From 816e7a67182db298c2d87e72b31fefc5a61d8a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 2 Dec 2023 11:42:58 +0100 Subject: [PATCH 0001/1506] mshtml: Disable -Wmisleading-indentation. --- configure.ac | 3 +++ dlls/mshtml/Makefile.in | 2 ++ tools/makedep.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index cba55126869..7eed4eb9233 100644 --- a/configure.ac +++ b/configure.ac @@ -817,6 +817,7 @@ enable_winemac_drv=${enable_winemac_drv:-no} dnl Check for cross compiler(s) AC_SUBST(PE_ARCHS,"") +AC_SUBST(MSHTML_CFLAGS,"") cross_archs= AS_VAR_SET_IF([enable_archs], [test "x$with_system_dllpath" = "x" || AC_MSG_ERROR("The --with-system-dllpath option is not compatible with --enable-archs") @@ -999,6 +1000,8 @@ This is an error since --enable-archs=$wine_arch was requested.])]) WINE_TRY_PE_CFLAGS([-Wlogical-op]) WINE_TRY_PE_CFLAGS([-Wabsolute-value]) WINE_TRY_PE_CFLAGS([-Wenum-conversion]) + WINE_TRY_PE_CFLAGS([-Wno-misleading-indentation], + [AS_VAR_APPEND([MSHTML_CFLAGS],[" -Wno-misleading-indentation"])]) case $wine_arch in i386) WINE_TRY_PE_CFLAGS([-fno-omit-frame-pointer]) diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 1e509a62e85..66c9f5ef1aa 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -3,6 +3,8 @@ IMPORTLIB = mshtml IMPORTS = strmiids uuid urlmon shlwapi shell32 ole32 oleaut32 user32 gdi32 advapi32 DELAYIMPORTS = wininet inetcomm +EXTRA_CFLAGS = $(MSHTML_CFLAGS) + SOURCES = \ conpoint.c \ dispex.c \ diff --git a/tools/makedep.c b/tools/makedep.c index 8ce575b15ca..92617142991 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -181,6 +181,7 @@ struct makefile struct strarray include_args; struct strarray define_args; struct strarray unix_cflags; + struct strarray extra_cflags; struct strarray programs; struct strarray scripts; struct strarray imports; @@ -3191,6 +3192,7 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), arch_make_variable( "CC", arch ), source->filename ); output_filenames( defines ); if (!source->use_msvcrt) output_filenames( make->unix_cflags ); + else output_filenames( make->extra_cflags ); output_filenames( make->extlib ? extra_cflags_extlib[arch] : extra_cflags[arch] ); if (!arch) { @@ -4249,6 +4251,7 @@ static void load_sources( struct makefile *make ) make->include_args = empty_strarray; make->define_args = empty_strarray; make->unix_cflags = empty_strarray; + make->extra_cflags = empty_strarray; if (!make->extlib) strarray_add( &make->define_args, "-D__WINESRC__" ); strarray_add( &make->unix_cflags, "-DWINE_UNIX_LIB" ); @@ -4270,6 +4273,7 @@ static void load_sources( struct makefile *make ) } strarray_addall( &make->define_args, get_expanded_make_var_array( make, "EXTRADEFS" )); strarray_addall_uniq( &make->unix_cflags, get_expanded_make_var_array( make, "UNIX_CFLAGS" )); + strarray_addall_uniq( &make->extra_cflags, get_expanded_make_var_array( make, "EXTRA_CFLAGS" )); strarray_add( &make->include_args, strmake( "-I%s", obj_dir_path( make, "" ))); if (make->src_dir) From 577e3f2078235a5441136576c37b72aedc8e3e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 10 Nov 2022 16:07:47 +0100 Subject: [PATCH 0002/1506] winevulkan: Add vk.xml version 1.3.267. Proton's build system uses that so we don't have to download the file each build. --- dlls/winevulkan/vk.xml | 25990 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 25990 insertions(+) create mode 100644 dlls/winevulkan/vk.xml diff --git a/dlls/winevulkan/vk.xml b/dlls/winevulkan/vk.xml new file mode 100644 index 00000000000..a696de6f012 --- /dev/null +++ b/dlls/winevulkan/vk.xml @@ -0,0 +1,25990 @@ + + + +Copyright 2015-2023 The Khronos Group Inc. + +SPDX-License-Identifier: Apache-2.0 OR MIT + + + +This file, vk.xml, is the Vulkan API Registry. It is a critically important +and normative part of the Vulkan Specification, including a canonical +machine-readable definition of the API, parameter and member validation +language incorporated into the Specification and reference pages, and other +material which is registered by Khronos, such as tags used by extension and +layer authors. The authoritative public version of vk.xml is maintained in +the default branch (currently named main) of the Khronos Vulkan GitHub +project. The authoritative private version is maintained in the default +branch of the member gitlab server. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #include "vk_platform.h" + + WSI extensions + + + + + + + + + + + + + + In the current header structure, each platform's interfaces + are confined to a platform-specific header (vulkan_xlib.h, + vulkan_win32.h, etc.). These headers are not self-contained, + and should not include native headers (X11/Xlib.h, + windows.h, etc.). Code should either include vulkan.h after + defining the appropriate VK_USE_PLATFORM_platform + macros, or include the required native headers prior to + explicitly including the corresponding platform header. + + To accomplish this, the dependencies of native types require + native headers, but the XML defines the content for those + native headers as empty. The actual native header includes + can be restored by modifying the native header tags above + to #include the header file in the 'name' attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. +#define VK_MAKE_VERSION(major, minor, patch) \ + ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) + // DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead. +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22U) + // DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead. +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) + // DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead. +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) + + #define VK_MAKE_API_VERSION(variant, major, minor, patch) \ + ((((uint32_t)(variant)) << 29U) | (((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) + #define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29U) + #define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22U) & 0x7FU) + #define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) + #define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) + + // Vulkan SC variant number +#define VKSC_API_VARIANT 1 + + // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. +//#define VK_API_VERSION VK_MAKE_API_VERSION(0, 1, 0, 0) // Patch version should always be set to 0 + // Vulkan 1.0 version number +#define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0)// Patch version should always be set to 0 + // Vulkan 1.1 version number +#define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0)// Patch version should always be set to 0 + // Vulkan 1.2 version number +#define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0)// Patch version should always be set to 0 + // Vulkan 1.3 version number +#define VK_API_VERSION_1_3 VK_MAKE_API_VERSION(0, 1, 3, 0)// Patch version should always be set to 0 + // Vulkan SC 1.0 version number +#define VKSC_API_VERSION_1_0 VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0)// Patch version should always be set to 0 + + // Version of this file +#define VK_HEADER_VERSION 267 + // Complete version of this file +#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) + // Version of this file +#define VK_HEADER_VERSION 13 + // Complete version of this file +#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, VK_HEADER_VERSION) + + +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* (object); + + +#ifndef VK_USE_64_BIT_PTR_DEFINES + #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) || (defined(__riscv) && __riscv_xlen == 64) + #define VK_USE_64_BIT_PTR_DEFINES 1 + #else + #define VK_USE_64_BIT_PTR_DEFINES 0 + #endif +#endif + +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) + #if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)) + #define VK_NULL_HANDLE nullptr + #else + #define VK_NULL_HANDLE ((void*)0) + #endif + #else + #define VK_NULL_HANDLE 0ULL + #endif +#endif +#ifndef VK_NULL_HANDLE + #define VK_NULL_HANDLE 0 +#endif + +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; + #else + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; + #endif +#endif + +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *(object); + #else + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t (object); + #endif +#endif + + struct ANativeWindow; + struct AHardwareBuffer; + #ifdef __OBJC__ +@class CAMetalLayer; +#else +typedef void CAMetalLayer; +#endif + #ifdef __OBJC__ +@protocol MTLDevice; +typedef id<MTLDevice> MTLDevice_id; +#else +typedef void* MTLDevice_id; +#endif + #ifdef __OBJC__ +@protocol MTLCommandQueue; +typedef id<MTLCommandQueue> MTLCommandQueue_id; +#else +typedef void* MTLCommandQueue_id; +#endif + #ifdef __OBJC__ +@protocol MTLBuffer; +typedef id<MTLBuffer> MTLBuffer_id; +#else +typedef void* MTLBuffer_id; +#endif + #ifdef __OBJC__ +@protocol MTLTexture; +typedef id<MTLTexture> MTLTexture_id; +#else +typedef void* MTLTexture_id; +#endif + #ifdef __OBJC__ +@protocol MTLSharedEvent; +typedef id<MTLSharedEvent> MTLSharedEvent_id; +#else +typedef void* MTLSharedEvent_id; +#endif + typedef struct __IOSurface* IOSurfaceRef; + + typedef uint32_t VkSampleMask; + typedef uint32_t VkBool32; + typedef uint32_t VkFlags; + typedef uint64_t VkFlags64; + typedef uint64_t VkDeviceSize; + typedef uint64_t VkDeviceAddress; + + Basic C types, pulled in via vk_platform.h + + + + + + + + + + + + + + + + Bitmask types + typedef VkFlags VkFramebufferCreateFlags; + typedef VkFlags VkQueryPoolCreateFlags; + typedef VkFlags VkRenderPassCreateFlags; + typedef VkFlags VkSamplerCreateFlags; + typedef VkFlags VkPipelineLayoutCreateFlags; + typedef VkFlags VkPipelineCacheCreateFlags; + typedef VkFlags VkPipelineDepthStencilStateCreateFlags; + typedef VkFlags VkPipelineDepthStencilStateCreateFlags; + typedef VkFlags VkPipelineDynamicStateCreateFlags; + typedef VkFlags VkPipelineColorBlendStateCreateFlags; + typedef VkFlags VkPipelineColorBlendStateCreateFlags; + typedef VkFlags VkPipelineMultisampleStateCreateFlags; + typedef VkFlags VkPipelineRasterizationStateCreateFlags; + typedef VkFlags VkPipelineViewportStateCreateFlags; + typedef VkFlags VkPipelineTessellationStateCreateFlags; + typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; + typedef VkFlags VkPipelineVertexInputStateCreateFlags; + typedef VkFlags VkPipelineShaderStageCreateFlags; + typedef VkFlags VkDescriptorSetLayoutCreateFlags; + typedef VkFlags VkBufferViewCreateFlags; + typedef VkFlags VkInstanceCreateFlags; + typedef VkFlags VkDeviceCreateFlags; + typedef VkFlags VkDeviceQueueCreateFlags; + typedef VkFlags VkQueueFlags; + typedef VkFlags VkMemoryPropertyFlags; + typedef VkFlags VkMemoryHeapFlags; + typedef VkFlags VkAccessFlags; + typedef VkFlags VkBufferUsageFlags; + typedef VkFlags VkBufferCreateFlags; + typedef VkFlags VkShaderStageFlags; + typedef VkFlags VkImageUsageFlags; + typedef VkFlags VkImageCreateFlags; + typedef VkFlags VkImageViewCreateFlags; + typedef VkFlags VkPipelineCreateFlags; + typedef VkFlags VkColorComponentFlags; + typedef VkFlags VkFenceCreateFlags; + typedef VkFlags VkSemaphoreCreateFlags; + typedef VkFlags VkFormatFeatureFlags; + typedef VkFlags VkQueryControlFlags; + typedef VkFlags VkQueryResultFlags; + typedef VkFlags VkShaderModuleCreateFlags; + typedef VkFlags VkEventCreateFlags; + typedef VkFlags VkCommandPoolCreateFlags; + typedef VkFlags VkCommandPoolResetFlags; + typedef VkFlags VkCommandBufferResetFlags; + typedef VkFlags VkCommandBufferUsageFlags; + typedef VkFlags VkQueryPipelineStatisticFlags; + typedef VkFlags VkMemoryMapFlags; + typedef VkFlags VkMemoryUnmapFlagsKHR; + typedef VkFlags VkImageAspectFlags; + typedef VkFlags VkSparseMemoryBindFlags; + typedef VkFlags VkSparseImageFormatFlags; + typedef VkFlags VkSubpassDescriptionFlags; + typedef VkFlags VkPipelineStageFlags; + typedef VkFlags VkSampleCountFlags; + typedef VkFlags VkAttachmentDescriptionFlags; + typedef VkFlags VkStencilFaceFlags; + typedef VkFlags VkCullModeFlags; + typedef VkFlags VkDescriptorPoolCreateFlags; + typedef VkFlags VkDescriptorPoolResetFlags; + typedef VkFlags VkDependencyFlags; + typedef VkFlags VkSubgroupFeatureFlags; + typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNV; + typedef VkFlags VkIndirectStateFlagsNV; + typedef VkFlags VkGeometryFlagsKHR; + + typedef VkFlags VkGeometryInstanceFlagsKHR; + + typedef VkFlags VkBuildAccelerationStructureFlagsKHR; + + typedef VkFlags VkPrivateDataSlotCreateFlags; + + typedef VkFlags VkAccelerationStructureCreateFlagsKHR; + typedef VkFlags VkDescriptorUpdateTemplateCreateFlags; + + typedef VkFlags VkPipelineCreationFeedbackFlags; + + typedef VkFlags VkPerformanceCounterDescriptionFlagsKHR; + typedef VkFlags VkAcquireProfilingLockFlagsKHR; + typedef VkFlags VkSemaphoreWaitFlags; + + typedef VkFlags VkPipelineCompilerControlFlagsAMD; + typedef VkFlags VkShaderCorePropertiesFlagsAMD; + typedef VkFlags VkDeviceDiagnosticsConfigFlagsNV; + typedef VkFlags VkRefreshObjectFlagsKHR; + typedef VkFlags64 VkAccessFlags2; + + typedef VkFlags64 VkPipelineStageFlags2; + + typedef VkFlags VkAccelerationStructureMotionInfoFlagsNV; + typedef VkFlags VkAccelerationStructureMotionInstanceFlagsNV; + typedef VkFlags64 VkFormatFeatureFlags2; + + typedef VkFlags VkRenderingFlags; + typedef VkFlags64 VkMemoryDecompressionMethodFlagsNV; + + typedef VkFlags VkBuildMicromapFlagsEXT; + typedef VkFlags VkMicromapCreateFlagsEXT; + typedef VkFlags VkDirectDriverLoadingFlagsLUNARG; + typedef VkFlags64 VkPipelineCreateFlags2KHR; + typedef VkFlags64 VkBufferUsageFlags2KHR; + + WSI extensions + typedef VkFlags VkCompositeAlphaFlagsKHR; + typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; + typedef VkFlags VkSurfaceTransformFlagsKHR; + typedef VkFlags VkSwapchainCreateFlagsKHR; + typedef VkFlags VkDisplayModeCreateFlagsKHR; + typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; + typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; + typedef VkFlags VkViSurfaceCreateFlagsNN; + typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; + typedef VkFlags VkWin32SurfaceCreateFlagsKHR; + typedef VkFlags VkXlibSurfaceCreateFlagsKHR; + typedef VkFlags VkXcbSurfaceCreateFlagsKHR; + typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; + typedef VkFlags VkIOSSurfaceCreateFlagsMVK; + typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; + typedef VkFlags VkMetalSurfaceCreateFlagsEXT; + typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA; + typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; + typedef VkFlags VkHeadlessSurfaceCreateFlagsEXT; + typedef VkFlags VkScreenSurfaceCreateFlagsQNX; + typedef VkFlags VkPeerMemoryFeatureFlags; + + typedef VkFlags VkMemoryAllocateFlags; + + typedef VkFlags VkDeviceGroupPresentModeFlagsKHR; + + typedef VkFlags VkDebugReportFlagsEXT; + typedef VkFlags VkCommandPoolTrimFlags; + + typedef VkFlags VkExternalMemoryHandleTypeFlagsNV; + typedef VkFlags VkExternalMemoryFeatureFlagsNV; + typedef VkFlags VkExternalMemoryHandleTypeFlags; + + typedef VkFlags VkExternalMemoryFeatureFlags; + + typedef VkFlags VkExternalSemaphoreHandleTypeFlags; + + typedef VkFlags VkExternalSemaphoreFeatureFlags; + + typedef VkFlags VkSemaphoreImportFlags; + + typedef VkFlags VkExternalFenceHandleTypeFlags; + + typedef VkFlags VkExternalFenceFeatureFlags; + + typedef VkFlags VkFenceImportFlags; + + typedef VkFlags VkSurfaceCounterFlagsEXT; + typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV; + typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT; + typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; + typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; + typedef VkFlags VkPipelineCoverageReductionStateCreateFlagsNV; + typedef VkFlags VkValidationCacheCreateFlagsEXT; + typedef VkFlags VkDebugUtilsMessageSeverityFlagsEXT; + typedef VkFlags VkDebugUtilsMessageTypeFlagsEXT; + typedef VkFlags VkDebugUtilsMessengerCreateFlagsEXT; + typedef VkFlags VkDebugUtilsMessengerCallbackDataFlagsEXT; + typedef VkFlags VkDeviceMemoryReportFlagsEXT; + typedef VkFlags VkPipelineRasterizationConservativeStateCreateFlagsEXT; + typedef VkFlags VkDescriptorBindingFlags; + + typedef VkFlags VkConditionalRenderingFlagsEXT; + typedef VkFlags VkResolveModeFlags; + + typedef VkFlags VkPipelineRasterizationStateStreamCreateFlagsEXT; + typedef VkFlags VkPipelineRasterizationDepthClipStateCreateFlagsEXT; + typedef VkFlags VkSwapchainImageUsageFlagsANDROID; + typedef VkFlags VkToolPurposeFlags; + + typedef VkFlags VkSubmitFlags; + + typedef VkFlags VkImageFormatConstraintsFlagsFUCHSIA; + typedef VkFlags VkHostImageCopyFlagsEXT; + typedef VkFlags VkImageConstraintsInfoFlagsFUCHSIA; + typedef VkFlags VkGraphicsPipelineLibraryFlagsEXT; + typedef VkFlags VkImageCompressionFlagsEXT; + typedef VkFlags VkImageCompressionFixedRateFlagsEXT; + typedef VkFlags VkExportMetalObjectTypeFlagsEXT; + typedef VkFlags VkDeviceAddressBindingFlagsEXT; + typedef VkFlags VkOpticalFlowGridSizeFlagsNV; + typedef VkFlags VkOpticalFlowUsageFlagsNV; + typedef VkFlags VkOpticalFlowSessionCreateFlagsNV; + typedef VkFlags VkOpticalFlowExecuteFlagsNV; + typedef VkFlags VkFrameBoundaryFlagsEXT; + typedef VkFlags VkPresentScalingFlagsEXT; + typedef VkFlags VkPresentGravityFlagsEXT; + typedef VkFlags VkShaderCreateFlagsEXT; + + Video Core extension + typedef VkFlags VkVideoCodecOperationFlagsKHR; + typedef VkFlags VkVideoCapabilityFlagsKHR; + typedef VkFlags VkVideoSessionCreateFlagsKHR; + typedef VkFlags VkVideoSessionParametersCreateFlagsKHR; + typedef VkFlags VkVideoBeginCodingFlagsKHR; + typedef VkFlags VkVideoEndCodingFlagsKHR; + typedef VkFlags VkVideoCodingControlFlagsKHR; + + Video Decode Core extension + typedef VkFlags VkVideoDecodeUsageFlagsKHR; + typedef VkFlags VkVideoDecodeCapabilityFlagsKHR; + typedef VkFlags VkVideoDecodeFlagsKHR; + + Video Decode H.264 extension + typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsKHR; + + Video Encode Core extension + typedef VkFlags VkVideoEncodeFlagsKHR; + typedef VkFlags VkVideoEncodeUsageFlagsKHR; + typedef VkFlags VkVideoEncodeContentFlagsKHR; + typedef VkFlags VkVideoEncodeCapabilityFlagsKHR; + typedef VkFlags VkVideoEncodeFeedbackFlagsKHR; + typedef VkFlags VkVideoEncodeRateControlFlagsKHR; + typedef VkFlags VkVideoEncodeRateControlModeFlagsKHR; + typedef VkFlags VkVideoChromaSubsamplingFlagsKHR; + typedef VkFlags VkVideoComponentBitDepthFlagsKHR; + + Video Encode H.264 extension + typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT; + typedef VkFlags VkVideoEncodeH264StdFlagsEXT; + typedef VkFlags VkVideoEncodeH264RateControlFlagsEXT; + + Video Encode H.265 extension + typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT; + typedef VkFlags VkVideoEncodeH265StdFlagsEXT; + typedef VkFlags VkVideoEncodeH265RateControlFlagsEXT; + typedef VkFlags VkVideoEncodeH265CtbSizeFlagsEXT; + typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsEXT; + + Types which can be void pointers or class pointers, selected at compile time + VK_DEFINE_HANDLE(VkInstance) + VK_DEFINE_HANDLE(VkPhysicalDevice) + VK_DEFINE_HANDLE(VkDevice) + VK_DEFINE_HANDLE(VkQueue) + VK_DEFINE_HANDLE(VkCommandBuffer) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNV) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplate) + + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion) + + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPerformanceConfigurationINTEL) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeferredOperationKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPrivateDataSlot) + + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuModuleNVX) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuFunctionNVX) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkOpticalFlowSessionNV) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkMicromapEXT) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderEXT) + + WSI extensions + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugUtilsMessengerEXT) + + Video extensions + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR) + + VK_NV_external_sci_sync2 + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphoreSciSyncPoolNV) + + Types generated from corresponding enums tags below + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extensions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WSI extensions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Enumerated types in the header, but not used by the API + + + + + + + + Video Core extensions + + + + + + + + + Video Decode extensions + + + + Video H.264 Decode extensions + + + Video H.265 Decode extensions + + Video Encode extensions + + + + + + + + Video H.264 Encode extensions + + + + + Video H.265 Encode extensions + + + + + + + The PFN_vk*Function types are used by VkAllocationCallbacks below + typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( + void* pUserData, + void* pOriginal, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( + void* pUserData, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + typedef void (VKAPI_PTR *PFN_vkFreeFunction)( + void* pUserData, + void* pMemory); + + The PFN_vkVoidFunction type are used by VkGet*ProcAddr below + typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); + + The PFN_vkDebugReportCallbackEXT type are used by the DEBUG_REPORT extension + typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage, + void* pUserData); + + The PFN_vkDebugUtilsMessengerCallbackEXT type are used by the VK_EXT_debug_utils extension + typedef VkBool32 (VKAPI_PTR *PFN_vkDebugUtilsMessengerCallbackEXT)( + VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT messageTypes, + const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, + void* pUserData); + + The PFN_vkFaultCallbackFunction type is used by VKSC_VERSION_1_0 + typedef void (VKAPI_PTR *PFN_vkFaultCallbackFunction)( + VkBool32 unrecordedFaults, + uint32_t faultCount, + const VkFaultData* pFaults); + + The PFN_vkDeviceMemoryReportCallbackEXT type is used by the VK_EXT_device_memory_report extension + typedef void (VKAPI_PTR *PFN_vkDeviceMemoryReportCallbackEXT)( + const VkDeviceMemoryReportCallbackDataEXT* pCallbackData, + void* pUserData); + + The PFN_vkGetInstanceProcAddrLUNARG type is used by the + VkDirectDriverLoadingInfoLUNARG structure. + We cannot introduce an explicit dependency on the + equivalent PFN_vkGetInstanceProcAddr type, even though + it is implicitly generated in the C header, because + that results in multiple definitions. + typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddrLUNARG)( + VkInstance instance, const char* pName); + + Struct types + + VkStructureType sType + struct VkBaseOutStructure* pNext + + + VkStructureType sType + const struct VkBaseInStructure* pNext + + + int32_t x + int32_t y + + + int32_t x + int32_t y + int32_t z + + + uint32_t width + uint32_t height + + + uint32_t width + uint32_t height + uint32_t depth + + + float x + float y + float width + float height + float minDepth + float maxDepth + + + VkOffset2D offset + VkExtent2D extent + + + VkRect2D rect + uint32_t baseArrayLayer + uint32_t layerCount + + + VkComponentSwizzle r + VkComponentSwizzle g + VkComponentSwizzle b + VkComponentSwizzle a + + + uint32_t apiVersion + uint32_t driverVersion + uint32_t vendorID + uint32_t deviceID + VkPhysicalDeviceType deviceType + char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] + uint8_t pipelineCacheUUID[VK_UUID_SIZE] + VkPhysicalDeviceLimits limits + VkPhysicalDeviceSparseProperties sparseProperties + + + char extensionName[VK_MAX_EXTENSION_NAME_SIZE]extension name + uint32_t specVersionversion of the extension specification implemented + + + char layerName[VK_MAX_EXTENSION_NAME_SIZE]layer name + uint32_t specVersionversion of the layer specification implemented + uint32_t implementationVersionbuild or release version of the layer's library + char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the layer + + + VkStructureType sType + const void* pNext + const char* pApplicationName + uint32_t applicationVersion + const char* pEngineName + uint32_t engineVersion + uint32_t apiVersion + + + void* pUserData + PFN_vkAllocationFunction pfnAllocation + PFN_vkReallocationFunction pfnReallocation + PFN_vkFreeFunction pfnFree + PFN_vkInternalAllocationNotification pfnInternalAllocation + PFN_vkInternalFreeNotification pfnInternalFree + + + VkStructureType sType + const void* pNext + VkDeviceQueueCreateFlags flags + uint32_t queueFamilyIndex + uint32_t queueCount + const float* pQueuePriorities + + + VkStructureType sType + const void* pNext + VkDeviceCreateFlags flags + uint32_t queueCreateInfoCount + const VkDeviceQueueCreateInfo* pQueueCreateInfos + uint32_t enabledLayerCount + const char* const* ppEnabledLayerNamesOrdered list of layer names to be enabled + uint32_t enabledExtensionCount + const char* const* ppEnabledExtensionNames + const VkPhysicalDeviceFeatures* pEnabledFeatures + + + VkStructureType sType + const void* pNext + VkInstanceCreateFlags flags + const VkApplicationInfo* pApplicationInfo + uint32_t enabledLayerCount + const char* const* ppEnabledLayerNamesOrdered list of layer names to be enabled + uint32_t enabledExtensionCount + const char* const* ppEnabledExtensionNamesExtension names to be enabled + + + VkQueueFlags queueFlagsQueue flags + uint32_t queueCount + uint32_t timestampValidBits + VkExtent3D minImageTransferGranularityMinimum alignment requirement for image transfers + + + uint32_t memoryTypeCount + VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES] + uint32_t memoryHeapCount + VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS] + + + VkStructureType sType + const void* pNext + VkDeviceSize allocationSizeSize of memory allocation + uint32_t memoryTypeIndexIndex of the of the memory type to allocate from + + + VkDeviceSize sizeSpecified in bytes + VkDeviceSize alignmentSpecified in bytes + uint32_t memoryTypeBitsBitmask of the allowed memory type indices into memoryTypes[] for this object + + + VkImageAspectFlags aspectMask + VkExtent3D imageGranularity + VkSparseImageFormatFlags flags + + + VkSparseImageFormatProperties formatProperties + uint32_t imageMipTailFirstLod + VkDeviceSize imageMipTailSizeSpecified in bytes, must be a multiple of sparse block size in bytes / alignment + VkDeviceSize imageMipTailOffsetSpecified in bytes, must be a multiple of sparse block size in bytes / alignment + VkDeviceSize imageMipTailStrideSpecified in bytes, must be a multiple of sparse block size in bytes / alignment + + + VkMemoryPropertyFlags propertyFlagsMemory properties of this memory type + uint32_t heapIndexIndex of the memory heap allocations of this memory type are taken from + + + VkDeviceSize sizeAvailable memory in the heap + VkMemoryHeapFlags flagsFlags for the heap + + + VkStructureType sType + const void* pNext + VkDeviceMemory memoryMapped memory object + VkDeviceSize offsetOffset within the memory object where the range starts + VkDeviceSize sizeSize of the range within the memory object + + + VkFormatFeatureFlags linearTilingFeaturesFormat features in case of linear tiling + VkFormatFeatureFlags optimalTilingFeaturesFormat features in case of optimal tiling + VkFormatFeatureFlags bufferFeaturesFormat features supported by buffers + + + VkExtent3D maxExtentmax image dimensions for this resource type + uint32_t maxMipLevelsmax number of mipmap levels for this resource type + uint32_t maxArrayLayersmax array size for this resource type + VkSampleCountFlags sampleCountssupported sample counts for this resource type + VkDeviceSize maxResourceSizemax size (in bytes) of this resource type + + + VkBuffer bufferBuffer used for this descriptor slot. + VkDeviceSize offsetBase offset from buffer start in bytes to update in the descriptor set. + VkDeviceSize rangeSize in bytes of the buffer resource for this descriptor update. + + + VkSampler samplerSampler to write to the descriptor in case it is a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor. Ignored otherwise. + VkImageView imageViewImage view to write to the descriptor in case it is a SAMPLED_IMAGE, STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, or INPUT_ATTACHMENT descriptor. Ignored otherwise. + VkImageLayout imageLayoutLayout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE). + + + VkStructureType sType + const void* pNext + VkDescriptorSet dstSetDestination descriptor set + uint32_t dstBindingBinding within the destination descriptor set to write + uint32_t dstArrayElementArray element within the destination binding to write + uint32_t descriptorCountNumber of descriptors to write (determines the size of the array pointed by pDescriptors) + VkDescriptorType descriptorTypeDescriptor type to write (determines which members of the array pointed by pDescriptors are going to be used) + const VkDescriptorImageInfo* pImageInfoSampler, image view, and layout for SAMPLER, COMBINED_IMAGE_SAMPLER, {SAMPLED,STORAGE}_IMAGE, and INPUT_ATTACHMENT descriptor types. + const VkDescriptorBufferInfo* pBufferInfoRaw buffer, size, and offset for {UNIFORM,STORAGE}_BUFFER[_DYNAMIC] descriptor types. + const VkBufferView* pTexelBufferViewBuffer view to write to the descriptor for {UNIFORM,STORAGE}_TEXEL_BUFFER descriptor types. + + + VkStructureType sType + const void* pNext + VkDescriptorSet srcSetSource descriptor set + uint32_t srcBindingBinding within the source descriptor set to copy from + uint32_t srcArrayElementArray element within the source binding to copy from + VkDescriptorSet dstSetDestination descriptor set + uint32_t dstBindingBinding within the destination descriptor set to copy to + uint32_t dstArrayElementArray element within the destination binding to copy to + uint32_t descriptorCountNumber of descriptors to write (determines the size of the array pointed by pDescriptors) + + + VkStructureType sType + const void* pNext + VkBufferUsageFlags2KHR usage + + + VkStructureType sType + const void* pNext + VkBufferCreateFlags flagsBuffer creation flags + VkDeviceSize sizeSpecified in bytes + VkBufferUsageFlags usageBuffer usage flags + VkSharingMode sharingMode + uint32_t queueFamilyIndexCount + const uint32_t* pQueueFamilyIndices + + + VkStructureType sType + const void* pNext + VkBufferViewCreateFlags flags + VkBuffer buffer + VkFormat formatOptionally specifies format of elements + VkDeviceSize offsetSpecified in bytes + VkDeviceSize rangeView size specified in bytes + + + VkImageAspectFlags aspectMask + uint32_t mipLevel + uint32_t arrayLayer + + + VkImageAspectFlags aspectMask + uint32_t mipLevel + uint32_t baseArrayLayer + uint32_t layerCount + + + VkImageAspectFlags aspectMask + uint32_t baseMipLevel + uint32_t levelCount + uint32_t baseArrayLayer + uint32_t layerCount + + + VkStructureType sType + const void* pNext + VkAccessFlags srcAccessMaskMemory accesses from the source of the dependency to synchronize + VkAccessFlags dstAccessMaskMemory accesses from the destination of the dependency to synchronize + + + VkStructureType sType + const void* pNext + VkAccessFlags srcAccessMaskMemory accesses from the source of the dependency to synchronize + VkAccessFlags dstAccessMaskMemory accesses from the destination of the dependency to synchronize + uint32_t srcQueueFamilyIndexQueue family to transition ownership from + uint32_t dstQueueFamilyIndexQueue family to transition ownership to + VkBuffer bufferBuffer to sync + VkDeviceSize offsetOffset within the buffer to sync + VkDeviceSize sizeAmount of bytes to sync + + + VkStructureType sType + const void* pNext + VkAccessFlags srcAccessMaskMemory accesses from the source of the dependency to synchronize + VkAccessFlags dstAccessMaskMemory accesses from the destination of the dependency to synchronize + VkImageLayout oldLayoutCurrent layout of the image + VkImageLayout newLayoutNew layout to transition the image to + uint32_t srcQueueFamilyIndexQueue family to transition ownership from + uint32_t dstQueueFamilyIndexQueue family to transition ownership to + VkImage imageImage to sync + VkImageSubresourceRange subresourceRangeSubresource range to sync + + + VkStructureType sType + const void* pNext + VkImageCreateFlags flagsImage creation flags + VkImageType imageType + VkFormat format + VkExtent3D extent + uint32_t mipLevels + uint32_t arrayLayers + VkSampleCountFlagBits samples + VkImageTiling tiling + VkImageUsageFlags usageImage usage flags + VkSharingMode sharingModeCross-queue-family sharing mode + uint32_t queueFamilyIndexCountNumber of queue families to share across + const uint32_t* pQueueFamilyIndicesArray of queue family indices to share across + VkImageLayout initialLayoutInitial image layout for all subresources + + + VkDeviceSize offsetSpecified in bytes + VkDeviceSize sizeSpecified in bytes + VkDeviceSize rowPitchSpecified in bytes + VkDeviceSize arrayPitchSpecified in bytes + VkDeviceSize depthPitchSpecified in bytes + + + VkStructureType sType + const void* pNext + VkImageViewCreateFlags flags + VkImage image + VkImageViewType viewType + VkFormat format + VkComponentMapping components + VkImageSubresourceRange subresourceRange + + + VkDeviceSize srcOffsetSpecified in bytes + VkDeviceSize dstOffsetSpecified in bytes + VkDeviceSize sizeSpecified in bytes + + + VkDeviceSize resourceOffsetSpecified in bytes + VkDeviceSize sizeSpecified in bytes + VkDeviceMemory memory + VkDeviceSize memoryOffsetSpecified in bytes + VkSparseMemoryBindFlags flags + + + VkImageSubresource subresource + VkOffset3D offset + VkExtent3D extent + VkDeviceMemory memory + VkDeviceSize memoryOffsetSpecified in bytes + VkSparseMemoryBindFlags flags + + + VkBuffer buffer + uint32_t bindCount + const VkSparseMemoryBind* pBinds + + + VkImage image + uint32_t bindCount + const VkSparseMemoryBind* pBinds + + + VkImage image + uint32_t bindCount + const VkSparseImageMemoryBind* pBinds + + + VkStructureType sType + const void* pNext + uint32_t waitSemaphoreCount + const VkSemaphore* pWaitSemaphores + uint32_t bufferBindCount + const VkSparseBufferMemoryBindInfo* pBufferBinds + uint32_t imageOpaqueBindCount + const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds + uint32_t imageBindCount + const VkSparseImageMemoryBindInfo* pImageBinds + uint32_t signalSemaphoreCount + const VkSemaphore* pSignalSemaphores + + + VkImageSubresourceLayers srcSubresource + VkOffset3D srcOffsetSpecified in pixels for both compressed and uncompressed images + VkImageSubresourceLayers dstSubresource + VkOffset3D dstOffsetSpecified in pixels for both compressed and uncompressed images + VkExtent3D extentSpecified in pixels for both compressed and uncompressed images + + + VkImageSubresourceLayers srcSubresource + VkOffset3D srcOffsets[2]Specified in pixels for both compressed and uncompressed images + VkImageSubresourceLayers dstSubresource + VkOffset3D dstOffsets[2]Specified in pixels for both compressed and uncompressed images + + + VkDeviceSize bufferOffsetSpecified in bytes + uint32_t bufferRowLengthSpecified in texels + uint32_t bufferImageHeight + VkImageSubresourceLayers imageSubresource + VkOffset3D imageOffsetSpecified in pixels for both compressed and uncompressed images + VkExtent3D imageExtentSpecified in pixels for both compressed and uncompressed images + + + VkDeviceAddress srcAddress + VkDeviceAddress dstAddress + VkDeviceSize sizeSpecified in bytes + + + VkDeviceAddress srcAddress + uint32_t bufferRowLengthSpecified in texels + uint32_t bufferImageHeight + VkImageSubresourceLayers imageSubresource + VkOffset3D imageOffsetSpecified in pixels for both compressed and uncompressed images + VkExtent3D imageExtentSpecified in pixels for both compressed and uncompressed images + + + VkImageSubresourceLayers srcSubresource + VkOffset3D srcOffset + VkImageSubresourceLayers dstSubresource + VkOffset3D dstOffset + VkExtent3D extent + + + VkStructureType sType + const void* pNextnoautovalidity because this structure can be either an explicit parameter, or passed in a pNext chain + VkShaderModuleCreateFlags flags + size_t codeSizeSpecified in bytes + const uint32_t* pCodeBinary code of size codeSize + + + uint32_t bindingBinding number for this entry + VkDescriptorType descriptorTypeType of the descriptors in this binding + uint32_t descriptorCountNumber of descriptors in this binding + VkShaderStageFlags stageFlagsShader stages this binding is visible to + const VkSampler* pImmutableSamplersImmutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains count number of elements) + + + VkStructureType sType + const void* pNext + VkDescriptorSetLayoutCreateFlags flags + uint32_t bindingCountNumber of bindings in the descriptor set layout + const VkDescriptorSetLayoutBinding* pBindingsArray of descriptor set layout bindings + + + VkDescriptorType type + uint32_t descriptorCount + + + VkStructureType sType + const void* pNext + VkDescriptorPoolCreateFlags flags + uint32_t maxSets + uint32_t poolSizeCount + const VkDescriptorPoolSize* pPoolSizes + + + VkStructureType sType + const void* pNext + VkDescriptorPool descriptorPool + uint32_t descriptorSetCount + const VkDescriptorSetLayout* pSetLayouts + + + uint32_t constantIDThe SpecConstant ID specified in the BIL + uint32_t offsetOffset of the value in the data block + size_t sizeSize in bytes of the SpecConstant + + + uint32_t mapEntryCountNumber of entries in the map + const VkSpecializationMapEntry* pMapEntriesArray of map entries + size_t dataSizeSize in bytes of pData + const void* pDataPointer to SpecConstant data + + + VkStructureType sType + const void* pNext + VkPipelineShaderStageCreateFlags flags + VkShaderStageFlagBits stageShader stage + VkShaderModule moduleModule containing entry point + const char* pNameNull-terminated entry point name + const char* pNameNull-terminated entry point name + const VkSpecializationInfo* pSpecializationInfo + + + VkStructureType sType + const void* pNext + VkPipelineCreateFlags flagsPipeline creation flags + VkPipelineShaderStageCreateInfo stage + VkPipelineLayout layoutInterface layout of the pipeline + VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of + int32_t basePipelineIndexIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of + + + VkStructureType sType + const void* pNext + VkDeviceAddress deviceAddress + VkDeviceSize size + VkDeviceAddress pipelineDeviceAddressCaptureReplay + + + VkStructureType sType + const void* pNext + VkPipelineCreateFlags2KHR flags + + + uint32_t bindingVertex buffer binding id + uint32_t strideDistance between vertices in bytes (0 = no advancement) + VkVertexInputRate inputRateThe rate at which the vertex data is consumed + + + uint32_t locationlocation of the shader vertex attrib + uint32_t bindingVertex buffer binding id + VkFormat formatformat of source data + uint32_t offsetOffset of first element in bytes from base of vertex + + + VkStructureType sType + const void* pNext + VkPipelineVertexInputStateCreateFlags flags + uint32_t vertexBindingDescriptionCountnumber of bindings + const VkVertexInputBindingDescription* pVertexBindingDescriptions + uint32_t vertexAttributeDescriptionCountnumber of attributes + const VkVertexInputAttributeDescription* pVertexAttributeDescriptions + + + VkStructureType sType + const void* pNext + VkPipelineInputAssemblyStateCreateFlags flags + VkPrimitiveTopology topology + VkBool32 primitiveRestartEnable + + + VkStructureType sType + const void* pNext + VkPipelineTessellationStateCreateFlags flags + uint32_t patchControlPoints + + + VkStructureType sType + const void* pNext + VkPipelineViewportStateCreateFlags flags + uint32_t viewportCount + const VkViewport* pViewports + uint32_t scissorCount + const VkRect2D* pScissors + + + VkStructureType sType + const void* pNext + VkPipelineRasterizationStateCreateFlags flags + VkBool32 depthClampEnable + VkBool32 rasterizerDiscardEnable + VkPolygonMode polygonModeoptional (GL45) + VkCullModeFlags cullMode + VkFrontFace frontFace + VkBool32 depthBiasEnable + float depthBiasConstantFactor + float depthBiasClamp + float depthBiasSlopeFactor + float lineWidth + + + VkStructureType sType + const void* pNext + VkPipelineMultisampleStateCreateFlags flags + VkSampleCountFlagBits rasterizationSamplesNumber of samples used for rasterization + VkBool32 sampleShadingEnableoptional (GL45) + float minSampleShadingoptional (GL45) + const VkSampleMask* pSampleMaskArray of sampleMask words + VkBool32 alphaToCoverageEnable + VkBool32 alphaToOneEnable + + + VkBool32 blendEnable + VkBlendFactor srcColorBlendFactor + VkBlendFactor dstColorBlendFactor + VkBlendOp colorBlendOp + VkBlendFactor srcAlphaBlendFactor + VkBlendFactor dstAlphaBlendFactor + VkBlendOp alphaBlendOp + VkColorComponentFlags colorWriteMask + + + VkStructureType sType + const void* pNext + VkPipelineColorBlendStateCreateFlags flags + VkBool32 logicOpEnable + VkLogicOp logicOp + uint32_t attachmentCount# of pAttachments + const VkPipelineColorBlendAttachmentState* pAttachments + float blendConstants[4] + + + VkStructureType sType + const void* pNext + VkPipelineDynamicStateCreateFlags flags + uint32_t dynamicStateCount + const VkDynamicState* pDynamicStates + + + VkStencilOp failOp + VkStencilOp passOp + VkStencilOp depthFailOp + VkCompareOp compareOp + uint32_t compareMask + uint32_t writeMask + uint32_t reference + + + VkStructureType sType + const void* pNext + VkPipelineDepthStencilStateCreateFlags flags + VkBool32 depthTestEnable + VkBool32 depthWriteEnable + VkCompareOp depthCompareOp + VkBool32 depthBoundsTestEnableoptional (depth_bounds_test) + VkBool32 stencilTestEnable + VkStencilOpState front + VkStencilOpState back + float minDepthBounds + float maxDepthBounds + + + VkStructureType sType + const void* pNext + VkPipelineCreateFlags flagsPipeline creation flags + uint32_t stageCount + const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage + const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage + const VkPipelineVertexInputStateCreateInfo* pVertexInputState + const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState + const VkPipelineTessellationStateCreateInfo* pTessellationState + const VkPipelineViewportStateCreateInfo* pViewportState + const VkPipelineRasterizationStateCreateInfo* pRasterizationState + const VkPipelineMultisampleStateCreateInfo* pMultisampleState + const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState + const VkPipelineColorBlendStateCreateInfo* pColorBlendState + const VkPipelineDynamicStateCreateInfo* pDynamicState + VkPipelineLayout layoutInterface layout of the pipeline + VkRenderPass renderPass + uint32_t subpass + VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of + int32_t basePipelineIndexIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of + + + VkStructureType sType + const void* pNext + VkPipelineCacheCreateFlags flags + size_t initialDataSizeSize of initial data to populate cache, in bytes + size_t initialDataSizeSize of initial data to populate cache, in bytes + const void* pInitialDataInitial data to populate cache + + + The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout. + uint32_t headerSize + VkPipelineCacheHeaderVersion headerVersion + uint32_t vendorID + uint32_t deviceID + uint8_t pipelineCacheUUID[VK_UUID_SIZE] + + + The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout. + uint64_t codeSize + uint64_t codeOffset + + + The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout. + uint8_t pipelineIdentifier[VK_UUID_SIZE] + uint64_t pipelineMemorySize + uint64_t jsonSize + uint64_t jsonOffset + uint32_t stageIndexCount + uint32_t stageIndexStride + uint64_t stageIndexOffset + + + The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout. + VkPipelineCacheHeaderVersionOne headerVersionOne + VkPipelineCacheValidationVersion validationVersion + uint32_t implementationData + uint32_t pipelineIndexCount + uint32_t pipelineIndexStride + uint64_t pipelineIndexOffset + + + VkShaderStageFlags stageFlagsWhich stages use the range + uint32_t offsetStart of the range, in bytes + uint32_t sizeSize of the range, in bytes + + + VkStructureType sType + const void* pNext + VkPipelineLayoutCreateFlags flags + uint32_t setLayoutCountNumber of descriptor sets interfaced by the pipeline + const VkDescriptorSetLayout* pSetLayoutsArray of setCount number of descriptor set layout objects defining the layout of the + uint32_t pushConstantRangeCountNumber of push-constant ranges used by the pipeline + const VkPushConstantRange* pPushConstantRangesArray of pushConstantRangeCount number of ranges used by various shader stages + + + VkStructureType sType + const void* pNext + VkSamplerCreateFlags flags + VkFilter magFilterFilter mode for magnification + VkFilter minFilterFilter mode for minifiation + VkSamplerMipmapMode mipmapModeMipmap selection mode + VkSamplerAddressMode addressModeU + VkSamplerAddressMode addressModeV + VkSamplerAddressMode addressModeW + float mipLodBias + VkBool32 anisotropyEnable + float maxAnisotropy + VkBool32 compareEnable + VkCompareOp compareOp + float minLod + float maxLod + VkBorderColor borderColor + VkBool32 unnormalizedCoordinates + + + VkStructureType sType + const void* pNext + VkCommandPoolCreateFlags flagsCommand pool creation flags + uint32_t queueFamilyIndex + + + VkStructureType sType + const void* pNext + VkCommandPool commandPool + VkCommandBufferLevel level + uint32_t commandBufferCount + + + VkStructureType sType + const void* pNext + VkRenderPass renderPassRender pass for secondary command buffers + uint32_t subpass + VkFramebuffer framebufferFramebuffer for secondary command buffers + VkBool32 occlusionQueryEnableWhether this secondary command buffer may be executed during an occlusion query + VkQueryControlFlags queryFlagsQuery flags used by this secondary command buffer, if executed during an occlusion query + VkQueryPipelineStatisticFlags pipelineStatisticsPipeline statistics that may be counted for this secondary command buffer + + + VkStructureType sType + const void* pNext + VkCommandBufferUsageFlags flagsCommand buffer usage flags + const VkCommandBufferInheritanceInfo* pInheritanceInfoPointer to inheritance info for secondary command buffers + + + VkStructureType sType + const void* pNext + VkRenderPass renderPass + VkFramebuffer framebuffer + VkRect2D renderArea + uint32_t clearValueCount + const VkClearValue* pClearValues + + + float float32[4] + int32_t int32[4] + uint32_t uint32[4] + + + float depth + uint32_t stencil + + + VkClearColorValue color + VkClearDepthStencilValue depthStencil + + + VkImageAspectFlags aspectMask + uint32_t colorAttachment + VkClearValue clearValue + + + VkAttachmentDescriptionFlags flags + VkFormat format + VkSampleCountFlagBits samples + VkAttachmentLoadOp loadOpLoad operation for color or depth data + VkAttachmentStoreOp storeOpStore operation for color or depth data + VkAttachmentLoadOp stencilLoadOpLoad operation for stencil data + VkAttachmentStoreOp stencilStoreOpStore operation for stencil data + VkImageLayout initialLayout + VkImageLayout finalLayout + + + uint32_t attachment + VkImageLayout layout + + + VkSubpassDescriptionFlags flags + VkPipelineBindPoint pipelineBindPointMust be VK_PIPELINE_BIND_POINT_GRAPHICS for now + uint32_t inputAttachmentCount + const VkAttachmentReference* pInputAttachments + uint32_t colorAttachmentCount + const VkAttachmentReference* pColorAttachments + const VkAttachmentReference* pResolveAttachments + const VkAttachmentReference* pDepthStencilAttachment + uint32_t preserveAttachmentCount + const uint32_t* pPreserveAttachments + + + uint32_t srcSubpass + uint32_t dstSubpass + VkPipelineStageFlags srcStageMask + VkPipelineStageFlags dstStageMask + VkAccessFlags srcAccessMaskMemory accesses from the source of the dependency to synchronize + VkAccessFlags dstAccessMaskMemory accesses from the destination of the dependency to synchronize + VkDependencyFlags dependencyFlags + + + VkStructureType sType + const void* pNext + VkRenderPassCreateFlags flags + uint32_t attachmentCount + const VkAttachmentDescription* pAttachments + uint32_t subpassCount + const VkSubpassDescription* pSubpasses + uint32_t dependencyCount + const VkSubpassDependency* pDependencies + + + VkStructureType sType + const void* pNext + VkEventCreateFlags flagsEvent creation flags + + + VkStructureType sType + const void* pNext + VkFenceCreateFlags flagsFence creation flags + + + VkBool32 robustBufferAccessout of bounds buffer accesses are well defined + VkBool32 fullDrawIndexUint32full 32-bit range of indices for indexed draw calls + VkBool32 imageCubeArrayimage views which are arrays of cube maps + VkBool32 independentBlendblending operations are controlled per-attachment + VkBool32 geometryShadergeometry stage + VkBool32 tessellationShadertessellation control and evaluation stage + VkBool32 sampleRateShadingper-sample shading and interpolation + VkBool32 dualSrcBlendblend operations which take two sources + VkBool32 logicOplogic operations + VkBool32 multiDrawIndirectmulti draw indirect + VkBool32 drawIndirectFirstInstanceindirect drawing can use non-zero firstInstance + VkBool32 depthClampdepth clamping + VkBool32 depthBiasClampdepth bias clamping + VkBool32 fillModeNonSolidpoint and wireframe fill modes + VkBool32 depthBoundsdepth bounds test + VkBool32 wideLineslines with width greater than 1 + VkBool32 largePointspoints with size greater than 1 + VkBool32 alphaToOnethe fragment alpha component can be forced to maximum representable alpha value + VkBool32 multiViewportviewport arrays + VkBool32 samplerAnisotropyanisotropic sampler filtering + VkBool32 textureCompressionETC2ETC texture compression formats + VkBool32 textureCompressionASTC_LDRASTC LDR texture compression formats + VkBool32 textureCompressionBCBC1-7 texture compressed formats + VkBool32 occlusionQueryPreciseprecise occlusion queries returning actual sample counts + VkBool32 pipelineStatisticsQuerypipeline statistics query + VkBool32 vertexPipelineStoresAndAtomicsstores and atomic ops on storage buffers and images are supported in vertex, tessellation, and geometry stages + VkBool32 fragmentStoresAndAtomicsstores and atomic ops on storage buffers and images are supported in the fragment stage + VkBool32 shaderTessellationAndGeometryPointSizetessellation and geometry stages can export point size + VkBool32 shaderImageGatherExtendedimage gather with run-time values and independent offsets + VkBool32 shaderStorageImageExtendedFormatsthe extended set of formats can be used for storage images + VkBool32 shaderStorageImageMultisamplemultisample images can be used for storage images + VkBool32 shaderStorageImageReadWithoutFormatread from storage image does not require format qualifier + VkBool32 shaderStorageImageWriteWithoutFormatwrite to storage image does not require format qualifier + VkBool32 shaderUniformBufferArrayDynamicIndexingarrays of uniform buffers can be accessed with dynamically uniform indices + VkBool32 shaderSampledImageArrayDynamicIndexingarrays of sampled images can be accessed with dynamically uniform indices + VkBool32 shaderStorageBufferArrayDynamicIndexingarrays of storage buffers can be accessed with dynamically uniform indices + VkBool32 shaderStorageImageArrayDynamicIndexingarrays of storage images can be accessed with dynamically uniform indices + VkBool32 shaderClipDistanceclip distance in shaders + VkBool32 shaderCullDistancecull distance in shaders + VkBool32 shaderFloat6464-bit floats (doubles) in shaders + VkBool32 shaderInt6464-bit integers in shaders + VkBool32 shaderInt1616-bit integers in shaders + VkBool32 shaderResourceResidencyshader can use texture operations that return resource residency information (requires sparseNonResident support) + VkBool32 shaderResourceMinLodshader can use texture operations that specify minimum resource LOD + VkBool32 sparseBindingSparse resources support: Resource memory can be managed at opaque page level rather than object level + VkBool32 sparseResidencyBufferSparse resources support: GPU can access partially resident buffers + VkBool32 sparseResidencyImage2DSparse resources support: GPU can access partially resident 2D (non-MSAA non-depth/stencil) images + VkBool32 sparseResidencyImage3DSparse resources support: GPU can access partially resident 3D images + VkBool32 sparseResidency2SamplesSparse resources support: GPU can access partially resident MSAA 2D images with 2 samples + VkBool32 sparseResidency4SamplesSparse resources support: GPU can access partially resident MSAA 2D images with 4 samples + VkBool32 sparseResidency8SamplesSparse resources support: GPU can access partially resident MSAA 2D images with 8 samples + VkBool32 sparseResidency16SamplesSparse resources support: GPU can access partially resident MSAA 2D images with 16 samples + VkBool32 sparseResidencyAliasedSparse resources support: GPU can correctly access data aliased into multiple locations (opt-in) + VkBool32 variableMultisampleRatemultisample rate must be the same for all pipelines in a subpass + VkBool32 inheritedQueriesQueries may be inherited from primary to secondary command buffers + + + VkBool32 residencyStandard2DBlockShapeSparse resources support: GPU will access all 2D (single sample) sparse resources using the standard sparse image block shapes (based on pixel format) + VkBool32 residencyStandard2DMultisampleBlockShapeSparse resources support: GPU will access all 2D (multisample) sparse resources using the standard sparse image block shapes (based on pixel format) + VkBool32 residencyStandard3DBlockShapeSparse resources support: GPU will access all 3D sparse resources using the standard sparse image block shapes (based on pixel format) + VkBool32 residencyAlignedMipSizeSparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail + VkBool32 residencyNonResidentStrictSparse resources support: GPU can consistently access non-resident regions of a resource, all reads return as if data is 0, writes are discarded + + + resource maximum sizes + uint32_t maxImageDimension1Dmax 1D image dimension + uint32_t maxImageDimension2Dmax 2D image dimension + uint32_t maxImageDimension3Dmax 3D image dimension + uint32_t maxImageDimensionCubemax cubemap image dimension + uint32_t maxImageArrayLayersmax layers for image arrays + uint32_t maxTexelBufferElementsmax texel buffer size (fstexels) + uint32_t maxUniformBufferRangemax uniform buffer range (bytes) + uint32_t maxStorageBufferRangemax storage buffer range (bytes) + uint32_t maxPushConstantsSizemax size of the push constants pool (bytes) + memory limits + uint32_t maxMemoryAllocationCountmax number of device memory allocations supported + uint32_t maxSamplerAllocationCountmax number of samplers that can be allocated on a device + VkDeviceSize bufferImageGranularityGranularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage + VkDeviceSize sparseAddressSpaceSizeTotal address space available for sparse allocations (bytes) + descriptor set limits + uint32_t maxBoundDescriptorSetsmax number of descriptors sets that can be bound to a pipeline + uint32_t maxPerStageDescriptorSamplersmax number of samplers allowed per-stage in a descriptor set + uint32_t maxPerStageDescriptorUniformBuffersmax number of uniform buffers allowed per-stage in a descriptor set + uint32_t maxPerStageDescriptorStorageBuffersmax number of storage buffers allowed per-stage in a descriptor set + uint32_t maxPerStageDescriptorSampledImagesmax number of sampled images allowed per-stage in a descriptor set + uint32_t maxPerStageDescriptorStorageImagesmax number of storage images allowed per-stage in a descriptor set + uint32_t maxPerStageDescriptorInputAttachmentsmax number of input attachments allowed per-stage in a descriptor set + uint32_t maxPerStageResourcesmax number of resources allowed by a single stage + uint32_t maxDescriptorSetSamplersmax number of samplers allowed in all stages in a descriptor set + uint32_t maxDescriptorSetUniformBuffersmax number of uniform buffers allowed in all stages in a descriptor set + uint32_t maxDescriptorSetUniformBuffersDynamicmax number of dynamic uniform buffers allowed in all stages in a descriptor set + uint32_t maxDescriptorSetStorageBuffersmax number of storage buffers allowed in all stages in a descriptor set + uint32_t maxDescriptorSetStorageBuffersDynamicmax number of dynamic storage buffers allowed in all stages in a descriptor set + uint32_t maxDescriptorSetSampledImagesmax number of sampled images allowed in all stages in a descriptor set + uint32_t maxDescriptorSetStorageImagesmax number of storage images allowed in all stages in a descriptor set + uint32_t maxDescriptorSetInputAttachmentsmax number of input attachments allowed in all stages in a descriptor set + vertex stage limits + uint32_t maxVertexInputAttributesmax number of vertex input attribute slots + uint32_t maxVertexInputBindingsmax number of vertex input binding slots + uint32_t maxVertexInputAttributeOffsetmax vertex input attribute offset added to vertex buffer offset + uint32_t maxVertexInputBindingStridemax vertex input binding stride + uint32_t maxVertexOutputComponentsmax number of output components written by vertex shader + tessellation control stage limits + uint32_t maxTessellationGenerationLevelmax level supported by tessellation primitive generator + uint32_t maxTessellationPatchSizemax patch size (vertices) + uint32_t maxTessellationControlPerVertexInputComponentsmax number of input components per-vertex in TCS + uint32_t maxTessellationControlPerVertexOutputComponentsmax number of output components per-vertex in TCS + uint32_t maxTessellationControlPerPatchOutputComponentsmax number of output components per-patch in TCS + uint32_t maxTessellationControlTotalOutputComponentsmax total number of per-vertex and per-patch output components in TCS + tessellation evaluation stage limits + uint32_t maxTessellationEvaluationInputComponentsmax number of input components per vertex in TES + uint32_t maxTessellationEvaluationOutputComponentsmax number of output components per vertex in TES + geometry stage limits + uint32_t maxGeometryShaderInvocationsmax invocation count supported in geometry shader + uint32_t maxGeometryInputComponentsmax number of input components read in geometry stage + uint32_t maxGeometryOutputComponentsmax number of output components written in geometry stage + uint32_t maxGeometryOutputVerticesmax number of vertices that can be emitted in geometry stage + uint32_t maxGeometryTotalOutputComponentsmax total number of components (all vertices) written in geometry stage + fragment stage limits + uint32_t maxFragmentInputComponentsmax number of input components read in fragment stage + uint32_t maxFragmentOutputAttachmentsmax number of output attachments written in fragment stage + uint32_t maxFragmentDualSrcAttachmentsmax number of output attachments written when using dual source blending + uint32_t maxFragmentCombinedOutputResourcesmax total number of storage buffers, storage images and output buffers + compute stage limits + uint32_t maxComputeSharedMemorySizemax total storage size of work group local storage (bytes) + uint32_t maxComputeWorkGroupCount[3]max num of compute work groups that may be dispatched by a single command (x,y,z) + uint32_t maxComputeWorkGroupInvocationsmax total compute invocations in a single local work group + uint32_t maxComputeWorkGroupSize[3]max local size of a compute work group (x,y,z) + uint32_t subPixelPrecisionBitsnumber bits of subpixel precision in screen x and y + uint32_t subTexelPrecisionBitsnumber bits of precision for selecting texel weights + uint32_t mipmapPrecisionBitsnumber bits of precision for selecting mipmap weights + uint32_t maxDrawIndexedIndexValuemax index value for indexed draw calls (for 32-bit indices) + uint32_t maxDrawIndirectCountmax draw count for indirect drawing calls + float maxSamplerLodBiasmax absolute sampler LOD bias + float maxSamplerAnisotropymax degree of sampler anisotropy + uint32_t maxViewportsmax number of active viewports + uint32_t maxViewportDimensions[2]max viewport dimensions (x,y) + float viewportBoundsRange[2]viewport bounds range (min,max) + uint32_t viewportSubPixelBitsnumber bits of subpixel precision for viewport + size_t minMemoryMapAlignmentmin required alignment of pointers returned by MapMemory (bytes) + VkDeviceSize minTexelBufferOffsetAlignmentmin required alignment for texel buffer offsets (bytes) + VkDeviceSize minUniformBufferOffsetAlignmentmin required alignment for uniform buffer sizes and offsets (bytes) + VkDeviceSize minStorageBufferOffsetAlignmentmin required alignment for storage buffer offsets (bytes) + int32_t minTexelOffsetmin texel offset for OpTextureSampleOffset + uint32_t maxTexelOffsetmax texel offset for OpTextureSampleOffset + int32_t minTexelGatherOffsetmin texel offset for OpTextureGatherOffset + uint32_t maxTexelGatherOffsetmax texel offset for OpTextureGatherOffset + float minInterpolationOffsetfurthest negative offset for interpolateAtOffset + float maxInterpolationOffsetfurthest positive offset for interpolateAtOffset + uint32_t subPixelInterpolationOffsetBitsnumber of subpixel bits for interpolateAtOffset + uint32_t maxFramebufferWidthmax width for a framebuffer + uint32_t maxFramebufferHeightmax height for a framebuffer + uint32_t maxFramebufferLayersmax layer count for a layered framebuffer + VkSampleCountFlags framebufferColorSampleCountssupported color sample counts for a framebuffer + VkSampleCountFlags framebufferDepthSampleCountssupported depth sample counts for a framebuffer + VkSampleCountFlags framebufferStencilSampleCountssupported stencil sample counts for a framebuffer + VkSampleCountFlags framebufferNoAttachmentsSampleCountssupported sample counts for a subpass which uses no attachments + uint32_t maxColorAttachmentsmax number of color attachments per subpass + VkSampleCountFlags sampledImageColorSampleCountssupported color sample counts for a non-integer sampled image + VkSampleCountFlags sampledImageIntegerSampleCountssupported sample counts for an integer image + VkSampleCountFlags sampledImageDepthSampleCountssupported depth sample counts for a sampled image + VkSampleCountFlags sampledImageStencilSampleCountssupported stencil sample counts for a sampled image + VkSampleCountFlags storageImageSampleCountssupported sample counts for a storage image + uint32_t maxSampleMaskWordsmax number of sample mask words + VkBool32 timestampComputeAndGraphicstimestamps on graphics and compute queues + float timestampPeriodnumber of nanoseconds it takes for timestamp query value to increment by 1 + uint32_t maxClipDistancesmax number of clip distances + uint32_t maxCullDistancesmax number of cull distances + uint32_t maxCombinedClipAndCullDistancesmax combined number of user clipping + uint32_t discreteQueuePrioritiesdistinct queue priorities available + float pointSizeRange[2]range (min,max) of supported point sizes + float lineWidthRange[2]range (min,max) of supported line widths + float pointSizeGranularitygranularity of supported point sizes + float lineWidthGranularitygranularity of supported line widths + VkBool32 strictLinesline rasterization follows preferred rules + VkBool32 standardSampleLocationssupports standard sample locations for all supported sample counts + VkDeviceSize optimalBufferCopyOffsetAlignmentoptimal offset of buffer copies + VkDeviceSize optimalBufferCopyRowPitchAlignmentoptimal pitch of buffer copies + VkDeviceSize nonCoherentAtomSizeminimum size and alignment for non-coherent host-mapped device memory access + + + VkStructureType sType + const void* pNext + VkSemaphoreCreateFlags flagsSemaphore creation flags + + + VkStructureType sType + const void* pNext + VkQueryPoolCreateFlags flags + VkQueryType queryType + uint32_t queryCount + VkQueryPipelineStatisticFlags pipelineStatisticsOptional + + + VkStructureType sType + const void* pNext + VkFramebufferCreateFlags flags + VkRenderPass renderPass + uint32_t attachmentCount + const VkImageView* pAttachments + uint32_t width + uint32_t height + uint32_t layers + + + uint32_t vertexCount + uint32_t instanceCount + uint32_t firstVertex + uint32_t firstInstance + + + uint32_t indexCount + uint32_t instanceCount + uint32_t firstIndex + int32_t vertexOffset + uint32_t firstInstance + + + uint32_t x + uint32_t y + uint32_t z + + + uint32_t firstVertex + uint32_t vertexCount + + + uint32_t firstIndex + uint32_t indexCount + int32_t vertexOffset + + + VkStructureType sType + const void* pNext + uint32_t waitSemaphoreCount + const VkSemaphore* pWaitSemaphores + const VkPipelineStageFlags* pWaitDstStageMask + uint32_t commandBufferCount + const VkCommandBuffer* pCommandBuffers + uint32_t signalSemaphoreCount + const VkSemaphore* pSignalSemaphores + + WSI extensions + + VkDisplayKHR displayHandle of the display object + const char* displayNameName of the display + VkExtent2D physicalDimensionsIn millimeters? + VkExtent2D physicalResolutionMax resolution for CRT? + VkSurfaceTransformFlagsKHR supportedTransformsone or more bits from VkSurfaceTransformFlagsKHR + VkBool32 planeReorderPossibleVK_TRUE if the overlay plane's z-order can be changed on this display. + VkBool32 persistentContentVK_TRUE if this is a "smart" display that supports self-refresh/internal buffering. + + + VkDisplayKHR currentDisplayDisplay the plane is currently associated with. Will be VK_NULL_HANDLE if the plane is not in use. + uint32_t currentStackIndexCurrent z-order of the plane. + + + VkExtent2D visibleRegionVisible scanout region. + uint32_t refreshRateNumber of times per second the display is updated. + + + VkDisplayModeKHR displayModeHandle of this display mode. + VkDisplayModeParametersKHR parametersThe parameters this mode uses. + + + VkStructureType sType + const void* pNext + VkDisplayModeCreateFlagsKHR flags + VkDisplayModeParametersKHR parametersThe parameters this mode uses. + + + VkDisplayPlaneAlphaFlagsKHR supportedAlphaTypes of alpha blending supported, if any. + VkOffset2D minSrcPositionDoes the plane have any position and extent restrictions? + VkOffset2D maxSrcPosition + VkExtent2D minSrcExtent + VkExtent2D maxSrcExtent + VkOffset2D minDstPosition + VkOffset2D maxDstPosition + VkExtent2D minDstExtent + VkExtent2D maxDstExtent + + + VkStructureType sType + const void* pNext + VkDisplaySurfaceCreateFlagsKHR flags + VkDisplayModeKHR displayModeThe mode to use when displaying this surface + uint32_t planeIndexThe plane on which this surface appears. Must be between 0 and the value returned by vkGetPhysicalDeviceDisplayPlanePropertiesKHR() in pPropertyCount. + uint32_t planeStackIndexThe z-order of the plane. + VkSurfaceTransformFlagBitsKHR transformTransform to apply to the images as part of the scanout operation + float globalAlphaGlobal alpha value. Must be between 0 and 1, inclusive. Ignored if alphaMode is not VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR + VkDisplayPlaneAlphaFlagBitsKHR alphaModeWhat type of alpha blending to use. Must be a bit from vkGetDisplayPlanePropertiesKHR::supportedAlpha. + VkExtent2D imageExtentsize of the images to use with this surface + + + VkStructureType sType + const void* pNext + VkRect2D srcRectRectangle within the presentable image to read pixel data from when presenting to the display. + VkRect2D dstRectRectangle within the current display mode's visible region to display srcRectangle in. + VkBool32 persistentFor smart displays, use buffered mode. If the display properties member "persistentMode" is VK_FALSE, this member must always be VK_FALSE. + + + uint32_t minImageCountSupported minimum number of images for the surface + uint32_t maxImageCountSupported maximum number of images for the surface, 0 for unlimited + VkExtent2D currentExtentCurrent image width and height for the surface, (0, 0) if undefined + VkExtent2D minImageExtentSupported minimum image width and height for the surface + VkExtent2D maxImageExtentSupported maximum image width and height for the surface + uint32_t maxImageArrayLayersSupported maximum number of image layers for the surface + VkSurfaceTransformFlagsKHR supportedTransforms1 or more bits representing the transforms supported + VkSurfaceTransformFlagBitsKHR currentTransformThe surface's current transform relative to the device's natural orientation + VkCompositeAlphaFlagsKHR supportedCompositeAlpha1 or more bits representing the alpha compositing modes supported + VkImageUsageFlags supportedUsageFlagsSupported image usage flags for the surface + + + VkStructureType sType + const void* pNext + VkAndroidSurfaceCreateFlagsKHR flags + struct ANativeWindow* window + + + VkStructureType sType + const void* pNext + VkViSurfaceCreateFlagsNN flags + void* window + + + VkStructureType sType + const void* pNext + VkWaylandSurfaceCreateFlagsKHR flags + struct wl_display* display + struct wl_surface* surface + + + VkStructureType sType + const void* pNext + VkWin32SurfaceCreateFlagsKHR flags + HINSTANCE hinstance + HWND hwnd + + + VkStructureType sType + const void* pNext + VkXlibSurfaceCreateFlagsKHR flags + Display* dpy + Window window + + + VkStructureType sType + const void* pNext + VkXcbSurfaceCreateFlagsKHR flags + xcb_connection_t* connection + xcb_window_t window + + + VkStructureType sType + const void* pNext + VkDirectFBSurfaceCreateFlagsEXT flags + IDirectFB* dfb + IDirectFBSurface* surface + + + VkStructureType sType + const void* pNext + VkImagePipeSurfaceCreateFlagsFUCHSIA flags + zx_handle_t imagePipeHandle + + + VkStructureType sType + const void* pNext + VkStreamDescriptorSurfaceCreateFlagsGGP flags + GgpStreamDescriptor streamDescriptor + + + VkStructureType sType + const void* pNext + VkScreenSurfaceCreateFlagsQNX flags + struct _screen_context* context + struct _screen_window* window + + + VkFormat formatSupported pair of rendering format + VkColorSpaceKHR colorSpaceand color space for the surface + + + VkStructureType sType + const void* pNext + VkSwapchainCreateFlagsKHR flags + VkSurfaceKHR surfaceThe swapchain's target surface + uint32_t minImageCountMinimum number of presentation images the application needs + VkFormat imageFormatFormat of the presentation images + VkColorSpaceKHR imageColorSpaceColorspace of the presentation images + VkExtent2D imageExtentDimensions of the presentation images + uint32_t imageArrayLayersDetermines the number of views for multiview/stereo presentation + VkImageUsageFlags imageUsageBits indicating how the presentation images will be used + VkSharingMode imageSharingModeSharing mode used for the presentation images + uint32_t queueFamilyIndexCountNumber of queue families having access to the images in case of concurrent sharing mode + const uint32_t* pQueueFamilyIndicesArray of queue family indices having access to the images in case of concurrent sharing mode + VkSurfaceTransformFlagBitsKHR preTransformThe transform, relative to the device's natural orientation, applied to the image content prior to presentation + VkCompositeAlphaFlagBitsKHR compositeAlphaThe alpha blending mode used when compositing this surface with other surfaces in the window system + VkPresentModeKHR presentModeWhich presentation mode to use for presents on this swap chain + VkBool32 clippedSpecifies whether presentable images may be affected by window clip regions + VkSwapchainKHR oldSwapchainExisting swap chain to replace, if any + VkSwapchainKHR oldSwapchainExisting swap chain to replace, if any + + + VkStructureType sType + const void* pNext + uint32_t waitSemaphoreCountNumber of semaphores to wait for before presenting + const VkSemaphore* pWaitSemaphoresSemaphores to wait for before presenting + uint32_t swapchainCountNumber of swapchains to present in this call + const VkSwapchainKHR* pSwapchainsSwapchains to present an image from + const uint32_t* pImageIndicesIndices of which presentable images to present + VkResult* pResultsOptional (i.e. if non-NULL) VkResult for each swapchain + + + VkStructureType sType + const void* pNext + VkDebugReportFlagsEXT flagsIndicates which events call this callback + PFN_vkDebugReportCallbackEXT pfnCallbackFunction pointer of a callback function + void* pUserDataUser data provided to callback function + + + VkStructureType sTypeMust be VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT + const void* pNext + uint32_t disabledValidationCheckCountNumber of validation checks to disable + const VkValidationCheckEXT* pDisabledValidationChecksValidation checks to disable + + + VkStructureType sTypeMust be VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT + const void* pNext + uint32_t enabledValidationFeatureCountNumber of validation features to enable + const VkValidationFeatureEnableEXT* pEnabledValidationFeaturesValidation features to enable + uint32_t disabledValidationFeatureCountNumber of validation features to disable + const VkValidationFeatureDisableEXT* pDisabledValidationFeaturesValidation features to disable + + + VkStructureType sType + const void* pNext + uint32_t vendorID + uint32_t deviceID + uint32_t key + uint64_t value + + + VkStructureType sType + const void* pNext + VkRasterizationOrderAMD rasterizationOrderRasterization order to use for the pipeline + + + VkStructureType sType + const void* pNext + VkDebugReportObjectTypeEXT objectTypeThe type of the object + uint64_t objectThe handle of the object, cast to uint64_t + const char* pObjectNameName to apply to the object + + + VkStructureType sType + const void* pNext + VkDebugReportObjectTypeEXT objectTypeThe type of the object + uint64_t objectThe handle of the object, cast to uint64_t + uint64_t tagNameThe name of the tag to set on the object + size_t tagSizeThe length in bytes of the tag data + const void* pTagTag data to attach to the object + + + VkStructureType sType + const void* pNext + const char* pMarkerNameName of the debug marker + float color[4]Optional color for debug marker + + + VkStructureType sType + const void* pNext + VkBool32 dedicatedAllocationWhether this image uses a dedicated allocation + + + VkStructureType sType + const void* pNext + VkBool32 dedicatedAllocationWhether this buffer uses a dedicated allocation + + + VkStructureType sType + const void* pNext + VkImage imageImage that this allocation will be bound to + VkBuffer bufferBuffer that this allocation will be bound to + + + VkImageFormatProperties imageFormatProperties + VkExternalMemoryFeatureFlagsNV externalMemoryFeatures + VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes + VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagsNV handleTypes + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagsNV handleTypes + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagsNV handleType + HANDLE handle + + + VkStructureType sType + const void* pNext + const SECURITY_ATTRIBUTES* pAttributes + DWORD dwAccess + + + VkStructureType sType + const void* pNext + NvSciBufAttrList pAttributes + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagBits handleType + NvSciBufObj handle + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + VkExternalMemoryHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + uint32_t memoryTypeBits + + + VkStructureType sType + void* pNext + VkBool32 sciBufImport + VkBool32 sciBufExport + + + + VkStructureType sType + const void* pNext + uint32_t acquireCount + const VkDeviceMemory* pAcquireSyncs + const uint64_t* pAcquireKeys + const uint32_t* pAcquireTimeoutMilliseconds + uint32_t releaseCount + const VkDeviceMemory* pReleaseSyncs + const uint64_t* pReleaseKeys + + + VkStructureType sType + void* pNext + VkBool32 deviceGeneratedCommands + + + VkStructureType sType + void* pNext + VkBool32 deviceGeneratedCompute + VkBool32 deviceGeneratedComputePipelines + VkBool32 deviceGeneratedComputeCaptureReplay + + + VkStructureType sType + const void* pNext + uint32_t privateDataSlotRequestCount + + + + VkStructureType sType + const void* pNext + VkPrivateDataSlotCreateFlags flags + + + + VkStructureType sType + void* pNext + VkBool32 privateData + + + + VkStructureType sType + void* pNext + uint32_t maxGraphicsShaderGroupCount + uint32_t maxIndirectSequenceCount + uint32_t maxIndirectCommandsTokenCount + uint32_t maxIndirectCommandsStreamCount + uint32_t maxIndirectCommandsTokenOffset + uint32_t maxIndirectCommandsStreamStride + uint32_t minSequencesCountBufferOffsetAlignment + uint32_t minSequencesIndexBufferOffsetAlignment + uint32_t minIndirectCommandsBufferOffsetAlignment + + + VkStructureType sType + void* pNext + uint32_t maxMultiDrawCount + + + VkStructureType sType + const void* pNext + uint32_t stageCount + const VkPipelineShaderStageCreateInfo* pStages + const VkPipelineVertexInputStateCreateInfo* pVertexInputState + const VkPipelineTessellationStateCreateInfo* pTessellationState + + + VkStructureType sType + const void* pNext + uint32_t groupCount + const VkGraphicsShaderGroupCreateInfoNV* pGroups + uint32_t pipelineCount + const VkPipeline* pPipelines + + + uint32_t groupIndex + + + VkDeviceAddress bufferAddress + uint32_t size + VkIndexType indexType + + + VkDeviceAddress bufferAddress + uint32_t size + uint32_t stride + + + uint32_t data + + + VkBuffer buffer + VkDeviceSize offset + + + VkStructureType sType + const void* pNext + VkIndirectCommandsTokenTypeNV tokenType + uint32_t stream + uint32_t offset + uint32_t vertexBindingUnit + VkBool32 vertexDynamicStride + VkPipelineLayout pushconstantPipelineLayout + VkShaderStageFlags pushconstantShaderStageFlags + uint32_t pushconstantOffset + uint32_t pushconstantSize + VkIndirectStateFlagsNV indirectStateFlags + uint32_t indexTypeCount + const VkIndexType* pIndexTypes + const uint32_t* pIndexTypeValues + + + VkStructureType sType + const void* pNext + VkIndirectCommandsLayoutUsageFlagsNV flags + VkPipelineBindPoint pipelineBindPoint + uint32_t tokenCount + const VkIndirectCommandsLayoutTokenNV* pTokens + uint32_t streamCount + const uint32_t* pStreamStrides + + + VkStructureType sType + const void* pNext + VkPipelineBindPoint pipelineBindPoint + VkPipeline pipeline + VkIndirectCommandsLayoutNV indirectCommandsLayout + uint32_t streamCount + const VkIndirectCommandsStreamNV* pStreams + uint32_t sequencesCount + VkBuffer preprocessBuffer + VkDeviceSize preprocessOffset + VkDeviceSize preprocessSize + VkBuffer sequencesCountBuffer + VkDeviceSize sequencesCountOffset + VkBuffer sequencesIndexBuffer + VkDeviceSize sequencesIndexOffset + + + VkStructureType sType + const void* pNext + VkPipelineBindPoint pipelineBindPoint + VkPipeline pipeline + VkIndirectCommandsLayoutNV indirectCommandsLayout + uint32_t maxSequencesCount + + + VkStructureType sType + const void* pNext + VkPipelineBindPoint pipelineBindPoint + VkPipeline pipeline + + + VkDeviceAddress pipelineAddress + + + VkStructureType sType + void* pNext + VkPhysicalDeviceFeatures features + + + + VkStructureType sType + void* pNext + VkPhysicalDeviceProperties properties + + + + VkStructureType sType + void* pNext + VkFormatProperties formatProperties + + + + VkStructureType sType + void* pNext + VkImageFormatProperties imageFormatProperties + + + + VkStructureType sType + const void* pNext + VkFormat format + VkImageType type + VkImageTiling tiling + VkImageUsageFlags usage + VkImageCreateFlags flags + + + + VkStructureType sType + void* pNext + VkQueueFamilyProperties queueFamilyProperties + + + + VkStructureType sType + void* pNext + VkPhysicalDeviceMemoryProperties memoryProperties + + + + VkStructureType sType + void* pNext + VkSparseImageFormatProperties properties + + + + VkStructureType sType + const void* pNext + VkFormat format + VkImageType type + VkSampleCountFlagBits samples + VkImageUsageFlags usage + VkImageTiling tiling + + + + VkStructureType sType + void* pNext + uint32_t maxPushDescriptors + + + uint8_t major + uint8_t minor + uint8_t subminor + uint8_t patch + + + + VkStructureType sType + void* pNext + VkDriverId driverID + char driverName[VK_MAX_DRIVER_NAME_SIZE] + char driverInfo[VK_MAX_DRIVER_INFO_SIZE] + VkConformanceVersion conformanceVersion + + + + VkStructureType sType + const void* pNext + uint32_t swapchainCountCopy of VkPresentInfoKHR::swapchainCount + const VkPresentRegionKHR* pRegionsThe regions that have changed + + + uint32_t rectangleCountNumber of rectangles in pRectangles + const VkRectLayerKHR* pRectanglesArray of rectangles that have changed in a swapchain's image(s) + + + VkOffset2D offsetupper-left corner of a rectangle that has not changed, in pixels of a presentation images + VkExtent2D extentDimensions of a rectangle that has not changed, in pixels of a presentation images + uint32_t layerLayer of a swapchain's image(s), for stereoscopic-3D images + + + VkStructureType sType + void* pNext + VkBool32 variablePointersStorageBuffer + VkBool32 variablePointers + + + + + + VkExternalMemoryFeatureFlags externalMemoryFeatures + VkExternalMemoryHandleTypeFlags exportFromImportedHandleTypes + VkExternalMemoryHandleTypeFlags compatibleHandleTypes + + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagBits handleType + + + + VkStructureType sType + void* pNext + VkExternalMemoryProperties externalMemoryProperties + + + + VkStructureType sType + const void* pNext + VkBufferCreateFlags flags + VkBufferUsageFlags usage + VkExternalMemoryHandleTypeFlagBits handleType + + + + VkStructureType sType + void* pNext + VkExternalMemoryProperties externalMemoryProperties + + + + VkStructureType sType + void* pNext + uint8_t deviceUUID[VK_UUID_SIZE] + uint8_t driverUUID[VK_UUID_SIZE] + uint8_t deviceLUID[VK_LUID_SIZE] + uint32_t deviceNodeMask + VkBool32 deviceLUIDValid + + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlags handleTypes + + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlags handleTypes + + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlags handleTypes + + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagBits handleType + HANDLE handle + LPCWSTR name + + + VkStructureType sType + const void* pNext + const SECURITY_ATTRIBUTES* pAttributes + DWORD dwAccess + LPCWSTR name + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagBits handleType + zx_handle_t handle + + + VkStructureType sType + void* pNext + uint32_t memoryTypeBits + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + VkExternalMemoryHandleTypeFlagBits handleType + + + VkStructureType sType + void* pNext + uint32_t memoryTypeBits + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + VkExternalMemoryHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagBits handleType + int fd + + + VkStructureType sType + void* pNext + uint32_t memoryTypeBits + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + VkExternalMemoryHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + uint32_t acquireCount + const VkDeviceMemory* pAcquireSyncs + const uint64_t* pAcquireKeys + const uint32_t* pAcquireTimeouts + uint32_t releaseCount + const VkDeviceMemory* pReleaseSyncs + const uint64_t* pReleaseKeys + + + VkStructureType sType + const void* pNext + VkExternalSemaphoreHandleTypeFlagBits handleType + + + + VkStructureType sType + void* pNext + VkExternalSemaphoreHandleTypeFlags exportFromImportedHandleTypes + VkExternalSemaphoreHandleTypeFlags compatibleHandleTypes + VkExternalSemaphoreFeatureFlags externalSemaphoreFeatures + + + + VkStructureType sType + const void* pNext + VkExternalSemaphoreHandleTypeFlags handleTypes + + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkSemaphoreImportFlags flags + VkExternalSemaphoreHandleTypeFlagBits handleType + HANDLE handle + LPCWSTR name + + + VkStructureType sType + const void* pNext + const SECURITY_ATTRIBUTES* pAttributes + DWORD dwAccess + LPCWSTR name + + + VkStructureType sType + const void* pNext + uint32_t waitSemaphoreValuesCount + const uint64_t* pWaitSemaphoreValues + uint32_t signalSemaphoreValuesCount + const uint64_t* pSignalSemaphoreValues + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkExternalSemaphoreHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkSemaphoreImportFlags flags + VkExternalSemaphoreHandleTypeFlagBits handleType + int fd + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkExternalSemaphoreHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkSemaphoreImportFlags flags + VkExternalSemaphoreHandleTypeFlagBits handleType + zx_handle_t zirconHandle + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkExternalSemaphoreHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkExternalFenceHandleTypeFlagBits handleType + + + + VkStructureType sType + void* pNext + VkExternalFenceHandleTypeFlags exportFromImportedHandleTypes + VkExternalFenceHandleTypeFlags compatibleHandleTypes + VkExternalFenceFeatureFlags externalFenceFeatures + + + + VkStructureType sType + const void* pNext + VkExternalFenceHandleTypeFlags handleTypes + + + + VkStructureType sType + const void* pNext + VkFence fence + VkFenceImportFlags flags + VkExternalFenceHandleTypeFlagBits handleType + HANDLE handle + LPCWSTR name + + + VkStructureType sType + const void* pNext + const SECURITY_ATTRIBUTES* pAttributes + DWORD dwAccess + LPCWSTR name + + + VkStructureType sType + const void* pNext + VkFence fence + VkExternalFenceHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkFence fence + VkFenceImportFlags flags + VkExternalFenceHandleTypeFlagBits handleType + int fd + + + VkStructureType sType + const void* pNext + VkFence fence + VkExternalFenceHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + NvSciSyncAttrList pAttributes + + + VkStructureType sType + const void* pNext + VkFence fence + VkExternalFenceHandleTypeFlagBits handleType + void* handle + + + VkStructureType sType + const void* pNext + VkFence fence + VkExternalFenceHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + NvSciSyncAttrList pAttributes + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkExternalSemaphoreHandleTypeFlagBits handleType + void* handle + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkExternalSemaphoreHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkSciSyncClientTypeNV clientType + VkSciSyncPrimitiveTypeNV primitiveType + + + VkStructureType sType + void* pNext + VkBool32 sciSyncFence + VkBool32 sciSyncSemaphore + VkBool32 sciSyncImport + VkBool32 sciSyncExport + + + VkStructureType sType + void* pNext + VkBool32 sciSyncFence + VkBool32 sciSyncSemaphore2 + VkBool32 sciSyncImport + VkBool32 sciSyncExport + + + VkStructureType sType + const void* pNext + NvSciSyncObj handle + + + VkStructureType sType + const void* pNext + VkSemaphoreSciSyncPoolNV semaphorePool + const NvSciSyncFence* pFence + + + VkStructureType sType + const void* pNext + uint32_t semaphoreSciSyncPoolRequestCount + + + VkStructureType sType + void* pNext + VkBool32 multiviewMultiple views in a renderpass + VkBool32 multiviewGeometryShaderMultiple views in a renderpass w/ geometry shader + VkBool32 multiviewTessellationShaderMultiple views in a renderpass w/ tessellation shader + + + + VkStructureType sType + void* pNext + uint32_t maxMultiviewViewCountmax number of views in a subpass + uint32_t maxMultiviewInstanceIndexmax instance index for a draw in a multiview subpass + + + + VkStructureType sType + const void* pNext + uint32_t subpassCount + const uint32_t* pViewMasks + uint32_t dependencyCount + const int32_t* pViewOffsets + uint32_t correlationMaskCount + const uint32_t* pCorrelationMasks + + + + VkStructureType sType + void* pNext + uint32_t minImageCountSupported minimum number of images for the surface + uint32_t maxImageCountSupported maximum number of images for the surface, 0 for unlimited + VkExtent2D currentExtentCurrent image width and height for the surface, (0, 0) if undefined + VkExtent2D minImageExtentSupported minimum image width and height for the surface + VkExtent2D maxImageExtentSupported maximum image width and height for the surface + uint32_t maxImageArrayLayersSupported maximum number of image layers for the surface + VkSurfaceTransformFlagsKHR supportedTransforms1 or more bits representing the transforms supported + VkSurfaceTransformFlagBitsKHR currentTransformThe surface's current transform relative to the device's natural orientation + VkCompositeAlphaFlagsKHR supportedCompositeAlpha1 or more bits representing the alpha compositing modes supported + VkImageUsageFlags supportedUsageFlagsSupported image usage flags for the surface + VkSurfaceCounterFlagsEXT supportedSurfaceCounters + + + VkStructureType sType + const void* pNext + VkDisplayPowerStateEXT powerState + + + VkStructureType sType + const void* pNext + VkDeviceEventTypeEXT deviceEvent + + + VkStructureType sType + const void* pNext + VkDisplayEventTypeEXT displayEvent + + + VkStructureType sType + const void* pNext + VkSurfaceCounterFlagsEXT surfaceCounters + + + VkStructureType sType + void* pNext + uint32_t physicalDeviceCount + VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE] + VkBool32 subsetAllocation + + + + VkStructureType sType + const void* pNext + VkMemoryAllocateFlags flags + uint32_t deviceMask + + + + VkStructureType sType + const void* pNext + VkBuffer buffer + VkDeviceMemory memory + VkDeviceSize memoryOffset + + + + VkStructureType sType + const void* pNext + uint32_t deviceIndexCount + const uint32_t* pDeviceIndices + + + + VkStructureType sType + const void* pNext + VkImage image + VkDeviceMemory memory + VkDeviceSize memoryOffset + + + + VkStructureType sType + const void* pNext + uint32_t deviceIndexCount + const uint32_t* pDeviceIndices + uint32_t splitInstanceBindRegionCount + const VkRect2D* pSplitInstanceBindRegions + + + + VkStructureType sType + const void* pNext + uint32_t deviceMask + uint32_t deviceRenderAreaCount + const VkRect2D* pDeviceRenderAreas + + + + VkStructureType sType + const void* pNext + uint32_t deviceMask + + + + VkStructureType sType + const void* pNext + uint32_t waitSemaphoreCount + const uint32_t* pWaitSemaphoreDeviceIndices + uint32_t commandBufferCount + const uint32_t* pCommandBufferDeviceMasks + uint32_t signalSemaphoreCount + const uint32_t* pSignalSemaphoreDeviceIndices + + + + VkStructureType sType + const void* pNext + uint32_t resourceDeviceIndex + uint32_t memoryDeviceIndex + + + + VkStructureType sType + void* pNext + uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE] + VkDeviceGroupPresentModeFlagsKHR modes + + + VkStructureType sType + const void* pNext + VkSwapchainKHR swapchain + + + VkStructureType sType + const void* pNext + VkSwapchainKHR swapchain + uint32_t imageIndex + + + VkStructureType sType + const void* pNext + VkSwapchainKHR swapchain + uint64_t timeout + VkSemaphore semaphore + VkFence fence + uint32_t deviceMask + + + VkStructureType sType + const void* pNext + uint32_t swapchainCount + const uint32_t* pDeviceMasks + VkDeviceGroupPresentModeFlagBitsKHR mode + + + VkStructureType sType + const void* pNext + uint32_t physicalDeviceCount + const VkPhysicalDevice* pPhysicalDevices + + + + VkStructureType sType + const void* pNext + VkDeviceGroupPresentModeFlagsKHR modes + + + uint32_t dstBindingBinding within the destination descriptor set to write + uint32_t dstArrayElementArray element within the destination binding to write + uint32_t descriptorCountNumber of descriptors to write + VkDescriptorType descriptorTypeDescriptor type to write + size_t offsetOffset into pData where the descriptors to update are stored + size_t strideStride between two descriptors in pData when writing more than one descriptor + + + + VkStructureType sType + const void* pNext + VkDescriptorUpdateTemplateCreateFlags flags + uint32_t descriptorUpdateEntryCountNumber of descriptor update entries to use for the update template + const VkDescriptorUpdateTemplateEntry* pDescriptorUpdateEntriesDescriptor update entries for the template + VkDescriptorUpdateTemplateType templateType + VkDescriptorSetLayout descriptorSetLayout + VkPipelineBindPoint pipelineBindPoint + VkPipelineLayout pipelineLayoutIf used for push descriptors, this is the only allowed layout + uint32_t set + + + + float x + float y + + + VkStructureType sType + void* pNext + VkBool32 presentIdPresent ID in VkPresentInfoKHR + + + VkStructureType sType + const void* pNext + uint32_t swapchainCountCopy of VkPresentInfoKHR::swapchainCount + const uint64_t* pPresentIdsPresent ID values for each swapchain + + + VkStructureType sType + void* pNext + VkBool32 presentWaitvkWaitForPresentKHR is supported + + + Display primary in chromaticity coordinates + VkStructureType sType + const void* pNext + From SMPTE 2086 + VkXYColorEXT displayPrimaryRedDisplay primary's Red + VkXYColorEXT displayPrimaryGreenDisplay primary's Green + VkXYColorEXT displayPrimaryBlueDisplay primary's Blue + VkXYColorEXT whitePointDisplay primary's Blue + float maxLuminanceDisplay maximum luminance + float minLuminanceDisplay minimum luminance + From CTA 861.3 + float maxContentLightLevelContent maximum luminance + float maxFrameAverageLightLevel + + + VkStructureType sType + void* pNext + VkBool32 localDimmingSupport + + + VkStructureType sType + const void* pNext + VkBool32 localDimmingEnable + + + uint64_t refreshDurationNumber of nanoseconds from the start of one refresh cycle to the next + + + uint32_t presentIDApplication-provided identifier, previously given to vkQueuePresentKHR + uint64_t desiredPresentTimeEarliest time an image should have been presented, previously given to vkQueuePresentKHR + uint64_t actualPresentTimeTime the image was actually displayed + uint64_t earliestPresentTimeEarliest time the image could have been displayed + uint64_t presentMarginHow early vkQueuePresentKHR was processed vs. how soon it needed to be and make earliestPresentTime + + + VkStructureType sType + const void* pNext + uint32_t swapchainCountCopy of VkPresentInfoKHR::swapchainCount + const VkPresentTimeGOOGLE* pTimesThe earliest times to present images + + + uint32_t presentIDApplication-provided identifier + uint64_t desiredPresentTimeEarliest time an image should be presented + + + VkStructureType sType + const void* pNext + VkIOSSurfaceCreateFlagsMVK flags + const void* pView + + + VkStructureType sType + const void* pNext + VkMacOSSurfaceCreateFlagsMVK flags + const void* pView + + + VkStructureType sType + const void* pNext + VkMetalSurfaceCreateFlagsEXT flags + const CAMetalLayer* pLayer + + + float xcoeff + float ycoeff + + + VkStructureType sType + const void* pNext + VkBool32 viewportWScalingEnable + uint32_t viewportCount + const VkViewportWScalingNV* pViewportWScalings + + + VkViewportCoordinateSwizzleNV x + VkViewportCoordinateSwizzleNV y + VkViewportCoordinateSwizzleNV z + VkViewportCoordinateSwizzleNV w + + + VkStructureType sType + const void* pNext + VkPipelineViewportSwizzleStateCreateFlagsNV flags + uint32_t viewportCount + const VkViewportSwizzleNV* pViewportSwizzles + + + VkStructureType sType + void* pNext + uint32_t maxDiscardRectanglesmax number of active discard rectangles + + + VkStructureType sType + const void* pNext + VkPipelineDiscardRectangleStateCreateFlagsEXT flags + VkDiscardRectangleModeEXT discardRectangleMode + uint32_t discardRectangleCount + const VkRect2D* pDiscardRectangles + + + VkStructureType sType + void* pNext + VkBool32 perViewPositionAllComponents + + + uint32_t subpass + uint32_t inputAttachmentIndex + VkImageAspectFlags aspectMask + + + + VkStructureType sType + const void* pNext + uint32_t aspectReferenceCount + const VkInputAttachmentAspectReference* pAspectReferences + + + + VkStructureType sType + const void* pNext + VkSurfaceKHR surface + + + VkStructureType sType + void* pNext + VkSurfaceCapabilitiesKHR surfaceCapabilities + + + VkStructureType sType + void* pNext + VkSurfaceFormatKHR surfaceFormat + + + VkStructureType sType + void* pNext + VkDisplayPropertiesKHR displayProperties + + + VkStructureType sType + void* pNext + VkDisplayPlanePropertiesKHR displayPlaneProperties + + + VkStructureType sType + void* pNext + VkDisplayModePropertiesKHR displayModeProperties + + + VkStructureType sType + const void* pNext + VkDisplayModeKHR mode + uint32_t planeIndex + + + VkStructureType sType + void* pNext + VkDisplayPlaneCapabilitiesKHR capabilities + + + VkStructureType sType + void* pNext + VkImageUsageFlags sharedPresentSupportedUsageFlagsSupported image usage flags if swapchain created using a shared present mode + + + VkStructureType sType + void* pNext + VkBool32 storageBuffer16BitAccess16-bit integer/floating-point variables supported in BufferBlock + VkBool32 uniformAndStorageBuffer16BitAccess16-bit integer/floating-point variables supported in BufferBlock and Block + VkBool32 storagePushConstant1616-bit integer/floating-point variables supported in PushConstant + VkBool32 storageInputOutput1616-bit integer/floating-point variables supported in shader inputs and outputs + + + + VkStructureType sType + void* pNext + uint32_t subgroupSizeThe size of a subgroup for this queue. + VkShaderStageFlags supportedStagesBitfield of what shader stages support subgroup operations + VkSubgroupFeatureFlags supportedOperationsBitfield of what subgroup operations are supported. + VkBool32 quadOperationsInAllStagesFlag to specify whether quad operations are available in all stages. + + + VkStructureType sType + void* pNext + VkBool32 shaderSubgroupExtendedTypesFlag to specify whether subgroup operations with extended types are supported + + + + VkStructureType sType + const void* pNext + VkBuffer buffer + + + + VkStructureType sType + const void* pNext + const VkBufferCreateInfo* pCreateInfo + + + + VkStructureType sType + const void* pNext + VkImage image + + + + VkStructureType sType + const void* pNext + VkImage image + + + + VkStructureType sType + const void* pNext + const VkImageCreateInfo* pCreateInfo + VkImageAspectFlagBits planeAspect + + + + VkStructureType sType + void* pNext + VkMemoryRequirements memoryRequirements + + + + VkStructureType sType + void* pNext + VkSparseImageMemoryRequirements memoryRequirements + + + + VkStructureType sType + void* pNext + VkPointClippingBehavior pointClippingBehavior + + + + VkStructureType sType + void* pNext + VkBool32 prefersDedicatedAllocation + VkBool32 requiresDedicatedAllocation + + + + VkStructureType sType + const void* pNext + VkImage imageImage that this allocation will be bound to + VkBuffer bufferBuffer that this allocation will be bound to + + + + VkStructureType sType + const void* pNext + VkImageUsageFlags usage + + + VkStructureType sType + const void* pNext + uint32_t sliceOffset + uint32_t sliceCount + + + + VkStructureType sType + const void* pNext + VkTessellationDomainOrigin domainOrigin + + + + VkStructureType sType + const void* pNext + VkSamplerYcbcrConversion conversion + + + + VkStructureType sType + const void* pNext + VkFormat format + VkSamplerYcbcrModelConversion ycbcrModel + VkSamplerYcbcrRange ycbcrRange + VkComponentMapping components + VkChromaLocation xChromaOffset + VkChromaLocation yChromaOffset + VkFilter chromaFilter + VkBool32 forceExplicitReconstruction + + + + VkStructureType sType + const void* pNext + VkImageAspectFlagBits planeAspect + + + + VkStructureType sType + const void* pNext + VkImageAspectFlagBits planeAspect + + + + VkStructureType sType + void* pNext + VkBool32 samplerYcbcrConversionSampler color conversion supported + + + + VkStructureType sType + void* pNext + uint32_t combinedImageSamplerDescriptorCount + + + + VkStructureType sType + void* pNext + VkBool32 supportsTextureGatherLODBiasAMD + + + VkStructureType sType + const void* pNext + VkBuffer buffer + VkDeviceSize offset + VkConditionalRenderingFlagsEXT flags + + + VkStructureType sType + const void* pNext + VkBool32 protectedSubmitSubmit protected command buffers + + + VkStructureType sType + void* pNext + VkBool32 protectedMemory + + + VkStructureType sType + void* pNext + VkBool32 protectedNoFault + + + VkStructureType sType + const void* pNext + VkDeviceQueueCreateFlags flags + uint32_t queueFamilyIndex + uint32_t queueIndex + + + VkStructureType sType + const void* pNext + VkPipelineCoverageToColorStateCreateFlagsNV flags + VkBool32 coverageToColorEnable + uint32_t coverageToColorLocation + + + VkStructureType sType + void* pNext + VkBool32 filterMinmaxSingleComponentFormats + VkBool32 filterMinmaxImageComponentMapping + + + + float x + float y + + + VkStructureType sType + const void* pNext + VkSampleCountFlagBits sampleLocationsPerPixel + VkExtent2D sampleLocationGridSize + uint32_t sampleLocationsCount + const VkSampleLocationEXT* pSampleLocations + + + uint32_t attachmentIndex + VkSampleLocationsInfoEXT sampleLocationsInfo + + + uint32_t subpassIndex + VkSampleLocationsInfoEXT sampleLocationsInfo + + + VkStructureType sType + const void* pNext + uint32_t attachmentInitialSampleLocationsCount + const VkAttachmentSampleLocationsEXT* pAttachmentInitialSampleLocations + uint32_t postSubpassSampleLocationsCount + const VkSubpassSampleLocationsEXT* pPostSubpassSampleLocations + + + VkStructureType sType + const void* pNext + VkBool32 sampleLocationsEnable + VkSampleLocationsInfoEXT sampleLocationsInfo + + + VkStructureType sType + void* pNext + VkSampleCountFlags sampleLocationSampleCounts + VkExtent2D maxSampleLocationGridSize + float sampleLocationCoordinateRange[2] + uint32_t sampleLocationSubPixelBits + VkBool32 variableSampleLocations + + + VkStructureType sType + void* pNext + VkExtent2D maxSampleLocationGridSize + + + VkStructureType sType + const void* pNext + VkSamplerReductionMode reductionMode + + + + VkStructureType sType + void* pNext + VkBool32 advancedBlendCoherentOperations + + + VkStructureType sType + void* pNext + VkBool32 multiDraw + + + VkStructureType sType + void* pNext + uint32_t advancedBlendMaxColorAttachments + VkBool32 advancedBlendIndependentBlend + VkBool32 advancedBlendNonPremultipliedSrcColor + VkBool32 advancedBlendNonPremultipliedDstColor + VkBool32 advancedBlendCorrelatedOverlap + VkBool32 advancedBlendAllOperations + + + VkStructureType sType + const void* pNext + VkBool32 srcPremultiplied + VkBool32 dstPremultiplied + VkBlendOverlapEXT blendOverlap + + + VkStructureType sType + void* pNext + VkBool32 inlineUniformBlock + VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind + + + + VkStructureType sType + void* pNext + uint32_t maxInlineUniformBlockSize + uint32_t maxPerStageDescriptorInlineUniformBlocks + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks + uint32_t maxDescriptorSetInlineUniformBlocks + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks + + + + VkStructureType sType + const void* pNext + uint32_t dataSize + const void* pData + + + + VkStructureType sType + const void* pNext + uint32_t maxInlineUniformBlockBindings + + + + VkStructureType sType + const void* pNext + VkPipelineCoverageModulationStateCreateFlagsNV flags + VkCoverageModulationModeNV coverageModulationMode + VkBool32 coverageModulationTableEnable + uint32_t coverageModulationTableCount + const float* pCoverageModulationTable + + + VkStructureType sType + const void* pNext + uint32_t viewFormatCount + const VkFormat* pViewFormats + + + + VkStructureType sType + const void* pNext + VkValidationCacheCreateFlagsEXT flags + size_t initialDataSize + const void* pInitialData + + + VkStructureType sType + const void* pNext + VkValidationCacheEXT validationCache + + + VkStructureType sType + void* pNext + uint32_t maxPerSetDescriptors + VkDeviceSize maxMemoryAllocationSize + + + + VkStructureType sType + void* pNext + VkBool32 maintenance4 + + + + VkStructureType sType + void* pNext + VkDeviceSize maxBufferSize + + + + VkStructureType sType + void* pNext + VkBool32 maintenance5 + + + VkStructureType sType + void* pNext + VkBool32 earlyFragmentMultisampleCoverageAfterSampleCounting + VkBool32 earlyFragmentSampleMaskTestBeforeSampleCounting + VkBool32 depthStencilSwizzleOneSupport + VkBool32 polygonModePointSize + VkBool32 nonStrictSinglePixelWideLinesUseParallelogram + VkBool32 nonStrictWideLinesUseParallelogram + + + VkStructureType sType + const void* pNext + uint32_t viewMask + uint32_t colorAttachmentCount + const VkFormat* pColorAttachmentFormats + VkFormat depthAttachmentFormat + VkFormat stencilAttachmentFormat + + + VkStructureType sType + void* pNext + VkBool32 supported + + + + VkStructureType sType + void* pNext + VkBool32 shaderDrawParameters + + + + VkStructureType sType + void* pNext + VkBool32 shaderFloat1616-bit floats (halfs) in shaders + VkBool32 shaderInt88-bit integers in shaders + + + + + VkStructureType sType + void* pNext + VkShaderFloatControlsIndependence denormBehaviorIndependence + VkShaderFloatControlsIndependence roundingModeIndependence + VkBool32 shaderSignedZeroInfNanPreserveFloat16An implementation can preserve signed zero, nan, inf + VkBool32 shaderSignedZeroInfNanPreserveFloat32An implementation can preserve signed zero, nan, inf + VkBool32 shaderSignedZeroInfNanPreserveFloat64An implementation can preserve signed zero, nan, inf + VkBool32 shaderDenormPreserveFloat16An implementation can preserve denormals + VkBool32 shaderDenormPreserveFloat32An implementation can preserve denormals + VkBool32 shaderDenormPreserveFloat64An implementation can preserve denormals + VkBool32 shaderDenormFlushToZeroFloat16An implementation can flush to zero denormals + VkBool32 shaderDenormFlushToZeroFloat32An implementation can flush to zero denormals + VkBool32 shaderDenormFlushToZeroFloat64An implementation can flush to zero denormals + VkBool32 shaderRoundingModeRTEFloat16An implementation can support RTE + VkBool32 shaderRoundingModeRTEFloat32An implementation can support RTE + VkBool32 shaderRoundingModeRTEFloat64An implementation can support RTE + VkBool32 shaderRoundingModeRTZFloat16An implementation can support RTZ + VkBool32 shaderRoundingModeRTZFloat32An implementation can support RTZ + VkBool32 shaderRoundingModeRTZFloat64An implementation can support RTZ + + + + VkStructureType sType + void* pNext + VkBool32 hostQueryReset + + + + uint64_t consumer + uint64_t producer + + + VkStructureType sType + const void* pNext + const void* handle + int stride + int format + int usage + VkNativeBufferUsage2ANDROID usage2 + + + VkStructureType sType + const void* pNext + VkSwapchainImageUsageFlagsANDROID usage + + + VkStructureType sType + const void* pNext + VkBool32 sharedImage + + + uint32_t numUsedVgprs + uint32_t numUsedSgprs + uint32_t ldsSizePerLocalWorkGroup + size_t ldsUsageSizeInBytes + size_t scratchMemUsageInBytes + + + VkShaderStageFlags shaderStageMask + VkShaderResourceUsageAMD resourceUsage + uint32_t numPhysicalVgprs + uint32_t numPhysicalSgprs + uint32_t numAvailableVgprs + uint32_t numAvailableSgprs + uint32_t computeWorkGroupSize[3] + + + VkStructureType sType + const void* pNext + VkQueueGlobalPriorityKHR globalPriority + + + + VkStructureType sType + void* pNext + VkBool32 globalPriorityQuery + + + + VkStructureType sType + void* pNext + uint32_t priorityCount + VkQueueGlobalPriorityKHR priorities[VK_MAX_GLOBAL_PRIORITY_SIZE_KHR] + + + + VkStructureType sType + const void* pNext + VkObjectType objectType + uint64_t objectHandle + const char* pObjectName + + + VkStructureType sType + const void* pNext + VkObjectType objectType + uint64_t objectHandle + uint64_t tagName + size_t tagSize + const void* pTag + + + VkStructureType sType + const void* pNext + const char* pLabelName + float color[4] + + + VkStructureType sType + const void* pNext + VkDebugUtilsMessengerCreateFlagsEXT flags + VkDebugUtilsMessageSeverityFlagsEXT messageSeverity + VkDebugUtilsMessageTypeFlagsEXT messageType + PFN_vkDebugUtilsMessengerCallbackEXT pfnUserCallback + void* pUserData + + + VkStructureType sType + const void* pNext + VkDebugUtilsMessengerCallbackDataFlagsEXT flags + const char* pMessageIdName + int32_t messageIdNumber + const char* pMessage + uint32_t queueLabelCount + const VkDebugUtilsLabelEXT* pQueueLabels + uint32_t cmdBufLabelCount + const VkDebugUtilsLabelEXT* pCmdBufLabels + uint32_t objectCount + const VkDebugUtilsObjectNameInfoEXT* pObjects + + + VkStructureType sType + void* pNext + VkBool32 deviceMemoryReport + + + VkStructureType sType + const void* pNext + VkDeviceMemoryReportFlagsEXT flags + PFN_vkDeviceMemoryReportCallbackEXT pfnUserCallback + void* pUserData + + + VkStructureType sType + void* pNext + VkDeviceMemoryReportFlagsEXT flags + VkDeviceMemoryReportEventTypeEXT type + uint64_t memoryObjectId + VkDeviceSize size + VkObjectType objectType + uint64_t objectHandle + uint32_t heapIndex + + + VkStructureType sType + const void* pNext + VkExternalMemoryHandleTypeFlagBits handleType + void* pHostPointer + + + VkStructureType sType + void* pNext + uint32_t memoryTypeBits + + + VkStructureType sType + void* pNext + VkDeviceSize minImportedHostPointerAlignment + + + VkStructureType sType + void* pNext + float primitiveOverestimationSizeThe size in pixels the primitive is enlarged at each edge during conservative rasterization + float maxExtraPrimitiveOverestimationSizeThe maximum additional overestimation the client can specify in the pipeline state + float extraPrimitiveOverestimationSizeGranularityThe granularity of extra overestimation sizes the implementations supports between 0 and maxExtraOverestimationSize + VkBool32 primitiveUnderestimationtrue if the implementation supports conservative rasterization underestimation mode + VkBool32 conservativePointAndLineRasterizationtrue if conservative rasterization also applies to points and lines + VkBool32 degenerateTrianglesRasterizedtrue if degenerate triangles (those with zero area after snap) are rasterized + VkBool32 degenerateLinesRasterizedtrue if degenerate lines (those with zero length after snap) are rasterized + VkBool32 fullyCoveredFragmentShaderInputVariabletrue if the implementation supports the FullyCoveredEXT SPIR-V builtin fragment shader input variable + VkBool32 conservativeRasterizationPostDepthCoveragetrue if the implementation supports both conservative rasterization and post depth coverage sample coverage mask + + + VkStructureType sType + const void* pNext + VkTimeDomainEXT timeDomain + + + VkStructureType sType + void* pNext + uint32_t shaderEngineCountnumber of shader engines + uint32_t shaderArraysPerEngineCountnumber of shader arrays + uint32_t computeUnitsPerShaderArraynumber of physical CUs per shader array + uint32_t simdPerComputeUnitnumber of SIMDs per compute unit + uint32_t wavefrontsPerSimdnumber of wavefront slots in each SIMD + uint32_t wavefrontSizemaximum number of threads per wavefront + uint32_t sgprsPerSimdnumber of physical SGPRs per SIMD + uint32_t minSgprAllocationminimum number of SGPRs that can be allocated by a wave + uint32_t maxSgprAllocationnumber of available SGPRs + uint32_t sgprAllocationGranularitySGPRs are allocated in groups of this size + uint32_t vgprsPerSimdnumber of physical VGPRs per SIMD + uint32_t minVgprAllocationminimum number of VGPRs that can be allocated by a wave + uint32_t maxVgprAllocationnumber of available VGPRs + uint32_t vgprAllocationGranularityVGPRs are allocated in groups of this size + + + VkStructureType sType + void* pNextPointer to next structure + VkShaderCorePropertiesFlagsAMD shaderCoreFeaturesfeatures supported by the shader core + uint32_t activeComputeUnitCountnumber of active compute units across all shader engines/arrays + + + VkStructureType sType + const void* pNext + VkPipelineRasterizationConservativeStateCreateFlagsEXT flagsReserved + VkConservativeRasterizationModeEXT conservativeRasterizationModeConservative rasterization mode + float extraPrimitiveOverestimationSizeExtra overestimation to add to the primitive + + + VkStructureType sType + void* pNext + VkBool32 shaderInputAttachmentArrayDynamicIndexing + VkBool32 shaderUniformTexelBufferArrayDynamicIndexing + VkBool32 shaderStorageTexelBufferArrayDynamicIndexing + VkBool32 shaderUniformBufferArrayNonUniformIndexing + VkBool32 shaderSampledImageArrayNonUniformIndexing + VkBool32 shaderStorageBufferArrayNonUniformIndexing + VkBool32 shaderStorageImageArrayNonUniformIndexing + VkBool32 shaderInputAttachmentArrayNonUniformIndexing + VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing + VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing + VkBool32 descriptorBindingUniformBufferUpdateAfterBind + VkBool32 descriptorBindingSampledImageUpdateAfterBind + VkBool32 descriptorBindingStorageImageUpdateAfterBind + VkBool32 descriptorBindingStorageBufferUpdateAfterBind + VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind + VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind + VkBool32 descriptorBindingUpdateUnusedWhilePending + VkBool32 descriptorBindingPartiallyBound + VkBool32 descriptorBindingVariableDescriptorCount + VkBool32 runtimeDescriptorArray + + + + VkStructureType sType + void* pNext + uint32_t maxUpdateAfterBindDescriptorsInAllPools + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative + VkBool32 shaderSampledImageArrayNonUniformIndexingNative + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative + VkBool32 shaderStorageImageArrayNonUniformIndexingNative + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative + VkBool32 robustBufferAccessUpdateAfterBind + VkBool32 quadDivergentImplicitLod + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments + uint32_t maxPerStageUpdateAfterBindResources + uint32_t maxDescriptorSetUpdateAfterBindSamplers + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic + uint32_t maxDescriptorSetUpdateAfterBindSampledImages + uint32_t maxDescriptorSetUpdateAfterBindStorageImages + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments + + + + VkStructureType sType + const void* pNext + uint32_t bindingCount + const VkDescriptorBindingFlags* pBindingFlags + + + + VkStructureType sType + const void* pNext + uint32_t descriptorSetCount + const uint32_t* pDescriptorCounts + + + + VkStructureType sType + void* pNext + uint32_t maxVariableDescriptorCount + + + + VkStructureType sType + const void* pNext + VkAttachmentDescriptionFlags flags + VkFormat format + VkSampleCountFlagBits samples + VkAttachmentLoadOp loadOpLoad operation for color or depth data + VkAttachmentStoreOp storeOpStore operation for color or depth data + VkAttachmentLoadOp stencilLoadOpLoad operation for stencil data + VkAttachmentStoreOp stencilStoreOpStore operation for stencil data + VkImageLayout initialLayout + VkImageLayout finalLayout + + + + VkStructureType sType + const void* pNext + uint32_t attachment + VkImageLayout layout + VkImageAspectFlags aspectMask + + + + VkStructureType sType + const void* pNext + VkSubpassDescriptionFlags flags + VkPipelineBindPoint pipelineBindPoint + uint32_t viewMask + uint32_t inputAttachmentCount + const VkAttachmentReference2* pInputAttachments + uint32_t colorAttachmentCount + const VkAttachmentReference2* pColorAttachments + const VkAttachmentReference2* pResolveAttachments + const VkAttachmentReference2* pDepthStencilAttachment + uint32_t preserveAttachmentCount + const uint32_t* pPreserveAttachments + + + + VkStructureType sType + const void* pNext + uint32_t srcSubpass + uint32_t dstSubpass + VkPipelineStageFlags srcStageMask + VkPipelineStageFlags dstStageMask + VkAccessFlags srcAccessMask + VkAccessFlags dstAccessMask + VkDependencyFlags dependencyFlags + int32_t viewOffset + + + + VkStructureType sType + const void* pNext + VkRenderPassCreateFlags flags + uint32_t attachmentCount + const VkAttachmentDescription2* pAttachments + uint32_t subpassCount + const VkSubpassDescription2* pSubpasses + uint32_t dependencyCount + const VkSubpassDependency2* pDependencies + uint32_t correlatedViewMaskCount + const uint32_t* pCorrelatedViewMasks + + + + VkStructureType sType + const void* pNext + VkSubpassContents contents + + + + VkStructureType sType + const void* pNext + + + + VkStructureType sType + void* pNext + VkBool32 timelineSemaphore + + + + VkStructureType sType + void* pNext + uint64_t maxTimelineSemaphoreValueDifference + + + + VkStructureType sType + const void* pNext + VkSemaphoreType semaphoreType + uint64_t initialValue + + + + VkStructureType sType + const void* pNext + uint32_t waitSemaphoreValueCount + const uint64_t* pWaitSemaphoreValues + uint32_t signalSemaphoreValueCount + const uint64_t* pSignalSemaphoreValues + + + + VkStructureType sType + const void* pNext + VkSemaphoreWaitFlags flags + uint32_t semaphoreCount + const VkSemaphore* pSemaphores + const uint64_t* pValues + + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + uint64_t value + + + + uint32_t binding + uint32_t divisor + + + VkStructureType sType + const void* pNext + uint32_t vertexBindingDivisorCount + const VkVertexInputBindingDivisorDescriptionEXT* pVertexBindingDivisors + + + VkStructureType sType + void* pNext + uint32_t maxVertexAttribDivisormax value of vertex attribute divisor + + + VkStructureType sType + void* pNext + uint32_t pciDomain + uint32_t pciBus + uint32_t pciDevice + uint32_t pciFunction + + + VkStructureType sType + const void* pNext + struct AHardwareBuffer* buffer + + + VkStructureType sType + void* pNext + uint64_t androidHardwareBufferUsage + + + VkStructureType sType + void* pNext + VkDeviceSize allocationSize + uint32_t memoryTypeBits + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + + + VkStructureType sType + void* pNext + VkFormat format + uint64_t externalFormat + VkFormatFeatureFlags formatFeatures + VkComponentMapping samplerYcbcrConversionComponents + VkSamplerYcbcrModelConversion suggestedYcbcrModel + VkSamplerYcbcrRange suggestedYcbcrRange + VkChromaLocation suggestedXChromaOffset + VkChromaLocation suggestedYChromaOffset + + + VkStructureType sType + const void* pNext + VkBool32 conditionalRenderingEnableWhether this secondary command buffer may be executed during an active conditional rendering + + + VkStructureType sType + void* pNext + uint64_t externalFormat + + + VkStructureType sType + void* pNext + VkBool32 storageBuffer8BitAccess8-bit integer variables supported in StorageBuffer + VkBool32 uniformAndStorageBuffer8BitAccess8-bit integer variables supported in StorageBuffer and Uniform + VkBool32 storagePushConstant88-bit integer variables supported in PushConstant + + + + VkStructureType sType + void* pNext + VkBool32 conditionalRendering + VkBool32 inheritedConditionalRendering + + + VkStructureType sType + void* pNext + VkBool32 vulkanMemoryModel + VkBool32 vulkanMemoryModelDeviceScope + VkBool32 vulkanMemoryModelAvailabilityVisibilityChains + + + + VkStructureType sType + void* pNext + VkBool32 shaderBufferInt64Atomics + VkBool32 shaderSharedInt64Atomics + + + + VkStructureType sType + void* pNext + VkBool32 shaderBufferFloat32Atomics + VkBool32 shaderBufferFloat32AtomicAdd + VkBool32 shaderBufferFloat64Atomics + VkBool32 shaderBufferFloat64AtomicAdd + VkBool32 shaderSharedFloat32Atomics + VkBool32 shaderSharedFloat32AtomicAdd + VkBool32 shaderSharedFloat64Atomics + VkBool32 shaderSharedFloat64AtomicAdd + VkBool32 shaderImageFloat32Atomics + VkBool32 shaderImageFloat32AtomicAdd + VkBool32 sparseImageFloat32Atomics + VkBool32 sparseImageFloat32AtomicAdd + + + VkStructureType sType + void* pNext + VkBool32 shaderBufferFloat16Atomics + VkBool32 shaderBufferFloat16AtomicAdd + VkBool32 shaderBufferFloat16AtomicMinMax + VkBool32 shaderBufferFloat32AtomicMinMax + VkBool32 shaderBufferFloat64AtomicMinMax + VkBool32 shaderSharedFloat16Atomics + VkBool32 shaderSharedFloat16AtomicAdd + VkBool32 shaderSharedFloat16AtomicMinMax + VkBool32 shaderSharedFloat32AtomicMinMax + VkBool32 shaderSharedFloat64AtomicMinMax + VkBool32 shaderImageFloat32AtomicMinMax + VkBool32 sparseImageFloat32AtomicMinMax + + + VkStructureType sType + void* pNext + VkBool32 vertexAttributeInstanceRateDivisor + VkBool32 vertexAttributeInstanceRateZeroDivisor + + + VkStructureType sType + void* pNext + VkPipelineStageFlags checkpointExecutionStageMask + + + VkStructureType sType + void* pNext + VkPipelineStageFlagBits stage + void* pCheckpointMarker + + + VkStructureType sType + void* pNext + VkResolveModeFlags supportedDepthResolveModessupported depth resolve modes + VkResolveModeFlags supportedStencilResolveModessupported stencil resolve modes + VkBool32 independentResolveNonedepth and stencil resolve modes can be set independently if one of them is none + VkBool32 independentResolvedepth and stencil resolve modes can be set independently + + + + VkStructureType sType + const void* pNext + VkResolveModeFlagBits depthResolveModedepth resolve mode + VkResolveModeFlagBits stencilResolveModestencil resolve mode + const VkAttachmentReference2* pDepthStencilResolveAttachmentdepth/stencil resolve attachment + + + + VkStructureType sType + const void* pNext + VkFormat decodeMode + + + VkStructureType sType + void* pNext + VkBool32 decodeModeSharedExponent + + + VkStructureType sType + void* pNext + VkBool32 transformFeedback + VkBool32 geometryStreams + + + VkStructureType sType + void* pNext + uint32_t maxTransformFeedbackStreams + uint32_t maxTransformFeedbackBuffers + VkDeviceSize maxTransformFeedbackBufferSize + uint32_t maxTransformFeedbackStreamDataSize + uint32_t maxTransformFeedbackBufferDataSize + uint32_t maxTransformFeedbackBufferDataStride + VkBool32 transformFeedbackQueries + VkBool32 transformFeedbackStreamsLinesTriangles + VkBool32 transformFeedbackRasterizationStreamSelect + VkBool32 transformFeedbackDraw + + + VkStructureType sType + const void* pNext + VkPipelineRasterizationStateStreamCreateFlagsEXT flags + uint32_t rasterizationStream + + + VkStructureType sType + void* pNext + VkBool32 representativeFragmentTest + + + VkStructureType sType + const void* pNext + VkBool32 representativeFragmentTestEnable + + + VkStructureType sType + void* pNext + VkBool32 exclusiveScissor + + + VkStructureType sType + const void* pNext + uint32_t exclusiveScissorCount + const VkRect2D* pExclusiveScissors + + + VkStructureType sType + void* pNext + VkBool32 cornerSampledImage + + + VkStructureType sType + void* pNext + VkBool32 computeDerivativeGroupQuads + VkBool32 computeDerivativeGroupLinear + + + + VkStructureType sType + void* pNext + VkBool32 imageFootprint + + + VkStructureType sType + void* pNext + VkBool32 dedicatedAllocationImageAliasing + + + VkStructureType sType + void* pNext + VkBool32 indirectCopy + + + VkStructureType sType + void* pNext + VkQueueFlags supportedQueuesBitfield of which queues are supported for indirect copy + + + VkStructureType sType + void* pNext + VkBool32 memoryDecompression + + + VkStructureType sType + void* pNext + VkMemoryDecompressionMethodFlagsNV decompressionMethods + uint64_t maxDecompressionIndirectCount + + + uint32_t shadingRatePaletteEntryCount + const VkShadingRatePaletteEntryNV* pShadingRatePaletteEntries + + + VkStructureType sType + const void* pNext + VkBool32 shadingRateImageEnable + uint32_t viewportCount + const VkShadingRatePaletteNV* pShadingRatePalettes + + + VkStructureType sType + void* pNext + VkBool32 shadingRateImage + VkBool32 shadingRateCoarseSampleOrder + + + VkStructureType sType + void* pNext + VkExtent2D shadingRateTexelSize + uint32_t shadingRatePaletteSize + uint32_t shadingRateMaxCoarseSamples + + + VkStructureType sType + void* pNext + VkBool32 invocationMask + + + uint32_t pixelX + uint32_t pixelY + uint32_t sample + + + VkShadingRatePaletteEntryNV shadingRate + uint32_t sampleCount + uint32_t sampleLocationCount + const VkCoarseSampleLocationNV* pSampleLocations + + + VkStructureType sType + const void* pNext + VkCoarseSampleOrderTypeNV sampleOrderType + uint32_t customSampleOrderCount + const VkCoarseSampleOrderCustomNV* pCustomSampleOrders + + + VkStructureType sType + void* pNext + VkBool32 taskShader + VkBool32 meshShader + + + VkStructureType sType + void* pNext + uint32_t maxDrawMeshTasksCount + uint32_t maxTaskWorkGroupInvocations + uint32_t maxTaskWorkGroupSize[3] + uint32_t maxTaskTotalMemorySize + uint32_t maxTaskOutputCount + uint32_t maxMeshWorkGroupInvocations + uint32_t maxMeshWorkGroupSize[3] + uint32_t maxMeshTotalMemorySize + uint32_t maxMeshOutputVertices + uint32_t maxMeshOutputPrimitives + uint32_t maxMeshMultiviewViewCount + uint32_t meshOutputPerVertexGranularity + uint32_t meshOutputPerPrimitiveGranularity + + + uint32_t taskCount + uint32_t firstTask + + + VkStructureType sType + void* pNext + VkBool32 taskShader + VkBool32 meshShader + VkBool32 multiviewMeshShader + VkBool32 primitiveFragmentShadingRateMeshShader + VkBool32 meshShaderQueries + + + VkStructureType sType + void* pNext + uint32_t maxTaskWorkGroupTotalCount + uint32_t maxTaskWorkGroupCount[3] + uint32_t maxTaskWorkGroupInvocations + uint32_t maxTaskWorkGroupSize[3] + uint32_t maxTaskPayloadSize + uint32_t maxTaskSharedMemorySize + uint32_t maxTaskPayloadAndSharedMemorySize + uint32_t maxMeshWorkGroupTotalCount + uint32_t maxMeshWorkGroupCount[3] + uint32_t maxMeshWorkGroupInvocations + uint32_t maxMeshWorkGroupSize[3] + uint32_t maxMeshSharedMemorySize + uint32_t maxMeshPayloadAndSharedMemorySize + uint32_t maxMeshOutputMemorySize + uint32_t maxMeshPayloadAndOutputMemorySize + uint32_t maxMeshOutputComponents + uint32_t maxMeshOutputVertices + uint32_t maxMeshOutputPrimitives + uint32_t maxMeshOutputLayers + uint32_t maxMeshMultiviewViewCount + uint32_t meshOutputPerVertexGranularity + uint32_t meshOutputPerPrimitiveGranularity + uint32_t maxPreferredTaskWorkGroupInvocations + uint32_t maxPreferredMeshWorkGroupInvocations + VkBool32 prefersLocalInvocationVertexOutput + VkBool32 prefersLocalInvocationPrimitiveOutput + VkBool32 prefersCompactVertexOutput + VkBool32 prefersCompactPrimitiveOutput + + + uint32_t groupCountX + uint32_t groupCountY + uint32_t groupCountZ + + + VkStructureType sType + const void* pNext + VkRayTracingShaderGroupTypeKHR type + uint32_t generalShader + uint32_t closestHitShader + uint32_t anyHitShader + uint32_t intersectionShader + + + VkStructureType sType + const void* pNext + VkRayTracingShaderGroupTypeKHR type + uint32_t generalShader + uint32_t closestHitShader + uint32_t anyHitShader + uint32_t intersectionShader + const void* pShaderGroupCaptureReplayHandle + + + VkStructureType sType + const void* pNext + VkPipelineCreateFlags flagsPipeline creation flags + uint32_t stageCount + const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage + uint32_t groupCount + const VkRayTracingShaderGroupCreateInfoNV* pGroups + uint32_t maxRecursionDepth + VkPipelineLayout layoutInterface layout of the pipeline + VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of + int32_t basePipelineIndexIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of + + + VkStructureType sType + const void* pNext + VkPipelineCreateFlags flagsPipeline creation flags + uint32_t stageCount + const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage + uint32_t groupCount + const VkRayTracingShaderGroupCreateInfoKHR* pGroups + uint32_t maxPipelineRayRecursionDepth + const VkPipelineLibraryCreateInfoKHR* pLibraryInfo + const VkRayTracingPipelineInterfaceCreateInfoKHR* pLibraryInterface + const VkPipelineDynamicStateCreateInfo* pDynamicState + VkPipelineLayout layoutInterface layout of the pipeline + VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of + int32_t basePipelineIndexIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of + + + VkStructureType sType + const void* pNext + VkBuffer vertexData + VkDeviceSize vertexOffset + uint32_t vertexCount + VkDeviceSize vertexStride + VkFormat vertexFormat + VkBuffer indexData + VkDeviceSize indexOffset + uint32_t indexCount + VkIndexType indexType + VkBuffer transformDataOptional reference to array of floats representing a 3x4 row major affine transformation matrix. + VkDeviceSize transformOffset + + + VkStructureType sType + const void* pNext + VkBuffer aabbData + uint32_t numAABBs + uint32_t strideStride in bytes between AABBs + VkDeviceSize offsetOffset in bytes of the first AABB in aabbData + + + VkGeometryTrianglesNV triangles + VkGeometryAABBNV aabbs + + + VkStructureType sType + const void* pNext + VkGeometryTypeKHR geometryType + VkGeometryDataNV geometry + VkGeometryFlagsKHR flags + + + VkStructureType sType + const void* pNext + VkAccelerationStructureTypeNV type + VkBuildAccelerationStructureFlagsNV flags + uint32_t instanceCount + uint32_t geometryCount + const VkGeometryNV* pGeometries + + + VkStructureType sType + const void* pNext + VkDeviceSize compactedSize + VkAccelerationStructureInfoNV info + + + VkStructureType sType + const void* pNext + VkAccelerationStructureNV accelerationStructure + VkDeviceMemory memory + VkDeviceSize memoryOffset + uint32_t deviceIndexCount + const uint32_t* pDeviceIndices + + + VkStructureType sType + const void* pNext + uint32_t accelerationStructureCount + const VkAccelerationStructureKHR* pAccelerationStructures + + + VkStructureType sType + const void* pNext + uint32_t accelerationStructureCount + const VkAccelerationStructureNV* pAccelerationStructures + + + VkStructureType sType + const void* pNext + VkAccelerationStructureMemoryRequirementsTypeNV type + VkAccelerationStructureNV accelerationStructure + + + VkStructureType sType + void* pNext + VkBool32 accelerationStructure + VkBool32 accelerationStructureCaptureReplay + VkBool32 accelerationStructureIndirectBuild + VkBool32 accelerationStructureHostCommands + VkBool32 descriptorBindingAccelerationStructureUpdateAfterBind + + + VkStructureType sType + void* pNext + VkBool32 rayTracingPipeline + VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplay + VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplayMixed + VkBool32 rayTracingPipelineTraceRaysIndirect + VkBool32 rayTraversalPrimitiveCulling + + + VkStructureType sType + void* pNext + VkBool32 rayQuery + + + VkStructureType sType + void* pNext + uint64_t maxGeometryCount + uint64_t maxInstanceCount + uint64_t maxPrimitiveCount + uint32_t maxPerStageDescriptorAccelerationStructures + uint32_t maxPerStageDescriptorUpdateAfterBindAccelerationStructures + uint32_t maxDescriptorSetAccelerationStructures + uint32_t maxDescriptorSetUpdateAfterBindAccelerationStructures + uint32_t minAccelerationStructureScratchOffsetAlignment + + + VkStructureType sType + void* pNext + uint32_t shaderGroupHandleSize + uint32_t maxRayRecursionDepth + uint32_t maxShaderGroupStride + uint32_t shaderGroupBaseAlignment + uint32_t shaderGroupHandleCaptureReplaySize + uint32_t maxRayDispatchInvocationCount + uint32_t shaderGroupHandleAlignment + uint32_t maxRayHitAttributeSize + + + VkStructureType sType + void* pNext + uint32_t shaderGroupHandleSize + uint32_t maxRecursionDepth + uint32_t maxShaderGroupStride + uint32_t shaderGroupBaseAlignment + uint64_t maxGeometryCount + uint64_t maxInstanceCount + uint64_t maxTriangleCount + uint32_t maxDescriptorSetAccelerationStructures + + + VkDeviceAddress deviceAddress + VkDeviceSize stride + VkDeviceSize size + + + uint32_t width + uint32_t height + uint32_t depth + + + VkDeviceAddress raygenShaderRecordAddress + VkDeviceSize raygenShaderRecordSize + VkDeviceAddress missShaderBindingTableAddress + VkDeviceSize missShaderBindingTableSize + VkDeviceSize missShaderBindingTableStride + VkDeviceAddress hitShaderBindingTableAddress + VkDeviceSize hitShaderBindingTableSize + VkDeviceSize hitShaderBindingTableStride + VkDeviceAddress callableShaderBindingTableAddress + VkDeviceSize callableShaderBindingTableSize + VkDeviceSize callableShaderBindingTableStride + uint32_t width + uint32_t height + uint32_t depth + + + VkStructureType sType + void* pNext + VkBool32 rayTracingMaintenance1 + VkBool32 rayTracingPipelineTraceRaysIndirect2 + + + VkStructureType sType + void* pNext + uint32_t drmFormatModifierCount + VkDrmFormatModifierPropertiesEXT* pDrmFormatModifierProperties + + + uint64_t drmFormatModifier + uint32_t drmFormatModifierPlaneCount + VkFormatFeatureFlags drmFormatModifierTilingFeatures + + + VkStructureType sType + const void* pNext + uint64_t drmFormatModifier + VkSharingMode sharingMode + uint32_t queueFamilyIndexCount + const uint32_t* pQueueFamilyIndices + + + VkStructureType sType + const void* pNext + uint32_t drmFormatModifierCount + const uint64_t* pDrmFormatModifiers + + + VkStructureType sType + const void* pNext + uint64_t drmFormatModifier + uint32_t drmFormatModifierPlaneCount + const VkSubresourceLayout* pPlaneLayouts + + + VkStructureType sType + void* pNext + uint64_t drmFormatModifier + + + VkStructureType sType + const void* pNext + VkImageUsageFlags stencilUsage + + + + VkStructureType sType + const void* pNext + VkMemoryOverallocationBehaviorAMD overallocationBehavior + + + VkStructureType sType + void* pNext + VkBool32 fragmentDensityMap + VkBool32 fragmentDensityMapDynamic + VkBool32 fragmentDensityMapNonSubsampledImages + + + VkStructureType sType + void* pNext + VkBool32 fragmentDensityMapDeferred + + + VkStructureType sType + void* pNext + VkBool32 fragmentDensityMapOffset + + + VkStructureType sType + void* pNext + VkExtent2D minFragmentDensityTexelSize + VkExtent2D maxFragmentDensityTexelSize + VkBool32 fragmentDensityInvocations + + + VkStructureType sType + void* pNext + VkBool32 subsampledLoads + VkBool32 subsampledCoarseReconstructionEarlyAccess + uint32_t maxSubsampledArrayLayers + uint32_t maxDescriptorSetSubsampledSamplers + + + VkStructureType sType + void* pNext + VkExtent2D fragmentDensityOffsetGranularity + + + VkStructureType sType + const void* pNext + VkAttachmentReference fragmentDensityMapAttachment + + + VkStructureType sType + const void* pNext + uint32_t fragmentDensityOffsetCount + const VkOffset2D* pFragmentDensityOffsets + + + VkStructureType sType + void* pNext + VkBool32 scalarBlockLayout + + + + VkStructureType sType + const void* pNext + VkBool32 supportsProtectedRepresents if surface can be protected + + + VkStructureType sType + void* pNext + VkBool32 uniformBufferStandardLayout + + + + VkStructureType sType + void* pNext + VkBool32 depthClipEnable + + + VkStructureType sType + const void* pNext + VkPipelineRasterizationDepthClipStateCreateFlagsEXT flagsReserved + VkBool32 depthClipEnable + + + VkStructureType sType + void* pNext + VkDeviceSize heapBudget[VK_MAX_MEMORY_HEAPS] + VkDeviceSize heapUsage[VK_MAX_MEMORY_HEAPS] + + + VkStructureType sType + void* pNext + VkBool32 memoryPriority + + + VkStructureType sType + const void* pNext + float priority + + + VkStructureType sType + void* pNext + VkBool32 pageableDeviceLocalMemory + + + VkStructureType sType + void* pNext + VkBool32 bufferDeviceAddress + VkBool32 bufferDeviceAddressCaptureReplay + VkBool32 bufferDeviceAddressMultiDevice + + + + VkStructureType sType + void* pNext + VkBool32 bufferDeviceAddress + VkBool32 bufferDeviceAddressCaptureReplay + VkBool32 bufferDeviceAddressMultiDevice + + + + VkStructureType sType + const void* pNext + VkBuffer buffer + + + + + VkStructureType sType + const void* pNext + uint64_t opaqueCaptureAddress + + + + VkStructureType sType + const void* pNext + VkDeviceAddress deviceAddress + + + VkStructureType sType + void* pNext + VkImageViewType imageViewType + + + VkStructureType sType + void* pNext + VkBool32 filterCubicThe combinations of format, image type (and image view type if provided) can be filtered with VK_FILTER_CUBIC_EXT + VkBool32 filterCubicMinmaxThe combination of format, image type (and image view type if provided) can be filtered with VK_FILTER_CUBIC_EXT and ReductionMode of Min or Max + + + VkStructureType sType + void* pNext + VkBool32 imagelessFramebuffer + + + + VkStructureType sType + const void* pNext + uint32_t attachmentImageInfoCount + const VkFramebufferAttachmentImageInfo* pAttachmentImageInfos + + + + VkStructureType sType + const void* pNext + VkImageCreateFlags flagsImage creation flags + VkImageUsageFlags usageImage usage flags + uint32_t width + uint32_t height + uint32_t layerCount + uint32_t viewFormatCount + const VkFormat* pViewFormats + + + + VkStructureType sType + const void* pNext + uint32_t attachmentCount + const VkImageView* pAttachments + + + + VkStructureType sType + void* pNext + VkBool32 textureCompressionASTC_HDR + + + + VkStructureType sType + void* pNext + VkBool32 cooperativeMatrix + VkBool32 cooperativeMatrixRobustBufferAccess + + + VkStructureType sType + void* pNext + VkShaderStageFlags cooperativeMatrixSupportedStages + + + VkStructureType sType + void* pNext + uint32_t MSize + uint32_t NSize + uint32_t KSize + VkComponentTypeNV AType + VkComponentTypeNV BType + VkComponentTypeNV CType + VkComponentTypeNV DType + VkScopeNV scope + + + VkStructureType sType + void* pNext + VkBool32 ycbcrImageArrays + + + VkStructureType sType + const void* pNext + VkImageView imageView + VkDescriptorType descriptorType + VkSampler sampler + + + VkStructureType sType + void* pNext + VkDeviceAddress deviceAddress + VkDeviceSize size + + + VkStructureType sType + const void* pNext + GgpFrameToken frameToken + + + VkPipelineCreationFeedbackFlags flags + uint64_t duration + + + + VkStructureType sType + const void* pNext + VkPipelineCreationFeedback* pPipelineCreationFeedbackOutput pipeline creation feedback. + uint32_t pipelineStageCreationFeedbackCount + VkPipelineCreationFeedback* pPipelineStageCreationFeedbacksOne entry for each shader stage specified in the parent Vk*PipelineCreateInfo struct + + + + VkStructureType sType + void* pNext + VkFullScreenExclusiveEXT fullScreenExclusive + + + VkStructureType sType + const void* pNext + HMONITOR hmonitor + + + VkStructureType sType + void* pNext + VkBool32 fullScreenExclusiveSupported + + + VkStructureType sType + void* pNext + VkBool32 presentBarrier + + + VkStructureType sType + void* pNext + VkBool32 presentBarrierSupported + + + VkStructureType sType + void* pNext + VkBool32 presentBarrierEnable + + + VkStructureType sType + void* pNext + VkBool32 performanceCounterQueryPoolsperformance counters supported in query pools + VkBool32 performanceCounterMultipleQueryPoolsperformance counters from multiple query pools can be accessed in the same primary command buffer + + + VkStructureType sType + void* pNext + VkBool32 allowCommandBufferQueryCopiesFlag to specify whether performance queries are allowed to be used in vkCmdCopyQueryPoolResults + + + VkStructureType sType + void* pNext + VkPerformanceCounterUnitKHR unit + VkPerformanceCounterScopeKHR scope + VkPerformanceCounterStorageKHR storage + uint8_t uuid[VK_UUID_SIZE] + + + VkStructureType sType + void* pNext + VkPerformanceCounterDescriptionFlagsKHR flags + char name[VK_MAX_DESCRIPTION_SIZE] + char category[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] + + + VkStructureType sType + const void* pNext + uint32_t queueFamilyIndex + uint32_t counterIndexCount + const uint32_t* pCounterIndices + + + int32_t int32 + int64_t int64 + uint32_t uint32 + uint64_t uint64 + float float32 + double float64 + + + VkStructureType sType + const void* pNext + VkAcquireProfilingLockFlagsKHR flagsAcquire profiling lock flags + uint64_t timeout + + + VkStructureType sType + const void* pNext + uint32_t counterPassIndexIndex for which counter pass to submit + + + VkStructureType sType + const void* pNext + uint32_t maxPerformanceQueriesPerPoolMaximum number of VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR queries in a query pool + + + VkStructureType sType + const void* pNext + VkHeadlessSurfaceCreateFlagsEXT flags + + + VkStructureType sType + void* pNext + VkBool32 coverageReductionMode + + + VkStructureType sType + const void* pNext + VkPipelineCoverageReductionStateCreateFlagsNV flags + VkCoverageReductionModeNV coverageReductionMode + + + VkStructureType sType + void* pNext + VkCoverageReductionModeNV coverageReductionMode + VkSampleCountFlagBits rasterizationSamples + VkSampleCountFlags depthStencilSamples + VkSampleCountFlags colorSamples + + + VkStructureType sType + void* pNext + VkBool32 shaderIntegerFunctions2 + + + uint32_t value32 + uint64_t value64 + float valueFloat + VkBool32 valueBool + const char* valueString + + + VkPerformanceValueTypeINTEL type + VkPerformanceValueDataINTEL data + + + VkStructureType sType + const void* pNext + void* pUserData + + + VkStructureType sType + const void* pNext + VkQueryPoolSamplingModeINTEL performanceCountersSampling + + + + VkStructureType sType + const void* pNext + uint64_t marker + + + VkStructureType sType + const void* pNext + uint32_t marker + + + VkStructureType sType + const void* pNext + VkPerformanceOverrideTypeINTEL type + VkBool32 enable + uint64_t parameter + + + VkStructureType sType + const void* pNext + VkPerformanceConfigurationTypeINTEL type + + + VkStructureType sType + void* pNext + VkBool32 shaderSubgroupClock + VkBool32 shaderDeviceClock + + + VkStructureType sType + void* pNext + VkBool32 indexTypeUint8 + + + VkStructureType sType + void* pNext + uint32_t shaderSMCount + uint32_t shaderWarpsPerSM + + + VkStructureType sType + void* pNext + VkBool32 shaderSMBuiltins + + + VkStructureType sType + void* pNextPointer to next structure + VkBool32 fragmentShaderSampleInterlock + VkBool32 fragmentShaderPixelInterlock + VkBool32 fragmentShaderShadingRateInterlock + + + VkStructureType sType + void* pNext + VkBool32 separateDepthStencilLayouts + + + + VkStructureType sType + void* pNext + VkImageLayout stencilLayout + + + VkStructureType sType + void* pNext + VkBool32 primitiveTopologyListRestart + VkBool32 primitiveTopologyPatchListRestart + + + + VkStructureType sType + void* pNext + VkImageLayout stencilInitialLayout + VkImageLayout stencilFinalLayout + + + + VkStructureType sType + void* pNext + VkBool32 pipelineExecutableInfo + + + VkStructureType sType + const void* pNext + VkPipeline pipeline + + + + VkStructureType sType + void* pNext + VkShaderStageFlags stages + char name[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] + uint32_t subgroupSize + + + VkStructureType sType + const void* pNext + VkPipeline pipeline + uint32_t executableIndex + + + VkBool32 b32 + int64_t i64 + uint64_t u64 + double f64 + + + VkStructureType sType + void* pNext + char name[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] + VkPipelineExecutableStatisticFormatKHR format + VkPipelineExecutableStatisticValueKHR value + + + VkStructureType sType + void* pNext + char name[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] + VkBool32 isText + size_t dataSize + void* pData + + + VkStructureType sType + void* pNext + VkBool32 shaderDemoteToHelperInvocation + + + + VkStructureType sType + void* pNext + VkBool32 texelBufferAlignment + + + VkStructureType sType + void* pNext + VkDeviceSize storageTexelBufferOffsetAlignmentBytes + VkBool32 storageTexelBufferOffsetSingleTexelAlignment + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment + + + + VkStructureType sType + void* pNext + VkBool32 subgroupSizeControl + VkBool32 computeFullSubgroups + + + + VkStructureType sType + void* pNext + uint32_t minSubgroupSizeThe minimum subgroup size supported by this device + uint32_t maxSubgroupSizeThe maximum subgroup size supported by this device + uint32_t maxComputeWorkgroupSubgroupsThe maximum number of subgroups supported in a workgroup + VkShaderStageFlags requiredSubgroupSizeStagesThe shader stages that support specifying a subgroup size + + + + VkStructureType sType + void* pNext + uint32_t requiredSubgroupSize + + + + + VkStructureType sType + void* pNext + VkRenderPass renderPass + uint32_t subpass + + + VkStructureType sType + void* pNext + uint32_t maxSubpassShadingWorkgroupSizeAspectRatio + + + VkStructureType sType + void* pNext + uint32_t maxWorkGroupCount[3] + uint32_t maxWorkGroupSize[3] + uint32_t maxOutputClusterCount + VkDeviceSize indirectBufferOffsetAlignment + + + VkStructureType sType + const void* pNext + uint64_t opaqueCaptureAddress + + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + + + + VkStructureType sType + void* pNext + VkBool32 rectangularLines + VkBool32 bresenhamLines + VkBool32 smoothLines + VkBool32 stippledRectangularLines + VkBool32 stippledBresenhamLines + VkBool32 stippledSmoothLines + + + VkStructureType sType + void* pNext + uint32_t lineSubPixelPrecisionBits + + + VkStructureType sType + const void* pNext + VkLineRasterizationModeEXT lineRasterizationMode + VkBool32 stippledLineEnable + uint32_t lineStippleFactor + uint16_t lineStipplePattern + + + VkStructureType sType + void* pNext + VkBool32 pipelineCreationCacheControl + + + + VkStructureType sType + void* pNext + VkBool32 storageBuffer16BitAccess16-bit integer/floating-point variables supported in BufferBlock + VkBool32 uniformAndStorageBuffer16BitAccess16-bit integer/floating-point variables supported in BufferBlock and Block + VkBool32 storagePushConstant1616-bit integer/floating-point variables supported in PushConstant + VkBool32 storageInputOutput1616-bit integer/floating-point variables supported in shader inputs and outputs + VkBool32 multiviewMultiple views in a renderpass + VkBool32 multiviewGeometryShaderMultiple views in a renderpass w/ geometry shader + VkBool32 multiviewTessellationShaderMultiple views in a renderpass w/ tessellation shader + VkBool32 variablePointersStorageBuffer + VkBool32 variablePointers + VkBool32 protectedMemory + VkBool32 samplerYcbcrConversionSampler color conversion supported + VkBool32 shaderDrawParameters + + + VkStructureType sType + void* pNext + uint8_t deviceUUID[VK_UUID_SIZE] + uint8_t driverUUID[VK_UUID_SIZE] + uint8_t deviceLUID[VK_LUID_SIZE] + uint32_t deviceNodeMask + VkBool32 deviceLUIDValid + uint32_t subgroupSizeThe size of a subgroup for this queue. + VkShaderStageFlags subgroupSupportedStagesBitfield of what shader stages support subgroup operations + VkSubgroupFeatureFlags subgroupSupportedOperationsBitfield of what subgroup operations are supported. + VkBool32 subgroupQuadOperationsInAllStagesFlag to specify whether quad operations are available in all stages. + VkPointClippingBehavior pointClippingBehavior + uint32_t maxMultiviewViewCountmax number of views in a subpass + uint32_t maxMultiviewInstanceIndexmax instance index for a draw in a multiview subpass + VkBool32 protectedNoFault + uint32_t maxPerSetDescriptors + VkDeviceSize maxMemoryAllocationSize + + + VkStructureType sType + void* pNext + VkBool32 samplerMirrorClampToEdge + VkBool32 drawIndirectCount + VkBool32 storageBuffer8BitAccess8-bit integer variables supported in StorageBuffer + VkBool32 uniformAndStorageBuffer8BitAccess8-bit integer variables supported in StorageBuffer and Uniform + VkBool32 storagePushConstant88-bit integer variables supported in PushConstant + VkBool32 shaderBufferInt64Atomics + VkBool32 shaderSharedInt64Atomics + VkBool32 shaderFloat1616-bit floats (halfs) in shaders + VkBool32 shaderInt88-bit integers in shaders + VkBool32 descriptorIndexing + VkBool32 shaderInputAttachmentArrayDynamicIndexing + VkBool32 shaderUniformTexelBufferArrayDynamicIndexing + VkBool32 shaderStorageTexelBufferArrayDynamicIndexing + VkBool32 shaderUniformBufferArrayNonUniformIndexing + VkBool32 shaderSampledImageArrayNonUniformIndexing + VkBool32 shaderStorageBufferArrayNonUniformIndexing + VkBool32 shaderStorageImageArrayNonUniformIndexing + VkBool32 shaderInputAttachmentArrayNonUniformIndexing + VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing + VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing + VkBool32 descriptorBindingUniformBufferUpdateAfterBind + VkBool32 descriptorBindingSampledImageUpdateAfterBind + VkBool32 descriptorBindingStorageImageUpdateAfterBind + VkBool32 descriptorBindingStorageBufferUpdateAfterBind + VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind + VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind + VkBool32 descriptorBindingUpdateUnusedWhilePending + VkBool32 descriptorBindingPartiallyBound + VkBool32 descriptorBindingVariableDescriptorCount + VkBool32 runtimeDescriptorArray + VkBool32 samplerFilterMinmax + VkBool32 scalarBlockLayout + VkBool32 imagelessFramebuffer + VkBool32 uniformBufferStandardLayout + VkBool32 shaderSubgroupExtendedTypes + VkBool32 separateDepthStencilLayouts + VkBool32 hostQueryReset + VkBool32 timelineSemaphore + VkBool32 bufferDeviceAddress + VkBool32 bufferDeviceAddressCaptureReplay + VkBool32 bufferDeviceAddressMultiDevice + VkBool32 vulkanMemoryModel + VkBool32 vulkanMemoryModelDeviceScope + VkBool32 vulkanMemoryModelAvailabilityVisibilityChains + VkBool32 shaderOutputViewportIndex + VkBool32 shaderOutputLayer + VkBool32 subgroupBroadcastDynamicId + + + VkStructureType sType + void* pNext + VkDriverId driverID + char driverName[VK_MAX_DRIVER_NAME_SIZE] + char driverInfo[VK_MAX_DRIVER_INFO_SIZE] + VkConformanceVersion conformanceVersion + VkShaderFloatControlsIndependence denormBehaviorIndependence + VkShaderFloatControlsIndependence roundingModeIndependence + VkBool32 shaderSignedZeroInfNanPreserveFloat16An implementation can preserve signed zero, nan, inf + VkBool32 shaderSignedZeroInfNanPreserveFloat32An implementation can preserve signed zero, nan, inf + VkBool32 shaderSignedZeroInfNanPreserveFloat64An implementation can preserve signed zero, nan, inf + VkBool32 shaderDenormPreserveFloat16An implementation can preserve denormals + VkBool32 shaderDenormPreserveFloat32An implementation can preserve denormals + VkBool32 shaderDenormPreserveFloat64An implementation can preserve denormals + VkBool32 shaderDenormFlushToZeroFloat16An implementation can flush to zero denormals + VkBool32 shaderDenormFlushToZeroFloat32An implementation can flush to zero denormals + VkBool32 shaderDenormFlushToZeroFloat64An implementation can flush to zero denormals + VkBool32 shaderRoundingModeRTEFloat16An implementation can support RTE + VkBool32 shaderRoundingModeRTEFloat32An implementation can support RTE + VkBool32 shaderRoundingModeRTEFloat64An implementation can support RTE + VkBool32 shaderRoundingModeRTZFloat16An implementation can support RTZ + VkBool32 shaderRoundingModeRTZFloat32An implementation can support RTZ + VkBool32 shaderRoundingModeRTZFloat64An implementation can support RTZ + uint32_t maxUpdateAfterBindDescriptorsInAllPools + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative + VkBool32 shaderSampledImageArrayNonUniformIndexingNative + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative + VkBool32 shaderStorageImageArrayNonUniformIndexingNative + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative + VkBool32 robustBufferAccessUpdateAfterBind + VkBool32 quadDivergentImplicitLod + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments + uint32_t maxPerStageUpdateAfterBindResources + uint32_t maxDescriptorSetUpdateAfterBindSamplers + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic + uint32_t maxDescriptorSetUpdateAfterBindSampledImages + uint32_t maxDescriptorSetUpdateAfterBindStorageImages + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments + VkResolveModeFlags supportedDepthResolveModessupported depth resolve modes + VkResolveModeFlags supportedStencilResolveModessupported stencil resolve modes + VkBool32 independentResolveNonedepth and stencil resolve modes can be set independently if one of them is none + VkBool32 independentResolvedepth and stencil resolve modes can be set independently + VkBool32 filterMinmaxSingleComponentFormats + VkBool32 filterMinmaxImageComponentMapping + uint64_t maxTimelineSemaphoreValueDifference + VkSampleCountFlags framebufferIntegerColorSampleCounts + + + VkStructureType sType + void* pNext + VkBool32 robustImageAccess + VkBool32 inlineUniformBlock + VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind + VkBool32 pipelineCreationCacheControl + VkBool32 privateData + VkBool32 shaderDemoteToHelperInvocation + VkBool32 shaderTerminateInvocation + VkBool32 subgroupSizeControl + VkBool32 computeFullSubgroups + VkBool32 synchronization2 + VkBool32 textureCompressionASTC_HDR + VkBool32 shaderZeroInitializeWorkgroupMemory + VkBool32 dynamicRendering + VkBool32 shaderIntegerDotProduct + VkBool32 maintenance4 + + + VkStructureType sType + void* pNext + uint32_t minSubgroupSizeThe minimum subgroup size supported by this device + uint32_t maxSubgroupSizeThe maximum subgroup size supported by this device + uint32_t maxComputeWorkgroupSubgroupsThe maximum number of subgroups supported in a workgroup + VkShaderStageFlags requiredSubgroupSizeStagesThe shader stages that support specifying a subgroup size + uint32_t maxInlineUniformBlockSize + uint32_t maxPerStageDescriptorInlineUniformBlocks + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks + uint32_t maxDescriptorSetInlineUniformBlocks + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks + uint32_t maxInlineUniformTotalSize + VkBool32 integerDotProduct8BitUnsignedAccelerated + VkBool32 integerDotProduct8BitSignedAccelerated + VkBool32 integerDotProduct8BitMixedSignednessAccelerated + VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated + VkBool32 integerDotProduct4x8BitPackedSignedAccelerated + VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated + VkBool32 integerDotProduct16BitUnsignedAccelerated + VkBool32 integerDotProduct16BitSignedAccelerated + VkBool32 integerDotProduct16BitMixedSignednessAccelerated + VkBool32 integerDotProduct32BitUnsignedAccelerated + VkBool32 integerDotProduct32BitSignedAccelerated + VkBool32 integerDotProduct32BitMixedSignednessAccelerated + VkBool32 integerDotProduct64BitUnsignedAccelerated + VkBool32 integerDotProduct64BitSignedAccelerated + VkBool32 integerDotProduct64BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated + VkDeviceSize storageTexelBufferOffsetAlignmentBytes + VkBool32 storageTexelBufferOffsetSingleTexelAlignment + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment + VkDeviceSize maxBufferSize + + + VkStructureType sType + const void* pNext + VkPipelineCompilerControlFlagsAMD compilerControlFlags + + + VkStructureType sType + void* pNext + VkBool32 deviceCoherentMemory + + + VkStructureType sType + void* pNext + VkFaultLevel faultLevel + VkFaultType faultType + + + VkStructureType sType + const void* pNext + uint32_t faultCount + VkFaultData*pFaults + PFN_vkFaultCallbackFunction pfnFaultCallback + + + VkStructureType sType + void* pNext + char name[VK_MAX_EXTENSION_NAME_SIZE] + char version[VK_MAX_EXTENSION_NAME_SIZE] + VkToolPurposeFlags purposes + char description[VK_MAX_DESCRIPTION_SIZE] + char layer[VK_MAX_EXTENSION_NAME_SIZE] + + + + VkStructureType sType + const void* pNext + VkClearColorValue customBorderColor + VkFormat format + + + VkStructureType sType + void* pNext + uint32_t maxCustomBorderColorSamplers + + + VkStructureType sType + void* pNext + VkBool32 customBorderColors + VkBool32 customBorderColorWithoutFormat + + + VkStructureType sType + const void* pNext + VkComponentMapping components + VkBool32 srgb + + + VkStructureType sType + void* pNext + VkBool32 borderColorSwizzle + VkBool32 borderColorSwizzleFromImage + + + VkDeviceAddress deviceAddress + void* hostAddress + + + VkDeviceAddress deviceAddress + const void* hostAddress + + + VkDeviceAddress deviceAddress + const void* hostAddress + + + VkStructureType sType + const void* pNext + VkFormat vertexFormat + VkDeviceOrHostAddressConstKHR vertexData + VkDeviceSize vertexStride + uint32_t maxVertex + VkIndexType indexType + VkDeviceOrHostAddressConstKHR indexData + VkDeviceOrHostAddressConstKHR transformData + + + VkStructureType sType + const void* pNext + VkDeviceOrHostAddressConstKHR data + VkDeviceSize stride + + + VkStructureType sType + const void* pNext + VkBool32 arrayOfPointers + VkDeviceOrHostAddressConstKHR data + + + VkAccelerationStructureGeometryTrianglesDataKHR triangles + VkAccelerationStructureGeometryAabbsDataKHR aabbs + VkAccelerationStructureGeometryInstancesDataKHR instances + + + VkStructureType sType + const void* pNext + VkGeometryTypeKHR geometryType + VkAccelerationStructureGeometryDataKHR geometry + VkGeometryFlagsKHR flags + + + VkStructureType sType + const void* pNext + VkAccelerationStructureTypeKHR type + VkBuildAccelerationStructureFlagsKHR flags + VkBuildAccelerationStructureModeKHR mode + VkAccelerationStructureKHR srcAccelerationStructure + VkAccelerationStructureKHR dstAccelerationStructure + uint32_t geometryCount + const VkAccelerationStructureGeometryKHR* pGeometries + const VkAccelerationStructureGeometryKHR* const* ppGeometries + VkDeviceOrHostAddressKHR scratchData + + + uint32_t primitiveCount + uint32_t primitiveOffset + uint32_t firstVertex + uint32_t transformOffset + + + VkStructureType sType + const void* pNext + VkAccelerationStructureCreateFlagsKHR createFlags + VkBuffer buffer + VkDeviceSize offsetSpecified in bytes + VkDeviceSize size + VkAccelerationStructureTypeKHR type + VkDeviceAddress deviceAddress + + + float minX + float minY + float minZ + float maxX + float maxY + float maxZ + + + + float matrix[3][4] + + + + The bitfields in this structure are non-normative since bitfield ordering is implementation-defined in C. The specification defines the normative layout. + VkTransformMatrixKHR transform + uint32_t instanceCustomIndex:24 + uint32_t mask:8 + uint32_t instanceShaderBindingTableRecordOffset:24 + VkGeometryInstanceFlagsKHR flags:8 + uint64_t accelerationStructureReference + + + + VkStructureType sType + const void* pNext + VkAccelerationStructureKHR accelerationStructure + + + VkStructureType sType + const void* pNext + const uint8_t* pVersionData + + + VkStructureType sType + const void* pNext + VkAccelerationStructureKHR src + VkAccelerationStructureKHR dst + VkCopyAccelerationStructureModeKHR mode + + + VkStructureType sType + const void* pNext + VkAccelerationStructureKHR src + VkDeviceOrHostAddressKHR dst + VkCopyAccelerationStructureModeKHR mode + + + VkStructureType sType + const void* pNext + VkDeviceOrHostAddressConstKHR src + VkAccelerationStructureKHR dst + VkCopyAccelerationStructureModeKHR mode + + + VkStructureType sType + const void* pNext + uint32_t maxPipelineRayPayloadSize + uint32_t maxPipelineRayHitAttributeSize + + + VkStructureType sType + const void* pNext + uint32_t libraryCount + const VkPipeline* pLibraries + + + VkObjectType objectType + uint64_t objectHandle + VkRefreshObjectFlagsKHR flags + + + VkStructureType sType + const void* pNext + uint32_t objectCount + const VkRefreshObjectKHR* pObjects + + + VkStructureType sType + void* pNext + VkBool32 extendedDynamicState + + + VkStructureType sType + void* pNext + VkBool32 extendedDynamicState2 + VkBool32 extendedDynamicState2LogicOp + VkBool32 extendedDynamicState2PatchControlPoints + + + VkStructureType sType + void* pNext + VkBool32 extendedDynamicState3TessellationDomainOrigin + VkBool32 extendedDynamicState3DepthClampEnable + VkBool32 extendedDynamicState3PolygonMode + VkBool32 extendedDynamicState3RasterizationSamples + VkBool32 extendedDynamicState3SampleMask + VkBool32 extendedDynamicState3AlphaToCoverageEnable + VkBool32 extendedDynamicState3AlphaToOneEnable + VkBool32 extendedDynamicState3LogicOpEnable + VkBool32 extendedDynamicState3ColorBlendEnable + VkBool32 extendedDynamicState3ColorBlendEquation + VkBool32 extendedDynamicState3ColorWriteMask + VkBool32 extendedDynamicState3RasterizationStream + VkBool32 extendedDynamicState3ConservativeRasterizationMode + VkBool32 extendedDynamicState3ExtraPrimitiveOverestimationSize + VkBool32 extendedDynamicState3DepthClipEnable + VkBool32 extendedDynamicState3SampleLocationsEnable + VkBool32 extendedDynamicState3ColorBlendAdvanced + VkBool32 extendedDynamicState3ProvokingVertexMode + VkBool32 extendedDynamicState3LineRasterizationMode + VkBool32 extendedDynamicState3LineStippleEnable + VkBool32 extendedDynamicState3DepthClipNegativeOneToOne + VkBool32 extendedDynamicState3ViewportWScalingEnable + VkBool32 extendedDynamicState3ViewportSwizzle + VkBool32 extendedDynamicState3CoverageToColorEnable + VkBool32 extendedDynamicState3CoverageToColorLocation + VkBool32 extendedDynamicState3CoverageModulationMode + VkBool32 extendedDynamicState3CoverageModulationTableEnable + VkBool32 extendedDynamicState3CoverageModulationTable + VkBool32 extendedDynamicState3CoverageReductionMode + VkBool32 extendedDynamicState3RepresentativeFragmentTestEnable + VkBool32 extendedDynamicState3ShadingRateImageEnable + + + VkStructureType sType + void* pNext + VkBool32 dynamicPrimitiveTopologyUnrestricted + + + VkBlendFactor srcColorBlendFactor + VkBlendFactor dstColorBlendFactor + VkBlendOp colorBlendOp + VkBlendFactor srcAlphaBlendFactor + VkBlendFactor dstAlphaBlendFactor + VkBlendOp alphaBlendOp + + + VkBlendOp advancedBlendOp + VkBool32 srcPremultiplied + VkBool32 dstPremultiplied + VkBlendOverlapEXT blendOverlap + VkBool32 clampResults + + + VkStructureType sType + void* pNextPointer to next structure + VkSurfaceTransformFlagBitsKHR transform + + + VkStructureType sType + const void* pNext + VkSurfaceTransformFlagBitsKHR transform + + + VkStructureType sType + void* pNextPointer to next structure + VkSurfaceTransformFlagBitsKHR transform + VkRect2D renderArea + + + VkStructureType sType + void* pNext + VkBool32 diagnosticsConfig + + + VkStructureType sType + const void* pNext + VkDeviceDiagnosticsConfigFlagsNV flags + + + VkStructureType sType + const void* pNext + uint8_t pipelineIdentifier[VK_UUID_SIZE] + VkPipelineMatchControl matchControl + VkDeviceSize poolEntrySize + + + VkStructureType sType + void* pNext + VkBool32 shaderZeroInitializeWorkgroupMemory + + + + VkStructureType sType + void* pNext + VkBool32 shaderSubgroupUniformControlFlow + + + VkStructureType sType + void* pNext + VkBool32 robustBufferAccess2 + VkBool32 robustImageAccess2 + VkBool32 nullDescriptor + + + VkStructureType sType + void* pNext + VkDeviceSize robustStorageBufferAccessSizeAlignment + VkDeviceSize robustUniformBufferAccessSizeAlignment + + + VkStructureType sType + void* pNext + VkBool32 robustImageAccess + + + + VkStructureType sType + void* pNext + VkBool32 workgroupMemoryExplicitLayout + VkBool32 workgroupMemoryExplicitLayoutScalarBlockLayout + VkBool32 workgroupMemoryExplicitLayout8BitAccess + VkBool32 workgroupMemoryExplicitLayout16BitAccess + + + VkStructureType sType + void* pNext + VkBool32 constantAlphaColorBlendFactors + VkBool32 events + VkBool32 imageViewFormatReinterpretation + VkBool32 imageViewFormatSwizzle + VkBool32 imageView2DOn3DImage + VkBool32 multisampleArrayImage + VkBool32 mutableComparisonSamplers + VkBool32 pointPolygons + VkBool32 samplerMipLodBias + VkBool32 separateStencilMaskRef + VkBool32 shaderSampleRateInterpolationFunctions + VkBool32 tessellationIsolines + VkBool32 tessellationPointMode + VkBool32 triangleFans + VkBool32 vertexAttributeAccessBeyondStride + + + VkStructureType sType + void* pNext + uint32_t minVertexInputBindingStrideAlignment + + + VkStructureType sType + void* pNext + VkBool32 formatA4R4G4B4 + VkBool32 formatA4B4G4R4 + + + VkStructureType sType + void* pNext + VkBool32 subpassShading + + + VkStructureType sType + void*pNext + VkBool32 clustercullingShader + VkBool32 multiviewClusterCullingShader + + + VkStructureType sType + const void* pNext + VkDeviceSize srcOffsetSpecified in bytes + VkDeviceSize dstOffsetSpecified in bytes + VkDeviceSize sizeSpecified in bytes + + + + VkStructureType sType + const void* pNext + VkImageSubresourceLayers srcSubresource + VkOffset3D srcOffsetSpecified in pixels for both compressed and uncompressed images + VkImageSubresourceLayers dstSubresource + VkOffset3D dstOffsetSpecified in pixels for both compressed and uncompressed images + VkExtent3D extentSpecified in pixels for both compressed and uncompressed images + + + + VkStructureType sType + const void* pNext + VkImageSubresourceLayers srcSubresource + VkOffset3D srcOffsets[2]Specified in pixels for both compressed and uncompressed images + VkImageSubresourceLayers dstSubresource + VkOffset3D dstOffsets[2]Specified in pixels for both compressed and uncompressed images + + + + VkStructureType sType + const void* pNext + VkDeviceSize bufferOffsetSpecified in bytes + uint32_t bufferRowLengthSpecified in texels + uint32_t bufferImageHeight + VkImageSubresourceLayers imageSubresource + VkOffset3D imageOffsetSpecified in pixels for both compressed and uncompressed images + VkExtent3D imageExtentSpecified in pixels for both compressed and uncompressed images + + + + VkStructureType sType + const void* pNext + VkImageSubresourceLayers srcSubresource + VkOffset3D srcOffset + VkImageSubresourceLayers dstSubresource + VkOffset3D dstOffset + VkExtent3D extent + + + + VkStructureType sType + const void* pNext + VkBuffer srcBuffer + VkBuffer dstBuffer + uint32_t regionCount + const VkBufferCopy2* pRegions + + + + VkStructureType sType + const void* pNext + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageCopy2* pRegions + + + + VkStructureType sType + const void* pNext + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageBlit2* pRegions + VkFilter filter + + + + VkStructureType sType + const void* pNext + VkBuffer srcBuffer + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkBufferImageCopy2* pRegions + + + + VkStructureType sType + const void* pNext + VkImage srcImage + VkImageLayout srcImageLayout + VkBuffer dstBuffer + uint32_t regionCount + const VkBufferImageCopy2* pRegions + + + + VkStructureType sType + const void* pNext + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageResolve2* pRegions + + + + VkStructureType sType + void* pNext + VkBool32 shaderImageInt64Atomics + VkBool32 sparseImageInt64Atomics + + + VkStructureType sType + const void* pNext + const VkAttachmentReference2* pFragmentShadingRateAttachment + VkExtent2D shadingRateAttachmentTexelSize + + + VkStructureType sType + const void* pNext + VkExtent2D fragmentSize + VkFragmentShadingRateCombinerOpKHR combinerOps[2] + + + VkStructureType sType + void* pNext + VkBool32 pipelineFragmentShadingRate + VkBool32 primitiveFragmentShadingRate + VkBool32 attachmentFragmentShadingRate + + + VkStructureType sType + void* pNext + VkExtent2D minFragmentShadingRateAttachmentTexelSize + VkExtent2D maxFragmentShadingRateAttachmentTexelSize + uint32_t maxFragmentShadingRateAttachmentTexelSizeAspectRatio + VkBool32 primitiveFragmentShadingRateWithMultipleViewports + VkBool32 layeredShadingRateAttachments + VkBool32 fragmentShadingRateNonTrivialCombinerOps + VkExtent2D maxFragmentSize + uint32_t maxFragmentSizeAspectRatio + uint32_t maxFragmentShadingRateCoverageSamples + VkSampleCountFlagBits maxFragmentShadingRateRasterizationSamples + VkBool32 fragmentShadingRateWithShaderDepthStencilWrites + VkBool32 fragmentShadingRateWithSampleMask + VkBool32 fragmentShadingRateWithShaderSampleMask + VkBool32 fragmentShadingRateWithConservativeRasterization + VkBool32 fragmentShadingRateWithFragmentShaderInterlock + VkBool32 fragmentShadingRateWithCustomSampleLocations + VkBool32 fragmentShadingRateStrictMultiplyCombiner + + + VkStructureType sType + void* pNext + VkSampleCountFlags sampleCounts + VkExtent2D fragmentSize + + + VkStructureType sType + void* pNext + VkBool32 shaderTerminateInvocation + + + + VkStructureType sType + void* pNext + VkBool32 fragmentShadingRateEnums + VkBool32 supersampleFragmentShadingRates + VkBool32 noInvocationFragmentShadingRates + + + VkStructureType sType + void* pNext + VkSampleCountFlagBits maxFragmentShadingRateInvocationCount + + + VkStructureType sType + const void* pNext + VkFragmentShadingRateTypeNV shadingRateType + VkFragmentShadingRateNV shadingRate + VkFragmentShadingRateCombinerOpKHR combinerOps[2] + + + VkStructureType sType + const void* pNext + VkDeviceSize accelerationStructureSize + VkDeviceSize updateScratchSize + VkDeviceSize buildScratchSize + + + VkStructureType sType + void* pNext + VkBool32 image2DViewOf3D + VkBool32 sampler2DViewOf3D + + + VkStructureType sType + void* pNext + VkBool32 imageSlicedViewOf3D + + + VkStructureType sType + void* pNext + VkBool32 attachmentFeedbackLoopDynamicState + + + VkStructureType sType + void* pNext + VkBool32 mutableDescriptorType + + + + uint32_t descriptorTypeCount + const VkDescriptorType* pDescriptorTypes + + + + VkStructureType sType + const void* pNext + uint32_t mutableDescriptorTypeListCount + const VkMutableDescriptorTypeListEXT* pMutableDescriptorTypeLists + + + + VkStructureType sType + void* pNext + VkBool32 depthClipControl + + + VkStructureType sType + const void* pNext + VkBool32 negativeOneToOne + + + VkStructureType sType + void* pNext + VkBool32 vertexInputDynamicState + + + VkStructureType sType + void* pNext + VkBool32 externalMemoryRDMA + + + VkStructureType sType + void* pNext + uint32_t binding + uint32_t stride + VkVertexInputRate inputRate + uint32_t divisor + + + VkStructureType sType + void* pNext + uint32_t locationlocation of the shader vertex attrib + uint32_t bindingVertex buffer binding id + VkFormat formatformat of source data + uint32_t offsetOffset of first element in bytes from base of vertex + + + VkStructureType sType + void* pNext + VkBool32 colorWriteEnable + + + VkStructureType sType + const void* pNext + uint32_t attachmentCount# of pAttachments + const VkBool32* pColorWriteEnables + + + VkStructureType sType + const void* pNext + VkPipelineStageFlags2 srcStageMask + VkAccessFlags2 srcAccessMask + VkPipelineStageFlags2 dstStageMask + VkAccessFlags2 dstAccessMask + + + + VkStructureType sType + const void* pNext + VkPipelineStageFlags2 srcStageMask + VkAccessFlags2 srcAccessMask + VkPipelineStageFlags2 dstStageMask + VkAccessFlags2 dstAccessMask + VkImageLayout oldLayout + VkImageLayout newLayout + uint32_t srcQueueFamilyIndex + uint32_t dstQueueFamilyIndex + VkImage image + VkImageSubresourceRange subresourceRange + + + + VkStructureType sType + const void* pNext + VkPipelineStageFlags2 srcStageMask + VkAccessFlags2 srcAccessMask + VkPipelineStageFlags2 dstStageMask + VkAccessFlags2 dstAccessMask + uint32_t srcQueueFamilyIndex + uint32_t dstQueueFamilyIndex + VkBuffer buffer + VkDeviceSize offset + VkDeviceSize size + + + + VkStructureType sType + const void* pNext + VkDependencyFlags dependencyFlags + uint32_t memoryBarrierCount + const VkMemoryBarrier2* pMemoryBarriers + uint32_t bufferMemoryBarrierCount + const VkBufferMemoryBarrier2* pBufferMemoryBarriers + uint32_t imageMemoryBarrierCount + const VkImageMemoryBarrier2* pImageMemoryBarriers + + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + uint64_t value + VkPipelineStageFlags2 stageMask + uint32_t deviceIndex + + + + VkStructureType sType + const void* pNext + VkCommandBuffer commandBuffer + uint32_t deviceMask + + + + VkStructureType sType + const void* pNext + VkSubmitFlags flags + uint32_t waitSemaphoreInfoCount + const VkSemaphoreSubmitInfo* pWaitSemaphoreInfos + uint32_t commandBufferInfoCount + const VkCommandBufferSubmitInfo* pCommandBufferInfos + uint32_t signalSemaphoreInfoCount + const VkSemaphoreSubmitInfo* pSignalSemaphoreInfos + + + + VkStructureType sType + void* pNext + VkPipelineStageFlags2 checkpointExecutionStageMask + + + VkStructureType sType + void* pNext + VkPipelineStageFlags2 stage + void* pCheckpointMarker + + + VkStructureType sType + void* pNext + VkBool32 synchronization2 + + + + VkStructureType sType + void* pNext + VkBool32 hostImageCopy + + + VkStructureType sType + void* pNext + uint32_t copySrcLayoutCount + VkImageLayout* pCopySrcLayouts + uint32_t copyDstLayoutCount + VkImageLayout* pCopyDstLayouts + uint8_t optimalTilingLayoutUUID[VK_UUID_SIZE] + VkBool32 identicalMemoryTypeRequirements + + + VkStructureType sType + const void* pNext + const void* pHostPointer + uint32_t memoryRowLengthSpecified in texels + uint32_t memoryImageHeight + VkImageSubresourceLayers imageSubresource + VkOffset3D imageOffset + VkExtent3D imageExtent + + + VkStructureType sType + const void* pNext + void* pHostPointer + uint32_t memoryRowLengthSpecified in texels + uint32_t memoryImageHeight + VkImageSubresourceLayers imageSubresource + VkOffset3D imageOffset + VkExtent3D imageExtent + + + VkStructureType sType + const void* pNext + VkHostImageCopyFlagsEXT flags + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkMemoryToImageCopyEXT* pRegions + + + VkStructureType sType + const void* pNext + VkHostImageCopyFlagsEXT flags + VkImage srcImage + VkImageLayout srcImageLayout + uint32_t regionCount + const VkImageToMemoryCopyEXT* pRegions + + + VkStructureType sType + const void* pNext + VkHostImageCopyFlagsEXT flags + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageCopy2* pRegions + + + VkStructureType sType + const void* pNext + VkImage image + VkImageLayout oldLayout + VkImageLayout newLayout + VkImageSubresourceRange subresourceRange + + + VkStructureType sType + void* pNext + VkDeviceSize sizeSpecified in bytes + + + VkStructureType sType + void* pNext + VkBool32 optimalDeviceAccessSpecifies if device access is optimal + VkBool32 identicalMemoryLayoutSpecifies if memory layout is identical + + + VkStructureType sType + void* pNext + VkBool32 deviceNoDynamicHostAllocations + VkBool32 deviceDestroyFreesMemory + VkBool32 commandPoolMultipleCommandBuffersRecording + VkBool32 commandPoolResetCommandBuffer + VkBool32 commandBufferSimultaneousUse + VkBool32 secondaryCommandBufferNullOrImagelessFramebuffer + VkBool32 recycleDescriptorSetMemory + VkBool32 recyclePipelineMemory + uint32_t maxRenderPassSubpasses + uint32_t maxRenderPassDependencies + uint32_t maxSubpassInputAttachments + uint32_t maxSubpassPreserveAttachments + uint32_t maxFramebufferAttachments + uint32_t maxDescriptorSetLayoutBindings + uint32_t maxQueryFaultCount + uint32_t maxCallbackFaultCount + uint32_t maxCommandPoolCommandBuffers + VkDeviceSize maxCommandBufferSize + + + VkStructureType sType + const void* pNext + VkDeviceSize poolEntrySize + uint32_t poolEntryCount + + + VkStructureType sType + const void* pNext + uint32_t pipelineCacheCreateInfoCount + const VkPipelineCacheCreateInfo* pPipelineCacheCreateInfos + uint32_t pipelinePoolSizeCount + const VkPipelinePoolSize* pPipelinePoolSizes + uint32_t semaphoreRequestCount + uint32_t commandBufferRequestCount + uint32_t fenceRequestCount + uint32_t deviceMemoryRequestCount + uint32_t bufferRequestCount + uint32_t imageRequestCount + uint32_t eventRequestCount + uint32_t queryPoolRequestCount + uint32_t bufferViewRequestCount + uint32_t imageViewRequestCount + uint32_t layeredImageViewRequestCount + uint32_t pipelineCacheRequestCount + uint32_t pipelineLayoutRequestCount + uint32_t renderPassRequestCount + uint32_t graphicsPipelineRequestCount + uint32_t computePipelineRequestCount + uint32_t descriptorSetLayoutRequestCount + uint32_t samplerRequestCount + uint32_t descriptorPoolRequestCount + uint32_t descriptorSetRequestCount + uint32_t framebufferRequestCount + uint32_t commandPoolRequestCount + uint32_t samplerYcbcrConversionRequestCount + uint32_t surfaceRequestCount + uint32_t swapchainRequestCount + uint32_t displayModeRequestCount + uint32_t subpassDescriptionRequestCount + uint32_t attachmentDescriptionRequestCount + uint32_t descriptorSetLayoutBindingRequestCount + uint32_t descriptorSetLayoutBindingLimit + uint32_t maxImageViewMipLevels + uint32_t maxImageViewArrayLayers + uint32_t maxLayeredImageViewMipLevels + uint32_t maxOcclusionQueriesPerPool + uint32_t maxPipelineStatisticsQueriesPerPool + uint32_t maxTimestampQueriesPerPool + uint32_t maxImmutableSamplersPerDescriptorSetLayout + + + VkStructureType sType + const void* pNext + VkDeviceSize commandPoolReservedSize + uint32_t commandPoolMaxCommandBuffers + + + VkStructureType sType + void* pNext + VkDeviceSize commandPoolAllocated + VkDeviceSize commandPoolReservedSize + VkDeviceSize commandBufferAllocated + + + VkStructureType sType + void* pNext + VkBool32 shaderAtomicInstructions + + + VkStructureType sType + void* pNext + VkBool32 primitivesGeneratedQuery + VkBool32 primitivesGeneratedQueryWithRasterizerDiscard + VkBool32 primitivesGeneratedQueryWithNonZeroStreams + + + VkStructureType sType + void* pNext + VkBool32 legacyDithering + + + VkStructureType sType + void* pNext + VkBool32 multisampledRenderToSingleSampled + + + VkStructureType sType + void* pNext + VkBool32 optimal + + + VkStructureType sType + const void* pNext + VkBool32 multisampledRenderToSingleSampledEnable + VkSampleCountFlagBits rasterizationSamples + + + VkStructureType sType + void* pNext + VkBool32 pipelineProtectedAccess + + + VkStructureType sType + void* pNext + VkVideoCodecOperationFlagsKHR videoCodecOperations + + + VkStructureType sType + void* pNext + VkBool32 queryResultStatusSupport + + + VkStructureType sType + const void* pNext + uint32_t profileCount + const VkVideoProfileInfoKHR* pProfiles + + + VkStructureType sType + const void* pNext + VkImageUsageFlags imageUsage + + + VkStructureType sType + void* pNext + VkFormat format + VkComponentMapping componentMapping + VkImageCreateFlags imageCreateFlags + VkImageType imageType + VkImageTiling imageTiling + VkImageUsageFlags imageUsageFlags + + + VkStructureType sType + const void* pNext + VkVideoCodecOperationFlagBitsKHR videoCodecOperation + VkVideoChromaSubsamplingFlagsKHR chromaSubsampling + VkVideoComponentBitDepthFlagsKHR lumaBitDepth + VkVideoComponentBitDepthFlagsKHR chromaBitDepth + + + VkStructureType sType + void* pNext + VkVideoCapabilityFlagsKHR flags + VkDeviceSize minBitstreamBufferOffsetAlignment + VkDeviceSize minBitstreamBufferSizeAlignment + VkExtent2D pictureAccessGranularity + VkExtent2D minCodedExtent + VkExtent2D maxCodedExtent + uint32_t maxDpbSlots + uint32_t maxActiveReferencePictures + VkExtensionProperties stdHeaderVersion + + + VkStructureType sType + void* pNext + uint32_t memoryBindIndex + VkMemoryRequirements memoryRequirements + + + VkStructureType sType + const void* pNext + uint32_t memoryBindIndex + VkDeviceMemory memory + VkDeviceSize memoryOffset + VkDeviceSize memorySize + + + VkStructureType sType + const void* pNext + VkOffset2D codedOffsetThe offset to be used for the picture resource, currently only used in field mode + VkExtent2D codedExtentThe extent to be used for the picture resource + uint32_t baseArrayLayerThe first array layer to be accessed for the Decode or Encode Operations + VkImageView imageViewBindingThe ImageView binding of the resource + + + VkStructureType sType + const void* pNext + int32_t slotIndexThe reference slot index + const VkVideoPictureResourceInfoKHR* pPictureResourceThe reference picture resource + + + VkStructureType sType + void* pNext + VkVideoDecodeCapabilityFlagsKHR flags + + + VkStructureType sType + const void* pNext + VkVideoDecodeUsageFlagsKHR videoUsageHints + + + VkStructureType sType + const void* pNext + VkVideoDecodeFlagsKHR flags + VkBuffer srcBuffer + VkDeviceSize srcBufferOffset + VkDeviceSize srcBufferRange + VkVideoPictureResourceInfoKHR dstPictureResource + const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot + uint32_t referenceSlotCount + const VkVideoReferenceSlotInfoKHR* pReferenceSlots + + Video Decode Codec Standard specific structures + #include "vk_video/vulkan_video_codec_h264std.h" + + + + + + + + + + + + + + + + + + + #include "vk_video/vulkan_video_codec_h264std_decode.h" + + + + + + VkStructureType sType + const void* pNext + StdVideoH264ProfileIdc stdProfileIdc + VkVideoDecodeH264PictureLayoutFlagBitsKHR pictureLayout + + + VkStructureType sType + void* pNext + StdVideoH264LevelIdc maxLevelIdc + VkOffset2D fieldOffsetGranularity + + + + + VkStructureType sType + const void* pNext + uint32_t stdSPSCount + const StdVideoH264SequenceParameterSet* pStdSPSs + uint32_t stdPPSCount + const StdVideoH264PictureParameterSet* pStdPPSsList of Picture Parameters associated with the spsStd, above + + + VkStructureType sType + const void* pNext + uint32_t maxStdSPSCount + uint32_t maxStdPPSCount + const VkVideoDecodeH264SessionParametersAddInfoKHR* pParametersAddInfo + + + VkStructureType sType + const void* pNext + const StdVideoDecodeH264PictureInfo* pStdPictureInfo + uint32_t sliceCount + const uint32_t* pSliceOffsets + + + VkStructureType sType + const void* pNext + const StdVideoDecodeH264ReferenceInfo* pStdReferenceInfo + + #include "vk_video/vulkan_video_codec_h265std.h" + + + + + + + + + + + + + + + + + + + #include "vk_video/vulkan_video_codec_h265std_decode.h" + + + + + + VkStructureType sType + const void* pNext + StdVideoH265ProfileIdc stdProfileIdc + + + VkStructureType sType + void* pNext + StdVideoH265LevelIdc maxLevelIdc + + + VkStructureType sType + const void* pNext + uint32_t stdVPSCount + const StdVideoH265VideoParameterSet* pStdVPSs + uint32_t stdSPSCount + const StdVideoH265SequenceParameterSet* pStdSPSs + uint32_t stdPPSCount + const StdVideoH265PictureParameterSet* pStdPPSsList of Picture Parameters associated with the spsStd, above + + + VkStructureType sType + const void* pNext + uint32_t maxStdVPSCount + uint32_t maxStdSPSCount + uint32_t maxStdPPSCount + const VkVideoDecodeH265SessionParametersAddInfoKHR* pParametersAddInfo + + + VkStructureType sType + const void* pNext + const StdVideoDecodeH265PictureInfo* pStdPictureInfo + uint32_t sliceSegmentCount + const uint32_t* pSliceSegmentOffsets + + + VkStructureType sType + const void* pNext + const StdVideoDecodeH265ReferenceInfo* pStdReferenceInfo + + + VkStructureType sType + const void* pNext + uint32_t queueFamilyIndex + VkVideoSessionCreateFlagsKHR flags + const VkVideoProfileInfoKHR* pVideoProfile + VkFormat pictureFormat + VkExtent2D maxCodedExtent + VkFormat referencePictureFormat + uint32_t maxDpbSlots + uint32_t maxActiveReferencePictures + const VkExtensionProperties* pStdHeaderVersion + + + VkStructureType sType + const void* pNext + VkVideoSessionParametersCreateFlagsKHR flags + VkVideoSessionParametersKHR videoSessionParametersTemplate + VkVideoSessionKHR videoSession + + + VkStructureType sType + const void* pNext + uint32_t updateSequenceCount + + + VkStructureType sType + const void* pNext + VkVideoSessionParametersKHR videoSessionParameters + + + VkStructureType sType + void* pNext + VkBool32 hasOverrides + + + VkStructureType sType + const void* pNext + VkVideoBeginCodingFlagsKHR flags + VkVideoSessionKHR videoSession + VkVideoSessionParametersKHR videoSessionParameters + uint32_t referenceSlotCount + const VkVideoReferenceSlotInfoKHR* pReferenceSlots + + + VkStructureType sType + const void* pNext + VkVideoEndCodingFlagsKHR flags + + + VkStructureType sType + const void* pNext + VkVideoCodingControlFlagsKHR flags + + + VkStructureType sType + const void* pNext + VkVideoEncodeUsageFlagsKHR videoUsageHints + VkVideoEncodeContentFlagsKHR videoContentHints + VkVideoEncodeTuningModeKHR tuningMode + + + VkStructureType sType + const void* pNext + VkVideoEncodeFlagsKHR flags + VkBuffer dstBuffer + VkDeviceSize dstBufferOffset + VkDeviceSize dstBufferRange + VkVideoPictureResourceInfoKHR srcPictureResource + const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot + uint32_t referenceSlotCount + const VkVideoReferenceSlotInfoKHR* pReferenceSlots + uint32_t precedingExternallyEncodedBytes + + + VkStructureType sType + const void* pNext + VkVideoEncodeFeedbackFlagsKHR encodeFeedbackFlags + + + VkStructureType sType + const void* pNext + uint32_t qualityLevel + + + VkStructureType sType + const void* pNext + const VkVideoProfileInfoKHR* pVideoProfile + uint32_t qualityLevel + + + VkStructureType sType + void* pNext + VkVideoEncodeRateControlModeFlagBitsKHR preferredRateControlMode + uint32_t preferredRateControlLayerCount + + + VkStructureType sType + const void* pNext + VkVideoEncodeRateControlFlagsKHR flags + VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode + uint32_t layerCount + const VkVideoEncodeRateControlLayerInfoKHR* pLayers + uint32_t virtualBufferSizeInMs + uint32_t initialVirtualBufferSizeInMs + + + VkStructureType sType + const void* pNext + uint64_t averageBitrate + uint64_t maxBitrate + uint32_t frameRateNumerator + uint32_t frameRateDenominator + + + VkStructureType sType + void* pNext + VkVideoEncodeCapabilityFlagsKHR flags + VkVideoEncodeRateControlModeFlagsKHR rateControlModes + uint32_t maxRateControlLayers + uint64_t maxBitrate + uint32_t maxQualityLevels + VkExtent2D encodeInputPictureGranularity + VkVideoEncodeFeedbackFlagsKHR supportedEncodeFeedbackFlags + + + VkStructureType sType + void* pNext + VkVideoEncodeH264CapabilityFlagsEXT flags + StdVideoH264LevelIdc maxLevelIdc + uint32_t maxSliceCount + uint32_t maxPPictureL0ReferenceCount + uint32_t maxBPictureL0ReferenceCount + uint32_t maxL1ReferenceCount + uint32_t maxTemporalLayerCount + VkBool32 expectDyadicTemporalLayerPattern + int32_t minQp + int32_t maxQp + VkBool32 prefersGopRemainingFrames + VkBool32 requiresGopRemainingFrames + VkVideoEncodeH264StdFlagsEXT stdSyntaxFlags + + + VkStructureType sType + void* pNext + VkVideoEncodeH264RateControlFlagsEXT preferredRateControlFlags + uint32_t preferredGopFrameCount + uint32_t preferredIdrPeriod + uint32_t preferredConsecutiveBFrameCount + uint32_t preferredTemporalLayerCount + VkVideoEncodeH264QpEXT preferredConstantQp + uint32_t preferredMaxL0ReferenceCount + uint32_t preferredMaxL1ReferenceCount + VkBool32 preferredStdEntropyCodingModeFlag + + #include "vk_video/vulkan_video_codec_h264std_encode.h" + + + + + + + + + + + + VkStructureType sType + const void* pNext + VkBool32 useMaxLevelIdc + StdVideoH264LevelIdc maxLevelIdc + + + VkStructureType sType + const void* pNext + uint32_t stdSPSCount + const StdVideoH264SequenceParameterSet* pStdSPSs + uint32_t stdPPSCount + const StdVideoH264PictureParameterSet* pStdPPSsList of Picture Parameters associated with the spsStd, above + + + VkStructureType sType + const void* pNext + uint32_t maxStdSPSCount + uint32_t maxStdPPSCount + const VkVideoEncodeH264SessionParametersAddInfoEXT* pParametersAddInfo + + + VkStructureType sType + const void* pNext + VkBool32 writeStdSPS + VkBool32 writeStdPPS + uint32_t stdSPSId + uint32_t stdPPSId + + + VkStructureType sType + void* pNext + VkBool32 hasStdSPSOverrides + VkBool32 hasStdPPSOverrides + + + VkStructureType sType + const void* pNext + const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo + + + VkStructureType sType + const void* pNext + uint32_t naluSliceEntryCount + const VkVideoEncodeH264NaluSliceInfoEXT* pNaluSliceEntries + const StdVideoEncodeH264PictureInfo* pStdPictureInfo + VkBool32 generatePrefixNalu + + + VkStructureType sType + const void* pNext + StdVideoH264ProfileIdc stdProfileIdc + + + VkStructureType sType + const void* pNext + int32_t constantQp + const StdVideoEncodeH264SliceHeader* pStdSliceHeader + + + VkStructureType sType + const void* pNext + VkVideoEncodeH264RateControlFlagsEXT flags + uint32_t gopFrameCount + uint32_t idrPeriod + uint32_t consecutiveBFrameCount + uint32_t temporalLayerCount + + + int32_t qpI + int32_t qpP + int32_t qpB + + + uint32_t frameISize + uint32_t framePSize + uint32_t frameBSize + + + VkStructureType sType + const void* pNext + VkBool32 useGopRemainingFrames + uint32_t gopRemainingI + uint32_t gopRemainingP + uint32_t gopRemainingB + + + VkStructureType sType + const void* pNext + VkBool32 useMinQp + VkVideoEncodeH264QpEXT minQp + VkBool32 useMaxQp + VkVideoEncodeH264QpEXT maxQp + VkBool32 useMaxFrameSize + VkVideoEncodeH264FrameSizeEXT maxFrameSize + + + VkStructureType sType + void* pNext + VkVideoEncodeH265CapabilityFlagsEXT flags + StdVideoH265LevelIdc maxLevelIdc + uint32_t maxSliceSegmentCount + VkExtent2D maxTiles + VkVideoEncodeH265CtbSizeFlagsEXT ctbSizes + VkVideoEncodeH265TransformBlockSizeFlagsEXT transformBlockSizes + uint32_t maxPPictureL0ReferenceCount + uint32_t maxBPictureL0ReferenceCount + uint32_t maxL1ReferenceCount + uint32_t maxSubLayerCount + VkBool32 expectDyadicTemporalSubLayerPattern + int32_t minQp + int32_t maxQp + VkBool32 prefersGopRemainingFrames + VkBool32 requiresGopRemainingFrames + VkVideoEncodeH265StdFlagsEXT stdSyntaxFlags + + + VkStructureType sType + void* pNext + VkVideoEncodeH265RateControlFlagsEXT preferredRateControlFlags + uint32_t preferredGopFrameCount + uint32_t preferredIdrPeriod + uint32_t preferredConsecutiveBFrameCount + uint32_t preferredSubLayerCount + VkVideoEncodeH265QpEXT preferredConstantQp + uint32_t preferredMaxL0ReferenceCount + uint32_t preferredMaxL1ReferenceCount + + #include "vk_video/vulkan_video_codec_h265std_encode.h" + + + + + + + + + + VkStructureType sType + const void* pNext + VkBool32 useMaxLevelIdc + StdVideoH265LevelIdc maxLevelIdc + + + VkStructureType sType + const void* pNext + uint32_t stdVPSCount + const StdVideoH265VideoParameterSet* pStdVPSs + uint32_t stdSPSCount + const StdVideoH265SequenceParameterSet* pStdSPSs + uint32_t stdPPSCount + const StdVideoH265PictureParameterSet* pStdPPSsList of Picture Parameters associated with the spsStd, above + + + VkStructureType sType + const void* pNext + uint32_t maxStdVPSCount + uint32_t maxStdSPSCount + uint32_t maxStdPPSCount + const VkVideoEncodeH265SessionParametersAddInfoEXT* pParametersAddInfo + + + VkStructureType sType + const void* pNext + VkBool32 writeStdVPS + VkBool32 writeStdSPS + VkBool32 writeStdPPS + uint32_t stdVPSId + uint32_t stdSPSId + uint32_t stdPPSId + + + VkStructureType sType + void* pNext + VkBool32 hasStdVPSOverrides + VkBool32 hasStdSPSOverrides + VkBool32 hasStdPPSOverrides + + + VkStructureType sType + const void* pNext + uint32_t naluSliceSegmentEntryCount + const VkVideoEncodeH265NaluSliceSegmentInfoEXT* pNaluSliceSegmentEntries + const StdVideoEncodeH265PictureInfo* pStdPictureInfo + + + VkStructureType sType + const void* pNext + int32_t constantQp + const StdVideoEncodeH265SliceSegmentHeader* pStdSliceSegmentHeader + + + VkStructureType sType + const void* pNext + VkVideoEncodeH265RateControlFlagsEXT flags + uint32_t gopFrameCount + uint32_t idrPeriod + uint32_t consecutiveBFrameCount + uint32_t subLayerCount + + + int32_t qpI + int32_t qpP + int32_t qpB + + + uint32_t frameISize + uint32_t framePSize + uint32_t frameBSize + + + VkStructureType sType + const void* pNext + VkBool32 useGopRemainingFrames + uint32_t gopRemainingI + uint32_t gopRemainingP + uint32_t gopRemainingB + + + VkStructureType sType + const void* pNext + VkBool32 useMinQp + VkVideoEncodeH265QpEXT minQp + VkBool32 useMaxQp + VkVideoEncodeH265QpEXT maxQp + VkBool32 useMaxFrameSize + VkVideoEncodeH265FrameSizeEXT maxFrameSize + + + VkStructureType sType + const void* pNext + StdVideoH265ProfileIdc stdProfileIdc + + + VkStructureType sType + const void* pNext + const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo + + + VkStructureType sType + void* pNext + VkBool32 inheritedViewportScissor2D + + + VkStructureType sType + const void* pNext + VkBool32 viewportScissor2D + uint32_t viewportDepthCount + const VkViewport* pViewportDepths + + + VkStructureType sType + void* pNext + VkBool32 ycbcr2plane444Formats + + + VkStructureType sType + void* pNext + VkBool32 provokingVertexLast + VkBool32 transformFeedbackPreservesProvokingVertex + + + VkStructureType sType + void* pNext + VkBool32 provokingVertexModePerPipeline + VkBool32 transformFeedbackPreservesTriangleFanProvokingVertex + + + VkStructureType sType + const void* pNext + VkProvokingVertexModeEXT provokingVertexMode + + + VkStructureType sType + const void* pNext + size_t dataSize + const void* pData + + + VkStructureType sType + const void* pNext + VkCuModuleNVX module + const char* pName + + + VkStructureType sType + const void* pNext + VkCuFunctionNVX function + uint32_t gridDimX + uint32_t gridDimY + uint32_t gridDimZ + uint32_t blockDimX + uint32_t blockDimY + uint32_t blockDimZ + uint32_t sharedMemBytes + size_t paramCount + const void* const * pParams + size_t extraCount + const void* const * pExtras + + + VkStructureType sType + void* pNext + VkBool32 descriptorBuffer + VkBool32 descriptorBufferCaptureReplay + VkBool32 descriptorBufferImageLayoutIgnored + VkBool32 descriptorBufferPushDescriptors + + + VkStructureType sType + void* pNext + VkBool32 combinedImageSamplerDescriptorSingleArray + VkBool32 bufferlessPushDescriptors + VkBool32 allowSamplerImageViewPostSubmitCreation + VkDeviceSize descriptorBufferOffsetAlignment + uint32_t maxDescriptorBufferBindings + uint32_t maxResourceDescriptorBufferBindings + uint32_t maxSamplerDescriptorBufferBindings + uint32_t maxEmbeddedImmutableSamplerBindings + uint32_t maxEmbeddedImmutableSamplers + size_t bufferCaptureReplayDescriptorDataSize + size_t imageCaptureReplayDescriptorDataSize + size_t imageViewCaptureReplayDescriptorDataSize + size_t samplerCaptureReplayDescriptorDataSize + size_t accelerationStructureCaptureReplayDescriptorDataSize + size_t samplerDescriptorSize + size_t combinedImageSamplerDescriptorSize + size_t sampledImageDescriptorSize + size_t storageImageDescriptorSize + size_t uniformTexelBufferDescriptorSize + size_t robustUniformTexelBufferDescriptorSize + size_t storageTexelBufferDescriptorSize + size_t robustStorageTexelBufferDescriptorSize + size_t uniformBufferDescriptorSize + size_t robustUniformBufferDescriptorSize + size_t storageBufferDescriptorSize + size_t robustStorageBufferDescriptorSize + size_t inputAttachmentDescriptorSize + size_t accelerationStructureDescriptorSize + VkDeviceSize maxSamplerDescriptorBufferRange + VkDeviceSize maxResourceDescriptorBufferRange + VkDeviceSize samplerDescriptorBufferAddressSpaceSize + VkDeviceSize resourceDescriptorBufferAddressSpaceSize + VkDeviceSize descriptorBufferAddressSpaceSize + + + VkStructureType sType + void* pNext + size_t combinedImageSamplerDensityMapDescriptorSize + + + VkStructureType sType + void* pNext + VkDeviceAddress address + VkDeviceSize range + VkFormat format + + + VkStructureType sType + void* pNext + VkDeviceAddress address + VkBufferUsageFlags usage + + + VkStructureType sType + void* pNext + VkBuffer buffer + + + const VkSampler* pSampler + const VkDescriptorImageInfo* pCombinedImageSampler + const VkDescriptorImageInfo* pInputAttachmentImage + const VkDescriptorImageInfo* pSampledImage + const VkDescriptorImageInfo* pStorageImage + const VkDescriptorAddressInfoEXT* pUniformTexelBuffer + const VkDescriptorAddressInfoEXT* pStorageTexelBuffer + const VkDescriptorAddressInfoEXT* pUniformBuffer + const VkDescriptorAddressInfoEXT* pStorageBuffer + VkDeviceAddress accelerationStructure + + + VkStructureType sType + const void* pNext + VkDescriptorType type + VkDescriptorDataEXT data + + + VkStructureType sType + const void* pNext + VkBuffer buffer + + + VkStructureType sType + const void* pNext + VkImage image + + + VkStructureType sType + const void* pNext + VkImageView imageView + + + VkStructureType sType + const void* pNext + VkSampler sampler + + + VkStructureType sType + const void* pNext + VkAccelerationStructureKHR accelerationStructure + VkAccelerationStructureNV accelerationStructureNV + + + VkStructureType sType + const void* pNext + const void* opaqueCaptureDescriptorData + + + VkStructureType sType + void* pNext + VkBool32 shaderIntegerDotProduct + + + + VkStructureType sType + void* pNext + VkBool32 integerDotProduct8BitUnsignedAccelerated + VkBool32 integerDotProduct8BitSignedAccelerated + VkBool32 integerDotProduct8BitMixedSignednessAccelerated + VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated + VkBool32 integerDotProduct4x8BitPackedSignedAccelerated + VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated + VkBool32 integerDotProduct16BitUnsignedAccelerated + VkBool32 integerDotProduct16BitSignedAccelerated + VkBool32 integerDotProduct16BitMixedSignednessAccelerated + VkBool32 integerDotProduct32BitUnsignedAccelerated + VkBool32 integerDotProduct32BitSignedAccelerated + VkBool32 integerDotProduct32BitMixedSignednessAccelerated + VkBool32 integerDotProduct64BitUnsignedAccelerated + VkBool32 integerDotProduct64BitSignedAccelerated + VkBool32 integerDotProduct64BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated + VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated + VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated + + + + VkStructureType sType + void* pNext + VkBool32 hasPrimary + VkBool32 hasRender + int64_t primaryMajor + int64_t primaryMinor + int64_t renderMajor + int64_t renderMinor + + + VkStructureType sType + void* pNext + VkBool32 fragmentShaderBarycentric + + + VkStructureType sType + void* pNext + VkBool32 triStripVertexOrderIndependentOfProvokingVertex + + + VkStructureType sType + void* pNext + VkBool32 rayTracingMotionBlur + VkBool32 rayTracingMotionBlurPipelineTraceRaysIndirect + + + + VkStructureType sType + const void* pNext + VkDeviceOrHostAddressConstKHR vertexData + + + VkStructureType sType + const void* pNext + uint32_t maxInstances + VkAccelerationStructureMotionInfoFlagsNV flags + + + float sx + float a + float b + float pvx + float sy + float c + float pvy + float sz + float pvz + float qx + float qy + float qz + float qw + float tx + float ty + float tz + + + The bitfields in this structure are non-normative since bitfield ordering is implementation-defined in C. The specification defines the normative layout. + VkSRTDataNV transformT0 + VkSRTDataNV transformT1 + uint32_t instanceCustomIndex:24 + uint32_t mask:8 + uint32_t instanceShaderBindingTableRecordOffset:24 + VkGeometryInstanceFlagsKHR flags:8 + uint64_t accelerationStructureReference + + + The bitfields in this structure are non-normative since bitfield ordering is implementation-defined in C. The specification defines the normative layout. + VkTransformMatrixKHR transformT0 + VkTransformMatrixKHR transformT1 + uint32_t instanceCustomIndex:24 + uint32_t mask:8 + uint32_t instanceShaderBindingTableRecordOffset:24 + VkGeometryInstanceFlagsKHR flags:8 + uint64_t accelerationStructureReference + + + VkAccelerationStructureInstanceKHR staticInstance + VkAccelerationStructureMatrixMotionInstanceNV matrixMotionInstance + VkAccelerationStructureSRTMotionInstanceNV srtMotionInstance + + + VkAccelerationStructureMotionInstanceTypeNV type + VkAccelerationStructureMotionInstanceFlagsNV flags + VkAccelerationStructureMotionInstanceDataNV data + + typedef void* VkRemoteAddressNV; + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + VkExternalMemoryHandleTypeFlagBits handleType + + + VkStructureType sType + const void* pNext + VkBufferCollectionFUCHSIA collection + uint32_t index + + + VkStructureType sType + const void* pNext + VkBufferCollectionFUCHSIA collection + uint32_t index + + + VkStructureType sType + const void* pNext + VkBufferCollectionFUCHSIA collection + uint32_t index + + + VkStructureType sType + const void* pNext + zx_handle_t collectionToken + + + VkStructureType sType + void* pNext + uint32_t memoryTypeBits + uint32_t bufferCount + uint32_t createInfoIndex + uint64_t sysmemPixelFormat + VkFormatFeatureFlags formatFeatures + VkSysmemColorSpaceFUCHSIA sysmemColorSpaceIndex + VkComponentMapping samplerYcbcrConversionComponents + VkSamplerYcbcrModelConversion suggestedYcbcrModel + VkSamplerYcbcrRange suggestedYcbcrRange + VkChromaLocation suggestedXChromaOffset + VkChromaLocation suggestedYChromaOffset + + + VkStructureType sType + const void* pNext + VkBufferCreateInfo createInfo + VkFormatFeatureFlags requiredFormatFeatures + VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints + + + VkStructureType sType + const void* pNext + uint32_t colorSpace + + + VkStructureType sType + const void* pNext + VkImageCreateInfo imageCreateInfo + VkFormatFeatureFlags requiredFormatFeatures + VkImageFormatConstraintsFlagsFUCHSIA flags + uint64_t sysmemPixelFormat + uint32_t colorSpaceCount + const VkSysmemColorSpaceFUCHSIA* pColorSpaces + + + VkStructureType sType + const void* pNext + uint32_t formatConstraintsCount + const VkImageFormatConstraintsInfoFUCHSIA* pFormatConstraints + VkBufferCollectionConstraintsInfoFUCHSIA bufferCollectionConstraints + VkImageConstraintsInfoFlagsFUCHSIA flags + + + VkStructureType sType + const void* pNext + uint32_t minBufferCount + uint32_t maxBufferCount + uint32_t minBufferCountForCamping + uint32_t minBufferCountForDedicatedSlack + uint32_t minBufferCountForSharedSlack + + + VkStructureType sType + void* pNext + VkBool32 formatRgba10x6WithoutYCbCrSampler + + + VkStructureType sType + void* pNext + VkFormatFeatureFlags2 linearTilingFeatures + VkFormatFeatureFlags2 optimalTilingFeatures + VkFormatFeatureFlags2 bufferFeatures + + + + VkStructureType sType + void* pNext + uint32_t drmFormatModifierCount + VkDrmFormatModifierProperties2EXT* pDrmFormatModifierProperties + + + uint64_t drmFormatModifier + uint32_t drmFormatModifierPlaneCount + VkFormatFeatureFlags2 drmFormatModifierTilingFeatures + + + VkStructureType sType + void* pNext + VkFormat format + uint64_t externalFormat + VkFormatFeatureFlags2 formatFeatures + VkComponentMapping samplerYcbcrConversionComponents + VkSamplerYcbcrModelConversion suggestedYcbcrModel + VkSamplerYcbcrRange suggestedYcbcrRange + VkChromaLocation suggestedXChromaOffset + VkChromaLocation suggestedYChromaOffset + + + VkStructureType sType + const void* pNext + uint32_t viewMask + uint32_t colorAttachmentCount + const VkFormat* pColorAttachmentFormats + VkFormat depthAttachmentFormat + VkFormat stencilAttachmentFormat + + + + VkStructureType sType + const void* pNext + VkRenderingFlags flags + VkRect2D renderArea + uint32_t layerCount + uint32_t viewMask + uint32_t colorAttachmentCount + const VkRenderingAttachmentInfo* pColorAttachments + const VkRenderingAttachmentInfo* pDepthAttachment + const VkRenderingAttachmentInfo* pStencilAttachment + + + + VkStructureType sType + const void* pNext + VkImageView imageView + VkImageLayout imageLayout + VkResolveModeFlagBits resolveMode + VkImageView resolveImageView + VkImageLayout resolveImageLayout + VkAttachmentLoadOp loadOp + VkAttachmentStoreOp storeOp + VkClearValue clearValue + + + + VkStructureType sType + const void* pNext + VkImageView imageView + VkImageLayout imageLayout + VkExtent2D shadingRateAttachmentTexelSize + + + VkStructureType sType + const void* pNext + VkImageView imageView + VkImageLayout imageLayout + + + VkStructureType sType + void* pNext + VkBool32 dynamicRendering + + + + VkStructureType sType + const void* pNext + VkRenderingFlags flags + uint32_t viewMask + uint32_t colorAttachmentCount + uint32_t colorAttachmentCount + const VkFormat* pColorAttachmentFormats + VkFormat depthAttachmentFormat + VkFormat stencilAttachmentFormat + VkSampleCountFlagBits rasterizationSamples + + + + VkStructureType sType + const void* pNext + uint32_t colorAttachmentCount + const VkSampleCountFlagBits* pColorAttachmentSamples + VkSampleCountFlagBits depthStencilAttachmentSamples + + + + VkStructureType sType + const void* pNext + VkBool32 perViewAttributes + VkBool32 perViewAttributesPositionXOnly + + + VkStructureType sType + void* pNext + VkBool32 minLod + + + VkStructureType sType + const void* pNext + float minLod + + + VkStructureType sType + void* pNext + VkBool32 rasterizationOrderColorAttachmentAccess + VkBool32 rasterizationOrderDepthAttachmentAccess + VkBool32 rasterizationOrderStencilAttachmentAccess + + + + VkStructureType sType + void* pNext + VkBool32 linearColorAttachment + + + VkStructureType sType + void* pNext + VkBool32 graphicsPipelineLibrary + + + VkStructureType sType + void* pNext + VkBool32 graphicsPipelineLibraryFastLinking + VkBool32 graphicsPipelineLibraryIndependentInterpolationDecoration + + + VkStructureType sType + const void* pNext + VkGraphicsPipelineLibraryFlagsEXT flags + + + VkStructureType sType + void* pNext + VkBool32 descriptorSetHostMapping + + + VkStructureType sType + const void* pNext + VkDescriptorSetLayout descriptorSetLayout + uint32_t binding + + + VkStructureType sType + void* pNext + size_t descriptorOffset + uint32_t descriptorSize + + + VkStructureType sType + void* pNext + VkBool32 nestedCommandBuffer + VkBool32 nestedCommandBufferRendering + VkBool32 nestedCommandBufferSimultaneousUse + + + VkStructureType sType + void* pNext + uint32_t maxCommandBufferNestingLevel + + + VkStructureType sType + void* pNext + VkBool32 shaderModuleIdentifier + + + VkStructureType sType + void* pNext + uint8_t shaderModuleIdentifierAlgorithmUUID[VK_UUID_SIZE] + + + VkStructureType sType + const void* pNext + uint32_t identifierSize + const uint8_t* pIdentifier + + + VkStructureType sType + void* pNext + uint32_t identifierSize + uint8_t identifier[VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT] + + + VkStructureType sType + const void* pNext + VkImageCompressionFlagsEXT flags + uint32_t compressionControlPlaneCount + VkImageCompressionFixedRateFlagsEXT* pFixedRateFlags + + + VkStructureType sType + void* pNext + VkBool32 imageCompressionControl + + + VkStructureType sType + void* pNext + VkImageCompressionFlagsEXT imageCompressionFlags + VkImageCompressionFixedRateFlagsEXT imageCompressionFixedRateFlags + + + VkStructureType sType + void* pNext + VkBool32 imageCompressionControlSwapchain + + + VkStructureType sType + void* pNext + VkImageSubresource imageSubresource + + + + VkStructureType sType + void* pNext + VkSubresourceLayout subresourceLayout + + + + VkStructureType sType + const void* pNext + VkBool32 disallowMerging + + + uint32_t postMergeSubpassCount + + + VkStructureType sType + const void* pNext + VkRenderPassCreationFeedbackInfoEXT* pRenderPassFeedback + + + VkSubpassMergeStatusEXT subpassMergeStatus + char description[VK_MAX_DESCRIPTION_SIZE] + uint32_t postMergeIndex + + + VkStructureType sType + const void* pNext + VkRenderPassSubpassFeedbackInfoEXT* pSubpassFeedback + + + VkStructureType sType + void* pNext + VkBool32 subpassMergeFeedback + + + VkStructureType sType + const void* pNext + VkMicromapTypeEXT type + VkBuildMicromapFlagsEXT flags + VkBuildMicromapModeEXT mode + VkMicromapEXT dstMicromap + uint32_t usageCountsCount + const VkMicromapUsageEXT* pUsageCounts + const VkMicromapUsageEXT* const* ppUsageCounts + VkDeviceOrHostAddressConstKHR data + VkDeviceOrHostAddressKHR scratchData + VkDeviceOrHostAddressConstKHR triangleArray + VkDeviceSize triangleArrayStride + + + VkStructureType sType + const void* pNext + VkMicromapCreateFlagsEXT createFlags + VkBuffer buffer + VkDeviceSize offsetSpecified in bytes + VkDeviceSize size + VkMicromapTypeEXT type + VkDeviceAddress deviceAddress + + + VkStructureType sType + const void* pNext + const uint8_t* pVersionData + + + VkStructureType sType + const void* pNext + VkMicromapEXT src + VkMicromapEXT dst + VkCopyMicromapModeEXT mode + + + VkStructureType sType + const void* pNext + VkMicromapEXT src + VkDeviceOrHostAddressKHR dst + VkCopyMicromapModeEXT mode + + + VkStructureType sType + const void* pNext + VkDeviceOrHostAddressConstKHR src + VkMicromapEXT dst + VkCopyMicromapModeEXT mode + + + VkStructureType sType + const void* pNext + VkDeviceSize micromapSize + VkDeviceSize buildScratchSize + VkBool32 discardable + + + uint32_t count + uint32_t subdivisionLevel + uint32_t formatInterpretation depends on parent type + + + uint32_t dataOffsetSpecified in bytes + uint16_t subdivisionLevel + uint16_t format + + + VkStructureType sType + void* pNext + VkBool32 micromap + VkBool32 micromapCaptureReplay + VkBool32 micromapHostCommands + + + VkStructureType sType + void* pNext + uint32_t maxOpacity2StateSubdivisionLevel + uint32_t maxOpacity4StateSubdivisionLevel + + + VkStructureType sType + void* pNext + VkIndexType indexType + VkDeviceOrHostAddressConstKHR indexBuffer + VkDeviceSize indexStride + uint32_t baseTriangle + uint32_t usageCountsCount + const VkMicromapUsageEXT* pUsageCounts + const VkMicromapUsageEXT* const* ppUsageCounts + VkMicromapEXT micromap + + + VkStructureType sType + void* pNext + VkBool32 displacementMicromap + + + VkStructureType sType + void* pNext + uint32_t maxDisplacementMicromapSubdivisionLevel + + + VkStructureType sType + void* pNext + + VkFormat displacementBiasAndScaleFormat + VkFormat displacementVectorFormat + + VkDeviceOrHostAddressConstKHR displacementBiasAndScaleBuffer + VkDeviceSize displacementBiasAndScaleStride + VkDeviceOrHostAddressConstKHR displacementVectorBuffer + VkDeviceSize displacementVectorStride + VkDeviceOrHostAddressConstKHR displacedMicromapPrimitiveFlags + VkDeviceSize displacedMicromapPrimitiveFlagsStride + VkIndexType indexType + VkDeviceOrHostAddressConstKHR indexBuffer + VkDeviceSize indexStride + + uint32_t baseTriangle + + uint32_t usageCountsCount + const VkMicromapUsageEXT* pUsageCounts + const VkMicromapUsageEXT* const* ppUsageCounts + + VkMicromapEXT micromap + + + VkStructureType sType + void* pNext + uint8_t pipelineIdentifier[VK_UUID_SIZE] + + + VkStructureType sType + void* pNext + VkBool32 pipelinePropertiesIdentifier + + + VkStructureType sType + void* pNext + VkBool32 shaderEarlyAndLateFragmentTests + + + VkStructureType sType + const void* pNext + VkBool32 acquireUnmodifiedMemory + + + VkStructureType sType + const void* pNext + VkExportMetalObjectTypeFlagBitsEXT exportObjectType + + + VkStructureType sType + const void* pNext + + + VkStructureType sType + const void* pNext + MTLDevice_id mtlDevice + + + VkStructureType sType + const void* pNext + VkQueue queue + MTLCommandQueue_id mtlCommandQueue + + + VkStructureType sType + const void* pNext + VkDeviceMemory memory + MTLBuffer_id mtlBuffer + + + VkStructureType sType + const void* pNext + MTLBuffer_id mtlBuffer + + + VkStructureType sType + const void* pNext + VkImage image + VkImageView imageView + VkBufferView bufferView + VkImageAspectFlagBits plane + MTLTexture_id mtlTexture + + + VkStructureType sType + const void* pNext + VkImageAspectFlagBits plane + MTLTexture_id mtlTexture + + + VkStructureType sType + const void* pNext + VkImage image + IOSurfaceRef ioSurface + + + VkStructureType sType + const void* pNext + IOSurfaceRef ioSurface + + + VkStructureType sType + const void* pNext + VkSemaphore semaphore + VkEvent event + MTLSharedEvent_id mtlSharedEvent + + + VkStructureType sType + const void* pNext + MTLSharedEvent_id mtlSharedEvent + + + VkStructureType sType + void* pNext + VkBool32 nonSeamlessCubeMap + + + VkStructureType sType + void* pNext + VkBool32 pipelineRobustness + + + VkStructureType sType + const void* pNext + VkPipelineRobustnessBufferBehaviorEXT storageBuffers + VkPipelineRobustnessBufferBehaviorEXT uniformBuffers + VkPipelineRobustnessBufferBehaviorEXT vertexInputs + VkPipelineRobustnessImageBehaviorEXT images + + + VkStructureType sType + void* pNext + VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessStorageBuffers + VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessUniformBuffers + VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessVertexInputs + VkPipelineRobustnessImageBehaviorEXT defaultRobustnessImages + + + VkStructureType sType + const void* pNext + VkOffset2D filterCenter + VkExtent2D filterSize + uint32_t numPhases + + + VkStructureType sType + void* pNext + VkBool32 textureSampleWeighted + VkBool32 textureBoxFilter + VkBool32 textureBlockMatch + + + VkStructureType sType + void* pNext + uint32_t maxWeightFilterPhases + VkExtent2D maxWeightFilterDimension + VkExtent2D maxBlockMatchRegion + VkExtent2D maxBoxFilterBlockSize + + + VkStructureType sType + void* pNext + VkBool32 tileProperties + + + VkStructureType sType + void* pNext + VkExtent3D tileSize + VkExtent2D apronSize + VkOffset2D origin + + + VkStructureType sType + void* pNext + VkBool32 amigoProfiling + + + VkStructureType sType + const void* pNext + uint64_t firstDrawTimestamp + uint64_t swapBufferTimestamp + + + VkStructureType sType + void* pNext + VkBool32 attachmentFeedbackLoopLayout + + + VkStructureType sType + void* pNext + VkBool32 depthClampZeroOne + + + VkStructureType sType + void* pNext + VkBool32 reportAddressBinding + + + VkStructureType sType + void* pNext + VkDeviceAddressBindingFlagsEXT flags + VkDeviceAddress baseAddress + VkDeviceSize size + VkDeviceAddressBindingTypeEXT bindingType + + + VkStructureType sType + void* pNext + VkBool32 opticalFlow + + + VkStructureType sType + void* pNext + VkOpticalFlowGridSizeFlagsNV supportedOutputGridSizes + VkOpticalFlowGridSizeFlagsNV supportedHintGridSizes + VkBool32 hintSupported + VkBool32 costSupported + VkBool32 bidirectionalFlowSupported + VkBool32 globalFlowSupported + uint32_t minWidth + uint32_t minHeight + uint32_t maxWidth + uint32_t maxHeight + uint32_t maxNumRegionsOfInterest + + + VkStructureType sType + const void* pNext + VkOpticalFlowUsageFlagsNV usage + + + VkStructureType sType + const void* pNext + VkFormat format + + + VkStructureType sType + void* pNext + uint32_t width + uint32_t height + VkFormat imageFormat + VkFormat flowVectorFormat + VkFormat costFormat + VkOpticalFlowGridSizeFlagsNV outputGridSize + VkOpticalFlowGridSizeFlagsNV hintGridSize + VkOpticalFlowPerformanceLevelNV performanceLevel + VkOpticalFlowSessionCreateFlagsNV flags + + NV internal use only + VkStructureType sType + void* pNext + uint32_t id + uint32_t size + const void* pPrivateData + + + VkStructureType sType + void* pNext + VkOpticalFlowExecuteFlagsNV flags + uint32_t regionCount + const VkRect2D* pRegions + + + VkStructureType sType + void* pNext + VkBool32 deviceFault + VkBool32 deviceFaultVendorBinary + + + VkDeviceFaultAddressTypeEXT addressType + VkDeviceAddress reportedAddress + VkDeviceSize addressPrecision + + + char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault + uint64_t vendorFaultCode + uint64_t vendorFaultData + + + VkStructureType sType + void* pNext + uint32_t addressInfoCount + uint32_t vendorInfoCount + VkDeviceSize vendorBinarySizeSpecified in bytes + + + VkStructureType sType + void* pNext + char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault + VkDeviceFaultAddressInfoEXT* pAddressInfos + VkDeviceFaultVendorInfoEXT* pVendorInfos + void* pVendorBinaryData + + + The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout. + uint32_t headerSize + VkDeviceFaultVendorBinaryHeaderVersionEXT headerVersion + uint32_t vendorID + uint32_t deviceID + uint32_t driverVersion + uint8_t pipelineCacheUUID[VK_UUID_SIZE] + uint32_t applicationNameOffset + uint32_t applicationVersion + uint32_t engineNameOffset + uint32_t engineVersion + uint32_t apiVersion + + + VkStructureType sType + void* pNext + VkBool32 pipelineLibraryGroupHandles + + + VkStructureType sType + const void* pNext + float depthBiasConstantFactor + float depthBiasClamp + float depthBiasSlopeFactor + + + VkStructureType sType + const void* pNext + VkDepthBiasRepresentationEXT depthBiasRepresentation + VkBool32 depthBiasExact + + + VkDeviceAddress srcAddress + VkDeviceAddress dstAddress + VkDeviceSize compressedSizeSpecified in bytes + VkDeviceSize decompressedSizeSpecified in bytes + VkMemoryDecompressionMethodFlagsNV decompressionMethod + + + VkStructureType sType + void* pNext + uint64_t shaderCoreMask + uint32_t shaderCoreCount + uint32_t shaderWarpsPerCore + + + VkStructureType sType + void* pNext + VkBool32 shaderCoreBuiltins + + + VkStructureType sType + const void* pNext + VkFrameBoundaryFlagsEXT flags + uint64_t frameID + uint32_t imageCount + const VkImage* pImages + uint32_t bufferCount + const VkBuffer* pBuffers + uint64_t tagName + size_t tagSize + const void* pTag + + + VkStructureType sType + void* pNext + VkBool32 frameBoundary + + + VkStructureType sType + void* pNext + VkBool32 dynamicRenderingUnusedAttachments + + + VkStructureType sType + void* pNext + VkPresentModeKHR presentMode + + + VkStructureType sType + void* pNext + VkPresentScalingFlagsEXT supportedPresentScaling + VkPresentGravityFlagsEXT supportedPresentGravityX + VkPresentGravityFlagsEXT supportedPresentGravityY + VkExtent2D minScaledImageExtentSupported minimum image width and height for the surface when scaling is used + VkExtent2D maxScaledImageExtentSupported maximum image width and height for the surface when scaling is used + + + VkStructureType sType + void* pNext + uint32_t presentModeCount + VkPresentModeKHR* pPresentModesOutput list of present modes compatible with the one specified in VkSurfacePresentModeEXT + + + VkStructureType sType + void* pNext + VkBool32 swapchainMaintenance1 + + + VkStructureType sType + const void* pNext + uint32_t swapchainCountCopy of VkPresentInfoKHR::swapchainCount + const VkFence* pFencesFence to signal for each swapchain + + + VkStructureType sType + const void* pNext + uint32_t presentModeCountLength of the pPresentModes array + const VkPresentModeKHR* pPresentModesPresentation modes which will be usable with this swapchain + + + VkStructureType sType + const void* pNext + uint32_t swapchainCountCopy of VkPresentInfoKHR::swapchainCount + const VkPresentModeKHR* pPresentModesPresentation mode for each swapchain + + + VkStructureType sType + const void* pNext + VkPresentScalingFlagsEXT scalingBehavior + VkPresentGravityFlagsEXT presentGravityX + VkPresentGravityFlagsEXT presentGravityY + + + VkStructureType sType + const void* pNext + VkSwapchainKHR swapchainSwapchain for which images are being released + uint32_t imageIndexCountNumber of indices to release + const uint32_t* pImageIndicesIndices of which presentable images to release + + + VkStructureType sType + void* pNext + VkBool32 depthBiasControl + VkBool32 leastRepresentableValueForceUnormRepresentation + VkBool32 floatRepresentation + VkBool32 depthBiasExact + + + VkStructureType sType + void* pNext + VkBool32 rayTracingInvocationReorder + + + VkStructureType sType + void* pNext + VkRayTracingInvocationReorderModeNV rayTracingInvocationReorderReorderingHint + + + VkStructureType sType + void* pNext + VkBool32 extendedSparseAddressSpace + + + VkStructureType sType + void* pNext + VkDeviceSize extendedSparseAddressSpaceSizeTotal address space available for extended sparse allocations (bytes) + VkImageUsageFlags extendedSparseImageUsageFlagsBitfield of which image usages are supported for extended sparse allocations + VkBufferUsageFlags extendedSparseBufferUsageFlagsBitfield of which buffer usages are supported for extended sparse allocations + + + VkStructureType sType + void* pNext + VkDirectDriverLoadingFlagsLUNARG flags + PFN_vkGetInstanceProcAddrLUNARG pfnGetInstanceProcAddr + + + VkStructureType sType + void* pNext + VkDirectDriverLoadingModeLUNARG mode + uint32_t driverCount + const VkDirectDriverLoadingInfoLUNARG* pDrivers + + + VkStructureType sType + void* pNext + VkBool32 multiviewPerViewViewports + + + VkStructureType sType + void* pNext + VkBool32 rayTracingPositionFetch + + + VkStructureType sType + const void* pNext + const VkImageCreateInfo* pCreateInfo + const VkImageSubresource2KHR* pSubresource + + + VkStructureType sType + void* pNext + uint32_t pixelRate + uint32_t texelRate + uint32_t fmaRate + + + VkStructureType sType + void* pNext + VkBool32 multiviewPerViewRenderAreas + + + VkStructureType sType + const void* pNext + uint32_t perViewRenderAreaCount + const VkRect2D* pPerViewRenderAreas + + + VkStructureType sType + const void* pNext + void* pQueriedLowLatencyData + + + VkStructureType sType + const void* pNext + VkMemoryMapFlags flags + VkDeviceMemory memory + VkDeviceSize offset + VkDeviceSize size + + + VkStructureType sType + const void* pNext + VkMemoryUnmapFlagsKHR flags + VkDeviceMemory memory + + + VkStructureType sType + void* pNext + VkBool32 shaderObject + + + VkStructureType sType + void* pNext + uint8_t shaderBinaryUUID[VK_UUID_SIZE] + uint32_t shaderBinaryVersion + + + VkStructureType sType + const void* pNext + VkShaderCreateFlagsEXT flags + VkShaderStageFlagBits stage + VkShaderStageFlags nextStage + VkShaderCodeTypeEXT codeType + size_t codeSize + const void* pCode + const char* pName + uint32_t setLayoutCount + const VkDescriptorSetLayout* pSetLayouts + uint32_t pushConstantRangeCount + const VkPushConstantRange* pPushConstantRanges + const VkSpecializationInfo* pSpecializationInfo + + + VkStructureType sType + void* pNext + VkBool32 shaderTileImageColorReadAccess + VkBool32 shaderTileImageDepthReadAccess + VkBool32 shaderTileImageStencilReadAccess + + + VkStructureType sType + void* pNext + VkBool32 shaderTileImageCoherentReadAccelerated + VkBool32 shaderTileImageReadSampleFromPixelRateInvocation + VkBool32 shaderTileImageReadFromHelperInvocation + + + VkStructureType sType + const void* pNext + struct _screen_buffer* buffer + + + VkStructureType sType + void* pNext + VkDeviceSize allocationSize + uint32_t memoryTypeBits + + + VkStructureType sType + void* pNext + VkFormat format + uint64_t externalFormat + uint64_t screenUsage + VkFormatFeatureFlags formatFeatures + VkComponentMapping samplerYcbcrConversionComponents + VkSamplerYcbcrModelConversion suggestedYcbcrModel + VkSamplerYcbcrRange suggestedYcbcrRange + VkChromaLocation suggestedXChromaOffset + VkChromaLocation suggestedYChromaOffset + + + VkStructureType sType + void* pNext + uint64_t externalFormat + + + VkStructureType sType + void* pNext + VkBool32 screenBufferImport + + + VkStructureType sType + void* pNext + VkBool32 cooperativeMatrix + VkBool32 cooperativeMatrixRobustBufferAccess + + + VkStructureType sType + void* pNext + uint32_t MSize + uint32_t NSize + uint32_t KSize + VkComponentTypeKHR AType + VkComponentTypeKHR BType + VkComponentTypeKHR CType + VkComponentTypeKHR ResultType + VkBool32 saturatingAccumulation + VkScopeKHR scope + + + VkStructureType sType + void* pNext + VkShaderStageFlags cooperativeMatrixSupportedStages + + + VkStructureType sType + void* pNext + uint32_t maxExecutionGraphDepth + uint32_t maxExecutionGraphShaderOutputNodes + uint32_t maxExecutionGraphShaderPayloadSize + uint32_t maxExecutionGraphShaderPayloadCount + uint32_t executionGraphDispatchAddressAlignment + + + VkStructureType sType + void* pNext + VkBool32 shaderEnqueue + + + VkStructureType sType + const void* pNext + VkPipelineCreateFlags flags + uint32_t stageCount + const VkPipelineShaderStageCreateInfo* pStages + const VkPipelineLibraryCreateInfoKHR* pLibraryInfo + VkPipelineLayout layout + VkPipeline basePipelineHandle + int32_t basePipelineIndex + + + VkStructureType sType + const void* pNext + const char* pName + uint32_t index + + + VkStructureType sType + void* pNext + VkDeviceSize size + + + uint32_t nodeIndex + uint32_t payloadCount + VkDeviceOrHostAddressConstAMDX payloads + uint64_t payloadStride + + + uint32_t count + VkDeviceOrHostAddressConstAMDX infos + uint64_t stride + + + VkStructureType sType + void* pNext + VkBool32 cubicRangeClamp + + + VkStructureType sType + void* pNext + VkBool32 ycbcrDegamma + + + VkStructureType sType + void* pNext + VkBool32 enableYDegamma + VkBool32 enableCbCrDegamma + + + VkStructureType sType + void* pNext + VkBool32 selectableCubicWeights + + + VkStructureType sType + const void* pNext + VkCubicFilterWeightsQCOM cubicWeights + + + VkStructureType sType + const void* pNext + VkCubicFilterWeightsQCOM cubicWeights + + + VkStructureType sType + void* pNext + VkBool32 textureBlockMatch2 + + + VkStructureType sType + void* pNext + VkExtent2D maxBlockMatchWindow + + + VkStructureType sType + const void* pNext + VkExtent2D windowExtent + VkBlockMatchWindowCompareModeQCOM windowCompareMode + + + VkStructureType sType + void* pNext + VkBool32 descriptorPoolOverallocation + + + VkStructureType sType + void* pNext + VkLayeredDriverUnderlyingApiMSFT underlyingAPI + + + VkStructureType sType + void* pNext + VkBool32 externalFormatResolve + + + VkStructureType sType + void* pNext + VkBool32 nullColorAttachmentWithExternalFormatResolve + VkChromaLocation externalFormatResolveChromaOffsetX + VkChromaLocation externalFormatResolveChromaOffsetY + + + VkStructureType sType + void* pNext + VkFormat colorAttachmentFormat + + + VkStructureType sType + const void* pNext + VkBool32 lowLatencyMode + VkBool32 lowLatencyBoost + uint32_t minimumIntervalUs + + + VkStructureType sType + const void* pNext + VkSemaphore signalSemaphore + uint64_t value + + + VkStructureType sType + const void* pNext + uint64_t presentID + VkLatencyMarkerNV marker + + + VkStructureType sType + const void* pNext + VkLatencyTimingsFrameReportNV* pTimings + + + VkStructureType sType + const void* pNext + uint64_t presentID + uint64_t inputSampleTimeUs + uint64_t simStartTimeUs + uint64_t simEndTimeUs + uint64_t renderSubmitStartTimeUs + uint64_t renderSubmitEndTimeUs + uint64_t presentStartTimeUs + uint64_t presentEndTimeUs + uint64_t driverStartTimeUs + uint64_t driverEndTimeUs + uint64_t osRenderQueueStartTimeUs + uint64_t osRenderQueueEndTimeUs + uint64_t gpuRenderStartTimeUs + uint64_t gpuRenderEndTimeUs + + + VkStructureType sType + const void* pNext + VkOutOfBandQueueTypeNV queueType + + + VkStructureType sType + const void* pNext + uint64_t presentID + + + VkStructureType sType + const void* pNext + VkBool32 latencyModeEnable + + + VkStructureType sType + const void* pNext + uint32_t presentModeCount + VkPresentModeKHR* pPresentModes + + + + + Vulkan enumerant (token) definitions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unlike OpenGL, most tokens in Vulkan are actual typed enumerants in + their own numeric namespaces. The "name" attribute is the C enum + type name, and is pulled in from a type tag definition above + (slightly clunky, but retains the type / enum distinction). "type" + attributes of "enum" or "bitmask" indicate that these values should + be generated inside an appropriate definition. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + value="4" reserved for VK_KHR_sampler_mirror_clamp_to_edge + enum VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; do not + alias! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return codes (positive values) + + + + + + + Error codes (negative values) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Flags + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WSI Extensions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NVX_device_generated_commands formerly used these enum values, but that extension has been removed + value 31 / name VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT + value 32 / name VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Vendor IDs are now represented as enums instead of the old + <vendorids> tag, allowing them to be included in the + API headers. + + + + + + + + + + + Driver IDs are now represented as enums instead of the old + <driverids> tag, allowing them to be included in the + API headers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bitpos 17-31 are specified by extensions to the original VkAccessFlagBits enum + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bitpos 17-31 are specified by extensions to the original VkPipelineStageFlagBits enum + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VkResult vkCreateInstance + const VkInstanceCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkInstance* pInstance + + + void vkDestroyInstance + VkInstance instance + const VkAllocationCallbacks* pAllocator + + all sname:VkPhysicalDevice objects enumerated from pname:instance + + + + VkResult vkEnumeratePhysicalDevices + VkInstance instance + uint32_t* pPhysicalDeviceCount + VkPhysicalDevice* pPhysicalDevices + + + PFN_vkVoidFunction vkGetDeviceProcAddr + VkDevice device + const char* pName + + + PFN_vkVoidFunction vkGetInstanceProcAddr + VkInstance instance + const char* pName + + + void vkGetPhysicalDeviceProperties + VkPhysicalDevice physicalDevice + VkPhysicalDeviceProperties* pProperties + + + void vkGetPhysicalDeviceQueueFamilyProperties + VkPhysicalDevice physicalDevice + uint32_t* pQueueFamilyPropertyCount + VkQueueFamilyProperties* pQueueFamilyProperties + + + void vkGetPhysicalDeviceMemoryProperties + VkPhysicalDevice physicalDevice + VkPhysicalDeviceMemoryProperties* pMemoryProperties + + + void vkGetPhysicalDeviceFeatures + VkPhysicalDevice physicalDevice + VkPhysicalDeviceFeatures* pFeatures + + + void vkGetPhysicalDeviceFormatProperties + VkPhysicalDevice physicalDevice + VkFormat format + VkFormatProperties* pFormatProperties + + + VkResult vkGetPhysicalDeviceImageFormatProperties + VkPhysicalDevice physicalDevice + VkFormat format + VkImageType type + VkImageTiling tiling + VkImageUsageFlags usage + VkImageCreateFlags flags + VkImageFormatProperties* pImageFormatProperties + + + VkResult vkCreateDevice + VkPhysicalDevice physicalDevice + const VkDeviceCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDevice* pDevice + + + VkResult vkCreateDevice + VkPhysicalDevice physicalDevice + const VkDeviceCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDevice* pDevice + + + void vkDestroyDevice + VkDevice device + const VkAllocationCallbacks* pAllocator + + all sname:VkQueue objects created from pname:device + + + + VkResult vkEnumerateInstanceVersion + uint32_t* pApiVersion + + + VkResult vkEnumerateInstanceLayerProperties + uint32_t* pPropertyCount + VkLayerProperties* pProperties + + + VkResult vkEnumerateInstanceExtensionProperties + const char* pLayerName + uint32_t* pPropertyCount + VkExtensionProperties* pProperties + + + VkResult vkEnumerateDeviceLayerProperties + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkLayerProperties* pProperties + + + VkResult vkEnumerateDeviceLayerProperties + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkLayerProperties* pProperties + + + + VkResult vkEnumerateDeviceExtensionProperties + VkPhysicalDevice physicalDevice + const char* pLayerName + uint32_t* pPropertyCount + VkExtensionProperties* pProperties + + + void vkGetDeviceQueue + VkDevice device + uint32_t queueFamilyIndex + uint32_t queueIndex + VkQueue* pQueue + + + VkResult vkQueueSubmit + VkQueue queue + uint32_t submitCount + const VkSubmitInfo* pSubmits + VkFence fence + + + VkResult vkQueueWaitIdle + VkQueue queue + + + VkResult vkDeviceWaitIdle + VkDevice device + + all sname:VkQueue objects created from pname:device + + + + VkResult vkAllocateMemory + VkDevice device + const VkMemoryAllocateInfo* pAllocateInfo + const VkAllocationCallbacks* pAllocator + VkDeviceMemory* pMemory + + + void vkFreeMemory + VkDevice device + VkDeviceMemory memory + const VkAllocationCallbacks* pAllocator + + + VkResult vkMapMemory + VkDevice device + VkDeviceMemory memory + VkDeviceSize offset + VkDeviceSize size + VkMemoryMapFlags flags + void** ppData + + + void vkUnmapMemory + VkDevice device + VkDeviceMemory memory + + + VkResult vkFlushMappedMemoryRanges + VkDevice device + uint32_t memoryRangeCount + const VkMappedMemoryRange* pMemoryRanges + + + VkResult vkInvalidateMappedMemoryRanges + VkDevice device + uint32_t memoryRangeCount + const VkMappedMemoryRange* pMemoryRanges + + + void vkGetDeviceMemoryCommitment + VkDevice device + VkDeviceMemory memory + VkDeviceSize* pCommittedMemoryInBytes + + + void vkGetBufferMemoryRequirements + VkDevice device + VkBuffer buffer + VkMemoryRequirements* pMemoryRequirements + + + VkResult vkBindBufferMemory + VkDevice device + VkBuffer buffer + VkDeviceMemory memory + VkDeviceSize memoryOffset + + + void vkGetImageMemoryRequirements + VkDevice device + VkImage image + VkMemoryRequirements* pMemoryRequirements + + + VkResult vkBindImageMemory + VkDevice device + VkImage image + VkDeviceMemory memory + VkDeviceSize memoryOffset + + + void vkGetImageSparseMemoryRequirements + VkDevice device + VkImage image + uint32_t* pSparseMemoryRequirementCount + VkSparseImageMemoryRequirements* pSparseMemoryRequirements + + + void vkGetPhysicalDeviceSparseImageFormatProperties + VkPhysicalDevice physicalDevice + VkFormat format + VkImageType type + VkSampleCountFlagBits samples + VkImageUsageFlags usage + VkImageTiling tiling + uint32_t* pPropertyCount + VkSparseImageFormatProperties* pProperties + + + VkResult vkQueueBindSparse + VkQueue queue + uint32_t bindInfoCount + const VkBindSparseInfo* pBindInfo + VkFence fence + + + VkResult vkCreateFence + VkDevice device + const VkFenceCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkFence* pFence + + + void vkDestroyFence + VkDevice device + VkFence fence + const VkAllocationCallbacks* pAllocator + + + VkResult vkResetFences + VkDevice device + uint32_t fenceCount + const VkFence* pFences + + + VkResult vkGetFenceStatus + VkDevice device + VkFence fence + + + VkResult vkWaitForFences + VkDevice device + uint32_t fenceCount + const VkFence* pFences + VkBool32 waitAll + uint64_t timeout + + + VkResult vkCreateSemaphore + VkDevice device + const VkSemaphoreCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSemaphore* pSemaphore + + + void vkDestroySemaphore + VkDevice device + VkSemaphore semaphore + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateEvent + VkDevice device + const VkEventCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkEvent* pEvent + + + void vkDestroyEvent + VkDevice device + VkEvent event + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetEventStatus + VkDevice device + VkEvent event + + + VkResult vkSetEvent + VkDevice device + VkEvent event + + + VkResult vkResetEvent + VkDevice device + VkEvent event + + + VkResult vkCreateQueryPool + VkDevice device + const VkQueryPoolCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkQueryPool* pQueryPool + + + void vkDestroyQueryPool + VkDevice device + VkQueryPool queryPool + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetQueryPoolResults + VkDevice device + VkQueryPool queryPool + uint32_t firstQuery + uint32_t queryCount + size_t dataSize + void* pData + VkDeviceSize stride + VkQueryResultFlags flags + + + void vkResetQueryPool + VkDevice device + VkQueryPool queryPool + uint32_t firstQuery + uint32_t queryCount + + + + VkResult vkCreateBuffer + VkDevice device + const VkBufferCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkBuffer* pBuffer + + + void vkDestroyBuffer + VkDevice device + VkBuffer buffer + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateBufferView + VkDevice device + const VkBufferViewCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkBufferView* pView + + + void vkDestroyBufferView + VkDevice device + VkBufferView bufferView + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateImage + VkDevice device + const VkImageCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkImage* pImage + + + void vkDestroyImage + VkDevice device + VkImage image + const VkAllocationCallbacks* pAllocator + + + void vkGetImageSubresourceLayout + VkDevice device + VkImage image + const VkImageSubresource* pSubresource + VkSubresourceLayout* pLayout + + + VkResult vkCreateImageView + VkDevice device + const VkImageViewCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkImageView* pView + + + void vkDestroyImageView + VkDevice device + VkImageView imageView + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateShaderModule + VkDevice device + const VkShaderModuleCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkShaderModule* pShaderModule + + + void vkDestroyShaderModule + VkDevice device + VkShaderModule shaderModule + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreatePipelineCache + VkDevice device + const VkPipelineCacheCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkPipelineCache* pPipelineCache + + + VkResult vkCreatePipelineCache + VkDevice device + const VkPipelineCacheCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkPipelineCache* pPipelineCache + + + void vkDestroyPipelineCache + VkDevice device + VkPipelineCache pipelineCache + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetPipelineCacheData + VkDevice device + VkPipelineCache pipelineCache + size_t* pDataSize + void* pData + + + VkResult vkMergePipelineCaches + VkDevice device + VkPipelineCache dstCache + uint32_t srcCacheCount + const VkPipelineCache* pSrcCaches + + + VkResult vkCreateGraphicsPipelines + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkGraphicsPipelineCreateInfo* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkCreateGraphicsPipelines + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkGraphicsPipelineCreateInfo* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkCreateComputePipelines + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkComputePipelineCreateInfo* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkCreateComputePipelines + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkComputePipelineCreateInfo* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI + VkDevice device + VkRenderPass renderpass + VkExtent2D* pMaxWorkgroupSize + + + void vkDestroyPipeline + VkDevice device + VkPipeline pipeline + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreatePipelineLayout + VkDevice device + const VkPipelineLayoutCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkPipelineLayout* pPipelineLayout + + + void vkDestroyPipelineLayout + VkDevice device + VkPipelineLayout pipelineLayout + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateSampler + VkDevice device + const VkSamplerCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSampler* pSampler + + + void vkDestroySampler + VkDevice device + VkSampler sampler + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateDescriptorSetLayout + VkDevice device + const VkDescriptorSetLayoutCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDescriptorSetLayout* pSetLayout + + + void vkDestroyDescriptorSetLayout + VkDevice device + VkDescriptorSetLayout descriptorSetLayout + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateDescriptorPool + VkDevice device + const VkDescriptorPoolCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDescriptorPool* pDescriptorPool + + + void vkDestroyDescriptorPool + VkDevice device + VkDescriptorPool descriptorPool + const VkAllocationCallbacks* pAllocator + + + VkResult vkResetDescriptorPool + VkDevice device + VkDescriptorPool descriptorPool + VkDescriptorPoolResetFlags flags + + any sname:VkDescriptorSet objects allocated from pname:descriptorPool + + + + VkResult vkAllocateDescriptorSets + VkDevice device + const VkDescriptorSetAllocateInfo* pAllocateInfo + VkDescriptorSet* pDescriptorSets + + + VkResult vkFreeDescriptorSets + VkDevice device + VkDescriptorPool descriptorPool + uint32_t descriptorSetCount + const VkDescriptorSet* pDescriptorSets + + + void vkUpdateDescriptorSets + VkDevice device + uint32_t descriptorWriteCount + const VkWriteDescriptorSet* pDescriptorWrites + uint32_t descriptorCopyCount + const VkCopyDescriptorSet* pDescriptorCopies + + + VkResult vkCreateFramebuffer + VkDevice device + const VkFramebufferCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkFramebuffer* pFramebuffer + + + void vkDestroyFramebuffer + VkDevice device + VkFramebuffer framebuffer + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateRenderPass + VkDevice device + const VkRenderPassCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkRenderPass* pRenderPass + + + void vkDestroyRenderPass + VkDevice device + VkRenderPass renderPass + const VkAllocationCallbacks* pAllocator + + + void vkGetRenderAreaGranularity + VkDevice device + VkRenderPass renderPass + VkExtent2D* pGranularity + + + void vkGetRenderingAreaGranularityKHR + VkDevice device + const VkRenderingAreaInfoKHR* pRenderingAreaInfo + VkExtent2D* pGranularity + + + VkResult vkCreateCommandPool + VkDevice device + const VkCommandPoolCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkCommandPool* pCommandPool + + + void vkDestroyCommandPool + VkDevice device + VkCommandPool commandPool + const VkAllocationCallbacks* pAllocator + + + VkResult vkResetCommandPool + VkDevice device + VkCommandPool commandPool + VkCommandPoolResetFlags flags + + + VkResult vkAllocateCommandBuffers + VkDevice device + const VkCommandBufferAllocateInfo* pAllocateInfo + VkCommandBuffer* pCommandBuffers + + + void vkFreeCommandBuffers + VkDevice device + VkCommandPool commandPool + uint32_t commandBufferCount + const VkCommandBuffer* pCommandBuffers + + + VkResult vkBeginCommandBuffer + VkCommandBuffer commandBuffer + const VkCommandBufferBeginInfo* pBeginInfo + + the sname:VkCommandPool that pname:commandBuffer was allocated from + + + + VkResult vkEndCommandBuffer + VkCommandBuffer commandBuffer + + the sname:VkCommandPool that pname:commandBuffer was allocated from + + + + VkResult vkResetCommandBuffer + VkCommandBuffer commandBuffer + VkCommandBufferResetFlags flags + + the sname:VkCommandPool that pname:commandBuffer was allocated from + + + + void vkCmdBindPipeline + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipeline pipeline + + + void vkCmdSetAttachmentFeedbackLoopEnableEXT + VkCommandBuffer commandBuffer + VkImageAspectFlags aspectMask + + + void vkCmdSetViewport + VkCommandBuffer commandBuffer + uint32_t firstViewport + uint32_t viewportCount + const VkViewport* pViewports + + + void vkCmdSetScissor + VkCommandBuffer commandBuffer + uint32_t firstScissor + uint32_t scissorCount + const VkRect2D* pScissors + + + void vkCmdSetLineWidth + VkCommandBuffer commandBuffer + float lineWidth + + + void vkCmdSetDepthBias + VkCommandBuffer commandBuffer + float depthBiasConstantFactor + float depthBiasClamp + float depthBiasSlopeFactor + + + void vkCmdSetBlendConstants + VkCommandBuffer commandBuffer + const float blendConstants[4] + + + void vkCmdSetDepthBounds + VkCommandBuffer commandBuffer + float minDepthBounds + float maxDepthBounds + + + void vkCmdSetStencilCompareMask + VkCommandBuffer commandBuffer + VkStencilFaceFlags faceMask + uint32_t compareMask + + + void vkCmdSetStencilWriteMask + VkCommandBuffer commandBuffer + VkStencilFaceFlags faceMask + uint32_t writeMask + + + void vkCmdSetStencilReference + VkCommandBuffer commandBuffer + VkStencilFaceFlags faceMask + uint32_t reference + + + void vkCmdBindDescriptorSets + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipelineLayout layout + uint32_t firstSet + uint32_t descriptorSetCount + const VkDescriptorSet* pDescriptorSets + uint32_t dynamicOffsetCount + const uint32_t* pDynamicOffsets + + + void vkCmdBindIndexBuffer + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + VkIndexType indexType + + + void vkCmdBindVertexBuffers + VkCommandBuffer commandBuffer + uint32_t firstBinding + uint32_t bindingCount + const VkBuffer* pBuffers + const VkDeviceSize* pOffsets + + + void vkCmdDraw + VkCommandBuffer commandBuffer + uint32_t vertexCount + uint32_t instanceCount + uint32_t firstVertex + uint32_t firstInstance + + + void vkCmdDrawIndexed + VkCommandBuffer commandBuffer + uint32_t indexCount + uint32_t instanceCount + uint32_t firstIndex + int32_t vertexOffset + uint32_t firstInstance + + + void vkCmdDrawMultiEXT + VkCommandBuffer commandBuffer + uint32_t drawCount + const VkMultiDrawInfoEXT* pVertexInfo + uint32_t instanceCount + uint32_t firstInstance + uint32_t stride + + + void vkCmdDrawMultiIndexedEXT + VkCommandBuffer commandBuffer + uint32_t drawCount + const VkMultiDrawIndexedInfoEXT* pIndexInfo + uint32_t instanceCount + uint32_t firstInstance + uint32_t stride + const int32_t* pVertexOffset + + + void vkCmdDrawIndirect + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + uint32_t drawCount + uint32_t stride + + + void vkCmdDrawIndexedIndirect + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + uint32_t drawCount + uint32_t stride + + + void vkCmdDispatch + VkCommandBuffer commandBuffer + uint32_t groupCountX + uint32_t groupCountY + uint32_t groupCountZ + + + void vkCmdDispatchIndirect + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + + + void vkCmdSubpassShadingHUAWEI + VkCommandBuffer commandBuffer + + + void vkCmdDrawClusterHUAWEI + VkCommandBuffer commandBuffer + uint32_t groupCountX + uint32_t groupCountY + uint32_t groupCountZ + + + void vkCmdDrawClusterIndirectHUAWEI + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + + + void vkCmdUpdatePipelineIndirectBufferNV + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipeline pipeline + + + void vkCmdCopyBuffer + VkCommandBuffer commandBuffer + VkBuffer srcBuffer + VkBuffer dstBuffer + uint32_t regionCount + const VkBufferCopy* pRegions + + + void vkCmdCopyImage + VkCommandBuffer commandBuffer + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageCopy* pRegions + + + void vkCmdBlitImage + VkCommandBuffer commandBuffer + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageBlit* pRegions + VkFilter filter + + + void vkCmdCopyBufferToImage + VkCommandBuffer commandBuffer + VkBuffer srcBuffer + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkBufferImageCopy* pRegions + + + void vkCmdCopyImageToBuffer + VkCommandBuffer commandBuffer + VkImage srcImage + VkImageLayout srcImageLayout + VkBuffer dstBuffer + uint32_t regionCount + const VkBufferImageCopy* pRegions + + + void vkCmdCopyMemoryIndirectNV + VkCommandBuffer commandBuffer + VkDeviceAddress copyBufferAddress + uint32_t copyCount + uint32_t stride + + + void vkCmdCopyMemoryToImageIndirectNV + VkCommandBuffer commandBuffer + VkDeviceAddress copyBufferAddress + uint32_t copyCount + uint32_t stride + VkImage dstImage + VkImageLayout dstImageLayout + const VkImageSubresourceLayers* pImageSubresources + + + void vkCmdUpdateBuffer + VkCommandBuffer commandBuffer + VkBuffer dstBuffer + VkDeviceSize dstOffset + VkDeviceSize dataSize + const void* pData + + + void vkCmdFillBuffer + VkCommandBuffer commandBuffer + VkBuffer dstBuffer + VkDeviceSize dstOffset + VkDeviceSize size + uint32_t data + + + void vkCmdClearColorImage + VkCommandBuffer commandBuffer + VkImage image + VkImageLayout imageLayout + const VkClearColorValue* pColor + uint32_t rangeCount + const VkImageSubresourceRange* pRanges + + + void vkCmdClearDepthStencilImage + VkCommandBuffer commandBuffer + VkImage image + VkImageLayout imageLayout + const VkClearDepthStencilValue* pDepthStencil + uint32_t rangeCount + const VkImageSubresourceRange* pRanges + + + void vkCmdClearAttachments + VkCommandBuffer commandBuffer + uint32_t attachmentCount + const VkClearAttachment* pAttachments + uint32_t rectCount + const VkClearRect* pRects + + + void vkCmdResolveImage + VkCommandBuffer commandBuffer + VkImage srcImage + VkImageLayout srcImageLayout + VkImage dstImage + VkImageLayout dstImageLayout + uint32_t regionCount + const VkImageResolve* pRegions + + + void vkCmdSetEvent + VkCommandBuffer commandBuffer + VkEvent event + VkPipelineStageFlags stageMask + + + void vkCmdResetEvent + VkCommandBuffer commandBuffer + VkEvent event + VkPipelineStageFlags stageMask + + + void vkCmdWaitEvents + VkCommandBuffer commandBuffer + uint32_t eventCount + const VkEvent* pEvents + VkPipelineStageFlags srcStageMask + VkPipelineStageFlags dstStageMask + uint32_t memoryBarrierCount + const VkMemoryBarrier* pMemoryBarriers + uint32_t bufferMemoryBarrierCount + const VkBufferMemoryBarrier* pBufferMemoryBarriers + uint32_t imageMemoryBarrierCount + const VkImageMemoryBarrier* pImageMemoryBarriers + + + void vkCmdPipelineBarrier + VkCommandBuffer commandBuffer + VkPipelineStageFlags srcStageMask + VkPipelineStageFlags dstStageMask + VkDependencyFlags dependencyFlags + uint32_t memoryBarrierCount + const VkMemoryBarrier* pMemoryBarriers + uint32_t bufferMemoryBarrierCount + const VkBufferMemoryBarrier* pBufferMemoryBarriers + uint32_t imageMemoryBarrierCount + const VkImageMemoryBarrier* pImageMemoryBarriers + + + void vkCmdBeginQuery + VkCommandBuffer commandBuffer + VkQueryPool queryPool + uint32_t query + VkQueryControlFlags flags + + + void vkCmdEndQuery + VkCommandBuffer commandBuffer + VkQueryPool queryPool + uint32_t query + + + void vkCmdBeginConditionalRenderingEXT + VkCommandBuffer commandBuffer + const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin + + + void vkCmdEndConditionalRenderingEXT + VkCommandBuffer commandBuffer + + + void vkCmdResetQueryPool + VkCommandBuffer commandBuffer + VkQueryPool queryPool + uint32_t firstQuery + uint32_t queryCount + + + void vkCmdWriteTimestamp + VkCommandBuffer commandBuffer + VkPipelineStageFlagBits pipelineStage + VkQueryPool queryPool + uint32_t query + + + void vkCmdCopyQueryPoolResults + VkCommandBuffer commandBuffer + VkQueryPool queryPool + uint32_t firstQuery + uint32_t queryCount + VkBuffer dstBuffer + VkDeviceSize dstOffset + VkDeviceSize stride + VkQueryResultFlags flags + + + void vkCmdPushConstants + VkCommandBuffer commandBuffer + VkPipelineLayout layout + VkShaderStageFlags stageFlags + uint32_t offset + uint32_t size + const void* pValues + + + void vkCmdBeginRenderPass + VkCommandBuffer commandBuffer + const VkRenderPassBeginInfo* pRenderPassBegin + VkSubpassContents contents + + + void vkCmdNextSubpass + VkCommandBuffer commandBuffer + VkSubpassContents contents + + + void vkCmdEndRenderPass + VkCommandBuffer commandBuffer + + + void vkCmdExecuteCommands + VkCommandBuffer commandBuffer + uint32_t commandBufferCount + const VkCommandBuffer* pCommandBuffers + + + VkResult vkCreateAndroidSurfaceKHR + VkInstance instance + const VkAndroidSurfaceCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkGetPhysicalDeviceDisplayPropertiesKHR + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkDisplayPropertiesKHR* pProperties + + + VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkDisplayPlanePropertiesKHR* pProperties + + + VkResult vkGetDisplayPlaneSupportedDisplaysKHR + VkPhysicalDevice physicalDevice + uint32_t planeIndex + uint32_t* pDisplayCount + VkDisplayKHR* pDisplays + + + VkResult vkGetDisplayModePropertiesKHR + VkPhysicalDevice physicalDevice + VkDisplayKHR display + uint32_t* pPropertyCount + VkDisplayModePropertiesKHR* pProperties + + + VkResult vkCreateDisplayModeKHR + VkPhysicalDevice physicalDevice + VkDisplayKHR display + const VkDisplayModeCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDisplayModeKHR* pMode + + + VkResult vkGetDisplayPlaneCapabilitiesKHR + VkPhysicalDevice physicalDevice + VkDisplayModeKHR mode + uint32_t planeIndex + VkDisplayPlaneCapabilitiesKHR* pCapabilities + + + VkResult vkCreateDisplayPlaneSurfaceKHR + VkInstance instance + const VkDisplaySurfaceCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkCreateSharedSwapchainsKHR + VkDevice device + uint32_t swapchainCount + const VkSwapchainCreateInfoKHR* pCreateInfos + const VkSwapchainCreateInfoKHR* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkSwapchainKHR* pSwapchains + + + void vkDestroySurfaceKHR + VkInstance instance + VkSurfaceKHR surface + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetPhysicalDeviceSurfaceSupportKHR + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + VkSurfaceKHR surface + VkBool32* pSupported + + + VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR + VkPhysicalDevice physicalDevice + VkSurfaceKHR surface + VkSurfaceCapabilitiesKHR* pSurfaceCapabilities + + + VkResult vkGetPhysicalDeviceSurfaceFormatsKHR + VkPhysicalDevice physicalDevice + VkSurfaceKHR surface + uint32_t* pSurfaceFormatCount + VkSurfaceFormatKHR* pSurfaceFormats + + + VkResult vkGetPhysicalDeviceSurfacePresentModesKHR + VkPhysicalDevice physicalDevice + VkSurfaceKHR surface + uint32_t* pPresentModeCount + VkPresentModeKHR* pPresentModes + + + VkResult vkCreateSwapchainKHR + VkDevice device + const VkSwapchainCreateInfoKHR* pCreateInfo + const VkSwapchainCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSwapchainKHR* pSwapchain + + + void vkDestroySwapchainKHR + VkDevice device + VkSwapchainKHR swapchain + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetSwapchainImagesKHR + VkDevice device + VkSwapchainKHR swapchain + uint32_t* pSwapchainImageCount + VkImage* pSwapchainImages + + + VkResult vkAcquireNextImageKHR + VkDevice device + VkSwapchainKHR swapchain + uint64_t timeout + VkSemaphore semaphore + VkFence fence + uint32_t* pImageIndex + + + VkResult vkQueuePresentKHR + VkQueue queue + const VkPresentInfoKHR* pPresentInfo + + + VkResult vkCreateViSurfaceNN + VkInstance instance + const VkViSurfaceCreateInfoNN* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkCreateWaylandSurfaceKHR + VkInstance instance + const VkWaylandSurfaceCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + struct wl_display* display + + + VkResult vkCreateWin32SurfaceKHR + VkInstance instance + const VkWin32SurfaceCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkBool32 vkGetPhysicalDeviceWin32PresentationSupportKHR + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + + + VkResult vkCreateXlibSurfaceKHR + VkInstance instance + const VkXlibSurfaceCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + Display* dpy + VisualID visualID + + + VkResult vkCreateXcbSurfaceKHR + VkInstance instance + const VkXcbSurfaceCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + xcb_connection_t* connection + xcb_visualid_t visual_id + + + VkResult vkCreateDirectFBSurfaceEXT + VkInstance instance + const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkBool32 vkGetPhysicalDeviceDirectFBPresentationSupportEXT + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + IDirectFB* dfb + + + VkResult vkCreateImagePipeSurfaceFUCHSIA + VkInstance instance + const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkCreateStreamDescriptorSurfaceGGP + VkInstance instance + const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkCreateScreenSurfaceQNX + VkInstance instance + const VkScreenSurfaceCreateInfoQNX* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkBool32 vkGetPhysicalDeviceScreenPresentationSupportQNX + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + struct _screen_window* window + + + VkResult vkCreateDebugReportCallbackEXT + VkInstance instance + const VkDebugReportCallbackCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDebugReportCallbackEXT* pCallback + + + void vkDestroyDebugReportCallbackEXT + VkInstance instance + VkDebugReportCallbackEXT callback + const VkAllocationCallbacks* pAllocator + + + void vkDebugReportMessageEXT + VkInstance instance + VkDebugReportFlagsEXT flags + VkDebugReportObjectTypeEXT objectType + uint64_t object + size_t location + int32_t messageCode + const char* pLayerPrefix + const char* pMessage + + + VkResult vkDebugMarkerSetObjectNameEXT + VkDevice device + const VkDebugMarkerObjectNameInfoEXT* pNameInfo + + + VkResult vkDebugMarkerSetObjectTagEXT + VkDevice device + const VkDebugMarkerObjectTagInfoEXT* pTagInfo + + + void vkCmdDebugMarkerBeginEXT + VkCommandBuffer commandBuffer + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo + + + void vkCmdDebugMarkerEndEXT + VkCommandBuffer commandBuffer + + + void vkCmdDebugMarkerInsertEXT + VkCommandBuffer commandBuffer + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo + + + VkResult vkGetPhysicalDeviceExternalImageFormatPropertiesNV + VkPhysicalDevice physicalDevice + VkFormat format + VkImageType type + VkImageTiling tiling + VkImageUsageFlags usage + VkImageCreateFlags flags + VkExternalMemoryHandleTypeFlagsNV externalHandleType + VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties + + + VkResult vkGetMemoryWin32HandleNV + VkDevice device + VkDeviceMemory memory + VkExternalMemoryHandleTypeFlagsNV handleType + HANDLE* pHandle + + + void vkCmdExecuteGeneratedCommandsNV + VkCommandBuffer commandBuffer + VkBool32 isPreprocessed + const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo + + + void vkCmdPreprocessGeneratedCommandsNV + VkCommandBuffer commandBuffer + const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo + + + void vkCmdBindPipelineShaderGroupNV + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipeline pipeline + uint32_t groupIndex + + + void vkGetGeneratedCommandsMemoryRequirementsNV + VkDevice device + const VkGeneratedCommandsMemoryRequirementsInfoNV* pInfo + VkMemoryRequirements2* pMemoryRequirements + + + VkResult vkCreateIndirectCommandsLayoutNV + VkDevice device + const VkIndirectCommandsLayoutCreateInfoNV* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkIndirectCommandsLayoutNV* pIndirectCommandsLayout + + + void vkDestroyIndirectCommandsLayoutNV + VkDevice device + VkIndirectCommandsLayoutNV indirectCommandsLayout + const VkAllocationCallbacks* pAllocator + + + void vkGetPhysicalDeviceFeatures2 + VkPhysicalDevice physicalDevice + VkPhysicalDeviceFeatures2* pFeatures + + + + void vkGetPhysicalDeviceProperties2 + VkPhysicalDevice physicalDevice + VkPhysicalDeviceProperties2* pProperties + + + + void vkGetPhysicalDeviceFormatProperties2 + VkPhysicalDevice physicalDevice + VkFormat format + VkFormatProperties2* pFormatProperties + + + + VkResult vkGetPhysicalDeviceImageFormatProperties2 + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo + VkImageFormatProperties2* pImageFormatProperties + + + + void vkGetPhysicalDeviceQueueFamilyProperties2 + VkPhysicalDevice physicalDevice + uint32_t* pQueueFamilyPropertyCount + VkQueueFamilyProperties2* pQueueFamilyProperties + + + + void vkGetPhysicalDeviceMemoryProperties2 + VkPhysicalDevice physicalDevice + VkPhysicalDeviceMemoryProperties2* pMemoryProperties + + + + void vkGetPhysicalDeviceSparseImageFormatProperties2 + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo + uint32_t* pPropertyCount + VkSparseImageFormatProperties2* pProperties + + + + void vkCmdPushDescriptorSetKHR + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipelineLayout layout + uint32_t set + uint32_t descriptorWriteCount + const VkWriteDescriptorSet* pDescriptorWrites + + + void vkTrimCommandPool + VkDevice device + VkCommandPool commandPool + VkCommandPoolTrimFlags flags + + + + void vkGetPhysicalDeviceExternalBufferProperties + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo + VkExternalBufferProperties* pExternalBufferProperties + + + + VkResult vkGetMemoryWin32HandleKHR + VkDevice device + const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo + HANDLE* pHandle + + + VkResult vkGetMemoryWin32HandlePropertiesKHR + VkDevice device + VkExternalMemoryHandleTypeFlagBits handleType + HANDLE handle + VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties + + + VkResult vkGetMemoryFdKHR + VkDevice device + const VkMemoryGetFdInfoKHR* pGetFdInfo + int* pFd + + + VkResult vkGetMemoryFdPropertiesKHR + VkDevice device + VkExternalMemoryHandleTypeFlagBits handleType + int fd + VkMemoryFdPropertiesKHR* pMemoryFdProperties + + + VkResult vkGetMemoryZirconHandleFUCHSIA + VkDevice device + const VkMemoryGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo + zx_handle_t* pZirconHandle + + + VkResult vkGetMemoryZirconHandlePropertiesFUCHSIA + VkDevice device + VkExternalMemoryHandleTypeFlagBits handleType + zx_handle_t zirconHandle + VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties + + + VkResult vkGetMemoryRemoteAddressNV + VkDevice device + const VkMemoryGetRemoteAddressInfoNV* pMemoryGetRemoteAddressInfo + VkRemoteAddressNV* pAddress + + + VkResult vkGetMemorySciBufNV + VkDevice device + const VkMemoryGetSciBufInfoNV* pGetSciBufInfo + NvSciBufObj* pHandle + + + VkResult vkGetPhysicalDeviceExternalMemorySciBufPropertiesNV + VkPhysicalDevice physicalDevice + VkExternalMemoryHandleTypeFlagBits handleType + NvSciBufObj handle + VkMemorySciBufPropertiesNV* pMemorySciBufProperties + + + VkResult vkGetPhysicalDeviceSciBufAttributesNV + VkPhysicalDevice physicalDevice + NvSciBufAttrList pAttributes + + + void vkGetPhysicalDeviceExternalSemaphoreProperties + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo + VkExternalSemaphoreProperties* pExternalSemaphoreProperties + + + + VkResult vkGetSemaphoreWin32HandleKHR + VkDevice device + const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo + HANDLE* pHandle + + + VkResult vkImportSemaphoreWin32HandleKHR + VkDevice device + const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo + + + VkResult vkGetSemaphoreFdKHR + VkDevice device + const VkSemaphoreGetFdInfoKHR* pGetFdInfo + int* pFd + + + VkResult vkImportSemaphoreFdKHR + VkDevice device + const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo + + + VkResult vkGetSemaphoreZirconHandleFUCHSIA + VkDevice device + const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo + zx_handle_t* pZirconHandle + + + VkResult vkImportSemaphoreZirconHandleFUCHSIA + VkDevice device + const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo + + + void vkGetPhysicalDeviceExternalFenceProperties + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo + VkExternalFenceProperties* pExternalFenceProperties + + + + VkResult vkGetFenceWin32HandleKHR + VkDevice device + const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo + HANDLE* pHandle + + + VkResult vkImportFenceWin32HandleKHR + VkDevice device + const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo + + + VkResult vkGetFenceFdKHR + VkDevice device + const VkFenceGetFdInfoKHR* pGetFdInfo + int* pFd + + + VkResult vkImportFenceFdKHR + VkDevice device + const VkImportFenceFdInfoKHR* pImportFenceFdInfo + + + VkResult vkGetFenceSciSyncFenceNV + VkDevice device + const VkFenceGetSciSyncInfoNV* pGetSciSyncHandleInfo + void* pHandle + + + VkResult vkGetFenceSciSyncObjNV + VkDevice device + const VkFenceGetSciSyncInfoNV* pGetSciSyncHandleInfo + void* pHandle + + + VkResult vkImportFenceSciSyncFenceNV + VkDevice device + const VkImportFenceSciSyncInfoNV* pImportFenceSciSyncInfo + + + VkResult vkImportFenceSciSyncObjNV + VkDevice device + const VkImportFenceSciSyncInfoNV* pImportFenceSciSyncInfo + + + VkResult vkGetSemaphoreSciSyncObjNV + VkDevice device + const VkSemaphoreGetSciSyncInfoNV* pGetSciSyncInfo + void* pHandle + + + VkResult vkImportSemaphoreSciSyncObjNV + VkDevice device + const VkImportSemaphoreSciSyncInfoNV* pImportSemaphoreSciSyncInfo + + + VkResult vkGetPhysicalDeviceSciSyncAttributesNV + VkPhysicalDevice physicalDevice + const VkSciSyncAttributesInfoNV* pSciSyncAttributesInfo + NvSciSyncAttrList pAttributes + + + VkResult vkCreateSemaphoreSciSyncPoolNV + VkDevice device + const VkSemaphoreSciSyncPoolCreateInfoNV* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSemaphoreSciSyncPoolNV* pSemaphorePool + + + void vkDestroySemaphoreSciSyncPoolNV + VkDevice device + VkSemaphoreSciSyncPoolNV semaphorePool + const VkAllocationCallbacks* pAllocator + + + VkResult vkReleaseDisplayEXT + VkPhysicalDevice physicalDevice + VkDisplayKHR display + + + VkResult vkAcquireXlibDisplayEXT + VkPhysicalDevice physicalDevice + Display* dpy + VkDisplayKHR display + + + VkResult vkGetRandROutputDisplayEXT + VkPhysicalDevice physicalDevice + Display* dpy + RROutput rrOutput + VkDisplayKHR* pDisplay + + + VkResult vkAcquireWinrtDisplayNV + VkPhysicalDevice physicalDevice + VkDisplayKHR display + + + VkResult vkGetWinrtDisplayNV + VkPhysicalDevice physicalDevice + uint32_t deviceRelativeId + VkDisplayKHR* pDisplay + + + VkResult vkDisplayPowerControlEXT + VkDevice device + VkDisplayKHR display + const VkDisplayPowerInfoEXT* pDisplayPowerInfo + + + VkResult vkRegisterDeviceEventEXT + VkDevice device + const VkDeviceEventInfoEXT* pDeviceEventInfo + const VkAllocationCallbacks* pAllocator + VkFence* pFence + + + VkResult vkRegisterDisplayEventEXT + VkDevice device + VkDisplayKHR display + const VkDisplayEventInfoEXT* pDisplayEventInfo + const VkAllocationCallbacks* pAllocator + VkFence* pFence + + + VkResult vkGetSwapchainCounterEXT + VkDevice device + VkSwapchainKHR swapchain + VkSurfaceCounterFlagBitsEXT counter + uint64_t* pCounterValue + + + VkResult vkGetPhysicalDeviceSurfaceCapabilities2EXT + VkPhysicalDevice physicalDevice + VkSurfaceKHR surface + VkSurfaceCapabilities2EXT* pSurfaceCapabilities + + + VkResult vkEnumeratePhysicalDeviceGroups + VkInstance instance + uint32_t* pPhysicalDeviceGroupCount + VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties + + + + void vkGetDeviceGroupPeerMemoryFeatures + VkDevice device + uint32_t heapIndex + uint32_t localDeviceIndex + uint32_t remoteDeviceIndex + VkPeerMemoryFeatureFlags* pPeerMemoryFeatures + + + + VkResult vkBindBufferMemory2 + VkDevice device + uint32_t bindInfoCount + const VkBindBufferMemoryInfo* pBindInfos + + + + VkResult vkBindImageMemory2 + VkDevice device + uint32_t bindInfoCount + const VkBindImageMemoryInfo* pBindInfos + + + + void vkCmdSetDeviceMask + VkCommandBuffer commandBuffer + uint32_t deviceMask + + + + VkResult vkGetDeviceGroupPresentCapabilitiesKHR + VkDevice device + VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities + + + VkResult vkGetDeviceGroupSurfacePresentModesKHR + VkDevice device + VkSurfaceKHR surface + VkDeviceGroupPresentModeFlagsKHR* pModes + + + VkResult vkAcquireNextImage2KHR + VkDevice device + const VkAcquireNextImageInfoKHR* pAcquireInfo + uint32_t* pImageIndex + + + void vkCmdDispatchBase + VkCommandBuffer commandBuffer + uint32_t baseGroupX + uint32_t baseGroupY + uint32_t baseGroupZ + uint32_t groupCountX + uint32_t groupCountY + uint32_t groupCountZ + + + + VkResult vkGetPhysicalDevicePresentRectanglesKHR + VkPhysicalDevice physicalDevice + VkSurfaceKHR surface + uint32_t* pRectCount + VkRect2D* pRects + + + VkResult vkCreateDescriptorUpdateTemplate + VkDevice device + const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate + + + + void vkDestroyDescriptorUpdateTemplate + VkDevice device + VkDescriptorUpdateTemplate descriptorUpdateTemplate + const VkAllocationCallbacks* pAllocator + + + + void vkUpdateDescriptorSetWithTemplate + VkDevice device + VkDescriptorSet descriptorSet + VkDescriptorUpdateTemplate descriptorUpdateTemplate + const void* pData + + + + void vkCmdPushDescriptorSetWithTemplateKHR + VkCommandBuffer commandBuffer + VkDescriptorUpdateTemplate descriptorUpdateTemplate + VkPipelineLayout layout + uint32_t set + const void* pData + + + void vkSetHdrMetadataEXT + VkDevice device + uint32_t swapchainCount + const VkSwapchainKHR* pSwapchains + const VkHdrMetadataEXT* pMetadata + + + VkResult vkGetSwapchainStatusKHR + VkDevice device + VkSwapchainKHR swapchain + + + VkResult vkGetRefreshCycleDurationGOOGLE + VkDevice device + VkSwapchainKHR swapchain + VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties + + + VkResult vkGetPastPresentationTimingGOOGLE + VkDevice device + VkSwapchainKHR swapchain + uint32_t* pPresentationTimingCount + VkPastPresentationTimingGOOGLE* pPresentationTimings + + + VkResult vkCreateIOSSurfaceMVK + VkInstance instance + const VkIOSSurfaceCreateInfoMVK* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkCreateMacOSSurfaceMVK + VkInstance instance + const VkMacOSSurfaceCreateInfoMVK* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkCreateMetalSurfaceEXT + VkInstance instance + const VkMetalSurfaceCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + void vkCmdSetViewportWScalingNV + VkCommandBuffer commandBuffer + uint32_t firstViewport + uint32_t viewportCount + const VkViewportWScalingNV* pViewportWScalings + + + void vkCmdSetDiscardRectangleEXT + VkCommandBuffer commandBuffer + uint32_t firstDiscardRectangle + uint32_t discardRectangleCount + const VkRect2D* pDiscardRectangles + + + void vkCmdSetDiscardRectangleEnableEXT + VkCommandBuffer commandBuffer + VkBool32 discardRectangleEnable + + + void vkCmdSetDiscardRectangleModeEXT + VkCommandBuffer commandBuffer + VkDiscardRectangleModeEXT discardRectangleMode + + + void vkCmdSetSampleLocationsEXT + VkCommandBuffer commandBuffer + const VkSampleLocationsInfoEXT* pSampleLocationsInfo + + + void vkGetPhysicalDeviceMultisamplePropertiesEXT + VkPhysicalDevice physicalDevice + VkSampleCountFlagBits samples + VkMultisamplePropertiesEXT* pMultisampleProperties + + + VkResult vkGetPhysicalDeviceSurfaceCapabilities2KHR + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo + VkSurfaceCapabilities2KHR* pSurfaceCapabilities + + + VkResult vkGetPhysicalDeviceSurfaceFormats2KHR + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo + uint32_t* pSurfaceFormatCount + VkSurfaceFormat2KHR* pSurfaceFormats + + + VkResult vkGetPhysicalDeviceDisplayProperties2KHR + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkDisplayProperties2KHR* pProperties + + + VkResult vkGetPhysicalDeviceDisplayPlaneProperties2KHR + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkDisplayPlaneProperties2KHR* pProperties + + + VkResult vkGetDisplayModeProperties2KHR + VkPhysicalDevice physicalDevice + VkDisplayKHR display + uint32_t* pPropertyCount + VkDisplayModeProperties2KHR* pProperties + + + VkResult vkGetDisplayPlaneCapabilities2KHR + VkPhysicalDevice physicalDevice + const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo + VkDisplayPlaneCapabilities2KHR* pCapabilities + + + void vkGetBufferMemoryRequirements2 + VkDevice device + const VkBufferMemoryRequirementsInfo2* pInfo + VkMemoryRequirements2* pMemoryRequirements + + + + void vkGetImageMemoryRequirements2 + VkDevice device + const VkImageMemoryRequirementsInfo2* pInfo + VkMemoryRequirements2* pMemoryRequirements + + + + void vkGetImageSparseMemoryRequirements2 + VkDevice device + const VkImageSparseMemoryRequirementsInfo2* pInfo + uint32_t* pSparseMemoryRequirementCount + VkSparseImageMemoryRequirements2* pSparseMemoryRequirements + + + + void vkGetDeviceBufferMemoryRequirements + VkDevice device + const VkDeviceBufferMemoryRequirements* pInfo + VkMemoryRequirements2* pMemoryRequirements + + + + void vkGetDeviceImageMemoryRequirements + VkDevice device + const VkDeviceImageMemoryRequirements* pInfo + VkMemoryRequirements2* pMemoryRequirements + + + + void vkGetDeviceImageSparseMemoryRequirements + VkDevice device + const VkDeviceImageMemoryRequirements* pInfo + uint32_t* pSparseMemoryRequirementCount + VkSparseImageMemoryRequirements2* pSparseMemoryRequirements + + + + VkResult vkCreateSamplerYcbcrConversion + VkDevice device + const VkSamplerYcbcrConversionCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSamplerYcbcrConversion* pYcbcrConversion + + + + void vkDestroySamplerYcbcrConversion + VkDevice device + VkSamplerYcbcrConversion ycbcrConversion + const VkAllocationCallbacks* pAllocator + + + + void vkGetDeviceQueue2 + VkDevice device + const VkDeviceQueueInfo2* pQueueInfo + VkQueue* pQueue + + + VkResult vkCreateValidationCacheEXT + VkDevice device + const VkValidationCacheCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkValidationCacheEXT* pValidationCache + + + void vkDestroyValidationCacheEXT + VkDevice device + VkValidationCacheEXT validationCache + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetValidationCacheDataEXT + VkDevice device + VkValidationCacheEXT validationCache + size_t* pDataSize + void* pData + + + VkResult vkMergeValidationCachesEXT + VkDevice device + VkValidationCacheEXT dstCache + uint32_t srcCacheCount + const VkValidationCacheEXT* pSrcCaches + + + void vkGetDescriptorSetLayoutSupport + VkDevice device + const VkDescriptorSetLayoutCreateInfo* pCreateInfo + VkDescriptorSetLayoutSupport* pSupport + + + + VkResult vkGetSwapchainGrallocUsageANDROID + VkDevice device + VkFormat format + VkImageUsageFlags imageUsage + int* grallocUsage + + + VkResult vkGetSwapchainGrallocUsage2ANDROID + VkDevice device + VkFormat format + VkImageUsageFlags imageUsage + VkSwapchainImageUsageFlagsANDROID swapchainImageUsage + uint64_t* grallocConsumerUsage + uint64_t* grallocProducerUsage + + + VkResult vkAcquireImageANDROID + VkDevice device + VkImage image + int nativeFenceFd + VkSemaphore semaphore + VkFence fence + + + VkResult vkQueueSignalReleaseImageANDROID + VkQueue queue + uint32_t waitSemaphoreCount + const VkSemaphore* pWaitSemaphores + VkImage image + int* pNativeFenceFd + + + VkResult vkGetShaderInfoAMD + VkDevice device + VkPipeline pipeline + VkShaderStageFlagBits shaderStage + VkShaderInfoTypeAMD infoType + size_t* pInfoSize + void* pInfo + + + void vkSetLocalDimmingAMD + VkDevice device + VkSwapchainKHR swapChain + VkBool32 localDimmingEnable + + + VkResult vkGetPhysicalDeviceCalibrateableTimeDomainsEXT + VkPhysicalDevice physicalDevice + uint32_t* pTimeDomainCount + VkTimeDomainEXT* pTimeDomains + + + VkResult vkGetCalibratedTimestampsEXT + VkDevice device + uint32_t timestampCount + const VkCalibratedTimestampInfoEXT* pTimestampInfos + uint64_t* pTimestamps + uint64_t* pMaxDeviation + + + VkResult vkSetDebugUtilsObjectNameEXT + VkDevice device + const VkDebugUtilsObjectNameInfoEXT* pNameInfo + + + VkResult vkSetDebugUtilsObjectTagEXT + VkDevice device + const VkDebugUtilsObjectTagInfoEXT* pTagInfo + + + void vkQueueBeginDebugUtilsLabelEXT + VkQueue queue + const VkDebugUtilsLabelEXT* pLabelInfo + + + void vkQueueEndDebugUtilsLabelEXT + VkQueue queue + + + void vkQueueInsertDebugUtilsLabelEXT + VkQueue queue + const VkDebugUtilsLabelEXT* pLabelInfo + + + void vkCmdBeginDebugUtilsLabelEXT + VkCommandBuffer commandBuffer + const VkDebugUtilsLabelEXT* pLabelInfo + + + void vkCmdEndDebugUtilsLabelEXT + VkCommandBuffer commandBuffer + + + void vkCmdInsertDebugUtilsLabelEXT + VkCommandBuffer commandBuffer + const VkDebugUtilsLabelEXT* pLabelInfo + + + VkResult vkCreateDebugUtilsMessengerEXT + VkInstance instance + const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkDebugUtilsMessengerEXT* pMessenger + + + void vkDestroyDebugUtilsMessengerEXT + VkInstance instance + VkDebugUtilsMessengerEXT messenger + const VkAllocationCallbacks* pAllocator + + + void vkSubmitDebugUtilsMessageEXT + VkInstance instance + VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity + VkDebugUtilsMessageTypeFlagsEXT messageTypes + const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData + + + VkResult vkGetMemoryHostPointerPropertiesEXT + VkDevice device + VkExternalMemoryHandleTypeFlagBits handleType + const void* pHostPointer + VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties + + + void vkCmdWriteBufferMarkerAMD + VkCommandBuffer commandBuffer + VkPipelineStageFlagBits pipelineStage + VkBuffer dstBuffer + VkDeviceSize dstOffset + uint32_t marker + + + VkResult vkCreateRenderPass2 + VkDevice device + const VkRenderPassCreateInfo2* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkRenderPass* pRenderPass + + + + void vkCmdBeginRenderPass2 + VkCommandBuffer commandBuffer + const VkRenderPassBeginInfo* pRenderPassBegin + const VkSubpassBeginInfo* pSubpassBeginInfo + + + + void vkCmdNextSubpass2 + VkCommandBuffer commandBuffer + const VkSubpassBeginInfo* pSubpassBeginInfo + const VkSubpassEndInfo* pSubpassEndInfo + + + + void vkCmdEndRenderPass2 + VkCommandBuffer commandBuffer + const VkSubpassEndInfo* pSubpassEndInfo + + + + VkResult vkGetSemaphoreCounterValue + VkDevice device + VkSemaphore semaphore + uint64_t* pValue + + + + VkResult vkWaitSemaphores + VkDevice device + const VkSemaphoreWaitInfo* pWaitInfo + uint64_t timeout + + + + VkResult vkSignalSemaphore + VkDevice device + const VkSemaphoreSignalInfo* pSignalInfo + + + + VkResult vkGetAndroidHardwareBufferPropertiesANDROID + VkDevice device + const struct AHardwareBuffer* buffer + VkAndroidHardwareBufferPropertiesANDROID* pProperties + + + VkResult vkGetMemoryAndroidHardwareBufferANDROID + VkDevice device + const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo + struct AHardwareBuffer** pBuffer + + + void vkCmdDrawIndirectCount + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + VkBuffer countBuffer + VkDeviceSize countBufferOffset + uint32_t maxDrawCount + uint32_t stride + + + + + void vkCmdDrawIndexedIndirectCount + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + VkBuffer countBuffer + VkDeviceSize countBufferOffset + uint32_t maxDrawCount + uint32_t stride + + + + + void vkCmdSetCheckpointNV + VkCommandBuffer commandBuffer + const void* pCheckpointMarker + + + void vkGetQueueCheckpointDataNV + VkQueue queue + uint32_t* pCheckpointDataCount + VkCheckpointDataNV* pCheckpointData + + + void vkCmdBindTransformFeedbackBuffersEXT + VkCommandBuffer commandBuffer + uint32_t firstBinding + uint32_t bindingCount + const VkBuffer* pBuffers + const VkDeviceSize* pOffsets + const VkDeviceSize* pSizes + + + void vkCmdBeginTransformFeedbackEXT + VkCommandBuffer commandBuffer + uint32_t firstCounterBuffer + uint32_t counterBufferCount + const VkBuffer* pCounterBuffers + const VkDeviceSize* pCounterBufferOffsets + + + void vkCmdEndTransformFeedbackEXT + VkCommandBuffer commandBuffer + uint32_t firstCounterBuffer + uint32_t counterBufferCount + const VkBuffer* pCounterBuffers + const VkDeviceSize* pCounterBufferOffsets + + + void vkCmdBeginQueryIndexedEXT + VkCommandBuffer commandBuffer + VkQueryPool queryPool + uint32_t query + VkQueryControlFlags flags + uint32_t index + + + void vkCmdEndQueryIndexedEXT + VkCommandBuffer commandBuffer + VkQueryPool queryPool + uint32_t query + uint32_t index + + + void vkCmdDrawIndirectByteCountEXT + VkCommandBuffer commandBuffer + uint32_t instanceCount + uint32_t firstInstance + VkBuffer counterBuffer + VkDeviceSize counterBufferOffset + uint32_t counterOffset + uint32_t vertexStride + + + void vkCmdSetExclusiveScissorNV + VkCommandBuffer commandBuffer + uint32_t firstExclusiveScissor + uint32_t exclusiveScissorCount + const VkRect2D* pExclusiveScissors + + + void vkCmdSetExclusiveScissorEnableNV + VkCommandBuffer commandBuffer + uint32_t firstExclusiveScissor + uint32_t exclusiveScissorCount + const VkBool32* pExclusiveScissorEnables + + + void vkCmdBindShadingRateImageNV + VkCommandBuffer commandBuffer + VkImageView imageView + VkImageLayout imageLayout + + + void vkCmdSetViewportShadingRatePaletteNV + VkCommandBuffer commandBuffer + uint32_t firstViewport + uint32_t viewportCount + const VkShadingRatePaletteNV* pShadingRatePalettes + + + void vkCmdSetCoarseSampleOrderNV + VkCommandBuffer commandBuffer + VkCoarseSampleOrderTypeNV sampleOrderType + uint32_t customSampleOrderCount + const VkCoarseSampleOrderCustomNV* pCustomSampleOrders + + + void vkCmdDrawMeshTasksNV + VkCommandBuffer commandBuffer + uint32_t taskCount + uint32_t firstTask + + + void vkCmdDrawMeshTasksIndirectNV + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + uint32_t drawCount + uint32_t stride + + + void vkCmdDrawMeshTasksIndirectCountNV + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + VkBuffer countBuffer + VkDeviceSize countBufferOffset + uint32_t maxDrawCount + uint32_t stride + + + void vkCmdDrawMeshTasksEXT + VkCommandBuffer commandBuffer + uint32_t groupCountX + uint32_t groupCountY + uint32_t groupCountZ + + + void vkCmdDrawMeshTasksIndirectEXT + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + uint32_t drawCount + uint32_t stride + + + void vkCmdDrawMeshTasksIndirectCountEXT + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + VkBuffer countBuffer + VkDeviceSize countBufferOffset + uint32_t maxDrawCount + uint32_t stride + + + VkResult vkCompileDeferredNV + VkDevice device + VkPipeline pipeline + uint32_t shader + + + VkResult vkCreateAccelerationStructureNV + VkDevice device + const VkAccelerationStructureCreateInfoNV* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkAccelerationStructureNV* pAccelerationStructure + + + void vkCmdBindInvocationMaskHUAWEI + VkCommandBuffer commandBuffer + VkImageView imageView + VkImageLayout imageLayout + + + void vkDestroyAccelerationStructureKHR + VkDevice device + VkAccelerationStructureKHR accelerationStructure + const VkAllocationCallbacks* pAllocator + + + void vkDestroyAccelerationStructureNV + VkDevice device + VkAccelerationStructureNV accelerationStructure + const VkAllocationCallbacks* pAllocator + + + void vkGetAccelerationStructureMemoryRequirementsNV + VkDevice device + const VkAccelerationStructureMemoryRequirementsInfoNV* pInfo + VkMemoryRequirements2KHR* pMemoryRequirements + + + VkResult vkBindAccelerationStructureMemoryNV + VkDevice device + uint32_t bindInfoCount + const VkBindAccelerationStructureMemoryInfoNV* pBindInfos + + + void vkCmdCopyAccelerationStructureNV + VkCommandBuffer commandBuffer + VkAccelerationStructureNV dst + VkAccelerationStructureNV src + VkCopyAccelerationStructureModeKHR mode + + + void vkCmdCopyAccelerationStructureKHR + VkCommandBuffer commandBuffer + const VkCopyAccelerationStructureInfoKHR* pInfo + + + VkResult vkCopyAccelerationStructureKHR + VkDevice device + VkDeferredOperationKHR deferredOperation + const VkCopyAccelerationStructureInfoKHR* pInfo + + + void vkCmdCopyAccelerationStructureToMemoryKHR + VkCommandBuffer commandBuffer + const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo + + + VkResult vkCopyAccelerationStructureToMemoryKHR + VkDevice device + VkDeferredOperationKHR deferredOperation + const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo + + + void vkCmdCopyMemoryToAccelerationStructureKHR + VkCommandBuffer commandBuffer + const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo + + + VkResult vkCopyMemoryToAccelerationStructureKHR + VkDevice device + VkDeferredOperationKHR deferredOperation + const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo + + + void vkCmdWriteAccelerationStructuresPropertiesKHR + VkCommandBuffer commandBuffer + uint32_t accelerationStructureCount + const VkAccelerationStructureKHR* pAccelerationStructures + VkQueryType queryType + VkQueryPool queryPool + uint32_t firstQuery + + + void vkCmdWriteAccelerationStructuresPropertiesNV + VkCommandBuffer commandBuffer + uint32_t accelerationStructureCount + const VkAccelerationStructureNV* pAccelerationStructures + VkQueryType queryType + VkQueryPool queryPool + uint32_t firstQuery + + + void vkCmdBuildAccelerationStructureNV + VkCommandBuffer commandBuffer + const VkAccelerationStructureInfoNV* pInfo + VkBuffer instanceData + VkDeviceSize instanceOffset + VkBool32 update + VkAccelerationStructureNV dst + VkAccelerationStructureNV src + VkBuffer scratch + VkDeviceSize scratchOffset + + + VkResult vkWriteAccelerationStructuresPropertiesKHR + VkDevice device + uint32_t accelerationStructureCount + const VkAccelerationStructureKHR* pAccelerationStructures + VkQueryType queryType + size_t dataSize + void* pData + size_t stride + + + void vkCmdTraceRaysKHR + VkCommandBuffer commandBuffer + const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable + const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable + const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable + const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable + uint32_t width + uint32_t height + uint32_t depth + + + void vkCmdTraceRaysNV + VkCommandBuffer commandBuffer + VkBuffer raygenShaderBindingTableBuffer + VkDeviceSize raygenShaderBindingOffset + VkBuffer missShaderBindingTableBuffer + VkDeviceSize missShaderBindingOffset + VkDeviceSize missShaderBindingStride + VkBuffer hitShaderBindingTableBuffer + VkDeviceSize hitShaderBindingOffset + VkDeviceSize hitShaderBindingStride + VkBuffer callableShaderBindingTableBuffer + VkDeviceSize callableShaderBindingOffset + VkDeviceSize callableShaderBindingStride + uint32_t width + uint32_t height + uint32_t depth + + + VkResult vkGetRayTracingShaderGroupHandlesKHR + VkDevice device + VkPipeline pipeline + uint32_t firstGroup + uint32_t groupCount + size_t dataSize + void* pData + + + + VkResult vkGetRayTracingCaptureReplayShaderGroupHandlesKHR + VkDevice device + VkPipeline pipeline + uint32_t firstGroup + uint32_t groupCount + size_t dataSize + void* pData + + + VkResult vkGetAccelerationStructureHandleNV + VkDevice device + VkAccelerationStructureNV accelerationStructure + size_t dataSize + void* pData + + + VkResult vkCreateRayTracingPipelinesNV + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkRayTracingPipelineCreateInfoNV* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkCreateRayTracingPipelinesNV + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkRayTracingPipelineCreateInfoNV* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkCreateRayTracingPipelinesKHR + VkDevice device + VkDeferredOperationKHR deferredOperation + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkRayTracingPipelineCreateInfoKHR* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkCreateRayTracingPipelinesKHR + VkDevice device + VkDeferredOperationKHR deferredOperation + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkRayTracingPipelineCreateInfoKHR* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + VkResult vkGetPhysicalDeviceCooperativeMatrixPropertiesNV + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkCooperativeMatrixPropertiesNV* pProperties + + + void vkCmdTraceRaysIndirectKHR + VkCommandBuffer commandBuffer + const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable + const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable + const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable + const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable + VkDeviceAddress indirectDeviceAddress + + + void vkCmdTraceRaysIndirect2KHR + VkCommandBuffer commandBuffer + VkDeviceAddress indirectDeviceAddress + + + void vkGetDeviceAccelerationStructureCompatibilityKHR + VkDevice device + const VkAccelerationStructureVersionInfoKHR* pVersionInfo + VkAccelerationStructureCompatibilityKHR* pCompatibility + + + VkDeviceSize vkGetRayTracingShaderGroupStackSizeKHR + VkDevice device + VkPipeline pipeline + uint32_t group + VkShaderGroupShaderKHR groupShader + + + void vkCmdSetRayTracingPipelineStackSizeKHR + VkCommandBuffer commandBuffer + uint32_t pipelineStackSize + + + uint32_t vkGetImageViewHandleNVX + VkDevice device + const VkImageViewHandleInfoNVX* pInfo + + + VkResult vkGetImageViewAddressNVX + VkDevice device + VkImageView imageView + VkImageViewAddressPropertiesNVX* pProperties + + + VkResult vkGetPhysicalDeviceSurfacePresentModes2EXT + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo + uint32_t* pPresentModeCount + VkPresentModeKHR* pPresentModes + + + VkResult vkGetDeviceGroupSurfacePresentModes2EXT + VkDevice device + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo + VkDeviceGroupPresentModeFlagsKHR* pModes + + + VkResult vkAcquireFullScreenExclusiveModeEXT + VkDevice device + VkSwapchainKHR swapchain + + + VkResult vkReleaseFullScreenExclusiveModeEXT + VkDevice device + VkSwapchainKHR swapchain + + + VkResult vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR + VkPhysicalDevice physicalDevice + uint32_t queueFamilyIndex + uint32_t* pCounterCount + VkPerformanceCounterKHR* pCounters + VkPerformanceCounterDescriptionKHR* pCounterDescriptions + + + void vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR + VkPhysicalDevice physicalDevice + const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo + uint32_t* pNumPasses + + + VkResult vkAcquireProfilingLockKHR + VkDevice device + const VkAcquireProfilingLockInfoKHR* pInfo + + + void vkReleaseProfilingLockKHR + VkDevice device + + + VkResult vkGetImageDrmFormatModifierPropertiesEXT + VkDevice device + VkImage image + VkImageDrmFormatModifierPropertiesEXT* pProperties + + + uint64_t vkGetBufferOpaqueCaptureAddress + VkDevice device + const VkBufferDeviceAddressInfo* pInfo + + + + VkDeviceAddress vkGetBufferDeviceAddress + VkDevice device + const VkBufferDeviceAddressInfo* pInfo + + + + + VkResult vkCreateHeadlessSurfaceEXT + VkInstance instance + const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkSurfaceKHR* pSurface + + + VkResult vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV + VkPhysicalDevice physicalDevice + uint32_t* pCombinationCount + VkFramebufferMixedSamplesCombinationNV* pCombinations + + + VkResult vkInitializePerformanceApiINTEL + VkDevice device + const VkInitializePerformanceApiInfoINTEL* pInitializeInfo + + + void vkUninitializePerformanceApiINTEL + VkDevice device + + + VkResult vkCmdSetPerformanceMarkerINTEL + VkCommandBuffer commandBuffer + const VkPerformanceMarkerInfoINTEL* pMarkerInfo + + + VkResult vkCmdSetPerformanceStreamMarkerINTEL + VkCommandBuffer commandBuffer + const VkPerformanceStreamMarkerInfoINTEL* pMarkerInfo + + + VkResult vkCmdSetPerformanceOverrideINTEL + VkCommandBuffer commandBuffer + const VkPerformanceOverrideInfoINTEL* pOverrideInfo + + + VkResult vkAcquirePerformanceConfigurationINTEL + VkDevice device + const VkPerformanceConfigurationAcquireInfoINTEL* pAcquireInfo + VkPerformanceConfigurationINTEL* pConfiguration + + + VkResult vkReleasePerformanceConfigurationINTEL + VkDevice device + VkPerformanceConfigurationINTEL configuration + + + VkResult vkQueueSetPerformanceConfigurationINTEL + VkQueue queue + VkPerformanceConfigurationINTEL configuration + + + VkResult vkGetPerformanceParameterINTEL + VkDevice device + VkPerformanceParameterTypeINTEL parameter + VkPerformanceValueINTEL* pValue + + + uint64_t vkGetDeviceMemoryOpaqueCaptureAddress + VkDevice device + const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo + + + + VkResult vkGetPipelineExecutablePropertiesKHR + VkDevice device + const VkPipelineInfoKHR* pPipelineInfo + uint32_t* pExecutableCount + VkPipelineExecutablePropertiesKHR* pProperties + + + VkResult vkGetPipelineExecutableStatisticsKHR + VkDevice device + const VkPipelineExecutableInfoKHR* pExecutableInfo + uint32_t* pStatisticCount + VkPipelineExecutableStatisticKHR* pStatistics + + + VkResult vkGetPipelineExecutableInternalRepresentationsKHR + VkDevice device + const VkPipelineExecutableInfoKHR* pExecutableInfo + uint32_t* pInternalRepresentationCount + VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations + + + void vkCmdSetLineStippleEXT + VkCommandBuffer commandBuffer + uint32_t lineStippleFactor + uint16_t lineStipplePattern + + + VkResult vkGetFaultData + VkDevice device + VkFaultQueryBehavior faultQueryBehavior + VkBool32* pUnrecordedFaults + uint32_t* pFaultCount + VkFaultData* pFaults + + + VkResult vkGetPhysicalDeviceToolProperties + VkPhysicalDevice physicalDevice + uint32_t* pToolCount + VkPhysicalDeviceToolProperties* pToolProperties + + + + VkResult vkCreateAccelerationStructureKHR + VkDevice device + const VkAccelerationStructureCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkAccelerationStructureKHR* pAccelerationStructure + + + void vkCmdBuildAccelerationStructuresKHR + VkCommandBuffer commandBuffer + uint32_t infoCount + const VkAccelerationStructureBuildGeometryInfoKHR* pInfos + const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos + + + void vkCmdBuildAccelerationStructuresIndirectKHR + VkCommandBuffer commandBuffer + uint32_t infoCount + const VkAccelerationStructureBuildGeometryInfoKHR* pInfos + const VkDeviceAddress* pIndirectDeviceAddresses + const uint32_t* pIndirectStrides + const uint32_t* const* ppMaxPrimitiveCounts + + + VkResult vkBuildAccelerationStructuresKHR + VkDevice device + VkDeferredOperationKHR deferredOperation + uint32_t infoCount + const VkAccelerationStructureBuildGeometryInfoKHR* pInfos + const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos + + + VkDeviceAddress vkGetAccelerationStructureDeviceAddressKHR + VkDevice device + const VkAccelerationStructureDeviceAddressInfoKHR* pInfo + + + VkResult vkCreateDeferredOperationKHR + VkDevice device + const VkAllocationCallbacks* pAllocator + VkDeferredOperationKHR* pDeferredOperation + + + void vkDestroyDeferredOperationKHR + VkDevice device + VkDeferredOperationKHR operation + const VkAllocationCallbacks* pAllocator + + + uint32_t vkGetDeferredOperationMaxConcurrencyKHR + VkDevice device + VkDeferredOperationKHR operation + + + VkResult vkGetDeferredOperationResultKHR + VkDevice device + VkDeferredOperationKHR operation + + + VkResult vkDeferredOperationJoinKHR + VkDevice device + VkDeferredOperationKHR operation + + + void vkGetPipelineIndirectMemoryRequirementsNV + VkDevice device + const VkComputePipelineCreateInfo* pCreateInfo + VkMemoryRequirements2* pMemoryRequirements + + + VkDeviceAddress vkGetPipelineIndirectDeviceAddressNV + VkDevice device + const VkPipelineIndirectDeviceAddressInfoNV* pInfo + + + void vkCmdSetCullMode + VkCommandBuffer commandBuffer + VkCullModeFlags cullMode + + + + void vkCmdSetFrontFace + VkCommandBuffer commandBuffer + VkFrontFace frontFace + + + + void vkCmdSetPrimitiveTopology + VkCommandBuffer commandBuffer + VkPrimitiveTopology primitiveTopology + + + + void vkCmdSetViewportWithCount + VkCommandBuffer commandBuffer + uint32_t viewportCount + const VkViewport* pViewports + + + + void vkCmdSetScissorWithCount + VkCommandBuffer commandBuffer + uint32_t scissorCount + const VkRect2D* pScissors + + + + void vkCmdBindIndexBuffer2KHR + VkCommandBuffer commandBuffer + VkBuffer buffer + VkDeviceSize offset + VkDeviceSize size + VkIndexType indexType + + + void vkCmdBindVertexBuffers2 + VkCommandBuffer commandBuffer + uint32_t firstBinding + uint32_t bindingCount + const VkBuffer* pBuffers + const VkDeviceSize* pOffsets + const VkDeviceSize* pSizes + const VkDeviceSize* pStrides + + + + void vkCmdSetDepthTestEnable + VkCommandBuffer commandBuffer + VkBool32 depthTestEnable + + + + void vkCmdSetDepthWriteEnable + VkCommandBuffer commandBuffer + VkBool32 depthWriteEnable + + + + void vkCmdSetDepthCompareOp + VkCommandBuffer commandBuffer + VkCompareOp depthCompareOp + + + + void vkCmdSetDepthBoundsTestEnable + VkCommandBuffer commandBuffer + VkBool32 depthBoundsTestEnable + + + + void vkCmdSetStencilTestEnable + VkCommandBuffer commandBuffer + VkBool32 stencilTestEnable + + + + void vkCmdSetStencilOp + VkCommandBuffer commandBuffer + VkStencilFaceFlags faceMask + VkStencilOp failOp + VkStencilOp passOp + VkStencilOp depthFailOp + VkCompareOp compareOp + + + + void vkCmdSetPatchControlPointsEXT + VkCommandBuffer commandBuffer + uint32_t patchControlPoints + + + void vkCmdSetRasterizerDiscardEnable + VkCommandBuffer commandBuffer + VkBool32 rasterizerDiscardEnable + + + + void vkCmdSetDepthBiasEnable + VkCommandBuffer commandBuffer + VkBool32 depthBiasEnable + + + + void vkCmdSetLogicOpEXT + VkCommandBuffer commandBuffer + VkLogicOp logicOp + + + void vkCmdSetPrimitiveRestartEnable + VkCommandBuffer commandBuffer + VkBool32 primitiveRestartEnable + + + + void vkCmdSetTessellationDomainOriginEXT + VkCommandBuffer commandBuffer + VkTessellationDomainOrigin domainOrigin + + + void vkCmdSetDepthClampEnableEXT + VkCommandBuffer commandBuffer + VkBool32 depthClampEnable + + + void vkCmdSetPolygonModeEXT + VkCommandBuffer commandBuffer + VkPolygonMode polygonMode + + + void vkCmdSetRasterizationSamplesEXT + VkCommandBuffer commandBuffer + VkSampleCountFlagBits rasterizationSamples + + + void vkCmdSetSampleMaskEXT + VkCommandBuffer commandBuffer + VkSampleCountFlagBits samples + const VkSampleMask* pSampleMask + + + void vkCmdSetAlphaToCoverageEnableEXT + VkCommandBuffer commandBuffer + VkBool32 alphaToCoverageEnable + + + void vkCmdSetAlphaToOneEnableEXT + VkCommandBuffer commandBuffer + VkBool32 alphaToOneEnable + + + void vkCmdSetLogicOpEnableEXT + VkCommandBuffer commandBuffer + VkBool32 logicOpEnable + + + void vkCmdSetColorBlendEnableEXT + VkCommandBuffer commandBuffer + uint32_t firstAttachment + uint32_t attachmentCount + const VkBool32* pColorBlendEnables + + + void vkCmdSetColorBlendEquationEXT + VkCommandBuffer commandBuffer + uint32_t firstAttachment + uint32_t attachmentCount + const VkColorBlendEquationEXT* pColorBlendEquations + + + void vkCmdSetColorWriteMaskEXT + VkCommandBuffer commandBuffer + uint32_t firstAttachment + uint32_t attachmentCount + const VkColorComponentFlags* pColorWriteMasks + + + void vkCmdSetRasterizationStreamEXT + VkCommandBuffer commandBuffer + uint32_t rasterizationStream + + + void vkCmdSetConservativeRasterizationModeEXT + VkCommandBuffer commandBuffer + VkConservativeRasterizationModeEXT conservativeRasterizationMode + + + void vkCmdSetExtraPrimitiveOverestimationSizeEXT + VkCommandBuffer commandBuffer + float extraPrimitiveOverestimationSize + + + void vkCmdSetDepthClipEnableEXT + VkCommandBuffer commandBuffer + VkBool32 depthClipEnable + + + void vkCmdSetSampleLocationsEnableEXT + VkCommandBuffer commandBuffer + VkBool32 sampleLocationsEnable + + + void vkCmdSetColorBlendAdvancedEXT + VkCommandBuffer commandBuffer + uint32_t firstAttachment + uint32_t attachmentCount + const VkColorBlendAdvancedEXT* pColorBlendAdvanced + + + void vkCmdSetProvokingVertexModeEXT + VkCommandBuffer commandBuffer + VkProvokingVertexModeEXT provokingVertexMode + + + void vkCmdSetLineRasterizationModeEXT + VkCommandBuffer commandBuffer + VkLineRasterizationModeEXT lineRasterizationMode + + + void vkCmdSetLineStippleEnableEXT + VkCommandBuffer commandBuffer + VkBool32 stippledLineEnable + + + void vkCmdSetDepthClipNegativeOneToOneEXT + VkCommandBuffer commandBuffer + VkBool32 negativeOneToOne + + + void vkCmdSetViewportWScalingEnableNV + VkCommandBuffer commandBuffer + VkBool32 viewportWScalingEnable + + + void vkCmdSetViewportSwizzleNV + VkCommandBuffer commandBuffer + uint32_t firstViewport + uint32_t viewportCount + const VkViewportSwizzleNV* pViewportSwizzles + + + void vkCmdSetCoverageToColorEnableNV + VkCommandBuffer commandBuffer + VkBool32 coverageToColorEnable + + + void vkCmdSetCoverageToColorLocationNV + VkCommandBuffer commandBuffer + uint32_t coverageToColorLocation + + + void vkCmdSetCoverageModulationModeNV + VkCommandBuffer commandBuffer + VkCoverageModulationModeNV coverageModulationMode + + + void vkCmdSetCoverageModulationTableEnableNV + VkCommandBuffer commandBuffer + VkBool32 coverageModulationTableEnable + + + void vkCmdSetCoverageModulationTableNV + VkCommandBuffer commandBuffer + uint32_t coverageModulationTableCount + const float* pCoverageModulationTable + + + void vkCmdSetShadingRateImageEnableNV + VkCommandBuffer commandBuffer + VkBool32 shadingRateImageEnable + + + void vkCmdSetCoverageReductionModeNV + VkCommandBuffer commandBuffer + VkCoverageReductionModeNV coverageReductionMode + + + void vkCmdSetRepresentativeFragmentTestEnableNV + VkCommandBuffer commandBuffer + VkBool32 representativeFragmentTestEnable + + + VkResult vkCreatePrivateDataSlot + VkDevice device + const VkPrivateDataSlotCreateInfo* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkPrivateDataSlot* pPrivateDataSlot + + + + void vkDestroyPrivateDataSlot + VkDevice device + VkPrivateDataSlot privateDataSlot + const VkAllocationCallbacks* pAllocator + + + + VkResult vkSetPrivateData + VkDevice device + VkObjectType objectType + uint64_t objectHandle + VkPrivateDataSlot privateDataSlot + uint64_t data + + + + void vkGetPrivateData + VkDevice device + VkObjectType objectType + uint64_t objectHandle + VkPrivateDataSlot privateDataSlot + uint64_t* pData + + + + void vkCmdCopyBuffer2 + VkCommandBuffer commandBuffer + const VkCopyBufferInfo2* pCopyBufferInfo + + + + void vkCmdCopyImage2 + VkCommandBuffer commandBuffer + const VkCopyImageInfo2* pCopyImageInfo + + + + void vkCmdBlitImage2 + VkCommandBuffer commandBuffer + const VkBlitImageInfo2* pBlitImageInfo + + + + void vkCmdCopyBufferToImage2 + VkCommandBuffer commandBuffer + const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo + + + + void vkCmdCopyImageToBuffer2 + VkCommandBuffer commandBuffer + const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo + + + + void vkCmdResolveImage2 + VkCommandBuffer commandBuffer + const VkResolveImageInfo2* pResolveImageInfo + + + + void vkCmdRefreshObjectsKHR + VkCommandBuffer commandBuffer + const VkRefreshObjectListKHR* pRefreshObjects + + + VkResult vkGetPhysicalDeviceRefreshableObjectTypesKHR + VkPhysicalDevice physicalDevice + uint32_t* pRefreshableObjectTypeCount + VkObjectType* pRefreshableObjectTypes + + + void vkCmdSetFragmentShadingRateKHR + VkCommandBuffer commandBuffer + const VkExtent2D* pFragmentSize + const VkFragmentShadingRateCombinerOpKHR combinerOps[2] + + + VkResult vkGetPhysicalDeviceFragmentShadingRatesKHR + VkPhysicalDevice physicalDevice + uint32_t* pFragmentShadingRateCount + VkPhysicalDeviceFragmentShadingRateKHR* pFragmentShadingRates + + + void vkCmdSetFragmentShadingRateEnumNV + VkCommandBuffer commandBuffer + VkFragmentShadingRateNV shadingRate + const VkFragmentShadingRateCombinerOpKHR combinerOps[2] + + + void vkGetAccelerationStructureBuildSizesKHR + VkDevice device + VkAccelerationStructureBuildTypeKHR buildType + const VkAccelerationStructureBuildGeometryInfoKHR* pBuildInfo + const uint32_t* pMaxPrimitiveCounts + VkAccelerationStructureBuildSizesInfoKHR* pSizeInfo + + + void vkCmdSetVertexInputEXT + VkCommandBuffer commandBuffer + uint32_t vertexBindingDescriptionCount + const VkVertexInputBindingDescription2EXT* pVertexBindingDescriptions + uint32_t vertexAttributeDescriptionCount + const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions + + + void vkCmdSetColorWriteEnableEXT + VkCommandBuffer commandBuffer + uint32_t attachmentCount + const VkBool32* pColorWriteEnables + + + void vkCmdSetEvent2 + VkCommandBuffer commandBuffer + VkEvent event + const VkDependencyInfo* pDependencyInfo + + + + void vkCmdResetEvent2 + VkCommandBuffer commandBuffer + VkEvent event + VkPipelineStageFlags2 stageMask + + + + void vkCmdWaitEvents2 + VkCommandBuffer commandBuffer + uint32_t eventCount + const VkEvent* pEvents + const VkDependencyInfo* pDependencyInfos + + + + void vkCmdPipelineBarrier2 + VkCommandBuffer commandBuffer + const VkDependencyInfo* pDependencyInfo + + + + VkResult vkQueueSubmit2 + VkQueue queue + uint32_t submitCount + const VkSubmitInfo2* pSubmits + VkFence fence + + + + void vkCmdWriteTimestamp2 + VkCommandBuffer commandBuffer + VkPipelineStageFlags2 stage + VkQueryPool queryPool + uint32_t query + + + + void vkCmdWriteBufferMarker2AMD + VkCommandBuffer commandBuffer + VkPipelineStageFlags2 stage + VkBuffer dstBuffer + VkDeviceSize dstOffset + uint32_t marker + + + void vkGetQueueCheckpointData2NV + VkQueue queue + uint32_t* pCheckpointDataCount + VkCheckpointData2NV* pCheckpointData + + + VkResult vkCopyMemoryToImageEXT + VkDevice device + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo + + + VkResult vkCopyImageToMemoryEXT + VkDevice device + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo + + + VkResult vkCopyImageToImageEXT + VkDevice device + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo + + + VkResult vkTransitionImageLayoutEXT + VkDevice device + uint32_t transitionCount + const VkHostImageLayoutTransitionInfoEXT* pTransitions + + + void vkGetCommandPoolMemoryConsumption + VkDevice device + VkCommandPool commandPool + VkCommandBuffer commandBuffer + VkCommandPoolMemoryConsumption* pConsumption + + + VkResult vkGetPhysicalDeviceVideoCapabilitiesKHR + VkPhysicalDevice physicalDevice + const VkVideoProfileInfoKHR* pVideoProfile + VkVideoCapabilitiesKHR* pCapabilities + + + VkResult vkGetPhysicalDeviceVideoFormatPropertiesKHR + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo + uint32_t* pVideoFormatPropertyCount + VkVideoFormatPropertiesKHR* pVideoFormatProperties + + + VkResult vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR + VkPhysicalDevice physicalDevice + const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo + VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties + + + VkResult vkCreateVideoSessionKHR + VkDevice device + const VkVideoSessionCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkVideoSessionKHR* pVideoSession + + + void vkDestroyVideoSessionKHR + VkDevice device + VkVideoSessionKHR videoSession + const VkAllocationCallbacks* pAllocator + + + VkResult vkCreateVideoSessionParametersKHR + VkDevice device + const VkVideoSessionParametersCreateInfoKHR* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkVideoSessionParametersKHR* pVideoSessionParameters + + + VkResult vkUpdateVideoSessionParametersKHR + VkDevice device + VkVideoSessionParametersKHR videoSessionParameters + const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo + + + VkResult vkGetEncodedVideoSessionParametersKHR + VkDevice device + const VkVideoEncodeSessionParametersGetInfoKHR* pVideoSessionParametersInfo + VkVideoEncodeSessionParametersFeedbackInfoKHR* pFeedbackInfo + size_t* pDataSize + void* pData + + + void vkDestroyVideoSessionParametersKHR + VkDevice device + VkVideoSessionParametersKHR videoSessionParameters + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetVideoSessionMemoryRequirementsKHR + VkDevice device + VkVideoSessionKHR videoSession + uint32_t* pMemoryRequirementsCount + VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements + + + VkResult vkBindVideoSessionMemoryKHR + VkDevice device + VkVideoSessionKHR videoSession + uint32_t bindSessionMemoryInfoCount + const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos + + + void vkCmdDecodeVideoKHR + VkCommandBuffer commandBuffer + const VkVideoDecodeInfoKHR* pDecodeInfo + + + void vkCmdBeginVideoCodingKHR + VkCommandBuffer commandBuffer + const VkVideoBeginCodingInfoKHR* pBeginInfo + + + void vkCmdControlVideoCodingKHR + VkCommandBuffer commandBuffer + const VkVideoCodingControlInfoKHR* pCodingControlInfo + + + void vkCmdEndVideoCodingKHR + VkCommandBuffer commandBuffer + const VkVideoEndCodingInfoKHR* pEndCodingInfo + + + void vkCmdEncodeVideoKHR + VkCommandBuffer commandBuffer + const VkVideoEncodeInfoKHR* pEncodeInfo + + + void vkCmdDecompressMemoryNV + VkCommandBuffer commandBuffer + uint32_t decompressRegionCount + const VkDecompressMemoryRegionNV* pDecompressMemoryRegions + + + void vkCmdDecompressMemoryIndirectCountNV + VkCommandBuffer commandBuffer + VkDeviceAddress indirectCommandsAddress + VkDeviceAddress indirectCommandsCountAddress + uint32_t stride + + + VkResult vkCreateCuModuleNVX + VkDevice device + const VkCuModuleCreateInfoNVX* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkCuModuleNVX* pModule + + + VkResult vkCreateCuFunctionNVX + VkDevice device + const VkCuFunctionCreateInfoNVX* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkCuFunctionNVX* pFunction + + + void vkDestroyCuModuleNVX + VkDevice device + VkCuModuleNVX module + const VkAllocationCallbacks* pAllocator + + + void vkDestroyCuFunctionNVX + VkDevice device + VkCuFunctionNVX function + const VkAllocationCallbacks* pAllocator + + + void vkCmdCuLaunchKernelNVX + VkCommandBuffer commandBuffer + const VkCuLaunchInfoNVX* pLaunchInfo + + + void vkGetDescriptorSetLayoutSizeEXT + VkDevice device + VkDescriptorSetLayout layout + VkDeviceSize* pLayoutSizeInBytes + + + void vkGetDescriptorSetLayoutBindingOffsetEXT + VkDevice device + VkDescriptorSetLayout layout + uint32_t binding + VkDeviceSize* pOffset + + + void vkGetDescriptorEXT + VkDevice device + const VkDescriptorGetInfoEXT* pDescriptorInfo + size_t dataSize + void* pDescriptor + + + void vkCmdBindDescriptorBuffersEXT + VkCommandBuffer commandBuffer + uint32_t bufferCount + const VkDescriptorBufferBindingInfoEXT* pBindingInfos + + + void vkCmdSetDescriptorBufferOffsetsEXT + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipelineLayout layout + uint32_t firstSet + uint32_t setCount + const uint32_t* pBufferIndices + const VkDeviceSize* pOffsets + + + void vkCmdBindDescriptorBufferEmbeddedSamplersEXT + VkCommandBuffer commandBuffer + VkPipelineBindPoint pipelineBindPoint + VkPipelineLayout layout + uint32_t set + + + VkResult vkGetBufferOpaqueCaptureDescriptorDataEXT + VkDevice device + const VkBufferCaptureDescriptorDataInfoEXT* pInfo + void* pData + + + VkResult vkGetImageOpaqueCaptureDescriptorDataEXT + VkDevice device + const VkImageCaptureDescriptorDataInfoEXT* pInfo + void* pData + + + VkResult vkGetImageViewOpaqueCaptureDescriptorDataEXT + VkDevice device + const VkImageViewCaptureDescriptorDataInfoEXT* pInfo + void* pData + + + VkResult vkGetSamplerOpaqueCaptureDescriptorDataEXT + VkDevice device + const VkSamplerCaptureDescriptorDataInfoEXT* pInfo + void* pData + + + VkResult vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT + VkDevice device + const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo + void* pData + + + void vkSetDeviceMemoryPriorityEXT + VkDevice device + VkDeviceMemory memory + float priority + + + VkResult vkAcquireDrmDisplayEXT + VkPhysicalDevice physicalDevice + int32_t drmFd + VkDisplayKHR display + + + VkResult vkGetDrmDisplayEXT + VkPhysicalDevice physicalDevice + int32_t drmFd + uint32_t connectorId + VkDisplayKHR* display + + + VkResult vkWaitForPresentKHR + VkDevice device + VkSwapchainKHR swapchain + uint64_t presentId + uint64_t timeout + + + VkResult vkCreateBufferCollectionFUCHSIA + VkDevice device + const VkBufferCollectionCreateInfoFUCHSIA* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkBufferCollectionFUCHSIA* pCollection + + + VkResult vkSetBufferCollectionBufferConstraintsFUCHSIA + VkDevice device + VkBufferCollectionFUCHSIA collection + const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo + + + VkResult vkSetBufferCollectionImageConstraintsFUCHSIA + VkDevice device + VkBufferCollectionFUCHSIA collection + const VkImageConstraintsInfoFUCHSIA* pImageConstraintsInfo + + + void vkDestroyBufferCollectionFUCHSIA + VkDevice device + VkBufferCollectionFUCHSIA collection + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetBufferCollectionPropertiesFUCHSIA + VkDevice device + VkBufferCollectionFUCHSIA collection + VkBufferCollectionPropertiesFUCHSIA* pProperties + + + void vkCmdBeginRendering + VkCommandBuffer commandBuffer + const VkRenderingInfo* pRenderingInfo + + + + void vkCmdEndRendering + VkCommandBuffer commandBuffer + + + + + void vkGetDescriptorSetLayoutHostMappingInfoVALVE + VkDevice device + const VkDescriptorSetBindingReferenceVALVE* pBindingReference + VkDescriptorSetLayoutHostMappingInfoVALVE* pHostMapping + + + void vkGetDescriptorSetHostMappingVALVE + VkDevice device + VkDescriptorSet descriptorSet + void** ppData + + + VkResult vkCreateMicromapEXT + VkDevice device + const VkMicromapCreateInfoEXT* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkMicromapEXT* pMicromap + + + void vkCmdBuildMicromapsEXT + VkCommandBuffer commandBuffer + uint32_t infoCount + const VkMicromapBuildInfoEXT* pInfos + + + VkResult vkBuildMicromapsEXT + VkDevice device + VkDeferredOperationKHR deferredOperation + uint32_t infoCount + const VkMicromapBuildInfoEXT* pInfos + + + void vkDestroyMicromapEXT + VkDevice device + VkMicromapEXT micromap + const VkAllocationCallbacks* pAllocator + + + void vkCmdCopyMicromapEXT + VkCommandBuffer commandBuffer + const VkCopyMicromapInfoEXT* pInfo + + + VkResult vkCopyMicromapEXT + VkDevice device + VkDeferredOperationKHR deferredOperation + const VkCopyMicromapInfoEXT* pInfo + + + void vkCmdCopyMicromapToMemoryEXT + VkCommandBuffer commandBuffer + const VkCopyMicromapToMemoryInfoEXT* pInfo + + + VkResult vkCopyMicromapToMemoryEXT + VkDevice device + VkDeferredOperationKHR deferredOperation + const VkCopyMicromapToMemoryInfoEXT* pInfo + + + void vkCmdCopyMemoryToMicromapEXT + VkCommandBuffer commandBuffer + const VkCopyMemoryToMicromapInfoEXT* pInfo + + + VkResult vkCopyMemoryToMicromapEXT + VkDevice device + VkDeferredOperationKHR deferredOperation + const VkCopyMemoryToMicromapInfoEXT* pInfo + + + void vkCmdWriteMicromapsPropertiesEXT + VkCommandBuffer commandBuffer + uint32_t micromapCount + const VkMicromapEXT* pMicromaps + VkQueryType queryType + VkQueryPool queryPool + uint32_t firstQuery + + + VkResult vkWriteMicromapsPropertiesEXT + VkDevice device + uint32_t micromapCount + const VkMicromapEXT* pMicromaps + VkQueryType queryType + size_t dataSize + void* pData + size_t stride + + + void vkGetDeviceMicromapCompatibilityEXT + VkDevice device + const VkMicromapVersionInfoEXT* pVersionInfo + VkAccelerationStructureCompatibilityKHR* pCompatibility + + + void vkGetMicromapBuildSizesEXT + VkDevice device + VkAccelerationStructureBuildTypeKHR buildType + const VkMicromapBuildInfoEXT* pBuildInfo + VkMicromapBuildSizesInfoEXT* pSizeInfo + + + void vkGetShaderModuleIdentifierEXT + VkDevice device + VkShaderModule shaderModule + VkShaderModuleIdentifierEXT* pIdentifier + + + void vkGetShaderModuleCreateInfoIdentifierEXT + VkDevice device + const VkShaderModuleCreateInfo* pCreateInfo + VkShaderModuleIdentifierEXT* pIdentifier + + + void vkGetImageSubresourceLayout2KHR + VkDevice device + VkImage image + const VkImageSubresource2KHR* pSubresource + VkSubresourceLayout2KHR* pLayout + + + + VkResult vkGetPipelinePropertiesEXT + VkDevice device + const VkPipelineInfoEXT* pPipelineInfo + VkBaseOutStructure* pPipelineProperties + + + void vkExportMetalObjectsEXT + VkDevice device + VkExportMetalObjectsInfoEXT* pMetalObjectsInfo + + + VkResult vkGetFramebufferTilePropertiesQCOM + VkDevice device + VkFramebuffer framebuffer + uint32_t* pPropertiesCount + VkTilePropertiesQCOM* pProperties + + + VkResult vkGetDynamicRenderingTilePropertiesQCOM + VkDevice device + const VkRenderingInfo* pRenderingInfo + VkTilePropertiesQCOM* pProperties + + + VkResult vkGetPhysicalDeviceOpticalFlowImageFormatsNV + VkPhysicalDevice physicalDevice + const VkOpticalFlowImageFormatInfoNV* pOpticalFlowImageFormatInfo + uint32_t* pFormatCount + VkOpticalFlowImageFormatPropertiesNV* pImageFormatProperties + + + VkResult vkCreateOpticalFlowSessionNV + VkDevice device + const VkOpticalFlowSessionCreateInfoNV* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkOpticalFlowSessionNV* pSession + + + void vkDestroyOpticalFlowSessionNV + VkDevice device + VkOpticalFlowSessionNV session + const VkAllocationCallbacks* pAllocator + + + VkResult vkBindOpticalFlowSessionImageNV + VkDevice device + VkOpticalFlowSessionNV session + VkOpticalFlowSessionBindingPointNV bindingPoint + VkImageView view + VkImageLayout layout + + + void vkCmdOpticalFlowExecuteNV + VkCommandBuffer commandBuffer + VkOpticalFlowSessionNV session + const VkOpticalFlowExecuteInfoNV* pExecuteInfo + + + VkResult vkGetDeviceFaultInfoEXT + VkDevice device + VkDeviceFaultCountsEXT* pFaultCounts + VkDeviceFaultInfoEXT* pFaultInfo + + + void vkCmdSetDepthBias2EXT + VkCommandBuffer commandBuffer + const VkDepthBiasInfoEXT* pDepthBiasInfo + + + VkResult vkReleaseSwapchainImagesEXT + VkDevice device + const VkReleaseSwapchainImagesInfoEXT* pReleaseInfo + + + void vkGetDeviceImageSubresourceLayoutKHR + VkDevice device + const VkDeviceImageSubresourceInfoKHR* pInfo + VkSubresourceLayout2KHR* pLayout + + + VkResult vkMapMemory2KHR + VkDevice device + const VkMemoryMapInfoKHR* pMemoryMapInfo + void** ppData + + + VkResult vkUnmapMemory2KHR + VkDevice device + const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo + + + VkResult vkCreateShadersEXT + VkDevice device + uint32_t createInfoCount + const VkShaderCreateInfoEXT* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkShaderEXT* pShaders + + + void vkDestroyShaderEXT + VkDevice device + VkShaderEXT shader + const VkAllocationCallbacks* pAllocator + + + VkResult vkGetShaderBinaryDataEXT + VkDevice device + VkShaderEXT shader + size_t* pDataSize + void* pData + + + void vkCmdBindShadersEXT + VkCommandBuffer commandBuffer + uint32_t stageCount + const VkShaderStageFlagBits* pStages + const VkShaderEXT* pShaders + + + VkResult vkGetScreenBufferPropertiesQNX + VkDevice device + const struct _screen_buffer* buffer + VkScreenBufferPropertiesQNX* pProperties + + + VkResult vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR + VkPhysicalDevice physicalDevice + uint32_t* pPropertyCount + VkCooperativeMatrixPropertiesKHR* pProperties + + + VkResult vkGetExecutionGraphPipelineScratchSizeAMDX + VkDevice device + VkPipeline executionGraph + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo + + + VkResult vkGetExecutionGraphPipelineNodeIndexAMDX + VkDevice device + VkPipeline executionGraph + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo + uint32_t* pNodeIndex + + + VkResult vkCreateExecutionGraphPipelinesAMDX + VkDevice device + VkPipelineCache pipelineCache + uint32_t createInfoCount + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos + const VkAllocationCallbacks* pAllocator + VkPipeline* pPipelines + + + void vkCmdInitializeGraphScratchMemoryAMDX + VkCommandBuffer commandBuffer + VkDeviceAddress scratch + + + void vkCmdDispatchGraphAMDX + VkCommandBuffer commandBuffer + VkDeviceAddress scratch + const VkDispatchGraphCountInfoAMDX* pCountInfo + + + void vkCmdDispatchGraphIndirectAMDX + VkCommandBuffer commandBuffer + VkDeviceAddress scratch + const VkDispatchGraphCountInfoAMDX* pCountInfo + + + void vkCmdDispatchGraphIndirectCountAMDX + VkCommandBuffer commandBuffer + VkDeviceAddress scratch + VkDeviceAddress countInfo + + + VkResult vkSetLatencySleepModeNV + VkDevice device + VkSwapchainKHR swapchain + const VkLatencySleepModeInfoNV* pSleepModeInfo + + + VkResult vkLatencySleepNV + VkDevice device + VkSwapchainKHR swapchain + const VkLatencySleepInfoNV* pSleepInfo + + + void vkSetLatencyMarkerNV + VkDevice device + VkSwapchainKHR swapchain + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo + + + void vkGetLatencyTimingsNV + VkDevice device + VkSwapchainKHR swapchain + uint32_t* pTimingCount + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo + + + void vkQueueNotifyOutOfBandNV + VkQueue queue + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + offset 1 reserved for the old VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX enum + offset 2 reserved for the old VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX enum + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Additional dependent types / tokens extending enumerants, not explicitly mentioned + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Additional dependent types / tokens extending enumerants, not explicitly mentioned + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This duplicates definitions in VK_KHR_device_group below + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VK_ANDROID_native_buffer is used between the Android Vulkan loader and drivers to implement the WSI extensions. It is not exposed to applications and uses types that are not part of Android's stable public API, so it is left disabled to keep it out of the standard Vulkan headers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This duplicates definitions in other extensions, below + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enum offset=0 was mistakenly used for the 1.1 core enum + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES + (value=1000094000). Fortunately, no conflict resulted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This extension requires buffer_device_address functionality. + VK_EXT_buffer_device_address is also acceptable, but since it is deprecated the KHR version is preferred. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These enums are present only to inform downstream + consumers like KTX2. There is no actual Vulkan extension + corresponding to the enums. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT and + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT + were not promoted to Vulkan 1.3. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VkPhysicalDevice4444FormatsFeaturesEXT and + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT + were not promoted to Vulkan 1.3. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NV internal use only + + + + + + + + + + + + + + + + + + + + + + + + + + NV internal use only + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fragment shader stage is added by the VK_EXT_shader_tile_image extension + + + + + + + Fragment shader stage is added by the VK_EXT_shader_tile_image extension + + + + + + + + + + + + + + + + + + + TODO/Suggestion. Introduce 'synclist' (could be a different name) element + that specifies the list of stages, accesses, etc. This list can be used by + 'syncaccess' or 'syncstage' elements. For example, 'syncsupport' in addition to the + 'stage' attribute can support 'list' attribute to reference 'synclist'. + We can have the lists defined for ALL stages and it can be shared between MEMORY_READ + and MEMORY_WRITE accesses. Similarly, ALL shader stages list is often used. This proposal + is a way to fix duplication problem. When new stage is added multiple places needs to be + updated. It is potential source of bugs. The expectation such setup will produce more + robust system and also more simple structure to review and validate. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT + VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT + VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT + VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT + VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT + VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT + VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT + VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT + VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR + VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT + VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT + VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT + VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT + VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT + VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT + + + VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT + VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT + VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT + VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR + VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT + VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT + VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT + VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT + VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT + VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT + + + VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT + VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT + VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT + + + VK_PIPELINE_STAGE_2_TRANSFER_BIT + + + VK_PIPELINE_STAGE_2_HOST_BIT + + + VK_PIPELINE_STAGE_2_SUBPASS_SHADER_BIT_HUAWEI + + + VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV + + + VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR + + + VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR + + + VK_PIPELINE_STAGE_2_MICROMAP_BUILD_BIT_EXT + + + VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT + VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR + + + VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR + + + VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR + + + VK_PIPELINE_STAGE_2_OPTICAL_FLOW_BIT_NV + + + From 7a09cc54ebbf2bc4950db7832756a6fa0e6ea5ed Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 12 Dec 2022 05:35:07 +0200 Subject: [PATCH 0003/1506] winevulkan: Remove autogenerated files. Proton's build system creates them anyway. They are getting outdated pretty fast and are confusing at best. --- dlls/vulkan-1/vulkan-1.spec | 253 - dlls/winevulkan/loader_thunks.c | 6669 ----- dlls/winevulkan/loader_thunks.h | 4978 ---- dlls/winevulkan/vulkan_thunks.c | 46008 ------------------------------ dlls/winevulkan/vulkan_thunks.h | 1186 - dlls/winevulkan/winevulkan.json | 7 - dlls/winevulkan/winevulkan.spec | 258 - include/wine/vulkan.h | 13855 --------- include/wine/vulkan_driver.h | 116 - 9 files changed, 73330 deletions(-) delete mode 100644 dlls/vulkan-1/vulkan-1.spec delete mode 100644 dlls/winevulkan/loader_thunks.c delete mode 100644 dlls/winevulkan/loader_thunks.h delete mode 100644 dlls/winevulkan/vulkan_thunks.c delete mode 100644 dlls/winevulkan/vulkan_thunks.h delete mode 100644 dlls/winevulkan/winevulkan.json delete mode 100644 dlls/winevulkan/winevulkan.spec delete mode 100644 include/wine/vulkan.h delete mode 100644 include/wine/vulkan_driver.h diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec deleted file mode 100644 index 48ff2af3126..00000000000 --- a/dlls/vulkan-1/vulkan-1.spec +++ /dev/null @@ -1,253 +0,0 @@ -# Automatically generated from Vulkan vk.xml; DO NOT EDIT! -# -# This file is generated from Vulkan vk.xml file covered -# by the following copyright and permission notice: -# -# Copyright 2015-2023 The Khronos Group Inc. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# - -@ stdcall vkAcquireNextImage2KHR(ptr ptr ptr) winevulkan.vkAcquireNextImage2KHR -@ stdcall vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr) winevulkan.vkAcquireNextImageKHR -@ stdcall vkAllocateCommandBuffers(ptr ptr ptr) winevulkan.vkAllocateCommandBuffers -@ stdcall vkAllocateDescriptorSets(ptr ptr ptr) winevulkan.vkAllocateDescriptorSets -@ stdcall vkAllocateMemory(ptr ptr ptr ptr) winevulkan.vkAllocateMemory -@ stdcall vkBeginCommandBuffer(ptr ptr) winevulkan.vkBeginCommandBuffer -@ stdcall vkBindBufferMemory(ptr int64 int64 int64) winevulkan.vkBindBufferMemory -@ stdcall vkBindBufferMemory2(ptr long ptr) winevulkan.vkBindBufferMemory2 -@ stdcall vkBindImageMemory(ptr int64 int64 int64) winevulkan.vkBindImageMemory -@ stdcall vkBindImageMemory2(ptr long ptr) winevulkan.vkBindImageMemory2 -@ stdcall vkCmdBeginQuery(ptr int64 long long) winevulkan.vkCmdBeginQuery -@ stdcall vkCmdBeginRenderPass(ptr ptr long) winevulkan.vkCmdBeginRenderPass -@ stdcall vkCmdBeginRenderPass2(ptr ptr ptr) winevulkan.vkCmdBeginRenderPass2 -@ stdcall vkCmdBeginRendering(ptr ptr) winevulkan.vkCmdBeginRendering -@ stdcall vkCmdBindDescriptorSets(ptr long int64 long long ptr long ptr) winevulkan.vkCmdBindDescriptorSets -@ stdcall vkCmdBindIndexBuffer(ptr int64 int64 long) winevulkan.vkCmdBindIndexBuffer -@ stdcall vkCmdBindPipeline(ptr long int64) winevulkan.vkCmdBindPipeline -@ stdcall vkCmdBindVertexBuffers(ptr long long ptr ptr) winevulkan.vkCmdBindVertexBuffers -@ stdcall vkCmdBindVertexBuffers2(ptr long long ptr ptr ptr ptr) winevulkan.vkCmdBindVertexBuffers2 -@ stdcall vkCmdBlitImage(ptr int64 long int64 long long ptr long) winevulkan.vkCmdBlitImage -@ stdcall vkCmdBlitImage2(ptr ptr) winevulkan.vkCmdBlitImage2 -@ stdcall vkCmdClearAttachments(ptr long ptr long ptr) winevulkan.vkCmdClearAttachments -@ stdcall vkCmdClearColorImage(ptr int64 long ptr long ptr) winevulkan.vkCmdClearColorImage -@ stdcall vkCmdClearDepthStencilImage(ptr int64 long ptr long ptr) winevulkan.vkCmdClearDepthStencilImage -@ stdcall vkCmdCopyBuffer(ptr int64 int64 long ptr) winevulkan.vkCmdCopyBuffer -@ stdcall vkCmdCopyBuffer2(ptr ptr) winevulkan.vkCmdCopyBuffer2 -@ stdcall vkCmdCopyBufferToImage(ptr int64 int64 long long ptr) winevulkan.vkCmdCopyBufferToImage -@ stdcall vkCmdCopyBufferToImage2(ptr ptr) winevulkan.vkCmdCopyBufferToImage2 -@ stdcall vkCmdCopyImage(ptr int64 long int64 long long ptr) winevulkan.vkCmdCopyImage -@ stdcall vkCmdCopyImage2(ptr ptr) winevulkan.vkCmdCopyImage2 -@ stdcall vkCmdCopyImageToBuffer(ptr int64 long int64 long ptr) winevulkan.vkCmdCopyImageToBuffer -@ stdcall vkCmdCopyImageToBuffer2(ptr ptr) winevulkan.vkCmdCopyImageToBuffer2 -@ stdcall vkCmdCopyQueryPoolResults(ptr int64 long long int64 int64 int64 long) winevulkan.vkCmdCopyQueryPoolResults -@ stdcall vkCmdDispatch(ptr long long long) winevulkan.vkCmdDispatch -@ stdcall vkCmdDispatchBase(ptr long long long long long long) winevulkan.vkCmdDispatchBase -@ stdcall vkCmdDispatchIndirect(ptr int64 int64) winevulkan.vkCmdDispatchIndirect -@ stdcall vkCmdDraw(ptr long long long long) winevulkan.vkCmdDraw -@ stdcall vkCmdDrawIndexed(ptr long long long long long) winevulkan.vkCmdDrawIndexed -@ stdcall vkCmdDrawIndexedIndirect(ptr int64 int64 long long) winevulkan.vkCmdDrawIndexedIndirect -@ stdcall vkCmdDrawIndexedIndirectCount(ptr int64 int64 int64 int64 long long) winevulkan.vkCmdDrawIndexedIndirectCount -@ stdcall vkCmdDrawIndirect(ptr int64 int64 long long) winevulkan.vkCmdDrawIndirect -@ stdcall vkCmdDrawIndirectCount(ptr int64 int64 int64 int64 long long) winevulkan.vkCmdDrawIndirectCount -@ stdcall vkCmdEndQuery(ptr int64 long) winevulkan.vkCmdEndQuery -@ stdcall vkCmdEndRenderPass(ptr) winevulkan.vkCmdEndRenderPass -@ stdcall vkCmdEndRenderPass2(ptr ptr) winevulkan.vkCmdEndRenderPass2 -@ stdcall vkCmdEndRendering(ptr) winevulkan.vkCmdEndRendering -@ stdcall vkCmdExecuteCommands(ptr long ptr) winevulkan.vkCmdExecuteCommands -@ stdcall vkCmdFillBuffer(ptr int64 int64 int64 long) winevulkan.vkCmdFillBuffer -@ stdcall vkCmdNextSubpass(ptr long) winevulkan.vkCmdNextSubpass -@ stdcall vkCmdNextSubpass2(ptr ptr ptr) winevulkan.vkCmdNextSubpass2 -@ stdcall vkCmdPipelineBarrier(ptr long long long long ptr long ptr long ptr) winevulkan.vkCmdPipelineBarrier -@ stdcall vkCmdPipelineBarrier2(ptr ptr) winevulkan.vkCmdPipelineBarrier2 -@ stdcall vkCmdPushConstants(ptr int64 long long long ptr) winevulkan.vkCmdPushConstants -@ stdcall vkCmdResetEvent(ptr int64 long) winevulkan.vkCmdResetEvent -@ stdcall vkCmdResetEvent2(ptr int64 int64) winevulkan.vkCmdResetEvent2 -@ stdcall vkCmdResetQueryPool(ptr int64 long long) winevulkan.vkCmdResetQueryPool -@ stdcall vkCmdResolveImage(ptr int64 long int64 long long ptr) winevulkan.vkCmdResolveImage -@ stdcall vkCmdResolveImage2(ptr ptr) winevulkan.vkCmdResolveImage2 -@ stdcall vkCmdSetBlendConstants(ptr ptr) winevulkan.vkCmdSetBlendConstants -@ stdcall vkCmdSetCullMode(ptr long) winevulkan.vkCmdSetCullMode -@ stdcall vkCmdSetDepthBias(ptr float float float) winevulkan.vkCmdSetDepthBias -@ stdcall vkCmdSetDepthBiasEnable(ptr long) winevulkan.vkCmdSetDepthBiasEnable -@ stdcall vkCmdSetDepthBounds(ptr float float) winevulkan.vkCmdSetDepthBounds -@ stdcall vkCmdSetDepthBoundsTestEnable(ptr long) winevulkan.vkCmdSetDepthBoundsTestEnable -@ stdcall vkCmdSetDepthCompareOp(ptr long) winevulkan.vkCmdSetDepthCompareOp -@ stdcall vkCmdSetDepthTestEnable(ptr long) winevulkan.vkCmdSetDepthTestEnable -@ stdcall vkCmdSetDepthWriteEnable(ptr long) winevulkan.vkCmdSetDepthWriteEnable -@ stdcall vkCmdSetDeviceMask(ptr long) winevulkan.vkCmdSetDeviceMask -@ stdcall vkCmdSetEvent(ptr int64 long) winevulkan.vkCmdSetEvent -@ stdcall vkCmdSetEvent2(ptr int64 ptr) winevulkan.vkCmdSetEvent2 -@ stdcall vkCmdSetFrontFace(ptr long) winevulkan.vkCmdSetFrontFace -@ stdcall vkCmdSetLineWidth(ptr float) winevulkan.vkCmdSetLineWidth -@ stdcall vkCmdSetPrimitiveRestartEnable(ptr long) winevulkan.vkCmdSetPrimitiveRestartEnable -@ stdcall vkCmdSetPrimitiveTopology(ptr long) winevulkan.vkCmdSetPrimitiveTopology -@ stdcall vkCmdSetRasterizerDiscardEnable(ptr long) winevulkan.vkCmdSetRasterizerDiscardEnable -@ stdcall vkCmdSetScissor(ptr long long ptr) winevulkan.vkCmdSetScissor -@ stdcall vkCmdSetScissorWithCount(ptr long ptr) winevulkan.vkCmdSetScissorWithCount -@ stdcall vkCmdSetStencilCompareMask(ptr long long) winevulkan.vkCmdSetStencilCompareMask -@ stdcall vkCmdSetStencilOp(ptr long long long long long) winevulkan.vkCmdSetStencilOp -@ stdcall vkCmdSetStencilReference(ptr long long) winevulkan.vkCmdSetStencilReference -@ stdcall vkCmdSetStencilTestEnable(ptr long) winevulkan.vkCmdSetStencilTestEnable -@ stdcall vkCmdSetStencilWriteMask(ptr long long) winevulkan.vkCmdSetStencilWriteMask -@ stdcall vkCmdSetViewport(ptr long long ptr) winevulkan.vkCmdSetViewport -@ stdcall vkCmdSetViewportWithCount(ptr long ptr) winevulkan.vkCmdSetViewportWithCount -@ stdcall vkCmdUpdateBuffer(ptr int64 int64 int64 ptr) winevulkan.vkCmdUpdateBuffer -@ stdcall vkCmdWaitEvents(ptr long ptr long long long ptr long ptr long ptr) winevulkan.vkCmdWaitEvents -@ stdcall vkCmdWaitEvents2(ptr long ptr ptr) winevulkan.vkCmdWaitEvents2 -@ stdcall vkCmdWriteTimestamp(ptr long int64 long) winevulkan.vkCmdWriteTimestamp -@ stdcall vkCmdWriteTimestamp2(ptr int64 int64 long) winevulkan.vkCmdWriteTimestamp2 -@ stdcall vkCreateBuffer(ptr ptr ptr ptr) winevulkan.vkCreateBuffer -@ stdcall vkCreateBufferView(ptr ptr ptr ptr) winevulkan.vkCreateBufferView -@ stdcall vkCreateCommandPool(ptr ptr ptr ptr) winevulkan.vkCreateCommandPool -@ stdcall vkCreateComputePipelines(ptr int64 long ptr ptr ptr) winevulkan.vkCreateComputePipelines -@ stdcall vkCreateDescriptorPool(ptr ptr ptr ptr) winevulkan.vkCreateDescriptorPool -@ stdcall vkCreateDescriptorSetLayout(ptr ptr ptr ptr) winevulkan.vkCreateDescriptorSetLayout -@ stdcall vkCreateDescriptorUpdateTemplate(ptr ptr ptr ptr) winevulkan.vkCreateDescriptorUpdateTemplate -@ stdcall vkCreateDevice(ptr ptr ptr ptr) winevulkan.vkCreateDevice -@ stub vkCreateDisplayModeKHR -@ stub vkCreateDisplayPlaneSurfaceKHR -@ stdcall vkCreateEvent(ptr ptr ptr ptr) winevulkan.vkCreateEvent -@ stdcall vkCreateFence(ptr ptr ptr ptr) winevulkan.vkCreateFence -@ stdcall vkCreateFramebuffer(ptr ptr ptr ptr) winevulkan.vkCreateFramebuffer -@ stdcall vkCreateGraphicsPipelines(ptr int64 long ptr ptr ptr) winevulkan.vkCreateGraphicsPipelines -@ stdcall vkCreateImage(ptr ptr ptr ptr) winevulkan.vkCreateImage -@ stdcall vkCreateImageView(ptr ptr ptr ptr) winevulkan.vkCreateImageView -@ stdcall vkCreateInstance(ptr ptr ptr) winevulkan.vkCreateInstance -@ stdcall vkCreatePipelineCache(ptr ptr ptr ptr) winevulkan.vkCreatePipelineCache -@ stdcall vkCreatePipelineLayout(ptr ptr ptr ptr) winevulkan.vkCreatePipelineLayout -@ stdcall vkCreatePrivateDataSlot(ptr ptr ptr ptr) winevulkan.vkCreatePrivateDataSlot -@ stdcall vkCreateQueryPool(ptr ptr ptr ptr) winevulkan.vkCreateQueryPool -@ stdcall vkCreateRenderPass(ptr ptr ptr ptr) winevulkan.vkCreateRenderPass -@ stdcall vkCreateRenderPass2(ptr ptr ptr ptr) winevulkan.vkCreateRenderPass2 -@ stdcall vkCreateSampler(ptr ptr ptr ptr) winevulkan.vkCreateSampler -@ stdcall vkCreateSamplerYcbcrConversion(ptr ptr ptr ptr) winevulkan.vkCreateSamplerYcbcrConversion -@ stdcall vkCreateSemaphore(ptr ptr ptr ptr) winevulkan.vkCreateSemaphore -@ stdcall vkCreateShaderModule(ptr ptr ptr ptr) winevulkan.vkCreateShaderModule -@ stub vkCreateSharedSwapchainsKHR -@ stdcall vkCreateSwapchainKHR(ptr ptr ptr ptr) winevulkan.vkCreateSwapchainKHR -@ stdcall vkCreateWin32SurfaceKHR(ptr ptr ptr ptr) winevulkan.vkCreateWin32SurfaceKHR -@ stdcall vkDestroyBuffer(ptr int64 ptr) winevulkan.vkDestroyBuffer -@ stdcall vkDestroyBufferView(ptr int64 ptr) winevulkan.vkDestroyBufferView -@ stdcall vkDestroyCommandPool(ptr int64 ptr) winevulkan.vkDestroyCommandPool -@ stdcall vkDestroyDescriptorPool(ptr int64 ptr) winevulkan.vkDestroyDescriptorPool -@ stdcall vkDestroyDescriptorSetLayout(ptr int64 ptr) winevulkan.vkDestroyDescriptorSetLayout -@ stdcall vkDestroyDescriptorUpdateTemplate(ptr int64 ptr) winevulkan.vkDestroyDescriptorUpdateTemplate -@ stdcall vkDestroyDevice(ptr ptr) winevulkan.vkDestroyDevice -@ stdcall vkDestroyEvent(ptr int64 ptr) winevulkan.vkDestroyEvent -@ stdcall vkDestroyFence(ptr int64 ptr) winevulkan.vkDestroyFence -@ stdcall vkDestroyFramebuffer(ptr int64 ptr) winevulkan.vkDestroyFramebuffer -@ stdcall vkDestroyImage(ptr int64 ptr) winevulkan.vkDestroyImage -@ stdcall vkDestroyImageView(ptr int64 ptr) winevulkan.vkDestroyImageView -@ stdcall vkDestroyInstance(ptr ptr) winevulkan.vkDestroyInstance -@ stdcall vkDestroyPipeline(ptr int64 ptr) winevulkan.vkDestroyPipeline -@ stdcall vkDestroyPipelineCache(ptr int64 ptr) winevulkan.vkDestroyPipelineCache -@ stdcall vkDestroyPipelineLayout(ptr int64 ptr) winevulkan.vkDestroyPipelineLayout -@ stdcall vkDestroyPrivateDataSlot(ptr int64 ptr) winevulkan.vkDestroyPrivateDataSlot -@ stdcall vkDestroyQueryPool(ptr int64 ptr) winevulkan.vkDestroyQueryPool -@ stdcall vkDestroyRenderPass(ptr int64 ptr) winevulkan.vkDestroyRenderPass -@ stdcall vkDestroySampler(ptr int64 ptr) winevulkan.vkDestroySampler -@ stdcall vkDestroySamplerYcbcrConversion(ptr int64 ptr) winevulkan.vkDestroySamplerYcbcrConversion -@ stdcall vkDestroySemaphore(ptr int64 ptr) winevulkan.vkDestroySemaphore -@ stdcall vkDestroyShaderModule(ptr int64 ptr) winevulkan.vkDestroyShaderModule -@ stdcall vkDestroySurfaceKHR(ptr int64 ptr) winevulkan.vkDestroySurfaceKHR -@ stdcall vkDestroySwapchainKHR(ptr int64 ptr) winevulkan.vkDestroySwapchainKHR -@ stdcall vkDeviceWaitIdle(ptr) winevulkan.vkDeviceWaitIdle -@ stdcall vkEndCommandBuffer(ptr) winevulkan.vkEndCommandBuffer -@ stdcall vkEnumerateDeviceExtensionProperties(ptr str ptr ptr) winevulkan.vkEnumerateDeviceExtensionProperties -@ stdcall vkEnumerateDeviceLayerProperties(ptr ptr ptr) winevulkan.vkEnumerateDeviceLayerProperties -@ stdcall vkEnumerateInstanceExtensionProperties(str ptr ptr) winevulkan.vkEnumerateInstanceExtensionProperties -@ stdcall vkEnumerateInstanceLayerProperties(ptr ptr) winevulkan.vkEnumerateInstanceLayerProperties -@ stdcall vkEnumerateInstanceVersion(ptr) winevulkan.vkEnumerateInstanceVersion -@ stdcall vkEnumeratePhysicalDeviceGroups(ptr ptr ptr) winevulkan.vkEnumeratePhysicalDeviceGroups -@ stdcall vkEnumeratePhysicalDevices(ptr ptr ptr) winevulkan.vkEnumeratePhysicalDevices -@ stdcall vkFlushMappedMemoryRanges(ptr long ptr) winevulkan.vkFlushMappedMemoryRanges -@ stdcall vkFreeCommandBuffers(ptr int64 long ptr) winevulkan.vkFreeCommandBuffers -@ stdcall vkFreeDescriptorSets(ptr int64 long ptr) winevulkan.vkFreeDescriptorSets -@ stdcall vkFreeMemory(ptr int64 ptr) winevulkan.vkFreeMemory -@ stdcall vkGetBufferDeviceAddress(ptr ptr) winevulkan.vkGetBufferDeviceAddress -@ stdcall vkGetBufferMemoryRequirements(ptr int64 ptr) winevulkan.vkGetBufferMemoryRequirements -@ stdcall vkGetBufferMemoryRequirements2(ptr ptr ptr) winevulkan.vkGetBufferMemoryRequirements2 -@ stdcall vkGetBufferOpaqueCaptureAddress(ptr ptr) winevulkan.vkGetBufferOpaqueCaptureAddress -@ stub vkGetCommandPoolMemoryConsumption -@ stdcall vkGetDescriptorSetLayoutSupport(ptr ptr ptr) winevulkan.vkGetDescriptorSetLayoutSupport -@ stdcall vkGetDeviceBufferMemoryRequirements(ptr ptr ptr) winevulkan.vkGetDeviceBufferMemoryRequirements -@ stdcall vkGetDeviceGroupPeerMemoryFeatures(ptr long long long ptr) winevulkan.vkGetDeviceGroupPeerMemoryFeatures -@ stdcall vkGetDeviceGroupPresentCapabilitiesKHR(ptr ptr) winevulkan.vkGetDeviceGroupPresentCapabilitiesKHR -@ stdcall vkGetDeviceGroupSurfacePresentModesKHR(ptr int64 ptr) winevulkan.vkGetDeviceGroupSurfacePresentModesKHR -@ stdcall vkGetDeviceImageMemoryRequirements(ptr ptr ptr) winevulkan.vkGetDeviceImageMemoryRequirements -@ stdcall vkGetDeviceImageSparseMemoryRequirements(ptr ptr ptr ptr) winevulkan.vkGetDeviceImageSparseMemoryRequirements -@ stdcall vkGetDeviceMemoryCommitment(ptr int64 ptr) winevulkan.vkGetDeviceMemoryCommitment -@ stdcall vkGetDeviceMemoryOpaqueCaptureAddress(ptr ptr) winevulkan.vkGetDeviceMemoryOpaqueCaptureAddress -@ stdcall vkGetDeviceProcAddr(ptr str) winevulkan.vkGetDeviceProcAddr -@ stdcall vkGetDeviceQueue(ptr long long ptr) winevulkan.vkGetDeviceQueue -@ stdcall vkGetDeviceQueue2(ptr ptr ptr) winevulkan.vkGetDeviceQueue2 -@ stub vkGetDisplayModePropertiesKHR -@ stub vkGetDisplayPlaneCapabilitiesKHR -@ stub vkGetDisplayPlaneSupportedDisplaysKHR -@ stdcall vkGetEventStatus(ptr int64) winevulkan.vkGetEventStatus -@ stub vkGetFaultData -@ stdcall vkGetFenceStatus(ptr int64) winevulkan.vkGetFenceStatus -@ stdcall vkGetImageMemoryRequirements(ptr int64 ptr) winevulkan.vkGetImageMemoryRequirements -@ stdcall vkGetImageMemoryRequirements2(ptr ptr ptr) winevulkan.vkGetImageMemoryRequirements2 -@ stdcall vkGetImageSparseMemoryRequirements(ptr int64 ptr ptr) winevulkan.vkGetImageSparseMemoryRequirements -@ stdcall vkGetImageSparseMemoryRequirements2(ptr ptr ptr ptr) winevulkan.vkGetImageSparseMemoryRequirements2 -@ stdcall vkGetImageSubresourceLayout(ptr int64 ptr ptr) winevulkan.vkGetImageSubresourceLayout -@ stdcall vkGetInstanceProcAddr(ptr str) winevulkan.vkGetInstanceProcAddr -@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR -@ stub vkGetPhysicalDeviceDisplayPropertiesKHR -@ stdcall vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceExternalBufferProperties -@ stdcall vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceExternalFenceProperties -@ stdcall vkGetPhysicalDeviceExternalSemaphoreProperties(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceExternalSemaphoreProperties -@ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) winevulkan.vkGetPhysicalDeviceFeatures -@ stdcall vkGetPhysicalDeviceFeatures2(ptr ptr) winevulkan.vkGetPhysicalDeviceFeatures2 -@ stdcall vkGetPhysicalDeviceFormatProperties(ptr long ptr) winevulkan.vkGetPhysicalDeviceFormatProperties -@ stdcall vkGetPhysicalDeviceFormatProperties2(ptr long ptr) winevulkan.vkGetPhysicalDeviceFormatProperties2 -@ stdcall vkGetPhysicalDeviceImageFormatProperties(ptr long long long long long ptr) winevulkan.vkGetPhysicalDeviceImageFormatProperties -@ stdcall vkGetPhysicalDeviceImageFormatProperties2(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceImageFormatProperties2 -@ stdcall vkGetPhysicalDeviceMemoryProperties(ptr ptr) winevulkan.vkGetPhysicalDeviceMemoryProperties -@ stdcall vkGetPhysicalDeviceMemoryProperties2(ptr ptr) winevulkan.vkGetPhysicalDeviceMemoryProperties2 -@ stdcall vkGetPhysicalDevicePresentRectanglesKHR(ptr int64 ptr ptr) winevulkan.vkGetPhysicalDevicePresentRectanglesKHR -@ stdcall vkGetPhysicalDeviceProperties(ptr ptr) winevulkan.vkGetPhysicalDeviceProperties -@ stdcall vkGetPhysicalDeviceProperties2(ptr ptr) winevulkan.vkGetPhysicalDeviceProperties2 -@ stdcall vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceQueueFamilyProperties -@ stdcall vkGetPhysicalDeviceQueueFamilyProperties2(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceQueueFamilyProperties2 -@ stdcall vkGetPhysicalDeviceSparseImageFormatProperties(ptr long long long long long ptr ptr) winevulkan.vkGetPhysicalDeviceSparseImageFormatProperties -@ stdcall vkGetPhysicalDeviceSparseImageFormatProperties2(ptr ptr ptr ptr) winevulkan.vkGetPhysicalDeviceSparseImageFormatProperties2 -@ stdcall vkGetPhysicalDeviceSurfaceCapabilities2KHR(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceSurfaceCapabilities2KHR -@ stdcall vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr int64 ptr) winevulkan.vkGetPhysicalDeviceSurfaceCapabilitiesKHR -@ stdcall vkGetPhysicalDeviceSurfaceFormats2KHR(ptr ptr ptr ptr) winevulkan.vkGetPhysicalDeviceSurfaceFormats2KHR -@ stdcall vkGetPhysicalDeviceSurfaceFormatsKHR(ptr int64 ptr ptr) winevulkan.vkGetPhysicalDeviceSurfaceFormatsKHR -@ stdcall vkGetPhysicalDeviceSurfacePresentModesKHR(ptr int64 ptr ptr) winevulkan.vkGetPhysicalDeviceSurfacePresentModesKHR -@ stdcall vkGetPhysicalDeviceSurfaceSupportKHR(ptr long int64 ptr) winevulkan.vkGetPhysicalDeviceSurfaceSupportKHR -@ stdcall vkGetPhysicalDeviceToolProperties(ptr ptr ptr) winevulkan.vkGetPhysicalDeviceToolProperties -@ stdcall vkGetPhysicalDeviceWin32PresentationSupportKHR(ptr long) winevulkan.vkGetPhysicalDeviceWin32PresentationSupportKHR -@ stdcall vkGetPipelineCacheData(ptr int64 ptr ptr) winevulkan.vkGetPipelineCacheData -@ stdcall vkGetPrivateData(ptr long int64 int64 ptr) winevulkan.vkGetPrivateData -@ stdcall vkGetQueryPoolResults(ptr int64 long long long ptr int64 long) winevulkan.vkGetQueryPoolResults -@ stdcall vkGetRenderAreaGranularity(ptr int64 ptr) winevulkan.vkGetRenderAreaGranularity -@ stdcall vkGetSemaphoreCounterValue(ptr int64 ptr) winevulkan.vkGetSemaphoreCounterValue -@ stdcall vkGetSwapchainImagesKHR(ptr int64 ptr ptr) winevulkan.vkGetSwapchainImagesKHR -@ stdcall vkInvalidateMappedMemoryRanges(ptr long ptr) winevulkan.vkInvalidateMappedMemoryRanges -@ stdcall vkMapMemory(ptr int64 int64 int64 long ptr) winevulkan.vkMapMemory -@ stdcall vkMergePipelineCaches(ptr int64 long ptr) winevulkan.vkMergePipelineCaches -@ stdcall vkQueueBindSparse(ptr long ptr int64) winevulkan.vkQueueBindSparse -@ stdcall vkQueuePresentKHR(ptr ptr) winevulkan.vkQueuePresentKHR -@ stdcall vkQueueSubmit(ptr long ptr int64) winevulkan.vkQueueSubmit -@ stdcall vkQueueSubmit2(ptr long ptr int64) winevulkan.vkQueueSubmit2 -@ stdcall vkQueueWaitIdle(ptr) winevulkan.vkQueueWaitIdle -@ stdcall vkResetCommandBuffer(ptr long) winevulkan.vkResetCommandBuffer -@ stdcall vkResetCommandPool(ptr int64 long) winevulkan.vkResetCommandPool -@ stdcall vkResetDescriptorPool(ptr int64 long) winevulkan.vkResetDescriptorPool -@ stdcall vkResetEvent(ptr int64) winevulkan.vkResetEvent -@ stdcall vkResetFences(ptr long ptr) winevulkan.vkResetFences -@ stdcall vkResetQueryPool(ptr int64 long long) winevulkan.vkResetQueryPool -@ stdcall vkSetEvent(ptr int64) winevulkan.vkSetEvent -@ stdcall vkSetPrivateData(ptr long int64 int64 int64) winevulkan.vkSetPrivateData -@ stdcall vkSignalSemaphore(ptr ptr) winevulkan.vkSignalSemaphore -@ stdcall vkTrimCommandPool(ptr int64 long) winevulkan.vkTrimCommandPool -@ stdcall vkUnmapMemory(ptr int64) winevulkan.vkUnmapMemory -@ stdcall vkUpdateDescriptorSetWithTemplate(ptr int64 int64 ptr) winevulkan.vkUpdateDescriptorSetWithTemplate -@ stdcall vkUpdateDescriptorSets(ptr long ptr long ptr) winevulkan.vkUpdateDescriptorSets -@ stdcall vkWaitForFences(ptr long ptr long int64) winevulkan.vkWaitForFences -@ stdcall vkWaitSemaphores(ptr ptr int64) winevulkan.vkWaitSemaphores diff --git a/dlls/winevulkan/loader_thunks.c b/dlls/winevulkan/loader_thunks.c deleted file mode 100644 index f0f108e15f3..00000000000 --- a/dlls/winevulkan/loader_thunks.c +++ /dev/null @@ -1,6669 +0,0 @@ -/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! - * - * This file is generated from Vulkan vk.xml file covered - * by the following copyright and permission notice: - * - * Copyright 2015-2023 The Khronos Group Inc. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "vulkan_loader.h" - -WINE_DEFAULT_DEBUG_CHANNEL(vulkan); - -VkResult WINAPI vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, uint32_t *pImageIndex) -{ - struct vkAcquireNextImage2KHR_params params; - NTSTATUS status; - params.device = device; - params.pAcquireInfo = pAcquireInfo; - params.pImageIndex = pImageIndex; - status = UNIX_CALL(vkAcquireNextImage2KHR, ¶ms); - assert(!status && "vkAcquireNextImage2KHR"); - return params.result; -} - -VkResult WINAPI vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) -{ - struct vkAcquireNextImageKHR_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.timeout = timeout; - params.semaphore = semaphore; - params.fence = fence; - params.pImageIndex = pImageIndex; - status = UNIX_CALL(vkAcquireNextImageKHR, ¶ms); - assert(!status && "vkAcquireNextImageKHR"); - return params.result; -} - -VkResult WINAPI vkAcquirePerformanceConfigurationINTEL(VkDevice device, const VkPerformanceConfigurationAcquireInfoINTEL *pAcquireInfo, VkPerformanceConfigurationINTEL *pConfiguration) -{ - struct vkAcquirePerformanceConfigurationINTEL_params params; - NTSTATUS status; - params.device = device; - params.pAcquireInfo = pAcquireInfo; - params.pConfiguration = pConfiguration; - status = UNIX_CALL(vkAcquirePerformanceConfigurationINTEL, ¶ms); - assert(!status && "vkAcquirePerformanceConfigurationINTEL"); - return params.result; -} - -VkResult WINAPI vkAcquireProfilingLockKHR(VkDevice device, const VkAcquireProfilingLockInfoKHR *pInfo) -{ - struct vkAcquireProfilingLockKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkAcquireProfilingLockKHR, ¶ms); - assert(!status && "vkAcquireProfilingLockKHR"); - return params.result; -} - -VkResult WINAPI vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) -{ - struct vkAllocateDescriptorSets_params params; - NTSTATUS status; - params.device = device; - params.pAllocateInfo = pAllocateInfo; - params.pDescriptorSets = pDescriptorSets; - status = UNIX_CALL(vkAllocateDescriptorSets, ¶ms); - assert(!status && "vkAllocateDescriptorSets"); - return params.result; -} - -VkResult WINAPI vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) -{ - struct vkAllocateMemory_params params; - NTSTATUS status; - params.device = device; - params.pAllocateInfo = pAllocateInfo; - params.pAllocator = pAllocator; - params.pMemory = pMemory; - status = UNIX_CALL(vkAllocateMemory, ¶ms); - assert(!status && "vkAllocateMemory"); - return params.result; -} - -VkResult WINAPI vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) -{ - struct vkBeginCommandBuffer_params params; - NTSTATUS status; - params.commandBuffer = commandBuffer; - params.pBeginInfo = pBeginInfo; - status = UNIX_CALL(vkBeginCommandBuffer, ¶ms); - assert(!status && "vkBeginCommandBuffer"); - return params.result; -} - -VkResult WINAPI vkBindAccelerationStructureMemoryNV(VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNV *pBindInfos) -{ - struct vkBindAccelerationStructureMemoryNV_params params; - NTSTATUS status; - params.device = device; - params.bindInfoCount = bindInfoCount; - params.pBindInfos = pBindInfos; - status = UNIX_CALL(vkBindAccelerationStructureMemoryNV, ¶ms); - assert(!status && "vkBindAccelerationStructureMemoryNV"); - return params.result; -} - -VkResult WINAPI vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) -{ - struct vkBindBufferMemory_params params; - NTSTATUS status; - params.device = device; - params.buffer = buffer; - params.memory = memory; - params.memoryOffset = memoryOffset; - status = UNIX_CALL(vkBindBufferMemory, ¶ms); - assert(!status && "vkBindBufferMemory"); - return params.result; -} - -VkResult WINAPI vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos) -{ - struct vkBindBufferMemory2_params params; - NTSTATUS status; - params.device = device; - params.bindInfoCount = bindInfoCount; - params.pBindInfos = pBindInfos; - status = UNIX_CALL(vkBindBufferMemory2, ¶ms); - assert(!status && "vkBindBufferMemory2"); - return params.result; -} - -VkResult WINAPI vkBindBufferMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos) -{ - struct vkBindBufferMemory2KHR_params params; - NTSTATUS status; - params.device = device; - params.bindInfoCount = bindInfoCount; - params.pBindInfos = pBindInfos; - status = UNIX_CALL(vkBindBufferMemory2KHR, ¶ms); - assert(!status && "vkBindBufferMemory2KHR"); - return params.result; -} - -VkResult WINAPI vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) -{ - struct vkBindImageMemory_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.memory = memory; - params.memoryOffset = memoryOffset; - status = UNIX_CALL(vkBindImageMemory, ¶ms); - assert(!status && "vkBindImageMemory"); - return params.result; -} - -VkResult WINAPI vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos) -{ - struct vkBindImageMemory2_params params; - NTSTATUS status; - params.device = device; - params.bindInfoCount = bindInfoCount; - params.pBindInfos = pBindInfos; - status = UNIX_CALL(vkBindImageMemory2, ¶ms); - assert(!status && "vkBindImageMemory2"); - return params.result; -} - -VkResult WINAPI vkBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos) -{ - struct vkBindImageMemory2KHR_params params; - NTSTATUS status; - params.device = device; - params.bindInfoCount = bindInfoCount; - params.pBindInfos = pBindInfos; - status = UNIX_CALL(vkBindImageMemory2KHR, ¶ms); - assert(!status && "vkBindImageMemory2KHR"); - return params.result; -} - -VkResult WINAPI vkBindOpticalFlowSessionImageNV(VkDevice device, VkOpticalFlowSessionNV session, VkOpticalFlowSessionBindingPointNV bindingPoint, VkImageView view, VkImageLayout layout) -{ - struct vkBindOpticalFlowSessionImageNV_params params; - NTSTATUS status; - params.device = device; - params.session = session; - params.bindingPoint = bindingPoint; - params.view = view; - params.layout = layout; - status = UNIX_CALL(vkBindOpticalFlowSessionImageNV, ¶ms); - assert(!status && "vkBindOpticalFlowSessionImageNV"); - return params.result; -} - -VkResult WINAPI vkBuildAccelerationStructuresKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, const VkAccelerationStructureBuildRangeInfoKHR * const*ppBuildRangeInfos) -{ - struct vkBuildAccelerationStructuresKHR_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.infoCount = infoCount; - params.pInfos = pInfos; - params.ppBuildRangeInfos = ppBuildRangeInfos; - status = UNIX_CALL(vkBuildAccelerationStructuresKHR, ¶ms); - assert(!status && "vkBuildAccelerationStructuresKHR"); - return params.result; -} - -VkResult WINAPI vkBuildMicromapsEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkMicromapBuildInfoEXT *pInfos) -{ - struct vkBuildMicromapsEXT_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.infoCount = infoCount; - params.pInfos = pInfos; - status = UNIX_CALL(vkBuildMicromapsEXT, ¶ms); - assert(!status && "vkBuildMicromapsEXT"); - return params.result; -} - -void WINAPI vkCmdBeginConditionalRenderingEXT(VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin) -{ - struct vkCmdBeginConditionalRenderingEXT_params params; - params.commandBuffer = commandBuffer; - params.pConditionalRenderingBegin = pConditionalRenderingBegin; - UNIX_CALL(vkCmdBeginConditionalRenderingEXT, ¶ms); -} - -void WINAPI vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo) -{ - struct vkCmdBeginDebugUtilsLabelEXT_params params; - params.commandBuffer = commandBuffer; - params.pLabelInfo = pLabelInfo; - UNIX_CALL(vkCmdBeginDebugUtilsLabelEXT, ¶ms); -} - -void WINAPI vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) -{ - struct vkCmdBeginQuery_params params; - params.commandBuffer = commandBuffer; - params.queryPool = queryPool; - params.query = query; - params.flags = flags; - UNIX_CALL(vkCmdBeginQuery, ¶ms); -} - -void WINAPI vkCmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags, uint32_t index) -{ - struct vkCmdBeginQueryIndexedEXT_params params; - params.commandBuffer = commandBuffer; - params.queryPool = queryPool; - params.query = query; - params.flags = flags; - params.index = index; - UNIX_CALL(vkCmdBeginQueryIndexedEXT, ¶ms); -} - -void WINAPI vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents) -{ - struct vkCmdBeginRenderPass_params params; - params.commandBuffer = commandBuffer; - params.pRenderPassBegin = pRenderPassBegin; - params.contents = contents; - UNIX_CALL(vkCmdBeginRenderPass, ¶ms); -} - -void WINAPI vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfo *pSubpassBeginInfo) -{ - struct vkCmdBeginRenderPass2_params params; - params.commandBuffer = commandBuffer; - params.pRenderPassBegin = pRenderPassBegin; - params.pSubpassBeginInfo = pSubpassBeginInfo; - UNIX_CALL(vkCmdBeginRenderPass2, ¶ms); -} - -void WINAPI vkCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfo *pSubpassBeginInfo) -{ - struct vkCmdBeginRenderPass2KHR_params params; - params.commandBuffer = commandBuffer; - params.pRenderPassBegin = pRenderPassBegin; - params.pSubpassBeginInfo = pSubpassBeginInfo; - UNIX_CALL(vkCmdBeginRenderPass2KHR, ¶ms); -} - -void WINAPI vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRenderingInfo) -{ - struct vkCmdBeginRendering_params params; - params.commandBuffer = commandBuffer; - params.pRenderingInfo = pRenderingInfo; - UNIX_CALL(vkCmdBeginRendering, ¶ms); -} - -void WINAPI vkCmdBeginRenderingKHR(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRenderingInfo) -{ - struct vkCmdBeginRenderingKHR_params params; - params.commandBuffer = commandBuffer; - params.pRenderingInfo = pRenderingInfo; - UNIX_CALL(vkCmdBeginRenderingKHR, ¶ms); -} - -void WINAPI vkCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, const VkDeviceSize *pCounterBufferOffsets) -{ - struct vkCmdBeginTransformFeedbackEXT_params params; - params.commandBuffer = commandBuffer; - params.firstCounterBuffer = firstCounterBuffer; - params.counterBufferCount = counterBufferCount; - params.pCounterBuffers = pCounterBuffers; - params.pCounterBufferOffsets = pCounterBufferOffsets; - UNIX_CALL(vkCmdBeginTransformFeedbackEXT, ¶ms); -} - -void WINAPI vkCmdBindDescriptorBufferEmbeddedSamplersEXT(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set) -{ - struct vkCmdBindDescriptorBufferEmbeddedSamplersEXT_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.layout = layout; - params.set = set; - UNIX_CALL(vkCmdBindDescriptorBufferEmbeddedSamplersEXT, ¶ms); -} - -void WINAPI vkCmdBindDescriptorBuffersEXT(VkCommandBuffer commandBuffer, uint32_t bufferCount, const VkDescriptorBufferBindingInfoEXT *pBindingInfos) -{ - struct vkCmdBindDescriptorBuffersEXT_params params; - params.commandBuffer = commandBuffer; - params.bufferCount = bufferCount; - params.pBindingInfos = pBindingInfos; - UNIX_CALL(vkCmdBindDescriptorBuffersEXT, ¶ms); -} - -void WINAPI vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) -{ - struct vkCmdBindDescriptorSets_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.layout = layout; - params.firstSet = firstSet; - params.descriptorSetCount = descriptorSetCount; - params.pDescriptorSets = pDescriptorSets; - params.dynamicOffsetCount = dynamicOffsetCount; - params.pDynamicOffsets = pDynamicOffsets; - UNIX_CALL(vkCmdBindDescriptorSets, ¶ms); -} - -void WINAPI vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) -{ - struct vkCmdBindIndexBuffer_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.indexType = indexType; - UNIX_CALL(vkCmdBindIndexBuffer, ¶ms); -} - -void WINAPI vkCmdBindIndexBuffer2KHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType) -{ - struct vkCmdBindIndexBuffer2KHR_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.size = size; - params.indexType = indexType; - UNIX_CALL(vkCmdBindIndexBuffer2KHR, ¶ms); -} - -void WINAPI vkCmdBindInvocationMaskHUAWEI(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout) -{ - struct vkCmdBindInvocationMaskHUAWEI_params params; - params.commandBuffer = commandBuffer; - params.imageView = imageView; - params.imageLayout = imageLayout; - UNIX_CALL(vkCmdBindInvocationMaskHUAWEI, ¶ms); -} - -void WINAPI vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) -{ - struct vkCmdBindPipeline_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.pipeline = pipeline; - UNIX_CALL(vkCmdBindPipeline, ¶ms); -} - -void WINAPI vkCmdBindPipelineShaderGroupNV(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline, uint32_t groupIndex) -{ - struct vkCmdBindPipelineShaderGroupNV_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.pipeline = pipeline; - params.groupIndex = groupIndex; - UNIX_CALL(vkCmdBindPipelineShaderGroupNV, ¶ms); -} - -void WINAPI vkCmdBindShadersEXT(VkCommandBuffer commandBuffer, uint32_t stageCount, const VkShaderStageFlagBits *pStages, const VkShaderEXT *pShaders) -{ - struct vkCmdBindShadersEXT_params params; - params.commandBuffer = commandBuffer; - params.stageCount = stageCount; - params.pStages = pStages; - params.pShaders = pShaders; - UNIX_CALL(vkCmdBindShadersEXT, ¶ms); -} - -void WINAPI vkCmdBindShadingRateImageNV(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout) -{ - struct vkCmdBindShadingRateImageNV_params params; - params.commandBuffer = commandBuffer; - params.imageView = imageView; - params.imageLayout = imageLayout; - UNIX_CALL(vkCmdBindShadingRateImageNV, ¶ms); -} - -void WINAPI vkCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) -{ - struct vkCmdBindTransformFeedbackBuffersEXT_params params; - params.commandBuffer = commandBuffer; - params.firstBinding = firstBinding; - params.bindingCount = bindingCount; - params.pBuffers = pBuffers; - params.pOffsets = pOffsets; - params.pSizes = pSizes; - UNIX_CALL(vkCmdBindTransformFeedbackBuffersEXT, ¶ms); -} - -void WINAPI vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) -{ - struct vkCmdBindVertexBuffers_params params; - params.commandBuffer = commandBuffer; - params.firstBinding = firstBinding; - params.bindingCount = bindingCount; - params.pBuffers = pBuffers; - params.pOffsets = pOffsets; - UNIX_CALL(vkCmdBindVertexBuffers, ¶ms); -} - -void WINAPI vkCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) -{ - struct vkCmdBindVertexBuffers2_params params; - params.commandBuffer = commandBuffer; - params.firstBinding = firstBinding; - params.bindingCount = bindingCount; - params.pBuffers = pBuffers; - params.pOffsets = pOffsets; - params.pSizes = pSizes; - params.pStrides = pStrides; - UNIX_CALL(vkCmdBindVertexBuffers2, ¶ms); -} - -void WINAPI vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) -{ - struct vkCmdBindVertexBuffers2EXT_params params; - params.commandBuffer = commandBuffer; - params.firstBinding = firstBinding; - params.bindingCount = bindingCount; - params.pBuffers = pBuffers; - params.pOffsets = pOffsets; - params.pSizes = pSizes; - params.pStrides = pStrides; - UNIX_CALL(vkCmdBindVertexBuffers2EXT, ¶ms); -} - -void WINAPI vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) -{ - struct vkCmdBlitImage_params params; - params.commandBuffer = commandBuffer; - params.srcImage = srcImage; - params.srcImageLayout = srcImageLayout; - params.dstImage = dstImage; - params.dstImageLayout = dstImageLayout; - params.regionCount = regionCount; - params.pRegions = pRegions; - params.filter = filter; - UNIX_CALL(vkCmdBlitImage, ¶ms); -} - -void WINAPI vkCmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 *pBlitImageInfo) -{ - struct vkCmdBlitImage2_params params; - params.commandBuffer = commandBuffer; - params.pBlitImageInfo = pBlitImageInfo; - UNIX_CALL(vkCmdBlitImage2, ¶ms); -} - -void WINAPI vkCmdBlitImage2KHR(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 *pBlitImageInfo) -{ - struct vkCmdBlitImage2KHR_params params; - params.commandBuffer = commandBuffer; - params.pBlitImageInfo = pBlitImageInfo; - UNIX_CALL(vkCmdBlitImage2KHR, ¶ms); -} - -void WINAPI vkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset) -{ - struct vkCmdBuildAccelerationStructureNV_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - params.instanceData = instanceData; - params.instanceOffset = instanceOffset; - params.update = update; - params.dst = dst; - params.src = src; - params.scratch = scratch; - params.scratchOffset = scratchOffset; - UNIX_CALL(vkCmdBuildAccelerationStructureNV, ¶ms); -} - -void WINAPI vkCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, const VkDeviceAddress *pIndirectDeviceAddresses, const uint32_t *pIndirectStrides, const uint32_t * const*ppMaxPrimitiveCounts) -{ - struct vkCmdBuildAccelerationStructuresIndirectKHR_params params; - params.commandBuffer = commandBuffer; - params.infoCount = infoCount; - params.pInfos = pInfos; - params.pIndirectDeviceAddresses = pIndirectDeviceAddresses; - params.pIndirectStrides = pIndirectStrides; - params.ppMaxPrimitiveCounts = ppMaxPrimitiveCounts; - UNIX_CALL(vkCmdBuildAccelerationStructuresIndirectKHR, ¶ms); -} - -void WINAPI vkCmdBuildAccelerationStructuresKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, const VkAccelerationStructureBuildRangeInfoKHR * const*ppBuildRangeInfos) -{ - struct vkCmdBuildAccelerationStructuresKHR_params params; - params.commandBuffer = commandBuffer; - params.infoCount = infoCount; - params.pInfos = pInfos; - params.ppBuildRangeInfos = ppBuildRangeInfos; - UNIX_CALL(vkCmdBuildAccelerationStructuresKHR, ¶ms); -} - -void WINAPI vkCmdBuildMicromapsEXT(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkMicromapBuildInfoEXT *pInfos) -{ - struct vkCmdBuildMicromapsEXT_params params; - params.commandBuffer = commandBuffer; - params.infoCount = infoCount; - params.pInfos = pInfos; - UNIX_CALL(vkCmdBuildMicromapsEXT, ¶ms); -} - -void WINAPI vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment *pAttachments, uint32_t rectCount, const VkClearRect *pRects) -{ - struct vkCmdClearAttachments_params params; - params.commandBuffer = commandBuffer; - params.attachmentCount = attachmentCount; - params.pAttachments = pAttachments; - params.rectCount = rectCount; - params.pRects = pRects; - UNIX_CALL(vkCmdClearAttachments, ¶ms); -} - -void WINAPI vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) -{ - struct vkCmdClearColorImage_params params; - params.commandBuffer = commandBuffer; - params.image = image; - params.imageLayout = imageLayout; - params.pColor = pColor; - params.rangeCount = rangeCount; - params.pRanges = pRanges; - UNIX_CALL(vkCmdClearColorImage, ¶ms); -} - -void WINAPI vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) -{ - struct vkCmdClearDepthStencilImage_params params; - params.commandBuffer = commandBuffer; - params.image = image; - params.imageLayout = imageLayout; - params.pDepthStencil = pDepthStencil; - params.rangeCount = rangeCount; - params.pRanges = pRanges; - UNIX_CALL(vkCmdClearDepthStencilImage, ¶ms); -} - -void WINAPI vkCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureInfoKHR *pInfo) -{ - struct vkCmdCopyAccelerationStructureKHR_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - UNIX_CALL(vkCmdCopyAccelerationStructureKHR, ¶ms); -} - -void WINAPI vkCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkCopyAccelerationStructureModeKHR mode) -{ - struct vkCmdCopyAccelerationStructureNV_params params; - params.commandBuffer = commandBuffer; - params.dst = dst; - params.src = src; - params.mode = mode; - UNIX_CALL(vkCmdCopyAccelerationStructureNV, ¶ms); -} - -void WINAPI vkCmdCopyAccelerationStructureToMemoryKHR(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) -{ - struct vkCmdCopyAccelerationStructureToMemoryKHR_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - UNIX_CALL(vkCmdCopyAccelerationStructureToMemoryKHR, ¶ms); -} - -void WINAPI vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy *pRegions) -{ - struct vkCmdCopyBuffer_params params; - params.commandBuffer = commandBuffer; - params.srcBuffer = srcBuffer; - params.dstBuffer = dstBuffer; - params.regionCount = regionCount; - params.pRegions = pRegions; - UNIX_CALL(vkCmdCopyBuffer, ¶ms); -} - -void WINAPI vkCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo) -{ - struct vkCmdCopyBuffer2_params params; - params.commandBuffer = commandBuffer; - params.pCopyBufferInfo = pCopyBufferInfo; - UNIX_CALL(vkCmdCopyBuffer2, ¶ms); -} - -void WINAPI vkCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo) -{ - struct vkCmdCopyBuffer2KHR_params params; - params.commandBuffer = commandBuffer; - params.pCopyBufferInfo = pCopyBufferInfo; - UNIX_CALL(vkCmdCopyBuffer2KHR, ¶ms); -} - -void WINAPI vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy *pRegions) -{ - struct vkCmdCopyBufferToImage_params params; - params.commandBuffer = commandBuffer; - params.srcBuffer = srcBuffer; - params.dstImage = dstImage; - params.dstImageLayout = dstImageLayout; - params.regionCount = regionCount; - params.pRegions = pRegions; - UNIX_CALL(vkCmdCopyBufferToImage, ¶ms); -} - -void WINAPI vkCmdCopyBufferToImage2(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo) -{ - struct vkCmdCopyBufferToImage2_params params; - params.commandBuffer = commandBuffer; - params.pCopyBufferToImageInfo = pCopyBufferToImageInfo; - UNIX_CALL(vkCmdCopyBufferToImage2, ¶ms); -} - -void WINAPI vkCmdCopyBufferToImage2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo) -{ - struct vkCmdCopyBufferToImage2KHR_params params; - params.commandBuffer = commandBuffer; - params.pCopyBufferToImageInfo = pCopyBufferToImageInfo; - UNIX_CALL(vkCmdCopyBufferToImage2KHR, ¶ms); -} - -void WINAPI vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) -{ - struct vkCmdCopyImage_params params; - params.commandBuffer = commandBuffer; - params.srcImage = srcImage; - params.srcImageLayout = srcImageLayout; - params.dstImage = dstImage; - params.dstImageLayout = dstImageLayout; - params.regionCount = regionCount; - params.pRegions = pRegions; - UNIX_CALL(vkCmdCopyImage, ¶ms); -} - -void WINAPI vkCmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 *pCopyImageInfo) -{ - struct vkCmdCopyImage2_params params; - params.commandBuffer = commandBuffer; - params.pCopyImageInfo = pCopyImageInfo; - UNIX_CALL(vkCmdCopyImage2, ¶ms); -} - -void WINAPI vkCmdCopyImage2KHR(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 *pCopyImageInfo) -{ - struct vkCmdCopyImage2KHR_params params; - params.commandBuffer = commandBuffer; - params.pCopyImageInfo = pCopyImageInfo; - UNIX_CALL(vkCmdCopyImage2KHR, ¶ms); -} - -void WINAPI vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) -{ - struct vkCmdCopyImageToBuffer_params params; - params.commandBuffer = commandBuffer; - params.srcImage = srcImage; - params.srcImageLayout = srcImageLayout; - params.dstBuffer = dstBuffer; - params.regionCount = regionCount; - params.pRegions = pRegions; - UNIX_CALL(vkCmdCopyImageToBuffer, ¶ms); -} - -void WINAPI vkCmdCopyImageToBuffer2(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo) -{ - struct vkCmdCopyImageToBuffer2_params params; - params.commandBuffer = commandBuffer; - params.pCopyImageToBufferInfo = pCopyImageToBufferInfo; - UNIX_CALL(vkCmdCopyImageToBuffer2, ¶ms); -} - -void WINAPI vkCmdCopyImageToBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo) -{ - struct vkCmdCopyImageToBuffer2KHR_params params; - params.commandBuffer = commandBuffer; - params.pCopyImageToBufferInfo = pCopyImageToBufferInfo; - UNIX_CALL(vkCmdCopyImageToBuffer2KHR, ¶ms); -} - -void WINAPI vkCmdCopyMemoryIndirectNV(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride) -{ - struct vkCmdCopyMemoryIndirectNV_params params; - params.commandBuffer = commandBuffer; - params.copyBufferAddress = copyBufferAddress; - params.copyCount = copyCount; - params.stride = stride; - UNIX_CALL(vkCmdCopyMemoryIndirectNV, ¶ms); -} - -void WINAPI vkCmdCopyMemoryToAccelerationStructureKHR(VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) -{ - struct vkCmdCopyMemoryToAccelerationStructureKHR_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - UNIX_CALL(vkCmdCopyMemoryToAccelerationStructureKHR, ¶ms); -} - -void WINAPI vkCmdCopyMemoryToImageIndirectNV(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride, VkImage dstImage, VkImageLayout dstImageLayout, const VkImageSubresourceLayers *pImageSubresources) -{ - struct vkCmdCopyMemoryToImageIndirectNV_params params; - params.commandBuffer = commandBuffer; - params.copyBufferAddress = copyBufferAddress; - params.copyCount = copyCount; - params.stride = stride; - params.dstImage = dstImage; - params.dstImageLayout = dstImageLayout; - params.pImageSubresources = pImageSubresources; - UNIX_CALL(vkCmdCopyMemoryToImageIndirectNV, ¶ms); -} - -void WINAPI vkCmdCopyMemoryToMicromapEXT(VkCommandBuffer commandBuffer, const VkCopyMemoryToMicromapInfoEXT *pInfo) -{ - struct vkCmdCopyMemoryToMicromapEXT_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - UNIX_CALL(vkCmdCopyMemoryToMicromapEXT, ¶ms); -} - -void WINAPI vkCmdCopyMicromapEXT(VkCommandBuffer commandBuffer, const VkCopyMicromapInfoEXT *pInfo) -{ - struct vkCmdCopyMicromapEXT_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - UNIX_CALL(vkCmdCopyMicromapEXT, ¶ms); -} - -void WINAPI vkCmdCopyMicromapToMemoryEXT(VkCommandBuffer commandBuffer, const VkCopyMicromapToMemoryInfoEXT *pInfo) -{ - struct vkCmdCopyMicromapToMemoryEXT_params params; - params.commandBuffer = commandBuffer; - params.pInfo = pInfo; - UNIX_CALL(vkCmdCopyMicromapToMemoryEXT, ¶ms); -} - -void WINAPI vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) -{ - struct vkCmdCopyQueryPoolResults_params params; - params.commandBuffer = commandBuffer; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - params.queryCount = queryCount; - params.dstBuffer = dstBuffer; - params.dstOffset = dstOffset; - params.stride = stride; - params.flags = flags; - UNIX_CALL(vkCmdCopyQueryPoolResults, ¶ms); -} - -void WINAPI vkCmdCuLaunchKernelNVX(VkCommandBuffer commandBuffer, const VkCuLaunchInfoNVX *pLaunchInfo) -{ - struct vkCmdCuLaunchKernelNVX_params params; - params.commandBuffer = commandBuffer; - params.pLaunchInfo = pLaunchInfo; - UNIX_CALL(vkCmdCuLaunchKernelNVX, ¶ms); -} - -void WINAPI vkCmdCudaLaunchKernelNV(VkCommandBuffer commandBuffer, const VkCudaLaunchInfoNV *pLaunchInfo) -{ - struct vkCmdCudaLaunchKernelNV_params params; - params.commandBuffer = commandBuffer; - params.pLaunchInfo = pLaunchInfo; - UNIX_CALL(vkCmdCudaLaunchKernelNV, ¶ms); -} - -void WINAPI vkCmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT *pMarkerInfo) -{ - struct vkCmdDebugMarkerBeginEXT_params params; - params.commandBuffer = commandBuffer; - params.pMarkerInfo = pMarkerInfo; - UNIX_CALL(vkCmdDebugMarkerBeginEXT, ¶ms); -} - -void WINAPI vkCmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) -{ - struct vkCmdDebugMarkerEndEXT_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdDebugMarkerEndEXT, ¶ms); -} - -void WINAPI vkCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT *pMarkerInfo) -{ - struct vkCmdDebugMarkerInsertEXT_params params; - params.commandBuffer = commandBuffer; - params.pMarkerInfo = pMarkerInfo; - UNIX_CALL(vkCmdDebugMarkerInsertEXT, ¶ms); -} - -void WINAPI vkCmdDecompressMemoryIndirectCountNV(VkCommandBuffer commandBuffer, VkDeviceAddress indirectCommandsAddress, VkDeviceAddress indirectCommandsCountAddress, uint32_t stride) -{ - struct vkCmdDecompressMemoryIndirectCountNV_params params; - params.commandBuffer = commandBuffer; - params.indirectCommandsAddress = indirectCommandsAddress; - params.indirectCommandsCountAddress = indirectCommandsCountAddress; - params.stride = stride; - UNIX_CALL(vkCmdDecompressMemoryIndirectCountNV, ¶ms); -} - -void WINAPI vkCmdDecompressMemoryNV(VkCommandBuffer commandBuffer, uint32_t decompressRegionCount, const VkDecompressMemoryRegionNV *pDecompressMemoryRegions) -{ - struct vkCmdDecompressMemoryNV_params params; - params.commandBuffer = commandBuffer; - params.decompressRegionCount = decompressRegionCount; - params.pDecompressMemoryRegions = pDecompressMemoryRegions; - UNIX_CALL(vkCmdDecompressMemoryNV, ¶ms); -} - -void WINAPI vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) -{ - struct vkCmdDispatch_params params; - params.commandBuffer = commandBuffer; - params.groupCountX = groupCountX; - params.groupCountY = groupCountY; - params.groupCountZ = groupCountZ; - UNIX_CALL(vkCmdDispatch, ¶ms); -} - -void WINAPI vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) -{ - struct vkCmdDispatchBase_params params; - params.commandBuffer = commandBuffer; - params.baseGroupX = baseGroupX; - params.baseGroupY = baseGroupY; - params.baseGroupZ = baseGroupZ; - params.groupCountX = groupCountX; - params.groupCountY = groupCountY; - params.groupCountZ = groupCountZ; - UNIX_CALL(vkCmdDispatchBase, ¶ms); -} - -void WINAPI vkCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) -{ - struct vkCmdDispatchBaseKHR_params params; - params.commandBuffer = commandBuffer; - params.baseGroupX = baseGroupX; - params.baseGroupY = baseGroupY; - params.baseGroupZ = baseGroupZ; - params.groupCountX = groupCountX; - params.groupCountY = groupCountY; - params.groupCountZ = groupCountZ; - UNIX_CALL(vkCmdDispatchBaseKHR, ¶ms); -} - -void WINAPI vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) -{ - struct vkCmdDispatchIndirect_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - UNIX_CALL(vkCmdDispatchIndirect, ¶ms); -} - -void WINAPI vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) -{ - struct vkCmdDraw_params params; - params.commandBuffer = commandBuffer; - params.vertexCount = vertexCount; - params.instanceCount = instanceCount; - params.firstVertex = firstVertex; - params.firstInstance = firstInstance; - UNIX_CALL(vkCmdDraw, ¶ms); -} - -void WINAPI vkCmdDrawClusterHUAWEI(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) -{ - struct vkCmdDrawClusterHUAWEI_params params; - params.commandBuffer = commandBuffer; - params.groupCountX = groupCountX; - params.groupCountY = groupCountY; - params.groupCountZ = groupCountZ; - UNIX_CALL(vkCmdDrawClusterHUAWEI, ¶ms); -} - -void WINAPI vkCmdDrawClusterIndirectHUAWEI(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) -{ - struct vkCmdDrawClusterIndirectHUAWEI_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - UNIX_CALL(vkCmdDrawClusterIndirectHUAWEI, ¶ms); -} - -void WINAPI vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) -{ - struct vkCmdDrawIndexed_params params; - params.commandBuffer = commandBuffer; - params.indexCount = indexCount; - params.instanceCount = instanceCount; - params.firstIndex = firstIndex; - params.vertexOffset = vertexOffset; - params.firstInstance = firstInstance; - UNIX_CALL(vkCmdDrawIndexed, ¶ms); -} - -void WINAPI vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) -{ - struct vkCmdDrawIndexedIndirect_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.drawCount = drawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndexedIndirect, ¶ms); -} - -void WINAPI vkCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawIndexedIndirectCount_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndexedIndirectCount, ¶ms); -} - -void WINAPI vkCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawIndexedIndirectCountAMD_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndexedIndirectCountAMD, ¶ms); -} - -void WINAPI vkCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawIndexedIndirectCountKHR_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndexedIndirectCountKHR, ¶ms); -} - -void WINAPI vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) -{ - struct vkCmdDrawIndirect_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.drawCount = drawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndirect, ¶ms); -} - -void WINAPI vkCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance, VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride) -{ - struct vkCmdDrawIndirectByteCountEXT_params params; - params.commandBuffer = commandBuffer; - params.instanceCount = instanceCount; - params.firstInstance = firstInstance; - params.counterBuffer = counterBuffer; - params.counterBufferOffset = counterBufferOffset; - params.counterOffset = counterOffset; - params.vertexStride = vertexStride; - UNIX_CALL(vkCmdDrawIndirectByteCountEXT, ¶ms); -} - -void WINAPI vkCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawIndirectCount_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndirectCount, ¶ms); -} - -void WINAPI vkCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawIndirectCountAMD_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndirectCountAMD, ¶ms); -} - -void WINAPI vkCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawIndirectCountKHR_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawIndirectCountKHR, ¶ms); -} - -void WINAPI vkCmdDrawMeshTasksEXT(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) -{ - struct vkCmdDrawMeshTasksEXT_params params; - params.commandBuffer = commandBuffer; - params.groupCountX = groupCountX; - params.groupCountY = groupCountY; - params.groupCountZ = groupCountZ; - UNIX_CALL(vkCmdDrawMeshTasksEXT, ¶ms); -} - -void WINAPI vkCmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawMeshTasksIndirectCountEXT_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawMeshTasksIndirectCountEXT, ¶ms); -} - -void WINAPI vkCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) -{ - struct vkCmdDrawMeshTasksIndirectCountNV_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.countBuffer = countBuffer; - params.countBufferOffset = countBufferOffset; - params.maxDrawCount = maxDrawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawMeshTasksIndirectCountNV, ¶ms); -} - -void WINAPI vkCmdDrawMeshTasksIndirectEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) -{ - struct vkCmdDrawMeshTasksIndirectEXT_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.drawCount = drawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawMeshTasksIndirectEXT, ¶ms); -} - -void WINAPI vkCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) -{ - struct vkCmdDrawMeshTasksIndirectNV_params params; - params.commandBuffer = commandBuffer; - params.buffer = buffer; - params.offset = offset; - params.drawCount = drawCount; - params.stride = stride; - UNIX_CALL(vkCmdDrawMeshTasksIndirectNV, ¶ms); -} - -void WINAPI vkCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) -{ - struct vkCmdDrawMeshTasksNV_params params; - params.commandBuffer = commandBuffer; - params.taskCount = taskCount; - params.firstTask = firstTask; - UNIX_CALL(vkCmdDrawMeshTasksNV, ¶ms); -} - -void WINAPI vkCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride) -{ - struct vkCmdDrawMultiEXT_params params; - params.commandBuffer = commandBuffer; - params.drawCount = drawCount; - params.pVertexInfo = pVertexInfo; - params.instanceCount = instanceCount; - params.firstInstance = firstInstance; - params.stride = stride; - UNIX_CALL(vkCmdDrawMultiEXT, ¶ms); -} - -void WINAPI vkCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) -{ - struct vkCmdDrawMultiIndexedEXT_params params; - params.commandBuffer = commandBuffer; - params.drawCount = drawCount; - params.pIndexInfo = pIndexInfo; - params.instanceCount = instanceCount; - params.firstInstance = firstInstance; - params.stride = stride; - params.pVertexOffset = pVertexOffset; - UNIX_CALL(vkCmdDrawMultiIndexedEXT, ¶ms); -} - -void WINAPI vkCmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer) -{ - struct vkCmdEndConditionalRenderingEXT_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdEndConditionalRenderingEXT, ¶ms); -} - -void WINAPI vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer) -{ - struct vkCmdEndDebugUtilsLabelEXT_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdEndDebugUtilsLabelEXT, ¶ms); -} - -void WINAPI vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) -{ - struct vkCmdEndQuery_params params; - params.commandBuffer = commandBuffer; - params.queryPool = queryPool; - params.query = query; - UNIX_CALL(vkCmdEndQuery, ¶ms); -} - -void WINAPI vkCmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, uint32_t index) -{ - struct vkCmdEndQueryIndexedEXT_params params; - params.commandBuffer = commandBuffer; - params.queryPool = queryPool; - params.query = query; - params.index = index; - UNIX_CALL(vkCmdEndQueryIndexedEXT, ¶ms); -} - -void WINAPI vkCmdEndRenderPass(VkCommandBuffer commandBuffer) -{ - struct vkCmdEndRenderPass_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdEndRenderPass, ¶ms); -} - -void WINAPI vkCmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo *pSubpassEndInfo) -{ - struct vkCmdEndRenderPass2_params params; - params.commandBuffer = commandBuffer; - params.pSubpassEndInfo = pSubpassEndInfo; - UNIX_CALL(vkCmdEndRenderPass2, ¶ms); -} - -void WINAPI vkCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfo *pSubpassEndInfo) -{ - struct vkCmdEndRenderPass2KHR_params params; - params.commandBuffer = commandBuffer; - params.pSubpassEndInfo = pSubpassEndInfo; - UNIX_CALL(vkCmdEndRenderPass2KHR, ¶ms); -} - -void WINAPI vkCmdEndRendering(VkCommandBuffer commandBuffer) -{ - struct vkCmdEndRendering_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdEndRendering, ¶ms); -} - -void WINAPI vkCmdEndRenderingKHR(VkCommandBuffer commandBuffer) -{ - struct vkCmdEndRenderingKHR_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdEndRenderingKHR, ¶ms); -} - -void WINAPI vkCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, const VkDeviceSize *pCounterBufferOffsets) -{ - struct vkCmdEndTransformFeedbackEXT_params params; - params.commandBuffer = commandBuffer; - params.firstCounterBuffer = firstCounterBuffer; - params.counterBufferCount = counterBufferCount; - params.pCounterBuffers = pCounterBuffers; - params.pCounterBufferOffsets = pCounterBufferOffsets; - UNIX_CALL(vkCmdEndTransformFeedbackEXT, ¶ms); -} - -void WINAPI vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) -{ - struct vkCmdExecuteCommands_params params; - params.commandBuffer = commandBuffer; - params.commandBufferCount = commandBufferCount; - params.pCommandBuffers = pCommandBuffers; - UNIX_CALL(vkCmdExecuteCommands, ¶ms); -} - -void WINAPI vkCmdExecuteGeneratedCommandsNV(VkCommandBuffer commandBuffer, VkBool32 isPreprocessed, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo) -{ - struct vkCmdExecuteGeneratedCommandsNV_params params; - params.commandBuffer = commandBuffer; - params.isPreprocessed = isPreprocessed; - params.pGeneratedCommandsInfo = pGeneratedCommandsInfo; - UNIX_CALL(vkCmdExecuteGeneratedCommandsNV, ¶ms); -} - -void WINAPI vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) -{ - struct vkCmdFillBuffer_params params; - params.commandBuffer = commandBuffer; - params.dstBuffer = dstBuffer; - params.dstOffset = dstOffset; - params.size = size; - params.data = data; - UNIX_CALL(vkCmdFillBuffer, ¶ms); -} - -void WINAPI vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo) -{ - struct vkCmdInsertDebugUtilsLabelEXT_params params; - params.commandBuffer = commandBuffer; - params.pLabelInfo = pLabelInfo; - UNIX_CALL(vkCmdInsertDebugUtilsLabelEXT, ¶ms); -} - -void WINAPI vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) -{ - struct vkCmdNextSubpass_params params; - params.commandBuffer = commandBuffer; - params.contents = contents; - UNIX_CALL(vkCmdNextSubpass, ¶ms); -} - -void WINAPI vkCmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo *pSubpassBeginInfo, const VkSubpassEndInfo *pSubpassEndInfo) -{ - struct vkCmdNextSubpass2_params params; - params.commandBuffer = commandBuffer; - params.pSubpassBeginInfo = pSubpassBeginInfo; - params.pSubpassEndInfo = pSubpassEndInfo; - UNIX_CALL(vkCmdNextSubpass2, ¶ms); -} - -void WINAPI vkCmdNextSubpass2KHR(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo *pSubpassBeginInfo, const VkSubpassEndInfo *pSubpassEndInfo) -{ - struct vkCmdNextSubpass2KHR_params params; - params.commandBuffer = commandBuffer; - params.pSubpassBeginInfo = pSubpassBeginInfo; - params.pSubpassEndInfo = pSubpassEndInfo; - UNIX_CALL(vkCmdNextSubpass2KHR, ¶ms); -} - -void WINAPI vkCmdOpticalFlowExecuteNV(VkCommandBuffer commandBuffer, VkOpticalFlowSessionNV session, const VkOpticalFlowExecuteInfoNV *pExecuteInfo) -{ - struct vkCmdOpticalFlowExecuteNV_params params; - params.commandBuffer = commandBuffer; - params.session = session; - params.pExecuteInfo = pExecuteInfo; - UNIX_CALL(vkCmdOpticalFlowExecuteNV, ¶ms); -} - -void WINAPI vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) -{ - struct vkCmdPipelineBarrier_params params; - params.commandBuffer = commandBuffer; - params.srcStageMask = srcStageMask; - params.dstStageMask = dstStageMask; - params.dependencyFlags = dependencyFlags; - params.memoryBarrierCount = memoryBarrierCount; - params.pMemoryBarriers = pMemoryBarriers; - params.bufferMemoryBarrierCount = bufferMemoryBarrierCount; - params.pBufferMemoryBarriers = pBufferMemoryBarriers; - params.imageMemoryBarrierCount = imageMemoryBarrierCount; - params.pImageMemoryBarriers = pImageMemoryBarriers; - UNIX_CALL(vkCmdPipelineBarrier, ¶ms); -} - -void WINAPI vkCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo *pDependencyInfo) -{ - struct vkCmdPipelineBarrier2_params params; - params.commandBuffer = commandBuffer; - params.pDependencyInfo = pDependencyInfo; - UNIX_CALL(vkCmdPipelineBarrier2, ¶ms); -} - -void WINAPI vkCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer, const VkDependencyInfo *pDependencyInfo) -{ - struct vkCmdPipelineBarrier2KHR_params params; - params.commandBuffer = commandBuffer; - params.pDependencyInfo = pDependencyInfo; - UNIX_CALL(vkCmdPipelineBarrier2KHR, ¶ms); -} - -void WINAPI vkCmdPreprocessGeneratedCommandsNV(VkCommandBuffer commandBuffer, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo) -{ - struct vkCmdPreprocessGeneratedCommandsNV_params params; - params.commandBuffer = commandBuffer; - params.pGeneratedCommandsInfo = pGeneratedCommandsInfo; - UNIX_CALL(vkCmdPreprocessGeneratedCommandsNV, ¶ms); -} - -void WINAPI vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void *pValues) -{ - struct vkCmdPushConstants_params params; - params.commandBuffer = commandBuffer; - params.layout = layout; - params.stageFlags = stageFlags; - params.offset = offset; - params.size = size; - params.pValues = pValues; - UNIX_CALL(vkCmdPushConstants, ¶ms); -} - -void WINAPI vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites) -{ - struct vkCmdPushDescriptorSetKHR_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.layout = layout; - params.set = set; - params.descriptorWriteCount = descriptorWriteCount; - params.pDescriptorWrites = pDescriptorWrites; - UNIX_CALL(vkCmdPushDescriptorSetKHR, ¶ms); -} - -void WINAPI vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void *pData) -{ - struct vkCmdPushDescriptorSetWithTemplateKHR_params params; - params.commandBuffer = commandBuffer; - params.descriptorUpdateTemplate = descriptorUpdateTemplate; - params.layout = layout; - params.set = set; - params.pData = pData; - UNIX_CALL(vkCmdPushDescriptorSetWithTemplateKHR, ¶ms); -} - -void WINAPI vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) -{ - struct vkCmdResetEvent_params params; - params.commandBuffer = commandBuffer; - params.event = event; - params.stageMask = stageMask; - UNIX_CALL(vkCmdResetEvent, ¶ms); -} - -void WINAPI vkCmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask) -{ - struct vkCmdResetEvent2_params params; - params.commandBuffer = commandBuffer; - params.event = event; - params.stageMask = stageMask; - UNIX_CALL(vkCmdResetEvent2, ¶ms); -} - -void WINAPI vkCmdResetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask) -{ - struct vkCmdResetEvent2KHR_params params; - params.commandBuffer = commandBuffer; - params.event = event; - params.stageMask = stageMask; - UNIX_CALL(vkCmdResetEvent2KHR, ¶ms); -} - -void WINAPI vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) -{ - struct vkCmdResetQueryPool_params params; - params.commandBuffer = commandBuffer; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - params.queryCount = queryCount; - UNIX_CALL(vkCmdResetQueryPool, ¶ms); -} - -void WINAPI vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) -{ - struct vkCmdResolveImage_params params; - params.commandBuffer = commandBuffer; - params.srcImage = srcImage; - params.srcImageLayout = srcImageLayout; - params.dstImage = dstImage; - params.dstImageLayout = dstImageLayout; - params.regionCount = regionCount; - params.pRegions = pRegions; - UNIX_CALL(vkCmdResolveImage, ¶ms); -} - -void WINAPI vkCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 *pResolveImageInfo) -{ - struct vkCmdResolveImage2_params params; - params.commandBuffer = commandBuffer; - params.pResolveImageInfo = pResolveImageInfo; - UNIX_CALL(vkCmdResolveImage2, ¶ms); -} - -void WINAPI vkCmdResolveImage2KHR(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 *pResolveImageInfo) -{ - struct vkCmdResolveImage2KHR_params params; - params.commandBuffer = commandBuffer; - params.pResolveImageInfo = pResolveImageInfo; - UNIX_CALL(vkCmdResolveImage2KHR, ¶ms); -} - -void WINAPI vkCmdSetAlphaToCoverageEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToCoverageEnable) -{ - struct vkCmdSetAlphaToCoverageEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.alphaToCoverageEnable = alphaToCoverageEnable; - UNIX_CALL(vkCmdSetAlphaToCoverageEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetAlphaToOneEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToOneEnable) -{ - struct vkCmdSetAlphaToOneEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.alphaToOneEnable = alphaToOneEnable; - UNIX_CALL(vkCmdSetAlphaToOneEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetAttachmentFeedbackLoopEnableEXT(VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask) -{ - struct vkCmdSetAttachmentFeedbackLoopEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.aspectMask = aspectMask; - UNIX_CALL(vkCmdSetAttachmentFeedbackLoopEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) -{ - struct vkCmdSetBlendConstants_params params; - params.commandBuffer = commandBuffer; - params.blendConstants = blendConstants; - UNIX_CALL(vkCmdSetBlendConstants, ¶ms); -} - -void WINAPI vkCmdSetCheckpointNV(VkCommandBuffer commandBuffer, const void *pCheckpointMarker) -{ - struct vkCmdSetCheckpointNV_params params; - params.commandBuffer = commandBuffer; - params.pCheckpointMarker = pCheckpointMarker; - UNIX_CALL(vkCmdSetCheckpointNV, ¶ms); -} - -void WINAPI vkCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) -{ - struct vkCmdSetCoarseSampleOrderNV_params params; - params.commandBuffer = commandBuffer; - params.sampleOrderType = sampleOrderType; - params.customSampleOrderCount = customSampleOrderCount; - params.pCustomSampleOrders = pCustomSampleOrders; - UNIX_CALL(vkCmdSetCoarseSampleOrderNV, ¶ms); -} - -void WINAPI vkCmdSetColorBlendAdvancedEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendAdvancedEXT *pColorBlendAdvanced) -{ - struct vkCmdSetColorBlendAdvancedEXT_params params; - params.commandBuffer = commandBuffer; - params.firstAttachment = firstAttachment; - params.attachmentCount = attachmentCount; - params.pColorBlendAdvanced = pColorBlendAdvanced; - UNIX_CALL(vkCmdSetColorBlendAdvancedEXT, ¶ms); -} - -void WINAPI vkCmdSetColorBlendEnableEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkBool32 *pColorBlendEnables) -{ - struct vkCmdSetColorBlendEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.firstAttachment = firstAttachment; - params.attachmentCount = attachmentCount; - params.pColorBlendEnables = pColorBlendEnables; - UNIX_CALL(vkCmdSetColorBlendEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetColorBlendEquationEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendEquationEXT *pColorBlendEquations) -{ - struct vkCmdSetColorBlendEquationEXT_params params; - params.commandBuffer = commandBuffer; - params.firstAttachment = firstAttachment; - params.attachmentCount = attachmentCount; - params.pColorBlendEquations = pColorBlendEquations; - UNIX_CALL(vkCmdSetColorBlendEquationEXT, ¶ms); -} - -void WINAPI vkCmdSetColorWriteEnableEXT(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkBool32 *pColorWriteEnables) -{ - struct vkCmdSetColorWriteEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.attachmentCount = attachmentCount; - params.pColorWriteEnables = pColorWriteEnables; - UNIX_CALL(vkCmdSetColorWriteEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetColorWriteMaskEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorComponentFlags *pColorWriteMasks) -{ - struct vkCmdSetColorWriteMaskEXT_params params; - params.commandBuffer = commandBuffer; - params.firstAttachment = firstAttachment; - params.attachmentCount = attachmentCount; - params.pColorWriteMasks = pColorWriteMasks; - UNIX_CALL(vkCmdSetColorWriteMaskEXT, ¶ms); -} - -void WINAPI vkCmdSetConservativeRasterizationModeEXT(VkCommandBuffer commandBuffer, VkConservativeRasterizationModeEXT conservativeRasterizationMode) -{ - struct vkCmdSetConservativeRasterizationModeEXT_params params; - params.commandBuffer = commandBuffer; - params.conservativeRasterizationMode = conservativeRasterizationMode; - UNIX_CALL(vkCmdSetConservativeRasterizationModeEXT, ¶ms); -} - -void WINAPI vkCmdSetCoverageModulationModeNV(VkCommandBuffer commandBuffer, VkCoverageModulationModeNV coverageModulationMode) -{ - struct vkCmdSetCoverageModulationModeNV_params params; - params.commandBuffer = commandBuffer; - params.coverageModulationMode = coverageModulationMode; - UNIX_CALL(vkCmdSetCoverageModulationModeNV, ¶ms); -} - -void WINAPI vkCmdSetCoverageModulationTableEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageModulationTableEnable) -{ - struct vkCmdSetCoverageModulationTableEnableNV_params params; - params.commandBuffer = commandBuffer; - params.coverageModulationTableEnable = coverageModulationTableEnable; - UNIX_CALL(vkCmdSetCoverageModulationTableEnableNV, ¶ms); -} - -void WINAPI vkCmdSetCoverageModulationTableNV(VkCommandBuffer commandBuffer, uint32_t coverageModulationTableCount, const float *pCoverageModulationTable) -{ - struct vkCmdSetCoverageModulationTableNV_params params; - params.commandBuffer = commandBuffer; - params.coverageModulationTableCount = coverageModulationTableCount; - params.pCoverageModulationTable = pCoverageModulationTable; - UNIX_CALL(vkCmdSetCoverageModulationTableNV, ¶ms); -} - -void WINAPI vkCmdSetCoverageReductionModeNV(VkCommandBuffer commandBuffer, VkCoverageReductionModeNV coverageReductionMode) -{ - struct vkCmdSetCoverageReductionModeNV_params params; - params.commandBuffer = commandBuffer; - params.coverageReductionMode = coverageReductionMode; - UNIX_CALL(vkCmdSetCoverageReductionModeNV, ¶ms); -} - -void WINAPI vkCmdSetCoverageToColorEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageToColorEnable) -{ - struct vkCmdSetCoverageToColorEnableNV_params params; - params.commandBuffer = commandBuffer; - params.coverageToColorEnable = coverageToColorEnable; - UNIX_CALL(vkCmdSetCoverageToColorEnableNV, ¶ms); -} - -void WINAPI vkCmdSetCoverageToColorLocationNV(VkCommandBuffer commandBuffer, uint32_t coverageToColorLocation) -{ - struct vkCmdSetCoverageToColorLocationNV_params params; - params.commandBuffer = commandBuffer; - params.coverageToColorLocation = coverageToColorLocation; - UNIX_CALL(vkCmdSetCoverageToColorLocationNV, ¶ms); -} - -void WINAPI vkCmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) -{ - struct vkCmdSetCullMode_params params; - params.commandBuffer = commandBuffer; - params.cullMode = cullMode; - UNIX_CALL(vkCmdSetCullMode, ¶ms); -} - -void WINAPI vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) -{ - struct vkCmdSetCullModeEXT_params params; - params.commandBuffer = commandBuffer; - params.cullMode = cullMode; - UNIX_CALL(vkCmdSetCullModeEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) -{ - struct vkCmdSetDepthBias_params params; - params.commandBuffer = commandBuffer; - params.depthBiasConstantFactor = depthBiasConstantFactor; - params.depthBiasClamp = depthBiasClamp; - params.depthBiasSlopeFactor = depthBiasSlopeFactor; - UNIX_CALL(vkCmdSetDepthBias, ¶ms); -} - -void WINAPI vkCmdSetDepthBias2EXT(VkCommandBuffer commandBuffer, const VkDepthBiasInfoEXT *pDepthBiasInfo) -{ - struct vkCmdSetDepthBias2EXT_params params; - params.commandBuffer = commandBuffer; - params.pDepthBiasInfo = pDepthBiasInfo; - UNIX_CALL(vkCmdSetDepthBias2EXT, ¶ms); -} - -void WINAPI vkCmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) -{ - struct vkCmdSetDepthBiasEnable_params params; - params.commandBuffer = commandBuffer; - params.depthBiasEnable = depthBiasEnable; - UNIX_CALL(vkCmdSetDepthBiasEnable, ¶ms); -} - -void WINAPI vkCmdSetDepthBiasEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) -{ - struct vkCmdSetDepthBiasEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.depthBiasEnable = depthBiasEnable; - UNIX_CALL(vkCmdSetDepthBiasEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) -{ - struct vkCmdSetDepthBounds_params params; - params.commandBuffer = commandBuffer; - params.minDepthBounds = minDepthBounds; - params.maxDepthBounds = maxDepthBounds; - UNIX_CALL(vkCmdSetDepthBounds, ¶ms); -} - -void WINAPI vkCmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) -{ - struct vkCmdSetDepthBoundsTestEnable_params params; - params.commandBuffer = commandBuffer; - params.depthBoundsTestEnable = depthBoundsTestEnable; - UNIX_CALL(vkCmdSetDepthBoundsTestEnable, ¶ms); -} - -void WINAPI vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) -{ - struct vkCmdSetDepthBoundsTestEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.depthBoundsTestEnable = depthBoundsTestEnable; - UNIX_CALL(vkCmdSetDepthBoundsTestEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthClampEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClampEnable) -{ - struct vkCmdSetDepthClampEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.depthClampEnable = depthClampEnable; - UNIX_CALL(vkCmdSetDepthClampEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthClipEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClipEnable) -{ - struct vkCmdSetDepthClipEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.depthClipEnable = depthClipEnable; - UNIX_CALL(vkCmdSetDepthClipEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthClipNegativeOneToOneEXT(VkCommandBuffer commandBuffer, VkBool32 negativeOneToOne) -{ - struct vkCmdSetDepthClipNegativeOneToOneEXT_params params; - params.commandBuffer = commandBuffer; - params.negativeOneToOne = negativeOneToOne; - UNIX_CALL(vkCmdSetDepthClipNegativeOneToOneEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) -{ - struct vkCmdSetDepthCompareOp_params params; - params.commandBuffer = commandBuffer; - params.depthCompareOp = depthCompareOp; - UNIX_CALL(vkCmdSetDepthCompareOp, ¶ms); -} - -void WINAPI vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) -{ - struct vkCmdSetDepthCompareOpEXT_params params; - params.commandBuffer = commandBuffer; - params.depthCompareOp = depthCompareOp; - UNIX_CALL(vkCmdSetDepthCompareOpEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) -{ - struct vkCmdSetDepthTestEnable_params params; - params.commandBuffer = commandBuffer; - params.depthTestEnable = depthTestEnable; - UNIX_CALL(vkCmdSetDepthTestEnable, ¶ms); -} - -void WINAPI vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) -{ - struct vkCmdSetDepthTestEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.depthTestEnable = depthTestEnable; - UNIX_CALL(vkCmdSetDepthTestEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) -{ - struct vkCmdSetDepthWriteEnable_params params; - params.commandBuffer = commandBuffer; - params.depthWriteEnable = depthWriteEnable; - UNIX_CALL(vkCmdSetDepthWriteEnable, ¶ms); -} - -void WINAPI vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) -{ - struct vkCmdSetDepthWriteEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.depthWriteEnable = depthWriteEnable; - UNIX_CALL(vkCmdSetDepthWriteEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDescriptorBufferOffsetsEXT(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const uint32_t *pBufferIndices, const VkDeviceSize *pOffsets) -{ - struct vkCmdSetDescriptorBufferOffsetsEXT_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.layout = layout; - params.firstSet = firstSet; - params.setCount = setCount; - params.pBufferIndices = pBufferIndices; - params.pOffsets = pOffsets; - UNIX_CALL(vkCmdSetDescriptorBufferOffsetsEXT, ¶ms); -} - -void WINAPI vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) -{ - struct vkCmdSetDeviceMask_params params; - params.commandBuffer = commandBuffer; - params.deviceMask = deviceMask; - UNIX_CALL(vkCmdSetDeviceMask, ¶ms); -} - -void WINAPI vkCmdSetDeviceMaskKHR(VkCommandBuffer commandBuffer, uint32_t deviceMask) -{ - struct vkCmdSetDeviceMaskKHR_params params; - params.commandBuffer = commandBuffer; - params.deviceMask = deviceMask; - UNIX_CALL(vkCmdSetDeviceMaskKHR, ¶ms); -} - -void WINAPI vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) -{ - struct vkCmdSetDiscardRectangleEXT_params params; - params.commandBuffer = commandBuffer; - params.firstDiscardRectangle = firstDiscardRectangle; - params.discardRectangleCount = discardRectangleCount; - params.pDiscardRectangles = pDiscardRectangles; - UNIX_CALL(vkCmdSetDiscardRectangleEXT, ¶ms); -} - -void WINAPI vkCmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable) -{ - struct vkCmdSetDiscardRectangleEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.discardRectangleEnable = discardRectangleEnable; - UNIX_CALL(vkCmdSetDiscardRectangleEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode) -{ - struct vkCmdSetDiscardRectangleModeEXT_params params; - params.commandBuffer = commandBuffer; - params.discardRectangleMode = discardRectangleMode; - UNIX_CALL(vkCmdSetDiscardRectangleModeEXT, ¶ms); -} - -void WINAPI vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) -{ - struct vkCmdSetEvent_params params; - params.commandBuffer = commandBuffer; - params.event = event; - params.stageMask = stageMask; - UNIX_CALL(vkCmdSetEvent, ¶ms); -} - -void WINAPI vkCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo *pDependencyInfo) -{ - struct vkCmdSetEvent2_params params; - params.commandBuffer = commandBuffer; - params.event = event; - params.pDependencyInfo = pDependencyInfo; - UNIX_CALL(vkCmdSetEvent2, ¶ms); -} - -void WINAPI vkCmdSetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo *pDependencyInfo) -{ - struct vkCmdSetEvent2KHR_params params; - params.commandBuffer = commandBuffer; - params.event = event; - params.pDependencyInfo = pDependencyInfo; - UNIX_CALL(vkCmdSetEvent2KHR, ¶ms); -} - -void WINAPI vkCmdSetExclusiveScissorEnableNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkBool32 *pExclusiveScissorEnables) -{ - struct vkCmdSetExclusiveScissorEnableNV_params params; - params.commandBuffer = commandBuffer; - params.firstExclusiveScissor = firstExclusiveScissor; - params.exclusiveScissorCount = exclusiveScissorCount; - params.pExclusiveScissorEnables = pExclusiveScissorEnables; - UNIX_CALL(vkCmdSetExclusiveScissorEnableNV, ¶ms); -} - -void WINAPI vkCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) -{ - struct vkCmdSetExclusiveScissorNV_params params; - params.commandBuffer = commandBuffer; - params.firstExclusiveScissor = firstExclusiveScissor; - params.exclusiveScissorCount = exclusiveScissorCount; - params.pExclusiveScissors = pExclusiveScissors; - UNIX_CALL(vkCmdSetExclusiveScissorNV, ¶ms); -} - -void WINAPI vkCmdSetExtraPrimitiveOverestimationSizeEXT(VkCommandBuffer commandBuffer, float extraPrimitiveOverestimationSize) -{ - struct vkCmdSetExtraPrimitiveOverestimationSizeEXT_params params; - params.commandBuffer = commandBuffer; - params.extraPrimitiveOverestimationSize = extraPrimitiveOverestimationSize; - UNIX_CALL(vkCmdSetExtraPrimitiveOverestimationSizeEXT, ¶ms); -} - -void WINAPI vkCmdSetFragmentShadingRateEnumNV(VkCommandBuffer commandBuffer, VkFragmentShadingRateNV shadingRate, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) -{ - struct vkCmdSetFragmentShadingRateEnumNV_params params; - params.commandBuffer = commandBuffer; - params.shadingRate = shadingRate; - params.combinerOps = combinerOps; - UNIX_CALL(vkCmdSetFragmentShadingRateEnumNV, ¶ms); -} - -void WINAPI vkCmdSetFragmentShadingRateKHR(VkCommandBuffer commandBuffer, const VkExtent2D *pFragmentSize, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]) -{ - struct vkCmdSetFragmentShadingRateKHR_params params; - params.commandBuffer = commandBuffer; - params.pFragmentSize = pFragmentSize; - params.combinerOps = combinerOps; - UNIX_CALL(vkCmdSetFragmentShadingRateKHR, ¶ms); -} - -void WINAPI vkCmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace) -{ - struct vkCmdSetFrontFace_params params; - params.commandBuffer = commandBuffer; - params.frontFace = frontFace; - UNIX_CALL(vkCmdSetFrontFace, ¶ms); -} - -void WINAPI vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, VkFrontFace frontFace) -{ - struct vkCmdSetFrontFaceEXT_params params; - params.commandBuffer = commandBuffer; - params.frontFace = frontFace; - UNIX_CALL(vkCmdSetFrontFaceEXT, ¶ms); -} - -void WINAPI vkCmdSetLineRasterizationModeEXT(VkCommandBuffer commandBuffer, VkLineRasterizationModeEXT lineRasterizationMode) -{ - struct vkCmdSetLineRasterizationModeEXT_params params; - params.commandBuffer = commandBuffer; - params.lineRasterizationMode = lineRasterizationMode; - UNIX_CALL(vkCmdSetLineRasterizationModeEXT, ¶ms); -} - -void WINAPI vkCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) -{ - struct vkCmdSetLineStippleEXT_params params; - params.commandBuffer = commandBuffer; - params.lineStippleFactor = lineStippleFactor; - params.lineStipplePattern = lineStipplePattern; - UNIX_CALL(vkCmdSetLineStippleEXT, ¶ms); -} - -void WINAPI vkCmdSetLineStippleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stippledLineEnable) -{ - struct vkCmdSetLineStippleEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.stippledLineEnable = stippledLineEnable; - UNIX_CALL(vkCmdSetLineStippleEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) -{ - struct vkCmdSetLineWidth_params params; - params.commandBuffer = commandBuffer; - params.lineWidth = lineWidth; - UNIX_CALL(vkCmdSetLineWidth, ¶ms); -} - -void WINAPI vkCmdSetLogicOpEXT(VkCommandBuffer commandBuffer, VkLogicOp logicOp) -{ - struct vkCmdSetLogicOpEXT_params params; - params.commandBuffer = commandBuffer; - params.logicOp = logicOp; - UNIX_CALL(vkCmdSetLogicOpEXT, ¶ms); -} - -void WINAPI vkCmdSetLogicOpEnableEXT(VkCommandBuffer commandBuffer, VkBool32 logicOpEnable) -{ - struct vkCmdSetLogicOpEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.logicOpEnable = logicOpEnable; - UNIX_CALL(vkCmdSetLogicOpEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetPatchControlPointsEXT(VkCommandBuffer commandBuffer, uint32_t patchControlPoints) -{ - struct vkCmdSetPatchControlPointsEXT_params params; - params.commandBuffer = commandBuffer; - params.patchControlPoints = patchControlPoints; - UNIX_CALL(vkCmdSetPatchControlPointsEXT, ¶ms); -} - -VkResult WINAPI vkCmdSetPerformanceMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceMarkerInfoINTEL *pMarkerInfo) -{ - struct vkCmdSetPerformanceMarkerINTEL_params params; - NTSTATUS status; - params.commandBuffer = commandBuffer; - params.pMarkerInfo = pMarkerInfo; - status = UNIX_CALL(vkCmdSetPerformanceMarkerINTEL, ¶ms); - assert(!status && "vkCmdSetPerformanceMarkerINTEL"); - return params.result; -} - -VkResult WINAPI vkCmdSetPerformanceOverrideINTEL(VkCommandBuffer commandBuffer, const VkPerformanceOverrideInfoINTEL *pOverrideInfo) -{ - struct vkCmdSetPerformanceOverrideINTEL_params params; - NTSTATUS status; - params.commandBuffer = commandBuffer; - params.pOverrideInfo = pOverrideInfo; - status = UNIX_CALL(vkCmdSetPerformanceOverrideINTEL, ¶ms); - assert(!status && "vkCmdSetPerformanceOverrideINTEL"); - return params.result; -} - -VkResult WINAPI vkCmdSetPerformanceStreamMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceStreamMarkerInfoINTEL *pMarkerInfo) -{ - struct vkCmdSetPerformanceStreamMarkerINTEL_params params; - NTSTATUS status; - params.commandBuffer = commandBuffer; - params.pMarkerInfo = pMarkerInfo; - status = UNIX_CALL(vkCmdSetPerformanceStreamMarkerINTEL, ¶ms); - assert(!status && "vkCmdSetPerformanceStreamMarkerINTEL"); - return params.result; -} - -void WINAPI vkCmdSetPolygonModeEXT(VkCommandBuffer commandBuffer, VkPolygonMode polygonMode) -{ - struct vkCmdSetPolygonModeEXT_params params; - params.commandBuffer = commandBuffer; - params.polygonMode = polygonMode; - UNIX_CALL(vkCmdSetPolygonModeEXT, ¶ms); -} - -void WINAPI vkCmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable) -{ - struct vkCmdSetPrimitiveRestartEnable_params params; - params.commandBuffer = commandBuffer; - params.primitiveRestartEnable = primitiveRestartEnable; - UNIX_CALL(vkCmdSetPrimitiveRestartEnable, ¶ms); -} - -void WINAPI vkCmdSetPrimitiveRestartEnableEXT(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable) -{ - struct vkCmdSetPrimitiveRestartEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.primitiveRestartEnable = primitiveRestartEnable; - UNIX_CALL(vkCmdSetPrimitiveRestartEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) -{ - struct vkCmdSetPrimitiveTopology_params params; - params.commandBuffer = commandBuffer; - params.primitiveTopology = primitiveTopology; - UNIX_CALL(vkCmdSetPrimitiveTopology, ¶ms); -} - -void WINAPI vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) -{ - struct vkCmdSetPrimitiveTopologyEXT_params params; - params.commandBuffer = commandBuffer; - params.primitiveTopology = primitiveTopology; - UNIX_CALL(vkCmdSetPrimitiveTopologyEXT, ¶ms); -} - -void WINAPI vkCmdSetProvokingVertexModeEXT(VkCommandBuffer commandBuffer, VkProvokingVertexModeEXT provokingVertexMode) -{ - struct vkCmdSetProvokingVertexModeEXT_params params; - params.commandBuffer = commandBuffer; - params.provokingVertexMode = provokingVertexMode; - UNIX_CALL(vkCmdSetProvokingVertexModeEXT, ¶ms); -} - -void WINAPI vkCmdSetRasterizationSamplesEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits rasterizationSamples) -{ - struct vkCmdSetRasterizationSamplesEXT_params params; - params.commandBuffer = commandBuffer; - params.rasterizationSamples = rasterizationSamples; - UNIX_CALL(vkCmdSetRasterizationSamplesEXT, ¶ms); -} - -void WINAPI vkCmdSetRasterizationStreamEXT(VkCommandBuffer commandBuffer, uint32_t rasterizationStream) -{ - struct vkCmdSetRasterizationStreamEXT_params params; - params.commandBuffer = commandBuffer; - params.rasterizationStream = rasterizationStream; - UNIX_CALL(vkCmdSetRasterizationStreamEXT, ¶ms); -} - -void WINAPI vkCmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable) -{ - struct vkCmdSetRasterizerDiscardEnable_params params; - params.commandBuffer = commandBuffer; - params.rasterizerDiscardEnable = rasterizerDiscardEnable; - UNIX_CALL(vkCmdSetRasterizerDiscardEnable, ¶ms); -} - -void WINAPI vkCmdSetRasterizerDiscardEnableEXT(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable) -{ - struct vkCmdSetRasterizerDiscardEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.rasterizerDiscardEnable = rasterizerDiscardEnable; - UNIX_CALL(vkCmdSetRasterizerDiscardEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetRayTracingPipelineStackSizeKHR(VkCommandBuffer commandBuffer, uint32_t pipelineStackSize) -{ - struct vkCmdSetRayTracingPipelineStackSizeKHR_params params; - params.commandBuffer = commandBuffer; - params.pipelineStackSize = pipelineStackSize; - UNIX_CALL(vkCmdSetRayTracingPipelineStackSizeKHR, ¶ms); -} - -void WINAPI vkCmdSetRepresentativeFragmentTestEnableNV(VkCommandBuffer commandBuffer, VkBool32 representativeFragmentTestEnable) -{ - struct vkCmdSetRepresentativeFragmentTestEnableNV_params params; - params.commandBuffer = commandBuffer; - params.representativeFragmentTestEnable = representativeFragmentTestEnable; - UNIX_CALL(vkCmdSetRepresentativeFragmentTestEnableNV, ¶ms); -} - -void WINAPI vkCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT *pSampleLocationsInfo) -{ - struct vkCmdSetSampleLocationsEXT_params params; - params.commandBuffer = commandBuffer; - params.pSampleLocationsInfo = pSampleLocationsInfo; - UNIX_CALL(vkCmdSetSampleLocationsEXT, ¶ms); -} - -void WINAPI vkCmdSetSampleLocationsEnableEXT(VkCommandBuffer commandBuffer, VkBool32 sampleLocationsEnable) -{ - struct vkCmdSetSampleLocationsEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.sampleLocationsEnable = sampleLocationsEnable; - UNIX_CALL(vkCmdSetSampleLocationsEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetSampleMaskEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits samples, const VkSampleMask *pSampleMask) -{ - struct vkCmdSetSampleMaskEXT_params params; - params.commandBuffer = commandBuffer; - params.samples = samples; - params.pSampleMask = pSampleMask; - UNIX_CALL(vkCmdSetSampleMaskEXT, ¶ms); -} - -void WINAPI vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors) -{ - struct vkCmdSetScissor_params params; - params.commandBuffer = commandBuffer; - params.firstScissor = firstScissor; - params.scissorCount = scissorCount; - params.pScissors = pScissors; - UNIX_CALL(vkCmdSetScissor, ¶ms); -} - -void WINAPI vkCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors) -{ - struct vkCmdSetScissorWithCount_params params; - params.commandBuffer = commandBuffer; - params.scissorCount = scissorCount; - params.pScissors = pScissors; - UNIX_CALL(vkCmdSetScissorWithCount, ¶ms); -} - -void WINAPI vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors) -{ - struct vkCmdSetScissorWithCountEXT_params params; - params.commandBuffer = commandBuffer; - params.scissorCount = scissorCount; - params.pScissors = pScissors; - UNIX_CALL(vkCmdSetScissorWithCountEXT, ¶ms); -} - -void WINAPI vkCmdSetShadingRateImageEnableNV(VkCommandBuffer commandBuffer, VkBool32 shadingRateImageEnable) -{ - struct vkCmdSetShadingRateImageEnableNV_params params; - params.commandBuffer = commandBuffer; - params.shadingRateImageEnable = shadingRateImageEnable; - UNIX_CALL(vkCmdSetShadingRateImageEnableNV, ¶ms); -} - -void WINAPI vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) -{ - struct vkCmdSetStencilCompareMask_params params; - params.commandBuffer = commandBuffer; - params.faceMask = faceMask; - params.compareMask = compareMask; - UNIX_CALL(vkCmdSetStencilCompareMask, ¶ms); -} - -void WINAPI vkCmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) -{ - struct vkCmdSetStencilOp_params params; - params.commandBuffer = commandBuffer; - params.faceMask = faceMask; - params.failOp = failOp; - params.passOp = passOp; - params.depthFailOp = depthFailOp; - params.compareOp = compareOp; - UNIX_CALL(vkCmdSetStencilOp, ¶ms); -} - -void WINAPI vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) -{ - struct vkCmdSetStencilOpEXT_params params; - params.commandBuffer = commandBuffer; - params.faceMask = faceMask; - params.failOp = failOp; - params.passOp = passOp; - params.depthFailOp = depthFailOp; - params.compareOp = compareOp; - UNIX_CALL(vkCmdSetStencilOpEXT, ¶ms); -} - -void WINAPI vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) -{ - struct vkCmdSetStencilReference_params params; - params.commandBuffer = commandBuffer; - params.faceMask = faceMask; - params.reference = reference; - UNIX_CALL(vkCmdSetStencilReference, ¶ms); -} - -void WINAPI vkCmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) -{ - struct vkCmdSetStencilTestEnable_params params; - params.commandBuffer = commandBuffer; - params.stencilTestEnable = stencilTestEnable; - UNIX_CALL(vkCmdSetStencilTestEnable, ¶ms); -} - -void WINAPI vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) -{ - struct vkCmdSetStencilTestEnableEXT_params params; - params.commandBuffer = commandBuffer; - params.stencilTestEnable = stencilTestEnable; - UNIX_CALL(vkCmdSetStencilTestEnableEXT, ¶ms); -} - -void WINAPI vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) -{ - struct vkCmdSetStencilWriteMask_params params; - params.commandBuffer = commandBuffer; - params.faceMask = faceMask; - params.writeMask = writeMask; - UNIX_CALL(vkCmdSetStencilWriteMask, ¶ms); -} - -void WINAPI vkCmdSetTessellationDomainOriginEXT(VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin) -{ - struct vkCmdSetTessellationDomainOriginEXT_params params; - params.commandBuffer = commandBuffer; - params.domainOrigin = domainOrigin; - UNIX_CALL(vkCmdSetTessellationDomainOriginEXT, ¶ms); -} - -void WINAPI vkCmdSetVertexInputEXT(VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) -{ - struct vkCmdSetVertexInputEXT_params params; - params.commandBuffer = commandBuffer; - params.vertexBindingDescriptionCount = vertexBindingDescriptionCount; - params.pVertexBindingDescriptions = pVertexBindingDescriptions; - params.vertexAttributeDescriptionCount = vertexAttributeDescriptionCount; - params.pVertexAttributeDescriptions = pVertexAttributeDescriptions; - UNIX_CALL(vkCmdSetVertexInputEXT, ¶ms); -} - -void WINAPI vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports) -{ - struct vkCmdSetViewport_params params; - params.commandBuffer = commandBuffer; - params.firstViewport = firstViewport; - params.viewportCount = viewportCount; - params.pViewports = pViewports; - UNIX_CALL(vkCmdSetViewport, ¶ms); -} - -void WINAPI vkCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV *pShadingRatePalettes) -{ - struct vkCmdSetViewportShadingRatePaletteNV_params params; - params.commandBuffer = commandBuffer; - params.firstViewport = firstViewport; - params.viewportCount = viewportCount; - params.pShadingRatePalettes = pShadingRatePalettes; - UNIX_CALL(vkCmdSetViewportShadingRatePaletteNV, ¶ms); -} - -void WINAPI vkCmdSetViewportSwizzleNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportSwizzleNV *pViewportSwizzles) -{ - struct vkCmdSetViewportSwizzleNV_params params; - params.commandBuffer = commandBuffer; - params.firstViewport = firstViewport; - params.viewportCount = viewportCount; - params.pViewportSwizzles = pViewportSwizzles; - UNIX_CALL(vkCmdSetViewportSwizzleNV, ¶ms); -} - -void WINAPI vkCmdSetViewportWScalingEnableNV(VkCommandBuffer commandBuffer, VkBool32 viewportWScalingEnable) -{ - struct vkCmdSetViewportWScalingEnableNV_params params; - params.commandBuffer = commandBuffer; - params.viewportWScalingEnable = viewportWScalingEnable; - UNIX_CALL(vkCmdSetViewportWScalingEnableNV, ¶ms); -} - -void WINAPI vkCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV *pViewportWScalings) -{ - struct vkCmdSetViewportWScalingNV_params params; - params.commandBuffer = commandBuffer; - params.firstViewport = firstViewport; - params.viewportCount = viewportCount; - params.pViewportWScalings = pViewportWScalings; - UNIX_CALL(vkCmdSetViewportWScalingNV, ¶ms); -} - -void WINAPI vkCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports) -{ - struct vkCmdSetViewportWithCount_params params; - params.commandBuffer = commandBuffer; - params.viewportCount = viewportCount; - params.pViewports = pViewports; - UNIX_CALL(vkCmdSetViewportWithCount, ¶ms); -} - -void WINAPI vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports) -{ - struct vkCmdSetViewportWithCountEXT_params params; - params.commandBuffer = commandBuffer; - params.viewportCount = viewportCount; - params.pViewports = pViewports; - UNIX_CALL(vkCmdSetViewportWithCountEXT, ¶ms); -} - -void WINAPI vkCmdSubpassShadingHUAWEI(VkCommandBuffer commandBuffer) -{ - struct vkCmdSubpassShadingHUAWEI_params params; - params.commandBuffer = commandBuffer; - UNIX_CALL(vkCmdSubpassShadingHUAWEI, ¶ms); -} - -void WINAPI vkCmdTraceRaysIndirect2KHR(VkCommandBuffer commandBuffer, VkDeviceAddress indirectDeviceAddress) -{ - struct vkCmdTraceRaysIndirect2KHR_params params; - params.commandBuffer = commandBuffer; - params.indirectDeviceAddress = indirectDeviceAddress; - UNIX_CALL(vkCmdTraceRaysIndirect2KHR, ¶ms); -} - -void WINAPI vkCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, VkDeviceAddress indirectDeviceAddress) -{ - struct vkCmdTraceRaysIndirectKHR_params params; - params.commandBuffer = commandBuffer; - params.pRaygenShaderBindingTable = pRaygenShaderBindingTable; - params.pMissShaderBindingTable = pMissShaderBindingTable; - params.pHitShaderBindingTable = pHitShaderBindingTable; - params.pCallableShaderBindingTable = pCallableShaderBindingTable; - params.indirectDeviceAddress = indirectDeviceAddress; - UNIX_CALL(vkCmdTraceRaysIndirectKHR, ¶ms); -} - -void WINAPI vkCmdTraceRaysKHR(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width, uint32_t height, uint32_t depth) -{ - struct vkCmdTraceRaysKHR_params params; - params.commandBuffer = commandBuffer; - params.pRaygenShaderBindingTable = pRaygenShaderBindingTable; - params.pMissShaderBindingTable = pMissShaderBindingTable; - params.pHitShaderBindingTable = pHitShaderBindingTable; - params.pCallableShaderBindingTable = pCallableShaderBindingTable; - params.width = width; - params.height = height; - params.depth = depth; - UNIX_CALL(vkCmdTraceRaysKHR, ¶ms); -} - -void WINAPI vkCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, uint32_t width, uint32_t height, uint32_t depth) -{ - struct vkCmdTraceRaysNV_params params; - params.commandBuffer = commandBuffer; - params.raygenShaderBindingTableBuffer = raygenShaderBindingTableBuffer; - params.raygenShaderBindingOffset = raygenShaderBindingOffset; - params.missShaderBindingTableBuffer = missShaderBindingTableBuffer; - params.missShaderBindingOffset = missShaderBindingOffset; - params.missShaderBindingStride = missShaderBindingStride; - params.hitShaderBindingTableBuffer = hitShaderBindingTableBuffer; - params.hitShaderBindingOffset = hitShaderBindingOffset; - params.hitShaderBindingStride = hitShaderBindingStride; - params.callableShaderBindingTableBuffer = callableShaderBindingTableBuffer; - params.callableShaderBindingOffset = callableShaderBindingOffset; - params.callableShaderBindingStride = callableShaderBindingStride; - params.width = width; - params.height = height; - params.depth = depth; - UNIX_CALL(vkCmdTraceRaysNV, ¶ms); -} - -void WINAPI vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) -{ - struct vkCmdUpdateBuffer_params params; - params.commandBuffer = commandBuffer; - params.dstBuffer = dstBuffer; - params.dstOffset = dstOffset; - params.dataSize = dataSize; - params.pData = pData; - UNIX_CALL(vkCmdUpdateBuffer, ¶ms); -} - -void WINAPI vkCmdUpdatePipelineIndirectBufferNV(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) -{ - struct vkCmdUpdatePipelineIndirectBufferNV_params params; - params.commandBuffer = commandBuffer; - params.pipelineBindPoint = pipelineBindPoint; - params.pipeline = pipeline; - UNIX_CALL(vkCmdUpdatePipelineIndirectBufferNV, ¶ms); -} - -void WINAPI vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) -{ - struct vkCmdWaitEvents_params params; - params.commandBuffer = commandBuffer; - params.eventCount = eventCount; - params.pEvents = pEvents; - params.srcStageMask = srcStageMask; - params.dstStageMask = dstStageMask; - params.memoryBarrierCount = memoryBarrierCount; - params.pMemoryBarriers = pMemoryBarriers; - params.bufferMemoryBarrierCount = bufferMemoryBarrierCount; - params.pBufferMemoryBarriers = pBufferMemoryBarriers; - params.imageMemoryBarrierCount = imageMemoryBarrierCount; - params.pImageMemoryBarriers = pImageMemoryBarriers; - UNIX_CALL(vkCmdWaitEvents, ¶ms); -} - -void WINAPI vkCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, const VkDependencyInfo *pDependencyInfos) -{ - struct vkCmdWaitEvents2_params params; - params.commandBuffer = commandBuffer; - params.eventCount = eventCount; - params.pEvents = pEvents; - params.pDependencyInfos = pDependencyInfos; - UNIX_CALL(vkCmdWaitEvents2, ¶ms); -} - -void WINAPI vkCmdWaitEvents2KHR(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, const VkDependencyInfo *pDependencyInfos) -{ - struct vkCmdWaitEvents2KHR_params params; - params.commandBuffer = commandBuffer; - params.eventCount = eventCount; - params.pEvents = pEvents; - params.pDependencyInfos = pDependencyInfos; - UNIX_CALL(vkCmdWaitEvents2KHR, ¶ms); -} - -void WINAPI vkCmdWriteAccelerationStructuresPropertiesKHR(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) -{ - struct vkCmdWriteAccelerationStructuresPropertiesKHR_params params; - params.commandBuffer = commandBuffer; - params.accelerationStructureCount = accelerationStructureCount; - params.pAccelerationStructures = pAccelerationStructures; - params.queryType = queryType; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - UNIX_CALL(vkCmdWriteAccelerationStructuresPropertiesKHR, ¶ms); -} - -void WINAPI vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) -{ - struct vkCmdWriteAccelerationStructuresPropertiesNV_params params; - params.commandBuffer = commandBuffer; - params.accelerationStructureCount = accelerationStructureCount; - params.pAccelerationStructures = pAccelerationStructures; - params.queryType = queryType; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - UNIX_CALL(vkCmdWriteAccelerationStructuresPropertiesNV, ¶ms); -} - -void WINAPI vkCmdWriteBufferMarker2AMD(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker) -{ - struct vkCmdWriteBufferMarker2AMD_params params; - params.commandBuffer = commandBuffer; - params.stage = stage; - params.dstBuffer = dstBuffer; - params.dstOffset = dstOffset; - params.marker = marker; - UNIX_CALL(vkCmdWriteBufferMarker2AMD, ¶ms); -} - -void WINAPI vkCmdWriteBufferMarkerAMD(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker) -{ - struct vkCmdWriteBufferMarkerAMD_params params; - params.commandBuffer = commandBuffer; - params.pipelineStage = pipelineStage; - params.dstBuffer = dstBuffer; - params.dstOffset = dstOffset; - params.marker = marker; - UNIX_CALL(vkCmdWriteBufferMarkerAMD, ¶ms); -} - -void WINAPI vkCmdWriteMicromapsPropertiesEXT(VkCommandBuffer commandBuffer, uint32_t micromapCount, const VkMicromapEXT *pMicromaps, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) -{ - struct vkCmdWriteMicromapsPropertiesEXT_params params; - params.commandBuffer = commandBuffer; - params.micromapCount = micromapCount; - params.pMicromaps = pMicromaps; - params.queryType = queryType; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - UNIX_CALL(vkCmdWriteMicromapsPropertiesEXT, ¶ms); -} - -void WINAPI vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) -{ - struct vkCmdWriteTimestamp_params params; - params.commandBuffer = commandBuffer; - params.pipelineStage = pipelineStage; - params.queryPool = queryPool; - params.query = query; - UNIX_CALL(vkCmdWriteTimestamp, ¶ms); -} - -void WINAPI vkCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query) -{ - struct vkCmdWriteTimestamp2_params params; - params.commandBuffer = commandBuffer; - params.stage = stage; - params.queryPool = queryPool; - params.query = query; - UNIX_CALL(vkCmdWriteTimestamp2, ¶ms); -} - -void WINAPI vkCmdWriteTimestamp2KHR(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query) -{ - struct vkCmdWriteTimestamp2KHR_params params; - params.commandBuffer = commandBuffer; - params.stage = stage; - params.queryPool = queryPool; - params.query = query; - UNIX_CALL(vkCmdWriteTimestamp2KHR, ¶ms); -} - -VkResult WINAPI vkCompileDeferredNV(VkDevice device, VkPipeline pipeline, uint32_t shader) -{ - struct vkCompileDeferredNV_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.shader = shader; - status = UNIX_CALL(vkCompileDeferredNV, ¶ms); - assert(!status && "vkCompileDeferredNV"); - return params.result; -} - -VkResult WINAPI vkCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureInfoKHR *pInfo) -{ - struct vkCopyAccelerationStructureKHR_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pInfo = pInfo; - status = UNIX_CALL(vkCopyAccelerationStructureKHR, ¶ms); - assert(!status && "vkCopyAccelerationStructureKHR"); - return params.result; -} - -VkResult WINAPI vkCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) -{ - struct vkCopyAccelerationStructureToMemoryKHR_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pInfo = pInfo; - status = UNIX_CALL(vkCopyAccelerationStructureToMemoryKHR, ¶ms); - assert(!status && "vkCopyAccelerationStructureToMemoryKHR"); - return params.result; -} - -VkResult WINAPI vkCopyImageToImageEXT(VkDevice device, const VkCopyImageToImageInfoEXT *pCopyImageToImageInfo) -{ - struct vkCopyImageToImageEXT_params params; - NTSTATUS status; - params.device = device; - params.pCopyImageToImageInfo = pCopyImageToImageInfo; - status = UNIX_CALL(vkCopyImageToImageEXT, ¶ms); - assert(!status && "vkCopyImageToImageEXT"); - return params.result; -} - -VkResult WINAPI vkCopyImageToMemoryEXT(VkDevice device, const VkCopyImageToMemoryInfoEXT *pCopyImageToMemoryInfo) -{ - struct vkCopyImageToMemoryEXT_params params; - NTSTATUS status; - params.device = device; - params.pCopyImageToMemoryInfo = pCopyImageToMemoryInfo; - status = UNIX_CALL(vkCopyImageToMemoryEXT, ¶ms); - assert(!status && "vkCopyImageToMemoryEXT"); - return params.result; -} - -VkResult WINAPI vkCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) -{ - struct vkCopyMemoryToAccelerationStructureKHR_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pInfo = pInfo; - status = UNIX_CALL(vkCopyMemoryToAccelerationStructureKHR, ¶ms); - assert(!status && "vkCopyMemoryToAccelerationStructureKHR"); - return params.result; -} - -VkResult WINAPI vkCopyMemoryToImageEXT(VkDevice device, const VkCopyMemoryToImageInfoEXT *pCopyMemoryToImageInfo) -{ - struct vkCopyMemoryToImageEXT_params params; - NTSTATUS status; - params.device = device; - params.pCopyMemoryToImageInfo = pCopyMemoryToImageInfo; - status = UNIX_CALL(vkCopyMemoryToImageEXT, ¶ms); - assert(!status && "vkCopyMemoryToImageEXT"); - return params.result; -} - -VkResult WINAPI vkCopyMemoryToMicromapEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToMicromapInfoEXT *pInfo) -{ - struct vkCopyMemoryToMicromapEXT_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pInfo = pInfo; - status = UNIX_CALL(vkCopyMemoryToMicromapEXT, ¶ms); - assert(!status && "vkCopyMemoryToMicromapEXT"); - return params.result; -} - -VkResult WINAPI vkCopyMicromapEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapInfoEXT *pInfo) -{ - struct vkCopyMicromapEXT_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pInfo = pInfo; - status = UNIX_CALL(vkCopyMicromapEXT, ¶ms); - assert(!status && "vkCopyMicromapEXT"); - return params.result; -} - -VkResult WINAPI vkCopyMicromapToMemoryEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapToMemoryInfoEXT *pInfo) -{ - struct vkCopyMicromapToMemoryEXT_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pInfo = pInfo; - status = UNIX_CALL(vkCopyMicromapToMemoryEXT, ¶ms); - assert(!status && "vkCopyMicromapToMemoryEXT"); - return params.result; -} - -VkResult WINAPI vkCreateAccelerationStructureKHR(VkDevice device, const VkAccelerationStructureCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkAccelerationStructureKHR *pAccelerationStructure) -{ - struct vkCreateAccelerationStructureKHR_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pAccelerationStructure = pAccelerationStructure; - status = UNIX_CALL(vkCreateAccelerationStructureKHR, ¶ms); - assert(!status && "vkCreateAccelerationStructureKHR"); - return params.result; -} - -VkResult WINAPI vkCreateAccelerationStructureNV(VkDevice device, const VkAccelerationStructureCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkAccelerationStructureNV *pAccelerationStructure) -{ - struct vkCreateAccelerationStructureNV_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pAccelerationStructure = pAccelerationStructure; - status = UNIX_CALL(vkCreateAccelerationStructureNV, ¶ms); - assert(!status && "vkCreateAccelerationStructureNV"); - return params.result; -} - -VkResult WINAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) -{ - struct vkCreateBuffer_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pBuffer = pBuffer; - status = UNIX_CALL(vkCreateBuffer, ¶ms); - assert(!status && "vkCreateBuffer"); - return params.result; -} - -VkResult WINAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBufferView *pView) -{ - struct vkCreateBufferView_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pView = pView; - status = UNIX_CALL(vkCreateBufferView, ¶ms); - assert(!status && "vkCreateBufferView"); - return params.result; -} - -VkResult WINAPI vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) -{ - struct vkCreateComputePipelines_params params; - NTSTATUS status; - params.device = device; - params.pipelineCache = pipelineCache; - params.createInfoCount = createInfoCount; - params.pCreateInfos = pCreateInfos; - params.pAllocator = pAllocator; - params.pPipelines = pPipelines; - status = UNIX_CALL(vkCreateComputePipelines, ¶ms); - assert(!status && "vkCreateComputePipelines"); - return params.result; -} - -VkResult WINAPI vkCreateCuFunctionNVX(VkDevice device, const VkCuFunctionCreateInfoNVX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCuFunctionNVX *pFunction) -{ - struct vkCreateCuFunctionNVX_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pFunction = pFunction; - status = UNIX_CALL(vkCreateCuFunctionNVX, ¶ms); - assert(!status && "vkCreateCuFunctionNVX"); - return params.result; -} - -VkResult WINAPI vkCreateCuModuleNVX(VkDevice device, const VkCuModuleCreateInfoNVX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCuModuleNVX *pModule) -{ - struct vkCreateCuModuleNVX_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pModule = pModule; - status = UNIX_CALL(vkCreateCuModuleNVX, ¶ms); - assert(!status && "vkCreateCuModuleNVX"); - return params.result; -} - -VkResult WINAPI vkCreateCudaFunctionNV(VkDevice device, const VkCudaFunctionCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCudaFunctionNV *pFunction) -{ - struct vkCreateCudaFunctionNV_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pFunction = pFunction; - status = UNIX_CALL(vkCreateCudaFunctionNV, ¶ms); - assert(!status && "vkCreateCudaFunctionNV"); - return params.result; -} - -VkResult WINAPI vkCreateCudaModuleNV(VkDevice device, const VkCudaModuleCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCudaModuleNV *pModule) -{ - struct vkCreateCudaModuleNV_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pModule = pModule; - status = UNIX_CALL(vkCreateCudaModuleNV, ¶ms); - assert(!status && "vkCreateCudaModuleNV"); - return params.result; -} - -VkResult WINAPI vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) -{ - struct vkCreateDebugReportCallbackEXT_params params; - NTSTATUS status; - params.instance = instance; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pCallback = pCallback; - status = UNIX_CALL(vkCreateDebugReportCallbackEXT, ¶ms); - assert(!status && "vkCreateDebugReportCallbackEXT"); - return params.result; -} - -VkResult WINAPI vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger) -{ - struct vkCreateDebugUtilsMessengerEXT_params params; - NTSTATUS status; - params.instance = instance; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pMessenger = pMessenger; - status = UNIX_CALL(vkCreateDebugUtilsMessengerEXT, ¶ms); - assert(!status && "vkCreateDebugUtilsMessengerEXT"); - return params.result; -} - -VkResult WINAPI vkCreateDeferredOperationKHR(VkDevice device, const VkAllocationCallbacks *pAllocator, VkDeferredOperationKHR *pDeferredOperation) -{ - struct vkCreateDeferredOperationKHR_params params; - NTSTATUS status; - params.device = device; - params.pAllocator = pAllocator; - params.pDeferredOperation = pDeferredOperation; - status = UNIX_CALL(vkCreateDeferredOperationKHR, ¶ms); - assert(!status && "vkCreateDeferredOperationKHR"); - return params.result; -} - -VkResult WINAPI vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) -{ - struct vkCreateDescriptorPool_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pDescriptorPool = pDescriptorPool; - status = UNIX_CALL(vkCreateDescriptorPool, ¶ms); - assert(!status && "vkCreateDescriptorPool"); - return params.result; -} - -VkResult WINAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout) -{ - struct vkCreateDescriptorSetLayout_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pSetLayout = pSetLayout; - status = UNIX_CALL(vkCreateDescriptorSetLayout, ¶ms); - assert(!status && "vkCreateDescriptorSetLayout"); - return params.result; -} - -VkResult WINAPI vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) -{ - struct vkCreateDescriptorUpdateTemplate_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pDescriptorUpdateTemplate = pDescriptorUpdateTemplate; - status = UNIX_CALL(vkCreateDescriptorUpdateTemplate, ¶ms); - assert(!status && "vkCreateDescriptorUpdateTemplate"); - return params.result; -} - -VkResult WINAPI vkCreateDescriptorUpdateTemplateKHR(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) -{ - struct vkCreateDescriptorUpdateTemplateKHR_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pDescriptorUpdateTemplate = pDescriptorUpdateTemplate; - status = UNIX_CALL(vkCreateDescriptorUpdateTemplateKHR, ¶ms); - assert(!status && "vkCreateDescriptorUpdateTemplateKHR"); - return params.result; -} - -VkResult WINAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) -{ - struct vkCreateEvent_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pEvent = pEvent; - status = UNIX_CALL(vkCreateEvent, ¶ms); - assert(!status && "vkCreateEvent"); - return params.result; -} - -VkResult WINAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) -{ - struct vkCreateFence_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pFence = pFence; - status = UNIX_CALL(vkCreateFence, ¶ms); - assert(!status && "vkCreateFence"); - return params.result; -} - -VkResult WINAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) -{ - struct vkCreateFramebuffer_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pFramebuffer = pFramebuffer; - status = UNIX_CALL(vkCreateFramebuffer, ¶ms); - assert(!status && "vkCreateFramebuffer"); - return params.result; -} - -VkResult WINAPI vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) -{ - struct vkCreateGraphicsPipelines_params params; - NTSTATUS status; - params.device = device; - params.pipelineCache = pipelineCache; - params.createInfoCount = createInfoCount; - params.pCreateInfos = pCreateInfos; - params.pAllocator = pAllocator; - params.pPipelines = pPipelines; - status = UNIX_CALL(vkCreateGraphicsPipelines, ¶ms); - assert(!status && "vkCreateGraphicsPipelines"); - return params.result; -} - -VkResult WINAPI vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage) -{ - struct vkCreateImage_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pImage = pImage; - status = UNIX_CALL(vkCreateImage, ¶ms); - assert(!status && "vkCreateImage"); - return params.result; -} - -VkResult WINAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView) -{ - struct vkCreateImageView_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pView = pView; - status = UNIX_CALL(vkCreateImageView, ¶ms); - assert(!status && "vkCreateImageView"); - return params.result; -} - -VkResult WINAPI vkCreateIndirectCommandsLayoutNV(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkIndirectCommandsLayoutNV *pIndirectCommandsLayout) -{ - struct vkCreateIndirectCommandsLayoutNV_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pIndirectCommandsLayout = pIndirectCommandsLayout; - status = UNIX_CALL(vkCreateIndirectCommandsLayoutNV, ¶ms); - assert(!status && "vkCreateIndirectCommandsLayoutNV"); - return params.result; -} - -VkResult WINAPI vkCreateMicromapEXT(VkDevice device, const VkMicromapCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkMicromapEXT *pMicromap) -{ - struct vkCreateMicromapEXT_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pMicromap = pMicromap; - status = UNIX_CALL(vkCreateMicromapEXT, ¶ms); - assert(!status && "vkCreateMicromapEXT"); - return params.result; -} - -VkResult WINAPI vkCreateOpticalFlowSessionNV(VkDevice device, const VkOpticalFlowSessionCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkOpticalFlowSessionNV *pSession) -{ - struct vkCreateOpticalFlowSessionNV_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pSession = pSession; - status = UNIX_CALL(vkCreateOpticalFlowSessionNV, ¶ms); - assert(!status && "vkCreateOpticalFlowSessionNV"); - return params.result; -} - -VkResult WINAPI vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) -{ - struct vkCreatePipelineCache_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pPipelineCache = pPipelineCache; - status = UNIX_CALL(vkCreatePipelineCache, ¶ms); - assert(!status && "vkCreatePipelineCache"); - return params.result; -} - -VkResult WINAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) -{ - struct vkCreatePipelineLayout_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pPipelineLayout = pPipelineLayout; - status = UNIX_CALL(vkCreatePipelineLayout, ¶ms); - assert(!status && "vkCreatePipelineLayout"); - return params.result; -} - -VkResult WINAPI vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPrivateDataSlot *pPrivateDataSlot) -{ - struct vkCreatePrivateDataSlot_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pPrivateDataSlot = pPrivateDataSlot; - status = UNIX_CALL(vkCreatePrivateDataSlot, ¶ms); - assert(!status && "vkCreatePrivateDataSlot"); - return params.result; -} - -VkResult WINAPI vkCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPrivateDataSlot *pPrivateDataSlot) -{ - struct vkCreatePrivateDataSlotEXT_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pPrivateDataSlot = pPrivateDataSlot; - status = UNIX_CALL(vkCreatePrivateDataSlotEXT, ¶ms); - assert(!status && "vkCreatePrivateDataSlotEXT"); - return params.result; -} - -VkResult WINAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) -{ - struct vkCreateQueryPool_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pQueryPool = pQueryPool; - status = UNIX_CALL(vkCreateQueryPool, ¶ms); - assert(!status && "vkCreateQueryPool"); - return params.result; -} - -VkResult WINAPI vkCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoKHR *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) -{ - struct vkCreateRayTracingPipelinesKHR_params params; - NTSTATUS status; - params.device = device; - params.deferredOperation = deferredOperation; - params.pipelineCache = pipelineCache; - params.createInfoCount = createInfoCount; - params.pCreateInfos = pCreateInfos; - params.pAllocator = pAllocator; - params.pPipelines = pPipelines; - status = UNIX_CALL(vkCreateRayTracingPipelinesKHR, ¶ms); - assert(!status && "vkCreateRayTracingPipelinesKHR"); - return params.result; -} - -VkResult WINAPI vkCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoNV *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) -{ - struct vkCreateRayTracingPipelinesNV_params params; - NTSTATUS status; - params.device = device; - params.pipelineCache = pipelineCache; - params.createInfoCount = createInfoCount; - params.pCreateInfos = pCreateInfos; - params.pAllocator = pAllocator; - params.pPipelines = pPipelines; - status = UNIX_CALL(vkCreateRayTracingPipelinesNV, ¶ms); - assert(!status && "vkCreateRayTracingPipelinesNV"); - return params.result; -} - -VkResult WINAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) -{ - struct vkCreateRenderPass_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pRenderPass = pRenderPass; - status = UNIX_CALL(vkCreateRenderPass, ¶ms); - assert(!status && "vkCreateRenderPass"); - return params.result; -} - -VkResult WINAPI vkCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) -{ - struct vkCreateRenderPass2_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pRenderPass = pRenderPass; - status = UNIX_CALL(vkCreateRenderPass2, ¶ms); - assert(!status && "vkCreateRenderPass2"); - return params.result; -} - -VkResult WINAPI vkCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) -{ - struct vkCreateRenderPass2KHR_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pRenderPass = pRenderPass; - status = UNIX_CALL(vkCreateRenderPass2KHR, ¶ms); - assert(!status && "vkCreateRenderPass2KHR"); - return params.result; -} - -VkResult WINAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) -{ - struct vkCreateSampler_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pSampler = pSampler; - status = UNIX_CALL(vkCreateSampler, ¶ms); - assert(!status && "vkCreateSampler"); - return params.result; -} - -VkResult WINAPI vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion) -{ - struct vkCreateSamplerYcbcrConversion_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pYcbcrConversion = pYcbcrConversion; - status = UNIX_CALL(vkCreateSamplerYcbcrConversion, ¶ms); - assert(!status && "vkCreateSamplerYcbcrConversion"); - return params.result; -} - -VkResult WINAPI vkCreateSamplerYcbcrConversionKHR(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion) -{ - struct vkCreateSamplerYcbcrConversionKHR_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pYcbcrConversion = pYcbcrConversion; - status = UNIX_CALL(vkCreateSamplerYcbcrConversionKHR, ¶ms); - assert(!status && "vkCreateSamplerYcbcrConversionKHR"); - return params.result; -} - -VkResult WINAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) -{ - struct vkCreateSemaphore_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pSemaphore = pSemaphore; - status = UNIX_CALL(vkCreateSemaphore, ¶ms); - assert(!status && "vkCreateSemaphore"); - return params.result; -} - -VkResult WINAPI vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) -{ - struct vkCreateShaderModule_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pShaderModule = pShaderModule; - status = UNIX_CALL(vkCreateShaderModule, ¶ms); - assert(!status && "vkCreateShaderModule"); - return params.result; -} - -VkResult WINAPI vkCreateShadersEXT(VkDevice device, uint32_t createInfoCount, const VkShaderCreateInfoEXT *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkShaderEXT *pShaders) -{ - struct vkCreateShadersEXT_params params; - NTSTATUS status; - params.device = device; - params.createInfoCount = createInfoCount; - params.pCreateInfos = pCreateInfos; - params.pAllocator = pAllocator; - params.pShaders = pShaders; - status = UNIX_CALL(vkCreateShadersEXT, ¶ms); - assert(!status && "vkCreateShadersEXT"); - return params.result; -} - -VkResult WINAPI vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) -{ - struct vkCreateSwapchainKHR_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pSwapchain = pSwapchain; - status = UNIX_CALL(vkCreateSwapchainKHR, ¶ms); - assert(!status && "vkCreateSwapchainKHR"); - return params.result; -} - -VkResult WINAPI vkCreateValidationCacheEXT(VkDevice device, const VkValidationCacheCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkValidationCacheEXT *pValidationCache) -{ - struct vkCreateValidationCacheEXT_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pValidationCache = pValidationCache; - status = UNIX_CALL(vkCreateValidationCacheEXT, ¶ms); - assert(!status && "vkCreateValidationCacheEXT"); - return params.result; -} - -VkResult WINAPI vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) -{ - struct vkCreateWin32SurfaceKHR_params params; - NTSTATUS status; - params.instance = instance; - params.pCreateInfo = pCreateInfo; - params.pAllocator = pAllocator; - params.pSurface = pSurface; - status = UNIX_CALL(vkCreateWin32SurfaceKHR, ¶ms); - assert(!status && "vkCreateWin32SurfaceKHR"); - return params.result; -} - -VkResult WINAPI vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) -{ - struct vkDebugMarkerSetObjectNameEXT_params params; - NTSTATUS status; - params.device = device; - params.pNameInfo = pNameInfo; - status = UNIX_CALL(vkDebugMarkerSetObjectNameEXT, ¶ms); - assert(!status && "vkDebugMarkerSetObjectNameEXT"); - return params.result; -} - -VkResult WINAPI vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) -{ - struct vkDebugMarkerSetObjectTagEXT_params params; - NTSTATUS status; - params.device = device; - params.pTagInfo = pTagInfo; - status = UNIX_CALL(vkDebugMarkerSetObjectTagEXT, ¶ms); - assert(!status && "vkDebugMarkerSetObjectTagEXT"); - return params.result; -} - -void WINAPI vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage) -{ - struct vkDebugReportMessageEXT_params params; - NTSTATUS status; - params.instance = instance; - params.flags = flags; - params.objectType = objectType; - params.object = object; - params.location = location; - params.messageCode = messageCode; - params.pLayerPrefix = pLayerPrefix; - params.pMessage = pMessage; - status = UNIX_CALL(vkDebugReportMessageEXT, ¶ms); - assert(!status && "vkDebugReportMessageEXT"); -} - -VkResult WINAPI vkDeferredOperationJoinKHR(VkDevice device, VkDeferredOperationKHR operation) -{ - struct vkDeferredOperationJoinKHR_params params; - NTSTATUS status; - params.device = device; - params.operation = operation; - status = UNIX_CALL(vkDeferredOperationJoinKHR, ¶ms); - assert(!status && "vkDeferredOperationJoinKHR"); - return params.result; -} - -void WINAPI vkDestroyAccelerationStructureKHR(VkDevice device, VkAccelerationStructureKHR accelerationStructure, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyAccelerationStructureKHR_params params; - NTSTATUS status; - params.device = device; - params.accelerationStructure = accelerationStructure; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyAccelerationStructureKHR, ¶ms); - assert(!status && "vkDestroyAccelerationStructureKHR"); -} - -void WINAPI vkDestroyAccelerationStructureNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyAccelerationStructureNV_params params; - NTSTATUS status; - params.device = device; - params.accelerationStructure = accelerationStructure; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyAccelerationStructureNV, ¶ms); - assert(!status && "vkDestroyAccelerationStructureNV"); -} - -void WINAPI vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyBuffer_params params; - NTSTATUS status; - params.device = device; - params.buffer = buffer; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyBuffer, ¶ms); - assert(!status && "vkDestroyBuffer"); -} - -void WINAPI vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyBufferView_params params; - NTSTATUS status; - params.device = device; - params.bufferView = bufferView; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyBufferView, ¶ms); - assert(!status && "vkDestroyBufferView"); -} - -void WINAPI vkDestroyCuFunctionNVX(VkDevice device, VkCuFunctionNVX function, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyCuFunctionNVX_params params; - NTSTATUS status; - params.device = device; - params.function = function; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyCuFunctionNVX, ¶ms); - assert(!status && "vkDestroyCuFunctionNVX"); -} - -void WINAPI vkDestroyCuModuleNVX(VkDevice device, VkCuModuleNVX module, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyCuModuleNVX_params params; - NTSTATUS status; - params.device = device; - params.module = module; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyCuModuleNVX, ¶ms); - assert(!status && "vkDestroyCuModuleNVX"); -} - -void WINAPI vkDestroyCudaFunctionNV(VkDevice device, VkCudaFunctionNV function, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyCudaFunctionNV_params params; - NTSTATUS status; - params.device = device; - params.function = function; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyCudaFunctionNV, ¶ms); - assert(!status && "vkDestroyCudaFunctionNV"); -} - -void WINAPI vkDestroyCudaModuleNV(VkDevice device, VkCudaModuleNV module, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyCudaModuleNV_params params; - NTSTATUS status; - params.device = device; - params.module = module; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyCudaModuleNV, ¶ms); - assert(!status && "vkDestroyCudaModuleNV"); -} - -void WINAPI vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDebugReportCallbackEXT_params params; - NTSTATUS status; - params.instance = instance; - params.callback = callback; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDebugReportCallbackEXT, ¶ms); - assert(!status && "vkDestroyDebugReportCallbackEXT"); -} - -void WINAPI vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDebugUtilsMessengerEXT_params params; - NTSTATUS status; - params.instance = instance; - params.messenger = messenger; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDebugUtilsMessengerEXT, ¶ms); - assert(!status && "vkDestroyDebugUtilsMessengerEXT"); -} - -void WINAPI vkDestroyDeferredOperationKHR(VkDevice device, VkDeferredOperationKHR operation, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDeferredOperationKHR_params params; - NTSTATUS status; - params.device = device; - params.operation = operation; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDeferredOperationKHR, ¶ms); - assert(!status && "vkDestroyDeferredOperationKHR"); -} - -void WINAPI vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDescriptorPool_params params; - NTSTATUS status; - params.device = device; - params.descriptorPool = descriptorPool; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDescriptorPool, ¶ms); - assert(!status && "vkDestroyDescriptorPool"); -} - -void WINAPI vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDescriptorSetLayout_params params; - NTSTATUS status; - params.device = device; - params.descriptorSetLayout = descriptorSetLayout; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDescriptorSetLayout, ¶ms); - assert(!status && "vkDestroyDescriptorSetLayout"); -} - -void WINAPI vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDescriptorUpdateTemplate_params params; - NTSTATUS status; - params.device = device; - params.descriptorUpdateTemplate = descriptorUpdateTemplate; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDescriptorUpdateTemplate, ¶ms); - assert(!status && "vkDestroyDescriptorUpdateTemplate"); -} - -void WINAPI vkDestroyDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyDescriptorUpdateTemplateKHR_params params; - NTSTATUS status; - params.device = device; - params.descriptorUpdateTemplate = descriptorUpdateTemplate; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyDescriptorUpdateTemplateKHR, ¶ms); - assert(!status && "vkDestroyDescriptorUpdateTemplateKHR"); -} - -void WINAPI vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyEvent_params params; - NTSTATUS status; - params.device = device; - params.event = event; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyEvent, ¶ms); - assert(!status && "vkDestroyEvent"); -} - -void WINAPI vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyFence_params params; - NTSTATUS status; - params.device = device; - params.fence = fence; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyFence, ¶ms); - assert(!status && "vkDestroyFence"); -} - -void WINAPI vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyFramebuffer_params params; - NTSTATUS status; - params.device = device; - params.framebuffer = framebuffer; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyFramebuffer, ¶ms); - assert(!status && "vkDestroyFramebuffer"); -} - -void WINAPI vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyImage_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyImage, ¶ms); - assert(!status && "vkDestroyImage"); -} - -void WINAPI vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyImageView_params params; - NTSTATUS status; - params.device = device; - params.imageView = imageView; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyImageView, ¶ms); - assert(!status && "vkDestroyImageView"); -} - -void WINAPI vkDestroyIndirectCommandsLayoutNV(VkDevice device, VkIndirectCommandsLayoutNV indirectCommandsLayout, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyIndirectCommandsLayoutNV_params params; - NTSTATUS status; - params.device = device; - params.indirectCommandsLayout = indirectCommandsLayout; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyIndirectCommandsLayoutNV, ¶ms); - assert(!status && "vkDestroyIndirectCommandsLayoutNV"); -} - -void WINAPI vkDestroyMicromapEXT(VkDevice device, VkMicromapEXT micromap, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyMicromapEXT_params params; - NTSTATUS status; - params.device = device; - params.micromap = micromap; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyMicromapEXT, ¶ms); - assert(!status && "vkDestroyMicromapEXT"); -} - -void WINAPI vkDestroyOpticalFlowSessionNV(VkDevice device, VkOpticalFlowSessionNV session, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyOpticalFlowSessionNV_params params; - NTSTATUS status; - params.device = device; - params.session = session; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyOpticalFlowSessionNV, ¶ms); - assert(!status && "vkDestroyOpticalFlowSessionNV"); -} - -void WINAPI vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyPipeline_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyPipeline, ¶ms); - assert(!status && "vkDestroyPipeline"); -} - -void WINAPI vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyPipelineCache_params params; - NTSTATUS status; - params.device = device; - params.pipelineCache = pipelineCache; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyPipelineCache, ¶ms); - assert(!status && "vkDestroyPipelineCache"); -} - -void WINAPI vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyPipelineLayout_params params; - NTSTATUS status; - params.device = device; - params.pipelineLayout = pipelineLayout; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyPipelineLayout, ¶ms); - assert(!status && "vkDestroyPipelineLayout"); -} - -void WINAPI vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyPrivateDataSlot_params params; - NTSTATUS status; - params.device = device; - params.privateDataSlot = privateDataSlot; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyPrivateDataSlot, ¶ms); - assert(!status && "vkDestroyPrivateDataSlot"); -} - -void WINAPI vkDestroyPrivateDataSlotEXT(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyPrivateDataSlotEXT_params params; - NTSTATUS status; - params.device = device; - params.privateDataSlot = privateDataSlot; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyPrivateDataSlotEXT, ¶ms); - assert(!status && "vkDestroyPrivateDataSlotEXT"); -} - -void WINAPI vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyQueryPool_params params; - NTSTATUS status; - params.device = device; - params.queryPool = queryPool; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyQueryPool, ¶ms); - assert(!status && "vkDestroyQueryPool"); -} - -void WINAPI vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyRenderPass_params params; - NTSTATUS status; - params.device = device; - params.renderPass = renderPass; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyRenderPass, ¶ms); - assert(!status && "vkDestroyRenderPass"); -} - -void WINAPI vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroySampler_params params; - NTSTATUS status; - params.device = device; - params.sampler = sampler; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroySampler, ¶ms); - assert(!status && "vkDestroySampler"); -} - -void WINAPI vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroySamplerYcbcrConversion_params params; - NTSTATUS status; - params.device = device; - params.ycbcrConversion = ycbcrConversion; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroySamplerYcbcrConversion, ¶ms); - assert(!status && "vkDestroySamplerYcbcrConversion"); -} - -void WINAPI vkDestroySamplerYcbcrConversionKHR(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroySamplerYcbcrConversionKHR_params params; - NTSTATUS status; - params.device = device; - params.ycbcrConversion = ycbcrConversion; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroySamplerYcbcrConversionKHR, ¶ms); - assert(!status && "vkDestroySamplerYcbcrConversionKHR"); -} - -void WINAPI vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroySemaphore_params params; - NTSTATUS status; - params.device = device; - params.semaphore = semaphore; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroySemaphore, ¶ms); - assert(!status && "vkDestroySemaphore"); -} - -void WINAPI vkDestroyShaderEXT(VkDevice device, VkShaderEXT shader, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyShaderEXT_params params; - NTSTATUS status; - params.device = device; - params.shader = shader; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyShaderEXT, ¶ms); - assert(!status && "vkDestroyShaderEXT"); -} - -void WINAPI vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyShaderModule_params params; - NTSTATUS status; - params.device = device; - params.shaderModule = shaderModule; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyShaderModule, ¶ms); - assert(!status && "vkDestroyShaderModule"); -} - -void WINAPI vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroySurfaceKHR_params params; - NTSTATUS status; - params.instance = instance; - params.surface = surface; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroySurfaceKHR, ¶ms); - assert(!status && "vkDestroySurfaceKHR"); -} - -void WINAPI vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroySwapchainKHR_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroySwapchainKHR, ¶ms); - assert(!status && "vkDestroySwapchainKHR"); -} - -void WINAPI vkDestroyValidationCacheEXT(VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks *pAllocator) -{ - struct vkDestroyValidationCacheEXT_params params; - NTSTATUS status; - params.device = device; - params.validationCache = validationCache; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkDestroyValidationCacheEXT, ¶ms); - assert(!status && "vkDestroyValidationCacheEXT"); -} - -VkResult WINAPI vkDeviceWaitIdle(VkDevice device) -{ - struct vkDeviceWaitIdle_params params; - NTSTATUS status; - params.device = device; - status = UNIX_CALL(vkDeviceWaitIdle, ¶ms); - assert(!status && "vkDeviceWaitIdle"); - return params.result; -} - -VkResult WINAPI vkEndCommandBuffer(VkCommandBuffer commandBuffer) -{ - struct vkEndCommandBuffer_params params; - NTSTATUS status; - params.commandBuffer = commandBuffer; - status = UNIX_CALL(vkEndCommandBuffer, ¶ms); - assert(!status && "vkEndCommandBuffer"); - return params.result; -} - -VkResult WINAPI vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) -{ - struct vkEnumerateDeviceExtensionProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pLayerName = pLayerName; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkEnumerateDeviceExtensionProperties, ¶ms); - assert(!status && "vkEnumerateDeviceExtensionProperties"); - return params.result; -} - -VkResult WINAPI vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties) -{ - struct vkEnumerateDeviceLayerProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkEnumerateDeviceLayerProperties, ¶ms); - assert(!status && "vkEnumerateDeviceLayerProperties"); - return params.result; -} - -VkResult WINAPI vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) -{ - struct vkEnumeratePhysicalDeviceGroups_params params; - NTSTATUS status; - params.instance = instance; - params.pPhysicalDeviceGroupCount = pPhysicalDeviceGroupCount; - params.pPhysicalDeviceGroupProperties = pPhysicalDeviceGroupProperties; - status = UNIX_CALL(vkEnumeratePhysicalDeviceGroups, ¶ms); - assert(!status && "vkEnumeratePhysicalDeviceGroups"); - return params.result; -} - -VkResult WINAPI vkEnumeratePhysicalDeviceGroupsKHR(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) -{ - struct vkEnumeratePhysicalDeviceGroupsKHR_params params; - NTSTATUS status; - params.instance = instance; - params.pPhysicalDeviceGroupCount = pPhysicalDeviceGroupCount; - params.pPhysicalDeviceGroupProperties = pPhysicalDeviceGroupProperties; - status = UNIX_CALL(vkEnumeratePhysicalDeviceGroupsKHR, ¶ms); - assert(!status && "vkEnumeratePhysicalDeviceGroupsKHR"); - return params.result; -} - -VkResult WINAPI vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, uint32_t *pCounterCount, VkPerformanceCounterKHR *pCounters, VkPerformanceCounterDescriptionKHR *pCounterDescriptions) -{ - struct vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.queueFamilyIndex = queueFamilyIndex; - params.pCounterCount = pCounterCount; - params.pCounters = pCounters; - params.pCounterDescriptions = pCounterDescriptions; - status = UNIX_CALL(vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, ¶ms); - assert(!status && "vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR"); - return params.result; -} - -VkResult WINAPI vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) -{ - struct vkEnumeratePhysicalDevices_params params; - NTSTATUS status; - params.instance = instance; - params.pPhysicalDeviceCount = pPhysicalDeviceCount; - params.pPhysicalDevices = pPhysicalDevices; - status = UNIX_CALL(vkEnumeratePhysicalDevices, ¶ms); - assert(!status && "vkEnumeratePhysicalDevices"); - return params.result; -} - -VkResult WINAPI vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) -{ - struct vkFlushMappedMemoryRanges_params params; - NTSTATUS status; - params.device = device; - params.memoryRangeCount = memoryRangeCount; - params.pMemoryRanges = pMemoryRanges; - status = UNIX_CALL(vkFlushMappedMemoryRanges, ¶ms); - assert(!status && "vkFlushMappedMemoryRanges"); - return params.result; -} - -VkResult WINAPI vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets) -{ - struct vkFreeDescriptorSets_params params; - NTSTATUS status; - params.device = device; - params.descriptorPool = descriptorPool; - params.descriptorSetCount = descriptorSetCount; - params.pDescriptorSets = pDescriptorSets; - status = UNIX_CALL(vkFreeDescriptorSets, ¶ms); - assert(!status && "vkFreeDescriptorSets"); - return params.result; -} - -void WINAPI vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) -{ - struct vkFreeMemory_params params; - NTSTATUS status; - params.device = device; - params.memory = memory; - params.pAllocator = pAllocator; - status = UNIX_CALL(vkFreeMemory, ¶ms); - assert(!status && "vkFreeMemory"); -} - -void WINAPI vkGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo, const uint32_t *pMaxPrimitiveCounts, VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) -{ - struct vkGetAccelerationStructureBuildSizesKHR_params params; - NTSTATUS status; - params.device = device; - params.buildType = buildType; - params.pBuildInfo = pBuildInfo; - params.pMaxPrimitiveCounts = pMaxPrimitiveCounts; - params.pSizeInfo = pSizeInfo; - status = UNIX_CALL(vkGetAccelerationStructureBuildSizesKHR, ¶ms); - assert(!status && "vkGetAccelerationStructureBuildSizesKHR"); -} - -VkDeviceAddress WINAPI vkGetAccelerationStructureDeviceAddressKHR(VkDevice device, const VkAccelerationStructureDeviceAddressInfoKHR *pInfo) -{ - struct vkGetAccelerationStructureDeviceAddressKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetAccelerationStructureDeviceAddressKHR, ¶ms); - assert(!status && "vkGetAccelerationStructureDeviceAddressKHR"); - return params.result; -} - -VkResult WINAPI vkGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, size_t dataSize, void *pData) -{ - struct vkGetAccelerationStructureHandleNV_params params; - NTSTATUS status; - params.device = device; - params.accelerationStructure = accelerationStructure; - params.dataSize = dataSize; - params.pData = pData; - status = UNIX_CALL(vkGetAccelerationStructureHandleNV, ¶ms); - assert(!status && "vkGetAccelerationStructureHandleNV"); - return params.result; -} - -void WINAPI vkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNV *pInfo, VkMemoryRequirements2KHR *pMemoryRequirements) -{ - struct vkGetAccelerationStructureMemoryRequirementsNV_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetAccelerationStructureMemoryRequirementsNV, ¶ms); - assert(!status && "vkGetAccelerationStructureMemoryRequirementsNV"); -} - -VkResult WINAPI vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkAccelerationStructureCaptureDescriptorDataInfoEXT *pInfo, void *pData) -{ - struct vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pData = pData; - status = UNIX_CALL(vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT, ¶ms); - assert(!status && "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT"); - return params.result; -} - -VkDeviceAddress WINAPI vkGetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) -{ - struct vkGetBufferDeviceAddress_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetBufferDeviceAddress, ¶ms); - assert(!status && "vkGetBufferDeviceAddress"); - return params.result; -} - -VkDeviceAddress WINAPI vkGetBufferDeviceAddressEXT(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) -{ - struct vkGetBufferDeviceAddressEXT_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetBufferDeviceAddressEXT, ¶ms); - assert(!status && "vkGetBufferDeviceAddressEXT"); - return params.result; -} - -VkDeviceAddress WINAPI vkGetBufferDeviceAddressKHR(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) -{ - struct vkGetBufferDeviceAddressKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetBufferDeviceAddressKHR, ¶ms); - assert(!status && "vkGetBufferDeviceAddressKHR"); - return params.result; -} - -void WINAPI vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements) -{ - struct vkGetBufferMemoryRequirements_params params; - NTSTATUS status; - params.device = device; - params.buffer = buffer; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetBufferMemoryRequirements, ¶ms); - assert(!status && "vkGetBufferMemoryRequirements"); -} - -void WINAPI vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetBufferMemoryRequirements2_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetBufferMemoryRequirements2, ¶ms); - assert(!status && "vkGetBufferMemoryRequirements2"); -} - -void WINAPI vkGetBufferMemoryRequirements2KHR(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetBufferMemoryRequirements2KHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetBufferMemoryRequirements2KHR, ¶ms); - assert(!status && "vkGetBufferMemoryRequirements2KHR"); -} - -uint64_t WINAPI vkGetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) -{ - struct vkGetBufferOpaqueCaptureAddress_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetBufferOpaqueCaptureAddress, ¶ms); - assert(!status && "vkGetBufferOpaqueCaptureAddress"); - return params.result; -} - -uint64_t WINAPI vkGetBufferOpaqueCaptureAddressKHR(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) -{ - struct vkGetBufferOpaqueCaptureAddressKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetBufferOpaqueCaptureAddressKHR, ¶ms); - assert(!status && "vkGetBufferOpaqueCaptureAddressKHR"); - return params.result; -} - -VkResult WINAPI vkGetBufferOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkBufferCaptureDescriptorDataInfoEXT *pInfo, void *pData) -{ - struct vkGetBufferOpaqueCaptureDescriptorDataEXT_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pData = pData; - status = UNIX_CALL(vkGetBufferOpaqueCaptureDescriptorDataEXT, ¶ms); - assert(!status && "vkGetBufferOpaqueCaptureDescriptorDataEXT"); - return params.result; -} - -VkResult WINAPI vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT *pTimestampInfos, uint64_t *pTimestamps, uint64_t *pMaxDeviation) -{ - struct vkGetCalibratedTimestampsEXT_params params; - NTSTATUS status; - params.device = device; - params.timestampCount = timestampCount; - params.pTimestampInfos = pTimestampInfos; - params.pTimestamps = pTimestamps; - params.pMaxDeviation = pMaxDeviation; - status = UNIX_CALL(vkGetCalibratedTimestampsEXT, ¶ms); - assert(!status && "vkGetCalibratedTimestampsEXT"); - return params.result; -} - -VkResult WINAPI vkGetCudaModuleCacheNV(VkDevice device, VkCudaModuleNV module, size_t *pCacheSize, void *pCacheData) -{ - struct vkGetCudaModuleCacheNV_params params; - NTSTATUS status; - params.device = device; - params.module = module; - params.pCacheSize = pCacheSize; - params.pCacheData = pCacheData; - status = UNIX_CALL(vkGetCudaModuleCacheNV, ¶ms); - assert(!status && "vkGetCudaModuleCacheNV"); - return params.result; -} - -uint32_t WINAPI vkGetDeferredOperationMaxConcurrencyKHR(VkDevice device, VkDeferredOperationKHR operation) -{ - struct vkGetDeferredOperationMaxConcurrencyKHR_params params; - NTSTATUS status; - params.device = device; - params.operation = operation; - status = UNIX_CALL(vkGetDeferredOperationMaxConcurrencyKHR, ¶ms); - assert(!status && "vkGetDeferredOperationMaxConcurrencyKHR"); - return params.result; -} - -VkResult WINAPI vkGetDeferredOperationResultKHR(VkDevice device, VkDeferredOperationKHR operation) -{ - struct vkGetDeferredOperationResultKHR_params params; - NTSTATUS status; - params.device = device; - params.operation = operation; - status = UNIX_CALL(vkGetDeferredOperationResultKHR, ¶ms); - assert(!status && "vkGetDeferredOperationResultKHR"); - return params.result; -} - -void WINAPI vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInfoEXT *pDescriptorInfo, size_t dataSize, void *pDescriptor) -{ - struct vkGetDescriptorEXT_params params; - params.device = device; - params.pDescriptorInfo = pDescriptorInfo; - params.dataSize = dataSize; - params.pDescriptor = pDescriptor; - UNIX_CALL(vkGetDescriptorEXT, ¶ms); -} - -void WINAPI vkGetDescriptorSetHostMappingVALVE(VkDevice device, VkDescriptorSet descriptorSet, void **ppData) -{ - struct vkGetDescriptorSetHostMappingVALVE_params params; - NTSTATUS status; - params.device = device; - params.descriptorSet = descriptorSet; - params.ppData = ppData; - status = UNIX_CALL(vkGetDescriptorSetHostMappingVALVE, ¶ms); - assert(!status && "vkGetDescriptorSetHostMappingVALVE"); -} - -void WINAPI vkGetDescriptorSetLayoutBindingOffsetEXT(VkDevice device, VkDescriptorSetLayout layout, uint32_t binding, VkDeviceSize *pOffset) -{ - struct vkGetDescriptorSetLayoutBindingOffsetEXT_params params; - NTSTATUS status; - params.device = device; - params.layout = layout; - params.binding = binding; - params.pOffset = pOffset; - status = UNIX_CALL(vkGetDescriptorSetLayoutBindingOffsetEXT, ¶ms); - assert(!status && "vkGetDescriptorSetLayoutBindingOffsetEXT"); -} - -void WINAPI vkGetDescriptorSetLayoutHostMappingInfoVALVE(VkDevice device, const VkDescriptorSetBindingReferenceVALVE *pBindingReference, VkDescriptorSetLayoutHostMappingInfoVALVE *pHostMapping) -{ - struct vkGetDescriptorSetLayoutHostMappingInfoVALVE_params params; - NTSTATUS status; - params.device = device; - params.pBindingReference = pBindingReference; - params.pHostMapping = pHostMapping; - status = UNIX_CALL(vkGetDescriptorSetLayoutHostMappingInfoVALVE, ¶ms); - assert(!status && "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); -} - -void WINAPI vkGetDescriptorSetLayoutSizeEXT(VkDevice device, VkDescriptorSetLayout layout, VkDeviceSize *pLayoutSizeInBytes) -{ - struct vkGetDescriptorSetLayoutSizeEXT_params params; - NTSTATUS status; - params.device = device; - params.layout = layout; - params.pLayoutSizeInBytes = pLayoutSizeInBytes; - status = UNIX_CALL(vkGetDescriptorSetLayoutSizeEXT, ¶ms); - assert(!status && "vkGetDescriptorSetLayoutSizeEXT"); -} - -void WINAPI vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport) -{ - struct vkGetDescriptorSetLayoutSupport_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pSupport = pSupport; - status = UNIX_CALL(vkGetDescriptorSetLayoutSupport, ¶ms); - assert(!status && "vkGetDescriptorSetLayoutSupport"); -} - -void WINAPI vkGetDescriptorSetLayoutSupportKHR(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport) -{ - struct vkGetDescriptorSetLayoutSupportKHR_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pSupport = pSupport; - status = UNIX_CALL(vkGetDescriptorSetLayoutSupportKHR, ¶ms); - assert(!status && "vkGetDescriptorSetLayoutSupportKHR"); -} - -void WINAPI vkGetDeviceAccelerationStructureCompatibilityKHR(VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo, VkAccelerationStructureCompatibilityKHR *pCompatibility) -{ - struct vkGetDeviceAccelerationStructureCompatibilityKHR_params params; - NTSTATUS status; - params.device = device; - params.pVersionInfo = pVersionInfo; - params.pCompatibility = pCompatibility; - status = UNIX_CALL(vkGetDeviceAccelerationStructureCompatibilityKHR, ¶ms); - assert(!status && "vkGetDeviceAccelerationStructureCompatibilityKHR"); -} - -void WINAPI vkGetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetDeviceBufferMemoryRequirements_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetDeviceBufferMemoryRequirements, ¶ms); - assert(!status && "vkGetDeviceBufferMemoryRequirements"); -} - -void WINAPI vkGetDeviceBufferMemoryRequirementsKHR(VkDevice device, const VkDeviceBufferMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetDeviceBufferMemoryRequirementsKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetDeviceBufferMemoryRequirementsKHR, ¶ms); - assert(!status && "vkGetDeviceBufferMemoryRequirementsKHR"); -} - -VkResult WINAPI vkGetDeviceFaultInfoEXT(VkDevice device, VkDeviceFaultCountsEXT *pFaultCounts, VkDeviceFaultInfoEXT *pFaultInfo) -{ - struct vkGetDeviceFaultInfoEXT_params params; - NTSTATUS status; - params.device = device; - params.pFaultCounts = pFaultCounts; - params.pFaultInfo = pFaultInfo; - status = UNIX_CALL(vkGetDeviceFaultInfoEXT, ¶ms); - assert(!status && "vkGetDeviceFaultInfoEXT"); - return params.result; -} - -void WINAPI vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) -{ - struct vkGetDeviceGroupPeerMemoryFeatures_params params; - NTSTATUS status; - params.device = device; - params.heapIndex = heapIndex; - params.localDeviceIndex = localDeviceIndex; - params.remoteDeviceIndex = remoteDeviceIndex; - params.pPeerMemoryFeatures = pPeerMemoryFeatures; - status = UNIX_CALL(vkGetDeviceGroupPeerMemoryFeatures, ¶ms); - assert(!status && "vkGetDeviceGroupPeerMemoryFeatures"); -} - -void WINAPI vkGetDeviceGroupPeerMemoryFeaturesKHR(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) -{ - struct vkGetDeviceGroupPeerMemoryFeaturesKHR_params params; - NTSTATUS status; - params.device = device; - params.heapIndex = heapIndex; - params.localDeviceIndex = localDeviceIndex; - params.remoteDeviceIndex = remoteDeviceIndex; - params.pPeerMemoryFeatures = pPeerMemoryFeatures; - status = UNIX_CALL(vkGetDeviceGroupPeerMemoryFeaturesKHR, ¶ms); - assert(!status && "vkGetDeviceGroupPeerMemoryFeaturesKHR"); -} - -VkResult WINAPI vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities) -{ - struct vkGetDeviceGroupPresentCapabilitiesKHR_params params; - NTSTATUS status; - params.device = device; - params.pDeviceGroupPresentCapabilities = pDeviceGroupPresentCapabilities; - status = UNIX_CALL(vkGetDeviceGroupPresentCapabilitiesKHR, ¶ms); - assert(!status && "vkGetDeviceGroupPresentCapabilitiesKHR"); - return params.result; -} - -VkResult WINAPI vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes) -{ - struct vkGetDeviceGroupSurfacePresentModesKHR_params params; - NTSTATUS status; - params.device = device; - params.surface = surface; - params.pModes = pModes; - status = UNIX_CALL(vkGetDeviceGroupSurfacePresentModesKHR, ¶ms); - assert(!status && "vkGetDeviceGroupSurfacePresentModesKHR"); - return params.result; -} - -void WINAPI vkGetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetDeviceImageMemoryRequirements_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetDeviceImageMemoryRequirements, ¶ms); - assert(!status && "vkGetDeviceImageMemoryRequirements"); -} - -void WINAPI vkGetDeviceImageMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetDeviceImageMemoryRequirementsKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetDeviceImageMemoryRequirementsKHR, ¶ms); - assert(!status && "vkGetDeviceImageMemoryRequirementsKHR"); -} - -void WINAPI vkGetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) -{ - struct vkGetDeviceImageSparseMemoryRequirements_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pSparseMemoryRequirementCount = pSparseMemoryRequirementCount; - params.pSparseMemoryRequirements = pSparseMemoryRequirements; - status = UNIX_CALL(vkGetDeviceImageSparseMemoryRequirements, ¶ms); - assert(!status && "vkGetDeviceImageSparseMemoryRequirements"); -} - -void WINAPI vkGetDeviceImageSparseMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) -{ - struct vkGetDeviceImageSparseMemoryRequirementsKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pSparseMemoryRequirementCount = pSparseMemoryRequirementCount; - params.pSparseMemoryRequirements = pSparseMemoryRequirements; - status = UNIX_CALL(vkGetDeviceImageSparseMemoryRequirementsKHR, ¶ms); - assert(!status && "vkGetDeviceImageSparseMemoryRequirementsKHR"); -} - -void WINAPI vkGetDeviceImageSubresourceLayoutKHR(VkDevice device, const VkDeviceImageSubresourceInfoKHR *pInfo, VkSubresourceLayout2KHR *pLayout) -{ - struct vkGetDeviceImageSubresourceLayoutKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pLayout = pLayout; - status = UNIX_CALL(vkGetDeviceImageSubresourceLayoutKHR, ¶ms); - assert(!status && "vkGetDeviceImageSubresourceLayoutKHR"); -} - -void WINAPI vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes) -{ - struct vkGetDeviceMemoryCommitment_params params; - NTSTATUS status; - params.device = device; - params.memory = memory; - params.pCommittedMemoryInBytes = pCommittedMemoryInBytes; - status = UNIX_CALL(vkGetDeviceMemoryCommitment, ¶ms); - assert(!status && "vkGetDeviceMemoryCommitment"); -} - -uint64_t WINAPI vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo) -{ - struct vkGetDeviceMemoryOpaqueCaptureAddress_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetDeviceMemoryOpaqueCaptureAddress, ¶ms); - assert(!status && "vkGetDeviceMemoryOpaqueCaptureAddress"); - return params.result; -} - -uint64_t WINAPI vkGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo) -{ - struct vkGetDeviceMemoryOpaqueCaptureAddressKHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetDeviceMemoryOpaqueCaptureAddressKHR, ¶ms); - assert(!status && "vkGetDeviceMemoryOpaqueCaptureAddressKHR"); - return params.result; -} - -void WINAPI vkGetDeviceMicromapCompatibilityEXT(VkDevice device, const VkMicromapVersionInfoEXT *pVersionInfo, VkAccelerationStructureCompatibilityKHR *pCompatibility) -{ - struct vkGetDeviceMicromapCompatibilityEXT_params params; - NTSTATUS status; - params.device = device; - params.pVersionInfo = pVersionInfo; - params.pCompatibility = pCompatibility; - status = UNIX_CALL(vkGetDeviceMicromapCompatibilityEXT, ¶ms); - assert(!status && "vkGetDeviceMicromapCompatibilityEXT"); -} - -void WINAPI vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) -{ - struct vkGetDeviceQueue_params params; - NTSTATUS status; - params.device = device; - params.queueFamilyIndex = queueFamilyIndex; - params.queueIndex = queueIndex; - params.pQueue = pQueue; - status = UNIX_CALL(vkGetDeviceQueue, ¶ms); - assert(!status && "vkGetDeviceQueue"); -} - -void WINAPI vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) -{ - struct vkGetDeviceQueue2_params params; - NTSTATUS status; - params.device = device; - params.pQueueInfo = pQueueInfo; - params.pQueue = pQueue; - status = UNIX_CALL(vkGetDeviceQueue2, ¶ms); - assert(!status && "vkGetDeviceQueue2"); -} - -VkResult WINAPI vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(VkDevice device, VkRenderPass renderpass, VkExtent2D *pMaxWorkgroupSize) -{ - struct vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI_params params; - NTSTATUS status; - params.device = device; - params.renderpass = renderpass; - params.pMaxWorkgroupSize = pMaxWorkgroupSize; - status = UNIX_CALL(vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI, ¶ms); - assert(!status && "vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI"); - return params.result; -} - -VkResult WINAPI vkGetDynamicRenderingTilePropertiesQCOM(VkDevice device, const VkRenderingInfo *pRenderingInfo, VkTilePropertiesQCOM *pProperties) -{ - struct vkGetDynamicRenderingTilePropertiesQCOM_params params; - NTSTATUS status; - params.device = device; - params.pRenderingInfo = pRenderingInfo; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetDynamicRenderingTilePropertiesQCOM, ¶ms); - assert(!status && "vkGetDynamicRenderingTilePropertiesQCOM"); - return params.result; -} - -VkResult WINAPI vkGetEventStatus(VkDevice device, VkEvent event) -{ - struct vkGetEventStatus_params params; - NTSTATUS status; - params.device = device; - params.event = event; - status = UNIX_CALL(vkGetEventStatus, ¶ms); - assert(!status && "vkGetEventStatus"); - return params.result; -} - -VkResult WINAPI vkGetFenceStatus(VkDevice device, VkFence fence) -{ - struct vkGetFenceStatus_params params; - NTSTATUS status; - params.device = device; - params.fence = fence; - status = UNIX_CALL(vkGetFenceStatus, ¶ms); - assert(!status && "vkGetFenceStatus"); - return params.result; -} - -VkResult WINAPI vkGetFramebufferTilePropertiesQCOM(VkDevice device, VkFramebuffer framebuffer, uint32_t *pPropertiesCount, VkTilePropertiesQCOM *pProperties) -{ - struct vkGetFramebufferTilePropertiesQCOM_params params; - NTSTATUS status; - params.device = device; - params.framebuffer = framebuffer; - params.pPropertiesCount = pPropertiesCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetFramebufferTilePropertiesQCOM, ¶ms); - assert(!status && "vkGetFramebufferTilePropertiesQCOM"); - return params.result; -} - -void WINAPI vkGetGeneratedCommandsMemoryRequirementsNV(VkDevice device, const VkGeneratedCommandsMemoryRequirementsInfoNV *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetGeneratedCommandsMemoryRequirementsNV_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetGeneratedCommandsMemoryRequirementsNV, ¶ms); - assert(!status && "vkGetGeneratedCommandsMemoryRequirementsNV"); -} - -void WINAPI vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) -{ - struct vkGetImageMemoryRequirements_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetImageMemoryRequirements, ¶ms); - assert(!status && "vkGetImageMemoryRequirements"); -} - -void WINAPI vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetImageMemoryRequirements2_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetImageMemoryRequirements2, ¶ms); - assert(!status && "vkGetImageMemoryRequirements2"); -} - -void WINAPI vkGetImageMemoryRequirements2KHR(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetImageMemoryRequirements2KHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetImageMemoryRequirements2KHR, ¶ms); - assert(!status && "vkGetImageMemoryRequirements2KHR"); -} - -VkResult WINAPI vkGetImageOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkImageCaptureDescriptorDataInfoEXT *pInfo, void *pData) -{ - struct vkGetImageOpaqueCaptureDescriptorDataEXT_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pData = pData; - status = UNIX_CALL(vkGetImageOpaqueCaptureDescriptorDataEXT, ¶ms); - assert(!status && "vkGetImageOpaqueCaptureDescriptorDataEXT"); - return params.result; -} - -void WINAPI vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements *pSparseMemoryRequirements) -{ - struct vkGetImageSparseMemoryRequirements_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.pSparseMemoryRequirementCount = pSparseMemoryRequirementCount; - params.pSparseMemoryRequirements = pSparseMemoryRequirements; - status = UNIX_CALL(vkGetImageSparseMemoryRequirements, ¶ms); - assert(!status && "vkGetImageSparseMemoryRequirements"); -} - -void WINAPI vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) -{ - struct vkGetImageSparseMemoryRequirements2_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pSparseMemoryRequirementCount = pSparseMemoryRequirementCount; - params.pSparseMemoryRequirements = pSparseMemoryRequirements; - status = UNIX_CALL(vkGetImageSparseMemoryRequirements2, ¶ms); - assert(!status && "vkGetImageSparseMemoryRequirements2"); -} - -void WINAPI vkGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) -{ - struct vkGetImageSparseMemoryRequirements2KHR_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pSparseMemoryRequirementCount = pSparseMemoryRequirementCount; - params.pSparseMemoryRequirements = pSparseMemoryRequirements; - status = UNIX_CALL(vkGetImageSparseMemoryRequirements2KHR, ¶ms); - assert(!status && "vkGetImageSparseMemoryRequirements2KHR"); -} - -void WINAPI vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout) -{ - struct vkGetImageSubresourceLayout_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.pSubresource = pSubresource; - params.pLayout = pLayout; - status = UNIX_CALL(vkGetImageSubresourceLayout, ¶ms); - assert(!status && "vkGetImageSubresourceLayout"); -} - -void WINAPI vkGetImageSubresourceLayout2EXT(VkDevice device, VkImage image, const VkImageSubresource2KHR *pSubresource, VkSubresourceLayout2KHR *pLayout) -{ - struct vkGetImageSubresourceLayout2EXT_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.pSubresource = pSubresource; - params.pLayout = pLayout; - status = UNIX_CALL(vkGetImageSubresourceLayout2EXT, ¶ms); - assert(!status && "vkGetImageSubresourceLayout2EXT"); -} - -void WINAPI vkGetImageSubresourceLayout2KHR(VkDevice device, VkImage image, const VkImageSubresource2KHR *pSubresource, VkSubresourceLayout2KHR *pLayout) -{ - struct vkGetImageSubresourceLayout2KHR_params params; - NTSTATUS status; - params.device = device; - params.image = image; - params.pSubresource = pSubresource; - params.pLayout = pLayout; - status = UNIX_CALL(vkGetImageSubresourceLayout2KHR, ¶ms); - assert(!status && "vkGetImageSubresourceLayout2KHR"); -} - -VkResult WINAPI vkGetImageViewAddressNVX(VkDevice device, VkImageView imageView, VkImageViewAddressPropertiesNVX *pProperties) -{ - struct vkGetImageViewAddressNVX_params params; - NTSTATUS status; - params.device = device; - params.imageView = imageView; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetImageViewAddressNVX, ¶ms); - assert(!status && "vkGetImageViewAddressNVX"); - return params.result; -} - -uint32_t WINAPI vkGetImageViewHandleNVX(VkDevice device, const VkImageViewHandleInfoNVX *pInfo) -{ - struct vkGetImageViewHandleNVX_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetImageViewHandleNVX, ¶ms); - assert(!status && "vkGetImageViewHandleNVX"); - return params.result; -} - -VkResult WINAPI vkGetImageViewOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkImageViewCaptureDescriptorDataInfoEXT *pInfo, void *pData) -{ - struct vkGetImageViewOpaqueCaptureDescriptorDataEXT_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pData = pData; - status = UNIX_CALL(vkGetImageViewOpaqueCaptureDescriptorDataEXT, ¶ms); - assert(!status && "vkGetImageViewOpaqueCaptureDescriptorDataEXT"); - return params.result; -} - -void WINAPI vkGetLatencyTimingsNV(VkDevice device, VkSwapchainKHR swapchain, VkGetLatencyMarkerInfoNV *pLatencyMarkerInfo) -{ - struct vkGetLatencyTimingsNV_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.pLatencyMarkerInfo = pLatencyMarkerInfo; - status = UNIX_CALL(vkGetLatencyTimingsNV, ¶ms); - assert(!status && "vkGetLatencyTimingsNV"); -} - -VkResult WINAPI vkGetMemoryHostPointerPropertiesEXT(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void *pHostPointer, VkMemoryHostPointerPropertiesEXT *pMemoryHostPointerProperties) -{ - struct vkGetMemoryHostPointerPropertiesEXT_params params; - NTSTATUS status; - params.device = device; - params.handleType = handleType; - params.pHostPointer = pHostPointer; - params.pMemoryHostPointerProperties = pMemoryHostPointerProperties; - status = UNIX_CALL(vkGetMemoryHostPointerPropertiesEXT, ¶ms); - assert(!status && "vkGetMemoryHostPointerPropertiesEXT"); - return params.result; -} - -void WINAPI vkGetMicromapBuildSizesEXT(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkMicromapBuildInfoEXT *pBuildInfo, VkMicromapBuildSizesInfoEXT *pSizeInfo) -{ - struct vkGetMicromapBuildSizesEXT_params params; - NTSTATUS status; - params.device = device; - params.buildType = buildType; - params.pBuildInfo = pBuildInfo; - params.pSizeInfo = pSizeInfo; - status = UNIX_CALL(vkGetMicromapBuildSizesEXT, ¶ms); - assert(!status && "vkGetMicromapBuildSizesEXT"); -} - -VkResult WINAPI vkGetPerformanceParameterINTEL(VkDevice device, VkPerformanceParameterTypeINTEL parameter, VkPerformanceValueINTEL *pValue) -{ - struct vkGetPerformanceParameterINTEL_params params; - NTSTATUS status; - params.device = device; - params.parameter = parameter; - params.pValue = pValue; - status = UNIX_CALL(vkGetPerformanceParameterINTEL, ¶ms); - assert(!status && "vkGetPerformanceParameterINTEL"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainEXT *pTimeDomains) -{ - struct vkGetPhysicalDeviceCalibrateableTimeDomainsEXT_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pTimeDomainCount = pTimeDomainCount; - params.pTimeDomains = pTimeDomains; - status = UNIX_CALL(vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, ¶ms); - assert(!status && "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkCooperativeMatrixPropertiesKHR *pProperties) -{ - struct vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkCooperativeMatrixPropertiesNV *pProperties) -{ - struct vkGetPhysicalDeviceCooperativeMatrixPropertiesNV_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPhysicalDeviceCooperativeMatrixPropertiesNV, ¶ms); - assert(!status && "vkGetPhysicalDeviceCooperativeMatrixPropertiesNV"); - return params.result; -} - -void WINAPI vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) -{ - struct vkGetPhysicalDeviceExternalBufferProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pExternalBufferInfo = pExternalBufferInfo; - params.pExternalBufferProperties = pExternalBufferProperties; - status = UNIX_CALL(vkGetPhysicalDeviceExternalBufferProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceExternalBufferProperties"); -} - -void WINAPI vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) -{ - struct vkGetPhysicalDeviceExternalBufferPropertiesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pExternalBufferInfo = pExternalBufferInfo; - params.pExternalBufferProperties = pExternalBufferProperties; - status = UNIX_CALL(vkGetPhysicalDeviceExternalBufferPropertiesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceExternalBufferPropertiesKHR"); -} - -void WINAPI vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) -{ - struct vkGetPhysicalDeviceExternalFenceProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pExternalFenceInfo = pExternalFenceInfo; - params.pExternalFenceProperties = pExternalFenceProperties; - status = UNIX_CALL(vkGetPhysicalDeviceExternalFenceProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceExternalFenceProperties"); -} - -void WINAPI vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) -{ - struct vkGetPhysicalDeviceExternalFencePropertiesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pExternalFenceInfo = pExternalFenceInfo; - params.pExternalFenceProperties = pExternalFenceProperties; - status = UNIX_CALL(vkGetPhysicalDeviceExternalFencePropertiesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceExternalFencePropertiesKHR"); -} - -void WINAPI vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) -{ - struct vkGetPhysicalDeviceExternalSemaphoreProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pExternalSemaphoreInfo = pExternalSemaphoreInfo; - params.pExternalSemaphoreProperties = pExternalSemaphoreProperties; - status = UNIX_CALL(vkGetPhysicalDeviceExternalSemaphoreProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceExternalSemaphoreProperties"); -} - -void WINAPI vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) -{ - struct vkGetPhysicalDeviceExternalSemaphorePropertiesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pExternalSemaphoreInfo = pExternalSemaphoreInfo; - params.pExternalSemaphoreProperties = pExternalSemaphoreProperties; - status = UNIX_CALL(vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"); -} - -void WINAPI vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) -{ - struct vkGetPhysicalDeviceFeatures_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pFeatures = pFeatures; - status = UNIX_CALL(vkGetPhysicalDeviceFeatures, ¶ms); - assert(!status && "vkGetPhysicalDeviceFeatures"); -} - -void WINAPI vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures) -{ - struct vkGetPhysicalDeviceFeatures2_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pFeatures = pFeatures; - status = UNIX_CALL(vkGetPhysicalDeviceFeatures2, ¶ms); - assert(!status && "vkGetPhysicalDeviceFeatures2"); -} - -void WINAPI vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures) -{ - struct vkGetPhysicalDeviceFeatures2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pFeatures = pFeatures; - status = UNIX_CALL(vkGetPhysicalDeviceFeatures2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceFeatures2KHR"); -} - -void WINAPI vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties) -{ - struct vkGetPhysicalDeviceFormatProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.format = format; - params.pFormatProperties = pFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceFormatProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceFormatProperties"); -} - -void WINAPI vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties) -{ - struct vkGetPhysicalDeviceFormatProperties2_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.format = format; - params.pFormatProperties = pFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceFormatProperties2, ¶ms); - assert(!status && "vkGetPhysicalDeviceFormatProperties2"); -} - -void WINAPI vkGetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties) -{ - struct vkGetPhysicalDeviceFormatProperties2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.format = format; - params.pFormatProperties = pFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceFormatProperties2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceFormatProperties2KHR"); -} - -VkResult WINAPI vkGetPhysicalDeviceFragmentShadingRatesKHR(VkPhysicalDevice physicalDevice, uint32_t *pFragmentShadingRateCount, VkPhysicalDeviceFragmentShadingRateKHR *pFragmentShadingRates) -{ - struct vkGetPhysicalDeviceFragmentShadingRatesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pFragmentShadingRateCount = pFragmentShadingRateCount; - params.pFragmentShadingRates = pFragmentShadingRates; - status = UNIX_CALL(vkGetPhysicalDeviceFragmentShadingRatesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceFragmentShadingRatesKHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) -{ - struct vkGetPhysicalDeviceImageFormatProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.format = format; - params.type = type; - params.tiling = tiling; - params.usage = usage; - params.flags = flags; - params.pImageFormatProperties = pImageFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceImageFormatProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceImageFormatProperties"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) -{ - struct vkGetPhysicalDeviceImageFormatProperties2_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pImageFormatInfo = pImageFormatInfo; - params.pImageFormatProperties = pImageFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceImageFormatProperties2, ¶ms); - assert(!status && "vkGetPhysicalDeviceImageFormatProperties2"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) -{ - struct vkGetPhysicalDeviceImageFormatProperties2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pImageFormatInfo = pImageFormatInfo; - params.pImageFormatProperties = pImageFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceImageFormatProperties2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceImageFormatProperties2KHR"); - return params.result; -} - -void WINAPI vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties) -{ - struct vkGetPhysicalDeviceMemoryProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pMemoryProperties = pMemoryProperties; - status = UNIX_CALL(vkGetPhysicalDeviceMemoryProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceMemoryProperties"); -} - -void WINAPI vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) -{ - struct vkGetPhysicalDeviceMemoryProperties2_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pMemoryProperties = pMemoryProperties; - status = UNIX_CALL(vkGetPhysicalDeviceMemoryProperties2, ¶ms); - assert(!status && "vkGetPhysicalDeviceMemoryProperties2"); -} - -void WINAPI vkGetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) -{ - struct vkGetPhysicalDeviceMemoryProperties2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pMemoryProperties = pMemoryProperties; - status = UNIX_CALL(vkGetPhysicalDeviceMemoryProperties2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceMemoryProperties2KHR"); -} - -void WINAPI vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT *pMultisampleProperties) -{ - struct vkGetPhysicalDeviceMultisamplePropertiesEXT_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.samples = samples; - params.pMultisampleProperties = pMultisampleProperties; - status = UNIX_CALL(vkGetPhysicalDeviceMultisamplePropertiesEXT, ¶ms); - assert(!status && "vkGetPhysicalDeviceMultisamplePropertiesEXT"); -} - -VkResult WINAPI vkGetPhysicalDeviceOpticalFlowImageFormatsNV(VkPhysicalDevice physicalDevice, const VkOpticalFlowImageFormatInfoNV *pOpticalFlowImageFormatInfo, uint32_t *pFormatCount, VkOpticalFlowImageFormatPropertiesNV *pImageFormatProperties) -{ - struct vkGetPhysicalDeviceOpticalFlowImageFormatsNV_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pOpticalFlowImageFormatInfo = pOpticalFlowImageFormatInfo; - params.pFormatCount = pFormatCount; - params.pImageFormatProperties = pImageFormatProperties; - status = UNIX_CALL(vkGetPhysicalDeviceOpticalFlowImageFormatsNV, ¶ms); - assert(!status && "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pRectCount, VkRect2D *pRects) -{ - struct vkGetPhysicalDevicePresentRectanglesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.surface = surface; - params.pRectCount = pRectCount; - params.pRects = pRects; - status = UNIX_CALL(vkGetPhysicalDevicePresentRectanglesKHR, ¶ms); - assert(!status && "vkGetPhysicalDevicePresentRectanglesKHR"); - return params.result; -} - -void WINAPI vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) -{ - struct vkGetPhysicalDeviceProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPhysicalDeviceProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceProperties"); -} - -void WINAPI vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(VkPhysicalDevice physicalDevice, const VkQueryPoolPerformanceCreateInfoKHR *pPerformanceQueryCreateInfo, uint32_t *pNumPasses) -{ - struct vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pPerformanceQueryCreateInfo = pPerformanceQueryCreateInfo; - params.pNumPasses = pNumPasses; - status = UNIX_CALL(vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR"); -} - -void WINAPI vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties) -{ - struct vkGetPhysicalDeviceQueueFamilyProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pQueueFamilyPropertyCount = pQueueFamilyPropertyCount; - params.pQueueFamilyProperties = pQueueFamilyProperties; - status = UNIX_CALL(vkGetPhysicalDeviceQueueFamilyProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceQueueFamilyProperties"); -} - -void WINAPI vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) -{ - struct vkGetPhysicalDeviceQueueFamilyProperties2_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pQueueFamilyPropertyCount = pQueueFamilyPropertyCount; - params.pQueueFamilyProperties = pQueueFamilyProperties; - status = UNIX_CALL(vkGetPhysicalDeviceQueueFamilyProperties2, ¶ms); - assert(!status && "vkGetPhysicalDeviceQueueFamilyProperties2"); -} - -void WINAPI vkGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) -{ - struct vkGetPhysicalDeviceQueueFamilyProperties2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pQueueFamilyPropertyCount = pQueueFamilyPropertyCount; - params.pQueueFamilyProperties = pQueueFamilyProperties; - status = UNIX_CALL(vkGetPhysicalDeviceQueueFamilyProperties2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); -} - -void WINAPI vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) -{ - struct vkGetPhysicalDeviceSparseImageFormatProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.format = format; - params.type = type; - params.samples = samples; - params.usage = usage; - params.tiling = tiling; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPhysicalDeviceSparseImageFormatProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceSparseImageFormatProperties"); -} - -void WINAPI vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties) -{ - struct vkGetPhysicalDeviceSparseImageFormatProperties2_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pFormatInfo = pFormatInfo; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPhysicalDeviceSparseImageFormatProperties2, ¶ms); - assert(!status && "vkGetPhysicalDeviceSparseImageFormatProperties2"); -} - -void WINAPI vkGetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties) -{ - struct vkGetPhysicalDeviceSparseImageFormatProperties2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pFormatInfo = pFormatInfo; - params.pPropertyCount = pPropertyCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPhysicalDeviceSparseImageFormatProperties2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); -} - -VkResult WINAPI vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(VkPhysicalDevice physicalDevice, uint32_t *pCombinationCount, VkFramebufferMixedSamplesCombinationNV *pCombinations) -{ - struct vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pCombinationCount = pCombinationCount; - params.pCombinations = pCombinations; - status = UNIX_CALL(vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV, ¶ms); - assert(!status && "vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities) -{ - struct vkGetPhysicalDeviceSurfaceCapabilities2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pSurfaceInfo = pSurfaceInfo; - params.pSurfaceCapabilities = pSurfaceCapabilities; - status = UNIX_CALL(vkGetPhysicalDeviceSurfaceCapabilities2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSurfaceCapabilities2KHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) -{ - struct vkGetPhysicalDeviceSurfaceCapabilitiesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.surface = surface; - params.pSurfaceCapabilities = pSurfaceCapabilities; - status = UNIX_CALL(vkGetPhysicalDeviceSurfaceCapabilitiesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats) -{ - struct vkGetPhysicalDeviceSurfaceFormats2KHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pSurfaceInfo = pSurfaceInfo; - params.pSurfaceFormatCount = pSurfaceFormatCount; - params.pSurfaceFormats = pSurfaceFormats; - status = UNIX_CALL(vkGetPhysicalDeviceSurfaceFormats2KHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSurfaceFormats2KHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) -{ - struct vkGetPhysicalDeviceSurfaceFormatsKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.surface = surface; - params.pSurfaceFormatCount = pSurfaceFormatCount; - params.pSurfaceFormats = pSurfaceFormats; - status = UNIX_CALL(vkGetPhysicalDeviceSurfaceFormatsKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSurfaceFormatsKHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) -{ - struct vkGetPhysicalDeviceSurfacePresentModesKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.surface = surface; - params.pPresentModeCount = pPresentModeCount; - params.pPresentModes = pPresentModes; - status = UNIX_CALL(vkGetPhysicalDeviceSurfacePresentModesKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSurfacePresentModesKHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported) -{ - struct vkGetPhysicalDeviceSurfaceSupportKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.queueFamilyIndex = queueFamilyIndex; - params.surface = surface; - params.pSupported = pSupported; - status = UNIX_CALL(vkGetPhysicalDeviceSurfaceSupportKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceSurfaceSupportKHR"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, VkPhysicalDeviceToolProperties *pToolProperties) -{ - struct vkGetPhysicalDeviceToolProperties_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pToolCount = pToolCount; - params.pToolProperties = pToolProperties; - status = UNIX_CALL(vkGetPhysicalDeviceToolProperties, ¶ms); - assert(!status && "vkGetPhysicalDeviceToolProperties"); - return params.result; -} - -VkResult WINAPI vkGetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, VkPhysicalDeviceToolProperties *pToolProperties) -{ - struct vkGetPhysicalDeviceToolPropertiesEXT_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.pToolCount = pToolCount; - params.pToolProperties = pToolProperties; - status = UNIX_CALL(vkGetPhysicalDeviceToolPropertiesEXT, ¶ms); - assert(!status && "vkGetPhysicalDeviceToolPropertiesEXT"); - return params.result; -} - -VkBool32 WINAPI vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) -{ - struct vkGetPhysicalDeviceWin32PresentationSupportKHR_params params; - NTSTATUS status; - params.physicalDevice = physicalDevice; - params.queueFamilyIndex = queueFamilyIndex; - status = UNIX_CALL(vkGetPhysicalDeviceWin32PresentationSupportKHR, ¶ms); - assert(!status && "vkGetPhysicalDeviceWin32PresentationSupportKHR"); - return params.result; -} - -VkResult WINAPI vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData) -{ - struct vkGetPipelineCacheData_params params; - NTSTATUS status; - params.device = device; - params.pipelineCache = pipelineCache; - params.pDataSize = pDataSize; - params.pData = pData; - status = UNIX_CALL(vkGetPipelineCacheData, ¶ms); - assert(!status && "vkGetPipelineCacheData"); - return params.result; -} - -VkResult WINAPI vkGetPipelineExecutableInternalRepresentationsKHR(VkDevice device, const VkPipelineExecutableInfoKHR *pExecutableInfo, uint32_t *pInternalRepresentationCount, VkPipelineExecutableInternalRepresentationKHR *pInternalRepresentations) -{ - struct vkGetPipelineExecutableInternalRepresentationsKHR_params params; - NTSTATUS status; - params.device = device; - params.pExecutableInfo = pExecutableInfo; - params.pInternalRepresentationCount = pInternalRepresentationCount; - params.pInternalRepresentations = pInternalRepresentations; - status = UNIX_CALL(vkGetPipelineExecutableInternalRepresentationsKHR, ¶ms); - assert(!status && "vkGetPipelineExecutableInternalRepresentationsKHR"); - return params.result; -} - -VkResult WINAPI vkGetPipelineExecutablePropertiesKHR(VkDevice device, const VkPipelineInfoKHR *pPipelineInfo, uint32_t *pExecutableCount, VkPipelineExecutablePropertiesKHR *pProperties) -{ - struct vkGetPipelineExecutablePropertiesKHR_params params; - NTSTATUS status; - params.device = device; - params.pPipelineInfo = pPipelineInfo; - params.pExecutableCount = pExecutableCount; - params.pProperties = pProperties; - status = UNIX_CALL(vkGetPipelineExecutablePropertiesKHR, ¶ms); - assert(!status && "vkGetPipelineExecutablePropertiesKHR"); - return params.result; -} - -VkResult WINAPI vkGetPipelineExecutableStatisticsKHR(VkDevice device, const VkPipelineExecutableInfoKHR *pExecutableInfo, uint32_t *pStatisticCount, VkPipelineExecutableStatisticKHR *pStatistics) -{ - struct vkGetPipelineExecutableStatisticsKHR_params params; - NTSTATUS status; - params.device = device; - params.pExecutableInfo = pExecutableInfo; - params.pStatisticCount = pStatisticCount; - params.pStatistics = pStatistics; - status = UNIX_CALL(vkGetPipelineExecutableStatisticsKHR, ¶ms); - assert(!status && "vkGetPipelineExecutableStatisticsKHR"); - return params.result; -} - -VkDeviceAddress WINAPI vkGetPipelineIndirectDeviceAddressNV(VkDevice device, const VkPipelineIndirectDeviceAddressInfoNV *pInfo) -{ - struct vkGetPipelineIndirectDeviceAddressNV_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetPipelineIndirectDeviceAddressNV, ¶ms); - assert(!status && "vkGetPipelineIndirectDeviceAddressNV"); - return params.result; -} - -void WINAPI vkGetPipelineIndirectMemoryRequirementsNV(VkDevice device, const VkComputePipelineCreateInfo *pCreateInfo, VkMemoryRequirements2 *pMemoryRequirements) -{ - struct vkGetPipelineIndirectMemoryRequirementsNV_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pMemoryRequirements = pMemoryRequirements; - status = UNIX_CALL(vkGetPipelineIndirectMemoryRequirementsNV, ¶ms); - assert(!status && "vkGetPipelineIndirectMemoryRequirementsNV"); -} - -VkResult WINAPI vkGetPipelinePropertiesEXT(VkDevice device, const VkPipelineInfoEXT *pPipelineInfo, VkBaseOutStructure *pPipelineProperties) -{ - struct vkGetPipelinePropertiesEXT_params params; - NTSTATUS status; - params.device = device; - params.pPipelineInfo = pPipelineInfo; - params.pPipelineProperties = pPipelineProperties; - status = UNIX_CALL(vkGetPipelinePropertiesEXT, ¶ms); - assert(!status && "vkGetPipelinePropertiesEXT"); - return params.result; -} - -void WINAPI vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t *pData) -{ - struct vkGetPrivateData_params params; - NTSTATUS status; - params.device = device; - params.objectType = objectType; - params.objectHandle = objectHandle; - params.privateDataSlot = privateDataSlot; - params.pData = pData; - status = UNIX_CALL(vkGetPrivateData, ¶ms); - assert(!status && "vkGetPrivateData"); -} - -void WINAPI vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t *pData) -{ - struct vkGetPrivateDataEXT_params params; - NTSTATUS status; - params.device = device; - params.objectType = objectType; - params.objectHandle = objectHandle; - params.privateDataSlot = privateDataSlot; - params.pData = pData; - status = UNIX_CALL(vkGetPrivateDataEXT, ¶ms); - assert(!status && "vkGetPrivateDataEXT"); -} - -VkResult WINAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) -{ - struct vkGetQueryPoolResults_params params; - NTSTATUS status; - params.device = device; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - params.queryCount = queryCount; - params.dataSize = dataSize; - params.pData = pData; - params.stride = stride; - params.flags = flags; - status = UNIX_CALL(vkGetQueryPoolResults, ¶ms); - assert(!status && "vkGetQueryPoolResults"); - return params.result; -} - -void WINAPI vkGetQueueCheckpointData2NV(VkQueue queue, uint32_t *pCheckpointDataCount, VkCheckpointData2NV *pCheckpointData) -{ - struct vkGetQueueCheckpointData2NV_params params; - NTSTATUS status; - params.queue = queue; - params.pCheckpointDataCount = pCheckpointDataCount; - params.pCheckpointData = pCheckpointData; - status = UNIX_CALL(vkGetQueueCheckpointData2NV, ¶ms); - assert(!status && "vkGetQueueCheckpointData2NV"); -} - -void WINAPI vkGetQueueCheckpointDataNV(VkQueue queue, uint32_t *pCheckpointDataCount, VkCheckpointDataNV *pCheckpointData) -{ - struct vkGetQueueCheckpointDataNV_params params; - NTSTATUS status; - params.queue = queue; - params.pCheckpointDataCount = pCheckpointDataCount; - params.pCheckpointData = pCheckpointData; - status = UNIX_CALL(vkGetQueueCheckpointDataNV, ¶ms); - assert(!status && "vkGetQueueCheckpointDataNV"); -} - -VkResult WINAPI vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData) -{ - struct vkGetRayTracingCaptureReplayShaderGroupHandlesKHR_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.firstGroup = firstGroup; - params.groupCount = groupCount; - params.dataSize = dataSize; - params.pData = pData; - status = UNIX_CALL(vkGetRayTracingCaptureReplayShaderGroupHandlesKHR, ¶ms); - assert(!status && "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR"); - return params.result; -} - -VkResult WINAPI vkGetRayTracingShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData) -{ - struct vkGetRayTracingShaderGroupHandlesKHR_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.firstGroup = firstGroup; - params.groupCount = groupCount; - params.dataSize = dataSize; - params.pData = pData; - status = UNIX_CALL(vkGetRayTracingShaderGroupHandlesKHR, ¶ms); - assert(!status && "vkGetRayTracingShaderGroupHandlesKHR"); - return params.result; -} - -VkResult WINAPI vkGetRayTracingShaderGroupHandlesNV(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData) -{ - struct vkGetRayTracingShaderGroupHandlesNV_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.firstGroup = firstGroup; - params.groupCount = groupCount; - params.dataSize = dataSize; - params.pData = pData; - status = UNIX_CALL(vkGetRayTracingShaderGroupHandlesNV, ¶ms); - assert(!status && "vkGetRayTracingShaderGroupHandlesNV"); - return params.result; -} - -VkDeviceSize WINAPI vkGetRayTracingShaderGroupStackSizeKHR(VkDevice device, VkPipeline pipeline, uint32_t group, VkShaderGroupShaderKHR groupShader) -{ - struct vkGetRayTracingShaderGroupStackSizeKHR_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.group = group; - params.groupShader = groupShader; - status = UNIX_CALL(vkGetRayTracingShaderGroupStackSizeKHR, ¶ms); - assert(!status && "vkGetRayTracingShaderGroupStackSizeKHR"); - return params.result; -} - -void WINAPI vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) -{ - struct vkGetRenderAreaGranularity_params params; - NTSTATUS status; - params.device = device; - params.renderPass = renderPass; - params.pGranularity = pGranularity; - status = UNIX_CALL(vkGetRenderAreaGranularity, ¶ms); - assert(!status && "vkGetRenderAreaGranularity"); -} - -void WINAPI vkGetRenderingAreaGranularityKHR(VkDevice device, const VkRenderingAreaInfoKHR *pRenderingAreaInfo, VkExtent2D *pGranularity) -{ - struct vkGetRenderingAreaGranularityKHR_params params; - NTSTATUS status; - params.device = device; - params.pRenderingAreaInfo = pRenderingAreaInfo; - params.pGranularity = pGranularity; - status = UNIX_CALL(vkGetRenderingAreaGranularityKHR, ¶ms); - assert(!status && "vkGetRenderingAreaGranularityKHR"); -} - -VkResult WINAPI vkGetSamplerOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkSamplerCaptureDescriptorDataInfoEXT *pInfo, void *pData) -{ - struct vkGetSamplerOpaqueCaptureDescriptorDataEXT_params params; - NTSTATUS status; - params.device = device; - params.pInfo = pInfo; - params.pData = pData; - status = UNIX_CALL(vkGetSamplerOpaqueCaptureDescriptorDataEXT, ¶ms); - assert(!status && "vkGetSamplerOpaqueCaptureDescriptorDataEXT"); - return params.result; -} - -VkResult WINAPI vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t *pValue) -{ - struct vkGetSemaphoreCounterValue_params params; - NTSTATUS status; - params.device = device; - params.semaphore = semaphore; - params.pValue = pValue; - status = UNIX_CALL(vkGetSemaphoreCounterValue, ¶ms); - assert(!status && "vkGetSemaphoreCounterValue"); - return params.result; -} - -VkResult WINAPI vkGetSemaphoreCounterValueKHR(VkDevice device, VkSemaphore semaphore, uint64_t *pValue) -{ - struct vkGetSemaphoreCounterValueKHR_params params; - NTSTATUS status; - params.device = device; - params.semaphore = semaphore; - params.pValue = pValue; - status = UNIX_CALL(vkGetSemaphoreCounterValueKHR, ¶ms); - assert(!status && "vkGetSemaphoreCounterValueKHR"); - return params.result; -} - -VkResult WINAPI vkGetShaderBinaryDataEXT(VkDevice device, VkShaderEXT shader, size_t *pDataSize, void *pData) -{ - struct vkGetShaderBinaryDataEXT_params params; - NTSTATUS status; - params.device = device; - params.shader = shader; - params.pDataSize = pDataSize; - params.pData = pData; - status = UNIX_CALL(vkGetShaderBinaryDataEXT, ¶ms); - assert(!status && "vkGetShaderBinaryDataEXT"); - return params.result; -} - -VkResult WINAPI vkGetShaderInfoAMD(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBits shaderStage, VkShaderInfoTypeAMD infoType, size_t *pInfoSize, void *pInfo) -{ - struct vkGetShaderInfoAMD_params params; - NTSTATUS status; - params.device = device; - params.pipeline = pipeline; - params.shaderStage = shaderStage; - params.infoType = infoType; - params.pInfoSize = pInfoSize; - params.pInfo = pInfo; - status = UNIX_CALL(vkGetShaderInfoAMD, ¶ms); - assert(!status && "vkGetShaderInfoAMD"); - return params.result; -} - -void WINAPI vkGetShaderModuleCreateInfoIdentifierEXT(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, VkShaderModuleIdentifierEXT *pIdentifier) -{ - struct vkGetShaderModuleCreateInfoIdentifierEXT_params params; - NTSTATUS status; - params.device = device; - params.pCreateInfo = pCreateInfo; - params.pIdentifier = pIdentifier; - status = UNIX_CALL(vkGetShaderModuleCreateInfoIdentifierEXT, ¶ms); - assert(!status && "vkGetShaderModuleCreateInfoIdentifierEXT"); -} - -void WINAPI vkGetShaderModuleIdentifierEXT(VkDevice device, VkShaderModule shaderModule, VkShaderModuleIdentifierEXT *pIdentifier) -{ - struct vkGetShaderModuleIdentifierEXT_params params; - NTSTATUS status; - params.device = device; - params.shaderModule = shaderModule; - params.pIdentifier = pIdentifier; - status = UNIX_CALL(vkGetShaderModuleIdentifierEXT, ¶ms); - assert(!status && "vkGetShaderModuleIdentifierEXT"); -} - -VkResult WINAPI vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) -{ - struct vkGetSwapchainImagesKHR_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.pSwapchainImageCount = pSwapchainImageCount; - params.pSwapchainImages = pSwapchainImages; - status = UNIX_CALL(vkGetSwapchainImagesKHR, ¶ms); - assert(!status && "vkGetSwapchainImagesKHR"); - return params.result; -} - -VkResult WINAPI vkGetValidationCacheDataEXT(VkDevice device, VkValidationCacheEXT validationCache, size_t *pDataSize, void *pData) -{ - struct vkGetValidationCacheDataEXT_params params; - NTSTATUS status; - params.device = device; - params.validationCache = validationCache; - params.pDataSize = pDataSize; - params.pData = pData; - status = UNIX_CALL(vkGetValidationCacheDataEXT, ¶ms); - assert(!status && "vkGetValidationCacheDataEXT"); - return params.result; -} - -VkResult WINAPI vkInitializePerformanceApiINTEL(VkDevice device, const VkInitializePerformanceApiInfoINTEL *pInitializeInfo) -{ - struct vkInitializePerformanceApiINTEL_params params; - NTSTATUS status; - params.device = device; - params.pInitializeInfo = pInitializeInfo; - status = UNIX_CALL(vkInitializePerformanceApiINTEL, ¶ms); - assert(!status && "vkInitializePerformanceApiINTEL"); - return params.result; -} - -VkResult WINAPI vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) -{ - struct vkInvalidateMappedMemoryRanges_params params; - NTSTATUS status; - params.device = device; - params.memoryRangeCount = memoryRangeCount; - params.pMemoryRanges = pMemoryRanges; - status = UNIX_CALL(vkInvalidateMappedMemoryRanges, ¶ms); - assert(!status && "vkInvalidateMappedMemoryRanges"); - return params.result; -} - -VkResult WINAPI vkLatencySleepNV(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepInfoNV *pSleepInfo) -{ - struct vkLatencySleepNV_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.pSleepInfo = pSleepInfo; - status = UNIX_CALL(vkLatencySleepNV, ¶ms); - assert(!status && "vkLatencySleepNV"); - return params.result; -} - -VkResult WINAPI vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData) -{ - struct vkMapMemory_params params; - NTSTATUS status; - params.device = device; - params.memory = memory; - params.offset = offset; - params.size = size; - params.flags = flags; - params.ppData = ppData; - status = UNIX_CALL(vkMapMemory, ¶ms); - assert(!status && "vkMapMemory"); - return params.result; -} - -VkResult WINAPI vkMapMemory2KHR(VkDevice device, const VkMemoryMapInfoKHR *pMemoryMapInfo, void **ppData) -{ - struct vkMapMemory2KHR_params params; - NTSTATUS status; - params.device = device; - params.pMemoryMapInfo = pMemoryMapInfo; - params.ppData = ppData; - status = UNIX_CALL(vkMapMemory2KHR, ¶ms); - assert(!status && "vkMapMemory2KHR"); - return params.result; -} - -VkResult WINAPI vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) -{ - struct vkMergePipelineCaches_params params; - NTSTATUS status; - params.device = device; - params.dstCache = dstCache; - params.srcCacheCount = srcCacheCount; - params.pSrcCaches = pSrcCaches; - status = UNIX_CALL(vkMergePipelineCaches, ¶ms); - assert(!status && "vkMergePipelineCaches"); - return params.result; -} - -VkResult WINAPI vkMergeValidationCachesEXT(VkDevice device, VkValidationCacheEXT dstCache, uint32_t srcCacheCount, const VkValidationCacheEXT *pSrcCaches) -{ - struct vkMergeValidationCachesEXT_params params; - NTSTATUS status; - params.device = device; - params.dstCache = dstCache; - params.srcCacheCount = srcCacheCount; - params.pSrcCaches = pSrcCaches; - status = UNIX_CALL(vkMergeValidationCachesEXT, ¶ms); - assert(!status && "vkMergeValidationCachesEXT"); - return params.result; -} - -void WINAPI vkQueueBeginDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo) -{ - struct vkQueueBeginDebugUtilsLabelEXT_params params; - NTSTATUS status; - params.queue = queue; - params.pLabelInfo = pLabelInfo; - status = UNIX_CALL(vkQueueBeginDebugUtilsLabelEXT, ¶ms); - assert(!status && "vkQueueBeginDebugUtilsLabelEXT"); -} - -VkResult WINAPI vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence) -{ - struct vkQueueBindSparse_params params; - NTSTATUS status; - params.queue = queue; - params.bindInfoCount = bindInfoCount; - params.pBindInfo = pBindInfo; - params.fence = fence; - status = UNIX_CALL(vkQueueBindSparse, ¶ms); - assert(!status && "vkQueueBindSparse"); - return params.result; -} - -void WINAPI vkQueueEndDebugUtilsLabelEXT(VkQueue queue) -{ - struct vkQueueEndDebugUtilsLabelEXT_params params; - NTSTATUS status; - params.queue = queue; - status = UNIX_CALL(vkQueueEndDebugUtilsLabelEXT, ¶ms); - assert(!status && "vkQueueEndDebugUtilsLabelEXT"); -} - -void WINAPI vkQueueInsertDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo) -{ - struct vkQueueInsertDebugUtilsLabelEXT_params params; - NTSTATUS status; - params.queue = queue; - params.pLabelInfo = pLabelInfo; - status = UNIX_CALL(vkQueueInsertDebugUtilsLabelEXT, ¶ms); - assert(!status && "vkQueueInsertDebugUtilsLabelEXT"); -} - -void WINAPI vkQueueNotifyOutOfBandNV(VkQueue queue, const VkOutOfBandQueueTypeInfoNV *pQueueTypeInfo) -{ - struct vkQueueNotifyOutOfBandNV_params params; - NTSTATUS status; - params.queue = queue; - params.pQueueTypeInfo = pQueueTypeInfo; - status = UNIX_CALL(vkQueueNotifyOutOfBandNV, ¶ms); - assert(!status && "vkQueueNotifyOutOfBandNV"); -} - -VkResult WINAPI vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) -{ - struct vkQueuePresentKHR_params params; - NTSTATUS status; - params.queue = queue; - params.pPresentInfo = pPresentInfo; - status = UNIX_CALL(vkQueuePresentKHR, ¶ms); - assert(!status && "vkQueuePresentKHR"); - return params.result; -} - -VkResult WINAPI vkQueueSetPerformanceConfigurationINTEL(VkQueue queue, VkPerformanceConfigurationINTEL configuration) -{ - struct vkQueueSetPerformanceConfigurationINTEL_params params; - NTSTATUS status; - params.queue = queue; - params.configuration = configuration; - status = UNIX_CALL(vkQueueSetPerformanceConfigurationINTEL, ¶ms); - assert(!status && "vkQueueSetPerformanceConfigurationINTEL"); - return params.result; -} - -VkResult WINAPI vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) -{ - struct vkQueueSubmit_params params; - NTSTATUS status; - params.queue = queue; - params.submitCount = submitCount; - params.pSubmits = pSubmits; - params.fence = fence; - status = UNIX_CALL(vkQueueSubmit, ¶ms); - assert(!status && "vkQueueSubmit"); - return params.result; -} - -VkResult WINAPI vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits, VkFence fence) -{ - struct vkQueueSubmit2_params params; - NTSTATUS status; - params.queue = queue; - params.submitCount = submitCount; - params.pSubmits = pSubmits; - params.fence = fence; - status = UNIX_CALL(vkQueueSubmit2, ¶ms); - assert(!status && "vkQueueSubmit2"); - return params.result; -} - -VkResult WINAPI vkQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits, VkFence fence) -{ - struct vkQueueSubmit2KHR_params params; - NTSTATUS status; - params.queue = queue; - params.submitCount = submitCount; - params.pSubmits = pSubmits; - params.fence = fence; - status = UNIX_CALL(vkQueueSubmit2KHR, ¶ms); - assert(!status && "vkQueueSubmit2KHR"); - return params.result; -} - -VkResult WINAPI vkQueueWaitIdle(VkQueue queue) -{ - struct vkQueueWaitIdle_params params; - NTSTATUS status; - params.queue = queue; - status = UNIX_CALL(vkQueueWaitIdle, ¶ms); - assert(!status && "vkQueueWaitIdle"); - return params.result; -} - -VkResult WINAPI vkReleasePerformanceConfigurationINTEL(VkDevice device, VkPerformanceConfigurationINTEL configuration) -{ - struct vkReleasePerformanceConfigurationINTEL_params params; - NTSTATUS status; - params.device = device; - params.configuration = configuration; - status = UNIX_CALL(vkReleasePerformanceConfigurationINTEL, ¶ms); - assert(!status && "vkReleasePerformanceConfigurationINTEL"); - return params.result; -} - -void WINAPI vkReleaseProfilingLockKHR(VkDevice device) -{ - struct vkReleaseProfilingLockKHR_params params; - NTSTATUS status; - params.device = device; - status = UNIX_CALL(vkReleaseProfilingLockKHR, ¶ms); - assert(!status && "vkReleaseProfilingLockKHR"); -} - -VkResult WINAPI vkReleaseSwapchainImagesEXT(VkDevice device, const VkReleaseSwapchainImagesInfoEXT *pReleaseInfo) -{ - struct vkReleaseSwapchainImagesEXT_params params; - NTSTATUS status; - params.device = device; - params.pReleaseInfo = pReleaseInfo; - status = UNIX_CALL(vkReleaseSwapchainImagesEXT, ¶ms); - assert(!status && "vkReleaseSwapchainImagesEXT"); - return params.result; -} - -VkResult WINAPI vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) -{ - struct vkResetCommandBuffer_params params; - NTSTATUS status; - params.commandBuffer = commandBuffer; - params.flags = flags; - status = UNIX_CALL(vkResetCommandBuffer, ¶ms); - assert(!status && "vkResetCommandBuffer"); - return params.result; -} - -VkResult WINAPI vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) -{ - struct vkResetCommandPool_params params; - NTSTATUS status; - params.device = device; - params.commandPool = commandPool; - params.flags = flags; - status = UNIX_CALL(vkResetCommandPool, ¶ms); - assert(!status && "vkResetCommandPool"); - return params.result; -} - -VkResult WINAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) -{ - struct vkResetDescriptorPool_params params; - NTSTATUS status; - params.device = device; - params.descriptorPool = descriptorPool; - params.flags = flags; - status = UNIX_CALL(vkResetDescriptorPool, ¶ms); - assert(!status && "vkResetDescriptorPool"); - return params.result; -} - -VkResult WINAPI vkResetEvent(VkDevice device, VkEvent event) -{ - struct vkResetEvent_params params; - NTSTATUS status; - params.device = device; - params.event = event; - status = UNIX_CALL(vkResetEvent, ¶ms); - assert(!status && "vkResetEvent"); - return params.result; -} - -VkResult WINAPI vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) -{ - struct vkResetFences_params params; - NTSTATUS status; - params.device = device; - params.fenceCount = fenceCount; - params.pFences = pFences; - status = UNIX_CALL(vkResetFences, ¶ms); - assert(!status && "vkResetFences"); - return params.result; -} - -void WINAPI vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) -{ - struct vkResetQueryPool_params params; - NTSTATUS status; - params.device = device; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - params.queryCount = queryCount; - status = UNIX_CALL(vkResetQueryPool, ¶ms); - assert(!status && "vkResetQueryPool"); -} - -void WINAPI vkResetQueryPoolEXT(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) -{ - struct vkResetQueryPoolEXT_params params; - NTSTATUS status; - params.device = device; - params.queryPool = queryPool; - params.firstQuery = firstQuery; - params.queryCount = queryCount; - status = UNIX_CALL(vkResetQueryPoolEXT, ¶ms); - assert(!status && "vkResetQueryPoolEXT"); -} - -VkResult WINAPI vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) -{ - struct vkSetDebugUtilsObjectNameEXT_params params; - NTSTATUS status; - params.device = device; - params.pNameInfo = pNameInfo; - status = UNIX_CALL(vkSetDebugUtilsObjectNameEXT, ¶ms); - assert(!status && "vkSetDebugUtilsObjectNameEXT"); - return params.result; -} - -VkResult WINAPI vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) -{ - struct vkSetDebugUtilsObjectTagEXT_params params; - NTSTATUS status; - params.device = device; - params.pTagInfo = pTagInfo; - status = UNIX_CALL(vkSetDebugUtilsObjectTagEXT, ¶ms); - assert(!status && "vkSetDebugUtilsObjectTagEXT"); - return params.result; -} - -void WINAPI vkSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority) -{ - struct vkSetDeviceMemoryPriorityEXT_params params; - NTSTATUS status; - params.device = device; - params.memory = memory; - params.priority = priority; - status = UNIX_CALL(vkSetDeviceMemoryPriorityEXT, ¶ms); - assert(!status && "vkSetDeviceMemoryPriorityEXT"); -} - -VkResult WINAPI vkSetEvent(VkDevice device, VkEvent event) -{ - struct vkSetEvent_params params; - NTSTATUS status; - params.device = device; - params.event = event; - status = UNIX_CALL(vkSetEvent, ¶ms); - assert(!status && "vkSetEvent"); - return params.result; -} - -void WINAPI vkSetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR *pSwapchains, const VkHdrMetadataEXT *pMetadata) -{ - struct vkSetHdrMetadataEXT_params params; - NTSTATUS status; - params.device = device; - params.swapchainCount = swapchainCount; - params.pSwapchains = pSwapchains; - params.pMetadata = pMetadata; - status = UNIX_CALL(vkSetHdrMetadataEXT, ¶ms); - assert(!status && "vkSetHdrMetadataEXT"); -} - -void WINAPI vkSetLatencyMarkerNV(VkDevice device, VkSwapchainKHR swapchain, const VkSetLatencyMarkerInfoNV *pLatencyMarkerInfo) -{ - struct vkSetLatencyMarkerNV_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.pLatencyMarkerInfo = pLatencyMarkerInfo; - status = UNIX_CALL(vkSetLatencyMarkerNV, ¶ms); - assert(!status && "vkSetLatencyMarkerNV"); -} - -VkResult WINAPI vkSetLatencySleepModeNV(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepModeInfoNV *pSleepModeInfo) -{ - struct vkSetLatencySleepModeNV_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.pSleepModeInfo = pSleepModeInfo; - status = UNIX_CALL(vkSetLatencySleepModeNV, ¶ms); - assert(!status && "vkSetLatencySleepModeNV"); - return params.result; -} - -VkResult WINAPI vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data) -{ - struct vkSetPrivateData_params params; - NTSTATUS status; - params.device = device; - params.objectType = objectType; - params.objectHandle = objectHandle; - params.privateDataSlot = privateDataSlot; - params.data = data; - status = UNIX_CALL(vkSetPrivateData, ¶ms); - assert(!status && "vkSetPrivateData"); - return params.result; -} - -VkResult WINAPI vkSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data) -{ - struct vkSetPrivateDataEXT_params params; - NTSTATUS status; - params.device = device; - params.objectType = objectType; - params.objectHandle = objectHandle; - params.privateDataSlot = privateDataSlot; - params.data = data; - status = UNIX_CALL(vkSetPrivateDataEXT, ¶ms); - assert(!status && "vkSetPrivateDataEXT"); - return params.result; -} - -VkResult WINAPI vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) -{ - struct vkSignalSemaphore_params params; - NTSTATUS status; - params.device = device; - params.pSignalInfo = pSignalInfo; - status = UNIX_CALL(vkSignalSemaphore, ¶ms); - assert(!status && "vkSignalSemaphore"); - return params.result; -} - -VkResult WINAPI vkSignalSemaphoreKHR(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) -{ - struct vkSignalSemaphoreKHR_params params; - NTSTATUS status; - params.device = device; - params.pSignalInfo = pSignalInfo; - status = UNIX_CALL(vkSignalSemaphoreKHR, ¶ms); - assert(!status && "vkSignalSemaphoreKHR"); - return params.result; -} - -void WINAPI vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) -{ - struct vkSubmitDebugUtilsMessageEXT_params params; - NTSTATUS status; - params.instance = instance; - params.messageSeverity = messageSeverity; - params.messageTypes = messageTypes; - params.pCallbackData = pCallbackData; - status = UNIX_CALL(vkSubmitDebugUtilsMessageEXT, ¶ms); - assert(!status && "vkSubmitDebugUtilsMessageEXT"); -} - -VkResult WINAPI vkTransitionImageLayoutEXT(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfoEXT *pTransitions) -{ - struct vkTransitionImageLayoutEXT_params params; - NTSTATUS status; - params.device = device; - params.transitionCount = transitionCount; - params.pTransitions = pTransitions; - status = UNIX_CALL(vkTransitionImageLayoutEXT, ¶ms); - assert(!status && "vkTransitionImageLayoutEXT"); - return params.result; -} - -void WINAPI vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) -{ - struct vkTrimCommandPool_params params; - NTSTATUS status; - params.device = device; - params.commandPool = commandPool; - params.flags = flags; - status = UNIX_CALL(vkTrimCommandPool, ¶ms); - assert(!status && "vkTrimCommandPool"); -} - -void WINAPI vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) -{ - struct vkTrimCommandPoolKHR_params params; - NTSTATUS status; - params.device = device; - params.commandPool = commandPool; - params.flags = flags; - status = UNIX_CALL(vkTrimCommandPoolKHR, ¶ms); - assert(!status && "vkTrimCommandPoolKHR"); -} - -void WINAPI vkUninitializePerformanceApiINTEL(VkDevice device) -{ - struct vkUninitializePerformanceApiINTEL_params params; - NTSTATUS status; - params.device = device; - status = UNIX_CALL(vkUninitializePerformanceApiINTEL, ¶ms); - assert(!status && "vkUninitializePerformanceApiINTEL"); -} - -void WINAPI vkUnmapMemory(VkDevice device, VkDeviceMemory memory) -{ - struct vkUnmapMemory_params params; - NTSTATUS status; - params.device = device; - params.memory = memory; - status = UNIX_CALL(vkUnmapMemory, ¶ms); - assert(!status && "vkUnmapMemory"); -} - -VkResult WINAPI vkUnmapMemory2KHR(VkDevice device, const VkMemoryUnmapInfoKHR *pMemoryUnmapInfo) -{ - struct vkUnmapMemory2KHR_params params; - NTSTATUS status; - params.device = device; - params.pMemoryUnmapInfo = pMemoryUnmapInfo; - status = UNIX_CALL(vkUnmapMemory2KHR, ¶ms); - assert(!status && "vkUnmapMemory2KHR"); - return params.result; -} - -void WINAPI vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData) -{ - struct vkUpdateDescriptorSetWithTemplate_params params; - params.device = device; - params.descriptorSet = descriptorSet; - params.descriptorUpdateTemplate = descriptorUpdateTemplate; - params.pData = pData; - UNIX_CALL(vkUpdateDescriptorSetWithTemplate, ¶ms); -} - -void WINAPI vkUpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData) -{ - struct vkUpdateDescriptorSetWithTemplateKHR_params params; - NTSTATUS status; - params.device = device; - params.descriptorSet = descriptorSet; - params.descriptorUpdateTemplate = descriptorUpdateTemplate; - params.pData = pData; - status = UNIX_CALL(vkUpdateDescriptorSetWithTemplateKHR, ¶ms); - assert(!status && "vkUpdateDescriptorSetWithTemplateKHR"); -} - -void WINAPI vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) -{ - struct vkUpdateDescriptorSets_params params; - params.device = device; - params.descriptorWriteCount = descriptorWriteCount; - params.pDescriptorWrites = pDescriptorWrites; - params.descriptorCopyCount = descriptorCopyCount; - params.pDescriptorCopies = pDescriptorCopies; - UNIX_CALL(vkUpdateDescriptorSets, ¶ms); -} - -VkResult WINAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout) -{ - struct vkWaitForFences_params params; - NTSTATUS status; - params.device = device; - params.fenceCount = fenceCount; - params.pFences = pFences; - params.waitAll = waitAll; - params.timeout = timeout; - status = UNIX_CALL(vkWaitForFences, ¶ms); - assert(!status && "vkWaitForFences"); - return params.result; -} - -VkResult WINAPI vkWaitForPresentKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t presentId, uint64_t timeout) -{ - struct vkWaitForPresentKHR_params params; - NTSTATUS status; - params.device = device; - params.swapchain = swapchain; - params.presentId = presentId; - params.timeout = timeout; - status = UNIX_CALL(vkWaitForPresentKHR, ¶ms); - assert(!status && "vkWaitForPresentKHR"); - return params.result; -} - -VkResult WINAPI vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout) -{ - struct vkWaitSemaphores_params params; - NTSTATUS status; - params.device = device; - params.pWaitInfo = pWaitInfo; - params.timeout = timeout; - status = UNIX_CALL(vkWaitSemaphores, ¶ms); - assert(!status && "vkWaitSemaphores"); - return params.result; -} - -VkResult WINAPI vkWaitSemaphoresKHR(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout) -{ - struct vkWaitSemaphoresKHR_params params; - NTSTATUS status; - params.device = device; - params.pWaitInfo = pWaitInfo; - params.timeout = timeout; - status = UNIX_CALL(vkWaitSemaphoresKHR, ¶ms); - assert(!status && "vkWaitSemaphoresKHR"); - return params.result; -} - -VkResult WINAPI vkWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, size_t dataSize, void *pData, size_t stride) -{ - struct vkWriteAccelerationStructuresPropertiesKHR_params params; - NTSTATUS status; - params.device = device; - params.accelerationStructureCount = accelerationStructureCount; - params.pAccelerationStructures = pAccelerationStructures; - params.queryType = queryType; - params.dataSize = dataSize; - params.pData = pData; - params.stride = stride; - status = UNIX_CALL(vkWriteAccelerationStructuresPropertiesKHR, ¶ms); - assert(!status && "vkWriteAccelerationStructuresPropertiesKHR"); - return params.result; -} - -VkResult WINAPI vkWriteMicromapsPropertiesEXT(VkDevice device, uint32_t micromapCount, const VkMicromapEXT *pMicromaps, VkQueryType queryType, size_t dataSize, void *pData, size_t stride) -{ - struct vkWriteMicromapsPropertiesEXT_params params; - NTSTATUS status; - params.device = device; - params.micromapCount = micromapCount; - params.pMicromaps = pMicromaps; - params.queryType = queryType; - params.dataSize = dataSize; - params.pData = pData; - params.stride = stride; - status = UNIX_CALL(vkWriteMicromapsPropertiesEXT, ¶ms); - assert(!status && "vkWriteMicromapsPropertiesEXT"); - return params.result; -} - -static const struct vulkan_func vk_device_dispatch_table[] = -{ - {"vkAcquireNextImage2KHR", vkAcquireNextImage2KHR}, - {"vkAcquireNextImageKHR", vkAcquireNextImageKHR}, - {"vkAcquirePerformanceConfigurationINTEL", vkAcquirePerformanceConfigurationINTEL}, - {"vkAcquireProfilingLockKHR", vkAcquireProfilingLockKHR}, - {"vkAllocateCommandBuffers", vkAllocateCommandBuffers}, - {"vkAllocateDescriptorSets", vkAllocateDescriptorSets}, - {"vkAllocateMemory", vkAllocateMemory}, - {"vkBeginCommandBuffer", vkBeginCommandBuffer}, - {"vkBindAccelerationStructureMemoryNV", vkBindAccelerationStructureMemoryNV}, - {"vkBindBufferMemory", vkBindBufferMemory}, - {"vkBindBufferMemory2", vkBindBufferMemory2}, - {"vkBindBufferMemory2KHR", vkBindBufferMemory2KHR}, - {"vkBindImageMemory", vkBindImageMemory}, - {"vkBindImageMemory2", vkBindImageMemory2}, - {"vkBindImageMemory2KHR", vkBindImageMemory2KHR}, - {"vkBindOpticalFlowSessionImageNV", vkBindOpticalFlowSessionImageNV}, - {"vkBuildAccelerationStructuresKHR", vkBuildAccelerationStructuresKHR}, - {"vkBuildMicromapsEXT", vkBuildMicromapsEXT}, - {"vkCmdBeginConditionalRenderingEXT", vkCmdBeginConditionalRenderingEXT}, - {"vkCmdBeginDebugUtilsLabelEXT", vkCmdBeginDebugUtilsLabelEXT}, - {"vkCmdBeginQuery", vkCmdBeginQuery}, - {"vkCmdBeginQueryIndexedEXT", vkCmdBeginQueryIndexedEXT}, - {"vkCmdBeginRenderPass", vkCmdBeginRenderPass}, - {"vkCmdBeginRenderPass2", vkCmdBeginRenderPass2}, - {"vkCmdBeginRenderPass2KHR", vkCmdBeginRenderPass2KHR}, - {"vkCmdBeginRendering", vkCmdBeginRendering}, - {"vkCmdBeginRenderingKHR", vkCmdBeginRenderingKHR}, - {"vkCmdBeginTransformFeedbackEXT", vkCmdBeginTransformFeedbackEXT}, - {"vkCmdBindDescriptorBufferEmbeddedSamplersEXT", vkCmdBindDescriptorBufferEmbeddedSamplersEXT}, - {"vkCmdBindDescriptorBuffersEXT", vkCmdBindDescriptorBuffersEXT}, - {"vkCmdBindDescriptorSets", vkCmdBindDescriptorSets}, - {"vkCmdBindIndexBuffer", vkCmdBindIndexBuffer}, - {"vkCmdBindIndexBuffer2KHR", vkCmdBindIndexBuffer2KHR}, - {"vkCmdBindInvocationMaskHUAWEI", vkCmdBindInvocationMaskHUAWEI}, - {"vkCmdBindPipeline", vkCmdBindPipeline}, - {"vkCmdBindPipelineShaderGroupNV", vkCmdBindPipelineShaderGroupNV}, - {"vkCmdBindShadersEXT", vkCmdBindShadersEXT}, - {"vkCmdBindShadingRateImageNV", vkCmdBindShadingRateImageNV}, - {"vkCmdBindTransformFeedbackBuffersEXT", vkCmdBindTransformFeedbackBuffersEXT}, - {"vkCmdBindVertexBuffers", vkCmdBindVertexBuffers}, - {"vkCmdBindVertexBuffers2", vkCmdBindVertexBuffers2}, - {"vkCmdBindVertexBuffers2EXT", vkCmdBindVertexBuffers2EXT}, - {"vkCmdBlitImage", vkCmdBlitImage}, - {"vkCmdBlitImage2", vkCmdBlitImage2}, - {"vkCmdBlitImage2KHR", vkCmdBlitImage2KHR}, - {"vkCmdBuildAccelerationStructureNV", vkCmdBuildAccelerationStructureNV}, - {"vkCmdBuildAccelerationStructuresIndirectKHR", vkCmdBuildAccelerationStructuresIndirectKHR}, - {"vkCmdBuildAccelerationStructuresKHR", vkCmdBuildAccelerationStructuresKHR}, - {"vkCmdBuildMicromapsEXT", vkCmdBuildMicromapsEXT}, - {"vkCmdClearAttachments", vkCmdClearAttachments}, - {"vkCmdClearColorImage", vkCmdClearColorImage}, - {"vkCmdClearDepthStencilImage", vkCmdClearDepthStencilImage}, - {"vkCmdCopyAccelerationStructureKHR", vkCmdCopyAccelerationStructureKHR}, - {"vkCmdCopyAccelerationStructureNV", vkCmdCopyAccelerationStructureNV}, - {"vkCmdCopyAccelerationStructureToMemoryKHR", vkCmdCopyAccelerationStructureToMemoryKHR}, - {"vkCmdCopyBuffer", vkCmdCopyBuffer}, - {"vkCmdCopyBuffer2", vkCmdCopyBuffer2}, - {"vkCmdCopyBuffer2KHR", vkCmdCopyBuffer2KHR}, - {"vkCmdCopyBufferToImage", vkCmdCopyBufferToImage}, - {"vkCmdCopyBufferToImage2", vkCmdCopyBufferToImage2}, - {"vkCmdCopyBufferToImage2KHR", vkCmdCopyBufferToImage2KHR}, - {"vkCmdCopyImage", vkCmdCopyImage}, - {"vkCmdCopyImage2", vkCmdCopyImage2}, - {"vkCmdCopyImage2KHR", vkCmdCopyImage2KHR}, - {"vkCmdCopyImageToBuffer", vkCmdCopyImageToBuffer}, - {"vkCmdCopyImageToBuffer2", vkCmdCopyImageToBuffer2}, - {"vkCmdCopyImageToBuffer2KHR", vkCmdCopyImageToBuffer2KHR}, - {"vkCmdCopyMemoryIndirectNV", vkCmdCopyMemoryIndirectNV}, - {"vkCmdCopyMemoryToAccelerationStructureKHR", vkCmdCopyMemoryToAccelerationStructureKHR}, - {"vkCmdCopyMemoryToImageIndirectNV", vkCmdCopyMemoryToImageIndirectNV}, - {"vkCmdCopyMemoryToMicromapEXT", vkCmdCopyMemoryToMicromapEXT}, - {"vkCmdCopyMicromapEXT", vkCmdCopyMicromapEXT}, - {"vkCmdCopyMicromapToMemoryEXT", vkCmdCopyMicromapToMemoryEXT}, - {"vkCmdCopyQueryPoolResults", vkCmdCopyQueryPoolResults}, - {"vkCmdCuLaunchKernelNVX", vkCmdCuLaunchKernelNVX}, - {"vkCmdCudaLaunchKernelNV", vkCmdCudaLaunchKernelNV}, - {"vkCmdDebugMarkerBeginEXT", vkCmdDebugMarkerBeginEXT}, - {"vkCmdDebugMarkerEndEXT", vkCmdDebugMarkerEndEXT}, - {"vkCmdDebugMarkerInsertEXT", vkCmdDebugMarkerInsertEXT}, - {"vkCmdDecompressMemoryIndirectCountNV", vkCmdDecompressMemoryIndirectCountNV}, - {"vkCmdDecompressMemoryNV", vkCmdDecompressMemoryNV}, - {"vkCmdDispatch", vkCmdDispatch}, - {"vkCmdDispatchBase", vkCmdDispatchBase}, - {"vkCmdDispatchBaseKHR", vkCmdDispatchBaseKHR}, - {"vkCmdDispatchIndirect", vkCmdDispatchIndirect}, - {"vkCmdDraw", vkCmdDraw}, - {"vkCmdDrawClusterHUAWEI", vkCmdDrawClusterHUAWEI}, - {"vkCmdDrawClusterIndirectHUAWEI", vkCmdDrawClusterIndirectHUAWEI}, - {"vkCmdDrawIndexed", vkCmdDrawIndexed}, - {"vkCmdDrawIndexedIndirect", vkCmdDrawIndexedIndirect}, - {"vkCmdDrawIndexedIndirectCount", vkCmdDrawIndexedIndirectCount}, - {"vkCmdDrawIndexedIndirectCountAMD", vkCmdDrawIndexedIndirectCountAMD}, - {"vkCmdDrawIndexedIndirectCountKHR", vkCmdDrawIndexedIndirectCountKHR}, - {"vkCmdDrawIndirect", vkCmdDrawIndirect}, - {"vkCmdDrawIndirectByteCountEXT", vkCmdDrawIndirectByteCountEXT}, - {"vkCmdDrawIndirectCount", vkCmdDrawIndirectCount}, - {"vkCmdDrawIndirectCountAMD", vkCmdDrawIndirectCountAMD}, - {"vkCmdDrawIndirectCountKHR", vkCmdDrawIndirectCountKHR}, - {"vkCmdDrawMeshTasksEXT", vkCmdDrawMeshTasksEXT}, - {"vkCmdDrawMeshTasksIndirectCountEXT", vkCmdDrawMeshTasksIndirectCountEXT}, - {"vkCmdDrawMeshTasksIndirectCountNV", vkCmdDrawMeshTasksIndirectCountNV}, - {"vkCmdDrawMeshTasksIndirectEXT", vkCmdDrawMeshTasksIndirectEXT}, - {"vkCmdDrawMeshTasksIndirectNV", vkCmdDrawMeshTasksIndirectNV}, - {"vkCmdDrawMeshTasksNV", vkCmdDrawMeshTasksNV}, - {"vkCmdDrawMultiEXT", vkCmdDrawMultiEXT}, - {"vkCmdDrawMultiIndexedEXT", vkCmdDrawMultiIndexedEXT}, - {"vkCmdEndConditionalRenderingEXT", vkCmdEndConditionalRenderingEXT}, - {"vkCmdEndDebugUtilsLabelEXT", vkCmdEndDebugUtilsLabelEXT}, - {"vkCmdEndQuery", vkCmdEndQuery}, - {"vkCmdEndQueryIndexedEXT", vkCmdEndQueryIndexedEXT}, - {"vkCmdEndRenderPass", vkCmdEndRenderPass}, - {"vkCmdEndRenderPass2", vkCmdEndRenderPass2}, - {"vkCmdEndRenderPass2KHR", vkCmdEndRenderPass2KHR}, - {"vkCmdEndRendering", vkCmdEndRendering}, - {"vkCmdEndRenderingKHR", vkCmdEndRenderingKHR}, - {"vkCmdEndTransformFeedbackEXT", vkCmdEndTransformFeedbackEXT}, - {"vkCmdExecuteCommands", vkCmdExecuteCommands}, - {"vkCmdExecuteGeneratedCommandsNV", vkCmdExecuteGeneratedCommandsNV}, - {"vkCmdFillBuffer", vkCmdFillBuffer}, - {"vkCmdInsertDebugUtilsLabelEXT", vkCmdInsertDebugUtilsLabelEXT}, - {"vkCmdNextSubpass", vkCmdNextSubpass}, - {"vkCmdNextSubpass2", vkCmdNextSubpass2}, - {"vkCmdNextSubpass2KHR", vkCmdNextSubpass2KHR}, - {"vkCmdOpticalFlowExecuteNV", vkCmdOpticalFlowExecuteNV}, - {"vkCmdPipelineBarrier", vkCmdPipelineBarrier}, - {"vkCmdPipelineBarrier2", vkCmdPipelineBarrier2}, - {"vkCmdPipelineBarrier2KHR", vkCmdPipelineBarrier2KHR}, - {"vkCmdPreprocessGeneratedCommandsNV", vkCmdPreprocessGeneratedCommandsNV}, - {"vkCmdPushConstants", vkCmdPushConstants}, - {"vkCmdPushDescriptorSetKHR", vkCmdPushDescriptorSetKHR}, - {"vkCmdPushDescriptorSetWithTemplateKHR", vkCmdPushDescriptorSetWithTemplateKHR}, - {"vkCmdResetEvent", vkCmdResetEvent}, - {"vkCmdResetEvent2", vkCmdResetEvent2}, - {"vkCmdResetEvent2KHR", vkCmdResetEvent2KHR}, - {"vkCmdResetQueryPool", vkCmdResetQueryPool}, - {"vkCmdResolveImage", vkCmdResolveImage}, - {"vkCmdResolveImage2", vkCmdResolveImage2}, - {"vkCmdResolveImage2KHR", vkCmdResolveImage2KHR}, - {"vkCmdSetAlphaToCoverageEnableEXT", vkCmdSetAlphaToCoverageEnableEXT}, - {"vkCmdSetAlphaToOneEnableEXT", vkCmdSetAlphaToOneEnableEXT}, - {"vkCmdSetAttachmentFeedbackLoopEnableEXT", vkCmdSetAttachmentFeedbackLoopEnableEXT}, - {"vkCmdSetBlendConstants", vkCmdSetBlendConstants}, - {"vkCmdSetCheckpointNV", vkCmdSetCheckpointNV}, - {"vkCmdSetCoarseSampleOrderNV", vkCmdSetCoarseSampleOrderNV}, - {"vkCmdSetColorBlendAdvancedEXT", vkCmdSetColorBlendAdvancedEXT}, - {"vkCmdSetColorBlendEnableEXT", vkCmdSetColorBlendEnableEXT}, - {"vkCmdSetColorBlendEquationEXT", vkCmdSetColorBlendEquationEXT}, - {"vkCmdSetColorWriteEnableEXT", vkCmdSetColorWriteEnableEXT}, - {"vkCmdSetColorWriteMaskEXT", vkCmdSetColorWriteMaskEXT}, - {"vkCmdSetConservativeRasterizationModeEXT", vkCmdSetConservativeRasterizationModeEXT}, - {"vkCmdSetCoverageModulationModeNV", vkCmdSetCoverageModulationModeNV}, - {"vkCmdSetCoverageModulationTableEnableNV", vkCmdSetCoverageModulationTableEnableNV}, - {"vkCmdSetCoverageModulationTableNV", vkCmdSetCoverageModulationTableNV}, - {"vkCmdSetCoverageReductionModeNV", vkCmdSetCoverageReductionModeNV}, - {"vkCmdSetCoverageToColorEnableNV", vkCmdSetCoverageToColorEnableNV}, - {"vkCmdSetCoverageToColorLocationNV", vkCmdSetCoverageToColorLocationNV}, - {"vkCmdSetCullMode", vkCmdSetCullMode}, - {"vkCmdSetCullModeEXT", vkCmdSetCullModeEXT}, - {"vkCmdSetDepthBias", vkCmdSetDepthBias}, - {"vkCmdSetDepthBias2EXT", vkCmdSetDepthBias2EXT}, - {"vkCmdSetDepthBiasEnable", vkCmdSetDepthBiasEnable}, - {"vkCmdSetDepthBiasEnableEXT", vkCmdSetDepthBiasEnableEXT}, - {"vkCmdSetDepthBounds", vkCmdSetDepthBounds}, - {"vkCmdSetDepthBoundsTestEnable", vkCmdSetDepthBoundsTestEnable}, - {"vkCmdSetDepthBoundsTestEnableEXT", vkCmdSetDepthBoundsTestEnableEXT}, - {"vkCmdSetDepthClampEnableEXT", vkCmdSetDepthClampEnableEXT}, - {"vkCmdSetDepthClipEnableEXT", vkCmdSetDepthClipEnableEXT}, - {"vkCmdSetDepthClipNegativeOneToOneEXT", vkCmdSetDepthClipNegativeOneToOneEXT}, - {"vkCmdSetDepthCompareOp", vkCmdSetDepthCompareOp}, - {"vkCmdSetDepthCompareOpEXT", vkCmdSetDepthCompareOpEXT}, - {"vkCmdSetDepthTestEnable", vkCmdSetDepthTestEnable}, - {"vkCmdSetDepthTestEnableEXT", vkCmdSetDepthTestEnableEXT}, - {"vkCmdSetDepthWriteEnable", vkCmdSetDepthWriteEnable}, - {"vkCmdSetDepthWriteEnableEXT", vkCmdSetDepthWriteEnableEXT}, - {"vkCmdSetDescriptorBufferOffsetsEXT", vkCmdSetDescriptorBufferOffsetsEXT}, - {"vkCmdSetDeviceMask", vkCmdSetDeviceMask}, - {"vkCmdSetDeviceMaskKHR", vkCmdSetDeviceMaskKHR}, - {"vkCmdSetDiscardRectangleEXT", vkCmdSetDiscardRectangleEXT}, - {"vkCmdSetDiscardRectangleEnableEXT", vkCmdSetDiscardRectangleEnableEXT}, - {"vkCmdSetDiscardRectangleModeEXT", vkCmdSetDiscardRectangleModeEXT}, - {"vkCmdSetEvent", vkCmdSetEvent}, - {"vkCmdSetEvent2", vkCmdSetEvent2}, - {"vkCmdSetEvent2KHR", vkCmdSetEvent2KHR}, - {"vkCmdSetExclusiveScissorEnableNV", vkCmdSetExclusiveScissorEnableNV}, - {"vkCmdSetExclusiveScissorNV", vkCmdSetExclusiveScissorNV}, - {"vkCmdSetExtraPrimitiveOverestimationSizeEXT", vkCmdSetExtraPrimitiveOverestimationSizeEXT}, - {"vkCmdSetFragmentShadingRateEnumNV", vkCmdSetFragmentShadingRateEnumNV}, - {"vkCmdSetFragmentShadingRateKHR", vkCmdSetFragmentShadingRateKHR}, - {"vkCmdSetFrontFace", vkCmdSetFrontFace}, - {"vkCmdSetFrontFaceEXT", vkCmdSetFrontFaceEXT}, - {"vkCmdSetLineRasterizationModeEXT", vkCmdSetLineRasterizationModeEXT}, - {"vkCmdSetLineStippleEXT", vkCmdSetLineStippleEXT}, - {"vkCmdSetLineStippleEnableEXT", vkCmdSetLineStippleEnableEXT}, - {"vkCmdSetLineWidth", vkCmdSetLineWidth}, - {"vkCmdSetLogicOpEXT", vkCmdSetLogicOpEXT}, - {"vkCmdSetLogicOpEnableEXT", vkCmdSetLogicOpEnableEXT}, - {"vkCmdSetPatchControlPointsEXT", vkCmdSetPatchControlPointsEXT}, - {"vkCmdSetPerformanceMarkerINTEL", vkCmdSetPerformanceMarkerINTEL}, - {"vkCmdSetPerformanceOverrideINTEL", vkCmdSetPerformanceOverrideINTEL}, - {"vkCmdSetPerformanceStreamMarkerINTEL", vkCmdSetPerformanceStreamMarkerINTEL}, - {"vkCmdSetPolygonModeEXT", vkCmdSetPolygonModeEXT}, - {"vkCmdSetPrimitiveRestartEnable", vkCmdSetPrimitiveRestartEnable}, - {"vkCmdSetPrimitiveRestartEnableEXT", vkCmdSetPrimitiveRestartEnableEXT}, - {"vkCmdSetPrimitiveTopology", vkCmdSetPrimitiveTopology}, - {"vkCmdSetPrimitiveTopologyEXT", vkCmdSetPrimitiveTopologyEXT}, - {"vkCmdSetProvokingVertexModeEXT", vkCmdSetProvokingVertexModeEXT}, - {"vkCmdSetRasterizationSamplesEXT", vkCmdSetRasterizationSamplesEXT}, - {"vkCmdSetRasterizationStreamEXT", vkCmdSetRasterizationStreamEXT}, - {"vkCmdSetRasterizerDiscardEnable", vkCmdSetRasterizerDiscardEnable}, - {"vkCmdSetRasterizerDiscardEnableEXT", vkCmdSetRasterizerDiscardEnableEXT}, - {"vkCmdSetRayTracingPipelineStackSizeKHR", vkCmdSetRayTracingPipelineStackSizeKHR}, - {"vkCmdSetRepresentativeFragmentTestEnableNV", vkCmdSetRepresentativeFragmentTestEnableNV}, - {"vkCmdSetSampleLocationsEXT", vkCmdSetSampleLocationsEXT}, - {"vkCmdSetSampleLocationsEnableEXT", vkCmdSetSampleLocationsEnableEXT}, - {"vkCmdSetSampleMaskEXT", vkCmdSetSampleMaskEXT}, - {"vkCmdSetScissor", vkCmdSetScissor}, - {"vkCmdSetScissorWithCount", vkCmdSetScissorWithCount}, - {"vkCmdSetScissorWithCountEXT", vkCmdSetScissorWithCountEXT}, - {"vkCmdSetShadingRateImageEnableNV", vkCmdSetShadingRateImageEnableNV}, - {"vkCmdSetStencilCompareMask", vkCmdSetStencilCompareMask}, - {"vkCmdSetStencilOp", vkCmdSetStencilOp}, - {"vkCmdSetStencilOpEXT", vkCmdSetStencilOpEXT}, - {"vkCmdSetStencilReference", vkCmdSetStencilReference}, - {"vkCmdSetStencilTestEnable", vkCmdSetStencilTestEnable}, - {"vkCmdSetStencilTestEnableEXT", vkCmdSetStencilTestEnableEXT}, - {"vkCmdSetStencilWriteMask", vkCmdSetStencilWriteMask}, - {"vkCmdSetTessellationDomainOriginEXT", vkCmdSetTessellationDomainOriginEXT}, - {"vkCmdSetVertexInputEXT", vkCmdSetVertexInputEXT}, - {"vkCmdSetViewport", vkCmdSetViewport}, - {"vkCmdSetViewportShadingRatePaletteNV", vkCmdSetViewportShadingRatePaletteNV}, - {"vkCmdSetViewportSwizzleNV", vkCmdSetViewportSwizzleNV}, - {"vkCmdSetViewportWScalingEnableNV", vkCmdSetViewportWScalingEnableNV}, - {"vkCmdSetViewportWScalingNV", vkCmdSetViewportWScalingNV}, - {"vkCmdSetViewportWithCount", vkCmdSetViewportWithCount}, - {"vkCmdSetViewportWithCountEXT", vkCmdSetViewportWithCountEXT}, - {"vkCmdSubpassShadingHUAWEI", vkCmdSubpassShadingHUAWEI}, - {"vkCmdTraceRaysIndirect2KHR", vkCmdTraceRaysIndirect2KHR}, - {"vkCmdTraceRaysIndirectKHR", vkCmdTraceRaysIndirectKHR}, - {"vkCmdTraceRaysKHR", vkCmdTraceRaysKHR}, - {"vkCmdTraceRaysNV", vkCmdTraceRaysNV}, - {"vkCmdUpdateBuffer", vkCmdUpdateBuffer}, - {"vkCmdUpdatePipelineIndirectBufferNV", vkCmdUpdatePipelineIndirectBufferNV}, - {"vkCmdWaitEvents", vkCmdWaitEvents}, - {"vkCmdWaitEvents2", vkCmdWaitEvents2}, - {"vkCmdWaitEvents2KHR", vkCmdWaitEvents2KHR}, - {"vkCmdWriteAccelerationStructuresPropertiesKHR", vkCmdWriteAccelerationStructuresPropertiesKHR}, - {"vkCmdWriteAccelerationStructuresPropertiesNV", vkCmdWriteAccelerationStructuresPropertiesNV}, - {"vkCmdWriteBufferMarker2AMD", vkCmdWriteBufferMarker2AMD}, - {"vkCmdWriteBufferMarkerAMD", vkCmdWriteBufferMarkerAMD}, - {"vkCmdWriteMicromapsPropertiesEXT", vkCmdWriteMicromapsPropertiesEXT}, - {"vkCmdWriteTimestamp", vkCmdWriteTimestamp}, - {"vkCmdWriteTimestamp2", vkCmdWriteTimestamp2}, - {"vkCmdWriteTimestamp2KHR", vkCmdWriteTimestamp2KHR}, - {"vkCompileDeferredNV", vkCompileDeferredNV}, - {"vkCopyAccelerationStructureKHR", vkCopyAccelerationStructureKHR}, - {"vkCopyAccelerationStructureToMemoryKHR", vkCopyAccelerationStructureToMemoryKHR}, - {"vkCopyImageToImageEXT", vkCopyImageToImageEXT}, - {"vkCopyImageToMemoryEXT", vkCopyImageToMemoryEXT}, - {"vkCopyMemoryToAccelerationStructureKHR", vkCopyMemoryToAccelerationStructureKHR}, - {"vkCopyMemoryToImageEXT", vkCopyMemoryToImageEXT}, - {"vkCopyMemoryToMicromapEXT", vkCopyMemoryToMicromapEXT}, - {"vkCopyMicromapEXT", vkCopyMicromapEXT}, - {"vkCopyMicromapToMemoryEXT", vkCopyMicromapToMemoryEXT}, - {"vkCreateAccelerationStructureKHR", vkCreateAccelerationStructureKHR}, - {"vkCreateAccelerationStructureNV", vkCreateAccelerationStructureNV}, - {"vkCreateBuffer", vkCreateBuffer}, - {"vkCreateBufferView", vkCreateBufferView}, - {"vkCreateCommandPool", vkCreateCommandPool}, - {"vkCreateComputePipelines", vkCreateComputePipelines}, - {"vkCreateCuFunctionNVX", vkCreateCuFunctionNVX}, - {"vkCreateCuModuleNVX", vkCreateCuModuleNVX}, - {"vkCreateCudaFunctionNV", vkCreateCudaFunctionNV}, - {"vkCreateCudaModuleNV", vkCreateCudaModuleNV}, - {"vkCreateDeferredOperationKHR", vkCreateDeferredOperationKHR}, - {"vkCreateDescriptorPool", vkCreateDescriptorPool}, - {"vkCreateDescriptorSetLayout", vkCreateDescriptorSetLayout}, - {"vkCreateDescriptorUpdateTemplate", vkCreateDescriptorUpdateTemplate}, - {"vkCreateDescriptorUpdateTemplateKHR", vkCreateDescriptorUpdateTemplateKHR}, - {"vkCreateEvent", vkCreateEvent}, - {"vkCreateFence", vkCreateFence}, - {"vkCreateFramebuffer", vkCreateFramebuffer}, - {"vkCreateGraphicsPipelines", vkCreateGraphicsPipelines}, - {"vkCreateImage", vkCreateImage}, - {"vkCreateImageView", vkCreateImageView}, - {"vkCreateIndirectCommandsLayoutNV", vkCreateIndirectCommandsLayoutNV}, - {"vkCreateMicromapEXT", vkCreateMicromapEXT}, - {"vkCreateOpticalFlowSessionNV", vkCreateOpticalFlowSessionNV}, - {"vkCreatePipelineCache", vkCreatePipelineCache}, - {"vkCreatePipelineLayout", vkCreatePipelineLayout}, - {"vkCreatePrivateDataSlot", vkCreatePrivateDataSlot}, - {"vkCreatePrivateDataSlotEXT", vkCreatePrivateDataSlotEXT}, - {"vkCreateQueryPool", vkCreateQueryPool}, - {"vkCreateRayTracingPipelinesKHR", vkCreateRayTracingPipelinesKHR}, - {"vkCreateRayTracingPipelinesNV", vkCreateRayTracingPipelinesNV}, - {"vkCreateRenderPass", vkCreateRenderPass}, - {"vkCreateRenderPass2", vkCreateRenderPass2}, - {"vkCreateRenderPass2KHR", vkCreateRenderPass2KHR}, - {"vkCreateSampler", vkCreateSampler}, - {"vkCreateSamplerYcbcrConversion", vkCreateSamplerYcbcrConversion}, - {"vkCreateSamplerYcbcrConversionKHR", vkCreateSamplerYcbcrConversionKHR}, - {"vkCreateSemaphore", vkCreateSemaphore}, - {"vkCreateShaderModule", vkCreateShaderModule}, - {"vkCreateShadersEXT", vkCreateShadersEXT}, - {"vkCreateSwapchainKHR", vkCreateSwapchainKHR}, - {"vkCreateValidationCacheEXT", vkCreateValidationCacheEXT}, - {"vkDebugMarkerSetObjectNameEXT", vkDebugMarkerSetObjectNameEXT}, - {"vkDebugMarkerSetObjectTagEXT", vkDebugMarkerSetObjectTagEXT}, - {"vkDeferredOperationJoinKHR", vkDeferredOperationJoinKHR}, - {"vkDestroyAccelerationStructureKHR", vkDestroyAccelerationStructureKHR}, - {"vkDestroyAccelerationStructureNV", vkDestroyAccelerationStructureNV}, - {"vkDestroyBuffer", vkDestroyBuffer}, - {"vkDestroyBufferView", vkDestroyBufferView}, - {"vkDestroyCommandPool", vkDestroyCommandPool}, - {"vkDestroyCuFunctionNVX", vkDestroyCuFunctionNVX}, - {"vkDestroyCuModuleNVX", vkDestroyCuModuleNVX}, - {"vkDestroyCudaFunctionNV", vkDestroyCudaFunctionNV}, - {"vkDestroyCudaModuleNV", vkDestroyCudaModuleNV}, - {"vkDestroyDeferredOperationKHR", vkDestroyDeferredOperationKHR}, - {"vkDestroyDescriptorPool", vkDestroyDescriptorPool}, - {"vkDestroyDescriptorSetLayout", vkDestroyDescriptorSetLayout}, - {"vkDestroyDescriptorUpdateTemplate", vkDestroyDescriptorUpdateTemplate}, - {"vkDestroyDescriptorUpdateTemplateKHR", vkDestroyDescriptorUpdateTemplateKHR}, - {"vkDestroyDevice", vkDestroyDevice}, - {"vkDestroyEvent", vkDestroyEvent}, - {"vkDestroyFence", vkDestroyFence}, - {"vkDestroyFramebuffer", vkDestroyFramebuffer}, - {"vkDestroyImage", vkDestroyImage}, - {"vkDestroyImageView", vkDestroyImageView}, - {"vkDestroyIndirectCommandsLayoutNV", vkDestroyIndirectCommandsLayoutNV}, - {"vkDestroyMicromapEXT", vkDestroyMicromapEXT}, - {"vkDestroyOpticalFlowSessionNV", vkDestroyOpticalFlowSessionNV}, - {"vkDestroyPipeline", vkDestroyPipeline}, - {"vkDestroyPipelineCache", vkDestroyPipelineCache}, - {"vkDestroyPipelineLayout", vkDestroyPipelineLayout}, - {"vkDestroyPrivateDataSlot", vkDestroyPrivateDataSlot}, - {"vkDestroyPrivateDataSlotEXT", vkDestroyPrivateDataSlotEXT}, - {"vkDestroyQueryPool", vkDestroyQueryPool}, - {"vkDestroyRenderPass", vkDestroyRenderPass}, - {"vkDestroySampler", vkDestroySampler}, - {"vkDestroySamplerYcbcrConversion", vkDestroySamplerYcbcrConversion}, - {"vkDestroySamplerYcbcrConversionKHR", vkDestroySamplerYcbcrConversionKHR}, - {"vkDestroySemaphore", vkDestroySemaphore}, - {"vkDestroyShaderEXT", vkDestroyShaderEXT}, - {"vkDestroyShaderModule", vkDestroyShaderModule}, - {"vkDestroySwapchainKHR", vkDestroySwapchainKHR}, - {"vkDestroyValidationCacheEXT", vkDestroyValidationCacheEXT}, - {"vkDeviceWaitIdle", vkDeviceWaitIdle}, - {"vkEndCommandBuffer", vkEndCommandBuffer}, - {"vkFlushMappedMemoryRanges", vkFlushMappedMemoryRanges}, - {"vkFreeCommandBuffers", vkFreeCommandBuffers}, - {"vkFreeDescriptorSets", vkFreeDescriptorSets}, - {"vkFreeMemory", vkFreeMemory}, - {"vkGetAccelerationStructureBuildSizesKHR", vkGetAccelerationStructureBuildSizesKHR}, - {"vkGetAccelerationStructureDeviceAddressKHR", vkGetAccelerationStructureDeviceAddressKHR}, - {"vkGetAccelerationStructureHandleNV", vkGetAccelerationStructureHandleNV}, - {"vkGetAccelerationStructureMemoryRequirementsNV", vkGetAccelerationStructureMemoryRequirementsNV}, - {"vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT", vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT}, - {"vkGetBufferDeviceAddress", vkGetBufferDeviceAddress}, - {"vkGetBufferDeviceAddressEXT", vkGetBufferDeviceAddressEXT}, - {"vkGetBufferDeviceAddressKHR", vkGetBufferDeviceAddressKHR}, - {"vkGetBufferMemoryRequirements", vkGetBufferMemoryRequirements}, - {"vkGetBufferMemoryRequirements2", vkGetBufferMemoryRequirements2}, - {"vkGetBufferMemoryRequirements2KHR", vkGetBufferMemoryRequirements2KHR}, - {"vkGetBufferOpaqueCaptureAddress", vkGetBufferOpaqueCaptureAddress}, - {"vkGetBufferOpaqueCaptureAddressKHR", vkGetBufferOpaqueCaptureAddressKHR}, - {"vkGetBufferOpaqueCaptureDescriptorDataEXT", vkGetBufferOpaqueCaptureDescriptorDataEXT}, - {"vkGetCalibratedTimestampsEXT", vkGetCalibratedTimestampsEXT}, - {"vkGetCudaModuleCacheNV", vkGetCudaModuleCacheNV}, - {"vkGetDeferredOperationMaxConcurrencyKHR", vkGetDeferredOperationMaxConcurrencyKHR}, - {"vkGetDeferredOperationResultKHR", vkGetDeferredOperationResultKHR}, - {"vkGetDescriptorEXT", vkGetDescriptorEXT}, - {"vkGetDescriptorSetHostMappingVALVE", vkGetDescriptorSetHostMappingVALVE}, - {"vkGetDescriptorSetLayoutBindingOffsetEXT", vkGetDescriptorSetLayoutBindingOffsetEXT}, - {"vkGetDescriptorSetLayoutHostMappingInfoVALVE", vkGetDescriptorSetLayoutHostMappingInfoVALVE}, - {"vkGetDescriptorSetLayoutSizeEXT", vkGetDescriptorSetLayoutSizeEXT}, - {"vkGetDescriptorSetLayoutSupport", vkGetDescriptorSetLayoutSupport}, - {"vkGetDescriptorSetLayoutSupportKHR", vkGetDescriptorSetLayoutSupportKHR}, - {"vkGetDeviceAccelerationStructureCompatibilityKHR", vkGetDeviceAccelerationStructureCompatibilityKHR}, - {"vkGetDeviceBufferMemoryRequirements", vkGetDeviceBufferMemoryRequirements}, - {"vkGetDeviceBufferMemoryRequirementsKHR", vkGetDeviceBufferMemoryRequirementsKHR}, - {"vkGetDeviceFaultInfoEXT", vkGetDeviceFaultInfoEXT}, - {"vkGetDeviceGroupPeerMemoryFeatures", vkGetDeviceGroupPeerMemoryFeatures}, - {"vkGetDeviceGroupPeerMemoryFeaturesKHR", vkGetDeviceGroupPeerMemoryFeaturesKHR}, - {"vkGetDeviceGroupPresentCapabilitiesKHR", vkGetDeviceGroupPresentCapabilitiesKHR}, - {"vkGetDeviceGroupSurfacePresentModesKHR", vkGetDeviceGroupSurfacePresentModesKHR}, - {"vkGetDeviceImageMemoryRequirements", vkGetDeviceImageMemoryRequirements}, - {"vkGetDeviceImageMemoryRequirementsKHR", vkGetDeviceImageMemoryRequirementsKHR}, - {"vkGetDeviceImageSparseMemoryRequirements", vkGetDeviceImageSparseMemoryRequirements}, - {"vkGetDeviceImageSparseMemoryRequirementsKHR", vkGetDeviceImageSparseMemoryRequirementsKHR}, - {"vkGetDeviceImageSubresourceLayoutKHR", vkGetDeviceImageSubresourceLayoutKHR}, - {"vkGetDeviceMemoryCommitment", vkGetDeviceMemoryCommitment}, - {"vkGetDeviceMemoryOpaqueCaptureAddress", vkGetDeviceMemoryOpaqueCaptureAddress}, - {"vkGetDeviceMemoryOpaqueCaptureAddressKHR", vkGetDeviceMemoryOpaqueCaptureAddressKHR}, - {"vkGetDeviceMicromapCompatibilityEXT", vkGetDeviceMicromapCompatibilityEXT}, - {"vkGetDeviceProcAddr", vkGetDeviceProcAddr}, - {"vkGetDeviceQueue", vkGetDeviceQueue}, - {"vkGetDeviceQueue2", vkGetDeviceQueue2}, - {"vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI", vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI}, - {"vkGetDynamicRenderingTilePropertiesQCOM", vkGetDynamicRenderingTilePropertiesQCOM}, - {"vkGetEventStatus", vkGetEventStatus}, - {"vkGetFenceStatus", vkGetFenceStatus}, - {"vkGetFramebufferTilePropertiesQCOM", vkGetFramebufferTilePropertiesQCOM}, - {"vkGetGeneratedCommandsMemoryRequirementsNV", vkGetGeneratedCommandsMemoryRequirementsNV}, - {"vkGetImageMemoryRequirements", vkGetImageMemoryRequirements}, - {"vkGetImageMemoryRequirements2", vkGetImageMemoryRequirements2}, - {"vkGetImageMemoryRequirements2KHR", vkGetImageMemoryRequirements2KHR}, - {"vkGetImageOpaqueCaptureDescriptorDataEXT", vkGetImageOpaqueCaptureDescriptorDataEXT}, - {"vkGetImageSparseMemoryRequirements", vkGetImageSparseMemoryRequirements}, - {"vkGetImageSparseMemoryRequirements2", vkGetImageSparseMemoryRequirements2}, - {"vkGetImageSparseMemoryRequirements2KHR", vkGetImageSparseMemoryRequirements2KHR}, - {"vkGetImageSubresourceLayout", vkGetImageSubresourceLayout}, - {"vkGetImageSubresourceLayout2EXT", vkGetImageSubresourceLayout2EXT}, - {"vkGetImageSubresourceLayout2KHR", vkGetImageSubresourceLayout2KHR}, - {"vkGetImageViewAddressNVX", vkGetImageViewAddressNVX}, - {"vkGetImageViewHandleNVX", vkGetImageViewHandleNVX}, - {"vkGetImageViewOpaqueCaptureDescriptorDataEXT", vkGetImageViewOpaqueCaptureDescriptorDataEXT}, - {"vkGetLatencyTimingsNV", vkGetLatencyTimingsNV}, - {"vkGetMemoryHostPointerPropertiesEXT", vkGetMemoryHostPointerPropertiesEXT}, - {"vkGetMicromapBuildSizesEXT", vkGetMicromapBuildSizesEXT}, - {"vkGetPerformanceParameterINTEL", vkGetPerformanceParameterINTEL}, - {"vkGetPipelineCacheData", vkGetPipelineCacheData}, - {"vkGetPipelineExecutableInternalRepresentationsKHR", vkGetPipelineExecutableInternalRepresentationsKHR}, - {"vkGetPipelineExecutablePropertiesKHR", vkGetPipelineExecutablePropertiesKHR}, - {"vkGetPipelineExecutableStatisticsKHR", vkGetPipelineExecutableStatisticsKHR}, - {"vkGetPipelineIndirectDeviceAddressNV", vkGetPipelineIndirectDeviceAddressNV}, - {"vkGetPipelineIndirectMemoryRequirementsNV", vkGetPipelineIndirectMemoryRequirementsNV}, - {"vkGetPipelinePropertiesEXT", vkGetPipelinePropertiesEXT}, - {"vkGetPrivateData", vkGetPrivateData}, - {"vkGetPrivateDataEXT", vkGetPrivateDataEXT}, - {"vkGetQueryPoolResults", vkGetQueryPoolResults}, - {"vkGetQueueCheckpointData2NV", vkGetQueueCheckpointData2NV}, - {"vkGetQueueCheckpointDataNV", vkGetQueueCheckpointDataNV}, - {"vkGetRayTracingCaptureReplayShaderGroupHandlesKHR", vkGetRayTracingCaptureReplayShaderGroupHandlesKHR}, - {"vkGetRayTracingShaderGroupHandlesKHR", vkGetRayTracingShaderGroupHandlesKHR}, - {"vkGetRayTracingShaderGroupHandlesNV", vkGetRayTracingShaderGroupHandlesNV}, - {"vkGetRayTracingShaderGroupStackSizeKHR", vkGetRayTracingShaderGroupStackSizeKHR}, - {"vkGetRenderAreaGranularity", vkGetRenderAreaGranularity}, - {"vkGetRenderingAreaGranularityKHR", vkGetRenderingAreaGranularityKHR}, - {"vkGetSamplerOpaqueCaptureDescriptorDataEXT", vkGetSamplerOpaqueCaptureDescriptorDataEXT}, - {"vkGetSemaphoreCounterValue", vkGetSemaphoreCounterValue}, - {"vkGetSemaphoreCounterValueKHR", vkGetSemaphoreCounterValueKHR}, - {"vkGetShaderBinaryDataEXT", vkGetShaderBinaryDataEXT}, - {"vkGetShaderInfoAMD", vkGetShaderInfoAMD}, - {"vkGetShaderModuleCreateInfoIdentifierEXT", vkGetShaderModuleCreateInfoIdentifierEXT}, - {"vkGetShaderModuleIdentifierEXT", vkGetShaderModuleIdentifierEXT}, - {"vkGetSwapchainImagesKHR", vkGetSwapchainImagesKHR}, - {"vkGetValidationCacheDataEXT", vkGetValidationCacheDataEXT}, - {"vkInitializePerformanceApiINTEL", vkInitializePerformanceApiINTEL}, - {"vkInvalidateMappedMemoryRanges", vkInvalidateMappedMemoryRanges}, - {"vkLatencySleepNV", vkLatencySleepNV}, - {"vkMapMemory", vkMapMemory}, - {"vkMapMemory2KHR", vkMapMemory2KHR}, - {"vkMergePipelineCaches", vkMergePipelineCaches}, - {"vkMergeValidationCachesEXT", vkMergeValidationCachesEXT}, - {"vkQueueBeginDebugUtilsLabelEXT", vkQueueBeginDebugUtilsLabelEXT}, - {"vkQueueBindSparse", vkQueueBindSparse}, - {"vkQueueEndDebugUtilsLabelEXT", vkQueueEndDebugUtilsLabelEXT}, - {"vkQueueInsertDebugUtilsLabelEXT", vkQueueInsertDebugUtilsLabelEXT}, - {"vkQueueNotifyOutOfBandNV", vkQueueNotifyOutOfBandNV}, - {"vkQueuePresentKHR", vkQueuePresentKHR}, - {"vkQueueSetPerformanceConfigurationINTEL", vkQueueSetPerformanceConfigurationINTEL}, - {"vkQueueSubmit", vkQueueSubmit}, - {"vkQueueSubmit2", vkQueueSubmit2}, - {"vkQueueSubmit2KHR", vkQueueSubmit2KHR}, - {"vkQueueWaitIdle", vkQueueWaitIdle}, - {"vkReleasePerformanceConfigurationINTEL", vkReleasePerformanceConfigurationINTEL}, - {"vkReleaseProfilingLockKHR", vkReleaseProfilingLockKHR}, - {"vkReleaseSwapchainImagesEXT", vkReleaseSwapchainImagesEXT}, - {"vkResetCommandBuffer", vkResetCommandBuffer}, - {"vkResetCommandPool", vkResetCommandPool}, - {"vkResetDescriptorPool", vkResetDescriptorPool}, - {"vkResetEvent", vkResetEvent}, - {"vkResetFences", vkResetFences}, - {"vkResetQueryPool", vkResetQueryPool}, - {"vkResetQueryPoolEXT", vkResetQueryPoolEXT}, - {"vkSetDebugUtilsObjectNameEXT", vkSetDebugUtilsObjectNameEXT}, - {"vkSetDebugUtilsObjectTagEXT", vkSetDebugUtilsObjectTagEXT}, - {"vkSetDeviceMemoryPriorityEXT", vkSetDeviceMemoryPriorityEXT}, - {"vkSetEvent", vkSetEvent}, - {"vkSetHdrMetadataEXT", vkSetHdrMetadataEXT}, - {"vkSetLatencyMarkerNV", vkSetLatencyMarkerNV}, - {"vkSetLatencySleepModeNV", vkSetLatencySleepModeNV}, - {"vkSetPrivateData", vkSetPrivateData}, - {"vkSetPrivateDataEXT", vkSetPrivateDataEXT}, - {"vkSignalSemaphore", vkSignalSemaphore}, - {"vkSignalSemaphoreKHR", vkSignalSemaphoreKHR}, - {"vkTransitionImageLayoutEXT", vkTransitionImageLayoutEXT}, - {"vkTrimCommandPool", vkTrimCommandPool}, - {"vkTrimCommandPoolKHR", vkTrimCommandPoolKHR}, - {"vkUninitializePerformanceApiINTEL", vkUninitializePerformanceApiINTEL}, - {"vkUnmapMemory", vkUnmapMemory}, - {"vkUnmapMemory2KHR", vkUnmapMemory2KHR}, - {"vkUpdateDescriptorSetWithTemplate", vkUpdateDescriptorSetWithTemplate}, - {"vkUpdateDescriptorSetWithTemplateKHR", vkUpdateDescriptorSetWithTemplateKHR}, - {"vkUpdateDescriptorSets", vkUpdateDescriptorSets}, - {"vkWaitForFences", vkWaitForFences}, - {"vkWaitForPresentKHR", vkWaitForPresentKHR}, - {"vkWaitSemaphores", vkWaitSemaphores}, - {"vkWaitSemaphoresKHR", vkWaitSemaphoresKHR}, - {"vkWriteAccelerationStructuresPropertiesKHR", vkWriteAccelerationStructuresPropertiesKHR}, - {"vkWriteMicromapsPropertiesEXT", vkWriteMicromapsPropertiesEXT}, -}; - -static const struct vulkan_func vk_phys_dev_dispatch_table[] = -{ - {"vkCreateDevice", vkCreateDevice}, - {"vkEnumerateDeviceExtensionProperties", vkEnumerateDeviceExtensionProperties}, - {"vkEnumerateDeviceLayerProperties", vkEnumerateDeviceLayerProperties}, - {"vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR", vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR}, - {"vkGetPhysicalDeviceCalibrateableTimeDomainsEXT", vkGetPhysicalDeviceCalibrateableTimeDomainsEXT}, - {"vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR", vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR}, - {"vkGetPhysicalDeviceCooperativeMatrixPropertiesNV", vkGetPhysicalDeviceCooperativeMatrixPropertiesNV}, - {"vkGetPhysicalDeviceExternalBufferProperties", vkGetPhysicalDeviceExternalBufferProperties}, - {"vkGetPhysicalDeviceExternalBufferPropertiesKHR", vkGetPhysicalDeviceExternalBufferPropertiesKHR}, - {"vkGetPhysicalDeviceExternalFenceProperties", vkGetPhysicalDeviceExternalFenceProperties}, - {"vkGetPhysicalDeviceExternalFencePropertiesKHR", vkGetPhysicalDeviceExternalFencePropertiesKHR}, - {"vkGetPhysicalDeviceExternalSemaphoreProperties", vkGetPhysicalDeviceExternalSemaphoreProperties}, - {"vkGetPhysicalDeviceExternalSemaphorePropertiesKHR", vkGetPhysicalDeviceExternalSemaphorePropertiesKHR}, - {"vkGetPhysicalDeviceFeatures", vkGetPhysicalDeviceFeatures}, - {"vkGetPhysicalDeviceFeatures2", vkGetPhysicalDeviceFeatures2}, - {"vkGetPhysicalDeviceFeatures2KHR", vkGetPhysicalDeviceFeatures2KHR}, - {"vkGetPhysicalDeviceFormatProperties", vkGetPhysicalDeviceFormatProperties}, - {"vkGetPhysicalDeviceFormatProperties2", vkGetPhysicalDeviceFormatProperties2}, - {"vkGetPhysicalDeviceFormatProperties2KHR", vkGetPhysicalDeviceFormatProperties2KHR}, - {"vkGetPhysicalDeviceFragmentShadingRatesKHR", vkGetPhysicalDeviceFragmentShadingRatesKHR}, - {"vkGetPhysicalDeviceImageFormatProperties", vkGetPhysicalDeviceImageFormatProperties}, - {"vkGetPhysicalDeviceImageFormatProperties2", vkGetPhysicalDeviceImageFormatProperties2}, - {"vkGetPhysicalDeviceImageFormatProperties2KHR", vkGetPhysicalDeviceImageFormatProperties2KHR}, - {"vkGetPhysicalDeviceMemoryProperties", vkGetPhysicalDeviceMemoryProperties}, - {"vkGetPhysicalDeviceMemoryProperties2", vkGetPhysicalDeviceMemoryProperties2}, - {"vkGetPhysicalDeviceMemoryProperties2KHR", vkGetPhysicalDeviceMemoryProperties2KHR}, - {"vkGetPhysicalDeviceMultisamplePropertiesEXT", vkGetPhysicalDeviceMultisamplePropertiesEXT}, - {"vkGetPhysicalDeviceOpticalFlowImageFormatsNV", vkGetPhysicalDeviceOpticalFlowImageFormatsNV}, - {"vkGetPhysicalDevicePresentRectanglesKHR", vkGetPhysicalDevicePresentRectanglesKHR}, - {"vkGetPhysicalDeviceProperties", vkGetPhysicalDeviceProperties}, - {"vkGetPhysicalDeviceProperties2", vkGetPhysicalDeviceProperties2}, - {"vkGetPhysicalDeviceProperties2KHR", vkGetPhysicalDeviceProperties2KHR}, - {"vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR", vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR}, - {"vkGetPhysicalDeviceQueueFamilyProperties", vkGetPhysicalDeviceQueueFamilyProperties}, - {"vkGetPhysicalDeviceQueueFamilyProperties2", vkGetPhysicalDeviceQueueFamilyProperties2}, - {"vkGetPhysicalDeviceQueueFamilyProperties2KHR", vkGetPhysicalDeviceQueueFamilyProperties2KHR}, - {"vkGetPhysicalDeviceSparseImageFormatProperties", vkGetPhysicalDeviceSparseImageFormatProperties}, - {"vkGetPhysicalDeviceSparseImageFormatProperties2", vkGetPhysicalDeviceSparseImageFormatProperties2}, - {"vkGetPhysicalDeviceSparseImageFormatProperties2KHR", vkGetPhysicalDeviceSparseImageFormatProperties2KHR}, - {"vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV", vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV}, - {"vkGetPhysicalDeviceSurfaceCapabilities2KHR", vkGetPhysicalDeviceSurfaceCapabilities2KHR}, - {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", vkGetPhysicalDeviceSurfaceCapabilitiesKHR}, - {"vkGetPhysicalDeviceSurfaceFormats2KHR", vkGetPhysicalDeviceSurfaceFormats2KHR}, - {"vkGetPhysicalDeviceSurfaceFormatsKHR", vkGetPhysicalDeviceSurfaceFormatsKHR}, - {"vkGetPhysicalDeviceSurfacePresentModesKHR", vkGetPhysicalDeviceSurfacePresentModesKHR}, - {"vkGetPhysicalDeviceSurfaceSupportKHR", vkGetPhysicalDeviceSurfaceSupportKHR}, - {"vkGetPhysicalDeviceToolProperties", vkGetPhysicalDeviceToolProperties}, - {"vkGetPhysicalDeviceToolPropertiesEXT", vkGetPhysicalDeviceToolPropertiesEXT}, - {"vkGetPhysicalDeviceWin32PresentationSupportKHR", vkGetPhysicalDeviceWin32PresentationSupportKHR}, -}; - -static const struct vulkan_func vk_instance_dispatch_table[] = -{ - {"vkCreateDebugReportCallbackEXT", vkCreateDebugReportCallbackEXT}, - {"vkCreateDebugUtilsMessengerEXT", vkCreateDebugUtilsMessengerEXT}, - {"vkCreateWin32SurfaceKHR", vkCreateWin32SurfaceKHR}, - {"vkDebugReportMessageEXT", vkDebugReportMessageEXT}, - {"vkDestroyDebugReportCallbackEXT", vkDestroyDebugReportCallbackEXT}, - {"vkDestroyDebugUtilsMessengerEXT", vkDestroyDebugUtilsMessengerEXT}, - {"vkDestroyInstance", vkDestroyInstance}, - {"vkDestroySurfaceKHR", vkDestroySurfaceKHR}, - {"vkEnumeratePhysicalDeviceGroups", vkEnumeratePhysicalDeviceGroups}, - {"vkEnumeratePhysicalDeviceGroupsKHR", vkEnumeratePhysicalDeviceGroupsKHR}, - {"vkEnumeratePhysicalDevices", vkEnumeratePhysicalDevices}, - {"vkSubmitDebugUtilsMessageEXT", vkSubmitDebugUtilsMessageEXT}, -}; - -void *wine_vk_get_device_proc_addr(const char *name) -{ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(vk_device_dispatch_table); i++) - { - if (strcmp(vk_device_dispatch_table[i].name, name) == 0) - { - TRACE("Found name=%s in device table\n", debugstr_a(name)); - return vk_device_dispatch_table[i].func; - } - } - return NULL; -} - -void *wine_vk_get_phys_dev_proc_addr(const char *name) -{ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(vk_phys_dev_dispatch_table); i++) - { - if (strcmp(vk_phys_dev_dispatch_table[i].name, name) == 0) - { - TRACE("Found name=%s in physical device table\n", debugstr_a(name)); - return vk_phys_dev_dispatch_table[i].func; - } - } - return NULL; -} - -void *wine_vk_get_instance_proc_addr(const char *name) -{ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(vk_instance_dispatch_table); i++) - { - if (strcmp(vk_instance_dispatch_table[i].name, name) == 0) - { - TRACE("Found name=%s in instance table\n", debugstr_a(name)); - return vk_instance_dispatch_table[i].func; - } - } - return NULL; -} diff --git a/dlls/winevulkan/loader_thunks.h b/dlls/winevulkan/loader_thunks.h deleted file mode 100644 index 2c54017e0c9..00000000000 --- a/dlls/winevulkan/loader_thunks.h +++ /dev/null @@ -1,4978 +0,0 @@ -/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! - * - * This file is generated from Vulkan vk.xml file covered - * by the following copyright and permission notice: - * - * Copyright 2015-2023 The Khronos Group Inc. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef __WINE_VULKAN_LOADER_THUNKS_H -#define __WINE_VULKAN_LOADER_THUNKS_H - -enum unix_call -{ - unix_init, - unix_is_available_instance_function, - unix_is_available_device_function, - unix_vkAcquireNextImage2KHR, - unix_vkAcquireNextImageKHR, - unix_vkAcquirePerformanceConfigurationINTEL, - unix_vkAcquireProfilingLockKHR, - unix_vkAllocateCommandBuffers, - unix_vkAllocateDescriptorSets, - unix_vkAllocateMemory, - unix_vkBeginCommandBuffer, - unix_vkBindAccelerationStructureMemoryNV, - unix_vkBindBufferMemory, - unix_vkBindBufferMemory2, - unix_vkBindBufferMemory2KHR, - unix_vkBindImageMemory, - unix_vkBindImageMemory2, - unix_vkBindImageMemory2KHR, - unix_vkBindOpticalFlowSessionImageNV, - unix_vkBuildAccelerationStructuresKHR, - unix_vkBuildMicromapsEXT, - unix_vkCmdBeginConditionalRenderingEXT, - unix_vkCmdBeginDebugUtilsLabelEXT, - unix_vkCmdBeginQuery, - unix_vkCmdBeginQueryIndexedEXT, - unix_vkCmdBeginRenderPass, - unix_vkCmdBeginRenderPass2, - unix_vkCmdBeginRenderPass2KHR, - unix_vkCmdBeginRendering, - unix_vkCmdBeginRenderingKHR, - unix_vkCmdBeginTransformFeedbackEXT, - unix_vkCmdBindDescriptorBufferEmbeddedSamplersEXT, - unix_vkCmdBindDescriptorBuffersEXT, - unix_vkCmdBindDescriptorSets, - unix_vkCmdBindIndexBuffer, - unix_vkCmdBindIndexBuffer2KHR, - unix_vkCmdBindInvocationMaskHUAWEI, - unix_vkCmdBindPipeline, - unix_vkCmdBindPipelineShaderGroupNV, - unix_vkCmdBindShadersEXT, - unix_vkCmdBindShadingRateImageNV, - unix_vkCmdBindTransformFeedbackBuffersEXT, - unix_vkCmdBindVertexBuffers, - unix_vkCmdBindVertexBuffers2, - unix_vkCmdBindVertexBuffers2EXT, - unix_vkCmdBlitImage, - unix_vkCmdBlitImage2, - unix_vkCmdBlitImage2KHR, - unix_vkCmdBuildAccelerationStructureNV, - unix_vkCmdBuildAccelerationStructuresIndirectKHR, - unix_vkCmdBuildAccelerationStructuresKHR, - unix_vkCmdBuildMicromapsEXT, - unix_vkCmdClearAttachments, - unix_vkCmdClearColorImage, - unix_vkCmdClearDepthStencilImage, - unix_vkCmdCopyAccelerationStructureKHR, - unix_vkCmdCopyAccelerationStructureNV, - unix_vkCmdCopyAccelerationStructureToMemoryKHR, - unix_vkCmdCopyBuffer, - unix_vkCmdCopyBuffer2, - unix_vkCmdCopyBuffer2KHR, - unix_vkCmdCopyBufferToImage, - unix_vkCmdCopyBufferToImage2, - unix_vkCmdCopyBufferToImage2KHR, - unix_vkCmdCopyImage, - unix_vkCmdCopyImage2, - unix_vkCmdCopyImage2KHR, - unix_vkCmdCopyImageToBuffer, - unix_vkCmdCopyImageToBuffer2, - unix_vkCmdCopyImageToBuffer2KHR, - unix_vkCmdCopyMemoryIndirectNV, - unix_vkCmdCopyMemoryToAccelerationStructureKHR, - unix_vkCmdCopyMemoryToImageIndirectNV, - unix_vkCmdCopyMemoryToMicromapEXT, - unix_vkCmdCopyMicromapEXT, - unix_vkCmdCopyMicromapToMemoryEXT, - unix_vkCmdCopyQueryPoolResults, - unix_vkCmdCuLaunchKernelNVX, - unix_vkCmdCudaLaunchKernelNV, - unix_vkCmdDebugMarkerBeginEXT, - unix_vkCmdDebugMarkerEndEXT, - unix_vkCmdDebugMarkerInsertEXT, - unix_vkCmdDecompressMemoryIndirectCountNV, - unix_vkCmdDecompressMemoryNV, - unix_vkCmdDispatch, - unix_vkCmdDispatchBase, - unix_vkCmdDispatchBaseKHR, - unix_vkCmdDispatchIndirect, - unix_vkCmdDraw, - unix_vkCmdDrawClusterHUAWEI, - unix_vkCmdDrawClusterIndirectHUAWEI, - unix_vkCmdDrawIndexed, - unix_vkCmdDrawIndexedIndirect, - unix_vkCmdDrawIndexedIndirectCount, - unix_vkCmdDrawIndexedIndirectCountAMD, - unix_vkCmdDrawIndexedIndirectCountKHR, - unix_vkCmdDrawIndirect, - unix_vkCmdDrawIndirectByteCountEXT, - unix_vkCmdDrawIndirectCount, - unix_vkCmdDrawIndirectCountAMD, - unix_vkCmdDrawIndirectCountKHR, - unix_vkCmdDrawMeshTasksEXT, - unix_vkCmdDrawMeshTasksIndirectCountEXT, - unix_vkCmdDrawMeshTasksIndirectCountNV, - unix_vkCmdDrawMeshTasksIndirectEXT, - unix_vkCmdDrawMeshTasksIndirectNV, - unix_vkCmdDrawMeshTasksNV, - unix_vkCmdDrawMultiEXT, - unix_vkCmdDrawMultiIndexedEXT, - unix_vkCmdEndConditionalRenderingEXT, - unix_vkCmdEndDebugUtilsLabelEXT, - unix_vkCmdEndQuery, - unix_vkCmdEndQueryIndexedEXT, - unix_vkCmdEndRenderPass, - unix_vkCmdEndRenderPass2, - unix_vkCmdEndRenderPass2KHR, - unix_vkCmdEndRendering, - unix_vkCmdEndRenderingKHR, - unix_vkCmdEndTransformFeedbackEXT, - unix_vkCmdExecuteCommands, - unix_vkCmdExecuteGeneratedCommandsNV, - unix_vkCmdFillBuffer, - unix_vkCmdInsertDebugUtilsLabelEXT, - unix_vkCmdNextSubpass, - unix_vkCmdNextSubpass2, - unix_vkCmdNextSubpass2KHR, - unix_vkCmdOpticalFlowExecuteNV, - unix_vkCmdPipelineBarrier, - unix_vkCmdPipelineBarrier2, - unix_vkCmdPipelineBarrier2KHR, - unix_vkCmdPreprocessGeneratedCommandsNV, - unix_vkCmdPushConstants, - unix_vkCmdPushDescriptorSetKHR, - unix_vkCmdPushDescriptorSetWithTemplateKHR, - unix_vkCmdResetEvent, - unix_vkCmdResetEvent2, - unix_vkCmdResetEvent2KHR, - unix_vkCmdResetQueryPool, - unix_vkCmdResolveImage, - unix_vkCmdResolveImage2, - unix_vkCmdResolveImage2KHR, - unix_vkCmdSetAlphaToCoverageEnableEXT, - unix_vkCmdSetAlphaToOneEnableEXT, - unix_vkCmdSetAttachmentFeedbackLoopEnableEXT, - unix_vkCmdSetBlendConstants, - unix_vkCmdSetCheckpointNV, - unix_vkCmdSetCoarseSampleOrderNV, - unix_vkCmdSetColorBlendAdvancedEXT, - unix_vkCmdSetColorBlendEnableEXT, - unix_vkCmdSetColorBlendEquationEXT, - unix_vkCmdSetColorWriteEnableEXT, - unix_vkCmdSetColorWriteMaskEXT, - unix_vkCmdSetConservativeRasterizationModeEXT, - unix_vkCmdSetCoverageModulationModeNV, - unix_vkCmdSetCoverageModulationTableEnableNV, - unix_vkCmdSetCoverageModulationTableNV, - unix_vkCmdSetCoverageReductionModeNV, - unix_vkCmdSetCoverageToColorEnableNV, - unix_vkCmdSetCoverageToColorLocationNV, - unix_vkCmdSetCullMode, - unix_vkCmdSetCullModeEXT, - unix_vkCmdSetDepthBias, - unix_vkCmdSetDepthBias2EXT, - unix_vkCmdSetDepthBiasEnable, - unix_vkCmdSetDepthBiasEnableEXT, - unix_vkCmdSetDepthBounds, - unix_vkCmdSetDepthBoundsTestEnable, - unix_vkCmdSetDepthBoundsTestEnableEXT, - unix_vkCmdSetDepthClampEnableEXT, - unix_vkCmdSetDepthClipEnableEXT, - unix_vkCmdSetDepthClipNegativeOneToOneEXT, - unix_vkCmdSetDepthCompareOp, - unix_vkCmdSetDepthCompareOpEXT, - unix_vkCmdSetDepthTestEnable, - unix_vkCmdSetDepthTestEnableEXT, - unix_vkCmdSetDepthWriteEnable, - unix_vkCmdSetDepthWriteEnableEXT, - unix_vkCmdSetDescriptorBufferOffsetsEXT, - unix_vkCmdSetDeviceMask, - unix_vkCmdSetDeviceMaskKHR, - unix_vkCmdSetDiscardRectangleEXT, - unix_vkCmdSetDiscardRectangleEnableEXT, - unix_vkCmdSetDiscardRectangleModeEXT, - unix_vkCmdSetEvent, - unix_vkCmdSetEvent2, - unix_vkCmdSetEvent2KHR, - unix_vkCmdSetExclusiveScissorEnableNV, - unix_vkCmdSetExclusiveScissorNV, - unix_vkCmdSetExtraPrimitiveOverestimationSizeEXT, - unix_vkCmdSetFragmentShadingRateEnumNV, - unix_vkCmdSetFragmentShadingRateKHR, - unix_vkCmdSetFrontFace, - unix_vkCmdSetFrontFaceEXT, - unix_vkCmdSetLineRasterizationModeEXT, - unix_vkCmdSetLineStippleEXT, - unix_vkCmdSetLineStippleEnableEXT, - unix_vkCmdSetLineWidth, - unix_vkCmdSetLogicOpEXT, - unix_vkCmdSetLogicOpEnableEXT, - unix_vkCmdSetPatchControlPointsEXT, - unix_vkCmdSetPerformanceMarkerINTEL, - unix_vkCmdSetPerformanceOverrideINTEL, - unix_vkCmdSetPerformanceStreamMarkerINTEL, - unix_vkCmdSetPolygonModeEXT, - unix_vkCmdSetPrimitiveRestartEnable, - unix_vkCmdSetPrimitiveRestartEnableEXT, - unix_vkCmdSetPrimitiveTopology, - unix_vkCmdSetPrimitiveTopologyEXT, - unix_vkCmdSetProvokingVertexModeEXT, - unix_vkCmdSetRasterizationSamplesEXT, - unix_vkCmdSetRasterizationStreamEXT, - unix_vkCmdSetRasterizerDiscardEnable, - unix_vkCmdSetRasterizerDiscardEnableEXT, - unix_vkCmdSetRayTracingPipelineStackSizeKHR, - unix_vkCmdSetRepresentativeFragmentTestEnableNV, - unix_vkCmdSetSampleLocationsEXT, - unix_vkCmdSetSampleLocationsEnableEXT, - unix_vkCmdSetSampleMaskEXT, - unix_vkCmdSetScissor, - unix_vkCmdSetScissorWithCount, - unix_vkCmdSetScissorWithCountEXT, - unix_vkCmdSetShadingRateImageEnableNV, - unix_vkCmdSetStencilCompareMask, - unix_vkCmdSetStencilOp, - unix_vkCmdSetStencilOpEXT, - unix_vkCmdSetStencilReference, - unix_vkCmdSetStencilTestEnable, - unix_vkCmdSetStencilTestEnableEXT, - unix_vkCmdSetStencilWriteMask, - unix_vkCmdSetTessellationDomainOriginEXT, - unix_vkCmdSetVertexInputEXT, - unix_vkCmdSetViewport, - unix_vkCmdSetViewportShadingRatePaletteNV, - unix_vkCmdSetViewportSwizzleNV, - unix_vkCmdSetViewportWScalingEnableNV, - unix_vkCmdSetViewportWScalingNV, - unix_vkCmdSetViewportWithCount, - unix_vkCmdSetViewportWithCountEXT, - unix_vkCmdSubpassShadingHUAWEI, - unix_vkCmdTraceRaysIndirect2KHR, - unix_vkCmdTraceRaysIndirectKHR, - unix_vkCmdTraceRaysKHR, - unix_vkCmdTraceRaysNV, - unix_vkCmdUpdateBuffer, - unix_vkCmdUpdatePipelineIndirectBufferNV, - unix_vkCmdWaitEvents, - unix_vkCmdWaitEvents2, - unix_vkCmdWaitEvents2KHR, - unix_vkCmdWriteAccelerationStructuresPropertiesKHR, - unix_vkCmdWriteAccelerationStructuresPropertiesNV, - unix_vkCmdWriteBufferMarker2AMD, - unix_vkCmdWriteBufferMarkerAMD, - unix_vkCmdWriteMicromapsPropertiesEXT, - unix_vkCmdWriteTimestamp, - unix_vkCmdWriteTimestamp2, - unix_vkCmdWriteTimestamp2KHR, - unix_vkCompileDeferredNV, - unix_vkCopyAccelerationStructureKHR, - unix_vkCopyAccelerationStructureToMemoryKHR, - unix_vkCopyImageToImageEXT, - unix_vkCopyImageToMemoryEXT, - unix_vkCopyMemoryToAccelerationStructureKHR, - unix_vkCopyMemoryToImageEXT, - unix_vkCopyMemoryToMicromapEXT, - unix_vkCopyMicromapEXT, - unix_vkCopyMicromapToMemoryEXT, - unix_vkCreateAccelerationStructureKHR, - unix_vkCreateAccelerationStructureNV, - unix_vkCreateBuffer, - unix_vkCreateBufferView, - unix_vkCreateCommandPool, - unix_vkCreateComputePipelines, - unix_vkCreateCuFunctionNVX, - unix_vkCreateCuModuleNVX, - unix_vkCreateCudaFunctionNV, - unix_vkCreateCudaModuleNV, - unix_vkCreateDebugReportCallbackEXT, - unix_vkCreateDebugUtilsMessengerEXT, - unix_vkCreateDeferredOperationKHR, - unix_vkCreateDescriptorPool, - unix_vkCreateDescriptorSetLayout, - unix_vkCreateDescriptorUpdateTemplate, - unix_vkCreateDescriptorUpdateTemplateKHR, - unix_vkCreateDevice, - unix_vkCreateEvent, - unix_vkCreateFence, - unix_vkCreateFramebuffer, - unix_vkCreateGraphicsPipelines, - unix_vkCreateImage, - unix_vkCreateImageView, - unix_vkCreateIndirectCommandsLayoutNV, - unix_vkCreateInstance, - unix_vkCreateMicromapEXT, - unix_vkCreateOpticalFlowSessionNV, - unix_vkCreatePipelineCache, - unix_vkCreatePipelineLayout, - unix_vkCreatePrivateDataSlot, - unix_vkCreatePrivateDataSlotEXT, - unix_vkCreateQueryPool, - unix_vkCreateRayTracingPipelinesKHR, - unix_vkCreateRayTracingPipelinesNV, - unix_vkCreateRenderPass, - unix_vkCreateRenderPass2, - unix_vkCreateRenderPass2KHR, - unix_vkCreateSampler, - unix_vkCreateSamplerYcbcrConversion, - unix_vkCreateSamplerYcbcrConversionKHR, - unix_vkCreateSemaphore, - unix_vkCreateShaderModule, - unix_vkCreateShadersEXT, - unix_vkCreateSwapchainKHR, - unix_vkCreateValidationCacheEXT, - unix_vkCreateWin32SurfaceKHR, - unix_vkDebugMarkerSetObjectNameEXT, - unix_vkDebugMarkerSetObjectTagEXT, - unix_vkDebugReportMessageEXT, - unix_vkDeferredOperationJoinKHR, - unix_vkDestroyAccelerationStructureKHR, - unix_vkDestroyAccelerationStructureNV, - unix_vkDestroyBuffer, - unix_vkDestroyBufferView, - unix_vkDestroyCommandPool, - unix_vkDestroyCuFunctionNVX, - unix_vkDestroyCuModuleNVX, - unix_vkDestroyCudaFunctionNV, - unix_vkDestroyCudaModuleNV, - unix_vkDestroyDebugReportCallbackEXT, - unix_vkDestroyDebugUtilsMessengerEXT, - unix_vkDestroyDeferredOperationKHR, - unix_vkDestroyDescriptorPool, - unix_vkDestroyDescriptorSetLayout, - unix_vkDestroyDescriptorUpdateTemplate, - unix_vkDestroyDescriptorUpdateTemplateKHR, - unix_vkDestroyDevice, - unix_vkDestroyEvent, - unix_vkDestroyFence, - unix_vkDestroyFramebuffer, - unix_vkDestroyImage, - unix_vkDestroyImageView, - unix_vkDestroyIndirectCommandsLayoutNV, - unix_vkDestroyInstance, - unix_vkDestroyMicromapEXT, - unix_vkDestroyOpticalFlowSessionNV, - unix_vkDestroyPipeline, - unix_vkDestroyPipelineCache, - unix_vkDestroyPipelineLayout, - unix_vkDestroyPrivateDataSlot, - unix_vkDestroyPrivateDataSlotEXT, - unix_vkDestroyQueryPool, - unix_vkDestroyRenderPass, - unix_vkDestroySampler, - unix_vkDestroySamplerYcbcrConversion, - unix_vkDestroySamplerYcbcrConversionKHR, - unix_vkDestroySemaphore, - unix_vkDestroyShaderEXT, - unix_vkDestroyShaderModule, - unix_vkDestroySurfaceKHR, - unix_vkDestroySwapchainKHR, - unix_vkDestroyValidationCacheEXT, - unix_vkDeviceWaitIdle, - unix_vkEndCommandBuffer, - unix_vkEnumerateDeviceExtensionProperties, - unix_vkEnumerateDeviceLayerProperties, - unix_vkEnumerateInstanceExtensionProperties, - unix_vkEnumerateInstanceVersion, - unix_vkEnumeratePhysicalDeviceGroups, - unix_vkEnumeratePhysicalDeviceGroupsKHR, - unix_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, - unix_vkEnumeratePhysicalDevices, - unix_vkFlushMappedMemoryRanges, - unix_vkFreeCommandBuffers, - unix_vkFreeDescriptorSets, - unix_vkFreeMemory, - unix_vkGetAccelerationStructureBuildSizesKHR, - unix_vkGetAccelerationStructureDeviceAddressKHR, - unix_vkGetAccelerationStructureHandleNV, - unix_vkGetAccelerationStructureMemoryRequirementsNV, - unix_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT, - unix_vkGetBufferDeviceAddress, - unix_vkGetBufferDeviceAddressEXT, - unix_vkGetBufferDeviceAddressKHR, - unix_vkGetBufferMemoryRequirements, - unix_vkGetBufferMemoryRequirements2, - unix_vkGetBufferMemoryRequirements2KHR, - unix_vkGetBufferOpaqueCaptureAddress, - unix_vkGetBufferOpaqueCaptureAddressKHR, - unix_vkGetBufferOpaqueCaptureDescriptorDataEXT, - unix_vkGetCalibratedTimestampsEXT, - unix_vkGetCudaModuleCacheNV, - unix_vkGetDeferredOperationMaxConcurrencyKHR, - unix_vkGetDeferredOperationResultKHR, - unix_vkGetDescriptorEXT, - unix_vkGetDescriptorSetHostMappingVALVE, - unix_vkGetDescriptorSetLayoutBindingOffsetEXT, - unix_vkGetDescriptorSetLayoutHostMappingInfoVALVE, - unix_vkGetDescriptorSetLayoutSizeEXT, - unix_vkGetDescriptorSetLayoutSupport, - unix_vkGetDescriptorSetLayoutSupportKHR, - unix_vkGetDeviceAccelerationStructureCompatibilityKHR, - unix_vkGetDeviceBufferMemoryRequirements, - unix_vkGetDeviceBufferMemoryRequirementsKHR, - unix_vkGetDeviceFaultInfoEXT, - unix_vkGetDeviceGroupPeerMemoryFeatures, - unix_vkGetDeviceGroupPeerMemoryFeaturesKHR, - unix_vkGetDeviceGroupPresentCapabilitiesKHR, - unix_vkGetDeviceGroupSurfacePresentModesKHR, - unix_vkGetDeviceImageMemoryRequirements, - unix_vkGetDeviceImageMemoryRequirementsKHR, - unix_vkGetDeviceImageSparseMemoryRequirements, - unix_vkGetDeviceImageSparseMemoryRequirementsKHR, - unix_vkGetDeviceImageSubresourceLayoutKHR, - unix_vkGetDeviceMemoryCommitment, - unix_vkGetDeviceMemoryOpaqueCaptureAddress, - unix_vkGetDeviceMemoryOpaqueCaptureAddressKHR, - unix_vkGetDeviceMicromapCompatibilityEXT, - unix_vkGetDeviceQueue, - unix_vkGetDeviceQueue2, - unix_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI, - unix_vkGetDynamicRenderingTilePropertiesQCOM, - unix_vkGetEventStatus, - unix_vkGetFenceStatus, - unix_vkGetFramebufferTilePropertiesQCOM, - unix_vkGetGeneratedCommandsMemoryRequirementsNV, - unix_vkGetImageMemoryRequirements, - unix_vkGetImageMemoryRequirements2, - unix_vkGetImageMemoryRequirements2KHR, - unix_vkGetImageOpaqueCaptureDescriptorDataEXT, - unix_vkGetImageSparseMemoryRequirements, - unix_vkGetImageSparseMemoryRequirements2, - unix_vkGetImageSparseMemoryRequirements2KHR, - unix_vkGetImageSubresourceLayout, - unix_vkGetImageSubresourceLayout2EXT, - unix_vkGetImageSubresourceLayout2KHR, - unix_vkGetImageViewAddressNVX, - unix_vkGetImageViewHandleNVX, - unix_vkGetImageViewOpaqueCaptureDescriptorDataEXT, - unix_vkGetLatencyTimingsNV, - unix_vkGetMemoryHostPointerPropertiesEXT, - unix_vkGetMicromapBuildSizesEXT, - unix_vkGetPerformanceParameterINTEL, - unix_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, - unix_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR, - unix_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV, - unix_vkGetPhysicalDeviceExternalBufferProperties, - unix_vkGetPhysicalDeviceExternalBufferPropertiesKHR, - unix_vkGetPhysicalDeviceExternalFenceProperties, - unix_vkGetPhysicalDeviceExternalFencePropertiesKHR, - unix_vkGetPhysicalDeviceExternalSemaphoreProperties, - unix_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, - unix_vkGetPhysicalDeviceFeatures, - unix_vkGetPhysicalDeviceFeatures2, - unix_vkGetPhysicalDeviceFeatures2KHR, - unix_vkGetPhysicalDeviceFormatProperties, - unix_vkGetPhysicalDeviceFormatProperties2, - unix_vkGetPhysicalDeviceFormatProperties2KHR, - unix_vkGetPhysicalDeviceFragmentShadingRatesKHR, - unix_vkGetPhysicalDeviceImageFormatProperties, - unix_vkGetPhysicalDeviceImageFormatProperties2, - unix_vkGetPhysicalDeviceImageFormatProperties2KHR, - unix_vkGetPhysicalDeviceMemoryProperties, - unix_vkGetPhysicalDeviceMemoryProperties2, - unix_vkGetPhysicalDeviceMemoryProperties2KHR, - unix_vkGetPhysicalDeviceMultisamplePropertiesEXT, - unix_vkGetPhysicalDeviceOpticalFlowImageFormatsNV, - unix_vkGetPhysicalDevicePresentRectanglesKHR, - unix_vkGetPhysicalDeviceProperties, - unix_vkGetPhysicalDeviceProperties2, - unix_vkGetPhysicalDeviceProperties2KHR, - unix_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, - unix_vkGetPhysicalDeviceQueueFamilyProperties, - unix_vkGetPhysicalDeviceQueueFamilyProperties2, - unix_vkGetPhysicalDeviceQueueFamilyProperties2KHR, - unix_vkGetPhysicalDeviceSparseImageFormatProperties, - unix_vkGetPhysicalDeviceSparseImageFormatProperties2, - unix_vkGetPhysicalDeviceSparseImageFormatProperties2KHR, - unix_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV, - unix_vkGetPhysicalDeviceSurfaceCapabilities2KHR, - unix_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, - unix_vkGetPhysicalDeviceSurfaceFormats2KHR, - unix_vkGetPhysicalDeviceSurfaceFormatsKHR, - unix_vkGetPhysicalDeviceSurfacePresentModesKHR, - unix_vkGetPhysicalDeviceSurfaceSupportKHR, - unix_vkGetPhysicalDeviceToolProperties, - unix_vkGetPhysicalDeviceToolPropertiesEXT, - unix_vkGetPhysicalDeviceWin32PresentationSupportKHR, - unix_vkGetPipelineCacheData, - unix_vkGetPipelineExecutableInternalRepresentationsKHR, - unix_vkGetPipelineExecutablePropertiesKHR, - unix_vkGetPipelineExecutableStatisticsKHR, - unix_vkGetPipelineIndirectDeviceAddressNV, - unix_vkGetPipelineIndirectMemoryRequirementsNV, - unix_vkGetPipelinePropertiesEXT, - unix_vkGetPrivateData, - unix_vkGetPrivateDataEXT, - unix_vkGetQueryPoolResults, - unix_vkGetQueueCheckpointData2NV, - unix_vkGetQueueCheckpointDataNV, - unix_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR, - unix_vkGetRayTracingShaderGroupHandlesKHR, - unix_vkGetRayTracingShaderGroupHandlesNV, - unix_vkGetRayTracingShaderGroupStackSizeKHR, - unix_vkGetRenderAreaGranularity, - unix_vkGetRenderingAreaGranularityKHR, - unix_vkGetSamplerOpaqueCaptureDescriptorDataEXT, - unix_vkGetSemaphoreCounterValue, - unix_vkGetSemaphoreCounterValueKHR, - unix_vkGetShaderBinaryDataEXT, - unix_vkGetShaderInfoAMD, - unix_vkGetShaderModuleCreateInfoIdentifierEXT, - unix_vkGetShaderModuleIdentifierEXT, - unix_vkGetSwapchainImagesKHR, - unix_vkGetValidationCacheDataEXT, - unix_vkInitializePerformanceApiINTEL, - unix_vkInvalidateMappedMemoryRanges, - unix_vkLatencySleepNV, - unix_vkMapMemory, - unix_vkMapMemory2KHR, - unix_vkMergePipelineCaches, - unix_vkMergeValidationCachesEXT, - unix_vkQueueBeginDebugUtilsLabelEXT, - unix_vkQueueBindSparse, - unix_vkQueueEndDebugUtilsLabelEXT, - unix_vkQueueInsertDebugUtilsLabelEXT, - unix_vkQueueNotifyOutOfBandNV, - unix_vkQueuePresentKHR, - unix_vkQueueSetPerformanceConfigurationINTEL, - unix_vkQueueSubmit, - unix_vkQueueSubmit2, - unix_vkQueueSubmit2KHR, - unix_vkQueueWaitIdle, - unix_vkReleasePerformanceConfigurationINTEL, - unix_vkReleaseProfilingLockKHR, - unix_vkReleaseSwapchainImagesEXT, - unix_vkResetCommandBuffer, - unix_vkResetCommandPool, - unix_vkResetDescriptorPool, - unix_vkResetEvent, - unix_vkResetFences, - unix_vkResetQueryPool, - unix_vkResetQueryPoolEXT, - unix_vkSetDebugUtilsObjectNameEXT, - unix_vkSetDebugUtilsObjectTagEXT, - unix_vkSetDeviceMemoryPriorityEXT, - unix_vkSetEvent, - unix_vkSetHdrMetadataEXT, - unix_vkSetLatencyMarkerNV, - unix_vkSetLatencySleepModeNV, - unix_vkSetPrivateData, - unix_vkSetPrivateDataEXT, - unix_vkSignalSemaphore, - unix_vkSignalSemaphoreKHR, - unix_vkSubmitDebugUtilsMessageEXT, - unix_vkTransitionImageLayoutEXT, - unix_vkTrimCommandPool, - unix_vkTrimCommandPoolKHR, - unix_vkUninitializePerformanceApiINTEL, - unix_vkUnmapMemory, - unix_vkUnmapMemory2KHR, - unix_vkUpdateDescriptorSetWithTemplate, - unix_vkUpdateDescriptorSetWithTemplateKHR, - unix_vkUpdateDescriptorSets, - unix_vkWaitForFences, - unix_vkWaitForPresentKHR, - unix_vkWaitSemaphores, - unix_vkWaitSemaphoresKHR, - unix_vkWriteAccelerationStructuresPropertiesKHR, - unix_vkWriteMicromapsPropertiesEXT, - unix_count, -}; - -struct vkAcquireNextImage2KHR_params -{ - VkDevice device; - const VkAcquireNextImageInfoKHR *pAcquireInfo; - uint32_t *pImageIndex; - VkResult result; -}; - -struct vkAcquireNextImageKHR_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - VkFence DECLSPEC_ALIGN(8) fence; - uint32_t *pImageIndex; - VkResult result; -}; - -struct vkAcquirePerformanceConfigurationINTEL_params -{ - VkDevice device; - const VkPerformanceConfigurationAcquireInfoINTEL *pAcquireInfo; - VkPerformanceConfigurationINTEL *pConfiguration; - VkResult result; -}; - -struct vkAcquireProfilingLockKHR_params -{ - VkDevice device; - const VkAcquireProfilingLockInfoKHR *pInfo; - VkResult result; -}; - -struct vkAllocateCommandBuffers_params -{ - VkDevice device; - const VkCommandBufferAllocateInfo *pAllocateInfo; - VkCommandBuffer *pCommandBuffers; - VkResult result; -}; - -struct vkAllocateDescriptorSets_params -{ - VkDevice device; - const VkDescriptorSetAllocateInfo *pAllocateInfo; - VkDescriptorSet *pDescriptorSets; - VkResult result; -}; - -struct vkAllocateMemory_params -{ - VkDevice device; - const VkMemoryAllocateInfo *pAllocateInfo; - const VkAllocationCallbacks *pAllocator; - VkDeviceMemory *pMemory; - VkResult result; -}; - -struct vkBeginCommandBuffer_params -{ - VkCommandBuffer commandBuffer; - const VkCommandBufferBeginInfo *pBeginInfo; - VkResult result; -}; - -struct vkBindAccelerationStructureMemoryNV_params -{ - VkDevice device; - uint32_t bindInfoCount; - const VkBindAccelerationStructureMemoryInfoNV *pBindInfos; - VkResult result; -}; - -struct vkBindBufferMemory_params -{ - VkDevice device; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - VkResult result; -}; - -struct vkBindBufferMemory2_params -{ - VkDevice device; - uint32_t bindInfoCount; - const VkBindBufferMemoryInfo *pBindInfos; - VkResult result; -}; - -struct vkBindBufferMemory2KHR_params -{ - VkDevice device; - uint32_t bindInfoCount; - const VkBindBufferMemoryInfo *pBindInfos; - VkResult result; -}; - -struct vkBindImageMemory_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - VkResult result; -}; - -struct vkBindImageMemory2_params -{ - VkDevice device; - uint32_t bindInfoCount; - const VkBindImageMemoryInfo *pBindInfos; - VkResult result; -}; - -struct vkBindImageMemory2KHR_params -{ - VkDevice device; - uint32_t bindInfoCount; - const VkBindImageMemoryInfo *pBindInfos; - VkResult result; -}; - -struct vkBindOpticalFlowSessionImageNV_params -{ - VkDevice device; - VkOpticalFlowSessionNV DECLSPEC_ALIGN(8) session; - VkOpticalFlowSessionBindingPointNV bindingPoint; - VkImageView DECLSPEC_ALIGN(8) view; - VkImageLayout layout; - VkResult result; -}; - -struct vkBuildAccelerationStructuresKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - uint32_t infoCount; - const VkAccelerationStructureBuildGeometryInfoKHR *pInfos; - const VkAccelerationStructureBuildRangeInfoKHR * const*ppBuildRangeInfos; - VkResult result; -}; - -struct vkBuildMicromapsEXT_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - uint32_t infoCount; - const VkMicromapBuildInfoEXT *pInfos; - VkResult result; -}; - -struct vkCmdBeginConditionalRenderingEXT_params -{ - VkCommandBuffer commandBuffer; - const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin; -}; - -struct vkCmdBeginDebugUtilsLabelEXT_params -{ - VkCommandBuffer commandBuffer; - const VkDebugUtilsLabelEXT *pLabelInfo; -}; - -struct vkCmdBeginQuery_params -{ - VkCommandBuffer commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - VkQueryControlFlags flags; -}; - -struct vkCmdBeginQueryIndexedEXT_params -{ - VkCommandBuffer commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - VkQueryControlFlags flags; - uint32_t index; -}; - -struct vkCmdBeginRenderPass_params -{ - VkCommandBuffer commandBuffer; - const VkRenderPassBeginInfo *pRenderPassBegin; - VkSubpassContents contents; -}; - -struct vkCmdBeginRenderPass2_params -{ - VkCommandBuffer commandBuffer; - const VkRenderPassBeginInfo *pRenderPassBegin; - const VkSubpassBeginInfo *pSubpassBeginInfo; -}; - -struct vkCmdBeginRenderPass2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkRenderPassBeginInfo *pRenderPassBegin; - const VkSubpassBeginInfo *pSubpassBeginInfo; -}; - -struct vkCmdBeginRendering_params -{ - VkCommandBuffer commandBuffer; - const VkRenderingInfo *pRenderingInfo; -}; - -struct vkCmdBeginRenderingKHR_params -{ - VkCommandBuffer commandBuffer; - const VkRenderingInfo *pRenderingInfo; -}; - -struct vkCmdBeginTransformFeedbackEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstCounterBuffer; - uint32_t counterBufferCount; - const VkBuffer *pCounterBuffers; - const VkDeviceSize *pCounterBufferOffsets; -}; - -struct vkCmdBindDescriptorBufferEmbeddedSamplersEXT_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t set; -}; - -struct vkCmdBindDescriptorBuffersEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t bufferCount; - const VkDescriptorBufferBindingInfoEXT *pBindingInfos; -}; - -struct vkCmdBindDescriptorSets_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t firstSet; - uint32_t descriptorSetCount; - const VkDescriptorSet *pDescriptorSets; - uint32_t dynamicOffsetCount; - const uint32_t *pDynamicOffsets; -}; - -struct vkCmdBindIndexBuffer_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkIndexType indexType; -}; - -struct vkCmdBindIndexBuffer2KHR_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkIndexType indexType; -}; - -struct vkCmdBindInvocationMaskHUAWEI_params -{ - VkCommandBuffer commandBuffer; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; -}; - -struct vkCmdBindPipeline_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; -}; - -struct vkCmdBindPipelineShaderGroupNV_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t groupIndex; -}; - -struct vkCmdBindShadersEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t stageCount; - const VkShaderStageFlagBits *pStages; - const VkShaderEXT *pShaders; -}; - -struct vkCmdBindShadingRateImageNV_params -{ - VkCommandBuffer commandBuffer; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; -}; - -struct vkCmdBindTransformFeedbackBuffersEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - const VkBuffer *pBuffers; - const VkDeviceSize *pOffsets; - const VkDeviceSize *pSizes; -}; - -struct vkCmdBindVertexBuffers_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - const VkBuffer *pBuffers; - const VkDeviceSize *pOffsets; -}; - -struct vkCmdBindVertexBuffers2_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - const VkBuffer *pBuffers; - const VkDeviceSize *pOffsets; - const VkDeviceSize *pSizes; - const VkDeviceSize *pStrides; -}; - -struct vkCmdBindVertexBuffers2EXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - const VkBuffer *pBuffers; - const VkDeviceSize *pOffsets; - const VkDeviceSize *pSizes; - const VkDeviceSize *pStrides; -}; - -struct vkCmdBlitImage_params -{ - VkCommandBuffer commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageBlit *pRegions; - VkFilter filter; -}; - -struct vkCmdBlitImage2_params -{ - VkCommandBuffer commandBuffer; - const VkBlitImageInfo2 *pBlitImageInfo; -}; - -struct vkCmdBlitImage2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkBlitImageInfo2 *pBlitImageInfo; -}; - -struct vkCmdBuildAccelerationStructureNV_params -{ - VkCommandBuffer commandBuffer; - const VkAccelerationStructureInfoNV *pInfo; - VkBuffer DECLSPEC_ALIGN(8) instanceData; - VkDeviceSize DECLSPEC_ALIGN(8) instanceOffset; - VkBool32 update; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) dst; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) src; - VkBuffer DECLSPEC_ALIGN(8) scratch; - VkDeviceSize DECLSPEC_ALIGN(8) scratchOffset; -}; - -struct vkCmdBuildAccelerationStructuresIndirectKHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t infoCount; - const VkAccelerationStructureBuildGeometryInfoKHR *pInfos; - const VkDeviceAddress *pIndirectDeviceAddresses; - const uint32_t *pIndirectStrides; - const uint32_t * const*ppMaxPrimitiveCounts; -}; - -struct vkCmdBuildAccelerationStructuresKHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t infoCount; - const VkAccelerationStructureBuildGeometryInfoKHR *pInfos; - const VkAccelerationStructureBuildRangeInfoKHR * const*ppBuildRangeInfos; -}; - -struct vkCmdBuildMicromapsEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t infoCount; - const VkMicromapBuildInfoEXT *pInfos; -}; - -struct vkCmdClearAttachments_params -{ - VkCommandBuffer commandBuffer; - uint32_t attachmentCount; - const VkClearAttachment *pAttachments; - uint32_t rectCount; - const VkClearRect *pRects; -}; - -struct vkCmdClearColorImage_params -{ - VkCommandBuffer commandBuffer; - VkImage DECLSPEC_ALIGN(8) image; - VkImageLayout imageLayout; - const VkClearColorValue *pColor; - uint32_t rangeCount; - const VkImageSubresourceRange *pRanges; -}; - -struct vkCmdClearDepthStencilImage_params -{ - VkCommandBuffer commandBuffer; - VkImage DECLSPEC_ALIGN(8) image; - VkImageLayout imageLayout; - const VkClearDepthStencilValue *pDepthStencil; - uint32_t rangeCount; - const VkImageSubresourceRange *pRanges; -}; - -struct vkCmdCopyAccelerationStructureKHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyAccelerationStructureInfoKHR *pInfo; -}; - -struct vkCmdCopyAccelerationStructureNV_params -{ - VkCommandBuffer commandBuffer; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) dst; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) src; - VkCopyAccelerationStructureModeKHR mode; -}; - -struct vkCmdCopyAccelerationStructureToMemoryKHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo; -}; - -struct vkCmdCopyBuffer_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) srcBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - uint32_t regionCount; - const VkBufferCopy *pRegions; -}; - -struct vkCmdCopyBuffer2_params -{ - VkCommandBuffer commandBuffer; - const VkCopyBufferInfo2 *pCopyBufferInfo; -}; - -struct vkCmdCopyBuffer2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyBufferInfo2 *pCopyBufferInfo; -}; - -struct vkCmdCopyBufferToImage_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) srcBuffer; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkBufferImageCopy *pRegions; -}; - -struct vkCmdCopyBufferToImage2_params -{ - VkCommandBuffer commandBuffer; - const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo; -}; - -struct vkCmdCopyBufferToImage2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo; -}; - -struct vkCmdCopyImage_params -{ - VkCommandBuffer commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageCopy *pRegions; -}; - -struct vkCmdCopyImage2_params -{ - VkCommandBuffer commandBuffer; - const VkCopyImageInfo2 *pCopyImageInfo; -}; - -struct vkCmdCopyImage2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyImageInfo2 *pCopyImageInfo; -}; - -struct vkCmdCopyImageToBuffer_params -{ - VkCommandBuffer commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - uint32_t regionCount; - const VkBufferImageCopy *pRegions; -}; - -struct vkCmdCopyImageToBuffer2_params -{ - VkCommandBuffer commandBuffer; - const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo; -}; - -struct vkCmdCopyImageToBuffer2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo; -}; - -struct vkCmdCopyMemoryIndirectNV_params -{ - VkCommandBuffer commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) copyBufferAddress; - uint32_t copyCount; - uint32_t stride; -}; - -struct vkCmdCopyMemoryToAccelerationStructureKHR_params -{ - VkCommandBuffer commandBuffer; - const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo; -}; - -struct vkCmdCopyMemoryToImageIndirectNV_params -{ - VkCommandBuffer commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) copyBufferAddress; - uint32_t copyCount; - uint32_t stride; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - const VkImageSubresourceLayers *pImageSubresources; -}; - -struct vkCmdCopyMemoryToMicromapEXT_params -{ - VkCommandBuffer commandBuffer; - const VkCopyMemoryToMicromapInfoEXT *pInfo; -}; - -struct vkCmdCopyMicromapEXT_params -{ - VkCommandBuffer commandBuffer; - const VkCopyMicromapInfoEXT *pInfo; -}; - -struct vkCmdCopyMicromapToMemoryEXT_params -{ - VkCommandBuffer commandBuffer; - const VkCopyMicromapToMemoryInfoEXT *pInfo; -}; - -struct vkCmdCopyQueryPoolResults_params -{ - VkCommandBuffer commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) stride; - VkQueryResultFlags flags; -}; - -struct vkCmdCuLaunchKernelNVX_params -{ - VkCommandBuffer commandBuffer; - const VkCuLaunchInfoNVX *pLaunchInfo; -}; - -struct vkCmdCudaLaunchKernelNV_params -{ - VkCommandBuffer commandBuffer; - const VkCudaLaunchInfoNV *pLaunchInfo; -}; - -struct vkCmdDebugMarkerBeginEXT_params -{ - VkCommandBuffer commandBuffer; - const VkDebugMarkerMarkerInfoEXT *pMarkerInfo; -}; - -struct vkCmdDebugMarkerEndEXT_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdDebugMarkerInsertEXT_params -{ - VkCommandBuffer commandBuffer; - const VkDebugMarkerMarkerInfoEXT *pMarkerInfo; -}; - -struct vkCmdDecompressMemoryIndirectCountNV_params -{ - VkCommandBuffer commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectCommandsAddress; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectCommandsCountAddress; - uint32_t stride; -}; - -struct vkCmdDecompressMemoryNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t decompressRegionCount; - const VkDecompressMemoryRegionNV *pDecompressMemoryRegions; -}; - -struct vkCmdDispatch_params -{ - VkCommandBuffer commandBuffer; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; -}; - -struct vkCmdDispatchBase_params -{ - VkCommandBuffer commandBuffer; - uint32_t baseGroupX; - uint32_t baseGroupY; - uint32_t baseGroupZ; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; -}; - -struct vkCmdDispatchBaseKHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t baseGroupX; - uint32_t baseGroupY; - uint32_t baseGroupZ; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; -}; - -struct vkCmdDispatchIndirect_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; -}; - -struct vkCmdDraw_params -{ - VkCommandBuffer commandBuffer; - uint32_t vertexCount; - uint32_t instanceCount; - uint32_t firstVertex; - uint32_t firstInstance; -}; - -struct vkCmdDrawClusterHUAWEI_params -{ - VkCommandBuffer commandBuffer; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; -}; - -struct vkCmdDrawClusterIndirectHUAWEI_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; -}; - -struct vkCmdDrawIndexed_params -{ - VkCommandBuffer commandBuffer; - uint32_t indexCount; - uint32_t instanceCount; - uint32_t firstIndex; - int32_t vertexOffset; - uint32_t firstInstance; -}; - -struct vkCmdDrawIndexedIndirect_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndexedIndirectCount_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndexedIndirectCountAMD_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndexedIndirectCountKHR_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndirect_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndirectByteCountEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t instanceCount; - uint32_t firstInstance; - VkBuffer DECLSPEC_ALIGN(8) counterBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) counterBufferOffset; - uint32_t counterOffset; - uint32_t vertexStride; -}; - -struct vkCmdDrawIndirectCount_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndirectCountAMD_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawIndirectCountKHR_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawMeshTasksEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; -}; - -struct vkCmdDrawMeshTasksIndirectCountEXT_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawMeshTasksIndirectCountNV_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; -}; - -struct vkCmdDrawMeshTasksIndirectEXT_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; -}; - -struct vkCmdDrawMeshTasksIndirectNV_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; -}; - -struct vkCmdDrawMeshTasksNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t taskCount; - uint32_t firstTask; -}; - -struct vkCmdDrawMultiEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t drawCount; - const VkMultiDrawInfoEXT *pVertexInfo; - uint32_t instanceCount; - uint32_t firstInstance; - uint32_t stride; -}; - -struct vkCmdDrawMultiIndexedEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t drawCount; - const VkMultiDrawIndexedInfoEXT *pIndexInfo; - uint32_t instanceCount; - uint32_t firstInstance; - uint32_t stride; - const int32_t *pVertexOffset; -}; - -struct vkCmdEndConditionalRenderingEXT_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdEndDebugUtilsLabelEXT_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdEndQuery_params -{ - VkCommandBuffer commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; -}; - -struct vkCmdEndQueryIndexedEXT_params -{ - VkCommandBuffer commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - uint32_t index; -}; - -struct vkCmdEndRenderPass_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdEndRenderPass2_params -{ - VkCommandBuffer commandBuffer; - const VkSubpassEndInfo *pSubpassEndInfo; -}; - -struct vkCmdEndRenderPass2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkSubpassEndInfo *pSubpassEndInfo; -}; - -struct vkCmdEndRendering_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdEndRenderingKHR_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdEndTransformFeedbackEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstCounterBuffer; - uint32_t counterBufferCount; - const VkBuffer *pCounterBuffers; - const VkDeviceSize *pCounterBufferOffsets; -}; - -struct vkCmdExecuteCommands_params -{ - VkCommandBuffer commandBuffer; - uint32_t commandBufferCount; - const VkCommandBuffer *pCommandBuffers; -}; - -struct vkCmdExecuteGeneratedCommandsNV_params -{ - VkCommandBuffer commandBuffer; - VkBool32 isPreprocessed; - const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo; -}; - -struct vkCmdFillBuffer_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - uint32_t data; -}; - -struct vkCmdInsertDebugUtilsLabelEXT_params -{ - VkCommandBuffer commandBuffer; - const VkDebugUtilsLabelEXT *pLabelInfo; -}; - -struct vkCmdNextSubpass_params -{ - VkCommandBuffer commandBuffer; - VkSubpassContents contents; -}; - -struct vkCmdNextSubpass2_params -{ - VkCommandBuffer commandBuffer; - const VkSubpassBeginInfo *pSubpassBeginInfo; - const VkSubpassEndInfo *pSubpassEndInfo; -}; - -struct vkCmdNextSubpass2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkSubpassBeginInfo *pSubpassBeginInfo; - const VkSubpassEndInfo *pSubpassEndInfo; -}; - -struct vkCmdOpticalFlowExecuteNV_params -{ - VkCommandBuffer commandBuffer; - VkOpticalFlowSessionNV DECLSPEC_ALIGN(8) session; - const VkOpticalFlowExecuteInfoNV *pExecuteInfo; -}; - -struct vkCmdPipelineBarrier_params -{ - VkCommandBuffer commandBuffer; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkDependencyFlags dependencyFlags; - uint32_t memoryBarrierCount; - const VkMemoryBarrier *pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - const VkBufferMemoryBarrier *pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - const VkImageMemoryBarrier *pImageMemoryBarriers; -}; - -struct vkCmdPipelineBarrier2_params -{ - VkCommandBuffer commandBuffer; - const VkDependencyInfo *pDependencyInfo; -}; - -struct vkCmdPipelineBarrier2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkDependencyInfo *pDependencyInfo; -}; - -struct vkCmdPreprocessGeneratedCommandsNV_params -{ - VkCommandBuffer commandBuffer; - const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo; -}; - -struct vkCmdPushConstants_params -{ - VkCommandBuffer commandBuffer; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - VkShaderStageFlags stageFlags; - uint32_t offset; - uint32_t size; - const void *pValues; -}; - -struct vkCmdPushDescriptorSetKHR_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t set; - uint32_t descriptorWriteCount; - const VkWriteDescriptorSet *pDescriptorWrites; -}; - -struct vkCmdPushDescriptorSetWithTemplateKHR_params -{ - VkCommandBuffer commandBuffer; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t set; - const void *pData; -}; - -struct vkCmdResetEvent_params -{ - VkCommandBuffer commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags stageMask; -}; - -struct vkCmdResetEvent2_params -{ - VkCommandBuffer commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stageMask; -}; - -struct vkCmdResetEvent2KHR_params -{ - VkCommandBuffer commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stageMask; -}; - -struct vkCmdResetQueryPool_params -{ - VkCommandBuffer commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; -}; - -struct vkCmdResolveImage_params -{ - VkCommandBuffer commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageResolve *pRegions; -}; - -struct vkCmdResolveImage2_params -{ - VkCommandBuffer commandBuffer; - const VkResolveImageInfo2 *pResolveImageInfo; -}; - -struct vkCmdResolveImage2KHR_params -{ - VkCommandBuffer commandBuffer; - const VkResolveImageInfo2 *pResolveImageInfo; -}; - -struct vkCmdSetAlphaToCoverageEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 alphaToCoverageEnable; -}; - -struct vkCmdSetAlphaToOneEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 alphaToOneEnable; -}; - -struct vkCmdSetAttachmentFeedbackLoopEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkImageAspectFlags aspectMask; -}; - -struct vkCmdSetBlendConstants_params -{ - VkCommandBuffer commandBuffer; - const float *blendConstants; -}; - -struct vkCmdSetCheckpointNV_params -{ - VkCommandBuffer commandBuffer; - const void *pCheckpointMarker; -}; - -struct vkCmdSetCoarseSampleOrderNV_params -{ - VkCommandBuffer commandBuffer; - VkCoarseSampleOrderTypeNV sampleOrderType; - uint32_t customSampleOrderCount; - const VkCoarseSampleOrderCustomNV *pCustomSampleOrders; -}; - -struct vkCmdSetColorBlendAdvancedEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - const VkColorBlendAdvancedEXT *pColorBlendAdvanced; -}; - -struct vkCmdSetColorBlendEnableEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - const VkBool32 *pColorBlendEnables; -}; - -struct vkCmdSetColorBlendEquationEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - const VkColorBlendEquationEXT *pColorBlendEquations; -}; - -struct vkCmdSetColorWriteEnableEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t attachmentCount; - const VkBool32 *pColorWriteEnables; -}; - -struct vkCmdSetColorWriteMaskEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - const VkColorComponentFlags *pColorWriteMasks; -}; - -struct vkCmdSetConservativeRasterizationModeEXT_params -{ - VkCommandBuffer commandBuffer; - VkConservativeRasterizationModeEXT conservativeRasterizationMode; -}; - -struct vkCmdSetCoverageModulationModeNV_params -{ - VkCommandBuffer commandBuffer; - VkCoverageModulationModeNV coverageModulationMode; -}; - -struct vkCmdSetCoverageModulationTableEnableNV_params -{ - VkCommandBuffer commandBuffer; - VkBool32 coverageModulationTableEnable; -}; - -struct vkCmdSetCoverageModulationTableNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t coverageModulationTableCount; - const float *pCoverageModulationTable; -}; - -struct vkCmdSetCoverageReductionModeNV_params -{ - VkCommandBuffer commandBuffer; - VkCoverageReductionModeNV coverageReductionMode; -}; - -struct vkCmdSetCoverageToColorEnableNV_params -{ - VkCommandBuffer commandBuffer; - VkBool32 coverageToColorEnable; -}; - -struct vkCmdSetCoverageToColorLocationNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t coverageToColorLocation; -}; - -struct vkCmdSetCullMode_params -{ - VkCommandBuffer commandBuffer; - VkCullModeFlags cullMode; -}; - -struct vkCmdSetCullModeEXT_params -{ - VkCommandBuffer commandBuffer; - VkCullModeFlags cullMode; -}; - -struct vkCmdSetDepthBias_params -{ - VkCommandBuffer commandBuffer; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; -}; - -struct vkCmdSetDepthBias2EXT_params -{ - VkCommandBuffer commandBuffer; - const VkDepthBiasInfoEXT *pDepthBiasInfo; -}; - -struct vkCmdSetDepthBiasEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthBiasEnable; -}; - -struct vkCmdSetDepthBiasEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthBiasEnable; -}; - -struct vkCmdSetDepthBounds_params -{ - VkCommandBuffer commandBuffer; - float minDepthBounds; - float maxDepthBounds; -}; - -struct vkCmdSetDepthBoundsTestEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthBoundsTestEnable; -}; - -struct vkCmdSetDepthBoundsTestEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthBoundsTestEnable; -}; - -struct vkCmdSetDepthClampEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthClampEnable; -}; - -struct vkCmdSetDepthClipEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthClipEnable; -}; - -struct vkCmdSetDepthClipNegativeOneToOneEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 negativeOneToOne; -}; - -struct vkCmdSetDepthCompareOp_params -{ - VkCommandBuffer commandBuffer; - VkCompareOp depthCompareOp; -}; - -struct vkCmdSetDepthCompareOpEXT_params -{ - VkCommandBuffer commandBuffer; - VkCompareOp depthCompareOp; -}; - -struct vkCmdSetDepthTestEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthTestEnable; -}; - -struct vkCmdSetDepthTestEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthTestEnable; -}; - -struct vkCmdSetDepthWriteEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthWriteEnable; -}; - -struct vkCmdSetDepthWriteEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 depthWriteEnable; -}; - -struct vkCmdSetDescriptorBufferOffsetsEXT_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t firstSet; - uint32_t setCount; - const uint32_t *pBufferIndices; - const VkDeviceSize *pOffsets; -}; - -struct vkCmdSetDeviceMask_params -{ - VkCommandBuffer commandBuffer; - uint32_t deviceMask; -}; - -struct vkCmdSetDeviceMaskKHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t deviceMask; -}; - -struct vkCmdSetDiscardRectangleEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstDiscardRectangle; - uint32_t discardRectangleCount; - const VkRect2D *pDiscardRectangles; -}; - -struct vkCmdSetDiscardRectangleEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 discardRectangleEnable; -}; - -struct vkCmdSetDiscardRectangleModeEXT_params -{ - VkCommandBuffer commandBuffer; - VkDiscardRectangleModeEXT discardRectangleMode; -}; - -struct vkCmdSetEvent_params -{ - VkCommandBuffer commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags stageMask; -}; - -struct vkCmdSetEvent2_params -{ - VkCommandBuffer commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - const VkDependencyInfo *pDependencyInfo; -}; - -struct vkCmdSetEvent2KHR_params -{ - VkCommandBuffer commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - const VkDependencyInfo *pDependencyInfo; -}; - -struct vkCmdSetExclusiveScissorEnableNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstExclusiveScissor; - uint32_t exclusiveScissorCount; - const VkBool32 *pExclusiveScissorEnables; -}; - -struct vkCmdSetExclusiveScissorNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstExclusiveScissor; - uint32_t exclusiveScissorCount; - const VkRect2D *pExclusiveScissors; -}; - -struct vkCmdSetExtraPrimitiveOverestimationSizeEXT_params -{ - VkCommandBuffer commandBuffer; - float extraPrimitiveOverestimationSize; -}; - -struct vkCmdSetFragmentShadingRateEnumNV_params -{ - VkCommandBuffer commandBuffer; - VkFragmentShadingRateNV shadingRate; - const VkFragmentShadingRateCombinerOpKHR *combinerOps; -}; - -struct vkCmdSetFragmentShadingRateKHR_params -{ - VkCommandBuffer commandBuffer; - const VkExtent2D *pFragmentSize; - const VkFragmentShadingRateCombinerOpKHR *combinerOps; -}; - -struct vkCmdSetFrontFace_params -{ - VkCommandBuffer commandBuffer; - VkFrontFace frontFace; -}; - -struct vkCmdSetFrontFaceEXT_params -{ - VkCommandBuffer commandBuffer; - VkFrontFace frontFace; -}; - -struct vkCmdSetLineRasterizationModeEXT_params -{ - VkCommandBuffer commandBuffer; - VkLineRasterizationModeEXT lineRasterizationMode; -}; - -struct vkCmdSetLineStippleEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t lineStippleFactor; - uint16_t lineStipplePattern; -}; - -struct vkCmdSetLineStippleEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 stippledLineEnable; -}; - -struct vkCmdSetLineWidth_params -{ - VkCommandBuffer commandBuffer; - float lineWidth; -}; - -struct vkCmdSetLogicOpEXT_params -{ - VkCommandBuffer commandBuffer; - VkLogicOp logicOp; -}; - -struct vkCmdSetLogicOpEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 logicOpEnable; -}; - -struct vkCmdSetPatchControlPointsEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t patchControlPoints; -}; - -struct vkCmdSetPerformanceMarkerINTEL_params -{ - VkCommandBuffer commandBuffer; - const VkPerformanceMarkerInfoINTEL *pMarkerInfo; - VkResult result; -}; - -struct vkCmdSetPerformanceOverrideINTEL_params -{ - VkCommandBuffer commandBuffer; - const VkPerformanceOverrideInfoINTEL *pOverrideInfo; - VkResult result; -}; - -struct vkCmdSetPerformanceStreamMarkerINTEL_params -{ - VkCommandBuffer commandBuffer; - const VkPerformanceStreamMarkerInfoINTEL *pMarkerInfo; - VkResult result; -}; - -struct vkCmdSetPolygonModeEXT_params -{ - VkCommandBuffer commandBuffer; - VkPolygonMode polygonMode; -}; - -struct vkCmdSetPrimitiveRestartEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 primitiveRestartEnable; -}; - -struct vkCmdSetPrimitiveRestartEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 primitiveRestartEnable; -}; - -struct vkCmdSetPrimitiveTopology_params -{ - VkCommandBuffer commandBuffer; - VkPrimitiveTopology primitiveTopology; -}; - -struct vkCmdSetPrimitiveTopologyEXT_params -{ - VkCommandBuffer commandBuffer; - VkPrimitiveTopology primitiveTopology; -}; - -struct vkCmdSetProvokingVertexModeEXT_params -{ - VkCommandBuffer commandBuffer; - VkProvokingVertexModeEXT provokingVertexMode; -}; - -struct vkCmdSetRasterizationSamplesEXT_params -{ - VkCommandBuffer commandBuffer; - VkSampleCountFlagBits rasterizationSamples; -}; - -struct vkCmdSetRasterizationStreamEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t rasterizationStream; -}; - -struct vkCmdSetRasterizerDiscardEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 rasterizerDiscardEnable; -}; - -struct vkCmdSetRasterizerDiscardEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 rasterizerDiscardEnable; -}; - -struct vkCmdSetRayTracingPipelineStackSizeKHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t pipelineStackSize; -}; - -struct vkCmdSetRepresentativeFragmentTestEnableNV_params -{ - VkCommandBuffer commandBuffer; - VkBool32 representativeFragmentTestEnable; -}; - -struct vkCmdSetSampleLocationsEXT_params -{ - VkCommandBuffer commandBuffer; - const VkSampleLocationsInfoEXT *pSampleLocationsInfo; -}; - -struct vkCmdSetSampleLocationsEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 sampleLocationsEnable; -}; - -struct vkCmdSetSampleMaskEXT_params -{ - VkCommandBuffer commandBuffer; - VkSampleCountFlagBits samples; - const VkSampleMask *pSampleMask; -}; - -struct vkCmdSetScissor_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstScissor; - uint32_t scissorCount; - const VkRect2D *pScissors; -}; - -struct vkCmdSetScissorWithCount_params -{ - VkCommandBuffer commandBuffer; - uint32_t scissorCount; - const VkRect2D *pScissors; -}; - -struct vkCmdSetScissorWithCountEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t scissorCount; - const VkRect2D *pScissors; -}; - -struct vkCmdSetShadingRateImageEnableNV_params -{ - VkCommandBuffer commandBuffer; - VkBool32 shadingRateImageEnable; -}; - -struct vkCmdSetStencilCompareMask_params -{ - VkCommandBuffer commandBuffer; - VkStencilFaceFlags faceMask; - uint32_t compareMask; -}; - -struct vkCmdSetStencilOp_params -{ - VkCommandBuffer commandBuffer; - VkStencilFaceFlags faceMask; - VkStencilOp failOp; - VkStencilOp passOp; - VkStencilOp depthFailOp; - VkCompareOp compareOp; -}; - -struct vkCmdSetStencilOpEXT_params -{ - VkCommandBuffer commandBuffer; - VkStencilFaceFlags faceMask; - VkStencilOp failOp; - VkStencilOp passOp; - VkStencilOp depthFailOp; - VkCompareOp compareOp; -}; - -struct vkCmdSetStencilReference_params -{ - VkCommandBuffer commandBuffer; - VkStencilFaceFlags faceMask; - uint32_t reference; -}; - -struct vkCmdSetStencilTestEnable_params -{ - VkCommandBuffer commandBuffer; - VkBool32 stencilTestEnable; -}; - -struct vkCmdSetStencilTestEnableEXT_params -{ - VkCommandBuffer commandBuffer; - VkBool32 stencilTestEnable; -}; - -struct vkCmdSetStencilWriteMask_params -{ - VkCommandBuffer commandBuffer; - VkStencilFaceFlags faceMask; - uint32_t writeMask; -}; - -struct vkCmdSetTessellationDomainOriginEXT_params -{ - VkCommandBuffer commandBuffer; - VkTessellationDomainOrigin domainOrigin; -}; - -struct vkCmdSetVertexInputEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t vertexBindingDescriptionCount; - const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions; - uint32_t vertexAttributeDescriptionCount; - const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions; -}; - -struct vkCmdSetViewport_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - const VkViewport *pViewports; -}; - -struct vkCmdSetViewportShadingRatePaletteNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - const VkShadingRatePaletteNV *pShadingRatePalettes; -}; - -struct vkCmdSetViewportSwizzleNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - const VkViewportSwizzleNV *pViewportSwizzles; -}; - -struct vkCmdSetViewportWScalingEnableNV_params -{ - VkCommandBuffer commandBuffer; - VkBool32 viewportWScalingEnable; -}; - -struct vkCmdSetViewportWScalingNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - const VkViewportWScalingNV *pViewportWScalings; -}; - -struct vkCmdSetViewportWithCount_params -{ - VkCommandBuffer commandBuffer; - uint32_t viewportCount; - const VkViewport *pViewports; -}; - -struct vkCmdSetViewportWithCountEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t viewportCount; - const VkViewport *pViewports; -}; - -struct vkCmdSubpassShadingHUAWEI_params -{ - VkCommandBuffer commandBuffer; -}; - -struct vkCmdTraceRaysIndirect2KHR_params -{ - VkCommandBuffer commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectDeviceAddress; -}; - -struct vkCmdTraceRaysIndirectKHR_params -{ - VkCommandBuffer commandBuffer; - const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable; - const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable; - const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable; - const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectDeviceAddress; -}; - -struct vkCmdTraceRaysKHR_params -{ - VkCommandBuffer commandBuffer; - const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable; - const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable; - const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable; - const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable; - uint32_t width; - uint32_t height; - uint32_t depth; -}; - -struct vkCmdTraceRaysNV_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) raygenShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) raygenShaderBindingOffset; - VkBuffer DECLSPEC_ALIGN(8) missShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) missShaderBindingOffset; - VkDeviceSize DECLSPEC_ALIGN(8) missShaderBindingStride; - VkBuffer DECLSPEC_ALIGN(8) hitShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) hitShaderBindingOffset; - VkDeviceSize DECLSPEC_ALIGN(8) hitShaderBindingStride; - VkBuffer DECLSPEC_ALIGN(8) callableShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) callableShaderBindingOffset; - VkDeviceSize DECLSPEC_ALIGN(8) callableShaderBindingStride; - uint32_t width; - uint32_t height; - uint32_t depth; -}; - -struct vkCmdUpdateBuffer_params -{ - VkCommandBuffer commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) dataSize; - const void *pData; -}; - -struct vkCmdUpdatePipelineIndirectBufferNV_params -{ - VkCommandBuffer commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; -}; - -struct vkCmdWaitEvents_params -{ - VkCommandBuffer commandBuffer; - uint32_t eventCount; - const VkEvent *pEvents; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - uint32_t memoryBarrierCount; - const VkMemoryBarrier *pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - const VkBufferMemoryBarrier *pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - const VkImageMemoryBarrier *pImageMemoryBarriers; -}; - -struct vkCmdWaitEvents2_params -{ - VkCommandBuffer commandBuffer; - uint32_t eventCount; - const VkEvent *pEvents; - const VkDependencyInfo *pDependencyInfos; -}; - -struct vkCmdWaitEvents2KHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t eventCount; - const VkEvent *pEvents; - const VkDependencyInfo *pDependencyInfos; -}; - -struct vkCmdWriteAccelerationStructuresPropertiesKHR_params -{ - VkCommandBuffer commandBuffer; - uint32_t accelerationStructureCount; - const VkAccelerationStructureKHR *pAccelerationStructures; - VkQueryType queryType; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; -}; - -struct vkCmdWriteAccelerationStructuresPropertiesNV_params -{ - VkCommandBuffer commandBuffer; - uint32_t accelerationStructureCount; - const VkAccelerationStructureNV *pAccelerationStructures; - VkQueryType queryType; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; -}; - -struct vkCmdWriteBufferMarker2AMD_params -{ - VkCommandBuffer commandBuffer; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - uint32_t marker; -}; - -struct vkCmdWriteBufferMarkerAMD_params -{ - VkCommandBuffer commandBuffer; - VkPipelineStageFlagBits pipelineStage; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - uint32_t marker; -}; - -struct vkCmdWriteMicromapsPropertiesEXT_params -{ - VkCommandBuffer commandBuffer; - uint32_t micromapCount; - const VkMicromapEXT *pMicromaps; - VkQueryType queryType; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; -}; - -struct vkCmdWriteTimestamp_params -{ - VkCommandBuffer commandBuffer; - VkPipelineStageFlagBits pipelineStage; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; -}; - -struct vkCmdWriteTimestamp2_params -{ - VkCommandBuffer commandBuffer; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; -}; - -struct vkCmdWriteTimestamp2KHR_params -{ - VkCommandBuffer commandBuffer; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; -}; - -struct vkCompileDeferredNV_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t shader; - VkResult result; -}; - -struct vkCopyAccelerationStructureKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - const VkCopyAccelerationStructureInfoKHR *pInfo; - VkResult result; -}; - -struct vkCopyAccelerationStructureToMemoryKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo; - VkResult result; -}; - -struct vkCopyImageToImageEXT_params -{ - VkDevice device; - const VkCopyImageToImageInfoEXT *pCopyImageToImageInfo; - VkResult result; -}; - -struct vkCopyImageToMemoryEXT_params -{ - VkDevice device; - const VkCopyImageToMemoryInfoEXT *pCopyImageToMemoryInfo; - VkResult result; -}; - -struct vkCopyMemoryToAccelerationStructureKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo; - VkResult result; -}; - -struct vkCopyMemoryToImageEXT_params -{ - VkDevice device; - const VkCopyMemoryToImageInfoEXT *pCopyMemoryToImageInfo; - VkResult result; -}; - -struct vkCopyMemoryToMicromapEXT_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - const VkCopyMemoryToMicromapInfoEXT *pInfo; - VkResult result; -}; - -struct vkCopyMicromapEXT_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - const VkCopyMicromapInfoEXT *pInfo; - VkResult result; -}; - -struct vkCopyMicromapToMemoryEXT_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - const VkCopyMicromapToMemoryInfoEXT *pInfo; - VkResult result; -}; - -struct vkCreateAccelerationStructureKHR_params -{ - VkDevice device; - const VkAccelerationStructureCreateInfoKHR *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkAccelerationStructureKHR *pAccelerationStructure; - VkResult result; -}; - -struct vkCreateAccelerationStructureNV_params -{ - VkDevice device; - const VkAccelerationStructureCreateInfoNV *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkAccelerationStructureNV *pAccelerationStructure; - VkResult result; -}; - -struct vkCreateBuffer_params -{ - VkDevice device; - const VkBufferCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkBuffer *pBuffer; - VkResult result; -}; - -struct vkCreateBufferView_params -{ - VkDevice device; - const VkBufferViewCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkBufferView *pView; - VkResult result; -}; - -struct vkCreateCommandPool_params -{ - VkDevice device; - const VkCommandPoolCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkCommandPool *pCommandPool; - void *client_ptr; - VkResult result; -}; - -struct vkCreateComputePipelines_params -{ - VkDevice device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - const VkComputePipelineCreateInfo *pCreateInfos; - const VkAllocationCallbacks *pAllocator; - VkPipeline *pPipelines; - VkResult result; -}; - -struct vkCreateCuFunctionNVX_params -{ - VkDevice device; - const VkCuFunctionCreateInfoNVX *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkCuFunctionNVX *pFunction; - VkResult result; -}; - -struct vkCreateCuModuleNVX_params -{ - VkDevice device; - const VkCuModuleCreateInfoNVX *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkCuModuleNVX *pModule; - VkResult result; -}; - -struct vkCreateCudaFunctionNV_params -{ - VkDevice device; - const VkCudaFunctionCreateInfoNV *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkCudaFunctionNV *pFunction; - VkResult result; -}; - -struct vkCreateCudaModuleNV_params -{ - VkDevice device; - const VkCudaModuleCreateInfoNV *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkCudaModuleNV *pModule; - VkResult result; -}; - -struct vkCreateDebugReportCallbackEXT_params -{ - VkInstance instance; - const VkDebugReportCallbackCreateInfoEXT *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDebugReportCallbackEXT *pCallback; - VkResult result; -}; - -struct vkCreateDebugUtilsMessengerEXT_params -{ - VkInstance instance; - const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDebugUtilsMessengerEXT *pMessenger; - VkResult result; -}; - -struct vkCreateDeferredOperationKHR_params -{ - VkDevice device; - const VkAllocationCallbacks *pAllocator; - VkDeferredOperationKHR *pDeferredOperation; - VkResult result; -}; - -struct vkCreateDescriptorPool_params -{ - VkDevice device; - const VkDescriptorPoolCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDescriptorPool *pDescriptorPool; - VkResult result; -}; - -struct vkCreateDescriptorSetLayout_params -{ - VkDevice device; - const VkDescriptorSetLayoutCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDescriptorSetLayout *pSetLayout; - VkResult result; -}; - -struct vkCreateDescriptorUpdateTemplate_params -{ - VkDevice device; - const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate; - VkResult result; -}; - -struct vkCreateDescriptorUpdateTemplateKHR_params -{ - VkDevice device; - const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate; - VkResult result; -}; - -struct vkCreateDevice_params -{ - VkPhysicalDevice physicalDevice; - const VkDeviceCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkDevice *pDevice; - void *client_ptr; - VkResult result; -}; - -struct vkCreateEvent_params -{ - VkDevice device; - const VkEventCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkEvent *pEvent; - VkResult result; -}; - -struct vkCreateFence_params -{ - VkDevice device; - const VkFenceCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkFence *pFence; - VkResult result; -}; - -struct vkCreateFramebuffer_params -{ - VkDevice device; - const VkFramebufferCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkFramebuffer *pFramebuffer; - VkResult result; -}; - -struct vkCreateGraphicsPipelines_params -{ - VkDevice device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - const VkGraphicsPipelineCreateInfo *pCreateInfos; - const VkAllocationCallbacks *pAllocator; - VkPipeline *pPipelines; - VkResult result; -}; - -struct vkCreateImage_params -{ - VkDevice device; - const VkImageCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkImage *pImage; - VkResult result; -}; - -struct vkCreateImageView_params -{ - VkDevice device; - const VkImageViewCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkImageView *pView; - VkResult result; -}; - -struct vkCreateIndirectCommandsLayoutNV_params -{ - VkDevice device; - const VkIndirectCommandsLayoutCreateInfoNV *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkIndirectCommandsLayoutNV *pIndirectCommandsLayout; - VkResult result; -}; - -struct vkCreateInstance_params -{ - const VkInstanceCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkInstance *pInstance; - void *client_ptr; - VkResult result; -}; - -struct vkCreateMicromapEXT_params -{ - VkDevice device; - const VkMicromapCreateInfoEXT *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkMicromapEXT *pMicromap; - VkResult result; -}; - -struct vkCreateOpticalFlowSessionNV_params -{ - VkDevice device; - const VkOpticalFlowSessionCreateInfoNV *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkOpticalFlowSessionNV *pSession; - VkResult result; -}; - -struct vkCreatePipelineCache_params -{ - VkDevice device; - const VkPipelineCacheCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkPipelineCache *pPipelineCache; - VkResult result; -}; - -struct vkCreatePipelineLayout_params -{ - VkDevice device; - const VkPipelineLayoutCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkPipelineLayout *pPipelineLayout; - VkResult result; -}; - -struct vkCreatePrivateDataSlot_params -{ - VkDevice device; - const VkPrivateDataSlotCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkPrivateDataSlot *pPrivateDataSlot; - VkResult result; -}; - -struct vkCreatePrivateDataSlotEXT_params -{ - VkDevice device; - const VkPrivateDataSlotCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkPrivateDataSlot *pPrivateDataSlot; - VkResult result; -}; - -struct vkCreateQueryPool_params -{ - VkDevice device; - const VkQueryPoolCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkQueryPool *pQueryPool; - VkResult result; -}; - -struct vkCreateRayTracingPipelinesKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - const VkRayTracingPipelineCreateInfoKHR *pCreateInfos; - const VkAllocationCallbacks *pAllocator; - VkPipeline *pPipelines; - VkResult result; -}; - -struct vkCreateRayTracingPipelinesNV_params -{ - VkDevice device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - const VkRayTracingPipelineCreateInfoNV *pCreateInfos; - const VkAllocationCallbacks *pAllocator; - VkPipeline *pPipelines; - VkResult result; -}; - -struct vkCreateRenderPass_params -{ - VkDevice device; - const VkRenderPassCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkRenderPass *pRenderPass; - VkResult result; -}; - -struct vkCreateRenderPass2_params -{ - VkDevice device; - const VkRenderPassCreateInfo2 *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkRenderPass *pRenderPass; - VkResult result; -}; - -struct vkCreateRenderPass2KHR_params -{ - VkDevice device; - const VkRenderPassCreateInfo2 *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkRenderPass *pRenderPass; - VkResult result; -}; - -struct vkCreateSampler_params -{ - VkDevice device; - const VkSamplerCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkSampler *pSampler; - VkResult result; -}; - -struct vkCreateSamplerYcbcrConversion_params -{ - VkDevice device; - const VkSamplerYcbcrConversionCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkSamplerYcbcrConversion *pYcbcrConversion; - VkResult result; -}; - -struct vkCreateSamplerYcbcrConversionKHR_params -{ - VkDevice device; - const VkSamplerYcbcrConversionCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkSamplerYcbcrConversion *pYcbcrConversion; - VkResult result; -}; - -struct vkCreateSemaphore_params -{ - VkDevice device; - const VkSemaphoreCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkSemaphore *pSemaphore; - VkResult result; -}; - -struct vkCreateShaderModule_params -{ - VkDevice device; - const VkShaderModuleCreateInfo *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkShaderModule *pShaderModule; - VkResult result; -}; - -struct vkCreateShadersEXT_params -{ - VkDevice device; - uint32_t createInfoCount; - const VkShaderCreateInfoEXT *pCreateInfos; - const VkAllocationCallbacks *pAllocator; - VkShaderEXT *pShaders; - VkResult result; -}; - -struct vkCreateSwapchainKHR_params -{ - VkDevice device; - const VkSwapchainCreateInfoKHR *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkSwapchainKHR *pSwapchain; - VkResult result; -}; - -struct vkCreateValidationCacheEXT_params -{ - VkDevice device; - const VkValidationCacheCreateInfoEXT *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkValidationCacheEXT *pValidationCache; - VkResult result; -}; - -struct vkCreateWin32SurfaceKHR_params -{ - VkInstance instance; - const VkWin32SurfaceCreateInfoKHR *pCreateInfo; - const VkAllocationCallbacks *pAllocator; - VkSurfaceKHR *pSurface; - VkResult result; -}; - -struct vkDebugMarkerSetObjectNameEXT_params -{ - VkDevice device; - const VkDebugMarkerObjectNameInfoEXT *pNameInfo; - VkResult result; -}; - -struct vkDebugMarkerSetObjectTagEXT_params -{ - VkDevice device; - const VkDebugMarkerObjectTagInfoEXT *pTagInfo; - VkResult result; -}; - -struct vkDebugReportMessageEXT_params -{ - VkInstance instance; - VkDebugReportFlagsEXT flags; - VkDebugReportObjectTypeEXT objectType; - uint64_t DECLSPEC_ALIGN(8) object; - size_t location; - int32_t messageCode; - const char *pLayerPrefix; - const char *pMessage; -}; - -struct vkDeferredOperationJoinKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - VkResult result; -}; - -struct vkDestroyAccelerationStructureKHR_params -{ - VkDevice device; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) accelerationStructure; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyAccelerationStructureNV_params -{ - VkDevice device; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructure; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyBuffer_params -{ - VkDevice device; - VkBuffer DECLSPEC_ALIGN(8) buffer; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyBufferView_params -{ - VkDevice device; - VkBufferView DECLSPEC_ALIGN(8) bufferView; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyCommandPool_params -{ - VkDevice device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyCuFunctionNVX_params -{ - VkDevice device; - VkCuFunctionNVX DECLSPEC_ALIGN(8) function; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyCuModuleNVX_params -{ - VkDevice device; - VkCuModuleNVX DECLSPEC_ALIGN(8) module; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyCudaFunctionNV_params -{ - VkDevice device; - VkCudaFunctionNV DECLSPEC_ALIGN(8) function; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyCudaModuleNV_params -{ - VkDevice device; - VkCudaModuleNV DECLSPEC_ALIGN(8) module; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDebugReportCallbackEXT_params -{ - VkInstance instance; - VkDebugReportCallbackEXT DECLSPEC_ALIGN(8) callback; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDebugUtilsMessengerEXT_params -{ - VkInstance instance; - VkDebugUtilsMessengerEXT DECLSPEC_ALIGN(8) messenger; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDeferredOperationKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDescriptorPool_params -{ - VkDevice device; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDescriptorSetLayout_params -{ - VkDevice device; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) descriptorSetLayout; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDescriptorUpdateTemplate_params -{ - VkDevice device; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDescriptorUpdateTemplateKHR_params -{ - VkDevice device; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyDevice_params -{ - VkDevice device; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyEvent_params -{ - VkDevice device; - VkEvent DECLSPEC_ALIGN(8) event; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyFence_params -{ - VkDevice device; - VkFence DECLSPEC_ALIGN(8) fence; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyFramebuffer_params -{ - VkDevice device; - VkFramebuffer DECLSPEC_ALIGN(8) framebuffer; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyImage_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyImageView_params -{ - VkDevice device; - VkImageView DECLSPEC_ALIGN(8) imageView; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyIndirectCommandsLayoutNV_params -{ - VkDevice device; - VkIndirectCommandsLayoutNV DECLSPEC_ALIGN(8) indirectCommandsLayout; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyInstance_params -{ - VkInstance instance; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyMicromapEXT_params -{ - VkDevice device; - VkMicromapEXT DECLSPEC_ALIGN(8) micromap; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyOpticalFlowSessionNV_params -{ - VkDevice device; - VkOpticalFlowSessionNV DECLSPEC_ALIGN(8) session; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyPipeline_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyPipelineCache_params -{ - VkDevice device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyPipelineLayout_params -{ - VkDevice device; - VkPipelineLayout DECLSPEC_ALIGN(8) pipelineLayout; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyPrivateDataSlot_params -{ - VkDevice device; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyPrivateDataSlotEXT_params -{ - VkDevice device; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyQueryPool_params -{ - VkDevice device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyRenderPass_params -{ - VkDevice device; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroySampler_params -{ - VkDevice device; - VkSampler DECLSPEC_ALIGN(8) sampler; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroySamplerYcbcrConversion_params -{ - VkDevice device; - VkSamplerYcbcrConversion DECLSPEC_ALIGN(8) ycbcrConversion; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroySamplerYcbcrConversionKHR_params -{ - VkDevice device; - VkSamplerYcbcrConversion DECLSPEC_ALIGN(8) ycbcrConversion; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroySemaphore_params -{ - VkDevice device; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyShaderEXT_params -{ - VkDevice device; - VkShaderEXT DECLSPEC_ALIGN(8) shader; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyShaderModule_params -{ - VkDevice device; - VkShaderModule DECLSPEC_ALIGN(8) shaderModule; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroySurfaceKHR_params -{ - VkInstance instance; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroySwapchainKHR_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDestroyValidationCacheEXT_params -{ - VkDevice device; - VkValidationCacheEXT DECLSPEC_ALIGN(8) validationCache; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkDeviceWaitIdle_params -{ - VkDevice device; - VkResult result; -}; - -struct vkEndCommandBuffer_params -{ - VkCommandBuffer commandBuffer; - VkResult result; -}; - -struct vkEnumerateDeviceExtensionProperties_params -{ - VkPhysicalDevice physicalDevice; - const char *pLayerName; - uint32_t *pPropertyCount; - VkExtensionProperties *pProperties; - VkResult result; -}; - -struct vkEnumerateDeviceLayerProperties_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pPropertyCount; - VkLayerProperties *pProperties; - VkResult result; -}; - -struct vkEnumerateInstanceExtensionProperties_params -{ - const char *pLayerName; - uint32_t *pPropertyCount; - VkExtensionProperties *pProperties; - VkResult result; -}; - -struct vkEnumerateInstanceVersion_params -{ - uint32_t *pApiVersion; - VkResult result; -}; - -struct vkEnumeratePhysicalDeviceGroups_params -{ - VkInstance instance; - uint32_t *pPhysicalDeviceGroupCount; - VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties; - VkResult result; -}; - -struct vkEnumeratePhysicalDeviceGroupsKHR_params -{ - VkInstance instance; - uint32_t *pPhysicalDeviceGroupCount; - VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties; - VkResult result; -}; - -struct vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR_params -{ - VkPhysicalDevice physicalDevice; - uint32_t queueFamilyIndex; - uint32_t *pCounterCount; - VkPerformanceCounterKHR *pCounters; - VkPerformanceCounterDescriptionKHR *pCounterDescriptions; - VkResult result; -}; - -struct vkEnumeratePhysicalDevices_params -{ - VkInstance instance; - uint32_t *pPhysicalDeviceCount; - VkPhysicalDevice *pPhysicalDevices; - VkResult result; -}; - -struct vkFlushMappedMemoryRanges_params -{ - VkDevice device; - uint32_t memoryRangeCount; - const VkMappedMemoryRange *pMemoryRanges; - VkResult result; -}; - -struct vkFreeCommandBuffers_params -{ - VkDevice device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - uint32_t commandBufferCount; - const VkCommandBuffer *pCommandBuffers; -}; - -struct vkFreeDescriptorSets_params -{ - VkDevice device; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - uint32_t descriptorSetCount; - const VkDescriptorSet *pDescriptorSets; - VkResult result; -}; - -struct vkFreeMemory_params -{ - VkDevice device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - const VkAllocationCallbacks *pAllocator; -}; - -struct vkGetAccelerationStructureBuildSizesKHR_params -{ - VkDevice device; - VkAccelerationStructureBuildTypeKHR buildType; - const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo; - const uint32_t *pMaxPrimitiveCounts; - VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo; -}; - -struct vkGetAccelerationStructureDeviceAddressKHR_params -{ - VkDevice device; - const VkAccelerationStructureDeviceAddressInfoKHR *pInfo; - VkDeviceAddress result; -}; - -struct vkGetAccelerationStructureHandleNV_params -{ - VkDevice device; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructure; - size_t dataSize; - void *pData; - VkResult result; -}; - -struct vkGetAccelerationStructureMemoryRequirementsNV_params -{ - VkDevice device; - const VkAccelerationStructureMemoryRequirementsInfoNV *pInfo; - VkMemoryRequirements2KHR *pMemoryRequirements; -}; - -struct vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT_params -{ - VkDevice device; - const VkAccelerationStructureCaptureDescriptorDataInfoEXT *pInfo; - void *pData; - VkResult result; -}; - -struct vkGetBufferDeviceAddress_params -{ - VkDevice device; - const VkBufferDeviceAddressInfo *pInfo; - VkDeviceAddress result; -}; - -struct vkGetBufferDeviceAddressEXT_params -{ - VkDevice device; - const VkBufferDeviceAddressInfo *pInfo; - VkDeviceAddress result; -}; - -struct vkGetBufferDeviceAddressKHR_params -{ - VkDevice device; - const VkBufferDeviceAddressInfo *pInfo; - VkDeviceAddress result; -}; - -struct vkGetBufferMemoryRequirements_params -{ - VkDevice device; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkMemoryRequirements *pMemoryRequirements; -}; - -struct vkGetBufferMemoryRequirements2_params -{ - VkDevice device; - const VkBufferMemoryRequirementsInfo2 *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetBufferMemoryRequirements2KHR_params -{ - VkDevice device; - const VkBufferMemoryRequirementsInfo2 *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetBufferOpaqueCaptureAddress_params -{ - VkDevice device; - const VkBufferDeviceAddressInfo *pInfo; - uint64_t result; -}; - -struct vkGetBufferOpaqueCaptureAddressKHR_params -{ - VkDevice device; - const VkBufferDeviceAddressInfo *pInfo; - uint64_t result; -}; - -struct vkGetBufferOpaqueCaptureDescriptorDataEXT_params -{ - VkDevice device; - const VkBufferCaptureDescriptorDataInfoEXT *pInfo; - void *pData; - VkResult result; -}; - -struct vkGetCalibratedTimestampsEXT_params -{ - VkDevice device; - uint32_t timestampCount; - const VkCalibratedTimestampInfoEXT *pTimestampInfos; - uint64_t *pTimestamps; - uint64_t *pMaxDeviation; - VkResult result; -}; - -struct vkGetCudaModuleCacheNV_params -{ - VkDevice device; - VkCudaModuleNV DECLSPEC_ALIGN(8) module; - size_t *pCacheSize; - void *pCacheData; - VkResult result; -}; - -struct vkGetDeferredOperationMaxConcurrencyKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - uint32_t result; -}; - -struct vkGetDeferredOperationResultKHR_params -{ - VkDevice device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - VkResult result; -}; - -struct vkGetDescriptorEXT_params -{ - VkDevice device; - const VkDescriptorGetInfoEXT *pDescriptorInfo; - size_t dataSize; - void *pDescriptor; -}; - -struct vkGetDescriptorSetHostMappingVALVE_params -{ - VkDevice device; - VkDescriptorSet DECLSPEC_ALIGN(8) descriptorSet; - void **ppData; -}; - -struct vkGetDescriptorSetLayoutBindingOffsetEXT_params -{ - VkDevice device; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) layout; - uint32_t binding; - VkDeviceSize *pOffset; -}; - -struct vkGetDescriptorSetLayoutHostMappingInfoVALVE_params -{ - VkDevice device; - const VkDescriptorSetBindingReferenceVALVE *pBindingReference; - VkDescriptorSetLayoutHostMappingInfoVALVE *pHostMapping; -}; - -struct vkGetDescriptorSetLayoutSizeEXT_params -{ - VkDevice device; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) layout; - VkDeviceSize *pLayoutSizeInBytes; -}; - -struct vkGetDescriptorSetLayoutSupport_params -{ - VkDevice device; - const VkDescriptorSetLayoutCreateInfo *pCreateInfo; - VkDescriptorSetLayoutSupport *pSupport; -}; - -struct vkGetDescriptorSetLayoutSupportKHR_params -{ - VkDevice device; - const VkDescriptorSetLayoutCreateInfo *pCreateInfo; - VkDescriptorSetLayoutSupport *pSupport; -}; - -struct vkGetDeviceAccelerationStructureCompatibilityKHR_params -{ - VkDevice device; - const VkAccelerationStructureVersionInfoKHR *pVersionInfo; - VkAccelerationStructureCompatibilityKHR *pCompatibility; -}; - -struct vkGetDeviceBufferMemoryRequirements_params -{ - VkDevice device; - const VkDeviceBufferMemoryRequirements *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetDeviceBufferMemoryRequirementsKHR_params -{ - VkDevice device; - const VkDeviceBufferMemoryRequirements *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetDeviceFaultInfoEXT_params -{ - VkDevice device; - VkDeviceFaultCountsEXT *pFaultCounts; - VkDeviceFaultInfoEXT *pFaultInfo; - VkResult result; -}; - -struct vkGetDeviceGroupPeerMemoryFeatures_params -{ - VkDevice device; - uint32_t heapIndex; - uint32_t localDeviceIndex; - uint32_t remoteDeviceIndex; - VkPeerMemoryFeatureFlags *pPeerMemoryFeatures; -}; - -struct vkGetDeviceGroupPeerMemoryFeaturesKHR_params -{ - VkDevice device; - uint32_t heapIndex; - uint32_t localDeviceIndex; - uint32_t remoteDeviceIndex; - VkPeerMemoryFeatureFlags *pPeerMemoryFeatures; -}; - -struct vkGetDeviceGroupPresentCapabilitiesKHR_params -{ - VkDevice device; - VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities; - VkResult result; -}; - -struct vkGetDeviceGroupSurfacePresentModesKHR_params -{ - VkDevice device; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - VkDeviceGroupPresentModeFlagsKHR *pModes; - VkResult result; -}; - -struct vkGetDeviceImageMemoryRequirements_params -{ - VkDevice device; - const VkDeviceImageMemoryRequirements *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetDeviceImageMemoryRequirementsKHR_params -{ - VkDevice device; - const VkDeviceImageMemoryRequirements *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetDeviceImageSparseMemoryRequirements_params -{ - VkDevice device; - const VkDeviceImageMemoryRequirements *pInfo; - uint32_t *pSparseMemoryRequirementCount; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements; -}; - -struct vkGetDeviceImageSparseMemoryRequirementsKHR_params -{ - VkDevice device; - const VkDeviceImageMemoryRequirements *pInfo; - uint32_t *pSparseMemoryRequirementCount; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements; -}; - -struct vkGetDeviceImageSubresourceLayoutKHR_params -{ - VkDevice device; - const VkDeviceImageSubresourceInfoKHR *pInfo; - VkSubresourceLayout2KHR *pLayout; -}; - -struct vkGetDeviceMemoryCommitment_params -{ - VkDevice device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize *pCommittedMemoryInBytes; -}; - -struct vkGetDeviceMemoryOpaqueCaptureAddress_params -{ - VkDevice device; - const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo; - uint64_t result; -}; - -struct vkGetDeviceMemoryOpaqueCaptureAddressKHR_params -{ - VkDevice device; - const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo; - uint64_t result; -}; - -struct vkGetDeviceMicromapCompatibilityEXT_params -{ - VkDevice device; - const VkMicromapVersionInfoEXT *pVersionInfo; - VkAccelerationStructureCompatibilityKHR *pCompatibility; -}; - -struct vkGetDeviceQueue_params -{ - VkDevice device; - uint32_t queueFamilyIndex; - uint32_t queueIndex; - VkQueue *pQueue; -}; - -struct vkGetDeviceQueue2_params -{ - VkDevice device; - const VkDeviceQueueInfo2 *pQueueInfo; - VkQueue *pQueue; -}; - -struct vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI_params -{ - VkDevice device; - VkRenderPass DECLSPEC_ALIGN(8) renderpass; - VkExtent2D *pMaxWorkgroupSize; - VkResult result; -}; - -struct vkGetDynamicRenderingTilePropertiesQCOM_params -{ - VkDevice device; - const VkRenderingInfo *pRenderingInfo; - VkTilePropertiesQCOM *pProperties; - VkResult result; -}; - -struct vkGetEventStatus_params -{ - VkDevice device; - VkEvent DECLSPEC_ALIGN(8) event; - VkResult result; -}; - -struct vkGetFenceStatus_params -{ - VkDevice device; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; -}; - -struct vkGetFramebufferTilePropertiesQCOM_params -{ - VkDevice device; - VkFramebuffer DECLSPEC_ALIGN(8) framebuffer; - uint32_t *pPropertiesCount; - VkTilePropertiesQCOM *pProperties; - VkResult result; -}; - -struct vkGetGeneratedCommandsMemoryRequirementsNV_params -{ - VkDevice device; - const VkGeneratedCommandsMemoryRequirementsInfoNV *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetImageMemoryRequirements_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - VkMemoryRequirements *pMemoryRequirements; -}; - -struct vkGetImageMemoryRequirements2_params -{ - VkDevice device; - const VkImageMemoryRequirementsInfo2 *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetImageMemoryRequirements2KHR_params -{ - VkDevice device; - const VkImageMemoryRequirementsInfo2 *pInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetImageOpaqueCaptureDescriptorDataEXT_params -{ - VkDevice device; - const VkImageCaptureDescriptorDataInfoEXT *pInfo; - void *pData; - VkResult result; -}; - -struct vkGetImageSparseMemoryRequirements_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - uint32_t *pSparseMemoryRequirementCount; - VkSparseImageMemoryRequirements *pSparseMemoryRequirements; -}; - -struct vkGetImageSparseMemoryRequirements2_params -{ - VkDevice device; - const VkImageSparseMemoryRequirementsInfo2 *pInfo; - uint32_t *pSparseMemoryRequirementCount; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements; -}; - -struct vkGetImageSparseMemoryRequirements2KHR_params -{ - VkDevice device; - const VkImageSparseMemoryRequirementsInfo2 *pInfo; - uint32_t *pSparseMemoryRequirementCount; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements; -}; - -struct vkGetImageSubresourceLayout_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - const VkImageSubresource *pSubresource; - VkSubresourceLayout *pLayout; -}; - -struct vkGetImageSubresourceLayout2EXT_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - const VkImageSubresource2KHR *pSubresource; - VkSubresourceLayout2KHR *pLayout; -}; - -struct vkGetImageSubresourceLayout2KHR_params -{ - VkDevice device; - VkImage DECLSPEC_ALIGN(8) image; - const VkImageSubresource2KHR *pSubresource; - VkSubresourceLayout2KHR *pLayout; -}; - -struct vkGetImageViewAddressNVX_params -{ - VkDevice device; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageViewAddressPropertiesNVX *pProperties; - VkResult result; -}; - -struct vkGetImageViewHandleNVX_params -{ - VkDevice device; - const VkImageViewHandleInfoNVX *pInfo; - uint32_t result; -}; - -struct vkGetImageViewOpaqueCaptureDescriptorDataEXT_params -{ - VkDevice device; - const VkImageViewCaptureDescriptorDataInfoEXT *pInfo; - void *pData; - VkResult result; -}; - -struct vkGetLatencyTimingsNV_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - VkGetLatencyMarkerInfoNV *pLatencyMarkerInfo; -}; - -struct vkGetMemoryHostPointerPropertiesEXT_params -{ - VkDevice device; - VkExternalMemoryHandleTypeFlagBits handleType; - const void *pHostPointer; - VkMemoryHostPointerPropertiesEXT *pMemoryHostPointerProperties; - VkResult result; -}; - -struct vkGetMicromapBuildSizesEXT_params -{ - VkDevice device; - VkAccelerationStructureBuildTypeKHR buildType; - const VkMicromapBuildInfoEXT *pBuildInfo; - VkMicromapBuildSizesInfoEXT *pSizeInfo; -}; - -struct vkGetPerformanceParameterINTEL_params -{ - VkDevice device; - VkPerformanceParameterTypeINTEL parameter; - VkPerformanceValueINTEL *pValue; - VkResult result; -}; - -struct vkGetPhysicalDeviceCalibrateableTimeDomainsEXT_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pTimeDomainCount; - VkTimeDomainEXT *pTimeDomains; - VkResult result; -}; - -struct vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pPropertyCount; - VkCooperativeMatrixPropertiesKHR *pProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceCooperativeMatrixPropertiesNV_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pPropertyCount; - VkCooperativeMatrixPropertiesNV *pProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceExternalBufferProperties_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo; - VkExternalBufferProperties *pExternalBufferProperties; -}; - -struct vkGetPhysicalDeviceExternalBufferPropertiesKHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo; - VkExternalBufferProperties *pExternalBufferProperties; -}; - -struct vkGetPhysicalDeviceExternalFenceProperties_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo; - VkExternalFenceProperties *pExternalFenceProperties; -}; - -struct vkGetPhysicalDeviceExternalFencePropertiesKHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo; - VkExternalFenceProperties *pExternalFenceProperties; -}; - -struct vkGetPhysicalDeviceExternalSemaphoreProperties_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo; - VkExternalSemaphoreProperties *pExternalSemaphoreProperties; -}; - -struct vkGetPhysicalDeviceExternalSemaphorePropertiesKHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo; - VkExternalSemaphoreProperties *pExternalSemaphoreProperties; -}; - -struct vkGetPhysicalDeviceFeatures_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceFeatures *pFeatures; -}; - -struct vkGetPhysicalDeviceFeatures2_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceFeatures2 *pFeatures; -}; - -struct vkGetPhysicalDeviceFeatures2KHR_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceFeatures2 *pFeatures; -}; - -struct vkGetPhysicalDeviceFormatProperties_params -{ - VkPhysicalDevice physicalDevice; - VkFormat format; - VkFormatProperties *pFormatProperties; -}; - -struct vkGetPhysicalDeviceFormatProperties2_params -{ - VkPhysicalDevice physicalDevice; - VkFormat format; - VkFormatProperties2 *pFormatProperties; -}; - -struct vkGetPhysicalDeviceFormatProperties2KHR_params -{ - VkPhysicalDevice physicalDevice; - VkFormat format; - VkFormatProperties2 *pFormatProperties; -}; - -struct vkGetPhysicalDeviceFragmentShadingRatesKHR_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pFragmentShadingRateCount; - VkPhysicalDeviceFragmentShadingRateKHR *pFragmentShadingRates; - VkResult result; -}; - -struct vkGetPhysicalDeviceImageFormatProperties_params -{ - VkPhysicalDevice physicalDevice; - VkFormat format; - VkImageType type; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkImageCreateFlags flags; - VkImageFormatProperties *pImageFormatProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceImageFormatProperties2_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo; - VkImageFormatProperties2 *pImageFormatProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceImageFormatProperties2KHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo; - VkImageFormatProperties2 *pImageFormatProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceMemoryProperties_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceMemoryProperties *pMemoryProperties; -}; - -struct vkGetPhysicalDeviceMemoryProperties2_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceMemoryProperties2 *pMemoryProperties; -}; - -struct vkGetPhysicalDeviceMemoryProperties2KHR_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceMemoryProperties2 *pMemoryProperties; -}; - -struct vkGetPhysicalDeviceMultisamplePropertiesEXT_params -{ - VkPhysicalDevice physicalDevice; - VkSampleCountFlagBits samples; - VkMultisamplePropertiesEXT *pMultisampleProperties; -}; - -struct vkGetPhysicalDeviceOpticalFlowImageFormatsNV_params -{ - VkPhysicalDevice physicalDevice; - const VkOpticalFlowImageFormatInfoNV *pOpticalFlowImageFormatInfo; - uint32_t *pFormatCount; - VkOpticalFlowImageFormatPropertiesNV *pImageFormatProperties; - VkResult result; -}; - -struct vkGetPhysicalDevicePresentRectanglesKHR_params -{ - VkPhysicalDevice physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - uint32_t *pRectCount; - VkRect2D *pRects; - VkResult result; -}; - -struct vkGetPhysicalDeviceProperties_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceProperties *pProperties; -}; - -struct vkGetPhysicalDeviceProperties2_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceProperties2 *pProperties; -}; - -struct vkGetPhysicalDeviceProperties2KHR_params -{ - VkPhysicalDevice physicalDevice; - VkPhysicalDeviceProperties2 *pProperties; -}; - -struct vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR_params -{ - VkPhysicalDevice physicalDevice; - const VkQueryPoolPerformanceCreateInfoKHR *pPerformanceQueryCreateInfo; - uint32_t *pNumPasses; -}; - -struct vkGetPhysicalDeviceQueueFamilyProperties_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pQueueFamilyPropertyCount; - VkQueueFamilyProperties *pQueueFamilyProperties; -}; - -struct vkGetPhysicalDeviceQueueFamilyProperties2_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pQueueFamilyPropertyCount; - VkQueueFamilyProperties2 *pQueueFamilyProperties; -}; - -struct vkGetPhysicalDeviceQueueFamilyProperties2KHR_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pQueueFamilyPropertyCount; - VkQueueFamilyProperties2 *pQueueFamilyProperties; -}; - -struct vkGetPhysicalDeviceSparseImageFormatProperties_params -{ - VkPhysicalDevice physicalDevice; - VkFormat format; - VkImageType type; - VkSampleCountFlagBits samples; - VkImageUsageFlags usage; - VkImageTiling tiling; - uint32_t *pPropertyCount; - VkSparseImageFormatProperties *pProperties; -}; - -struct vkGetPhysicalDeviceSparseImageFormatProperties2_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo; - uint32_t *pPropertyCount; - VkSparseImageFormatProperties2 *pProperties; -}; - -struct vkGetPhysicalDeviceSparseImageFormatProperties2KHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo; - uint32_t *pPropertyCount; - VkSparseImageFormatProperties2 *pProperties; -}; - -struct vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pCombinationCount; - VkFramebufferMixedSamplesCombinationNV *pCombinations; - VkResult result; -}; - -struct vkGetPhysicalDeviceSurfaceCapabilities2KHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo; - VkSurfaceCapabilities2KHR *pSurfaceCapabilities; - VkResult result; -}; - -struct vkGetPhysicalDeviceSurfaceCapabilitiesKHR_params -{ - VkPhysicalDevice physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - VkSurfaceCapabilitiesKHR *pSurfaceCapabilities; - VkResult result; -}; - -struct vkGetPhysicalDeviceSurfaceFormats2KHR_params -{ - VkPhysicalDevice physicalDevice; - const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo; - uint32_t *pSurfaceFormatCount; - VkSurfaceFormat2KHR *pSurfaceFormats; - VkResult result; -}; - -struct vkGetPhysicalDeviceSurfaceFormatsKHR_params -{ - VkPhysicalDevice physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - uint32_t *pSurfaceFormatCount; - VkSurfaceFormatKHR *pSurfaceFormats; - VkResult result; -}; - -struct vkGetPhysicalDeviceSurfacePresentModesKHR_params -{ - VkPhysicalDevice physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - uint32_t *pPresentModeCount; - VkPresentModeKHR *pPresentModes; - VkResult result; -}; - -struct vkGetPhysicalDeviceSurfaceSupportKHR_params -{ - VkPhysicalDevice physicalDevice; - uint32_t queueFamilyIndex; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - VkBool32 *pSupported; - VkResult result; -}; - -struct vkGetPhysicalDeviceToolProperties_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pToolCount; - VkPhysicalDeviceToolProperties *pToolProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceToolPropertiesEXT_params -{ - VkPhysicalDevice physicalDevice; - uint32_t *pToolCount; - VkPhysicalDeviceToolProperties *pToolProperties; - VkResult result; -}; - -struct vkGetPhysicalDeviceWin32PresentationSupportKHR_params -{ - VkPhysicalDevice physicalDevice; - uint32_t queueFamilyIndex; - VkBool32 result; -}; - -struct vkGetPipelineCacheData_params -{ - VkDevice device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - size_t *pDataSize; - void *pData; - VkResult result; -}; - -struct vkGetPipelineExecutableInternalRepresentationsKHR_params -{ - VkDevice device; - const VkPipelineExecutableInfoKHR *pExecutableInfo; - uint32_t *pInternalRepresentationCount; - VkPipelineExecutableInternalRepresentationKHR *pInternalRepresentations; - VkResult result; -}; - -struct vkGetPipelineExecutablePropertiesKHR_params -{ - VkDevice device; - const VkPipelineInfoKHR *pPipelineInfo; - uint32_t *pExecutableCount; - VkPipelineExecutablePropertiesKHR *pProperties; - VkResult result; -}; - -struct vkGetPipelineExecutableStatisticsKHR_params -{ - VkDevice device; - const VkPipelineExecutableInfoKHR *pExecutableInfo; - uint32_t *pStatisticCount; - VkPipelineExecutableStatisticKHR *pStatistics; - VkResult result; -}; - -struct vkGetPipelineIndirectDeviceAddressNV_params -{ - VkDevice device; - const VkPipelineIndirectDeviceAddressInfoNV *pInfo; - VkDeviceAddress result; -}; - -struct vkGetPipelineIndirectMemoryRequirementsNV_params -{ - VkDevice device; - const VkComputePipelineCreateInfo *pCreateInfo; - VkMemoryRequirements2 *pMemoryRequirements; -}; - -struct vkGetPipelinePropertiesEXT_params -{ - VkDevice device; - const VkPipelineInfoEXT *pPipelineInfo; - VkBaseOutStructure *pPipelineProperties; - VkResult result; -}; - -struct vkGetPrivateData_params -{ - VkDevice device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - uint64_t *pData; -}; - -struct vkGetPrivateDataEXT_params -{ - VkDevice device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - uint64_t *pData; -}; - -struct vkGetQueryPoolResults_params -{ - VkDevice device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - size_t dataSize; - void *pData; - VkDeviceSize DECLSPEC_ALIGN(8) stride; - VkQueryResultFlags flags; - VkResult result; -}; - -struct vkGetQueueCheckpointData2NV_params -{ - VkQueue queue; - uint32_t *pCheckpointDataCount; - VkCheckpointData2NV *pCheckpointData; -}; - -struct vkGetQueueCheckpointDataNV_params -{ - VkQueue queue; - uint32_t *pCheckpointDataCount; - VkCheckpointDataNV *pCheckpointData; -}; - -struct vkGetRayTracingCaptureReplayShaderGroupHandlesKHR_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t firstGroup; - uint32_t groupCount; - size_t dataSize; - void *pData; - VkResult result; -}; - -struct vkGetRayTracingShaderGroupHandlesKHR_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t firstGroup; - uint32_t groupCount; - size_t dataSize; - void *pData; - VkResult result; -}; - -struct vkGetRayTracingShaderGroupHandlesNV_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t firstGroup; - uint32_t groupCount; - size_t dataSize; - void *pData; - VkResult result; -}; - -struct vkGetRayTracingShaderGroupStackSizeKHR_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t group; - VkShaderGroupShaderKHR groupShader; - VkDeviceSize result; -}; - -struct vkGetRenderAreaGranularity_params -{ - VkDevice device; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - VkExtent2D *pGranularity; -}; - -struct vkGetRenderingAreaGranularityKHR_params -{ - VkDevice device; - const VkRenderingAreaInfoKHR *pRenderingAreaInfo; - VkExtent2D *pGranularity; -}; - -struct vkGetSamplerOpaqueCaptureDescriptorDataEXT_params -{ - VkDevice device; - const VkSamplerCaptureDescriptorDataInfoEXT *pInfo; - void *pData; - VkResult result; -}; - -struct vkGetSemaphoreCounterValue_params -{ - VkDevice device; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - uint64_t *pValue; - VkResult result; -}; - -struct vkGetSemaphoreCounterValueKHR_params -{ - VkDevice device; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - uint64_t *pValue; - VkResult result; -}; - -struct vkGetShaderBinaryDataEXT_params -{ - VkDevice device; - VkShaderEXT DECLSPEC_ALIGN(8) shader; - size_t *pDataSize; - void *pData; - VkResult result; -}; - -struct vkGetShaderInfoAMD_params -{ - VkDevice device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - VkShaderStageFlagBits shaderStage; - VkShaderInfoTypeAMD infoType; - size_t *pInfoSize; - void *pInfo; - VkResult result; -}; - -struct vkGetShaderModuleCreateInfoIdentifierEXT_params -{ - VkDevice device; - const VkShaderModuleCreateInfo *pCreateInfo; - VkShaderModuleIdentifierEXT *pIdentifier; -}; - -struct vkGetShaderModuleIdentifierEXT_params -{ - VkDevice device; - VkShaderModule DECLSPEC_ALIGN(8) shaderModule; - VkShaderModuleIdentifierEXT *pIdentifier; -}; - -struct vkGetSwapchainImagesKHR_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint32_t *pSwapchainImageCount; - VkImage *pSwapchainImages; - VkResult result; -}; - -struct vkGetValidationCacheDataEXT_params -{ - VkDevice device; - VkValidationCacheEXT DECLSPEC_ALIGN(8) validationCache; - size_t *pDataSize; - void *pData; - VkResult result; -}; - -struct vkInitializePerformanceApiINTEL_params -{ - VkDevice device; - const VkInitializePerformanceApiInfoINTEL *pInitializeInfo; - VkResult result; -}; - -struct vkInvalidateMappedMemoryRanges_params -{ - VkDevice device; - uint32_t memoryRangeCount; - const VkMappedMemoryRange *pMemoryRanges; - VkResult result; -}; - -struct vkLatencySleepNV_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - const VkLatencySleepInfoNV *pSleepInfo; - VkResult result; -}; - -struct vkMapMemory_params -{ - VkDevice device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkMemoryMapFlags flags; - void **ppData; - VkResult result; -}; - -struct vkMapMemory2KHR_params -{ - VkDevice device; - const VkMemoryMapInfoKHR *pMemoryMapInfo; - void **ppData; - VkResult result; -}; - -struct vkMergePipelineCaches_params -{ - VkDevice device; - VkPipelineCache DECLSPEC_ALIGN(8) dstCache; - uint32_t srcCacheCount; - const VkPipelineCache *pSrcCaches; - VkResult result; -}; - -struct vkMergeValidationCachesEXT_params -{ - VkDevice device; - VkValidationCacheEXT DECLSPEC_ALIGN(8) dstCache; - uint32_t srcCacheCount; - const VkValidationCacheEXT *pSrcCaches; - VkResult result; -}; - -struct vkQueueBeginDebugUtilsLabelEXT_params -{ - VkQueue queue; - const VkDebugUtilsLabelEXT *pLabelInfo; -}; - -struct vkQueueBindSparse_params -{ - VkQueue queue; - uint32_t bindInfoCount; - const VkBindSparseInfo *pBindInfo; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; -}; - -struct vkQueueEndDebugUtilsLabelEXT_params -{ - VkQueue queue; -}; - -struct vkQueueInsertDebugUtilsLabelEXT_params -{ - VkQueue queue; - const VkDebugUtilsLabelEXT *pLabelInfo; -}; - -struct vkQueueNotifyOutOfBandNV_params -{ - VkQueue queue; - const VkOutOfBandQueueTypeInfoNV *pQueueTypeInfo; -}; - -struct vkQueuePresentKHR_params -{ - VkQueue queue; - const VkPresentInfoKHR *pPresentInfo; - VkResult result; -}; - -struct vkQueueSetPerformanceConfigurationINTEL_params -{ - VkQueue queue; - VkPerformanceConfigurationINTEL DECLSPEC_ALIGN(8) configuration; - VkResult result; -}; - -struct vkQueueSubmit_params -{ - VkQueue queue; - uint32_t submitCount; - const VkSubmitInfo *pSubmits; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; -}; - -struct vkQueueSubmit2_params -{ - VkQueue queue; - uint32_t submitCount; - const VkSubmitInfo2 *pSubmits; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; -}; - -struct vkQueueSubmit2KHR_params -{ - VkQueue queue; - uint32_t submitCount; - const VkSubmitInfo2 *pSubmits; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; -}; - -struct vkQueueWaitIdle_params -{ - VkQueue queue; - VkResult result; -}; - -struct vkReleasePerformanceConfigurationINTEL_params -{ - VkDevice device; - VkPerformanceConfigurationINTEL DECLSPEC_ALIGN(8) configuration; - VkResult result; -}; - -struct vkReleaseProfilingLockKHR_params -{ - VkDevice device; -}; - -struct vkReleaseSwapchainImagesEXT_params -{ - VkDevice device; - const VkReleaseSwapchainImagesInfoEXT *pReleaseInfo; - VkResult result; -}; - -struct vkResetCommandBuffer_params -{ - VkCommandBuffer commandBuffer; - VkCommandBufferResetFlags flags; - VkResult result; -}; - -struct vkResetCommandPool_params -{ - VkDevice device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandPoolResetFlags flags; - VkResult result; -}; - -struct vkResetDescriptorPool_params -{ - VkDevice device; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - VkDescriptorPoolResetFlags flags; - VkResult result; -}; - -struct vkResetEvent_params -{ - VkDevice device; - VkEvent DECLSPEC_ALIGN(8) event; - VkResult result; -}; - -struct vkResetFences_params -{ - VkDevice device; - uint32_t fenceCount; - const VkFence *pFences; - VkResult result; -}; - -struct vkResetQueryPool_params -{ - VkDevice device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; -}; - -struct vkResetQueryPoolEXT_params -{ - VkDevice device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; -}; - -struct vkSetDebugUtilsObjectNameEXT_params -{ - VkDevice device; - const VkDebugUtilsObjectNameInfoEXT *pNameInfo; - VkResult result; -}; - -struct vkSetDebugUtilsObjectTagEXT_params -{ - VkDevice device; - const VkDebugUtilsObjectTagInfoEXT *pTagInfo; - VkResult result; -}; - -struct vkSetDeviceMemoryPriorityEXT_params -{ - VkDevice device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - float priority; -}; - -struct vkSetEvent_params -{ - VkDevice device; - VkEvent DECLSPEC_ALIGN(8) event; - VkResult result; -}; - -struct vkSetHdrMetadataEXT_params -{ - VkDevice device; - uint32_t swapchainCount; - const VkSwapchainKHR *pSwapchains; - const VkHdrMetadataEXT *pMetadata; -}; - -struct vkSetLatencyMarkerNV_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - const VkSetLatencyMarkerInfoNV *pLatencyMarkerInfo; -}; - -struct vkSetLatencySleepModeNV_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - const VkLatencySleepModeInfoNV *pSleepModeInfo; - VkResult result; -}; - -struct vkSetPrivateData_params -{ - VkDevice device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - uint64_t DECLSPEC_ALIGN(8) data; - VkResult result; -}; - -struct vkSetPrivateDataEXT_params -{ - VkDevice device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - uint64_t DECLSPEC_ALIGN(8) data; - VkResult result; -}; - -struct vkSignalSemaphore_params -{ - VkDevice device; - const VkSemaphoreSignalInfo *pSignalInfo; - VkResult result; -}; - -struct vkSignalSemaphoreKHR_params -{ - VkDevice device; - const VkSemaphoreSignalInfo *pSignalInfo; - VkResult result; -}; - -struct vkSubmitDebugUtilsMessageEXT_params -{ - VkInstance instance; - VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity; - VkDebugUtilsMessageTypeFlagsEXT messageTypes; - const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData; -}; - -struct vkTransitionImageLayoutEXT_params -{ - VkDevice device; - uint32_t transitionCount; - const VkHostImageLayoutTransitionInfoEXT *pTransitions; - VkResult result; -}; - -struct vkTrimCommandPool_params -{ - VkDevice device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandPoolTrimFlags flags; -}; - -struct vkTrimCommandPoolKHR_params -{ - VkDevice device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandPoolTrimFlags flags; -}; - -struct vkUninitializePerformanceApiINTEL_params -{ - VkDevice device; -}; - -struct vkUnmapMemory_params -{ - VkDevice device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; -}; - -struct vkUnmapMemory2KHR_params -{ - VkDevice device; - const VkMemoryUnmapInfoKHR *pMemoryUnmapInfo; - VkResult result; -}; - -struct vkUpdateDescriptorSetWithTemplate_params -{ - VkDevice device; - VkDescriptorSet DECLSPEC_ALIGN(8) descriptorSet; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - const void *pData; -}; - -struct vkUpdateDescriptorSetWithTemplateKHR_params -{ - VkDevice device; - VkDescriptorSet DECLSPEC_ALIGN(8) descriptorSet; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - const void *pData; -}; - -struct vkUpdateDescriptorSets_params -{ - VkDevice device; - uint32_t descriptorWriteCount; - const VkWriteDescriptorSet *pDescriptorWrites; - uint32_t descriptorCopyCount; - const VkCopyDescriptorSet *pDescriptorCopies; -}; - -struct vkWaitForFences_params -{ - VkDevice device; - uint32_t fenceCount; - const VkFence *pFences; - VkBool32 waitAll; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; -}; - -struct vkWaitForPresentKHR_params -{ - VkDevice device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint64_t DECLSPEC_ALIGN(8) presentId; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; -}; - -struct vkWaitSemaphores_params -{ - VkDevice device; - const VkSemaphoreWaitInfo *pWaitInfo; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; -}; - -struct vkWaitSemaphoresKHR_params -{ - VkDevice device; - const VkSemaphoreWaitInfo *pWaitInfo; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; -}; - -struct vkWriteAccelerationStructuresPropertiesKHR_params -{ - VkDevice device; - uint32_t accelerationStructureCount; - const VkAccelerationStructureKHR *pAccelerationStructures; - VkQueryType queryType; - size_t dataSize; - void *pData; - size_t stride; - VkResult result; -}; - -struct vkWriteMicromapsPropertiesEXT_params -{ - VkDevice device; - uint32_t micromapCount; - const VkMicromapEXT *pMicromaps; - VkQueryType queryType; - size_t dataSize; - void *pData; - size_t stride; - VkResult result; -}; - -#endif /* __WINE_VULKAN_LOADER_THUNKS_H */ diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c deleted file mode 100644 index 166ce23ad03..00000000000 --- a/dlls/winevulkan/vulkan_thunks.c +++ /dev/null @@ -1,46008 +0,0 @@ -/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! - * - * This file is generated from Vulkan vk.xml file covered - * by the following copyright and permission notice: - * - * Copyright 2015-2023 The Khronos Group Inc. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#if 0 -#pragma makedep unix -#endif - -#include "config.h" - -#include - -#include "vulkan_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(vulkan); - -typedef struct VkAcquireNextImageInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - VkFence DECLSPEC_ALIGN(8) fence; - uint32_t deviceMask; -} VkAcquireNextImageInfoKHR32; - -typedef struct VkPerformanceConfigurationAcquireInfoINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - VkPerformanceConfigurationTypeINTEL type; -} VkPerformanceConfigurationAcquireInfoINTEL32; - -typedef struct VkAcquireProfilingLockInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkAcquireProfilingLockFlagsKHR flags; - uint64_t DECLSPEC_ALIGN(8) timeout; -} VkAcquireProfilingLockInfoKHR32; - -typedef struct VkCommandBufferAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandBufferLevel level; - uint32_t commandBufferCount; -} VkCommandBufferAllocateInfo32; - -typedef struct VkDescriptorSetVariableDescriptorCountAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t descriptorSetCount; - PTR32 pDescriptorCounts; -} VkDescriptorSetVariableDescriptorCountAllocateInfo32; -typedef VkDescriptorSetVariableDescriptorCountAllocateInfo32 VkDescriptorSetVariableDescriptorCountAllocateInfoEXT32; - -typedef struct VkDescriptorSetAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - uint32_t descriptorSetCount; - PTR32 pSetLayouts; -} VkDescriptorSetAllocateInfo32; - -typedef struct VkDedicatedAllocationMemoryAllocateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; - VkBuffer DECLSPEC_ALIGN(8) buffer; -} VkDedicatedAllocationMemoryAllocateInfoNV32; - -typedef struct VkExportMemoryAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExportMemoryAllocateInfo32; -typedef VkExportMemoryAllocateInfo32 VkExportMemoryAllocateInfoKHR32; - -typedef struct VkImportMemoryWin32HandleInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - HANDLE handle; - LPCWSTR name; -} VkImportMemoryWin32HandleInfoKHR32; - -typedef struct VkExportMemoryWin32HandleInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportMemoryWin32HandleInfoKHR32; - -typedef struct VkMemoryAllocateFlagsInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkMemoryAllocateFlags flags; - uint32_t deviceMask; -} VkMemoryAllocateFlagsInfo32; -typedef VkMemoryAllocateFlagsInfo32 VkMemoryAllocateFlagsInfoKHR32; - -typedef struct VkMemoryDedicatedAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; - VkBuffer DECLSPEC_ALIGN(8) buffer; -} VkMemoryDedicatedAllocateInfo32; -typedef VkMemoryDedicatedAllocateInfo32 VkMemoryDedicatedAllocateInfoKHR32; - -typedef struct VkImportMemoryHostPointerInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - PTR32 pHostPointer; -} VkImportMemoryHostPointerInfoEXT32; - -typedef struct VkMemoryPriorityAllocateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - float priority; -} VkMemoryPriorityAllocateInfoEXT32; - -typedef struct VkMemoryOpaqueCaptureAddressAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) opaqueCaptureAddress; -} VkMemoryOpaqueCaptureAddressAllocateInfo32; -typedef VkMemoryOpaqueCaptureAddressAllocateInfo32 VkMemoryOpaqueCaptureAddressAllocateInfoKHR32; - -typedef struct VkMemoryAllocateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) allocationSize; - uint32_t memoryTypeIndex; -} VkMemoryAllocateInfo32; - -typedef struct VkCommandBufferInheritanceConditionalRenderingInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 conditionalRenderingEnable; -} VkCommandBufferInheritanceConditionalRenderingInfoEXT32; - -typedef struct VkCommandBufferInheritanceRenderPassTransformInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkSurfaceTransformFlagBitsKHR transform; - VkRect2D renderArea; -} VkCommandBufferInheritanceRenderPassTransformInfoQCOM32; - -typedef struct VkCommandBufferInheritanceViewportScissorInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 viewportScissor2D; - uint32_t viewportDepthCount; - PTR32 pViewportDepths; -} VkCommandBufferInheritanceViewportScissorInfoNV32; - -typedef struct VkCommandBufferInheritanceRenderingInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderingFlags flags; - uint32_t viewMask; - uint32_t colorAttachmentCount; - PTR32 pColorAttachmentFormats; - VkFormat depthAttachmentFormat; - VkFormat stencilAttachmentFormat; - VkSampleCountFlagBits rasterizationSamples; -} VkCommandBufferInheritanceRenderingInfo32; -typedef VkCommandBufferInheritanceRenderingInfo32 VkCommandBufferInheritanceRenderingInfoKHR32; - -typedef struct VkAttachmentSampleCountInfoAMD32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t colorAttachmentCount; - PTR32 pColorAttachmentSamples; - VkSampleCountFlagBits depthStencilAttachmentSamples; -} VkAttachmentSampleCountInfoAMD32; -typedef VkAttachmentSampleCountInfoAMD32 VkAttachmentSampleCountInfoNV32; - -typedef struct VkMultiviewPerViewAttributesInfoNVX32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 perViewAttributes; - VkBool32 perViewAttributesPositionXOnly; -} VkMultiviewPerViewAttributesInfoNVX32; - -typedef struct VkCommandBufferInheritanceInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - uint32_t subpass; - VkFramebuffer DECLSPEC_ALIGN(8) framebuffer; - VkBool32 occlusionQueryEnable; - VkQueryControlFlags queryFlags; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkCommandBufferInheritanceInfo32; - -typedef struct VkDeviceGroupCommandBufferBeginInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t deviceMask; -} VkDeviceGroupCommandBufferBeginInfo32; -typedef VkDeviceGroupCommandBufferBeginInfo32 VkDeviceGroupCommandBufferBeginInfoKHR32; - -typedef struct VkCommandBufferBeginInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkCommandBufferUsageFlags flags; - PTR32 pInheritanceInfo; -} VkCommandBufferBeginInfo32; - -typedef struct VkBindAccelerationStructureMemoryInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructure; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - uint32_t deviceIndexCount; - PTR32 pDeviceIndices; -} VkBindAccelerationStructureMemoryInfoNV32; - -typedef struct VkBindBufferMemoryDeviceGroupInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t deviceIndexCount; - PTR32 pDeviceIndices; -} VkBindBufferMemoryDeviceGroupInfo32; -typedef VkBindBufferMemoryDeviceGroupInfo32 VkBindBufferMemoryDeviceGroupInfoKHR32; - -typedef struct VkBindBufferMemoryInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; -} VkBindBufferMemoryInfo32; -typedef VkBindBufferMemoryInfo32 VkBindBufferMemoryInfoKHR32; - -typedef struct VkBindImageMemoryDeviceGroupInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t deviceIndexCount; - PTR32 pDeviceIndices; - uint32_t splitInstanceBindRegionCount; - PTR32 pSplitInstanceBindRegions; -} VkBindImageMemoryDeviceGroupInfo32; -typedef VkBindImageMemoryDeviceGroupInfo32 VkBindImageMemoryDeviceGroupInfoKHR32; - -typedef struct VkBindImageMemorySwapchainInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint32_t imageIndex; -} VkBindImageMemorySwapchainInfoKHR32; - -typedef struct VkBindImagePlaneMemoryInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageAspectFlagBits planeAspect; -} VkBindImagePlaneMemoryInfo32; -typedef VkBindImagePlaneMemoryInfo32 VkBindImagePlaneMemoryInfoKHR32; - -typedef struct VkBindImageMemoryInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; -} VkBindImageMemoryInfo32; -typedef VkBindImageMemoryInfo32 VkBindImageMemoryInfoKHR32; - -typedef struct VkAccelerationStructureGeometryMotionTrianglesDataNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) vertexData; -} VkAccelerationStructureGeometryMotionTrianglesDataNV32; - -typedef struct VkAccelerationStructureTrianglesOpacityMicromapEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkIndexType indexType; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) indexBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) indexStride; - uint32_t baseTriangle; - uint32_t usageCountsCount; - PTR32 pUsageCounts; - PTR32 ppUsageCounts; - VkMicromapEXT DECLSPEC_ALIGN(8) micromap; -} VkAccelerationStructureTrianglesOpacityMicromapEXT32; - -typedef struct VkAccelerationStructureGeometryTrianglesDataKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkFormat vertexFormat; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) vertexData; - VkDeviceSize DECLSPEC_ALIGN(8) vertexStride; - uint32_t maxVertex; - VkIndexType indexType; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) indexData; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) transformData; -} VkAccelerationStructureGeometryTrianglesDataKHR32; - -typedef struct VkAccelerationStructureGeometryAabbsDataKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) data; - VkDeviceSize DECLSPEC_ALIGN(8) stride; -} VkAccelerationStructureGeometryAabbsDataKHR32; - -typedef struct VkAccelerationStructureGeometryInstancesDataKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 arrayOfPointers; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) data; -} VkAccelerationStructureGeometryInstancesDataKHR32; - -typedef union VkAccelerationStructureGeometryDataKHR32 -{ - VkAccelerationStructureGeometryTrianglesDataKHR32 DECLSPEC_ALIGN(8) triangles; - VkAccelerationStructureGeometryAabbsDataKHR32 DECLSPEC_ALIGN(8) aabbs; - VkAccelerationStructureGeometryInstancesDataKHR32 DECLSPEC_ALIGN(8) instances; -} VkAccelerationStructureGeometryDataKHR32; - -typedef struct VkAccelerationStructureGeometryKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkGeometryTypeKHR geometryType; - VkAccelerationStructureGeometryDataKHR32 DECLSPEC_ALIGN(8) geometry; - VkGeometryFlagsKHR flags; -} VkAccelerationStructureGeometryKHR32; - -typedef struct VkAccelerationStructureBuildGeometryInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureTypeKHR type; - VkBuildAccelerationStructureFlagsKHR flags; - VkBuildAccelerationStructureModeKHR mode; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) srcAccelerationStructure; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) dstAccelerationStructure; - uint32_t geometryCount; - PTR32 pGeometries; - PTR32 ppGeometries; - VkDeviceOrHostAddressKHR DECLSPEC_ALIGN(8) scratchData; -} VkAccelerationStructureBuildGeometryInfoKHR32; - -typedef struct VkMicromapBuildInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkMicromapTypeEXT type; - VkBuildMicromapFlagsEXT flags; - VkBuildMicromapModeEXT mode; - VkMicromapEXT DECLSPEC_ALIGN(8) dstMicromap; - uint32_t usageCountsCount; - PTR32 pUsageCounts; - PTR32 ppUsageCounts; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) data; - VkDeviceOrHostAddressKHR DECLSPEC_ALIGN(8) scratchData; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) triangleArray; - VkDeviceSize DECLSPEC_ALIGN(8) triangleArrayStride; -} VkMicromapBuildInfoEXT32; - -typedef struct VkConditionalRenderingBeginInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkConditionalRenderingFlagsEXT flags; -} VkConditionalRenderingBeginInfoEXT32; - -typedef struct VkDebugUtilsLabelEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pLabelName; - float color[4]; -} VkDebugUtilsLabelEXT32; - -typedef struct VkSampleLocationsInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkSampleCountFlagBits sampleLocationsPerPixel; - VkExtent2D sampleLocationGridSize; - uint32_t sampleLocationsCount; - PTR32 pSampleLocations; -} VkSampleLocationsInfoEXT32; - -typedef struct VkAttachmentSampleLocationsEXT32 -{ - uint32_t attachmentIndex; - VkSampleLocationsInfoEXT32 sampleLocationsInfo; -} VkAttachmentSampleLocationsEXT32; - -typedef struct VkSubpassSampleLocationsEXT32 -{ - uint32_t subpassIndex; - VkSampleLocationsInfoEXT32 sampleLocationsInfo; -} VkSubpassSampleLocationsEXT32; - -typedef struct VkDeviceGroupRenderPassBeginInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t deviceMask; - uint32_t deviceRenderAreaCount; - PTR32 pDeviceRenderAreas; -} VkDeviceGroupRenderPassBeginInfo32; -typedef VkDeviceGroupRenderPassBeginInfo32 VkDeviceGroupRenderPassBeginInfoKHR32; - -typedef struct VkRenderPassSampleLocationsBeginInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t attachmentInitialSampleLocationsCount; - PTR32 pAttachmentInitialSampleLocations; - uint32_t postSubpassSampleLocationsCount; - PTR32 pPostSubpassSampleLocations; -} VkRenderPassSampleLocationsBeginInfoEXT32; - -typedef struct VkRenderPassAttachmentBeginInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t attachmentCount; - PTR32 pAttachments; -} VkRenderPassAttachmentBeginInfo32; -typedef VkRenderPassAttachmentBeginInfo32 VkRenderPassAttachmentBeginInfoKHR32; - -typedef struct VkRenderPassTransformBeginInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkSurfaceTransformFlagBitsKHR transform; -} VkRenderPassTransformBeginInfoQCOM32; - -typedef struct VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t perViewRenderAreaCount; - PTR32 pPerViewRenderAreas; -} VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM32; - -typedef struct VkRenderPassBeginInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - VkFramebuffer DECLSPEC_ALIGN(8) framebuffer; - VkRect2D renderArea; - uint32_t clearValueCount; - PTR32 pClearValues; -} VkRenderPassBeginInfo32; - -typedef struct VkSubpassBeginInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSubpassContents contents; -} VkSubpassBeginInfo32; -typedef VkSubpassBeginInfo32 VkSubpassBeginInfoKHR32; - -typedef struct VkRenderingAttachmentInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; - VkResolveModeFlagBits resolveMode; - VkImageView DECLSPEC_ALIGN(8) resolveImageView; - VkImageLayout resolveImageLayout; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkClearValue clearValue; -} VkRenderingAttachmentInfo32; -typedef VkRenderingAttachmentInfo32 VkRenderingAttachmentInfoKHR32; - -typedef struct VkMultisampledRenderToSingleSampledInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 multisampledRenderToSingleSampledEnable; - VkSampleCountFlagBits rasterizationSamples; -} VkMultisampledRenderToSingleSampledInfoEXT32; - -typedef struct VkRenderingFragmentShadingRateAttachmentInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; - VkExtent2D shadingRateAttachmentTexelSize; -} VkRenderingFragmentShadingRateAttachmentInfoKHR32; - -typedef struct VkRenderingFragmentDensityMapAttachmentInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; -} VkRenderingFragmentDensityMapAttachmentInfoEXT32; - -typedef struct VkRenderingInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderingFlags flags; - VkRect2D renderArea; - uint32_t layerCount; - uint32_t viewMask; - uint32_t colorAttachmentCount; - PTR32 pColorAttachments; - PTR32 pDepthAttachment; - PTR32 pStencilAttachment; -} VkRenderingInfo32; -typedef VkRenderingInfo32 VkRenderingInfoKHR32; - -typedef struct VkBufferUsageFlags2CreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBufferUsageFlags2KHR DECLSPEC_ALIGN(8) usage; -} VkBufferUsageFlags2CreateInfoKHR32; - -typedef struct VkDescriptorBufferBindingPushDescriptorBufferHandleEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) buffer; -} VkDescriptorBufferBindingPushDescriptorBufferHandleEXT32; - -typedef struct VkDescriptorBufferBindingInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceAddress DECLSPEC_ALIGN(8) address; - VkBufferUsageFlags usage; -} VkDescriptorBufferBindingInfoEXT32; - -typedef struct VkCopyCommandTransformInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkSurfaceTransformFlagBitsKHR transform; -} VkCopyCommandTransformInfoQCOM32; - -typedef struct VkImageBlit232 -{ - VkStructureType sType; - PTR32 pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffsets[2]; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffsets[2]; -} VkImageBlit232; -typedef VkImageBlit232 VkImageBlit2KHR32; - -typedef struct VkBlitImageCubicWeightsInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkCubicFilterWeightsQCOM cubicWeights; -} VkBlitImageCubicWeightsInfoQCOM32; - -typedef struct VkBlitImageInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; - VkFilter filter; -} VkBlitImageInfo232; -typedef VkBlitImageInfo232 VkBlitImageInfo2KHR32; - -typedef struct VkGeometryTrianglesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) vertexData; - VkDeviceSize DECLSPEC_ALIGN(8) vertexOffset; - uint32_t vertexCount; - VkDeviceSize DECLSPEC_ALIGN(8) vertexStride; - VkFormat vertexFormat; - VkBuffer DECLSPEC_ALIGN(8) indexData; - VkDeviceSize DECLSPEC_ALIGN(8) indexOffset; - uint32_t indexCount; - VkIndexType indexType; - VkBuffer DECLSPEC_ALIGN(8) transformData; - VkDeviceSize DECLSPEC_ALIGN(8) transformOffset; -} VkGeometryTrianglesNV32; - -typedef struct VkGeometryAABBNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) aabbData; - uint32_t numAABBs; - uint32_t stride; - VkDeviceSize DECLSPEC_ALIGN(8) offset; -} VkGeometryAABBNV32; - -typedef struct VkGeometryDataNV32 -{ - VkGeometryTrianglesNV32 DECLSPEC_ALIGN(8) triangles; - VkGeometryAABBNV32 DECLSPEC_ALIGN(8) aabbs; -} VkGeometryDataNV32; - -typedef struct VkGeometryNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkGeometryTypeKHR geometryType; - VkGeometryDataNV32 DECLSPEC_ALIGN(8) geometry; - VkGeometryFlagsKHR flags; -} VkGeometryNV32; - -typedef struct VkAccelerationStructureInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureTypeNV type; - VkBuildAccelerationStructureFlagsNV flags; - uint32_t instanceCount; - uint32_t geometryCount; - PTR32 pGeometries; -} VkAccelerationStructureInfoNV32; - -typedef struct VkCopyAccelerationStructureInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) src; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyAccelerationStructureInfoKHR32; - -typedef struct VkCopyAccelerationStructureToMemoryInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) src; - VkDeviceOrHostAddressKHR DECLSPEC_ALIGN(8) dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyAccelerationStructureToMemoryInfoKHR32; - -typedef struct VkBufferCopy32 -{ - VkDeviceSize DECLSPEC_ALIGN(8) srcOffset; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkBufferCopy32; - -typedef struct VkBufferCopy232 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) srcOffset; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkBufferCopy232; -typedef VkBufferCopy232 VkBufferCopy2KHR32; - -typedef struct VkCopyBufferInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) srcBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyBufferInfo232; -typedef VkCopyBufferInfo232 VkCopyBufferInfo2KHR32; - -typedef struct VkBufferImageCopy32 -{ - VkDeviceSize DECLSPEC_ALIGN(8) bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy32; - -typedef struct VkBufferImageCopy232 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy232; -typedef VkBufferImageCopy232 VkBufferImageCopy2KHR32; - -typedef struct VkCopyBufferToImageInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) srcBuffer; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyBufferToImageInfo232; -typedef VkCopyBufferToImageInfo232 VkCopyBufferToImageInfo2KHR32; - -typedef struct VkImageCopy232 -{ - VkStructureType sType; - PTR32 pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageCopy232; -typedef VkImageCopy232 VkImageCopy2KHR32; - -typedef struct VkCopyImageInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyImageInfo232; -typedef VkCopyImageInfo232 VkCopyImageInfo2KHR32; - -typedef struct VkCopyImageToBufferInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyImageToBufferInfo232; -typedef VkCopyImageToBufferInfo232 VkCopyImageToBufferInfo2KHR32; - -typedef struct VkCopyMemoryToAccelerationStructureInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) src; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyMemoryToAccelerationStructureInfoKHR32; - -typedef struct VkCopyMemoryToMicromapInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceOrHostAddressConstKHR DECLSPEC_ALIGN(8) src; - VkMicromapEXT DECLSPEC_ALIGN(8) dst; - VkCopyMicromapModeEXT mode; -} VkCopyMemoryToMicromapInfoEXT32; - -typedef struct VkCopyMicromapInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkMicromapEXT DECLSPEC_ALIGN(8) src; - VkMicromapEXT DECLSPEC_ALIGN(8) dst; - VkCopyMicromapModeEXT mode; -} VkCopyMicromapInfoEXT32; - -typedef struct VkCopyMicromapToMemoryInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkMicromapEXT DECLSPEC_ALIGN(8) src; - VkDeviceOrHostAddressKHR DECLSPEC_ALIGN(8) dst; - VkCopyMicromapModeEXT mode; -} VkCopyMicromapToMemoryInfoEXT32; - -typedef struct VkCuLaunchInfoNVX32 -{ - VkStructureType sType; - PTR32 pNext; - VkCuFunctionNVX DECLSPEC_ALIGN(8) function; - uint32_t gridDimX; - uint32_t gridDimY; - uint32_t gridDimZ; - uint32_t blockDimX; - uint32_t blockDimY; - uint32_t blockDimZ; - uint32_t sharedMemBytes; - PTR32 paramCount; - PTR32 pParams; - PTR32 extraCount; - PTR32 pExtras; -} VkCuLaunchInfoNVX32; - -typedef struct VkCudaLaunchInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkCudaFunctionNV DECLSPEC_ALIGN(8) function; - uint32_t gridDimX; - uint32_t gridDimY; - uint32_t gridDimZ; - uint32_t blockDimX; - uint32_t blockDimY; - uint32_t blockDimZ; - uint32_t sharedMemBytes; - PTR32 paramCount; - PTR32 pParams; - PTR32 extraCount; - PTR32 pExtras; -} VkCudaLaunchInfoNV32; - -typedef struct VkDebugMarkerMarkerInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pMarkerName; - float color[4]; -} VkDebugMarkerMarkerInfoEXT32; - -typedef struct VkDecompressMemoryRegionNV32 -{ - VkDeviceAddress DECLSPEC_ALIGN(8) srcAddress; - VkDeviceAddress DECLSPEC_ALIGN(8) dstAddress; - VkDeviceSize DECLSPEC_ALIGN(8) compressedSize; - VkDeviceSize DECLSPEC_ALIGN(8) decompressedSize; - VkMemoryDecompressionMethodFlagsNV DECLSPEC_ALIGN(8) decompressionMethod; -} VkDecompressMemoryRegionNV32; - -typedef struct VkSubpassFragmentDensityMapOffsetEndInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t fragmentDensityOffsetCount; - PTR32 pFragmentDensityOffsets; -} VkSubpassFragmentDensityMapOffsetEndInfoQCOM32; - -typedef struct VkSubpassEndInfo32 -{ - VkStructureType sType; - PTR32 pNext; -} VkSubpassEndInfo32; -typedef VkSubpassEndInfo32 VkSubpassEndInfoKHR32; - -typedef struct VkIndirectCommandsStreamNV32 -{ - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; -} VkIndirectCommandsStreamNV32; - -typedef struct VkGeneratedCommandsInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - VkIndirectCommandsLayoutNV DECLSPEC_ALIGN(8) indirectCommandsLayout; - uint32_t streamCount; - PTR32 pStreams; - uint32_t sequencesCount; - VkBuffer DECLSPEC_ALIGN(8) preprocessBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) preprocessOffset; - VkDeviceSize DECLSPEC_ALIGN(8) preprocessSize; - VkBuffer DECLSPEC_ALIGN(8) sequencesCountBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) sequencesCountOffset; - VkBuffer DECLSPEC_ALIGN(8) sequencesIndexBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) sequencesIndexOffset; -} VkGeneratedCommandsInfoNV32; - -typedef struct VkOpticalFlowExecuteInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkOpticalFlowExecuteFlagsNV flags; - uint32_t regionCount; - PTR32 pRegions; -} VkOpticalFlowExecuteInfoNV32; - -typedef struct VkMemoryBarrier32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; -} VkMemoryBarrier32; - -typedef struct VkExternalMemoryAcquireUnmodifiedEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 acquireUnmodifiedMemory; -} VkExternalMemoryAcquireUnmodifiedEXT32; - -typedef struct VkBufferMemoryBarrier32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkBufferMemoryBarrier32; - -typedef struct VkImageMemoryBarrier32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage DECLSPEC_ALIGN(8) image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier32; - -typedef struct VkMemoryBarrier232 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) srcStageMask; - VkAccessFlags2 DECLSPEC_ALIGN(8) srcAccessMask; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) dstStageMask; - VkAccessFlags2 DECLSPEC_ALIGN(8) dstAccessMask; -} VkMemoryBarrier232; -typedef VkMemoryBarrier232 VkMemoryBarrier2KHR32; - -typedef struct VkBufferMemoryBarrier232 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) srcStageMask; - VkAccessFlags2 DECLSPEC_ALIGN(8) srcAccessMask; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) dstStageMask; - VkAccessFlags2 DECLSPEC_ALIGN(8) dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkBufferMemoryBarrier232; -typedef VkBufferMemoryBarrier232 VkBufferMemoryBarrier2KHR32; - -typedef struct VkImageMemoryBarrier232 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) srcStageMask; - VkAccessFlags2 DECLSPEC_ALIGN(8) srcAccessMask; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) dstStageMask; - VkAccessFlags2 DECLSPEC_ALIGN(8) dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage DECLSPEC_ALIGN(8) image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier232; -typedef VkImageMemoryBarrier232 VkImageMemoryBarrier2KHR32; - -typedef struct VkDependencyInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDependencyFlags dependencyFlags; - uint32_t memoryBarrierCount; - PTR32 pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - PTR32 pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - PTR32 pImageMemoryBarriers; -} VkDependencyInfo32; -typedef VkDependencyInfo32 VkDependencyInfoKHR32; - -typedef struct VkDescriptorImageInfo32 -{ - VkSampler DECLSPEC_ALIGN(8) sampler; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; -} VkDescriptorImageInfo32; - -typedef struct VkDescriptorBufferInfo32 -{ - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) range; -} VkDescriptorBufferInfo32; - -typedef struct VkWriteDescriptorSetInlineUniformBlock32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t dataSize; - PTR32 pData; -} VkWriteDescriptorSetInlineUniformBlock32; -typedef VkWriteDescriptorSetInlineUniformBlock32 VkWriteDescriptorSetInlineUniformBlockEXT32; - -typedef struct VkWriteDescriptorSetAccelerationStructureKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t accelerationStructureCount; - PTR32 pAccelerationStructures; -} VkWriteDescriptorSetAccelerationStructureKHR32; - -typedef struct VkWriteDescriptorSetAccelerationStructureNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t accelerationStructureCount; - PTR32 pAccelerationStructures; -} VkWriteDescriptorSetAccelerationStructureNV32; - -typedef struct VkWriteDescriptorSet32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorSet DECLSPEC_ALIGN(8) dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - PTR32 pImageInfo; - PTR32 pBufferInfo; - PTR32 pTexelBufferView; -} VkWriteDescriptorSet32; - -typedef struct VkImageResolve232 -{ - VkStructureType sType; - PTR32 pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageResolve232; -typedef VkImageResolve232 VkImageResolve2KHR32; - -typedef struct VkResolveImageInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; -} VkResolveImageInfo232; -typedef VkResolveImageInfo232 VkResolveImageInfo2KHR32; - -typedef struct VkCoarseSampleOrderCustomNV32 -{ - VkShadingRatePaletteEntryNV shadingRate; - uint32_t sampleCount; - uint32_t sampleLocationCount; - PTR32 pSampleLocations; -} VkCoarseSampleOrderCustomNV32; - -typedef struct VkDepthBiasRepresentationInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDepthBiasRepresentationEXT depthBiasRepresentation; - VkBool32 depthBiasExact; -} VkDepthBiasRepresentationInfoEXT32; - -typedef struct VkDepthBiasInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; -} VkDepthBiasInfoEXT32; - -typedef struct VkPerformanceMarkerInfoINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) marker; -} VkPerformanceMarkerInfoINTEL32; - -typedef struct VkPerformanceOverrideInfoINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - VkPerformanceOverrideTypeINTEL type; - VkBool32 enable; - uint64_t DECLSPEC_ALIGN(8) parameter; -} VkPerformanceOverrideInfoINTEL32; - -typedef struct VkPerformanceStreamMarkerInfoINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t marker; -} VkPerformanceStreamMarkerInfoINTEL32; - -typedef struct VkVertexInputBindingDescription2EXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t binding; - uint32_t stride; - VkVertexInputRate inputRate; - uint32_t divisor; -} VkVertexInputBindingDescription2EXT32; - -typedef struct VkVertexInputAttributeDescription2EXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t location; - uint32_t binding; - VkFormat format; - uint32_t offset; -} VkVertexInputAttributeDescription2EXT32; - -typedef struct VkShadingRatePaletteNV32 -{ - uint32_t shadingRatePaletteEntryCount; - PTR32 pShadingRatePaletteEntries; -} VkShadingRatePaletteNV32; - -typedef struct VkStridedDeviceAddressRegionKHR32 -{ - VkDeviceAddress DECLSPEC_ALIGN(8) deviceAddress; - VkDeviceSize DECLSPEC_ALIGN(8) stride; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkStridedDeviceAddressRegionKHR32; - -typedef struct VkCopyImageToImageInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkHostImageCopyFlagsEXT flags; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyImageToImageInfoEXT32; - -typedef struct VkImageToMemoryCopyEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pHostPointer; - uint32_t memoryRowLength; - uint32_t memoryImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkImageToMemoryCopyEXT32; - -typedef struct VkCopyImageToMemoryInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkHostImageCopyFlagsEXT flags; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyImageToMemoryInfoEXT32; - -typedef struct VkMemoryToImageCopyEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pHostPointer; - uint32_t memoryRowLength; - uint32_t memoryImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkMemoryToImageCopyEXT32; - -typedef struct VkCopyMemoryToImageInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkHostImageCopyFlagsEXT flags; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; -} VkCopyMemoryToImageInfoEXT32; - -typedef struct VkOpaqueCaptureDescriptorDataCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 opaqueCaptureDescriptorData; -} VkOpaqueCaptureDescriptorDataCreateInfoEXT32; - -typedef struct VkAccelerationStructureMotionInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxInstances; - VkAccelerationStructureMotionInfoFlagsNV flags; -} VkAccelerationStructureMotionInfoNV32; - -typedef struct VkAccelerationStructureCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureCreateFlagsKHR createFlags; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkAccelerationStructureTypeKHR type; - VkDeviceAddress DECLSPEC_ALIGN(8) deviceAddress; -} VkAccelerationStructureCreateInfoKHR32; - -typedef struct VkAccelerationStructureCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) compactedSize; - VkAccelerationStructureInfoNV32 info; -} VkAccelerationStructureCreateInfoNV32; - -typedef struct VkDedicatedAllocationBufferCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationBufferCreateInfoNV32; - -typedef struct VkExternalMemoryBufferCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExternalMemoryBufferCreateInfo32; -typedef VkExternalMemoryBufferCreateInfo32 VkExternalMemoryBufferCreateInfoKHR32; - -typedef struct VkBufferOpaqueCaptureAddressCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) opaqueCaptureAddress; -} VkBufferOpaqueCaptureAddressCreateInfo32; -typedef VkBufferOpaqueCaptureAddressCreateInfo32 VkBufferOpaqueCaptureAddressCreateInfoKHR32; - -typedef struct VkBufferDeviceAddressCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceAddress DECLSPEC_ALIGN(8) deviceAddress; -} VkBufferDeviceAddressCreateInfoEXT32; - -typedef struct VkBufferCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkBufferCreateFlags flags; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkBufferUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - PTR32 pQueueFamilyIndices; -} VkBufferCreateInfo32; - -typedef struct VkBufferViewCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkBufferViewCreateFlags flags; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkFormat format; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) range; -} VkBufferViewCreateInfo32; - -typedef struct VkCommandPoolCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkCommandPoolCreateFlags flags; - uint32_t queueFamilyIndex; -} VkCommandPoolCreateInfo32; - -typedef struct VkPipelineCreationFeedback32 -{ - VkPipelineCreationFeedbackFlags flags; - uint64_t DECLSPEC_ALIGN(8) duration; -} VkPipelineCreationFeedback32; -typedef VkPipelineCreationFeedback32 VkPipelineCreationFeedbackEXT32; - -typedef struct VkSpecializationMapEntry32 -{ - uint32_t constantID; - uint32_t offset; - PTR32 size; -} VkSpecializationMapEntry32; - -typedef struct VkSpecializationInfo32 -{ - uint32_t mapEntryCount; - PTR32 pMapEntries; - PTR32 dataSize; - PTR32 pData; -} VkSpecializationInfo32; - -typedef struct VkShaderModuleCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderModuleCreateFlags flags; - PTR32 codeSize; - PTR32 pCode; -} VkShaderModuleCreateInfo32; - -typedef struct VkShaderModuleValidationCacheCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkValidationCacheEXT DECLSPEC_ALIGN(8) validationCache; -} VkShaderModuleValidationCacheCreateInfoEXT32; - -typedef struct VkDebugUtilsObjectNameInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - PTR32 pObjectName; -} VkDebugUtilsObjectNameInfoEXT32; - -typedef struct VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t requiredSubgroupSize; -} VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32; -typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT32; -typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 VkShaderRequiredSubgroupSizeCreateInfoEXT32; - -typedef struct VkPipelineShaderStageModuleIdentifierCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t identifierSize; - PTR32 pIdentifier; -} VkPipelineShaderStageModuleIdentifierCreateInfoEXT32; - -typedef struct VkPipelineRobustnessCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineRobustnessBufferBehaviorEXT storageBuffers; - VkPipelineRobustnessBufferBehaviorEXT uniformBuffers; - VkPipelineRobustnessBufferBehaviorEXT vertexInputs; - VkPipelineRobustnessImageBehaviorEXT images; -} VkPipelineRobustnessCreateInfoEXT32; - -typedef struct VkPipelineShaderStageCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineShaderStageCreateFlags flags; - VkShaderStageFlagBits stage; - VkShaderModule DECLSPEC_ALIGN(8) module; - PTR32 pName; - PTR32 pSpecializationInfo; -} VkPipelineShaderStageCreateInfo32; - -typedef struct VkPipelineCreateFlags2CreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCreateFlags2KHR DECLSPEC_ALIGN(8) flags; -} VkPipelineCreateFlags2CreateInfoKHR32; - -typedef struct VkPipelineCreationFeedbackCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pPipelineCreationFeedback; - uint32_t pipelineStageCreationFeedbackCount; - PTR32 pPipelineStageCreationFeedbacks; -} VkPipelineCreationFeedbackCreateInfo32; -typedef VkPipelineCreationFeedbackCreateInfo32 VkPipelineCreationFeedbackCreateInfoEXT32; - -typedef struct VkSubpassShadingPipelineCreateInfoHUAWEI32 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - uint32_t subpass; -} VkSubpassShadingPipelineCreateInfoHUAWEI32; - -typedef struct VkPipelineCompilerControlCreateInfoAMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCompilerControlFlagsAMD compilerControlFlags; -} VkPipelineCompilerControlCreateInfoAMD32; - -typedef struct VkComputePipelineCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCreateFlags flags; - VkPipelineShaderStageCreateInfo32 DECLSPEC_ALIGN(8) stage; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - VkPipeline DECLSPEC_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkComputePipelineCreateInfo32; - -typedef struct VkCuFunctionCreateInfoNVX32 -{ - VkStructureType sType; - PTR32 pNext; - VkCuModuleNVX DECLSPEC_ALIGN(8) module; - PTR32 pName; -} VkCuFunctionCreateInfoNVX32; - -typedef struct VkCuModuleCreateInfoNVX32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 dataSize; - PTR32 pData; -} VkCuModuleCreateInfoNVX32; - -typedef struct VkCudaFunctionCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkCudaModuleNV DECLSPEC_ALIGN(8) module; - PTR32 pName; -} VkCudaFunctionCreateInfoNV32; - -typedef struct VkCudaModuleCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 dataSize; - PTR32 pData; -} VkCudaModuleCreateInfoNV32; - -typedef struct VkDebugReportCallbackCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDebugReportFlagsEXT flags; - PFN_vkDebugReportCallbackEXT pfnCallback; - PTR32 pUserData; -} VkDebugReportCallbackCreateInfoEXT32; - -typedef struct VkDebugUtilsMessengerCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDebugUtilsMessengerCreateFlagsEXT flags; - VkDebugUtilsMessageSeverityFlagsEXT messageSeverity; - VkDebugUtilsMessageTypeFlagsEXT messageType; - PFN_vkDebugUtilsMessengerCallbackEXT pfnUserCallback; - PTR32 pUserData; -} VkDebugUtilsMessengerCreateInfoEXT32; - -typedef struct VkMutableDescriptorTypeListEXT32 -{ - uint32_t descriptorTypeCount; - PTR32 pDescriptorTypes; -} VkMutableDescriptorTypeListEXT32; -typedef VkMutableDescriptorTypeListEXT32 VkMutableDescriptorTypeListVALVE32; - -typedef struct VkDescriptorPoolInlineUniformBlockCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxInlineUniformBlockBindings; -} VkDescriptorPoolInlineUniformBlockCreateInfo32; -typedef VkDescriptorPoolInlineUniformBlockCreateInfo32 VkDescriptorPoolInlineUniformBlockCreateInfoEXT32; - -typedef struct VkMutableDescriptorTypeCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t mutableDescriptorTypeListCount; - PTR32 pMutableDescriptorTypeLists; -} VkMutableDescriptorTypeCreateInfoEXT32; -typedef VkMutableDescriptorTypeCreateInfoEXT32 VkMutableDescriptorTypeCreateInfoVALVE32; - -typedef struct VkDescriptorPoolCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorPoolCreateFlags flags; - uint32_t maxSets; - uint32_t poolSizeCount; - PTR32 pPoolSizes; -} VkDescriptorPoolCreateInfo32; - -typedef struct VkDescriptorSetLayoutBinding32 -{ - uint32_t binding; - VkDescriptorType descriptorType; - uint32_t descriptorCount; - VkShaderStageFlags stageFlags; - PTR32 pImmutableSamplers; -} VkDescriptorSetLayoutBinding32; - -typedef struct VkDescriptorSetLayoutBindingFlagsCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t bindingCount; - PTR32 pBindingFlags; -} VkDescriptorSetLayoutBindingFlagsCreateInfo32; -typedef VkDescriptorSetLayoutBindingFlagsCreateInfo32 VkDescriptorSetLayoutBindingFlagsCreateInfoEXT32; - -typedef struct VkDescriptorSetLayoutCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorSetLayoutCreateFlags flags; - uint32_t bindingCount; - PTR32 pBindings; -} VkDescriptorSetLayoutCreateInfo32; - -typedef struct VkDescriptorUpdateTemplateEntry32 -{ - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - PTR32 offset; - PTR32 stride; -} VkDescriptorUpdateTemplateEntry32; -typedef VkDescriptorUpdateTemplateEntry32 VkDescriptorUpdateTemplateEntryKHR32; - -typedef struct VkDescriptorUpdateTemplateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorUpdateTemplateCreateFlags flags; - uint32_t descriptorUpdateEntryCount; - PTR32 pDescriptorUpdateEntries; - VkDescriptorUpdateTemplateType templateType; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) descriptorSetLayout; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) pipelineLayout; - uint32_t set; -} VkDescriptorUpdateTemplateCreateInfo32; -typedef VkDescriptorUpdateTemplateCreateInfo32 VkDescriptorUpdateTemplateCreateInfoKHR32; - -typedef struct VkDeviceQueueGlobalPriorityCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkQueueGlobalPriorityKHR globalPriority; -} VkDeviceQueueGlobalPriorityCreateInfoKHR32; -typedef VkDeviceQueueGlobalPriorityCreateInfoKHR32 VkDeviceQueueGlobalPriorityCreateInfoEXT32; - -typedef struct VkDeviceQueueShaderCoreControlCreateInfoARM32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t shaderCoreCount; -} VkDeviceQueueShaderCoreControlCreateInfoARM32; - -typedef struct VkDeviceQueueCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueCount; - PTR32 pQueuePriorities; -} VkDeviceQueueCreateInfo32; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 deviceGeneratedCommands; -} VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 deviceGeneratedCompute; - VkBool32 deviceGeneratedComputePipelines; - VkBool32 deviceGeneratedComputeCaptureReplay; -} VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32; - -typedef struct VkDevicePrivateDataCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t privateDataSlotRequestCount; -} VkDevicePrivateDataCreateInfo32; -typedef VkDevicePrivateDataCreateInfo32 VkDevicePrivateDataCreateInfoEXT32; - -typedef struct VkPhysicalDevicePrivateDataFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 privateData; -} VkPhysicalDevicePrivateDataFeatures32; -typedef VkPhysicalDevicePrivateDataFeatures32 VkPhysicalDevicePrivateDataFeaturesEXT32; - -typedef struct VkPhysicalDeviceFeatures232 -{ - VkStructureType sType; - PTR32 pNext; - VkPhysicalDeviceFeatures features; -} VkPhysicalDeviceFeatures232; -typedef VkPhysicalDeviceFeatures232 VkPhysicalDeviceFeatures2KHR32; - -typedef struct VkPhysicalDeviceVariablePointersFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 variablePointersStorageBuffer; - VkBool32 variablePointers; -} VkPhysicalDeviceVariablePointersFeatures32; -typedef VkPhysicalDeviceVariablePointersFeatures32 VkPhysicalDeviceVariablePointersFeaturesKHR32; -typedef VkPhysicalDeviceVariablePointersFeatures32 VkPhysicalDeviceVariablePointerFeaturesKHR32; -typedef VkPhysicalDeviceVariablePointersFeatures32 VkPhysicalDeviceVariablePointerFeatures32; - -typedef struct VkPhysicalDeviceMultiviewFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 multiview; - VkBool32 multiviewGeometryShader; - VkBool32 multiviewTessellationShader; -} VkPhysicalDeviceMultiviewFeatures32; -typedef VkPhysicalDeviceMultiviewFeatures32 VkPhysicalDeviceMultiviewFeaturesKHR32; - -typedef struct VkDeviceGroupDeviceCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t physicalDeviceCount; - PTR32 pPhysicalDevices; -} VkDeviceGroupDeviceCreateInfo32; -typedef VkDeviceGroupDeviceCreateInfo32 VkDeviceGroupDeviceCreateInfoKHR32; - -typedef struct VkPhysicalDevicePresentIdFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 presentId; -} VkPhysicalDevicePresentIdFeaturesKHR32; - -typedef struct VkPhysicalDevicePresentWaitFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 presentWait; -} VkPhysicalDevicePresentWaitFeaturesKHR32; - -typedef struct VkPhysicalDevice16BitStorageFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 storageBuffer16BitAccess; - VkBool32 uniformAndStorageBuffer16BitAccess; - VkBool32 storagePushConstant16; - VkBool32 storageInputOutput16; -} VkPhysicalDevice16BitStorageFeatures32; -typedef VkPhysicalDevice16BitStorageFeatures32 VkPhysicalDevice16BitStorageFeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderSubgroupExtendedTypes; -} VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32; -typedef VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR32; - -typedef struct VkPhysicalDeviceSamplerYcbcrConversionFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 samplerYcbcrConversion; -} VkPhysicalDeviceSamplerYcbcrConversionFeatures32; -typedef VkPhysicalDeviceSamplerYcbcrConversionFeatures32 VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR32; - -typedef struct VkPhysicalDeviceProtectedMemoryFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 protectedMemory; -} VkPhysicalDeviceProtectedMemoryFeatures32; - -typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 advancedBlendCoherentOperations; -} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32; - -typedef struct VkPhysicalDeviceMultiDrawFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 multiDraw; -} VkPhysicalDeviceMultiDrawFeaturesEXT32; - -typedef struct VkPhysicalDeviceInlineUniformBlockFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 inlineUniformBlock; - VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; -} VkPhysicalDeviceInlineUniformBlockFeatures32; -typedef VkPhysicalDeviceInlineUniformBlockFeatures32 VkPhysicalDeviceInlineUniformBlockFeaturesEXT32; - -typedef struct VkPhysicalDeviceMaintenance4Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 maintenance4; -} VkPhysicalDeviceMaintenance4Features32; -typedef VkPhysicalDeviceMaintenance4Features32 VkPhysicalDeviceMaintenance4FeaturesKHR32; - -typedef struct VkPhysicalDeviceMaintenance5FeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 maintenance5; -} VkPhysicalDeviceMaintenance5FeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderDrawParametersFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderDrawParameters; -} VkPhysicalDeviceShaderDrawParametersFeatures32; -typedef VkPhysicalDeviceShaderDrawParametersFeatures32 VkPhysicalDeviceShaderDrawParameterFeatures32; - -typedef struct VkPhysicalDeviceShaderFloat16Int8Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderFloat16; - VkBool32 shaderInt8; -} VkPhysicalDeviceShaderFloat16Int8Features32; -typedef VkPhysicalDeviceShaderFloat16Int8Features32 VkPhysicalDeviceShaderFloat16Int8FeaturesKHR32; -typedef VkPhysicalDeviceShaderFloat16Int8Features32 VkPhysicalDeviceFloat16Int8FeaturesKHR32; - -typedef struct VkPhysicalDeviceHostQueryResetFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 hostQueryReset; -} VkPhysicalDeviceHostQueryResetFeatures32; -typedef VkPhysicalDeviceHostQueryResetFeatures32 VkPhysicalDeviceHostQueryResetFeaturesEXT32; - -typedef struct VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 globalPriorityQuery; -} VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32; -typedef VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 VkPhysicalDeviceGlobalPriorityQueryFeaturesEXT32; - -typedef struct VkPhysicalDeviceDescriptorIndexingFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderInputAttachmentArrayDynamicIndexing; - VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; - VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; - VkBool32 shaderUniformBufferArrayNonUniformIndexing; - VkBool32 shaderSampledImageArrayNonUniformIndexing; - VkBool32 shaderStorageBufferArrayNonUniformIndexing; - VkBool32 shaderStorageImageArrayNonUniformIndexing; - VkBool32 shaderInputAttachmentArrayNonUniformIndexing; - VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; - VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; - VkBool32 descriptorBindingUniformBufferUpdateAfterBind; - VkBool32 descriptorBindingSampledImageUpdateAfterBind; - VkBool32 descriptorBindingStorageImageUpdateAfterBind; - VkBool32 descriptorBindingStorageBufferUpdateAfterBind; - VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingUpdateUnusedWhilePending; - VkBool32 descriptorBindingPartiallyBound; - VkBool32 descriptorBindingVariableDescriptorCount; - VkBool32 runtimeDescriptorArray; -} VkPhysicalDeviceDescriptorIndexingFeatures32; -typedef VkPhysicalDeviceDescriptorIndexingFeatures32 VkPhysicalDeviceDescriptorIndexingFeaturesEXT32; - -typedef struct VkPhysicalDeviceTimelineSemaphoreFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 timelineSemaphore; -} VkPhysicalDeviceTimelineSemaphoreFeatures32; -typedef VkPhysicalDeviceTimelineSemaphoreFeatures32 VkPhysicalDeviceTimelineSemaphoreFeaturesKHR32; - -typedef struct VkPhysicalDevice8BitStorageFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 storageBuffer8BitAccess; - VkBool32 uniformAndStorageBuffer8BitAccess; - VkBool32 storagePushConstant8; -} VkPhysicalDevice8BitStorageFeatures32; -typedef VkPhysicalDevice8BitStorageFeatures32 VkPhysicalDevice8BitStorageFeaturesKHR32; - -typedef struct VkPhysicalDeviceConditionalRenderingFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 conditionalRendering; - VkBool32 inheritedConditionalRendering; -} VkPhysicalDeviceConditionalRenderingFeaturesEXT32; - -typedef struct VkPhysicalDeviceVulkanMemoryModelFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 vulkanMemoryModel; - VkBool32 vulkanMemoryModelDeviceScope; - VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; -} VkPhysicalDeviceVulkanMemoryModelFeatures32; -typedef VkPhysicalDeviceVulkanMemoryModelFeatures32 VkPhysicalDeviceVulkanMemoryModelFeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderAtomicInt64Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderBufferInt64Atomics; - VkBool32 shaderSharedInt64Atomics; -} VkPhysicalDeviceShaderAtomicInt64Features32; -typedef VkPhysicalDeviceShaderAtomicInt64Features32 VkPhysicalDeviceShaderAtomicInt64FeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderBufferFloat32Atomics; - VkBool32 shaderBufferFloat32AtomicAdd; - VkBool32 shaderBufferFloat64Atomics; - VkBool32 shaderBufferFloat64AtomicAdd; - VkBool32 shaderSharedFloat32Atomics; - VkBool32 shaderSharedFloat32AtomicAdd; - VkBool32 shaderSharedFloat64Atomics; - VkBool32 shaderSharedFloat64AtomicAdd; - VkBool32 shaderImageFloat32Atomics; - VkBool32 shaderImageFloat32AtomicAdd; - VkBool32 sparseImageFloat32Atomics; - VkBool32 sparseImageFloat32AtomicAdd; -} VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderBufferFloat16Atomics; - VkBool32 shaderBufferFloat16AtomicAdd; - VkBool32 shaderBufferFloat16AtomicMinMax; - VkBool32 shaderBufferFloat32AtomicMinMax; - VkBool32 shaderBufferFloat64AtomicMinMax; - VkBool32 shaderSharedFloat16Atomics; - VkBool32 shaderSharedFloat16AtomicAdd; - VkBool32 shaderSharedFloat16AtomicMinMax; - VkBool32 shaderSharedFloat32AtomicMinMax; - VkBool32 shaderSharedFloat64AtomicMinMax; - VkBool32 shaderImageFloat32AtomicMinMax; - VkBool32 sparseImageFloat32AtomicMinMax; -} VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32; - -typedef struct VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 vertexAttributeInstanceRateDivisor; - VkBool32 vertexAttributeInstanceRateZeroDivisor; -} VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32; - -typedef struct VkPhysicalDeviceASTCDecodeFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 decodeModeSharedExponent; -} VkPhysicalDeviceASTCDecodeFeaturesEXT32; - -typedef struct VkPhysicalDeviceTransformFeedbackFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 transformFeedback; - VkBool32 geometryStreams; -} VkPhysicalDeviceTransformFeedbackFeaturesEXT32; - -typedef struct VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 representativeFragmentTest; -} VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32; - -typedef struct VkPhysicalDeviceExclusiveScissorFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 exclusiveScissor; -} VkPhysicalDeviceExclusiveScissorFeaturesNV32; - -typedef struct VkPhysicalDeviceCornerSampledImageFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 cornerSampledImage; -} VkPhysicalDeviceCornerSampledImageFeaturesNV32; - -typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 computeDerivativeGroupQuads; - VkBool32 computeDerivativeGroupLinear; -} VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32; - -typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 imageFootprint; -} VkPhysicalDeviceShaderImageFootprintFeaturesNV32; - -typedef struct VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 dedicatedAllocationImageAliasing; -} VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32; - -typedef struct VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 indirectCopy; -} VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32; - -typedef struct VkPhysicalDeviceMemoryDecompressionFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 memoryDecompression; -} VkPhysicalDeviceMemoryDecompressionFeaturesNV32; - -typedef struct VkPhysicalDeviceShadingRateImageFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shadingRateImage; - VkBool32 shadingRateCoarseSampleOrder; -} VkPhysicalDeviceShadingRateImageFeaturesNV32; - -typedef struct VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 invocationMask; -} VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32; - -typedef struct VkPhysicalDeviceMeshShaderFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 taskShader; - VkBool32 meshShader; -} VkPhysicalDeviceMeshShaderFeaturesNV32; - -typedef struct VkPhysicalDeviceMeshShaderFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 taskShader; - VkBool32 meshShader; - VkBool32 multiviewMeshShader; - VkBool32 primitiveFragmentShadingRateMeshShader; - VkBool32 meshShaderQueries; -} VkPhysicalDeviceMeshShaderFeaturesEXT32; - -typedef struct VkPhysicalDeviceAccelerationStructureFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 accelerationStructure; - VkBool32 accelerationStructureCaptureReplay; - VkBool32 accelerationStructureIndirectBuild; - VkBool32 accelerationStructureHostCommands; - VkBool32 descriptorBindingAccelerationStructureUpdateAfterBind; -} VkPhysicalDeviceAccelerationStructureFeaturesKHR32; - -typedef struct VkPhysicalDeviceRayTracingPipelineFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rayTracingPipeline; - VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplay; - VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - VkBool32 rayTracingPipelineTraceRaysIndirect; - VkBool32 rayTraversalPrimitiveCulling; -} VkPhysicalDeviceRayTracingPipelineFeaturesKHR32; - -typedef struct VkPhysicalDeviceRayQueryFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rayQuery; -} VkPhysicalDeviceRayQueryFeaturesKHR32; - -typedef struct VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rayTracingMaintenance1; - VkBool32 rayTracingPipelineTraceRaysIndirect2; -} VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32; - -typedef struct VkDeviceMemoryOverallocationCreateInfoAMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkMemoryOverallocationBehaviorAMD overallocationBehavior; -} VkDeviceMemoryOverallocationCreateInfoAMD32; - -typedef struct VkPhysicalDeviceFragmentDensityMapFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 fragmentDensityMap; - VkBool32 fragmentDensityMapDynamic; - VkBool32 fragmentDensityMapNonSubsampledImages; -} VkPhysicalDeviceFragmentDensityMapFeaturesEXT32; - -typedef struct VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 fragmentDensityMapDeferred; -} VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32; - -typedef struct VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 fragmentDensityMapOffset; -} VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32; - -typedef struct VkPhysicalDeviceScalarBlockLayoutFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 scalarBlockLayout; -} VkPhysicalDeviceScalarBlockLayoutFeatures32; -typedef VkPhysicalDeviceScalarBlockLayoutFeatures32 VkPhysicalDeviceScalarBlockLayoutFeaturesEXT32; - -typedef struct VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 uniformBufferStandardLayout; -} VkPhysicalDeviceUniformBufferStandardLayoutFeatures32; -typedef VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR32; - -typedef struct VkPhysicalDeviceDepthClipEnableFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 depthClipEnable; -} VkPhysicalDeviceDepthClipEnableFeaturesEXT32; - -typedef struct VkPhysicalDeviceMemoryPriorityFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 memoryPriority; -} VkPhysicalDeviceMemoryPriorityFeaturesEXT32; - -typedef struct VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pageableDeviceLocalMemory; -} VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32; - -typedef struct VkPhysicalDeviceBufferDeviceAddressFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; -} VkPhysicalDeviceBufferDeviceAddressFeatures32; -typedef VkPhysicalDeviceBufferDeviceAddressFeatures32 VkPhysicalDeviceBufferDeviceAddressFeaturesKHR32; - -typedef struct VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; -} VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32; -typedef VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 VkPhysicalDeviceBufferAddressFeaturesEXT32; - -typedef struct VkPhysicalDeviceImagelessFramebufferFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 imagelessFramebuffer; -} VkPhysicalDeviceImagelessFramebufferFeatures32; -typedef VkPhysicalDeviceImagelessFramebufferFeatures32 VkPhysicalDeviceImagelessFramebufferFeaturesKHR32; - -typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 textureCompressionASTC_HDR; -} VkPhysicalDeviceTextureCompressionASTCHDRFeatures32; -typedef VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT32; - -typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 cooperativeMatrix; - VkBool32 cooperativeMatrixRobustBufferAccess; -} VkPhysicalDeviceCooperativeMatrixFeaturesNV32; - -typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 ycbcrImageArrays; -} VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32; - -typedef struct VkPhysicalDevicePresentBarrierFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 presentBarrier; -} VkPhysicalDevicePresentBarrierFeaturesNV32; - -typedef struct VkPhysicalDevicePerformanceQueryFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 performanceCounterQueryPools; - VkBool32 performanceCounterMultipleQueryPools; -} VkPhysicalDevicePerformanceQueryFeaturesKHR32; - -typedef struct VkPerformanceQueryReservationInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxPerformanceQueriesPerPool; -} VkPerformanceQueryReservationInfoKHR32; - -typedef struct VkPhysicalDeviceCoverageReductionModeFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 coverageReductionMode; -} VkPhysicalDeviceCoverageReductionModeFeaturesNV32; - -typedef struct VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderIntegerFunctions2; -} VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32; - -typedef struct VkPhysicalDeviceShaderClockFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderSubgroupClock; - VkBool32 shaderDeviceClock; -} VkPhysicalDeviceShaderClockFeaturesKHR32; - -typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 indexTypeUint8; -} VkPhysicalDeviceIndexTypeUint8FeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderSMBuiltins; -} VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32; - -typedef struct VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 fragmentShaderSampleInterlock; - VkBool32 fragmentShaderPixelInterlock; - VkBool32 fragmentShaderShadingRateInterlock; -} VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32; - -typedef struct VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 separateDepthStencilLayouts; -} VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32; -typedef VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR32; - -typedef struct VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 primitiveTopologyListRestart; - VkBool32 primitiveTopologyPatchListRestart; -} VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32; - -typedef struct VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelineExecutableInfo; -} VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderDemoteToHelperInvocation; -} VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32; -typedef VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT32; - -typedef struct VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 texelBufferAlignment; -} VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32; - -typedef struct VkPhysicalDeviceSubgroupSizeControlFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 subgroupSizeControl; - VkBool32 computeFullSubgroups; -} VkPhysicalDeviceSubgroupSizeControlFeatures32; -typedef VkPhysicalDeviceSubgroupSizeControlFeatures32 VkPhysicalDeviceSubgroupSizeControlFeaturesEXT32; - -typedef struct VkPhysicalDeviceLineRasterizationFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rectangularLines; - VkBool32 bresenhamLines; - VkBool32 smoothLines; - VkBool32 stippledRectangularLines; - VkBool32 stippledBresenhamLines; - VkBool32 stippledSmoothLines; -} VkPhysicalDeviceLineRasterizationFeaturesEXT32; - -typedef struct VkPhysicalDevicePipelineCreationCacheControlFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelineCreationCacheControl; -} VkPhysicalDevicePipelineCreationCacheControlFeatures32; -typedef VkPhysicalDevicePipelineCreationCacheControlFeatures32 VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT32; - -typedef struct VkPhysicalDeviceVulkan11Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 storageBuffer16BitAccess; - VkBool32 uniformAndStorageBuffer16BitAccess; - VkBool32 storagePushConstant16; - VkBool32 storageInputOutput16; - VkBool32 multiview; - VkBool32 multiviewGeometryShader; - VkBool32 multiviewTessellationShader; - VkBool32 variablePointersStorageBuffer; - VkBool32 variablePointers; - VkBool32 protectedMemory; - VkBool32 samplerYcbcrConversion; - VkBool32 shaderDrawParameters; -} VkPhysicalDeviceVulkan11Features32; - -typedef struct VkPhysicalDeviceVulkan12Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 samplerMirrorClampToEdge; - VkBool32 drawIndirectCount; - VkBool32 storageBuffer8BitAccess; - VkBool32 uniformAndStorageBuffer8BitAccess; - VkBool32 storagePushConstant8; - VkBool32 shaderBufferInt64Atomics; - VkBool32 shaderSharedInt64Atomics; - VkBool32 shaderFloat16; - VkBool32 shaderInt8; - VkBool32 descriptorIndexing; - VkBool32 shaderInputAttachmentArrayDynamicIndexing; - VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; - VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; - VkBool32 shaderUniformBufferArrayNonUniformIndexing; - VkBool32 shaderSampledImageArrayNonUniformIndexing; - VkBool32 shaderStorageBufferArrayNonUniformIndexing; - VkBool32 shaderStorageImageArrayNonUniformIndexing; - VkBool32 shaderInputAttachmentArrayNonUniformIndexing; - VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; - VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; - VkBool32 descriptorBindingUniformBufferUpdateAfterBind; - VkBool32 descriptorBindingSampledImageUpdateAfterBind; - VkBool32 descriptorBindingStorageImageUpdateAfterBind; - VkBool32 descriptorBindingStorageBufferUpdateAfterBind; - VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingUpdateUnusedWhilePending; - VkBool32 descriptorBindingPartiallyBound; - VkBool32 descriptorBindingVariableDescriptorCount; - VkBool32 runtimeDescriptorArray; - VkBool32 samplerFilterMinmax; - VkBool32 scalarBlockLayout; - VkBool32 imagelessFramebuffer; - VkBool32 uniformBufferStandardLayout; - VkBool32 shaderSubgroupExtendedTypes; - VkBool32 separateDepthStencilLayouts; - VkBool32 hostQueryReset; - VkBool32 timelineSemaphore; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; - VkBool32 vulkanMemoryModel; - VkBool32 vulkanMemoryModelDeviceScope; - VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; - VkBool32 shaderOutputViewportIndex; - VkBool32 shaderOutputLayer; - VkBool32 subgroupBroadcastDynamicId; -} VkPhysicalDeviceVulkan12Features32; - -typedef struct VkPhysicalDeviceVulkan13Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 robustImageAccess; - VkBool32 inlineUniformBlock; - VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; - VkBool32 pipelineCreationCacheControl; - VkBool32 privateData; - VkBool32 shaderDemoteToHelperInvocation; - VkBool32 shaderTerminateInvocation; - VkBool32 subgroupSizeControl; - VkBool32 computeFullSubgroups; - VkBool32 synchronization2; - VkBool32 textureCompressionASTC_HDR; - VkBool32 shaderZeroInitializeWorkgroupMemory; - VkBool32 dynamicRendering; - VkBool32 shaderIntegerDotProduct; - VkBool32 maintenance4; -} VkPhysicalDeviceVulkan13Features32; - -typedef struct VkPhysicalDeviceCoherentMemoryFeaturesAMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 deviceCoherentMemory; -} VkPhysicalDeviceCoherentMemoryFeaturesAMD32; - -typedef struct VkPhysicalDeviceCustomBorderColorFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 customBorderColors; - VkBool32 customBorderColorWithoutFormat; -} VkPhysicalDeviceCustomBorderColorFeaturesEXT32; - -typedef struct VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 borderColorSwizzle; - VkBool32 borderColorSwizzleFromImage; -} VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32; - -typedef struct VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 extendedDynamicState; -} VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32; - -typedef struct VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 extendedDynamicState2; - VkBool32 extendedDynamicState2LogicOp; - VkBool32 extendedDynamicState2PatchControlPoints; -} VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32; - -typedef struct VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 extendedDynamicState3TessellationDomainOrigin; - VkBool32 extendedDynamicState3DepthClampEnable; - VkBool32 extendedDynamicState3PolygonMode; - VkBool32 extendedDynamicState3RasterizationSamples; - VkBool32 extendedDynamicState3SampleMask; - VkBool32 extendedDynamicState3AlphaToCoverageEnable; - VkBool32 extendedDynamicState3AlphaToOneEnable; - VkBool32 extendedDynamicState3LogicOpEnable; - VkBool32 extendedDynamicState3ColorBlendEnable; - VkBool32 extendedDynamicState3ColorBlendEquation; - VkBool32 extendedDynamicState3ColorWriteMask; - VkBool32 extendedDynamicState3RasterizationStream; - VkBool32 extendedDynamicState3ConservativeRasterizationMode; - VkBool32 extendedDynamicState3ExtraPrimitiveOverestimationSize; - VkBool32 extendedDynamicState3DepthClipEnable; - VkBool32 extendedDynamicState3SampleLocationsEnable; - VkBool32 extendedDynamicState3ColorBlendAdvanced; - VkBool32 extendedDynamicState3ProvokingVertexMode; - VkBool32 extendedDynamicState3LineRasterizationMode; - VkBool32 extendedDynamicState3LineStippleEnable; - VkBool32 extendedDynamicState3DepthClipNegativeOneToOne; - VkBool32 extendedDynamicState3ViewportWScalingEnable; - VkBool32 extendedDynamicState3ViewportSwizzle; - VkBool32 extendedDynamicState3CoverageToColorEnable; - VkBool32 extendedDynamicState3CoverageToColorLocation; - VkBool32 extendedDynamicState3CoverageModulationMode; - VkBool32 extendedDynamicState3CoverageModulationTableEnable; - VkBool32 extendedDynamicState3CoverageModulationTable; - VkBool32 extendedDynamicState3CoverageReductionMode; - VkBool32 extendedDynamicState3RepresentativeFragmentTestEnable; - VkBool32 extendedDynamicState3ShadingRateImageEnable; -} VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32; - -typedef struct VkPhysicalDeviceDiagnosticsConfigFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 diagnosticsConfig; -} VkPhysicalDeviceDiagnosticsConfigFeaturesNV32; - -typedef struct VkDeviceDiagnosticsConfigCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceDiagnosticsConfigFlagsNV flags; -} VkDeviceDiagnosticsConfigCreateInfoNV32; - -typedef struct VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderZeroInitializeWorkgroupMemory; -} VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32; -typedef VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderSubgroupUniformControlFlow; -} VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32; - -typedef struct VkPhysicalDeviceRobustness2FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 robustBufferAccess2; - VkBool32 robustImageAccess2; - VkBool32 nullDescriptor; -} VkPhysicalDeviceRobustness2FeaturesEXT32; - -typedef struct VkPhysicalDeviceImageRobustnessFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 robustImageAccess; -} VkPhysicalDeviceImageRobustnessFeatures32; -typedef VkPhysicalDeviceImageRobustnessFeatures32 VkPhysicalDeviceImageRobustnessFeaturesEXT32; - -typedef struct VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 workgroupMemoryExplicitLayout; - VkBool32 workgroupMemoryExplicitLayoutScalarBlockLayout; - VkBool32 workgroupMemoryExplicitLayout8BitAccess; - VkBool32 workgroupMemoryExplicitLayout16BitAccess; -} VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32; - -typedef struct VkPhysicalDevice4444FormatsFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 formatA4R4G4B4; - VkBool32 formatA4B4G4R4; -} VkPhysicalDevice4444FormatsFeaturesEXT32; - -typedef struct VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 subpassShading; -} VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32; - -typedef struct VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 clustercullingShader; - VkBool32 multiviewClusterCullingShader; -} VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32; - -typedef struct VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderImageInt64Atomics; - VkBool32 sparseImageInt64Atomics; -} VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32; - -typedef struct VkPhysicalDeviceFragmentShadingRateFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelineFragmentShadingRate; - VkBool32 primitiveFragmentShadingRate; - VkBool32 attachmentFragmentShadingRate; -} VkPhysicalDeviceFragmentShadingRateFeaturesKHR32; - -typedef struct VkPhysicalDeviceShaderTerminateInvocationFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderTerminateInvocation; -} VkPhysicalDeviceShaderTerminateInvocationFeatures32; -typedef VkPhysicalDeviceShaderTerminateInvocationFeatures32 VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR32; - -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 fragmentShadingRateEnums; - VkBool32 supersampleFragmentShadingRates; - VkBool32 noInvocationFragmentShadingRates; -} VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32; - -typedef struct VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 image2DViewOf3D; - VkBool32 sampler2DViewOf3D; -} VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32; - -typedef struct VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 imageSlicedViewOf3D; -} VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32; - -typedef struct VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 attachmentFeedbackLoopDynamicState; -} VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32; - -typedef struct VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 mutableDescriptorType; -} VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32; -typedef VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE32; - -typedef struct VkPhysicalDeviceDepthClipControlFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 depthClipControl; -} VkPhysicalDeviceDepthClipControlFeaturesEXT32; - -typedef struct VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 vertexInputDynamicState; -} VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32; - -typedef struct VkPhysicalDeviceColorWriteEnableFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 colorWriteEnable; -} VkPhysicalDeviceColorWriteEnableFeaturesEXT32; - -typedef struct VkPhysicalDeviceSynchronization2Features32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 synchronization2; -} VkPhysicalDeviceSynchronization2Features32; -typedef VkPhysicalDeviceSynchronization2Features32 VkPhysicalDeviceSynchronization2FeaturesKHR32; - -typedef struct VkPhysicalDeviceHostImageCopyFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 hostImageCopy; -} VkPhysicalDeviceHostImageCopyFeaturesEXT32; - -typedef struct VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 primitivesGeneratedQuery; - VkBool32 primitivesGeneratedQueryWithRasterizerDiscard; - VkBool32 primitivesGeneratedQueryWithNonZeroStreams; -} VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32; - -typedef struct VkPhysicalDeviceLegacyDitheringFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 legacyDithering; -} VkPhysicalDeviceLegacyDitheringFeaturesEXT32; - -typedef struct VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 multisampledRenderToSingleSampled; -} VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32; - -typedef struct VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelineProtectedAccess; -} VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32; - -typedef struct VkPhysicalDeviceInheritedViewportScissorFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 inheritedViewportScissor2D; -} VkPhysicalDeviceInheritedViewportScissorFeaturesNV32; - -typedef struct VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 ycbcr2plane444Formats; -} VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32; - -typedef struct VkPhysicalDeviceProvokingVertexFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 provokingVertexLast; - VkBool32 transformFeedbackPreservesProvokingVertex; -} VkPhysicalDeviceProvokingVertexFeaturesEXT32; - -typedef struct VkPhysicalDeviceDescriptorBufferFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 descriptorBuffer; - VkBool32 descriptorBufferCaptureReplay; - VkBool32 descriptorBufferImageLayoutIgnored; - VkBool32 descriptorBufferPushDescriptors; -} VkPhysicalDeviceDescriptorBufferFeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderIntegerDotProductFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderIntegerDotProduct; -} VkPhysicalDeviceShaderIntegerDotProductFeatures32; -typedef VkPhysicalDeviceShaderIntegerDotProductFeatures32 VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR32; - -typedef struct VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 fragmentShaderBarycentric; -} VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32; -typedef VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV32; - -typedef struct VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rayTracingMotionBlur; - VkBool32 rayTracingMotionBlurPipelineTraceRaysIndirect; -} VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32; - -typedef struct VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 formatRgba10x6WithoutYCbCrSampler; -} VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32; - -typedef struct VkPhysicalDeviceDynamicRenderingFeatures32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 dynamicRendering; -} VkPhysicalDeviceDynamicRenderingFeatures32; -typedef VkPhysicalDeviceDynamicRenderingFeatures32 VkPhysicalDeviceDynamicRenderingFeaturesKHR32; - -typedef struct VkPhysicalDeviceImageViewMinLodFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 minLod; -} VkPhysicalDeviceImageViewMinLodFeaturesEXT32; - -typedef struct VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rasterizationOrderColorAttachmentAccess; - VkBool32 rasterizationOrderDepthAttachmentAccess; - VkBool32 rasterizationOrderStencilAttachmentAccess; -} VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32; -typedef VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM32; - -typedef struct VkPhysicalDeviceLinearColorAttachmentFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 linearColorAttachment; -} VkPhysicalDeviceLinearColorAttachmentFeaturesNV32; - -typedef struct VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 graphicsPipelineLibrary; -} VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32; - -typedef struct VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 descriptorSetHostMapping; -} VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32; - -typedef struct VkPhysicalDeviceNestedCommandBufferFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 nestedCommandBuffer; - VkBool32 nestedCommandBufferRendering; - VkBool32 nestedCommandBufferSimultaneousUse; -} VkPhysicalDeviceNestedCommandBufferFeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderModuleIdentifier; -} VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32; - -typedef struct VkPhysicalDeviceImageCompressionControlFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 imageCompressionControl; -} VkPhysicalDeviceImageCompressionControlFeaturesEXT32; - -typedef struct VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 imageCompressionControlSwapchain; -} VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32; - -typedef struct VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 subpassMergeFeedback; -} VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32; - -typedef struct VkPhysicalDeviceOpacityMicromapFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 micromap; - VkBool32 micromapCaptureReplay; - VkBool32 micromapHostCommands; -} VkPhysicalDeviceOpacityMicromapFeaturesEXT32; - -typedef struct VkPhysicalDevicePipelinePropertiesFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelinePropertiesIdentifier; -} VkPhysicalDevicePipelinePropertiesFeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderEarlyAndLateFragmentTests; -} VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32; - -typedef struct VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 nonSeamlessCubeMap; -} VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32; - -typedef struct VkPhysicalDevicePipelineRobustnessFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelineRobustness; -} VkPhysicalDevicePipelineRobustnessFeaturesEXT32; - -typedef struct VkPhysicalDeviceImageProcessingFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 textureSampleWeighted; - VkBool32 textureBoxFilter; - VkBool32 textureBlockMatch; -} VkPhysicalDeviceImageProcessingFeaturesQCOM32; - -typedef struct VkPhysicalDeviceTilePropertiesFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 tileProperties; -} VkPhysicalDeviceTilePropertiesFeaturesQCOM32; - -typedef struct VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 attachmentFeedbackLoopLayout; -} VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32; - -typedef struct VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 depthClampZeroOne; -} VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32; - -typedef struct VkPhysicalDeviceAddressBindingReportFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 reportAddressBinding; -} VkPhysicalDeviceAddressBindingReportFeaturesEXT32; - -typedef struct VkPhysicalDeviceOpticalFlowFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 opticalFlow; -} VkPhysicalDeviceOpticalFlowFeaturesNV32; - -typedef struct VkPhysicalDeviceFaultFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 deviceFault; - VkBool32 deviceFaultVendorBinary; -} VkPhysicalDeviceFaultFeaturesEXT32; - -typedef struct VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 pipelineLibraryGroupHandles; -} VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderCoreBuiltins; -} VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32; - -typedef struct VkPhysicalDeviceFrameBoundaryFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 frameBoundary; -} VkPhysicalDeviceFrameBoundaryFeaturesEXT32; - -typedef struct VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 dynamicRenderingUnusedAttachments; -} VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32; - -typedef struct VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 swapchainMaintenance1; -} VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32; - -typedef struct VkPhysicalDeviceDepthBiasControlFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 depthBiasControl; - VkBool32 leastRepresentableValueForceUnormRepresentation; - VkBool32 floatRepresentation; - VkBool32 depthBiasExact; -} VkPhysicalDeviceDepthBiasControlFeaturesEXT32; - -typedef struct VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rayTracingInvocationReorder; -} VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32; - -typedef struct VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 extendedSparseAddressSpace; -} VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32; - -typedef struct VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 multiviewPerViewViewports; -} VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32; - -typedef struct VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 rayTracingPositionFetch; -} VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32; - -typedef struct VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 multiviewPerViewRenderAreas; -} VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32; - -typedef struct VkPhysicalDeviceShaderObjectFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderObject; -} VkPhysicalDeviceShaderObjectFeaturesEXT32; - -typedef struct VkPhysicalDeviceShaderTileImageFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderTileImageColorReadAccess; - VkBool32 shaderTileImageDepthReadAccess; - VkBool32 shaderTileImageStencilReadAccess; -} VkPhysicalDeviceShaderTileImageFeaturesEXT32; - -typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 cooperativeMatrix; - VkBool32 cooperativeMatrixRobustBufferAccess; -} VkPhysicalDeviceCooperativeMatrixFeaturesKHR32; - -typedef struct VkPhysicalDeviceCubicClampFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 cubicRangeClamp; -} VkPhysicalDeviceCubicClampFeaturesQCOM32; - -typedef struct VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 ycbcrDegamma; -} VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32; - -typedef struct VkPhysicalDeviceCubicWeightsFeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 selectableCubicWeights; -} VkPhysicalDeviceCubicWeightsFeaturesQCOM32; - -typedef struct VkPhysicalDeviceImageProcessing2FeaturesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 textureBlockMatch2; -} VkPhysicalDeviceImageProcessing2FeaturesQCOM32; - -typedef struct VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 descriptorPoolOverallocation; -} VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32; - -typedef struct VkPhysicalDeviceCudaKernelLaunchFeaturesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 cudaKernelLaunchFeatures; -} VkPhysicalDeviceCudaKernelLaunchFeaturesNV32; - -typedef struct VkPhysicalDeviceSchedulingControlsFeaturesARM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 schedulingControls; -} VkPhysicalDeviceSchedulingControlsFeaturesARM32; - -typedef struct VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 relaxedLineRasterization; -} VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32; - -typedef struct VkDeviceCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceCreateFlags flags; - uint32_t queueCreateInfoCount; - PTR32 pQueueCreateInfos; - uint32_t enabledLayerCount; - PTR32 ppEnabledLayerNames; - uint32_t enabledExtensionCount; - PTR32 ppEnabledExtensionNames; - PTR32 pEnabledFeatures; -} VkDeviceCreateInfo32; - -typedef struct VkEventCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkEventCreateFlags flags; -} VkEventCreateInfo32; - -typedef struct VkExportFenceCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalFenceHandleTypeFlags handleTypes; -} VkExportFenceCreateInfo32; -typedef VkExportFenceCreateInfo32 VkExportFenceCreateInfoKHR32; - -typedef struct VkFenceCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkFenceCreateFlags flags; -} VkFenceCreateInfo32; - -typedef struct VkFramebufferAttachmentImageInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageCreateFlags flags; - VkImageUsageFlags usage; - uint32_t width; - uint32_t height; - uint32_t layerCount; - uint32_t viewFormatCount; - PTR32 pViewFormats; -} VkFramebufferAttachmentImageInfo32; -typedef VkFramebufferAttachmentImageInfo32 VkFramebufferAttachmentImageInfoKHR32; - -typedef struct VkFramebufferAttachmentsCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t attachmentImageInfoCount; - PTR32 pAttachmentImageInfos; -} VkFramebufferAttachmentsCreateInfo32; -typedef VkFramebufferAttachmentsCreateInfo32 VkFramebufferAttachmentsCreateInfoKHR32; - -typedef struct VkFramebufferCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkFramebufferCreateFlags flags; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - uint32_t attachmentCount; - PTR32 pAttachments; - uint32_t width; - uint32_t height; - uint32_t layers; -} VkFramebufferCreateInfo32; - -typedef struct VkPipelineVertexInputDivisorStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t vertexBindingDivisorCount; - PTR32 pVertexBindingDivisors; -} VkPipelineVertexInputDivisorStateCreateInfoEXT32; - -typedef struct VkPipelineVertexInputStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineVertexInputStateCreateFlags flags; - uint32_t vertexBindingDescriptionCount; - PTR32 pVertexBindingDescriptions; - uint32_t vertexAttributeDescriptionCount; - PTR32 pVertexAttributeDescriptions; -} VkPipelineVertexInputStateCreateInfo32; - -typedef struct VkPipelineTessellationDomainOriginStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkTessellationDomainOrigin domainOrigin; -} VkPipelineTessellationDomainOriginStateCreateInfo32; -typedef VkPipelineTessellationDomainOriginStateCreateInfo32 VkPipelineTessellationDomainOriginStateCreateInfoKHR32; - -typedef struct VkPipelineTessellationStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineTessellationStateCreateFlags flags; - uint32_t patchControlPoints; -} VkPipelineTessellationStateCreateInfo32; - -typedef struct VkGraphicsShaderGroupCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t stageCount; - PTR32 pStages; - PTR32 pVertexInputState; - PTR32 pTessellationState; -} VkGraphicsShaderGroupCreateInfoNV32; - -typedef struct VkPipelineInputAssemblyStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineInputAssemblyStateCreateFlags flags; - VkPrimitiveTopology topology; - VkBool32 primitiveRestartEnable; -} VkPipelineInputAssemblyStateCreateInfo32; - -typedef struct VkPipelineViewportWScalingStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 viewportWScalingEnable; - uint32_t viewportCount; - PTR32 pViewportWScalings; -} VkPipelineViewportWScalingStateCreateInfoNV32; - -typedef struct VkPipelineViewportSwizzleStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineViewportSwizzleStateCreateFlagsNV flags; - uint32_t viewportCount; - PTR32 pViewportSwizzles; -} VkPipelineViewportSwizzleStateCreateInfoNV32; - -typedef struct VkPipelineViewportExclusiveScissorStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t exclusiveScissorCount; - PTR32 pExclusiveScissors; -} VkPipelineViewportExclusiveScissorStateCreateInfoNV32; - -typedef struct VkPipelineViewportShadingRateImageStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shadingRateImageEnable; - uint32_t viewportCount; - PTR32 pShadingRatePalettes; -} VkPipelineViewportShadingRateImageStateCreateInfoNV32; - -typedef struct VkPipelineViewportCoarseSampleOrderStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkCoarseSampleOrderTypeNV sampleOrderType; - uint32_t customSampleOrderCount; - PTR32 pCustomSampleOrders; -} VkPipelineViewportCoarseSampleOrderStateCreateInfoNV32; - -typedef struct VkPipelineViewportDepthClipControlCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 negativeOneToOne; -} VkPipelineViewportDepthClipControlCreateInfoEXT32; - -typedef struct VkPipelineViewportStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineViewportStateCreateFlags flags; - uint32_t viewportCount; - PTR32 pViewports; - uint32_t scissorCount; - PTR32 pScissors; -} VkPipelineViewportStateCreateInfo32; - -typedef struct VkPipelineRasterizationStateRasterizationOrderAMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkRasterizationOrderAMD rasterizationOrder; -} VkPipelineRasterizationStateRasterizationOrderAMD32; - -typedef struct VkPipelineRasterizationConservativeStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineRasterizationConservativeStateCreateFlagsEXT flags; - VkConservativeRasterizationModeEXT conservativeRasterizationMode; - float extraPrimitiveOverestimationSize; -} VkPipelineRasterizationConservativeStateCreateInfoEXT32; - -typedef struct VkPipelineRasterizationStateStreamCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineRasterizationStateStreamCreateFlagsEXT flags; - uint32_t rasterizationStream; -} VkPipelineRasterizationStateStreamCreateInfoEXT32; - -typedef struct VkPipelineRasterizationDepthClipStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineRasterizationDepthClipStateCreateFlagsEXT flags; - VkBool32 depthClipEnable; -} VkPipelineRasterizationDepthClipStateCreateInfoEXT32; - -typedef struct VkPipelineRasterizationLineStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkLineRasterizationModeEXT lineRasterizationMode; - VkBool32 stippledLineEnable; - uint32_t lineStippleFactor; - uint16_t lineStipplePattern; -} VkPipelineRasterizationLineStateCreateInfoEXT32; - -typedef struct VkPipelineRasterizationProvokingVertexStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkProvokingVertexModeEXT provokingVertexMode; -} VkPipelineRasterizationProvokingVertexStateCreateInfoEXT32; - -typedef struct VkPipelineRasterizationStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineRasterizationStateCreateFlags flags; - VkBool32 depthClampEnable; - VkBool32 rasterizerDiscardEnable; - VkPolygonMode polygonMode; - VkCullModeFlags cullMode; - VkFrontFace frontFace; - VkBool32 depthBiasEnable; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; - float lineWidth; -} VkPipelineRasterizationStateCreateInfo32; - -typedef struct VkPipelineCoverageToColorStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCoverageToColorStateCreateFlagsNV flags; - VkBool32 coverageToColorEnable; - uint32_t coverageToColorLocation; -} VkPipelineCoverageToColorStateCreateInfoNV32; - -typedef struct VkPipelineSampleLocationsStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 sampleLocationsEnable; - VkSampleLocationsInfoEXT32 sampleLocationsInfo; -} VkPipelineSampleLocationsStateCreateInfoEXT32; - -typedef struct VkPipelineCoverageModulationStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCoverageModulationStateCreateFlagsNV flags; - VkCoverageModulationModeNV coverageModulationMode; - VkBool32 coverageModulationTableEnable; - uint32_t coverageModulationTableCount; - PTR32 pCoverageModulationTable; -} VkPipelineCoverageModulationStateCreateInfoNV32; - -typedef struct VkPipelineCoverageReductionStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCoverageReductionStateCreateFlagsNV flags; - VkCoverageReductionModeNV coverageReductionMode; -} VkPipelineCoverageReductionStateCreateInfoNV32; - -typedef struct VkPipelineMultisampleStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineMultisampleStateCreateFlags flags; - VkSampleCountFlagBits rasterizationSamples; - VkBool32 sampleShadingEnable; - float minSampleShading; - PTR32 pSampleMask; - VkBool32 alphaToCoverageEnable; - VkBool32 alphaToOneEnable; -} VkPipelineMultisampleStateCreateInfo32; - -typedef struct VkPipelineDepthStencilStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineDepthStencilStateCreateFlags flags; - VkBool32 depthTestEnable; - VkBool32 depthWriteEnable; - VkCompareOp depthCompareOp; - VkBool32 depthBoundsTestEnable; - VkBool32 stencilTestEnable; - VkStencilOpState front; - VkStencilOpState back; - float minDepthBounds; - float maxDepthBounds; -} VkPipelineDepthStencilStateCreateInfo32; - -typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 srcPremultiplied; - VkBool32 dstPremultiplied; - VkBlendOverlapEXT blendOverlap; -} VkPipelineColorBlendAdvancedStateCreateInfoEXT32; - -typedef struct VkPipelineColorWriteCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t attachmentCount; - PTR32 pColorWriteEnables; -} VkPipelineColorWriteCreateInfoEXT32; - -typedef struct VkPipelineColorBlendStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineColorBlendStateCreateFlags flags; - VkBool32 logicOpEnable; - VkLogicOp logicOp; - uint32_t attachmentCount; - PTR32 pAttachments; - float blendConstants[4]; -} VkPipelineColorBlendStateCreateInfo32; - -typedef struct VkPipelineDynamicStateCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineDynamicStateCreateFlags flags; - uint32_t dynamicStateCount; - PTR32 pDynamicStates; -} VkPipelineDynamicStateCreateInfo32; - -typedef struct VkGraphicsPipelineShaderGroupsCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t groupCount; - PTR32 pGroups; - uint32_t pipelineCount; - PTR32 pPipelines; -} VkGraphicsPipelineShaderGroupsCreateInfoNV32; - -typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineDiscardRectangleStateCreateFlagsEXT flags; - VkDiscardRectangleModeEXT discardRectangleMode; - uint32_t discardRectangleCount; - PTR32 pDiscardRectangles; -} VkPipelineDiscardRectangleStateCreateInfoEXT32; - -typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 representativeFragmentTestEnable; -} VkPipelineRepresentativeFragmentTestStateCreateInfoNV32; - -typedef struct VkPipelineLibraryCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t libraryCount; - PTR32 pLibraries; -} VkPipelineLibraryCreateInfoKHR32; - -typedef struct VkPipelineFragmentShadingRateStateCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D fragmentSize; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateStateCreateInfoKHR32; - -typedef struct VkPipelineFragmentShadingRateEnumStateCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkFragmentShadingRateTypeNV shadingRateType; - VkFragmentShadingRateNV shadingRate; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateEnumStateCreateInfoNV32; - -typedef struct VkPipelineRenderingCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t viewMask; - uint32_t colorAttachmentCount; - PTR32 pColorAttachmentFormats; - VkFormat depthAttachmentFormat; - VkFormat stencilAttachmentFormat; -} VkPipelineRenderingCreateInfo32; -typedef VkPipelineRenderingCreateInfo32 VkPipelineRenderingCreateInfoKHR32; - -typedef struct VkGraphicsPipelineLibraryCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkGraphicsPipelineLibraryFlagsEXT flags; -} VkGraphicsPipelineLibraryCreateInfoEXT32; - -typedef struct VkGraphicsPipelineCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - PTR32 pStages; - PTR32 pVertexInputState; - PTR32 pInputAssemblyState; - PTR32 pTessellationState; - PTR32 pViewportState; - PTR32 pRasterizationState; - PTR32 pMultisampleState; - PTR32 pDepthStencilState; - PTR32 pColorBlendState; - PTR32 pDynamicState; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - uint32_t subpass; - VkPipeline DECLSPEC_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkGraphicsPipelineCreateInfo32; - -typedef struct VkDedicatedAllocationImageCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationImageCreateInfoNV32; - -typedef struct VkExternalMemoryImageCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExternalMemoryImageCreateInfo32; -typedef VkExternalMemoryImageCreateInfo32 VkExternalMemoryImageCreateInfoKHR32; - -typedef struct VkImageSwapchainCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; -} VkImageSwapchainCreateInfoKHR32; - -typedef struct VkImageFormatListCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t viewFormatCount; - PTR32 pViewFormats; -} VkImageFormatListCreateInfo32; -typedef VkImageFormatListCreateInfo32 VkImageFormatListCreateInfoKHR32; - -typedef struct VkImageStencilUsageCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageUsageFlags stencilUsage; -} VkImageStencilUsageCreateInfo32; -typedef VkImageStencilUsageCreateInfo32 VkImageStencilUsageCreateInfoEXT32; - -typedef struct VkImageCompressionControlEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageCompressionFlagsEXT flags; - uint32_t compressionControlPlaneCount; - PTR32 pFixedRateFlags; -} VkImageCompressionControlEXT32; - -typedef struct VkOpticalFlowImageFormatInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkOpticalFlowUsageFlagsNV usage; -} VkOpticalFlowImageFormatInfoNV32; - -typedef struct VkImageCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageCreateFlags flags; - VkImageType imageType; - VkFormat format; - VkExtent3D extent; - uint32_t mipLevels; - uint32_t arrayLayers; - VkSampleCountFlagBits samples; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - PTR32 pQueueFamilyIndices; - VkImageLayout initialLayout; -} VkImageCreateInfo32; - -typedef struct VkImageViewUsageCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageUsageFlags usage; -} VkImageViewUsageCreateInfo32; -typedef VkImageViewUsageCreateInfo32 VkImageViewUsageCreateInfoKHR32; - -typedef struct VkImageViewSlicedCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t sliceOffset; - uint32_t sliceCount; -} VkImageViewSlicedCreateInfoEXT32; - -typedef struct VkSamplerYcbcrConversionInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSamplerYcbcrConversion DECLSPEC_ALIGN(8) conversion; -} VkSamplerYcbcrConversionInfo32; -typedef VkSamplerYcbcrConversionInfo32 VkSamplerYcbcrConversionInfoKHR32; - -typedef struct VkImageViewASTCDecodeModeEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkFormat decodeMode; -} VkImageViewASTCDecodeModeEXT32; - -typedef struct VkImageViewMinLodCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - float minLod; -} VkImageViewMinLodCreateInfoEXT32; - -typedef struct VkImageViewSampleWeightCreateInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkOffset2D filterCenter; - VkExtent2D filterSize; - uint32_t numPhases; -} VkImageViewSampleWeightCreateInfoQCOM32; - -typedef struct VkImageViewCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageViewCreateFlags flags; - VkImage DECLSPEC_ALIGN(8) image; - VkImageViewType viewType; - VkFormat format; - VkComponentMapping components; - VkImageSubresourceRange subresourceRange; -} VkImageViewCreateInfo32; - -typedef struct VkIndirectCommandsLayoutTokenNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkIndirectCommandsTokenTypeNV tokenType; - uint32_t stream; - uint32_t offset; - uint32_t vertexBindingUnit; - VkBool32 vertexDynamicStride; - VkPipelineLayout DECLSPEC_ALIGN(8) pushconstantPipelineLayout; - VkShaderStageFlags pushconstantShaderStageFlags; - uint32_t pushconstantOffset; - uint32_t pushconstantSize; - VkIndirectStateFlagsNV indirectStateFlags; - uint32_t indexTypeCount; - PTR32 pIndexTypes; - PTR32 pIndexTypeValues; -} VkIndirectCommandsLayoutTokenNV32; - -typedef struct VkIndirectCommandsLayoutCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkIndirectCommandsLayoutUsageFlagsNV flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t tokenCount; - PTR32 pTokens; - uint32_t streamCount; - PTR32 pStreamStrides; -} VkIndirectCommandsLayoutCreateInfoNV32; - -typedef struct VkLayerSettingEXT32 -{ - PTR32 pLayerName; - PTR32 pSettingName; - VkLayerSettingTypeEXT type; - uint32_t valueCount; - PTR32 pValues; -} VkLayerSettingEXT32; - -typedef struct VkApplicationInfo32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pApplicationName; - uint32_t applicationVersion; - PTR32 pEngineName; - uint32_t engineVersion; - uint32_t apiVersion; -} VkApplicationInfo32; - -typedef struct VkValidationFlagsEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t disabledValidationCheckCount; - PTR32 pDisabledValidationChecks; -} VkValidationFlagsEXT32; - -typedef struct VkValidationFeaturesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t enabledValidationFeatureCount; - PTR32 pEnabledValidationFeatures; - uint32_t disabledValidationFeatureCount; - PTR32 pDisabledValidationFeatures; -} VkValidationFeaturesEXT32; - -typedef struct VkLayerSettingsCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t settingCount; - PTR32 pSettings; -} VkLayerSettingsCreateInfoEXT32; - -typedef struct VkInstanceCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkInstanceCreateFlags flags; - PTR32 pApplicationInfo; - uint32_t enabledLayerCount; - PTR32 ppEnabledLayerNames; - uint32_t enabledExtensionCount; - PTR32 ppEnabledExtensionNames; -} VkInstanceCreateInfo32; - -typedef struct VkMicromapCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkMicromapCreateFlagsEXT createFlags; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkMicromapTypeEXT type; - VkDeviceAddress DECLSPEC_ALIGN(8) deviceAddress; -} VkMicromapCreateInfoEXT32; - -typedef struct VkOpticalFlowSessionCreatePrivateDataInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t id; - uint32_t size; - PTR32 pPrivateData; -} VkOpticalFlowSessionCreatePrivateDataInfoNV32; - -typedef struct VkOpticalFlowSessionCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t width; - uint32_t height; - VkFormat imageFormat; - VkFormat flowVectorFormat; - VkFormat costFormat; - VkOpticalFlowGridSizeFlagsNV outputGridSize; - VkOpticalFlowGridSizeFlagsNV hintGridSize; - VkOpticalFlowPerformanceLevelNV performanceLevel; - VkOpticalFlowSessionCreateFlagsNV flags; -} VkOpticalFlowSessionCreateInfoNV32; - -typedef struct VkPipelineCacheCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCacheCreateFlags flags; - PTR32 initialDataSize; - PTR32 pInitialData; -} VkPipelineCacheCreateInfo32; - -typedef struct VkPipelineLayoutCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineLayoutCreateFlags flags; - uint32_t setLayoutCount; - PTR32 pSetLayouts; - uint32_t pushConstantRangeCount; - PTR32 pPushConstantRanges; -} VkPipelineLayoutCreateInfo32; - -typedef struct VkPrivateDataSlotCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkPrivateDataSlotCreateFlags flags; -} VkPrivateDataSlotCreateInfo32; -typedef VkPrivateDataSlotCreateInfo32 VkPrivateDataSlotCreateInfoEXT32; - -typedef struct VkQueryPoolPerformanceCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t queueFamilyIndex; - uint32_t counterIndexCount; - PTR32 pCounterIndices; -} VkQueryPoolPerformanceCreateInfoKHR32; - -typedef struct VkQueryPoolPerformanceQueryCreateInfoINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - VkQueryPoolSamplingModeINTEL performanceCountersSampling; -} VkQueryPoolPerformanceQueryCreateInfoINTEL32; -typedef VkQueryPoolPerformanceQueryCreateInfoINTEL32 VkQueryPoolCreateInfoINTEL32; - -typedef struct VkQueryPoolCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkQueryPoolCreateFlags flags; - VkQueryType queryType; - uint32_t queryCount; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkQueryPoolCreateInfo32; - -typedef struct VkRayTracingShaderGroupCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkRayTracingShaderGroupTypeKHR type; - uint32_t generalShader; - uint32_t closestHitShader; - uint32_t anyHitShader; - uint32_t intersectionShader; - PTR32 pShaderGroupCaptureReplayHandle; -} VkRayTracingShaderGroupCreateInfoKHR32; - -typedef struct VkRayTracingPipelineInterfaceCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxPipelineRayPayloadSize; - uint32_t maxPipelineRayHitAttributeSize; -} VkRayTracingPipelineInterfaceCreateInfoKHR32; - -typedef struct VkRayTracingPipelineCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - PTR32 pStages; - uint32_t groupCount; - PTR32 pGroups; - uint32_t maxPipelineRayRecursionDepth; - PTR32 pLibraryInfo; - PTR32 pLibraryInterface; - PTR32 pDynamicState; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - VkPipeline DECLSPEC_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkRayTracingPipelineCreateInfoKHR32; - -typedef struct VkRayTracingShaderGroupCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkRayTracingShaderGroupTypeKHR type; - uint32_t generalShader; - uint32_t closestHitShader; - uint32_t anyHitShader; - uint32_t intersectionShader; -} VkRayTracingShaderGroupCreateInfoNV32; - -typedef struct VkRayTracingPipelineCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - PTR32 pStages; - uint32_t groupCount; - PTR32 pGroups; - uint32_t maxRecursionDepth; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - VkPipeline DECLSPEC_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkRayTracingPipelineCreateInfoNV32; - -typedef struct VkSubpassDescription32 -{ - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t inputAttachmentCount; - PTR32 pInputAttachments; - uint32_t colorAttachmentCount; - PTR32 pColorAttachments; - PTR32 pResolveAttachments; - PTR32 pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - PTR32 pPreserveAttachments; -} VkSubpassDescription32; - -typedef struct VkRenderPassMultiviewCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t subpassCount; - PTR32 pViewMasks; - uint32_t dependencyCount; - PTR32 pViewOffsets; - uint32_t correlationMaskCount; - PTR32 pCorrelationMasks; -} VkRenderPassMultiviewCreateInfo32; -typedef VkRenderPassMultiviewCreateInfo32 VkRenderPassMultiviewCreateInfoKHR32; - -typedef struct VkRenderPassInputAttachmentAspectCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t aspectReferenceCount; - PTR32 pAspectReferences; -} VkRenderPassInputAttachmentAspectCreateInfo32; -typedef VkRenderPassInputAttachmentAspectCreateInfo32 VkRenderPassInputAttachmentAspectCreateInfoKHR32; - -typedef struct VkRenderPassFragmentDensityMapCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkAttachmentReference fragmentDensityMapAttachment; -} VkRenderPassFragmentDensityMapCreateInfoEXT32; - -typedef struct VkRenderPassCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - PTR32 pAttachments; - uint32_t subpassCount; - PTR32 pSubpasses; - uint32_t dependencyCount; - PTR32 pDependencies; -} VkRenderPassCreateInfo32; - -typedef struct VkAttachmentDescriptionStencilLayout32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageLayout stencilInitialLayout; - VkImageLayout stencilFinalLayout; -} VkAttachmentDescriptionStencilLayout32; -typedef VkAttachmentDescriptionStencilLayout32 VkAttachmentDescriptionStencilLayoutKHR32; - -typedef struct VkAttachmentDescription232 -{ - VkStructureType sType; - PTR32 pNext; - VkAttachmentDescriptionFlags flags; - VkFormat format; - VkSampleCountFlagBits samples; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkAttachmentLoadOp stencilLoadOp; - VkAttachmentStoreOp stencilStoreOp; - VkImageLayout initialLayout; - VkImageLayout finalLayout; -} VkAttachmentDescription232; -typedef VkAttachmentDescription232 VkAttachmentDescription2KHR32; - -typedef struct VkAttachmentReferenceStencilLayout32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageLayout stencilLayout; -} VkAttachmentReferenceStencilLayout32; -typedef VkAttachmentReferenceStencilLayout32 VkAttachmentReferenceStencilLayoutKHR32; - -typedef struct VkAttachmentReference232 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t attachment; - VkImageLayout layout; - VkImageAspectFlags aspectMask; -} VkAttachmentReference232; -typedef VkAttachmentReference232 VkAttachmentReference2KHR32; - -typedef struct VkSubpassDescriptionDepthStencilResolve32 -{ - VkStructureType sType; - PTR32 pNext; - VkResolveModeFlagBits depthResolveMode; - VkResolveModeFlagBits stencilResolveMode; - PTR32 pDepthStencilResolveAttachment; -} VkSubpassDescriptionDepthStencilResolve32; -typedef VkSubpassDescriptionDepthStencilResolve32 VkSubpassDescriptionDepthStencilResolveKHR32; - -typedef struct VkFragmentShadingRateAttachmentInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pFragmentShadingRateAttachment; - VkExtent2D shadingRateAttachmentTexelSize; -} VkFragmentShadingRateAttachmentInfoKHR32; - -typedef struct VkRenderPassCreationControlEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 disallowMerging; -} VkRenderPassCreationControlEXT32; - -typedef struct VkRenderPassSubpassFeedbackCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pSubpassFeedback; -} VkRenderPassSubpassFeedbackCreateInfoEXT32; - -typedef struct VkSubpassDescription232 -{ - VkStructureType sType; - PTR32 pNext; - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t viewMask; - uint32_t inputAttachmentCount; - PTR32 pInputAttachments; - uint32_t colorAttachmentCount; - PTR32 pColorAttachments; - PTR32 pResolveAttachments; - PTR32 pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - PTR32 pPreserveAttachments; -} VkSubpassDescription232; -typedef VkSubpassDescription232 VkSubpassDescription2KHR32; - -typedef struct VkSubpassDependency232 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t srcSubpass; - uint32_t dstSubpass; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkDependencyFlags dependencyFlags; - int32_t viewOffset; -} VkSubpassDependency232; -typedef VkSubpassDependency232 VkSubpassDependency2KHR32; - -typedef struct VkRenderPassCreationFeedbackCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pRenderPassFeedback; -} VkRenderPassCreationFeedbackCreateInfoEXT32; - -typedef struct VkRenderPassCreateInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - PTR32 pAttachments; - uint32_t subpassCount; - PTR32 pSubpasses; - uint32_t dependencyCount; - PTR32 pDependencies; - uint32_t correlatedViewMaskCount; - PTR32 pCorrelatedViewMasks; -} VkRenderPassCreateInfo232; -typedef VkRenderPassCreateInfo232 VkRenderPassCreateInfo2KHR32; - -typedef struct VkSamplerReductionModeCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSamplerReductionMode reductionMode; -} VkSamplerReductionModeCreateInfo32; -typedef VkSamplerReductionModeCreateInfo32 VkSamplerReductionModeCreateInfoEXT32; - -typedef struct VkSamplerCustomBorderColorCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkClearColorValue customBorderColor; - VkFormat format; -} VkSamplerCustomBorderColorCreateInfoEXT32; - -typedef struct VkSamplerBorderColorComponentMappingCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkComponentMapping components; - VkBool32 srgb; -} VkSamplerBorderColorComponentMappingCreateInfoEXT32; - -typedef struct VkSamplerCubicWeightsCreateInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkCubicFilterWeightsQCOM cubicWeights; -} VkSamplerCubicWeightsCreateInfoQCOM32; - -typedef struct VkSamplerBlockMatchWindowCreateInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D windowExtent; - VkBlockMatchWindowCompareModeQCOM windowCompareMode; -} VkSamplerBlockMatchWindowCreateInfoQCOM32; - -typedef struct VkSamplerCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSamplerCreateFlags flags; - VkFilter magFilter; - VkFilter minFilter; - VkSamplerMipmapMode mipmapMode; - VkSamplerAddressMode addressModeU; - VkSamplerAddressMode addressModeV; - VkSamplerAddressMode addressModeW; - float mipLodBias; - VkBool32 anisotropyEnable; - float maxAnisotropy; - VkBool32 compareEnable; - VkCompareOp compareOp; - float minLod; - float maxLod; - VkBorderColor borderColor; - VkBool32 unnormalizedCoordinates; -} VkSamplerCreateInfo32; - -typedef struct VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 enableYDegamma; - VkBool32 enableCbCrDegamma; -} VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM32; - -typedef struct VkSamplerYcbcrConversionCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkFormat format; - VkSamplerYcbcrModelConversion ycbcrModel; - VkSamplerYcbcrRange ycbcrRange; - VkComponentMapping components; - VkChromaLocation xChromaOffset; - VkChromaLocation yChromaOffset; - VkFilter chromaFilter; - VkBool32 forceExplicitReconstruction; -} VkSamplerYcbcrConversionCreateInfo32; -typedef VkSamplerYcbcrConversionCreateInfo32 VkSamplerYcbcrConversionCreateInfoKHR32; - -typedef struct VkExportSemaphoreCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalSemaphoreHandleTypeFlags handleTypes; -} VkExportSemaphoreCreateInfo32; -typedef VkExportSemaphoreCreateInfo32 VkExportSemaphoreCreateInfoKHR32; - -typedef struct VkSemaphoreTypeCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSemaphoreType semaphoreType; - uint64_t DECLSPEC_ALIGN(8) initialValue; -} VkSemaphoreTypeCreateInfo32; -typedef VkSemaphoreTypeCreateInfo32 VkSemaphoreTypeCreateInfoKHR32; - -typedef struct VkQueryLowLatencySupportNV32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pQueriedLowLatencyData; -} VkQueryLowLatencySupportNV32; - -typedef struct VkSemaphoreCreateInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSemaphoreCreateFlags flags; -} VkSemaphoreCreateInfo32; - -typedef struct VkShaderCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderCreateFlagsEXT flags; - VkShaderStageFlagBits stage; - VkShaderStageFlags nextStage; - VkShaderCodeTypeEXT codeType; - PTR32 codeSize; - PTR32 pCode; - PTR32 pName; - uint32_t setLayoutCount; - PTR32 pSetLayouts; - uint32_t pushConstantRangeCount; - PTR32 pPushConstantRanges; - PTR32 pSpecializationInfo; -} VkShaderCreateInfoEXT32; - -typedef struct VkDeviceGroupSwapchainCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceGroupPresentModeFlagsKHR modes; -} VkDeviceGroupSwapchainCreateInfoKHR32; - -typedef struct VkSwapchainPresentBarrierCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 presentBarrierEnable; -} VkSwapchainPresentBarrierCreateInfoNV32; - -typedef struct VkSwapchainPresentModesCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t presentModeCount; - PTR32 pPresentModes; -} VkSwapchainPresentModesCreateInfoEXT32; - -typedef struct VkSwapchainPresentScalingCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPresentScalingFlagsEXT scalingBehavior; - VkPresentGravityFlagsEXT presentGravityX; - VkPresentGravityFlagsEXT presentGravityY; -} VkSwapchainPresentScalingCreateInfoEXT32; - -typedef struct VkSwapchainLatencyCreateInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 latencyModeEnable; -} VkSwapchainLatencyCreateInfoNV32; - -typedef struct VkSwapchainCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSwapchainCreateFlagsKHR flags; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - uint32_t minImageCount; - VkFormat imageFormat; - VkColorSpaceKHR imageColorSpace; - VkExtent2D imageExtent; - uint32_t imageArrayLayers; - VkImageUsageFlags imageUsage; - VkSharingMode imageSharingMode; - uint32_t queueFamilyIndexCount; - PTR32 pQueueFamilyIndices; - VkSurfaceTransformFlagBitsKHR preTransform; - VkCompositeAlphaFlagBitsKHR compositeAlpha; - VkPresentModeKHR presentMode; - VkBool32 clipped; - VkSwapchainKHR DECLSPEC_ALIGN(8) oldSwapchain; -} VkSwapchainCreateInfoKHR32; - -typedef struct VkValidationCacheCreateInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkValidationCacheCreateFlagsEXT flags; - PTR32 initialDataSize; - PTR32 pInitialData; -} VkValidationCacheCreateInfoEXT32; - -typedef struct VkWin32SurfaceCreateInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkWin32SurfaceCreateFlagsKHR flags; - PTR32 hinstance; - PTR32 hwnd; -} VkWin32SurfaceCreateInfoKHR32; - -typedef struct VkDebugMarkerObjectNameInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDebugReportObjectTypeEXT objectType; - uint64_t DECLSPEC_ALIGN(8) object; - PTR32 pObjectName; -} VkDebugMarkerObjectNameInfoEXT32; - -typedef struct VkDebugMarkerObjectTagInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDebugReportObjectTypeEXT objectType; - uint64_t DECLSPEC_ALIGN(8) object; - uint64_t DECLSPEC_ALIGN(8) tagName; - PTR32 tagSize; - PTR32 pTag; -} VkDebugMarkerObjectTagInfoEXT32; - -typedef struct VkPhysicalDeviceGroupProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t physicalDeviceCount; - PTR32 physicalDevices[VK_MAX_DEVICE_GROUP_SIZE]; - VkBool32 subsetAllocation; -} VkPhysicalDeviceGroupProperties32; -typedef VkPhysicalDeviceGroupProperties32 VkPhysicalDeviceGroupPropertiesKHR32; - -typedef struct VkPerformanceCounterKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkPerformanceCounterUnitKHR unit; - VkPerformanceCounterScopeKHR scope; - VkPerformanceCounterStorageKHR storage; - uint8_t uuid[VK_UUID_SIZE]; -} VkPerformanceCounterKHR32; - -typedef struct VkPerformanceCounterDescriptionKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkPerformanceCounterDescriptionFlagsKHR flags; - char name[VK_MAX_DESCRIPTION_SIZE]; - char category[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; -} VkPerformanceCounterDescriptionKHR32; - -typedef struct VkMappedMemoryRange32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkMappedMemoryRange32; - -typedef struct VkAccelerationStructureBuildSizesInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) accelerationStructureSize; - VkDeviceSize DECLSPEC_ALIGN(8) updateScratchSize; - VkDeviceSize DECLSPEC_ALIGN(8) buildScratchSize; -} VkAccelerationStructureBuildSizesInfoKHR32; - -typedef struct VkAccelerationStructureDeviceAddressInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) accelerationStructure; -} VkAccelerationStructureDeviceAddressInfoKHR32; - -typedef struct VkAccelerationStructureMemoryRequirementsInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureMemoryRequirementsTypeNV type; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructure; -} VkAccelerationStructureMemoryRequirementsInfoNV32; - -typedef struct VkMemoryRequirements32 -{ - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkDeviceSize DECLSPEC_ALIGN(8) alignment; - uint32_t memoryTypeBits; -} VkMemoryRequirements32; - - -typedef struct VkAccelerationStructureCaptureDescriptorDataInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) accelerationStructure; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructureNV; -} VkAccelerationStructureCaptureDescriptorDataInfoEXT32; - -typedef struct VkBufferDeviceAddressInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) buffer; -} VkBufferDeviceAddressInfo32; -typedef VkBufferDeviceAddressInfo32 VkBufferDeviceAddressInfoKHR32; -typedef VkBufferDeviceAddressInfo32 VkBufferDeviceAddressInfoEXT32; - -typedef struct VkBufferMemoryRequirementsInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) buffer; -} VkBufferMemoryRequirementsInfo232; -typedef VkBufferMemoryRequirementsInfo232 VkBufferMemoryRequirementsInfo2KHR32; - -typedef struct VkMemoryDedicatedRequirements32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 prefersDedicatedAllocation; - VkBool32 requiresDedicatedAllocation; -} VkMemoryDedicatedRequirements32; -typedef VkMemoryDedicatedRequirements32 VkMemoryDedicatedRequirementsKHR32; - -typedef struct VkMemoryRequirements232 -{ - VkStructureType sType; - PTR32 pNext; - VkMemoryRequirements32 DECLSPEC_ALIGN(8) memoryRequirements; -} VkMemoryRequirements232; -typedef VkMemoryRequirements232 VkMemoryRequirements2KHR32; - -typedef struct VkBufferCaptureDescriptorDataInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBuffer DECLSPEC_ALIGN(8) buffer; -} VkBufferCaptureDescriptorDataInfoEXT32; - -typedef struct VkCalibratedTimestampInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkTimeDomainEXT timeDomain; -} VkCalibratedTimestampInfoEXT32; - -typedef struct VkDescriptorAddressInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceAddress DECLSPEC_ALIGN(8) address; - VkDeviceSize DECLSPEC_ALIGN(8) range; - VkFormat format; -} VkDescriptorAddressInfoEXT32; - -typedef union VkDescriptorDataEXT32 -{ - PTR32 pSampler; - PTR32 pCombinedImageSampler; - PTR32 pInputAttachmentImage; - PTR32 pSampledImage; - PTR32 pStorageImage; - PTR32 pUniformTexelBuffer; - PTR32 pStorageTexelBuffer; - PTR32 pUniformBuffer; - PTR32 pStorageBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) accelerationStructure; -} VkDescriptorDataEXT32; - -typedef struct VkDescriptorGetInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorType type; - VkDescriptorDataEXT32 DECLSPEC_ALIGN(8) data; -} VkDescriptorGetInfoEXT32; - -typedef struct VkDescriptorSetBindingReferenceVALVE32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) descriptorSetLayout; - uint32_t binding; -} VkDescriptorSetBindingReferenceVALVE32; - -typedef struct VkDescriptorSetLayoutHostMappingInfoVALVE32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 descriptorOffset; - uint32_t descriptorSize; -} VkDescriptorSetLayoutHostMappingInfoVALVE32; - -typedef struct VkDescriptorSetVariableDescriptorCountLayoutSupport32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxVariableDescriptorCount; -} VkDescriptorSetVariableDescriptorCountLayoutSupport32; -typedef VkDescriptorSetVariableDescriptorCountLayoutSupport32 VkDescriptorSetVariableDescriptorCountLayoutSupportEXT32; - -typedef struct VkDescriptorSetLayoutSupport32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 supported; -} VkDescriptorSetLayoutSupport32; -typedef VkDescriptorSetLayoutSupport32 VkDescriptorSetLayoutSupportKHR32; - -typedef struct VkAccelerationStructureVersionInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pVersionData; -} VkAccelerationStructureVersionInfoKHR32; - -typedef struct VkDeviceBufferMemoryRequirements32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pCreateInfo; -} VkDeviceBufferMemoryRequirements32; -typedef VkDeviceBufferMemoryRequirements32 VkDeviceBufferMemoryRequirementsKHR32; - -typedef struct VkDeviceFaultCountsEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t addressInfoCount; - uint32_t vendorInfoCount; - VkDeviceSize DECLSPEC_ALIGN(8) vendorBinarySize; -} VkDeviceFaultCountsEXT32; - -typedef struct VkDeviceFaultAddressInfoEXT32 -{ - VkDeviceFaultAddressTypeEXT addressType; - VkDeviceAddress DECLSPEC_ALIGN(8) reportedAddress; - VkDeviceSize DECLSPEC_ALIGN(8) addressPrecision; -} VkDeviceFaultAddressInfoEXT32; - -typedef struct VkDeviceFaultVendorInfoEXT32 -{ - char description[VK_MAX_DESCRIPTION_SIZE]; - uint64_t DECLSPEC_ALIGN(8) vendorFaultCode; - uint64_t DECLSPEC_ALIGN(8) vendorFaultData; -} VkDeviceFaultVendorInfoEXT32; - -typedef struct VkDeviceFaultInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - char description[VK_MAX_DESCRIPTION_SIZE]; - PTR32 pAddressInfos; - PTR32 pVendorInfos; - PTR32 pVendorBinaryData; -} VkDeviceFaultInfoEXT32; - -typedef struct VkDeviceGroupPresentCapabilitiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE]; - VkDeviceGroupPresentModeFlagsKHR modes; -} VkDeviceGroupPresentCapabilitiesKHR32; - -typedef struct VkDeviceImageMemoryRequirements32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pCreateInfo; - VkImageAspectFlagBits planeAspect; -} VkDeviceImageMemoryRequirements32; -typedef VkDeviceImageMemoryRequirements32 VkDeviceImageMemoryRequirementsKHR32; - -typedef struct VkSparseImageMemoryRequirements32 -{ - VkSparseImageFormatProperties formatProperties; - uint32_t imageMipTailFirstLod; - VkDeviceSize DECLSPEC_ALIGN(8) imageMipTailSize; - VkDeviceSize DECLSPEC_ALIGN(8) imageMipTailOffset; - VkDeviceSize DECLSPEC_ALIGN(8) imageMipTailStride; -} VkSparseImageMemoryRequirements32; - -typedef struct VkSparseImageMemoryRequirements232 -{ - VkStructureType sType; - PTR32 pNext; - VkSparseImageMemoryRequirements32 DECLSPEC_ALIGN(8) memoryRequirements; -} VkSparseImageMemoryRequirements232; -typedef VkSparseImageMemoryRequirements232 VkSparseImageMemoryRequirements2KHR32; - -typedef struct VkImageSubresource2KHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageSubresource imageSubresource; -} VkImageSubresource2KHR32; -typedef VkImageSubresource2KHR32 VkImageSubresource2EXT32; - -typedef struct VkDeviceImageSubresourceInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pCreateInfo; - PTR32 pSubresource; -} VkDeviceImageSubresourceInfoKHR32; - -typedef struct VkSubresourceLayout32 -{ - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkDeviceSize DECLSPEC_ALIGN(8) rowPitch; - VkDeviceSize DECLSPEC_ALIGN(8) arrayPitch; - VkDeviceSize DECLSPEC_ALIGN(8) depthPitch; -} VkSubresourceLayout32; - -typedef struct VkSubresourceHostMemcpySizeEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkSubresourceHostMemcpySizeEXT32; - -typedef struct VkImageCompressionPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageCompressionFlagsEXT imageCompressionFlags; - VkImageCompressionFixedRateFlagsEXT imageCompressionFixedRateFlags; -} VkImageCompressionPropertiesEXT32; - -typedef struct VkSubresourceLayout2KHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSubresourceLayout32 DECLSPEC_ALIGN(8) subresourceLayout; -} VkSubresourceLayout2KHR32; -typedef VkSubresourceLayout2KHR32 VkSubresourceLayout2EXT32; - -typedef struct VkDeviceMemoryOpaqueCaptureAddressInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; -} VkDeviceMemoryOpaqueCaptureAddressInfo32; -typedef VkDeviceMemoryOpaqueCaptureAddressInfo32 VkDeviceMemoryOpaqueCaptureAddressInfoKHR32; - -typedef struct VkMicromapVersionInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pVersionData; -} VkMicromapVersionInfoEXT32; - -typedef struct VkDeviceQueueInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueIndex; -} VkDeviceQueueInfo232; - -typedef struct VkTilePropertiesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent3D tileSize; - VkExtent2D apronSize; - VkOffset2D origin; -} VkTilePropertiesQCOM32; - -typedef struct VkGeneratedCommandsMemoryRequirementsInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - VkIndirectCommandsLayoutNV DECLSPEC_ALIGN(8) indirectCommandsLayout; - uint32_t maxSequencesCount; -} VkGeneratedCommandsMemoryRequirementsInfoNV32; - -typedef struct VkImagePlaneMemoryRequirementsInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageAspectFlagBits planeAspect; -} VkImagePlaneMemoryRequirementsInfo32; -typedef VkImagePlaneMemoryRequirementsInfo32 VkImagePlaneMemoryRequirementsInfoKHR32; - -typedef struct VkImageMemoryRequirementsInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; -} VkImageMemoryRequirementsInfo232; -typedef VkImageMemoryRequirementsInfo232 VkImageMemoryRequirementsInfo2KHR32; - -typedef struct VkImageCaptureDescriptorDataInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; -} VkImageCaptureDescriptorDataInfoEXT32; - -typedef struct VkImageSparseMemoryRequirementsInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; -} VkImageSparseMemoryRequirementsInfo232; -typedef VkImageSparseMemoryRequirementsInfo232 VkImageSparseMemoryRequirementsInfo2KHR32; - -typedef struct VkImageViewAddressPropertiesNVX32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceAddress DECLSPEC_ALIGN(8) deviceAddress; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkImageViewAddressPropertiesNVX32; - -typedef struct VkImageViewHandleInfoNVX32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkDescriptorType descriptorType; - VkSampler DECLSPEC_ALIGN(8) sampler; -} VkImageViewHandleInfoNVX32; - -typedef struct VkImageViewCaptureDescriptorDataInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageView DECLSPEC_ALIGN(8) imageView; -} VkImageViewCaptureDescriptorDataInfoEXT32; - -typedef struct VkLatencyTimingsFrameReportNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) presentID; - uint64_t DECLSPEC_ALIGN(8) inputSampleTimeUs; - uint64_t DECLSPEC_ALIGN(8) simStartTimeUs; - uint64_t DECLSPEC_ALIGN(8) simEndTimeUs; - uint64_t DECLSPEC_ALIGN(8) renderSubmitStartTimeUs; - uint64_t DECLSPEC_ALIGN(8) renderSubmitEndTimeUs; - uint64_t DECLSPEC_ALIGN(8) presentStartTimeUs; - uint64_t DECLSPEC_ALIGN(8) presentEndTimeUs; - uint64_t DECLSPEC_ALIGN(8) driverStartTimeUs; - uint64_t DECLSPEC_ALIGN(8) driverEndTimeUs; - uint64_t DECLSPEC_ALIGN(8) osRenderQueueStartTimeUs; - uint64_t DECLSPEC_ALIGN(8) osRenderQueueEndTimeUs; - uint64_t DECLSPEC_ALIGN(8) gpuRenderStartTimeUs; - uint64_t DECLSPEC_ALIGN(8) gpuRenderEndTimeUs; -} VkLatencyTimingsFrameReportNV32; - -typedef struct VkGetLatencyMarkerInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t timingCount; - PTR32 pTimings; -} VkGetLatencyMarkerInfoNV32; - -typedef struct VkMemoryHostPointerPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t memoryTypeBits; -} VkMemoryHostPointerPropertiesEXT32; - -typedef struct VkMicromapBuildSizesInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) micromapSize; - VkDeviceSize DECLSPEC_ALIGN(8) buildScratchSize; - VkBool32 discardable; -} VkMicromapBuildSizesInfoEXT32; - -typedef union VkPerformanceValueDataINTEL32 -{ - uint32_t value32; - uint64_t DECLSPEC_ALIGN(8) value64; - float valueFloat; - VkBool32 valueBool; - PTR32 valueString; -} VkPerformanceValueDataINTEL32; - -typedef struct VkPerformanceValueINTEL32 -{ - VkPerformanceValueTypeINTEL type; - VkPerformanceValueDataINTEL32 DECLSPEC_ALIGN(8) data; -} VkPerformanceValueINTEL32; - -typedef struct VkCooperativeMatrixPropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t MSize; - uint32_t NSize; - uint32_t KSize; - VkComponentTypeKHR AType; - VkComponentTypeKHR BType; - VkComponentTypeKHR CType; - VkComponentTypeKHR ResultType; - VkBool32 saturatingAccumulation; - VkScopeKHR scope; -} VkCooperativeMatrixPropertiesKHR32; - -typedef struct VkCooperativeMatrixPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t MSize; - uint32_t NSize; - uint32_t KSize; - VkComponentTypeNV AType; - VkComponentTypeNV BType; - VkComponentTypeNV CType; - VkComponentTypeNV DType; - VkScopeNV scope; -} VkCooperativeMatrixPropertiesNV32; - -typedef struct VkPhysicalDeviceExternalBufferInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkBufferCreateFlags flags; - VkBufferUsageFlags usage; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalBufferInfo32; -typedef VkPhysicalDeviceExternalBufferInfo32 VkPhysicalDeviceExternalBufferInfoKHR32; - -typedef struct VkExternalBufferProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryProperties externalMemoryProperties; -} VkExternalBufferProperties32; -typedef VkExternalBufferProperties32 VkExternalBufferPropertiesKHR32; - -typedef struct VkPhysicalDeviceExternalFenceInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalFenceHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalFenceInfo32; -typedef VkPhysicalDeviceExternalFenceInfo32 VkPhysicalDeviceExternalFenceInfoKHR32; - -typedef struct VkExternalFenceProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalFenceHandleTypeFlags exportFromImportedHandleTypes; - VkExternalFenceHandleTypeFlags compatibleHandleTypes; - VkExternalFenceFeatureFlags externalFenceFeatures; -} VkExternalFenceProperties32; -typedef VkExternalFenceProperties32 VkExternalFencePropertiesKHR32; - -typedef struct VkPhysicalDeviceExternalSemaphoreInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalSemaphoreHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalSemaphoreInfo32; -typedef VkPhysicalDeviceExternalSemaphoreInfo32 VkPhysicalDeviceExternalSemaphoreInfoKHR32; - -typedef struct VkExternalSemaphoreProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalSemaphoreHandleTypeFlags exportFromImportedHandleTypes; - VkExternalSemaphoreHandleTypeFlags compatibleHandleTypes; - VkExternalSemaphoreFeatureFlags externalSemaphoreFeatures; -} VkExternalSemaphoreProperties32; -typedef VkExternalSemaphoreProperties32 VkExternalSemaphorePropertiesKHR32; - -typedef struct VkSubpassResolvePerformanceQueryEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 optimal; -} VkSubpassResolvePerformanceQueryEXT32; - -typedef struct VkFormatProperties332 -{ - VkStructureType sType; - PTR32 pNext; - VkFormatFeatureFlags2 DECLSPEC_ALIGN(8) linearTilingFeatures; - VkFormatFeatureFlags2 DECLSPEC_ALIGN(8) optimalTilingFeatures; - VkFormatFeatureFlags2 DECLSPEC_ALIGN(8) bufferFeatures; -} VkFormatProperties332; -typedef VkFormatProperties332 VkFormatProperties3KHR32; - -typedef struct VkFormatProperties232 -{ - VkStructureType sType; - PTR32 pNext; - VkFormatProperties formatProperties; -} VkFormatProperties232; -typedef VkFormatProperties232 VkFormatProperties2KHR32; - -typedef struct VkPhysicalDeviceFragmentShadingRateKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSampleCountFlags sampleCounts; - VkExtent2D fragmentSize; -} VkPhysicalDeviceFragmentShadingRateKHR32; - -typedef struct VkImageFormatProperties32 -{ - VkExtent3D maxExtent; - uint32_t maxMipLevels; - uint32_t maxArrayLayers; - VkSampleCountFlags sampleCounts; - VkDeviceSize DECLSPEC_ALIGN(8) maxResourceSize; -} VkImageFormatProperties32; - -typedef struct VkPhysicalDeviceExternalImageFormatInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalImageFormatInfo32; -typedef VkPhysicalDeviceExternalImageFormatInfo32 VkPhysicalDeviceExternalImageFormatInfoKHR32; - -typedef struct VkPhysicalDeviceImageViewImageFormatInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImageViewType imageViewType; -} VkPhysicalDeviceImageViewImageFormatInfoEXT32; - -typedef struct VkPhysicalDeviceImageFormatInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkFormat format; - VkImageType type; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkImageCreateFlags flags; -} VkPhysicalDeviceImageFormatInfo232; -typedef VkPhysicalDeviceImageFormatInfo232 VkPhysicalDeviceImageFormatInfo2KHR32; - -typedef struct VkExternalImageFormatProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkExternalMemoryProperties externalMemoryProperties; -} VkExternalImageFormatProperties32; -typedef VkExternalImageFormatProperties32 VkExternalImageFormatPropertiesKHR32; - -typedef struct VkSamplerYcbcrConversionImageFormatProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t combinedImageSamplerDescriptorCount; -} VkSamplerYcbcrConversionImageFormatProperties32; -typedef VkSamplerYcbcrConversionImageFormatProperties32 VkSamplerYcbcrConversionImageFormatPropertiesKHR32; - -typedef struct VkTextureLODGatherFormatPropertiesAMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 supportsTextureGatherLODBiasAMD; -} VkTextureLODGatherFormatPropertiesAMD32; - -typedef struct VkFilterCubicImageViewImageFormatPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 filterCubic; - VkBool32 filterCubicMinmax; -} VkFilterCubicImageViewImageFormatPropertiesEXT32; - -typedef struct VkHostImageCopyDevicePerformanceQueryEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 optimalDeviceAccess; - VkBool32 identicalMemoryLayout; -} VkHostImageCopyDevicePerformanceQueryEXT32; - -typedef struct VkImageFormatProperties232 -{ - VkStructureType sType; - PTR32 pNext; - VkImageFormatProperties32 DECLSPEC_ALIGN(8) imageFormatProperties; -} VkImageFormatProperties232; -typedef VkImageFormatProperties232 VkImageFormatProperties2KHR32; - -typedef struct VkMemoryHeap32 -{ - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkMemoryHeapFlags flags; -} VkMemoryHeap32; - -typedef struct VkPhysicalDeviceMemoryProperties32 -{ - uint32_t memoryTypeCount; - VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; - uint32_t memoryHeapCount; - VkMemoryHeap32 DECLSPEC_ALIGN(8) memoryHeaps[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryProperties32; - -typedef struct VkPhysicalDeviceMemoryBudgetPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) heapBudget[VK_MAX_MEMORY_HEAPS]; - VkDeviceSize DECLSPEC_ALIGN(8) heapUsage[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryBudgetPropertiesEXT32; - -typedef struct VkPhysicalDeviceMemoryProperties232 -{ - VkStructureType sType; - PTR32 pNext; - VkPhysicalDeviceMemoryProperties32 DECLSPEC_ALIGN(8) memoryProperties; -} VkPhysicalDeviceMemoryProperties232; -typedef VkPhysicalDeviceMemoryProperties232 VkPhysicalDeviceMemoryProperties2KHR32; - -typedef struct VkMultisamplePropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D maxSampleLocationGridSize; -} VkMultisamplePropertiesEXT32; - -typedef struct VkOpticalFlowImageFormatPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkFormat format; -} VkOpticalFlowImageFormatPropertiesNV32; - -typedef struct VkPhysicalDeviceLimits32 -{ - uint32_t maxImageDimension1D; - uint32_t maxImageDimension2D; - uint32_t maxImageDimension3D; - uint32_t maxImageDimensionCube; - uint32_t maxImageArrayLayers; - uint32_t maxTexelBufferElements; - uint32_t maxUniformBufferRange; - uint32_t maxStorageBufferRange; - uint32_t maxPushConstantsSize; - uint32_t maxMemoryAllocationCount; - uint32_t maxSamplerAllocationCount; - VkDeviceSize DECLSPEC_ALIGN(8) bufferImageGranularity; - VkDeviceSize DECLSPEC_ALIGN(8) sparseAddressSpaceSize; - uint32_t maxBoundDescriptorSets; - uint32_t maxPerStageDescriptorSamplers; - uint32_t maxPerStageDescriptorUniformBuffers; - uint32_t maxPerStageDescriptorStorageBuffers; - uint32_t maxPerStageDescriptorSampledImages; - uint32_t maxPerStageDescriptorStorageImages; - uint32_t maxPerStageDescriptorInputAttachments; - uint32_t maxPerStageResources; - uint32_t maxDescriptorSetSamplers; - uint32_t maxDescriptorSetUniformBuffers; - uint32_t maxDescriptorSetUniformBuffersDynamic; - uint32_t maxDescriptorSetStorageBuffers; - uint32_t maxDescriptorSetStorageBuffersDynamic; - uint32_t maxDescriptorSetSampledImages; - uint32_t maxDescriptorSetStorageImages; - uint32_t maxDescriptorSetInputAttachments; - uint32_t maxVertexInputAttributes; - uint32_t maxVertexInputBindings; - uint32_t maxVertexInputAttributeOffset; - uint32_t maxVertexInputBindingStride; - uint32_t maxVertexOutputComponents; - uint32_t maxTessellationGenerationLevel; - uint32_t maxTessellationPatchSize; - uint32_t maxTessellationControlPerVertexInputComponents; - uint32_t maxTessellationControlPerVertexOutputComponents; - uint32_t maxTessellationControlPerPatchOutputComponents; - uint32_t maxTessellationControlTotalOutputComponents; - uint32_t maxTessellationEvaluationInputComponents; - uint32_t maxTessellationEvaluationOutputComponents; - uint32_t maxGeometryShaderInvocations; - uint32_t maxGeometryInputComponents; - uint32_t maxGeometryOutputComponents; - uint32_t maxGeometryOutputVertices; - uint32_t maxGeometryTotalOutputComponents; - uint32_t maxFragmentInputComponents; - uint32_t maxFragmentOutputAttachments; - uint32_t maxFragmentDualSrcAttachments; - uint32_t maxFragmentCombinedOutputResources; - uint32_t maxComputeSharedMemorySize; - uint32_t maxComputeWorkGroupCount[3]; - uint32_t maxComputeWorkGroupInvocations; - uint32_t maxComputeWorkGroupSize[3]; - uint32_t subPixelPrecisionBits; - uint32_t subTexelPrecisionBits; - uint32_t mipmapPrecisionBits; - uint32_t maxDrawIndexedIndexValue; - uint32_t maxDrawIndirectCount; - float maxSamplerLodBias; - float maxSamplerAnisotropy; - uint32_t maxViewports; - uint32_t maxViewportDimensions[2]; - float viewportBoundsRange[2]; - uint32_t viewportSubPixelBits; - PTR32 minMemoryMapAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) minTexelBufferOffsetAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) minUniformBufferOffsetAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) minStorageBufferOffsetAlignment; - int32_t minTexelOffset; - uint32_t maxTexelOffset; - int32_t minTexelGatherOffset; - uint32_t maxTexelGatherOffset; - float minInterpolationOffset; - float maxInterpolationOffset; - uint32_t subPixelInterpolationOffsetBits; - uint32_t maxFramebufferWidth; - uint32_t maxFramebufferHeight; - uint32_t maxFramebufferLayers; - VkSampleCountFlags framebufferColorSampleCounts; - VkSampleCountFlags framebufferDepthSampleCounts; - VkSampleCountFlags framebufferStencilSampleCounts; - VkSampleCountFlags framebufferNoAttachmentsSampleCounts; - uint32_t maxColorAttachments; - VkSampleCountFlags sampledImageColorSampleCounts; - VkSampleCountFlags sampledImageIntegerSampleCounts; - VkSampleCountFlags sampledImageDepthSampleCounts; - VkSampleCountFlags sampledImageStencilSampleCounts; - VkSampleCountFlags storageImageSampleCounts; - uint32_t maxSampleMaskWords; - VkBool32 timestampComputeAndGraphics; - float timestampPeriod; - uint32_t maxClipDistances; - uint32_t maxCullDistances; - uint32_t maxCombinedClipAndCullDistances; - uint32_t discreteQueuePriorities; - float pointSizeRange[2]; - float lineWidthRange[2]; - float pointSizeGranularity; - float lineWidthGranularity; - VkBool32 strictLines; - VkBool32 standardSampleLocations; - VkDeviceSize DECLSPEC_ALIGN(8) optimalBufferCopyOffsetAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) optimalBufferCopyRowPitchAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) nonCoherentAtomSize; -} VkPhysicalDeviceLimits32; - -typedef struct VkPhysicalDeviceProperties32 -{ - uint32_t apiVersion; - uint32_t driverVersion; - uint32_t vendorID; - uint32_t deviceID; - VkPhysicalDeviceType deviceType; - char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; - uint8_t pipelineCacheUUID[VK_UUID_SIZE]; - VkPhysicalDeviceLimits32 DECLSPEC_ALIGN(8) limits; - VkPhysicalDeviceSparseProperties sparseProperties; -} VkPhysicalDeviceProperties32; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxGraphicsShaderGroupCount; - uint32_t maxIndirectSequenceCount; - uint32_t maxIndirectCommandsTokenCount; - uint32_t maxIndirectCommandsStreamCount; - uint32_t maxIndirectCommandsTokenOffset; - uint32_t maxIndirectCommandsStreamStride; - uint32_t minSequencesCountBufferOffsetAlignment; - uint32_t minSequencesIndexBufferOffsetAlignment; - uint32_t minIndirectCommandsBufferOffsetAlignment; -} VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV32; - -typedef struct VkPhysicalDeviceMultiDrawPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxMultiDrawCount; -} VkPhysicalDeviceMultiDrawPropertiesEXT32; - -typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxPushDescriptors; -} VkPhysicalDevicePushDescriptorPropertiesKHR32; - -typedef struct VkPhysicalDeviceDriverProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkDriverId driverID; - char driverName[VK_MAX_DRIVER_NAME_SIZE]; - char driverInfo[VK_MAX_DRIVER_INFO_SIZE]; - VkConformanceVersion conformanceVersion; -} VkPhysicalDeviceDriverProperties32; -typedef VkPhysicalDeviceDriverProperties32 VkPhysicalDeviceDriverPropertiesKHR32; - -typedef struct VkPhysicalDeviceIDProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; -} VkPhysicalDeviceIDProperties32; -typedef VkPhysicalDeviceIDProperties32 VkPhysicalDeviceIDPropertiesKHR32; - -typedef struct VkPhysicalDeviceMultiviewProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxMultiviewViewCount; - uint32_t maxMultiviewInstanceIndex; -} VkPhysicalDeviceMultiviewProperties32; -typedef VkPhysicalDeviceMultiviewProperties32 VkPhysicalDeviceMultiviewPropertiesKHR32; - -typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxDiscardRectangles; -} VkPhysicalDeviceDiscardRectanglePropertiesEXT32; - -typedef struct VkPhysicalDeviceSubgroupProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t subgroupSize; - VkShaderStageFlags supportedStages; - VkSubgroupFeatureFlags supportedOperations; - VkBool32 quadOperationsInAllStages; -} VkPhysicalDeviceSubgroupProperties32; - -typedef struct VkPhysicalDevicePointClippingProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkPointClippingBehavior pointClippingBehavior; -} VkPhysicalDevicePointClippingProperties32; -typedef VkPhysicalDevicePointClippingProperties32 VkPhysicalDevicePointClippingPropertiesKHR32; - -typedef struct VkPhysicalDeviceProtectedMemoryProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 protectedNoFault; -} VkPhysicalDeviceProtectedMemoryProperties32; - -typedef struct VkPhysicalDeviceSamplerFilterMinmaxProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 filterMinmaxSingleComponentFormats; - VkBool32 filterMinmaxImageComponentMapping; -} VkPhysicalDeviceSamplerFilterMinmaxProperties32; -typedef VkPhysicalDeviceSamplerFilterMinmaxProperties32 VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT32; - -typedef struct VkPhysicalDeviceSampleLocationsPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkSampleCountFlags sampleLocationSampleCounts; - VkExtent2D maxSampleLocationGridSize; - float sampleLocationCoordinateRange[2]; - uint32_t sampleLocationSubPixelBits; - VkBool32 variableSampleLocations; -} VkPhysicalDeviceSampleLocationsPropertiesEXT32; - -typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t advancedBlendMaxColorAttachments; - VkBool32 advancedBlendIndependentBlend; - VkBool32 advancedBlendNonPremultipliedSrcColor; - VkBool32 advancedBlendNonPremultipliedDstColor; - VkBool32 advancedBlendCorrelatedOverlap; - VkBool32 advancedBlendAllOperations; -} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT32; - -typedef struct VkPhysicalDeviceInlineUniformBlockProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxInlineUniformBlockSize; - uint32_t maxPerStageDescriptorInlineUniformBlocks; - uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - uint32_t maxDescriptorSetInlineUniformBlocks; - uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; -} VkPhysicalDeviceInlineUniformBlockProperties32; -typedef VkPhysicalDeviceInlineUniformBlockProperties32 VkPhysicalDeviceInlineUniformBlockPropertiesEXT32; - -typedef struct VkPhysicalDeviceMaintenance3Properties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxPerSetDescriptors; - VkDeviceSize DECLSPEC_ALIGN(8) maxMemoryAllocationSize; -} VkPhysicalDeviceMaintenance3Properties32; -typedef VkPhysicalDeviceMaintenance3Properties32 VkPhysicalDeviceMaintenance3PropertiesKHR32; - -typedef struct VkPhysicalDeviceMaintenance4Properties32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) maxBufferSize; -} VkPhysicalDeviceMaintenance4Properties32; -typedef VkPhysicalDeviceMaintenance4Properties32 VkPhysicalDeviceMaintenance4PropertiesKHR32; - -typedef struct VkPhysicalDeviceMaintenance5PropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 earlyFragmentMultisampleCoverageAfterSampleCounting; - VkBool32 earlyFragmentSampleMaskTestBeforeSampleCounting; - VkBool32 depthStencilSwizzleOneSupport; - VkBool32 polygonModePointSize; - VkBool32 nonStrictSinglePixelWideLinesUseParallelogram; - VkBool32 nonStrictWideLinesUseParallelogram; -} VkPhysicalDeviceMaintenance5PropertiesKHR32; - -typedef struct VkPhysicalDeviceFloatControlsProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderFloatControlsIndependence denormBehaviorIndependence; - VkShaderFloatControlsIndependence roundingModeIndependence; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; -} VkPhysicalDeviceFloatControlsProperties32; -typedef VkPhysicalDeviceFloatControlsProperties32 VkPhysicalDeviceFloatControlsPropertiesKHR32; - -typedef struct VkPhysicalDeviceExternalMemoryHostPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) minImportedHostPointerAlignment; -} VkPhysicalDeviceExternalMemoryHostPropertiesEXT32; - -typedef struct VkPhysicalDeviceConservativeRasterizationPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - float primitiveOverestimationSize; - float maxExtraPrimitiveOverestimationSize; - float extraPrimitiveOverestimationSizeGranularity; - VkBool32 primitiveUnderestimation; - VkBool32 conservativePointAndLineRasterization; - VkBool32 degenerateTrianglesRasterized; - VkBool32 degenerateLinesRasterized; - VkBool32 fullyCoveredFragmentShaderInputVariable; - VkBool32 conservativeRasterizationPostDepthCoverage; -} VkPhysicalDeviceConservativeRasterizationPropertiesEXT32; - -typedef struct VkPhysicalDeviceShaderCorePropertiesAMD32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t shaderEngineCount; - uint32_t shaderArraysPerEngineCount; - uint32_t computeUnitsPerShaderArray; - uint32_t simdPerComputeUnit; - uint32_t wavefrontsPerSimd; - uint32_t wavefrontSize; - uint32_t sgprsPerSimd; - uint32_t minSgprAllocation; - uint32_t maxSgprAllocation; - uint32_t sgprAllocationGranularity; - uint32_t vgprsPerSimd; - uint32_t minVgprAllocation; - uint32_t maxVgprAllocation; - uint32_t vgprAllocationGranularity; -} VkPhysicalDeviceShaderCorePropertiesAMD32; - -typedef struct VkPhysicalDeviceShaderCoreProperties2AMD32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderCorePropertiesFlagsAMD shaderCoreFeatures; - uint32_t activeComputeUnitCount; -} VkPhysicalDeviceShaderCoreProperties2AMD32; - -typedef struct VkPhysicalDeviceDescriptorIndexingProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxUpdateAfterBindDescriptorsInAllPools; - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; - VkBool32 shaderSampledImageArrayNonUniformIndexingNative; - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; - VkBool32 shaderStorageImageArrayNonUniformIndexingNative; - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; - VkBool32 robustBufferAccessUpdateAfterBind; - VkBool32 quadDivergentImplicitLod; - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; - uint32_t maxPerStageUpdateAfterBindResources; - uint32_t maxDescriptorSetUpdateAfterBindSamplers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindSampledImages; - uint32_t maxDescriptorSetUpdateAfterBindStorageImages; - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; -} VkPhysicalDeviceDescriptorIndexingProperties32; -typedef VkPhysicalDeviceDescriptorIndexingProperties32 VkPhysicalDeviceDescriptorIndexingPropertiesEXT32; - -typedef struct VkPhysicalDeviceTimelineSemaphoreProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) maxTimelineSemaphoreValueDifference; -} VkPhysicalDeviceTimelineSemaphoreProperties32; -typedef VkPhysicalDeviceTimelineSemaphoreProperties32 VkPhysicalDeviceTimelineSemaphorePropertiesKHR32; - -typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxVertexAttribDivisor; -} VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT32; - -typedef struct VkPhysicalDevicePCIBusInfoPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t pciDomain; - uint32_t pciBus; - uint32_t pciDevice; - uint32_t pciFunction; -} VkPhysicalDevicePCIBusInfoPropertiesEXT32; - -typedef struct VkPhysicalDeviceDepthStencilResolveProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkResolveModeFlags supportedDepthResolveModes; - VkResolveModeFlags supportedStencilResolveModes; - VkBool32 independentResolveNone; - VkBool32 independentResolve; -} VkPhysicalDeviceDepthStencilResolveProperties32; -typedef VkPhysicalDeviceDepthStencilResolveProperties32 VkPhysicalDeviceDepthStencilResolvePropertiesKHR32; - -typedef struct VkPhysicalDeviceTransformFeedbackPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxTransformFeedbackStreams; - uint32_t maxTransformFeedbackBuffers; - VkDeviceSize DECLSPEC_ALIGN(8) maxTransformFeedbackBufferSize; - uint32_t maxTransformFeedbackStreamDataSize; - uint32_t maxTransformFeedbackBufferDataSize; - uint32_t maxTransformFeedbackBufferDataStride; - VkBool32 transformFeedbackQueries; - VkBool32 transformFeedbackStreamsLinesTriangles; - VkBool32 transformFeedbackRasterizationStreamSelect; - VkBool32 transformFeedbackDraw; -} VkPhysicalDeviceTransformFeedbackPropertiesEXT32; - -typedef struct VkPhysicalDeviceCopyMemoryIndirectPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkQueueFlags supportedQueues; -} VkPhysicalDeviceCopyMemoryIndirectPropertiesNV32; - -typedef struct VkPhysicalDeviceMemoryDecompressionPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkMemoryDecompressionMethodFlagsNV DECLSPEC_ALIGN(8) decompressionMethods; - uint64_t DECLSPEC_ALIGN(8) maxDecompressionIndirectCount; -} VkPhysicalDeviceMemoryDecompressionPropertiesNV32; - -typedef struct VkPhysicalDeviceShadingRateImagePropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D shadingRateTexelSize; - uint32_t shadingRatePaletteSize; - uint32_t shadingRateMaxCoarseSamples; -} VkPhysicalDeviceShadingRateImagePropertiesNV32; - -typedef struct VkPhysicalDeviceMeshShaderPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxDrawMeshTasksCount; - uint32_t maxTaskWorkGroupInvocations; - uint32_t maxTaskWorkGroupSize[3]; - uint32_t maxTaskTotalMemorySize; - uint32_t maxTaskOutputCount; - uint32_t maxMeshWorkGroupInvocations; - uint32_t maxMeshWorkGroupSize[3]; - uint32_t maxMeshTotalMemorySize; - uint32_t maxMeshOutputVertices; - uint32_t maxMeshOutputPrimitives; - uint32_t maxMeshMultiviewViewCount; - uint32_t meshOutputPerVertexGranularity; - uint32_t meshOutputPerPrimitiveGranularity; -} VkPhysicalDeviceMeshShaderPropertiesNV32; - -typedef struct VkPhysicalDeviceMeshShaderPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxTaskWorkGroupTotalCount; - uint32_t maxTaskWorkGroupCount[3]; - uint32_t maxTaskWorkGroupInvocations; - uint32_t maxTaskWorkGroupSize[3]; - uint32_t maxTaskPayloadSize; - uint32_t maxTaskSharedMemorySize; - uint32_t maxTaskPayloadAndSharedMemorySize; - uint32_t maxMeshWorkGroupTotalCount; - uint32_t maxMeshWorkGroupCount[3]; - uint32_t maxMeshWorkGroupInvocations; - uint32_t maxMeshWorkGroupSize[3]; - uint32_t maxMeshSharedMemorySize; - uint32_t maxMeshPayloadAndSharedMemorySize; - uint32_t maxMeshOutputMemorySize; - uint32_t maxMeshPayloadAndOutputMemorySize; - uint32_t maxMeshOutputComponents; - uint32_t maxMeshOutputVertices; - uint32_t maxMeshOutputPrimitives; - uint32_t maxMeshOutputLayers; - uint32_t maxMeshMultiviewViewCount; - uint32_t meshOutputPerVertexGranularity; - uint32_t meshOutputPerPrimitiveGranularity; - uint32_t maxPreferredTaskWorkGroupInvocations; - uint32_t maxPreferredMeshWorkGroupInvocations; - VkBool32 prefersLocalInvocationVertexOutput; - VkBool32 prefersLocalInvocationPrimitiveOutput; - VkBool32 prefersCompactVertexOutput; - VkBool32 prefersCompactPrimitiveOutput; -} VkPhysicalDeviceMeshShaderPropertiesEXT32; - -typedef struct VkPhysicalDeviceAccelerationStructurePropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) maxGeometryCount; - uint64_t DECLSPEC_ALIGN(8) maxInstanceCount; - uint64_t DECLSPEC_ALIGN(8) maxPrimitiveCount; - uint32_t maxPerStageDescriptorAccelerationStructures; - uint32_t maxPerStageDescriptorUpdateAfterBindAccelerationStructures; - uint32_t maxDescriptorSetAccelerationStructures; - uint32_t maxDescriptorSetUpdateAfterBindAccelerationStructures; - uint32_t minAccelerationStructureScratchOffsetAlignment; -} VkPhysicalDeviceAccelerationStructurePropertiesKHR32; - -typedef struct VkPhysicalDeviceRayTracingPipelinePropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t shaderGroupHandleSize; - uint32_t maxRayRecursionDepth; - uint32_t maxShaderGroupStride; - uint32_t shaderGroupBaseAlignment; - uint32_t shaderGroupHandleCaptureReplaySize; - uint32_t maxRayDispatchInvocationCount; - uint32_t shaderGroupHandleAlignment; - uint32_t maxRayHitAttributeSize; -} VkPhysicalDeviceRayTracingPipelinePropertiesKHR32; - -typedef struct VkPhysicalDeviceRayTracingPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t shaderGroupHandleSize; - uint32_t maxRecursionDepth; - uint32_t maxShaderGroupStride; - uint32_t shaderGroupBaseAlignment; - uint64_t DECLSPEC_ALIGN(8) maxGeometryCount; - uint64_t DECLSPEC_ALIGN(8) maxInstanceCount; - uint64_t DECLSPEC_ALIGN(8) maxTriangleCount; - uint32_t maxDescriptorSetAccelerationStructures; -} VkPhysicalDeviceRayTracingPropertiesNV32; - -typedef struct VkPhysicalDeviceFragmentDensityMapPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D minFragmentDensityTexelSize; - VkExtent2D maxFragmentDensityTexelSize; - VkBool32 fragmentDensityInvocations; -} VkPhysicalDeviceFragmentDensityMapPropertiesEXT32; - -typedef struct VkPhysicalDeviceFragmentDensityMap2PropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 subsampledLoads; - VkBool32 subsampledCoarseReconstructionEarlyAccess; - uint32_t maxSubsampledArrayLayers; - uint32_t maxDescriptorSetSubsampledSamplers; -} VkPhysicalDeviceFragmentDensityMap2PropertiesEXT32; - -typedef struct VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D fragmentDensityOffsetGranularity; -} VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM32; - -typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderStageFlags cooperativeMatrixSupportedStages; -} VkPhysicalDeviceCooperativeMatrixPropertiesNV32; - -typedef struct VkPhysicalDevicePerformanceQueryPropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 allowCommandBufferQueryCopies; -} VkPhysicalDevicePerformanceQueryPropertiesKHR32; - -typedef struct VkPhysicalDeviceShaderSMBuiltinsPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t shaderSMCount; - uint32_t shaderWarpsPerSM; -} VkPhysicalDeviceShaderSMBuiltinsPropertiesNV32; - -typedef struct VkPhysicalDeviceTexelBufferAlignmentProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) storageTexelBufferOffsetAlignmentBytes; - VkBool32 storageTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) uniformTexelBufferOffsetAlignmentBytes; - VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; -} VkPhysicalDeviceTexelBufferAlignmentProperties32; -typedef VkPhysicalDeviceTexelBufferAlignmentProperties32 VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT32; - -typedef struct VkPhysicalDeviceSubgroupSizeControlProperties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; - uint32_t maxComputeWorkgroupSubgroups; - VkShaderStageFlags requiredSubgroupSizeStages; -} VkPhysicalDeviceSubgroupSizeControlProperties32; -typedef VkPhysicalDeviceSubgroupSizeControlProperties32 VkPhysicalDeviceSubgroupSizeControlPropertiesEXT32; - -typedef struct VkPhysicalDeviceSubpassShadingPropertiesHUAWEI32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxSubpassShadingWorkgroupSizeAspectRatio; -} VkPhysicalDeviceSubpassShadingPropertiesHUAWEI32; - -typedef struct VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxWorkGroupCount[3]; - uint32_t maxWorkGroupSize[3]; - uint32_t maxOutputClusterCount; - VkDeviceSize DECLSPEC_ALIGN(8) indirectBufferOffsetAlignment; -} VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI32; - -typedef struct VkPhysicalDeviceLineRasterizationPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t lineSubPixelPrecisionBits; -} VkPhysicalDeviceLineRasterizationPropertiesEXT32; - -typedef struct VkPhysicalDeviceVulkan11Properties32 -{ - VkStructureType sType; - PTR32 pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; - uint32_t subgroupSize; - VkShaderStageFlags subgroupSupportedStages; - VkSubgroupFeatureFlags subgroupSupportedOperations; - VkBool32 subgroupQuadOperationsInAllStages; - VkPointClippingBehavior pointClippingBehavior; - uint32_t maxMultiviewViewCount; - uint32_t maxMultiviewInstanceIndex; - VkBool32 protectedNoFault; - uint32_t maxPerSetDescriptors; - VkDeviceSize DECLSPEC_ALIGN(8) maxMemoryAllocationSize; -} VkPhysicalDeviceVulkan11Properties32; - -typedef struct VkPhysicalDeviceVulkan12Properties32 -{ - VkStructureType sType; - PTR32 pNext; - VkDriverId driverID; - char driverName[VK_MAX_DRIVER_NAME_SIZE]; - char driverInfo[VK_MAX_DRIVER_INFO_SIZE]; - VkConformanceVersion conformanceVersion; - VkShaderFloatControlsIndependence denormBehaviorIndependence; - VkShaderFloatControlsIndependence roundingModeIndependence; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; - uint32_t maxUpdateAfterBindDescriptorsInAllPools; - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; - VkBool32 shaderSampledImageArrayNonUniformIndexingNative; - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; - VkBool32 shaderStorageImageArrayNonUniformIndexingNative; - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; - VkBool32 robustBufferAccessUpdateAfterBind; - VkBool32 quadDivergentImplicitLod; - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; - uint32_t maxPerStageUpdateAfterBindResources; - uint32_t maxDescriptorSetUpdateAfterBindSamplers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindSampledImages; - uint32_t maxDescriptorSetUpdateAfterBindStorageImages; - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; - VkResolveModeFlags supportedDepthResolveModes; - VkResolveModeFlags supportedStencilResolveModes; - VkBool32 independentResolveNone; - VkBool32 independentResolve; - VkBool32 filterMinmaxSingleComponentFormats; - VkBool32 filterMinmaxImageComponentMapping; - uint64_t DECLSPEC_ALIGN(8) maxTimelineSemaphoreValueDifference; - VkSampleCountFlags framebufferIntegerColorSampleCounts; -} VkPhysicalDeviceVulkan12Properties32; - -typedef struct VkPhysicalDeviceVulkan13Properties32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; - uint32_t maxComputeWorkgroupSubgroups; - VkShaderStageFlags requiredSubgroupSizeStages; - uint32_t maxInlineUniformBlockSize; - uint32_t maxPerStageDescriptorInlineUniformBlocks; - uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - uint32_t maxDescriptorSetInlineUniformBlocks; - uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; - uint32_t maxInlineUniformTotalSize; - VkBool32 integerDotProduct8BitUnsignedAccelerated; - VkBool32 integerDotProduct8BitSignedAccelerated; - VkBool32 integerDotProduct8BitMixedSignednessAccelerated; - VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProduct16BitUnsignedAccelerated; - VkBool32 integerDotProduct16BitSignedAccelerated; - VkBool32 integerDotProduct16BitMixedSignednessAccelerated; - VkBool32 integerDotProduct32BitUnsignedAccelerated; - VkBool32 integerDotProduct32BitSignedAccelerated; - VkBool32 integerDotProduct32BitMixedSignednessAccelerated; - VkBool32 integerDotProduct64BitUnsignedAccelerated; - VkBool32 integerDotProduct64BitSignedAccelerated; - VkBool32 integerDotProduct64BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; - VkDeviceSize DECLSPEC_ALIGN(8) storageTexelBufferOffsetAlignmentBytes; - VkBool32 storageTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) uniformTexelBufferOffsetAlignmentBytes; - VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) maxBufferSize; -} VkPhysicalDeviceVulkan13Properties32; - -typedef struct VkPhysicalDeviceCustomBorderColorPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxCustomBorderColorSamplers; -} VkPhysicalDeviceCustomBorderColorPropertiesEXT32; - -typedef struct VkPhysicalDeviceExtendedDynamicState3PropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 dynamicPrimitiveTopologyUnrestricted; -} VkPhysicalDeviceExtendedDynamicState3PropertiesEXT32; - -typedef struct VkPhysicalDeviceRobustness2PropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) robustStorageBufferAccessSizeAlignment; - VkDeviceSize DECLSPEC_ALIGN(8) robustUniformBufferAccessSizeAlignment; -} VkPhysicalDeviceRobustness2PropertiesEXT32; - -typedef struct VkPhysicalDeviceFragmentShadingRatePropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D minFragmentShadingRateAttachmentTexelSize; - VkExtent2D maxFragmentShadingRateAttachmentTexelSize; - uint32_t maxFragmentShadingRateAttachmentTexelSizeAspectRatio; - VkBool32 primitiveFragmentShadingRateWithMultipleViewports; - VkBool32 layeredShadingRateAttachments; - VkBool32 fragmentShadingRateNonTrivialCombinerOps; - VkExtent2D maxFragmentSize; - uint32_t maxFragmentSizeAspectRatio; - uint32_t maxFragmentShadingRateCoverageSamples; - VkSampleCountFlagBits maxFragmentShadingRateRasterizationSamples; - VkBool32 fragmentShadingRateWithShaderDepthStencilWrites; - VkBool32 fragmentShadingRateWithSampleMask; - VkBool32 fragmentShadingRateWithShaderSampleMask; - VkBool32 fragmentShadingRateWithConservativeRasterization; - VkBool32 fragmentShadingRateWithFragmentShaderInterlock; - VkBool32 fragmentShadingRateWithCustomSampleLocations; - VkBool32 fragmentShadingRateStrictMultiplyCombiner; -} VkPhysicalDeviceFragmentShadingRatePropertiesKHR32; - -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkSampleCountFlagBits maxFragmentShadingRateInvocationCount; -} VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV32; - -typedef struct VkPhysicalDeviceHostImageCopyPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t copySrcLayoutCount; - PTR32 pCopySrcLayouts; - uint32_t copyDstLayoutCount; - PTR32 pCopyDstLayouts; - uint8_t optimalTilingLayoutUUID[VK_UUID_SIZE]; - VkBool32 identicalMemoryTypeRequirements; -} VkPhysicalDeviceHostImageCopyPropertiesEXT32; - -typedef struct VkPhysicalDeviceProvokingVertexPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 provokingVertexModePerPipeline; - VkBool32 transformFeedbackPreservesTriangleFanProvokingVertex; -} VkPhysicalDeviceProvokingVertexPropertiesEXT32; - -typedef struct VkPhysicalDeviceDescriptorBufferPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 combinedImageSamplerDescriptorSingleArray; - VkBool32 bufferlessPushDescriptors; - VkBool32 allowSamplerImageViewPostSubmitCreation; - VkDeviceSize DECLSPEC_ALIGN(8) descriptorBufferOffsetAlignment; - uint32_t maxDescriptorBufferBindings; - uint32_t maxResourceDescriptorBufferBindings; - uint32_t maxSamplerDescriptorBufferBindings; - uint32_t maxEmbeddedImmutableSamplerBindings; - uint32_t maxEmbeddedImmutableSamplers; - PTR32 bufferCaptureReplayDescriptorDataSize; - PTR32 imageCaptureReplayDescriptorDataSize; - PTR32 imageViewCaptureReplayDescriptorDataSize; - PTR32 samplerCaptureReplayDescriptorDataSize; - PTR32 accelerationStructureCaptureReplayDescriptorDataSize; - PTR32 samplerDescriptorSize; - PTR32 combinedImageSamplerDescriptorSize; - PTR32 sampledImageDescriptorSize; - PTR32 storageImageDescriptorSize; - PTR32 uniformTexelBufferDescriptorSize; - PTR32 robustUniformTexelBufferDescriptorSize; - PTR32 storageTexelBufferDescriptorSize; - PTR32 robustStorageTexelBufferDescriptorSize; - PTR32 uniformBufferDescriptorSize; - PTR32 robustUniformBufferDescriptorSize; - PTR32 storageBufferDescriptorSize; - PTR32 robustStorageBufferDescriptorSize; - PTR32 inputAttachmentDescriptorSize; - PTR32 accelerationStructureDescriptorSize; - VkDeviceSize DECLSPEC_ALIGN(8) maxSamplerDescriptorBufferRange; - VkDeviceSize DECLSPEC_ALIGN(8) maxResourceDescriptorBufferRange; - VkDeviceSize DECLSPEC_ALIGN(8) samplerDescriptorBufferAddressSpaceSize; - VkDeviceSize DECLSPEC_ALIGN(8) resourceDescriptorBufferAddressSpaceSize; - VkDeviceSize DECLSPEC_ALIGN(8) descriptorBufferAddressSpaceSize; -} VkPhysicalDeviceDescriptorBufferPropertiesEXT32; - -typedef struct VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 combinedImageSamplerDensityMapDescriptorSize; -} VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT32; - -typedef struct VkPhysicalDeviceShaderIntegerDotProductProperties32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 integerDotProduct8BitUnsignedAccelerated; - VkBool32 integerDotProduct8BitSignedAccelerated; - VkBool32 integerDotProduct8BitMixedSignednessAccelerated; - VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProduct16BitUnsignedAccelerated; - VkBool32 integerDotProduct16BitSignedAccelerated; - VkBool32 integerDotProduct16BitMixedSignednessAccelerated; - VkBool32 integerDotProduct32BitUnsignedAccelerated; - VkBool32 integerDotProduct32BitSignedAccelerated; - VkBool32 integerDotProduct32BitMixedSignednessAccelerated; - VkBool32 integerDotProduct64BitUnsignedAccelerated; - VkBool32 integerDotProduct64BitSignedAccelerated; - VkBool32 integerDotProduct64BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; -} VkPhysicalDeviceShaderIntegerDotProductProperties32; -typedef VkPhysicalDeviceShaderIntegerDotProductProperties32 VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR32; - -typedef struct VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 triStripVertexOrderIndependentOfProvokingVertex; -} VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR32; - -typedef struct VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 graphicsPipelineLibraryFastLinking; - VkBool32 graphicsPipelineLibraryIndependentInterpolationDecoration; -} VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT32; - -typedef struct VkPhysicalDeviceNestedCommandBufferPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxCommandBufferNestingLevel; -} VkPhysicalDeviceNestedCommandBufferPropertiesEXT32; - -typedef struct VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint8_t shaderModuleIdentifierAlgorithmUUID[VK_UUID_SIZE]; -} VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT32; - -typedef struct VkPhysicalDeviceOpacityMicromapPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxOpacity2StateSubdivisionLevel; - uint32_t maxOpacity4StateSubdivisionLevel; -} VkPhysicalDeviceOpacityMicromapPropertiesEXT32; - -typedef struct VkPhysicalDevicePipelineRobustnessPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessStorageBuffers; - VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessUniformBuffers; - VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessVertexInputs; - VkPipelineRobustnessImageBehaviorEXT defaultRobustnessImages; -} VkPhysicalDevicePipelineRobustnessPropertiesEXT32; - -typedef struct VkPhysicalDeviceImageProcessingPropertiesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t maxWeightFilterPhases; - VkExtent2D maxWeightFilterDimension; - VkExtent2D maxBlockMatchRegion; - VkExtent2D maxBoxFilterBlockSize; -} VkPhysicalDeviceImageProcessingPropertiesQCOM32; - -typedef struct VkPhysicalDeviceOpticalFlowPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkOpticalFlowGridSizeFlagsNV supportedOutputGridSizes; - VkOpticalFlowGridSizeFlagsNV supportedHintGridSizes; - VkBool32 hintSupported; - VkBool32 costSupported; - VkBool32 bidirectionalFlowSupported; - VkBool32 globalFlowSupported; - uint32_t minWidth; - uint32_t minHeight; - uint32_t maxWidth; - uint32_t maxHeight; - uint32_t maxNumRegionsOfInterest; -} VkPhysicalDeviceOpticalFlowPropertiesNV32; - -typedef struct VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) shaderCoreMask; - uint32_t shaderCoreCount; - uint32_t shaderWarpsPerCore; -} VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM32; - -typedef struct VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkRayTracingInvocationReorderModeNV rayTracingInvocationReorderReorderingHint; -} VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV32; - -typedef struct VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceSize DECLSPEC_ALIGN(8) extendedSparseAddressSpaceSize; - VkImageUsageFlags extendedSparseImageUsageFlags; - VkBufferUsageFlags extendedSparseBufferUsageFlags; -} VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV32; - -typedef struct VkPhysicalDeviceShaderCorePropertiesARM32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t pixelRate; - uint32_t texelRate; - uint32_t fmaRate; -} VkPhysicalDeviceShaderCorePropertiesARM32; - -typedef struct VkPhysicalDeviceShaderObjectPropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint8_t shaderBinaryUUID[VK_UUID_SIZE]; - uint32_t shaderBinaryVersion; -} VkPhysicalDeviceShaderObjectPropertiesEXT32; - -typedef struct VkPhysicalDeviceShaderTileImagePropertiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 shaderTileImageCoherentReadAccelerated; - VkBool32 shaderTileImageReadSampleFromPixelRateInvocation; - VkBool32 shaderTileImageReadFromHelperInvocation; -} VkPhysicalDeviceShaderTileImagePropertiesEXT32; - -typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderStageFlags cooperativeMatrixSupportedStages; -} VkPhysicalDeviceCooperativeMatrixPropertiesKHR32; - -typedef struct VkPhysicalDeviceImageProcessing2PropertiesQCOM32 -{ - VkStructureType sType; - PTR32 pNext; - VkExtent2D maxBlockMatchWindow; -} VkPhysicalDeviceImageProcessing2PropertiesQCOM32; - -typedef struct VkPhysicalDeviceLayeredDriverPropertiesMSFT32 -{ - VkStructureType sType; - PTR32 pNext; - VkLayeredDriverUnderlyingApiMSFT underlyingAPI; -} VkPhysicalDeviceLayeredDriverPropertiesMSFT32; - -typedef struct VkPhysicalDeviceCudaKernelLaunchPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t computeCapabilityMinor; - uint32_t computeCapabilityMajor; -} VkPhysicalDeviceCudaKernelLaunchPropertiesNV32; - -typedef struct VkPhysicalDeviceSchedulingControlsPropertiesARM32 -{ - VkStructureType sType; - PTR32 pNext; - VkPhysicalDeviceSchedulingControlsFlagsARM DECLSPEC_ALIGN(8) schedulingControlsFlags; -} VkPhysicalDeviceSchedulingControlsPropertiesARM32; - -typedef struct VkPhysicalDeviceProperties232 -{ - VkStructureType sType; - PTR32 pNext; - VkPhysicalDeviceProperties32 DECLSPEC_ALIGN(8) properties; -} VkPhysicalDeviceProperties232; -typedef VkPhysicalDeviceProperties232 VkPhysicalDeviceProperties2KHR32; - -typedef struct VkQueueFamilyGlobalPriorityPropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t priorityCount; - VkQueueGlobalPriorityKHR priorities[VK_MAX_GLOBAL_PRIORITY_SIZE_KHR]; -} VkQueueFamilyGlobalPriorityPropertiesKHR32; -typedef VkQueueFamilyGlobalPriorityPropertiesKHR32 VkQueueFamilyGlobalPriorityPropertiesEXT32; - -typedef struct VkQueueFamilyCheckpointPropertiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlags checkpointExecutionStageMask; -} VkQueueFamilyCheckpointPropertiesNV32; - -typedef struct VkQueueFamilyCheckpointProperties2NV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) checkpointExecutionStageMask; -} VkQueueFamilyCheckpointProperties2NV32; - -typedef struct VkQueueFamilyProperties232 -{ - VkStructureType sType; - PTR32 pNext; - VkQueueFamilyProperties queueFamilyProperties; -} VkQueueFamilyProperties232; -typedef VkQueueFamilyProperties232 VkQueueFamilyProperties2KHR32; - -typedef struct VkPhysicalDeviceSparseImageFormatInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkFormat format; - VkImageType type; - VkSampleCountFlagBits samples; - VkImageUsageFlags usage; - VkImageTiling tiling; -} VkPhysicalDeviceSparseImageFormatInfo232; -typedef VkPhysicalDeviceSparseImageFormatInfo232 VkPhysicalDeviceSparseImageFormatInfo2KHR32; - -typedef struct VkSparseImageFormatProperties232 -{ - VkStructureType sType; - PTR32 pNext; - VkSparseImageFormatProperties properties; -} VkSparseImageFormatProperties232; -typedef VkSparseImageFormatProperties232 VkSparseImageFormatProperties2KHR32; - -typedef struct VkFramebufferMixedSamplesCombinationNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkCoverageReductionModeNV coverageReductionMode; - VkSampleCountFlagBits rasterizationSamples; - VkSampleCountFlags depthStencilSamples; - VkSampleCountFlags colorSamples; -} VkFramebufferMixedSamplesCombinationNV32; - -typedef struct VkSurfacePresentModeEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPresentModeKHR presentMode; -} VkSurfacePresentModeEXT32; - -typedef struct VkPhysicalDeviceSurfaceInfo2KHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; -} VkPhysicalDeviceSurfaceInfo2KHR32; - -typedef struct VkSurfaceCapabilitiesPresentBarrierNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 presentBarrierSupported; -} VkSurfaceCapabilitiesPresentBarrierNV32; - -typedef struct VkSurfacePresentScalingCapabilitiesEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkPresentScalingFlagsEXT supportedPresentScaling; - VkPresentGravityFlagsEXT supportedPresentGravityX; - VkPresentGravityFlagsEXT supportedPresentGravityY; - VkExtent2D minScaledImageExtent; - VkExtent2D maxScaledImageExtent; -} VkSurfacePresentScalingCapabilitiesEXT32; - -typedef struct VkSurfacePresentModeCompatibilityEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t presentModeCount; - PTR32 pPresentModes; -} VkSurfacePresentModeCompatibilityEXT32; - -typedef struct VkLatencySurfaceCapabilitiesNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t presentModeCount; - PTR32 pPresentModes; -} VkLatencySurfaceCapabilitiesNV32; - -typedef struct VkSurfaceCapabilities2KHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSurfaceCapabilitiesKHR surfaceCapabilities; -} VkSurfaceCapabilities2KHR32; - -typedef struct VkSurfaceFormat2KHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkSurfaceFormatKHR surfaceFormat; -} VkSurfaceFormat2KHR32; - -typedef struct VkPhysicalDeviceToolProperties32 -{ - VkStructureType sType; - PTR32 pNext; - char name[VK_MAX_EXTENSION_NAME_SIZE]; - char version[VK_MAX_EXTENSION_NAME_SIZE]; - VkToolPurposeFlags purposes; - char description[VK_MAX_DESCRIPTION_SIZE]; - char layer[VK_MAX_EXTENSION_NAME_SIZE]; -} VkPhysicalDeviceToolProperties32; -typedef VkPhysicalDeviceToolProperties32 VkPhysicalDeviceToolPropertiesEXT32; - -typedef struct VkPipelineExecutableInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t executableIndex; -} VkPipelineExecutableInfoKHR32; - -typedef struct VkPipelineExecutableInternalRepresentationKHR32 -{ - VkStructureType sType; - PTR32 pNext; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkBool32 isText; - PTR32 dataSize; - PTR32 pData; -} VkPipelineExecutableInternalRepresentationKHR32; - -typedef struct VkPipelineInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipeline DECLSPEC_ALIGN(8) pipeline; -} VkPipelineInfoKHR32; -typedef VkPipelineInfoKHR32 VkPipelineInfoEXT32; - -typedef struct VkPipelineExecutablePropertiesKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkShaderStageFlags stages; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - uint32_t subgroupSize; -} VkPipelineExecutablePropertiesKHR32; - -typedef union VkPipelineExecutableStatisticValueKHR32 -{ - VkBool32 b32; - int64_t i64; - uint64_t DECLSPEC_ALIGN(8) u64; - double f64; -} VkPipelineExecutableStatisticValueKHR32; - -typedef struct VkPipelineExecutableStatisticKHR32 -{ - VkStructureType sType; - PTR32 pNext; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkPipelineExecutableStatisticFormatKHR format; - VkPipelineExecutableStatisticValueKHR32 DECLSPEC_ALIGN(8) value; -} VkPipelineExecutableStatisticKHR32; - -typedef struct VkPipelineIndirectDeviceAddressInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; -} VkPipelineIndirectDeviceAddressInfoNV32; - - -typedef struct VkCheckpointData2NV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - PTR32 pCheckpointMarker; -} VkCheckpointData2NV32; - -typedef struct VkCheckpointDataNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkPipelineStageFlagBits stage; - PTR32 pCheckpointMarker; -} VkCheckpointDataNV32; - -typedef struct VkRenderingAreaInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t viewMask; - uint32_t colorAttachmentCount; - PTR32 pColorAttachmentFormats; - VkFormat depthAttachmentFormat; - VkFormat stencilAttachmentFormat; -} VkRenderingAreaInfoKHR32; - -typedef struct VkSamplerCaptureDescriptorDataInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkSampler DECLSPEC_ALIGN(8) sampler; -} VkSamplerCaptureDescriptorDataInfoEXT32; - -typedef struct VkShaderModuleIdentifierEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t identifierSize; - uint8_t identifier[VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT]; -} VkShaderModuleIdentifierEXT32; - -typedef struct VkInitializePerformanceApiInfoINTEL32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pUserData; -} VkInitializePerformanceApiInfoINTEL32; - -typedef struct VkLatencySleepInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkSemaphore DECLSPEC_ALIGN(8) signalSemaphore; - uint64_t DECLSPEC_ALIGN(8) value; -} VkLatencySleepInfoNV32; - -typedef struct VkMemoryMapInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkMemoryMapFlags flags; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; -} VkMemoryMapInfoKHR32; - -typedef struct VkSparseMemoryBind32 -{ - VkDeviceSize DECLSPEC_ALIGN(8) resourceOffset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - VkSparseMemoryBindFlags flags; -} VkSparseMemoryBind32; - -typedef struct VkSparseBufferMemoryBindInfo32 -{ - VkBuffer DECLSPEC_ALIGN(8) buffer; - uint32_t bindCount; - PTR32 pBinds; -} VkSparseBufferMemoryBindInfo32; - -typedef struct VkSparseImageOpaqueMemoryBindInfo32 -{ - VkImage DECLSPEC_ALIGN(8) image; - uint32_t bindCount; - PTR32 pBinds; -} VkSparseImageOpaqueMemoryBindInfo32; - -typedef struct VkSparseImageMemoryBind32 -{ - VkImageSubresource subresource; - VkOffset3D offset; - VkExtent3D extent; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - VkSparseMemoryBindFlags flags; -} VkSparseImageMemoryBind32; - -typedef struct VkSparseImageMemoryBindInfo32 -{ - VkImage DECLSPEC_ALIGN(8) image; - uint32_t bindCount; - PTR32 pBinds; -} VkSparseImageMemoryBindInfo32; - -typedef struct VkDeviceGroupBindSparseInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t resourceDeviceIndex; - uint32_t memoryDeviceIndex; -} VkDeviceGroupBindSparseInfo32; -typedef VkDeviceGroupBindSparseInfo32 VkDeviceGroupBindSparseInfoKHR32; - -typedef struct VkTimelineSemaphoreSubmitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t waitSemaphoreValueCount; - PTR32 pWaitSemaphoreValues; - uint32_t signalSemaphoreValueCount; - PTR32 pSignalSemaphoreValues; -} VkTimelineSemaphoreSubmitInfo32; -typedef VkTimelineSemaphoreSubmitInfo32 VkTimelineSemaphoreSubmitInfoKHR32; - -typedef struct VkFrameBoundaryEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkFrameBoundaryFlagsEXT flags; - uint64_t DECLSPEC_ALIGN(8) frameID; - uint32_t imageCount; - PTR32 pImages; - uint32_t bufferCount; - PTR32 pBuffers; - uint64_t DECLSPEC_ALIGN(8) tagName; - PTR32 tagSize; - PTR32 pTag; -} VkFrameBoundaryEXT32; - -typedef struct VkBindSparseInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t waitSemaphoreCount; - PTR32 pWaitSemaphores; - uint32_t bufferBindCount; - PTR32 pBufferBinds; - uint32_t imageOpaqueBindCount; - PTR32 pImageOpaqueBinds; - uint32_t imageBindCount; - PTR32 pImageBinds; - uint32_t signalSemaphoreCount; - PTR32 pSignalSemaphores; -} VkBindSparseInfo32; - -typedef struct VkOutOfBandQueueTypeInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkOutOfBandQueueTypeNV queueType; -} VkOutOfBandQueueTypeInfoNV32; - -typedef struct VkPresentRegionKHR32 -{ - uint32_t rectangleCount; - PTR32 pRectangles; -} VkPresentRegionKHR32; - -typedef struct VkPresentRegionsKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t swapchainCount; - PTR32 pRegions; -} VkPresentRegionsKHR32; - -typedef struct VkDeviceGroupPresentInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t swapchainCount; - PTR32 pDeviceMasks; - VkDeviceGroupPresentModeFlagBitsKHR mode; -} VkDeviceGroupPresentInfoKHR32; - -typedef struct VkPresentIdKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t swapchainCount; - PTR32 pPresentIds; -} VkPresentIdKHR32; - -typedef struct VkSwapchainPresentFenceInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t swapchainCount; - PTR32 pFences; -} VkSwapchainPresentFenceInfoEXT32; - -typedef struct VkSwapchainPresentModeInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t swapchainCount; - PTR32 pPresentModes; -} VkSwapchainPresentModeInfoEXT32; - -typedef struct VkPresentInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t waitSemaphoreCount; - PTR32 pWaitSemaphores; - uint32_t swapchainCount; - PTR32 pSwapchains; - PTR32 pImageIndices; - PTR32 pResults; -} VkPresentInfoKHR32; - -typedef struct VkDeviceGroupSubmitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t waitSemaphoreCount; - PTR32 pWaitSemaphoreDeviceIndices; - uint32_t commandBufferCount; - PTR32 pCommandBufferDeviceMasks; - uint32_t signalSemaphoreCount; - PTR32 pSignalSemaphoreDeviceIndices; -} VkDeviceGroupSubmitInfo32; -typedef VkDeviceGroupSubmitInfo32 VkDeviceGroupSubmitInfoKHR32; - -typedef struct VkProtectedSubmitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 protectedSubmit; -} VkProtectedSubmitInfo32; - -typedef struct VkPerformanceQuerySubmitInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t counterPassIndex; -} VkPerformanceQuerySubmitInfoKHR32; - -typedef struct VkLatencySubmissionPresentIdNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) presentID; -} VkLatencySubmissionPresentIdNV32; - -typedef struct VkSubmitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - uint32_t waitSemaphoreCount; - PTR32 pWaitSemaphores; - PTR32 pWaitDstStageMask; - uint32_t commandBufferCount; - PTR32 pCommandBuffers; - uint32_t signalSemaphoreCount; - PTR32 pSignalSemaphores; -} VkSubmitInfo32; - -typedef struct VkSemaphoreSubmitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - uint64_t DECLSPEC_ALIGN(8) value; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stageMask; - uint32_t deviceIndex; -} VkSemaphoreSubmitInfo32; -typedef VkSemaphoreSubmitInfo32 VkSemaphoreSubmitInfoKHR32; - -typedef struct VkCommandBufferSubmitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 commandBuffer; - uint32_t deviceMask; -} VkCommandBufferSubmitInfo32; -typedef VkCommandBufferSubmitInfo32 VkCommandBufferSubmitInfoKHR32; - -typedef struct VkSubmitInfo232 -{ - VkStructureType sType; - PTR32 pNext; - VkSubmitFlags flags; - uint32_t waitSemaphoreInfoCount; - PTR32 pWaitSemaphoreInfos; - uint32_t commandBufferInfoCount; - PTR32 pCommandBufferInfos; - uint32_t signalSemaphoreInfoCount; - PTR32 pSignalSemaphoreInfos; -} VkSubmitInfo232; -typedef VkSubmitInfo232 VkSubmitInfo2KHR32; - -typedef struct VkReleaseSwapchainImagesInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint32_t imageIndexCount; - PTR32 pImageIndices; -} VkReleaseSwapchainImagesInfoEXT32; - -typedef struct VkDebugUtilsObjectTagInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - uint64_t DECLSPEC_ALIGN(8) tagName; - PTR32 tagSize; - PTR32 pTag; -} VkDebugUtilsObjectTagInfoEXT32; - -typedef struct VkHdrMetadataEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkXYColorEXT displayPrimaryRed; - VkXYColorEXT displayPrimaryGreen; - VkXYColorEXT displayPrimaryBlue; - VkXYColorEXT whitePoint; - float maxLuminance; - float minLuminance; - float maxContentLightLevel; - float maxFrameAverageLightLevel; -} VkHdrMetadataEXT32; - -typedef struct VkSetLatencyMarkerInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - uint64_t DECLSPEC_ALIGN(8) presentID; - VkLatencyMarkerNV marker; -} VkSetLatencyMarkerInfoNV32; - -typedef struct VkLatencySleepModeInfoNV32 -{ - VkStructureType sType; - PTR32 pNext; - VkBool32 lowLatencyMode; - VkBool32 lowLatencyBoost; - uint32_t minimumIntervalUs; -} VkLatencySleepModeInfoNV32; - -typedef struct VkSemaphoreSignalInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - uint64_t DECLSPEC_ALIGN(8) value; -} VkSemaphoreSignalInfo32; -typedef VkSemaphoreSignalInfo32 VkSemaphoreSignalInfoKHR32; - -typedef struct VkDeviceAddressBindingCallbackDataEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDeviceAddressBindingFlagsEXT flags; - VkDeviceAddress DECLSPEC_ALIGN(8) baseAddress; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkDeviceAddressBindingTypeEXT bindingType; -} VkDeviceAddressBindingCallbackDataEXT32; - -typedef struct VkDebugUtilsMessengerCallbackDataEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDebugUtilsMessengerCallbackDataFlagsEXT flags; - PTR32 pMessageIdName; - int32_t messageIdNumber; - PTR32 pMessage; - uint32_t queueLabelCount; - PTR32 pQueueLabels; - uint32_t cmdBufLabelCount; - PTR32 pCmdBufLabels; - uint32_t objectCount; - PTR32 pObjects; -} VkDebugUtilsMessengerCallbackDataEXT32; - -typedef struct VkHostImageLayoutTransitionInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkImage DECLSPEC_ALIGN(8) image; - VkImageLayout oldLayout; - VkImageLayout newLayout; - VkImageSubresourceRange subresourceRange; -} VkHostImageLayoutTransitionInfoEXT32; - -typedef struct VkMemoryUnmapInfoKHR32 -{ - VkStructureType sType; - PTR32 pNext; - VkMemoryUnmapFlagsKHR flags; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; -} VkMemoryUnmapInfoKHR32; - -typedef struct VkCopyDescriptorSet32 -{ - VkStructureType sType; - PTR32 pNext; - VkDescriptorSet DECLSPEC_ALIGN(8) srcSet; - uint32_t srcBinding; - uint32_t srcArrayElement; - VkDescriptorSet DECLSPEC_ALIGN(8) dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; -} VkCopyDescriptorSet32; - -typedef struct VkSemaphoreWaitInfo32 -{ - VkStructureType sType; - PTR32 pNext; - VkSemaphoreWaitFlags flags; - uint32_t semaphoreCount; - PTR32 pSemaphores; - PTR32 pValues; -} VkSemaphoreWaitInfo32; -typedef VkSemaphoreWaitInfo32 VkSemaphoreWaitInfoKHR32; - -static uint64_t wine_vk_unwrap_handle(uint32_t type, uint64_t handle) -{ - switch(type) - { - case VK_OBJECT_TYPE_COMMAND_BUFFER: - return (uint64_t) (uintptr_t) wine_cmd_buffer_from_handle(((VkCommandBuffer) (uintptr_t) handle))->host_command_buffer; - case VK_OBJECT_TYPE_COMMAND_POOL: - return (uint64_t) wine_cmd_pool_from_handle(handle)->host_command_pool; - case VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT: - return (uint64_t) wine_debug_report_callback_from_handle(handle)->host_debug_callback; - case VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT: - return (uint64_t) wine_debug_utils_messenger_from_handle(handle)->host_debug_messenger; - case VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR: - return (uint64_t) wine_deferred_operation_from_handle(handle)->host_deferred_operation; - case VK_OBJECT_TYPE_DEVICE: - return (uint64_t) (uintptr_t) wine_device_from_handle(((VkDevice) (uintptr_t) handle))->host_device; - case VK_OBJECT_TYPE_DEVICE_MEMORY: - return (uint64_t) wine_device_memory_from_handle(handle)->host_memory; - case VK_OBJECT_TYPE_INSTANCE: - return (uint64_t) (uintptr_t) wine_instance_from_handle(((VkInstance) (uintptr_t) handle))->host_instance; - case VK_OBJECT_TYPE_PHYSICAL_DEVICE: - return (uint64_t) (uintptr_t) wine_phys_dev_from_handle(((VkPhysicalDevice) (uintptr_t) handle))->host_physical_device; - case VK_OBJECT_TYPE_QUEUE: - return (uint64_t) (uintptr_t) wine_queue_from_handle(((VkQueue) (uintptr_t) handle))->host_queue; - case VK_OBJECT_TYPE_SURFACE_KHR: - return (uint64_t) wine_surface_from_handle(handle)->host_surface; - default: - return handle; - } -} - -static inline void convert_VkAcquireNextImageInfoKHR_win32_to_host(const VkAcquireNextImageInfoKHR32 *in, VkAcquireNextImageInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->swapchain = in->swapchain; - out->timeout = in->timeout; - out->semaphore = in->semaphore; - out->fence = in->fence; - out->deviceMask = in->deviceMask; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPerformanceConfigurationAcquireInfoINTEL_win32_to_host(const VkPerformanceConfigurationAcquireInfoINTEL32 *in, VkPerformanceConfigurationAcquireInfoINTEL *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAcquireProfilingLockInfoKHR_win32_to_host(const VkAcquireProfilingLockInfoKHR32 *in, VkAcquireProfilingLockInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->timeout = in->timeout; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCommandBufferAllocateInfo_win32_to_unwrapped_host(const VkCommandBufferAllocateInfo32 *in, VkCommandBufferAllocateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->commandPool = in->commandPool; - out->level = in->level; - out->commandBufferCount = in->commandBufferCount; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline VkCommandBuffer *convert_VkCommandBuffer_array_win32_to_unwrapped_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count) -{ - VkCommandBuffer *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = UlongToPtr(in[i]); - } - - return out; -} - -static inline void convert_VkDescriptorSetAllocateInfo_win32_to_host(struct conversion_context *ctx, const VkDescriptorSetAllocateInfo32 *in, VkDescriptorSetAllocateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->descriptorPool = in->descriptorPool; - out->descriptorSetCount = in->descriptorSetCount; - out->pSetLayouts = (const VkDescriptorSetLayout *)UlongToPtr(in->pSetLayouts); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO: - { - VkDescriptorSetVariableDescriptorCountAllocateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDescriptorSetVariableDescriptorCountAllocateInfo32 *in_ext = (const VkDescriptorSetVariableDescriptorCountAllocateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO; - out_ext->pNext = NULL; - out_ext->descriptorSetCount = in_ext->descriptorSetCount; - out_ext->pDescriptorCounts = (const uint32_t *)UlongToPtr(in_ext->pDescriptorCounts); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkMemoryAllocateInfo_win32_to_host(struct conversion_context *ctx, const VkMemoryAllocateInfo32 *in, VkMemoryAllocateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->allocationSize = in->allocationSize; - out->memoryTypeIndex = in->memoryTypeIndex; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV: - { - VkDedicatedAllocationMemoryAllocateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDedicatedAllocationMemoryAllocateInfoNV32 *in_ext = (const VkDedicatedAllocationMemoryAllocateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->image = in_ext->image; - out_ext->buffer = in_ext->buffer; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO: - { - VkExportMemoryAllocateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExportMemoryAllocateInfo32 *in_ext = (const VkExportMemoryAllocateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO; - out_ext->pNext = NULL; - out_ext->handleTypes = in_ext->handleTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR: - { - VkImportMemoryWin32HandleInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImportMemoryWin32HandleInfoKHR32 *in_ext = (const VkImportMemoryWin32HandleInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->handleType = in_ext->handleType; - out_ext->handle = in_ext->handle; - out_ext->name = in_ext->name; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR: - { - VkExportMemoryWin32HandleInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExportMemoryWin32HandleInfoKHR32 *in_ext = (const VkExportMemoryWin32HandleInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->pAttributes = (const SECURITY_ATTRIBUTES *)UlongToPtr(in_ext->pAttributes); - out_ext->dwAccess = in_ext->dwAccess; - out_ext->name = in_ext->name; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO: - { - VkMemoryAllocateFlagsInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMemoryAllocateFlagsInfo32 *in_ext = (const VkMemoryAllocateFlagsInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->deviceMask = in_ext->deviceMask; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO: - { - VkMemoryDedicatedAllocateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMemoryDedicatedAllocateInfo32 *in_ext = (const VkMemoryDedicatedAllocateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO; - out_ext->pNext = NULL; - out_ext->image = in_ext->image; - out_ext->buffer = in_ext->buffer; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT: - { - VkImportMemoryHostPointerInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImportMemoryHostPointerInfoEXT32 *in_ext = (const VkImportMemoryHostPointerInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT; - out_ext->pNext = NULL; - out_ext->handleType = in_ext->handleType; - out_ext->pHostPointer = (void *)UlongToPtr(in_ext->pHostPointer); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT: - { - VkMemoryPriorityAllocateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMemoryPriorityAllocateInfoEXT32 *in_ext = (const VkMemoryPriorityAllocateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->priority = in_ext->priority; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO: - { - VkMemoryOpaqueCaptureAddressAllocateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMemoryOpaqueCaptureAddressAllocateInfo32 *in_ext = (const VkMemoryOpaqueCaptureAddressAllocateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO; - out_ext->pNext = NULL; - out_ext->opaqueCaptureAddress = in_ext->opaqueCaptureAddress; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkCommandBufferInheritanceInfo_win32_to_host(struct conversion_context *ctx, const VkCommandBufferInheritanceInfo32 *in, VkCommandBufferInheritanceInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->renderPass = in->renderPass; - out->subpass = in->subpass; - out->framebuffer = in->framebuffer; - out->occlusionQueryEnable = in->occlusionQueryEnable; - out->queryFlags = in->queryFlags; - out->pipelineStatistics = in->pipelineStatistics; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT: - { - VkCommandBufferInheritanceConditionalRenderingInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkCommandBufferInheritanceConditionalRenderingInfoEXT32 *in_ext = (const VkCommandBufferInheritanceConditionalRenderingInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT; - out_ext->pNext = NULL; - out_ext->conditionalRenderingEnable = in_ext->conditionalRenderingEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM: - { - VkCommandBufferInheritanceRenderPassTransformInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkCommandBufferInheritanceRenderPassTransformInfoQCOM32 *in_ext = (const VkCommandBufferInheritanceRenderPassTransformInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->transform = in_ext->transform; - out_ext->renderArea = in_ext->renderArea; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV: - { - VkCommandBufferInheritanceViewportScissorInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkCommandBufferInheritanceViewportScissorInfoNV32 *in_ext = (const VkCommandBufferInheritanceViewportScissorInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV; - out_ext->pNext = NULL; - out_ext->viewportScissor2D = in_ext->viewportScissor2D; - out_ext->viewportDepthCount = in_ext->viewportDepthCount; - out_ext->pViewportDepths = (const VkViewport *)UlongToPtr(in_ext->pViewportDepths); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO: - { - VkCommandBufferInheritanceRenderingInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkCommandBufferInheritanceRenderingInfo32 *in_ext = (const VkCommandBufferInheritanceRenderingInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->viewMask = in_ext->viewMask; - out_ext->colorAttachmentCount = in_ext->colorAttachmentCount; - out_ext->pColorAttachmentFormats = (const VkFormat *)UlongToPtr(in_ext->pColorAttachmentFormats); - out_ext->depthAttachmentFormat = in_ext->depthAttachmentFormat; - out_ext->stencilAttachmentFormat = in_ext->stencilAttachmentFormat; - out_ext->rasterizationSamples = in_ext->rasterizationSamples; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD: - { - VkAttachmentSampleCountInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAttachmentSampleCountInfoAMD32 *in_ext = (const VkAttachmentSampleCountInfoAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD; - out_ext->pNext = NULL; - out_ext->colorAttachmentCount = in_ext->colorAttachmentCount; - out_ext->pColorAttachmentSamples = (const VkSampleCountFlagBits *)UlongToPtr(in_ext->pColorAttachmentSamples); - out_ext->depthStencilAttachmentSamples = in_ext->depthStencilAttachmentSamples; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX: - { - VkMultiviewPerViewAttributesInfoNVX *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultiviewPerViewAttributesInfoNVX32 *in_ext = (const VkMultiviewPerViewAttributesInfoNVX32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX; - out_ext->pNext = NULL; - out_ext->perViewAttributes = in_ext->perViewAttributes; - out_ext->perViewAttributesPositionXOnly = in_ext->perViewAttributesPositionXOnly; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkCommandBufferInheritanceInfo *convert_VkCommandBufferInheritanceInfo_array_win32_to_host(struct conversion_context *ctx, const VkCommandBufferInheritanceInfo32 *in, uint32_t count) -{ - VkCommandBufferInheritanceInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCommandBufferInheritanceInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCommandBufferBeginInfo_win32_to_host(struct conversion_context *ctx, const VkCommandBufferBeginInfo32 *in, VkCommandBufferBeginInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pInheritanceInfo = convert_VkCommandBufferInheritanceInfo_array_win32_to_host(ctx, (const VkCommandBufferInheritanceInfo32 *)UlongToPtr(in->pInheritanceInfo), 1); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO: - { - VkDeviceGroupCommandBufferBeginInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupCommandBufferBeginInfo32 *in_ext = (const VkDeviceGroupCommandBufferBeginInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO; - out_ext->pNext = NULL; - out_ext->deviceMask = in_ext->deviceMask; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline void convert_VkBindAccelerationStructureMemoryInfoNV_win64_to_host(const VkBindAccelerationStructureMemoryInfoNV *in, VkBindAccelerationStructureMemoryInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->accelerationStructure = in->accelerationStructure; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->memoryOffset = in->memoryOffset; - out->deviceIndexCount = in->deviceIndexCount; - out->pDeviceIndices = in->pDeviceIndices; -} -#endif /* _WIN64 */ - -static inline void convert_VkBindAccelerationStructureMemoryInfoNV_win32_to_host(const VkBindAccelerationStructureMemoryInfoNV32 *in, VkBindAccelerationStructureMemoryInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->accelerationStructure = in->accelerationStructure; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->memoryOffset = in->memoryOffset; - out->deviceIndexCount = in->deviceIndexCount; - out->pDeviceIndices = (const uint32_t *)UlongToPtr(in->pDeviceIndices); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline const VkBindAccelerationStructureMemoryInfoNV *convert_VkBindAccelerationStructureMemoryInfoNV_array_win64_to_host(struct conversion_context *ctx, const VkBindAccelerationStructureMemoryInfoNV *in, uint32_t count) -{ - VkBindAccelerationStructureMemoryInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindAccelerationStructureMemoryInfoNV_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkBindAccelerationStructureMemoryInfoNV *convert_VkBindAccelerationStructureMemoryInfoNV_array_win32_to_host(struct conversion_context *ctx, const VkBindAccelerationStructureMemoryInfoNV32 *in, uint32_t count) -{ - VkBindAccelerationStructureMemoryInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindAccelerationStructureMemoryInfoNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkBindBufferMemoryInfo_win64_to_host(const VkBindBufferMemoryInfo *in, VkBindBufferMemoryInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->buffer = in->buffer; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->memoryOffset = in->memoryOffset; -} -#endif /* _WIN64 */ - -static inline void convert_VkBindBufferMemoryInfo_win32_to_host(struct conversion_context *ctx, const VkBindBufferMemoryInfo32 *in, VkBindBufferMemoryInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->buffer = in->buffer; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->memoryOffset = in->memoryOffset; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO: - { - VkBindBufferMemoryDeviceGroupInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBindBufferMemoryDeviceGroupInfo32 *in_ext = (const VkBindBufferMemoryDeviceGroupInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO; - out_ext->pNext = NULL; - out_ext->deviceIndexCount = in_ext->deviceIndexCount; - out_ext->pDeviceIndices = (const uint32_t *)UlongToPtr(in_ext->pDeviceIndices); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkBindBufferMemoryInfo *convert_VkBindBufferMemoryInfo_array_win64_to_host(struct conversion_context *ctx, const VkBindBufferMemoryInfo *in, uint32_t count) -{ - VkBindBufferMemoryInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindBufferMemoryInfo_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkBindBufferMemoryInfo *convert_VkBindBufferMemoryInfo_array_win32_to_host(struct conversion_context *ctx, const VkBindBufferMemoryInfo32 *in, uint32_t count) -{ - VkBindBufferMemoryInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindBufferMemoryInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkBindImageMemoryInfo_win64_to_host(const VkBindImageMemoryInfo *in, VkBindImageMemoryInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->image = in->image; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->memoryOffset = in->memoryOffset; -} -#endif /* _WIN64 */ - -static inline void convert_VkBindImageMemoryInfo_win32_to_host(struct conversion_context *ctx, const VkBindImageMemoryInfo32 *in, VkBindImageMemoryInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->image = in->image; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->memoryOffset = in->memoryOffset; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO: - { - VkBindImageMemoryDeviceGroupInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBindImageMemoryDeviceGroupInfo32 *in_ext = (const VkBindImageMemoryDeviceGroupInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO; - out_ext->pNext = NULL; - out_ext->deviceIndexCount = in_ext->deviceIndexCount; - out_ext->pDeviceIndices = (const uint32_t *)UlongToPtr(in_ext->pDeviceIndices); - out_ext->splitInstanceBindRegionCount = in_ext->splitInstanceBindRegionCount; - out_ext->pSplitInstanceBindRegions = (const VkRect2D *)UlongToPtr(in_ext->pSplitInstanceBindRegions); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: - { - VkBindImageMemorySwapchainInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBindImageMemorySwapchainInfoKHR32 *in_ext = (const VkBindImageMemorySwapchainInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR; - out_ext->pNext = NULL; - out_ext->swapchain = in_ext->swapchain; - out_ext->imageIndex = in_ext->imageIndex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO: - { - VkBindImagePlaneMemoryInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBindImagePlaneMemoryInfo32 *in_ext = (const VkBindImagePlaneMemoryInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO; - out_ext->pNext = NULL; - out_ext->planeAspect = in_ext->planeAspect; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkBindImageMemoryInfo *convert_VkBindImageMemoryInfo_array_win64_to_host(struct conversion_context *ctx, const VkBindImageMemoryInfo *in, uint32_t count) -{ - VkBindImageMemoryInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindImageMemoryInfo_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkBindImageMemoryInfo *convert_VkBindImageMemoryInfo_array_win32_to_host(struct conversion_context *ctx, const VkBindImageMemoryInfo32 *in, uint32_t count) -{ - VkBindImageMemoryInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindImageMemoryInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline const VkMicromapUsageEXT * const*convert_VkMicromapUsageEXT_pointer_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count) -{ - VkMicromapUsageEXT **out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = UlongToPtr(in[i]); - } - - return (void *)out; -} - -static inline void convert_VkAccelerationStructureGeometryTrianglesDataKHR_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureGeometryTrianglesDataKHR32 *in, VkAccelerationStructureGeometryTrianglesDataKHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->vertexFormat = in->vertexFormat; - out->vertexData = in->vertexData; - out->vertexStride = in->vertexStride; - out->maxVertex = in->maxVertex; - out->indexType = in->indexType; - out->indexData = in->indexData; - out->transformData = in->transformData; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_MOTION_TRIANGLES_DATA_NV: - { - VkAccelerationStructureGeometryMotionTrianglesDataNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAccelerationStructureGeometryMotionTrianglesDataNV32 *in_ext = (const VkAccelerationStructureGeometryMotionTrianglesDataNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_MOTION_TRIANGLES_DATA_NV; - out_ext->pNext = NULL; - out_ext->vertexData = in_ext->vertexData; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT: - { - VkAccelerationStructureTrianglesOpacityMicromapEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAccelerationStructureTrianglesOpacityMicromapEXT32 *in_ext = (const VkAccelerationStructureTrianglesOpacityMicromapEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT; - out_ext->pNext = NULL; - out_ext->indexType = in_ext->indexType; - out_ext->indexBuffer = in_ext->indexBuffer; - out_ext->indexStride = in_ext->indexStride; - out_ext->baseTriangle = in_ext->baseTriangle; - out_ext->usageCountsCount = in_ext->usageCountsCount; - out_ext->pUsageCounts = (const VkMicromapUsageEXT *)UlongToPtr(in_ext->pUsageCounts); - out_ext->ppUsageCounts = convert_VkMicromapUsageEXT_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in_ext->ppUsageCounts), in_ext->usageCountsCount); - out_ext->micromap = in_ext->micromap; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkAccelerationStructureGeometryAabbsDataKHR_win32_to_host(const VkAccelerationStructureGeometryAabbsDataKHR32 *in, VkAccelerationStructureGeometryAabbsDataKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->data = in->data; - out->stride = in->stride; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAccelerationStructureGeometryInstancesDataKHR_win32_to_host(const VkAccelerationStructureGeometryInstancesDataKHR32 *in, VkAccelerationStructureGeometryInstancesDataKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->arrayOfPointers = in->arrayOfPointers; - out->data = in->data; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAccelerationStructureGeometryDataKHR_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureGeometryDataKHR32 *in, VkAccelerationStructureGeometryDataKHR *out, VkFlags selector) -{ - if (!in) return; - - if (selector == VK_GEOMETRY_TYPE_TRIANGLES_KHR) - convert_VkAccelerationStructureGeometryTrianglesDataKHR_win32_to_host(ctx, &in->triangles, &out->triangles); - if (selector == VK_GEOMETRY_TYPE_AABBS_KHR) - convert_VkAccelerationStructureGeometryAabbsDataKHR_win32_to_host(&in->aabbs, &out->aabbs); - if (selector == VK_GEOMETRY_TYPE_INSTANCES_KHR) - convert_VkAccelerationStructureGeometryInstancesDataKHR_win32_to_host(&in->instances, &out->instances); -} - -static inline void convert_VkAccelerationStructureGeometryKHR_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureGeometryKHR32 *in, VkAccelerationStructureGeometryKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->geometryType = in->geometryType; - convert_VkAccelerationStructureGeometryDataKHR_win32_to_host(ctx, &in->geometry, &out->geometry, in->geometryType); - out->flags = in->flags; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkAccelerationStructureGeometryKHR *convert_VkAccelerationStructureGeometryKHR_array_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureGeometryKHR32 *in, uint32_t count) -{ - VkAccelerationStructureGeometryKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkAccelerationStructureGeometryKHR_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline const VkAccelerationStructureGeometryKHR * const*convert_VkAccelerationStructureGeometryKHR_pointer_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count) -{ - VkAccelerationStructureGeometryKHR **out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - if (in[i]) - { - out[i] = conversion_context_alloc(ctx, sizeof(*out[i])); - convert_VkAccelerationStructureGeometryKHR_win32_to_host(ctx, (VkAccelerationStructureGeometryKHR32 *)UlongToPtr(in[i]), out[i]); - } - else - out[i] = NULL; - } - - return (void *)out; -} - -static inline void convert_VkAccelerationStructureBuildGeometryInfoKHR_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureBuildGeometryInfoKHR32 *in, VkAccelerationStructureBuildGeometryInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->flags = in->flags; - out->mode = in->mode; - out->srcAccelerationStructure = in->srcAccelerationStructure; - out->dstAccelerationStructure = in->dstAccelerationStructure; - out->geometryCount = in->geometryCount; - out->pGeometries = convert_VkAccelerationStructureGeometryKHR_array_win32_to_host(ctx, (const VkAccelerationStructureGeometryKHR32 *)UlongToPtr(in->pGeometries), in->geometryCount); - out->ppGeometries = convert_VkAccelerationStructureGeometryKHR_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppGeometries), in->geometryCount); - out->scratchData = in->scratchData; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkAccelerationStructureBuildGeometryInfoKHR *convert_VkAccelerationStructureBuildGeometryInfoKHR_array_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureBuildGeometryInfoKHR32 *in, uint32_t count) -{ - VkAccelerationStructureBuildGeometryInfoKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkAccelerationStructureBuildGeometryInfoKHR_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkMicromapBuildInfoEXT_win32_to_host(struct conversion_context *ctx, const VkMicromapBuildInfoEXT32 *in, VkMicromapBuildInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->flags = in->flags; - out->mode = in->mode; - out->dstMicromap = in->dstMicromap; - out->usageCountsCount = in->usageCountsCount; - out->pUsageCounts = (const VkMicromapUsageEXT *)UlongToPtr(in->pUsageCounts); - out->ppUsageCounts = convert_VkMicromapUsageEXT_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppUsageCounts), in->usageCountsCount); - out->data = in->data; - out->scratchData = in->scratchData; - out->triangleArray = in->triangleArray; - out->triangleArrayStride = in->triangleArrayStride; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkMicromapBuildInfoEXT *convert_VkMicromapBuildInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkMicromapBuildInfoEXT32 *in, uint32_t count) -{ - VkMicromapBuildInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMicromapBuildInfoEXT_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkConditionalRenderingBeginInfoEXT_win32_to_host(const VkConditionalRenderingBeginInfoEXT32 *in, VkConditionalRenderingBeginInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->buffer = in->buffer; - out->offset = in->offset; - out->flags = in->flags; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDebugUtilsLabelEXT_win32_to_host(const VkDebugUtilsLabelEXT32 *in, VkDebugUtilsLabelEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pLabelName = (const char *)UlongToPtr(in->pLabelName); - memcpy(out->color, in->color, 4 * sizeof(float)); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSampleLocationsInfoEXT_win32_to_host(const VkSampleLocationsInfoEXT32 *in, VkSampleLocationsInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->sampleLocationsPerPixel = in->sampleLocationsPerPixel; - out->sampleLocationGridSize = in->sampleLocationGridSize; - out->sampleLocationsCount = in->sampleLocationsCount; - out->pSampleLocations = (const VkSampleLocationEXT *)UlongToPtr(in->pSampleLocations); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAttachmentSampleLocationsEXT_win32_to_host(const VkAttachmentSampleLocationsEXT32 *in, VkAttachmentSampleLocationsEXT *out) -{ - if (!in) return; - - out->attachmentIndex = in->attachmentIndex; - convert_VkSampleLocationsInfoEXT_win32_to_host(&in->sampleLocationsInfo, &out->sampleLocationsInfo); -} - -static inline const VkAttachmentSampleLocationsEXT *convert_VkAttachmentSampleLocationsEXT_array_win32_to_host(struct conversion_context *ctx, const VkAttachmentSampleLocationsEXT32 *in, uint32_t count) -{ - VkAttachmentSampleLocationsEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkAttachmentSampleLocationsEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSubpassSampleLocationsEXT_win32_to_host(const VkSubpassSampleLocationsEXT32 *in, VkSubpassSampleLocationsEXT *out) -{ - if (!in) return; - - out->subpassIndex = in->subpassIndex; - convert_VkSampleLocationsInfoEXT_win32_to_host(&in->sampleLocationsInfo, &out->sampleLocationsInfo); -} - -static inline const VkSubpassSampleLocationsEXT *convert_VkSubpassSampleLocationsEXT_array_win32_to_host(struct conversion_context *ctx, const VkSubpassSampleLocationsEXT32 *in, uint32_t count) -{ - VkSubpassSampleLocationsEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubpassSampleLocationsEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRenderPassBeginInfo_win32_to_host(struct conversion_context *ctx, const VkRenderPassBeginInfo32 *in, VkRenderPassBeginInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->renderPass = in->renderPass; - out->framebuffer = in->framebuffer; - out->renderArea = in->renderArea; - out->clearValueCount = in->clearValueCount; - out->pClearValues = (const VkClearValue *)UlongToPtr(in->pClearValues); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO: - { - VkDeviceGroupRenderPassBeginInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupRenderPassBeginInfo32 *in_ext = (const VkDeviceGroupRenderPassBeginInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO; - out_ext->pNext = NULL; - out_ext->deviceMask = in_ext->deviceMask; - out_ext->deviceRenderAreaCount = in_ext->deviceRenderAreaCount; - out_ext->pDeviceRenderAreas = (const VkRect2D *)UlongToPtr(in_ext->pDeviceRenderAreas); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT: - { - VkRenderPassSampleLocationsBeginInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassSampleLocationsBeginInfoEXT32 *in_ext = (const VkRenderPassSampleLocationsBeginInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT; - out_ext->pNext = NULL; - out_ext->attachmentInitialSampleLocationsCount = in_ext->attachmentInitialSampleLocationsCount; - out_ext->pAttachmentInitialSampleLocations = convert_VkAttachmentSampleLocationsEXT_array_win32_to_host(ctx, (const VkAttachmentSampleLocationsEXT32 *)UlongToPtr(in_ext->pAttachmentInitialSampleLocations), in_ext->attachmentInitialSampleLocationsCount); - out_ext->postSubpassSampleLocationsCount = in_ext->postSubpassSampleLocationsCount; - out_ext->pPostSubpassSampleLocations = convert_VkSubpassSampleLocationsEXT_array_win32_to_host(ctx, (const VkSubpassSampleLocationsEXT32 *)UlongToPtr(in_ext->pPostSubpassSampleLocations), in_ext->postSubpassSampleLocationsCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO: - { - VkRenderPassAttachmentBeginInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassAttachmentBeginInfo32 *in_ext = (const VkRenderPassAttachmentBeginInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO; - out_ext->pNext = NULL; - out_ext->attachmentCount = in_ext->attachmentCount; - out_ext->pAttachments = (const VkImageView *)UlongToPtr(in_ext->pAttachments); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM: - { - VkRenderPassTransformBeginInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassTransformBeginInfoQCOM32 *in_ext = (const VkRenderPassTransformBeginInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->transform = in_ext->transform; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM: - { - VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM32 *in_ext = (const VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->perViewRenderAreaCount = in_ext->perViewRenderAreaCount; - out_ext->pPerViewRenderAreas = (const VkRect2D *)UlongToPtr(in_ext->pPerViewRenderAreas); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSubpassBeginInfo_win32_to_host(const VkSubpassBeginInfo32 *in, VkSubpassBeginInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->contents = in->contents; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkRenderingAttachmentInfo_win32_to_host(const VkRenderingAttachmentInfo32 *in, VkRenderingAttachmentInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->imageView = in->imageView; - out->imageLayout = in->imageLayout; - out->resolveMode = in->resolveMode; - out->resolveImageView = in->resolveImageView; - out->resolveImageLayout = in->resolveImageLayout; - out->loadOp = in->loadOp; - out->storeOp = in->storeOp; - out->clearValue = in->clearValue; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkRenderingAttachmentInfo *convert_VkRenderingAttachmentInfo_array_win32_to_host(struct conversion_context *ctx, const VkRenderingAttachmentInfo32 *in, uint32_t count) -{ - VkRenderingAttachmentInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRenderingAttachmentInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRenderingInfo_win32_to_host(struct conversion_context *ctx, const VkRenderingInfo32 *in, VkRenderingInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->renderArea = in->renderArea; - out->layerCount = in->layerCount; - out->viewMask = in->viewMask; - out->colorAttachmentCount = in->colorAttachmentCount; - out->pColorAttachments = convert_VkRenderingAttachmentInfo_array_win32_to_host(ctx, (const VkRenderingAttachmentInfo32 *)UlongToPtr(in->pColorAttachments), in->colorAttachmentCount); - out->pDepthAttachment = convert_VkRenderingAttachmentInfo_array_win32_to_host(ctx, (const VkRenderingAttachmentInfo32 *)UlongToPtr(in->pDepthAttachment), 1); - out->pStencilAttachment = convert_VkRenderingAttachmentInfo_array_win32_to_host(ctx, (const VkRenderingAttachmentInfo32 *)UlongToPtr(in->pStencilAttachment), 1); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO: - { - VkDeviceGroupRenderPassBeginInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupRenderPassBeginInfo32 *in_ext = (const VkDeviceGroupRenderPassBeginInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO; - out_ext->pNext = NULL; - out_ext->deviceMask = in_ext->deviceMask; - out_ext->deviceRenderAreaCount = in_ext->deviceRenderAreaCount; - out_ext->pDeviceRenderAreas = (const VkRect2D *)UlongToPtr(in_ext->pDeviceRenderAreas); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT: - { - VkMultisampledRenderToSingleSampledInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultisampledRenderToSingleSampledInfoEXT32 *in_ext = (const VkMultisampledRenderToSingleSampledInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT; - out_ext->pNext = NULL; - out_ext->multisampledRenderToSingleSampledEnable = in_ext->multisampledRenderToSingleSampledEnable; - out_ext->rasterizationSamples = in_ext->rasterizationSamples; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR: - { - VkRenderingFragmentShadingRateAttachmentInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderingFragmentShadingRateAttachmentInfoKHR32 *in_ext = (const VkRenderingFragmentShadingRateAttachmentInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR; - out_ext->pNext = NULL; - out_ext->imageView = in_ext->imageView; - out_ext->imageLayout = in_ext->imageLayout; - out_ext->shadingRateAttachmentTexelSize = in_ext->shadingRateAttachmentTexelSize; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT: - { - VkRenderingFragmentDensityMapAttachmentInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderingFragmentDensityMapAttachmentInfoEXT32 *in_ext = (const VkRenderingFragmentDensityMapAttachmentInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT; - out_ext->pNext = NULL; - out_ext->imageView = in_ext->imageView; - out_ext->imageLayout = in_ext->imageLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX: - { - VkMultiviewPerViewAttributesInfoNVX *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultiviewPerViewAttributesInfoNVX32 *in_ext = (const VkMultiviewPerViewAttributesInfoNVX32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX; - out_ext->pNext = NULL; - out_ext->perViewAttributes = in_ext->perViewAttributes; - out_ext->perViewAttributesPositionXOnly = in_ext->perViewAttributesPositionXOnly; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM: - { - VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM32 *in_ext = (const VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->perViewRenderAreaCount = in_ext->perViewRenderAreaCount; - out_ext->pPerViewRenderAreas = (const VkRect2D *)UlongToPtr(in_ext->pPerViewRenderAreas); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkDescriptorBufferBindingInfoEXT_win32_to_host(struct conversion_context *ctx, const VkDescriptorBufferBindingInfoEXT32 *in, VkDescriptorBufferBindingInfoEXT *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->address = in->address; - out->usage = in->usage; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR: - { - VkBufferUsageFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBufferUsageFlags2CreateInfoKHR32 *in_ext = (const VkBufferUsageFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_PUSH_DESCRIPTOR_BUFFER_HANDLE_EXT: - { - VkDescriptorBufferBindingPushDescriptorBufferHandleEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDescriptorBufferBindingPushDescriptorBufferHandleEXT32 *in_ext = (const VkDescriptorBufferBindingPushDescriptorBufferHandleEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_PUSH_DESCRIPTOR_BUFFER_HANDLE_EXT; - out_ext->pNext = NULL; - out_ext->buffer = in_ext->buffer; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkDescriptorBufferBindingInfoEXT *convert_VkDescriptorBufferBindingInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDescriptorBufferBindingInfoEXT32 *in, uint32_t count) -{ - VkDescriptorBufferBindingInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDescriptorBufferBindingInfoEXT_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkImageBlit2_win32_to_host(struct conversion_context *ctx, const VkImageBlit232 *in, VkImageBlit2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcSubresource = in->srcSubresource; - memcpy(out->srcOffsets, in->srcOffsets, 2 * sizeof(VkOffset3D)); - out->dstSubresource = in->dstSubresource; - memcpy(out->dstOffsets, in->dstOffsets, 2 * sizeof(VkOffset3D)); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM: - { - VkCopyCommandTransformInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkCopyCommandTransformInfoQCOM32 *in_ext = (const VkCopyCommandTransformInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->transform = in_ext->transform; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkImageBlit2 *convert_VkImageBlit2_array_win32_to_host(struct conversion_context *ctx, const VkImageBlit232 *in, uint32_t count) -{ - VkImageBlit2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageBlit2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkBlitImageInfo2_win32_to_host(struct conversion_context *ctx, const VkBlitImageInfo232 *in, VkBlitImageInfo2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcImage = in->srcImage; - out->srcImageLayout = in->srcImageLayout; - out->dstImage = in->dstImage; - out->dstImageLayout = in->dstImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkImageBlit2_array_win32_to_host(ctx, (const VkImageBlit232 *)UlongToPtr(in->pRegions), in->regionCount); - out->filter = in->filter; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM: - { - VkBlitImageCubicWeightsInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBlitImageCubicWeightsInfoQCOM32 *in_ext = (const VkBlitImageCubicWeightsInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->cubicWeights = in_ext->cubicWeights; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkGeometryTrianglesNV_win32_to_host(const VkGeometryTrianglesNV32 *in, VkGeometryTrianglesNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->vertexData = in->vertexData; - out->vertexOffset = in->vertexOffset; - out->vertexCount = in->vertexCount; - out->vertexStride = in->vertexStride; - out->vertexFormat = in->vertexFormat; - out->indexData = in->indexData; - out->indexOffset = in->indexOffset; - out->indexCount = in->indexCount; - out->indexType = in->indexType; - out->transformData = in->transformData; - out->transformOffset = in->transformOffset; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkGeometryAABBNV_win32_to_host(const VkGeometryAABBNV32 *in, VkGeometryAABBNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->aabbData = in->aabbData; - out->numAABBs = in->numAABBs; - out->stride = in->stride; - out->offset = in->offset; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkGeometryDataNV_win32_to_host(const VkGeometryDataNV32 *in, VkGeometryDataNV *out) -{ - if (!in) return; - - convert_VkGeometryTrianglesNV_win32_to_host(&in->triangles, &out->triangles); - convert_VkGeometryAABBNV_win32_to_host(&in->aabbs, &out->aabbs); -} - -static inline void convert_VkGeometryNV_win32_to_host(const VkGeometryNV32 *in, VkGeometryNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->geometryType = in->geometryType; - convert_VkGeometryDataNV_win32_to_host(&in->geometry, &out->geometry); - out->flags = in->flags; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkGeometryNV *convert_VkGeometryNV_array_win32_to_host(struct conversion_context *ctx, const VkGeometryNV32 *in, uint32_t count) -{ - VkGeometryNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkGeometryNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkAccelerationStructureInfoNV_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureInfoNV32 *in, VkAccelerationStructureInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->flags = in->flags; - out->instanceCount = in->instanceCount; - out->geometryCount = in->geometryCount; - out->pGeometries = convert_VkGeometryNV_array_win32_to_host(ctx, (const VkGeometryNV32 *)UlongToPtr(in->pGeometries), in->geometryCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyAccelerationStructureInfoKHR_win32_to_host(const VkCopyAccelerationStructureInfoKHR32 *in, VkCopyAccelerationStructureInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->src = in->src; - out->dst = in->dst; - out->mode = in->mode; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyAccelerationStructureToMemoryInfoKHR_win32_to_host(const VkCopyAccelerationStructureToMemoryInfoKHR32 *in, VkCopyAccelerationStructureToMemoryInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->src = in->src; - out->dst = in->dst; - out->mode = in->mode; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkBufferCopy_win32_to_host(const VkBufferCopy32 *in, VkBufferCopy *out) -{ - if (!in) return; - - out->srcOffset = in->srcOffset; - out->dstOffset = in->dstOffset; - out->size = in->size; -} - -static inline const VkBufferCopy *convert_VkBufferCopy_array_win32_to_host(struct conversion_context *ctx, const VkBufferCopy32 *in, uint32_t count) -{ - VkBufferCopy *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferCopy_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkBufferCopy2_win32_to_host(const VkBufferCopy232 *in, VkBufferCopy2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcOffset = in->srcOffset; - out->dstOffset = in->dstOffset; - out->size = in->size; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkBufferCopy2 *convert_VkBufferCopy2_array_win32_to_host(struct conversion_context *ctx, const VkBufferCopy232 *in, uint32_t count) -{ - VkBufferCopy2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferCopy2_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCopyBufferInfo2_win32_to_host(struct conversion_context *ctx, const VkCopyBufferInfo232 *in, VkCopyBufferInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcBuffer = in->srcBuffer; - out->dstBuffer = in->dstBuffer; - out->regionCount = in->regionCount; - out->pRegions = convert_VkBufferCopy2_array_win32_to_host(ctx, (const VkBufferCopy232 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkBufferImageCopy_win32_to_host(const VkBufferImageCopy32 *in, VkBufferImageCopy *out) -{ - if (!in) return; - - out->bufferOffset = in->bufferOffset; - out->bufferRowLength = in->bufferRowLength; - out->bufferImageHeight = in->bufferImageHeight; - out->imageSubresource = in->imageSubresource; - out->imageOffset = in->imageOffset; - out->imageExtent = in->imageExtent; -} - -static inline const VkBufferImageCopy *convert_VkBufferImageCopy_array_win32_to_host(struct conversion_context *ctx, const VkBufferImageCopy32 *in, uint32_t count) -{ - VkBufferImageCopy *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferImageCopy_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkBufferImageCopy2_win32_to_host(struct conversion_context *ctx, const VkBufferImageCopy232 *in, VkBufferImageCopy2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->bufferOffset = in->bufferOffset; - out->bufferRowLength = in->bufferRowLength; - out->bufferImageHeight = in->bufferImageHeight; - out->imageSubresource = in->imageSubresource; - out->imageOffset = in->imageOffset; - out->imageExtent = in->imageExtent; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM: - { - VkCopyCommandTransformInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkCopyCommandTransformInfoQCOM32 *in_ext = (const VkCopyCommandTransformInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->transform = in_ext->transform; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkBufferImageCopy2 *convert_VkBufferImageCopy2_array_win32_to_host(struct conversion_context *ctx, const VkBufferImageCopy232 *in, uint32_t count) -{ - VkBufferImageCopy2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferImageCopy2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCopyBufferToImageInfo2_win32_to_host(struct conversion_context *ctx, const VkCopyBufferToImageInfo232 *in, VkCopyBufferToImageInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcBuffer = in->srcBuffer; - out->dstImage = in->dstImage; - out->dstImageLayout = in->dstImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkBufferImageCopy2_array_win32_to_host(ctx, (const VkBufferImageCopy232 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkImageCopy2_win32_to_host(const VkImageCopy232 *in, VkImageCopy2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcSubresource = in->srcSubresource; - out->srcOffset = in->srcOffset; - out->dstSubresource = in->dstSubresource; - out->dstOffset = in->dstOffset; - out->extent = in->extent; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkImageCopy2 *convert_VkImageCopy2_array_win32_to_host(struct conversion_context *ctx, const VkImageCopy232 *in, uint32_t count) -{ - VkImageCopy2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageCopy2_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCopyImageInfo2_win32_to_host(struct conversion_context *ctx, const VkCopyImageInfo232 *in, VkCopyImageInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcImage = in->srcImage; - out->srcImageLayout = in->srcImageLayout; - out->dstImage = in->dstImage; - out->dstImageLayout = in->dstImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkImageCopy2_array_win32_to_host(ctx, (const VkImageCopy232 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyImageToBufferInfo2_win32_to_host(struct conversion_context *ctx, const VkCopyImageToBufferInfo232 *in, VkCopyImageToBufferInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcImage = in->srcImage; - out->srcImageLayout = in->srcImageLayout; - out->dstBuffer = in->dstBuffer; - out->regionCount = in->regionCount; - out->pRegions = convert_VkBufferImageCopy2_array_win32_to_host(ctx, (const VkBufferImageCopy232 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyMemoryToAccelerationStructureInfoKHR_win32_to_host(const VkCopyMemoryToAccelerationStructureInfoKHR32 *in, VkCopyMemoryToAccelerationStructureInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->src = in->src; - out->dst = in->dst; - out->mode = in->mode; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyMemoryToMicromapInfoEXT_win32_to_host(const VkCopyMemoryToMicromapInfoEXT32 *in, VkCopyMemoryToMicromapInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->src = in->src; - out->dst = in->dst; - out->mode = in->mode; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyMicromapInfoEXT_win32_to_host(const VkCopyMicromapInfoEXT32 *in, VkCopyMicromapInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->src = in->src; - out->dst = in->dst; - out->mode = in->mode; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyMicromapToMemoryInfoEXT_win32_to_host(const VkCopyMicromapToMemoryInfoEXT32 *in, VkCopyMicromapToMemoryInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->src = in->src; - out->dst = in->dst; - out->mode = in->mode; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCuLaunchInfoNVX_win32_to_host(const VkCuLaunchInfoNVX32 *in, VkCuLaunchInfoNVX *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->function = in->function; - out->gridDimX = in->gridDimX; - out->gridDimY = in->gridDimY; - out->gridDimZ = in->gridDimZ; - out->blockDimX = in->blockDimX; - out->blockDimY = in->blockDimY; - out->blockDimZ = in->blockDimZ; - out->sharedMemBytes = in->sharedMemBytes; - out->paramCount = in->paramCount; - out->pParams = (const void * const *)UlongToPtr(in->pParams); - out->extraCount = in->extraCount; - out->pExtras = (const void * const *)UlongToPtr(in->pExtras); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCudaLaunchInfoNV_win32_to_host(const VkCudaLaunchInfoNV32 *in, VkCudaLaunchInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->function = in->function; - out->gridDimX = in->gridDimX; - out->gridDimY = in->gridDimY; - out->gridDimZ = in->gridDimZ; - out->blockDimX = in->blockDimX; - out->blockDimY = in->blockDimY; - out->blockDimZ = in->blockDimZ; - out->sharedMemBytes = in->sharedMemBytes; - out->paramCount = in->paramCount; - out->pParams = (const void * const *)UlongToPtr(in->pParams); - out->extraCount = in->extraCount; - out->pExtras = (const void * const *)UlongToPtr(in->pExtras); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDebugMarkerMarkerInfoEXT_win32_to_host(const VkDebugMarkerMarkerInfoEXT32 *in, VkDebugMarkerMarkerInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pMarkerName = (const char *)UlongToPtr(in->pMarkerName); - memcpy(out->color, in->color, 4 * sizeof(float)); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDecompressMemoryRegionNV_win32_to_host(const VkDecompressMemoryRegionNV32 *in, VkDecompressMemoryRegionNV *out) -{ - if (!in) return; - - out->srcAddress = in->srcAddress; - out->dstAddress = in->dstAddress; - out->compressedSize = in->compressedSize; - out->decompressedSize = in->decompressedSize; - out->decompressionMethod = in->decompressionMethod; -} - -static inline const VkDecompressMemoryRegionNV *convert_VkDecompressMemoryRegionNV_array_win32_to_host(struct conversion_context *ctx, const VkDecompressMemoryRegionNV32 *in, uint32_t count) -{ - VkDecompressMemoryRegionNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDecompressMemoryRegionNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSubpassEndInfo_win32_to_host(struct conversion_context *ctx, const VkSubpassEndInfo32 *in, VkSubpassEndInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM: - { - VkSubpassFragmentDensityMapOffsetEndInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSubpassFragmentDensityMapOffsetEndInfoQCOM32 *in_ext = (const VkSubpassFragmentDensityMapOffsetEndInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->fragmentDensityOffsetCount = in_ext->fragmentDensityOffsetCount; - out_ext->pFragmentDensityOffsets = (const VkOffset2D *)UlongToPtr(in_ext->pFragmentDensityOffsets); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkCommandBuffer *convert_VkCommandBuffer_array_win64_to_host(struct conversion_context *ctx, const VkCommandBuffer *in, uint32_t count) -{ - VkCommandBuffer *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = wine_cmd_buffer_from_handle(in[i])->host_command_buffer; - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkCommandBuffer *convert_VkCommandBuffer_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count) -{ - VkCommandBuffer *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = wine_cmd_buffer_from_handle(UlongToPtr(in[i]))->host_command_buffer; - } - - return out; -} - -static inline void convert_VkIndirectCommandsStreamNV_win32_to_host(const VkIndirectCommandsStreamNV32 *in, VkIndirectCommandsStreamNV *out) -{ - if (!in) return; - - out->buffer = in->buffer; - out->offset = in->offset; -} - -static inline const VkIndirectCommandsStreamNV *convert_VkIndirectCommandsStreamNV_array_win32_to_host(struct conversion_context *ctx, const VkIndirectCommandsStreamNV32 *in, uint32_t count) -{ - VkIndirectCommandsStreamNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkIndirectCommandsStreamNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkGeneratedCommandsInfoNV_win32_to_host(struct conversion_context *ctx, const VkGeneratedCommandsInfoNV32 *in, VkGeneratedCommandsInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pipelineBindPoint = in->pipelineBindPoint; - out->pipeline = in->pipeline; - out->indirectCommandsLayout = in->indirectCommandsLayout; - out->streamCount = in->streamCount; - out->pStreams = convert_VkIndirectCommandsStreamNV_array_win32_to_host(ctx, (const VkIndirectCommandsStreamNV32 *)UlongToPtr(in->pStreams), in->streamCount); - out->sequencesCount = in->sequencesCount; - out->preprocessBuffer = in->preprocessBuffer; - out->preprocessOffset = in->preprocessOffset; - out->preprocessSize = in->preprocessSize; - out->sequencesCountBuffer = in->sequencesCountBuffer; - out->sequencesCountOffset = in->sequencesCountOffset; - out->sequencesIndexBuffer = in->sequencesIndexBuffer; - out->sequencesIndexOffset = in->sequencesIndexOffset; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkOpticalFlowExecuteInfoNV_win32_to_host(const VkOpticalFlowExecuteInfoNV32 *in, VkOpticalFlowExecuteInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->regionCount = in->regionCount; - out->pRegions = (const VkRect2D *)UlongToPtr(in->pRegions); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryBarrier_win32_to_host(const VkMemoryBarrier32 *in, VkMemoryBarrier *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcAccessMask = in->srcAccessMask; - out->dstAccessMask = in->dstAccessMask; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkMemoryBarrier *convert_VkMemoryBarrier_array_win32_to_host(struct conversion_context *ctx, const VkMemoryBarrier32 *in, uint32_t count) -{ - VkMemoryBarrier *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMemoryBarrier_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkBufferMemoryBarrier_win32_to_host(struct conversion_context *ctx, const VkBufferMemoryBarrier32 *in, VkBufferMemoryBarrier *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcAccessMask = in->srcAccessMask; - out->dstAccessMask = in->dstAccessMask; - out->srcQueueFamilyIndex = in->srcQueueFamilyIndex; - out->dstQueueFamilyIndex = in->dstQueueFamilyIndex; - out->buffer = in->buffer; - out->offset = in->offset; - out->size = in->size; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT: - { - VkExternalMemoryAcquireUnmodifiedEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExternalMemoryAcquireUnmodifiedEXT32 *in_ext = (const VkExternalMemoryAcquireUnmodifiedEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT; - out_ext->pNext = NULL; - out_ext->acquireUnmodifiedMemory = in_ext->acquireUnmodifiedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkBufferMemoryBarrier *convert_VkBufferMemoryBarrier_array_win32_to_host(struct conversion_context *ctx, const VkBufferMemoryBarrier32 *in, uint32_t count) -{ - VkBufferMemoryBarrier *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferMemoryBarrier_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkImageMemoryBarrier_win32_to_host(struct conversion_context *ctx, const VkImageMemoryBarrier32 *in, VkImageMemoryBarrier *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcAccessMask = in->srcAccessMask; - out->dstAccessMask = in->dstAccessMask; - out->oldLayout = in->oldLayout; - out->newLayout = in->newLayout; - out->srcQueueFamilyIndex = in->srcQueueFamilyIndex; - out->dstQueueFamilyIndex = in->dstQueueFamilyIndex; - out->image = in->image; - out->subresourceRange = in->subresourceRange; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT: - { - VkSampleLocationsInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSampleLocationsInfoEXT32 *in_ext = (const VkSampleLocationsInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT; - out_ext->pNext = NULL; - out_ext->sampleLocationsPerPixel = in_ext->sampleLocationsPerPixel; - out_ext->sampleLocationGridSize = in_ext->sampleLocationGridSize; - out_ext->sampleLocationsCount = in_ext->sampleLocationsCount; - out_ext->pSampleLocations = (const VkSampleLocationEXT *)UlongToPtr(in_ext->pSampleLocations); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT: - { - VkExternalMemoryAcquireUnmodifiedEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExternalMemoryAcquireUnmodifiedEXT32 *in_ext = (const VkExternalMemoryAcquireUnmodifiedEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT; - out_ext->pNext = NULL; - out_ext->acquireUnmodifiedMemory = in_ext->acquireUnmodifiedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkImageMemoryBarrier *convert_VkImageMemoryBarrier_array_win32_to_host(struct conversion_context *ctx, const VkImageMemoryBarrier32 *in, uint32_t count) -{ - VkImageMemoryBarrier *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageMemoryBarrier_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkMemoryBarrier2_win32_to_host(const VkMemoryBarrier232 *in, VkMemoryBarrier2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcStageMask = in->srcStageMask; - out->srcAccessMask = in->srcAccessMask; - out->dstStageMask = in->dstStageMask; - out->dstAccessMask = in->dstAccessMask; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkMemoryBarrier2 *convert_VkMemoryBarrier2_array_win32_to_host(struct conversion_context *ctx, const VkMemoryBarrier232 *in, uint32_t count) -{ - VkMemoryBarrier2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMemoryBarrier2_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkBufferMemoryBarrier2_win32_to_host(struct conversion_context *ctx, const VkBufferMemoryBarrier232 *in, VkBufferMemoryBarrier2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcStageMask = in->srcStageMask; - out->srcAccessMask = in->srcAccessMask; - out->dstStageMask = in->dstStageMask; - out->dstAccessMask = in->dstAccessMask; - out->srcQueueFamilyIndex = in->srcQueueFamilyIndex; - out->dstQueueFamilyIndex = in->dstQueueFamilyIndex; - out->buffer = in->buffer; - out->offset = in->offset; - out->size = in->size; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT: - { - VkExternalMemoryAcquireUnmodifiedEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExternalMemoryAcquireUnmodifiedEXT32 *in_ext = (const VkExternalMemoryAcquireUnmodifiedEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT; - out_ext->pNext = NULL; - out_ext->acquireUnmodifiedMemory = in_ext->acquireUnmodifiedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkBufferMemoryBarrier2 *convert_VkBufferMemoryBarrier2_array_win32_to_host(struct conversion_context *ctx, const VkBufferMemoryBarrier232 *in, uint32_t count) -{ - VkBufferMemoryBarrier2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferMemoryBarrier2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkImageMemoryBarrier2_win32_to_host(struct conversion_context *ctx, const VkImageMemoryBarrier232 *in, VkImageMemoryBarrier2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcStageMask = in->srcStageMask; - out->srcAccessMask = in->srcAccessMask; - out->dstStageMask = in->dstStageMask; - out->dstAccessMask = in->dstAccessMask; - out->oldLayout = in->oldLayout; - out->newLayout = in->newLayout; - out->srcQueueFamilyIndex = in->srcQueueFamilyIndex; - out->dstQueueFamilyIndex = in->dstQueueFamilyIndex; - out->image = in->image; - out->subresourceRange = in->subresourceRange; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT: - { - VkSampleLocationsInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSampleLocationsInfoEXT32 *in_ext = (const VkSampleLocationsInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT; - out_ext->pNext = NULL; - out_ext->sampleLocationsPerPixel = in_ext->sampleLocationsPerPixel; - out_ext->sampleLocationGridSize = in_ext->sampleLocationGridSize; - out_ext->sampleLocationsCount = in_ext->sampleLocationsCount; - out_ext->pSampleLocations = (const VkSampleLocationEXT *)UlongToPtr(in_ext->pSampleLocations); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT: - { - VkExternalMemoryAcquireUnmodifiedEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExternalMemoryAcquireUnmodifiedEXT32 *in_ext = (const VkExternalMemoryAcquireUnmodifiedEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT; - out_ext->pNext = NULL; - out_ext->acquireUnmodifiedMemory = in_ext->acquireUnmodifiedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkImageMemoryBarrier2 *convert_VkImageMemoryBarrier2_array_win32_to_host(struct conversion_context *ctx, const VkImageMemoryBarrier232 *in, uint32_t count) -{ - VkImageMemoryBarrier2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageMemoryBarrier2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDependencyInfo_win32_to_host(struct conversion_context *ctx, const VkDependencyInfo32 *in, VkDependencyInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->dependencyFlags = in->dependencyFlags; - out->memoryBarrierCount = in->memoryBarrierCount; - out->pMemoryBarriers = convert_VkMemoryBarrier2_array_win32_to_host(ctx, (const VkMemoryBarrier232 *)UlongToPtr(in->pMemoryBarriers), in->memoryBarrierCount); - out->bufferMemoryBarrierCount = in->bufferMemoryBarrierCount; - out->pBufferMemoryBarriers = convert_VkBufferMemoryBarrier2_array_win32_to_host(ctx, (const VkBufferMemoryBarrier232 *)UlongToPtr(in->pBufferMemoryBarriers), in->bufferMemoryBarrierCount); - out->imageMemoryBarrierCount = in->imageMemoryBarrierCount; - out->pImageMemoryBarriers = convert_VkImageMemoryBarrier2_array_win32_to_host(ctx, (const VkImageMemoryBarrier232 *)UlongToPtr(in->pImageMemoryBarriers), in->imageMemoryBarrierCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDescriptorImageInfo_win32_to_host(const VkDescriptorImageInfo32 *in, VkDescriptorImageInfo *out) -{ - if (!in) return; - - out->sampler = in->sampler; - out->imageView = in->imageView; - out->imageLayout = in->imageLayout; -} - -static inline const VkDescriptorImageInfo *convert_VkDescriptorImageInfo_array_win32_to_host(struct conversion_context *ctx, const VkDescriptorImageInfo32 *in, uint32_t count) -{ - VkDescriptorImageInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDescriptorImageInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDescriptorBufferInfo_win32_to_host(const VkDescriptorBufferInfo32 *in, VkDescriptorBufferInfo *out) -{ - if (!in) return; - - out->buffer = in->buffer; - out->offset = in->offset; - out->range = in->range; -} - -static inline const VkDescriptorBufferInfo *convert_VkDescriptorBufferInfo_array_win32_to_host(struct conversion_context *ctx, const VkDescriptorBufferInfo32 *in, uint32_t count) -{ - VkDescriptorBufferInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDescriptorBufferInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkWriteDescriptorSet_win32_to_host(struct conversion_context *ctx, const VkWriteDescriptorSet32 *in, VkWriteDescriptorSet *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->dstSet = in->dstSet; - out->dstBinding = in->dstBinding; - out->dstArrayElement = in->dstArrayElement; - out->descriptorCount = in->descriptorCount; - out->descriptorType = in->descriptorType; - out->pImageInfo = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, (const VkDescriptorImageInfo32 *)UlongToPtr(in->pImageInfo), in->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER || in->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER || in->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE || in->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE || in->descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT || in->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM || in->descriptorType == VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM ? in->descriptorCount : 0); - out->pBufferInfo = convert_VkDescriptorBufferInfo_array_win32_to_host(ctx, (const VkDescriptorBufferInfo32 *)UlongToPtr(in->pBufferInfo), in->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER || in->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER || in->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC || in->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC ? in->descriptorCount : 0); - out->pTexelBufferView = (const VkBufferView *)UlongToPtr(in->pTexelBufferView); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK: - { - VkWriteDescriptorSetInlineUniformBlock *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkWriteDescriptorSetInlineUniformBlock32 *in_ext = (const VkWriteDescriptorSetInlineUniformBlock32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK; - out_ext->pNext = NULL; - out_ext->dataSize = in_ext->dataSize; - out_ext->pData = (const void *)UlongToPtr(in_ext->pData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR: - { - VkWriteDescriptorSetAccelerationStructureKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkWriteDescriptorSetAccelerationStructureKHR32 *in_ext = (const VkWriteDescriptorSetAccelerationStructureKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR; - out_ext->pNext = NULL; - out_ext->accelerationStructureCount = in_ext->accelerationStructureCount; - out_ext->pAccelerationStructures = (const VkAccelerationStructureKHR *)UlongToPtr(in_ext->pAccelerationStructures); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV: - { - VkWriteDescriptorSetAccelerationStructureNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkWriteDescriptorSetAccelerationStructureNV32 *in_ext = (const VkWriteDescriptorSetAccelerationStructureNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV; - out_ext->pNext = NULL; - out_ext->accelerationStructureCount = in_ext->accelerationStructureCount; - out_ext->pAccelerationStructures = (const VkAccelerationStructureNV *)UlongToPtr(in_ext->pAccelerationStructures); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkWriteDescriptorSet *convert_VkWriteDescriptorSet_array_win32_to_host(struct conversion_context *ctx, const VkWriteDescriptorSet32 *in, uint32_t count) -{ - VkWriteDescriptorSet *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkWriteDescriptorSet_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkImageResolve2_win32_to_host(const VkImageResolve232 *in, VkImageResolve2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcSubresource = in->srcSubresource; - out->srcOffset = in->srcOffset; - out->dstSubresource = in->dstSubresource; - out->dstOffset = in->dstOffset; - out->extent = in->extent; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkImageResolve2 *convert_VkImageResolve2_array_win32_to_host(struct conversion_context *ctx, const VkImageResolve232 *in, uint32_t count) -{ - VkImageResolve2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageResolve2_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkResolveImageInfo2_win32_to_host(struct conversion_context *ctx, const VkResolveImageInfo232 *in, VkResolveImageInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcImage = in->srcImage; - out->srcImageLayout = in->srcImageLayout; - out->dstImage = in->dstImage; - out->dstImageLayout = in->dstImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkImageResolve2_array_win32_to_host(ctx, (const VkImageResolve232 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCoarseSampleOrderCustomNV_win32_to_host(const VkCoarseSampleOrderCustomNV32 *in, VkCoarseSampleOrderCustomNV *out) -{ - if (!in) return; - - out->shadingRate = in->shadingRate; - out->sampleCount = in->sampleCount; - out->sampleLocationCount = in->sampleLocationCount; - out->pSampleLocations = (const VkCoarseSampleLocationNV *)UlongToPtr(in->pSampleLocations); -} - -static inline const VkCoarseSampleOrderCustomNV *convert_VkCoarseSampleOrderCustomNV_array_win32_to_host(struct conversion_context *ctx, const VkCoarseSampleOrderCustomNV32 *in, uint32_t count) -{ - VkCoarseSampleOrderCustomNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCoarseSampleOrderCustomNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDepthBiasInfoEXT_win32_to_host(struct conversion_context *ctx, const VkDepthBiasInfoEXT32 *in, VkDepthBiasInfoEXT *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->depthBiasConstantFactor = in->depthBiasConstantFactor; - out->depthBiasClamp = in->depthBiasClamp; - out->depthBiasSlopeFactor = in->depthBiasSlopeFactor; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT: - { - VkDepthBiasRepresentationInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDepthBiasRepresentationInfoEXT32 *in_ext = (const VkDepthBiasRepresentationInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT; - out_ext->pNext = NULL; - out_ext->depthBiasRepresentation = in_ext->depthBiasRepresentation; - out_ext->depthBiasExact = in_ext->depthBiasExact; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkPerformanceMarkerInfoINTEL_win32_to_host(const VkPerformanceMarkerInfoINTEL32 *in, VkPerformanceMarkerInfoINTEL *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->marker = in->marker; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPerformanceOverrideInfoINTEL_win32_to_host(const VkPerformanceOverrideInfoINTEL32 *in, VkPerformanceOverrideInfoINTEL *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->enable = in->enable; - out->parameter = in->parameter; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPerformanceStreamMarkerInfoINTEL_win32_to_host(const VkPerformanceStreamMarkerInfoINTEL32 *in, VkPerformanceStreamMarkerInfoINTEL *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->marker = in->marker; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkVertexInputBindingDescription2EXT_win32_to_host(const VkVertexInputBindingDescription2EXT32 *in, VkVertexInputBindingDescription2EXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->binding = in->binding; - out->stride = in->stride; - out->inputRate = in->inputRate; - out->divisor = in->divisor; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkVertexInputBindingDescription2EXT *convert_VkVertexInputBindingDescription2EXT_array_win32_to_host(struct conversion_context *ctx, const VkVertexInputBindingDescription2EXT32 *in, uint32_t count) -{ - VkVertexInputBindingDescription2EXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkVertexInputBindingDescription2EXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkVertexInputAttributeDescription2EXT_win32_to_host(const VkVertexInputAttributeDescription2EXT32 *in, VkVertexInputAttributeDescription2EXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->location = in->location; - out->binding = in->binding; - out->format = in->format; - out->offset = in->offset; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkVertexInputAttributeDescription2EXT *convert_VkVertexInputAttributeDescription2EXT_array_win32_to_host(struct conversion_context *ctx, const VkVertexInputAttributeDescription2EXT32 *in, uint32_t count) -{ - VkVertexInputAttributeDescription2EXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkVertexInputAttributeDescription2EXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkShadingRatePaletteNV_win32_to_host(const VkShadingRatePaletteNV32 *in, VkShadingRatePaletteNV *out) -{ - if (!in) return; - - out->shadingRatePaletteEntryCount = in->shadingRatePaletteEntryCount; - out->pShadingRatePaletteEntries = (const VkShadingRatePaletteEntryNV *)UlongToPtr(in->pShadingRatePaletteEntries); -} - -static inline const VkShadingRatePaletteNV *convert_VkShadingRatePaletteNV_array_win32_to_host(struct conversion_context *ctx, const VkShadingRatePaletteNV32 *in, uint32_t count) -{ - VkShadingRatePaletteNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkShadingRatePaletteNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkStridedDeviceAddressRegionKHR_win32_to_host(const VkStridedDeviceAddressRegionKHR32 *in, VkStridedDeviceAddressRegionKHR *out) -{ - if (!in) return; - - out->deviceAddress = in->deviceAddress; - out->stride = in->stride; - out->size = in->size; -} - -static inline const VkDependencyInfo *convert_VkDependencyInfo_array_win32_to_host(struct conversion_context *ctx, const VkDependencyInfo32 *in, uint32_t count) -{ - VkDependencyInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDependencyInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCopyImageToImageInfoEXT_win32_to_host(struct conversion_context *ctx, const VkCopyImageToImageInfoEXT32 *in, VkCopyImageToImageInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->srcImage = in->srcImage; - out->srcImageLayout = in->srcImageLayout; - out->dstImage = in->dstImage; - out->dstImageLayout = in->dstImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkImageCopy2_array_win32_to_host(ctx, (const VkImageCopy232 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkImageToMemoryCopyEXT_win32_to_host(const VkImageToMemoryCopyEXT32 *in, VkImageToMemoryCopyEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pHostPointer = (void *)UlongToPtr(in->pHostPointer); - out->memoryRowLength = in->memoryRowLength; - out->memoryImageHeight = in->memoryImageHeight; - out->imageSubresource = in->imageSubresource; - out->imageOffset = in->imageOffset; - out->imageExtent = in->imageExtent; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkImageToMemoryCopyEXT *convert_VkImageToMemoryCopyEXT_array_win32_to_host(struct conversion_context *ctx, const VkImageToMemoryCopyEXT32 *in, uint32_t count) -{ - VkImageToMemoryCopyEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageToMemoryCopyEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCopyImageToMemoryInfoEXT_win32_to_host(struct conversion_context *ctx, const VkCopyImageToMemoryInfoEXT32 *in, VkCopyImageToMemoryInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->srcImage = in->srcImage; - out->srcImageLayout = in->srcImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkImageToMemoryCopyEXT_array_win32_to_host(ctx, (const VkImageToMemoryCopyEXT32 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryToImageCopyEXT_win32_to_host(const VkMemoryToImageCopyEXT32 *in, VkMemoryToImageCopyEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pHostPointer = (const void *)UlongToPtr(in->pHostPointer); - out->memoryRowLength = in->memoryRowLength; - out->memoryImageHeight = in->memoryImageHeight; - out->imageSubresource = in->imageSubresource; - out->imageOffset = in->imageOffset; - out->imageExtent = in->imageExtent; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkMemoryToImageCopyEXT *convert_VkMemoryToImageCopyEXT_array_win32_to_host(struct conversion_context *ctx, const VkMemoryToImageCopyEXT32 *in, uint32_t count) -{ - VkMemoryToImageCopyEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMemoryToImageCopyEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCopyMemoryToImageInfoEXT_win32_to_host(struct conversion_context *ctx, const VkCopyMemoryToImageInfoEXT32 *in, VkCopyMemoryToImageInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->dstImage = in->dstImage; - out->dstImageLayout = in->dstImageLayout; - out->regionCount = in->regionCount; - out->pRegions = convert_VkMemoryToImageCopyEXT_array_win32_to_host(ctx, (const VkMemoryToImageCopyEXT32 *)UlongToPtr(in->pRegions), in->regionCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAccelerationStructureCreateInfoKHR_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureCreateInfoKHR32 *in, VkAccelerationStructureCreateInfoKHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->createFlags = in->createFlags; - out->buffer = in->buffer; - out->offset = in->offset; - out->size = in->size; - out->type = in->type; - out->deviceAddress = in->deviceAddress; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: - { - VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->opaqueCaptureDescriptorData = (const void *)UlongToPtr(in_ext->opaqueCaptureDescriptorData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MOTION_INFO_NV: - { - VkAccelerationStructureMotionInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAccelerationStructureMotionInfoNV32 *in_ext = (const VkAccelerationStructureMotionInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MOTION_INFO_NV; - out_ext->pNext = NULL; - out_ext->maxInstances = in_ext->maxInstances; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkAccelerationStructureCreateInfoNV_win32_to_host(struct conversion_context *ctx, const VkAccelerationStructureCreateInfoNV32 *in, VkAccelerationStructureCreateInfoNV *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->compactedSize = in->compactedSize; - convert_VkAccelerationStructureInfoNV_win32_to_host(ctx, &in->info, &out->info); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: - { - VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->opaqueCaptureDescriptorData = (const void *)UlongToPtr(in_ext->opaqueCaptureDescriptorData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkBufferCreateInfo_win32_to_host(struct conversion_context *ctx, const VkBufferCreateInfo32 *in, VkBufferCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->size = in->size; - out->usage = in->usage; - out->sharingMode = in->sharingMode; - out->queueFamilyIndexCount = in->queueFamilyIndexCount; - out->pQueueFamilyIndices = (const uint32_t *)UlongToPtr(in->pQueueFamilyIndices); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR: - { - VkBufferUsageFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBufferUsageFlags2CreateInfoKHR32 *in_ext = (const VkBufferUsageFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV: - { - VkDedicatedAllocationBufferCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDedicatedAllocationBufferCreateInfoNV32 *in_ext = (const VkDedicatedAllocationBufferCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->dedicatedAllocation = in_ext->dedicatedAllocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO: - { - VkExternalMemoryBufferCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExternalMemoryBufferCreateInfo32 *in_ext = (const VkExternalMemoryBufferCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->handleTypes = in_ext->handleTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO: - { - VkBufferOpaqueCaptureAddressCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBufferOpaqueCaptureAddressCreateInfo32 *in_ext = (const VkBufferOpaqueCaptureAddressCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->opaqueCaptureAddress = in_ext->opaqueCaptureAddress; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT: - { - VkBufferDeviceAddressCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBufferDeviceAddressCreateInfoEXT32 *in_ext = (const VkBufferDeviceAddressCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->deviceAddress = in_ext->deviceAddress; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: - { - VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->opaqueCaptureDescriptorData = (const void *)UlongToPtr(in_ext->opaqueCaptureDescriptorData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkBufferViewCreateInfo_win32_to_host(struct conversion_context *ctx, const VkBufferViewCreateInfo32 *in, VkBufferViewCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->buffer = in->buffer; - out->format = in->format; - out->offset = in->offset; - out->range = in->range; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR: - { - VkBufferUsageFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBufferUsageFlags2CreateInfoKHR32 *in_ext = (const VkBufferUsageFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkCommandPoolCreateInfo_win32_to_host(const VkCommandPoolCreateInfo32 *in, VkCommandPoolCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->queueFamilyIndex = in->queueFamilyIndex; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineCreationFeedback_host_to_win32(const VkPipelineCreationFeedback *in, VkPipelineCreationFeedback32 *out) -{ - if (!in) return; - - out->flags = in->flags; - out->duration = in->duration; -} - -static inline VkPipelineCreationFeedback *convert_VkPipelineCreationFeedback_array_win32_to_host(struct conversion_context *ctx, const VkPipelineCreationFeedback32 *in, uint32_t count) -{ - VkPipelineCreationFeedback *out; - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - - return out; -} - -static inline void convert_VkPipelineCreationFeedback_array_host_to_win32(const VkPipelineCreationFeedback *in, VkPipelineCreationFeedback32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPipelineCreationFeedback_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkSpecializationMapEntry_win32_to_host(const VkSpecializationMapEntry32 *in, VkSpecializationMapEntry *out) -{ - if (!in) return; - - out->constantID = in->constantID; - out->offset = in->offset; - out->size = in->size; -} - -static inline const VkSpecializationMapEntry *convert_VkSpecializationMapEntry_array_win32_to_host(struct conversion_context *ctx, const VkSpecializationMapEntry32 *in, uint32_t count) -{ - VkSpecializationMapEntry *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSpecializationMapEntry_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSpecializationInfo_win32_to_host(struct conversion_context *ctx, const VkSpecializationInfo32 *in, VkSpecializationInfo *out) -{ - if (!in) return; - - out->mapEntryCount = in->mapEntryCount; - out->pMapEntries = convert_VkSpecializationMapEntry_array_win32_to_host(ctx, (const VkSpecializationMapEntry32 *)UlongToPtr(in->pMapEntries), in->mapEntryCount); - out->dataSize = in->dataSize; - out->pData = (const void *)UlongToPtr(in->pData); -} - -static inline const VkSpecializationInfo *convert_VkSpecializationInfo_array_win32_to_host(struct conversion_context *ctx, const VkSpecializationInfo32 *in, uint32_t count) -{ - VkSpecializationInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSpecializationInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkPipelineShaderStageCreateInfo_win64_to_host(struct conversion_context *ctx, const VkPipelineShaderStageCreateInfo *in, VkPipelineShaderStageCreateInfo *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stage = in->stage; - out->module = in->module; - out->pName = in->pName; - out->pSpecializationInfo = in->pSpecializationInfo; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO: - { - VkShaderModuleCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkShaderModuleCreateInfo *in_ext = (const VkShaderModuleCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->codeSize = in_ext->codeSize; - out_ext->pCode = in_ext->pCode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT: - { - VkShaderModuleValidationCacheCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkShaderModuleValidationCacheCreateInfoEXT *in_ext = (const VkShaderModuleValidationCacheCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->validationCache = in_ext->validationCache; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT: - { - VkDebugUtilsObjectNameInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDebugUtilsObjectNameInfoEXT *in_ext = (const VkDebugUtilsObjectNameInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; - out_ext->pNext = NULL; - out_ext->objectType = in_ext->objectType; - out_ext->objectHandle = wine_vk_unwrap_handle(in_ext->objectType, in_ext->objectHandle); - out_ext->pObjectName = in_ext->pObjectName; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO: - { - VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *in_ext = (const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->requiredSubgroupSize = in_ext->requiredSubgroupSize; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT: - { - VkPipelineShaderStageModuleIdentifierCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineShaderStageModuleIdentifierCreateInfoEXT *in_ext = (const VkPipelineShaderStageModuleIdentifierCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->identifierSize = in_ext->identifierSize; - out_ext->pIdentifier = in_ext->pIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT: - { - VkPipelineRobustnessCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRobustnessCreateInfoEXT *in_ext = (const VkPipelineRobustnessCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->storageBuffers = in_ext->storageBuffers; - out_ext->uniformBuffers = in_ext->uniformBuffers; - out_ext->vertexInputs = in_ext->vertexInputs; - out_ext->images = in_ext->images; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} -#endif /* _WIN64 */ - -static inline void convert_VkPipelineShaderStageCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineShaderStageCreateInfo32 *in, VkPipelineShaderStageCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stage = in->stage; - out->module = in->module; - out->pName = (const char *)UlongToPtr(in->pName); - out->pSpecializationInfo = convert_VkSpecializationInfo_array_win32_to_host(ctx, (const VkSpecializationInfo32 *)UlongToPtr(in->pSpecializationInfo), 1); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO: - { - VkShaderModuleCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkShaderModuleCreateInfo32 *in_ext = (const VkShaderModuleCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->codeSize = in_ext->codeSize; - out_ext->pCode = (const uint32_t *)UlongToPtr(in_ext->pCode); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT: - { - VkShaderModuleValidationCacheCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkShaderModuleValidationCacheCreateInfoEXT32 *in_ext = (const VkShaderModuleValidationCacheCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->validationCache = in_ext->validationCache; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT: - { - VkDebugUtilsObjectNameInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDebugUtilsObjectNameInfoEXT32 *in_ext = (const VkDebugUtilsObjectNameInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; - out_ext->pNext = NULL; - out_ext->objectType = in_ext->objectType; - out_ext->objectHandle = wine_vk_unwrap_handle(in_ext->objectType, in_ext->objectHandle); - out_ext->pObjectName = (const char *)UlongToPtr(in_ext->pObjectName); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO: - { - VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 *in_ext = (const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->requiredSubgroupSize = in_ext->requiredSubgroupSize; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT: - { - VkPipelineShaderStageModuleIdentifierCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineShaderStageModuleIdentifierCreateInfoEXT32 *in_ext = (const VkPipelineShaderStageModuleIdentifierCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->identifierSize = in_ext->identifierSize; - out_ext->pIdentifier = (const uint8_t *)UlongToPtr(in_ext->pIdentifier); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT: - { - VkPipelineRobustnessCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRobustnessCreateInfoEXT32 *in_ext = (const VkPipelineRobustnessCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->storageBuffers = in_ext->storageBuffers; - out_ext->uniformBuffers = in_ext->uniformBuffers; - out_ext->vertexInputs = in_ext->vertexInputs; - out_ext->images = in_ext->images; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline void convert_VkComputePipelineCreateInfo_win64_to_host(struct conversion_context *ctx, const VkComputePipelineCreateInfo *in, VkComputePipelineCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - convert_VkPipelineShaderStageCreateInfo_win64_to_host(ctx, &in->stage, &out->stage); - out->layout = in->layout; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; -} -#endif /* _WIN64 */ - -static inline void convert_VkComputePipelineCreateInfo_win32_to_host(struct conversion_context *ctx, const VkComputePipelineCreateInfo32 *in, VkComputePipelineCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - convert_VkPipelineShaderStageCreateInfo_win32_to_host(ctx, &in->stage, &out->stage); - out->layout = in->layout; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR: - { - VkPipelineCreateFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreateFlags2CreateInfoKHR32 *in_ext = (const VkPipelineCreateFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreationFeedbackCreateInfo32 *in_ext = (const VkPipelineCreationFeedbackCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->pPipelineCreationFeedback = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineCreationFeedback), 1); - out_ext->pipelineStageCreationFeedbackCount = in_ext->pipelineStageCreationFeedbackCount; - out_ext->pPipelineStageCreationFeedbacks = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SUBPASS_SHADING_PIPELINE_CREATE_INFO_HUAWEI: - { - VkSubpassShadingPipelineCreateInfoHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSubpassShadingPipelineCreateInfoHUAWEI32 *in_ext = (const VkSubpassShadingPipelineCreateInfoHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SUBPASS_SHADING_PIPELINE_CREATE_INFO_HUAWEI; - out_ext->pNext = NULL; - out_ext->renderPass = in_ext->renderPass; - out_ext->subpass = in_ext->subpass; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD: - { - VkPipelineCompilerControlCreateInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCompilerControlCreateInfoAMD32 *in_ext = (const VkPipelineCompilerControlCreateInfoAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD; - out_ext->pNext = NULL; - out_ext->compilerControlFlags = in_ext->compilerControlFlags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT: - { - VkPipelineRobustnessCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRobustnessCreateInfoEXT32 *in_ext = (const VkPipelineRobustnessCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->storageBuffers = in_ext->storageBuffers; - out_ext->uniformBuffers = in_ext->uniformBuffers; - out_ext->vertexInputs = in_ext->vertexInputs; - out_ext->images = in_ext->images; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkComputePipelineCreateInfo_host_to_win32(const VkComputePipelineCreateInfo *in, const VkComputePipelineCreateInfo32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO); - const VkPipelineCreationFeedbackCreateInfo *in_ext = (const VkPipelineCreationFeedbackCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineCreationFeedback, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineCreationFeedback), 1); - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineStageCreationFeedbacks, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -#ifdef _WIN64 -static inline const VkComputePipelineCreateInfo *convert_VkComputePipelineCreateInfo_array_win64_to_host(struct conversion_context *ctx, const VkComputePipelineCreateInfo *in, uint32_t count) -{ - VkComputePipelineCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkComputePipelineCreateInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkComputePipelineCreateInfo *convert_VkComputePipelineCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkComputePipelineCreateInfo32 *in, uint32_t count) -{ - VkComputePipelineCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkComputePipelineCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkComputePipelineCreateInfo_array_host_to_win32(const VkComputePipelineCreateInfo *in, const VkComputePipelineCreateInfo32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkComputePipelineCreateInfo_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkCuFunctionCreateInfoNVX_win32_to_host(const VkCuFunctionCreateInfoNVX32 *in, VkCuFunctionCreateInfoNVX *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->module = in->module; - out->pName = (const char *)UlongToPtr(in->pName); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCuModuleCreateInfoNVX_win32_to_host(const VkCuModuleCreateInfoNVX32 *in, VkCuModuleCreateInfoNVX *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->dataSize = in->dataSize; - out->pData = (const void *)UlongToPtr(in->pData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCudaFunctionCreateInfoNV_win32_to_host(const VkCudaFunctionCreateInfoNV32 *in, VkCudaFunctionCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->module = in->module; - out->pName = (const char *)UlongToPtr(in->pName); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCudaModuleCreateInfoNV_win32_to_host(const VkCudaModuleCreateInfoNV32 *in, VkCudaModuleCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->dataSize = in->dataSize; - out->pData = (const void *)UlongToPtr(in->pData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDebugReportCallbackCreateInfoEXT_win32_to_host(const VkDebugReportCallbackCreateInfoEXT32 *in, VkDebugReportCallbackCreateInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pfnCallback = in->pfnCallback; - out->pUserData = (void *)UlongToPtr(in->pUserData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDebugUtilsMessengerCreateInfoEXT_win32_to_host(const VkDebugUtilsMessengerCreateInfoEXT32 *in, VkDebugUtilsMessengerCreateInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->messageSeverity = in->messageSeverity; - out->messageType = in->messageType; - out->pfnUserCallback = in->pfnUserCallback; - out->pUserData = (void *)UlongToPtr(in->pUserData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMutableDescriptorTypeListEXT_win32_to_host(const VkMutableDescriptorTypeListEXT32 *in, VkMutableDescriptorTypeListEXT *out) -{ - if (!in) return; - - out->descriptorTypeCount = in->descriptorTypeCount; - out->pDescriptorTypes = (const VkDescriptorType *)UlongToPtr(in->pDescriptorTypes); -} - -static inline const VkMutableDescriptorTypeListEXT *convert_VkMutableDescriptorTypeListEXT_array_win32_to_host(struct conversion_context *ctx, const VkMutableDescriptorTypeListEXT32 *in, uint32_t count) -{ - VkMutableDescriptorTypeListEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMutableDescriptorTypeListEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDescriptorPoolCreateInfo_win32_to_host(struct conversion_context *ctx, const VkDescriptorPoolCreateInfo32 *in, VkDescriptorPoolCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->maxSets = in->maxSets; - out->poolSizeCount = in->poolSizeCount; - out->pPoolSizes = (const VkDescriptorPoolSize *)UlongToPtr(in->pPoolSizes); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO: - { - VkDescriptorPoolInlineUniformBlockCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDescriptorPoolInlineUniformBlockCreateInfo32 *in_ext = (const VkDescriptorPoolInlineUniformBlockCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->maxInlineUniformBlockBindings = in_ext->maxInlineUniformBlockBindings; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT: - { - VkMutableDescriptorTypeCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMutableDescriptorTypeCreateInfoEXT32 *in_ext = (const VkMutableDescriptorTypeCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->mutableDescriptorTypeListCount = in_ext->mutableDescriptorTypeListCount; - out_ext->pMutableDescriptorTypeLists = convert_VkMutableDescriptorTypeListEXT_array_win32_to_host(ctx, (const VkMutableDescriptorTypeListEXT32 *)UlongToPtr(in_ext->pMutableDescriptorTypeLists), in_ext->mutableDescriptorTypeListCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkDescriptorSetLayoutBinding_win32_to_host(const VkDescriptorSetLayoutBinding32 *in, VkDescriptorSetLayoutBinding *out) -{ - if (!in) return; - - out->binding = in->binding; - out->descriptorType = in->descriptorType; - out->descriptorCount = in->descriptorCount; - out->stageFlags = in->stageFlags; - out->pImmutableSamplers = (const VkSampler *)UlongToPtr(in->pImmutableSamplers); -} - -static inline const VkDescriptorSetLayoutBinding *convert_VkDescriptorSetLayoutBinding_array_win32_to_host(struct conversion_context *ctx, const VkDescriptorSetLayoutBinding32 *in, uint32_t count) -{ - VkDescriptorSetLayoutBinding *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDescriptorSetLayoutBinding_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDescriptorSetLayoutCreateInfo_win32_to_host(struct conversion_context *ctx, const VkDescriptorSetLayoutCreateInfo32 *in, VkDescriptorSetLayoutCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->bindingCount = in->bindingCount; - out->pBindings = convert_VkDescriptorSetLayoutBinding_array_win32_to_host(ctx, (const VkDescriptorSetLayoutBinding32 *)UlongToPtr(in->pBindings), in->bindingCount); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO: - { - VkDescriptorSetLayoutBindingFlagsCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDescriptorSetLayoutBindingFlagsCreateInfo32 *in_ext = (const VkDescriptorSetLayoutBindingFlagsCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->bindingCount = in_ext->bindingCount; - out_ext->pBindingFlags = (const VkDescriptorBindingFlags *)UlongToPtr(in_ext->pBindingFlags); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT: - { - VkMutableDescriptorTypeCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMutableDescriptorTypeCreateInfoEXT32 *in_ext = (const VkMutableDescriptorTypeCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->mutableDescriptorTypeListCount = in_ext->mutableDescriptorTypeListCount; - out_ext->pMutableDescriptorTypeLists = convert_VkMutableDescriptorTypeListEXT_array_win32_to_host(ctx, (const VkMutableDescriptorTypeListEXT32 *)UlongToPtr(in_ext->pMutableDescriptorTypeLists), in_ext->mutableDescriptorTypeListCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkDescriptorUpdateTemplateEntry_win32_to_host(const VkDescriptorUpdateTemplateEntry32 *in, VkDescriptorUpdateTemplateEntry *out) -{ - if (!in) return; - - out->dstBinding = in->dstBinding; - out->dstArrayElement = in->dstArrayElement; - out->descriptorCount = in->descriptorCount; - out->descriptorType = in->descriptorType; - out->offset = in->offset; - out->stride = in->stride; -} - -static inline const VkDescriptorUpdateTemplateEntry *convert_VkDescriptorUpdateTemplateEntry_array_win32_to_host(struct conversion_context *ctx, const VkDescriptorUpdateTemplateEntry32 *in, uint32_t count) -{ - VkDescriptorUpdateTemplateEntry *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDescriptorUpdateTemplateEntry_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDescriptorUpdateTemplateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkDescriptorUpdateTemplateCreateInfo32 *in, VkDescriptorUpdateTemplateCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->descriptorUpdateEntryCount = in->descriptorUpdateEntryCount; - out->pDescriptorUpdateEntries = convert_VkDescriptorUpdateTemplateEntry_array_win32_to_host(ctx, (const VkDescriptorUpdateTemplateEntry32 *)UlongToPtr(in->pDescriptorUpdateEntries), in->descriptorUpdateEntryCount); - out->templateType = in->templateType; - out->descriptorSetLayout = in->descriptorSetLayout; - out->pipelineBindPoint = in->pipelineBindPoint; - out->pipelineLayout = in->pipelineLayout; - out->set = in->set; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline const VkPhysicalDevice *convert_VkPhysicalDevice_array_win64_to_host(struct conversion_context *ctx, const VkPhysicalDevice *in, uint32_t count) -{ - VkPhysicalDevice *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = wine_phys_dev_from_handle(in[i])->host_physical_device; - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkPhysicalDevice *convert_VkPhysicalDevice_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count) -{ - VkPhysicalDevice *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = wine_phys_dev_from_handle(UlongToPtr(in[i]))->host_physical_device; - } - - return out; -} - -static inline void convert_VkDeviceQueueCreateInfo_win32_to_host(struct conversion_context *ctx, const VkDeviceQueueCreateInfo32 *in, VkDeviceQueueCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->queueFamilyIndex = in->queueFamilyIndex; - out->queueCount = in->queueCount; - out->pQueuePriorities = (const float *)UlongToPtr(in->pQueuePriorities); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR: - { - VkDeviceQueueGlobalPriorityCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceQueueGlobalPriorityCreateInfoKHR32 *in_ext = (const VkDeviceQueueGlobalPriorityCreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->globalPriority = in_ext->globalPriority; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM: - { - VkDeviceQueueShaderCoreControlCreateInfoARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceQueueShaderCoreControlCreateInfoARM32 *in_ext = (const VkDeviceQueueShaderCoreControlCreateInfoARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM; - out_ext->pNext = NULL; - out_ext->shaderCoreCount = in_ext->shaderCoreCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkDeviceQueueCreateInfo *convert_VkDeviceQueueCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkDeviceQueueCreateInfo32 *in, uint32_t count) -{ - VkDeviceQueueCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDeviceQueueCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline const char * const*convert_char_pointer_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count) -{ - char **out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - out[i] = UlongToPtr(in[i]); - } - - return (void *)out; -} - -#ifdef _WIN64 -static inline void convert_VkDeviceCreateInfo_win64_to_host(struct conversion_context *ctx, const VkDeviceCreateInfo *in, VkDeviceCreateInfo *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->queueCreateInfoCount = in->queueCreateInfoCount; - out->pQueueCreateInfos = in->pQueueCreateInfos; - out->enabledLayerCount = in->enabledLayerCount; - out->ppEnabledLayerNames = in->ppEnabledLayerNames; - out->enabledExtensionCount = in->enabledExtensionCount; - out->ppEnabledExtensionNames = in->ppEnabledExtensionNames; - out->pEnabledFeatures = in->pEnabledFeatures; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO: - break; - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->deviceGeneratedCommands = in_ext->deviceGeneratedCommands; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->deviceGeneratedCompute = in_ext->deviceGeneratedCompute; - out_ext->deviceGeneratedComputePipelines = in_ext->deviceGeneratedComputePipelines; - out_ext->deviceGeneratedComputeCaptureReplay = in_ext->deviceGeneratedComputeCaptureReplay; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO: - { - VkDevicePrivateDataCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDevicePrivateDataCreateInfo *in_ext = (const VkDevicePrivateDataCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->privateDataSlotRequestCount = in_ext->privateDataSlotRequestCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES: - { - VkPhysicalDevicePrivateDataFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrivateDataFeatures *in_ext = (const VkPhysicalDevicePrivateDataFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES; - out_ext->pNext = NULL; - out_ext->privateData = in_ext->privateData; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: - { - VkPhysicalDeviceFeatures2 *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFeatures2 *in_ext = (const VkPhysicalDeviceFeatures2 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; - out_ext->pNext = NULL; - out_ext->features = in_ext->features; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: - { - VkPhysicalDeviceVariablePointersFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVariablePointersFeatures *in_ext = (const VkPhysicalDeviceVariablePointersFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES; - out_ext->pNext = NULL; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: - { - VkPhysicalDeviceMultiviewFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewFeatures *in_ext = (const VkPhysicalDeviceMultiviewFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; - out_ext->pNext = NULL; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO: - { - VkDeviceGroupDeviceCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupDeviceCreateInfo *in_ext = (const VkDeviceGroupDeviceCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->physicalDeviceCount = in_ext->physicalDeviceCount; - out_ext->pPhysicalDevices = convert_VkPhysicalDevice_array_win64_to_host(ctx, in_ext->pPhysicalDevices, in_ext->physicalDeviceCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR: - { - VkPhysicalDevicePresentIdFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentIdFeaturesKHR *in_ext = (const VkPhysicalDevicePresentIdFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->presentId = in_ext->presentId; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR: - { - VkPhysicalDevicePresentWaitFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentWaitFeaturesKHR *in_ext = (const VkPhysicalDevicePresentWaitFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->presentWait = in_ext->presentWait; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: - { - VkPhysicalDevice16BitStorageFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice16BitStorageFeatures *in_ext = (const VkPhysicalDevice16BitStorageFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES: - { - VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *in_ext = (const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: - { - VkPhysicalDeviceSamplerYcbcrConversionFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSamplerYcbcrConversionFeatures *in_ext = (const VkPhysicalDeviceSamplerYcbcrConversionFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES; - out_ext->pNext = NULL; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: - { - VkPhysicalDeviceProtectedMemoryFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceProtectedMemoryFeatures *in_ext = (const VkPhysicalDeviceProtectedMemoryFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES; - out_ext->pNext = NULL; - out_ext->protectedMemory = in_ext->protectedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT: - { - VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *in_ext = (const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->advancedBlendCoherentOperations = in_ext->advancedBlendCoherentOperations; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT: - { - VkPhysicalDeviceMultiDrawFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiDrawFeaturesEXT *in_ext = (const VkPhysicalDeviceMultiDrawFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->multiDraw = in_ext->multiDraw; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES: - { - VkPhysicalDeviceInlineUniformBlockFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInlineUniformBlockFeatures *in_ext = (const VkPhysicalDeviceInlineUniformBlockFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES; - out_ext->pNext = NULL; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES: - { - VkPhysicalDeviceMaintenance4Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMaintenance4Features *in_ext = (const VkPhysicalDeviceMaintenance4Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES; - out_ext->pNext = NULL; - out_ext->maintenance4 = in_ext->maintenance4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR: - { - VkPhysicalDeviceMaintenance5FeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMaintenance5FeaturesKHR *in_ext = (const VkPhysicalDeviceMaintenance5FeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->maintenance5 = in_ext->maintenance5; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: - { - VkPhysicalDeviceShaderDrawParametersFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderDrawParametersFeatures *in_ext = (const VkPhysicalDeviceShaderDrawParametersFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: - { - VkPhysicalDeviceShaderFloat16Int8Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderFloat16Int8Features *in_ext = (const VkPhysicalDeviceShaderFloat16Int8Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES: - { - VkPhysicalDeviceHostQueryResetFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostQueryResetFeatures *in_ext = (const VkPhysicalDeviceHostQueryResetFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES; - out_ext->pNext = NULL; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *in_ext = (const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->globalPriorityQuery = in_ext->globalPriorityQuery; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES: - { - VkPhysicalDeviceDescriptorIndexingFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorIndexingFeatures *in_ext = (const VkPhysicalDeviceDescriptorIndexingFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: - { - VkPhysicalDeviceTimelineSemaphoreFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTimelineSemaphoreFeatures *in_ext = (const VkPhysicalDeviceTimelineSemaphoreFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES; - out_ext->pNext = NULL; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: - { - VkPhysicalDevice8BitStorageFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice8BitStorageFeatures *in_ext = (const VkPhysicalDevice8BitStorageFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: - { - VkPhysicalDeviceConditionalRenderingFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceConditionalRenderingFeaturesEXT *in_ext = (const VkPhysicalDeviceConditionalRenderingFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->conditionalRendering = in_ext->conditionalRendering; - out_ext->inheritedConditionalRendering = in_ext->inheritedConditionalRendering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES: - { - VkPhysicalDeviceVulkanMemoryModelFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkanMemoryModelFeatures *in_ext = (const VkPhysicalDeviceVulkanMemoryModelFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES; - out_ext->pNext = NULL; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES: - { - VkPhysicalDeviceShaderAtomicInt64Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicInt64Features *in_ext = (const VkPhysicalDeviceShaderAtomicInt64Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderBufferFloat32Atomics = in_ext->shaderBufferFloat32Atomics; - out_ext->shaderBufferFloat32AtomicAdd = in_ext->shaderBufferFloat32AtomicAdd; - out_ext->shaderBufferFloat64Atomics = in_ext->shaderBufferFloat64Atomics; - out_ext->shaderBufferFloat64AtomicAdd = in_ext->shaderBufferFloat64AtomicAdd; - out_ext->shaderSharedFloat32Atomics = in_ext->shaderSharedFloat32Atomics; - out_ext->shaderSharedFloat32AtomicAdd = in_ext->shaderSharedFloat32AtomicAdd; - out_ext->shaderSharedFloat64Atomics = in_ext->shaderSharedFloat64Atomics; - out_ext->shaderSharedFloat64AtomicAdd = in_ext->shaderSharedFloat64AtomicAdd; - out_ext->shaderImageFloat32Atomics = in_ext->shaderImageFloat32Atomics; - out_ext->shaderImageFloat32AtomicAdd = in_ext->shaderImageFloat32AtomicAdd; - out_ext->sparseImageFloat32Atomics = in_ext->sparseImageFloat32Atomics; - out_ext->sparseImageFloat32AtomicAdd = in_ext->sparseImageFloat32AtomicAdd; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *in_ext = (const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderBufferFloat16Atomics = in_ext->shaderBufferFloat16Atomics; - out_ext->shaderBufferFloat16AtomicAdd = in_ext->shaderBufferFloat16AtomicAdd; - out_ext->shaderBufferFloat16AtomicMinMax = in_ext->shaderBufferFloat16AtomicMinMax; - out_ext->shaderBufferFloat32AtomicMinMax = in_ext->shaderBufferFloat32AtomicMinMax; - out_ext->shaderBufferFloat64AtomicMinMax = in_ext->shaderBufferFloat64AtomicMinMax; - out_ext->shaderSharedFloat16Atomics = in_ext->shaderSharedFloat16Atomics; - out_ext->shaderSharedFloat16AtomicAdd = in_ext->shaderSharedFloat16AtomicAdd; - out_ext->shaderSharedFloat16AtomicMinMax = in_ext->shaderSharedFloat16AtomicMinMax; - out_ext->shaderSharedFloat32AtomicMinMax = in_ext->shaderSharedFloat32AtomicMinMax; - out_ext->shaderSharedFloat64AtomicMinMax = in_ext->shaderSharedFloat64AtomicMinMax; - out_ext->shaderImageFloat32AtomicMinMax = in_ext->shaderImageFloat32AtomicMinMax; - out_ext->sparseImageFloat32AtomicMinMax = in_ext->sparseImageFloat32AtomicMinMax; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: - { - VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *in_ext = (const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->vertexAttributeInstanceRateDivisor = in_ext->vertexAttributeInstanceRateDivisor; - out_ext->vertexAttributeInstanceRateZeroDivisor = in_ext->vertexAttributeInstanceRateZeroDivisor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT: - { - VkPhysicalDeviceASTCDecodeFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceASTCDecodeFeaturesEXT *in_ext = (const VkPhysicalDeviceASTCDecodeFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->decodeModeSharedExponent = in_ext->decodeModeSharedExponent; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceTransformFeedbackFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTransformFeedbackFeaturesEXT *in_ext = (const VkPhysicalDeviceTransformFeedbackFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->transformFeedback = in_ext->transformFeedback; - out_ext->geometryStreams = in_ext->geometryStreams; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV: - { - VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *in_ext = (const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->representativeFragmentTest = in_ext->representativeFragmentTest; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceExclusiveScissorFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExclusiveScissorFeaturesNV *in_ext = (const VkPhysicalDeviceExclusiveScissorFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->exclusiveScissor = in_ext->exclusiveScissor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceCornerSampledImageFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCornerSampledImageFeaturesNV *in_ext = (const VkPhysicalDeviceCornerSampledImageFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cornerSampledImage = in_ext->cornerSampledImage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: - { - VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *in_ext = (const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->computeDerivativeGroupQuads = in_ext->computeDerivativeGroupQuads; - out_ext->computeDerivativeGroupLinear = in_ext->computeDerivativeGroupLinear; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV: - { - VkPhysicalDeviceShaderImageFootprintFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderImageFootprintFeaturesNV *in_ext = (const VkPhysicalDeviceShaderImageFootprintFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->imageFootprint = in_ext->imageFootprint; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV: - { - VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *in_ext = (const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->dedicatedAllocationImageAliasing = in_ext->dedicatedAllocationImageAliasing; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV: - { - VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *in_ext = (const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->indirectCopy = in_ext->indirectCopy; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV: - { - VkPhysicalDeviceMemoryDecompressionFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMemoryDecompressionFeaturesNV *in_ext = (const VkPhysicalDeviceMemoryDecompressionFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->memoryDecompression = in_ext->memoryDecompression; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceShadingRateImageFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShadingRateImageFeaturesNV *in_ext = (const VkPhysicalDeviceShadingRateImageFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->shadingRateImage = in_ext->shadingRateImage; - out_ext->shadingRateCoarseSampleOrder = in_ext->shadingRateCoarseSampleOrder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI: - { - VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *in_ext = (const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->invocationMask = in_ext->invocationMask; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV: - { - VkPhysicalDeviceMeshShaderFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMeshShaderFeaturesNV *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT: - { - VkPhysicalDeviceMeshShaderFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMeshShaderFeaturesEXT *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_ext->multiviewMeshShader = in_ext->multiviewMeshShader; - out_ext->primitiveFragmentShadingRateMeshShader = in_ext->primitiveFragmentShadingRateMeshShader; - out_ext->meshShaderQueries = in_ext->meshShaderQueries; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR: - { - VkPhysicalDeviceAccelerationStructureFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAccelerationStructureFeaturesKHR *in_ext = (const VkPhysicalDeviceAccelerationStructureFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->accelerationStructure = in_ext->accelerationStructure; - out_ext->accelerationStructureCaptureReplay = in_ext->accelerationStructureCaptureReplay; - out_ext->accelerationStructureIndirectBuild = in_ext->accelerationStructureIndirectBuild; - out_ext->accelerationStructureHostCommands = in_ext->accelerationStructureHostCommands; - out_ext->descriptorBindingAccelerationStructureUpdateAfterBind = in_ext->descriptorBindingAccelerationStructureUpdateAfterBind; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPipelineFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingPipelineFeaturesKHR *in_ext = (const VkPhysicalDeviceRayTracingPipelineFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingPipeline = in_ext->rayTracingPipeline; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplay = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplay; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - out_ext->rayTracingPipelineTraceRaysIndirect = in_ext->rayTracingPipelineTraceRaysIndirect; - out_ext->rayTraversalPrimitiveCulling = in_ext->rayTraversalPrimitiveCulling; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceRayQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayQueryFeaturesKHR *in_ext = (const VkPhysicalDeviceRayQueryFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayQuery = in_ext->rayQuery; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *in_ext = (const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingMaintenance1 = in_ext->rayTracingMaintenance1; - out_ext->rayTracingPipelineTraceRaysIndirect2 = in_ext->rayTracingPipelineTraceRaysIndirect2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD: - { - VkDeviceMemoryOverallocationCreateInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceMemoryOverallocationCreateInfoAMD *in_ext = (const VkDeviceMemoryOverallocationCreateInfoAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD; - out_ext->pNext = NULL; - out_ext->overallocationBehavior = in_ext->overallocationBehavior; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMapFeaturesEXT *in_ext = (const VkPhysicalDeviceFragmentDensityMapFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMap = in_ext->fragmentDensityMap; - out_ext->fragmentDensityMapDynamic = in_ext->fragmentDensityMapDynamic; - out_ext->fragmentDensityMapNonSubsampledImages = in_ext->fragmentDensityMapNonSubsampledImages; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *in_ext = (const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapDeferred = in_ext->fragmentDensityMapDeferred; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM: - { - VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *in_ext = (const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapOffset = in_ext->fragmentDensityMapOffset; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES: - { - VkPhysicalDeviceScalarBlockLayoutFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceScalarBlockLayoutFeatures *in_ext = (const VkPhysicalDeviceScalarBlockLayoutFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES; - out_ext->pNext = NULL; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES: - { - VkPhysicalDeviceUniformBufferStandardLayoutFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceUniformBufferStandardLayoutFeatures *in_ext = (const VkPhysicalDeviceUniformBufferStandardLayoutFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES; - out_ext->pNext = NULL; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipEnableFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClipEnableFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthClipEnableFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClipEnable = in_ext->depthClipEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT: - { - VkPhysicalDeviceMemoryPriorityFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMemoryPriorityFeaturesEXT *in_ext = (const VkPhysicalDeviceMemoryPriorityFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->memoryPriority = in_ext->memoryPriority; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT: - { - VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *in_ext = (const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pageableDeviceLocalMemory = in_ext->pageableDeviceLocalMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES: - { - VkPhysicalDeviceBufferDeviceAddressFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBufferDeviceAddressFeatures *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES; - out_ext->pNext = NULL; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT: - { - VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES: - { - VkPhysicalDeviceImagelessFramebufferFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImagelessFramebufferFeatures *in_ext = (const VkPhysicalDeviceImagelessFramebufferFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES; - out_ext->pNext = NULL; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES: - { - VkPhysicalDeviceTextureCompressionASTCHDRFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTextureCompressionASTCHDRFeatures *in_ext = (const VkPhysicalDeviceTextureCompressionASTCHDRFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES; - out_ext->pNext = NULL; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV: - { - VkPhysicalDeviceCooperativeMatrixFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCooperativeMatrixFeaturesNV *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *in_ext = (const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->ycbcrImageArrays = in_ext->ycbcrImageArrays; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV: - { - VkPhysicalDevicePresentBarrierFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentBarrierFeaturesNV *in_ext = (const VkPhysicalDevicePresentBarrierFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->presentBarrier = in_ext->presentBarrier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR: - { - VkPhysicalDevicePerformanceQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePerformanceQueryFeaturesKHR *in_ext = (const VkPhysicalDevicePerformanceQueryFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->performanceCounterQueryPools = in_ext->performanceCounterQueryPools; - out_ext->performanceCounterMultipleQueryPools = in_ext->performanceCounterMultipleQueryPools; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_RESERVATION_INFO_KHR: - { - VkPerformanceQueryReservationInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPerformanceQueryReservationInfoKHR *in_ext = (const VkPerformanceQueryReservationInfoKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_RESERVATION_INFO_KHR; - out_ext->pNext = NULL; - out_ext->maxPerformanceQueriesPerPool = in_ext->maxPerformanceQueriesPerPool; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV: - { - VkPhysicalDeviceCoverageReductionModeFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCoverageReductionModeFeaturesNV *in_ext = (const VkPhysicalDeviceCoverageReductionModeFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->coverageReductionMode = in_ext->coverageReductionMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL: - { - VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *in_ext = (const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL; - out_ext->pNext = NULL; - out_ext->shaderIntegerFunctions2 = in_ext->shaderIntegerFunctions2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR: - { - VkPhysicalDeviceShaderClockFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderClockFeaturesKHR *in_ext = (const VkPhysicalDeviceShaderClockFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->shaderSubgroupClock = in_ext->shaderSubgroupClock; - out_ext->shaderDeviceClock = in_ext->shaderDeviceClock; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT: - { - VkPhysicalDeviceIndexTypeUint8FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceIndexTypeUint8FeaturesEXT *in_ext = (const VkPhysicalDeviceIndexTypeUint8FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->indexTypeUint8 = in_ext->indexTypeUint8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV: - { - VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *in_ext = (const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->shaderSMBuiltins = in_ext->shaderSMBuiltins; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT: - { - VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *in_ext = (const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentShaderSampleInterlock = in_ext->fragmentShaderSampleInterlock; - out_ext->fragmentShaderPixelInterlock = in_ext->fragmentShaderPixelInterlock; - out_ext->fragmentShaderShadingRateInterlock = in_ext->fragmentShaderShadingRateInterlock; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES: - { - VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *in_ext = (const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES; - out_ext->pNext = NULL; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT: - { - VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *in_ext = (const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->primitiveTopologyListRestart = in_ext->primitiveTopologyListRestart; - out_ext->primitiveTopologyPatchListRestart = in_ext->primitiveTopologyPatchListRestart; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR: - { - VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *in_ext = (const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->pipelineExecutableInfo = in_ext->pipelineExecutableInfo; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *in_ext = (const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT: - { - VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *in_ext = (const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->texelBufferAlignment = in_ext->texelBufferAlignment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES: - { - VkPhysicalDeviceSubgroupSizeControlFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubgroupSizeControlFeatures *in_ext = (const VkPhysicalDeviceSubgroupSizeControlFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES; - out_ext->pNext = NULL; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: - { - VkPhysicalDeviceLineRasterizationFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLineRasterizationFeaturesEXT *in_ext = (const VkPhysicalDeviceLineRasterizationFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->rectangularLines = in_ext->rectangularLines; - out_ext->bresenhamLines = in_ext->bresenhamLines; - out_ext->smoothLines = in_ext->smoothLines; - out_ext->stippledRectangularLines = in_ext->stippledRectangularLines; - out_ext->stippledBresenhamLines = in_ext->stippledBresenhamLines; - out_ext->stippledSmoothLines = in_ext->stippledSmoothLines; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES: - { - VkPhysicalDevicePipelineCreationCacheControlFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineCreationCacheControlFeatures *in_ext = (const VkPhysicalDevicePipelineCreationCacheControlFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES; - out_ext->pNext = NULL; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: - { - VkPhysicalDeviceVulkan11Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan11Features *in_ext = (const VkPhysicalDeviceVulkan11Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_ext->protectedMemory = in_ext->protectedMemory; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES: - { - VkPhysicalDeviceVulkan12Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan12Features *in_ext = (const VkPhysicalDeviceVulkan12Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; - out_ext->pNext = NULL; - out_ext->samplerMirrorClampToEdge = in_ext->samplerMirrorClampToEdge; - out_ext->drawIndirectCount = in_ext->drawIndirectCount; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_ext->descriptorIndexing = in_ext->descriptorIndexing; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_ext->samplerFilterMinmax = in_ext->samplerFilterMinmax; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_ext->shaderOutputViewportIndex = in_ext->shaderOutputViewportIndex; - out_ext->shaderOutputLayer = in_ext->shaderOutputLayer; - out_ext->subgroupBroadcastDynamicId = in_ext->subgroupBroadcastDynamicId; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES: - { - VkPhysicalDeviceVulkan13Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan13Features *in_ext = (const VkPhysicalDeviceVulkan13Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; - out_ext->pNext = NULL; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_ext->privateData = in_ext->privateData; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_ext->synchronization2 = in_ext->synchronization2; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_ext->maintenance4 = in_ext->maintenance4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD: - { - VkPhysicalDeviceCoherentMemoryFeaturesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCoherentMemoryFeaturesAMD *in_ext = (const VkPhysicalDeviceCoherentMemoryFeaturesAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD; - out_ext->pNext = NULL; - out_ext->deviceCoherentMemory = in_ext->deviceCoherentMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT: - { - VkPhysicalDeviceCustomBorderColorFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCustomBorderColorFeaturesEXT *in_ext = (const VkPhysicalDeviceCustomBorderColorFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->customBorderColors = in_ext->customBorderColors; - out_ext->customBorderColorWithoutFormat = in_ext->customBorderColorWithoutFormat; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT: - { - VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *in_ext = (const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->borderColorSwizzle = in_ext->borderColorSwizzle; - out_ext->borderColorSwizzleFromImage = in_ext->borderColorSwizzleFromImage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState = in_ext->extendedDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState2 = in_ext->extendedDynamicState2; - out_ext->extendedDynamicState2LogicOp = in_ext->extendedDynamicState2LogicOp; - out_ext->extendedDynamicState2PatchControlPoints = in_ext->extendedDynamicState2PatchControlPoints; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState3TessellationDomainOrigin = in_ext->extendedDynamicState3TessellationDomainOrigin; - out_ext->extendedDynamicState3DepthClampEnable = in_ext->extendedDynamicState3DepthClampEnable; - out_ext->extendedDynamicState3PolygonMode = in_ext->extendedDynamicState3PolygonMode; - out_ext->extendedDynamicState3RasterizationSamples = in_ext->extendedDynamicState3RasterizationSamples; - out_ext->extendedDynamicState3SampleMask = in_ext->extendedDynamicState3SampleMask; - out_ext->extendedDynamicState3AlphaToCoverageEnable = in_ext->extendedDynamicState3AlphaToCoverageEnable; - out_ext->extendedDynamicState3AlphaToOneEnable = in_ext->extendedDynamicState3AlphaToOneEnable; - out_ext->extendedDynamicState3LogicOpEnable = in_ext->extendedDynamicState3LogicOpEnable; - out_ext->extendedDynamicState3ColorBlendEnable = in_ext->extendedDynamicState3ColorBlendEnable; - out_ext->extendedDynamicState3ColorBlendEquation = in_ext->extendedDynamicState3ColorBlendEquation; - out_ext->extendedDynamicState3ColorWriteMask = in_ext->extendedDynamicState3ColorWriteMask; - out_ext->extendedDynamicState3RasterizationStream = in_ext->extendedDynamicState3RasterizationStream; - out_ext->extendedDynamicState3ConservativeRasterizationMode = in_ext->extendedDynamicState3ConservativeRasterizationMode; - out_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize = in_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize; - out_ext->extendedDynamicState3DepthClipEnable = in_ext->extendedDynamicState3DepthClipEnable; - out_ext->extendedDynamicState3SampleLocationsEnable = in_ext->extendedDynamicState3SampleLocationsEnable; - out_ext->extendedDynamicState3ColorBlendAdvanced = in_ext->extendedDynamicState3ColorBlendAdvanced; - out_ext->extendedDynamicState3ProvokingVertexMode = in_ext->extendedDynamicState3ProvokingVertexMode; - out_ext->extendedDynamicState3LineRasterizationMode = in_ext->extendedDynamicState3LineRasterizationMode; - out_ext->extendedDynamicState3LineStippleEnable = in_ext->extendedDynamicState3LineStippleEnable; - out_ext->extendedDynamicState3DepthClipNegativeOneToOne = in_ext->extendedDynamicState3DepthClipNegativeOneToOne; - out_ext->extendedDynamicState3ViewportWScalingEnable = in_ext->extendedDynamicState3ViewportWScalingEnable; - out_ext->extendedDynamicState3ViewportSwizzle = in_ext->extendedDynamicState3ViewportSwizzle; - out_ext->extendedDynamicState3CoverageToColorEnable = in_ext->extendedDynamicState3CoverageToColorEnable; - out_ext->extendedDynamicState3CoverageToColorLocation = in_ext->extendedDynamicState3CoverageToColorLocation; - out_ext->extendedDynamicState3CoverageModulationMode = in_ext->extendedDynamicState3CoverageModulationMode; - out_ext->extendedDynamicState3CoverageModulationTableEnable = in_ext->extendedDynamicState3CoverageModulationTableEnable; - out_ext->extendedDynamicState3CoverageModulationTable = in_ext->extendedDynamicState3CoverageModulationTable; - out_ext->extendedDynamicState3CoverageReductionMode = in_ext->extendedDynamicState3CoverageReductionMode; - out_ext->extendedDynamicState3RepresentativeFragmentTestEnable = in_ext->extendedDynamicState3RepresentativeFragmentTestEnable; - out_ext->extendedDynamicState3ShadingRateImageEnable = in_ext->extendedDynamicState3ShadingRateImageEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV: - { - VkPhysicalDeviceDiagnosticsConfigFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDiagnosticsConfigFeaturesNV *in_ext = (const VkPhysicalDeviceDiagnosticsConfigFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->diagnosticsConfig = in_ext->diagnosticsConfig; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV: - { - VkDeviceDiagnosticsConfigCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceDiagnosticsConfigCreateInfoNV *in_ext = (const VkDeviceDiagnosticsConfigCreateInfoNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES: - { - VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *in_ext = (const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR: - { - VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *in_ext = (const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->shaderSubgroupUniformControlFlow = in_ext->shaderSubgroupUniformControlFlow; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: - { - VkPhysicalDeviceRobustness2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRobustness2FeaturesEXT *in_ext = (const VkPhysicalDeviceRobustness2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->robustBufferAccess2 = in_ext->robustBufferAccess2; - out_ext->robustImageAccess2 = in_ext->robustImageAccess2; - out_ext->nullDescriptor = in_ext->nullDescriptor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES: - { - VkPhysicalDeviceImageRobustnessFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageRobustnessFeatures *in_ext = (const VkPhysicalDeviceImageRobustnessFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES; - out_ext->pNext = NULL; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR: - { - VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *in_ext = (const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->workgroupMemoryExplicitLayout = in_ext->workgroupMemoryExplicitLayout; - out_ext->workgroupMemoryExplicitLayoutScalarBlockLayout = in_ext->workgroupMemoryExplicitLayoutScalarBlockLayout; - out_ext->workgroupMemoryExplicitLayout8BitAccess = in_ext->workgroupMemoryExplicitLayout8BitAccess; - out_ext->workgroupMemoryExplicitLayout16BitAccess = in_ext->workgroupMemoryExplicitLayout16BitAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT: - { - VkPhysicalDevice4444FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice4444FormatsFeaturesEXT *in_ext = (const VkPhysicalDevice4444FormatsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->formatA4R4G4B4 = in_ext->formatA4R4G4B4; - out_ext->formatA4B4G4R4 = in_ext->formatA4B4G4R4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI: - { - VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *in_ext = (const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->subpassShading = in_ext->subpassShading; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI: - { - VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *in_ext = (const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->clustercullingShader = in_ext->clustercullingShader; - out_ext->multiviewClusterCullingShader = in_ext->multiviewClusterCullingShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT: - { - VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *in_ext = (const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderImageInt64Atomics = in_ext->shaderImageInt64Atomics; - out_ext->sparseImageInt64Atomics = in_ext->sparseImageInt64Atomics; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShadingRateFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateFeaturesKHR *in_ext = (const VkPhysicalDeviceFragmentShadingRateFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->pipelineFragmentShadingRate = in_ext->pipelineFragmentShadingRate; - out_ext->primitiveFragmentShadingRate = in_ext->primitiveFragmentShadingRate; - out_ext->attachmentFragmentShadingRate = in_ext->attachmentFragmentShadingRate; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderTerminateInvocationFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderTerminateInvocationFeatures *in_ext = (const VkPhysicalDeviceShaderTerminateInvocationFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV: - { - VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *in_ext = (const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->fragmentShadingRateEnums = in_ext->fragmentShadingRateEnums; - out_ext->supersampleFragmentShadingRates = in_ext->supersampleFragmentShadingRates; - out_ext->noInvocationFragmentShadingRates = in_ext->noInvocationFragmentShadingRates; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *in_ext = (const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->image2DViewOf3D = in_ext->image2DViewOf3D; - out_ext->sampler2DViewOf3D = in_ext->sampler2DViewOf3D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *in_ext = (const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageSlicedViewOf3D = in_ext->imageSlicedViewOf3D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->attachmentFeedbackLoopDynamicState = in_ext->attachmentFeedbackLoopDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT: - { - VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *in_ext = (const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->mutableDescriptorType = in_ext->mutableDescriptorType; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClipControlFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthClipControlFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClipControl = in_ext->depthClipControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *in_ext = (const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->vertexInputDynamicState = in_ext->vertexInputDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceColorWriteEnableFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceColorWriteEnableFeaturesEXT *in_ext = (const VkPhysicalDeviceColorWriteEnableFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->colorWriteEnable = in_ext->colorWriteEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES: - { - VkPhysicalDeviceSynchronization2Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSynchronization2Features *in_ext = (const VkPhysicalDeviceSynchronization2Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES; - out_ext->pNext = NULL; - out_ext->synchronization2 = in_ext->synchronization2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT: - { - VkPhysicalDeviceHostImageCopyFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostImageCopyFeaturesEXT *in_ext = (const VkPhysicalDeviceHostImageCopyFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->hostImageCopy = in_ext->hostImageCopy; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT: - { - VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *in_ext = (const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->primitivesGeneratedQuery = in_ext->primitivesGeneratedQuery; - out_ext->primitivesGeneratedQueryWithRasterizerDiscard = in_ext->primitivesGeneratedQueryWithRasterizerDiscard; - out_ext->primitivesGeneratedQueryWithNonZeroStreams = in_ext->primitivesGeneratedQueryWithNonZeroStreams; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT: - { - VkPhysicalDeviceLegacyDitheringFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLegacyDitheringFeaturesEXT *in_ext = (const VkPhysicalDeviceLegacyDitheringFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->legacyDithering = in_ext->legacyDithering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT: - { - VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *in_ext = (const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->multisampledRenderToSingleSampled = in_ext->multisampledRenderToSingleSampled; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *in_ext = (const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineProtectedAccess = in_ext->pipelineProtectedAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceInheritedViewportScissorFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInheritedViewportScissorFeaturesNV *in_ext = (const VkPhysicalDeviceInheritedViewportScissorFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->inheritedViewportScissor2D = in_ext->inheritedViewportScissor2D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *in_ext = (const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->ycbcr2plane444Formats = in_ext->ycbcr2plane444Formats; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: - { - VkPhysicalDeviceProvokingVertexFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceProvokingVertexFeaturesEXT *in_ext = (const VkPhysicalDeviceProvokingVertexFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->provokingVertexLast = in_ext->provokingVertexLast; - out_ext->transformFeedbackPreservesProvokingVertex = in_ext->transformFeedbackPreservesProvokingVertex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceDescriptorBufferFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorBufferFeaturesEXT *in_ext = (const VkPhysicalDeviceDescriptorBufferFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->descriptorBuffer = in_ext->descriptorBuffer; - out_ext->descriptorBufferCaptureReplay = in_ext->descriptorBufferCaptureReplay; - out_ext->descriptorBufferImageLayoutIgnored = in_ext->descriptorBufferImageLayoutIgnored; - out_ext->descriptorBufferPushDescriptors = in_ext->descriptorBufferPushDescriptors; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES: - { - VkPhysicalDeviceShaderIntegerDotProductFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderIntegerDotProductFeatures *in_ext = (const VkPhysicalDeviceShaderIntegerDotProductFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *in_ext = (const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->fragmentShaderBarycentric = in_ext->fragmentShaderBarycentric; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV: - { - VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *in_ext = (const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->rayTracingMotionBlur = in_ext->rayTracingMotionBlur; - out_ext->rayTracingMotionBlurPipelineTraceRaysIndirect = in_ext->rayTracingMotionBlurPipelineTraceRaysIndirect; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *in_ext = (const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->formatRgba10x6WithoutYCbCrSampler = in_ext->formatRgba10x6WithoutYCbCrSampler; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES: - { - VkPhysicalDeviceDynamicRenderingFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDynamicRenderingFeatures *in_ext = (const VkPhysicalDeviceDynamicRenderingFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES; - out_ext->pNext = NULL; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT: - { - VkPhysicalDeviceImageViewMinLodFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageViewMinLodFeaturesEXT *in_ext = (const VkPhysicalDeviceImageViewMinLodFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->minLod = in_ext->minLod; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT: - { - VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *in_ext = (const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->rasterizationOrderColorAttachmentAccess = in_ext->rasterizationOrderColorAttachmentAccess; - out_ext->rasterizationOrderDepthAttachmentAccess = in_ext->rasterizationOrderDepthAttachmentAccess; - out_ext->rasterizationOrderStencilAttachmentAccess = in_ext->rasterizationOrderStencilAttachmentAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV: - { - VkPhysicalDeviceLinearColorAttachmentFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLinearColorAttachmentFeaturesNV *in_ext = (const VkPhysicalDeviceLinearColorAttachmentFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->linearColorAttachment = in_ext->linearColorAttachment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT: - { - VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *in_ext = (const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->graphicsPipelineLibrary = in_ext->graphicsPipelineLibrary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE: - { - VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *in_ext = (const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE; - out_ext->pNext = NULL; - out_ext->descriptorSetHostMapping = in_ext->descriptorSetHostMapping; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceNestedCommandBufferFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNestedCommandBufferFeaturesEXT *in_ext = (const VkPhysicalDeviceNestedCommandBufferFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->nestedCommandBuffer = in_ext->nestedCommandBuffer; - out_ext->nestedCommandBufferRendering = in_ext->nestedCommandBufferRendering; - out_ext->nestedCommandBufferSimultaneousUse = in_ext->nestedCommandBufferSimultaneousUse; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT: - { - VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderModuleIdentifier = in_ext->shaderModuleIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageCompressionControlFeaturesEXT *in_ext = (const VkPhysicalDeviceImageCompressionControlFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageCompressionControl = in_ext->imageCompressionControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *in_ext = (const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageCompressionControlSwapchain = in_ext->imageCompressionControlSwapchain; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *in_ext = (const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->subpassMergeFeedback = in_ext->subpassMergeFeedback; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT: - { - VkPhysicalDeviceOpacityMicromapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceOpacityMicromapFeaturesEXT *in_ext = (const VkPhysicalDeviceOpacityMicromapFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->micromap = in_ext->micromap; - out_ext->micromapCaptureReplay = in_ext->micromapCaptureReplay; - out_ext->micromapHostCommands = in_ext->micromapHostCommands; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT: - { - VkPhysicalDevicePipelinePropertiesFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelinePropertiesFeaturesEXT *in_ext = (const VkPhysicalDevicePipelinePropertiesFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelinePropertiesIdentifier = in_ext->pipelinePropertiesIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD: - { - VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *in_ext = (const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD; - out_ext->pNext = NULL; - out_ext->shaderEarlyAndLateFragmentTests = in_ext->shaderEarlyAndLateFragmentTests; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT: - { - VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *in_ext = (const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->nonSeamlessCubeMap = in_ext->nonSeamlessCubeMap; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineRobustnessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineRobustnessFeaturesEXT *in_ext = (const VkPhysicalDevicePipelineRobustnessFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineRobustness = in_ext->pipelineRobustness; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessingFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageProcessingFeaturesQCOM *in_ext = (const VkPhysicalDeviceImageProcessingFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->textureSampleWeighted = in_ext->textureSampleWeighted; - out_ext->textureBoxFilter = in_ext->textureBoxFilter; - out_ext->textureBlockMatch = in_ext->textureBlockMatch; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM: - { - VkPhysicalDeviceTilePropertiesFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTilePropertiesFeaturesQCOM *in_ext = (const VkPhysicalDeviceTilePropertiesFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->tileProperties = in_ext->tileProperties; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->attachmentFeedbackLoopLayout = in_ext->attachmentFeedbackLoopLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClampZeroOne = in_ext->depthClampZeroOne; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT: - { - VkPhysicalDeviceAddressBindingReportFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAddressBindingReportFeaturesEXT *in_ext = (const VkPhysicalDeviceAddressBindingReportFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->reportAddressBinding = in_ext->reportAddressBinding; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV: - { - VkPhysicalDeviceOpticalFlowFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceOpticalFlowFeaturesNV *in_ext = (const VkPhysicalDeviceOpticalFlowFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->opticalFlow = in_ext->opticalFlow; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT: - { - VkPhysicalDeviceFaultFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFaultFeaturesEXT *in_ext = (const VkPhysicalDeviceFaultFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->deviceFault = in_ext->deviceFault; - out_ext->deviceFaultVendorBinary = in_ext->deviceFaultVendorBinary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT: - { - VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *in_ext = (const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineLibraryGroupHandles = in_ext->pipelineLibraryGroupHandles; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM: - { - VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *in_ext = (const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM; - out_ext->pNext = NULL; - out_ext->shaderCoreBuiltins = in_ext->shaderCoreBuiltins; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT: - { - VkPhysicalDeviceFrameBoundaryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFrameBoundaryFeaturesEXT *in_ext = (const VkPhysicalDeviceFrameBoundaryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->frameBoundary = in_ext->frameBoundary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT: - { - VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *in_ext = (const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->dynamicRenderingUnusedAttachments = in_ext->dynamicRenderingUnusedAttachments; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT: - { - VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *in_ext = (const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->swapchainMaintenance1 = in_ext->swapchainMaintenance1; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthBiasControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthBiasControlFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthBiasControlFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthBiasControl = in_ext->depthBiasControl; - out_ext->leastRepresentableValueForceUnormRepresentation = in_ext->leastRepresentableValueForceUnormRepresentation; - out_ext->floatRepresentation = in_ext->floatRepresentation; - out_ext->depthBiasExact = in_ext->depthBiasExact; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV: - { - VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *in_ext = (const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->rayTracingInvocationReorder = in_ext->rayTracingInvocationReorder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV: - { - VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *in_ext = (const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->extendedSparseAddressSpace = in_ext->extendedSparseAddressSpace; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *in_ext = (const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->multiviewPerViewViewports = in_ext->multiviewPerViewViewports; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *in_ext = (const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingPositionFetch = in_ext->rayTracingPositionFetch; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *in_ext = (const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->multiviewPerViewRenderAreas = in_ext->multiviewPerViewRenderAreas; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT: - { - VkPhysicalDeviceShaderObjectFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderObjectFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderObjectFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderObject = in_ext->shaderObject; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT: - { - VkPhysicalDeviceShaderTileImageFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderTileImageFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderTileImageFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderTileImageColorReadAccess = in_ext->shaderTileImageColorReadAccess; - out_ext->shaderTileImageDepthReadAccess = in_ext->shaderTileImageDepthReadAccess; - out_ext->shaderTileImageStencilReadAccess = in_ext->shaderTileImageStencilReadAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR: - { - VkPhysicalDeviceCooperativeMatrixFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCooperativeMatrixFeaturesKHR *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM: - { - VkPhysicalDeviceCubicClampFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCubicClampFeaturesQCOM *in_ext = (const VkPhysicalDeviceCubicClampFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->cubicRangeClamp = in_ext->cubicRangeClamp; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM: - { - VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *in_ext = (const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->ycbcrDegamma = in_ext->ycbcrDegamma; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM: - { - VkPhysicalDeviceCubicWeightsFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCubicWeightsFeaturesQCOM *in_ext = (const VkPhysicalDeviceCubicWeightsFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->selectableCubicWeights = in_ext->selectableCubicWeights; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessing2FeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageProcessing2FeaturesQCOM *in_ext = (const VkPhysicalDeviceImageProcessing2FeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->textureBlockMatch2 = in_ext->textureBlockMatch2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV: - { - VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *in_ext = (const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->descriptorPoolOverallocation = in_ext->descriptorPoolOverallocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV: - { - VkPhysicalDeviceCudaKernelLaunchFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCudaKernelLaunchFeaturesNV *in_ext = (const VkPhysicalDeviceCudaKernelLaunchFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cudaKernelLaunchFeatures = in_ext->cudaKernelLaunchFeatures; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM: - { - VkDeviceQueueShaderCoreControlCreateInfoARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceQueueShaderCoreControlCreateInfoARM *in_ext = (const VkDeviceQueueShaderCoreControlCreateInfoARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM; - out_ext->pNext = NULL; - out_ext->shaderCoreCount = in_ext->shaderCoreCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM: - { - VkPhysicalDeviceSchedulingControlsFeaturesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSchedulingControlsFeaturesARM *in_ext = (const VkPhysicalDeviceSchedulingControlsFeaturesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM; - out_ext->pNext = NULL; - out_ext->schedulingControls = in_ext->schedulingControls; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG: - { - VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *in_ext = (const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG; - out_ext->pNext = NULL; - out_ext->relaxedLineRasterization = in_ext->relaxedLineRasterization; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} -#endif /* _WIN64 */ - -static inline void convert_VkDeviceCreateInfo_win32_to_host(struct conversion_context *ctx, const VkDeviceCreateInfo32 *in, VkDeviceCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->queueCreateInfoCount = in->queueCreateInfoCount; - out->pQueueCreateInfos = convert_VkDeviceQueueCreateInfo_array_win32_to_host(ctx, (const VkDeviceQueueCreateInfo32 *)UlongToPtr(in->pQueueCreateInfos), in->queueCreateInfoCount); - out->enabledLayerCount = in->enabledLayerCount; - out->ppEnabledLayerNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledLayerNames), in->enabledLayerCount); - out->enabledExtensionCount = in->enabledExtensionCount; - out->ppEnabledExtensionNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledExtensionNames), in->enabledExtensionCount); - out->pEnabledFeatures = (const VkPhysicalDeviceFeatures *)UlongToPtr(in->pEnabledFeatures); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO: - break; - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32 *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->deviceGeneratedCommands = in_ext->deviceGeneratedCommands; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32 *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->deviceGeneratedCompute = in_ext->deviceGeneratedCompute; - out_ext->deviceGeneratedComputePipelines = in_ext->deviceGeneratedComputePipelines; - out_ext->deviceGeneratedComputeCaptureReplay = in_ext->deviceGeneratedComputeCaptureReplay; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO: - { - VkDevicePrivateDataCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDevicePrivateDataCreateInfo32 *in_ext = (const VkDevicePrivateDataCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->privateDataSlotRequestCount = in_ext->privateDataSlotRequestCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES: - { - VkPhysicalDevicePrivateDataFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrivateDataFeatures32 *in_ext = (const VkPhysicalDevicePrivateDataFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES; - out_ext->pNext = NULL; - out_ext->privateData = in_ext->privateData; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: - { - VkPhysicalDeviceFeatures2 *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFeatures232 *in_ext = (const VkPhysicalDeviceFeatures232 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; - out_ext->pNext = NULL; - out_ext->features = in_ext->features; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: - { - VkPhysicalDeviceVariablePointersFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVariablePointersFeatures32 *in_ext = (const VkPhysicalDeviceVariablePointersFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES; - out_ext->pNext = NULL; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: - { - VkPhysicalDeviceMultiviewFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewFeatures32 *in_ext = (const VkPhysicalDeviceMultiviewFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; - out_ext->pNext = NULL; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO: - { - VkDeviceGroupDeviceCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupDeviceCreateInfo32 *in_ext = (const VkDeviceGroupDeviceCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->physicalDeviceCount = in_ext->physicalDeviceCount; - out_ext->pPhysicalDevices = convert_VkPhysicalDevice_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in_ext->pPhysicalDevices), in_ext->physicalDeviceCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR: - { - VkPhysicalDevicePresentIdFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentIdFeaturesKHR32 *in_ext = (const VkPhysicalDevicePresentIdFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->presentId = in_ext->presentId; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR: - { - VkPhysicalDevicePresentWaitFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentWaitFeaturesKHR32 *in_ext = (const VkPhysicalDevicePresentWaitFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->presentWait = in_ext->presentWait; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: - { - VkPhysicalDevice16BitStorageFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice16BitStorageFeatures32 *in_ext = (const VkPhysicalDevice16BitStorageFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES: - { - VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 *in_ext = (const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: - { - VkPhysicalDeviceSamplerYcbcrConversionFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSamplerYcbcrConversionFeatures32 *in_ext = (const VkPhysicalDeviceSamplerYcbcrConversionFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES; - out_ext->pNext = NULL; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: - { - VkPhysicalDeviceProtectedMemoryFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceProtectedMemoryFeatures32 *in_ext = (const VkPhysicalDeviceProtectedMemoryFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES; - out_ext->pNext = NULL; - out_ext->protectedMemory = in_ext->protectedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT: - { - VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32 *in_ext = (const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->advancedBlendCoherentOperations = in_ext->advancedBlendCoherentOperations; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT: - { - VkPhysicalDeviceMultiDrawFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiDrawFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMultiDrawFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->multiDraw = in_ext->multiDraw; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES: - { - VkPhysicalDeviceInlineUniformBlockFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInlineUniformBlockFeatures32 *in_ext = (const VkPhysicalDeviceInlineUniformBlockFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES; - out_ext->pNext = NULL; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES: - { - VkPhysicalDeviceMaintenance4Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMaintenance4Features32 *in_ext = (const VkPhysicalDeviceMaintenance4Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES; - out_ext->pNext = NULL; - out_ext->maintenance4 = in_ext->maintenance4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR: - { - VkPhysicalDeviceMaintenance5FeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMaintenance5FeaturesKHR32 *in_ext = (const VkPhysicalDeviceMaintenance5FeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->maintenance5 = in_ext->maintenance5; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: - { - VkPhysicalDeviceShaderDrawParametersFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderDrawParametersFeatures32 *in_ext = (const VkPhysicalDeviceShaderDrawParametersFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: - { - VkPhysicalDeviceShaderFloat16Int8Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderFloat16Int8Features32 *in_ext = (const VkPhysicalDeviceShaderFloat16Int8Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES: - { - VkPhysicalDeviceHostQueryResetFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostQueryResetFeatures32 *in_ext = (const VkPhysicalDeviceHostQueryResetFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES; - out_ext->pNext = NULL; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 *in_ext = (const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->globalPriorityQuery = in_ext->globalPriorityQuery; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES: - { - VkPhysicalDeviceDescriptorIndexingFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorIndexingFeatures32 *in_ext = (const VkPhysicalDeviceDescriptorIndexingFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: - { - VkPhysicalDeviceTimelineSemaphoreFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTimelineSemaphoreFeatures32 *in_ext = (const VkPhysicalDeviceTimelineSemaphoreFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES; - out_ext->pNext = NULL; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: - { - VkPhysicalDevice8BitStorageFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice8BitStorageFeatures32 *in_ext = (const VkPhysicalDevice8BitStorageFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: - { - VkPhysicalDeviceConditionalRenderingFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceConditionalRenderingFeaturesEXT32 *in_ext = (const VkPhysicalDeviceConditionalRenderingFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->conditionalRendering = in_ext->conditionalRendering; - out_ext->inheritedConditionalRendering = in_ext->inheritedConditionalRendering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES: - { - VkPhysicalDeviceVulkanMemoryModelFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkanMemoryModelFeatures32 *in_ext = (const VkPhysicalDeviceVulkanMemoryModelFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES; - out_ext->pNext = NULL; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES: - { - VkPhysicalDeviceShaderAtomicInt64Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicInt64Features32 *in_ext = (const VkPhysicalDeviceShaderAtomicInt64Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderBufferFloat32Atomics = in_ext->shaderBufferFloat32Atomics; - out_ext->shaderBufferFloat32AtomicAdd = in_ext->shaderBufferFloat32AtomicAdd; - out_ext->shaderBufferFloat64Atomics = in_ext->shaderBufferFloat64Atomics; - out_ext->shaderBufferFloat64AtomicAdd = in_ext->shaderBufferFloat64AtomicAdd; - out_ext->shaderSharedFloat32Atomics = in_ext->shaderSharedFloat32Atomics; - out_ext->shaderSharedFloat32AtomicAdd = in_ext->shaderSharedFloat32AtomicAdd; - out_ext->shaderSharedFloat64Atomics = in_ext->shaderSharedFloat64Atomics; - out_ext->shaderSharedFloat64AtomicAdd = in_ext->shaderSharedFloat64AtomicAdd; - out_ext->shaderImageFloat32Atomics = in_ext->shaderImageFloat32Atomics; - out_ext->shaderImageFloat32AtomicAdd = in_ext->shaderImageFloat32AtomicAdd; - out_ext->sparseImageFloat32Atomics = in_ext->sparseImageFloat32Atomics; - out_ext->sparseImageFloat32AtomicAdd = in_ext->sparseImageFloat32AtomicAdd; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderBufferFloat16Atomics = in_ext->shaderBufferFloat16Atomics; - out_ext->shaderBufferFloat16AtomicAdd = in_ext->shaderBufferFloat16AtomicAdd; - out_ext->shaderBufferFloat16AtomicMinMax = in_ext->shaderBufferFloat16AtomicMinMax; - out_ext->shaderBufferFloat32AtomicMinMax = in_ext->shaderBufferFloat32AtomicMinMax; - out_ext->shaderBufferFloat64AtomicMinMax = in_ext->shaderBufferFloat64AtomicMinMax; - out_ext->shaderSharedFloat16Atomics = in_ext->shaderSharedFloat16Atomics; - out_ext->shaderSharedFloat16AtomicAdd = in_ext->shaderSharedFloat16AtomicAdd; - out_ext->shaderSharedFloat16AtomicMinMax = in_ext->shaderSharedFloat16AtomicMinMax; - out_ext->shaderSharedFloat32AtomicMinMax = in_ext->shaderSharedFloat32AtomicMinMax; - out_ext->shaderSharedFloat64AtomicMinMax = in_ext->shaderSharedFloat64AtomicMinMax; - out_ext->shaderImageFloat32AtomicMinMax = in_ext->shaderImageFloat32AtomicMinMax; - out_ext->sparseImageFloat32AtomicMinMax = in_ext->sparseImageFloat32AtomicMinMax; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: - { - VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32 *in_ext = (const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->vertexAttributeInstanceRateDivisor = in_ext->vertexAttributeInstanceRateDivisor; - out_ext->vertexAttributeInstanceRateZeroDivisor = in_ext->vertexAttributeInstanceRateZeroDivisor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT: - { - VkPhysicalDeviceASTCDecodeFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceASTCDecodeFeaturesEXT32 *in_ext = (const VkPhysicalDeviceASTCDecodeFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->decodeModeSharedExponent = in_ext->decodeModeSharedExponent; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceTransformFeedbackFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTransformFeedbackFeaturesEXT32 *in_ext = (const VkPhysicalDeviceTransformFeedbackFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->transformFeedback = in_ext->transformFeedback; - out_ext->geometryStreams = in_ext->geometryStreams; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV: - { - VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32 *in_ext = (const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->representativeFragmentTest = in_ext->representativeFragmentTest; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceExclusiveScissorFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExclusiveScissorFeaturesNV32 *in_ext = (const VkPhysicalDeviceExclusiveScissorFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->exclusiveScissor = in_ext->exclusiveScissor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceCornerSampledImageFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCornerSampledImageFeaturesNV32 *in_ext = (const VkPhysicalDeviceCornerSampledImageFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cornerSampledImage = in_ext->cornerSampledImage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: - { - VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32 *in_ext = (const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->computeDerivativeGroupQuads = in_ext->computeDerivativeGroupQuads; - out_ext->computeDerivativeGroupLinear = in_ext->computeDerivativeGroupLinear; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV: - { - VkPhysicalDeviceShaderImageFootprintFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderImageFootprintFeaturesNV32 *in_ext = (const VkPhysicalDeviceShaderImageFootprintFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->imageFootprint = in_ext->imageFootprint; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV: - { - VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32 *in_ext = (const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->dedicatedAllocationImageAliasing = in_ext->dedicatedAllocationImageAliasing; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV: - { - VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32 *in_ext = (const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->indirectCopy = in_ext->indirectCopy; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV: - { - VkPhysicalDeviceMemoryDecompressionFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMemoryDecompressionFeaturesNV32 *in_ext = (const VkPhysicalDeviceMemoryDecompressionFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->memoryDecompression = in_ext->memoryDecompression; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceShadingRateImageFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShadingRateImageFeaturesNV32 *in_ext = (const VkPhysicalDeviceShadingRateImageFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->shadingRateImage = in_ext->shadingRateImage; - out_ext->shadingRateCoarseSampleOrder = in_ext->shadingRateCoarseSampleOrder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI: - { - VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32 *in_ext = (const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->invocationMask = in_ext->invocationMask; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV: - { - VkPhysicalDeviceMeshShaderFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMeshShaderFeaturesNV32 *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT: - { - VkPhysicalDeviceMeshShaderFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMeshShaderFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_ext->multiviewMeshShader = in_ext->multiviewMeshShader; - out_ext->primitiveFragmentShadingRateMeshShader = in_ext->primitiveFragmentShadingRateMeshShader; - out_ext->meshShaderQueries = in_ext->meshShaderQueries; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR: - { - VkPhysicalDeviceAccelerationStructureFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAccelerationStructureFeaturesKHR32 *in_ext = (const VkPhysicalDeviceAccelerationStructureFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->accelerationStructure = in_ext->accelerationStructure; - out_ext->accelerationStructureCaptureReplay = in_ext->accelerationStructureCaptureReplay; - out_ext->accelerationStructureIndirectBuild = in_ext->accelerationStructureIndirectBuild; - out_ext->accelerationStructureHostCommands = in_ext->accelerationStructureHostCommands; - out_ext->descriptorBindingAccelerationStructureUpdateAfterBind = in_ext->descriptorBindingAccelerationStructureUpdateAfterBind; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPipelineFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingPipelineFeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayTracingPipelineFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingPipeline = in_ext->rayTracingPipeline; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplay = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplay; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - out_ext->rayTracingPipelineTraceRaysIndirect = in_ext->rayTracingPipelineTraceRaysIndirect; - out_ext->rayTraversalPrimitiveCulling = in_ext->rayTraversalPrimitiveCulling; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceRayQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayQueryFeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayQueryFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayQuery = in_ext->rayQuery; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingMaintenance1 = in_ext->rayTracingMaintenance1; - out_ext->rayTracingPipelineTraceRaysIndirect2 = in_ext->rayTracingPipelineTraceRaysIndirect2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD: - { - VkDeviceMemoryOverallocationCreateInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceMemoryOverallocationCreateInfoAMD32 *in_ext = (const VkDeviceMemoryOverallocationCreateInfoAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD; - out_ext->pNext = NULL; - out_ext->overallocationBehavior = in_ext->overallocationBehavior; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMapFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFragmentDensityMapFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMap = in_ext->fragmentDensityMap; - out_ext->fragmentDensityMapDynamic = in_ext->fragmentDensityMapDynamic; - out_ext->fragmentDensityMapNonSubsampledImages = in_ext->fragmentDensityMapNonSubsampledImages; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapDeferred = in_ext->fragmentDensityMapDeferred; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM: - { - VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapOffset = in_ext->fragmentDensityMapOffset; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES: - { - VkPhysicalDeviceScalarBlockLayoutFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceScalarBlockLayoutFeatures32 *in_ext = (const VkPhysicalDeviceScalarBlockLayoutFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES; - out_ext->pNext = NULL; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES: - { - VkPhysicalDeviceUniformBufferStandardLayoutFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 *in_ext = (const VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES; - out_ext->pNext = NULL; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipEnableFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClipEnableFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthClipEnableFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClipEnable = in_ext->depthClipEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT: - { - VkPhysicalDeviceMemoryPriorityFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMemoryPriorityFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMemoryPriorityFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->memoryPriority = in_ext->memoryPriority; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT: - { - VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32 *in_ext = (const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pageableDeviceLocalMemory = in_ext->pageableDeviceLocalMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES: - { - VkPhysicalDeviceBufferDeviceAddressFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBufferDeviceAddressFeatures32 *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES; - out_ext->pNext = NULL; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT: - { - VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES: - { - VkPhysicalDeviceImagelessFramebufferFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImagelessFramebufferFeatures32 *in_ext = (const VkPhysicalDeviceImagelessFramebufferFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES; - out_ext->pNext = NULL; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES: - { - VkPhysicalDeviceTextureCompressionASTCHDRFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 *in_ext = (const VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES; - out_ext->pNext = NULL; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV: - { - VkPhysicalDeviceCooperativeMatrixFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCooperativeMatrixFeaturesNV32 *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32 *in_ext = (const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->ycbcrImageArrays = in_ext->ycbcrImageArrays; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV: - { - VkPhysicalDevicePresentBarrierFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentBarrierFeaturesNV32 *in_ext = (const VkPhysicalDevicePresentBarrierFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->presentBarrier = in_ext->presentBarrier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR: - { - VkPhysicalDevicePerformanceQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePerformanceQueryFeaturesKHR32 *in_ext = (const VkPhysicalDevicePerformanceQueryFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->performanceCounterQueryPools = in_ext->performanceCounterQueryPools; - out_ext->performanceCounterMultipleQueryPools = in_ext->performanceCounterMultipleQueryPools; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_RESERVATION_INFO_KHR: - { - VkPerformanceQueryReservationInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPerformanceQueryReservationInfoKHR32 *in_ext = (const VkPerformanceQueryReservationInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_RESERVATION_INFO_KHR; - out_ext->pNext = NULL; - out_ext->maxPerformanceQueriesPerPool = in_ext->maxPerformanceQueriesPerPool; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV: - { - VkPhysicalDeviceCoverageReductionModeFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCoverageReductionModeFeaturesNV32 *in_ext = (const VkPhysicalDeviceCoverageReductionModeFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->coverageReductionMode = in_ext->coverageReductionMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL: - { - VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32 *in_ext = (const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL; - out_ext->pNext = NULL; - out_ext->shaderIntegerFunctions2 = in_ext->shaderIntegerFunctions2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR: - { - VkPhysicalDeviceShaderClockFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderClockFeaturesKHR32 *in_ext = (const VkPhysicalDeviceShaderClockFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->shaderSubgroupClock = in_ext->shaderSubgroupClock; - out_ext->shaderDeviceClock = in_ext->shaderDeviceClock; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT: - { - VkPhysicalDeviceIndexTypeUint8FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceIndexTypeUint8FeaturesEXT32 *in_ext = (const VkPhysicalDeviceIndexTypeUint8FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->indexTypeUint8 = in_ext->indexTypeUint8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV: - { - VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32 *in_ext = (const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->shaderSMBuiltins = in_ext->shaderSMBuiltins; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT: - { - VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentShaderSampleInterlock = in_ext->fragmentShaderSampleInterlock; - out_ext->fragmentShaderPixelInterlock = in_ext->fragmentShaderPixelInterlock; - out_ext->fragmentShaderShadingRateInterlock = in_ext->fragmentShaderShadingRateInterlock; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES: - { - VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 *in_ext = (const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES; - out_ext->pNext = NULL; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT: - { - VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32 *in_ext = (const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->primitiveTopologyListRestart = in_ext->primitiveTopologyListRestart; - out_ext->primitiveTopologyPatchListRestart = in_ext->primitiveTopologyPatchListRestart; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR: - { - VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32 *in_ext = (const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->pipelineExecutableInfo = in_ext->pipelineExecutableInfo; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 *in_ext = (const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT: - { - VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32 *in_ext = (const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->texelBufferAlignment = in_ext->texelBufferAlignment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES: - { - VkPhysicalDeviceSubgroupSizeControlFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubgroupSizeControlFeatures32 *in_ext = (const VkPhysicalDeviceSubgroupSizeControlFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES; - out_ext->pNext = NULL; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: - { - VkPhysicalDeviceLineRasterizationFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLineRasterizationFeaturesEXT32 *in_ext = (const VkPhysicalDeviceLineRasterizationFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->rectangularLines = in_ext->rectangularLines; - out_ext->bresenhamLines = in_ext->bresenhamLines; - out_ext->smoothLines = in_ext->smoothLines; - out_ext->stippledRectangularLines = in_ext->stippledRectangularLines; - out_ext->stippledBresenhamLines = in_ext->stippledBresenhamLines; - out_ext->stippledSmoothLines = in_ext->stippledSmoothLines; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES: - { - VkPhysicalDevicePipelineCreationCacheControlFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineCreationCacheControlFeatures32 *in_ext = (const VkPhysicalDevicePipelineCreationCacheControlFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES; - out_ext->pNext = NULL; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: - { - VkPhysicalDeviceVulkan11Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan11Features32 *in_ext = (const VkPhysicalDeviceVulkan11Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_ext->protectedMemory = in_ext->protectedMemory; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES: - { - VkPhysicalDeviceVulkan12Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan12Features32 *in_ext = (const VkPhysicalDeviceVulkan12Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; - out_ext->pNext = NULL; - out_ext->samplerMirrorClampToEdge = in_ext->samplerMirrorClampToEdge; - out_ext->drawIndirectCount = in_ext->drawIndirectCount; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_ext->descriptorIndexing = in_ext->descriptorIndexing; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_ext->samplerFilterMinmax = in_ext->samplerFilterMinmax; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_ext->shaderOutputViewportIndex = in_ext->shaderOutputViewportIndex; - out_ext->shaderOutputLayer = in_ext->shaderOutputLayer; - out_ext->subgroupBroadcastDynamicId = in_ext->subgroupBroadcastDynamicId; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES: - { - VkPhysicalDeviceVulkan13Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan13Features32 *in_ext = (const VkPhysicalDeviceVulkan13Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; - out_ext->pNext = NULL; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_ext->privateData = in_ext->privateData; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_ext->synchronization2 = in_ext->synchronization2; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_ext->maintenance4 = in_ext->maintenance4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD: - { - VkPhysicalDeviceCoherentMemoryFeaturesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCoherentMemoryFeaturesAMD32 *in_ext = (const VkPhysicalDeviceCoherentMemoryFeaturesAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD; - out_ext->pNext = NULL; - out_ext->deviceCoherentMemory = in_ext->deviceCoherentMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT: - { - VkPhysicalDeviceCustomBorderColorFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCustomBorderColorFeaturesEXT32 *in_ext = (const VkPhysicalDeviceCustomBorderColorFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->customBorderColors = in_ext->customBorderColors; - out_ext->customBorderColorWithoutFormat = in_ext->customBorderColorWithoutFormat; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT: - { - VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32 *in_ext = (const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->borderColorSwizzle = in_ext->borderColorSwizzle; - out_ext->borderColorSwizzleFromImage = in_ext->borderColorSwizzleFromImage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState = in_ext->extendedDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState2 = in_ext->extendedDynamicState2; - out_ext->extendedDynamicState2LogicOp = in_ext->extendedDynamicState2LogicOp; - out_ext->extendedDynamicState2PatchControlPoints = in_ext->extendedDynamicState2PatchControlPoints; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState3TessellationDomainOrigin = in_ext->extendedDynamicState3TessellationDomainOrigin; - out_ext->extendedDynamicState3DepthClampEnable = in_ext->extendedDynamicState3DepthClampEnable; - out_ext->extendedDynamicState3PolygonMode = in_ext->extendedDynamicState3PolygonMode; - out_ext->extendedDynamicState3RasterizationSamples = in_ext->extendedDynamicState3RasterizationSamples; - out_ext->extendedDynamicState3SampleMask = in_ext->extendedDynamicState3SampleMask; - out_ext->extendedDynamicState3AlphaToCoverageEnable = in_ext->extendedDynamicState3AlphaToCoverageEnable; - out_ext->extendedDynamicState3AlphaToOneEnable = in_ext->extendedDynamicState3AlphaToOneEnable; - out_ext->extendedDynamicState3LogicOpEnable = in_ext->extendedDynamicState3LogicOpEnable; - out_ext->extendedDynamicState3ColorBlendEnable = in_ext->extendedDynamicState3ColorBlendEnable; - out_ext->extendedDynamicState3ColorBlendEquation = in_ext->extendedDynamicState3ColorBlendEquation; - out_ext->extendedDynamicState3ColorWriteMask = in_ext->extendedDynamicState3ColorWriteMask; - out_ext->extendedDynamicState3RasterizationStream = in_ext->extendedDynamicState3RasterizationStream; - out_ext->extendedDynamicState3ConservativeRasterizationMode = in_ext->extendedDynamicState3ConservativeRasterizationMode; - out_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize = in_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize; - out_ext->extendedDynamicState3DepthClipEnable = in_ext->extendedDynamicState3DepthClipEnable; - out_ext->extendedDynamicState3SampleLocationsEnable = in_ext->extendedDynamicState3SampleLocationsEnable; - out_ext->extendedDynamicState3ColorBlendAdvanced = in_ext->extendedDynamicState3ColorBlendAdvanced; - out_ext->extendedDynamicState3ProvokingVertexMode = in_ext->extendedDynamicState3ProvokingVertexMode; - out_ext->extendedDynamicState3LineRasterizationMode = in_ext->extendedDynamicState3LineRasterizationMode; - out_ext->extendedDynamicState3LineStippleEnable = in_ext->extendedDynamicState3LineStippleEnable; - out_ext->extendedDynamicState3DepthClipNegativeOneToOne = in_ext->extendedDynamicState3DepthClipNegativeOneToOne; - out_ext->extendedDynamicState3ViewportWScalingEnable = in_ext->extendedDynamicState3ViewportWScalingEnable; - out_ext->extendedDynamicState3ViewportSwizzle = in_ext->extendedDynamicState3ViewportSwizzle; - out_ext->extendedDynamicState3CoverageToColorEnable = in_ext->extendedDynamicState3CoverageToColorEnable; - out_ext->extendedDynamicState3CoverageToColorLocation = in_ext->extendedDynamicState3CoverageToColorLocation; - out_ext->extendedDynamicState3CoverageModulationMode = in_ext->extendedDynamicState3CoverageModulationMode; - out_ext->extendedDynamicState3CoverageModulationTableEnable = in_ext->extendedDynamicState3CoverageModulationTableEnable; - out_ext->extendedDynamicState3CoverageModulationTable = in_ext->extendedDynamicState3CoverageModulationTable; - out_ext->extendedDynamicState3CoverageReductionMode = in_ext->extendedDynamicState3CoverageReductionMode; - out_ext->extendedDynamicState3RepresentativeFragmentTestEnable = in_ext->extendedDynamicState3RepresentativeFragmentTestEnable; - out_ext->extendedDynamicState3ShadingRateImageEnable = in_ext->extendedDynamicState3ShadingRateImageEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV: - { - VkPhysicalDeviceDiagnosticsConfigFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDiagnosticsConfigFeaturesNV32 *in_ext = (const VkPhysicalDeviceDiagnosticsConfigFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->diagnosticsConfig = in_ext->diagnosticsConfig; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV: - { - VkDeviceDiagnosticsConfigCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceDiagnosticsConfigCreateInfoNV32 *in_ext = (const VkDeviceDiagnosticsConfigCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES: - { - VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 *in_ext = (const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR: - { - VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32 *in_ext = (const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->shaderSubgroupUniformControlFlow = in_ext->shaderSubgroupUniformControlFlow; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: - { - VkPhysicalDeviceRobustness2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRobustness2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceRobustness2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->robustBufferAccess2 = in_ext->robustBufferAccess2; - out_ext->robustImageAccess2 = in_ext->robustImageAccess2; - out_ext->nullDescriptor = in_ext->nullDescriptor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES: - { - VkPhysicalDeviceImageRobustnessFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageRobustnessFeatures32 *in_ext = (const VkPhysicalDeviceImageRobustnessFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES; - out_ext->pNext = NULL; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR: - { - VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32 *in_ext = (const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->workgroupMemoryExplicitLayout = in_ext->workgroupMemoryExplicitLayout; - out_ext->workgroupMemoryExplicitLayoutScalarBlockLayout = in_ext->workgroupMemoryExplicitLayoutScalarBlockLayout; - out_ext->workgroupMemoryExplicitLayout8BitAccess = in_ext->workgroupMemoryExplicitLayout8BitAccess; - out_ext->workgroupMemoryExplicitLayout16BitAccess = in_ext->workgroupMemoryExplicitLayout16BitAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT: - { - VkPhysicalDevice4444FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice4444FormatsFeaturesEXT32 *in_ext = (const VkPhysicalDevice4444FormatsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->formatA4R4G4B4 = in_ext->formatA4R4G4B4; - out_ext->formatA4B4G4R4 = in_ext->formatA4B4G4R4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI: - { - VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32 *in_ext = (const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->subpassShading = in_ext->subpassShading; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI: - { - VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32 *in_ext = (const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->clustercullingShader = in_ext->clustercullingShader; - out_ext->multiviewClusterCullingShader = in_ext->multiviewClusterCullingShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT: - { - VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderImageInt64Atomics = in_ext->shaderImageInt64Atomics; - out_ext->sparseImageInt64Atomics = in_ext->sparseImageInt64Atomics; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShadingRateFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateFeaturesKHR32 *in_ext = (const VkPhysicalDeviceFragmentShadingRateFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->pipelineFragmentShadingRate = in_ext->pipelineFragmentShadingRate; - out_ext->primitiveFragmentShadingRate = in_ext->primitiveFragmentShadingRate; - out_ext->attachmentFragmentShadingRate = in_ext->attachmentFragmentShadingRate; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderTerminateInvocationFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderTerminateInvocationFeatures32 *in_ext = (const VkPhysicalDeviceShaderTerminateInvocationFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV: - { - VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32 *in_ext = (const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->fragmentShadingRateEnums = in_ext->fragmentShadingRateEnums; - out_ext->supersampleFragmentShadingRates = in_ext->supersampleFragmentShadingRates; - out_ext->noInvocationFragmentShadingRates = in_ext->noInvocationFragmentShadingRates; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->image2DViewOf3D = in_ext->image2DViewOf3D; - out_ext->sampler2DViewOf3D = in_ext->sampler2DViewOf3D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageSlicedViewOf3D = in_ext->imageSlicedViewOf3D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32 *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->attachmentFeedbackLoopDynamicState = in_ext->attachmentFeedbackLoopDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT: - { - VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->mutableDescriptorType = in_ext->mutableDescriptorType; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClipControlFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthClipControlFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClipControl = in_ext->depthClipControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32 *in_ext = (const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->vertexInputDynamicState = in_ext->vertexInputDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceColorWriteEnableFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceColorWriteEnableFeaturesEXT32 *in_ext = (const VkPhysicalDeviceColorWriteEnableFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->colorWriteEnable = in_ext->colorWriteEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES: - { - VkPhysicalDeviceSynchronization2Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSynchronization2Features32 *in_ext = (const VkPhysicalDeviceSynchronization2Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES; - out_ext->pNext = NULL; - out_ext->synchronization2 = in_ext->synchronization2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT: - { - VkPhysicalDeviceHostImageCopyFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostImageCopyFeaturesEXT32 *in_ext = (const VkPhysicalDeviceHostImageCopyFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->hostImageCopy = in_ext->hostImageCopy; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT: - { - VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32 *in_ext = (const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->primitivesGeneratedQuery = in_ext->primitivesGeneratedQuery; - out_ext->primitivesGeneratedQueryWithRasterizerDiscard = in_ext->primitivesGeneratedQueryWithRasterizerDiscard; - out_ext->primitivesGeneratedQueryWithNonZeroStreams = in_ext->primitivesGeneratedQueryWithNonZeroStreams; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT: - { - VkPhysicalDeviceLegacyDitheringFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLegacyDitheringFeaturesEXT32 *in_ext = (const VkPhysicalDeviceLegacyDitheringFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->legacyDithering = in_ext->legacyDithering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT: - { - VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->multisampledRenderToSingleSampled = in_ext->multisampledRenderToSingleSampled; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineProtectedAccess = in_ext->pipelineProtectedAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceInheritedViewportScissorFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInheritedViewportScissorFeaturesNV32 *in_ext = (const VkPhysicalDeviceInheritedViewportScissorFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->inheritedViewportScissor2D = in_ext->inheritedViewportScissor2D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32 *in_ext = (const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->ycbcr2plane444Formats = in_ext->ycbcr2plane444Formats; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: - { - VkPhysicalDeviceProvokingVertexFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceProvokingVertexFeaturesEXT32 *in_ext = (const VkPhysicalDeviceProvokingVertexFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->provokingVertexLast = in_ext->provokingVertexLast; - out_ext->transformFeedbackPreservesProvokingVertex = in_ext->transformFeedbackPreservesProvokingVertex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceDescriptorBufferFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorBufferFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDescriptorBufferFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->descriptorBuffer = in_ext->descriptorBuffer; - out_ext->descriptorBufferCaptureReplay = in_ext->descriptorBufferCaptureReplay; - out_ext->descriptorBufferImageLayoutIgnored = in_ext->descriptorBufferImageLayoutIgnored; - out_ext->descriptorBufferPushDescriptors = in_ext->descriptorBufferPushDescriptors; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES: - { - VkPhysicalDeviceShaderIntegerDotProductFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderIntegerDotProductFeatures32 *in_ext = (const VkPhysicalDeviceShaderIntegerDotProductFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 *in_ext = (const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->fragmentShaderBarycentric = in_ext->fragmentShaderBarycentric; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV: - { - VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32 *in_ext = (const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->rayTracingMotionBlur = in_ext->rayTracingMotionBlur; - out_ext->rayTracingMotionBlurPipelineTraceRaysIndirect = in_ext->rayTracingMotionBlurPipelineTraceRaysIndirect; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32 *in_ext = (const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->formatRgba10x6WithoutYCbCrSampler = in_ext->formatRgba10x6WithoutYCbCrSampler; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES: - { - VkPhysicalDeviceDynamicRenderingFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDynamicRenderingFeatures32 *in_ext = (const VkPhysicalDeviceDynamicRenderingFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES; - out_ext->pNext = NULL; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT: - { - VkPhysicalDeviceImageViewMinLodFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageViewMinLodFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageViewMinLodFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->minLod = in_ext->minLod; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT: - { - VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 *in_ext = (const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->rasterizationOrderColorAttachmentAccess = in_ext->rasterizationOrderColorAttachmentAccess; - out_ext->rasterizationOrderDepthAttachmentAccess = in_ext->rasterizationOrderDepthAttachmentAccess; - out_ext->rasterizationOrderStencilAttachmentAccess = in_ext->rasterizationOrderStencilAttachmentAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV: - { - VkPhysicalDeviceLinearColorAttachmentFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLinearColorAttachmentFeaturesNV32 *in_ext = (const VkPhysicalDeviceLinearColorAttachmentFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->linearColorAttachment = in_ext->linearColorAttachment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT: - { - VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32 *in_ext = (const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->graphicsPipelineLibrary = in_ext->graphicsPipelineLibrary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE: - { - VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32 *in_ext = (const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE; - out_ext->pNext = NULL; - out_ext->descriptorSetHostMapping = in_ext->descriptorSetHostMapping; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceNestedCommandBufferFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNestedCommandBufferFeaturesEXT32 *in_ext = (const VkPhysicalDeviceNestedCommandBufferFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->nestedCommandBuffer = in_ext->nestedCommandBuffer; - out_ext->nestedCommandBufferRendering = in_ext->nestedCommandBufferRendering; - out_ext->nestedCommandBufferSimultaneousUse = in_ext->nestedCommandBufferSimultaneousUse; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT: - { - VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderModuleIdentifier = in_ext->shaderModuleIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageCompressionControlFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageCompressionControlFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageCompressionControl = in_ext->imageCompressionControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageCompressionControlSwapchain = in_ext->imageCompressionControlSwapchain; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32 *in_ext = (const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->subpassMergeFeedback = in_ext->subpassMergeFeedback; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT: - { - VkPhysicalDeviceOpacityMicromapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceOpacityMicromapFeaturesEXT32 *in_ext = (const VkPhysicalDeviceOpacityMicromapFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->micromap = in_ext->micromap; - out_ext->micromapCaptureReplay = in_ext->micromapCaptureReplay; - out_ext->micromapHostCommands = in_ext->micromapHostCommands; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT: - { - VkPhysicalDevicePipelinePropertiesFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelinePropertiesFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelinePropertiesFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelinePropertiesIdentifier = in_ext->pipelinePropertiesIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD: - { - VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32 *in_ext = (const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD; - out_ext->pNext = NULL; - out_ext->shaderEarlyAndLateFragmentTests = in_ext->shaderEarlyAndLateFragmentTests; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT: - { - VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32 *in_ext = (const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->nonSeamlessCubeMap = in_ext->nonSeamlessCubeMap; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineRobustnessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineRobustnessFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelineRobustnessFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineRobustness = in_ext->pipelineRobustness; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessingFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageProcessingFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceImageProcessingFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->textureSampleWeighted = in_ext->textureSampleWeighted; - out_ext->textureBoxFilter = in_ext->textureBoxFilter; - out_ext->textureBlockMatch = in_ext->textureBlockMatch; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM: - { - VkPhysicalDeviceTilePropertiesFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTilePropertiesFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceTilePropertiesFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->tileProperties = in_ext->tileProperties; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32 *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->attachmentFeedbackLoopLayout = in_ext->attachmentFeedbackLoopLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClampZeroOne = in_ext->depthClampZeroOne; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT: - { - VkPhysicalDeviceAddressBindingReportFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAddressBindingReportFeaturesEXT32 *in_ext = (const VkPhysicalDeviceAddressBindingReportFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->reportAddressBinding = in_ext->reportAddressBinding; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV: - { - VkPhysicalDeviceOpticalFlowFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceOpticalFlowFeaturesNV32 *in_ext = (const VkPhysicalDeviceOpticalFlowFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->opticalFlow = in_ext->opticalFlow; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT: - { - VkPhysicalDeviceFaultFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFaultFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFaultFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->deviceFault = in_ext->deviceFault; - out_ext->deviceFaultVendorBinary = in_ext->deviceFaultVendorBinary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT: - { - VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineLibraryGroupHandles = in_ext->pipelineLibraryGroupHandles; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM: - { - VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32 *in_ext = (const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM; - out_ext->pNext = NULL; - out_ext->shaderCoreBuiltins = in_ext->shaderCoreBuiltins; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT: - { - VkPhysicalDeviceFrameBoundaryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFrameBoundaryFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFrameBoundaryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->frameBoundary = in_ext->frameBoundary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT: - { - VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->dynamicRenderingUnusedAttachments = in_ext->dynamicRenderingUnusedAttachments; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT: - { - VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32 *in_ext = (const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->swapchainMaintenance1 = in_ext->swapchainMaintenance1; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthBiasControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthBiasControlFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthBiasControlFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthBiasControl = in_ext->depthBiasControl; - out_ext->leastRepresentableValueForceUnormRepresentation = in_ext->leastRepresentableValueForceUnormRepresentation; - out_ext->floatRepresentation = in_ext->floatRepresentation; - out_ext->depthBiasExact = in_ext->depthBiasExact; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV: - { - VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32 *in_ext = (const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->rayTracingInvocationReorder = in_ext->rayTracingInvocationReorder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV: - { - VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32 *in_ext = (const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->extendedSparseAddressSpace = in_ext->extendedSparseAddressSpace; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->multiviewPerViewViewports = in_ext->multiviewPerViewViewports; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingPositionFetch = in_ext->rayTracingPositionFetch; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->multiviewPerViewRenderAreas = in_ext->multiviewPerViewRenderAreas; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT: - { - VkPhysicalDeviceShaderObjectFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderObjectFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderObjectFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderObject = in_ext->shaderObject; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT: - { - VkPhysicalDeviceShaderTileImageFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderTileImageFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderTileImageFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderTileImageColorReadAccess = in_ext->shaderTileImageColorReadAccess; - out_ext->shaderTileImageDepthReadAccess = in_ext->shaderTileImageDepthReadAccess; - out_ext->shaderTileImageStencilReadAccess = in_ext->shaderTileImageStencilReadAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR: - { - VkPhysicalDeviceCooperativeMatrixFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCooperativeMatrixFeaturesKHR32 *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM: - { - VkPhysicalDeviceCubicClampFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCubicClampFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceCubicClampFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->cubicRangeClamp = in_ext->cubicRangeClamp; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM: - { - VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->ycbcrDegamma = in_ext->ycbcrDegamma; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM: - { - VkPhysicalDeviceCubicWeightsFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCubicWeightsFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceCubicWeightsFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->selectableCubicWeights = in_ext->selectableCubicWeights; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessing2FeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageProcessing2FeaturesQCOM32 *in_ext = (const VkPhysicalDeviceImageProcessing2FeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->textureBlockMatch2 = in_ext->textureBlockMatch2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV: - { - VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32 *in_ext = (const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->descriptorPoolOverallocation = in_ext->descriptorPoolOverallocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV: - { - VkPhysicalDeviceCudaKernelLaunchFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCudaKernelLaunchFeaturesNV32 *in_ext = (const VkPhysicalDeviceCudaKernelLaunchFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cudaKernelLaunchFeatures = in_ext->cudaKernelLaunchFeatures; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM: - { - VkDeviceQueueShaderCoreControlCreateInfoARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceQueueShaderCoreControlCreateInfoARM32 *in_ext = (const VkDeviceQueueShaderCoreControlCreateInfoARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM; - out_ext->pNext = NULL; - out_ext->shaderCoreCount = in_ext->shaderCoreCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM: - { - VkPhysicalDeviceSchedulingControlsFeaturesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSchedulingControlsFeaturesARM32 *in_ext = (const VkPhysicalDeviceSchedulingControlsFeaturesARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM; - out_ext->pNext = NULL; - out_ext->schedulingControls = in_ext->schedulingControls; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG: - { - VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32 *in_ext = (const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG; - out_ext->pNext = NULL; - out_ext->relaxedLineRasterization = in_ext->relaxedLineRasterization; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkEventCreateInfo_win32_to_host(const VkEventCreateInfo32 *in, VkEventCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkFenceCreateInfo_win32_to_host(struct conversion_context *ctx, const VkFenceCreateInfo32 *in, VkFenceCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO: - { - VkExportFenceCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExportFenceCreateInfo32 *in_ext = (const VkExportFenceCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->handleTypes = in_ext->handleTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkFramebufferAttachmentImageInfo_win32_to_host(const VkFramebufferAttachmentImageInfo32 *in, VkFramebufferAttachmentImageInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->usage = in->usage; - out->width = in->width; - out->height = in->height; - out->layerCount = in->layerCount; - out->viewFormatCount = in->viewFormatCount; - out->pViewFormats = (const VkFormat *)UlongToPtr(in->pViewFormats); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkFramebufferAttachmentImageInfo *convert_VkFramebufferAttachmentImageInfo_array_win32_to_host(struct conversion_context *ctx, const VkFramebufferAttachmentImageInfo32 *in, uint32_t count) -{ - VkFramebufferAttachmentImageInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkFramebufferAttachmentImageInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkFramebufferCreateInfo_win32_to_host(struct conversion_context *ctx, const VkFramebufferCreateInfo32 *in, VkFramebufferCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->renderPass = in->renderPass; - out->attachmentCount = in->attachmentCount; - out->pAttachments = (const VkImageView *)UlongToPtr(in->pAttachments); - out->width = in->width; - out->height = in->height; - out->layers = in->layers; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO: - { - VkFramebufferAttachmentsCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkFramebufferAttachmentsCreateInfo32 *in_ext = (const VkFramebufferAttachmentsCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->attachmentImageInfoCount = in_ext->attachmentImageInfoCount; - out_ext->pAttachmentImageInfos = convert_VkFramebufferAttachmentImageInfo_array_win32_to_host(ctx, (const VkFramebufferAttachmentImageInfo32 *)UlongToPtr(in_ext->pAttachmentImageInfos), in_ext->attachmentImageInfoCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkPipelineShaderStageCreateInfo *convert_VkPipelineShaderStageCreateInfo_array_win64_to_host(struct conversion_context *ctx, const VkPipelineShaderStageCreateInfo *in, uint32_t count) -{ - VkPipelineShaderStageCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineShaderStageCreateInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkPipelineShaderStageCreateInfo *convert_VkPipelineShaderStageCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineShaderStageCreateInfo32 *in, uint32_t count) -{ - VkPipelineShaderStageCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineShaderStageCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineVertexInputStateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineVertexInputStateCreateInfo32 *in, VkPipelineVertexInputStateCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->vertexBindingDescriptionCount = in->vertexBindingDescriptionCount; - out->pVertexBindingDescriptions = (const VkVertexInputBindingDescription *)UlongToPtr(in->pVertexBindingDescriptions); - out->vertexAttributeDescriptionCount = in->vertexAttributeDescriptionCount; - out->pVertexAttributeDescriptions = (const VkVertexInputAttributeDescription *)UlongToPtr(in->pVertexAttributeDescriptions); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT: - { - VkPipelineVertexInputDivisorStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineVertexInputDivisorStateCreateInfoEXT32 *in_ext = (const VkPipelineVertexInputDivisorStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->vertexBindingDivisorCount = in_ext->vertexBindingDivisorCount; - out_ext->pVertexBindingDivisors = (const VkVertexInputBindingDivisorDescriptionEXT *)UlongToPtr(in_ext->pVertexBindingDivisors); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkPipelineVertexInputStateCreateInfo *convert_VkPipelineVertexInputStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineVertexInputStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineVertexInputStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineVertexInputStateCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineTessellationStateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineTessellationStateCreateInfo32 *in, VkPipelineTessellationStateCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->patchControlPoints = in->patchControlPoints; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO: - { - VkPipelineTessellationDomainOriginStateCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineTessellationDomainOriginStateCreateInfo32 *in_ext = (const VkPipelineTessellationDomainOriginStateCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->domainOrigin = in_ext->domainOrigin; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkPipelineTessellationStateCreateInfo *convert_VkPipelineTessellationStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineTessellationStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineTessellationStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineTessellationStateCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkGraphicsShaderGroupCreateInfoNV_win64_to_host(struct conversion_context *ctx, const VkGraphicsShaderGroupCreateInfoNV *in, VkGraphicsShaderGroupCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win64_to_host(ctx, in->pStages, in->stageCount); - out->pVertexInputState = in->pVertexInputState; - out->pTessellationState = in->pTessellationState; -} -#endif /* _WIN64 */ - -static inline void convert_VkGraphicsShaderGroupCreateInfoNV_win32_to_host(struct conversion_context *ctx, const VkGraphicsShaderGroupCreateInfoNV32 *in, VkGraphicsShaderGroupCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win32_to_host(ctx, (const VkPipelineShaderStageCreateInfo32 *)UlongToPtr(in->pStages), in->stageCount); - out->pVertexInputState = convert_VkPipelineVertexInputStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineVertexInputStateCreateInfo32 *)UlongToPtr(in->pVertexInputState), 1); - out->pTessellationState = convert_VkPipelineTessellationStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineTessellationStateCreateInfo32 *)UlongToPtr(in->pTessellationState), 1); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline const VkGraphicsShaderGroupCreateInfoNV *convert_VkGraphicsShaderGroupCreateInfoNV_array_win64_to_host(struct conversion_context *ctx, const VkGraphicsShaderGroupCreateInfoNV *in, uint32_t count) -{ - VkGraphicsShaderGroupCreateInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkGraphicsShaderGroupCreateInfoNV_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkGraphicsShaderGroupCreateInfoNV *convert_VkGraphicsShaderGroupCreateInfoNV_array_win32_to_host(struct conversion_context *ctx, const VkGraphicsShaderGroupCreateInfoNV32 *in, uint32_t count) -{ - VkGraphicsShaderGroupCreateInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkGraphicsShaderGroupCreateInfoNV_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineInputAssemblyStateCreateInfo_win32_to_host(const VkPipelineInputAssemblyStateCreateInfo32 *in, VkPipelineInputAssemblyStateCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->topology = in->topology; - out->primitiveRestartEnable = in->primitiveRestartEnable; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkPipelineInputAssemblyStateCreateInfo *convert_VkPipelineInputAssemblyStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineInputAssemblyStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineInputAssemblyStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineInputAssemblyStateCreateInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineViewportStateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineViewportStateCreateInfo32 *in, VkPipelineViewportStateCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->viewportCount = in->viewportCount; - out->pViewports = (const VkViewport *)UlongToPtr(in->pViewports); - out->scissorCount = in->scissorCount; - out->pScissors = (const VkRect2D *)UlongToPtr(in->pScissors); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV: - { - VkPipelineViewportWScalingStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineViewportWScalingStateCreateInfoNV32 *in_ext = (const VkPipelineViewportWScalingStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->viewportWScalingEnable = in_ext->viewportWScalingEnable; - out_ext->viewportCount = in_ext->viewportCount; - out_ext->pViewportWScalings = (const VkViewportWScalingNV *)UlongToPtr(in_ext->pViewportWScalings); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV: - { - VkPipelineViewportSwizzleStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineViewportSwizzleStateCreateInfoNV32 *in_ext = (const VkPipelineViewportSwizzleStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->viewportCount = in_ext->viewportCount; - out_ext->pViewportSwizzles = (const VkViewportSwizzleNV *)UlongToPtr(in_ext->pViewportSwizzles); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV: - { - VkPipelineViewportExclusiveScissorStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineViewportExclusiveScissorStateCreateInfoNV32 *in_ext = (const VkPipelineViewportExclusiveScissorStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->exclusiveScissorCount = in_ext->exclusiveScissorCount; - out_ext->pExclusiveScissors = (const VkRect2D *)UlongToPtr(in_ext->pExclusiveScissors); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV: - { - VkPipelineViewportShadingRateImageStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineViewportShadingRateImageStateCreateInfoNV32 *in_ext = (const VkPipelineViewportShadingRateImageStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->shadingRateImageEnable = in_ext->shadingRateImageEnable; - out_ext->viewportCount = in_ext->viewportCount; - out_ext->pShadingRatePalettes = convert_VkShadingRatePaletteNV_array_win32_to_host(ctx, (const VkShadingRatePaletteNV32 *)UlongToPtr(in_ext->pShadingRatePalettes), in_ext->viewportCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV: - { - VkPipelineViewportCoarseSampleOrderStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineViewportCoarseSampleOrderStateCreateInfoNV32 *in_ext = (const VkPipelineViewportCoarseSampleOrderStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->sampleOrderType = in_ext->sampleOrderType; - out_ext->customSampleOrderCount = in_ext->customSampleOrderCount; - out_ext->pCustomSampleOrders = convert_VkCoarseSampleOrderCustomNV_array_win32_to_host(ctx, (const VkCoarseSampleOrderCustomNV32 *)UlongToPtr(in_ext->pCustomSampleOrders), in_ext->customSampleOrderCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT: - { - VkPipelineViewportDepthClipControlCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineViewportDepthClipControlCreateInfoEXT32 *in_ext = (const VkPipelineViewportDepthClipControlCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->negativeOneToOne = in_ext->negativeOneToOne; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkPipelineViewportStateCreateInfo *convert_VkPipelineViewportStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineViewportStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineViewportStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineViewportStateCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineRasterizationStateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineRasterizationStateCreateInfo32 *in, VkPipelineRasterizationStateCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->depthClampEnable = in->depthClampEnable; - out->rasterizerDiscardEnable = in->rasterizerDiscardEnable; - out->polygonMode = in->polygonMode; - out->cullMode = in->cullMode; - out->frontFace = in->frontFace; - out->depthBiasEnable = in->depthBiasEnable; - out->depthBiasConstantFactor = in->depthBiasConstantFactor; - out->depthBiasClamp = in->depthBiasClamp; - out->depthBiasSlopeFactor = in->depthBiasSlopeFactor; - out->lineWidth = in->lineWidth; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD: - { - VkPipelineRasterizationStateRasterizationOrderAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRasterizationStateRasterizationOrderAMD32 *in_ext = (const VkPipelineRasterizationStateRasterizationOrderAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD; - out_ext->pNext = NULL; - out_ext->rasterizationOrder = in_ext->rasterizationOrder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT: - { - VkPipelineRasterizationConservativeStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRasterizationConservativeStateCreateInfoEXT32 *in_ext = (const VkPipelineRasterizationConservativeStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->conservativeRasterizationMode = in_ext->conservativeRasterizationMode; - out_ext->extraPrimitiveOverestimationSize = in_ext->extraPrimitiveOverestimationSize; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT: - { - VkPipelineRasterizationStateStreamCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRasterizationStateStreamCreateInfoEXT32 *in_ext = (const VkPipelineRasterizationStateStreamCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->rasterizationStream = in_ext->rasterizationStream; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT: - { - VkPipelineRasterizationDepthClipStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRasterizationDepthClipStateCreateInfoEXT32 *in_ext = (const VkPipelineRasterizationDepthClipStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->depthClipEnable = in_ext->depthClipEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT: - { - VkPipelineRasterizationLineStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRasterizationLineStateCreateInfoEXT32 *in_ext = (const VkPipelineRasterizationLineStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->lineRasterizationMode = in_ext->lineRasterizationMode; - out_ext->stippledLineEnable = in_ext->stippledLineEnable; - out_ext->lineStippleFactor = in_ext->lineStippleFactor; - out_ext->lineStipplePattern = in_ext->lineStipplePattern; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT: - { - VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT32 *in_ext = (const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->provokingVertexMode = in_ext->provokingVertexMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT: - { - VkDepthBiasRepresentationInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDepthBiasRepresentationInfoEXT32 *in_ext = (const VkDepthBiasRepresentationInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT; - out_ext->pNext = NULL; - out_ext->depthBiasRepresentation = in_ext->depthBiasRepresentation; - out_ext->depthBiasExact = in_ext->depthBiasExact; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkPipelineRasterizationStateCreateInfo *convert_VkPipelineRasterizationStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineRasterizationStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineRasterizationStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineRasterizationStateCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineMultisampleStateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineMultisampleStateCreateInfo32 *in, VkPipelineMultisampleStateCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->rasterizationSamples = in->rasterizationSamples; - out->sampleShadingEnable = in->sampleShadingEnable; - out->minSampleShading = in->minSampleShading; - out->pSampleMask = (const VkSampleMask *)UlongToPtr(in->pSampleMask); - out->alphaToCoverageEnable = in->alphaToCoverageEnable; - out->alphaToOneEnable = in->alphaToOneEnable; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV: - { - VkPipelineCoverageToColorStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCoverageToColorStateCreateInfoNV32 *in_ext = (const VkPipelineCoverageToColorStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->coverageToColorEnable = in_ext->coverageToColorEnable; - out_ext->coverageToColorLocation = in_ext->coverageToColorLocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT: - { - VkPipelineSampleLocationsStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineSampleLocationsStateCreateInfoEXT32 *in_ext = (const VkPipelineSampleLocationsStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->sampleLocationsEnable = in_ext->sampleLocationsEnable; - convert_VkSampleLocationsInfoEXT_win32_to_host(&in_ext->sampleLocationsInfo, &out_ext->sampleLocationsInfo); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV: - { - VkPipelineCoverageModulationStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCoverageModulationStateCreateInfoNV32 *in_ext = (const VkPipelineCoverageModulationStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->coverageModulationMode = in_ext->coverageModulationMode; - out_ext->coverageModulationTableEnable = in_ext->coverageModulationTableEnable; - out_ext->coverageModulationTableCount = in_ext->coverageModulationTableCount; - out_ext->pCoverageModulationTable = (const float *)UlongToPtr(in_ext->pCoverageModulationTable); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV: - { - VkPipelineCoverageReductionStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCoverageReductionStateCreateInfoNV32 *in_ext = (const VkPipelineCoverageReductionStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->coverageReductionMode = in_ext->coverageReductionMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkPipelineMultisampleStateCreateInfo *convert_VkPipelineMultisampleStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineMultisampleStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineMultisampleStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineMultisampleStateCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineDepthStencilStateCreateInfo_win32_to_host(const VkPipelineDepthStencilStateCreateInfo32 *in, VkPipelineDepthStencilStateCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->depthTestEnable = in->depthTestEnable; - out->depthWriteEnable = in->depthWriteEnable; - out->depthCompareOp = in->depthCompareOp; - out->depthBoundsTestEnable = in->depthBoundsTestEnable; - out->stencilTestEnable = in->stencilTestEnable; - out->front = in->front; - out->back = in->back; - out->minDepthBounds = in->minDepthBounds; - out->maxDepthBounds = in->maxDepthBounds; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkPipelineDepthStencilStateCreateInfo *convert_VkPipelineDepthStencilStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineDepthStencilStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineDepthStencilStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineDepthStencilStateCreateInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineColorBlendStateCreateInfo_win32_to_host(struct conversion_context *ctx, const VkPipelineColorBlendStateCreateInfo32 *in, VkPipelineColorBlendStateCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->logicOpEnable = in->logicOpEnable; - out->logicOp = in->logicOp; - out->attachmentCount = in->attachmentCount; - out->pAttachments = (const VkPipelineColorBlendAttachmentState *)UlongToPtr(in->pAttachments); - memcpy(out->blendConstants, in->blendConstants, 4 * sizeof(float)); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT: - { - VkPipelineColorBlendAdvancedStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineColorBlendAdvancedStateCreateInfoEXT32 *in_ext = (const VkPipelineColorBlendAdvancedStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->srcPremultiplied = in_ext->srcPremultiplied; - out_ext->dstPremultiplied = in_ext->dstPremultiplied; - out_ext->blendOverlap = in_ext->blendOverlap; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT: - { - VkPipelineColorWriteCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineColorWriteCreateInfoEXT32 *in_ext = (const VkPipelineColorWriteCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->attachmentCount = in_ext->attachmentCount; - out_ext->pColorWriteEnables = (const VkBool32 *)UlongToPtr(in_ext->pColorWriteEnables); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkPipelineColorBlendStateCreateInfo *convert_VkPipelineColorBlendStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineColorBlendStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineColorBlendStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineColorBlendStateCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineDynamicStateCreateInfo_win32_to_host(const VkPipelineDynamicStateCreateInfo32 *in, VkPipelineDynamicStateCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->dynamicStateCount = in->dynamicStateCount; - out->pDynamicStates = (const VkDynamicState *)UlongToPtr(in->pDynamicStates); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkPipelineDynamicStateCreateInfo *convert_VkPipelineDynamicStateCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkPipelineDynamicStateCreateInfo32 *in, uint32_t count) -{ - VkPipelineDynamicStateCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineDynamicStateCreateInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkGraphicsPipelineCreateInfo_win64_to_host(struct conversion_context *ctx, const VkGraphicsPipelineCreateInfo *in, VkGraphicsPipelineCreateInfo *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win64_to_host(ctx, in->pStages, in->stageCount); - out->pVertexInputState = in->pVertexInputState; - out->pInputAssemblyState = in->pInputAssemblyState; - out->pTessellationState = in->pTessellationState; - out->pViewportState = in->pViewportState; - out->pRasterizationState = in->pRasterizationState; - out->pMultisampleState = in->pMultisampleState; - out->pDepthStencilState = in->pDepthStencilState; - out->pColorBlendState = in->pColorBlendState; - out->pDynamicState = in->pDynamicState; - out->layout = in->layout; - out->renderPass = in->renderPass; - out->subpass = in->subpass; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR: - { - VkPipelineCreateFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreateFlags2CreateInfoKHR *in_ext = (const VkPipelineCreateFlags2CreateInfoKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV: - { - VkGraphicsPipelineShaderGroupsCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkGraphicsPipelineShaderGroupsCreateInfoNV *in_ext = (const VkGraphicsPipelineShaderGroupsCreateInfoNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->groupCount = in_ext->groupCount; - out_ext->pGroups = convert_VkGraphicsShaderGroupCreateInfoNV_array_win64_to_host(ctx, in_ext->pGroups, in_ext->groupCount); - out_ext->pipelineCount = in_ext->pipelineCount; - out_ext->pPipelines = in_ext->pPipelines; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT: - { - VkPipelineDiscardRectangleStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineDiscardRectangleStateCreateInfoEXT *in_ext = (const VkPipelineDiscardRectangleStateCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->discardRectangleMode = in_ext->discardRectangleMode; - out_ext->discardRectangleCount = in_ext->discardRectangleCount; - out_ext->pDiscardRectangles = in_ext->pDiscardRectangles; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV: - { - VkPipelineRepresentativeFragmentTestStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRepresentativeFragmentTestStateCreateInfoNV *in_ext = (const VkPipelineRepresentativeFragmentTestStateCreateInfoNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->representativeFragmentTestEnable = in_ext->representativeFragmentTestEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreationFeedbackCreateInfo *in_ext = (const VkPipelineCreationFeedbackCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->pPipelineCreationFeedback = in_ext->pPipelineCreationFeedback; - out_ext->pipelineStageCreationFeedbackCount = in_ext->pipelineStageCreationFeedbackCount; - out_ext->pPipelineStageCreationFeedbacks = in_ext->pPipelineStageCreationFeedbacks; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD: - { - VkPipelineCompilerControlCreateInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCompilerControlCreateInfoAMD *in_ext = (const VkPipelineCompilerControlCreateInfoAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD; - out_ext->pNext = NULL; - out_ext->compilerControlFlags = in_ext->compilerControlFlags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR: - { - VkPipelineLibraryCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineLibraryCreateInfoKHR *in_ext = (const VkPipelineLibraryCreateInfoKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->libraryCount = in_ext->libraryCount; - out_ext->pLibraries = in_ext->pLibraries; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR: - { - VkPipelineFragmentShadingRateStateCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineFragmentShadingRateStateCreateInfoKHR *in_ext = (const VkPipelineFragmentShadingRateStateCreateInfoKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->fragmentSize = in_ext->fragmentSize; - memcpy(out_ext->combinerOps, in_ext->combinerOps, 2 * sizeof(VkFragmentShadingRateCombinerOpKHR)); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV: - { - VkPipelineFragmentShadingRateEnumStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineFragmentShadingRateEnumStateCreateInfoNV *in_ext = (const VkPipelineFragmentShadingRateEnumStateCreateInfoNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->shadingRateType = in_ext->shadingRateType; - out_ext->shadingRate = in_ext->shadingRate; - memcpy(out_ext->combinerOps, in_ext->combinerOps, 2 * sizeof(VkFragmentShadingRateCombinerOpKHR)); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO: - { - VkPipelineRenderingCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRenderingCreateInfo *in_ext = (const VkPipelineRenderingCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->viewMask = in_ext->viewMask; - out_ext->colorAttachmentCount = in_ext->colorAttachmentCount; - out_ext->pColorAttachmentFormats = in_ext->pColorAttachmentFormats; - out_ext->depthAttachmentFormat = in_ext->depthAttachmentFormat; - out_ext->stencilAttachmentFormat = in_ext->stencilAttachmentFormat; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD: - { - VkAttachmentSampleCountInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAttachmentSampleCountInfoAMD *in_ext = (const VkAttachmentSampleCountInfoAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD; - out_ext->pNext = NULL; - out_ext->colorAttachmentCount = in_ext->colorAttachmentCount; - out_ext->pColorAttachmentSamples = in_ext->pColorAttachmentSamples; - out_ext->depthStencilAttachmentSamples = in_ext->depthStencilAttachmentSamples; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX: - { - VkMultiviewPerViewAttributesInfoNVX *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultiviewPerViewAttributesInfoNVX *in_ext = (const VkMultiviewPerViewAttributesInfoNVX *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX; - out_ext->pNext = NULL; - out_ext->perViewAttributes = in_ext->perViewAttributes; - out_ext->perViewAttributesPositionXOnly = in_ext->perViewAttributesPositionXOnly; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT: - { - VkGraphicsPipelineLibraryCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkGraphicsPipelineLibraryCreateInfoEXT *in_ext = (const VkGraphicsPipelineLibraryCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT: - { - VkPipelineRobustnessCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRobustnessCreateInfoEXT *in_ext = (const VkPipelineRobustnessCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->storageBuffers = in_ext->storageBuffers; - out_ext->uniformBuffers = in_ext->uniformBuffers; - out_ext->vertexInputs = in_ext->vertexInputs; - out_ext->images = in_ext->images; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} -#endif /* _WIN64 */ - -static inline void convert_VkGraphicsPipelineCreateInfo_win32_to_host(struct conversion_context *ctx, const VkGraphicsPipelineCreateInfo32 *in, VkGraphicsPipelineCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win32_to_host(ctx, (const VkPipelineShaderStageCreateInfo32 *)UlongToPtr(in->pStages), in->stageCount); - out->pVertexInputState = convert_VkPipelineVertexInputStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineVertexInputStateCreateInfo32 *)UlongToPtr(in->pVertexInputState), 1); - out->pInputAssemblyState = convert_VkPipelineInputAssemblyStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineInputAssemblyStateCreateInfo32 *)UlongToPtr(in->pInputAssemblyState), 1); - out->pTessellationState = convert_VkPipelineTessellationStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineTessellationStateCreateInfo32 *)UlongToPtr(in->pTessellationState), 1); - out->pViewportState = convert_VkPipelineViewportStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineViewportStateCreateInfo32 *)UlongToPtr(in->pViewportState), 1); - out->pRasterizationState = convert_VkPipelineRasterizationStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineRasterizationStateCreateInfo32 *)UlongToPtr(in->pRasterizationState), 1); - out->pMultisampleState = convert_VkPipelineMultisampleStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineMultisampleStateCreateInfo32 *)UlongToPtr(in->pMultisampleState), 1); - out->pDepthStencilState = convert_VkPipelineDepthStencilStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineDepthStencilStateCreateInfo32 *)UlongToPtr(in->pDepthStencilState), 1); - out->pColorBlendState = convert_VkPipelineColorBlendStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineColorBlendStateCreateInfo32 *)UlongToPtr(in->pColorBlendState), 1); - out->pDynamicState = convert_VkPipelineDynamicStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineDynamicStateCreateInfo32 *)UlongToPtr(in->pDynamicState), 1); - out->layout = in->layout; - out->renderPass = in->renderPass; - out->subpass = in->subpass; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR: - { - VkPipelineCreateFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreateFlags2CreateInfoKHR32 *in_ext = (const VkPipelineCreateFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV: - { - VkGraphicsPipelineShaderGroupsCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkGraphicsPipelineShaderGroupsCreateInfoNV32 *in_ext = (const VkGraphicsPipelineShaderGroupsCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->groupCount = in_ext->groupCount; - out_ext->pGroups = convert_VkGraphicsShaderGroupCreateInfoNV_array_win32_to_host(ctx, (const VkGraphicsShaderGroupCreateInfoNV32 *)UlongToPtr(in_ext->pGroups), in_ext->groupCount); - out_ext->pipelineCount = in_ext->pipelineCount; - out_ext->pPipelines = (const VkPipeline *)UlongToPtr(in_ext->pPipelines); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT: - { - VkPipelineDiscardRectangleStateCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineDiscardRectangleStateCreateInfoEXT32 *in_ext = (const VkPipelineDiscardRectangleStateCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->discardRectangleMode = in_ext->discardRectangleMode; - out_ext->discardRectangleCount = in_ext->discardRectangleCount; - out_ext->pDiscardRectangles = (const VkRect2D *)UlongToPtr(in_ext->pDiscardRectangles); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV: - { - VkPipelineRepresentativeFragmentTestStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRepresentativeFragmentTestStateCreateInfoNV32 *in_ext = (const VkPipelineRepresentativeFragmentTestStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->representativeFragmentTestEnable = in_ext->representativeFragmentTestEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreationFeedbackCreateInfo32 *in_ext = (const VkPipelineCreationFeedbackCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->pPipelineCreationFeedback = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineCreationFeedback), 1); - out_ext->pipelineStageCreationFeedbackCount = in_ext->pipelineStageCreationFeedbackCount; - out_ext->pPipelineStageCreationFeedbacks = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD: - { - VkPipelineCompilerControlCreateInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCompilerControlCreateInfoAMD32 *in_ext = (const VkPipelineCompilerControlCreateInfoAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD; - out_ext->pNext = NULL; - out_ext->compilerControlFlags = in_ext->compilerControlFlags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR: - { - VkPipelineLibraryCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineLibraryCreateInfoKHR32 *in_ext = (const VkPipelineLibraryCreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->libraryCount = in_ext->libraryCount; - out_ext->pLibraries = (const VkPipeline *)UlongToPtr(in_ext->pLibraries); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR: - { - VkPipelineFragmentShadingRateStateCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineFragmentShadingRateStateCreateInfoKHR32 *in_ext = (const VkPipelineFragmentShadingRateStateCreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->fragmentSize = in_ext->fragmentSize; - memcpy(out_ext->combinerOps, in_ext->combinerOps, 2 * sizeof(VkFragmentShadingRateCombinerOpKHR)); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV: - { - VkPipelineFragmentShadingRateEnumStateCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineFragmentShadingRateEnumStateCreateInfoNV32 *in_ext = (const VkPipelineFragmentShadingRateEnumStateCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->shadingRateType = in_ext->shadingRateType; - out_ext->shadingRate = in_ext->shadingRate; - memcpy(out_ext->combinerOps, in_ext->combinerOps, 2 * sizeof(VkFragmentShadingRateCombinerOpKHR)); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO: - { - VkPipelineRenderingCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRenderingCreateInfo32 *in_ext = (const VkPipelineRenderingCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->viewMask = in_ext->viewMask; - out_ext->colorAttachmentCount = in_ext->colorAttachmentCount; - out_ext->pColorAttachmentFormats = (const VkFormat *)UlongToPtr(in_ext->pColorAttachmentFormats); - out_ext->depthAttachmentFormat = in_ext->depthAttachmentFormat; - out_ext->stencilAttachmentFormat = in_ext->stencilAttachmentFormat; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD: - { - VkAttachmentSampleCountInfoAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAttachmentSampleCountInfoAMD32 *in_ext = (const VkAttachmentSampleCountInfoAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD; - out_ext->pNext = NULL; - out_ext->colorAttachmentCount = in_ext->colorAttachmentCount; - out_ext->pColorAttachmentSamples = (const VkSampleCountFlagBits *)UlongToPtr(in_ext->pColorAttachmentSamples); - out_ext->depthStencilAttachmentSamples = in_ext->depthStencilAttachmentSamples; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX: - { - VkMultiviewPerViewAttributesInfoNVX *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultiviewPerViewAttributesInfoNVX32 *in_ext = (const VkMultiviewPerViewAttributesInfoNVX32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX; - out_ext->pNext = NULL; - out_ext->perViewAttributes = in_ext->perViewAttributes; - out_ext->perViewAttributesPositionXOnly = in_ext->perViewAttributesPositionXOnly; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT: - { - VkGraphicsPipelineLibraryCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkGraphicsPipelineLibraryCreateInfoEXT32 *in_ext = (const VkGraphicsPipelineLibraryCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT: - { - VkPipelineRobustnessCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRobustnessCreateInfoEXT32 *in_ext = (const VkPipelineRobustnessCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->storageBuffers = in_ext->storageBuffers; - out_ext->uniformBuffers = in_ext->uniformBuffers; - out_ext->vertexInputs = in_ext->vertexInputs; - out_ext->images = in_ext->images; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkGraphicsPipelineCreateInfo_host_to_win32(const VkGraphicsPipelineCreateInfo *in, const VkGraphicsPipelineCreateInfo32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO); - const VkPipelineCreationFeedbackCreateInfo *in_ext = (const VkPipelineCreationFeedbackCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineCreationFeedback, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineCreationFeedback), 1); - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineStageCreationFeedbacks, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -#ifdef _WIN64 -static inline const VkGraphicsPipelineCreateInfo *convert_VkGraphicsPipelineCreateInfo_array_win64_to_host(struct conversion_context *ctx, const VkGraphicsPipelineCreateInfo *in, uint32_t count) -{ - VkGraphicsPipelineCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkGraphicsPipelineCreateInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkGraphicsPipelineCreateInfo *convert_VkGraphicsPipelineCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkGraphicsPipelineCreateInfo32 *in, uint32_t count) -{ - VkGraphicsPipelineCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkGraphicsPipelineCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkGraphicsPipelineCreateInfo_array_host_to_win32(const VkGraphicsPipelineCreateInfo *in, const VkGraphicsPipelineCreateInfo32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkGraphicsPipelineCreateInfo_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkImageCreateInfo_win32_to_host(struct conversion_context *ctx, const VkImageCreateInfo32 *in, VkImageCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->imageType = in->imageType; - out->format = in->format; - out->extent = in->extent; - out->mipLevels = in->mipLevels; - out->arrayLayers = in->arrayLayers; - out->samples = in->samples; - out->tiling = in->tiling; - out->usage = in->usage; - out->sharingMode = in->sharingMode; - out->queueFamilyIndexCount = in->queueFamilyIndexCount; - out->pQueueFamilyIndices = (const uint32_t *)UlongToPtr(in->pQueueFamilyIndices); - out->initialLayout = in->initialLayout; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV: - { - VkDedicatedAllocationImageCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDedicatedAllocationImageCreateInfoNV32 *in_ext = (const VkDedicatedAllocationImageCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->dedicatedAllocation = in_ext->dedicatedAllocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO: - { - VkExternalMemoryImageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExternalMemoryImageCreateInfo32 *in_ext = (const VkExternalMemoryImageCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->handleTypes = in_ext->handleTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR: - { - VkImageSwapchainCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageSwapchainCreateInfoKHR32 *in_ext = (const VkImageSwapchainCreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->swapchain = in_ext->swapchain; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: - { - VkImageFormatListCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageFormatListCreateInfo32 *in_ext = (const VkImageFormatListCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->viewFormatCount = in_ext->viewFormatCount; - out_ext->pViewFormats = (const VkFormat *)UlongToPtr(in_ext->pViewFormats); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: - { - VkImageStencilUsageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageStencilUsageCreateInfo32 *in_ext = (const VkImageStencilUsageCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->stencilUsage = in_ext->stencilUsage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: - { - VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->opaqueCaptureDescriptorData = (const void *)UlongToPtr(in_ext->opaqueCaptureDescriptorData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: - { - VkImageCompressionControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageCompressionControlEXT32 *in_ext = (const VkImageCompressionControlEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->compressionControlPlaneCount = in_ext->compressionControlPlaneCount; - out_ext->pFixedRateFlags = (VkImageCompressionFixedRateFlagsEXT *)UlongToPtr(in_ext->pFixedRateFlags); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV: - { - VkOpticalFlowImageFormatInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpticalFlowImageFormatInfoNV32 *in_ext = (const VkOpticalFlowImageFormatInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkImageViewCreateInfo_win32_to_host(struct conversion_context *ctx, const VkImageViewCreateInfo32 *in, VkImageViewCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->image = in->image; - out->viewType = in->viewType; - out->format = in->format; - out->components = in->components; - out->subresourceRange = in->subresourceRange; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO: - { - VkImageViewUsageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageViewUsageCreateInfo32 *in_ext = (const VkImageViewUsageCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT: - { - VkImageViewSlicedCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageViewSlicedCreateInfoEXT32 *in_ext = (const VkImageViewSlicedCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->sliceOffset = in_ext->sliceOffset; - out_ext->sliceCount = in_ext->sliceCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: - { - VkSamplerYcbcrConversionInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerYcbcrConversionInfo32 *in_ext = (const VkSamplerYcbcrConversionInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO; - out_ext->pNext = NULL; - out_ext->conversion = in_ext->conversion; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT: - { - VkImageViewASTCDecodeModeEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageViewASTCDecodeModeEXT32 *in_ext = (const VkImageViewASTCDecodeModeEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT; - out_ext->pNext = NULL; - out_ext->decodeMode = in_ext->decodeMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: - { - VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->opaqueCaptureDescriptorData = (const void *)UlongToPtr(in_ext->opaqueCaptureDescriptorData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT: - { - VkImageViewMinLodCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageViewMinLodCreateInfoEXT32 *in_ext = (const VkImageViewMinLodCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->minLod = in_ext->minLod; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM: - { - VkImageViewSampleWeightCreateInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageViewSampleWeightCreateInfoQCOM32 *in_ext = (const VkImageViewSampleWeightCreateInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->filterCenter = in_ext->filterCenter; - out_ext->filterSize = in_ext->filterSize; - out_ext->numPhases = in_ext->numPhases; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkIndirectCommandsLayoutTokenNV_win32_to_host(const VkIndirectCommandsLayoutTokenNV32 *in, VkIndirectCommandsLayoutTokenNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->tokenType = in->tokenType; - out->stream = in->stream; - out->offset = in->offset; - out->vertexBindingUnit = in->vertexBindingUnit; - out->vertexDynamicStride = in->vertexDynamicStride; - out->pushconstantPipelineLayout = in->pushconstantPipelineLayout; - out->pushconstantShaderStageFlags = in->pushconstantShaderStageFlags; - out->pushconstantOffset = in->pushconstantOffset; - out->pushconstantSize = in->pushconstantSize; - out->indirectStateFlags = in->indirectStateFlags; - out->indexTypeCount = in->indexTypeCount; - out->pIndexTypes = (const VkIndexType *)UlongToPtr(in->pIndexTypes); - out->pIndexTypeValues = (const uint32_t *)UlongToPtr(in->pIndexTypeValues); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkIndirectCommandsLayoutTokenNV *convert_VkIndirectCommandsLayoutTokenNV_array_win32_to_host(struct conversion_context *ctx, const VkIndirectCommandsLayoutTokenNV32 *in, uint32_t count) -{ - VkIndirectCommandsLayoutTokenNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkIndirectCommandsLayoutTokenNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkIndirectCommandsLayoutCreateInfoNV_win32_to_host(struct conversion_context *ctx, const VkIndirectCommandsLayoutCreateInfoNV32 *in, VkIndirectCommandsLayoutCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pipelineBindPoint = in->pipelineBindPoint; - out->tokenCount = in->tokenCount; - out->pTokens = convert_VkIndirectCommandsLayoutTokenNV_array_win32_to_host(ctx, (const VkIndirectCommandsLayoutTokenNV32 *)UlongToPtr(in->pTokens), in->tokenCount); - out->streamCount = in->streamCount; - out->pStreamStrides = (const uint32_t *)UlongToPtr(in->pStreamStrides); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkLayerSettingEXT_win32_to_host(const VkLayerSettingEXT32 *in, VkLayerSettingEXT *out) -{ - if (!in) return; - - out->pLayerName = (const char *)UlongToPtr(in->pLayerName); - out->pSettingName = (const char *)UlongToPtr(in->pSettingName); - out->type = in->type; - out->valueCount = in->valueCount; - out->pValues = (const void *)UlongToPtr(in->pValues); -} - -static inline const VkLayerSettingEXT *convert_VkLayerSettingEXT_array_win32_to_host(struct conversion_context *ctx, const VkLayerSettingEXT32 *in, uint32_t count) -{ - VkLayerSettingEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkLayerSettingEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkApplicationInfo_win32_to_host(const VkApplicationInfo32 *in, VkApplicationInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pApplicationName = (const char *)UlongToPtr(in->pApplicationName); - out->applicationVersion = in->applicationVersion; - out->pEngineName = (const char *)UlongToPtr(in->pEngineName); - out->engineVersion = in->engineVersion; - out->apiVersion = in->apiVersion; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkApplicationInfo *convert_VkApplicationInfo_array_win32_to_host(struct conversion_context *ctx, const VkApplicationInfo32 *in, uint32_t count) -{ - VkApplicationInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkApplicationInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkInstanceCreateInfo_win64_to_host(struct conversion_context *ctx, const VkInstanceCreateInfo *in, VkInstanceCreateInfo *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pApplicationInfo = in->pApplicationInfo; - out->enabledLayerCount = in->enabledLayerCount; - out->ppEnabledLayerNames = in->ppEnabledLayerNames; - out->enabledExtensionCount = in->enabledExtensionCount; - out->ppEnabledExtensionNames = in->ppEnabledExtensionNames; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO: - break; - case VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT: - { - VkDebugReportCallbackCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDebugReportCallbackCreateInfoEXT *in_ext = (const VkDebugReportCallbackCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->pfnCallback = in_ext->pfnCallback; - out_ext->pUserData = in_ext->pUserData; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT: - { - VkValidationFlagsEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkValidationFlagsEXT *in_ext = (const VkValidationFlagsEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT; - out_ext->pNext = NULL; - out_ext->disabledValidationCheckCount = in_ext->disabledValidationCheckCount; - out_ext->pDisabledValidationChecks = in_ext->pDisabledValidationChecks; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT: - { - VkValidationFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkValidationFeaturesEXT *in_ext = (const VkValidationFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->enabledValidationFeatureCount = in_ext->enabledValidationFeatureCount; - out_ext->pEnabledValidationFeatures = in_ext->pEnabledValidationFeatures; - out_ext->disabledValidationFeatureCount = in_ext->disabledValidationFeatureCount; - out_ext->pDisabledValidationFeatures = in_ext->pDisabledValidationFeatures; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT: - { - VkLayerSettingsCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkLayerSettingsCreateInfoEXT *in_ext = (const VkLayerSettingsCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->settingCount = in_ext->settingCount; - out_ext->pSettings = in_ext->pSettings; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT: - { - VkDebugUtilsMessengerCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDebugUtilsMessengerCreateInfoEXT *in_ext = (const VkDebugUtilsMessengerCreateInfoEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->messageSeverity = in_ext->messageSeverity; - out_ext->messageType = in_ext->messageType; - out_ext->pfnUserCallback = in_ext->pfnUserCallback; - out_ext->pUserData = in_ext->pUserData; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} -#endif /* _WIN64 */ - -static inline void convert_VkInstanceCreateInfo_win32_to_host(struct conversion_context *ctx, const VkInstanceCreateInfo32 *in, VkInstanceCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pApplicationInfo = convert_VkApplicationInfo_array_win32_to_host(ctx, (const VkApplicationInfo32 *)UlongToPtr(in->pApplicationInfo), 1); - out->enabledLayerCount = in->enabledLayerCount; - out->ppEnabledLayerNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledLayerNames), in->enabledLayerCount); - out->enabledExtensionCount = in->enabledExtensionCount; - out->ppEnabledExtensionNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledExtensionNames), in->enabledExtensionCount); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO: - break; - case VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT: - { - VkDebugReportCallbackCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDebugReportCallbackCreateInfoEXT32 *in_ext = (const VkDebugReportCallbackCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->pfnCallback = in_ext->pfnCallback; - out_ext->pUserData = (void *)UlongToPtr(in_ext->pUserData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT: - { - VkValidationFlagsEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkValidationFlagsEXT32 *in_ext = (const VkValidationFlagsEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT; - out_ext->pNext = NULL; - out_ext->disabledValidationCheckCount = in_ext->disabledValidationCheckCount; - out_ext->pDisabledValidationChecks = (const VkValidationCheckEXT *)UlongToPtr(in_ext->pDisabledValidationChecks); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT: - { - VkValidationFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkValidationFeaturesEXT32 *in_ext = (const VkValidationFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->enabledValidationFeatureCount = in_ext->enabledValidationFeatureCount; - out_ext->pEnabledValidationFeatures = (const VkValidationFeatureEnableEXT *)UlongToPtr(in_ext->pEnabledValidationFeatures); - out_ext->disabledValidationFeatureCount = in_ext->disabledValidationFeatureCount; - out_ext->pDisabledValidationFeatures = (const VkValidationFeatureDisableEXT *)UlongToPtr(in_ext->pDisabledValidationFeatures); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT: - { - VkLayerSettingsCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkLayerSettingsCreateInfoEXT32 *in_ext = (const VkLayerSettingsCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->settingCount = in_ext->settingCount; - out_ext->pSettings = convert_VkLayerSettingEXT_array_win32_to_host(ctx, (const VkLayerSettingEXT32 *)UlongToPtr(in_ext->pSettings), in_ext->settingCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT: - { - VkDebugUtilsMessengerCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDebugUtilsMessengerCreateInfoEXT32 *in_ext = (const VkDebugUtilsMessengerCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->messageSeverity = in_ext->messageSeverity; - out_ext->messageType = in_ext->messageType; - out_ext->pfnUserCallback = in_ext->pfnUserCallback; - out_ext->pUserData = (void *)UlongToPtr(in_ext->pUserData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkMicromapCreateInfoEXT_win32_to_host(const VkMicromapCreateInfoEXT32 *in, VkMicromapCreateInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->createFlags = in->createFlags; - out->buffer = in->buffer; - out->offset = in->offset; - out->size = in->size; - out->type = in->type; - out->deviceAddress = in->deviceAddress; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkOpticalFlowSessionCreateInfoNV_win32_to_host(struct conversion_context *ctx, const VkOpticalFlowSessionCreateInfoNV32 *in, VkOpticalFlowSessionCreateInfoNV *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->width = in->width; - out->height = in->height; - out->imageFormat = in->imageFormat; - out->flowVectorFormat = in->flowVectorFormat; - out->costFormat = in->costFormat; - out->outputGridSize = in->outputGridSize; - out->hintGridSize = in->hintGridSize; - out->performanceLevel = in->performanceLevel; - out->flags = in->flags; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_PRIVATE_DATA_INFO_NV: - { - VkOpticalFlowSessionCreatePrivateDataInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpticalFlowSessionCreatePrivateDataInfoNV32 *in_ext = (const VkOpticalFlowSessionCreatePrivateDataInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_PRIVATE_DATA_INFO_NV; - out_ext->pNext = NULL; - out_ext->id = in_ext->id; - out_ext->size = in_ext->size; - out_ext->pPrivateData = (const void *)UlongToPtr(in_ext->pPrivateData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkPipelineCacheCreateInfo_win32_to_host(const VkPipelineCacheCreateInfo32 *in, VkPipelineCacheCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->initialDataSize = in->initialDataSize; - out->pInitialData = (const void *)UlongToPtr(in->pInitialData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineLayoutCreateInfo_win32_to_host(const VkPipelineLayoutCreateInfo32 *in, VkPipelineLayoutCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->setLayoutCount = in->setLayoutCount; - out->pSetLayouts = (const VkDescriptorSetLayout *)UlongToPtr(in->pSetLayouts); - out->pushConstantRangeCount = in->pushConstantRangeCount; - out->pPushConstantRanges = (const VkPushConstantRange *)UlongToPtr(in->pPushConstantRanges); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPrivateDataSlotCreateInfo_win32_to_host(const VkPrivateDataSlotCreateInfo32 *in, VkPrivateDataSlotCreateInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkQueryPoolCreateInfo_win32_to_host(struct conversion_context *ctx, const VkQueryPoolCreateInfo32 *in, VkQueryPoolCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->queryType = in->queryType; - out->queryCount = in->queryCount; - out->pipelineStatistics = in->pipelineStatistics; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR: - { - VkQueryPoolPerformanceCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkQueryPoolPerformanceCreateInfoKHR32 *in_ext = (const VkQueryPoolPerformanceCreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->queueFamilyIndex = in_ext->queueFamilyIndex; - out_ext->counterIndexCount = in_ext->counterIndexCount; - out_ext->pCounterIndices = (const uint32_t *)UlongToPtr(in_ext->pCounterIndices); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL: - { - VkQueryPoolPerformanceQueryCreateInfoINTEL *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkQueryPoolPerformanceQueryCreateInfoINTEL32 *in_ext = (const VkQueryPoolPerformanceQueryCreateInfoINTEL32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL; - out_ext->pNext = NULL; - out_ext->performanceCountersSampling = in_ext->performanceCountersSampling; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkRayTracingShaderGroupCreateInfoKHR_win32_to_host(const VkRayTracingShaderGroupCreateInfoKHR32 *in, VkRayTracingShaderGroupCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->generalShader = in->generalShader; - out->closestHitShader = in->closestHitShader; - out->anyHitShader = in->anyHitShader; - out->intersectionShader = in->intersectionShader; - out->pShaderGroupCaptureReplayHandle = (const void *)UlongToPtr(in->pShaderGroupCaptureReplayHandle); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkRayTracingShaderGroupCreateInfoKHR *convert_VkRayTracingShaderGroupCreateInfoKHR_array_win32_to_host(struct conversion_context *ctx, const VkRayTracingShaderGroupCreateInfoKHR32 *in, uint32_t count) -{ - VkRayTracingShaderGroupCreateInfoKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingShaderGroupCreateInfoKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineLibraryCreateInfoKHR_win32_to_host(const VkPipelineLibraryCreateInfoKHR32 *in, VkPipelineLibraryCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->libraryCount = in->libraryCount; - out->pLibraries = (const VkPipeline *)UlongToPtr(in->pLibraries); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkPipelineLibraryCreateInfoKHR *convert_VkPipelineLibraryCreateInfoKHR_array_win32_to_host(struct conversion_context *ctx, const VkPipelineLibraryCreateInfoKHR32 *in, uint32_t count) -{ - VkPipelineLibraryCreateInfoKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineLibraryCreateInfoKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRayTracingPipelineInterfaceCreateInfoKHR_win32_to_host(const VkRayTracingPipelineInterfaceCreateInfoKHR32 *in, VkRayTracingPipelineInterfaceCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->maxPipelineRayPayloadSize = in->maxPipelineRayPayloadSize; - out->maxPipelineRayHitAttributeSize = in->maxPipelineRayHitAttributeSize; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkRayTracingPipelineInterfaceCreateInfoKHR *convert_VkRayTracingPipelineInterfaceCreateInfoKHR_array_win32_to_host(struct conversion_context *ctx, const VkRayTracingPipelineInterfaceCreateInfoKHR32 *in, uint32_t count) -{ - VkRayTracingPipelineInterfaceCreateInfoKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineInterfaceCreateInfoKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkRayTracingPipelineCreateInfoKHR_win64_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoKHR *in, VkRayTracingPipelineCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win64_to_host(ctx, in->pStages, in->stageCount); - out->groupCount = in->groupCount; - out->pGroups = in->pGroups; - out->maxPipelineRayRecursionDepth = in->maxPipelineRayRecursionDepth; - out->pLibraryInfo = in->pLibraryInfo; - out->pLibraryInterface = in->pLibraryInterface; - out->pDynamicState = in->pDynamicState; - out->layout = in->layout; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; -} -#endif /* _WIN64 */ - -static inline void convert_VkRayTracingPipelineCreateInfoKHR_win32_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoKHR32 *in, VkRayTracingPipelineCreateInfoKHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win32_to_host(ctx, (const VkPipelineShaderStageCreateInfo32 *)UlongToPtr(in->pStages), in->stageCount); - out->groupCount = in->groupCount; - out->pGroups = convert_VkRayTracingShaderGroupCreateInfoKHR_array_win32_to_host(ctx, (const VkRayTracingShaderGroupCreateInfoKHR32 *)UlongToPtr(in->pGroups), in->groupCount); - out->maxPipelineRayRecursionDepth = in->maxPipelineRayRecursionDepth; - out->pLibraryInfo = convert_VkPipelineLibraryCreateInfoKHR_array_win32_to_host(ctx, (const VkPipelineLibraryCreateInfoKHR32 *)UlongToPtr(in->pLibraryInfo), 1); - out->pLibraryInterface = convert_VkRayTracingPipelineInterfaceCreateInfoKHR_array_win32_to_host(ctx, (const VkRayTracingPipelineInterfaceCreateInfoKHR32 *)UlongToPtr(in->pLibraryInterface), 1); - out->pDynamicState = convert_VkPipelineDynamicStateCreateInfo_array_win32_to_host(ctx, (const VkPipelineDynamicStateCreateInfo32 *)UlongToPtr(in->pDynamicState), 1); - out->layout = in->layout; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR: - { - VkPipelineCreateFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreateFlags2CreateInfoKHR32 *in_ext = (const VkPipelineCreateFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreationFeedbackCreateInfo32 *in_ext = (const VkPipelineCreationFeedbackCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->pPipelineCreationFeedback = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineCreationFeedback), 1); - out_ext->pipelineStageCreationFeedbackCount = in_ext->pipelineStageCreationFeedbackCount; - out_ext->pPipelineStageCreationFeedbacks = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT: - { - VkPipelineRobustnessCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineRobustnessCreateInfoEXT32 *in_ext = (const VkPipelineRobustnessCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->storageBuffers = in_ext->storageBuffers; - out_ext->uniformBuffers = in_ext->uniformBuffers; - out_ext->vertexInputs = in_ext->vertexInputs; - out_ext->images = in_ext->images; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkRayTracingPipelineCreateInfoKHR_host_to_win32(const VkRayTracingPipelineCreateInfoKHR *in, const VkRayTracingPipelineCreateInfoKHR32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO); - const VkPipelineCreationFeedbackCreateInfo *in_ext = (const VkPipelineCreationFeedbackCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineCreationFeedback, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineCreationFeedback), 1); - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineStageCreationFeedbacks, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -#ifdef _WIN64 -static inline const VkRayTracingPipelineCreateInfoKHR *convert_VkRayTracingPipelineCreateInfoKHR_array_win64_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoKHR *in, uint32_t count) -{ - VkRayTracingPipelineCreateInfoKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineCreateInfoKHR_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkRayTracingPipelineCreateInfoKHR *convert_VkRayTracingPipelineCreateInfoKHR_array_win32_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoKHR32 *in, uint32_t count) -{ - VkRayTracingPipelineCreateInfoKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineCreateInfoKHR_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRayTracingPipelineCreateInfoKHR_array_host_to_win32(const VkRayTracingPipelineCreateInfoKHR *in, const VkRayTracingPipelineCreateInfoKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineCreateInfoKHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkRayTracingShaderGroupCreateInfoNV_win32_to_host(const VkRayTracingShaderGroupCreateInfoNV32 *in, VkRayTracingShaderGroupCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->generalShader = in->generalShader; - out->closestHitShader = in->closestHitShader; - out->anyHitShader = in->anyHitShader; - out->intersectionShader = in->intersectionShader; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkRayTracingShaderGroupCreateInfoNV *convert_VkRayTracingShaderGroupCreateInfoNV_array_win32_to_host(struct conversion_context *ctx, const VkRayTracingShaderGroupCreateInfoNV32 *in, uint32_t count) -{ - VkRayTracingShaderGroupCreateInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingShaderGroupCreateInfoNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkRayTracingPipelineCreateInfoNV_win64_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoNV *in, VkRayTracingPipelineCreateInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win64_to_host(ctx, in->pStages, in->stageCount); - out->groupCount = in->groupCount; - out->pGroups = in->pGroups; - out->maxRecursionDepth = in->maxRecursionDepth; - out->layout = in->layout; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; -} -#endif /* _WIN64 */ - -static inline void convert_VkRayTracingPipelineCreateInfoNV_win32_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoNV32 *in, VkRayTracingPipelineCreateInfoNV *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stageCount = in->stageCount; - out->pStages = convert_VkPipelineShaderStageCreateInfo_array_win32_to_host(ctx, (const VkPipelineShaderStageCreateInfo32 *)UlongToPtr(in->pStages), in->stageCount); - out->groupCount = in->groupCount; - out->pGroups = convert_VkRayTracingShaderGroupCreateInfoNV_array_win32_to_host(ctx, (const VkRayTracingShaderGroupCreateInfoNV32 *)UlongToPtr(in->pGroups), in->groupCount); - out->maxRecursionDepth = in->maxRecursionDepth; - out->layout = in->layout; - out->basePipelineHandle = in->basePipelineHandle; - out->basePipelineIndex = in->basePipelineIndex; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR: - { - VkPipelineCreateFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreateFlags2CreateInfoKHR32 *in_ext = (const VkPipelineCreateFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineCreationFeedbackCreateInfo32 *in_ext = (const VkPipelineCreationFeedbackCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->pPipelineCreationFeedback = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineCreationFeedback), 1); - out_ext->pipelineStageCreationFeedbackCount = in_ext->pipelineStageCreationFeedbackCount; - out_ext->pPipelineStageCreationFeedbacks = convert_VkPipelineCreationFeedback_array_win32_to_host(ctx, (VkPipelineCreationFeedback32 *)UlongToPtr(in_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkRayTracingPipelineCreateInfoNV_host_to_win32(const VkRayTracingPipelineCreateInfoNV *in, const VkRayTracingPipelineCreateInfoNV32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO: - { - VkPipelineCreationFeedbackCreateInfo32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO); - const VkPipelineCreationFeedbackCreateInfo *in_ext = (const VkPipelineCreationFeedbackCreateInfo *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO; - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineCreationFeedback, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineCreationFeedback), 1); - convert_VkPipelineCreationFeedback_array_host_to_win32(in_ext->pPipelineStageCreationFeedbacks, (VkPipelineCreationFeedback32 *)UlongToPtr(out_ext->pPipelineStageCreationFeedbacks), in_ext->pipelineStageCreationFeedbackCount); - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -#ifdef _WIN64 -static inline const VkRayTracingPipelineCreateInfoNV *convert_VkRayTracingPipelineCreateInfoNV_array_win64_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoNV *in, uint32_t count) -{ - VkRayTracingPipelineCreateInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineCreateInfoNV_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkRayTracingPipelineCreateInfoNV *convert_VkRayTracingPipelineCreateInfoNV_array_win32_to_host(struct conversion_context *ctx, const VkRayTracingPipelineCreateInfoNV32 *in, uint32_t count) -{ - VkRayTracingPipelineCreateInfoNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineCreateInfoNV_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRayTracingPipelineCreateInfoNV_array_host_to_win32(const VkRayTracingPipelineCreateInfoNV *in, const VkRayTracingPipelineCreateInfoNV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkRayTracingPipelineCreateInfoNV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkSubpassDescription_win32_to_host(const VkSubpassDescription32 *in, VkSubpassDescription *out) -{ - if (!in) return; - - out->flags = in->flags; - out->pipelineBindPoint = in->pipelineBindPoint; - out->inputAttachmentCount = in->inputAttachmentCount; - out->pInputAttachments = (const VkAttachmentReference *)UlongToPtr(in->pInputAttachments); - out->colorAttachmentCount = in->colorAttachmentCount; - out->pColorAttachments = (const VkAttachmentReference *)UlongToPtr(in->pColorAttachments); - out->pResolveAttachments = (const VkAttachmentReference *)UlongToPtr(in->pResolveAttachments); - out->pDepthStencilAttachment = (const VkAttachmentReference *)UlongToPtr(in->pDepthStencilAttachment); - out->preserveAttachmentCount = in->preserveAttachmentCount; - out->pPreserveAttachments = (const uint32_t *)UlongToPtr(in->pPreserveAttachments); -} - -static inline const VkSubpassDescription *convert_VkSubpassDescription_array_win32_to_host(struct conversion_context *ctx, const VkSubpassDescription32 *in, uint32_t count) -{ - VkSubpassDescription *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubpassDescription_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRenderPassCreateInfo_win32_to_host(struct conversion_context *ctx, const VkRenderPassCreateInfo32 *in, VkRenderPassCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->attachmentCount = in->attachmentCount; - out->pAttachments = (const VkAttachmentDescription *)UlongToPtr(in->pAttachments); - out->subpassCount = in->subpassCount; - out->pSubpasses = convert_VkSubpassDescription_array_win32_to_host(ctx, (const VkSubpassDescription32 *)UlongToPtr(in->pSubpasses), in->subpassCount); - out->dependencyCount = in->dependencyCount; - out->pDependencies = (const VkSubpassDependency *)UlongToPtr(in->pDependencies); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO: - { - VkRenderPassMultiviewCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassMultiviewCreateInfo32 *in_ext = (const VkRenderPassMultiviewCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->subpassCount = in_ext->subpassCount; - out_ext->pViewMasks = (const uint32_t *)UlongToPtr(in_ext->pViewMasks); - out_ext->dependencyCount = in_ext->dependencyCount; - out_ext->pViewOffsets = (const int32_t *)UlongToPtr(in_ext->pViewOffsets); - out_ext->correlationMaskCount = in_ext->correlationMaskCount; - out_ext->pCorrelationMasks = (const uint32_t *)UlongToPtr(in_ext->pCorrelationMasks); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO: - { - VkRenderPassInputAttachmentAspectCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassInputAttachmentAspectCreateInfo32 *in_ext = (const VkRenderPassInputAttachmentAspectCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->aspectReferenceCount = in_ext->aspectReferenceCount; - out_ext->pAspectReferences = (const VkInputAttachmentAspectReference *)UlongToPtr(in_ext->pAspectReferences); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT: - { - VkRenderPassFragmentDensityMapCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassFragmentDensityMapCreateInfoEXT32 *in_ext = (const VkRenderPassFragmentDensityMapCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapAttachment = in_ext->fragmentDensityMapAttachment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkAttachmentDescription2_win32_to_host(struct conversion_context *ctx, const VkAttachmentDescription232 *in, VkAttachmentDescription2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->format = in->format; - out->samples = in->samples; - out->loadOp = in->loadOp; - out->storeOp = in->storeOp; - out->stencilLoadOp = in->stencilLoadOp; - out->stencilStoreOp = in->stencilStoreOp; - out->initialLayout = in->initialLayout; - out->finalLayout = in->finalLayout; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT: - { - VkAttachmentDescriptionStencilLayout *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAttachmentDescriptionStencilLayout32 *in_ext = (const VkAttachmentDescriptionStencilLayout32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT; - out_ext->pNext = NULL; - out_ext->stencilInitialLayout = in_ext->stencilInitialLayout; - out_ext->stencilFinalLayout = in_ext->stencilFinalLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkAttachmentDescription2 *convert_VkAttachmentDescription2_array_win32_to_host(struct conversion_context *ctx, const VkAttachmentDescription232 *in, uint32_t count) -{ - VkAttachmentDescription2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkAttachmentDescription2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkAttachmentReference2_win32_to_host(struct conversion_context *ctx, const VkAttachmentReference232 *in, VkAttachmentReference2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->attachment = in->attachment; - out->layout = in->layout; - out->aspectMask = in->aspectMask; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT: - { - VkAttachmentReferenceStencilLayout *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkAttachmentReferenceStencilLayout32 *in_ext = (const VkAttachmentReferenceStencilLayout32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT; - out_ext->pNext = NULL; - out_ext->stencilLayout = in_ext->stencilLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkAttachmentReference2 *convert_VkAttachmentReference2_array_win32_to_host(struct conversion_context *ctx, const VkAttachmentReference232 *in, uint32_t count) -{ - VkAttachmentReference2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkAttachmentReference2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSubpassDescription2_win32_to_host(struct conversion_context *ctx, const VkSubpassDescription232 *in, VkSubpassDescription2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pipelineBindPoint = in->pipelineBindPoint; - out->viewMask = in->viewMask; - out->inputAttachmentCount = in->inputAttachmentCount; - out->pInputAttachments = convert_VkAttachmentReference2_array_win32_to_host(ctx, (const VkAttachmentReference232 *)UlongToPtr(in->pInputAttachments), in->inputAttachmentCount); - out->colorAttachmentCount = in->colorAttachmentCount; - out->pColorAttachments = convert_VkAttachmentReference2_array_win32_to_host(ctx, (const VkAttachmentReference232 *)UlongToPtr(in->pColorAttachments), in->colorAttachmentCount); - out->pResolveAttachments = convert_VkAttachmentReference2_array_win32_to_host(ctx, (const VkAttachmentReference232 *)UlongToPtr(in->pResolveAttachments), in->colorAttachmentCount); - out->pDepthStencilAttachment = convert_VkAttachmentReference2_array_win32_to_host(ctx, (const VkAttachmentReference232 *)UlongToPtr(in->pDepthStencilAttachment), 1); - out->preserveAttachmentCount = in->preserveAttachmentCount; - out->pPreserveAttachments = (const uint32_t *)UlongToPtr(in->pPreserveAttachments); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE: - { - VkSubpassDescriptionDepthStencilResolve *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSubpassDescriptionDepthStencilResolve32 *in_ext = (const VkSubpassDescriptionDepthStencilResolve32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE; - out_ext->pNext = NULL; - out_ext->depthResolveMode = in_ext->depthResolveMode; - out_ext->stencilResolveMode = in_ext->stencilResolveMode; - out_ext->pDepthStencilResolveAttachment = convert_VkAttachmentReference2_array_win32_to_host(ctx, (const VkAttachmentReference232 *)UlongToPtr(in_ext->pDepthStencilResolveAttachment), 1); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR: - { - VkFragmentShadingRateAttachmentInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkFragmentShadingRateAttachmentInfoKHR32 *in_ext = (const VkFragmentShadingRateAttachmentInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR; - out_ext->pNext = NULL; - out_ext->pFragmentShadingRateAttachment = convert_VkAttachmentReference2_array_win32_to_host(ctx, (const VkAttachmentReference232 *)UlongToPtr(in_ext->pFragmentShadingRateAttachment), 1); - out_ext->shadingRateAttachmentTexelSize = in_ext->shadingRateAttachmentTexelSize; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT: - { - VkMultisampledRenderToSingleSampledInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMultisampledRenderToSingleSampledInfoEXT32 *in_ext = (const VkMultisampledRenderToSingleSampledInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT; - out_ext->pNext = NULL; - out_ext->multisampledRenderToSingleSampledEnable = in_ext->multisampledRenderToSingleSampledEnable; - out_ext->rasterizationSamples = in_ext->rasterizationSamples; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT: - { - VkRenderPassCreationControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassCreationControlEXT32 *in_ext = (const VkRenderPassCreationControlEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT; - out_ext->pNext = NULL; - out_ext->disallowMerging = in_ext->disallowMerging; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT: - { - VkRenderPassSubpassFeedbackCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassSubpassFeedbackCreateInfoEXT32 *in_ext = (const VkRenderPassSubpassFeedbackCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->pSubpassFeedback = (VkRenderPassSubpassFeedbackInfoEXT *)UlongToPtr(in_ext->pSubpassFeedback); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkSubpassDescription2 *convert_VkSubpassDescription2_array_win32_to_host(struct conversion_context *ctx, const VkSubpassDescription232 *in, uint32_t count) -{ - VkSubpassDescription2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubpassDescription2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSubpassDependency2_win32_to_host(struct conversion_context *ctx, const VkSubpassDependency232 *in, VkSubpassDependency2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcSubpass = in->srcSubpass; - out->dstSubpass = in->dstSubpass; - out->srcStageMask = in->srcStageMask; - out->dstStageMask = in->dstStageMask; - out->srcAccessMask = in->srcAccessMask; - out->dstAccessMask = in->dstAccessMask; - out->dependencyFlags = in->dependencyFlags; - out->viewOffset = in->viewOffset; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_MEMORY_BARRIER_2: - { - VkMemoryBarrier2 *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkMemoryBarrier232 *in_ext = (const VkMemoryBarrier232 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2; - out_ext->pNext = NULL; - out_ext->srcStageMask = in_ext->srcStageMask; - out_ext->srcAccessMask = in_ext->srcAccessMask; - out_ext->dstStageMask = in_ext->dstStageMask; - out_ext->dstAccessMask = in_ext->dstAccessMask; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkSubpassDependency2 *convert_VkSubpassDependency2_array_win32_to_host(struct conversion_context *ctx, const VkSubpassDependency232 *in, uint32_t count) -{ - VkSubpassDependency2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubpassDependency2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkRenderPassCreateInfo2_win32_to_host(struct conversion_context *ctx, const VkRenderPassCreateInfo232 *in, VkRenderPassCreateInfo2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->attachmentCount = in->attachmentCount; - out->pAttachments = convert_VkAttachmentDescription2_array_win32_to_host(ctx, (const VkAttachmentDescription232 *)UlongToPtr(in->pAttachments), in->attachmentCount); - out->subpassCount = in->subpassCount; - out->pSubpasses = convert_VkSubpassDescription2_array_win32_to_host(ctx, (const VkSubpassDescription232 *)UlongToPtr(in->pSubpasses), in->subpassCount); - out->dependencyCount = in->dependencyCount; - out->pDependencies = convert_VkSubpassDependency2_array_win32_to_host(ctx, (const VkSubpassDependency232 *)UlongToPtr(in->pDependencies), in->dependencyCount); - out->correlatedViewMaskCount = in->correlatedViewMaskCount; - out->pCorrelatedViewMasks = (const uint32_t *)UlongToPtr(in->pCorrelatedViewMasks); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT: - { - VkRenderPassFragmentDensityMapCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassFragmentDensityMapCreateInfoEXT32 *in_ext = (const VkRenderPassFragmentDensityMapCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapAttachment = in_ext->fragmentDensityMapAttachment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT: - { - VkRenderPassCreationControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassCreationControlEXT32 *in_ext = (const VkRenderPassCreationControlEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT; - out_ext->pNext = NULL; - out_ext->disallowMerging = in_ext->disallowMerging; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT: - { - VkRenderPassCreationFeedbackCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkRenderPassCreationFeedbackCreateInfoEXT32 *in_ext = (const VkRenderPassCreationFeedbackCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->pRenderPassFeedback = (VkRenderPassCreationFeedbackInfoEXT *)UlongToPtr(in_ext->pRenderPassFeedback); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSamplerCreateInfo_win32_to_host(struct conversion_context *ctx, const VkSamplerCreateInfo32 *in, VkSamplerCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->magFilter = in->magFilter; - out->minFilter = in->minFilter; - out->mipmapMode = in->mipmapMode; - out->addressModeU = in->addressModeU; - out->addressModeV = in->addressModeV; - out->addressModeW = in->addressModeW; - out->mipLodBias = in->mipLodBias; - out->anisotropyEnable = in->anisotropyEnable; - out->maxAnisotropy = in->maxAnisotropy; - out->compareEnable = in->compareEnable; - out->compareOp = in->compareOp; - out->minLod = in->minLod; - out->maxLod = in->maxLod; - out->borderColor = in->borderColor; - out->unnormalizedCoordinates = in->unnormalizedCoordinates; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: - { - VkSamplerYcbcrConversionInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerYcbcrConversionInfo32 *in_ext = (const VkSamplerYcbcrConversionInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO; - out_ext->pNext = NULL; - out_ext->conversion = in_ext->conversion; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO: - { - VkSamplerReductionModeCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerReductionModeCreateInfo32 *in_ext = (const VkSamplerReductionModeCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->reductionMode = in_ext->reductionMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT: - { - VkSamplerCustomBorderColorCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerCustomBorderColorCreateInfoEXT32 *in_ext = (const VkSamplerCustomBorderColorCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->customBorderColor = in_ext->customBorderColor; - out_ext->format = in_ext->format; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT: - { - VkSamplerBorderColorComponentMappingCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerBorderColorComponentMappingCreateInfoEXT32 *in_ext = (const VkSamplerBorderColorComponentMappingCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->components = in_ext->components; - out_ext->srgb = in_ext->srgb; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: - { - VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->opaqueCaptureDescriptorData = (const void *)UlongToPtr(in_ext->opaqueCaptureDescriptorData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM: - { - VkSamplerCubicWeightsCreateInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerCubicWeightsCreateInfoQCOM32 *in_ext = (const VkSamplerCubicWeightsCreateInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->cubicWeights = in_ext->cubicWeights; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM: - { - VkSamplerBlockMatchWindowCreateInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerBlockMatchWindowCreateInfoQCOM32 *in_ext = (const VkSamplerBlockMatchWindowCreateInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->windowExtent = in_ext->windowExtent; - out_ext->windowCompareMode = in_ext->windowCompareMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSamplerYcbcrConversionCreateInfo_win32_to_host(struct conversion_context *ctx, const VkSamplerYcbcrConversionCreateInfo32 *in, VkSamplerYcbcrConversionCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->format = in->format; - out->ycbcrModel = in->ycbcrModel; - out->ycbcrRange = in->ycbcrRange; - out->components = in->components; - out->xChromaOffset = in->xChromaOffset; - out->yChromaOffset = in->yChromaOffset; - out->chromaFilter = in->chromaFilter; - out->forceExplicitReconstruction = in->forceExplicitReconstruction; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM: - { - VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM32 *in_ext = (const VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM; - out_ext->pNext = NULL; - out_ext->enableYDegamma = in_ext->enableYDegamma; - out_ext->enableCbCrDegamma = in_ext->enableCbCrDegamma; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSemaphoreCreateInfo_win32_to_host(struct conversion_context *ctx, const VkSemaphoreCreateInfo32 *in, VkSemaphoreCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO: - { - VkExportSemaphoreCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkExportSemaphoreCreateInfo32 *in_ext = (const VkExportSemaphoreCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->handleTypes = in_ext->handleTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO: - { - VkSemaphoreTypeCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSemaphoreTypeCreateInfo32 *in_ext = (const VkSemaphoreTypeCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->semaphoreType = in_ext->semaphoreType; - out_ext->initialValue = in_ext->initialValue; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_QUERY_LOW_LATENCY_SUPPORT_NV: - { - VkQueryLowLatencySupportNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkQueryLowLatencySupportNV32 *in_ext = (const VkQueryLowLatencySupportNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUERY_LOW_LATENCY_SUPPORT_NV; - out_ext->pNext = NULL; - out_ext->pQueriedLowLatencyData = (void *)UlongToPtr(in_ext->pQueriedLowLatencyData); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkShaderModuleCreateInfo_win32_to_host(struct conversion_context *ctx, const VkShaderModuleCreateInfo32 *in, VkShaderModuleCreateInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->codeSize = in->codeSize; - out->pCode = (const uint32_t *)UlongToPtr(in->pCode); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT: - { - VkShaderModuleValidationCacheCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkShaderModuleValidationCacheCreateInfoEXT32 *in_ext = (const VkShaderModuleValidationCacheCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->validationCache = in_ext->validationCache; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkShaderCreateInfoEXT_win32_to_host(struct conversion_context *ctx, const VkShaderCreateInfoEXT32 *in, VkShaderCreateInfoEXT *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->stage = in->stage; - out->nextStage = in->nextStage; - out->codeType = in->codeType; - out->codeSize = in->codeSize; - out->pCode = (const void *)UlongToPtr(in->pCode); - out->pName = (const char *)UlongToPtr(in->pName); - out->setLayoutCount = in->setLayoutCount; - out->pSetLayouts = (const VkDescriptorSetLayout *)UlongToPtr(in->pSetLayouts); - out->pushConstantRangeCount = in->pushConstantRangeCount; - out->pPushConstantRanges = (const VkPushConstantRange *)UlongToPtr(in->pPushConstantRanges); - out->pSpecializationInfo = convert_VkSpecializationInfo_array_win32_to_host(ctx, (const VkSpecializationInfo32 *)UlongToPtr(in->pSpecializationInfo), 1); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO: - { - VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 *in_ext = (const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->requiredSubgroupSize = in_ext->requiredSubgroupSize; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline const VkShaderCreateInfoEXT *convert_VkShaderCreateInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkShaderCreateInfoEXT32 *in, uint32_t count) -{ - VkShaderCreateInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkShaderCreateInfoEXT_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkSwapchainCreateInfoKHR_win64_to_driver(const VkSwapchainCreateInfoKHR *in, VkSwapchainCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - out->surface = wine_surface_from_handle(in->surface)->driver_surface; - out->minImageCount = in->minImageCount; - out->imageFormat = in->imageFormat; - out->imageColorSpace = in->imageColorSpace; - out->imageExtent = in->imageExtent; - out->imageArrayLayers = in->imageArrayLayers; - out->imageUsage = in->imageUsage; - out->imageSharingMode = in->imageSharingMode; - out->queueFamilyIndexCount = in->queueFamilyIndexCount; - out->pQueueFamilyIndices = in->pQueueFamilyIndices; - out->preTransform = in->preTransform; - out->compositeAlpha = in->compositeAlpha; - out->presentMode = in->presentMode; - out->clipped = in->clipped; - out->oldSwapchain = in->oldSwapchain; -} -#endif /* _WIN64 */ - -static inline void convert_VkSwapchainCreateInfoKHR_win32_to_driver(struct conversion_context *ctx, const VkSwapchainCreateInfoKHR32 *in, VkSwapchainCreateInfoKHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->surface = wine_surface_from_handle(in->surface)->driver_surface; - out->minImageCount = in->minImageCount; - out->imageFormat = in->imageFormat; - out->imageColorSpace = in->imageColorSpace; - out->imageExtent = in->imageExtent; - out->imageArrayLayers = in->imageArrayLayers; - out->imageUsage = in->imageUsage; - out->imageSharingMode = in->imageSharingMode; - out->queueFamilyIndexCount = in->queueFamilyIndexCount; - out->pQueueFamilyIndices = (const uint32_t *)UlongToPtr(in->pQueueFamilyIndices); - out->preTransform = in->preTransform; - out->compositeAlpha = in->compositeAlpha; - out->presentMode = in->presentMode; - out->clipped = in->clipped; - out->oldSwapchain = in->oldSwapchain; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR: - { - VkDeviceGroupSwapchainCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupSwapchainCreateInfoKHR32 *in_ext = (const VkDeviceGroupSwapchainCreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->modes = in_ext->modes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: - { - VkImageFormatListCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageFormatListCreateInfo32 *in_ext = (const VkImageFormatListCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->viewFormatCount = in_ext->viewFormatCount; - out_ext->pViewFormats = (const VkFormat *)UlongToPtr(in_ext->pViewFormats); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_BARRIER_CREATE_INFO_NV: - { - VkSwapchainPresentBarrierCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSwapchainPresentBarrierCreateInfoNV32 *in_ext = (const VkSwapchainPresentBarrierCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_BARRIER_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->presentBarrierEnable = in_ext->presentBarrierEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: - { - VkImageCompressionControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageCompressionControlEXT32 *in_ext = (const VkImageCompressionControlEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->compressionControlPlaneCount = in_ext->compressionControlPlaneCount; - out_ext->pFixedRateFlags = (VkImageCompressionFixedRateFlagsEXT *)UlongToPtr(in_ext->pFixedRateFlags); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT: - { - VkSwapchainPresentModesCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSwapchainPresentModesCreateInfoEXT32 *in_ext = (const VkSwapchainPresentModesCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->presentModeCount = in_ext->presentModeCount; - out_ext->pPresentModes = (const VkPresentModeKHR *)UlongToPtr(in_ext->pPresentModes); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_SCALING_CREATE_INFO_EXT: - { - VkSwapchainPresentScalingCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSwapchainPresentScalingCreateInfoEXT32 *in_ext = (const VkSwapchainPresentScalingCreateInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_SCALING_CREATE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->scalingBehavior = in_ext->scalingBehavior; - out_ext->presentGravityX = in_ext->presentGravityX; - out_ext->presentGravityY = in_ext->presentGravityY; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV: - { - VkSwapchainLatencyCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSwapchainLatencyCreateInfoNV32 *in_ext = (const VkSwapchainLatencyCreateInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV; - out_ext->pNext = NULL; - out_ext->latencyModeEnable = in_ext->latencyModeEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkValidationCacheCreateInfoEXT_win32_to_host(const VkValidationCacheCreateInfoEXT32 *in, VkValidationCacheCreateInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->initialDataSize = in->initialDataSize; - out->pInitialData = (const void *)UlongToPtr(in->pInitialData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkWin32SurfaceCreateInfoKHR_win32_to_host(const VkWin32SurfaceCreateInfoKHR32 *in, VkWin32SurfaceCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->hinstance = (HINSTANCE)UlongToPtr(in->hinstance); - out->hwnd = (HWND)UlongToPtr(in->hwnd); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline void convert_VkDebugMarkerObjectNameInfoEXT_win64_to_host(const VkDebugMarkerObjectNameInfoEXT *in, VkDebugMarkerObjectNameInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->objectType = in->objectType; - out->object = wine_vk_unwrap_handle(in->objectType, in->object); - out->pObjectName = in->pObjectName; -} -#endif /* _WIN64 */ - -static inline void convert_VkDebugMarkerObjectNameInfoEXT_win32_to_host(const VkDebugMarkerObjectNameInfoEXT32 *in, VkDebugMarkerObjectNameInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->objectType = in->objectType; - out->object = wine_vk_unwrap_handle(in->objectType, in->object); - out->pObjectName = (const char *)UlongToPtr(in->pObjectName); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline void convert_VkDebugMarkerObjectTagInfoEXT_win64_to_host(const VkDebugMarkerObjectTagInfoEXT *in, VkDebugMarkerObjectTagInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->objectType = in->objectType; - out->object = wine_vk_unwrap_handle(in->objectType, in->object); - out->tagName = in->tagName; - out->tagSize = in->tagSize; - out->pTag = in->pTag; -} -#endif /* _WIN64 */ - -static inline void convert_VkDebugMarkerObjectTagInfoEXT_win32_to_host(const VkDebugMarkerObjectTagInfoEXT32 *in, VkDebugMarkerObjectTagInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->objectType = in->objectType; - out->object = wine_vk_unwrap_handle(in->objectType, in->object); - out->tagName = in->tagName; - out->tagSize = in->tagSize; - out->pTag = (const void *)UlongToPtr(in->pTag); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPhysicalDevice_array_unwrapped_host_to_win32(const VkPhysicalDevice *in, PTR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - out[i] = PtrToUlong(in[i]); - } -} - -static inline void convert_VkPhysicalDeviceGroupProperties_win32_to_unwrapped_host(const VkPhysicalDeviceGroupProperties32 *in, VkPhysicalDeviceGroupProperties *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPhysicalDeviceGroupProperties_unwrapped_host_to_win32(const VkPhysicalDeviceGroupProperties *in, VkPhysicalDeviceGroupProperties32 *out) -{ - if (!in) return; - - out->physicalDeviceCount = in->physicalDeviceCount; - convert_VkPhysicalDevice_array_unwrapped_host_to_win32(in->physicalDevices, out->physicalDevices, VK_MAX_DEVICE_GROUP_SIZE); - out->subsetAllocation = in->subsetAllocation; -} - -static inline VkPhysicalDeviceGroupProperties *convert_VkPhysicalDeviceGroupProperties_array_win32_to_unwrapped_host(struct conversion_context *ctx, const VkPhysicalDeviceGroupProperties32 *in, uint32_t count) -{ - VkPhysicalDeviceGroupProperties *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPhysicalDeviceGroupProperties_win32_to_unwrapped_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPhysicalDeviceGroupProperties_array_unwrapped_host_to_win32(const VkPhysicalDeviceGroupProperties *in, VkPhysicalDeviceGroupProperties32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPhysicalDeviceGroupProperties_unwrapped_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPerformanceCounterKHR_win32_to_host(const VkPerformanceCounterKHR32 *in, VkPerformanceCounterKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPerformanceCounterKHR_host_to_win32(const VkPerformanceCounterKHR *in, VkPerformanceCounterKHR32 *out) -{ - if (!in) return; - - out->unit = in->unit; - out->scope = in->scope; - out->storage = in->storage; - memcpy(out->uuid, in->uuid, VK_UUID_SIZE * sizeof(uint8_t)); -} - -static inline VkPerformanceCounterKHR *convert_VkPerformanceCounterKHR_array_win32_to_host(struct conversion_context *ctx, const VkPerformanceCounterKHR32 *in, uint32_t count) -{ - VkPerformanceCounterKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPerformanceCounterKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPerformanceCounterKHR_array_host_to_win32(const VkPerformanceCounterKHR *in, VkPerformanceCounterKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPerformanceCounterKHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPerformanceCounterDescriptionKHR_win32_to_host(const VkPerformanceCounterDescriptionKHR32 *in, VkPerformanceCounterDescriptionKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPerformanceCounterDescriptionKHR_host_to_win32(const VkPerformanceCounterDescriptionKHR *in, VkPerformanceCounterDescriptionKHR32 *out) -{ - if (!in) return; - - out->flags = in->flags; - memcpy(out->name, in->name, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - memcpy(out->category, in->category, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); -} - -static inline VkPerformanceCounterDescriptionKHR *convert_VkPerformanceCounterDescriptionKHR_array_win32_to_host(struct conversion_context *ctx, const VkPerformanceCounterDescriptionKHR32 *in, uint32_t count) -{ - VkPerformanceCounterDescriptionKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPerformanceCounterDescriptionKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPerformanceCounterDescriptionKHR_array_host_to_win32(const VkPerformanceCounterDescriptionKHR *in, VkPerformanceCounterDescriptionKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPerformanceCounterDescriptionKHR_host_to_win32(&in[i], &out[i]); - } -} - -#ifdef _WIN64 -static inline void convert_VkMappedMemoryRange_win64_to_host(const VkMappedMemoryRange *in, VkMappedMemoryRange *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->offset = in->offset; - out->size = in->size; -} -#endif /* _WIN64 */ - -static inline void convert_VkMappedMemoryRange_win32_to_host(const VkMappedMemoryRange32 *in, VkMappedMemoryRange *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - out->offset = in->offset; - out->size = in->size; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline const VkMappedMemoryRange *convert_VkMappedMemoryRange_array_win64_to_host(struct conversion_context *ctx, const VkMappedMemoryRange *in, uint32_t count) -{ - VkMappedMemoryRange *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMappedMemoryRange_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkMappedMemoryRange *convert_VkMappedMemoryRange_array_win32_to_host(struct conversion_context *ctx, const VkMappedMemoryRange32 *in, uint32_t count) -{ - VkMappedMemoryRange *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkMappedMemoryRange_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkAccelerationStructureBuildSizesInfoKHR_win32_to_host(const VkAccelerationStructureBuildSizesInfoKHR32 *in, VkAccelerationStructureBuildSizesInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->accelerationStructureSize = in->accelerationStructureSize; - out->updateScratchSize = in->updateScratchSize; - out->buildScratchSize = in->buildScratchSize; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAccelerationStructureBuildSizesInfoKHR_host_to_win32(const VkAccelerationStructureBuildSizesInfoKHR *in, VkAccelerationStructureBuildSizesInfoKHR32 *out) -{ - if (!in) return; - - out->accelerationStructureSize = in->accelerationStructureSize; - out->updateScratchSize = in->updateScratchSize; - out->buildScratchSize = in->buildScratchSize; -} - -static inline void convert_VkAccelerationStructureDeviceAddressInfoKHR_win32_to_host(const VkAccelerationStructureDeviceAddressInfoKHR32 *in, VkAccelerationStructureDeviceAddressInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->accelerationStructure = in->accelerationStructure; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkAccelerationStructureMemoryRequirementsInfoNV_win32_to_host(const VkAccelerationStructureMemoryRequirementsInfoNV32 *in, VkAccelerationStructureMemoryRequirementsInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - out->accelerationStructure = in->accelerationStructure; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryRequirements_host_to_win32(const VkMemoryRequirements *in, VkMemoryRequirements32 *out) -{ - if (!in) return; - - out->size = in->size; - out->alignment = in->alignment; - out->memoryTypeBits = in->memoryTypeBits; -} - -static inline void convert_VkMemoryRequirements2KHR_win32_to_host(const VkMemoryRequirements2KHR32 *in, VkMemoryRequirements2KHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryRequirements2KHR_host_to_win32(const VkMemoryRequirements2KHR *in, VkMemoryRequirements2KHR32 *out) -{ - if (!in) return; - - convert_VkMemoryRequirements_host_to_win32(&in->memoryRequirements, &out->memoryRequirements); -} - -static inline void convert_VkAccelerationStructureCaptureDescriptorDataInfoEXT_win32_to_host(const VkAccelerationStructureCaptureDescriptorDataInfoEXT32 *in, VkAccelerationStructureCaptureDescriptorDataInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->accelerationStructure = in->accelerationStructure; - out->accelerationStructureNV = in->accelerationStructureNV; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkBufferDeviceAddressInfo_win32_to_host(const VkBufferDeviceAddressInfo32 *in, VkBufferDeviceAddressInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->buffer = in->buffer; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkBufferMemoryRequirementsInfo2_win32_to_host(const VkBufferMemoryRequirementsInfo232 *in, VkBufferMemoryRequirementsInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->buffer = in->buffer; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryRequirements2_win32_to_host(struct conversion_context *ctx, const VkMemoryRequirements232 *in, VkMemoryRequirements2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: - { - VkMemoryDedicatedRequirements *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkMemoryRequirements2_host_to_win32(const VkMemoryRequirements2 *in, VkMemoryRequirements232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - convert_VkMemoryRequirements_host_to_win32(&in->memoryRequirements, &out->memoryRequirements); - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: - { - VkMemoryDedicatedRequirements32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS); - const VkMemoryDedicatedRequirements *in_ext = (const VkMemoryDedicatedRequirements *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS; - out_ext->prefersDedicatedAllocation = in_ext->prefersDedicatedAllocation; - out_ext->requiresDedicatedAllocation = in_ext->requiresDedicatedAllocation; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkBufferCaptureDescriptorDataInfoEXT_win32_to_host(const VkBufferCaptureDescriptorDataInfoEXT32 *in, VkBufferCaptureDescriptorDataInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->buffer = in->buffer; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCalibratedTimestampInfoEXT_win32_to_host(const VkCalibratedTimestampInfoEXT32 *in, VkCalibratedTimestampInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->timeDomain = in->timeDomain; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkCalibratedTimestampInfoEXT *convert_VkCalibratedTimestampInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkCalibratedTimestampInfoEXT32 *in, uint32_t count) -{ - VkCalibratedTimestampInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCalibratedTimestampInfoEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDescriptorAddressInfoEXT_win32_to_host(const VkDescriptorAddressInfoEXT32 *in, VkDescriptorAddressInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->address = in->address; - out->range = in->range; - out->format = in->format; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkDescriptorAddressInfoEXT *convert_VkDescriptorAddressInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDescriptorAddressInfoEXT32 *in, uint32_t count) -{ - VkDescriptorAddressInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDescriptorAddressInfoEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDescriptorDataEXT_win32_to_host(struct conversion_context *ctx, const VkDescriptorDataEXT32 *in, VkDescriptorDataEXT *out, VkFlags selector) -{ - if (!in) return; - - if (selector == VK_DESCRIPTOR_TYPE_SAMPLER) - out->pSampler = (const VkSampler *)UlongToPtr(in->pSampler); - if (selector == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) - out->pCombinedImageSampler = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, (const VkDescriptorImageInfo32 *)UlongToPtr(in->pCombinedImageSampler), 1); - if (selector == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) - out->pInputAttachmentImage = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, (const VkDescriptorImageInfo32 *)UlongToPtr(in->pInputAttachmentImage), 1); - if (selector == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) - out->pSampledImage = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, (const VkDescriptorImageInfo32 *)UlongToPtr(in->pSampledImage), 1); - if (selector == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) - out->pStorageImage = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, (const VkDescriptorImageInfo32 *)UlongToPtr(in->pStorageImage), 1); - if (selector == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) - out->pUniformTexelBuffer = convert_VkDescriptorAddressInfoEXT_array_win32_to_host(ctx, (const VkDescriptorAddressInfoEXT32 *)UlongToPtr(in->pUniformTexelBuffer), 1); - if (selector == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER) - out->pStorageTexelBuffer = convert_VkDescriptorAddressInfoEXT_array_win32_to_host(ctx, (const VkDescriptorAddressInfoEXT32 *)UlongToPtr(in->pStorageTexelBuffer), 1); - if (selector == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) - out->pUniformBuffer = convert_VkDescriptorAddressInfoEXT_array_win32_to_host(ctx, (const VkDescriptorAddressInfoEXT32 *)UlongToPtr(in->pUniformBuffer), 1); - if (selector == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) - out->pStorageBuffer = convert_VkDescriptorAddressInfoEXT_array_win32_to_host(ctx, (const VkDescriptorAddressInfoEXT32 *)UlongToPtr(in->pStorageBuffer), 1); - if (selector == VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR || selector == VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV) - out->accelerationStructure = in->accelerationStructure; -} - -static inline void convert_VkDescriptorGetInfoEXT_win32_to_host(struct conversion_context *ctx, const VkDescriptorGetInfoEXT32 *in, VkDescriptorGetInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->type = in->type; - convert_VkDescriptorDataEXT_win32_to_host(ctx, &in->data, &out->data, in->type); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDescriptorSetBindingReferenceVALVE_win32_to_host(const VkDescriptorSetBindingReferenceVALVE32 *in, VkDescriptorSetBindingReferenceVALVE *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->descriptorSetLayout = in->descriptorSetLayout; - out->binding = in->binding; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDescriptorSetLayoutHostMappingInfoVALVE_win32_to_host(const VkDescriptorSetLayoutHostMappingInfoVALVE32 *in, VkDescriptorSetLayoutHostMappingInfoVALVE *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->descriptorOffset = in->descriptorOffset; - out->descriptorSize = in->descriptorSize; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDescriptorSetLayoutHostMappingInfoVALVE_host_to_win32(const VkDescriptorSetLayoutHostMappingInfoVALVE *in, VkDescriptorSetLayoutHostMappingInfoVALVE32 *out) -{ - if (!in) return; - - out->descriptorOffset = in->descriptorOffset; - out->descriptorSize = in->descriptorSize; -} - -static inline void convert_VkDescriptorSetLayoutSupport_win32_to_host(struct conversion_context *ctx, const VkDescriptorSetLayoutSupport32 *in, VkDescriptorSetLayoutSupport *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT: - { - VkDescriptorSetVariableDescriptorCountLayoutSupport *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkDescriptorSetLayoutSupport_host_to_win32(const VkDescriptorSetLayoutSupport *in, VkDescriptorSetLayoutSupport32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - out->supported = in->supported; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT: - { - VkDescriptorSetVariableDescriptorCountLayoutSupport32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT); - const VkDescriptorSetVariableDescriptorCountLayoutSupport *in_ext = (const VkDescriptorSetVariableDescriptorCountLayoutSupport *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT; - out_ext->maxVariableDescriptorCount = in_ext->maxVariableDescriptorCount; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkAccelerationStructureVersionInfoKHR_win32_to_host(const VkAccelerationStructureVersionInfoKHR32 *in, VkAccelerationStructureVersionInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pVersionData = (const uint8_t *)UlongToPtr(in->pVersionData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkBufferCreateInfo *convert_VkBufferCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkBufferCreateInfo32 *in, uint32_t count) -{ - VkBufferCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBufferCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDeviceBufferMemoryRequirements_win32_to_host(struct conversion_context *ctx, const VkDeviceBufferMemoryRequirements32 *in, VkDeviceBufferMemoryRequirements *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pCreateInfo = convert_VkBufferCreateInfo_array_win32_to_host(ctx, (const VkBufferCreateInfo32 *)UlongToPtr(in->pCreateInfo), 1); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDeviceFaultCountsEXT_win32_to_host(const VkDeviceFaultCountsEXT32 *in, VkDeviceFaultCountsEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->addressInfoCount = in->addressInfoCount; - out->vendorInfoCount = in->vendorInfoCount; - out->vendorBinarySize = in->vendorBinarySize; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDeviceFaultCountsEXT_host_to_win32(const VkDeviceFaultCountsEXT *in, VkDeviceFaultCountsEXT32 *out) -{ - if (!in) return; - - out->addressInfoCount = in->addressInfoCount; - out->vendorInfoCount = in->vendorInfoCount; - out->vendorBinarySize = in->vendorBinarySize; -} - -static inline void convert_VkDeviceFaultAddressInfoEXT_win32_to_host(const VkDeviceFaultAddressInfoEXT32 *in, VkDeviceFaultAddressInfoEXT *out) -{ - if (!in) return; - - out->addressType = in->addressType; - out->reportedAddress = in->reportedAddress; - out->addressPrecision = in->addressPrecision; -} - -static inline void convert_VkDeviceFaultAddressInfoEXT_host_to_win32(const VkDeviceFaultAddressInfoEXT *in, VkDeviceFaultAddressInfoEXT32 *out) -{ - if (!in) return; - - out->addressType = in->addressType; - out->reportedAddress = in->reportedAddress; - out->addressPrecision = in->addressPrecision; -} - -static inline VkDeviceFaultAddressInfoEXT *convert_VkDeviceFaultAddressInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultAddressInfoEXT32 *in, uint32_t count) -{ - VkDeviceFaultAddressInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDeviceFaultAddressInfoEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDeviceFaultAddressInfoEXT_array_host_to_win32(const VkDeviceFaultAddressInfoEXT *in, VkDeviceFaultAddressInfoEXT32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkDeviceFaultAddressInfoEXT_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkDeviceFaultVendorInfoEXT_win32_to_host(const VkDeviceFaultVendorInfoEXT32 *in, VkDeviceFaultVendorInfoEXT *out) -{ - if (!in) return; - - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - out->vendorFaultCode = in->vendorFaultCode; - out->vendorFaultData = in->vendorFaultData; -} - -static inline void convert_VkDeviceFaultVendorInfoEXT_host_to_win32(const VkDeviceFaultVendorInfoEXT *in, VkDeviceFaultVendorInfoEXT32 *out) -{ - if (!in) return; - - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - out->vendorFaultCode = in->vendorFaultCode; - out->vendorFaultData = in->vendorFaultData; -} - -static inline VkDeviceFaultVendorInfoEXT *convert_VkDeviceFaultVendorInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultVendorInfoEXT32 *in, uint32_t count) -{ - VkDeviceFaultVendorInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDeviceFaultVendorInfoEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDeviceFaultVendorInfoEXT_array_host_to_win32(const VkDeviceFaultVendorInfoEXT *in, VkDeviceFaultVendorInfoEXT32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkDeviceFaultVendorInfoEXT_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkDeviceFaultInfoEXT_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultInfoEXT32 *in, VkDeviceFaultInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - out->pAddressInfos = convert_VkDeviceFaultAddressInfoEXT_array_win32_to_host(ctx, (VkDeviceFaultAddressInfoEXT32 *)UlongToPtr(in->pAddressInfos), 1); - out->pVendorInfos = convert_VkDeviceFaultVendorInfoEXT_array_win32_to_host(ctx, (VkDeviceFaultVendorInfoEXT32 *)UlongToPtr(in->pVendorInfos), 1); - out->pVendorBinaryData = (void *)UlongToPtr(in->pVendorBinaryData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDeviceFaultInfoEXT_host_to_win32(const VkDeviceFaultInfoEXT *in, VkDeviceFaultInfoEXT32 *out) -{ - if (!in) return; - - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - convert_VkDeviceFaultAddressInfoEXT_array_host_to_win32(in->pAddressInfos, (VkDeviceFaultAddressInfoEXT32 *)UlongToPtr(out->pAddressInfos), 1); - convert_VkDeviceFaultVendorInfoEXT_array_host_to_win32(in->pVendorInfos, (VkDeviceFaultVendorInfoEXT32 *)UlongToPtr(out->pVendorInfos), 1); - out->pVendorBinaryData = PtrToUlong(in->pVendorBinaryData); -} - -static inline void convert_VkDeviceGroupPresentCapabilitiesKHR_win32_to_host(const VkDeviceGroupPresentCapabilitiesKHR32 *in, VkDeviceGroupPresentCapabilitiesKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDeviceGroupPresentCapabilitiesKHR_host_to_win32(const VkDeviceGroupPresentCapabilitiesKHR *in, VkDeviceGroupPresentCapabilitiesKHR32 *out) -{ - if (!in) return; - - memcpy(out->presentMask, in->presentMask, VK_MAX_DEVICE_GROUP_SIZE * sizeof(uint32_t)); - out->modes = in->modes; -} - -static inline const VkImageCreateInfo *convert_VkImageCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkImageCreateInfo32 *in, uint32_t count) -{ - VkImageCreateInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageCreateInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDeviceImageMemoryRequirements_win32_to_host(struct conversion_context *ctx, const VkDeviceImageMemoryRequirements32 *in, VkDeviceImageMemoryRequirements *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pCreateInfo = convert_VkImageCreateInfo_array_win32_to_host(ctx, (const VkImageCreateInfo32 *)UlongToPtr(in->pCreateInfo), 1); - out->planeAspect = in->planeAspect; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSparseImageMemoryRequirements_host_to_win32(const VkSparseImageMemoryRequirements *in, VkSparseImageMemoryRequirements32 *out) -{ - if (!in) return; - - out->formatProperties = in->formatProperties; - out->imageMipTailFirstLod = in->imageMipTailFirstLod; - out->imageMipTailSize = in->imageMipTailSize; - out->imageMipTailOffset = in->imageMipTailOffset; - out->imageMipTailStride = in->imageMipTailStride; -} - -static inline void convert_VkSparseImageMemoryRequirements2_win32_to_host(const VkSparseImageMemoryRequirements232 *in, VkSparseImageMemoryRequirements2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSparseImageMemoryRequirements2_host_to_win32(const VkSparseImageMemoryRequirements2 *in, VkSparseImageMemoryRequirements232 *out) -{ - if (!in) return; - - convert_VkSparseImageMemoryRequirements_host_to_win32(&in->memoryRequirements, &out->memoryRequirements); -} - -static inline VkSparseImageMemoryRequirements2 *convert_VkSparseImageMemoryRequirements2_array_win32_to_host(struct conversion_context *ctx, const VkSparseImageMemoryRequirements232 *in, uint32_t count) -{ - VkSparseImageMemoryRequirements2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryRequirements2_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSparseImageMemoryRequirements2_array_host_to_win32(const VkSparseImageMemoryRequirements2 *in, VkSparseImageMemoryRequirements232 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryRequirements2_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkImageSubresource2KHR_win32_to_host(const VkImageSubresource2KHR32 *in, VkImageSubresource2KHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->imageSubresource = in->imageSubresource; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkImageSubresource2KHR *convert_VkImageSubresource2KHR_array_win32_to_host(struct conversion_context *ctx, const VkImageSubresource2KHR32 *in, uint32_t count) -{ - VkImageSubresource2KHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkImageSubresource2KHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkDeviceImageSubresourceInfoKHR_win32_to_host(struct conversion_context *ctx, const VkDeviceImageSubresourceInfoKHR32 *in, VkDeviceImageSubresourceInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pCreateInfo = convert_VkImageCreateInfo_array_win32_to_host(ctx, (const VkImageCreateInfo32 *)UlongToPtr(in->pCreateInfo), 1); - out->pSubresource = convert_VkImageSubresource2KHR_array_win32_to_host(ctx, (const VkImageSubresource2KHR32 *)UlongToPtr(in->pSubresource), 1); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSubresourceLayout_win32_to_host(const VkSubresourceLayout32 *in, VkSubresourceLayout *out) -{ - if (!in) return; - - out->offset = in->offset; - out->size = in->size; - out->rowPitch = in->rowPitch; - out->arrayPitch = in->arrayPitch; - out->depthPitch = in->depthPitch; -} - -static inline void convert_VkSubresourceLayout_host_to_win32(const VkSubresourceLayout *in, VkSubresourceLayout32 *out) -{ - if (!in) return; - - out->offset = in->offset; - out->size = in->size; - out->rowPitch = in->rowPitch; - out->arrayPitch = in->arrayPitch; - out->depthPitch = in->depthPitch; -} - -static inline void convert_VkSubresourceLayout2KHR_win32_to_host(struct conversion_context *ctx, const VkSubresourceLayout2KHR32 *in, VkSubresourceLayout2KHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT: - { - VkSubresourceHostMemcpySizeEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: - { - VkImageCompressionPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSubresourceLayout2KHR_host_to_win32(const VkSubresourceLayout2KHR *in, VkSubresourceLayout2KHR32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - convert_VkSubresourceLayout_host_to_win32(&in->subresourceLayout, &out->subresourceLayout); - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT: - { - VkSubresourceHostMemcpySizeEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT); - const VkSubresourceHostMemcpySizeEXT *in_ext = (const VkSubresourceHostMemcpySizeEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT; - out_ext->size = in_ext->size; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: - { - VkImageCompressionPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT); - const VkImageCompressionPropertiesEXT *in_ext = (const VkImageCompressionPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; - out_ext->imageCompressionFlags = in_ext->imageCompressionFlags; - out_ext->imageCompressionFixedRateFlags = in_ext->imageCompressionFixedRateFlags; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -#ifdef _WIN64 -static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win64_to_host(const VkDeviceMemoryOpaqueCaptureAddressInfo *in, VkDeviceMemoryOpaqueCaptureAddressInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; -} -#endif /* _WIN64 */ - -static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win32_to_host(const VkDeviceMemoryOpaqueCaptureAddressInfo32 *in, VkDeviceMemoryOpaqueCaptureAddressInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->memory = wine_device_memory_from_handle(in->memory)->host_memory; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMicromapVersionInfoEXT_win32_to_host(const VkMicromapVersionInfoEXT32 *in, VkMicromapVersionInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pVersionData = (const uint8_t *)UlongToPtr(in->pVersionData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkDeviceQueueInfo2_win32_to_host(const VkDeviceQueueInfo232 *in, VkDeviceQueueInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->queueFamilyIndex = in->queueFamilyIndex; - out->queueIndex = in->queueIndex; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkTilePropertiesQCOM_win32_to_host(const VkTilePropertiesQCOM32 *in, VkTilePropertiesQCOM *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->tileSize = in->tileSize; - out->apronSize = in->apronSize; - out->origin = in->origin; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkTilePropertiesQCOM_host_to_win32(const VkTilePropertiesQCOM *in, VkTilePropertiesQCOM32 *out) -{ - if (!in) return; - - out->tileSize = in->tileSize; - out->apronSize = in->apronSize; - out->origin = in->origin; -} - -static inline VkTilePropertiesQCOM *convert_VkTilePropertiesQCOM_array_win32_to_host(struct conversion_context *ctx, const VkTilePropertiesQCOM32 *in, uint32_t count) -{ - VkTilePropertiesQCOM *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkTilePropertiesQCOM_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkTilePropertiesQCOM_array_host_to_win32(const VkTilePropertiesQCOM *in, VkTilePropertiesQCOM32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkTilePropertiesQCOM_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkGeneratedCommandsMemoryRequirementsInfoNV_win32_to_host(const VkGeneratedCommandsMemoryRequirementsInfoNV32 *in, VkGeneratedCommandsMemoryRequirementsInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pipelineBindPoint = in->pipelineBindPoint; - out->pipeline = in->pipeline; - out->indirectCommandsLayout = in->indirectCommandsLayout; - out->maxSequencesCount = in->maxSequencesCount; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkImageMemoryRequirementsInfo2_win32_to_host(struct conversion_context *ctx, const VkImageMemoryRequirementsInfo232 *in, VkImageMemoryRequirementsInfo2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->image = in->image; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO: - { - VkImagePlaneMemoryRequirementsInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImagePlaneMemoryRequirementsInfo32 *in_ext = (const VkImagePlaneMemoryRequirementsInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO; - out_ext->pNext = NULL; - out_ext->planeAspect = in_ext->planeAspect; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkImageCaptureDescriptorDataInfoEXT_win32_to_host(const VkImageCaptureDescriptorDataInfoEXT32 *in, VkImageCaptureDescriptorDataInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->image = in->image; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSparseImageMemoryRequirements_array_host_to_win32(const VkSparseImageMemoryRequirements *in, VkSparseImageMemoryRequirements32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryRequirements_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkImageSparseMemoryRequirementsInfo2_win32_to_host(const VkImageSparseMemoryRequirementsInfo232 *in, VkImageSparseMemoryRequirementsInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->image = in->image; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkImageViewAddressPropertiesNVX_win32_to_host(const VkImageViewAddressPropertiesNVX32 *in, VkImageViewAddressPropertiesNVX *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkImageViewAddressPropertiesNVX_host_to_win32(const VkImageViewAddressPropertiesNVX *in, VkImageViewAddressPropertiesNVX32 *out) -{ - if (!in) return; - - out->deviceAddress = in->deviceAddress; - out->size = in->size; -} - -static inline void convert_VkImageViewHandleInfoNVX_win32_to_host(const VkImageViewHandleInfoNVX32 *in, VkImageViewHandleInfoNVX *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->imageView = in->imageView; - out->descriptorType = in->descriptorType; - out->sampler = in->sampler; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkImageViewCaptureDescriptorDataInfoEXT_win32_to_host(const VkImageViewCaptureDescriptorDataInfoEXT32 *in, VkImageViewCaptureDescriptorDataInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->imageView = in->imageView; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkLatencyTimingsFrameReportNV_win32_to_host(const VkLatencyTimingsFrameReportNV32 *in, VkLatencyTimingsFrameReportNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->presentID = in->presentID; - out->inputSampleTimeUs = in->inputSampleTimeUs; - out->simStartTimeUs = in->simStartTimeUs; - out->simEndTimeUs = in->simEndTimeUs; - out->renderSubmitStartTimeUs = in->renderSubmitStartTimeUs; - out->renderSubmitEndTimeUs = in->renderSubmitEndTimeUs; - out->presentStartTimeUs = in->presentStartTimeUs; - out->presentEndTimeUs = in->presentEndTimeUs; - out->driverStartTimeUs = in->driverStartTimeUs; - out->driverEndTimeUs = in->driverEndTimeUs; - out->osRenderQueueStartTimeUs = in->osRenderQueueStartTimeUs; - out->osRenderQueueEndTimeUs = in->osRenderQueueEndTimeUs; - out->gpuRenderStartTimeUs = in->gpuRenderStartTimeUs; - out->gpuRenderEndTimeUs = in->gpuRenderEndTimeUs; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkLatencyTimingsFrameReportNV_host_to_win32(const VkLatencyTimingsFrameReportNV *in, VkLatencyTimingsFrameReportNV32 *out) -{ - if (!in) return; - - out->presentID = in->presentID; - out->inputSampleTimeUs = in->inputSampleTimeUs; - out->simStartTimeUs = in->simStartTimeUs; - out->simEndTimeUs = in->simEndTimeUs; - out->renderSubmitStartTimeUs = in->renderSubmitStartTimeUs; - out->renderSubmitEndTimeUs = in->renderSubmitEndTimeUs; - out->presentStartTimeUs = in->presentStartTimeUs; - out->presentEndTimeUs = in->presentEndTimeUs; - out->driverStartTimeUs = in->driverStartTimeUs; - out->driverEndTimeUs = in->driverEndTimeUs; - out->osRenderQueueStartTimeUs = in->osRenderQueueStartTimeUs; - out->osRenderQueueEndTimeUs = in->osRenderQueueEndTimeUs; - out->gpuRenderStartTimeUs = in->gpuRenderStartTimeUs; - out->gpuRenderEndTimeUs = in->gpuRenderEndTimeUs; -} - -static inline VkLatencyTimingsFrameReportNV *convert_VkLatencyTimingsFrameReportNV_array_win32_to_host(struct conversion_context *ctx, const VkLatencyTimingsFrameReportNV32 *in, uint32_t count) -{ - VkLatencyTimingsFrameReportNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkLatencyTimingsFrameReportNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkLatencyTimingsFrameReportNV_array_host_to_win32(const VkLatencyTimingsFrameReportNV *in, VkLatencyTimingsFrameReportNV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkLatencyTimingsFrameReportNV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkGetLatencyMarkerInfoNV_win32_to_host(struct conversion_context *ctx, const VkGetLatencyMarkerInfoNV32 *in, VkGetLatencyMarkerInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->timingCount = in->timingCount; - out->pTimings = convert_VkLatencyTimingsFrameReportNV_array_win32_to_host(ctx, (VkLatencyTimingsFrameReportNV32 *)UlongToPtr(in->pTimings), in->timingCount); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkGetLatencyMarkerInfoNV_host_to_win32(const VkGetLatencyMarkerInfoNV *in, VkGetLatencyMarkerInfoNV32 *out) -{ - if (!in) return; - - out->timingCount = in->timingCount; - convert_VkLatencyTimingsFrameReportNV_array_host_to_win32(in->pTimings, (VkLatencyTimingsFrameReportNV32 *)UlongToPtr(out->pTimings), in->timingCount); -} - -static inline void convert_VkMemoryHostPointerPropertiesEXT_win32_to_host(const VkMemoryHostPointerPropertiesEXT32 *in, VkMemoryHostPointerPropertiesEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryHostPointerPropertiesEXT_host_to_win32(const VkMemoryHostPointerPropertiesEXT *in, VkMemoryHostPointerPropertiesEXT32 *out) -{ - if (!in) return; - - out->memoryTypeBits = in->memoryTypeBits; -} - -static inline void convert_VkMicromapBuildSizesInfoEXT_win32_to_host(const VkMicromapBuildSizesInfoEXT32 *in, VkMicromapBuildSizesInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->micromapSize = in->micromapSize; - out->buildScratchSize = in->buildScratchSize; - out->discardable = in->discardable; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMicromapBuildSizesInfoEXT_host_to_win32(const VkMicromapBuildSizesInfoEXT *in, VkMicromapBuildSizesInfoEXT32 *out) -{ - if (!in) return; - - out->micromapSize = in->micromapSize; - out->buildScratchSize = in->buildScratchSize; - out->discardable = in->discardable; -} - -static inline void convert_VkPerformanceValueDataINTEL_win32_to_host(const VkPerformanceValueDataINTEL32 *in, VkPerformanceValueDataINTEL *out, VkFlags selector) -{ - if (!in) return; - - if (selector == VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL) - out->value32 = in->value32; - if (selector == VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL) - out->value64 = in->value64; - if (selector == VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL) - out->valueFloat = in->valueFloat; - if (selector == VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL) - out->valueBool = in->valueBool; - if (selector == VK_PERFORMANCE_VALUE_TYPE_STRING_INTEL) - out->valueString = (const char *)UlongToPtr(in->valueString); -} - -static inline void convert_VkPerformanceValueDataINTEL_host_to_win32(const VkPerformanceValueDataINTEL *in, VkPerformanceValueDataINTEL32 *out, VkFlags selector) -{ - if (!in) return; - - if (selector == VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL) - out->value32 = in->value32; - if (selector == VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL) - out->value64 = in->value64; - if (selector == VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL) - out->valueFloat = in->valueFloat; - if (selector == VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL) - out->valueBool = in->valueBool; -} - -static inline void convert_VkPerformanceValueINTEL_host_to_win32(const VkPerformanceValueINTEL *in, VkPerformanceValueINTEL32 *out) -{ - if (!in) return; - - out->type = in->type; - convert_VkPerformanceValueDataINTEL_host_to_win32(&in->data, &out->data, in->type); -} - -static inline void convert_VkCooperativeMatrixPropertiesKHR_win32_to_host(const VkCooperativeMatrixPropertiesKHR32 *in, VkCooperativeMatrixPropertiesKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->MSize = in->MSize; - out->NSize = in->NSize; - out->KSize = in->KSize; - out->AType = in->AType; - out->BType = in->BType; - out->CType = in->CType; - out->ResultType = in->ResultType; - out->saturatingAccumulation = in->saturatingAccumulation; - out->scope = in->scope; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCooperativeMatrixPropertiesKHR_host_to_win32(const VkCooperativeMatrixPropertiesKHR *in, VkCooperativeMatrixPropertiesKHR32 *out) -{ - if (!in) return; - - out->MSize = in->MSize; - out->NSize = in->NSize; - out->KSize = in->KSize; - out->AType = in->AType; - out->BType = in->BType; - out->CType = in->CType; - out->ResultType = in->ResultType; - out->saturatingAccumulation = in->saturatingAccumulation; - out->scope = in->scope; -} - -static inline VkCooperativeMatrixPropertiesKHR *convert_VkCooperativeMatrixPropertiesKHR_array_win32_to_host(struct conversion_context *ctx, const VkCooperativeMatrixPropertiesKHR32 *in, uint32_t count) -{ - VkCooperativeMatrixPropertiesKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCooperativeMatrixPropertiesKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCooperativeMatrixPropertiesKHR_array_host_to_win32(const VkCooperativeMatrixPropertiesKHR *in, VkCooperativeMatrixPropertiesKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkCooperativeMatrixPropertiesKHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkCooperativeMatrixPropertiesNV_win32_to_host(const VkCooperativeMatrixPropertiesNV32 *in, VkCooperativeMatrixPropertiesNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCooperativeMatrixPropertiesNV_host_to_win32(const VkCooperativeMatrixPropertiesNV *in, VkCooperativeMatrixPropertiesNV32 *out) -{ - if (!in) return; - - out->MSize = in->MSize; - out->NSize = in->NSize; - out->KSize = in->KSize; - out->AType = in->AType; - out->BType = in->BType; - out->CType = in->CType; - out->DType = in->DType; - out->scope = in->scope; -} - -static inline VkCooperativeMatrixPropertiesNV *convert_VkCooperativeMatrixPropertiesNV_array_win32_to_host(struct conversion_context *ctx, const VkCooperativeMatrixPropertiesNV32 *in, uint32_t count) -{ - VkCooperativeMatrixPropertiesNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCooperativeMatrixPropertiesNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCooperativeMatrixPropertiesNV_array_host_to_win32(const VkCooperativeMatrixPropertiesNV *in, VkCooperativeMatrixPropertiesNV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkCooperativeMatrixPropertiesNV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPhysicalDeviceExternalBufferInfo_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceExternalBufferInfo32 *in, VkPhysicalDeviceExternalBufferInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->usage = in->usage; - out->handleType = in->handleType; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR: - { - VkBufferUsageFlags2CreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkBufferUsageFlags2CreateInfoKHR32 *in_ext = (const VkBufferUsageFlags2CreateInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkExternalBufferProperties_win32_to_host(const VkExternalBufferProperties32 *in, VkExternalBufferProperties *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkExternalBufferProperties_host_to_win32(const VkExternalBufferProperties *in, VkExternalBufferProperties32 *out) -{ - if (!in) return; - - out->externalMemoryProperties = in->externalMemoryProperties; -} - -static inline void convert_VkPhysicalDeviceExternalFenceInfo_win32_to_host(const VkPhysicalDeviceExternalFenceInfo32 *in, VkPhysicalDeviceExternalFenceInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->handleType = in->handleType; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkExternalFenceProperties_win32_to_host(const VkExternalFenceProperties32 *in, VkExternalFenceProperties *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkExternalFenceProperties_host_to_win32(const VkExternalFenceProperties *in, VkExternalFenceProperties32 *out) -{ - if (!in) return; - - out->exportFromImportedHandleTypes = in->exportFromImportedHandleTypes; - out->compatibleHandleTypes = in->compatibleHandleTypes; - out->externalFenceFeatures = in->externalFenceFeatures; -} - -static inline void convert_VkPhysicalDeviceExternalSemaphoreInfo_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceExternalSemaphoreInfo32 *in, VkPhysicalDeviceExternalSemaphoreInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->handleType = in->handleType; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO: - { - VkSemaphoreTypeCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSemaphoreTypeCreateInfo32 *in_ext = (const VkSemaphoreTypeCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->semaphoreType = in_ext->semaphoreType; - out_ext->initialValue = in_ext->initialValue; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkExternalSemaphoreProperties_win32_to_host(const VkExternalSemaphoreProperties32 *in, VkExternalSemaphoreProperties *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkExternalSemaphoreProperties_host_to_win32(const VkExternalSemaphoreProperties *in, VkExternalSemaphoreProperties32 *out) -{ - if (!in) return; - - out->exportFromImportedHandleTypes = in->exportFromImportedHandleTypes; - out->compatibleHandleTypes = in->compatibleHandleTypes; - out->externalSemaphoreFeatures = in->externalSemaphoreFeatures; -} - -static inline void convert_VkPhysicalDeviceFeatures2_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceFeatures232 *in, VkPhysicalDeviceFeatures2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->features = in->features; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32 *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->deviceGeneratedCommands = in_ext->deviceGeneratedCommands; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32 *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->deviceGeneratedCompute = in_ext->deviceGeneratedCompute; - out_ext->deviceGeneratedComputePipelines = in_ext->deviceGeneratedComputePipelines; - out_ext->deviceGeneratedComputeCaptureReplay = in_ext->deviceGeneratedComputeCaptureReplay; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES: - { - VkPhysicalDevicePrivateDataFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrivateDataFeatures32 *in_ext = (const VkPhysicalDevicePrivateDataFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES; - out_ext->pNext = NULL; - out_ext->privateData = in_ext->privateData; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: - { - VkPhysicalDeviceVariablePointersFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVariablePointersFeatures32 *in_ext = (const VkPhysicalDeviceVariablePointersFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES; - out_ext->pNext = NULL; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: - { - VkPhysicalDeviceMultiviewFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewFeatures32 *in_ext = (const VkPhysicalDeviceMultiviewFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; - out_ext->pNext = NULL; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR: - { - VkPhysicalDevicePresentIdFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentIdFeaturesKHR32 *in_ext = (const VkPhysicalDevicePresentIdFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->presentId = in_ext->presentId; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR: - { - VkPhysicalDevicePresentWaitFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentWaitFeaturesKHR32 *in_ext = (const VkPhysicalDevicePresentWaitFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->presentWait = in_ext->presentWait; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: - { - VkPhysicalDevice16BitStorageFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice16BitStorageFeatures32 *in_ext = (const VkPhysicalDevice16BitStorageFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES: - { - VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 *in_ext = (const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: - { - VkPhysicalDeviceSamplerYcbcrConversionFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSamplerYcbcrConversionFeatures32 *in_ext = (const VkPhysicalDeviceSamplerYcbcrConversionFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES; - out_ext->pNext = NULL; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: - { - VkPhysicalDeviceProtectedMemoryFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceProtectedMemoryFeatures32 *in_ext = (const VkPhysicalDeviceProtectedMemoryFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES; - out_ext->pNext = NULL; - out_ext->protectedMemory = in_ext->protectedMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT: - { - VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32 *in_ext = (const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->advancedBlendCoherentOperations = in_ext->advancedBlendCoherentOperations; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT: - { - VkPhysicalDeviceMultiDrawFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiDrawFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMultiDrawFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->multiDraw = in_ext->multiDraw; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES: - { - VkPhysicalDeviceInlineUniformBlockFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInlineUniformBlockFeatures32 *in_ext = (const VkPhysicalDeviceInlineUniformBlockFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES; - out_ext->pNext = NULL; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES: - { - VkPhysicalDeviceMaintenance4Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMaintenance4Features32 *in_ext = (const VkPhysicalDeviceMaintenance4Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES; - out_ext->pNext = NULL; - out_ext->maintenance4 = in_ext->maintenance4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR: - { - VkPhysicalDeviceMaintenance5FeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMaintenance5FeaturesKHR32 *in_ext = (const VkPhysicalDeviceMaintenance5FeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->maintenance5 = in_ext->maintenance5; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: - { - VkPhysicalDeviceShaderDrawParametersFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderDrawParametersFeatures32 *in_ext = (const VkPhysicalDeviceShaderDrawParametersFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: - { - VkPhysicalDeviceShaderFloat16Int8Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderFloat16Int8Features32 *in_ext = (const VkPhysicalDeviceShaderFloat16Int8Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES: - { - VkPhysicalDeviceHostQueryResetFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostQueryResetFeatures32 *in_ext = (const VkPhysicalDeviceHostQueryResetFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES; - out_ext->pNext = NULL; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 *in_ext = (const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->globalPriorityQuery = in_ext->globalPriorityQuery; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES: - { - VkPhysicalDeviceDescriptorIndexingFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorIndexingFeatures32 *in_ext = (const VkPhysicalDeviceDescriptorIndexingFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: - { - VkPhysicalDeviceTimelineSemaphoreFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTimelineSemaphoreFeatures32 *in_ext = (const VkPhysicalDeviceTimelineSemaphoreFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES; - out_ext->pNext = NULL; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: - { - VkPhysicalDevice8BitStorageFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice8BitStorageFeatures32 *in_ext = (const VkPhysicalDevice8BitStorageFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: - { - VkPhysicalDeviceConditionalRenderingFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceConditionalRenderingFeaturesEXT32 *in_ext = (const VkPhysicalDeviceConditionalRenderingFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->conditionalRendering = in_ext->conditionalRendering; - out_ext->inheritedConditionalRendering = in_ext->inheritedConditionalRendering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES: - { - VkPhysicalDeviceVulkanMemoryModelFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkanMemoryModelFeatures32 *in_ext = (const VkPhysicalDeviceVulkanMemoryModelFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES; - out_ext->pNext = NULL; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES: - { - VkPhysicalDeviceShaderAtomicInt64Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicInt64Features32 *in_ext = (const VkPhysicalDeviceShaderAtomicInt64Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderBufferFloat32Atomics = in_ext->shaderBufferFloat32Atomics; - out_ext->shaderBufferFloat32AtomicAdd = in_ext->shaderBufferFloat32AtomicAdd; - out_ext->shaderBufferFloat64Atomics = in_ext->shaderBufferFloat64Atomics; - out_ext->shaderBufferFloat64AtomicAdd = in_ext->shaderBufferFloat64AtomicAdd; - out_ext->shaderSharedFloat32Atomics = in_ext->shaderSharedFloat32Atomics; - out_ext->shaderSharedFloat32AtomicAdd = in_ext->shaderSharedFloat32AtomicAdd; - out_ext->shaderSharedFloat64Atomics = in_ext->shaderSharedFloat64Atomics; - out_ext->shaderSharedFloat64AtomicAdd = in_ext->shaderSharedFloat64AtomicAdd; - out_ext->shaderImageFloat32Atomics = in_ext->shaderImageFloat32Atomics; - out_ext->shaderImageFloat32AtomicAdd = in_ext->shaderImageFloat32AtomicAdd; - out_ext->sparseImageFloat32Atomics = in_ext->sparseImageFloat32Atomics; - out_ext->sparseImageFloat32AtomicAdd = in_ext->sparseImageFloat32AtomicAdd; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderBufferFloat16Atomics = in_ext->shaderBufferFloat16Atomics; - out_ext->shaderBufferFloat16AtomicAdd = in_ext->shaderBufferFloat16AtomicAdd; - out_ext->shaderBufferFloat16AtomicMinMax = in_ext->shaderBufferFloat16AtomicMinMax; - out_ext->shaderBufferFloat32AtomicMinMax = in_ext->shaderBufferFloat32AtomicMinMax; - out_ext->shaderBufferFloat64AtomicMinMax = in_ext->shaderBufferFloat64AtomicMinMax; - out_ext->shaderSharedFloat16Atomics = in_ext->shaderSharedFloat16Atomics; - out_ext->shaderSharedFloat16AtomicAdd = in_ext->shaderSharedFloat16AtomicAdd; - out_ext->shaderSharedFloat16AtomicMinMax = in_ext->shaderSharedFloat16AtomicMinMax; - out_ext->shaderSharedFloat32AtomicMinMax = in_ext->shaderSharedFloat32AtomicMinMax; - out_ext->shaderSharedFloat64AtomicMinMax = in_ext->shaderSharedFloat64AtomicMinMax; - out_ext->shaderImageFloat32AtomicMinMax = in_ext->shaderImageFloat32AtomicMinMax; - out_ext->sparseImageFloat32AtomicMinMax = in_ext->sparseImageFloat32AtomicMinMax; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: - { - VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32 *in_ext = (const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->vertexAttributeInstanceRateDivisor = in_ext->vertexAttributeInstanceRateDivisor; - out_ext->vertexAttributeInstanceRateZeroDivisor = in_ext->vertexAttributeInstanceRateZeroDivisor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT: - { - VkPhysicalDeviceASTCDecodeFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceASTCDecodeFeaturesEXT32 *in_ext = (const VkPhysicalDeviceASTCDecodeFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->decodeModeSharedExponent = in_ext->decodeModeSharedExponent; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceTransformFeedbackFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTransformFeedbackFeaturesEXT32 *in_ext = (const VkPhysicalDeviceTransformFeedbackFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->transformFeedback = in_ext->transformFeedback; - out_ext->geometryStreams = in_ext->geometryStreams; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV: - { - VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32 *in_ext = (const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->representativeFragmentTest = in_ext->representativeFragmentTest; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceExclusiveScissorFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExclusiveScissorFeaturesNV32 *in_ext = (const VkPhysicalDeviceExclusiveScissorFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->exclusiveScissor = in_ext->exclusiveScissor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceCornerSampledImageFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCornerSampledImageFeaturesNV32 *in_ext = (const VkPhysicalDeviceCornerSampledImageFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cornerSampledImage = in_ext->cornerSampledImage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: - { - VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32 *in_ext = (const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->computeDerivativeGroupQuads = in_ext->computeDerivativeGroupQuads; - out_ext->computeDerivativeGroupLinear = in_ext->computeDerivativeGroupLinear; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV: - { - VkPhysicalDeviceShaderImageFootprintFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderImageFootprintFeaturesNV32 *in_ext = (const VkPhysicalDeviceShaderImageFootprintFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->imageFootprint = in_ext->imageFootprint; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV: - { - VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32 *in_ext = (const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->dedicatedAllocationImageAliasing = in_ext->dedicatedAllocationImageAliasing; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV: - { - VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32 *in_ext = (const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->indirectCopy = in_ext->indirectCopy; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV: - { - VkPhysicalDeviceMemoryDecompressionFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMemoryDecompressionFeaturesNV32 *in_ext = (const VkPhysicalDeviceMemoryDecompressionFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->memoryDecompression = in_ext->memoryDecompression; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceShadingRateImageFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShadingRateImageFeaturesNV32 *in_ext = (const VkPhysicalDeviceShadingRateImageFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->shadingRateImage = in_ext->shadingRateImage; - out_ext->shadingRateCoarseSampleOrder = in_ext->shadingRateCoarseSampleOrder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI: - { - VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32 *in_ext = (const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->invocationMask = in_ext->invocationMask; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV: - { - VkPhysicalDeviceMeshShaderFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMeshShaderFeaturesNV32 *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT: - { - VkPhysicalDeviceMeshShaderFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMeshShaderFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_ext->multiviewMeshShader = in_ext->multiviewMeshShader; - out_ext->primitiveFragmentShadingRateMeshShader = in_ext->primitiveFragmentShadingRateMeshShader; - out_ext->meshShaderQueries = in_ext->meshShaderQueries; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR: - { - VkPhysicalDeviceAccelerationStructureFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAccelerationStructureFeaturesKHR32 *in_ext = (const VkPhysicalDeviceAccelerationStructureFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->accelerationStructure = in_ext->accelerationStructure; - out_ext->accelerationStructureCaptureReplay = in_ext->accelerationStructureCaptureReplay; - out_ext->accelerationStructureIndirectBuild = in_ext->accelerationStructureIndirectBuild; - out_ext->accelerationStructureHostCommands = in_ext->accelerationStructureHostCommands; - out_ext->descriptorBindingAccelerationStructureUpdateAfterBind = in_ext->descriptorBindingAccelerationStructureUpdateAfterBind; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPipelineFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingPipelineFeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayTracingPipelineFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingPipeline = in_ext->rayTracingPipeline; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplay = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplay; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - out_ext->rayTracingPipelineTraceRaysIndirect = in_ext->rayTracingPipelineTraceRaysIndirect; - out_ext->rayTraversalPrimitiveCulling = in_ext->rayTraversalPrimitiveCulling; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceRayQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayQueryFeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayQueryFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayQuery = in_ext->rayQuery; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingMaintenance1 = in_ext->rayTracingMaintenance1; - out_ext->rayTracingPipelineTraceRaysIndirect2 = in_ext->rayTracingPipelineTraceRaysIndirect2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMapFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFragmentDensityMapFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMap = in_ext->fragmentDensityMap; - out_ext->fragmentDensityMapDynamic = in_ext->fragmentDensityMapDynamic; - out_ext->fragmentDensityMapNonSubsampledImages = in_ext->fragmentDensityMapNonSubsampledImages; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapDeferred = in_ext->fragmentDensityMapDeferred; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM: - { - VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->fragmentDensityMapOffset = in_ext->fragmentDensityMapOffset; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES: - { - VkPhysicalDeviceScalarBlockLayoutFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceScalarBlockLayoutFeatures32 *in_ext = (const VkPhysicalDeviceScalarBlockLayoutFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES; - out_ext->pNext = NULL; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES: - { - VkPhysicalDeviceUniformBufferStandardLayoutFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 *in_ext = (const VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES; - out_ext->pNext = NULL; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipEnableFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClipEnableFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthClipEnableFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClipEnable = in_ext->depthClipEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT: - { - VkPhysicalDeviceMemoryPriorityFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMemoryPriorityFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMemoryPriorityFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->memoryPriority = in_ext->memoryPriority; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT: - { - VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32 *in_ext = (const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pageableDeviceLocalMemory = in_ext->pageableDeviceLocalMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES: - { - VkPhysicalDeviceBufferDeviceAddressFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBufferDeviceAddressFeatures32 *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES; - out_ext->pNext = NULL; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT: - { - VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES: - { - VkPhysicalDeviceImagelessFramebufferFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImagelessFramebufferFeatures32 *in_ext = (const VkPhysicalDeviceImagelessFramebufferFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES; - out_ext->pNext = NULL; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES: - { - VkPhysicalDeviceTextureCompressionASTCHDRFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 *in_ext = (const VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES; - out_ext->pNext = NULL; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV: - { - VkPhysicalDeviceCooperativeMatrixFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCooperativeMatrixFeaturesNV32 *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32 *in_ext = (const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->ycbcrImageArrays = in_ext->ycbcrImageArrays; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV: - { - VkPhysicalDevicePresentBarrierFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePresentBarrierFeaturesNV32 *in_ext = (const VkPhysicalDevicePresentBarrierFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->presentBarrier = in_ext->presentBarrier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR: - { - VkPhysicalDevicePerformanceQueryFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePerformanceQueryFeaturesKHR32 *in_ext = (const VkPhysicalDevicePerformanceQueryFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->performanceCounterQueryPools = in_ext->performanceCounterQueryPools; - out_ext->performanceCounterMultipleQueryPools = in_ext->performanceCounterMultipleQueryPools; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV: - { - VkPhysicalDeviceCoverageReductionModeFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCoverageReductionModeFeaturesNV32 *in_ext = (const VkPhysicalDeviceCoverageReductionModeFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->coverageReductionMode = in_ext->coverageReductionMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL: - { - VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32 *in_ext = (const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL; - out_ext->pNext = NULL; - out_ext->shaderIntegerFunctions2 = in_ext->shaderIntegerFunctions2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR: - { - VkPhysicalDeviceShaderClockFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderClockFeaturesKHR32 *in_ext = (const VkPhysicalDeviceShaderClockFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->shaderSubgroupClock = in_ext->shaderSubgroupClock; - out_ext->shaderDeviceClock = in_ext->shaderDeviceClock; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT: - { - VkPhysicalDeviceIndexTypeUint8FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceIndexTypeUint8FeaturesEXT32 *in_ext = (const VkPhysicalDeviceIndexTypeUint8FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->indexTypeUint8 = in_ext->indexTypeUint8; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV: - { - VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32 *in_ext = (const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->shaderSMBuiltins = in_ext->shaderSMBuiltins; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT: - { - VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->fragmentShaderSampleInterlock = in_ext->fragmentShaderSampleInterlock; - out_ext->fragmentShaderPixelInterlock = in_ext->fragmentShaderPixelInterlock; - out_ext->fragmentShaderShadingRateInterlock = in_ext->fragmentShaderShadingRateInterlock; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES: - { - VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 *in_ext = (const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES; - out_ext->pNext = NULL; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT: - { - VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32 *in_ext = (const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->primitiveTopologyListRestart = in_ext->primitiveTopologyListRestart; - out_ext->primitiveTopologyPatchListRestart = in_ext->primitiveTopologyPatchListRestart; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR: - { - VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32 *in_ext = (const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->pipelineExecutableInfo = in_ext->pipelineExecutableInfo; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 *in_ext = (const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT: - { - VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32 *in_ext = (const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->texelBufferAlignment = in_ext->texelBufferAlignment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES: - { - VkPhysicalDeviceSubgroupSizeControlFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubgroupSizeControlFeatures32 *in_ext = (const VkPhysicalDeviceSubgroupSizeControlFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES; - out_ext->pNext = NULL; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: - { - VkPhysicalDeviceLineRasterizationFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLineRasterizationFeaturesEXT32 *in_ext = (const VkPhysicalDeviceLineRasterizationFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->rectangularLines = in_ext->rectangularLines; - out_ext->bresenhamLines = in_ext->bresenhamLines; - out_ext->smoothLines = in_ext->smoothLines; - out_ext->stippledRectangularLines = in_ext->stippledRectangularLines; - out_ext->stippledBresenhamLines = in_ext->stippledBresenhamLines; - out_ext->stippledSmoothLines = in_ext->stippledSmoothLines; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES: - { - VkPhysicalDevicePipelineCreationCacheControlFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineCreationCacheControlFeatures32 *in_ext = (const VkPhysicalDevicePipelineCreationCacheControlFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES; - out_ext->pNext = NULL; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: - { - VkPhysicalDeviceVulkan11Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan11Features32 *in_ext = (const VkPhysicalDeviceVulkan11Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; - out_ext->pNext = NULL; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_ext->protectedMemory = in_ext->protectedMemory; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES: - { - VkPhysicalDeviceVulkan12Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan12Features32 *in_ext = (const VkPhysicalDeviceVulkan12Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; - out_ext->pNext = NULL; - out_ext->samplerMirrorClampToEdge = in_ext->samplerMirrorClampToEdge; - out_ext->drawIndirectCount = in_ext->drawIndirectCount; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_ext->descriptorIndexing = in_ext->descriptorIndexing; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_ext->samplerFilterMinmax = in_ext->samplerFilterMinmax; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_ext->shaderOutputViewportIndex = in_ext->shaderOutputViewportIndex; - out_ext->shaderOutputLayer = in_ext->shaderOutputLayer; - out_ext->subgroupBroadcastDynamicId = in_ext->subgroupBroadcastDynamicId; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES: - { - VkPhysicalDeviceVulkan13Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVulkan13Features32 *in_ext = (const VkPhysicalDeviceVulkan13Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; - out_ext->pNext = NULL; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_ext->privateData = in_ext->privateData; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_ext->synchronization2 = in_ext->synchronization2; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_ext->maintenance4 = in_ext->maintenance4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD: - { - VkPhysicalDeviceCoherentMemoryFeaturesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCoherentMemoryFeaturesAMD32 *in_ext = (const VkPhysicalDeviceCoherentMemoryFeaturesAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD; - out_ext->pNext = NULL; - out_ext->deviceCoherentMemory = in_ext->deviceCoherentMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT: - { - VkPhysicalDeviceCustomBorderColorFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCustomBorderColorFeaturesEXT32 *in_ext = (const VkPhysicalDeviceCustomBorderColorFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->customBorderColors = in_ext->customBorderColors; - out_ext->customBorderColorWithoutFormat = in_ext->customBorderColorWithoutFormat; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT: - { - VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32 *in_ext = (const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->borderColorSwizzle = in_ext->borderColorSwizzle; - out_ext->borderColorSwizzleFromImage = in_ext->borderColorSwizzleFromImage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState = in_ext->extendedDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState2 = in_ext->extendedDynamicState2; - out_ext->extendedDynamicState2LogicOp = in_ext->extendedDynamicState2LogicOp; - out_ext->extendedDynamicState2PatchControlPoints = in_ext->extendedDynamicState2PatchControlPoints; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->extendedDynamicState3TessellationDomainOrigin = in_ext->extendedDynamicState3TessellationDomainOrigin; - out_ext->extendedDynamicState3DepthClampEnable = in_ext->extendedDynamicState3DepthClampEnable; - out_ext->extendedDynamicState3PolygonMode = in_ext->extendedDynamicState3PolygonMode; - out_ext->extendedDynamicState3RasterizationSamples = in_ext->extendedDynamicState3RasterizationSamples; - out_ext->extendedDynamicState3SampleMask = in_ext->extendedDynamicState3SampleMask; - out_ext->extendedDynamicState3AlphaToCoverageEnable = in_ext->extendedDynamicState3AlphaToCoverageEnable; - out_ext->extendedDynamicState3AlphaToOneEnable = in_ext->extendedDynamicState3AlphaToOneEnable; - out_ext->extendedDynamicState3LogicOpEnable = in_ext->extendedDynamicState3LogicOpEnable; - out_ext->extendedDynamicState3ColorBlendEnable = in_ext->extendedDynamicState3ColorBlendEnable; - out_ext->extendedDynamicState3ColorBlendEquation = in_ext->extendedDynamicState3ColorBlendEquation; - out_ext->extendedDynamicState3ColorWriteMask = in_ext->extendedDynamicState3ColorWriteMask; - out_ext->extendedDynamicState3RasterizationStream = in_ext->extendedDynamicState3RasterizationStream; - out_ext->extendedDynamicState3ConservativeRasterizationMode = in_ext->extendedDynamicState3ConservativeRasterizationMode; - out_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize = in_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize; - out_ext->extendedDynamicState3DepthClipEnable = in_ext->extendedDynamicState3DepthClipEnable; - out_ext->extendedDynamicState3SampleLocationsEnable = in_ext->extendedDynamicState3SampleLocationsEnable; - out_ext->extendedDynamicState3ColorBlendAdvanced = in_ext->extendedDynamicState3ColorBlendAdvanced; - out_ext->extendedDynamicState3ProvokingVertexMode = in_ext->extendedDynamicState3ProvokingVertexMode; - out_ext->extendedDynamicState3LineRasterizationMode = in_ext->extendedDynamicState3LineRasterizationMode; - out_ext->extendedDynamicState3LineStippleEnable = in_ext->extendedDynamicState3LineStippleEnable; - out_ext->extendedDynamicState3DepthClipNegativeOneToOne = in_ext->extendedDynamicState3DepthClipNegativeOneToOne; - out_ext->extendedDynamicState3ViewportWScalingEnable = in_ext->extendedDynamicState3ViewportWScalingEnable; - out_ext->extendedDynamicState3ViewportSwizzle = in_ext->extendedDynamicState3ViewportSwizzle; - out_ext->extendedDynamicState3CoverageToColorEnable = in_ext->extendedDynamicState3CoverageToColorEnable; - out_ext->extendedDynamicState3CoverageToColorLocation = in_ext->extendedDynamicState3CoverageToColorLocation; - out_ext->extendedDynamicState3CoverageModulationMode = in_ext->extendedDynamicState3CoverageModulationMode; - out_ext->extendedDynamicState3CoverageModulationTableEnable = in_ext->extendedDynamicState3CoverageModulationTableEnable; - out_ext->extendedDynamicState3CoverageModulationTable = in_ext->extendedDynamicState3CoverageModulationTable; - out_ext->extendedDynamicState3CoverageReductionMode = in_ext->extendedDynamicState3CoverageReductionMode; - out_ext->extendedDynamicState3RepresentativeFragmentTestEnable = in_ext->extendedDynamicState3RepresentativeFragmentTestEnable; - out_ext->extendedDynamicState3ShadingRateImageEnable = in_ext->extendedDynamicState3ShadingRateImageEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV: - { - VkPhysicalDeviceDiagnosticsConfigFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDiagnosticsConfigFeaturesNV32 *in_ext = (const VkPhysicalDeviceDiagnosticsConfigFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->diagnosticsConfig = in_ext->diagnosticsConfig; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES: - { - VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 *in_ext = (const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR: - { - VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32 *in_ext = (const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->shaderSubgroupUniformControlFlow = in_ext->shaderSubgroupUniformControlFlow; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: - { - VkPhysicalDeviceRobustness2FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRobustness2FeaturesEXT32 *in_ext = (const VkPhysicalDeviceRobustness2FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->robustBufferAccess2 = in_ext->robustBufferAccess2; - out_ext->robustImageAccess2 = in_ext->robustImageAccess2; - out_ext->nullDescriptor = in_ext->nullDescriptor; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES: - { - VkPhysicalDeviceImageRobustnessFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageRobustnessFeatures32 *in_ext = (const VkPhysicalDeviceImageRobustnessFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES; - out_ext->pNext = NULL; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR: - { - VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32 *in_ext = (const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->workgroupMemoryExplicitLayout = in_ext->workgroupMemoryExplicitLayout; - out_ext->workgroupMemoryExplicitLayoutScalarBlockLayout = in_ext->workgroupMemoryExplicitLayoutScalarBlockLayout; - out_ext->workgroupMemoryExplicitLayout8BitAccess = in_ext->workgroupMemoryExplicitLayout8BitAccess; - out_ext->workgroupMemoryExplicitLayout16BitAccess = in_ext->workgroupMemoryExplicitLayout16BitAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT: - { - VkPhysicalDevice4444FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevice4444FormatsFeaturesEXT32 *in_ext = (const VkPhysicalDevice4444FormatsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->formatA4R4G4B4 = in_ext->formatA4R4G4B4; - out_ext->formatA4B4G4R4 = in_ext->formatA4B4G4R4; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI: - { - VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32 *in_ext = (const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->subpassShading = in_ext->subpassShading; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI: - { - VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32 *in_ext = (const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI; - out_ext->pNext = NULL; - out_ext->clustercullingShader = in_ext->clustercullingShader; - out_ext->multiviewClusterCullingShader = in_ext->multiviewClusterCullingShader; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT: - { - VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderImageInt64Atomics = in_ext->shaderImageInt64Atomics; - out_ext->sparseImageInt64Atomics = in_ext->sparseImageInt64Atomics; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShadingRateFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateFeaturesKHR32 *in_ext = (const VkPhysicalDeviceFragmentShadingRateFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->pipelineFragmentShadingRate = in_ext->pipelineFragmentShadingRate; - out_ext->primitiveFragmentShadingRate = in_ext->primitiveFragmentShadingRate; - out_ext->attachmentFragmentShadingRate = in_ext->attachmentFragmentShadingRate; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderTerminateInvocationFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderTerminateInvocationFeatures32 *in_ext = (const VkPhysicalDeviceShaderTerminateInvocationFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV: - { - VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32 *in_ext = (const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->fragmentShadingRateEnums = in_ext->fragmentShadingRateEnums; - out_ext->supersampleFragmentShadingRates = in_ext->supersampleFragmentShadingRates; - out_ext->noInvocationFragmentShadingRates = in_ext->noInvocationFragmentShadingRates; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->image2DViewOf3D = in_ext->image2DViewOf3D; - out_ext->sampler2DViewOf3D = in_ext->sampler2DViewOf3D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageSlicedViewOf3D = in_ext->imageSlicedViewOf3D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32 *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->attachmentFeedbackLoopDynamicState = in_ext->attachmentFeedbackLoopDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT: - { - VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->mutableDescriptorType = in_ext->mutableDescriptorType; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClipControlFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthClipControlFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClipControl = in_ext->depthClipControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32 *in_ext = (const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->vertexInputDynamicState = in_ext->vertexInputDynamicState; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceColorWriteEnableFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceColorWriteEnableFeaturesEXT32 *in_ext = (const VkPhysicalDeviceColorWriteEnableFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->colorWriteEnable = in_ext->colorWriteEnable; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES: - { - VkPhysicalDeviceSynchronization2Features *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSynchronization2Features32 *in_ext = (const VkPhysicalDeviceSynchronization2Features32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES; - out_ext->pNext = NULL; - out_ext->synchronization2 = in_ext->synchronization2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT: - { - VkPhysicalDeviceHostImageCopyFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostImageCopyFeaturesEXT32 *in_ext = (const VkPhysicalDeviceHostImageCopyFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->hostImageCopy = in_ext->hostImageCopy; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT: - { - VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32 *in_ext = (const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->primitivesGeneratedQuery = in_ext->primitivesGeneratedQuery; - out_ext->primitivesGeneratedQueryWithRasterizerDiscard = in_ext->primitivesGeneratedQueryWithRasterizerDiscard; - out_ext->primitivesGeneratedQueryWithNonZeroStreams = in_ext->primitivesGeneratedQueryWithNonZeroStreams; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT: - { - VkPhysicalDeviceLegacyDitheringFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLegacyDitheringFeaturesEXT32 *in_ext = (const VkPhysicalDeviceLegacyDitheringFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->legacyDithering = in_ext->legacyDithering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT: - { - VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32 *in_ext = (const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->multisampledRenderToSingleSampled = in_ext->multisampledRenderToSingleSampled; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineProtectedAccess = in_ext->pipelineProtectedAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceInheritedViewportScissorFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceInheritedViewportScissorFeaturesNV32 *in_ext = (const VkPhysicalDeviceInheritedViewportScissorFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->inheritedViewportScissor2D = in_ext->inheritedViewportScissor2D; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32 *in_ext = (const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->ycbcr2plane444Formats = in_ext->ycbcr2plane444Formats; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: - { - VkPhysicalDeviceProvokingVertexFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceProvokingVertexFeaturesEXT32 *in_ext = (const VkPhysicalDeviceProvokingVertexFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->provokingVertexLast = in_ext->provokingVertexLast; - out_ext->transformFeedbackPreservesProvokingVertex = in_ext->transformFeedbackPreservesProvokingVertex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceDescriptorBufferFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorBufferFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDescriptorBufferFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->descriptorBuffer = in_ext->descriptorBuffer; - out_ext->descriptorBufferCaptureReplay = in_ext->descriptorBufferCaptureReplay; - out_ext->descriptorBufferImageLayoutIgnored = in_ext->descriptorBufferImageLayoutIgnored; - out_ext->descriptorBufferPushDescriptors = in_ext->descriptorBufferPushDescriptors; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES: - { - VkPhysicalDeviceShaderIntegerDotProductFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderIntegerDotProductFeatures32 *in_ext = (const VkPhysicalDeviceShaderIntegerDotProductFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES; - out_ext->pNext = NULL; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 *in_ext = (const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->fragmentShaderBarycentric = in_ext->fragmentShaderBarycentric; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV: - { - VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32 *in_ext = (const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->rayTracingMotionBlur = in_ext->rayTracingMotionBlur; - out_ext->rayTracingMotionBlurPipelineTraceRaysIndirect = in_ext->rayTracingMotionBlurPipelineTraceRaysIndirect; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32 *in_ext = (const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->formatRgba10x6WithoutYCbCrSampler = in_ext->formatRgba10x6WithoutYCbCrSampler; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES: - { - VkPhysicalDeviceDynamicRenderingFeatures *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDynamicRenderingFeatures32 *in_ext = (const VkPhysicalDeviceDynamicRenderingFeatures32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES; - out_ext->pNext = NULL; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT: - { - VkPhysicalDeviceImageViewMinLodFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageViewMinLodFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageViewMinLodFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->minLod = in_ext->minLod; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT: - { - VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 *in_ext = (const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->rasterizationOrderColorAttachmentAccess = in_ext->rasterizationOrderColorAttachmentAccess; - out_ext->rasterizationOrderDepthAttachmentAccess = in_ext->rasterizationOrderDepthAttachmentAccess; - out_ext->rasterizationOrderStencilAttachmentAccess = in_ext->rasterizationOrderStencilAttachmentAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV: - { - VkPhysicalDeviceLinearColorAttachmentFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceLinearColorAttachmentFeaturesNV32 *in_ext = (const VkPhysicalDeviceLinearColorAttachmentFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->linearColorAttachment = in_ext->linearColorAttachment; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT: - { - VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32 *in_ext = (const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->graphicsPipelineLibrary = in_ext->graphicsPipelineLibrary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE: - { - VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32 *in_ext = (const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE; - out_ext->pNext = NULL; - out_ext->descriptorSetHostMapping = in_ext->descriptorSetHostMapping; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceNestedCommandBufferFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNestedCommandBufferFeaturesEXT32 *in_ext = (const VkPhysicalDeviceNestedCommandBufferFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->nestedCommandBuffer = in_ext->nestedCommandBuffer; - out_ext->nestedCommandBufferRendering = in_ext->nestedCommandBufferRendering; - out_ext->nestedCommandBufferSimultaneousUse = in_ext->nestedCommandBufferSimultaneousUse; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT: - { - VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderModuleIdentifier = in_ext->shaderModuleIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageCompressionControlFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageCompressionControlFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageCompressionControl = in_ext->imageCompressionControl; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32 *in_ext = (const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->imageCompressionControlSwapchain = in_ext->imageCompressionControlSwapchain; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32 *in_ext = (const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->subpassMergeFeedback = in_ext->subpassMergeFeedback; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT: - { - VkPhysicalDeviceOpacityMicromapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceOpacityMicromapFeaturesEXT32 *in_ext = (const VkPhysicalDeviceOpacityMicromapFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->micromap = in_ext->micromap; - out_ext->micromapCaptureReplay = in_ext->micromapCaptureReplay; - out_ext->micromapHostCommands = in_ext->micromapHostCommands; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT: - { - VkPhysicalDevicePipelinePropertiesFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelinePropertiesFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelinePropertiesFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelinePropertiesIdentifier = in_ext->pipelinePropertiesIdentifier; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD: - { - VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32 *in_ext = (const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD; - out_ext->pNext = NULL; - out_ext->shaderEarlyAndLateFragmentTests = in_ext->shaderEarlyAndLateFragmentTests; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT: - { - VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32 *in_ext = (const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->nonSeamlessCubeMap = in_ext->nonSeamlessCubeMap; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineRobustnessFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineRobustnessFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelineRobustnessFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineRobustness = in_ext->pipelineRobustness; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessingFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageProcessingFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceImageProcessingFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->textureSampleWeighted = in_ext->textureSampleWeighted; - out_ext->textureBoxFilter = in_ext->textureBoxFilter; - out_ext->textureBlockMatch = in_ext->textureBlockMatch; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM: - { - VkPhysicalDeviceTilePropertiesFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceTilePropertiesFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceTilePropertiesFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->tileProperties = in_ext->tileProperties; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32 *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->attachmentFeedbackLoopLayout = in_ext->attachmentFeedbackLoopLayout; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthClampZeroOne = in_ext->depthClampZeroOne; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT: - { - VkPhysicalDeviceAddressBindingReportFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceAddressBindingReportFeaturesEXT32 *in_ext = (const VkPhysicalDeviceAddressBindingReportFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->reportAddressBinding = in_ext->reportAddressBinding; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV: - { - VkPhysicalDeviceOpticalFlowFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceOpticalFlowFeaturesNV32 *in_ext = (const VkPhysicalDeviceOpticalFlowFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->opticalFlow = in_ext->opticalFlow; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT: - { - VkPhysicalDeviceFaultFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFaultFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFaultFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->deviceFault = in_ext->deviceFault; - out_ext->deviceFaultVendorBinary = in_ext->deviceFaultVendorBinary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT: - { - VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32 *in_ext = (const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->pipelineLibraryGroupHandles = in_ext->pipelineLibraryGroupHandles; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM: - { - VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32 *in_ext = (const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM; - out_ext->pNext = NULL; - out_ext->shaderCoreBuiltins = in_ext->shaderCoreBuiltins; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT: - { - VkPhysicalDeviceFrameBoundaryFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFrameBoundaryFeaturesEXT32 *in_ext = (const VkPhysicalDeviceFrameBoundaryFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->frameBoundary = in_ext->frameBoundary; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT: - { - VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->dynamicRenderingUnusedAttachments = in_ext->dynamicRenderingUnusedAttachments; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT: - { - VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32 *in_ext = (const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->swapchainMaintenance1 = in_ext->swapchainMaintenance1; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthBiasControlFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDepthBiasControlFeaturesEXT32 *in_ext = (const VkPhysicalDeviceDepthBiasControlFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->depthBiasControl = in_ext->depthBiasControl; - out_ext->leastRepresentableValueForceUnormRepresentation = in_ext->leastRepresentableValueForceUnormRepresentation; - out_ext->floatRepresentation = in_ext->floatRepresentation; - out_ext->depthBiasExact = in_ext->depthBiasExact; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV: - { - VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32 *in_ext = (const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->rayTracingInvocationReorder = in_ext->rayTracingInvocationReorder; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV: - { - VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32 *in_ext = (const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->extendedSparseAddressSpace = in_ext->extendedSparseAddressSpace; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->multiviewPerViewViewports = in_ext->multiviewPerViewViewports; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32 *in_ext = (const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->rayTracingPositionFetch = in_ext->rayTracingPositionFetch; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->multiviewPerViewRenderAreas = in_ext->multiviewPerViewRenderAreas; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT: - { - VkPhysicalDeviceShaderObjectFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderObjectFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderObjectFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderObject = in_ext->shaderObject; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT: - { - VkPhysicalDeviceShaderTileImageFeaturesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceShaderTileImageFeaturesEXT32 *in_ext = (const VkPhysicalDeviceShaderTileImageFeaturesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT; - out_ext->pNext = NULL; - out_ext->shaderTileImageColorReadAccess = in_ext->shaderTileImageColorReadAccess; - out_ext->shaderTileImageDepthReadAccess = in_ext->shaderTileImageDepthReadAccess; - out_ext->shaderTileImageStencilReadAccess = in_ext->shaderTileImageStencilReadAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR: - { - VkPhysicalDeviceCooperativeMatrixFeaturesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCooperativeMatrixFeaturesKHR32 *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR; - out_ext->pNext = NULL; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM: - { - VkPhysicalDeviceCubicClampFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCubicClampFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceCubicClampFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->cubicRangeClamp = in_ext->cubicRangeClamp; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM: - { - VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->ycbcrDegamma = in_ext->ycbcrDegamma; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM: - { - VkPhysicalDeviceCubicWeightsFeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCubicWeightsFeaturesQCOM32 *in_ext = (const VkPhysicalDeviceCubicWeightsFeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->selectableCubicWeights = in_ext->selectableCubicWeights; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessing2FeaturesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageProcessing2FeaturesQCOM32 *in_ext = (const VkPhysicalDeviceImageProcessing2FeaturesQCOM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM; - out_ext->pNext = NULL; - out_ext->textureBlockMatch2 = in_ext->textureBlockMatch2; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV: - { - VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32 *in_ext = (const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->descriptorPoolOverallocation = in_ext->descriptorPoolOverallocation; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV: - { - VkPhysicalDeviceCudaKernelLaunchFeaturesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceCudaKernelLaunchFeaturesNV32 *in_ext = (const VkPhysicalDeviceCudaKernelLaunchFeaturesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV; - out_ext->pNext = NULL; - out_ext->cudaKernelLaunchFeatures = in_ext->cudaKernelLaunchFeatures; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM: - { - VkPhysicalDeviceSchedulingControlsFeaturesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSchedulingControlsFeaturesARM32 *in_ext = (const VkPhysicalDeviceSchedulingControlsFeaturesARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM; - out_ext->pNext = NULL; - out_ext->schedulingControls = in_ext->schedulingControls; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG: - { - VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32 *in_ext = (const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG; - out_ext->pNext = NULL; - out_ext->relaxedLineRasterization = in_ext->relaxedLineRasterization; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkPhysicalDeviceFeatures2_host_to_win32(const VkPhysicalDeviceFeatures2 *in, VkPhysicalDeviceFeatures232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - out->features = in->features; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV); - const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV; - out_ext->deviceGeneratedCommands = in_ext->deviceGeneratedCommands; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV); - const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV; - out_ext->deviceGeneratedCompute = in_ext->deviceGeneratedCompute; - out_ext->deviceGeneratedComputePipelines = in_ext->deviceGeneratedComputePipelines; - out_ext->deviceGeneratedComputeCaptureReplay = in_ext->deviceGeneratedComputeCaptureReplay; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES: - { - VkPhysicalDevicePrivateDataFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES); - const VkPhysicalDevicePrivateDataFeatures *in_ext = (const VkPhysicalDevicePrivateDataFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES; - out_ext->privateData = in_ext->privateData; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: - { - VkPhysicalDeviceVariablePointersFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES); - const VkPhysicalDeviceVariablePointersFeatures *in_ext = (const VkPhysicalDeviceVariablePointersFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: - { - VkPhysicalDeviceMultiviewFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES); - const VkPhysicalDeviceMultiviewFeatures *in_ext = (const VkPhysicalDeviceMultiviewFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR: - { - VkPhysicalDevicePresentIdFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR); - const VkPhysicalDevicePresentIdFeaturesKHR *in_ext = (const VkPhysicalDevicePresentIdFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR; - out_ext->presentId = in_ext->presentId; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR: - { - VkPhysicalDevicePresentWaitFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR); - const VkPhysicalDevicePresentWaitFeaturesKHR *in_ext = (const VkPhysicalDevicePresentWaitFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR; - out_ext->presentWait = in_ext->presentWait; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: - { - VkPhysicalDevice16BitStorageFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES); - const VkPhysicalDevice16BitStorageFeatures *in_ext = (const VkPhysicalDevice16BitStorageFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES: - { - VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES); - const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *in_ext = (const VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: - { - VkPhysicalDeviceSamplerYcbcrConversionFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES); - const VkPhysicalDeviceSamplerYcbcrConversionFeatures *in_ext = (const VkPhysicalDeviceSamplerYcbcrConversionFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: - { - VkPhysicalDeviceProtectedMemoryFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES); - const VkPhysicalDeviceProtectedMemoryFeatures *in_ext = (const VkPhysicalDeviceProtectedMemoryFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES; - out_ext->protectedMemory = in_ext->protectedMemory; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT: - { - VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT); - const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *in_ext = (const VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT; - out_ext->advancedBlendCoherentOperations = in_ext->advancedBlendCoherentOperations; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT: - { - VkPhysicalDeviceMultiDrawFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT); - const VkPhysicalDeviceMultiDrawFeaturesEXT *in_ext = (const VkPhysicalDeviceMultiDrawFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT; - out_ext->multiDraw = in_ext->multiDraw; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES: - { - VkPhysicalDeviceInlineUniformBlockFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES); - const VkPhysicalDeviceInlineUniformBlockFeatures *in_ext = (const VkPhysicalDeviceInlineUniformBlockFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES: - { - VkPhysicalDeviceMaintenance4Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES); - const VkPhysicalDeviceMaintenance4Features *in_ext = (const VkPhysicalDeviceMaintenance4Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES; - out_ext->maintenance4 = in_ext->maintenance4; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR: - { - VkPhysicalDeviceMaintenance5FeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR); - const VkPhysicalDeviceMaintenance5FeaturesKHR *in_ext = (const VkPhysicalDeviceMaintenance5FeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR; - out_ext->maintenance5 = in_ext->maintenance5; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: - { - VkPhysicalDeviceShaderDrawParametersFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES); - const VkPhysicalDeviceShaderDrawParametersFeatures *in_ext = (const VkPhysicalDeviceShaderDrawParametersFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES: - { - VkPhysicalDeviceShaderFloat16Int8Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES); - const VkPhysicalDeviceShaderFloat16Int8Features *in_ext = (const VkPhysicalDeviceShaderFloat16Int8Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES: - { - VkPhysicalDeviceHostQueryResetFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES); - const VkPhysicalDeviceHostQueryResetFeatures *in_ext = (const VkPhysicalDeviceHostQueryResetFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR); - const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *in_ext = (const VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR; - out_ext->globalPriorityQuery = in_ext->globalPriorityQuery; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES: - { - VkPhysicalDeviceDescriptorIndexingFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES); - const VkPhysicalDeviceDescriptorIndexingFeatures *in_ext = (const VkPhysicalDeviceDescriptorIndexingFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: - { - VkPhysicalDeviceTimelineSemaphoreFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES); - const VkPhysicalDeviceTimelineSemaphoreFeatures *in_ext = (const VkPhysicalDeviceTimelineSemaphoreFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: - { - VkPhysicalDevice8BitStorageFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES); - const VkPhysicalDevice8BitStorageFeatures *in_ext = (const VkPhysicalDevice8BitStorageFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: - { - VkPhysicalDeviceConditionalRenderingFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT); - const VkPhysicalDeviceConditionalRenderingFeaturesEXT *in_ext = (const VkPhysicalDeviceConditionalRenderingFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT; - out_ext->conditionalRendering = in_ext->conditionalRendering; - out_ext->inheritedConditionalRendering = in_ext->inheritedConditionalRendering; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES: - { - VkPhysicalDeviceVulkanMemoryModelFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES); - const VkPhysicalDeviceVulkanMemoryModelFeatures *in_ext = (const VkPhysicalDeviceVulkanMemoryModelFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES: - { - VkPhysicalDeviceShaderAtomicInt64Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES); - const VkPhysicalDeviceShaderAtomicInt64Features *in_ext = (const VkPhysicalDeviceShaderAtomicInt64Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloatFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT); - const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT; - out_ext->shaderBufferFloat32Atomics = in_ext->shaderBufferFloat32Atomics; - out_ext->shaderBufferFloat32AtomicAdd = in_ext->shaderBufferFloat32AtomicAdd; - out_ext->shaderBufferFloat64Atomics = in_ext->shaderBufferFloat64Atomics; - out_ext->shaderBufferFloat64AtomicAdd = in_ext->shaderBufferFloat64AtomicAdd; - out_ext->shaderSharedFloat32Atomics = in_ext->shaderSharedFloat32Atomics; - out_ext->shaderSharedFloat32AtomicAdd = in_ext->shaderSharedFloat32AtomicAdd; - out_ext->shaderSharedFloat64Atomics = in_ext->shaderSharedFloat64Atomics; - out_ext->shaderSharedFloat64AtomicAdd = in_ext->shaderSharedFloat64AtomicAdd; - out_ext->shaderImageFloat32Atomics = in_ext->shaderImageFloat32Atomics; - out_ext->shaderImageFloat32AtomicAdd = in_ext->shaderImageFloat32AtomicAdd; - out_ext->sparseImageFloat32Atomics = in_ext->sparseImageFloat32Atomics; - out_ext->sparseImageFloat32AtomicAdd = in_ext->sparseImageFloat32AtomicAdd; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT: - { - VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT); - const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *in_ext = (const VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT; - out_ext->shaderBufferFloat16Atomics = in_ext->shaderBufferFloat16Atomics; - out_ext->shaderBufferFloat16AtomicAdd = in_ext->shaderBufferFloat16AtomicAdd; - out_ext->shaderBufferFloat16AtomicMinMax = in_ext->shaderBufferFloat16AtomicMinMax; - out_ext->shaderBufferFloat32AtomicMinMax = in_ext->shaderBufferFloat32AtomicMinMax; - out_ext->shaderBufferFloat64AtomicMinMax = in_ext->shaderBufferFloat64AtomicMinMax; - out_ext->shaderSharedFloat16Atomics = in_ext->shaderSharedFloat16Atomics; - out_ext->shaderSharedFloat16AtomicAdd = in_ext->shaderSharedFloat16AtomicAdd; - out_ext->shaderSharedFloat16AtomicMinMax = in_ext->shaderSharedFloat16AtomicMinMax; - out_ext->shaderSharedFloat32AtomicMinMax = in_ext->shaderSharedFloat32AtomicMinMax; - out_ext->shaderSharedFloat64AtomicMinMax = in_ext->shaderSharedFloat64AtomicMinMax; - out_ext->shaderImageFloat32AtomicMinMax = in_ext->shaderImageFloat32AtomicMinMax; - out_ext->sparseImageFloat32AtomicMinMax = in_ext->sparseImageFloat32AtomicMinMax; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: - { - VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT); - const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *in_ext = (const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; - out_ext->vertexAttributeInstanceRateDivisor = in_ext->vertexAttributeInstanceRateDivisor; - out_ext->vertexAttributeInstanceRateZeroDivisor = in_ext->vertexAttributeInstanceRateZeroDivisor; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT: - { - VkPhysicalDeviceASTCDecodeFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT); - const VkPhysicalDeviceASTCDecodeFeaturesEXT *in_ext = (const VkPhysicalDeviceASTCDecodeFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT; - out_ext->decodeModeSharedExponent = in_ext->decodeModeSharedExponent; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceTransformFeedbackFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT); - const VkPhysicalDeviceTransformFeedbackFeaturesEXT *in_ext = (const VkPhysicalDeviceTransformFeedbackFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; - out_ext->transformFeedback = in_ext->transformFeedback; - out_ext->geometryStreams = in_ext->geometryStreams; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV: - { - VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV); - const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *in_ext = (const VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV; - out_ext->representativeFragmentTest = in_ext->representativeFragmentTest; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceExclusiveScissorFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV); - const VkPhysicalDeviceExclusiveScissorFeaturesNV *in_ext = (const VkPhysicalDeviceExclusiveScissorFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV; - out_ext->exclusiveScissor = in_ext->exclusiveScissor; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceCornerSampledImageFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV); - const VkPhysicalDeviceCornerSampledImageFeaturesNV *in_ext = (const VkPhysicalDeviceCornerSampledImageFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV; - out_ext->cornerSampledImage = in_ext->cornerSampledImage; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: - { - VkPhysicalDeviceComputeShaderDerivativesFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV); - const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *in_ext = (const VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV; - out_ext->computeDerivativeGroupQuads = in_ext->computeDerivativeGroupQuads; - out_ext->computeDerivativeGroupLinear = in_ext->computeDerivativeGroupLinear; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV: - { - VkPhysicalDeviceShaderImageFootprintFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV); - const VkPhysicalDeviceShaderImageFootprintFeaturesNV *in_ext = (const VkPhysicalDeviceShaderImageFootprintFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV; - out_ext->imageFootprint = in_ext->imageFootprint; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV: - { - VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV); - const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *in_ext = (const VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV; - out_ext->dedicatedAllocationImageAliasing = in_ext->dedicatedAllocationImageAliasing; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV: - { - VkPhysicalDeviceCopyMemoryIndirectFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV); - const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *in_ext = (const VkPhysicalDeviceCopyMemoryIndirectFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV; - out_ext->indirectCopy = in_ext->indirectCopy; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV: - { - VkPhysicalDeviceMemoryDecompressionFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV); - const VkPhysicalDeviceMemoryDecompressionFeaturesNV *in_ext = (const VkPhysicalDeviceMemoryDecompressionFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV; - out_ext->memoryDecompression = in_ext->memoryDecompression; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV: - { - VkPhysicalDeviceShadingRateImageFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV); - const VkPhysicalDeviceShadingRateImageFeaturesNV *in_ext = (const VkPhysicalDeviceShadingRateImageFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV; - out_ext->shadingRateImage = in_ext->shadingRateImage; - out_ext->shadingRateCoarseSampleOrder = in_ext->shadingRateCoarseSampleOrder; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI: - { - VkPhysicalDeviceInvocationMaskFeaturesHUAWEI32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI); - const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *in_ext = (const VkPhysicalDeviceInvocationMaskFeaturesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI; - out_ext->invocationMask = in_ext->invocationMask; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV: - { - VkPhysicalDeviceMeshShaderFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV); - const VkPhysicalDeviceMeshShaderFeaturesNV *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT: - { - VkPhysicalDeviceMeshShaderFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT); - const VkPhysicalDeviceMeshShaderFeaturesEXT *in_ext = (const VkPhysicalDeviceMeshShaderFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT; - out_ext->taskShader = in_ext->taskShader; - out_ext->meshShader = in_ext->meshShader; - out_ext->multiviewMeshShader = in_ext->multiviewMeshShader; - out_ext->primitiveFragmentShadingRateMeshShader = in_ext->primitiveFragmentShadingRateMeshShader; - out_ext->meshShaderQueries = in_ext->meshShaderQueries; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR: - { - VkPhysicalDeviceAccelerationStructureFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR); - const VkPhysicalDeviceAccelerationStructureFeaturesKHR *in_ext = (const VkPhysicalDeviceAccelerationStructureFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR; - out_ext->accelerationStructure = in_ext->accelerationStructure; - out_ext->accelerationStructureCaptureReplay = in_ext->accelerationStructureCaptureReplay; - out_ext->accelerationStructureIndirectBuild = in_ext->accelerationStructureIndirectBuild; - out_ext->accelerationStructureHostCommands = in_ext->accelerationStructureHostCommands; - out_ext->descriptorBindingAccelerationStructureUpdateAfterBind = in_ext->descriptorBindingAccelerationStructureUpdateAfterBind; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPipelineFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR); - const VkPhysicalDeviceRayTracingPipelineFeaturesKHR *in_ext = (const VkPhysicalDeviceRayTracingPipelineFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR; - out_ext->rayTracingPipeline = in_ext->rayTracingPipeline; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplay = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplay; - out_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed = in_ext->rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - out_ext->rayTracingPipelineTraceRaysIndirect = in_ext->rayTracingPipelineTraceRaysIndirect; - out_ext->rayTraversalPrimitiveCulling = in_ext->rayTraversalPrimitiveCulling; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR: - { - VkPhysicalDeviceRayQueryFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR); - const VkPhysicalDeviceRayQueryFeaturesKHR *in_ext = (const VkPhysicalDeviceRayQueryFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR; - out_ext->rayQuery = in_ext->rayQuery; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR); - const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *in_ext = (const VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR; - out_ext->rayTracingMaintenance1 = in_ext->rayTracingMaintenance1; - out_ext->rayTracingPipelineTraceRaysIndirect2 = in_ext->rayTracingPipelineTraceRaysIndirect2; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMapFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT); - const VkPhysicalDeviceFragmentDensityMapFeaturesEXT *in_ext = (const VkPhysicalDeviceFragmentDensityMapFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT; - out_ext->fragmentDensityMap = in_ext->fragmentDensityMap; - out_ext->fragmentDensityMapDynamic = in_ext->fragmentDensityMapDynamic; - out_ext->fragmentDensityMapNonSubsampledImages = in_ext->fragmentDensityMapNonSubsampledImages; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT: - { - VkPhysicalDeviceFragmentDensityMap2FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT); - const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *in_ext = (const VkPhysicalDeviceFragmentDensityMap2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT; - out_ext->fragmentDensityMapDeferred = in_ext->fragmentDensityMapDeferred; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM: - { - VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM); - const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *in_ext = (const VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM; - out_ext->fragmentDensityMapOffset = in_ext->fragmentDensityMapOffset; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES: - { - VkPhysicalDeviceScalarBlockLayoutFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES); - const VkPhysicalDeviceScalarBlockLayoutFeatures *in_ext = (const VkPhysicalDeviceScalarBlockLayoutFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES: - { - VkPhysicalDeviceUniformBufferStandardLayoutFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES); - const VkPhysicalDeviceUniformBufferStandardLayoutFeatures *in_ext = (const VkPhysicalDeviceUniformBufferStandardLayoutFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipEnableFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT); - const VkPhysicalDeviceDepthClipEnableFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthClipEnableFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; - out_ext->depthClipEnable = in_ext->depthClipEnable; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT: - { - VkPhysicalDeviceMemoryPriorityFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT); - const VkPhysicalDeviceMemoryPriorityFeaturesEXT *in_ext = (const VkPhysicalDeviceMemoryPriorityFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT; - out_ext->memoryPriority = in_ext->memoryPriority; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT: - { - VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT); - const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *in_ext = (const VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT; - out_ext->pageableDeviceLocalMemory = in_ext->pageableDeviceLocalMemory; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES: - { - VkPhysicalDeviceBufferDeviceAddressFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES); - const VkPhysicalDeviceBufferDeviceAddressFeatures *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT: - { - VkPhysicalDeviceBufferDeviceAddressFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT); - const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *in_ext = (const VkPhysicalDeviceBufferDeviceAddressFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES: - { - VkPhysicalDeviceImagelessFramebufferFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES); - const VkPhysicalDeviceImagelessFramebufferFeatures *in_ext = (const VkPhysicalDeviceImagelessFramebufferFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES: - { - VkPhysicalDeviceTextureCompressionASTCHDRFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES); - const VkPhysicalDeviceTextureCompressionASTCHDRFeatures *in_ext = (const VkPhysicalDeviceTextureCompressionASTCHDRFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV: - { - VkPhysicalDeviceCooperativeMatrixFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV); - const VkPhysicalDeviceCooperativeMatrixFeaturesNV *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcrImageArraysFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT); - const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *in_ext = (const VkPhysicalDeviceYcbcrImageArraysFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT; - out_ext->ycbcrImageArrays = in_ext->ycbcrImageArrays; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV: - { - VkPhysicalDevicePresentBarrierFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV); - const VkPhysicalDevicePresentBarrierFeaturesNV *in_ext = (const VkPhysicalDevicePresentBarrierFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV; - out_ext->presentBarrier = in_ext->presentBarrier; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR: - { - VkPhysicalDevicePerformanceQueryFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR); - const VkPhysicalDevicePerformanceQueryFeaturesKHR *in_ext = (const VkPhysicalDevicePerformanceQueryFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR; - out_ext->performanceCounterQueryPools = in_ext->performanceCounterQueryPools; - out_ext->performanceCounterMultipleQueryPools = in_ext->performanceCounterMultipleQueryPools; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV: - { - VkPhysicalDeviceCoverageReductionModeFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV); - const VkPhysicalDeviceCoverageReductionModeFeaturesNV *in_ext = (const VkPhysicalDeviceCoverageReductionModeFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV; - out_ext->coverageReductionMode = in_ext->coverageReductionMode; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL: - { - VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL); - const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *in_ext = (const VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL; - out_ext->shaderIntegerFunctions2 = in_ext->shaderIntegerFunctions2; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR: - { - VkPhysicalDeviceShaderClockFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR); - const VkPhysicalDeviceShaderClockFeaturesKHR *in_ext = (const VkPhysicalDeviceShaderClockFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR; - out_ext->shaderSubgroupClock = in_ext->shaderSubgroupClock; - out_ext->shaderDeviceClock = in_ext->shaderDeviceClock; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT: - { - VkPhysicalDeviceIndexTypeUint8FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT); - const VkPhysicalDeviceIndexTypeUint8FeaturesEXT *in_ext = (const VkPhysicalDeviceIndexTypeUint8FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT; - out_ext->indexTypeUint8 = in_ext->indexTypeUint8; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV: - { - VkPhysicalDeviceShaderSMBuiltinsFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV); - const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *in_ext = (const VkPhysicalDeviceShaderSMBuiltinsFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV; - out_ext->shaderSMBuiltins = in_ext->shaderSMBuiltins; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT: - { - VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT); - const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *in_ext = (const VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT; - out_ext->fragmentShaderSampleInterlock = in_ext->fragmentShaderSampleInterlock; - out_ext->fragmentShaderPixelInterlock = in_ext->fragmentShaderPixelInterlock; - out_ext->fragmentShaderShadingRateInterlock = in_ext->fragmentShaderShadingRateInterlock; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES: - { - VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES); - const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *in_ext = (const VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT: - { - VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT); - const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *in_ext = (const VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT; - out_ext->primitiveTopologyListRestart = in_ext->primitiveTopologyListRestart; - out_ext->primitiveTopologyPatchListRestart = in_ext->primitiveTopologyPatchListRestart; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR: - { - VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR); - const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *in_ext = (const VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR; - out_ext->pipelineExecutableInfo = in_ext->pipelineExecutableInfo; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES); - const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *in_ext = (const VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT: - { - VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT); - const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *in_ext = (const VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT; - out_ext->texelBufferAlignment = in_ext->texelBufferAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES: - { - VkPhysicalDeviceSubgroupSizeControlFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES); - const VkPhysicalDeviceSubgroupSizeControlFeatures *in_ext = (const VkPhysicalDeviceSubgroupSizeControlFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: - { - VkPhysicalDeviceLineRasterizationFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT); - const VkPhysicalDeviceLineRasterizationFeaturesEXT *in_ext = (const VkPhysicalDeviceLineRasterizationFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT; - out_ext->rectangularLines = in_ext->rectangularLines; - out_ext->bresenhamLines = in_ext->bresenhamLines; - out_ext->smoothLines = in_ext->smoothLines; - out_ext->stippledRectangularLines = in_ext->stippledRectangularLines; - out_ext->stippledBresenhamLines = in_ext->stippledBresenhamLines; - out_ext->stippledSmoothLines = in_ext->stippledSmoothLines; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES: - { - VkPhysicalDevicePipelineCreationCacheControlFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES); - const VkPhysicalDevicePipelineCreationCacheControlFeatures *in_ext = (const VkPhysicalDevicePipelineCreationCacheControlFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: - { - VkPhysicalDeviceVulkan11Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES); - const VkPhysicalDeviceVulkan11Features *in_ext = (const VkPhysicalDeviceVulkan11Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES; - out_ext->storageBuffer16BitAccess = in_ext->storageBuffer16BitAccess; - out_ext->uniformAndStorageBuffer16BitAccess = in_ext->uniformAndStorageBuffer16BitAccess; - out_ext->storagePushConstant16 = in_ext->storagePushConstant16; - out_ext->storageInputOutput16 = in_ext->storageInputOutput16; - out_ext->multiview = in_ext->multiview; - out_ext->multiviewGeometryShader = in_ext->multiviewGeometryShader; - out_ext->multiviewTessellationShader = in_ext->multiviewTessellationShader; - out_ext->variablePointersStorageBuffer = in_ext->variablePointersStorageBuffer; - out_ext->variablePointers = in_ext->variablePointers; - out_ext->protectedMemory = in_ext->protectedMemory; - out_ext->samplerYcbcrConversion = in_ext->samplerYcbcrConversion; - out_ext->shaderDrawParameters = in_ext->shaderDrawParameters; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES: - { - VkPhysicalDeviceVulkan12Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES); - const VkPhysicalDeviceVulkan12Features *in_ext = (const VkPhysicalDeviceVulkan12Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; - out_ext->samplerMirrorClampToEdge = in_ext->samplerMirrorClampToEdge; - out_ext->drawIndirectCount = in_ext->drawIndirectCount; - out_ext->storageBuffer8BitAccess = in_ext->storageBuffer8BitAccess; - out_ext->uniformAndStorageBuffer8BitAccess = in_ext->uniformAndStorageBuffer8BitAccess; - out_ext->storagePushConstant8 = in_ext->storagePushConstant8; - out_ext->shaderBufferInt64Atomics = in_ext->shaderBufferInt64Atomics; - out_ext->shaderSharedInt64Atomics = in_ext->shaderSharedInt64Atomics; - out_ext->shaderFloat16 = in_ext->shaderFloat16; - out_ext->shaderInt8 = in_ext->shaderInt8; - out_ext->descriptorIndexing = in_ext->descriptorIndexing; - out_ext->shaderInputAttachmentArrayDynamicIndexing = in_ext->shaderInputAttachmentArrayDynamicIndexing; - out_ext->shaderUniformTexelBufferArrayDynamicIndexing = in_ext->shaderUniformTexelBufferArrayDynamicIndexing; - out_ext->shaderStorageTexelBufferArrayDynamicIndexing = in_ext->shaderStorageTexelBufferArrayDynamicIndexing; - out_ext->shaderUniformBufferArrayNonUniformIndexing = in_ext->shaderUniformBufferArrayNonUniformIndexing; - out_ext->shaderSampledImageArrayNonUniformIndexing = in_ext->shaderSampledImageArrayNonUniformIndexing; - out_ext->shaderStorageBufferArrayNonUniformIndexing = in_ext->shaderStorageBufferArrayNonUniformIndexing; - out_ext->shaderStorageImageArrayNonUniformIndexing = in_ext->shaderStorageImageArrayNonUniformIndexing; - out_ext->shaderInputAttachmentArrayNonUniformIndexing = in_ext->shaderInputAttachmentArrayNonUniformIndexing; - out_ext->shaderUniformTexelBufferArrayNonUniformIndexing = in_ext->shaderUniformTexelBufferArrayNonUniformIndexing; - out_ext->shaderStorageTexelBufferArrayNonUniformIndexing = in_ext->shaderStorageTexelBufferArrayNonUniformIndexing; - out_ext->descriptorBindingUniformBufferUpdateAfterBind = in_ext->descriptorBindingUniformBufferUpdateAfterBind; - out_ext->descriptorBindingSampledImageUpdateAfterBind = in_ext->descriptorBindingSampledImageUpdateAfterBind; - out_ext->descriptorBindingStorageImageUpdateAfterBind = in_ext->descriptorBindingStorageImageUpdateAfterBind; - out_ext->descriptorBindingStorageBufferUpdateAfterBind = in_ext->descriptorBindingStorageBufferUpdateAfterBind; - out_ext->descriptorBindingUniformTexelBufferUpdateAfterBind = in_ext->descriptorBindingUniformTexelBufferUpdateAfterBind; - out_ext->descriptorBindingStorageTexelBufferUpdateAfterBind = in_ext->descriptorBindingStorageTexelBufferUpdateAfterBind; - out_ext->descriptorBindingUpdateUnusedWhilePending = in_ext->descriptorBindingUpdateUnusedWhilePending; - out_ext->descriptorBindingPartiallyBound = in_ext->descriptorBindingPartiallyBound; - out_ext->descriptorBindingVariableDescriptorCount = in_ext->descriptorBindingVariableDescriptorCount; - out_ext->runtimeDescriptorArray = in_ext->runtimeDescriptorArray; - out_ext->samplerFilterMinmax = in_ext->samplerFilterMinmax; - out_ext->scalarBlockLayout = in_ext->scalarBlockLayout; - out_ext->imagelessFramebuffer = in_ext->imagelessFramebuffer; - out_ext->uniformBufferStandardLayout = in_ext->uniformBufferStandardLayout; - out_ext->shaderSubgroupExtendedTypes = in_ext->shaderSubgroupExtendedTypes; - out_ext->separateDepthStencilLayouts = in_ext->separateDepthStencilLayouts; - out_ext->hostQueryReset = in_ext->hostQueryReset; - out_ext->timelineSemaphore = in_ext->timelineSemaphore; - out_ext->bufferDeviceAddress = in_ext->bufferDeviceAddress; - out_ext->bufferDeviceAddressCaptureReplay = in_ext->bufferDeviceAddressCaptureReplay; - out_ext->bufferDeviceAddressMultiDevice = in_ext->bufferDeviceAddressMultiDevice; - out_ext->vulkanMemoryModel = in_ext->vulkanMemoryModel; - out_ext->vulkanMemoryModelDeviceScope = in_ext->vulkanMemoryModelDeviceScope; - out_ext->vulkanMemoryModelAvailabilityVisibilityChains = in_ext->vulkanMemoryModelAvailabilityVisibilityChains; - out_ext->shaderOutputViewportIndex = in_ext->shaderOutputViewportIndex; - out_ext->shaderOutputLayer = in_ext->shaderOutputLayer; - out_ext->subgroupBroadcastDynamicId = in_ext->subgroupBroadcastDynamicId; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES: - { - VkPhysicalDeviceVulkan13Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES); - const VkPhysicalDeviceVulkan13Features *in_ext = (const VkPhysicalDeviceVulkan13Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_ext->inlineUniformBlock = in_ext->inlineUniformBlock; - out_ext->descriptorBindingInlineUniformBlockUpdateAfterBind = in_ext->descriptorBindingInlineUniformBlockUpdateAfterBind; - out_ext->pipelineCreationCacheControl = in_ext->pipelineCreationCacheControl; - out_ext->privateData = in_ext->privateData; - out_ext->shaderDemoteToHelperInvocation = in_ext->shaderDemoteToHelperInvocation; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_ext->subgroupSizeControl = in_ext->subgroupSizeControl; - out_ext->computeFullSubgroups = in_ext->computeFullSubgroups; - out_ext->synchronization2 = in_ext->synchronization2; - out_ext->textureCompressionASTC_HDR = in_ext->textureCompressionASTC_HDR; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_ext->maintenance4 = in_ext->maintenance4; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD: - { - VkPhysicalDeviceCoherentMemoryFeaturesAMD32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD); - const VkPhysicalDeviceCoherentMemoryFeaturesAMD *in_ext = (const VkPhysicalDeviceCoherentMemoryFeaturesAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD; - out_ext->deviceCoherentMemory = in_ext->deviceCoherentMemory; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT: - { - VkPhysicalDeviceCustomBorderColorFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT); - const VkPhysicalDeviceCustomBorderColorFeaturesEXT *in_ext = (const VkPhysicalDeviceCustomBorderColorFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; - out_ext->customBorderColors = in_ext->customBorderColors; - out_ext->customBorderColorWithoutFormat = in_ext->customBorderColorWithoutFormat; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT: - { - VkPhysicalDeviceBorderColorSwizzleFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT); - const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *in_ext = (const VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT; - out_ext->borderColorSwizzle = in_ext->borderColorSwizzle; - out_ext->borderColorSwizzleFromImage = in_ext->borderColorSwizzleFromImage; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicStateFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT); - const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; - out_ext->extendedDynamicState = in_ext->extendedDynamicState; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState2FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT); - const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicState2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT; - out_ext->extendedDynamicState2 = in_ext->extendedDynamicState2; - out_ext->extendedDynamicState2LogicOp = in_ext->extendedDynamicState2LogicOp; - out_ext->extendedDynamicState2PatchControlPoints = in_ext->extendedDynamicState2PatchControlPoints; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT: - { - VkPhysicalDeviceExtendedDynamicState3FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT); - const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicState3FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT; - out_ext->extendedDynamicState3TessellationDomainOrigin = in_ext->extendedDynamicState3TessellationDomainOrigin; - out_ext->extendedDynamicState3DepthClampEnable = in_ext->extendedDynamicState3DepthClampEnable; - out_ext->extendedDynamicState3PolygonMode = in_ext->extendedDynamicState3PolygonMode; - out_ext->extendedDynamicState3RasterizationSamples = in_ext->extendedDynamicState3RasterizationSamples; - out_ext->extendedDynamicState3SampleMask = in_ext->extendedDynamicState3SampleMask; - out_ext->extendedDynamicState3AlphaToCoverageEnable = in_ext->extendedDynamicState3AlphaToCoverageEnable; - out_ext->extendedDynamicState3AlphaToOneEnable = in_ext->extendedDynamicState3AlphaToOneEnable; - out_ext->extendedDynamicState3LogicOpEnable = in_ext->extendedDynamicState3LogicOpEnable; - out_ext->extendedDynamicState3ColorBlendEnable = in_ext->extendedDynamicState3ColorBlendEnable; - out_ext->extendedDynamicState3ColorBlendEquation = in_ext->extendedDynamicState3ColorBlendEquation; - out_ext->extendedDynamicState3ColorWriteMask = in_ext->extendedDynamicState3ColorWriteMask; - out_ext->extendedDynamicState3RasterizationStream = in_ext->extendedDynamicState3RasterizationStream; - out_ext->extendedDynamicState3ConservativeRasterizationMode = in_ext->extendedDynamicState3ConservativeRasterizationMode; - out_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize = in_ext->extendedDynamicState3ExtraPrimitiveOverestimationSize; - out_ext->extendedDynamicState3DepthClipEnable = in_ext->extendedDynamicState3DepthClipEnable; - out_ext->extendedDynamicState3SampleLocationsEnable = in_ext->extendedDynamicState3SampleLocationsEnable; - out_ext->extendedDynamicState3ColorBlendAdvanced = in_ext->extendedDynamicState3ColorBlendAdvanced; - out_ext->extendedDynamicState3ProvokingVertexMode = in_ext->extendedDynamicState3ProvokingVertexMode; - out_ext->extendedDynamicState3LineRasterizationMode = in_ext->extendedDynamicState3LineRasterizationMode; - out_ext->extendedDynamicState3LineStippleEnable = in_ext->extendedDynamicState3LineStippleEnable; - out_ext->extendedDynamicState3DepthClipNegativeOneToOne = in_ext->extendedDynamicState3DepthClipNegativeOneToOne; - out_ext->extendedDynamicState3ViewportWScalingEnable = in_ext->extendedDynamicState3ViewportWScalingEnable; - out_ext->extendedDynamicState3ViewportSwizzle = in_ext->extendedDynamicState3ViewportSwizzle; - out_ext->extendedDynamicState3CoverageToColorEnable = in_ext->extendedDynamicState3CoverageToColorEnable; - out_ext->extendedDynamicState3CoverageToColorLocation = in_ext->extendedDynamicState3CoverageToColorLocation; - out_ext->extendedDynamicState3CoverageModulationMode = in_ext->extendedDynamicState3CoverageModulationMode; - out_ext->extendedDynamicState3CoverageModulationTableEnable = in_ext->extendedDynamicState3CoverageModulationTableEnable; - out_ext->extendedDynamicState3CoverageModulationTable = in_ext->extendedDynamicState3CoverageModulationTable; - out_ext->extendedDynamicState3CoverageReductionMode = in_ext->extendedDynamicState3CoverageReductionMode; - out_ext->extendedDynamicState3RepresentativeFragmentTestEnable = in_ext->extendedDynamicState3RepresentativeFragmentTestEnable; - out_ext->extendedDynamicState3ShadingRateImageEnable = in_ext->extendedDynamicState3ShadingRateImageEnable; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV: - { - VkPhysicalDeviceDiagnosticsConfigFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV); - const VkPhysicalDeviceDiagnosticsConfigFeaturesNV *in_ext = (const VkPhysicalDeviceDiagnosticsConfigFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV; - out_ext->diagnosticsConfig = in_ext->diagnosticsConfig; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES: - { - VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES); - const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *in_ext = (const VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES; - out_ext->shaderZeroInitializeWorkgroupMemory = in_ext->shaderZeroInitializeWorkgroupMemory; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR: - { - VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR); - const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *in_ext = (const VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR; - out_ext->shaderSubgroupUniformControlFlow = in_ext->shaderSubgroupUniformControlFlow; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: - { - VkPhysicalDeviceRobustness2FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT); - const VkPhysicalDeviceRobustness2FeaturesEXT *in_ext = (const VkPhysicalDeviceRobustness2FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; - out_ext->robustBufferAccess2 = in_ext->robustBufferAccess2; - out_ext->robustImageAccess2 = in_ext->robustImageAccess2; - out_ext->nullDescriptor = in_ext->nullDescriptor; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES: - { - VkPhysicalDeviceImageRobustnessFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES); - const VkPhysicalDeviceImageRobustnessFeatures *in_ext = (const VkPhysicalDeviceImageRobustnessFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES; - out_ext->robustImageAccess = in_ext->robustImageAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR: - { - VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR); - const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *in_ext = (const VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR; - out_ext->workgroupMemoryExplicitLayout = in_ext->workgroupMemoryExplicitLayout; - out_ext->workgroupMemoryExplicitLayoutScalarBlockLayout = in_ext->workgroupMemoryExplicitLayoutScalarBlockLayout; - out_ext->workgroupMemoryExplicitLayout8BitAccess = in_ext->workgroupMemoryExplicitLayout8BitAccess; - out_ext->workgroupMemoryExplicitLayout16BitAccess = in_ext->workgroupMemoryExplicitLayout16BitAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT: - { - VkPhysicalDevice4444FormatsFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT); - const VkPhysicalDevice4444FormatsFeaturesEXT *in_ext = (const VkPhysicalDevice4444FormatsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT; - out_ext->formatA4R4G4B4 = in_ext->formatA4R4G4B4; - out_ext->formatA4B4G4R4 = in_ext->formatA4B4G4R4; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI: - { - VkPhysicalDeviceSubpassShadingFeaturesHUAWEI32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI); - const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *in_ext = (const VkPhysicalDeviceSubpassShadingFeaturesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI; - out_ext->subpassShading = in_ext->subpassShading; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI: - { - VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI); - const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *in_ext = (const VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI; - out_ext->clustercullingShader = in_ext->clustercullingShader; - out_ext->multiviewClusterCullingShader = in_ext->multiviewClusterCullingShader; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT: - { - VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT); - const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *in_ext = (const VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT; - out_ext->shaderImageInt64Atomics = in_ext->shaderImageInt64Atomics; - out_ext->sparseImageInt64Atomics = in_ext->sparseImageInt64Atomics; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShadingRateFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR); - const VkPhysicalDeviceFragmentShadingRateFeaturesKHR *in_ext = (const VkPhysicalDeviceFragmentShadingRateFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR; - out_ext->pipelineFragmentShadingRate = in_ext->pipelineFragmentShadingRate; - out_ext->primitiveFragmentShadingRate = in_ext->primitiveFragmentShadingRate; - out_ext->attachmentFragmentShadingRate = in_ext->attachmentFragmentShadingRate; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES: - { - VkPhysicalDeviceShaderTerminateInvocationFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES); - const VkPhysicalDeviceShaderTerminateInvocationFeatures *in_ext = (const VkPhysicalDeviceShaderTerminateInvocationFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES; - out_ext->shaderTerminateInvocation = in_ext->shaderTerminateInvocation; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV: - { - VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV); - const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *in_ext = (const VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV; - out_ext->fragmentShadingRateEnums = in_ext->fragmentShadingRateEnums; - out_ext->supersampleFragmentShadingRates = in_ext->supersampleFragmentShadingRates; - out_ext->noInvocationFragmentShadingRates = in_ext->noInvocationFragmentShadingRates; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImage2DViewOf3DFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT); - const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *in_ext = (const VkPhysicalDeviceImage2DViewOf3DFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT; - out_ext->image2DViewOf3D = in_ext->image2DViewOf3D; - out_ext->sampler2DViewOf3D = in_ext->sampler2DViewOf3D; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT: - { - VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT); - const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *in_ext = (const VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT; - out_ext->imageSlicedViewOf3D = in_ext->imageSlicedViewOf3D; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT); - const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT; - out_ext->attachmentFeedbackLoopDynamicState = in_ext->attachmentFeedbackLoopDynamicState; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT: - { - VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT); - const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *in_ext = (const VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT; - out_ext->mutableDescriptorType = in_ext->mutableDescriptorType; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthClipControlFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT); - const VkPhysicalDeviceDepthClipControlFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthClipControlFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT; - out_ext->depthClipControl = in_ext->depthClipControl; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT: - { - VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT); - const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *in_ext = (const VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT; - out_ext->vertexInputDynamicState = in_ext->vertexInputDynamicState; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT: - { - VkPhysicalDeviceColorWriteEnableFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT); - const VkPhysicalDeviceColorWriteEnableFeaturesEXT *in_ext = (const VkPhysicalDeviceColorWriteEnableFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT; - out_ext->colorWriteEnable = in_ext->colorWriteEnable; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES: - { - VkPhysicalDeviceSynchronization2Features32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES); - const VkPhysicalDeviceSynchronization2Features *in_ext = (const VkPhysicalDeviceSynchronization2Features *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES; - out_ext->synchronization2 = in_ext->synchronization2; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT: - { - VkPhysicalDeviceHostImageCopyFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT); - const VkPhysicalDeviceHostImageCopyFeaturesEXT *in_ext = (const VkPhysicalDeviceHostImageCopyFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT; - out_ext->hostImageCopy = in_ext->hostImageCopy; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT: - { - VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT); - const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *in_ext = (const VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT; - out_ext->primitivesGeneratedQuery = in_ext->primitivesGeneratedQuery; - out_ext->primitivesGeneratedQueryWithRasterizerDiscard = in_ext->primitivesGeneratedQueryWithRasterizerDiscard; - out_ext->primitivesGeneratedQueryWithNonZeroStreams = in_ext->primitivesGeneratedQueryWithNonZeroStreams; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT: - { - VkPhysicalDeviceLegacyDitheringFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT); - const VkPhysicalDeviceLegacyDitheringFeaturesEXT *in_ext = (const VkPhysicalDeviceLegacyDitheringFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT; - out_ext->legacyDithering = in_ext->legacyDithering; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT: - { - VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT); - const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *in_ext = (const VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT; - out_ext->multisampledRenderToSingleSampled = in_ext->multisampledRenderToSingleSampled; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineProtectedAccessFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT); - const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *in_ext = (const VkPhysicalDevicePipelineProtectedAccessFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT; - out_ext->pipelineProtectedAccess = in_ext->pipelineProtectedAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV: - { - VkPhysicalDeviceInheritedViewportScissorFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV); - const VkPhysicalDeviceInheritedViewportScissorFeaturesNV *in_ext = (const VkPhysicalDeviceInheritedViewportScissorFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV; - out_ext->inheritedViewportScissor2D = in_ext->inheritedViewportScissor2D; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT); - const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *in_ext = (const VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT; - out_ext->ycbcr2plane444Formats = in_ext->ycbcr2plane444Formats; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: - { - VkPhysicalDeviceProvokingVertexFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT); - const VkPhysicalDeviceProvokingVertexFeaturesEXT *in_ext = (const VkPhysicalDeviceProvokingVertexFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT; - out_ext->provokingVertexLast = in_ext->provokingVertexLast; - out_ext->transformFeedbackPreservesProvokingVertex = in_ext->transformFeedbackPreservesProvokingVertex; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceDescriptorBufferFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT); - const VkPhysicalDeviceDescriptorBufferFeaturesEXT *in_ext = (const VkPhysicalDeviceDescriptorBufferFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT; - out_ext->descriptorBuffer = in_ext->descriptorBuffer; - out_ext->descriptorBufferCaptureReplay = in_ext->descriptorBufferCaptureReplay; - out_ext->descriptorBufferImageLayoutIgnored = in_ext->descriptorBufferImageLayoutIgnored; - out_ext->descriptorBufferPushDescriptors = in_ext->descriptorBufferPushDescriptors; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES: - { - VkPhysicalDeviceShaderIntegerDotProductFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES); - const VkPhysicalDeviceShaderIntegerDotProductFeatures *in_ext = (const VkPhysicalDeviceShaderIntegerDotProductFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES; - out_ext->shaderIntegerDotProduct = in_ext->shaderIntegerDotProduct; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR: - { - VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR); - const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *in_ext = (const VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR; - out_ext->fragmentShaderBarycentric = in_ext->fragmentShaderBarycentric; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV: - { - VkPhysicalDeviceRayTracingMotionBlurFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV); - const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *in_ext = (const VkPhysicalDeviceRayTracingMotionBlurFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV; - out_ext->rayTracingMotionBlur = in_ext->rayTracingMotionBlur; - out_ext->rayTracingMotionBlurPipelineTraceRaysIndirect = in_ext->rayTracingMotionBlurPipelineTraceRaysIndirect; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT: - { - VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT); - const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *in_ext = (const VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT; - out_ext->formatRgba10x6WithoutYCbCrSampler = in_ext->formatRgba10x6WithoutYCbCrSampler; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES: - { - VkPhysicalDeviceDynamicRenderingFeatures32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES); - const VkPhysicalDeviceDynamicRenderingFeatures *in_ext = (const VkPhysicalDeviceDynamicRenderingFeatures *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES; - out_ext->dynamicRendering = in_ext->dynamicRendering; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT: - { - VkPhysicalDeviceImageViewMinLodFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT); - const VkPhysicalDeviceImageViewMinLodFeaturesEXT *in_ext = (const VkPhysicalDeviceImageViewMinLodFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT; - out_ext->minLod = in_ext->minLod; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT: - { - VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT); - const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *in_ext = (const VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT; - out_ext->rasterizationOrderColorAttachmentAccess = in_ext->rasterizationOrderColorAttachmentAccess; - out_ext->rasterizationOrderDepthAttachmentAccess = in_ext->rasterizationOrderDepthAttachmentAccess; - out_ext->rasterizationOrderStencilAttachmentAccess = in_ext->rasterizationOrderStencilAttachmentAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV: - { - VkPhysicalDeviceLinearColorAttachmentFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV); - const VkPhysicalDeviceLinearColorAttachmentFeaturesNV *in_ext = (const VkPhysicalDeviceLinearColorAttachmentFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV; - out_ext->linearColorAttachment = in_ext->linearColorAttachment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT: - { - VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT); - const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *in_ext = (const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT; - out_ext->graphicsPipelineLibrary = in_ext->graphicsPipelineLibrary; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE: - { - VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE); - const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *in_ext = (const VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE; - out_ext->descriptorSetHostMapping = in_ext->descriptorSetHostMapping; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT: - { - VkPhysicalDeviceNestedCommandBufferFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT); - const VkPhysicalDeviceNestedCommandBufferFeaturesEXT *in_ext = (const VkPhysicalDeviceNestedCommandBufferFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT; - out_ext->nestedCommandBuffer = in_ext->nestedCommandBuffer; - out_ext->nestedCommandBufferRendering = in_ext->nestedCommandBufferRendering; - out_ext->nestedCommandBufferSimultaneousUse = in_ext->nestedCommandBufferSimultaneousUse; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT: - { - VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT); - const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT; - out_ext->shaderModuleIdentifier = in_ext->shaderModuleIdentifier; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT); - const VkPhysicalDeviceImageCompressionControlFeaturesEXT *in_ext = (const VkPhysicalDeviceImageCompressionControlFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT; - out_ext->imageCompressionControl = in_ext->imageCompressionControl; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT: - { - VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT); - const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *in_ext = (const VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT; - out_ext->imageCompressionControlSwapchain = in_ext->imageCompressionControlSwapchain; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT: - { - VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT); - const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *in_ext = (const VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT; - out_ext->subpassMergeFeedback = in_ext->subpassMergeFeedback; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT: - { - VkPhysicalDeviceOpacityMicromapFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT); - const VkPhysicalDeviceOpacityMicromapFeaturesEXT *in_ext = (const VkPhysicalDeviceOpacityMicromapFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT; - out_ext->micromap = in_ext->micromap; - out_ext->micromapCaptureReplay = in_ext->micromapCaptureReplay; - out_ext->micromapHostCommands = in_ext->micromapHostCommands; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT: - { - VkPhysicalDevicePipelinePropertiesFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT); - const VkPhysicalDevicePipelinePropertiesFeaturesEXT *in_ext = (const VkPhysicalDevicePipelinePropertiesFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT; - out_ext->pipelinePropertiesIdentifier = in_ext->pipelinePropertiesIdentifier; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD: - { - VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD); - const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *in_ext = (const VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD; - out_ext->shaderEarlyAndLateFragmentTests = in_ext->shaderEarlyAndLateFragmentTests; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT: - { - VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT); - const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *in_ext = (const VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT; - out_ext->nonSeamlessCubeMap = in_ext->nonSeamlessCubeMap; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT: - { - VkPhysicalDevicePipelineRobustnessFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT); - const VkPhysicalDevicePipelineRobustnessFeaturesEXT *in_ext = (const VkPhysicalDevicePipelineRobustnessFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT; - out_ext->pipelineRobustness = in_ext->pipelineRobustness; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessingFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM); - const VkPhysicalDeviceImageProcessingFeaturesQCOM *in_ext = (const VkPhysicalDeviceImageProcessingFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM; - out_ext->textureSampleWeighted = in_ext->textureSampleWeighted; - out_ext->textureBoxFilter = in_ext->textureBoxFilter; - out_ext->textureBlockMatch = in_ext->textureBlockMatch; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM: - { - VkPhysicalDeviceTilePropertiesFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM); - const VkPhysicalDeviceTilePropertiesFeaturesQCOM *in_ext = (const VkPhysicalDeviceTilePropertiesFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM; - out_ext->tileProperties = in_ext->tileProperties; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT: - { - VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT); - const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *in_ext = (const VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT; - out_ext->attachmentFeedbackLoopLayout = in_ext->attachmentFeedbackLoopLayout; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT: - { - VkPhysicalDeviceDepthClampZeroOneFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT); - const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthClampZeroOneFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT; - out_ext->depthClampZeroOne = in_ext->depthClampZeroOne; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT: - { - VkPhysicalDeviceAddressBindingReportFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT); - const VkPhysicalDeviceAddressBindingReportFeaturesEXT *in_ext = (const VkPhysicalDeviceAddressBindingReportFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT; - out_ext->reportAddressBinding = in_ext->reportAddressBinding; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV: - { - VkPhysicalDeviceOpticalFlowFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV); - const VkPhysicalDeviceOpticalFlowFeaturesNV *in_ext = (const VkPhysicalDeviceOpticalFlowFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV; - out_ext->opticalFlow = in_ext->opticalFlow; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT: - { - VkPhysicalDeviceFaultFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT); - const VkPhysicalDeviceFaultFeaturesEXT *in_ext = (const VkPhysicalDeviceFaultFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT; - out_ext->deviceFault = in_ext->deviceFault; - out_ext->deviceFaultVendorBinary = in_ext->deviceFaultVendorBinary; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT: - { - VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT); - const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *in_ext = (const VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT; - out_ext->pipelineLibraryGroupHandles = in_ext->pipelineLibraryGroupHandles; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM: - { - VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM); - const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *in_ext = (const VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM; - out_ext->shaderCoreBuiltins = in_ext->shaderCoreBuiltins; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT: - { - VkPhysicalDeviceFrameBoundaryFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT); - const VkPhysicalDeviceFrameBoundaryFeaturesEXT *in_ext = (const VkPhysicalDeviceFrameBoundaryFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT; - out_ext->frameBoundary = in_ext->frameBoundary; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT: - { - VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT); - const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *in_ext = (const VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT; - out_ext->dynamicRenderingUnusedAttachments = in_ext->dynamicRenderingUnusedAttachments; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT: - { - VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT); - const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *in_ext = (const VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT; - out_ext->swapchainMaintenance1 = in_ext->swapchainMaintenance1; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT: - { - VkPhysicalDeviceDepthBiasControlFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT); - const VkPhysicalDeviceDepthBiasControlFeaturesEXT *in_ext = (const VkPhysicalDeviceDepthBiasControlFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT; - out_ext->depthBiasControl = in_ext->depthBiasControl; - out_ext->leastRepresentableValueForceUnormRepresentation = in_ext->leastRepresentableValueForceUnormRepresentation; - out_ext->floatRepresentation = in_ext->floatRepresentation; - out_ext->depthBiasExact = in_ext->depthBiasExact; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV: - { - VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV); - const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *in_ext = (const VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV; - out_ext->rayTracingInvocationReorder = in_ext->rayTracingInvocationReorder; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV: - { - VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV); - const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *in_ext = (const VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV; - out_ext->extendedSparseAddressSpace = in_ext->extendedSparseAddressSpace; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM); - const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *in_ext = (const VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM; - out_ext->multiviewPerViewViewports = in_ext->multiviewPerViewViewports; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR: - { - VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR); - const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *in_ext = (const VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR; - out_ext->rayTracingPositionFetch = in_ext->rayTracingPositionFetch; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM: - { - VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM); - const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *in_ext = (const VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM; - out_ext->multiviewPerViewRenderAreas = in_ext->multiviewPerViewRenderAreas; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT: - { - VkPhysicalDeviceShaderObjectFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT); - const VkPhysicalDeviceShaderObjectFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderObjectFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT; - out_ext->shaderObject = in_ext->shaderObject; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT: - { - VkPhysicalDeviceShaderTileImageFeaturesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT); - const VkPhysicalDeviceShaderTileImageFeaturesEXT *in_ext = (const VkPhysicalDeviceShaderTileImageFeaturesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT; - out_ext->shaderTileImageColorReadAccess = in_ext->shaderTileImageColorReadAccess; - out_ext->shaderTileImageDepthReadAccess = in_ext->shaderTileImageDepthReadAccess; - out_ext->shaderTileImageStencilReadAccess = in_ext->shaderTileImageStencilReadAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR: - { - VkPhysicalDeviceCooperativeMatrixFeaturesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR); - const VkPhysicalDeviceCooperativeMatrixFeaturesKHR *in_ext = (const VkPhysicalDeviceCooperativeMatrixFeaturesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR; - out_ext->cooperativeMatrix = in_ext->cooperativeMatrix; - out_ext->cooperativeMatrixRobustBufferAccess = in_ext->cooperativeMatrixRobustBufferAccess; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM: - { - VkPhysicalDeviceCubicClampFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM); - const VkPhysicalDeviceCubicClampFeaturesQCOM *in_ext = (const VkPhysicalDeviceCubicClampFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM; - out_ext->cubicRangeClamp = in_ext->cubicRangeClamp; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM: - { - VkPhysicalDeviceYcbcrDegammaFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM); - const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *in_ext = (const VkPhysicalDeviceYcbcrDegammaFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM; - out_ext->ycbcrDegamma = in_ext->ycbcrDegamma; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM: - { - VkPhysicalDeviceCubicWeightsFeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM); - const VkPhysicalDeviceCubicWeightsFeaturesQCOM *in_ext = (const VkPhysicalDeviceCubicWeightsFeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM; - out_ext->selectableCubicWeights = in_ext->selectableCubicWeights; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM: - { - VkPhysicalDeviceImageProcessing2FeaturesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM); - const VkPhysicalDeviceImageProcessing2FeaturesQCOM *in_ext = (const VkPhysicalDeviceImageProcessing2FeaturesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM; - out_ext->textureBlockMatch2 = in_ext->textureBlockMatch2; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV: - { - VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV); - const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *in_ext = (const VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; - out_ext->descriptorPoolOverallocation = in_ext->descriptorPoolOverallocation; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV: - { - VkPhysicalDeviceCudaKernelLaunchFeaturesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV); - const VkPhysicalDeviceCudaKernelLaunchFeaturesNV *in_ext = (const VkPhysicalDeviceCudaKernelLaunchFeaturesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV; - out_ext->cudaKernelLaunchFeatures = in_ext->cudaKernelLaunchFeatures; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM: - { - VkPhysicalDeviceSchedulingControlsFeaturesARM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM); - const VkPhysicalDeviceSchedulingControlsFeaturesARM *in_ext = (const VkPhysicalDeviceSchedulingControlsFeaturesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM; - out_ext->schedulingControls = in_ext->schedulingControls; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG: - { - VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG); - const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *in_ext = (const VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG; - out_ext->relaxedLineRasterization = in_ext->relaxedLineRasterization; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkFormatProperties2_win32_to_host(struct conversion_context *ctx, const VkFormatProperties232 *in, VkFormatProperties2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT: - { - VkSubpassResolvePerformanceQueryEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3: - { - VkFormatProperties3 *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkFormatProperties2_host_to_win32(const VkFormatProperties2 *in, VkFormatProperties232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - out->formatProperties = in->formatProperties; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT: - { - VkSubpassResolvePerformanceQueryEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT); - const VkSubpassResolvePerformanceQueryEXT *in_ext = (const VkSubpassResolvePerformanceQueryEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT; - out_ext->optimal = in_ext->optimal; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3: - { - VkFormatProperties332 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3); - const VkFormatProperties3 *in_ext = (const VkFormatProperties3 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3; - out_ext->linearTilingFeatures = in_ext->linearTilingFeatures; - out_ext->optimalTilingFeatures = in_ext->optimalTilingFeatures; - out_ext->bufferFeatures = in_ext->bufferFeatures; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkPhysicalDeviceFragmentShadingRateKHR_win32_to_host(const VkPhysicalDeviceFragmentShadingRateKHR32 *in, VkPhysicalDeviceFragmentShadingRateKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPhysicalDeviceFragmentShadingRateKHR_host_to_win32(const VkPhysicalDeviceFragmentShadingRateKHR *in, VkPhysicalDeviceFragmentShadingRateKHR32 *out) -{ - if (!in) return; - - out->sampleCounts = in->sampleCounts; - out->fragmentSize = in->fragmentSize; -} - -static inline VkPhysicalDeviceFragmentShadingRateKHR *convert_VkPhysicalDeviceFragmentShadingRateKHR_array_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceFragmentShadingRateKHR32 *in, uint32_t count) -{ - VkPhysicalDeviceFragmentShadingRateKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPhysicalDeviceFragmentShadingRateKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPhysicalDeviceFragmentShadingRateKHR_array_host_to_win32(const VkPhysicalDeviceFragmentShadingRateKHR *in, VkPhysicalDeviceFragmentShadingRateKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPhysicalDeviceFragmentShadingRateKHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkImageFormatProperties_host_to_win32(const VkImageFormatProperties *in, VkImageFormatProperties32 *out) -{ - if (!in) return; - - out->maxExtent = in->maxExtent; - out->maxMipLevels = in->maxMipLevels; - out->maxArrayLayers = in->maxArrayLayers; - out->sampleCounts = in->sampleCounts; - out->maxResourceSize = in->maxResourceSize; -} - -static inline void convert_VkPhysicalDeviceImageFormatInfo2_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceImageFormatInfo232 *in, VkPhysicalDeviceImageFormatInfo2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->format = in->format; - out->type = in->type; - out->tiling = in->tiling; - out->usage = in->usage; - out->flags = in->flags; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: - { - VkPhysicalDeviceExternalImageFormatInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExternalImageFormatInfo32 *in_ext = (const VkPhysicalDeviceExternalImageFormatInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO; - out_ext->pNext = NULL; - out_ext->handleType = in_ext->handleType; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: - { - VkImageFormatListCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageFormatListCreateInfo32 *in_ext = (const VkImageFormatListCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->viewFormatCount = in_ext->viewFormatCount; - out_ext->pViewFormats = (const VkFormat *)UlongToPtr(in_ext->pViewFormats); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: - { - VkImageStencilUsageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageStencilUsageCreateInfo32 *in_ext = (const VkImageStencilUsageCreateInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO; - out_ext->pNext = NULL; - out_ext->stencilUsage = in_ext->stencilUsage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT: - { - VkPhysicalDeviceImageViewImageFormatInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceImageViewImageFormatInfoEXT32 *in_ext = (const VkPhysicalDeviceImageViewImageFormatInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT; - out_ext->pNext = NULL; - out_ext->imageViewType = in_ext->imageViewType; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: - { - VkImageCompressionControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkImageCompressionControlEXT32 *in_ext = (const VkImageCompressionControlEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->compressionControlPlaneCount = in_ext->compressionControlPlaneCount; - out_ext->pFixedRateFlags = (VkImageCompressionFixedRateFlagsEXT *)UlongToPtr(in_ext->pFixedRateFlags); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV: - { - VkOpticalFlowImageFormatInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkOpticalFlowImageFormatInfoNV32 *in_ext = (const VkOpticalFlowImageFormatInfoNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV; - out_ext->pNext = NULL; - out_ext->usage = in_ext->usage; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkImageFormatProperties2_win32_to_host(struct conversion_context *ctx, const VkImageFormatProperties232 *in, VkImageFormatProperties2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES: - { - VkExternalImageFormatProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES: - { - VkSamplerYcbcrConversionImageFormatProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD: - { - VkTextureLODGatherFormatPropertiesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT: - { - VkFilterCubicImageViewImageFormatPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT: - { - VkHostImageCopyDevicePerformanceQueryEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: - { - VkImageCompressionPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkImageFormatProperties2_host_to_win32(const VkImageFormatProperties2 *in, VkImageFormatProperties232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - convert_VkImageFormatProperties_host_to_win32(&in->imageFormatProperties, &out->imageFormatProperties); - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES: - { - VkExternalImageFormatProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES); - const VkExternalImageFormatProperties *in_ext = (const VkExternalImageFormatProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES; - out_ext->externalMemoryProperties = in_ext->externalMemoryProperties; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES: - { - VkSamplerYcbcrConversionImageFormatProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES); - const VkSamplerYcbcrConversionImageFormatProperties *in_ext = (const VkSamplerYcbcrConversionImageFormatProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES; - out_ext->combinedImageSamplerDescriptorCount = in_ext->combinedImageSamplerDescriptorCount; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD: - { - VkTextureLODGatherFormatPropertiesAMD32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD); - const VkTextureLODGatherFormatPropertiesAMD *in_ext = (const VkTextureLODGatherFormatPropertiesAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD; - out_ext->supportsTextureGatherLODBiasAMD = in_ext->supportsTextureGatherLODBiasAMD; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT: - { - VkFilterCubicImageViewImageFormatPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT); - const VkFilterCubicImageViewImageFormatPropertiesEXT *in_ext = (const VkFilterCubicImageViewImageFormatPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT; - out_ext->filterCubic = in_ext->filterCubic; - out_ext->filterCubicMinmax = in_ext->filterCubicMinmax; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT: - { - VkHostImageCopyDevicePerformanceQueryEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT); - const VkHostImageCopyDevicePerformanceQueryEXT *in_ext = (const VkHostImageCopyDevicePerformanceQueryEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT; - out_ext->optimalDeviceAccess = in_ext->optimalDeviceAccess; - out_ext->identicalMemoryLayout = in_ext->identicalMemoryLayout; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: - { - VkImageCompressionPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT); - const VkImageCompressionPropertiesEXT *in_ext = (const VkImageCompressionPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; - out_ext->imageCompressionFlags = in_ext->imageCompressionFlags; - out_ext->imageCompressionFixedRateFlags = in_ext->imageCompressionFixedRateFlags; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkMemoryHeap_host_to_win32(const VkMemoryHeap *in, VkMemoryHeap32 *out) -{ - if (!in) return; - - out->size = in->size; - out->flags = in->flags; -} - -static inline void convert_VkMemoryHeap_array_host_to_win32(const VkMemoryHeap *in, VkMemoryHeap32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkMemoryHeap_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPhysicalDeviceMemoryProperties_host_to_win32(const VkPhysicalDeviceMemoryProperties *in, VkPhysicalDeviceMemoryProperties32 *out) -{ - if (!in) return; - - out->memoryTypeCount = in->memoryTypeCount; - memcpy(out->memoryTypes, in->memoryTypes, VK_MAX_MEMORY_TYPES * sizeof(VkMemoryType)); - out->memoryHeapCount = in->memoryHeapCount; - convert_VkMemoryHeap_array_host_to_win32(in->memoryHeaps, out->memoryHeaps, VK_MAX_MEMORY_HEAPS); -} - -static inline void convert_VkPhysicalDeviceMemoryProperties2_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceMemoryProperties232 *in, VkPhysicalDeviceMemoryProperties2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT: - { - VkPhysicalDeviceMemoryBudgetPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkPhysicalDeviceMemoryProperties2_host_to_win32(const VkPhysicalDeviceMemoryProperties2 *in, VkPhysicalDeviceMemoryProperties232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - convert_VkPhysicalDeviceMemoryProperties_host_to_win32(&in->memoryProperties, &out->memoryProperties); - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT: - { - VkPhysicalDeviceMemoryBudgetPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT); - const VkPhysicalDeviceMemoryBudgetPropertiesEXT *in_ext = (const VkPhysicalDeviceMemoryBudgetPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT; - memcpy(out_ext->heapBudget, in_ext->heapBudget, VK_MAX_MEMORY_HEAPS * sizeof(VkDeviceSize)); - memcpy(out_ext->heapUsage, in_ext->heapUsage, VK_MAX_MEMORY_HEAPS * sizeof(VkDeviceSize)); - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkMultisamplePropertiesEXT_win32_to_host(const VkMultisamplePropertiesEXT32 *in, VkMultisamplePropertiesEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMultisamplePropertiesEXT_host_to_win32(const VkMultisamplePropertiesEXT *in, VkMultisamplePropertiesEXT32 *out) -{ - if (!in) return; - - out->maxSampleLocationGridSize = in->maxSampleLocationGridSize; -} - -static inline void convert_VkOpticalFlowImageFormatInfoNV_win32_to_host(const VkOpticalFlowImageFormatInfoNV32 *in, VkOpticalFlowImageFormatInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->usage = in->usage; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkOpticalFlowImageFormatPropertiesNV_win32_to_host(const VkOpticalFlowImageFormatPropertiesNV32 *in, VkOpticalFlowImageFormatPropertiesNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkOpticalFlowImageFormatPropertiesNV_host_to_win32(const VkOpticalFlowImageFormatPropertiesNV *in, VkOpticalFlowImageFormatPropertiesNV32 *out) -{ - if (!in) return; - - out->format = in->format; -} - -static inline VkOpticalFlowImageFormatPropertiesNV *convert_VkOpticalFlowImageFormatPropertiesNV_array_win32_to_host(struct conversion_context *ctx, const VkOpticalFlowImageFormatPropertiesNV32 *in, uint32_t count) -{ - VkOpticalFlowImageFormatPropertiesNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkOpticalFlowImageFormatPropertiesNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkOpticalFlowImageFormatPropertiesNV_array_host_to_win32(const VkOpticalFlowImageFormatPropertiesNV *in, VkOpticalFlowImageFormatPropertiesNV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkOpticalFlowImageFormatPropertiesNV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPhysicalDeviceLimits_host_to_win32(const VkPhysicalDeviceLimits *in, VkPhysicalDeviceLimits32 *out) -{ - if (!in) return; - - out->maxImageDimension1D = in->maxImageDimension1D; - out->maxImageDimension2D = in->maxImageDimension2D; - out->maxImageDimension3D = in->maxImageDimension3D; - out->maxImageDimensionCube = in->maxImageDimensionCube; - out->maxImageArrayLayers = in->maxImageArrayLayers; - out->maxTexelBufferElements = in->maxTexelBufferElements; - out->maxUniformBufferRange = in->maxUniformBufferRange; - out->maxStorageBufferRange = in->maxStorageBufferRange; - out->maxPushConstantsSize = in->maxPushConstantsSize; - out->maxMemoryAllocationCount = in->maxMemoryAllocationCount; - out->maxSamplerAllocationCount = in->maxSamplerAllocationCount; - out->bufferImageGranularity = in->bufferImageGranularity; - out->sparseAddressSpaceSize = in->sparseAddressSpaceSize; - out->maxBoundDescriptorSets = in->maxBoundDescriptorSets; - out->maxPerStageDescriptorSamplers = in->maxPerStageDescriptorSamplers; - out->maxPerStageDescriptorUniformBuffers = in->maxPerStageDescriptorUniformBuffers; - out->maxPerStageDescriptorStorageBuffers = in->maxPerStageDescriptorStorageBuffers; - out->maxPerStageDescriptorSampledImages = in->maxPerStageDescriptorSampledImages; - out->maxPerStageDescriptorStorageImages = in->maxPerStageDescriptorStorageImages; - out->maxPerStageDescriptorInputAttachments = in->maxPerStageDescriptorInputAttachments; - out->maxPerStageResources = in->maxPerStageResources; - out->maxDescriptorSetSamplers = in->maxDescriptorSetSamplers; - out->maxDescriptorSetUniformBuffers = in->maxDescriptorSetUniformBuffers; - out->maxDescriptorSetUniformBuffersDynamic = in->maxDescriptorSetUniformBuffersDynamic; - out->maxDescriptorSetStorageBuffers = in->maxDescriptorSetStorageBuffers; - out->maxDescriptorSetStorageBuffersDynamic = in->maxDescriptorSetStorageBuffersDynamic; - out->maxDescriptorSetSampledImages = in->maxDescriptorSetSampledImages; - out->maxDescriptorSetStorageImages = in->maxDescriptorSetStorageImages; - out->maxDescriptorSetInputAttachments = in->maxDescriptorSetInputAttachments; - out->maxVertexInputAttributes = in->maxVertexInputAttributes; - out->maxVertexInputBindings = in->maxVertexInputBindings; - out->maxVertexInputAttributeOffset = in->maxVertexInputAttributeOffset; - out->maxVertexInputBindingStride = in->maxVertexInputBindingStride; - out->maxVertexOutputComponents = in->maxVertexOutputComponents; - out->maxTessellationGenerationLevel = in->maxTessellationGenerationLevel; - out->maxTessellationPatchSize = in->maxTessellationPatchSize; - out->maxTessellationControlPerVertexInputComponents = in->maxTessellationControlPerVertexInputComponents; - out->maxTessellationControlPerVertexOutputComponents = in->maxTessellationControlPerVertexOutputComponents; - out->maxTessellationControlPerPatchOutputComponents = in->maxTessellationControlPerPatchOutputComponents; - out->maxTessellationControlTotalOutputComponents = in->maxTessellationControlTotalOutputComponents; - out->maxTessellationEvaluationInputComponents = in->maxTessellationEvaluationInputComponents; - out->maxTessellationEvaluationOutputComponents = in->maxTessellationEvaluationOutputComponents; - out->maxGeometryShaderInvocations = in->maxGeometryShaderInvocations; - out->maxGeometryInputComponents = in->maxGeometryInputComponents; - out->maxGeometryOutputComponents = in->maxGeometryOutputComponents; - out->maxGeometryOutputVertices = in->maxGeometryOutputVertices; - out->maxGeometryTotalOutputComponents = in->maxGeometryTotalOutputComponents; - out->maxFragmentInputComponents = in->maxFragmentInputComponents; - out->maxFragmentOutputAttachments = in->maxFragmentOutputAttachments; - out->maxFragmentDualSrcAttachments = in->maxFragmentDualSrcAttachments; - out->maxFragmentCombinedOutputResources = in->maxFragmentCombinedOutputResources; - out->maxComputeSharedMemorySize = in->maxComputeSharedMemorySize; - memcpy(out->maxComputeWorkGroupCount, in->maxComputeWorkGroupCount, 3 * sizeof(uint32_t)); - out->maxComputeWorkGroupInvocations = in->maxComputeWorkGroupInvocations; - memcpy(out->maxComputeWorkGroupSize, in->maxComputeWorkGroupSize, 3 * sizeof(uint32_t)); - out->subPixelPrecisionBits = in->subPixelPrecisionBits; - out->subTexelPrecisionBits = in->subTexelPrecisionBits; - out->mipmapPrecisionBits = in->mipmapPrecisionBits; - out->maxDrawIndexedIndexValue = in->maxDrawIndexedIndexValue; - out->maxDrawIndirectCount = in->maxDrawIndirectCount; - out->maxSamplerLodBias = in->maxSamplerLodBias; - out->maxSamplerAnisotropy = in->maxSamplerAnisotropy; - out->maxViewports = in->maxViewports; - memcpy(out->maxViewportDimensions, in->maxViewportDimensions, 2 * sizeof(uint32_t)); - memcpy(out->viewportBoundsRange, in->viewportBoundsRange, 2 * sizeof(float)); - out->viewportSubPixelBits = in->viewportSubPixelBits; - out->minMemoryMapAlignment = in->minMemoryMapAlignment; - out->minTexelBufferOffsetAlignment = in->minTexelBufferOffsetAlignment; - out->minUniformBufferOffsetAlignment = in->minUniformBufferOffsetAlignment; - out->minStorageBufferOffsetAlignment = in->minStorageBufferOffsetAlignment; - out->minTexelOffset = in->minTexelOffset; - out->maxTexelOffset = in->maxTexelOffset; - out->minTexelGatherOffset = in->minTexelGatherOffset; - out->maxTexelGatherOffset = in->maxTexelGatherOffset; - out->minInterpolationOffset = in->minInterpolationOffset; - out->maxInterpolationOffset = in->maxInterpolationOffset; - out->subPixelInterpolationOffsetBits = in->subPixelInterpolationOffsetBits; - out->maxFramebufferWidth = in->maxFramebufferWidth; - out->maxFramebufferHeight = in->maxFramebufferHeight; - out->maxFramebufferLayers = in->maxFramebufferLayers; - out->framebufferColorSampleCounts = in->framebufferColorSampleCounts; - out->framebufferDepthSampleCounts = in->framebufferDepthSampleCounts; - out->framebufferStencilSampleCounts = in->framebufferStencilSampleCounts; - out->framebufferNoAttachmentsSampleCounts = in->framebufferNoAttachmentsSampleCounts; - out->maxColorAttachments = in->maxColorAttachments; - out->sampledImageColorSampleCounts = in->sampledImageColorSampleCounts; - out->sampledImageIntegerSampleCounts = in->sampledImageIntegerSampleCounts; - out->sampledImageDepthSampleCounts = in->sampledImageDepthSampleCounts; - out->sampledImageStencilSampleCounts = in->sampledImageStencilSampleCounts; - out->storageImageSampleCounts = in->storageImageSampleCounts; - out->maxSampleMaskWords = in->maxSampleMaskWords; - out->timestampComputeAndGraphics = in->timestampComputeAndGraphics; - out->timestampPeriod = in->timestampPeriod; - out->maxClipDistances = in->maxClipDistances; - out->maxCullDistances = in->maxCullDistances; - out->maxCombinedClipAndCullDistances = in->maxCombinedClipAndCullDistances; - out->discreteQueuePriorities = in->discreteQueuePriorities; - memcpy(out->pointSizeRange, in->pointSizeRange, 2 * sizeof(float)); - memcpy(out->lineWidthRange, in->lineWidthRange, 2 * sizeof(float)); - out->pointSizeGranularity = in->pointSizeGranularity; - out->lineWidthGranularity = in->lineWidthGranularity; - out->strictLines = in->strictLines; - out->standardSampleLocations = in->standardSampleLocations; - out->optimalBufferCopyOffsetAlignment = in->optimalBufferCopyOffsetAlignment; - out->optimalBufferCopyRowPitchAlignment = in->optimalBufferCopyRowPitchAlignment; - out->nonCoherentAtomSize = in->nonCoherentAtomSize; -} - -static inline void convert_VkPhysicalDeviceProperties_host_to_win32(const VkPhysicalDeviceProperties *in, VkPhysicalDeviceProperties32 *out) -{ - if (!in) return; - - out->apiVersion = in->apiVersion; - out->driverVersion = in->driverVersion; - out->vendorID = in->vendorID; - out->deviceID = in->deviceID; - out->deviceType = in->deviceType; - memcpy(out->deviceName, in->deviceName, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE * sizeof(char)); - memcpy(out->pipelineCacheUUID, in->pipelineCacheUUID, VK_UUID_SIZE * sizeof(uint8_t)); - convert_VkPhysicalDeviceLimits_host_to_win32(&in->limits, &out->limits); - out->sparseProperties = in->sparseProperties; -} - -static inline void convert_VkPhysicalDeviceProperties2_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceProperties232 *in, VkPhysicalDeviceProperties2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT: - { - VkPhysicalDeviceMultiDrawPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR: - { - VkPhysicalDevicePushDescriptorPropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES: - { - VkPhysicalDeviceDriverProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: - { - VkPhysicalDeviceIDProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES: - { - VkPhysicalDeviceMultiviewProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT: - { - VkPhysicalDeviceDiscardRectanglePropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: - { - VkPhysicalDeviceSubgroupProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: - { - VkPhysicalDevicePointClippingProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES: - { - VkPhysicalDeviceProtectedMemoryProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES: - { - VkPhysicalDeviceSamplerFilterMinmaxProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: - { - VkPhysicalDeviceSampleLocationsPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT: - { - VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES: - { - VkPhysicalDeviceInlineUniformBlockProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: - { - VkPhysicalDeviceMaintenance3Properties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES: - { - VkPhysicalDeviceMaintenance4Properties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR: - { - VkPhysicalDeviceMaintenance5PropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES: - { - VkPhysicalDeviceFloatControlsProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: - { - VkPhysicalDeviceExternalMemoryHostPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT: - { - VkPhysicalDeviceConservativeRasterizationPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD: - { - VkPhysicalDeviceShaderCorePropertiesAMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD: - { - VkPhysicalDeviceShaderCoreProperties2AMD *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES: - { - VkPhysicalDeviceDescriptorIndexingProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES: - { - VkPhysicalDeviceTimelineSemaphoreProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT: - { - VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: - { - VkPhysicalDevicePCIBusInfoPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES: - { - VkPhysicalDeviceDepthStencilResolveProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT: - { - VkPhysicalDeviceTransformFeedbackPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV: - { - VkPhysicalDeviceCopyMemoryIndirectPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV: - { - VkPhysicalDeviceMemoryDecompressionPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV: - { - VkPhysicalDeviceShadingRateImagePropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV: - { - VkPhysicalDeviceMeshShaderPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT: - { - VkPhysicalDeviceMeshShaderPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR: - { - VkPhysicalDeviceAccelerationStructurePropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR: - { - VkPhysicalDeviceRayTracingPipelinePropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV: - { - VkPhysicalDeviceRayTracingPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT: - { - VkPhysicalDeviceFragmentDensityMapPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT: - { - VkPhysicalDeviceFragmentDensityMap2PropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM: - { - VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV: - { - VkPhysicalDeviceCooperativeMatrixPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR: - { - VkPhysicalDevicePerformanceQueryPropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV: - { - VkPhysicalDeviceShaderSMBuiltinsPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES: - { - VkPhysicalDeviceTexelBufferAlignmentProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES: - { - VkPhysicalDeviceSubgroupSizeControlProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI: - { - VkPhysicalDeviceSubpassShadingPropertiesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI: - { - VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT: - { - VkPhysicalDeviceLineRasterizationPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES: - { - VkPhysicalDeviceVulkan11Properties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES: - { - VkPhysicalDeviceVulkan12Properties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES: - { - VkPhysicalDeviceVulkan13Properties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT: - { - VkPhysicalDeviceCustomBorderColorPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT: - { - VkPhysicalDeviceExtendedDynamicState3PropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceExtendedDynamicState3PropertiesEXT32 *in_ext = (const VkPhysicalDeviceExtendedDynamicState3PropertiesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_ext->dynamicPrimitiveTopologyUnrestricted = in_ext->dynamicPrimitiveTopologyUnrestricted; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT: - { - VkPhysicalDeviceRobustness2PropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR: - { - VkPhysicalDeviceFragmentShadingRatePropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV: - { - VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV32 *in_ext = (const VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV; - out_ext->pNext = NULL; - out_ext->maxFragmentShadingRateInvocationCount = in_ext->maxFragmentShadingRateInvocationCount; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT: - { - VkPhysicalDeviceHostImageCopyPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceHostImageCopyPropertiesEXT32 *in_ext = (const VkPhysicalDeviceHostImageCopyPropertiesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_ext->copySrcLayoutCount = in_ext->copySrcLayoutCount; - out_ext->pCopySrcLayouts = (VkImageLayout *)UlongToPtr(in_ext->pCopySrcLayouts); - out_ext->copyDstLayoutCount = in_ext->copyDstLayoutCount; - out_ext->pCopyDstLayouts = (VkImageLayout *)UlongToPtr(in_ext->pCopyDstLayouts); - memcpy(out_ext->optimalTilingLayoutUUID, in_ext->optimalTilingLayoutUUID, VK_UUID_SIZE * sizeof(uint8_t)); - out_ext->identicalMemoryTypeRequirements = in_ext->identicalMemoryTypeRequirements; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT: - { - VkPhysicalDeviceProvokingVertexPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT: - { - VkPhysicalDeviceDescriptorBufferPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT: - { - VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES: - { - VkPhysicalDeviceShaderIntegerDotProductProperties *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR: - { - VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT: - { - VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT32 *in_ext = (const VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_ext->graphicsPipelineLibraryFastLinking = in_ext->graphicsPipelineLibraryFastLinking; - out_ext->graphicsPipelineLibraryIndependentInterpolationDecoration = in_ext->graphicsPipelineLibraryIndependentInterpolationDecoration; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT: - { - VkPhysicalDeviceNestedCommandBufferPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceNestedCommandBufferPropertiesEXT32 *in_ext = (const VkPhysicalDeviceNestedCommandBufferPropertiesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_ext->maxCommandBufferNestingLevel = in_ext->maxCommandBufferNestingLevel; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT: - { - VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT: - { - VkPhysicalDeviceOpacityMicromapPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT: - { - VkPhysicalDevicePipelineRobustnessPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM: - { - VkPhysicalDeviceImageProcessingPropertiesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV: - { - VkPhysicalDeviceOpticalFlowPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM: - { - VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV: - { - VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV: - { - VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM: - { - VkPhysicalDeviceShaderCorePropertiesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT: - { - VkPhysicalDeviceShaderObjectPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT: - { - VkPhysicalDeviceShaderTileImagePropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR: - { - VkPhysicalDeviceCooperativeMatrixPropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM: - { - VkPhysicalDeviceImageProcessing2PropertiesQCOM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT: - { - VkPhysicalDeviceLayeredDriverPropertiesMSFT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV: - { - VkPhysicalDeviceCudaKernelLaunchPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM: - { - VkPhysicalDeviceSchedulingControlsPropertiesARM *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPhysicalDeviceSchedulingControlsPropertiesARM32 *in_ext = (const VkPhysicalDeviceSchedulingControlsPropertiesARM32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM; - out_ext->pNext = NULL; - out_ext->schedulingControlsFlags = in_ext->schedulingControlsFlags; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkPhysicalDeviceProperties2_host_to_win32(const VkPhysicalDeviceProperties2 *in, VkPhysicalDeviceProperties232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - convert_VkPhysicalDeviceProperties_host_to_win32(&in->properties, &out->properties); - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV: - { - VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV); - const VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV *in_ext = (const VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV; - out_ext->maxGraphicsShaderGroupCount = in_ext->maxGraphicsShaderGroupCount; - out_ext->maxIndirectSequenceCount = in_ext->maxIndirectSequenceCount; - out_ext->maxIndirectCommandsTokenCount = in_ext->maxIndirectCommandsTokenCount; - out_ext->maxIndirectCommandsStreamCount = in_ext->maxIndirectCommandsStreamCount; - out_ext->maxIndirectCommandsTokenOffset = in_ext->maxIndirectCommandsTokenOffset; - out_ext->maxIndirectCommandsStreamStride = in_ext->maxIndirectCommandsStreamStride; - out_ext->minSequencesCountBufferOffsetAlignment = in_ext->minSequencesCountBufferOffsetAlignment; - out_ext->minSequencesIndexBufferOffsetAlignment = in_ext->minSequencesIndexBufferOffsetAlignment; - out_ext->minIndirectCommandsBufferOffsetAlignment = in_ext->minIndirectCommandsBufferOffsetAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT: - { - VkPhysicalDeviceMultiDrawPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT); - const VkPhysicalDeviceMultiDrawPropertiesEXT *in_ext = (const VkPhysicalDeviceMultiDrawPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT; - out_ext->maxMultiDrawCount = in_ext->maxMultiDrawCount; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR: - { - VkPhysicalDevicePushDescriptorPropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR); - const VkPhysicalDevicePushDescriptorPropertiesKHR *in_ext = (const VkPhysicalDevicePushDescriptorPropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR; - out_ext->maxPushDescriptors = in_ext->maxPushDescriptors; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES: - { - VkPhysicalDeviceDriverProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES); - const VkPhysicalDeviceDriverProperties *in_ext = (const VkPhysicalDeviceDriverProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES; - out_ext->driverID = in_ext->driverID; - memcpy(out_ext->driverName, in_ext->driverName, VK_MAX_DRIVER_NAME_SIZE * sizeof(char)); - memcpy(out_ext->driverInfo, in_ext->driverInfo, VK_MAX_DRIVER_INFO_SIZE * sizeof(char)); - out_ext->conformanceVersion = in_ext->conformanceVersion; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: - { - VkPhysicalDeviceIDProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES); - const VkPhysicalDeviceIDProperties *in_ext = (const VkPhysicalDeviceIDProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; - memcpy(out_ext->deviceUUID, in_ext->deviceUUID, VK_UUID_SIZE * sizeof(uint8_t)); - memcpy(out_ext->driverUUID, in_ext->driverUUID, VK_UUID_SIZE * sizeof(uint8_t)); - memcpy(out_ext->deviceLUID, in_ext->deviceLUID, VK_LUID_SIZE * sizeof(uint8_t)); - out_ext->deviceNodeMask = in_ext->deviceNodeMask; - out_ext->deviceLUIDValid = in_ext->deviceLUIDValid; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES: - { - VkPhysicalDeviceMultiviewProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES); - const VkPhysicalDeviceMultiviewProperties *in_ext = (const VkPhysicalDeviceMultiviewProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES; - out_ext->maxMultiviewViewCount = in_ext->maxMultiviewViewCount; - out_ext->maxMultiviewInstanceIndex = in_ext->maxMultiviewInstanceIndex; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT: - { - VkPhysicalDeviceDiscardRectanglePropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT); - const VkPhysicalDeviceDiscardRectanglePropertiesEXT *in_ext = (const VkPhysicalDeviceDiscardRectanglePropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT; - out_ext->maxDiscardRectangles = in_ext->maxDiscardRectangles; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: - { - VkPhysicalDeviceSubgroupProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES); - const VkPhysicalDeviceSubgroupProperties *in_ext = (const VkPhysicalDeviceSubgroupProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; - out_ext->subgroupSize = in_ext->subgroupSize; - out_ext->supportedStages = in_ext->supportedStages; - out_ext->supportedOperations = in_ext->supportedOperations; - out_ext->quadOperationsInAllStages = in_ext->quadOperationsInAllStages; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: - { - VkPhysicalDevicePointClippingProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES); - const VkPhysicalDevicePointClippingProperties *in_ext = (const VkPhysicalDevicePointClippingProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES; - out_ext->pointClippingBehavior = in_ext->pointClippingBehavior; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES: - { - VkPhysicalDeviceProtectedMemoryProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES); - const VkPhysicalDeviceProtectedMemoryProperties *in_ext = (const VkPhysicalDeviceProtectedMemoryProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES; - out_ext->protectedNoFault = in_ext->protectedNoFault; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES: - { - VkPhysicalDeviceSamplerFilterMinmaxProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES); - const VkPhysicalDeviceSamplerFilterMinmaxProperties *in_ext = (const VkPhysicalDeviceSamplerFilterMinmaxProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES; - out_ext->filterMinmaxSingleComponentFormats = in_ext->filterMinmaxSingleComponentFormats; - out_ext->filterMinmaxImageComponentMapping = in_ext->filterMinmaxImageComponentMapping; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: - { - VkPhysicalDeviceSampleLocationsPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT); - const VkPhysicalDeviceSampleLocationsPropertiesEXT *in_ext = (const VkPhysicalDeviceSampleLocationsPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT; - out_ext->sampleLocationSampleCounts = in_ext->sampleLocationSampleCounts; - out_ext->maxSampleLocationGridSize = in_ext->maxSampleLocationGridSize; - memcpy(out_ext->sampleLocationCoordinateRange, in_ext->sampleLocationCoordinateRange, 2 * sizeof(float)); - out_ext->sampleLocationSubPixelBits = in_ext->sampleLocationSubPixelBits; - out_ext->variableSampleLocations = in_ext->variableSampleLocations; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT: - { - VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT); - const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT *in_ext = (const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT; - out_ext->advancedBlendMaxColorAttachments = in_ext->advancedBlendMaxColorAttachments; - out_ext->advancedBlendIndependentBlend = in_ext->advancedBlendIndependentBlend; - out_ext->advancedBlendNonPremultipliedSrcColor = in_ext->advancedBlendNonPremultipliedSrcColor; - out_ext->advancedBlendNonPremultipliedDstColor = in_ext->advancedBlendNonPremultipliedDstColor; - out_ext->advancedBlendCorrelatedOverlap = in_ext->advancedBlendCorrelatedOverlap; - out_ext->advancedBlendAllOperations = in_ext->advancedBlendAllOperations; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES: - { - VkPhysicalDeviceInlineUniformBlockProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES); - const VkPhysicalDeviceInlineUniformBlockProperties *in_ext = (const VkPhysicalDeviceInlineUniformBlockProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES; - out_ext->maxInlineUniformBlockSize = in_ext->maxInlineUniformBlockSize; - out_ext->maxPerStageDescriptorInlineUniformBlocks = in_ext->maxPerStageDescriptorInlineUniformBlocks; - out_ext->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks = in_ext->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - out_ext->maxDescriptorSetInlineUniformBlocks = in_ext->maxDescriptorSetInlineUniformBlocks; - out_ext->maxDescriptorSetUpdateAfterBindInlineUniformBlocks = in_ext->maxDescriptorSetUpdateAfterBindInlineUniformBlocks; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: - { - VkPhysicalDeviceMaintenance3Properties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES); - const VkPhysicalDeviceMaintenance3Properties *in_ext = (const VkPhysicalDeviceMaintenance3Properties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; - out_ext->maxPerSetDescriptors = in_ext->maxPerSetDescriptors; - out_ext->maxMemoryAllocationSize = in_ext->maxMemoryAllocationSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES: - { - VkPhysicalDeviceMaintenance4Properties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES); - const VkPhysicalDeviceMaintenance4Properties *in_ext = (const VkPhysicalDeviceMaintenance4Properties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES; - out_ext->maxBufferSize = in_ext->maxBufferSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR: - { - VkPhysicalDeviceMaintenance5PropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR); - const VkPhysicalDeviceMaintenance5PropertiesKHR *in_ext = (const VkPhysicalDeviceMaintenance5PropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR; - out_ext->earlyFragmentMultisampleCoverageAfterSampleCounting = in_ext->earlyFragmentMultisampleCoverageAfterSampleCounting; - out_ext->earlyFragmentSampleMaskTestBeforeSampleCounting = in_ext->earlyFragmentSampleMaskTestBeforeSampleCounting; - out_ext->depthStencilSwizzleOneSupport = in_ext->depthStencilSwizzleOneSupport; - out_ext->polygonModePointSize = in_ext->polygonModePointSize; - out_ext->nonStrictSinglePixelWideLinesUseParallelogram = in_ext->nonStrictSinglePixelWideLinesUseParallelogram; - out_ext->nonStrictWideLinesUseParallelogram = in_ext->nonStrictWideLinesUseParallelogram; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES: - { - VkPhysicalDeviceFloatControlsProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES); - const VkPhysicalDeviceFloatControlsProperties *in_ext = (const VkPhysicalDeviceFloatControlsProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES; - out_ext->denormBehaviorIndependence = in_ext->denormBehaviorIndependence; - out_ext->roundingModeIndependence = in_ext->roundingModeIndependence; - out_ext->shaderSignedZeroInfNanPreserveFloat16 = in_ext->shaderSignedZeroInfNanPreserveFloat16; - out_ext->shaderSignedZeroInfNanPreserveFloat32 = in_ext->shaderSignedZeroInfNanPreserveFloat32; - out_ext->shaderSignedZeroInfNanPreserveFloat64 = in_ext->shaderSignedZeroInfNanPreserveFloat64; - out_ext->shaderDenormPreserveFloat16 = in_ext->shaderDenormPreserveFloat16; - out_ext->shaderDenormPreserveFloat32 = in_ext->shaderDenormPreserveFloat32; - out_ext->shaderDenormPreserveFloat64 = in_ext->shaderDenormPreserveFloat64; - out_ext->shaderDenormFlushToZeroFloat16 = in_ext->shaderDenormFlushToZeroFloat16; - out_ext->shaderDenormFlushToZeroFloat32 = in_ext->shaderDenormFlushToZeroFloat32; - out_ext->shaderDenormFlushToZeroFloat64 = in_ext->shaderDenormFlushToZeroFloat64; - out_ext->shaderRoundingModeRTEFloat16 = in_ext->shaderRoundingModeRTEFloat16; - out_ext->shaderRoundingModeRTEFloat32 = in_ext->shaderRoundingModeRTEFloat32; - out_ext->shaderRoundingModeRTEFloat64 = in_ext->shaderRoundingModeRTEFloat64; - out_ext->shaderRoundingModeRTZFloat16 = in_ext->shaderRoundingModeRTZFloat16; - out_ext->shaderRoundingModeRTZFloat32 = in_ext->shaderRoundingModeRTZFloat32; - out_ext->shaderRoundingModeRTZFloat64 = in_ext->shaderRoundingModeRTZFloat64; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: - { - VkPhysicalDeviceExternalMemoryHostPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT); - const VkPhysicalDeviceExternalMemoryHostPropertiesEXT *in_ext = (const VkPhysicalDeviceExternalMemoryHostPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT; - out_ext->minImportedHostPointerAlignment = in_ext->minImportedHostPointerAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT: - { - VkPhysicalDeviceConservativeRasterizationPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT); - const VkPhysicalDeviceConservativeRasterizationPropertiesEXT *in_ext = (const VkPhysicalDeviceConservativeRasterizationPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT; - out_ext->primitiveOverestimationSize = in_ext->primitiveOverestimationSize; - out_ext->maxExtraPrimitiveOverestimationSize = in_ext->maxExtraPrimitiveOverestimationSize; - out_ext->extraPrimitiveOverestimationSizeGranularity = in_ext->extraPrimitiveOverestimationSizeGranularity; - out_ext->primitiveUnderestimation = in_ext->primitiveUnderestimation; - out_ext->conservativePointAndLineRasterization = in_ext->conservativePointAndLineRasterization; - out_ext->degenerateTrianglesRasterized = in_ext->degenerateTrianglesRasterized; - out_ext->degenerateLinesRasterized = in_ext->degenerateLinesRasterized; - out_ext->fullyCoveredFragmentShaderInputVariable = in_ext->fullyCoveredFragmentShaderInputVariable; - out_ext->conservativeRasterizationPostDepthCoverage = in_ext->conservativeRasterizationPostDepthCoverage; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD: - { - VkPhysicalDeviceShaderCorePropertiesAMD32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD); - const VkPhysicalDeviceShaderCorePropertiesAMD *in_ext = (const VkPhysicalDeviceShaderCorePropertiesAMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD; - out_ext->shaderEngineCount = in_ext->shaderEngineCount; - out_ext->shaderArraysPerEngineCount = in_ext->shaderArraysPerEngineCount; - out_ext->computeUnitsPerShaderArray = in_ext->computeUnitsPerShaderArray; - out_ext->simdPerComputeUnit = in_ext->simdPerComputeUnit; - out_ext->wavefrontsPerSimd = in_ext->wavefrontsPerSimd; - out_ext->wavefrontSize = in_ext->wavefrontSize; - out_ext->sgprsPerSimd = in_ext->sgprsPerSimd; - out_ext->minSgprAllocation = in_ext->minSgprAllocation; - out_ext->maxSgprAllocation = in_ext->maxSgprAllocation; - out_ext->sgprAllocationGranularity = in_ext->sgprAllocationGranularity; - out_ext->vgprsPerSimd = in_ext->vgprsPerSimd; - out_ext->minVgprAllocation = in_ext->minVgprAllocation; - out_ext->maxVgprAllocation = in_ext->maxVgprAllocation; - out_ext->vgprAllocationGranularity = in_ext->vgprAllocationGranularity; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD: - { - VkPhysicalDeviceShaderCoreProperties2AMD32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD); - const VkPhysicalDeviceShaderCoreProperties2AMD *in_ext = (const VkPhysicalDeviceShaderCoreProperties2AMD *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD; - out_ext->shaderCoreFeatures = in_ext->shaderCoreFeatures; - out_ext->activeComputeUnitCount = in_ext->activeComputeUnitCount; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES: - { - VkPhysicalDeviceDescriptorIndexingProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES); - const VkPhysicalDeviceDescriptorIndexingProperties *in_ext = (const VkPhysicalDeviceDescriptorIndexingProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES; - out_ext->maxUpdateAfterBindDescriptorsInAllPools = in_ext->maxUpdateAfterBindDescriptorsInAllPools; - out_ext->shaderUniformBufferArrayNonUniformIndexingNative = in_ext->shaderUniformBufferArrayNonUniformIndexingNative; - out_ext->shaderSampledImageArrayNonUniformIndexingNative = in_ext->shaderSampledImageArrayNonUniformIndexingNative; - out_ext->shaderStorageBufferArrayNonUniformIndexingNative = in_ext->shaderStorageBufferArrayNonUniformIndexingNative; - out_ext->shaderStorageImageArrayNonUniformIndexingNative = in_ext->shaderStorageImageArrayNonUniformIndexingNative; - out_ext->shaderInputAttachmentArrayNonUniformIndexingNative = in_ext->shaderInputAttachmentArrayNonUniformIndexingNative; - out_ext->robustBufferAccessUpdateAfterBind = in_ext->robustBufferAccessUpdateAfterBind; - out_ext->quadDivergentImplicitLod = in_ext->quadDivergentImplicitLod; - out_ext->maxPerStageDescriptorUpdateAfterBindSamplers = in_ext->maxPerStageDescriptorUpdateAfterBindSamplers; - out_ext->maxPerStageDescriptorUpdateAfterBindUniformBuffers = in_ext->maxPerStageDescriptorUpdateAfterBindUniformBuffers; - out_ext->maxPerStageDescriptorUpdateAfterBindStorageBuffers = in_ext->maxPerStageDescriptorUpdateAfterBindStorageBuffers; - out_ext->maxPerStageDescriptorUpdateAfterBindSampledImages = in_ext->maxPerStageDescriptorUpdateAfterBindSampledImages; - out_ext->maxPerStageDescriptorUpdateAfterBindStorageImages = in_ext->maxPerStageDescriptorUpdateAfterBindStorageImages; - out_ext->maxPerStageDescriptorUpdateAfterBindInputAttachments = in_ext->maxPerStageDescriptorUpdateAfterBindInputAttachments; - out_ext->maxPerStageUpdateAfterBindResources = in_ext->maxPerStageUpdateAfterBindResources; - out_ext->maxDescriptorSetUpdateAfterBindSamplers = in_ext->maxDescriptorSetUpdateAfterBindSamplers; - out_ext->maxDescriptorSetUpdateAfterBindUniformBuffers = in_ext->maxDescriptorSetUpdateAfterBindUniformBuffers; - out_ext->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = in_ext->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - out_ext->maxDescriptorSetUpdateAfterBindStorageBuffers = in_ext->maxDescriptorSetUpdateAfterBindStorageBuffers; - out_ext->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = in_ext->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - out_ext->maxDescriptorSetUpdateAfterBindSampledImages = in_ext->maxDescriptorSetUpdateAfterBindSampledImages; - out_ext->maxDescriptorSetUpdateAfterBindStorageImages = in_ext->maxDescriptorSetUpdateAfterBindStorageImages; - out_ext->maxDescriptorSetUpdateAfterBindInputAttachments = in_ext->maxDescriptorSetUpdateAfterBindInputAttachments; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES: - { - VkPhysicalDeviceTimelineSemaphoreProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES); - const VkPhysicalDeviceTimelineSemaphoreProperties *in_ext = (const VkPhysicalDeviceTimelineSemaphoreProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES; - out_ext->maxTimelineSemaphoreValueDifference = in_ext->maxTimelineSemaphoreValueDifference; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT: - { - VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT); - const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *in_ext = (const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; - out_ext->maxVertexAttribDivisor = in_ext->maxVertexAttribDivisor; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: - { - VkPhysicalDevicePCIBusInfoPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT); - const VkPhysicalDevicePCIBusInfoPropertiesEXT *in_ext = (const VkPhysicalDevicePCIBusInfoPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT; - out_ext->pciDomain = in_ext->pciDomain; - out_ext->pciBus = in_ext->pciBus; - out_ext->pciDevice = in_ext->pciDevice; - out_ext->pciFunction = in_ext->pciFunction; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES: - { - VkPhysicalDeviceDepthStencilResolveProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES); - const VkPhysicalDeviceDepthStencilResolveProperties *in_ext = (const VkPhysicalDeviceDepthStencilResolveProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES; - out_ext->supportedDepthResolveModes = in_ext->supportedDepthResolveModes; - out_ext->supportedStencilResolveModes = in_ext->supportedStencilResolveModes; - out_ext->independentResolveNone = in_ext->independentResolveNone; - out_ext->independentResolve = in_ext->independentResolve; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT: - { - VkPhysicalDeviceTransformFeedbackPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT); - const VkPhysicalDeviceTransformFeedbackPropertiesEXT *in_ext = (const VkPhysicalDeviceTransformFeedbackPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; - out_ext->maxTransformFeedbackStreams = in_ext->maxTransformFeedbackStreams; - out_ext->maxTransformFeedbackBuffers = in_ext->maxTransformFeedbackBuffers; - out_ext->maxTransformFeedbackBufferSize = in_ext->maxTransformFeedbackBufferSize; - out_ext->maxTransformFeedbackStreamDataSize = in_ext->maxTransformFeedbackStreamDataSize; - out_ext->maxTransformFeedbackBufferDataSize = in_ext->maxTransformFeedbackBufferDataSize; - out_ext->maxTransformFeedbackBufferDataStride = in_ext->maxTransformFeedbackBufferDataStride; - out_ext->transformFeedbackQueries = in_ext->transformFeedbackQueries; - out_ext->transformFeedbackStreamsLinesTriangles = in_ext->transformFeedbackStreamsLinesTriangles; - out_ext->transformFeedbackRasterizationStreamSelect = in_ext->transformFeedbackRasterizationStreamSelect; - out_ext->transformFeedbackDraw = in_ext->transformFeedbackDraw; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV: - { - VkPhysicalDeviceCopyMemoryIndirectPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV); - const VkPhysicalDeviceCopyMemoryIndirectPropertiesNV *in_ext = (const VkPhysicalDeviceCopyMemoryIndirectPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV; - out_ext->supportedQueues = in_ext->supportedQueues; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV: - { - VkPhysicalDeviceMemoryDecompressionPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV); - const VkPhysicalDeviceMemoryDecompressionPropertiesNV *in_ext = (const VkPhysicalDeviceMemoryDecompressionPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV; - out_ext->decompressionMethods = in_ext->decompressionMethods; - out_ext->maxDecompressionIndirectCount = in_ext->maxDecompressionIndirectCount; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV: - { - VkPhysicalDeviceShadingRateImagePropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV); - const VkPhysicalDeviceShadingRateImagePropertiesNV *in_ext = (const VkPhysicalDeviceShadingRateImagePropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV; - out_ext->shadingRateTexelSize = in_ext->shadingRateTexelSize; - out_ext->shadingRatePaletteSize = in_ext->shadingRatePaletteSize; - out_ext->shadingRateMaxCoarseSamples = in_ext->shadingRateMaxCoarseSamples; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV: - { - VkPhysicalDeviceMeshShaderPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV); - const VkPhysicalDeviceMeshShaderPropertiesNV *in_ext = (const VkPhysicalDeviceMeshShaderPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV; - out_ext->maxDrawMeshTasksCount = in_ext->maxDrawMeshTasksCount; - out_ext->maxTaskWorkGroupInvocations = in_ext->maxTaskWorkGroupInvocations; - memcpy(out_ext->maxTaskWorkGroupSize, in_ext->maxTaskWorkGroupSize, 3 * sizeof(uint32_t)); - out_ext->maxTaskTotalMemorySize = in_ext->maxTaskTotalMemorySize; - out_ext->maxTaskOutputCount = in_ext->maxTaskOutputCount; - out_ext->maxMeshWorkGroupInvocations = in_ext->maxMeshWorkGroupInvocations; - memcpy(out_ext->maxMeshWorkGroupSize, in_ext->maxMeshWorkGroupSize, 3 * sizeof(uint32_t)); - out_ext->maxMeshTotalMemorySize = in_ext->maxMeshTotalMemorySize; - out_ext->maxMeshOutputVertices = in_ext->maxMeshOutputVertices; - out_ext->maxMeshOutputPrimitives = in_ext->maxMeshOutputPrimitives; - out_ext->maxMeshMultiviewViewCount = in_ext->maxMeshMultiviewViewCount; - out_ext->meshOutputPerVertexGranularity = in_ext->meshOutputPerVertexGranularity; - out_ext->meshOutputPerPrimitiveGranularity = in_ext->meshOutputPerPrimitiveGranularity; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT: - { - VkPhysicalDeviceMeshShaderPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT); - const VkPhysicalDeviceMeshShaderPropertiesEXT *in_ext = (const VkPhysicalDeviceMeshShaderPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT; - out_ext->maxTaskWorkGroupTotalCount = in_ext->maxTaskWorkGroupTotalCount; - memcpy(out_ext->maxTaskWorkGroupCount, in_ext->maxTaskWorkGroupCount, 3 * sizeof(uint32_t)); - out_ext->maxTaskWorkGroupInvocations = in_ext->maxTaskWorkGroupInvocations; - memcpy(out_ext->maxTaskWorkGroupSize, in_ext->maxTaskWorkGroupSize, 3 * sizeof(uint32_t)); - out_ext->maxTaskPayloadSize = in_ext->maxTaskPayloadSize; - out_ext->maxTaskSharedMemorySize = in_ext->maxTaskSharedMemorySize; - out_ext->maxTaskPayloadAndSharedMemorySize = in_ext->maxTaskPayloadAndSharedMemorySize; - out_ext->maxMeshWorkGroupTotalCount = in_ext->maxMeshWorkGroupTotalCount; - memcpy(out_ext->maxMeshWorkGroupCount, in_ext->maxMeshWorkGroupCount, 3 * sizeof(uint32_t)); - out_ext->maxMeshWorkGroupInvocations = in_ext->maxMeshWorkGroupInvocations; - memcpy(out_ext->maxMeshWorkGroupSize, in_ext->maxMeshWorkGroupSize, 3 * sizeof(uint32_t)); - out_ext->maxMeshSharedMemorySize = in_ext->maxMeshSharedMemorySize; - out_ext->maxMeshPayloadAndSharedMemorySize = in_ext->maxMeshPayloadAndSharedMemorySize; - out_ext->maxMeshOutputMemorySize = in_ext->maxMeshOutputMemorySize; - out_ext->maxMeshPayloadAndOutputMemorySize = in_ext->maxMeshPayloadAndOutputMemorySize; - out_ext->maxMeshOutputComponents = in_ext->maxMeshOutputComponents; - out_ext->maxMeshOutputVertices = in_ext->maxMeshOutputVertices; - out_ext->maxMeshOutputPrimitives = in_ext->maxMeshOutputPrimitives; - out_ext->maxMeshOutputLayers = in_ext->maxMeshOutputLayers; - out_ext->maxMeshMultiviewViewCount = in_ext->maxMeshMultiviewViewCount; - out_ext->meshOutputPerVertexGranularity = in_ext->meshOutputPerVertexGranularity; - out_ext->meshOutputPerPrimitiveGranularity = in_ext->meshOutputPerPrimitiveGranularity; - out_ext->maxPreferredTaskWorkGroupInvocations = in_ext->maxPreferredTaskWorkGroupInvocations; - out_ext->maxPreferredMeshWorkGroupInvocations = in_ext->maxPreferredMeshWorkGroupInvocations; - out_ext->prefersLocalInvocationVertexOutput = in_ext->prefersLocalInvocationVertexOutput; - out_ext->prefersLocalInvocationPrimitiveOutput = in_ext->prefersLocalInvocationPrimitiveOutput; - out_ext->prefersCompactVertexOutput = in_ext->prefersCompactVertexOutput; - out_ext->prefersCompactPrimitiveOutput = in_ext->prefersCompactPrimitiveOutput; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR: - { - VkPhysicalDeviceAccelerationStructurePropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR); - const VkPhysicalDeviceAccelerationStructurePropertiesKHR *in_ext = (const VkPhysicalDeviceAccelerationStructurePropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR; - out_ext->maxGeometryCount = in_ext->maxGeometryCount; - out_ext->maxInstanceCount = in_ext->maxInstanceCount; - out_ext->maxPrimitiveCount = in_ext->maxPrimitiveCount; - out_ext->maxPerStageDescriptorAccelerationStructures = in_ext->maxPerStageDescriptorAccelerationStructures; - out_ext->maxPerStageDescriptorUpdateAfterBindAccelerationStructures = in_ext->maxPerStageDescriptorUpdateAfterBindAccelerationStructures; - out_ext->maxDescriptorSetAccelerationStructures = in_ext->maxDescriptorSetAccelerationStructures; - out_ext->maxDescriptorSetUpdateAfterBindAccelerationStructures = in_ext->maxDescriptorSetUpdateAfterBindAccelerationStructures; - out_ext->minAccelerationStructureScratchOffsetAlignment = in_ext->minAccelerationStructureScratchOffsetAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR: - { - VkPhysicalDeviceRayTracingPipelinePropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR); - const VkPhysicalDeviceRayTracingPipelinePropertiesKHR *in_ext = (const VkPhysicalDeviceRayTracingPipelinePropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR; - out_ext->shaderGroupHandleSize = in_ext->shaderGroupHandleSize; - out_ext->maxRayRecursionDepth = in_ext->maxRayRecursionDepth; - out_ext->maxShaderGroupStride = in_ext->maxShaderGroupStride; - out_ext->shaderGroupBaseAlignment = in_ext->shaderGroupBaseAlignment; - out_ext->shaderGroupHandleCaptureReplaySize = in_ext->shaderGroupHandleCaptureReplaySize; - out_ext->maxRayDispatchInvocationCount = in_ext->maxRayDispatchInvocationCount; - out_ext->shaderGroupHandleAlignment = in_ext->shaderGroupHandleAlignment; - out_ext->maxRayHitAttributeSize = in_ext->maxRayHitAttributeSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV: - { - VkPhysicalDeviceRayTracingPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV); - const VkPhysicalDeviceRayTracingPropertiesNV *in_ext = (const VkPhysicalDeviceRayTracingPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV; - out_ext->shaderGroupHandleSize = in_ext->shaderGroupHandleSize; - out_ext->maxRecursionDepth = in_ext->maxRecursionDepth; - out_ext->maxShaderGroupStride = in_ext->maxShaderGroupStride; - out_ext->shaderGroupBaseAlignment = in_ext->shaderGroupBaseAlignment; - out_ext->maxGeometryCount = in_ext->maxGeometryCount; - out_ext->maxInstanceCount = in_ext->maxInstanceCount; - out_ext->maxTriangleCount = in_ext->maxTriangleCount; - out_ext->maxDescriptorSetAccelerationStructures = in_ext->maxDescriptorSetAccelerationStructures; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT: - { - VkPhysicalDeviceFragmentDensityMapPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT); - const VkPhysicalDeviceFragmentDensityMapPropertiesEXT *in_ext = (const VkPhysicalDeviceFragmentDensityMapPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT; - out_ext->minFragmentDensityTexelSize = in_ext->minFragmentDensityTexelSize; - out_ext->maxFragmentDensityTexelSize = in_ext->maxFragmentDensityTexelSize; - out_ext->fragmentDensityInvocations = in_ext->fragmentDensityInvocations; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT: - { - VkPhysicalDeviceFragmentDensityMap2PropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT); - const VkPhysicalDeviceFragmentDensityMap2PropertiesEXT *in_ext = (const VkPhysicalDeviceFragmentDensityMap2PropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT; - out_ext->subsampledLoads = in_ext->subsampledLoads; - out_ext->subsampledCoarseReconstructionEarlyAccess = in_ext->subsampledCoarseReconstructionEarlyAccess; - out_ext->maxSubsampledArrayLayers = in_ext->maxSubsampledArrayLayers; - out_ext->maxDescriptorSetSubsampledSamplers = in_ext->maxDescriptorSetSubsampledSamplers; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM: - { - VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM); - const VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM *in_ext = (const VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM; - out_ext->fragmentDensityOffsetGranularity = in_ext->fragmentDensityOffsetGranularity; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV: - { - VkPhysicalDeviceCooperativeMatrixPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV); - const VkPhysicalDeviceCooperativeMatrixPropertiesNV *in_ext = (const VkPhysicalDeviceCooperativeMatrixPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV; - out_ext->cooperativeMatrixSupportedStages = in_ext->cooperativeMatrixSupportedStages; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR: - { - VkPhysicalDevicePerformanceQueryPropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR); - const VkPhysicalDevicePerformanceQueryPropertiesKHR *in_ext = (const VkPhysicalDevicePerformanceQueryPropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR; - out_ext->allowCommandBufferQueryCopies = in_ext->allowCommandBufferQueryCopies; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV: - { - VkPhysicalDeviceShaderSMBuiltinsPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV); - const VkPhysicalDeviceShaderSMBuiltinsPropertiesNV *in_ext = (const VkPhysicalDeviceShaderSMBuiltinsPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV; - out_ext->shaderSMCount = in_ext->shaderSMCount; - out_ext->shaderWarpsPerSM = in_ext->shaderWarpsPerSM; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES: - { - VkPhysicalDeviceTexelBufferAlignmentProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES); - const VkPhysicalDeviceTexelBufferAlignmentProperties *in_ext = (const VkPhysicalDeviceTexelBufferAlignmentProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES; - out_ext->storageTexelBufferOffsetAlignmentBytes = in_ext->storageTexelBufferOffsetAlignmentBytes; - out_ext->storageTexelBufferOffsetSingleTexelAlignment = in_ext->storageTexelBufferOffsetSingleTexelAlignment; - out_ext->uniformTexelBufferOffsetAlignmentBytes = in_ext->uniformTexelBufferOffsetAlignmentBytes; - out_ext->uniformTexelBufferOffsetSingleTexelAlignment = in_ext->uniformTexelBufferOffsetSingleTexelAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES: - { - VkPhysicalDeviceSubgroupSizeControlProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES); - const VkPhysicalDeviceSubgroupSizeControlProperties *in_ext = (const VkPhysicalDeviceSubgroupSizeControlProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES; - out_ext->minSubgroupSize = in_ext->minSubgroupSize; - out_ext->maxSubgroupSize = in_ext->maxSubgroupSize; - out_ext->maxComputeWorkgroupSubgroups = in_ext->maxComputeWorkgroupSubgroups; - out_ext->requiredSubgroupSizeStages = in_ext->requiredSubgroupSizeStages; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI: - { - VkPhysicalDeviceSubpassShadingPropertiesHUAWEI32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI); - const VkPhysicalDeviceSubpassShadingPropertiesHUAWEI *in_ext = (const VkPhysicalDeviceSubpassShadingPropertiesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI; - out_ext->maxSubpassShadingWorkgroupSizeAspectRatio = in_ext->maxSubpassShadingWorkgroupSizeAspectRatio; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI: - { - VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI); - const VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI *in_ext = (const VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI; - memcpy(out_ext->maxWorkGroupCount, in_ext->maxWorkGroupCount, 3 * sizeof(uint32_t)); - memcpy(out_ext->maxWorkGroupSize, in_ext->maxWorkGroupSize, 3 * sizeof(uint32_t)); - out_ext->maxOutputClusterCount = in_ext->maxOutputClusterCount; - out_ext->indirectBufferOffsetAlignment = in_ext->indirectBufferOffsetAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT: - { - VkPhysicalDeviceLineRasterizationPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT); - const VkPhysicalDeviceLineRasterizationPropertiesEXT *in_ext = (const VkPhysicalDeviceLineRasterizationPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT; - out_ext->lineSubPixelPrecisionBits = in_ext->lineSubPixelPrecisionBits; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES: - { - VkPhysicalDeviceVulkan11Properties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES); - const VkPhysicalDeviceVulkan11Properties *in_ext = (const VkPhysicalDeviceVulkan11Properties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES; - memcpy(out_ext->deviceUUID, in_ext->deviceUUID, VK_UUID_SIZE * sizeof(uint8_t)); - memcpy(out_ext->driverUUID, in_ext->driverUUID, VK_UUID_SIZE * sizeof(uint8_t)); - memcpy(out_ext->deviceLUID, in_ext->deviceLUID, VK_LUID_SIZE * sizeof(uint8_t)); - out_ext->deviceNodeMask = in_ext->deviceNodeMask; - out_ext->deviceLUIDValid = in_ext->deviceLUIDValid; - out_ext->subgroupSize = in_ext->subgroupSize; - out_ext->subgroupSupportedStages = in_ext->subgroupSupportedStages; - out_ext->subgroupSupportedOperations = in_ext->subgroupSupportedOperations; - out_ext->subgroupQuadOperationsInAllStages = in_ext->subgroupQuadOperationsInAllStages; - out_ext->pointClippingBehavior = in_ext->pointClippingBehavior; - out_ext->maxMultiviewViewCount = in_ext->maxMultiviewViewCount; - out_ext->maxMultiviewInstanceIndex = in_ext->maxMultiviewInstanceIndex; - out_ext->protectedNoFault = in_ext->protectedNoFault; - out_ext->maxPerSetDescriptors = in_ext->maxPerSetDescriptors; - out_ext->maxMemoryAllocationSize = in_ext->maxMemoryAllocationSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES: - { - VkPhysicalDeviceVulkan12Properties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES); - const VkPhysicalDeviceVulkan12Properties *in_ext = (const VkPhysicalDeviceVulkan12Properties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES; - out_ext->driverID = in_ext->driverID; - memcpy(out_ext->driverName, in_ext->driverName, VK_MAX_DRIVER_NAME_SIZE * sizeof(char)); - memcpy(out_ext->driverInfo, in_ext->driverInfo, VK_MAX_DRIVER_INFO_SIZE * sizeof(char)); - out_ext->conformanceVersion = in_ext->conformanceVersion; - out_ext->denormBehaviorIndependence = in_ext->denormBehaviorIndependence; - out_ext->roundingModeIndependence = in_ext->roundingModeIndependence; - out_ext->shaderSignedZeroInfNanPreserveFloat16 = in_ext->shaderSignedZeroInfNanPreserveFloat16; - out_ext->shaderSignedZeroInfNanPreserveFloat32 = in_ext->shaderSignedZeroInfNanPreserveFloat32; - out_ext->shaderSignedZeroInfNanPreserveFloat64 = in_ext->shaderSignedZeroInfNanPreserveFloat64; - out_ext->shaderDenormPreserveFloat16 = in_ext->shaderDenormPreserveFloat16; - out_ext->shaderDenormPreserveFloat32 = in_ext->shaderDenormPreserveFloat32; - out_ext->shaderDenormPreserveFloat64 = in_ext->shaderDenormPreserveFloat64; - out_ext->shaderDenormFlushToZeroFloat16 = in_ext->shaderDenormFlushToZeroFloat16; - out_ext->shaderDenormFlushToZeroFloat32 = in_ext->shaderDenormFlushToZeroFloat32; - out_ext->shaderDenormFlushToZeroFloat64 = in_ext->shaderDenormFlushToZeroFloat64; - out_ext->shaderRoundingModeRTEFloat16 = in_ext->shaderRoundingModeRTEFloat16; - out_ext->shaderRoundingModeRTEFloat32 = in_ext->shaderRoundingModeRTEFloat32; - out_ext->shaderRoundingModeRTEFloat64 = in_ext->shaderRoundingModeRTEFloat64; - out_ext->shaderRoundingModeRTZFloat16 = in_ext->shaderRoundingModeRTZFloat16; - out_ext->shaderRoundingModeRTZFloat32 = in_ext->shaderRoundingModeRTZFloat32; - out_ext->shaderRoundingModeRTZFloat64 = in_ext->shaderRoundingModeRTZFloat64; - out_ext->maxUpdateAfterBindDescriptorsInAllPools = in_ext->maxUpdateAfterBindDescriptorsInAllPools; - out_ext->shaderUniformBufferArrayNonUniformIndexingNative = in_ext->shaderUniformBufferArrayNonUniformIndexingNative; - out_ext->shaderSampledImageArrayNonUniformIndexingNative = in_ext->shaderSampledImageArrayNonUniformIndexingNative; - out_ext->shaderStorageBufferArrayNonUniformIndexingNative = in_ext->shaderStorageBufferArrayNonUniformIndexingNative; - out_ext->shaderStorageImageArrayNonUniformIndexingNative = in_ext->shaderStorageImageArrayNonUniformIndexingNative; - out_ext->shaderInputAttachmentArrayNonUniformIndexingNative = in_ext->shaderInputAttachmentArrayNonUniformIndexingNative; - out_ext->robustBufferAccessUpdateAfterBind = in_ext->robustBufferAccessUpdateAfterBind; - out_ext->quadDivergentImplicitLod = in_ext->quadDivergentImplicitLod; - out_ext->maxPerStageDescriptorUpdateAfterBindSamplers = in_ext->maxPerStageDescriptorUpdateAfterBindSamplers; - out_ext->maxPerStageDescriptorUpdateAfterBindUniformBuffers = in_ext->maxPerStageDescriptorUpdateAfterBindUniformBuffers; - out_ext->maxPerStageDescriptorUpdateAfterBindStorageBuffers = in_ext->maxPerStageDescriptorUpdateAfterBindStorageBuffers; - out_ext->maxPerStageDescriptorUpdateAfterBindSampledImages = in_ext->maxPerStageDescriptorUpdateAfterBindSampledImages; - out_ext->maxPerStageDescriptorUpdateAfterBindStorageImages = in_ext->maxPerStageDescriptorUpdateAfterBindStorageImages; - out_ext->maxPerStageDescriptorUpdateAfterBindInputAttachments = in_ext->maxPerStageDescriptorUpdateAfterBindInputAttachments; - out_ext->maxPerStageUpdateAfterBindResources = in_ext->maxPerStageUpdateAfterBindResources; - out_ext->maxDescriptorSetUpdateAfterBindSamplers = in_ext->maxDescriptorSetUpdateAfterBindSamplers; - out_ext->maxDescriptorSetUpdateAfterBindUniformBuffers = in_ext->maxDescriptorSetUpdateAfterBindUniformBuffers; - out_ext->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = in_ext->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - out_ext->maxDescriptorSetUpdateAfterBindStorageBuffers = in_ext->maxDescriptorSetUpdateAfterBindStorageBuffers; - out_ext->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = in_ext->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - out_ext->maxDescriptorSetUpdateAfterBindSampledImages = in_ext->maxDescriptorSetUpdateAfterBindSampledImages; - out_ext->maxDescriptorSetUpdateAfterBindStorageImages = in_ext->maxDescriptorSetUpdateAfterBindStorageImages; - out_ext->maxDescriptorSetUpdateAfterBindInputAttachments = in_ext->maxDescriptorSetUpdateAfterBindInputAttachments; - out_ext->supportedDepthResolveModes = in_ext->supportedDepthResolveModes; - out_ext->supportedStencilResolveModes = in_ext->supportedStencilResolveModes; - out_ext->independentResolveNone = in_ext->independentResolveNone; - out_ext->independentResolve = in_ext->independentResolve; - out_ext->filterMinmaxSingleComponentFormats = in_ext->filterMinmaxSingleComponentFormats; - out_ext->filterMinmaxImageComponentMapping = in_ext->filterMinmaxImageComponentMapping; - out_ext->maxTimelineSemaphoreValueDifference = in_ext->maxTimelineSemaphoreValueDifference; - out_ext->framebufferIntegerColorSampleCounts = in_ext->framebufferIntegerColorSampleCounts; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES: - { - VkPhysicalDeviceVulkan13Properties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES); - const VkPhysicalDeviceVulkan13Properties *in_ext = (const VkPhysicalDeviceVulkan13Properties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES; - out_ext->minSubgroupSize = in_ext->minSubgroupSize; - out_ext->maxSubgroupSize = in_ext->maxSubgroupSize; - out_ext->maxComputeWorkgroupSubgroups = in_ext->maxComputeWorkgroupSubgroups; - out_ext->requiredSubgroupSizeStages = in_ext->requiredSubgroupSizeStages; - out_ext->maxInlineUniformBlockSize = in_ext->maxInlineUniformBlockSize; - out_ext->maxPerStageDescriptorInlineUniformBlocks = in_ext->maxPerStageDescriptorInlineUniformBlocks; - out_ext->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks = in_ext->maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - out_ext->maxDescriptorSetInlineUniformBlocks = in_ext->maxDescriptorSetInlineUniformBlocks; - out_ext->maxDescriptorSetUpdateAfterBindInlineUniformBlocks = in_ext->maxDescriptorSetUpdateAfterBindInlineUniformBlocks; - out_ext->maxInlineUniformTotalSize = in_ext->maxInlineUniformTotalSize; - out_ext->integerDotProduct8BitUnsignedAccelerated = in_ext->integerDotProduct8BitUnsignedAccelerated; - out_ext->integerDotProduct8BitSignedAccelerated = in_ext->integerDotProduct8BitSignedAccelerated; - out_ext->integerDotProduct8BitMixedSignednessAccelerated = in_ext->integerDotProduct8BitMixedSignednessAccelerated; - out_ext->integerDotProduct4x8BitPackedUnsignedAccelerated = in_ext->integerDotProduct4x8BitPackedUnsignedAccelerated; - out_ext->integerDotProduct4x8BitPackedSignedAccelerated = in_ext->integerDotProduct4x8BitPackedSignedAccelerated; - out_ext->integerDotProduct4x8BitPackedMixedSignednessAccelerated = in_ext->integerDotProduct4x8BitPackedMixedSignednessAccelerated; - out_ext->integerDotProduct16BitUnsignedAccelerated = in_ext->integerDotProduct16BitUnsignedAccelerated; - out_ext->integerDotProduct16BitSignedAccelerated = in_ext->integerDotProduct16BitSignedAccelerated; - out_ext->integerDotProduct16BitMixedSignednessAccelerated = in_ext->integerDotProduct16BitMixedSignednessAccelerated; - out_ext->integerDotProduct32BitUnsignedAccelerated = in_ext->integerDotProduct32BitUnsignedAccelerated; - out_ext->integerDotProduct32BitSignedAccelerated = in_ext->integerDotProduct32BitSignedAccelerated; - out_ext->integerDotProduct32BitMixedSignednessAccelerated = in_ext->integerDotProduct32BitMixedSignednessAccelerated; - out_ext->integerDotProduct64BitUnsignedAccelerated = in_ext->integerDotProduct64BitUnsignedAccelerated; - out_ext->integerDotProduct64BitSignedAccelerated = in_ext->integerDotProduct64BitSignedAccelerated; - out_ext->integerDotProduct64BitMixedSignednessAccelerated = in_ext->integerDotProduct64BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating8BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating8BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating16BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating16BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating32BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating32BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating64BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating64BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; - out_ext->storageTexelBufferOffsetAlignmentBytes = in_ext->storageTexelBufferOffsetAlignmentBytes; - out_ext->storageTexelBufferOffsetSingleTexelAlignment = in_ext->storageTexelBufferOffsetSingleTexelAlignment; - out_ext->uniformTexelBufferOffsetAlignmentBytes = in_ext->uniformTexelBufferOffsetAlignmentBytes; - out_ext->uniformTexelBufferOffsetSingleTexelAlignment = in_ext->uniformTexelBufferOffsetSingleTexelAlignment; - out_ext->maxBufferSize = in_ext->maxBufferSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT: - { - VkPhysicalDeviceCustomBorderColorPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT); - const VkPhysicalDeviceCustomBorderColorPropertiesEXT *in_ext = (const VkPhysicalDeviceCustomBorderColorPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT; - out_ext->maxCustomBorderColorSamplers = in_ext->maxCustomBorderColorSamplers; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT: - { - VkPhysicalDeviceExtendedDynamicState3PropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT); - const VkPhysicalDeviceExtendedDynamicState3PropertiesEXT *in_ext = (const VkPhysicalDeviceExtendedDynamicState3PropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT; - out_ext->dynamicPrimitiveTopologyUnrestricted = in_ext->dynamicPrimitiveTopologyUnrestricted; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT: - { - VkPhysicalDeviceRobustness2PropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT); - const VkPhysicalDeviceRobustness2PropertiesEXT *in_ext = (const VkPhysicalDeviceRobustness2PropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT; - out_ext->robustStorageBufferAccessSizeAlignment = in_ext->robustStorageBufferAccessSizeAlignment; - out_ext->robustUniformBufferAccessSizeAlignment = in_ext->robustUniformBufferAccessSizeAlignment; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR: - { - VkPhysicalDeviceFragmentShadingRatePropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR); - const VkPhysicalDeviceFragmentShadingRatePropertiesKHR *in_ext = (const VkPhysicalDeviceFragmentShadingRatePropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR; - out_ext->minFragmentShadingRateAttachmentTexelSize = in_ext->minFragmentShadingRateAttachmentTexelSize; - out_ext->maxFragmentShadingRateAttachmentTexelSize = in_ext->maxFragmentShadingRateAttachmentTexelSize; - out_ext->maxFragmentShadingRateAttachmentTexelSizeAspectRatio = in_ext->maxFragmentShadingRateAttachmentTexelSizeAspectRatio; - out_ext->primitiveFragmentShadingRateWithMultipleViewports = in_ext->primitiveFragmentShadingRateWithMultipleViewports; - out_ext->layeredShadingRateAttachments = in_ext->layeredShadingRateAttachments; - out_ext->fragmentShadingRateNonTrivialCombinerOps = in_ext->fragmentShadingRateNonTrivialCombinerOps; - out_ext->maxFragmentSize = in_ext->maxFragmentSize; - out_ext->maxFragmentSizeAspectRatio = in_ext->maxFragmentSizeAspectRatio; - out_ext->maxFragmentShadingRateCoverageSamples = in_ext->maxFragmentShadingRateCoverageSamples; - out_ext->maxFragmentShadingRateRasterizationSamples = in_ext->maxFragmentShadingRateRasterizationSamples; - out_ext->fragmentShadingRateWithShaderDepthStencilWrites = in_ext->fragmentShadingRateWithShaderDepthStencilWrites; - out_ext->fragmentShadingRateWithSampleMask = in_ext->fragmentShadingRateWithSampleMask; - out_ext->fragmentShadingRateWithShaderSampleMask = in_ext->fragmentShadingRateWithShaderSampleMask; - out_ext->fragmentShadingRateWithConservativeRasterization = in_ext->fragmentShadingRateWithConservativeRasterization; - out_ext->fragmentShadingRateWithFragmentShaderInterlock = in_ext->fragmentShadingRateWithFragmentShaderInterlock; - out_ext->fragmentShadingRateWithCustomSampleLocations = in_ext->fragmentShadingRateWithCustomSampleLocations; - out_ext->fragmentShadingRateStrictMultiplyCombiner = in_ext->fragmentShadingRateStrictMultiplyCombiner; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV: - { - VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV); - const VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV *in_ext = (const VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV; - out_ext->maxFragmentShadingRateInvocationCount = in_ext->maxFragmentShadingRateInvocationCount; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT: - { - VkPhysicalDeviceHostImageCopyPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT); - const VkPhysicalDeviceHostImageCopyPropertiesEXT *in_ext = (const VkPhysicalDeviceHostImageCopyPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; - out_ext->copySrcLayoutCount = in_ext->copySrcLayoutCount; - out_ext->pCopySrcLayouts = PtrToUlong(in_ext->pCopySrcLayouts); - out_ext->copyDstLayoutCount = in_ext->copyDstLayoutCount; - out_ext->pCopyDstLayouts = PtrToUlong(in_ext->pCopyDstLayouts); - memcpy(out_ext->optimalTilingLayoutUUID, in_ext->optimalTilingLayoutUUID, VK_UUID_SIZE * sizeof(uint8_t)); - out_ext->identicalMemoryTypeRequirements = in_ext->identicalMemoryTypeRequirements; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT: - { - VkPhysicalDeviceProvokingVertexPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT); - const VkPhysicalDeviceProvokingVertexPropertiesEXT *in_ext = (const VkPhysicalDeviceProvokingVertexPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT; - out_ext->provokingVertexModePerPipeline = in_ext->provokingVertexModePerPipeline; - out_ext->transformFeedbackPreservesTriangleFanProvokingVertex = in_ext->transformFeedbackPreservesTriangleFanProvokingVertex; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT: - { - VkPhysicalDeviceDescriptorBufferPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT); - const VkPhysicalDeviceDescriptorBufferPropertiesEXT *in_ext = (const VkPhysicalDeviceDescriptorBufferPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT; - out_ext->combinedImageSamplerDescriptorSingleArray = in_ext->combinedImageSamplerDescriptorSingleArray; - out_ext->bufferlessPushDescriptors = in_ext->bufferlessPushDescriptors; - out_ext->allowSamplerImageViewPostSubmitCreation = in_ext->allowSamplerImageViewPostSubmitCreation; - out_ext->descriptorBufferOffsetAlignment = in_ext->descriptorBufferOffsetAlignment; - out_ext->maxDescriptorBufferBindings = in_ext->maxDescriptorBufferBindings; - out_ext->maxResourceDescriptorBufferBindings = in_ext->maxResourceDescriptorBufferBindings; - out_ext->maxSamplerDescriptorBufferBindings = in_ext->maxSamplerDescriptorBufferBindings; - out_ext->maxEmbeddedImmutableSamplerBindings = in_ext->maxEmbeddedImmutableSamplerBindings; - out_ext->maxEmbeddedImmutableSamplers = in_ext->maxEmbeddedImmutableSamplers; - out_ext->bufferCaptureReplayDescriptorDataSize = in_ext->bufferCaptureReplayDescriptorDataSize; - out_ext->imageCaptureReplayDescriptorDataSize = in_ext->imageCaptureReplayDescriptorDataSize; - out_ext->imageViewCaptureReplayDescriptorDataSize = in_ext->imageViewCaptureReplayDescriptorDataSize; - out_ext->samplerCaptureReplayDescriptorDataSize = in_ext->samplerCaptureReplayDescriptorDataSize; - out_ext->accelerationStructureCaptureReplayDescriptorDataSize = in_ext->accelerationStructureCaptureReplayDescriptorDataSize; - out_ext->samplerDescriptorSize = in_ext->samplerDescriptorSize; - out_ext->combinedImageSamplerDescriptorSize = in_ext->combinedImageSamplerDescriptorSize; - out_ext->sampledImageDescriptorSize = in_ext->sampledImageDescriptorSize; - out_ext->storageImageDescriptorSize = in_ext->storageImageDescriptorSize; - out_ext->uniformTexelBufferDescriptorSize = in_ext->uniformTexelBufferDescriptorSize; - out_ext->robustUniformTexelBufferDescriptorSize = in_ext->robustUniformTexelBufferDescriptorSize; - out_ext->storageTexelBufferDescriptorSize = in_ext->storageTexelBufferDescriptorSize; - out_ext->robustStorageTexelBufferDescriptorSize = in_ext->robustStorageTexelBufferDescriptorSize; - out_ext->uniformBufferDescriptorSize = in_ext->uniformBufferDescriptorSize; - out_ext->robustUniformBufferDescriptorSize = in_ext->robustUniformBufferDescriptorSize; - out_ext->storageBufferDescriptorSize = in_ext->storageBufferDescriptorSize; - out_ext->robustStorageBufferDescriptorSize = in_ext->robustStorageBufferDescriptorSize; - out_ext->inputAttachmentDescriptorSize = in_ext->inputAttachmentDescriptorSize; - out_ext->accelerationStructureDescriptorSize = in_ext->accelerationStructureDescriptorSize; - out_ext->maxSamplerDescriptorBufferRange = in_ext->maxSamplerDescriptorBufferRange; - out_ext->maxResourceDescriptorBufferRange = in_ext->maxResourceDescriptorBufferRange; - out_ext->samplerDescriptorBufferAddressSpaceSize = in_ext->samplerDescriptorBufferAddressSpaceSize; - out_ext->resourceDescriptorBufferAddressSpaceSize = in_ext->resourceDescriptorBufferAddressSpaceSize; - out_ext->descriptorBufferAddressSpaceSize = in_ext->descriptorBufferAddressSpaceSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT: - { - VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT); - const VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT *in_ext = (const VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT; - out_ext->combinedImageSamplerDensityMapDescriptorSize = in_ext->combinedImageSamplerDensityMapDescriptorSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES: - { - VkPhysicalDeviceShaderIntegerDotProductProperties32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES); - const VkPhysicalDeviceShaderIntegerDotProductProperties *in_ext = (const VkPhysicalDeviceShaderIntegerDotProductProperties *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES; - out_ext->integerDotProduct8BitUnsignedAccelerated = in_ext->integerDotProduct8BitUnsignedAccelerated; - out_ext->integerDotProduct8BitSignedAccelerated = in_ext->integerDotProduct8BitSignedAccelerated; - out_ext->integerDotProduct8BitMixedSignednessAccelerated = in_ext->integerDotProduct8BitMixedSignednessAccelerated; - out_ext->integerDotProduct4x8BitPackedUnsignedAccelerated = in_ext->integerDotProduct4x8BitPackedUnsignedAccelerated; - out_ext->integerDotProduct4x8BitPackedSignedAccelerated = in_ext->integerDotProduct4x8BitPackedSignedAccelerated; - out_ext->integerDotProduct4x8BitPackedMixedSignednessAccelerated = in_ext->integerDotProduct4x8BitPackedMixedSignednessAccelerated; - out_ext->integerDotProduct16BitUnsignedAccelerated = in_ext->integerDotProduct16BitUnsignedAccelerated; - out_ext->integerDotProduct16BitSignedAccelerated = in_ext->integerDotProduct16BitSignedAccelerated; - out_ext->integerDotProduct16BitMixedSignednessAccelerated = in_ext->integerDotProduct16BitMixedSignednessAccelerated; - out_ext->integerDotProduct32BitUnsignedAccelerated = in_ext->integerDotProduct32BitUnsignedAccelerated; - out_ext->integerDotProduct32BitSignedAccelerated = in_ext->integerDotProduct32BitSignedAccelerated; - out_ext->integerDotProduct32BitMixedSignednessAccelerated = in_ext->integerDotProduct32BitMixedSignednessAccelerated; - out_ext->integerDotProduct64BitUnsignedAccelerated = in_ext->integerDotProduct64BitUnsignedAccelerated; - out_ext->integerDotProduct64BitSignedAccelerated = in_ext->integerDotProduct64BitSignedAccelerated; - out_ext->integerDotProduct64BitMixedSignednessAccelerated = in_ext->integerDotProduct64BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating8BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating8BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating16BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating16BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating32BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating32BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; - out_ext->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated = in_ext->integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating64BitSignedAccelerated = in_ext->integerDotProductAccumulatingSaturating64BitSignedAccelerated; - out_ext->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated = in_ext->integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR: - { - VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR); - const VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR *in_ext = (const VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR; - out_ext->triStripVertexOrderIndependentOfProvokingVertex = in_ext->triStripVertexOrderIndependentOfProvokingVertex; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT: - { - VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT); - const VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT *in_ext = (const VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT; - out_ext->graphicsPipelineLibraryFastLinking = in_ext->graphicsPipelineLibraryFastLinking; - out_ext->graphicsPipelineLibraryIndependentInterpolationDecoration = in_ext->graphicsPipelineLibraryIndependentInterpolationDecoration; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT: - { - VkPhysicalDeviceNestedCommandBufferPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT); - const VkPhysicalDeviceNestedCommandBufferPropertiesEXT *in_ext = (const VkPhysicalDeviceNestedCommandBufferPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT; - out_ext->maxCommandBufferNestingLevel = in_ext->maxCommandBufferNestingLevel; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT: - { - VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT); - const VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT *in_ext = (const VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT; - memcpy(out_ext->shaderModuleIdentifierAlgorithmUUID, in_ext->shaderModuleIdentifierAlgorithmUUID, VK_UUID_SIZE * sizeof(uint8_t)); - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT: - { - VkPhysicalDeviceOpacityMicromapPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT); - const VkPhysicalDeviceOpacityMicromapPropertiesEXT *in_ext = (const VkPhysicalDeviceOpacityMicromapPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT; - out_ext->maxOpacity2StateSubdivisionLevel = in_ext->maxOpacity2StateSubdivisionLevel; - out_ext->maxOpacity4StateSubdivisionLevel = in_ext->maxOpacity4StateSubdivisionLevel; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT: - { - VkPhysicalDevicePipelineRobustnessPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT); - const VkPhysicalDevicePipelineRobustnessPropertiesEXT *in_ext = (const VkPhysicalDevicePipelineRobustnessPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT; - out_ext->defaultRobustnessStorageBuffers = in_ext->defaultRobustnessStorageBuffers; - out_ext->defaultRobustnessUniformBuffers = in_ext->defaultRobustnessUniformBuffers; - out_ext->defaultRobustnessVertexInputs = in_ext->defaultRobustnessVertexInputs; - out_ext->defaultRobustnessImages = in_ext->defaultRobustnessImages; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM: - { - VkPhysicalDeviceImageProcessingPropertiesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM); - const VkPhysicalDeviceImageProcessingPropertiesQCOM *in_ext = (const VkPhysicalDeviceImageProcessingPropertiesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM; - out_ext->maxWeightFilterPhases = in_ext->maxWeightFilterPhases; - out_ext->maxWeightFilterDimension = in_ext->maxWeightFilterDimension; - out_ext->maxBlockMatchRegion = in_ext->maxBlockMatchRegion; - out_ext->maxBoxFilterBlockSize = in_ext->maxBoxFilterBlockSize; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV: - { - VkPhysicalDeviceOpticalFlowPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV); - const VkPhysicalDeviceOpticalFlowPropertiesNV *in_ext = (const VkPhysicalDeviceOpticalFlowPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV; - out_ext->supportedOutputGridSizes = in_ext->supportedOutputGridSizes; - out_ext->supportedHintGridSizes = in_ext->supportedHintGridSizes; - out_ext->hintSupported = in_ext->hintSupported; - out_ext->costSupported = in_ext->costSupported; - out_ext->bidirectionalFlowSupported = in_ext->bidirectionalFlowSupported; - out_ext->globalFlowSupported = in_ext->globalFlowSupported; - out_ext->minWidth = in_ext->minWidth; - out_ext->minHeight = in_ext->minHeight; - out_ext->maxWidth = in_ext->maxWidth; - out_ext->maxHeight = in_ext->maxHeight; - out_ext->maxNumRegionsOfInterest = in_ext->maxNumRegionsOfInterest; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM: - { - VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM); - const VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM *in_ext = (const VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM; - out_ext->shaderCoreMask = in_ext->shaderCoreMask; - out_ext->shaderCoreCount = in_ext->shaderCoreCount; - out_ext->shaderWarpsPerCore = in_ext->shaderWarpsPerCore; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV: - { - VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV); - const VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV *in_ext = (const VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV; - out_ext->rayTracingInvocationReorderReorderingHint = in_ext->rayTracingInvocationReorderReorderingHint; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV: - { - VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV); - const VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV *in_ext = (const VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV; - out_ext->extendedSparseAddressSpaceSize = in_ext->extendedSparseAddressSpaceSize; - out_ext->extendedSparseImageUsageFlags = in_ext->extendedSparseImageUsageFlags; - out_ext->extendedSparseBufferUsageFlags = in_ext->extendedSparseBufferUsageFlags; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM: - { - VkPhysicalDeviceShaderCorePropertiesARM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM); - const VkPhysicalDeviceShaderCorePropertiesARM *in_ext = (const VkPhysicalDeviceShaderCorePropertiesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM; - out_ext->pixelRate = in_ext->pixelRate; - out_ext->texelRate = in_ext->texelRate; - out_ext->fmaRate = in_ext->fmaRate; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT: - { - VkPhysicalDeviceShaderObjectPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT); - const VkPhysicalDeviceShaderObjectPropertiesEXT *in_ext = (const VkPhysicalDeviceShaderObjectPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT; - memcpy(out_ext->shaderBinaryUUID, in_ext->shaderBinaryUUID, VK_UUID_SIZE * sizeof(uint8_t)); - out_ext->shaderBinaryVersion = in_ext->shaderBinaryVersion; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT: - { - VkPhysicalDeviceShaderTileImagePropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT); - const VkPhysicalDeviceShaderTileImagePropertiesEXT *in_ext = (const VkPhysicalDeviceShaderTileImagePropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT; - out_ext->shaderTileImageCoherentReadAccelerated = in_ext->shaderTileImageCoherentReadAccelerated; - out_ext->shaderTileImageReadSampleFromPixelRateInvocation = in_ext->shaderTileImageReadSampleFromPixelRateInvocation; - out_ext->shaderTileImageReadFromHelperInvocation = in_ext->shaderTileImageReadFromHelperInvocation; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR: - { - VkPhysicalDeviceCooperativeMatrixPropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR); - const VkPhysicalDeviceCooperativeMatrixPropertiesKHR *in_ext = (const VkPhysicalDeviceCooperativeMatrixPropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR; - out_ext->cooperativeMatrixSupportedStages = in_ext->cooperativeMatrixSupportedStages; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM: - { - VkPhysicalDeviceImageProcessing2PropertiesQCOM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM); - const VkPhysicalDeviceImageProcessing2PropertiesQCOM *in_ext = (const VkPhysicalDeviceImageProcessing2PropertiesQCOM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM; - out_ext->maxBlockMatchWindow = in_ext->maxBlockMatchWindow; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT: - { - VkPhysicalDeviceLayeredDriverPropertiesMSFT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT); - const VkPhysicalDeviceLayeredDriverPropertiesMSFT *in_ext = (const VkPhysicalDeviceLayeredDriverPropertiesMSFT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT; - out_ext->underlyingAPI = in_ext->underlyingAPI; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV: - { - VkPhysicalDeviceCudaKernelLaunchPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV); - const VkPhysicalDeviceCudaKernelLaunchPropertiesNV *in_ext = (const VkPhysicalDeviceCudaKernelLaunchPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV; - out_ext->computeCapabilityMinor = in_ext->computeCapabilityMinor; - out_ext->computeCapabilityMajor = in_ext->computeCapabilityMajor; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM: - { - VkPhysicalDeviceSchedulingControlsPropertiesARM32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM); - const VkPhysicalDeviceSchedulingControlsPropertiesARM *in_ext = (const VkPhysicalDeviceSchedulingControlsPropertiesARM *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM; - out_ext->schedulingControlsFlags = in_ext->schedulingControlsFlags; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline void convert_VkQueryPoolPerformanceCreateInfoKHR_win32_to_host(const VkQueryPoolPerformanceCreateInfoKHR32 *in, VkQueryPoolPerformanceCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->queueFamilyIndex = in->queueFamilyIndex; - out->counterIndexCount = in->counterIndexCount; - out->pCounterIndices = (const uint32_t *)UlongToPtr(in->pCounterIndices); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkQueueFamilyProperties2_win32_to_host(struct conversion_context *ctx, const VkQueueFamilyProperties232 *in, VkQueueFamilyProperties2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR: - { - VkQueueFamilyGlobalPriorityPropertiesKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkQueueFamilyGlobalPriorityPropertiesKHR32 *in_ext = (const VkQueueFamilyGlobalPriorityPropertiesKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR; - out_ext->pNext = NULL; - out_ext->priorityCount = in_ext->priorityCount; - memcpy(out_ext->priorities, in_ext->priorities, VK_MAX_GLOBAL_PRIORITY_SIZE_KHR * sizeof(VkQueueGlobalPriorityKHR)); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV: - { - VkQueueFamilyCheckpointPropertiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV: - { - VkQueueFamilyCheckpointProperties2NV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkQueueFamilyProperties2_host_to_win32(const VkQueueFamilyProperties2 *in, VkQueueFamilyProperties232 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - out->queueFamilyProperties = in->queueFamilyProperties; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR: - { - VkQueueFamilyGlobalPriorityPropertiesKHR32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR); - const VkQueueFamilyGlobalPriorityPropertiesKHR *in_ext = (const VkQueueFamilyGlobalPriorityPropertiesKHR *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR; - out_ext->priorityCount = in_ext->priorityCount; - memcpy(out_ext->priorities, in_ext->priorities, VK_MAX_GLOBAL_PRIORITY_SIZE_KHR * sizeof(VkQueueGlobalPriorityKHR)); - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV: - { - VkQueueFamilyCheckpointPropertiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV); - const VkQueueFamilyCheckpointPropertiesNV *in_ext = (const VkQueueFamilyCheckpointPropertiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV; - out_ext->checkpointExecutionStageMask = in_ext->checkpointExecutionStageMask; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV: - { - VkQueueFamilyCheckpointProperties2NV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV); - const VkQueueFamilyCheckpointProperties2NV *in_ext = (const VkQueueFamilyCheckpointProperties2NV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV; - out_ext->checkpointExecutionStageMask = in_ext->checkpointExecutionStageMask; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline VkQueueFamilyProperties2 *convert_VkQueueFamilyProperties2_array_win32_to_host(struct conversion_context *ctx, const VkQueueFamilyProperties232 *in, uint32_t count) -{ - VkQueueFamilyProperties2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkQueueFamilyProperties2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkQueueFamilyProperties2_array_host_to_win32(const VkQueueFamilyProperties2 *in, VkQueueFamilyProperties232 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkQueueFamilyProperties2_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPhysicalDeviceSparseImageFormatInfo2_win32_to_host(const VkPhysicalDeviceSparseImageFormatInfo232 *in, VkPhysicalDeviceSparseImageFormatInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->format = in->format; - out->type = in->type; - out->samples = in->samples; - out->usage = in->usage; - out->tiling = in->tiling; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSparseImageFormatProperties2_win32_to_host(const VkSparseImageFormatProperties232 *in, VkSparseImageFormatProperties2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSparseImageFormatProperties2_host_to_win32(const VkSparseImageFormatProperties2 *in, VkSparseImageFormatProperties232 *out) -{ - if (!in) return; - - out->properties = in->properties; -} - -static inline VkSparseImageFormatProperties2 *convert_VkSparseImageFormatProperties2_array_win32_to_host(struct conversion_context *ctx, const VkSparseImageFormatProperties232 *in, uint32_t count) -{ - VkSparseImageFormatProperties2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageFormatProperties2_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSparseImageFormatProperties2_array_host_to_win32(const VkSparseImageFormatProperties2 *in, VkSparseImageFormatProperties232 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkSparseImageFormatProperties2_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkFramebufferMixedSamplesCombinationNV_win32_to_host(const VkFramebufferMixedSamplesCombinationNV32 *in, VkFramebufferMixedSamplesCombinationNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkFramebufferMixedSamplesCombinationNV_host_to_win32(const VkFramebufferMixedSamplesCombinationNV *in, VkFramebufferMixedSamplesCombinationNV32 *out) -{ - if (!in) return; - - out->coverageReductionMode = in->coverageReductionMode; - out->rasterizationSamples = in->rasterizationSamples; - out->depthStencilSamples = in->depthStencilSamples; - out->colorSamples = in->colorSamples; -} - -static inline VkFramebufferMixedSamplesCombinationNV *convert_VkFramebufferMixedSamplesCombinationNV_array_win32_to_host(struct conversion_context *ctx, const VkFramebufferMixedSamplesCombinationNV32 *in, uint32_t count) -{ - VkFramebufferMixedSamplesCombinationNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkFramebufferMixedSamplesCombinationNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkFramebufferMixedSamplesCombinationNV_array_host_to_win32(const VkFramebufferMixedSamplesCombinationNV *in, VkFramebufferMixedSamplesCombinationNV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkFramebufferMixedSamplesCombinationNV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_unwrapped_host(struct conversion_context *ctx, const VkPhysicalDeviceSurfaceInfo2KHR32 *in, VkPhysicalDeviceSurfaceInfo2KHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->surface = in->surface; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT: - { - VkSurfacePresentModeEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSurfacePresentModeEXT32 *in_ext = (const VkSurfacePresentModeEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT; - out_ext->pNext = NULL; - out_ext->presentMode = in_ext->presentMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSurfaceCapabilities2KHR_win32_to_host(struct conversion_context *ctx, const VkSurfaceCapabilities2KHR32 *in, VkSurfaceCapabilities2KHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV: - { - VkSurfaceCapabilitiesPresentBarrierNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT: - { - VkSurfacePresentScalingCapabilitiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSurfacePresentScalingCapabilitiesEXT32 *in_ext = (const VkSurfacePresentScalingCapabilitiesEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT; - out_ext->pNext = NULL; - out_ext->supportedPresentScaling = in_ext->supportedPresentScaling; - out_ext->supportedPresentGravityX = in_ext->supportedPresentGravityX; - out_ext->supportedPresentGravityY = in_ext->supportedPresentGravityY; - out_ext->minScaledImageExtent = in_ext->minScaledImageExtent; - out_ext->maxScaledImageExtent = in_ext->maxScaledImageExtent; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT: - { - VkSurfacePresentModeCompatibilityEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSurfacePresentModeCompatibilityEXT32 *in_ext = (const VkSurfacePresentModeCompatibilityEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT; - out_ext->pNext = NULL; - out_ext->presentModeCount = in_ext->presentModeCount; - out_ext->pPresentModes = (VkPresentModeKHR *)UlongToPtr(in_ext->pPresentModes); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV: - { - VkLatencySurfaceCapabilitiesNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkLatencySurfaceCapabilitiesNV32 *in_ext = (const VkLatencySurfaceCapabilitiesNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV; - out_ext->pNext = NULL; - out_ext->presentModeCount = in_ext->presentModeCount; - out_ext->pPresentModes = (VkPresentModeKHR *)UlongToPtr(in_ext->pPresentModes); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSurfaceCapabilities2KHR_host_to_win32(const VkSurfaceCapabilities2KHR *in, VkSurfaceCapabilities2KHR32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - out->surfaceCapabilities = in->surfaceCapabilities; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV: - { - VkSurfaceCapabilitiesPresentBarrierNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV); - const VkSurfaceCapabilitiesPresentBarrierNV *in_ext = (const VkSurfaceCapabilitiesPresentBarrierNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV; - out_ext->presentBarrierSupported = in_ext->presentBarrierSupported; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT: - { - VkSurfacePresentScalingCapabilitiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT); - const VkSurfacePresentScalingCapabilitiesEXT *in_ext = (const VkSurfacePresentScalingCapabilitiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT; - out_ext->supportedPresentScaling = in_ext->supportedPresentScaling; - out_ext->supportedPresentGravityX = in_ext->supportedPresentGravityX; - out_ext->supportedPresentGravityY = in_ext->supportedPresentGravityY; - out_ext->minScaledImageExtent = in_ext->minScaledImageExtent; - out_ext->maxScaledImageExtent = in_ext->maxScaledImageExtent; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT: - { - VkSurfacePresentModeCompatibilityEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT); - const VkSurfacePresentModeCompatibilityEXT *in_ext = (const VkSurfacePresentModeCompatibilityEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT; - out_ext->presentModeCount = in_ext->presentModeCount; - out_ext->pPresentModes = PtrToUlong(in_ext->pPresentModes); - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV: - { - VkLatencySurfaceCapabilitiesNV32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV); - const VkLatencySurfaceCapabilitiesNV *in_ext = (const VkLatencySurfaceCapabilitiesNV *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV; - out_ext->presentModeCount = in_ext->presentModeCount; - out_ext->pPresentModes = PtrToUlong(in_ext->pPresentModes); - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -#ifdef _WIN64 -static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_driver(const VkPhysicalDeviceSurfaceInfo2KHR *in, VkPhysicalDeviceSurfaceInfo2KHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->surface = in->surface ? wine_surface_from_handle(in->surface)->driver_surface : 0; -} -#endif /* _WIN64 */ - -static inline void convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_driver(struct conversion_context *ctx, const VkPhysicalDeviceSurfaceInfo2KHR32 *in, VkPhysicalDeviceSurfaceInfo2KHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->surface = in->surface ? wine_surface_from_handle(in->surface)->driver_surface : 0; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT: - { - VkSurfacePresentModeEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSurfacePresentModeEXT32 *in_ext = (const VkSurfacePresentModeEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT; - out_ext->pNext = NULL; - out_ext->presentMode = in_ext->presentMode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSurfaceFormat2KHR_win32_to_host(struct conversion_context *ctx, const VkSurfaceFormat2KHR32 *in, VkSurfaceFormat2KHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: - { - VkImageCompressionPropertiesEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; - out_ext->pNext = NULL; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkSurfaceFormat2KHR_host_to_win32(const VkSurfaceFormat2KHR *in, VkSurfaceFormat2KHR32 *out) -{ - const VkBaseInStructure *in_header; - VkBaseOutStructure32 *out_header = (void *)out; - - if (!in) return; - - out->surfaceFormat = in->surfaceFormat; - - for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT: - { - VkImageCompressionPropertiesEXT32 *out_ext = find_next_struct32(out_header, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT); - const VkImageCompressionPropertiesEXT *in_ext = (const VkImageCompressionPropertiesEXT *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT; - out_ext->imageCompressionFlags = in_ext->imageCompressionFlags; - out_ext->imageCompressionFixedRateFlags = in_ext->imageCompressionFixedRateFlags; - out_header = (void *)out_ext; - break; - } - default: - break; - } - } -} - -static inline VkSurfaceFormat2KHR *convert_VkSurfaceFormat2KHR_array_win32_to_host(struct conversion_context *ctx, const VkSurfaceFormat2KHR32 *in, uint32_t count) -{ - VkSurfaceFormat2KHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSurfaceFormat2KHR_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSurfaceFormat2KHR_array_host_to_win32(const VkSurfaceFormat2KHR *in, VkSurfaceFormat2KHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkSurfaceFormat2KHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPhysicalDeviceToolProperties_win32_to_host(const VkPhysicalDeviceToolProperties32 *in, VkPhysicalDeviceToolProperties *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPhysicalDeviceToolProperties_host_to_win32(const VkPhysicalDeviceToolProperties *in, VkPhysicalDeviceToolProperties32 *out) -{ - if (!in) return; - - memcpy(out->name, in->name, VK_MAX_EXTENSION_NAME_SIZE * sizeof(char)); - memcpy(out->version, in->version, VK_MAX_EXTENSION_NAME_SIZE * sizeof(char)); - out->purposes = in->purposes; - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - memcpy(out->layer, in->layer, VK_MAX_EXTENSION_NAME_SIZE * sizeof(char)); -} - -static inline VkPhysicalDeviceToolProperties *convert_VkPhysicalDeviceToolProperties_array_win32_to_host(struct conversion_context *ctx, const VkPhysicalDeviceToolProperties32 *in, uint32_t count) -{ - VkPhysicalDeviceToolProperties *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPhysicalDeviceToolProperties_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPhysicalDeviceToolProperties_array_host_to_win32(const VkPhysicalDeviceToolProperties *in, VkPhysicalDeviceToolProperties32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPhysicalDeviceToolProperties_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPipelineExecutableInfoKHR_win32_to_host(const VkPipelineExecutableInfoKHR32 *in, VkPipelineExecutableInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pipeline = in->pipeline; - out->executableIndex = in->executableIndex; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineExecutableInternalRepresentationKHR_win32_to_host(const VkPipelineExecutableInternalRepresentationKHR32 *in, VkPipelineExecutableInternalRepresentationKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineExecutableInternalRepresentationKHR_host_to_win32(const VkPipelineExecutableInternalRepresentationKHR *in, VkPipelineExecutableInternalRepresentationKHR32 *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->isText = in->isText; - out->dataSize = in->dataSize; - out->pData = PtrToUlong(in->pData); -} - -static inline VkPipelineExecutableInternalRepresentationKHR *convert_VkPipelineExecutableInternalRepresentationKHR_array_win32_to_host(struct conversion_context *ctx, const VkPipelineExecutableInternalRepresentationKHR32 *in, uint32_t count) -{ - VkPipelineExecutableInternalRepresentationKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineExecutableInternalRepresentationKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineExecutableInternalRepresentationKHR_array_host_to_win32(const VkPipelineExecutableInternalRepresentationKHR *in, VkPipelineExecutableInternalRepresentationKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPipelineExecutableInternalRepresentationKHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPipelineInfoKHR_win32_to_host(const VkPipelineInfoKHR32 *in, VkPipelineInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pipeline = in->pipeline; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineExecutablePropertiesKHR_win32_to_host(const VkPipelineExecutablePropertiesKHR32 *in, VkPipelineExecutablePropertiesKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineExecutablePropertiesKHR_host_to_win32(const VkPipelineExecutablePropertiesKHR *in, VkPipelineExecutablePropertiesKHR32 *out) -{ - if (!in) return; - - out->stages = in->stages; - memcpy(out->name, in->name, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char)); - out->subgroupSize = in->subgroupSize; -} - -static inline VkPipelineExecutablePropertiesKHR *convert_VkPipelineExecutablePropertiesKHR_array_win32_to_host(struct conversion_context *ctx, const VkPipelineExecutablePropertiesKHR32 *in, uint32_t count) -{ - VkPipelineExecutablePropertiesKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPipelineExecutablePropertiesKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPipelineExecutablePropertiesKHR_array_host_to_win32(const VkPipelineExecutablePropertiesKHR *in, VkPipelineExecutablePropertiesKHR32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkPipelineExecutablePropertiesKHR_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkPipelineExecutableStatisticValueKHR_host_to_win32(const VkPipelineExecutableStatisticValueKHR *in, VkPipelineExecutableStatisticValueKHR32 *out, VkFlags selector) -{ - if (!in) return; - - if (selector == VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR) - out->b32 = in->b32; - if (selector == VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR) - out->i64 = in->i64; - if (selector == VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR) - out->u64 = in->u64; - if (selector == VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR) - out->f64 = in->f64; -} - -static inline void convert_VkPipelineExecutableStatisticKHR_win32_to_host(const VkPipelineExecutableStatisticKHR32 *in, VkPipelineExecutableStatisticKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineExecutableStatisticKHR_host_to_win32(const VkPipelineExecutableStatisticKHR *in, VkPipelineExecutableStatisticKHR32 *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; - convert_VkPipelineExecutableStatisticValueKHR_host_to_win32(&in->value, &out->value, in->format); -} - -static inline VkPipelineExecutableStatisticKHR *convert_VkPipelineExecutableStatisticKHR_array_win32_to_host(struct conversion_context *ctx, const VkPipelineExecutableStatisticKHR32 *in, uint32_t count) -{ - VkPipelineExecutableStatisticKHR *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; -} - -static inline void convert_VkPipelineExecutableStatisticKHR_array_host_to_win32(const VkPipelineExecutableStatisticKHR *in, VkPipelineExecutableStatisticKHR32 *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]); - } -} - -static inline void convert_VkPipelineIndirectDeviceAddressInfoNV_win32_to_host(const VkPipelineIndirectDeviceAddressInfoNV32 *in, VkPipelineIndirectDeviceAddressInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pipelineBindPoint = in->pipelineBindPoint; - out->pipeline = in->pipeline; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPipelineInfoEXT_win32_to_host(const VkPipelineInfoEXT32 *in, VkPipelineInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pipeline = in->pipeline; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCheckpointData2NV_win32_to_host(const VkCheckpointData2NV32 *in, VkCheckpointData2NV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCheckpointData2NV_host_to_win32(const VkCheckpointData2NV *in, VkCheckpointData2NV32 *out) -{ - if (!in) return; - - out->stage = in->stage; - out->pCheckpointMarker = PtrToUlong(in->pCheckpointMarker); -} - -static inline VkCheckpointData2NV *convert_VkCheckpointData2NV_array_win32_to_host(struct conversion_context *ctx, const VkCheckpointData2NV32 *in, uint32_t count) -{ - VkCheckpointData2NV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCheckpointData2NV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCheckpointData2NV_array_host_to_win32(const VkCheckpointData2NV *in, VkCheckpointData2NV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkCheckpointData2NV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkCheckpointDataNV_win32_to_host(const VkCheckpointDataNV32 *in, VkCheckpointDataNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCheckpointDataNV_host_to_win32(const VkCheckpointDataNV *in, VkCheckpointDataNV32 *out) -{ - if (!in) return; - - out->stage = in->stage; - out->pCheckpointMarker = PtrToUlong(in->pCheckpointMarker); -} - -static inline VkCheckpointDataNV *convert_VkCheckpointDataNV_array_win32_to_host(struct conversion_context *ctx, const VkCheckpointDataNV32 *in, uint32_t count) -{ - VkCheckpointDataNV *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCheckpointDataNV_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkCheckpointDataNV_array_host_to_win32(const VkCheckpointDataNV *in, VkCheckpointDataNV32 *out, uint32_t count) -{ - unsigned int i; - - if (!in) return; - - for (i = 0; i < count; i++) - { - convert_VkCheckpointDataNV_host_to_win32(&in[i], &out[i]); - } -} - -static inline void convert_VkRenderingAreaInfoKHR_win32_to_host(const VkRenderingAreaInfoKHR32 *in, VkRenderingAreaInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->viewMask = in->viewMask; - out->colorAttachmentCount = in->colorAttachmentCount; - out->pColorAttachmentFormats = (const VkFormat *)UlongToPtr(in->pColorAttachmentFormats); - out->depthAttachmentFormat = in->depthAttachmentFormat; - out->stencilAttachmentFormat = in->stencilAttachmentFormat; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSamplerCaptureDescriptorDataInfoEXT_win32_to_host(const VkSamplerCaptureDescriptorDataInfoEXT32 *in, VkSamplerCaptureDescriptorDataInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->sampler = in->sampler; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkShaderModuleIdentifierEXT_win32_to_host(const VkShaderModuleIdentifierEXT32 *in, VkShaderModuleIdentifierEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkShaderModuleIdentifierEXT_host_to_win32(const VkShaderModuleIdentifierEXT *in, VkShaderModuleIdentifierEXT32 *out) -{ - if (!in) return; - - out->identifierSize = in->identifierSize; - memcpy(out->identifier, in->identifier, VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT * sizeof(uint8_t)); -} - -static inline void convert_VkInitializePerformanceApiInfoINTEL_win32_to_host(const VkInitializePerformanceApiInfoINTEL32 *in, VkInitializePerformanceApiInfoINTEL *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->pUserData = (void *)UlongToPtr(in->pUserData); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkLatencySleepInfoNV_win32_to_host(const VkLatencySleepInfoNV32 *in, VkLatencySleepInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->signalSemaphore = in->signalSemaphore; - out->value = in->value; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkMemoryMapInfoKHR_win32_to_unwrapped_host(const VkMemoryMapInfoKHR32 *in, VkMemoryMapInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->memory = in->memory; - out->offset = in->offset; - out->size = in->size; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline void convert_VkSparseMemoryBind_win64_to_host(const VkSparseMemoryBind *in, VkSparseMemoryBind *out) -{ - if (!in) return; - - out->resourceOffset = in->resourceOffset; - out->size = in->size; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host_memory : 0; - out->memoryOffset = in->memoryOffset; - out->flags = in->flags; -} -#endif /* _WIN64 */ - -static inline void convert_VkSparseMemoryBind_win32_to_host(const VkSparseMemoryBind32 *in, VkSparseMemoryBind *out) -{ - if (!in) return; - - out->resourceOffset = in->resourceOffset; - out->size = in->size; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host_memory : 0; - out->memoryOffset = in->memoryOffset; - out->flags = in->flags; -} - -#ifdef _WIN64 -static inline const VkSparseMemoryBind *convert_VkSparseMemoryBind_array_win64_to_host(struct conversion_context *ctx, const VkSparseMemoryBind *in, uint32_t count) -{ - VkSparseMemoryBind *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseMemoryBind_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSparseMemoryBind *convert_VkSparseMemoryBind_array_win32_to_host(struct conversion_context *ctx, const VkSparseMemoryBind32 *in, uint32_t count) -{ - VkSparseMemoryBind *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseMemoryBind_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkSparseBufferMemoryBindInfo_win64_to_host(struct conversion_context *ctx, const VkSparseBufferMemoryBindInfo *in, VkSparseBufferMemoryBindInfo *out) -{ - if (!in) return; - - out->buffer = in->buffer; - out->bindCount = in->bindCount; - out->pBinds = convert_VkSparseMemoryBind_array_win64_to_host(ctx, in->pBinds, in->bindCount); -} -#endif /* _WIN64 */ - -static inline void convert_VkSparseBufferMemoryBindInfo_win32_to_host(struct conversion_context *ctx, const VkSparseBufferMemoryBindInfo32 *in, VkSparseBufferMemoryBindInfo *out) -{ - if (!in) return; - - out->buffer = in->buffer; - out->bindCount = in->bindCount; - out->pBinds = convert_VkSparseMemoryBind_array_win32_to_host(ctx, (const VkSparseMemoryBind32 *)UlongToPtr(in->pBinds), in->bindCount); -} - -#ifdef _WIN64 -static inline const VkSparseBufferMemoryBindInfo *convert_VkSparseBufferMemoryBindInfo_array_win64_to_host(struct conversion_context *ctx, const VkSparseBufferMemoryBindInfo *in, uint32_t count) -{ - VkSparseBufferMemoryBindInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseBufferMemoryBindInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSparseBufferMemoryBindInfo *convert_VkSparseBufferMemoryBindInfo_array_win32_to_host(struct conversion_context *ctx, const VkSparseBufferMemoryBindInfo32 *in, uint32_t count) -{ - VkSparseBufferMemoryBindInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseBufferMemoryBindInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkSparseImageOpaqueMemoryBindInfo_win64_to_host(struct conversion_context *ctx, const VkSparseImageOpaqueMemoryBindInfo *in, VkSparseImageOpaqueMemoryBindInfo *out) -{ - if (!in) return; - - out->image = in->image; - out->bindCount = in->bindCount; - out->pBinds = convert_VkSparseMemoryBind_array_win64_to_host(ctx, in->pBinds, in->bindCount); -} -#endif /* _WIN64 */ - -static inline void convert_VkSparseImageOpaqueMemoryBindInfo_win32_to_host(struct conversion_context *ctx, const VkSparseImageOpaqueMemoryBindInfo32 *in, VkSparseImageOpaqueMemoryBindInfo *out) -{ - if (!in) return; - - out->image = in->image; - out->bindCount = in->bindCount; - out->pBinds = convert_VkSparseMemoryBind_array_win32_to_host(ctx, (const VkSparseMemoryBind32 *)UlongToPtr(in->pBinds), in->bindCount); -} - -#ifdef _WIN64 -static inline const VkSparseImageOpaqueMemoryBindInfo *convert_VkSparseImageOpaqueMemoryBindInfo_array_win64_to_host(struct conversion_context *ctx, const VkSparseImageOpaqueMemoryBindInfo *in, uint32_t count) -{ - VkSparseImageOpaqueMemoryBindInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageOpaqueMemoryBindInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSparseImageOpaqueMemoryBindInfo *convert_VkSparseImageOpaqueMemoryBindInfo_array_win32_to_host(struct conversion_context *ctx, const VkSparseImageOpaqueMemoryBindInfo32 *in, uint32_t count) -{ - VkSparseImageOpaqueMemoryBindInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageOpaqueMemoryBindInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkSparseImageMemoryBind_win64_to_host(const VkSparseImageMemoryBind *in, VkSparseImageMemoryBind *out) -{ - if (!in) return; - - out->subresource = in->subresource; - out->offset = in->offset; - out->extent = in->extent; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host_memory : 0; - out->memoryOffset = in->memoryOffset; - out->flags = in->flags; -} -#endif /* _WIN64 */ - -static inline void convert_VkSparseImageMemoryBind_win32_to_host(const VkSparseImageMemoryBind32 *in, VkSparseImageMemoryBind *out) -{ - if (!in) return; - - out->subresource = in->subresource; - out->offset = in->offset; - out->extent = in->extent; - out->memory = in->memory ? wine_device_memory_from_handle(in->memory)->host_memory : 0; - out->memoryOffset = in->memoryOffset; - out->flags = in->flags; -} - -#ifdef _WIN64 -static inline const VkSparseImageMemoryBind *convert_VkSparseImageMemoryBind_array_win64_to_host(struct conversion_context *ctx, const VkSparseImageMemoryBind *in, uint32_t count) -{ - VkSparseImageMemoryBind *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryBind_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSparseImageMemoryBind *convert_VkSparseImageMemoryBind_array_win32_to_host(struct conversion_context *ctx, const VkSparseImageMemoryBind32 *in, uint32_t count) -{ - VkSparseImageMemoryBind *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryBind_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkSparseImageMemoryBindInfo_win64_to_host(struct conversion_context *ctx, const VkSparseImageMemoryBindInfo *in, VkSparseImageMemoryBindInfo *out) -{ - if (!in) return; - - out->image = in->image; - out->bindCount = in->bindCount; - out->pBinds = convert_VkSparseImageMemoryBind_array_win64_to_host(ctx, in->pBinds, in->bindCount); -} -#endif /* _WIN64 */ - -static inline void convert_VkSparseImageMemoryBindInfo_win32_to_host(struct conversion_context *ctx, const VkSparseImageMemoryBindInfo32 *in, VkSparseImageMemoryBindInfo *out) -{ - if (!in) return; - - out->image = in->image; - out->bindCount = in->bindCount; - out->pBinds = convert_VkSparseImageMemoryBind_array_win32_to_host(ctx, (const VkSparseImageMemoryBind32 *)UlongToPtr(in->pBinds), in->bindCount); -} - -#ifdef _WIN64 -static inline const VkSparseImageMemoryBindInfo *convert_VkSparseImageMemoryBindInfo_array_win64_to_host(struct conversion_context *ctx, const VkSparseImageMemoryBindInfo *in, uint32_t count) -{ - VkSparseImageMemoryBindInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryBindInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSparseImageMemoryBindInfo *convert_VkSparseImageMemoryBindInfo_array_win32_to_host(struct conversion_context *ctx, const VkSparseImageMemoryBindInfo32 *in, uint32_t count) -{ - VkSparseImageMemoryBindInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSparseImageMemoryBindInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkBindSparseInfo_win64_to_host(struct conversion_context *ctx, const VkBindSparseInfo *in, VkBindSparseInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->waitSemaphoreCount = in->waitSemaphoreCount; - out->pWaitSemaphores = in->pWaitSemaphores; - out->bufferBindCount = in->bufferBindCount; - out->pBufferBinds = convert_VkSparseBufferMemoryBindInfo_array_win64_to_host(ctx, in->pBufferBinds, in->bufferBindCount); - out->imageOpaqueBindCount = in->imageOpaqueBindCount; - out->pImageOpaqueBinds = convert_VkSparseImageOpaqueMemoryBindInfo_array_win64_to_host(ctx, in->pImageOpaqueBinds, in->imageOpaqueBindCount); - out->imageBindCount = in->imageBindCount; - out->pImageBinds = convert_VkSparseImageMemoryBindInfo_array_win64_to_host(ctx, in->pImageBinds, in->imageBindCount); - out->signalSemaphoreCount = in->signalSemaphoreCount; - out->pSignalSemaphores = in->pSignalSemaphores; -} -#endif /* _WIN64 */ - -static inline void convert_VkBindSparseInfo_win32_to_host(struct conversion_context *ctx, const VkBindSparseInfo32 *in, VkBindSparseInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->waitSemaphoreCount = in->waitSemaphoreCount; - out->pWaitSemaphores = (const VkSemaphore *)UlongToPtr(in->pWaitSemaphores); - out->bufferBindCount = in->bufferBindCount; - out->pBufferBinds = convert_VkSparseBufferMemoryBindInfo_array_win32_to_host(ctx, (const VkSparseBufferMemoryBindInfo32 *)UlongToPtr(in->pBufferBinds), in->bufferBindCount); - out->imageOpaqueBindCount = in->imageOpaqueBindCount; - out->pImageOpaqueBinds = convert_VkSparseImageOpaqueMemoryBindInfo_array_win32_to_host(ctx, (const VkSparseImageOpaqueMemoryBindInfo32 *)UlongToPtr(in->pImageOpaqueBinds), in->imageOpaqueBindCount); - out->imageBindCount = in->imageBindCount; - out->pImageBinds = convert_VkSparseImageMemoryBindInfo_array_win32_to_host(ctx, (const VkSparseImageMemoryBindInfo32 *)UlongToPtr(in->pImageBinds), in->imageBindCount); - out->signalSemaphoreCount = in->signalSemaphoreCount; - out->pSignalSemaphores = (const VkSemaphore *)UlongToPtr(in->pSignalSemaphores); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO: - { - VkDeviceGroupBindSparseInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupBindSparseInfo32 *in_ext = (const VkDeviceGroupBindSparseInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO; - out_ext->pNext = NULL; - out_ext->resourceDeviceIndex = in_ext->resourceDeviceIndex; - out_ext->memoryDeviceIndex = in_ext->memoryDeviceIndex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO: - { - VkTimelineSemaphoreSubmitInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkTimelineSemaphoreSubmitInfo32 *in_ext = (const VkTimelineSemaphoreSubmitInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO; - out_ext->pNext = NULL; - out_ext->waitSemaphoreValueCount = in_ext->waitSemaphoreValueCount; - out_ext->pWaitSemaphoreValues = (const uint64_t *)UlongToPtr(in_ext->pWaitSemaphoreValues); - out_ext->signalSemaphoreValueCount = in_ext->signalSemaphoreValueCount; - out_ext->pSignalSemaphoreValues = (const uint64_t *)UlongToPtr(in_ext->pSignalSemaphoreValues); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT: - { - VkFrameBoundaryEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkFrameBoundaryEXT32 *in_ext = (const VkFrameBoundaryEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->frameID = in_ext->frameID; - out_ext->imageCount = in_ext->imageCount; - out_ext->pImages = (const VkImage *)UlongToPtr(in_ext->pImages); - out_ext->bufferCount = in_ext->bufferCount; - out_ext->pBuffers = (const VkBuffer *)UlongToPtr(in_ext->pBuffers); - out_ext->tagName = in_ext->tagName; - out_ext->tagSize = in_ext->tagSize; - out_ext->pTag = (const void *)UlongToPtr(in_ext->pTag); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkBindSparseInfo *convert_VkBindSparseInfo_array_win64_to_host(struct conversion_context *ctx, const VkBindSparseInfo *in, uint32_t count) -{ - VkBindSparseInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindSparseInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkBindSparseInfo *convert_VkBindSparseInfo_array_win32_to_host(struct conversion_context *ctx, const VkBindSparseInfo32 *in, uint32_t count) -{ - VkBindSparseInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkBindSparseInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkOutOfBandQueueTypeInfoNV_win32_to_host(const VkOutOfBandQueueTypeInfoNV32 *in, VkOutOfBandQueueTypeInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->queueType = in->queueType; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkPresentRegionKHR_win32_to_host(const VkPresentRegionKHR32 *in, VkPresentRegionKHR *out) -{ - if (!in) return; - - out->rectangleCount = in->rectangleCount; - out->pRectangles = (const VkRectLayerKHR *)UlongToPtr(in->pRectangles); -} - -static inline const VkPresentRegionKHR *convert_VkPresentRegionKHR_array_win32_to_host(struct conversion_context *ctx, const VkPresentRegionKHR32 *in, uint32_t count) -{ - VkPresentRegionKHR *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkPresentRegionKHR_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkPresentInfoKHR_win32_to_host(struct conversion_context *ctx, const VkPresentInfoKHR32 *in, VkPresentInfoKHR *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->waitSemaphoreCount = in->waitSemaphoreCount; - out->pWaitSemaphores = (const VkSemaphore *)UlongToPtr(in->pWaitSemaphores); - out->swapchainCount = in->swapchainCount; - out->pSwapchains = (const VkSwapchainKHR *)UlongToPtr(in->pSwapchains); - out->pImageIndices = (const uint32_t *)UlongToPtr(in->pImageIndices); - out->pResults = (VkResult *)UlongToPtr(in->pResults); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR: - { - VkPresentRegionsKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPresentRegionsKHR32 *in_ext = (const VkPresentRegionsKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR; - out_ext->pNext = NULL; - out_ext->swapchainCount = in_ext->swapchainCount; - out_ext->pRegions = convert_VkPresentRegionKHR_array_win32_to_host(ctx, (const VkPresentRegionKHR32 *)UlongToPtr(in_ext->pRegions), in_ext->swapchainCount); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR: - { - VkDeviceGroupPresentInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupPresentInfoKHR32 *in_ext = (const VkDeviceGroupPresentInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR; - out_ext->pNext = NULL; - out_ext->swapchainCount = in_ext->swapchainCount; - out_ext->pDeviceMasks = (const uint32_t *)UlongToPtr(in_ext->pDeviceMasks); - out_ext->mode = in_ext->mode; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PRESENT_ID_KHR: - { - VkPresentIdKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPresentIdKHR32 *in_ext = (const VkPresentIdKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PRESENT_ID_KHR; - out_ext->pNext = NULL; - out_ext->swapchainCount = in_ext->swapchainCount; - out_ext->pPresentIds = (const uint64_t *)UlongToPtr(in_ext->pPresentIds); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT: - { - VkFrameBoundaryEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkFrameBoundaryEXT32 *in_ext = (const VkFrameBoundaryEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->frameID = in_ext->frameID; - out_ext->imageCount = in_ext->imageCount; - out_ext->pImages = (const VkImage *)UlongToPtr(in_ext->pImages); - out_ext->bufferCount = in_ext->bufferCount; - out_ext->pBuffers = (const VkBuffer *)UlongToPtr(in_ext->pBuffers); - out_ext->tagName = in_ext->tagName; - out_ext->tagSize = in_ext->tagSize; - out_ext->pTag = (const void *)UlongToPtr(in_ext->pTag); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_FENCE_INFO_EXT: - { - VkSwapchainPresentFenceInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSwapchainPresentFenceInfoEXT32 *in_ext = (const VkSwapchainPresentFenceInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_FENCE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->swapchainCount = in_ext->swapchainCount; - out_ext->pFences = (const VkFence *)UlongToPtr(in_ext->pFences); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT: - { - VkSwapchainPresentModeInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkSwapchainPresentModeInfoEXT32 *in_ext = (const VkSwapchainPresentModeInfoEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT; - out_ext->pNext = NULL; - out_ext->swapchainCount = in_ext->swapchainCount; - out_ext->pPresentModes = (const VkPresentModeKHR *)UlongToPtr(in_ext->pPresentModes); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline void convert_VkSubmitInfo_win64_to_host(struct conversion_context *ctx, const VkSubmitInfo *in, VkSubmitInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->waitSemaphoreCount = in->waitSemaphoreCount; - out->pWaitSemaphores = in->pWaitSemaphores; - out->pWaitDstStageMask = in->pWaitDstStageMask; - out->commandBufferCount = in->commandBufferCount; - out->pCommandBuffers = convert_VkCommandBuffer_array_win64_to_host(ctx, in->pCommandBuffers, in->commandBufferCount); - out->signalSemaphoreCount = in->signalSemaphoreCount; - out->pSignalSemaphores = in->pSignalSemaphores; -} -#endif /* _WIN64 */ - -static inline void convert_VkSubmitInfo_win32_to_host(struct conversion_context *ctx, const VkSubmitInfo32 *in, VkSubmitInfo *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->waitSemaphoreCount = in->waitSemaphoreCount; - out->pWaitSemaphores = (const VkSemaphore *)UlongToPtr(in->pWaitSemaphores); - out->pWaitDstStageMask = (const VkPipelineStageFlags *)UlongToPtr(in->pWaitDstStageMask); - out->commandBufferCount = in->commandBufferCount; - out->pCommandBuffers = convert_VkCommandBuffer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->pCommandBuffers), in->commandBufferCount); - out->signalSemaphoreCount = in->signalSemaphoreCount; - out->pSignalSemaphores = (const VkSemaphore *)UlongToPtr(in->pSignalSemaphores); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO: - { - VkDeviceGroupSubmitInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceGroupSubmitInfo32 *in_ext = (const VkDeviceGroupSubmitInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO; - out_ext->pNext = NULL; - out_ext->waitSemaphoreCount = in_ext->waitSemaphoreCount; - out_ext->pWaitSemaphoreDeviceIndices = (const uint32_t *)UlongToPtr(in_ext->pWaitSemaphoreDeviceIndices); - out_ext->commandBufferCount = in_ext->commandBufferCount; - out_ext->pCommandBufferDeviceMasks = (const uint32_t *)UlongToPtr(in_ext->pCommandBufferDeviceMasks); - out_ext->signalSemaphoreCount = in_ext->signalSemaphoreCount; - out_ext->pSignalSemaphoreDeviceIndices = (const uint32_t *)UlongToPtr(in_ext->pSignalSemaphoreDeviceIndices); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO: - { - VkProtectedSubmitInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkProtectedSubmitInfo32 *in_ext = (const VkProtectedSubmitInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO; - out_ext->pNext = NULL; - out_ext->protectedSubmit = in_ext->protectedSubmit; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO: - { - VkTimelineSemaphoreSubmitInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkTimelineSemaphoreSubmitInfo32 *in_ext = (const VkTimelineSemaphoreSubmitInfo32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO; - out_ext->pNext = NULL; - out_ext->waitSemaphoreValueCount = in_ext->waitSemaphoreValueCount; - out_ext->pWaitSemaphoreValues = (const uint64_t *)UlongToPtr(in_ext->pWaitSemaphoreValues); - out_ext->signalSemaphoreValueCount = in_ext->signalSemaphoreValueCount; - out_ext->pSignalSemaphoreValues = (const uint64_t *)UlongToPtr(in_ext->pSignalSemaphoreValues); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR: - { - VkPerformanceQuerySubmitInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPerformanceQuerySubmitInfoKHR32 *in_ext = (const VkPerformanceQuerySubmitInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR; - out_ext->pNext = NULL; - out_ext->counterPassIndex = in_ext->counterPassIndex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT: - { - VkFrameBoundaryEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkFrameBoundaryEXT32 *in_ext = (const VkFrameBoundaryEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->frameID = in_ext->frameID; - out_ext->imageCount = in_ext->imageCount; - out_ext->pImages = (const VkImage *)UlongToPtr(in_ext->pImages); - out_ext->bufferCount = in_ext->bufferCount; - out_ext->pBuffers = (const VkBuffer *)UlongToPtr(in_ext->pBuffers); - out_ext->tagName = in_ext->tagName; - out_ext->tagSize = in_ext->tagSize; - out_ext->pTag = (const void *)UlongToPtr(in_ext->pTag); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV: - { - VkLatencySubmissionPresentIdNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkLatencySubmissionPresentIdNV32 *in_ext = (const VkLatencySubmissionPresentIdNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV; - out_ext->pNext = NULL; - out_ext->presentID = in_ext->presentID; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkSubmitInfo *convert_VkSubmitInfo_array_win64_to_host(struct conversion_context *ctx, const VkSubmitInfo *in, uint32_t count) -{ - VkSubmitInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubmitInfo_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSubmitInfo *convert_VkSubmitInfo_array_win32_to_host(struct conversion_context *ctx, const VkSubmitInfo32 *in, uint32_t count) -{ - VkSubmitInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubmitInfo_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSemaphoreSubmitInfo_win32_to_host(const VkSemaphoreSubmitInfo32 *in, VkSemaphoreSubmitInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->semaphore = in->semaphore; - out->value = in->value; - out->stageMask = in->stageMask; - out->deviceIndex = in->deviceIndex; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkSemaphoreSubmitInfo *convert_VkSemaphoreSubmitInfo_array_win32_to_host(struct conversion_context *ctx, const VkSemaphoreSubmitInfo32 *in, uint32_t count) -{ - VkSemaphoreSubmitInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSemaphoreSubmitInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkCommandBufferSubmitInfo_win64_to_host(const VkCommandBufferSubmitInfo *in, VkCommandBufferSubmitInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->commandBuffer = wine_cmd_buffer_from_handle(in->commandBuffer)->host_command_buffer; - out->deviceMask = in->deviceMask; -} -#endif /* _WIN64 */ - -static inline void convert_VkCommandBufferSubmitInfo_win32_to_host(const VkCommandBufferSubmitInfo32 *in, VkCommandBufferSubmitInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->commandBuffer = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(in->commandBuffer))->host_command_buffer; - out->deviceMask = in->deviceMask; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline const VkCommandBufferSubmitInfo *convert_VkCommandBufferSubmitInfo_array_win64_to_host(struct conversion_context *ctx, const VkCommandBufferSubmitInfo *in, uint32_t count) -{ - VkCommandBufferSubmitInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCommandBufferSubmitInfo_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkCommandBufferSubmitInfo *convert_VkCommandBufferSubmitInfo_array_win32_to_host(struct conversion_context *ctx, const VkCommandBufferSubmitInfo32 *in, uint32_t count) -{ - VkCommandBufferSubmitInfo *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCommandBufferSubmitInfo_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkSubmitInfo2_win64_to_host(struct conversion_context *ctx, const VkSubmitInfo2 *in, VkSubmitInfo2 *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - out->waitSemaphoreInfoCount = in->waitSemaphoreInfoCount; - out->pWaitSemaphoreInfos = in->pWaitSemaphoreInfos; - out->commandBufferInfoCount = in->commandBufferInfoCount; - out->pCommandBufferInfos = convert_VkCommandBufferSubmitInfo_array_win64_to_host(ctx, in->pCommandBufferInfos, in->commandBufferInfoCount); - out->signalSemaphoreInfoCount = in->signalSemaphoreInfoCount; - out->pSignalSemaphoreInfos = in->pSignalSemaphoreInfos; -} -#endif /* _WIN64 */ - -static inline void convert_VkSubmitInfo2_win32_to_host(struct conversion_context *ctx, const VkSubmitInfo232 *in, VkSubmitInfo2 *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->waitSemaphoreInfoCount = in->waitSemaphoreInfoCount; - out->pWaitSemaphoreInfos = convert_VkSemaphoreSubmitInfo_array_win32_to_host(ctx, (const VkSemaphoreSubmitInfo32 *)UlongToPtr(in->pWaitSemaphoreInfos), in->waitSemaphoreInfoCount); - out->commandBufferInfoCount = in->commandBufferInfoCount; - out->pCommandBufferInfos = convert_VkCommandBufferSubmitInfo_array_win32_to_host(ctx, (const VkCommandBufferSubmitInfo32 *)UlongToPtr(in->pCommandBufferInfos), in->commandBufferInfoCount); - out->signalSemaphoreInfoCount = in->signalSemaphoreInfoCount; - out->pSignalSemaphoreInfos = convert_VkSemaphoreSubmitInfo_array_win32_to_host(ctx, (const VkSemaphoreSubmitInfo32 *)UlongToPtr(in->pSignalSemaphoreInfos), in->signalSemaphoreInfoCount); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR: - { - VkPerformanceQuerySubmitInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkPerformanceQuerySubmitInfoKHR32 *in_ext = (const VkPerformanceQuerySubmitInfoKHR32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR; - out_ext->pNext = NULL; - out_ext->counterPassIndex = in_ext->counterPassIndex; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT: - { - VkFrameBoundaryEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkFrameBoundaryEXT32 *in_ext = (const VkFrameBoundaryEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->frameID = in_ext->frameID; - out_ext->imageCount = in_ext->imageCount; - out_ext->pImages = (const VkImage *)UlongToPtr(in_ext->pImages); - out_ext->bufferCount = in_ext->bufferCount; - out_ext->pBuffers = (const VkBuffer *)UlongToPtr(in_ext->pBuffers); - out_ext->tagName = in_ext->tagName; - out_ext->tagSize = in_ext->tagSize; - out_ext->pTag = (const void *)UlongToPtr(in_ext->pTag); - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - case VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV: - { - VkLatencySubmissionPresentIdNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkLatencySubmissionPresentIdNV32 *in_ext = (const VkLatencySubmissionPresentIdNV32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV; - out_ext->pNext = NULL; - out_ext->presentID = in_ext->presentID; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -#ifdef _WIN64 -static inline const VkSubmitInfo2 *convert_VkSubmitInfo2_array_win64_to_host(struct conversion_context *ctx, const VkSubmitInfo2 *in, uint32_t count) -{ - VkSubmitInfo2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubmitInfo2_win64_to_host(ctx, &in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkSubmitInfo2 *convert_VkSubmitInfo2_array_win32_to_host(struct conversion_context *ctx, const VkSubmitInfo232 *in, uint32_t count) -{ - VkSubmitInfo2 *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkSubmitInfo2_win32_to_host(ctx, &in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkReleaseSwapchainImagesInfoEXT_win32_to_host(const VkReleaseSwapchainImagesInfoEXT32 *in, VkReleaseSwapchainImagesInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->swapchain = in->swapchain; - out->imageIndexCount = in->imageIndexCount; - out->pImageIndices = (const uint32_t *)UlongToPtr(in->pImageIndices); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline void convert_VkDebugUtilsObjectNameInfoEXT_win64_to_host(const VkDebugUtilsObjectNameInfoEXT *in, VkDebugUtilsObjectNameInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->objectType = in->objectType; - out->objectHandle = wine_vk_unwrap_handle(in->objectType, in->objectHandle); - out->pObjectName = in->pObjectName; -} -#endif /* _WIN64 */ - -static inline void convert_VkDebugUtilsObjectNameInfoEXT_win32_to_host(const VkDebugUtilsObjectNameInfoEXT32 *in, VkDebugUtilsObjectNameInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->objectType = in->objectType; - out->objectHandle = wine_vk_unwrap_handle(in->objectType, in->objectHandle); - out->pObjectName = (const char *)UlongToPtr(in->pObjectName); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static inline void convert_VkDebugUtilsObjectTagInfoEXT_win64_to_host(const VkDebugUtilsObjectTagInfoEXT *in, VkDebugUtilsObjectTagInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->objectType = in->objectType; - out->objectHandle = wine_vk_unwrap_handle(in->objectType, in->objectHandle); - out->tagName = in->tagName; - out->tagSize = in->tagSize; - out->pTag = in->pTag; -} -#endif /* _WIN64 */ - -static inline void convert_VkDebugUtilsObjectTagInfoEXT_win32_to_host(const VkDebugUtilsObjectTagInfoEXT32 *in, VkDebugUtilsObjectTagInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->objectType = in->objectType; - out->objectHandle = wine_vk_unwrap_handle(in->objectType, in->objectHandle); - out->tagName = in->tagName; - out->tagSize = in->tagSize; - out->pTag = (const void *)UlongToPtr(in->pTag); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkHdrMetadataEXT_win32_to_host(const VkHdrMetadataEXT32 *in, VkHdrMetadataEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->displayPrimaryRed = in->displayPrimaryRed; - out->displayPrimaryGreen = in->displayPrimaryGreen; - out->displayPrimaryBlue = in->displayPrimaryBlue; - out->whitePoint = in->whitePoint; - out->maxLuminance = in->maxLuminance; - out->minLuminance = in->minLuminance; - out->maxContentLightLevel = in->maxContentLightLevel; - out->maxFrameAverageLightLevel = in->maxFrameAverageLightLevel; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkHdrMetadataEXT *convert_VkHdrMetadataEXT_array_win32_to_host(struct conversion_context *ctx, const VkHdrMetadataEXT32 *in, uint32_t count) -{ - VkHdrMetadataEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkHdrMetadataEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSetLatencyMarkerInfoNV_win32_to_host(const VkSetLatencyMarkerInfoNV32 *in, VkSetLatencyMarkerInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->presentID = in->presentID; - out->marker = in->marker; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkLatencySleepModeInfoNV_win32_to_host(const VkLatencySleepModeInfoNV32 *in, VkLatencySleepModeInfoNV *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->lowLatencyMode = in->lowLatencyMode; - out->lowLatencyBoost = in->lowLatencyBoost; - out->minimumIntervalUs = in->minimumIntervalUs; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkSemaphoreSignalInfo_win32_to_host(const VkSemaphoreSignalInfo32 *in, VkSemaphoreSignalInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->semaphore = in->semaphore; - out->value = in->value; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkDebugUtilsLabelEXT *convert_VkDebugUtilsLabelEXT_array_win32_to_host(struct conversion_context *ctx, const VkDebugUtilsLabelEXT32 *in, uint32_t count) -{ - VkDebugUtilsLabelEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDebugUtilsLabelEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline const VkDebugUtilsObjectNameInfoEXT *convert_VkDebugUtilsObjectNameInfoEXT_array_win64_to_host(struct conversion_context *ctx, const VkDebugUtilsObjectNameInfoEXT *in, uint32_t count) -{ - VkDebugUtilsObjectNameInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDebugUtilsObjectNameInfoEXT_win64_to_host(&in[i], &out[i]); - } - - return out; -} -#endif /* _WIN64 */ - -static inline const VkDebugUtilsObjectNameInfoEXT *convert_VkDebugUtilsObjectNameInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDebugUtilsObjectNameInfoEXT32 *in, uint32_t count) -{ - VkDebugUtilsObjectNameInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkDebugUtilsObjectNameInfoEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -#ifdef _WIN64 -static inline void convert_VkDebugUtilsMessengerCallbackDataEXT_win64_to_host(struct conversion_context *ctx, const VkDebugUtilsMessengerCallbackDataEXT *in, VkDebugUtilsMessengerCallbackDataEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - out->pMessageIdName = in->pMessageIdName; - out->messageIdNumber = in->messageIdNumber; - out->pMessage = in->pMessage; - out->queueLabelCount = in->queueLabelCount; - out->pQueueLabels = in->pQueueLabels; - out->cmdBufLabelCount = in->cmdBufLabelCount; - out->pCmdBufLabels = in->pCmdBufLabels; - out->objectCount = in->objectCount; - out->pObjects = convert_VkDebugUtilsObjectNameInfoEXT_array_win64_to_host(ctx, in->pObjects, in->objectCount); -} -#endif /* _WIN64 */ - -static inline void convert_VkDebugUtilsMessengerCallbackDataEXT_win32_to_host(struct conversion_context *ctx, const VkDebugUtilsMessengerCallbackDataEXT32 *in, VkDebugUtilsMessengerCallbackDataEXT *out) -{ - const VkBaseInStructure32 *in_header; - VkBaseOutStructure *out_header = (void *)out; - - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->pMessageIdName = (const char *)UlongToPtr(in->pMessageIdName); - out->messageIdNumber = in->messageIdNumber; - out->pMessage = (const char *)UlongToPtr(in->pMessage); - out->queueLabelCount = in->queueLabelCount; - out->pQueueLabels = convert_VkDebugUtilsLabelEXT_array_win32_to_host(ctx, (const VkDebugUtilsLabelEXT32 *)UlongToPtr(in->pQueueLabels), in->queueLabelCount); - out->cmdBufLabelCount = in->cmdBufLabelCount; - out->pCmdBufLabels = convert_VkDebugUtilsLabelEXT_array_win32_to_host(ctx, (const VkDebugUtilsLabelEXT32 *)UlongToPtr(in->pCmdBufLabels), in->cmdBufLabelCount); - out->objectCount = in->objectCount; - out->pObjects = convert_VkDebugUtilsObjectNameInfoEXT_array_win32_to_host(ctx, (const VkDebugUtilsObjectNameInfoEXT32 *)UlongToPtr(in->pObjects), in->objectCount); - - for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext)) - { - switch (in_header->sType) - { - case VK_STRUCTURE_TYPE_DEVICE_ADDRESS_BINDING_CALLBACK_DATA_EXT: - { - VkDeviceAddressBindingCallbackDataEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); - const VkDeviceAddressBindingCallbackDataEXT32 *in_ext = (const VkDeviceAddressBindingCallbackDataEXT32 *)in_header; - out_ext->sType = VK_STRUCTURE_TYPE_DEVICE_ADDRESS_BINDING_CALLBACK_DATA_EXT; - out_ext->pNext = NULL; - out_ext->flags = in_ext->flags; - out_ext->baseAddress = in_ext->baseAddress; - out_ext->size = in_ext->size; - out_ext->bindingType = in_ext->bindingType; - out_header->pNext = (void *)out_ext; - out_header = (void *)out_ext; - break; - } - default: - FIXME("Unhandled sType %u.\n", in_header->sType); - break; - } - } -} - -static inline void convert_VkHostImageLayoutTransitionInfoEXT_win32_to_host(const VkHostImageLayoutTransitionInfoEXT32 *in, VkHostImageLayoutTransitionInfoEXT *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->image = in->image; - out->oldLayout = in->oldLayout; - out->newLayout = in->newLayout; - out->subresourceRange = in->subresourceRange; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkHostImageLayoutTransitionInfoEXT *convert_VkHostImageLayoutTransitionInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkHostImageLayoutTransitionInfoEXT32 *in, uint32_t count) -{ - VkHostImageLayoutTransitionInfoEXT *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkHostImageLayoutTransitionInfoEXT_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkMemoryUnmapInfoKHR_win32_to_unwrapped_host(const VkMemoryUnmapInfoKHR32 *in, VkMemoryUnmapInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->memory = in->memory; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline void convert_VkCopyDescriptorSet_win32_to_host(const VkCopyDescriptorSet32 *in, VkCopyDescriptorSet *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->srcSet = in->srcSet; - out->srcBinding = in->srcBinding; - out->srcArrayElement = in->srcArrayElement; - out->dstSet = in->dstSet; - out->dstBinding = in->dstBinding; - out->dstArrayElement = in->dstArrayElement; - out->descriptorCount = in->descriptorCount; - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -static inline const VkCopyDescriptorSet *convert_VkCopyDescriptorSet_array_win32_to_host(struct conversion_context *ctx, const VkCopyDescriptorSet32 *in, uint32_t count) -{ - VkCopyDescriptorSet *out; - unsigned int i; - - if (!in || !count) return NULL; - - out = conversion_context_alloc(ctx, count * sizeof(*out)); - for (i = 0; i < count; i++) - { - convert_VkCopyDescriptorSet_win32_to_host(&in[i], &out[i]); - } - - return out; -} - -static inline void convert_VkSemaphoreWaitInfo_win32_to_host(const VkSemaphoreWaitInfo32 *in, VkSemaphoreWaitInfo *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = NULL; - out->flags = in->flags; - out->semaphoreCount = in->semaphoreCount; - out->pSemaphores = (const VkSemaphore *)UlongToPtr(in->pSemaphores); - out->pValues = (const uint64_t *)UlongToPtr(in->pValues); - if (in->pNext) - FIXME("Unexpected pNext\n"); -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAcquireNextImage2KHR(void *args) -{ - struct vkAcquireNextImage2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pAcquireInfo, params->pImageIndex); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireNextImage2KHR(wine_device_from_handle(params->device)->host_device, params->pAcquireInfo, params->pImageIndex); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAcquireNextImage2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pAcquireInfo; - PTR32 pImageIndex; - VkResult result; - } *params = args; - VkAcquireNextImageInfoKHR pAcquireInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pAcquireInfo, params->pImageIndex); - - convert_VkAcquireNextImageInfoKHR_win32_to_host((const VkAcquireNextImageInfoKHR32 *)UlongToPtr(params->pAcquireInfo), &pAcquireInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAcquireNextImage2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pAcquireInfo_host, (uint32_t *)UlongToPtr(params->pImageIndex)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAcquireNextImageKHR(void *args) -{ - struct vkAcquireNextImageKHR_params *params = args; - - TRACE("%p, 0x%s, 0x%s, 0x%s, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->timeout), wine_dbgstr_longlong(params->semaphore), wine_dbgstr_longlong(params->fence), params->pImageIndex); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireNextImageKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, params->timeout, params->semaphore, params->fence, params->pImageIndex); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAcquireNextImageKHR(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - VkFence DECLSPEC_ALIGN(8) fence; - PTR32 pImageIndex; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, 0x%s, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->timeout), wine_dbgstr_longlong(params->semaphore), wine_dbgstr_longlong(params->fence), params->pImageIndex); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAcquireNextImageKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, params->timeout, params->semaphore, params->fence, (uint32_t *)UlongToPtr(params->pImageIndex)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAcquirePerformanceConfigurationINTEL(void *args) -{ - struct vkAcquirePerformanceConfigurationINTEL_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pAcquireInfo, params->pConfiguration); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquirePerformanceConfigurationINTEL(wine_device_from_handle(params->device)->host_device, params->pAcquireInfo, params->pConfiguration); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAcquirePerformanceConfigurationINTEL(void *args) -{ - struct - { - PTR32 device; - PTR32 pAcquireInfo; - PTR32 pConfiguration; - VkResult result; - } *params = args; - VkPerformanceConfigurationAcquireInfoINTEL pAcquireInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pAcquireInfo, params->pConfiguration); - - convert_VkPerformanceConfigurationAcquireInfoINTEL_win32_to_host((const VkPerformanceConfigurationAcquireInfoINTEL32 *)UlongToPtr(params->pAcquireInfo), &pAcquireInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAcquirePerformanceConfigurationINTEL(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pAcquireInfo_host, (VkPerformanceConfigurationINTEL *)UlongToPtr(params->pConfiguration)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAcquireProfilingLockKHR(void *args) -{ - struct vkAcquireProfilingLockKHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireProfilingLockKHR(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAcquireProfilingLockKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - VkResult result; - } *params = args; - VkAcquireProfilingLockInfoKHR pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkAcquireProfilingLockInfoKHR_win32_to_host((const VkAcquireProfilingLockInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAcquireProfilingLockKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAllocateCommandBuffers(void *args) -{ - struct vkAllocateCommandBuffers_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pAllocateInfo, params->pCommandBuffers); - - params->result = wine_vkAllocateCommandBuffers(params->device, params->pAllocateInfo, params->pCommandBuffers); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAllocateCommandBuffers(void *args) -{ - struct - { - PTR32 device; - PTR32 pAllocateInfo; - PTR32 pCommandBuffers; - VkResult result; - } *params = args; - VkCommandBufferAllocateInfo pAllocateInfo_host; - VkCommandBuffer *pCommandBuffers_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pAllocateInfo, params->pCommandBuffers); - - init_conversion_context(ctx); - convert_VkCommandBufferAllocateInfo_win32_to_unwrapped_host((const VkCommandBufferAllocateInfo32 *)UlongToPtr(params->pAllocateInfo), &pAllocateInfo_host); - pCommandBuffers_host = convert_VkCommandBuffer_array_win32_to_unwrapped_host(ctx, (PTR32 *)UlongToPtr(params->pCommandBuffers), ((const VkCommandBufferAllocateInfo32 *)UlongToPtr(params->pAllocateInfo))->commandBufferCount); - params->result = wine_vkAllocateCommandBuffers((VkDevice)UlongToPtr(params->device), &pAllocateInfo_host, pCommandBuffers_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAllocateDescriptorSets(void *args) -{ - struct vkAllocateDescriptorSets_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pAllocateInfo, params->pDescriptorSets); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkAllocateDescriptorSets(wine_device_from_handle(params->device)->host_device, params->pAllocateInfo, params->pDescriptorSets); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAllocateDescriptorSets(void *args) -{ - struct - { - PTR32 device; - PTR32 pAllocateInfo; - PTR32 pDescriptorSets; - VkResult result; - } *params = args; - VkDescriptorSetAllocateInfo pAllocateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pAllocateInfo, params->pDescriptorSets); - - init_conversion_context(ctx); - convert_VkDescriptorSetAllocateInfo_win32_to_host(ctx, (const VkDescriptorSetAllocateInfo32 *)UlongToPtr(params->pAllocateInfo), &pAllocateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAllocateDescriptorSets(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pAllocateInfo_host, (VkDescriptorSet *)UlongToPtr(params->pDescriptorSets)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkAllocateMemory(void *args) -{ - struct vkAllocateMemory_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pAllocateInfo, params->pAllocator, params->pMemory); - - params->result = wine_vkAllocateMemory(params->device, params->pAllocateInfo, params->pAllocator, params->pMemory); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkAllocateMemory(void *args) -{ - struct - { - PTR32 device; - PTR32 pAllocateInfo; - PTR32 pAllocator; - PTR32 pMemory; - VkResult result; - } *params = args; - VkMemoryAllocateInfo pAllocateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pAllocateInfo, params->pAllocator, params->pMemory); - - init_conversion_context(ctx); - convert_VkMemoryAllocateInfo_win32_to_host(ctx, (const VkMemoryAllocateInfo32 *)UlongToPtr(params->pAllocateInfo), &pAllocateInfo_host); - params->result = wine_vkAllocateMemory((VkDevice)UlongToPtr(params->device), &pAllocateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkDeviceMemory *)UlongToPtr(params->pMemory)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBeginCommandBuffer(void *args) -{ - struct vkBeginCommandBuffer_params *params = args; - - TRACE("%p, %p\n", params->commandBuffer, params->pBeginInfo); - - params->result = wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkBeginCommandBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pBeginInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBeginCommandBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pBeginInfo; - VkResult result; - } *params = args; - VkCommandBufferBeginInfo pBeginInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->commandBuffer, params->pBeginInfo); - - init_conversion_context(ctx); - convert_VkCommandBufferBeginInfo_win32_to_host(ctx, (const VkCommandBufferBeginInfo32 *)UlongToPtr(params->pBeginInfo), &pBeginInfo_host); - params->result = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkBeginCommandBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pBeginInfo_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindAccelerationStructureMemoryNV(void *args) -{ - struct vkBindAccelerationStructureMemoryNV_params *params = args; - const VkBindAccelerationStructureMemoryInfoNV *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindAccelerationStructureMemoryInfoNV_array_win64_to_host(ctx, params->pBindInfos, params->bindInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindAccelerationStructureMemoryNV(wine_device_from_handle(params->device)->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindAccelerationStructureMemoryNV(void *args) -{ - struct - { - PTR32 device; - uint32_t bindInfoCount; - PTR32 pBindInfos; - VkResult result; - } *params = args; - const VkBindAccelerationStructureMemoryInfoNV *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindAccelerationStructureMemoryInfoNV_array_win32_to_host(ctx, (const VkBindAccelerationStructureMemoryInfoNV32 *)UlongToPtr(params->pBindInfos), params->bindInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindAccelerationStructureMemoryNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindBufferMemory(void *args) -{ - struct vkBindBufferMemory_params *params = args; - - TRACE("%p, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->buffer), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindBufferMemory(wine_device_from_handle(params->device)->host_device, params->buffer, wine_device_memory_from_handle(params->memory)->host_memory, params->memoryOffset); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindBufferMemory(void *args) -{ - struct - { - PTR32 device; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->buffer), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindBufferMemory(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->buffer, wine_device_memory_from_handle(params->memory)->host_memory, params->memoryOffset); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindBufferMemory2(void *args) -{ - struct vkBindBufferMemory2_params *params = args; - const VkBindBufferMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win64_to_host(ctx, params->pBindInfos, params->bindInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindBufferMemory2(wine_device_from_handle(params->device)->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindBufferMemory2(void *args) -{ - struct - { - PTR32 device; - uint32_t bindInfoCount; - PTR32 pBindInfos; - VkResult result; - } *params = args; - const VkBindBufferMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win32_to_host(ctx, (const VkBindBufferMemoryInfo32 *)UlongToPtr(params->pBindInfos), params->bindInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindBufferMemory2(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindBufferMemory2KHR(void *args) -{ - struct vkBindBufferMemory2KHR_params *params = args; - const VkBindBufferMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win64_to_host(ctx, params->pBindInfos, params->bindInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindBufferMemory2KHR(wine_device_from_handle(params->device)->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindBufferMemory2KHR(void *args) -{ - struct - { - PTR32 device; - uint32_t bindInfoCount; - PTR32 pBindInfos; - VkResult result; - } *params = args; - const VkBindBufferMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindBufferMemoryInfo_array_win32_to_host(ctx, (const VkBindBufferMemoryInfo32 *)UlongToPtr(params->pBindInfos), params->bindInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindBufferMemory2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindImageMemory(void *args) -{ - struct vkBindImageMemory_params *params = args; - - TRACE("%p, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->image), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindImageMemory(wine_device_from_handle(params->device)->host_device, params->image, wine_device_memory_from_handle(params->memory)->host_memory, params->memoryOffset); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindImageMemory(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) memoryOffset; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->image), wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->memoryOffset)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindImageMemory(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, wine_device_memory_from_handle(params->memory)->host_memory, params->memoryOffset); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindImageMemory2(void *args) -{ - struct vkBindImageMemory2_params *params = args; - const VkBindImageMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindImageMemoryInfo_array_win64_to_host(ctx, params->pBindInfos, params->bindInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindImageMemory2(wine_device_from_handle(params->device)->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindImageMemory2(void *args) -{ - struct - { - PTR32 device; - uint32_t bindInfoCount; - PTR32 pBindInfos; - VkResult result; - } *params = args; - const VkBindImageMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindImageMemoryInfo_array_win32_to_host(ctx, (const VkBindImageMemoryInfo32 *)UlongToPtr(params->pBindInfos), params->bindInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindImageMemory2(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindImageMemory2KHR(void *args) -{ - struct vkBindImageMemory2KHR_params *params = args; - const VkBindImageMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindImageMemoryInfo_array_win64_to_host(ctx, params->pBindInfos, params->bindInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindImageMemory2KHR(wine_device_from_handle(params->device)->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindImageMemory2KHR(void *args) -{ - struct - { - PTR32 device; - uint32_t bindInfoCount; - PTR32 pBindInfos; - VkResult result; - } *params = args; - const VkBindImageMemoryInfo *pBindInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->bindInfoCount, params->pBindInfos); - - init_conversion_context(ctx); - pBindInfos_host = convert_VkBindImageMemoryInfo_array_win32_to_host(ctx, (const VkBindImageMemoryInfo32 *)UlongToPtr(params->pBindInfos), params->bindInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindImageMemory2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->bindInfoCount, pBindInfos_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBindOpticalFlowSessionImageNV(void *args) -{ - struct vkBindOpticalFlowSessionImageNV_params *params = args; - - TRACE("%p, 0x%s, %#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->session), params->bindingPoint, wine_dbgstr_longlong(params->view), params->layout); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkBindOpticalFlowSessionImageNV(wine_device_from_handle(params->device)->host_device, params->session, params->bindingPoint, params->view, params->layout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBindOpticalFlowSessionImageNV(void *args) -{ - struct - { - PTR32 device; - VkOpticalFlowSessionNV DECLSPEC_ALIGN(8) session; - VkOpticalFlowSessionBindingPointNV bindingPoint; - VkImageView DECLSPEC_ALIGN(8) view; - VkImageLayout layout; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->session), params->bindingPoint, wine_dbgstr_longlong(params->view), params->layout); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBindOpticalFlowSessionImageNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->session, params->bindingPoint, params->view, params->layout); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBuildAccelerationStructuresKHR(void *args) -{ - struct vkBuildAccelerationStructuresKHR_params *params = args; - - TRACE("%p, 0x%s, %u, %p, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->infoCount, params->pInfos, params->ppBuildRangeInfos); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkBuildAccelerationStructuresKHR(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->infoCount, params->pInfos, params->ppBuildRangeInfos); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBuildAccelerationStructuresKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - uint32_t infoCount; - PTR32 pInfos; - PTR32 ppBuildRangeInfos; - VkResult result; - } *params = args; - const VkAccelerationStructureBuildGeometryInfoKHR *pInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %u, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->infoCount, params->pInfos, params->ppBuildRangeInfos); - - if (params->deferredOperation == VK_NULL_HANDLE) - init_conversion_context(ctx); - else - ctx = &wine_deferred_operation_from_handle(params->deferredOperation)->ctx; - pInfos_host = convert_VkAccelerationStructureBuildGeometryInfoKHR_array_win32_to_host(ctx, (const VkAccelerationStructureBuildGeometryInfoKHR32 *)UlongToPtr(params->pInfos), params->infoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBuildAccelerationStructuresKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->infoCount, pInfos_host, (const VkAccelerationStructureBuildRangeInfoKHR * const*)UlongToPtr(params->ppBuildRangeInfos)); - if (params->deferredOperation == VK_NULL_HANDLE) - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkBuildMicromapsEXT(void *args) -{ - struct vkBuildMicromapsEXT_params *params = args; - - TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->infoCount, params->pInfos); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkBuildMicromapsEXT(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->infoCount, params->pInfos); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkBuildMicromapsEXT(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - uint32_t infoCount; - PTR32 pInfos; - VkResult result; - } *params = args; - const VkMicromapBuildInfoEXT *pInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->infoCount, params->pInfos); - - if (params->deferredOperation == VK_NULL_HANDLE) - init_conversion_context(ctx); - else - ctx = &wine_deferred_operation_from_handle(params->deferredOperation)->ctx; - pInfos_host = convert_VkMicromapBuildInfoEXT_array_win32_to_host(ctx, (const VkMicromapBuildInfoEXT32 *)UlongToPtr(params->pInfos), params->infoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkBuildMicromapsEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->infoCount, pInfos_host); - if (params->deferredOperation == VK_NULL_HANDLE) - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginConditionalRenderingEXT(void *args) -{ - struct vkCmdBeginConditionalRenderingEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginConditionalRenderingEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pConditionalRenderingBegin); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginConditionalRenderingEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pConditionalRenderingBegin; - } *params = args; - VkConditionalRenderingBeginInfoEXT pConditionalRenderingBegin_host; - - convert_VkConditionalRenderingBeginInfoEXT_win32_to_host((const VkConditionalRenderingBeginInfoEXT32 *)UlongToPtr(params->pConditionalRenderingBegin), &pConditionalRenderingBegin_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginConditionalRenderingEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pConditionalRenderingBegin_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginDebugUtilsLabelEXT(void *args) -{ - struct vkCmdBeginDebugUtilsLabelEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginDebugUtilsLabelEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pLabelInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginDebugUtilsLabelEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pLabelInfo; - } *params = args; - VkDebugUtilsLabelEXT pLabelInfo_host; - - convert_VkDebugUtilsLabelEXT_win32_to_host((const VkDebugUtilsLabelEXT32 *)UlongToPtr(params->pLabelInfo), &pLabelInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginDebugUtilsLabelEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pLabelInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginQuery(void *args) -{ - struct vkCmdBeginQuery_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginQuery(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->queryPool, params->query, params->flags); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginQuery(void *args) -{ - struct - { - PTR32 commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - VkQueryControlFlags flags; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginQuery(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->queryPool, params->query, params->flags); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginQueryIndexedEXT(void *args) -{ - struct vkCmdBeginQueryIndexedEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginQueryIndexedEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->queryPool, params->query, params->flags, params->index); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginQueryIndexedEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - VkQueryControlFlags flags; - uint32_t index; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginQueryIndexedEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->queryPool, params->query, params->flags, params->index); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginRenderPass(void *args) -{ - struct vkCmdBeginRenderPass_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginRenderPass(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRenderPassBegin, params->contents); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginRenderPass(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRenderPassBegin; - VkSubpassContents contents; - } *params = args; - VkRenderPassBeginInfo pRenderPassBegin_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkRenderPassBeginInfo_win32_to_host(ctx, (const VkRenderPassBeginInfo32 *)UlongToPtr(params->pRenderPassBegin), &pRenderPassBegin_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginRenderPass(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRenderPassBegin_host, params->contents); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginRenderPass2(void *args) -{ - struct vkCmdBeginRenderPass2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginRenderPass2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRenderPassBegin, params->pSubpassBeginInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginRenderPass2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRenderPassBegin; - PTR32 pSubpassBeginInfo; - } *params = args; - VkRenderPassBeginInfo pRenderPassBegin_host; - VkSubpassBeginInfo pSubpassBeginInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkRenderPassBeginInfo_win32_to_host(ctx, (const VkRenderPassBeginInfo32 *)UlongToPtr(params->pRenderPassBegin), &pRenderPassBegin_host); - convert_VkSubpassBeginInfo_win32_to_host((const VkSubpassBeginInfo32 *)UlongToPtr(params->pSubpassBeginInfo), &pSubpassBeginInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginRenderPass2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRenderPassBegin_host, &pSubpassBeginInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginRenderPass2KHR(void *args) -{ - struct vkCmdBeginRenderPass2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginRenderPass2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRenderPassBegin, params->pSubpassBeginInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginRenderPass2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRenderPassBegin; - PTR32 pSubpassBeginInfo; - } *params = args; - VkRenderPassBeginInfo pRenderPassBegin_host; - VkSubpassBeginInfo pSubpassBeginInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkRenderPassBeginInfo_win32_to_host(ctx, (const VkRenderPassBeginInfo32 *)UlongToPtr(params->pRenderPassBegin), &pRenderPassBegin_host); - convert_VkSubpassBeginInfo_win32_to_host((const VkSubpassBeginInfo32 *)UlongToPtr(params->pSubpassBeginInfo), &pSubpassBeginInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginRenderPass2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRenderPassBegin_host, &pSubpassBeginInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginRendering(void *args) -{ - struct vkCmdBeginRendering_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginRendering(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRenderingInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginRendering(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRenderingInfo; - } *params = args; - VkRenderingInfo pRenderingInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkRenderingInfo_win32_to_host(ctx, (const VkRenderingInfo32 *)UlongToPtr(params->pRenderingInfo), &pRenderingInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginRendering(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRenderingInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginRenderingKHR(void *args) -{ - struct vkCmdBeginRenderingKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginRenderingKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRenderingInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginRenderingKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRenderingInfo; - } *params = args; - VkRenderingInfo pRenderingInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkRenderingInfo_win32_to_host(ctx, (const VkRenderingInfo32 *)UlongToPtr(params->pRenderingInfo), &pRenderingInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginRenderingKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRenderingInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBeginTransformFeedbackEXT(void *args) -{ - struct vkCmdBeginTransformFeedbackEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBeginTransformFeedbackEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstCounterBuffer, params->counterBufferCount, params->pCounterBuffers, params->pCounterBufferOffsets); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBeginTransformFeedbackEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstCounterBuffer; - uint32_t counterBufferCount; - PTR32 pCounterBuffers; - PTR32 pCounterBufferOffsets; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBeginTransformFeedbackEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstCounterBuffer, params->counterBufferCount, (const VkBuffer *)UlongToPtr(params->pCounterBuffers), (const VkDeviceSize *)UlongToPtr(params->pCounterBufferOffsets)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindDescriptorBufferEmbeddedSamplersEXT(void *args) -{ - struct vkCmdBindDescriptorBufferEmbeddedSamplersEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindDescriptorBufferEmbeddedSamplersEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->layout, params->set); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindDescriptorBufferEmbeddedSamplersEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t set; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindDescriptorBufferEmbeddedSamplersEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->layout, params->set); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindDescriptorBuffersEXT(void *args) -{ - struct vkCmdBindDescriptorBuffersEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindDescriptorBuffersEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->bufferCount, params->pBindingInfos); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindDescriptorBuffersEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t bufferCount; - PTR32 pBindingInfos; - } *params = args; - const VkDescriptorBufferBindingInfoEXT *pBindingInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pBindingInfos_host = convert_VkDescriptorBufferBindingInfoEXT_array_win32_to_host(ctx, (const VkDescriptorBufferBindingInfoEXT32 *)UlongToPtr(params->pBindingInfos), params->bufferCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindDescriptorBuffersEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->bufferCount, pBindingInfos_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindDescriptorSets(void *args) -{ - struct vkCmdBindDescriptorSets_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindDescriptorSets(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->layout, params->firstSet, params->descriptorSetCount, params->pDescriptorSets, params->dynamicOffsetCount, params->pDynamicOffsets); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindDescriptorSets(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t firstSet; - uint32_t descriptorSetCount; - PTR32 pDescriptorSets; - uint32_t dynamicOffsetCount; - PTR32 pDynamicOffsets; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindDescriptorSets(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->layout, params->firstSet, params->descriptorSetCount, (const VkDescriptorSet *)UlongToPtr(params->pDescriptorSets), params->dynamicOffsetCount, (const uint32_t *)UlongToPtr(params->pDynamicOffsets)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindIndexBuffer(void *args) -{ - struct vkCmdBindIndexBuffer_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindIndexBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->indexType); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindIndexBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkIndexType indexType; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindIndexBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->indexType); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindIndexBuffer2KHR(void *args) -{ - struct vkCmdBindIndexBuffer2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindIndexBuffer2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->size, params->indexType); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindIndexBuffer2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkIndexType indexType; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindIndexBuffer2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->size, params->indexType); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindInvocationMaskHUAWEI(void *args) -{ - struct vkCmdBindInvocationMaskHUAWEI_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindInvocationMaskHUAWEI(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->imageView, params->imageLayout); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindInvocationMaskHUAWEI(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindInvocationMaskHUAWEI(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->imageView, params->imageLayout); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindPipeline(void *args) -{ - struct vkCmdBindPipeline_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindPipeline(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->pipeline); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindPipeline(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindPipeline(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->pipeline); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindPipelineShaderGroupNV(void *args) -{ - struct vkCmdBindPipelineShaderGroupNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindPipelineShaderGroupNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->pipeline, params->groupIndex); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindPipelineShaderGroupNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t groupIndex; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindPipelineShaderGroupNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->pipeline, params->groupIndex); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindShadersEXT(void *args) -{ - struct vkCmdBindShadersEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindShadersEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stageCount, params->pStages, params->pShaders); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindShadersEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t stageCount; - PTR32 pStages; - PTR32 pShaders; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindShadersEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stageCount, (const VkShaderStageFlagBits *)UlongToPtr(params->pStages), (const VkShaderEXT *)UlongToPtr(params->pShaders)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindShadingRateImageNV(void *args) -{ - struct vkCmdBindShadingRateImageNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindShadingRateImageNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->imageView, params->imageLayout); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindShadingRateImageNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImageView DECLSPEC_ALIGN(8) imageView; - VkImageLayout imageLayout; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindShadingRateImageNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->imageView, params->imageLayout); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindTransformFeedbackBuffersEXT(void *args) -{ - struct vkCmdBindTransformFeedbackBuffersEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindTransformFeedbackBuffersEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstBinding, params->bindingCount, params->pBuffers, params->pOffsets, params->pSizes); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindTransformFeedbackBuffersEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - PTR32 pBuffers; - PTR32 pOffsets; - PTR32 pSizes; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindTransformFeedbackBuffersEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstBinding, params->bindingCount, (const VkBuffer *)UlongToPtr(params->pBuffers), (const VkDeviceSize *)UlongToPtr(params->pOffsets), (const VkDeviceSize *)UlongToPtr(params->pSizes)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindVertexBuffers(void *args) -{ - struct vkCmdBindVertexBuffers_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindVertexBuffers(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstBinding, params->bindingCount, params->pBuffers, params->pOffsets); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindVertexBuffers(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - PTR32 pBuffers; - PTR32 pOffsets; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindVertexBuffers(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstBinding, params->bindingCount, (const VkBuffer *)UlongToPtr(params->pBuffers), (const VkDeviceSize *)UlongToPtr(params->pOffsets)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindVertexBuffers2(void *args) -{ - struct vkCmdBindVertexBuffers2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindVertexBuffers2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstBinding, params->bindingCount, params->pBuffers, params->pOffsets, params->pSizes, params->pStrides); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindVertexBuffers2(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - PTR32 pBuffers; - PTR32 pOffsets; - PTR32 pSizes; - PTR32 pStrides; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindVertexBuffers2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstBinding, params->bindingCount, (const VkBuffer *)UlongToPtr(params->pBuffers), (const VkDeviceSize *)UlongToPtr(params->pOffsets), (const VkDeviceSize *)UlongToPtr(params->pSizes), (const VkDeviceSize *)UlongToPtr(params->pStrides)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBindVertexBuffers2EXT(void *args) -{ - struct vkCmdBindVertexBuffers2EXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBindVertexBuffers2EXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstBinding, params->bindingCount, params->pBuffers, params->pOffsets, params->pSizes, params->pStrides); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBindVertexBuffers2EXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstBinding; - uint32_t bindingCount; - PTR32 pBuffers; - PTR32 pOffsets; - PTR32 pSizes; - PTR32 pStrides; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBindVertexBuffers2EXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstBinding, params->bindingCount, (const VkBuffer *)UlongToPtr(params->pBuffers), (const VkDeviceSize *)UlongToPtr(params->pOffsets), (const VkDeviceSize *)UlongToPtr(params->pSizes), (const VkDeviceSize *)UlongToPtr(params->pStrides)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBlitImage(void *args) -{ - struct vkCmdBlitImage_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBlitImage(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstImage, params->dstImageLayout, params->regionCount, params->pRegions, params->filter); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBlitImage(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; - VkFilter filter; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBlitImage(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstImage, params->dstImageLayout, params->regionCount, (const VkImageBlit *)UlongToPtr(params->pRegions), params->filter); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBlitImage2(void *args) -{ - struct vkCmdBlitImage2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBlitImage2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pBlitImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBlitImage2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pBlitImageInfo; - } *params = args; - VkBlitImageInfo2 pBlitImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkBlitImageInfo2_win32_to_host(ctx, (const VkBlitImageInfo232 *)UlongToPtr(params->pBlitImageInfo), &pBlitImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBlitImage2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pBlitImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBlitImage2KHR(void *args) -{ - struct vkCmdBlitImage2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBlitImage2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pBlitImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBlitImage2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pBlitImageInfo; - } *params = args; - VkBlitImageInfo2 pBlitImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkBlitImageInfo2_win32_to_host(ctx, (const VkBlitImageInfo232 *)UlongToPtr(params->pBlitImageInfo), &pBlitImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBlitImage2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pBlitImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBuildAccelerationStructureNV(void *args) -{ - struct vkCmdBuildAccelerationStructureNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBuildAccelerationStructureNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo, params->instanceData, params->instanceOffset, params->update, params->dst, params->src, params->scratch, params->scratchOffset); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBuildAccelerationStructureNV(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - VkBuffer DECLSPEC_ALIGN(8) instanceData; - VkDeviceSize DECLSPEC_ALIGN(8) instanceOffset; - VkBool32 update; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) dst; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) src; - VkBuffer DECLSPEC_ALIGN(8) scratch; - VkDeviceSize DECLSPEC_ALIGN(8) scratchOffset; - } *params = args; - VkAccelerationStructureInfoNV pInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkAccelerationStructureInfoNV_win32_to_host(ctx, (const VkAccelerationStructureInfoNV32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBuildAccelerationStructureNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host, params->instanceData, params->instanceOffset, params->update, params->dst, params->src, params->scratch, params->scratchOffset); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBuildAccelerationStructuresIndirectKHR(void *args) -{ - struct vkCmdBuildAccelerationStructuresIndirectKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBuildAccelerationStructuresIndirectKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->infoCount, params->pInfos, params->pIndirectDeviceAddresses, params->pIndirectStrides, params->ppMaxPrimitiveCounts); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBuildAccelerationStructuresIndirectKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t infoCount; - PTR32 pInfos; - PTR32 pIndirectDeviceAddresses; - PTR32 pIndirectStrides; - PTR32 ppMaxPrimitiveCounts; - } *params = args; - const VkAccelerationStructureBuildGeometryInfoKHR *pInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pInfos_host = convert_VkAccelerationStructureBuildGeometryInfoKHR_array_win32_to_host(ctx, (const VkAccelerationStructureBuildGeometryInfoKHR32 *)UlongToPtr(params->pInfos), params->infoCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBuildAccelerationStructuresIndirectKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->infoCount, pInfos_host, (const VkDeviceAddress *)UlongToPtr(params->pIndirectDeviceAddresses), (const uint32_t *)UlongToPtr(params->pIndirectStrides), (const uint32_t * const*)UlongToPtr(params->ppMaxPrimitiveCounts)); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBuildAccelerationStructuresKHR(void *args) -{ - struct vkCmdBuildAccelerationStructuresKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBuildAccelerationStructuresKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->infoCount, params->pInfos, params->ppBuildRangeInfos); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBuildAccelerationStructuresKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t infoCount; - PTR32 pInfos; - PTR32 ppBuildRangeInfos; - } *params = args; - const VkAccelerationStructureBuildGeometryInfoKHR *pInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pInfos_host = convert_VkAccelerationStructureBuildGeometryInfoKHR_array_win32_to_host(ctx, (const VkAccelerationStructureBuildGeometryInfoKHR32 *)UlongToPtr(params->pInfos), params->infoCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBuildAccelerationStructuresKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->infoCount, pInfos_host, (const VkAccelerationStructureBuildRangeInfoKHR * const*)UlongToPtr(params->ppBuildRangeInfos)); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdBuildMicromapsEXT(void *args) -{ - struct vkCmdBuildMicromapsEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdBuildMicromapsEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->infoCount, params->pInfos); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdBuildMicromapsEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t infoCount; - PTR32 pInfos; - } *params = args; - const VkMicromapBuildInfoEXT *pInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pInfos_host = convert_VkMicromapBuildInfoEXT_array_win32_to_host(ctx, (const VkMicromapBuildInfoEXT32 *)UlongToPtr(params->pInfos), params->infoCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdBuildMicromapsEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->infoCount, pInfos_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdClearAttachments(void *args) -{ - struct vkCmdClearAttachments_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdClearAttachments(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->attachmentCount, params->pAttachments, params->rectCount, params->pRects); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdClearAttachments(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t attachmentCount; - PTR32 pAttachments; - uint32_t rectCount; - PTR32 pRects; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdClearAttachments(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->attachmentCount, (const VkClearAttachment *)UlongToPtr(params->pAttachments), params->rectCount, (const VkClearRect *)UlongToPtr(params->pRects)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdClearColorImage(void *args) -{ - struct vkCmdClearColorImage_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdClearColorImage(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->image, params->imageLayout, params->pColor, params->rangeCount, params->pRanges); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdClearColorImage(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImage DECLSPEC_ALIGN(8) image; - VkImageLayout imageLayout; - PTR32 pColor; - uint32_t rangeCount; - PTR32 pRanges; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdClearColorImage(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->image, params->imageLayout, (const VkClearColorValue *)UlongToPtr(params->pColor), params->rangeCount, (const VkImageSubresourceRange *)UlongToPtr(params->pRanges)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdClearDepthStencilImage(void *args) -{ - struct vkCmdClearDepthStencilImage_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdClearDepthStencilImage(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->image, params->imageLayout, params->pDepthStencil, params->rangeCount, params->pRanges); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdClearDepthStencilImage(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImage DECLSPEC_ALIGN(8) image; - VkImageLayout imageLayout; - PTR32 pDepthStencil; - uint32_t rangeCount; - PTR32 pRanges; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdClearDepthStencilImage(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->image, params->imageLayout, (const VkClearDepthStencilValue *)UlongToPtr(params->pDepthStencil), params->rangeCount, (const VkImageSubresourceRange *)UlongToPtr(params->pRanges)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyAccelerationStructureKHR(void *args) -{ - struct vkCmdCopyAccelerationStructureKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyAccelerationStructureKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyAccelerationStructureKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - } *params = args; - VkCopyAccelerationStructureInfoKHR pInfo_host; - - convert_VkCopyAccelerationStructureInfoKHR_win32_to_host((const VkCopyAccelerationStructureInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyAccelerationStructureKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyAccelerationStructureNV(void *args) -{ - struct vkCmdCopyAccelerationStructureNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyAccelerationStructureNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->dst, params->src, params->mode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyAccelerationStructureNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) dst; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) src; - VkCopyAccelerationStructureModeKHR mode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyAccelerationStructureNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->dst, params->src, params->mode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyAccelerationStructureToMemoryKHR(void *args) -{ - struct vkCmdCopyAccelerationStructureToMemoryKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyAccelerationStructureToMemoryKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyAccelerationStructureToMemoryKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - } *params = args; - VkCopyAccelerationStructureToMemoryInfoKHR pInfo_host; - - convert_VkCopyAccelerationStructureToMemoryInfoKHR_win32_to_host((const VkCopyAccelerationStructureToMemoryInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyAccelerationStructureToMemoryKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyBuffer(void *args) -{ - struct vkCmdCopyBuffer_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcBuffer, params->dstBuffer, params->regionCount, params->pRegions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) srcBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - uint32_t regionCount; - PTR32 pRegions; - } *params = args; - const VkBufferCopy *pRegions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pRegions_host = convert_VkBufferCopy_array_win32_to_host(ctx, (const VkBufferCopy32 *)UlongToPtr(params->pRegions), params->regionCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcBuffer, params->dstBuffer, params->regionCount, pRegions_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyBuffer2(void *args) -{ - struct vkCmdCopyBuffer2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyBuffer2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyBufferInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyBuffer2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyBufferInfo; - } *params = args; - VkCopyBufferInfo2 pCopyBufferInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyBufferInfo2_win32_to_host(ctx, (const VkCopyBufferInfo232 *)UlongToPtr(params->pCopyBufferInfo), &pCopyBufferInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyBuffer2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyBufferInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyBuffer2KHR(void *args) -{ - struct vkCmdCopyBuffer2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyBuffer2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyBufferInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyBuffer2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyBufferInfo; - } *params = args; - VkCopyBufferInfo2 pCopyBufferInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyBufferInfo2_win32_to_host(ctx, (const VkCopyBufferInfo232 *)UlongToPtr(params->pCopyBufferInfo), &pCopyBufferInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyBuffer2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyBufferInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyBufferToImage(void *args) -{ - struct vkCmdCopyBufferToImage_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyBufferToImage(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcBuffer, params->dstImage, params->dstImageLayout, params->regionCount, params->pRegions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyBufferToImage(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) srcBuffer; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; - } *params = args; - const VkBufferImageCopy *pRegions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pRegions_host = convert_VkBufferImageCopy_array_win32_to_host(ctx, (const VkBufferImageCopy32 *)UlongToPtr(params->pRegions), params->regionCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyBufferToImage(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcBuffer, params->dstImage, params->dstImageLayout, params->regionCount, pRegions_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyBufferToImage2(void *args) -{ - struct vkCmdCopyBufferToImage2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyBufferToImage2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyBufferToImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyBufferToImage2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyBufferToImageInfo; - } *params = args; - VkCopyBufferToImageInfo2 pCopyBufferToImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyBufferToImageInfo2_win32_to_host(ctx, (const VkCopyBufferToImageInfo232 *)UlongToPtr(params->pCopyBufferToImageInfo), &pCopyBufferToImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyBufferToImage2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyBufferToImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyBufferToImage2KHR(void *args) -{ - struct vkCmdCopyBufferToImage2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyBufferToImage2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyBufferToImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyBufferToImage2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyBufferToImageInfo; - } *params = args; - VkCopyBufferToImageInfo2 pCopyBufferToImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyBufferToImageInfo2_win32_to_host(ctx, (const VkCopyBufferToImageInfo232 *)UlongToPtr(params->pCopyBufferToImageInfo), &pCopyBufferToImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyBufferToImage2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyBufferToImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyImage(void *args) -{ - struct vkCmdCopyImage_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyImage(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstImage, params->dstImageLayout, params->regionCount, params->pRegions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyImage(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyImage(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstImage, params->dstImageLayout, params->regionCount, (const VkImageCopy *)UlongToPtr(params->pRegions)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyImage2(void *args) -{ - struct vkCmdCopyImage2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyImage2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyImage2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyImageInfo; - } *params = args; - VkCopyImageInfo2 pCopyImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyImageInfo2_win32_to_host(ctx, (const VkCopyImageInfo232 *)UlongToPtr(params->pCopyImageInfo), &pCopyImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyImage2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyImage2KHR(void *args) -{ - struct vkCmdCopyImage2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyImage2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyImage2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyImageInfo; - } *params = args; - VkCopyImageInfo2 pCopyImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyImageInfo2_win32_to_host(ctx, (const VkCopyImageInfo232 *)UlongToPtr(params->pCopyImageInfo), &pCopyImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyImage2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyImageToBuffer(void *args) -{ - struct vkCmdCopyImageToBuffer_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyImageToBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstBuffer, params->regionCount, params->pRegions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyImageToBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - uint32_t regionCount; - PTR32 pRegions; - } *params = args; - const VkBufferImageCopy *pRegions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pRegions_host = convert_VkBufferImageCopy_array_win32_to_host(ctx, (const VkBufferImageCopy32 *)UlongToPtr(params->pRegions), params->regionCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyImageToBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstBuffer, params->regionCount, pRegions_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyImageToBuffer2(void *args) -{ - struct vkCmdCopyImageToBuffer2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyImageToBuffer2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyImageToBufferInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyImageToBuffer2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyImageToBufferInfo; - } *params = args; - VkCopyImageToBufferInfo2 pCopyImageToBufferInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyImageToBufferInfo2_win32_to_host(ctx, (const VkCopyImageToBufferInfo232 *)UlongToPtr(params->pCopyImageToBufferInfo), &pCopyImageToBufferInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyImageToBuffer2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyImageToBufferInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyImageToBuffer2KHR(void *args) -{ - struct vkCmdCopyImageToBuffer2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyImageToBuffer2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCopyImageToBufferInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyImageToBuffer2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCopyImageToBufferInfo; - } *params = args; - VkCopyImageToBufferInfo2 pCopyImageToBufferInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkCopyImageToBufferInfo2_win32_to_host(ctx, (const VkCopyImageToBufferInfo232 *)UlongToPtr(params->pCopyImageToBufferInfo), &pCopyImageToBufferInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyImageToBuffer2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pCopyImageToBufferInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyMemoryIndirectNV(void *args) -{ - struct vkCmdCopyMemoryIndirectNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyMemoryIndirectNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->copyBufferAddress, params->copyCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyMemoryIndirectNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) copyBufferAddress; - uint32_t copyCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyMemoryIndirectNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->copyBufferAddress, params->copyCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyMemoryToAccelerationStructureKHR(void *args) -{ - struct vkCmdCopyMemoryToAccelerationStructureKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyMemoryToAccelerationStructureKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyMemoryToAccelerationStructureKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - } *params = args; - VkCopyMemoryToAccelerationStructureInfoKHR pInfo_host; - - convert_VkCopyMemoryToAccelerationStructureInfoKHR_win32_to_host((const VkCopyMemoryToAccelerationStructureInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyMemoryToAccelerationStructureKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyMemoryToImageIndirectNV(void *args) -{ - struct vkCmdCopyMemoryToImageIndirectNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyMemoryToImageIndirectNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->copyBufferAddress, params->copyCount, params->stride, params->dstImage, params->dstImageLayout, params->pImageSubresources); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyMemoryToImageIndirectNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) copyBufferAddress; - uint32_t copyCount; - uint32_t stride; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - PTR32 pImageSubresources; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyMemoryToImageIndirectNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->copyBufferAddress, params->copyCount, params->stride, params->dstImage, params->dstImageLayout, (const VkImageSubresourceLayers *)UlongToPtr(params->pImageSubresources)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyMemoryToMicromapEXT(void *args) -{ - struct vkCmdCopyMemoryToMicromapEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyMemoryToMicromapEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyMemoryToMicromapEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - } *params = args; - VkCopyMemoryToMicromapInfoEXT pInfo_host; - - convert_VkCopyMemoryToMicromapInfoEXT_win32_to_host((const VkCopyMemoryToMicromapInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyMemoryToMicromapEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyMicromapEXT(void *args) -{ - struct vkCmdCopyMicromapEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyMicromapEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyMicromapEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - } *params = args; - VkCopyMicromapInfoEXT pInfo_host; - - convert_VkCopyMicromapInfoEXT_win32_to_host((const VkCopyMicromapInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyMicromapEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyMicromapToMemoryEXT(void *args) -{ - struct vkCmdCopyMicromapToMemoryEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyMicromapToMemoryEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyMicromapToMemoryEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pInfo; - } *params = args; - VkCopyMicromapToMemoryInfoEXT pInfo_host; - - convert_VkCopyMicromapToMemoryInfoEXT_win32_to_host((const VkCopyMicromapToMemoryInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyMicromapToMemoryEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCopyQueryPoolResults(void *args) -{ - struct vkCmdCopyQueryPoolResults_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCopyQueryPoolResults(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->queryPool, params->firstQuery, params->queryCount, params->dstBuffer, params->dstOffset, params->stride, params->flags); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCopyQueryPoolResults(void *args) -{ - struct - { - PTR32 commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) stride; - VkQueryResultFlags flags; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCopyQueryPoolResults(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->queryPool, params->firstQuery, params->queryCount, params->dstBuffer, params->dstOffset, params->stride, params->flags); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCuLaunchKernelNVX(void *args) -{ - struct vkCmdCuLaunchKernelNVX_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCuLaunchKernelNVX(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pLaunchInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCuLaunchKernelNVX(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pLaunchInfo; - } *params = args; - VkCuLaunchInfoNVX pLaunchInfo_host; - - convert_VkCuLaunchInfoNVX_win32_to_host((const VkCuLaunchInfoNVX32 *)UlongToPtr(params->pLaunchInfo), &pLaunchInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCuLaunchKernelNVX(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pLaunchInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdCudaLaunchKernelNV(void *args) -{ - struct vkCmdCudaLaunchKernelNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdCudaLaunchKernelNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pLaunchInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdCudaLaunchKernelNV(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pLaunchInfo; - } *params = args; - VkCudaLaunchInfoNV pLaunchInfo_host; - - convert_VkCudaLaunchInfoNV_win32_to_host((const VkCudaLaunchInfoNV32 *)UlongToPtr(params->pLaunchInfo), &pLaunchInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdCudaLaunchKernelNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pLaunchInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDebugMarkerBeginEXT(void *args) -{ - struct vkCmdDebugMarkerBeginEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDebugMarkerBeginEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pMarkerInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDebugMarkerBeginEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pMarkerInfo; - } *params = args; - VkDebugMarkerMarkerInfoEXT pMarkerInfo_host; - - convert_VkDebugMarkerMarkerInfoEXT_win32_to_host((const VkDebugMarkerMarkerInfoEXT32 *)UlongToPtr(params->pMarkerInfo), &pMarkerInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDebugMarkerBeginEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pMarkerInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDebugMarkerEndEXT(void *args) -{ - struct vkCmdDebugMarkerEndEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDebugMarkerEndEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDebugMarkerEndEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDebugMarkerEndEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDebugMarkerInsertEXT(void *args) -{ - struct vkCmdDebugMarkerInsertEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDebugMarkerInsertEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pMarkerInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDebugMarkerInsertEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pMarkerInfo; - } *params = args; - VkDebugMarkerMarkerInfoEXT pMarkerInfo_host; - - convert_VkDebugMarkerMarkerInfoEXT_win32_to_host((const VkDebugMarkerMarkerInfoEXT32 *)UlongToPtr(params->pMarkerInfo), &pMarkerInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDebugMarkerInsertEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pMarkerInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDecompressMemoryIndirectCountNV(void *args) -{ - struct vkCmdDecompressMemoryIndirectCountNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDecompressMemoryIndirectCountNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->indirectCommandsAddress, params->indirectCommandsCountAddress, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDecompressMemoryIndirectCountNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectCommandsAddress; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectCommandsCountAddress; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDecompressMemoryIndirectCountNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->indirectCommandsAddress, params->indirectCommandsCountAddress, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDecompressMemoryNV(void *args) -{ - struct vkCmdDecompressMemoryNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDecompressMemoryNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->decompressRegionCount, params->pDecompressMemoryRegions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDecompressMemoryNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t decompressRegionCount; - PTR32 pDecompressMemoryRegions; - } *params = args; - const VkDecompressMemoryRegionNV *pDecompressMemoryRegions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pDecompressMemoryRegions_host = convert_VkDecompressMemoryRegionNV_array_win32_to_host(ctx, (const VkDecompressMemoryRegionNV32 *)UlongToPtr(params->pDecompressMemoryRegions), params->decompressRegionCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDecompressMemoryNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->decompressRegionCount, pDecompressMemoryRegions_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDispatch(void *args) -{ - struct vkCmdDispatch_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDispatch(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->groupCountX, params->groupCountY, params->groupCountZ); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDispatch(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDispatch(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->groupCountX, params->groupCountY, params->groupCountZ); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDispatchBase(void *args) -{ - struct vkCmdDispatchBase_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDispatchBase(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->baseGroupX, params->baseGroupY, params->baseGroupZ, params->groupCountX, params->groupCountY, params->groupCountZ); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDispatchBase(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t baseGroupX; - uint32_t baseGroupY; - uint32_t baseGroupZ; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDispatchBase(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->baseGroupX, params->baseGroupY, params->baseGroupZ, params->groupCountX, params->groupCountY, params->groupCountZ); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDispatchBaseKHR(void *args) -{ - struct vkCmdDispatchBaseKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDispatchBaseKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->baseGroupX, params->baseGroupY, params->baseGroupZ, params->groupCountX, params->groupCountY, params->groupCountZ); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDispatchBaseKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t baseGroupX; - uint32_t baseGroupY; - uint32_t baseGroupZ; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDispatchBaseKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->baseGroupX, params->baseGroupY, params->baseGroupZ, params->groupCountX, params->groupCountY, params->groupCountZ); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDispatchIndirect(void *args) -{ - struct vkCmdDispatchIndirect_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDispatchIndirect(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDispatchIndirect(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDispatchIndirect(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDraw(void *args) -{ - struct vkCmdDraw_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDraw(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->vertexCount, params->instanceCount, params->firstVertex, params->firstInstance); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDraw(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t vertexCount; - uint32_t instanceCount; - uint32_t firstVertex; - uint32_t firstInstance; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDraw(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->vertexCount, params->instanceCount, params->firstVertex, params->firstInstance); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawClusterHUAWEI(void *args) -{ - struct vkCmdDrawClusterHUAWEI_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawClusterHUAWEI(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->groupCountX, params->groupCountY, params->groupCountZ); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawClusterHUAWEI(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawClusterHUAWEI(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->groupCountX, params->groupCountY, params->groupCountZ); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawClusterIndirectHUAWEI(void *args) -{ - struct vkCmdDrawClusterIndirectHUAWEI_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawClusterIndirectHUAWEI(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawClusterIndirectHUAWEI(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawClusterIndirectHUAWEI(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndexed(void *args) -{ - struct vkCmdDrawIndexed_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndexed(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->indexCount, params->instanceCount, params->firstIndex, params->vertexOffset, params->firstInstance); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndexed(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t indexCount; - uint32_t instanceCount; - uint32_t firstIndex; - int32_t vertexOffset; - uint32_t firstInstance; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndexed(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->indexCount, params->instanceCount, params->firstIndex, params->vertexOffset, params->firstInstance); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndexedIndirect(void *args) -{ - struct vkCmdDrawIndexedIndirect_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndexedIndirect(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndexedIndirect(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndexedIndirect(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndexedIndirectCount(void *args) -{ - struct vkCmdDrawIndexedIndirectCount_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndexedIndirectCount(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndexedIndirectCount(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndexedIndirectCount(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndexedIndirectCountAMD(void *args) -{ - struct vkCmdDrawIndexedIndirectCountAMD_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndexedIndirectCountAMD(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndexedIndirectCountAMD(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndexedIndirectCountAMD(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndexedIndirectCountKHR(void *args) -{ - struct vkCmdDrawIndexedIndirectCountKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndexedIndirectCountKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndexedIndirectCountKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndexedIndirectCountKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndirect(void *args) -{ - struct vkCmdDrawIndirect_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndirect(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndirect(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndirect(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndirectByteCountEXT(void *args) -{ - struct vkCmdDrawIndirectByteCountEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndirectByteCountEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->instanceCount, params->firstInstance, params->counterBuffer, params->counterBufferOffset, params->counterOffset, params->vertexStride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndirectByteCountEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t instanceCount; - uint32_t firstInstance; - VkBuffer DECLSPEC_ALIGN(8) counterBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) counterBufferOffset; - uint32_t counterOffset; - uint32_t vertexStride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndirectByteCountEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->instanceCount, params->firstInstance, params->counterBuffer, params->counterBufferOffset, params->counterOffset, params->vertexStride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndirectCount(void *args) -{ - struct vkCmdDrawIndirectCount_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndirectCount(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndirectCount(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndirectCount(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndirectCountAMD(void *args) -{ - struct vkCmdDrawIndirectCountAMD_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndirectCountAMD(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndirectCountAMD(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndirectCountAMD(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawIndirectCountKHR(void *args) -{ - struct vkCmdDrawIndirectCountKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawIndirectCountKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawIndirectCountKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawIndirectCountKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMeshTasksEXT(void *args) -{ - struct vkCmdDrawMeshTasksEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMeshTasksEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->groupCountX, params->groupCountY, params->groupCountZ); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMeshTasksEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMeshTasksEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->groupCountX, params->groupCountY, params->groupCountZ); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMeshTasksIndirectCountEXT(void *args) -{ - struct vkCmdDrawMeshTasksIndirectCountEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMeshTasksIndirectCountEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMeshTasksIndirectCountEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMeshTasksIndirectCountEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMeshTasksIndirectCountNV(void *args) -{ - struct vkCmdDrawMeshTasksIndirectCountNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMeshTasksIndirectCountNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMeshTasksIndirectCountNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkBuffer DECLSPEC_ALIGN(8) countBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) countBufferOffset; - uint32_t maxDrawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMeshTasksIndirectCountNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->countBuffer, params->countBufferOffset, params->maxDrawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMeshTasksIndirectEXT(void *args) -{ - struct vkCmdDrawMeshTasksIndirectEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMeshTasksIndirectEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMeshTasksIndirectEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMeshTasksIndirectEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMeshTasksIndirectNV(void *args) -{ - struct vkCmdDrawMeshTasksIndirectNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMeshTasksIndirectNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMeshTasksIndirectNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) buffer; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - uint32_t drawCount; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMeshTasksIndirectNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->buffer, params->offset, params->drawCount, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMeshTasksNV(void *args) -{ - struct vkCmdDrawMeshTasksNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMeshTasksNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->taskCount, params->firstTask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMeshTasksNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t taskCount; - uint32_t firstTask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMeshTasksNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->taskCount, params->firstTask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMultiEXT(void *args) -{ - struct vkCmdDrawMultiEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMultiEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->drawCount, params->pVertexInfo, params->instanceCount, params->firstInstance, params->stride); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMultiEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t drawCount; - PTR32 pVertexInfo; - uint32_t instanceCount; - uint32_t firstInstance; - uint32_t stride; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMultiEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->drawCount, (const VkMultiDrawInfoEXT *)UlongToPtr(params->pVertexInfo), params->instanceCount, params->firstInstance, params->stride); -} - -#ifdef _WIN64 -static void thunk64_vkCmdDrawMultiIndexedEXT(void *args) -{ - struct vkCmdDrawMultiIndexedEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdDrawMultiIndexedEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->drawCount, params->pIndexInfo, params->instanceCount, params->firstInstance, params->stride, params->pVertexOffset); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdDrawMultiIndexedEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t drawCount; - PTR32 pIndexInfo; - uint32_t instanceCount; - uint32_t firstInstance; - uint32_t stride; - PTR32 pVertexOffset; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdDrawMultiIndexedEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->drawCount, (const VkMultiDrawIndexedInfoEXT *)UlongToPtr(params->pIndexInfo), params->instanceCount, params->firstInstance, params->stride, (const int32_t *)UlongToPtr(params->pVertexOffset)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndConditionalRenderingEXT(void *args) -{ - struct vkCmdEndConditionalRenderingEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndConditionalRenderingEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndConditionalRenderingEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndConditionalRenderingEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndDebugUtilsLabelEXT(void *args) -{ - struct vkCmdEndDebugUtilsLabelEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndDebugUtilsLabelEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndDebugUtilsLabelEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndDebugUtilsLabelEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndQuery(void *args) -{ - struct vkCmdEndQuery_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndQuery(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->queryPool, params->query); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndQuery(void *args) -{ - struct - { - PTR32 commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndQuery(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->queryPool, params->query); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndQueryIndexedEXT(void *args) -{ - struct vkCmdEndQueryIndexedEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndQueryIndexedEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->queryPool, params->query, params->index); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndQueryIndexedEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - uint32_t index; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndQueryIndexedEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->queryPool, params->query, params->index); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndRenderPass(void *args) -{ - struct vkCmdEndRenderPass_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndRenderPass(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndRenderPass(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndRenderPass(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndRenderPass2(void *args) -{ - struct vkCmdEndRenderPass2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndRenderPass2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pSubpassEndInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndRenderPass2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pSubpassEndInfo; - } *params = args; - VkSubpassEndInfo pSubpassEndInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkSubpassEndInfo_win32_to_host(ctx, (const VkSubpassEndInfo32 *)UlongToPtr(params->pSubpassEndInfo), &pSubpassEndInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndRenderPass2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pSubpassEndInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndRenderPass2KHR(void *args) -{ - struct vkCmdEndRenderPass2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndRenderPass2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pSubpassEndInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndRenderPass2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pSubpassEndInfo; - } *params = args; - VkSubpassEndInfo pSubpassEndInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkSubpassEndInfo_win32_to_host(ctx, (const VkSubpassEndInfo32 *)UlongToPtr(params->pSubpassEndInfo), &pSubpassEndInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndRenderPass2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pSubpassEndInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndRendering(void *args) -{ - struct vkCmdEndRendering_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndRendering(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndRendering(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndRendering(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndRenderingKHR(void *args) -{ - struct vkCmdEndRenderingKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndRenderingKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndRenderingKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndRenderingKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdEndTransformFeedbackEXT(void *args) -{ - struct vkCmdEndTransformFeedbackEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdEndTransformFeedbackEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstCounterBuffer, params->counterBufferCount, params->pCounterBuffers, params->pCounterBufferOffsets); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdEndTransformFeedbackEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstCounterBuffer; - uint32_t counterBufferCount; - PTR32 pCounterBuffers; - PTR32 pCounterBufferOffsets; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdEndTransformFeedbackEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstCounterBuffer, params->counterBufferCount, (const VkBuffer *)UlongToPtr(params->pCounterBuffers), (const VkDeviceSize *)UlongToPtr(params->pCounterBufferOffsets)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdExecuteCommands(void *args) -{ - struct vkCmdExecuteCommands_params *params = args; - const VkCommandBuffer *pCommandBuffers_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pCommandBuffers_host = convert_VkCommandBuffer_array_win64_to_host(ctx, params->pCommandBuffers, params->commandBufferCount); - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdExecuteCommands(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->commandBufferCount, pCommandBuffers_host); - free_conversion_context(ctx); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdExecuteCommands(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t commandBufferCount; - PTR32 pCommandBuffers; - } *params = args; - const VkCommandBuffer *pCommandBuffers_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pCommandBuffers_host = convert_VkCommandBuffer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(params->pCommandBuffers), params->commandBufferCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdExecuteCommands(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->commandBufferCount, pCommandBuffers_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdExecuteGeneratedCommandsNV(void *args) -{ - struct vkCmdExecuteGeneratedCommandsNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdExecuteGeneratedCommandsNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->isPreprocessed, params->pGeneratedCommandsInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdExecuteGeneratedCommandsNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 isPreprocessed; - PTR32 pGeneratedCommandsInfo; - } *params = args; - VkGeneratedCommandsInfoNV pGeneratedCommandsInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkGeneratedCommandsInfoNV_win32_to_host(ctx, (const VkGeneratedCommandsInfoNV32 *)UlongToPtr(params->pGeneratedCommandsInfo), &pGeneratedCommandsInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdExecuteGeneratedCommandsNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->isPreprocessed, &pGeneratedCommandsInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdFillBuffer(void *args) -{ - struct vkCmdFillBuffer_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdFillBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->dstBuffer, params->dstOffset, params->size, params->data); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdFillBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - uint32_t data; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdFillBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->dstBuffer, params->dstOffset, params->size, params->data); -} - -#ifdef _WIN64 -static void thunk64_vkCmdInsertDebugUtilsLabelEXT(void *args) -{ - struct vkCmdInsertDebugUtilsLabelEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdInsertDebugUtilsLabelEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pLabelInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdInsertDebugUtilsLabelEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pLabelInfo; - } *params = args; - VkDebugUtilsLabelEXT pLabelInfo_host; - - convert_VkDebugUtilsLabelEXT_win32_to_host((const VkDebugUtilsLabelEXT32 *)UlongToPtr(params->pLabelInfo), &pLabelInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdInsertDebugUtilsLabelEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pLabelInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdNextSubpass(void *args) -{ - struct vkCmdNextSubpass_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdNextSubpass(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->contents); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdNextSubpass(void *args) -{ - struct - { - PTR32 commandBuffer; - VkSubpassContents contents; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdNextSubpass(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->contents); -} - -#ifdef _WIN64 -static void thunk64_vkCmdNextSubpass2(void *args) -{ - struct vkCmdNextSubpass2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdNextSubpass2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pSubpassBeginInfo, params->pSubpassEndInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdNextSubpass2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pSubpassBeginInfo; - PTR32 pSubpassEndInfo; - } *params = args; - VkSubpassBeginInfo pSubpassBeginInfo_host; - VkSubpassEndInfo pSubpassEndInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkSubpassBeginInfo_win32_to_host((const VkSubpassBeginInfo32 *)UlongToPtr(params->pSubpassBeginInfo), &pSubpassBeginInfo_host); - convert_VkSubpassEndInfo_win32_to_host(ctx, (const VkSubpassEndInfo32 *)UlongToPtr(params->pSubpassEndInfo), &pSubpassEndInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdNextSubpass2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pSubpassBeginInfo_host, &pSubpassEndInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdNextSubpass2KHR(void *args) -{ - struct vkCmdNextSubpass2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdNextSubpass2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pSubpassBeginInfo, params->pSubpassEndInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdNextSubpass2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pSubpassBeginInfo; - PTR32 pSubpassEndInfo; - } *params = args; - VkSubpassBeginInfo pSubpassBeginInfo_host; - VkSubpassEndInfo pSubpassEndInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkSubpassBeginInfo_win32_to_host((const VkSubpassBeginInfo32 *)UlongToPtr(params->pSubpassBeginInfo), &pSubpassBeginInfo_host); - convert_VkSubpassEndInfo_win32_to_host(ctx, (const VkSubpassEndInfo32 *)UlongToPtr(params->pSubpassEndInfo), &pSubpassEndInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdNextSubpass2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pSubpassBeginInfo_host, &pSubpassEndInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdOpticalFlowExecuteNV(void *args) -{ - struct vkCmdOpticalFlowExecuteNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdOpticalFlowExecuteNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->session, params->pExecuteInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdOpticalFlowExecuteNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkOpticalFlowSessionNV DECLSPEC_ALIGN(8) session; - PTR32 pExecuteInfo; - } *params = args; - VkOpticalFlowExecuteInfoNV pExecuteInfo_host; - - convert_VkOpticalFlowExecuteInfoNV_win32_to_host((const VkOpticalFlowExecuteInfoNV32 *)UlongToPtr(params->pExecuteInfo), &pExecuteInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdOpticalFlowExecuteNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->session, &pExecuteInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPipelineBarrier(void *args) -{ - struct vkCmdPipelineBarrier_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPipelineBarrier(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcStageMask, params->dstStageMask, params->dependencyFlags, params->memoryBarrierCount, params->pMemoryBarriers, params->bufferMemoryBarrierCount, params->pBufferMemoryBarriers, params->imageMemoryBarrierCount, params->pImageMemoryBarriers); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPipelineBarrier(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkDependencyFlags dependencyFlags; - uint32_t memoryBarrierCount; - PTR32 pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - PTR32 pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - PTR32 pImageMemoryBarriers; - } *params = args; - const VkMemoryBarrier *pMemoryBarriers_host; - const VkBufferMemoryBarrier *pBufferMemoryBarriers_host; - const VkImageMemoryBarrier *pImageMemoryBarriers_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pMemoryBarriers_host = convert_VkMemoryBarrier_array_win32_to_host(ctx, (const VkMemoryBarrier32 *)UlongToPtr(params->pMemoryBarriers), params->memoryBarrierCount); - pBufferMemoryBarriers_host = convert_VkBufferMemoryBarrier_array_win32_to_host(ctx, (const VkBufferMemoryBarrier32 *)UlongToPtr(params->pBufferMemoryBarriers), params->bufferMemoryBarrierCount); - pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win32_to_host(ctx, (const VkImageMemoryBarrier32 *)UlongToPtr(params->pImageMemoryBarriers), params->imageMemoryBarrierCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPipelineBarrier(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcStageMask, params->dstStageMask, params->dependencyFlags, params->memoryBarrierCount, pMemoryBarriers_host, params->bufferMemoryBarrierCount, pBufferMemoryBarriers_host, params->imageMemoryBarrierCount, pImageMemoryBarriers_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPipelineBarrier2(void *args) -{ - struct vkCmdPipelineBarrier2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPipelineBarrier2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pDependencyInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPipelineBarrier2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pDependencyInfo; - } *params = args; - VkDependencyInfo pDependencyInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkDependencyInfo_win32_to_host(ctx, (const VkDependencyInfo32 *)UlongToPtr(params->pDependencyInfo), &pDependencyInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPipelineBarrier2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pDependencyInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPipelineBarrier2KHR(void *args) -{ - struct vkCmdPipelineBarrier2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPipelineBarrier2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pDependencyInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPipelineBarrier2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pDependencyInfo; - } *params = args; - VkDependencyInfo pDependencyInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkDependencyInfo_win32_to_host(ctx, (const VkDependencyInfo32 *)UlongToPtr(params->pDependencyInfo), &pDependencyInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPipelineBarrier2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pDependencyInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPreprocessGeneratedCommandsNV(void *args) -{ - struct vkCmdPreprocessGeneratedCommandsNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPreprocessGeneratedCommandsNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pGeneratedCommandsInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPreprocessGeneratedCommandsNV(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pGeneratedCommandsInfo; - } *params = args; - VkGeneratedCommandsInfoNV pGeneratedCommandsInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkGeneratedCommandsInfoNV_win32_to_host(ctx, (const VkGeneratedCommandsInfoNV32 *)UlongToPtr(params->pGeneratedCommandsInfo), &pGeneratedCommandsInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPreprocessGeneratedCommandsNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pGeneratedCommandsInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPushConstants(void *args) -{ - struct vkCmdPushConstants_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPushConstants(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->layout, params->stageFlags, params->offset, params->size, params->pValues); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPushConstants(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - VkShaderStageFlags stageFlags; - uint32_t offset; - uint32_t size; - PTR32 pValues; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPushConstants(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->layout, params->stageFlags, params->offset, params->size, (const void *)UlongToPtr(params->pValues)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPushDescriptorSetKHR(void *args) -{ - struct vkCmdPushDescriptorSetKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPushDescriptorSetKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->layout, params->set, params->descriptorWriteCount, params->pDescriptorWrites); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPushDescriptorSetKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t set; - uint32_t descriptorWriteCount; - PTR32 pDescriptorWrites; - } *params = args; - const VkWriteDescriptorSet *pDescriptorWrites_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pDescriptorWrites_host = convert_VkWriteDescriptorSet_array_win32_to_host(ctx, (const VkWriteDescriptorSet32 *)UlongToPtr(params->pDescriptorWrites), params->descriptorWriteCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPushDescriptorSetKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->layout, params->set, params->descriptorWriteCount, pDescriptorWrites_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdPushDescriptorSetWithTemplateKHR(void *args) -{ - struct vkCmdPushDescriptorSetWithTemplateKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdPushDescriptorSetWithTemplateKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->descriptorUpdateTemplate, params->layout, params->set, params->pData); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdPushDescriptorSetWithTemplateKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t set; - PTR32 pData; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdPushDescriptorSetWithTemplateKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->descriptorUpdateTemplate, params->layout, params->set, (const void *)UlongToPtr(params->pData)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResetEvent(void *args) -{ - struct vkCmdResetEvent_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResetEvent(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->event, params->stageMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResetEvent(void *args) -{ - struct - { - PTR32 commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags stageMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResetEvent(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->event, params->stageMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResetEvent2(void *args) -{ - struct vkCmdResetEvent2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResetEvent2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->event, params->stageMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResetEvent2(void *args) -{ - struct - { - PTR32 commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stageMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResetEvent2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->event, params->stageMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResetEvent2KHR(void *args) -{ - struct vkCmdResetEvent2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResetEvent2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->event, params->stageMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResetEvent2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stageMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResetEvent2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->event, params->stageMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResetQueryPool(void *args) -{ - struct vkCmdResetQueryPool_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResetQueryPool(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->queryPool, params->firstQuery, params->queryCount); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResetQueryPool(void *args) -{ - struct - { - PTR32 commandBuffer; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResetQueryPool(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->queryPool, params->firstQuery, params->queryCount); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResolveImage(void *args) -{ - struct vkCmdResolveImage_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResolveImage(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstImage, params->dstImageLayout, params->regionCount, params->pRegions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResolveImage(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImage DECLSPEC_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage DECLSPEC_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - PTR32 pRegions; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResolveImage(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->srcImage, params->srcImageLayout, params->dstImage, params->dstImageLayout, params->regionCount, (const VkImageResolve *)UlongToPtr(params->pRegions)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResolveImage2(void *args) -{ - struct vkCmdResolveImage2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResolveImage2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pResolveImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResolveImage2(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pResolveImageInfo; - } *params = args; - VkResolveImageInfo2 pResolveImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkResolveImageInfo2_win32_to_host(ctx, (const VkResolveImageInfo232 *)UlongToPtr(params->pResolveImageInfo), &pResolveImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResolveImage2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pResolveImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdResolveImage2KHR(void *args) -{ - struct vkCmdResolveImage2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdResolveImage2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pResolveImageInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdResolveImage2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pResolveImageInfo; - } *params = args; - VkResolveImageInfo2 pResolveImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkResolveImageInfo2_win32_to_host(ctx, (const VkResolveImageInfo232 *)UlongToPtr(params->pResolveImageInfo), &pResolveImageInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdResolveImage2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pResolveImageInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetAlphaToCoverageEnableEXT(void *args) -{ - struct vkCmdSetAlphaToCoverageEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetAlphaToCoverageEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->alphaToCoverageEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetAlphaToCoverageEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 alphaToCoverageEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetAlphaToCoverageEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->alphaToCoverageEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetAlphaToOneEnableEXT(void *args) -{ - struct vkCmdSetAlphaToOneEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetAlphaToOneEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->alphaToOneEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetAlphaToOneEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 alphaToOneEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetAlphaToOneEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->alphaToOneEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetAttachmentFeedbackLoopEnableEXT(void *args) -{ - struct vkCmdSetAttachmentFeedbackLoopEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetAttachmentFeedbackLoopEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->aspectMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetAttachmentFeedbackLoopEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkImageAspectFlags aspectMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetAttachmentFeedbackLoopEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->aspectMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetBlendConstants(void *args) -{ - struct vkCmdSetBlendConstants_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetBlendConstants(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->blendConstants); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetBlendConstants(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 blendConstants; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetBlendConstants(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, (const float *)UlongToPtr(params->blendConstants)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCheckpointNV(void *args) -{ - struct vkCmdSetCheckpointNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCheckpointNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pCheckpointMarker); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCheckpointNV(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pCheckpointMarker; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCheckpointNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, (const void *)UlongToPtr(params->pCheckpointMarker)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoarseSampleOrderNV(void *args) -{ - struct vkCmdSetCoarseSampleOrderNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoarseSampleOrderNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->sampleOrderType, params->customSampleOrderCount, params->pCustomSampleOrders); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoarseSampleOrderNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCoarseSampleOrderTypeNV sampleOrderType; - uint32_t customSampleOrderCount; - PTR32 pCustomSampleOrders; - } *params = args; - const VkCoarseSampleOrderCustomNV *pCustomSampleOrders_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pCustomSampleOrders_host = convert_VkCoarseSampleOrderCustomNV_array_win32_to_host(ctx, (const VkCoarseSampleOrderCustomNV32 *)UlongToPtr(params->pCustomSampleOrders), params->customSampleOrderCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoarseSampleOrderNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->sampleOrderType, params->customSampleOrderCount, pCustomSampleOrders_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetColorBlendAdvancedEXT(void *args) -{ - struct vkCmdSetColorBlendAdvancedEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetColorBlendAdvancedEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstAttachment, params->attachmentCount, params->pColorBlendAdvanced); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetColorBlendAdvancedEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - PTR32 pColorBlendAdvanced; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetColorBlendAdvancedEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstAttachment, params->attachmentCount, (const VkColorBlendAdvancedEXT *)UlongToPtr(params->pColorBlendAdvanced)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetColorBlendEnableEXT(void *args) -{ - struct vkCmdSetColorBlendEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetColorBlendEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstAttachment, params->attachmentCount, params->pColorBlendEnables); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetColorBlendEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - PTR32 pColorBlendEnables; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetColorBlendEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstAttachment, params->attachmentCount, (const VkBool32 *)UlongToPtr(params->pColorBlendEnables)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetColorBlendEquationEXT(void *args) -{ - struct vkCmdSetColorBlendEquationEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetColorBlendEquationEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstAttachment, params->attachmentCount, params->pColorBlendEquations); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetColorBlendEquationEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - PTR32 pColorBlendEquations; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetColorBlendEquationEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstAttachment, params->attachmentCount, (const VkColorBlendEquationEXT *)UlongToPtr(params->pColorBlendEquations)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetColorWriteEnableEXT(void *args) -{ - struct vkCmdSetColorWriteEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetColorWriteEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->attachmentCount, params->pColorWriteEnables); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetColorWriteEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t attachmentCount; - PTR32 pColorWriteEnables; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetColorWriteEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->attachmentCount, (const VkBool32 *)UlongToPtr(params->pColorWriteEnables)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetColorWriteMaskEXT(void *args) -{ - struct vkCmdSetColorWriteMaskEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetColorWriteMaskEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstAttachment, params->attachmentCount, params->pColorWriteMasks); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetColorWriteMaskEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstAttachment; - uint32_t attachmentCount; - PTR32 pColorWriteMasks; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetColorWriteMaskEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstAttachment, params->attachmentCount, (const VkColorComponentFlags *)UlongToPtr(params->pColorWriteMasks)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetConservativeRasterizationModeEXT(void *args) -{ - struct vkCmdSetConservativeRasterizationModeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetConservativeRasterizationModeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->conservativeRasterizationMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetConservativeRasterizationModeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkConservativeRasterizationModeEXT conservativeRasterizationMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetConservativeRasterizationModeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->conservativeRasterizationMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoverageModulationModeNV(void *args) -{ - struct vkCmdSetCoverageModulationModeNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoverageModulationModeNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->coverageModulationMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoverageModulationModeNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCoverageModulationModeNV coverageModulationMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoverageModulationModeNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->coverageModulationMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoverageModulationTableEnableNV(void *args) -{ - struct vkCmdSetCoverageModulationTableEnableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoverageModulationTableEnableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->coverageModulationTableEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoverageModulationTableEnableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 coverageModulationTableEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoverageModulationTableEnableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->coverageModulationTableEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoverageModulationTableNV(void *args) -{ - struct vkCmdSetCoverageModulationTableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoverageModulationTableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->coverageModulationTableCount, params->pCoverageModulationTable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoverageModulationTableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t coverageModulationTableCount; - PTR32 pCoverageModulationTable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoverageModulationTableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->coverageModulationTableCount, (const float *)UlongToPtr(params->pCoverageModulationTable)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoverageReductionModeNV(void *args) -{ - struct vkCmdSetCoverageReductionModeNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoverageReductionModeNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->coverageReductionMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoverageReductionModeNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCoverageReductionModeNV coverageReductionMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoverageReductionModeNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->coverageReductionMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoverageToColorEnableNV(void *args) -{ - struct vkCmdSetCoverageToColorEnableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoverageToColorEnableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->coverageToColorEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoverageToColorEnableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 coverageToColorEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoverageToColorEnableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->coverageToColorEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCoverageToColorLocationNV(void *args) -{ - struct vkCmdSetCoverageToColorLocationNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCoverageToColorLocationNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->coverageToColorLocation); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCoverageToColorLocationNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t coverageToColorLocation; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCoverageToColorLocationNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->coverageToColorLocation); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCullMode(void *args) -{ - struct vkCmdSetCullMode_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCullMode(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->cullMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCullMode(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCullModeFlags cullMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCullMode(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->cullMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetCullModeEXT(void *args) -{ - struct vkCmdSetCullModeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetCullModeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->cullMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetCullModeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCullModeFlags cullMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetCullModeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->cullMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBias(void *args) -{ - struct vkCmdSetDepthBias_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBias(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthBiasConstantFactor, params->depthBiasClamp, params->depthBiasSlopeFactor); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBias(void *args) -{ - struct - { - PTR32 commandBuffer; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBias(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthBiasConstantFactor, params->depthBiasClamp, params->depthBiasSlopeFactor); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBias2EXT(void *args) -{ - struct vkCmdSetDepthBias2EXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBias2EXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pDepthBiasInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBias2EXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pDepthBiasInfo; - } *params = args; - VkDepthBiasInfoEXT pDepthBiasInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkDepthBiasInfoEXT_win32_to_host(ctx, (const VkDepthBiasInfoEXT32 *)UlongToPtr(params->pDepthBiasInfo), &pDepthBiasInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBias2EXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pDepthBiasInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBiasEnable(void *args) -{ - struct vkCmdSetDepthBiasEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBiasEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthBiasEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBiasEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthBiasEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBiasEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthBiasEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBiasEnableEXT(void *args) -{ - struct vkCmdSetDepthBiasEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBiasEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthBiasEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBiasEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthBiasEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBiasEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthBiasEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBounds(void *args) -{ - struct vkCmdSetDepthBounds_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBounds(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->minDepthBounds, params->maxDepthBounds); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBounds(void *args) -{ - struct - { - PTR32 commandBuffer; - float minDepthBounds; - float maxDepthBounds; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBounds(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->minDepthBounds, params->maxDepthBounds); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBoundsTestEnable(void *args) -{ - struct vkCmdSetDepthBoundsTestEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBoundsTestEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthBoundsTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBoundsTestEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthBoundsTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBoundsTestEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthBoundsTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthBoundsTestEnableEXT(void *args) -{ - struct vkCmdSetDepthBoundsTestEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthBoundsTestEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthBoundsTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthBoundsTestEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthBoundsTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthBoundsTestEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthBoundsTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthClampEnableEXT(void *args) -{ - struct vkCmdSetDepthClampEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthClampEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthClampEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthClampEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthClampEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthClampEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthClampEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthClipEnableEXT(void *args) -{ - struct vkCmdSetDepthClipEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthClipEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthClipEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthClipEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthClipEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthClipEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthClipEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthClipNegativeOneToOneEXT(void *args) -{ - struct vkCmdSetDepthClipNegativeOneToOneEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthClipNegativeOneToOneEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->negativeOneToOne); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthClipNegativeOneToOneEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 negativeOneToOne; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthClipNegativeOneToOneEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->negativeOneToOne); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthCompareOp(void *args) -{ - struct vkCmdSetDepthCompareOp_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthCompareOp(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthCompareOp); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthCompareOp(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCompareOp depthCompareOp; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthCompareOp(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthCompareOp); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthCompareOpEXT(void *args) -{ - struct vkCmdSetDepthCompareOpEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthCompareOpEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthCompareOp); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthCompareOpEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCompareOp depthCompareOp; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthCompareOpEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthCompareOp); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthTestEnable(void *args) -{ - struct vkCmdSetDepthTestEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthTestEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthTestEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthTestEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthTestEnableEXT(void *args) -{ - struct vkCmdSetDepthTestEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthTestEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthTestEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthTestEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthWriteEnable(void *args) -{ - struct vkCmdSetDepthWriteEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthWriteEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthWriteEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthWriteEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthWriteEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthWriteEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthWriteEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDepthWriteEnableEXT(void *args) -{ - struct vkCmdSetDepthWriteEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDepthWriteEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->depthWriteEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDepthWriteEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 depthWriteEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDepthWriteEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->depthWriteEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDescriptorBufferOffsetsEXT(void *args) -{ - struct vkCmdSetDescriptorBufferOffsetsEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDescriptorBufferOffsetsEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->layout, params->firstSet, params->setCount, params->pBufferIndices, params->pOffsets); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDescriptorBufferOffsetsEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout DECLSPEC_ALIGN(8) layout; - uint32_t firstSet; - uint32_t setCount; - PTR32 pBufferIndices; - PTR32 pOffsets; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDescriptorBufferOffsetsEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->layout, params->firstSet, params->setCount, (const uint32_t *)UlongToPtr(params->pBufferIndices), (const VkDeviceSize *)UlongToPtr(params->pOffsets)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDeviceMask(void *args) -{ - struct vkCmdSetDeviceMask_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDeviceMask(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->deviceMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDeviceMask(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t deviceMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDeviceMask(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->deviceMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDeviceMaskKHR(void *args) -{ - struct vkCmdSetDeviceMaskKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDeviceMaskKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->deviceMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDeviceMaskKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t deviceMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDeviceMaskKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->deviceMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDiscardRectangleEXT(void *args) -{ - struct vkCmdSetDiscardRectangleEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDiscardRectangleEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstDiscardRectangle, params->discardRectangleCount, params->pDiscardRectangles); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDiscardRectangleEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstDiscardRectangle; - uint32_t discardRectangleCount; - PTR32 pDiscardRectangles; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDiscardRectangleEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstDiscardRectangle, params->discardRectangleCount, (const VkRect2D *)UlongToPtr(params->pDiscardRectangles)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDiscardRectangleEnableEXT(void *args) -{ - struct vkCmdSetDiscardRectangleEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDiscardRectangleEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->discardRectangleEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDiscardRectangleEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 discardRectangleEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDiscardRectangleEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->discardRectangleEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetDiscardRectangleModeEXT(void *args) -{ - struct vkCmdSetDiscardRectangleModeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetDiscardRectangleModeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->discardRectangleMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetDiscardRectangleModeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkDiscardRectangleModeEXT discardRectangleMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetDiscardRectangleModeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->discardRectangleMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetEvent(void *args) -{ - struct vkCmdSetEvent_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetEvent(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->event, params->stageMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetEvent(void *args) -{ - struct - { - PTR32 commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - VkPipelineStageFlags stageMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetEvent(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->event, params->stageMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetEvent2(void *args) -{ - struct vkCmdSetEvent2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetEvent2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->event, params->pDependencyInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetEvent2(void *args) -{ - struct - { - PTR32 commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - PTR32 pDependencyInfo; - } *params = args; - VkDependencyInfo pDependencyInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkDependencyInfo_win32_to_host(ctx, (const VkDependencyInfo32 *)UlongToPtr(params->pDependencyInfo), &pDependencyInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetEvent2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->event, &pDependencyInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetEvent2KHR(void *args) -{ - struct vkCmdSetEvent2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetEvent2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->event, params->pDependencyInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetEvent2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkEvent DECLSPEC_ALIGN(8) event; - PTR32 pDependencyInfo; - } *params = args; - VkDependencyInfo pDependencyInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkDependencyInfo_win32_to_host(ctx, (const VkDependencyInfo32 *)UlongToPtr(params->pDependencyInfo), &pDependencyInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetEvent2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->event, &pDependencyInfo_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetExclusiveScissorEnableNV(void *args) -{ - struct vkCmdSetExclusiveScissorEnableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetExclusiveScissorEnableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstExclusiveScissor, params->exclusiveScissorCount, params->pExclusiveScissorEnables); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetExclusiveScissorEnableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstExclusiveScissor; - uint32_t exclusiveScissorCount; - PTR32 pExclusiveScissorEnables; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetExclusiveScissorEnableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstExclusiveScissor, params->exclusiveScissorCount, (const VkBool32 *)UlongToPtr(params->pExclusiveScissorEnables)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetExclusiveScissorNV(void *args) -{ - struct vkCmdSetExclusiveScissorNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetExclusiveScissorNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstExclusiveScissor, params->exclusiveScissorCount, params->pExclusiveScissors); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetExclusiveScissorNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstExclusiveScissor; - uint32_t exclusiveScissorCount; - PTR32 pExclusiveScissors; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetExclusiveScissorNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstExclusiveScissor, params->exclusiveScissorCount, (const VkRect2D *)UlongToPtr(params->pExclusiveScissors)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetExtraPrimitiveOverestimationSizeEXT(void *args) -{ - struct vkCmdSetExtraPrimitiveOverestimationSizeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetExtraPrimitiveOverestimationSizeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->extraPrimitiveOverestimationSize); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetExtraPrimitiveOverestimationSizeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - float extraPrimitiveOverestimationSize; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetExtraPrimitiveOverestimationSizeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->extraPrimitiveOverestimationSize); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetFragmentShadingRateEnumNV(void *args) -{ - struct vkCmdSetFragmentShadingRateEnumNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetFragmentShadingRateEnumNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->shadingRate, params->combinerOps); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetFragmentShadingRateEnumNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkFragmentShadingRateNV shadingRate; - PTR32 combinerOps; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetFragmentShadingRateEnumNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->shadingRate, (const VkFragmentShadingRateCombinerOpKHR *)UlongToPtr(params->combinerOps)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetFragmentShadingRateKHR(void *args) -{ - struct vkCmdSetFragmentShadingRateKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetFragmentShadingRateKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pFragmentSize, params->combinerOps); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetFragmentShadingRateKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pFragmentSize; - PTR32 combinerOps; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetFragmentShadingRateKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, (const VkExtent2D *)UlongToPtr(params->pFragmentSize), (const VkFragmentShadingRateCombinerOpKHR *)UlongToPtr(params->combinerOps)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetFrontFace(void *args) -{ - struct vkCmdSetFrontFace_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetFrontFace(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->frontFace); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetFrontFace(void *args) -{ - struct - { - PTR32 commandBuffer; - VkFrontFace frontFace; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetFrontFace(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->frontFace); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetFrontFaceEXT(void *args) -{ - struct vkCmdSetFrontFaceEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetFrontFaceEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->frontFace); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetFrontFaceEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkFrontFace frontFace; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetFrontFaceEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->frontFace); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetLineRasterizationModeEXT(void *args) -{ - struct vkCmdSetLineRasterizationModeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetLineRasterizationModeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->lineRasterizationMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetLineRasterizationModeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkLineRasterizationModeEXT lineRasterizationMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetLineRasterizationModeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->lineRasterizationMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetLineStippleEXT(void *args) -{ - struct vkCmdSetLineStippleEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetLineStippleEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->lineStippleFactor, params->lineStipplePattern); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetLineStippleEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t lineStippleFactor; - uint16_t lineStipplePattern; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetLineStippleEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->lineStippleFactor, params->lineStipplePattern); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetLineStippleEnableEXT(void *args) -{ - struct vkCmdSetLineStippleEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetLineStippleEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stippledLineEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetLineStippleEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 stippledLineEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetLineStippleEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stippledLineEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetLineWidth(void *args) -{ - struct vkCmdSetLineWidth_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetLineWidth(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->lineWidth); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetLineWidth(void *args) -{ - struct - { - PTR32 commandBuffer; - float lineWidth; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetLineWidth(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->lineWidth); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetLogicOpEXT(void *args) -{ - struct vkCmdSetLogicOpEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetLogicOpEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->logicOp); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetLogicOpEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkLogicOp logicOp; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetLogicOpEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->logicOp); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetLogicOpEnableEXT(void *args) -{ - struct vkCmdSetLogicOpEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetLogicOpEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->logicOpEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetLogicOpEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 logicOpEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetLogicOpEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->logicOpEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetPatchControlPointsEXT(void *args) -{ - struct vkCmdSetPatchControlPointsEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPatchControlPointsEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->patchControlPoints); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetPatchControlPointsEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t patchControlPoints; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPatchControlPointsEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->patchControlPoints); -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCmdSetPerformanceMarkerINTEL(void *args) -{ - struct vkCmdSetPerformanceMarkerINTEL_params *params = args; - - TRACE("%p, %p\n", params->commandBuffer, params->pMarkerInfo); - - params->result = wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPerformanceMarkerINTEL(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pMarkerInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCmdSetPerformanceMarkerINTEL(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pMarkerInfo; - VkResult result; - } *params = args; - VkPerformanceMarkerInfoINTEL pMarkerInfo_host; - - TRACE("%#x, %#x\n", params->commandBuffer, params->pMarkerInfo); - - convert_VkPerformanceMarkerInfoINTEL_win32_to_host((const VkPerformanceMarkerInfoINTEL32 *)UlongToPtr(params->pMarkerInfo), &pMarkerInfo_host); - params->result = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPerformanceMarkerINTEL(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pMarkerInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCmdSetPerformanceOverrideINTEL(void *args) -{ - struct vkCmdSetPerformanceOverrideINTEL_params *params = args; - - TRACE("%p, %p\n", params->commandBuffer, params->pOverrideInfo); - - params->result = wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPerformanceOverrideINTEL(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pOverrideInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCmdSetPerformanceOverrideINTEL(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pOverrideInfo; - VkResult result; - } *params = args; - VkPerformanceOverrideInfoINTEL pOverrideInfo_host; - - TRACE("%#x, %#x\n", params->commandBuffer, params->pOverrideInfo); - - convert_VkPerformanceOverrideInfoINTEL_win32_to_host((const VkPerformanceOverrideInfoINTEL32 *)UlongToPtr(params->pOverrideInfo), &pOverrideInfo_host); - params->result = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPerformanceOverrideINTEL(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pOverrideInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCmdSetPerformanceStreamMarkerINTEL(void *args) -{ - struct vkCmdSetPerformanceStreamMarkerINTEL_params *params = args; - - TRACE("%p, %p\n", params->commandBuffer, params->pMarkerInfo); - - params->result = wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPerformanceStreamMarkerINTEL(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pMarkerInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCmdSetPerformanceStreamMarkerINTEL(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pMarkerInfo; - VkResult result; - } *params = args; - VkPerformanceStreamMarkerInfoINTEL pMarkerInfo_host; - - TRACE("%#x, %#x\n", params->commandBuffer, params->pMarkerInfo); - - convert_VkPerformanceStreamMarkerInfoINTEL_win32_to_host((const VkPerformanceStreamMarkerInfoINTEL32 *)UlongToPtr(params->pMarkerInfo), &pMarkerInfo_host); - params->result = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPerformanceStreamMarkerINTEL(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pMarkerInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetPolygonModeEXT(void *args) -{ - struct vkCmdSetPolygonModeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPolygonModeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->polygonMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetPolygonModeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPolygonMode polygonMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPolygonModeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->polygonMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetPrimitiveRestartEnable(void *args) -{ - struct vkCmdSetPrimitiveRestartEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPrimitiveRestartEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->primitiveRestartEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetPrimitiveRestartEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 primitiveRestartEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPrimitiveRestartEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->primitiveRestartEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetPrimitiveRestartEnableEXT(void *args) -{ - struct vkCmdSetPrimitiveRestartEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPrimitiveRestartEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->primitiveRestartEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetPrimitiveRestartEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 primitiveRestartEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPrimitiveRestartEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->primitiveRestartEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetPrimitiveTopology(void *args) -{ - struct vkCmdSetPrimitiveTopology_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPrimitiveTopology(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->primitiveTopology); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetPrimitiveTopology(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPrimitiveTopology primitiveTopology; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPrimitiveTopology(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->primitiveTopology); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetPrimitiveTopologyEXT(void *args) -{ - struct vkCmdSetPrimitiveTopologyEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetPrimitiveTopologyEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->primitiveTopology); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetPrimitiveTopologyEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPrimitiveTopology primitiveTopology; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetPrimitiveTopologyEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->primitiveTopology); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetProvokingVertexModeEXT(void *args) -{ - struct vkCmdSetProvokingVertexModeEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetProvokingVertexModeEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->provokingVertexMode); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetProvokingVertexModeEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkProvokingVertexModeEXT provokingVertexMode; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetProvokingVertexModeEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->provokingVertexMode); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetRasterizationSamplesEXT(void *args) -{ - struct vkCmdSetRasterizationSamplesEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetRasterizationSamplesEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->rasterizationSamples); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetRasterizationSamplesEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkSampleCountFlagBits rasterizationSamples; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetRasterizationSamplesEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->rasterizationSamples); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetRasterizationStreamEXT(void *args) -{ - struct vkCmdSetRasterizationStreamEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetRasterizationStreamEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->rasterizationStream); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetRasterizationStreamEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t rasterizationStream; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetRasterizationStreamEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->rasterizationStream); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetRasterizerDiscardEnable(void *args) -{ - struct vkCmdSetRasterizerDiscardEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetRasterizerDiscardEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->rasterizerDiscardEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetRasterizerDiscardEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 rasterizerDiscardEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetRasterizerDiscardEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->rasterizerDiscardEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetRasterizerDiscardEnableEXT(void *args) -{ - struct vkCmdSetRasterizerDiscardEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetRasterizerDiscardEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->rasterizerDiscardEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetRasterizerDiscardEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 rasterizerDiscardEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetRasterizerDiscardEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->rasterizerDiscardEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetRayTracingPipelineStackSizeKHR(void *args) -{ - struct vkCmdSetRayTracingPipelineStackSizeKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetRayTracingPipelineStackSizeKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineStackSize); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetRayTracingPipelineStackSizeKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t pipelineStackSize; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetRayTracingPipelineStackSizeKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineStackSize); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetRepresentativeFragmentTestEnableNV(void *args) -{ - struct vkCmdSetRepresentativeFragmentTestEnableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetRepresentativeFragmentTestEnableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->representativeFragmentTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetRepresentativeFragmentTestEnableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 representativeFragmentTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetRepresentativeFragmentTestEnableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->representativeFragmentTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetSampleLocationsEXT(void *args) -{ - struct vkCmdSetSampleLocationsEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetSampleLocationsEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pSampleLocationsInfo); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetSampleLocationsEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pSampleLocationsInfo; - } *params = args; - VkSampleLocationsInfoEXT pSampleLocationsInfo_host; - - convert_VkSampleLocationsInfoEXT_win32_to_host((const VkSampleLocationsInfoEXT32 *)UlongToPtr(params->pSampleLocationsInfo), &pSampleLocationsInfo_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetSampleLocationsEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pSampleLocationsInfo_host); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetSampleLocationsEnableEXT(void *args) -{ - struct vkCmdSetSampleLocationsEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetSampleLocationsEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->sampleLocationsEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetSampleLocationsEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 sampleLocationsEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetSampleLocationsEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->sampleLocationsEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetSampleMaskEXT(void *args) -{ - struct vkCmdSetSampleMaskEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetSampleMaskEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->samples, params->pSampleMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetSampleMaskEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkSampleCountFlagBits samples; - PTR32 pSampleMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetSampleMaskEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->samples, (const VkSampleMask *)UlongToPtr(params->pSampleMask)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetScissor(void *args) -{ - struct vkCmdSetScissor_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetScissor(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstScissor, params->scissorCount, params->pScissors); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetScissor(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstScissor; - uint32_t scissorCount; - PTR32 pScissors; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetScissor(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstScissor, params->scissorCount, (const VkRect2D *)UlongToPtr(params->pScissors)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetScissorWithCount(void *args) -{ - struct vkCmdSetScissorWithCount_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetScissorWithCount(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->scissorCount, params->pScissors); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetScissorWithCount(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t scissorCount; - PTR32 pScissors; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetScissorWithCount(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->scissorCount, (const VkRect2D *)UlongToPtr(params->pScissors)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetScissorWithCountEXT(void *args) -{ - struct vkCmdSetScissorWithCountEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetScissorWithCountEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->scissorCount, params->pScissors); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetScissorWithCountEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t scissorCount; - PTR32 pScissors; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetScissorWithCountEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->scissorCount, (const VkRect2D *)UlongToPtr(params->pScissors)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetShadingRateImageEnableNV(void *args) -{ - struct vkCmdSetShadingRateImageEnableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetShadingRateImageEnableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->shadingRateImageEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetShadingRateImageEnableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 shadingRateImageEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetShadingRateImageEnableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->shadingRateImageEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilCompareMask(void *args) -{ - struct vkCmdSetStencilCompareMask_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilCompareMask(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->faceMask, params->compareMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilCompareMask(void *args) -{ - struct - { - PTR32 commandBuffer; - VkStencilFaceFlags faceMask; - uint32_t compareMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilCompareMask(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->faceMask, params->compareMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilOp(void *args) -{ - struct vkCmdSetStencilOp_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilOp(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->faceMask, params->failOp, params->passOp, params->depthFailOp, params->compareOp); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilOp(void *args) -{ - struct - { - PTR32 commandBuffer; - VkStencilFaceFlags faceMask; - VkStencilOp failOp; - VkStencilOp passOp; - VkStencilOp depthFailOp; - VkCompareOp compareOp; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilOp(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->faceMask, params->failOp, params->passOp, params->depthFailOp, params->compareOp); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilOpEXT(void *args) -{ - struct vkCmdSetStencilOpEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilOpEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->faceMask, params->failOp, params->passOp, params->depthFailOp, params->compareOp); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilOpEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkStencilFaceFlags faceMask; - VkStencilOp failOp; - VkStencilOp passOp; - VkStencilOp depthFailOp; - VkCompareOp compareOp; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilOpEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->faceMask, params->failOp, params->passOp, params->depthFailOp, params->compareOp); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilReference(void *args) -{ - struct vkCmdSetStencilReference_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilReference(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->faceMask, params->reference); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilReference(void *args) -{ - struct - { - PTR32 commandBuffer; - VkStencilFaceFlags faceMask; - uint32_t reference; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilReference(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->faceMask, params->reference); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilTestEnable(void *args) -{ - struct vkCmdSetStencilTestEnable_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilTestEnable(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stencilTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilTestEnable(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 stencilTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilTestEnable(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stencilTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilTestEnableEXT(void *args) -{ - struct vkCmdSetStencilTestEnableEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilTestEnableEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stencilTestEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilTestEnableEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 stencilTestEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilTestEnableEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stencilTestEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetStencilWriteMask(void *args) -{ - struct vkCmdSetStencilWriteMask_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetStencilWriteMask(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->faceMask, params->writeMask); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetStencilWriteMask(void *args) -{ - struct - { - PTR32 commandBuffer; - VkStencilFaceFlags faceMask; - uint32_t writeMask; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetStencilWriteMask(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->faceMask, params->writeMask); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetTessellationDomainOriginEXT(void *args) -{ - struct vkCmdSetTessellationDomainOriginEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetTessellationDomainOriginEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->domainOrigin); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetTessellationDomainOriginEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - VkTessellationDomainOrigin domainOrigin; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetTessellationDomainOriginEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->domainOrigin); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetVertexInputEXT(void *args) -{ - struct vkCmdSetVertexInputEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetVertexInputEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->vertexBindingDescriptionCount, params->pVertexBindingDescriptions, params->vertexAttributeDescriptionCount, params->pVertexAttributeDescriptions); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetVertexInputEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t vertexBindingDescriptionCount; - PTR32 pVertexBindingDescriptions; - uint32_t vertexAttributeDescriptionCount; - PTR32 pVertexAttributeDescriptions; - } *params = args; - const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions_host; - const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pVertexBindingDescriptions_host = convert_VkVertexInputBindingDescription2EXT_array_win32_to_host(ctx, (const VkVertexInputBindingDescription2EXT32 *)UlongToPtr(params->pVertexBindingDescriptions), params->vertexBindingDescriptionCount); - pVertexAttributeDescriptions_host = convert_VkVertexInputAttributeDescription2EXT_array_win32_to_host(ctx, (const VkVertexInputAttributeDescription2EXT32 *)UlongToPtr(params->pVertexAttributeDescriptions), params->vertexAttributeDescriptionCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetVertexInputEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->vertexBindingDescriptionCount, pVertexBindingDescriptions_host, params->vertexAttributeDescriptionCount, pVertexAttributeDescriptions_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewport(void *args) -{ - struct vkCmdSetViewport_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewport(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstViewport, params->viewportCount, params->pViewports); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewport(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - PTR32 pViewports; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewport(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstViewport, params->viewportCount, (const VkViewport *)UlongToPtr(params->pViewports)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewportShadingRatePaletteNV(void *args) -{ - struct vkCmdSetViewportShadingRatePaletteNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewportShadingRatePaletteNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstViewport, params->viewportCount, params->pShadingRatePalettes); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewportShadingRatePaletteNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - PTR32 pShadingRatePalettes; - } *params = args; - const VkShadingRatePaletteNV *pShadingRatePalettes_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pShadingRatePalettes_host = convert_VkShadingRatePaletteNV_array_win32_to_host(ctx, (const VkShadingRatePaletteNV32 *)UlongToPtr(params->pShadingRatePalettes), params->viewportCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewportShadingRatePaletteNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstViewport, params->viewportCount, pShadingRatePalettes_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewportSwizzleNV(void *args) -{ - struct vkCmdSetViewportSwizzleNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewportSwizzleNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstViewport, params->viewportCount, params->pViewportSwizzles); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewportSwizzleNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - PTR32 pViewportSwizzles; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewportSwizzleNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstViewport, params->viewportCount, (const VkViewportSwizzleNV *)UlongToPtr(params->pViewportSwizzles)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewportWScalingEnableNV(void *args) -{ - struct vkCmdSetViewportWScalingEnableNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewportWScalingEnableNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->viewportWScalingEnable); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewportWScalingEnableNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBool32 viewportWScalingEnable; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewportWScalingEnableNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->viewportWScalingEnable); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewportWScalingNV(void *args) -{ - struct vkCmdSetViewportWScalingNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewportWScalingNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->firstViewport, params->viewportCount, params->pViewportWScalings); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewportWScalingNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t firstViewport; - uint32_t viewportCount; - PTR32 pViewportWScalings; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewportWScalingNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->firstViewport, params->viewportCount, (const VkViewportWScalingNV *)UlongToPtr(params->pViewportWScalings)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewportWithCount(void *args) -{ - struct vkCmdSetViewportWithCount_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewportWithCount(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->viewportCount, params->pViewports); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewportWithCount(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t viewportCount; - PTR32 pViewports; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewportWithCount(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->viewportCount, (const VkViewport *)UlongToPtr(params->pViewports)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSetViewportWithCountEXT(void *args) -{ - struct vkCmdSetViewportWithCountEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSetViewportWithCountEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->viewportCount, params->pViewports); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSetViewportWithCountEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t viewportCount; - PTR32 pViewports; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSetViewportWithCountEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->viewportCount, (const VkViewport *)UlongToPtr(params->pViewports)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdSubpassShadingHUAWEI(void *args) -{ - struct vkCmdSubpassShadingHUAWEI_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdSubpassShadingHUAWEI(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdSubpassShadingHUAWEI(void *args) -{ - struct - { - PTR32 commandBuffer; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdSubpassShadingHUAWEI(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); -} - -#ifdef _WIN64 -static void thunk64_vkCmdTraceRaysIndirect2KHR(void *args) -{ - struct vkCmdTraceRaysIndirect2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdTraceRaysIndirect2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->indirectDeviceAddress); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdTraceRaysIndirect2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectDeviceAddress; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdTraceRaysIndirect2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->indirectDeviceAddress); -} - -#ifdef _WIN64 -static void thunk64_vkCmdTraceRaysIndirectKHR(void *args) -{ - struct vkCmdTraceRaysIndirectKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdTraceRaysIndirectKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRaygenShaderBindingTable, params->pMissShaderBindingTable, params->pHitShaderBindingTable, params->pCallableShaderBindingTable, params->indirectDeviceAddress); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdTraceRaysIndirectKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRaygenShaderBindingTable; - PTR32 pMissShaderBindingTable; - PTR32 pHitShaderBindingTable; - PTR32 pCallableShaderBindingTable; - VkDeviceAddress DECLSPEC_ALIGN(8) indirectDeviceAddress; - } *params = args; - VkStridedDeviceAddressRegionKHR pRaygenShaderBindingTable_host; - VkStridedDeviceAddressRegionKHR pMissShaderBindingTable_host; - VkStridedDeviceAddressRegionKHR pHitShaderBindingTable_host; - VkStridedDeviceAddressRegionKHR pCallableShaderBindingTable_host; - - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pRaygenShaderBindingTable), &pRaygenShaderBindingTable_host); - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pMissShaderBindingTable), &pMissShaderBindingTable_host); - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pHitShaderBindingTable), &pHitShaderBindingTable_host); - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pCallableShaderBindingTable), &pCallableShaderBindingTable_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdTraceRaysIndirectKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRaygenShaderBindingTable_host, &pMissShaderBindingTable_host, &pHitShaderBindingTable_host, &pCallableShaderBindingTable_host, params->indirectDeviceAddress); -} - -#ifdef _WIN64 -static void thunk64_vkCmdTraceRaysKHR(void *args) -{ - struct vkCmdTraceRaysKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdTraceRaysKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pRaygenShaderBindingTable, params->pMissShaderBindingTable, params->pHitShaderBindingTable, params->pCallableShaderBindingTable, params->width, params->height, params->depth); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdTraceRaysKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - PTR32 pRaygenShaderBindingTable; - PTR32 pMissShaderBindingTable; - PTR32 pHitShaderBindingTable; - PTR32 pCallableShaderBindingTable; - uint32_t width; - uint32_t height; - uint32_t depth; - } *params = args; - VkStridedDeviceAddressRegionKHR pRaygenShaderBindingTable_host; - VkStridedDeviceAddressRegionKHR pMissShaderBindingTable_host; - VkStridedDeviceAddressRegionKHR pHitShaderBindingTable_host; - VkStridedDeviceAddressRegionKHR pCallableShaderBindingTable_host; - - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pRaygenShaderBindingTable), &pRaygenShaderBindingTable_host); - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pMissShaderBindingTable), &pMissShaderBindingTable_host); - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pHitShaderBindingTable), &pHitShaderBindingTable_host); - convert_VkStridedDeviceAddressRegionKHR_win32_to_host((const VkStridedDeviceAddressRegionKHR32 *)UlongToPtr(params->pCallableShaderBindingTable), &pCallableShaderBindingTable_host); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdTraceRaysKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, &pRaygenShaderBindingTable_host, &pMissShaderBindingTable_host, &pHitShaderBindingTable_host, &pCallableShaderBindingTable_host, params->width, params->height, params->depth); -} - -#ifdef _WIN64 -static void thunk64_vkCmdTraceRaysNV(void *args) -{ - struct vkCmdTraceRaysNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdTraceRaysNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->raygenShaderBindingTableBuffer, params->raygenShaderBindingOffset, params->missShaderBindingTableBuffer, params->missShaderBindingOffset, params->missShaderBindingStride, params->hitShaderBindingTableBuffer, params->hitShaderBindingOffset, params->hitShaderBindingStride, params->callableShaderBindingTableBuffer, params->callableShaderBindingOffset, params->callableShaderBindingStride, params->width, params->height, params->depth); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdTraceRaysNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) raygenShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) raygenShaderBindingOffset; - VkBuffer DECLSPEC_ALIGN(8) missShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) missShaderBindingOffset; - VkDeviceSize DECLSPEC_ALIGN(8) missShaderBindingStride; - VkBuffer DECLSPEC_ALIGN(8) hitShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) hitShaderBindingOffset; - VkDeviceSize DECLSPEC_ALIGN(8) hitShaderBindingStride; - VkBuffer DECLSPEC_ALIGN(8) callableShaderBindingTableBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) callableShaderBindingOffset; - VkDeviceSize DECLSPEC_ALIGN(8) callableShaderBindingStride; - uint32_t width; - uint32_t height; - uint32_t depth; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdTraceRaysNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->raygenShaderBindingTableBuffer, params->raygenShaderBindingOffset, params->missShaderBindingTableBuffer, params->missShaderBindingOffset, params->missShaderBindingStride, params->hitShaderBindingTableBuffer, params->hitShaderBindingOffset, params->hitShaderBindingStride, params->callableShaderBindingTableBuffer, params->callableShaderBindingOffset, params->callableShaderBindingStride, params->width, params->height, params->depth); -} - -#ifdef _WIN64 -static void thunk64_vkCmdUpdateBuffer(void *args) -{ - struct vkCmdUpdateBuffer_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdUpdateBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->dstBuffer, params->dstOffset, params->dataSize, params->pData); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdUpdateBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - VkDeviceSize DECLSPEC_ALIGN(8) dataSize; - PTR32 pData; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdUpdateBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->dstBuffer, params->dstOffset, params->dataSize, (const void *)UlongToPtr(params->pData)); -} - -#ifdef _WIN64 -static void thunk64_vkCmdUpdatePipelineIndirectBufferNV(void *args) -{ - struct vkCmdUpdatePipelineIndirectBufferNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdUpdatePipelineIndirectBufferNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineBindPoint, params->pipeline); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdUpdatePipelineIndirectBufferNV(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdUpdatePipelineIndirectBufferNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineBindPoint, params->pipeline); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWaitEvents(void *args) -{ - struct vkCmdWaitEvents_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWaitEvents(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->eventCount, params->pEvents, params->srcStageMask, params->dstStageMask, params->memoryBarrierCount, params->pMemoryBarriers, params->bufferMemoryBarrierCount, params->pBufferMemoryBarriers, params->imageMemoryBarrierCount, params->pImageMemoryBarriers); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWaitEvents(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t eventCount; - PTR32 pEvents; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - uint32_t memoryBarrierCount; - PTR32 pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - PTR32 pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - PTR32 pImageMemoryBarriers; - } *params = args; - const VkMemoryBarrier *pMemoryBarriers_host; - const VkBufferMemoryBarrier *pBufferMemoryBarriers_host; - const VkImageMemoryBarrier *pImageMemoryBarriers_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pMemoryBarriers_host = convert_VkMemoryBarrier_array_win32_to_host(ctx, (const VkMemoryBarrier32 *)UlongToPtr(params->pMemoryBarriers), params->memoryBarrierCount); - pBufferMemoryBarriers_host = convert_VkBufferMemoryBarrier_array_win32_to_host(ctx, (const VkBufferMemoryBarrier32 *)UlongToPtr(params->pBufferMemoryBarriers), params->bufferMemoryBarrierCount); - pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win32_to_host(ctx, (const VkImageMemoryBarrier32 *)UlongToPtr(params->pImageMemoryBarriers), params->imageMemoryBarrierCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWaitEvents(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->eventCount, (const VkEvent *)UlongToPtr(params->pEvents), params->srcStageMask, params->dstStageMask, params->memoryBarrierCount, pMemoryBarriers_host, params->bufferMemoryBarrierCount, pBufferMemoryBarriers_host, params->imageMemoryBarrierCount, pImageMemoryBarriers_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWaitEvents2(void *args) -{ - struct vkCmdWaitEvents2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWaitEvents2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->eventCount, params->pEvents, params->pDependencyInfos); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWaitEvents2(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t eventCount; - PTR32 pEvents; - PTR32 pDependencyInfos; - } *params = args; - const VkDependencyInfo *pDependencyInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pDependencyInfos_host = convert_VkDependencyInfo_array_win32_to_host(ctx, (const VkDependencyInfo32 *)UlongToPtr(params->pDependencyInfos), params->eventCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWaitEvents2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->eventCount, (const VkEvent *)UlongToPtr(params->pEvents), pDependencyInfos_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWaitEvents2KHR(void *args) -{ - struct vkCmdWaitEvents2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWaitEvents2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->eventCount, params->pEvents, params->pDependencyInfos); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWaitEvents2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t eventCount; - PTR32 pEvents; - PTR32 pDependencyInfos; - } *params = args; - const VkDependencyInfo *pDependencyInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pDependencyInfos_host = convert_VkDependencyInfo_array_win32_to_host(ctx, (const VkDependencyInfo32 *)UlongToPtr(params->pDependencyInfos), params->eventCount); - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWaitEvents2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->eventCount, (const VkEvent *)UlongToPtr(params->pEvents), pDependencyInfos_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteAccelerationStructuresPropertiesKHR(void *args) -{ - struct vkCmdWriteAccelerationStructuresPropertiesKHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteAccelerationStructuresPropertiesKHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->accelerationStructureCount, params->pAccelerationStructures, params->queryType, params->queryPool, params->firstQuery); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteAccelerationStructuresPropertiesKHR(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t accelerationStructureCount; - PTR32 pAccelerationStructures; - VkQueryType queryType; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteAccelerationStructuresPropertiesKHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->accelerationStructureCount, (const VkAccelerationStructureKHR *)UlongToPtr(params->pAccelerationStructures), params->queryType, params->queryPool, params->firstQuery); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteAccelerationStructuresPropertiesNV(void *args) -{ - struct vkCmdWriteAccelerationStructuresPropertiesNV_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteAccelerationStructuresPropertiesNV(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->accelerationStructureCount, params->pAccelerationStructures, params->queryType, params->queryPool, params->firstQuery); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteAccelerationStructuresPropertiesNV(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t accelerationStructureCount; - PTR32 pAccelerationStructures; - VkQueryType queryType; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteAccelerationStructuresPropertiesNV(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->accelerationStructureCount, (const VkAccelerationStructureNV *)UlongToPtr(params->pAccelerationStructures), params->queryType, params->queryPool, params->firstQuery); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteBufferMarker2AMD(void *args) -{ - struct vkCmdWriteBufferMarker2AMD_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteBufferMarker2AMD(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stage, params->dstBuffer, params->dstOffset, params->marker); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteBufferMarker2AMD(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - uint32_t marker; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteBufferMarker2AMD(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stage, params->dstBuffer, params->dstOffset, params->marker); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteBufferMarkerAMD(void *args) -{ - struct vkCmdWriteBufferMarkerAMD_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteBufferMarkerAMD(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineStage, params->dstBuffer, params->dstOffset, params->marker); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteBufferMarkerAMD(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineStageFlagBits pipelineStage; - VkBuffer DECLSPEC_ALIGN(8) dstBuffer; - VkDeviceSize DECLSPEC_ALIGN(8) dstOffset; - uint32_t marker; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteBufferMarkerAMD(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineStage, params->dstBuffer, params->dstOffset, params->marker); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteMicromapsPropertiesEXT(void *args) -{ - struct vkCmdWriteMicromapsPropertiesEXT_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteMicromapsPropertiesEXT(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->micromapCount, params->pMicromaps, params->queryType, params->queryPool, params->firstQuery); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteMicromapsPropertiesEXT(void *args) -{ - struct - { - PTR32 commandBuffer; - uint32_t micromapCount; - PTR32 pMicromaps; - VkQueryType queryType; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteMicromapsPropertiesEXT(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->micromapCount, (const VkMicromapEXT *)UlongToPtr(params->pMicromaps), params->queryType, params->queryPool, params->firstQuery); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteTimestamp(void *args) -{ - struct vkCmdWriteTimestamp_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteTimestamp(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->pipelineStage, params->queryPool, params->query); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteTimestamp(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineStageFlagBits pipelineStage; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteTimestamp(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->pipelineStage, params->queryPool, params->query); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteTimestamp2(void *args) -{ - struct vkCmdWriteTimestamp2_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteTimestamp2(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stage, params->queryPool, params->query); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteTimestamp2(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteTimestamp2(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stage, params->queryPool, params->query); -} - -#ifdef _WIN64 -static void thunk64_vkCmdWriteTimestamp2KHR(void *args) -{ - struct vkCmdWriteTimestamp2KHR_params *params = args; - - wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkCmdWriteTimestamp2KHR(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->stage, params->queryPool, params->query); -} -#endif /* _WIN64 */ - -static void thunk32_vkCmdWriteTimestamp2KHR(void *args) -{ - struct - { - PTR32 commandBuffer; - VkPipelineStageFlags2 DECLSPEC_ALIGN(8) stage; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t query; - } *params = args; - - wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkCmdWriteTimestamp2KHR(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->stage, params->queryPool, params->query); -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCompileDeferredNV(void *args) -{ - struct vkCompileDeferredNV_params *params = args; - - TRACE("%p, 0x%s, %u\n", params->device, wine_dbgstr_longlong(params->pipeline), params->shader); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCompileDeferredNV(wine_device_from_handle(params->device)->host_device, params->pipeline, params->shader); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCompileDeferredNV(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t shader; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u\n", params->device, wine_dbgstr_longlong(params->pipeline), params->shader); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCompileDeferredNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, params->shader); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyAccelerationStructureKHR(void *args) -{ - struct vkCopyAccelerationStructureKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyAccelerationStructureKHR(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyAccelerationStructureKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - PTR32 pInfo; - VkResult result; - } *params = args; - VkCopyAccelerationStructureInfoKHR pInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - convert_VkCopyAccelerationStructureInfoKHR_win32_to_host((const VkCopyAccelerationStructureInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyAccelerationStructureKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyAccelerationStructureToMemoryKHR(void *args) -{ - struct vkCopyAccelerationStructureToMemoryKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyAccelerationStructureToMemoryKHR(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyAccelerationStructureToMemoryKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - PTR32 pInfo; - VkResult result; - } *params = args; - VkCopyAccelerationStructureToMemoryInfoKHR pInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - convert_VkCopyAccelerationStructureToMemoryInfoKHR_win32_to_host((const VkCopyAccelerationStructureToMemoryInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyAccelerationStructureToMemoryKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyImageToImageEXT(void *args) -{ - struct vkCopyImageToImageEXT_params *params = args; - - TRACE("%p, %p\n", params->device, params->pCopyImageToImageInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyImageToImageEXT(wine_device_from_handle(params->device)->host_device, params->pCopyImageToImageInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyImageToImageEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCopyImageToImageInfo; - VkResult result; - } *params = args; - VkCopyImageToImageInfoEXT pCopyImageToImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->device, params->pCopyImageToImageInfo); - - init_conversion_context(ctx); - convert_VkCopyImageToImageInfoEXT_win32_to_host(ctx, (const VkCopyImageToImageInfoEXT32 *)UlongToPtr(params->pCopyImageToImageInfo), &pCopyImageToImageInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyImageToImageEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCopyImageToImageInfo_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyImageToMemoryEXT(void *args) -{ - struct vkCopyImageToMemoryEXT_params *params = args; - - TRACE("%p, %p\n", params->device, params->pCopyImageToMemoryInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyImageToMemoryEXT(wine_device_from_handle(params->device)->host_device, params->pCopyImageToMemoryInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyImageToMemoryEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCopyImageToMemoryInfo; - VkResult result; - } *params = args; - VkCopyImageToMemoryInfoEXT pCopyImageToMemoryInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->device, params->pCopyImageToMemoryInfo); - - init_conversion_context(ctx); - convert_VkCopyImageToMemoryInfoEXT_win32_to_host(ctx, (const VkCopyImageToMemoryInfoEXT32 *)UlongToPtr(params->pCopyImageToMemoryInfo), &pCopyImageToMemoryInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyImageToMemoryEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCopyImageToMemoryInfo_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyMemoryToAccelerationStructureKHR(void *args) -{ - struct vkCopyMemoryToAccelerationStructureKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyMemoryToAccelerationStructureKHR(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyMemoryToAccelerationStructureKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - PTR32 pInfo; - VkResult result; - } *params = args; - VkCopyMemoryToAccelerationStructureInfoKHR pInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - convert_VkCopyMemoryToAccelerationStructureInfoKHR_win32_to_host((const VkCopyMemoryToAccelerationStructureInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyMemoryToAccelerationStructureKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyMemoryToImageEXT(void *args) -{ - struct vkCopyMemoryToImageEXT_params *params = args; - - TRACE("%p, %p\n", params->device, params->pCopyMemoryToImageInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyMemoryToImageEXT(wine_device_from_handle(params->device)->host_device, params->pCopyMemoryToImageInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyMemoryToImageEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCopyMemoryToImageInfo; - VkResult result; - } *params = args; - VkCopyMemoryToImageInfoEXT pCopyMemoryToImageInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->device, params->pCopyMemoryToImageInfo); - - init_conversion_context(ctx); - convert_VkCopyMemoryToImageInfoEXT_win32_to_host(ctx, (const VkCopyMemoryToImageInfoEXT32 *)UlongToPtr(params->pCopyMemoryToImageInfo), &pCopyMemoryToImageInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyMemoryToImageEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCopyMemoryToImageInfo_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyMemoryToMicromapEXT(void *args) -{ - struct vkCopyMemoryToMicromapEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyMemoryToMicromapEXT(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyMemoryToMicromapEXT(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - PTR32 pInfo; - VkResult result; - } *params = args; - VkCopyMemoryToMicromapInfoEXT pInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - convert_VkCopyMemoryToMicromapInfoEXT_win32_to_host((const VkCopyMemoryToMicromapInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyMemoryToMicromapEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyMicromapEXT(void *args) -{ - struct vkCopyMicromapEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyMicromapEXT(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyMicromapEXT(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - PTR32 pInfo; - VkResult result; - } *params = args; - VkCopyMicromapInfoEXT pInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - convert_VkCopyMicromapInfoEXT_win32_to_host((const VkCopyMicromapInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyMicromapEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCopyMicromapToMemoryEXT(void *args) -{ - struct vkCopyMicromapToMemoryEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCopyMicromapToMemoryEXT(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCopyMicromapToMemoryEXT(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - PTR32 pInfo; - VkResult result; - } *params = args; - VkCopyMicromapToMemoryInfoEXT pInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), params->pInfo); - - convert_VkCopyMicromapToMemoryInfoEXT_win32_to_host((const VkCopyMicromapToMemoryInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCopyMicromapToMemoryEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateAccelerationStructureKHR(void *args) -{ - struct vkCreateAccelerationStructureKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pAccelerationStructure); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateAccelerationStructureKHR(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pAccelerationStructure); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateAccelerationStructureKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pAccelerationStructure; - VkResult result; - } *params = args; - VkAccelerationStructureCreateInfoKHR pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pAccelerationStructure); - - init_conversion_context(ctx); - convert_VkAccelerationStructureCreateInfoKHR_win32_to_host(ctx, (const VkAccelerationStructureCreateInfoKHR32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateAccelerationStructureKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkAccelerationStructureKHR *)UlongToPtr(params->pAccelerationStructure)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateAccelerationStructureNV(void *args) -{ - struct vkCreateAccelerationStructureNV_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pAccelerationStructure); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateAccelerationStructureNV(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pAccelerationStructure); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateAccelerationStructureNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pAccelerationStructure; - VkResult result; - } *params = args; - VkAccelerationStructureCreateInfoNV pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pAccelerationStructure); - - init_conversion_context(ctx); - convert_VkAccelerationStructureCreateInfoNV_win32_to_host(ctx, (const VkAccelerationStructureCreateInfoNV32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateAccelerationStructureNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkAccelerationStructureNV *)UlongToPtr(params->pAccelerationStructure)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateBuffer(void *args) -{ - struct vkCreateBuffer_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pBuffer); - - params->result = wine_vkCreateBuffer(params->device, params->pCreateInfo, params->pAllocator, params->pBuffer); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateBuffer(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pBuffer; - VkResult result; - } *params = args; - VkBufferCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pBuffer); - - init_conversion_context(ctx); - convert_VkBufferCreateInfo_win32_to_host(ctx, (const VkBufferCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateBuffer((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkBuffer *)UlongToPtr(params->pBuffer)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateBufferView(void *args) -{ - struct vkCreateBufferView_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pView); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateBufferView(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pView); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateBufferView(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pView; - VkResult result; - } *params = args; - VkBufferViewCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pView); - - init_conversion_context(ctx); - convert_VkBufferViewCreateInfo_win32_to_host(ctx, (const VkBufferViewCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateBufferView(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkBufferView *)UlongToPtr(params->pView)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateCommandPool(void *args) -{ - struct vkCreateCommandPool_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pCommandPool); - - params->result = wine_vkCreateCommandPool(params->device, params->pCreateInfo, params->pAllocator, params->pCommandPool, params->client_ptr); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateCommandPool(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pCommandPool; - PTR32 client_ptr; - VkResult result; - } *params = args; - VkCommandPoolCreateInfo pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pCommandPool); - - convert_VkCommandPoolCreateInfo_win32_to_host((const VkCommandPoolCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateCommandPool((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkCommandPool *)UlongToPtr(params->pCommandPool), UlongToPtr(params->client_ptr)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateComputePipelines(void *args) -{ - struct vkCreateComputePipelines_params *params = args; - const VkComputePipelineCreateInfo *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, 0x%s, %u, %p, %p, %p\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkComputePipelineCreateInfo_array_win64_to_host(ctx, params->pCreateInfos, params->createInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateComputePipelines(wine_device_from_handle(params->device)->host_device, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, params->pPipelines); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateComputePipelines(void *args) -{ - struct - { - PTR32 device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - PTR32 pCreateInfos; - PTR32 pAllocator; - PTR32 pPipelines; - VkResult result; - } *params = args; - const VkComputePipelineCreateInfo *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %u, %#x, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkComputePipelineCreateInfo_array_win32_to_host(ctx, (const VkComputePipelineCreateInfo32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateComputePipelines(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, (VkPipeline *)UlongToPtr(params->pPipelines)); - convert_VkComputePipelineCreateInfo_array_host_to_win32(pCreateInfos_host, (const VkComputePipelineCreateInfo32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateCuFunctionNVX(void *args) -{ - struct vkCreateCuFunctionNVX_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pFunction); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateCuFunctionNVX(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pFunction); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateCuFunctionNVX(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pFunction; - VkResult result; - } *params = args; - VkCuFunctionCreateInfoNVX pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pFunction); - - convert_VkCuFunctionCreateInfoNVX_win32_to_host((const VkCuFunctionCreateInfoNVX32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateCuFunctionNVX(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkCuFunctionNVX *)UlongToPtr(params->pFunction)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateCuModuleNVX(void *args) -{ - struct vkCreateCuModuleNVX_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pModule); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateCuModuleNVX(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pModule); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateCuModuleNVX(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pModule; - VkResult result; - } *params = args; - VkCuModuleCreateInfoNVX pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pModule); - - convert_VkCuModuleCreateInfoNVX_win32_to_host((const VkCuModuleCreateInfoNVX32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateCuModuleNVX(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkCuModuleNVX *)UlongToPtr(params->pModule)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateCudaFunctionNV(void *args) -{ - struct vkCreateCudaFunctionNV_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pFunction); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateCudaFunctionNV(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pFunction); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateCudaFunctionNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pFunction; - VkResult result; - } *params = args; - VkCudaFunctionCreateInfoNV pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pFunction); - - convert_VkCudaFunctionCreateInfoNV_win32_to_host((const VkCudaFunctionCreateInfoNV32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateCudaFunctionNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkCudaFunctionNV *)UlongToPtr(params->pFunction)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateCudaModuleNV(void *args) -{ - struct vkCreateCudaModuleNV_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pModule); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateCudaModuleNV(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pModule); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateCudaModuleNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pModule; - VkResult result; - } *params = args; - VkCudaModuleCreateInfoNV pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pModule); - - convert_VkCudaModuleCreateInfoNV_win32_to_host((const VkCudaModuleCreateInfoNV32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateCudaModuleNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkCudaModuleNV *)UlongToPtr(params->pModule)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDebugReportCallbackEXT(void *args) -{ - struct vkCreateDebugReportCallbackEXT_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->instance, params->pCreateInfo, params->pAllocator, params->pCallback); - - params->result = wine_vkCreateDebugReportCallbackEXT(params->instance, params->pCreateInfo, params->pAllocator, params->pCallback); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDebugReportCallbackEXT(void *args) -{ - struct - { - PTR32 instance; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pCallback; - VkResult result; - } *params = args; - VkDebugReportCallbackCreateInfoEXT pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->instance, params->pCreateInfo, params->pAllocator, params->pCallback); - - convert_VkDebugReportCallbackCreateInfoEXT_win32_to_host((const VkDebugReportCallbackCreateInfoEXT32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateDebugReportCallbackEXT((VkInstance)UlongToPtr(params->instance), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkDebugReportCallbackEXT *)UlongToPtr(params->pCallback)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDebugUtilsMessengerEXT(void *args) -{ - struct vkCreateDebugUtilsMessengerEXT_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->instance, params->pCreateInfo, params->pAllocator, params->pMessenger); - - params->result = wine_vkCreateDebugUtilsMessengerEXT(params->instance, params->pCreateInfo, params->pAllocator, params->pMessenger); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDebugUtilsMessengerEXT(void *args) -{ - struct - { - PTR32 instance; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pMessenger; - VkResult result; - } *params = args; - VkDebugUtilsMessengerCreateInfoEXT pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->instance, params->pCreateInfo, params->pAllocator, params->pMessenger); - - convert_VkDebugUtilsMessengerCreateInfoEXT_win32_to_host((const VkDebugUtilsMessengerCreateInfoEXT32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateDebugUtilsMessengerEXT((VkInstance)UlongToPtr(params->instance), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkDebugUtilsMessengerEXT *)UlongToPtr(params->pMessenger)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDeferredOperationKHR(void *args) -{ - struct vkCreateDeferredOperationKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pAllocator, params->pDeferredOperation); - - params->result = wine_vkCreateDeferredOperationKHR(params->device, params->pAllocator, params->pDeferredOperation); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDeferredOperationKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pAllocator; - PTR32 pDeferredOperation; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, %#x\n", params->device, params->pAllocator, params->pDeferredOperation); - - params->result = wine_vkCreateDeferredOperationKHR((VkDevice)UlongToPtr(params->device), (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkDeferredOperationKHR *)UlongToPtr(params->pDeferredOperation)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDescriptorPool(void *args) -{ - struct vkCreateDescriptorPool_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pDescriptorPool); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateDescriptorPool(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pDescriptorPool); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDescriptorPool(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pDescriptorPool; - VkResult result; - } *params = args; - VkDescriptorPoolCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pDescriptorPool); - - init_conversion_context(ctx); - convert_VkDescriptorPoolCreateInfo_win32_to_host(ctx, (const VkDescriptorPoolCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateDescriptorPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkDescriptorPool *)UlongToPtr(params->pDescriptorPool)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDescriptorSetLayout(void *args) -{ - struct vkCreateDescriptorSetLayout_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pSetLayout); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateDescriptorSetLayout(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pSetLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDescriptorSetLayout(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pSetLayout; - VkResult result; - } *params = args; - VkDescriptorSetLayoutCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pSetLayout); - - init_conversion_context(ctx); - convert_VkDescriptorSetLayoutCreateInfo_win32_to_host(ctx, (const VkDescriptorSetLayoutCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateDescriptorSetLayout(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkDescriptorSetLayout *)UlongToPtr(params->pSetLayout)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDescriptorUpdateTemplate(void *args) -{ - struct vkCreateDescriptorUpdateTemplate_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pDescriptorUpdateTemplate); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateDescriptorUpdateTemplate(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pDescriptorUpdateTemplate); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDescriptorUpdateTemplate(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pDescriptorUpdateTemplate; - VkResult result; - } *params = args; - VkDescriptorUpdateTemplateCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pDescriptorUpdateTemplate); - - init_conversion_context(ctx); - convert_VkDescriptorUpdateTemplateCreateInfo_win32_to_host(ctx, (const VkDescriptorUpdateTemplateCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateDescriptorUpdateTemplate(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkDescriptorUpdateTemplate *)UlongToPtr(params->pDescriptorUpdateTemplate)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDescriptorUpdateTemplateKHR(void *args) -{ - struct vkCreateDescriptorUpdateTemplateKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pDescriptorUpdateTemplate); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateDescriptorUpdateTemplateKHR(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pDescriptorUpdateTemplate); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDescriptorUpdateTemplateKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pDescriptorUpdateTemplate; - VkResult result; - } *params = args; - VkDescriptorUpdateTemplateCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pDescriptorUpdateTemplate); - - init_conversion_context(ctx); - convert_VkDescriptorUpdateTemplateCreateInfo_win32_to_host(ctx, (const VkDescriptorUpdateTemplateCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateDescriptorUpdateTemplateKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkDescriptorUpdateTemplate *)UlongToPtr(params->pDescriptorUpdateTemplate)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateDevice(void *args) -{ - struct vkCreateDevice_params *params = args; - VkDeviceCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %p, %p, %p\n", params->physicalDevice, params->pCreateInfo, params->pAllocator, params->pDevice); - - init_conversion_context(ctx); - convert_VkDeviceCreateInfo_win64_to_host(ctx, params->pCreateInfo, &pCreateInfo_host); - params->result = wine_vkCreateDevice(params->physicalDevice, &pCreateInfo_host, params->pAllocator, params->pDevice, params->client_ptr); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateDevice(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pDevice; - PTR32 client_ptr; - VkResult result; - } *params = args; - VkDeviceCreateInfo pCreateInfo_host; - VkDevice pDevice_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->physicalDevice, params->pCreateInfo, params->pAllocator, params->pDevice); - - init_conversion_context(ctx); - convert_VkDeviceCreateInfo_win32_to_host(ctx, (const VkDeviceCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - pDevice_host = UlongToPtr(*(PTR32 *)UlongToPtr(params->pDevice)); - params->result = wine_vkCreateDevice((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), &pDevice_host, UlongToPtr(params->client_ptr)); - *(PTR32 *)UlongToPtr(params->pDevice) = PtrToUlong(pDevice_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateEvent(void *args) -{ - struct vkCreateEvent_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pEvent); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateEvent(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pEvent); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateEvent(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pEvent; - VkResult result; - } *params = args; - VkEventCreateInfo pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pEvent); - - convert_VkEventCreateInfo_win32_to_host((const VkEventCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateEvent(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkEvent *)UlongToPtr(params->pEvent)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateFence(void *args) -{ - struct vkCreateFence_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pFence); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateFence(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pFence); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateFence(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pFence; - VkResult result; - } *params = args; - VkFenceCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pFence); - - init_conversion_context(ctx); - convert_VkFenceCreateInfo_win32_to_host(ctx, (const VkFenceCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateFence(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkFence *)UlongToPtr(params->pFence)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateFramebuffer(void *args) -{ - struct vkCreateFramebuffer_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pFramebuffer); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateFramebuffer(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pFramebuffer); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateFramebuffer(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pFramebuffer; - VkResult result; - } *params = args; - VkFramebufferCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pFramebuffer); - - init_conversion_context(ctx); - convert_VkFramebufferCreateInfo_win32_to_host(ctx, (const VkFramebufferCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateFramebuffer(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkFramebuffer *)UlongToPtr(params->pFramebuffer)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateGraphicsPipelines(void *args) -{ - struct vkCreateGraphicsPipelines_params *params = args; - const VkGraphicsPipelineCreateInfo *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, 0x%s, %u, %p, %p, %p\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkGraphicsPipelineCreateInfo_array_win64_to_host(ctx, params->pCreateInfos, params->createInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateGraphicsPipelines(wine_device_from_handle(params->device)->host_device, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, params->pPipelines); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateGraphicsPipelines(void *args) -{ - struct - { - PTR32 device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - PTR32 pCreateInfos; - PTR32 pAllocator; - PTR32 pPipelines; - VkResult result; - } *params = args; - const VkGraphicsPipelineCreateInfo *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %u, %#x, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkGraphicsPipelineCreateInfo_array_win32_to_host(ctx, (const VkGraphicsPipelineCreateInfo32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateGraphicsPipelines(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, (VkPipeline *)UlongToPtr(params->pPipelines)); - convert_VkGraphicsPipelineCreateInfo_array_host_to_win32(pCreateInfos_host, (const VkGraphicsPipelineCreateInfo32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateImage(void *args) -{ - struct vkCreateImage_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pImage); - - params->result = wine_vkCreateImage(params->device, params->pCreateInfo, params->pAllocator, params->pImage); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateImage(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pImage; - VkResult result; - } *params = args; - VkImageCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pImage); - - init_conversion_context(ctx); - convert_VkImageCreateInfo_win32_to_host(ctx, (const VkImageCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateImage((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkImage *)UlongToPtr(params->pImage)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateImageView(void *args) -{ - struct vkCreateImageView_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pView); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateImageView(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pView); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateImageView(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pView; - VkResult result; - } *params = args; - VkImageViewCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pView); - - init_conversion_context(ctx); - convert_VkImageViewCreateInfo_win32_to_host(ctx, (const VkImageViewCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateImageView(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkImageView *)UlongToPtr(params->pView)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateIndirectCommandsLayoutNV(void *args) -{ - struct vkCreateIndirectCommandsLayoutNV_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pIndirectCommandsLayout); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateIndirectCommandsLayoutNV(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pIndirectCommandsLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateIndirectCommandsLayoutNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pIndirectCommandsLayout; - VkResult result; - } *params = args; - VkIndirectCommandsLayoutCreateInfoNV pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pIndirectCommandsLayout); - - init_conversion_context(ctx); - convert_VkIndirectCommandsLayoutCreateInfoNV_win32_to_host(ctx, (const VkIndirectCommandsLayoutCreateInfoNV32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateIndirectCommandsLayoutNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkIndirectCommandsLayoutNV *)UlongToPtr(params->pIndirectCommandsLayout)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateInstance(void *args) -{ - struct vkCreateInstance_params *params = args; - VkInstanceCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %p, %p\n", params->pCreateInfo, params->pAllocator, params->pInstance); - - init_conversion_context(ctx); - convert_VkInstanceCreateInfo_win64_to_host(ctx, params->pCreateInfo, &pCreateInfo_host); - params->result = wine_vkCreateInstance(&pCreateInfo_host, params->pAllocator, params->pInstance, params->client_ptr); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateInstance(void *args) -{ - struct - { - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pInstance; - PTR32 client_ptr; - VkResult result; - } *params = args; - VkInstanceCreateInfo pCreateInfo_host; - VkInstance pInstance_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->pCreateInfo, params->pAllocator, params->pInstance); - - init_conversion_context(ctx); - convert_VkInstanceCreateInfo_win32_to_host(ctx, (const VkInstanceCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - pInstance_host = UlongToPtr(*(PTR32 *)UlongToPtr(params->pInstance)); - params->result = wine_vkCreateInstance(&pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), &pInstance_host, UlongToPtr(params->client_ptr)); - *(PTR32 *)UlongToPtr(params->pInstance) = PtrToUlong(pInstance_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateMicromapEXT(void *args) -{ - struct vkCreateMicromapEXT_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pMicromap); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateMicromapEXT(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pMicromap); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateMicromapEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pMicromap; - VkResult result; - } *params = args; - VkMicromapCreateInfoEXT pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pMicromap); - - convert_VkMicromapCreateInfoEXT_win32_to_host((const VkMicromapCreateInfoEXT32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateMicromapEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkMicromapEXT *)UlongToPtr(params->pMicromap)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateOpticalFlowSessionNV(void *args) -{ - struct vkCreateOpticalFlowSessionNV_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pSession); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateOpticalFlowSessionNV(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pSession); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateOpticalFlowSessionNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pSession; - VkResult result; - } *params = args; - VkOpticalFlowSessionCreateInfoNV pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pSession); - - init_conversion_context(ctx); - convert_VkOpticalFlowSessionCreateInfoNV_win32_to_host(ctx, (const VkOpticalFlowSessionCreateInfoNV32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateOpticalFlowSessionNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkOpticalFlowSessionNV *)UlongToPtr(params->pSession)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreatePipelineCache(void *args) -{ - struct vkCreatePipelineCache_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pPipelineCache); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreatePipelineCache(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pPipelineCache); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreatePipelineCache(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pPipelineCache; - VkResult result; - } *params = args; - VkPipelineCacheCreateInfo pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pPipelineCache); - - convert_VkPipelineCacheCreateInfo_win32_to_host((const VkPipelineCacheCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreatePipelineCache(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkPipelineCache *)UlongToPtr(params->pPipelineCache)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreatePipelineLayout(void *args) -{ - struct vkCreatePipelineLayout_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pPipelineLayout); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreatePipelineLayout(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pPipelineLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreatePipelineLayout(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pPipelineLayout; - VkResult result; - } *params = args; - VkPipelineLayoutCreateInfo pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pPipelineLayout); - - convert_VkPipelineLayoutCreateInfo_win32_to_host((const VkPipelineLayoutCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreatePipelineLayout(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkPipelineLayout *)UlongToPtr(params->pPipelineLayout)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreatePrivateDataSlot(void *args) -{ - struct vkCreatePrivateDataSlot_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pPrivateDataSlot); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreatePrivateDataSlot(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pPrivateDataSlot); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreatePrivateDataSlot(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pPrivateDataSlot; - VkResult result; - } *params = args; - VkPrivateDataSlotCreateInfo pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pPrivateDataSlot); - - convert_VkPrivateDataSlotCreateInfo_win32_to_host((const VkPrivateDataSlotCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreatePrivateDataSlot(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkPrivateDataSlot *)UlongToPtr(params->pPrivateDataSlot)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreatePrivateDataSlotEXT(void *args) -{ - struct vkCreatePrivateDataSlotEXT_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pPrivateDataSlot); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreatePrivateDataSlotEXT(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pPrivateDataSlot); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreatePrivateDataSlotEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pPrivateDataSlot; - VkResult result; - } *params = args; - VkPrivateDataSlotCreateInfo pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pPrivateDataSlot); - - convert_VkPrivateDataSlotCreateInfo_win32_to_host((const VkPrivateDataSlotCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreatePrivateDataSlotEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkPrivateDataSlot *)UlongToPtr(params->pPrivateDataSlot)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateQueryPool(void *args) -{ - struct vkCreateQueryPool_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pQueryPool); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateQueryPool(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pQueryPool); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateQueryPool(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pQueryPool; - VkResult result; - } *params = args; - VkQueryPoolCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pQueryPool); - - init_conversion_context(ctx); - convert_VkQueryPoolCreateInfo_win32_to_host(ctx, (const VkQueryPoolCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateQueryPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkQueryPool *)UlongToPtr(params->pQueryPool)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateRayTracingPipelinesKHR(void *args) -{ - struct vkCreateRayTracingPipelinesKHR_params *params = args; - const VkRayTracingPipelineCreateInfoKHR *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, 0x%s, 0x%s, %u, %p, %p, %p\n", params->device, wine_dbgstr_longlong(params->deferredOperation), wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - if (params->deferredOperation == VK_NULL_HANDLE) - init_conversion_context(ctx); - else - ctx = &wine_deferred_operation_from_handle(params->deferredOperation)->ctx; - pCreateInfos_host = convert_VkRayTracingPipelineCreateInfoKHR_array_win64_to_host(ctx, params->pCreateInfos, params->createInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateRayTracingPipelinesKHR(wine_device_from_handle(params->device)->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, params->pPipelines); - if (params->deferredOperation == VK_NULL_HANDLE) - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateRayTracingPipelinesKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) deferredOperation; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - PTR32 pCreateInfos; - PTR32 pAllocator; - PTR32 pPipelines; - VkResult result; - } *params = args; - const VkRayTracingPipelineCreateInfoKHR *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, 0x%s, %u, %#x, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->deferredOperation), wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - if (params->deferredOperation == VK_NULL_HANDLE) - init_conversion_context(ctx); - else - ctx = &wine_deferred_operation_from_handle(params->deferredOperation)->ctx; - pCreateInfos_host = convert_VkRayTracingPipelineCreateInfoKHR_array_win32_to_host(ctx, (const VkRayTracingPipelineCreateInfoKHR32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateRayTracingPipelinesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->deferredOperation ? wine_deferred_operation_from_handle(params->deferredOperation)->host_deferred_operation : 0, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, (VkPipeline *)UlongToPtr(params->pPipelines)); - convert_VkRayTracingPipelineCreateInfoKHR_array_host_to_win32(pCreateInfos_host, (const VkRayTracingPipelineCreateInfoKHR32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - if (params->deferredOperation == VK_NULL_HANDLE) - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateRayTracingPipelinesNV(void *args) -{ - struct vkCreateRayTracingPipelinesNV_params *params = args; - const VkRayTracingPipelineCreateInfoNV *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, 0x%s, %u, %p, %p, %p\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkRayTracingPipelineCreateInfoNV_array_win64_to_host(ctx, params->pCreateInfos, params->createInfoCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateRayTracingPipelinesNV(wine_device_from_handle(params->device)->host_device, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, params->pPipelines); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateRayTracingPipelinesNV(void *args) -{ - struct - { - PTR32 device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - uint32_t createInfoCount; - PTR32 pCreateInfos; - PTR32 pAllocator; - PTR32 pPipelines; - VkResult result; - } *params = args; - const VkRayTracingPipelineCreateInfoNV *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %u, %#x, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pPipelines); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkRayTracingPipelineCreateInfoNV_array_win32_to_host(ctx, (const VkRayTracingPipelineCreateInfoNV32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateRayTracingPipelinesNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipelineCache, params->createInfoCount, pCreateInfos_host, NULL, (VkPipeline *)UlongToPtr(params->pPipelines)); - convert_VkRayTracingPipelineCreateInfoNV_array_host_to_win32(pCreateInfos_host, (const VkRayTracingPipelineCreateInfoNV32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateRenderPass(void *args) -{ - struct vkCreateRenderPass_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pRenderPass); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateRenderPass(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pRenderPass); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateRenderPass(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pRenderPass; - VkResult result; - } *params = args; - VkRenderPassCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pRenderPass); - - init_conversion_context(ctx); - convert_VkRenderPassCreateInfo_win32_to_host(ctx, (const VkRenderPassCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateRenderPass(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkRenderPass *)UlongToPtr(params->pRenderPass)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateRenderPass2(void *args) -{ - struct vkCreateRenderPass2_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pRenderPass); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateRenderPass2(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pRenderPass); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateRenderPass2(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pRenderPass; - VkResult result; - } *params = args; - VkRenderPassCreateInfo2 pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pRenderPass); - - init_conversion_context(ctx); - convert_VkRenderPassCreateInfo2_win32_to_host(ctx, (const VkRenderPassCreateInfo232 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateRenderPass2(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkRenderPass *)UlongToPtr(params->pRenderPass)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateRenderPass2KHR(void *args) -{ - struct vkCreateRenderPass2KHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pRenderPass); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateRenderPass2KHR(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pRenderPass); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateRenderPass2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pRenderPass; - VkResult result; - } *params = args; - VkRenderPassCreateInfo2 pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pRenderPass); - - init_conversion_context(ctx); - convert_VkRenderPassCreateInfo2_win32_to_host(ctx, (const VkRenderPassCreateInfo232 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateRenderPass2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkRenderPass *)UlongToPtr(params->pRenderPass)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateSampler(void *args) -{ - struct vkCreateSampler_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pSampler); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateSampler(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pSampler); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateSampler(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pSampler; - VkResult result; - } *params = args; - VkSamplerCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pSampler); - - init_conversion_context(ctx); - convert_VkSamplerCreateInfo_win32_to_host(ctx, (const VkSamplerCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateSampler(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkSampler *)UlongToPtr(params->pSampler)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateSamplerYcbcrConversion(void *args) -{ - struct vkCreateSamplerYcbcrConversion_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pYcbcrConversion); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateSamplerYcbcrConversion(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pYcbcrConversion); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateSamplerYcbcrConversion(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pYcbcrConversion; - VkResult result; - } *params = args; - VkSamplerYcbcrConversionCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pYcbcrConversion); - - init_conversion_context(ctx); - convert_VkSamplerYcbcrConversionCreateInfo_win32_to_host(ctx, (const VkSamplerYcbcrConversionCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateSamplerYcbcrConversion(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkSamplerYcbcrConversion *)UlongToPtr(params->pYcbcrConversion)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateSamplerYcbcrConversionKHR(void *args) -{ - struct vkCreateSamplerYcbcrConversionKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pYcbcrConversion); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateSamplerYcbcrConversionKHR(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pYcbcrConversion); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateSamplerYcbcrConversionKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pYcbcrConversion; - VkResult result; - } *params = args; - VkSamplerYcbcrConversionCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pYcbcrConversion); - - init_conversion_context(ctx); - convert_VkSamplerYcbcrConversionCreateInfo_win32_to_host(ctx, (const VkSamplerYcbcrConversionCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateSamplerYcbcrConversionKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkSamplerYcbcrConversion *)UlongToPtr(params->pYcbcrConversion)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateSemaphore(void *args) -{ - struct vkCreateSemaphore_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pSemaphore); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateSemaphore(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pSemaphore); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateSemaphore(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pSemaphore; - VkResult result; - } *params = args; - VkSemaphoreCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pSemaphore); - - init_conversion_context(ctx); - convert_VkSemaphoreCreateInfo_win32_to_host(ctx, (const VkSemaphoreCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateSemaphore(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkSemaphore *)UlongToPtr(params->pSemaphore)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateShaderModule(void *args) -{ - struct vkCreateShaderModule_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pShaderModule); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateShaderModule(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pShaderModule); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateShaderModule(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pShaderModule; - VkResult result; - } *params = args; - VkShaderModuleCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pShaderModule); - - init_conversion_context(ctx); - convert_VkShaderModuleCreateInfo_win32_to_host(ctx, (const VkShaderModuleCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateShaderModule(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkShaderModule *)UlongToPtr(params->pShaderModule)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateShadersEXT(void *args) -{ - struct vkCreateShadersEXT_params *params = args; - - TRACE("%p, %u, %p, %p, %p\n", params->device, params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pShaders); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateShadersEXT(wine_device_from_handle(params->device)->host_device, params->createInfoCount, params->pCreateInfos, NULL, params->pShaders); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateShadersEXT(void *args) -{ - struct - { - PTR32 device; - uint32_t createInfoCount; - PTR32 pCreateInfos; - PTR32 pAllocator; - PTR32 pShaders; - VkResult result; - } *params = args; - const VkShaderCreateInfoEXT *pCreateInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, %#x, %#x\n", params->device, params->createInfoCount, params->pCreateInfos, params->pAllocator, params->pShaders); - - init_conversion_context(ctx); - pCreateInfos_host = convert_VkShaderCreateInfoEXT_array_win32_to_host(ctx, (const VkShaderCreateInfoEXT32 *)UlongToPtr(params->pCreateInfos), params->createInfoCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateShadersEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->createInfoCount, pCreateInfos_host, NULL, (VkShaderEXT *)UlongToPtr(params->pShaders)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateSwapchainKHR(void *args) -{ - struct vkCreateSwapchainKHR_params *params = args; - VkSwapchainCreateInfoKHR pCreateInfo_host; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pSwapchain); - - convert_VkSwapchainCreateInfoKHR_win64_to_driver(params->pCreateInfo, &pCreateInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateSwapchainKHR(wine_device_from_handle(params->device)->host_device, &pCreateInfo_host, NULL, params->pSwapchain); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateSwapchainKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pSwapchain; - VkResult result; - } *params = args; - VkSwapchainCreateInfoKHR pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pSwapchain); - - init_conversion_context(ctx); - convert_VkSwapchainCreateInfoKHR_win32_to_driver(ctx, (const VkSwapchainCreateInfoKHR32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateSwapchainKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkSwapchainKHR *)UlongToPtr(params->pSwapchain)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateValidationCacheEXT(void *args) -{ - struct vkCreateValidationCacheEXT_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pValidationCache); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateValidationCacheEXT(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, NULL, params->pValidationCache); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateValidationCacheEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pValidationCache; - VkResult result; - } *params = args; - VkValidationCacheCreateInfoEXT pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pValidationCache); - - convert_VkValidationCacheCreateInfoEXT_win32_to_host((const VkValidationCacheCreateInfoEXT32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateValidationCacheEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkValidationCacheEXT *)UlongToPtr(params->pValidationCache)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkCreateWin32SurfaceKHR(void *args) -{ - struct vkCreateWin32SurfaceKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->instance, params->pCreateInfo, params->pAllocator, params->pSurface); - - params->result = wine_vkCreateWin32SurfaceKHR(params->instance, params->pCreateInfo, params->pAllocator, params->pSurface); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkCreateWin32SurfaceKHR(void *args) -{ - struct - { - PTR32 instance; - PTR32 pCreateInfo; - PTR32 pAllocator; - PTR32 pSurface; - VkResult result; - } *params = args; - VkWin32SurfaceCreateInfoKHR pCreateInfo_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->instance, params->pCreateInfo, params->pAllocator, params->pSurface); - - convert_VkWin32SurfaceCreateInfoKHR_win32_to_host((const VkWin32SurfaceCreateInfoKHR32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_vkCreateWin32SurfaceKHR((VkInstance)UlongToPtr(params->instance), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkSurfaceKHR *)UlongToPtr(params->pSurface)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDebugMarkerSetObjectNameEXT(void *args) -{ - struct vkDebugMarkerSetObjectNameEXT_params *params = args; - VkDebugMarkerObjectNameInfoEXT pNameInfo_host; - - TRACE("%p, %p\n", params->device, params->pNameInfo); - - convert_VkDebugMarkerObjectNameInfoEXT_win64_to_host(params->pNameInfo, &pNameInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkDebugMarkerSetObjectNameEXT(wine_device_from_handle(params->device)->host_device, &pNameInfo_host); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDebugMarkerSetObjectNameEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pNameInfo; - VkResult result; - } *params = args; - VkDebugMarkerObjectNameInfoEXT pNameInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pNameInfo); - - convert_VkDebugMarkerObjectNameInfoEXT_win32_to_host((const VkDebugMarkerObjectNameInfoEXT32 *)UlongToPtr(params->pNameInfo), &pNameInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDebugMarkerSetObjectNameEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pNameInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDebugMarkerSetObjectTagEXT(void *args) -{ - struct vkDebugMarkerSetObjectTagEXT_params *params = args; - VkDebugMarkerObjectTagInfoEXT pTagInfo_host; - - TRACE("%p, %p\n", params->device, params->pTagInfo); - - convert_VkDebugMarkerObjectTagInfoEXT_win64_to_host(params->pTagInfo, &pTagInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkDebugMarkerSetObjectTagEXT(wine_device_from_handle(params->device)->host_device, &pTagInfo_host); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDebugMarkerSetObjectTagEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pTagInfo; - VkResult result; - } *params = args; - VkDebugMarkerObjectTagInfoEXT pTagInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pTagInfo); - - convert_VkDebugMarkerObjectTagInfoEXT_win32_to_host((const VkDebugMarkerObjectTagInfoEXT32 *)UlongToPtr(params->pTagInfo), &pTagInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDebugMarkerSetObjectTagEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pTagInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDebugReportMessageEXT(void *args) -{ - struct vkDebugReportMessageEXT_params *params = args; - - TRACE("%p, %#x, %#x, 0x%s, 0x%s, %d, %p, %p\n", params->instance, params->flags, params->objectType, wine_dbgstr_longlong(params->object), wine_dbgstr_longlong(params->location), params->messageCode, params->pLayerPrefix, params->pMessage); - - wine_instance_from_handle(params->instance)->funcs.p_vkDebugReportMessageEXT(wine_instance_from_handle(params->instance)->host_instance, params->flags, params->objectType, wine_vk_unwrap_handle(params->objectType, params->object), params->location, params->messageCode, params->pLayerPrefix, params->pMessage); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDebugReportMessageEXT(void *args) -{ - struct - { - PTR32 instance; - VkDebugReportFlagsEXT flags; - VkDebugReportObjectTypeEXT objectType; - uint64_t DECLSPEC_ALIGN(8) object; - PTR32 location; - int32_t messageCode; - PTR32 pLayerPrefix; - PTR32 pMessage; - } *params = args; - - TRACE("%#x, %#x, %#x, 0x%s, 0x%s, %d, %#x, %#x\n", params->instance, params->flags, params->objectType, wine_dbgstr_longlong(params->object), wine_dbgstr_longlong(params->location), params->messageCode, params->pLayerPrefix, params->pMessage); - - wine_instance_from_handle((VkInstance)UlongToPtr(params->instance))->funcs.p_vkDebugReportMessageEXT(wine_instance_from_handle((VkInstance)UlongToPtr(params->instance))->host_instance, params->flags, params->objectType, wine_vk_unwrap_handle(params->objectType, params->object), params->location, params->messageCode, (const char *)UlongToPtr(params->pLayerPrefix), (const char *)UlongToPtr(params->pMessage)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDeferredOperationJoinKHR(void *args) -{ - struct vkDeferredOperationJoinKHR_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->operation)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkDeferredOperationJoinKHR(wine_device_from_handle(params->device)->host_device, wine_deferred_operation_from_handle(params->operation)->host_deferred_operation); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDeferredOperationJoinKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->operation)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDeferredOperationJoinKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_deferred_operation_from_handle(params->operation)->host_deferred_operation); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyAccelerationStructureKHR(void *args) -{ - struct vkDestroyAccelerationStructureKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->accelerationStructure), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyAccelerationStructureKHR(wine_device_from_handle(params->device)->host_device, params->accelerationStructure, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyAccelerationStructureKHR(void *args) -{ - struct - { - PTR32 device; - VkAccelerationStructureKHR DECLSPEC_ALIGN(8) accelerationStructure; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->accelerationStructure), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyAccelerationStructureKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->accelerationStructure, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyAccelerationStructureNV(void *args) -{ - struct vkDestroyAccelerationStructureNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->accelerationStructure), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyAccelerationStructureNV(wine_device_from_handle(params->device)->host_device, params->accelerationStructure, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyAccelerationStructureNV(void *args) -{ - struct - { - PTR32 device; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructure; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->accelerationStructure), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyAccelerationStructureNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->accelerationStructure, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyBuffer(void *args) -{ - struct vkDestroyBuffer_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->buffer), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyBuffer(wine_device_from_handle(params->device)->host_device, params->buffer, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyBuffer(void *args) -{ - struct - { - PTR32 device; - VkBuffer DECLSPEC_ALIGN(8) buffer; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->buffer), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyBuffer(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->buffer, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyBufferView(void *args) -{ - struct vkDestroyBufferView_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->bufferView), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyBufferView(wine_device_from_handle(params->device)->host_device, params->bufferView, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyBufferView(void *args) -{ - struct - { - PTR32 device; - VkBufferView DECLSPEC_ALIGN(8) bufferView; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->bufferView), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyBufferView(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->bufferView, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyCommandPool(void *args) -{ - struct vkDestroyCommandPool_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->commandPool), params->pAllocator); - - wine_vkDestroyCommandPool(params->device, params->commandPool, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyCommandPool(void *args) -{ - struct - { - PTR32 device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->pAllocator); - - wine_vkDestroyCommandPool((VkDevice)UlongToPtr(params->device), params->commandPool, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyCuFunctionNVX(void *args) -{ - struct vkDestroyCuFunctionNVX_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->function), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyCuFunctionNVX(wine_device_from_handle(params->device)->host_device, params->function, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyCuFunctionNVX(void *args) -{ - struct - { - PTR32 device; - VkCuFunctionNVX DECLSPEC_ALIGN(8) function; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->function), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyCuFunctionNVX(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->function, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyCuModuleNVX(void *args) -{ - struct vkDestroyCuModuleNVX_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->module), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyCuModuleNVX(wine_device_from_handle(params->device)->host_device, params->module, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyCuModuleNVX(void *args) -{ - struct - { - PTR32 device; - VkCuModuleNVX DECLSPEC_ALIGN(8) module; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->module), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyCuModuleNVX(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->module, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyCudaFunctionNV(void *args) -{ - struct vkDestroyCudaFunctionNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->function), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyCudaFunctionNV(wine_device_from_handle(params->device)->host_device, params->function, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyCudaFunctionNV(void *args) -{ - struct - { - PTR32 device; - VkCudaFunctionNV DECLSPEC_ALIGN(8) function; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->function), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyCudaFunctionNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->function, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyCudaModuleNV(void *args) -{ - struct vkDestroyCudaModuleNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->module), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyCudaModuleNV(wine_device_from_handle(params->device)->host_device, params->module, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyCudaModuleNV(void *args) -{ - struct - { - PTR32 device; - VkCudaModuleNV DECLSPEC_ALIGN(8) module; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->module), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyCudaModuleNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->module, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDebugReportCallbackEXT(void *args) -{ - struct vkDestroyDebugReportCallbackEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->instance, wine_dbgstr_longlong(params->callback), params->pAllocator); - - wine_vkDestroyDebugReportCallbackEXT(params->instance, params->callback, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDebugReportCallbackEXT(void *args) -{ - struct - { - PTR32 instance; - VkDebugReportCallbackEXT DECLSPEC_ALIGN(8) callback; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->instance, wine_dbgstr_longlong(params->callback), params->pAllocator); - - wine_vkDestroyDebugReportCallbackEXT((VkInstance)UlongToPtr(params->instance), params->callback, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDebugUtilsMessengerEXT(void *args) -{ - struct vkDestroyDebugUtilsMessengerEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->instance, wine_dbgstr_longlong(params->messenger), params->pAllocator); - - wine_vkDestroyDebugUtilsMessengerEXT(params->instance, params->messenger, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDebugUtilsMessengerEXT(void *args) -{ - struct - { - PTR32 instance; - VkDebugUtilsMessengerEXT DECLSPEC_ALIGN(8) messenger; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->instance, wine_dbgstr_longlong(params->messenger), params->pAllocator); - - wine_vkDestroyDebugUtilsMessengerEXT((VkInstance)UlongToPtr(params->instance), params->messenger, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDeferredOperationKHR(void *args) -{ - struct vkDestroyDeferredOperationKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->operation), params->pAllocator); - - wine_vkDestroyDeferredOperationKHR(params->device, params->operation, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDeferredOperationKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->operation), params->pAllocator); - - wine_vkDestroyDeferredOperationKHR((VkDevice)UlongToPtr(params->device), params->operation, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDescriptorPool(void *args) -{ - struct vkDestroyDescriptorPool_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->descriptorPool), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyDescriptorPool(wine_device_from_handle(params->device)->host_device, params->descriptorPool, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDescriptorPool(void *args) -{ - struct - { - PTR32 device; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorPool), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyDescriptorPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorPool, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDescriptorSetLayout(void *args) -{ - struct vkDestroyDescriptorSetLayout_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->descriptorSetLayout), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyDescriptorSetLayout(wine_device_from_handle(params->device)->host_device, params->descriptorSetLayout, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDescriptorSetLayout(void *args) -{ - struct - { - PTR32 device; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) descriptorSetLayout; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorSetLayout), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyDescriptorSetLayout(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorSetLayout, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDescriptorUpdateTemplate(void *args) -{ - struct vkDestroyDescriptorUpdateTemplate_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->descriptorUpdateTemplate), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyDescriptorUpdateTemplate(wine_device_from_handle(params->device)->host_device, params->descriptorUpdateTemplate, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDescriptorUpdateTemplate(void *args) -{ - struct - { - PTR32 device; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorUpdateTemplate), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyDescriptorUpdateTemplate(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorUpdateTemplate, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDescriptorUpdateTemplateKHR(void *args) -{ - struct vkDestroyDescriptorUpdateTemplateKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->descriptorUpdateTemplate), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyDescriptorUpdateTemplateKHR(wine_device_from_handle(params->device)->host_device, params->descriptorUpdateTemplate, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDescriptorUpdateTemplateKHR(void *args) -{ - struct - { - PTR32 device; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorUpdateTemplate), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyDescriptorUpdateTemplateKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorUpdateTemplate, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyDevice(void *args) -{ - struct vkDestroyDevice_params *params = args; - - TRACE("%p, %p\n", params->device, params->pAllocator); - - if (!params->device) - return STATUS_SUCCESS; - - wine_vkDestroyDevice(params->device, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyDevice(void *args) -{ - struct - { - PTR32 device; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, %#x\n", params->device, params->pAllocator); - - if (!params->device) - return STATUS_SUCCESS; - - wine_vkDestroyDevice((VkDevice)UlongToPtr(params->device), (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyEvent(void *args) -{ - struct vkDestroyEvent_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->event), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyEvent(wine_device_from_handle(params->device)->host_device, params->event, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyEvent(void *args) -{ - struct - { - PTR32 device; - VkEvent DECLSPEC_ALIGN(8) event; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->event), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyEvent(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->event, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyFence(void *args) -{ - struct vkDestroyFence_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->fence), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyFence(wine_device_from_handle(params->device)->host_device, params->fence, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyFence(void *args) -{ - struct - { - PTR32 device; - VkFence DECLSPEC_ALIGN(8) fence; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->fence), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyFence(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->fence, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyFramebuffer(void *args) -{ - struct vkDestroyFramebuffer_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->framebuffer), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyFramebuffer(wine_device_from_handle(params->device)->host_device, params->framebuffer, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyFramebuffer(void *args) -{ - struct - { - PTR32 device; - VkFramebuffer DECLSPEC_ALIGN(8) framebuffer; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->framebuffer), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyFramebuffer(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->framebuffer, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyImage(void *args) -{ - struct vkDestroyImage_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->image), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyImage(wine_device_from_handle(params->device)->host_device, params->image, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyImage(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->image), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyImage(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyImageView(void *args) -{ - struct vkDestroyImageView_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->imageView), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyImageView(wine_device_from_handle(params->device)->host_device, params->imageView, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyImageView(void *args) -{ - struct - { - PTR32 device; - VkImageView DECLSPEC_ALIGN(8) imageView; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->imageView), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyImageView(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->imageView, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyIndirectCommandsLayoutNV(void *args) -{ - struct vkDestroyIndirectCommandsLayoutNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->indirectCommandsLayout), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyIndirectCommandsLayoutNV(wine_device_from_handle(params->device)->host_device, params->indirectCommandsLayout, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyIndirectCommandsLayoutNV(void *args) -{ - struct - { - PTR32 device; - VkIndirectCommandsLayoutNV DECLSPEC_ALIGN(8) indirectCommandsLayout; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->indirectCommandsLayout), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyIndirectCommandsLayoutNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->indirectCommandsLayout, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyInstance(void *args) -{ - struct vkDestroyInstance_params *params = args; - - TRACE("%p, %p\n", params->instance, params->pAllocator); - - if (!params->instance) - return STATUS_SUCCESS; - - wine_vkDestroyInstance(params->instance, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyInstance(void *args) -{ - struct - { - PTR32 instance; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, %#x\n", params->instance, params->pAllocator); - - if (!params->instance) - return STATUS_SUCCESS; - - wine_vkDestroyInstance((VkInstance)UlongToPtr(params->instance), (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyMicromapEXT(void *args) -{ - struct vkDestroyMicromapEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->micromap), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyMicromapEXT(wine_device_from_handle(params->device)->host_device, params->micromap, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyMicromapEXT(void *args) -{ - struct - { - PTR32 device; - VkMicromapEXT DECLSPEC_ALIGN(8) micromap; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->micromap), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyMicromapEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->micromap, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyOpticalFlowSessionNV(void *args) -{ - struct vkDestroyOpticalFlowSessionNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->session), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyOpticalFlowSessionNV(wine_device_from_handle(params->device)->host_device, params->session, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyOpticalFlowSessionNV(void *args) -{ - struct - { - PTR32 device; - VkOpticalFlowSessionNV DECLSPEC_ALIGN(8) session; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->session), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyOpticalFlowSessionNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->session, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyPipeline(void *args) -{ - struct vkDestroyPipeline_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->pipeline), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyPipeline(wine_device_from_handle(params->device)->host_device, params->pipeline, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyPipeline(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyPipeline(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyPipelineCache(void *args) -{ - struct vkDestroyPipelineCache_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyPipelineCache(wine_device_from_handle(params->device)->host_device, params->pipelineCache, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyPipelineCache(void *args) -{ - struct - { - PTR32 device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyPipelineCache(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipelineCache, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyPipelineLayout(void *args) -{ - struct vkDestroyPipelineLayout_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->pipelineLayout), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyPipelineLayout(wine_device_from_handle(params->device)->host_device, params->pipelineLayout, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyPipelineLayout(void *args) -{ - struct - { - PTR32 device; - VkPipelineLayout DECLSPEC_ALIGN(8) pipelineLayout; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->pipelineLayout), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyPipelineLayout(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipelineLayout, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyPrivateDataSlot(void *args) -{ - struct vkDestroyPrivateDataSlot_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->privateDataSlot), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyPrivateDataSlot(wine_device_from_handle(params->device)->host_device, params->privateDataSlot, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyPrivateDataSlot(void *args) -{ - struct - { - PTR32 device; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->privateDataSlot), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyPrivateDataSlot(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->privateDataSlot, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyPrivateDataSlotEXT(void *args) -{ - struct vkDestroyPrivateDataSlotEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->privateDataSlot), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyPrivateDataSlotEXT(wine_device_from_handle(params->device)->host_device, params->privateDataSlot, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyPrivateDataSlotEXT(void *args) -{ - struct - { - PTR32 device; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->privateDataSlot), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyPrivateDataSlotEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->privateDataSlot, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyQueryPool(void *args) -{ - struct vkDestroyQueryPool_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->queryPool), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyQueryPool(wine_device_from_handle(params->device)->host_device, params->queryPool, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyQueryPool(void *args) -{ - struct - { - PTR32 device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->queryPool), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyQueryPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->queryPool, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyRenderPass(void *args) -{ - struct vkDestroyRenderPass_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->renderPass), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyRenderPass(wine_device_from_handle(params->device)->host_device, params->renderPass, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyRenderPass(void *args) -{ - struct - { - PTR32 device; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->renderPass), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyRenderPass(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->renderPass, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroySampler(void *args) -{ - struct vkDestroySampler_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->sampler), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroySampler(wine_device_from_handle(params->device)->host_device, params->sampler, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroySampler(void *args) -{ - struct - { - PTR32 device; - VkSampler DECLSPEC_ALIGN(8) sampler; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->sampler), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroySampler(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->sampler, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroySamplerYcbcrConversion(void *args) -{ - struct vkDestroySamplerYcbcrConversion_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->ycbcrConversion), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroySamplerYcbcrConversion(wine_device_from_handle(params->device)->host_device, params->ycbcrConversion, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroySamplerYcbcrConversion(void *args) -{ - struct - { - PTR32 device; - VkSamplerYcbcrConversion DECLSPEC_ALIGN(8) ycbcrConversion; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->ycbcrConversion), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroySamplerYcbcrConversion(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->ycbcrConversion, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroySamplerYcbcrConversionKHR(void *args) -{ - struct vkDestroySamplerYcbcrConversionKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->ycbcrConversion), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroySamplerYcbcrConversionKHR(wine_device_from_handle(params->device)->host_device, params->ycbcrConversion, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroySamplerYcbcrConversionKHR(void *args) -{ - struct - { - PTR32 device; - VkSamplerYcbcrConversion DECLSPEC_ALIGN(8) ycbcrConversion; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->ycbcrConversion), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroySamplerYcbcrConversionKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->ycbcrConversion, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroySemaphore(void *args) -{ - struct vkDestroySemaphore_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->semaphore), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroySemaphore(wine_device_from_handle(params->device)->host_device, params->semaphore, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroySemaphore(void *args) -{ - struct - { - PTR32 device; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->semaphore), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroySemaphore(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->semaphore, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyShaderEXT(void *args) -{ - struct vkDestroyShaderEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->shader), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyShaderEXT(wine_device_from_handle(params->device)->host_device, params->shader, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyShaderEXT(void *args) -{ - struct - { - PTR32 device; - VkShaderEXT DECLSPEC_ALIGN(8) shader; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->shader), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyShaderEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->shader, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyShaderModule(void *args) -{ - struct vkDestroyShaderModule_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->shaderModule), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyShaderModule(wine_device_from_handle(params->device)->host_device, params->shaderModule, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyShaderModule(void *args) -{ - struct - { - PTR32 device; - VkShaderModule DECLSPEC_ALIGN(8) shaderModule; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->shaderModule), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyShaderModule(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->shaderModule, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroySurfaceKHR(void *args) -{ - struct vkDestroySurfaceKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->instance, wine_dbgstr_longlong(params->surface), params->pAllocator); - - wine_vkDestroySurfaceKHR(params->instance, params->surface, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroySurfaceKHR(void *args) -{ - struct - { - PTR32 instance; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->instance, wine_dbgstr_longlong(params->surface), params->pAllocator); - - wine_vkDestroySurfaceKHR((VkInstance)UlongToPtr(params->instance), params->surface, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroySwapchainKHR(void *args) -{ - struct vkDestroySwapchainKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroySwapchainKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroySwapchainKHR(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroySwapchainKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDestroyValidationCacheEXT(void *args) -{ - struct vkDestroyValidationCacheEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->validationCache), params->pAllocator); - - wine_device_from_handle(params->device)->funcs.p_vkDestroyValidationCacheEXT(wine_device_from_handle(params->device)->host_device, params->validationCache, NULL); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDestroyValidationCacheEXT(void *args) -{ - struct - { - PTR32 device; - VkValidationCacheEXT DECLSPEC_ALIGN(8) validationCache; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->validationCache), params->pAllocator); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroyValidationCacheEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->validationCache, NULL); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkDeviceWaitIdle(void *args) -{ - struct vkDeviceWaitIdle_params *params = args; - - TRACE("%p\n", params->device); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkDeviceWaitIdle(wine_device_from_handle(params->device)->host_device); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkDeviceWaitIdle(void *args) -{ - struct - { - PTR32 device; - VkResult result; - } *params = args; - - TRACE("%#x\n", params->device); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDeviceWaitIdle(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEndCommandBuffer(void *args) -{ - struct vkEndCommandBuffer_params *params = args; - - TRACE("%p\n", params->commandBuffer); - - params->result = wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkEndCommandBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEndCommandBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkResult result; - } *params = args; - - TRACE("%#x\n", params->commandBuffer); - - params->result = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkEndCommandBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumerateDeviceExtensionProperties(void *args) -{ - struct vkEnumerateDeviceExtensionProperties_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->physicalDevice, params->pLayerName, params->pPropertyCount, params->pProperties); - - params->result = wine_vkEnumerateDeviceExtensionProperties(params->physicalDevice, params->pLayerName, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumerateDeviceExtensionProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pLayerName; - PTR32 pPropertyCount; - PTR32 pProperties; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, %#x, %#x\n", params->physicalDevice, params->pLayerName, params->pPropertyCount, params->pProperties); - - params->result = wine_vkEnumerateDeviceExtensionProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), (const char *)UlongToPtr(params->pLayerName), (uint32_t *)UlongToPtr(params->pPropertyCount), (VkExtensionProperties *)UlongToPtr(params->pProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumerateDeviceLayerProperties(void *args) -{ - struct vkEnumerateDeviceLayerProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pPropertyCount, params->pProperties); - - params->result = wine_vkEnumerateDeviceLayerProperties(params->physicalDevice, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumerateDeviceLayerProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pPropertyCount; - PTR32 pProperties; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pPropertyCount, params->pProperties); - - params->result = wine_vkEnumerateDeviceLayerProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), (uint32_t *)UlongToPtr(params->pPropertyCount), (VkLayerProperties *)UlongToPtr(params->pProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumerateInstanceExtensionProperties(void *args) -{ - struct vkEnumerateInstanceExtensionProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->pLayerName, params->pPropertyCount, params->pProperties); - - params->result = wine_vkEnumerateInstanceExtensionProperties(params->pLayerName, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumerateInstanceExtensionProperties(void *args) -{ - struct - { - PTR32 pLayerName; - PTR32 pPropertyCount; - PTR32 pProperties; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, %#x\n", params->pLayerName, params->pPropertyCount, params->pProperties); - - params->result = wine_vkEnumerateInstanceExtensionProperties((const char *)UlongToPtr(params->pLayerName), (uint32_t *)UlongToPtr(params->pPropertyCount), (VkExtensionProperties *)UlongToPtr(params->pProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumerateInstanceVersion(void *args) -{ - struct vkEnumerateInstanceVersion_params *params = args; - - TRACE("%p\n", params->pApiVersion); - - params->result = wine_vkEnumerateInstanceVersion(params->pApiVersion); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumerateInstanceVersion(void *args) -{ - struct - { - PTR32 pApiVersion; - VkResult result; - } *params = args; - - TRACE("%#x\n", params->pApiVersion); - - params->result = wine_vkEnumerateInstanceVersion((uint32_t *)UlongToPtr(params->pApiVersion)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumeratePhysicalDeviceGroups(void *args) -{ - struct vkEnumeratePhysicalDeviceGroups_params *params = args; - - TRACE("%p, %p, %p\n", params->instance, params->pPhysicalDeviceGroupCount, params->pPhysicalDeviceGroupProperties); - - params->result = wine_vkEnumeratePhysicalDeviceGroups(params->instance, params->pPhysicalDeviceGroupCount, params->pPhysicalDeviceGroupProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumeratePhysicalDeviceGroups(void *args) -{ - struct - { - PTR32 instance; - PTR32 pPhysicalDeviceGroupCount; - PTR32 pPhysicalDeviceGroupProperties; - VkResult result; - } *params = args; - VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->instance, params->pPhysicalDeviceGroupCount, params->pPhysicalDeviceGroupProperties); - - init_conversion_context(ctx); - pPhysicalDeviceGroupProperties_host = convert_VkPhysicalDeviceGroupProperties_array_win32_to_unwrapped_host(ctx, (VkPhysicalDeviceGroupProperties32 *)UlongToPtr(params->pPhysicalDeviceGroupProperties), *(uint32_t *)UlongToPtr(params->pPhysicalDeviceGroupCount)); - params->result = wine_vkEnumeratePhysicalDeviceGroups((VkInstance)UlongToPtr(params->instance), (uint32_t *)UlongToPtr(params->pPhysicalDeviceGroupCount), pPhysicalDeviceGroupProperties_host); - convert_VkPhysicalDeviceGroupProperties_array_unwrapped_host_to_win32(pPhysicalDeviceGroupProperties_host, (VkPhysicalDeviceGroupProperties32 *)UlongToPtr(params->pPhysicalDeviceGroupProperties), *(uint32_t *)UlongToPtr(params->pPhysicalDeviceGroupCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumeratePhysicalDeviceGroupsKHR(void *args) -{ - struct vkEnumeratePhysicalDeviceGroupsKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->instance, params->pPhysicalDeviceGroupCount, params->pPhysicalDeviceGroupProperties); - - params->result = wine_vkEnumeratePhysicalDeviceGroupsKHR(params->instance, params->pPhysicalDeviceGroupCount, params->pPhysicalDeviceGroupProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumeratePhysicalDeviceGroupsKHR(void *args) -{ - struct - { - PTR32 instance; - PTR32 pPhysicalDeviceGroupCount; - PTR32 pPhysicalDeviceGroupProperties; - VkResult result; - } *params = args; - VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->instance, params->pPhysicalDeviceGroupCount, params->pPhysicalDeviceGroupProperties); - - init_conversion_context(ctx); - pPhysicalDeviceGroupProperties_host = convert_VkPhysicalDeviceGroupProperties_array_win32_to_unwrapped_host(ctx, (VkPhysicalDeviceGroupProperties32 *)UlongToPtr(params->pPhysicalDeviceGroupProperties), *(uint32_t *)UlongToPtr(params->pPhysicalDeviceGroupCount)); - params->result = wine_vkEnumeratePhysicalDeviceGroupsKHR((VkInstance)UlongToPtr(params->instance), (uint32_t *)UlongToPtr(params->pPhysicalDeviceGroupCount), pPhysicalDeviceGroupProperties_host); - convert_VkPhysicalDeviceGroupProperties_array_unwrapped_host_to_win32(pPhysicalDeviceGroupProperties_host, (VkPhysicalDeviceGroupProperties32 *)UlongToPtr(params->pPhysicalDeviceGroupProperties), *(uint32_t *)UlongToPtr(params->pPhysicalDeviceGroupCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(void *args) -{ - struct vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR_params *params = args; - - TRACE("%p, %u, %p, %p, %p\n", params->physicalDevice, params->queueFamilyIndex, params->pCounterCount, params->pCounters, params->pCounterDescriptions); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->queueFamilyIndex, params->pCounterCount, params->pCounters, params->pCounterDescriptions); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - uint32_t queueFamilyIndex; - PTR32 pCounterCount; - PTR32 pCounters; - PTR32 pCounterDescriptions; - VkResult result; - } *params = args; - VkPerformanceCounterKHR *pCounters_host; - VkPerformanceCounterDescriptionKHR *pCounterDescriptions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, %#x, %#x\n", params->physicalDevice, params->queueFamilyIndex, params->pCounterCount, params->pCounters, params->pCounterDescriptions); - - init_conversion_context(ctx); - pCounters_host = convert_VkPerformanceCounterKHR_array_win32_to_host(ctx, (VkPerformanceCounterKHR32 *)UlongToPtr(params->pCounters), *(uint32_t *)UlongToPtr(params->pCounterCount)); - pCounterDescriptions_host = convert_VkPerformanceCounterDescriptionKHR_array_win32_to_host(ctx, (VkPerformanceCounterDescriptionKHR32 *)UlongToPtr(params->pCounterDescriptions), *(uint32_t *)UlongToPtr(params->pCounterCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->queueFamilyIndex, (uint32_t *)UlongToPtr(params->pCounterCount), pCounters_host, pCounterDescriptions_host); - convert_VkPerformanceCounterKHR_array_host_to_win32(pCounters_host, (VkPerformanceCounterKHR32 *)UlongToPtr(params->pCounters), *(uint32_t *)UlongToPtr(params->pCounterCount)); - convert_VkPerformanceCounterDescriptionKHR_array_host_to_win32(pCounterDescriptions_host, (VkPerformanceCounterDescriptionKHR32 *)UlongToPtr(params->pCounterDescriptions), *(uint32_t *)UlongToPtr(params->pCounterCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkEnumeratePhysicalDevices(void *args) -{ - struct vkEnumeratePhysicalDevices_params *params = args; - - TRACE("%p, %p, %p\n", params->instance, params->pPhysicalDeviceCount, params->pPhysicalDevices); - - params->result = wine_vkEnumeratePhysicalDevices(params->instance, params->pPhysicalDeviceCount, params->pPhysicalDevices); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkEnumeratePhysicalDevices(void *args) -{ - struct - { - PTR32 instance; - PTR32 pPhysicalDeviceCount; - PTR32 pPhysicalDevices; - VkResult result; - } *params = args; - VkPhysicalDevice *pPhysicalDevices_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->instance, params->pPhysicalDeviceCount, params->pPhysicalDevices); - - init_conversion_context(ctx); - pPhysicalDevices_host = (params->pPhysicalDevices && *(uint32_t *)UlongToPtr(params->pPhysicalDeviceCount)) ? conversion_context_alloc(ctx, sizeof(*pPhysicalDevices_host) * *(uint32_t *)UlongToPtr(params->pPhysicalDeviceCount)) : NULL; - params->result = wine_vkEnumeratePhysicalDevices((VkInstance)UlongToPtr(params->instance), (uint32_t *)UlongToPtr(params->pPhysicalDeviceCount), pPhysicalDevices_host); - convert_VkPhysicalDevice_array_unwrapped_host_to_win32(pPhysicalDevices_host, (PTR32 *)UlongToPtr(params->pPhysicalDevices), *(uint32_t *)UlongToPtr(params->pPhysicalDeviceCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkFlushMappedMemoryRanges(void *args) -{ - struct vkFlushMappedMemoryRanges_params *params = args; - const VkMappedMemoryRange *pMemoryRanges_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->memoryRangeCount, params->pMemoryRanges); - - init_conversion_context(ctx); - pMemoryRanges_host = convert_VkMappedMemoryRange_array_win64_to_host(ctx, params->pMemoryRanges, params->memoryRangeCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkFlushMappedMemoryRanges(wine_device_from_handle(params->device)->host_device, params->memoryRangeCount, pMemoryRanges_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkFlushMappedMemoryRanges(void *args) -{ - struct - { - PTR32 device; - uint32_t memoryRangeCount; - PTR32 pMemoryRanges; - VkResult result; - } *params = args; - const VkMappedMemoryRange *pMemoryRanges_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->memoryRangeCount, params->pMemoryRanges); - - init_conversion_context(ctx); - pMemoryRanges_host = convert_VkMappedMemoryRange_array_win32_to_host(ctx, (const VkMappedMemoryRange32 *)UlongToPtr(params->pMemoryRanges), params->memoryRangeCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkFlushMappedMemoryRanges(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->memoryRangeCount, pMemoryRanges_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkFreeCommandBuffers(void *args) -{ - struct vkFreeCommandBuffers_params *params = args; - - TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->commandPool), params->commandBufferCount, params->pCommandBuffers); - - wine_vkFreeCommandBuffers(params->device, params->commandPool, params->commandBufferCount, params->pCommandBuffers); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkFreeCommandBuffers(void *args) -{ - struct - { - PTR32 device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - uint32_t commandBufferCount; - PTR32 pCommandBuffers; - } *params = args; - const VkCommandBuffer *pCommandBuffers_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->commandBufferCount, params->pCommandBuffers); - - init_conversion_context(ctx); - pCommandBuffers_host = convert_VkCommandBuffer_array_win32_to_unwrapped_host(ctx, (const PTR32 *)UlongToPtr(params->pCommandBuffers), params->commandBufferCount); - wine_vkFreeCommandBuffers((VkDevice)UlongToPtr(params->device), params->commandPool, params->commandBufferCount, pCommandBuffers_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkFreeDescriptorSets(void *args) -{ - struct vkFreeDescriptorSets_params *params = args; - - TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->descriptorPool), params->descriptorSetCount, params->pDescriptorSets); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkFreeDescriptorSets(wine_device_from_handle(params->device)->host_device, params->descriptorPool, params->descriptorSetCount, params->pDescriptorSets); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkFreeDescriptorSets(void *args) -{ - struct - { - PTR32 device; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - uint32_t descriptorSetCount; - PTR32 pDescriptorSets; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorPool), params->descriptorSetCount, params->pDescriptorSets); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkFreeDescriptorSets(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorPool, params->descriptorSetCount, (const VkDescriptorSet *)UlongToPtr(params->pDescriptorSets)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkFreeMemory(void *args) -{ - struct vkFreeMemory_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->memory), params->pAllocator); - - wine_vkFreeMemory(params->device, params->memory, params->pAllocator); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkFreeMemory(void *args) -{ - struct - { - PTR32 device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - PTR32 pAllocator; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->memory), params->pAllocator); - - wine_vkFreeMemory((VkDevice)UlongToPtr(params->device), params->memory, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetAccelerationStructureBuildSizesKHR(void *args) -{ - struct vkGetAccelerationStructureBuildSizesKHR_params *params = args; - - TRACE("%p, %#x, %p, %p, %p\n", params->device, params->buildType, params->pBuildInfo, params->pMaxPrimitiveCounts, params->pSizeInfo); - - wine_device_from_handle(params->device)->funcs.p_vkGetAccelerationStructureBuildSizesKHR(wine_device_from_handle(params->device)->host_device, params->buildType, params->pBuildInfo, params->pMaxPrimitiveCounts, params->pSizeInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetAccelerationStructureBuildSizesKHR(void *args) -{ - struct - { - PTR32 device; - VkAccelerationStructureBuildTypeKHR buildType; - PTR32 pBuildInfo; - PTR32 pMaxPrimitiveCounts; - PTR32 pSizeInfo; - } *params = args; - VkAccelerationStructureBuildGeometryInfoKHR pBuildInfo_host; - VkAccelerationStructureBuildSizesInfoKHR pSizeInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x, %#x\n", params->device, params->buildType, params->pBuildInfo, params->pMaxPrimitiveCounts, params->pSizeInfo); - - init_conversion_context(ctx); - convert_VkAccelerationStructureBuildGeometryInfoKHR_win32_to_host(ctx, (const VkAccelerationStructureBuildGeometryInfoKHR32 *)UlongToPtr(params->pBuildInfo), &pBuildInfo_host); - convert_VkAccelerationStructureBuildSizesInfoKHR_win32_to_host((VkAccelerationStructureBuildSizesInfoKHR32 *)UlongToPtr(params->pSizeInfo), &pSizeInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetAccelerationStructureBuildSizesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->buildType, &pBuildInfo_host, (const uint32_t *)UlongToPtr(params->pMaxPrimitiveCounts), &pSizeInfo_host); - convert_VkAccelerationStructureBuildSizesInfoKHR_host_to_win32(&pSizeInfo_host, (VkAccelerationStructureBuildSizesInfoKHR32 *)UlongToPtr(params->pSizeInfo)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetAccelerationStructureDeviceAddressKHR(void *args) -{ - struct vkGetAccelerationStructureDeviceAddressKHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetAccelerationStructureDeviceAddressKHR(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetAccelerationStructureDeviceAddressKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - VkDeviceAddress result; - } *params = args; - VkAccelerationStructureDeviceAddressInfoKHR pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkAccelerationStructureDeviceAddressInfoKHR_win32_to_host((const VkAccelerationStructureDeviceAddressInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetAccelerationStructureDeviceAddressKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetAccelerationStructureHandleNV(void *args) -{ - struct vkGetAccelerationStructureHandleNV_params *params = args; - - TRACE("%p, 0x%s, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->accelerationStructure), wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetAccelerationStructureHandleNV(wine_device_from_handle(params->device)->host_device, params->accelerationStructure, params->dataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetAccelerationStructureHandleNV(void *args) -{ - struct - { - PTR32 device; - VkAccelerationStructureNV DECLSPEC_ALIGN(8) accelerationStructure; - PTR32 dataSize; - PTR32 pData; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->accelerationStructure), wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetAccelerationStructureHandleNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->accelerationStructure, params->dataSize, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetAccelerationStructureMemoryRequirementsNV(void *args) -{ - struct vkGetAccelerationStructureMemoryRequirementsNV_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetAccelerationStructureMemoryRequirementsNV(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetAccelerationStructureMemoryRequirementsNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkAccelerationStructureMemoryRequirementsInfoNV pInfo_host; - VkMemoryRequirements2KHR pMemoryRequirements_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - convert_VkAccelerationStructureMemoryRequirementsInfoNV_win32_to_host((const VkAccelerationStructureMemoryRequirementsInfoNV32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2KHR_win32_to_host((VkMemoryRequirements2KHR32 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetAccelerationStructureMemoryRequirementsNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2KHR_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements2KHR32 *)UlongToPtr(params->pMemoryRequirements)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pData; - VkResult result; - } *params = args; - VkAccelerationStructureCaptureDescriptorDataInfoEXT pInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pData); - - convert_VkAccelerationStructureCaptureDescriptorDataInfoEXT_win32_to_host((const VkAccelerationStructureCaptureDescriptorDataInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferDeviceAddress(void *args) -{ - struct vkGetBufferDeviceAddress_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetBufferDeviceAddress(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferDeviceAddress(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - VkDeviceAddress result; - } *params = args; - VkBufferDeviceAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkBufferDeviceAddressInfo_win32_to_host((const VkBufferDeviceAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferDeviceAddress(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferDeviceAddressEXT(void *args) -{ - struct vkGetBufferDeviceAddressEXT_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetBufferDeviceAddressEXT(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferDeviceAddressEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - VkDeviceAddress result; - } *params = args; - VkBufferDeviceAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkBufferDeviceAddressInfo_win32_to_host((const VkBufferDeviceAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferDeviceAddressEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferDeviceAddressKHR(void *args) -{ - struct vkGetBufferDeviceAddressKHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetBufferDeviceAddressKHR(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferDeviceAddressKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - VkDeviceAddress result; - } *params = args; - VkBufferDeviceAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkBufferDeviceAddressInfo_win32_to_host((const VkBufferDeviceAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferDeviceAddressKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferMemoryRequirements(void *args) -{ - struct vkGetBufferMemoryRequirements_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->buffer), params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetBufferMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->buffer, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferMemoryRequirements(void *args) -{ - struct - { - PTR32 device; - VkBuffer DECLSPEC_ALIGN(8) buffer; - PTR32 pMemoryRequirements; - } *params = args; - VkMemoryRequirements pMemoryRequirements_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->buffer), params->pMemoryRequirements); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferMemoryRequirements(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->buffer, &pMemoryRequirements_host); - convert_VkMemoryRequirements_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements32 *)UlongToPtr(params->pMemoryRequirements)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferMemoryRequirements2(void *args) -{ - struct vkGetBufferMemoryRequirements2_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetBufferMemoryRequirements2(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferMemoryRequirements2(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkBufferMemoryRequirementsInfo2 pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkBufferMemoryRequirementsInfo2_win32_to_host((const VkBufferMemoryRequirementsInfo232 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferMemoryRequirements2(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferMemoryRequirements2KHR(void *args) -{ - struct vkGetBufferMemoryRequirements2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetBufferMemoryRequirements2KHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferMemoryRequirements2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkBufferMemoryRequirementsInfo2 pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkBufferMemoryRequirementsInfo2_win32_to_host((const VkBufferMemoryRequirementsInfo232 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferMemoryRequirements2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferOpaqueCaptureAddress(void *args) -{ - struct vkGetBufferOpaqueCaptureAddress_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetBufferOpaqueCaptureAddress(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferOpaqueCaptureAddress(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - uint64_t result; - } *params = args; - VkBufferDeviceAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkBufferDeviceAddressInfo_win32_to_host((const VkBufferDeviceAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferOpaqueCaptureAddress(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferOpaqueCaptureAddressKHR(void *args) -{ - struct vkGetBufferOpaqueCaptureAddressKHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetBufferOpaqueCaptureAddressKHR(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferOpaqueCaptureAddressKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - uint64_t result; - } *params = args; - VkBufferDeviceAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkBufferDeviceAddressInfo_win32_to_host((const VkBufferDeviceAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferOpaqueCaptureAddressKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetBufferOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct vkGetBufferOpaqueCaptureDescriptorDataEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetBufferOpaqueCaptureDescriptorDataEXT(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetBufferOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pData; - VkResult result; - } *params = args; - VkBufferCaptureDescriptorDataInfoEXT pInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pData); - - convert_VkBufferCaptureDescriptorDataInfoEXT_win32_to_host((const VkBufferCaptureDescriptorDataInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetBufferOpaqueCaptureDescriptorDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetCalibratedTimestampsEXT(void *args) -{ - struct vkGetCalibratedTimestampsEXT_params *params = args; - - TRACE("%p, %u, %p, %p, %p\n", params->device, params->timestampCount, params->pTimestampInfos, params->pTimestamps, params->pMaxDeviation); - - params->result = wine_vkGetCalibratedTimestampsEXT(params->device, params->timestampCount, params->pTimestampInfos, params->pTimestamps, params->pMaxDeviation); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetCalibratedTimestampsEXT(void *args) -{ - struct - { - PTR32 device; - uint32_t timestampCount; - PTR32 pTimestampInfos; - PTR32 pTimestamps; - PTR32 pMaxDeviation; - VkResult result; - } *params = args; - const VkCalibratedTimestampInfoEXT *pTimestampInfos_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, %#x, %#x\n", params->device, params->timestampCount, params->pTimestampInfos, params->pTimestamps, params->pMaxDeviation); - - init_conversion_context(ctx); - pTimestampInfos_host = convert_VkCalibratedTimestampInfoEXT_array_win32_to_host(ctx, (const VkCalibratedTimestampInfoEXT32 *)UlongToPtr(params->pTimestampInfos), params->timestampCount); - params->result = wine_vkGetCalibratedTimestampsEXT((VkDevice)UlongToPtr(params->device), params->timestampCount, pTimestampInfos_host, (uint64_t *)UlongToPtr(params->pTimestamps), (uint64_t *)UlongToPtr(params->pMaxDeviation)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetCudaModuleCacheNV(void *args) -{ - struct vkGetCudaModuleCacheNV_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->module), params->pCacheSize, params->pCacheData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetCudaModuleCacheNV(wine_device_from_handle(params->device)->host_device, params->module, params->pCacheSize, params->pCacheData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetCudaModuleCacheNV(void *args) -{ - struct - { - PTR32 device; - VkCudaModuleNV DECLSPEC_ALIGN(8) module; - PTR32 pCacheSize; - PTR32 pCacheData; - VkResult result; - } *params = args; - size_t pCacheSize_host; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->module), params->pCacheSize, params->pCacheData); - - pCacheSize_host = *(PTR32 *)UlongToPtr(params->pCacheSize); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetCudaModuleCacheNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->module, &pCacheSize_host, (void *)UlongToPtr(params->pCacheData)); - *(PTR32 *)UlongToPtr(params->pCacheSize) = pCacheSize_host; - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeferredOperationMaxConcurrencyKHR(void *args) -{ - struct vkGetDeferredOperationMaxConcurrencyKHR_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->operation)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeferredOperationMaxConcurrencyKHR(wine_device_from_handle(params->device)->host_device, wine_deferred_operation_from_handle(params->operation)->host_deferred_operation); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeferredOperationMaxConcurrencyKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - uint32_t result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->operation)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeferredOperationMaxConcurrencyKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_deferred_operation_from_handle(params->operation)->host_deferred_operation); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeferredOperationResultKHR(void *args) -{ - struct vkGetDeferredOperationResultKHR_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->operation)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeferredOperationResultKHR(wine_device_from_handle(params->device)->host_device, wine_deferred_operation_from_handle(params->operation)->host_deferred_operation); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeferredOperationResultKHR(void *args) -{ - struct - { - PTR32 device; - VkDeferredOperationKHR DECLSPEC_ALIGN(8) operation; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->operation)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeferredOperationResultKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_deferred_operation_from_handle(params->operation)->host_deferred_operation); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static void thunk64_vkGetDescriptorEXT(void *args) -{ - struct vkGetDescriptorEXT_params *params = args; - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorEXT(wine_device_from_handle(params->device)->host_device, params->pDescriptorInfo, params->dataSize, params->pDescriptor); -} -#endif /* _WIN64 */ - -static void thunk32_vkGetDescriptorEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pDescriptorInfo; - PTR32 dataSize; - PTR32 pDescriptor; - } *params = args; - VkDescriptorGetInfoEXT pDescriptorInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - convert_VkDescriptorGetInfoEXT_win32_to_host(ctx, (const VkDescriptorGetInfoEXT32 *)UlongToPtr(params->pDescriptorInfo), &pDescriptorInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pDescriptorInfo_host, params->dataSize, (void *)UlongToPtr(params->pDescriptor)); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDescriptorSetHostMappingVALVE(void *args) -{ - struct vkGetDescriptorSetHostMappingVALVE_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->descriptorSet), params->ppData); - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorSetHostMappingVALVE(wine_device_from_handle(params->device)->host_device, params->descriptorSet, params->ppData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDescriptorSetHostMappingVALVE(void *args) -{ - struct - { - PTR32 device; - VkDescriptorSet DECLSPEC_ALIGN(8) descriptorSet; - PTR32 ppData; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorSet), params->ppData); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorSetHostMappingVALVE(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorSet, (void **)UlongToPtr(params->ppData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDescriptorSetLayoutBindingOffsetEXT(void *args) -{ - struct vkGetDescriptorSetLayoutBindingOffsetEXT_params *params = args; - - TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->layout), params->binding, params->pOffset); - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorSetLayoutBindingOffsetEXT(wine_device_from_handle(params->device)->host_device, params->layout, params->binding, params->pOffset); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDescriptorSetLayoutBindingOffsetEXT(void *args) -{ - struct - { - PTR32 device; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) layout; - uint32_t binding; - PTR32 pOffset; - } *params = args; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->layout), params->binding, params->pOffset); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorSetLayoutBindingOffsetEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->layout, params->binding, (VkDeviceSize *)UlongToPtr(params->pOffset)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDescriptorSetLayoutHostMappingInfoVALVE(void *args) -{ - struct vkGetDescriptorSetLayoutHostMappingInfoVALVE_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pBindingReference, params->pHostMapping); - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorSetLayoutHostMappingInfoVALVE(wine_device_from_handle(params->device)->host_device, params->pBindingReference, params->pHostMapping); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDescriptorSetLayoutHostMappingInfoVALVE(void *args) -{ - struct - { - PTR32 device; - PTR32 pBindingReference; - PTR32 pHostMapping; - } *params = args; - VkDescriptorSetBindingReferenceVALVE pBindingReference_host; - VkDescriptorSetLayoutHostMappingInfoVALVE pHostMapping_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pBindingReference, params->pHostMapping); - - convert_VkDescriptorSetBindingReferenceVALVE_win32_to_host((const VkDescriptorSetBindingReferenceVALVE32 *)UlongToPtr(params->pBindingReference), &pBindingReference_host); - convert_VkDescriptorSetLayoutHostMappingInfoVALVE_win32_to_host((VkDescriptorSetLayoutHostMappingInfoVALVE32 *)UlongToPtr(params->pHostMapping), &pHostMapping_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorSetLayoutHostMappingInfoVALVE(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pBindingReference_host, &pHostMapping_host); - convert_VkDescriptorSetLayoutHostMappingInfoVALVE_host_to_win32(&pHostMapping_host, (VkDescriptorSetLayoutHostMappingInfoVALVE32 *)UlongToPtr(params->pHostMapping)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDescriptorSetLayoutSizeEXT(void *args) -{ - struct vkGetDescriptorSetLayoutSizeEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->layout), params->pLayoutSizeInBytes); - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorSetLayoutSizeEXT(wine_device_from_handle(params->device)->host_device, params->layout, params->pLayoutSizeInBytes); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDescriptorSetLayoutSizeEXT(void *args) -{ - struct - { - PTR32 device; - VkDescriptorSetLayout DECLSPEC_ALIGN(8) layout; - PTR32 pLayoutSizeInBytes; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->layout), params->pLayoutSizeInBytes); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorSetLayoutSizeEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->layout, (VkDeviceSize *)UlongToPtr(params->pLayoutSizeInBytes)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDescriptorSetLayoutSupport(void *args) -{ - struct vkGetDescriptorSetLayoutSupport_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pCreateInfo, params->pSupport); - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorSetLayoutSupport(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, params->pSupport); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDescriptorSetLayoutSupport(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pSupport; - } *params = args; - VkDescriptorSetLayoutCreateInfo pCreateInfo_host; - VkDescriptorSetLayoutSupport pSupport_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pSupport); - - init_conversion_context(ctx); - convert_VkDescriptorSetLayoutCreateInfo_win32_to_host(ctx, (const VkDescriptorSetLayoutCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - convert_VkDescriptorSetLayoutSupport_win32_to_host(ctx, (VkDescriptorSetLayoutSupport32 *)UlongToPtr(params->pSupport), &pSupport_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorSetLayoutSupport(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, &pSupport_host); - convert_VkDescriptorSetLayoutSupport_host_to_win32(&pSupport_host, (VkDescriptorSetLayoutSupport32 *)UlongToPtr(params->pSupport)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDescriptorSetLayoutSupportKHR(void *args) -{ - struct vkGetDescriptorSetLayoutSupportKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pCreateInfo, params->pSupport); - - wine_device_from_handle(params->device)->funcs.p_vkGetDescriptorSetLayoutSupportKHR(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, params->pSupport); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDescriptorSetLayoutSupportKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pSupport; - } *params = args; - VkDescriptorSetLayoutCreateInfo pCreateInfo_host; - VkDescriptorSetLayoutSupport pSupport_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pSupport); - - init_conversion_context(ctx); - convert_VkDescriptorSetLayoutCreateInfo_win32_to_host(ctx, (const VkDescriptorSetLayoutCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - convert_VkDescriptorSetLayoutSupport_win32_to_host(ctx, (VkDescriptorSetLayoutSupport32 *)UlongToPtr(params->pSupport), &pSupport_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDescriptorSetLayoutSupportKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, &pSupport_host); - convert_VkDescriptorSetLayoutSupport_host_to_win32(&pSupport_host, (VkDescriptorSetLayoutSupport32 *)UlongToPtr(params->pSupport)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceAccelerationStructureCompatibilityKHR(void *args) -{ - struct vkGetDeviceAccelerationStructureCompatibilityKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pVersionInfo, params->pCompatibility); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceAccelerationStructureCompatibilityKHR(wine_device_from_handle(params->device)->host_device, params->pVersionInfo, params->pCompatibility); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceAccelerationStructureCompatibilityKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pVersionInfo; - PTR32 pCompatibility; - } *params = args; - VkAccelerationStructureVersionInfoKHR pVersionInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pVersionInfo, params->pCompatibility); - - convert_VkAccelerationStructureVersionInfoKHR_win32_to_host((const VkAccelerationStructureVersionInfoKHR32 *)UlongToPtr(params->pVersionInfo), &pVersionInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceAccelerationStructureCompatibilityKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pVersionInfo_host, (VkAccelerationStructureCompatibilityKHR *)UlongToPtr(params->pCompatibility)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceBufferMemoryRequirements(void *args) -{ - struct vkGetDeviceBufferMemoryRequirements_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceBufferMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceBufferMemoryRequirements(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkDeviceBufferMemoryRequirements pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkDeviceBufferMemoryRequirements_win32_to_host(ctx, (const VkDeviceBufferMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceBufferMemoryRequirements(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceBufferMemoryRequirementsKHR(void *args) -{ - struct vkGetDeviceBufferMemoryRequirementsKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceBufferMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceBufferMemoryRequirementsKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkDeviceBufferMemoryRequirements pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkDeviceBufferMemoryRequirements_win32_to_host(ctx, (const VkDeviceBufferMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceBufferMemoryRequirementsKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceFaultInfoEXT(void *args) -{ - struct vkGetDeviceFaultInfoEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pFaultCounts, params->pFaultInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceFaultInfoEXT(wine_device_from_handle(params->device)->host_device, params->pFaultCounts, params->pFaultInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceFaultInfoEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pFaultCounts; - PTR32 pFaultInfo; - VkResult result; - } *params = args; - VkDeviceFaultCountsEXT pFaultCounts_host; - VkDeviceFaultInfoEXT *pFaultInfo_host = NULL; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pFaultCounts, params->pFaultInfo); - - init_conversion_context(ctx); - convert_VkDeviceFaultCountsEXT_win32_to_host((VkDeviceFaultCountsEXT32 *)UlongToPtr(params->pFaultCounts), &pFaultCounts_host); - if (params->pFaultInfo) - { - pFaultInfo_host = conversion_context_alloc(ctx, sizeof(*pFaultInfo_host)); - convert_VkDeviceFaultInfoEXT_win32_to_host(ctx, (VkDeviceFaultInfoEXT32 *)UlongToPtr(params->pFaultInfo), pFaultInfo_host); - } - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceFaultInfoEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pFaultCounts_host, pFaultInfo_host); - convert_VkDeviceFaultCountsEXT_host_to_win32(&pFaultCounts_host, (VkDeviceFaultCountsEXT32 *)UlongToPtr(params->pFaultCounts)); - convert_VkDeviceFaultInfoEXT_host_to_win32(pFaultInfo_host, (VkDeviceFaultInfoEXT32 *)UlongToPtr(params->pFaultInfo)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceGroupPeerMemoryFeatures(void *args) -{ - struct vkGetDeviceGroupPeerMemoryFeatures_params *params = args; - - TRACE("%p, %u, %u, %u, %p\n", params->device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, params->pPeerMemoryFeatures); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceGroupPeerMemoryFeatures(wine_device_from_handle(params->device)->host_device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, params->pPeerMemoryFeatures); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceGroupPeerMemoryFeatures(void *args) -{ - struct - { - PTR32 device; - uint32_t heapIndex; - uint32_t localDeviceIndex; - uint32_t remoteDeviceIndex; - PTR32 pPeerMemoryFeatures; - } *params = args; - - TRACE("%#x, %u, %u, %u, %#x\n", params->device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, params->pPeerMemoryFeatures); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceGroupPeerMemoryFeatures(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, (VkPeerMemoryFeatureFlags *)UlongToPtr(params->pPeerMemoryFeatures)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceGroupPeerMemoryFeaturesKHR(void *args) -{ - struct vkGetDeviceGroupPeerMemoryFeaturesKHR_params *params = args; - - TRACE("%p, %u, %u, %u, %p\n", params->device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, params->pPeerMemoryFeatures); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceGroupPeerMemoryFeaturesKHR(wine_device_from_handle(params->device)->host_device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, params->pPeerMemoryFeatures); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceGroupPeerMemoryFeaturesKHR(void *args) -{ - struct - { - PTR32 device; - uint32_t heapIndex; - uint32_t localDeviceIndex; - uint32_t remoteDeviceIndex; - PTR32 pPeerMemoryFeatures; - } *params = args; - - TRACE("%#x, %u, %u, %u, %#x\n", params->device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, params->pPeerMemoryFeatures); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceGroupPeerMemoryFeaturesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->heapIndex, params->localDeviceIndex, params->remoteDeviceIndex, (VkPeerMemoryFeatureFlags *)UlongToPtr(params->pPeerMemoryFeatures)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceGroupPresentCapabilitiesKHR(void *args) -{ - struct vkGetDeviceGroupPresentCapabilitiesKHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pDeviceGroupPresentCapabilities); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceGroupPresentCapabilitiesKHR(wine_device_from_handle(params->device)->host_device, params->pDeviceGroupPresentCapabilities); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceGroupPresentCapabilitiesKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pDeviceGroupPresentCapabilities; - VkResult result; - } *params = args; - VkDeviceGroupPresentCapabilitiesKHR pDeviceGroupPresentCapabilities_host; - - TRACE("%#x, %#x\n", params->device, params->pDeviceGroupPresentCapabilities); - - convert_VkDeviceGroupPresentCapabilitiesKHR_win32_to_host((VkDeviceGroupPresentCapabilitiesKHR32 *)UlongToPtr(params->pDeviceGroupPresentCapabilities), &pDeviceGroupPresentCapabilities_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceGroupPresentCapabilitiesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pDeviceGroupPresentCapabilities_host); - convert_VkDeviceGroupPresentCapabilitiesKHR_host_to_win32(&pDeviceGroupPresentCapabilities_host, (VkDeviceGroupPresentCapabilitiesKHR32 *)UlongToPtr(params->pDeviceGroupPresentCapabilities)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceGroupSurfacePresentModesKHR(void *args) -{ - struct vkGetDeviceGroupSurfacePresentModesKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->surface), params->pModes); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceGroupSurfacePresentModesKHR(wine_device_from_handle(params->device)->host_device, wine_surface_from_handle(params->surface)->driver_surface, params->pModes); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceGroupSurfacePresentModesKHR(void *args) -{ - struct - { - PTR32 device; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pModes; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->surface), params->pModes); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceGroupSurfacePresentModesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_surface_from_handle(params->surface)->driver_surface, (VkDeviceGroupPresentModeFlagsKHR *)UlongToPtr(params->pModes)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceImageMemoryRequirements(void *args) -{ - struct vkGetDeviceImageMemoryRequirements_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceImageMemoryRequirements(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkDeviceImageMemoryRequirements pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkDeviceImageMemoryRequirements_win32_to_host(ctx, (const VkDeviceImageMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceImageMemoryRequirements(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceImageMemoryRequirementsKHR(void *args) -{ - struct vkGetDeviceImageMemoryRequirementsKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceImageMemoryRequirementsKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkDeviceImageMemoryRequirements pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkDeviceImageMemoryRequirements_win32_to_host(ctx, (const VkDeviceImageMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceImageMemoryRequirementsKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceImageSparseMemoryRequirements(void *args) -{ - struct vkGetDeviceImageSparseMemoryRequirements_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSparseMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceImageSparseMemoryRequirements(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pSparseMemoryRequirementCount; - PTR32 pSparseMemoryRequirements; - } *params = args; - VkDeviceImageMemoryRequirements pInfo_host; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - init_conversion_context(ctx); - convert_VkDeviceImageMemoryRequirements_win32_to_host(ctx, (const VkDeviceImageMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); - pSparseMemoryRequirements_host = convert_VkSparseImageMemoryRequirements2_array_win32_to_host(ctx, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceImageSparseMemoryRequirements(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount), pSparseMemoryRequirements_host); - convert_VkSparseImageMemoryRequirements2_array_host_to_win32(pSparseMemoryRequirements_host, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceImageSparseMemoryRequirementsKHR(void *args) -{ - struct vkGetDeviceImageSparseMemoryRequirementsKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSparseMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceImageSparseMemoryRequirementsKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pSparseMemoryRequirementCount; - PTR32 pSparseMemoryRequirements; - } *params = args; - VkDeviceImageMemoryRequirements pInfo_host; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - init_conversion_context(ctx); - convert_VkDeviceImageMemoryRequirements_win32_to_host(ctx, (const VkDeviceImageMemoryRequirements32 *)UlongToPtr(params->pInfo), &pInfo_host); - pSparseMemoryRequirements_host = convert_VkSparseImageMemoryRequirements2_array_win32_to_host(ctx, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceImageSparseMemoryRequirementsKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount), pSparseMemoryRequirements_host); - convert_VkSparseImageMemoryRequirements2_array_host_to_win32(pSparseMemoryRequirements_host, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceImageSubresourceLayoutKHR(void *args) -{ - struct vkGetDeviceImageSubresourceLayoutKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pLayout); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSubresourceLayoutKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceImageSubresourceLayoutKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pLayout; - } *params = args; - VkDeviceImageSubresourceInfoKHR pInfo_host; - VkSubresourceLayout2KHR pLayout_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pLayout); - - init_conversion_context(ctx); - convert_VkDeviceImageSubresourceInfoKHR_win32_to_host(ctx, (const VkDeviceImageSubresourceInfoKHR32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkSubresourceLayout2KHR_win32_to_host(ctx, (VkSubresourceLayout2KHR32 *)UlongToPtr(params->pLayout), &pLayout_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceImageSubresourceLayoutKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pLayout_host); - convert_VkSubresourceLayout2KHR_host_to_win32(&pLayout_host, (VkSubresourceLayout2KHR32 *)UlongToPtr(params->pLayout)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceMemoryCommitment(void *args) -{ - struct vkGetDeviceMemoryCommitment_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->memory), params->pCommittedMemoryInBytes); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceMemoryCommitment(wine_device_from_handle(params->device)->host_device, wine_device_memory_from_handle(params->memory)->host_memory, params->pCommittedMemoryInBytes); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceMemoryCommitment(void *args) -{ - struct - { - PTR32 device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - PTR32 pCommittedMemoryInBytes; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->memory), params->pCommittedMemoryInBytes); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceMemoryCommitment(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_device_memory_from_handle(params->memory)->host_memory, (VkDeviceSize *)UlongToPtr(params->pCommittedMemoryInBytes)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceMemoryOpaqueCaptureAddress(void *args) -{ - struct vkGetDeviceMemoryOpaqueCaptureAddress_params *params = args; - VkDeviceMemoryOpaqueCaptureAddressInfo pInfo_host; - - TRACE("%p, %p\n", params->device, params->pInfo); - - convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win64_to_host(params->pInfo, &pInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceMemoryOpaqueCaptureAddress(wine_device_from_handle(params->device)->host_device, &pInfo_host); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceMemoryOpaqueCaptureAddress(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - uint64_t result; - } *params = args; - VkDeviceMemoryOpaqueCaptureAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win32_to_host((const VkDeviceMemoryOpaqueCaptureAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceMemoryOpaqueCaptureAddress(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceMemoryOpaqueCaptureAddressKHR(void *args) -{ - struct vkGetDeviceMemoryOpaqueCaptureAddressKHR_params *params = args; - VkDeviceMemoryOpaqueCaptureAddressInfo pInfo_host; - - TRACE("%p, %p\n", params->device, params->pInfo); - - convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win64_to_host(params->pInfo, &pInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceMemoryOpaqueCaptureAddressKHR(wine_device_from_handle(params->device)->host_device, &pInfo_host); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceMemoryOpaqueCaptureAddressKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - uint64_t result; - } *params = args; - VkDeviceMemoryOpaqueCaptureAddressInfo pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win32_to_host((const VkDeviceMemoryOpaqueCaptureAddressInfo32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceMemoryOpaqueCaptureAddressKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceMicromapCompatibilityEXT(void *args) -{ - struct vkGetDeviceMicromapCompatibilityEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pVersionInfo, params->pCompatibility); - - wine_device_from_handle(params->device)->funcs.p_vkGetDeviceMicromapCompatibilityEXT(wine_device_from_handle(params->device)->host_device, params->pVersionInfo, params->pCompatibility); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceMicromapCompatibilityEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pVersionInfo; - PTR32 pCompatibility; - } *params = args; - VkMicromapVersionInfoEXT pVersionInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pVersionInfo, params->pCompatibility); - - convert_VkMicromapVersionInfoEXT_win32_to_host((const VkMicromapVersionInfoEXT32 *)UlongToPtr(params->pVersionInfo), &pVersionInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceMicromapCompatibilityEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pVersionInfo_host, (VkAccelerationStructureCompatibilityKHR *)UlongToPtr(params->pCompatibility)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceQueue(void *args) -{ - struct vkGetDeviceQueue_params *params = args; - - TRACE("%p, %u, %u, %p\n", params->device, params->queueFamilyIndex, params->queueIndex, params->pQueue); - - wine_vkGetDeviceQueue(params->device, params->queueFamilyIndex, params->queueIndex, params->pQueue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceQueue(void *args) -{ - struct - { - PTR32 device; - uint32_t queueFamilyIndex; - uint32_t queueIndex; - PTR32 pQueue; - } *params = args; - VkQueue pQueue_host; - - TRACE("%#x, %u, %u, %#x\n", params->device, params->queueFamilyIndex, params->queueIndex, params->pQueue); - - pQueue_host = UlongToPtr(*(PTR32 *)UlongToPtr(params->pQueue)); - wine_vkGetDeviceQueue((VkDevice)UlongToPtr(params->device), params->queueFamilyIndex, params->queueIndex, &pQueue_host); - *(PTR32 *)UlongToPtr(params->pQueue) = PtrToUlong(pQueue_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceQueue2(void *args) -{ - struct vkGetDeviceQueue2_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pQueueInfo, params->pQueue); - - wine_vkGetDeviceQueue2(params->device, params->pQueueInfo, params->pQueue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceQueue2(void *args) -{ - struct - { - PTR32 device; - PTR32 pQueueInfo; - PTR32 pQueue; - } *params = args; - VkDeviceQueueInfo2 pQueueInfo_host; - VkQueue pQueue_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pQueueInfo, params->pQueue); - - convert_VkDeviceQueueInfo2_win32_to_host((const VkDeviceQueueInfo232 *)UlongToPtr(params->pQueueInfo), &pQueueInfo_host); - pQueue_host = UlongToPtr(*(PTR32 *)UlongToPtr(params->pQueue)); - wine_vkGetDeviceQueue2((VkDevice)UlongToPtr(params->device), &pQueueInfo_host, &pQueue_host); - *(PTR32 *)UlongToPtr(params->pQueue) = PtrToUlong(pQueue_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(void *args) -{ - struct vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->renderpass), params->pMaxWorkgroupSize); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(wine_device_from_handle(params->device)->host_device, params->renderpass, params->pMaxWorkgroupSize); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(void *args) -{ - struct - { - PTR32 device; - VkRenderPass DECLSPEC_ALIGN(8) renderpass; - PTR32 pMaxWorkgroupSize; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->renderpass), params->pMaxWorkgroupSize); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->renderpass, (VkExtent2D *)UlongToPtr(params->pMaxWorkgroupSize)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetDynamicRenderingTilePropertiesQCOM(void *args) -{ - struct vkGetDynamicRenderingTilePropertiesQCOM_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pRenderingInfo, params->pProperties); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDynamicRenderingTilePropertiesQCOM(wine_device_from_handle(params->device)->host_device, params->pRenderingInfo, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetDynamicRenderingTilePropertiesQCOM(void *args) -{ - struct - { - PTR32 device; - PTR32 pRenderingInfo; - PTR32 pProperties; - VkResult result; - } *params = args; - VkRenderingInfo pRenderingInfo_host; - VkTilePropertiesQCOM pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pRenderingInfo, params->pProperties); - - init_conversion_context(ctx); - convert_VkRenderingInfo_win32_to_host(ctx, (const VkRenderingInfo32 *)UlongToPtr(params->pRenderingInfo), &pRenderingInfo_host); - convert_VkTilePropertiesQCOM_win32_to_host((VkTilePropertiesQCOM32 *)UlongToPtr(params->pProperties), &pProperties_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetDynamicRenderingTilePropertiesQCOM(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pRenderingInfo_host, &pProperties_host); - convert_VkTilePropertiesQCOM_host_to_win32(&pProperties_host, (VkTilePropertiesQCOM32 *)UlongToPtr(params->pProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetEventStatus(void *args) -{ - struct vkGetEventStatus_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->event)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetEventStatus(wine_device_from_handle(params->device)->host_device, params->event); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetEventStatus(void *args) -{ - struct - { - PTR32 device; - VkEvent DECLSPEC_ALIGN(8) event; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->event)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetEventStatus(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->event); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetFenceStatus(void *args) -{ - struct vkGetFenceStatus_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->fence)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetFenceStatus(wine_device_from_handle(params->device)->host_device, params->fence); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetFenceStatus(void *args) -{ - struct - { - PTR32 device; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->fence)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetFenceStatus(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->fence); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetFramebufferTilePropertiesQCOM(void *args) -{ - struct vkGetFramebufferTilePropertiesQCOM_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->framebuffer), params->pPropertiesCount, params->pProperties); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetFramebufferTilePropertiesQCOM(wine_device_from_handle(params->device)->host_device, params->framebuffer, params->pPropertiesCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetFramebufferTilePropertiesQCOM(void *args) -{ - struct - { - PTR32 device; - VkFramebuffer DECLSPEC_ALIGN(8) framebuffer; - PTR32 pPropertiesCount; - PTR32 pProperties; - VkResult result; - } *params = args; - VkTilePropertiesQCOM *pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->framebuffer), params->pPropertiesCount, params->pProperties); - - init_conversion_context(ctx); - pProperties_host = convert_VkTilePropertiesQCOM_array_win32_to_host(ctx, (VkTilePropertiesQCOM32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertiesCount)); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetFramebufferTilePropertiesQCOM(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->framebuffer, (uint32_t *)UlongToPtr(params->pPropertiesCount), pProperties_host); - convert_VkTilePropertiesQCOM_array_host_to_win32(pProperties_host, (VkTilePropertiesQCOM32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertiesCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetGeneratedCommandsMemoryRequirementsNV(void *args) -{ - struct vkGetGeneratedCommandsMemoryRequirementsNV_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetGeneratedCommandsMemoryRequirementsNV(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetGeneratedCommandsMemoryRequirementsNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkGeneratedCommandsMemoryRequirementsInfoNV pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkGeneratedCommandsMemoryRequirementsInfoNV_win32_to_host((const VkGeneratedCommandsMemoryRequirementsInfoNV32 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetGeneratedCommandsMemoryRequirementsNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageMemoryRequirements(void *args) -{ - struct vkGetImageMemoryRequirements_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->image), params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->image, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageMemoryRequirements(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - PTR32 pMemoryRequirements; - } *params = args; - VkMemoryRequirements pMemoryRequirements_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->image), params->pMemoryRequirements); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageMemoryRequirements(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, &pMemoryRequirements_host); - convert_VkMemoryRequirements_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements32 *)UlongToPtr(params->pMemoryRequirements)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageMemoryRequirements2(void *args) -{ - struct vkGetImageMemoryRequirements2_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageMemoryRequirements2(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageMemoryRequirements2(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkImageMemoryRequirementsInfo2 pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkImageMemoryRequirementsInfo2_win32_to_host(ctx, (const VkImageMemoryRequirementsInfo232 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageMemoryRequirements2(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageMemoryRequirements2KHR(void *args) -{ - struct vkGetImageMemoryRequirements2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageMemoryRequirements2KHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageMemoryRequirements2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkImageMemoryRequirementsInfo2 pInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkImageMemoryRequirementsInfo2_win32_to_host(ctx, (const VkImageMemoryRequirementsInfo232 *)UlongToPtr(params->pInfo), &pInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageMemoryRequirements2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, &pMemoryRequirements_host); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct vkGetImageOpaqueCaptureDescriptorDataEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetImageOpaqueCaptureDescriptorDataEXT(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pData; - VkResult result; - } *params = args; - VkImageCaptureDescriptorDataInfoEXT pInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pData); - - convert_VkImageCaptureDescriptorDataInfoEXT_win32_to_host((const VkImageCaptureDescriptorDataInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageOpaqueCaptureDescriptorDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageSparseMemoryRequirements(void *args) -{ - struct vkGetImageSparseMemoryRequirements_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->image), params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageSparseMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->image, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageSparseMemoryRequirements(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - PTR32 pSparseMemoryRequirementCount; - PTR32 pSparseMemoryRequirements; - } *params = args; - VkSparseImageMemoryRequirements *pSparseMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->image), params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - init_conversion_context(ctx); - pSparseMemoryRequirements_host = (params->pSparseMemoryRequirements && *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)) ? conversion_context_alloc(ctx, sizeof(*pSparseMemoryRequirements_host) * *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)) : NULL; - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageSparseMemoryRequirements(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, (uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount), pSparseMemoryRequirements_host); - convert_VkSparseImageMemoryRequirements_array_host_to_win32(pSparseMemoryRequirements_host, (VkSparseImageMemoryRequirements32 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageSparseMemoryRequirements2(void *args) -{ - struct vkGetImageSparseMemoryRequirements2_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageSparseMemoryRequirements2(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageSparseMemoryRequirements2(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pSparseMemoryRequirementCount; - PTR32 pSparseMemoryRequirements; - } *params = args; - VkImageSparseMemoryRequirementsInfo2 pInfo_host; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - init_conversion_context(ctx); - convert_VkImageSparseMemoryRequirementsInfo2_win32_to_host((const VkImageSparseMemoryRequirementsInfo232 *)UlongToPtr(params->pInfo), &pInfo_host); - pSparseMemoryRequirements_host = convert_VkSparseImageMemoryRequirements2_array_win32_to_host(ctx, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageSparseMemoryRequirements2(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount), pSparseMemoryRequirements_host); - convert_VkSparseImageMemoryRequirements2_array_host_to_win32(pSparseMemoryRequirements_host, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageSparseMemoryRequirements2KHR(void *args) -{ - struct vkGetImageSparseMemoryRequirements2KHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageSparseMemoryRequirements2KHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageSparseMemoryRequirements2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pSparseMemoryRequirementCount; - PTR32 pSparseMemoryRequirements; - } *params = args; - VkImageSparseMemoryRequirementsInfo2 pInfo_host; - VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); - - init_conversion_context(ctx); - convert_VkImageSparseMemoryRequirementsInfo2_win32_to_host((const VkImageSparseMemoryRequirementsInfo232 *)UlongToPtr(params->pInfo), &pInfo_host); - pSparseMemoryRequirements_host = convert_VkSparseImageMemoryRequirements2_array_win32_to_host(ctx, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageSparseMemoryRequirements2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount), pSparseMemoryRequirements_host); - convert_VkSparseImageMemoryRequirements2_array_host_to_win32(pSparseMemoryRequirements_host, (VkSparseImageMemoryRequirements232 *)UlongToPtr(params->pSparseMemoryRequirements), *(uint32_t *)UlongToPtr(params->pSparseMemoryRequirementCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageSubresourceLayout(void *args) -{ - struct vkGetImageSubresourceLayout_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->image), params->pSubresource, params->pLayout); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageSubresourceLayout(wine_device_from_handle(params->device)->host_device, params->image, params->pSubresource, params->pLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageSubresourceLayout(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - PTR32 pSubresource; - PTR32 pLayout; - } *params = args; - VkSubresourceLayout pLayout_host; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->image), params->pSubresource, params->pLayout); - - convert_VkSubresourceLayout_win32_to_host((VkSubresourceLayout32 *)UlongToPtr(params->pLayout), &pLayout_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageSubresourceLayout(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, (const VkImageSubresource *)UlongToPtr(params->pSubresource), &pLayout_host); - convert_VkSubresourceLayout_host_to_win32(&pLayout_host, (VkSubresourceLayout32 *)UlongToPtr(params->pLayout)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageSubresourceLayout2EXT(void *args) -{ - struct vkGetImageSubresourceLayout2EXT_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->image), params->pSubresource, params->pLayout); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageSubresourceLayout2EXT(wine_device_from_handle(params->device)->host_device, params->image, params->pSubresource, params->pLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageSubresourceLayout2EXT(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - PTR32 pSubresource; - PTR32 pLayout; - } *params = args; - VkImageSubresource2KHR pSubresource_host; - VkSubresourceLayout2KHR pLayout_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->image), params->pSubresource, params->pLayout); - - init_conversion_context(ctx); - convert_VkImageSubresource2KHR_win32_to_host((const VkImageSubresource2KHR32 *)UlongToPtr(params->pSubresource), &pSubresource_host); - convert_VkSubresourceLayout2KHR_win32_to_host(ctx, (VkSubresourceLayout2KHR32 *)UlongToPtr(params->pLayout), &pLayout_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageSubresourceLayout2EXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, &pSubresource_host, &pLayout_host); - convert_VkSubresourceLayout2KHR_host_to_win32(&pLayout_host, (VkSubresourceLayout2KHR32 *)UlongToPtr(params->pLayout)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageSubresourceLayout2KHR(void *args) -{ - struct vkGetImageSubresourceLayout2KHR_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->image), params->pSubresource, params->pLayout); - - wine_device_from_handle(params->device)->funcs.p_vkGetImageSubresourceLayout2KHR(wine_device_from_handle(params->device)->host_device, params->image, params->pSubresource, params->pLayout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageSubresourceLayout2KHR(void *args) -{ - struct - { - PTR32 device; - VkImage DECLSPEC_ALIGN(8) image; - PTR32 pSubresource; - PTR32 pLayout; - } *params = args; - VkImageSubresource2KHR pSubresource_host; - VkSubresourceLayout2KHR pLayout_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->image), params->pSubresource, params->pLayout); - - init_conversion_context(ctx); - convert_VkImageSubresource2KHR_win32_to_host((const VkImageSubresource2KHR32 *)UlongToPtr(params->pSubresource), &pSubresource_host); - convert_VkSubresourceLayout2KHR_win32_to_host(ctx, (VkSubresourceLayout2KHR32 *)UlongToPtr(params->pLayout), &pLayout_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageSubresourceLayout2KHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->image, &pSubresource_host, &pLayout_host); - convert_VkSubresourceLayout2KHR_host_to_win32(&pLayout_host, (VkSubresourceLayout2KHR32 *)UlongToPtr(params->pLayout)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageViewAddressNVX(void *args) -{ - struct vkGetImageViewAddressNVX_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->imageView), params->pProperties); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetImageViewAddressNVX(wine_device_from_handle(params->device)->host_device, params->imageView, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageViewAddressNVX(void *args) -{ - struct - { - PTR32 device; - VkImageView DECLSPEC_ALIGN(8) imageView; - PTR32 pProperties; - VkResult result; - } *params = args; - VkImageViewAddressPropertiesNVX pProperties_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->imageView), params->pProperties); - - convert_VkImageViewAddressPropertiesNVX_win32_to_host((VkImageViewAddressPropertiesNVX32 *)UlongToPtr(params->pProperties), &pProperties_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageViewAddressNVX(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->imageView, &pProperties_host); - convert_VkImageViewAddressPropertiesNVX_host_to_win32(&pProperties_host, (VkImageViewAddressPropertiesNVX32 *)UlongToPtr(params->pProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageViewHandleNVX(void *args) -{ - struct vkGetImageViewHandleNVX_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetImageViewHandleNVX(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageViewHandleNVX(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - uint32_t result; - } *params = args; - VkImageViewHandleInfoNVX pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkImageViewHandleInfoNVX_win32_to_host((const VkImageViewHandleInfoNVX32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageViewHandleNVX(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetImageViewOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct vkGetImageViewOpaqueCaptureDescriptorDataEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetImageViewOpaqueCaptureDescriptorDataEXT(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetImageViewOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pData; - VkResult result; - } *params = args; - VkImageViewCaptureDescriptorDataInfoEXT pInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pData); - - convert_VkImageViewCaptureDescriptorDataInfoEXT_win32_to_host((const VkImageViewCaptureDescriptorDataInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetImageViewOpaqueCaptureDescriptorDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetLatencyTimingsNV(void *args) -{ - struct vkGetLatencyTimingsNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo); - - wine_device_from_handle(params->device)->funcs.p_vkGetLatencyTimingsNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pLatencyMarkerInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetLatencyTimingsNV(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - PTR32 pLatencyMarkerInfo; - } *params = args; - VkGetLatencyMarkerInfoNV pLatencyMarkerInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo); - - init_conversion_context(ctx); - convert_VkGetLatencyMarkerInfoNV_win32_to_host(ctx, (VkGetLatencyMarkerInfoNV32 *)UlongToPtr(params->pLatencyMarkerInfo), &pLatencyMarkerInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetLatencyTimingsNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pLatencyMarkerInfo_host); - convert_VkGetLatencyMarkerInfoNV_host_to_win32(&pLatencyMarkerInfo_host, (VkGetLatencyMarkerInfoNV32 *)UlongToPtr(params->pLatencyMarkerInfo)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetMemoryHostPointerPropertiesEXT(void *args) -{ - struct vkGetMemoryHostPointerPropertiesEXT_params *params = args; - - TRACE("%p, %#x, %p, %p\n", params->device, params->handleType, params->pHostPointer, params->pMemoryHostPointerProperties); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetMemoryHostPointerPropertiesEXT(wine_device_from_handle(params->device)->host_device, params->handleType, params->pHostPointer, params->pMemoryHostPointerProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetMemoryHostPointerPropertiesEXT(void *args) -{ - struct - { - PTR32 device; - VkExternalMemoryHandleTypeFlagBits handleType; - PTR32 pHostPointer; - PTR32 pMemoryHostPointerProperties; - VkResult result; - } *params = args; - VkMemoryHostPointerPropertiesEXT pMemoryHostPointerProperties_host; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->handleType, params->pHostPointer, params->pMemoryHostPointerProperties); - - convert_VkMemoryHostPointerPropertiesEXT_win32_to_host((VkMemoryHostPointerPropertiesEXT32 *)UlongToPtr(params->pMemoryHostPointerProperties), &pMemoryHostPointerProperties_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetMemoryHostPointerPropertiesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->handleType, (const void *)UlongToPtr(params->pHostPointer), &pMemoryHostPointerProperties_host); - convert_VkMemoryHostPointerPropertiesEXT_host_to_win32(&pMemoryHostPointerProperties_host, (VkMemoryHostPointerPropertiesEXT32 *)UlongToPtr(params->pMemoryHostPointerProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetMicromapBuildSizesEXT(void *args) -{ - struct vkGetMicromapBuildSizesEXT_params *params = args; - - TRACE("%p, %#x, %p, %p\n", params->device, params->buildType, params->pBuildInfo, params->pSizeInfo); - - wine_device_from_handle(params->device)->funcs.p_vkGetMicromapBuildSizesEXT(wine_device_from_handle(params->device)->host_device, params->buildType, params->pBuildInfo, params->pSizeInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetMicromapBuildSizesEXT(void *args) -{ - struct - { - PTR32 device; - VkAccelerationStructureBuildTypeKHR buildType; - PTR32 pBuildInfo; - PTR32 pSizeInfo; - } *params = args; - VkMicromapBuildInfoEXT pBuildInfo_host; - VkMicromapBuildSizesInfoEXT pSizeInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->buildType, params->pBuildInfo, params->pSizeInfo); - - init_conversion_context(ctx); - convert_VkMicromapBuildInfoEXT_win32_to_host(ctx, (const VkMicromapBuildInfoEXT32 *)UlongToPtr(params->pBuildInfo), &pBuildInfo_host); - convert_VkMicromapBuildSizesInfoEXT_win32_to_host((VkMicromapBuildSizesInfoEXT32 *)UlongToPtr(params->pSizeInfo), &pSizeInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetMicromapBuildSizesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->buildType, &pBuildInfo_host, &pSizeInfo_host); - convert_VkMicromapBuildSizesInfoEXT_host_to_win32(&pSizeInfo_host, (VkMicromapBuildSizesInfoEXT32 *)UlongToPtr(params->pSizeInfo)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPerformanceParameterINTEL(void *args) -{ - struct vkGetPerformanceParameterINTEL_params *params = args; - - 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)->host_device, params->parameter, params->pValue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPerformanceParameterINTEL(void *args) -{ - struct - { - PTR32 device; - VkPerformanceParameterTypeINTEL parameter; - PTR32 pValue; - VkResult result; - } *params = args; - VkPerformanceValueINTEL pValue_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->parameter, params->pValue); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPerformanceParameterINTEL(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->parameter, &pValue_host); - convert_VkPerformanceValueINTEL_host_to_win32(&pValue_host, (VkPerformanceValueINTEL32 *)UlongToPtr(params->pValue)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(void *args) -{ - struct vkGetPhysicalDeviceCalibrateableTimeDomainsEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pTimeDomainCount, params->pTimeDomains); - - params->result = wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(params->physicalDevice, params->pTimeDomainCount, params->pTimeDomains); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pTimeDomainCount; - PTR32 pTimeDomains; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pTimeDomainCount, params->pTimeDomains); - - params->result = wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT((VkPhysicalDevice)UlongToPtr(params->physicalDevice), (uint32_t *)UlongToPtr(params->pTimeDomainCount), (VkTimeDomainEXT *)UlongToPtr(params->pTimeDomains)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(void *args) -{ - struct vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pPropertyCount, params->pProperties); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pPropertyCount; - PTR32 pProperties; - VkResult result; - } *params = args; - VkCooperativeMatrixPropertiesKHR *pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pPropertyCount, params->pProperties); - - init_conversion_context(ctx); - pProperties_host = convert_VkCooperativeMatrixPropertiesKHR_array_win32_to_host(ctx, (VkCooperativeMatrixPropertiesKHR32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pPropertyCount), pProperties_host); - convert_VkCooperativeMatrixPropertiesKHR_array_host_to_win32(pProperties_host, (VkCooperativeMatrixPropertiesKHR32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(void *args) -{ - struct vkGetPhysicalDeviceCooperativeMatrixPropertiesNV_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pPropertyCount, params->pProperties); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pPropertyCount; - PTR32 pProperties; - VkResult result; - } *params = args; - VkCooperativeMatrixPropertiesNV *pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pPropertyCount, params->pProperties); - - init_conversion_context(ctx); - pProperties_host = convert_VkCooperativeMatrixPropertiesNV_array_win32_to_host(ctx, (VkCooperativeMatrixPropertiesNV32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pPropertyCount), pProperties_host); - convert_VkCooperativeMatrixPropertiesNV_array_host_to_win32(pProperties_host, (VkCooperativeMatrixPropertiesNV32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceExternalBufferProperties(void *args) -{ - struct vkGetPhysicalDeviceExternalBufferProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); - - wine_vkGetPhysicalDeviceExternalBufferProperties(params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceExternalBufferProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pExternalBufferInfo; - PTR32 pExternalBufferProperties; - } *params = args; - VkPhysicalDeviceExternalBufferInfo pExternalBufferInfo_host; - VkExternalBufferProperties pExternalBufferProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceExternalBufferInfo_win32_to_host(ctx, (const VkPhysicalDeviceExternalBufferInfo32 *)UlongToPtr(params->pExternalBufferInfo), &pExternalBufferInfo_host); - convert_VkExternalBufferProperties_win32_to_host((VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties), &pExternalBufferProperties_host); - wine_vkGetPhysicalDeviceExternalBufferProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalBufferInfo_host, &pExternalBufferProperties_host); - convert_VkExternalBufferProperties_host_to_win32(&pExternalBufferProperties_host, (VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceExternalBufferPropertiesKHR(void *args) -{ - struct vkGetPhysicalDeviceExternalBufferPropertiesKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); - - wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceExternalBufferPropertiesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pExternalBufferInfo; - PTR32 pExternalBufferProperties; - } *params = args; - VkPhysicalDeviceExternalBufferInfo pExternalBufferInfo_host; - VkExternalBufferProperties pExternalBufferProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pExternalBufferInfo, params->pExternalBufferProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceExternalBufferInfo_win32_to_host(ctx, (const VkPhysicalDeviceExternalBufferInfo32 *)UlongToPtr(params->pExternalBufferInfo), &pExternalBufferInfo_host); - convert_VkExternalBufferProperties_win32_to_host((VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties), &pExternalBufferProperties_host); - wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalBufferInfo_host, &pExternalBufferProperties_host); - convert_VkExternalBufferProperties_host_to_win32(&pExternalBufferProperties_host, (VkExternalBufferProperties32 *)UlongToPtr(params->pExternalBufferProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceExternalFenceProperties(void *args) -{ - struct vkGetPhysicalDeviceExternalFenceProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalFenceInfo, params->pExternalFenceProperties); - - wine_vkGetPhysicalDeviceExternalFenceProperties(params->physicalDevice, params->pExternalFenceInfo, params->pExternalFenceProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceExternalFenceProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pExternalFenceInfo; - PTR32 pExternalFenceProperties; - } *params = args; - VkPhysicalDeviceExternalFenceInfo pExternalFenceInfo_host; - VkExternalFenceProperties pExternalFenceProperties_host; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pExternalFenceInfo, params->pExternalFenceProperties); - - convert_VkPhysicalDeviceExternalFenceInfo_win32_to_host((const VkPhysicalDeviceExternalFenceInfo32 *)UlongToPtr(params->pExternalFenceInfo), &pExternalFenceInfo_host); - convert_VkExternalFenceProperties_win32_to_host((VkExternalFenceProperties32 *)UlongToPtr(params->pExternalFenceProperties), &pExternalFenceProperties_host); - wine_vkGetPhysicalDeviceExternalFenceProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalFenceInfo_host, &pExternalFenceProperties_host); - convert_VkExternalFenceProperties_host_to_win32(&pExternalFenceProperties_host, (VkExternalFenceProperties32 *)UlongToPtr(params->pExternalFenceProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceExternalFencePropertiesKHR(void *args) -{ - struct vkGetPhysicalDeviceExternalFencePropertiesKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalFenceInfo, params->pExternalFenceProperties); - - wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(params->physicalDevice, params->pExternalFenceInfo, params->pExternalFenceProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceExternalFencePropertiesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pExternalFenceInfo; - PTR32 pExternalFenceProperties; - } *params = args; - VkPhysicalDeviceExternalFenceInfo pExternalFenceInfo_host; - VkExternalFenceProperties pExternalFenceProperties_host; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pExternalFenceInfo, params->pExternalFenceProperties); - - convert_VkPhysicalDeviceExternalFenceInfo_win32_to_host((const VkPhysicalDeviceExternalFenceInfo32 *)UlongToPtr(params->pExternalFenceInfo), &pExternalFenceInfo_host); - convert_VkExternalFenceProperties_win32_to_host((VkExternalFenceProperties32 *)UlongToPtr(params->pExternalFenceProperties), &pExternalFenceProperties_host); - wine_vkGetPhysicalDeviceExternalFencePropertiesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalFenceInfo_host, &pExternalFenceProperties_host); - convert_VkExternalFenceProperties_host_to_win32(&pExternalFenceProperties_host, (VkExternalFenceProperties32 *)UlongToPtr(params->pExternalFenceProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceExternalSemaphoreProperties(void *args) -{ - struct vkGetPhysicalDeviceExternalSemaphoreProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalSemaphoreInfo, params->pExternalSemaphoreProperties); - - wine_vkGetPhysicalDeviceExternalSemaphoreProperties(params->physicalDevice, params->pExternalSemaphoreInfo, params->pExternalSemaphoreProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceExternalSemaphoreProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pExternalSemaphoreInfo; - PTR32 pExternalSemaphoreProperties; - } *params = args; - VkPhysicalDeviceExternalSemaphoreInfo pExternalSemaphoreInfo_host; - VkExternalSemaphoreProperties pExternalSemaphoreProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pExternalSemaphoreInfo, params->pExternalSemaphoreProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceExternalSemaphoreInfo_win32_to_host(ctx, (const VkPhysicalDeviceExternalSemaphoreInfo32 *)UlongToPtr(params->pExternalSemaphoreInfo), &pExternalSemaphoreInfo_host); - convert_VkExternalSemaphoreProperties_win32_to_host((VkExternalSemaphoreProperties32 *)UlongToPtr(params->pExternalSemaphoreProperties), &pExternalSemaphoreProperties_host); - wine_vkGetPhysicalDeviceExternalSemaphoreProperties((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalSemaphoreInfo_host, &pExternalSemaphoreProperties_host); - convert_VkExternalSemaphoreProperties_host_to_win32(&pExternalSemaphoreProperties_host, (VkExternalSemaphoreProperties32 *)UlongToPtr(params->pExternalSemaphoreProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(void *args) -{ - struct vkGetPhysicalDeviceExternalSemaphorePropertiesKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pExternalSemaphoreInfo, params->pExternalSemaphoreProperties); - - wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(params->physicalDevice, params->pExternalSemaphoreInfo, params->pExternalSemaphoreProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pExternalSemaphoreInfo; - PTR32 pExternalSemaphoreProperties; - } *params = args; - VkPhysicalDeviceExternalSemaphoreInfo pExternalSemaphoreInfo_host; - VkExternalSemaphoreProperties pExternalSemaphoreProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pExternalSemaphoreInfo, params->pExternalSemaphoreProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceExternalSemaphoreInfo_win32_to_host(ctx, (const VkPhysicalDeviceExternalSemaphoreInfo32 *)UlongToPtr(params->pExternalSemaphoreInfo), &pExternalSemaphoreInfo_host); - convert_VkExternalSemaphoreProperties_win32_to_host((VkExternalSemaphoreProperties32 *)UlongToPtr(params->pExternalSemaphoreProperties), &pExternalSemaphoreProperties_host); - wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pExternalSemaphoreInfo_host, &pExternalSemaphoreProperties_host); - convert_VkExternalSemaphoreProperties_host_to_win32(&pExternalSemaphoreProperties_host, (VkExternalSemaphoreProperties32 *)UlongToPtr(params->pExternalSemaphoreProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFeatures(void *args) -{ - struct vkGetPhysicalDeviceFeatures_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pFeatures); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFeatures(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pFeatures); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFeatures(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pFeatures; - } *params = args; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pFeatures); - - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFeatures(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (VkPhysicalDeviceFeatures *)UlongToPtr(params->pFeatures)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFeatures2(void *args) -{ - struct vkGetPhysicalDeviceFeatures2_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pFeatures); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFeatures2(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pFeatures); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFeatures2(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pFeatures; - } *params = args; - VkPhysicalDeviceFeatures2 pFeatures_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pFeatures); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceFeatures2_win32_to_host(ctx, (VkPhysicalDeviceFeatures232 *)UlongToPtr(params->pFeatures), &pFeatures_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFeatures2(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pFeatures_host); - convert_VkPhysicalDeviceFeatures2_host_to_win32(&pFeatures_host, (VkPhysicalDeviceFeatures232 *)UlongToPtr(params->pFeatures)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFeatures2KHR(void *args) -{ - struct vkGetPhysicalDeviceFeatures2KHR_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pFeatures); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFeatures2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pFeatures); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFeatures2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pFeatures; - } *params = args; - VkPhysicalDeviceFeatures2 pFeatures_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pFeatures); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceFeatures2_win32_to_host(ctx, (VkPhysicalDeviceFeatures232 *)UlongToPtr(params->pFeatures), &pFeatures_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFeatures2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pFeatures_host); - convert_VkPhysicalDeviceFeatures2_host_to_win32(&pFeatures_host, (VkPhysicalDeviceFeatures232 *)UlongToPtr(params->pFeatures)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFormatProperties(void *args) -{ - struct vkGetPhysicalDeviceFormatProperties_params *params = args; - - TRACE("%p, %#x, %p\n", params->physicalDevice, params->format, params->pFormatProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFormatProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->format, params->pFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFormatProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - VkFormat format; - PTR32 pFormatProperties; - } *params = args; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->format, params->pFormatProperties); - - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFormatProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->format, (VkFormatProperties *)UlongToPtr(params->pFormatProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFormatProperties2(void *args) -{ - struct vkGetPhysicalDeviceFormatProperties2_params *params = args; - - TRACE("%p, %#x, %p\n", params->physicalDevice, params->format, params->pFormatProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFormatProperties2(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->format, params->pFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFormatProperties2(void *args) -{ - struct - { - PTR32 physicalDevice; - VkFormat format; - PTR32 pFormatProperties; - } *params = args; - VkFormatProperties2 pFormatProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->format, params->pFormatProperties); - - init_conversion_context(ctx); - convert_VkFormatProperties2_win32_to_host(ctx, (VkFormatProperties232 *)UlongToPtr(params->pFormatProperties), &pFormatProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFormatProperties2(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->format, &pFormatProperties_host); - convert_VkFormatProperties2_host_to_win32(&pFormatProperties_host, (VkFormatProperties232 *)UlongToPtr(params->pFormatProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFormatProperties2KHR(void *args) -{ - struct vkGetPhysicalDeviceFormatProperties2KHR_params *params = args; - - TRACE("%p, %#x, %p\n", params->physicalDevice, params->format, params->pFormatProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFormatProperties2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->format, params->pFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFormatProperties2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - VkFormat format; - PTR32 pFormatProperties; - } *params = args; - VkFormatProperties2 pFormatProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->format, params->pFormatProperties); - - init_conversion_context(ctx); - convert_VkFormatProperties2_win32_to_host(ctx, (VkFormatProperties232 *)UlongToPtr(params->pFormatProperties), &pFormatProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFormatProperties2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->format, &pFormatProperties_host); - convert_VkFormatProperties2_host_to_win32(&pFormatProperties_host, (VkFormatProperties232 *)UlongToPtr(params->pFormatProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceFragmentShadingRatesKHR(void *args) -{ - struct vkGetPhysicalDeviceFragmentShadingRatesKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pFragmentShadingRateCount, params->pFragmentShadingRates); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceFragmentShadingRatesKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pFragmentShadingRateCount, params->pFragmentShadingRates); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceFragmentShadingRatesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pFragmentShadingRateCount; - PTR32 pFragmentShadingRates; - VkResult result; - } *params = args; - VkPhysicalDeviceFragmentShadingRateKHR *pFragmentShadingRates_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pFragmentShadingRateCount, params->pFragmentShadingRates); - - init_conversion_context(ctx); - pFragmentShadingRates_host = convert_VkPhysicalDeviceFragmentShadingRateKHR_array_win32_to_host(ctx, (VkPhysicalDeviceFragmentShadingRateKHR32 *)UlongToPtr(params->pFragmentShadingRates), *(uint32_t *)UlongToPtr(params->pFragmentShadingRateCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceFragmentShadingRatesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pFragmentShadingRateCount), pFragmentShadingRates_host); - convert_VkPhysicalDeviceFragmentShadingRateKHR_array_host_to_win32(pFragmentShadingRates_host, (VkPhysicalDeviceFragmentShadingRateKHR32 *)UlongToPtr(params->pFragmentShadingRates), *(uint32_t *)UlongToPtr(params->pFragmentShadingRateCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceImageFormatProperties(void *args) -{ - struct vkGetPhysicalDeviceImageFormatProperties_params *params = args; - - TRACE("%p, %#x, %#x, %#x, %#x, %#x, %p\n", params->physicalDevice, params->format, params->type, params->tiling, params->usage, params->flags, params->pImageFormatProperties); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->format, params->type, params->tiling, params->usage, params->flags, params->pImageFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - VkFormat format; - VkImageType type; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkImageCreateFlags flags; - PTR32 pImageFormatProperties; - VkResult result; - } *params = args; - VkImageFormatProperties pImageFormatProperties_host; - - TRACE("%#x, %#x, %#x, %#x, %#x, %#x, %#x\n", params->physicalDevice, params->format, params->type, params->tiling, params->usage, params->flags, params->pImageFormatProperties); - - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->format, params->type, params->tiling, params->usage, params->flags, &pImageFormatProperties_host); - convert_VkImageFormatProperties_host_to_win32(&pImageFormatProperties_host, (VkImageFormatProperties32 *)UlongToPtr(params->pImageFormatProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceImageFormatProperties2(void *args) -{ - struct vkGetPhysicalDeviceImageFormatProperties2_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); - - params->result = wine_vkGetPhysicalDeviceImageFormatProperties2(params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties2(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pImageFormatInfo; - PTR32 pImageFormatProperties; - VkResult result; - } *params = args; - VkPhysicalDeviceImageFormatInfo2 pImageFormatInfo_host; - VkImageFormatProperties2 pImageFormatProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceImageFormatInfo2_win32_to_host(ctx, (const VkPhysicalDeviceImageFormatInfo232 *)UlongToPtr(params->pImageFormatInfo), &pImageFormatInfo_host); - convert_VkImageFormatProperties2_win32_to_host(ctx, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties), &pImageFormatProperties_host); - params->result = wine_vkGetPhysicalDeviceImageFormatProperties2((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pImageFormatInfo_host, &pImageFormatProperties_host); - convert_VkImageFormatProperties2_host_to_win32(&pImageFormatProperties_host, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceImageFormatProperties2KHR(void *args) -{ - struct vkGetPhysicalDeviceImageFormatProperties2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); - - params->result = wine_vkGetPhysicalDeviceImageFormatProperties2KHR(params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceImageFormatProperties2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pImageFormatInfo; - PTR32 pImageFormatProperties; - VkResult result; - } *params = args; - VkPhysicalDeviceImageFormatInfo2 pImageFormatInfo_host; - VkImageFormatProperties2 pImageFormatProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pImageFormatInfo, params->pImageFormatProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceImageFormatInfo2_win32_to_host(ctx, (const VkPhysicalDeviceImageFormatInfo232 *)UlongToPtr(params->pImageFormatInfo), &pImageFormatInfo_host); - convert_VkImageFormatProperties2_win32_to_host(ctx, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties), &pImageFormatProperties_host); - params->result = wine_vkGetPhysicalDeviceImageFormatProperties2KHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pImageFormatInfo_host, &pImageFormatProperties_host); - convert_VkImageFormatProperties2_host_to_win32(&pImageFormatProperties_host, (VkImageFormatProperties232 *)UlongToPtr(params->pImageFormatProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceMemoryProperties(void *args) -{ - struct vkGetPhysicalDeviceMemoryProperties_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pMemoryProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pMemoryProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceMemoryProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pMemoryProperties; - } *params = args; - VkPhysicalDeviceMemoryProperties pMemoryProperties_host; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pMemoryProperties); - - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pMemoryProperties_host); - convert_VkPhysicalDeviceMemoryProperties_host_to_win32(&pMemoryProperties_host, (VkPhysicalDeviceMemoryProperties32 *)UlongToPtr(params->pMemoryProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceMemoryProperties2(void *args) -{ - struct vkGetPhysicalDeviceMemoryProperties2_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pMemoryProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties2(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pMemoryProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceMemoryProperties2(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pMemoryProperties; - } *params = args; - VkPhysicalDeviceMemoryProperties2 pMemoryProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pMemoryProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceMemoryProperties2_win32_to_host(ctx, (VkPhysicalDeviceMemoryProperties232 *)UlongToPtr(params->pMemoryProperties), &pMemoryProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties2(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pMemoryProperties_host); - convert_VkPhysicalDeviceMemoryProperties2_host_to_win32(&pMemoryProperties_host, (VkPhysicalDeviceMemoryProperties232 *)UlongToPtr(params->pMemoryProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceMemoryProperties2KHR(void *args) -{ - struct vkGetPhysicalDeviceMemoryProperties2KHR_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pMemoryProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pMemoryProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceMemoryProperties2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pMemoryProperties; - } *params = args; - VkPhysicalDeviceMemoryProperties2 pMemoryProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pMemoryProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceMemoryProperties2_win32_to_host(ctx, (VkPhysicalDeviceMemoryProperties232 *)UlongToPtr(params->pMemoryProperties), &pMemoryProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pMemoryProperties_host); - convert_VkPhysicalDeviceMemoryProperties2_host_to_win32(&pMemoryProperties_host, (VkPhysicalDeviceMemoryProperties232 *)UlongToPtr(params->pMemoryProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceMultisamplePropertiesEXT(void *args) -{ - struct vkGetPhysicalDeviceMultisamplePropertiesEXT_params *params = args; - - TRACE("%p, %#x, %p\n", params->physicalDevice, params->samples, params->pMultisampleProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceMultisamplePropertiesEXT(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->samples, params->pMultisampleProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceMultisamplePropertiesEXT(void *args) -{ - struct - { - PTR32 physicalDevice; - VkSampleCountFlagBits samples; - PTR32 pMultisampleProperties; - } *params = args; - VkMultisamplePropertiesEXT pMultisampleProperties_host; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->samples, params->pMultisampleProperties); - - convert_VkMultisamplePropertiesEXT_win32_to_host((VkMultisamplePropertiesEXT32 *)UlongToPtr(params->pMultisampleProperties), &pMultisampleProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceMultisamplePropertiesEXT(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->samples, &pMultisampleProperties_host); - convert_VkMultisamplePropertiesEXT_host_to_win32(&pMultisampleProperties_host, (VkMultisamplePropertiesEXT32 *)UlongToPtr(params->pMultisampleProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceOpticalFlowImageFormatsNV(void *args) -{ - struct vkGetPhysicalDeviceOpticalFlowImageFormatsNV_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->physicalDevice, params->pOpticalFlowImageFormatInfo, params->pFormatCount, params->pImageFormatProperties); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceOpticalFlowImageFormatsNV(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pOpticalFlowImageFormatInfo, params->pFormatCount, params->pImageFormatProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceOpticalFlowImageFormatsNV(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pOpticalFlowImageFormatInfo; - PTR32 pFormatCount; - PTR32 pImageFormatProperties; - VkResult result; - } *params = args; - VkOpticalFlowImageFormatInfoNV pOpticalFlowImageFormatInfo_host; - VkOpticalFlowImageFormatPropertiesNV *pImageFormatProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->physicalDevice, params->pOpticalFlowImageFormatInfo, params->pFormatCount, params->pImageFormatProperties); - - init_conversion_context(ctx); - convert_VkOpticalFlowImageFormatInfoNV_win32_to_host((const VkOpticalFlowImageFormatInfoNV32 *)UlongToPtr(params->pOpticalFlowImageFormatInfo), &pOpticalFlowImageFormatInfo_host); - pImageFormatProperties_host = convert_VkOpticalFlowImageFormatPropertiesNV_array_win32_to_host(ctx, (VkOpticalFlowImageFormatPropertiesNV32 *)UlongToPtr(params->pImageFormatProperties), *(uint32_t *)UlongToPtr(params->pFormatCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceOpticalFlowImageFormatsNV(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pOpticalFlowImageFormatInfo_host, (uint32_t *)UlongToPtr(params->pFormatCount), pImageFormatProperties_host); - convert_VkOpticalFlowImageFormatPropertiesNV_array_host_to_win32(pImageFormatProperties_host, (VkOpticalFlowImageFormatPropertiesNV32 *)UlongToPtr(params->pImageFormatProperties), *(uint32_t *)UlongToPtr(params->pFormatCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDevicePresentRectanglesKHR(void *args) -{ - struct vkGetPhysicalDevicePresentRectanglesKHR_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pRectCount, params->pRects); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, wine_surface_from_handle(params->surface)->driver_surface, params->pRectCount, params->pRects); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDevicePresentRectanglesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pRectCount; - PTR32 pRects; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pRectCount, params->pRects); - - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDevicePresentRectanglesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, wine_surface_from_handle(params->surface)->driver_surface, (uint32_t *)UlongToPtr(params->pRectCount), (VkRect2D *)UlongToPtr(params->pRects)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceProperties(void *args) -{ - struct vkGetPhysicalDeviceProperties_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pProperties; - } *params = args; - VkPhysicalDeviceProperties pProperties_host; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pProperties); - - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pProperties_host); - convert_VkPhysicalDeviceProperties_host_to_win32(&pProperties_host, (VkPhysicalDeviceProperties32 *)UlongToPtr(params->pProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceProperties2(void *args) -{ - struct vkGetPhysicalDeviceProperties2_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceProperties2(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceProperties2(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pProperties; - } *params = args; - VkPhysicalDeviceProperties2 pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceProperties2_win32_to_host(ctx, (VkPhysicalDeviceProperties232 *)UlongToPtr(params->pProperties), &pProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceProperties2(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pProperties_host); - convert_VkPhysicalDeviceProperties2_host_to_win32(&pProperties_host, (VkPhysicalDeviceProperties232 *)UlongToPtr(params->pProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceProperties2KHR(void *args) -{ - struct vkGetPhysicalDeviceProperties2KHR_params *params = args; - - TRACE("%p, %p\n", params->physicalDevice, params->pProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceProperties2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceProperties2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pProperties; - } *params = args; - VkPhysicalDeviceProperties2 pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->physicalDevice, params->pProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceProperties2_win32_to_host(ctx, (VkPhysicalDeviceProperties232 *)UlongToPtr(params->pProperties), &pProperties_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceProperties2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pProperties_host); - convert_VkPhysicalDeviceProperties2_host_to_win32(&pProperties_host, (VkPhysicalDeviceProperties232 *)UlongToPtr(params->pProperties)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(void *args) -{ - struct vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pPerformanceQueryCreateInfo, params->pNumPasses); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pPerformanceQueryCreateInfo, params->pNumPasses); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pPerformanceQueryCreateInfo; - PTR32 pNumPasses; - } *params = args; - VkQueryPoolPerformanceCreateInfoKHR pPerformanceQueryCreateInfo_host; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pPerformanceQueryCreateInfo, params->pNumPasses); - - convert_VkQueryPoolPerformanceCreateInfoKHR_win32_to_host((const VkQueryPoolPerformanceCreateInfoKHR32 *)UlongToPtr(params->pPerformanceQueryCreateInfo), &pPerformanceQueryCreateInfo_host); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pPerformanceQueryCreateInfo_host, (uint32_t *)UlongToPtr(params->pNumPasses)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceQueueFamilyProperties(void *args) -{ - struct vkGetPhysicalDeviceQueueFamilyProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceQueueFamilyProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pQueueFamilyPropertyCount; - PTR32 pQueueFamilyProperties; - } *params = args; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount), (VkQueueFamilyProperties *)UlongToPtr(params->pQueueFamilyProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceQueueFamilyProperties2(void *args) -{ - struct vkGetPhysicalDeviceQueueFamilyProperties2_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties2(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceQueueFamilyProperties2(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pQueueFamilyPropertyCount; - PTR32 pQueueFamilyProperties; - } *params = args; - VkQueueFamilyProperties2 *pQueueFamilyProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - - init_conversion_context(ctx); - pQueueFamilyProperties_host = convert_VkQueueFamilyProperties2_array_win32_to_host(ctx, (VkQueueFamilyProperties232 *)UlongToPtr(params->pQueueFamilyProperties), *(uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount)); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties2(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount), pQueueFamilyProperties_host); - convert_VkQueueFamilyProperties2_array_host_to_win32(pQueueFamilyProperties_host, (VkQueueFamilyProperties232 *)UlongToPtr(params->pQueueFamilyProperties), *(uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceQueueFamilyProperties2KHR(void *args) -{ - struct vkGetPhysicalDeviceQueueFamilyProperties2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceQueueFamilyProperties2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pQueueFamilyPropertyCount; - PTR32 pQueueFamilyProperties; - } *params = args; - VkQueueFamilyProperties2 *pQueueFamilyProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pQueueFamilyPropertyCount, params->pQueueFamilyProperties); - - init_conversion_context(ctx); - pQueueFamilyProperties_host = convert_VkQueueFamilyProperties2_array_win32_to_host(ctx, (VkQueueFamilyProperties232 *)UlongToPtr(params->pQueueFamilyProperties), *(uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount)); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount), pQueueFamilyProperties_host); - convert_VkQueueFamilyProperties2_array_host_to_win32(pQueueFamilyProperties_host, (VkQueueFamilyProperties232 *)UlongToPtr(params->pQueueFamilyProperties), *(uint32_t *)UlongToPtr(params->pQueueFamilyPropertyCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSparseImageFormatProperties(void *args) -{ - struct vkGetPhysicalDeviceSparseImageFormatProperties_params *params = args; - - TRACE("%p, %#x, %#x, %#x, %#x, %#x, %p, %p\n", params->physicalDevice, params->format, params->type, params->samples, params->usage, params->tiling, params->pPropertyCount, params->pProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->format, params->type, params->samples, params->usage, params->tiling, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSparseImageFormatProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - VkFormat format; - VkImageType type; - VkSampleCountFlagBits samples; - VkImageUsageFlags usage; - VkImageTiling tiling; - PTR32 pPropertyCount; - PTR32 pProperties; - } *params = args; - - TRACE("%#x, %#x, %#x, %#x, %#x, %#x, %#x, %#x\n", params->physicalDevice, params->format, params->type, params->samples, params->usage, params->tiling, params->pPropertyCount, params->pProperties); - - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->format, params->type, params->samples, params->usage, params->tiling, (uint32_t *)UlongToPtr(params->pPropertyCount), (VkSparseImageFormatProperties *)UlongToPtr(params->pProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSparseImageFormatProperties2(void *args) -{ - struct vkGetPhysicalDeviceSparseImageFormatProperties2_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->physicalDevice, params->pFormatInfo, params->pPropertyCount, params->pProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties2(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pFormatInfo, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSparseImageFormatProperties2(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pFormatInfo; - PTR32 pPropertyCount; - PTR32 pProperties; - } *params = args; - VkPhysicalDeviceSparseImageFormatInfo2 pFormatInfo_host; - VkSparseImageFormatProperties2 *pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->physicalDevice, params->pFormatInfo, params->pPropertyCount, params->pProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceSparseImageFormatInfo2_win32_to_host((const VkPhysicalDeviceSparseImageFormatInfo232 *)UlongToPtr(params->pFormatInfo), &pFormatInfo_host); - pProperties_host = convert_VkSparseImageFormatProperties2_array_win32_to_host(ctx, (VkSparseImageFormatProperties232 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties2(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pFormatInfo_host, (uint32_t *)UlongToPtr(params->pPropertyCount), pProperties_host); - convert_VkSparseImageFormatProperties2_array_host_to_win32(pProperties_host, (VkSparseImageFormatProperties232 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSparseImageFormatProperties2KHR(void *args) -{ - struct vkGetPhysicalDeviceSparseImageFormatProperties2KHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->physicalDevice, params->pFormatInfo, params->pPropertyCount, params->pProperties); - - wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pFormatInfo, params->pPropertyCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSparseImageFormatProperties2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pFormatInfo; - PTR32 pPropertyCount; - PTR32 pProperties; - } *params = args; - VkPhysicalDeviceSparseImageFormatInfo2 pFormatInfo_host; - VkSparseImageFormatProperties2 *pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->physicalDevice, params->pFormatInfo, params->pPropertyCount, params->pProperties); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceSparseImageFormatInfo2_win32_to_host((const VkPhysicalDeviceSparseImageFormatInfo232 *)UlongToPtr(params->pFormatInfo), &pFormatInfo_host); - pProperties_host = convert_VkSparseImageFormatProperties2_array_win32_to_host(ctx, (VkSparseImageFormatProperties232 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSparseImageFormatProperties2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pFormatInfo_host, (uint32_t *)UlongToPtr(params->pPropertyCount), pProperties_host); - convert_VkSparseImageFormatProperties2_array_host_to_win32(pProperties_host, (VkSparseImageFormatProperties232 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pPropertyCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(void *args) -{ - struct vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pCombinationCount, params->pCombinations); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pCombinationCount, params->pCombinations); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pCombinationCount; - PTR32 pCombinations; - VkResult result; - } *params = args; - VkFramebufferMixedSamplesCombinationNV *pCombinations_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pCombinationCount, params->pCombinations); - - init_conversion_context(ctx); - pCombinations_host = convert_VkFramebufferMixedSamplesCombinationNV_array_win32_to_host(ctx, (VkFramebufferMixedSamplesCombinationNV32 *)UlongToPtr(params->pCombinations), *(uint32_t *)UlongToPtr(params->pCombinationCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pCombinationCount), pCombinations_host); - convert_VkFramebufferMixedSamplesCombinationNV_array_host_to_win32(pCombinations_host, (VkFramebufferMixedSamplesCombinationNV32 *)UlongToPtr(params->pCombinations), *(uint32_t *)UlongToPtr(params->pCombinationCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceCapabilities2KHR(void *args) -{ - struct vkGetPhysicalDeviceSurfaceCapabilities2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pSurfaceInfo, params->pSurfaceCapabilities); - - params->result = wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(params->physicalDevice, params->pSurfaceInfo, params->pSurfaceCapabilities); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceCapabilities2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pSurfaceInfo; - PTR32 pSurfaceCapabilities; - VkResult result; - } *params = args; - VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo_host; - VkSurfaceCapabilities2KHR pSurfaceCapabilities_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pSurfaceInfo, params->pSurfaceCapabilities); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_unwrapped_host(ctx, (const VkPhysicalDeviceSurfaceInfo2KHR32 *)UlongToPtr(params->pSurfaceInfo), &pSurfaceInfo_host); - convert_VkSurfaceCapabilities2KHR_win32_to_host(ctx, (VkSurfaceCapabilities2KHR32 *)UlongToPtr(params->pSurfaceCapabilities), &pSurfaceCapabilities_host); - params->result = wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), &pSurfaceInfo_host, &pSurfaceCapabilities_host); - convert_VkSurfaceCapabilities2KHR_host_to_win32(&pSurfaceCapabilities_host, (VkSurfaceCapabilities2KHR32 *)UlongToPtr(params->pSurfaceCapabilities)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(void *args) -{ - struct vkGetPhysicalDeviceSurfaceCapabilitiesKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pSurfaceCapabilities); - - params->result = wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(params->physicalDevice, params->surface, params->pSurfaceCapabilities); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pSurfaceCapabilities; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pSurfaceCapabilities); - - params->result = wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR((VkPhysicalDevice)UlongToPtr(params->physicalDevice), params->surface, (VkSurfaceCapabilitiesKHR *)UlongToPtr(params->pSurfaceCapabilities)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceFormats2KHR(void *args) -{ - struct vkGetPhysicalDeviceSurfaceFormats2KHR_params *params = args; - VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo_host; - - TRACE("%p, %p, %p, %p\n", params->physicalDevice, params->pSurfaceInfo, params->pSurfaceFormatCount, params->pSurfaceFormats); - - convert_VkPhysicalDeviceSurfaceInfo2KHR_win64_to_driver(params->pSurfaceInfo, &pSurfaceInfo_host); - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, &pSurfaceInfo_host, params->pSurfaceFormatCount, params->pSurfaceFormats); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceFormats2KHR(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pSurfaceInfo; - PTR32 pSurfaceFormatCount; - PTR32 pSurfaceFormats; - VkResult result; - } *params = args; - VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo_host; - VkSurfaceFormat2KHR *pSurfaceFormats_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->physicalDevice, params->pSurfaceInfo, params->pSurfaceFormatCount, params->pSurfaceFormats); - - init_conversion_context(ctx); - convert_VkPhysicalDeviceSurfaceInfo2KHR_win32_to_driver(ctx, (const VkPhysicalDeviceSurfaceInfo2KHR32 *)UlongToPtr(params->pSurfaceInfo), &pSurfaceInfo_host); - pSurfaceFormats_host = convert_VkSurfaceFormat2KHR_array_win32_to_host(ctx, (VkSurfaceFormat2KHR32 *)UlongToPtr(params->pSurfaceFormats), *(uint32_t *)UlongToPtr(params->pSurfaceFormatCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormats2KHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, &pSurfaceInfo_host, (uint32_t *)UlongToPtr(params->pSurfaceFormatCount), pSurfaceFormats_host); - convert_VkSurfaceFormat2KHR_array_host_to_win32(pSurfaceFormats_host, (VkSurfaceFormat2KHR32 *)UlongToPtr(params->pSurfaceFormats), *(uint32_t *)UlongToPtr(params->pSurfaceFormatCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceFormatsKHR(void *args) -{ - struct vkGetPhysicalDeviceSurfaceFormatsKHR_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pSurfaceFormatCount, params->pSurfaceFormats); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, params->pSurfaceFormatCount, params->pSurfaceFormats); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceFormatsKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pSurfaceFormatCount; - PTR32 pSurfaceFormats; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pSurfaceFormatCount, params->pSurfaceFormats); - - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfaceFormatsKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, (uint32_t *)UlongToPtr(params->pSurfaceFormatCount), (VkSurfaceFormatKHR *)UlongToPtr(params->pSurfaceFormats)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSurfacePresentModesKHR(void *args) -{ - struct vkGetPhysicalDeviceSurfacePresentModesKHR_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pPresentModeCount, params->pPresentModes); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, params->pPresentModeCount, params->pPresentModes); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSurfacePresentModesKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pPresentModeCount; - PTR32 pPresentModes; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->physicalDevice, wine_dbgstr_longlong(params->surface), params->pPresentModeCount, params->pPresentModes); - - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfacePresentModesKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->surface ? wine_surface_from_handle(params->surface)->driver_surface : 0, (uint32_t *)UlongToPtr(params->pPresentModeCount), (VkPresentModeKHR *)UlongToPtr(params->pPresentModes)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceSurfaceSupportKHR(void *args) -{ - struct vkGetPhysicalDeviceSurfaceSupportKHR_params *params = args; - - TRACE("%p, %u, 0x%s, %p\n", params->physicalDevice, params->queueFamilyIndex, wine_dbgstr_longlong(params->surface), params->pSupported); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceSurfaceSupportKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->queueFamilyIndex, wine_surface_from_handle(params->surface)->driver_surface, params->pSupported); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceSurfaceSupportKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - uint32_t queueFamilyIndex; - VkSurfaceKHR DECLSPEC_ALIGN(8) surface; - PTR32 pSupported; - VkResult result; - } *params = args; - - TRACE("%#x, %u, 0x%s, %#x\n", params->physicalDevice, params->queueFamilyIndex, wine_dbgstr_longlong(params->surface), params->pSupported); - - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceSurfaceSupportKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->queueFamilyIndex, wine_surface_from_handle(params->surface)->driver_surface, (VkBool32 *)UlongToPtr(params->pSupported)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceToolProperties(void *args) -{ - struct vkGetPhysicalDeviceToolProperties_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pToolCount, params->pToolProperties); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceToolProperties(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pToolCount, params->pToolProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceToolProperties(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pToolCount; - PTR32 pToolProperties; - VkResult result; - } *params = args; - VkPhysicalDeviceToolProperties *pToolProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pToolCount, params->pToolProperties); - - init_conversion_context(ctx); - pToolProperties_host = convert_VkPhysicalDeviceToolProperties_array_win32_to_host(ctx, (VkPhysicalDeviceToolProperties32 *)UlongToPtr(params->pToolProperties), *(uint32_t *)UlongToPtr(params->pToolCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceToolProperties(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pToolCount), pToolProperties_host); - convert_VkPhysicalDeviceToolProperties_array_host_to_win32(pToolProperties_host, (VkPhysicalDeviceToolProperties32 *)UlongToPtr(params->pToolProperties), *(uint32_t *)UlongToPtr(params->pToolCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceToolPropertiesEXT(void *args) -{ - struct vkGetPhysicalDeviceToolPropertiesEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->physicalDevice, params->pToolCount, params->pToolProperties); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceToolPropertiesEXT(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->pToolCount, params->pToolProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceToolPropertiesEXT(void *args) -{ - struct - { - PTR32 physicalDevice; - PTR32 pToolCount; - PTR32 pToolProperties; - VkResult result; - } *params = args; - VkPhysicalDeviceToolProperties *pToolProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->physicalDevice, params->pToolCount, params->pToolProperties); - - init_conversion_context(ctx); - pToolProperties_host = convert_VkPhysicalDeviceToolProperties_array_win32_to_host(ctx, (VkPhysicalDeviceToolProperties32 *)UlongToPtr(params->pToolProperties), *(uint32_t *)UlongToPtr(params->pToolCount)); - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceToolPropertiesEXT(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, (uint32_t *)UlongToPtr(params->pToolCount), pToolProperties_host); - convert_VkPhysicalDeviceToolProperties_array_host_to_win32(pToolProperties_host, (VkPhysicalDeviceToolProperties32 *)UlongToPtr(params->pToolProperties), *(uint32_t *)UlongToPtr(params->pToolCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPhysicalDeviceWin32PresentationSupportKHR(void *args) -{ - struct vkGetPhysicalDeviceWin32PresentationSupportKHR_params *params = args; - - TRACE("%p, %u\n", params->physicalDevice, params->queueFamilyIndex); - - params->result = wine_phys_dev_from_handle(params->physicalDevice)->instance->funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR(wine_phys_dev_from_handle(params->physicalDevice)->host_physical_device, params->queueFamilyIndex); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPhysicalDeviceWin32PresentationSupportKHR(void *args) -{ - struct - { - PTR32 physicalDevice; - uint32_t queueFamilyIndex; - VkBool32 result; - } *params = args; - - TRACE("%#x, %u\n", params->physicalDevice, params->queueFamilyIndex); - - params->result = wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->instance->funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR(wine_phys_dev_from_handle((VkPhysicalDevice)UlongToPtr(params->physicalDevice))->host_physical_device, params->queueFamilyIndex); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelineCacheData(void *args) -{ - struct vkGetPipelineCacheData_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->pDataSize, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineCacheData(wine_device_from_handle(params->device)->host_device, params->pipelineCache, params->pDataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelineCacheData(void *args) -{ - struct - { - PTR32 device; - VkPipelineCache DECLSPEC_ALIGN(8) pipelineCache; - PTR32 pDataSize; - PTR32 pData; - VkResult result; - } *params = args; - size_t pDataSize_host; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->pipelineCache), params->pDataSize, params->pData); - - pDataSize_host = *(PTR32 *)UlongToPtr(params->pDataSize); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelineCacheData(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipelineCache, &pDataSize_host, (void *)UlongToPtr(params->pData)); - *(PTR32 *)UlongToPtr(params->pDataSize) = pDataSize_host; - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelineExecutableInternalRepresentationsKHR(void *args) -{ - struct vkGetPipelineExecutableInternalRepresentationsKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pExecutableInfo, params->pInternalRepresentationCount, params->pInternalRepresentations); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineExecutableInternalRepresentationsKHR(wine_device_from_handle(params->device)->host_device, params->pExecutableInfo, params->pInternalRepresentationCount, params->pInternalRepresentations); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelineExecutableInternalRepresentationsKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pExecutableInfo; - PTR32 pInternalRepresentationCount; - PTR32 pInternalRepresentations; - VkResult result; - } *params = args; - VkPipelineExecutableInfoKHR pExecutableInfo_host; - VkPipelineExecutableInternalRepresentationKHR *pInternalRepresentations_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pExecutableInfo, params->pInternalRepresentationCount, params->pInternalRepresentations); - - init_conversion_context(ctx); - convert_VkPipelineExecutableInfoKHR_win32_to_host((const VkPipelineExecutableInfoKHR32 *)UlongToPtr(params->pExecutableInfo), &pExecutableInfo_host); - pInternalRepresentations_host = convert_VkPipelineExecutableInternalRepresentationKHR_array_win32_to_host(ctx, (VkPipelineExecutableInternalRepresentationKHR32 *)UlongToPtr(params->pInternalRepresentations), *(uint32_t *)UlongToPtr(params->pInternalRepresentationCount)); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelineExecutableInternalRepresentationsKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pExecutableInfo_host, (uint32_t *)UlongToPtr(params->pInternalRepresentationCount), pInternalRepresentations_host); - convert_VkPipelineExecutableInternalRepresentationKHR_array_host_to_win32(pInternalRepresentations_host, (VkPipelineExecutableInternalRepresentationKHR32 *)UlongToPtr(params->pInternalRepresentations), *(uint32_t *)UlongToPtr(params->pInternalRepresentationCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelineExecutablePropertiesKHR(void *args) -{ - struct vkGetPipelineExecutablePropertiesKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pPipelineInfo, params->pExecutableCount, params->pProperties); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineExecutablePropertiesKHR(wine_device_from_handle(params->device)->host_device, params->pPipelineInfo, params->pExecutableCount, params->pProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelineExecutablePropertiesKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pPipelineInfo; - PTR32 pExecutableCount; - PTR32 pProperties; - VkResult result; - } *params = args; - VkPipelineInfoKHR pPipelineInfo_host; - VkPipelineExecutablePropertiesKHR *pProperties_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pPipelineInfo, params->pExecutableCount, params->pProperties); - - init_conversion_context(ctx); - convert_VkPipelineInfoKHR_win32_to_host((const VkPipelineInfoKHR32 *)UlongToPtr(params->pPipelineInfo), &pPipelineInfo_host); - pProperties_host = convert_VkPipelineExecutablePropertiesKHR_array_win32_to_host(ctx, (VkPipelineExecutablePropertiesKHR32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pExecutableCount)); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelineExecutablePropertiesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pPipelineInfo_host, (uint32_t *)UlongToPtr(params->pExecutableCount), pProperties_host); - convert_VkPipelineExecutablePropertiesKHR_array_host_to_win32(pProperties_host, (VkPipelineExecutablePropertiesKHR32 *)UlongToPtr(params->pProperties), *(uint32_t *)UlongToPtr(params->pExecutableCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelineExecutableStatisticsKHR(void *args) -{ - struct vkGetPipelineExecutableStatisticsKHR_params *params = args; - - TRACE("%p, %p, %p, %p\n", params->device, params->pExecutableInfo, params->pStatisticCount, params->pStatistics); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineExecutableStatisticsKHR(wine_device_from_handle(params->device)->host_device, params->pExecutableInfo, params->pStatisticCount, params->pStatistics); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelineExecutableStatisticsKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pExecutableInfo; - PTR32 pStatisticCount; - PTR32 pStatistics; - VkResult result; - } *params = args; - VkPipelineExecutableInfoKHR pExecutableInfo_host; - VkPipelineExecutableStatisticKHR *pStatistics_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pExecutableInfo, params->pStatisticCount, params->pStatistics); - - init_conversion_context(ctx); - convert_VkPipelineExecutableInfoKHR_win32_to_host((const VkPipelineExecutableInfoKHR32 *)UlongToPtr(params->pExecutableInfo), &pExecutableInfo_host); - pStatistics_host = convert_VkPipelineExecutableStatisticKHR_array_win32_to_host(ctx, (VkPipelineExecutableStatisticKHR32 *)UlongToPtr(params->pStatistics), *(uint32_t *)UlongToPtr(params->pStatisticCount)); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelineExecutableStatisticsKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pExecutableInfo_host, (uint32_t *)UlongToPtr(params->pStatisticCount), pStatistics_host); - convert_VkPipelineExecutableStatisticKHR_array_host_to_win32(pStatistics_host, (VkPipelineExecutableStatisticKHR32 *)UlongToPtr(params->pStatistics), *(uint32_t *)UlongToPtr(params->pStatisticCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelineIndirectDeviceAddressNV(void *args) -{ - struct vkGetPipelineIndirectDeviceAddressNV_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelineIndirectDeviceAddressNV(wine_device_from_handle(params->device)->host_device, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelineIndirectDeviceAddressNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - VkDeviceAddress result; - } *params = args; - VkPipelineIndirectDeviceAddressInfoNV pInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInfo); - - convert_VkPipelineIndirectDeviceAddressInfoNV_win32_to_host((const VkPipelineIndirectDeviceAddressInfoNV32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelineIndirectDeviceAddressNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelineIndirectMemoryRequirementsNV(void *args) -{ - struct vkGetPipelineIndirectMemoryRequirementsNV_params *params = args; - VkComputePipelineCreateInfo pCreateInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %p, %p\n", params->device, params->pCreateInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkComputePipelineCreateInfo_win64_to_host(ctx, params->pCreateInfo, &pCreateInfo_host); - wine_device_from_handle(params->device)->funcs.p_vkGetPipelineIndirectMemoryRequirementsNV(wine_device_from_handle(params->device)->host_device, &pCreateInfo_host, params->pMemoryRequirements); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelineIndirectMemoryRequirementsNV(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pMemoryRequirements; - } *params = args; - VkComputePipelineCreateInfo pCreateInfo_host; - VkMemoryRequirements2 pMemoryRequirements_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pMemoryRequirements); - - init_conversion_context(ctx); - convert_VkComputePipelineCreateInfo_win32_to_host(ctx, (const VkComputePipelineCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - convert_VkMemoryRequirements2_win32_to_host(ctx, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements), &pMemoryRequirements_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelineIndirectMemoryRequirementsNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, &pMemoryRequirements_host); - convert_VkComputePipelineCreateInfo_host_to_win32(&pCreateInfo_host, (const VkComputePipelineCreateInfo32 *)UlongToPtr(params->pCreateInfo)); - convert_VkMemoryRequirements2_host_to_win32(&pMemoryRequirements_host, (VkMemoryRequirements232 *)UlongToPtr(params->pMemoryRequirements)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPipelinePropertiesEXT(void *args) -{ - struct vkGetPipelinePropertiesEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pPipelineInfo, params->pPipelineProperties); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetPipelinePropertiesEXT(wine_device_from_handle(params->device)->host_device, params->pPipelineInfo, params->pPipelineProperties); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPipelinePropertiesEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pPipelineInfo; - PTR32 pPipelineProperties; - VkResult result; - } *params = args; - VkPipelineInfoEXT pPipelineInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pPipelineInfo, params->pPipelineProperties); - - convert_VkPipelineInfoEXT_win32_to_host((const VkPipelineInfoEXT32 *)UlongToPtr(params->pPipelineInfo), &pPipelineInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPipelinePropertiesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pPipelineInfo_host, (VkBaseOutStructure *)UlongToPtr(params->pPipelineProperties)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPrivateData(void *args) -{ - struct vkGetPrivateData_params *params = args; - - TRACE("%p, %#x, 0x%s, 0x%s, %p\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), params->pData); - - wine_device_from_handle(params->device)->funcs.p_vkGetPrivateData(wine_device_from_handle(params->device)->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPrivateData(void *args) -{ - struct - { - PTR32 device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - PTR32 pData; - } *params = args; - - TRACE("%#x, %#x, 0x%s, 0x%s, %#x\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), params->pData); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPrivateData(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, (uint64_t *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetPrivateDataEXT(void *args) -{ - struct vkGetPrivateDataEXT_params *params = args; - - TRACE("%p, %#x, 0x%s, 0x%s, %p\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), params->pData); - - wine_device_from_handle(params->device)->funcs.p_vkGetPrivateDataEXT(wine_device_from_handle(params->device)->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetPrivateDataEXT(void *args) -{ - struct - { - PTR32 device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - PTR32 pData; - } *params = args; - - TRACE("%#x, %#x, 0x%s, 0x%s, %#x\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), params->pData); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetPrivateDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, (uint64_t *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetQueryPoolResults(void *args) -{ - struct vkGetQueryPoolResults_params *params = args; - - TRACE("%p, 0x%s, %u, %u, 0x%s, %p, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->queryPool), params->firstQuery, params->queryCount, wine_dbgstr_longlong(params->dataSize), params->pData, wine_dbgstr_longlong(params->stride), params->flags); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetQueryPoolResults(wine_device_from_handle(params->device)->host_device, params->queryPool, params->firstQuery, params->queryCount, params->dataSize, params->pData, params->stride, params->flags); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetQueryPoolResults(void *args) -{ - struct - { - PTR32 device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - PTR32 dataSize; - PTR32 pData; - VkDeviceSize DECLSPEC_ALIGN(8) stride; - VkQueryResultFlags flags; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %u, 0x%s, %#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->queryPool), params->firstQuery, params->queryCount, wine_dbgstr_longlong(params->dataSize), params->pData, wine_dbgstr_longlong(params->stride), params->flags); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetQueryPoolResults(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->queryPool, params->firstQuery, params->queryCount, params->dataSize, (void *)UlongToPtr(params->pData), params->stride, params->flags); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetQueueCheckpointData2NV(void *args) -{ - struct vkGetQueueCheckpointData2NV_params *params = args; - - TRACE("%p, %p, %p\n", params->queue, params->pCheckpointDataCount, params->pCheckpointData); - - wine_queue_from_handle(params->queue)->device->funcs.p_vkGetQueueCheckpointData2NV(wine_queue_from_handle(params->queue)->host_queue, params->pCheckpointDataCount, params->pCheckpointData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetQueueCheckpointData2NV(void *args) -{ - struct - { - PTR32 queue; - PTR32 pCheckpointDataCount; - PTR32 pCheckpointData; - } *params = args; - VkCheckpointData2NV *pCheckpointData_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->queue, params->pCheckpointDataCount, params->pCheckpointData); - - init_conversion_context(ctx); - pCheckpointData_host = convert_VkCheckpointData2NV_array_win32_to_host(ctx, (VkCheckpointData2NV32 *)UlongToPtr(params->pCheckpointData), *(uint32_t *)UlongToPtr(params->pCheckpointDataCount)); - wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkGetQueueCheckpointData2NV(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, (uint32_t *)UlongToPtr(params->pCheckpointDataCount), pCheckpointData_host); - convert_VkCheckpointData2NV_array_host_to_win32(pCheckpointData_host, (VkCheckpointData2NV32 *)UlongToPtr(params->pCheckpointData), *(uint32_t *)UlongToPtr(params->pCheckpointDataCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetQueueCheckpointDataNV(void *args) -{ - struct vkGetQueueCheckpointDataNV_params *params = args; - - TRACE("%p, %p, %p\n", params->queue, params->pCheckpointDataCount, params->pCheckpointData); - - wine_queue_from_handle(params->queue)->device->funcs.p_vkGetQueueCheckpointDataNV(wine_queue_from_handle(params->queue)->host_queue, params->pCheckpointDataCount, params->pCheckpointData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetQueueCheckpointDataNV(void *args) -{ - struct - { - PTR32 queue; - PTR32 pCheckpointDataCount; - PTR32 pCheckpointData; - } *params = args; - VkCheckpointDataNV *pCheckpointData_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->queue, params->pCheckpointDataCount, params->pCheckpointData); - - init_conversion_context(ctx); - pCheckpointData_host = convert_VkCheckpointDataNV_array_win32_to_host(ctx, (VkCheckpointDataNV32 *)UlongToPtr(params->pCheckpointData), *(uint32_t *)UlongToPtr(params->pCheckpointDataCount)); - wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkGetQueueCheckpointDataNV(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, (uint32_t *)UlongToPtr(params->pCheckpointDataCount), pCheckpointData_host); - convert_VkCheckpointDataNV_array_host_to_win32(pCheckpointData_host, (VkCheckpointDataNV32 *)UlongToPtr(params->pCheckpointData), *(uint32_t *)UlongToPtr(params->pCheckpointDataCount)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(void *args) -{ - struct vkGetRayTracingCaptureReplayShaderGroupHandlesKHR_params *params = args; - - TRACE("%p, 0x%s, %u, %u, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->pipeline), params->firstGroup, params->groupCount, wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(wine_device_from_handle(params->device)->host_device, params->pipeline, params->firstGroup, params->groupCount, params->dataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t firstGroup; - uint32_t groupCount; - PTR32 dataSize; - PTR32 pData; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %u, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->firstGroup, params->groupCount, wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, params->firstGroup, params->groupCount, params->dataSize, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetRayTracingShaderGroupHandlesKHR(void *args) -{ - struct vkGetRayTracingShaderGroupHandlesKHR_params *params = args; - - TRACE("%p, 0x%s, %u, %u, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->pipeline), params->firstGroup, params->groupCount, wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetRayTracingShaderGroupHandlesKHR(wine_device_from_handle(params->device)->host_device, params->pipeline, params->firstGroup, params->groupCount, params->dataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetRayTracingShaderGroupHandlesKHR(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t firstGroup; - uint32_t groupCount; - PTR32 dataSize; - PTR32 pData; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %u, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->firstGroup, params->groupCount, wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetRayTracingShaderGroupHandlesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, params->firstGroup, params->groupCount, params->dataSize, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetRayTracingShaderGroupHandlesNV(void *args) -{ - struct vkGetRayTracingShaderGroupHandlesNV_params *params = args; - - TRACE("%p, 0x%s, %u, %u, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->pipeline), params->firstGroup, params->groupCount, wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetRayTracingShaderGroupHandlesNV(wine_device_from_handle(params->device)->host_device, params->pipeline, params->firstGroup, params->groupCount, params->dataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetRayTracingShaderGroupHandlesNV(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t firstGroup; - uint32_t groupCount; - PTR32 dataSize; - PTR32 pData; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %u, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->firstGroup, params->groupCount, wine_dbgstr_longlong(params->dataSize), params->pData); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetRayTracingShaderGroupHandlesNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, params->firstGroup, params->groupCount, params->dataSize, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetRayTracingShaderGroupStackSizeKHR(void *args) -{ - struct vkGetRayTracingShaderGroupStackSizeKHR_params *params = args; - - TRACE("%p, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->group, params->groupShader); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetRayTracingShaderGroupStackSizeKHR(wine_device_from_handle(params->device)->host_device, params->pipeline, params->group, params->groupShader); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetRayTracingShaderGroupStackSizeKHR(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - uint32_t group; - VkShaderGroupShaderKHR groupShader; - VkDeviceSize result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->group, params->groupShader); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetRayTracingShaderGroupStackSizeKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, params->group, params->groupShader); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetRenderAreaGranularity(void *args) -{ - struct vkGetRenderAreaGranularity_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->renderPass), params->pGranularity); - - wine_device_from_handle(params->device)->funcs.p_vkGetRenderAreaGranularity(wine_device_from_handle(params->device)->host_device, params->renderPass, params->pGranularity); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetRenderAreaGranularity(void *args) -{ - struct - { - PTR32 device; - VkRenderPass DECLSPEC_ALIGN(8) renderPass; - PTR32 pGranularity; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->renderPass), params->pGranularity); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetRenderAreaGranularity(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->renderPass, (VkExtent2D *)UlongToPtr(params->pGranularity)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetRenderingAreaGranularityKHR(void *args) -{ - struct vkGetRenderingAreaGranularityKHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pRenderingAreaInfo, params->pGranularity); - - wine_device_from_handle(params->device)->funcs.p_vkGetRenderingAreaGranularityKHR(wine_device_from_handle(params->device)->host_device, params->pRenderingAreaInfo, params->pGranularity); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetRenderingAreaGranularityKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pRenderingAreaInfo; - PTR32 pGranularity; - } *params = args; - VkRenderingAreaInfoKHR pRenderingAreaInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pRenderingAreaInfo, params->pGranularity); - - convert_VkRenderingAreaInfoKHR_win32_to_host((const VkRenderingAreaInfoKHR32 *)UlongToPtr(params->pRenderingAreaInfo), &pRenderingAreaInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetRenderingAreaGranularityKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pRenderingAreaInfo_host, (VkExtent2D *)UlongToPtr(params->pGranularity)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetSamplerOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct vkGetSamplerOpaqueCaptureDescriptorDataEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetSamplerOpaqueCaptureDescriptorDataEXT(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetSamplerOpaqueCaptureDescriptorDataEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pInfo; - PTR32 pData; - VkResult result; - } *params = args; - VkSamplerCaptureDescriptorDataInfoEXT pInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pInfo, params->pData); - - convert_VkSamplerCaptureDescriptorDataInfoEXT_win32_to_host((const VkSamplerCaptureDescriptorDataInfoEXT32 *)UlongToPtr(params->pInfo), &pInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetSamplerOpaqueCaptureDescriptorDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInfo_host, (void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetSemaphoreCounterValue(void *args) -{ - struct vkGetSemaphoreCounterValue_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->semaphore), params->pValue); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetSemaphoreCounterValue(wine_device_from_handle(params->device)->host_device, params->semaphore, params->pValue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetSemaphoreCounterValue(void *args) -{ - struct - { - PTR32 device; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - PTR32 pValue; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->semaphore), params->pValue); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetSemaphoreCounterValue(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->semaphore, (uint64_t *)UlongToPtr(params->pValue)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetSemaphoreCounterValueKHR(void *args) -{ - struct vkGetSemaphoreCounterValueKHR_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->semaphore), params->pValue); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetSemaphoreCounterValueKHR(wine_device_from_handle(params->device)->host_device, params->semaphore, params->pValue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetSemaphoreCounterValueKHR(void *args) -{ - struct - { - PTR32 device; - VkSemaphore DECLSPEC_ALIGN(8) semaphore; - PTR32 pValue; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->semaphore), params->pValue); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetSemaphoreCounterValueKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->semaphore, (uint64_t *)UlongToPtr(params->pValue)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetShaderBinaryDataEXT(void *args) -{ - struct vkGetShaderBinaryDataEXT_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->shader), params->pDataSize, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetShaderBinaryDataEXT(wine_device_from_handle(params->device)->host_device, params->shader, params->pDataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetShaderBinaryDataEXT(void *args) -{ - struct - { - PTR32 device; - VkShaderEXT DECLSPEC_ALIGN(8) shader; - PTR32 pDataSize; - PTR32 pData; - VkResult result; - } *params = args; - size_t pDataSize_host; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->shader), params->pDataSize, params->pData); - - pDataSize_host = *(PTR32 *)UlongToPtr(params->pDataSize); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetShaderBinaryDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->shader, &pDataSize_host, (void *)UlongToPtr(params->pData)); - *(PTR32 *)UlongToPtr(params->pDataSize) = pDataSize_host; - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetShaderInfoAMD(void *args) -{ - struct vkGetShaderInfoAMD_params *params = args; - - TRACE("%p, 0x%s, %#x, %#x, %p, %p\n", params->device, wine_dbgstr_longlong(params->pipeline), params->shaderStage, params->infoType, params->pInfoSize, params->pInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetShaderInfoAMD(wine_device_from_handle(params->device)->host_device, params->pipeline, params->shaderStage, params->infoType, params->pInfoSize, params->pInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetShaderInfoAMD(void *args) -{ - struct - { - PTR32 device; - VkPipeline DECLSPEC_ALIGN(8) pipeline; - VkShaderStageFlagBits shaderStage; - VkShaderInfoTypeAMD infoType; - PTR32 pInfoSize; - PTR32 pInfo; - VkResult result; - } *params = args; - size_t pInfoSize_host; - - TRACE("%#x, 0x%s, %#x, %#x, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->pipeline), params->shaderStage, params->infoType, params->pInfoSize, params->pInfo); - - pInfoSize_host = *(PTR32 *)UlongToPtr(params->pInfoSize); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetShaderInfoAMD(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->pipeline, params->shaderStage, params->infoType, &pInfoSize_host, (void *)UlongToPtr(params->pInfo)); - *(PTR32 *)UlongToPtr(params->pInfoSize) = pInfoSize_host; - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetShaderModuleCreateInfoIdentifierEXT(void *args) -{ - struct vkGetShaderModuleCreateInfoIdentifierEXT_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pCreateInfo, params->pIdentifier); - - wine_device_from_handle(params->device)->funcs.p_vkGetShaderModuleCreateInfoIdentifierEXT(wine_device_from_handle(params->device)->host_device, params->pCreateInfo, params->pIdentifier); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetShaderModuleCreateInfoIdentifierEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pCreateInfo; - PTR32 pIdentifier; - } *params = args; - VkShaderModuleCreateInfo pCreateInfo_host; - VkShaderModuleIdentifierEXT pIdentifier_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pIdentifier); - - init_conversion_context(ctx); - convert_VkShaderModuleCreateInfo_win32_to_host(ctx, (const VkShaderModuleCreateInfo32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - convert_VkShaderModuleIdentifierEXT_win32_to_host((VkShaderModuleIdentifierEXT32 *)UlongToPtr(params->pIdentifier), &pIdentifier_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetShaderModuleCreateInfoIdentifierEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, &pIdentifier_host); - convert_VkShaderModuleIdentifierEXT_host_to_win32(&pIdentifier_host, (VkShaderModuleIdentifierEXT32 *)UlongToPtr(params->pIdentifier)); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetShaderModuleIdentifierEXT(void *args) -{ - struct vkGetShaderModuleIdentifierEXT_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->shaderModule), params->pIdentifier); - - wine_device_from_handle(params->device)->funcs.p_vkGetShaderModuleIdentifierEXT(wine_device_from_handle(params->device)->host_device, params->shaderModule, params->pIdentifier); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetShaderModuleIdentifierEXT(void *args) -{ - struct - { - PTR32 device; - VkShaderModule DECLSPEC_ALIGN(8) shaderModule; - PTR32 pIdentifier; - } *params = args; - VkShaderModuleIdentifierEXT pIdentifier_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->shaderModule), params->pIdentifier); - - convert_VkShaderModuleIdentifierEXT_win32_to_host((VkShaderModuleIdentifierEXT32 *)UlongToPtr(params->pIdentifier), &pIdentifier_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetShaderModuleIdentifierEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->shaderModule, &pIdentifier_host); - convert_VkShaderModuleIdentifierEXT_host_to_win32(&pIdentifier_host, (VkShaderModuleIdentifierEXT32 *)UlongToPtr(params->pIdentifier)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetSwapchainImagesKHR(void *args) -{ - struct vkGetSwapchainImagesKHR_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSwapchainImageCount, params->pSwapchainImages); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetSwapchainImagesKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pSwapchainImageCount, params->pSwapchainImages); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetSwapchainImagesKHR(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - PTR32 pSwapchainImageCount; - PTR32 pSwapchainImages; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSwapchainImageCount, params->pSwapchainImages); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetSwapchainImagesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, (uint32_t *)UlongToPtr(params->pSwapchainImageCount), (VkImage *)UlongToPtr(params->pSwapchainImages)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkGetValidationCacheDataEXT(void *args) -{ - struct vkGetValidationCacheDataEXT_params *params = args; - - TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->validationCache), params->pDataSize, params->pData); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkGetValidationCacheDataEXT(wine_device_from_handle(params->device)->host_device, params->validationCache, params->pDataSize, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkGetValidationCacheDataEXT(void *args) -{ - struct - { - PTR32 device; - VkValidationCacheEXT DECLSPEC_ALIGN(8) validationCache; - PTR32 pDataSize; - PTR32 pData; - VkResult result; - } *params = args; - size_t pDataSize_host; - - TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->validationCache), params->pDataSize, params->pData); - - pDataSize_host = *(PTR32 *)UlongToPtr(params->pDataSize); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetValidationCacheDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->validationCache, &pDataSize_host, (void *)UlongToPtr(params->pData)); - *(PTR32 *)UlongToPtr(params->pDataSize) = pDataSize_host; - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkInitializePerformanceApiINTEL(void *args) -{ - struct vkInitializePerformanceApiINTEL_params *params = args; - - TRACE("%p, %p\n", params->device, params->pInitializeInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkInitializePerformanceApiINTEL(wine_device_from_handle(params->device)->host_device, params->pInitializeInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkInitializePerformanceApiINTEL(void *args) -{ - struct - { - PTR32 device; - PTR32 pInitializeInfo; - VkResult result; - } *params = args; - VkInitializePerformanceApiInfoINTEL pInitializeInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pInitializeInfo); - - convert_VkInitializePerformanceApiInfoINTEL_win32_to_host((const VkInitializePerformanceApiInfoINTEL32 *)UlongToPtr(params->pInitializeInfo), &pInitializeInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkInitializePerformanceApiINTEL(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pInitializeInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkInvalidateMappedMemoryRanges(void *args) -{ - struct vkInvalidateMappedMemoryRanges_params *params = args; - const VkMappedMemoryRange *pMemoryRanges_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p\n", params->device, params->memoryRangeCount, params->pMemoryRanges); - - init_conversion_context(ctx); - pMemoryRanges_host = convert_VkMappedMemoryRange_array_win64_to_host(ctx, params->pMemoryRanges, params->memoryRangeCount); - params->result = wine_device_from_handle(params->device)->funcs.p_vkInvalidateMappedMemoryRanges(wine_device_from_handle(params->device)->host_device, params->memoryRangeCount, pMemoryRanges_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkInvalidateMappedMemoryRanges(void *args) -{ - struct - { - PTR32 device; - uint32_t memoryRangeCount; - PTR32 pMemoryRanges; - VkResult result; - } *params = args; - const VkMappedMemoryRange *pMemoryRanges_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->memoryRangeCount, params->pMemoryRanges); - - init_conversion_context(ctx); - pMemoryRanges_host = convert_VkMappedMemoryRange_array_win32_to_host(ctx, (const VkMappedMemoryRange32 *)UlongToPtr(params->pMemoryRanges), params->memoryRangeCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkInvalidateMappedMemoryRanges(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->memoryRangeCount, pMemoryRanges_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkLatencySleepNV(void *args) -{ - struct vkLatencySleepNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkLatencySleepNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pSleepInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkLatencySleepNV(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - PTR32 pSleepInfo; - VkResult result; - } *params = args; - VkLatencySleepInfoNV pSleepInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepInfo); - - convert_VkLatencySleepInfoNV_win32_to_host((const VkLatencySleepInfoNV32 *)UlongToPtr(params->pSleepInfo), &pSleepInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkLatencySleepNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pSleepInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkMapMemory(void *args) -{ - struct vkMapMemory_params *params = args; - - TRACE("%p, 0x%s, 0x%s, 0x%s, %#x, %p\n", params->device, wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->offset), wine_dbgstr_longlong(params->size), params->flags, params->ppData); - - params->result = wine_vkMapMemory(params->device, params->memory, params->offset, params->size, params->flags, params->ppData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkMapMemory(void *args) -{ - struct - { - PTR32 device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - VkDeviceSize DECLSPEC_ALIGN(8) offset; - VkDeviceSize DECLSPEC_ALIGN(8) size; - VkMemoryMapFlags flags; - PTR32 ppData; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->memory), wine_dbgstr_longlong(params->offset), wine_dbgstr_longlong(params->size), params->flags, params->ppData); - - params->result = wine_vkMapMemory((VkDevice)UlongToPtr(params->device), params->memory, params->offset, params->size, params->flags, (void **)UlongToPtr(params->ppData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkMapMemory2KHR(void *args) -{ - struct vkMapMemory2KHR_params *params = args; - - TRACE("%p, %p, %p\n", params->device, params->pMemoryMapInfo, params->ppData); - - params->result = wine_vkMapMemory2KHR(params->device, params->pMemoryMapInfo, params->ppData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkMapMemory2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pMemoryMapInfo; - PTR32 ppData; - VkResult result; - } *params = args; - VkMemoryMapInfoKHR pMemoryMapInfo_host; - - TRACE("%#x, %#x, %#x\n", params->device, params->pMemoryMapInfo, params->ppData); - - convert_VkMemoryMapInfoKHR_win32_to_unwrapped_host((const VkMemoryMapInfoKHR32 *)UlongToPtr(params->pMemoryMapInfo), &pMemoryMapInfo_host); - params->result = wine_vkMapMemory2KHR((VkDevice)UlongToPtr(params->device), &pMemoryMapInfo_host, (void **)UlongToPtr(params->ppData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkMergePipelineCaches(void *args) -{ - struct vkMergePipelineCaches_params *params = args; - - TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->dstCache), params->srcCacheCount, params->pSrcCaches); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkMergePipelineCaches(wine_device_from_handle(params->device)->host_device, params->dstCache, params->srcCacheCount, params->pSrcCaches); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkMergePipelineCaches(void *args) -{ - struct - { - PTR32 device; - VkPipelineCache DECLSPEC_ALIGN(8) dstCache; - uint32_t srcCacheCount; - PTR32 pSrcCaches; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->dstCache), params->srcCacheCount, params->pSrcCaches); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkMergePipelineCaches(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->dstCache, params->srcCacheCount, (const VkPipelineCache *)UlongToPtr(params->pSrcCaches)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkMergeValidationCachesEXT(void *args) -{ - struct vkMergeValidationCachesEXT_params *params = args; - - TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->dstCache), params->srcCacheCount, params->pSrcCaches); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkMergeValidationCachesEXT(wine_device_from_handle(params->device)->host_device, params->dstCache, params->srcCacheCount, params->pSrcCaches); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkMergeValidationCachesEXT(void *args) -{ - struct - { - PTR32 device; - VkValidationCacheEXT DECLSPEC_ALIGN(8) dstCache; - uint32_t srcCacheCount; - PTR32 pSrcCaches; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %u, %#x\n", params->device, wine_dbgstr_longlong(params->dstCache), params->srcCacheCount, params->pSrcCaches); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkMergeValidationCachesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->dstCache, params->srcCacheCount, (const VkValidationCacheEXT *)UlongToPtr(params->pSrcCaches)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueBeginDebugUtilsLabelEXT(void *args) -{ - struct vkQueueBeginDebugUtilsLabelEXT_params *params = args; - - TRACE("%p, %p\n", params->queue, params->pLabelInfo); - - wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueBeginDebugUtilsLabelEXT(wine_queue_from_handle(params->queue)->host_queue, params->pLabelInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueBeginDebugUtilsLabelEXT(void *args) -{ - struct - { - PTR32 queue; - PTR32 pLabelInfo; - } *params = args; - VkDebugUtilsLabelEXT pLabelInfo_host; - - TRACE("%#x, %#x\n", params->queue, params->pLabelInfo); - - convert_VkDebugUtilsLabelEXT_win32_to_host((const VkDebugUtilsLabelEXT32 *)UlongToPtr(params->pLabelInfo), &pLabelInfo_host); - wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueBeginDebugUtilsLabelEXT(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, &pLabelInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueBindSparse(void *args) -{ - struct vkQueueBindSparse_params *params = args; - const VkBindSparseInfo *pBindInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p, 0x%s\n", params->queue, params->bindInfoCount, params->pBindInfo, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pBindInfo_host = convert_VkBindSparseInfo_array_win64_to_host(ctx, params->pBindInfo, params->bindInfoCount); - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueBindSparse(wine_queue_from_handle(params->queue)->host_queue, params->bindInfoCount, pBindInfo_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueBindSparse(void *args) -{ - struct - { - PTR32 queue; - uint32_t bindInfoCount; - PTR32 pBindInfo; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; - } *params = args; - const VkBindSparseInfo *pBindInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, 0x%s\n", params->queue, params->bindInfoCount, params->pBindInfo, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pBindInfo_host = convert_VkBindSparseInfo_array_win32_to_host(ctx, (const VkBindSparseInfo32 *)UlongToPtr(params->pBindInfo), params->bindInfoCount); - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueBindSparse(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, params->bindInfoCount, pBindInfo_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueEndDebugUtilsLabelEXT(void *args) -{ - struct vkQueueEndDebugUtilsLabelEXT_params *params = args; - - TRACE("%p\n", params->queue); - - wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueEndDebugUtilsLabelEXT(wine_queue_from_handle(params->queue)->host_queue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueEndDebugUtilsLabelEXT(void *args) -{ - struct - { - PTR32 queue; - } *params = args; - - TRACE("%#x\n", params->queue); - - wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueEndDebugUtilsLabelEXT(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueInsertDebugUtilsLabelEXT(void *args) -{ - struct vkQueueInsertDebugUtilsLabelEXT_params *params = args; - - TRACE("%p, %p\n", params->queue, params->pLabelInfo); - - wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueInsertDebugUtilsLabelEXT(wine_queue_from_handle(params->queue)->host_queue, params->pLabelInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueInsertDebugUtilsLabelEXT(void *args) -{ - struct - { - PTR32 queue; - PTR32 pLabelInfo; - } *params = args; - VkDebugUtilsLabelEXT pLabelInfo_host; - - TRACE("%#x, %#x\n", params->queue, params->pLabelInfo); - - convert_VkDebugUtilsLabelEXT_win32_to_host((const VkDebugUtilsLabelEXT32 *)UlongToPtr(params->pLabelInfo), &pLabelInfo_host); - wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueInsertDebugUtilsLabelEXT(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, &pLabelInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueNotifyOutOfBandNV(void *args) -{ - struct vkQueueNotifyOutOfBandNV_params *params = args; - - TRACE("%p, %p\n", params->queue, params->pQueueTypeInfo); - - wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueNotifyOutOfBandNV(wine_queue_from_handle(params->queue)->host_queue, params->pQueueTypeInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueNotifyOutOfBandNV(void *args) -{ - struct - { - PTR32 queue; - PTR32 pQueueTypeInfo; - } *params = args; - VkOutOfBandQueueTypeInfoNV pQueueTypeInfo_host; - - TRACE("%#x, %#x\n", params->queue, params->pQueueTypeInfo); - - convert_VkOutOfBandQueueTypeInfoNV_win32_to_host((const VkOutOfBandQueueTypeInfoNV32 *)UlongToPtr(params->pQueueTypeInfo), &pQueueTypeInfo_host); - wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueNotifyOutOfBandNV(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, &pQueueTypeInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueuePresentKHR(void *args) -{ - struct vkQueuePresentKHR_params *params = args; - - TRACE("%p, %p\n", params->queue, params->pPresentInfo); - - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueuePresentKHR(wine_queue_from_handle(params->queue)->host_queue, params->pPresentInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueuePresentKHR(void *args) -{ - struct - { - PTR32 queue; - PTR32 pPresentInfo; - VkResult result; - } *params = args; - VkPresentInfoKHR pPresentInfo_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x\n", params->queue, params->pPresentInfo); - - init_conversion_context(ctx); - convert_VkPresentInfoKHR_win32_to_host(ctx, (const VkPresentInfoKHR32 *)UlongToPtr(params->pPresentInfo), &pPresentInfo_host); - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueuePresentKHR(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, &pPresentInfo_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueSetPerformanceConfigurationINTEL(void *args) -{ - struct vkQueueSetPerformanceConfigurationINTEL_params *params = args; - - TRACE("%p, 0x%s\n", params->queue, wine_dbgstr_longlong(params->configuration)); - - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSetPerformanceConfigurationINTEL(wine_queue_from_handle(params->queue)->host_queue, params->configuration); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueSetPerformanceConfigurationINTEL(void *args) -{ - struct - { - PTR32 queue; - VkPerformanceConfigurationINTEL DECLSPEC_ALIGN(8) configuration; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->queue, wine_dbgstr_longlong(params->configuration)); - - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueSetPerformanceConfigurationINTEL(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, params->configuration); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueSubmit(void *args) -{ - struct vkQueueSubmit_params *params = args; - const VkSubmitInfo *pSubmits_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pSubmits_host = convert_VkSubmitInfo_array_win64_to_host(ctx, params->pSubmits, params->submitCount); - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit(wine_queue_from_handle(params->queue)->host_queue, params->submitCount, pSubmits_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueSubmit(void *args) -{ - struct - { - PTR32 queue; - uint32_t submitCount; - PTR32 pSubmits; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; - } *params = args; - const VkSubmitInfo *pSubmits_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pSubmits_host = convert_VkSubmitInfo_array_win32_to_host(ctx, (const VkSubmitInfo32 *)UlongToPtr(params->pSubmits), params->submitCount); - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueSubmit(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, params->submitCount, pSubmits_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueSubmit2(void *args) -{ - struct vkQueueSubmit2_params *params = args; - const VkSubmitInfo2 *pSubmits_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pSubmits_host = convert_VkSubmitInfo2_array_win64_to_host(ctx, params->pSubmits, params->submitCount); - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit2(wine_queue_from_handle(params->queue)->host_queue, params->submitCount, pSubmits_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueSubmit2(void *args) -{ - struct - { - PTR32 queue; - uint32_t submitCount; - PTR32 pSubmits; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; - } *params = args; - const VkSubmitInfo2 *pSubmits_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pSubmits_host = convert_VkSubmitInfo2_array_win32_to_host(ctx, (const VkSubmitInfo232 *)UlongToPtr(params->pSubmits), params->submitCount); - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueSubmit2(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, params->submitCount, pSubmits_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueSubmit2KHR(void *args) -{ - struct vkQueueSubmit2KHR_params *params = args; - const VkSubmitInfo2 *pSubmits_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pSubmits_host = convert_VkSubmitInfo2_array_win64_to_host(ctx, params->pSubmits, params->submitCount); - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit2KHR(wine_queue_from_handle(params->queue)->host_queue, params->submitCount, pSubmits_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueSubmit2KHR(void *args) -{ - struct - { - PTR32 queue; - uint32_t submitCount; - PTR32 pSubmits; - VkFence DECLSPEC_ALIGN(8) fence; - VkResult result; - } *params = args; - const VkSubmitInfo2 *pSubmits_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence)); - - init_conversion_context(ctx); - pSubmits_host = convert_VkSubmitInfo2_array_win32_to_host(ctx, (const VkSubmitInfo232 *)UlongToPtr(params->pSubmits), params->submitCount); - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueSubmit2KHR(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, params->submitCount, pSubmits_host, params->fence); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkQueueWaitIdle(void *args) -{ - struct vkQueueWaitIdle_params *params = args; - - TRACE("%p\n", params->queue); - - params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueWaitIdle(wine_queue_from_handle(params->queue)->host_queue); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkQueueWaitIdle(void *args) -{ - struct - { - PTR32 queue; - VkResult result; - } *params = args; - - TRACE("%#x\n", params->queue); - - params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueueWaitIdle(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkReleasePerformanceConfigurationINTEL(void *args) -{ - struct vkReleasePerformanceConfigurationINTEL_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->configuration)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkReleasePerformanceConfigurationINTEL(wine_device_from_handle(params->device)->host_device, params->configuration); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkReleasePerformanceConfigurationINTEL(void *args) -{ - struct - { - PTR32 device; - VkPerformanceConfigurationINTEL DECLSPEC_ALIGN(8) configuration; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->configuration)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkReleasePerformanceConfigurationINTEL(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->configuration); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkReleaseProfilingLockKHR(void *args) -{ - struct vkReleaseProfilingLockKHR_params *params = args; - - TRACE("%p\n", params->device); - - wine_device_from_handle(params->device)->funcs.p_vkReleaseProfilingLockKHR(wine_device_from_handle(params->device)->host_device); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkReleaseProfilingLockKHR(void *args) -{ - struct - { - PTR32 device; - } *params = args; - - TRACE("%#x\n", params->device); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkReleaseProfilingLockKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkReleaseSwapchainImagesEXT(void *args) -{ - struct vkReleaseSwapchainImagesEXT_params *params = args; - - TRACE("%p, %p\n", params->device, params->pReleaseInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkReleaseSwapchainImagesEXT(wine_device_from_handle(params->device)->host_device, params->pReleaseInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkReleaseSwapchainImagesEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pReleaseInfo; - VkResult result; - } *params = args; - VkReleaseSwapchainImagesInfoEXT pReleaseInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pReleaseInfo); - - convert_VkReleaseSwapchainImagesInfoEXT_win32_to_host((const VkReleaseSwapchainImagesInfoEXT32 *)UlongToPtr(params->pReleaseInfo), &pReleaseInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkReleaseSwapchainImagesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pReleaseInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetCommandBuffer(void *args) -{ - struct vkResetCommandBuffer_params *params = args; - - TRACE("%p, %#x\n", params->commandBuffer, params->flags); - - params->result = wine_cmd_buffer_from_handle(params->commandBuffer)->device->funcs.p_vkResetCommandBuffer(wine_cmd_buffer_from_handle(params->commandBuffer)->host_command_buffer, params->flags); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetCommandBuffer(void *args) -{ - struct - { - PTR32 commandBuffer; - VkCommandBufferResetFlags flags; - VkResult result; - } *params = args; - - TRACE("%#x, %#x\n", params->commandBuffer, params->flags); - - params->result = wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->device->funcs.p_vkResetCommandBuffer(wine_cmd_buffer_from_handle((VkCommandBuffer)UlongToPtr(params->commandBuffer))->host_command_buffer, params->flags); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetCommandPool(void *args) -{ - struct vkResetCommandPool_params *params = args; - - TRACE("%p, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->flags); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkResetCommandPool(wine_device_from_handle(params->device)->host_device, wine_cmd_pool_from_handle(params->commandPool)->host_command_pool, params->flags); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetCommandPool(void *args) -{ - struct - { - PTR32 device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandPoolResetFlags flags; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->flags); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkResetCommandPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_cmd_pool_from_handle(params->commandPool)->host_command_pool, params->flags); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetDescriptorPool(void *args) -{ - struct vkResetDescriptorPool_params *params = args; - - TRACE("%p, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorPool), params->flags); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkResetDescriptorPool(wine_device_from_handle(params->device)->host_device, params->descriptorPool, params->flags); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetDescriptorPool(void *args) -{ - struct - { - PTR32 device; - VkDescriptorPool DECLSPEC_ALIGN(8) descriptorPool; - VkDescriptorPoolResetFlags flags; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorPool), params->flags); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkResetDescriptorPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorPool, params->flags); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetEvent(void *args) -{ - struct vkResetEvent_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->event)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkResetEvent(wine_device_from_handle(params->device)->host_device, params->event); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetEvent(void *args) -{ - struct - { - PTR32 device; - VkEvent DECLSPEC_ALIGN(8) event; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->event)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkResetEvent(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->event); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetFences(void *args) -{ - struct vkResetFences_params *params = args; - - TRACE("%p, %u, %p\n", params->device, params->fenceCount, params->pFences); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkResetFences(wine_device_from_handle(params->device)->host_device, params->fenceCount, params->pFences); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetFences(void *args) -{ - struct - { - PTR32 device; - uint32_t fenceCount; - PTR32 pFences; - VkResult result; - } *params = args; - - TRACE("%#x, %u, %#x\n", params->device, params->fenceCount, params->pFences); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkResetFences(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->fenceCount, (const VkFence *)UlongToPtr(params->pFences)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetQueryPool(void *args) -{ - struct vkResetQueryPool_params *params = args; - - TRACE("%p, 0x%s, %u, %u\n", params->device, wine_dbgstr_longlong(params->queryPool), params->firstQuery, params->queryCount); - - wine_device_from_handle(params->device)->funcs.p_vkResetQueryPool(wine_device_from_handle(params->device)->host_device, params->queryPool, params->firstQuery, params->queryCount); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetQueryPool(void *args) -{ - struct - { - PTR32 device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - } *params = args; - - TRACE("%#x, 0x%s, %u, %u\n", params->device, wine_dbgstr_longlong(params->queryPool), params->firstQuery, params->queryCount); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkResetQueryPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->queryPool, params->firstQuery, params->queryCount); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkResetQueryPoolEXT(void *args) -{ - struct vkResetQueryPoolEXT_params *params = args; - - TRACE("%p, 0x%s, %u, %u\n", params->device, wine_dbgstr_longlong(params->queryPool), params->firstQuery, params->queryCount); - - wine_device_from_handle(params->device)->funcs.p_vkResetQueryPoolEXT(wine_device_from_handle(params->device)->host_device, params->queryPool, params->firstQuery, params->queryCount); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkResetQueryPoolEXT(void *args) -{ - struct - { - PTR32 device; - VkQueryPool DECLSPEC_ALIGN(8) queryPool; - uint32_t firstQuery; - uint32_t queryCount; - } *params = args; - - TRACE("%#x, 0x%s, %u, %u\n", params->device, wine_dbgstr_longlong(params->queryPool), params->firstQuery, params->queryCount); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkResetQueryPoolEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->queryPool, params->firstQuery, params->queryCount); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetDebugUtilsObjectNameEXT(void *args) -{ - struct vkSetDebugUtilsObjectNameEXT_params *params = args; - VkDebugUtilsObjectNameInfoEXT pNameInfo_host; - - TRACE("%p, %p\n", params->device, params->pNameInfo); - - convert_VkDebugUtilsObjectNameInfoEXT_win64_to_host(params->pNameInfo, &pNameInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkSetDebugUtilsObjectNameEXT(wine_device_from_handle(params->device)->host_device, &pNameInfo_host); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetDebugUtilsObjectNameEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pNameInfo; - VkResult result; - } *params = args; - VkDebugUtilsObjectNameInfoEXT pNameInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pNameInfo); - - convert_VkDebugUtilsObjectNameInfoEXT_win32_to_host((const VkDebugUtilsObjectNameInfoEXT32 *)UlongToPtr(params->pNameInfo), &pNameInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetDebugUtilsObjectNameEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pNameInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetDebugUtilsObjectTagEXT(void *args) -{ - struct vkSetDebugUtilsObjectTagEXT_params *params = args; - VkDebugUtilsObjectTagInfoEXT pTagInfo_host; - - TRACE("%p, %p\n", params->device, params->pTagInfo); - - convert_VkDebugUtilsObjectTagInfoEXT_win64_to_host(params->pTagInfo, &pTagInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkSetDebugUtilsObjectTagEXT(wine_device_from_handle(params->device)->host_device, &pTagInfo_host); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetDebugUtilsObjectTagEXT(void *args) -{ - struct - { - PTR32 device; - PTR32 pTagInfo; - VkResult result; - } *params = args; - VkDebugUtilsObjectTagInfoEXT pTagInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pTagInfo); - - convert_VkDebugUtilsObjectTagInfoEXT_win32_to_host((const VkDebugUtilsObjectTagInfoEXT32 *)UlongToPtr(params->pTagInfo), &pTagInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetDebugUtilsObjectTagEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pTagInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetDeviceMemoryPriorityEXT(void *args) -{ - struct vkSetDeviceMemoryPriorityEXT_params *params = args; - - TRACE("%p, 0x%s, %f\n", params->device, wine_dbgstr_longlong(params->memory), params->priority); - - wine_device_from_handle(params->device)->funcs.p_vkSetDeviceMemoryPriorityEXT(wine_device_from_handle(params->device)->host_device, wine_device_memory_from_handle(params->memory)->host_memory, params->priority); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetDeviceMemoryPriorityEXT(void *args) -{ - struct - { - PTR32 device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - float priority; - } *params = args; - - TRACE("%#x, 0x%s, %f\n", params->device, wine_dbgstr_longlong(params->memory), params->priority); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetDeviceMemoryPriorityEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_device_memory_from_handle(params->memory)->host_memory, params->priority); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetEvent(void *args) -{ - struct vkSetEvent_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->event)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkSetEvent(wine_device_from_handle(params->device)->host_device, params->event); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetEvent(void *args) -{ - struct - { - PTR32 device; - VkEvent DECLSPEC_ALIGN(8) event; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->event)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetEvent(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->event); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetHdrMetadataEXT(void *args) -{ - struct vkSetHdrMetadataEXT_params *params = args; - - TRACE("%p, %u, %p, %p\n", params->device, params->swapchainCount, params->pSwapchains, params->pMetadata); - - wine_device_from_handle(params->device)->funcs.p_vkSetHdrMetadataEXT(wine_device_from_handle(params->device)->host_device, params->swapchainCount, params->pSwapchains, params->pMetadata); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetHdrMetadataEXT(void *args) -{ - struct - { - PTR32 device; - uint32_t swapchainCount; - PTR32 pSwapchains; - PTR32 pMetadata; - } *params = args; - const VkHdrMetadataEXT *pMetadata_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x, %#x\n", params->device, params->swapchainCount, params->pSwapchains, params->pMetadata); - - init_conversion_context(ctx); - pMetadata_host = convert_VkHdrMetadataEXT_array_win32_to_host(ctx, (const VkHdrMetadataEXT32 *)UlongToPtr(params->pMetadata), params->swapchainCount); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetHdrMetadataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchainCount, (const VkSwapchainKHR *)UlongToPtr(params->pSwapchains), pMetadata_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetLatencyMarkerNV(void *args) -{ - struct vkSetLatencyMarkerNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo); - - wine_device_from_handle(params->device)->funcs.p_vkSetLatencyMarkerNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pLatencyMarkerInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetLatencyMarkerNV(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - PTR32 pLatencyMarkerInfo; - } *params = args; - VkSetLatencyMarkerInfoNV pLatencyMarkerInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo); - - convert_VkSetLatencyMarkerInfoNV_win32_to_host((const VkSetLatencyMarkerInfoNV32 *)UlongToPtr(params->pLatencyMarkerInfo), &pLatencyMarkerInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetLatencyMarkerNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pLatencyMarkerInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetLatencySleepModeNV(void *args) -{ - struct vkSetLatencySleepModeNV_params *params = args; - - TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepModeInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkSetLatencySleepModeNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pSleepModeInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetLatencySleepModeNV(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - PTR32 pSleepModeInfo; - VkResult result; - } *params = args; - VkLatencySleepModeInfoNV pSleepModeInfo_host; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepModeInfo); - - convert_VkLatencySleepModeInfoNV_win32_to_host((const VkLatencySleepModeInfoNV32 *)UlongToPtr(params->pSleepModeInfo), &pSleepModeInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetLatencySleepModeNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pSleepModeInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetPrivateData(void *args) -{ - struct vkSetPrivateData_params *params = args; - - TRACE("%p, %#x, 0x%s, 0x%s, 0x%s\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), wine_dbgstr_longlong(params->data)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkSetPrivateData(wine_device_from_handle(params->device)->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, params->data); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetPrivateData(void *args) -{ - struct - { - PTR32 device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - uint64_t DECLSPEC_ALIGN(8) data; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, 0x%s, 0x%s, 0x%s\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), wine_dbgstr_longlong(params->data)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetPrivateData(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, params->data); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSetPrivateDataEXT(void *args) -{ - struct vkSetPrivateDataEXT_params *params = args; - - TRACE("%p, %#x, 0x%s, 0x%s, 0x%s\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), wine_dbgstr_longlong(params->data)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkSetPrivateDataEXT(wine_device_from_handle(params->device)->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, params->data); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSetPrivateDataEXT(void *args) -{ - struct - { - PTR32 device; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - VkPrivateDataSlot DECLSPEC_ALIGN(8) privateDataSlot; - uint64_t DECLSPEC_ALIGN(8) data; - VkResult result; - } *params = args; - - TRACE("%#x, %#x, 0x%s, 0x%s, 0x%s\n", params->device, params->objectType, wine_dbgstr_longlong(params->objectHandle), wine_dbgstr_longlong(params->privateDataSlot), wine_dbgstr_longlong(params->data)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetPrivateDataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->objectType, wine_vk_unwrap_handle(params->objectType, params->objectHandle), params->privateDataSlot, params->data); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSignalSemaphore(void *args) -{ - struct vkSignalSemaphore_params *params = args; - - TRACE("%p, %p\n", params->device, params->pSignalInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkSignalSemaphore(wine_device_from_handle(params->device)->host_device, params->pSignalInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSignalSemaphore(void *args) -{ - struct - { - PTR32 device; - PTR32 pSignalInfo; - VkResult result; - } *params = args; - VkSemaphoreSignalInfo pSignalInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pSignalInfo); - - convert_VkSemaphoreSignalInfo_win32_to_host((const VkSemaphoreSignalInfo32 *)UlongToPtr(params->pSignalInfo), &pSignalInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSignalSemaphore(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pSignalInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSignalSemaphoreKHR(void *args) -{ - struct vkSignalSemaphoreKHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pSignalInfo); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkSignalSemaphoreKHR(wine_device_from_handle(params->device)->host_device, params->pSignalInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSignalSemaphoreKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pSignalInfo; - VkResult result; - } *params = args; - VkSemaphoreSignalInfo pSignalInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pSignalInfo); - - convert_VkSemaphoreSignalInfo_win32_to_host((const VkSemaphoreSignalInfo32 *)UlongToPtr(params->pSignalInfo), &pSignalInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSignalSemaphoreKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pSignalInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkSubmitDebugUtilsMessageEXT(void *args) -{ - struct vkSubmitDebugUtilsMessageEXT_params *params = args; - VkDebugUtilsMessengerCallbackDataEXT pCallbackData_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%p, %#x, %#x, %p\n", params->instance, params->messageSeverity, params->messageTypes, params->pCallbackData); - - init_conversion_context(ctx); - convert_VkDebugUtilsMessengerCallbackDataEXT_win64_to_host(ctx, params->pCallbackData, &pCallbackData_host); - wine_instance_from_handle(params->instance)->funcs.p_vkSubmitDebugUtilsMessageEXT(wine_instance_from_handle(params->instance)->host_instance, params->messageSeverity, params->messageTypes, &pCallbackData_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkSubmitDebugUtilsMessageEXT(void *args) -{ - struct - { - PTR32 instance; - VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity; - VkDebugUtilsMessageTypeFlagsEXT messageTypes; - PTR32 pCallbackData; - } *params = args; - VkDebugUtilsMessengerCallbackDataEXT pCallbackData_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %#x, %#x, %#x\n", params->instance, params->messageSeverity, params->messageTypes, params->pCallbackData); - - init_conversion_context(ctx); - convert_VkDebugUtilsMessengerCallbackDataEXT_win32_to_host(ctx, (const VkDebugUtilsMessengerCallbackDataEXT32 *)UlongToPtr(params->pCallbackData), &pCallbackData_host); - wine_instance_from_handle((VkInstance)UlongToPtr(params->instance))->funcs.p_vkSubmitDebugUtilsMessageEXT(wine_instance_from_handle((VkInstance)UlongToPtr(params->instance))->host_instance, params->messageSeverity, params->messageTypes, &pCallbackData_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkTransitionImageLayoutEXT(void *args) -{ - struct vkTransitionImageLayoutEXT_params *params = args; - - TRACE("%p, %u, %p\n", params->device, params->transitionCount, params->pTransitions); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkTransitionImageLayoutEXT(wine_device_from_handle(params->device)->host_device, params->transitionCount, params->pTransitions); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkTransitionImageLayoutEXT(void *args) -{ - struct - { - PTR32 device; - uint32_t transitionCount; - PTR32 pTransitions; - VkResult result; - } *params = args; - const VkHostImageLayoutTransitionInfoEXT *pTransitions_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - TRACE("%#x, %u, %#x\n", params->device, params->transitionCount, params->pTransitions); - - init_conversion_context(ctx); - pTransitions_host = convert_VkHostImageLayoutTransitionInfoEXT_array_win32_to_host(ctx, (const VkHostImageLayoutTransitionInfoEXT32 *)UlongToPtr(params->pTransitions), params->transitionCount); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkTransitionImageLayoutEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->transitionCount, pTransitions_host); - free_conversion_context(ctx); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkTrimCommandPool(void *args) -{ - struct vkTrimCommandPool_params *params = args; - - TRACE("%p, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->flags); - - wine_device_from_handle(params->device)->funcs.p_vkTrimCommandPool(wine_device_from_handle(params->device)->host_device, wine_cmd_pool_from_handle(params->commandPool)->host_command_pool, params->flags); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkTrimCommandPool(void *args) -{ - struct - { - PTR32 device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandPoolTrimFlags flags; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->flags); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkTrimCommandPool(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_cmd_pool_from_handle(params->commandPool)->host_command_pool, params->flags); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkTrimCommandPoolKHR(void *args) -{ - struct vkTrimCommandPoolKHR_params *params = args; - - TRACE("%p, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->flags); - - wine_device_from_handle(params->device)->funcs.p_vkTrimCommandPoolKHR(wine_device_from_handle(params->device)->host_device, wine_cmd_pool_from_handle(params->commandPool)->host_command_pool, params->flags); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkTrimCommandPoolKHR(void *args) -{ - struct - { - PTR32 device; - VkCommandPool DECLSPEC_ALIGN(8) commandPool; - VkCommandPoolTrimFlags flags; - } *params = args; - - TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->commandPool), params->flags); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkTrimCommandPoolKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_cmd_pool_from_handle(params->commandPool)->host_command_pool, params->flags); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkUninitializePerformanceApiINTEL(void *args) -{ - struct vkUninitializePerformanceApiINTEL_params *params = args; - - TRACE("%p\n", params->device); - - wine_device_from_handle(params->device)->funcs.p_vkUninitializePerformanceApiINTEL(wine_device_from_handle(params->device)->host_device); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkUninitializePerformanceApiINTEL(void *args) -{ - struct - { - PTR32 device; - } *params = args; - - TRACE("%#x\n", params->device); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkUninitializePerformanceApiINTEL(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkUnmapMemory(void *args) -{ - struct vkUnmapMemory_params *params = args; - - TRACE("%p, 0x%s\n", params->device, wine_dbgstr_longlong(params->memory)); - - wine_vkUnmapMemory(params->device, params->memory); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkUnmapMemory(void *args) -{ - struct - { - PTR32 device; - VkDeviceMemory DECLSPEC_ALIGN(8) memory; - } *params = args; - - TRACE("%#x, 0x%s\n", params->device, wine_dbgstr_longlong(params->memory)); - - wine_vkUnmapMemory((VkDevice)UlongToPtr(params->device), params->memory); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkUnmapMemory2KHR(void *args) -{ - struct vkUnmapMemory2KHR_params *params = args; - - TRACE("%p, %p\n", params->device, params->pMemoryUnmapInfo); - - params->result = wine_vkUnmapMemory2KHR(params->device, params->pMemoryUnmapInfo); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkUnmapMemory2KHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pMemoryUnmapInfo; - VkResult result; - } *params = args; - VkMemoryUnmapInfoKHR pMemoryUnmapInfo_host; - - TRACE("%#x, %#x\n", params->device, params->pMemoryUnmapInfo); - - convert_VkMemoryUnmapInfoKHR_win32_to_unwrapped_host((const VkMemoryUnmapInfoKHR32 *)UlongToPtr(params->pMemoryUnmapInfo), &pMemoryUnmapInfo_host); - params->result = wine_vkUnmapMemory2KHR((VkDevice)UlongToPtr(params->device), &pMemoryUnmapInfo_host); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static void thunk64_vkUpdateDescriptorSetWithTemplate(void *args) -{ - struct vkUpdateDescriptorSetWithTemplate_params *params = args; - - wine_device_from_handle(params->device)->funcs.p_vkUpdateDescriptorSetWithTemplate(wine_device_from_handle(params->device)->host_device, params->descriptorSet, params->descriptorUpdateTemplate, params->pData); -} -#endif /* _WIN64 */ - -static void thunk32_vkUpdateDescriptorSetWithTemplate(void *args) -{ - struct - { - PTR32 device; - VkDescriptorSet DECLSPEC_ALIGN(8) descriptorSet; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - PTR32 pData; - } *params = args; - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkUpdateDescriptorSetWithTemplate(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorSet, params->descriptorUpdateTemplate, (const void *)UlongToPtr(params->pData)); -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkUpdateDescriptorSetWithTemplateKHR(void *args) -{ - struct vkUpdateDescriptorSetWithTemplateKHR_params *params = args; - - TRACE("%p, 0x%s, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->descriptorSet), wine_dbgstr_longlong(params->descriptorUpdateTemplate), params->pData); - - wine_device_from_handle(params->device)->funcs.p_vkUpdateDescriptorSetWithTemplateKHR(wine_device_from_handle(params->device)->host_device, params->descriptorSet, params->descriptorUpdateTemplate, params->pData); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkUpdateDescriptorSetWithTemplateKHR(void *args) -{ - struct - { - PTR32 device; - VkDescriptorSet DECLSPEC_ALIGN(8) descriptorSet; - VkDescriptorUpdateTemplate DECLSPEC_ALIGN(8) descriptorUpdateTemplate; - PTR32 pData; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->descriptorSet), wine_dbgstr_longlong(params->descriptorUpdateTemplate), params->pData); - - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkUpdateDescriptorSetWithTemplateKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorSet, params->descriptorUpdateTemplate, (const void *)UlongToPtr(params->pData)); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static void thunk64_vkUpdateDescriptorSets(void *args) -{ - struct vkUpdateDescriptorSets_params *params = args; - - wine_device_from_handle(params->device)->funcs.p_vkUpdateDescriptorSets(wine_device_from_handle(params->device)->host_device, params->descriptorWriteCount, params->pDescriptorWrites, params->descriptorCopyCount, params->pDescriptorCopies); -} -#endif /* _WIN64 */ - -static void thunk32_vkUpdateDescriptorSets(void *args) -{ - struct - { - PTR32 device; - uint32_t descriptorWriteCount; - PTR32 pDescriptorWrites; - uint32_t descriptorCopyCount; - PTR32 pDescriptorCopies; - } *params = args; - const VkWriteDescriptorSet *pDescriptorWrites_host; - const VkCopyDescriptorSet *pDescriptorCopies_host; - struct conversion_context local_ctx; - struct conversion_context *ctx = &local_ctx; - - init_conversion_context(ctx); - pDescriptorWrites_host = convert_VkWriteDescriptorSet_array_win32_to_host(ctx, (const VkWriteDescriptorSet32 *)UlongToPtr(params->pDescriptorWrites), params->descriptorWriteCount); - pDescriptorCopies_host = convert_VkCopyDescriptorSet_array_win32_to_host(ctx, (const VkCopyDescriptorSet32 *)UlongToPtr(params->pDescriptorCopies), params->descriptorCopyCount); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkUpdateDescriptorSets(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->descriptorWriteCount, pDescriptorWrites_host, params->descriptorCopyCount, pDescriptorCopies_host); - free_conversion_context(ctx); -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkWaitForFences(void *args) -{ - struct vkWaitForFences_params *params = args; - - TRACE("%p, %u, %p, %u, 0x%s\n", params->device, params->fenceCount, params->pFences, params->waitAll, wine_dbgstr_longlong(params->timeout)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkWaitForFences(wine_device_from_handle(params->device)->host_device, params->fenceCount, params->pFences, params->waitAll, params->timeout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkWaitForFences(void *args) -{ - struct - { - PTR32 device; - uint32_t fenceCount; - PTR32 pFences; - VkBool32 waitAll; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; - } *params = args; - - TRACE("%#x, %u, %#x, %u, 0x%s\n", params->device, params->fenceCount, params->pFences, params->waitAll, wine_dbgstr_longlong(params->timeout)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWaitForFences(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->fenceCount, (const VkFence *)UlongToPtr(params->pFences), params->waitAll, params->timeout); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkWaitForPresentKHR(void *args) -{ - struct vkWaitForPresentKHR_params *params = args; - - TRACE("%p, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->presentId), wine_dbgstr_longlong(params->timeout)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkWaitForPresentKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, params->presentId, params->timeout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkWaitForPresentKHR(void *args) -{ - struct - { - PTR32 device; - VkSwapchainKHR DECLSPEC_ALIGN(8) swapchain; - uint64_t DECLSPEC_ALIGN(8) presentId; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; - } *params = args; - - TRACE("%#x, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->presentId), wine_dbgstr_longlong(params->timeout)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWaitForPresentKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, params->presentId, params->timeout); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkWaitSemaphores(void *args) -{ - struct vkWaitSemaphores_params *params = args; - - TRACE("%p, %p, 0x%s\n", params->device, params->pWaitInfo, wine_dbgstr_longlong(params->timeout)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkWaitSemaphores(wine_device_from_handle(params->device)->host_device, params->pWaitInfo, params->timeout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkWaitSemaphores(void *args) -{ - struct - { - PTR32 device; - PTR32 pWaitInfo; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; - } *params = args; - VkSemaphoreWaitInfo pWaitInfo_host; - - TRACE("%#x, %#x, 0x%s\n", params->device, params->pWaitInfo, wine_dbgstr_longlong(params->timeout)); - - convert_VkSemaphoreWaitInfo_win32_to_host((const VkSemaphoreWaitInfo32 *)UlongToPtr(params->pWaitInfo), &pWaitInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWaitSemaphores(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pWaitInfo_host, params->timeout); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkWaitSemaphoresKHR(void *args) -{ - struct vkWaitSemaphoresKHR_params *params = args; - - TRACE("%p, %p, 0x%s\n", params->device, params->pWaitInfo, wine_dbgstr_longlong(params->timeout)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkWaitSemaphoresKHR(wine_device_from_handle(params->device)->host_device, params->pWaitInfo, params->timeout); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkWaitSemaphoresKHR(void *args) -{ - struct - { - PTR32 device; - PTR32 pWaitInfo; - uint64_t DECLSPEC_ALIGN(8) timeout; - VkResult result; - } *params = args; - VkSemaphoreWaitInfo pWaitInfo_host; - - TRACE("%#x, %#x, 0x%s\n", params->device, params->pWaitInfo, wine_dbgstr_longlong(params->timeout)); - - convert_VkSemaphoreWaitInfo_win32_to_host((const VkSemaphoreWaitInfo32 *)UlongToPtr(params->pWaitInfo), &pWaitInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWaitSemaphoresKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pWaitInfo_host, params->timeout); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkWriteAccelerationStructuresPropertiesKHR(void *args) -{ - struct vkWriteAccelerationStructuresPropertiesKHR_params *params = args; - - TRACE("%p, %u, %p, %#x, 0x%s, %p, 0x%s\n", params->device, params->accelerationStructureCount, params->pAccelerationStructures, params->queryType, wine_dbgstr_longlong(params->dataSize), params->pData, wine_dbgstr_longlong(params->stride)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkWriteAccelerationStructuresPropertiesKHR(wine_device_from_handle(params->device)->host_device, params->accelerationStructureCount, params->pAccelerationStructures, params->queryType, params->dataSize, params->pData, params->stride); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkWriteAccelerationStructuresPropertiesKHR(void *args) -{ - struct - { - PTR32 device; - uint32_t accelerationStructureCount; - PTR32 pAccelerationStructures; - VkQueryType queryType; - PTR32 dataSize; - PTR32 pData; - PTR32 stride; - VkResult result; - } *params = args; - - TRACE("%#x, %u, %#x, %#x, 0x%s, %#x, 0x%s\n", params->device, params->accelerationStructureCount, params->pAccelerationStructures, params->queryType, wine_dbgstr_longlong(params->dataSize), params->pData, wine_dbgstr_longlong(params->stride)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWriteAccelerationStructuresPropertiesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->accelerationStructureCount, (const VkAccelerationStructureKHR *)UlongToPtr(params->pAccelerationStructures), params->queryType, params->dataSize, (void *)UlongToPtr(params->pData), params->stride); - return STATUS_SUCCESS; -} - -#ifdef _WIN64 -static NTSTATUS thunk64_vkWriteMicromapsPropertiesEXT(void *args) -{ - struct vkWriteMicromapsPropertiesEXT_params *params = args; - - TRACE("%p, %u, %p, %#x, 0x%s, %p, 0x%s\n", params->device, params->micromapCount, params->pMicromaps, params->queryType, wine_dbgstr_longlong(params->dataSize), params->pData, wine_dbgstr_longlong(params->stride)); - - params->result = wine_device_from_handle(params->device)->funcs.p_vkWriteMicromapsPropertiesEXT(wine_device_from_handle(params->device)->host_device, params->micromapCount, params->pMicromaps, params->queryType, params->dataSize, params->pData, params->stride); - return STATUS_SUCCESS; -} -#endif /* _WIN64 */ - -static NTSTATUS thunk32_vkWriteMicromapsPropertiesEXT(void *args) -{ - struct - { - PTR32 device; - uint32_t micromapCount; - PTR32 pMicromaps; - VkQueryType queryType; - PTR32 dataSize; - PTR32 pData; - PTR32 stride; - VkResult result; - } *params = args; - - TRACE("%#x, %u, %#x, %#x, 0x%s, %#x, 0x%s\n", params->device, params->micromapCount, params->pMicromaps, params->queryType, wine_dbgstr_longlong(params->dataSize), params->pData, wine_dbgstr_longlong(params->stride)); - - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWriteMicromapsPropertiesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->micromapCount, (const VkMicromapEXT *)UlongToPtr(params->pMicromaps), params->queryType, params->dataSize, (void *)UlongToPtr(params->pData), params->stride); - return STATUS_SUCCESS; -} - -static const char * const vk_device_extensions[] = -{ - "VK_AMD_buffer_marker", - "VK_AMD_device_coherent_memory", - "VK_AMD_draw_indirect_count", - "VK_AMD_gcn_shader", - "VK_AMD_gpu_shader_half_float", - "VK_AMD_gpu_shader_int16", - "VK_AMD_memory_overallocation_behavior", - "VK_AMD_mixed_attachment_samples", - "VK_AMD_negative_viewport_height", - "VK_AMD_pipeline_compiler_control", - "VK_AMD_rasterization_order", - "VK_AMD_shader_ballot", - "VK_AMD_shader_core_properties", - "VK_AMD_shader_core_properties2", - "VK_AMD_shader_early_and_late_fragment_tests", - "VK_AMD_shader_explicit_vertex_parameter", - "VK_AMD_shader_fragment_mask", - "VK_AMD_shader_image_load_store_lod", - "VK_AMD_shader_info", - "VK_AMD_shader_trinary_minmax", - "VK_AMD_texture_gather_bias_lod", - "VK_ARM_rasterization_order_attachment_access", - "VK_ARM_scheduling_controls", - "VK_ARM_shader_core_builtins", - "VK_ARM_shader_core_properties", - "VK_EXT_4444_formats", - "VK_EXT_astc_decode_mode", - "VK_EXT_attachment_feedback_loop_dynamic_state", - "VK_EXT_attachment_feedback_loop_layout", - "VK_EXT_blend_operation_advanced", - "VK_EXT_border_color_swizzle", - "VK_EXT_buffer_device_address", - "VK_EXT_calibrated_timestamps", - "VK_EXT_color_write_enable", - "VK_EXT_conditional_rendering", - "VK_EXT_conservative_rasterization", - "VK_EXT_custom_border_color", - "VK_EXT_debug_marker", - "VK_EXT_depth_bias_control", - "VK_EXT_depth_clamp_zero_one", - "VK_EXT_depth_clip_control", - "VK_EXT_depth_clip_enable", - "VK_EXT_depth_range_unrestricted", - "VK_EXT_descriptor_buffer", - "VK_EXT_descriptor_indexing", - "VK_EXT_device_address_binding_report", - "VK_EXT_device_fault", - "VK_EXT_discard_rectangles", - "VK_EXT_dynamic_rendering_unused_attachments", - "VK_EXT_extended_dynamic_state", - "VK_EXT_extended_dynamic_state2", - "VK_EXT_extended_dynamic_state3", - "VK_EXT_external_memory_acquire_unmodified", - "VK_EXT_external_memory_host", - "VK_EXT_filter_cubic", - "VK_EXT_fragment_density_map", - "VK_EXT_fragment_density_map2", - "VK_EXT_fragment_shader_interlock", - "VK_EXT_frame_boundary", - "VK_EXT_global_priority", - "VK_EXT_global_priority_query", - "VK_EXT_graphics_pipeline_library", - "VK_EXT_hdr_metadata", - "VK_EXT_host_image_copy", - "VK_EXT_host_query_reset", - "VK_EXT_image_2d_view_of_3d", - "VK_EXT_image_compression_control", - "VK_EXT_image_compression_control_swapchain", - "VK_EXT_image_robustness", - "VK_EXT_image_sliced_view_of_3d", - "VK_EXT_image_view_min_lod", - "VK_EXT_index_type_uint8", - "VK_EXT_inline_uniform_block", - "VK_EXT_legacy_dithering", - "VK_EXT_line_rasterization", - "VK_EXT_load_store_op_none", - "VK_EXT_memory_budget", - "VK_EXT_memory_priority", - "VK_EXT_mesh_shader", - "VK_EXT_multi_draw", - "VK_EXT_multisampled_render_to_single_sampled", - "VK_EXT_mutable_descriptor_type", - "VK_EXT_nested_command_buffer", - "VK_EXT_non_seamless_cube_map", - "VK_EXT_opacity_micromap", - "VK_EXT_pageable_device_local_memory", - "VK_EXT_pci_bus_info", - "VK_EXT_pipeline_creation_cache_control", - "VK_EXT_pipeline_creation_feedback", - "VK_EXT_pipeline_library_group_handles", - "VK_EXT_pipeline_properties", - "VK_EXT_pipeline_protected_access", - "VK_EXT_pipeline_robustness", - "VK_EXT_post_depth_coverage", - "VK_EXT_primitive_topology_list_restart", - "VK_EXT_primitives_generated_query", - "VK_EXT_private_data", - "VK_EXT_provoking_vertex", - "VK_EXT_queue_family_foreign", - "VK_EXT_rasterization_order_attachment_access", - "VK_EXT_rgba10x6_formats", - "VK_EXT_robustness2", - "VK_EXT_sample_locations", - "VK_EXT_sampler_filter_minmax", - "VK_EXT_scalar_block_layout", - "VK_EXT_separate_stencil_usage", - "VK_EXT_shader_atomic_float", - "VK_EXT_shader_atomic_float2", - "VK_EXT_shader_demote_to_helper_invocation", - "VK_EXT_shader_image_atomic_int64", - "VK_EXT_shader_module_identifier", - "VK_EXT_shader_object", - "VK_EXT_shader_stencil_export", - "VK_EXT_shader_subgroup_ballot", - "VK_EXT_shader_subgroup_vote", - "VK_EXT_shader_tile_image", - "VK_EXT_shader_viewport_index_layer", - "VK_EXT_subgroup_size_control", - "VK_EXT_subpass_merge_feedback", - "VK_EXT_swapchain_maintenance1", - "VK_EXT_texel_buffer_alignment", - "VK_EXT_texture_compression_astc_hdr", - "VK_EXT_tooling_info", - "VK_EXT_transform_feedback", - "VK_EXT_validation_cache", - "VK_EXT_vertex_attribute_divisor", - "VK_EXT_vertex_input_dynamic_state", - "VK_EXT_ycbcr_2plane_444_formats", - "VK_EXT_ycbcr_image_arrays", - "VK_GOOGLE_decorate_string", - "VK_GOOGLE_hlsl_functionality1", - "VK_GOOGLE_user_type", - "VK_HUAWEI_cluster_culling_shader", - "VK_HUAWEI_invocation_mask", - "VK_HUAWEI_subpass_shading", - "VK_IMG_filter_cubic", - "VK_IMG_format_pvrtc", - "VK_IMG_relaxed_line_rasterization", - "VK_INTEL_performance_query", - "VK_INTEL_shader_integer_functions2", - "VK_KHR_16bit_storage", - "VK_KHR_8bit_storage", - "VK_KHR_acceleration_structure", - "VK_KHR_bind_memory2", - "VK_KHR_buffer_device_address", - "VK_KHR_cooperative_matrix", - "VK_KHR_copy_commands2", - "VK_KHR_create_renderpass2", - "VK_KHR_dedicated_allocation", - "VK_KHR_deferred_host_operations", - "VK_KHR_depth_stencil_resolve", - "VK_KHR_descriptor_update_template", - "VK_KHR_device_group", - "VK_KHR_draw_indirect_count", - "VK_KHR_driver_properties", - "VK_KHR_dynamic_rendering", - "VK_KHR_external_fence", - "VK_KHR_external_memory", - "VK_KHR_external_semaphore", - "VK_KHR_format_feature_flags2", - "VK_KHR_fragment_shader_barycentric", - "VK_KHR_fragment_shading_rate", - "VK_KHR_get_memory_requirements2", - "VK_KHR_global_priority", - "VK_KHR_image_format_list", - "VK_KHR_imageless_framebuffer", - "VK_KHR_incremental_present", - "VK_KHR_maintenance1", - "VK_KHR_maintenance2", - "VK_KHR_maintenance3", - "VK_KHR_maintenance4", - "VK_KHR_maintenance5", - "VK_KHR_map_memory2", - "VK_KHR_multiview", - "VK_KHR_performance_query", - "VK_KHR_pipeline_executable_properties", - "VK_KHR_pipeline_library", - "VK_KHR_present_id", - "VK_KHR_present_wait", - "VK_KHR_push_descriptor", - "VK_KHR_ray_query", - "VK_KHR_ray_tracing_maintenance1", - "VK_KHR_ray_tracing_pipeline", - "VK_KHR_ray_tracing_position_fetch", - "VK_KHR_relaxed_block_layout", - "VK_KHR_sampler_mirror_clamp_to_edge", - "VK_KHR_sampler_ycbcr_conversion", - "VK_KHR_separate_depth_stencil_layouts", - "VK_KHR_shader_atomic_int64", - "VK_KHR_shader_clock", - "VK_KHR_shader_draw_parameters", - "VK_KHR_shader_float16_int8", - "VK_KHR_shader_float_controls", - "VK_KHR_shader_integer_dot_product", - "VK_KHR_shader_non_semantic_info", - "VK_KHR_shader_subgroup_extended_types", - "VK_KHR_shader_subgroup_uniform_control_flow", - "VK_KHR_shader_terminate_invocation", - "VK_KHR_spirv_1_4", - "VK_KHR_storage_buffer_storage_class", - "VK_KHR_swapchain", - "VK_KHR_swapchain_mutable_format", - "VK_KHR_synchronization2", - "VK_KHR_timeline_semaphore", - "VK_KHR_uniform_buffer_standard_layout", - "VK_KHR_variable_pointers", - "VK_KHR_vulkan_memory_model", - "VK_KHR_workgroup_memory_explicit_layout", - "VK_KHR_zero_initialize_workgroup_memory", - "VK_MSFT_layered_driver", - "VK_NVX_binary_import", - "VK_NVX_image_view_handle", - "VK_NV_clip_space_w_scaling", - "VK_NV_compute_shader_derivatives", - "VK_NV_cooperative_matrix", - "VK_NV_copy_memory_indirect", - "VK_NV_corner_sampled_image", - "VK_NV_coverage_reduction_mode", - "VK_NV_cuda_kernel_launch", - "VK_NV_dedicated_allocation", - "VK_NV_dedicated_allocation_image_aliasing", - "VK_NV_descriptor_pool_overallocation", - "VK_NV_device_diagnostic_checkpoints", - "VK_NV_device_diagnostics_config", - "VK_NV_device_generated_commands", - "VK_NV_device_generated_commands_compute", - "VK_NV_extended_sparse_address_space", - "VK_NV_fill_rectangle", - "VK_NV_fragment_coverage_to_color", - "VK_NV_fragment_shader_barycentric", - "VK_NV_fragment_shading_rate_enums", - "VK_NV_framebuffer_mixed_samples", - "VK_NV_geometry_shader_passthrough", - "VK_NV_glsl_shader", - "VK_NV_inherited_viewport_scissor", - "VK_NV_linear_color_attachment", - "VK_NV_low_latency", - "VK_NV_low_latency2", - "VK_NV_memory_decompression", - "VK_NV_mesh_shader", - "VK_NV_optical_flow", - "VK_NV_present_barrier", - "VK_NV_ray_tracing", - "VK_NV_ray_tracing_invocation_reorder", - "VK_NV_ray_tracing_motion_blur", - "VK_NV_representative_fragment_test", - "VK_NV_sample_mask_override_coverage", - "VK_NV_scissor_exclusive", - "VK_NV_shader_image_footprint", - "VK_NV_shader_sm_builtins", - "VK_NV_shader_subgroup_partitioned", - "VK_NV_shading_rate_image", - "VK_NV_viewport_array2", - "VK_NV_viewport_swizzle", - "VK_QCOM_filter_cubic_clamp", - "VK_QCOM_filter_cubic_weights", - "VK_QCOM_fragment_density_map_offset", - "VK_QCOM_image_processing", - "VK_QCOM_image_processing2", - "VK_QCOM_multiview_per_view_render_areas", - "VK_QCOM_multiview_per_view_viewports", - "VK_QCOM_render_pass_shader_resolve", - "VK_QCOM_render_pass_store_ops", - "VK_QCOM_render_pass_transform", - "VK_QCOM_rotated_copy_commands", - "VK_QCOM_tile_properties", - "VK_QCOM_ycbcr_degamma", - "VK_VALVE_descriptor_set_host_mapping", - "VK_VALVE_mutable_descriptor_type", -}; - -static const char * const vk_instance_extensions[] = -{ - "VK_EXT_debug_report", - "VK_EXT_debug_utils", - "VK_EXT_layer_settings", - "VK_EXT_surface_maintenance1", - "VK_EXT_swapchain_colorspace", - "VK_EXT_validation_features", - "VK_EXT_validation_flags", - "VK_KHR_device_group_creation", - "VK_KHR_external_fence_capabilities", - "VK_KHR_external_memory_capabilities", - "VK_KHR_external_semaphore_capabilities", - "VK_KHR_get_physical_device_properties2", - "VK_KHR_get_surface_capabilities2", - "VK_KHR_portability_enumeration", - "VK_KHR_surface", - "VK_KHR_win32_surface", -}; - -BOOL wine_vk_device_extension_supported(const char *name) -{ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(vk_device_extensions); i++) - { - if (strcmp(vk_device_extensions[i], name) == 0) - return TRUE; - } - return FALSE; -} - -BOOL wine_vk_instance_extension_supported(const char *name) -{ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(vk_instance_extensions); i++) - { - if (strcmp(vk_instance_extensions[i], name) == 0) - return TRUE; - } - return FALSE; -} - -BOOL wine_vk_is_type_wrapped(VkObjectType type) -{ - return FALSE || - type == VK_OBJECT_TYPE_COMMAND_BUFFER || - type == VK_OBJECT_TYPE_COMMAND_POOL || - type == VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT || - type == VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT || - type == VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR || - type == VK_OBJECT_TYPE_DEVICE || - type == VK_OBJECT_TYPE_DEVICE_MEMORY || - type == VK_OBJECT_TYPE_INSTANCE || - type == VK_OBJECT_TYPE_PHYSICAL_DEVICE || - type == VK_OBJECT_TYPE_QUEUE || - type == VK_OBJECT_TYPE_SURFACE_KHR; -} - -#ifdef _WIN64 - -const unixlib_entry_t __wine_unix_call_funcs[] = -{ - init_vulkan, - vk_is_available_instance_function, - vk_is_available_device_function, - thunk64_vkAcquireNextImage2KHR, - thunk64_vkAcquireNextImageKHR, - thunk64_vkAcquirePerformanceConfigurationINTEL, - thunk64_vkAcquireProfilingLockKHR, - thunk64_vkAllocateCommandBuffers, - thunk64_vkAllocateDescriptorSets, - thunk64_vkAllocateMemory, - thunk64_vkBeginCommandBuffer, - thunk64_vkBindAccelerationStructureMemoryNV, - thunk64_vkBindBufferMemory, - thunk64_vkBindBufferMemory2, - thunk64_vkBindBufferMemory2KHR, - thunk64_vkBindImageMemory, - thunk64_vkBindImageMemory2, - thunk64_vkBindImageMemory2KHR, - thunk64_vkBindOpticalFlowSessionImageNV, - thunk64_vkBuildAccelerationStructuresKHR, - thunk64_vkBuildMicromapsEXT, - (void *)thunk64_vkCmdBeginConditionalRenderingEXT, - (void *)thunk64_vkCmdBeginDebugUtilsLabelEXT, - (void *)thunk64_vkCmdBeginQuery, - (void *)thunk64_vkCmdBeginQueryIndexedEXT, - (void *)thunk64_vkCmdBeginRenderPass, - (void *)thunk64_vkCmdBeginRenderPass2, - (void *)thunk64_vkCmdBeginRenderPass2KHR, - (void *)thunk64_vkCmdBeginRendering, - (void *)thunk64_vkCmdBeginRenderingKHR, - (void *)thunk64_vkCmdBeginTransformFeedbackEXT, - (void *)thunk64_vkCmdBindDescriptorBufferEmbeddedSamplersEXT, - (void *)thunk64_vkCmdBindDescriptorBuffersEXT, - (void *)thunk64_vkCmdBindDescriptorSets, - (void *)thunk64_vkCmdBindIndexBuffer, - (void *)thunk64_vkCmdBindIndexBuffer2KHR, - (void *)thunk64_vkCmdBindInvocationMaskHUAWEI, - (void *)thunk64_vkCmdBindPipeline, - (void *)thunk64_vkCmdBindPipelineShaderGroupNV, - (void *)thunk64_vkCmdBindShadersEXT, - (void *)thunk64_vkCmdBindShadingRateImageNV, - (void *)thunk64_vkCmdBindTransformFeedbackBuffersEXT, - (void *)thunk64_vkCmdBindVertexBuffers, - (void *)thunk64_vkCmdBindVertexBuffers2, - (void *)thunk64_vkCmdBindVertexBuffers2EXT, - (void *)thunk64_vkCmdBlitImage, - (void *)thunk64_vkCmdBlitImage2, - (void *)thunk64_vkCmdBlitImage2KHR, - (void *)thunk64_vkCmdBuildAccelerationStructureNV, - (void *)thunk64_vkCmdBuildAccelerationStructuresIndirectKHR, - (void *)thunk64_vkCmdBuildAccelerationStructuresKHR, - (void *)thunk64_vkCmdBuildMicromapsEXT, - (void *)thunk64_vkCmdClearAttachments, - (void *)thunk64_vkCmdClearColorImage, - (void *)thunk64_vkCmdClearDepthStencilImage, - (void *)thunk64_vkCmdCopyAccelerationStructureKHR, - (void *)thunk64_vkCmdCopyAccelerationStructureNV, - (void *)thunk64_vkCmdCopyAccelerationStructureToMemoryKHR, - (void *)thunk64_vkCmdCopyBuffer, - (void *)thunk64_vkCmdCopyBuffer2, - (void *)thunk64_vkCmdCopyBuffer2KHR, - (void *)thunk64_vkCmdCopyBufferToImage, - (void *)thunk64_vkCmdCopyBufferToImage2, - (void *)thunk64_vkCmdCopyBufferToImage2KHR, - (void *)thunk64_vkCmdCopyImage, - (void *)thunk64_vkCmdCopyImage2, - (void *)thunk64_vkCmdCopyImage2KHR, - (void *)thunk64_vkCmdCopyImageToBuffer, - (void *)thunk64_vkCmdCopyImageToBuffer2, - (void *)thunk64_vkCmdCopyImageToBuffer2KHR, - (void *)thunk64_vkCmdCopyMemoryIndirectNV, - (void *)thunk64_vkCmdCopyMemoryToAccelerationStructureKHR, - (void *)thunk64_vkCmdCopyMemoryToImageIndirectNV, - (void *)thunk64_vkCmdCopyMemoryToMicromapEXT, - (void *)thunk64_vkCmdCopyMicromapEXT, - (void *)thunk64_vkCmdCopyMicromapToMemoryEXT, - (void *)thunk64_vkCmdCopyQueryPoolResults, - (void *)thunk64_vkCmdCuLaunchKernelNVX, - (void *)thunk64_vkCmdCudaLaunchKernelNV, - (void *)thunk64_vkCmdDebugMarkerBeginEXT, - (void *)thunk64_vkCmdDebugMarkerEndEXT, - (void *)thunk64_vkCmdDebugMarkerInsertEXT, - (void *)thunk64_vkCmdDecompressMemoryIndirectCountNV, - (void *)thunk64_vkCmdDecompressMemoryNV, - (void *)thunk64_vkCmdDispatch, - (void *)thunk64_vkCmdDispatchBase, - (void *)thunk64_vkCmdDispatchBaseKHR, - (void *)thunk64_vkCmdDispatchIndirect, - (void *)thunk64_vkCmdDraw, - (void *)thunk64_vkCmdDrawClusterHUAWEI, - (void *)thunk64_vkCmdDrawClusterIndirectHUAWEI, - (void *)thunk64_vkCmdDrawIndexed, - (void *)thunk64_vkCmdDrawIndexedIndirect, - (void *)thunk64_vkCmdDrawIndexedIndirectCount, - (void *)thunk64_vkCmdDrawIndexedIndirectCountAMD, - (void *)thunk64_vkCmdDrawIndexedIndirectCountKHR, - (void *)thunk64_vkCmdDrawIndirect, - (void *)thunk64_vkCmdDrawIndirectByteCountEXT, - (void *)thunk64_vkCmdDrawIndirectCount, - (void *)thunk64_vkCmdDrawIndirectCountAMD, - (void *)thunk64_vkCmdDrawIndirectCountKHR, - (void *)thunk64_vkCmdDrawMeshTasksEXT, - (void *)thunk64_vkCmdDrawMeshTasksIndirectCountEXT, - (void *)thunk64_vkCmdDrawMeshTasksIndirectCountNV, - (void *)thunk64_vkCmdDrawMeshTasksIndirectEXT, - (void *)thunk64_vkCmdDrawMeshTasksIndirectNV, - (void *)thunk64_vkCmdDrawMeshTasksNV, - (void *)thunk64_vkCmdDrawMultiEXT, - (void *)thunk64_vkCmdDrawMultiIndexedEXT, - (void *)thunk64_vkCmdEndConditionalRenderingEXT, - (void *)thunk64_vkCmdEndDebugUtilsLabelEXT, - (void *)thunk64_vkCmdEndQuery, - (void *)thunk64_vkCmdEndQueryIndexedEXT, - (void *)thunk64_vkCmdEndRenderPass, - (void *)thunk64_vkCmdEndRenderPass2, - (void *)thunk64_vkCmdEndRenderPass2KHR, - (void *)thunk64_vkCmdEndRendering, - (void *)thunk64_vkCmdEndRenderingKHR, - (void *)thunk64_vkCmdEndTransformFeedbackEXT, - (void *)thunk64_vkCmdExecuteCommands, - (void *)thunk64_vkCmdExecuteGeneratedCommandsNV, - (void *)thunk64_vkCmdFillBuffer, - (void *)thunk64_vkCmdInsertDebugUtilsLabelEXT, - (void *)thunk64_vkCmdNextSubpass, - (void *)thunk64_vkCmdNextSubpass2, - (void *)thunk64_vkCmdNextSubpass2KHR, - (void *)thunk64_vkCmdOpticalFlowExecuteNV, - (void *)thunk64_vkCmdPipelineBarrier, - (void *)thunk64_vkCmdPipelineBarrier2, - (void *)thunk64_vkCmdPipelineBarrier2KHR, - (void *)thunk64_vkCmdPreprocessGeneratedCommandsNV, - (void *)thunk64_vkCmdPushConstants, - (void *)thunk64_vkCmdPushDescriptorSetKHR, - (void *)thunk64_vkCmdPushDescriptorSetWithTemplateKHR, - (void *)thunk64_vkCmdResetEvent, - (void *)thunk64_vkCmdResetEvent2, - (void *)thunk64_vkCmdResetEvent2KHR, - (void *)thunk64_vkCmdResetQueryPool, - (void *)thunk64_vkCmdResolveImage, - (void *)thunk64_vkCmdResolveImage2, - (void *)thunk64_vkCmdResolveImage2KHR, - (void *)thunk64_vkCmdSetAlphaToCoverageEnableEXT, - (void *)thunk64_vkCmdSetAlphaToOneEnableEXT, - (void *)thunk64_vkCmdSetAttachmentFeedbackLoopEnableEXT, - (void *)thunk64_vkCmdSetBlendConstants, - (void *)thunk64_vkCmdSetCheckpointNV, - (void *)thunk64_vkCmdSetCoarseSampleOrderNV, - (void *)thunk64_vkCmdSetColorBlendAdvancedEXT, - (void *)thunk64_vkCmdSetColorBlendEnableEXT, - (void *)thunk64_vkCmdSetColorBlendEquationEXT, - (void *)thunk64_vkCmdSetColorWriteEnableEXT, - (void *)thunk64_vkCmdSetColorWriteMaskEXT, - (void *)thunk64_vkCmdSetConservativeRasterizationModeEXT, - (void *)thunk64_vkCmdSetCoverageModulationModeNV, - (void *)thunk64_vkCmdSetCoverageModulationTableEnableNV, - (void *)thunk64_vkCmdSetCoverageModulationTableNV, - (void *)thunk64_vkCmdSetCoverageReductionModeNV, - (void *)thunk64_vkCmdSetCoverageToColorEnableNV, - (void *)thunk64_vkCmdSetCoverageToColorLocationNV, - (void *)thunk64_vkCmdSetCullMode, - (void *)thunk64_vkCmdSetCullModeEXT, - (void *)thunk64_vkCmdSetDepthBias, - (void *)thunk64_vkCmdSetDepthBias2EXT, - (void *)thunk64_vkCmdSetDepthBiasEnable, - (void *)thunk64_vkCmdSetDepthBiasEnableEXT, - (void *)thunk64_vkCmdSetDepthBounds, - (void *)thunk64_vkCmdSetDepthBoundsTestEnable, - (void *)thunk64_vkCmdSetDepthBoundsTestEnableEXT, - (void *)thunk64_vkCmdSetDepthClampEnableEXT, - (void *)thunk64_vkCmdSetDepthClipEnableEXT, - (void *)thunk64_vkCmdSetDepthClipNegativeOneToOneEXT, - (void *)thunk64_vkCmdSetDepthCompareOp, - (void *)thunk64_vkCmdSetDepthCompareOpEXT, - (void *)thunk64_vkCmdSetDepthTestEnable, - (void *)thunk64_vkCmdSetDepthTestEnableEXT, - (void *)thunk64_vkCmdSetDepthWriteEnable, - (void *)thunk64_vkCmdSetDepthWriteEnableEXT, - (void *)thunk64_vkCmdSetDescriptorBufferOffsetsEXT, - (void *)thunk64_vkCmdSetDeviceMask, - (void *)thunk64_vkCmdSetDeviceMaskKHR, - (void *)thunk64_vkCmdSetDiscardRectangleEXT, - (void *)thunk64_vkCmdSetDiscardRectangleEnableEXT, - (void *)thunk64_vkCmdSetDiscardRectangleModeEXT, - (void *)thunk64_vkCmdSetEvent, - (void *)thunk64_vkCmdSetEvent2, - (void *)thunk64_vkCmdSetEvent2KHR, - (void *)thunk64_vkCmdSetExclusiveScissorEnableNV, - (void *)thunk64_vkCmdSetExclusiveScissorNV, - (void *)thunk64_vkCmdSetExtraPrimitiveOverestimationSizeEXT, - (void *)thunk64_vkCmdSetFragmentShadingRateEnumNV, - (void *)thunk64_vkCmdSetFragmentShadingRateKHR, - (void *)thunk64_vkCmdSetFrontFace, - (void *)thunk64_vkCmdSetFrontFaceEXT, - (void *)thunk64_vkCmdSetLineRasterizationModeEXT, - (void *)thunk64_vkCmdSetLineStippleEXT, - (void *)thunk64_vkCmdSetLineStippleEnableEXT, - (void *)thunk64_vkCmdSetLineWidth, - (void *)thunk64_vkCmdSetLogicOpEXT, - (void *)thunk64_vkCmdSetLogicOpEnableEXT, - (void *)thunk64_vkCmdSetPatchControlPointsEXT, - thunk64_vkCmdSetPerformanceMarkerINTEL, - thunk64_vkCmdSetPerformanceOverrideINTEL, - thunk64_vkCmdSetPerformanceStreamMarkerINTEL, - (void *)thunk64_vkCmdSetPolygonModeEXT, - (void *)thunk64_vkCmdSetPrimitiveRestartEnable, - (void *)thunk64_vkCmdSetPrimitiveRestartEnableEXT, - (void *)thunk64_vkCmdSetPrimitiveTopology, - (void *)thunk64_vkCmdSetPrimitiveTopologyEXT, - (void *)thunk64_vkCmdSetProvokingVertexModeEXT, - (void *)thunk64_vkCmdSetRasterizationSamplesEXT, - (void *)thunk64_vkCmdSetRasterizationStreamEXT, - (void *)thunk64_vkCmdSetRasterizerDiscardEnable, - (void *)thunk64_vkCmdSetRasterizerDiscardEnableEXT, - (void *)thunk64_vkCmdSetRayTracingPipelineStackSizeKHR, - (void *)thunk64_vkCmdSetRepresentativeFragmentTestEnableNV, - (void *)thunk64_vkCmdSetSampleLocationsEXT, - (void *)thunk64_vkCmdSetSampleLocationsEnableEXT, - (void *)thunk64_vkCmdSetSampleMaskEXT, - (void *)thunk64_vkCmdSetScissor, - (void *)thunk64_vkCmdSetScissorWithCount, - (void *)thunk64_vkCmdSetScissorWithCountEXT, - (void *)thunk64_vkCmdSetShadingRateImageEnableNV, - (void *)thunk64_vkCmdSetStencilCompareMask, - (void *)thunk64_vkCmdSetStencilOp, - (void *)thunk64_vkCmdSetStencilOpEXT, - (void *)thunk64_vkCmdSetStencilReference, - (void *)thunk64_vkCmdSetStencilTestEnable, - (void *)thunk64_vkCmdSetStencilTestEnableEXT, - (void *)thunk64_vkCmdSetStencilWriteMask, - (void *)thunk64_vkCmdSetTessellationDomainOriginEXT, - (void *)thunk64_vkCmdSetVertexInputEXT, - (void *)thunk64_vkCmdSetViewport, - (void *)thunk64_vkCmdSetViewportShadingRatePaletteNV, - (void *)thunk64_vkCmdSetViewportSwizzleNV, - (void *)thunk64_vkCmdSetViewportWScalingEnableNV, - (void *)thunk64_vkCmdSetViewportWScalingNV, - (void *)thunk64_vkCmdSetViewportWithCount, - (void *)thunk64_vkCmdSetViewportWithCountEXT, - (void *)thunk64_vkCmdSubpassShadingHUAWEI, - (void *)thunk64_vkCmdTraceRaysIndirect2KHR, - (void *)thunk64_vkCmdTraceRaysIndirectKHR, - (void *)thunk64_vkCmdTraceRaysKHR, - (void *)thunk64_vkCmdTraceRaysNV, - (void *)thunk64_vkCmdUpdateBuffer, - (void *)thunk64_vkCmdUpdatePipelineIndirectBufferNV, - (void *)thunk64_vkCmdWaitEvents, - (void *)thunk64_vkCmdWaitEvents2, - (void *)thunk64_vkCmdWaitEvents2KHR, - (void *)thunk64_vkCmdWriteAccelerationStructuresPropertiesKHR, - (void *)thunk64_vkCmdWriteAccelerationStructuresPropertiesNV, - (void *)thunk64_vkCmdWriteBufferMarker2AMD, - (void *)thunk64_vkCmdWriteBufferMarkerAMD, - (void *)thunk64_vkCmdWriteMicromapsPropertiesEXT, - (void *)thunk64_vkCmdWriteTimestamp, - (void *)thunk64_vkCmdWriteTimestamp2, - (void *)thunk64_vkCmdWriteTimestamp2KHR, - thunk64_vkCompileDeferredNV, - thunk64_vkCopyAccelerationStructureKHR, - thunk64_vkCopyAccelerationStructureToMemoryKHR, - thunk64_vkCopyImageToImageEXT, - thunk64_vkCopyImageToMemoryEXT, - thunk64_vkCopyMemoryToAccelerationStructureKHR, - thunk64_vkCopyMemoryToImageEXT, - thunk64_vkCopyMemoryToMicromapEXT, - thunk64_vkCopyMicromapEXT, - thunk64_vkCopyMicromapToMemoryEXT, - thunk64_vkCreateAccelerationStructureKHR, - thunk64_vkCreateAccelerationStructureNV, - thunk64_vkCreateBuffer, - thunk64_vkCreateBufferView, - thunk64_vkCreateCommandPool, - thunk64_vkCreateComputePipelines, - thunk64_vkCreateCuFunctionNVX, - thunk64_vkCreateCuModuleNVX, - thunk64_vkCreateCudaFunctionNV, - thunk64_vkCreateCudaModuleNV, - thunk64_vkCreateDebugReportCallbackEXT, - thunk64_vkCreateDebugUtilsMessengerEXT, - thunk64_vkCreateDeferredOperationKHR, - thunk64_vkCreateDescriptorPool, - thunk64_vkCreateDescriptorSetLayout, - thunk64_vkCreateDescriptorUpdateTemplate, - thunk64_vkCreateDescriptorUpdateTemplateKHR, - thunk64_vkCreateDevice, - thunk64_vkCreateEvent, - thunk64_vkCreateFence, - thunk64_vkCreateFramebuffer, - thunk64_vkCreateGraphicsPipelines, - thunk64_vkCreateImage, - thunk64_vkCreateImageView, - thunk64_vkCreateIndirectCommandsLayoutNV, - thunk64_vkCreateInstance, - thunk64_vkCreateMicromapEXT, - thunk64_vkCreateOpticalFlowSessionNV, - thunk64_vkCreatePipelineCache, - thunk64_vkCreatePipelineLayout, - thunk64_vkCreatePrivateDataSlot, - thunk64_vkCreatePrivateDataSlotEXT, - thunk64_vkCreateQueryPool, - thunk64_vkCreateRayTracingPipelinesKHR, - thunk64_vkCreateRayTracingPipelinesNV, - thunk64_vkCreateRenderPass, - thunk64_vkCreateRenderPass2, - thunk64_vkCreateRenderPass2KHR, - thunk64_vkCreateSampler, - thunk64_vkCreateSamplerYcbcrConversion, - thunk64_vkCreateSamplerYcbcrConversionKHR, - thunk64_vkCreateSemaphore, - thunk64_vkCreateShaderModule, - thunk64_vkCreateShadersEXT, - thunk64_vkCreateSwapchainKHR, - thunk64_vkCreateValidationCacheEXT, - thunk64_vkCreateWin32SurfaceKHR, - thunk64_vkDebugMarkerSetObjectNameEXT, - thunk64_vkDebugMarkerSetObjectTagEXT, - thunk64_vkDebugReportMessageEXT, - thunk64_vkDeferredOperationJoinKHR, - thunk64_vkDestroyAccelerationStructureKHR, - thunk64_vkDestroyAccelerationStructureNV, - thunk64_vkDestroyBuffer, - thunk64_vkDestroyBufferView, - thunk64_vkDestroyCommandPool, - thunk64_vkDestroyCuFunctionNVX, - thunk64_vkDestroyCuModuleNVX, - thunk64_vkDestroyCudaFunctionNV, - thunk64_vkDestroyCudaModuleNV, - thunk64_vkDestroyDebugReportCallbackEXT, - thunk64_vkDestroyDebugUtilsMessengerEXT, - thunk64_vkDestroyDeferredOperationKHR, - thunk64_vkDestroyDescriptorPool, - thunk64_vkDestroyDescriptorSetLayout, - thunk64_vkDestroyDescriptorUpdateTemplate, - thunk64_vkDestroyDescriptorUpdateTemplateKHR, - thunk64_vkDestroyDevice, - thunk64_vkDestroyEvent, - thunk64_vkDestroyFence, - thunk64_vkDestroyFramebuffer, - thunk64_vkDestroyImage, - thunk64_vkDestroyImageView, - thunk64_vkDestroyIndirectCommandsLayoutNV, - thunk64_vkDestroyInstance, - thunk64_vkDestroyMicromapEXT, - thunk64_vkDestroyOpticalFlowSessionNV, - thunk64_vkDestroyPipeline, - thunk64_vkDestroyPipelineCache, - thunk64_vkDestroyPipelineLayout, - thunk64_vkDestroyPrivateDataSlot, - thunk64_vkDestroyPrivateDataSlotEXT, - thunk64_vkDestroyQueryPool, - thunk64_vkDestroyRenderPass, - thunk64_vkDestroySampler, - thunk64_vkDestroySamplerYcbcrConversion, - thunk64_vkDestroySamplerYcbcrConversionKHR, - thunk64_vkDestroySemaphore, - thunk64_vkDestroyShaderEXT, - thunk64_vkDestroyShaderModule, - thunk64_vkDestroySurfaceKHR, - thunk64_vkDestroySwapchainKHR, - thunk64_vkDestroyValidationCacheEXT, - thunk64_vkDeviceWaitIdle, - thunk64_vkEndCommandBuffer, - thunk64_vkEnumerateDeviceExtensionProperties, - thunk64_vkEnumerateDeviceLayerProperties, - thunk64_vkEnumerateInstanceExtensionProperties, - thunk64_vkEnumerateInstanceVersion, - thunk64_vkEnumeratePhysicalDeviceGroups, - thunk64_vkEnumeratePhysicalDeviceGroupsKHR, - thunk64_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, - thunk64_vkEnumeratePhysicalDevices, - thunk64_vkFlushMappedMemoryRanges, - thunk64_vkFreeCommandBuffers, - thunk64_vkFreeDescriptorSets, - thunk64_vkFreeMemory, - thunk64_vkGetAccelerationStructureBuildSizesKHR, - thunk64_vkGetAccelerationStructureDeviceAddressKHR, - thunk64_vkGetAccelerationStructureHandleNV, - thunk64_vkGetAccelerationStructureMemoryRequirementsNV, - thunk64_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT, - thunk64_vkGetBufferDeviceAddress, - thunk64_vkGetBufferDeviceAddressEXT, - thunk64_vkGetBufferDeviceAddressKHR, - thunk64_vkGetBufferMemoryRequirements, - thunk64_vkGetBufferMemoryRequirements2, - thunk64_vkGetBufferMemoryRequirements2KHR, - thunk64_vkGetBufferOpaqueCaptureAddress, - thunk64_vkGetBufferOpaqueCaptureAddressKHR, - thunk64_vkGetBufferOpaqueCaptureDescriptorDataEXT, - thunk64_vkGetCalibratedTimestampsEXT, - thunk64_vkGetCudaModuleCacheNV, - thunk64_vkGetDeferredOperationMaxConcurrencyKHR, - thunk64_vkGetDeferredOperationResultKHR, - (void *)thunk64_vkGetDescriptorEXT, - thunk64_vkGetDescriptorSetHostMappingVALVE, - thunk64_vkGetDescriptorSetLayoutBindingOffsetEXT, - thunk64_vkGetDescriptorSetLayoutHostMappingInfoVALVE, - thunk64_vkGetDescriptorSetLayoutSizeEXT, - thunk64_vkGetDescriptorSetLayoutSupport, - thunk64_vkGetDescriptorSetLayoutSupportKHR, - thunk64_vkGetDeviceAccelerationStructureCompatibilityKHR, - thunk64_vkGetDeviceBufferMemoryRequirements, - thunk64_vkGetDeviceBufferMemoryRequirementsKHR, - thunk64_vkGetDeviceFaultInfoEXT, - thunk64_vkGetDeviceGroupPeerMemoryFeatures, - thunk64_vkGetDeviceGroupPeerMemoryFeaturesKHR, - thunk64_vkGetDeviceGroupPresentCapabilitiesKHR, - thunk64_vkGetDeviceGroupSurfacePresentModesKHR, - thunk64_vkGetDeviceImageMemoryRequirements, - thunk64_vkGetDeviceImageMemoryRequirementsKHR, - thunk64_vkGetDeviceImageSparseMemoryRequirements, - thunk64_vkGetDeviceImageSparseMemoryRequirementsKHR, - thunk64_vkGetDeviceImageSubresourceLayoutKHR, - thunk64_vkGetDeviceMemoryCommitment, - thunk64_vkGetDeviceMemoryOpaqueCaptureAddress, - thunk64_vkGetDeviceMemoryOpaqueCaptureAddressKHR, - thunk64_vkGetDeviceMicromapCompatibilityEXT, - thunk64_vkGetDeviceQueue, - thunk64_vkGetDeviceQueue2, - thunk64_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI, - thunk64_vkGetDynamicRenderingTilePropertiesQCOM, - thunk64_vkGetEventStatus, - thunk64_vkGetFenceStatus, - thunk64_vkGetFramebufferTilePropertiesQCOM, - thunk64_vkGetGeneratedCommandsMemoryRequirementsNV, - thunk64_vkGetImageMemoryRequirements, - thunk64_vkGetImageMemoryRequirements2, - thunk64_vkGetImageMemoryRequirements2KHR, - thunk64_vkGetImageOpaqueCaptureDescriptorDataEXT, - thunk64_vkGetImageSparseMemoryRequirements, - thunk64_vkGetImageSparseMemoryRequirements2, - thunk64_vkGetImageSparseMemoryRequirements2KHR, - thunk64_vkGetImageSubresourceLayout, - thunk64_vkGetImageSubresourceLayout2EXT, - thunk64_vkGetImageSubresourceLayout2KHR, - thunk64_vkGetImageViewAddressNVX, - thunk64_vkGetImageViewHandleNVX, - thunk64_vkGetImageViewOpaqueCaptureDescriptorDataEXT, - thunk64_vkGetLatencyTimingsNV, - thunk64_vkGetMemoryHostPointerPropertiesEXT, - thunk64_vkGetMicromapBuildSizesEXT, - thunk64_vkGetPerformanceParameterINTEL, - thunk64_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, - thunk64_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR, - thunk64_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV, - thunk64_vkGetPhysicalDeviceExternalBufferProperties, - thunk64_vkGetPhysicalDeviceExternalBufferPropertiesKHR, - thunk64_vkGetPhysicalDeviceExternalFenceProperties, - thunk64_vkGetPhysicalDeviceExternalFencePropertiesKHR, - thunk64_vkGetPhysicalDeviceExternalSemaphoreProperties, - thunk64_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, - thunk64_vkGetPhysicalDeviceFeatures, - thunk64_vkGetPhysicalDeviceFeatures2, - thunk64_vkGetPhysicalDeviceFeatures2KHR, - thunk64_vkGetPhysicalDeviceFormatProperties, - thunk64_vkGetPhysicalDeviceFormatProperties2, - thunk64_vkGetPhysicalDeviceFormatProperties2KHR, - thunk64_vkGetPhysicalDeviceFragmentShadingRatesKHR, - thunk64_vkGetPhysicalDeviceImageFormatProperties, - thunk64_vkGetPhysicalDeviceImageFormatProperties2, - thunk64_vkGetPhysicalDeviceImageFormatProperties2KHR, - thunk64_vkGetPhysicalDeviceMemoryProperties, - thunk64_vkGetPhysicalDeviceMemoryProperties2, - thunk64_vkGetPhysicalDeviceMemoryProperties2KHR, - thunk64_vkGetPhysicalDeviceMultisamplePropertiesEXT, - thunk64_vkGetPhysicalDeviceOpticalFlowImageFormatsNV, - thunk64_vkGetPhysicalDevicePresentRectanglesKHR, - thunk64_vkGetPhysicalDeviceProperties, - thunk64_vkGetPhysicalDeviceProperties2, - thunk64_vkGetPhysicalDeviceProperties2KHR, - thunk64_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, - thunk64_vkGetPhysicalDeviceQueueFamilyProperties, - thunk64_vkGetPhysicalDeviceQueueFamilyProperties2, - thunk64_vkGetPhysicalDeviceQueueFamilyProperties2KHR, - thunk64_vkGetPhysicalDeviceSparseImageFormatProperties, - thunk64_vkGetPhysicalDeviceSparseImageFormatProperties2, - thunk64_vkGetPhysicalDeviceSparseImageFormatProperties2KHR, - thunk64_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV, - thunk64_vkGetPhysicalDeviceSurfaceCapabilities2KHR, - thunk64_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, - thunk64_vkGetPhysicalDeviceSurfaceFormats2KHR, - thunk64_vkGetPhysicalDeviceSurfaceFormatsKHR, - thunk64_vkGetPhysicalDeviceSurfacePresentModesKHR, - thunk64_vkGetPhysicalDeviceSurfaceSupportKHR, - thunk64_vkGetPhysicalDeviceToolProperties, - thunk64_vkGetPhysicalDeviceToolPropertiesEXT, - thunk64_vkGetPhysicalDeviceWin32PresentationSupportKHR, - thunk64_vkGetPipelineCacheData, - thunk64_vkGetPipelineExecutableInternalRepresentationsKHR, - thunk64_vkGetPipelineExecutablePropertiesKHR, - thunk64_vkGetPipelineExecutableStatisticsKHR, - thunk64_vkGetPipelineIndirectDeviceAddressNV, - thunk64_vkGetPipelineIndirectMemoryRequirementsNV, - thunk64_vkGetPipelinePropertiesEXT, - thunk64_vkGetPrivateData, - thunk64_vkGetPrivateDataEXT, - thunk64_vkGetQueryPoolResults, - thunk64_vkGetQueueCheckpointData2NV, - thunk64_vkGetQueueCheckpointDataNV, - thunk64_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR, - thunk64_vkGetRayTracingShaderGroupHandlesKHR, - thunk64_vkGetRayTracingShaderGroupHandlesNV, - thunk64_vkGetRayTracingShaderGroupStackSizeKHR, - thunk64_vkGetRenderAreaGranularity, - thunk64_vkGetRenderingAreaGranularityKHR, - thunk64_vkGetSamplerOpaqueCaptureDescriptorDataEXT, - thunk64_vkGetSemaphoreCounterValue, - thunk64_vkGetSemaphoreCounterValueKHR, - thunk64_vkGetShaderBinaryDataEXT, - thunk64_vkGetShaderInfoAMD, - thunk64_vkGetShaderModuleCreateInfoIdentifierEXT, - thunk64_vkGetShaderModuleIdentifierEXT, - thunk64_vkGetSwapchainImagesKHR, - thunk64_vkGetValidationCacheDataEXT, - thunk64_vkInitializePerformanceApiINTEL, - thunk64_vkInvalidateMappedMemoryRanges, - thunk64_vkLatencySleepNV, - thunk64_vkMapMemory, - thunk64_vkMapMemory2KHR, - thunk64_vkMergePipelineCaches, - thunk64_vkMergeValidationCachesEXT, - thunk64_vkQueueBeginDebugUtilsLabelEXT, - thunk64_vkQueueBindSparse, - thunk64_vkQueueEndDebugUtilsLabelEXT, - thunk64_vkQueueInsertDebugUtilsLabelEXT, - thunk64_vkQueueNotifyOutOfBandNV, - thunk64_vkQueuePresentKHR, - thunk64_vkQueueSetPerformanceConfigurationINTEL, - thunk64_vkQueueSubmit, - thunk64_vkQueueSubmit2, - thunk64_vkQueueSubmit2KHR, - thunk64_vkQueueWaitIdle, - thunk64_vkReleasePerformanceConfigurationINTEL, - thunk64_vkReleaseProfilingLockKHR, - thunk64_vkReleaseSwapchainImagesEXT, - thunk64_vkResetCommandBuffer, - thunk64_vkResetCommandPool, - thunk64_vkResetDescriptorPool, - thunk64_vkResetEvent, - thunk64_vkResetFences, - thunk64_vkResetQueryPool, - thunk64_vkResetQueryPoolEXT, - thunk64_vkSetDebugUtilsObjectNameEXT, - thunk64_vkSetDebugUtilsObjectTagEXT, - thunk64_vkSetDeviceMemoryPriorityEXT, - thunk64_vkSetEvent, - thunk64_vkSetHdrMetadataEXT, - thunk64_vkSetLatencyMarkerNV, - thunk64_vkSetLatencySleepModeNV, - thunk64_vkSetPrivateData, - thunk64_vkSetPrivateDataEXT, - thunk64_vkSignalSemaphore, - thunk64_vkSignalSemaphoreKHR, - thunk64_vkSubmitDebugUtilsMessageEXT, - thunk64_vkTransitionImageLayoutEXT, - thunk64_vkTrimCommandPool, - thunk64_vkTrimCommandPoolKHR, - thunk64_vkUninitializePerformanceApiINTEL, - thunk64_vkUnmapMemory, - thunk64_vkUnmapMemory2KHR, - (void *)thunk64_vkUpdateDescriptorSetWithTemplate, - thunk64_vkUpdateDescriptorSetWithTemplateKHR, - (void *)thunk64_vkUpdateDescriptorSets, - thunk64_vkWaitForFences, - thunk64_vkWaitForPresentKHR, - thunk64_vkWaitSemaphores, - thunk64_vkWaitSemaphoresKHR, - thunk64_vkWriteAccelerationStructuresPropertiesKHR, - thunk64_vkWriteMicromapsPropertiesEXT, -}; -C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count); - -#endif /* _WIN64 */ - -#ifdef _WIN64 -const unixlib_entry_t __wine_unix_call_wow64_funcs[] = -#else -const unixlib_entry_t __wine_unix_call_funcs[] = -#endif -{ - init_vulkan, - vk_is_available_instance_function32, - vk_is_available_device_function32, - thunk32_vkAcquireNextImage2KHR, - thunk32_vkAcquireNextImageKHR, - thunk32_vkAcquirePerformanceConfigurationINTEL, - thunk32_vkAcquireProfilingLockKHR, - thunk32_vkAllocateCommandBuffers, - thunk32_vkAllocateDescriptorSets, - thunk32_vkAllocateMemory, - thunk32_vkBeginCommandBuffer, - thunk32_vkBindAccelerationStructureMemoryNV, - thunk32_vkBindBufferMemory, - thunk32_vkBindBufferMemory2, - thunk32_vkBindBufferMemory2KHR, - thunk32_vkBindImageMemory, - thunk32_vkBindImageMemory2, - thunk32_vkBindImageMemory2KHR, - thunk32_vkBindOpticalFlowSessionImageNV, - thunk32_vkBuildAccelerationStructuresKHR, - thunk32_vkBuildMicromapsEXT, - (void *)thunk32_vkCmdBeginConditionalRenderingEXT, - (void *)thunk32_vkCmdBeginDebugUtilsLabelEXT, - (void *)thunk32_vkCmdBeginQuery, - (void *)thunk32_vkCmdBeginQueryIndexedEXT, - (void *)thunk32_vkCmdBeginRenderPass, - (void *)thunk32_vkCmdBeginRenderPass2, - (void *)thunk32_vkCmdBeginRenderPass2KHR, - (void *)thunk32_vkCmdBeginRendering, - (void *)thunk32_vkCmdBeginRenderingKHR, - (void *)thunk32_vkCmdBeginTransformFeedbackEXT, - (void *)thunk32_vkCmdBindDescriptorBufferEmbeddedSamplersEXT, - (void *)thunk32_vkCmdBindDescriptorBuffersEXT, - (void *)thunk32_vkCmdBindDescriptorSets, - (void *)thunk32_vkCmdBindIndexBuffer, - (void *)thunk32_vkCmdBindIndexBuffer2KHR, - (void *)thunk32_vkCmdBindInvocationMaskHUAWEI, - (void *)thunk32_vkCmdBindPipeline, - (void *)thunk32_vkCmdBindPipelineShaderGroupNV, - (void *)thunk32_vkCmdBindShadersEXT, - (void *)thunk32_vkCmdBindShadingRateImageNV, - (void *)thunk32_vkCmdBindTransformFeedbackBuffersEXT, - (void *)thunk32_vkCmdBindVertexBuffers, - (void *)thunk32_vkCmdBindVertexBuffers2, - (void *)thunk32_vkCmdBindVertexBuffers2EXT, - (void *)thunk32_vkCmdBlitImage, - (void *)thunk32_vkCmdBlitImage2, - (void *)thunk32_vkCmdBlitImage2KHR, - (void *)thunk32_vkCmdBuildAccelerationStructureNV, - (void *)thunk32_vkCmdBuildAccelerationStructuresIndirectKHR, - (void *)thunk32_vkCmdBuildAccelerationStructuresKHR, - (void *)thunk32_vkCmdBuildMicromapsEXT, - (void *)thunk32_vkCmdClearAttachments, - (void *)thunk32_vkCmdClearColorImage, - (void *)thunk32_vkCmdClearDepthStencilImage, - (void *)thunk32_vkCmdCopyAccelerationStructureKHR, - (void *)thunk32_vkCmdCopyAccelerationStructureNV, - (void *)thunk32_vkCmdCopyAccelerationStructureToMemoryKHR, - (void *)thunk32_vkCmdCopyBuffer, - (void *)thunk32_vkCmdCopyBuffer2, - (void *)thunk32_vkCmdCopyBuffer2KHR, - (void *)thunk32_vkCmdCopyBufferToImage, - (void *)thunk32_vkCmdCopyBufferToImage2, - (void *)thunk32_vkCmdCopyBufferToImage2KHR, - (void *)thunk32_vkCmdCopyImage, - (void *)thunk32_vkCmdCopyImage2, - (void *)thunk32_vkCmdCopyImage2KHR, - (void *)thunk32_vkCmdCopyImageToBuffer, - (void *)thunk32_vkCmdCopyImageToBuffer2, - (void *)thunk32_vkCmdCopyImageToBuffer2KHR, - (void *)thunk32_vkCmdCopyMemoryIndirectNV, - (void *)thunk32_vkCmdCopyMemoryToAccelerationStructureKHR, - (void *)thunk32_vkCmdCopyMemoryToImageIndirectNV, - (void *)thunk32_vkCmdCopyMemoryToMicromapEXT, - (void *)thunk32_vkCmdCopyMicromapEXT, - (void *)thunk32_vkCmdCopyMicromapToMemoryEXT, - (void *)thunk32_vkCmdCopyQueryPoolResults, - (void *)thunk32_vkCmdCuLaunchKernelNVX, - (void *)thunk32_vkCmdCudaLaunchKernelNV, - (void *)thunk32_vkCmdDebugMarkerBeginEXT, - (void *)thunk32_vkCmdDebugMarkerEndEXT, - (void *)thunk32_vkCmdDebugMarkerInsertEXT, - (void *)thunk32_vkCmdDecompressMemoryIndirectCountNV, - (void *)thunk32_vkCmdDecompressMemoryNV, - (void *)thunk32_vkCmdDispatch, - (void *)thunk32_vkCmdDispatchBase, - (void *)thunk32_vkCmdDispatchBaseKHR, - (void *)thunk32_vkCmdDispatchIndirect, - (void *)thunk32_vkCmdDraw, - (void *)thunk32_vkCmdDrawClusterHUAWEI, - (void *)thunk32_vkCmdDrawClusterIndirectHUAWEI, - (void *)thunk32_vkCmdDrawIndexed, - (void *)thunk32_vkCmdDrawIndexedIndirect, - (void *)thunk32_vkCmdDrawIndexedIndirectCount, - (void *)thunk32_vkCmdDrawIndexedIndirectCountAMD, - (void *)thunk32_vkCmdDrawIndexedIndirectCountKHR, - (void *)thunk32_vkCmdDrawIndirect, - (void *)thunk32_vkCmdDrawIndirectByteCountEXT, - (void *)thunk32_vkCmdDrawIndirectCount, - (void *)thunk32_vkCmdDrawIndirectCountAMD, - (void *)thunk32_vkCmdDrawIndirectCountKHR, - (void *)thunk32_vkCmdDrawMeshTasksEXT, - (void *)thunk32_vkCmdDrawMeshTasksIndirectCountEXT, - (void *)thunk32_vkCmdDrawMeshTasksIndirectCountNV, - (void *)thunk32_vkCmdDrawMeshTasksIndirectEXT, - (void *)thunk32_vkCmdDrawMeshTasksIndirectNV, - (void *)thunk32_vkCmdDrawMeshTasksNV, - (void *)thunk32_vkCmdDrawMultiEXT, - (void *)thunk32_vkCmdDrawMultiIndexedEXT, - (void *)thunk32_vkCmdEndConditionalRenderingEXT, - (void *)thunk32_vkCmdEndDebugUtilsLabelEXT, - (void *)thunk32_vkCmdEndQuery, - (void *)thunk32_vkCmdEndQueryIndexedEXT, - (void *)thunk32_vkCmdEndRenderPass, - (void *)thunk32_vkCmdEndRenderPass2, - (void *)thunk32_vkCmdEndRenderPass2KHR, - (void *)thunk32_vkCmdEndRendering, - (void *)thunk32_vkCmdEndRenderingKHR, - (void *)thunk32_vkCmdEndTransformFeedbackEXT, - (void *)thunk32_vkCmdExecuteCommands, - (void *)thunk32_vkCmdExecuteGeneratedCommandsNV, - (void *)thunk32_vkCmdFillBuffer, - (void *)thunk32_vkCmdInsertDebugUtilsLabelEXT, - (void *)thunk32_vkCmdNextSubpass, - (void *)thunk32_vkCmdNextSubpass2, - (void *)thunk32_vkCmdNextSubpass2KHR, - (void *)thunk32_vkCmdOpticalFlowExecuteNV, - (void *)thunk32_vkCmdPipelineBarrier, - (void *)thunk32_vkCmdPipelineBarrier2, - (void *)thunk32_vkCmdPipelineBarrier2KHR, - (void *)thunk32_vkCmdPreprocessGeneratedCommandsNV, - (void *)thunk32_vkCmdPushConstants, - (void *)thunk32_vkCmdPushDescriptorSetKHR, - (void *)thunk32_vkCmdPushDescriptorSetWithTemplateKHR, - (void *)thunk32_vkCmdResetEvent, - (void *)thunk32_vkCmdResetEvent2, - (void *)thunk32_vkCmdResetEvent2KHR, - (void *)thunk32_vkCmdResetQueryPool, - (void *)thunk32_vkCmdResolveImage, - (void *)thunk32_vkCmdResolveImage2, - (void *)thunk32_vkCmdResolveImage2KHR, - (void *)thunk32_vkCmdSetAlphaToCoverageEnableEXT, - (void *)thunk32_vkCmdSetAlphaToOneEnableEXT, - (void *)thunk32_vkCmdSetAttachmentFeedbackLoopEnableEXT, - (void *)thunk32_vkCmdSetBlendConstants, - (void *)thunk32_vkCmdSetCheckpointNV, - (void *)thunk32_vkCmdSetCoarseSampleOrderNV, - (void *)thunk32_vkCmdSetColorBlendAdvancedEXT, - (void *)thunk32_vkCmdSetColorBlendEnableEXT, - (void *)thunk32_vkCmdSetColorBlendEquationEXT, - (void *)thunk32_vkCmdSetColorWriteEnableEXT, - (void *)thunk32_vkCmdSetColorWriteMaskEXT, - (void *)thunk32_vkCmdSetConservativeRasterizationModeEXT, - (void *)thunk32_vkCmdSetCoverageModulationModeNV, - (void *)thunk32_vkCmdSetCoverageModulationTableEnableNV, - (void *)thunk32_vkCmdSetCoverageModulationTableNV, - (void *)thunk32_vkCmdSetCoverageReductionModeNV, - (void *)thunk32_vkCmdSetCoverageToColorEnableNV, - (void *)thunk32_vkCmdSetCoverageToColorLocationNV, - (void *)thunk32_vkCmdSetCullMode, - (void *)thunk32_vkCmdSetCullModeEXT, - (void *)thunk32_vkCmdSetDepthBias, - (void *)thunk32_vkCmdSetDepthBias2EXT, - (void *)thunk32_vkCmdSetDepthBiasEnable, - (void *)thunk32_vkCmdSetDepthBiasEnableEXT, - (void *)thunk32_vkCmdSetDepthBounds, - (void *)thunk32_vkCmdSetDepthBoundsTestEnable, - (void *)thunk32_vkCmdSetDepthBoundsTestEnableEXT, - (void *)thunk32_vkCmdSetDepthClampEnableEXT, - (void *)thunk32_vkCmdSetDepthClipEnableEXT, - (void *)thunk32_vkCmdSetDepthClipNegativeOneToOneEXT, - (void *)thunk32_vkCmdSetDepthCompareOp, - (void *)thunk32_vkCmdSetDepthCompareOpEXT, - (void *)thunk32_vkCmdSetDepthTestEnable, - (void *)thunk32_vkCmdSetDepthTestEnableEXT, - (void *)thunk32_vkCmdSetDepthWriteEnable, - (void *)thunk32_vkCmdSetDepthWriteEnableEXT, - (void *)thunk32_vkCmdSetDescriptorBufferOffsetsEXT, - (void *)thunk32_vkCmdSetDeviceMask, - (void *)thunk32_vkCmdSetDeviceMaskKHR, - (void *)thunk32_vkCmdSetDiscardRectangleEXT, - (void *)thunk32_vkCmdSetDiscardRectangleEnableEXT, - (void *)thunk32_vkCmdSetDiscardRectangleModeEXT, - (void *)thunk32_vkCmdSetEvent, - (void *)thunk32_vkCmdSetEvent2, - (void *)thunk32_vkCmdSetEvent2KHR, - (void *)thunk32_vkCmdSetExclusiveScissorEnableNV, - (void *)thunk32_vkCmdSetExclusiveScissorNV, - (void *)thunk32_vkCmdSetExtraPrimitiveOverestimationSizeEXT, - (void *)thunk32_vkCmdSetFragmentShadingRateEnumNV, - (void *)thunk32_vkCmdSetFragmentShadingRateKHR, - (void *)thunk32_vkCmdSetFrontFace, - (void *)thunk32_vkCmdSetFrontFaceEXT, - (void *)thunk32_vkCmdSetLineRasterizationModeEXT, - (void *)thunk32_vkCmdSetLineStippleEXT, - (void *)thunk32_vkCmdSetLineStippleEnableEXT, - (void *)thunk32_vkCmdSetLineWidth, - (void *)thunk32_vkCmdSetLogicOpEXT, - (void *)thunk32_vkCmdSetLogicOpEnableEXT, - (void *)thunk32_vkCmdSetPatchControlPointsEXT, - thunk32_vkCmdSetPerformanceMarkerINTEL, - thunk32_vkCmdSetPerformanceOverrideINTEL, - thunk32_vkCmdSetPerformanceStreamMarkerINTEL, - (void *)thunk32_vkCmdSetPolygonModeEXT, - (void *)thunk32_vkCmdSetPrimitiveRestartEnable, - (void *)thunk32_vkCmdSetPrimitiveRestartEnableEXT, - (void *)thunk32_vkCmdSetPrimitiveTopology, - (void *)thunk32_vkCmdSetPrimitiveTopologyEXT, - (void *)thunk32_vkCmdSetProvokingVertexModeEXT, - (void *)thunk32_vkCmdSetRasterizationSamplesEXT, - (void *)thunk32_vkCmdSetRasterizationStreamEXT, - (void *)thunk32_vkCmdSetRasterizerDiscardEnable, - (void *)thunk32_vkCmdSetRasterizerDiscardEnableEXT, - (void *)thunk32_vkCmdSetRayTracingPipelineStackSizeKHR, - (void *)thunk32_vkCmdSetRepresentativeFragmentTestEnableNV, - (void *)thunk32_vkCmdSetSampleLocationsEXT, - (void *)thunk32_vkCmdSetSampleLocationsEnableEXT, - (void *)thunk32_vkCmdSetSampleMaskEXT, - (void *)thunk32_vkCmdSetScissor, - (void *)thunk32_vkCmdSetScissorWithCount, - (void *)thunk32_vkCmdSetScissorWithCountEXT, - (void *)thunk32_vkCmdSetShadingRateImageEnableNV, - (void *)thunk32_vkCmdSetStencilCompareMask, - (void *)thunk32_vkCmdSetStencilOp, - (void *)thunk32_vkCmdSetStencilOpEXT, - (void *)thunk32_vkCmdSetStencilReference, - (void *)thunk32_vkCmdSetStencilTestEnable, - (void *)thunk32_vkCmdSetStencilTestEnableEXT, - (void *)thunk32_vkCmdSetStencilWriteMask, - (void *)thunk32_vkCmdSetTessellationDomainOriginEXT, - (void *)thunk32_vkCmdSetVertexInputEXT, - (void *)thunk32_vkCmdSetViewport, - (void *)thunk32_vkCmdSetViewportShadingRatePaletteNV, - (void *)thunk32_vkCmdSetViewportSwizzleNV, - (void *)thunk32_vkCmdSetViewportWScalingEnableNV, - (void *)thunk32_vkCmdSetViewportWScalingNV, - (void *)thunk32_vkCmdSetViewportWithCount, - (void *)thunk32_vkCmdSetViewportWithCountEXT, - (void *)thunk32_vkCmdSubpassShadingHUAWEI, - (void *)thunk32_vkCmdTraceRaysIndirect2KHR, - (void *)thunk32_vkCmdTraceRaysIndirectKHR, - (void *)thunk32_vkCmdTraceRaysKHR, - (void *)thunk32_vkCmdTraceRaysNV, - (void *)thunk32_vkCmdUpdateBuffer, - (void *)thunk32_vkCmdUpdatePipelineIndirectBufferNV, - (void *)thunk32_vkCmdWaitEvents, - (void *)thunk32_vkCmdWaitEvents2, - (void *)thunk32_vkCmdWaitEvents2KHR, - (void *)thunk32_vkCmdWriteAccelerationStructuresPropertiesKHR, - (void *)thunk32_vkCmdWriteAccelerationStructuresPropertiesNV, - (void *)thunk32_vkCmdWriteBufferMarker2AMD, - (void *)thunk32_vkCmdWriteBufferMarkerAMD, - (void *)thunk32_vkCmdWriteMicromapsPropertiesEXT, - (void *)thunk32_vkCmdWriteTimestamp, - (void *)thunk32_vkCmdWriteTimestamp2, - (void *)thunk32_vkCmdWriteTimestamp2KHR, - thunk32_vkCompileDeferredNV, - thunk32_vkCopyAccelerationStructureKHR, - thunk32_vkCopyAccelerationStructureToMemoryKHR, - thunk32_vkCopyImageToImageEXT, - thunk32_vkCopyImageToMemoryEXT, - thunk32_vkCopyMemoryToAccelerationStructureKHR, - thunk32_vkCopyMemoryToImageEXT, - thunk32_vkCopyMemoryToMicromapEXT, - thunk32_vkCopyMicromapEXT, - thunk32_vkCopyMicromapToMemoryEXT, - thunk32_vkCreateAccelerationStructureKHR, - thunk32_vkCreateAccelerationStructureNV, - thunk32_vkCreateBuffer, - thunk32_vkCreateBufferView, - thunk32_vkCreateCommandPool, - thunk32_vkCreateComputePipelines, - thunk32_vkCreateCuFunctionNVX, - thunk32_vkCreateCuModuleNVX, - thunk32_vkCreateCudaFunctionNV, - thunk32_vkCreateCudaModuleNV, - thunk32_vkCreateDebugReportCallbackEXT, - thunk32_vkCreateDebugUtilsMessengerEXT, - thunk32_vkCreateDeferredOperationKHR, - thunk32_vkCreateDescriptorPool, - thunk32_vkCreateDescriptorSetLayout, - thunk32_vkCreateDescriptorUpdateTemplate, - thunk32_vkCreateDescriptorUpdateTemplateKHR, - thunk32_vkCreateDevice, - thunk32_vkCreateEvent, - thunk32_vkCreateFence, - thunk32_vkCreateFramebuffer, - thunk32_vkCreateGraphicsPipelines, - thunk32_vkCreateImage, - thunk32_vkCreateImageView, - thunk32_vkCreateIndirectCommandsLayoutNV, - thunk32_vkCreateInstance, - thunk32_vkCreateMicromapEXT, - thunk32_vkCreateOpticalFlowSessionNV, - thunk32_vkCreatePipelineCache, - thunk32_vkCreatePipelineLayout, - thunk32_vkCreatePrivateDataSlot, - thunk32_vkCreatePrivateDataSlotEXT, - thunk32_vkCreateQueryPool, - thunk32_vkCreateRayTracingPipelinesKHR, - thunk32_vkCreateRayTracingPipelinesNV, - thunk32_vkCreateRenderPass, - thunk32_vkCreateRenderPass2, - thunk32_vkCreateRenderPass2KHR, - thunk32_vkCreateSampler, - thunk32_vkCreateSamplerYcbcrConversion, - thunk32_vkCreateSamplerYcbcrConversionKHR, - thunk32_vkCreateSemaphore, - thunk32_vkCreateShaderModule, - thunk32_vkCreateShadersEXT, - thunk32_vkCreateSwapchainKHR, - thunk32_vkCreateValidationCacheEXT, - thunk32_vkCreateWin32SurfaceKHR, - thunk32_vkDebugMarkerSetObjectNameEXT, - thunk32_vkDebugMarkerSetObjectTagEXT, - thunk32_vkDebugReportMessageEXT, - thunk32_vkDeferredOperationJoinKHR, - thunk32_vkDestroyAccelerationStructureKHR, - thunk32_vkDestroyAccelerationStructureNV, - thunk32_vkDestroyBuffer, - thunk32_vkDestroyBufferView, - thunk32_vkDestroyCommandPool, - thunk32_vkDestroyCuFunctionNVX, - thunk32_vkDestroyCuModuleNVX, - thunk32_vkDestroyCudaFunctionNV, - thunk32_vkDestroyCudaModuleNV, - thunk32_vkDestroyDebugReportCallbackEXT, - thunk32_vkDestroyDebugUtilsMessengerEXT, - thunk32_vkDestroyDeferredOperationKHR, - thunk32_vkDestroyDescriptorPool, - thunk32_vkDestroyDescriptorSetLayout, - thunk32_vkDestroyDescriptorUpdateTemplate, - thunk32_vkDestroyDescriptorUpdateTemplateKHR, - thunk32_vkDestroyDevice, - thunk32_vkDestroyEvent, - thunk32_vkDestroyFence, - thunk32_vkDestroyFramebuffer, - thunk32_vkDestroyImage, - thunk32_vkDestroyImageView, - thunk32_vkDestroyIndirectCommandsLayoutNV, - thunk32_vkDestroyInstance, - thunk32_vkDestroyMicromapEXT, - thunk32_vkDestroyOpticalFlowSessionNV, - thunk32_vkDestroyPipeline, - thunk32_vkDestroyPipelineCache, - thunk32_vkDestroyPipelineLayout, - thunk32_vkDestroyPrivateDataSlot, - thunk32_vkDestroyPrivateDataSlotEXT, - thunk32_vkDestroyQueryPool, - thunk32_vkDestroyRenderPass, - thunk32_vkDestroySampler, - thunk32_vkDestroySamplerYcbcrConversion, - thunk32_vkDestroySamplerYcbcrConversionKHR, - thunk32_vkDestroySemaphore, - thunk32_vkDestroyShaderEXT, - thunk32_vkDestroyShaderModule, - thunk32_vkDestroySurfaceKHR, - thunk32_vkDestroySwapchainKHR, - thunk32_vkDestroyValidationCacheEXT, - thunk32_vkDeviceWaitIdle, - thunk32_vkEndCommandBuffer, - thunk32_vkEnumerateDeviceExtensionProperties, - thunk32_vkEnumerateDeviceLayerProperties, - thunk32_vkEnumerateInstanceExtensionProperties, - thunk32_vkEnumerateInstanceVersion, - thunk32_vkEnumeratePhysicalDeviceGroups, - thunk32_vkEnumeratePhysicalDeviceGroupsKHR, - thunk32_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR, - thunk32_vkEnumeratePhysicalDevices, - thunk32_vkFlushMappedMemoryRanges, - thunk32_vkFreeCommandBuffers, - thunk32_vkFreeDescriptorSets, - thunk32_vkFreeMemory, - thunk32_vkGetAccelerationStructureBuildSizesKHR, - thunk32_vkGetAccelerationStructureDeviceAddressKHR, - thunk32_vkGetAccelerationStructureHandleNV, - thunk32_vkGetAccelerationStructureMemoryRequirementsNV, - thunk32_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT, - thunk32_vkGetBufferDeviceAddress, - thunk32_vkGetBufferDeviceAddressEXT, - thunk32_vkGetBufferDeviceAddressKHR, - thunk32_vkGetBufferMemoryRequirements, - thunk32_vkGetBufferMemoryRequirements2, - thunk32_vkGetBufferMemoryRequirements2KHR, - thunk32_vkGetBufferOpaqueCaptureAddress, - thunk32_vkGetBufferOpaqueCaptureAddressKHR, - thunk32_vkGetBufferOpaqueCaptureDescriptorDataEXT, - thunk32_vkGetCalibratedTimestampsEXT, - thunk32_vkGetCudaModuleCacheNV, - thunk32_vkGetDeferredOperationMaxConcurrencyKHR, - thunk32_vkGetDeferredOperationResultKHR, - (void *)thunk32_vkGetDescriptorEXT, - thunk32_vkGetDescriptorSetHostMappingVALVE, - thunk32_vkGetDescriptorSetLayoutBindingOffsetEXT, - thunk32_vkGetDescriptorSetLayoutHostMappingInfoVALVE, - thunk32_vkGetDescriptorSetLayoutSizeEXT, - thunk32_vkGetDescriptorSetLayoutSupport, - thunk32_vkGetDescriptorSetLayoutSupportKHR, - thunk32_vkGetDeviceAccelerationStructureCompatibilityKHR, - thunk32_vkGetDeviceBufferMemoryRequirements, - thunk32_vkGetDeviceBufferMemoryRequirementsKHR, - thunk32_vkGetDeviceFaultInfoEXT, - thunk32_vkGetDeviceGroupPeerMemoryFeatures, - thunk32_vkGetDeviceGroupPeerMemoryFeaturesKHR, - thunk32_vkGetDeviceGroupPresentCapabilitiesKHR, - thunk32_vkGetDeviceGroupSurfacePresentModesKHR, - thunk32_vkGetDeviceImageMemoryRequirements, - thunk32_vkGetDeviceImageMemoryRequirementsKHR, - thunk32_vkGetDeviceImageSparseMemoryRequirements, - thunk32_vkGetDeviceImageSparseMemoryRequirementsKHR, - thunk32_vkGetDeviceImageSubresourceLayoutKHR, - thunk32_vkGetDeviceMemoryCommitment, - thunk32_vkGetDeviceMemoryOpaqueCaptureAddress, - thunk32_vkGetDeviceMemoryOpaqueCaptureAddressKHR, - thunk32_vkGetDeviceMicromapCompatibilityEXT, - thunk32_vkGetDeviceQueue, - thunk32_vkGetDeviceQueue2, - thunk32_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI, - thunk32_vkGetDynamicRenderingTilePropertiesQCOM, - thunk32_vkGetEventStatus, - thunk32_vkGetFenceStatus, - thunk32_vkGetFramebufferTilePropertiesQCOM, - thunk32_vkGetGeneratedCommandsMemoryRequirementsNV, - thunk32_vkGetImageMemoryRequirements, - thunk32_vkGetImageMemoryRequirements2, - thunk32_vkGetImageMemoryRequirements2KHR, - thunk32_vkGetImageOpaqueCaptureDescriptorDataEXT, - thunk32_vkGetImageSparseMemoryRequirements, - thunk32_vkGetImageSparseMemoryRequirements2, - thunk32_vkGetImageSparseMemoryRequirements2KHR, - thunk32_vkGetImageSubresourceLayout, - thunk32_vkGetImageSubresourceLayout2EXT, - thunk32_vkGetImageSubresourceLayout2KHR, - thunk32_vkGetImageViewAddressNVX, - thunk32_vkGetImageViewHandleNVX, - thunk32_vkGetImageViewOpaqueCaptureDescriptorDataEXT, - thunk32_vkGetLatencyTimingsNV, - thunk32_vkGetMemoryHostPointerPropertiesEXT, - thunk32_vkGetMicromapBuildSizesEXT, - thunk32_vkGetPerformanceParameterINTEL, - thunk32_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT, - thunk32_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR, - thunk32_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV, - thunk32_vkGetPhysicalDeviceExternalBufferProperties, - thunk32_vkGetPhysicalDeviceExternalBufferPropertiesKHR, - thunk32_vkGetPhysicalDeviceExternalFenceProperties, - thunk32_vkGetPhysicalDeviceExternalFencePropertiesKHR, - thunk32_vkGetPhysicalDeviceExternalSemaphoreProperties, - thunk32_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, - thunk32_vkGetPhysicalDeviceFeatures, - thunk32_vkGetPhysicalDeviceFeatures2, - thunk32_vkGetPhysicalDeviceFeatures2KHR, - thunk32_vkGetPhysicalDeviceFormatProperties, - thunk32_vkGetPhysicalDeviceFormatProperties2, - thunk32_vkGetPhysicalDeviceFormatProperties2KHR, - thunk32_vkGetPhysicalDeviceFragmentShadingRatesKHR, - thunk32_vkGetPhysicalDeviceImageFormatProperties, - thunk32_vkGetPhysicalDeviceImageFormatProperties2, - thunk32_vkGetPhysicalDeviceImageFormatProperties2KHR, - thunk32_vkGetPhysicalDeviceMemoryProperties, - thunk32_vkGetPhysicalDeviceMemoryProperties2, - thunk32_vkGetPhysicalDeviceMemoryProperties2KHR, - thunk32_vkGetPhysicalDeviceMultisamplePropertiesEXT, - thunk32_vkGetPhysicalDeviceOpticalFlowImageFormatsNV, - thunk32_vkGetPhysicalDevicePresentRectanglesKHR, - thunk32_vkGetPhysicalDeviceProperties, - thunk32_vkGetPhysicalDeviceProperties2, - thunk32_vkGetPhysicalDeviceProperties2KHR, - thunk32_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR, - thunk32_vkGetPhysicalDeviceQueueFamilyProperties, - thunk32_vkGetPhysicalDeviceQueueFamilyProperties2, - thunk32_vkGetPhysicalDeviceQueueFamilyProperties2KHR, - thunk32_vkGetPhysicalDeviceSparseImageFormatProperties, - thunk32_vkGetPhysicalDeviceSparseImageFormatProperties2, - thunk32_vkGetPhysicalDeviceSparseImageFormatProperties2KHR, - thunk32_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV, - thunk32_vkGetPhysicalDeviceSurfaceCapabilities2KHR, - thunk32_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, - thunk32_vkGetPhysicalDeviceSurfaceFormats2KHR, - thunk32_vkGetPhysicalDeviceSurfaceFormatsKHR, - thunk32_vkGetPhysicalDeviceSurfacePresentModesKHR, - thunk32_vkGetPhysicalDeviceSurfaceSupportKHR, - thunk32_vkGetPhysicalDeviceToolProperties, - thunk32_vkGetPhysicalDeviceToolPropertiesEXT, - thunk32_vkGetPhysicalDeviceWin32PresentationSupportKHR, - thunk32_vkGetPipelineCacheData, - thunk32_vkGetPipelineExecutableInternalRepresentationsKHR, - thunk32_vkGetPipelineExecutablePropertiesKHR, - thunk32_vkGetPipelineExecutableStatisticsKHR, - thunk32_vkGetPipelineIndirectDeviceAddressNV, - thunk32_vkGetPipelineIndirectMemoryRequirementsNV, - thunk32_vkGetPipelinePropertiesEXT, - thunk32_vkGetPrivateData, - thunk32_vkGetPrivateDataEXT, - thunk32_vkGetQueryPoolResults, - thunk32_vkGetQueueCheckpointData2NV, - thunk32_vkGetQueueCheckpointDataNV, - thunk32_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR, - thunk32_vkGetRayTracingShaderGroupHandlesKHR, - thunk32_vkGetRayTracingShaderGroupHandlesNV, - thunk32_vkGetRayTracingShaderGroupStackSizeKHR, - thunk32_vkGetRenderAreaGranularity, - thunk32_vkGetRenderingAreaGranularityKHR, - thunk32_vkGetSamplerOpaqueCaptureDescriptorDataEXT, - thunk32_vkGetSemaphoreCounterValue, - thunk32_vkGetSemaphoreCounterValueKHR, - thunk32_vkGetShaderBinaryDataEXT, - thunk32_vkGetShaderInfoAMD, - thunk32_vkGetShaderModuleCreateInfoIdentifierEXT, - thunk32_vkGetShaderModuleIdentifierEXT, - thunk32_vkGetSwapchainImagesKHR, - thunk32_vkGetValidationCacheDataEXT, - thunk32_vkInitializePerformanceApiINTEL, - thunk32_vkInvalidateMappedMemoryRanges, - thunk32_vkLatencySleepNV, - thunk32_vkMapMemory, - thunk32_vkMapMemory2KHR, - thunk32_vkMergePipelineCaches, - thunk32_vkMergeValidationCachesEXT, - thunk32_vkQueueBeginDebugUtilsLabelEXT, - thunk32_vkQueueBindSparse, - thunk32_vkQueueEndDebugUtilsLabelEXT, - thunk32_vkQueueInsertDebugUtilsLabelEXT, - thunk32_vkQueueNotifyOutOfBandNV, - thunk32_vkQueuePresentKHR, - thunk32_vkQueueSetPerformanceConfigurationINTEL, - thunk32_vkQueueSubmit, - thunk32_vkQueueSubmit2, - thunk32_vkQueueSubmit2KHR, - thunk32_vkQueueWaitIdle, - thunk32_vkReleasePerformanceConfigurationINTEL, - thunk32_vkReleaseProfilingLockKHR, - thunk32_vkReleaseSwapchainImagesEXT, - thunk32_vkResetCommandBuffer, - thunk32_vkResetCommandPool, - thunk32_vkResetDescriptorPool, - thunk32_vkResetEvent, - thunk32_vkResetFences, - thunk32_vkResetQueryPool, - thunk32_vkResetQueryPoolEXT, - thunk32_vkSetDebugUtilsObjectNameEXT, - thunk32_vkSetDebugUtilsObjectTagEXT, - thunk32_vkSetDeviceMemoryPriorityEXT, - thunk32_vkSetEvent, - thunk32_vkSetHdrMetadataEXT, - thunk32_vkSetLatencyMarkerNV, - thunk32_vkSetLatencySleepModeNV, - thunk32_vkSetPrivateData, - thunk32_vkSetPrivateDataEXT, - thunk32_vkSignalSemaphore, - thunk32_vkSignalSemaphoreKHR, - thunk32_vkSubmitDebugUtilsMessageEXT, - thunk32_vkTransitionImageLayoutEXT, - thunk32_vkTrimCommandPool, - thunk32_vkTrimCommandPoolKHR, - thunk32_vkUninitializePerformanceApiINTEL, - thunk32_vkUnmapMemory, - thunk32_vkUnmapMemory2KHR, - (void *)thunk32_vkUpdateDescriptorSetWithTemplate, - thunk32_vkUpdateDescriptorSetWithTemplateKHR, - (void *)thunk32_vkUpdateDescriptorSets, - thunk32_vkWaitForFences, - thunk32_vkWaitForPresentKHR, - thunk32_vkWaitSemaphores, - thunk32_vkWaitSemaphoresKHR, - thunk32_vkWriteAccelerationStructuresPropertiesKHR, - thunk32_vkWriteMicromapsPropertiesEXT, -}; -C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == unix_count); diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h deleted file mode 100644 index 8b0d43fadf5..00000000000 --- a/dlls/winevulkan/vulkan_thunks.h +++ /dev/null @@ -1,1186 +0,0 @@ -/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! - * - * This file is generated from Vulkan vk.xml file covered - * by the following copyright and permission notice: - * - * Copyright 2015-2023 The Khronos Group Inc. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef __WINE_VULKAN_THUNKS_H -#define __WINE_VULKAN_THUNKS_H - -#define WINE_VK_VERSION VK_API_VERSION_1_3 - -/* Functions for which we have custom implementations outside of the thunks. */ -VkResult wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers); -VkResult wine_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory); -VkResult wine_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer); -VkResult wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool, void *client_ptr); -VkResult wine_vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback); -VkResult wine_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger); -VkResult wine_vkCreateDeferredOperationKHR(VkDevice device, const VkAllocationCallbacks *pAllocator, VkDeferredOperationKHR *pDeferredOperation); -VkResult wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, void *client_ptr); -VkResult wine_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage); -VkResult wine_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance, void *client_ptr); -VkResult wine_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); -void wine_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator); -void wine_vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator); -void wine_vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks *pAllocator); -void wine_vkDestroyDeferredOperationKHR(VkDevice device, VkDeferredOperationKHR operation, const VkAllocationCallbacks *pAllocator); -void wine_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator); -void wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator); -void wine_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator); -VkResult wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties); -VkResult wine_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties); -VkResult wine_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties); -VkResult wine_vkEnumerateInstanceVersion(uint32_t *pApiVersion); -VkResult wine_vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties); -VkResult wine_vkEnumeratePhysicalDeviceGroupsKHR(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties); -VkResult wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices); -void wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers); -void wine_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator); -VkResult wine_vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT *pTimestampInfos, uint64_t *pTimestamps, uint64_t *pMaxDeviation); -void wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue); -void wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue); -VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainEXT *pTimeDomains); -void wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); -void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); -void wine_vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); -void wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); -void wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties); -void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties); -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties); -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties); -VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities); -VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); -VkResult wine_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData); -VkResult wine_vkMapMemory2KHR(VkDevice device, const VkMemoryMapInfoKHR *pMemoryMapInfo, void **ppData); -void wine_vkUnmapMemory(VkDevice device, VkDeviceMemory memory); -VkResult wine_vkUnmapMemory2KHR(VkDevice device, const VkMemoryUnmapInfoKHR *pMemoryUnmapInfo); - -/* For use by vkDevice and children */ -struct vulkan_device_funcs -{ - VkResult (*p_vkAcquireNextImage2KHR)(VkDevice, const VkAcquireNextImageInfoKHR *, uint32_t *); - VkResult (*p_vkAcquireNextImageKHR)(VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence, uint32_t *); - VkResult (*p_vkAcquirePerformanceConfigurationINTEL)(VkDevice, const VkPerformanceConfigurationAcquireInfoINTEL *, VkPerformanceConfigurationINTEL *); - VkResult (*p_vkAcquireProfilingLockKHR)(VkDevice, const VkAcquireProfilingLockInfoKHR *); - VkResult (*p_vkAllocateCommandBuffers)(VkDevice, const VkCommandBufferAllocateInfo *, VkCommandBuffer *); - VkResult (*p_vkAllocateDescriptorSets)(VkDevice, const VkDescriptorSetAllocateInfo *, VkDescriptorSet *); - VkResult (*p_vkAllocateMemory)(VkDevice, const VkMemoryAllocateInfo *, const VkAllocationCallbacks *, VkDeviceMemory *); - VkResult (*p_vkBeginCommandBuffer)(VkCommandBuffer, const VkCommandBufferBeginInfo *); - VkResult (*p_vkBindAccelerationStructureMemoryNV)(VkDevice, uint32_t, const VkBindAccelerationStructureMemoryInfoNV *); - VkResult (*p_vkBindBufferMemory)(VkDevice, VkBuffer, VkDeviceMemory, VkDeviceSize); - VkResult (*p_vkBindBufferMemory2)(VkDevice, uint32_t, const VkBindBufferMemoryInfo *); - VkResult (*p_vkBindBufferMemory2KHR)(VkDevice, uint32_t, const VkBindBufferMemoryInfo *); - VkResult (*p_vkBindImageMemory)(VkDevice, VkImage, VkDeviceMemory, VkDeviceSize); - VkResult (*p_vkBindImageMemory2)(VkDevice, uint32_t, const VkBindImageMemoryInfo *); - VkResult (*p_vkBindImageMemory2KHR)(VkDevice, uint32_t, const VkBindImageMemoryInfo *); - VkResult (*p_vkBindOpticalFlowSessionImageNV)(VkDevice, VkOpticalFlowSessionNV, VkOpticalFlowSessionBindingPointNV, VkImageView, VkImageLayout); - VkResult (*p_vkBuildAccelerationStructuresKHR)(VkDevice, VkDeferredOperationKHR, uint32_t, const VkAccelerationStructureBuildGeometryInfoKHR *, const VkAccelerationStructureBuildRangeInfoKHR * const*); - VkResult (*p_vkBuildMicromapsEXT)(VkDevice, VkDeferredOperationKHR, uint32_t, const VkMicromapBuildInfoEXT *); - void (*p_vkCmdBeginConditionalRenderingEXT)(VkCommandBuffer, const VkConditionalRenderingBeginInfoEXT *); - void (*p_vkCmdBeginDebugUtilsLabelEXT)(VkCommandBuffer, const VkDebugUtilsLabelEXT *); - void (*p_vkCmdBeginQuery)(VkCommandBuffer, VkQueryPool, uint32_t, VkQueryControlFlags); - void (*p_vkCmdBeginQueryIndexedEXT)(VkCommandBuffer, VkQueryPool, uint32_t, VkQueryControlFlags, uint32_t); - void (*p_vkCmdBeginRenderPass)(VkCommandBuffer, const VkRenderPassBeginInfo *, VkSubpassContents); - void (*p_vkCmdBeginRenderPass2)(VkCommandBuffer, const VkRenderPassBeginInfo *, const VkSubpassBeginInfo *); - void (*p_vkCmdBeginRenderPass2KHR)(VkCommandBuffer, const VkRenderPassBeginInfo *, const VkSubpassBeginInfo *); - void (*p_vkCmdBeginRendering)(VkCommandBuffer, const VkRenderingInfo *); - void (*p_vkCmdBeginRenderingKHR)(VkCommandBuffer, const VkRenderingInfo *); - void (*p_vkCmdBeginTransformFeedbackEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *); - void (*p_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t); - void (*p_vkCmdBindDescriptorBuffersEXT)(VkCommandBuffer, uint32_t, const VkDescriptorBufferBindingInfoEXT *); - void (*p_vkCmdBindDescriptorSets)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const VkDescriptorSet *, uint32_t, const uint32_t *); - void (*p_vkCmdBindIndexBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkIndexType); - void (*p_vkCmdBindIndexBuffer2KHR)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, VkIndexType); - void (*p_vkCmdBindInvocationMaskHUAWEI)(VkCommandBuffer, VkImageView, VkImageLayout); - void (*p_vkCmdBindPipeline)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline); - void (*p_vkCmdBindPipelineShaderGroupNV)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline, uint32_t); - void (*p_vkCmdBindShadersEXT)(VkCommandBuffer, uint32_t, const VkShaderStageFlagBits *, const VkShaderEXT *); - void (*p_vkCmdBindShadingRateImageNV)(VkCommandBuffer, VkImageView, VkImageLayout); - void (*p_vkCmdBindTransformFeedbackBuffersEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *, const VkDeviceSize *); - void (*p_vkCmdBindVertexBuffers)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *); - void (*p_vkCmdBindVertexBuffers2)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *, const VkDeviceSize *, const VkDeviceSize *); - void (*p_vkCmdBindVertexBuffers2EXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *, const VkDeviceSize *, const VkDeviceSize *); - void (*p_vkCmdBlitImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageBlit *, VkFilter); - void (*p_vkCmdBlitImage2)(VkCommandBuffer, const VkBlitImageInfo2 *); - void (*p_vkCmdBlitImage2KHR)(VkCommandBuffer, const VkBlitImageInfo2 *); - void (*p_vkCmdBuildAccelerationStructureNV)(VkCommandBuffer, const VkAccelerationStructureInfoNV *, VkBuffer, VkDeviceSize, VkBool32, VkAccelerationStructureNV, VkAccelerationStructureNV, VkBuffer, VkDeviceSize); - void (*p_vkCmdBuildAccelerationStructuresIndirectKHR)(VkCommandBuffer, uint32_t, const VkAccelerationStructureBuildGeometryInfoKHR *, const VkDeviceAddress *, const uint32_t *, const uint32_t * const*); - void (*p_vkCmdBuildAccelerationStructuresKHR)(VkCommandBuffer, uint32_t, const VkAccelerationStructureBuildGeometryInfoKHR *, const VkAccelerationStructureBuildRangeInfoKHR * const*); - void (*p_vkCmdBuildMicromapsEXT)(VkCommandBuffer, uint32_t, const VkMicromapBuildInfoEXT *); - void (*p_vkCmdClearAttachments)(VkCommandBuffer, uint32_t, const VkClearAttachment *, uint32_t, const VkClearRect *); - void (*p_vkCmdClearColorImage)(VkCommandBuffer, VkImage, VkImageLayout, const VkClearColorValue *, uint32_t, const VkImageSubresourceRange *); - void (*p_vkCmdClearDepthStencilImage)(VkCommandBuffer, VkImage, VkImageLayout, const VkClearDepthStencilValue *, uint32_t, const VkImageSubresourceRange *); - void (*p_vkCmdCopyAccelerationStructureKHR)(VkCommandBuffer, const VkCopyAccelerationStructureInfoKHR *); - void (*p_vkCmdCopyAccelerationStructureNV)(VkCommandBuffer, VkAccelerationStructureNV, VkAccelerationStructureNV, VkCopyAccelerationStructureModeKHR); - void (*p_vkCmdCopyAccelerationStructureToMemoryKHR)(VkCommandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *); - void (*p_vkCmdCopyBuffer)(VkCommandBuffer, VkBuffer, VkBuffer, uint32_t, const VkBufferCopy *); - void (*p_vkCmdCopyBuffer2)(VkCommandBuffer, const VkCopyBufferInfo2 *); - void (*p_vkCmdCopyBuffer2KHR)(VkCommandBuffer, const VkCopyBufferInfo2 *); - void (*p_vkCmdCopyBufferToImage)(VkCommandBuffer, VkBuffer, VkImage, VkImageLayout, uint32_t, const VkBufferImageCopy *); - void (*p_vkCmdCopyBufferToImage2)(VkCommandBuffer, const VkCopyBufferToImageInfo2 *); - void (*p_vkCmdCopyBufferToImage2KHR)(VkCommandBuffer, const VkCopyBufferToImageInfo2 *); - void (*p_vkCmdCopyImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageCopy *); - void (*p_vkCmdCopyImage2)(VkCommandBuffer, const VkCopyImageInfo2 *); - void (*p_vkCmdCopyImage2KHR)(VkCommandBuffer, const VkCopyImageInfo2 *); - void (*p_vkCmdCopyImageToBuffer)(VkCommandBuffer, VkImage, VkImageLayout, VkBuffer, uint32_t, const VkBufferImageCopy *); - void (*p_vkCmdCopyImageToBuffer2)(VkCommandBuffer, const VkCopyImageToBufferInfo2 *); - void (*p_vkCmdCopyImageToBuffer2KHR)(VkCommandBuffer, const VkCopyImageToBufferInfo2 *); - void (*p_vkCmdCopyMemoryIndirectNV)(VkCommandBuffer, VkDeviceAddress, uint32_t, uint32_t); - void (*p_vkCmdCopyMemoryToAccelerationStructureKHR)(VkCommandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *); - void (*p_vkCmdCopyMemoryToImageIndirectNV)(VkCommandBuffer, VkDeviceAddress, uint32_t, uint32_t, VkImage, VkImageLayout, const VkImageSubresourceLayers *); - void (*p_vkCmdCopyMemoryToMicromapEXT)(VkCommandBuffer, const VkCopyMemoryToMicromapInfoEXT *); - void (*p_vkCmdCopyMicromapEXT)(VkCommandBuffer, const VkCopyMicromapInfoEXT *); - void (*p_vkCmdCopyMicromapToMemoryEXT)(VkCommandBuffer, const VkCopyMicromapToMemoryInfoEXT *); - void (*p_vkCmdCopyQueryPoolResults)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t, VkBuffer, VkDeviceSize, VkDeviceSize, VkQueryResultFlags); - void (*p_vkCmdCuLaunchKernelNVX)(VkCommandBuffer, const VkCuLaunchInfoNVX *); - void (*p_vkCmdCudaLaunchKernelNV)(VkCommandBuffer, const VkCudaLaunchInfoNV *); - void (*p_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer, const VkDebugMarkerMarkerInfoEXT *); - void (*p_vkCmdDebugMarkerEndEXT)(VkCommandBuffer); - void (*p_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer, const VkDebugMarkerMarkerInfoEXT *); - void (*p_vkCmdDecompressMemoryIndirectCountNV)(VkCommandBuffer, VkDeviceAddress, VkDeviceAddress, uint32_t); - void (*p_vkCmdDecompressMemoryNV)(VkCommandBuffer, uint32_t, const VkDecompressMemoryRegionNV *); - void (*p_vkCmdDispatch)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDispatchBase)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDispatchBaseKHR)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDispatchIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize); - void (*p_vkCmdDraw)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDrawClusterHUAWEI)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDrawClusterIndirectHUAWEI)(VkCommandBuffer, VkBuffer, VkDeviceSize); - void (*p_vkCmdDrawIndexed)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, int32_t, uint32_t); - void (*p_vkCmdDrawIndexedIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndexedIndirectCount)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndexedIndirectCountKHR)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndirectByteCountEXT)(VkCommandBuffer, uint32_t, uint32_t, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndirectCount)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndirectCountAMD)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawIndirectCountKHR)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawMeshTasksEXT)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDrawMeshTasksIndirectCountEXT)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawMeshTasksIndirectCountNV)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawMeshTasksIndirectEXT)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawMeshTasksIndirectNV)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); - void (*p_vkCmdDrawMeshTasksNV)(VkCommandBuffer, uint32_t, uint32_t); - void (*p_vkCmdDrawMultiEXT)(VkCommandBuffer, uint32_t, const VkMultiDrawInfoEXT *, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdDrawMultiIndexedEXT)(VkCommandBuffer, uint32_t, const VkMultiDrawIndexedInfoEXT *, uint32_t, uint32_t, uint32_t, const int32_t *); - void (*p_vkCmdEndConditionalRenderingEXT)(VkCommandBuffer); - void (*p_vkCmdEndDebugUtilsLabelEXT)(VkCommandBuffer); - void (*p_vkCmdEndQuery)(VkCommandBuffer, VkQueryPool, uint32_t); - void (*p_vkCmdEndQueryIndexedEXT)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t); - void (*p_vkCmdEndRenderPass)(VkCommandBuffer); - void (*p_vkCmdEndRenderPass2)(VkCommandBuffer, const VkSubpassEndInfo *); - void (*p_vkCmdEndRenderPass2KHR)(VkCommandBuffer, const VkSubpassEndInfo *); - void (*p_vkCmdEndRendering)(VkCommandBuffer); - void (*p_vkCmdEndRenderingKHR)(VkCommandBuffer); - void (*p_vkCmdEndTransformFeedbackEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *); - void (*p_vkCmdExecuteCommands)(VkCommandBuffer, uint32_t, const VkCommandBuffer *); - void (*p_vkCmdExecuteGeneratedCommandsNV)(VkCommandBuffer, VkBool32, const VkGeneratedCommandsInfoNV *); - void (*p_vkCmdFillBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, uint32_t); - void (*p_vkCmdInsertDebugUtilsLabelEXT)(VkCommandBuffer, const VkDebugUtilsLabelEXT *); - void (*p_vkCmdNextSubpass)(VkCommandBuffer, VkSubpassContents); - void (*p_vkCmdNextSubpass2)(VkCommandBuffer, const VkSubpassBeginInfo *, const VkSubpassEndInfo *); - void (*p_vkCmdNextSubpass2KHR)(VkCommandBuffer, const VkSubpassBeginInfo *, const VkSubpassEndInfo *); - void (*p_vkCmdOpticalFlowExecuteNV)(VkCommandBuffer, VkOpticalFlowSessionNV, const VkOpticalFlowExecuteInfoNV *); - void (*p_vkCmdPipelineBarrier)(VkCommandBuffer, VkPipelineStageFlags, VkPipelineStageFlags, VkDependencyFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); - void (*p_vkCmdPipelineBarrier2)(VkCommandBuffer, const VkDependencyInfo *); - void (*p_vkCmdPipelineBarrier2KHR)(VkCommandBuffer, const VkDependencyInfo *); - void (*p_vkCmdPreprocessGeneratedCommandsNV)(VkCommandBuffer, const VkGeneratedCommandsInfoNV *); - void (*p_vkCmdPushConstants)(VkCommandBuffer, VkPipelineLayout, VkShaderStageFlags, uint32_t, uint32_t, const void *); - void (*p_vkCmdPushDescriptorSetKHR)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const VkWriteDescriptorSet *); - void (*p_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer, VkDescriptorUpdateTemplate, VkPipelineLayout, uint32_t, const void *); - void (*p_vkCmdResetEvent)(VkCommandBuffer, VkEvent, VkPipelineStageFlags); - void (*p_vkCmdResetEvent2)(VkCommandBuffer, VkEvent, VkPipelineStageFlags2); - void (*p_vkCmdResetEvent2KHR)(VkCommandBuffer, VkEvent, VkPipelineStageFlags2); - void (*p_vkCmdResetQueryPool)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t); - void (*p_vkCmdResolveImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageResolve *); - void (*p_vkCmdResolveImage2)(VkCommandBuffer, const VkResolveImageInfo2 *); - void (*p_vkCmdResolveImage2KHR)(VkCommandBuffer, const VkResolveImageInfo2 *); - void (*p_vkCmdSetAlphaToCoverageEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetAlphaToOneEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetAttachmentFeedbackLoopEnableEXT)(VkCommandBuffer, VkImageAspectFlags); - void (*p_vkCmdSetBlendConstants)(VkCommandBuffer, const float[4]); - void (*p_vkCmdSetCheckpointNV)(VkCommandBuffer, const void *); - void (*p_vkCmdSetCoarseSampleOrderNV)(VkCommandBuffer, VkCoarseSampleOrderTypeNV, uint32_t, const VkCoarseSampleOrderCustomNV *); - void (*p_vkCmdSetColorBlendAdvancedEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkColorBlendAdvancedEXT *); - void (*p_vkCmdSetColorBlendEnableEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBool32 *); - void (*p_vkCmdSetColorBlendEquationEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkColorBlendEquationEXT *); - void (*p_vkCmdSetColorWriteEnableEXT)(VkCommandBuffer, uint32_t, const VkBool32 *); - void (*p_vkCmdSetColorWriteMaskEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkColorComponentFlags *); - void (*p_vkCmdSetConservativeRasterizationModeEXT)(VkCommandBuffer, VkConservativeRasterizationModeEXT); - void (*p_vkCmdSetCoverageModulationModeNV)(VkCommandBuffer, VkCoverageModulationModeNV); - void (*p_vkCmdSetCoverageModulationTableEnableNV)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetCoverageModulationTableNV)(VkCommandBuffer, uint32_t, const float *); - void (*p_vkCmdSetCoverageReductionModeNV)(VkCommandBuffer, VkCoverageReductionModeNV); - void (*p_vkCmdSetCoverageToColorEnableNV)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetCoverageToColorLocationNV)(VkCommandBuffer, uint32_t); - void (*p_vkCmdSetCullMode)(VkCommandBuffer, VkCullModeFlags); - void (*p_vkCmdSetCullModeEXT)(VkCommandBuffer, VkCullModeFlags); - void (*p_vkCmdSetDepthBias)(VkCommandBuffer, float, float, float); - void (*p_vkCmdSetDepthBias2EXT)(VkCommandBuffer, const VkDepthBiasInfoEXT *); - void (*p_vkCmdSetDepthBiasEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthBiasEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthBounds)(VkCommandBuffer, float, float); - void (*p_vkCmdSetDepthBoundsTestEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthBoundsTestEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthClampEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthClipEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthClipNegativeOneToOneEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthCompareOp)(VkCommandBuffer, VkCompareOp); - void (*p_vkCmdSetDepthCompareOpEXT)(VkCommandBuffer, VkCompareOp); - void (*p_vkCmdSetDepthTestEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthTestEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthWriteEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDepthWriteEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDescriptorBufferOffsetsEXT)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const uint32_t *, const VkDeviceSize *); - void (*p_vkCmdSetDeviceMask)(VkCommandBuffer, uint32_t); - void (*p_vkCmdSetDeviceMaskKHR)(VkCommandBuffer, uint32_t); - void (*p_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkRect2D *); - void (*p_vkCmdSetDiscardRectangleEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetDiscardRectangleModeEXT)(VkCommandBuffer, VkDiscardRectangleModeEXT); - void (*p_vkCmdSetEvent)(VkCommandBuffer, VkEvent, VkPipelineStageFlags); - void (*p_vkCmdSetEvent2)(VkCommandBuffer, VkEvent, const VkDependencyInfo *); - void (*p_vkCmdSetEvent2KHR)(VkCommandBuffer, VkEvent, const VkDependencyInfo *); - void (*p_vkCmdSetExclusiveScissorEnableNV)(VkCommandBuffer, uint32_t, uint32_t, const VkBool32 *); - void (*p_vkCmdSetExclusiveScissorNV)(VkCommandBuffer, uint32_t, uint32_t, const VkRect2D *); - void (*p_vkCmdSetExtraPrimitiveOverestimationSizeEXT)(VkCommandBuffer, float); - void (*p_vkCmdSetFragmentShadingRateEnumNV)(VkCommandBuffer, VkFragmentShadingRateNV, const VkFragmentShadingRateCombinerOpKHR[2]); - void (*p_vkCmdSetFragmentShadingRateKHR)(VkCommandBuffer, const VkExtent2D *, const VkFragmentShadingRateCombinerOpKHR[2]); - void (*p_vkCmdSetFrontFace)(VkCommandBuffer, VkFrontFace); - void (*p_vkCmdSetFrontFaceEXT)(VkCommandBuffer, VkFrontFace); - void (*p_vkCmdSetLineRasterizationModeEXT)(VkCommandBuffer, VkLineRasterizationModeEXT); - void (*p_vkCmdSetLineStippleEXT)(VkCommandBuffer, uint32_t, uint16_t); - void (*p_vkCmdSetLineStippleEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetLineWidth)(VkCommandBuffer, float); - void (*p_vkCmdSetLogicOpEXT)(VkCommandBuffer, VkLogicOp); - void (*p_vkCmdSetLogicOpEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetPatchControlPointsEXT)(VkCommandBuffer, uint32_t); - VkResult (*p_vkCmdSetPerformanceMarkerINTEL)(VkCommandBuffer, const VkPerformanceMarkerInfoINTEL *); - VkResult (*p_vkCmdSetPerformanceOverrideINTEL)(VkCommandBuffer, const VkPerformanceOverrideInfoINTEL *); - VkResult (*p_vkCmdSetPerformanceStreamMarkerINTEL)(VkCommandBuffer, const VkPerformanceStreamMarkerInfoINTEL *); - void (*p_vkCmdSetPolygonModeEXT)(VkCommandBuffer, VkPolygonMode); - void (*p_vkCmdSetPrimitiveRestartEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetPrimitiveRestartEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetPrimitiveTopology)(VkCommandBuffer, VkPrimitiveTopology); - void (*p_vkCmdSetPrimitiveTopologyEXT)(VkCommandBuffer, VkPrimitiveTopology); - void (*p_vkCmdSetProvokingVertexModeEXT)(VkCommandBuffer, VkProvokingVertexModeEXT); - void (*p_vkCmdSetRasterizationSamplesEXT)(VkCommandBuffer, VkSampleCountFlagBits); - void (*p_vkCmdSetRasterizationStreamEXT)(VkCommandBuffer, uint32_t); - void (*p_vkCmdSetRasterizerDiscardEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetRasterizerDiscardEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetRayTracingPipelineStackSizeKHR)(VkCommandBuffer, uint32_t); - void (*p_vkCmdSetRepresentativeFragmentTestEnableNV)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetSampleLocationsEXT)(VkCommandBuffer, const VkSampleLocationsInfoEXT *); - void (*p_vkCmdSetSampleLocationsEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetSampleMaskEXT)(VkCommandBuffer, VkSampleCountFlagBits, const VkSampleMask *); - void (*p_vkCmdSetScissor)(VkCommandBuffer, uint32_t, uint32_t, const VkRect2D *); - void (*p_vkCmdSetScissorWithCount)(VkCommandBuffer, uint32_t, const VkRect2D *); - void (*p_vkCmdSetScissorWithCountEXT)(VkCommandBuffer, uint32_t, const VkRect2D *); - void (*p_vkCmdSetShadingRateImageEnableNV)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetStencilCompareMask)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); - void (*p_vkCmdSetStencilOp)(VkCommandBuffer, VkStencilFaceFlags, VkStencilOp, VkStencilOp, VkStencilOp, VkCompareOp); - void (*p_vkCmdSetStencilOpEXT)(VkCommandBuffer, VkStencilFaceFlags, VkStencilOp, VkStencilOp, VkStencilOp, VkCompareOp); - void (*p_vkCmdSetStencilReference)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); - void (*p_vkCmdSetStencilTestEnable)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetStencilTestEnableEXT)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetStencilWriteMask)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); - void (*p_vkCmdSetTessellationDomainOriginEXT)(VkCommandBuffer, VkTessellationDomainOrigin); - void (*p_vkCmdSetVertexInputEXT)(VkCommandBuffer, uint32_t, const VkVertexInputBindingDescription2EXT *, uint32_t, const VkVertexInputAttributeDescription2EXT *); - void (*p_vkCmdSetViewport)(VkCommandBuffer, uint32_t, uint32_t, const VkViewport *); - void (*p_vkCmdSetViewportShadingRatePaletteNV)(VkCommandBuffer, uint32_t, uint32_t, const VkShadingRatePaletteNV *); - void (*p_vkCmdSetViewportSwizzleNV)(VkCommandBuffer, uint32_t, uint32_t, const VkViewportSwizzleNV *); - void (*p_vkCmdSetViewportWScalingEnableNV)(VkCommandBuffer, VkBool32); - void (*p_vkCmdSetViewportWScalingNV)(VkCommandBuffer, uint32_t, uint32_t, const VkViewportWScalingNV *); - void (*p_vkCmdSetViewportWithCount)(VkCommandBuffer, uint32_t, const VkViewport *); - void (*p_vkCmdSetViewportWithCountEXT)(VkCommandBuffer, uint32_t, const VkViewport *); - void (*p_vkCmdSubpassShadingHUAWEI)(VkCommandBuffer); - void (*p_vkCmdTraceRaysIndirect2KHR)(VkCommandBuffer, VkDeviceAddress); - void (*p_vkCmdTraceRaysIndirectKHR)(VkCommandBuffer, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, VkDeviceAddress); - void (*p_vkCmdTraceRaysKHR)(VkCommandBuffer, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdTraceRaysNV)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, VkDeviceSize, VkBuffer, VkDeviceSize, VkDeviceSize, VkBuffer, VkDeviceSize, VkDeviceSize, uint32_t, uint32_t, uint32_t); - void (*p_vkCmdUpdateBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, const void *); - void (*p_vkCmdUpdatePipelineIndirectBufferNV)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline); - void (*p_vkCmdWaitEvents)(VkCommandBuffer, uint32_t, const VkEvent *, VkPipelineStageFlags, VkPipelineStageFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); - void (*p_vkCmdWaitEvents2)(VkCommandBuffer, uint32_t, const VkEvent *, const VkDependencyInfo *); - void (*p_vkCmdWaitEvents2KHR)(VkCommandBuffer, uint32_t, const VkEvent *, const VkDependencyInfo *); - void (*p_vkCmdWriteAccelerationStructuresPropertiesKHR)(VkCommandBuffer, uint32_t, const VkAccelerationStructureKHR *, VkQueryType, VkQueryPool, uint32_t); - void (*p_vkCmdWriteAccelerationStructuresPropertiesNV)(VkCommandBuffer, uint32_t, const VkAccelerationStructureNV *, VkQueryType, VkQueryPool, uint32_t); - void (*p_vkCmdWriteBufferMarker2AMD)(VkCommandBuffer, VkPipelineStageFlags2, VkBuffer, VkDeviceSize, uint32_t); - void (*p_vkCmdWriteBufferMarkerAMD)(VkCommandBuffer, VkPipelineStageFlagBits, VkBuffer, VkDeviceSize, uint32_t); - void (*p_vkCmdWriteMicromapsPropertiesEXT)(VkCommandBuffer, uint32_t, const VkMicromapEXT *, VkQueryType, VkQueryPool, uint32_t); - void (*p_vkCmdWriteTimestamp)(VkCommandBuffer, VkPipelineStageFlagBits, VkQueryPool, uint32_t); - void (*p_vkCmdWriteTimestamp2)(VkCommandBuffer, VkPipelineStageFlags2, VkQueryPool, uint32_t); - void (*p_vkCmdWriteTimestamp2KHR)(VkCommandBuffer, VkPipelineStageFlags2, VkQueryPool, uint32_t); - VkResult (*p_vkCompileDeferredNV)(VkDevice, VkPipeline, uint32_t); - VkResult (*p_vkCopyAccelerationStructureKHR)(VkDevice, VkDeferredOperationKHR, const VkCopyAccelerationStructureInfoKHR *); - VkResult (*p_vkCopyAccelerationStructureToMemoryKHR)(VkDevice, VkDeferredOperationKHR, const VkCopyAccelerationStructureToMemoryInfoKHR *); - VkResult (*p_vkCopyImageToImageEXT)(VkDevice, const VkCopyImageToImageInfoEXT *); - VkResult (*p_vkCopyImageToMemoryEXT)(VkDevice, const VkCopyImageToMemoryInfoEXT *); - VkResult (*p_vkCopyMemoryToAccelerationStructureKHR)(VkDevice, VkDeferredOperationKHR, const VkCopyMemoryToAccelerationStructureInfoKHR *); - VkResult (*p_vkCopyMemoryToImageEXT)(VkDevice, const VkCopyMemoryToImageInfoEXT *); - VkResult (*p_vkCopyMemoryToMicromapEXT)(VkDevice, VkDeferredOperationKHR, const VkCopyMemoryToMicromapInfoEXT *); - VkResult (*p_vkCopyMicromapEXT)(VkDevice, VkDeferredOperationKHR, const VkCopyMicromapInfoEXT *); - VkResult (*p_vkCopyMicromapToMemoryEXT)(VkDevice, VkDeferredOperationKHR, const VkCopyMicromapToMemoryInfoEXT *); - VkResult (*p_vkCreateAccelerationStructureKHR)(VkDevice, const VkAccelerationStructureCreateInfoKHR *, const VkAllocationCallbacks *, VkAccelerationStructureKHR *); - VkResult (*p_vkCreateAccelerationStructureNV)(VkDevice, const VkAccelerationStructureCreateInfoNV *, const VkAllocationCallbacks *, VkAccelerationStructureNV *); - VkResult (*p_vkCreateBuffer)(VkDevice, const VkBufferCreateInfo *, const VkAllocationCallbacks *, VkBuffer *); - VkResult (*p_vkCreateBufferView)(VkDevice, const VkBufferViewCreateInfo *, const VkAllocationCallbacks *, VkBufferView *); - VkResult (*p_vkCreateCommandPool)(VkDevice, const VkCommandPoolCreateInfo *, const VkAllocationCallbacks *, VkCommandPool *); - VkResult (*p_vkCreateComputePipelines)(VkDevice, VkPipelineCache, uint32_t, const VkComputePipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *); - VkResult (*p_vkCreateCuFunctionNVX)(VkDevice, const VkCuFunctionCreateInfoNVX *, const VkAllocationCallbacks *, VkCuFunctionNVX *); - VkResult (*p_vkCreateCuModuleNVX)(VkDevice, const VkCuModuleCreateInfoNVX *, const VkAllocationCallbacks *, VkCuModuleNVX *); - VkResult (*p_vkCreateCudaFunctionNV)(VkDevice, const VkCudaFunctionCreateInfoNV *, const VkAllocationCallbacks *, VkCudaFunctionNV *); - VkResult (*p_vkCreateCudaModuleNV)(VkDevice, const VkCudaModuleCreateInfoNV *, const VkAllocationCallbacks *, VkCudaModuleNV *); - VkResult (*p_vkCreateDeferredOperationKHR)(VkDevice, const VkAllocationCallbacks *, VkDeferredOperationKHR *); - VkResult (*p_vkCreateDescriptorPool)(VkDevice, const VkDescriptorPoolCreateInfo *, const VkAllocationCallbacks *, VkDescriptorPool *); - VkResult (*p_vkCreateDescriptorSetLayout)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, const VkAllocationCallbacks *, VkDescriptorSetLayout *); - VkResult (*p_vkCreateDescriptorUpdateTemplate)(VkDevice, const VkDescriptorUpdateTemplateCreateInfo *, const VkAllocationCallbacks *, VkDescriptorUpdateTemplate *); - VkResult (*p_vkCreateDescriptorUpdateTemplateKHR)(VkDevice, const VkDescriptorUpdateTemplateCreateInfo *, const VkAllocationCallbacks *, VkDescriptorUpdateTemplate *); - VkResult (*p_vkCreateEvent)(VkDevice, const VkEventCreateInfo *, const VkAllocationCallbacks *, VkEvent *); - VkResult (*p_vkCreateFence)(VkDevice, const VkFenceCreateInfo *, const VkAllocationCallbacks *, VkFence *); - VkResult (*p_vkCreateFramebuffer)(VkDevice, const VkFramebufferCreateInfo *, const VkAllocationCallbacks *, VkFramebuffer *); - VkResult (*p_vkCreateGraphicsPipelines)(VkDevice, VkPipelineCache, uint32_t, const VkGraphicsPipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *); - VkResult (*p_vkCreateImage)(VkDevice, const VkImageCreateInfo *, const VkAllocationCallbacks *, VkImage *); - VkResult (*p_vkCreateImageView)(VkDevice, const VkImageViewCreateInfo *, const VkAllocationCallbacks *, VkImageView *); - VkResult (*p_vkCreateIndirectCommandsLayoutNV)(VkDevice, const VkIndirectCommandsLayoutCreateInfoNV *, const VkAllocationCallbacks *, VkIndirectCommandsLayoutNV *); - VkResult (*p_vkCreateMicromapEXT)(VkDevice, const VkMicromapCreateInfoEXT *, const VkAllocationCallbacks *, VkMicromapEXT *); - VkResult (*p_vkCreateOpticalFlowSessionNV)(VkDevice, const VkOpticalFlowSessionCreateInfoNV *, const VkAllocationCallbacks *, VkOpticalFlowSessionNV *); - VkResult (*p_vkCreatePipelineCache)(VkDevice, const VkPipelineCacheCreateInfo *, const VkAllocationCallbacks *, VkPipelineCache *); - VkResult (*p_vkCreatePipelineLayout)(VkDevice, const VkPipelineLayoutCreateInfo *, const VkAllocationCallbacks *, VkPipelineLayout *); - VkResult (*p_vkCreatePrivateDataSlot)(VkDevice, const VkPrivateDataSlotCreateInfo *, const VkAllocationCallbacks *, VkPrivateDataSlot *); - VkResult (*p_vkCreatePrivateDataSlotEXT)(VkDevice, const VkPrivateDataSlotCreateInfo *, const VkAllocationCallbacks *, VkPrivateDataSlot *); - VkResult (*p_vkCreateQueryPool)(VkDevice, const VkQueryPoolCreateInfo *, const VkAllocationCallbacks *, VkQueryPool *); - VkResult (*p_vkCreateRayTracingPipelinesKHR)(VkDevice, VkDeferredOperationKHR, VkPipelineCache, uint32_t, const VkRayTracingPipelineCreateInfoKHR *, const VkAllocationCallbacks *, VkPipeline *); - VkResult (*p_vkCreateRayTracingPipelinesNV)(VkDevice, VkPipelineCache, uint32_t, const VkRayTracingPipelineCreateInfoNV *, const VkAllocationCallbacks *, VkPipeline *); - VkResult (*p_vkCreateRenderPass)(VkDevice, const VkRenderPassCreateInfo *, const VkAllocationCallbacks *, VkRenderPass *); - VkResult (*p_vkCreateRenderPass2)(VkDevice, const VkRenderPassCreateInfo2 *, const VkAllocationCallbacks *, VkRenderPass *); - VkResult (*p_vkCreateRenderPass2KHR)(VkDevice, const VkRenderPassCreateInfo2 *, const VkAllocationCallbacks *, VkRenderPass *); - VkResult (*p_vkCreateSampler)(VkDevice, const VkSamplerCreateInfo *, const VkAllocationCallbacks *, VkSampler *); - VkResult (*p_vkCreateSamplerYcbcrConversion)(VkDevice, const VkSamplerYcbcrConversionCreateInfo *, const VkAllocationCallbacks *, VkSamplerYcbcrConversion *); - VkResult (*p_vkCreateSamplerYcbcrConversionKHR)(VkDevice, const VkSamplerYcbcrConversionCreateInfo *, const VkAllocationCallbacks *, VkSamplerYcbcrConversion *); - VkResult (*p_vkCreateSemaphore)(VkDevice, const VkSemaphoreCreateInfo *, const VkAllocationCallbacks *, VkSemaphore *); - VkResult (*p_vkCreateShaderModule)(VkDevice, const VkShaderModuleCreateInfo *, const VkAllocationCallbacks *, VkShaderModule *); - VkResult (*p_vkCreateShadersEXT)(VkDevice, uint32_t, const VkShaderCreateInfoEXT *, const VkAllocationCallbacks *, VkShaderEXT *); - VkResult (*p_vkCreateSwapchainKHR)(VkDevice, const VkSwapchainCreateInfoKHR *, const VkAllocationCallbacks *, VkSwapchainKHR *); - VkResult (*p_vkCreateValidationCacheEXT)(VkDevice, const VkValidationCacheCreateInfoEXT *, const VkAllocationCallbacks *, VkValidationCacheEXT *); - VkResult (*p_vkDebugMarkerSetObjectNameEXT)(VkDevice, const VkDebugMarkerObjectNameInfoEXT *); - VkResult (*p_vkDebugMarkerSetObjectTagEXT)(VkDevice, const VkDebugMarkerObjectTagInfoEXT *); - VkResult (*p_vkDeferredOperationJoinKHR)(VkDevice, VkDeferredOperationKHR); - void (*p_vkDestroyAccelerationStructureKHR)(VkDevice, VkAccelerationStructureKHR, const VkAllocationCallbacks *); - void (*p_vkDestroyAccelerationStructureNV)(VkDevice, VkAccelerationStructureNV, const VkAllocationCallbacks *); - void (*p_vkDestroyBuffer)(VkDevice, VkBuffer, const VkAllocationCallbacks *); - void (*p_vkDestroyBufferView)(VkDevice, VkBufferView, const VkAllocationCallbacks *); - void (*p_vkDestroyCommandPool)(VkDevice, VkCommandPool, const VkAllocationCallbacks *); - void (*p_vkDestroyCuFunctionNVX)(VkDevice, VkCuFunctionNVX, const VkAllocationCallbacks *); - void (*p_vkDestroyCuModuleNVX)(VkDevice, VkCuModuleNVX, const VkAllocationCallbacks *); - void (*p_vkDestroyCudaFunctionNV)(VkDevice, VkCudaFunctionNV, const VkAllocationCallbacks *); - void (*p_vkDestroyCudaModuleNV)(VkDevice, VkCudaModuleNV, const VkAllocationCallbacks *); - void (*p_vkDestroyDeferredOperationKHR)(VkDevice, VkDeferredOperationKHR, const VkAllocationCallbacks *); - void (*p_vkDestroyDescriptorPool)(VkDevice, VkDescriptorPool, const VkAllocationCallbacks *); - void (*p_vkDestroyDescriptorSetLayout)(VkDevice, VkDescriptorSetLayout, const VkAllocationCallbacks *); - void (*p_vkDestroyDescriptorUpdateTemplate)(VkDevice, VkDescriptorUpdateTemplate, const VkAllocationCallbacks *); - void (*p_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice, VkDescriptorUpdateTemplate, const VkAllocationCallbacks *); - void (*p_vkDestroyDevice)(VkDevice, const VkAllocationCallbacks *); - void (*p_vkDestroyEvent)(VkDevice, VkEvent, const VkAllocationCallbacks *); - void (*p_vkDestroyFence)(VkDevice, VkFence, const VkAllocationCallbacks *); - void (*p_vkDestroyFramebuffer)(VkDevice, VkFramebuffer, const VkAllocationCallbacks *); - void (*p_vkDestroyImage)(VkDevice, VkImage, const VkAllocationCallbacks *); - void (*p_vkDestroyImageView)(VkDevice, VkImageView, const VkAllocationCallbacks *); - void (*p_vkDestroyIndirectCommandsLayoutNV)(VkDevice, VkIndirectCommandsLayoutNV, const VkAllocationCallbacks *); - void (*p_vkDestroyMicromapEXT)(VkDevice, VkMicromapEXT, const VkAllocationCallbacks *); - void (*p_vkDestroyOpticalFlowSessionNV)(VkDevice, VkOpticalFlowSessionNV, const VkAllocationCallbacks *); - void (*p_vkDestroyPipeline)(VkDevice, VkPipeline, const VkAllocationCallbacks *); - void (*p_vkDestroyPipelineCache)(VkDevice, VkPipelineCache, const VkAllocationCallbacks *); - void (*p_vkDestroyPipelineLayout)(VkDevice, VkPipelineLayout, const VkAllocationCallbacks *); - void (*p_vkDestroyPrivateDataSlot)(VkDevice, VkPrivateDataSlot, const VkAllocationCallbacks *); - void (*p_vkDestroyPrivateDataSlotEXT)(VkDevice, VkPrivateDataSlot, const VkAllocationCallbacks *); - void (*p_vkDestroyQueryPool)(VkDevice, VkQueryPool, const VkAllocationCallbacks *); - void (*p_vkDestroyRenderPass)(VkDevice, VkRenderPass, const VkAllocationCallbacks *); - void (*p_vkDestroySampler)(VkDevice, VkSampler, const VkAllocationCallbacks *); - void (*p_vkDestroySamplerYcbcrConversion)(VkDevice, VkSamplerYcbcrConversion, const VkAllocationCallbacks *); - void (*p_vkDestroySamplerYcbcrConversionKHR)(VkDevice, VkSamplerYcbcrConversion, const VkAllocationCallbacks *); - void (*p_vkDestroySemaphore)(VkDevice, VkSemaphore, const VkAllocationCallbacks *); - void (*p_vkDestroyShaderEXT)(VkDevice, VkShaderEXT, const VkAllocationCallbacks *); - void (*p_vkDestroyShaderModule)(VkDevice, VkShaderModule, const VkAllocationCallbacks *); - void (*p_vkDestroySwapchainKHR)(VkDevice, VkSwapchainKHR, const VkAllocationCallbacks *); - void (*p_vkDestroyValidationCacheEXT)(VkDevice, VkValidationCacheEXT, const VkAllocationCallbacks *); - VkResult (*p_vkDeviceWaitIdle)(VkDevice); - VkResult (*p_vkEndCommandBuffer)(VkCommandBuffer); - VkResult (*p_vkFlushMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange *); - void (*p_vkFreeCommandBuffers)(VkDevice, VkCommandPool, uint32_t, const VkCommandBuffer *); - VkResult (*p_vkFreeDescriptorSets)(VkDevice, VkDescriptorPool, uint32_t, const VkDescriptorSet *); - void (*p_vkFreeMemory)(VkDevice, VkDeviceMemory, const VkAllocationCallbacks *); - void (*p_vkGetAccelerationStructureBuildSizesKHR)(VkDevice, VkAccelerationStructureBuildTypeKHR, const VkAccelerationStructureBuildGeometryInfoKHR *, const uint32_t *, VkAccelerationStructureBuildSizesInfoKHR *); - VkDeviceAddress (*p_vkGetAccelerationStructureDeviceAddressKHR)(VkDevice, const VkAccelerationStructureDeviceAddressInfoKHR *); - VkResult (*p_vkGetAccelerationStructureHandleNV)(VkDevice, VkAccelerationStructureNV, size_t, void *); - void (*p_vkGetAccelerationStructureMemoryRequirementsNV)(VkDevice, const VkAccelerationStructureMemoryRequirementsInfoNV *, VkMemoryRequirements2KHR *); - VkResult (*p_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkAccelerationStructureCaptureDescriptorDataInfoEXT *, void *); - VkDeviceAddress (*p_vkGetBufferDeviceAddress)(VkDevice, const VkBufferDeviceAddressInfo *); - VkDeviceAddress (*p_vkGetBufferDeviceAddressEXT)(VkDevice, const VkBufferDeviceAddressInfo *); - VkDeviceAddress (*p_vkGetBufferDeviceAddressKHR)(VkDevice, const VkBufferDeviceAddressInfo *); - void (*p_vkGetBufferMemoryRequirements)(VkDevice, VkBuffer, VkMemoryRequirements *); - void (*p_vkGetBufferMemoryRequirements2)(VkDevice, const VkBufferMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); - void (*p_vkGetBufferMemoryRequirements2KHR)(VkDevice, const VkBufferMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); - uint64_t (*p_vkGetBufferOpaqueCaptureAddress)(VkDevice, const VkBufferDeviceAddressInfo *); - uint64_t (*p_vkGetBufferOpaqueCaptureAddressKHR)(VkDevice, const VkBufferDeviceAddressInfo *); - VkResult (*p_vkGetBufferOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkBufferCaptureDescriptorDataInfoEXT *, void *); - VkResult (*p_vkGetCalibratedTimestampsEXT)(VkDevice, uint32_t, const VkCalibratedTimestampInfoEXT *, uint64_t *, uint64_t *); - VkResult (*p_vkGetCudaModuleCacheNV)(VkDevice, VkCudaModuleNV, size_t *, void *); - uint32_t (*p_vkGetDeferredOperationMaxConcurrencyKHR)(VkDevice, VkDeferredOperationKHR); - VkResult (*p_vkGetDeferredOperationResultKHR)(VkDevice, VkDeferredOperationKHR); - void (*p_vkGetDescriptorEXT)(VkDevice, const VkDescriptorGetInfoEXT *, size_t, void *); - void (*p_vkGetDescriptorSetHostMappingVALVE)(VkDevice, VkDescriptorSet, void **); - void (*p_vkGetDescriptorSetLayoutBindingOffsetEXT)(VkDevice, VkDescriptorSetLayout, uint32_t, VkDeviceSize *); - void (*p_vkGetDescriptorSetLayoutHostMappingInfoVALVE)(VkDevice, const VkDescriptorSetBindingReferenceVALVE *, VkDescriptorSetLayoutHostMappingInfoVALVE *); - void (*p_vkGetDescriptorSetLayoutSizeEXT)(VkDevice, VkDescriptorSetLayout, VkDeviceSize *); - void (*p_vkGetDescriptorSetLayoutSupport)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, VkDescriptorSetLayoutSupport *); - void (*p_vkGetDescriptorSetLayoutSupportKHR)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, VkDescriptorSetLayoutSupport *); - void (*p_vkGetDeviceAccelerationStructureCompatibilityKHR)(VkDevice, const VkAccelerationStructureVersionInfoKHR *, VkAccelerationStructureCompatibilityKHR *); - void (*p_vkGetDeviceBufferMemoryRequirements)(VkDevice, const VkDeviceBufferMemoryRequirements *, VkMemoryRequirements2 *); - void (*p_vkGetDeviceBufferMemoryRequirementsKHR)(VkDevice, const VkDeviceBufferMemoryRequirements *, VkMemoryRequirements2 *); - VkResult (*p_vkGetDeviceFaultInfoEXT)(VkDevice, VkDeviceFaultCountsEXT *, VkDeviceFaultInfoEXT *); - void (*p_vkGetDeviceGroupPeerMemoryFeatures)(VkDevice, uint32_t, uint32_t, uint32_t, VkPeerMemoryFeatureFlags *); - void (*p_vkGetDeviceGroupPeerMemoryFeaturesKHR)(VkDevice, uint32_t, uint32_t, uint32_t, VkPeerMemoryFeatureFlags *); - VkResult (*p_vkGetDeviceGroupPresentCapabilitiesKHR)(VkDevice, VkDeviceGroupPresentCapabilitiesKHR *); - VkResult (*p_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKHR, VkDeviceGroupPresentModeFlagsKHR *); - void (*p_vkGetDeviceImageMemoryRequirements)(VkDevice, const VkDeviceImageMemoryRequirements *, VkMemoryRequirements2 *); - void (*p_vkGetDeviceImageMemoryRequirementsKHR)(VkDevice, const VkDeviceImageMemoryRequirements *, VkMemoryRequirements2 *); - void (*p_vkGetDeviceImageSparseMemoryRequirements)(VkDevice, const VkDeviceImageMemoryRequirements *, uint32_t *, VkSparseImageMemoryRequirements2 *); - void (*p_vkGetDeviceImageSparseMemoryRequirementsKHR)(VkDevice, const VkDeviceImageMemoryRequirements *, uint32_t *, VkSparseImageMemoryRequirements2 *); - void (*p_vkGetDeviceImageSubresourceLayoutKHR)(VkDevice, const VkDeviceImageSubresourceInfoKHR *, VkSubresourceLayout2KHR *); - void (*p_vkGetDeviceMemoryCommitment)(VkDevice, VkDeviceMemory, VkDeviceSize *); - uint64_t (*p_vkGetDeviceMemoryOpaqueCaptureAddress)(VkDevice, const VkDeviceMemoryOpaqueCaptureAddressInfo *); - uint64_t (*p_vkGetDeviceMemoryOpaqueCaptureAddressKHR)(VkDevice, const VkDeviceMemoryOpaqueCaptureAddressInfo *); - void (*p_vkGetDeviceMicromapCompatibilityEXT)(VkDevice, const VkMicromapVersionInfoEXT *, VkAccelerationStructureCompatibilityKHR *); - void (*p_vkGetDeviceQueue)(VkDevice, uint32_t, uint32_t, VkQueue *); - void (*p_vkGetDeviceQueue2)(VkDevice, const VkDeviceQueueInfo2 *, VkQueue *); - VkResult (*p_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI)(VkDevice, VkRenderPass, VkExtent2D *); - VkResult (*p_vkGetDynamicRenderingTilePropertiesQCOM)(VkDevice, const VkRenderingInfo *, VkTilePropertiesQCOM *); - VkResult (*p_vkGetEventStatus)(VkDevice, VkEvent); - VkResult (*p_vkGetFenceStatus)(VkDevice, VkFence); - VkResult (*p_vkGetFramebufferTilePropertiesQCOM)(VkDevice, VkFramebuffer, uint32_t *, VkTilePropertiesQCOM *); - void (*p_vkGetGeneratedCommandsMemoryRequirementsNV)(VkDevice, const VkGeneratedCommandsMemoryRequirementsInfoNV *, VkMemoryRequirements2 *); - void (*p_vkGetImageMemoryRequirements)(VkDevice, VkImage, VkMemoryRequirements *); - void (*p_vkGetImageMemoryRequirements2)(VkDevice, const VkImageMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); - void (*p_vkGetImageMemoryRequirements2KHR)(VkDevice, const VkImageMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); - VkResult (*p_vkGetImageOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkImageCaptureDescriptorDataInfoEXT *, void *); - void (*p_vkGetImageSparseMemoryRequirements)(VkDevice, VkImage, uint32_t *, VkSparseImageMemoryRequirements *); - void (*p_vkGetImageSparseMemoryRequirements2)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *); - void (*p_vkGetImageSparseMemoryRequirements2KHR)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *); - void (*p_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout *); - void (*p_vkGetImageSubresourceLayout2EXT)(VkDevice, VkImage, const VkImageSubresource2KHR *, VkSubresourceLayout2KHR *); - void (*p_vkGetImageSubresourceLayout2KHR)(VkDevice, VkImage, const VkImageSubresource2KHR *, VkSubresourceLayout2KHR *); - VkResult (*p_vkGetImageViewAddressNVX)(VkDevice, VkImageView, VkImageViewAddressPropertiesNVX *); - uint32_t (*p_vkGetImageViewHandleNVX)(VkDevice, const VkImageViewHandleInfoNVX *); - VkResult (*p_vkGetImageViewOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkImageViewCaptureDescriptorDataInfoEXT *, void *); - void (*p_vkGetLatencyTimingsNV)(VkDevice, VkSwapchainKHR, VkGetLatencyMarkerInfoNV *); - VkResult (*p_vkGetMemoryHostPointerPropertiesEXT)(VkDevice, VkExternalMemoryHandleTypeFlagBits, const void *, VkMemoryHostPointerPropertiesEXT *); - void (*p_vkGetMicromapBuildSizesEXT)(VkDevice, VkAccelerationStructureBuildTypeKHR, const VkMicromapBuildInfoEXT *, VkMicromapBuildSizesInfoEXT *); - VkResult (*p_vkGetPerformanceParameterINTEL)(VkDevice, VkPerformanceParameterTypeINTEL, VkPerformanceValueINTEL *); - VkResult (*p_vkGetPipelineCacheData)(VkDevice, VkPipelineCache, size_t *, void *); - VkResult (*p_vkGetPipelineExecutableInternalRepresentationsKHR)(VkDevice, const VkPipelineExecutableInfoKHR *, uint32_t *, VkPipelineExecutableInternalRepresentationKHR *); - VkResult (*p_vkGetPipelineExecutablePropertiesKHR)(VkDevice, const VkPipelineInfoKHR *, uint32_t *, VkPipelineExecutablePropertiesKHR *); - VkResult (*p_vkGetPipelineExecutableStatisticsKHR)(VkDevice, const VkPipelineExecutableInfoKHR *, uint32_t *, VkPipelineExecutableStatisticKHR *); - VkDeviceAddress (*p_vkGetPipelineIndirectDeviceAddressNV)(VkDevice, const VkPipelineIndirectDeviceAddressInfoNV *); - void (*p_vkGetPipelineIndirectMemoryRequirementsNV)(VkDevice, const VkComputePipelineCreateInfo *, VkMemoryRequirements2 *); - VkResult (*p_vkGetPipelinePropertiesEXT)(VkDevice, const VkPipelineInfoEXT *, VkBaseOutStructure *); - void (*p_vkGetPrivateData)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t *); - void (*p_vkGetPrivateDataEXT)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t *); - VkResult (*p_vkGetQueryPoolResults)(VkDevice, VkQueryPool, uint32_t, uint32_t, size_t, void *, VkDeviceSize, VkQueryResultFlags); - void (*p_vkGetQueueCheckpointData2NV)(VkQueue, uint32_t *, VkCheckpointData2NV *); - void (*p_vkGetQueueCheckpointDataNV)(VkQueue, uint32_t *, VkCheckpointDataNV *); - VkResult (*p_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)(VkDevice, VkPipeline, uint32_t, uint32_t, size_t, void *); - VkResult (*p_vkGetRayTracingShaderGroupHandlesKHR)(VkDevice, VkPipeline, uint32_t, uint32_t, size_t, void *); - VkResult (*p_vkGetRayTracingShaderGroupHandlesNV)(VkDevice, VkPipeline, uint32_t, uint32_t, size_t, void *); - VkDeviceSize (*p_vkGetRayTracingShaderGroupStackSizeKHR)(VkDevice, VkPipeline, uint32_t, VkShaderGroupShaderKHR); - void (*p_vkGetRenderAreaGranularity)(VkDevice, VkRenderPass, VkExtent2D *); - void (*p_vkGetRenderingAreaGranularityKHR)(VkDevice, const VkRenderingAreaInfoKHR *, VkExtent2D *); - VkResult (*p_vkGetSamplerOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkSamplerCaptureDescriptorDataInfoEXT *, void *); - VkResult (*p_vkGetSemaphoreCounterValue)(VkDevice, VkSemaphore, uint64_t *); - VkResult (*p_vkGetSemaphoreCounterValueKHR)(VkDevice, VkSemaphore, uint64_t *); - VkResult (*p_vkGetShaderBinaryDataEXT)(VkDevice, VkShaderEXT, size_t *, void *); - VkResult (*p_vkGetShaderInfoAMD)(VkDevice, VkPipeline, VkShaderStageFlagBits, VkShaderInfoTypeAMD, size_t *, void *); - void (*p_vkGetShaderModuleCreateInfoIdentifierEXT)(VkDevice, const VkShaderModuleCreateInfo *, VkShaderModuleIdentifierEXT *); - void (*p_vkGetShaderModuleIdentifierEXT)(VkDevice, VkShaderModule, VkShaderModuleIdentifierEXT *); - VkResult (*p_vkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *); - VkResult (*p_vkGetValidationCacheDataEXT)(VkDevice, VkValidationCacheEXT, size_t *, void *); - VkResult (*p_vkInitializePerformanceApiINTEL)(VkDevice, const VkInitializePerformanceApiInfoINTEL *); - VkResult (*p_vkInvalidateMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange *); - VkResult (*p_vkLatencySleepNV)(VkDevice, VkSwapchainKHR, const VkLatencySleepInfoNV *); - VkResult (*p_vkMapMemory)(VkDevice, VkDeviceMemory, VkDeviceSize, VkDeviceSize, VkMemoryMapFlags, void **); - VkResult (*p_vkMapMemory2KHR)(VkDevice, const VkMemoryMapInfoKHR *, void **); - VkResult (*p_vkMergePipelineCaches)(VkDevice, VkPipelineCache, uint32_t, const VkPipelineCache *); - VkResult (*p_vkMergeValidationCachesEXT)(VkDevice, VkValidationCacheEXT, uint32_t, const VkValidationCacheEXT *); - void (*p_vkQueueBeginDebugUtilsLabelEXT)(VkQueue, const VkDebugUtilsLabelEXT *); - VkResult (*p_vkQueueBindSparse)(VkQueue, uint32_t, const VkBindSparseInfo *, VkFence); - void (*p_vkQueueEndDebugUtilsLabelEXT)(VkQueue); - void (*p_vkQueueInsertDebugUtilsLabelEXT)(VkQueue, const VkDebugUtilsLabelEXT *); - void (*p_vkQueueNotifyOutOfBandNV)(VkQueue, const VkOutOfBandQueueTypeInfoNV *); - VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); - VkResult (*p_vkQueueSetPerformanceConfigurationINTEL)(VkQueue, VkPerformanceConfigurationINTEL); - VkResult (*p_vkQueueSubmit)(VkQueue, uint32_t, const VkSubmitInfo *, VkFence); - VkResult (*p_vkQueueSubmit2)(VkQueue, uint32_t, const VkSubmitInfo2 *, VkFence); - VkResult (*p_vkQueueSubmit2KHR)(VkQueue, uint32_t, const VkSubmitInfo2 *, VkFence); - VkResult (*p_vkQueueWaitIdle)(VkQueue); - VkResult (*p_vkReleasePerformanceConfigurationINTEL)(VkDevice, VkPerformanceConfigurationINTEL); - void (*p_vkReleaseProfilingLockKHR)(VkDevice); - VkResult (*p_vkReleaseSwapchainImagesEXT)(VkDevice, const VkReleaseSwapchainImagesInfoEXT *); - VkResult (*p_vkResetCommandBuffer)(VkCommandBuffer, VkCommandBufferResetFlags); - VkResult (*p_vkResetCommandPool)(VkDevice, VkCommandPool, VkCommandPoolResetFlags); - VkResult (*p_vkResetDescriptorPool)(VkDevice, VkDescriptorPool, VkDescriptorPoolResetFlags); - VkResult (*p_vkResetEvent)(VkDevice, VkEvent); - VkResult (*p_vkResetFences)(VkDevice, uint32_t, const VkFence *); - void (*p_vkResetQueryPool)(VkDevice, VkQueryPool, uint32_t, uint32_t); - void (*p_vkResetQueryPoolEXT)(VkDevice, VkQueryPool, uint32_t, uint32_t); - VkResult (*p_vkSetDebugUtilsObjectNameEXT)(VkDevice, const VkDebugUtilsObjectNameInfoEXT *); - VkResult (*p_vkSetDebugUtilsObjectTagEXT)(VkDevice, const VkDebugUtilsObjectTagInfoEXT *); - void (*p_vkSetDeviceMemoryPriorityEXT)(VkDevice, VkDeviceMemory, float); - VkResult (*p_vkSetEvent)(VkDevice, VkEvent); - void (*p_vkSetHdrMetadataEXT)(VkDevice, uint32_t, const VkSwapchainKHR *, const VkHdrMetadataEXT *); - void (*p_vkSetLatencyMarkerNV)(VkDevice, VkSwapchainKHR, const VkSetLatencyMarkerInfoNV *); - VkResult (*p_vkSetLatencySleepModeNV)(VkDevice, VkSwapchainKHR, const VkLatencySleepModeInfoNV *); - VkResult (*p_vkSetPrivateData)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t); - VkResult (*p_vkSetPrivateDataEXT)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t); - VkResult (*p_vkSignalSemaphore)(VkDevice, const VkSemaphoreSignalInfo *); - VkResult (*p_vkSignalSemaphoreKHR)(VkDevice, const VkSemaphoreSignalInfo *); - VkResult (*p_vkTransitionImageLayoutEXT)(VkDevice, uint32_t, const VkHostImageLayoutTransitionInfoEXT *); - void (*p_vkTrimCommandPool)(VkDevice, VkCommandPool, VkCommandPoolTrimFlags); - void (*p_vkTrimCommandPoolKHR)(VkDevice, VkCommandPool, VkCommandPoolTrimFlags); - void (*p_vkUninitializePerformanceApiINTEL)(VkDevice); - void (*p_vkUnmapMemory)(VkDevice, VkDeviceMemory); - VkResult (*p_vkUnmapMemory2KHR)(VkDevice, const VkMemoryUnmapInfoKHR *); - void (*p_vkUpdateDescriptorSetWithTemplate)(VkDevice, VkDescriptorSet, VkDescriptorUpdateTemplate, const void *); - void (*p_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice, VkDescriptorSet, VkDescriptorUpdateTemplate, const void *); - void (*p_vkUpdateDescriptorSets)(VkDevice, uint32_t, const VkWriteDescriptorSet *, uint32_t, const VkCopyDescriptorSet *); - VkResult (*p_vkWaitForFences)(VkDevice, uint32_t, const VkFence *, VkBool32, uint64_t); - VkResult (*p_vkWaitForPresentKHR)(VkDevice, VkSwapchainKHR, uint64_t, uint64_t); - VkResult (*p_vkWaitSemaphores)(VkDevice, const VkSemaphoreWaitInfo *, uint64_t); - VkResult (*p_vkWaitSemaphoresKHR)(VkDevice, const VkSemaphoreWaitInfo *, uint64_t); - VkResult (*p_vkWriteAccelerationStructuresPropertiesKHR)(VkDevice, uint32_t, const VkAccelerationStructureKHR *, VkQueryType, size_t, void *, size_t); - VkResult (*p_vkWriteMicromapsPropertiesEXT)(VkDevice, uint32_t, const VkMicromapEXT *, VkQueryType, size_t, void *, size_t); -}; - -/* For use by vkInstance and children */ -struct vulkan_instance_funcs -{ - VkResult (*p_vkCreateDebugReportCallbackEXT)(VkInstance, const VkDebugReportCallbackCreateInfoEXT *, const VkAllocationCallbacks *, VkDebugReportCallbackEXT *); - VkResult (*p_vkCreateDebugUtilsMessengerEXT)(VkInstance, const VkDebugUtilsMessengerCreateInfoEXT *, const VkAllocationCallbacks *, VkDebugUtilsMessengerEXT *); - VkResult (*p_vkCreateWin32SurfaceKHR)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); - void (*p_vkDebugReportMessageEXT)(VkInstance, VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *); - void (*p_vkDestroyDebugReportCallbackEXT)(VkInstance, VkDebugReportCallbackEXT, const VkAllocationCallbacks *); - void (*p_vkDestroyDebugUtilsMessengerEXT)(VkInstance, VkDebugUtilsMessengerEXT, const VkAllocationCallbacks *); - void (*p_vkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); - VkResult (*p_vkEnumeratePhysicalDeviceGroups)(VkInstance, uint32_t *, VkPhysicalDeviceGroupProperties *); - VkResult (*p_vkEnumeratePhysicalDeviceGroupsKHR)(VkInstance, uint32_t *, VkPhysicalDeviceGroupProperties *); - VkResult (*p_vkEnumeratePhysicalDevices)(VkInstance, uint32_t *, VkPhysicalDevice *); - void (*p_vkSubmitDebugUtilsMessageEXT)(VkInstance, VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *); - VkResult (*p_vkCreateDevice)(VkPhysicalDevice, const VkDeviceCreateInfo *, const VkAllocationCallbacks *, VkDevice *); - VkResult (*p_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice, const char *, uint32_t *, VkExtensionProperties *); - VkResult (*p_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice, uint32_t *, VkLayerProperties *); - VkResult (*p_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR)(VkPhysicalDevice, uint32_t, uint32_t *, VkPerformanceCounterKHR *, VkPerformanceCounterDescriptionKHR *); - VkResult (*p_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)(VkPhysicalDevice, uint32_t *, VkTimeDomainEXT *); - VkResult (*p_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR)(VkPhysicalDevice, uint32_t *, VkCooperativeMatrixPropertiesKHR *); - VkResult (*p_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)(VkPhysicalDevice, uint32_t *, VkCooperativeMatrixPropertiesNV *); - void (*p_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice, VkPhysicalDeviceFeatures *); - void (*p_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *); - void (*p_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *); - void (*p_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice, VkFormat, VkFormatProperties *); - void (*p_vkGetPhysicalDeviceFormatProperties2)(VkPhysicalDevice, VkFormat, VkFormatProperties2 *); - void (*p_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice, VkFormat, VkFormatProperties2 *); - VkResult (*p_vkGetPhysicalDeviceFragmentShadingRatesKHR)(VkPhysicalDevice, uint32_t *, VkPhysicalDeviceFragmentShadingRateKHR *); - VkResult (*p_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice, VkFormat, VkImageType, VkImageTiling, VkImageUsageFlags, VkImageCreateFlags, VkImageFormatProperties *); - VkResult (*p_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceImageFormatInfo2 *, VkImageFormatProperties2 *); - VkResult (*p_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice, const VkPhysicalDeviceImageFormatInfo2 *, VkImageFormatProperties2 *); - void (*p_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties *); - void (*p_vkGetPhysicalDeviceMemoryProperties2)(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties2 *); - void (*p_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties2 *); - void (*p_vkGetPhysicalDeviceMultisamplePropertiesEXT)(VkPhysicalDevice, VkSampleCountFlagBits, VkMultisamplePropertiesEXT *); - VkResult (*p_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)(VkPhysicalDevice, const VkOpticalFlowImageFormatInfoNV *, uint32_t *, VkOpticalFlowImageFormatPropertiesNV *); - VkResult (*p_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); - void (*p_vkGetPhysicalDeviceProperties)(VkPhysicalDevice, VkPhysicalDeviceProperties *); - void (*p_vkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); - void (*p_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); - void (*p_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR)(VkPhysicalDevice, const VkQueryPoolPerformanceCreateInfoKHR *, uint32_t *); - void (*p_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice, uint32_t *, VkQueueFamilyProperties *); - void (*p_vkGetPhysicalDeviceQueueFamilyProperties2)(VkPhysicalDevice, uint32_t *, VkQueueFamilyProperties2 *); - void (*p_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice, uint32_t *, VkQueueFamilyProperties2 *); - void (*p_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice, VkFormat, VkImageType, VkSampleCountFlagBits, VkImageUsageFlags, VkImageTiling, uint32_t *, VkSparseImageFormatProperties *); - void (*p_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); - void (*p_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); - VkResult (*p_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)(VkPhysicalDevice, uint32_t *, VkFramebufferMixedSamplesCombinationNV *); - VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); - VkResult (*p_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); - VkResult (*p_vkGetPhysicalDeviceToolProperties)(VkPhysicalDevice, uint32_t *, VkPhysicalDeviceToolProperties *); - VkResult (*p_vkGetPhysicalDeviceToolPropertiesEXT)(VkPhysicalDevice, uint32_t *, VkPhysicalDeviceToolProperties *); - VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); -}; - -#define ALL_VK_DEVICE_FUNCS() \ - USE_VK_FUNC(vkAcquireNextImage2KHR) \ - USE_VK_FUNC(vkAcquireNextImageKHR) \ - USE_VK_FUNC(vkAcquirePerformanceConfigurationINTEL) \ - USE_VK_FUNC(vkAcquireProfilingLockKHR) \ - USE_VK_FUNC(vkAllocateCommandBuffers) \ - USE_VK_FUNC(vkAllocateDescriptorSets) \ - USE_VK_FUNC(vkAllocateMemory) \ - USE_VK_FUNC(vkBeginCommandBuffer) \ - USE_VK_FUNC(vkBindAccelerationStructureMemoryNV) \ - USE_VK_FUNC(vkBindBufferMemory) \ - USE_VK_FUNC(vkBindBufferMemory2) \ - USE_VK_FUNC(vkBindBufferMemory2KHR) \ - USE_VK_FUNC(vkBindImageMemory) \ - USE_VK_FUNC(vkBindImageMemory2) \ - USE_VK_FUNC(vkBindImageMemory2KHR) \ - USE_VK_FUNC(vkBindOpticalFlowSessionImageNV) \ - USE_VK_FUNC(vkBuildAccelerationStructuresKHR) \ - USE_VK_FUNC(vkBuildMicromapsEXT) \ - USE_VK_FUNC(vkCmdBeginConditionalRenderingEXT) \ - USE_VK_FUNC(vkCmdBeginDebugUtilsLabelEXT) \ - USE_VK_FUNC(vkCmdBeginQuery) \ - USE_VK_FUNC(vkCmdBeginQueryIndexedEXT) \ - USE_VK_FUNC(vkCmdBeginRenderPass) \ - USE_VK_FUNC(vkCmdBeginRenderPass2) \ - USE_VK_FUNC(vkCmdBeginRenderPass2KHR) \ - USE_VK_FUNC(vkCmdBeginRendering) \ - USE_VK_FUNC(vkCmdBeginRenderingKHR) \ - USE_VK_FUNC(vkCmdBeginTransformFeedbackEXT) \ - USE_VK_FUNC(vkCmdBindDescriptorBufferEmbeddedSamplersEXT) \ - USE_VK_FUNC(vkCmdBindDescriptorBuffersEXT) \ - USE_VK_FUNC(vkCmdBindDescriptorSets) \ - USE_VK_FUNC(vkCmdBindIndexBuffer) \ - USE_VK_FUNC(vkCmdBindIndexBuffer2KHR) \ - USE_VK_FUNC(vkCmdBindInvocationMaskHUAWEI) \ - USE_VK_FUNC(vkCmdBindPipeline) \ - USE_VK_FUNC(vkCmdBindPipelineShaderGroupNV) \ - USE_VK_FUNC(vkCmdBindShadersEXT) \ - USE_VK_FUNC(vkCmdBindShadingRateImageNV) \ - USE_VK_FUNC(vkCmdBindTransformFeedbackBuffersEXT) \ - USE_VK_FUNC(vkCmdBindVertexBuffers) \ - USE_VK_FUNC(vkCmdBindVertexBuffers2) \ - USE_VK_FUNC(vkCmdBindVertexBuffers2EXT) \ - USE_VK_FUNC(vkCmdBlitImage) \ - USE_VK_FUNC(vkCmdBlitImage2) \ - USE_VK_FUNC(vkCmdBlitImage2KHR) \ - USE_VK_FUNC(vkCmdBuildAccelerationStructureNV) \ - USE_VK_FUNC(vkCmdBuildAccelerationStructuresIndirectKHR) \ - USE_VK_FUNC(vkCmdBuildAccelerationStructuresKHR) \ - USE_VK_FUNC(vkCmdBuildMicromapsEXT) \ - USE_VK_FUNC(vkCmdClearAttachments) \ - USE_VK_FUNC(vkCmdClearColorImage) \ - USE_VK_FUNC(vkCmdClearDepthStencilImage) \ - USE_VK_FUNC(vkCmdCopyAccelerationStructureKHR) \ - USE_VK_FUNC(vkCmdCopyAccelerationStructureNV) \ - USE_VK_FUNC(vkCmdCopyAccelerationStructureToMemoryKHR) \ - USE_VK_FUNC(vkCmdCopyBuffer) \ - USE_VK_FUNC(vkCmdCopyBuffer2) \ - USE_VK_FUNC(vkCmdCopyBuffer2KHR) \ - USE_VK_FUNC(vkCmdCopyBufferToImage) \ - USE_VK_FUNC(vkCmdCopyBufferToImage2) \ - USE_VK_FUNC(vkCmdCopyBufferToImage2KHR) \ - USE_VK_FUNC(vkCmdCopyImage) \ - USE_VK_FUNC(vkCmdCopyImage2) \ - USE_VK_FUNC(vkCmdCopyImage2KHR) \ - USE_VK_FUNC(vkCmdCopyImageToBuffer) \ - USE_VK_FUNC(vkCmdCopyImageToBuffer2) \ - USE_VK_FUNC(vkCmdCopyImageToBuffer2KHR) \ - USE_VK_FUNC(vkCmdCopyMemoryIndirectNV) \ - USE_VK_FUNC(vkCmdCopyMemoryToAccelerationStructureKHR) \ - USE_VK_FUNC(vkCmdCopyMemoryToImageIndirectNV) \ - USE_VK_FUNC(vkCmdCopyMemoryToMicromapEXT) \ - USE_VK_FUNC(vkCmdCopyMicromapEXT) \ - USE_VK_FUNC(vkCmdCopyMicromapToMemoryEXT) \ - USE_VK_FUNC(vkCmdCopyQueryPoolResults) \ - USE_VK_FUNC(vkCmdCuLaunchKernelNVX) \ - USE_VK_FUNC(vkCmdCudaLaunchKernelNV) \ - USE_VK_FUNC(vkCmdDebugMarkerBeginEXT) \ - USE_VK_FUNC(vkCmdDebugMarkerEndEXT) \ - USE_VK_FUNC(vkCmdDebugMarkerInsertEXT) \ - USE_VK_FUNC(vkCmdDecompressMemoryIndirectCountNV) \ - USE_VK_FUNC(vkCmdDecompressMemoryNV) \ - USE_VK_FUNC(vkCmdDispatch) \ - USE_VK_FUNC(vkCmdDispatchBase) \ - USE_VK_FUNC(vkCmdDispatchBaseKHR) \ - USE_VK_FUNC(vkCmdDispatchIndirect) \ - USE_VK_FUNC(vkCmdDraw) \ - USE_VK_FUNC(vkCmdDrawClusterHUAWEI) \ - USE_VK_FUNC(vkCmdDrawClusterIndirectHUAWEI) \ - USE_VK_FUNC(vkCmdDrawIndexed) \ - USE_VK_FUNC(vkCmdDrawIndexedIndirect) \ - USE_VK_FUNC(vkCmdDrawIndexedIndirectCount) \ - USE_VK_FUNC(vkCmdDrawIndexedIndirectCountAMD) \ - USE_VK_FUNC(vkCmdDrawIndexedIndirectCountKHR) \ - USE_VK_FUNC(vkCmdDrawIndirect) \ - USE_VK_FUNC(vkCmdDrawIndirectByteCountEXT) \ - USE_VK_FUNC(vkCmdDrawIndirectCount) \ - USE_VK_FUNC(vkCmdDrawIndirectCountAMD) \ - USE_VK_FUNC(vkCmdDrawIndirectCountKHR) \ - USE_VK_FUNC(vkCmdDrawMeshTasksEXT) \ - USE_VK_FUNC(vkCmdDrawMeshTasksIndirectCountEXT) \ - USE_VK_FUNC(vkCmdDrawMeshTasksIndirectCountNV) \ - USE_VK_FUNC(vkCmdDrawMeshTasksIndirectEXT) \ - USE_VK_FUNC(vkCmdDrawMeshTasksIndirectNV) \ - USE_VK_FUNC(vkCmdDrawMeshTasksNV) \ - USE_VK_FUNC(vkCmdDrawMultiEXT) \ - USE_VK_FUNC(vkCmdDrawMultiIndexedEXT) \ - USE_VK_FUNC(vkCmdEndConditionalRenderingEXT) \ - USE_VK_FUNC(vkCmdEndDebugUtilsLabelEXT) \ - USE_VK_FUNC(vkCmdEndQuery) \ - USE_VK_FUNC(vkCmdEndQueryIndexedEXT) \ - USE_VK_FUNC(vkCmdEndRenderPass) \ - USE_VK_FUNC(vkCmdEndRenderPass2) \ - USE_VK_FUNC(vkCmdEndRenderPass2KHR) \ - USE_VK_FUNC(vkCmdEndRendering) \ - USE_VK_FUNC(vkCmdEndRenderingKHR) \ - USE_VK_FUNC(vkCmdEndTransformFeedbackEXT) \ - USE_VK_FUNC(vkCmdExecuteCommands) \ - USE_VK_FUNC(vkCmdExecuteGeneratedCommandsNV) \ - USE_VK_FUNC(vkCmdFillBuffer) \ - USE_VK_FUNC(vkCmdInsertDebugUtilsLabelEXT) \ - USE_VK_FUNC(vkCmdNextSubpass) \ - USE_VK_FUNC(vkCmdNextSubpass2) \ - USE_VK_FUNC(vkCmdNextSubpass2KHR) \ - USE_VK_FUNC(vkCmdOpticalFlowExecuteNV) \ - USE_VK_FUNC(vkCmdPipelineBarrier) \ - USE_VK_FUNC(vkCmdPipelineBarrier2) \ - USE_VK_FUNC(vkCmdPipelineBarrier2KHR) \ - USE_VK_FUNC(vkCmdPreprocessGeneratedCommandsNV) \ - USE_VK_FUNC(vkCmdPushConstants) \ - USE_VK_FUNC(vkCmdPushDescriptorSetKHR) \ - USE_VK_FUNC(vkCmdPushDescriptorSetWithTemplateKHR) \ - USE_VK_FUNC(vkCmdResetEvent) \ - USE_VK_FUNC(vkCmdResetEvent2) \ - USE_VK_FUNC(vkCmdResetEvent2KHR) \ - USE_VK_FUNC(vkCmdResetQueryPool) \ - USE_VK_FUNC(vkCmdResolveImage) \ - USE_VK_FUNC(vkCmdResolveImage2) \ - USE_VK_FUNC(vkCmdResolveImage2KHR) \ - USE_VK_FUNC(vkCmdSetAlphaToCoverageEnableEXT) \ - USE_VK_FUNC(vkCmdSetAlphaToOneEnableEXT) \ - USE_VK_FUNC(vkCmdSetAttachmentFeedbackLoopEnableEXT) \ - USE_VK_FUNC(vkCmdSetBlendConstants) \ - USE_VK_FUNC(vkCmdSetCheckpointNV) \ - USE_VK_FUNC(vkCmdSetCoarseSampleOrderNV) \ - USE_VK_FUNC(vkCmdSetColorBlendAdvancedEXT) \ - USE_VK_FUNC(vkCmdSetColorBlendEnableEXT) \ - USE_VK_FUNC(vkCmdSetColorBlendEquationEXT) \ - USE_VK_FUNC(vkCmdSetColorWriteEnableEXT) \ - USE_VK_FUNC(vkCmdSetColorWriteMaskEXT) \ - USE_VK_FUNC(vkCmdSetConservativeRasterizationModeEXT) \ - USE_VK_FUNC(vkCmdSetCoverageModulationModeNV) \ - USE_VK_FUNC(vkCmdSetCoverageModulationTableEnableNV) \ - USE_VK_FUNC(vkCmdSetCoverageModulationTableNV) \ - USE_VK_FUNC(vkCmdSetCoverageReductionModeNV) \ - USE_VK_FUNC(vkCmdSetCoverageToColorEnableNV) \ - USE_VK_FUNC(vkCmdSetCoverageToColorLocationNV) \ - USE_VK_FUNC(vkCmdSetCullMode) \ - USE_VK_FUNC(vkCmdSetCullModeEXT) \ - USE_VK_FUNC(vkCmdSetDepthBias) \ - USE_VK_FUNC(vkCmdSetDepthBias2EXT) \ - USE_VK_FUNC(vkCmdSetDepthBiasEnable) \ - USE_VK_FUNC(vkCmdSetDepthBiasEnableEXT) \ - USE_VK_FUNC(vkCmdSetDepthBounds) \ - USE_VK_FUNC(vkCmdSetDepthBoundsTestEnable) \ - USE_VK_FUNC(vkCmdSetDepthBoundsTestEnableEXT) \ - USE_VK_FUNC(vkCmdSetDepthClampEnableEXT) \ - USE_VK_FUNC(vkCmdSetDepthClipEnableEXT) \ - USE_VK_FUNC(vkCmdSetDepthClipNegativeOneToOneEXT) \ - USE_VK_FUNC(vkCmdSetDepthCompareOp) \ - USE_VK_FUNC(vkCmdSetDepthCompareOpEXT) \ - USE_VK_FUNC(vkCmdSetDepthTestEnable) \ - USE_VK_FUNC(vkCmdSetDepthTestEnableEXT) \ - USE_VK_FUNC(vkCmdSetDepthWriteEnable) \ - USE_VK_FUNC(vkCmdSetDepthWriteEnableEXT) \ - USE_VK_FUNC(vkCmdSetDescriptorBufferOffsetsEXT) \ - USE_VK_FUNC(vkCmdSetDeviceMask) \ - USE_VK_FUNC(vkCmdSetDeviceMaskKHR) \ - USE_VK_FUNC(vkCmdSetDiscardRectangleEXT) \ - USE_VK_FUNC(vkCmdSetDiscardRectangleEnableEXT) \ - USE_VK_FUNC(vkCmdSetDiscardRectangleModeEXT) \ - USE_VK_FUNC(vkCmdSetEvent) \ - USE_VK_FUNC(vkCmdSetEvent2) \ - USE_VK_FUNC(vkCmdSetEvent2KHR) \ - USE_VK_FUNC(vkCmdSetExclusiveScissorEnableNV) \ - USE_VK_FUNC(vkCmdSetExclusiveScissorNV) \ - USE_VK_FUNC(vkCmdSetExtraPrimitiveOverestimationSizeEXT) \ - USE_VK_FUNC(vkCmdSetFragmentShadingRateEnumNV) \ - USE_VK_FUNC(vkCmdSetFragmentShadingRateKHR) \ - USE_VK_FUNC(vkCmdSetFrontFace) \ - USE_VK_FUNC(vkCmdSetFrontFaceEXT) \ - USE_VK_FUNC(vkCmdSetLineRasterizationModeEXT) \ - USE_VK_FUNC(vkCmdSetLineStippleEXT) \ - USE_VK_FUNC(vkCmdSetLineStippleEnableEXT) \ - USE_VK_FUNC(vkCmdSetLineWidth) \ - USE_VK_FUNC(vkCmdSetLogicOpEXT) \ - USE_VK_FUNC(vkCmdSetLogicOpEnableEXT) \ - USE_VK_FUNC(vkCmdSetPatchControlPointsEXT) \ - USE_VK_FUNC(vkCmdSetPerformanceMarkerINTEL) \ - USE_VK_FUNC(vkCmdSetPerformanceOverrideINTEL) \ - USE_VK_FUNC(vkCmdSetPerformanceStreamMarkerINTEL) \ - USE_VK_FUNC(vkCmdSetPolygonModeEXT) \ - USE_VK_FUNC(vkCmdSetPrimitiveRestartEnable) \ - USE_VK_FUNC(vkCmdSetPrimitiveRestartEnableEXT) \ - USE_VK_FUNC(vkCmdSetPrimitiveTopology) \ - USE_VK_FUNC(vkCmdSetPrimitiveTopologyEXT) \ - USE_VK_FUNC(vkCmdSetProvokingVertexModeEXT) \ - USE_VK_FUNC(vkCmdSetRasterizationSamplesEXT) \ - USE_VK_FUNC(vkCmdSetRasterizationStreamEXT) \ - USE_VK_FUNC(vkCmdSetRasterizerDiscardEnable) \ - USE_VK_FUNC(vkCmdSetRasterizerDiscardEnableEXT) \ - USE_VK_FUNC(vkCmdSetRayTracingPipelineStackSizeKHR) \ - USE_VK_FUNC(vkCmdSetRepresentativeFragmentTestEnableNV) \ - USE_VK_FUNC(vkCmdSetSampleLocationsEXT) \ - USE_VK_FUNC(vkCmdSetSampleLocationsEnableEXT) \ - USE_VK_FUNC(vkCmdSetSampleMaskEXT) \ - USE_VK_FUNC(vkCmdSetScissor) \ - USE_VK_FUNC(vkCmdSetScissorWithCount) \ - USE_VK_FUNC(vkCmdSetScissorWithCountEXT) \ - USE_VK_FUNC(vkCmdSetShadingRateImageEnableNV) \ - USE_VK_FUNC(vkCmdSetStencilCompareMask) \ - USE_VK_FUNC(vkCmdSetStencilOp) \ - USE_VK_FUNC(vkCmdSetStencilOpEXT) \ - USE_VK_FUNC(vkCmdSetStencilReference) \ - USE_VK_FUNC(vkCmdSetStencilTestEnable) \ - USE_VK_FUNC(vkCmdSetStencilTestEnableEXT) \ - USE_VK_FUNC(vkCmdSetStencilWriteMask) \ - USE_VK_FUNC(vkCmdSetTessellationDomainOriginEXT) \ - USE_VK_FUNC(vkCmdSetVertexInputEXT) \ - USE_VK_FUNC(vkCmdSetViewport) \ - USE_VK_FUNC(vkCmdSetViewportShadingRatePaletteNV) \ - USE_VK_FUNC(vkCmdSetViewportSwizzleNV) \ - USE_VK_FUNC(vkCmdSetViewportWScalingEnableNV) \ - USE_VK_FUNC(vkCmdSetViewportWScalingNV) \ - USE_VK_FUNC(vkCmdSetViewportWithCount) \ - USE_VK_FUNC(vkCmdSetViewportWithCountEXT) \ - USE_VK_FUNC(vkCmdSubpassShadingHUAWEI) \ - USE_VK_FUNC(vkCmdTraceRaysIndirect2KHR) \ - USE_VK_FUNC(vkCmdTraceRaysIndirectKHR) \ - USE_VK_FUNC(vkCmdTraceRaysKHR) \ - USE_VK_FUNC(vkCmdTraceRaysNV) \ - USE_VK_FUNC(vkCmdUpdateBuffer) \ - USE_VK_FUNC(vkCmdUpdatePipelineIndirectBufferNV) \ - USE_VK_FUNC(vkCmdWaitEvents) \ - USE_VK_FUNC(vkCmdWaitEvents2) \ - USE_VK_FUNC(vkCmdWaitEvents2KHR) \ - USE_VK_FUNC(vkCmdWriteAccelerationStructuresPropertiesKHR) \ - USE_VK_FUNC(vkCmdWriteAccelerationStructuresPropertiesNV) \ - USE_VK_FUNC(vkCmdWriteBufferMarker2AMD) \ - USE_VK_FUNC(vkCmdWriteBufferMarkerAMD) \ - USE_VK_FUNC(vkCmdWriteMicromapsPropertiesEXT) \ - USE_VK_FUNC(vkCmdWriteTimestamp) \ - USE_VK_FUNC(vkCmdWriteTimestamp2) \ - USE_VK_FUNC(vkCmdWriteTimestamp2KHR) \ - USE_VK_FUNC(vkCompileDeferredNV) \ - USE_VK_FUNC(vkCopyAccelerationStructureKHR) \ - USE_VK_FUNC(vkCopyAccelerationStructureToMemoryKHR) \ - USE_VK_FUNC(vkCopyImageToImageEXT) \ - USE_VK_FUNC(vkCopyImageToMemoryEXT) \ - USE_VK_FUNC(vkCopyMemoryToAccelerationStructureKHR) \ - USE_VK_FUNC(vkCopyMemoryToImageEXT) \ - USE_VK_FUNC(vkCopyMemoryToMicromapEXT) \ - USE_VK_FUNC(vkCopyMicromapEXT) \ - USE_VK_FUNC(vkCopyMicromapToMemoryEXT) \ - USE_VK_FUNC(vkCreateAccelerationStructureKHR) \ - USE_VK_FUNC(vkCreateAccelerationStructureNV) \ - USE_VK_FUNC(vkCreateBuffer) \ - USE_VK_FUNC(vkCreateBufferView) \ - USE_VK_FUNC(vkCreateCommandPool) \ - USE_VK_FUNC(vkCreateComputePipelines) \ - USE_VK_FUNC(vkCreateCuFunctionNVX) \ - USE_VK_FUNC(vkCreateCuModuleNVX) \ - USE_VK_FUNC(vkCreateCudaFunctionNV) \ - USE_VK_FUNC(vkCreateCudaModuleNV) \ - USE_VK_FUNC(vkCreateDeferredOperationKHR) \ - USE_VK_FUNC(vkCreateDescriptorPool) \ - USE_VK_FUNC(vkCreateDescriptorSetLayout) \ - USE_VK_FUNC(vkCreateDescriptorUpdateTemplate) \ - USE_VK_FUNC(vkCreateDescriptorUpdateTemplateKHR) \ - USE_VK_FUNC(vkCreateEvent) \ - USE_VK_FUNC(vkCreateFence) \ - USE_VK_FUNC(vkCreateFramebuffer) \ - USE_VK_FUNC(vkCreateGraphicsPipelines) \ - USE_VK_FUNC(vkCreateImage) \ - USE_VK_FUNC(vkCreateImageView) \ - USE_VK_FUNC(vkCreateIndirectCommandsLayoutNV) \ - USE_VK_FUNC(vkCreateMicromapEXT) \ - USE_VK_FUNC(vkCreateOpticalFlowSessionNV) \ - USE_VK_FUNC(vkCreatePipelineCache) \ - USE_VK_FUNC(vkCreatePipelineLayout) \ - USE_VK_FUNC(vkCreatePrivateDataSlot) \ - USE_VK_FUNC(vkCreatePrivateDataSlotEXT) \ - USE_VK_FUNC(vkCreateQueryPool) \ - USE_VK_FUNC(vkCreateRayTracingPipelinesKHR) \ - USE_VK_FUNC(vkCreateRayTracingPipelinesNV) \ - USE_VK_FUNC(vkCreateRenderPass) \ - USE_VK_FUNC(vkCreateRenderPass2) \ - USE_VK_FUNC(vkCreateRenderPass2KHR) \ - USE_VK_FUNC(vkCreateSampler) \ - USE_VK_FUNC(vkCreateSamplerYcbcrConversion) \ - USE_VK_FUNC(vkCreateSamplerYcbcrConversionKHR) \ - USE_VK_FUNC(vkCreateSemaphore) \ - USE_VK_FUNC(vkCreateShaderModule) \ - USE_VK_FUNC(vkCreateShadersEXT) \ - USE_VK_FUNC(vkCreateSwapchainKHR) \ - USE_VK_FUNC(vkCreateValidationCacheEXT) \ - USE_VK_FUNC(vkDebugMarkerSetObjectNameEXT) \ - USE_VK_FUNC(vkDebugMarkerSetObjectTagEXT) \ - USE_VK_FUNC(vkDeferredOperationJoinKHR) \ - USE_VK_FUNC(vkDestroyAccelerationStructureKHR) \ - USE_VK_FUNC(vkDestroyAccelerationStructureNV) \ - USE_VK_FUNC(vkDestroyBuffer) \ - USE_VK_FUNC(vkDestroyBufferView) \ - USE_VK_FUNC(vkDestroyCommandPool) \ - USE_VK_FUNC(vkDestroyCuFunctionNVX) \ - USE_VK_FUNC(vkDestroyCuModuleNVX) \ - USE_VK_FUNC(vkDestroyCudaFunctionNV) \ - USE_VK_FUNC(vkDestroyCudaModuleNV) \ - USE_VK_FUNC(vkDestroyDeferredOperationKHR) \ - USE_VK_FUNC(vkDestroyDescriptorPool) \ - USE_VK_FUNC(vkDestroyDescriptorSetLayout) \ - USE_VK_FUNC(vkDestroyDescriptorUpdateTemplate) \ - USE_VK_FUNC(vkDestroyDescriptorUpdateTemplateKHR) \ - USE_VK_FUNC(vkDestroyDevice) \ - USE_VK_FUNC(vkDestroyEvent) \ - USE_VK_FUNC(vkDestroyFence) \ - USE_VK_FUNC(vkDestroyFramebuffer) \ - USE_VK_FUNC(vkDestroyImage) \ - USE_VK_FUNC(vkDestroyImageView) \ - USE_VK_FUNC(vkDestroyIndirectCommandsLayoutNV) \ - USE_VK_FUNC(vkDestroyMicromapEXT) \ - USE_VK_FUNC(vkDestroyOpticalFlowSessionNV) \ - USE_VK_FUNC(vkDestroyPipeline) \ - USE_VK_FUNC(vkDestroyPipelineCache) \ - USE_VK_FUNC(vkDestroyPipelineLayout) \ - USE_VK_FUNC(vkDestroyPrivateDataSlot) \ - USE_VK_FUNC(vkDestroyPrivateDataSlotEXT) \ - USE_VK_FUNC(vkDestroyQueryPool) \ - USE_VK_FUNC(vkDestroyRenderPass) \ - USE_VK_FUNC(vkDestroySampler) \ - USE_VK_FUNC(vkDestroySamplerYcbcrConversion) \ - USE_VK_FUNC(vkDestroySamplerYcbcrConversionKHR) \ - USE_VK_FUNC(vkDestroySemaphore) \ - USE_VK_FUNC(vkDestroyShaderEXT) \ - USE_VK_FUNC(vkDestroyShaderModule) \ - USE_VK_FUNC(vkDestroySwapchainKHR) \ - USE_VK_FUNC(vkDestroyValidationCacheEXT) \ - USE_VK_FUNC(vkDeviceWaitIdle) \ - USE_VK_FUNC(vkEndCommandBuffer) \ - USE_VK_FUNC(vkFlushMappedMemoryRanges) \ - USE_VK_FUNC(vkFreeCommandBuffers) \ - USE_VK_FUNC(vkFreeDescriptorSets) \ - USE_VK_FUNC(vkFreeMemory) \ - USE_VK_FUNC(vkGetAccelerationStructureBuildSizesKHR) \ - USE_VK_FUNC(vkGetAccelerationStructureDeviceAddressKHR) \ - USE_VK_FUNC(vkGetAccelerationStructureHandleNV) \ - USE_VK_FUNC(vkGetAccelerationStructureMemoryRequirementsNV) \ - USE_VK_FUNC(vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT) \ - USE_VK_FUNC(vkGetBufferDeviceAddress) \ - USE_VK_FUNC(vkGetBufferDeviceAddressEXT) \ - USE_VK_FUNC(vkGetBufferDeviceAddressKHR) \ - USE_VK_FUNC(vkGetBufferMemoryRequirements) \ - USE_VK_FUNC(vkGetBufferMemoryRequirements2) \ - USE_VK_FUNC(vkGetBufferMemoryRequirements2KHR) \ - USE_VK_FUNC(vkGetBufferOpaqueCaptureAddress) \ - USE_VK_FUNC(vkGetBufferOpaqueCaptureAddressKHR) \ - USE_VK_FUNC(vkGetBufferOpaqueCaptureDescriptorDataEXT) \ - USE_VK_FUNC(vkGetCalibratedTimestampsEXT) \ - USE_VK_FUNC(vkGetCudaModuleCacheNV) \ - USE_VK_FUNC(vkGetDeferredOperationMaxConcurrencyKHR) \ - USE_VK_FUNC(vkGetDeferredOperationResultKHR) \ - USE_VK_FUNC(vkGetDescriptorEXT) \ - USE_VK_FUNC(vkGetDescriptorSetHostMappingVALVE) \ - USE_VK_FUNC(vkGetDescriptorSetLayoutBindingOffsetEXT) \ - USE_VK_FUNC(vkGetDescriptorSetLayoutHostMappingInfoVALVE) \ - USE_VK_FUNC(vkGetDescriptorSetLayoutSizeEXT) \ - USE_VK_FUNC(vkGetDescriptorSetLayoutSupport) \ - USE_VK_FUNC(vkGetDescriptorSetLayoutSupportKHR) \ - USE_VK_FUNC(vkGetDeviceAccelerationStructureCompatibilityKHR) \ - USE_VK_FUNC(vkGetDeviceBufferMemoryRequirements) \ - USE_VK_FUNC(vkGetDeviceBufferMemoryRequirementsKHR) \ - USE_VK_FUNC(vkGetDeviceFaultInfoEXT) \ - USE_VK_FUNC(vkGetDeviceGroupPeerMemoryFeatures) \ - USE_VK_FUNC(vkGetDeviceGroupPeerMemoryFeaturesKHR) \ - USE_VK_FUNC(vkGetDeviceGroupPresentCapabilitiesKHR) \ - USE_VK_FUNC(vkGetDeviceGroupSurfacePresentModesKHR) \ - USE_VK_FUNC(vkGetDeviceImageMemoryRequirements) \ - USE_VK_FUNC(vkGetDeviceImageMemoryRequirementsKHR) \ - USE_VK_FUNC(vkGetDeviceImageSparseMemoryRequirements) \ - USE_VK_FUNC(vkGetDeviceImageSparseMemoryRequirementsKHR) \ - USE_VK_FUNC(vkGetDeviceImageSubresourceLayoutKHR) \ - USE_VK_FUNC(vkGetDeviceMemoryCommitment) \ - USE_VK_FUNC(vkGetDeviceMemoryOpaqueCaptureAddress) \ - USE_VK_FUNC(vkGetDeviceMemoryOpaqueCaptureAddressKHR) \ - USE_VK_FUNC(vkGetDeviceMicromapCompatibilityEXT) \ - USE_VK_FUNC(vkGetDeviceQueue) \ - USE_VK_FUNC(vkGetDeviceQueue2) \ - USE_VK_FUNC(vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI) \ - USE_VK_FUNC(vkGetDynamicRenderingTilePropertiesQCOM) \ - USE_VK_FUNC(vkGetEventStatus) \ - USE_VK_FUNC(vkGetFenceStatus) \ - USE_VK_FUNC(vkGetFramebufferTilePropertiesQCOM) \ - USE_VK_FUNC(vkGetGeneratedCommandsMemoryRequirementsNV) \ - USE_VK_FUNC(vkGetImageMemoryRequirements) \ - USE_VK_FUNC(vkGetImageMemoryRequirements2) \ - USE_VK_FUNC(vkGetImageMemoryRequirements2KHR) \ - USE_VK_FUNC(vkGetImageOpaqueCaptureDescriptorDataEXT) \ - USE_VK_FUNC(vkGetImageSparseMemoryRequirements) \ - USE_VK_FUNC(vkGetImageSparseMemoryRequirements2) \ - USE_VK_FUNC(vkGetImageSparseMemoryRequirements2KHR) \ - USE_VK_FUNC(vkGetImageSubresourceLayout) \ - USE_VK_FUNC(vkGetImageSubresourceLayout2EXT) \ - USE_VK_FUNC(vkGetImageSubresourceLayout2KHR) \ - USE_VK_FUNC(vkGetImageViewAddressNVX) \ - USE_VK_FUNC(vkGetImageViewHandleNVX) \ - USE_VK_FUNC(vkGetImageViewOpaqueCaptureDescriptorDataEXT) \ - USE_VK_FUNC(vkGetLatencyTimingsNV) \ - USE_VK_FUNC(vkGetMemoryHostPointerPropertiesEXT) \ - USE_VK_FUNC(vkGetMicromapBuildSizesEXT) \ - USE_VK_FUNC(vkGetPerformanceParameterINTEL) \ - USE_VK_FUNC(vkGetPipelineCacheData) \ - USE_VK_FUNC(vkGetPipelineExecutableInternalRepresentationsKHR) \ - USE_VK_FUNC(vkGetPipelineExecutablePropertiesKHR) \ - USE_VK_FUNC(vkGetPipelineExecutableStatisticsKHR) \ - USE_VK_FUNC(vkGetPipelineIndirectDeviceAddressNV) \ - USE_VK_FUNC(vkGetPipelineIndirectMemoryRequirementsNV) \ - USE_VK_FUNC(vkGetPipelinePropertiesEXT) \ - USE_VK_FUNC(vkGetPrivateData) \ - USE_VK_FUNC(vkGetPrivateDataEXT) \ - USE_VK_FUNC(vkGetQueryPoolResults) \ - USE_VK_FUNC(vkGetQueueCheckpointData2NV) \ - USE_VK_FUNC(vkGetQueueCheckpointDataNV) \ - USE_VK_FUNC(vkGetRayTracingCaptureReplayShaderGroupHandlesKHR) \ - USE_VK_FUNC(vkGetRayTracingShaderGroupHandlesKHR) \ - USE_VK_FUNC(vkGetRayTracingShaderGroupHandlesNV) \ - USE_VK_FUNC(vkGetRayTracingShaderGroupStackSizeKHR) \ - USE_VK_FUNC(vkGetRenderAreaGranularity) \ - USE_VK_FUNC(vkGetRenderingAreaGranularityKHR) \ - USE_VK_FUNC(vkGetSamplerOpaqueCaptureDescriptorDataEXT) \ - USE_VK_FUNC(vkGetSemaphoreCounterValue) \ - USE_VK_FUNC(vkGetSemaphoreCounterValueKHR) \ - USE_VK_FUNC(vkGetShaderBinaryDataEXT) \ - USE_VK_FUNC(vkGetShaderInfoAMD) \ - USE_VK_FUNC(vkGetShaderModuleCreateInfoIdentifierEXT) \ - USE_VK_FUNC(vkGetShaderModuleIdentifierEXT) \ - USE_VK_FUNC(vkGetSwapchainImagesKHR) \ - USE_VK_FUNC(vkGetValidationCacheDataEXT) \ - USE_VK_FUNC(vkInitializePerformanceApiINTEL) \ - USE_VK_FUNC(vkInvalidateMappedMemoryRanges) \ - USE_VK_FUNC(vkLatencySleepNV) \ - USE_VK_FUNC(vkMapMemory) \ - USE_VK_FUNC(vkMapMemory2KHR) \ - USE_VK_FUNC(vkMergePipelineCaches) \ - USE_VK_FUNC(vkMergeValidationCachesEXT) \ - USE_VK_FUNC(vkQueueBeginDebugUtilsLabelEXT) \ - USE_VK_FUNC(vkQueueBindSparse) \ - USE_VK_FUNC(vkQueueEndDebugUtilsLabelEXT) \ - USE_VK_FUNC(vkQueueInsertDebugUtilsLabelEXT) \ - USE_VK_FUNC(vkQueueNotifyOutOfBandNV) \ - USE_VK_FUNC(vkQueuePresentKHR) \ - USE_VK_FUNC(vkQueueSetPerformanceConfigurationINTEL) \ - USE_VK_FUNC(vkQueueSubmit) \ - USE_VK_FUNC(vkQueueSubmit2) \ - USE_VK_FUNC(vkQueueSubmit2KHR) \ - USE_VK_FUNC(vkQueueWaitIdle) \ - USE_VK_FUNC(vkReleasePerformanceConfigurationINTEL) \ - USE_VK_FUNC(vkReleaseProfilingLockKHR) \ - USE_VK_FUNC(vkReleaseSwapchainImagesEXT) \ - USE_VK_FUNC(vkResetCommandBuffer) \ - USE_VK_FUNC(vkResetCommandPool) \ - USE_VK_FUNC(vkResetDescriptorPool) \ - USE_VK_FUNC(vkResetEvent) \ - USE_VK_FUNC(vkResetFences) \ - USE_VK_FUNC(vkResetQueryPool) \ - USE_VK_FUNC(vkResetQueryPoolEXT) \ - USE_VK_FUNC(vkSetDebugUtilsObjectNameEXT) \ - USE_VK_FUNC(vkSetDebugUtilsObjectTagEXT) \ - USE_VK_FUNC(vkSetDeviceMemoryPriorityEXT) \ - USE_VK_FUNC(vkSetEvent) \ - USE_VK_FUNC(vkSetHdrMetadataEXT) \ - USE_VK_FUNC(vkSetLatencyMarkerNV) \ - USE_VK_FUNC(vkSetLatencySleepModeNV) \ - USE_VK_FUNC(vkSetPrivateData) \ - USE_VK_FUNC(vkSetPrivateDataEXT) \ - USE_VK_FUNC(vkSignalSemaphore) \ - USE_VK_FUNC(vkSignalSemaphoreKHR) \ - USE_VK_FUNC(vkTransitionImageLayoutEXT) \ - USE_VK_FUNC(vkTrimCommandPool) \ - USE_VK_FUNC(vkTrimCommandPoolKHR) \ - USE_VK_FUNC(vkUninitializePerformanceApiINTEL) \ - USE_VK_FUNC(vkUnmapMemory) \ - USE_VK_FUNC(vkUnmapMemory2KHR) \ - USE_VK_FUNC(vkUpdateDescriptorSetWithTemplate) \ - USE_VK_FUNC(vkUpdateDescriptorSetWithTemplateKHR) \ - USE_VK_FUNC(vkUpdateDescriptorSets) \ - USE_VK_FUNC(vkWaitForFences) \ - USE_VK_FUNC(vkWaitForPresentKHR) \ - USE_VK_FUNC(vkWaitSemaphores) \ - USE_VK_FUNC(vkWaitSemaphoresKHR) \ - USE_VK_FUNC(vkWriteAccelerationStructuresPropertiesKHR) \ - USE_VK_FUNC(vkWriteMicromapsPropertiesEXT) - -#define ALL_VK_INSTANCE_FUNCS() \ - USE_VK_FUNC(vkCreateDebugReportCallbackEXT) \ - USE_VK_FUNC(vkCreateDebugUtilsMessengerEXT) \ - USE_VK_FUNC(vkCreateWin32SurfaceKHR) \ - USE_VK_FUNC(vkDebugReportMessageEXT) \ - USE_VK_FUNC(vkDestroyDebugReportCallbackEXT) \ - USE_VK_FUNC(vkDestroyDebugUtilsMessengerEXT) \ - USE_VK_FUNC(vkDestroySurfaceKHR) \ - USE_VK_FUNC(vkEnumeratePhysicalDeviceGroups) \ - USE_VK_FUNC(vkEnumeratePhysicalDeviceGroupsKHR) \ - USE_VK_FUNC(vkEnumeratePhysicalDevices) \ - USE_VK_FUNC(vkSubmitDebugUtilsMessageEXT) \ - USE_VK_FUNC(vkCreateDevice) \ - USE_VK_FUNC(vkEnumerateDeviceExtensionProperties) \ - USE_VK_FUNC(vkEnumerateDeviceLayerProperties) \ - USE_VK_FUNC(vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceCalibrateableTimeDomainsEXT) \ - USE_VK_FUNC(vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceCooperativeMatrixPropertiesNV) \ - USE_VK_FUNC(vkGetPhysicalDeviceFeatures) \ - USE_VK_FUNC(vkGetPhysicalDeviceFeatures2) \ - USE_VK_FUNC(vkGetPhysicalDeviceFeatures2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceFormatProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceFormatProperties2) \ - USE_VK_FUNC(vkGetPhysicalDeviceFormatProperties2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceFragmentShadingRatesKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceImageFormatProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceImageFormatProperties2) \ - USE_VK_FUNC(vkGetPhysicalDeviceImageFormatProperties2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceMemoryProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceMemoryProperties2) \ - USE_VK_FUNC(vkGetPhysicalDeviceMemoryProperties2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceMultisamplePropertiesEXT) \ - USE_VK_FUNC(vkGetPhysicalDeviceOpticalFlowImageFormatsNV) \ - USE_VK_FUNC(vkGetPhysicalDevicePresentRectanglesKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceProperties2) \ - USE_VK_FUNC(vkGetPhysicalDeviceProperties2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceQueueFamilyProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceQueueFamilyProperties2) \ - USE_VK_FUNC(vkGetPhysicalDeviceQueueFamilyProperties2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSparseImageFormatProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceSparseImageFormatProperties2) \ - USE_VK_FUNC(vkGetPhysicalDeviceSparseImageFormatProperties2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV) \ - USE_VK_FUNC(vkGetPhysicalDeviceSurfaceCapabilities2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSurfaceFormats2KHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSurfaceFormatsKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSurfacePresentModesKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceSurfaceSupportKHR) \ - USE_VK_FUNC(vkGetPhysicalDeviceToolProperties) \ - USE_VK_FUNC(vkGetPhysicalDeviceToolPropertiesEXT) \ - USE_VK_FUNC(vkGetPhysicalDeviceWin32PresentationSupportKHR) - -#endif /* __WINE_VULKAN_THUNKS_H */ diff --git a/dlls/winevulkan/winevulkan.json b/dlls/winevulkan/winevulkan.json deleted file mode 100644 index a4ae238dfba..00000000000 --- a/dlls/winevulkan/winevulkan.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "file_format_version": "1.0.0", - "ICD": { - "library_path": ".\\winevulkan.dll", - "api_version": "1.3.272" - } -} diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec deleted file mode 100644 index e8b58b018e5..00000000000 --- a/dlls/winevulkan/winevulkan.spec +++ /dev/null @@ -1,258 +0,0 @@ -# Automatically generated from Vulkan vk.xml; DO NOT EDIT! -# -# This file is generated from Vulkan vk.xml file covered -# by the following copyright and permission notice: -# -# Copyright 2015-2023 The Khronos Group Inc. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# - -@ stdcall -private vk_icdGetInstanceProcAddr(ptr str) -@ stdcall -private vk_icdGetPhysicalDeviceProcAddr(ptr str) -@ stdcall -private vk_icdNegotiateLoaderICDInterfaceVersion(ptr) -@ stdcall vkAcquireNextImage2KHR(ptr ptr ptr) -@ stdcall vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr) -@ stdcall vkAllocateCommandBuffers(ptr ptr ptr) -@ stdcall vkAllocateDescriptorSets(ptr ptr ptr) -@ stdcall vkAllocateMemory(ptr ptr ptr ptr) -@ stdcall vkBeginCommandBuffer(ptr ptr) -@ stdcall vkBindBufferMemory(ptr int64 int64 int64) -@ stdcall vkBindBufferMemory2(ptr long ptr) -@ stdcall vkBindImageMemory(ptr int64 int64 int64) -@ stdcall vkBindImageMemory2(ptr long ptr) -@ stdcall vkCmdBeginQuery(ptr int64 long long) -@ stdcall vkCmdBeginRenderPass(ptr ptr long) -@ stdcall vkCmdBeginRenderPass2(ptr ptr ptr) -@ stdcall vkCmdBeginRendering(ptr ptr) -@ stdcall vkCmdBindDescriptorSets(ptr long int64 long long ptr long ptr) -@ stdcall vkCmdBindIndexBuffer(ptr int64 int64 long) -@ stdcall vkCmdBindPipeline(ptr long int64) -@ stdcall vkCmdBindVertexBuffers(ptr long long ptr ptr) -@ stdcall vkCmdBindVertexBuffers2(ptr long long ptr ptr ptr ptr) -@ stdcall vkCmdBlitImage(ptr int64 long int64 long long ptr long) -@ stdcall vkCmdBlitImage2(ptr ptr) -@ stdcall vkCmdClearAttachments(ptr long ptr long ptr) -@ stdcall vkCmdClearColorImage(ptr int64 long ptr long ptr) -@ stdcall vkCmdClearDepthStencilImage(ptr int64 long ptr long ptr) -@ stdcall vkCmdCopyBuffer(ptr int64 int64 long ptr) -@ stdcall vkCmdCopyBuffer2(ptr ptr) -@ stdcall vkCmdCopyBufferToImage(ptr int64 int64 long long ptr) -@ stdcall vkCmdCopyBufferToImage2(ptr ptr) -@ stdcall vkCmdCopyImage(ptr int64 long int64 long long ptr) -@ stdcall vkCmdCopyImage2(ptr ptr) -@ stdcall vkCmdCopyImageToBuffer(ptr int64 long int64 long ptr) -@ stdcall vkCmdCopyImageToBuffer2(ptr ptr) -@ stdcall vkCmdCopyQueryPoolResults(ptr int64 long long int64 int64 int64 long) -@ stdcall vkCmdDispatch(ptr long long long) -@ stdcall vkCmdDispatchBase(ptr long long long long long long) -@ stdcall vkCmdDispatchIndirect(ptr int64 int64) -@ stdcall vkCmdDraw(ptr long long long long) -@ stdcall vkCmdDrawIndexed(ptr long long long long long) -@ stdcall vkCmdDrawIndexedIndirect(ptr int64 int64 long long) -@ stdcall vkCmdDrawIndexedIndirectCount(ptr int64 int64 int64 int64 long long) -@ stdcall vkCmdDrawIndirect(ptr int64 int64 long long) -@ stdcall vkCmdDrawIndirectCount(ptr int64 int64 int64 int64 long long) -@ stdcall vkCmdEndQuery(ptr int64 long) -@ stdcall vkCmdEndRenderPass(ptr) -@ stdcall vkCmdEndRenderPass2(ptr ptr) -@ stdcall vkCmdEndRendering(ptr) -@ stdcall vkCmdExecuteCommands(ptr long ptr) -@ stdcall vkCmdFillBuffer(ptr int64 int64 int64 long) -@ stdcall vkCmdNextSubpass(ptr long) -@ stdcall vkCmdNextSubpass2(ptr ptr ptr) -@ stdcall vkCmdPipelineBarrier(ptr long long long long ptr long ptr long ptr) -@ stdcall vkCmdPipelineBarrier2(ptr ptr) -@ stdcall vkCmdPushConstants(ptr int64 long long long ptr) -@ stdcall vkCmdResetEvent(ptr int64 long) -@ stdcall vkCmdResetEvent2(ptr int64 int64) -@ stdcall vkCmdResetQueryPool(ptr int64 long long) -@ stdcall vkCmdResolveImage(ptr int64 long int64 long long ptr) -@ stdcall vkCmdResolveImage2(ptr ptr) -@ stdcall vkCmdSetBlendConstants(ptr ptr) -@ stdcall vkCmdSetCullMode(ptr long) -@ stdcall vkCmdSetDepthBias(ptr float float float) -@ stdcall vkCmdSetDepthBiasEnable(ptr long) -@ stdcall vkCmdSetDepthBounds(ptr float float) -@ stdcall vkCmdSetDepthBoundsTestEnable(ptr long) -@ stdcall vkCmdSetDepthCompareOp(ptr long) -@ stdcall vkCmdSetDepthTestEnable(ptr long) -@ stdcall vkCmdSetDepthWriteEnable(ptr long) -@ stdcall vkCmdSetDeviceMask(ptr long) -@ stdcall vkCmdSetEvent(ptr int64 long) -@ stdcall vkCmdSetEvent2(ptr int64 ptr) -@ stdcall vkCmdSetFrontFace(ptr long) -@ stdcall vkCmdSetLineWidth(ptr float) -@ stdcall vkCmdSetPrimitiveRestartEnable(ptr long) -@ stdcall vkCmdSetPrimitiveTopology(ptr long) -@ stdcall vkCmdSetRasterizerDiscardEnable(ptr long) -@ stdcall vkCmdSetScissor(ptr long long ptr) -@ stdcall vkCmdSetScissorWithCount(ptr long ptr) -@ stdcall vkCmdSetStencilCompareMask(ptr long long) -@ stdcall vkCmdSetStencilOp(ptr long long long long long) -@ stdcall vkCmdSetStencilReference(ptr long long) -@ stdcall vkCmdSetStencilTestEnable(ptr long) -@ stdcall vkCmdSetStencilWriteMask(ptr long long) -@ stdcall vkCmdSetViewport(ptr long long ptr) -@ stdcall vkCmdSetViewportWithCount(ptr long ptr) -@ stdcall vkCmdUpdateBuffer(ptr int64 int64 int64 ptr) -@ stdcall vkCmdWaitEvents(ptr long ptr long long long ptr long ptr long ptr) -@ stdcall vkCmdWaitEvents2(ptr long ptr ptr) -@ stdcall vkCmdWriteTimestamp(ptr long int64 long) -@ stdcall vkCmdWriteTimestamp2(ptr int64 int64 long) -@ stdcall vkCreateBuffer(ptr ptr ptr ptr) -@ stdcall vkCreateBufferView(ptr ptr ptr ptr) -@ stdcall vkCreateCommandPool(ptr ptr ptr ptr) -@ stdcall vkCreateComputePipelines(ptr int64 long ptr ptr ptr) -@ stdcall vkCreateDescriptorPool(ptr ptr ptr ptr) -@ stdcall vkCreateDescriptorSetLayout(ptr ptr ptr ptr) -@ stdcall vkCreateDescriptorUpdateTemplate(ptr ptr ptr ptr) -@ stdcall vkCreateDevice(ptr ptr ptr ptr) -@ stub vkCreateDisplayModeKHR -@ stub vkCreateDisplayPlaneSurfaceKHR -@ stdcall vkCreateEvent(ptr ptr ptr ptr) -@ stdcall vkCreateFence(ptr ptr ptr ptr) -@ stdcall vkCreateFramebuffer(ptr ptr ptr ptr) -@ stdcall vkCreateGraphicsPipelines(ptr int64 long ptr ptr ptr) -@ stdcall vkCreateImage(ptr ptr ptr ptr) -@ stdcall vkCreateImageView(ptr ptr ptr ptr) -@ stdcall vkCreateInstance(ptr ptr ptr) -@ stdcall vkCreatePipelineCache(ptr ptr ptr ptr) -@ stdcall vkCreatePipelineLayout(ptr ptr ptr ptr) -@ stdcall vkCreatePrivateDataSlot(ptr ptr ptr ptr) -@ stdcall vkCreateQueryPool(ptr ptr ptr ptr) -@ stdcall vkCreateRenderPass(ptr ptr ptr ptr) -@ stdcall vkCreateRenderPass2(ptr ptr ptr ptr) -@ stdcall vkCreateSampler(ptr ptr ptr ptr) -@ stdcall vkCreateSamplerYcbcrConversion(ptr ptr ptr ptr) -@ stdcall vkCreateSemaphore(ptr ptr ptr ptr) -@ stdcall vkCreateShaderModule(ptr ptr ptr ptr) -@ stub vkCreateSharedSwapchainsKHR -@ stdcall vkCreateSwapchainKHR(ptr ptr ptr ptr) -@ stdcall vkCreateWin32SurfaceKHR(ptr ptr ptr ptr) -@ stdcall vkDestroyBuffer(ptr int64 ptr) -@ stdcall vkDestroyBufferView(ptr int64 ptr) -@ stdcall vkDestroyCommandPool(ptr int64 ptr) -@ stdcall vkDestroyDescriptorPool(ptr int64 ptr) -@ stdcall vkDestroyDescriptorSetLayout(ptr int64 ptr) -@ stdcall vkDestroyDescriptorUpdateTemplate(ptr int64 ptr) -@ stdcall vkDestroyDevice(ptr ptr) -@ stdcall vkDestroyEvent(ptr int64 ptr) -@ stdcall vkDestroyFence(ptr int64 ptr) -@ stdcall vkDestroyFramebuffer(ptr int64 ptr) -@ stdcall vkDestroyImage(ptr int64 ptr) -@ stdcall vkDestroyImageView(ptr int64 ptr) -@ stdcall vkDestroyInstance(ptr ptr) -@ stdcall vkDestroyPipeline(ptr int64 ptr) -@ stdcall vkDestroyPipelineCache(ptr int64 ptr) -@ stdcall vkDestroyPipelineLayout(ptr int64 ptr) -@ stdcall vkDestroyPrivateDataSlot(ptr int64 ptr) -@ stdcall vkDestroyQueryPool(ptr int64 ptr) -@ stdcall vkDestroyRenderPass(ptr int64 ptr) -@ stdcall vkDestroySampler(ptr int64 ptr) -@ stdcall vkDestroySamplerYcbcrConversion(ptr int64 ptr) -@ stdcall vkDestroySemaphore(ptr int64 ptr) -@ stdcall vkDestroyShaderModule(ptr int64 ptr) -@ stdcall vkDestroySurfaceKHR(ptr int64 ptr) -@ stdcall vkDestroySwapchainKHR(ptr int64 ptr) -@ stdcall vkDeviceWaitIdle(ptr) -@ stdcall vkEndCommandBuffer(ptr) -@ stdcall vkEnumerateDeviceExtensionProperties(ptr str ptr ptr) -@ stdcall vkEnumerateDeviceLayerProperties(ptr ptr ptr) -@ stdcall vkEnumerateInstanceExtensionProperties(str ptr ptr) -@ stdcall vkEnumerateInstanceLayerProperties(ptr ptr) -@ stdcall vkEnumerateInstanceVersion(ptr) -@ stdcall vkEnumeratePhysicalDeviceGroups(ptr ptr ptr) -@ stdcall vkEnumeratePhysicalDevices(ptr ptr ptr) -@ stdcall vkFlushMappedMemoryRanges(ptr long ptr) -@ stdcall vkFreeCommandBuffers(ptr int64 long ptr) -@ stdcall vkFreeDescriptorSets(ptr int64 long ptr) -@ stdcall vkFreeMemory(ptr int64 ptr) -@ stdcall vkGetBufferDeviceAddress(ptr ptr) -@ stdcall vkGetBufferMemoryRequirements(ptr int64 ptr) -@ stdcall vkGetBufferMemoryRequirements2(ptr ptr ptr) -@ stdcall vkGetBufferOpaqueCaptureAddress(ptr ptr) -@ stub vkGetCommandPoolMemoryConsumption -@ stdcall vkGetDescriptorSetLayoutSupport(ptr ptr ptr) -@ stdcall vkGetDeviceBufferMemoryRequirements(ptr ptr ptr) -@ stdcall vkGetDeviceGroupPeerMemoryFeatures(ptr long long long ptr) -@ stdcall vkGetDeviceGroupPresentCapabilitiesKHR(ptr ptr) -@ stdcall vkGetDeviceGroupSurfacePresentModesKHR(ptr int64 ptr) -@ stdcall vkGetDeviceImageMemoryRequirements(ptr ptr ptr) -@ stdcall vkGetDeviceImageSparseMemoryRequirements(ptr ptr ptr ptr) -@ stdcall vkGetDeviceMemoryCommitment(ptr int64 ptr) -@ stdcall vkGetDeviceMemoryOpaqueCaptureAddress(ptr ptr) -@ stdcall vkGetDeviceProcAddr(ptr str) -@ stdcall vkGetDeviceQueue(ptr long long ptr) -@ stdcall vkGetDeviceQueue2(ptr ptr ptr) -@ stub vkGetDisplayModePropertiesKHR -@ stub vkGetDisplayPlaneCapabilitiesKHR -@ stub vkGetDisplayPlaneSupportedDisplaysKHR -@ stdcall vkGetEventStatus(ptr int64) -@ stub vkGetFaultData -@ stdcall vkGetFenceStatus(ptr int64) -@ stdcall vkGetImageMemoryRequirements(ptr int64 ptr) -@ stdcall vkGetImageMemoryRequirements2(ptr ptr ptr) -@ stdcall vkGetImageSparseMemoryRequirements(ptr int64 ptr ptr) -@ stdcall vkGetImageSparseMemoryRequirements2(ptr ptr ptr ptr) -@ stdcall vkGetImageSubresourceLayout(ptr int64 ptr ptr) -@ stdcall vkGetInstanceProcAddr(ptr str) -@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR -@ stub vkGetPhysicalDeviceDisplayPropertiesKHR -@ stdcall vkGetPhysicalDeviceExternalBufferProperties(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceExternalFenceProperties(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceExternalSemaphoreProperties(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) -@ stdcall vkGetPhysicalDeviceFeatures2(ptr ptr) -@ stdcall vkGetPhysicalDeviceFormatProperties(ptr long ptr) -@ stdcall vkGetPhysicalDeviceFormatProperties2(ptr long ptr) -@ stdcall vkGetPhysicalDeviceImageFormatProperties(ptr long long long long long ptr) -@ stdcall vkGetPhysicalDeviceImageFormatProperties2(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceMemoryProperties(ptr ptr) -@ stdcall vkGetPhysicalDeviceMemoryProperties2(ptr ptr) -@ stdcall vkGetPhysicalDevicePresentRectanglesKHR(ptr int64 ptr ptr) -@ stdcall vkGetPhysicalDeviceProperties(ptr ptr) -@ stdcall vkGetPhysicalDeviceProperties2(ptr ptr) -@ stdcall vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceQueueFamilyProperties2(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceSparseImageFormatProperties(ptr long long long long long ptr ptr) -@ stdcall vkGetPhysicalDeviceSparseImageFormatProperties2(ptr ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceSurfaceCapabilities2KHR(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr int64 ptr) -@ stdcall vkGetPhysicalDeviceSurfaceFormats2KHR(ptr ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceSurfaceFormatsKHR(ptr int64 ptr ptr) -@ stdcall vkGetPhysicalDeviceSurfacePresentModesKHR(ptr int64 ptr ptr) -@ stdcall vkGetPhysicalDeviceSurfaceSupportKHR(ptr long int64 ptr) -@ stdcall vkGetPhysicalDeviceToolProperties(ptr ptr ptr) -@ stdcall vkGetPhysicalDeviceWin32PresentationSupportKHR(ptr long) -@ stdcall vkGetPipelineCacheData(ptr int64 ptr ptr) -@ stdcall vkGetPrivateData(ptr long int64 int64 ptr) -@ stdcall vkGetQueryPoolResults(ptr int64 long long long ptr int64 long) -@ stdcall vkGetRenderAreaGranularity(ptr int64 ptr) -@ stdcall vkGetSemaphoreCounterValue(ptr int64 ptr) -@ stdcall vkGetSwapchainImagesKHR(ptr int64 ptr ptr) -@ stdcall vkInvalidateMappedMemoryRanges(ptr long ptr) -@ stdcall vkMapMemory(ptr int64 int64 int64 long ptr) -@ stdcall vkMergePipelineCaches(ptr int64 long ptr) -@ stdcall vkQueueBindSparse(ptr long ptr int64) -@ stdcall vkQueuePresentKHR(ptr ptr) -@ stdcall vkQueueSubmit(ptr long ptr int64) -@ stdcall vkQueueSubmit2(ptr long ptr int64) -@ stdcall vkQueueWaitIdle(ptr) -@ stdcall vkResetCommandBuffer(ptr long) -@ stdcall vkResetCommandPool(ptr int64 long) -@ stdcall vkResetDescriptorPool(ptr int64 long) -@ stdcall vkResetEvent(ptr int64) -@ stdcall vkResetFences(ptr long ptr) -@ stdcall vkResetQueryPool(ptr int64 long long) -@ stdcall vkSetEvent(ptr int64) -@ stdcall vkSetPrivateData(ptr long int64 int64 int64) -@ stdcall vkSignalSemaphore(ptr ptr) -@ stdcall vkTrimCommandPool(ptr int64 long) -@ stdcall vkUnmapMemory(ptr int64) -@ stdcall vkUpdateDescriptorSetWithTemplate(ptr int64 int64 ptr) -@ stdcall vkUpdateDescriptorSets(ptr long ptr long ptr) -@ stdcall vkWaitForFences(ptr long ptr long int64) -@ stdcall vkWaitSemaphores(ptr ptr int64) -@ stdcall -private DllRegisterServer() -@ stdcall -private DllUnregisterServer() diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h deleted file mode 100644 index a8bf4ad4df0..00000000000 --- a/include/wine/vulkan.h +++ /dev/null @@ -1,13855 +0,0 @@ -/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! - * - * This file is generated from Vulkan vk.xml file covered - * by the following copyright and permission notice: - * - * Copyright 2015-2023 The Khronos Group Inc. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef __WINE_VULKAN_H -#define __WINE_VULKAN_H - -#include -#include - -/* Define WINE_VK_HOST to get 'host' headers. */ -#ifdef WINE_VK_HOST -#define VKAPI_CALL -#define WINE_VK_ALIGN(x) -#endif - -#ifndef VKAPI_CALL -#define VKAPI_CALL __stdcall -#endif - -#ifndef VKAPI_PTR -#define VKAPI_PTR VKAPI_CALL -#endif - -#ifndef WINE_VK_ALIGN -#define WINE_VK_ALIGN DECLSPEC_ALIGN -#endif - -#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 -#define VK_UUID_SIZE 16 -#define VK_LUID_SIZE 8 -#define VK_LUID_SIZE_KHR VK_LUID_SIZE -#define VK_MAX_EXTENSION_NAME_SIZE 256 -#define VK_MAX_DESCRIPTION_SIZE 256 -#define VK_MAX_MEMORY_TYPES 32 -#define VK_MAX_MEMORY_HEAPS 16 -#define VK_LOD_CLAMP_NONE 1000.0F -#define VK_REMAINING_MIP_LEVELS (~0U) -#define VK_REMAINING_ARRAY_LAYERS (~0U) -#define VK_REMAINING_3D_SLICES_EXT (~0U) -#define VK_WHOLE_SIZE (~0ULL) -#define VK_ATTACHMENT_UNUSED (~0U) -#define VK_TRUE 1 -#define VK_FALSE 0 -#define VK_QUEUE_FAMILY_IGNORED (~0U) -#define VK_QUEUE_FAMILY_EXTERNAL (~1U) -#define VK_QUEUE_FAMILY_EXTERNAL_KHR VK_QUEUE_FAMILY_EXTERNAL -#define VK_QUEUE_FAMILY_FOREIGN_EXT (~2U) -#define VK_SUBPASS_EXTERNAL (~0U) -#define VK_MAX_DEVICE_GROUP_SIZE 32 -#define VK_MAX_DEVICE_GROUP_SIZE_KHR VK_MAX_DEVICE_GROUP_SIZE -#define VK_MAX_DRIVER_NAME_SIZE 256 -#define VK_MAX_DRIVER_NAME_SIZE_KHR VK_MAX_DRIVER_NAME_SIZE -#define VK_MAX_DRIVER_INFO_SIZE 256 -#define VK_MAX_DRIVER_INFO_SIZE_KHR VK_MAX_DRIVER_INFO_SIZE -#define VK_SHADER_UNUSED_KHR (~0U) -#define VK_SHADER_UNUSED_NV VK_SHADER_UNUSED_KHR -#define VK_MAX_GLOBAL_PRIORITY_SIZE_KHR 16 -#define VK_MAX_GLOBAL_PRIORITY_SIZE_EXT VK_MAX_GLOBAL_PRIORITY_SIZE_KHR -#define VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT 32 -#define VK_SHADER_INDEX_UNUSED_AMDX (~0U) -#define VK_KHR_SURFACE_SPEC_VERSION 25 -#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" -#define VK_KHR_SWAPCHAIN_SPEC_VERSION 70 -#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" -#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 -#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" -#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 10 -#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" -#define VK_NV_GLSL_SHADER_SPEC_VERSION 1 -#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" -#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 -#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" -#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 3 -#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" -#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 -#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" -#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 -#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" -#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 -#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" -#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 -#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" -#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 -#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" -#define VK_AMD_GCN_SHADER_SPEC_VERSION 1 -#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" -#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 -#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" -#define VK_EXT_TRANSFORM_FEEDBACK_SPEC_VERSION 1 -#define VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME "VK_EXT_transform_feedback" -#define VK_NVX_BINARY_IMPORT_SPEC_VERSION 1 -#define VK_NVX_BINARY_IMPORT_EXTENSION_NAME "VK_NVX_binary_import" -#define VK_NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION 2 -#define VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME "VK_NVX_image_view_handle" -#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 2 -#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" -#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 -#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" -#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 2 -#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" -#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 -#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" -#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 -#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" -#define VK_AMD_SHADER_INFO_SPEC_VERSION 1 -#define VK_AMD_SHADER_INFO_EXTENSION_NAME "VK_AMD_shader_info" -#define VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION 1 -#define VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME "VK_KHR_dynamic_rendering" -#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION 1 -#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod" -#define VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION 2 -#define VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME "VK_NV_corner_sampled_image" -#define VK_KHR_MULTIVIEW_SPEC_VERSION 1 -#define VK_KHR_MULTIVIEW_EXTENSION_NAME "VK_KHR_multiview" -#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 -#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" -#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 2 -#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" -#define VK_KHR_DEVICE_GROUP_SPEC_VERSION 4 -#define VK_KHR_DEVICE_GROUP_EXTENSION_NAME "VK_KHR_device_group" -#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 3 -#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" -#define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 -#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" -#define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 -#define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" -#define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 -#define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" -#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION 1 -#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME "VK_EXT_texture_compression_astc_hdr" -#define VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION 1 -#define VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME "VK_EXT_astc_decode_mode" -#define VK_EXT_PIPELINE_ROBUSTNESS_SPEC_VERSION 1 -#define VK_EXT_PIPELINE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_pipeline_robustness" -#define VK_KHR_MAINTENANCE1_SPEC_VERSION VK_KHR_MAINTENANCE_1_SPEC_VERSION -#define VK_KHR_MAINTENANCE1_EXTENSION_NAME VK_KHR_MAINTENANCE_1_EXTENSION_NAME -#define VK_KHR_MAINTENANCE_1_SPEC_VERSION 2 -#define VK_KHR_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_maintenance1" -#define VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION 1 -#define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation" -#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" -#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" -#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" -#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" -#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" -#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2 -#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" -#define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 2 -#define VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME "VK_EXT_conditional_rendering" -#define VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION 1 -#define VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME "VK_KHR_shader_float16_int8" -#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 -#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" -#define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 2 -#define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" -#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION 1 -#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME "VK_KHR_descriptor_update_template" -#define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 -#define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" -#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 -#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" -#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 -#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" -#define VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION -#define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME -#define VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION 1 -#define VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME "VK_NV_viewport_array2" -#define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 -#define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" -#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 2 -#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" -#define VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION 1 -#define VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME "VK_EXT_conservative_rasterization" -#define VK_EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION 1 -#define VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME "VK_EXT_depth_clip_enable" -#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 4 -#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" -#define VK_EXT_HDR_METADATA_SPEC_VERSION 2 -#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" -#define VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION 1 -#define VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME "VK_KHR_imageless_framebuffer" -#define VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION 1 -#define VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME "VK_KHR_create_renderpass2" -#define VK_IMG_RELAXED_LINE_RASTERIZATION_SPEC_VERSION 1 -#define VK_IMG_RELAXED_LINE_RASTERIZATION_EXTENSION_NAME "VK_IMG_relaxed_line_rasterization" -#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" -#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" -#define VK_KHR_PERFORMANCE_QUERY_SPEC_VERSION 1 -#define VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME "VK_KHR_performance_query" -#define VK_KHR_MAINTENANCE2_SPEC_VERSION VK_KHR_MAINTENANCE_2_SPEC_VERSION -#define VK_KHR_MAINTENANCE2_EXTENSION_NAME VK_KHR_MAINTENANCE_2_EXTENSION_NAME -#define VK_KHR_MAINTENANCE_2_SPEC_VERSION 1 -#define VK_KHR_MAINTENANCE_2_EXTENSION_NAME "VK_KHR_maintenance2" -#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 -#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" -#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 -#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" -#define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 -#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign" -#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 -#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" -#define VK_EXT_DEBUG_UTILS_SPEC_VERSION 2 -#define VK_EXT_DEBUG_UTILS_EXTENSION_NAME "VK_EXT_debug_utils" -#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 2 -#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" -#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 -#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" -#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 2 -#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" -#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 -#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" -#define VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION 1 -#define VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME "VK_AMD_shader_fragment_mask" -#define VK_EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION 1 -#define VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME "VK_EXT_inline_uniform_block" -#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 -#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" -#define VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION 1 -#define VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME "VK_EXT_sample_locations" -#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 -#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" -#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 -#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" -#define VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION 1 -#define VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME "VK_KHR_image_format_list" -#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 -#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" -#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" -#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 -#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" -#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 -#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" -#define VK_NV_SHADER_SM_BUILTINS_SPEC_VERSION 1 -#define VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME "VK_NV_shader_sm_builtins" -#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 -#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" -#define VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION 14 -#define VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME "VK_KHR_sampler_ycbcr_conversion" -#define VK_KHR_BIND_MEMORY_2_SPEC_VERSION 1 -#define VK_KHR_BIND_MEMORY_2_EXTENSION_NAME "VK_KHR_bind_memory2" -#define VK_EXT_VALIDATION_CACHE_SPEC_VERSION 1 -#define VK_EXT_VALIDATION_CACHE_EXTENSION_NAME "VK_EXT_validation_cache" -#define VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION 2 -#define VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME "VK_EXT_descriptor_indexing" -#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 -#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" -#define VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION 3 -#define VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME "VK_NV_shading_rate_image" -#define VK_NV_RAY_TRACING_SPEC_VERSION 3 -#define VK_NV_RAY_TRACING_EXTENSION_NAME "VK_NV_ray_tracing" -#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 2 -#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test" -#define VK_KHR_MAINTENANCE3_SPEC_VERSION VK_KHR_MAINTENANCE_3_SPEC_VERSION -#define VK_KHR_MAINTENANCE3_EXTENSION_NAME VK_KHR_MAINTENANCE_3_EXTENSION_NAME -#define VK_KHR_MAINTENANCE_3_SPEC_VERSION 1 -#define VK_KHR_MAINTENANCE_3_EXTENSION_NAME "VK_KHR_maintenance3" -#define VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 -#define VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_KHR_draw_indirect_count" -#define VK_EXT_FILTER_CUBIC_SPEC_VERSION 3 -#define VK_EXT_FILTER_CUBIC_EXTENSION_NAME "VK_EXT_filter_cubic" -#define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_SPEC_VERSION 4 -#define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_EXTENSION_NAME "VK_QCOM_render_pass_shader_resolve" -#define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2 -#define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority" -#define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION 1 -#define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME "VK_KHR_shader_subgroup_extended_types" -#define VK_KHR_8BIT_STORAGE_SPEC_VERSION 1 -#define VK_KHR_8BIT_STORAGE_EXTENSION_NAME "VK_KHR_8bit_storage" -#define VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION 1 -#define VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME "VK_EXT_external_memory_host" -#define VK_AMD_BUFFER_MARKER_SPEC_VERSION 1 -#define VK_AMD_BUFFER_MARKER_EXTENSION_NAME "VK_AMD_buffer_marker" -#define VK_KHR_SHADER_ATOMIC_INT64_SPEC_VERSION 1 -#define VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME "VK_KHR_shader_atomic_int64" -#define VK_KHR_SHADER_CLOCK_SPEC_VERSION 1 -#define VK_KHR_SHADER_CLOCK_EXTENSION_NAME "VK_KHR_shader_clock" -#define VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION 1 -#define VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME "VK_AMD_pipeline_compiler_control" -#define VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION 2 -#define VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME "VK_EXT_calibrated_timestamps" -#define VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION 2 -#define VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_AMD_shader_core_properties" -#define VK_KHR_GLOBAL_PRIORITY_SPEC_VERSION 1 -#define VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME "VK_KHR_global_priority" -#define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION 1 -#define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME "VK_AMD_memory_overallocation_behavior" -#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 3 -#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_EXT_vertex_attribute_divisor" -#define VK_EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION 1 -#define VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME "VK_EXT_pipeline_creation_feedback" -#define VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION 1 -#define VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME "VK_KHR_driver_properties" -#define VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION 4 -#define VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME "VK_KHR_shader_float_controls" -#define VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION 1 -#define VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME "VK_NV_shader_subgroup_partitioned" -#define VK_KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION 1 -#define VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME "VK_KHR_depth_stencil_resolve" -#define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION 1 -#define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME "VK_KHR_swapchain_mutable_format" -#define VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION 1 -#define VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME "VK_NV_compute_shader_derivatives" -#define VK_NV_MESH_SHADER_SPEC_VERSION 1 -#define VK_NV_MESH_SHADER_EXTENSION_NAME "VK_NV_mesh_shader" -#define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_NV_fragment_shader_barycentric" -#define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 2 -#define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint" -#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 2 -#define VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME "VK_NV_scissor_exclusive" -#define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION 2 -#define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME "VK_NV_device_diagnostic_checkpoints" -#define VK_KHR_TIMELINE_SEMAPHORE_SPEC_VERSION 2 -#define VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME "VK_KHR_timeline_semaphore" -#define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION 1 -#define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME "VK_INTEL_shader_integer_functions2" -#define VK_INTEL_PERFORMANCE_QUERY_SPEC_VERSION 2 -#define VK_INTEL_PERFORMANCE_QUERY_EXTENSION_NAME "VK_INTEL_performance_query" -#define VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION 3 -#define VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME "VK_KHR_vulkan_memory_model" -#define VK_EXT_PCI_BUS_INFO_SPEC_VERSION 2 -#define VK_EXT_PCI_BUS_INFO_EXTENSION_NAME "VK_EXT_pci_bus_info" -#define VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION 1 -#define VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME "VK_KHR_shader_terminate_invocation" -#define VK_EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION 2 -#define VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME "VK_EXT_fragment_density_map" -#define VK_EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION 1 -#define VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME "VK_EXT_scalar_block_layout" -#define VK_GOOGLE_HLSL_FUNCTIONALITY1_SPEC_VERSION VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION -#define VK_GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME -#define VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION 1 -#define VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME "VK_GOOGLE_hlsl_functionality1" -#define VK_GOOGLE_DECORATE_STRING_SPEC_VERSION 1 -#define VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME "VK_GOOGLE_decorate_string" -#define VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION 2 -#define VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME "VK_EXT_subgroup_size_control" -#define VK_KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION 2 -#define VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME "VK_KHR_fragment_shading_rate" -#define VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION 1 -#define VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME "VK_AMD_shader_core_properties2" -#define VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION 1 -#define VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME "VK_AMD_device_coherent_memory" -#define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_SPEC_VERSION 1 -#define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME "VK_EXT_shader_image_atomic_int64" -#define VK_KHR_SPIRV_1_4_SPEC_VERSION 1 -#define VK_KHR_SPIRV_1_4_EXTENSION_NAME "VK_KHR_spirv_1_4" -#define VK_EXT_MEMORY_BUDGET_SPEC_VERSION 1 -#define VK_EXT_MEMORY_BUDGET_EXTENSION_NAME "VK_EXT_memory_budget" -#define VK_EXT_MEMORY_PRIORITY_SPEC_VERSION 1 -#define VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME "VK_EXT_memory_priority" -#define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION 1 -#define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME "VK_NV_dedicated_allocation_image_aliasing" -#define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION 1 -#define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME "VK_KHR_separate_depth_stencil_layouts" -#define VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 2 -#define VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_EXT_buffer_device_address" -#define VK_EXT_TOOLING_INFO_SPEC_VERSION 1 -#define VK_EXT_TOOLING_INFO_EXTENSION_NAME "VK_EXT_tooling_info" -#define VK_EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION 1 -#define VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME "VK_EXT_separate_stencil_usage" -#define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 6 -#define VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME "VK_EXT_validation_features" -#define VK_KHR_PRESENT_WAIT_SPEC_VERSION 1 -#define VK_KHR_PRESENT_WAIT_EXTENSION_NAME "VK_KHR_present_wait" -#define VK_NV_COOPERATIVE_MATRIX_SPEC_VERSION 1 -#define VK_NV_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_NV_cooperative_matrix" -#define VK_NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION 1 -#define VK_NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME "VK_NV_coverage_reduction_mode" -#define VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION 1 -#define VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME "VK_EXT_fragment_shader_interlock" -#define VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION 1 -#define VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME "VK_EXT_ycbcr_image_arrays" -#define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION 1 -#define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME "VK_KHR_uniform_buffer_standard_layout" -#define VK_EXT_PROVOKING_VERTEX_SPEC_VERSION 1 -#define VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME "VK_EXT_provoking_vertex" -#define VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 1 -#define VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_KHR_buffer_device_address" -#define VK_EXT_LINE_RASTERIZATION_SPEC_VERSION 1 -#define VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME "VK_EXT_line_rasterization" -#define VK_EXT_SHADER_ATOMIC_FLOAT_SPEC_VERSION 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME "VK_EXT_shader_atomic_float" -#define VK_EXT_HOST_QUERY_RESET_SPEC_VERSION 1 -#define VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME "VK_EXT_host_query_reset" -#define VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION 1 -#define VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME "VK_EXT_index_type_uint8" -#define VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION 1 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_extended_dynamic_state" -#define VK_KHR_DEFERRED_HOST_OPERATIONS_SPEC_VERSION 4 -#define VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME "VK_KHR_deferred_host_operations" -#define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION 1 -#define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME "VK_KHR_pipeline_executable_properties" -#define VK_EXT_HOST_IMAGE_COPY_SPEC_VERSION 1 -#define VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME "VK_EXT_host_image_copy" -#define VK_KHR_MAP_MEMORY_2_SPEC_VERSION 1 -#define VK_KHR_MAP_MEMORY_2_EXTENSION_NAME "VK_KHR_map_memory2" -#define VK_EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME "VK_EXT_shader_atomic_float2" -#define VK_EXT_SURFACE_MAINTENANCE_1_SPEC_VERSION 1 -#define VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME "VK_EXT_surface_maintenance1" -#define VK_EXT_SWAPCHAIN_MAINTENANCE_1_SPEC_VERSION 1 -#define VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME "VK_EXT_swapchain_maintenance1" -#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION 1 -#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME "VK_EXT_shader_demote_to_helper_invocation" -#define VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 -#define VK_NV_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NV_device_generated_commands" -#define VK_NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION 1 -#define VK_NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME "VK_NV_inherited_viewport_scissor" -#define VK_KHR_SHADER_INTEGER_DOT_PRODUCT_SPEC_VERSION 1 -#define VK_KHR_SHADER_INTEGER_DOT_PRODUCT_EXTENSION_NAME "VK_KHR_shader_integer_dot_product" -#define VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION 1 -#define VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME "VK_EXT_texel_buffer_alignment" -#define VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION 3 -#define VK_QCOM_RENDER_PASS_TRANSFORM_EXTENSION_NAME "VK_QCOM_render_pass_transform" -#define VK_EXT_DEPTH_BIAS_CONTROL_SPEC_VERSION 1 -#define VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME "VK_EXT_depth_bias_control" -#define VK_EXT_ROBUSTNESS_2_SPEC_VERSION 1 -#define VK_EXT_ROBUSTNESS_2_EXTENSION_NAME "VK_EXT_robustness2" -#define VK_EXT_CUSTOM_BORDER_COLOR_SPEC_VERSION 12 -#define VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME "VK_EXT_custom_border_color" -#define VK_GOOGLE_USER_TYPE_SPEC_VERSION 1 -#define VK_GOOGLE_USER_TYPE_EXTENSION_NAME "VK_GOOGLE_user_type" -#define VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION 1 -#define VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME "VK_KHR_pipeline_library" -#define VK_NV_PRESENT_BARRIER_SPEC_VERSION 1 -#define VK_NV_PRESENT_BARRIER_EXTENSION_NAME "VK_NV_present_barrier" -#define VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION 1 -#define VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME "VK_KHR_shader_non_semantic_info" -#define VK_KHR_PRESENT_ID_SPEC_VERSION 1 -#define VK_KHR_PRESENT_ID_EXTENSION_NAME "VK_KHR_present_id" -#define VK_EXT_PRIVATE_DATA_SPEC_VERSION 1 -#define VK_EXT_PRIVATE_DATA_EXTENSION_NAME "VK_EXT_private_data" -#define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_SPEC_VERSION 3 -#define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME "VK_EXT_pipeline_creation_cache_control" -#define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION 2 -#define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME "VK_NV_device_diagnostics_config" -#define VK_QCOM_RENDER_PASS_STORE_OPS_SPEC_VERSION 2 -#define VK_QCOM_RENDER_PASS_STORE_OPS_EXTENSION_NAME "VK_QCOM_render_pass_store_ops" -#define VK_NV_CUDA_KERNEL_LAUNCH_SPEC_VERSION 2 -#define VK_NV_CUDA_KERNEL_LAUNCH_EXTENSION_NAME "VK_NV_cuda_kernel_launch" -#define VK_NV_LOW_LATENCY_SPEC_VERSION 1 -#define VK_NV_LOW_LATENCY_EXTENSION_NAME "VK_NV_low_latency" -#define VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION 1 -#define VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME "VK_KHR_synchronization2" -#define VK_EXT_DESCRIPTOR_BUFFER_SPEC_VERSION 1 -#define VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME "VK_EXT_descriptor_buffer" -#define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_SPEC_VERSION 1 -#define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME "VK_EXT_graphics_pipeline_library" -#define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_SPEC_VERSION 1 -#define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_EXTENSION_NAME "VK_AMD_shader_early_and_late_fragment_tests" -#define VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 -#define VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_KHR_fragment_shader_barycentric" -#define VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_SPEC_VERSION 1 -#define VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_EXTENSION_NAME "VK_KHR_shader_subgroup_uniform_control_flow" -#define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_SPEC_VERSION 1 -#define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_EXTENSION_NAME "VK_KHR_zero_initialize_workgroup_memory" -#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME "VK_NV_fragment_shading_rate_enums" -#define VK_NV_RAY_TRACING_MOTION_BLUR_SPEC_VERSION 1 -#define VK_NV_RAY_TRACING_MOTION_BLUR_EXTENSION_NAME "VK_NV_ray_tracing_motion_blur" -#define VK_EXT_YCBCR_2PLANE_444_FORMATS_SPEC_VERSION 1 -#define VK_EXT_YCBCR_2PLANE_444_FORMATS_EXTENSION_NAME "VK_EXT_ycbcr_2plane_444_formats" -#define VK_EXT_FRAGMENT_DENSITY_MAP_2_SPEC_VERSION 1 -#define VK_EXT_FRAGMENT_DENSITY_MAP_2_EXTENSION_NAME "VK_EXT_fragment_density_map2" -#define VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION 1 -#define VK_QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME "VK_QCOM_rotated_copy_commands" -#define VK_EXT_IMAGE_ROBUSTNESS_SPEC_VERSION 1 -#define VK_EXT_IMAGE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_image_robustness" -#define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_SPEC_VERSION 1 -#define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME "VK_KHR_workgroup_memory_explicit_layout" -#define VK_KHR_COPY_COMMANDS_2_SPEC_VERSION 1 -#define VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME "VK_KHR_copy_commands2" -#define VK_EXT_IMAGE_COMPRESSION_CONTROL_SPEC_VERSION 1 -#define VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME "VK_EXT_image_compression_control" -#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_SPEC_VERSION 2 -#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_EXTENSION_NAME "VK_EXT_attachment_feedback_loop_layout" -#define VK_EXT_4444_FORMATS_SPEC_VERSION 1 -#define VK_EXT_4444_FORMATS_EXTENSION_NAME "VK_EXT_4444_formats" -#define VK_EXT_DEVICE_FAULT_SPEC_VERSION 2 -#define VK_EXT_DEVICE_FAULT_EXTENSION_NAME "VK_EXT_device_fault" -#define VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION 1 -#define VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME "VK_ARM_rasterization_order_attachment_access" -#define VK_EXT_RGBA10X6_FORMATS_SPEC_VERSION 1 -#define VK_EXT_RGBA10X6_FORMATS_EXTENSION_NAME "VK_EXT_rgba10x6_formats" -#define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 -#define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_VALVE_mutable_descriptor_type" -#define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_SPEC_VERSION 2 -#define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_vertex_input_dynamic_state" -#define VK_EXT_DEVICE_ADDRESS_BINDING_REPORT_SPEC_VERSION 1 -#define VK_EXT_DEVICE_ADDRESS_BINDING_REPORT_EXTENSION_NAME "VK_EXT_device_address_binding_report" -#define VK_EXT_DEPTH_CLIP_CONTROL_SPEC_VERSION 1 -#define VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME "VK_EXT_depth_clip_control" -#define VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_SPEC_VERSION 1 -#define VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME "VK_EXT_primitive_topology_list_restart" -#define VK_KHR_FORMAT_FEATURE_FLAGS_2_SPEC_VERSION 2 -#define VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME "VK_KHR_format_feature_flags2" -#define VK_HUAWEI_SUBPASS_SHADING_SPEC_VERSION 3 -#define VK_HUAWEI_SUBPASS_SHADING_EXTENSION_NAME "VK_HUAWEI_subpass_shading" -#define VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION 1 -#define VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME "VK_HUAWEI_invocation_mask" -#define VK_EXT_PIPELINE_PROPERTIES_SPEC_VERSION 1 -#define VK_EXT_PIPELINE_PROPERTIES_EXTENSION_NAME "VK_EXT_pipeline_properties" -#define VK_EXT_FRAME_BOUNDARY_SPEC_VERSION 1 -#define VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME "VK_EXT_frame_boundary" -#define VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_SPEC_VERSION 1 -#define VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_EXTENSION_NAME "VK_EXT_multisampled_render_to_single_sampled" -#define VK_EXT_EXTENDED_DYNAMIC_STATE_2_SPEC_VERSION 1 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME "VK_EXT_extended_dynamic_state2" -#define VK_EXT_COLOR_WRITE_ENABLE_SPEC_VERSION 1 -#define VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME "VK_EXT_color_write_enable" -#define VK_EXT_PRIMITIVES_GENERATED_QUERY_SPEC_VERSION 1 -#define VK_EXT_PRIMITIVES_GENERATED_QUERY_EXTENSION_NAME "VK_EXT_primitives_generated_query" -#define VK_KHR_RAY_TRACING_MAINTENANCE_1_SPEC_VERSION 1 -#define VK_KHR_RAY_TRACING_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_ray_tracing_maintenance1" -#define VK_EXT_GLOBAL_PRIORITY_QUERY_SPEC_VERSION 1 -#define VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME "VK_EXT_global_priority_query" -#define VK_EXT_IMAGE_VIEW_MIN_LOD_SPEC_VERSION 1 -#define VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME "VK_EXT_image_view_min_lod" -#define VK_EXT_MULTI_DRAW_SPEC_VERSION 1 -#define VK_EXT_MULTI_DRAW_EXTENSION_NAME "VK_EXT_multi_draw" -#define VK_EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION 1 -#define VK_EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME "VK_EXT_image_2d_view_of_3d" -#define VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION 1 -#define VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME "VK_KHR_portability_enumeration" -#define VK_EXT_SHADER_TILE_IMAGE_SPEC_VERSION 1 -#define VK_EXT_SHADER_TILE_IMAGE_EXTENSION_NAME "VK_EXT_shader_tile_image" -#define VK_EXT_OPACITY_MICROMAP_SPEC_VERSION 2 -#define VK_EXT_OPACITY_MICROMAP_EXTENSION_NAME "VK_EXT_opacity_micromap" -#define VK_EXT_LOAD_STORE_OP_NONE_SPEC_VERSION 1 -#define VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME "VK_EXT_load_store_op_none" -#define VK_HUAWEI_CLUSTER_CULLING_SHADER_SPEC_VERSION 3 -#define VK_HUAWEI_CLUSTER_CULLING_SHADER_EXTENSION_NAME "VK_HUAWEI_cluster_culling_shader" -#define VK_EXT_BORDER_COLOR_SWIZZLE_SPEC_VERSION 1 -#define VK_EXT_BORDER_COLOR_SWIZZLE_EXTENSION_NAME "VK_EXT_border_color_swizzle" -#define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_SPEC_VERSION 1 -#define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME "VK_EXT_pageable_device_local_memory" -#define VK_KHR_MAINTENANCE_4_SPEC_VERSION 2 -#define VK_KHR_MAINTENANCE_4_EXTENSION_NAME "VK_KHR_maintenance4" -#define VK_ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION 1 -#define VK_ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_ARM_shader_core_properties" -#define VK_ARM_SCHEDULING_CONTROLS_SPEC_VERSION 1 -#define VK_ARM_SCHEDULING_CONTROLS_EXTENSION_NAME "VK_ARM_scheduling_controls" -#define VK_EXT_IMAGE_SLICED_VIEW_OF_3D_SPEC_VERSION 1 -#define VK_EXT_IMAGE_SLICED_VIEW_OF_3D_EXTENSION_NAME "VK_EXT_image_sliced_view_of_3d" -#define VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_SPEC_VERSION 1 -#define VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_EXTENSION_NAME "VK_VALVE_descriptor_set_host_mapping" -#define VK_EXT_DEPTH_CLAMP_ZERO_ONE_SPEC_VERSION 1 -#define VK_EXT_DEPTH_CLAMP_ZERO_ONE_EXTENSION_NAME "VK_EXT_depth_clamp_zero_one" -#define VK_EXT_NON_SEAMLESS_CUBE_MAP_SPEC_VERSION 1 -#define VK_EXT_NON_SEAMLESS_CUBE_MAP_EXTENSION_NAME "VK_EXT_non_seamless_cube_map" -#define VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_SPEC_VERSION 1 -#define VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_EXTENSION_NAME "VK_QCOM_fragment_density_map_offset" -#define VK_NV_COPY_MEMORY_INDIRECT_SPEC_VERSION 1 -#define VK_NV_COPY_MEMORY_INDIRECT_EXTENSION_NAME "VK_NV_copy_memory_indirect" -#define VK_NV_MEMORY_DECOMPRESSION_SPEC_VERSION 1 -#define VK_NV_MEMORY_DECOMPRESSION_EXTENSION_NAME "VK_NV_memory_decompression" -#define VK_NV_DEVICE_GENERATED_COMMANDS_COMPUTE_SPEC_VERSION 2 -#define VK_NV_DEVICE_GENERATED_COMMANDS_COMPUTE_EXTENSION_NAME "VK_NV_device_generated_commands_compute" -#define VK_NV_LINEAR_COLOR_ATTACHMENT_SPEC_VERSION 1 -#define VK_NV_LINEAR_COLOR_ATTACHMENT_EXTENSION_NAME "VK_NV_linear_color_attachment" -#define VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_SPEC_VERSION 1 -#define VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_EXTENSION_NAME "VK_EXT_image_compression_control_swapchain" -#define VK_QCOM_IMAGE_PROCESSING_SPEC_VERSION 1 -#define VK_QCOM_IMAGE_PROCESSING_EXTENSION_NAME "VK_QCOM_image_processing" -#define VK_EXT_NESTED_COMMAND_BUFFER_SPEC_VERSION 1 -#define VK_EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME "VK_EXT_nested_command_buffer" -#define VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_SPEC_VERSION 1 -#define VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXTENSION_NAME "VK_EXT_external_memory_acquire_unmodified" -#define VK_EXT_EXTENDED_DYNAMIC_STATE_3_SPEC_VERSION 2 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME "VK_EXT_extended_dynamic_state3" -#define VK_EXT_SUBPASS_MERGE_FEEDBACK_SPEC_VERSION 2 -#define VK_EXT_SUBPASS_MERGE_FEEDBACK_EXTENSION_NAME "VK_EXT_subpass_merge_feedback" -#define VK_EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION 1 -#define VK_EXT_SHADER_MODULE_IDENTIFIER_EXTENSION_NAME "VK_EXT_shader_module_identifier" -#define VK_EXT_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION 1 -#define VK_EXT_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME "VK_EXT_rasterization_order_attachment_access" -#define VK_NV_OPTICAL_FLOW_SPEC_VERSION 1 -#define VK_NV_OPTICAL_FLOW_EXTENSION_NAME "VK_NV_optical_flow" -#define VK_EXT_LEGACY_DITHERING_SPEC_VERSION 1 -#define VK_EXT_LEGACY_DITHERING_EXTENSION_NAME "VK_EXT_legacy_dithering" -#define VK_EXT_PIPELINE_PROTECTED_ACCESS_SPEC_VERSION 1 -#define VK_EXT_PIPELINE_PROTECTED_ACCESS_EXTENSION_NAME "VK_EXT_pipeline_protected_access" -#define VK_KHR_MAINTENANCE_5_SPEC_VERSION 1 -#define VK_KHR_MAINTENANCE_5_EXTENSION_NAME "VK_KHR_maintenance5" -#define VK_KHR_RAY_TRACING_POSITION_FETCH_SPEC_VERSION 1 -#define VK_KHR_RAY_TRACING_POSITION_FETCH_EXTENSION_NAME "VK_KHR_ray_tracing_position_fetch" -#define VK_EXT_SHADER_OBJECT_SPEC_VERSION 1 -#define VK_EXT_SHADER_OBJECT_EXTENSION_NAME "VK_EXT_shader_object" -#define VK_QCOM_TILE_PROPERTIES_SPEC_VERSION 1 -#define VK_QCOM_TILE_PROPERTIES_EXTENSION_NAME "VK_QCOM_tile_properties" -#define VK_QCOM_MULTIVIEW_PER_VIEW_VIEWPORTS_SPEC_VERSION 1 -#define VK_QCOM_MULTIVIEW_PER_VIEW_VIEWPORTS_EXTENSION_NAME "VK_QCOM_multiview_per_view_viewports" -#define VK_NV_RAY_TRACING_INVOCATION_REORDER_SPEC_VERSION 1 -#define VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME "VK_NV_ray_tracing_invocation_reorder" -#define VK_NV_EXTENDED_SPARSE_ADDRESS_SPACE_SPEC_VERSION 1 -#define VK_NV_EXTENDED_SPARSE_ADDRESS_SPACE_EXTENSION_NAME "VK_NV_extended_sparse_address_space" -#define VK_EXT_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 -#define VK_EXT_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_EXT_mutable_descriptor_type" -#define VK_EXT_LAYER_SETTINGS_SPEC_VERSION 2 -#define VK_EXT_LAYER_SETTINGS_EXTENSION_NAME "VK_EXT_layer_settings" -#define VK_ARM_SHADER_CORE_BUILTINS_SPEC_VERSION 2 -#define VK_ARM_SHADER_CORE_BUILTINS_EXTENSION_NAME "VK_ARM_shader_core_builtins" -#define VK_EXT_PIPELINE_LIBRARY_GROUP_HANDLES_SPEC_VERSION 1 -#define VK_EXT_PIPELINE_LIBRARY_GROUP_HANDLES_EXTENSION_NAME "VK_EXT_pipeline_library_group_handles" -#define VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_SPEC_VERSION 1 -#define VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_EXTENSION_NAME "VK_EXT_dynamic_rendering_unused_attachments" -#define VK_NV_LOW_LATENCY_2_SPEC_VERSION 2 -#define VK_NV_LOW_LATENCY_2_EXTENSION_NAME "VK_NV_low_latency2" -#define VK_KHR_COOPERATIVE_MATRIX_SPEC_VERSION 2 -#define VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_KHR_cooperative_matrix" -#define VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION 1 -#define VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME "VK_QCOM_multiview_per_view_render_areas" -#define VK_QCOM_IMAGE_PROCESSING_2_SPEC_VERSION 1 -#define VK_QCOM_IMAGE_PROCESSING_2_EXTENSION_NAME "VK_QCOM_image_processing2" -#define VK_QCOM_FILTER_CUBIC_WEIGHTS_SPEC_VERSION 1 -#define VK_QCOM_FILTER_CUBIC_WEIGHTS_EXTENSION_NAME "VK_QCOM_filter_cubic_weights" -#define VK_QCOM_YCBCR_DEGAMMA_SPEC_VERSION 1 -#define VK_QCOM_YCBCR_DEGAMMA_EXTENSION_NAME "VK_QCOM_ycbcr_degamma" -#define VK_QCOM_FILTER_CUBIC_CLAMP_SPEC_VERSION 1 -#define VK_QCOM_FILTER_CUBIC_CLAMP_EXTENSION_NAME "VK_QCOM_filter_cubic_clamp" -#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_SPEC_VERSION 1 -#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_attachment_feedback_loop_dynamic_state" -#define VK_MSFT_LAYERED_DRIVER_SPEC_VERSION 1 -#define VK_MSFT_LAYERED_DRIVER_EXTENSION_NAME "VK_MSFT_layered_driver" -#define VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_SPEC_VERSION 1 -#define VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME "VK_NV_descriptor_pool_overallocation" -#define VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION 13 -#define VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME "VK_KHR_acceleration_structure" -#define VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION 1 -#define VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME "VK_KHR_ray_tracing_pipeline" -#define VK_KHR_RAY_QUERY_SPEC_VERSION 1 -#define VK_KHR_RAY_QUERY_EXTENSION_NAME "VK_KHR_ray_query" -#define VK_EXT_MESH_SHADER_SPEC_VERSION 1 -#define VK_EXT_MESH_SHADER_EXTENSION_NAME "VK_EXT_mesh_shader" - -#define VK_MAKE_VERSION(major, minor, patch) \ - ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) -#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22U) -#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) -#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) -#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ - ((((uint32_t)(variant)) << 29U) | (((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) -#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29U) -#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22U) & 0x7FU) -#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) -#define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) -#define VKSC_API_VARIANT 1 -#define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0) -#define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0) -#define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0) -#define VK_API_VERSION_1_3 VK_MAKE_API_VERSION(0, 1, 3, 0) -#define VKSC_API_VERSION_1_0 VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0) -#define VK_HEADER_VERSION 272 -#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) -#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; -#define VK_USE_64_BIT_PTR_DEFINES 0 - -#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE - #if (VK_USE_64_BIT_PTR_DEFINES==1) - #if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)) - #define VK_NULL_HANDLE nullptr - #else - #define VK_NULL_HANDLE ((void*)0) - #endif - #else - #define VK_NULL_HANDLE 0ULL - #endif -#endif -#ifndef VK_NULL_HANDLE - #define VK_NULL_HANDLE 0 -#endif - -#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE - #if (VK_USE_64_BIT_PTR_DEFINES==1) - #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; - #else - #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; - #endif -#endif -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) -VK_DEFINE_HANDLE(VkCommandBuffer) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuFunctionNVX) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuModuleNVX) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaFunctionNV) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaModuleNV) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugUtilsMessengerEXT) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeferredOperationKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplate) -typedef VkDescriptorUpdateTemplate VkDescriptorUpdateTemplateKHR; -VK_DEFINE_HANDLE(VkDevice) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNV) -VK_DEFINE_HANDLE(VkInstance) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkMicromapEXT) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkOpticalFlowSessionNV) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPerformanceConfigurationINTEL) -VK_DEFINE_HANDLE(VkPhysicalDevice) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPrivateDataSlot) -typedef VkPrivateDataSlot VkPrivateDataSlotEXT; -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) -VK_DEFINE_HANDLE(VkQueue) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion) -typedef VkSamplerYcbcrConversion VkSamplerYcbcrConversionKHR; -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderEXT) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT) - -struct AHardwareBuffer; -struct ANativeWindow; -struct CAMetalLayer; -struct IOSurfaceRef; -struct MTLBuffer_id; -struct MTLCommandQueue_id; -struct MTLDevice_id; -struct MTLSharedEvent_id; -struct MTLTexture_id; -typedef uint32_t VkBool32; -typedef uint64_t VkDeviceAddress; -typedef uint64_t VkDeviceSize; -typedef uint32_t VkFlags; -typedef uint64_t VkFlags64; -typedef void* VkRemoteAddressNV; -typedef uint32_t VkSampleMask; - -typedef VkFlags VkAccelerationStructureCreateFlagsKHR; -typedef VkFlags VkAccelerationStructureMotionInfoFlagsNV; -typedef VkFlags VkAccelerationStructureMotionInstanceFlagsNV; -typedef VkFlags VkAccessFlags; -typedef VkFlags64 VkAccessFlags2; -typedef VkAccessFlags2 VkAccessFlags2KHR; -typedef VkFlags VkAcquireProfilingLockFlagsKHR; -typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; -typedef VkFlags VkAttachmentDescriptionFlags; -typedef VkFlags VkBufferCreateFlags; -typedef VkFlags VkBufferUsageFlags; -typedef VkFlags64 VkBufferUsageFlags2KHR; -typedef VkFlags VkBufferViewCreateFlags; -typedef VkFlags VkBuildAccelerationStructureFlagsKHR; -typedef VkBuildAccelerationStructureFlagsKHR VkBuildAccelerationStructureFlagsNV; -typedef VkFlags VkBuildMicromapFlagsEXT; -typedef VkFlags VkColorComponentFlags; -typedef VkFlags VkCommandBufferResetFlags; -typedef VkFlags VkCommandBufferUsageFlags; -typedef VkFlags VkCommandPoolCreateFlags; -typedef VkFlags VkCommandPoolResetFlags; -typedef VkFlags VkCommandPoolTrimFlags; -typedef VkCommandPoolTrimFlags VkCommandPoolTrimFlagsKHR; -typedef VkFlags VkCompositeAlphaFlagsKHR; -typedef VkFlags VkConditionalRenderingFlagsEXT; -typedef VkFlags VkCullModeFlags; -typedef VkFlags VkDebugReportFlagsEXT; -typedef VkFlags VkDebugUtilsMessageSeverityFlagsEXT; -typedef VkFlags VkDebugUtilsMessageTypeFlagsEXT; -typedef VkFlags VkDebugUtilsMessengerCallbackDataFlagsEXT; -typedef VkFlags VkDebugUtilsMessengerCreateFlagsEXT; -typedef VkFlags VkDependencyFlags; -typedef VkFlags VkDescriptorBindingFlags; -typedef VkDescriptorBindingFlags VkDescriptorBindingFlagsEXT; -typedef VkFlags VkDescriptorPoolCreateFlags; -typedef VkFlags VkDescriptorPoolResetFlags; -typedef VkFlags VkDescriptorSetLayoutCreateFlags; -typedef VkFlags VkDescriptorUpdateTemplateCreateFlags; -typedef VkDescriptorUpdateTemplateCreateFlags VkDescriptorUpdateTemplateCreateFlagsKHR; -typedef VkFlags VkDeviceAddressBindingFlagsEXT; -typedef VkFlags VkDeviceCreateFlags; -typedef VkFlags VkDeviceDiagnosticsConfigFlagsNV; -typedef VkFlags VkDeviceGroupPresentModeFlagsKHR; -typedef VkFlags VkDeviceMemoryReportFlagsEXT; -typedef VkFlags VkDeviceQueueCreateFlags; -typedef VkFlags VkDirectDriverLoadingFlagsLUNARG; -typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; -typedef VkFlags VkDisplayModeCreateFlagsKHR; -typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; -typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; -typedef VkFlags VkEventCreateFlags; -typedef VkFlags VkExportMetalObjectTypeFlagsEXT; -typedef VkFlags VkExternalFenceFeatureFlags; -typedef VkExternalFenceFeatureFlags VkExternalFenceFeatureFlagsKHR; -typedef VkFlags VkExternalFenceHandleTypeFlags; -typedef VkExternalFenceHandleTypeFlags VkExternalFenceHandleTypeFlagsKHR; -typedef VkFlags VkExternalMemoryFeatureFlags; -typedef VkExternalMemoryFeatureFlags VkExternalMemoryFeatureFlagsKHR; -typedef VkFlags VkExternalMemoryFeatureFlagsNV; -typedef VkFlags VkExternalMemoryHandleTypeFlags; -typedef VkExternalMemoryHandleTypeFlags VkExternalMemoryHandleTypeFlagsKHR; -typedef VkFlags VkExternalMemoryHandleTypeFlagsNV; -typedef VkFlags VkExternalSemaphoreFeatureFlags; -typedef VkExternalSemaphoreFeatureFlags VkExternalSemaphoreFeatureFlagsKHR; -typedef VkFlags VkExternalSemaphoreHandleTypeFlags; -typedef VkExternalSemaphoreHandleTypeFlags VkExternalSemaphoreHandleTypeFlagsKHR; -typedef VkFlags VkFenceCreateFlags; -typedef VkFlags VkFenceImportFlags; -typedef VkFenceImportFlags VkFenceImportFlagsKHR; -typedef VkFlags VkFormatFeatureFlags; -typedef VkFlags64 VkFormatFeatureFlags2; -typedef VkFormatFeatureFlags2 VkFormatFeatureFlags2KHR; -typedef VkFlags VkFrameBoundaryFlagsEXT; -typedef VkFlags VkFramebufferCreateFlags; -typedef VkFlags VkGeometryFlagsKHR; -typedef VkGeometryFlagsKHR VkGeometryFlagsNV; -typedef VkFlags VkGeometryInstanceFlagsKHR; -typedef VkGeometryInstanceFlagsKHR VkGeometryInstanceFlagsNV; -typedef VkFlags VkGraphicsPipelineLibraryFlagsEXT; -typedef VkFlags VkHeadlessSurfaceCreateFlagsEXT; -typedef VkFlags VkHostImageCopyFlagsEXT; -typedef VkFlags VkIOSSurfaceCreateFlagsMVK; -typedef VkFlags VkImageAspectFlags; -typedef VkFlags VkImageCompressionFixedRateFlagsEXT; -typedef VkFlags VkImageCompressionFlagsEXT; -typedef VkFlags VkImageConstraintsInfoFlagsFUCHSIA; -typedef VkFlags VkImageCreateFlags; -typedef VkFlags VkImageFormatConstraintsFlagsFUCHSIA; -typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA; -typedef VkFlags VkImageUsageFlags; -typedef VkFlags VkImageViewCreateFlags; -typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNV; -typedef VkFlags VkIndirectStateFlagsNV; -typedef VkFlags VkInstanceCreateFlags; -typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; -typedef VkFlags VkMemoryAllocateFlags; -typedef VkMemoryAllocateFlags VkMemoryAllocateFlagsKHR; -typedef VkFlags64 VkMemoryDecompressionMethodFlagsNV; -typedef VkFlags VkMemoryHeapFlags; -typedef VkFlags VkMemoryMapFlags; -typedef VkFlags VkMemoryPropertyFlags; -typedef VkFlags VkMemoryUnmapFlagsKHR; -typedef VkFlags VkMetalSurfaceCreateFlagsEXT; -typedef VkFlags VkMicromapCreateFlagsEXT; -typedef VkFlags VkOpticalFlowExecuteFlagsNV; -typedef VkFlags VkOpticalFlowGridSizeFlagsNV; -typedef VkFlags VkOpticalFlowSessionCreateFlagsNV; -typedef VkFlags VkOpticalFlowUsageFlagsNV; -typedef VkFlags VkPeerMemoryFeatureFlags; -typedef VkPeerMemoryFeatureFlags VkPeerMemoryFeatureFlagsKHR; -typedef VkFlags VkPerformanceCounterDescriptionFlagsKHR; -typedef VkFlags64 VkPhysicalDeviceSchedulingControlsFlagsARM; -typedef VkFlags VkPipelineCacheCreateFlags; -typedef VkFlags VkPipelineColorBlendStateCreateFlags; -typedef VkFlags VkPipelineColorBlendStateCreateFlags; -typedef VkFlags VkPipelineCompilerControlFlagsAMD; -typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; -typedef VkFlags VkPipelineCoverageReductionStateCreateFlagsNV; -typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; -typedef VkFlags VkPipelineCreateFlags; -typedef VkFlags64 VkPipelineCreateFlags2KHR; -typedef VkFlags VkPipelineCreationFeedbackFlags; -typedef VkPipelineCreationFeedbackFlags VkPipelineCreationFeedbackFlagsEXT; -typedef VkFlags VkPipelineDepthStencilStateCreateFlags; -typedef VkFlags VkPipelineDepthStencilStateCreateFlags; -typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT; -typedef VkFlags VkPipelineDynamicStateCreateFlags; -typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; -typedef VkFlags VkPipelineLayoutCreateFlags; -typedef VkFlags VkPipelineMultisampleStateCreateFlags; -typedef VkFlags VkPipelineRasterizationConservativeStateCreateFlagsEXT; -typedef VkFlags VkPipelineRasterizationDepthClipStateCreateFlagsEXT; -typedef VkFlags VkPipelineRasterizationStateCreateFlags; -typedef VkFlags VkPipelineRasterizationStateStreamCreateFlagsEXT; -typedef VkFlags VkPipelineShaderStageCreateFlags; -typedef VkFlags VkPipelineStageFlags; -typedef VkFlags64 VkPipelineStageFlags2; -typedef VkPipelineStageFlags2 VkPipelineStageFlags2KHR; -typedef VkFlags VkPipelineTessellationStateCreateFlags; -typedef VkFlags VkPipelineVertexInputStateCreateFlags; -typedef VkFlags VkPipelineViewportStateCreateFlags; -typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV; -typedef VkFlags VkPresentGravityFlagsEXT; -typedef VkFlags VkPresentScalingFlagsEXT; -typedef VkFlags VkPrivateDataSlotCreateFlags; -typedef VkPrivateDataSlotCreateFlags VkPrivateDataSlotCreateFlagsEXT; -typedef VkFlags VkQueryControlFlags; -typedef VkFlags VkQueryPipelineStatisticFlags; -typedef VkFlags VkQueryPoolCreateFlags; -typedef VkFlags VkQueryResultFlags; -typedef VkFlags VkQueueFlags; -typedef VkFlags VkRefreshObjectFlagsKHR; -typedef VkFlags VkRenderPassCreateFlags; -typedef VkFlags VkRenderingFlags; -typedef VkRenderingFlags VkRenderingFlagsKHR; -typedef VkFlags VkResolveModeFlags; -typedef VkResolveModeFlags VkResolveModeFlagsKHR; -typedef VkFlags VkSampleCountFlags; -typedef VkFlags VkSamplerCreateFlags; -typedef VkFlags VkScreenSurfaceCreateFlagsQNX; -typedef VkFlags VkSemaphoreCreateFlags; -typedef VkFlags VkSemaphoreImportFlags; -typedef VkSemaphoreImportFlags VkSemaphoreImportFlagsKHR; -typedef VkFlags VkSemaphoreWaitFlags; -typedef VkSemaphoreWaitFlags VkSemaphoreWaitFlagsKHR; -typedef VkFlags VkShaderCorePropertiesFlagsAMD; -typedef VkFlags VkShaderCreateFlagsEXT; -typedef VkFlags VkShaderModuleCreateFlags; -typedef VkFlags VkShaderStageFlags; -typedef VkFlags VkSparseImageFormatFlags; -typedef VkFlags VkSparseMemoryBindFlags; -typedef VkFlags VkStencilFaceFlags; -typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; -typedef VkFlags VkSubgroupFeatureFlags; -typedef VkFlags VkSubmitFlags; -typedef VkSubmitFlags VkSubmitFlagsKHR; -typedef VkFlags VkSubpassDescriptionFlags; -typedef VkFlags VkSurfaceCounterFlagsEXT; -typedef VkFlags VkSurfaceTransformFlagsKHR; -typedef VkFlags VkSwapchainCreateFlagsKHR; -typedef VkFlags VkSwapchainImageUsageFlagsANDROID; -typedef VkFlags VkToolPurposeFlags; -typedef VkToolPurposeFlags VkToolPurposeFlagsEXT; -typedef VkFlags VkValidationCacheCreateFlagsEXT; -typedef VkFlags VkViSurfaceCreateFlagsNN; -typedef VkFlags VkVideoBeginCodingFlagsKHR; -typedef VkFlags VkVideoCapabilityFlagsKHR; -typedef VkFlags VkVideoChromaSubsamplingFlagsKHR; -typedef VkFlags VkVideoCodecOperationFlagsKHR; -typedef VkFlags VkVideoCodingControlFlagsKHR; -typedef VkFlags VkVideoComponentBitDepthFlagsKHR; -typedef VkFlags VkVideoDecodeCapabilityFlagsKHR; -typedef VkFlags VkVideoDecodeFlagsKHR; -typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsKHR; -typedef VkFlags VkVideoDecodeUsageFlagsKHR; -typedef VkFlags VkVideoEncodeCapabilityFlagsKHR; -typedef VkFlags VkVideoEncodeContentFlagsKHR; -typedef VkFlags VkVideoEncodeFeedbackFlagsKHR; -typedef VkFlags VkVideoEncodeFlagsKHR; -typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT; -typedef VkFlags VkVideoEncodeH264RateControlFlagsEXT; -typedef VkFlags VkVideoEncodeH264StdFlagsEXT; -typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT; -typedef VkFlags VkVideoEncodeH265CtbSizeFlagsEXT; -typedef VkFlags VkVideoEncodeH265RateControlFlagsEXT; -typedef VkFlags VkVideoEncodeH265StdFlagsEXT; -typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsEXT; -typedef VkFlags VkVideoEncodeRateControlFlagsKHR; -typedef VkFlags VkVideoEncodeRateControlModeFlagsKHR; -typedef VkFlags VkVideoEncodeUsageFlagsKHR; -typedef VkFlags VkVideoEndCodingFlagsKHR; -typedef VkFlags VkVideoSessionCreateFlagsKHR; -typedef VkFlags VkVideoSessionParametersCreateFlagsKHR; -typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; -typedef VkFlags VkWin32SurfaceCreateFlagsKHR; -typedef VkFlags VkXcbSurfaceCreateFlagsKHR; -typedef VkFlags VkXlibSurfaceCreateFlagsKHR; - -typedef enum VkAccelerationStructureBuildTypeKHR -{ - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR = 0, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR = 1, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR = 2, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_KHR_MAX_ENUM = 0x7fffffff, -} VkAccelerationStructureBuildTypeKHR; - -typedef enum VkAccelerationStructureCompatibilityKHR -{ - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR = 0, - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR = 1, - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_KHR_MAX_ENUM = 0x7fffffff, -} VkAccelerationStructureCompatibilityKHR; - -typedef enum VkAccelerationStructureCreateFlagBitsKHR -{ - VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = 0x00000001, - VK_ACCELERATION_STRUCTURE_CREATE_MOTION_BIT_NV = 0x00000004, - VK_ACCELERATION_STRUCTURE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000008, - VK_ACCELERATION_STRUCTURE_CREATE_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkAccelerationStructureCreateFlagBitsKHR; - -typedef enum VkAccelerationStructureMemoryRequirementsTypeNV -{ - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV = 0, - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV = 1, - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV = 2, - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_NV_MAX_ENUM = 0x7fffffff, -} VkAccelerationStructureMemoryRequirementsTypeNV; - -typedef enum VkAccelerationStructureMotionInstanceTypeNV -{ - VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_STATIC_NV = 0, - VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_MATRIX_MOTION_NV = 1, - VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_SRT_MOTION_NV = 2, - VK_ACCELERATION_STRUCTURE_MOTION_INSTANCE_TYPE_NV_MAX_ENUM = 0x7fffffff, -} VkAccelerationStructureMotionInstanceTypeNV; - -typedef enum VkAccelerationStructureTypeKHR -{ - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR = 0, - VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR = 1, - VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR = 2, - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, - VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR, - VK_ACCELERATION_STRUCTURE_TYPE_KHR_MAX_ENUM = 0x7fffffff, -} VkAccelerationStructureTypeKHR; -typedef VkAccelerationStructureTypeKHR VkAccelerationStructureTypeNV; - -typedef enum VkAccessFlagBits -{ - VK_ACCESS_NONE = 0, - VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, - VK_ACCESS_INDEX_READ_BIT = 0x00000002, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, - VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, - VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, - VK_ACCESS_SHADER_READ_BIT = 0x00000020, - VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, - VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, - VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, - VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, - VK_ACCESS_HOST_READ_BIT = 0x00002000, - VK_ACCESS_HOST_WRITE_BIT = 0x00004000, - VK_ACCESS_MEMORY_READ_BIT = 0x00008000, - VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, - VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV = 0x00020000, - VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV = 0x00040000, - VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000, - VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT = 0x00100000, - VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR = 0x00200000, - VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR = 0x00400000, - VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR = 0x00800000, - VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = 0x01000000, - VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT = 0x02000000, - VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT = 0x04000000, - VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT = 0x08000000, - VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV = VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR, - VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV = VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR, - VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV = VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR, - VK_ACCESS_NONE_KHR = VK_ACCESS_NONE, - VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkAccessFlagBits; - -typedef VkFlags64 VkAccessFlagBits2; - -static const VkAccessFlagBits2 VK_ACCESS_2_NONE = 0ull; -static const VkAccessFlagBits2 VK_ACCESS_2_NONE_KHR = 0ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT = 0x00000001ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 0x00000001ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INDEX_READ_BIT = 0x00000002ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INDEX_READ_BIT_KHR = 0x00000002ull; -static const VkAccessFlagBits2 VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004ull; -static const VkAccessFlagBits2 VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR = 0x00000004ull; -static const VkAccessFlagBits2 VK_ACCESS_2_UNIFORM_READ_BIT = 0x00000008ull; -static const VkAccessFlagBits2 VK_ACCESS_2_UNIFORM_READ_BIT_KHR = 0x00000008ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT = 0x00000010ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR = 0x00000010ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_READ_BIT = 0x00000020ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_READ_BIT_KHR = 0x00000020ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_WRITE_BIT = 0x00000040ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_WRITE_BIT_KHR = 0x00000040ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT = 0x00000080ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR = 0x00000080ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR = 0x00000100ull; -static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200ull; -static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR = 0x00000200ull; -static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400ull; -static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR = 0x00000400ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_READ_BIT = 0x00000800ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_READ_BIT_KHR = 0x00000800ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_WRITE_BIT = 0x00001000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR = 0x00001000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_HOST_READ_BIT = 0x00002000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_HOST_READ_BIT_KHR = 0x00002000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_HOST_WRITE_BIT = 0x00004000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_HOST_WRITE_BIT_KHR = 0x00004000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_READ_BIT = 0x00008000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_READ_BIT_KHR = 0x00008000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_WRITE_BIT = 0x00010000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_WRITE_BIT_KHR = 0x00010000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COMMAND_PREPROCESS_READ_BIT_NV = 0x00020000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COMMAND_PREPROCESS_WRITE_BIT_NV = 0x00040000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_CONDITIONAL_RENDERING_READ_BIT_EXT = 0x00100000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR = 0x00200000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_NV = 0x00200000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR = 0x00400000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_NV = 0x00400000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR = 0x00800000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV = 0x00800000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = 0x01000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT = 0x02000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT = 0x04000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT = 0x08000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 0x100000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR = 0x100000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT = 0x200000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR = 0x200000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT = 0x400000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR = 0x400000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI = 0x8000000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_BINDING_TABLE_READ_BIT_KHR = 0x10000000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT = 0x20000000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_OPTICAL_FLOW_READ_BIT_NV = 0x40000000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_OPTICAL_FLOW_WRITE_BIT_NV = 0x80000000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_MICROMAP_READ_BIT_EXT = 0x100000000000ull; -static const VkAccessFlagBits2 VK_ACCESS_2_MICROMAP_WRITE_BIT_EXT = 0x200000000000ull; -typedef VkAccessFlagBits2 VkAccessFlagBits2KHR; - -typedef enum VkAcquireProfilingLockFlagBitsKHR -{ - VK_ACQUIRE_PROFILING_LOCK_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkAcquireProfilingLockFlagBitsKHR; - -typedef enum VkAttachmentDescriptionFlagBits -{ - VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, - VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkAttachmentDescriptionFlagBits; - -typedef enum VkAttachmentLoadOp -{ - VK_ATTACHMENT_LOAD_OP_LOAD = 0, - VK_ATTACHMENT_LOAD_OP_CLEAR = 1, - VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, - VK_ATTACHMENT_LOAD_OP_NONE_EXT = 1000400000, - VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7fffffff, -} VkAttachmentLoadOp; - -typedef enum VkAttachmentStoreOp -{ - VK_ATTACHMENT_STORE_OP_STORE = 0, - VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, - VK_ATTACHMENT_STORE_OP_NONE = 1000301000, - VK_ATTACHMENT_STORE_OP_NONE_KHR = VK_ATTACHMENT_STORE_OP_NONE, - VK_ATTACHMENT_STORE_OP_NONE_QCOM = VK_ATTACHMENT_STORE_OP_NONE, - VK_ATTACHMENT_STORE_OP_NONE_EXT = VK_ATTACHMENT_STORE_OP_NONE, - VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7fffffff, -} VkAttachmentStoreOp; - -typedef enum VkBlendFactor -{ - VK_BLEND_FACTOR_ZERO = 0, - VK_BLEND_FACTOR_ONE = 1, - VK_BLEND_FACTOR_SRC_COLOR = 2, - VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, - VK_BLEND_FACTOR_DST_COLOR = 4, - VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, - VK_BLEND_FACTOR_SRC_ALPHA = 6, - VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, - VK_BLEND_FACTOR_DST_ALPHA = 8, - VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, - VK_BLEND_FACTOR_CONSTANT_COLOR = 10, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, - VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, - VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, - VK_BLEND_FACTOR_SRC1_COLOR = 15, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, - VK_BLEND_FACTOR_SRC1_ALPHA = 17, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, - VK_BLEND_FACTOR_MAX_ENUM = 0x7fffffff, -} VkBlendFactor; - -typedef enum VkBlendOp -{ - VK_BLEND_OP_ADD = 0, - VK_BLEND_OP_SUBTRACT = 1, - VK_BLEND_OP_REVERSE_SUBTRACT = 2, - VK_BLEND_OP_MIN = 3, - VK_BLEND_OP_MAX = 4, - VK_BLEND_OP_ZERO_EXT = 1000148000, - VK_BLEND_OP_SRC_EXT = 1000148001, - VK_BLEND_OP_DST_EXT = 1000148002, - VK_BLEND_OP_SRC_OVER_EXT = 1000148003, - VK_BLEND_OP_DST_OVER_EXT = 1000148004, - VK_BLEND_OP_SRC_IN_EXT = 1000148005, - VK_BLEND_OP_DST_IN_EXT = 1000148006, - VK_BLEND_OP_SRC_OUT_EXT = 1000148007, - VK_BLEND_OP_DST_OUT_EXT = 1000148008, - VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, - VK_BLEND_OP_DST_ATOP_EXT = 1000148010, - VK_BLEND_OP_XOR_EXT = 1000148011, - VK_BLEND_OP_MULTIPLY_EXT = 1000148012, - VK_BLEND_OP_SCREEN_EXT = 1000148013, - VK_BLEND_OP_OVERLAY_EXT = 1000148014, - VK_BLEND_OP_DARKEN_EXT = 1000148015, - VK_BLEND_OP_LIGHTEN_EXT = 1000148016, - VK_BLEND_OP_COLORDODGE_EXT = 1000148017, - VK_BLEND_OP_COLORBURN_EXT = 1000148018, - VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, - VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, - VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, - VK_BLEND_OP_EXCLUSION_EXT = 1000148022, - VK_BLEND_OP_INVERT_EXT = 1000148023, - VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, - VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, - VK_BLEND_OP_LINEARBURN_EXT = 1000148026, - VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, - VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, - VK_BLEND_OP_PINLIGHT_EXT = 1000148029, - VK_BLEND_OP_HARDMIX_EXT = 1000148030, - VK_BLEND_OP_HSL_HUE_EXT = 1000148031, - VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, - VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, - VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, - VK_BLEND_OP_PLUS_EXT = 1000148035, - VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, - VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, - VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, - VK_BLEND_OP_MINUS_EXT = 1000148039, - VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, - VK_BLEND_OP_CONTRAST_EXT = 1000148041, - VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, - VK_BLEND_OP_RED_EXT = 1000148043, - VK_BLEND_OP_GREEN_EXT = 1000148044, - VK_BLEND_OP_BLUE_EXT = 1000148045, - VK_BLEND_OP_MAX_ENUM = 0x7fffffff, -} VkBlendOp; - -typedef enum VkBlendOverlapEXT -{ - VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, - VK_BLEND_OVERLAP_DISJOINT_EXT = 1, - VK_BLEND_OVERLAP_CONJOINT_EXT = 2, - VK_BLEND_OVERLAP_EXT_MAX_ENUM = 0x7fffffff, -} VkBlendOverlapEXT; - -typedef enum VkBlockMatchWindowCompareModeQCOM -{ - VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MIN_QCOM = 0, - VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MAX_QCOM = 1, - VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_QCOM_MAX_ENUM = 0x7fffffff, -} VkBlockMatchWindowCompareModeQCOM; - -typedef enum VkBorderColor -{ - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, - VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, - VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, - VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, - VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, - VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, - VK_BORDER_COLOR_FLOAT_CUSTOM_EXT = 1000287003, - VK_BORDER_COLOR_INT_CUSTOM_EXT = 1000287004, - VK_BORDER_COLOR_MAX_ENUM = 0x7fffffff, -} VkBorderColor; - -typedef enum VkBufferCreateFlagBits -{ - VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, - VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, - VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, - VK_BUFFER_CREATE_PROTECTED_BIT = 0x00000008, - VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 0x00000010, - VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000020, - VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, - VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, - VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkBufferCreateFlagBits; - -typedef enum VkBufferUsageFlagBits -{ - VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, - VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, - VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, - VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, - VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, - VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, - VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, - VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, - VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, - VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200, - VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400, - VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800, - VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 0x00020000, - VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000, - VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000, - VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT = 0x00200000, - VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00400000, - VK_BUFFER_USAGE_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT = 0x00800000, - VK_BUFFER_USAGE_MICROMAP_STORAGE_BIT_EXT = 0x01000000, - VK_BUFFER_USAGE_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT = 0x04000000, - VK_BUFFER_USAGE_RAY_TRACING_BIT_NV = VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkBufferUsageFlagBits; - -typedef VkFlags64 VkBufferUsageFlagBits2KHR; - -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR = 0x00000001ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFER_DST_BIT_KHR = 0x00000002ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR = 0x00000004ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_STORAGE_TEXEL_BUFFER_BIT_KHR = 0x00000008ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_UNIFORM_BUFFER_BIT_KHR = 0x00000010ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR = 0x00000020ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_INDEX_BUFFER_BIT_KHR = 0x00000040ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VERTEX_BUFFER_BIT_KHR = 0x00000080ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_INDIRECT_BUFFER_BIT_KHR = 0x00000100ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_RAY_TRACING_BIT_NV = 0x00000400ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_DECODE_SRC_BIT_KHR = 0x00002000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_DECODE_DST_BIT_KHR = 0x00004000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_ENCODE_DST_BIT_KHR = 0x00008000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_ENCODE_SRC_BIT_KHR = 0x00010000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT_KHR = 0x00020000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT = 0x00200000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00400000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT = 0x00800000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_MICROMAP_STORAGE_BIT_EXT = 0x01000000ull; -static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT = 0x04000000ull; - -typedef enum VkBuildAccelerationStructureFlagBitsKHR -{ - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR = 0x00000001, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR = 0x00000002, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR = 0x00000004, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR = 0x00000008, - VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR = 0x00000010, - VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV = 0x00000020, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT = 0x00000040, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISABLE_OPACITY_MICROMAPS_EXT = 0x00000080, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT = 0x00000100, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DATA_ACCESS_KHR = 0x00000800, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkBuildAccelerationStructureFlagBitsKHR; -typedef VkBuildAccelerationStructureFlagBitsKHR VkBuildAccelerationStructureFlagBitsNV; - -typedef enum VkBuildAccelerationStructureModeKHR -{ - VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR = 0, - VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR = 1, - VK_BUILD_ACCELERATION_STRUCTURE_MODE_KHR_MAX_ENUM = 0x7fffffff, -} VkBuildAccelerationStructureModeKHR; - -typedef enum VkBuildMicromapFlagBitsEXT -{ - VK_BUILD_MICROMAP_PREFER_FAST_TRACE_BIT_EXT = 0x00000001, - VK_BUILD_MICROMAP_PREFER_FAST_BUILD_BIT_EXT = 0x00000002, - VK_BUILD_MICROMAP_ALLOW_COMPACTION_BIT_EXT = 0x00000004, - VK_BUILD_MICROMAP_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkBuildMicromapFlagBitsEXT; - -typedef enum VkBuildMicromapModeEXT -{ - VK_BUILD_MICROMAP_MODE_BUILD_EXT = 0, - VK_BUILD_MICROMAP_MODE_EXT_MAX_ENUM = 0x7fffffff, -} VkBuildMicromapModeEXT; - -typedef enum VkChromaLocation -{ - VK_CHROMA_LOCATION_COSITED_EVEN = 0, - VK_CHROMA_LOCATION_MIDPOINT = 1, - VK_CHROMA_LOCATION_COSITED_EVEN_KHR = VK_CHROMA_LOCATION_COSITED_EVEN, - VK_CHROMA_LOCATION_MIDPOINT_KHR = VK_CHROMA_LOCATION_MIDPOINT, - VK_CHROMA_LOCATION_MAX_ENUM = 0x7fffffff, -} VkChromaLocation; -typedef VkChromaLocation VkChromaLocationKHR; - -typedef enum VkCoarseSampleOrderTypeNV -{ - VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV = 0, - VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV = 1, - VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV = 2, - VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV = 3, - VK_COARSE_SAMPLE_ORDER_TYPE_NV_MAX_ENUM = 0x7fffffff, -} VkCoarseSampleOrderTypeNV; - -typedef enum VkColorComponentFlagBits -{ - VK_COLOR_COMPONENT_R_BIT = 0x00000001, - VK_COLOR_COMPONENT_G_BIT = 0x00000002, - VK_COLOR_COMPONENT_B_BIT = 0x00000004, - VK_COLOR_COMPONENT_A_BIT = 0x00000008, - VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkColorComponentFlagBits; - -typedef enum VkColorSpaceKHR -{ - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, - VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, - VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, - VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104003, - VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, - VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, - VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, - VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, - VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, - VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, - VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, - VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, - VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, - VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, - VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, - VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, - VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT, - VK_COLOR_SPACE_KHR_MAX_ENUM = 0x7fffffff, -} VkColorSpaceKHR; - -typedef enum VkCommandBufferLevel -{ - VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, - VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, - VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7fffffff, -} VkCommandBufferLevel; - -typedef enum VkCommandBufferResetFlagBits -{ - VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, - VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkCommandBufferResetFlagBits; - -typedef enum VkCommandBufferUsageFlagBits -{ - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, - VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, - VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, - VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkCommandBufferUsageFlagBits; - -typedef enum VkCommandPoolCreateFlagBits -{ - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, - VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, - VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 0x00000004, - VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkCommandPoolCreateFlagBits; - -typedef enum VkCommandPoolResetFlagBits -{ - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, - VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkCommandPoolResetFlagBits; - -typedef enum VkCompareOp -{ - VK_COMPARE_OP_NEVER = 0, - VK_COMPARE_OP_LESS = 1, - VK_COMPARE_OP_EQUAL = 2, - VK_COMPARE_OP_LESS_OR_EQUAL = 3, - VK_COMPARE_OP_GREATER = 4, - VK_COMPARE_OP_NOT_EQUAL = 5, - VK_COMPARE_OP_GREATER_OR_EQUAL = 6, - VK_COMPARE_OP_ALWAYS = 7, - VK_COMPARE_OP_MAX_ENUM = 0x7fffffff, -} VkCompareOp; - -typedef enum VkComponentSwizzle -{ - VK_COMPONENT_SWIZZLE_IDENTITY = 0, - VK_COMPONENT_SWIZZLE_ZERO = 1, - VK_COMPONENT_SWIZZLE_ONE = 2, - VK_COMPONENT_SWIZZLE_R = 3, - VK_COMPONENT_SWIZZLE_G = 4, - VK_COMPONENT_SWIZZLE_B = 5, - VK_COMPONENT_SWIZZLE_A = 6, - VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7fffffff, -} VkComponentSwizzle; - -typedef enum VkComponentTypeKHR -{ - VK_COMPONENT_TYPE_FLOAT16_KHR = 0, - VK_COMPONENT_TYPE_FLOAT32_KHR = 1, - VK_COMPONENT_TYPE_FLOAT64_KHR = 2, - VK_COMPONENT_TYPE_SINT8_KHR = 3, - VK_COMPONENT_TYPE_SINT16_KHR = 4, - VK_COMPONENT_TYPE_SINT32_KHR = 5, - VK_COMPONENT_TYPE_SINT64_KHR = 6, - VK_COMPONENT_TYPE_UINT8_KHR = 7, - VK_COMPONENT_TYPE_UINT16_KHR = 8, - VK_COMPONENT_TYPE_UINT32_KHR = 9, - VK_COMPONENT_TYPE_UINT64_KHR = 10, - VK_COMPONENT_TYPE_FLOAT16_NV = VK_COMPONENT_TYPE_FLOAT16_KHR, - VK_COMPONENT_TYPE_FLOAT32_NV = VK_COMPONENT_TYPE_FLOAT32_KHR, - VK_COMPONENT_TYPE_FLOAT64_NV = VK_COMPONENT_TYPE_FLOAT64_KHR, - VK_COMPONENT_TYPE_SINT8_NV = VK_COMPONENT_TYPE_SINT8_KHR, - VK_COMPONENT_TYPE_SINT16_NV = VK_COMPONENT_TYPE_SINT16_KHR, - VK_COMPONENT_TYPE_SINT32_NV = VK_COMPONENT_TYPE_SINT32_KHR, - VK_COMPONENT_TYPE_SINT64_NV = VK_COMPONENT_TYPE_SINT64_KHR, - VK_COMPONENT_TYPE_UINT8_NV = VK_COMPONENT_TYPE_UINT8_KHR, - VK_COMPONENT_TYPE_UINT16_NV = VK_COMPONENT_TYPE_UINT16_KHR, - VK_COMPONENT_TYPE_UINT32_NV = VK_COMPONENT_TYPE_UINT32_KHR, - VK_COMPONENT_TYPE_UINT64_NV = VK_COMPONENT_TYPE_UINT64_KHR, - VK_COMPONENT_TYPE_KHR_MAX_ENUM = 0x7fffffff, -} VkComponentTypeKHR; -typedef VkComponentTypeKHR VkComponentTypeNV; - -typedef enum VkCompositeAlphaFlagBitsKHR -{ - VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, - VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, - VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, - VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, - VK_COMPOSITE_ALPHA_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkCompositeAlphaFlagBitsKHR; - -typedef enum VkConditionalRenderingFlagBitsEXT -{ - VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT = 0x00000001, - VK_CONDITIONAL_RENDERING_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkConditionalRenderingFlagBitsEXT; - -typedef enum VkConservativeRasterizationModeEXT -{ - VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = 0, - VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = 1, - VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = 2, - VK_CONSERVATIVE_RASTERIZATION_MODE_EXT_MAX_ENUM = 0x7fffffff, -} VkConservativeRasterizationModeEXT; - -typedef enum VkCopyAccelerationStructureModeKHR -{ - VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR = 0, - VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR = 1, - VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR = 2, - VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR = 3, - VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV = VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR, - VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV = VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR, - VK_COPY_ACCELERATION_STRUCTURE_MODE_KHR_MAX_ENUM = 0x7fffffff, -} VkCopyAccelerationStructureModeKHR; -typedef VkCopyAccelerationStructureModeKHR VkCopyAccelerationStructureModeNV; - -typedef enum VkCopyMicromapModeEXT -{ - VK_COPY_MICROMAP_MODE_CLONE_EXT = 0, - VK_COPY_MICROMAP_MODE_SERIALIZE_EXT = 1, - VK_COPY_MICROMAP_MODE_DESERIALIZE_EXT = 2, - VK_COPY_MICROMAP_MODE_COMPACT_EXT = 3, - VK_COPY_MICROMAP_MODE_EXT_MAX_ENUM = 0x7fffffff, -} VkCopyMicromapModeEXT; - -typedef enum VkCoverageModulationModeNV -{ - VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, - VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, - VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, - VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, - VK_COVERAGE_MODULATION_MODE_NV_MAX_ENUM = 0x7fffffff, -} VkCoverageModulationModeNV; - -typedef enum VkCoverageReductionModeNV -{ - VK_COVERAGE_REDUCTION_MODE_MERGE_NV = 0, - VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV = 1, - VK_COVERAGE_REDUCTION_MODE_NV_MAX_ENUM = 0x7fffffff, -} VkCoverageReductionModeNV; - -typedef enum VkCubicFilterWeightsQCOM -{ - VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM = 0, - VK_CUBIC_FILTER_WEIGHTS_ZERO_TANGENT_CARDINAL_QCOM = 1, - VK_CUBIC_FILTER_WEIGHTS_B_SPLINE_QCOM = 2, - VK_CUBIC_FILTER_WEIGHTS_MITCHELL_NETRAVALI_QCOM = 3, - VK_CUBIC_FILTER_WEIGHTS_QCOM_MAX_ENUM = 0x7fffffff, -} VkCubicFilterWeightsQCOM; - -typedef enum VkCullModeFlagBits -{ - VK_CULL_MODE_NONE = 0, - VK_CULL_MODE_FRONT_BIT = 0x00000001, - VK_CULL_MODE_BACK_BIT = 0x00000002, - VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, - VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkCullModeFlagBits; - -typedef enum VkDebugReportFlagBitsEXT -{ - VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, - VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, - VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, - VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, - VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, - VK_DEBUG_REPORT_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkDebugReportFlagBitsEXT; - -typedef enum VkDebugReportObjectTypeEXT -{ - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, - VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, - VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, - VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, - VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, - VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, - VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, - VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, - VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, - VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, - VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, - VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, - VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, - VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, - VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, - VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, - VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, - VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, - VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, - VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, - VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, - VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, - VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, - VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, - VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, - VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, - VK_DEBUG_REPORT_OBJECT_TYPE_CU_MODULE_NVX_EXT = 1000029000, - VK_DEBUG_REPORT_OBJECT_TYPE_CU_FUNCTION_NVX_EXT = 1000029001, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000, - VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT = 1000150000, - VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000, - VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT = 1000165000, - VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_MODULE_NV_EXT = 1000307000, - VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_FUNCTION_NV_EXT = 1000307001, - VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_EXT_MAX_ENUM = 0x7fffffff, -} VkDebugReportObjectTypeEXT; - -typedef enum VkDebugUtilsMessageSeverityFlagBitsEXT -{ - VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT = 0x00000001, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT = 0x00000010, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT = 0x00000100, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT = 0x00001000, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkDebugUtilsMessageSeverityFlagBitsEXT; - -typedef enum VkDebugUtilsMessageTypeFlagBitsEXT -{ - VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = 0x00000001, - VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = 0x00000002, - VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = 0x00000004, - VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT = 0x00000008, - VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkDebugUtilsMessageTypeFlagBitsEXT; - -typedef enum VkDependencyFlagBits -{ - VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, - VK_DEPENDENCY_VIEW_LOCAL_BIT = 0x00000002, - VK_DEPENDENCY_DEVICE_GROUP_BIT = 0x00000004, - VK_DEPENDENCY_FEEDBACK_LOOP_BIT_EXT = 0x00000008, - VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR = VK_DEPENDENCY_VIEW_LOCAL_BIT, - VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR = VK_DEPENDENCY_DEVICE_GROUP_BIT, - VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkDependencyFlagBits; - -typedef enum VkDepthBiasRepresentationEXT -{ - VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT = 0, - VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT = 1, - VK_DEPTH_BIAS_REPRESENTATION_FLOAT_EXT = 2, - VK_DEPTH_BIAS_REPRESENTATION_EXT_MAX_ENUM = 0x7fffffff, -} VkDepthBiasRepresentationEXT; - -typedef enum VkDescriptorBindingFlagBits -{ - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT = 0x00000001, - VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT = 0x00000002, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT = 0x00000004, - VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT = 0x00000008, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT = VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT = VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, - VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkDescriptorBindingFlagBits; -typedef VkDescriptorBindingFlagBits VkDescriptorBindingFlagBitsEXT; - -typedef enum VkDescriptorPoolCreateFlagBits -{ - VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = 0x00000002, - VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT = 0x00000004, - VK_DESCRIPTOR_POOL_CREATE_ALLOW_OVERALLOCATION_SETS_BIT_NV = 0x00000008, - VK_DESCRIPTOR_POOL_CREATE_ALLOW_OVERALLOCATION_POOLS_BIT_NV = 0x00000010, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE = VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT, - VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkDescriptorPoolCreateFlagBits; - -typedef enum VkDescriptorSetLayoutCreateFlagBits -{ - VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = 0x00000002, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_EXT = 0x00000004, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00000010, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_EMBEDDED_IMMUTABLE_SAMPLERS_BIT_EXT = 0x00000020, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00000080, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE = VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_EXT, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkDescriptorSetLayoutCreateFlagBits; - -typedef enum VkDescriptorType -{ - VK_DESCRIPTOR_TYPE_SAMPLER = 0, - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, - VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, - VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, - VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, - VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK = 1000138000, - VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, - VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, - VK_DESCRIPTOR_TYPE_MUTABLE_EXT = 1000351000, - VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM = 1000440000, - VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM = 1000440001, - VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT = VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK, - VK_DESCRIPTOR_TYPE_MUTABLE_VALVE = VK_DESCRIPTOR_TYPE_MUTABLE_EXT, - VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7fffffff, -} VkDescriptorType; - -typedef enum VkDescriptorUpdateTemplateType -{ - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0, - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET, - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = 0x7fffffff, -} VkDescriptorUpdateTemplateType; -typedef VkDescriptorUpdateTemplateType VkDescriptorUpdateTemplateTypeKHR; - -typedef enum VkDeviceAddressBindingFlagBitsEXT -{ - VK_DEVICE_ADDRESS_BINDING_INTERNAL_OBJECT_BIT_EXT = 0x00000001, - VK_DEVICE_ADDRESS_BINDING_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkDeviceAddressBindingFlagBitsEXT; - -typedef enum VkDeviceAddressBindingTypeEXT -{ - VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT = 0, - VK_DEVICE_ADDRESS_BINDING_TYPE_UNBIND_EXT = 1, - VK_DEVICE_ADDRESS_BINDING_TYPE_EXT_MAX_ENUM = 0x7fffffff, -} VkDeviceAddressBindingTypeEXT; - -typedef enum VkDeviceDiagnosticsConfigFlagBitsNV -{ - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV = 0x00000001, - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV = 0x00000002, - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV = 0x00000004, - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV = 0x00000008, - VK_DEVICE_DIAGNOSTICS_CONFIG_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkDeviceDiagnosticsConfigFlagBitsNV; - -typedef enum VkDeviceFaultAddressTypeEXT -{ - VK_DEVICE_FAULT_ADDRESS_TYPE_NONE_EXT = 0, - VK_DEVICE_FAULT_ADDRESS_TYPE_READ_INVALID_EXT = 1, - VK_DEVICE_FAULT_ADDRESS_TYPE_WRITE_INVALID_EXT = 2, - VK_DEVICE_FAULT_ADDRESS_TYPE_EXECUTE_INVALID_EXT = 3, - VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_UNKNOWN_EXT = 4, - VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_INVALID_EXT = 5, - VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_FAULT_EXT = 6, - VK_DEVICE_FAULT_ADDRESS_TYPE_EXT_MAX_ENUM = 0x7fffffff, -} VkDeviceFaultAddressTypeEXT; - -typedef enum VkDeviceFaultVendorBinaryHeaderVersionEXT -{ - VK_DEVICE_FAULT_VENDOR_BINARY_HEADER_VERSION_ONE_EXT = 1, - VK_DEVICE_FAULT_VENDOR_BINARY_HEADER_VERSION_EXT_MAX_ENUM = 0x7fffffff, -} VkDeviceFaultVendorBinaryHeaderVersionEXT; - -typedef enum VkDeviceGroupPresentModeFlagBitsKHR -{ - VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = 0x00000001, - VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = 0x00000002, - VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = 0x00000004, - VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 0x00000008, - VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkDeviceGroupPresentModeFlagBitsKHR; - -typedef enum VkDeviceQueueCreateFlagBits -{ - VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 0x00000001, - VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkDeviceQueueCreateFlagBits; - -typedef enum VkDiscardRectangleModeEXT -{ - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, - VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, - VK_DISCARD_RECTANGLE_MODE_EXT_MAX_ENUM = 0x7fffffff, -} VkDiscardRectangleModeEXT; - -typedef enum VkDriverId -{ - VK_DRIVER_ID_AMD_PROPRIETARY = 1, - VK_DRIVER_ID_AMD_OPEN_SOURCE = 2, - VK_DRIVER_ID_MESA_RADV = 3, - VK_DRIVER_ID_NVIDIA_PROPRIETARY = 4, - VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS = 5, - VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA = 6, - VK_DRIVER_ID_IMAGINATION_PROPRIETARY = 7, - VK_DRIVER_ID_QUALCOMM_PROPRIETARY = 8, - VK_DRIVER_ID_ARM_PROPRIETARY = 9, - VK_DRIVER_ID_GOOGLE_SWIFTSHADER = 10, - VK_DRIVER_ID_GGP_PROPRIETARY = 11, - VK_DRIVER_ID_BROADCOM_PROPRIETARY = 12, - VK_DRIVER_ID_MESA_LLVMPIPE = 13, - VK_DRIVER_ID_MOLTENVK = 14, - VK_DRIVER_ID_COREAVI_PROPRIETARY = 15, - VK_DRIVER_ID_JUICE_PROPRIETARY = 16, - VK_DRIVER_ID_VERISILICON_PROPRIETARY = 17, - VK_DRIVER_ID_MESA_TURNIP = 18, - VK_DRIVER_ID_MESA_V3DV = 19, - VK_DRIVER_ID_MESA_PANVK = 20, - VK_DRIVER_ID_SAMSUNG_PROPRIETARY = 21, - VK_DRIVER_ID_MESA_VENUS = 22, - VK_DRIVER_ID_MESA_DOZEN = 23, - VK_DRIVER_ID_MESA_NVK = 24, - VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA = 25, - VK_DRIVER_ID_MESA_AGXV = 26, - VK_DRIVER_ID_AMD_PROPRIETARY_KHR = VK_DRIVER_ID_AMD_PROPRIETARY, - VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR = VK_DRIVER_ID_AMD_OPEN_SOURCE, - VK_DRIVER_ID_MESA_RADV_KHR = VK_DRIVER_ID_MESA_RADV, - VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR = VK_DRIVER_ID_NVIDIA_PROPRIETARY, - VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR = VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, - VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR = VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA, - VK_DRIVER_ID_IMAGINATION_PROPRIETARY_KHR = VK_DRIVER_ID_IMAGINATION_PROPRIETARY, - VK_DRIVER_ID_QUALCOMM_PROPRIETARY_KHR = VK_DRIVER_ID_QUALCOMM_PROPRIETARY, - VK_DRIVER_ID_ARM_PROPRIETARY_KHR = VK_DRIVER_ID_ARM_PROPRIETARY, - VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR = VK_DRIVER_ID_GOOGLE_SWIFTSHADER, - VK_DRIVER_ID_GGP_PROPRIETARY_KHR = VK_DRIVER_ID_GGP_PROPRIETARY, - VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR = VK_DRIVER_ID_BROADCOM_PROPRIETARY, - VK_DRIVER_ID_MAX_ENUM = 0x7fffffff, -} VkDriverId; -typedef VkDriverId VkDriverIdKHR; - -typedef enum VkDynamicState -{ - VK_DYNAMIC_STATE_VIEWPORT = 0, - VK_DYNAMIC_STATE_SCISSOR = 1, - VK_DYNAMIC_STATE_LINE_WIDTH = 2, - VK_DYNAMIC_STATE_DEPTH_BIAS = 3, - VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, - VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, - VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, - VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, - VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, - VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, - VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, - VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT = 1000099001, - VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT = 1000099002, - VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, - VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004, - VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006, - VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_ENABLE_NV = 1000205000, - VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001, - VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR = 1000226000, - VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000, - VK_DYNAMIC_STATE_CULL_MODE = 1000267000, - VK_DYNAMIC_STATE_FRONT_FACE = 1000267001, - VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY = 1000267002, - VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT = 1000267003, - VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT = 1000267004, - VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE = 1000267005, - VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE = 1000267006, - VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE = 1000267007, - VK_DYNAMIC_STATE_DEPTH_COMPARE_OP = 1000267008, - VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE = 1000267009, - VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE = 1000267010, - VK_DYNAMIC_STATE_STENCIL_OP = 1000267011, - VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR = 1000347000, - VK_DYNAMIC_STATE_VERTEX_INPUT_EXT = 1000352000, - VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT = 1000377000, - VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE = 1000377001, - VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE = 1000377002, - VK_DYNAMIC_STATE_LOGIC_OP_EXT = 1000377003, - VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE = 1000377004, - VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT = 1000381000, - VK_DYNAMIC_STATE_TESSELLATION_DOMAIN_ORIGIN_EXT = 1000455002, - VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT = 1000455003, - VK_DYNAMIC_STATE_POLYGON_MODE_EXT = 1000455004, - VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT = 1000455005, - VK_DYNAMIC_STATE_SAMPLE_MASK_EXT = 1000455006, - VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT = 1000455007, - VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT = 1000455008, - VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT = 1000455009, - VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT = 1000455010, - VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT = 1000455011, - VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT = 1000455012, - VK_DYNAMIC_STATE_RASTERIZATION_STREAM_EXT = 1000455013, - VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT = 1000455014, - VK_DYNAMIC_STATE_EXTRA_PRIMITIVE_OVERESTIMATION_SIZE_EXT = 1000455015, - VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT = 1000455016, - VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT = 1000455017, - VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT = 1000455018, - VK_DYNAMIC_STATE_PROVOKING_VERTEX_MODE_EXT = 1000455019, - VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT = 1000455020, - VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT = 1000455021, - VK_DYNAMIC_STATE_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE_EXT = 1000455022, - VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_ENABLE_NV = 1000455023, - VK_DYNAMIC_STATE_VIEWPORT_SWIZZLE_NV = 1000455024, - VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_ENABLE_NV = 1000455025, - VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_LOCATION_NV = 1000455026, - VK_DYNAMIC_STATE_COVERAGE_MODULATION_MODE_NV = 1000455027, - VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_ENABLE_NV = 1000455028, - VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_NV = 1000455029, - VK_DYNAMIC_STATE_SHADING_RATE_IMAGE_ENABLE_NV = 1000455030, - VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV = 1000455031, - VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV = 1000455032, - VK_DYNAMIC_STATE_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT = 1000524000, - VK_DYNAMIC_STATE_CULL_MODE_EXT = VK_DYNAMIC_STATE_CULL_MODE, - VK_DYNAMIC_STATE_FRONT_FACE_EXT = VK_DYNAMIC_STATE_FRONT_FACE, - VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY, - VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT, - VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT, - VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE, - VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE, - VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE, - VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = VK_DYNAMIC_STATE_DEPTH_COMPARE_OP, - VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE, - VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE, - VK_DYNAMIC_STATE_STENCIL_OP_EXT = VK_DYNAMIC_STATE_STENCIL_OP, - VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT = VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE, - VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT = VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE, - VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT = VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE, - VK_DYNAMIC_STATE_MAX_ENUM = 0x7fffffff, -} VkDynamicState; - -typedef enum VkEventCreateFlagBits -{ - VK_EVENT_CREATE_DEVICE_ONLY_BIT = 0x00000001, - VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR = VK_EVENT_CREATE_DEVICE_ONLY_BIT, - VK_EVENT_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkEventCreateFlagBits; - -typedef enum VkExternalFenceFeatureFlagBits -{ - VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = 0x00000001, - VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 0x00000002, - VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT, - VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT, - VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkExternalFenceFeatureFlagBits; -typedef VkExternalFenceFeatureFlagBits VkExternalFenceFeatureFlagBitsKHR; - -typedef enum VkExternalFenceHandleTypeFlagBits -{ - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = 0x00000001, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000002, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 0x00000004, - VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 0x00000008, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkExternalFenceHandleTypeFlagBits; -typedef VkExternalFenceHandleTypeFlagBits VkExternalFenceHandleTypeFlagBitsKHR; - -typedef enum VkExternalMemoryFeatureFlagBits -{ - VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = 0x00000001, - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = 0x00000002, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 0x00000004, - VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT, - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT, - VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkExternalMemoryFeatureFlagBits; -typedef VkExternalMemoryFeatureFlagBits VkExternalMemoryFeatureFlagBitsKHR; - -typedef enum VkExternalMemoryHandleTypeFlagBits -{ - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = 0x00000001, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000002, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 0x00000004, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = 0x00000008, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = 0x00000010, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = 0x00000020, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 0x00000040, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = 0x00000080, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkExternalMemoryHandleTypeFlagBits; -typedef VkExternalMemoryHandleTypeFlagBits VkExternalMemoryHandleTypeFlagBitsKHR; - -typedef enum VkExternalSemaphoreFeatureFlagBits -{ - VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = 0x00000001, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 0x00000002, - VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT, - VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkExternalSemaphoreFeatureFlagBits; -typedef VkExternalSemaphoreFeatureFlagBits VkExternalSemaphoreFeatureFlagBitsKHR; - -typedef enum VkExternalSemaphoreHandleTypeFlagBits -{ - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = 0x00000001, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000002, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 0x00000004, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = 0x00000008, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 0x00000010, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkExternalSemaphoreHandleTypeFlagBits; -typedef VkExternalSemaphoreHandleTypeFlagBits VkExternalSemaphoreHandleTypeFlagBitsKHR; - -typedef enum VkFenceCreateFlagBits -{ - VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, - VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkFenceCreateFlagBits; - -typedef enum VkFenceImportFlagBits -{ - VK_FENCE_IMPORT_TEMPORARY_BIT = 0x00000001, - VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = VK_FENCE_IMPORT_TEMPORARY_BIT, - VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkFenceImportFlagBits; -typedef VkFenceImportFlagBits VkFenceImportFlagBitsKHR; - -typedef enum VkFilter -{ - VK_FILTER_NEAREST = 0, - VK_FILTER_LINEAR = 1, - VK_FILTER_CUBIC_EXT = 1000015000, - VK_FILTER_CUBIC_IMG = VK_FILTER_CUBIC_EXT, - VK_FILTER_MAX_ENUM = 0x7fffffff, -} VkFilter; - -typedef enum VkFormat -{ - VK_FORMAT_UNDEFINED = 0, - VK_FORMAT_R4G4_UNORM_PACK8 = 1, - VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, - VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, - VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, - VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, - VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, - VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, - VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, - VK_FORMAT_R8_UNORM = 9, - VK_FORMAT_R8_SNORM = 10, - VK_FORMAT_R8_USCALED = 11, - VK_FORMAT_R8_SSCALED = 12, - VK_FORMAT_R8_UINT = 13, - VK_FORMAT_R8_SINT = 14, - VK_FORMAT_R8_SRGB = 15, - VK_FORMAT_R8G8_UNORM = 16, - VK_FORMAT_R8G8_SNORM = 17, - VK_FORMAT_R8G8_USCALED = 18, - VK_FORMAT_R8G8_SSCALED = 19, - VK_FORMAT_R8G8_UINT = 20, - VK_FORMAT_R8G8_SINT = 21, - VK_FORMAT_R8G8_SRGB = 22, - VK_FORMAT_R8G8B8_UNORM = 23, - VK_FORMAT_R8G8B8_SNORM = 24, - VK_FORMAT_R8G8B8_USCALED = 25, - VK_FORMAT_R8G8B8_SSCALED = 26, - VK_FORMAT_R8G8B8_UINT = 27, - VK_FORMAT_R8G8B8_SINT = 28, - VK_FORMAT_R8G8B8_SRGB = 29, - VK_FORMAT_B8G8R8_UNORM = 30, - VK_FORMAT_B8G8R8_SNORM = 31, - VK_FORMAT_B8G8R8_USCALED = 32, - VK_FORMAT_B8G8R8_SSCALED = 33, - VK_FORMAT_B8G8R8_UINT = 34, - VK_FORMAT_B8G8R8_SINT = 35, - VK_FORMAT_B8G8R8_SRGB = 36, - VK_FORMAT_R8G8B8A8_UNORM = 37, - VK_FORMAT_R8G8B8A8_SNORM = 38, - VK_FORMAT_R8G8B8A8_USCALED = 39, - VK_FORMAT_R8G8B8A8_SSCALED = 40, - VK_FORMAT_R8G8B8A8_UINT = 41, - VK_FORMAT_R8G8B8A8_SINT = 42, - VK_FORMAT_R8G8B8A8_SRGB = 43, - VK_FORMAT_B8G8R8A8_UNORM = 44, - VK_FORMAT_B8G8R8A8_SNORM = 45, - VK_FORMAT_B8G8R8A8_USCALED = 46, - VK_FORMAT_B8G8R8A8_SSCALED = 47, - VK_FORMAT_B8G8R8A8_UINT = 48, - VK_FORMAT_B8G8R8A8_SINT = 49, - VK_FORMAT_B8G8R8A8_SRGB = 50, - VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, - VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, - VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, - VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, - VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, - VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, - VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, - VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, - VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, - VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, - VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, - VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, - VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, - VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, - VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, - VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, - VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, - VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, - VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, - VK_FORMAT_R16_UNORM = 70, - VK_FORMAT_R16_SNORM = 71, - VK_FORMAT_R16_USCALED = 72, - VK_FORMAT_R16_SSCALED = 73, - VK_FORMAT_R16_UINT = 74, - VK_FORMAT_R16_SINT = 75, - VK_FORMAT_R16_SFLOAT = 76, - VK_FORMAT_R16G16_UNORM = 77, - VK_FORMAT_R16G16_SNORM = 78, - VK_FORMAT_R16G16_USCALED = 79, - VK_FORMAT_R16G16_SSCALED = 80, - VK_FORMAT_R16G16_UINT = 81, - VK_FORMAT_R16G16_SINT = 82, - VK_FORMAT_R16G16_SFLOAT = 83, - VK_FORMAT_R16G16B16_UNORM = 84, - VK_FORMAT_R16G16B16_SNORM = 85, - VK_FORMAT_R16G16B16_USCALED = 86, - VK_FORMAT_R16G16B16_SSCALED = 87, - VK_FORMAT_R16G16B16_UINT = 88, - VK_FORMAT_R16G16B16_SINT = 89, - VK_FORMAT_R16G16B16_SFLOAT = 90, - VK_FORMAT_R16G16B16A16_UNORM = 91, - VK_FORMAT_R16G16B16A16_SNORM = 92, - VK_FORMAT_R16G16B16A16_USCALED = 93, - VK_FORMAT_R16G16B16A16_SSCALED = 94, - VK_FORMAT_R16G16B16A16_UINT = 95, - VK_FORMAT_R16G16B16A16_SINT = 96, - VK_FORMAT_R16G16B16A16_SFLOAT = 97, - VK_FORMAT_R32_UINT = 98, - VK_FORMAT_R32_SINT = 99, - VK_FORMAT_R32_SFLOAT = 100, - VK_FORMAT_R32G32_UINT = 101, - VK_FORMAT_R32G32_SINT = 102, - VK_FORMAT_R32G32_SFLOAT = 103, - VK_FORMAT_R32G32B32_UINT = 104, - VK_FORMAT_R32G32B32_SINT = 105, - VK_FORMAT_R32G32B32_SFLOAT = 106, - VK_FORMAT_R32G32B32A32_UINT = 107, - VK_FORMAT_R32G32B32A32_SINT = 108, - VK_FORMAT_R32G32B32A32_SFLOAT = 109, - VK_FORMAT_R64_UINT = 110, - VK_FORMAT_R64_SINT = 111, - VK_FORMAT_R64_SFLOAT = 112, - VK_FORMAT_R64G64_UINT = 113, - VK_FORMAT_R64G64_SINT = 114, - VK_FORMAT_R64G64_SFLOAT = 115, - VK_FORMAT_R64G64B64_UINT = 116, - VK_FORMAT_R64G64B64_SINT = 117, - VK_FORMAT_R64G64B64_SFLOAT = 118, - VK_FORMAT_R64G64B64A64_UINT = 119, - VK_FORMAT_R64G64B64A64_SINT = 120, - VK_FORMAT_R64G64B64A64_SFLOAT = 121, - VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, - VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, - VK_FORMAT_D16_UNORM = 124, - VK_FORMAT_X8_D24_UNORM_PACK32 = 125, - VK_FORMAT_D32_SFLOAT = 126, - VK_FORMAT_S8_UINT = 127, - VK_FORMAT_D16_UNORM_S8_UINT = 128, - VK_FORMAT_D24_UNORM_S8_UINT = 129, - VK_FORMAT_D32_SFLOAT_S8_UINT = 130, - VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, - VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, - VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, - VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, - VK_FORMAT_BC2_UNORM_BLOCK = 135, - VK_FORMAT_BC2_SRGB_BLOCK = 136, - VK_FORMAT_BC3_UNORM_BLOCK = 137, - VK_FORMAT_BC3_SRGB_BLOCK = 138, - VK_FORMAT_BC4_UNORM_BLOCK = 139, - VK_FORMAT_BC4_SNORM_BLOCK = 140, - VK_FORMAT_BC5_UNORM_BLOCK = 141, - VK_FORMAT_BC5_SNORM_BLOCK = 142, - VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, - VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, - VK_FORMAT_BC7_UNORM_BLOCK = 145, - VK_FORMAT_BC7_SRGB_BLOCK = 146, - VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, - VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, - VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, - VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, - VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, - VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, - VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, - VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, - VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, - VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, - VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, - VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, - VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, - VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, - VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, - VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, - VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, - VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, - VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, - VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, - VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, - VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, - VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, - VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, - VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, - VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, - VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, - VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, - VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, - VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, - VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, - VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, - VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, - VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, - VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, - VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, - VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, - VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, - VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, - VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, - VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, - VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, - VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, - VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, - VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, - VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, - VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK = 1000066000, - VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK = 1000066001, - VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK = 1000066002, - VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK = 1000066003, - VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK = 1000066004, - VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK = 1000066005, - VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK = 1000066006, - VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK = 1000066007, - VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK = 1000066008, - VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK = 1000066009, - VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK = 1000066010, - VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK = 1000066011, - VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK = 1000066012, - VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK = 1000066013, - VK_FORMAT_G8B8G8R8_422_UNORM = 1000156000, - VK_FORMAT_B8G8R8G8_422_UNORM = 1000156001, - VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = 1000156002, - VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = 1000156003, - VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = 1000156004, - VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = 1000156005, - VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = 1000156006, - VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007, - VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008, - VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009, - VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010, - VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = 1000156012, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = 1000156013, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = 1000156014, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = 1000156015, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = 1000156016, - VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017, - VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018, - VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019, - VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020, - VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = 1000156022, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = 1000156023, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = 1000156024, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = 1000156025, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = 1000156026, - VK_FORMAT_G16B16G16R16_422_UNORM = 1000156027, - VK_FORMAT_B16G16R16G16_422_UNORM = 1000156028, - VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM = 1000156029, - VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030, - VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031, - VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033, - VK_FORMAT_G8_B8R8_2PLANE_444_UNORM = 1000330000, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16 = 1000330001, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16 = 1000330002, - VK_FORMAT_G16_B16R16_2PLANE_444_UNORM = 1000330003, - VK_FORMAT_A4R4G4B4_UNORM_PACK16 = 1000340000, - VK_FORMAT_A4B4G4R4_UNORM_PACK16 = 1000340001, - VK_FORMAT_R16G16_S10_5_NV = 1000464000, - VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR = 1000470000, - VK_FORMAT_A8_UNORM_KHR = 1000470001, - VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK, - VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK, - VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK, - VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK, - VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK, - VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK, - VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK, - VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK, - VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK, - VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK, - VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK, - VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK, - VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK, - VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK, - VK_FORMAT_G8B8G8R8_422_UNORM_KHR = VK_FORMAT_G8B8G8R8_422_UNORM, - VK_FORMAT_B8G8R8G8_422_UNORM_KHR = VK_FORMAT_B8G8R8G8_422_UNORM, - VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM, - VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, - VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM, - VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM, - VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM, - VK_FORMAT_R10X6_UNORM_PACK16_KHR = VK_FORMAT_R10X6_UNORM_PACK16, - VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR = VK_FORMAT_R10X6G10X6_UNORM_2PACK16, - VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16, - VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16, - VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16, - VK_FORMAT_R12X4_UNORM_PACK16_KHR = VK_FORMAT_R12X4_UNORM_PACK16, - VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR = VK_FORMAT_R12X4G12X4_UNORM_2PACK16, - VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR = VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16, - VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16, - VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16, - VK_FORMAT_G16B16G16R16_422_UNORM_KHR = VK_FORMAT_G16B16G16R16_422_UNORM, - VK_FORMAT_B16G16R16G16_422_UNORM_KHR = VK_FORMAT_B16G16R16G16_422_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, - VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM, - VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM, - VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT = VK_FORMAT_G8_B8R8_2PLANE_444_UNORM, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16, - VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT = VK_FORMAT_G16_B16R16_2PLANE_444_UNORM, - VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = VK_FORMAT_A4R4G4B4_UNORM_PACK16, - VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = VK_FORMAT_A4B4G4R4_UNORM_PACK16, - VK_FORMAT_MAX_ENUM = 0x7fffffff, -} VkFormat; - -typedef enum VkFormatFeatureFlagBits -{ - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, - VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, - VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, - VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, - VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, - VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, - VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, - VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, - VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, - VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, - VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, - VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 0x00002000, - VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = 0x00004000, - VK_FORMAT_FEATURE_TRANSFER_DST_BIT = 0x00008000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 0x00010000, - VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT = 0x00020000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 0x00040000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 0x00080000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 0x00100000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 0x00200000, - VK_FORMAT_FEATURE_DISJOINT_BIT = 0x00400000, - VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 0x00800000, - VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000, - VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000, - VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x40000000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT, - VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT, - VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_DST_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT, - VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT, - VK_FORMAT_FEATURE_DISJOINT_BIT_KHR = VK_FORMAT_FEATURE_DISJOINT_BIT, - VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR = VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, - VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkFormatFeatureFlagBits; - -typedef VkFlags64 VkFormatFeatureFlagBits2; - -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT = 0x00000001ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR = 0x00000001ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT = 0x00000002ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR = 0x00000002ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT_KHR = 0x00000004ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR = 0x00000008ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT = 0x00000010ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT_KHR = 0x00000010ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT_KHR = 0x00000020ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT = 0x00000040ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT_KHR = 0x00000040ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT = 0x00000080ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR = 0x00000080ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT_KHR = 0x00000100ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT_KHR = 0x00000200ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_SRC_BIT = 0x00000400ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_SRC_BIT_KHR = 0x00000400ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_DST_BIT = 0x00000800ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_DST_BIT_KHR = 0x00000800ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT_KHR = 0x00001000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT = 0x00002000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 0x00002000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT = 0x00004000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR = 0x00004000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT = 0x00008000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR = 0x00008000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 0x00010000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT_KHR = 0x00010000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT = 0x00020000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = 0x00020000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 0x00040000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = 0x00040000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 0x00080000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = 0x00080000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 0x00100000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = 0x00100000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 0x00200000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = 0x00200000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DISJOINT_BIT = 0x00400000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DISJOINT_BIT_KHR = 0x00400000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT = 0x00800000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT_KHR = 0x00800000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x40000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT = 0x80000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT_KHR = 0x80000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT = 0x100000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR = 0x100000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT = 0x200000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT_KHR = 0x200000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_WEIGHT_IMAGE_BIT_QCOM = 0x400000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_WEIGHT_SAMPLED_IMAGE_BIT_QCOM = 0x800000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLOCK_MATCHING_BIT_QCOM = 0x1000000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BOX_FILTER_SAMPLED_BIT_QCOM = 0x2000000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV = 0x4000000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_OPTICAL_FLOW_IMAGE_BIT_NV = 0x10000000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_OPTICAL_FLOW_VECTOR_BIT_NV = 0x20000000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_OPTICAL_FLOW_COST_BIT_NV = 0x40000000000ull; -static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT = 0x400000000000ull; -typedef VkFormatFeatureFlagBits2 VkFormatFeatureFlagBits2KHR; - -typedef enum VkFragmentShadingRateCombinerOpKHR -{ - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR = 0, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR = 1, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_KHR = 2, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_KHR = 3, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_KHR = 4, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KHR_MAX_ENUM = 0x7fffffff, -} VkFragmentShadingRateCombinerOpKHR; - -typedef enum VkFragmentShadingRateNV -{ - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV = 0, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV = 1, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV = 4, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV = 5, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV = 6, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV = 9, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV = 10, - VK_FRAGMENT_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV = 11, - VK_FRAGMENT_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV = 12, - VK_FRAGMENT_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV = 13, - VK_FRAGMENT_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV = 14, - VK_FRAGMENT_SHADING_RATE_NO_INVOCATIONS_NV = 15, - VK_FRAGMENT_SHADING_RATE_NV_MAX_ENUM = 0x7fffffff, -} VkFragmentShadingRateNV; - -typedef enum VkFragmentShadingRateTypeNV -{ - VK_FRAGMENT_SHADING_RATE_TYPE_FRAGMENT_SIZE_NV = 0, - VK_FRAGMENT_SHADING_RATE_TYPE_ENUMS_NV = 1, - VK_FRAGMENT_SHADING_RATE_TYPE_NV_MAX_ENUM = 0x7fffffff, -} VkFragmentShadingRateTypeNV; - -typedef enum VkFrameBoundaryFlagBitsEXT -{ - VK_FRAME_BOUNDARY_FRAME_END_BIT_EXT = 0x00000001, - VK_FRAME_BOUNDARY_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkFrameBoundaryFlagBitsEXT; - -typedef enum VkFramebufferCreateFlagBits -{ - VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT = 0x00000001, - VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR = VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, - VK_FRAMEBUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkFramebufferCreateFlagBits; - -typedef enum VkFrontFace -{ - VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, - VK_FRONT_FACE_CLOCKWISE = 1, - VK_FRONT_FACE_MAX_ENUM = 0x7fffffff, -} VkFrontFace; - -typedef enum VkGeometryFlagBitsKHR -{ - VK_GEOMETRY_OPAQUE_BIT_KHR = 0x00000001, - VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR = 0x00000002, - VK_GEOMETRY_OPAQUE_BIT_NV = VK_GEOMETRY_OPAQUE_BIT_KHR, - VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV = VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR, - VK_GEOMETRY_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkGeometryFlagBitsKHR; -typedef VkGeometryFlagBitsKHR VkGeometryFlagBitsNV; - -typedef enum VkGeometryInstanceFlagBitsKHR -{ - VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR = 0x00000001, - VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR = 0x00000002, - VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR = 0x00000004, - VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR = 0x00000008, - VK_GEOMETRY_INSTANCE_FORCE_OPACITY_MICROMAP_2_STATE_EXT = 0x00000010, - VK_GEOMETRY_INSTANCE_DISABLE_OPACITY_MICROMAPS_EXT = 0x00000020, - VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR = VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR, - VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, - VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR, - VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV = VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, - VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV = VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR, - VK_GEOMETRY_INSTANCE_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkGeometryInstanceFlagBitsKHR; -typedef VkGeometryInstanceFlagBitsKHR VkGeometryInstanceFlagBitsNV; - -typedef enum VkGeometryTypeKHR -{ - VK_GEOMETRY_TYPE_TRIANGLES_KHR = 0, - VK_GEOMETRY_TYPE_AABBS_KHR = 1, - VK_GEOMETRY_TYPE_INSTANCES_KHR = 2, - VK_GEOMETRY_TYPE_TRIANGLES_NV = VK_GEOMETRY_TYPE_TRIANGLES_KHR, - VK_GEOMETRY_TYPE_AABBS_NV = VK_GEOMETRY_TYPE_AABBS_KHR, - VK_GEOMETRY_TYPE_KHR_MAX_ENUM = 0x7fffffff, -} VkGeometryTypeKHR; -typedef VkGeometryTypeKHR VkGeometryTypeNV; - -typedef enum VkGraphicsPipelineLibraryFlagBitsEXT -{ - VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT = 0x00000001, - VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT = 0x00000002, - VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT = 0x00000004, - VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT = 0x00000008, - VK_GRAPHICS_PIPELINE_LIBRARY_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkGraphicsPipelineLibraryFlagBitsEXT; - -typedef enum VkHostImageCopyFlagBitsEXT -{ - VK_HOST_IMAGE_COPY_MEMCPY_EXT = 0x00000001, - VK_HOST_IMAGE_COPY_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkHostImageCopyFlagBitsEXT; - -typedef enum VkImageAspectFlagBits -{ - VK_IMAGE_ASPECT_NONE = 0, - VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, - VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, - VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, - VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, - VK_IMAGE_ASPECT_PLANE_0_BIT = 0x00000010, - VK_IMAGE_ASPECT_PLANE_1_BIT = 0x00000020, - VK_IMAGE_ASPECT_PLANE_2_BIT = 0x00000040, - VK_IMAGE_ASPECT_PLANE_0_BIT_KHR = VK_IMAGE_ASPECT_PLANE_0_BIT, - VK_IMAGE_ASPECT_PLANE_1_BIT_KHR = VK_IMAGE_ASPECT_PLANE_1_BIT, - VK_IMAGE_ASPECT_PLANE_2_BIT_KHR = VK_IMAGE_ASPECT_PLANE_2_BIT, - VK_IMAGE_ASPECT_NONE_KHR = VK_IMAGE_ASPECT_NONE, - VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkImageAspectFlagBits; - -typedef enum VkImageCompressionFixedRateFlagBitsEXT -{ - VK_IMAGE_COMPRESSION_FIXED_RATE_NONE_EXT = 0, - VK_IMAGE_COMPRESSION_FIXED_RATE_1BPC_BIT_EXT = 0x00000001, - VK_IMAGE_COMPRESSION_FIXED_RATE_2BPC_BIT_EXT = 0x00000002, - VK_IMAGE_COMPRESSION_FIXED_RATE_3BPC_BIT_EXT = 0x00000004, - VK_IMAGE_COMPRESSION_FIXED_RATE_4BPC_BIT_EXT = 0x00000008, - VK_IMAGE_COMPRESSION_FIXED_RATE_5BPC_BIT_EXT = 0x00000010, - VK_IMAGE_COMPRESSION_FIXED_RATE_6BPC_BIT_EXT = 0x00000020, - VK_IMAGE_COMPRESSION_FIXED_RATE_7BPC_BIT_EXT = 0x00000040, - VK_IMAGE_COMPRESSION_FIXED_RATE_8BPC_BIT_EXT = 0x00000080, - VK_IMAGE_COMPRESSION_FIXED_RATE_9BPC_BIT_EXT = 0x00000100, - VK_IMAGE_COMPRESSION_FIXED_RATE_10BPC_BIT_EXT = 0x00000200, - VK_IMAGE_COMPRESSION_FIXED_RATE_11BPC_BIT_EXT = 0x00000400, - VK_IMAGE_COMPRESSION_FIXED_RATE_12BPC_BIT_EXT = 0x00000800, - VK_IMAGE_COMPRESSION_FIXED_RATE_13BPC_BIT_EXT = 0x00001000, - VK_IMAGE_COMPRESSION_FIXED_RATE_14BPC_BIT_EXT = 0x00002000, - VK_IMAGE_COMPRESSION_FIXED_RATE_15BPC_BIT_EXT = 0x00004000, - VK_IMAGE_COMPRESSION_FIXED_RATE_16BPC_BIT_EXT = 0x00008000, - VK_IMAGE_COMPRESSION_FIXED_RATE_17BPC_BIT_EXT = 0x00010000, - VK_IMAGE_COMPRESSION_FIXED_RATE_18BPC_BIT_EXT = 0x00020000, - VK_IMAGE_COMPRESSION_FIXED_RATE_19BPC_BIT_EXT = 0x00040000, - VK_IMAGE_COMPRESSION_FIXED_RATE_20BPC_BIT_EXT = 0x00080000, - VK_IMAGE_COMPRESSION_FIXED_RATE_21BPC_BIT_EXT = 0x00100000, - VK_IMAGE_COMPRESSION_FIXED_RATE_22BPC_BIT_EXT = 0x00200000, - VK_IMAGE_COMPRESSION_FIXED_RATE_23BPC_BIT_EXT = 0x00400000, - VK_IMAGE_COMPRESSION_FIXED_RATE_24BPC_BIT_EXT = 0x00800000, - VK_IMAGE_COMPRESSION_FIXED_RATE_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkImageCompressionFixedRateFlagBitsEXT; - -typedef enum VkImageCompressionFlagBitsEXT -{ - VK_IMAGE_COMPRESSION_DEFAULT_EXT = 0, - VK_IMAGE_COMPRESSION_FIXED_RATE_DEFAULT_EXT = 0x00000001, - VK_IMAGE_COMPRESSION_FIXED_RATE_EXPLICIT_EXT = 0x00000002, - VK_IMAGE_COMPRESSION_DISABLED_EXT = 0x00000004, - VK_IMAGE_COMPRESSION_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkImageCompressionFlagBitsEXT; - -typedef enum VkImageCreateFlagBits -{ - VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, - VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, - VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, - VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, - VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, - VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT = 0x00000020, - VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT = 0x00000040, - VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = 0x00000080, - VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = 0x00000100, - VK_IMAGE_CREATE_DISJOINT_BIT = 0x00000200, - VK_IMAGE_CREATE_ALIAS_BIT = 0x00000400, - VK_IMAGE_CREATE_PROTECTED_BIT = 0x00000800, - VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000, - VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = 0x00002000, - VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT = 0x00004000, - VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM = 0x00008000, - VK_IMAGE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00010000, - VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT = 0x00020000, - VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT = 0x00040000, - VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT, - VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, - VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, - VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR = VK_IMAGE_CREATE_EXTENDED_USAGE_BIT, - VK_IMAGE_CREATE_DISJOINT_BIT_KHR = VK_IMAGE_CREATE_DISJOINT_BIT, - VK_IMAGE_CREATE_ALIAS_BIT_KHR = VK_IMAGE_CREATE_ALIAS_BIT, - VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkImageCreateFlagBits; - -typedef enum VkImageLayout -{ - VK_IMAGE_LAYOUT_UNDEFINED = 0, - VK_IMAGE_LAYOUT_GENERAL = 1, - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, - VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, - VK_IMAGE_LAYOUT_PREINITIALIZED = 8, - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = 1000117000, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001, - VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR = 1000164003, - VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT = 1000218000, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL = 1000241000, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL = 1000241001, - VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL = 1000241002, - VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL = 1000241003, - VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL = 1000314000, - VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL = 1000314001, - VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT = 1000339000, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV = VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_MAX_ENUM = 0x7fffffff, -} VkImageLayout; - -typedef enum VkImageTiling -{ - VK_IMAGE_TILING_OPTIMAL = 0, - VK_IMAGE_TILING_LINEAR = 1, - VK_IMAGE_TILING_MAX_ENUM = 0x7fffffff, -} VkImageTiling; - -typedef enum VkImageType -{ - VK_IMAGE_TYPE_1D = 0, - VK_IMAGE_TYPE_2D = 1, - VK_IMAGE_TYPE_3D = 2, - VK_IMAGE_TYPE_MAX_ENUM = 0x7fffffff, -} VkImageType; - -typedef enum VkImageUsageFlagBits -{ - VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, - VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, - VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, - VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, - VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, - VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, - VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, - VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00000100, - VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x00000200, - VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI = 0x00040000, - VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x00080000, - VK_IMAGE_USAGE_SAMPLE_WEIGHT_BIT_QCOM = 0x00100000, - VK_IMAGE_USAGE_SAMPLE_BLOCK_MATCH_BIT_QCOM = 0x00200000, - VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT = 0x00400000, - VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV = VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR, - VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkImageUsageFlagBits; - -typedef enum VkImageViewCreateFlagBits -{ - VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT = 0x00000001, - VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT = 0x00000002, - VK_IMAGE_VIEW_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000004, - VK_IMAGE_VIEW_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkImageViewCreateFlagBits; - -typedef enum VkImageViewType -{ - VK_IMAGE_VIEW_TYPE_1D = 0, - VK_IMAGE_VIEW_TYPE_2D = 1, - VK_IMAGE_VIEW_TYPE_3D = 2, - VK_IMAGE_VIEW_TYPE_CUBE = 3, - VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, - VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, - VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, - VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7fffffff, -} VkImageViewType; - -typedef enum VkIndexType -{ - VK_INDEX_TYPE_UINT16 = 0, - VK_INDEX_TYPE_UINT32 = 1, - VK_INDEX_TYPE_NONE_KHR = 1000165000, - VK_INDEX_TYPE_UINT8_EXT = 1000265000, - VK_INDEX_TYPE_NONE_NV = VK_INDEX_TYPE_NONE_KHR, - VK_INDEX_TYPE_MAX_ENUM = 0x7fffffff, -} VkIndexType; - -typedef enum VkIndirectCommandsLayoutUsageFlagBitsNV -{ - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV = 0x00000001, - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV = 0x00000002, - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV = 0x00000004, - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkIndirectCommandsLayoutUsageFlagBitsNV; - -typedef enum VkIndirectCommandsTokenTypeNV -{ - VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV = 0, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV = 1, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV = 2, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV = 3, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV = 4, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV = 5, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV = 6, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV = 7, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV = 1000328000, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NV = 1000428003, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NV = 1000428004, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_NV_MAX_ENUM = 0x7fffffff, -} VkIndirectCommandsTokenTypeNV; - -typedef enum VkIndirectStateFlagBitsNV -{ - VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV = 0x00000001, - VK_INDIRECT_STATE_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkIndirectStateFlagBitsNV; - -typedef enum VkInstanceCreateFlagBits -{ - VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR = 0x00000001, - VK_INSTANCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkInstanceCreateFlagBits; - -typedef enum VkInternalAllocationType -{ - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, - VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7fffffff, -} VkInternalAllocationType; - -typedef enum VkLatencyMarkerNV -{ - VK_LATENCY_MARKER_SIMULATION_START_NV = 0, - VK_LATENCY_MARKER_SIMULATION_END_NV = 1, - VK_LATENCY_MARKER_RENDERSUBMIT_START_NV = 2, - VK_LATENCY_MARKER_RENDERSUBMIT_END_NV = 3, - VK_LATENCY_MARKER_PRESENT_START_NV = 4, - VK_LATENCY_MARKER_PRESENT_END_NV = 5, - VK_LATENCY_MARKER_INPUT_SAMPLE_NV = 6, - VK_LATENCY_MARKER_TRIGGER_FLASH_NV = 7, - VK_LATENCY_MARKER_OUT_OF_BAND_RENDERSUBMIT_START_NV = 8, - VK_LATENCY_MARKER_OUT_OF_BAND_RENDERSUBMIT_END_NV = 9, - VK_LATENCY_MARKER_OUT_OF_BAND_PRESENT_START_NV = 10, - VK_LATENCY_MARKER_OUT_OF_BAND_PRESENT_END_NV = 11, - VK_LATENCY_MARKER_NV_MAX_ENUM = 0x7fffffff, -} VkLatencyMarkerNV; - -typedef enum VkLayerSettingTypeEXT -{ - VK_LAYER_SETTING_TYPE_BOOL32_EXT = 0, - VK_LAYER_SETTING_TYPE_INT32_EXT = 1, - VK_LAYER_SETTING_TYPE_INT64_EXT = 2, - VK_LAYER_SETTING_TYPE_UINT32_EXT = 3, - VK_LAYER_SETTING_TYPE_UINT64_EXT = 4, - VK_LAYER_SETTING_TYPE_FLOAT32_EXT = 5, - VK_LAYER_SETTING_TYPE_FLOAT64_EXT = 6, - VK_LAYER_SETTING_TYPE_STRING_EXT = 7, - VK_LAYER_SETTING_TYPE_EXT_MAX_ENUM = 0x7fffffff, -} VkLayerSettingTypeEXT; - -typedef enum VkLayeredDriverUnderlyingApiMSFT -{ - VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT = 0, - VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT = 1, - VK_LAYERED_DRIVER_UNDERLYING_API_MSFT_MAX_ENUM = 0x7fffffff, -} VkLayeredDriverUnderlyingApiMSFT; - -typedef enum VkLineRasterizationModeEXT -{ - VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT = 0, - VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT = 1, - VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT = 2, - VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT = 3, - VK_LINE_RASTERIZATION_MODE_EXT_MAX_ENUM = 0x7fffffff, -} VkLineRasterizationModeEXT; - -typedef enum VkLogicOp -{ - VK_LOGIC_OP_CLEAR = 0, - VK_LOGIC_OP_AND = 1, - VK_LOGIC_OP_AND_REVERSE = 2, - VK_LOGIC_OP_COPY = 3, - VK_LOGIC_OP_AND_INVERTED = 4, - VK_LOGIC_OP_NO_OP = 5, - VK_LOGIC_OP_XOR = 6, - VK_LOGIC_OP_OR = 7, - VK_LOGIC_OP_NOR = 8, - VK_LOGIC_OP_EQUIVALENT = 9, - VK_LOGIC_OP_INVERT = 10, - VK_LOGIC_OP_OR_REVERSE = 11, - VK_LOGIC_OP_COPY_INVERTED = 12, - VK_LOGIC_OP_OR_INVERTED = 13, - VK_LOGIC_OP_NAND = 14, - VK_LOGIC_OP_SET = 15, - VK_LOGIC_OP_MAX_ENUM = 0x7fffffff, -} VkLogicOp; - -typedef enum VkMemoryAllocateFlagBits -{ - VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 0x00000001, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT = 0x00000002, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 0x00000004, - VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, - VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkMemoryAllocateFlagBits; -typedef VkMemoryAllocateFlagBits VkMemoryAllocateFlagBitsKHR; - -typedef VkFlags64 VkMemoryDecompressionMethodFlagBitsNV; - -static const VkMemoryDecompressionMethodFlagBitsNV VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_NV = 0x00000001ull; - -typedef enum VkMemoryHeapFlagBits -{ - VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, - VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 0x00000002, - VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR = VK_MEMORY_HEAP_MULTI_INSTANCE_BIT, - VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkMemoryHeapFlagBits; - -typedef enum VkMemoryOverallocationBehaviorAMD -{ - VK_MEMORY_OVERALLOCATION_BEHAVIOR_DEFAULT_AMD = 0, - VK_MEMORY_OVERALLOCATION_BEHAVIOR_ALLOWED_AMD = 1, - VK_MEMORY_OVERALLOCATION_BEHAVIOR_DISALLOWED_AMD = 2, - VK_MEMORY_OVERALLOCATION_BEHAVIOR_AMD_MAX_ENUM = 0x7fffffff, -} VkMemoryOverallocationBehaviorAMD; - -typedef enum VkMemoryPropertyFlagBits -{ - VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, - VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, - VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, - VK_MEMORY_PROPERTY_PROTECTED_BIT = 0x00000020, - VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD = 0x00000040, - VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD = 0x00000080, - VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkMemoryPropertyFlagBits; - -typedef enum VkMicromapCreateFlagBitsEXT -{ - VK_MICROMAP_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = 0x00000001, - VK_MICROMAP_CREATE_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkMicromapCreateFlagBitsEXT; - -typedef enum VkMicromapTypeEXT -{ - VK_MICROMAP_TYPE_OPACITY_MICROMAP_EXT = 0, - VK_MICROMAP_TYPE_EXT_MAX_ENUM = 0x7fffffff, -} VkMicromapTypeEXT; - -typedef enum VkObjectType -{ - VK_OBJECT_TYPE_UNKNOWN = 0, - VK_OBJECT_TYPE_INSTANCE = 1, - VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, - VK_OBJECT_TYPE_DEVICE = 3, - VK_OBJECT_TYPE_QUEUE = 4, - VK_OBJECT_TYPE_SEMAPHORE = 5, - VK_OBJECT_TYPE_COMMAND_BUFFER = 6, - VK_OBJECT_TYPE_FENCE = 7, - VK_OBJECT_TYPE_DEVICE_MEMORY = 8, - VK_OBJECT_TYPE_BUFFER = 9, - VK_OBJECT_TYPE_IMAGE = 10, - VK_OBJECT_TYPE_EVENT = 11, - VK_OBJECT_TYPE_QUERY_POOL = 12, - VK_OBJECT_TYPE_BUFFER_VIEW = 13, - VK_OBJECT_TYPE_IMAGE_VIEW = 14, - VK_OBJECT_TYPE_SHADER_MODULE = 15, - VK_OBJECT_TYPE_PIPELINE_CACHE = 16, - VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, - VK_OBJECT_TYPE_RENDER_PASS = 18, - VK_OBJECT_TYPE_PIPELINE = 19, - VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, - VK_OBJECT_TYPE_SAMPLER = 21, - VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, - VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, - VK_OBJECT_TYPE_FRAMEBUFFER = 24, - VK_OBJECT_TYPE_COMMAND_POOL = 25, - VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, - VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, - VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, - VK_OBJECT_TYPE_CU_MODULE_NVX = 1000029000, - VK_OBJECT_TYPE_CU_FUNCTION_NVX = 1000029001, - VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = 1000085000, - VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000, - VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, - VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = 1000156000, - VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000, - VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, - VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL = 1000210000, - VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR = 1000268000, - VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV = 1000277000, - VK_OBJECT_TYPE_PRIVATE_DATA_SLOT = 1000295000, - VK_OBJECT_TYPE_CUDA_MODULE_NV = 1000307000, - VK_OBJECT_TYPE_CUDA_FUNCTION_NV = 1000307001, - VK_OBJECT_TYPE_MICROMAP_EXT = 1000396000, - VK_OBJECT_TYPE_OPTICAL_FLOW_SESSION_NV = 1000464000, - VK_OBJECT_TYPE_SHADER_EXT = 1000482000, - VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE, - VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION, - VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT = VK_OBJECT_TYPE_PRIVATE_DATA_SLOT, - VK_OBJECT_TYPE_MAX_ENUM = 0x7fffffff, -} VkObjectType; - -typedef enum VkOpacityMicromapFormatEXT -{ - VK_OPACITY_MICROMAP_FORMAT_2_STATE_EXT = 1, - VK_OPACITY_MICROMAP_FORMAT_4_STATE_EXT = 2, - VK_OPACITY_MICROMAP_FORMAT_EXT_MAX_ENUM = 0x7fffffff, -} VkOpacityMicromapFormatEXT; - -typedef enum VkOpacityMicromapSpecialIndexEXT -{ - VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_OPAQUE_EXT = -4, - VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_TRANSPARENT_EXT = -3, - VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_OPAQUE_EXT = -2, - VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_TRANSPARENT_EXT = -1, - VK_OPACITY_MICROMAP_SPECIAL_INDEX_EXT_MAX_ENUM = 0x7fffffff, -} VkOpacityMicromapSpecialIndexEXT; - -typedef enum VkOpticalFlowExecuteFlagBitsNV -{ - VK_OPTICAL_FLOW_EXECUTE_DISABLE_TEMPORAL_HINTS_BIT_NV = 0x00000001, - VK_OPTICAL_FLOW_EXECUTE_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkOpticalFlowExecuteFlagBitsNV; - -typedef enum VkOpticalFlowGridSizeFlagBitsNV -{ - VK_OPTICAL_FLOW_GRID_SIZE_UNKNOWN_NV = 0, - VK_OPTICAL_FLOW_GRID_SIZE_1X1_BIT_NV = 0x00000001, - VK_OPTICAL_FLOW_GRID_SIZE_2X2_BIT_NV = 0x00000002, - VK_OPTICAL_FLOW_GRID_SIZE_4X4_BIT_NV = 0x00000004, - VK_OPTICAL_FLOW_GRID_SIZE_8X8_BIT_NV = 0x00000008, - VK_OPTICAL_FLOW_GRID_SIZE_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkOpticalFlowGridSizeFlagBitsNV; - -typedef enum VkOpticalFlowPerformanceLevelNV -{ - VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_UNKNOWN_NV = 0, - VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_SLOW_NV = 1, - VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_MEDIUM_NV = 2, - VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_FAST_NV = 3, - VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_NV_MAX_ENUM = 0x7fffffff, -} VkOpticalFlowPerformanceLevelNV; - -typedef enum VkOpticalFlowSessionBindingPointNV -{ - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_UNKNOWN_NV = 0, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_INPUT_NV = 1, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_REFERENCE_NV = 2, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_HINT_NV = 3, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_FLOW_VECTOR_NV = 4, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_BACKWARD_FLOW_VECTOR_NV = 5, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_COST_NV = 6, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_BACKWARD_COST_NV = 7, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_GLOBAL_FLOW_NV = 8, - VK_OPTICAL_FLOW_SESSION_BINDING_POINT_NV_MAX_ENUM = 0x7fffffff, -} VkOpticalFlowSessionBindingPointNV; - -typedef enum VkOpticalFlowSessionCreateFlagBitsNV -{ - VK_OPTICAL_FLOW_SESSION_CREATE_ENABLE_HINT_BIT_NV = 0x00000001, - VK_OPTICAL_FLOW_SESSION_CREATE_ENABLE_COST_BIT_NV = 0x00000002, - VK_OPTICAL_FLOW_SESSION_CREATE_ENABLE_GLOBAL_FLOW_BIT_NV = 0x00000004, - VK_OPTICAL_FLOW_SESSION_CREATE_ALLOW_REGIONS_BIT_NV = 0x00000008, - VK_OPTICAL_FLOW_SESSION_CREATE_BOTH_DIRECTIONS_BIT_NV = 0x00000010, - VK_OPTICAL_FLOW_SESSION_CREATE_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkOpticalFlowSessionCreateFlagBitsNV; - -typedef enum VkOpticalFlowUsageFlagBitsNV -{ - VK_OPTICAL_FLOW_USAGE_UNKNOWN_NV = 0, - VK_OPTICAL_FLOW_USAGE_INPUT_BIT_NV = 0x00000001, - VK_OPTICAL_FLOW_USAGE_OUTPUT_BIT_NV = 0x00000002, - VK_OPTICAL_FLOW_USAGE_HINT_BIT_NV = 0x00000004, - VK_OPTICAL_FLOW_USAGE_COST_BIT_NV = 0x00000008, - VK_OPTICAL_FLOW_USAGE_GLOBAL_FLOW_BIT_NV = 0x00000010, - VK_OPTICAL_FLOW_USAGE_FLAG_BITS_NV_MAX_ENUM = 0x7fffffff, -} VkOpticalFlowUsageFlagBitsNV; - -typedef enum VkOutOfBandQueueTypeNV -{ - VK_OUT_OF_BAND_QUEUE_TYPE_RENDER_NV = 0, - VK_OUT_OF_BAND_QUEUE_TYPE_PRESENT_NV = 1, - VK_OUT_OF_BAND_QUEUE_TYPE_NV_MAX_ENUM = 0x7fffffff, -} VkOutOfBandQueueTypeNV; - -typedef enum VkPeerMemoryFeatureFlagBits -{ - VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = 0x00000001, - VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = 0x00000002, - VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = 0x00000004, - VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 0x00000008, - VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT, - VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR = VK_PEER_MEMORY_FEATURE_COPY_DST_BIT, - VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR = VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT, - VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR = VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT, - VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPeerMemoryFeatureFlagBits; -typedef VkPeerMemoryFeatureFlagBits VkPeerMemoryFeatureFlagBitsKHR; - -typedef enum VkPerformanceConfigurationTypeINTEL -{ - VK_PERFORMANCE_CONFIGURATION_TYPE_COMMAND_QUEUE_METRICS_DISCOVERY_ACTIVATED_INTEL = 0, - VK_PERFORMANCE_CONFIGURATION_TYPE_INTEL_MAX_ENUM = 0x7fffffff, -} VkPerformanceConfigurationTypeINTEL; - -typedef enum VkPerformanceCounterDescriptionFlagBitsKHR -{ - VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR = 0x00000001, - VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR = 0x00000002, - VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_KHR = VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR, - VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_KHR = VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR, - VK_PERFORMANCE_COUNTER_DESCRIPTION_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkPerformanceCounterDescriptionFlagBitsKHR; - -typedef enum VkPerformanceCounterScopeKHR -{ - VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR = 0, - VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR = 1, - VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR = 2, - VK_QUERY_SCOPE_COMMAND_BUFFER_KHR = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR, - VK_QUERY_SCOPE_RENDER_PASS_KHR = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR, - VK_QUERY_SCOPE_COMMAND_KHR = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR, - VK_PERFORMANCE_COUNTER_SCOPE_KHR_MAX_ENUM = 0x7fffffff, -} VkPerformanceCounterScopeKHR; - -typedef enum VkPerformanceCounterStorageKHR -{ - VK_PERFORMANCE_COUNTER_STORAGE_INT32_KHR = 0, - VK_PERFORMANCE_COUNTER_STORAGE_INT64_KHR = 1, - VK_PERFORMANCE_COUNTER_STORAGE_UINT32_KHR = 2, - VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR = 3, - VK_PERFORMANCE_COUNTER_STORAGE_FLOAT32_KHR = 4, - VK_PERFORMANCE_COUNTER_STORAGE_FLOAT64_KHR = 5, - VK_PERFORMANCE_COUNTER_STORAGE_KHR_MAX_ENUM = 0x7fffffff, -} VkPerformanceCounterStorageKHR; - -typedef enum VkPerformanceCounterUnitKHR -{ - VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR = 0, - VK_PERFORMANCE_COUNTER_UNIT_PERCENTAGE_KHR = 1, - VK_PERFORMANCE_COUNTER_UNIT_NANOSECONDS_KHR = 2, - VK_PERFORMANCE_COUNTER_UNIT_BYTES_KHR = 3, - VK_PERFORMANCE_COUNTER_UNIT_BYTES_PER_SECOND_KHR = 4, - VK_PERFORMANCE_COUNTER_UNIT_KELVIN_KHR = 5, - VK_PERFORMANCE_COUNTER_UNIT_WATTS_KHR = 6, - VK_PERFORMANCE_COUNTER_UNIT_VOLTS_KHR = 7, - VK_PERFORMANCE_COUNTER_UNIT_AMPS_KHR = 8, - VK_PERFORMANCE_COUNTER_UNIT_HERTZ_KHR = 9, - VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR = 10, - VK_PERFORMANCE_COUNTER_UNIT_KHR_MAX_ENUM = 0x7fffffff, -} VkPerformanceCounterUnitKHR; - -typedef enum VkPerformanceOverrideTypeINTEL -{ - VK_PERFORMANCE_OVERRIDE_TYPE_NULL_HARDWARE_INTEL = 0, - VK_PERFORMANCE_OVERRIDE_TYPE_FLUSH_GPU_CACHES_INTEL = 1, - VK_PERFORMANCE_OVERRIDE_TYPE_INTEL_MAX_ENUM = 0x7fffffff, -} VkPerformanceOverrideTypeINTEL; - -typedef enum VkPerformanceParameterTypeINTEL -{ - VK_PERFORMANCE_PARAMETER_TYPE_HW_COUNTERS_SUPPORTED_INTEL = 0, - VK_PERFORMANCE_PARAMETER_TYPE_STREAM_MARKER_VALID_BITS_INTEL = 1, - VK_PERFORMANCE_PARAMETER_TYPE_INTEL_MAX_ENUM = 0x7fffffff, -} VkPerformanceParameterTypeINTEL; - -typedef enum VkPerformanceValueTypeINTEL -{ - VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL = 0, - VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL = 1, - VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL = 2, - VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL = 3, - VK_PERFORMANCE_VALUE_TYPE_STRING_INTEL = 4, - VK_PERFORMANCE_VALUE_TYPE_INTEL_MAX_ENUM = 0x7fffffff, -} VkPerformanceValueTypeINTEL; - -typedef enum VkPhysicalDeviceSchedulingControlsFlagBitsARM -{ - VK_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_SHADER_CORE_COUNT_ARM = 0x00000001, - VK_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FLAG_BITS_ARM_MAX_ENUM = 0x7fffffff, -} VkPhysicalDeviceSchedulingControlsFlagBitsARM; - -typedef enum VkPhysicalDeviceType -{ - VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, - VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, - VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, - VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, - VK_PHYSICAL_DEVICE_TYPE_CPU = 4, - VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7fffffff, -} VkPhysicalDeviceType; - -typedef enum VkPipelineBindPoint -{ - VK_PIPELINE_BIND_POINT_GRAPHICS = 0, - VK_PIPELINE_BIND_POINT_COMPUTE = 1, - VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR = 1000165000, - VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI = 1000369003, - VK_PIPELINE_BIND_POINT_RAY_TRACING_NV = VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, - VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7fffffff, -} VkPipelineBindPoint; - -typedef enum VkPipelineCacheCreateFlagBits -{ - VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 0x00000001, - VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT = VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT, - VK_PIPELINE_CACHE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineCacheCreateFlagBits; - -typedef enum VkPipelineCacheHeaderVersion -{ - VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, - VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7fffffff, -} VkPipelineCacheHeaderVersion; - -typedef enum VkPipelineColorBlendStateCreateFlagBits -{ - VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT = 0x00000001, - VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_ARM = VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT, - VK_PIPELINE_COLOR_BLEND_STATE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineColorBlendStateCreateFlagBits; - -typedef enum VkPipelineCompilerControlFlagBitsAMD -{ - VK_PIPELINE_COMPILER_CONTROL_FLAG_BITS_AMD_MAX_ENUM = 0x7fffffff, -} VkPipelineCompilerControlFlagBitsAMD; - -typedef enum VkPipelineCreateFlagBits -{ - VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, - VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, - VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, - VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 0x00000008, - VK_PIPELINE_CREATE_DISPATCH_BASE_BIT = 0x00000010, - VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV = 0x00000020, - VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR = 0x00000040, - VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080, - VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT = 0x00000100, - VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT = 0x00000200, - VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x00000400, - VK_PIPELINE_CREATE_LIBRARY_BIT_KHR = 0x00000800, - VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR = 0x00001000, - VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR = 0x00002000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR = 0x00004000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR = 0x00008000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR = 0x00010000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR = 0x00020000, - VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00040000, - VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR = 0x00080000, - VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x00100000, - VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00200000, - VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00400000, - VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x00800000, - VK_PIPELINE_CREATE_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT = 0x01000000, - VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x02000000, - VK_PIPELINE_CREATE_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x04000000, - VK_PIPELINE_CREATE_NO_PROTECTED_ACCESS_BIT_EXT = 0x08000000, - VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000, - VK_PIPELINE_CREATE_PROTECTED_ACCESS_ONLY_BIT_EXT = 0x40000000, - VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, - VK_PIPELINE_RASTERIZATION_STATE_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR, - VK_PIPELINE_RASTERIZATION_STATE_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT, - VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT, - VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = VK_PIPELINE_CREATE_DISPATCH_BASE, - VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT = VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT, - VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT = VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT, - VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineCreateFlagBits; - -typedef VkFlags64 VkPipelineCreateFlagBits2KHR; - -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DISABLE_OPTIMIZATION_BIT_KHR = 0x00000001ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_ALLOW_DERIVATIVES_BIT_KHR = 0x00000002ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DERIVATIVE_BIT_KHR = 0x00000004ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = 0x00000008ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DISPATCH_BASE_BIT_KHR = 0x00000010ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DEFER_COMPILE_BIT_NV = 0x00000020ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_CAPTURE_STATISTICS_BIT_KHR = 0x00000040ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_KHR = 0x00000100ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_EARLY_RETURN_ON_FAILURE_BIT_KHR = 0x00000200ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x00000400ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR = 0x00000800ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR = 0x00001000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_AABBS_BIT_KHR = 0x00002000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR = 0x00004000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR = 0x00008000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR = 0x00010000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR = 0x00020000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_INDIRECT_BINDABLE_BIT_NV = 0x00040000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR = 0x00080000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x00100000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00200000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00400000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x00800000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT = 0x01000000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x02000000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x04000000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_NO_PROTECTED_ACCESS_BIT_EXT = 0x08000000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_DISPLACEMENT_MICROMAP_BIT_NV = 0x10000000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000ull; -static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_PROTECTED_ACCESS_ONLY_BIT_EXT = 0x40000000ull; - -typedef enum VkPipelineCreationFeedbackFlagBits -{ - VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT = 0x00000001, - VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT = 0x00000002, - VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT = 0x00000004, - VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, - VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT, - VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT, - VK_PIPELINE_CREATION_FEEDBACK_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineCreationFeedbackFlagBits; -typedef VkPipelineCreationFeedbackFlagBits VkPipelineCreationFeedbackFlagBitsEXT; - -typedef enum VkPipelineDepthStencilStateCreateFlagBits -{ - VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT = 0x00000001, - VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT = 0x00000002, - VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_ARM = VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT, - VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_ARM = VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT, - VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineDepthStencilStateCreateFlagBits; - -typedef enum VkPipelineExecutableStatisticFormatKHR -{ - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR = 0, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR = 1, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR = 2, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR = 3, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_KHR_MAX_ENUM = 0x7fffffff, -} VkPipelineExecutableStatisticFormatKHR; - -typedef enum VkPipelineLayoutCreateFlagBits -{ - VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT = 0x00000002, - VK_PIPELINE_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineLayoutCreateFlagBits; - -typedef enum VkPipelineRobustnessBufferBehaviorEXT -{ - VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DEVICE_DEFAULT_EXT = 0, - VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT = 1, - VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT = 2, - VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_2_EXT = 3, - VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_EXT_MAX_ENUM = 0x7fffffff, -} VkPipelineRobustnessBufferBehaviorEXT; - -typedef enum VkPipelineRobustnessImageBehaviorEXT -{ - VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DEVICE_DEFAULT_EXT = 0, - VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DISABLED_EXT = 1, - VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_EXT = 2, - VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_2_EXT = 3, - VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_EXT_MAX_ENUM = 0x7fffffff, -} VkPipelineRobustnessImageBehaviorEXT; - -typedef enum VkPipelineShaderStageCreateFlagBits -{ - VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT = 0x00000001, - VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT = 0x00000002, - VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT, - VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT, - VK_PIPELINE_SHADER_STAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineShaderStageCreateFlagBits; - -typedef enum VkPipelineStageFlagBits -{ - VK_PIPELINE_STAGE_NONE = 0, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, - VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, - VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, - VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, - VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, - VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, - VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, - VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, - VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, - VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, - VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, - VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, - VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, - VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV = 0x00020000, - VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000, - VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT = 0x00080000, - VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT = 0x00100000, - VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR = 0x00200000, - VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00400000, - VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT = 0x00800000, - VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT = 0x01000000, - VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR = 0x02000000, - VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV = VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR, - VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV = VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, - VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV = VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, - VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV = VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT, - VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV = VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT, - VK_PIPELINE_STAGE_NONE_KHR = VK_PIPELINE_STAGE_NONE, - VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkPipelineStageFlagBits; - -typedef VkFlags64 VkPipelineStageFlagBits2; - -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_NONE = 0ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_NONE_KHR = 0ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT = 0x00000001ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR = 0x00000001ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT = 0x00000002ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR = 0x00000002ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT = 0x00000004ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR = 0x00000004ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT = 0x00000008ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR = 0x00000008ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR = 0x00000010ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR = 0x00000020ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT = 0x00000040ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR = 0x00000040ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT = 0x00000080ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR = 0x00000080ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT = 0x00000100ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR = 0x00000100ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT = 0x00000200ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR = 0x00000200ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR = 0x00000400ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT = 0x00000800ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR = 0x00000800ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT = 0x00001000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR = 0x00001000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFER_BIT = 0x00001000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFER_BIT_KHR = 0x00001000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT = 0x00002000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR = 0x00002000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_HOST_BIT = 0x00004000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_HOST_BIT_KHR = 0x00004000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT = 0x00008000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR = 0x00008000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT = 0x00010000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR = 0x00010000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV = 0x00020000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV = 0x00080000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT = 0x00080000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV = 0x00100000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT = 0x00100000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR = 0x00200000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_NV = 0x00200000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00400000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV = 0x00400000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT = 0x00800000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT = 0x01000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR = 0x02000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_NV = 0x02000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR = 0x10000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_OPTICAL_FLOW_BIT_NV = 0x20000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MICROMAP_BUILD_BIT_EXT = 0x40000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COPY_BIT = 0x100000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COPY_BIT_KHR = 0x100000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RESOLVE_BIT = 0x200000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR = 0x200000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BLIT_BIT = 0x400000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BLIT_BIT_KHR = 0x400000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLEAR_BIT = 0x800000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR = 0x800000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT = 0x1000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR = 0x1000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT = 0x2000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR = 0x2000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT = 0x4000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR = 0x4000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SUBPASS_SHADER_BIT_HUAWEI = 0x8000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI = 0x8000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI = 0x10000000000ull; -static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLUSTER_CULLING_SHADER_BIT_HUAWEI = 0x20000000000ull; -typedef VkPipelineStageFlagBits2 VkPipelineStageFlagBits2KHR; - -typedef enum VkPointClippingBehavior -{ - VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0, - VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1, - VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES, - VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY, - VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = 0x7fffffff, -} VkPointClippingBehavior; -typedef VkPointClippingBehavior VkPointClippingBehaviorKHR; - -typedef enum VkPolygonMode -{ - VK_POLYGON_MODE_FILL = 0, - VK_POLYGON_MODE_LINE = 1, - VK_POLYGON_MODE_POINT = 2, - VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, - VK_POLYGON_MODE_MAX_ENUM = 0x7fffffff, -} VkPolygonMode; - -typedef enum VkPresentGravityFlagBitsEXT -{ - VK_PRESENT_GRAVITY_MIN_BIT_EXT = 0x00000001, - VK_PRESENT_GRAVITY_MAX_BIT_EXT = 0x00000002, - VK_PRESENT_GRAVITY_CENTERED_BIT_EXT = 0x00000004, - VK_PRESENT_GRAVITY_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkPresentGravityFlagBitsEXT; - -typedef enum VkPresentModeKHR -{ - VK_PRESENT_MODE_IMMEDIATE_KHR = 0, - VK_PRESENT_MODE_MAILBOX_KHR = 1, - VK_PRESENT_MODE_FIFO_KHR = 2, - VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, - VK_PRESENT_MODE_KHR_MAX_ENUM = 0x7fffffff, -} VkPresentModeKHR; - -typedef enum VkPresentScalingFlagBitsEXT -{ - VK_PRESENT_SCALING_ONE_TO_ONE_BIT_EXT = 0x00000001, - VK_PRESENT_SCALING_ASPECT_RATIO_STRETCH_BIT_EXT = 0x00000002, - VK_PRESENT_SCALING_STRETCH_BIT_EXT = 0x00000004, - VK_PRESENT_SCALING_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkPresentScalingFlagBitsEXT; - -typedef enum VkPrimitiveTopology -{ - VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, - VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, - VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, - VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, - VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7fffffff, -} VkPrimitiveTopology; - -typedef enum VkProvokingVertexModeEXT -{ - VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT = 0, - VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT = 1, - VK_PROVOKING_VERTEX_MODE_EXT_MAX_ENUM = 0x7fffffff, -} VkProvokingVertexModeEXT; - -typedef enum VkQueryControlFlagBits -{ - VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, - VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkQueryControlFlagBits; - -typedef enum VkQueryPipelineStatisticFlagBits -{ - VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, - VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, - VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, - VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, - VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, - VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, - VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, - VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, - VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, - VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, - VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, - VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT = 0x00000800, - VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT = 0x00001000, - VK_QUERY_PIPELINE_STATISTIC_CLUSTER_CULLING_SHADER_INVOCATIONS_BIT_HUAWEI = 0x00002000, - VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkQueryPipelineStatisticFlagBits; - -typedef enum VkQueryPoolSamplingModeINTEL -{ - VK_QUERY_POOL_SAMPLING_MODE_MANUAL_INTEL = 0, - VK_QUERY_POOL_SAMPLING_MODE_INTEL_MAX_ENUM = 0x7fffffff, -} VkQueryPoolSamplingModeINTEL; - -typedef enum VkQueryResultFlagBits -{ - VK_QUERY_RESULT_64_BIT = 0x00000001, - VK_QUERY_RESULT_WAIT_BIT = 0x00000002, - VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, - VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, - VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkQueryResultFlagBits; - -typedef enum VkQueryType -{ - VK_QUERY_TYPE_OCCLUSION = 0, - VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, - VK_QUERY_TYPE_TIMESTAMP = 2, - VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT = 1000028004, - VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR = 1000116000, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR = 1000150000, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR = 1000150001, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV = 1000165000, - VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL = 1000210000, - VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT = 1000328000, - VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT = 1000382000, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR = 1000386000, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR = 1000386001, - VK_QUERY_TYPE_MICROMAP_SERIALIZATION_SIZE_EXT = 1000396000, - VK_QUERY_TYPE_MICROMAP_COMPACTED_SIZE_EXT = 1000396001, - VK_QUERY_TYPE_MAX_ENUM = 0x7fffffff, -} VkQueryType; - -typedef enum VkQueueFlagBits -{ - VK_QUEUE_GRAPHICS_BIT = 0x00000001, - VK_QUEUE_COMPUTE_BIT = 0x00000002, - VK_QUEUE_TRANSFER_BIT = 0x00000004, - VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, - VK_QUEUE_PROTECTED_BIT = 0x00000010, - VK_QUEUE_OPTICAL_FLOW_BIT_NV = 0x00000100, - VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkQueueFlagBits; - -typedef enum VkQueueGlobalPriorityKHR -{ - VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR = 128, - VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR = 256, - VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR = 512, - VK_QUEUE_GLOBAL_PRIORITY_REALTIME_KHR = 1024, - VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR, - VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT = VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR, - VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT = VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR, - VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT = VK_QUEUE_GLOBAL_PRIORITY_REALTIME_KHR, - VK_QUEUE_GLOBAL_PRIORITY_KHR_MAX_ENUM = 0x7fffffff, -} VkQueueGlobalPriorityKHR; -typedef VkQueueGlobalPriorityKHR VkQueueGlobalPriorityEXT; - -typedef enum VkRasterizationOrderAMD -{ - VK_RASTERIZATION_ORDER_STRICT_AMD = 0, - VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, - VK_RASTERIZATION_ORDER_AMD_MAX_ENUM = 0x7fffffff, -} VkRasterizationOrderAMD; - -typedef enum VkRayTracingInvocationReorderModeNV -{ - VK_RAY_TRACING_INVOCATION_REORDER_MODE_NONE_NV = 0, - VK_RAY_TRACING_INVOCATION_REORDER_MODE_REORDER_NV = 1, - VK_RAY_TRACING_INVOCATION_REORDER_MODE_NV_MAX_ENUM = 0x7fffffff, -} VkRayTracingInvocationReorderModeNV; - -typedef enum VkRayTracingShaderGroupTypeKHR -{ - VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR = 0, - VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR = 1, - VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR = 2, - VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR, - VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, - VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, - VK_RAY_TRACING_SHADER_GROUP_TYPE_KHR_MAX_ENUM = 0x7fffffff, -} VkRayTracingShaderGroupTypeKHR; -typedef VkRayTracingShaderGroupTypeKHR VkRayTracingShaderGroupTypeNV; - -typedef enum VkRenderPassCreateFlagBits -{ - VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM = 0x00000002, - VK_RENDER_PASS_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkRenderPassCreateFlagBits; - -typedef enum VkRenderingFlagBits -{ - VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT = 0x00000001, - VK_RENDERING_SUSPENDING_BIT = 0x00000002, - VK_RENDERING_RESUMING_BIT = 0x00000004, - VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT = 0x00000008, - VK_RENDERING_CONTENTS_INLINE_BIT_EXT = 0x00000010, - VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT_KHR = VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT, - VK_RENDERING_SUSPENDING_BIT_KHR = VK_RENDERING_SUSPENDING_BIT, - VK_RENDERING_RESUMING_BIT_KHR = VK_RENDERING_RESUMING_BIT, - VK_RENDERING_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkRenderingFlagBits; -typedef VkRenderingFlagBits VkRenderingFlagBitsKHR; - -typedef enum VkResolveModeFlagBits -{ - VK_RESOLVE_MODE_NONE = 0, - VK_RESOLVE_MODE_SAMPLE_ZERO_BIT = 0x00000001, - VK_RESOLVE_MODE_AVERAGE_BIT = 0x00000002, - VK_RESOLVE_MODE_MIN_BIT = 0x00000004, - VK_RESOLVE_MODE_MAX_BIT = 0x00000008, - VK_RESOLVE_MODE_NONE_KHR = VK_RESOLVE_MODE_NONE, - VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, - VK_RESOLVE_MODE_AVERAGE_BIT_KHR = VK_RESOLVE_MODE_AVERAGE_BIT, - VK_RESOLVE_MODE_MIN_BIT_KHR = VK_RESOLVE_MODE_MIN_BIT, - VK_RESOLVE_MODE_MAX_BIT_KHR = VK_RESOLVE_MODE_MAX_BIT, - VK_RESOLVE_MODE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkResolveModeFlagBits; -typedef VkResolveModeFlagBits VkResolveModeFlagBitsKHR; - -typedef enum VkResult -{ - VK_ERROR_COMPRESSION_EXHAUSTED_EXT = -1000338000, - VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000, - VK_ERROR_NOT_PERMITTED_KHR = -1000174001, - VK_ERROR_FRAGMENTATION = -1000161000, - VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003, - VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000, - VK_ERROR_INVALID_SHADER_NV = -1000012000, - VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, - VK_ERROR_OUT_OF_DATE_KHR = -1000001004, - VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, - VK_ERROR_SURFACE_LOST_KHR = -1000000000, - VK_ERROR_UNKNOWN = -13, - VK_ERROR_FRAGMENTED_POOL = -12, - VK_ERROR_FORMAT_NOT_SUPPORTED = -11, - VK_ERROR_TOO_MANY_OBJECTS = -10, - VK_ERROR_INCOMPATIBLE_DRIVER = -9, - VK_ERROR_FEATURE_NOT_PRESENT = -8, - VK_ERROR_EXTENSION_NOT_PRESENT = -7, - VK_ERROR_LAYER_NOT_PRESENT = -6, - VK_ERROR_MEMORY_MAP_FAILED = -5, - VK_ERROR_DEVICE_LOST = -4, - VK_ERROR_INITIALIZATION_FAILED = -3, - VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, - VK_ERROR_OUT_OF_HOST_MEMORY = -1, - VK_SUCCESS = 0, - VK_NOT_READY = 1, - VK_TIMEOUT = 2, - VK_EVENT_SET = 3, - VK_EVENT_RESET = 4, - VK_INCOMPLETE = 5, - VK_SUBOPTIMAL_KHR = 1000001003, - VK_THREAD_IDLE_KHR = 1000268000, - VK_THREAD_DONE_KHR = 1000268001, - VK_OPERATION_DEFERRED_KHR = 1000268002, - VK_OPERATION_NOT_DEFERRED_KHR = 1000268003, - VK_PIPELINE_COMPILE_REQUIRED = 1000297000, - VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT = 1000482000, - VK_ERROR_OUT_OF_POOL_MEMORY_KHR = VK_ERROR_OUT_OF_POOL_MEMORY, - VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = VK_ERROR_INVALID_EXTERNAL_HANDLE, - VK_ERROR_FRAGMENTATION_EXT = VK_ERROR_FRAGMENTATION, - VK_ERROR_NOT_PERMITTED_EXT = VK_ERROR_NOT_PERMITTED_KHR, - VK_ERROR_INVALID_DEVICE_ADDRESS_EXT = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS, - VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS, - VK_PIPELINE_COMPILE_REQUIRED_EXT = VK_PIPELINE_COMPILE_REQUIRED, - VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT = VK_PIPELINE_COMPILE_REQUIRED, - VK_RESULT_MAX_ENUM = 0x7fffffff, -} VkResult; - -typedef enum VkSampleCountFlagBits -{ - VK_SAMPLE_COUNT_1_BIT = 0x00000001, - VK_SAMPLE_COUNT_2_BIT = 0x00000002, - VK_SAMPLE_COUNT_4_BIT = 0x00000004, - VK_SAMPLE_COUNT_8_BIT = 0x00000008, - VK_SAMPLE_COUNT_16_BIT = 0x00000010, - VK_SAMPLE_COUNT_32_BIT = 0x00000020, - VK_SAMPLE_COUNT_64_BIT = 0x00000040, - VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSampleCountFlagBits; - -typedef enum VkSamplerAddressMode -{ - VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, - VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, - VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, - VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE_KHR = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, - VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7fffffff, -} VkSamplerAddressMode; - -typedef enum VkSamplerCreateFlagBits -{ - VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT = 0x00000001, - VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT = 0x00000002, - VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT = 0x00000004, - VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000008, - VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM = 0x00000010, - VK_SAMPLER_CREATE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSamplerCreateFlagBits; - -typedef enum VkSamplerMipmapMode -{ - VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, - VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, - VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7fffffff, -} VkSamplerMipmapMode; - -typedef enum VkSamplerReductionMode -{ - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, - VK_SAMPLER_REDUCTION_MODE_MIN = 1, - VK_SAMPLER_REDUCTION_MODE_MAX = 2, - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_RANGECLAMP_QCOM = 1000521000, - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE, - VK_SAMPLER_REDUCTION_MODE_MIN_EXT = VK_SAMPLER_REDUCTION_MODE_MIN, - VK_SAMPLER_REDUCTION_MODE_MAX_EXT = VK_SAMPLER_REDUCTION_MODE_MAX, - VK_SAMPLER_REDUCTION_MODE_MAX_ENUM = 0x7fffffff, -} VkSamplerReductionMode; -typedef VkSamplerReductionMode VkSamplerReductionModeEXT; - -typedef enum VkSamplerYcbcrModelConversion -{ - VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = 1, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = 2, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = 3, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = 0x7fffffff, -} VkSamplerYcbcrModelConversion; -typedef VkSamplerYcbcrModelConversion VkSamplerYcbcrModelConversionKHR; - -typedef enum VkSamplerYcbcrRange -{ - VK_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, - VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1, - VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_FULL, - VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_NARROW, - VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = 0x7fffffff, -} VkSamplerYcbcrRange; -typedef VkSamplerYcbcrRange VkSamplerYcbcrRangeKHR; - -typedef enum VkScopeKHR -{ - VK_SCOPE_DEVICE_KHR = 1, - VK_SCOPE_WORKGROUP_KHR = 2, - VK_SCOPE_SUBGROUP_KHR = 3, - VK_SCOPE_QUEUE_FAMILY_KHR = 5, - VK_SCOPE_DEVICE_NV = VK_SCOPE_DEVICE_KHR, - VK_SCOPE_WORKGROUP_NV = VK_SCOPE_WORKGROUP_KHR, - VK_SCOPE_SUBGROUP_NV = VK_SCOPE_SUBGROUP_KHR, - VK_SCOPE_QUEUE_FAMILY_NV = VK_SCOPE_QUEUE_FAMILY_KHR, - VK_SCOPE_KHR_MAX_ENUM = 0x7fffffff, -} VkScopeKHR; -typedef VkScopeKHR VkScopeNV; - -typedef enum VkSemaphoreImportFlagBits -{ - VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 0x00000001, - VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT, - VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSemaphoreImportFlagBits; -typedef VkSemaphoreImportFlagBits VkSemaphoreImportFlagBitsKHR; - -typedef enum VkSemaphoreType -{ - VK_SEMAPHORE_TYPE_BINARY = 0, - VK_SEMAPHORE_TYPE_TIMELINE = 1, - VK_SEMAPHORE_TYPE_BINARY_KHR = VK_SEMAPHORE_TYPE_BINARY, - VK_SEMAPHORE_TYPE_TIMELINE_KHR = VK_SEMAPHORE_TYPE_TIMELINE, - VK_SEMAPHORE_TYPE_MAX_ENUM = 0x7fffffff, -} VkSemaphoreType; -typedef VkSemaphoreType VkSemaphoreTypeKHR; - -typedef enum VkSemaphoreWaitFlagBits -{ - VK_SEMAPHORE_WAIT_ANY_BIT = 0x00000001, - VK_SEMAPHORE_WAIT_ANY_BIT_KHR = VK_SEMAPHORE_WAIT_ANY_BIT, - VK_SEMAPHORE_WAIT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSemaphoreWaitFlagBits; -typedef VkSemaphoreWaitFlagBits VkSemaphoreWaitFlagBitsKHR; - -typedef enum VkShaderCodeTypeEXT -{ - VK_SHADER_CODE_TYPE_BINARY_EXT = 0, - VK_SHADER_CODE_TYPE_SPIRV_EXT = 1, - VK_SHADER_CODE_TYPE_EXT_MAX_ENUM = 0x7fffffff, -} VkShaderCodeTypeEXT; - -typedef enum VkShaderCorePropertiesFlagBitsAMD -{ - VK_SHADER_CORE_PROPERTIES_FLAG_BITS_AMD_MAX_ENUM = 0x7fffffff, -} VkShaderCorePropertiesFlagBitsAMD; - -typedef enum VkShaderCreateFlagBitsEXT -{ - VK_SHADER_CREATE_LINK_STAGE_BIT_EXT = 0x00000001, - VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = 0x00000002, - VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = 0x00000004, - VK_SHADER_CREATE_NO_TASK_SHADER_BIT_EXT = 0x00000008, - VK_SHADER_CREATE_DISPATCH_BASE_BIT_EXT = 0x00000010, - VK_SHADER_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_EXT = 0x00000020, - VK_SHADER_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00000040, - VK_SHADER_CREATE_FLAG_BITS_EXT_MAX_ENUM = 0x7fffffff, -} VkShaderCreateFlagBitsEXT; - -typedef enum VkShaderFloatControlsIndependence -{ - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY = 0, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL = 1, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE = 2, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_MAX_ENUM = 0x7fffffff, -} VkShaderFloatControlsIndependence; -typedef VkShaderFloatControlsIndependence VkShaderFloatControlsIndependenceKHR; - -typedef enum VkShaderGroupShaderKHR -{ - VK_SHADER_GROUP_SHADER_GENERAL_KHR = 0, - VK_SHADER_GROUP_SHADER_CLOSEST_HIT_KHR = 1, - VK_SHADER_GROUP_SHADER_ANY_HIT_KHR = 2, - VK_SHADER_GROUP_SHADER_INTERSECTION_KHR = 3, - VK_SHADER_GROUP_SHADER_KHR_MAX_ENUM = 0x7fffffff, -} VkShaderGroupShaderKHR; - -typedef enum VkShaderInfoTypeAMD -{ - VK_SHADER_INFO_TYPE_STATISTICS_AMD = 0, - VK_SHADER_INFO_TYPE_BINARY_AMD = 1, - VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD = 2, - VK_SHADER_INFO_TYPE_AMD_MAX_ENUM = 0x7fffffff, -} VkShaderInfoTypeAMD; - -typedef enum VkShaderStageFlagBits -{ - VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, - VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, - VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, - VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, - VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, - VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001f, - VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, - VK_SHADER_STAGE_TASK_BIT_EXT = 0x00000040, - VK_SHADER_STAGE_MESH_BIT_EXT = 0x00000080, - VK_SHADER_STAGE_RAYGEN_BIT_KHR = 0x00000100, - VK_SHADER_STAGE_ANY_HIT_BIT_KHR = 0x00000200, - VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = 0x00000400, - VK_SHADER_STAGE_MISS_BIT_KHR = 0x00000800, - VK_SHADER_STAGE_INTERSECTION_BIT_KHR = 0x00001000, - VK_SHADER_STAGE_CALLABLE_BIT_KHR = 0x00002000, - VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI = 0x00004000, - VK_SHADER_STAGE_CLUSTER_CULLING_BIT_HUAWEI = 0x00080000, - VK_SHADER_STAGE_RAYGEN_BIT_NV = VK_SHADER_STAGE_RAYGEN_BIT_KHR, - VK_SHADER_STAGE_ANY_HIT_BIT_NV = VK_SHADER_STAGE_ANY_HIT_BIT_KHR, - VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, - VK_SHADER_STAGE_MISS_BIT_NV = VK_SHADER_STAGE_MISS_BIT_KHR, - VK_SHADER_STAGE_INTERSECTION_BIT_NV = VK_SHADER_STAGE_INTERSECTION_BIT_KHR, - VK_SHADER_STAGE_CALLABLE_BIT_NV = VK_SHADER_STAGE_CALLABLE_BIT_KHR, - VK_SHADER_STAGE_TASK_BIT_NV = VK_SHADER_STAGE_TASK_BIT_EXT, - VK_SHADER_STAGE_MESH_BIT_NV = VK_SHADER_STAGE_MESH_BIT_EXT, - VK_SHADER_STAGE_ALL = 0x7fffffff, -} VkShaderStageFlagBits; - -typedef enum VkShadingRatePaletteEntryNV -{ - VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV = 0, - VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV = 1, - VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV = 2, - VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV = 3, - VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV = 4, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV = 5, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV = 6, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV = 7, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV = 8, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV = 9, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV = 10, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV = 11, - VK_SHADING_RATE_PALETTE_ENTRY_NV_MAX_ENUM = 0x7fffffff, -} VkShadingRatePaletteEntryNV; - -typedef enum VkSharingMode -{ - VK_SHARING_MODE_EXCLUSIVE = 0, - VK_SHARING_MODE_CONCURRENT = 1, - VK_SHARING_MODE_MAX_ENUM = 0x7fffffff, -} VkSharingMode; - -typedef enum VkSparseImageFormatFlagBits -{ - VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, - VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, - VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, - VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSparseImageFormatFlagBits; - -typedef enum VkSparseMemoryBindFlagBits -{ - VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, - VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSparseMemoryBindFlagBits; - -typedef enum VkStencilFaceFlagBits -{ - VK_STENCIL_FACE_FRONT_BIT = 0x00000001, - VK_STENCIL_FACE_BACK_BIT = 0x00000002, - VK_STENCIL_FACE_FRONT_AND_BACK = 0x00000003, - VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK, - VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkStencilFaceFlagBits; - -typedef enum VkStencilOp -{ - VK_STENCIL_OP_KEEP = 0, - VK_STENCIL_OP_ZERO = 1, - VK_STENCIL_OP_REPLACE = 2, - VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, - VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, - VK_STENCIL_OP_INVERT = 5, - VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, - VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, - VK_STENCIL_OP_MAX_ENUM = 0x7fffffff, -} VkStencilOp; - -typedef enum VkStructureType -{ - VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, - VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, - VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, - VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, - VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, - VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, - VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, - VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, - VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, - VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, - VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, - VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES = 49, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES = 50, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES = 51, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES = 52, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES = 53, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES = 54, - VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, - VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, - VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, - VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, - VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, - VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, - VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT = 1000028000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT = 1000028001, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT = 1000028002, - VK_STRUCTURE_TYPE_CU_MODULE_CREATE_INFO_NVX = 1000029000, - VK_STRUCTURE_TYPE_CU_FUNCTION_CREATE_INFO_NVX = 1000029001, - VK_STRUCTURE_TYPE_CU_LAUNCH_INFO_NVX = 1000029002, - VK_STRUCTURE_TYPE_IMAGE_VIEW_HANDLE_INFO_NVX = 1000030000, - VK_STRUCTURE_TYPE_IMAGE_VIEW_ADDRESS_PROPERTIES_NVX = 1000030001, - VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, - VK_STRUCTURE_TYPE_RENDERING_INFO = 1000044000, - VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO = 1000044001, - VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO = 1000044002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES = 1000044003, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO = 1000044004, - VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR = 1000044006, - VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT = 1000044007, - VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD = 1000044008, - VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_ATTRIBUTES_INFO_NVX = 1000044009, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV = 1000050000, - VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO = 1000053000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES = 1000053001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES = 1000053002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 = 1000059000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 = 1000059001, - VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2 = 1000059002, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2 = 1000059003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2 = 1000059004, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2 = 1000059005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2 = 1000059006, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2 = 1000059007, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2 = 1000059008, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO = 1000060000, - VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO = 1000060003, - VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO = 1000060004, - VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO = 1000060005, - VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO = 1000060006, - VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007, - VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR = 1000060008, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR = 1000060009, - VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR = 1000060010, - VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = 1000060011, - VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = 1000060012, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO = 1000060013, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO = 1000060014, - VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES = 1000063000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES = 1000066000, - VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT = 1000067000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT = 1000067001, - VK_STRUCTURE_TYPE_PIPELINE_ROBUSTNESS_CREATE_INFO_EXT = 1000068000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_FEATURES_EXT = 1000068001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_ROBUSTNESS_PROPERTIES_EXT = 1000068002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES = 1000070000, - VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO = 1000070001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO = 1000071000, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES = 1000071001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO = 1000071002, - VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES = 1000071003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES = 1000071004, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO = 1000072000, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO = 1000072001, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO = 1000072002, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, - VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, - VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO = 1000076000, - VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES = 1000076001, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO = 1000077000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT = 1000081000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT = 1000081001, - VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT = 1000081002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES = 1000082000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES = 1000083000, - VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, - VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO = 1000085000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, - VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT = 1000101000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT = 1000101001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT = 1000102000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT = 1000102001, - VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES = 1000108000, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO = 1000108001, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO = 1000108002, - VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO = 1000108003, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2 = 1000109000, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 = 1000109001, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2 = 1000109002, - VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2 = 1000109003, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2 = 1000109004, - VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO = 1000109005, - VK_STRUCTURE_TYPE_SUBPASS_END_INFO = 1000109006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG = 1000110000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO = 1000112000, - VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES = 1000112001, - VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO = 1000113000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR = 1000116000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR = 1000116001, - VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR = 1000116002, - VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR = 1000116003, - VK_STRUCTURE_TYPE_ACQUIRE_PROFILING_LOCK_INFO_KHR = 1000116004, - VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_KHR = 1000116005, - VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_DESCRIPTION_KHR = 1000116006, - VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_RESERVATION_INFO_KHR = 1000116007, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES = 1000117000, - VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO = 1000117001, - VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO = 1000117002, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO = 1000117003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, - VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES = 1000120000, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS = 1000127000, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO = 1000127001, - VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = 1000128000, - VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT = 1000128001, - VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT = 1000128002, - VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT = 1000128003, - VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT = 1000128004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES = 1000130000, - VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO = 1000130001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES = 1000138000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES = 1000138001, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK = 1000138002, - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO = 1000138003, - VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, - VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, - VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT = 1000143003, - VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT = 1000143004, - VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO = 1000145000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES = 1000145001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES = 1000145002, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2 = 1000145003, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2 = 1000146000, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2 = 1000146001, - VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2 = 1000146002, - VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 = 1000146003, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2 = 1000146004, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO = 1000147000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, - VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR = 1000150000, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR = 1000150002, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR = 1000150003, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR = 1000150004, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR = 1000150005, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR = 1000150006, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR = 1000150007, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_VERSION_INFO_KHR = 1000150009, - VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_INFO_KHR = 1000150010, - VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_TO_MEMORY_INFO_KHR = 1000150011, - VK_STRUCTURE_TYPE_COPY_MEMORY_TO_ACCELERATION_STRUCTURE_INFO_KHR = 1000150012, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR = 1000150013, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR = 1000150014, - VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR = 1000150015, - VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR = 1000150016, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR = 1000150017, - VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR = 1000150018, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR = 1000150020, - VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV = 1000154000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV = 1000154001, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO = 1000156000, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO = 1000156001, - VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO = 1000156002, - VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO = 1000156003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES = 1000156004, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES = 1000156005, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO = 1000157001, - VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160000, - VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160001, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO = 1000161000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES = 1000161001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES = 1000161002, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO = 1000161003, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT = 1000161004, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV = 1000164000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV = 1000164001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV = 1000164002, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV = 1000164005, - VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV = 1000165000, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV = 1000165001, - VK_STRUCTURE_TYPE_GEOMETRY_NV = 1000165003, - VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV = 1000165004, - VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV = 1000165005, - VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV = 1000165006, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV = 1000165007, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV = 1000165008, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV = 1000165009, - VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV = 1000165011, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV = 1000165012, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV = 1000166000, - VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV = 1000166001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES = 1000168000, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = 1000168001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT = 1000170000, - VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT = 1000170001, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR = 1000174000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES = 1000175000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES = 1000177000, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, - VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES = 1000180000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR = 1000181000, - VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD = 1000183000, - VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, - VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD = 1000189000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = 1000190002, - VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO = 1000192000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES = 1000196000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES = 1000197000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES = 1000199000, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE = 1000199001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV = 1000201000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV = 1000202000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV = 1000202001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR = 1000203000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV = 1000204000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV = 1000205000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV = 1000205002, - VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV = 1000206000, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV = 1000206001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES = 1000207000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES = 1000207001, - VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO = 1000207002, - VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO = 1000207003, - VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO = 1000207004, - VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO = 1000207005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL = 1000209000, - VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL = 1000210000, - VK_STRUCTURE_TYPE_INITIALIZE_PERFORMANCE_API_INFO_INTEL = 1000210001, - VK_STRUCTURE_TYPE_PERFORMANCE_MARKER_INFO_INTEL = 1000210002, - VK_STRUCTURE_TYPE_PERFORMANCE_STREAM_MARKER_INFO_INTEL = 1000210003, - VK_STRUCTURE_TYPE_PERFORMANCE_OVERRIDE_INFO_INTEL = 1000210004, - VK_STRUCTURE_TYPE_PERFORMANCE_CONFIGURATION_ACQUIRE_INFO_INTEL = 1000210005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES = 1000211000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT = 1000212000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES = 1000215000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT = 1000218000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT = 1000218001, - VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT = 1000218002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES = 1000221000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES = 1000225000, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO = 1000225001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES = 1000225002, - VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR = 1000226000, - VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR = 1000226001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR = 1000226002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR = 1000226003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_KHR = 1000226004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD = 1000227000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD = 1000229000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT = 1000234000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT = 1000237000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT = 1000238000, - VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT = 1000238001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV = 1000240000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES = 1000241000, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT = 1000241001, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT = 1000241002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT = 1000244000, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO = 1000244001, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT = 1000244002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES = 1000245000, - VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO = 1000246000, - VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT = 1000247000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR = 1000248000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV = 1000249000, - VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_NV = 1000249001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV = 1000249002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV = 1000250000, - VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV = 1000250001, - VK_STRUCTURE_TYPE_FRAMEBUFFER_MIXED_SAMPLES_COMBINATION_NV = 1000250002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT = 1000251000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT = 1000252000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES = 1000253000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT = 1000254000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT = 1000254001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT = 1000254002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES = 1000257000, - VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO = 1000257002, - VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO = 1000257003, - VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO = 1000257004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT = 1000259000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT = 1000259001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT = 1000259002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT = 1000260000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES = 1000261000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT = 1000265000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR = 1000269000, - VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR = 1000269001, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR = 1000269002, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR = 1000269003, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR = 1000269004, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR = 1000269005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT = 1000270000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT = 1000270001, - VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT = 1000270002, - VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT = 1000270003, - VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT = 1000270004, - VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT = 1000270005, - VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT = 1000270006, - VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT = 1000270007, - VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT = 1000270008, - VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT = 1000270009, - VK_STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR = 1000271000, - VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR = 1000271001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT = 1000273000, - VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT = 1000274000, - VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT = 1000274001, - VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT = 1000274002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT = 1000275000, - VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_FENCE_INFO_EXT = 1000275001, - VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT = 1000275002, - VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT = 1000275003, - VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_SCALING_CREATE_INFO_EXT = 1000275004, - VK_STRUCTURE_TYPE_RELEASE_SWAPCHAIN_IMAGES_INFO_EXT = 1000275005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES = 1000276000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV = 1000277000, - VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV = 1000277001, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV = 1000277002, - VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_TOKEN_NV = 1000277003, - VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NV = 1000277004, - VK_STRUCTURE_TYPE_GENERATED_COMMANDS_INFO_NV = 1000277005, - VK_STRUCTURE_TYPE_GENERATED_COMMANDS_MEMORY_REQUIREMENTS_INFO_NV = 1000277006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV = 1000277007, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV = 1000278000, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV = 1000278001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES = 1000280000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES = 1000280001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT = 1000281000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES = 1000281001, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM = 1000282000, - VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM = 1000282001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT = 1000283000, - VK_STRUCTURE_TYPE_DEPTH_BIAS_INFO_EXT = 1000283001, - VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT = 1000283002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT = 1000286000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT = 1000286001, - VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT = 1000287000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT = 1000287001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT = 1000287002, - VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR = 1000290000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV = 1000292000, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV = 1000292001, - VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_BARRIER_CREATE_INFO_NV = 1000292002, - VK_STRUCTURE_TYPE_PRESENT_ID_KHR = 1000294000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR = 1000294001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES = 1000295000, - VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO = 1000295001, - VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO = 1000295002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES = 1000297000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV = 1000300000, - VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV = 1000300001, - VK_STRUCTURE_TYPE_CUDA_MODULE_CREATE_INFO_NV = 1000307000, - VK_STRUCTURE_TYPE_CUDA_FUNCTION_CREATE_INFO_NV = 1000307001, - VK_STRUCTURE_TYPE_CUDA_LAUNCH_INFO_NV = 1000307002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV = 1000307003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV = 1000307004, - VK_STRUCTURE_TYPE_QUERY_LOW_LATENCY_SUPPORT_NV = 1000310000, - VK_STRUCTURE_TYPE_MEMORY_BARRIER_2 = 1000314000, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2 = 1000314001, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2 = 1000314002, - VK_STRUCTURE_TYPE_DEPENDENCY_INFO = 1000314003, - VK_STRUCTURE_TYPE_SUBMIT_INFO_2 = 1000314004, - VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO = 1000314005, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO = 1000314006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES = 1000314007, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV = 1000314008, - VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV = 1000314009, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT = 1000316000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT = 1000316001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT = 1000316002, - VK_STRUCTURE_TYPE_DESCRIPTOR_ADDRESS_INFO_EXT = 1000316003, - VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT = 1000316004, - VK_STRUCTURE_TYPE_BUFFER_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316005, - VK_STRUCTURE_TYPE_IMAGE_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316006, - VK_STRUCTURE_TYPE_IMAGE_VIEW_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316007, - VK_STRUCTURE_TYPE_SAMPLER_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316008, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316009, - VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT = 1000316010, - VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_INFO_EXT = 1000316011, - VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_PUSH_DESCRIPTOR_BUFFER_HANDLE_EXT = 1000316012, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT = 1000320000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT = 1000320001, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT = 1000320002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_FEATURES_AMD = 1000321000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR = 1000322000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_FEATURES_KHR = 1000323000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES = 1000325000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV = 1000326000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV = 1000326001, - VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV = 1000326002, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_MOTION_TRIANGLES_DATA_NV = 1000327000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MOTION_BLUR_FEATURES_NV = 1000327001, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MOTION_INFO_NV = 1000327002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT = 1000328000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT = 1000328001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT = 1000330000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT = 1000332000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT = 1000332001, - VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM = 1000333000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES = 1000335000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR = 1000336000, - VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2 = 1000337000, - VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2 = 1000337001, - VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2 = 1000337002, - VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2 = 1000337003, - VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2 = 1000337004, - VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2 = 1000337005, - VK_STRUCTURE_TYPE_BUFFER_COPY_2 = 1000337006, - VK_STRUCTURE_TYPE_IMAGE_COPY_2 = 1000337007, - VK_STRUCTURE_TYPE_IMAGE_BLIT_2 = 1000337008, - VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2 = 1000337009, - VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2 = 1000337010, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT = 1000338000, - VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT = 1000338001, - VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR = 1000338002, - VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR = 1000338003, - VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT = 1000338004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT = 1000339000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT = 1000340000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT = 1000341000, - VK_STRUCTURE_TYPE_DEVICE_FAULT_COUNTS_EXT = 1000341001, - VK_STRUCTURE_TYPE_DEVICE_FAULT_INFO_EXT = 1000341002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT = 1000342000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT = 1000344000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR = 1000347000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR = 1000347001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR = 1000348013, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT = 1000351000, - VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT = 1000351002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT = 1000352000, - VK_STRUCTURE_TYPE_VERTEX_INPUT_BINDING_DESCRIPTION_2_EXT = 1000352001, - VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT = 1000352002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT = 1000354000, - VK_STRUCTURE_TYPE_DEVICE_ADDRESS_BINDING_CALLBACK_DATA_EXT = 1000354001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT = 1000355000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT = 1000355001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT = 1000356000, - VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3 = 1000360000, - VK_STRUCTURE_TYPE_SUBPASS_SHADING_PIPELINE_CREATE_INFO_HUAWEI = 1000369000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_FEATURES_HUAWEI = 1000369001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_SHADING_PROPERTIES_HUAWEI = 1000369002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INVOCATION_MASK_FEATURES_HUAWEI = 1000370000, - VK_STRUCTURE_TYPE_PIPELINE_PROPERTIES_IDENTIFIER_EXT = 1000372000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT = 1000372001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT = 1000375000, - VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT = 1000375001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT = 1000376000, - VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT = 1000376001, - VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT = 1000376002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT = 1000377000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT = 1000381000, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT = 1000381001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVES_GENERATED_QUERY_FEATURES_EXT = 1000382000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_MAINTENANCE_1_FEATURES_KHR = 1000386000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR = 1000388000, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR = 1000388001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT = 1000391000, - VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT = 1000391001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT = 1000392000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT = 1000392001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT = 1000393000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT = 1000395000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT = 1000395001, - VK_STRUCTURE_TYPE_MICROMAP_BUILD_INFO_EXT = 1000396000, - VK_STRUCTURE_TYPE_MICROMAP_VERSION_INFO_EXT = 1000396001, - VK_STRUCTURE_TYPE_COPY_MICROMAP_INFO_EXT = 1000396002, - VK_STRUCTURE_TYPE_COPY_MICROMAP_TO_MEMORY_INFO_EXT = 1000396003, - VK_STRUCTURE_TYPE_COPY_MEMORY_TO_MICROMAP_INFO_EXT = 1000396004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT = 1000396005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT = 1000396006, - VK_STRUCTURE_TYPE_MICROMAP_CREATE_INFO_EXT = 1000396007, - VK_STRUCTURE_TYPE_MICROMAP_BUILD_SIZES_INFO_EXT = 1000396008, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT = 1000396009, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI = 1000404000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI = 1000404001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_VRS_FEATURES_HUAWEI = 1000404002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT = 1000411000, - VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT = 1000411001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT = 1000412000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES = 1000413000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES = 1000413001, - VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS = 1000413002, - VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS = 1000413003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM = 1000415000, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM = 1000417000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM = 1000417001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM = 1000417002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT = 1000418000, - VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT = 1000418001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE = 1000420000, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_BINDING_REFERENCE_VALVE = 1000420001, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE = 1000420002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT = 1000421000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT = 1000422000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM = 1000425000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM = 1000425001, - VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM = 1000425002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV = 1000426000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV = 1000426001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV = 1000427000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV = 1000427001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV = 1000428000, - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV = 1000428001, - VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV = 1000428002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV = 1000430000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT = 1000437000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM = 1000440000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM = 1000440001, - VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM = 1000440002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT = 1000451000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT = 1000451001, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT = 1000453000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT = 1000455000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT = 1000455001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT = 1000458000, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT = 1000458001, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT = 1000458002, - VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT = 1000458003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT = 1000462000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT = 1000462001, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT = 1000462002, - VK_STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT = 1000462003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV = 1000464000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV = 1000464001, - VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV = 1000464002, - VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_PROPERTIES_NV = 1000464003, - VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_INFO_NV = 1000464004, - VK_STRUCTURE_TYPE_OPTICAL_FLOW_EXECUTE_INFO_NV = 1000464005, - VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_PRIVATE_DATA_INFO_NV = 1000464010, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT = 1000465000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT = 1000466000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR = 1000470000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR = 1000470001, - VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR = 1000470003, - VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR = 1000470004, - VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR = 1000470005, - VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR = 1000470006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR = 1000481000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT = 1000482000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT = 1000482001, - VK_STRUCTURE_TYPE_SHADER_CREATE_INFO_EXT = 1000482002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM = 1000484000, - VK_STRUCTURE_TYPE_TILE_PROPERTIES_QCOM = 1000484001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM = 1000488000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV = 1000490000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV = 1000490001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV = 1000492000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV = 1000492001, - VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT = 1000496000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM = 1000497000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM = 1000497001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT = 1000498000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT = 1000499000, - VK_STRUCTURE_TYPE_LATENCY_SLEEP_MODE_INFO_NV = 1000505000, - VK_STRUCTURE_TYPE_LATENCY_SLEEP_INFO_NV = 1000505001, - VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV = 1000505002, - VK_STRUCTURE_TYPE_GET_LATENCY_MARKER_INFO_NV = 1000505003, - VK_STRUCTURE_TYPE_LATENCY_TIMINGS_FRAME_REPORT_NV = 1000505004, - VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV = 1000505005, - VK_STRUCTURE_TYPE_OUT_OF_BAND_QUEUE_TYPE_INFO_NV = 1000505006, - VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV = 1000505007, - VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV = 1000505008, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR = 1000506000, - VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_KHR = 1000506001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR = 1000506002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM = 1000510000, - VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM = 1000510001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM = 1000518000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM = 1000518001, - VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM = 1000518002, - VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM = 1000519000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM = 1000519001, - VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM = 1000519002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM = 1000520000, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM = 1000520001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM = 1000521000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT = 1000524000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT = 1000530000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV = 1000546000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, - VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, - VK_STRUCTURE_TYPE_RENDERING_INFO_KHR = VK_STRUCTURE_TYPE_RENDERING_INFO, - VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO, - VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO_KHR = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO, - VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_NV = VK_STRUCTURE_TYPE_ATTACHMENT_SAMPLE_COUNT_INFO_AMD, - VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, - VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES, - VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, - VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO_KHR = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO, - VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2, - VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2_KHR = VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2, - VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO, - VK_STRUCTURE_TYPE_SUBPASS_END_INFO_KHR = VK_STRUCTURE_TYPE_SUBPASS_END_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES, - VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES, - VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO, - VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES, - VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK, - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2, - VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2, - VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO, - VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO, - VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES, - VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES, - VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO, - VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO, - VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, - VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO, - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO_INTEL = VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES, - VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, - VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO, - VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES, - VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO, - VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES, - VK_STRUCTURE_TYPE_MEMORY_BARRIER_2_KHR = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2_KHR = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2_KHR = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2, - VK_STRUCTURE_TYPE_DEPENDENCY_INFO_KHR = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, - VK_STRUCTURE_TYPE_SUBMIT_INFO_2_KHR = VK_STRUCTURE_TYPE_SUBMIT_INFO_2, - VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES, - VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2_KHR = VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2, - VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2_KHR = VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2, - VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2_KHR = VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2, - VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2_KHR = VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2, - VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2_KHR = VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2, - VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2_KHR = VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2, - VK_STRUCTURE_TYPE_BUFFER_COPY_2_KHR = VK_STRUCTURE_TYPE_BUFFER_COPY_2, - VK_STRUCTURE_TYPE_IMAGE_COPY_2_KHR = VK_STRUCTURE_TYPE_IMAGE_COPY_2, - VK_STRUCTURE_TYPE_IMAGE_BLIT_2_KHR = VK_STRUCTURE_TYPE_IMAGE_BLIT_2, - VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR = VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2, - VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2_KHR = VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2, - VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR, - VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT, - VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE = VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT, - VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3_KHR = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3, - VK_STRUCTURE_TYPE_PIPELINE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_EXT = VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES, - VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS, - VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS, - VK_STRUCTURE_TYPE_SHADER_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO, - VK_STRUCTURE_TYPE_MAX_ENUM = 0x7fffffff, -} VkStructureType; - -typedef enum VkSubgroupFeatureFlagBits -{ - VK_SUBGROUP_FEATURE_BASIC_BIT = 0x00000001, - VK_SUBGROUP_FEATURE_VOTE_BIT = 0x00000002, - VK_SUBGROUP_FEATURE_ARITHMETIC_BIT = 0x00000004, - VK_SUBGROUP_FEATURE_BALLOT_BIT = 0x00000008, - VK_SUBGROUP_FEATURE_SHUFFLE_BIT = 0x00000010, - VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = 0x00000020, - VK_SUBGROUP_FEATURE_CLUSTERED_BIT = 0x00000040, - VK_SUBGROUP_FEATURE_QUAD_BIT = 0x00000080, - VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV = 0x00000100, - VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSubgroupFeatureFlagBits; - -typedef enum VkSubmitFlagBits -{ - VK_SUBMIT_PROTECTED_BIT = 0x00000001, - VK_SUBMIT_PROTECTED_BIT_KHR = VK_SUBMIT_PROTECTED_BIT, - VK_SUBMIT_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSubmitFlagBits; -typedef VkSubmitFlagBits VkSubmitFlagBitsKHR; - -typedef enum VkSubpassContents -{ - VK_SUBPASS_CONTENTS_INLINE = 0, - VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, - VK_SUBPASS_CONTENTS_INLINE_AND_SECONDARY_COMMAND_BUFFERS_EXT = 1000451000, - VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7fffffff, -} VkSubpassContents; - -typedef enum VkSubpassDescriptionFlagBits -{ - VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM = 0x00000004, - VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM = 0x00000008, - VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_COLOR_ACCESS_BIT_EXT = 0x00000010, - VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT = 0x00000020, - VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT = 0x00000040, - VK_SUBPASS_DESCRIPTION_ENABLE_LEGACY_DITHERING_BIT_EXT = 0x00000080, - VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_COLOR_ACCESS_BIT_ARM = VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_COLOR_ACCESS_BIT_EXT, - VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_ARM = VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT, - VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_ARM = VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT, - VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkSubpassDescriptionFlagBits; - -typedef enum VkSubpassMergeStatusEXT -{ - VK_SUBPASS_MERGE_STATUS_MERGED_EXT = 0, - VK_SUBPASS_MERGE_STATUS_DISALLOWED_EXT = 1, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_SIDE_EFFECTS_EXT = 2, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_SAMPLES_MISMATCH_EXT = 3, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_VIEWS_MISMATCH_EXT = 4, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_ALIASING_EXT = 5, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_DEPENDENCIES_EXT = 6, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_INCOMPATIBLE_INPUT_ATTACHMENT_EXT = 7, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_TOO_MANY_ATTACHMENTS_EXT = 8, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_INSUFFICIENT_STORAGE_EXT = 9, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_DEPTH_STENCIL_COUNT_EXT = 10, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_RESOLVE_ATTACHMENT_REUSE_EXT = 11, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_SINGLE_SUBPASS_EXT = 12, - VK_SUBPASS_MERGE_STATUS_NOT_MERGED_UNSPECIFIED_EXT = 13, - VK_SUBPASS_MERGE_STATUS_EXT_MAX_ENUM = 0x7fffffff, -} VkSubpassMergeStatusEXT; - -typedef enum VkSurfaceTransformFlagBitsKHR -{ - VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, - VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, - VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, - VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, - VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, - VK_SURFACE_TRANSFORM_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkSurfaceTransformFlagBitsKHR; - -typedef enum VkSwapchainCreateFlagBitsKHR -{ - VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 0x00000001, - VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 0x00000002, - VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR = 0x00000004, - VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT = 0x00000008, - VK_SWAPCHAIN_CREATE_FLAG_BITS_KHR_MAX_ENUM = 0x7fffffff, -} VkSwapchainCreateFlagBitsKHR; - -typedef enum VkSystemAllocationScope -{ - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, - VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, - VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, - VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7fffffff, -} VkSystemAllocationScope; - -typedef enum VkTessellationDomainOrigin -{ - VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = 0, - VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1, - VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT, - VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT, - VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = 0x7fffffff, -} VkTessellationDomainOrigin; -typedef VkTessellationDomainOrigin VkTessellationDomainOriginKHR; - -typedef enum VkTimeDomainEXT -{ - VK_TIME_DOMAIN_DEVICE_EXT = 0, - VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT = 1, - VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = 2, - VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = 3, - VK_TIME_DOMAIN_EXT_MAX_ENUM = 0x7fffffff, -} VkTimeDomainEXT; - -typedef enum VkToolPurposeFlagBits -{ - VK_TOOL_PURPOSE_VALIDATION_BIT = 0x00000001, - VK_TOOL_PURPOSE_PROFILING_BIT = 0x00000002, - VK_TOOL_PURPOSE_TRACING_BIT = 0x00000004, - VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT = 0x00000008, - VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT = 0x00000010, - VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT = 0x00000020, - VK_TOOL_PURPOSE_DEBUG_MARKERS_BIT_EXT = 0x00000040, - VK_TOOL_PURPOSE_VALIDATION_BIT_EXT = VK_TOOL_PURPOSE_VALIDATION_BIT, - VK_TOOL_PURPOSE_PROFILING_BIT_EXT = VK_TOOL_PURPOSE_PROFILING_BIT, - VK_TOOL_PURPOSE_TRACING_BIT_EXT = VK_TOOL_PURPOSE_TRACING_BIT, - VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT, - VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT, - VK_TOOL_PURPOSE_FLAG_BITS_MAX_ENUM = 0x7fffffff, -} VkToolPurposeFlagBits; -typedef VkToolPurposeFlagBits VkToolPurposeFlagBitsEXT; - -typedef enum VkValidationCacheHeaderVersionEXT -{ - VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = 1, - VK_VALIDATION_CACHE_HEADER_VERSION_EXT_MAX_ENUM = 0x7fffffff, -} VkValidationCacheHeaderVersionEXT; - -typedef enum VkValidationCheckEXT -{ - VK_VALIDATION_CHECK_ALL_EXT = 0, - VK_VALIDATION_CHECK_SHADERS_EXT = 1, - VK_VALIDATION_CHECK_EXT_MAX_ENUM = 0x7fffffff, -} VkValidationCheckEXT; - -typedef enum VkValidationFeatureDisableEXT -{ - VK_VALIDATION_FEATURE_DISABLE_ALL_EXT = 0, - VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT = 1, - VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT = 2, - VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT = 3, - VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT = 4, - VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT = 5, - VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT = 6, - VK_VALIDATION_FEATURE_DISABLE_SHADER_VALIDATION_CACHE_EXT = 7, - VK_VALIDATION_FEATURE_DISABLE_EXT_MAX_ENUM = 0x7fffffff, -} VkValidationFeatureDisableEXT; - -typedef enum VkValidationFeatureEnableEXT -{ - VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT = 0, - VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT = 1, - VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT = 2, - VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT = 3, - VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT = 4, - VK_VALIDATION_FEATURE_ENABLE_EXT_MAX_ENUM = 0x7fffffff, -} VkValidationFeatureEnableEXT; - -typedef enum VkVendorId -{ - VK_VENDOR_ID_VIV = 0x00010001, - VK_VENDOR_ID_VSI = 0x00010002, - VK_VENDOR_ID_KAZAN = 0x00010003, - VK_VENDOR_ID_CODEPLAY = 0x00010004, - VK_VENDOR_ID_MESA = 0x00010005, - VK_VENDOR_ID_POCL = 0x00010006, - VK_VENDOR_ID_MOBILEYE = 0x00010007, - VK_VENDOR_ID_MAX_ENUM = 0x7fffffff, -} VkVendorId; - -typedef enum VkVertexInputRate -{ - VK_VERTEX_INPUT_RATE_VERTEX = 0, - VK_VERTEX_INPUT_RATE_INSTANCE = 1, - VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7fffffff, -} VkVertexInputRate; - -typedef enum VkViewportCoordinateSwizzleNV -{ - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, - VK_VIEWPORT_COORDINATE_SWIZZLE_NV_MAX_ENUM = 0x7fffffff, -} VkViewportCoordinateSwizzleNV; - -typedef void* (VKAPI_PTR * PFN_vkAllocationFunction)( - void *pUserData, - size_t size, - size_t alignment, - VkSystemAllocationScope allocationScope); -typedef VkBool32 (VKAPI_PTR * PFN_vkDebugReportCallbackEXT)( - VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objectType, - uint64_t object, - size_t location, - int32_t messageCode, - const char *pLayerPrefix, - const char *pMessage, - void *pUserData); -typedef struct VkDebugUtilsMessengerCallbackDataEXT VkDebugUtilsMessengerCallbackDataEXT; -typedef VkBool32 (VKAPI_PTR * PFN_vkDebugUtilsMessengerCallbackEXT)( - VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageTypes, - const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, - void *pUserData); -typedef void (VKAPI_PTR * PFN_vkFreeFunction)( - void *pUserData, - void *pMemory); -typedef void (VKAPI_PTR * PFN_vkInternalAllocationNotification)( - void *pUserData, - size_t size, - VkInternalAllocationType allocationType, - VkSystemAllocationScope allocationScope); -typedef void (VKAPI_PTR * PFN_vkInternalFreeNotification)( - void *pUserData, - size_t size, - VkInternalAllocationType allocationType, - VkSystemAllocationScope allocationScope); -typedef void* (VKAPI_PTR * PFN_vkReallocationFunction)( - void *pUserData, - void *pOriginal, - size_t size, - size_t alignment, - VkSystemAllocationScope allocationScope); -typedef void (VKAPI_PTR * PFN_vkVoidFunction)( -void); - -typedef struct VkAabbPositionsKHR -{ - float minX; - float minY; - float minZ; - float maxX; - float maxY; - float maxZ; -} VkAabbPositionsKHR; -typedef VkAabbPositionsKHR VkAabbPositionsNV; - -typedef struct VkAccelerationStructureBuildRangeInfoKHR -{ - uint32_t primitiveCount; - uint32_t primitiveOffset; - uint32_t firstVertex; - uint32_t transformOffset; -} VkAccelerationStructureBuildRangeInfoKHR; - -typedef struct VkAccelerationStructureBuildSizesInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) accelerationStructureSize; - VkDeviceSize WINE_VK_ALIGN(8) updateScratchSize; - VkDeviceSize WINE_VK_ALIGN(8) buildScratchSize; -} VkAccelerationStructureBuildSizesInfoKHR; - -typedef struct VkAccelerationStructureCaptureDescriptorDataInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) accelerationStructure; - VkAccelerationStructureNV WINE_VK_ALIGN(8) accelerationStructureNV; -} VkAccelerationStructureCaptureDescriptorDataInfoEXT; - -typedef struct VkAccelerationStructureCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureCreateFlagsKHR createFlags; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkAccelerationStructureTypeKHR type; - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; -} VkAccelerationStructureCreateInfoKHR; - -typedef struct VkAccelerationStructureDeviceAddressInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) accelerationStructure; -} VkAccelerationStructureDeviceAddressInfoKHR; - -typedef struct VkAccelerationStructureMemoryRequirementsInfoNV -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureMemoryRequirementsTypeNV type; - VkAccelerationStructureNV WINE_VK_ALIGN(8) accelerationStructure; -} VkAccelerationStructureMemoryRequirementsInfoNV; - -typedef struct VkAccelerationStructureMotionInfoNV -{ - VkStructureType sType; - const void *pNext; - uint32_t maxInstances; - VkAccelerationStructureMotionInfoFlagsNV flags; -} VkAccelerationStructureMotionInfoNV; - -typedef struct VkAccelerationStructureVersionInfoKHR -{ - VkStructureType sType; - const void *pNext; - const uint8_t *pVersionData; -} VkAccelerationStructureVersionInfoKHR; - -typedef struct VkAcquireNextImageInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkSwapchainKHR WINE_VK_ALIGN(8) swapchain; - uint64_t WINE_VK_ALIGN(8) timeout; - VkSemaphore WINE_VK_ALIGN(8) semaphore; - VkFence WINE_VK_ALIGN(8) fence; - uint32_t deviceMask; -} VkAcquireNextImageInfoKHR; - -typedef struct VkAcquireProfilingLockInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkAcquireProfilingLockFlagsKHR flags; - uint64_t WINE_VK_ALIGN(8) timeout; -} VkAcquireProfilingLockInfoKHR; - -typedef struct VkAllocationCallbacks -{ - void *pUserData; - PFN_vkAllocationFunction pfnAllocation; - PFN_vkReallocationFunction pfnReallocation; - PFN_vkFreeFunction pfnFree; - PFN_vkInternalAllocationNotification pfnInternalAllocation; - PFN_vkInternalFreeNotification pfnInternalFree; -} VkAllocationCallbacks; - -typedef struct VkApplicationInfo -{ - VkStructureType sType; - const void *pNext; - const char *pApplicationName; - uint32_t applicationVersion; - const char *pEngineName; - uint32_t engineVersion; - uint32_t apiVersion; -} VkApplicationInfo; - -typedef struct VkAttachmentDescription -{ - VkAttachmentDescriptionFlags flags; - VkFormat format; - VkSampleCountFlagBits samples; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkAttachmentLoadOp stencilLoadOp; - VkAttachmentStoreOp stencilStoreOp; - VkImageLayout initialLayout; - VkImageLayout finalLayout; -} VkAttachmentDescription; - -typedef struct VkAttachmentDescription2 -{ - VkStructureType sType; - const void *pNext; - VkAttachmentDescriptionFlags flags; - VkFormat format; - VkSampleCountFlagBits samples; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkAttachmentLoadOp stencilLoadOp; - VkAttachmentStoreOp stencilStoreOp; - VkImageLayout initialLayout; - VkImageLayout finalLayout; -} VkAttachmentDescription2; -typedef VkAttachmentDescription2 VkAttachmentDescription2KHR; - -typedef struct VkAttachmentDescriptionStencilLayout -{ - VkStructureType sType; - void *pNext; - VkImageLayout stencilInitialLayout; - VkImageLayout stencilFinalLayout; -} VkAttachmentDescriptionStencilLayout; -typedef VkAttachmentDescriptionStencilLayout VkAttachmentDescriptionStencilLayoutKHR; - -typedef struct VkAttachmentReference -{ - uint32_t attachment; - VkImageLayout layout; -} VkAttachmentReference; - -typedef struct VkAttachmentReference2 -{ - VkStructureType sType; - const void *pNext; - uint32_t attachment; - VkImageLayout layout; - VkImageAspectFlags aspectMask; -} VkAttachmentReference2; -typedef VkAttachmentReference2 VkAttachmentReference2KHR; - -typedef struct VkAttachmentReferenceStencilLayout -{ - VkStructureType sType; - void *pNext; - VkImageLayout stencilLayout; -} VkAttachmentReferenceStencilLayout; -typedef VkAttachmentReferenceStencilLayout VkAttachmentReferenceStencilLayoutKHR; - -typedef struct VkAttachmentSampleCountInfoAMD -{ - VkStructureType sType; - const void *pNext; - uint32_t colorAttachmentCount; - const VkSampleCountFlagBits *pColorAttachmentSamples; - VkSampleCountFlagBits depthStencilAttachmentSamples; -} VkAttachmentSampleCountInfoAMD; -typedef VkAttachmentSampleCountInfoAMD VkAttachmentSampleCountInfoNV; - -typedef struct VkBaseInStructure -{ - VkStructureType sType; - const struct VkBaseInStructure *pNext; -} VkBaseInStructure; - -typedef struct VkBaseOutStructure -{ - VkStructureType sType; - struct VkBaseOutStructure *pNext; -} VkBaseOutStructure; - -typedef struct VkBindAccelerationStructureMemoryInfoNV -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureNV WINE_VK_ALIGN(8) accelerationStructure; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) memoryOffset; - uint32_t deviceIndexCount; - const uint32_t *pDeviceIndices; -} VkBindAccelerationStructureMemoryInfoNV; - -typedef struct VkBindBufferMemoryDeviceGroupInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t deviceIndexCount; - const uint32_t *pDeviceIndices; -} VkBindBufferMemoryDeviceGroupInfo; -typedef VkBindBufferMemoryDeviceGroupInfo VkBindBufferMemoryDeviceGroupInfoKHR; - -typedef struct VkBindBufferMemoryInfo -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) memoryOffset; -} VkBindBufferMemoryInfo; -typedef VkBindBufferMemoryInfo VkBindBufferMemoryInfoKHR; - -typedef struct VkBindImageMemoryInfo -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) memoryOffset; -} VkBindImageMemoryInfo; -typedef VkBindImageMemoryInfo VkBindImageMemoryInfoKHR; - -typedef struct VkBindImageMemorySwapchainInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkSwapchainKHR WINE_VK_ALIGN(8) swapchain; - uint32_t imageIndex; -} VkBindImageMemorySwapchainInfoKHR; - -typedef struct VkBindImagePlaneMemoryInfo -{ - VkStructureType sType; - const void *pNext; - VkImageAspectFlagBits planeAspect; -} VkBindImagePlaneMemoryInfo; -typedef VkBindImagePlaneMemoryInfo VkBindImagePlaneMemoryInfoKHR; - -typedef struct VkBindIndexBufferIndirectCommandNV -{ - VkDeviceAddress WINE_VK_ALIGN(8) bufferAddress; - uint32_t size; - VkIndexType indexType; -} VkBindIndexBufferIndirectCommandNV; - -typedef struct VkBindPipelineIndirectCommandNV -{ - VkDeviceAddress WINE_VK_ALIGN(8) pipelineAddress; -} VkBindPipelineIndirectCommandNV; - -typedef struct VkBindShaderGroupIndirectCommandNV -{ - uint32_t groupIndex; -} VkBindShaderGroupIndirectCommandNV; - -typedef struct VkBindVertexBufferIndirectCommandNV -{ - VkDeviceAddress WINE_VK_ALIGN(8) bufferAddress; - uint32_t size; - uint32_t stride; -} VkBindVertexBufferIndirectCommandNV; - -typedef struct VkBlitImageCubicWeightsInfoQCOM -{ - VkStructureType sType; - const void *pNext; - VkCubicFilterWeightsQCOM cubicWeights; -} VkBlitImageCubicWeightsInfoQCOM; - -typedef struct VkBufferCaptureDescriptorDataInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) buffer; -} VkBufferCaptureDescriptorDataInfoEXT; - -typedef struct VkBufferCopy -{ - VkDeviceSize WINE_VK_ALIGN(8) srcOffset; - VkDeviceSize WINE_VK_ALIGN(8) dstOffset; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkBufferCopy; - -typedef struct VkBufferCopy2 -{ - VkStructureType sType; - const void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) srcOffset; - VkDeviceSize WINE_VK_ALIGN(8) dstOffset; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkBufferCopy2; -typedef VkBufferCopy2 VkBufferCopy2KHR; - -typedef struct VkBufferCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkBufferCreateFlags flags; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkBufferUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t *pQueueFamilyIndices; -} VkBufferCreateInfo; - -typedef struct VkBufferDeviceAddressCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; -} VkBufferDeviceAddressCreateInfoEXT; - -typedef struct VkBufferDeviceAddressInfo -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) buffer; -} VkBufferDeviceAddressInfo; -typedef VkBufferDeviceAddressInfo VkBufferDeviceAddressInfoKHR; -typedef VkBufferDeviceAddressInfo VkBufferDeviceAddressInfoEXT; - -typedef struct VkBufferMemoryBarrier -{ - VkStructureType sType; - const void *pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkBufferMemoryBarrier; - -typedef struct VkBufferMemoryBarrier2 -{ - VkStructureType sType; - const void *pNext; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) srcStageMask; - VkAccessFlags2 WINE_VK_ALIGN(8) srcAccessMask; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) dstStageMask; - VkAccessFlags2 WINE_VK_ALIGN(8) dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkBufferMemoryBarrier2; -typedef VkBufferMemoryBarrier2 VkBufferMemoryBarrier2KHR; - -typedef struct VkBufferMemoryRequirementsInfo2 -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) buffer; -} VkBufferMemoryRequirementsInfo2; -typedef VkBufferMemoryRequirementsInfo2 VkBufferMemoryRequirementsInfo2KHR; - -typedef struct VkBufferOpaqueCaptureAddressCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint64_t WINE_VK_ALIGN(8) opaqueCaptureAddress; -} VkBufferOpaqueCaptureAddressCreateInfo; -typedef VkBufferOpaqueCaptureAddressCreateInfo VkBufferOpaqueCaptureAddressCreateInfoKHR; - -typedef struct VkBufferUsageFlags2CreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkBufferUsageFlags2KHR WINE_VK_ALIGN(8) usage; -} VkBufferUsageFlags2CreateInfoKHR; - -typedef struct VkBufferViewCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkBufferViewCreateFlags flags; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkFormat format; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) range; -} VkBufferViewCreateInfo; - -typedef struct VkCalibratedTimestampInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkTimeDomainEXT timeDomain; -} VkCalibratedTimestampInfoEXT; - -typedef struct VkCheckpointData2NV -{ - VkStructureType sType; - void *pNext; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) stage; - void *pCheckpointMarker; -} VkCheckpointData2NV; - -typedef struct VkCheckpointDataNV -{ - VkStructureType sType; - void *pNext; - VkPipelineStageFlagBits stage; - void *pCheckpointMarker; -} VkCheckpointDataNV; - -typedef union VkClearColorValue -{ - float float32[4]; - int32_t int32[4]; - uint32_t uint32[4]; -} VkClearColorValue; - -typedef struct VkClearDepthStencilValue -{ - float depth; - uint32_t stencil; -} VkClearDepthStencilValue; - -typedef union VkClearValue -{ - VkClearColorValue color; - VkClearDepthStencilValue depthStencil; -} VkClearValue; - -typedef struct VkCoarseSampleLocationNV -{ - uint32_t pixelX; - uint32_t pixelY; - uint32_t sample; -} VkCoarseSampleLocationNV; - -typedef struct VkCoarseSampleOrderCustomNV -{ - VkShadingRatePaletteEntryNV shadingRate; - uint32_t sampleCount; - uint32_t sampleLocationCount; - const VkCoarseSampleLocationNV *pSampleLocations; -} VkCoarseSampleOrderCustomNV; - -typedef struct VkColorBlendAdvancedEXT -{ - VkBlendOp advancedBlendOp; - VkBool32 srcPremultiplied; - VkBool32 dstPremultiplied; - VkBlendOverlapEXT blendOverlap; - VkBool32 clampResults; -} VkColorBlendAdvancedEXT; - -typedef struct VkColorBlendEquationEXT -{ - VkBlendFactor srcColorBlendFactor; - VkBlendFactor dstColorBlendFactor; - VkBlendOp colorBlendOp; - VkBlendFactor srcAlphaBlendFactor; - VkBlendFactor dstAlphaBlendFactor; - VkBlendOp alphaBlendOp; -} VkColorBlendEquationEXT; - -typedef struct VkCommandBufferAllocateInfo -{ - VkStructureType sType; - const void *pNext; - VkCommandPool WINE_VK_ALIGN(8) commandPool; - VkCommandBufferLevel level; - uint32_t commandBufferCount; -} VkCommandBufferAllocateInfo; - -typedef struct VkCommandBufferInheritanceConditionalRenderingInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 conditionalRenderingEnable; -} VkCommandBufferInheritanceConditionalRenderingInfoEXT; - -typedef struct VkCommandBufferInheritanceInfo -{ - VkStructureType sType; - const void *pNext; - VkRenderPass WINE_VK_ALIGN(8) renderPass; - uint32_t subpass; - VkFramebuffer WINE_VK_ALIGN(8) framebuffer; - VkBool32 occlusionQueryEnable; - VkQueryControlFlags queryFlags; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkCommandBufferInheritanceInfo; - -typedef struct VkCommandBufferInheritanceRenderingInfo -{ - VkStructureType sType; - const void *pNext; - VkRenderingFlags flags; - uint32_t viewMask; - uint32_t colorAttachmentCount; - const VkFormat *pColorAttachmentFormats; - VkFormat depthAttachmentFormat; - VkFormat stencilAttachmentFormat; - VkSampleCountFlagBits rasterizationSamples; -} VkCommandBufferInheritanceRenderingInfo; -typedef VkCommandBufferInheritanceRenderingInfo VkCommandBufferInheritanceRenderingInfoKHR; - -typedef struct VkCommandBufferSubmitInfo -{ - VkStructureType sType; - const void *pNext; - VkCommandBuffer commandBuffer; - uint32_t deviceMask; -} VkCommandBufferSubmitInfo; -typedef VkCommandBufferSubmitInfo VkCommandBufferSubmitInfoKHR; - -typedef struct VkCommandPoolCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkCommandPoolCreateFlags flags; - uint32_t queueFamilyIndex; -} VkCommandPoolCreateInfo; - -typedef struct VkComponentMapping -{ - VkComponentSwizzle r; - VkComponentSwizzle g; - VkComponentSwizzle b; - VkComponentSwizzle a; -} VkComponentMapping; - -typedef struct VkComputePipelineIndirectBufferInfoNV -{ - VkStructureType sType; - const void *pNext; - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkDeviceAddress WINE_VK_ALIGN(8) pipelineDeviceAddressCaptureReplay; -} VkComputePipelineIndirectBufferInfoNV; - -typedef struct VkConditionalRenderingBeginInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkConditionalRenderingFlagsEXT flags; -} VkConditionalRenderingBeginInfoEXT; - -typedef struct VkConformanceVersion -{ - uint8_t major; - uint8_t minor; - uint8_t subminor; - uint8_t patch; -} VkConformanceVersion; -typedef VkConformanceVersion VkConformanceVersionKHR; - -typedef struct VkCooperativeMatrixPropertiesKHR -{ - VkStructureType sType; - void *pNext; - uint32_t MSize; - uint32_t NSize; - uint32_t KSize; - VkComponentTypeKHR AType; - VkComponentTypeKHR BType; - VkComponentTypeKHR CType; - VkComponentTypeKHR ResultType; - VkBool32 saturatingAccumulation; - VkScopeKHR scope; -} VkCooperativeMatrixPropertiesKHR; - -typedef struct VkCooperativeMatrixPropertiesNV -{ - VkStructureType sType; - void *pNext; - uint32_t MSize; - uint32_t NSize; - uint32_t KSize; - VkComponentTypeNV AType; - VkComponentTypeNV BType; - VkComponentTypeNV CType; - VkComponentTypeNV DType; - VkScopeNV scope; -} VkCooperativeMatrixPropertiesNV; - -typedef struct VkCopyAccelerationStructureInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) src; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyAccelerationStructureInfoKHR; - -typedef struct VkCopyBufferInfo2 -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) srcBuffer; - VkBuffer WINE_VK_ALIGN(8) dstBuffer; - uint32_t regionCount; - const VkBufferCopy2 *pRegions; -} VkCopyBufferInfo2; -typedef VkCopyBufferInfo2 VkCopyBufferInfo2KHR; - -typedef struct VkCopyCommandTransformInfoQCOM -{ - VkStructureType sType; - const void *pNext; - VkSurfaceTransformFlagBitsKHR transform; -} VkCopyCommandTransformInfoQCOM; - -typedef struct VkCopyDescriptorSet -{ - VkStructureType sType; - const void *pNext; - VkDescriptorSet WINE_VK_ALIGN(8) srcSet; - uint32_t srcBinding; - uint32_t srcArrayElement; - VkDescriptorSet WINE_VK_ALIGN(8) dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; -} VkCopyDescriptorSet; - -typedef struct VkCopyMemoryIndirectCommandNV -{ - VkDeviceAddress WINE_VK_ALIGN(8) srcAddress; - VkDeviceAddress WINE_VK_ALIGN(8) dstAddress; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkCopyMemoryIndirectCommandNV; - -typedef struct VkCopyMicromapInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkMicromapEXT WINE_VK_ALIGN(8) src; - VkMicromapEXT WINE_VK_ALIGN(8) dst; - VkCopyMicromapModeEXT mode; -} VkCopyMicromapInfoEXT; - -typedef struct VkCuFunctionCreateInfoNVX -{ - VkStructureType sType; - const void *pNext; - VkCuModuleNVX WINE_VK_ALIGN(8) module; - const char *pName; -} VkCuFunctionCreateInfoNVX; - -typedef struct VkCuLaunchInfoNVX -{ - VkStructureType sType; - const void *pNext; - VkCuFunctionNVX WINE_VK_ALIGN(8) function; - uint32_t gridDimX; - uint32_t gridDimY; - uint32_t gridDimZ; - uint32_t blockDimX; - uint32_t blockDimY; - uint32_t blockDimZ; - uint32_t sharedMemBytes; - size_t paramCount; - const void * const *pParams; - size_t extraCount; - const void * const *pExtras; -} VkCuLaunchInfoNVX; - -typedef struct VkCuModuleCreateInfoNVX -{ - VkStructureType sType; - const void *pNext; - size_t dataSize; - const void *pData; -} VkCuModuleCreateInfoNVX; - -typedef struct VkCudaFunctionCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkCudaModuleNV WINE_VK_ALIGN(8) module; - const char *pName; -} VkCudaFunctionCreateInfoNV; - -typedef struct VkCudaLaunchInfoNV -{ - VkStructureType sType; - const void *pNext; - VkCudaFunctionNV WINE_VK_ALIGN(8) function; - uint32_t gridDimX; - uint32_t gridDimY; - uint32_t gridDimZ; - uint32_t blockDimX; - uint32_t blockDimY; - uint32_t blockDimZ; - uint32_t sharedMemBytes; - size_t paramCount; - const void * const *pParams; - size_t extraCount; - const void * const *pExtras; -} VkCudaLaunchInfoNV; - -typedef struct VkCudaModuleCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - size_t dataSize; - const void *pData; -} VkCudaModuleCreateInfoNV; - -typedef struct VkDebugMarkerMarkerInfoEXT -{ - VkStructureType sType; - const void *pNext; - const char *pMarkerName; - float color[4]; -} VkDebugMarkerMarkerInfoEXT; - -typedef struct VkDebugMarkerObjectNameInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDebugReportObjectTypeEXT objectType; - uint64_t WINE_VK_ALIGN(8) object; - const char *pObjectName; -} VkDebugMarkerObjectNameInfoEXT; - -typedef struct VkDebugMarkerObjectTagInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDebugReportObjectTypeEXT objectType; - uint64_t WINE_VK_ALIGN(8) object; - uint64_t WINE_VK_ALIGN(8) tagName; - size_t tagSize; - const void *pTag; -} VkDebugMarkerObjectTagInfoEXT; - -typedef struct VkDebugReportCallbackCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDebugReportFlagsEXT flags; - PFN_vkDebugReportCallbackEXT pfnCallback; - void *pUserData; -} VkDebugReportCallbackCreateInfoEXT; - -typedef struct VkDebugUtilsLabelEXT -{ - VkStructureType sType; - const void *pNext; - const char *pLabelName; - float color[4]; -} VkDebugUtilsLabelEXT; - -typedef struct VkDebugUtilsMessengerCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDebugUtilsMessengerCreateFlagsEXT flags; - VkDebugUtilsMessageSeverityFlagsEXT messageSeverity; - VkDebugUtilsMessageTypeFlagsEXT messageType; - PFN_vkDebugUtilsMessengerCallbackEXT pfnUserCallback; - void *pUserData; -} VkDebugUtilsMessengerCreateInfoEXT; - -typedef struct VkDebugUtilsObjectNameInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkObjectType objectType; - uint64_t WINE_VK_ALIGN(8) objectHandle; - const char *pObjectName; -} VkDebugUtilsObjectNameInfoEXT; - -typedef struct VkDebugUtilsObjectTagInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkObjectType objectType; - uint64_t WINE_VK_ALIGN(8) objectHandle; - uint64_t WINE_VK_ALIGN(8) tagName; - size_t tagSize; - const void *pTag; -} VkDebugUtilsObjectTagInfoEXT; - -typedef struct VkDecompressMemoryRegionNV -{ - VkDeviceAddress WINE_VK_ALIGN(8) srcAddress; - VkDeviceAddress WINE_VK_ALIGN(8) dstAddress; - VkDeviceSize WINE_VK_ALIGN(8) compressedSize; - VkDeviceSize WINE_VK_ALIGN(8) decompressedSize; - VkMemoryDecompressionMethodFlagsNV WINE_VK_ALIGN(8) decompressionMethod; -} VkDecompressMemoryRegionNV; - -typedef struct VkDedicatedAllocationBufferCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationBufferCreateInfoNV; - -typedef struct VkDedicatedAllocationImageCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationImageCreateInfoNV; - -typedef struct VkDedicatedAllocationMemoryAllocateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; - VkBuffer WINE_VK_ALIGN(8) buffer; -} VkDedicatedAllocationMemoryAllocateInfoNV; - -typedef struct VkDepthBiasInfoEXT -{ - VkStructureType sType; - const void *pNext; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; -} VkDepthBiasInfoEXT; - -typedef struct VkDepthBiasRepresentationInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDepthBiasRepresentationEXT depthBiasRepresentation; - VkBool32 depthBiasExact; -} VkDepthBiasRepresentationInfoEXT; - -typedef struct VkDescriptorAddressInfoEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceAddress WINE_VK_ALIGN(8) address; - VkDeviceSize WINE_VK_ALIGN(8) range; - VkFormat format; -} VkDescriptorAddressInfoEXT; - -typedef struct VkDescriptorBufferBindingInfoEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceAddress WINE_VK_ALIGN(8) address; - VkBufferUsageFlags usage; -} VkDescriptorBufferBindingInfoEXT; - -typedef struct VkDescriptorBufferBindingPushDescriptorBufferHandleEXT -{ - VkStructureType sType; - void *pNext; - VkBuffer WINE_VK_ALIGN(8) buffer; -} VkDescriptorBufferBindingPushDescriptorBufferHandleEXT; - -typedef struct VkDescriptorBufferInfo -{ - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) range; -} VkDescriptorBufferInfo; - -typedef struct VkDescriptorImageInfo -{ - VkSampler WINE_VK_ALIGN(8) sampler; - VkImageView WINE_VK_ALIGN(8) imageView; - VkImageLayout imageLayout; -} VkDescriptorImageInfo; - -typedef struct VkDescriptorPoolInlineUniformBlockCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t maxInlineUniformBlockBindings; -} VkDescriptorPoolInlineUniformBlockCreateInfo; -typedef VkDescriptorPoolInlineUniformBlockCreateInfo VkDescriptorPoolInlineUniformBlockCreateInfoEXT; - -typedef struct VkDescriptorPoolSize -{ - VkDescriptorType type; - uint32_t descriptorCount; -} VkDescriptorPoolSize; - -typedef struct VkDescriptorSetAllocateInfo -{ - VkStructureType sType; - const void *pNext; - VkDescriptorPool WINE_VK_ALIGN(8) descriptorPool; - uint32_t descriptorSetCount; - const VkDescriptorSetLayout *pSetLayouts; -} VkDescriptorSetAllocateInfo; - -typedef struct VkDescriptorSetBindingReferenceVALVE -{ - VkStructureType sType; - const void *pNext; - VkDescriptorSetLayout WINE_VK_ALIGN(8) descriptorSetLayout; - uint32_t binding; -} VkDescriptorSetBindingReferenceVALVE; - -typedef struct VkDescriptorSetLayoutBinding -{ - uint32_t binding; - VkDescriptorType descriptorType; - uint32_t descriptorCount; - VkShaderStageFlags stageFlags; - const VkSampler *pImmutableSamplers; -} VkDescriptorSetLayoutBinding; - -typedef struct VkDescriptorSetLayoutBindingFlagsCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t bindingCount; - const VkDescriptorBindingFlags *pBindingFlags; -} VkDescriptorSetLayoutBindingFlagsCreateInfo; -typedef VkDescriptorSetLayoutBindingFlagsCreateInfo VkDescriptorSetLayoutBindingFlagsCreateInfoEXT; - -typedef struct VkDescriptorSetLayoutCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkDescriptorSetLayoutCreateFlags flags; - uint32_t bindingCount; - const VkDescriptorSetLayoutBinding *pBindings; -} VkDescriptorSetLayoutCreateInfo; - -typedef struct VkDescriptorSetLayoutHostMappingInfoVALVE -{ - VkStructureType sType; - void *pNext; - size_t descriptorOffset; - uint32_t descriptorSize; -} VkDescriptorSetLayoutHostMappingInfoVALVE; - -typedef struct VkDescriptorSetLayoutSupport -{ - VkStructureType sType; - void *pNext; - VkBool32 supported; -} VkDescriptorSetLayoutSupport; -typedef VkDescriptorSetLayoutSupport VkDescriptorSetLayoutSupportKHR; - -typedef struct VkDescriptorSetVariableDescriptorCountAllocateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t descriptorSetCount; - const uint32_t *pDescriptorCounts; -} VkDescriptorSetVariableDescriptorCountAllocateInfo; -typedef VkDescriptorSetVariableDescriptorCountAllocateInfo VkDescriptorSetVariableDescriptorCountAllocateInfoEXT; - -typedef struct VkDescriptorSetVariableDescriptorCountLayoutSupport -{ - VkStructureType sType; - void *pNext; - uint32_t maxVariableDescriptorCount; -} VkDescriptorSetVariableDescriptorCountLayoutSupport; -typedef VkDescriptorSetVariableDescriptorCountLayoutSupport VkDescriptorSetVariableDescriptorCountLayoutSupportEXT; - -typedef struct VkDescriptorUpdateTemplateEntry -{ - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - size_t offset; - size_t stride; -} VkDescriptorUpdateTemplateEntry; -typedef VkDescriptorUpdateTemplateEntry VkDescriptorUpdateTemplateEntryKHR; - -typedef struct VkDeviceAddressBindingCallbackDataEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceAddressBindingFlagsEXT flags; - VkDeviceAddress WINE_VK_ALIGN(8) baseAddress; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkDeviceAddressBindingTypeEXT bindingType; -} VkDeviceAddressBindingCallbackDataEXT; - -typedef struct VkDeviceBufferMemoryRequirements -{ - VkStructureType sType; - const void *pNext; - const VkBufferCreateInfo *pCreateInfo; -} VkDeviceBufferMemoryRequirements; -typedef VkDeviceBufferMemoryRequirements VkDeviceBufferMemoryRequirementsKHR; - -typedef struct VkDeviceDiagnosticsConfigCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkDeviceDiagnosticsConfigFlagsNV flags; -} VkDeviceDiagnosticsConfigCreateInfoNV; - -typedef struct VkDeviceFaultAddressInfoEXT -{ - VkDeviceFaultAddressTypeEXT addressType; - VkDeviceAddress WINE_VK_ALIGN(8) reportedAddress; - VkDeviceSize WINE_VK_ALIGN(8) addressPrecision; -} VkDeviceFaultAddressInfoEXT; - -typedef struct VkDeviceFaultCountsEXT -{ - VkStructureType sType; - void *pNext; - uint32_t addressInfoCount; - uint32_t vendorInfoCount; - VkDeviceSize WINE_VK_ALIGN(8) vendorBinarySize; -} VkDeviceFaultCountsEXT; - -typedef struct VkDeviceFaultVendorBinaryHeaderVersionOneEXT -{ - uint32_t headerSize; - VkDeviceFaultVendorBinaryHeaderVersionEXT headerVersion; - uint32_t vendorID; - uint32_t deviceID; - uint32_t driverVersion; - uint8_t pipelineCacheUUID[VK_UUID_SIZE]; - uint32_t applicationNameOffset; - uint32_t applicationVersion; - uint32_t engineNameOffset; - uint32_t engineVersion; - uint32_t apiVersion; -} VkDeviceFaultVendorBinaryHeaderVersionOneEXT; - -typedef struct VkDeviceFaultVendorInfoEXT -{ - char description[VK_MAX_DESCRIPTION_SIZE]; - uint64_t WINE_VK_ALIGN(8) vendorFaultCode; - uint64_t WINE_VK_ALIGN(8) vendorFaultData; -} VkDeviceFaultVendorInfoEXT; - -typedef struct VkDeviceGroupBindSparseInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t resourceDeviceIndex; - uint32_t memoryDeviceIndex; -} VkDeviceGroupBindSparseInfo; -typedef VkDeviceGroupBindSparseInfo VkDeviceGroupBindSparseInfoKHR; - -typedef struct VkDeviceGroupCommandBufferBeginInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t deviceMask; -} VkDeviceGroupCommandBufferBeginInfo; -typedef VkDeviceGroupCommandBufferBeginInfo VkDeviceGroupCommandBufferBeginInfoKHR; - -typedef struct VkDeviceGroupDeviceCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t physicalDeviceCount; - const VkPhysicalDevice *pPhysicalDevices; -} VkDeviceGroupDeviceCreateInfo; -typedef VkDeviceGroupDeviceCreateInfo VkDeviceGroupDeviceCreateInfoKHR; - -typedef struct VkDeviceGroupPresentCapabilitiesKHR -{ - VkStructureType sType; - void *pNext; - uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE]; - VkDeviceGroupPresentModeFlagsKHR modes; -} VkDeviceGroupPresentCapabilitiesKHR; - -typedef struct VkDeviceGroupPresentInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t swapchainCount; - const uint32_t *pDeviceMasks; - VkDeviceGroupPresentModeFlagBitsKHR mode; -} VkDeviceGroupPresentInfoKHR; - -typedef struct VkDeviceGroupSubmitInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t waitSemaphoreCount; - const uint32_t *pWaitSemaphoreDeviceIndices; - uint32_t commandBufferCount; - const uint32_t *pCommandBufferDeviceMasks; - uint32_t signalSemaphoreCount; - const uint32_t *pSignalSemaphoreDeviceIndices; -} VkDeviceGroupSubmitInfo; -typedef VkDeviceGroupSubmitInfo VkDeviceGroupSubmitInfoKHR; - -typedef struct VkDeviceGroupSwapchainCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkDeviceGroupPresentModeFlagsKHR modes; -} VkDeviceGroupSwapchainCreateInfoKHR; - -typedef struct VkDeviceMemoryOpaqueCaptureAddressInfo -{ - VkStructureType sType; - const void *pNext; - VkDeviceMemory WINE_VK_ALIGN(8) memory; -} VkDeviceMemoryOpaqueCaptureAddressInfo; -typedef VkDeviceMemoryOpaqueCaptureAddressInfo VkDeviceMemoryOpaqueCaptureAddressInfoKHR; - -typedef struct VkDeviceMemoryOverallocationCreateInfoAMD -{ - VkStructureType sType; - const void *pNext; - VkMemoryOverallocationBehaviorAMD overallocationBehavior; -} VkDeviceMemoryOverallocationCreateInfoAMD; - -typedef union VkDeviceOrHostAddressConstKHR -{ - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; - const void *hostAddress; -} VkDeviceOrHostAddressConstKHR; - -typedef union VkDeviceOrHostAddressKHR -{ - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; - void *hostAddress; -} VkDeviceOrHostAddressKHR; - -typedef struct VkDevicePrivateDataCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t privateDataSlotRequestCount; -} VkDevicePrivateDataCreateInfo; -typedef VkDevicePrivateDataCreateInfo VkDevicePrivateDataCreateInfoEXT; - -typedef struct VkDeviceQueueCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueCount; - const float *pQueuePriorities; -} VkDeviceQueueCreateInfo; - -typedef struct VkDeviceQueueGlobalPriorityCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkQueueGlobalPriorityKHR globalPriority; -} VkDeviceQueueGlobalPriorityCreateInfoKHR; -typedef VkDeviceQueueGlobalPriorityCreateInfoKHR VkDeviceQueueGlobalPriorityCreateInfoEXT; - -typedef struct VkDeviceQueueInfo2 -{ - VkStructureType sType; - const void *pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueIndex; -} VkDeviceQueueInfo2; - -typedef struct VkDeviceQueueShaderCoreControlCreateInfoARM -{ - VkStructureType sType; - void *pNext; - uint32_t shaderCoreCount; -} VkDeviceQueueShaderCoreControlCreateInfoARM; - -typedef struct VkDispatchIndirectCommand -{ - uint32_t x; - uint32_t y; - uint32_t z; -} VkDispatchIndirectCommand; - -typedef struct VkDrawIndexedIndirectCommand -{ - uint32_t indexCount; - uint32_t instanceCount; - uint32_t firstIndex; - int32_t vertexOffset; - uint32_t firstInstance; -} VkDrawIndexedIndirectCommand; - -typedef struct VkDrawIndirectCommand -{ - uint32_t vertexCount; - uint32_t instanceCount; - uint32_t firstVertex; - uint32_t firstInstance; -} VkDrawIndirectCommand; - -typedef struct VkDrawMeshTasksIndirectCommandEXT -{ - uint32_t groupCountX; - uint32_t groupCountY; - uint32_t groupCountZ; -} VkDrawMeshTasksIndirectCommandEXT; - -typedef struct VkDrawMeshTasksIndirectCommandNV -{ - uint32_t taskCount; - uint32_t firstTask; -} VkDrawMeshTasksIndirectCommandNV; - -typedef struct VkEventCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkEventCreateFlags flags; -} VkEventCreateInfo; - -typedef struct VkExportFenceCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalFenceHandleTypeFlags handleTypes; -} VkExportFenceCreateInfo; -typedef VkExportFenceCreateInfo VkExportFenceCreateInfoKHR; - -typedef struct VkExportMemoryAllocateInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExportMemoryAllocateInfo; -typedef VkExportMemoryAllocateInfo VkExportMemoryAllocateInfoKHR; - -typedef struct VkExportMemoryWin32HandleInfoKHR -{ - VkStructureType sType; - const void *pNext; - const SECURITY_ATTRIBUTES *pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportMemoryWin32HandleInfoKHR; - -typedef struct VkExportSemaphoreCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalSemaphoreHandleTypeFlags handleTypes; -} VkExportSemaphoreCreateInfo; -typedef VkExportSemaphoreCreateInfo VkExportSemaphoreCreateInfoKHR; - -typedef struct VkExtensionProperties -{ - char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; - uint32_t specVersion; -} VkExtensionProperties; - -typedef struct VkExtent2D -{ - uint32_t width; - uint32_t height; -} VkExtent2D; - -typedef struct VkExtent3D -{ - uint32_t width; - uint32_t height; - uint32_t depth; -} VkExtent3D; - -typedef struct VkExternalFenceProperties -{ - VkStructureType sType; - void *pNext; - VkExternalFenceHandleTypeFlags exportFromImportedHandleTypes; - VkExternalFenceHandleTypeFlags compatibleHandleTypes; - VkExternalFenceFeatureFlags externalFenceFeatures; -} VkExternalFenceProperties; -typedef VkExternalFenceProperties VkExternalFencePropertiesKHR; - -typedef struct VkExternalMemoryAcquireUnmodifiedEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 acquireUnmodifiedMemory; -} VkExternalMemoryAcquireUnmodifiedEXT; - -typedef struct VkExternalMemoryBufferCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExternalMemoryBufferCreateInfo; -typedef VkExternalMemoryBufferCreateInfo VkExternalMemoryBufferCreateInfoKHR; - -typedef struct VkExternalMemoryImageCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExternalMemoryImageCreateInfo; -typedef VkExternalMemoryImageCreateInfo VkExternalMemoryImageCreateInfoKHR; - -typedef struct VkExternalMemoryProperties -{ - VkExternalMemoryFeatureFlags externalMemoryFeatures; - VkExternalMemoryHandleTypeFlags exportFromImportedHandleTypes; - VkExternalMemoryHandleTypeFlags compatibleHandleTypes; -} VkExternalMemoryProperties; -typedef VkExternalMemoryProperties VkExternalMemoryPropertiesKHR; - -typedef struct VkExternalSemaphoreProperties -{ - VkStructureType sType; - void *pNext; - VkExternalSemaphoreHandleTypeFlags exportFromImportedHandleTypes; - VkExternalSemaphoreHandleTypeFlags compatibleHandleTypes; - VkExternalSemaphoreFeatureFlags externalSemaphoreFeatures; -} VkExternalSemaphoreProperties; -typedef VkExternalSemaphoreProperties VkExternalSemaphorePropertiesKHR; - -typedef struct VkFenceCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkFenceCreateFlags flags; -} VkFenceCreateInfo; - -typedef struct VkFilterCubicImageViewImageFormatPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 filterCubic; - VkBool32 filterCubicMinmax; -} VkFilterCubicImageViewImageFormatPropertiesEXT; - -typedef struct VkFormatProperties -{ - VkFormatFeatureFlags linearTilingFeatures; - VkFormatFeatureFlags optimalTilingFeatures; - VkFormatFeatureFlags bufferFeatures; -} VkFormatProperties; - -typedef struct VkFormatProperties2 -{ - VkStructureType sType; - void *pNext; - VkFormatProperties formatProperties; -} VkFormatProperties2; -typedef VkFormatProperties2 VkFormatProperties2KHR; - -typedef struct VkFormatProperties3 -{ - VkStructureType sType; - void *pNext; - VkFormatFeatureFlags2 WINE_VK_ALIGN(8) linearTilingFeatures; - VkFormatFeatureFlags2 WINE_VK_ALIGN(8) optimalTilingFeatures; - VkFormatFeatureFlags2 WINE_VK_ALIGN(8) bufferFeatures; -} VkFormatProperties3; -typedef VkFormatProperties3 VkFormatProperties3KHR; - -typedef struct VkFragmentShadingRateAttachmentInfoKHR -{ - VkStructureType sType; - const void *pNext; - const VkAttachmentReference2 *pFragmentShadingRateAttachment; - VkExtent2D shadingRateAttachmentTexelSize; -} VkFragmentShadingRateAttachmentInfoKHR; - -typedef struct VkFrameBoundaryEXT -{ - VkStructureType sType; - const void *pNext; - VkFrameBoundaryFlagsEXT flags; - uint64_t WINE_VK_ALIGN(8) frameID; - uint32_t imageCount; - const VkImage *pImages; - uint32_t bufferCount; - const VkBuffer *pBuffers; - uint64_t WINE_VK_ALIGN(8) tagName; - size_t tagSize; - const void *pTag; -} VkFrameBoundaryEXT; - -typedef struct VkFramebufferAttachmentImageInfo -{ - VkStructureType sType; - const void *pNext; - VkImageCreateFlags flags; - VkImageUsageFlags usage; - uint32_t width; - uint32_t height; - uint32_t layerCount; - uint32_t viewFormatCount; - const VkFormat *pViewFormats; -} VkFramebufferAttachmentImageInfo; -typedef VkFramebufferAttachmentImageInfo VkFramebufferAttachmentImageInfoKHR; - -typedef struct VkFramebufferAttachmentsCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t attachmentImageInfoCount; - const VkFramebufferAttachmentImageInfo *pAttachmentImageInfos; -} VkFramebufferAttachmentsCreateInfo; -typedef VkFramebufferAttachmentsCreateInfo VkFramebufferAttachmentsCreateInfoKHR; - -typedef struct VkFramebufferCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkFramebufferCreateFlags flags; - VkRenderPass WINE_VK_ALIGN(8) renderPass; - uint32_t attachmentCount; - const VkImageView *pAttachments; - uint32_t width; - uint32_t height; - uint32_t layers; -} VkFramebufferCreateInfo; - -typedef struct VkFramebufferMixedSamplesCombinationNV -{ - VkStructureType sType; - void *pNext; - VkCoverageReductionModeNV coverageReductionMode; - VkSampleCountFlagBits rasterizationSamples; - VkSampleCountFlags depthStencilSamples; - VkSampleCountFlags colorSamples; -} VkFramebufferMixedSamplesCombinationNV; - -typedef struct VkGeneratedCommandsMemoryRequirementsInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline WINE_VK_ALIGN(8) pipeline; - VkIndirectCommandsLayoutNV WINE_VK_ALIGN(8) indirectCommandsLayout; - uint32_t maxSequencesCount; -} VkGeneratedCommandsMemoryRequirementsInfoNV; - -typedef struct VkGeometryAABBNV -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) aabbData; - uint32_t numAABBs; - uint32_t stride; - VkDeviceSize WINE_VK_ALIGN(8) offset; -} VkGeometryAABBNV; - -typedef struct VkGeometryTrianglesNV -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) vertexData; - VkDeviceSize WINE_VK_ALIGN(8) vertexOffset; - uint32_t vertexCount; - VkDeviceSize WINE_VK_ALIGN(8) vertexStride; - VkFormat vertexFormat; - VkBuffer WINE_VK_ALIGN(8) indexData; - VkDeviceSize WINE_VK_ALIGN(8) indexOffset; - uint32_t indexCount; - VkIndexType indexType; - VkBuffer WINE_VK_ALIGN(8) transformData; - VkDeviceSize WINE_VK_ALIGN(8) transformOffset; -} VkGeometryTrianglesNV; - -typedef struct VkGraphicsPipelineLibraryCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkGraphicsPipelineLibraryFlagsEXT flags; -} VkGraphicsPipelineLibraryCreateInfoEXT; - -typedef struct VkHostImageCopyDevicePerformanceQueryEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 optimalDeviceAccess; - VkBool32 identicalMemoryLayout; -} VkHostImageCopyDevicePerformanceQueryEXT; - -typedef struct VkImageCaptureDescriptorDataInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; -} VkImageCaptureDescriptorDataInfoEXT; - -typedef struct VkImageCompressionControlEXT -{ - VkStructureType sType; - const void *pNext; - VkImageCompressionFlagsEXT flags; - uint32_t compressionControlPlaneCount; - VkImageCompressionFixedRateFlagsEXT *pFixedRateFlags; -} VkImageCompressionControlEXT; - -typedef struct VkImageCompressionPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkImageCompressionFlagsEXT imageCompressionFlags; - VkImageCompressionFixedRateFlagsEXT imageCompressionFixedRateFlags; -} VkImageCompressionPropertiesEXT; - -typedef struct VkImageCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkImageCreateFlags flags; - VkImageType imageType; - VkFormat format; - VkExtent3D extent; - uint32_t mipLevels; - uint32_t arrayLayers; - VkSampleCountFlagBits samples; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t *pQueueFamilyIndices; - VkImageLayout initialLayout; -} VkImageCreateInfo; - -typedef struct VkImageFormatListCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t viewFormatCount; - const VkFormat *pViewFormats; -} VkImageFormatListCreateInfo; -typedef VkImageFormatListCreateInfo VkImageFormatListCreateInfoKHR; - -typedef struct VkImageFormatProperties -{ - VkExtent3D maxExtent; - uint32_t maxMipLevels; - uint32_t maxArrayLayers; - VkSampleCountFlags sampleCounts; - VkDeviceSize WINE_VK_ALIGN(8) maxResourceSize; -} VkImageFormatProperties; - -typedef struct VkImageFormatProperties2 -{ - VkStructureType sType; - void *pNext; - VkImageFormatProperties WINE_VK_ALIGN(8) imageFormatProperties; -} VkImageFormatProperties2; -typedef VkImageFormatProperties2 VkImageFormatProperties2KHR; - -typedef struct VkImageMemoryRequirementsInfo2 -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; -} VkImageMemoryRequirementsInfo2; -typedef VkImageMemoryRequirementsInfo2 VkImageMemoryRequirementsInfo2KHR; - -typedef struct VkImagePlaneMemoryRequirementsInfo -{ - VkStructureType sType; - const void *pNext; - VkImageAspectFlagBits planeAspect; -} VkImagePlaneMemoryRequirementsInfo; -typedef VkImagePlaneMemoryRequirementsInfo VkImagePlaneMemoryRequirementsInfoKHR; - -typedef struct VkImageSparseMemoryRequirementsInfo2 -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; -} VkImageSparseMemoryRequirementsInfo2; -typedef VkImageSparseMemoryRequirementsInfo2 VkImageSparseMemoryRequirementsInfo2KHR; - -typedef struct VkImageStencilUsageCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkImageUsageFlags stencilUsage; -} VkImageStencilUsageCreateInfo; -typedef VkImageStencilUsageCreateInfo VkImageStencilUsageCreateInfoEXT; - -typedef struct VkImageSubresource -{ - VkImageAspectFlags aspectMask; - uint32_t mipLevel; - uint32_t arrayLayer; -} VkImageSubresource; - -typedef struct VkImageSubresource2KHR -{ - VkStructureType sType; - void *pNext; - VkImageSubresource imageSubresource; -} VkImageSubresource2KHR; -typedef VkImageSubresource2KHR VkImageSubresource2EXT; - -typedef struct VkImageSubresourceLayers -{ - VkImageAspectFlags aspectMask; - uint32_t mipLevel; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceLayers; - -typedef struct VkImageSubresourceRange -{ - VkImageAspectFlags aspectMask; - uint32_t baseMipLevel; - uint32_t levelCount; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceRange; - -typedef struct VkImageSwapchainCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkSwapchainKHR WINE_VK_ALIGN(8) swapchain; -} VkImageSwapchainCreateInfoKHR; - -typedef struct VkImageViewASTCDecodeModeEXT -{ - VkStructureType sType; - const void *pNext; - VkFormat decodeMode; -} VkImageViewASTCDecodeModeEXT; - -typedef struct VkImageViewAddressPropertiesNVX -{ - VkStructureType sType; - void *pNext; - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkImageViewAddressPropertiesNVX; - -typedef struct VkImageViewCaptureDescriptorDataInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkImageView WINE_VK_ALIGN(8) imageView; -} VkImageViewCaptureDescriptorDataInfoEXT; - -typedef struct VkImageViewCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkImageViewCreateFlags flags; - VkImage WINE_VK_ALIGN(8) image; - VkImageViewType viewType; - VkFormat format; - VkComponentMapping components; - VkImageSubresourceRange subresourceRange; -} VkImageViewCreateInfo; - -typedef struct VkImageViewHandleInfoNVX -{ - VkStructureType sType; - const void *pNext; - VkImageView WINE_VK_ALIGN(8) imageView; - VkDescriptorType descriptorType; - VkSampler WINE_VK_ALIGN(8) sampler; -} VkImageViewHandleInfoNVX; - -typedef struct VkImageViewMinLodCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - float minLod; -} VkImageViewMinLodCreateInfoEXT; - -typedef struct VkImageViewSlicedCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t sliceOffset; - uint32_t sliceCount; -} VkImageViewSlicedCreateInfoEXT; - -typedef struct VkImageViewUsageCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkImageUsageFlags usage; -} VkImageViewUsageCreateInfo; -typedef VkImageViewUsageCreateInfo VkImageViewUsageCreateInfoKHR; - -typedef struct VkImportMemoryHostPointerInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - void *pHostPointer; -} VkImportMemoryHostPointerInfoEXT; - -typedef struct VkImportMemoryWin32HandleInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - HANDLE handle; - LPCWSTR name; -} VkImportMemoryWin32HandleInfoKHR; - -typedef struct VkIndirectCommandsLayoutTokenNV -{ - VkStructureType sType; - const void *pNext; - VkIndirectCommandsTokenTypeNV tokenType; - uint32_t stream; - uint32_t offset; - uint32_t vertexBindingUnit; - VkBool32 vertexDynamicStride; - VkPipelineLayout WINE_VK_ALIGN(8) pushconstantPipelineLayout; - VkShaderStageFlags pushconstantShaderStageFlags; - uint32_t pushconstantOffset; - uint32_t pushconstantSize; - VkIndirectStateFlagsNV indirectStateFlags; - uint32_t indexTypeCount; - const VkIndexType *pIndexTypes; - const uint32_t *pIndexTypeValues; -} VkIndirectCommandsLayoutTokenNV; - -typedef struct VkIndirectCommandsStreamNV -{ - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; -} VkIndirectCommandsStreamNV; - -typedef struct VkInitializePerformanceApiInfoINTEL -{ - VkStructureType sType; - const void *pNext; - void *pUserData; -} VkInitializePerformanceApiInfoINTEL; - -typedef struct VkInputAttachmentAspectReference -{ - uint32_t subpass; - uint32_t inputAttachmentIndex; - VkImageAspectFlags aspectMask; -} VkInputAttachmentAspectReference; -typedef VkInputAttachmentAspectReference VkInputAttachmentAspectReferenceKHR; - -typedef struct VkInstanceCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkInstanceCreateFlags flags; - const VkApplicationInfo *pApplicationInfo; - uint32_t enabledLayerCount; - const char * const*ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char * const*ppEnabledExtensionNames; -} VkInstanceCreateInfo; - -typedef struct VkLatencySleepInfoNV -{ - VkStructureType sType; - const void *pNext; - VkSemaphore WINE_VK_ALIGN(8) signalSemaphore; - uint64_t WINE_VK_ALIGN(8) value; -} VkLatencySleepInfoNV; - -typedef struct VkLatencySleepModeInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 lowLatencyMode; - VkBool32 lowLatencyBoost; - uint32_t minimumIntervalUs; -} VkLatencySleepModeInfoNV; - -typedef struct VkLatencySubmissionPresentIdNV -{ - VkStructureType sType; - const void *pNext; - uint64_t WINE_VK_ALIGN(8) presentID; -} VkLatencySubmissionPresentIdNV; - -typedef struct VkLatencySurfaceCapabilitiesNV -{ - VkStructureType sType; - const void *pNext; - uint32_t presentModeCount; - VkPresentModeKHR *pPresentModes; -} VkLatencySurfaceCapabilitiesNV; - -typedef struct VkLatencyTimingsFrameReportNV -{ - VkStructureType sType; - const void *pNext; - uint64_t WINE_VK_ALIGN(8) presentID; - uint64_t WINE_VK_ALIGN(8) inputSampleTimeUs; - uint64_t WINE_VK_ALIGN(8) simStartTimeUs; - uint64_t WINE_VK_ALIGN(8) simEndTimeUs; - uint64_t WINE_VK_ALIGN(8) renderSubmitStartTimeUs; - uint64_t WINE_VK_ALIGN(8) renderSubmitEndTimeUs; - uint64_t WINE_VK_ALIGN(8) presentStartTimeUs; - uint64_t WINE_VK_ALIGN(8) presentEndTimeUs; - uint64_t WINE_VK_ALIGN(8) driverStartTimeUs; - uint64_t WINE_VK_ALIGN(8) driverEndTimeUs; - uint64_t WINE_VK_ALIGN(8) osRenderQueueStartTimeUs; - uint64_t WINE_VK_ALIGN(8) osRenderQueueEndTimeUs; - uint64_t WINE_VK_ALIGN(8) gpuRenderStartTimeUs; - uint64_t WINE_VK_ALIGN(8) gpuRenderEndTimeUs; -} VkLatencyTimingsFrameReportNV; - -typedef struct VkLayerProperties -{ - char layerName[VK_MAX_EXTENSION_NAME_SIZE]; - uint32_t specVersion; - uint32_t implementationVersion; - char description[VK_MAX_DESCRIPTION_SIZE]; -} VkLayerProperties; - -typedef struct VkLayerSettingEXT -{ - const char *pLayerName; - const char *pSettingName; - VkLayerSettingTypeEXT type; - uint32_t valueCount; - const void *pValues; -} VkLayerSettingEXT; - -typedef struct VkLayerSettingsCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t settingCount; - const VkLayerSettingEXT *pSettings; -} VkLayerSettingsCreateInfoEXT; - -typedef struct VkMappedMemoryRange -{ - VkStructureType sType; - const void *pNext; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkMappedMemoryRange; - -typedef struct VkMemoryAllocateFlagsInfo -{ - VkStructureType sType; - const void *pNext; - VkMemoryAllocateFlags flags; - uint32_t deviceMask; -} VkMemoryAllocateFlagsInfo; -typedef VkMemoryAllocateFlagsInfo VkMemoryAllocateFlagsInfoKHR; - -typedef struct VkMemoryAllocateInfo -{ - VkStructureType sType; - const void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) allocationSize; - uint32_t memoryTypeIndex; -} VkMemoryAllocateInfo; - -typedef struct VkMemoryBarrier -{ - VkStructureType sType; - const void *pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; -} VkMemoryBarrier; - -typedef struct VkMemoryBarrier2 -{ - VkStructureType sType; - const void *pNext; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) srcStageMask; - VkAccessFlags2 WINE_VK_ALIGN(8) srcAccessMask; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) dstStageMask; - VkAccessFlags2 WINE_VK_ALIGN(8) dstAccessMask; -} VkMemoryBarrier2; -typedef VkMemoryBarrier2 VkMemoryBarrier2KHR; - -typedef struct VkMemoryDedicatedAllocateInfo -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; - VkBuffer WINE_VK_ALIGN(8) buffer; -} VkMemoryDedicatedAllocateInfo; -typedef VkMemoryDedicatedAllocateInfo VkMemoryDedicatedAllocateInfoKHR; - -typedef struct VkMemoryDedicatedRequirements -{ - VkStructureType sType; - void *pNext; - VkBool32 prefersDedicatedAllocation; - VkBool32 requiresDedicatedAllocation; -} VkMemoryDedicatedRequirements; -typedef VkMemoryDedicatedRequirements VkMemoryDedicatedRequirementsKHR; - -typedef struct VkMemoryGetWin32HandleInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkMemoryGetWin32HandleInfoKHR; - -typedef struct VkMemoryHeap -{ - VkDeviceSize WINE_VK_ALIGN(8) size; - VkMemoryHeapFlags flags; -} VkMemoryHeap; - -typedef struct VkMemoryHostPointerPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t memoryTypeBits; -} VkMemoryHostPointerPropertiesEXT; - -typedef struct VkMemoryMapInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkMemoryMapFlags flags; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkMemoryMapInfoKHR; - -typedef struct VkMemoryOpaqueCaptureAddressAllocateInfo -{ - VkStructureType sType; - const void *pNext; - uint64_t WINE_VK_ALIGN(8) opaqueCaptureAddress; -} VkMemoryOpaqueCaptureAddressAllocateInfo; -typedef VkMemoryOpaqueCaptureAddressAllocateInfo VkMemoryOpaqueCaptureAddressAllocateInfoKHR; - -typedef struct VkMemoryPriorityAllocateInfoEXT -{ - VkStructureType sType; - const void *pNext; - float priority; -} VkMemoryPriorityAllocateInfoEXT; - -typedef struct VkMemoryRequirements -{ - VkDeviceSize WINE_VK_ALIGN(8) size; - VkDeviceSize WINE_VK_ALIGN(8) alignment; - uint32_t memoryTypeBits; -} VkMemoryRequirements; - -typedef struct VkMemoryRequirements2 -{ - VkStructureType sType; - void *pNext; - VkMemoryRequirements WINE_VK_ALIGN(8) memoryRequirements; -} VkMemoryRequirements2; -typedef VkMemoryRequirements2 VkMemoryRequirements2KHR; - - -typedef struct VkMemoryType -{ - VkMemoryPropertyFlags propertyFlags; - uint32_t heapIndex; -} VkMemoryType; - -typedef struct VkMemoryUnmapInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkMemoryUnmapFlagsKHR flags; - VkDeviceMemory WINE_VK_ALIGN(8) memory; -} VkMemoryUnmapInfoKHR; - -typedef struct VkMemoryWin32HandlePropertiesKHR -{ - VkStructureType sType; - void *pNext; - uint32_t memoryTypeBits; -} VkMemoryWin32HandlePropertiesKHR; - -typedef struct VkMicromapBuildSizesInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) micromapSize; - VkDeviceSize WINE_VK_ALIGN(8) buildScratchSize; - VkBool32 discardable; -} VkMicromapBuildSizesInfoEXT; - -typedef struct VkMicromapCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkMicromapCreateFlagsEXT createFlags; - VkBuffer WINE_VK_ALIGN(8) buffer; - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkMicromapTypeEXT type; - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; -} VkMicromapCreateInfoEXT; - -typedef struct VkMicromapTriangleEXT -{ - uint32_t dataOffset; - uint16_t subdivisionLevel; - uint16_t format; -} VkMicromapTriangleEXT; - -typedef struct VkMicromapUsageEXT -{ - uint32_t count; - uint32_t subdivisionLevel; - uint32_t format; -} VkMicromapUsageEXT; - -typedef struct VkMicromapVersionInfoEXT -{ - VkStructureType sType; - const void *pNext; - const uint8_t *pVersionData; -} VkMicromapVersionInfoEXT; - -typedef struct VkMultiDrawIndexedInfoEXT -{ - uint32_t firstIndex; - uint32_t indexCount; - int32_t vertexOffset; -} VkMultiDrawIndexedInfoEXT; - -typedef struct VkMultiDrawInfoEXT -{ - uint32_t firstVertex; - uint32_t vertexCount; -} VkMultiDrawInfoEXT; - -typedef struct VkMultisamplePropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkExtent2D maxSampleLocationGridSize; -} VkMultisamplePropertiesEXT; - -typedef struct VkMultisampledRenderToSingleSampledInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 multisampledRenderToSingleSampledEnable; - VkSampleCountFlagBits rasterizationSamples; -} VkMultisampledRenderToSingleSampledInfoEXT; - -typedef struct VkMultiviewPerViewAttributesInfoNVX -{ - VkStructureType sType; - const void *pNext; - VkBool32 perViewAttributes; - VkBool32 perViewAttributesPositionXOnly; -} VkMultiviewPerViewAttributesInfoNVX; - -typedef struct VkMutableDescriptorTypeListEXT -{ - uint32_t descriptorTypeCount; - const VkDescriptorType *pDescriptorTypes; -} VkMutableDescriptorTypeListEXT; -typedef VkMutableDescriptorTypeListEXT VkMutableDescriptorTypeListVALVE; - -typedef struct VkOffset2D -{ - int32_t x; - int32_t y; -} VkOffset2D; - -typedef struct VkOffset3D -{ - int32_t x; - int32_t y; - int32_t z; -} VkOffset3D; - -typedef struct VkOpaqueCaptureDescriptorDataCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - const void *opaqueCaptureDescriptorData; -} VkOpaqueCaptureDescriptorDataCreateInfoEXT; - -typedef struct VkOpticalFlowImageFormatInfoNV -{ - VkStructureType sType; - const void *pNext; - VkOpticalFlowUsageFlagsNV usage; -} VkOpticalFlowImageFormatInfoNV; - -typedef struct VkOpticalFlowImageFormatPropertiesNV -{ - VkStructureType sType; - const void *pNext; - VkFormat format; -} VkOpticalFlowImageFormatPropertiesNV; - -typedef struct VkOpticalFlowSessionCreateInfoNV -{ - VkStructureType sType; - void *pNext; - uint32_t width; - uint32_t height; - VkFormat imageFormat; - VkFormat flowVectorFormat; - VkFormat costFormat; - VkOpticalFlowGridSizeFlagsNV outputGridSize; - VkOpticalFlowGridSizeFlagsNV hintGridSize; - VkOpticalFlowPerformanceLevelNV performanceLevel; - VkOpticalFlowSessionCreateFlagsNV flags; -} VkOpticalFlowSessionCreateInfoNV; - -typedef struct VkOpticalFlowSessionCreatePrivateDataInfoNV -{ - VkStructureType sType; - void *pNext; - uint32_t id; - uint32_t size; - const void *pPrivateData; -} VkOpticalFlowSessionCreatePrivateDataInfoNV; - -typedef struct VkOutOfBandQueueTypeInfoNV -{ - VkStructureType sType; - const void *pNext; - VkOutOfBandQueueTypeNV queueType; -} VkOutOfBandQueueTypeInfoNV; - -typedef struct VkPerformanceConfigurationAcquireInfoINTEL -{ - VkStructureType sType; - const void *pNext; - VkPerformanceConfigurationTypeINTEL type; -} VkPerformanceConfigurationAcquireInfoINTEL; - -typedef struct VkPerformanceCounterDescriptionKHR -{ - VkStructureType sType; - void *pNext; - VkPerformanceCounterDescriptionFlagsKHR flags; - char name[VK_MAX_DESCRIPTION_SIZE]; - char category[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; -} VkPerformanceCounterDescriptionKHR; - -typedef struct VkPerformanceCounterKHR -{ - VkStructureType sType; - void *pNext; - VkPerformanceCounterUnitKHR unit; - VkPerformanceCounterScopeKHR scope; - VkPerformanceCounterStorageKHR storage; - uint8_t uuid[VK_UUID_SIZE]; -} VkPerformanceCounterKHR; - -typedef union VkPerformanceCounterResultKHR -{ - int32_t int32; - int64_t int64; - uint32_t uint32; - uint64_t WINE_VK_ALIGN(8) uint64; - float float32; - double float64; -} VkPerformanceCounterResultKHR; - -typedef struct VkPerformanceMarkerInfoINTEL -{ - VkStructureType sType; - const void *pNext; - uint64_t WINE_VK_ALIGN(8) marker; -} VkPerformanceMarkerInfoINTEL; - -typedef struct VkPerformanceOverrideInfoINTEL -{ - VkStructureType sType; - const void *pNext; - VkPerformanceOverrideTypeINTEL type; - VkBool32 enable; - uint64_t WINE_VK_ALIGN(8) parameter; -} VkPerformanceOverrideInfoINTEL; - -typedef struct VkPerformanceQueryReservationInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t maxPerformanceQueriesPerPool; -} VkPerformanceQueryReservationInfoKHR; - -typedef struct VkPerformanceQuerySubmitInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t counterPassIndex; -} VkPerformanceQuerySubmitInfoKHR; - -typedef struct VkPerformanceStreamMarkerInfoINTEL -{ - VkStructureType sType; - const void *pNext; - uint32_t marker; -} VkPerformanceStreamMarkerInfoINTEL; - -typedef union VkPerformanceValueDataINTEL -{ - uint32_t value32; - uint64_t WINE_VK_ALIGN(8) value64; - float valueFloat; - VkBool32 valueBool; - const char *valueString; -} VkPerformanceValueDataINTEL; - -typedef struct VkPerformanceValueINTEL -{ - VkPerformanceValueTypeINTEL type; - VkPerformanceValueDataINTEL WINE_VK_ALIGN(8) data; -} VkPerformanceValueINTEL; - -typedef struct VkPhysicalDevice16BitStorageFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 storageBuffer16BitAccess; - VkBool32 uniformAndStorageBuffer16BitAccess; - VkBool32 storagePushConstant16; - VkBool32 storageInputOutput16; -} VkPhysicalDevice16BitStorageFeatures; -typedef VkPhysicalDevice16BitStorageFeatures VkPhysicalDevice16BitStorageFeaturesKHR; - -typedef struct VkPhysicalDevice4444FormatsFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 formatA4R4G4B4; - VkBool32 formatA4B4G4R4; -} VkPhysicalDevice4444FormatsFeaturesEXT; - -typedef struct VkPhysicalDevice8BitStorageFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 storageBuffer8BitAccess; - VkBool32 uniformAndStorageBuffer8BitAccess; - VkBool32 storagePushConstant8; -} VkPhysicalDevice8BitStorageFeatures; -typedef VkPhysicalDevice8BitStorageFeatures VkPhysicalDevice8BitStorageFeaturesKHR; - -typedef struct VkPhysicalDeviceASTCDecodeFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 decodeModeSharedExponent; -} VkPhysicalDeviceASTCDecodeFeaturesEXT; - -typedef struct VkPhysicalDeviceAccelerationStructureFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 accelerationStructure; - VkBool32 accelerationStructureCaptureReplay; - VkBool32 accelerationStructureIndirectBuild; - VkBool32 accelerationStructureHostCommands; - VkBool32 descriptorBindingAccelerationStructureUpdateAfterBind; -} VkPhysicalDeviceAccelerationStructureFeaturesKHR; - -typedef struct VkPhysicalDeviceAccelerationStructurePropertiesKHR -{ - VkStructureType sType; - void *pNext; - uint64_t WINE_VK_ALIGN(8) maxGeometryCount; - uint64_t WINE_VK_ALIGN(8) maxInstanceCount; - uint64_t WINE_VK_ALIGN(8) maxPrimitiveCount; - uint32_t maxPerStageDescriptorAccelerationStructures; - uint32_t maxPerStageDescriptorUpdateAfterBindAccelerationStructures; - uint32_t maxDescriptorSetAccelerationStructures; - uint32_t maxDescriptorSetUpdateAfterBindAccelerationStructures; - uint32_t minAccelerationStructureScratchOffsetAlignment; -} VkPhysicalDeviceAccelerationStructurePropertiesKHR; - -typedef struct VkPhysicalDeviceAddressBindingReportFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 reportAddressBinding; -} VkPhysicalDeviceAddressBindingReportFeaturesEXT; - -typedef struct VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 attachmentFeedbackLoopDynamicState; -} VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT; - -typedef struct VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 attachmentFeedbackLoopLayout; -} VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT; - -typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 advancedBlendCoherentOperations; -} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; - -typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t advancedBlendMaxColorAttachments; - VkBool32 advancedBlendIndependentBlend; - VkBool32 advancedBlendNonPremultipliedSrcColor; - VkBool32 advancedBlendNonPremultipliedDstColor; - VkBool32 advancedBlendCorrelatedOverlap; - VkBool32 advancedBlendAllOperations; -} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; - -typedef struct VkPhysicalDeviceBorderColorSwizzleFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 borderColorSwizzle; - VkBool32 borderColorSwizzleFromImage; -} VkPhysicalDeviceBorderColorSwizzleFeaturesEXT; - -typedef struct VkPhysicalDeviceBufferDeviceAddressFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; -} VkPhysicalDeviceBufferDeviceAddressFeatures; -typedef VkPhysicalDeviceBufferDeviceAddressFeatures VkPhysicalDeviceBufferDeviceAddressFeaturesKHR; - -typedef struct VkPhysicalDeviceBufferDeviceAddressFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; -} VkPhysicalDeviceBufferDeviceAddressFeaturesEXT; -typedef VkPhysicalDeviceBufferDeviceAddressFeaturesEXT VkPhysicalDeviceBufferAddressFeaturesEXT; - -typedef struct VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI -{ - VkStructureType sType; - void *pNext; - VkBool32 clustercullingShader; - VkBool32 multiviewClusterCullingShader; -} VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI; - -typedef struct VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI -{ - VkStructureType sType; - void *pNext; - uint32_t maxWorkGroupCount[3]; - uint32_t maxWorkGroupSize[3]; - uint32_t maxOutputClusterCount; - VkDeviceSize WINE_VK_ALIGN(8) indirectBufferOffsetAlignment; -} VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI; - -typedef struct VkPhysicalDeviceClusterCullingShaderVrsFeaturesHUAWEI -{ - VkStructureType sType; - void *pNext; - VkBool32 clusterShadingRate; -} VkPhysicalDeviceClusterCullingShaderVrsFeaturesHUAWEI; - -typedef struct VkPhysicalDeviceCoherentMemoryFeaturesAMD -{ - VkStructureType sType; - void *pNext; - VkBool32 deviceCoherentMemory; -} VkPhysicalDeviceCoherentMemoryFeaturesAMD; - -typedef struct VkPhysicalDeviceColorWriteEnableFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 colorWriteEnable; -} VkPhysicalDeviceColorWriteEnableFeaturesEXT; - -typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 computeDerivativeGroupQuads; - VkBool32 computeDerivativeGroupLinear; -} VkPhysicalDeviceComputeShaderDerivativesFeaturesNV; - -typedef struct VkPhysicalDeviceConditionalRenderingFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 conditionalRendering; - VkBool32 inheritedConditionalRendering; -} VkPhysicalDeviceConditionalRenderingFeaturesEXT; - -typedef struct VkPhysicalDeviceConservativeRasterizationPropertiesEXT -{ - VkStructureType sType; - void *pNext; - float primitiveOverestimationSize; - float maxExtraPrimitiveOverestimationSize; - float extraPrimitiveOverestimationSizeGranularity; - VkBool32 primitiveUnderestimation; - VkBool32 conservativePointAndLineRasterization; - VkBool32 degenerateTrianglesRasterized; - VkBool32 degenerateLinesRasterized; - VkBool32 fullyCoveredFragmentShaderInputVariable; - VkBool32 conservativeRasterizationPostDepthCoverage; -} VkPhysicalDeviceConservativeRasterizationPropertiesEXT; - -typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 cooperativeMatrix; - VkBool32 cooperativeMatrixRobustBufferAccess; -} VkPhysicalDeviceCooperativeMatrixFeaturesKHR; - -typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 cooperativeMatrix; - VkBool32 cooperativeMatrixRobustBufferAccess; -} VkPhysicalDeviceCooperativeMatrixFeaturesNV; - -typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesKHR -{ - VkStructureType sType; - void *pNext; - VkShaderStageFlags cooperativeMatrixSupportedStages; -} VkPhysicalDeviceCooperativeMatrixPropertiesKHR; - -typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkShaderStageFlags cooperativeMatrixSupportedStages; -} VkPhysicalDeviceCooperativeMatrixPropertiesNV; - -typedef struct VkPhysicalDeviceCopyMemoryIndirectFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 indirectCopy; -} VkPhysicalDeviceCopyMemoryIndirectFeaturesNV; - -typedef struct VkPhysicalDeviceCopyMemoryIndirectPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkQueueFlags supportedQueues; -} VkPhysicalDeviceCopyMemoryIndirectPropertiesNV; - -typedef struct VkPhysicalDeviceCornerSampledImageFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 cornerSampledImage; -} VkPhysicalDeviceCornerSampledImageFeaturesNV; - -typedef struct VkPhysicalDeviceCoverageReductionModeFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 coverageReductionMode; -} VkPhysicalDeviceCoverageReductionModeFeaturesNV; - -typedef struct VkPhysicalDeviceCubicClampFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 cubicRangeClamp; -} VkPhysicalDeviceCubicClampFeaturesQCOM; - -typedef struct VkPhysicalDeviceCubicWeightsFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 selectableCubicWeights; -} VkPhysicalDeviceCubicWeightsFeaturesQCOM; - -typedef struct VkPhysicalDeviceCudaKernelLaunchFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 cudaKernelLaunchFeatures; -} VkPhysicalDeviceCudaKernelLaunchFeaturesNV; - -typedef struct VkPhysicalDeviceCudaKernelLaunchPropertiesNV -{ - VkStructureType sType; - void *pNext; - uint32_t computeCapabilityMinor; - uint32_t computeCapabilityMajor; -} VkPhysicalDeviceCudaKernelLaunchPropertiesNV; - -typedef struct VkPhysicalDeviceCustomBorderColorFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 customBorderColors; - VkBool32 customBorderColorWithoutFormat; -} VkPhysicalDeviceCustomBorderColorFeaturesEXT; - -typedef struct VkPhysicalDeviceCustomBorderColorPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxCustomBorderColorSamplers; -} VkPhysicalDeviceCustomBorderColorPropertiesEXT; - -typedef struct VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 dedicatedAllocationImageAliasing; -} VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV; - -typedef struct VkPhysicalDeviceDepthBiasControlFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 depthBiasControl; - VkBool32 leastRepresentableValueForceUnormRepresentation; - VkBool32 floatRepresentation; - VkBool32 depthBiasExact; -} VkPhysicalDeviceDepthBiasControlFeaturesEXT; - -typedef struct VkPhysicalDeviceDepthClampZeroOneFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 depthClampZeroOne; -} VkPhysicalDeviceDepthClampZeroOneFeaturesEXT; - -typedef struct VkPhysicalDeviceDepthClipControlFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 depthClipControl; -} VkPhysicalDeviceDepthClipControlFeaturesEXT; - -typedef struct VkPhysicalDeviceDepthClipEnableFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 depthClipEnable; -} VkPhysicalDeviceDepthClipEnableFeaturesEXT; - -typedef struct VkPhysicalDeviceDepthStencilResolveProperties -{ - VkStructureType sType; - void *pNext; - VkResolveModeFlags supportedDepthResolveModes; - VkResolveModeFlags supportedStencilResolveModes; - VkBool32 independentResolveNone; - VkBool32 independentResolve; -} VkPhysicalDeviceDepthStencilResolveProperties; -typedef VkPhysicalDeviceDepthStencilResolveProperties VkPhysicalDeviceDepthStencilResolvePropertiesKHR; - -typedef struct VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT -{ - VkStructureType sType; - void *pNext; - size_t combinedImageSamplerDensityMapDescriptorSize; -} VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT; - -typedef struct VkPhysicalDeviceDescriptorBufferFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 descriptorBuffer; - VkBool32 descriptorBufferCaptureReplay; - VkBool32 descriptorBufferImageLayoutIgnored; - VkBool32 descriptorBufferPushDescriptors; -} VkPhysicalDeviceDescriptorBufferFeaturesEXT; - -typedef struct VkPhysicalDeviceDescriptorBufferPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 combinedImageSamplerDescriptorSingleArray; - VkBool32 bufferlessPushDescriptors; - VkBool32 allowSamplerImageViewPostSubmitCreation; - VkDeviceSize WINE_VK_ALIGN(8) descriptorBufferOffsetAlignment; - uint32_t maxDescriptorBufferBindings; - uint32_t maxResourceDescriptorBufferBindings; - uint32_t maxSamplerDescriptorBufferBindings; - uint32_t maxEmbeddedImmutableSamplerBindings; - uint32_t maxEmbeddedImmutableSamplers; - size_t bufferCaptureReplayDescriptorDataSize; - size_t imageCaptureReplayDescriptorDataSize; - size_t imageViewCaptureReplayDescriptorDataSize; - size_t samplerCaptureReplayDescriptorDataSize; - size_t accelerationStructureCaptureReplayDescriptorDataSize; - size_t samplerDescriptorSize; - size_t combinedImageSamplerDescriptorSize; - size_t sampledImageDescriptorSize; - size_t storageImageDescriptorSize; - size_t uniformTexelBufferDescriptorSize; - size_t robustUniformTexelBufferDescriptorSize; - size_t storageTexelBufferDescriptorSize; - size_t robustStorageTexelBufferDescriptorSize; - size_t uniformBufferDescriptorSize; - size_t robustUniformBufferDescriptorSize; - size_t storageBufferDescriptorSize; - size_t robustStorageBufferDescriptorSize; - size_t inputAttachmentDescriptorSize; - size_t accelerationStructureDescriptorSize; - VkDeviceSize WINE_VK_ALIGN(8) maxSamplerDescriptorBufferRange; - VkDeviceSize WINE_VK_ALIGN(8) maxResourceDescriptorBufferRange; - VkDeviceSize WINE_VK_ALIGN(8) samplerDescriptorBufferAddressSpaceSize; - VkDeviceSize WINE_VK_ALIGN(8) resourceDescriptorBufferAddressSpaceSize; - VkDeviceSize WINE_VK_ALIGN(8) descriptorBufferAddressSpaceSize; -} VkPhysicalDeviceDescriptorBufferPropertiesEXT; - -typedef struct VkPhysicalDeviceDescriptorIndexingFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderInputAttachmentArrayDynamicIndexing; - VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; - VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; - VkBool32 shaderUniformBufferArrayNonUniformIndexing; - VkBool32 shaderSampledImageArrayNonUniformIndexing; - VkBool32 shaderStorageBufferArrayNonUniformIndexing; - VkBool32 shaderStorageImageArrayNonUniformIndexing; - VkBool32 shaderInputAttachmentArrayNonUniformIndexing; - VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; - VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; - VkBool32 descriptorBindingUniformBufferUpdateAfterBind; - VkBool32 descriptorBindingSampledImageUpdateAfterBind; - VkBool32 descriptorBindingStorageImageUpdateAfterBind; - VkBool32 descriptorBindingStorageBufferUpdateAfterBind; - VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingUpdateUnusedWhilePending; - VkBool32 descriptorBindingPartiallyBound; - VkBool32 descriptorBindingVariableDescriptorCount; - VkBool32 runtimeDescriptorArray; -} VkPhysicalDeviceDescriptorIndexingFeatures; -typedef VkPhysicalDeviceDescriptorIndexingFeatures VkPhysicalDeviceDescriptorIndexingFeaturesEXT; - -typedef struct VkPhysicalDeviceDescriptorIndexingProperties -{ - VkStructureType sType; - void *pNext; - uint32_t maxUpdateAfterBindDescriptorsInAllPools; - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; - VkBool32 shaderSampledImageArrayNonUniformIndexingNative; - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; - VkBool32 shaderStorageImageArrayNonUniformIndexingNative; - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; - VkBool32 robustBufferAccessUpdateAfterBind; - VkBool32 quadDivergentImplicitLod; - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; - uint32_t maxPerStageUpdateAfterBindResources; - uint32_t maxDescriptorSetUpdateAfterBindSamplers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindSampledImages; - uint32_t maxDescriptorSetUpdateAfterBindStorageImages; - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; -} VkPhysicalDeviceDescriptorIndexingProperties; -typedef VkPhysicalDeviceDescriptorIndexingProperties VkPhysicalDeviceDescriptorIndexingPropertiesEXT; - -typedef struct VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 descriptorPoolOverallocation; -} VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV; - -typedef struct VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE -{ - VkStructureType sType; - void *pNext; - VkBool32 descriptorSetHostMapping; -} VkPhysicalDeviceDescriptorSetHostMappingFeaturesVALVE; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 deviceGeneratedCompute; - VkBool32 deviceGeneratedComputePipelines; - VkBool32 deviceGeneratedComputeCaptureReplay; -} VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 deviceGeneratedCommands; -} VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV -{ - VkStructureType sType; - void *pNext; - uint32_t maxGraphicsShaderGroupCount; - uint32_t maxIndirectSequenceCount; - uint32_t maxIndirectCommandsTokenCount; - uint32_t maxIndirectCommandsStreamCount; - uint32_t maxIndirectCommandsTokenOffset; - uint32_t maxIndirectCommandsStreamStride; - uint32_t minSequencesCountBufferOffsetAlignment; - uint32_t minSequencesIndexBufferOffsetAlignment; - uint32_t minIndirectCommandsBufferOffsetAlignment; -} VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV; - -typedef struct VkPhysicalDeviceDiagnosticsConfigFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 diagnosticsConfig; -} VkPhysicalDeviceDiagnosticsConfigFeaturesNV; - -typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxDiscardRectangles; -} VkPhysicalDeviceDiscardRectanglePropertiesEXT; - -typedef struct VkPhysicalDeviceDriverProperties -{ - VkStructureType sType; - void *pNext; - VkDriverId driverID; - char driverName[VK_MAX_DRIVER_NAME_SIZE]; - char driverInfo[VK_MAX_DRIVER_INFO_SIZE]; - VkConformanceVersion conformanceVersion; -} VkPhysicalDeviceDriverProperties; -typedef VkPhysicalDeviceDriverProperties VkPhysicalDeviceDriverPropertiesKHR; - -typedef struct VkPhysicalDeviceDynamicRenderingFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 dynamicRendering; -} VkPhysicalDeviceDynamicRenderingFeatures; -typedef VkPhysicalDeviceDynamicRenderingFeatures VkPhysicalDeviceDynamicRenderingFeaturesKHR; - -typedef struct VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 dynamicRenderingUnusedAttachments; -} VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT; - -typedef struct VkPhysicalDeviceExclusiveScissorFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 exclusiveScissor; -} VkPhysicalDeviceExclusiveScissorFeaturesNV; - -typedef struct VkPhysicalDeviceExtendedDynamicState2FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 extendedDynamicState2; - VkBool32 extendedDynamicState2LogicOp; - VkBool32 extendedDynamicState2PatchControlPoints; -} VkPhysicalDeviceExtendedDynamicState2FeaturesEXT; - -typedef struct VkPhysicalDeviceExtendedDynamicState3FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 extendedDynamicState3TessellationDomainOrigin; - VkBool32 extendedDynamicState3DepthClampEnable; - VkBool32 extendedDynamicState3PolygonMode; - VkBool32 extendedDynamicState3RasterizationSamples; - VkBool32 extendedDynamicState3SampleMask; - VkBool32 extendedDynamicState3AlphaToCoverageEnable; - VkBool32 extendedDynamicState3AlphaToOneEnable; - VkBool32 extendedDynamicState3LogicOpEnable; - VkBool32 extendedDynamicState3ColorBlendEnable; - VkBool32 extendedDynamicState3ColorBlendEquation; - VkBool32 extendedDynamicState3ColorWriteMask; - VkBool32 extendedDynamicState3RasterizationStream; - VkBool32 extendedDynamicState3ConservativeRasterizationMode; - VkBool32 extendedDynamicState3ExtraPrimitiveOverestimationSize; - VkBool32 extendedDynamicState3DepthClipEnable; - VkBool32 extendedDynamicState3SampleLocationsEnable; - VkBool32 extendedDynamicState3ColorBlendAdvanced; - VkBool32 extendedDynamicState3ProvokingVertexMode; - VkBool32 extendedDynamicState3LineRasterizationMode; - VkBool32 extendedDynamicState3LineStippleEnable; - VkBool32 extendedDynamicState3DepthClipNegativeOneToOne; - VkBool32 extendedDynamicState3ViewportWScalingEnable; - VkBool32 extendedDynamicState3ViewportSwizzle; - VkBool32 extendedDynamicState3CoverageToColorEnable; - VkBool32 extendedDynamicState3CoverageToColorLocation; - VkBool32 extendedDynamicState3CoverageModulationMode; - VkBool32 extendedDynamicState3CoverageModulationTableEnable; - VkBool32 extendedDynamicState3CoverageModulationTable; - VkBool32 extendedDynamicState3CoverageReductionMode; - VkBool32 extendedDynamicState3RepresentativeFragmentTestEnable; - VkBool32 extendedDynamicState3ShadingRateImageEnable; -} VkPhysicalDeviceExtendedDynamicState3FeaturesEXT; - -typedef struct VkPhysicalDeviceExtendedDynamicState3PropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 dynamicPrimitiveTopologyUnrestricted; -} VkPhysicalDeviceExtendedDynamicState3PropertiesEXT; - -typedef struct VkPhysicalDeviceExtendedDynamicStateFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 extendedDynamicState; -} VkPhysicalDeviceExtendedDynamicStateFeaturesEXT; - -typedef struct VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 extendedSparseAddressSpace; -} VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV; - -typedef struct VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) extendedSparseAddressSpaceSize; - VkImageUsageFlags extendedSparseImageUsageFlags; - VkBufferUsageFlags extendedSparseBufferUsageFlags; -} VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV; - -typedef struct VkPhysicalDeviceExternalBufferInfo -{ - VkStructureType sType; - const void *pNext; - VkBufferCreateFlags flags; - VkBufferUsageFlags usage; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalBufferInfo; -typedef VkPhysicalDeviceExternalBufferInfo VkPhysicalDeviceExternalBufferInfoKHR; - -typedef struct VkPhysicalDeviceExternalFenceInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalFenceHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalFenceInfo; -typedef VkPhysicalDeviceExternalFenceInfo VkPhysicalDeviceExternalFenceInfoKHR; - -typedef struct VkPhysicalDeviceExternalImageFormatInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalImageFormatInfo; -typedef VkPhysicalDeviceExternalImageFormatInfo VkPhysicalDeviceExternalImageFormatInfoKHR; - -typedef struct VkPhysicalDeviceExternalMemoryHostPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) minImportedHostPointerAlignment; -} VkPhysicalDeviceExternalMemoryHostPropertiesEXT; - -typedef struct VkPhysicalDeviceExternalSemaphoreInfo -{ - VkStructureType sType; - const void *pNext; - VkExternalSemaphoreHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalSemaphoreInfo; -typedef VkPhysicalDeviceExternalSemaphoreInfo VkPhysicalDeviceExternalSemaphoreInfoKHR; - -typedef struct VkPhysicalDeviceFaultFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 deviceFault; - VkBool32 deviceFaultVendorBinary; -} VkPhysicalDeviceFaultFeaturesEXT; - -typedef struct VkPhysicalDeviceFeatures -{ - VkBool32 robustBufferAccess; - VkBool32 fullDrawIndexUint32; - VkBool32 imageCubeArray; - VkBool32 independentBlend; - VkBool32 geometryShader; - VkBool32 tessellationShader; - VkBool32 sampleRateShading; - VkBool32 dualSrcBlend; - VkBool32 logicOp; - VkBool32 multiDrawIndirect; - VkBool32 drawIndirectFirstInstance; - VkBool32 depthClamp; - VkBool32 depthBiasClamp; - VkBool32 fillModeNonSolid; - VkBool32 depthBounds; - VkBool32 wideLines; - VkBool32 largePoints; - VkBool32 alphaToOne; - VkBool32 multiViewport; - VkBool32 samplerAnisotropy; - VkBool32 textureCompressionETC2; - VkBool32 textureCompressionASTC_LDR; - VkBool32 textureCompressionBC; - VkBool32 occlusionQueryPrecise; - VkBool32 pipelineStatisticsQuery; - VkBool32 vertexPipelineStoresAndAtomics; - VkBool32 fragmentStoresAndAtomics; - VkBool32 shaderTessellationAndGeometryPointSize; - VkBool32 shaderImageGatherExtended; - VkBool32 shaderStorageImageExtendedFormats; - VkBool32 shaderStorageImageMultisample; - VkBool32 shaderStorageImageReadWithoutFormat; - VkBool32 shaderStorageImageWriteWithoutFormat; - VkBool32 shaderUniformBufferArrayDynamicIndexing; - VkBool32 shaderSampledImageArrayDynamicIndexing; - VkBool32 shaderStorageBufferArrayDynamicIndexing; - VkBool32 shaderStorageImageArrayDynamicIndexing; - VkBool32 shaderClipDistance; - VkBool32 shaderCullDistance; - VkBool32 shaderFloat64; - VkBool32 shaderInt64; - VkBool32 shaderInt16; - VkBool32 shaderResourceResidency; - VkBool32 shaderResourceMinLod; - VkBool32 sparseBinding; - VkBool32 sparseResidencyBuffer; - VkBool32 sparseResidencyImage2D; - VkBool32 sparseResidencyImage3D; - VkBool32 sparseResidency2Samples; - VkBool32 sparseResidency4Samples; - VkBool32 sparseResidency8Samples; - VkBool32 sparseResidency16Samples; - VkBool32 sparseResidencyAliased; - VkBool32 variableMultisampleRate; - VkBool32 inheritedQueries; -} VkPhysicalDeviceFeatures; - -typedef struct VkPhysicalDeviceFeatures2 -{ - VkStructureType sType; - void *pNext; - VkPhysicalDeviceFeatures features; -} VkPhysicalDeviceFeatures2; -typedef VkPhysicalDeviceFeatures2 VkPhysicalDeviceFeatures2KHR; - -typedef struct VkPhysicalDeviceFloatControlsProperties -{ - VkStructureType sType; - void *pNext; - VkShaderFloatControlsIndependence denormBehaviorIndependence; - VkShaderFloatControlsIndependence roundingModeIndependence; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; -} VkPhysicalDeviceFloatControlsProperties; -typedef VkPhysicalDeviceFloatControlsProperties VkPhysicalDeviceFloatControlsPropertiesKHR; - -typedef struct VkPhysicalDeviceFragmentDensityMap2FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 fragmentDensityMapDeferred; -} VkPhysicalDeviceFragmentDensityMap2FeaturesEXT; - -typedef struct VkPhysicalDeviceFragmentDensityMap2PropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 subsampledLoads; - VkBool32 subsampledCoarseReconstructionEarlyAccess; - uint32_t maxSubsampledArrayLayers; - uint32_t maxDescriptorSetSubsampledSamplers; -} VkPhysicalDeviceFragmentDensityMap2PropertiesEXT; - -typedef struct VkPhysicalDeviceFragmentDensityMapFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 fragmentDensityMap; - VkBool32 fragmentDensityMapDynamic; - VkBool32 fragmentDensityMapNonSubsampledImages; -} VkPhysicalDeviceFragmentDensityMapFeaturesEXT; - -typedef struct VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 fragmentDensityMapOffset; -} VkPhysicalDeviceFragmentDensityMapOffsetFeaturesQCOM; - -typedef struct VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM -{ - VkStructureType sType; - void *pNext; - VkExtent2D fragmentDensityOffsetGranularity; -} VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM; - -typedef struct VkPhysicalDeviceFragmentDensityMapPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkExtent2D minFragmentDensityTexelSize; - VkExtent2D maxFragmentDensityTexelSize; - VkBool32 fragmentDensityInvocations; -} VkPhysicalDeviceFragmentDensityMapPropertiesEXT; - -typedef struct VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 fragmentShaderBarycentric; -} VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR; -typedef VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV; - -typedef struct VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 triStripVertexOrderIndependentOfProvokingVertex; -} VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR; - -typedef struct VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 fragmentShaderSampleInterlock; - VkBool32 fragmentShaderPixelInterlock; - VkBool32 fragmentShaderShadingRateInterlock; -} VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT; - -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 fragmentShadingRateEnums; - VkBool32 supersampleFragmentShadingRates; - VkBool32 noInvocationFragmentShadingRates; -} VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV; - -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkSampleCountFlagBits maxFragmentShadingRateInvocationCount; -} VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV; - -typedef struct VkPhysicalDeviceFragmentShadingRateFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelineFragmentShadingRate; - VkBool32 primitiveFragmentShadingRate; - VkBool32 attachmentFragmentShadingRate; -} VkPhysicalDeviceFragmentShadingRateFeaturesKHR; - -typedef struct VkPhysicalDeviceFragmentShadingRateKHR -{ - VkStructureType sType; - void *pNext; - VkSampleCountFlags sampleCounts; - VkExtent2D fragmentSize; -} VkPhysicalDeviceFragmentShadingRateKHR; - -typedef struct VkPhysicalDeviceFragmentShadingRatePropertiesKHR -{ - VkStructureType sType; - void *pNext; - VkExtent2D minFragmentShadingRateAttachmentTexelSize; - VkExtent2D maxFragmentShadingRateAttachmentTexelSize; - uint32_t maxFragmentShadingRateAttachmentTexelSizeAspectRatio; - VkBool32 primitiveFragmentShadingRateWithMultipleViewports; - VkBool32 layeredShadingRateAttachments; - VkBool32 fragmentShadingRateNonTrivialCombinerOps; - VkExtent2D maxFragmentSize; - uint32_t maxFragmentSizeAspectRatio; - uint32_t maxFragmentShadingRateCoverageSamples; - VkSampleCountFlagBits maxFragmentShadingRateRasterizationSamples; - VkBool32 fragmentShadingRateWithShaderDepthStencilWrites; - VkBool32 fragmentShadingRateWithSampleMask; - VkBool32 fragmentShadingRateWithShaderSampleMask; - VkBool32 fragmentShadingRateWithConservativeRasterization; - VkBool32 fragmentShadingRateWithFragmentShaderInterlock; - VkBool32 fragmentShadingRateWithCustomSampleLocations; - VkBool32 fragmentShadingRateStrictMultiplyCombiner; -} VkPhysicalDeviceFragmentShadingRatePropertiesKHR; - -typedef struct VkPhysicalDeviceFrameBoundaryFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 frameBoundary; -} VkPhysicalDeviceFrameBoundaryFeaturesEXT; - -typedef struct VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 globalPriorityQuery; -} VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR; -typedef VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR VkPhysicalDeviceGlobalPriorityQueryFeaturesEXT; - -typedef struct VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 graphicsPipelineLibrary; -} VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT; - -typedef struct VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 graphicsPipelineLibraryFastLinking; - VkBool32 graphicsPipelineLibraryIndependentInterpolationDecoration; -} VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT; - -typedef struct VkPhysicalDeviceGroupProperties -{ - VkStructureType sType; - void *pNext; - uint32_t physicalDeviceCount; - VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE]; - VkBool32 subsetAllocation; -} VkPhysicalDeviceGroupProperties; -typedef VkPhysicalDeviceGroupProperties VkPhysicalDeviceGroupPropertiesKHR; - -typedef struct VkPhysicalDeviceHostImageCopyFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 hostImageCopy; -} VkPhysicalDeviceHostImageCopyFeaturesEXT; - -typedef struct VkPhysicalDeviceHostImageCopyPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t copySrcLayoutCount; - VkImageLayout *pCopySrcLayouts; - uint32_t copyDstLayoutCount; - VkImageLayout *pCopyDstLayouts; - uint8_t optimalTilingLayoutUUID[VK_UUID_SIZE]; - VkBool32 identicalMemoryTypeRequirements; -} VkPhysicalDeviceHostImageCopyPropertiesEXT; - -typedef struct VkPhysicalDeviceHostQueryResetFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 hostQueryReset; -} VkPhysicalDeviceHostQueryResetFeatures; -typedef VkPhysicalDeviceHostQueryResetFeatures VkPhysicalDeviceHostQueryResetFeaturesEXT; - -typedef struct VkPhysicalDeviceIDProperties -{ - VkStructureType sType; - void *pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; -} VkPhysicalDeviceIDProperties; -typedef VkPhysicalDeviceIDProperties VkPhysicalDeviceIDPropertiesKHR; - -typedef struct VkPhysicalDeviceImage2DViewOf3DFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 image2DViewOf3D; - VkBool32 sampler2DViewOf3D; -} VkPhysicalDeviceImage2DViewOf3DFeaturesEXT; - -typedef struct VkPhysicalDeviceImageCompressionControlFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 imageCompressionControl; -} VkPhysicalDeviceImageCompressionControlFeaturesEXT; - -typedef struct VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 imageCompressionControlSwapchain; -} VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT; - -typedef struct VkPhysicalDeviceImageFormatInfo2 -{ - VkStructureType sType; - const void *pNext; - VkFormat format; - VkImageType type; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkImageCreateFlags flags; -} VkPhysicalDeviceImageFormatInfo2; -typedef VkPhysicalDeviceImageFormatInfo2 VkPhysicalDeviceImageFormatInfo2KHR; - -typedef struct VkPhysicalDeviceImageProcessing2FeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 textureBlockMatch2; -} VkPhysicalDeviceImageProcessing2FeaturesQCOM; - -typedef struct VkPhysicalDeviceImageProcessing2PropertiesQCOM -{ - VkStructureType sType; - void *pNext; - VkExtent2D maxBlockMatchWindow; -} VkPhysicalDeviceImageProcessing2PropertiesQCOM; - -typedef struct VkPhysicalDeviceImageProcessingFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 textureSampleWeighted; - VkBool32 textureBoxFilter; - VkBool32 textureBlockMatch; -} VkPhysicalDeviceImageProcessingFeaturesQCOM; - -typedef struct VkPhysicalDeviceImageProcessingPropertiesQCOM -{ - VkStructureType sType; - void *pNext; - uint32_t maxWeightFilterPhases; - VkExtent2D maxWeightFilterDimension; - VkExtent2D maxBlockMatchRegion; - VkExtent2D maxBoxFilterBlockSize; -} VkPhysicalDeviceImageProcessingPropertiesQCOM; - -typedef struct VkPhysicalDeviceImageRobustnessFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 robustImageAccess; -} VkPhysicalDeviceImageRobustnessFeatures; -typedef VkPhysicalDeviceImageRobustnessFeatures VkPhysicalDeviceImageRobustnessFeaturesEXT; - -typedef struct VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 imageSlicedViewOf3D; -} VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT; - -typedef struct VkPhysicalDeviceImageViewImageFormatInfoEXT -{ - VkStructureType sType; - void *pNext; - VkImageViewType imageViewType; -} VkPhysicalDeviceImageViewImageFormatInfoEXT; - -typedef struct VkPhysicalDeviceImageViewMinLodFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 minLod; -} VkPhysicalDeviceImageViewMinLodFeaturesEXT; - -typedef struct VkPhysicalDeviceImagelessFramebufferFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 imagelessFramebuffer; -} VkPhysicalDeviceImagelessFramebufferFeatures; -typedef VkPhysicalDeviceImagelessFramebufferFeatures VkPhysicalDeviceImagelessFramebufferFeaturesKHR; - -typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 indexTypeUint8; -} VkPhysicalDeviceIndexTypeUint8FeaturesEXT; - -typedef struct VkPhysicalDeviceInheritedViewportScissorFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 inheritedViewportScissor2D; -} VkPhysicalDeviceInheritedViewportScissorFeaturesNV; - -typedef struct VkPhysicalDeviceInlineUniformBlockFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 inlineUniformBlock; - VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; -} VkPhysicalDeviceInlineUniformBlockFeatures; -typedef VkPhysicalDeviceInlineUniformBlockFeatures VkPhysicalDeviceInlineUniformBlockFeaturesEXT; - -typedef struct VkPhysicalDeviceInlineUniformBlockProperties -{ - VkStructureType sType; - void *pNext; - uint32_t maxInlineUniformBlockSize; - uint32_t maxPerStageDescriptorInlineUniformBlocks; - uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - uint32_t maxDescriptorSetInlineUniformBlocks; - uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; -} VkPhysicalDeviceInlineUniformBlockProperties; -typedef VkPhysicalDeviceInlineUniformBlockProperties VkPhysicalDeviceInlineUniformBlockPropertiesEXT; - -typedef struct VkPhysicalDeviceInvocationMaskFeaturesHUAWEI -{ - VkStructureType sType; - void *pNext; - VkBool32 invocationMask; -} VkPhysicalDeviceInvocationMaskFeaturesHUAWEI; - -typedef struct VkPhysicalDeviceLayeredDriverPropertiesMSFT -{ - VkStructureType sType; - void *pNext; - VkLayeredDriverUnderlyingApiMSFT underlyingAPI; -} VkPhysicalDeviceLayeredDriverPropertiesMSFT; - -typedef struct VkPhysicalDeviceLegacyDitheringFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 legacyDithering; -} VkPhysicalDeviceLegacyDitheringFeaturesEXT; - -typedef struct VkPhysicalDeviceLimits -{ - uint32_t maxImageDimension1D; - uint32_t maxImageDimension2D; - uint32_t maxImageDimension3D; - uint32_t maxImageDimensionCube; - uint32_t maxImageArrayLayers; - uint32_t maxTexelBufferElements; - uint32_t maxUniformBufferRange; - uint32_t maxStorageBufferRange; - uint32_t maxPushConstantsSize; - uint32_t maxMemoryAllocationCount; - uint32_t maxSamplerAllocationCount; - VkDeviceSize WINE_VK_ALIGN(8) bufferImageGranularity; - VkDeviceSize WINE_VK_ALIGN(8) sparseAddressSpaceSize; - uint32_t maxBoundDescriptorSets; - uint32_t maxPerStageDescriptorSamplers; - uint32_t maxPerStageDescriptorUniformBuffers; - uint32_t maxPerStageDescriptorStorageBuffers; - uint32_t maxPerStageDescriptorSampledImages; - uint32_t maxPerStageDescriptorStorageImages; - uint32_t maxPerStageDescriptorInputAttachments; - uint32_t maxPerStageResources; - uint32_t maxDescriptorSetSamplers; - uint32_t maxDescriptorSetUniformBuffers; - uint32_t maxDescriptorSetUniformBuffersDynamic; - uint32_t maxDescriptorSetStorageBuffers; - uint32_t maxDescriptorSetStorageBuffersDynamic; - uint32_t maxDescriptorSetSampledImages; - uint32_t maxDescriptorSetStorageImages; - uint32_t maxDescriptorSetInputAttachments; - uint32_t maxVertexInputAttributes; - uint32_t maxVertexInputBindings; - uint32_t maxVertexInputAttributeOffset; - uint32_t maxVertexInputBindingStride; - uint32_t maxVertexOutputComponents; - uint32_t maxTessellationGenerationLevel; - uint32_t maxTessellationPatchSize; - uint32_t maxTessellationControlPerVertexInputComponents; - uint32_t maxTessellationControlPerVertexOutputComponents; - uint32_t maxTessellationControlPerPatchOutputComponents; - uint32_t maxTessellationControlTotalOutputComponents; - uint32_t maxTessellationEvaluationInputComponents; - uint32_t maxTessellationEvaluationOutputComponents; - uint32_t maxGeometryShaderInvocations; - uint32_t maxGeometryInputComponents; - uint32_t maxGeometryOutputComponents; - uint32_t maxGeometryOutputVertices; - uint32_t maxGeometryTotalOutputComponents; - uint32_t maxFragmentInputComponents; - uint32_t maxFragmentOutputAttachments; - uint32_t maxFragmentDualSrcAttachments; - uint32_t maxFragmentCombinedOutputResources; - uint32_t maxComputeSharedMemorySize; - uint32_t maxComputeWorkGroupCount[3]; - uint32_t maxComputeWorkGroupInvocations; - uint32_t maxComputeWorkGroupSize[3]; - uint32_t subPixelPrecisionBits; - uint32_t subTexelPrecisionBits; - uint32_t mipmapPrecisionBits; - uint32_t maxDrawIndexedIndexValue; - uint32_t maxDrawIndirectCount; - float maxSamplerLodBias; - float maxSamplerAnisotropy; - uint32_t maxViewports; - uint32_t maxViewportDimensions[2]; - float viewportBoundsRange[2]; - uint32_t viewportSubPixelBits; - size_t minMemoryMapAlignment; - VkDeviceSize WINE_VK_ALIGN(8) minTexelBufferOffsetAlignment; - VkDeviceSize WINE_VK_ALIGN(8) minUniformBufferOffsetAlignment; - VkDeviceSize WINE_VK_ALIGN(8) minStorageBufferOffsetAlignment; - int32_t minTexelOffset; - uint32_t maxTexelOffset; - int32_t minTexelGatherOffset; - uint32_t maxTexelGatherOffset; - float minInterpolationOffset; - float maxInterpolationOffset; - uint32_t subPixelInterpolationOffsetBits; - uint32_t maxFramebufferWidth; - uint32_t maxFramebufferHeight; - uint32_t maxFramebufferLayers; - VkSampleCountFlags framebufferColorSampleCounts; - VkSampleCountFlags framebufferDepthSampleCounts; - VkSampleCountFlags framebufferStencilSampleCounts; - VkSampleCountFlags framebufferNoAttachmentsSampleCounts; - uint32_t maxColorAttachments; - VkSampleCountFlags sampledImageColorSampleCounts; - VkSampleCountFlags sampledImageIntegerSampleCounts; - VkSampleCountFlags sampledImageDepthSampleCounts; - VkSampleCountFlags sampledImageStencilSampleCounts; - VkSampleCountFlags storageImageSampleCounts; - uint32_t maxSampleMaskWords; - VkBool32 timestampComputeAndGraphics; - float timestampPeriod; - uint32_t maxClipDistances; - uint32_t maxCullDistances; - uint32_t maxCombinedClipAndCullDistances; - uint32_t discreteQueuePriorities; - float pointSizeRange[2]; - float lineWidthRange[2]; - float pointSizeGranularity; - float lineWidthGranularity; - VkBool32 strictLines; - VkBool32 standardSampleLocations; - VkDeviceSize WINE_VK_ALIGN(8) optimalBufferCopyOffsetAlignment; - VkDeviceSize WINE_VK_ALIGN(8) optimalBufferCopyRowPitchAlignment; - VkDeviceSize WINE_VK_ALIGN(8) nonCoherentAtomSize; -} VkPhysicalDeviceLimits; - -typedef struct VkPhysicalDeviceLineRasterizationFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 rectangularLines; - VkBool32 bresenhamLines; - VkBool32 smoothLines; - VkBool32 stippledRectangularLines; - VkBool32 stippledBresenhamLines; - VkBool32 stippledSmoothLines; -} VkPhysicalDeviceLineRasterizationFeaturesEXT; - -typedef struct VkPhysicalDeviceLineRasterizationPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t lineSubPixelPrecisionBits; -} VkPhysicalDeviceLineRasterizationPropertiesEXT; - -typedef struct VkPhysicalDeviceLinearColorAttachmentFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 linearColorAttachment; -} VkPhysicalDeviceLinearColorAttachmentFeaturesNV; - -typedef struct VkPhysicalDeviceMaintenance3Properties -{ - VkStructureType sType; - void *pNext; - uint32_t maxPerSetDescriptors; - VkDeviceSize WINE_VK_ALIGN(8) maxMemoryAllocationSize; -} VkPhysicalDeviceMaintenance3Properties; -typedef VkPhysicalDeviceMaintenance3Properties VkPhysicalDeviceMaintenance3PropertiesKHR; - -typedef struct VkPhysicalDeviceMaintenance4Features -{ - VkStructureType sType; - void *pNext; - VkBool32 maintenance4; -} VkPhysicalDeviceMaintenance4Features; -typedef VkPhysicalDeviceMaintenance4Features VkPhysicalDeviceMaintenance4FeaturesKHR; - -typedef struct VkPhysicalDeviceMaintenance4Properties -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) maxBufferSize; -} VkPhysicalDeviceMaintenance4Properties; -typedef VkPhysicalDeviceMaintenance4Properties VkPhysicalDeviceMaintenance4PropertiesKHR; - -typedef struct VkPhysicalDeviceMaintenance5FeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 maintenance5; -} VkPhysicalDeviceMaintenance5FeaturesKHR; - -typedef struct VkPhysicalDeviceMaintenance5PropertiesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 earlyFragmentMultisampleCoverageAfterSampleCounting; - VkBool32 earlyFragmentSampleMaskTestBeforeSampleCounting; - VkBool32 depthStencilSwizzleOneSupport; - VkBool32 polygonModePointSize; - VkBool32 nonStrictSinglePixelWideLinesUseParallelogram; - VkBool32 nonStrictWideLinesUseParallelogram; -} VkPhysicalDeviceMaintenance5PropertiesKHR; - -typedef struct VkPhysicalDeviceMemoryBudgetPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) heapBudget[VK_MAX_MEMORY_HEAPS]; - VkDeviceSize WINE_VK_ALIGN(8) heapUsage[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryBudgetPropertiesEXT; - -typedef struct VkPhysicalDeviceMemoryDecompressionFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 memoryDecompression; -} VkPhysicalDeviceMemoryDecompressionFeaturesNV; - -typedef struct VkPhysicalDeviceMemoryDecompressionPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkMemoryDecompressionMethodFlagsNV WINE_VK_ALIGN(8) decompressionMethods; - uint64_t WINE_VK_ALIGN(8) maxDecompressionIndirectCount; -} VkPhysicalDeviceMemoryDecompressionPropertiesNV; - -typedef struct VkPhysicalDeviceMemoryPriorityFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 memoryPriority; -} VkPhysicalDeviceMemoryPriorityFeaturesEXT; - -typedef struct VkPhysicalDeviceMemoryProperties -{ - uint32_t memoryTypeCount; - VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; - uint32_t memoryHeapCount; - VkMemoryHeap WINE_VK_ALIGN(8) memoryHeaps[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryProperties; - -typedef struct VkPhysicalDeviceMemoryProperties2 -{ - VkStructureType sType; - void *pNext; - VkPhysicalDeviceMemoryProperties WINE_VK_ALIGN(8) memoryProperties; -} VkPhysicalDeviceMemoryProperties2; -typedef VkPhysicalDeviceMemoryProperties2 VkPhysicalDeviceMemoryProperties2KHR; - -typedef struct VkPhysicalDeviceMeshShaderFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 taskShader; - VkBool32 meshShader; - VkBool32 multiviewMeshShader; - VkBool32 primitiveFragmentShadingRateMeshShader; - VkBool32 meshShaderQueries; -} VkPhysicalDeviceMeshShaderFeaturesEXT; - -typedef struct VkPhysicalDeviceMeshShaderFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 taskShader; - VkBool32 meshShader; -} VkPhysicalDeviceMeshShaderFeaturesNV; - -typedef struct VkPhysicalDeviceMeshShaderPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxTaskWorkGroupTotalCount; - uint32_t maxTaskWorkGroupCount[3]; - uint32_t maxTaskWorkGroupInvocations; - uint32_t maxTaskWorkGroupSize[3]; - uint32_t maxTaskPayloadSize; - uint32_t maxTaskSharedMemorySize; - uint32_t maxTaskPayloadAndSharedMemorySize; - uint32_t maxMeshWorkGroupTotalCount; - uint32_t maxMeshWorkGroupCount[3]; - uint32_t maxMeshWorkGroupInvocations; - uint32_t maxMeshWorkGroupSize[3]; - uint32_t maxMeshSharedMemorySize; - uint32_t maxMeshPayloadAndSharedMemorySize; - uint32_t maxMeshOutputMemorySize; - uint32_t maxMeshPayloadAndOutputMemorySize; - uint32_t maxMeshOutputComponents; - uint32_t maxMeshOutputVertices; - uint32_t maxMeshOutputPrimitives; - uint32_t maxMeshOutputLayers; - uint32_t maxMeshMultiviewViewCount; - uint32_t meshOutputPerVertexGranularity; - uint32_t meshOutputPerPrimitiveGranularity; - uint32_t maxPreferredTaskWorkGroupInvocations; - uint32_t maxPreferredMeshWorkGroupInvocations; - VkBool32 prefersLocalInvocationVertexOutput; - VkBool32 prefersLocalInvocationPrimitiveOutput; - VkBool32 prefersCompactVertexOutput; - VkBool32 prefersCompactPrimitiveOutput; -} VkPhysicalDeviceMeshShaderPropertiesEXT; - -typedef struct VkPhysicalDeviceMeshShaderPropertiesNV -{ - VkStructureType sType; - void *pNext; - uint32_t maxDrawMeshTasksCount; - uint32_t maxTaskWorkGroupInvocations; - uint32_t maxTaskWorkGroupSize[3]; - uint32_t maxTaskTotalMemorySize; - uint32_t maxTaskOutputCount; - uint32_t maxMeshWorkGroupInvocations; - uint32_t maxMeshWorkGroupSize[3]; - uint32_t maxMeshTotalMemorySize; - uint32_t maxMeshOutputVertices; - uint32_t maxMeshOutputPrimitives; - uint32_t maxMeshMultiviewViewCount; - uint32_t meshOutputPerVertexGranularity; - uint32_t meshOutputPerPrimitiveGranularity; -} VkPhysicalDeviceMeshShaderPropertiesNV; - -typedef struct VkPhysicalDeviceMultiDrawFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 multiDraw; -} VkPhysicalDeviceMultiDrawFeaturesEXT; - -typedef struct VkPhysicalDeviceMultiDrawPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxMultiDrawCount; -} VkPhysicalDeviceMultiDrawPropertiesEXT; - -typedef struct VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 multisampledRenderToSingleSampled; -} VkPhysicalDeviceMultisampledRenderToSingleSampledFeaturesEXT; - -typedef struct VkPhysicalDeviceMultiviewFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 multiview; - VkBool32 multiviewGeometryShader; - VkBool32 multiviewTessellationShader; -} VkPhysicalDeviceMultiviewFeatures; -typedef VkPhysicalDeviceMultiviewFeatures VkPhysicalDeviceMultiviewFeaturesKHR; - -typedef struct VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 multiviewPerViewRenderAreas; -} VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM; - -typedef struct VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 multiviewPerViewViewports; -} VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM; - -typedef struct VkPhysicalDeviceMultiviewProperties -{ - VkStructureType sType; - void *pNext; - uint32_t maxMultiviewViewCount; - uint32_t maxMultiviewInstanceIndex; -} VkPhysicalDeviceMultiviewProperties; -typedef VkPhysicalDeviceMultiviewProperties VkPhysicalDeviceMultiviewPropertiesKHR; - -typedef struct VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 mutableDescriptorType; -} VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT; -typedef VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE; - -typedef struct VkPhysicalDeviceNestedCommandBufferFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 nestedCommandBuffer; - VkBool32 nestedCommandBufferRendering; - VkBool32 nestedCommandBufferSimultaneousUse; -} VkPhysicalDeviceNestedCommandBufferFeaturesEXT; - -typedef struct VkPhysicalDeviceNestedCommandBufferPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxCommandBufferNestingLevel; -} VkPhysicalDeviceNestedCommandBufferPropertiesEXT; - -typedef struct VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 nonSeamlessCubeMap; -} VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT; - -typedef struct VkPhysicalDeviceOpacityMicromapFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 micromap; - VkBool32 micromapCaptureReplay; - VkBool32 micromapHostCommands; -} VkPhysicalDeviceOpacityMicromapFeaturesEXT; - -typedef struct VkPhysicalDeviceOpacityMicromapPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxOpacity2StateSubdivisionLevel; - uint32_t maxOpacity4StateSubdivisionLevel; -} VkPhysicalDeviceOpacityMicromapPropertiesEXT; - -typedef struct VkPhysicalDeviceOpticalFlowFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 opticalFlow; -} VkPhysicalDeviceOpticalFlowFeaturesNV; - -typedef struct VkPhysicalDeviceOpticalFlowPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkOpticalFlowGridSizeFlagsNV supportedOutputGridSizes; - VkOpticalFlowGridSizeFlagsNV supportedHintGridSizes; - VkBool32 hintSupported; - VkBool32 costSupported; - VkBool32 bidirectionalFlowSupported; - VkBool32 globalFlowSupported; - uint32_t minWidth; - uint32_t minHeight; - uint32_t maxWidth; - uint32_t maxHeight; - uint32_t maxNumRegionsOfInterest; -} VkPhysicalDeviceOpticalFlowPropertiesNV; - -typedef struct VkPhysicalDevicePCIBusInfoPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t pciDomain; - uint32_t pciBus; - uint32_t pciDevice; - uint32_t pciFunction; -} VkPhysicalDevicePCIBusInfoPropertiesEXT; - -typedef struct VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 pageableDeviceLocalMemory; -} VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT; - -typedef struct VkPhysicalDevicePerformanceQueryFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 performanceCounterQueryPools; - VkBool32 performanceCounterMultipleQueryPools; -} VkPhysicalDevicePerformanceQueryFeaturesKHR; - -typedef struct VkPhysicalDevicePerformanceQueryPropertiesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 allowCommandBufferQueryCopies; -} VkPhysicalDevicePerformanceQueryPropertiesKHR; - -typedef struct VkPhysicalDevicePipelineCreationCacheControlFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelineCreationCacheControl; -} VkPhysicalDevicePipelineCreationCacheControlFeatures; -typedef VkPhysicalDevicePipelineCreationCacheControlFeatures VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT; - -typedef struct VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelineExecutableInfo; -} VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR; - -typedef struct VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelineLibraryGroupHandles; -} VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT; - -typedef struct VkPhysicalDevicePipelinePropertiesFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelinePropertiesIdentifier; -} VkPhysicalDevicePipelinePropertiesFeaturesEXT; - -typedef struct VkPhysicalDevicePipelineProtectedAccessFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelineProtectedAccess; -} VkPhysicalDevicePipelineProtectedAccessFeaturesEXT; - -typedef struct VkPhysicalDevicePipelineRobustnessFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 pipelineRobustness; -} VkPhysicalDevicePipelineRobustnessFeaturesEXT; - -typedef struct VkPhysicalDevicePipelineRobustnessPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessStorageBuffers; - VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessUniformBuffers; - VkPipelineRobustnessBufferBehaviorEXT defaultRobustnessVertexInputs; - VkPipelineRobustnessImageBehaviorEXT defaultRobustnessImages; -} VkPhysicalDevicePipelineRobustnessPropertiesEXT; - -typedef struct VkPhysicalDevicePointClippingProperties -{ - VkStructureType sType; - void *pNext; - VkPointClippingBehavior pointClippingBehavior; -} VkPhysicalDevicePointClippingProperties; -typedef VkPhysicalDevicePointClippingProperties VkPhysicalDevicePointClippingPropertiesKHR; - -typedef struct VkPhysicalDevicePresentBarrierFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 presentBarrier; -} VkPhysicalDevicePresentBarrierFeaturesNV; - -typedef struct VkPhysicalDevicePresentIdFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 presentId; -} VkPhysicalDevicePresentIdFeaturesKHR; - -typedef struct VkPhysicalDevicePresentWaitFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 presentWait; -} VkPhysicalDevicePresentWaitFeaturesKHR; - -typedef struct VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 primitiveTopologyListRestart; - VkBool32 primitiveTopologyPatchListRestart; -} VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT; - -typedef struct VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 primitivesGeneratedQuery; - VkBool32 primitivesGeneratedQueryWithRasterizerDiscard; - VkBool32 primitivesGeneratedQueryWithNonZeroStreams; -} VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT; - -typedef struct VkPhysicalDevicePrivateDataFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 privateData; -} VkPhysicalDevicePrivateDataFeatures; -typedef VkPhysicalDevicePrivateDataFeatures VkPhysicalDevicePrivateDataFeaturesEXT; - -typedef struct VkPhysicalDeviceProtectedMemoryFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 protectedMemory; -} VkPhysicalDeviceProtectedMemoryFeatures; - -typedef struct VkPhysicalDeviceProtectedMemoryProperties -{ - VkStructureType sType; - void *pNext; - VkBool32 protectedNoFault; -} VkPhysicalDeviceProtectedMemoryProperties; - -typedef struct VkPhysicalDeviceProvokingVertexFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 provokingVertexLast; - VkBool32 transformFeedbackPreservesProvokingVertex; -} VkPhysicalDeviceProvokingVertexFeaturesEXT; - -typedef struct VkPhysicalDeviceProvokingVertexPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 provokingVertexModePerPipeline; - VkBool32 transformFeedbackPreservesTriangleFanProvokingVertex; -} VkPhysicalDeviceProvokingVertexPropertiesEXT; - -typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR -{ - VkStructureType sType; - void *pNext; - uint32_t maxPushDescriptors; -} VkPhysicalDevicePushDescriptorPropertiesKHR; - -typedef struct VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 formatRgba10x6WithoutYCbCrSampler; -} VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT; - -typedef struct VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 rasterizationOrderColorAttachmentAccess; - VkBool32 rasterizationOrderDepthAttachmentAccess; - VkBool32 rasterizationOrderStencilAttachmentAccess; -} VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT; -typedef VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesARM; - -typedef struct VkPhysicalDeviceRayQueryFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 rayQuery; -} VkPhysicalDeviceRayQueryFeaturesKHR; - -typedef struct VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 rayTracingInvocationReorder; -} VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV; - -typedef struct VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkRayTracingInvocationReorderModeNV rayTracingInvocationReorderReorderingHint; -} VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV; - -typedef struct VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 rayTracingMaintenance1; - VkBool32 rayTracingPipelineTraceRaysIndirect2; -} VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR; - -typedef struct VkPhysicalDeviceRayTracingMotionBlurFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 rayTracingMotionBlur; - VkBool32 rayTracingMotionBlurPipelineTraceRaysIndirect; -} VkPhysicalDeviceRayTracingMotionBlurFeaturesNV; - -typedef struct VkPhysicalDeviceRayTracingPipelineFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 rayTracingPipeline; - VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplay; - VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - VkBool32 rayTracingPipelineTraceRaysIndirect; - VkBool32 rayTraversalPrimitiveCulling; -} VkPhysicalDeviceRayTracingPipelineFeaturesKHR; - -typedef struct VkPhysicalDeviceRayTracingPipelinePropertiesKHR -{ - VkStructureType sType; - void *pNext; - uint32_t shaderGroupHandleSize; - uint32_t maxRayRecursionDepth; - uint32_t maxShaderGroupStride; - uint32_t shaderGroupBaseAlignment; - uint32_t shaderGroupHandleCaptureReplaySize; - uint32_t maxRayDispatchInvocationCount; - uint32_t shaderGroupHandleAlignment; - uint32_t maxRayHitAttributeSize; -} VkPhysicalDeviceRayTracingPipelinePropertiesKHR; - -typedef struct VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 rayTracingPositionFetch; -} VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR; - -typedef struct VkPhysicalDeviceRayTracingPropertiesNV -{ - VkStructureType sType; - void *pNext; - uint32_t shaderGroupHandleSize; - uint32_t maxRecursionDepth; - uint32_t maxShaderGroupStride; - uint32_t shaderGroupBaseAlignment; - uint64_t WINE_VK_ALIGN(8) maxGeometryCount; - uint64_t WINE_VK_ALIGN(8) maxInstanceCount; - uint64_t WINE_VK_ALIGN(8) maxTriangleCount; - uint32_t maxDescriptorSetAccelerationStructures; -} VkPhysicalDeviceRayTracingPropertiesNV; - -typedef struct VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG -{ - VkStructureType sType; - void *pNext; - VkBool32 relaxedLineRasterization; -} VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG; - -typedef struct VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 representativeFragmentTest; -} VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV; - -typedef struct VkPhysicalDeviceRobustness2FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 robustBufferAccess2; - VkBool32 robustImageAccess2; - VkBool32 nullDescriptor; -} VkPhysicalDeviceRobustness2FeaturesEXT; - -typedef struct VkPhysicalDeviceRobustness2PropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) robustStorageBufferAccessSizeAlignment; - VkDeviceSize WINE_VK_ALIGN(8) robustUniformBufferAccessSizeAlignment; -} VkPhysicalDeviceRobustness2PropertiesEXT; - -typedef struct VkPhysicalDeviceSampleLocationsPropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkSampleCountFlags sampleLocationSampleCounts; - VkExtent2D maxSampleLocationGridSize; - float sampleLocationCoordinateRange[2]; - uint32_t sampleLocationSubPixelBits; - VkBool32 variableSampleLocations; -} VkPhysicalDeviceSampleLocationsPropertiesEXT; - -typedef struct VkPhysicalDeviceSamplerFilterMinmaxProperties -{ - VkStructureType sType; - void *pNext; - VkBool32 filterMinmaxSingleComponentFormats; - VkBool32 filterMinmaxImageComponentMapping; -} VkPhysicalDeviceSamplerFilterMinmaxProperties; -typedef VkPhysicalDeviceSamplerFilterMinmaxProperties VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; - -typedef struct VkPhysicalDeviceSamplerYcbcrConversionFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 samplerYcbcrConversion; -} VkPhysicalDeviceSamplerYcbcrConversionFeatures; -typedef VkPhysicalDeviceSamplerYcbcrConversionFeatures VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR; - -typedef struct VkPhysicalDeviceScalarBlockLayoutFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 scalarBlockLayout; -} VkPhysicalDeviceScalarBlockLayoutFeatures; -typedef VkPhysicalDeviceScalarBlockLayoutFeatures VkPhysicalDeviceScalarBlockLayoutFeaturesEXT; - -typedef struct VkPhysicalDeviceSchedulingControlsFeaturesARM -{ - VkStructureType sType; - void *pNext; - VkBool32 schedulingControls; -} VkPhysicalDeviceSchedulingControlsFeaturesARM; - -typedef struct VkPhysicalDeviceSchedulingControlsPropertiesARM -{ - VkStructureType sType; - void *pNext; - VkPhysicalDeviceSchedulingControlsFlagsARM WINE_VK_ALIGN(8) schedulingControlsFlags; -} VkPhysicalDeviceSchedulingControlsPropertiesARM; - -typedef struct VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 separateDepthStencilLayouts; -} VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures; -typedef VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR; - -typedef struct VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderBufferFloat16Atomics; - VkBool32 shaderBufferFloat16AtomicAdd; - VkBool32 shaderBufferFloat16AtomicMinMax; - VkBool32 shaderBufferFloat32AtomicMinMax; - VkBool32 shaderBufferFloat64AtomicMinMax; - VkBool32 shaderSharedFloat16Atomics; - VkBool32 shaderSharedFloat16AtomicAdd; - VkBool32 shaderSharedFloat16AtomicMinMax; - VkBool32 shaderSharedFloat32AtomicMinMax; - VkBool32 shaderSharedFloat64AtomicMinMax; - VkBool32 shaderImageFloat32AtomicMinMax; - VkBool32 sparseImageFloat32AtomicMinMax; -} VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT; - -typedef struct VkPhysicalDeviceShaderAtomicFloatFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderBufferFloat32Atomics; - VkBool32 shaderBufferFloat32AtomicAdd; - VkBool32 shaderBufferFloat64Atomics; - VkBool32 shaderBufferFloat64AtomicAdd; - VkBool32 shaderSharedFloat32Atomics; - VkBool32 shaderSharedFloat32AtomicAdd; - VkBool32 shaderSharedFloat64Atomics; - VkBool32 shaderSharedFloat64AtomicAdd; - VkBool32 shaderImageFloat32Atomics; - VkBool32 shaderImageFloat32AtomicAdd; - VkBool32 sparseImageFloat32Atomics; - VkBool32 sparseImageFloat32AtomicAdd; -} VkPhysicalDeviceShaderAtomicFloatFeaturesEXT; - -typedef struct VkPhysicalDeviceShaderAtomicInt64Features -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderBufferInt64Atomics; - VkBool32 shaderSharedInt64Atomics; -} VkPhysicalDeviceShaderAtomicInt64Features; -typedef VkPhysicalDeviceShaderAtomicInt64Features VkPhysicalDeviceShaderAtomicInt64FeaturesKHR; - -typedef struct VkPhysicalDeviceShaderClockFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderSubgroupClock; - VkBool32 shaderDeviceClock; -} VkPhysicalDeviceShaderClockFeaturesKHR; - -typedef struct VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderCoreBuiltins; -} VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM; - -typedef struct VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM -{ - VkStructureType sType; - void *pNext; - uint64_t WINE_VK_ALIGN(8) shaderCoreMask; - uint32_t shaderCoreCount; - uint32_t shaderWarpsPerCore; -} VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM; - -typedef struct VkPhysicalDeviceShaderCoreProperties2AMD -{ - VkStructureType sType; - void *pNext; - VkShaderCorePropertiesFlagsAMD shaderCoreFeatures; - uint32_t activeComputeUnitCount; -} VkPhysicalDeviceShaderCoreProperties2AMD; - -typedef struct VkPhysicalDeviceShaderCorePropertiesAMD -{ - VkStructureType sType; - void *pNext; - uint32_t shaderEngineCount; - uint32_t shaderArraysPerEngineCount; - uint32_t computeUnitsPerShaderArray; - uint32_t simdPerComputeUnit; - uint32_t wavefrontsPerSimd; - uint32_t wavefrontSize; - uint32_t sgprsPerSimd; - uint32_t minSgprAllocation; - uint32_t maxSgprAllocation; - uint32_t sgprAllocationGranularity; - uint32_t vgprsPerSimd; - uint32_t minVgprAllocation; - uint32_t maxVgprAllocation; - uint32_t vgprAllocationGranularity; -} VkPhysicalDeviceShaderCorePropertiesAMD; - -typedef struct VkPhysicalDeviceShaderCorePropertiesARM -{ - VkStructureType sType; - void *pNext; - uint32_t pixelRate; - uint32_t texelRate; - uint32_t fmaRate; -} VkPhysicalDeviceShaderCorePropertiesARM; - -typedef struct VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderDemoteToHelperInvocation; -} VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures; -typedef VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT; - - -typedef struct VkPhysicalDeviceShaderDrawParametersFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderDrawParameters; -} VkPhysicalDeviceShaderDrawParametersFeatures; -typedef VkPhysicalDeviceShaderDrawParametersFeatures VkPhysicalDeviceShaderDrawParameterFeatures; - -typedef struct VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderEarlyAndLateFragmentTests; -} VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD; - -typedef struct VkPhysicalDeviceShaderFloat16Int8Features -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderFloat16; - VkBool32 shaderInt8; -} VkPhysicalDeviceShaderFloat16Int8Features; -typedef VkPhysicalDeviceShaderFloat16Int8Features VkPhysicalDeviceShaderFloat16Int8FeaturesKHR; -typedef VkPhysicalDeviceShaderFloat16Int8Features VkPhysicalDeviceFloat16Int8FeaturesKHR; - -typedef struct VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderImageInt64Atomics; - VkBool32 sparseImageInt64Atomics; -} VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT; - -typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 imageFootprint; -} VkPhysicalDeviceShaderImageFootprintFeaturesNV; - -typedef struct VkPhysicalDeviceShaderIntegerDotProductFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderIntegerDotProduct; -} VkPhysicalDeviceShaderIntegerDotProductFeatures; -typedef VkPhysicalDeviceShaderIntegerDotProductFeatures VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR; - -typedef struct VkPhysicalDeviceShaderIntegerDotProductProperties -{ - VkStructureType sType; - void *pNext; - VkBool32 integerDotProduct8BitUnsignedAccelerated; - VkBool32 integerDotProduct8BitSignedAccelerated; - VkBool32 integerDotProduct8BitMixedSignednessAccelerated; - VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProduct16BitUnsignedAccelerated; - VkBool32 integerDotProduct16BitSignedAccelerated; - VkBool32 integerDotProduct16BitMixedSignednessAccelerated; - VkBool32 integerDotProduct32BitUnsignedAccelerated; - VkBool32 integerDotProduct32BitSignedAccelerated; - VkBool32 integerDotProduct32BitMixedSignednessAccelerated; - VkBool32 integerDotProduct64BitUnsignedAccelerated; - VkBool32 integerDotProduct64BitSignedAccelerated; - VkBool32 integerDotProduct64BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; -} VkPhysicalDeviceShaderIntegerDotProductProperties; -typedef VkPhysicalDeviceShaderIntegerDotProductProperties VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR; - -typedef struct VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderIntegerFunctions2; -} VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL; - -typedef struct VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderModuleIdentifier; -} VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT; - -typedef struct VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint8_t shaderModuleIdentifierAlgorithmUUID[VK_UUID_SIZE]; -} VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT; - -typedef struct VkPhysicalDeviceShaderObjectFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderObject; -} VkPhysicalDeviceShaderObjectFeaturesEXT; - -typedef struct VkPhysicalDeviceShaderObjectPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint8_t shaderBinaryUUID[VK_UUID_SIZE]; - uint32_t shaderBinaryVersion; -} VkPhysicalDeviceShaderObjectPropertiesEXT; - -typedef struct VkPhysicalDeviceShaderSMBuiltinsFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderSMBuiltins; -} VkPhysicalDeviceShaderSMBuiltinsFeaturesNV; - -typedef struct VkPhysicalDeviceShaderSMBuiltinsPropertiesNV -{ - VkStructureType sType; - void *pNext; - uint32_t shaderSMCount; - uint32_t shaderWarpsPerSM; -} VkPhysicalDeviceShaderSMBuiltinsPropertiesNV; - -typedef struct VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderSubgroupExtendedTypes; -} VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures; -typedef VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR; - -typedef struct VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderSubgroupUniformControlFlow; -} VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR; - -typedef struct VkPhysicalDeviceShaderTerminateInvocationFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderTerminateInvocation; -} VkPhysicalDeviceShaderTerminateInvocationFeatures; -typedef VkPhysicalDeviceShaderTerminateInvocationFeatures VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR; - -typedef struct VkPhysicalDeviceShaderTileImageFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderTileImageColorReadAccess; - VkBool32 shaderTileImageDepthReadAccess; - VkBool32 shaderTileImageStencilReadAccess; -} VkPhysicalDeviceShaderTileImageFeaturesEXT; - -typedef struct VkPhysicalDeviceShaderTileImagePropertiesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderTileImageCoherentReadAccelerated; - VkBool32 shaderTileImageReadSampleFromPixelRateInvocation; - VkBool32 shaderTileImageReadFromHelperInvocation; -} VkPhysicalDeviceShaderTileImagePropertiesEXT; - -typedef struct VkPhysicalDeviceShadingRateImageFeaturesNV -{ - VkStructureType sType; - void *pNext; - VkBool32 shadingRateImage; - VkBool32 shadingRateCoarseSampleOrder; -} VkPhysicalDeviceShadingRateImageFeaturesNV; - -typedef struct VkPhysicalDeviceShadingRateImagePropertiesNV -{ - VkStructureType sType; - void *pNext; - VkExtent2D shadingRateTexelSize; - uint32_t shadingRatePaletteSize; - uint32_t shadingRateMaxCoarseSamples; -} VkPhysicalDeviceShadingRateImagePropertiesNV; - -typedef struct VkPhysicalDeviceSparseImageFormatInfo2 -{ - VkStructureType sType; - const void *pNext; - VkFormat format; - VkImageType type; - VkSampleCountFlagBits samples; - VkImageUsageFlags usage; - VkImageTiling tiling; -} VkPhysicalDeviceSparseImageFormatInfo2; -typedef VkPhysicalDeviceSparseImageFormatInfo2 VkPhysicalDeviceSparseImageFormatInfo2KHR; - -typedef struct VkPhysicalDeviceSparseProperties -{ - VkBool32 residencyStandard2DBlockShape; - VkBool32 residencyStandard2DMultisampleBlockShape; - VkBool32 residencyStandard3DBlockShape; - VkBool32 residencyAlignedMipSize; - VkBool32 residencyNonResidentStrict; -} VkPhysicalDeviceSparseProperties; - -typedef struct VkPhysicalDeviceSubgroupProperties -{ - VkStructureType sType; - void *pNext; - uint32_t subgroupSize; - VkShaderStageFlags supportedStages; - VkSubgroupFeatureFlags supportedOperations; - VkBool32 quadOperationsInAllStages; -} VkPhysicalDeviceSubgroupProperties; - -typedef struct VkPhysicalDeviceSubgroupSizeControlFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 subgroupSizeControl; - VkBool32 computeFullSubgroups; -} VkPhysicalDeviceSubgroupSizeControlFeatures; -typedef VkPhysicalDeviceSubgroupSizeControlFeatures VkPhysicalDeviceSubgroupSizeControlFeaturesEXT; - -typedef struct VkPhysicalDeviceSubgroupSizeControlProperties -{ - VkStructureType sType; - void *pNext; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; - uint32_t maxComputeWorkgroupSubgroups; - VkShaderStageFlags requiredSubgroupSizeStages; -} VkPhysicalDeviceSubgroupSizeControlProperties; -typedef VkPhysicalDeviceSubgroupSizeControlProperties VkPhysicalDeviceSubgroupSizeControlPropertiesEXT; - -typedef struct VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 subpassMergeFeedback; -} VkPhysicalDeviceSubpassMergeFeedbackFeaturesEXT; - -typedef struct VkPhysicalDeviceSubpassShadingFeaturesHUAWEI -{ - VkStructureType sType; - void *pNext; - VkBool32 subpassShading; -} VkPhysicalDeviceSubpassShadingFeaturesHUAWEI; - -typedef struct VkPhysicalDeviceSubpassShadingPropertiesHUAWEI -{ - VkStructureType sType; - void *pNext; - uint32_t maxSubpassShadingWorkgroupSizeAspectRatio; -} VkPhysicalDeviceSubpassShadingPropertiesHUAWEI; - -typedef struct VkPhysicalDeviceSurfaceInfo2KHR -{ - VkStructureType sType; - const void *pNext; - VkSurfaceKHR WINE_VK_ALIGN(8) surface; -} VkPhysicalDeviceSurfaceInfo2KHR; - -typedef struct VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 swapchainMaintenance1; -} VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT; - -typedef struct VkPhysicalDeviceSynchronization2Features -{ - VkStructureType sType; - void *pNext; - VkBool32 synchronization2; -} VkPhysicalDeviceSynchronization2Features; -typedef VkPhysicalDeviceSynchronization2Features VkPhysicalDeviceSynchronization2FeaturesKHR; - -typedef struct VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 texelBufferAlignment; -} VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT; - -typedef struct VkPhysicalDeviceTexelBufferAlignmentProperties -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) storageTexelBufferOffsetAlignmentBytes; - VkBool32 storageTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize WINE_VK_ALIGN(8) uniformTexelBufferOffsetAlignmentBytes; - VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; -} VkPhysicalDeviceTexelBufferAlignmentProperties; -typedef VkPhysicalDeviceTexelBufferAlignmentProperties VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT; - -typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 textureCompressionASTC_HDR; -} VkPhysicalDeviceTextureCompressionASTCHDRFeatures; -typedef VkPhysicalDeviceTextureCompressionASTCHDRFeatures VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT; - -typedef struct VkPhysicalDeviceTilePropertiesFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 tileProperties; -} VkPhysicalDeviceTilePropertiesFeaturesQCOM; - -typedef struct VkPhysicalDeviceTimelineSemaphoreFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 timelineSemaphore; -} VkPhysicalDeviceTimelineSemaphoreFeatures; -typedef VkPhysicalDeviceTimelineSemaphoreFeatures VkPhysicalDeviceTimelineSemaphoreFeaturesKHR; - -typedef struct VkPhysicalDeviceTimelineSemaphoreProperties -{ - VkStructureType sType; - void *pNext; - uint64_t WINE_VK_ALIGN(8) maxTimelineSemaphoreValueDifference; -} VkPhysicalDeviceTimelineSemaphoreProperties; -typedef VkPhysicalDeviceTimelineSemaphoreProperties VkPhysicalDeviceTimelineSemaphorePropertiesKHR; - -typedef struct VkPhysicalDeviceToolProperties -{ - VkStructureType sType; - void *pNext; - char name[VK_MAX_EXTENSION_NAME_SIZE]; - char version[VK_MAX_EXTENSION_NAME_SIZE]; - VkToolPurposeFlags purposes; - char description[VK_MAX_DESCRIPTION_SIZE]; - char layer[VK_MAX_EXTENSION_NAME_SIZE]; -} VkPhysicalDeviceToolProperties; -typedef VkPhysicalDeviceToolProperties VkPhysicalDeviceToolPropertiesEXT; - -typedef struct VkPhysicalDeviceTransformFeedbackFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 transformFeedback; - VkBool32 geometryStreams; -} VkPhysicalDeviceTransformFeedbackFeaturesEXT; - -typedef struct VkPhysicalDeviceTransformFeedbackPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxTransformFeedbackStreams; - uint32_t maxTransformFeedbackBuffers; - VkDeviceSize WINE_VK_ALIGN(8) maxTransformFeedbackBufferSize; - uint32_t maxTransformFeedbackStreamDataSize; - uint32_t maxTransformFeedbackBufferDataSize; - uint32_t maxTransformFeedbackBufferDataStride; - VkBool32 transformFeedbackQueries; - VkBool32 transformFeedbackStreamsLinesTriangles; - VkBool32 transformFeedbackRasterizationStreamSelect; - VkBool32 transformFeedbackDraw; -} VkPhysicalDeviceTransformFeedbackPropertiesEXT; - -typedef struct VkPhysicalDeviceUniformBufferStandardLayoutFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 uniformBufferStandardLayout; -} VkPhysicalDeviceUniformBufferStandardLayoutFeatures; -typedef VkPhysicalDeviceUniformBufferStandardLayoutFeatures VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR; - - -typedef struct VkPhysicalDeviceVariablePointersFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 variablePointersStorageBuffer; - VkBool32 variablePointers; -} VkPhysicalDeviceVariablePointersFeatures; -typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointersFeaturesKHR; -typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointerFeaturesKHR; -typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointerFeatures; - -typedef struct VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 vertexAttributeInstanceRateDivisor; - VkBool32 vertexAttributeInstanceRateZeroDivisor; -} VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT; - -typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT -{ - VkStructureType sType; - void *pNext; - uint32_t maxVertexAttribDivisor; -} VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT; - -typedef struct VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 vertexInputDynamicState; -} VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT; - -typedef struct VkPhysicalDeviceVulkan11Features -{ - VkStructureType sType; - void *pNext; - VkBool32 storageBuffer16BitAccess; - VkBool32 uniformAndStorageBuffer16BitAccess; - VkBool32 storagePushConstant16; - VkBool32 storageInputOutput16; - VkBool32 multiview; - VkBool32 multiviewGeometryShader; - VkBool32 multiviewTessellationShader; - VkBool32 variablePointersStorageBuffer; - VkBool32 variablePointers; - VkBool32 protectedMemory; - VkBool32 samplerYcbcrConversion; - VkBool32 shaderDrawParameters; -} VkPhysicalDeviceVulkan11Features; - -typedef struct VkPhysicalDeviceVulkan11Properties -{ - VkStructureType sType; - void *pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; - uint32_t subgroupSize; - VkShaderStageFlags subgroupSupportedStages; - VkSubgroupFeatureFlags subgroupSupportedOperations; - VkBool32 subgroupQuadOperationsInAllStages; - VkPointClippingBehavior pointClippingBehavior; - uint32_t maxMultiviewViewCount; - uint32_t maxMultiviewInstanceIndex; - VkBool32 protectedNoFault; - uint32_t maxPerSetDescriptors; - VkDeviceSize WINE_VK_ALIGN(8) maxMemoryAllocationSize; -} VkPhysicalDeviceVulkan11Properties; - -typedef struct VkPhysicalDeviceVulkan12Features -{ - VkStructureType sType; - void *pNext; - VkBool32 samplerMirrorClampToEdge; - VkBool32 drawIndirectCount; - VkBool32 storageBuffer8BitAccess; - VkBool32 uniformAndStorageBuffer8BitAccess; - VkBool32 storagePushConstant8; - VkBool32 shaderBufferInt64Atomics; - VkBool32 shaderSharedInt64Atomics; - VkBool32 shaderFloat16; - VkBool32 shaderInt8; - VkBool32 descriptorIndexing; - VkBool32 shaderInputAttachmentArrayDynamicIndexing; - VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; - VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; - VkBool32 shaderUniformBufferArrayNonUniformIndexing; - VkBool32 shaderSampledImageArrayNonUniformIndexing; - VkBool32 shaderStorageBufferArrayNonUniformIndexing; - VkBool32 shaderStorageImageArrayNonUniformIndexing; - VkBool32 shaderInputAttachmentArrayNonUniformIndexing; - VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; - VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; - VkBool32 descriptorBindingUniformBufferUpdateAfterBind; - VkBool32 descriptorBindingSampledImageUpdateAfterBind; - VkBool32 descriptorBindingStorageImageUpdateAfterBind; - VkBool32 descriptorBindingStorageBufferUpdateAfterBind; - VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingUpdateUnusedWhilePending; - VkBool32 descriptorBindingPartiallyBound; - VkBool32 descriptorBindingVariableDescriptorCount; - VkBool32 runtimeDescriptorArray; - VkBool32 samplerFilterMinmax; - VkBool32 scalarBlockLayout; - VkBool32 imagelessFramebuffer; - VkBool32 uniformBufferStandardLayout; - VkBool32 shaderSubgroupExtendedTypes; - VkBool32 separateDepthStencilLayouts; - VkBool32 hostQueryReset; - VkBool32 timelineSemaphore; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; - VkBool32 vulkanMemoryModel; - VkBool32 vulkanMemoryModelDeviceScope; - VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; - VkBool32 shaderOutputViewportIndex; - VkBool32 shaderOutputLayer; - VkBool32 subgroupBroadcastDynamicId; -} VkPhysicalDeviceVulkan12Features; - -typedef struct VkPhysicalDeviceVulkan12Properties -{ - VkStructureType sType; - void *pNext; - VkDriverId driverID; - char driverName[VK_MAX_DRIVER_NAME_SIZE]; - char driverInfo[VK_MAX_DRIVER_INFO_SIZE]; - VkConformanceVersion conformanceVersion; - VkShaderFloatControlsIndependence denormBehaviorIndependence; - VkShaderFloatControlsIndependence roundingModeIndependence; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; - uint32_t maxUpdateAfterBindDescriptorsInAllPools; - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; - VkBool32 shaderSampledImageArrayNonUniformIndexingNative; - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; - VkBool32 shaderStorageImageArrayNonUniformIndexingNative; - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; - VkBool32 robustBufferAccessUpdateAfterBind; - VkBool32 quadDivergentImplicitLod; - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; - uint32_t maxPerStageUpdateAfterBindResources; - uint32_t maxDescriptorSetUpdateAfterBindSamplers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindSampledImages; - uint32_t maxDescriptorSetUpdateAfterBindStorageImages; - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; - VkResolveModeFlags supportedDepthResolveModes; - VkResolveModeFlags supportedStencilResolveModes; - VkBool32 independentResolveNone; - VkBool32 independentResolve; - VkBool32 filterMinmaxSingleComponentFormats; - VkBool32 filterMinmaxImageComponentMapping; - uint64_t WINE_VK_ALIGN(8) maxTimelineSemaphoreValueDifference; - VkSampleCountFlags framebufferIntegerColorSampleCounts; -} VkPhysicalDeviceVulkan12Properties; - -typedef struct VkPhysicalDeviceVulkan13Features -{ - VkStructureType sType; - void *pNext; - VkBool32 robustImageAccess; - VkBool32 inlineUniformBlock; - VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; - VkBool32 pipelineCreationCacheControl; - VkBool32 privateData; - VkBool32 shaderDemoteToHelperInvocation; - VkBool32 shaderTerminateInvocation; - VkBool32 subgroupSizeControl; - VkBool32 computeFullSubgroups; - VkBool32 synchronization2; - VkBool32 textureCompressionASTC_HDR; - VkBool32 shaderZeroInitializeWorkgroupMemory; - VkBool32 dynamicRendering; - VkBool32 shaderIntegerDotProduct; - VkBool32 maintenance4; -} VkPhysicalDeviceVulkan13Features; - -typedef struct VkPhysicalDeviceVulkan13Properties -{ - VkStructureType sType; - void *pNext; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; - uint32_t maxComputeWorkgroupSubgroups; - VkShaderStageFlags requiredSubgroupSizeStages; - uint32_t maxInlineUniformBlockSize; - uint32_t maxPerStageDescriptorInlineUniformBlocks; - uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - uint32_t maxDescriptorSetInlineUniformBlocks; - uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; - uint32_t maxInlineUniformTotalSize; - VkBool32 integerDotProduct8BitUnsignedAccelerated; - VkBool32 integerDotProduct8BitSignedAccelerated; - VkBool32 integerDotProduct8BitMixedSignednessAccelerated; - VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; - VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProduct16BitUnsignedAccelerated; - VkBool32 integerDotProduct16BitSignedAccelerated; - VkBool32 integerDotProduct16BitMixedSignednessAccelerated; - VkBool32 integerDotProduct32BitUnsignedAccelerated; - VkBool32 integerDotProduct32BitSignedAccelerated; - VkBool32 integerDotProduct32BitMixedSignednessAccelerated; - VkBool32 integerDotProduct64BitUnsignedAccelerated; - VkBool32 integerDotProduct64BitSignedAccelerated; - VkBool32 integerDotProduct64BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; - VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; - VkDeviceSize WINE_VK_ALIGN(8) storageTexelBufferOffsetAlignmentBytes; - VkBool32 storageTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize WINE_VK_ALIGN(8) uniformTexelBufferOffsetAlignmentBytes; - VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize WINE_VK_ALIGN(8) maxBufferSize; -} VkPhysicalDeviceVulkan13Properties; - -typedef struct VkPhysicalDeviceVulkanMemoryModelFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 vulkanMemoryModel; - VkBool32 vulkanMemoryModelDeviceScope; - VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; -} VkPhysicalDeviceVulkanMemoryModelFeatures; -typedef VkPhysicalDeviceVulkanMemoryModelFeatures VkPhysicalDeviceVulkanMemoryModelFeaturesKHR; - -typedef struct VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR -{ - VkStructureType sType; - void *pNext; - VkBool32 workgroupMemoryExplicitLayout; - VkBool32 workgroupMemoryExplicitLayoutScalarBlockLayout; - VkBool32 workgroupMemoryExplicitLayout8BitAccess; - VkBool32 workgroupMemoryExplicitLayout16BitAccess; -} VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR; - -typedef struct VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 ycbcr2plane444Formats; -} VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT; - -typedef struct VkPhysicalDeviceYcbcrDegammaFeaturesQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 ycbcrDegamma; -} VkPhysicalDeviceYcbcrDegammaFeaturesQCOM; - -typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 ycbcrImageArrays; -} VkPhysicalDeviceYcbcrImageArraysFeaturesEXT; - -typedef struct VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures -{ - VkStructureType sType; - void *pNext; - VkBool32 shaderZeroInitializeWorkgroupMemory; -} VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures; -typedef VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR; - -typedef struct VkPipelineCacheCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineCacheCreateFlags flags; - size_t initialDataSize; - const void *pInitialData; -} VkPipelineCacheCreateInfo; - -typedef struct VkPipelineCacheHeaderVersionOne -{ - uint32_t headerSize; - VkPipelineCacheHeaderVersion headerVersion; - uint32_t vendorID; - uint32_t deviceID; - uint8_t pipelineCacheUUID[VK_UUID_SIZE]; -} VkPipelineCacheHeaderVersionOne; - -typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 srcPremultiplied; - VkBool32 dstPremultiplied; - VkBlendOverlapEXT blendOverlap; -} VkPipelineColorBlendAdvancedStateCreateInfoEXT; - -typedef struct VkPipelineColorBlendAttachmentState -{ - VkBool32 blendEnable; - VkBlendFactor srcColorBlendFactor; - VkBlendFactor dstColorBlendFactor; - VkBlendOp colorBlendOp; - VkBlendFactor srcAlphaBlendFactor; - VkBlendFactor dstAlphaBlendFactor; - VkBlendOp alphaBlendOp; - VkColorComponentFlags colorWriteMask; -} VkPipelineColorBlendAttachmentState; - -typedef struct VkPipelineColorBlendStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineColorBlendStateCreateFlags flags; - VkBool32 logicOpEnable; - VkLogicOp logicOp; - uint32_t attachmentCount; - const VkPipelineColorBlendAttachmentState *pAttachments; - float blendConstants[4]; -} VkPipelineColorBlendStateCreateInfo; - -typedef struct VkPipelineColorWriteCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t attachmentCount; - const VkBool32 *pColorWriteEnables; -} VkPipelineColorWriteCreateInfoEXT; - -typedef struct VkPipelineCompilerControlCreateInfoAMD -{ - VkStructureType sType; - const void *pNext; - VkPipelineCompilerControlFlagsAMD compilerControlFlags; -} VkPipelineCompilerControlCreateInfoAMD; - -typedef struct VkPipelineCoverageModulationStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineCoverageModulationStateCreateFlagsNV flags; - VkCoverageModulationModeNV coverageModulationMode; - VkBool32 coverageModulationTableEnable; - uint32_t coverageModulationTableCount; - const float *pCoverageModulationTable; -} VkPipelineCoverageModulationStateCreateInfoNV; - -typedef struct VkPipelineCoverageReductionStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineCoverageReductionStateCreateFlagsNV flags; - VkCoverageReductionModeNV coverageReductionMode; -} VkPipelineCoverageReductionStateCreateInfoNV; - -typedef struct VkPipelineCoverageToColorStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineCoverageToColorStateCreateFlagsNV flags; - VkBool32 coverageToColorEnable; - uint32_t coverageToColorLocation; -} VkPipelineCoverageToColorStateCreateInfoNV; - -typedef struct VkPipelineCreateFlags2CreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkPipelineCreateFlags2KHR WINE_VK_ALIGN(8) flags; -} VkPipelineCreateFlags2CreateInfoKHR; - -typedef struct VkPipelineCreationFeedback -{ - VkPipelineCreationFeedbackFlags flags; - uint64_t WINE_VK_ALIGN(8) duration; -} VkPipelineCreationFeedback; -typedef VkPipelineCreationFeedback VkPipelineCreationFeedbackEXT; - -typedef struct VkPipelineCreationFeedbackCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineCreationFeedback *pPipelineCreationFeedback; - uint32_t pipelineStageCreationFeedbackCount; - VkPipelineCreationFeedback *pPipelineStageCreationFeedbacks; -} VkPipelineCreationFeedbackCreateInfo; -typedef VkPipelineCreationFeedbackCreateInfo VkPipelineCreationFeedbackCreateInfoEXT; - -typedef struct VkPipelineDynamicStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineDynamicStateCreateFlags flags; - uint32_t dynamicStateCount; - const VkDynamicState *pDynamicStates; -} VkPipelineDynamicStateCreateInfo; - -typedef struct VkPipelineExecutableInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkPipeline WINE_VK_ALIGN(8) pipeline; - uint32_t executableIndex; -} VkPipelineExecutableInfoKHR; - -typedef struct VkPipelineExecutableInternalRepresentationKHR -{ - VkStructureType sType; - void *pNext; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkBool32 isText; - size_t dataSize; - void *pData; -} VkPipelineExecutableInternalRepresentationKHR; - -typedef struct VkPipelineExecutablePropertiesKHR -{ - VkStructureType sType; - void *pNext; - VkShaderStageFlags stages; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - uint32_t subgroupSize; -} VkPipelineExecutablePropertiesKHR; - -typedef union VkPipelineExecutableStatisticValueKHR -{ - VkBool32 b32; - int64_t i64; - uint64_t WINE_VK_ALIGN(8) u64; - double f64; -} VkPipelineExecutableStatisticValueKHR; - -typedef struct VkPipelineFragmentShadingRateEnumStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkFragmentShadingRateTypeNV shadingRateType; - VkFragmentShadingRateNV shadingRate; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateEnumStateCreateInfoNV; - -typedef struct VkPipelineFragmentShadingRateStateCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkExtent2D fragmentSize; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateStateCreateInfoKHR; - -typedef struct VkPipelineIndirectDeviceAddressInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline WINE_VK_ALIGN(8) pipeline; -} VkPipelineIndirectDeviceAddressInfoNV; - - -typedef struct VkPipelineInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkPipeline WINE_VK_ALIGN(8) pipeline; -} VkPipelineInfoKHR; -typedef VkPipelineInfoKHR VkPipelineInfoEXT; - -typedef struct VkPipelineInputAssemblyStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineInputAssemblyStateCreateFlags flags; - VkPrimitiveTopology topology; - VkBool32 primitiveRestartEnable; -} VkPipelineInputAssemblyStateCreateInfo; - -typedef struct VkPipelineLibraryCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t libraryCount; - const VkPipeline *pLibraries; -} VkPipelineLibraryCreateInfoKHR; - -typedef struct VkPipelineMultisampleStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineMultisampleStateCreateFlags flags; - VkSampleCountFlagBits rasterizationSamples; - VkBool32 sampleShadingEnable; - float minSampleShading; - const VkSampleMask *pSampleMask; - VkBool32 alphaToCoverageEnable; - VkBool32 alphaToOneEnable; -} VkPipelineMultisampleStateCreateInfo; - -typedef struct VkPipelinePropertiesIdentifierEXT -{ - VkStructureType sType; - void *pNext; - uint8_t pipelineIdentifier[VK_UUID_SIZE]; -} VkPipelinePropertiesIdentifierEXT; - -typedef struct VkPipelineRasterizationConservativeStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkPipelineRasterizationConservativeStateCreateFlagsEXT flags; - VkConservativeRasterizationModeEXT conservativeRasterizationMode; - float extraPrimitiveOverestimationSize; -} VkPipelineRasterizationConservativeStateCreateInfoEXT; - -typedef struct VkPipelineRasterizationDepthClipStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkPipelineRasterizationDepthClipStateCreateFlagsEXT flags; - VkBool32 depthClipEnable; -} VkPipelineRasterizationDepthClipStateCreateInfoEXT; - -typedef struct VkPipelineRasterizationLineStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkLineRasterizationModeEXT lineRasterizationMode; - VkBool32 stippledLineEnable; - uint32_t lineStippleFactor; - uint16_t lineStipplePattern; -} VkPipelineRasterizationLineStateCreateInfoEXT; - -typedef struct VkPipelineRasterizationProvokingVertexStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkProvokingVertexModeEXT provokingVertexMode; -} VkPipelineRasterizationProvokingVertexStateCreateInfoEXT; - -typedef struct VkPipelineRasterizationStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineRasterizationStateCreateFlags flags; - VkBool32 depthClampEnable; - VkBool32 rasterizerDiscardEnable; - VkPolygonMode polygonMode; - VkCullModeFlags cullMode; - VkFrontFace frontFace; - VkBool32 depthBiasEnable; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; - float lineWidth; -} VkPipelineRasterizationStateCreateInfo; - -typedef struct VkPipelineRasterizationStateRasterizationOrderAMD -{ - VkStructureType sType; - const void *pNext; - VkRasterizationOrderAMD rasterizationOrder; -} VkPipelineRasterizationStateRasterizationOrderAMD; - -typedef struct VkPipelineRasterizationStateStreamCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkPipelineRasterizationStateStreamCreateFlagsEXT flags; - uint32_t rasterizationStream; -} VkPipelineRasterizationStateStreamCreateInfoEXT; - -typedef struct VkPipelineRenderingCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t viewMask; - uint32_t colorAttachmentCount; - const VkFormat *pColorAttachmentFormats; - VkFormat depthAttachmentFormat; - VkFormat stencilAttachmentFormat; -} VkPipelineRenderingCreateInfo; -typedef VkPipelineRenderingCreateInfo VkPipelineRenderingCreateInfoKHR; - -typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 representativeFragmentTestEnable; -} VkPipelineRepresentativeFragmentTestStateCreateInfoNV; - -typedef struct VkPipelineRobustnessCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkPipelineRobustnessBufferBehaviorEXT storageBuffers; - VkPipelineRobustnessBufferBehaviorEXT uniformBuffers; - VkPipelineRobustnessBufferBehaviorEXT vertexInputs; - VkPipelineRobustnessImageBehaviorEXT images; -} VkPipelineRobustnessCreateInfoEXT; - -typedef struct VkPipelineShaderStageModuleIdentifierCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t identifierSize; - const uint8_t *pIdentifier; -} VkPipelineShaderStageModuleIdentifierCreateInfoEXT; - -typedef struct VkPipelineShaderStageRequiredSubgroupSizeCreateInfo -{ - VkStructureType sType; - void *pNext; - uint32_t requiredSubgroupSize; -} VkPipelineShaderStageRequiredSubgroupSizeCreateInfo; -typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT; -typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo VkShaderRequiredSubgroupSizeCreateInfoEXT; - -typedef struct VkPipelineTessellationDomainOriginStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkTessellationDomainOrigin domainOrigin; -} VkPipelineTessellationDomainOriginStateCreateInfo; -typedef VkPipelineTessellationDomainOriginStateCreateInfo VkPipelineTessellationDomainOriginStateCreateInfoKHR; - -typedef struct VkPipelineTessellationStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineTessellationStateCreateFlags flags; - uint32_t patchControlPoints; -} VkPipelineTessellationStateCreateInfo; - -typedef struct VkPipelineViewportCoarseSampleOrderStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkCoarseSampleOrderTypeNV sampleOrderType; - uint32_t customSampleOrderCount; - const VkCoarseSampleOrderCustomNV *pCustomSampleOrders; -} VkPipelineViewportCoarseSampleOrderStateCreateInfoNV; - -typedef struct VkPipelineViewportDepthClipControlCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 negativeOneToOne; -} VkPipelineViewportDepthClipControlCreateInfoEXT; - -typedef struct VkPresentIdKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t swapchainCount; - const uint64_t *pPresentIds; -} VkPresentIdKHR; - -typedef struct VkPresentInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore *pWaitSemaphores; - uint32_t swapchainCount; - const VkSwapchainKHR *pSwapchains; - const uint32_t *pImageIndices; - VkResult *pResults; -} VkPresentInfoKHR; - -typedef struct VkPrivateDataSlotCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPrivateDataSlotCreateFlags flags; -} VkPrivateDataSlotCreateInfo; -typedef VkPrivateDataSlotCreateInfo VkPrivateDataSlotCreateInfoEXT; - -typedef struct VkProtectedSubmitInfo -{ - VkStructureType sType; - const void *pNext; - VkBool32 protectedSubmit; -} VkProtectedSubmitInfo; - -typedef struct VkPushConstantRange -{ - VkShaderStageFlags stageFlags; - uint32_t offset; - uint32_t size; -} VkPushConstantRange; - -typedef struct VkQueryLowLatencySupportNV -{ - VkStructureType sType; - const void *pNext; - void *pQueriedLowLatencyData; -} VkQueryLowLatencySupportNV; - -typedef struct VkQueryPoolCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkQueryPoolCreateFlags flags; - VkQueryType queryType; - uint32_t queryCount; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkQueryPoolCreateInfo; - -typedef struct VkQueryPoolPerformanceCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t queueFamilyIndex; - uint32_t counterIndexCount; - const uint32_t *pCounterIndices; -} VkQueryPoolPerformanceCreateInfoKHR; - -typedef struct VkQueryPoolPerformanceQueryCreateInfoINTEL -{ - VkStructureType sType; - const void *pNext; - VkQueryPoolSamplingModeINTEL performanceCountersSampling; -} VkQueryPoolPerformanceQueryCreateInfoINTEL; -typedef VkQueryPoolPerformanceQueryCreateInfoINTEL VkQueryPoolCreateInfoINTEL; - -typedef struct VkQueueFamilyCheckpointProperties2NV -{ - VkStructureType sType; - void *pNext; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) checkpointExecutionStageMask; -} VkQueueFamilyCheckpointProperties2NV; - -typedef struct VkQueueFamilyCheckpointPropertiesNV -{ - VkStructureType sType; - void *pNext; - VkPipelineStageFlags checkpointExecutionStageMask; -} VkQueueFamilyCheckpointPropertiesNV; - -typedef struct VkQueueFamilyGlobalPriorityPropertiesKHR -{ - VkStructureType sType; - void *pNext; - uint32_t priorityCount; - VkQueueGlobalPriorityKHR priorities[VK_MAX_GLOBAL_PRIORITY_SIZE_KHR]; -} VkQueueFamilyGlobalPriorityPropertiesKHR; -typedef VkQueueFamilyGlobalPriorityPropertiesKHR VkQueueFamilyGlobalPriorityPropertiesEXT; - -typedef struct VkQueueFamilyProperties -{ - VkQueueFlags queueFlags; - uint32_t queueCount; - uint32_t timestampValidBits; - VkExtent3D minImageTransferGranularity; -} VkQueueFamilyProperties; - -typedef struct VkQueueFamilyProperties2 -{ - VkStructureType sType; - void *pNext; - VkQueueFamilyProperties queueFamilyProperties; -} VkQueueFamilyProperties2; -typedef VkQueueFamilyProperties2 VkQueueFamilyProperties2KHR; - -typedef struct VkRayTracingPipelineInterfaceCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t maxPipelineRayPayloadSize; - uint32_t maxPipelineRayHitAttributeSize; -} VkRayTracingPipelineInterfaceCreateInfoKHR; - -typedef struct VkRayTracingShaderGroupCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkRayTracingShaderGroupTypeKHR type; - uint32_t generalShader; - uint32_t closestHitShader; - uint32_t anyHitShader; - uint32_t intersectionShader; - const void *pShaderGroupCaptureReplayHandle; -} VkRayTracingShaderGroupCreateInfoKHR; - -typedef struct VkRayTracingShaderGroupCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkRayTracingShaderGroupTypeKHR type; - uint32_t generalShader; - uint32_t closestHitShader; - uint32_t anyHitShader; - uint32_t intersectionShader; -} VkRayTracingShaderGroupCreateInfoNV; - -typedef struct VkRect2D -{ - VkOffset2D offset; - VkExtent2D extent; -} VkRect2D; - -typedef struct VkRectLayerKHR -{ - VkOffset2D offset; - VkExtent2D extent; - uint32_t layer; -} VkRectLayerKHR; - -typedef struct VkReleaseSwapchainImagesInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkSwapchainKHR WINE_VK_ALIGN(8) swapchain; - uint32_t imageIndexCount; - const uint32_t *pImageIndices; -} VkReleaseSwapchainImagesInfoEXT; - -typedef struct VkRenderPassAttachmentBeginInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t attachmentCount; - const VkImageView *pAttachments; -} VkRenderPassAttachmentBeginInfo; -typedef VkRenderPassAttachmentBeginInfo VkRenderPassAttachmentBeginInfoKHR; - -typedef struct VkRenderPassBeginInfo -{ - VkStructureType sType; - const void *pNext; - VkRenderPass WINE_VK_ALIGN(8) renderPass; - VkFramebuffer WINE_VK_ALIGN(8) framebuffer; - VkRect2D renderArea; - uint32_t clearValueCount; - const VkClearValue *pClearValues; -} VkRenderPassBeginInfo; - -typedef struct VkRenderPassCreationControlEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 disallowMerging; -} VkRenderPassCreationControlEXT; - -typedef struct VkRenderPassCreationFeedbackInfoEXT -{ - uint32_t postMergeSubpassCount; -} VkRenderPassCreationFeedbackInfoEXT; - -typedef struct VkRenderPassFragmentDensityMapCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkAttachmentReference fragmentDensityMapAttachment; -} VkRenderPassFragmentDensityMapCreateInfoEXT; - -typedef struct VkRenderPassInputAttachmentAspectCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t aspectReferenceCount; - const VkInputAttachmentAspectReference *pAspectReferences; -} VkRenderPassInputAttachmentAspectCreateInfo; -typedef VkRenderPassInputAttachmentAspectCreateInfo VkRenderPassInputAttachmentAspectCreateInfoKHR; - -typedef struct VkRenderPassMultiviewCreateInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t subpassCount; - const uint32_t *pViewMasks; - uint32_t dependencyCount; - const int32_t *pViewOffsets; - uint32_t correlationMaskCount; - const uint32_t *pCorrelationMasks; -} VkRenderPassMultiviewCreateInfo; -typedef VkRenderPassMultiviewCreateInfo VkRenderPassMultiviewCreateInfoKHR; - -typedef struct VkRenderPassSubpassFeedbackInfoEXT -{ - VkSubpassMergeStatusEXT subpassMergeStatus; - char description[VK_MAX_DESCRIPTION_SIZE]; - uint32_t postMergeIndex; -} VkRenderPassSubpassFeedbackInfoEXT; - -typedef struct VkRenderPassTransformBeginInfoQCOM -{ - VkStructureType sType; - void *pNext; - VkSurfaceTransformFlagBitsKHR transform; -} VkRenderPassTransformBeginInfoQCOM; - -typedef struct VkRenderingAreaInfoKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t viewMask; - uint32_t colorAttachmentCount; - const VkFormat *pColorAttachmentFormats; - VkFormat depthAttachmentFormat; - VkFormat stencilAttachmentFormat; -} VkRenderingAreaInfoKHR; - -typedef struct VkRenderingAttachmentInfo -{ - VkStructureType sType; - const void *pNext; - VkImageView WINE_VK_ALIGN(8) imageView; - VkImageLayout imageLayout; - VkResolveModeFlagBits resolveMode; - VkImageView WINE_VK_ALIGN(8) resolveImageView; - VkImageLayout resolveImageLayout; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkClearValue clearValue; -} VkRenderingAttachmentInfo; -typedef VkRenderingAttachmentInfo VkRenderingAttachmentInfoKHR; - -typedef struct VkRenderingFragmentDensityMapAttachmentInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkImageView WINE_VK_ALIGN(8) imageView; - VkImageLayout imageLayout; -} VkRenderingFragmentDensityMapAttachmentInfoEXT; - -typedef struct VkRenderingFragmentShadingRateAttachmentInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkImageView WINE_VK_ALIGN(8) imageView; - VkImageLayout imageLayout; - VkExtent2D shadingRateAttachmentTexelSize; -} VkRenderingFragmentShadingRateAttachmentInfoKHR; - -typedef struct VkRenderingInfo -{ - VkStructureType sType; - const void *pNext; - VkRenderingFlags flags; - VkRect2D renderArea; - uint32_t layerCount; - uint32_t viewMask; - uint32_t colorAttachmentCount; - const VkRenderingAttachmentInfo *pColorAttachments; - const VkRenderingAttachmentInfo *pDepthAttachment; - const VkRenderingAttachmentInfo *pStencilAttachment; -} VkRenderingInfo; -typedef VkRenderingInfo VkRenderingInfoKHR; - -typedef struct VkSRTDataNV -{ - float sx; - float a; - float b; - float pvx; - float sy; - float c; - float pvy; - float sz; - float pvz; - float qx; - float qy; - float qz; - float qw; - float tx; - float ty; - float tz; -} VkSRTDataNV; - -typedef struct VkSampleLocationEXT -{ - float x; - float y; -} VkSampleLocationEXT; - -typedef struct VkSampleLocationsInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkSampleCountFlagBits sampleLocationsPerPixel; - VkExtent2D sampleLocationGridSize; - uint32_t sampleLocationsCount; - const VkSampleLocationEXT *pSampleLocations; -} VkSampleLocationsInfoEXT; - -typedef struct VkSamplerBlockMatchWindowCreateInfoQCOM -{ - VkStructureType sType; - const void *pNext; - VkExtent2D windowExtent; - VkBlockMatchWindowCompareModeQCOM windowCompareMode; -} VkSamplerBlockMatchWindowCreateInfoQCOM; - -typedef struct VkSamplerBorderColorComponentMappingCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkComponentMapping components; - VkBool32 srgb; -} VkSamplerBorderColorComponentMappingCreateInfoEXT; - -typedef struct VkSamplerCaptureDescriptorDataInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkSampler WINE_VK_ALIGN(8) sampler; -} VkSamplerCaptureDescriptorDataInfoEXT; - -typedef struct VkSamplerCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkSamplerCreateFlags flags; - VkFilter magFilter; - VkFilter minFilter; - VkSamplerMipmapMode mipmapMode; - VkSamplerAddressMode addressModeU; - VkSamplerAddressMode addressModeV; - VkSamplerAddressMode addressModeW; - float mipLodBias; - VkBool32 anisotropyEnable; - float maxAnisotropy; - VkBool32 compareEnable; - VkCompareOp compareOp; - float minLod; - float maxLod; - VkBorderColor borderColor; - VkBool32 unnormalizedCoordinates; -} VkSamplerCreateInfo; - -typedef struct VkSamplerCubicWeightsCreateInfoQCOM -{ - VkStructureType sType; - const void *pNext; - VkCubicFilterWeightsQCOM cubicWeights; -} VkSamplerCubicWeightsCreateInfoQCOM; - -typedef struct VkSamplerCustomBorderColorCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkClearColorValue customBorderColor; - VkFormat format; -} VkSamplerCustomBorderColorCreateInfoEXT; - -typedef struct VkSamplerReductionModeCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkSamplerReductionMode reductionMode; -} VkSamplerReductionModeCreateInfo; -typedef VkSamplerReductionModeCreateInfo VkSamplerReductionModeCreateInfoEXT; - -typedef struct VkSamplerYcbcrConversionCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkFormat format; - VkSamplerYcbcrModelConversion ycbcrModel; - VkSamplerYcbcrRange ycbcrRange; - VkComponentMapping components; - VkChromaLocation xChromaOffset; - VkChromaLocation yChromaOffset; - VkFilter chromaFilter; - VkBool32 forceExplicitReconstruction; -} VkSamplerYcbcrConversionCreateInfo; -typedef VkSamplerYcbcrConversionCreateInfo VkSamplerYcbcrConversionCreateInfoKHR; - -typedef struct VkSamplerYcbcrConversionImageFormatProperties -{ - VkStructureType sType; - void *pNext; - uint32_t combinedImageSamplerDescriptorCount; -} VkSamplerYcbcrConversionImageFormatProperties; -typedef VkSamplerYcbcrConversionImageFormatProperties VkSamplerYcbcrConversionImageFormatPropertiesKHR; - -typedef struct VkSamplerYcbcrConversionInfo -{ - VkStructureType sType; - const void *pNext; - VkSamplerYcbcrConversion WINE_VK_ALIGN(8) conversion; -} VkSamplerYcbcrConversionInfo; -typedef VkSamplerYcbcrConversionInfo VkSamplerYcbcrConversionInfoKHR; - -typedef struct VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM -{ - VkStructureType sType; - void *pNext; - VkBool32 enableYDegamma; - VkBool32 enableCbCrDegamma; -} VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM; - -typedef struct VkSemaphoreCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkSemaphoreCreateFlags flags; -} VkSemaphoreCreateInfo; - -typedef struct VkSemaphoreSignalInfo -{ - VkStructureType sType; - const void *pNext; - VkSemaphore WINE_VK_ALIGN(8) semaphore; - uint64_t WINE_VK_ALIGN(8) value; -} VkSemaphoreSignalInfo; -typedef VkSemaphoreSignalInfo VkSemaphoreSignalInfoKHR; - -typedef struct VkSemaphoreSubmitInfo -{ - VkStructureType sType; - const void *pNext; - VkSemaphore WINE_VK_ALIGN(8) semaphore; - uint64_t WINE_VK_ALIGN(8) value; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) stageMask; - uint32_t deviceIndex; -} VkSemaphoreSubmitInfo; -typedef VkSemaphoreSubmitInfo VkSemaphoreSubmitInfoKHR; - -typedef struct VkSemaphoreTypeCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkSemaphoreType semaphoreType; - uint64_t WINE_VK_ALIGN(8) initialValue; -} VkSemaphoreTypeCreateInfo; -typedef VkSemaphoreTypeCreateInfo VkSemaphoreTypeCreateInfoKHR; - -typedef struct VkSemaphoreWaitInfo -{ - VkStructureType sType; - const void *pNext; - VkSemaphoreWaitFlags flags; - uint32_t semaphoreCount; - const VkSemaphore *pSemaphores; - const uint64_t *pValues; -} VkSemaphoreWaitInfo; -typedef VkSemaphoreWaitInfo VkSemaphoreWaitInfoKHR; - -typedef struct VkSetLatencyMarkerInfoNV -{ - VkStructureType sType; - const void *pNext; - uint64_t WINE_VK_ALIGN(8) presentID; - VkLatencyMarkerNV marker; -} VkSetLatencyMarkerInfoNV; - -typedef struct VkSetStateFlagsIndirectCommandNV -{ - uint32_t data; -} VkSetStateFlagsIndirectCommandNV; - -typedef struct VkShaderModuleCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkShaderModuleCreateFlags flags; - size_t codeSize; - const uint32_t *pCode; -} VkShaderModuleCreateInfo; - -typedef struct VkShaderModuleIdentifierEXT -{ - VkStructureType sType; - void *pNext; - uint32_t identifierSize; - uint8_t identifier[VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT]; -} VkShaderModuleIdentifierEXT; - -typedef struct VkShaderModuleValidationCacheCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkValidationCacheEXT WINE_VK_ALIGN(8) validationCache; -} VkShaderModuleValidationCacheCreateInfoEXT; - -typedef struct VkShaderResourceUsageAMD -{ - uint32_t numUsedVgprs; - uint32_t numUsedSgprs; - uint32_t ldsSizePerLocalWorkGroup; - size_t ldsUsageSizeInBytes; - size_t scratchMemUsageInBytes; -} VkShaderResourceUsageAMD; - -typedef struct VkShaderStatisticsInfoAMD -{ - VkShaderStageFlags shaderStageMask; - VkShaderResourceUsageAMD resourceUsage; - uint32_t numPhysicalVgprs; - uint32_t numPhysicalSgprs; - uint32_t numAvailableVgprs; - uint32_t numAvailableSgprs; - uint32_t computeWorkGroupSize[3]; -} VkShaderStatisticsInfoAMD; - -typedef struct VkShadingRatePaletteNV -{ - uint32_t shadingRatePaletteEntryCount; - const VkShadingRatePaletteEntryNV *pShadingRatePaletteEntries; -} VkShadingRatePaletteNV; - -typedef struct VkSparseImageFormatProperties -{ - VkImageAspectFlags aspectMask; - VkExtent3D imageGranularity; - VkSparseImageFormatFlags flags; -} VkSparseImageFormatProperties; - -typedef struct VkSparseImageFormatProperties2 -{ - VkStructureType sType; - void *pNext; - VkSparseImageFormatProperties properties; -} VkSparseImageFormatProperties2; -typedef VkSparseImageFormatProperties2 VkSparseImageFormatProperties2KHR; - -typedef struct VkSparseImageMemoryBind -{ - VkImageSubresource subresource; - VkOffset3D offset; - VkExtent3D extent; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) memoryOffset; - VkSparseMemoryBindFlags flags; -} VkSparseImageMemoryBind; - -typedef struct VkSparseImageMemoryBindInfo -{ - VkImage WINE_VK_ALIGN(8) image; - uint32_t bindCount; - const VkSparseImageMemoryBind *pBinds; -} VkSparseImageMemoryBindInfo; - -typedef struct VkSparseImageMemoryRequirements -{ - VkSparseImageFormatProperties formatProperties; - uint32_t imageMipTailFirstLod; - VkDeviceSize WINE_VK_ALIGN(8) imageMipTailSize; - VkDeviceSize WINE_VK_ALIGN(8) imageMipTailOffset; - VkDeviceSize WINE_VK_ALIGN(8) imageMipTailStride; -} VkSparseImageMemoryRequirements; - -typedef struct VkSparseImageMemoryRequirements2 -{ - VkStructureType sType; - void *pNext; - VkSparseImageMemoryRequirements WINE_VK_ALIGN(8) memoryRequirements; -} VkSparseImageMemoryRequirements2; -typedef VkSparseImageMemoryRequirements2 VkSparseImageMemoryRequirements2KHR; - -typedef struct VkSparseMemoryBind -{ - VkDeviceSize WINE_VK_ALIGN(8) resourceOffset; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkDeviceMemory WINE_VK_ALIGN(8) memory; - VkDeviceSize WINE_VK_ALIGN(8) memoryOffset; - VkSparseMemoryBindFlags flags; -} VkSparseMemoryBind; - -typedef struct VkSpecializationMapEntry -{ - uint32_t constantID; - uint32_t offset; - size_t size; -} VkSpecializationMapEntry; - -typedef struct VkStencilOpState -{ - VkStencilOp failOp; - VkStencilOp passOp; - VkStencilOp depthFailOp; - VkCompareOp compareOp; - uint32_t compareMask; - uint32_t writeMask; - uint32_t reference; -} VkStencilOpState; - -typedef struct VkStridedDeviceAddressRegionKHR -{ - VkDeviceAddress WINE_VK_ALIGN(8) deviceAddress; - VkDeviceSize WINE_VK_ALIGN(8) stride; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkStridedDeviceAddressRegionKHR; - -typedef struct VkSubmitInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore *pWaitSemaphores; - const VkPipelineStageFlags *pWaitDstStageMask; - uint32_t commandBufferCount; - const VkCommandBuffer *pCommandBuffers; - uint32_t signalSemaphoreCount; - const VkSemaphore *pSignalSemaphores; -} VkSubmitInfo; - -typedef struct VkSubmitInfo2 -{ - VkStructureType sType; - const void *pNext; - VkSubmitFlags flags; - uint32_t waitSemaphoreInfoCount; - const VkSemaphoreSubmitInfo *pWaitSemaphoreInfos; - uint32_t commandBufferInfoCount; - const VkCommandBufferSubmitInfo *pCommandBufferInfos; - uint32_t signalSemaphoreInfoCount; - const VkSemaphoreSubmitInfo *pSignalSemaphoreInfos; -} VkSubmitInfo2; -typedef VkSubmitInfo2 VkSubmitInfo2KHR; - -typedef struct VkSubpassBeginInfo -{ - VkStructureType sType; - const void *pNext; - VkSubpassContents contents; -} VkSubpassBeginInfo; -typedef VkSubpassBeginInfo VkSubpassBeginInfoKHR; - -typedef struct VkSubpassDependency -{ - uint32_t srcSubpass; - uint32_t dstSubpass; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkDependencyFlags dependencyFlags; -} VkSubpassDependency; - -typedef struct VkSubpassDependency2 -{ - VkStructureType sType; - const void *pNext; - uint32_t srcSubpass; - uint32_t dstSubpass; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkDependencyFlags dependencyFlags; - int32_t viewOffset; -} VkSubpassDependency2; -typedef VkSubpassDependency2 VkSubpassDependency2KHR; - -typedef struct VkSubpassDescription -{ - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t inputAttachmentCount; - const VkAttachmentReference *pInputAttachments; - uint32_t colorAttachmentCount; - const VkAttachmentReference *pColorAttachments; - const VkAttachmentReference *pResolveAttachments; - const VkAttachmentReference *pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - const uint32_t *pPreserveAttachments; -} VkSubpassDescription; - -typedef struct VkSubpassDescription2 -{ - VkStructureType sType; - const void *pNext; - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t viewMask; - uint32_t inputAttachmentCount; - const VkAttachmentReference2 *pInputAttachments; - uint32_t colorAttachmentCount; - const VkAttachmentReference2 *pColorAttachments; - const VkAttachmentReference2 *pResolveAttachments; - const VkAttachmentReference2 *pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - const uint32_t *pPreserveAttachments; -} VkSubpassDescription2; -typedef VkSubpassDescription2 VkSubpassDescription2KHR; - -typedef struct VkSubpassDescriptionDepthStencilResolve -{ - VkStructureType sType; - const void *pNext; - VkResolveModeFlagBits depthResolveMode; - VkResolveModeFlagBits stencilResolveMode; - const VkAttachmentReference2 *pDepthStencilResolveAttachment; -} VkSubpassDescriptionDepthStencilResolve; -typedef VkSubpassDescriptionDepthStencilResolve VkSubpassDescriptionDepthStencilResolveKHR; - -typedef struct VkSubpassEndInfo -{ - VkStructureType sType; - const void *pNext; -} VkSubpassEndInfo; -typedef VkSubpassEndInfo VkSubpassEndInfoKHR; - -typedef struct VkSubpassFragmentDensityMapOffsetEndInfoQCOM -{ - VkStructureType sType; - const void *pNext; - uint32_t fragmentDensityOffsetCount; - const VkOffset2D *pFragmentDensityOffsets; -} VkSubpassFragmentDensityMapOffsetEndInfoQCOM; - -typedef struct VkSubpassResolvePerformanceQueryEXT -{ - VkStructureType sType; - void *pNext; - VkBool32 optimal; -} VkSubpassResolvePerformanceQueryEXT; - -typedef struct VkSubpassSampleLocationsEXT -{ - uint32_t subpassIndex; - VkSampleLocationsInfoEXT sampleLocationsInfo; -} VkSubpassSampleLocationsEXT; - -typedef struct VkSubpassShadingPipelineCreateInfoHUAWEI -{ - VkStructureType sType; - void *pNext; - VkRenderPass WINE_VK_ALIGN(8) renderPass; - uint32_t subpass; -} VkSubpassShadingPipelineCreateInfoHUAWEI; - -typedef struct VkSubresourceHostMemcpySizeEXT -{ - VkStructureType sType; - void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) size; -} VkSubresourceHostMemcpySizeEXT; - -typedef struct VkSubresourceLayout -{ - VkDeviceSize WINE_VK_ALIGN(8) offset; - VkDeviceSize WINE_VK_ALIGN(8) size; - VkDeviceSize WINE_VK_ALIGN(8) rowPitch; - VkDeviceSize WINE_VK_ALIGN(8) arrayPitch; - VkDeviceSize WINE_VK_ALIGN(8) depthPitch; -} VkSubresourceLayout; - -typedef struct VkSubresourceLayout2KHR -{ - VkStructureType sType; - void *pNext; - VkSubresourceLayout WINE_VK_ALIGN(8) subresourceLayout; -} VkSubresourceLayout2KHR; -typedef VkSubresourceLayout2KHR VkSubresourceLayout2EXT; - -typedef struct VkSurfaceCapabilitiesKHR -{ - uint32_t minImageCount; - uint32_t maxImageCount; - VkExtent2D currentExtent; - VkExtent2D minImageExtent; - VkExtent2D maxImageExtent; - uint32_t maxImageArrayLayers; - VkSurfaceTransformFlagsKHR supportedTransforms; - VkSurfaceTransformFlagBitsKHR currentTransform; - VkCompositeAlphaFlagsKHR supportedCompositeAlpha; - VkImageUsageFlags supportedUsageFlags; -} VkSurfaceCapabilitiesKHR; - -typedef struct VkSurfaceCapabilitiesPresentBarrierNV -{ - VkStructureType sType; - void *pNext; - VkBool32 presentBarrierSupported; -} VkSurfaceCapabilitiesPresentBarrierNV; - -typedef struct VkSurfaceFormatKHR -{ - VkFormat format; - VkColorSpaceKHR colorSpace; -} VkSurfaceFormatKHR; - -typedef struct VkSurfacePresentModeCompatibilityEXT -{ - VkStructureType sType; - void *pNext; - uint32_t presentModeCount; - VkPresentModeKHR *pPresentModes; -} VkSurfacePresentModeCompatibilityEXT; - -typedef struct VkSurfacePresentModeEXT -{ - VkStructureType sType; - void *pNext; - VkPresentModeKHR presentMode; -} VkSurfacePresentModeEXT; - -typedef struct VkSurfacePresentScalingCapabilitiesEXT -{ - VkStructureType sType; - void *pNext; - VkPresentScalingFlagsEXT supportedPresentScaling; - VkPresentGravityFlagsEXT supportedPresentGravityX; - VkPresentGravityFlagsEXT supportedPresentGravityY; - VkExtent2D minScaledImageExtent; - VkExtent2D maxScaledImageExtent; -} VkSurfacePresentScalingCapabilitiesEXT; - -typedef struct VkSwapchainCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkSwapchainCreateFlagsKHR flags; - VkSurfaceKHR WINE_VK_ALIGN(8) surface; - uint32_t minImageCount; - VkFormat imageFormat; - VkColorSpaceKHR imageColorSpace; - VkExtent2D imageExtent; - uint32_t imageArrayLayers; - VkImageUsageFlags imageUsage; - VkSharingMode imageSharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t *pQueueFamilyIndices; - VkSurfaceTransformFlagBitsKHR preTransform; - VkCompositeAlphaFlagBitsKHR compositeAlpha; - VkPresentModeKHR presentMode; - VkBool32 clipped; - VkSwapchainKHR WINE_VK_ALIGN(8) oldSwapchain; -} VkSwapchainCreateInfoKHR; - -typedef struct VkSwapchainLatencyCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 latencyModeEnable; -} VkSwapchainLatencyCreateInfoNV; - -typedef struct VkSwapchainPresentBarrierCreateInfoNV -{ - VkStructureType sType; - void *pNext; - VkBool32 presentBarrierEnable; -} VkSwapchainPresentBarrierCreateInfoNV; - -typedef struct VkSwapchainPresentFenceInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t swapchainCount; - const VkFence *pFences; -} VkSwapchainPresentFenceInfoEXT; - -typedef struct VkSwapchainPresentModeInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t swapchainCount; - const VkPresentModeKHR *pPresentModes; -} VkSwapchainPresentModeInfoEXT; - -typedef struct VkSwapchainPresentModesCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t presentModeCount; - const VkPresentModeKHR *pPresentModes; -} VkSwapchainPresentModesCreateInfoEXT; - -typedef struct VkSwapchainPresentScalingCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkPresentScalingFlagsEXT scalingBehavior; - VkPresentGravityFlagsEXT presentGravityX; - VkPresentGravityFlagsEXT presentGravityY; -} VkSwapchainPresentScalingCreateInfoEXT; - -typedef struct VkTextureLODGatherFormatPropertiesAMD -{ - VkStructureType sType; - void *pNext; - VkBool32 supportsTextureGatherLODBiasAMD; -} VkTextureLODGatherFormatPropertiesAMD; - -typedef struct VkTilePropertiesQCOM -{ - VkStructureType sType; - void *pNext; - VkExtent3D tileSize; - VkExtent2D apronSize; - VkOffset2D origin; -} VkTilePropertiesQCOM; - -typedef struct VkTimelineSemaphoreSubmitInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t waitSemaphoreValueCount; - const uint64_t *pWaitSemaphoreValues; - uint32_t signalSemaphoreValueCount; - const uint64_t *pSignalSemaphoreValues; -} VkTimelineSemaphoreSubmitInfo; -typedef VkTimelineSemaphoreSubmitInfo VkTimelineSemaphoreSubmitInfoKHR; - -typedef struct VkTraceRaysIndirectCommand2KHR -{ - VkDeviceAddress WINE_VK_ALIGN(8) raygenShaderRecordAddress; - VkDeviceSize WINE_VK_ALIGN(8) raygenShaderRecordSize; - VkDeviceAddress WINE_VK_ALIGN(8) missShaderBindingTableAddress; - VkDeviceSize WINE_VK_ALIGN(8) missShaderBindingTableSize; - VkDeviceSize WINE_VK_ALIGN(8) missShaderBindingTableStride; - VkDeviceAddress WINE_VK_ALIGN(8) hitShaderBindingTableAddress; - VkDeviceSize WINE_VK_ALIGN(8) hitShaderBindingTableSize; - VkDeviceSize WINE_VK_ALIGN(8) hitShaderBindingTableStride; - VkDeviceAddress WINE_VK_ALIGN(8) callableShaderBindingTableAddress; - VkDeviceSize WINE_VK_ALIGN(8) callableShaderBindingTableSize; - VkDeviceSize WINE_VK_ALIGN(8) callableShaderBindingTableStride; - uint32_t width; - uint32_t height; - uint32_t depth; -} VkTraceRaysIndirectCommand2KHR; - -typedef struct VkTraceRaysIndirectCommandKHR -{ - uint32_t width; - uint32_t height; - uint32_t depth; -} VkTraceRaysIndirectCommandKHR; - -typedef struct VkTransformMatrixKHR -{ - float matrix[3][4]; -} VkTransformMatrixKHR; -typedef VkTransformMatrixKHR VkTransformMatrixNV; - -typedef struct VkValidationCacheCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkValidationCacheCreateFlagsEXT flags; - size_t initialDataSize; - const void *pInitialData; -} VkValidationCacheCreateInfoEXT; - -typedef struct VkValidationFeaturesEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t enabledValidationFeatureCount; - const VkValidationFeatureEnableEXT *pEnabledValidationFeatures; - uint32_t disabledValidationFeatureCount; - const VkValidationFeatureDisableEXT *pDisabledValidationFeatures; -} VkValidationFeaturesEXT; - -typedef struct VkValidationFlagsEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t disabledValidationCheckCount; - const VkValidationCheckEXT *pDisabledValidationChecks; -} VkValidationFlagsEXT; - -typedef struct VkVertexInputAttributeDescription -{ - uint32_t location; - uint32_t binding; - VkFormat format; - uint32_t offset; -} VkVertexInputAttributeDescription; - -typedef struct VkVertexInputAttributeDescription2EXT -{ - VkStructureType sType; - void *pNext; - uint32_t location; - uint32_t binding; - VkFormat format; - uint32_t offset; -} VkVertexInputAttributeDescription2EXT; - -typedef struct VkVertexInputBindingDescription -{ - uint32_t binding; - uint32_t stride; - VkVertexInputRate inputRate; -} VkVertexInputBindingDescription; - -typedef struct VkVertexInputBindingDescription2EXT -{ - VkStructureType sType; - void *pNext; - uint32_t binding; - uint32_t stride; - VkVertexInputRate inputRate; - uint32_t divisor; -} VkVertexInputBindingDescription2EXT; - -typedef struct VkVertexInputBindingDivisorDescriptionEXT -{ - uint32_t binding; - uint32_t divisor; -} VkVertexInputBindingDivisorDescriptionEXT; - -typedef struct VkViewport -{ - float x; - float y; - float width; - float height; - float minDepth; - float maxDepth; -} VkViewport; - -typedef struct VkViewportSwizzleNV -{ - VkViewportCoordinateSwizzleNV x; - VkViewportCoordinateSwizzleNV y; - VkViewportCoordinateSwizzleNV z; - VkViewportCoordinateSwizzleNV w; -} VkViewportSwizzleNV; - -typedef struct VkViewportWScalingNV -{ - float xcoeff; - float ycoeff; -} VkViewportWScalingNV; - -typedef struct VkWin32SurfaceCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkWin32SurfaceCreateFlagsKHR flags; - HINSTANCE hinstance; - HWND hwnd; -} VkWin32SurfaceCreateInfoKHR; - -typedef struct VkWriteDescriptorSet -{ - VkStructureType sType; - const void *pNext; - VkDescriptorSet WINE_VK_ALIGN(8) dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - const VkDescriptorImageInfo *pImageInfo; - const VkDescriptorBufferInfo *pBufferInfo; - const VkBufferView *pTexelBufferView; -} VkWriteDescriptorSet; - -typedef struct VkWriteDescriptorSetAccelerationStructureKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t accelerationStructureCount; - const VkAccelerationStructureKHR *pAccelerationStructures; -} VkWriteDescriptorSetAccelerationStructureKHR; - -typedef struct VkWriteDescriptorSetAccelerationStructureNV -{ - VkStructureType sType; - const void *pNext; - uint32_t accelerationStructureCount; - const VkAccelerationStructureNV *pAccelerationStructures; -} VkWriteDescriptorSetAccelerationStructureNV; - -typedef struct VkWriteDescriptorSetInlineUniformBlock -{ - VkStructureType sType; - const void *pNext; - uint32_t dataSize; - const void *pData; -} VkWriteDescriptorSetInlineUniformBlock; -typedef VkWriteDescriptorSetInlineUniformBlock VkWriteDescriptorSetInlineUniformBlockEXT; - -typedef struct VkXYColorEXT -{ - float x; - float y; -} VkXYColorEXT; - -typedef struct VkAccelerationStructureGeometryAabbsDataKHR -{ - VkStructureType sType; - const void *pNext; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) data; - VkDeviceSize WINE_VK_ALIGN(8) stride; -} VkAccelerationStructureGeometryAabbsDataKHR; - -typedef struct VkAccelerationStructureGeometryInstancesDataKHR -{ - VkStructureType sType; - const void *pNext; - VkBool32 arrayOfPointers; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) data; -} VkAccelerationStructureGeometryInstancesDataKHR; - -typedef struct VkAccelerationStructureGeometryMotionTrianglesDataNV -{ - VkStructureType sType; - const void *pNext; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) vertexData; -} VkAccelerationStructureGeometryMotionTrianglesDataNV; - -typedef struct VkAccelerationStructureGeometryTrianglesDataKHR -{ - VkStructureType sType; - const void *pNext; - VkFormat vertexFormat; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) vertexData; - VkDeviceSize WINE_VK_ALIGN(8) vertexStride; - uint32_t maxVertex; - VkIndexType indexType; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) indexData; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) transformData; -} VkAccelerationStructureGeometryTrianglesDataKHR; - -typedef struct VkAccelerationStructureInstanceKHR -{ - VkTransformMatrixKHR transform; - 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; - -typedef struct VkAccelerationStructureMatrixMotionInstanceNV -{ - VkTransformMatrixKHR transformT0; - VkTransformMatrixKHR transformT1; - uint32_t instanceCustomIndex:24; - uint32_t mask:8; - uint32_t instanceShaderBindingTableRecordOffset:24; - VkGeometryInstanceFlagsKHR flags:8; - uint64_t WINE_VK_ALIGN(8) accelerationStructureReference; -} VkAccelerationStructureMatrixMotionInstanceNV; - -typedef struct VkAccelerationStructureSRTMotionInstanceNV -{ - VkSRTDataNV transformT0; - VkSRTDataNV transformT1; - uint32_t instanceCustomIndex:24; - uint32_t mask:8; - uint32_t instanceShaderBindingTableRecordOffset:24; - VkGeometryInstanceFlagsKHR flags:8; - uint64_t WINE_VK_ALIGN(8) accelerationStructureReference; -} VkAccelerationStructureSRTMotionInstanceNV; - -typedef struct VkAccelerationStructureTrianglesOpacityMicromapEXT -{ - VkStructureType sType; - void *pNext; - VkIndexType indexType; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) indexBuffer; - VkDeviceSize WINE_VK_ALIGN(8) indexStride; - uint32_t baseTriangle; - uint32_t usageCountsCount; - const VkMicromapUsageEXT *pUsageCounts; - const VkMicromapUsageEXT * const*ppUsageCounts; - VkMicromapEXT WINE_VK_ALIGN(8) micromap; -} VkAccelerationStructureTrianglesOpacityMicromapEXT; - -typedef struct VkAttachmentSampleLocationsEXT -{ - uint32_t attachmentIndex; - VkSampleLocationsInfoEXT sampleLocationsInfo; -} VkAttachmentSampleLocationsEXT; - -typedef struct VkBindImageMemoryDeviceGroupInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t deviceIndexCount; - const uint32_t *pDeviceIndices; - uint32_t splitInstanceBindRegionCount; - const VkRect2D *pSplitInstanceBindRegions; -} VkBindImageMemoryDeviceGroupInfo; -typedef VkBindImageMemoryDeviceGroupInfo VkBindImageMemoryDeviceGroupInfoKHR; - -typedef struct VkBufferImageCopy -{ - VkDeviceSize WINE_VK_ALIGN(8) bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy; - -typedef struct VkBufferImageCopy2 -{ - VkStructureType sType; - const void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy2; -typedef VkBufferImageCopy2 VkBufferImageCopy2KHR; - -typedef struct VkClearAttachment -{ - VkImageAspectFlags aspectMask; - uint32_t colorAttachment; - VkClearValue clearValue; -} VkClearAttachment; - -typedef struct VkClearRect -{ - VkRect2D rect; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkClearRect; - -typedef struct VkCommandBufferBeginInfo -{ - VkStructureType sType; - const void *pNext; - VkCommandBufferUsageFlags flags; - const VkCommandBufferInheritanceInfo *pInheritanceInfo; -} VkCommandBufferBeginInfo; - -typedef struct VkCommandBufferInheritanceRenderPassTransformInfoQCOM -{ - VkStructureType sType; - void *pNext; - VkSurfaceTransformFlagBitsKHR transform; - VkRect2D renderArea; -} VkCommandBufferInheritanceRenderPassTransformInfoQCOM; - -typedef struct VkCommandBufferInheritanceViewportScissorInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 viewportScissor2D; - uint32_t viewportDepthCount; - const VkViewport *pViewportDepths; -} VkCommandBufferInheritanceViewportScissorInfoNV; - -typedef struct VkCopyAccelerationStructureToMemoryInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) src; - VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyAccelerationStructureToMemoryInfoKHR; - -typedef struct VkCopyBufferToImageInfo2 -{ - VkStructureType sType; - const void *pNext; - VkBuffer WINE_VK_ALIGN(8) srcBuffer; - VkImage WINE_VK_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkBufferImageCopy2 *pRegions; -} VkCopyBufferToImageInfo2; -typedef VkCopyBufferToImageInfo2 VkCopyBufferToImageInfo2KHR; - -typedef struct VkCopyImageToBufferInfo2 -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkBuffer WINE_VK_ALIGN(8) dstBuffer; - uint32_t regionCount; - const VkBufferImageCopy2 *pRegions; -} VkCopyImageToBufferInfo2; -typedef VkCopyImageToBufferInfo2 VkCopyImageToBufferInfo2KHR; - -typedef struct VkCopyMemoryToAccelerationStructureInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) src; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyMemoryToAccelerationStructureInfoKHR; - -typedef struct VkCopyMemoryToImageIndirectCommandNV -{ - VkDeviceAddress WINE_VK_ALIGN(8) srcAddress; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkCopyMemoryToImageIndirectCommandNV; - -typedef struct VkCopyMemoryToMicromapInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDeviceOrHostAddressConstKHR WINE_VK_ALIGN(8) src; - VkMicromapEXT WINE_VK_ALIGN(8) dst; - VkCopyMicromapModeEXT mode; -} VkCopyMemoryToMicromapInfoEXT; - -typedef struct VkCopyMicromapToMemoryInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkMicromapEXT WINE_VK_ALIGN(8) src; - VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) dst; - VkCopyMicromapModeEXT mode; -} VkCopyMicromapToMemoryInfoEXT; - -typedef struct VkDebugUtilsMessengerCallbackDataEXT -{ - VkStructureType sType; - const void *pNext; - VkDebugUtilsMessengerCallbackDataFlagsEXT flags; - const char *pMessageIdName; - int32_t messageIdNumber; - const char *pMessage; - uint32_t queueLabelCount; - const VkDebugUtilsLabelEXT *pQueueLabels; - uint32_t cmdBufLabelCount; - const VkDebugUtilsLabelEXT *pCmdBufLabels; - uint32_t objectCount; - const VkDebugUtilsObjectNameInfoEXT *pObjects; -} VkDebugUtilsMessengerCallbackDataEXT; - -typedef union VkDescriptorDataEXT -{ - const VkSampler *pSampler; - const VkDescriptorImageInfo *pCombinedImageSampler; - const VkDescriptorImageInfo *pInputAttachmentImage; - const VkDescriptorImageInfo *pSampledImage; - const VkDescriptorImageInfo *pStorageImage; - const VkDescriptorAddressInfoEXT *pUniformTexelBuffer; - const VkDescriptorAddressInfoEXT *pStorageTexelBuffer; - const VkDescriptorAddressInfoEXT *pUniformBuffer; - const VkDescriptorAddressInfoEXT *pStorageBuffer; - VkDeviceAddress WINE_VK_ALIGN(8) accelerationStructure; -} VkDescriptorDataEXT; - -typedef struct VkDescriptorGetInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkDescriptorType type; - VkDescriptorDataEXT WINE_VK_ALIGN(8) data; -} VkDescriptorGetInfoEXT; - -typedef struct VkDescriptorPoolCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkDescriptorPoolCreateFlags flags; - uint32_t maxSets; - uint32_t poolSizeCount; - const VkDescriptorPoolSize *pPoolSizes; -} VkDescriptorPoolCreateInfo; - -typedef struct VkDescriptorUpdateTemplateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkDescriptorUpdateTemplateCreateFlags flags; - uint32_t descriptorUpdateEntryCount; - const VkDescriptorUpdateTemplateEntry *pDescriptorUpdateEntries; - VkDescriptorUpdateTemplateType templateType; - VkDescriptorSetLayout WINE_VK_ALIGN(8) descriptorSetLayout; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout WINE_VK_ALIGN(8) pipelineLayout; - uint32_t set; -} VkDescriptorUpdateTemplateCreateInfo; -typedef VkDescriptorUpdateTemplateCreateInfo VkDescriptorUpdateTemplateCreateInfoKHR; - -typedef struct VkDeviceCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkDeviceCreateFlags flags; - uint32_t queueCreateInfoCount; - const VkDeviceQueueCreateInfo *pQueueCreateInfos; - uint32_t enabledLayerCount; - const char * const*ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char * const*ppEnabledExtensionNames; - const VkPhysicalDeviceFeatures *pEnabledFeatures; -} VkDeviceCreateInfo; - -typedef struct VkDeviceFaultInfoEXT -{ - VkStructureType sType; - void *pNext; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkDeviceFaultAddressInfoEXT *pAddressInfos; - VkDeviceFaultVendorInfoEXT *pVendorInfos; - void *pVendorBinaryData; -} VkDeviceFaultInfoEXT; - -typedef struct VkDeviceGroupRenderPassBeginInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t deviceMask; - uint32_t deviceRenderAreaCount; - const VkRect2D *pDeviceRenderAreas; -} VkDeviceGroupRenderPassBeginInfo; -typedef VkDeviceGroupRenderPassBeginInfo VkDeviceGroupRenderPassBeginInfoKHR; - -typedef struct VkDeviceImageMemoryRequirements -{ - VkStructureType sType; - const void *pNext; - const VkImageCreateInfo *pCreateInfo; - VkImageAspectFlagBits planeAspect; -} VkDeviceImageMemoryRequirements; -typedef VkDeviceImageMemoryRequirements VkDeviceImageMemoryRequirementsKHR; - -typedef struct VkDeviceImageSubresourceInfoKHR -{ - VkStructureType sType; - const void *pNext; - const VkImageCreateInfo *pCreateInfo; - const VkImageSubresource2KHR *pSubresource; -} VkDeviceImageSubresourceInfoKHR; - -typedef struct VkExternalBufferProperties -{ - VkStructureType sType; - void *pNext; - VkExternalMemoryProperties externalMemoryProperties; -} VkExternalBufferProperties; -typedef VkExternalBufferProperties VkExternalBufferPropertiesKHR; - -typedef struct VkExternalImageFormatProperties -{ - VkStructureType sType; - void *pNext; - VkExternalMemoryProperties externalMemoryProperties; -} VkExternalImageFormatProperties; -typedef VkExternalImageFormatProperties VkExternalImageFormatPropertiesKHR; - -typedef struct VkGeneratedCommandsInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline WINE_VK_ALIGN(8) pipeline; - VkIndirectCommandsLayoutNV WINE_VK_ALIGN(8) indirectCommandsLayout; - uint32_t streamCount; - const VkIndirectCommandsStreamNV *pStreams; - uint32_t sequencesCount; - VkBuffer WINE_VK_ALIGN(8) preprocessBuffer; - VkDeviceSize WINE_VK_ALIGN(8) preprocessOffset; - VkDeviceSize WINE_VK_ALIGN(8) preprocessSize; - VkBuffer WINE_VK_ALIGN(8) sequencesCountBuffer; - VkDeviceSize WINE_VK_ALIGN(8) sequencesCountOffset; - VkBuffer WINE_VK_ALIGN(8) sequencesIndexBuffer; - VkDeviceSize WINE_VK_ALIGN(8) sequencesIndexOffset; -} VkGeneratedCommandsInfoNV; - -typedef struct VkGeometryDataNV -{ - VkGeometryTrianglesNV WINE_VK_ALIGN(8) triangles; - VkGeometryAABBNV WINE_VK_ALIGN(8) aabbs; -} VkGeometryDataNV; - -typedef struct VkGeometryNV -{ - VkStructureType sType; - const void *pNext; - VkGeometryTypeKHR geometryType; - VkGeometryDataNV WINE_VK_ALIGN(8) geometry; - VkGeometryFlagsKHR flags; -} VkGeometryNV; - -typedef struct VkGetLatencyMarkerInfoNV -{ - VkStructureType sType; - const void *pNext; - uint32_t timingCount; - VkLatencyTimingsFrameReportNV *pTimings; -} VkGetLatencyMarkerInfoNV; - -typedef struct VkHdrMetadataEXT -{ - VkStructureType sType; - const void *pNext; - VkXYColorEXT displayPrimaryRed; - VkXYColorEXT displayPrimaryGreen; - VkXYColorEXT displayPrimaryBlue; - VkXYColorEXT whitePoint; - float maxLuminance; - float minLuminance; - float maxContentLightLevel; - float maxFrameAverageLightLevel; -} VkHdrMetadataEXT; - -typedef struct VkHostImageLayoutTransitionInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) image; - VkImageLayout oldLayout; - VkImageLayout newLayout; - VkImageSubresourceRange subresourceRange; -} VkHostImageLayoutTransitionInfoEXT; - -typedef struct VkImageBlit -{ - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffsets[2]; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffsets[2]; -} VkImageBlit; - -typedef struct VkImageBlit2 -{ - VkStructureType sType; - const void *pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffsets[2]; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffsets[2]; -} VkImageBlit2; -typedef VkImageBlit2 VkImageBlit2KHR; - -typedef struct VkImageCopy -{ - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageCopy; - -typedef struct VkImageCopy2 -{ - VkStructureType sType; - const void *pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageCopy2; -typedef VkImageCopy2 VkImageCopy2KHR; - -typedef struct VkImageMemoryBarrier -{ - VkStructureType sType; - const void *pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage WINE_VK_ALIGN(8) image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier; - -typedef struct VkImageMemoryBarrier2 -{ - VkStructureType sType; - const void *pNext; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) srcStageMask; - VkAccessFlags2 WINE_VK_ALIGN(8) srcAccessMask; - VkPipelineStageFlags2 WINE_VK_ALIGN(8) dstStageMask; - VkAccessFlags2 WINE_VK_ALIGN(8) dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage WINE_VK_ALIGN(8) image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier2; -typedef VkImageMemoryBarrier2 VkImageMemoryBarrier2KHR; - -typedef struct VkImageResolve -{ - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageResolve; - -typedef struct VkImageResolve2 -{ - VkStructureType sType; - const void *pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageResolve2; -typedef VkImageResolve2 VkImageResolve2KHR; - -typedef struct VkImageToMemoryCopyEXT -{ - VkStructureType sType; - const void *pNext; - void *pHostPointer; - uint32_t memoryRowLength; - uint32_t memoryImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkImageToMemoryCopyEXT; - -typedef struct VkImageViewSampleWeightCreateInfoQCOM -{ - VkStructureType sType; - const void *pNext; - VkOffset2D filterCenter; - VkExtent2D filterSize; - uint32_t numPhases; -} VkImageViewSampleWeightCreateInfoQCOM; - -typedef struct VkIndirectCommandsLayoutCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkIndirectCommandsLayoutUsageFlagsNV flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t tokenCount; - const VkIndirectCommandsLayoutTokenNV *pTokens; - uint32_t streamCount; - const uint32_t *pStreamStrides; -} VkIndirectCommandsLayoutCreateInfoNV; - -typedef struct VkMemoryToImageCopyEXT -{ - VkStructureType sType; - const void *pNext; - const void *pHostPointer; - uint32_t memoryRowLength; - uint32_t memoryImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkMemoryToImageCopyEXT; - -typedef struct VkMicromapBuildInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkMicromapTypeEXT type; - VkBuildMicromapFlagsEXT flags; - VkBuildMicromapModeEXT mode; - VkMicromapEXT WINE_VK_ALIGN(8) dstMicromap; - uint32_t usageCountsCount; - const VkMicromapUsageEXT *pUsageCounts; - const VkMicromapUsageEXT * const*ppUsageCounts; - 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; - -typedef struct VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM -{ - VkStructureType sType; - const void *pNext; - uint32_t perViewRenderAreaCount; - const VkRect2D *pPerViewRenderAreas; -} VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM; - -typedef struct VkMutableDescriptorTypeCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t mutableDescriptorTypeListCount; - const VkMutableDescriptorTypeListEXT *pMutableDescriptorTypeLists; -} VkMutableDescriptorTypeCreateInfoEXT; -typedef VkMutableDescriptorTypeCreateInfoEXT VkMutableDescriptorTypeCreateInfoVALVE; - -typedef struct VkOpticalFlowExecuteInfoNV -{ - VkStructureType sType; - void *pNext; - VkOpticalFlowExecuteFlagsNV flags; - uint32_t regionCount; - const VkRect2D *pRegions; -} VkOpticalFlowExecuteInfoNV; - -typedef struct VkPhysicalDeviceProperties -{ - uint32_t apiVersion; - uint32_t driverVersion; - uint32_t vendorID; - uint32_t deviceID; - VkPhysicalDeviceType deviceType; - char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; - uint8_t pipelineCacheUUID[VK_UUID_SIZE]; - VkPhysicalDeviceLimits WINE_VK_ALIGN(8) limits; - VkPhysicalDeviceSparseProperties sparseProperties; -} VkPhysicalDeviceProperties; - -typedef struct VkPhysicalDeviceProperties2 -{ - VkStructureType sType; - void *pNext; - VkPhysicalDeviceProperties WINE_VK_ALIGN(8) properties; -} VkPhysicalDeviceProperties2; -typedef VkPhysicalDeviceProperties2 VkPhysicalDeviceProperties2KHR; - -typedef struct VkPipelineDepthStencilStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineDepthStencilStateCreateFlags flags; - VkBool32 depthTestEnable; - VkBool32 depthWriteEnable; - VkCompareOp depthCompareOp; - VkBool32 depthBoundsTestEnable; - VkBool32 stencilTestEnable; - VkStencilOpState front; - VkStencilOpState back; - float minDepthBounds; - float maxDepthBounds; -} VkPipelineDepthStencilStateCreateInfo; - -typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkPipelineDiscardRectangleStateCreateFlagsEXT flags; - VkDiscardRectangleModeEXT discardRectangleMode; - uint32_t discardRectangleCount; - const VkRect2D *pDiscardRectangles; -} VkPipelineDiscardRectangleStateCreateInfoEXT; - -typedef struct VkPipelineExecutableStatisticKHR -{ - VkStructureType sType; - void *pNext; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkPipelineExecutableStatisticFormatKHR format; - VkPipelineExecutableStatisticValueKHR WINE_VK_ALIGN(8) value; -} VkPipelineExecutableStatisticKHR; - -typedef struct VkPipelineLayoutCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineLayoutCreateFlags flags; - uint32_t setLayoutCount; - const VkDescriptorSetLayout *pSetLayouts; - uint32_t pushConstantRangeCount; - const VkPushConstantRange *pPushConstantRanges; -} VkPipelineLayoutCreateInfo; - -typedef struct VkPipelineSampleLocationsStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkBool32 sampleLocationsEnable; - VkSampleLocationsInfoEXT sampleLocationsInfo; -} VkPipelineSampleLocationsStateCreateInfoEXT; - -typedef struct VkPipelineVertexInputDivisorStateCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t vertexBindingDivisorCount; - const VkVertexInputBindingDivisorDescriptionEXT *pVertexBindingDivisors; -} VkPipelineVertexInputDivisorStateCreateInfoEXT; - -typedef struct VkPipelineVertexInputStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineVertexInputStateCreateFlags flags; - uint32_t vertexBindingDescriptionCount; - const VkVertexInputBindingDescription *pVertexBindingDescriptions; - uint32_t vertexAttributeDescriptionCount; - const VkVertexInputAttributeDescription *pVertexAttributeDescriptions; -} VkPipelineVertexInputStateCreateInfo; - -typedef struct VkPipelineViewportExclusiveScissorStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - uint32_t exclusiveScissorCount; - const VkRect2D *pExclusiveScissors; -} VkPipelineViewportExclusiveScissorStateCreateInfoNV; - -typedef struct VkPipelineViewportShadingRateImageStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 shadingRateImageEnable; - uint32_t viewportCount; - const VkShadingRatePaletteNV *pShadingRatePalettes; -} VkPipelineViewportShadingRateImageStateCreateInfoNV; - -typedef struct VkPipelineViewportStateCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineViewportStateCreateFlags flags; - uint32_t viewportCount; - const VkViewport *pViewports; - uint32_t scissorCount; - const VkRect2D *pScissors; -} VkPipelineViewportStateCreateInfo; - -typedef struct VkPipelineViewportSwizzleStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineViewportSwizzleStateCreateFlagsNV flags; - uint32_t viewportCount; - const VkViewportSwizzleNV *pViewportSwizzles; -} VkPipelineViewportSwizzleStateCreateInfoNV; - -typedef struct VkPipelineViewportWScalingStateCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkBool32 viewportWScalingEnable; - uint32_t viewportCount; - const VkViewportWScalingNV *pViewportWScalings; -} VkPipelineViewportWScalingStateCreateInfoNV; - -typedef struct VkPresentRegionKHR -{ - uint32_t rectangleCount; - const VkRectLayerKHR *pRectangles; -} VkPresentRegionKHR; - -typedef struct VkPresentRegionsKHR -{ - VkStructureType sType; - const void *pNext; - uint32_t swapchainCount; - const VkPresentRegionKHR *pRegions; -} VkPresentRegionsKHR; - -typedef struct VkRenderPassCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - const VkAttachmentDescription *pAttachments; - uint32_t subpassCount; - const VkSubpassDescription *pSubpasses; - uint32_t dependencyCount; - const VkSubpassDependency *pDependencies; -} VkRenderPassCreateInfo; - -typedef struct VkRenderPassCreateInfo2 -{ - VkStructureType sType; - const void *pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - const VkAttachmentDescription2 *pAttachments; - uint32_t subpassCount; - const VkSubpassDescription2 *pSubpasses; - uint32_t dependencyCount; - const VkSubpassDependency2 *pDependencies; - uint32_t correlatedViewMaskCount; - const uint32_t *pCorrelatedViewMasks; -} VkRenderPassCreateInfo2; -typedef VkRenderPassCreateInfo2 VkRenderPassCreateInfo2KHR; - -typedef struct VkRenderPassCreationFeedbackCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkRenderPassCreationFeedbackInfoEXT *pRenderPassFeedback; -} VkRenderPassCreationFeedbackCreateInfoEXT; - -typedef struct VkRenderPassSampleLocationsBeginInfoEXT -{ - VkStructureType sType; - const void *pNext; - uint32_t attachmentInitialSampleLocationsCount; - const VkAttachmentSampleLocationsEXT *pAttachmentInitialSampleLocations; - uint32_t postSubpassSampleLocationsCount; - const VkSubpassSampleLocationsEXT *pPostSubpassSampleLocations; -} VkRenderPassSampleLocationsBeginInfoEXT; - -typedef struct VkRenderPassSubpassFeedbackCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkRenderPassSubpassFeedbackInfoEXT *pSubpassFeedback; -} VkRenderPassSubpassFeedbackCreateInfoEXT; - -typedef struct VkResolveImageInfo2 -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage WINE_VK_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageResolve2 *pRegions; -} VkResolveImageInfo2; -typedef VkResolveImageInfo2 VkResolveImageInfo2KHR; - -typedef struct VkSparseBufferMemoryBindInfo -{ - VkBuffer WINE_VK_ALIGN(8) buffer; - uint32_t bindCount; - const VkSparseMemoryBind *pBinds; -} VkSparseBufferMemoryBindInfo; - -typedef struct VkSparseImageOpaqueMemoryBindInfo -{ - VkImage WINE_VK_ALIGN(8) image; - uint32_t bindCount; - const VkSparseMemoryBind *pBinds; -} VkSparseImageOpaqueMemoryBindInfo; - -typedef struct VkSpecializationInfo -{ - uint32_t mapEntryCount; - const VkSpecializationMapEntry *pMapEntries; - size_t dataSize; - const void *pData; -} VkSpecializationInfo; - -typedef struct VkSurfaceCapabilities2KHR -{ - VkStructureType sType; - void *pNext; - VkSurfaceCapabilitiesKHR surfaceCapabilities; -} VkSurfaceCapabilities2KHR; - -typedef struct VkSurfaceFormat2KHR -{ - VkStructureType sType; - void *pNext; - VkSurfaceFormatKHR surfaceFormat; -} VkSurfaceFormat2KHR; - -typedef union VkAccelerationStructureGeometryDataKHR -{ - VkAccelerationStructureGeometryTrianglesDataKHR WINE_VK_ALIGN(8) triangles; - VkAccelerationStructureGeometryAabbsDataKHR WINE_VK_ALIGN(8) aabbs; - VkAccelerationStructureGeometryInstancesDataKHR WINE_VK_ALIGN(8) instances; -} VkAccelerationStructureGeometryDataKHR; - -typedef struct VkAccelerationStructureGeometryKHR -{ - VkStructureType sType; - const void *pNext; - VkGeometryTypeKHR geometryType; - VkAccelerationStructureGeometryDataKHR WINE_VK_ALIGN(8) geometry; - VkGeometryFlagsKHR flags; -} VkAccelerationStructureGeometryKHR; - -typedef struct VkAccelerationStructureInfoNV -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureTypeNV type; - VkBuildAccelerationStructureFlagsNV flags; - uint32_t instanceCount; - uint32_t geometryCount; - const VkGeometryNV *pGeometries; -} VkAccelerationStructureInfoNV; - -typedef union VkAccelerationStructureMotionInstanceDataNV -{ - VkAccelerationStructureInstanceKHR WINE_VK_ALIGN(8) staticInstance; - VkAccelerationStructureMatrixMotionInstanceNV WINE_VK_ALIGN(8) matrixMotionInstance; - VkAccelerationStructureSRTMotionInstanceNV WINE_VK_ALIGN(8) srtMotionInstance; -} VkAccelerationStructureMotionInstanceDataNV; - -typedef struct VkAccelerationStructureMotionInstanceNV -{ - VkAccelerationStructureMotionInstanceTypeNV type; - VkAccelerationStructureMotionInstanceFlagsNV flags; - VkAccelerationStructureMotionInstanceDataNV WINE_VK_ALIGN(8) data; -} VkAccelerationStructureMotionInstanceNV; - -typedef struct VkBindSparseInfo -{ - VkStructureType sType; - const void *pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore *pWaitSemaphores; - uint32_t bufferBindCount; - const VkSparseBufferMemoryBindInfo *pBufferBinds; - uint32_t imageOpaqueBindCount; - const VkSparseImageOpaqueMemoryBindInfo *pImageOpaqueBinds; - uint32_t imageBindCount; - const VkSparseImageMemoryBindInfo *pImageBinds; - uint32_t signalSemaphoreCount; - const VkSemaphore *pSignalSemaphores; -} VkBindSparseInfo; - -typedef struct VkBlitImageInfo2 -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage WINE_VK_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageBlit2 *pRegions; - VkFilter filter; -} VkBlitImageInfo2; -typedef VkBlitImageInfo2 VkBlitImageInfo2KHR; - -typedef struct VkCopyImageInfo2 -{ - VkStructureType sType; - const void *pNext; - VkImage WINE_VK_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage WINE_VK_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageCopy2 *pRegions; -} VkCopyImageInfo2; -typedef VkCopyImageInfo2 VkCopyImageInfo2KHR; - -typedef struct VkCopyImageToImageInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkHostImageCopyFlagsEXT flags; - VkImage WINE_VK_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - VkImage WINE_VK_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageCopy2 *pRegions; -} VkCopyImageToImageInfoEXT; - -typedef struct VkCopyImageToMemoryInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkHostImageCopyFlagsEXT flags; - VkImage WINE_VK_ALIGN(8) srcImage; - VkImageLayout srcImageLayout; - uint32_t regionCount; - const VkImageToMemoryCopyEXT *pRegions; -} VkCopyImageToMemoryInfoEXT; - -typedef struct VkCopyMemoryToImageInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkHostImageCopyFlagsEXT flags; - VkImage WINE_VK_ALIGN(8) dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkMemoryToImageCopyEXT *pRegions; -} VkCopyMemoryToImageInfoEXT; - -typedef struct VkDependencyInfo -{ - VkStructureType sType; - const void *pNext; - VkDependencyFlags dependencyFlags; - uint32_t memoryBarrierCount; - const VkMemoryBarrier2 *pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - const VkBufferMemoryBarrier2 *pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - const VkImageMemoryBarrier2 *pImageMemoryBarriers; -} VkDependencyInfo; -typedef VkDependencyInfo VkDependencyInfoKHR; - -typedef struct VkPipelineShaderStageCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineShaderStageCreateFlags flags; - VkShaderStageFlagBits stage; - VkShaderModule WINE_VK_ALIGN(8) module; - const char *pName; - const VkSpecializationInfo *pSpecializationInfo; -} VkPipelineShaderStageCreateInfo; - -typedef struct VkRayTracingPipelineCreateInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo *pStages; - uint32_t groupCount; - const VkRayTracingShaderGroupCreateInfoKHR *pGroups; - uint32_t maxPipelineRayRecursionDepth; - const VkPipelineLibraryCreateInfoKHR *pLibraryInfo; - const VkRayTracingPipelineInterfaceCreateInfoKHR *pLibraryInterface; - const VkPipelineDynamicStateCreateInfo *pDynamicState; - VkPipelineLayout WINE_VK_ALIGN(8) layout; - VkPipeline WINE_VK_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkRayTracingPipelineCreateInfoKHR; - -typedef struct VkRayTracingPipelineCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo *pStages; - uint32_t groupCount; - const VkRayTracingShaderGroupCreateInfoNV *pGroups; - uint32_t maxRecursionDepth; - VkPipelineLayout WINE_VK_ALIGN(8) layout; - VkPipeline WINE_VK_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkRayTracingPipelineCreateInfoNV; - -typedef struct VkShaderCreateInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkShaderCreateFlagsEXT flags; - VkShaderStageFlagBits stage; - VkShaderStageFlags nextStage; - VkShaderCodeTypeEXT codeType; - size_t codeSize; - const void *pCode; - const char *pName; - uint32_t setLayoutCount; - const VkDescriptorSetLayout *pSetLayouts; - uint32_t pushConstantRangeCount; - const VkPushConstantRange *pPushConstantRanges; - const VkSpecializationInfo *pSpecializationInfo; -} VkShaderCreateInfoEXT; - -typedef struct VkAccelerationStructureBuildGeometryInfoKHR -{ - VkStructureType sType; - const void *pNext; - VkAccelerationStructureTypeKHR type; - VkBuildAccelerationStructureFlagsKHR flags; - VkBuildAccelerationStructureModeKHR mode; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) srcAccelerationStructure; - VkAccelerationStructureKHR WINE_VK_ALIGN(8) dstAccelerationStructure; - uint32_t geometryCount; - const VkAccelerationStructureGeometryKHR *pGeometries; - const VkAccelerationStructureGeometryKHR * const*ppGeometries; - VkDeviceOrHostAddressKHR WINE_VK_ALIGN(8) scratchData; -} VkAccelerationStructureBuildGeometryInfoKHR; - -typedef struct VkAccelerationStructureCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - VkDeviceSize WINE_VK_ALIGN(8) compactedSize; - VkAccelerationStructureInfoNV info; -} VkAccelerationStructureCreateInfoNV; - -typedef struct VkComputePipelineCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineCreateFlags flags; - VkPipelineShaderStageCreateInfo WINE_VK_ALIGN(8) stage; - VkPipelineLayout WINE_VK_ALIGN(8) layout; - VkPipeline WINE_VK_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkComputePipelineCreateInfo; - -typedef struct VkGraphicsPipelineCreateInfo -{ - VkStructureType sType; - const void *pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo *pStages; - const VkPipelineVertexInputStateCreateInfo *pVertexInputState; - const VkPipelineInputAssemblyStateCreateInfo *pInputAssemblyState; - const VkPipelineTessellationStateCreateInfo *pTessellationState; - const VkPipelineViewportStateCreateInfo *pViewportState; - const VkPipelineRasterizationStateCreateInfo *pRasterizationState; - const VkPipelineMultisampleStateCreateInfo *pMultisampleState; - const VkPipelineDepthStencilStateCreateInfo *pDepthStencilState; - const VkPipelineColorBlendStateCreateInfo *pColorBlendState; - const VkPipelineDynamicStateCreateInfo *pDynamicState; - VkPipelineLayout WINE_VK_ALIGN(8) layout; - VkRenderPass WINE_VK_ALIGN(8) renderPass; - uint32_t subpass; - VkPipeline WINE_VK_ALIGN(8) basePipelineHandle; - int32_t basePipelineIndex; -} VkGraphicsPipelineCreateInfo; - -typedef struct VkGraphicsShaderGroupCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo *pStages; - const VkPipelineVertexInputStateCreateInfo *pVertexInputState; - const VkPipelineTessellationStateCreateInfo *pTessellationState; -} VkGraphicsShaderGroupCreateInfoNV; - -typedef struct VkGraphicsPipelineShaderGroupsCreateInfoNV -{ - VkStructureType sType; - const void *pNext; - uint32_t groupCount; - const VkGraphicsShaderGroupCreateInfoNV *pGroups; - uint32_t pipelineCount; - const VkPipeline *pPipelines; -} VkGraphicsPipelineShaderGroupsCreateInfoNV; - -typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHR)(VkDevice, const VkAcquireNextImageInfoKHR *, uint32_t *); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence, uint32_t *); -typedef VkResult (VKAPI_PTR *PFN_vkAcquirePerformanceConfigurationINTEL)(VkDevice, const VkPerformanceConfigurationAcquireInfoINTEL *, VkPerformanceConfigurationINTEL *); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireProfilingLockKHR)(VkDevice, const VkAcquireProfilingLockInfoKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice, const VkCommandBufferAllocateInfo *, VkCommandBuffer *); -typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice, const VkDescriptorSetAllocateInfo *, VkDescriptorSet *); -typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice, const VkMemoryAllocateInfo *, const VkAllocationCallbacks *, VkDeviceMemory *); -typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer, const VkCommandBufferBeginInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkBindAccelerationStructureMemoryNV)(VkDevice, uint32_t, const VkBindAccelerationStructureMemoryInfoNV *); -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice, VkBuffer, VkDeviceMemory, VkDeviceSize); -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2)(VkDevice, uint32_t, const VkBindBufferMemoryInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHR)(VkDevice, uint32_t, const VkBindBufferMemoryInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice, VkImage, VkDeviceMemory, VkDeviceSize); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2)(VkDevice, uint32_t, const VkBindImageMemoryInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHR)(VkDevice, uint32_t, const VkBindImageMemoryInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkBindOpticalFlowSessionImageNV)(VkDevice, VkOpticalFlowSessionNV, VkOpticalFlowSessionBindingPointNV, VkImageView, VkImageLayout); -typedef VkResult (VKAPI_PTR *PFN_vkBuildAccelerationStructuresKHR)(VkDevice, VkDeferredOperationKHR, uint32_t, const VkAccelerationStructureBuildGeometryInfoKHR *, const VkAccelerationStructureBuildRangeInfoKHR * const*); -typedef VkResult (VKAPI_PTR *PFN_vkBuildMicromapsEXT)(VkDevice, VkDeferredOperationKHR, uint32_t, const VkMicromapBuildInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginConditionalRenderingEXT)(VkCommandBuffer, const VkConditionalRenderingBeginInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginDebugUtilsLabelEXT)(VkCommandBuffer, const VkDebugUtilsLabelEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer, VkQueryPool, uint32_t, VkQueryControlFlags); -typedef void (VKAPI_PTR *PFN_vkCmdBeginQueryIndexedEXT)(VkCommandBuffer, VkQueryPool, uint32_t, VkQueryControlFlags, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer, const VkRenderPassBeginInfo *, VkSubpassContents); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass2)(VkCommandBuffer, const VkRenderPassBeginInfo *, const VkSubpassBeginInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass2KHR)(VkCommandBuffer, const VkRenderPassBeginInfo *, const VkSubpassBeginInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRendering)(VkCommandBuffer, const VkRenderingInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderingKHR)(VkCommandBuffer, const VkRenderingInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdBeginTransformFeedbackEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBuffersEXT)(VkCommandBuffer, uint32_t, const VkDescriptorBufferBindingInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const VkDescriptorSet *, uint32_t, const uint32_t *); -typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkIndexType); -typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer2KHR)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, VkIndexType); -typedef void (VKAPI_PTR *PFN_vkCmdBindInvocationMaskHUAWEI)(VkCommandBuffer, VkImageView, VkImageLayout); -typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline); -typedef void (VKAPI_PTR *PFN_vkCmdBindPipelineShaderGroupNV)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdBindShadersEXT)(VkCommandBuffer, uint32_t, const VkShaderStageFlagBits *, const VkShaderEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdBindShadingRateImageNV)(VkCommandBuffer, VkImageView, VkImageLayout); -typedef void (VKAPI_PTR *PFN_vkCmdBindTransformFeedbackBuffersEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers2)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *, const VkDeviceSize *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers2EXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *, const VkDeviceSize *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageBlit *, VkFilter); -typedef void (VKAPI_PTR *PFN_vkCmdBlitImage2)(VkCommandBuffer, const VkBlitImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdBlitImage2KHR)(VkCommandBuffer, const VkBlitImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructureNV)(VkCommandBuffer, const VkAccelerationStructureInfoNV *, VkBuffer, VkDeviceSize, VkBool32, VkAccelerationStructureNV, VkAccelerationStructureNV, VkBuffer, VkDeviceSize); -typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructuresIndirectKHR)(VkCommandBuffer, uint32_t, const VkAccelerationStructureBuildGeometryInfoKHR *, const VkDeviceAddress *, const uint32_t *, const uint32_t * const*); -typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructuresKHR)(VkCommandBuffer, uint32_t, const VkAccelerationStructureBuildGeometryInfoKHR *, const VkAccelerationStructureBuildRangeInfoKHR * const*); -typedef void (VKAPI_PTR *PFN_vkCmdBuildMicromapsEXT)(VkCommandBuffer, uint32_t, const VkMicromapBuildInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer, uint32_t, const VkClearAttachment *, uint32_t, const VkClearRect *); -typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer, VkImage, VkImageLayout, const VkClearColorValue *, uint32_t, const VkImageSubresourceRange *); -typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer, VkImage, VkImageLayout, const VkClearDepthStencilValue *, uint32_t, const VkImageSubresourceRange *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureKHR)(VkCommandBuffer, const VkCopyAccelerationStructureInfoKHR *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureNV)(VkCommandBuffer, VkAccelerationStructureNV, VkAccelerationStructureNV, VkCopyAccelerationStructureModeKHR); -typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureToMemoryKHR)(VkCommandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer, VkBuffer, VkBuffer, uint32_t, const VkBufferCopy *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer2)(VkCommandBuffer, const VkCopyBufferInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer2KHR)(VkCommandBuffer, const VkCopyBufferInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer, VkBuffer, VkImage, VkImageLayout, uint32_t, const VkBufferImageCopy *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage2)(VkCommandBuffer, const VkCopyBufferToImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage2KHR)(VkCommandBuffer, const VkCopyBufferToImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageCopy *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImage2)(VkCommandBuffer, const VkCopyImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImage2KHR)(VkCommandBuffer, const VkCopyImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer, VkImage, VkImageLayout, VkBuffer, uint32_t, const VkBufferImageCopy *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer2)(VkCommandBuffer, const VkCopyImageToBufferInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer2KHR)(VkCommandBuffer, const VkCopyImageToBufferInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryIndirectNV)(VkCommandBuffer, VkDeviceAddress, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToAccelerationStructureKHR)(VkCommandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToImageIndirectNV)(VkCommandBuffer, VkDeviceAddress, uint32_t, uint32_t, VkImage, VkImageLayout, const VkImageSubresourceLayers *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToMicromapEXT)(VkCommandBuffer, const VkCopyMemoryToMicromapInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMicromapEXT)(VkCommandBuffer, const VkCopyMicromapInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMicromapToMemoryEXT)(VkCommandBuffer, const VkCopyMicromapToMemoryInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t, VkBuffer, VkDeviceSize, VkDeviceSize, VkQueryResultFlags); -typedef void (VKAPI_PTR *PFN_vkCmdCuLaunchKernelNVX)(VkCommandBuffer, const VkCuLaunchInfoNVX *); -typedef void (VKAPI_PTR *PFN_vkCmdCudaLaunchKernelNV)(VkCommandBuffer, const VkCudaLaunchInfoNV *); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer, const VkDebugMarkerMarkerInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer, const VkDebugMarkerMarkerInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdDecompressMemoryIndirectCountNV)(VkCommandBuffer, VkDeviceAddress, VkDeviceAddress, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDecompressMemoryNV)(VkCommandBuffer, uint32_t, const VkDecompressMemoryRegionNV *); -typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchBase)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHR)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize); -typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawClusterHUAWEI)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawClusterIndirectHUAWEI)(VkCommandBuffer, VkBuffer, VkDeviceSize); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer, uint32_t, uint32_t, uint32_t, int32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCount)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountKHR)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectByteCountEXT)(VkCommandBuffer, uint32_t, uint32_t, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCount)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountKHR)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksEXT)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectCountEXT)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectCountNV)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectEXT)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectNV)(VkCommandBuffer, VkBuffer, VkDeviceSize, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksNV)(VkCommandBuffer, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMultiEXT)(VkCommandBuffer, uint32_t, const VkMultiDrawInfoEXT *, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMultiIndexedEXT)(VkCommandBuffer, uint32_t, const VkMultiDrawIndexedInfoEXT *, uint32_t, uint32_t, uint32_t, const int32_t *); -typedef void (VKAPI_PTR *PFN_vkCmdEndConditionalRenderingEXT)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdEndDebugUtilsLabelEXT)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer, VkQueryPool, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdEndQueryIndexedEXT)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass2)(VkCommandBuffer, const VkSubpassEndInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass2KHR)(VkCommandBuffer, const VkSubpassEndInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdEndRendering)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderingKHR)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdEndTransformFeedbackEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBuffer *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer, uint32_t, const VkCommandBuffer *); -typedef void (VKAPI_PTR *PFN_vkCmdExecuteGeneratedCommandsNV)(VkCommandBuffer, VkBool32, const VkGeneratedCommandsInfoNV *); -typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdInsertDebugUtilsLabelEXT)(VkCommandBuffer, const VkDebugUtilsLabelEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer, VkSubpassContents); -typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass2)(VkCommandBuffer, const VkSubpassBeginInfo *, const VkSubpassEndInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass2KHR)(VkCommandBuffer, const VkSubpassBeginInfo *, const VkSubpassEndInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdOpticalFlowExecuteNV)(VkCommandBuffer, VkOpticalFlowSessionNV, const VkOpticalFlowExecuteInfoNV *); -typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer, VkPipelineStageFlags, VkPipelineStageFlags, VkDependencyFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); -typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier2)(VkCommandBuffer, const VkDependencyInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier2KHR)(VkCommandBuffer, const VkDependencyInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdPreprocessGeneratedCommandsNV)(VkCommandBuffer, const VkGeneratedCommandsInfoNV *); -typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer, VkPipelineLayout, VkShaderStageFlags, uint32_t, uint32_t, const void *); -typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetKHR)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const VkWriteDescriptorSet *); -typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer, VkDescriptorUpdateTemplate, VkPipelineLayout, uint32_t, const void *); -typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer, VkEvent, VkPipelineStageFlags); -typedef void (VKAPI_PTR *PFN_vkCmdResetEvent2)(VkCommandBuffer, VkEvent, VkPipelineStageFlags2); -typedef void (VKAPI_PTR *PFN_vkCmdResetEvent2KHR)(VkCommandBuffer, VkEvent, VkPipelineStageFlags2); -typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageResolve *); -typedef void (VKAPI_PTR *PFN_vkCmdResolveImage2)(VkCommandBuffer, const VkResolveImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdResolveImage2KHR)(VkCommandBuffer, const VkResolveImageInfo2 *); -typedef void (VKAPI_PTR *PFN_vkCmdSetAlphaToCoverageEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetAlphaToOneEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)(VkCommandBuffer, VkImageAspectFlags); -typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer, const float[4]); -typedef void (VKAPI_PTR *PFN_vkCmdSetCheckpointNV)(VkCommandBuffer, const void *); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoarseSampleOrderNV)(VkCommandBuffer, VkCoarseSampleOrderTypeNV, uint32_t, const VkCoarseSampleOrderCustomNV *); -typedef void (VKAPI_PTR *PFN_vkCmdSetColorBlendAdvancedEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkColorBlendAdvancedEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdSetColorBlendEnableEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkBool32 *); -typedef void (VKAPI_PTR *PFN_vkCmdSetColorBlendEquationEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkColorBlendEquationEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdSetColorWriteEnableEXT)(VkCommandBuffer, uint32_t, const VkBool32 *); -typedef void (VKAPI_PTR *PFN_vkCmdSetColorWriteMaskEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkColorComponentFlags *); -typedef void (VKAPI_PTR *PFN_vkCmdSetConservativeRasterizationModeEXT)(VkCommandBuffer, VkConservativeRasterizationModeEXT); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageModulationModeNV)(VkCommandBuffer, VkCoverageModulationModeNV); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageModulationTableEnableNV)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageModulationTableNV)(VkCommandBuffer, uint32_t, const float *); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageReductionModeNV)(VkCommandBuffer, VkCoverageReductionModeNV); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageToColorEnableNV)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageToColorLocationNV)(VkCommandBuffer, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetCullMode)(VkCommandBuffer, VkCullModeFlags); -typedef void (VKAPI_PTR *PFN_vkCmdSetCullModeEXT)(VkCommandBuffer, VkCullModeFlags); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer, float, float, float); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias2EXT)(VkCommandBuffer, const VkDepthBiasInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBiasEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBiasEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer, float, float); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBoundsTestEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBoundsTestEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthClampEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthClipEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthClipNegativeOneToOneEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthCompareOp)(VkCommandBuffer, VkCompareOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthCompareOpEXT)(VkCommandBuffer, VkCompareOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthTestEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthTestEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthWriteEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthWriteEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDescriptorBufferOffsetsEXT)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const uint32_t *, const VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMask)(VkCommandBuffer, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHR)(VkCommandBuffer, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer, uint32_t, uint32_t, const VkRect2D *); -typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleModeEXT)(VkCommandBuffer, VkDiscardRectangleModeEXT); -typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer, VkEvent, VkPipelineStageFlags); -typedef void (VKAPI_PTR *PFN_vkCmdSetEvent2)(VkCommandBuffer, VkEvent, const VkDependencyInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdSetEvent2KHR)(VkCommandBuffer, VkEvent, const VkDependencyInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorEnableNV)(VkCommandBuffer, uint32_t, uint32_t, const VkBool32 *); -typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorNV)(VkCommandBuffer, uint32_t, uint32_t, const VkRect2D *); -typedef void (VKAPI_PTR *PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)(VkCommandBuffer, float); -typedef void (VKAPI_PTR *PFN_vkCmdSetFragmentShadingRateEnumNV)(VkCommandBuffer, VkFragmentShadingRateNV, const VkFragmentShadingRateCombinerOpKHR[2]); -typedef void (VKAPI_PTR *PFN_vkCmdSetFragmentShadingRateKHR)(VkCommandBuffer, const VkExtent2D *, const VkFragmentShadingRateCombinerOpKHR[2]); -typedef void (VKAPI_PTR *PFN_vkCmdSetFrontFace)(VkCommandBuffer, VkFrontFace); -typedef void (VKAPI_PTR *PFN_vkCmdSetFrontFaceEXT)(VkCommandBuffer, VkFrontFace); -typedef void (VKAPI_PTR *PFN_vkCmdSetLineRasterizationModeEXT)(VkCommandBuffer, VkLineRasterizationModeEXT); -typedef void (VKAPI_PTR *PFN_vkCmdSetLineStippleEXT)(VkCommandBuffer, uint32_t, uint16_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetLineStippleEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer, float); -typedef void (VKAPI_PTR *PFN_vkCmdSetLogicOpEXT)(VkCommandBuffer, VkLogicOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetLogicOpEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetPatchControlPointsEXT)(VkCommandBuffer, uint32_t); -typedef VkResult (VKAPI_PTR *PFN_vkCmdSetPerformanceMarkerINTEL)(VkCommandBuffer, const VkPerformanceMarkerInfoINTEL *); -typedef VkResult (VKAPI_PTR *PFN_vkCmdSetPerformanceOverrideINTEL)(VkCommandBuffer, const VkPerformanceOverrideInfoINTEL *); -typedef VkResult (VKAPI_PTR *PFN_vkCmdSetPerformanceStreamMarkerINTEL)(VkCommandBuffer, const VkPerformanceStreamMarkerInfoINTEL *); -typedef void (VKAPI_PTR *PFN_vkCmdSetPolygonModeEXT)(VkCommandBuffer, VkPolygonMode); -typedef void (VKAPI_PTR *PFN_vkCmdSetPrimitiveRestartEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetPrimitiveRestartEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetPrimitiveTopology)(VkCommandBuffer, VkPrimitiveTopology); -typedef void (VKAPI_PTR *PFN_vkCmdSetPrimitiveTopologyEXT)(VkCommandBuffer, VkPrimitiveTopology); -typedef void (VKAPI_PTR *PFN_vkCmdSetProvokingVertexModeEXT)(VkCommandBuffer, VkProvokingVertexModeEXT); -typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizationSamplesEXT)(VkCommandBuffer, VkSampleCountFlagBits); -typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizationStreamEXT)(VkCommandBuffer, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizerDiscardEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizerDiscardEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetRayTracingPipelineStackSizeKHR)(VkCommandBuffer, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetRepresentativeFragmentTestEnableNV)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetSampleLocationsEXT)(VkCommandBuffer, const VkSampleLocationsInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkCmdSetSampleLocationsEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetSampleMaskEXT)(VkCommandBuffer, VkSampleCountFlagBits, const VkSampleMask *); -typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer, uint32_t, uint32_t, const VkRect2D *); -typedef void (VKAPI_PTR *PFN_vkCmdSetScissorWithCount)(VkCommandBuffer, uint32_t, const VkRect2D *); -typedef void (VKAPI_PTR *PFN_vkCmdSetScissorWithCountEXT)(VkCommandBuffer, uint32_t, const VkRect2D *); -typedef void (VKAPI_PTR *PFN_vkCmdSetShadingRateImageEnableNV)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilOp)(VkCommandBuffer, VkStencilFaceFlags, VkStencilOp, VkStencilOp, VkStencilOp, VkCompareOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilOpEXT)(VkCommandBuffer, VkStencilFaceFlags, VkStencilOp, VkStencilOp, VkStencilOp, VkCompareOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilTestEnable)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilTestEnableEXT)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdSetTessellationDomainOriginEXT)(VkCommandBuffer, VkTessellationDomainOrigin); -typedef void (VKAPI_PTR *PFN_vkCmdSetVertexInputEXT)(VkCommandBuffer, uint32_t, const VkVertexInputBindingDescription2EXT *, uint32_t, const VkVertexInputAttributeDescription2EXT *); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer, uint32_t, uint32_t, const VkViewport *); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportShadingRatePaletteNV)(VkCommandBuffer, uint32_t, uint32_t, const VkShadingRatePaletteNV *); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportSwizzleNV)(VkCommandBuffer, uint32_t, uint32_t, const VkViewportSwizzleNV *); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingEnableNV)(VkCommandBuffer, VkBool32); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingNV)(VkCommandBuffer, uint32_t, uint32_t, const VkViewportWScalingNV *); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWithCount)(VkCommandBuffer, uint32_t, const VkViewport *); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWithCountEXT)(VkCommandBuffer, uint32_t, const VkViewport *); -typedef void (VKAPI_PTR *PFN_vkCmdSubpassShadingHUAWEI)(VkCommandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysIndirect2KHR)(VkCommandBuffer, VkDeviceAddress); -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysIndirectKHR)(VkCommandBuffer, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, VkDeviceAddress); -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysKHR)(VkCommandBuffer, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, const VkStridedDeviceAddressRegionKHR *, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysNV)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, VkDeviceSize, VkBuffer, VkDeviceSize, VkDeviceSize, VkBuffer, VkDeviceSize, VkDeviceSize, uint32_t, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, const void *); -typedef void (VKAPI_PTR *PFN_vkCmdUpdatePipelineIndirectBufferNV)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline); -typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer, uint32_t, const VkEvent *, VkPipelineStageFlags, VkPipelineStageFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); -typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents2)(VkCommandBuffer, uint32_t, const VkEvent *, const VkDependencyInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents2KHR)(VkCommandBuffer, uint32_t, const VkEvent *, const VkDependencyInfo *); -typedef void (VKAPI_PTR *PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)(VkCommandBuffer, uint32_t, const VkAccelerationStructureKHR *, VkQueryType, VkQueryPool, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteAccelerationStructuresPropertiesNV)(VkCommandBuffer, uint32_t, const VkAccelerationStructureNV *, VkQueryType, VkQueryPool, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteBufferMarker2AMD)(VkCommandBuffer, VkPipelineStageFlags2, VkBuffer, VkDeviceSize, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteBufferMarkerAMD)(VkCommandBuffer, VkPipelineStageFlagBits, VkBuffer, VkDeviceSize, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteMicromapsPropertiesEXT)(VkCommandBuffer, uint32_t, const VkMicromapEXT *, VkQueryType, VkQueryPool, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer, VkPipelineStageFlagBits, VkQueryPool, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp2)(VkCommandBuffer, VkPipelineStageFlags2, VkQueryPool, uint32_t); -typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp2KHR)(VkCommandBuffer, VkPipelineStageFlags2, VkQueryPool, uint32_t); -typedef VkResult (VKAPI_PTR *PFN_vkCompileDeferredNV)(VkDevice, VkPipeline, uint32_t); -typedef VkResult (VKAPI_PTR *PFN_vkCopyAccelerationStructureKHR)(VkDevice, VkDeferredOperationKHR, const VkCopyAccelerationStructureInfoKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyAccelerationStructureToMemoryKHR)(VkDevice, VkDeferredOperationKHR, const VkCopyAccelerationStructureToMemoryInfoKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyImageToImageEXT)(VkDevice, const VkCopyImageToImageInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyImageToMemoryEXT)(VkDevice, const VkCopyImageToMemoryInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToAccelerationStructureKHR)(VkDevice, VkDeferredOperationKHR, const VkCopyMemoryToAccelerationStructureInfoKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToImageEXT)(VkDevice, const VkCopyMemoryToImageInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToMicromapEXT)(VkDevice, VkDeferredOperationKHR, const VkCopyMemoryToMicromapInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyMicromapEXT)(VkDevice, VkDeferredOperationKHR, const VkCopyMicromapInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCopyMicromapToMemoryEXT)(VkDevice, VkDeferredOperationKHR, const VkCopyMicromapToMemoryInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateAccelerationStructureKHR)(VkDevice, const VkAccelerationStructureCreateInfoKHR *, const VkAllocationCallbacks *, VkAccelerationStructureKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateAccelerationStructureNV)(VkDevice, const VkAccelerationStructureCreateInfoNV *, const VkAllocationCallbacks *, VkAccelerationStructureNV *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice, const VkBufferCreateInfo *, const VkAllocationCallbacks *, VkBuffer *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice, const VkBufferViewCreateInfo *, const VkAllocationCallbacks *, VkBufferView *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice, const VkCommandPoolCreateInfo *, const VkAllocationCallbacks *, VkCommandPool *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice, VkPipelineCache, uint32_t, const VkComputePipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateCuFunctionNVX)(VkDevice, const VkCuFunctionCreateInfoNVX *, const VkAllocationCallbacks *, VkCuFunctionNVX *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateCuModuleNVX)(VkDevice, const VkCuModuleCreateInfoNVX *, const VkAllocationCallbacks *, VkCuModuleNVX *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateCudaFunctionNV)(VkDevice, const VkCudaFunctionCreateInfoNV *, const VkAllocationCallbacks *, VkCudaFunctionNV *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateCudaModuleNV)(VkDevice, const VkCudaModuleCreateInfoNV *, const VkAllocationCallbacks *, VkCudaModuleNV *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance, const VkDebugReportCallbackCreateInfoEXT *, const VkAllocationCallbacks *, VkDebugReportCallbackEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugUtilsMessengerEXT)(VkInstance, const VkDebugUtilsMessengerCreateInfoEXT *, const VkAllocationCallbacks *, VkDebugUtilsMessengerEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDeferredOperationKHR)(VkDevice, const VkAllocationCallbacks *, VkDeferredOperationKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice, const VkDescriptorPoolCreateInfo *, const VkAllocationCallbacks *, VkDescriptorPool *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, const VkAllocationCallbacks *, VkDescriptorSetLayout *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplate)(VkDevice, const VkDescriptorUpdateTemplateCreateInfo *, const VkAllocationCallbacks *, VkDescriptorUpdateTemplate *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplateKHR)(VkDevice, const VkDescriptorUpdateTemplateCreateInfo *, const VkAllocationCallbacks *, VkDescriptorUpdateTemplate *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice, const VkDeviceCreateInfo *, const VkAllocationCallbacks *, VkDevice *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice, const VkEventCreateInfo *, const VkAllocationCallbacks *, VkEvent *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice, const VkFenceCreateInfo *, const VkAllocationCallbacks *, VkFence *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice, const VkFramebufferCreateInfo *, const VkAllocationCallbacks *, VkFramebuffer *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice, VkPipelineCache, uint32_t, const VkGraphicsPipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice, const VkImageCreateInfo *, const VkAllocationCallbacks *, VkImage *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice, const VkImageViewCreateInfo *, const VkAllocationCallbacks *, VkImageView *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateIndirectCommandsLayoutNV)(VkDevice, const VkIndirectCommandsLayoutCreateInfoNV *, const VkAllocationCallbacks *, VkIndirectCommandsLayoutNV *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo *, const VkAllocationCallbacks *, VkInstance *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateMicromapEXT)(VkDevice, const VkMicromapCreateInfoEXT *, const VkAllocationCallbacks *, VkMicromapEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateOpticalFlowSessionNV)(VkDevice, const VkOpticalFlowSessionCreateInfoNV *, const VkAllocationCallbacks *, VkOpticalFlowSessionNV *); -typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice, const VkPipelineCacheCreateInfo *, const VkAllocationCallbacks *, VkPipelineCache *); -typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice, const VkPipelineLayoutCreateInfo *, const VkAllocationCallbacks *, VkPipelineLayout *); -typedef VkResult (VKAPI_PTR *PFN_vkCreatePrivateDataSlot)(VkDevice, const VkPrivateDataSlotCreateInfo *, const VkAllocationCallbacks *, VkPrivateDataSlot *); -typedef VkResult (VKAPI_PTR *PFN_vkCreatePrivateDataSlotEXT)(VkDevice, const VkPrivateDataSlotCreateInfo *, const VkAllocationCallbacks *, VkPrivateDataSlot *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice, const VkQueryPoolCreateInfo *, const VkAllocationCallbacks *, VkQueryPool *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRayTracingPipelinesKHR)(VkDevice, VkDeferredOperationKHR, VkPipelineCache, uint32_t, const VkRayTracingPipelineCreateInfoKHR *, const VkAllocationCallbacks *, VkPipeline *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRayTracingPipelinesNV)(VkDevice, VkPipelineCache, uint32_t, const VkRayTracingPipelineCreateInfoNV *, const VkAllocationCallbacks *, VkPipeline *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice, const VkRenderPassCreateInfo *, const VkAllocationCallbacks *, VkRenderPass *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass2)(VkDevice, const VkRenderPassCreateInfo2 *, const VkAllocationCallbacks *, VkRenderPass *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass2KHR)(VkDevice, const VkRenderPassCreateInfo2 *, const VkAllocationCallbacks *, VkRenderPass *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice, const VkSamplerCreateInfo *, const VkAllocationCallbacks *, VkSampler *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSamplerYcbcrConversion)(VkDevice, const VkSamplerYcbcrConversionCreateInfo *, const VkAllocationCallbacks *, VkSamplerYcbcrConversion *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSamplerYcbcrConversionKHR)(VkDevice, const VkSamplerYcbcrConversionCreateInfo *, const VkAllocationCallbacks *, VkSamplerYcbcrConversion *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice, const VkSemaphoreCreateInfo *, const VkAllocationCallbacks *, VkSemaphore *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice, const VkShaderModuleCreateInfo *, const VkAllocationCallbacks *, VkShaderModule *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateShadersEXT)(VkDevice, uint32_t, const VkShaderCreateInfoEXT *, const VkAllocationCallbacks *, VkShaderEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice, const VkSwapchainCreateInfoKHR *, const VkAllocationCallbacks *, VkSwapchainKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateValidationCacheEXT)(VkDevice, const VkValidationCacheCreateInfoEXT *, const VkAllocationCallbacks *, VkValidationCacheEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice, const VkDebugMarkerObjectNameInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice, const VkDebugMarkerObjectTagInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance, VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *); -typedef VkResult (VKAPI_PTR *PFN_vkDeferredOperationJoinKHR)(VkDevice, VkDeferredOperationKHR); -typedef void (VKAPI_PTR *PFN_vkDestroyAccelerationStructureKHR)(VkDevice, VkAccelerationStructureKHR, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyAccelerationStructureNV)(VkDevice, VkAccelerationStructureNV, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice, VkBuffer, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice, VkBufferView, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice, VkCommandPool, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyCuFunctionNVX)(VkDevice, VkCuFunctionNVX, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyCuModuleNVX)(VkDevice, VkCuModuleNVX, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyCudaFunctionNV)(VkDevice, VkCudaFunctionNV, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyCudaModuleNV)(VkDevice, VkCudaModuleNV, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance, VkDebugReportCallbackEXT, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDebugUtilsMessengerEXT)(VkInstance, VkDebugUtilsMessengerEXT, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDeferredOperationKHR)(VkDevice, VkDeferredOperationKHR, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice, VkDescriptorPool, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice, VkDescriptorSetLayout, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplate)(VkDevice, VkDescriptorUpdateTemplate, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice, VkDescriptorUpdateTemplate, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice, VkEvent, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice, VkFence, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice, VkFramebuffer, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice, VkImage, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice, VkImageView, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyIndirectCommandsLayoutNV)(VkDevice, VkIndirectCommandsLayoutNV, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyMicromapEXT)(VkDevice, VkMicromapEXT, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyOpticalFlowSessionNV)(VkDevice, VkOpticalFlowSessionNV, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice, VkPipeline, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice, VkPipelineCache, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice, VkPipelineLayout, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyPrivateDataSlot)(VkDevice, VkPrivateDataSlot, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyPrivateDataSlotEXT)(VkDevice, VkPrivateDataSlot, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice, VkQueryPool, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice, VkRenderPass, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice, VkSampler, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroySamplerYcbcrConversion)(VkDevice, VkSamplerYcbcrConversion, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroySamplerYcbcrConversionKHR)(VkDevice, VkSamplerYcbcrConversion, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice, VkSemaphore, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyShaderEXT)(VkDevice, VkShaderEXT, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice, VkShaderModule, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice, VkSwapchainKHR, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkDestroyValidationCacheEXT)(VkDevice, VkValidationCacheEXT, const VkAllocationCallbacks *); -typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice); -typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice, const char *, uint32_t *, VkExtensionProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice, uint32_t *, VkLayerProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char *, uint32_t *, VkExtensionProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t *, VkLayerProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceVersion)(uint32_t *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroups)(VkInstance, uint32_t *, VkPhysicalDeviceGroupProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroupsKHR)(VkInstance, uint32_t *, VkPhysicalDeviceGroupProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR)(VkPhysicalDevice, uint32_t, uint32_t *, VkPerformanceCounterKHR *, VkPerformanceCounterDescriptionKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance, uint32_t *, VkPhysicalDevice *); -typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange *); -typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice, VkCommandPool, uint32_t, const VkCommandBuffer *); -typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice, VkDescriptorPool, uint32_t, const VkDescriptorSet *); -typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice, VkDeviceMemory, const VkAllocationCallbacks *); -typedef void (VKAPI_PTR *PFN_vkGetAccelerationStructureBuildSizesKHR)(VkDevice, VkAccelerationStructureBuildTypeKHR, const VkAccelerationStructureBuildGeometryInfoKHR *, const uint32_t *, VkAccelerationStructureBuildSizesInfoKHR *); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetAccelerationStructureDeviceAddressKHR)(VkDevice, const VkAccelerationStructureDeviceAddressInfoKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetAccelerationStructureHandleNV)(VkDevice, VkAccelerationStructureNV, size_t, void *); -typedef void (VKAPI_PTR *PFN_vkGetAccelerationStructureMemoryRequirementsNV)(VkDevice, const VkAccelerationStructureMemoryRequirementsInfoNV *, VkMemoryRequirements2KHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkAccelerationStructureCaptureDescriptorDataInfoEXT *, void *); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetBufferDeviceAddress)(VkDevice, const VkBufferDeviceAddressInfo *); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetBufferDeviceAddressEXT)(VkDevice, const VkBufferDeviceAddressInfo *); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetBufferDeviceAddressKHR)(VkDevice, const VkBufferDeviceAddressInfo *); -typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice, VkBuffer, VkMemoryRequirements *); -typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2)(VkDevice, const VkBufferMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice, const VkBufferMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); -typedef uint64_t (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureAddress)(VkDevice, const VkBufferDeviceAddressInfo *); -typedef uint64_t (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureAddressKHR)(VkDevice, const VkBufferDeviceAddressInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkBufferCaptureDescriptorDataInfoEXT *, void *); -typedef VkResult (VKAPI_PTR *PFN_vkGetCalibratedTimestampsEXT)(VkDevice, uint32_t, const VkCalibratedTimestampInfoEXT *, uint64_t *, uint64_t *); -typedef VkResult (VKAPI_PTR *PFN_vkGetCudaModuleCacheNV)(VkDevice, VkCudaModuleNV, size_t *, void *); -typedef uint32_t (VKAPI_PTR *PFN_vkGetDeferredOperationMaxConcurrencyKHR)(VkDevice, VkDeferredOperationKHR); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeferredOperationResultKHR)(VkDevice, VkDeferredOperationKHR); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorEXT)(VkDevice, const VkDescriptorGetInfoEXT *, size_t, void *); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetHostMappingVALVE)(VkDevice, VkDescriptorSet, void **); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)(VkDevice, VkDescriptorSetLayout, uint32_t, VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)(VkDevice, const VkDescriptorSetBindingReferenceVALVE *, VkDescriptorSetLayoutHostMappingInfoVALVE *); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSizeEXT)(VkDevice, VkDescriptorSetLayout, VkDeviceSize *); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSupport)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, VkDescriptorSetLayoutSupport *); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSupportKHR)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, VkDescriptorSetLayoutSupport *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)(VkDevice, const VkAccelerationStructureVersionInfoKHR *, VkAccelerationStructureCompatibilityKHR *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceBufferMemoryRequirements)(VkDevice, const VkDeviceBufferMemoryRequirements *, VkMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceBufferMemoryRequirementsKHR)(VkDevice, const VkDeviceBufferMemoryRequirements *, VkMemoryRequirements2 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceFaultInfoEXT)(VkDevice, VkDeviceFaultCountsEXT *, VkDeviceFaultInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeatures)(VkDevice, uint32_t, uint32_t, uint32_t, VkPeerMemoryFeatureFlags *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR)(VkDevice, uint32_t, uint32_t, uint32_t, VkPeerMemoryFeatureFlags *); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHR)(VkDevice, VkDeviceGroupPresentCapabilitiesKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKHR, VkDeviceGroupPresentModeFlagsKHR *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceImageMemoryRequirements)(VkDevice, const VkDeviceImageMemoryRequirements *, VkMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceImageMemoryRequirementsKHR)(VkDevice, const VkDeviceImageMemoryRequirements *, VkMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceImageSparseMemoryRequirements)(VkDevice, const VkDeviceImageMemoryRequirements *, uint32_t *, VkSparseImageMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)(VkDevice, const VkDeviceImageMemoryRequirements *, uint32_t *, VkSparseImageMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceImageSubresourceLayoutKHR)(VkDevice, const VkDeviceImageSubresourceInfoKHR *, VkSubresourceLayout2KHR *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice, VkDeviceMemory, VkDeviceSize *); -typedef uint64_t (VKAPI_PTR *PFN_vkGetDeviceMemoryOpaqueCaptureAddress)(VkDevice, const VkDeviceMemoryOpaqueCaptureAddressInfo *); -typedef uint64_t (VKAPI_PTR *PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)(VkDevice, const VkDeviceMemoryOpaqueCaptureAddressInfo *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceMicromapCompatibilityEXT)(VkDevice, const VkMicromapVersionInfoEXT *, VkAccelerationStructureCompatibilityKHR *); -typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice, const char *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice, uint32_t, uint32_t, VkQueue *); -typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue2)(VkDevice, const VkDeviceQueueInfo2 *, VkQueue *); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI)(VkDevice, VkRenderPass, VkExtent2D *); -typedef VkResult (VKAPI_PTR *PFN_vkGetDynamicRenderingTilePropertiesQCOM)(VkDevice, const VkRenderingInfo *, VkTilePropertiesQCOM *); -typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice, VkEvent); -typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice, VkFence); -typedef VkResult (VKAPI_PTR *PFN_vkGetFramebufferTilePropertiesQCOM)(VkDevice, VkFramebuffer, uint32_t *, VkTilePropertiesQCOM *); -typedef void (VKAPI_PTR *PFN_vkGetGeneratedCommandsMemoryRequirementsNV)(VkDevice, const VkGeneratedCommandsMemoryRequirementsInfoNV *, VkMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice, VkImage, VkMemoryRequirements *); -typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2)(VkDevice, const VkImageMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice, const VkImageMemoryRequirementsInfo2 *, VkMemoryRequirements2 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkImageCaptureDescriptorDataInfoEXT *, void *); -typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice, VkImage, uint32_t *, VkSparseImageMemoryRequirements *); -typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice, const VkImageSparseMemoryRequirementsInfo2 *, uint32_t *, VkSparseImageMemoryRequirements2 *); -typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout *); -typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2EXT)(VkDevice, VkImage, const VkImageSubresource2KHR *, VkSubresourceLayout2KHR *); -typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2KHR)(VkDevice, VkImage, const VkImageSubresource2KHR *, VkSubresourceLayout2KHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetImageViewAddressNVX)(VkDevice, VkImageView, VkImageViewAddressPropertiesNVX *); -typedef uint32_t (VKAPI_PTR *PFN_vkGetImageViewHandleNVX)(VkDevice, const VkImageViewHandleInfoNVX *); -typedef VkResult (VKAPI_PTR *PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkImageViewCaptureDescriptorDataInfoEXT *, void *); -typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance, const char *); -typedef void (VKAPI_PTR *PFN_vkGetLatencyTimingsNV)(VkDevice, VkSwapchainKHR, VkGetLatencyMarkerInfoNV *); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryHostPointerPropertiesEXT)(VkDevice, VkExternalMemoryHandleTypeFlagBits, const void *, VkMemoryHostPointerPropertiesEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice, const VkMemoryGetWin32HandleInfoKHR *, HANDLE *); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice, VkExternalMemoryHandleTypeFlagBits, HANDLE, VkMemoryWin32HandlePropertiesKHR *); -typedef void (VKAPI_PTR *PFN_vkGetMicromapBuildSizesEXT)(VkDevice, VkAccelerationStructureBuildTypeKHR, const VkMicromapBuildInfoEXT *, VkMicromapBuildSizesInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPerformanceParameterINTEL)(VkDevice, VkPerformanceParameterTypeINTEL, VkPerformanceValueINTEL *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)(VkPhysicalDevice, uint32_t *, VkTimeDomainEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR)(VkPhysicalDevice, uint32_t *, VkCooperativeMatrixPropertiesKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)(VkPhysicalDevice, uint32_t *, VkCooperativeMatrixPropertiesNV *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalFenceInfo *, VkExternalFenceProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *, VkExternalSemaphoreProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *, VkExternalSemaphoreProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice, VkPhysicalDeviceFeatures *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice, VkPhysicalDeviceFeatures2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice, VkFormat, VkFormatProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2)(VkPhysicalDevice, VkFormat, VkFormatProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice, VkFormat, VkFormatProperties2 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR)(VkPhysicalDevice, uint32_t *, VkPhysicalDeviceFragmentShadingRateKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice, VkFormat, VkImageType, VkImageTiling, VkImageUsageFlags, VkImageCreateFlags, VkImageFormatProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceImageFormatInfo2 *, VkImageFormatProperties2 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice, const VkPhysicalDeviceImageFormatInfo2 *, VkImageFormatProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2)(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceMemoryProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT)(VkPhysicalDevice, VkSampleCountFlagBits, VkMultisamplePropertiesEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)(VkPhysicalDevice, const VkOpticalFlowImageFormatInfoNV *, uint32_t *, VkOpticalFlowImageFormatPropertiesNV *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice, VkPhysicalDeviceProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice, VkPhysicalDeviceProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR)(VkPhysicalDevice, const VkQueryPoolPerformanceCreateInfoKHR *, uint32_t *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice, uint32_t *, VkQueueFamilyProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2)(VkPhysicalDevice, uint32_t *, VkQueueFamilyProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice, uint32_t *, VkQueueFamilyProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice, VkFormat, VkImageType, VkSampleCountFlagBits, VkImageUsageFlags, VkImageTiling, uint32_t *, VkSparseImageFormatProperties *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *, uint32_t *, VkSparseImageFormatProperties2 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)(VkPhysicalDevice, uint32_t *, VkFramebufferMixedSamplesCombinationNV *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceToolProperties)(VkPhysicalDevice, uint32_t *, VkPhysicalDeviceToolProperties *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceToolPropertiesEXT)(VkPhysicalDevice, uint32_t *, VkPhysicalDeviceToolProperties *); -typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice, VkPipelineCache, size_t *, void *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutableInternalRepresentationsKHR)(VkDevice, const VkPipelineExecutableInfoKHR *, uint32_t *, VkPipelineExecutableInternalRepresentationKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutablePropertiesKHR)(VkDevice, const VkPipelineInfoKHR *, uint32_t *, VkPipelineExecutablePropertiesKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutableStatisticsKHR)(VkDevice, const VkPipelineExecutableInfoKHR *, uint32_t *, VkPipelineExecutableStatisticKHR *); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetPipelineIndirectDeviceAddressNV)(VkDevice, const VkPipelineIndirectDeviceAddressInfoNV *); -typedef void (VKAPI_PTR *PFN_vkGetPipelineIndirectMemoryRequirementsNV)(VkDevice, const VkComputePipelineCreateInfo *, VkMemoryRequirements2 *); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelinePropertiesEXT)(VkDevice, const VkPipelineInfoEXT *, VkBaseOutStructure *); -typedef void (VKAPI_PTR *PFN_vkGetPrivateData)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t *); -typedef void (VKAPI_PTR *PFN_vkGetPrivateDataEXT)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t *); -typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice, VkQueryPool, uint32_t, uint32_t, size_t, void *, VkDeviceSize, VkQueryResultFlags); -typedef void (VKAPI_PTR *PFN_vkGetQueueCheckpointData2NV)(VkQueue, uint32_t *, VkCheckpointData2NV *); -typedef void (VKAPI_PTR *PFN_vkGetQueueCheckpointDataNV)(VkQueue, uint32_t *, VkCheckpointDataNV *); -typedef VkResult (VKAPI_PTR *PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)(VkDevice, VkPipeline, uint32_t, uint32_t, size_t, void *); -typedef VkResult (VKAPI_PTR *PFN_vkGetRayTracingShaderGroupHandlesKHR)(VkDevice, VkPipeline, uint32_t, uint32_t, size_t, void *); -typedef VkResult (VKAPI_PTR *PFN_vkGetRayTracingShaderGroupHandlesNV)(VkDevice, VkPipeline, uint32_t, uint32_t, size_t, void *); -typedef VkDeviceSize (VKAPI_PTR *PFN_vkGetRayTracingShaderGroupStackSizeKHR)(VkDevice, VkPipeline, uint32_t, VkShaderGroupShaderKHR); -typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice, VkRenderPass, VkExtent2D *); -typedef void (VKAPI_PTR *PFN_vkGetRenderingAreaGranularityKHR)(VkDevice, const VkRenderingAreaInfoKHR *, VkExtent2D *); -typedef VkResult (VKAPI_PTR *PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)(VkDevice, const VkSamplerCaptureDescriptorDataInfoEXT *, void *); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreCounterValue)(VkDevice, VkSemaphore, uint64_t *); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreCounterValueKHR)(VkDevice, VkSemaphore, uint64_t *); -typedef VkResult (VKAPI_PTR *PFN_vkGetShaderBinaryDataEXT)(VkDevice, VkShaderEXT, size_t *, void *); -typedef VkResult (VKAPI_PTR *PFN_vkGetShaderInfoAMD)(VkDevice, VkPipeline, VkShaderStageFlagBits, VkShaderInfoTypeAMD, size_t *, void *); -typedef void (VKAPI_PTR *PFN_vkGetShaderModuleCreateInfoIdentifierEXT)(VkDevice, const VkShaderModuleCreateInfo *, VkShaderModuleIdentifierEXT *); -typedef void (VKAPI_PTR *PFN_vkGetShaderModuleIdentifierEXT)(VkDevice, VkShaderModule, VkShaderModuleIdentifierEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *); -typedef VkResult (VKAPI_PTR *PFN_vkGetValidationCacheDataEXT)(VkDevice, VkValidationCacheEXT, size_t *, void *); -typedef VkResult (VKAPI_PTR *PFN_vkInitializePerformanceApiINTEL)(VkDevice, const VkInitializePerformanceApiInfoINTEL *); -typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange *); -typedef VkResult (VKAPI_PTR *PFN_vkLatencySleepNV)(VkDevice, VkSwapchainKHR, const VkLatencySleepInfoNV *); -typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice, VkDeviceMemory, VkDeviceSize, VkDeviceSize, VkMemoryMapFlags, void **); -typedef VkResult (VKAPI_PTR *PFN_vkMapMemory2KHR)(VkDevice, const VkMemoryMapInfoKHR *, void **); -typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice, VkPipelineCache, uint32_t, const VkPipelineCache *); -typedef VkResult (VKAPI_PTR *PFN_vkMergeValidationCachesEXT)(VkDevice, VkValidationCacheEXT, uint32_t, const VkValidationCacheEXT *); -typedef void (VKAPI_PTR *PFN_vkQueueBeginDebugUtilsLabelEXT)(VkQueue, const VkDebugUtilsLabelEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue, uint32_t, const VkBindSparseInfo *, VkFence); -typedef void (VKAPI_PTR *PFN_vkQueueEndDebugUtilsLabelEXT)(VkQueue); -typedef void (VKAPI_PTR *PFN_vkQueueInsertDebugUtilsLabelEXT)(VkQueue, const VkDebugUtilsLabelEXT *); -typedef void (VKAPI_PTR *PFN_vkQueueNotifyOutOfBandNV)(VkQueue, const VkOutOfBandQueueTypeInfoNV *); -typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSetPerformanceConfigurationINTEL)(VkQueue, VkPerformanceConfigurationINTEL); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue, uint32_t, const VkSubmitInfo *, VkFence); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit2)(VkQueue, uint32_t, const VkSubmitInfo2 *, VkFence); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit2KHR)(VkQueue, uint32_t, const VkSubmitInfo2 *, VkFence); -typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue); -typedef VkResult (VKAPI_PTR *PFN_vkReleasePerformanceConfigurationINTEL)(VkDevice, VkPerformanceConfigurationINTEL); -typedef void (VKAPI_PTR *PFN_vkReleaseProfilingLockKHR)(VkDevice); -typedef VkResult (VKAPI_PTR *PFN_vkReleaseSwapchainImagesEXT)(VkDevice, const VkReleaseSwapchainImagesInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer, VkCommandBufferResetFlags); -typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice, VkCommandPool, VkCommandPoolResetFlags); -typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice, VkDescriptorPool, VkDescriptorPoolResetFlags); -typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice, VkEvent); -typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice, uint32_t, const VkFence *); -typedef void (VKAPI_PTR *PFN_vkResetQueryPool)(VkDevice, VkQueryPool, uint32_t, uint32_t); -typedef void (VKAPI_PTR *PFN_vkResetQueryPoolEXT)(VkDevice, VkQueryPool, uint32_t, uint32_t); -typedef VkResult (VKAPI_PTR *PFN_vkSetDebugUtilsObjectNameEXT)(VkDevice, const VkDebugUtilsObjectNameInfoEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkSetDebugUtilsObjectTagEXT)(VkDevice, const VkDebugUtilsObjectTagInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkSetDeviceMemoryPriorityEXT)(VkDevice, VkDeviceMemory, float); -typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice, VkEvent); -typedef void (VKAPI_PTR *PFN_vkSetHdrMetadataEXT)(VkDevice, uint32_t, const VkSwapchainKHR *, const VkHdrMetadataEXT *); -typedef void (VKAPI_PTR *PFN_vkSetLatencyMarkerNV)(VkDevice, VkSwapchainKHR, const VkSetLatencyMarkerInfoNV *); -typedef VkResult (VKAPI_PTR *PFN_vkSetLatencySleepModeNV)(VkDevice, VkSwapchainKHR, const VkLatencySleepModeInfoNV *); -typedef VkResult (VKAPI_PTR *PFN_vkSetPrivateData)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t); -typedef VkResult (VKAPI_PTR *PFN_vkSetPrivateDataEXT)(VkDevice, VkObjectType, uint64_t, VkPrivateDataSlot, uint64_t); -typedef VkResult (VKAPI_PTR *PFN_vkSignalSemaphore)(VkDevice, const VkSemaphoreSignalInfo *); -typedef VkResult (VKAPI_PTR *PFN_vkSignalSemaphoreKHR)(VkDevice, const VkSemaphoreSignalInfo *); -typedef void (VKAPI_PTR *PFN_vkSubmitDebugUtilsMessageEXT)(VkInstance, VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *); -typedef VkResult (VKAPI_PTR *PFN_vkTransitionImageLayoutEXT)(VkDevice, uint32_t, const VkHostImageLayoutTransitionInfoEXT *); -typedef void (VKAPI_PTR *PFN_vkTrimCommandPool)(VkDevice, VkCommandPool, VkCommandPoolTrimFlags); -typedef void (VKAPI_PTR *PFN_vkTrimCommandPoolKHR)(VkDevice, VkCommandPool, VkCommandPoolTrimFlags); -typedef void (VKAPI_PTR *PFN_vkUninitializePerformanceApiINTEL)(VkDevice); -typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice, VkDeviceMemory); -typedef VkResult (VKAPI_PTR *PFN_vkUnmapMemory2KHR)(VkDevice, const VkMemoryUnmapInfoKHR *); -typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplate)(VkDevice, VkDescriptorSet, VkDescriptorUpdateTemplate, const void *); -typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice, VkDescriptorSet, VkDescriptorUpdateTemplate, const void *); -typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice, uint32_t, const VkWriteDescriptorSet *, uint32_t, const VkCopyDescriptorSet *); -typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice, uint32_t, const VkFence *, VkBool32, uint64_t); -typedef VkResult (VKAPI_PTR *PFN_vkWaitForPresentKHR)(VkDevice, VkSwapchainKHR, uint64_t, uint64_t); -typedef VkResult (VKAPI_PTR *PFN_vkWaitSemaphores)(VkDevice, const VkSemaphoreWaitInfo *, uint64_t); -typedef VkResult (VKAPI_PTR *PFN_vkWaitSemaphoresKHR)(VkDevice, const VkSemaphoreWaitInfo *, uint64_t); -typedef VkResult (VKAPI_PTR *PFN_vkWriteAccelerationStructuresPropertiesKHR)(VkDevice, uint32_t, const VkAccelerationStructureKHR *, VkQueryType, size_t, void *, size_t); -typedef VkResult (VKAPI_PTR *PFN_vkWriteMicromapsPropertiesEXT)(VkDevice, uint32_t, const VkMicromapEXT *, VkQueryType, size_t, void *, size_t); - -#ifndef VK_NO_PROTOTYPES -VkResult VKAPI_CALL vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, uint32_t *pImageIndex); -VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex); -VkResult VKAPI_CALL vkAcquirePerformanceConfigurationINTEL(VkDevice device, const VkPerformanceConfigurationAcquireInfoINTEL *pAcquireInfo, VkPerformanceConfigurationINTEL *pConfiguration); -VkResult VKAPI_CALL vkAcquireProfilingLockKHR(VkDevice device, const VkAcquireProfilingLockInfoKHR *pInfo); -VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers); -VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets); -VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory); -VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo); -VkResult VKAPI_CALL vkBindAccelerationStructureMemoryNV(VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNV *pBindInfos); -VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); -VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos); -VkResult VKAPI_CALL vkBindBufferMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos); -VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); -VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos); -VkResult VKAPI_CALL vkBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos); -VkResult VKAPI_CALL vkBindOpticalFlowSessionImageNV(VkDevice device, VkOpticalFlowSessionNV session, VkOpticalFlowSessionBindingPointNV bindingPoint, VkImageView view, VkImageLayout layout); -VkResult VKAPI_CALL vkBuildAccelerationStructuresKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, const VkAccelerationStructureBuildRangeInfoKHR * const*ppBuildRangeInfos); -VkResult VKAPI_CALL vkBuildMicromapsEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkMicromapBuildInfoEXT *pInfos); -void VKAPI_CALL vkCmdBeginConditionalRenderingEXT(VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin); -void VKAPI_CALL vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo); -void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); -void VKAPI_CALL vkCmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags, uint32_t index); -void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents); -void VKAPI_CALL vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfo *pSubpassBeginInfo); -void VKAPI_CALL vkCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfo *pSubpassBeginInfo); -void VKAPI_CALL vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRenderingInfo); -void VKAPI_CALL vkCmdBeginRenderingKHR(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRenderingInfo); -void VKAPI_CALL vkCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, const VkDeviceSize *pCounterBufferOffsets); -void VKAPI_CALL vkCmdBindDescriptorBufferEmbeddedSamplersEXT(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set); -void VKAPI_CALL vkCmdBindDescriptorBuffersEXT(VkCommandBuffer commandBuffer, uint32_t bufferCount, const VkDescriptorBufferBindingInfoEXT *pBindingInfos); -void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets); -void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); -void VKAPI_CALL vkCmdBindIndexBuffer2KHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType); -void VKAPI_CALL vkCmdBindInvocationMaskHUAWEI(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout); -void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); -void VKAPI_CALL vkCmdBindPipelineShaderGroupNV(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline, uint32_t groupIndex); -void VKAPI_CALL vkCmdBindShadersEXT(VkCommandBuffer commandBuffer, uint32_t stageCount, const VkShaderStageFlagBits *pStages, const VkShaderEXT *pShaders); -void VKAPI_CALL vkCmdBindShadingRateImageNV(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout); -void VKAPI_CALL vkCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes); -void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets); -void VKAPI_CALL vkCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes, const VkDeviceSize *pStrides); -void VKAPI_CALL vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes, const VkDeviceSize *pStrides); -void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter); -void VKAPI_CALL vkCmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 *pBlitImageInfo); -void VKAPI_CALL vkCmdBlitImage2KHR(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 *pBlitImageInfo); -void VKAPI_CALL vkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset); -void VKAPI_CALL vkCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, const VkDeviceAddress *pIndirectDeviceAddresses, const uint32_t *pIndirectStrides, const uint32_t * const*ppMaxPrimitiveCounts); -void VKAPI_CALL vkCmdBuildAccelerationStructuresKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, const VkAccelerationStructureBuildRangeInfoKHR * const*ppBuildRangeInfos); -void VKAPI_CALL vkCmdBuildMicromapsEXT(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkMicromapBuildInfoEXT *pInfos); -void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment *pAttachments, uint32_t rectCount, const VkClearRect *pRects); -void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges); -void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges); -void VKAPI_CALL vkCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureInfoKHR *pInfo); -void VKAPI_CALL vkCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkCopyAccelerationStructureModeKHR mode); -void VKAPI_CALL vkCmdCopyAccelerationStructureToMemoryKHR(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo); -void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy *pRegions); -void VKAPI_CALL vkCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo); -void VKAPI_CALL vkCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo); -void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy *pRegions); -void VKAPI_CALL vkCmdCopyBufferToImage2(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo); -void VKAPI_CALL vkCmdCopyBufferToImage2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo); -void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions); -void VKAPI_CALL vkCmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 *pCopyImageInfo); -void VKAPI_CALL vkCmdCopyImage2KHR(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 *pCopyImageInfo); -void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions); -void VKAPI_CALL vkCmdCopyImageToBuffer2(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo); -void VKAPI_CALL vkCmdCopyImageToBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo); -void VKAPI_CALL vkCmdCopyMemoryIndirectNV(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride); -void VKAPI_CALL vkCmdCopyMemoryToAccelerationStructureKHR(VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo); -void VKAPI_CALL vkCmdCopyMemoryToImageIndirectNV(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride, VkImage dstImage, VkImageLayout dstImageLayout, const VkImageSubresourceLayers *pImageSubresources); -void VKAPI_CALL vkCmdCopyMemoryToMicromapEXT(VkCommandBuffer commandBuffer, const VkCopyMemoryToMicromapInfoEXT *pInfo); -void VKAPI_CALL vkCmdCopyMicromapEXT(VkCommandBuffer commandBuffer, const VkCopyMicromapInfoEXT *pInfo); -void VKAPI_CALL vkCmdCopyMicromapToMemoryEXT(VkCommandBuffer commandBuffer, const VkCopyMicromapToMemoryInfoEXT *pInfo); -void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); -void VKAPI_CALL vkCmdCuLaunchKernelNVX(VkCommandBuffer commandBuffer, const VkCuLaunchInfoNVX *pLaunchInfo); -void VKAPI_CALL vkCmdCudaLaunchKernelNV(VkCommandBuffer commandBuffer, const VkCudaLaunchInfoNV *pLaunchInfo); -void VKAPI_CALL vkCmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT *pMarkerInfo); -void VKAPI_CALL vkCmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT *pMarkerInfo); -void VKAPI_CALL vkCmdDecompressMemoryIndirectCountNV(VkCommandBuffer commandBuffer, VkDeviceAddress indirectCommandsAddress, VkDeviceAddress indirectCommandsCountAddress, uint32_t stride); -void VKAPI_CALL vkCmdDecompressMemoryNV(VkCommandBuffer commandBuffer, uint32_t decompressRegionCount, const VkDecompressMemoryRegionNV *pDecompressMemoryRegions); -void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -void VKAPI_CALL vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -void VKAPI_CALL vkCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); -void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); -void VKAPI_CALL vkCmdDrawClusterHUAWEI(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -void VKAPI_CALL vkCmdDrawClusterIndirectHUAWEI(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); -void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); -void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance, VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride); -void VKAPI_CALL vkCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawMeshTasksEXT(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawMeshTasksIndirectEXT(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -void VKAPI_CALL vkCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask); -void VKAPI_CALL vkCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride); -void VKAPI_CALL vkCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset); -void VKAPI_CALL vkCmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); -void VKAPI_CALL vkCmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, uint32_t index); -void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo *pSubpassEndInfo); -void VKAPI_CALL vkCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfo *pSubpassEndInfo); -void VKAPI_CALL vkCmdEndRendering(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdEndRenderingKHR(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, const VkDeviceSize *pCounterBufferOffsets); -void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers); -void VKAPI_CALL vkCmdExecuteGeneratedCommandsNV(VkCommandBuffer commandBuffer, VkBool32 isPreprocessed, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo); -void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); -void VKAPI_CALL vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo); -void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents); -void VKAPI_CALL vkCmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo *pSubpassBeginInfo, const VkSubpassEndInfo *pSubpassEndInfo); -void VKAPI_CALL vkCmdNextSubpass2KHR(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo *pSubpassBeginInfo, const VkSubpassEndInfo *pSubpassEndInfo); -void VKAPI_CALL vkCmdOpticalFlowExecuteNV(VkCommandBuffer commandBuffer, VkOpticalFlowSessionNV session, const VkOpticalFlowExecuteInfoNV *pExecuteInfo); -void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers); -void VKAPI_CALL vkCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo *pDependencyInfo); -void VKAPI_CALL vkCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer, const VkDependencyInfo *pDependencyInfo); -void VKAPI_CALL vkCmdPreprocessGeneratedCommandsNV(VkCommandBuffer commandBuffer, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo); -void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void *pValues); -void VKAPI_CALL vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites); -void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void *pData); -void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); -void VKAPI_CALL vkCmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask); -void VKAPI_CALL vkCmdResetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask); -void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); -void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions); -void VKAPI_CALL vkCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 *pResolveImageInfo); -void VKAPI_CALL vkCmdResolveImage2KHR(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 *pResolveImageInfo); -void VKAPI_CALL vkCmdSetAlphaToCoverageEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToCoverageEnable); -void VKAPI_CALL vkCmdSetAlphaToOneEnableEXT(VkCommandBuffer commandBuffer, VkBool32 alphaToOneEnable); -void VKAPI_CALL vkCmdSetAttachmentFeedbackLoopEnableEXT(VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask); -void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]); -void VKAPI_CALL vkCmdSetCheckpointNV(VkCommandBuffer commandBuffer, const void *pCheckpointMarker); -void VKAPI_CALL vkCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV *pCustomSampleOrders); -void VKAPI_CALL vkCmdSetColorBlendAdvancedEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendAdvancedEXT *pColorBlendAdvanced); -void VKAPI_CALL vkCmdSetColorBlendEnableEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkBool32 *pColorBlendEnables); -void VKAPI_CALL vkCmdSetColorBlendEquationEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendEquationEXT *pColorBlendEquations); -void VKAPI_CALL vkCmdSetColorWriteEnableEXT(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkBool32 *pColorWriteEnables); -void VKAPI_CALL vkCmdSetColorWriteMaskEXT(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorComponentFlags *pColorWriteMasks); -void VKAPI_CALL vkCmdSetConservativeRasterizationModeEXT(VkCommandBuffer commandBuffer, VkConservativeRasterizationModeEXT conservativeRasterizationMode); -void VKAPI_CALL vkCmdSetCoverageModulationModeNV(VkCommandBuffer commandBuffer, VkCoverageModulationModeNV coverageModulationMode); -void VKAPI_CALL vkCmdSetCoverageModulationTableEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageModulationTableEnable); -void VKAPI_CALL vkCmdSetCoverageModulationTableNV(VkCommandBuffer commandBuffer, uint32_t coverageModulationTableCount, const float *pCoverageModulationTable); -void VKAPI_CALL vkCmdSetCoverageReductionModeNV(VkCommandBuffer commandBuffer, VkCoverageReductionModeNV coverageReductionMode); -void VKAPI_CALL vkCmdSetCoverageToColorEnableNV(VkCommandBuffer commandBuffer, VkBool32 coverageToColorEnable); -void VKAPI_CALL vkCmdSetCoverageToColorLocationNV(VkCommandBuffer commandBuffer, uint32_t coverageToColorLocation); -void VKAPI_CALL vkCmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); -void VKAPI_CALL vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); -void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); -void VKAPI_CALL vkCmdSetDepthBias2EXT(VkCommandBuffer commandBuffer, const VkDepthBiasInfoEXT *pDepthBiasInfo); -void VKAPI_CALL vkCmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable); -void VKAPI_CALL vkCmdSetDepthBiasEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable); -void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); -void VKAPI_CALL vkCmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable); -void VKAPI_CALL vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable); -void VKAPI_CALL vkCmdSetDepthClampEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClampEnable); -void VKAPI_CALL vkCmdSetDepthClipEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthClipEnable); -void VKAPI_CALL vkCmdSetDepthClipNegativeOneToOneEXT(VkCommandBuffer commandBuffer, VkBool32 negativeOneToOne); -void VKAPI_CALL vkCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp); -void VKAPI_CALL vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp); -void VKAPI_CALL vkCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); -void VKAPI_CALL vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); -void VKAPI_CALL vkCmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); -void VKAPI_CALL vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); -void VKAPI_CALL vkCmdSetDescriptorBufferOffsetsEXT(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const uint32_t *pBufferIndices, const VkDeviceSize *pOffsets); -void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask); -void VKAPI_CALL vkCmdSetDeviceMaskKHR(VkCommandBuffer commandBuffer, uint32_t deviceMask); -void VKAPI_CALL vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles); -void VKAPI_CALL vkCmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable); -void VKAPI_CALL vkCmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode); -void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); -void VKAPI_CALL vkCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo *pDependencyInfo); -void VKAPI_CALL vkCmdSetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo *pDependencyInfo); -void VKAPI_CALL vkCmdSetExclusiveScissorEnableNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkBool32 *pExclusiveScissorEnables); -void VKAPI_CALL vkCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors); -void VKAPI_CALL vkCmdSetExtraPrimitiveOverestimationSizeEXT(VkCommandBuffer commandBuffer, float extraPrimitiveOverestimationSize); -void VKAPI_CALL vkCmdSetFragmentShadingRateEnumNV(VkCommandBuffer commandBuffer, VkFragmentShadingRateNV shadingRate, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); -void VKAPI_CALL vkCmdSetFragmentShadingRateKHR(VkCommandBuffer commandBuffer, const VkExtent2D *pFragmentSize, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); -void VKAPI_CALL vkCmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace); -void VKAPI_CALL vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, VkFrontFace frontFace); -void VKAPI_CALL vkCmdSetLineRasterizationModeEXT(VkCommandBuffer commandBuffer, VkLineRasterizationModeEXT lineRasterizationMode); -void VKAPI_CALL vkCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern); -void VKAPI_CALL vkCmdSetLineStippleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stippledLineEnable); -void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth); -void VKAPI_CALL vkCmdSetLogicOpEXT(VkCommandBuffer commandBuffer, VkLogicOp logicOp); -void VKAPI_CALL vkCmdSetLogicOpEnableEXT(VkCommandBuffer commandBuffer, VkBool32 logicOpEnable); -void VKAPI_CALL vkCmdSetPatchControlPointsEXT(VkCommandBuffer commandBuffer, uint32_t patchControlPoints); -VkResult VKAPI_CALL vkCmdSetPerformanceMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceMarkerInfoINTEL *pMarkerInfo); -VkResult VKAPI_CALL vkCmdSetPerformanceOverrideINTEL(VkCommandBuffer commandBuffer, const VkPerformanceOverrideInfoINTEL *pOverrideInfo); -VkResult VKAPI_CALL vkCmdSetPerformanceStreamMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceStreamMarkerInfoINTEL *pMarkerInfo); -void VKAPI_CALL vkCmdSetPolygonModeEXT(VkCommandBuffer commandBuffer, VkPolygonMode polygonMode); -void VKAPI_CALL vkCmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable); -void VKAPI_CALL vkCmdSetPrimitiveRestartEnableEXT(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable); -void VKAPI_CALL vkCmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); -void VKAPI_CALL vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); -void VKAPI_CALL vkCmdSetProvokingVertexModeEXT(VkCommandBuffer commandBuffer, VkProvokingVertexModeEXT provokingVertexMode); -void VKAPI_CALL vkCmdSetRasterizationSamplesEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits rasterizationSamples); -void VKAPI_CALL vkCmdSetRasterizationStreamEXT(VkCommandBuffer commandBuffer, uint32_t rasterizationStream); -void VKAPI_CALL vkCmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable); -void VKAPI_CALL vkCmdSetRasterizerDiscardEnableEXT(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable); -void VKAPI_CALL vkCmdSetRayTracingPipelineStackSizeKHR(VkCommandBuffer commandBuffer, uint32_t pipelineStackSize); -void VKAPI_CALL vkCmdSetRepresentativeFragmentTestEnableNV(VkCommandBuffer commandBuffer, VkBool32 representativeFragmentTestEnable); -void VKAPI_CALL vkCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT *pSampleLocationsInfo); -void VKAPI_CALL vkCmdSetSampleLocationsEnableEXT(VkCommandBuffer commandBuffer, VkBool32 sampleLocationsEnable); -void VKAPI_CALL vkCmdSetSampleMaskEXT(VkCommandBuffer commandBuffer, VkSampleCountFlagBits samples, const VkSampleMask *pSampleMask); -void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors); -void VKAPI_CALL vkCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors); -void VKAPI_CALL vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors); -void VKAPI_CALL vkCmdSetShadingRateImageEnableNV(VkCommandBuffer commandBuffer, VkBool32 shadingRateImageEnable); -void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); -void VKAPI_CALL vkCmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp); -void VKAPI_CALL vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp); -void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); -void VKAPI_CALL vkCmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable); -void VKAPI_CALL vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable); -void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); -void VKAPI_CALL vkCmdSetTessellationDomainOriginEXT(VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin); -void VKAPI_CALL vkCmdSetVertexInputEXT(VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions); -void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports); -void VKAPI_CALL vkCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV *pShadingRatePalettes); -void VKAPI_CALL vkCmdSetViewportSwizzleNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportSwizzleNV *pViewportSwizzles); -void VKAPI_CALL vkCmdSetViewportWScalingEnableNV(VkCommandBuffer commandBuffer, VkBool32 viewportWScalingEnable); -void VKAPI_CALL vkCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV *pViewportWScalings); -void VKAPI_CALL vkCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports); -void VKAPI_CALL vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports); -void VKAPI_CALL vkCmdSubpassShadingHUAWEI(VkCommandBuffer commandBuffer); -void VKAPI_CALL vkCmdTraceRaysIndirect2KHR(VkCommandBuffer commandBuffer, VkDeviceAddress indirectDeviceAddress); -void VKAPI_CALL vkCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, VkDeviceAddress indirectDeviceAddress); -void VKAPI_CALL vkCmdTraceRaysKHR(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width, uint32_t height, uint32_t depth); -void VKAPI_CALL vkCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, uint32_t width, uint32_t height, uint32_t depth); -void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData); -void VKAPI_CALL vkCmdUpdatePipelineIndirectBufferNV(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); -void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers); -void VKAPI_CALL vkCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, const VkDependencyInfo *pDependencyInfos); -void VKAPI_CALL vkCmdWaitEvents2KHR(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, const VkDependencyInfo *pDependencyInfos); -void VKAPI_CALL vkCmdWriteAccelerationStructuresPropertiesKHR(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery); -void VKAPI_CALL vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery); -void VKAPI_CALL vkCmdWriteBufferMarker2AMD(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker); -void VKAPI_CALL vkCmdWriteBufferMarkerAMD(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker); -void VKAPI_CALL vkCmdWriteMicromapsPropertiesEXT(VkCommandBuffer commandBuffer, uint32_t micromapCount, const VkMicromapEXT *pMicromaps, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery); -void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); -void VKAPI_CALL vkCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query); -void VKAPI_CALL vkCmdWriteTimestamp2KHR(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query); -VkResult VKAPI_CALL vkCompileDeferredNV(VkDevice device, VkPipeline pipeline, uint32_t shader); -VkResult VKAPI_CALL vkCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureInfoKHR *pInfo); -VkResult VKAPI_CALL vkCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo); -VkResult VKAPI_CALL vkCopyImageToImageEXT(VkDevice device, const VkCopyImageToImageInfoEXT *pCopyImageToImageInfo); -VkResult VKAPI_CALL vkCopyImageToMemoryEXT(VkDevice device, const VkCopyImageToMemoryInfoEXT *pCopyImageToMemoryInfo); -VkResult VKAPI_CALL vkCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo); -VkResult VKAPI_CALL vkCopyMemoryToImageEXT(VkDevice device, const VkCopyMemoryToImageInfoEXT *pCopyMemoryToImageInfo); -VkResult VKAPI_CALL vkCopyMemoryToMicromapEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToMicromapInfoEXT *pInfo); -VkResult VKAPI_CALL vkCopyMicromapEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapInfoEXT *pInfo); -VkResult VKAPI_CALL vkCopyMicromapToMemoryEXT(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapToMemoryInfoEXT *pInfo); -VkResult VKAPI_CALL vkCreateAccelerationStructureKHR(VkDevice device, const VkAccelerationStructureCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkAccelerationStructureKHR *pAccelerationStructure); -VkResult VKAPI_CALL vkCreateAccelerationStructureNV(VkDevice device, const VkAccelerationStructureCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkAccelerationStructureNV *pAccelerationStructure); -VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer); -VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBufferView *pView); -VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool); -VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines); -VkResult VKAPI_CALL vkCreateCuFunctionNVX(VkDevice device, const VkCuFunctionCreateInfoNVX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCuFunctionNVX *pFunction); -VkResult VKAPI_CALL vkCreateCuModuleNVX(VkDevice device, const VkCuModuleCreateInfoNVX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCuModuleNVX *pModule); -VkResult VKAPI_CALL vkCreateCudaFunctionNV(VkDevice device, const VkCudaFunctionCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCudaFunctionNV *pFunction); -VkResult VKAPI_CALL vkCreateCudaModuleNV(VkDevice device, const VkCudaModuleCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCudaModuleNV *pModule); -VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback); -VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger); -VkResult VKAPI_CALL vkCreateDeferredOperationKHR(VkDevice device, const VkAllocationCallbacks *pAllocator, VkDeferredOperationKHR *pDeferredOperation); -VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool); -VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout); -VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate); -VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate); -VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice); -VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent); -VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence); -VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer); -VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines); -VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage); -VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView); -VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNV(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkIndirectCommandsLayoutNV *pIndirectCommandsLayout); -VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance); -VkResult VKAPI_CALL vkCreateMicromapEXT(VkDevice device, const VkMicromapCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkMicromapEXT *pMicromap); -VkResult VKAPI_CALL vkCreateOpticalFlowSessionNV(VkDevice device, const VkOpticalFlowSessionCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkOpticalFlowSessionNV *pSession); -VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache); -VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout); -VkResult VKAPI_CALL vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPrivateDataSlot *pPrivateDataSlot); -VkResult VKAPI_CALL vkCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPrivateDataSlot *pPrivateDataSlot); -VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool); -VkResult VKAPI_CALL vkCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoKHR *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines); -VkResult VKAPI_CALL vkCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoNV *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines); -VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass); -VkResult VKAPI_CALL vkCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass); -VkResult VKAPI_CALL vkCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass); -VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSampler *pSampler); -VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion); -VkResult VKAPI_CALL vkCreateSamplerYcbcrConversionKHR(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion); -VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore); -VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule); -VkResult VKAPI_CALL vkCreateShadersEXT(VkDevice device, uint32_t createInfoCount, const VkShaderCreateInfoEXT *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkShaderEXT *pShaders); -VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain); -VkResult VKAPI_CALL vkCreateValidationCacheEXT(VkDevice device, const VkValidationCacheCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkValidationCacheEXT *pValidationCache); -VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); -VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo); -VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo); -void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage); -VkResult VKAPI_CALL vkDeferredOperationJoinKHR(VkDevice device, VkDeferredOperationKHR operation); -void VKAPI_CALL vkDestroyAccelerationStructureKHR(VkDevice device, VkAccelerationStructureKHR accelerationStructure, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyAccelerationStructureNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyCuFunctionNVX(VkDevice device, VkCuFunctionNVX function, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyCuModuleNVX(VkDevice device, VkCuModuleNVX module, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyCudaFunctionNV(VkDevice device, VkCudaFunctionNV function, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyCudaModuleNV(VkDevice device, VkCudaModuleNV module, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDeferredOperationKHR(VkDevice device, VkDeferredOperationKHR operation, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyIndirectCommandsLayoutNV(VkDevice device, VkIndirectCommandsLayoutNV indirectCommandsLayout, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyMicromapEXT(VkDevice device, VkMicromapEXT micromap, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyOpticalFlowSessionNV(VkDevice device, VkOpticalFlowSessionNV session, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyPrivateDataSlotEXT(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroySamplerYcbcrConversionKHR(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyShaderEXT(VkDevice device, VkShaderEXT shader, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkDestroyValidationCacheEXT(VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks *pAllocator); -VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device); -VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer); -VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties); -VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties); -VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties); -VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties); -VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion); -VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties); -VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHR(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties); -VkResult VKAPI_CALL vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, uint32_t *pCounterCount, VkPerformanceCounterKHR *pCounters, VkPerformanceCounterDescriptionKHR *pCounterDescriptions); -VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices); -VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges); -void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers); -VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets); -void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator); -void VKAPI_CALL vkGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo, const uint32_t *pMaxPrimitiveCounts, VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo); -VkDeviceAddress VKAPI_CALL vkGetAccelerationStructureDeviceAddressKHR(VkDevice device, const VkAccelerationStructureDeviceAddressInfoKHR *pInfo); -VkResult VKAPI_CALL vkGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, size_t dataSize, void *pData); -void VKAPI_CALL vkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNV *pInfo, VkMemoryRequirements2KHR *pMemoryRequirements); -VkResult VKAPI_CALL vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkAccelerationStructureCaptureDescriptorDataInfoEXT *pInfo, void *pData); -VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo *pInfo); -VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressEXT(VkDevice device, const VkBufferDeviceAddressInfo *pInfo); -VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressKHR(VkDevice device, const VkBufferDeviceAddressInfo *pInfo); -void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements); -void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -void VKAPI_CALL vkGetBufferMemoryRequirements2KHR(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo *pInfo); -uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddressKHR(VkDevice device, const VkBufferDeviceAddressInfo *pInfo); -VkResult VKAPI_CALL vkGetBufferOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkBufferCaptureDescriptorDataInfoEXT *pInfo, void *pData); -VkResult VKAPI_CALL vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT *pTimestampInfos, uint64_t *pTimestamps, uint64_t *pMaxDeviation); -VkResult VKAPI_CALL vkGetCudaModuleCacheNV(VkDevice device, VkCudaModuleNV module, size_t *pCacheSize, void *pCacheData); -uint32_t VKAPI_CALL vkGetDeferredOperationMaxConcurrencyKHR(VkDevice device, VkDeferredOperationKHR operation); -VkResult VKAPI_CALL vkGetDeferredOperationResultKHR(VkDevice device, VkDeferredOperationKHR operation); -void VKAPI_CALL vkGetDescriptorEXT(VkDevice device, const VkDescriptorGetInfoEXT *pDescriptorInfo, size_t dataSize, void *pDescriptor); -void VKAPI_CALL vkGetDescriptorSetHostMappingVALVE(VkDevice device, VkDescriptorSet descriptorSet, void **ppData); -void VKAPI_CALL vkGetDescriptorSetLayoutBindingOffsetEXT(VkDevice device, VkDescriptorSetLayout layout, uint32_t binding, VkDeviceSize *pOffset); -void VKAPI_CALL vkGetDescriptorSetLayoutHostMappingInfoVALVE(VkDevice device, const VkDescriptorSetBindingReferenceVALVE *pBindingReference, VkDescriptorSetLayoutHostMappingInfoVALVE *pHostMapping); -void VKAPI_CALL vkGetDescriptorSetLayoutSizeEXT(VkDevice device, VkDescriptorSetLayout layout, VkDeviceSize *pLayoutSizeInBytes); -void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport); -void VKAPI_CALL vkGetDescriptorSetLayoutSupportKHR(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport); -void VKAPI_CALL vkGetDeviceAccelerationStructureCompatibilityKHR(VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo, VkAccelerationStructureCompatibilityKHR *pCompatibility); -void VKAPI_CALL vkGetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -void VKAPI_CALL vkGetDeviceBufferMemoryRequirementsKHR(VkDevice device, const VkDeviceBufferMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -VkResult VKAPI_CALL vkGetDeviceFaultInfoEXT(VkDevice device, VkDeviceFaultCountsEXT *pFaultCounts, VkDeviceFaultInfoEXT *pFaultInfo); -void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures); -void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHR(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures); -VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities); -VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes); -void VKAPI_CALL vkGetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -void VKAPI_CALL vkGetDeviceImageMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements); -void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements); -void VKAPI_CALL vkGetDeviceImageSubresourceLayoutKHR(VkDevice device, const VkDeviceImageSubresourceInfoKHR *pInfo, VkSubresourceLayout2KHR *pLayout); -void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes); -uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo); -uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo); -void VKAPI_CALL vkGetDeviceMicromapCompatibilityEXT(VkDevice device, const VkMicromapVersionInfoEXT *pVersionInfo, VkAccelerationStructureCompatibilityKHR *pCompatibility); -PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName); -void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue); -void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue); -VkResult VKAPI_CALL vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI(VkDevice device, VkRenderPass renderpass, VkExtent2D *pMaxWorkgroupSize); -VkResult VKAPI_CALL vkGetDynamicRenderingTilePropertiesQCOM(VkDevice device, const VkRenderingInfo *pRenderingInfo, VkTilePropertiesQCOM *pProperties); -VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event); -VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence); -VkResult VKAPI_CALL vkGetFramebufferTilePropertiesQCOM(VkDevice device, VkFramebuffer framebuffer, uint32_t *pPropertiesCount, VkTilePropertiesQCOM *pProperties); -void VKAPI_CALL vkGetGeneratedCommandsMemoryRequirementsNV(VkDevice device, const VkGeneratedCommandsMemoryRequirementsInfoNV *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements); -void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -void VKAPI_CALL vkGetImageMemoryRequirements2KHR(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements); -VkResult VKAPI_CALL vkGetImageOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkImageCaptureDescriptorDataInfoEXT *pInfo, void *pData); -void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements *pSparseMemoryRequirements); -void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements); -void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements); -void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout); -void VKAPI_CALL vkGetImageSubresourceLayout2EXT(VkDevice device, VkImage image, const VkImageSubresource2KHR *pSubresource, VkSubresourceLayout2KHR *pLayout); -void VKAPI_CALL vkGetImageSubresourceLayout2KHR(VkDevice device, VkImage image, const VkImageSubresource2KHR *pSubresource, VkSubresourceLayout2KHR *pLayout); -VkResult VKAPI_CALL vkGetImageViewAddressNVX(VkDevice device, VkImageView imageView, VkImageViewAddressPropertiesNVX *pProperties); -uint32_t VKAPI_CALL vkGetImageViewHandleNVX(VkDevice device, const VkImageViewHandleInfoNVX *pInfo); -VkResult VKAPI_CALL vkGetImageViewOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkImageViewCaptureDescriptorDataInfoEXT *pInfo, void *pData); -PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName); -void VKAPI_CALL vkGetLatencyTimingsNV(VkDevice device, VkSwapchainKHR swapchain, VkGetLatencyMarkerInfoNV *pLatencyMarkerInfo); -VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void *pHostPointer, VkMemoryHostPointerPropertiesEXT *pMemoryHostPointerProperties); -VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE *pHandle); -VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR *pMemoryWin32HandleProperties); -void VKAPI_CALL vkGetMicromapBuildSizesEXT(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkMicromapBuildInfoEXT *pBuildInfo, VkMicromapBuildSizesInfoEXT *pSizeInfo); -VkResult VKAPI_CALL vkGetPerformanceParameterINTEL(VkDevice device, VkPerformanceParameterTypeINTEL parameter, VkPerformanceValueINTEL *pValue); -VkResult VKAPI_CALL vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainEXT *pTimeDomains); -VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkCooperativeMatrixPropertiesKHR *pProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkCooperativeMatrixPropertiesNV *pProperties); -void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); -void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties); -void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); -void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties); -void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties); -void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties); -void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures); -void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures); -void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures); -void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties); -void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties); -void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceFragmentShadingRatesKHR(VkPhysicalDevice physicalDevice, uint32_t *pFragmentShadingRateCount, VkPhysicalDeviceFragmentShadingRateKHR *pFragmentShadingRates); -VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties); -void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties); -void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties); -void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties); -void VKAPI_CALL vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT *pMultisampleProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceOpticalFlowImageFormatsNV(VkPhysicalDevice physicalDevice, const VkOpticalFlowImageFormatInfoNV *pOpticalFlowImageFormatInfo, uint32_t *pFormatCount, VkOpticalFlowImageFormatPropertiesNV *pImageFormatProperties); -VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pRectCount, VkRect2D *pRects); -void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties); -void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties); -void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties); -void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(VkPhysicalDevice physicalDevice, const VkQueryPoolPerformanceCreateInfoKHR *pPerformanceQueryCreateInfo, uint32_t *pNumPasses); -void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties); -void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties); -void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties); -void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties); -void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties); -void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(VkPhysicalDevice physicalDevice, uint32_t *pCombinationCount, VkFramebufferMixedSamplesCombinationNV *pCombinations); -VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities); -VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); -VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats); -VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats); -VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes); -VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported); -VkResult VKAPI_CALL vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, VkPhysicalDeviceToolProperties *pToolProperties); -VkResult VKAPI_CALL vkGetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, VkPhysicalDeviceToolProperties *pToolProperties); -VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); -VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData); -VkResult VKAPI_CALL vkGetPipelineExecutableInternalRepresentationsKHR(VkDevice device, const VkPipelineExecutableInfoKHR *pExecutableInfo, uint32_t *pInternalRepresentationCount, VkPipelineExecutableInternalRepresentationKHR *pInternalRepresentations); -VkResult VKAPI_CALL vkGetPipelineExecutablePropertiesKHR(VkDevice device, const VkPipelineInfoKHR *pPipelineInfo, uint32_t *pExecutableCount, VkPipelineExecutablePropertiesKHR *pProperties); -VkResult VKAPI_CALL vkGetPipelineExecutableStatisticsKHR(VkDevice device, const VkPipelineExecutableInfoKHR *pExecutableInfo, uint32_t *pStatisticCount, VkPipelineExecutableStatisticKHR *pStatistics); -VkDeviceAddress VKAPI_CALL vkGetPipelineIndirectDeviceAddressNV(VkDevice device, const VkPipelineIndirectDeviceAddressInfoNV *pInfo); -void VKAPI_CALL vkGetPipelineIndirectMemoryRequirementsNV(VkDevice device, const VkComputePipelineCreateInfo *pCreateInfo, VkMemoryRequirements2 *pMemoryRequirements); -VkResult VKAPI_CALL vkGetPipelinePropertiesEXT(VkDevice device, const VkPipelineInfoEXT *pPipelineInfo, VkBaseOutStructure *pPipelineProperties); -void VKAPI_CALL vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t *pData); -void VKAPI_CALL vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t *pData); -VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags); -void VKAPI_CALL vkGetQueueCheckpointData2NV(VkQueue queue, uint32_t *pCheckpointDataCount, VkCheckpointData2NV *pCheckpointData); -void VKAPI_CALL vkGetQueueCheckpointDataNV(VkQueue queue, uint32_t *pCheckpointDataCount, VkCheckpointDataNV *pCheckpointData); -VkResult VKAPI_CALL vkGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData); -VkResult VKAPI_CALL vkGetRayTracingShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData); -VkResult VKAPI_CALL vkGetRayTracingShaderGroupHandlesNV(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData); -VkDeviceSize VKAPI_CALL vkGetRayTracingShaderGroupStackSizeKHR(VkDevice device, VkPipeline pipeline, uint32_t group, VkShaderGroupShaderKHR groupShader); -void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity); -void VKAPI_CALL vkGetRenderingAreaGranularityKHR(VkDevice device, const VkRenderingAreaInfoKHR *pRenderingAreaInfo, VkExtent2D *pGranularity); -VkResult VKAPI_CALL vkGetSamplerOpaqueCaptureDescriptorDataEXT(VkDevice device, const VkSamplerCaptureDescriptorDataInfoEXT *pInfo, void *pData); -VkResult VKAPI_CALL vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t *pValue); -VkResult VKAPI_CALL vkGetSemaphoreCounterValueKHR(VkDevice device, VkSemaphore semaphore, uint64_t *pValue); -VkResult VKAPI_CALL vkGetShaderBinaryDataEXT(VkDevice device, VkShaderEXT shader, size_t *pDataSize, void *pData); -VkResult VKAPI_CALL vkGetShaderInfoAMD(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBits shaderStage, VkShaderInfoTypeAMD infoType, size_t *pInfoSize, void *pInfo); -void VKAPI_CALL vkGetShaderModuleCreateInfoIdentifierEXT(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, VkShaderModuleIdentifierEXT *pIdentifier); -void VKAPI_CALL vkGetShaderModuleIdentifierEXT(VkDevice device, VkShaderModule shaderModule, VkShaderModuleIdentifierEXT *pIdentifier); -VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages); -VkResult VKAPI_CALL vkGetValidationCacheDataEXT(VkDevice device, VkValidationCacheEXT validationCache, size_t *pDataSize, void *pData); -VkResult VKAPI_CALL vkInitializePerformanceApiINTEL(VkDevice device, const VkInitializePerformanceApiInfoINTEL *pInitializeInfo); -VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges); -VkResult VKAPI_CALL vkLatencySleepNV(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepInfoNV *pSleepInfo); -VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData); -VkResult VKAPI_CALL vkMapMemory2KHR(VkDevice device, const VkMemoryMapInfoKHR *pMemoryMapInfo, void **ppData); -VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches); -VkResult VKAPI_CALL vkMergeValidationCachesEXT(VkDevice device, VkValidationCacheEXT dstCache, uint32_t srcCacheCount, const VkValidationCacheEXT *pSrcCaches); -void VKAPI_CALL vkQueueBeginDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo); -VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence); -void VKAPI_CALL vkQueueEndDebugUtilsLabelEXT(VkQueue queue); -void VKAPI_CALL vkQueueInsertDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo); -void VKAPI_CALL vkQueueNotifyOutOfBandNV(VkQueue queue, const VkOutOfBandQueueTypeInfoNV *pQueueTypeInfo); -VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo); -VkResult VKAPI_CALL vkQueueSetPerformanceConfigurationINTEL(VkQueue queue, VkPerformanceConfigurationINTEL configuration); -VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence); -VkResult VKAPI_CALL vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits, VkFence fence); -VkResult VKAPI_CALL vkQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits, VkFence fence); -VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue); -VkResult VKAPI_CALL vkReleasePerformanceConfigurationINTEL(VkDevice device, VkPerformanceConfigurationINTEL configuration); -void VKAPI_CALL vkReleaseProfilingLockKHR(VkDevice device); -VkResult VKAPI_CALL vkReleaseSwapchainImagesEXT(VkDevice device, const VkReleaseSwapchainImagesInfoEXT *pReleaseInfo); -VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); -VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); -VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); -VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event); -VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences); -void VKAPI_CALL vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); -void VKAPI_CALL vkResetQueryPoolEXT(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); -VkResult VKAPI_CALL vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo); -VkResult VKAPI_CALL vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo); -void VKAPI_CALL vkSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority); -VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event); -void VKAPI_CALL vkSetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR *pSwapchains, const VkHdrMetadataEXT *pMetadata); -void VKAPI_CALL vkSetLatencyMarkerNV(VkDevice device, VkSwapchainKHR swapchain, const VkSetLatencyMarkerInfoNV *pLatencyMarkerInfo); -VkResult VKAPI_CALL vkSetLatencySleepModeNV(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepModeInfoNV *pSleepModeInfo); -VkResult VKAPI_CALL vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data); -VkResult VKAPI_CALL vkSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data); -VkResult VKAPI_CALL vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo); -VkResult VKAPI_CALL vkSignalSemaphoreKHR(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo); -void VKAPI_CALL vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData); -VkResult VKAPI_CALL vkTransitionImageLayoutEXT(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfoEXT *pTransitions); -void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); -void VKAPI_CALL vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); -void VKAPI_CALL vkUninitializePerformanceApiINTEL(VkDevice device); -void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory); -VkResult VKAPI_CALL vkUnmapMemory2KHR(VkDevice device, const VkMemoryUnmapInfoKHR *pMemoryUnmapInfo); -void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData); -void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData); -void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies); -VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout); -VkResult VKAPI_CALL vkWaitForPresentKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t presentId, uint64_t timeout); -VkResult VKAPI_CALL vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout); -VkResult VKAPI_CALL vkWaitSemaphoresKHR(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout); -VkResult VKAPI_CALL vkWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, size_t dataSize, void *pData, size_t stride); -VkResult VKAPI_CALL vkWriteMicromapsPropertiesEXT(VkDevice device, uint32_t micromapCount, const VkMicromapEXT *pMicromaps, VkQueryType queryType, size_t dataSize, void *pData, size_t stride); -#endif /* VK_NO_PROTOTYPES */ - -#endif /* __WINE_VULKAN_H */ diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h deleted file mode 100644 index 116c379528b..00000000000 --- a/include/wine/vulkan_driver.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! - * - * This file is generated from Vulkan vk.xml file covered - * by the following copyright and permission notice: - * - * Copyright 2015-2023 The Khronos Group Inc. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef __WINE_VULKAN_DRIVER_H -#define __WINE_VULKAN_DRIVER_H - -/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 11 - -struct vulkan_funcs -{ - /* Vulkan global functions. These are the only calls at this point a graphics driver - * needs to provide. Other function calls will be provided indirectly by dispatch - * tables part of dispatchable Vulkan objects such as VkInstance or vkDevice. - */ - VkResult (*p_vkCreateInstance)(const VkInstanceCreateInfo *, const VkAllocationCallbacks *, VkInstance *); - VkResult (*p_vkCreateSwapchainKHR)(VkDevice, const VkSwapchainCreateInfoKHR *, const VkAllocationCallbacks *, VkSwapchainKHR *); - VkResult (*p_vkCreateWin32SurfaceKHR)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); - void (*p_vkDestroyInstance)(VkInstance, const VkAllocationCallbacks *); - void (*p_vkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); - void (*p_vkDestroySwapchainKHR)(VkDevice, VkSwapchainKHR, const VkAllocationCallbacks *); - VkResult (*p_vkEnumerateInstanceExtensionProperties)(const char *, uint32_t *, VkExtensionProperties *); - VkResult (*p_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice, VkSurfaceKHR, VkDeviceGroupPresentModeFlagsKHR *); - void * (*p_vkGetDeviceProcAddr)(VkDevice, const char *); - void * (*p_vkGetInstanceProcAddr)(VkInstance, const char *); - VkResult (*p_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkRect2D *); - VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, uint32_t *, VkSurfaceFormat2KHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkSurfaceFormatKHR *); - VkResult (*p_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); - VkResult (*p_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); - VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); - VkResult (*p_vkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *); - VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); - - /* winevulkan specific functions */ - VkSurfaceKHR (*p_wine_get_host_surface)(VkSurfaceKHR); -}; - -static inline void *get_vulkan_driver_device_proc_addr( - const struct vulkan_funcs *vulkan_funcs, const char *name) -{ - if (!name || name[0] != 'v' || name[1] != 'k') return NULL; - - name += 2; - - if (!strcmp(name, "CreateSwapchainKHR")) - return vulkan_funcs->p_vkCreateSwapchainKHR; - if (!strcmp(name, "DestroySwapchainKHR")) - return vulkan_funcs->p_vkDestroySwapchainKHR; - if (!strcmp(name, "GetDeviceGroupSurfacePresentModesKHR")) - return vulkan_funcs->p_vkGetDeviceGroupSurfacePresentModesKHR; - if (!strcmp(name, "GetDeviceProcAddr")) - return vulkan_funcs->p_vkGetDeviceProcAddr; - if (!strcmp(name, "GetSwapchainImagesKHR")) - return vulkan_funcs->p_vkGetSwapchainImagesKHR; - if (!strcmp(name, "QueuePresentKHR")) - return vulkan_funcs->p_vkQueuePresentKHR; - - return NULL; -} - -static inline void *get_vulkan_driver_instance_proc_addr( - const struct vulkan_funcs *vulkan_funcs, VkInstance instance, const char *name) -{ - if (!name || name[0] != 'v' || name[1] != 'k') return NULL; - - name += 2; - - if (!strcmp(name, "CreateInstance")) - return vulkan_funcs->p_vkCreateInstance; - if (!strcmp(name, "EnumerateInstanceExtensionProperties")) - return vulkan_funcs->p_vkEnumerateInstanceExtensionProperties; - - if (!instance) return NULL; - - if (!strcmp(name, "CreateWin32SurfaceKHR")) - return vulkan_funcs->p_vkCreateWin32SurfaceKHR; - if (!strcmp(name, "DestroyInstance")) - return vulkan_funcs->p_vkDestroyInstance; - if (!strcmp(name, "DestroySurfaceKHR")) - return vulkan_funcs->p_vkDestroySurfaceKHR; - if (!strcmp(name, "GetInstanceProcAddr")) - return vulkan_funcs->p_vkGetInstanceProcAddr; - if (!strcmp(name, "GetPhysicalDevicePresentRectanglesKHR")) - return vulkan_funcs->p_vkGetPhysicalDevicePresentRectanglesKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2KHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceCapabilities2KHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceFormats2KHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceFormats2KHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceFormatsKHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceFormatsKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceSurfacePresentModesKHR; - if (!strcmp(name, "GetPhysicalDeviceSurfaceSupportKHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceSurfaceSupportKHR; - if (!strcmp(name, "GetPhysicalDeviceWin32PresentationSupportKHR")) - return vulkan_funcs->p_vkGetPhysicalDeviceWin32PresentationSupportKHR; - - name -= 2; - - return get_vulkan_driver_device_proc_addr(vulkan_funcs, name); -} - -#endif /* __WINE_VULKAN_DRIVER_H */ From 07eb342ad8a60f31e27a9cd4edcaf8c917568e74 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 12 Dec 2022 05:40:31 +0200 Subject: [PATCH 0004/1506] configure: Remove configure and config.h.in. Those are autogenerated by Proton's build system and get outdated very quickly. --- configure | 24267 ------------------------------------------ include/config.h.in | 836 -- 2 files changed, 25103 deletions(-) delete mode 100755 configure delete mode 100644 include/config.h.in diff --git a/configure b/configure deleted file mode 100755 index e30aed5f408..00000000000 --- a/configure +++ /dev/null @@ -1,24267 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for Wine 9.0. -# -# Report bugs to . -# -# -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, -# Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else $as_nop - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. -as_nl=' -' -export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi - -# The user is always right. -if ${PATH_SEPARATOR+false} :; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else \$as_nop - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ) -then : - -else \$as_nop - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -blah=\$(echo \$(echo blah)) -test x\"\$blah\" = xblah || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null -then : - as_have_required=yes -else $as_nop - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null -then : - -else $as_nop - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : - CONFIG_SHELL=$as_shell as_have_required=yes - if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null -then : - break 2 -fi -fi - done;; - esac - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi -fi - - - if test "x$CONFIG_SHELL" != x -then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno -then : - printf "%s\n" "$0: This script requires a shell more modern than all" - printf "%s\n" "$0: the shells that I found on your system." - if test ${ZSH_VERSION+y} ; then - printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" - printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." - else - printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and -$0: wine-devel@winehq.org about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else $as_nop - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else $as_nop - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - printf "%s\n" "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='Wine' -PACKAGE_TARNAME='wine' -PACKAGE_VERSION='9.0' -PACKAGE_STRING='Wine 9.0' -PACKAGE_BUGREPORT='wine-devel@winehq.org' -PACKAGE_URL='https://www.winehq.org' - -ac_unique_file="server/atom.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_STDIO_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_header_c_list= -ac_subst_vars='LTLIBOBJS -LIBOBJS -TAGSFLAGS -RT_LIBS -WINELOADER_PROGRAMS -DELAYLOADFLAG -MSVCRTFLAGS -NETAPI_LIBS -NETAPI_CFLAGS -PROCSTAT_LIBS -GSSAPI_LIBS -GSSAPI_CFLAGS -KRB5_LIBS -KRB5_CFLAGS -FONTCONFIG_LIBS -FONTCONFIG_CFLAGS -CUPS_LIBS -CUPS_CFLAGS -CAPI20_LIBS -CAPI20_CFLAGS -SDL2_LIBS -SDL2_CFLAGS -UNWIND_LIBS -UNWIND_CFLAGS -UDEV_LIBS -UDEV_CFLAGS -OSS4_LIBS -OSS4_CFLAGS -ALSA_LIBS -GSTREAMER_LIBS -GSTREAMER_CFLAGS -PULSE_LIBS -PULSE_CFLAGS -GETTEXTPO_LIBS -FREETYPE_LIBS -FREETYPE_CFLAGS -RESOLV_LIBS -GPHOTO2_PORT_LIBS -GPHOTO2_PORT_CFLAGS -GPHOTO2_LIBS -GPHOTO2_CFLAGS -USB_LIBS -USB_CFLAGS -SANE_LIBS -SANE_CFLAGS -GNUTLS_LIBS -GNUTLS_CFLAGS -DBUS_LIBS -DBUS_CFLAGS -INOTIFY_LIBS -INOTIFY_CFLAGS -PCSCLITE_LIBS -PCAP_LIBS -XKBREGISTRY_LIBS -XKBREGISTRY_CFLAGS -XKBCOMMON_LIBS -XKBCOMMON_CFLAGS -WAYLAND_SCANNER -WAYLAND_CLIENT_LIBS -WAYLAND_CLIENT_CFLAGS -X_EXTRA_LIBS -X_LIBS -X_PRE_LIBS -X_CFLAGS -CPP -XMKMF -PTHREAD_LIBS -ZYDIS_PE_LIBS -ZYDIS_PE_CFLAGS -ZLIB_PE_LIBS -ZLIB_PE_CFLAGS -XSLT_PE_LIBS -XSLT_PE_CFLAGS -XML2_PE_LIBS -XML2_PE_CFLAGS -VKD3D_PE_LIBS -VKD3D_PE_CFLAGS -TIFF_PE_LIBS -TIFF_PE_CFLAGS -PNG_PE_LIBS -PNG_PE_CFLAGS -MUSL_PE_LIBS -MUSL_PE_CFLAGS -MPG123_PE_LIBS -MPG123_PE_CFLAGS -LDAP_PE_LIBS -LDAP_PE_CFLAGS -LCMS2_PE_LIBS -LCMS2_PE_CFLAGS -JXR_PE_LIBS -JXR_PE_CFLAGS -JPEG_PE_LIBS -JPEG_PE_CFLAGS -GSM_PE_LIBS -GSM_PE_CFLAGS -FLUIDSYNTH_PE_LIBS -FLUIDSYNTH_PE_CFLAGS -FAUDIO_PE_LIBS -FAUDIO_PE_CFLAGS -MINGW_PKG_CONFIG -PE_ARCHS -WINELOADER_DEPENDS -ac_ct_OBJC -OBJCFLAGS -OBJC -OPENCL_LIBS -COREAUDIO_LIBS -SYSTEMCONFIGURATION_LIBS -SECURITY_LIBS -APPKIT_LIBS -CORESERVICES_LIBS -APPLICATIONSERVICES_LIBS -METAL_LIBS -IOKIT_LIBS -DISKARBITRATION_LIBS -COREFOUNDATION_LIBS -CARBON_LIBS -CONFIGURE_TARGETS -DISABLED_SUBDIRS -SUBDIRS -READELF -OTOOL -LDD -DLLEXT -WINEPRELOADER_LDFLAGS -WINELOADER_LDFLAGS -TOP_INSTALL_DEV -TOP_INSTALL_LIB -UNIXLDFLAGS -UNIXDLLFLAGS -EXTRACFLAGS -LDEXECFLAGS -LDDLLFLAGS -DLLFLAGS -OPENGL_LIBS -I386_LIBS -ICOTOOL -CONVERT -RSVG -FONTFORGE -PKG_CONFIG -MSGFMT -LDCONFIG -EGREP -GREP -LN_S -RANLIB -STRIP -ac_ct_AR -AR -BISON -FLEX -SED_CMD -RUNTESTFLAGS -MAKEDEP -toolsdir -x86_64_DISABLED_SUBDIRS -x86_64_DELAYLOADFLAG -x86_64_TARGET -x86_64_DEBUG -x86_64_LDFLAGS -x86_64_EXTRACFLAGS -x86_64_CFLAGS -x86_64_CC -i386_DISABLED_SUBDIRS -i386_DELAYLOADFLAG -i386_TARGET -i386_DEBUG -i386_LDFLAGS -i386_EXTRACFLAGS -i386_CFLAGS -i386_CC -arm64ec_DISABLED_SUBDIRS -arm64ec_DELAYLOADFLAG -arm64ec_TARGET -arm64ec_DEBUG -arm64ec_LDFLAGS -arm64ec_EXTRACFLAGS -arm64ec_CFLAGS -arm64ec_CC -arm_DISABLED_SUBDIRS -arm_DELAYLOADFLAG -arm_TARGET -arm_DEBUG -arm_LDFLAGS -arm_EXTRACFLAGS -arm_CFLAGS -arm_CC -aarch64_DISABLED_SUBDIRS -aarch64_DELAYLOADFLAG -aarch64_TARGET -aarch64_DEBUG -aarch64_LDFLAGS -aarch64_EXTRACFLAGS -aarch64_CFLAGS -aarch64_CC -HOST_ARCH -toolsext -TARGETFLAGS -LD -CPPBIN -ac_ct_CXX -CXXFLAGS -CXX -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -SET_MAKE -srcdir -nlsdir -fontdir -dlldir -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -system_dllpath -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -runstatedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_archs -enable_win16 -enable_win64 -enable_tests -enable_build_id -enable_maintainer_mode -enable_silent_rules -enable_werror -with_alsa -with_capi -with_coreaudio -with_cups -with_dbus -with_float_abi -with_fontconfig -with_freetype -with_gettext -with_gettextpo -with_gphoto -with_gnutls -with_gssapi -with_gstreamer -with_inotify -with_krb5 -with_mingw -with_netapi -with_opencl -with_opengl -with_osmesa -with_oss -with_pcap -with_pcsclite -with_pthread -with_pulse -with_sane -with_sdl -with_udev -with_unwind -with_usb -with_v4l2 -with_vulkan -with_wayland -with_xcomposite -with_xcursor -with_xfixes -with_xinerama -with_xinput -with_xinput2 -with_xrandr -with_xrender -with_xshape -with_xshm -with_xxf86vm -with_system_dllpath -with_wine_tools -with_wine64 -enable_largefile -with_x -enable_acledit -enable_aclui -enable_activeds_tlb -enable_activeds -enable_actxprxy -enable_adsldp -enable_adsldpc -enable_advapi32 -enable_advpack -enable_amsi -enable_amstream -enable_apisetschema -enable_apphelp -enable_appwiz_cpl -enable_appxdeploymentclient -enable_atl -enable_atl100 -enable_atl110 -enable_atl80 -enable_atl90 -enable_atlthunk -enable_atmlib -enable_authz -enable_avicap32 -enable_avifil32 -enable_avrt -enable_bcrypt -enable_bcryptprimitives -enable_bluetoothapis -enable_browseui -enable_bthprops_cpl -enable_cabinet -enable_capi2032 -enable_cards -enable_cdosys -enable_cfgmgr32 -enable_clusapi -enable_cng_sys -enable_combase -enable_comcat -enable_comctl32 -enable_comdlg32 -enable_coml2 -enable_compstui -enable_comsvcs -enable_concrt140 -enable_connect -enable_credui -enable_crtdll -enable_crypt32 -enable_cryptdlg -enable_cryptdll -enable_cryptext -enable_cryptnet -enable_cryptowinrt -enable_cryptsp -enable_cryptui -enable_ctapi32 -enable_ctl3d32 -enable_d2d1 -enable_d3d10 -enable_d3d10_1 -enable_d3d10core -enable_d3d11 -enable_d3d12 -enable_d3d12core -enable_d3d8 -enable_d3d8thk -enable_d3d9 -enable_d3dcompiler_33 -enable_d3dcompiler_34 -enable_d3dcompiler_35 -enable_d3dcompiler_36 -enable_d3dcompiler_37 -enable_d3dcompiler_38 -enable_d3dcompiler_39 -enable_d3dcompiler_40 -enable_d3dcompiler_41 -enable_d3dcompiler_42 -enable_d3dcompiler_43 -enable_d3dcompiler_46 -enable_d3dcompiler_47 -enable_d3dim -enable_d3dim700 -enable_d3drm -enable_d3dx10_33 -enable_d3dx10_34 -enable_d3dx10_35 -enable_d3dx10_36 -enable_d3dx10_37 -enable_d3dx10_38 -enable_d3dx10_39 -enable_d3dx10_40 -enable_d3dx10_41 -enable_d3dx10_42 -enable_d3dx10_43 -enable_d3dx11_42 -enable_d3dx11_43 -enable_d3dx9_24 -enable_d3dx9_25 -enable_d3dx9_26 -enable_d3dx9_27 -enable_d3dx9_28 -enable_d3dx9_29 -enable_d3dx9_30 -enable_d3dx9_31 -enable_d3dx9_32 -enable_d3dx9_33 -enable_d3dx9_34 -enable_d3dx9_35 -enable_d3dx9_36 -enable_d3dx9_37 -enable_d3dx9_38 -enable_d3dx9_39 -enable_d3dx9_40 -enable_d3dx9_41 -enable_d3dx9_42 -enable_d3dx9_43 -enable_d3dxof -enable_davclnt -enable_dbgeng -enable_dbghelp -enable_dciman32 -enable_dcomp -enable_ddraw -enable_ddrawex -enable_devenum -enable_dhcpcsvc -enable_dhcpcsvc6 -enable_dhtmled_ocx -enable_diasymreader -enable_difxapi -enable_dinput -enable_dinput8 -enable_directmanipulation -enable_dispex -enable_dmband -enable_dmcompos -enable_dmime -enable_dmloader -enable_dmscript -enable_dmstyle -enable_dmsynth -enable_dmusic -enable_dmusic32 -enable_dnsapi -enable_dplay -enable_dplayx -enable_dpnaddr -enable_dpnet -enable_dpnhpast -enable_dpnhupnp -enable_dpnlobby -enable_dpvoice -enable_dpwsockx -enable_drmclien -enable_dsdmo -enable_dsound -enable_dsquery -enable_dssenh -enable_dsuiext -enable_dswave -enable_dwmapi -enable_dwrite -enable_dx8vb -enable_dxcore -enable_dxdiagn -enable_dxgi -enable_dxtrans -enable_dxva2 -enable_esent -enable_evr -enable_explorerframe -enable_faultrep -enable_feclient -enable_fltlib -enable_fltmgr_sys -enable_fntcache -enable_fontsub -enable_fusion -enable_fwpuclnt -enable_gameux -enable_gamingtcui -enable_gdi32 -enable_gdiplus -enable_geolocation -enable_glu32 -enable_gphoto2_ds -enable_gpkcsp -enable_graphicscapture -enable_hal -enable_hhctrl_ocx -enable_hid -enable_hidclass_sys -enable_hidparse_sys -enable_hlink -enable_hnetcfg -enable_hrtfapo -enable_http_sys -enable_httpapi -enable_hvsimanagementapi -enable_ia2comproxy -enable_iccvid -enable_icmp -enable_ieframe -enable_ieproxy -enable_imaadp32_acm -enable_imagehlp -enable_imm32 -enable_inetcomm -enable_inetcpl_cpl -enable_inetmib1 -enable_infosoft -enable_initpki -enable_inkobj -enable_inseng -enable_iphlpapi -enable_iprop -enable_ir50_32 -enable_irprops_cpl -enable_itircl -enable_itss -enable_joy_cpl -enable_jscript -enable_jsproxy -enable_kerberos -enable_kernel32 -enable_kernelbase -enable_ksecdd_sys -enable_ksproxy_ax -enable_ksuser -enable_ktmw32 -enable_l3codeca_acm -enable_light_msstyles -enable_loadperf -enable_localspl -enable_localui -enable_lz32 -enable_magnification -enable_mapi32 -enable_mapistub -enable_mciavi32 -enable_mcicda -enable_mciqtz32 -enable_mciseq -enable_mciwave -enable_mf -enable_mf3216 -enable_mferror -enable_mfmediaengine -enable_mfplat -enable_mfplay -enable_mfreadwrite -enable_mfsrcsnk -enable_mgmtapi -enable_midimap -enable_mlang -enable_mmcndmgr -enable_mmdevapi -enable_mountmgr_sys -enable_mp3dmod -enable_mpr -enable_mprapi -enable_msacm32_drv -enable_msacm32 -enable_msado15 -enable_msadp32_acm -enable_msasn1 -enable_msauddecmft -enable_mscat32 -enable_mscms -enable_mscoree -enable_mscorwks -enable_msctf -enable_msctfmonitor -enable_msctfp -enable_msdaps -enable_msdasql -enable_msdelta -enable_msdmo -enable_msdrm -enable_msftedit -enable_msg711_acm -enable_msgsm32_acm -enable_mshtml_tlb -enable_mshtml -enable_msi -enable_msident -enable_msimg32 -enable_msimsg -enable_msimtf -enable_msisip -enable_msisys_ocx -enable_msls31 -enable_msmpeg2vdec -enable_msnet32 -enable_mspatcha -enable_msports -enable_msrle32 -enable_msscript_ocx -enable_mssign32 -enable_mssip32 -enable_mstask -enable_msttsengine -enable_msv1_0 -enable_msvcirt -enable_msvcm80 -enable_msvcm90 -enable_msvcp100 -enable_msvcp110 -enable_msvcp120 -enable_msvcp120_app -enable_msvcp140 -enable_msvcp140_1 -enable_msvcp140_2 -enable_msvcp140_atomic_wait -enable_msvcp140_codecvt_ids -enable_msvcp60 -enable_msvcp70 -enable_msvcp71 -enable_msvcp80 -enable_msvcp90 -enable_msvcp_win -enable_msvcr100 -enable_msvcr110 -enable_msvcr120 -enable_msvcr120_app -enable_msvcr70 -enable_msvcr71 -enable_msvcr80 -enable_msvcr90 -enable_msvcrt -enable_msvcrt20 -enable_msvcrt40 -enable_msvcrtd -enable_msvfw32 -enable_msvidc32 -enable_mswsock -enable_msxml -enable_msxml2 -enable_msxml3 -enable_msxml4 -enable_msxml6 -enable_mtxdm -enable_ncrypt -enable_nddeapi -enable_ndis_sys -enable_netapi32 -enable_netcfgx -enable_netio_sys -enable_netprofm -enable_netutils -enable_newdev -enable_ninput -enable_normaliz -enable_npmshtml -enable_npptools -enable_nsi -enable_nsiproxy_sys -enable_ntdll -enable_ntdsapi -enable_ntoskrnl_exe -enable_ntprint -enable_objsel -enable_odbc32 -enable_odbcbcp -enable_odbccp32 -enable_odbccu32 -enable_ole32 -enable_oleacc -enable_oleaut32 -enable_olecli32 -enable_oledb32 -enable_oledlg -enable_olepro32 -enable_olesvr32 -enable_olethk32 -enable_opcservices -enable_opencl -enable_opengl32 -enable_packager -enable_pdh -enable_photometadatahandler -enable_pidgen -enable_powrprof -enable_printui -enable_prntvpt -enable_propsys -enable_psapi -enable_pstorec -enable_pwrshplugin -enable_qasf -enable_qcap -enable_qdvd -enable_qedit -enable_qmgr -enable_qmgrprxy -enable_quartz -enable_query -enable_qwave -enable_rasapi32 -enable_rasdlg -enable_regapi -enable_resutils -enable_riched20 -enable_riched32 -enable_rpcrt4 -enable_rsabase -enable_rsaenh -enable_rstrtmgr -enable_rtutils -enable_rtworkq -enable_samlib -enable_sane_ds -enable_sapi -enable_sas -enable_scarddlg -enable_scardsvr -enable_sccbase -enable_schannel -enable_schedsvc -enable_scrobj -enable_scrrun -enable_scsiport_sys -enable_sechost -enable_secur32 -enable_security -enable_sensapi -enable_serialui -enable_setupapi -enable_sfc -enable_sfc_os -enable_shcore -enable_shdoclc -enable_shdocvw -enable_shell32 -enable_shfolder -enable_shlwapi -enable_slbcsp -enable_slc -enable_snmpapi -enable_softpub -enable_spoolss -enable_sppc -enable_srclient -enable_srvcli -enable_srvsvc -enable_sspicli -enable_stdole2_tlb -enable_stdole32_tlb -enable_sti -enable_strmdll -enable_svrapi -enable_sxs -enable_t2embed -enable_tapi32 -enable_taskschd -enable_tbs -enable_tdh -enable_tdi_sys -enable_threadpoolwinrt -enable_traffic -enable_twain_32 -enable_twinapi_appcore -enable_tzres -enable_ucrtbase -enable_uianimation -enable_uiautomationcore -enable_uiribbon -enable_unicows -enable_updspapi -enable_url -enable_urlmon -enable_usbd_sys -enable_user32 -enable_userenv -enable_usp10 -enable_utildll -enable_uxtheme -enable_vbscript -enable_vcomp -enable_vcomp100 -enable_vcomp110 -enable_vcomp120 -enable_vcomp140 -enable_vcomp90 -enable_vcruntime140 -enable_vcruntime140_1 -enable_vdmdbg -enable_version -enable_vga -enable_virtdisk -enable_vssapi -enable_vulkan_1 -enable_wbemdisp -enable_wbemprox -enable_wdscore -enable_webservices -enable_websocket -enable_wer -enable_wevtapi -enable_wevtsvc -enable_wiaservc -enable_wimgapi -enable_win32u -enable_windows_applicationmodel -enable_windows_devices_bluetooth -enable_windows_devices_enumeration -enable_windows_devices_usb -enable_windows_gaming_input -enable_windows_gaming_ui_gamebar -enable_windows_globalization -enable_windows_media_devices -enable_windows_media_mediacontrol -enable_windows_media_speech -enable_windows_media -enable_windows_networking_hostname -enable_windows_networking -enable_windows_perception_stub -enable_windows_security_credentials_ui_userconsentverifier -enable_windows_storage_applicationdata -enable_windows_system_profile_systemmanufacturers -enable_windows_ui -enable_windowscodecs -enable_windowscodecsext -enable_winealsa_drv -enable_wineandroid_drv -enable_winebus_sys -enable_winecoreaudio_drv -enable_winecrt0 -enable_wined3d -enable_winegstreamer -enable_winehid_sys -enable_winemac_drv -enable_winemapi -enable_wineoss_drv -enable_wineps_drv -enable_winepulse_drv -enable_wineusb_sys -enable_winevulkan -enable_winewayland_drv -enable_winex11_drv -enable_winexinput_sys -enable_wing32 -enable_winhttp -enable_wininet -enable_winmm -enable_winnls32 -enable_winprint -enable_winscard -enable_winspool_drv -enable_winsta -enable_wintab32 -enable_wintrust -enable_wintypes -enable_winusb -enable_wlanapi -enable_wlanui -enable_wldap32 -enable_wldp -enable_wmasf -enable_wmi -enable_wmiutils -enable_wmp -enable_wmphoto -enable_wmvcore -enable_wnaspi32 -enable_wofutil -enable_wow64 -enable_wow64cpu -enable_wow64win -enable_wpc -enable_wpcap -enable_ws2_32 -enable_wsdapi -enable_wshom_ocx -enable_wsnmp32 -enable_wsock32 -enable_wtsapi32 -enable_wuapi -enable_wuaueng -enable_x3daudio1_0 -enable_x3daudio1_1 -enable_x3daudio1_2 -enable_x3daudio1_3 -enable_x3daudio1_4 -enable_x3daudio1_5 -enable_x3daudio1_6 -enable_x3daudio1_7 -enable_xactengine2_0 -enable_xactengine2_4 -enable_xactengine2_7 -enable_xactengine2_9 -enable_xactengine3_0 -enable_xactengine3_1 -enable_xactengine3_2 -enable_xactengine3_3 -enable_xactengine3_4 -enable_xactengine3_5 -enable_xactengine3_6 -enable_xactengine3_7 -enable_xapofx1_1 -enable_xapofx1_2 -enable_xapofx1_3 -enable_xapofx1_4 -enable_xapofx1_5 -enable_xaudio2_0 -enable_xaudio2_1 -enable_xaudio2_2 -enable_xaudio2_3 -enable_xaudio2_4 -enable_xaudio2_5 -enable_xaudio2_6 -enable_xaudio2_7 -enable_xaudio2_8 -enable_xaudio2_9 -enable_xinput1_1 -enable_xinput1_2 -enable_xinput1_3 -enable_xinput1_4 -enable_xinput9_1_0 -enable_xinputuap -enable_xmllite -enable_xolehlp -enable_xpsprint -enable_xpssvcs -enable_fonts -enable_include -enable_adsiid -enable_dmoguids -enable_dxerr8 -enable_dxerr9 -enable_dxguid -enable_faudio -enable_fluidsynth -enable_gsm -enable_jpeg -enable_jxr -enable_lcms2 -enable_ldap -enable_mfuuid -enable_mpg123 -enable_musl -enable_png -enable_strmbase -enable_strmiids -enable_tiff -enable_uuid -enable_vkd3d -enable_wbemuuid -enable_wmcodecdspuuid -enable_xml2 -enable_xslt -enable_zlib -enable_zydis -enable_loader -enable_nls -enable_po -enable_arp -enable_aspnet_regiis -enable_attrib -enable_cabarc -enable_cacls -enable_certutil -enable_chcp_com -enable_clock -enable_cmd -enable_conhost -enable_control -enable_cscript -enable_dism -enable_dllhost -enable_dplaysvr -enable_dpnsvr -enable_dpvsetup -enable_dxdiag -enable_eject -enable_expand -enable_explorer -enable_extrac32 -enable_fc -enable_find -enable_findstr -enable_fsutil -enable_hh -enable_hostname -enable_icacls -enable_icinfo -enable_iexplore -enable_ipconfig -enable_klist -enable_lodctr -enable_mofcomp -enable_mshta -enable_msidb -enable_msiexec -enable_msinfo32 -enable_net -enable_netsh -enable_netstat -enable_ngen -enable_notepad -enable_oleview -enable_ping -enable_plugplay -enable_pnputil -enable_powershell -enable_presentationfontcache -enable_progman -enable_reg -enable_regasm -enable_regedit -enable_regini -enable_regsvcs -enable_regsvr32 -enable_robocopy -enable_rpcss -enable_rundll32 -enable_sc -enable_schtasks -enable_sdbinst -enable_secedit -enable_servicemodelreg -enable_services -enable_setx -enable_shutdown -enable_spoolsv -enable_start -enable_subst -enable_svchost -enable_systeminfo -enable_taskkill -enable_tasklist -enable_taskmgr -enable_termsv -enable_uninstaller -enable_unlodctr -enable_view -enable_wevtutil -enable_where -enable_whoami -enable_wineboot -enable_winebrowser -enable_winecfg -enable_wineconsole -enable_winedbg -enable_winedevice -enable_winefile -enable_winemenubuilder -enable_winemine -enable_winemsibuilder -enable_winepath -enable_winetest -enable_winhlp32 -enable_winmgmt -enable_winver -enable_wmic -enable_wmplayer -enable_wordpad -enable_write -enable_wscript -enable_wuauserv -enable_wusa -enable_xcopy -enable_server -enable_tools -enable_sfnt2fon -enable_widl -enable_winebuild -enable_winedump -enable_winegcc -enable_winemaker -enable_wmc -enable_wrc -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -OBJC -OBJCFLAGS -FAUDIO_PE_CFLAGS -FAUDIO_PE_LIBS -FLUIDSYNTH_PE_CFLAGS -FLUIDSYNTH_PE_LIBS -GSM_PE_CFLAGS -GSM_PE_LIBS -JPEG_PE_CFLAGS -JPEG_PE_LIBS -JXR_PE_CFLAGS -JXR_PE_LIBS -LCMS2_PE_CFLAGS -LCMS2_PE_LIBS -LDAP_PE_CFLAGS -LDAP_PE_LIBS -MPG123_PE_CFLAGS -MPG123_PE_LIBS -MUSL_PE_CFLAGS -MUSL_PE_LIBS -PNG_PE_CFLAGS -PNG_PE_LIBS -TIFF_PE_CFLAGS -TIFF_PE_LIBS -VKD3D_PE_CFLAGS -VKD3D_PE_LIBS -XML2_PE_CFLAGS -XML2_PE_LIBS -XSLT_PE_CFLAGS -XSLT_PE_LIBS -ZLIB_PE_CFLAGS -ZLIB_PE_LIBS -ZYDIS_PE_CFLAGS -ZYDIS_PE_LIBS -XMKMF -CPP -WAYLAND_CLIENT_CFLAGS -WAYLAND_CLIENT_LIBS -XKBCOMMON_CFLAGS -XKBCOMMON_LIBS -XKBREGISTRY_CFLAGS -XKBREGISTRY_LIBS -INOTIFY_CFLAGS -INOTIFY_LIBS -DBUS_CFLAGS -DBUS_LIBS -GNUTLS_CFLAGS -GNUTLS_LIBS -SANE_CFLAGS -SANE_LIBS -USB_CFLAGS -USB_LIBS -GPHOTO2_CFLAGS -GPHOTO2_LIBS -GPHOTO2_PORT_CFLAGS -GPHOTO2_PORT_LIBS -FREETYPE_CFLAGS -FREETYPE_LIBS -PULSE_CFLAGS -PULSE_LIBS -GSTREAMER_CFLAGS -GSTREAMER_LIBS -UDEV_CFLAGS -UDEV_LIBS -UNWIND_CFLAGS -UNWIND_LIBS -SDL2_CFLAGS -SDL2_LIBS -CAPI20_CFLAGS -CAPI20_LIBS -CUPS_CFLAGS -CUPS_LIBS -FONTCONFIG_CFLAGS -FONTCONFIG_LIBS -KRB5_CFLAGS -KRB5_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS -NETAPI_CFLAGS -NETAPI_LIBS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures Wine 9.0 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/wine] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -X features: - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Wine 9.0:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-archs={i386,x86_64,arm,aarch64} - enable multiple architectures for PE compilation - --disable-win16 do not include Win16 support - --enable-win64 build a Win64 emulator on AMD64 (won't run Win32 - binaries) - --disable-tests do not build the regression tests - --enable-build-id include .buildid section in output objects - --enable-maintainer-mode - enable maintainer-specific build rules - --enable-silent-rules use silent build rules (override: "make V=1") - --enable-werror treat compilation warnings as errors - --disable-largefile omit support for large files - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --without-alsa do not use the Alsa sound support - --without-capi do not use CAPI (ISDN support) - --without-coreaudio do not use the CoreAudio sound support - --without-cups do not use CUPS - --without-dbus do not use DBus (dynamic device support) - --with-float-abi=abi specify the ABI (soft|softfp|hard) for ARM platforms - --without-fontconfig do not use fontconfig - --without-freetype do not use the FreeType library - --without-gettext do not use gettext - --with-gettextpo use the GetTextPO library to rebuild po files - --without-gphoto do not use gphoto (Digital Camera support) - --without-gnutls do not use GnuTLS (schannel support) - --without-gssapi do not use GSSAPI (Kerberos SSP support) - --without-gstreamer do not use GStreamer (codecs support) - --without-inotify do not use inotify (filesystem change notifications) - --without-krb5 do not use krb5 (Kerberos) - --without-mingw do not use the MinGW cross-compiler - --without-netapi do not use the Samba NetAPI library - --without-opencl do not use OpenCL - --without-opengl do not use OpenGL - --without-osmesa do not use the OSMesa library - --without-oss do not use the OSS sound support - --without-pcap do not use the Packet Capture library - --without-pcsclite do not use PCSC lite - --without-pthread do not use the pthread library - --without-pulse do not use PulseAudio sound support - --without-sane do not use SANE (scanner support) - --without-sdl do not use SDL - --without-udev do not use udev (plug and play support) - --without-unwind do not use the libunwind library (exception - handling) - --without-usb do not use the libusb library - --without-v4l2 do not use v4l2 (video capture) - --without-vulkan do not use Vulkan - --without-wayland do not build the Wayland driver - --without-xcomposite do not use the Xcomposite extension - --without-xcursor do not use the Xcursor extension - --without-xfixes do not use Xfixes for clipboard change notifications - --without-xinerama do not use Xinerama (legacy multi-monitor support) - --without-xinput do not use the Xinput extension - --without-xinput2 do not use the Xinput 2 extension - --without-xrandr do not use Xrandr (multi-monitor support) - --without-xrender do not use the Xrender extension - --without-xshape do not use the Xshape extension - --without-xshm do not use XShm (shared memory extension) - --without-xxf86vm do not use XFree video mode extension - --with-system-dllpath=PATH - load external PE dependencies from colon-separated - path PATH - --with-wine-tools=DIR use Wine tools from directory DIR - --with-wine64=DIR use the 64-bit Wine in DIR for a Wow64 build - --with-x use the X Window System - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - OBJC Objective C compiler command - OBJCFLAGS Objective C compiler flags - FAUDIO_PE_CFLAGS - C compiler flags for the PE faudio, overriding the bundled - version - FAUDIO_PE_LIBS - Linker flags for the PE faudio, overriding the bundled version - FLUIDSYNTH_PE_CFLAGS - C compiler flags for the PE fluidsynth, overriding the bundled - version - FLUIDSYNTH_PE_LIBS - Linker flags for the PE fluidsynth, overriding the bundled - version - GSM_PE_CFLAGS - C compiler flags for the PE gsm, overriding the bundled version - GSM_PE_LIBS Linker flags for the PE gsm, overriding the bundled version - JPEG_PE_CFLAGS - C compiler flags for the PE jpeg, overriding the bundled version - JPEG_PE_LIBS - Linker flags for the PE jpeg, overriding the bundled version - JXR_PE_CFLAGS - C compiler flags for the PE jxr, overriding the bundled version - JXR_PE_LIBS Linker flags for the PE jxr, overriding the bundled version - LCMS2_PE_CFLAGS - C compiler flags for the PE lcms2, overriding the bundled - version - LCMS2_PE_LIBS - Linker flags for the PE lcms2, overriding the bundled version - LDAP_PE_CFLAGS - C compiler flags for the PE ldap, overriding the bundled version - LDAP_PE_LIBS - Linker flags for the PE ldap, overriding the bundled version - MPG123_PE_CFLAGS - C compiler flags for the PE mpg123, overriding the bundled - version - MPG123_PE_LIBS - Linker flags for the PE mpg123, overriding the bundled version - MUSL_PE_CFLAGS - C compiler flags for the PE musl, overriding the bundled version - MUSL_PE_LIBS - Linker flags for the PE musl, overriding the bundled version - PNG_PE_CFLAGS - C compiler flags for the PE png, overriding the bundled version - PNG_PE_LIBS Linker flags for the PE png, overriding the bundled version - TIFF_PE_CFLAGS - C compiler flags for the PE tiff, overriding the bundled version - TIFF_PE_LIBS - Linker flags for the PE tiff, overriding the bundled version - VKD3D_PE_CFLAGS - C compiler flags for the PE vkd3d, overriding the bundled - version - VKD3D_PE_LIBS - Linker flags for the PE vkd3d, overriding the bundled version - XML2_PE_CFLAGS - C compiler flags for the PE xml2, overriding the bundled version - XML2_PE_LIBS - Linker flags for the PE xml2, overriding the bundled version - XSLT_PE_CFLAGS - C compiler flags for the PE xslt, overriding the bundled version - XSLT_PE_LIBS - Linker flags for the PE xslt, overriding the bundled version - ZLIB_PE_CFLAGS - C compiler flags for the PE zlib, overriding the bundled version - ZLIB_PE_LIBS - Linker flags for the PE zlib, overriding the bundled version - ZYDIS_PE_CFLAGS - C compiler flags for the PE zydis, overriding the bundled - version - ZYDIS_PE_LIBS - Linker flags for the PE zydis, overriding the bundled version - XMKMF Path to xmkmf, Makefile generator for X Window System - CPP C preprocessor - WAYLAND_CLIENT_CFLAGS - C compiler flags for wayland-client, overriding pkg-config - WAYLAND_CLIENT_LIBS - Linker flags for wayland-client, overriding pkg-config - XKBCOMMON_CFLAGS - C compiler flags for xkbcommon, overriding pkg-config - XKBCOMMON_LIBS - Linker flags for xkbcommon, overriding pkg-config - XKBREGISTRY_CFLAGS - C compiler flags for xkbregistry, overriding pkg-config - XKBREGISTRY_LIBS - Linker flags for xkbregistry, overriding pkg-config - INOTIFY_CFLAGS - C compiler flags for libinotify, overriding pkg-config - INOTIFY_LIBS - Linker flags for libinotify, overriding pkg-config - DBUS_CFLAGS C compiler flags for dbus-1, overriding pkg-config - DBUS_LIBS Linker flags for dbus-1, overriding pkg-config - GNUTLS_CFLAGS - C compiler flags for gnutls, overriding pkg-config - GNUTLS_LIBS Linker flags for gnutls, overriding pkg-config - SANE_CFLAGS C compiler flags for sane-backends, overriding pkg-config - SANE_LIBS Linker flags for sane-backends, overriding pkg-config - USB_CFLAGS C compiler flags for libusb-1.0, overriding pkg-config - USB_LIBS Linker flags for libusb-1.0, overriding pkg-config - GPHOTO2_CFLAGS - C compiler flags for libgphoto2, overriding pkg-config - GPHOTO2_LIBS - Linker flags for libgphoto2, overriding pkg-config - GPHOTO2_PORT_CFLAGS - C compiler flags for libgphoto2_port, overriding pkg-config - GPHOTO2_PORT_LIBS - Linker flags for libgphoto2_port, overriding pkg-config - FREETYPE_CFLAGS - C compiler flags for freetype2, overriding pkg-config - FREETYPE_LIBS - Linker flags for freetype2, overriding pkg-config - PULSE_CFLAGS - C compiler flags for libpulse, overriding pkg-config - PULSE_LIBS Linker flags for libpulse, overriding pkg-config - GSTREAMER_CFLAGS - C compiler flags for gstreamer-1.0 gstreamer-video-1.0 - gstreamer-audio-1.0 gstreamer-tag-1.0, overriding pkg-config - GSTREAMER_LIBS - Linker flags for gstreamer-1.0 gstreamer-video-1.0 - gstreamer-audio-1.0 gstreamer-tag-1.0, overriding pkg-config - UDEV_CFLAGS C compiler flags for libudev, overriding pkg-config - UDEV_LIBS Linker flags for libudev, overriding pkg-config - UNWIND_CFLAGS - C compiler flags for libunwind, overriding pkg-config - UNWIND_LIBS Linker flags for libunwind, overriding pkg-config - SDL2_CFLAGS C compiler flags for sdl2, overriding pkg-config - SDL2_LIBS Linker flags for sdl2, overriding pkg-config - CAPI20_CFLAGS - C compiler flags for capi20, overriding pkg-config - CAPI20_LIBS Linker flags for capi20, overriding pkg-config - CUPS_CFLAGS C compiler flags for cups, overriding pkg-config - CUPS_LIBS Linker flags for cups, overriding pkg-config - FONTCONFIG_CFLAGS - C compiler flags for fontconfig, overriding pkg-config - FONTCONFIG_LIBS - Linker flags for fontconfig, overriding pkg-config - KRB5_CFLAGS C compiler flags for krb5, overriding pkg-config - KRB5_LIBS Linker flags for krb5, overriding pkg-config - GSSAPI_CFLAGS - C compiler flags for krb5-gssapi, overriding pkg-config - GSSAPI_LIBS Linker flags for krb5-gssapi, overriding pkg-config - NETAPI_CFLAGS - C compiler flags for netapi, overriding pkg-config - NETAPI_LIBS Linker flags for netapi, overriding pkg-config - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -Wine home page: . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -Wine configure 9.0 -generated by GNU Autoconf 2.71 - -Copyright (C) 2021 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_objc_try_compile LINENO -# ----------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_objc_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_objc_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_objc_try_compile - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. */ - -#include -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main (void) -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$3=yes" -else $as_nop - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -printf %s "checking for $2.$3... " >&6; } -if eval test \${$4+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main (void) -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$4=yes" -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main (void) -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$4=yes" -else $as_nop - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$4 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type -ac_configure_args_raw= -for ac_arg -do - case $ac_arg in - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_configure_args_raw " '$ac_arg'" -done - -case $ac_configure_args_raw in - *$as_nl*) - ac_safe_unquote= ;; - *) - ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. - ac_unsafe_a="$ac_unsafe_z#~" - ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" - ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; -esac - -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by Wine $as_me 9.0, which was -generated by GNU Autoconf 2.71. Invocation command line was - - $ $0$ac_configure_args_raw - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - printf "%s\n" "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Sanitize IFS. - IFS=" "" $as_nl" - # Save into config.log some information that might help in debugging. - { - echo - - printf "%s\n" "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - printf "%s\n" "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - printf "%s\n" "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - printf "%s\n" "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - printf "%s\n" "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - printf "%s\n" "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - printf "%s\n" "$as_me: caught signal $ac_signal" - printf "%s\n" "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -printf "%s\n" "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - ac_site_files="$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - ac_site_files="$prefix/share/config.site $prefix/etc/config.site" -else - ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" -fi - -for ac_site_file in $ac_site_files -do - case $ac_site_file in #( - */*) : - ;; #( - *) : - ac_site_file=./$ac_site_file ;; -esac - if test -f "$ac_site_file" && test -r "$ac_site_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -printf "%s\n" "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -printf "%s\n" "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Test code for whether the C compiler supports C89 (global declarations) -ac_c_conftest_c89_globals=' -/* Does the compiler advertise C89 conformance? - Do not test the value of __STDC__, because some compilers set it to 0 - while being otherwise adequately conformant. */ -#if !defined __STDC__ -# error "Compiler does not advertise C89 conformance" -#endif - -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ -struct buf { int x; }; -struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not \xHH hex character constants. - These do not provoke an error unfortunately, instead are silently treated - as an "x". The following induces an error, until -std is added to get - proper ANSI mode. Curiously \x00 != x always comes out true, for an - array size at least. It is necessary to write \x00 == 0 to get something - that is true only with -std. */ -int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) '\''x'\'' -int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), - int, int);' - -# Test code for whether the C compiler supports C89 (body of main). -ac_c_conftest_c89_main=' -ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); -' - -# Test code for whether the C compiler supports C99 (global declarations) -ac_c_conftest_c99_globals=' -// Does the compiler advertise C99 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L -# error "Compiler does not advertise C99 conformance" -#endif - -#include -extern int puts (const char *); -extern int printf (const char *, ...); -extern int dprintf (int, const char *, ...); -extern void *malloc (size_t); - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -// dprintf is used instead of fprintf to avoid needing to declare -// FILE and stderr. -#define debug(...) dprintf (2, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - #error "your preprocessor is broken" -#endif -#if BIG_OK -#else - #error "your preprocessor is broken" -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case '\''s'\'': // string - str = va_arg (args_copy, const char *); - break; - case '\''d'\'': // int - number = va_arg (args_copy, int); - break; - case '\''f'\'': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -' - -# Test code for whether the C compiler supports C99 (body of main). -ac_c_conftest_c99_main=' - // Check bool. - _Bool success = false; - success |= (argc != 0); - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[0] = argv[0][0]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); -' - -# Test code for whether the C compiler supports C11 (global declarations) -ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L -# error "Compiler does not advertise C11 conformance" -#endif - -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; -' - -# Test code for whether the C compiler supports C11 (body of main). -ac_c_conftest_c11_main=' - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - v1.i = 2; - v1.w.k = 5; - ok |= v1.i != 5; -' - -# Test code for whether the C compiler supports C11 (complete). -ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} -${ac_c_conftest_c11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - ${ac_c_conftest_c11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C99 (complete). -ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (complete). -ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - return ok; -} -" - -# Test code for whether the C++ compiler supports C++98 (global declarations) -ac_cxx_conftest_cxx98_globals=' -// Does the compiler advertise C++98 conformance? -#if !defined __cplusplus || __cplusplus < 199711L -# error "Compiler does not advertise C++98 conformance" -#endif - -// These inclusions are to reject old compilers that -// lack the unsuffixed header files. -#include -#include - -// and are *not* freestanding headers in C++98. -extern void assert (int); -namespace std { - extern int strcmp (const char *, const char *); -} - -// Namespaces, exceptions, and templates were all added after "C++ 2.0". -using std::exception; -using std::strcmp; - -namespace { - -void test_exception_syntax() -{ - try { - throw "test"; - } catch (const char *s) { - // Extra parentheses suppress a warning when building autoconf itself, - // due to lint rules shared with more typical C programs. - assert (!(strcmp) (s, "test")); - } -} - -template struct test_template -{ - T const val; - explicit test_template(T t) : val(t) {} - template T add(U u) { return static_cast(u) + val; } -}; - -} // anonymous namespace -' - -# Test code for whether the C++ compiler supports C++98 (body of main) -ac_cxx_conftest_cxx98_main=' - assert (argc); - assert (! argv[0]); -{ - test_exception_syntax (); - test_template tt (2.0); - assert (tt.add (4) == 6.0); - assert (true && !false); -} -' - -# Test code for whether the C++ compiler supports C++11 (global declarations) -ac_cxx_conftest_cxx11_globals=' -// Does the compiler advertise C++ 2011 conformance? -#if !defined __cplusplus || __cplusplus < 201103L -# error "Compiler does not advertise C++11 conformance" -#endif - -namespace cxx11test -{ - constexpr int get_val() { return 20; } - - struct testinit - { - int i; - double d; - }; - - class delegate - { - public: - delegate(int n) : n(n) {} - delegate(): delegate(2354) {} - - virtual int getval() { return this->n; }; - protected: - int n; - }; - - class overridden : public delegate - { - public: - overridden(int n): delegate(n) {} - virtual int getval() override final { return this->n * 2; } - }; - - class nocopy - { - public: - nocopy(int i): i(i) {} - nocopy() = default; - nocopy(const nocopy&) = delete; - nocopy & operator=(const nocopy&) = delete; - private: - int i; - }; - - // for testing lambda expressions - template Ret eval(Fn f, Ret v) - { - return f(v); - } - - // for testing variadic templates and trailing return types - template auto sum(V first) -> V - { - return first; - } - template auto sum(V first, Args... rest) -> V - { - return first + sum(rest...); - } -} -' - -# Test code for whether the C++ compiler supports C++11 (body of main) -ac_cxx_conftest_cxx11_main=' -{ - // Test auto and decltype - auto a1 = 6538; - auto a2 = 48573953.4; - auto a3 = "String literal"; - - int total = 0; - for (auto i = a3; *i; ++i) { total += *i; } - - decltype(a2) a4 = 34895.034; -} -{ - // Test constexpr - short sa[cxx11test::get_val()] = { 0 }; -} -{ - // Test initializer lists - cxx11test::testinit il = { 4323, 435234.23544 }; -} -{ - // Test range-based for - int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, - 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - for (auto &x : array) { x += 23; } -} -{ - // Test lambda expressions - using cxx11test::eval; - assert (eval ([](int x) { return x*2; }, 21) == 42); - double d = 2.0; - assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); - assert (d == 5.0); - assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); - assert (d == 5.0); -} -{ - // Test use of variadic templates - using cxx11test::sum; - auto a = sum(1); - auto b = sum(1, 2); - auto c = sum(1.0, 2.0, 3.0); -} -{ - // Test constructor delegation - cxx11test::delegate d1; - cxx11test::delegate d2(); - cxx11test::delegate d3(45); -} -{ - // Test override and final - cxx11test::overridden o1(55464); -} -{ - // Test nullptr - char *c = nullptr; -} -{ - // Test template brackets - test_template<::test_template> v(test_template(12)); -} -{ - // Unicode literals - char const *utf8 = u8"UTF-8 string \u2500"; - char16_t const *utf16 = u"UTF-8 string \u2500"; - char32_t const *utf32 = U"UTF-32 string \u2500"; -} -' - -# Test code for whether the C compiler supports C++11 (complete). -ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} -${ac_cxx_conftest_cxx11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - ${ac_cxx_conftest_cxx11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C++98 (complete). -ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - return ok; -} -" - -as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" -as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" -as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" -as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" -as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" -as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" -as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" -as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" -as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" - -# Auxiliary files required by this configure script. -ac_aux_files="config.guess config.sub" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}/tools" - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" - break - fi - ac_first_candidate=false - - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 -fi - - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' - and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_config_headers="$ac_config_headers include/config.h" - - - -libwine_version="1.0" - - -# Check whether --enable-archs was given. -if test ${enable_archs+y} -then : - enableval=$enable_archs; -fi - -# Check whether --enable-win16 was given. -if test ${enable_win16+y} -then : - enableval=$enable_win16; -fi - -# Check whether --enable-win64 was given. -if test ${enable_win64+y} -then : - enableval=$enable_win64; -fi - -# Check whether --enable-tests was given. -if test ${enable_tests+y} -then : - enableval=$enable_tests; -fi - -# Check whether --enable-build-id was given. -if test ${enable_build_id+y} -then : - enableval=$enable_build_id; -fi - -# Check whether --enable-maintainer-mode was given. -if test ${enable_maintainer_mode+y} -then : - enableval=$enable_maintainer_mode; -fi - -# Check whether --enable-silent-rules was given. -if test ${enable_silent_rules+y} -then : - enableval=$enable_silent_rules; -fi - -# Check whether --enable-werror was given. -if test ${enable_werror+y} -then : - enableval=$enable_werror; -fi - - - -# Check whether --with-alsa was given. -if test ${with_alsa+y} -then : - withval=$with_alsa; -fi - - -# Check whether --with-capi was given. -if test ${with_capi+y} -then : - withval=$with_capi; -fi - - -# Check whether --with-coreaudio was given. -if test ${with_coreaudio+y} -then : - withval=$with_coreaudio; -fi - - -# Check whether --with-cups was given. -if test ${with_cups+y} -then : - withval=$with_cups; -fi - - -# Check whether --with-dbus was given. -if test ${with_dbus+y} -then : - withval=$with_dbus; -fi - - -# Check whether --with-float-abi was given. -if test ${with_float_abi+y} -then : - withval=$with_float_abi; -fi - - -# Check whether --with-fontconfig was given. -if test ${with_fontconfig+y} -then : - withval=$with_fontconfig; -fi - - -# Check whether --with-freetype was given. -if test ${with_freetype+y} -then : - withval=$with_freetype; -fi - - -# Check whether --with-gettext was given. -if test ${with_gettext+y} -then : - withval=$with_gettext; -fi - - -# Check whether --with-gettextpo was given. -if test ${with_gettextpo+y} -then : - withval=$with_gettextpo; if test "x$withval" = "xno"; then ac_cv_header_gettext_po_h=no; fi -fi - - -# Check whether --with-gphoto was given. -if test ${with_gphoto+y} -then : - withval=$with_gphoto; -fi - - -# Check whether --with-gnutls was given. -if test ${with_gnutls+y} -then : - withval=$with_gnutls; -fi - - -# Check whether --with-gssapi was given. -if test ${with_gssapi+y} -then : - withval=$with_gssapi; -fi - - -# Check whether --with-gstreamer was given. -if test ${with_gstreamer+y} -then : - withval=$with_gstreamer; -fi - - -# Check whether --with-inotify was given. -if test ${with_inotify+y} -then : - withval=$with_inotify; -fi - - -# Check whether --with-krb5 was given. -if test ${with_krb5+y} -then : - withval=$with_krb5; -fi - - -# Check whether --with-mingw was given. -if test ${with_mingw+y} -then : - withval=$with_mingw; -fi - - -# Check whether --with-netapi was given. -if test ${with_netapi+y} -then : - withval=$with_netapi; -fi - - -# Check whether --with-opencl was given. -if test ${with_opencl+y} -then : - withval=$with_opencl; if test "x$withval" = "xno"; then ac_cv_header_CL_cl_h=no; ac_cv_header_OpenCL_opencl_h=no; fi -fi - - -# Check whether --with-opengl was given. -if test ${with_opengl+y} -then : - withval=$with_opengl; -fi - - -# Check whether --with-osmesa was given. -if test ${with_osmesa+y} -then : - withval=$with_osmesa; -fi - - -# Check whether --with-oss was given. -if test ${with_oss+y} -then : - withval=$with_oss; -fi - - -# Check whether --with-pcap was given. -if test ${with_pcap+y} -then : - withval=$with_pcap; if test "x$withval" = "xno"; then ac_cv_header_pcap_pcap_h=no; fi -fi - - -# Check whether --with-pcsclite was given. -if test ${with_pcsclite+y} -then : - withval=$with_pcsclite; -fi - - -# Check whether --with-pthread was given. -if test ${with_pthread+y} -then : - withval=$with_pthread; -fi - - -# Check whether --with-pulse was given. -if test ${with_pulse+y} -then : - withval=$with_pulse; -fi - - -# Check whether --with-sane was given. -if test ${with_sane+y} -then : - withval=$with_sane; -fi - - -# Check whether --with-sdl was given. -if test ${with_sdl+y} -then : - withval=$with_sdl; -fi - - -# Check whether --with-udev was given. -if test ${with_udev+y} -then : - withval=$with_udev; -fi - - -# Check whether --with-unwind was given. -if test ${with_unwind+y} -then : - withval=$with_unwind; -fi - - -# Check whether --with-usb was given. -if test ${with_usb+y} -then : - withval=$with_usb; -fi - - -# Check whether --with-v4l2 was given. -if test ${with_v4l2+y} -then : - withval=$with_v4l2; -fi - - -# Check whether --with-vulkan was given. -if test ${with_vulkan+y} -then : - withval=$with_vulkan; -fi - - -# Check whether --with-wayland was given. -if test ${with_wayland+y} -then : - withval=$with_wayland; -fi - - -# Check whether --with-xcomposite was given. -if test ${with_xcomposite+y} -then : - withval=$with_xcomposite; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi -fi - - -# Check whether --with-xcursor was given. -if test ${with_xcursor+y} -then : - withval=$with_xcursor; if test "x$withval" = "xno"; then ac_cv_header_X11_Xcursor_Xcursor_h=no; fi -fi - - -# Check whether --with-xfixes was given. -if test ${with_xfixes+y} -then : - withval=$with_xfixes; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xfixes_h=no; fi -fi - - -# Check whether --with-xinerama was given. -if test ${with_xinerama+y} -then : - withval=$with_xinerama; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xinerama_h=no; fi -fi - - -# Check whether --with-xinput was given. -if test ${with_xinput+y} -then : - withval=$with_xinput; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_XInput_h=no; fi -fi - - -# Check whether --with-xinput2 was given. -if test ${with_xinput2+y} -then : - withval=$with_xinput2; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_XInput2_h=no; fi -fi - - -# Check whether --with-xrandr was given. -if test ${with_xrandr+y} -then : - withval=$with_xrandr; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xrandr_h=no; fi -fi - - -# Check whether --with-xrender was given. -if test ${with_xrender+y} -then : - withval=$with_xrender; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xrender_h=no; fi -fi - - -# Check whether --with-xshape was given. -if test ${with_xshape+y} -then : - withval=$with_xshape; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_shape_h=no; fi -fi - - -# Check whether --with-xshm was given. -if test ${with_xshm+y} -then : - withval=$with_xshm; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_XShm_h=no; fi -fi - - -# Check whether --with-xxf86vm was given. -if test ${with_xxf86vm+y} -then : - withval=$with_xxf86vm; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_xf86vmode_h=no; ac_cv_header_X11_extensions_xf86vmproto_h=no; fi -fi - - - -# Check whether --with-system-dllpath was given. -if test ${with_system_dllpath+y} -then : - withval=$with_system_dllpath; system_dllpath=$withval - -fi - - -# Check whether --with-wine-tools was given. -if test ${with_wine_tools+y} -then : - withval=$with_wine_tools; -fi - - -# Check whether --with-wine64 was given. -if test ${with_wine64+y} -then : - withval=$with_wine64; -fi - - - - - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -dlldir=\${libdir}/wine - -fontdir=\${datadir}/wine/fonts - -nlsdir=\${datadir}/wine/nls - - - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval test \${ac_cv_prog_make_${ac_make}_set+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - SET_MAKE= -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -fi - - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -printf %s "checking whether the C compiler works... " >&6; } -ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else $as_nop - ac_file='' -fi -if test -z "$ac_file" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -printf %s "checking for C compiler default output file name... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -printf "%s\n" "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -printf %s "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -printf "%s\n" "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -printf %s "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -printf "%s\n" "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -printf %s "checking for suffix of object files... " >&6; } -if test ${ac_cv_objext+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -printf "%s\n" "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+y} -ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_g=yes -else $as_nop - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c89_program -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -printf "%s\n" "$CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -printf "%s\n" "$ac_ct_CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+y} -ac_save_CXXFLAGS=$CXXFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -printf %s "checking whether $CXX accepts -g... " >&6; } -if test ${ac_cv_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_g=yes -else $as_nop - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - -else $as_nop - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_cxx11=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program -_ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 -fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx98+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_cxx98=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx98=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx98" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx98" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cpp", so it can be a program name with args. -set dummy ${ac_tool_prefix}cpp; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CPPBIN+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CPPBIN"; then - ac_cv_prog_CPPBIN="$CPPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CPPBIN="${ac_tool_prefix}cpp" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CPPBIN=$ac_cv_prog_CPPBIN -if test -n "$CPPBIN"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPPBIN" >&5 -printf "%s\n" "$CPPBIN" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CPPBIN"; then - ac_ct_CPPBIN=$CPPBIN - # Extract the first word of "cpp", so it can be a program name with args. -set dummy cpp; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CPPBIN+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CPPBIN"; then - ac_cv_prog_ac_ct_CPPBIN="$ac_ct_CPPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CPPBIN="cpp" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CPPBIN=$ac_cv_prog_ac_ct_CPPBIN -if test -n "$ac_ct_CPPBIN"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CPPBIN" >&5 -printf "%s\n" "$ac_ct_CPPBIN" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CPPBIN" = x; then - CPPBIN="cpp" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CPPBIN=$ac_ct_CPPBIN - fi -else - CPPBIN="$ac_cv_prog_CPPBIN" -fi - - -printf "%s\n" "#define EXEEXT \"$ac_exeext\"" >>confdefs.h - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. -set dummy ${ac_tool_prefix}ld; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="${ac_tool_prefix}ld" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LD=$ac_cv_prog_LD -if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LD"; then - ac_ct_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. -set dummy ld; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_LD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_LD"; then - ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LD="ld" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LD=$ac_cv_prog_ac_ct_LD -if test -n "$ac_ct_LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 -printf "%s\n" "$ac_ct_LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_LD" = x; then - LD="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LD=$ac_ct_LD - fi -else - LD="$ac_cv_prog_LD" -fi - - -case $host in - *-darwin*) - with_fontconfig=${with_fontconfig:-no} - ;; - *-mingw32*|*-cygwin*) - enable_win16=${enable_win16:-no} - with_mingw=${with_mingw:-no} - ;; -esac - - -case $host in - x86_64*|amd64*) - if test "x$enable_win64" != "xyes" -a "$cross_compiling" != "yes" -a x"$enable_archs" = x - then - CC="$CC -m32" - CXX="$CXX -m32" - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC works" >&5 -printf %s "checking whether $CC works... " >&6; } -if test ${wine_cv_cc_m32+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_cc_m32=yes -else $as_nop - wine_cv_cc_m32=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_cc_m32" >&5 -printf "%s\n" "$wine_cv_cc_m32" >&6; } - test $wine_cv_cc_m32 != no || as_fn_error $? "Cannot build a 32-bit program, you need to install 32-bit development libraries." "$LINENO" 5 - host_cpu="i386" - notice_platform="32-bit " - TARGETFLAGS="$TARGETFLAGS -m32" - PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib32/pkgconfig:/usr/lib/pkgconfig} - export PKG_CONFIG_LIBDIR - with_unwind=${with_unwind:-no} - else - CC="$CC -m64" - CXX="$CXX -m64" - host_cpu="x86_64" - notice_platform="64-bit " - TARGETFLAGS="$TARGETFLAGS -m64" - fi - ;; - arm*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports Thumb-2" >&5 -printf %s "checking whether $CC supports Thumb-2... " >&6; } -if test ${wine_cv_thumb2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -asm(".syntax unified\n\t.thumb\n\tldm r0,{r0-r8}"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_thumb2=yes -else $as_nop - wine_cv_thumb2=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_thumb2" >&5 -printf "%s\n" "$wine_cv_thumb2" >&6; } - if test x"$wine_cv_thumb2" = xyes - then - CFLAGS="$CFLAGS -mthumb" - TARGETFLAGS="$TARGETFLAGS -mthumb" - else - CFLAGS="$CFLAGS -marm" - TARGETFLAGS="$TARGETFLAGS -marm" - fi - case $with_float_abi in - soft|softfp|hard) - float_abi=$with_float_abi ;; - *) - case $host_os in - *eabihf) - float_abi=hard ;; - *) - float_abi=softfp - saved_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -mfloat-abi=$float_abi" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -mfloat-abi=$float_abi" >&5 -printf %s "checking whether $CC supports -mfloat-abi=$float_abi... " >&6; } -if test ${wine_cv_float_abi+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -asm("vmrs r2,fpscr"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_float_abi=yes -else $as_nop - wine_cv_float_abi=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_float_abi" >&5 -printf "%s\n" "$wine_cv_float_abi" >&6; } - if test $wine_cv_float_abi = no - then - float_abi=soft - as_fn_append wine_warnings "|Floating point is not supported for this target. The resulting build won't be compatible with Windows ARM binaries." - fi - CFLAGS=$saved_CFLAGS - esac - ;; - esac - CFLAGS="$CFLAGS -mfloat-abi=$float_abi" - TARGETFLAGS="$TARGETFLAGS -mfloat-abi=$float_abi" - ;; - i[3456789]86*) - with_unwind=${with_unwind:-no} - ;; -esac - -enable_win16=${enable_win16:-i386} -enable_win64=${enable_win64:-no} -enable_wow64=${enable_wow64:-aarch64,x86_64} -enable_wow64win=${enable_wow64win:-aarch64,x86_64} -enable_wow64cpu=${enable_wow64cpu:-x86_64} -enable_vcruntime140_1=${enable_vcruntime140_1:-x86_64,arm64ec} - -enable_cmd=${enable_cmd:-yes} -enable_dllhost=${enable_dllhost:-yes} -enable_dpnsvr=${enable_dpnsvr:-i386,x86_64,arm64ec} -enable_dxdiag=${enable_dxdiag:-yes} -enable_msiexec=${enable_msiexec:-yes} -enable_netsh=${enable_netsh:-yes} -enable_regsvr32=${enable_regsvr32:-yes} -enable_rundll32=${enable_rundll32:-yes} - -enable_winetest=${enable_winetest:-$enable_tests} - -if test "x$enable_win64" = "xyes" -then - test -z "$with_wine64" || as_fn_error $? "--enable-win64 and --with-wine64 are mutually exclusive. ---enable-win64 should be used in the 64-bit build tree, --with-wine64 in the 32-bit Wow64 build tree." "$LINENO" 5 -fi - -case $build_os in - cygwin*|mingw32*) toolsext=".exe" - ;; - *) toolsext="" - ;; -esac - -HOST_ARCH=unknown -case "$host_cpu" in - aarch64*) HOST_ARCH=aarch64 ;; - arm*) HOST_ARCH=arm ;; - i[3456789]86*) HOST_ARCH=i386 ;; - x86_64) HOST_ARCH=x86_64 ;; -esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the directory containing the Wine tools" >&5 -printf %s "checking for the directory containing the Wine tools... " >&6; } -if test ${wine_cv_toolsdir+y} -then : - printf %s "(cached) " >&6 -else $as_nop - wine_cv_toolsdir="$with_wine_tools" - if test -z "$with_wine_tools"; then - if test "$cross_compiling" = "yes"; then - as_fn_error $? "you must use the --with-wine-tools option when cross-compiling." "$LINENO" 5 - elif test -n "$with_wine64"; then - wine_cv_toolsdir="$with_wine64" - fi - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_toolsdir" >&5 -printf "%s\n" "$wine_cv_toolsdir" >&6; } -if test -z "$wine_cv_toolsdir"; then - wine_makedep=tools/makedep$toolsext -elif test -d "$wine_cv_toolsdir/tools/winebuild"; then - wine_makedep=$wine_cv_toolsdir/tools/makedep$toolsext - enable_tools=${enable_tools:-no} - test -f "$wine_makedep" || as_fn_error $? "the Wine tools have not yet been built in $wine_cv_toolsdir" "$LINENO" 5 -else - as_fn_error $? "could not find Wine tools in $wine_cv_toolsdir" "$LINENO" 5 -fi -toolsdir=$wine_cv_toolsdir - -MAKEDEP=$wine_makedep - -RUNTESTFLAGS="-q -P wine" - -SED_CMD="LC_ALL=C sed -e 's,@bindir@,\${bindir},g' -e 's,@dlldir@,\${dlldir},g' -e 's,@PACKAGE_STRING@,$PACKAGE_STRING,g' -e 's,@PACKAGE_VERSION@,$PACKAGE_VERSION,g'" - - -if test -n "$host_alias" -a "$host_alias" != "$build_alias" -then - TARGETFLAGS="-b $host_alias $TARGETFLAGS" -fi - -for ac_prog in flex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_FLEX+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$FLEX"; then - ac_cv_prog_FLEX="$FLEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_FLEX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -FLEX=$ac_cv_prog_FLEX -if test -n "$FLEX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5 -printf "%s\n" "$FLEX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$FLEX" && break -done -test -n "$FLEX" || FLEX="none" - -if test "$FLEX" = "none" -then - as_fn_error $? "no suitable flex found. Please install the 'flex' package." "$LINENO" 5 -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether flex is recent enough" >&5 -printf %s "checking whether flex is recent enough... " >&6; } -if test ${wine_cv_recent_flex+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat >conftest.l </dev/null 2>&5 - then - wine_cv_recent_flex=yes - else - wine_cv_recent_flex=no - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_recent_flex" >&5 -printf "%s\n" "$wine_cv_recent_flex" >&6; } -test $wine_cv_recent_flex != no || as_fn_error $? "Your flex version is too old. Please install flex version 2.5.33 or newer." "$LINENO" 5 - -for ac_prog in bison -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_BISON+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$BISON"; then - ac_cv_prog_BISON="$BISON" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_BISON="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -BISON=$ac_cv_prog_BISON -if test -n "$BISON"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5 -printf "%s\n" "$BISON" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$BISON" && break -done -test -n "$BISON" || BISON="none" - -if test "$BISON" = "none" -then - as_fn_error $? "no suitable bison found. Please install the 'bison' package." "$LINENO" 5 -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether bison is recent enough" >&5 -printf %s "checking whether bison is recent enough... " >&6; } -if test ${wine_cv_recent_bison+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat >conftest.y </dev/null 2>&5 - then - wine_cv_recent_bison=yes - else - wine_cv_recent_bison=no - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_recent_bison" >&5 -printf "%s\n" "$wine_cv_recent_bison" >&6; } -test $wine_cv_recent_bison != no || as_fn_error $? "Your bison version is too old. Please install bison version 3.0 or newer." "$LINENO" 5 - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar gar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar gar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="ar" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -printf "%s\n" "$STRIP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -printf "%s\n" "$ac_ct_STRIP" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP="strip" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -printf %s "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -printf "%s\n" "no, using $LN_S" >&6; } -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -# Extract the first word of "ldconfig", so it can be a program name with args. -set dummy ldconfig; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_LDCONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $LDCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /sbin /usr/sbin $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_LDCONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_LDCONFIG" && ac_cv_path_LDCONFIG="true" - ;; -esac -fi -LDCONFIG=$ac_cv_path_LDCONFIG -if test -n "$LDCONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LDCONFIG" >&5 -printf "%s\n" "$LDCONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -for ac_prog in msgfmt -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_MSGFMT+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$MSGFMT"; then - ac_cv_prog_MSGFMT="$MSGFMT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_MSGFMT="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MSGFMT=$ac_cv_prog_MSGFMT -if test -n "$MSGFMT"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 -printf "%s\n" "$MSGFMT" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$MSGFMT" && break -done -test -n "$MSGFMT" || MSGFMT="false" - -if test ${ac_tool_prefix+y} -then : - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$PKG_CONFIG"; then - ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PKG_CONFIG=$ac_cv_prog_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -printf "%s\n" "$PKG_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if ${ac_cv_prog_PKG_CONFIG:+false} : -then : - if test "x$cross_compiling" = xyes -then : - -else $as_nop - { ac_cv_prog_PKG_CONFIG=; unset ac_cv_prog_PKG_CONFIG;} - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$PKG_CONFIG"; then - ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_PKG_CONFIG="pkg-config" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PKG_CONFIG=$ac_cv_prog_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -printf "%s\n" "$PKG_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -else $as_nop - PKG_CONFIG=$ac_cv_prog_PKG_CONFIG -fi - -if test "x$enable_maintainer_mode" != "xyes" -then - FONTFORGE="" - RSVG="" - CONVERT="" - ICOTOOL="" -else - test "$srcdir" = . || as_fn_error $? "Maintainer mode cannot work out of tree." "$LINENO" 5 - for ac_prog in fontforge -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_FONTFORGE+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$FONTFORGE"; then - ac_cv_prog_FONTFORGE="$FONTFORGE" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_FONTFORGE="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -FONTFORGE=$ac_cv_prog_FONTFORGE -if test -n "$FONTFORGE"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FONTFORGE" >&5 -printf "%s\n" "$FONTFORGE" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$FONTFORGE" && break -done -test -n "$FONTFORGE" || FONTFORGE="false" - - for ac_prog in rsvg-convert rsvg -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RSVG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$RSVG"; then - ac_cv_prog_RSVG="$RSVG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_RSVG="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RSVG=$ac_cv_prog_RSVG -if test -n "$RSVG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RSVG" >&5 -printf "%s\n" "$RSVG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$RSVG" && break -done -test -n "$RSVG" || RSVG="false" - - for ac_prog in convert -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CONVERT+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CONVERT"; then - ac_cv_prog_CONVERT="$CONVERT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CONVERT="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CONVERT=$ac_cv_prog_CONVERT -if test -n "$CONVERT"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CONVERT" >&5 -printf "%s\n" "$CONVERT" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CONVERT" && break -done -test -n "$CONVERT" || CONVERT="false" - - for ac_prog in icotool -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ICOTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ICOTOOL"; then - ac_cv_prog_ICOTOOL="$ICOTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ICOTOOL="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ICOTOOL=$ac_cv_prog_ICOTOOL -if test -n "$ICOTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ICOTOOL" >&5 -printf "%s\n" "$ICOTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ICOTOOL" && break -done -test -n "$ICOTOOL" || ICOTOOL="false" - - test "$FONTFORGE" != "false" || as_fn_error $? "You need fontforge to rebuild fonts in maintainer mode." "$LINENO" 5 - test "$RSVG" != "false" || as_fn_error $? "You need rsvg to rebuild icons in maintainer mode." "$LINENO" 5 - - if test "$CONVERT" = false - then - as_fn_error $? "You need imagemagick to rebuild icons in maintainer mode." "$LINENO" 5 - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for recent enough imagemagick" >&5 -printf %s "checking for recent enough imagemagick... " >&6; } - convert_version=`convert --version | head -n1` - if test "x$convert_version" != "x" - then - convert_version_major=`expr "$convert_version" : '.* \([0-9]*\)\.[0-9]*'` - convert_version_minor=`expr "$convert_version" : '.* [0-9]*\.\([0-9]*\)'` - if test "$convert_version_major" -eq 6 -a "$convert_version_minor" -lt 6 - then - CONVERT=false - fi - fi - if test "$CONVERT" = false - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no ($convert_version_major.$convert_version_minor)" >&5 -printf "%s\n" "no ($convert_version_major.$convert_version_minor)" >&6; } - as_fn_error $? "You need imagemagick version 6.6 or newer to rebuild icons in maintainer mode." "$LINENO" 5 - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes ($convert_version_major.$convert_version_minor)" >&5 -printf "%s\n" "yes ($convert_version_major.$convert_version_minor)" >&6; } - fi - fi - - if test "$ICOTOOL" = false - then - as_fn_error $? "You need icotool to rebuild icons in maintainer mode." "$LINENO" 5 - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for recent enough icotool" >&5 -printf %s "checking for recent enough icotool... " >&6; } - icotool_version=`icotool --version | head -n1` - if test "x$icotool_version" != "x" - then - icotool_version_major=`expr "$icotool_version" : '.* \([0-9]*\)\.[0-9]*'` - icotool_version_minor=`expr "$icotool_version" : '.* [0-9]*\.\([0-9]*\)'` - if test "$icotool_version_major" -eq 0 -a "$icotool_version_minor" -lt 29 - then - ICOTOOL=false - as_fn_append wine_warnings "|icotool version 0.29.0 or newer is needed to rebuild icons." - fi - fi - if test "$ICOTOOL" = false - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no ($icotool_version_major.$icotool_version_minor)" >&5 -printf "%s\n" "no ($icotool_version_major.$icotool_version_minor)" >&6; } - as_fn_error $? "You need icotool version 0.29.0 or newer to rebuild icons in maintainer mode." "$LINENO" 5 - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes ($icotool_version_major.$icotool_version_minor)" >&5 -printf "%s\n" "yes ($icotool_version_major.$icotool_version_minor)" >&6; } - fi - fi - - with_gettext=yes - with_gettextpo=yes - - enable_werror=yes -fi - -test "x$with_gettext" != xno || MSGFMT=false -if test "$MSGFMT" != "false" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether msgfmt supports contexts" >&5 -printf %s "checking whether msgfmt supports contexts... " >&6; } -if test ${wine_cv_msgfmt_contexts+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat >conftest.po <&5 - then - wine_cv_msgfmt_contexts=yes - else - wine_cv_msgfmt_contexts=no - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_msgfmt_contexts" >&5 -printf "%s\n" "$wine_cv_msgfmt_contexts" >&6; } - test $wine_cv_msgfmt_contexts != no || MSGFMT=false -fi -if test "$MSGFMT" = false -then : - case "x$with_gettext" in - x) as_fn_append wine_warnings "|gettext tools not found (or too old), translations won't be built." ;; - xno) ;; - *) as_fn_error $? "gettext tools not found (or too old), translations won't be built. -This is an error since --with-gettext was requested." "$LINENO" 5 ;; -esac -enable_po=${enable_po:-no} -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for i386_set_ldt in -li386" >&5 -printf %s "checking for i386_set_ldt in -li386... " >&6; } -if test ${ac_cv_lib_i386_i386_set_ldt+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-li386 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char i386_set_ldt (); -int -main (void) -{ -return i386_set_ldt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_i386_i386_set_ldt=yes -else $as_nop - ac_cv_lib_i386_i386_set_ldt=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_i386_i386_set_ldt" >&5 -printf "%s\n" "$ac_cv_lib_i386_i386_set_ldt" >&6; } -if test "x$ac_cv_lib_i386_i386_set_ldt" = xyes -then : - I386_LIBS="-li386" - -fi - - -OPENGL_LIBS="" - - - -# Check whether --enable-largefile was given. -if test ${enable_largefile+y} -then : - enableval=$enable_largefile; -fi - -if test "$enable_largefile" != no; then - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -printf %s "checking for special C compiler options needed for large files... " >&6; } -if test ${ac_cv_sys_largefile_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then - ac_save_CC=$CC - while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF - if ac_fn_c_try_compile "$LINENO" -then : - break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_largefile_CC=' -n32'; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test ${ac_cv_sys_file_offset_bits+y} -then : - printf %s "(cached) " >&6 -else $as_nop - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_file_offset_bits=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_file_offset_bits=64; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cv_sys_file_offset_bits=unknown - break -done -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } -case $ac_cv_sys_file_offset_bits in #( - no | unknown) ;; - *) -printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h -;; -esac -rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } -if test ${ac_cv_sys_large_files+y} -then : - printf %s "(cached) " >&6 -else $as_nop - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_large_files=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_large_files=1; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cv_sys_large_files=unknown - break -done -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -printf "%s\n" "$ac_cv_sys_large_files" >&6; } -case $ac_cv_sys_large_files in #( - no | unknown) ;; - *) -printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h -;; -esac -rm -rf conftest* - fi -fi - - -ac_header= ac_cache= -for ac_item in $ac_header_c_list -do - if test $ac_cache; then - ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi -done - - - - - - - - -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes -then : - -printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "CL/cl.h" "ac_cv_header_CL_cl_h" "$ac_includes_default" -if test "x$ac_cv_header_CL_cl_h" = xyes -then : - printf "%s\n" "#define HAVE_CL_CL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "EGL/egl.h" "ac_cv_header_EGL_egl_h" "$ac_includes_default" -if test "x$ac_cv_header_EGL_egl_h" = xyes -then : - printf "%s\n" "#define HAVE_EGL_EGL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "OpenCL/opencl.h" "ac_cv_header_OpenCL_opencl_h" "$ac_includes_default" -if test "x$ac_cv_header_OpenCL_opencl_h" = xyes -then : - printf "%s\n" "#define HAVE_OPENCL_OPENCL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_inet_h" = xyes -then : - printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "arpa/nameser.h" "ac_cv_header_arpa_nameser_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_nameser_h" = xyes -then : - printf "%s\n" "#define HAVE_ARPA_NAMESER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "asm/types.h" "ac_cv_header_asm_types_h" "$ac_includes_default" -if test "x$ac_cv_header_asm_types_h" = xyes -then : - printf "%s\n" "#define HAVE_ASM_TYPES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "asm/user.h" "ac_cv_header_asm_user_h" "$ac_includes_default" -if test "x$ac_cv_header_asm_user_h" = xyes -then : - printf "%s\n" "#define HAVE_ASM_USER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "elf.h" "ac_cv_header_elf_h" "$ac_includes_default" -if test "x$ac_cv_header_elf_h" = xyes -then : - printf "%s\n" "#define HAVE_ELF_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes -then : - printf "%s\n" "#define HAVE_FLOAT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "gettext-po.h" "ac_cv_header_gettext_po_h" "$ac_includes_default" -if test "x$ac_cv_header_gettext_po_h" = xyes -then : - printf "%s\n" "#define HAVE_GETTEXT_PO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "libproc.h" "ac_cv_header_libproc_h" "$ac_includes_default" -if test "x$ac_cv_header_libproc_h" = xyes -then : - printf "%s\n" "#define HAVE_LIBPROC_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "link.h" "ac_cv_header_link_h" "$ac_includes_default" -if test "x$ac_cv_header_link_h" = xyes -then : - printf "%s\n" "#define HAVE_LINK_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/cdrom.h" "ac_cv_header_linux_cdrom_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_cdrom_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_CDROM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/filter.h" "ac_cv_header_linux_filter_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_filter_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_FILTER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/hdreg.h" "ac_cv_header_linux_hdreg_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_hdreg_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_HDREG_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/hidraw.h" "ac_cv_header_linux_hidraw_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_hidraw_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_HIDRAW_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_input_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_INPUT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/ioctl.h" "ac_cv_header_linux_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_ioctl_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_IOCTL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/major.h" "ac_cv_header_linux_major_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_major_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_MAJOR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/param.h" "ac_cv_header_linux_param_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_param_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_PARAM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/serial.h" "ac_cv_header_linux_serial_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_serial_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_SERIAL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/types.h" "ac_cv_header_linux_types_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_types_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_TYPES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/ucdrom.h" "ac_cv_header_linux_ucdrom_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_ucdrom_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_UCDROM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/wireless.h" "ac_cv_header_linux_wireless_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_wireless_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_WIRELESS_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "lwp.h" "ac_cv_header_lwp_h" "$ac_includes_default" -if test "x$ac_cv_header_lwp_h" = xyes -then : - printf "%s\n" "#define HAVE_LWP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "mach-o/loader.h" "ac_cv_header_mach_o_loader_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_o_loader_h" = xyes -then : - printf "%s\n" "#define HAVE_MACH_O_LOADER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_mach_h" = xyes -then : - printf "%s\n" "#define HAVE_MACH_MACH_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "machine/cpu.h" "ac_cv_header_machine_cpu_h" "$ac_includes_default" -if test "x$ac_cv_header_machine_cpu_h" = xyes -then : - printf "%s\n" "#define HAVE_MACHINE_CPU_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "machine/sysarch.h" "ac_cv_header_machine_sysarch_h" "$ac_includes_default" -if test "x$ac_cv_header_machine_sysarch_h" = xyes -then : - printf "%s\n" "#define HAVE_MACHINE_SYSARCH_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "mntent.h" "ac_cv_header_mntent_h" "$ac_includes_default" -if test "x$ac_cv_header_mntent_h" = xyes -then : - printf "%s\n" "#define HAVE_MNTENT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" -if test "x$ac_cv_header_netdb_h" = xyes -then : - printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/in_systm.h" "ac_cv_header_netinet_in_systm_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_systm_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IN_SYSTM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/tcp.h" "ac_cv_header_netinet_tcp_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_tcp_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_TCP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/tcp_fsm.h" "ac_cv_header_netinet_tcp_fsm_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_tcp_fsm_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_TCP_FSM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "pcap/pcap.h" "ac_cv_header_pcap_pcap_h" "$ac_includes_default" -if test "x$ac_cv_header_pcap_pcap_h" = xyes -then : - printf "%s\n" "#define HAVE_PCAP_PCAP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "port.h" "ac_cv_header_port_h" "$ac_includes_default" -if test "x$ac_cv_header_port_h" = xyes -then : - printf "%s\n" "#define HAVE_PORT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" -if test "x$ac_cv_header_pwd_h" = xyes -then : - printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sched.h" "ac_cv_header_sched_h" "$ac_includes_default" -if test "x$ac_cv_header_sched_h" = xyes -then : - printf "%s\n" "#define HAVE_SCHED_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "scsi/scsi.h" "ac_cv_header_scsi_scsi_h" "$ac_includes_default" -if test "x$ac_cv_header_scsi_scsi_h" = xyes -then : - printf "%s\n" "#define HAVE_SCSI_SCSI_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "scsi/scsi_ioctl.h" "ac_cv_header_scsi_scsi_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_scsi_scsi_ioctl_h" = xyes -then : - printf "%s\n" "#define HAVE_SCSI_SCSI_IOCTL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "scsi/sg.h" "ac_cv_header_scsi_sg_h" "$ac_includes_default" -if test "x$ac_cv_header_scsi_sg_h" = xyes -then : - printf "%s\n" "#define HAVE_SCSI_SG_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes -then : - printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/attr.h" "ac_cv_header_sys_attr_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_attr_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_ATTR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/auxv.h" "ac_cv_header_sys_auxv_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_auxv_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_AUXV_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/cdio.h" "ac_cv_header_sys_cdio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_cdio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_CDIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/epoll.h" "ac_cv_header_sys_epoll_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_epoll_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_EPOLL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_event_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_EVENT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/extattr.h" "ac_cv_header_sys_extattr_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_extattr_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_EXTATTR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_filio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_FILIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/ipc.h" "ac_cv_header_sys_ipc_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ipc_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_IPC_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/link.h" "ac_cv_header_sys_link_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_link_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_LINK_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/modem.h" "ac_cv_header_sys_modem_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_modem_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_MODEM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/mtio.h" "ac_cv_header_sys_mtio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mtio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_MTIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/prctl.h" "ac_cv_header_sys_prctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_prctl_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_PRCTL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/ptrace.h" "ac_cv_header_sys_ptrace_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ptrace_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_PTRACE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/queue.h" "ac_cv_header_sys_queue_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_queue_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_QUEUE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/random.h" "ac_cv_header_sys_random_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_random_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_RANDOM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/resource.h" "ac_cv_header_sys_resource_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_resource_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_RESOURCE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/scsiio.h" "ac_cv_header_sys_scsiio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_scsiio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SCSIIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/shm.h" "ac_cv_header_sys_shm_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_shm_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SHM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/signal.h" "ac_cv_header_sys_signal_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_signal_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SIGNAL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/socketvar.h" "ac_cv_header_sys_socketvar_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_socketvar_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SOCKETVAR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/sockio.h" "ac_cv_header_sys_sockio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sockio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SOCKIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_statvfs_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_STATVFS_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/strtio.h" "ac_cv_header_sys_strtio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_strtio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_STRTIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/syscall.h" "ac_cv_header_sys_syscall_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_syscall_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SYSCALL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/sysinfo.h" "ac_cv_header_sys_sysinfo_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysinfo_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SYSINFO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/times.h" "ac_cv_header_sys_times_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_times_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_TIMES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/uio.h" "ac_cv_header_sys_uio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_uio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_UIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/user.h" "ac_cv_header_sys_user_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_user_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_USER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/utsname.h" "ac_cv_header_sys_utsname_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_utsname_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_UTSNAME_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/vnode.h" "ac_cv_header_sys_vnode_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_vnode_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_VNODE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/xattr.h" "ac_cv_header_sys_xattr_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_xattr_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_XATTR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "syscall.h" "ac_cv_header_syscall_h" "$ac_includes_default" -if test "x$ac_cv_header_syscall_h" = xyes -then : - printf "%s\n" "#define HAVE_SYSCALL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default" -if test "x$ac_cv_header_utime_h" = xyes -then : - printf "%s\n" "#define HAVE_UTIME_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "valgrind/memcheck.h" "ac_cv_header_valgrind_memcheck_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_memcheck_h" = xyes -then : - printf "%s\n" "#define HAVE_VALGRIND_MEMCHECK_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = xyes -then : - printf "%s\n" "#define HAVE_VALGRIND_VALGRIND_H 1" >>confdefs.h - -fi - -ac_fn_c_check_header_compile "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = xyes -then : - -printf "%s\n" "#define MAJOR_IN_MKDEV 1" >>confdefs.h - -fi - -if test $ac_cv_header_sys_mkdev_h = no; then - ac_fn_c_check_header_compile "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = xyes -then : - -printf "%s\n" "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h - -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 -printf %s "checking whether stat file-mode macros are broken... " >&6; } -if test ${ac_cv_header_stat_broken+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -#if defined S_ISBLK && defined S_IFDIR -extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; -#endif - -#if defined S_ISBLK && defined S_IFCHR -extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; -#endif - -#if defined S_ISLNK && defined S_IFREG -extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; -#endif - -#if defined S_ISSOCK && defined S_IFREG -extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_header_stat_broken=no -else $as_nop - ac_cv_header_stat_broken=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 -printf "%s\n" "$ac_cv_header_stat_broken" >&6; } -if test $ac_cv_header_stat_broken = yes; then - -printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h - -fi - - - -ac_fn_c_check_header_compile "$LINENO" "sys/conf.h" "ac_cv_header_sys_conf_h" "#include - #ifdef HAVE_SYS_PARAM_H - # include - #endif -" -if test "x$ac_cv_header_sys_conf_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_CONF_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" "#include - #ifdef HAVE_SYS_PARAM_H - # include - #endif -" -if test "x$ac_cv_header_sys_mount_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_MOUNT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/statfs.h" "ac_cv_header_sys_statfs_h" "#include - #ifdef HAVE_SYS_PARAM_H - # include - #endif -" -if test "x$ac_cv_header_sys_statfs_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_STATFS_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/user.h" "ac_cv_header_sys_user_h" "#include - #ifdef HAVE_SYS_PARAM_H - # include - #endif -" -if test "x$ac_cv_header_sys_user_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_USER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/vfs.h" "ac_cv_header_sys_vfs_h" "#include - #ifdef HAVE_SYS_PARAM_H - # include - #endif -" -if test "x$ac_cv_header_sys_vfs_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_VFS_H 1" >>confdefs.h - -fi - - -saved_sysctl_h_CFLAGS=$CFLAGS -test "x${GCC}" != xyes || CFLAGS="$CFLAGS -Werror" -ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#include - #ifdef HAVE_SYS_PARAM_H - # include - #endif -" -if test "x$ac_cv_header_sys_sysctl_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h - -fi - -CFLAGS=$saved_sysctl_h_CFLAGS - -ac_fn_c_check_header_compile "$LINENO" "netinet/ip.h" "ac_cv_header_netinet_ip_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_ip_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_net_if_h" = xyes -then : - printf "%s\n" "#define HAVE_NET_IF_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "net/if_arp.h" "ac_cv_header_net_if_arp_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_net_if_arp_h" = xyes -then : - printf "%s\n" "#define HAVE_NET_IF_ARP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "net/if_dl.h" "ac_cv_header_net_if_dl_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_net_if_dl_h" = xyes -then : - printf "%s\n" "#define HAVE_NET_IF_DL_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "net/if_types.h" "ac_cv_header_net_if_types_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_net_if_types_h" = xyes -then : - printf "%s\n" "#define HAVE_NET_IF_TYPES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "net/route.h" "ac_cv_header_net_route_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_net_route_h" = xyes -then : - printf "%s\n" "#define HAVE_NET_ROUTE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/if_ether.h" "ac_cv_header_netinet_if_ether_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_if_ether_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IF_ETHER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/in_pcb.h" "ac_cv_header_netinet_in_pcb_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_in_pcb_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IN_PCB_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/ip_icmp.h" "ac_cv_header_netinet_ip_icmp_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_ip_icmp_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IP_ICMP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/ip_var.h" "ac_cv_header_netinet_ip_var_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_ip_var_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IP_VAR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/udp.h" "ac_cv_header_netinet_udp_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_udp_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_UDP_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet6/ip6_var.h" "ac_cv_header_netinet6_ip6_var_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netinet6_ip6_var_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET6_IP6_VAR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netipx/ipx.h" "ac_cv_header_netipx_ipx_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_netipx_ipx_h" = xyes -then : - printf "%s\n" "#define HAVE_NETIPX_IPX_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "sys/un.h" "ac_cv_header_sys_un_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NET_ROUTE_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NET_IF_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif -" -if test "x$ac_cv_header_sys_un_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_UN_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "netinet/udp_var.h" "ac_cv_header_netinet_udp_var_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif - #ifdef HAVE_NETINET_IP_VAR_H - # include - #endif - #ifdef HAVE_NETINET_IP_ICMP_H - # include - #endif - #ifdef HAVE_NETINET_UDP_H - # include - #endif - #ifdef HAVE_NETINET_TCP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_udp_var_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_UDP_VAR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/icmp_var.h" "ac_cv_header_netinet_icmp_var_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif - #ifdef HAVE_NETINET_IP_VAR_H - # include - #endif - #ifdef HAVE_NETINET_IP_ICMP_H - # include - #endif - #ifdef HAVE_NETINET_UDP_H - # include - #endif - #ifdef HAVE_NETINET_TCP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_icmp_var_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_ICMP_VAR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/icmp6.h" "ac_cv_header_netinet_icmp6_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif - #ifdef HAVE_NETINET_IP_VAR_H - # include - #endif - #ifdef HAVE_NETINET_IP_ICMP_H - # include - #endif - #ifdef HAVE_NETINET_UDP_H - # include - #endif - #ifdef HAVE_NETINET_TCP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_icmp6_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_ICMP6_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "netinet/tcp_var.h" "ac_cv_header_netinet_tcp_var_h" "#include - #include - #ifdef HAVE_SYS_SOCKETVAR_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_NETINET_IN_SYSTM_H - # include - #endif - #ifdef HAVE_NETINET_IP_H - # include - #endif - #ifdef HAVE_NETINET_IP_VAR_H - # include - #endif - #ifdef HAVE_NETINET_IP_ICMP_H - # include - #endif - #ifdef HAVE_NETINET_UDP_H - # include - #endif - #ifdef HAVE_NETINET_TCP_H - # include - #endif -" -if test "x$ac_cv_header_netinet_tcp_var_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_TCP_VAR_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "linux/ipx.h" "ac_cv_header_linux_ipx_h" "#include - #include - #ifdef HAVE_ASM_TYPES_H - # include - #endif - #ifdef HAVE_LINUX_TYPES_H - # include - #endif -" -if test "x$ac_cv_header_linux_ipx_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_IPX_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/irda.h" "ac_cv_header_linux_irda_h" "#include - #include - #ifdef HAVE_ASM_TYPES_H - # include - #endif - #ifdef HAVE_LINUX_TYPES_H - # include - #endif -" -if test "x$ac_cv_header_linux_irda_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_IRDA_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/rtnetlink.h" "ac_cv_header_linux_rtnetlink_h" "#include - #include - #ifdef HAVE_ASM_TYPES_H - # include - #endif - #ifdef HAVE_LINUX_TYPES_H - # include - #endif -" -if test "x$ac_cv_header_linux_rtnetlink_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_RTNETLINK_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "resolv.h" "ac_cv_header_resolv_h" "#include - #include - #ifdef HAVE_NETINET_IN_H - # include - #endif - #ifdef HAVE_ARPA_NAMESER_H - # include - #endif -" -if test "x$ac_cv_header_resolv_h" = xyes -then : - printf "%s\n" "#define HAVE_RESOLV_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "#include -" -if test "x$ac_cv_header_ifaddrs_h" = xyes -then : - printf "%s\n" "#define HAVE_IFADDRS_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "sys/ucontext.h" "ac_cv_header_sys_ucontext_h" "#include -" -if test "x$ac_cv_header_sys_ucontext_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_UCONTEXT_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "sys/thr.h" "ac_cv_header_sys_thr_h" "#include -#ifdef HAVE_SYS_UCONTEXT_H -#include -#endif -" -if test "x$ac_cv_header_sys_thr_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_THR_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" "#include -" -if test "x$ac_cv_header_pthread_np_h" = xyes -then : - printf "%s\n" "#define HAVE_PTHREAD_NP_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "linux/videodev2.h" "ac_cv_header_linux_videodev2_h" "#include -#include -#ifdef HAVE_ASM_TYPES_H -#include -#endif -" -if test "x$ac_cv_header_linux_videodev2_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_VIDEODEV2_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "libprocstat.h" "ac_cv_header_libprocstat_h" "#ifdef HAVE_SYS_PARAM_H -#include -#endif -#include -#ifdef HAVE_SYS_QUEUE_H -#include -#endif -" -if test "x$ac_cv_header_libprocstat_h" = xyes -then : - printf "%s\n" "#define HAVE_LIBPROCSTAT_H 1" >>confdefs.h - -fi - - -if test "x$ac_cv_header_sys_xattr_h" = xyes -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getxattr takes additional arguments" >&5 -printf %s "checking whether getxattr takes additional arguments... " >&6; } -if test ${wine_cv_xattr_extra_args+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -getxattr("", "", "", 0, 0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - wine_cv_xattr_extra_args=yes -else $as_nop - wine_cv_xattr_extra_args=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_xattr_extra_args" >&5 -printf "%s\n" "$wine_cv_xattr_extra_args" >&6; } - test $wine_cv_xattr_extra_args != yes || -printf "%s\n" "#define XATTR_ADDITIONAL_OPTIONS 1" >>confdefs.h - -fi - - -DLLFLAGS="" - -LDDLLFLAGS="" - -LDEXECFLAGS="" - -EXTRACFLAGS="" - -UNIXDLLFLAGS="-fPIC" - -UNIXLDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname,\$(UNIXLIB)" - -TOP_INSTALL_LIB="" - -TOP_INSTALL_DEV="" - -WINELOADER_LDFLAGS="" - -WINEPRELOADER_LDFLAGS="" - -DLLEXT=".so" - -LIBEXT="so" -# Extract the first word of "ldd", so it can be a program name with args. -set dummy ldd; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_LDD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $LDD in - [\\/]* | ?:[\\/]*) - ac_cv_path_LDD="$LDD" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="/sbin:/usr/sbin:$PATH" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_LDD="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_LDD" && ac_cv_path_LDD="true" - ;; -esac -fi -LDD=$ac_cv_path_LDD -if test -n "$LDD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LDD" >&5 -printf "%s\n" "$LDD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -printf "%s\n" "$OTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL="otool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -printf "%s\n" "$ac_ct_OTOOL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL="otool" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args. -set dummy ${ac_tool_prefix}readelf; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_READELF+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$READELF"; then - ac_cv_prog_READELF="$READELF" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_READELF="${ac_tool_prefix}readelf" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -READELF=$ac_cv_prog_READELF -if test -n "$READELF"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5 -printf "%s\n" "$READELF" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_READELF"; then - ac_ct_READELF=$READELF - # Extract the first word of "readelf", so it can be a program name with args. -set dummy readelf; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_READELF+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_READELF"; then - ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_READELF="readelf" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_READELF=$ac_cv_prog_ac_ct_READELF -if test -n "$ac_ct_READELF"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5 -printf "%s\n" "$ac_ct_READELF" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_READELF" = x; then - READELF="true" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - READELF=$ac_ct_READELF - fi -else - READELF="$ac_cv_prog_READELF" -fi - -wine_rules="all:" -SUBDIRS="" - -DISABLED_SUBDIRS="" - -CONFIGURE_TARGETS="" - - -wine_fn_config_makefile () -{ - as_fn_append SUBDIRS " \\$as_nl $1" - eval enable=\$$2 - case "$enable" in - no) as_fn_append DISABLED_SUBDIRS " $1" ;; - yes) ;; - *aarch64*|*arm*|*i386*|*x86_64*) - if test -n "$PE_ARCHS" - then - for i in $PE_ARCHS - do - test $(expr ",$enable," : ".*,$i,") -gt 0 || as_fn_append ${i}_DISABLED_SUBDIRS " $1" - done - else - test $(expr ",$enable," : ".*,$HOST_ARCH,") -gt 0 || as_fn_append DISABLED_SUBDIRS " $1" - fi ;; - "") - case "$1, $PE_ARCHS " in - programs/*,*\ arm64ec\ *) as_fn_append arm64ec_DISABLED_SUBDIRS " $1" ;; - esac ;; - esac -} - -wine_fn_config_symlink () -{ - ac_links=$@ - as_fn_append wine_rules " -$ac_links: - @./config.status \$@" - for f in $ac_links; do as_fn_append CONFIGURE_TARGETS " $f"; done -} - -case $host_os in - cygwin*|mingw32*) - LIBEXT="dll" - DLLEXT="" - EXTRACFLAGS="-D__WINE_PE_BUILD" - if test "x$HOST_ARCH" = xi386 -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--disable-stdcall-fixup" >&5 -printf %s "checking whether the compiler supports -Wl,--disable-stdcall-fixup... " >&6; } -if test ${ac_cv_cflags__Wl___disable_stdcall_fixup+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,--disable-stdcall-fixup" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl___disable_stdcall_fixup=yes -else $as_nop - ac_cv_cflags__Wl___disable_stdcall_fixup=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___disable_stdcall_fixup" >&5 -printf "%s\n" "$ac_cv_cflags__Wl___disable_stdcall_fixup" >&6; } -if test "x$ac_cv_cflags__Wl___disable_stdcall_fixup" = xyes -then : - LDDLLFLAGS="-Wl,--disable-stdcall-fixup" -fi -fi - enable_loader=${enable_loader:-no} - enable_server=${enable_server:-no} - with_x=${with_x:-no} - with_pthread=${with_pthread:-no} - ;; - - darwin*|macosx*) - LIBEXT="dylib" - DLLFLAGS="$DLLFLAGS -fPIC" - LDDLLFLAGS="-fPIC" - enable_winemac_drv=${enable_winemac_drv:-yes} - CARBON_LIBS="-framework Carbon" - - COREFOUNDATION_LIBS="-framework CoreFoundation" - - DISKARBITRATION_LIBS="-framework DiskArbitration -framework CoreFoundation" - - IOKIT_LIBS="-framework IOKit -framework CoreFoundation" - - METAL_LIBS="-framework Metal" - - APPLICATIONSERVICES_LIBS="-framework ApplicationServices" - - CORESERVICES_LIBS="-framework CoreServices" - - APPKIT_LIBS="-framework AppKit" - - SECURITY_LIBS="-framework Security -framework CoreFoundation" - - SYSTEMCONFIGURATION_LIBS="-framework SystemConfiguration" - - - WINELOADER_LDFLAGS="-Wl,-pie,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist" - - case $HOST_ARCH in - i386|x86_64) wine_can_build_preloader=yes ;; - *) wine_can_build_preloader=no ;; - esac - - if test "$wine_can_build_preloader" = "yes" - then - WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs -e _start -ldylib1.o -mmacosx-version-min=10.7 -Wl,-no_new_main,-segalign,0x1000,-pagezero_size,0x1000,-sectcreate,__TEXT,__info_plist,loader/wine_info.plist" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-no_pie" >&5 -printf %s "checking whether the compiler supports -Wl,-no_pie... " >&6; } -if test ${ac_cv_cflags__Wl__no_pie+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,-no_pie" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl__no_pie=yes -else $as_nop - ac_cv_cflags__Wl__no_pie=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__no_pie" >&5 -printf "%s\n" "$ac_cv_cflags__Wl__no_pie" >&6; } -if test "x$ac_cv_cflags__Wl__no_pie" = xyes -then : - WINEPRELOADER_LDFLAGS="-Wl,-no_pie $WINEPRELOADER_LDFLAGS" -fi - case $HOST_ARCH in - i386) - WINEPRELOADER_LDFLAGS="-Wl,-image_base,0x7d400000 $WINEPRELOADER_LDFLAGS" - ;; - x86_64) - WINEPRELOADER_LDFLAGS="-Wl,-image_base,0x200000000,-segalign,0x1000,-segaddr,WINE_RESERVE,0x1000 $WINEPRELOADER_LDFLAGS" - ;; - esac - WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -mmacosx-version-min=10.7" - else - as_fn_append wine_warnings "|can't build Wine preloader; many programs won't work" - fi - - if test "x$with_coreaudio" != "xno"; - then - COREAUDIO_LIBS="-framework CoreFoundation -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreMIDI" - - enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-yes} - fi - if test "$ac_cv_header_OpenCL_opencl_h" = "yes" - then - OPENCL_LIBS="-framework OpenCL" - - ac_cv_lib_OpenCL_clGetPlatformInfo=yes - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether MTLDevice protocol supports registryID property" >&5 -printf %s "checking whether MTLDevice protocol supports registryID property... " >&6; } - ac_ext=m -ac_cpp='$OBJCPP $CPPFLAGS' -ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_objc_compiler_gnu - - ac_ext=m -ac_cpp='$OBJCPP $CPPFLAGS' -ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_objc_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in gcc objcc objc cc CC clang - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OBJC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$OBJC"; then - ac_cv_prog_OBJC="$OBJC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJC=$ac_cv_prog_OBJC -if test -n "$OBJC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJC" >&5 -printf "%s\n" "$OBJC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$OBJC" && break - done -fi -if test -z "$OBJC"; then - ac_ct_OBJC=$OBJC - for ac_prog in gcc objcc objc cc CC clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OBJC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_OBJC"; then - ac_cv_prog_ac_ct_OBJC="$ac_ct_OBJC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC -if test -n "$ac_ct_OBJC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJC" >&5 -printf "%s\n" "$ac_ct_OBJC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_OBJC" && break -done - - if test "x$ac_ct_OBJC" = x; then - OBJC="gcc" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJC=$ac_ct_OBJC - fi -fi - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Objective C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU Objective C" >&5 -printf %s "checking whether the compiler supports GNU Objective C... " >&6; } -if test ${ac_cv_objc_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_objc_compiler_gnu=$ac_compiler_gnu - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objc_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_objc_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_objc_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GOBJC=yes -else - GOBJC= -fi -ac_test_OBJCFLAGS=${OBJCFLAGS+y} -ac_save_OBJCFLAGS=$OBJCFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5 -printf %s "checking whether $OBJC accepts -g... " >&6; } -if test ${ac_cv_prog_objc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_objc_werror_flag=$ac_objc_werror_flag - ac_objc_werror_flag=yes - ac_cv_prog_objc_g=no - OBJCFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - ac_cv_prog_objc_g=yes -else $as_nop - OBJCFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - -else $as_nop - ac_objc_werror_flag=$ac_save_objc_werror_flag - OBJCFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - ac_cv_prog_objc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_objc_werror_flag=$ac_save_objc_werror_flag -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_objc_g" >&5 -printf "%s\n" "$ac_cv_prog_objc_g" >&6; } -if test $ac_test_OBJCFLAGS; then - OBJCFLAGS=$ac_save_OBJCFLAGS -elif test $ac_cv_prog_objc_g = yes; then - if test "$GOBJC" = yes; then - OBJCFLAGS="-g -O2" - else - OBJCFLAGS="-g" - fi -else - if test "$GOBJC" = yes; then - OBJCFLAGS="-O2" - else - OBJCFLAGS= - fi -fi -ac_ext=m -ac_cpp='$OBJCPP $CPPFLAGS' -ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_objc_compiler_gnu - - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -id device; device.registryID; - ; - return 0; -} -_ACEOF -if ac_fn_objc_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - -printf "%s\n" "#define HAVE_MTLDEVICE_REGISTRYID 1" >>confdefs.h - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - UNIXLDFLAGS="-dynamiclib -install_name @rpath/\$(UNIXLIB) -Wl,-rpath,@loader_path\/" - WINELOADER_DEPENDS="wine_info.plist" - - ;; - - linux-android*) - -printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h - - DLLFLAGS="$DLLFLAGS -fPIC" - LDDLLFLAGS="-fPIC" - LDEXECFLAGS="-Wl,-pie" - enable_wineandroid_drv=${enable_wineandroid_drv:-yes} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-z,defs" >&5 -printf %s "checking whether the compiler supports -Wl,-z,defs... " >&6; } -if test ${ac_cv_cflags__Wl__z_defs+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,-z,defs" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl__z_defs=yes -else $as_nop - ac_cv_cflags__Wl__z_defs=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__z_defs" >&5 -printf "%s\n" "$ac_cv_cflags__Wl__z_defs" >&6; } -if test "x$ac_cv_cflags__Wl__z_defs" = xyes -then : - UNIXLDFLAGS="$UNIXLDFLAGS -Wl,-z,defs" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fPIC -Wl,--export-dynamic" >&5 -printf %s "checking whether the compiler supports -fPIC -Wl,--export-dynamic... " >&6; } -if test ${ac_cv_cflags__fPIC__Wl___export_dynamic+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fPIC -Wl,--export-dynamic" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fPIC__Wl___export_dynamic=yes -else $as_nop - ac_cv_cflags__fPIC__Wl___export_dynamic=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fPIC__Wl___export_dynamic" >&5 -printf "%s\n" "$ac_cv_cflags__fPIC__Wl___export_dynamic" >&6; } -if test "x$ac_cv_cflags__fPIC__Wl___export_dynamic" = xyes -then : - WINELOADER_LDFLAGS="-Wl,--export-dynamic" -fi - WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lEGL" >&5 -printf %s "checking for -lEGL... " >&6; } -if test ${ac_cv_lib_soname_EGL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lEGL $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char eglGetProcAddress (); -int -main (void) -{ -return eglGetProcAddress (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_EGL=`$ac_cv_path_LDD conftest.exe | grep "EGL" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_EGL=`$OTOOL -L conftest$ac_exeext | grep "libEGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libEGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_EGL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libEGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libEGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_EGL:+false} : -then : - ac_cv_lib_soname_EGL=`$LDD conftest$ac_exeext | grep "libEGL\\.$LIBEXT" | sed -e "s/^.*\(libEGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_EGL= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_EGL:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_EGL" >&5 -printf "%s\n" "$ac_cv_lib_soname_EGL" >&6; } - -printf "%s\n" "#define SONAME_LIBEGL \"$ac_cv_lib_soname_EGL\"" >>confdefs.h - - -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lGLESv2" >&5 -printf %s "checking for -lGLESv2... " >&6; } -if test ${ac_cv_lib_soname_GLESv2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lGLESv2 $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char glFlush (); -int -main (void) -{ -return glFlush (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_GLESv2=`$ac_cv_path_LDD conftest.exe | grep "GLESv2" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_GLESv2=`$OTOOL -L conftest$ac_exeext | grep "libGLESv2\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGLESv2\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_GLESv2=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGLESv2\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGLESv2\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_GLESv2:+false} : -then : - ac_cv_lib_soname_GLESv2=`$LDD conftest$ac_exeext | grep "libGLESv2\\.$LIBEXT" | sed -e "s/^.*\(libGLESv2\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_GLESv2= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_GLESv2:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_GLESv2" >&5 -printf "%s\n" "$ac_cv_lib_soname_GLESv2" >&6; } - -printf "%s\n" "#define SONAME_LIBGLESV2 \"$ac_cv_lib_soname_GLESv2\"" >>confdefs.h - - -fi - - if test "x$exec_prefix" = xNONE - then - case $HOST_ARCH in - i386) exec_prefix='${prefix}/x86' ;; - x86_64) exec_prefix='${prefix}/x86_64' ;; - arm) exec_prefix='${prefix}/armeabi-v7a' ;; - aarch64) exec_prefix='${prefix}/arm64-v8a' ;; - esac - fi - ;; - - *) - -printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h - - test "$ac_cv_sys_file_offset_bits" = 64 && -printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h - - if test $HOST_ARCH = i386 - then - DLLFLAGS="$DLLFLAGS -fno-PIC" - LDDLLFLAGS="-fno-PIC" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-PIC -Wl,-z,notext" >&5 -printf %s "checking whether the compiler supports -fno-PIC -Wl,-z,notext... " >&6; } -if test ${ac_cv_cflags__fno_PIC__Wl__z_notext+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fno-PIC -Wl,-z,notext" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fno_PIC__Wl__z_notext=yes -else $as_nop - ac_cv_cflags__fno_PIC__Wl__z_notext=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fno_PIC__Wl__z_notext" >&5 -printf "%s\n" "$ac_cv_cflags__fno_PIC__Wl__z_notext" >&6; } -if test "x$ac_cv_cflags__fno_PIC__Wl__z_notext" = xyes -then : - LDDLLFLAGS="$LDDLLFLAGS -Wl,-z,notext" -fi - else - DLLFLAGS="$DLLFLAGS -fPIC" - LDDLLFLAGS="-fPIC" - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -Wl,-z,defs works correctly" >&5 -printf %s "checking whether -Wl,-z,defs works correctly... " >&6; } -if test ${ac_cv_wl_z_defs+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $UNIXDLLFLAGS $UNIXLDFLAGS -Wl,-z,defs" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -extern char **environ; char **envp; void myfunc(void) { envp = environ; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_wl_z_defs=yes -else $as_nop - ac_cv_wl_z_defs=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS=$ac_save_CFLAGS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_wl_z_defs" >&5 -printf "%s\n" "$ac_cv_wl_z_defs" >&6; } - test $ac_cv_wl_z_defs != yes || as_fn_append UNIXLDFLAGS " -Wl,-z,defs" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--export-dynamic" >&5 -printf %s "checking whether the compiler supports -Wl,--export-dynamic... " >&6; } -if test ${ac_cv_cflags__Wl___export_dynamic+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,--export-dynamic" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl___export_dynamic=yes -else $as_nop - ac_cv_cflags__Wl___export_dynamic=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___export_dynamic" >&5 -printf "%s\n" "$ac_cv_cflags__Wl___export_dynamic" >&6; } -if test "x$ac_cv_cflags__Wl___export_dynamic" = xyes -then : - WINELOADER_LDFLAGS="-Wl,--export-dynamic" -fi - WINEPRELOADER_LDFLAGS="-nostartfiles -nodefaultlibs" - - case $host_os in - linux*) - as_fn_append WINELOADER_LDFLAGS " -pie" - case $HOST_ARCH in - i386|arm) - as_fn_append WINEPRELOADER_LDFLAGS " -static -Wl,-Ttext=0x7d400000" ;; - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -static-pie" >&5 -printf %s "checking whether the compiler supports -static-pie... " >&6; } -if test ${ac_cv_cflags__static_pie+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -static-pie" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__static_pie=yes -else $as_nop - ac_cv_cflags__static_pie=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__static_pie" >&5 -printf "%s\n" "$ac_cv_cflags__static_pie" >&6; } -if test "x$ac_cv_cflags__static_pie" = xyes -then : - as_fn_append WINEPRELOADER_LDFLAGS " -static-pie" -else $as_nop - as_fn_append WINEPRELOADER_LDFLAGS " -static -Wl,-Ttext=0x7d7d00000000" -fi - ;; - esac - ;; - *) - case $HOST_ARCH in - i386|arm) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-Ttext-segment=0x60000000" >&5 -printf %s "checking whether the compiler supports -Wl,-Ttext-segment=0x60000000... " >&6; } -if test ${ac_cv_cflags__Wl__Ttext_segment_0x60000000+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,-Ttext-segment=0x60000000" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl__Ttext_segment_0x60000000=yes -else $as_nop - ac_cv_cflags__Wl__Ttext_segment_0x60000000=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__Ttext_segment_0x60000000" >&5 -printf "%s\n" "$ac_cv_cflags__Wl__Ttext_segment_0x60000000" >&6; } -if test "x$ac_cv_cflags__Wl__Ttext_segment_0x60000000" = xyes -then : - as_fn_append WINELOADER_LDFLAGS " -Wl,-Ttext-segment=0x60000000" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--section-start,.interp=0x60000400" >&5 -printf %s "checking whether the compiler supports -Wl,--section-start,.interp=0x60000400... " >&6; } -if test ${ac_cv_cflags__Wl___section_start__interp_0x60000400+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,--section-start,.interp=0x60000400" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl___section_start__interp_0x60000400=yes -else $as_nop - ac_cv_cflags__Wl___section_start__interp_0x60000400=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___section_start__interp_0x60000400" >&5 -printf "%s\n" "$ac_cv_cflags__Wl___section_start__interp_0x60000400" >&6; } -if test "x$ac_cv_cflags__Wl___section_start__interp_0x60000400" = xyes -then : - as_fn_append WINELOADER_LDFLAGS " -Wl,--section-start,.interp=0x60000400" -fi -fi - ;; - *) - as_fn_append WINELOADER_LDFLAGS " -pie" - ;; - esac - ;; - esac - ;; -esac - -enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no} -enable_wineandroid_drv=${enable_wineandroid_drv:-no} -enable_winemac_drv=${enable_winemac_drv:-no} - -PE_ARCHS="" - -cross_archs= -if test ${enable_archs+y} -then : - test "x$with_system_dllpath" = "x" || as_fn_error $? "\"The --with-system-dllpath option is not compatible with --enable-archs\"" "$LINENO" 5 - ac_save_IFS=$IFS - IFS=' ,' - set x $enable_archs - IFS=$ac_save_IFS - shift - for arch - do - case $arch in - i386|x86_64|arm|aarch64|arm64ec) cross_archs="$cross_archs $arch" ;; - *) as_fn_error $? "Unknown cross-compilation architecture '$arch'" "$LINENO" 5 ;; - esac - done -else $as_nop - if test "x$with_mingw" != xno - then - test $HOST_ARCH = unknown || cross_archs=$HOST_ARCH - fi -fi - -for wine_arch in $cross_archs -do - case "x$with_mingw" in - xclang|x*/clang) eval "${wine_arch}_CC=\$with_mingw" ;; - esac - if eval \${${wine_arch}_CC:+false} : -then : - case $wine_arch in - aarch64) - for ac_prog in aarch64-w64-mingw32-clang aarch64-w64-mingw32-gcc clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_aarch64_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$aarch64_CC"; then - ac_cv_prog_aarch64_CC="$aarch64_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_aarch64_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -aarch64_CC=$ac_cv_prog_aarch64_CC -if test -n "$aarch64_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $aarch64_CC" >&5 -printf "%s\n" "$aarch64_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$aarch64_CC" && break -done -test -n "$aarch64_CC" || aarch64_CC="false" - - ;; - arm64ec) - for ac_prog in arm64ec-w64-mingw32-clang arm64ec-w64-mingw32-gcc clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_arm64ec_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$arm64ec_CC"; then - ac_cv_prog_arm64ec_CC="$arm64ec_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_arm64ec_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -arm64ec_CC=$ac_cv_prog_arm64ec_CC -if test -n "$arm64ec_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $arm64ec_CC" >&5 -printf "%s\n" "$arm64ec_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$arm64ec_CC" && break -done -test -n "$arm64ec_CC" || arm64ec_CC="false" - - ;; - arm) - for ac_prog in armv7-w64-mingw32-clang armv7-w64-mingw32-gcc clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_arm_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$arm_CC"; then - ac_cv_prog_arm_CC="$arm_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_arm_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -arm_CC=$ac_cv_prog_arm_CC -if test -n "$arm_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $arm_CC" >&5 -printf "%s\n" "$arm_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$arm_CC" && break -done -test -n "$arm_CC" || arm_CC="false" - - ;; - i386) - ac_prefix_list="i686-w64-mingw32-gcc i586-w64-mingw32-gcc i486-w64-mingw32-gcc i386-w64-mingw32-gcc i686-w64-mingw32-clang i586-w64-mingw32-clang i486-w64-mingw32-clang i386-w64-mingw32-clang " - for ac_prog in $ac_prefix_list clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_i386_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$i386_CC"; then - ac_cv_prog_i386_CC="$i386_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_i386_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -i386_CC=$ac_cv_prog_i386_CC -if test -n "$i386_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $i386_CC" >&5 -printf "%s\n" "$i386_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$i386_CC" && break -done -test -n "$i386_CC" || i386_CC="false" - - ;; - x86_64) - ac_prefix_list="x86_64-w64-mingw32-gcc amd64-w64-mingw32-gcc x86_64-w64-mingw32-clang amd64-w64-mingw32-clang " - for ac_prog in $ac_prefix_list clang -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_x86_64_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$x86_64_CC"; then - ac_cv_prog_x86_64_CC="$x86_64_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_x86_64_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -x86_64_CC=$ac_cv_prog_x86_64_CC -if test -n "$x86_64_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $x86_64_CC" >&5 -printf "%s\n" "$x86_64_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$x86_64_CC" && break -done -test -n "$x86_64_CC" || x86_64_CC="false" - - ;; - esac -fi - - saved_CC=$CC - saved_CFLAGS=$CFLAGS - saved_LDFLAGS=$LDFLAGS - - CFLAGS=${CROSSCFLAGS:-"-g -O2"} - LDFLAGS=$CROSSLDFLAGS - eval CC=\$${wine_arch}_CC - eval ${wine_arch}_CFLAGS=\$CFLAGS - eval ${wine_arch}_LDFLAGS=\$LDFLAGS - eval "${wine_arch}_EXTRACFLAGS=\"-D__WINE_PE_BUILD -Wall\"" - - target="" - as_wine_cv_crosscc=`printf "%s\n" "ac_cv_${wine_arch}_crosscc" | $as_tr_sh` - - if eval test \"x\$"${wine_arch}_CC"\" = x"false" -then : - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC works" >&5 -printf %s "checking whether $CC works... " >&6; } -if eval test \${$as_wine_cv_crosscc+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$as_wine_cv_crosscc=yes" -else $as_nop - eval "$as_wine_cv_crosscc=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$as_wine_cv_crosscc - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -fi - if eval test \"x\$"$as_wine_cv_crosscc"\" = x"yes" -then : - set x $CC - shift - while test $# -ge 1 - do - case "$1" in - *-gcc) target=`expr "$1" : '\(.*\)-gcc'` ;; - *-clang) target=`expr "$1" : '\(.*\)-clang'` ;; - esac - shift - done - - llvm_target=$target - if test -z "$llvm_target" - then - case $wine_arch in - i386) llvm_target=i686-windows ;; - arm) llvm_target=armv7-windows ;; - *) llvm_target=$wine_arch-windows ;; - esac - fi - llvm_extra_cflags="-target $llvm_target -fuse-ld=lld" - llvm_extra_ldflags="" - case $llvm_target in - *windows) llvm_cflags="-Wl,-subsystem:console -Wl,-WX" ;; - esac - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_$llvm_extra_cflags $llvm_cflags --no-default-config" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $llvm_extra_cflags $llvm_cflags --no-default-config" >&5 -printf %s "checking whether $CC supports $llvm_extra_cflags $llvm_cflags --no-default-config... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs $llvm_extra_cflags $llvm_cflags --no-default-config" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - llvm_extra_cflags="$llvm_extra_cflags --no-default-config" - llvm_extra_ldflags="--no-default-config" -else $as_nop - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_$llvm_extra_cflags $llvm_cflags" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $llvm_extra_cflags $llvm_cflags" >&5 -printf %s "checking whether $CC supports $llvm_extra_cflags $llvm_cflags... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs $llvm_extra_cflags $llvm_cflags" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - : -else $as_nop - llvm_extra_cflags="" -fi } -fi } - if test -n "$llvm_extra_cflags" - then - target=$llvm_target - eval "${wine_arch}_DELAYLOADFLAG=\"-Wl,-delayload,\"" - as_fn_append ${wine_arch}_EXTRACFLAGS " $llvm_extra_cflags" - as_fn_append ${wine_arch}_LDFLAGS " $llvm_extra_ldflags" - CFLAGS="$llvm_extra_cflags $llvm_cflags" - fi - eval "${wine_arch}_TARGET=\$target" -fi - - - if test -z "$target" - then - if test ${enable_archs+y} -then : - as_fn_error $? "MinGW $wine_arch compiler not found. -This is an error since --enable-archs=$wine_arch was requested." "$LINENO" 5 -fi - CC=$saved_CC - CFLAGS=$saved_CFLAGS - LDFLAGS=$saved_LDFLAGS - continue - fi - - as_wine_cv_crosscc_c99=`printf "%s\n" "ac_cv_${wine_arch}_crosscc_c99" | $as_tr_sh` - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } - if eval test \${$as_wine_cv_crosscc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - eval "$as_wine_cv_crosscc_c99=no" - for arg in '' '-std=gnu99' '-D__STDC__' - do - test -z "$arg" || CC="$CC $arg" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$as_wine_cv_crosscc_c99=\$arg" -else $as_nop - eval "$as_wine_cv_crosscc_c99=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - eval CC=\$${wine_arch}_CC - if eval test \"x\$"$as_wine_cv_crosscc_c99"\" = x"no" -then : - -else $as_nop - break -fi - done -fi - - eval res=\$$as_wine_cv_crosscc_c99 - - case "x$res" in - x) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } ;; - xno) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } - CC=$saved_CC - CFLAGS=$saved_CFLAGS - LDFLAGS=$saved_LDFLAGS - if test ${enable_archs+y} -then : - as_fn_error $? "MinGW $wine_arch compiler supporting C99 not found. -This is an error since --enable-archs=$wine_arch was requested." "$LINENO" 5 -fi - continue - ;; - x*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $res" >&5 -printf "%s\n" "$res" >&6; } - as_fn_append ${wine_arch}_CC " $res" ;; - esac - - if test "x$wine_arch" = xi386 -then : - -else $as_nop - as_wine_cv_seh_support=`printf "%s\n" "ac_cv_${wine_arch}_seh_support" | $as_tr_sh` - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports SEH directives" >&5 -printf %s "checking whether $CC supports SEH directives... " >&6; } -if eval test \${$as_wine_cv_seh_support+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -asm(".text\nac_test:\t.seh_proc ac_test\n\tnop\n\t.seh_stackalloc 16\n\t.seh_endprologue\n\t.seh_endproc"); -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - eval "$as_wine_cv_seh_support=yes" -else $as_nop - eval "$as_wine_cv_seh_support=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$as_wine_cv_seh_support - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval res=\$$as_wine_cv_seh_support - - if test "x$res" = xyes -then : - -else $as_nop - if test ${enable_archs+y} -then : - as_fn_error $? "The $wine_arch cross-compiler doesn't support SEH directives. -This is an error since --enable-archs=$wine_arch was requested." "$LINENO" 5 -fi - continue -fi -fi - - as_fn_append PE_ARCHS " $wine_arch" - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-fno-strict-aliasing" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5 -printf %s "checking whether $CC supports -fno-strict-aliasing... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -fno-strict-aliasing" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -fno-strict-aliasing" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Werror=unknown-warning-option" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror=unknown-warning-option" >&5 -printf %s "checking whether $CC supports -Werror=unknown-warning-option... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Werror=unknown-warning-option" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - CFLAGS="$CFLAGS -Werror=unknown-warning-option" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Werror=ignored-optimization-argument" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror=ignored-optimization-argument" >&5 -printf %s "checking whether $CC supports -Werror=ignored-optimization-argument... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Werror=ignored-optimization-argument" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - CFLAGS="$CFLAGS -Werror=ignored-optimization-argument" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wdeclaration-after-statement" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wdeclaration-after-statement" >&5 -printf %s "checking whether $CC supports -Wdeclaration-after-statement... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wdeclaration-after-statement" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wdeclaration-after-statement" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wempty-body" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wempty-body" >&5 -printf %s "checking whether $CC supports -Wempty-body... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wempty-body" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wempty-body" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wignored-qualifiers" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wignored-qualifiers" >&5 -printf %s "checking whether $CC supports -Wignored-qualifiers... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wignored-qualifiers" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wignored-qualifiers" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Winit-self" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Winit-self" >&5 -printf %s "checking whether $CC supports -Winit-self... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Winit-self" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Winit-self" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wpacked-not-aligned" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wpacked-not-aligned" >&5 -printf %s "checking whether $CC supports -Wpacked-not-aligned... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wpacked-not-aligned" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wno-packed-not-aligned" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wpragma-pack" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wpragma-pack" >&5 -printf %s "checking whether $CC supports -Wpragma-pack... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wpragma-pack" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wno-pragma-pack" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wmicrosoft-enum-forward-reference" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wmicrosoft-enum-forward-reference" >&5 -printf %s "checking whether $CC supports -Wmicrosoft-enum-forward-reference... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wmicrosoft-enum-forward-reference" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wno-microsoft-enum-forward-reference" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wshift-overflow=2" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshift-overflow=2" >&5 -printf %s "checking whether $CC supports -Wshift-overflow=2... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wshift-overflow=2" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wshift-overflow=2" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wstrict-prototypes" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wstrict-prototypes" >&5 -printf %s "checking whether $CC supports -Wstrict-prototypes... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wstrict-prototypes" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wstrict-prototypes" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wtype-limits" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wtype-limits" >&5 -printf %s "checking whether $CC supports -Wtype-limits... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wtype-limits" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wtype-limits" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wunused-but-set-parameter" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wunused-but-set-parameter" >&5 -printf %s "checking whether $CC supports -Wunused-but-set-parameter... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wunused-but-set-parameter" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wunused-but-set-parameter" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wvla" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wvla" >&5 -printf %s "checking whether $CC supports -Wvla... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wvla" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wvla" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wwrite-strings" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wwrite-strings" >&5 -printf %s "checking whether $CC supports -Wwrite-strings... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wwrite-strings" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wwrite-strings" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wpointer-arith" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wpointer-arith" >&5 -printf %s "checking whether $CC supports -Wpointer-arith... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wpointer-arith" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wpointer-arith" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wlogical-op" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wlogical-op" >&5 -printf %s "checking whether $CC supports -Wlogical-op... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wlogical-op" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wlogical-op" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wabsolute-value" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wabsolute-value" >&5 -printf %s "checking whether $CC supports -Wabsolute-value... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wabsolute-value" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wabsolute-value" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wenum-conversion" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wenum-conversion" >&5 -printf %s "checking whether $CC supports -Wenum-conversion... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wenum-conversion" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wenum-conversion" -fi } - - case $wine_arch in - i386) { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-fno-omit-frame-pointer" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-omit-frame-pointer" >&5 -printf %s "checking whether $CC supports -fno-omit-frame-pointer... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -fno-omit-frame-pointer" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -fno-omit-frame-pointer" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-mpreferred-stack-boundary=2" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -mpreferred-stack-boundary=2" >&5 -printf %s "checking whether $CC supports -mpreferred-stack-boundary=2... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -mpreferred-stack-boundary=2" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -mpreferred-stack-boundary=2" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wl,--disable-stdcall-fixup" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,--disable-stdcall-fixup" >&5 -printf %s "checking whether $CC supports -Wl,--disable-stdcall-fixup... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wl,--disable-stdcall-fixup" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_LDFLAGS " -Wl,--disable-stdcall-fixup" -fi } ;; - x86_64) { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wformat-overflow" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wformat-overflow" >&5 -printf %s "checking whether $CC supports -Wformat-overflow... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wformat-overflow" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wformat-overflow" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wnonnull" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnonnull" >&5 -printf %s "checking whether $CC supports -Wnonnull... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wnonnull" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Wnonnull" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-mcx16" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -mcx16" >&5 -printf %s "checking whether $CC supports -mcx16... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -mcx16" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -mcx16" -fi } - { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-mcmodel=small" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -mcmodel=small" >&5 -printf %s "checking whether $CC supports -mcmodel=small... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -mcmodel=small" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -mcmodel=small" -fi } ;; - esac - - wine_crossdebug=$CROSSDEBUG - if test -z "$wine_crossdebug" - then - for ac_flag in $CFLAGS; do - case $ac_flag in - -gdwarf*) wine_crossdebug=dwarf ;; - -gcodeview) wine_crossdebug=pdb ;; - -g) wine_crossdebug=${wine_crossdebug:-dwarf} ;; - esac - done - fi - - ac_debug_format_seen="" - for ac_flag in $CFLAGS; do - case $ac_flag in - -gdwarf*|-gcodeview) ac_debug_format_seen=$ac_flag ;; - esac - done - if test "x$ac_debug_format_seen" = x - then - case $wine_crossdebug in - *dwarf) { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-gdwarf-4" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -gdwarf-4" >&5 -printf %s "checking whether $CC supports -gdwarf-4... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -gdwarf-4" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -gdwarf-4" -fi } ;; - pdb) { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-gcodeview" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -gcodeview" >&5 -printf %s "checking whether $CC supports -gcodeview... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -gcodeview" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -gcodeview" -fi } ;; - esac - fi - eval "${wine_arch}_DEBUG=\$wine_crossdebug" - - test "x$enable_werror" != xyes || { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Werror" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 -printf %s "checking whether $CC supports -Werror... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Werror" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_EXTRACFLAGS " -Werror" -fi } - test "x$enable_build_id" != xyes || { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-Wl,--build-id" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,--build-id" >&5 -printf %s "checking whether $CC supports -Wl,--build-id... " >&6; } -if eval test \${$as_ac_var+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -ac_wine_try_cflags_saved_exeext=$ac_exeext -CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -Wl,--build-id" -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void *__os_arm64x_dispatch_ret = 0; -int __cdecl mainCRTStartup(void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - eval "$as_ac_var=yes" -else $as_nop - eval "$as_ac_var=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -ac_exeext=$ac_wine_try_cflags_saved_exeext -fi -eval ac_res=\$$as_ac_var - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_var"\" = x"yes" -then : - as_fn_append ${wine_arch}_CFLAGS " -Wl,--build-id" - as_fn_append ${wine_arch}_LDFLAGS " -Wl,--build-id" -fi } - - CC=$saved_CC - CFLAGS=$saved_CFLAGS - LDFLAGS=$saved_LDFLAGS -done - -if test $HOST_ARCH = aarch64 -then - test "x$PE_ARCHS" != x || as_fn_error $? "PE cross-compilation is required for ARM64, please install clang/llvm-dlltool/lld, or llvm-mingw." "$LINENO" 5 - DLLEXT="" -fi - - -if test "x$with_system_dllpath" != "x" -a -n "$PE_ARCHS" -then - if test "x$HOST_ARCH" = xi386 -then : - ac_prefix_list="i686-w64-mingw32-pkg-config i586-w64-mingw32-pkg-config i486-w64-mingw32-pkg-config i386-w64-mingw32-pkg-config " -else $as_nop - ac_prefix_list="$host_cpu-w64-mingw32-pkg-config" -fi -for ac_prog in $ac_prefix_list -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_MINGW_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$MINGW_PKG_CONFIG"; then - ac_cv_prog_MINGW_PKG_CONFIG="$MINGW_PKG_CONFIG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_MINGW_PKG_CONFIG="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MINGW_PKG_CONFIG=$ac_cv_prog_MINGW_PKG_CONFIG -if test -n "$MINGW_PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MINGW_PKG_CONFIG" >&5 -printf "%s\n" "$MINGW_PKG_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$MINGW_PKG_CONFIG" && break -done -test -n "$MINGW_PKG_CONFIG" || MINGW_PKG_CONFIG="false" - -if ${FAUDIO_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - FAUDIO_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags FAudio 2>/dev/null` -fi -fi -if ${FAUDIO_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - FAUDIO_PE_LIBS=`$MINGW_PKG_CONFIG --libs FAudio 2>/dev/null` -fi -fi -FAUDIO_PE_LIBS=${FAUDIO_PE_LIBS:-"-lFAudio"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $FAUDIO_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW FAudio.h" >&5 -printf %s "checking for MinGW FAudio.h... " >&6; } -if test ${ac_cv_mingw_header_FAudio_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_FAudio_h=yes -else $as_nop - ac_cv_mingw_header_FAudio_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_FAudio_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_FAudio_h" >&6; } -if test "x$ac_cv_mingw_header_FAudio_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FAudio_CommitOperationSet in MinGW -lFAudio" >&5 -printf %s "checking for FAudio_CommitOperationSet in MinGW -lFAudio... " >&6; } -if test ${ac_cv_mingw_lib_FAudio+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lFAudio $FAUDIO_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char FAudio_CommitOperationSet (); -int -main (void) -{ -return FAudio_CommitOperationSet (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_FAudio=yes -else $as_nop - ac_cv_mingw_lib_FAudio=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_FAudio" >&5 -printf "%s\n" "$ac_cv_mingw_lib_FAudio" >&6; } -if test "x$ac_cv_mingw_lib_FAudio" = xyes -then : - : -else $as_nop - FAUDIO_PE_CFLAGS=""; FAUDIO_PE_LIBS="" -fi -else $as_nop - FAUDIO_PE_CFLAGS=""; FAUDIO_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$FAUDIO_PE_LIBS" = "x" - then - as_fn_append wine_notices "|FAudio ${notice_platform}MinGW development files not found (or too old); using bundled version." - fi - - if ${FLUIDSYNTH_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - FLUIDSYNTH_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags fluidsynth 2>/dev/null` -fi -fi -if ${FLUIDSYNTH_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - FLUIDSYNTH_PE_LIBS=`$MINGW_PKG_CONFIG --libs fluidsynth 2>/dev/null` -fi -fi -FLUIDSYNTH_PE_LIBS=${FLUIDSYNTH_PE_LIBS:-"-lfluidsynth"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $FLUIDSYNTH_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW fluidsynth.h" >&5 -printf %s "checking for MinGW fluidsynth.h... " >&6; } -if test ${ac_cv_mingw_header_fluidsynth_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_fluidsynth_h=yes -else $as_nop - ac_cv_mingw_header_fluidsynth_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_fluidsynth_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_fluidsynth_h" >&6; } -if test "x$ac_cv_mingw_header_fluidsynth_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for new_fluid_synth in MinGW -lfluidsynth" >&5 -printf %s "checking for new_fluid_synth in MinGW -lfluidsynth... " >&6; } -if test ${ac_cv_mingw_lib_fluidsynth+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lfluidsynth $FLUIDSYNTH_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char new_fluid_synth (); -int -main (void) -{ -return new_fluid_synth (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_fluidsynth=yes -else $as_nop - ac_cv_mingw_lib_fluidsynth=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_fluidsynth" >&5 -printf "%s\n" "$ac_cv_mingw_lib_fluidsynth" >&6; } -if test "x$ac_cv_mingw_lib_fluidsynth" = xyes -then : - : -else $as_nop - FLUIDSYNTH_PE_CFLAGS=""; FLUIDSYNTH_PE_LIBS="" -fi -else $as_nop - FLUIDSYNTH_PE_CFLAGS=""; FLUIDSYNTH_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$FLUIDSYNTH_PE_LIBS" = "x" - then - as_fn_append wine_notices "|Fluidsynth ${notice_platform}MinGW development files not found (or too old); using bundled version." - fi - - if ${JPEG_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - JPEG_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libjpeg 2>/dev/null` -fi -fi -if ${JPEG_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - JPEG_PE_LIBS=`$MINGW_PKG_CONFIG --libs libjpeg 2>/dev/null` -fi -fi - -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $JPEG_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW jpeglib.h" >&5 -printf %s "checking for MinGW jpeglib.h... " >&6; } -if test ${ac_cv_mingw_header_jpeglib_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_jpeglib_h=yes -else $as_nop - ac_cv_mingw_header_jpeglib_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_jpeglib_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_jpeglib_h" >&6; } -if test "x$ac_cv_mingw_header_jpeglib_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_decompress in MinGW -ljpeg" >&5 -printf %s "checking for jpeg_start_decompress in MinGW -ljpeg... " >&6; } -if test ${ac_cv_mingw_lib_jpeg+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-ljpeg $JPEG_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char jpeg_start_decompress (); -int -main (void) -{ -return jpeg_start_decompress (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_jpeg=yes -else $as_nop - ac_cv_mingw_lib_jpeg=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_jpeg" >&5 -printf "%s\n" "$ac_cv_mingw_lib_jpeg" >&6; } -if test "x$ac_cv_mingw_lib_jpeg" = xyes -then : - : -else $as_nop - JPEG_PE_CFLAGS=""; JPEG_PE_LIBS="" -fi -else $as_nop - JPEG_PE_CFLAGS=""; JPEG_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$JPEG_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libjpeg ${notice_platform}MinGW development files not found; using bundled version." - fi - - if ${LCMS2_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - LCMS2_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags lcms2 2>/dev/null` -fi -fi -if ${LCMS2_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - LCMS2_PE_LIBS=`$MINGW_PKG_CONFIG --libs lcms2 2>/dev/null` -fi -fi -LCMS2_PE_LIBS=${LCMS2_PE_LIBS:-"-llcms2"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $LCMS2_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW lcms2.h" >&5 -printf %s "checking for MinGW lcms2.h... " >&6; } -if test ${ac_cv_mingw_header_lcms2_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_lcms2_h=yes -else $as_nop - ac_cv_mingw_header_lcms2_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_lcms2_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_lcms2_h" >&6; } -if test "x$ac_cv_mingw_header_lcms2_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cmsOpenProfileFromFile in MinGW -llcms2" >&5 -printf %s "checking for cmsOpenProfileFromFile in MinGW -llcms2... " >&6; } -if test ${ac_cv_mingw_lib_lcms2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-llcms2 $LCMS2_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char cmsOpenProfileFromFile (); -int -main (void) -{ -return cmsOpenProfileFromFile (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_lcms2=yes -else $as_nop - ac_cv_mingw_lib_lcms2=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_lcms2" >&5 -printf "%s\n" "$ac_cv_mingw_lib_lcms2" >&6; } -if test "x$ac_cv_mingw_lib_lcms2" = xyes -then : - : -else $as_nop - LCMS2_PE_CFLAGS=""; LCMS2_PE_LIBS="" -fi -else $as_nop - LCMS2_PE_CFLAGS=""; LCMS2_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$LCMS2_PE_LIBS" = "x" - then - as_fn_append wine_notices "|liblcms2 ${notice_platform}MinGW development files not found; using bundled version." - fi - - if ${MPG123_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - MPG123_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libmpg123 2>/dev/null` -fi -fi -if ${MPG123_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - MPG123_PE_LIBS=`$MINGW_PKG_CONFIG --libs libmpg123 2>/dev/null` -fi -fi -MPG123_PE_LIBS=${MPG123_PE_LIBS:-"-lmpg123"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $MPG123_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW mpg123.h" >&5 -printf %s "checking for MinGW mpg123.h... " >&6; } -if test ${ac_cv_mingw_header_mpg123_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_mpg123_h=yes -else $as_nop - ac_cv_mingw_header_mpg123_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_mpg123_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_mpg123_h" >&6; } -if test "x$ac_cv_mingw_header_mpg123_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpg123_feed in MinGW -lmpg123" >&5 -printf %s "checking for mpg123_feed in MinGW -lmpg123... " >&6; } -if test ${ac_cv_mingw_lib_mpg123+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lmpg123 $MPG123_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char mpg123_feed (); -int -main (void) -{ -return mpg123_feed (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_mpg123=yes -else $as_nop - ac_cv_mingw_lib_mpg123=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_mpg123" >&5 -printf "%s\n" "$ac_cv_mingw_lib_mpg123" >&6; } -if test "x$ac_cv_mingw_lib_mpg123" = xyes -then : - : -else $as_nop - MPG123_PE_CFLAGS=""; MPG123_PE_LIBS="" -fi -else $as_nop - MPG123_PE_CFLAGS=""; MPG123_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$MPG123_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libmpg123 ${notice_platform}MinGW development files not found (or too old); using bundled version." - fi - - if ${PNG_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - PNG_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libpng 2>/dev/null` -fi -fi -if ${PNG_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - PNG_PE_LIBS=`$MINGW_PKG_CONFIG --libs libpng 2>/dev/null` -fi -fi - -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $PNG_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW png.h" >&5 -printf %s "checking for MinGW png.h... " >&6; } -if test ${ac_cv_mingw_header_png_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_png_h=yes -else $as_nop - ac_cv_mingw_header_png_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_png_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_png_h" >&6; } -if test "x$ac_cv_mingw_header_png_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in MinGW -lpng" >&5 -printf %s "checking for png_create_read_struct in MinGW -lpng... " >&6; } -if test ${ac_cv_mingw_lib_png+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lpng $PNG_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char png_create_read_struct (); -int -main (void) -{ -return png_create_read_struct (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_png=yes -else $as_nop - ac_cv_mingw_lib_png=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_png" >&5 -printf "%s\n" "$ac_cv_mingw_lib_png" >&6; } -if test "x$ac_cv_mingw_lib_png" = xyes -then : - : -else $as_nop - PNG_PE_CFLAGS=""; PNG_PE_LIBS="" -fi -else $as_nop - PNG_PE_CFLAGS=""; PNG_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$PNG_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libpng ${notice_platform}MinGW development files not found; using bundled version." - fi - - if ${TIFF_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - TIFF_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libtiff-4 2>/dev/null` -fi -fi -if ${TIFF_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - TIFF_PE_LIBS=`$MINGW_PKG_CONFIG --libs libtiff-4 2>/dev/null` -fi -fi - -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $TIFF_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW tiffio.h" >&5 -printf %s "checking for MinGW tiffio.h... " >&6; } -if test ${ac_cv_mingw_header_tiffio_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_tiffio_h=yes -else $as_nop - ac_cv_mingw_header_tiffio_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_tiffio_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_tiffio_h" >&6; } -if test "x$ac_cv_mingw_header_tiffio_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TIFFClientOpen in MinGW -ltiff" >&5 -printf %s "checking for TIFFClientOpen in MinGW -ltiff... " >&6; } -if test ${ac_cv_mingw_lib_tiff+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-ltiff $TIFF_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char TIFFClientOpen (); -int -main (void) -{ -return TIFFClientOpen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_tiff=yes -else $as_nop - ac_cv_mingw_lib_tiff=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_tiff" >&5 -printf "%s\n" "$ac_cv_mingw_lib_tiff" >&6; } -if test "x$ac_cv_mingw_lib_tiff" = xyes -then : - : -else $as_nop - TIFF_PE_CFLAGS=""; TIFF_PE_LIBS="" -fi -else $as_nop - TIFF_PE_CFLAGS=""; TIFF_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$TIFF_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libtiff ${notice_platform}MinGW development files not found; using bundled version." - fi - - if ${XML2_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - XML2_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libxml-2.0 2>/dev/null` -fi -fi -if ${XML2_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - XML2_PE_LIBS=`$MINGW_PKG_CONFIG --libs libxml-2.0 2>/dev/null` -fi -fi -XML2_PE_LIBS=${XML2_PE_LIBS:-"-lxml2"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $XML2_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW libxml/parser.h" >&5 -printf %s "checking for MinGW libxml/parser.h... " >&6; } -if test ${ac_cv_mingw_header_libxml_parser_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_libxml_parser_h=yes -else $as_nop - ac_cv_mingw_header_libxml_parser_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_libxml_parser_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_libxml_parser_h" >&6; } -if test "x$ac_cv_mingw_header_libxml_parser_h" = xyes -then : - -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW libxml/xmlsave.h" >&5 -printf %s "checking for MinGW libxml/xmlsave.h... " >&6; } -if test ${ac_cv_mingw_header_libxml_xmlsave_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_libxml_xmlsave_h=yes -else $as_nop - ac_cv_mingw_header_libxml_xmlsave_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_libxml_xmlsave_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_libxml_xmlsave_h" >&6; } -if test "x$ac_cv_mingw_header_libxml_xmlsave_h" = xyes -then : - -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW libxml/SAX2.h" >&5 -printf %s "checking for MinGW libxml/SAX2.h... " >&6; } -if test ${ac_cv_mingw_header_libxml_SAX2_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_libxml_SAX2_h=yes -else $as_nop - ac_cv_mingw_header_libxml_SAX2_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_libxml_SAX2_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_libxml_SAX2_h" >&6; } -if test "x$ac_cv_mingw_header_libxml_SAX2_h" = xyes -then : - -fi - if test "$ac_cv_mingw_header_libxml_parser_h" = "yes" -a "$ac_cv_mingw_header_libxml_xmlsave_h" = "yes" -a "$ac_cv_mingw_header_libxml_SAX2_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xmlFirstElementChild in MinGW -lxml2" >&5 -printf %s "checking for xmlFirstElementChild in MinGW -lxml2... " >&6; } -if test ${ac_cv_mingw_lib_xml2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lxml2 $XML2_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char xmlFirstElementChild (); -int -main (void) -{ -return xmlFirstElementChild (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_xml2=yes -else $as_nop - ac_cv_mingw_lib_xml2=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_xml2" >&5 -printf "%s\n" "$ac_cv_mingw_lib_xml2" >&6; } -if test "x$ac_cv_mingw_lib_xml2" = xyes -then : - : -else $as_nop - XML2_PE_CFLAGS=""; XML2_PE_LIBS="" -fi - else - XML2_PE_CFLAGS="" - XML2_PE_LIBS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$XML2_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libxml2 ${notice_platform}MinGW development files not found (or too old); using bundled version." - fi - - if ${XSLT_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - XSLT_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libxslt 2>/dev/null` -fi -fi -if ${XSLT_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - XSLT_PE_LIBS=`$MINGW_PKG_CONFIG --libs libxslt 2>/dev/null` -fi -fi -XSLT_PE_LIBS=${XSLT_PE_LIBS:-"-lxslt"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $XSLT_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW libxslt/pattern.h" >&5 -printf %s "checking for MinGW libxslt/pattern.h... " >&6; } -if test ${ac_cv_mingw_header_libxslt_pattern_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_libxslt_pattern_h=yes -else $as_nop - ac_cv_mingw_header_libxslt_pattern_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_libxslt_pattern_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_libxslt_pattern_h" >&6; } -if test "x$ac_cv_mingw_header_libxslt_pattern_h" = xyes -then : - -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW libxslt/transform.h" >&5 -printf %s "checking for MinGW libxslt/transform.h... " >&6; } -if test ${ac_cv_mingw_header_libxslt_transform_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_libxslt_transform_h=yes -else $as_nop - ac_cv_mingw_header_libxslt_transform_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_libxslt_transform_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_libxslt_transform_h" >&6; } -if test "x$ac_cv_mingw_header_libxslt_transform_h" = xyes -then : - -fi - if test "$ac_cv_mingw_header_libxslt_pattern_h" = "yes" -a "$ac_cv_mingw_header_libxslt_transform_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xsltCompilePattern in MinGW -lxslt" >&5 -printf %s "checking for xsltCompilePattern in MinGW -lxslt... " >&6; } -if test ${ac_cv_mingw_lib_xslt+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lxslt $XSLT_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char xsltCompilePattern (); -int -main (void) -{ -return xsltCompilePattern (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_xslt=yes -else $as_nop - ac_cv_mingw_lib_xslt=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_xslt" >&5 -printf "%s\n" "$ac_cv_mingw_lib_xslt" >&6; } -if test "x$ac_cv_mingw_lib_xslt" = xyes -then : - : -else $as_nop - XSLT_PE_CFLAGS=""; XSLT_PE_LIBS="" -fi - else - XSLT_PE_CFLAGS="" - XSLT_PE_LIBS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$XSLT_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libxslt ${notice_platform}MinGW development files not found; using bundled version." - fi - - if ${VKD3D_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - VKD3D_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags libvkd3d libvkd3d-shader 2>/dev/null` -fi -fi -if ${VKD3D_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - VKD3D_PE_LIBS=`$MINGW_PKG_CONFIG --libs libvkd3d libvkd3d-shader 2>/dev/null` -fi -fi -VKD3D_PE_LIBS=${VKD3D_PE_LIBS:-"-lvkd3d -lvkd3d-shader"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $VKD3D_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW vkd3d.h" >&5 -printf %s "checking for MinGW vkd3d.h... " >&6; } -if test ${ac_cv_mingw_header_vkd3d_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_vkd3d_h=yes -else $as_nop - ac_cv_mingw_header_vkd3d_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_vkd3d_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_vkd3d_h" >&6; } -if test "x$ac_cv_mingw_header_vkd3d_h" = xyes -then : - -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW vkd3d_shader.h" >&5 -printf %s "checking for MinGW vkd3d_shader.h... " >&6; } -if test ${ac_cv_mingw_header_vkd3d_shader_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_vkd3d_shader_h=yes -else $as_nop - ac_cv_mingw_header_vkd3d_shader_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_vkd3d_shader_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_vkd3d_shader_h" >&6; } -if test "x$ac_cv_mingw_header_vkd3d_shader_h" = xyes -then : - -fi - if test "$ac_cv_mingw_header_vkd3d_h" = "yes" -a "$ac_cv_mingw_header_vkd3d_shader_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for vkd3d_set_log_callback in MinGW -lvkd3d" >&5 -printf %s "checking for vkd3d_set_log_callback in MinGW -lvkd3d... " >&6; } -if test ${ac_cv_mingw_lib_vkd3d+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lvkd3d $VKD3D_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char vkd3d_set_log_callback (); -int -main (void) -{ -return vkd3d_set_log_callback (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_vkd3d=yes -else $as_nop - ac_cv_mingw_lib_vkd3d=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_vkd3d" >&5 -printf "%s\n" "$ac_cv_mingw_lib_vkd3d" >&6; } -if test "x$ac_cv_mingw_lib_vkd3d" = xyes -then : - : -else $as_nop - : -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for vkd3d_shader_serialize_dxbc in MinGW -lvkd3d-shader" >&5 -printf %s "checking for vkd3d_shader_serialize_dxbc in MinGW -lvkd3d-shader... " >&6; } -if test ${ac_cv_mingw_lib_vkd3d_shader+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lvkd3d-shader $VKD3D_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char vkd3d_shader_serialize_dxbc (); -int -main (void) -{ -return vkd3d_shader_serialize_dxbc (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_vkd3d_shader=yes -else $as_nop - ac_cv_mingw_lib_vkd3d_shader=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_vkd3d_shader" >&5 -printf "%s\n" "$ac_cv_mingw_lib_vkd3d_shader" >&6; } -if test "x$ac_cv_mingw_lib_vkd3d_shader" = xyes -then : - : -else $as_nop - : -fi - if test "$ac_cv_mingw_lib_vkd3d" = "no" -o "$ac_cv_mingw_lib_vkd3d_shader" = "no" - then - VKD3D_PE_CFLAGS="" - VKD3D_PE_LIBS="" - fi - else - VKD3D_PE_CFLAGS="" - VKD3D_PE_LIBS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$VKD3D_PE_LIBS" = "x" - then - as_fn_append wine_notices "|libvkd3d ${notice_platform}MinGW development files not found (or too old); using bundled version." - fi - - if ${ZLIB_PE_CFLAGS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - ZLIB_PE_CFLAGS=`$MINGW_PKG_CONFIG --cflags zlib 2>/dev/null` -fi -fi -if ${ZLIB_PE_LIBS:+false} : -then : - if test ${MINGW_PKG_CONFIG+y} -then : - ZLIB_PE_LIBS=`$MINGW_PKG_CONFIG --libs zlib 2>/dev/null` -fi -fi -ZLIB_PE_LIBS=${ZLIB_PE_LIBS:-"-lz"} -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $ZLIB_PE_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MinGW zlib.h" >&5 -printf %s "checking for MinGW zlib.h... " >&6; } -if test ${ac_cv_mingw_header_zlib_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mingw_header_zlib_h=yes -else $as_nop - ac_cv_mingw_header_zlib_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_header_zlib_h" >&5 -printf "%s\n" "$ac_cv_mingw_header_zlib_h" >&6; } -if test "x$ac_cv_mingw_header_zlib_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inflate in MinGW -lz" >&5 -printf %s "checking for inflate in MinGW -lz... " >&6; } -if test ${ac_cv_mingw_lib_z+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_check_headers_saved_cc=$CC -ac_wine_check_headers_saved_exeext=$ac_exeext -ac_wine_check_headers_saved_libs=$LIBS -eval CC=\$${wine_arch}_CC -ac_exeext=".exe" -LIBS="-lz $ZLIB_PE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char inflate (); -int -main (void) -{ -return inflate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_mingw_lib_z=yes -else $as_nop - ac_cv_mingw_lib_z=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CC=$ac_wine_check_headers_saved_cc -ac_exeext=$ac_wine_check_headers_saved_exeext -LIBS=$ac_wine_check_headers_saved_libs -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mingw_lib_z" >&5 -printf "%s\n" "$ac_cv_mingw_lib_z" >&6; } -if test "x$ac_cv_mingw_lib_z" = xyes -then : - : -else $as_nop - ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS="" -fi -else $as_nop - ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS="" -fi -CPPFLAGS=$ac_save_CPPFLAGS - - if test "x$ZLIB_PE_LIBS" = "x" - then - as_fn_append wine_notices "|zlib ${notice_platform}MinGW development files not found; using bundled version." - fi -fi - -if ${FAUDIO_PE_LIBS:+false} : -then : - FAUDIO_PE_LIBS="faudio mfplat mfreadwrite mfuuid propsys" - if ${FAUDIO_PE_CFLAGS:+false} : -then : - FAUDIO_PE_CFLAGS="-I\$(top_srcdir)/libs/faudio/include" -else $as_nop - enable_faudio=no -fi -else $as_nop - enable_faudio=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: faudio cflags: $FAUDIO_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: faudio libs: $FAUDIO_PE_LIBS" >&5 - -if ${FLUIDSYNTH_PE_LIBS:+false} : -then : - FLUIDSYNTH_PE_LIBS="fluidsynth" - if ${FLUIDSYNTH_PE_CFLAGS:+false} : -then : - FLUIDSYNTH_PE_CFLAGS="-I\$(top_srcdir)/libs/fluidsynth/include" -else $as_nop - enable_fluidsynth=no -fi -else $as_nop - enable_fluidsynth=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: fluidsynth cflags: $FLUIDSYNTH_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: fluidsynth libs: $FLUIDSYNTH_PE_LIBS" >&5 - -if ${GSM_PE_LIBS:+false} : -then : - GSM_PE_LIBS=gsm - if ${GSM_PE_CFLAGS:+false} : -then : - GSM_PE_CFLAGS="-I\$(top_srcdir)/libs/gsm/inc" -else $as_nop - enable_gsm=no -fi -else $as_nop - enable_gsm=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: gsm cflags: $GSM_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: gsm libs: $GSM_PE_LIBS" >&5 - -if ${JPEG_PE_LIBS:+false} : -then : - JPEG_PE_LIBS=jpeg - if ${JPEG_PE_CFLAGS:+false} : -then : - JPEG_PE_CFLAGS="-I\$(top_srcdir)/libs/jpeg" -else $as_nop - enable_jpeg=no -fi -else $as_nop - enable_jpeg=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: jpeg cflags: $JPEG_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: jpeg libs: $JPEG_PE_LIBS" >&5 - -if ${JXR_PE_LIBS:+false} : -then : - JXR_PE_LIBS=jxr - if ${JXR_PE_CFLAGS:+false} : -then : - JXR_PE_CFLAGS="-I\$(top_srcdir)/libs/jxr/jxrgluelib -I\$(top_srcdir)/libs/jxr/image/sys" -else $as_nop - enable_jxr=no -fi -else $as_nop - enable_jxr=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: jxr cflags: $JXR_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: jxr libs: $JXR_PE_LIBS" >&5 - -if ${LCMS2_PE_LIBS:+false} : -then : - LCMS2_PE_LIBS=lcms2 - if ${LCMS2_PE_CFLAGS:+false} : -then : - LCMS2_PE_CFLAGS="-I\$(top_srcdir)/libs/lcms2/include" -else $as_nop - enable_lcms2=no -fi -else $as_nop - enable_lcms2=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: lcms2 cflags: $LCMS2_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: lcms2 libs: $LCMS2_PE_LIBS" >&5 - -if ${LDAP_PE_LIBS:+false} : -then : - LDAP_PE_LIBS=ldap - if ${LDAP_PE_CFLAGS:+false} : -then : - LDAP_PE_CFLAGS="-I\$(top_srcdir)/libs/ldap/include" -else $as_nop - enable_ldap=no -fi -else $as_nop - enable_ldap=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: ldap cflags: $LDAP_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: ldap libs: $LDAP_PE_LIBS" >&5 - -if ${MPG123_PE_LIBS:+false} : -then : - MPG123_PE_LIBS=mpg123 - if ${MPG123_PE_CFLAGS:+false} : -then : - MPG123_PE_CFLAGS="-I\$(top_srcdir)/libs/mpg123/src/libmpg123" -else $as_nop - enable_mpg123=no -fi -else $as_nop - enable_mpg123=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: mpg123 cflags: $MPG123_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: mpg123 libs: $MPG123_PE_LIBS" >&5 - -if ${MUSL_PE_LIBS:+false} : -then : - MUSL_PE_LIBS=musl - if ${MUSL_PE_CFLAGS:+false} : -then : - MUSL_PE_CFLAGS= -else $as_nop - enable_musl=no -fi -else $as_nop - enable_musl=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: musl cflags: $MUSL_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: musl libs: $MUSL_PE_LIBS" >&5 - -if ${PNG_PE_LIBS:+false} : -then : - PNG_PE_LIBS="png \$(ZLIB_PE_LIBS)" - if ${PNG_PE_CFLAGS:+false} : -then : - PNG_PE_CFLAGS="-I\$(top_srcdir)/libs/png" -else $as_nop - enable_png=no -fi -else $as_nop - enable_png=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: png cflags: $PNG_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: png libs: $PNG_PE_LIBS" >&5 - -if ${TIFF_PE_LIBS:+false} : -then : - TIFF_PE_LIBS="tiff \$(ZLIB_PE_LIBS)" - if ${TIFF_PE_CFLAGS:+false} : -then : - TIFF_PE_CFLAGS="-I\$(top_srcdir)/libs/tiff/libtiff" -else $as_nop - enable_tiff=no -fi -else $as_nop - enable_tiff=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: tiff cflags: $TIFF_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: tiff libs: $TIFF_PE_LIBS" >&5 - -if ${VKD3D_PE_LIBS:+false} : -then : - VKD3D_PE_LIBS=vkd3d - if ${VKD3D_PE_CFLAGS:+false} : -then : - VKD3D_PE_CFLAGS="-I\$(top_srcdir)/libs/vkd3d/include" -else $as_nop - enable_vkd3d=no -fi -else $as_nop - enable_vkd3d=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: vkd3d cflags: $VKD3D_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: vkd3d libs: $VKD3D_PE_LIBS" >&5 - -if ${XML2_PE_LIBS:+false} : -then : - XML2_PE_LIBS=xml2 - if ${XML2_PE_CFLAGS:+false} : -then : - XML2_PE_CFLAGS="-I\$(top_srcdir)/libs/xml2/include -DLIBXML_STATIC" -else $as_nop - enable_xml2=no -fi -else $as_nop - enable_xml2=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xml2 cflags: $XML2_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xml2 libs: $XML2_PE_LIBS" >&5 - -if ${XSLT_PE_LIBS:+false} : -then : - XSLT_PE_LIBS=xslt - if ${XSLT_PE_CFLAGS:+false} : -then : - XSLT_PE_CFLAGS="-I\$(top_srcdir)/libs/xslt/libxslt -I\$(top_srcdir)/libs/xslt -DLIBXSLT_STATIC" -else $as_nop - enable_xslt=no -fi -else $as_nop - enable_xslt=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xslt cflags: $XSLT_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xslt libs: $XSLT_PE_LIBS" >&5 - -if ${ZLIB_PE_LIBS:+false} : -then : - ZLIB_PE_LIBS=z - if ${ZLIB_PE_CFLAGS:+false} : -then : - ZLIB_PE_CFLAGS="-I\$(top_srcdir)/libs/zlib -DFAR= -DZ_SOLO" -else $as_nop - enable_zlib=no -fi -else $as_nop - enable_zlib=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: zlib cflags: $ZLIB_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: zlib libs: $ZLIB_PE_LIBS" >&5 - -if ${ZYDIS_PE_LIBS:+false} : -then : - ZYDIS_PE_LIBS=zydis - if ${ZYDIS_PE_CFLAGS:+false} : -then : - ZYDIS_PE_CFLAGS="-I\$(top_srcdir)/libs/zydis/include" -else $as_nop - enable_zydis=no -fi -else $as_nop - enable_zydis=no -fi -printf "%s\n" "$as_me:${as_lineno-$LINENO}: zydis cflags: $ZYDIS_PE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: zydis libs: $ZYDIS_PE_LIBS" >&5 - - - -if test "x$with_pthread" = xno -then : - -else $as_nop - ac_fn_c_check_func "$LINENO" "pthread_create" "ac_cv_func_pthread_create" -if test "x$ac_cv_func_pthread_create" = xyes -then : - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -printf %s "checking for pthread_create in -lpthread... " >&6; } -if test ${ac_cv_lib_pthread_pthread_create+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char pthread_create (); -int -main (void) -{ -return pthread_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_pthread_pthread_create=yes -else $as_nop - ac_cv_lib_pthread_pthread_create=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes -then : - PTHREAD_LIBS="-lpthread" - -fi - -fi - -fi -if test "x$ac_cv_func_pthread_create" != xyes -a "x$PTHREAD_LIBS" = x -then : - case "x$with_pthread" in - xno) ;; - *) as_fn_error $? "pthread ${notice_platform}development files not found. -Wine cannot support threads without libpthread. -Use the --without-pthread option if you really want this." "$LINENO" 5 ;; -esac - -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test ${ac_cv_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -printf %s "checking for X... " >&6; } - - -# Check whether --with-x was given. -if test ${with_x+y} -then : - withval=$with_x; -fi - -# $have_x is `yes', `no', `disabled', or empty when we do not yet know. -if test "x$with_x" = xno; then - # The user explicitly disabled X. - have_x=disabled -else - case $x_includes,$x_libraries in #( - *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( - *,NONE | NONE,*) if test ${ac_cv_have_x+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # One or both of the vars are not set, and there is no cached value. -ac_x_includes=no -ac_x_libraries=no -# Do we need to do anything special at all? -ac_save_LIBS=$LIBS -LIBS="-lX11 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -XrmInitialize () - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - # We can compile and link X programs with no special options. - ac_x_includes= - ac_x_libraries= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS="$ac_save_LIBS" -# If that didn't work, only try xmkmf and file system searches -# for native compilation. -if test x"$ac_x_includes" = xno && test "$cross_compiling" = no -then : - rm -f -r conftest.dir -if mkdir conftest.dir; then - cd conftest.dir - cat >Imakefile <<'_ACEOF' -incroot: - @echo incroot='${INCROOT}' -usrlibdir: - @echo usrlibdir='${USRLIBDIR}' -libdir: - @echo libdir='${LIBDIR}' -_ACEOF - if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. - for ac_var in incroot usrlibdir libdir; do - eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" - done - # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl dylib la dll; do - if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && - test -f "$ac_im_libdir/libX11.$ac_extension"; then - ac_im_usrlibdir=$ac_im_libdir; break - fi - done - # Screen out bogus values from the imake configuration. They are - # bogus both because they are the default anyway, and because - # using them would break gcc on systems where it needs fixed includes. - case $ac_im_incroot in - /usr/include) ac_x_includes= ;; - *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; - esac - case $ac_im_usrlibdir in - /usr/lib | /usr/lib64 | /lib | /lib64) ;; - *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; - esac - fi - cd .. - rm -f -r conftest.dir -fi - - # Standard set of common directories for X headers. -# Check X11 before X11Rn because it is often a symlink to the current release. -ac_x_header_dirs=' -/usr/X11/include -/usr/X11R7/include -/usr/X11R6/include -/usr/X11R5/include -/usr/X11R4/include - -/usr/include/X11 -/usr/include/X11R7 -/usr/include/X11R6 -/usr/include/X11R5 -/usr/include/X11R4 - -/usr/local/X11/include -/usr/local/X11R7/include -/usr/local/X11R6/include -/usr/local/X11R5/include -/usr/local/X11R4/include - -/usr/local/include/X11 -/usr/local/include/X11R7 -/usr/local/include/X11R6 -/usr/local/include/X11R5 -/usr/local/include/X11R4 - -/opt/X11/include - -/usr/X386/include -/usr/x386/include -/usr/XFree86/include/X11 - -/usr/include -/usr/local/include -/usr/unsupported/include -/usr/athena/include -/usr/local/x11r5/include -/usr/lpp/Xamples/include - -/usr/openwin/include -/usr/openwin/share/include' - -if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. - # First, try using that file with no special directory specified. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # We can compile using X headers with no special include directory. -ac_x_includes= -else $as_nop - for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Xlib.h"; then - ac_x_includes=$ac_dir - break - fi -done -fi -rm -f conftest.err conftest.i conftest.$ac_ext -fi # $ac_x_includes = no - -if test "$ac_x_libraries" = no; then - # Check for the libraries. - # See if we find them without any special options. - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS - LIBS="-lX11 $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -XrmInitialize () - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - LIBS=$ac_save_LIBS -# We can link X programs with no special library path. -ac_x_libraries= -else $as_nop - LIBS=$ac_save_LIBS -for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` -do - # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl dylib la dll; do - if test -r "$ac_dir/libX11.$ac_extension"; then - ac_x_libraries=$ac_dir - break 2 - fi - done -done -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi # $ac_x_libraries = no - -fi -# Record the results. -case $ac_x_includes,$ac_x_libraries in #( - no,* | *,no | *\'*) : - # Didn't find X, or a directory has "'" in its name. - ac_cv_have_x="have_x=no" ;; #( - *) : - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes\ - ac_x_includes='$ac_x_includes'\ - ac_x_libraries='$ac_x_libraries'" ;; -esac -fi -;; #( - *) have_x=yes;; - esac - eval "$ac_cv_have_x" -fi # $with_x != no - -if test "$have_x" != yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 -printf "%s\n" "$have_x" >&6; } - no_x=yes -else - # If each of the values was on the command line, it overrides each guess. - test "x$x_includes" = xNONE && x_includes=$ac_x_includes - test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries - # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes\ - ac_x_includes='$x_includes'\ - ac_x_libraries='$x_libraries'" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 -printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; } -fi - -if test "$no_x" = yes; then - # Not all programs may use this symbol, but it does not hurt to define it. - -printf "%s\n" "#define X_DISPLAY_MISSING 1" >>confdefs.h - - X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= -else - if test -n "$x_includes"; then - X_CFLAGS="$X_CFLAGS -I$x_includes" - fi - - # It would also be nice to do this for all -L options, not just this one. - if test -n "$x_libraries"; then - X_LIBS="$X_LIBS -L$x_libraries" - # For Solaris; some versions of Sun CC require a space after -R and - # others require no space. Words are not sufficient . . . . - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 -printf %s "checking whether -R must be followed by a space... " >&6; } - ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" - ac_xsave_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - X_LIBS="$X_LIBS -R$x_libraries" -else $as_nop - LIBS="$ac_xsave_LIBS -R $x_libraries" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - X_LIBS="$X_LIBS -R $x_libraries" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 -printf "%s\n" "neither works" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ac_c_werror_flag=$ac_xsave_c_werror_flag - LIBS=$ac_xsave_LIBS - fi - - # Check for system-dependent libraries X programs must link with. - # Do this before checking for the system-independent R6 libraries - # (-lICE), since we may need -lsocket or whatever for X linking. - - if test "$ISC" = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" - else - # Martyn Johnson says this is needed for Ultrix, if the X - # libraries were built with DECnet support. And Karl Berry says - # the Alpha needs dnet_stub (dnet does not exist). - ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XOpenDisplay (); -int -main (void) -{ -return XOpenDisplay (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 -printf %s "checking for dnet_ntoa in -ldnet... " >&6; } -if test ${ac_cv_lib_dnet_dnet_ntoa+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldnet $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dnet_ntoa (); -int -main (void) -{ -return dnet_ntoa (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_dnet_dnet_ntoa=yes -else $as_nop - ac_cv_lib_dnet_dnet_ntoa=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -printf "%s\n" "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes -then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" -fi - - if test $ac_cv_lib_dnet_dnet_ntoa = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 -printf %s "checking for dnet_ntoa in -ldnet_stub... " >&6; } -if test ${ac_cv_lib_dnet_stub_dnet_ntoa+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldnet_stub $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dnet_ntoa (); -int -main (void) -{ -return dnet_ntoa (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_dnet_stub_dnet_ntoa=yes -else $as_nop - ac_cv_lib_dnet_stub_dnet_ntoa=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -printf "%s\n" "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes -then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" -fi - - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_xsave_LIBS" - - # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, - # to get the SysV transport functions. - # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) - # needs -lnsl. - # The nsl library prevents programs from opening the X display - # on Irix 5.2, according to T.E. Dickey. - # The functions gethostbyname, getservbyname, and inet_addr are - # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. - ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes -then : - -fi - - if test $ac_cv_func_gethostbyname = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -printf %s "checking for gethostbyname in -lnsl... " >&6; } -if test ${ac_cv_lib_nsl_gethostbyname+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -int -main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_nsl_gethostbyname=yes -else $as_nop - ac_cv_lib_nsl_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -printf "%s\n" "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes -then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" -fi - - if test $ac_cv_lib_nsl_gethostbyname = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 -printf %s "checking for gethostbyname in -lbsd... " >&6; } -if test ${ac_cv_lib_bsd_gethostbyname+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lbsd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -int -main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_bsd_gethostbyname=yes -else $as_nop - ac_cv_lib_bsd_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 -printf "%s\n" "$ac_cv_lib_bsd_gethostbyname" >&6; } -if test "x$ac_cv_lib_bsd_gethostbyname" = xyes -then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" -fi - - fi - fi - - # lieder@skyler.mavd.honeywell.com says without -lsocket, - # socket/setsockopt and other routines are undefined under SCO ODT - # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary - # on later versions), says Simon Leinen: it contains gethostby* - # variants that don't use the name server (or something). -lsocket - # must be given before -lnsl if both are needed. We assume that - # if connect needs -lnsl, so does gethostbyname. - ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = xyes -then : - -fi - - if test $ac_cv_func_connect = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 -printf %s "checking for connect in -lsocket... " >&6; } -if test ${ac_cv_lib_socket_connect+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char connect (); -int -main (void) -{ -return connect (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_socket_connect=yes -else $as_nop - ac_cv_lib_socket_connect=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 -printf "%s\n" "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = xyes -then : - X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" -fi - - fi - - # Guillermo Gomez says -lposix is necessary on A/UX. - ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" -if test "x$ac_cv_func_remove" = xyes -then : - -fi - - if test $ac_cv_func_remove = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 -printf %s "checking for remove in -lposix... " >&6; } -if test ${ac_cv_lib_posix_remove+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char remove (); -int -main (void) -{ -return remove (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_posix_remove=yes -else $as_nop - ac_cv_lib_posix_remove=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 -printf "%s\n" "$ac_cv_lib_posix_remove" >&6; } -if test "x$ac_cv_lib_posix_remove" = xyes -then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" -fi - - fi - - # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. - ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" -if test "x$ac_cv_func_shmat" = xyes -then : - -fi - - if test $ac_cv_func_shmat = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 -printf %s "checking for shmat in -lipc... " >&6; } -if test ${ac_cv_lib_ipc_shmat+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lipc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char shmat (); -int -main (void) -{ -return shmat (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ipc_shmat=yes -else $as_nop - ac_cv_lib_ipc_shmat=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 -printf "%s\n" "$ac_cv_lib_ipc_shmat" >&6; } -if test "x$ac_cv_lib_ipc_shmat" = xyes -then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" -fi - - fi - fi - - # Check for libraries that X11R6 Xt/Xaw programs need. - ac_save_LDFLAGS=$LDFLAGS - test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" - # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to - # check for ICE first), but we must link in the order -lSM -lICE or - # we get undefined symbols. So assume we have SM if we have ICE. - # These have to be linked with before -lX11, unlike the other - # libraries we check for below, so use a different variable. - # John Interrante, Karl Berry - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 -printf %s "checking for IceConnectionNumber in -lICE... " >&6; } -if test ${ac_cv_lib_ICE_IceConnectionNumber+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lICE $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char IceConnectionNumber (); -int -main (void) -{ -return IceConnectionNumber (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ICE_IceConnectionNumber=yes -else $as_nop - ac_cv_lib_ICE_IceConnectionNumber=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -printf "%s\n" "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } -if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes -then : - X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" -fi - - LDFLAGS=$ac_save_LDFLAGS - -fi - - -if test "$have_x" = "yes" -then - ac_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lX11" >&5 -printf %s "checking for -lX11... " >&6; } -if test ${ac_cv_lib_soname_X11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lX11 $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XCreateWindow (); -int -main (void) -{ -return XCreateWindow (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_X11=`$ac_cv_path_LDD conftest.exe | grep "X11" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_X11=`$OTOOL -L conftest$ac_exeext | grep "libX11\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libX11\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_X11=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libX11\\.$LIBEXT" | sed -e "s/^.*\\[\\(libX11\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_X11:+false} : -then : - ac_cv_lib_soname_X11=`$LDD conftest$ac_exeext | grep "libX11\\.$LIBEXT" | sed -e "s/^.*\(libX11\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_X11= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_X11:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_X11" >&5 -printf "%s\n" "$ac_cv_lib_soname_X11" >&6; } - -printf "%s\n" "#define SONAME_LIBX11 \"$ac_cv_lib_soname_X11\"" >>confdefs.h - - -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXext" >&5 -printf %s "checking for -lXext... " >&6; } -if test ${ac_cv_lib_soname_Xext+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXext $X_LIBS -lX11 $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XextCreateExtension (); -int -main (void) -{ -return XextCreateExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xext=`$ac_cv_path_LDD conftest.exe | grep "Xext" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xext=`$OTOOL -L conftest$ac_exeext | grep "libXext\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXext\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xext=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXext\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXext\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xext:+false} : -then : - ac_cv_lib_soname_Xext=`$LDD conftest$ac_exeext | grep "libXext\\.$LIBEXT" | sed -e "s/^.*\(libXext\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xext= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xext:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xext" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xext" >&6; } - -printf "%s\n" "#define SONAME_LIBXEXT \"$ac_cv_lib_soname_Xext\"" >>confdefs.h - - X_LIBS="$X_LIBS -lXext" -fi - X_LIBS="$X_LIBS -lX11" - - xlib_includes="#include -#include " - - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/shape.h" "ac_cv_header_X11_extensions_shape_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_shape_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_SHAPE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput2.h" "ac_cv_header_X11_extensions_XInput2_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_XInput2_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XINPUT2_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XShm.h" "ac_cv_header_X11_extensions_XShm_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_XShm_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XSHM_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xfixes.h" "ac_cv_header_X11_extensions_Xfixes_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_Xfixes_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XFIXES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XINERAMA_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XRANDR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrender.h" "ac_cv_header_X11_extensions_Xrender_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_Xrender_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XRENDER_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmproto.h" "ac_cv_header_X11_extensions_xf86vmproto_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_xf86vmproto_h" = xyes -then : - printf "%s\n" "#define HAVE_X11_EXTENSIONS_XF86VMPROTO_H 1" >>confdefs.h - -fi - - - ac_fn_c_check_header_compile "$LINENO" "X11/Xcursor/Xcursor.h" "ac_cv_header_X11_Xcursor_Xcursor_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_Xcursor_Xcursor_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXcursor" >&5 -printf %s "checking for -lXcursor... " >&6; } -if test ${ac_cv_lib_soname_Xcursor+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXcursor $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XcursorImageLoadCursor (); -int -main (void) -{ -return XcursorImageLoadCursor (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xcursor=`$ac_cv_path_LDD conftest.exe | grep "Xcursor" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xcursor=`$OTOOL -L conftest$ac_exeext | grep "libXcursor\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXcursor\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xcursor=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXcursor\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXcursor\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xcursor:+false} : -then : - ac_cv_lib_soname_Xcursor=`$LDD conftest$ac_exeext | grep "libXcursor\\.$LIBEXT" | sed -e "s/^.*\(libXcursor\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xcursor= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xcursor:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xcursor" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xcursor" >&6; } - -printf "%s\n" "#define SONAME_LIBXCURSOR \"$ac_cv_lib_soname_Xcursor\"" >>confdefs.h - - -fi -fi - - if test "x$ac_cv_lib_soname_Xcursor" = "x" -then : - case "x$with_xcursor" in - x) as_fn_append wine_notices "|libxcursor ${notice_platform}development files not found, the Xcursor extension won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxcursor ${notice_platform}development files not found, the Xcursor extension won't be supported. -This is an error since --with-xcursor was requested." "$LINENO" 5 ;; -esac - -fi - - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput.h" "ac_cv_header_X11_extensions_XInput_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_XInput_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXi" >&5 -printf %s "checking for -lXi... " >&6; } -if test ${ac_cv_lib_soname_Xi+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXi $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XOpenDevice (); -int -main (void) -{ -return XOpenDevice (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xi=`$ac_cv_path_LDD conftest.exe | grep "Xi" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xi=`$OTOOL -L conftest$ac_exeext | grep "libXi\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXi\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xi=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXi\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXi\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xi:+false} : -then : - ac_cv_lib_soname_Xi=`$LDD conftest$ac_exeext | grep "libXi\\.$LIBEXT" | sed -e "s/^.*\(libXi\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xi:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xi" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xi" >&6; } - -printf "%s\n" "#define SONAME_LIBXI \"$ac_cv_lib_soname_Xi\"" >>confdefs.h - - -fi -fi - - if test "x$ac_cv_lib_soname_Xi" = "x" -then : - case "x$with_xinput" in - x) as_fn_append wine_notices "|libxi ${notice_platform}development files not found, the Xinput extension won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxi ${notice_platform}development files not found, the Xinput extension won't be supported. -This is an error since --with-xinput was requested." "$LINENO" 5 ;; -esac - -fi - - if test "x$ac_cv_lib_soname_Xi" != x - then - if test "$ac_cv_header_X11_extensions_XInput2_h" != "yes" -then : - case "x$with_xinput2" in - x) as_fn_append wine_notices "|XInput2 headers not found, the XInput 2 extension won't be supported." ;; - xno) ;; - *) as_fn_error $? "XInput2 headers not found, the XInput 2 extension won't be supported. -This is an error since --with-xinput2 was requested." "$LINENO" 5 ;; -esac - -fi - fi - - if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XShmQueryExtension in -lXext" >&5 -printf %s "checking for XShmQueryExtension in -lXext... " >&6; } -if test ${ac_cv_lib_Xext_XShmQueryExtension+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXext $X_LIBS $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XShmQueryExtension (); -int -main (void) -{ -return XShmQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_Xext_XShmQueryExtension=yes -else $as_nop - ac_cv_lib_Xext_XShmQueryExtension=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XShmQueryExtension" >&5 -printf "%s\n" "$ac_cv_lib_Xext_XShmQueryExtension" >&6; } -if test "x$ac_cv_lib_Xext_XShmQueryExtension" = xyes -then : - -printf "%s\n" "#define HAVE_LIBXXSHM 1" >>confdefs.h - -fi - - fi - if test "$ac_cv_lib_Xext_XShmQueryExtension" != "yes" -then : - case "x$with_xshm" in - x) as_fn_append wine_notices "|XShm ${notice_platform}development files not found, X Shared Memory won't be supported." ;; - xno) ;; - *) as_fn_error $? "XShm ${notice_platform}development files not found, X Shared Memory won't be supported. -This is an error since --with-xshm was requested." "$LINENO" 5 ;; -esac - -fi - - if test "$ac_cv_header_X11_extensions_shape_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XShapeQueryExtension in -lXext" >&5 -printf %s "checking for XShapeQueryExtension in -lXext... " >&6; } -if test ${ac_cv_lib_Xext_XShapeQueryExtension+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXext $X_LIBS $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XShapeQueryExtension (); -int -main (void) -{ -return XShapeQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_Xext_XShapeQueryExtension=yes -else $as_nop - ac_cv_lib_Xext_XShapeQueryExtension=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XShapeQueryExtension" >&5 -printf "%s\n" "$ac_cv_lib_Xext_XShapeQueryExtension" >&6; } -if test "x$ac_cv_lib_Xext_XShapeQueryExtension" = xyes -then : - -printf "%s\n" "#define HAVE_LIBXSHAPE 1" >>confdefs.h - -fi - - fi - if test "$ac_cv_lib_Xext_XShapeQueryExtension" != "yes" -then : - case "x$with_xshape" in - x) as_fn_append wine_notices "|XShape ${notice_platform}development files not found, XShape won't be supported." ;; - xno) ;; - *) as_fn_error $? "XShape ${notice_platform}development files not found, XShape won't be supported. -This is an error since --with-xshape was requested." "$LINENO" 5 ;; -esac - -fi - - if test "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes" -o "$ac_cv_header_X11_extensions_xf86vmproto_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXxf86vm" >&5 -printf %s "checking for -lXxf86vm... " >&6; } -if test ${ac_cv_lib_soname_Xxf86vm+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXxf86vm $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XF86VidModeQueryExtension (); -int -main (void) -{ -return XF86VidModeQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xxf86vm=`$ac_cv_path_LDD conftest.exe | grep "Xxf86vm" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xxf86vm=`$OTOOL -L conftest$ac_exeext | grep "libXxf86vm\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXxf86vm\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xxf86vm=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXxf86vm\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXxf86vm\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xxf86vm:+false} : -then : - ac_cv_lib_soname_Xxf86vm=`$LDD conftest$ac_exeext | grep "libXxf86vm\\.$LIBEXT" | sed -e "s/^.*\(libXxf86vm\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xxf86vm= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xxf86vm:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xxf86vm" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xxf86vm" >&6; } - -printf "%s\n" "#define SONAME_LIBXXF86VM \"$ac_cv_lib_soname_Xxf86vm\"" >>confdefs.h - - -fi - fi - if test "x$ac_cv_lib_soname_Xxf86vm" = "x" -then : - case "x$with_xxf86vm" in - x) as_fn_append wine_notices "|libXxf86vm ${notice_platform}development files not found, XFree86 Vidmode won't be supported." ;; - xno) ;; - *) as_fn_error $? "libXxf86vm ${notice_platform}development files not found, XFree86 Vidmode won't be supported. -This is an error since --with-xxf86vm was requested." "$LINENO" 5 ;; -esac - -fi - - if test "$ac_cv_header_X11_extensions_Xrender_h" = "yes" -a "x$ac_cv_lib_soname_X11" != "x" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXrender" >&5 -printf %s "checking for -lXrender... " >&6; } -if test ${ac_cv_lib_soname_Xrender+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXrender $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XRenderQueryExtension (); -int -main (void) -{ -return XRenderQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xrender=`$ac_cv_path_LDD conftest.exe | grep "Xrender" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xrender=`$OTOOL -L conftest$ac_exeext | grep "libXrender\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXrender\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xrender=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXrender\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXrender\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xrender:+false} : -then : - ac_cv_lib_soname_Xrender=`$LDD conftest$ac_exeext | grep "libXrender\\.$LIBEXT" | sed -e "s/^.*\(libXrender\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xrender= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xrender:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xrender" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xrender" >&6; } - -printf "%s\n" "#define SONAME_LIBXRENDER \"$ac_cv_lib_soname_Xrender\"" >>confdefs.h - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XRenderSetPictureTransform in -lXrender" >&5 -printf %s "checking for XRenderSetPictureTransform in -lXrender... " >&6; } -if test ${ac_cv_lib_Xrender_XRenderSetPictureTransform+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXrender $X_LIBS $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XRenderSetPictureTransform (); -int -main (void) -{ -return XRenderSetPictureTransform (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_Xrender_XRenderSetPictureTransform=yes -else $as_nop - ac_cv_lib_Xrender_XRenderSetPictureTransform=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderSetPictureTransform" >&5 -printf "%s\n" "$ac_cv_lib_Xrender_XRenderSetPictureTransform" >&6; } -if test "x$ac_cv_lib_Xrender_XRenderSetPictureTransform" = xyes -then : - -printf "%s\n" "#define HAVE_XRENDERSETPICTURETRANSFORM 1" >>confdefs.h - -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XRenderCreateLinearGradient in -lXrender" >&5 -printf %s "checking for XRenderCreateLinearGradient in -lXrender... " >&6; } -if test ${ac_cv_lib_Xrender_XRenderCreateLinearGradient+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXrender $X_LIBS $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XRenderCreateLinearGradient (); -int -main (void) -{ -return XRenderCreateLinearGradient (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_Xrender_XRenderCreateLinearGradient=yes -else $as_nop - ac_cv_lib_Xrender_XRenderCreateLinearGradient=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderCreateLinearGradient" >&5 -printf "%s\n" "$ac_cv_lib_Xrender_XRenderCreateLinearGradient" >&6; } -if test "x$ac_cv_lib_Xrender_XRenderCreateLinearGradient" = xyes -then : - -printf "%s\n" "#define HAVE_XRENDERCREATELINEARGRADIENT 1" >>confdefs.h - -fi - -fi - - fi - if test "x$ac_cv_lib_soname_Xrender" = "x" -then : - case "x$with_xrender" in - x) as_fn_append wine_warnings "|libxrender ${notice_platform}development files not found, XRender won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxrender ${notice_platform}development files not found, XRender won't be supported. -This is an error since --with-xrender was requested." "$LINENO" 5 ;; -esac - -fi - - if test "$ac_cv_header_X11_extensions_Xrandr_h" = "yes" -a "x$ac_cv_lib_soname_Xrender" != "x" - then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main (void) -{ -static typeof(XRRSetScreenConfigAndRate) * func; if (func) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXrandr" >&5 -printf %s "checking for -lXrandr... " >&6; } -if test ${ac_cv_lib_soname_Xrandr+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXrandr $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XRRQueryExtension (); -int -main (void) -{ -return XRRQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xrandr=`$ac_cv_path_LDD conftest.exe | grep "Xrandr" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xrandr=`$OTOOL -L conftest$ac_exeext | grep "libXrandr\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXrandr\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xrandr=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXrandr\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXrandr\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xrandr:+false} : -then : - ac_cv_lib_soname_Xrandr=`$LDD conftest$ac_exeext | grep "libXrandr\\.$LIBEXT" | sed -e "s/^.*\(libXrandr\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xrandr= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xrandr:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xrandr" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xrandr" >&6; } - -printf "%s\n" "#define SONAME_LIBXRANDR \"$ac_cv_lib_soname_Xrandr\"" >>confdefs.h - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main (void) -{ -static typeof(XRRGetProviderResources) *f; if (f) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -printf "%s\n" "#define HAVE_XRRGETPROVIDERRESOURCES 1" >>confdefs.h - -else $as_nop - as_fn_append wine_notices "|libxrandr ${notice_platform}development files too old, XRandR display device handler won't be supported." -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - if test "x$ac_cv_lib_soname_Xrandr" = "x" -then : - case "x$with_xrandr" in - x) as_fn_append wine_notices "|libxrandr ${notice_platform}development files not found, XRandr won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxrandr ${notice_platform}development files not found, XRandr won't be supported. -This is an error since --with-xrandr was requested." "$LINENO" 5 ;; -esac - -fi - - if test "$ac_cv_header_X11_extensions_Xfixes_h" = "yes" - then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main (void) -{ -static typeof(XFixesQueryVersion) * func; if (func) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXfixes" >&5 -printf %s "checking for -lXfixes... " >&6; } -if test ${ac_cv_lib_soname_Xfixes+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXfixes $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XFixesQueryVersion (); -int -main (void) -{ -return XFixesQueryVersion (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xfixes=`$ac_cv_path_LDD conftest.exe | grep "Xfixes" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xfixes=`$OTOOL -L conftest$ac_exeext | grep "libXfixes\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXfixes\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xfixes=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXfixes\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXfixes\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xfixes:+false} : -then : - ac_cv_lib_soname_Xfixes=`$LDD conftest$ac_exeext | grep "libXfixes\\.$LIBEXT" | sed -e "s/^.*\(libXfixes\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xfixes= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xfixes:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xfixes" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xfixes" >&6; } - -printf "%s\n" "#define SONAME_LIBXFIXES \"$ac_cv_lib_soname_Xfixes\"" >>confdefs.h - - -fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - if test "x$ac_cv_lib_soname_Xfixes" = "x" -then : - case "x$with_xfixes" in - x) as_fn_append wine_notices "|libxfixes ${notice_platform}development files not found, Xfixes won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxfixes ${notice_platform}development files not found, Xfixes won't be supported. -This is an error since --with-xfixes was requested." "$LINENO" 5 ;; -esac - -fi - - if test "$ac_cv_header_X11_extensions_Xinerama_h" = "yes" - then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main (void) -{ -static typeof(XineramaQueryScreens) * func; if (func) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXinerama" >&5 -printf %s "checking for -lXinerama... " >&6; } -if test ${ac_cv_lib_soname_Xinerama+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXinerama $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XineramaQueryScreens (); -int -main (void) -{ -return XineramaQueryScreens (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xinerama=`$ac_cv_path_LDD conftest.exe | grep "Xinerama" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xinerama=`$OTOOL -L conftest$ac_exeext | grep "libXinerama\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXinerama\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xinerama=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXinerama\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXinerama\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xinerama:+false} : -then : - ac_cv_lib_soname_Xinerama=`$LDD conftest$ac_exeext | grep "libXinerama\\.$LIBEXT" | sed -e "s/^.*\(libXinerama\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xinerama= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xinerama:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xinerama" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xinerama" >&6; } - -printf "%s\n" "#define SONAME_LIBXINERAMA \"$ac_cv_lib_soname_Xinerama\"" >>confdefs.h - - -fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - if test "x$ac_cv_lib_soname_Xinerama" = "x" -then : - case "x$with_xinerama" in - x) as_fn_append wine_notices "|libxinerama ${notice_platform}development files not found, multi-monitor setups won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxinerama ${notice_platform}development files not found, multi-monitor setups won't be supported. -This is an error since --with-xinerama was requested." "$LINENO" 5 ;; -esac - -fi - - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xcomposite.h" "ac_cv_header_X11_extensions_Xcomposite_h" "$xlib_includes -" -if test "x$ac_cv_header_X11_extensions_Xcomposite_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lXcomposite" >&5 -printf %s "checking for -lXcomposite... " >&6; } -if test ${ac_cv_lib_soname_Xcomposite+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lXcomposite $X_LIBS $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char XCompositeRedirectWindow (); -int -main (void) -{ -return XCompositeRedirectWindow (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_Xcomposite=`$ac_cv_path_LDD conftest.exe | grep "Xcomposite" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_Xcomposite=`$OTOOL -L conftest$ac_exeext | grep "libXcomposite\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXcomposite\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_Xcomposite=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libXcomposite\\.$LIBEXT" | sed -e "s/^.*\\[\\(libXcomposite\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_Xcomposite:+false} : -then : - ac_cv_lib_soname_Xcomposite=`$LDD conftest$ac_exeext | grep "libXcomposite\\.$LIBEXT" | sed -e "s/^.*\(libXcomposite\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_Xcomposite= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_Xcomposite:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_Xcomposite" >&5 -printf "%s\n" "$ac_cv_lib_soname_Xcomposite" >&6; } - -printf "%s\n" "#define SONAME_LIBXCOMPOSITE \"$ac_cv_lib_soname_Xcomposite\"" >>confdefs.h - - -fi -fi - - if test "x$ac_cv_lib_soname_Xcomposite" = "x" -then : - case "x$with_xcomposite" in - x) as_fn_append wine_notices "|libxcomposite ${notice_platform}development files not found, Xcomposite won't be supported." ;; - xno) ;; - *) as_fn_error $? "libxcomposite ${notice_platform}development files not found, Xcomposite won't be supported. -This is an error since --with-xcomposite was requested." "$LINENO" 5 ;; -esac - -fi - - ac_fn_c_check_member "$LINENO" "XICCallback" "callback" "ac_cv_member_XICCallback_callback" "$xlib_includes -" -if test "x$ac_cv_member_XICCallback_callback" = xyes -then : - -printf "%s\n" "#define HAVE_XICCALLBACK_CALLBACK 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "XEvent" "xcookie" "ac_cv_member_XEvent_xcookie" "$xlib_includes -" -if test "x$ac_cv_member_XEvent_xcookie" = xyes -then : - -printf "%s\n" "#define HAVE_XEVENT_XCOOKIE 1" >>confdefs.h - - -fi - - - - opengl_msg="" - if test "x$with_opengl" != "xno" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lGL" >&5 -printf %s "checking for -lGL... " >&6; } -if test ${ac_cv_lib_soname_GL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lGL $X_LIBS -lm $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char glXCreateContext (); -int -main (void) -{ -return glXCreateContext (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_GL=`$ac_cv_path_LDD conftest.exe | grep "GL" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_GL=`$OTOOL -L conftest$ac_exeext | grep "libGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_GL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_GL:+false} : -then : - ac_cv_lib_soname_GL=`$LDD conftest$ac_exeext | grep "libGL\\.$LIBEXT" | sed -e "s/^.*\(libGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_GL= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_GL:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lGL" >&5 -printf %s "checking for -lGL... " >&6; } -if test ${ac_cv_lib_soname_GL+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lGL $X_LIBS -lm $X_EXTRA_LIBS -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char glXCreateContext (); -int -main (void) -{ -return glXCreateContext (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_GL=`$ac_cv_path_LDD conftest.exe | grep "GL" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_GL=`$OTOOL -L conftest$ac_exeext | grep "libGL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libGL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_GL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libGL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libGL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_GL:+false} : -then : - ac_cv_lib_soname_GL=`$LDD conftest$ac_exeext | grep "libGL\\.$LIBEXT" | sed -e "s/^.*\(libGL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_GL= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_GL:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - if test -f /usr/X11R6/lib/libGL.a - then - opengl_msg="/usr/X11R6/lib/libGL.a is present on your system. -This probably prevents linking to OpenGL. Try deleting the file and restarting configure." - else - opengl_msg="No OpenGL library found on this system." - fi -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_GL" >&5 -printf "%s\n" "$ac_cv_lib_soname_GL" >&6; } - -printf "%s\n" "#define SONAME_LIBGL \"$ac_cv_lib_soname_GL\"" >>confdefs.h - - OPENGL_LIBS="-Xlinker -dylib_file -Xlinker /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -lGL" -fi -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_GL" >&5 -printf "%s\n" "$ac_cv_lib_soname_GL" >&6; } - -printf "%s\n" "#define SONAME_LIBGL \"$ac_cv_lib_soname_GL\"" >>confdefs.h - - OPENGL_LIBS="-lGL" -fi - if test "x$with_osmesa" != "xno" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lOSMesa" >&5 -printf %s "checking for -lOSMesa... " >&6; } -if test ${ac_cv_lib_soname_OSMesa+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lOSMesa $X_LIBS -lm $X_EXTRA_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char OSMesaGetProcAddress (); -int -main (void) -{ -return OSMesaGetProcAddress (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_OSMesa=`$ac_cv_path_LDD conftest.exe | grep "OSMesa" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_OSMesa=`$OTOOL -L conftest$ac_exeext | grep "libOSMesa\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libOSMesa\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_OSMesa=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libOSMesa\\.$LIBEXT" | sed -e "s/^.*\\[\\(libOSMesa\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_OSMesa:+false} : -then : - ac_cv_lib_soname_OSMesa=`$LDD conftest$ac_exeext | grep "libOSMesa\\.$LIBEXT" | sed -e "s/^.*\(libOSMesa\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_OSMesa= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_OSMesa:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_OSMesa" >&5 -printf "%s\n" "$ac_cv_lib_soname_OSMesa" >&6; } - -printf "%s\n" "#define SONAME_LIBOSMESA \"$ac_cv_lib_soname_OSMesa\"" >>confdefs.h - - -fi - if test "x$ac_cv_lib_soname_OSMesa" = "x" -then : - case "x$with_osmesa" in - x) as_fn_append wine_notices "|libOSMesa ${notice_platform}development files not found (or too old), OpenGL rendering in bitmaps won't be supported." ;; - xno) ;; - *) as_fn_error $? "libOSMesa ${notice_platform}development files not found (or too old), OpenGL rendering in bitmaps won't be supported. -This is an error since --with-osmesa was requested." "$LINENO" 5 ;; -esac - -fi - fi - fi - if test -n "$opengl_msg" -then : - case "x$with_opengl" in - x) as_fn_append wine_warnings "|$opengl_msg -OpenGL and Direct3D won't be supported." ;; - xno) ;; - *) as_fn_error $? "$opengl_msg -OpenGL and Direct3D won't be supported. -This is an error since --with-opengl was requested." "$LINENO" 5 ;; -esac - -fi - - CPPFLAGS="$ac_save_CPPFLAGS" -else - X_CFLAGS="" - X_LIBS="" -fi - -if test "$enable_wineandroid_drv$enable_winemac_drv" = "nono" -then - if test "x$X_LIBS" = "x" -then : - case "x$with_x" in - xno) ;; - *) as_fn_error $? "X ${notice_platform}development files not found. Wine will be built -without X support, which probably isn't what you want. You will need -to install ${notice_platform}development packages of Xlib at the very least. -Use the --without-x option if you really want this." "$LINENO" 5 ;; -esac -enable_winex11_drv=${enable_winex11_drv:-no} -fi -else - if test "x$X_LIBS" = "x" -then : - case "x$with_x" in - x) as_fn_append wine_notices "|X ${notice_platform}development files not found, the X11 driver won't be supported." ;; - xno) ;; - *) as_fn_error $? "X ${notice_platform}development files not found, the X11 driver won't be supported. -This is an error since --with-x was requested." "$LINENO" 5 ;; -esac -enable_winex11_drv=${enable_winex11_drv:-no} -fi -fi - -if test "x$with_wayland" != "xno" -then - rm -f conftest.err -if ${WAYLAND_CLIENT_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - WAYLAND_CLIENT_CFLAGS=`$PKG_CONFIG --cflags wayland-client 2>conftest.err` -fi -fi - -if ${WAYLAND_CLIENT_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - WAYLAND_CLIENT_LIBS=`$PKG_CONFIG --libs wayland-client 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: wayland-client cflags: $WAYLAND_CLIENT_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: wayland-client libs: $WAYLAND_CLIENT_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: wayland-client errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $WAYLAND_CLIENT_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "wayland-client.h" "ac_cv_header_wayland_client_h" "$ac_includes_default" -if test "x$ac_cv_header_wayland_client_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wl_display_connect in -lwayland-client" >&5 -printf %s "checking for wl_display_connect in -lwayland-client... " >&6; } -if test ${ac_cv_lib_wayland_client_wl_display_connect+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lwayland-client $WAYLAND_CLIENT_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char wl_display_connect (); -int -main (void) -{ -return wl_display_connect (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_wayland_client_wl_display_connect=yes -else $as_nop - ac_cv_lib_wayland_client_wl_display_connect=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wayland_client_wl_display_connect" >&5 -printf "%s\n" "$ac_cv_lib_wayland_client_wl_display_connect" >&6; } -if test "x$ac_cv_lib_wayland_client_wl_display_connect" = xyes -then : - # Extract the first word of "wayland-scanner", so it can be a program name with args. -set dummy wayland-scanner; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_WAYLAND_SCANNER+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $WAYLAND_SCANNER in - [\\/]* | ?:[\\/]*) - ac_cv_path_WAYLAND_SCANNER="$WAYLAND_SCANNER" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_WAYLAND_SCANNER="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_WAYLAND_SCANNER" && ac_cv_path_WAYLAND_SCANNER="`test -n "$PKG_CONFIG" && $PKG_CONFIG --variable=wayland_scanner wayland-scanner 2>/dev/null`" - ;; -esac -fi -WAYLAND_SCANNER=$ac_cv_path_WAYLAND_SCANNER -if test -n "$WAYLAND_SCANNER"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $WAYLAND_SCANNER" >&5 -printf "%s\n" "$WAYLAND_SCANNER" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -else $as_nop - WAYLAND_CLIENT_LIBS="" -fi - -fi - -CPPFLAGS=$ac_save_CPPFLAGS - - rm -f conftest.err -if ${XKBCOMMON_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - XKBCOMMON_CFLAGS=`$PKG_CONFIG --cflags xkbcommon 2>conftest.err` -fi -fi - -if ${XKBCOMMON_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - XKBCOMMON_LIBS=`$PKG_CONFIG --libs xkbcommon 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xkbcommon cflags: $XKBCOMMON_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xkbcommon libs: $XKBCOMMON_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: xkbcommon errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $XKBCOMMON_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "xkbcommon/xkbcommon.h" "ac_cv_header_xkbcommon_xkbcommon_h" "$ac_includes_default" -if test "x$ac_cv_header_xkbcommon_xkbcommon_h" = xyes -then : - printf "%s\n" "#define HAVE_XKBCOMMON_XKBCOMMON_H 1" >>confdefs.h - -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xkb_context_new in -lxkbcommon" >&5 -printf %s "checking for xkb_context_new in -lxkbcommon... " >&6; } -if test ${ac_cv_lib_xkbcommon_xkb_context_new+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lxkbcommon $XKBCOMMON_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char xkb_context_new (); -int -main (void) -{ -return xkb_context_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_xkbcommon_xkb_context_new=yes -else $as_nop - ac_cv_lib_xkbcommon_xkb_context_new=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xkbcommon_xkb_context_new" >&5 -printf "%s\n" "$ac_cv_lib_xkbcommon_xkb_context_new" >&6; } -if test "x$ac_cv_lib_xkbcommon_xkb_context_new" = xyes -then : - : -else $as_nop - XKBCOMMON_LIBS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - - rm -f conftest.err -if ${XKBREGISTRY_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - XKBREGISTRY_CFLAGS=`$PKG_CONFIG --cflags xkbregistry 2>conftest.err` -fi -fi - -if ${XKBREGISTRY_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - XKBREGISTRY_LIBS=`$PKG_CONFIG --libs xkbregistry 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xkbregistry cflags: $XKBREGISTRY_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: xkbregistry libs: $XKBREGISTRY_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: xkbregistry errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $XKBREGISTRY_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "xkbcommon/xkbregistry.h" "ac_cv_header_xkbcommon_xkbregistry_h" "$ac_includes_default" -if test "x$ac_cv_header_xkbcommon_xkbregistry_h" = xyes -then : - printf "%s\n" "#define HAVE_XKBCOMMON_XKBREGISTRY_H 1" >>confdefs.h - -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for rxkb_context_new in -lxkbregistry" >&5 -printf %s "checking for rxkb_context_new in -lxkbregistry... " >&6; } -if test ${ac_cv_lib_xkbregistry_rxkb_context_new+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lxkbregistry $XKBREGISTRY_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char rxkb_context_new (); -int -main (void) -{ -return rxkb_context_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_xkbregistry_rxkb_context_new=yes -else $as_nop - ac_cv_lib_xkbregistry_rxkb_context_new=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xkbregistry_rxkb_context_new" >&5 -printf "%s\n" "$ac_cv_lib_xkbregistry_rxkb_context_new" >&6; } -if test "x$ac_cv_lib_xkbregistry_rxkb_context_new" = xyes -then : - : -else $as_nop - XKBREGISTRY_LIBS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test -z "$WAYLAND_CLIENT_LIBS" -o -z "$WAYLAND_SCANNER" -o -z "$XKBCOMMON_LIBS" -o -z "$XKBREGISTRY_LIBS" -o "$ac_cv_header_linux_input_h" = "no" -then : - case "x$with_wayland" in - x) as_fn_append wine_notices "|Wayland ${notice_platform}development files not found, the Wayland driver won't be supported." ;; - xno) ;; - *) as_fn_error $? "Wayland ${notice_platform}development files not found, the Wayland driver won't be supported. -This is an error since --with-wayland was requested." "$LINENO" 5 ;; -esac -enable_winewayland_drv=${enable_winewayland_drv:-no} -fi - -if test "$ac_cv_header_CL_cl_h" = "yes" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clGetPlatformInfo in -lOpenCL" >&5 -printf %s "checking for clGetPlatformInfo in -lOpenCL... " >&6; } -if test ${ac_cv_lib_OpenCL_clGetPlatformInfo+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lOpenCL $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char clGetPlatformInfo (); -int -main (void) -{ -return clGetPlatformInfo (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_OpenCL_clGetPlatformInfo=yes -else $as_nop - ac_cv_lib_OpenCL_clGetPlatformInfo=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OpenCL_clGetPlatformInfo" >&5 -printf "%s\n" "$ac_cv_lib_OpenCL_clGetPlatformInfo" >&6; } -if test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" = xyes -then : - OPENCL_LIBS="-lOpenCL" - -fi - -fi -if test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes -then : - case "x$with_opencl" in - x) as_fn_append wine_notices "|OpenCL ${notice_platform}development files not found, OpenCL won't be supported." ;; - xno) ;; - *) as_fn_error $? "OpenCL ${notice_platform}development files not found, OpenCL won't be supported. -This is an error since --with-opencl was requested." "$LINENO" 5 ;; -esac -enable_opencl=${enable_opencl:-no} -fi - -if test "$ac_cv_header_pcap_pcap_h" = "yes" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcap_init in -lpcap" >&5 -printf %s "checking for pcap_init in -lpcap... " >&6; } -if test ${ac_cv_lib_pcap_pcap_init+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpcap $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char pcap_init (); -int -main (void) -{ -return pcap_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_pcap_pcap_init=yes -else $as_nop - ac_cv_lib_pcap_pcap_init=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_init" >&5 -printf "%s\n" "$ac_cv_lib_pcap_pcap_init" >&6; } -if test "x$ac_cv_lib_pcap_pcap_init" = xyes -then : - PCAP_LIBS="-lpcap" - -fi - -fi -if test "x$ac_cv_lib_pcap_pcap_init" != xyes -then : - case "x$with_pcap" in - x) as_fn_append wine_notices "|pcap ${notice_platform}development files not found, wpcap won't be supported." ;; - xno) ;; - *) as_fn_error $? "pcap ${notice_platform}development files not found, wpcap won't be supported. -This is an error since --with-pcap was requested." "$LINENO" 5 ;; -esac -enable_wpcap=${enable_wpcap:-no} -fi - -if test "x$with_pcsclite" != "xno" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SCardEstablishContext in -lpcsclite" >&5 -printf %s "checking for SCardEstablishContext in -lpcsclite... " >&6; } -if test ${ac_cv_lib_pcsclite_SCardEstablishContext+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpcsclite $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char SCardEstablishContext (); -int -main (void) -{ -return SCardEstablishContext (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_pcsclite_SCardEstablishContext=yes -else $as_nop - ac_cv_lib_pcsclite_SCardEstablishContext=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcsclite_SCardEstablishContext" >&5 -printf "%s\n" "$ac_cv_lib_pcsclite_SCardEstablishContext" >&6; } -if test "x$ac_cv_lib_pcsclite_SCardEstablishContext" = xyes -then : - PCSCLITE_LIBS="-lpcsclite" - -else $as_nop - case $host_os in - darwin*|macosx*) PCSCLITE_LIBS="-framework PCSC" - ;; - esac -fi - -fi -if test "x$PCSCLITE_LIBS" = x -then : - case "x$with_pcsclite" in - x) as_fn_append wine_notices "|libpcsclite not found, smart cards won't be supported." ;; - xno) ;; - *) as_fn_error $? "libpcsclite not found, smart cards won't be supported. -This is an error since --with-pcsclite was requested." "$LINENO" 5 ;; -esac -enable_winscard=${enable_winscard:-no} -fi - -if test "x$with_inotify" != "xno" -then - rm -f conftest.err -if ${INOTIFY_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - INOTIFY_CFLAGS=`$PKG_CONFIG --cflags libinotify 2>conftest.err` -fi -fi - -if ${INOTIFY_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - INOTIFY_LIBS=`$PKG_CONFIG --libs libinotify 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libinotify cflags: $INOTIFY_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libinotify libs: $INOTIFY_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libinotify errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $INOTIFY_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_inotify_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_INOTIFY_H 1" >>confdefs.h - -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inotify_add_watch in -linotify" >&5 -printf %s "checking for inotify_add_watch in -linotify... " >&6; } -if test ${ac_cv_lib_inotify_inotify_add_watch+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-linotify $INOTIFY_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char inotify_add_watch (); -int -main (void) -{ -return inotify_add_watch (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_inotify_inotify_add_watch=yes -else $as_nop - ac_cv_lib_inotify_inotify_add_watch=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inotify_inotify_add_watch" >&5 -printf "%s\n" "$ac_cv_lib_inotify_inotify_add_watch" >&6; } -if test "x$ac_cv_lib_inotify_inotify_add_watch" = xyes -then : - : -else $as_nop - INOTIFY_LIBS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "$ac_cv_header_sys_inotify_h" != "yes" -then : - case "x$with_inotify" in - x) as_fn_append wine_notices "|libinotify ${notice_platform}development files not found (or too old), filesystem change notifications won't be supported." ;; - xno) ;; - *) as_fn_error $? "libinotify ${notice_platform}development files not found (or too old), filesystem change notifications won't be supported. -This is an error since --with-inotify was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_dbus" != "xno" -then - rm -f conftest.err -if ${DBUS_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1 2>conftest.err` -fi -fi - -if ${DBUS_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - DBUS_LIBS=`$PKG_CONFIG --libs dbus-1 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: dbus-1 cflags: $DBUS_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: dbus-1 libs: $DBUS_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: dbus-1 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" -if test "x$ac_cv_header_dbus_dbus_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -ldbus-1" >&5 -printf %s "checking for -ldbus-1... " >&6; } -if test ${ac_cv_lib_soname_dbus_1+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-ldbus-1 $DBUS_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dbus_connection_close (); -int -main (void) -{ -return dbus_connection_close (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_dbus_1=`$ac_cv_path_LDD conftest.exe | grep "dbus-1" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_dbus_1=`$OTOOL -L conftest$ac_exeext | grep "libdbus-1\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libdbus-1\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_dbus_1=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libdbus-1\\.$LIBEXT" | sed -e "s/^.*\\[\\(libdbus-1\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_dbus_1:+false} : -then : - ac_cv_lib_soname_dbus_1=`$LDD conftest$ac_exeext | grep "libdbus-1\\.$LIBEXT" | sed -e "s/^.*\(libdbus-1\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_dbus_1= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_dbus_1:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - DBUS_CFLAGS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_dbus_1" >&5 -printf "%s\n" "$ac_cv_lib_soname_dbus_1" >&6; } - -printf "%s\n" "#define SONAME_LIBDBUS_1 \"$ac_cv_lib_soname_dbus_1\"" >>confdefs.h - - -fi -else $as_nop - DBUS_CFLAGS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -case $host_os in - darwin*|macosx*) ;; - *) if test "x$ac_cv_lib_soname_dbus_1" = "x" -then : - case "x$with_dbus" in - x) as_fn_append wine_notices "|libdbus ${notice_platform}development files not found, no dynamic device support." ;; - xno) ;; - *) as_fn_error $? "libdbus ${notice_platform}development files not found, no dynamic device support. -This is an error since --with-dbus was requested." "$LINENO" 5 ;; -esac - -fi ;; -esac - -if test "x$with_gnutls" != "xno" -then - rm -f conftest.err -if ${GNUTLS_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GNUTLS_CFLAGS=`$PKG_CONFIG --cflags gnutls 2>conftest.err` -fi -fi - -if ${GNUTLS_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GNUTLS_LIBS=`$PKG_CONFIG --libs gnutls 2>/dev/null` -fi -fi - -GNUTLS_LIBS=${GNUTLS_LIBS:-"-lgnutls"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: gnutls cflags: $GNUTLS_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: gnutls libs: $GNUTLS_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: gnutls errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default" -if test "x$ac_cv_header_gnutls_gnutls_h" = xyes -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main (void) -{ -static typeof(gnutls_mac_get_key_size) *func; if (func) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lgnutls" >&5 -printf %s "checking for -lgnutls... " >&6; } -if test ${ac_cv_lib_soname_gnutls+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lgnutls $GNUTLS_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gnutls_global_init (); -int -main (void) -{ -return gnutls_global_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_gnutls=`$ac_cv_path_LDD conftest.exe | grep "gnutls" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_gnutls=`$OTOOL -L conftest$ac_exeext | grep "libgnutls\\(-deb0\\)\\{0,1\\}\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libgnutls\\(-deb0\\)\\{0,1\\}\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_gnutls=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libgnutls\\(-deb0\\)\\{0,1\\}\\.$LIBEXT" | sed -e "s/^.*\\[\\(libgnutls\\(-deb0\\)\\{0,1\\}\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_gnutls:+false} : -then : - ac_cv_lib_soname_gnutls=`$LDD conftest$ac_exeext | grep "libgnutls\\(-deb0\\)\\{0,1\\}\\.$LIBEXT" | sed -e "s/^.*\(libgnutls\\(-deb0\\)\\{0,1\\}\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_gnutls= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_gnutls:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - GNUTLS_CFLAGS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_gnutls" >&5 -printf "%s\n" "$ac_cv_lib_soname_gnutls" >&6; } - -printf "%s\n" "#define SONAME_LIBGNUTLS \"$ac_cv_lib_soname_gnutls\"" >>confdefs.h - - -fi - ac_wine_check_funcs_save_LIBS="$LIBS" -LIBS="$LIBS $GNUTLS_LIBS" - - for ac_func in gnutls_cipher_init -do : - ac_fn_c_check_func "$LINENO" "gnutls_cipher_init" "ac_cv_func_gnutls_cipher_init" -if test "x$ac_cv_func_gnutls_cipher_init" = xyes -then : - printf "%s\n" "#define HAVE_GNUTLS_CIPHER_INIT 1" >>confdefs.h - -else $as_nop - as_fn_append wine_notices "|libgnutls ${notice_platform}development files too old, bcrypt encryption won't be supported." -fi - -done -LIBS="$ac_wine_check_funcs_save_LIBS" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -else $as_nop - GNUTLS_CFLAGS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_gnutls" = "x" -then : - case "x$with_gnutls" in - x) as_fn_append wine_warnings "|libgnutls ${notice_platform}development files not found, no schannel support." ;; - xno) ;; - *) as_fn_error $? "libgnutls ${notice_platform}development files not found, no schannel support. -This is an error since --with-gnutls was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_sane" != "xno" -then - rm -f conftest.err -if ${SANE_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - SANE_CFLAGS=`$PKG_CONFIG --cflags sane-backends 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || SANE_CFLAGS=${SANE_CFLAGS:-`${SANE_CONFIG:-sane-config} --cflags 2>/dev/null`} -if ${SANE_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - SANE_LIBS=`$PKG_CONFIG --libs sane-backends 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || SANE_LIBS=${SANE_LIBS:-`${SANE_CONFIG:-sane-config} --ldflags 2>/dev/null`} - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: sane-backends cflags: $SANE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: sane-backends libs: $SANE_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: sane-backends errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $SANE_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "sane/sane.h" "ac_cv_header_sane_sane_h" "$ac_includes_default" -if test "x$ac_cv_header_sane_sane_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sane_init in -lsane" >&5 -printf %s "checking for sane_init in -lsane... " >&6; } -if test ${ac_cv_lib_sane_sane_init+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsane $SANE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char sane_init (); -int -main (void) -{ -return sane_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_sane_sane_init=yes -else $as_nop - ac_cv_lib_sane_sane_init=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sane_sane_init" >&5 -printf "%s\n" "$ac_cv_lib_sane_sane_init" >&6; } -if test "x$ac_cv_lib_sane_sane_init" = xyes -then : - : -fi - -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "$ac_cv_lib_sane_sane_init" != "yes" -then : - case "x$with_sane" in - x) as_fn_append wine_notices "|libsane ${notice_platform}development files not found, scanners won't be supported." ;; - xno) ;; - *) as_fn_error $? "libsane ${notice_platform}development files not found, scanners won't be supported. -This is an error since --with-sane was requested." "$LINENO" 5 ;; -esac -enable_sane_ds=${enable_sane_ds:-no} -fi - -if test "x$with_usb" != "xno" -then - rm -f conftest.err -if ${USB_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - USB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0 2>conftest.err` -fi -fi - -if ${USB_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - USB_LIBS=`$PKG_CONFIG --libs libusb-1.0 2>/dev/null` -fi -fi - -USB_LIBS=${USB_LIBS:-"-lusb-1.0"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libusb-1.0 cflags: $USB_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libusb-1.0 libs: $USB_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libusb-1.0 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $USB_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" -if test "x$ac_cv_header_libusb_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libusb_interrupt_event_handler in -lusb-1.0" >&5 -printf %s "checking for libusb_interrupt_event_handler in -lusb-1.0... " >&6; } -if test ${ac_cv_lib_usb_1_0_libusb_interrupt_event_handler+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lusb-1.0 $USB_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char libusb_interrupt_event_handler (); -int -main (void) -{ -return libusb_interrupt_event_handler (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_usb_1_0_libusb_interrupt_event_handler=yes -else $as_nop - ac_cv_lib_usb_1_0_libusb_interrupt_event_handler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_1_0_libusb_interrupt_event_handler" >&5 -printf "%s\n" "$ac_cv_lib_usb_1_0_libusb_interrupt_event_handler" >&6; } -if test "x$ac_cv_lib_usb_1_0_libusb_interrupt_event_handler" = xyes -then : - : -else $as_nop - USB_LIBS="" -fi - -else $as_nop - USB_LIBS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "$ac_cv_lib_usb_1_0_libusb_interrupt_event_handler" != "yes" -then : - case "x$with_usb" in - x) as_fn_append wine_notices "|libusb-1.0 ${notice_platform}development files not found (or too old), USB devices won't be supported." ;; - xno) ;; - *) as_fn_error $? "libusb-1.0 ${notice_platform}development files not found (or too old), USB devices won't be supported. -This is an error since --with-usb was requested." "$LINENO" 5 ;; -esac -enable_wineusb_sys=${enable_wineusb_sys:-no} -fi - -if test "x$with_v4l2" != "xno" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lv4l2" >&5 -printf %s "checking for -lv4l2... " >&6; } -if test ${ac_cv_lib_soname_v4l2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lv4l2 $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char v4l2_open (); -int -main (void) -{ -return v4l2_open (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_v4l2=`$ac_cv_path_LDD conftest.exe | grep "v4l2" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_v4l2=`$OTOOL -L conftest$ac_exeext | grep "libv4l2\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libv4l2\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_v4l2=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libv4l2\\.$LIBEXT" | sed -e "s/^.*\\[\\(libv4l2\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_v4l2:+false} : -then : - ac_cv_lib_soname_v4l2=`$LDD conftest$ac_exeext | grep "libv4l2\\.$LIBEXT" | sed -e "s/^.*\(libv4l2\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_v4l2= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_v4l2:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_v4l2" >&5 -printf "%s\n" "$ac_cv_lib_soname_v4l2" >&6; } - -printf "%s\n" "#define SONAME_LIBV4L2 \"$ac_cv_lib_soname_v4l2\"" >>confdefs.h - - -fi -fi -if test "x$ac_cv_lib_soname_v4l2" = "x" -then : - case "x$with_v4l2" in - x) as_fn_append wine_notices "|libv4l2 ${notice_platform}development files not found." ;; - xno) ;; - *) as_fn_error $? "libv4l2 ${notice_platform}development files not found. -This is an error since --with-v4l2 was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_gphoto" != "xno" -then - rm -f conftest.err -if ${GPHOTO2_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GPHOTO2_CFLAGS=`$PKG_CONFIG --cflags libgphoto2 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || GPHOTO2_CFLAGS=${GPHOTO2_CFLAGS:-`${GPHOTO2_CONFIG:-gphoto2-config} --cflags 2>/dev/null`} -if ${GPHOTO2_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GPHOTO2_LIBS=`$PKG_CONFIG --libs libgphoto2 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || GPHOTO2_LIBS=${GPHOTO2_LIBS:-`${GPHOTO2_CONFIG:-gphoto2-config} --libs 2>/dev/null`} -GPHOTO2_LIBS=${GPHOTO2_LIBS:-"-lgphoto2"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libgphoto2 cflags: $GPHOTO2_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libgphoto2 libs: $GPHOTO2_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libgphoto2 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $GPHOTO2_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "gphoto2-camera.h" "ac_cv_header_gphoto2_camera_h" "$ac_includes_default" -if test "x$ac_cv_header_gphoto2_camera_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gp_camera_new in -lgphoto2" >&5 -printf %s "checking for gp_camera_new in -lgphoto2... " >&6; } -if test ${ac_cv_lib_gphoto2_gp_camera_new+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgphoto2 $GPHOTO2_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gp_camera_new (); -int -main (void) -{ -return gp_camera_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_gphoto2_gp_camera_new=yes -else $as_nop - ac_cv_lib_gphoto2_gp_camera_new=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gphoto2_gp_camera_new" >&5 -printf "%s\n" "$ac_cv_lib_gphoto2_gp_camera_new" >&6; } -if test "x$ac_cv_lib_gphoto2_gp_camera_new" = xyes -then : - : -fi - -fi - -CPPFLAGS=$ac_save_CPPFLAGS - - rm -f conftest.err -if ${GPHOTO2_PORT_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GPHOTO2_PORT_CFLAGS=`$PKG_CONFIG --cflags libgphoto2_port 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || GPHOTO2_PORT_CFLAGS=${GPHOTO2_PORT_CFLAGS:-`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --cflags 2>/dev/null`} -if ${GPHOTO2_PORT_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GPHOTO2_PORT_LIBS=`$PKG_CONFIG --libs libgphoto2_port 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || GPHOTO2_PORT_LIBS=${GPHOTO2_PORT_LIBS:-`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --libs 2>/dev/null`} -GPHOTO2_PORT_LIBS=${GPHOTO2_PORT_LIBS:-"-lgphoto2_port"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libgphoto2_port cflags: $GPHOTO2_PORT_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libgphoto2_port libs: $GPHOTO2_PORT_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libgphoto2_port errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $GPHOTO2_PORT_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "gphoto2-port.h" "ac_cv_header_gphoto2_port_h" "$ac_includes_default" -if test "x$ac_cv_header_gphoto2_port_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gp_port_info_list_new in -lgphoto2_port" >&5 -printf %s "checking for gp_port_info_list_new in -lgphoto2_port... " >&6; } -if test ${ac_cv_lib_gphoto2_port_gp_port_info_list_new+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgphoto2_port $GPHOTO2_PORT_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gp_port_info_list_new (); -int -main (void) -{ -return gp_port_info_list_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_gphoto2_port_gp_port_info_list_new=yes -else $as_nop - ac_cv_lib_gphoto2_port_gp_port_info_list_new=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gphoto2_port_gp_port_info_list_new" >&5 -printf "%s\n" "$ac_cv_lib_gphoto2_port_gp_port_info_list_new" >&6; } -if test "x$ac_cv_lib_gphoto2_port_gp_port_info_list_new" = xyes -then : - -printf "%s\n" "#define HAVE_GPHOTO2_PORT 1" >>confdefs.h - -else $as_nop - GPHOTO2_PORT_LIBS=""; GPHOTO2_PORT_CFLAGS="" -fi - -else $as_nop - GPHOTO2_PORT_LIBS=""; GPHOTO2_PORT_CFLAGS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "$ac_cv_lib_gphoto2_gp_camera_new" != "yes" -then : - case "x$with_gphoto" in - x) as_fn_append wine_notices "|libgphoto2 ${notice_platform}development files not found, digital cameras won't be supported." ;; - xno) ;; - *) as_fn_error $? "libgphoto2 ${notice_platform}development files not found, digital cameras won't be supported. -This is an error since --with-gphoto was requested." "$LINENO" 5 ;; -esac -enable_gphoto2_ds=${enable_gphoto2_ds:-no} -fi -if test "$ac_cv_lib_gphoto2_port_gp_port_info_list_new" != "yes" -then : - case "x$with_gphoto" in - x) as_fn_append wine_notices "|libgphoto2_port ${notice_platform}development files not found, digital cameras won't be auto-detected." ;; - xno) ;; - *) as_fn_error $? "libgphoto2_port ${notice_platform}development files not found, digital cameras won't be auto-detected. -This is an error since --with-gphoto was requested." "$LINENO" 5 ;; -esac - -fi - - -if test "$ac_cv_header_resolv_h" = "yes" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for resolver library" >&5 -printf %s "checking for resolver library... " >&6; } -if test ${ac_cv_have_resolv+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_LIBS="$LIBS" - for lib in '' -lresolv - do - LIBS="$lib $ac_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef HAVE_NETINET_IN_H -#include -#endif -#include -int -main (void) -{ -if (!(_res.options & RES_INIT)) res_init(); res_query("foo",ns_c_in,0,0,0); ns_initparse(0,0,0) - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_have_resolv=${lib:-"none required"} -else $as_nop - ac_cv_have_resolv="not found" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - test "x$ac_cv_have_resolv" = "xnot found" || break - done - LIBS="$ac_save_LIBS" -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_resolv" >&5 -printf "%s\n" "$ac_cv_have_resolv" >&6; } - - case "$ac_cv_have_resolv" in - "not found") ;; - "none required") - -printf "%s\n" "#define HAVE_RESOLV 1" >>confdefs.h - ;; - *) - printf "%s\n" "#define HAVE_RESOLV 1" >>confdefs.h - - RESOLV_LIBS=$ac_cv_have_resolv - ;; - esac - - if test "x$ac_cv_have_resolv" != "xnot found" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for res_getservers" >&5 -printf %s "checking for res_getservers... " >&6; } -if test ${ac_cv_have_res_getservers+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_LIBS="$LIBS" - LIBS="$RESOLV_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -res_getservers(NULL, NULL, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_have_res_getservers=yes -else $as_nop - ac_cv_have_res_getservers=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_save_LIBS" -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_res_getservers" >&5 -printf "%s\n" "$ac_cv_have_res_getservers" >&6; } - if test "$ac_cv_have_res_getservers" = "yes" - then - -printf "%s\n" "#define HAVE_RES_GETSERVERS 1" >>confdefs.h - - fi - fi -fi - -if test "x$with_freetype" != "xno" -then - rm -f conftest.err -if ${FREETYPE_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - FREETYPE_CFLAGS=`$PKG_CONFIG --cflags freetype2 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || FREETYPE_CFLAGS=${FREETYPE_CFLAGS:-`(${FREETYPE_CONFIG:-freetype-config} --cflags || ${FREETYPE2_CONFIG:-freetype2-config} --cflags) 2>/dev/null`} -if ${FREETYPE_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - FREETYPE_LIBS=`$PKG_CONFIG --libs freetype2 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || FREETYPE_LIBS=${FREETYPE_LIBS:-`(${FREETYPE_CONFIG:-freetype-config} --libs || ${FREETYPE2_CONFIG:-freetype2-config} --libs) 2>/dev/null`} -FREETYPE_LIBS=${FREETYPE_LIBS:-"-lfreetype"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: freetype2 cflags: $FREETYPE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: freetype2 libs: $FREETYPE_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: freetype2 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "ft2build.h" "ac_cv_header_ft2build_h" "$ac_includes_default" -if test "x$ac_cv_header_ft2build_h" = xyes -then : - printf "%s\n" "#define HAVE_FT2BUILD_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_ft2build_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lfreetype" >&5 -printf %s "checking for -lfreetype... " >&6; } -if test ${ac_cv_lib_soname_freetype+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lfreetype $FREETYPE_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char FT_Init_FreeType (); -int -main (void) -{ -return FT_Init_FreeType (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_freetype=`$ac_cv_path_LDD conftest.exe | grep "freetype" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_freetype=`$OTOOL -L conftest$ac_exeext | grep "libfreetype\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libfreetype\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_freetype=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libfreetype\\.$LIBEXT" | sed -e "s/^.*\\[\\(libfreetype\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_freetype:+false} : -then : - ac_cv_lib_soname_freetype=`$LDD conftest$ac_exeext | grep "libfreetype\\.$LIBEXT" | sed -e "s/^.*\(libfreetype\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_freetype= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_freetype:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - FREETYPE_LIBS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_freetype" >&5 -printf "%s\n" "$ac_cv_lib_soname_freetype" >&6; } - -printf "%s\n" "#define SONAME_LIBFREETYPE \"$ac_cv_lib_soname_freetype\"" >>confdefs.h - - -printf "%s\n" "#define HAVE_FREETYPE 1" >>confdefs.h - - ac_fn_c_check_type "$LINENO" "FT_TrueTypeEngineType" "ac_cv_type_FT_TrueTypeEngineType" "#include -#include FT_MODULE_H -" -if test "x$ac_cv_type_FT_TrueTypeEngineType" = xyes -then : - -printf "%s\n" "#define HAVE_FT_TRUETYPEENGINETYPE 1" >>confdefs.h - - -fi - -fi - else - FREETYPE_CFLAGS="" - FREETYPE_LIBS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_freetype" = x -then : - case "x$with_freetype" in - xno) ;; - *) as_fn_error $? "FreeType ${notice_platform}development files not found. Fonts will not be built. -Use the --without-freetype option if you really want this." "$LINENO" 5 ;; -esac -enable_fonts=${enable_fonts:-no} -fi - -ac_wine_check_funcs_save_LIBS="$LIBS" -LIBS="$LIBS $PTHREAD_LIBS" -ac_fn_c_check_func "$LINENO" "pthread_getthreadid_np" "ac_cv_func_pthread_getthreadid_np" -if test "x$ac_cv_func_pthread_getthreadid_np" = xyes -then : - printf "%s\n" "#define HAVE_PTHREAD_GETTHREADID_NP 1" >>confdefs.h - -fi - -LIBS="$ac_wine_check_funcs_save_LIBS" - -if test "x$enable_tools" != xno -a "x$with_gettextpo" = xyes -then - if test "$ac_cv_header_gettext_po_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for po_message_msgctxt in -lgettextpo" >&5 -printf %s "checking for po_message_msgctxt in -lgettextpo... " >&6; } -if test ${ac_cv_lib_gettextpo_po_message_msgctxt+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgettextpo $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char po_message_msgctxt (); -int -main (void) -{ -return po_message_msgctxt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_gettextpo_po_message_msgctxt=yes -else $as_nop - ac_cv_lib_gettextpo_po_message_msgctxt=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gettextpo_po_message_msgctxt" >&5 -printf "%s\n" "$ac_cv_lib_gettextpo_po_message_msgctxt" >&6; } -if test "x$ac_cv_lib_gettextpo_po_message_msgctxt" = xyes -then : - -printf "%s\n" "#define HAVE_LIBGETTEXTPO 1" >>confdefs.h - - GETTEXTPO_LIBS="-lgettextpo" - -fi - - fi - if test "x$GETTEXTPO_LIBS" = "x" -then : - case "x$with_gettextpo" in - x) as_fn_append wine_notices "|GetText ${notice_platform}development files not found (or too old), po files can't be rebuilt." ;; - xno) ;; - *) as_fn_error $? "GetText ${notice_platform}development files not found (or too old), po files can't be rebuilt. -This is an error since --with-gettextpo was requested." "$LINENO" 5 ;; -esac - -fi - if test "$srcdir" != . -then : - case "x$with_gettextpo" in - x) as_fn_append wine_notices "|Rebuilding po files is not supported for out of tree builds." ;; - xno) ;; - *) as_fn_error $? "Rebuilding po files is not supported for out of tree builds. -This is an error since --with-gettextpo was requested." "$LINENO" 5 ;; -esac - -fi -fi - -if test "x$with_pulse" != "xno"; -then - rm -f conftest.err -if ${PULSE_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse 2>conftest.err` -fi -fi - -if ${PULSE_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - PULSE_LIBS=`$PKG_CONFIG --libs libpulse 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libpulse cflags: $PULSE_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libpulse libs: $PULSE_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libpulse errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $PULSE_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "pulse/pulseaudio.h" "ac_cv_header_pulse_pulseaudio_h" "$ac_includes_default" -if test "x$ac_cv_header_pulse_pulseaudio_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pa_stream_is_corked in -lpulse" >&5 -printf %s "checking for pa_stream_is_corked in -lpulse... " >&6; } -if test ${ac_cv_lib_pulse_pa_stream_is_corked+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpulse $PULSE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char pa_stream_is_corked (); -int -main (void) -{ -return pa_stream_is_corked (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_pulse_pa_stream_is_corked=yes -else $as_nop - ac_cv_lib_pulse_pa_stream_is_corked=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pulse_pa_stream_is_corked" >&5 -printf "%s\n" "$ac_cv_lib_pulse_pa_stream_is_corked" >&6; } -if test "x$ac_cv_lib_pulse_pa_stream_is_corked" = xyes -then : - : -else $as_nop - PULSE_LIBS="" -fi - -else $as_nop - PULSE_LIBS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test -z "$PULSE_LIBS" -then : - case "x$with_pulse" in - x) as_fn_append wine_notices "|libpulse ${notice_platform}development files not found or too old, Pulse won't be supported." ;; - xno) ;; - *) as_fn_error $? "libpulse ${notice_platform}development files not found or too old, Pulse won't be supported. -This is an error since --with-pulse was requested." "$LINENO" 5 ;; -esac -enable_winepulse_drv=${enable_winepulse_drv:-no} -fi - -if test "x$with_gstreamer" != "xno" -then - rm -f conftest.err -if ${GSTREAMER_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GSTREAMER_CFLAGS=`$PKG_CONFIG --cflags gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 2>conftest.err` -fi -fi - -if ${GSTREAMER_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GSTREAMER_LIBS=`$PKG_CONFIG --libs gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 cflags: $GSTREAMER_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 libs: $GSTREAMER_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $GSTREAMER_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "gst/gst.h" "ac_cv_header_gst_gst_h" "$ac_includes_default" -if test "x$ac_cv_header_gst_gst_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether gint64 defined by gst/gst.h is indeed 64-bit" >&5 -printf %s "checking whether gint64 defined by gst/gst.h is indeed 64-bit... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -static int a[sizeof(gint64) > 4 ? 1 : -1]; if (a[0]) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gst_pad_new in -lgstreamer-1.0" >&5 -printf %s "checking for gst_pad_new in -lgstreamer-1.0... " >&6; } -if test ${ac_cv_lib_gstreamer_1_0_gst_pad_new+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgstreamer-1.0 $GSTREAMER_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gst_pad_new (); -int -main (void) -{ -return gst_pad_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_gstreamer_1_0_gst_pad_new=yes -else $as_nop - ac_cv_lib_gstreamer_1_0_gst_pad_new=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gstreamer_1_0_gst_pad_new" >&5 -printf "%s\n" "$ac_cv_lib_gstreamer_1_0_gst_pad_new" >&6; } -if test "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" = xyes -then : - : -fi - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ac_glib2_broken=yes - enable_winegstreamer=${enable_winegstreamer:-no} - as_fn_append wine_notices "|glib-2.0 pkgconfig configuration is for the wrong architecture, winegstreamer won't be built." -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes -then : - case "x$with_gstreamer" in - x) as_fn_append wine_notices "|gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported." ;; - xno) ;; - *) as_fn_error $? "gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported. -This is an error since --with-gstreamer was requested." "$LINENO" 5 ;; -esac -enable_winegstreamer=${enable_winegstreamer:-no} -fi - -ALSA_LIBS="" - -if test "x$with_alsa" != "xno" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_hw_params_get_access_mask in -lasound" >&5 -printf %s "checking for snd_pcm_hw_params_get_access_mask in -lasound... " >&6; } -if test ${ac_cv_lib_asound_snd_pcm_hw_params_get_access_mask+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lasound $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char snd_pcm_hw_params_get_access_mask (); -int -main (void) -{ -return snd_pcm_hw_params_get_access_mask (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_asound_snd_pcm_hw_params_get_access_mask=yes -else $as_nop - ac_cv_lib_asound_snd_pcm_hw_params_get_access_mask=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_pcm_hw_params_get_access_mask" >&5 -printf "%s\n" "$ac_cv_lib_asound_snd_pcm_hw_params_get_access_mask" >&6; } -if test "x$ac_cv_lib_asound_snd_pcm_hw_params_get_access_mask" = xyes -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -snd_pcm_hw_params_get_access_mask(NULL, NULL) - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ALSA_LIBS="-lasound" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -test -n "$ALSA_LIBS" || enable_winealsa_drv=${enable_winealsa_drv:-no} - -if test "x$with_oss" != xno -then - ac_save_CPPFLAGS="$CPPFLAGS" - if test -f /etc/oss.conf - then - . /etc/oss.conf - fi - ac_oss_incl="-I${OSSLIBDIR:-/usr/lib/oss}/include" - CPPFLAGS="$CPPFLAGS $ac_oss_incl" - ac_fn_c_check_header_compile "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_soundcard_h" = xyes -then : - ac_fn_c_check_member "$LINENO" "oss_sysinfo" "numaudioengines" "ac_cv_member_oss_sysinfo_numaudioengines" "#include -" -if test "x$ac_cv_member_oss_sysinfo_numaudioengines" = xyes -then : - -printf "%s\n" "#define HAVE_OSS_SYSINFO_NUMAUDIOENGINES 1" >>confdefs.h - -OSS4_CFLAGS="$ac_oss_incl" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _oss_ioctl in -lossaudio" >&5 -printf %s "checking for _oss_ioctl in -lossaudio... " >&6; } -if test ${ac_cv_lib_ossaudio__oss_ioctl+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lossaudio $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char _oss_ioctl (); -int -main (void) -{ -return _oss_ioctl (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ossaudio__oss_ioctl=yes -else $as_nop - ac_cv_lib_ossaudio__oss_ioctl=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5 -printf "%s\n" "$ac_cv_lib_ossaudio__oss_ioctl" >&6; } -if test "x$ac_cv_lib_ossaudio__oss_ioctl" = xyes -then : - OSS4_LIBS="-lossaudio" - -fi - -fi - -fi - - CPPFLAGS="$ac_save_CPPFLAGS" -fi -if test "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes -then : - case "x$with_oss" in - x) as_fn_append wine_notices "|OSS sound system found but too old (OSSv4 needed), OSS won't be supported." ;; - xno) ;; - *) as_fn_error $? "OSS sound system found but too old (OSSv4 needed), OSS won't be supported. -This is an error since --with-oss was requested." "$LINENO" 5 ;; -esac -enable_wineoss_drv=${enable_wineoss_drv:-no} -fi - -if test "x$with_udev" != "xno" -then - rm -f conftest.err -if ${UDEV_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - UDEV_CFLAGS=`$PKG_CONFIG --cflags libudev 2>conftest.err` -fi -fi - -if ${UDEV_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - UDEV_LIBS=`$PKG_CONFIG --libs libudev 2>/dev/null` -fi -fi - -UDEV_LIBS=${UDEV_LIBS:-"-ludev"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libudev cflags: $UDEV_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libudev libs: $UDEV_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libudev errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $UDEV_CFLAGS" - for ac_header in libudev.h -do : - ac_fn_c_check_header_compile "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default" -if test "x$ac_cv_header_libudev_h" = xyes -then : - printf "%s\n" "#define HAVE_LIBUDEV_H 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for udev_new in -ludev" >&5 -printf %s "checking for udev_new in -ludev... " >&6; } -if test ${ac_cv_lib_udev_udev_new+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-ludev $UDEV_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char udev_new (); -int -main (void) -{ -return udev_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_udev_udev_new=yes -else $as_nop - ac_cv_lib_udev_udev_new=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_new" >&5 -printf "%s\n" "$ac_cv_lib_udev_udev_new" >&6; } -if test "x$ac_cv_lib_udev_udev_new" = xyes -then : - -printf "%s\n" "#define HAVE_UDEV 1" >>confdefs.h - -else $as_nop - UDEV_LIBS="" -fi - -else $as_nop - UDEV_LIBS="" -fi - -done -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$UDEV_LIBS" = "x" -then : - case "x$with_udev" in - x) as_fn_append wine_notices "|libudev ${notice_platform}development files not found, plug and play won't be supported." ;; - xno) ;; - *) as_fn_error $? "libudev ${notice_platform}development files not found, plug and play won't be supported. -This is an error since --with-udev was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_unwind" != xno -then - rm -f conftest.err -if ${UNWIND_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - UNWIND_CFLAGS=`$PKG_CONFIG --cflags libunwind 2>conftest.err` -fi -fi - -if ${UNWIND_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - UNWIND_LIBS=`$PKG_CONFIG --libs libunwind 2>/dev/null` -fi -fi - -UNWIND_LIBS=${UNWIND_LIBS:-"-lunwind"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libunwind cflags: $UNWIND_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: libunwind libs: $UNWIND_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: libunwind errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $UNWIND_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unw_step" >&5 -printf %s "checking for unw_step... " >&6; } -if test ${wine_cv_have_unw_step+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define UNW_LOCAL_ONLY -#include -int -main (void) -{ -unw_cursor_t cursor; unw_step( &cursor ); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_have_unw_step="yes" -else $as_nop - wine_cv_have_unw_step="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_unw_step" >&5 -printf "%s\n" "$wine_cv_have_unw_step" >&6; } - if test "$wine_cv_have_unw_step" = no -a -n "$UNWIND_LIBS" - then - save_libs=$LIBS - UNWIND_LIBS="-static-libgcc $UNWIND_LIBS" - LIBS="$UNWIND_LIBS $LIBS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unw_step in libunwind" >&5 -printf %s "checking for unw_step in libunwind... " >&6; } -if test ${wine_cv_have_libunwind_unw_step+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define UNW_LOCAL_ONLY -#include -int -main (void) -{ -unw_cursor_t cursor; unw_step( &cursor ); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_have_libunwind_unw_step="yes" -else $as_nop - wine_cv_have_libunwind_unw_step="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_libunwind_unw_step" >&5 -printf "%s\n" "$wine_cv_have_libunwind_unw_step" >&6; } - LIBS=$save_libs - fi - test "$wine_cv_have_libunwind_unw_step" = yes || UNWIND_LIBS="" - if test "x$wine_cv_have_unw_step$wine_cv_have_libunwind_unw_step" != xnono - then - -printf "%s\n" "#define HAVE_LIBUNWIND 1" >>confdefs.h - - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -case $host in - aarch64*|*-darwin*) - if test "x$wine_cv_have_unw_step$wine_cv_have_libunwind_unw_step" = xnono -then : - case "x$with_unwind" in - x) as_fn_append wine_notices "|libunwind ${notice_platform}development files not found, stack unwinding won't work." ;; - xno) ;; - *) as_fn_error $? "libunwind ${notice_platform}development files not found, stack unwinding won't work. -This is an error since --with-unwind was requested." "$LINENO" 5 ;; -esac - -fi ;; -esac - -if test "x$with_sdl" != "xno" -then - rm -f conftest.err -if ${SDL2_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - SDL2_CFLAGS=`$PKG_CONFIG --cflags sdl2 2>conftest.err` -fi -fi - -if ${SDL2_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - SDL2_LIBS=`$PKG_CONFIG --libs sdl2 2>/dev/null` -fi -fi - -SDL2_LIBS=${SDL2_LIBS:-"-lSDL2"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: sdl2 cflags: $SDL2_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: sdl2 libs: $SDL2_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: sdl2 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $SDL2_CFLAGS" - for ac_header in SDL.h -do : - ac_fn_c_check_header_compile "$LINENO" "SDL.h" "ac_cv_header_SDL_h" "$ac_includes_default" -if test "x$ac_cv_header_SDL_h" = xyes -then : - printf "%s\n" "#define HAVE_SDL_H 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lSDL2" >&5 -printf %s "checking for -lSDL2... " >&6; } -if test ${ac_cv_lib_soname_SDL2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lSDL2 $SDL2_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char SDL_Init (); -int -main (void) -{ -return SDL_Init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_SDL2=`$ac_cv_path_LDD conftest.exe | grep "SDL2" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_SDL2=`$OTOOL -L conftest$ac_exeext | grep "libSDL2-2.0*\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libSDL2-2.0*\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_SDL2=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libSDL2-2.0*\\.$LIBEXT" | sed -e "s/^.*\\[\\(libSDL2-2.0*\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_SDL2:+false} : -then : - ac_cv_lib_soname_SDL2=`$LDD conftest$ac_exeext | grep "libSDL2-2.0*\\.$LIBEXT" | sed -e "s/^.*\(libSDL2-2.0*\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_SDL2= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_SDL2:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_SDL2" >&5 -printf "%s\n" "$ac_cv_lib_soname_SDL2" >&6; } - -printf "%s\n" "#define SONAME_LIBSDL2 \"$ac_cv_lib_soname_SDL2\"" >>confdefs.h - - -fi -fi - -done -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_SDL2" = "x" -then : - case "x$with_sdl" in - x) as_fn_append wine_notices "|libSDL2 ${notice_platform}development files not found, SDL2 won't be supported." ;; - xno) ;; - *) as_fn_error $? "libSDL2 ${notice_platform}development files not found, SDL2 won't be supported. -This is an error since --with-sdl was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_capi" != "xno" -then - rm -f conftest.err -if ${CAPI20_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - CAPI20_CFLAGS=`$PKG_CONFIG --cflags capi20 2>conftest.err` -fi -fi - -if ${CAPI20_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - CAPI20_LIBS=`$PKG_CONFIG --libs capi20 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: capi20 cflags: $CAPI20_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: capi20 libs: $CAPI20_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: capi20 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $CAPI20_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "capi20.h" "ac_cv_header_capi20_h" "#define __user -" -if test "x$ac_cv_header_capi20_h" = xyes -then : - printf "%s\n" "#define HAVE_CAPI20_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "linux/capi.h" "ac_cv_header_linux_capi_h" "#define __user -" -if test "x$ac_cv_header_linux_capi_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_CAPI_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_capi20_h" = "yes" -a "$ac_cv_header_linux_capi_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for capi20_register in -lcapi20" >&5 -printf %s "checking for capi20_register in -lcapi20... " >&6; } -if test ${ac_cv_lib_capi20_capi20_register+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcapi20 $CAPI20_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char capi20_register (); -int -main (void) -{ -return capi20_register (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_capi20_capi20_register=yes -else $as_nop - ac_cv_lib_capi20_capi20_register=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_capi20_capi20_register" >&5 -printf "%s\n" "$ac_cv_lib_capi20_capi20_register" >&6; } -if test "x$ac_cv_lib_capi20_capi20_register" = xyes -then : - : -else $as_nop - CAPI20_LIBS="" -fi - - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_capi20_capi20_register" != xyes -then : - case "x$with_capi" in - x) as_fn_append wine_notices "|libcapi20 ${notice_platform}development files not found, ISDN won't be supported." ;; - xno) ;; - *) as_fn_error $? "libcapi20 ${notice_platform}development files not found, ISDN won't be supported. -This is an error since --with-capi was requested." "$LINENO" 5 ;; -esac -enable_capi2032=${enable_capi2032:-no} -fi - -if test "x$with_cups" != "xno" -then - rm -f conftest.err -if ${CUPS_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - CUPS_CFLAGS=`$PKG_CONFIG --cflags cups 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || CUPS_CFLAGS=${CUPS_CFLAGS:-`${CUPS_CONFIG:-cups-config} --cflags 2>/dev/null`} -if ${CUPS_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - CUPS_LIBS=`$PKG_CONFIG --libs cups 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || CUPS_LIBS=${CUPS_LIBS:-`${CUPS_CONFIG:-cups-config} --libs 2>/dev/null`} -CUPS_LIBS=${CUPS_LIBS:-"-lcups"} -printf "%s\n" "$as_me:${as_lineno-$LINENO}: cups cflags: $CUPS_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: cups libs: $CUPS_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: cups errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $CUPS_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "cups/cups.h" "ac_cv_header_cups_cups_h" "$ac_includes_default" -if test "x$ac_cv_header_cups_cups_h" = xyes -then : - printf "%s\n" "#define HAVE_CUPS_CUPS_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "cups/ppd.h" "ac_cv_header_cups_ppd_h" "$ac_includes_default" -if test "x$ac_cv_header_cups_ppd_h" = xyes -then : - printf "%s\n" "#define HAVE_CUPS_PPD_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_cups_cups_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lcups" >&5 -printf %s "checking for -lcups... " >&6; } -if test ${ac_cv_lib_soname_cups+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lcups $CUPS_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char cupsGetDefault (); -int -main (void) -{ -return cupsGetDefault (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_cups=`$ac_cv_path_LDD conftest.exe | grep "cups" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_cups=`$OTOOL -L conftest$ac_exeext | grep "libcups\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libcups\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_cups=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libcups\\.$LIBEXT" | sed -e "s/^.*\\[\\(libcups\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_cups:+false} : -then : - ac_cv_lib_soname_cups=`$LDD conftest$ac_exeext | grep "libcups\\.$LIBEXT" | sed -e "s/^.*\(libcups\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_cups= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_cups:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - CUPS_LIBS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_cups" >&5 -printf "%s\n" "$ac_cv_lib_soname_cups" >&6; } - -printf "%s\n" "#define SONAME_LIBCUPS \"$ac_cv_lib_soname_cups\"" >>confdefs.h - - -fi - else - CUPS_CFLAGS="" - CUPS_LIBS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_cups" = "x" -then : - case "x$with_cups" in - x) as_fn_append wine_notices "|libcups ${notice_platform}development files not found, CUPS won't be supported." ;; - xno) ;; - *) as_fn_error $? "libcups ${notice_platform}development files not found, CUPS won't be supported. -This is an error since --with-cups was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_fontconfig" != "xno" -then - rm -f conftest.err -if ${FONTCONFIG_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags fontconfig 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || FONTCONFIG_CFLAGS=${FONTCONFIG_CFLAGS:-$X_CFLAGS} -if ${FONTCONFIG_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - FONTCONFIG_LIBS=`$PKG_CONFIG --libs fontconfig 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || FONTCONFIG_LIBS=${FONTCONFIG_LIBS:-$X_LIBS} - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: fontconfig cflags: $FONTCONFIG_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: fontconfig libs: $FONTCONFIG_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: fontconfig errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $FONTCONFIG_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "fontconfig/fontconfig.h" "ac_cv_header_fontconfig_fontconfig_h" "$ac_includes_default" -if test "x$ac_cv_header_fontconfig_fontconfig_h" = xyes -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lfontconfig" >&5 -printf %s "checking for -lfontconfig... " >&6; } -if test ${ac_cv_lib_soname_fontconfig+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lfontconfig $FONTCONFIG_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char FcInit (); -int -main (void) -{ -return FcInit (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_fontconfig=`$ac_cv_path_LDD conftest.exe | grep "fontconfig" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_fontconfig=`$OTOOL -L conftest$ac_exeext | grep "libfontconfig\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libfontconfig\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_fontconfig=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libfontconfig\\.$LIBEXT" | sed -e "s/^.*\\[\\(libfontconfig\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_fontconfig:+false} : -then : - ac_cv_lib_soname_fontconfig=`$LDD conftest$ac_exeext | grep "libfontconfig\\.$LIBEXT" | sed -e "s/^.*\(libfontconfig\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_fontconfig= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_fontconfig:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - FONTCONFIG_CFLAGS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_fontconfig" >&5 -printf "%s\n" "$ac_cv_lib_soname_fontconfig" >&6; } - -printf "%s\n" "#define SONAME_LIBFONTCONFIG \"$ac_cv_lib_soname_fontconfig\"" >>confdefs.h - - -fi -else $as_nop - FONTCONFIG_CFLAGS="" -fi - -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_fontconfig" = "x" -then : - case "x$with_fontconfig" in - x) as_fn_append wine_notices "|fontconfig ${notice_platform}development files not found, fontconfig won't be supported." ;; - xno) ;; - *) as_fn_error $? "fontconfig ${notice_platform}development files not found, fontconfig won't be supported. -This is an error since --with-fontconfig was requested." "$LINENO" 5 ;; -esac - -fi - -if test "x$with_krb5" != "xno" -then - rm -f conftest.err -if ${KRB5_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - KRB5_CFLAGS=`$PKG_CONFIG --cflags krb5 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || KRB5_CFLAGS=${KRB5_CFLAGS:-`${KRB5_CONFIG:-krb5-config} --cflags 2>/dev/null`} -if ${KRB5_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - KRB5_LIBS=`$PKG_CONFIG --libs krb5 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || KRB5_LIBS=${KRB5_LIBS:-`${KRB5_CONFIG:-krb5-config} --libs 2>/dev/null`} - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: krb5 cflags: $KRB5_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: krb5 libs: $KRB5_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: krb5 errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $KRB5_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "krb5/krb5.h" "ac_cv_header_krb5_krb5_h" "$ac_includes_default" -if test "x$ac_cv_header_krb5_krb5_h" = xyes -then : - printf "%s\n" "#define HAVE_KRB5_KRB5_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_krb5_krb5_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lkrb5" >&5 -printf %s "checking for -lkrb5... " >&6; } -if test ${ac_cv_lib_soname_krb5+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lkrb5 $KRB5_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char krb5_is_config_principal (); -int -main (void) -{ -return krb5_is_config_principal (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_krb5=`$ac_cv_path_LDD conftest.exe | grep "krb5" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_krb5=`$OTOOL -L conftest$ac_exeext | grep "libkrb5\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libkrb5\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_krb5=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libkrb5\\.$LIBEXT" | sed -e "s/^.*\\[\\(libkrb5\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_krb5:+false} : -then : - ac_cv_lib_soname_krb5=`$LDD conftest$ac_exeext | grep "libkrb5\\.$LIBEXT" | sed -e "s/^.*\(libkrb5\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_krb5= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_krb5:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - KRB5_CFLAGS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_krb5" >&5 -printf "%s\n" "$ac_cv_lib_soname_krb5" >&6; } - -printf "%s\n" "#define SONAME_LIBKRB5 \"$ac_cv_lib_soname_krb5\"" >>confdefs.h - - -fi - else - KRB5_CFLAGS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_krb5" = "x" -then : - case "x$with_krb5" in - x) as_fn_append wine_notices "|libkrb5 ${notice_platform}development files not found (or too old), Kerberos won't be supported." ;; - xno) ;; - *) as_fn_error $? "libkrb5 ${notice_platform}development files not found (or too old), Kerberos won't be supported. -This is an error since --with-krb5 was requested." "$LINENO" 5 ;; -esac - -fi -test "x$ac_cv_lib_soname_krb5" != "x" || with_gssapi=${with_gssapi:-no} - -if test "x$with_gssapi" != "xno" -then - rm -f conftest.err -if ${GSSAPI_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GSSAPI_CFLAGS=`$PKG_CONFIG --cflags krb5-gssapi 2>conftest.err` -fi -fi -test "$cross_compiling" = yes || GSSAPI_CFLAGS=${GSSAPI_CFLAGS:-`${KRB5_CONFIG:-krb5-config} --cflags gssapi 2>/dev/null`} -if ${GSSAPI_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - GSSAPI_LIBS=`$PKG_CONFIG --libs krb5-gssapi 2>/dev/null` -fi -fi -test "$cross_compiling" = yes || GSSAPI_LIBS=${GSSAPI_LIBS:-`${KRB5_CONFIG:-krb5-config} --libs gssapi 2>/dev/null`} - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: krb5-gssapi cflags: $GSSAPI_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: krb5-gssapi libs: $GSSAPI_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: krb5-gssapi errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $GSSAPI_CFLAGS" -ac_fn_c_check_header_compile "$LINENO" "gssapi/gssapi.h" "ac_cv_header_gssapi_gssapi_h" "$ac_includes_default" -if test "x$ac_cv_header_gssapi_gssapi_h" = xyes -then : - printf "%s\n" "#define HAVE_GSSAPI_GSSAPI_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "gssapi/gssapi_ext.h" "ac_cv_header_gssapi_gssapi_ext_h" "$ac_includes_default" -if test "x$ac_cv_header_gssapi_gssapi_ext_h" = xyes -then : - printf "%s\n" "#define HAVE_GSSAPI_GSSAPI_EXT_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_gssapi_gssapi_h" = "yes" -a "$ac_cv_header_gssapi_gssapi_ext_h" = "yes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lgssapi_krb5" >&5 -printf %s "checking for -lgssapi_krb5... " >&6; } -if test ${ac_cv_lib_soname_gssapi_krb5+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lgssapi_krb5 $GSSAPI_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gss_init_sec_context (); -int -main (void) -{ -return gss_init_sec_context (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_gssapi_krb5=`$ac_cv_path_LDD conftest.exe | grep "gssapi_krb5" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_gssapi_krb5=`$OTOOL -L conftest$ac_exeext | grep "libgssapi_krb5\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libgssapi_krb5\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_gssapi_krb5=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libgssapi_krb5\\.$LIBEXT" | sed -e "s/^.*\\[\\(libgssapi_krb5\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_gssapi_krb5:+false} : -then : - ac_cv_lib_soname_gssapi_krb5=`$LDD conftest$ac_exeext | grep "libgssapi_krb5\\.$LIBEXT" | sed -e "s/^.*\(libgssapi_krb5\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_gssapi_krb5= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_gssapi_krb5:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - GSSAPI_CFLAGS="" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_gssapi_krb5" >&5 -printf "%s\n" "$ac_cv_lib_soname_gssapi_krb5" >&6; } - -printf "%s\n" "#define SONAME_LIBGSSAPI_KRB5 \"$ac_cv_lib_soname_gssapi_krb5\"" >>confdefs.h - - -fi - else - GSSAPI_CFLAGS="" - fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_gssapi_krb5" = "x" -then : - case "x$with_gssapi" in - x) as_fn_append wine_notices "|libgssapi_krb5 ${notice_platform}development files not found (or too old), no Kerberos SSP support." ;; - xno) ;; - *) as_fn_error $? "libgssapi_krb5 ${notice_platform}development files not found (or too old), no Kerberos SSP support. -This is an error since --with-gssapi was requested." "$LINENO" 5 ;; -esac - -fi - -if test "$ac_cv_header_libprocstat_h" = "yes" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for procstat_open_sysctl in -lprocstat" >&5 -printf %s "checking for procstat_open_sysctl in -lprocstat... " >&6; } -if test ${ac_cv_lib_procstat_procstat_open_sysctl+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lprocstat $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char procstat_open_sysctl (); -int -main (void) -{ -return procstat_open_sysctl (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_procstat_procstat_open_sysctl=yes -else $as_nop - ac_cv_lib_procstat_procstat_open_sysctl=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_procstat_procstat_open_sysctl" >&5 -printf "%s\n" "$ac_cv_lib_procstat_procstat_open_sysctl" >&6; } -if test "x$ac_cv_lib_procstat_procstat_open_sysctl" = xyes -then : - -printf "%s\n" "#define HAVE_LIBPROCSTAT 1" >>confdefs.h - - PROCSTAT_LIBS="-lprocstat" - -fi - -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lodbc" >&5 -printf %s "checking for -lodbc... " >&6; } -if test ${ac_cv_lib_soname_odbc+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lodbc $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char SQLConnect (); -int -main (void) -{ -return SQLConnect (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_odbc=`$ac_cv_path_LDD conftest.exe | grep "odbc" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_odbc=`$OTOOL -L conftest$ac_exeext | grep "libodbc\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libodbc\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_odbc=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libodbc\\.$LIBEXT" | sed -e "s/^.*\\[\\(libodbc\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_odbc:+false} : -then : - ac_cv_lib_soname_odbc=`$LDD conftest$ac_exeext | grep "libodbc\\.$LIBEXT" | sed -e "s/^.*\(libodbc\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_odbc= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_odbc:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - printf "%s\n" "#define SONAME_LIBODBC \"libodbc.$LIBEXT\"" >>confdefs.h - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_odbc" >&5 -printf "%s\n" "$ac_cv_lib_soname_odbc" >&6; } - -printf "%s\n" "#define SONAME_LIBODBC \"$ac_cv_lib_soname_odbc\"" >>confdefs.h - - -fi - -if test "x$with_netapi" != "xno" -then - rm -f conftest.err -if ${NETAPI_CFLAGS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - NETAPI_CFLAGS=`$PKG_CONFIG --cflags netapi 2>conftest.err` -fi -fi - -if ${NETAPI_LIBS:+false} : -then : - if test ${PKG_CONFIG+y} -then : - NETAPI_LIBS=`$PKG_CONFIG --libs netapi 2>/dev/null` -fi -fi - - -printf "%s\n" "$as_me:${as_lineno-$LINENO}: netapi cflags: $NETAPI_CFLAGS" >&5 -printf "%s\n" "$as_me:${as_lineno-$LINENO}: netapi libs: $NETAPI_LIBS" >&5 -if test -s conftest.err; then - printf %s "$as_me:${as_lineno-$LINENO}: netapi errors: " >&5 - cat conftest.err >&5 -fi -rm -f conftest.err -ac_save_CPPFLAGS=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $NETAPI_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lnetapi" >&5 -printf %s "checking for -lnetapi... " >&6; } -if test ${ac_cv_lib_soname_netapi+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lnetapi $NETAPI_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char libnetapi_init (); -int -main (void) -{ -return libnetapi_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_netapi=`$ac_cv_path_LDD conftest.exe | grep "netapi" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_netapi=`$OTOOL -L conftest$ac_exeext | grep "libnetapi\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libnetapi\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_netapi=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libnetapi\\.$LIBEXT" | sed -e "s/^.*\\[\\(libnetapi\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_netapi:+false} : -then : - ac_cv_lib_soname_netapi=`$LDD conftest$ac_exeext | grep "libnetapi\\.$LIBEXT" | sed -e "s/^.*\(libnetapi\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_netapi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_netapi:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - printf "%s\n" "#define SONAME_LIBNETAPI \"libnetapi.$LIBEXT\"" >>confdefs.h - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_netapi" >&5 -printf "%s\n" "$ac_cv_lib_soname_netapi" >&6; } - -printf "%s\n" "#define SONAME_LIBNETAPI \"$ac_cv_lib_soname_netapi\"" >>confdefs.h - - -fi -CPPFLAGS=$ac_save_CPPFLAGS - -fi -if test "x$ac_cv_lib_soname_netapi" = "x" -then : - case "x$with_netapi" in - x) as_fn_append wine_notices "|libnetapi not found, Samba NetAPI won't be supported." ;; - xno) ;; - *) as_fn_error $? "libnetapi not found, Samba NetAPI won't be supported. -This is an error since --with-netapi was requested." "$LINENO" 5 ;; -esac -enable_netapi=${enable_netapi:-no} -fi - - -if test "x$enable_winealsa_drv$enable_winecoreaudio_drv$enable_winepulse_drv$enable_wineoss_drv$enable_wineandroid_drv" = xnonononono -a \ - "x$with_alsa$with_coreaudio$with_oss$with_pulse" != xnononono -then - as_fn_append wine_warnings "|No sound system was found. Windows applications will be silent." -fi - -if test "x$with_vulkan" != "xno" -then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lvulkan" >&5 -printf %s "checking for -lvulkan... " >&6; } -if test ${ac_cv_lib_soname_vulkan+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lvulkan $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char vkGetInstanceProcAddr (); -int -main (void) -{ -return vkGetInstanceProcAddr (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_vulkan=`$ac_cv_path_LDD conftest.exe | grep "vulkan" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_vulkan=`$OTOOL -L conftest$ac_exeext | grep "libvulkan\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libvulkan\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_vulkan=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libvulkan\\.$LIBEXT" | sed -e "s/^.*\\[\\(libvulkan\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_vulkan:+false} : -then : - ac_cv_lib_soname_vulkan=`$LDD conftest$ac_exeext | grep "libvulkan\\.$LIBEXT" | sed -e "s/^.*\(libvulkan\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_vulkan= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_vulkan:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_vulkan" >&5 -printf "%s\n" "$ac_cv_lib_soname_vulkan" >&6; } - -printf "%s\n" "#define SONAME_LIBVULKAN \"$ac_cv_lib_soname_vulkan\"" >>confdefs.h - - -fi - if test "x$ac_cv_lib_soname_vulkan" = "x" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lMoltenVK" >&5 -printf %s "checking for -lMoltenVK... " >&6; } -if test ${ac_cv_lib_soname_MoltenVK+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_soname_save_LIBS=$LIBS -LIBS="-lMoltenVK $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char vkGetInstanceProcAddr (); -int -main (void) -{ -return vkGetInstanceProcAddr (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - case "$LIBEXT" in - dll) ac_cv_lib_soname_MoltenVK=`$ac_cv_path_LDD conftest.exe | grep "MoltenVK" | sed -e "s/dll.*/dll/"';2,$d'` ;; - dylib) ac_cv_lib_soname_MoltenVK=`$OTOOL -L conftest$ac_exeext | grep "libMoltenVK\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libMoltenVK\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_MoltenVK=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libMoltenVK\\.$LIBEXT" | sed -e "s/^.*\\[\\(libMoltenVK\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'` - if ${ac_cv_lib_soname_MoltenVK:+false} : -then : - ac_cv_lib_soname_MoltenVK=`$LDD conftest$ac_exeext | grep "libMoltenVK\\.$LIBEXT" | sed -e "s/^.*\(libMoltenVK\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` -fi ;; - esac -else $as_nop - ac_cv_lib_soname_MoltenVK= -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if ${ac_cv_lib_soname_MoltenVK:+false} : -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_MoltenVK" >&5 -printf "%s\n" "$ac_cv_lib_soname_MoltenVK" >&6; } - -printf "%s\n" "#define SONAME_LIBMOLTENVK \"$ac_cv_lib_soname_MoltenVK\"" >>confdefs.h - - -fi - fi -fi -if test "x$ac_cv_lib_soname_vulkan" = "x" -a "x$ac_cv_lib_soname_MoltenVK" = "x" -then : - case "x$with_vulkan" in - x) as_fn_append wine_notices "|libvulkan and libMoltenVK ${notice_platform}development files not found, Vulkan won't be supported." ;; - xno) ;; - *) as_fn_error $? "libvulkan and libMoltenVK ${notice_platform}development files not found, Vulkan won't be supported. -This is an error since --with-vulkan was requested." "$LINENO" 5 ;; -esac - -fi - - -if test "x${GCC}" = "xyes" -then - EXTRACFLAGS="$EXTRACFLAGS -Wall -pipe" - - saved_CFLAGS=$CFLAGS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror=unknown-warning-option" >&5 -printf %s "checking whether the compiler supports -Werror=unknown-warning-option... " >&6; } -if test ${ac_cv_cflags__Werror_unknown_warning_option+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Werror=unknown-warning-option" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Werror_unknown_warning_option=yes -else $as_nop - ac_cv_cflags__Werror_unknown_warning_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Werror_unknown_warning_option" >&5 -printf "%s\n" "$ac_cv_cflags__Werror_unknown_warning_option" >&6; } -if test "x$ac_cv_cflags__Werror_unknown_warning_option" = xyes -then : - CFLAGS="$CFLAGS -Werror=unknown-warning-option" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror=unused-command-line-argument" >&5 -printf %s "checking whether the compiler supports -Werror=unused-command-line-argument... " >&6; } -if test ${ac_cv_cflags__Werror_unused_command_line_argument+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Werror=unused-command-line-argument" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Werror_unused_command_line_argument=yes -else $as_nop - ac_cv_cflags__Werror_unused_command_line_argument=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Werror_unused_command_line_argument" >&5 -printf "%s\n" "$ac_cv_cflags__Werror_unused_command_line_argument" >&6; } -if test "x$ac_cv_cflags__Werror_unused_command_line_argument" = xyes -then : - CFLAGS="$CFLAGS -Werror=unused-command-line-argument" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror=ignored-optimization-argument" >&5 -printf %s "checking whether the compiler supports -Werror=ignored-optimization-argument... " >&6; } -if test ${ac_cv_cflags__Werror_ignored_optimization_argument+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Werror=ignored-optimization-argument" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Werror_ignored_optimization_argument=yes -else $as_nop - ac_cv_cflags__Werror_ignored_optimization_argument=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Werror_ignored_optimization_argument" >&5 -printf "%s\n" "$ac_cv_cflags__Werror_ignored_optimization_argument" >&6; } -if test "x$ac_cv_cflags__Werror_ignored_optimization_argument" = xyes -then : - CFLAGS="$CFLAGS -Werror=ignored-optimization-argument" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fcf-protection=none" >&5 -printf %s "checking whether the compiler supports -fcf-protection=none... " >&6; } -if test ${ac_cv_cflags__fcf_protection_none+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fcf-protection=none" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fcf_protection_none=yes -else $as_nop - ac_cv_cflags__fcf_protection_none=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fcf_protection_none" >&5 -printf "%s\n" "$ac_cv_cflags__fcf_protection_none" >&6; } -if test "x$ac_cv_cflags__fcf_protection_none" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -fcf-protection=none" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fvisibility=hidden" >&5 -printf %s "checking whether the compiler supports -fvisibility=hidden... " >&6; } -if test ${ac_cv_cflags__fvisibility_hidden+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fvisibility=hidden" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fvisibility_hidden=yes -else $as_nop - ac_cv_cflags__fvisibility_hidden=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fvisibility_hidden" >&5 -printf "%s\n" "$ac_cv_cflags__fvisibility_hidden" >&6; } -if test "x$ac_cv_cflags__fvisibility_hidden" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -fvisibility=hidden" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-stack-protector" >&5 -printf %s "checking whether the compiler supports -fno-stack-protector... " >&6; } -if test ${ac_cv_cflags__fno_stack_protector+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fno-stack-protector" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fno_stack_protector=yes -else $as_nop - ac_cv_cflags__fno_stack_protector=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fno_stack_protector" >&5 -printf "%s\n" "$ac_cv_cflags__fno_stack_protector" >&6; } -if test "x$ac_cv_cflags__fno_stack_protector" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -fno-stack-protector" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-strict-aliasing" >&5 -printf %s "checking whether the compiler supports -fno-strict-aliasing... " >&6; } -if test ${ac_cv_cflags__fno_strict_aliasing+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fno-strict-aliasing" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fno_strict_aliasing=yes -else $as_nop - ac_cv_cflags__fno_strict_aliasing=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fno_strict_aliasing" >&5 -printf "%s\n" "$ac_cv_cflags__fno_strict_aliasing" >&6; } -if test "x$ac_cv_cflags__fno_strict_aliasing" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -fno-strict-aliasing" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wdeclaration-after-statement" >&5 -printf %s "checking whether the compiler supports -Wdeclaration-after-statement... " >&6; } -if test ${ac_cv_cflags__Wdeclaration_after_statement+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wdeclaration-after-statement" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wdeclaration_after_statement=yes -else $as_nop - ac_cv_cflags__Wdeclaration_after_statement=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wdeclaration_after_statement" >&5 -printf "%s\n" "$ac_cv_cflags__Wdeclaration_after_statement" >&6; } -if test "x$ac_cv_cflags__Wdeclaration_after_statement" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wdeclaration-after-statement" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wempty-body" >&5 -printf %s "checking whether the compiler supports -Wempty-body... " >&6; } -if test ${ac_cv_cflags__Wempty_body+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wempty-body" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wempty_body=yes -else $as_nop - ac_cv_cflags__Wempty_body=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wempty_body" >&5 -printf "%s\n" "$ac_cv_cflags__Wempty_body" >&6; } -if test "x$ac_cv_cflags__Wempty_body" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wempty-body" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wignored-qualifiers" >&5 -printf %s "checking whether the compiler supports -Wignored-qualifiers... " >&6; } -if test ${ac_cv_cflags__Wignored_qualifiers+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wignored-qualifiers" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wignored_qualifiers=yes -else $as_nop - ac_cv_cflags__Wignored_qualifiers=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wignored_qualifiers" >&5 -printf "%s\n" "$ac_cv_cflags__Wignored_qualifiers" >&6; } -if test "x$ac_cv_cflags__Wignored_qualifiers" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wignored-qualifiers" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Winit-self" >&5 -printf %s "checking whether the compiler supports -Winit-self... " >&6; } -if test ${ac_cv_cflags__Winit_self+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Winit-self" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Winit_self=yes -else $as_nop - ac_cv_cflags__Winit_self=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Winit_self" >&5 -printf "%s\n" "$ac_cv_cflags__Winit_self" >&6; } -if test "x$ac_cv_cflags__Winit_self" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Winit-self" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wpacked-not-aligned" >&5 -printf %s "checking whether the compiler supports -Wpacked-not-aligned... " >&6; } -if test ${ac_cv_cflags__Wpacked_not_aligned+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wpacked-not-aligned" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wpacked_not_aligned=yes -else $as_nop - ac_cv_cflags__Wpacked_not_aligned=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wpacked_not_aligned" >&5 -printf "%s\n" "$ac_cv_cflags__Wpacked_not_aligned" >&6; } -if test "x$ac_cv_cflags__Wpacked_not_aligned" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wno-packed-not-aligned" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wpragma-pack" >&5 -printf %s "checking whether the compiler supports -Wpragma-pack... " >&6; } -if test ${ac_cv_cflags__Wpragma_pack+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wpragma-pack" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wpragma_pack=yes -else $as_nop - ac_cv_cflags__Wpragma_pack=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wpragma_pack" >&5 -printf "%s\n" "$ac_cv_cflags__Wpragma_pack" >&6; } -if test "x$ac_cv_cflags__Wpragma_pack" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wno-pragma-pack" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wshift-overflow=2" >&5 -printf %s "checking whether the compiler supports -Wshift-overflow=2... " >&6; } -if test ${ac_cv_cflags__Wshift_overflow_2+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wshift-overflow=2" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wshift_overflow_2=yes -else $as_nop - ac_cv_cflags__Wshift_overflow_2=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wshift_overflow_2" >&5 -printf "%s\n" "$ac_cv_cflags__Wshift_overflow_2" >&6; } -if test "x$ac_cv_cflags__Wshift_overflow_2" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wshift-overflow=2" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wstrict-prototypes" >&5 -printf %s "checking whether the compiler supports -Wstrict-prototypes... " >&6; } -if test ${ac_cv_cflags__Wstrict_prototypes+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wstrict-prototypes" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wstrict_prototypes=yes -else $as_nop - ac_cv_cflags__Wstrict_prototypes=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wstrict_prototypes" >&5 -printf "%s\n" "$ac_cv_cflags__Wstrict_prototypes" >&6; } -if test "x$ac_cv_cflags__Wstrict_prototypes" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wstrict-prototypes" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wtype-limits" >&5 -printf %s "checking whether the compiler supports -Wtype-limits... " >&6; } -if test ${ac_cv_cflags__Wtype_limits+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wtype-limits" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wtype_limits=yes -else $as_nop - ac_cv_cflags__Wtype_limits=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wtype_limits" >&5 -printf "%s\n" "$ac_cv_cflags__Wtype_limits" >&6; } -if test "x$ac_cv_cflags__Wtype_limits" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wtype-limits" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wunused-but-set-parameter" >&5 -printf %s "checking whether the compiler supports -Wunused-but-set-parameter... " >&6; } -if test ${ac_cv_cflags__Wunused_but_set_parameter+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wunused-but-set-parameter" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wunused_but_set_parameter=yes -else $as_nop - ac_cv_cflags__Wunused_but_set_parameter=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wunused_but_set_parameter" >&5 -printf "%s\n" "$ac_cv_cflags__Wunused_but_set_parameter" >&6; } -if test "x$ac_cv_cflags__Wunused_but_set_parameter" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wunused-but-set-parameter" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wvla" >&5 -printf %s "checking whether the compiler supports -Wvla... " >&6; } -if test ${ac_cv_cflags__Wvla+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wvla" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wvla=yes -else $as_nop - ac_cv_cflags__Wvla=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wvla" >&5 -printf "%s\n" "$ac_cv_cflags__Wvla" >&6; } -if test "x$ac_cv_cflags__Wvla" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wvla" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wwrite-strings" >&5 -printf %s "checking whether the compiler supports -Wwrite-strings... " >&6; } -if test ${ac_cv_cflags__Wwrite_strings+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wwrite-strings" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wwrite_strings=yes -else $as_nop - ac_cv_cflags__Wwrite_strings=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wwrite_strings" >&5 -printf "%s\n" "$ac_cv_cflags__Wwrite_strings" >&6; } -if test "x$ac_cv_cflags__Wwrite_strings" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wwrite-strings" -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wpointer-arith" >&5 -printf %s "checking whether the compiler supports -Wpointer-arith... " >&6; } -if test ${ac_cv_cflags__Wpointer_arith+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wpointer-arith" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wpointer_arith=yes -else $as_nop - ac_cv_cflags__Wpointer_arith=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wpointer_arith" >&5 -printf "%s\n" "$ac_cv_cflags__Wpointer_arith" >&6; } -if test "x$ac_cv_cflags__Wpointer_arith" = xyes -then : - saved_string_h_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Wpointer-arith -Werror" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wpointer-arith" >&5 -printf %s "checking for broken string.h that generates warnings with -Wpointer-arith... " >&6; } -if test ${ac_cv_c_string_h_warnings+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_c_string_h_warnings=no -else $as_nop - ac_cv_c_string_h_warnings=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_string_h_warnings" >&5 -printf "%s\n" "$ac_cv_c_string_h_warnings" >&6; } - test "$ac_cv_c_string_h_warnings" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith" - CFLAGS=$saved_string_h_CFLAGS -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wlogical-op" >&5 -printf %s "checking whether the compiler supports -Wlogical-op... " >&6; } -if test ${ac_cv_cflags__Wlogical_op+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wlogical-op" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wlogical_op=yes -else $as_nop - ac_cv_cflags__Wlogical_op=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wlogical_op" >&5 -printf "%s\n" "$ac_cv_cflags__Wlogical_op" >&6; } -if test "x$ac_cv_cflags__Wlogical_op" = xyes -then : - saved_string_h_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Wlogical-op -Werror" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wlogical-op" >&5 -printf %s "checking for broken string.h that generates warnings with -Wlogical-op... " >&6; } -if test ${ac_cv_c_logicalop_noisy+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -char*f(const char *h,char n) {return strchr(h,n);} -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_c_logicalop_noisy=no -else $as_nop - ac_cv_c_logicalop_noisy=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_logicalop_noisy" >&5 -printf "%s\n" "$ac_cv_c_logicalop_noisy" >&6; } - CFLAGS=$saved_string_h_CFLAGS - test "$ac_cv_c_logicalop_noisy" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op" -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for flags needed for 64-bit compare-and-swap support" >&5 -printf %s "checking for flags needed for 64-bit compare-and-swap support... " >&6; } -if test ${wine_cv_64bit_compare_swap+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 -#error no -#endif -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - wine_cv_64bit_compare_swap="none needed" -else $as_nop - case $HOST_ARCH in - i386) wine_cv_64bit_compare_swap="-march=i586" ;; - arm) wine_cv_64bit_compare_swap="-march=armv7-a" ;; - *) wine_cv_64bit_compare_swap="unknown" ;; - esac - if test "x$wine_cv_64bit_compare_swap" != xunknown - then - CFLAGS="$CFLAGS $wine_cv_64bit_compare_swap" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 -#error no -#endif -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - wine_cv_64bit_compare_swap="unknown" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_64bit_compare_swap" >&5 -printf "%s\n" "$wine_cv_64bit_compare_swap" >&6; } - case "$wine_cv_64bit_compare_swap" in - unknown) as_fn_error $? "gcc doesn't support 64-bit compare-and-swap on this platform" "$LINENO" 5 ;; - "none needed") ;; - *) EXTRACFLAGS="$EXTRACFLAGS $wine_cv_64bit_compare_swap" ;; - esac - - ac_debug_format_seen="" - for ac_flag in $CFLAGS; do - case $ac_flag in - -gdwarf*) ac_debug_format_seen=yes ;; - -g) ac_debug_format_seen=${ac_debug_format_seen:-default} ;; - esac - done - if test "x$ac_debug_format_seen" = xdefault - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -gdwarf-4" >&5 -printf %s "checking whether the compiler supports -gdwarf-4... " >&6; } -if test ${ac_cv_cflags__gdwarf_4+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -gdwarf-4" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__gdwarf_4=yes -else $as_nop - ac_cv_cflags__gdwarf_4=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__gdwarf_4" >&5 -printf "%s\n" "$ac_cv_cflags__gdwarf_4" >&6; } -if test "x$ac_cv_cflags__gdwarf_4" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -gdwarf-4" -fi - fi - - MSVCRTFLAGS="" - - case $host_os in - mingw32*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-delayload,autoconftest.dll" >&5 -printf %s "checking whether the compiler supports -Wl,-delayload,autoconftest.dll... " >&6; } -if test ${ac_cv_cflags__Wl__delayload_autoconftest_dll+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,-delayload,autoconftest.dll" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl__delayload_autoconftest_dll=yes -else $as_nop - ac_cv_cflags__Wl__delayload_autoconftest_dll=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__delayload_autoconftest_dll" >&5 -printf "%s\n" "$ac_cv_cflags__Wl__delayload_autoconftest_dll" >&6; } -if test "x$ac_cv_cflags__Wl__delayload_autoconftest_dll" = xyes -then : - DELAYLOADFLAG="-Wl,-delayload," - -fi ;; - *) MSVCRTFLAGS="-D_WIN32" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-builtin" >&5 -printf %s "checking whether the compiler supports -fno-builtin... " >&6; } -if test ${ac_cv_cflags__fno_builtin+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fno-builtin" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fno_builtin=yes -else $as_nop - ac_cv_cflags__fno_builtin=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fno_builtin" >&5 -printf "%s\n" "$ac_cv_cflags__fno_builtin" >&6; } -if test "x$ac_cv_cflags__fno_builtin" = xyes -then : - MSVCRTFLAGS="$MSVCRTFLAGS -fno-builtin" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fshort-wchar" >&5 -printf %s "checking whether the compiler supports -fshort-wchar... " >&6; } -if test ${ac_cv_cflags__fshort_wchar+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fshort-wchar" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fshort_wchar=yes -else $as_nop - ac_cv_cflags__fshort_wchar=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fshort_wchar" >&5 -printf "%s\n" "$ac_cv_cflags__fshort_wchar" >&6; } -if test "x$ac_cv_cflags__fshort_wchar" = xyes -then : - MSVCRTFLAGS="$MSVCRTFLAGS -fshort-wchar" -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wno-format" >&5 -printf %s "checking whether the compiler supports -Wno-format... " >&6; } -if test ${ac_cv_cflags__Wno_format+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wno-format" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wno_format=yes -else $as_nop - ac_cv_cflags__Wno_format=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wno_format" >&5 -printf "%s\n" "$ac_cv_cflags__Wno_format" >&6; } -if test "x$ac_cv_cflags__Wno_format" = xyes -then : - MSVCRTFLAGS="$MSVCRTFLAGS -Wno-format" -fi ;; - esac - - case $HOST_ARCH in - i386) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-omit-frame-pointer" >&5 -printf %s "checking whether the compiler supports -fno-omit-frame-pointer... " >&6; } -if test ${ac_cv_cflags__fno_omit_frame_pointer+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -fno-omit-frame-pointer" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__fno_omit_frame_pointer=yes -else $as_nop - ac_cv_cflags__fno_omit_frame_pointer=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fno_omit_frame_pointer" >&5 -printf "%s\n" "$ac_cv_cflags__fno_omit_frame_pointer" >&6; } -if test "x$ac_cv_cflags__fno_omit_frame_pointer" = xyes -then : - MSVCRTFLAGS="$MSVCRTFLAGS -fno-omit-frame-pointer" -fi ;; - x86_64) - case $host_os in - cygwin*|mingw32*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wno-format" >&5 -printf %s "checking whether the compiler supports -Wno-format... " >&6; } -if test ${ac_cv_cflags__Wno_format+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wno-format" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wno_format=yes -else $as_nop - ac_cv_cflags__Wno_format=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wno_format" >&5 -printf "%s\n" "$ac_cv_cflags__Wno_format" >&6; } -if test "x$ac_cv_cflags__Wno_format" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wno-format" -fi ;; - *) if test -z "$PE_ARCHS" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -mabi=ms" >&5 -printf %s "checking for working -mabi=ms... " >&6; } -if test ${ac_cv_mabi_ms+y} -then : - printf %s "(cached) " >&6 -else $as_nop - CFLAGS="$CFLAGS -mabi=ms" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int a(int b, ...) { __builtin_ms_va_list list; __builtin_ms_va_start(list,b); } -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_mabi_ms=yes -else $as_nop - ac_cv_mabi_ms=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mabi_ms" >&5 -printf "%s\n" "$ac_cv_mabi_ms" >&6; } - test $ac_cv_mabi_ms = yes || as_fn_error $? "The compiler doesn't support -mabi=ms. Use gcc instead of clang, or install mingw-w64." "$LINENO" 5 - fi - MSVCRTFLAGS="$MSVCRTFLAGS -mabi=ms" ;; - esac ;; - arm) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wincompatible-function-pointer-types" >&5 -printf %s "checking whether the compiler supports -Wincompatible-function-pointer-types... " >&6; } -if test ${ac_cv_cflags__Wincompatible_function_pointer_types+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wincompatible-function-pointer-types" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wincompatible_function_pointer_types=yes -else $as_nop - ac_cv_cflags__Wincompatible_function_pointer_types=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wincompatible_function_pointer_types" >&5 -printf "%s\n" "$ac_cv_cflags__Wincompatible_function_pointer_types" >&6; } -if test "x$ac_cv_cflags__Wincompatible_function_pointer_types" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Wno-error=incompatible-function-pointer-types" -fi ;; - esac - - CFLAGS=$saved_CFLAGS - - if test "x$enable_werror" = "xyes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror" >&5 -printf %s "checking whether the compiler supports -Werror... " >&6; } -if test ${ac_cv_cflags__Werror+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Werror" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Werror=yes -else $as_nop - ac_cv_cflags__Werror=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Werror" >&5 -printf "%s\n" "$ac_cv_cflags__Werror" >&6; } -if test "x$ac_cv_cflags__Werror" = xyes -then : - EXTRACFLAGS="$EXTRACFLAGS -Werror" -fi - fi - if test "x$enable_build_id" = "xyes" - then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,--build-id" >&5 -printf %s "checking whether the compiler supports -Wl,--build-id... " >&6; } -if test ${ac_cv_cflags__Wl___build_id+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_wine_try_cflags_saved=$CFLAGS -CFLAGS="$CFLAGS -Wl,--build-id" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main(int argc, char **argv) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_cflags__Wl___build_id=yes -else $as_nop - ac_cv_cflags__Wl___build_id=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -CFLAGS=$ac_wine_try_cflags_saved -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl___build_id" >&5 -printf "%s\n" "$ac_cv_cflags__Wl___build_id" >&6; } -if test "x$ac_cv_cflags__Wl___build_id" = xyes -then : - CFLAGS="$CFLAGS -Wl,--build-id" - LDFLAGS="$LDFLAGS -Wl,--build-id" -fi - fi -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the need to disable Fortify" >&5 -printf %s "checking for the need to disable Fortify... " >&6; } -if test ${ac_cv_c_fortify_enabled+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -#if (defined(__USE_FORTIFY_LEVEL) && __USE_FORTIFY_LEVEL > 0) || (defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0) -#error Fortify enabled -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_c_fortify_enabled=no -else $as_nop - ac_cv_c_fortify_enabled=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_fortify_enabled" >&5 -printf "%s\n" "$ac_cv_c_fortify_enabled" >&6; } -if test "$ac_cv_c_fortify_enabled" = yes -then - CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether CFI directives are supported in assembly code" >&5 -printf %s "checking whether CFI directives are supported in assembly code... " >&6; } -if test ${ac_cv_c_cfi_support+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -asm(".text\nac_test:\t.cfi_startproc\n\t.long 0\n\t.cfi_endproc"); -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_c_cfi_support="yes" -else $as_nop - ac_cv_c_cfi_support="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_cfi_support" >&5 -printf "%s\n" "$ac_cv_c_cfi_support" >&6; } -if test "$ac_cv_c_cfi_support" = "yes" -then - DLLFLAGS="$DLLFLAGS -fasynchronous-unwind-tables" - LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables" - UNIXDLLFLAGS="$UNIXDLLFLAGS -fasynchronous-unwind-tables" -elif test $HOST_ARCH = x86_64 -then - as_fn_append wine_warnings "|building 64-bit Wine without support for CFI directives; exception handling will not work properly." -fi - - -case "$HOST_ARCH,$PE_ARCHS" in - x86_64,*i386*) wine_binary="wine" ;; - x86_64,*) wine_binary="wine64" ;; - *) wine_binary="wine" ;; -esac -WINELOADER_PROGRAMS="$wine_binary" - - -case $host_os in - linux*) - if test $HOST_ARCH != unknown - then - test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine-preloader" - WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader" - fi - ;; - darwin*|macosx*) - if test "$wine_can_build_preloader" = "yes" - then - test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine-preloader" - WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader" - fi - ;; -esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -printf %s "checking for library containing dlopen... " >&6; } -if test ${ac_cv_search_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main (void) -{ -return dlopen (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dl -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_dlopen=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_dlopen+y} -then : - break -fi -done -if test ${ac_cv_search_dlopen+y} -then : - -else $as_nop - ac_cv_search_dlopen=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -printf "%s\n" "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 -printf %s "checking for library containing gethostbyname... " >&6; } -if test ${ac_cv_search_gethostbyname+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -int -main (void) -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_gethostbyname=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_gethostbyname+y} -then : - break -fi -done -if test ${ac_cv_search_gethostbyname+y} -then : - -else $as_nop - ac_cv_search_gethostbyname=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 -printf "%s\n" "$ac_cv_search_gethostbyname" >&6; } -ac_res=$ac_cv_search_gethostbyname -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5 -printf %s "checking for library containing connect... " >&6; } -if test ${ac_cv_search_connect+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char connect (); -int -main (void) -{ -return connect (); - ; - return 0; -} -_ACEOF -for ac_lib in '' socket -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_connect=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_connect+y} -then : - break -fi -done -if test ${ac_cv_search_connect+y} -then : - -else $as_nop - ac_cv_search_connect=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5 -printf "%s\n" "$ac_cv_search_connect" >&6; } -ac_res=$ac_cv_search_connect -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing inet_aton" >&5 -printf %s "checking for library containing inet_aton... " >&6; } -if test ${ac_cv_search_inet_aton+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char inet_aton (); -int -main (void) -{ -return inet_aton (); - ; - return 0; -} -_ACEOF -for ac_lib in '' resolv -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_inet_aton=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_inet_aton+y} -then : - break -fi -done -if test ${ac_cv_search_inet_aton+y} -then : - -else $as_nop - ac_cv_search_inet_aton=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_aton" >&5 -printf "%s\n" "$ac_cv_search_inet_aton" >&6; } -ac_res=$ac_cv_search_inet_aton -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - -ac_save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $BUILTINFLAG" -ac_fn_c_check_func "$LINENO" "dladdr1" "ac_cv_func_dladdr1" -if test "x$ac_cv_func_dladdr1" = xyes -then : - printf "%s\n" "#define HAVE_DLADDR1 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "dlinfo" "ac_cv_func_dlinfo" -if test "x$ac_cv_func_dlinfo" = xyes -then : - printf "%s\n" "#define HAVE_DLINFO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "epoll_create" "ac_cv_func_epoll_create" -if test "x$ac_cv_func_epoll_create" = xyes -then : - printf "%s\n" "#define HAVE_EPOLL_CREATE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" -if test "x$ac_cv_func_fstatfs" = xyes -then : - printf "%s\n" "#define HAVE_FSTATFS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "futimens" "ac_cv_func_futimens" -if test "x$ac_cv_func_futimens" = xyes -then : - printf "%s\n" "#define HAVE_FUTIMENS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "futimes" "ac_cv_func_futimes" -if test "x$ac_cv_func_futimes" = xyes -then : - printf "%s\n" "#define HAVE_FUTIMES 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "futimesat" "ac_cv_func_futimesat" -if test "x$ac_cv_func_futimesat" = xyes -then : - printf "%s\n" "#define HAVE_FUTIMESAT 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" -if test "x$ac_cv_func_getaddrinfo" = xyes -then : - printf "%s\n" "#define HAVE_GETADDRINFO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getattrlist" "ac_cv_func_getattrlist" -if test "x$ac_cv_func_getattrlist" = xyes -then : - printf "%s\n" "#define HAVE_GETATTRLIST 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getauxval" "ac_cv_func_getauxval" -if test "x$ac_cv_func_getauxval" = xyes -then : - printf "%s\n" "#define HAVE_GETAUXVAL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getifaddrs" "ac_cv_func_getifaddrs" -if test "x$ac_cv_func_getifaddrs" = xyes -then : - printf "%s\n" "#define HAVE_GETIFADDRS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getrandom" "ac_cv_func_getrandom" -if test "x$ac_cv_func_getrandom" = xyes -then : - printf "%s\n" "#define HAVE_GETRANDOM 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "kqueue" "ac_cv_func_kqueue" -if test "x$ac_cv_func_kqueue" = xyes -then : - printf "%s\n" "#define HAVE_KQUEUE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "mach_continuous_time" "ac_cv_func_mach_continuous_time" -if test "x$ac_cv_func_mach_continuous_time" = xyes -then : - printf "%s\n" "#define HAVE_MACH_CONTINUOUS_TIME 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" -if test "x$ac_cv_func_pipe2" = xyes -then : - printf "%s\n" "#define HAVE_PIPE2 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "port_create" "ac_cv_func_port_create" -if test "x$ac_cv_func_port_create" = xyes -then : - printf "%s\n" "#define HAVE_PORT_CREATE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "posix_fadvise" "ac_cv_func_posix_fadvise" -if test "x$ac_cv_func_posix_fadvise" = xyes -then : - printf "%s\n" "#define HAVE_POSIX_FADVISE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "posix_fallocate" "ac_cv_func_posix_fallocate" -if test "x$ac_cv_func_posix_fallocate" = xyes -then : - printf "%s\n" "#define HAVE_POSIX_FALLOCATE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "prctl" "ac_cv_func_prctl" -if test "x$ac_cv_func_prctl" = xyes -then : - printf "%s\n" "#define HAVE_PRCTL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "proc_pidinfo" "ac_cv_func_proc_pidinfo" -if test "x$ac_cv_func_proc_pidinfo" = xyes -then : - printf "%s\n" "#define HAVE_PROC_PIDINFO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sched_yield" "ac_cv_func_sched_yield" -if test "x$ac_cv_func_sched_yield" = xyes -then : - printf "%s\n" "#define HAVE_SCHED_YIELD 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "setproctitle" "ac_cv_func_setproctitle" -if test "x$ac_cv_func_setproctitle" = xyes -then : - printf "%s\n" "#define HAVE_SETPROCTITLE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "setprogname" "ac_cv_func_setprogname" -if test "x$ac_cv_func_setprogname" = xyes -then : - printf "%s\n" "#define HAVE_SETPROGNAME 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" -if test "x$ac_cv_func_sigprocmask" = xyes -then : - printf "%s\n" "#define HAVE_SIGPROCMASK 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sysinfo" "ac_cv_func_sysinfo" -if test "x$ac_cv_func_sysinfo" = xyes -then : - printf "%s\n" "#define HAVE_SYSINFO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "tcdrain" "ac_cv_func_tcdrain" -if test "x$ac_cv_func_tcdrain" = xyes -then : - printf "%s\n" "#define HAVE_TCDRAIN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "thr_kill2" "ac_cv_func_thr_kill2" -if test "x$ac_cv_func_thr_kill2" = xyes -then : - printf "%s\n" "#define HAVE_THR_KILL2 1" >>confdefs.h - -fi - -CFLAGS="$ac_save_CFLAGS" - -case $host_os in - darwin*|macosx*) ;; - *) ac_save_LIBS=$LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 -printf %s "checking for library containing clock_gettime... " >&6; } -if test ${ac_cv_search_clock_gettime+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char clock_gettime (); -int -main (void) -{ -return clock_gettime (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_clock_gettime=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_clock_gettime+y} -then : - break -fi -done -if test ${ac_cv_search_clock_gettime+y} -then : - -else $as_nop - ac_cv_search_clock_gettime=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 -printf "%s\n" "$ac_cv_search_clock_gettime" >&6; } -ac_res=$ac_cv_search_clock_gettime -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h - - test "$ac_res" = "none required" || RT_LIBS="$ac_res" - -fi - - LIBS=$ac_save_LIBS - ;; -esac - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_setaffinity" >&5 -printf %s "checking for sched_setaffinity... " >&6; } -if test ${wine_cv_have_sched_setaffinity+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -sched_setaffinity(0, 0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_have_sched_setaffinity=yes -else $as_nop - wine_cv_have_sched_setaffinity=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_sched_setaffinity" >&5 -printf "%s\n" "$wine_cv_have_sched_setaffinity" >&6; } -if test "$wine_cv_have_sched_setaffinity" = "yes" -then - -printf "%s\n" "#define HAVE_SCHED_SETAFFINITY 1" >>confdefs.h - -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -printf %s "checking for inline... " >&6; } -if test ${ac_cv_c_inline+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo (void) {return 0; } -$ac_kw foo_t foo (void) {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -printf "%s\n" "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -ac_fn_c_check_type "$LINENO" "request_sense" "ac_cv_type_request_sense" "#include -" -if test "x$ac_cv_type_request_sense" = xyes -then : - -printf "%s\n" "#define HAVE_REQUEST_SENSE 1" >>confdefs.h - - -fi - - -ac_fn_c_check_type "$LINENO" "struct xinpgen" "ac_cv_type_struct_xinpgen" "#include -#include -#ifdef HAVE_SYS_SOCKETVAR_H -#include -#endif -#ifdef HAVE_NET_ROUTE_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif -#ifdef HAVE_NETINET_IP_H -#include -#endif -#ifdef HAVE_NETINET_IN_PCB_H -#include -#endif -" -if test "x$ac_cv_type_struct_xinpgen" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_XINPGEN 1" >>confdefs.h - - -fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we can use re-entrant gethostbyname_r Linux style" >&5 -printf %s "checking whether we can use re-entrant gethostbyname_r Linux style... " >&6; } -if test ${wine_cv_linux_gethostbyname_r_6+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - char *name=0; - struct hostent he; - struct hostent *result; - char *buf=0; - int bufsize=0; - int errnr; - char *addr=0; - int addrlen=0; - int addrtype=0; - gethostbyname_r(name,&he,buf,bufsize,&result,&errnr); - gethostbyaddr_r(addr, addrlen, addrtype,&he,buf,bufsize,&result,&errnr); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - wine_cv_linux_gethostbyname_r_6=yes -else $as_nop - wine_cv_linux_gethostbyname_r_6=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_linux_gethostbyname_r_6" >&5 -printf "%s\n" "$wine_cv_linux_gethostbyname_r_6" >&6; } - if test "$wine_cv_linux_gethostbyname_r_6" = "yes" - then - -printf "%s\n" "#define HAVE_LINUX_GETHOSTBYNAME_R_6 1" >>confdefs.h - - fi - -ac_fn_c_check_member "$LINENO" "struct msghdr" "msg_accrights" "ac_cv_member_struct_msghdr_msg_accrights" "#include -#include -#ifdef HAVE_SYS_UN_H -# include -#endif -" -if test "x$ac_cv_member_struct_msghdr_msg_accrights" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct sockaddr_un" "sun_len" "ac_cv_member_struct_sockaddr_un_sun_len" "#include -#include -#ifdef HAVE_SYS_UN_H -# include -#endif -" -if test "x$ac_cv_member_struct_sockaddr_un_sun_len" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_SOCKADDR_UN_SUN_LEN 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "scsireq_t" "cmd" "ac_cv_member_scsireq_t_cmd" "#include -#ifdef HAVE_SCSI_SG_H -#include -#endif -" -if test "x$ac_cv_member_scsireq_t_cmd" = xyes -then : - -printf "%s\n" "#define HAVE_SCSIREQ_T_CMD 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "sg_io_hdr_t" "interface_id" "ac_cv_member_sg_io_hdr_t_interface_id" "#include -#ifdef HAVE_SCSI_SG_H -#include -#endif -" -if test "x$ac_cv_member_sg_io_hdr_t_interface_id" = xyes -then : - -printf "%s\n" "#define HAVE_SG_IO_HDR_T_INTERFACE_ID 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "siginfo_t" "si_fd" "ac_cv_member_siginfo_t_si_fd" "#include -" -if test "x$ac_cv_member_siginfo_t_si_fd" = xyes -then : - -printf "%s\n" "#define HAVE_SIGINFO_T_SI_FD 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct mtget" "mt_blksiz" "ac_cv_member_struct_mtget_mt_blksiz" "#include -#ifdef HAVE_SYS_MTIO_H -#include -#endif -" -if test "x$ac_cv_member_struct_mtget_mt_blksiz" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_MTGET_MT_BLKSIZ 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct mtget" "mt_gstat" "ac_cv_member_struct_mtget_mt_gstat" "#include -#ifdef HAVE_SYS_MTIO_H -#include -#endif -" -if test "x$ac_cv_member_struct_mtget_mt_gstat" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_MTGET_MT_GSTAT 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct mtget" "mt_blkno" "ac_cv_member_struct_mtget_mt_blkno" "#include -#ifdef HAVE_SYS_MTIO_H -#include -#endif -" -if test "x$ac_cv_member_struct_mtget_mt_blkno" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_MTGET_MT_BLKNO 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_mtim" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIM 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec" "ac_cv_member_struct_stat_st_mtimespec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIMESPEC 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_ctim" "ac_cv_member_struct_stat_st_ctim" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_ctim" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_CTIM 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_ctimespec" "ac_cv_member_struct_stat_st_ctimespec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_ctimespec" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_CTIMESPEC 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_atim" "ac_cv_member_struct_stat_st_atim" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_atim" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec" "ac_cv_member_struct_stat_st_atimespec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_atimespec" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMESPEC 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim" "ac_cv_member_struct_stat_st_birthtim" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtim" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIM 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec" "ac_cv_member_struct_stat_st_birthtimespec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtimespec" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "__st_birthtime" "ac_cv_member_struct_stat___st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat___st_birthtime" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT___ST_BIRTHTIME 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "__st_birthtim" "ac_cv_member_struct_stat___st_birthtim" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat___st_birthtim" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_STAT___ST_BIRTHTIM 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_scope_id" "ac_cv_member_struct_sockaddr_in6_sin6_scope_id" "#include -#ifdef HAVE_NETINET_IN_H -#include -#endif -" -if test "x$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct __res_state" "_u._ext.nscount6" "ac_cv_member_struct___res_state__u__ext_nscount6" "#ifdef HAVE_RESOLV_H -#include -#endif -" -if test "x$ac_cv_member_struct___res_state__u__ext_nscount6" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT___RES_STATE__U__EXT_NSCOUNT6 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct in6_pktinfo" "ipi6_addr" "ac_cv_member_struct_in6_pktinfo_ipi6_addr" "#ifdef HAVE_NETINET_IN_H -#include -#endif -" -if test "x$ac_cv_member_struct_in6_pktinfo_ipi6_addr" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct ipstat" "ips_total" "ac_cv_member_struct_ipstat_ips_total" "#include -#ifdef HAVE_SYS_SOCKETVAR_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_IP_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_ipstat_ips_total" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_IPSTAT_IPS_TOTAL 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct ip_stats" "ips_total" "ac_cv_member_struct_ip_stats_ips_total" "#ifdef HAVE_NETINET_IP_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_ip_stats_ips_total" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_IP_STATS_IPS_TOTAL 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct ip6stat" "ip6s_total" "ac_cv_member_struct_ip6stat_ip6s_total" "#include -#ifdef HAVE_SYS_SOCKETVAR_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET6_IP6_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_ip6stat_ip6s_total" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_IP6STAT_IP6S_TOTAL 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct icmpstat" "icps_error" "ac_cv_member_struct_icmpstat_icps_error" "#include -#ifdef HAVE_SYS_SOCKETVAR_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_IP_H -#include -#endif -#ifdef HAVE_NETINET_IP_ICMP_H -#include -#endif -#ifdef HAVE_NETINET_ICMP_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_icmpstat_icps_error" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_ICMPSTAT_ICPS_ERROR 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct icmp6stat" "icp6s_error" "ac_cv_member_struct_icmp6stat_icp6s_error" "#include -#ifdef HAVE_SYS_SOCKETVAR_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_ICMP6_H -#include -#endif -" -if test "x$ac_cv_member_struct_icmp6stat_icp6s_error" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_ICMP6STAT_ICP6S_ERROR 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct tcpstat" "tcps_connattempt" "ac_cv_member_struct_tcpstat_tcps_connattempt" "#include -#ifdef HAVE_SYS_SOCKETVAR_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_TCP_H -#include -#endif -#ifdef HAVE_NETINET_TCP_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_tcpstat_tcps_connattempt" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_TCPSTAT_TCPS_CONNATTEMPT 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct tcp_stats" "tcps_connattempt" "ac_cv_member_struct_tcp_stats_tcps_connattempt" "#ifdef HAVE_NETINET_TCP_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_tcp_stats_tcps_connattempt" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_TCP_STATS_TCPS_CONNATTEMPT 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct udpstat" "udps_ipackets" "ac_cv_member_struct_udpstat_udps_ipackets" "#include -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_IP_VAR_H -#include -#endif -#ifdef HAVE_NETINET_UDP_H -#include -#endif -#ifdef HAVE_NETINET_UDP_VAR_H -#include -#endif -" -if test "x$ac_cv_member_struct_udpstat_udps_ipackets" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_UDPSTAT_UDPS_IPACKETS 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_hwaddr" "ac_cv_member_struct_ifreq_ifr_hwaddr" "#include -#ifdef HAVE_NET_IF_H -# include -#endif -" -if test "x$ac_cv_member_struct_ifreq_ifr_hwaddr" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_IFREQ_IFR_HWADDR 1" >>confdefs.h - - -fi - - -ac_fn_c_check_member "$LINENO" "struct sysinfo" "totalram" "ac_cv_member_struct_sysinfo_totalram" "#ifdef HAVE_SYS_SYSINFO_H -# include -#endif -" -if test "x$ac_cv_member_struct_sysinfo_totalram" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_SYSINFO_TOTALRAM 1" >>confdefs.h - - -fi -ac_fn_c_check_member "$LINENO" "struct sysinfo" "mem_unit" "ac_cv_member_struct_sysinfo_mem_unit" "#ifdef HAVE_SYS_SYSINFO_H -# include -#endif -" -if test "x$ac_cv_member_struct_sysinfo_mem_unit" = xyes -then : - -printf "%s\n" "#define HAVE_STRUCT_SYSINFO_MEM_UNIT 1" >>confdefs.h - - -fi - - -LIBS="$ac_save_LIBS" - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5 -printf %s "checking for __builtin_popcount... " >&6; } -if test ${ac_cv_have___builtin_popcount+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return __builtin_popcount(1) - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_have___builtin_popcount="yes" -else $as_nop - ac_cv_have___builtin_popcount="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___builtin_popcount" >&5 -printf "%s\n" "$ac_cv_have___builtin_popcount" >&6; } -if test "$ac_cv_have___builtin_popcount" = "yes" -then - -printf "%s\n" "#define HAVE___BUILTIN_POPCOUNT 1" >>confdefs.h - -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __clear_cache" >&5 -printf %s "checking for __clear_cache... " >&6; } -if test ${ac_cv_have___clear_cache+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -__clear_cache((void*)0, (void*)0); return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_have___clear_cache="yes" -else $as_nop - ac_cv_have___clear_cache="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___clear_cache" >&5 -printf "%s\n" "$ac_cv_have___clear_cache" >&6; } -if test "$ac_cv_have___clear_cache" = "yes" -then - -printf "%s\n" "#define HAVE___CLEAR_CACHE 1" >>confdefs.h - -fi - - -case $host_cpu in - *i[3456789]86*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __i386__" >&5 -printf %s "checking whether we need to define __i386__... " >&6; } -if test ${ac_cv_cpp_def___i386__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __i386__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___i386__=yes -else $as_nop - ac_cv_cpp_def___i386__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___i386__" >&5 -printf "%s\n" "$ac_cv_cpp_def___i386__" >&6; } -if test "x$ac_cv_cpp_def___i386__" = xyes -then : - CFLAGS="$CFLAGS -D__i386__" - LINTFLAGS="$LINTFLAGS -D__i386__" -fi ;; - *x86_64*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __x86_64__" >&5 -printf %s "checking whether we need to define __x86_64__... " >&6; } -if test ${ac_cv_cpp_def___x86_64__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __x86_64__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___x86_64__=yes -else $as_nop - ac_cv_cpp_def___x86_64__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___x86_64__" >&5 -printf "%s\n" "$ac_cv_cpp_def___x86_64__" >&6; } -if test "x$ac_cv_cpp_def___x86_64__" = xyes -then : - CFLAGS="$CFLAGS -D__x86_64__" - LINTFLAGS="$LINTFLAGS -D__x86_64__" -fi ;; - *sparc64*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __sparc64__" >&5 -printf %s "checking whether we need to define __sparc64__... " >&6; } -if test ${ac_cv_cpp_def___sparc64__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __sparc64__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___sparc64__=yes -else $as_nop - ac_cv_cpp_def___sparc64__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___sparc64__" >&5 -printf "%s\n" "$ac_cv_cpp_def___sparc64__" >&6; } -if test "x$ac_cv_cpp_def___sparc64__" = xyes -then : - CFLAGS="$CFLAGS -D__sparc64__" - LINTFLAGS="$LINTFLAGS -D__sparc64__" -fi ;; - *sparc*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __sparc__" >&5 -printf %s "checking whether we need to define __sparc__... " >&6; } -if test ${ac_cv_cpp_def___sparc__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __sparc__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___sparc__=yes -else $as_nop - ac_cv_cpp_def___sparc__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___sparc__" >&5 -printf "%s\n" "$ac_cv_cpp_def___sparc__" >&6; } -if test "x$ac_cv_cpp_def___sparc__" = xyes -then : - CFLAGS="$CFLAGS -D__sparc__" - LINTFLAGS="$LINTFLAGS -D__sparc__" -fi ;; - *powerpc64*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __powerpc64__" >&5 -printf %s "checking whether we need to define __powerpc64__... " >&6; } -if test ${ac_cv_cpp_def___powerpc64__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __powerpc64__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___powerpc64__=yes -else $as_nop - ac_cv_cpp_def___powerpc64__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___powerpc64__" >&5 -printf "%s\n" "$ac_cv_cpp_def___powerpc64__" >&6; } -if test "x$ac_cv_cpp_def___powerpc64__" = xyes -then : - CFLAGS="$CFLAGS -D__powerpc64__" - LINTFLAGS="$LINTFLAGS -D__powerpc64__" -fi ;; - *powerpc*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __powerpc__" >&5 -printf %s "checking whether we need to define __powerpc__... " >&6; } -if test ${ac_cv_cpp_def___powerpc__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __powerpc__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___powerpc__=yes -else $as_nop - ac_cv_cpp_def___powerpc__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___powerpc__" >&5 -printf "%s\n" "$ac_cv_cpp_def___powerpc__" >&6; } -if test "x$ac_cv_cpp_def___powerpc__" = xyes -then : - CFLAGS="$CFLAGS -D__powerpc__" - LINTFLAGS="$LINTFLAGS -D__powerpc__" -fi ;; - *aarch64*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __aarch64__" >&5 -printf %s "checking whether we need to define __aarch64__... " >&6; } -if test ${ac_cv_cpp_def___aarch64__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __aarch64__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___aarch64__=yes -else $as_nop - ac_cv_cpp_def___aarch64__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___aarch64__" >&5 -printf "%s\n" "$ac_cv_cpp_def___aarch64__" >&6; } -if test "x$ac_cv_cpp_def___aarch64__" = xyes -then : - CFLAGS="$CFLAGS -D__aarch64__" - LINTFLAGS="$LINTFLAGS -D__aarch64__" -fi ;; - *arm*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __arm__" >&5 -printf %s "checking whether we need to define __arm__... " >&6; } -if test ${ac_cv_cpp_def___arm__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __arm__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___arm__=yes -else $as_nop - ac_cv_cpp_def___arm__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___arm__" >&5 -printf "%s\n" "$ac_cv_cpp_def___arm__" >&6; } -if test "x$ac_cv_cpp_def___arm__" = xyes -then : - CFLAGS="$CFLAGS -D__arm__" - LINTFLAGS="$LINTFLAGS -D__arm__" -fi ;; -esac - -case $host_vendor in - *sun*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to define __sun__" >&5 -printf %s "checking whether we need to define __sun__... " >&6; } -if test ${ac_cv_cpp_def___sun__+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __sun__ -yes -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 -then : - ac_cv_cpp_def___sun__=yes -else $as_nop - ac_cv_cpp_def___sun__=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_def___sun__" >&5 -printf "%s\n" "$ac_cv_cpp_def___sun__" >&6; } -if test "x$ac_cv_cpp_def___sun__" = xyes -then : - CFLAGS="$CFLAGS -D__sun__" - LINTFLAGS="$LINTFLAGS -D__sun__" -fi ;; -esac - - - - - -ac_config_commands="$ac_config_commands include/stamp-h" - -printf %s "creating Makefile rules..." >&6 - -makedep_flags="" -test "x$enable_silent_rules" = xyes && makedep_flags="$makedep_flags -S" - -wine_srcdir= -test "$srcdir" = . || wine_srcdir="$srcdir/" - -ac_config_links="$ac_config_links wine:tools/winewrapper" -wine_fn_config_symlink wine -if test "$wine_binary" = wine64 -o -n "$with_wine64"; then -ac_config_links="$ac_config_links wine64:tools/winewrapper" -wine_fn_config_symlink wine64 -fi - -wine_fn_config_makefile dlls/acledit enable_acledit -wine_fn_config_makefile dlls/aclui enable_aclui -wine_fn_config_makefile dlls/activeds.tlb enable_activeds_tlb -wine_fn_config_makefile dlls/activeds enable_activeds -wine_fn_config_makefile dlls/activeds/tests enable_tests -wine_fn_config_makefile dlls/actxprxy enable_actxprxy -wine_fn_config_makefile dlls/adsldp enable_adsldp -wine_fn_config_makefile dlls/adsldp/tests enable_tests -wine_fn_config_makefile dlls/adsldpc enable_adsldpc -wine_fn_config_makefile dlls/advapi32 enable_advapi32 -wine_fn_config_makefile dlls/advapi32/tests enable_tests -wine_fn_config_makefile dlls/advpack enable_advpack -wine_fn_config_makefile dlls/advpack/tests enable_tests -wine_fn_config_makefile dlls/amsi enable_amsi -wine_fn_config_makefile dlls/amstream enable_amstream -wine_fn_config_makefile dlls/amstream/tests enable_tests -wine_fn_config_makefile dlls/apisetschema enable_apisetschema -wine_fn_config_makefile dlls/apphelp enable_apphelp -wine_fn_config_makefile dlls/apphelp/tests enable_tests -wine_fn_config_makefile dlls/appwiz.cpl enable_appwiz_cpl -wine_fn_config_makefile dlls/appxdeploymentclient enable_appxdeploymentclient -wine_fn_config_makefile dlls/atl enable_atl -wine_fn_config_makefile dlls/atl/tests enable_tests -wine_fn_config_makefile dlls/atl100 enable_atl100 -wine_fn_config_makefile dlls/atl100/tests enable_tests -wine_fn_config_makefile dlls/atl110 enable_atl110 -wine_fn_config_makefile dlls/atl110/tests enable_tests -wine_fn_config_makefile dlls/atl80 enable_atl80 -wine_fn_config_makefile dlls/atl80/tests enable_tests -wine_fn_config_makefile dlls/atl90 enable_atl90 -wine_fn_config_makefile dlls/atlthunk enable_atlthunk -wine_fn_config_makefile dlls/atlthunk/tests enable_tests -wine_fn_config_makefile dlls/atmlib enable_atmlib -wine_fn_config_makefile dlls/authz enable_authz -wine_fn_config_makefile dlls/avicap32 enable_avicap32 -wine_fn_config_makefile dlls/avifil32 enable_avifil32 -wine_fn_config_makefile dlls/avifil32/tests enable_tests -wine_fn_config_makefile dlls/avifile.dll16 enable_win16 -wine_fn_config_makefile dlls/avrt enable_avrt -wine_fn_config_makefile dlls/bcrypt enable_bcrypt -wine_fn_config_makefile dlls/bcrypt/tests enable_tests -wine_fn_config_makefile dlls/bcryptprimitives enable_bcryptprimitives -wine_fn_config_makefile dlls/bluetoothapis enable_bluetoothapis -wine_fn_config_makefile dlls/browseui enable_browseui -wine_fn_config_makefile dlls/browseui/tests enable_tests -wine_fn_config_makefile dlls/bthprops.cpl enable_bthprops_cpl -wine_fn_config_makefile dlls/cabinet enable_cabinet -wine_fn_config_makefile dlls/cabinet/tests enable_tests -wine_fn_config_makefile dlls/capi2032 enable_capi2032 -wine_fn_config_makefile dlls/cards enable_cards -wine_fn_config_makefile dlls/cdosys enable_cdosys -wine_fn_config_makefile dlls/cfgmgr32 enable_cfgmgr32 -wine_fn_config_makefile dlls/cfgmgr32/tests enable_tests -wine_fn_config_makefile dlls/clusapi enable_clusapi -wine_fn_config_makefile dlls/cng.sys enable_cng_sys -wine_fn_config_makefile dlls/combase enable_combase -wine_fn_config_makefile dlls/combase/tests enable_tests -wine_fn_config_makefile dlls/comcat enable_comcat -wine_fn_config_makefile dlls/comcat/tests enable_tests -wine_fn_config_makefile dlls/comctl32 enable_comctl32 -wine_fn_config_makefile dlls/comctl32/tests enable_tests -wine_fn_config_makefile dlls/comdlg32 enable_comdlg32 -wine_fn_config_makefile dlls/comdlg32/tests enable_tests -wine_fn_config_makefile dlls/coml2 enable_coml2 -wine_fn_config_makefile dlls/comm.drv16 enable_win16 -wine_fn_config_makefile dlls/commdlg.dll16 enable_win16 -wine_fn_config_makefile dlls/compobj.dll16 enable_win16 -wine_fn_config_makefile dlls/compstui enable_compstui -wine_fn_config_makefile dlls/compstui/tests enable_tests -wine_fn_config_makefile dlls/comsvcs enable_comsvcs -wine_fn_config_makefile dlls/comsvcs/tests enable_tests -wine_fn_config_makefile dlls/concrt140 enable_concrt140 -wine_fn_config_makefile dlls/concrt140/tests enable_tests -wine_fn_config_makefile dlls/connect enable_connect -wine_fn_config_makefile dlls/credui enable_credui -wine_fn_config_makefile dlls/credui/tests enable_tests -wine_fn_config_makefile dlls/crtdll enable_crtdll -wine_fn_config_makefile dlls/crypt32 enable_crypt32 -wine_fn_config_makefile dlls/crypt32/tests enable_tests -wine_fn_config_makefile dlls/cryptdlg enable_cryptdlg -wine_fn_config_makefile dlls/cryptdll enable_cryptdll -wine_fn_config_makefile dlls/cryptext enable_cryptext -wine_fn_config_makefile dlls/cryptnet enable_cryptnet -wine_fn_config_makefile dlls/cryptnet/tests enable_tests -wine_fn_config_makefile dlls/cryptowinrt enable_cryptowinrt -wine_fn_config_makefile dlls/cryptowinrt/tests enable_tests -wine_fn_config_makefile dlls/cryptsp enable_cryptsp -wine_fn_config_makefile dlls/cryptui enable_cryptui -wine_fn_config_makefile dlls/cryptui/tests enable_tests -wine_fn_config_makefile dlls/ctapi32 enable_ctapi32 -wine_fn_config_makefile dlls/ctl3d.dll16 enable_win16 -wine_fn_config_makefile dlls/ctl3d32 enable_ctl3d32 -wine_fn_config_makefile dlls/ctl3dv2.dll16 enable_win16 -wine_fn_config_makefile dlls/d2d1 enable_d2d1 -wine_fn_config_makefile dlls/d2d1/tests enable_tests -wine_fn_config_makefile dlls/d3d10 enable_d3d10 -wine_fn_config_makefile dlls/d3d10/tests enable_tests -wine_fn_config_makefile dlls/d3d10_1 enable_d3d10_1 -wine_fn_config_makefile dlls/d3d10_1/tests enable_tests -wine_fn_config_makefile dlls/d3d10core enable_d3d10core -wine_fn_config_makefile dlls/d3d10core/tests enable_tests -wine_fn_config_makefile dlls/d3d11 enable_d3d11 -wine_fn_config_makefile dlls/d3d11/tests enable_tests -wine_fn_config_makefile dlls/d3d12 enable_d3d12 -wine_fn_config_makefile dlls/d3d12/tests enable_tests -wine_fn_config_makefile dlls/d3d12core enable_d3d12core -wine_fn_config_makefile dlls/d3d8 enable_d3d8 -wine_fn_config_makefile dlls/d3d8/tests enable_tests -wine_fn_config_makefile dlls/d3d8thk enable_d3d8thk -wine_fn_config_makefile dlls/d3d9 enable_d3d9 -wine_fn_config_makefile dlls/d3d9/tests enable_tests -wine_fn_config_makefile dlls/d3dcompiler_33 enable_d3dcompiler_33 -wine_fn_config_makefile dlls/d3dcompiler_34 enable_d3dcompiler_34 -wine_fn_config_makefile dlls/d3dcompiler_35 enable_d3dcompiler_35 -wine_fn_config_makefile dlls/d3dcompiler_36 enable_d3dcompiler_36 -wine_fn_config_makefile dlls/d3dcompiler_37 enable_d3dcompiler_37 -wine_fn_config_makefile dlls/d3dcompiler_38 enable_d3dcompiler_38 -wine_fn_config_makefile dlls/d3dcompiler_39 enable_d3dcompiler_39 -wine_fn_config_makefile dlls/d3dcompiler_40 enable_d3dcompiler_40 -wine_fn_config_makefile dlls/d3dcompiler_41 enable_d3dcompiler_41 -wine_fn_config_makefile dlls/d3dcompiler_42 enable_d3dcompiler_42 -wine_fn_config_makefile dlls/d3dcompiler_43 enable_d3dcompiler_43 -wine_fn_config_makefile dlls/d3dcompiler_43/tests enable_tests -wine_fn_config_makefile dlls/d3dcompiler_46 enable_d3dcompiler_46 -wine_fn_config_makefile dlls/d3dcompiler_46/tests enable_tests -wine_fn_config_makefile dlls/d3dcompiler_47 enable_d3dcompiler_47 -wine_fn_config_makefile dlls/d3dcompiler_47/tests enable_tests -wine_fn_config_makefile dlls/d3dim enable_d3dim -wine_fn_config_makefile dlls/d3dim700 enable_d3dim700 -wine_fn_config_makefile dlls/d3drm enable_d3drm -wine_fn_config_makefile dlls/d3drm/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_33 enable_d3dx10_33 -wine_fn_config_makefile dlls/d3dx10_34 enable_d3dx10_34 -wine_fn_config_makefile dlls/d3dx10_34/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_35 enable_d3dx10_35 -wine_fn_config_makefile dlls/d3dx10_35/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_36 enable_d3dx10_36 -wine_fn_config_makefile dlls/d3dx10_36/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_37 enable_d3dx10_37 -wine_fn_config_makefile dlls/d3dx10_37/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_38 enable_d3dx10_38 -wine_fn_config_makefile dlls/d3dx10_38/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_39 enable_d3dx10_39 -wine_fn_config_makefile dlls/d3dx10_39/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_40 enable_d3dx10_40 -wine_fn_config_makefile dlls/d3dx10_40/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_41 enable_d3dx10_41 -wine_fn_config_makefile dlls/d3dx10_41/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_42 enable_d3dx10_42 -wine_fn_config_makefile dlls/d3dx10_42/tests enable_tests -wine_fn_config_makefile dlls/d3dx10_43 enable_d3dx10_43 -wine_fn_config_makefile dlls/d3dx10_43/tests enable_tests -wine_fn_config_makefile dlls/d3dx11_42 enable_d3dx11_42 -wine_fn_config_makefile dlls/d3dx11_42/tests enable_tests -wine_fn_config_makefile dlls/d3dx11_43 enable_d3dx11_43 -wine_fn_config_makefile dlls/d3dx11_43/tests enable_tests -wine_fn_config_makefile dlls/d3dx9_24 enable_d3dx9_24 -wine_fn_config_makefile dlls/d3dx9_25 enable_d3dx9_25 -wine_fn_config_makefile dlls/d3dx9_26 enable_d3dx9_26 -wine_fn_config_makefile dlls/d3dx9_27 enable_d3dx9_27 -wine_fn_config_makefile dlls/d3dx9_28 enable_d3dx9_28 -wine_fn_config_makefile dlls/d3dx9_29 enable_d3dx9_29 -wine_fn_config_makefile dlls/d3dx9_30 enable_d3dx9_30 -wine_fn_config_makefile dlls/d3dx9_31 enable_d3dx9_31 -wine_fn_config_makefile dlls/d3dx9_32 enable_d3dx9_32 -wine_fn_config_makefile dlls/d3dx9_33 enable_d3dx9_33 -wine_fn_config_makefile dlls/d3dx9_34 enable_d3dx9_34 -wine_fn_config_makefile dlls/d3dx9_35 enable_d3dx9_35 -wine_fn_config_makefile dlls/d3dx9_36 enable_d3dx9_36 -wine_fn_config_makefile dlls/d3dx9_36/tests enable_tests -wine_fn_config_makefile dlls/d3dx9_37 enable_d3dx9_37 -wine_fn_config_makefile dlls/d3dx9_38 enable_d3dx9_38 -wine_fn_config_makefile dlls/d3dx9_39 enable_d3dx9_39 -wine_fn_config_makefile dlls/d3dx9_40 enable_d3dx9_40 -wine_fn_config_makefile dlls/d3dx9_41 enable_d3dx9_41 -wine_fn_config_makefile dlls/d3dx9_42 enable_d3dx9_42 -wine_fn_config_makefile dlls/d3dx9_43 enable_d3dx9_43 -wine_fn_config_makefile dlls/d3dxof enable_d3dxof -wine_fn_config_makefile dlls/d3dxof/tests enable_tests -wine_fn_config_makefile dlls/davclnt enable_davclnt -wine_fn_config_makefile dlls/dbgeng enable_dbgeng -wine_fn_config_makefile dlls/dbgeng/tests enable_tests -wine_fn_config_makefile dlls/dbghelp enable_dbghelp -wine_fn_config_makefile dlls/dbghelp/tests enable_tests -wine_fn_config_makefile dlls/dciman32 enable_dciman32 -wine_fn_config_makefile dlls/dcomp enable_dcomp -wine_fn_config_makefile dlls/ddeml.dll16 enable_win16 -wine_fn_config_makefile dlls/ddraw enable_ddraw -wine_fn_config_makefile dlls/ddraw/tests enable_tests -wine_fn_config_makefile dlls/ddrawex enable_ddrawex -wine_fn_config_makefile dlls/ddrawex/tests enable_tests -wine_fn_config_makefile dlls/devenum enable_devenum -wine_fn_config_makefile dlls/devenum/tests enable_tests -wine_fn_config_makefile dlls/dhcpcsvc enable_dhcpcsvc -wine_fn_config_makefile dlls/dhcpcsvc/tests enable_tests -wine_fn_config_makefile dlls/dhcpcsvc6 enable_dhcpcsvc6 -wine_fn_config_makefile dlls/dhtmled.ocx enable_dhtmled_ocx -wine_fn_config_makefile dlls/diasymreader enable_diasymreader -wine_fn_config_makefile dlls/difxapi enable_difxapi -wine_fn_config_makefile dlls/dinput enable_dinput -wine_fn_config_makefile dlls/dinput/tests enable_tests -wine_fn_config_makefile dlls/dinput8 enable_dinput8 -wine_fn_config_makefile dlls/directmanipulation enable_directmanipulation -wine_fn_config_makefile dlls/directmanipulation/tests enable_tests -wine_fn_config_makefile dlls/dispdib.dll16 enable_win16 -wine_fn_config_makefile dlls/dispex enable_dispex -wine_fn_config_makefile dlls/dispex/tests enable_tests -wine_fn_config_makefile dlls/display.drv16 enable_win16 -wine_fn_config_makefile dlls/dmband enable_dmband -wine_fn_config_makefile dlls/dmband/tests enable_tests -wine_fn_config_makefile dlls/dmcompos enable_dmcompos -wine_fn_config_makefile dlls/dmcompos/tests enable_tests -wine_fn_config_makefile dlls/dmime enable_dmime -wine_fn_config_makefile dlls/dmime/tests enable_tests -wine_fn_config_makefile dlls/dmloader enable_dmloader -wine_fn_config_makefile dlls/dmloader/tests enable_tests -wine_fn_config_makefile dlls/dmscript enable_dmscript -wine_fn_config_makefile dlls/dmscript/tests enable_tests -wine_fn_config_makefile dlls/dmstyle enable_dmstyle -wine_fn_config_makefile dlls/dmstyle/tests enable_tests -wine_fn_config_makefile dlls/dmsynth enable_dmsynth -wine_fn_config_makefile dlls/dmsynth/tests enable_tests -wine_fn_config_makefile dlls/dmusic enable_dmusic -wine_fn_config_makefile dlls/dmusic/tests enable_tests -wine_fn_config_makefile dlls/dmusic32 enable_dmusic32 -wine_fn_config_makefile dlls/dnsapi enable_dnsapi -wine_fn_config_makefile dlls/dnsapi/tests enable_tests -wine_fn_config_makefile dlls/dplay enable_dplay -wine_fn_config_makefile dlls/dplayx enable_dplayx -wine_fn_config_makefile dlls/dplayx/tests enable_tests -wine_fn_config_makefile dlls/dpnaddr enable_dpnaddr -wine_fn_config_makefile dlls/dpnet enable_dpnet -wine_fn_config_makefile dlls/dpnet/tests enable_tests -wine_fn_config_makefile dlls/dpnhpast enable_dpnhpast -wine_fn_config_makefile dlls/dpnhupnp enable_dpnhupnp -wine_fn_config_makefile dlls/dpnlobby enable_dpnlobby -wine_fn_config_makefile dlls/dpvoice enable_dpvoice -wine_fn_config_makefile dlls/dpvoice/tests enable_tests -wine_fn_config_makefile dlls/dpwsockx enable_dpwsockx -wine_fn_config_makefile dlls/drmclien enable_drmclien -wine_fn_config_makefile dlls/dsdmo enable_dsdmo -wine_fn_config_makefile dlls/dsdmo/tests enable_tests -wine_fn_config_makefile dlls/dsound enable_dsound -wine_fn_config_makefile dlls/dsound/tests enable_tests -wine_fn_config_makefile dlls/dsquery enable_dsquery -wine_fn_config_makefile dlls/dssenh enable_dssenh -wine_fn_config_makefile dlls/dssenh/tests enable_tests -wine_fn_config_makefile dlls/dsuiext enable_dsuiext -wine_fn_config_makefile dlls/dswave enable_dswave -wine_fn_config_makefile dlls/dswave/tests enable_tests -wine_fn_config_makefile dlls/dwmapi enable_dwmapi -wine_fn_config_makefile dlls/dwmapi/tests enable_tests -wine_fn_config_makefile dlls/dwrite enable_dwrite -wine_fn_config_makefile dlls/dwrite/tests enable_tests -wine_fn_config_makefile dlls/dx8vb enable_dx8vb -wine_fn_config_makefile dlls/dxcore enable_dxcore -wine_fn_config_makefile dlls/dxdiagn enable_dxdiagn -wine_fn_config_makefile dlls/dxdiagn/tests enable_tests -wine_fn_config_makefile dlls/dxgi enable_dxgi -wine_fn_config_makefile dlls/dxgi/tests enable_tests -wine_fn_config_makefile dlls/dxtrans enable_dxtrans -wine_fn_config_makefile dlls/dxva2 enable_dxva2 -wine_fn_config_makefile dlls/dxva2/tests enable_tests -wine_fn_config_makefile dlls/esent enable_esent -wine_fn_config_makefile dlls/evr enable_evr -wine_fn_config_makefile dlls/evr/tests enable_tests -wine_fn_config_makefile dlls/explorerframe enable_explorerframe -wine_fn_config_makefile dlls/explorerframe/tests enable_tests -wine_fn_config_makefile dlls/faultrep enable_faultrep -wine_fn_config_makefile dlls/faultrep/tests enable_tests -wine_fn_config_makefile dlls/feclient enable_feclient -wine_fn_config_makefile dlls/fltlib enable_fltlib -wine_fn_config_makefile dlls/fltmgr.sys enable_fltmgr_sys -wine_fn_config_makefile dlls/fntcache enable_fntcache -wine_fn_config_makefile dlls/fontsub enable_fontsub -wine_fn_config_makefile dlls/fusion enable_fusion -wine_fn_config_makefile dlls/fusion/tests enable_tests -wine_fn_config_makefile dlls/fwpuclnt enable_fwpuclnt -wine_fn_config_makefile dlls/gameux enable_gameux -wine_fn_config_makefile dlls/gameux/tests enable_tests -wine_fn_config_makefile dlls/gamingtcui enable_gamingtcui -wine_fn_config_makefile dlls/gdi.exe16 enable_win16 -wine_fn_config_makefile dlls/gdi32 enable_gdi32 -wine_fn_config_makefile dlls/gdi32/tests enable_tests -wine_fn_config_makefile dlls/gdiplus enable_gdiplus -wine_fn_config_makefile dlls/gdiplus/tests enable_tests -wine_fn_config_makefile dlls/geolocation enable_geolocation -wine_fn_config_makefile dlls/geolocation/tests enable_tests -wine_fn_config_makefile dlls/glu32 enable_glu32 -wine_fn_config_makefile dlls/gphoto2.ds enable_gphoto2_ds -wine_fn_config_makefile dlls/gpkcsp enable_gpkcsp -wine_fn_config_makefile dlls/graphicscapture enable_graphicscapture -wine_fn_config_makefile dlls/graphicscapture/tests enable_tests -wine_fn_config_makefile dlls/hal enable_hal -wine_fn_config_makefile dlls/hhctrl.ocx enable_hhctrl_ocx -wine_fn_config_makefile dlls/hid enable_hid -wine_fn_config_makefile dlls/hid/tests enable_tests -wine_fn_config_makefile dlls/hidclass.sys enable_hidclass_sys -wine_fn_config_makefile dlls/hidparse.sys enable_hidparse_sys -wine_fn_config_makefile dlls/hlink enable_hlink -wine_fn_config_makefile dlls/hlink/tests enable_tests -wine_fn_config_makefile dlls/hnetcfg enable_hnetcfg -wine_fn_config_makefile dlls/hnetcfg/tests enable_tests -wine_fn_config_makefile dlls/hrtfapo enable_hrtfapo -wine_fn_config_makefile dlls/http.sys enable_http_sys -wine_fn_config_makefile dlls/httpapi enable_httpapi -wine_fn_config_makefile dlls/httpapi/tests enable_tests -wine_fn_config_makefile dlls/hvsimanagementapi enable_hvsimanagementapi -wine_fn_config_makefile dlls/hvsimanagementapi/tests enable_tests -wine_fn_config_makefile dlls/ia2comproxy enable_ia2comproxy -wine_fn_config_makefile dlls/iccvid enable_iccvid -wine_fn_config_makefile dlls/icmp enable_icmp -wine_fn_config_makefile dlls/ieframe enable_ieframe -wine_fn_config_makefile dlls/ieframe/tests enable_tests -wine_fn_config_makefile dlls/ieproxy enable_ieproxy -wine_fn_config_makefile dlls/ifsmgr.vxd enable_win16 -wine_fn_config_makefile dlls/imaadp32.acm enable_imaadp32_acm -wine_fn_config_makefile dlls/imagehlp enable_imagehlp -wine_fn_config_makefile dlls/imagehlp/tests enable_tests -wine_fn_config_makefile dlls/imm.dll16 enable_win16 -wine_fn_config_makefile dlls/imm32 enable_imm32 -wine_fn_config_makefile dlls/imm32/tests enable_tests -wine_fn_config_makefile dlls/inetcomm enable_inetcomm -wine_fn_config_makefile dlls/inetcomm/tests enable_tests -wine_fn_config_makefile dlls/inetcpl.cpl enable_inetcpl_cpl -wine_fn_config_makefile dlls/inetmib1 enable_inetmib1 -wine_fn_config_makefile dlls/inetmib1/tests enable_tests -wine_fn_config_makefile dlls/infosoft enable_infosoft -wine_fn_config_makefile dlls/infosoft/tests enable_tests -wine_fn_config_makefile dlls/initpki enable_initpki -wine_fn_config_makefile dlls/inkobj enable_inkobj -wine_fn_config_makefile dlls/inseng enable_inseng -wine_fn_config_makefile dlls/iphlpapi enable_iphlpapi -wine_fn_config_makefile dlls/iphlpapi/tests enable_tests -wine_fn_config_makefile dlls/iprop enable_iprop -wine_fn_config_makefile dlls/ir50_32 enable_ir50_32 -wine_fn_config_makefile dlls/irprops.cpl enable_irprops_cpl -wine_fn_config_makefile dlls/itircl enable_itircl -wine_fn_config_makefile dlls/itss enable_itss -wine_fn_config_makefile dlls/itss/tests enable_tests -wine_fn_config_makefile dlls/joy.cpl enable_joy_cpl -wine_fn_config_makefile dlls/jscript enable_jscript -wine_fn_config_makefile dlls/jscript/tests enable_tests -wine_fn_config_makefile dlls/jsproxy enable_jsproxy -wine_fn_config_makefile dlls/jsproxy/tests enable_tests -wine_fn_config_makefile dlls/kerberos enable_kerberos -wine_fn_config_makefile dlls/kernel32 enable_kernel32 -wine_fn_config_makefile dlls/kernel32/tests enable_tests -wine_fn_config_makefile dlls/kernelbase enable_kernelbase -wine_fn_config_makefile dlls/kernelbase/tests enable_tests -wine_fn_config_makefile dlls/keyboard.drv16 enable_win16 -wine_fn_config_makefile dlls/krnl386.exe16 enable_win16 -wine_fn_config_makefile dlls/ksecdd.sys enable_ksecdd_sys -wine_fn_config_makefile dlls/ksproxy.ax enable_ksproxy_ax -wine_fn_config_makefile dlls/ksuser enable_ksuser -wine_fn_config_makefile dlls/ktmw32 enable_ktmw32 -wine_fn_config_makefile dlls/l3codeca.acm enable_l3codeca_acm -wine_fn_config_makefile dlls/light.msstyles enable_light_msstyles -wine_fn_config_makefile dlls/loadperf enable_loadperf -wine_fn_config_makefile dlls/localspl enable_localspl -wine_fn_config_makefile dlls/localspl/tests enable_tests -wine_fn_config_makefile dlls/localui enable_localui -wine_fn_config_makefile dlls/localui/tests enable_tests -wine_fn_config_makefile dlls/lz32 enable_lz32 -wine_fn_config_makefile dlls/lz32/tests enable_tests -wine_fn_config_makefile dlls/lzexpand.dll16 enable_win16 -wine_fn_config_makefile dlls/magnification enable_magnification -wine_fn_config_makefile dlls/mapi32 enable_mapi32 -wine_fn_config_makefile dlls/mapi32/tests enable_tests -wine_fn_config_makefile dlls/mapistub enable_mapistub -wine_fn_config_makefile dlls/mciavi32 enable_mciavi32 -wine_fn_config_makefile dlls/mcicda enable_mcicda -wine_fn_config_makefile dlls/mciqtz32 enable_mciqtz32 -wine_fn_config_makefile dlls/mciseq enable_mciseq -wine_fn_config_makefile dlls/mciwave enable_mciwave -wine_fn_config_makefile dlls/mf enable_mf -wine_fn_config_makefile dlls/mf/tests enable_tests -wine_fn_config_makefile dlls/mf3216 enable_mf3216 -wine_fn_config_makefile dlls/mferror enable_mferror -wine_fn_config_makefile dlls/mfmediaengine enable_mfmediaengine -wine_fn_config_makefile dlls/mfmediaengine/tests enable_tests -wine_fn_config_makefile dlls/mfplat enable_mfplat -wine_fn_config_makefile dlls/mfplat/tests enable_tests -wine_fn_config_makefile dlls/mfplay enable_mfplay -wine_fn_config_makefile dlls/mfplay/tests enable_tests -wine_fn_config_makefile dlls/mfreadwrite enable_mfreadwrite -wine_fn_config_makefile dlls/mfreadwrite/tests enable_tests -wine_fn_config_makefile dlls/mfsrcsnk enable_mfsrcsnk -wine_fn_config_makefile dlls/mfsrcsnk/tests enable_tests -wine_fn_config_makefile dlls/mgmtapi enable_mgmtapi -wine_fn_config_makefile dlls/midimap enable_midimap -wine_fn_config_makefile dlls/mlang enable_mlang -wine_fn_config_makefile dlls/mlang/tests enable_tests -wine_fn_config_makefile dlls/mmcndmgr enable_mmcndmgr -wine_fn_config_makefile dlls/mmcndmgr/tests enable_tests -wine_fn_config_makefile dlls/mmdevapi enable_mmdevapi -wine_fn_config_makefile dlls/mmdevapi/tests enable_tests -wine_fn_config_makefile dlls/mmdevldr.vxd enable_win16 -wine_fn_config_makefile dlls/mmsystem.dll16 enable_win16 -wine_fn_config_makefile dlls/monodebg.vxd enable_win16 -wine_fn_config_makefile dlls/mountmgr.sys enable_mountmgr_sys -wine_fn_config_makefile dlls/mouse.drv16 enable_win16 -wine_fn_config_makefile dlls/mp3dmod enable_mp3dmod -wine_fn_config_makefile dlls/mp3dmod/tests enable_tests -wine_fn_config_makefile dlls/mpr enable_mpr -wine_fn_config_makefile dlls/mpr/tests enable_tests -wine_fn_config_makefile dlls/mprapi enable_mprapi -wine_fn_config_makefile dlls/msacm.dll16 enable_win16 -wine_fn_config_makefile dlls/msacm32.drv enable_msacm32_drv -wine_fn_config_makefile dlls/msacm32 enable_msacm32 -wine_fn_config_makefile dlls/msacm32/tests enable_tests -wine_fn_config_makefile dlls/msado15 enable_msado15 -wine_fn_config_makefile dlls/msado15/tests enable_tests -wine_fn_config_makefile dlls/msadp32.acm enable_msadp32_acm -wine_fn_config_makefile dlls/msasn1 enable_msasn1 -wine_fn_config_makefile dlls/msasn1/tests enable_tests -wine_fn_config_makefile dlls/msauddecmft enable_msauddecmft -wine_fn_config_makefile dlls/mscat32 enable_mscat32 -wine_fn_config_makefile dlls/mscms enable_mscms -wine_fn_config_makefile dlls/mscms/tests enable_tests -wine_fn_config_makefile dlls/mscoree enable_mscoree -wine_fn_config_makefile dlls/mscoree/tests enable_tests -wine_fn_config_makefile dlls/mscorwks enable_mscorwks -wine_fn_config_makefile dlls/msctf enable_msctf -wine_fn_config_makefile dlls/msctf/tests enable_tests -wine_fn_config_makefile dlls/msctfmonitor enable_msctfmonitor -wine_fn_config_makefile dlls/msctfp enable_msctfp -wine_fn_config_makefile dlls/msdaps enable_msdaps -wine_fn_config_makefile dlls/msdasql enable_msdasql -wine_fn_config_makefile dlls/msdasql/tests enable_tests -wine_fn_config_makefile dlls/msdelta enable_msdelta -wine_fn_config_makefile dlls/msdmo enable_msdmo -wine_fn_config_makefile dlls/msdmo/tests enable_tests -wine_fn_config_makefile dlls/msdrm enable_msdrm -wine_fn_config_makefile dlls/msftedit enable_msftedit -wine_fn_config_makefile dlls/msftedit/tests enable_tests -wine_fn_config_makefile dlls/msg711.acm enable_msg711_acm -wine_fn_config_makefile dlls/msgsm32.acm enable_msgsm32_acm -wine_fn_config_makefile dlls/mshtml.tlb enable_mshtml_tlb -wine_fn_config_makefile dlls/mshtml enable_mshtml -wine_fn_config_makefile dlls/mshtml/tests enable_tests -wine_fn_config_makefile dlls/msi enable_msi -wine_fn_config_makefile dlls/msi/tests enable_tests -wine_fn_config_makefile dlls/msident enable_msident -wine_fn_config_makefile dlls/msimg32 enable_msimg32 -wine_fn_config_makefile dlls/msimsg enable_msimsg -wine_fn_config_makefile dlls/msimtf enable_msimtf -wine_fn_config_makefile dlls/msisip enable_msisip -wine_fn_config_makefile dlls/msisys.ocx enable_msisys_ocx -wine_fn_config_makefile dlls/msls31 enable_msls31 -wine_fn_config_makefile dlls/msmpeg2vdec enable_msmpeg2vdec -wine_fn_config_makefile dlls/msnet32 enable_msnet32 -wine_fn_config_makefile dlls/mspatcha enable_mspatcha -wine_fn_config_makefile dlls/mspatcha/tests enable_tests -wine_fn_config_makefile dlls/msports enable_msports -wine_fn_config_makefile dlls/msrle32 enable_msrle32 -wine_fn_config_makefile dlls/msrle32/tests enable_tests -wine_fn_config_makefile dlls/msscript.ocx enable_msscript_ocx -wine_fn_config_makefile dlls/msscript.ocx/tests enable_tests -wine_fn_config_makefile dlls/mssign32 enable_mssign32 -wine_fn_config_makefile dlls/mssip32 enable_mssip32 -wine_fn_config_makefile dlls/mstask enable_mstask -wine_fn_config_makefile dlls/mstask/tests enable_tests -wine_fn_config_makefile dlls/msttsengine enable_msttsengine -wine_fn_config_makefile dlls/msv1_0 enable_msv1_0 -wine_fn_config_makefile dlls/msvcirt enable_msvcirt -wine_fn_config_makefile dlls/msvcirt/tests enable_tests -wine_fn_config_makefile dlls/msvcm80 enable_msvcm80 -wine_fn_config_makefile dlls/msvcm90 enable_msvcm90 -wine_fn_config_makefile dlls/msvcp100 enable_msvcp100 -wine_fn_config_makefile dlls/msvcp100/tests enable_tests -wine_fn_config_makefile dlls/msvcp110 enable_msvcp110 -wine_fn_config_makefile dlls/msvcp110/tests enable_tests -wine_fn_config_makefile dlls/msvcp120 enable_msvcp120 -wine_fn_config_makefile dlls/msvcp120/tests enable_tests -wine_fn_config_makefile dlls/msvcp120_app enable_msvcp120_app -wine_fn_config_makefile dlls/msvcp140 enable_msvcp140 -wine_fn_config_makefile dlls/msvcp140/tests enable_tests -wine_fn_config_makefile dlls/msvcp140_1 enable_msvcp140_1 -wine_fn_config_makefile dlls/msvcp140_1/tests enable_tests -wine_fn_config_makefile dlls/msvcp140_2 enable_msvcp140_2 -wine_fn_config_makefile dlls/msvcp140_atomic_wait enable_msvcp140_atomic_wait -wine_fn_config_makefile dlls/msvcp140_atomic_wait/tests enable_tests -wine_fn_config_makefile dlls/msvcp140_codecvt_ids enable_msvcp140_codecvt_ids -wine_fn_config_makefile dlls/msvcp60 enable_msvcp60 -wine_fn_config_makefile dlls/msvcp60/tests enable_tests -wine_fn_config_makefile dlls/msvcp70 enable_msvcp70 -wine_fn_config_makefile dlls/msvcp71 enable_msvcp71 -wine_fn_config_makefile dlls/msvcp80 enable_msvcp80 -wine_fn_config_makefile dlls/msvcp90 enable_msvcp90 -wine_fn_config_makefile dlls/msvcp90/tests enable_tests -wine_fn_config_makefile dlls/msvcp_win enable_msvcp_win -wine_fn_config_makefile dlls/msvcr100 enable_msvcr100 -wine_fn_config_makefile dlls/msvcr100/tests enable_tests -wine_fn_config_makefile dlls/msvcr110 enable_msvcr110 -wine_fn_config_makefile dlls/msvcr110/tests enable_tests -wine_fn_config_makefile dlls/msvcr120 enable_msvcr120 -wine_fn_config_makefile dlls/msvcr120/tests enable_tests -wine_fn_config_makefile dlls/msvcr120_app enable_msvcr120_app -wine_fn_config_makefile dlls/msvcr70 enable_msvcr70 -wine_fn_config_makefile dlls/msvcr70/tests enable_tests -wine_fn_config_makefile dlls/msvcr71 enable_msvcr71 -wine_fn_config_makefile dlls/msvcr71/tests enable_tests -wine_fn_config_makefile dlls/msvcr80 enable_msvcr80 -wine_fn_config_makefile dlls/msvcr80/tests enable_tests -wine_fn_config_makefile dlls/msvcr90 enable_msvcr90 -wine_fn_config_makefile dlls/msvcr90/tests enable_tests -wine_fn_config_makefile dlls/msvcrt enable_msvcrt -wine_fn_config_makefile dlls/msvcrt/tests enable_tests -wine_fn_config_makefile dlls/msvcrt20 enable_msvcrt20 -wine_fn_config_makefile dlls/msvcrt40 enable_msvcrt40 -wine_fn_config_makefile dlls/msvcrtd enable_msvcrtd -wine_fn_config_makefile dlls/msvcrtd/tests enable_tests -wine_fn_config_makefile dlls/msvfw32 enable_msvfw32 -wine_fn_config_makefile dlls/msvfw32/tests enable_tests -wine_fn_config_makefile dlls/msvidc32 enable_msvidc32 -wine_fn_config_makefile dlls/msvideo.dll16 enable_win16 -wine_fn_config_makefile dlls/mswsock enable_mswsock -wine_fn_config_makefile dlls/msxml enable_msxml -wine_fn_config_makefile dlls/msxml2 enable_msxml2 -wine_fn_config_makefile dlls/msxml3 enable_msxml3 -wine_fn_config_makefile dlls/msxml3/tests enable_tests -wine_fn_config_makefile dlls/msxml4 enable_msxml4 -wine_fn_config_makefile dlls/msxml4/tests enable_tests -wine_fn_config_makefile dlls/msxml6 enable_msxml6 -wine_fn_config_makefile dlls/msxml6/tests enable_tests -wine_fn_config_makefile dlls/mtxdm enable_mtxdm -wine_fn_config_makefile dlls/ncrypt enable_ncrypt -wine_fn_config_makefile dlls/ncrypt/tests enable_tests -wine_fn_config_makefile dlls/nddeapi enable_nddeapi -wine_fn_config_makefile dlls/ndis.sys enable_ndis_sys -wine_fn_config_makefile dlls/ndis.sys/tests enable_tests -wine_fn_config_makefile dlls/netapi32 enable_netapi32 -wine_fn_config_makefile dlls/netapi32/tests enable_tests -wine_fn_config_makefile dlls/netcfgx enable_netcfgx -wine_fn_config_makefile dlls/netcfgx/tests enable_tests -wine_fn_config_makefile dlls/netio.sys enable_netio_sys -wine_fn_config_makefile dlls/netprofm enable_netprofm -wine_fn_config_makefile dlls/netprofm/tests enable_tests -wine_fn_config_makefile dlls/netutils enable_netutils -wine_fn_config_makefile dlls/newdev enable_newdev -wine_fn_config_makefile dlls/ninput enable_ninput -wine_fn_config_makefile dlls/ninput/tests enable_tests -wine_fn_config_makefile dlls/normaliz enable_normaliz -wine_fn_config_makefile dlls/npmshtml enable_npmshtml -wine_fn_config_makefile dlls/npptools enable_npptools -wine_fn_config_makefile dlls/nsi enable_nsi -wine_fn_config_makefile dlls/nsi/tests enable_tests -wine_fn_config_makefile dlls/nsiproxy.sys enable_nsiproxy_sys -wine_fn_config_makefile dlls/ntdll enable_ntdll -wine_fn_config_makefile dlls/ntdll/tests enable_tests -wine_fn_config_makefile dlls/ntdsapi enable_ntdsapi -wine_fn_config_makefile dlls/ntdsapi/tests enable_tests -wine_fn_config_makefile dlls/ntoskrnl.exe enable_ntoskrnl_exe -wine_fn_config_makefile dlls/ntoskrnl.exe/tests enable_tests -wine_fn_config_makefile dlls/ntprint enable_ntprint -wine_fn_config_makefile dlls/ntprint/tests enable_tests -wine_fn_config_makefile dlls/objsel enable_objsel -wine_fn_config_makefile dlls/odbc32 enable_odbc32 -wine_fn_config_makefile dlls/odbcbcp enable_odbcbcp -wine_fn_config_makefile dlls/odbccp32 enable_odbccp32 -wine_fn_config_makefile dlls/odbccp32/tests enable_tests -wine_fn_config_makefile dlls/odbccu32 enable_odbccu32 -wine_fn_config_makefile dlls/ole2.dll16 enable_win16 -wine_fn_config_makefile dlls/ole2conv.dll16 enable_win16 -wine_fn_config_makefile dlls/ole2disp.dll16 enable_win16 -wine_fn_config_makefile dlls/ole2nls.dll16 enable_win16 -wine_fn_config_makefile dlls/ole2prox.dll16 enable_win16 -wine_fn_config_makefile dlls/ole2thk.dll16 enable_win16 -wine_fn_config_makefile dlls/ole32 enable_ole32 -wine_fn_config_makefile dlls/ole32/tests enable_tests -wine_fn_config_makefile dlls/oleacc enable_oleacc -wine_fn_config_makefile dlls/oleacc/tests enable_tests -wine_fn_config_makefile dlls/oleaut32 enable_oleaut32 -wine_fn_config_makefile dlls/oleaut32/tests enable_tests -wine_fn_config_makefile dlls/olecli.dll16 enable_win16 -wine_fn_config_makefile dlls/olecli32 enable_olecli32 -wine_fn_config_makefile dlls/oledb32 enable_oledb32 -wine_fn_config_makefile dlls/oledb32/tests enable_tests -wine_fn_config_makefile dlls/oledlg enable_oledlg -wine_fn_config_makefile dlls/oledlg/tests enable_tests -wine_fn_config_makefile dlls/olepro32 enable_olepro32 -wine_fn_config_makefile dlls/olesvr.dll16 enable_win16 -wine_fn_config_makefile dlls/olesvr32 enable_olesvr32 -wine_fn_config_makefile dlls/olethk32 enable_olethk32 -wine_fn_config_makefile dlls/opcservices enable_opcservices -wine_fn_config_makefile dlls/opcservices/tests enable_tests -wine_fn_config_makefile dlls/opencl enable_opencl -wine_fn_config_makefile dlls/opengl32 enable_opengl32 -wine_fn_config_makefile dlls/opengl32/tests enable_tests -wine_fn_config_makefile dlls/packager enable_packager -wine_fn_config_makefile dlls/packager/tests enable_tests -wine_fn_config_makefile dlls/pdh enable_pdh -wine_fn_config_makefile dlls/pdh/tests enable_tests -wine_fn_config_makefile dlls/photometadatahandler enable_photometadatahandler -wine_fn_config_makefile dlls/pidgen enable_pidgen -wine_fn_config_makefile dlls/powrprof enable_powrprof -wine_fn_config_makefile dlls/printui enable_printui -wine_fn_config_makefile dlls/prntvpt enable_prntvpt -wine_fn_config_makefile dlls/prntvpt/tests enable_tests -wine_fn_config_makefile dlls/propsys enable_propsys -wine_fn_config_makefile dlls/propsys/tests enable_tests -wine_fn_config_makefile dlls/psapi enable_psapi -wine_fn_config_makefile dlls/psapi/tests enable_tests -wine_fn_config_makefile dlls/pstorec enable_pstorec -wine_fn_config_makefile dlls/pstorec/tests enable_tests -wine_fn_config_makefile dlls/pwrshplugin enable_pwrshplugin -wine_fn_config_makefile dlls/qasf enable_qasf -wine_fn_config_makefile dlls/qasf/tests enable_tests -wine_fn_config_makefile dlls/qcap enable_qcap -wine_fn_config_makefile dlls/qcap/tests enable_tests -wine_fn_config_makefile dlls/qdvd enable_qdvd -wine_fn_config_makefile dlls/qdvd/tests enable_tests -wine_fn_config_makefile dlls/qedit enable_qedit -wine_fn_config_makefile dlls/qedit/tests enable_tests -wine_fn_config_makefile dlls/qmgr enable_qmgr -wine_fn_config_makefile dlls/qmgr/tests enable_tests -wine_fn_config_makefile dlls/qmgrprxy enable_qmgrprxy -wine_fn_config_makefile dlls/quartz enable_quartz -wine_fn_config_makefile dlls/quartz/tests enable_tests -wine_fn_config_makefile dlls/query enable_query -wine_fn_config_makefile dlls/qwave enable_qwave -wine_fn_config_makefile dlls/qwave/tests enable_tests -wine_fn_config_makefile dlls/rasapi16.dll16 enable_win16 -wine_fn_config_makefile dlls/rasapi32 enable_rasapi32 -wine_fn_config_makefile dlls/rasapi32/tests enable_tests -wine_fn_config_makefile dlls/rasdlg enable_rasdlg -wine_fn_config_makefile dlls/regapi enable_regapi -wine_fn_config_makefile dlls/resutils enable_resutils -wine_fn_config_makefile dlls/riched20 enable_riched20 -wine_fn_config_makefile dlls/riched20/tests enable_tests -wine_fn_config_makefile dlls/riched32 enable_riched32 -wine_fn_config_makefile dlls/riched32/tests enable_tests -wine_fn_config_makefile dlls/rpcrt4 enable_rpcrt4 -wine_fn_config_makefile dlls/rpcrt4/tests enable_tests -wine_fn_config_makefile dlls/rsabase enable_rsabase -wine_fn_config_makefile dlls/rsaenh enable_rsaenh -wine_fn_config_makefile dlls/rsaenh/tests enable_tests -wine_fn_config_makefile dlls/rstrtmgr enable_rstrtmgr -wine_fn_config_makefile dlls/rtutils enable_rtutils -wine_fn_config_makefile dlls/rtworkq enable_rtworkq -wine_fn_config_makefile dlls/rtworkq/tests enable_tests -wine_fn_config_makefile dlls/samlib enable_samlib -wine_fn_config_makefile dlls/sane.ds enable_sane_ds -wine_fn_config_makefile dlls/sapi enable_sapi -wine_fn_config_makefile dlls/sapi/tests enable_tests -wine_fn_config_makefile dlls/sas enable_sas -wine_fn_config_makefile dlls/scarddlg enable_scarddlg -wine_fn_config_makefile dlls/scardsvr enable_scardsvr -wine_fn_config_makefile dlls/sccbase enable_sccbase -wine_fn_config_makefile dlls/schannel enable_schannel -wine_fn_config_makefile dlls/schannel/tests enable_tests -wine_fn_config_makefile dlls/schedsvc enable_schedsvc -wine_fn_config_makefile dlls/schedsvc/tests enable_tests -wine_fn_config_makefile dlls/scrobj enable_scrobj -wine_fn_config_makefile dlls/scrobj/tests enable_tests -wine_fn_config_makefile dlls/scrrun enable_scrrun -wine_fn_config_makefile dlls/scrrun/tests enable_tests -wine_fn_config_makefile dlls/scsiport.sys enable_scsiport_sys -wine_fn_config_makefile dlls/sechost enable_sechost -wine_fn_config_makefile dlls/secur32 enable_secur32 -wine_fn_config_makefile dlls/secur32/tests enable_tests -wine_fn_config_makefile dlls/security enable_security -wine_fn_config_makefile dlls/sensapi enable_sensapi -wine_fn_config_makefile dlls/serialui enable_serialui -wine_fn_config_makefile dlls/serialui/tests enable_tests -wine_fn_config_makefile dlls/setupapi enable_setupapi -wine_fn_config_makefile dlls/setupapi/tests enable_tests -wine_fn_config_makefile dlls/setupx.dll16 enable_win16 -wine_fn_config_makefile dlls/sfc enable_sfc -wine_fn_config_makefile dlls/sfc_os enable_sfc_os -wine_fn_config_makefile dlls/shcore enable_shcore -wine_fn_config_makefile dlls/shcore/tests enable_tests -wine_fn_config_makefile dlls/shdoclc enable_shdoclc -wine_fn_config_makefile dlls/shdocvw enable_shdocvw -wine_fn_config_makefile dlls/shdocvw/tests enable_tests -wine_fn_config_makefile dlls/shell.dll16 enable_win16 -wine_fn_config_makefile dlls/shell32 enable_shell32 -wine_fn_config_makefile dlls/shell32/tests enable_tests -wine_fn_config_makefile dlls/shfolder enable_shfolder -wine_fn_config_makefile dlls/shlwapi enable_shlwapi -wine_fn_config_makefile dlls/shlwapi/tests enable_tests -wine_fn_config_makefile dlls/slbcsp enable_slbcsp -wine_fn_config_makefile dlls/slc enable_slc -wine_fn_config_makefile dlls/slc/tests enable_tests -wine_fn_config_makefile dlls/snmpapi enable_snmpapi -wine_fn_config_makefile dlls/snmpapi/tests enable_tests -wine_fn_config_makefile dlls/softpub enable_softpub -wine_fn_config_makefile dlls/sound.drv16 enable_win16 -wine_fn_config_makefile dlls/spoolss enable_spoolss -wine_fn_config_makefile dlls/spoolss/tests enable_tests -wine_fn_config_makefile dlls/sppc enable_sppc -wine_fn_config_makefile dlls/srclient enable_srclient -wine_fn_config_makefile dlls/srvcli enable_srvcli -wine_fn_config_makefile dlls/srvsvc enable_srvsvc -wine_fn_config_makefile dlls/sspicli enable_sspicli -wine_fn_config_makefile dlls/stdole2.tlb enable_stdole2_tlb -wine_fn_config_makefile dlls/stdole32.tlb enable_stdole32_tlb -wine_fn_config_makefile dlls/sti enable_sti -wine_fn_config_makefile dlls/sti/tests enable_tests -wine_fn_config_makefile dlls/storage.dll16 enable_win16 -wine_fn_config_makefile dlls/stress.dll16 enable_win16 -wine_fn_config_makefile dlls/strmdll enable_strmdll -wine_fn_config_makefile dlls/svrapi enable_svrapi -wine_fn_config_makefile dlls/sxs enable_sxs -wine_fn_config_makefile dlls/sxs/tests enable_tests -wine_fn_config_makefile dlls/system.drv16 enable_win16 -wine_fn_config_makefile dlls/t2embed enable_t2embed -wine_fn_config_makefile dlls/t2embed/tests enable_tests -wine_fn_config_makefile dlls/tapi32 enable_tapi32 -wine_fn_config_makefile dlls/tapi32/tests enable_tests -wine_fn_config_makefile dlls/taskschd enable_taskschd -wine_fn_config_makefile dlls/taskschd/tests enable_tests -wine_fn_config_makefile dlls/tbs enable_tbs -wine_fn_config_makefile dlls/tdh enable_tdh -wine_fn_config_makefile dlls/tdi.sys enable_tdi_sys -wine_fn_config_makefile dlls/threadpoolwinrt enable_threadpoolwinrt -wine_fn_config_makefile dlls/threadpoolwinrt/tests enable_tests -wine_fn_config_makefile dlls/toolhelp.dll16 enable_win16 -wine_fn_config_makefile dlls/traffic enable_traffic -wine_fn_config_makefile dlls/twain.dll16 enable_win16 -wine_fn_config_makefile dlls/twain_32 enable_twain_32 -wine_fn_config_makefile dlls/twain_32/tests enable_tests -wine_fn_config_makefile dlls/twinapi.appcore enable_twinapi_appcore -wine_fn_config_makefile dlls/twinapi.appcore/tests enable_tests -wine_fn_config_makefile dlls/typelib.dll16 enable_win16 -wine_fn_config_makefile dlls/tzres enable_tzres -wine_fn_config_makefile dlls/ucrtbase enable_ucrtbase -wine_fn_config_makefile dlls/ucrtbase/tests enable_tests -wine_fn_config_makefile dlls/uianimation enable_uianimation -wine_fn_config_makefile dlls/uianimation/tests enable_tests -wine_fn_config_makefile dlls/uiautomationcore enable_uiautomationcore -wine_fn_config_makefile dlls/uiautomationcore/tests enable_tests -wine_fn_config_makefile dlls/uiribbon enable_uiribbon -wine_fn_config_makefile dlls/unicows enable_unicows -wine_fn_config_makefile dlls/updspapi enable_updspapi -wine_fn_config_makefile dlls/url enable_url -wine_fn_config_makefile dlls/urlmon enable_urlmon -wine_fn_config_makefile dlls/urlmon/tests enable_tests -wine_fn_config_makefile dlls/usbd.sys enable_usbd_sys -wine_fn_config_makefile dlls/user.exe16 enable_win16 -wine_fn_config_makefile dlls/user32 enable_user32 -wine_fn_config_makefile dlls/user32/tests enable_tests -wine_fn_config_makefile dlls/userenv enable_userenv -wine_fn_config_makefile dlls/userenv/tests enable_tests -wine_fn_config_makefile dlls/usp10 enable_usp10 -wine_fn_config_makefile dlls/usp10/tests enable_tests -wine_fn_config_makefile dlls/utildll enable_utildll -wine_fn_config_makefile dlls/uxtheme enable_uxtheme -wine_fn_config_makefile dlls/uxtheme/tests enable_tests -wine_fn_config_makefile dlls/vbscript enable_vbscript -wine_fn_config_makefile dlls/vbscript/tests enable_tests -wine_fn_config_makefile dlls/vcomp enable_vcomp -wine_fn_config_makefile dlls/vcomp/tests enable_tests -wine_fn_config_makefile dlls/vcomp100 enable_vcomp100 -wine_fn_config_makefile dlls/vcomp110 enable_vcomp110 -wine_fn_config_makefile dlls/vcomp110/tests enable_tests -wine_fn_config_makefile dlls/vcomp120 enable_vcomp120 -wine_fn_config_makefile dlls/vcomp140 enable_vcomp140 -wine_fn_config_makefile dlls/vcomp90 enable_vcomp90 -wine_fn_config_makefile dlls/vcruntime140 enable_vcruntime140 -wine_fn_config_makefile dlls/vcruntime140_1 enable_vcruntime140_1 -wine_fn_config_makefile dlls/vdhcp.vxd enable_win16 -wine_fn_config_makefile dlls/vdmdbg enable_vdmdbg -wine_fn_config_makefile dlls/ver.dll16 enable_win16 -wine_fn_config_makefile dlls/version enable_version -wine_fn_config_makefile dlls/version/tests enable_tests -wine_fn_config_makefile dlls/vga enable_vga -wine_fn_config_makefile dlls/virtdisk enable_virtdisk -wine_fn_config_makefile dlls/virtdisk/tests enable_tests -wine_fn_config_makefile dlls/vmm.vxd enable_win16 -wine_fn_config_makefile dlls/vnbt.vxd enable_win16 -wine_fn_config_makefile dlls/vnetbios.vxd enable_win16 -wine_fn_config_makefile dlls/vssapi enable_vssapi -wine_fn_config_makefile dlls/vtdapi.vxd enable_win16 -wine_fn_config_makefile dlls/vulkan-1 enable_vulkan_1 -wine_fn_config_makefile dlls/vulkan-1/tests enable_tests -wine_fn_config_makefile dlls/vwin32.vxd enable_win16 -wine_fn_config_makefile dlls/w32skrnl enable_win16 -wine_fn_config_makefile dlls/w32sys.dll16 enable_win16 -wine_fn_config_makefile dlls/wbemdisp enable_wbemdisp -wine_fn_config_makefile dlls/wbemdisp/tests enable_tests -wine_fn_config_makefile dlls/wbemprox enable_wbemprox -wine_fn_config_makefile dlls/wbemprox/tests enable_tests -wine_fn_config_makefile dlls/wdscore enable_wdscore -wine_fn_config_makefile dlls/webservices enable_webservices -wine_fn_config_makefile dlls/webservices/tests enable_tests -wine_fn_config_makefile dlls/websocket enable_websocket -wine_fn_config_makefile dlls/wer enable_wer -wine_fn_config_makefile dlls/wer/tests enable_tests -wine_fn_config_makefile dlls/wevtapi enable_wevtapi -wine_fn_config_makefile dlls/wevtapi/tests enable_tests -wine_fn_config_makefile dlls/wevtsvc enable_wevtsvc -wine_fn_config_makefile dlls/wiaservc enable_wiaservc -wine_fn_config_makefile dlls/wiaservc/tests enable_tests -wine_fn_config_makefile dlls/wimgapi enable_wimgapi -wine_fn_config_makefile dlls/win32s16.dll16 enable_win16 -wine_fn_config_makefile dlls/win32u enable_win32u -wine_fn_config_makefile dlls/win32u/tests enable_tests -wine_fn_config_makefile dlls/win87em.dll16 enable_win16 -wine_fn_config_makefile dlls/winaspi.dll16 enable_win16 -wine_fn_config_makefile dlls/windebug.dll16 enable_win16 -wine_fn_config_makefile dlls/windows.applicationmodel enable_windows_applicationmodel -wine_fn_config_makefile dlls/windows.applicationmodel/tests enable_tests -wine_fn_config_makefile dlls/windows.devices.bluetooth enable_windows_devices_bluetooth -wine_fn_config_makefile dlls/windows.devices.bluetooth/tests enable_tests -wine_fn_config_makefile dlls/windows.devices.enumeration enable_windows_devices_enumeration -wine_fn_config_makefile dlls/windows.devices.enumeration/tests enable_tests -wine_fn_config_makefile dlls/windows.devices.usb enable_windows_devices_usb -wine_fn_config_makefile dlls/windows.devices.usb/tests enable_tests -wine_fn_config_makefile dlls/windows.gaming.input enable_windows_gaming_input -wine_fn_config_makefile dlls/windows.gaming.input/tests enable_tests -wine_fn_config_makefile dlls/windows.gaming.ui.gamebar enable_windows_gaming_ui_gamebar -wine_fn_config_makefile dlls/windows.gaming.ui.gamebar/tests enable_tests -wine_fn_config_makefile dlls/windows.globalization enable_windows_globalization -wine_fn_config_makefile dlls/windows.globalization/tests enable_tests -wine_fn_config_makefile dlls/windows.media.devices enable_windows_media_devices -wine_fn_config_makefile dlls/windows.media.devices/tests enable_tests -wine_fn_config_makefile dlls/windows.media.mediacontrol enable_windows_media_mediacontrol -wine_fn_config_makefile dlls/windows.media.mediacontrol/tests enable_tests -wine_fn_config_makefile dlls/windows.media.speech enable_windows_media_speech -wine_fn_config_makefile dlls/windows.media.speech/tests enable_tests -wine_fn_config_makefile dlls/windows.media enable_windows_media -wine_fn_config_makefile dlls/windows.media/tests enable_tests -wine_fn_config_makefile dlls/windows.networking.hostname enable_windows_networking_hostname -wine_fn_config_makefile dlls/windows.networking.hostname/tests enable_tests -wine_fn_config_makefile dlls/windows.networking enable_windows_networking -wine_fn_config_makefile dlls/windows.perception.stub enable_windows_perception_stub -wine_fn_config_makefile dlls/windows.perception.stub/tests enable_tests -wine_fn_config_makefile dlls/windows.security.credentials.ui.userconsentverifier enable_windows_security_credentials_ui_userconsentverifier -wine_fn_config_makefile dlls/windows.security.credentials.ui.userconsentverifier/tests enable_tests -wine_fn_config_makefile dlls/windows.storage.applicationdata enable_windows_storage_applicationdata -wine_fn_config_makefile dlls/windows.storage.applicationdata/tests enable_tests -wine_fn_config_makefile dlls/windows.system.profile.systemmanufacturers enable_windows_system_profile_systemmanufacturers -wine_fn_config_makefile dlls/windows.system.profile.systemmanufacturers/tests enable_tests -wine_fn_config_makefile dlls/windows.ui enable_windows_ui -wine_fn_config_makefile dlls/windows.ui/tests enable_tests -wine_fn_config_makefile dlls/windowscodecs enable_windowscodecs -wine_fn_config_makefile dlls/windowscodecs/tests enable_tests -wine_fn_config_makefile dlls/windowscodecsext enable_windowscodecsext -wine_fn_config_makefile dlls/windowscodecsext/tests enable_tests -wine_fn_config_makefile dlls/winealsa.drv enable_winealsa_drv -wine_fn_config_makefile dlls/wineandroid.drv enable_wineandroid_drv -wine_fn_config_makefile dlls/winebus.sys enable_winebus_sys -wine_fn_config_makefile dlls/winecoreaudio.drv enable_winecoreaudio_drv -wine_fn_config_makefile dlls/winecrt0 enable_winecrt0 -wine_fn_config_makefile dlls/wined3d enable_wined3d -wine_fn_config_makefile dlls/winegstreamer enable_winegstreamer -wine_fn_config_makefile dlls/winehid.sys enable_winehid_sys -wine_fn_config_makefile dlls/winemac.drv enable_winemac_drv -wine_fn_config_makefile dlls/winemapi enable_winemapi -wine_fn_config_makefile dlls/wineoss.drv enable_wineoss_drv -wine_fn_config_makefile dlls/wineps.drv enable_wineps_drv -wine_fn_config_makefile dlls/wineps16.drv16 enable_win16 -wine_fn_config_makefile dlls/winepulse.drv enable_winepulse_drv -wine_fn_config_makefile dlls/wineusb.sys enable_wineusb_sys -wine_fn_config_makefile dlls/winevulkan enable_winevulkan -wine_fn_config_makefile dlls/winewayland.drv enable_winewayland_drv -wine_fn_config_makefile dlls/winex11.drv enable_winex11_drv -wine_fn_config_makefile dlls/winexinput.sys enable_winexinput_sys -wine_fn_config_makefile dlls/wing.dll16 enable_win16 -wine_fn_config_makefile dlls/wing32 enable_wing32 -wine_fn_config_makefile dlls/winhttp enable_winhttp -wine_fn_config_makefile dlls/winhttp/tests enable_tests -wine_fn_config_makefile dlls/wininet enable_wininet -wine_fn_config_makefile dlls/wininet/tests enable_tests -wine_fn_config_makefile dlls/winmm enable_winmm -wine_fn_config_makefile dlls/winmm/tests enable_tests -wine_fn_config_makefile dlls/winnls.dll16 enable_win16 -wine_fn_config_makefile dlls/winnls32 enable_winnls32 -wine_fn_config_makefile dlls/winprint enable_winprint -wine_fn_config_makefile dlls/winscard enable_winscard -wine_fn_config_makefile dlls/winscard/tests enable_tests -wine_fn_config_makefile dlls/winsock.dll16 enable_win16 -wine_fn_config_makefile dlls/winspool.drv enable_winspool_drv -wine_fn_config_makefile dlls/winspool.drv/tests enable_tests -wine_fn_config_makefile dlls/winsta enable_winsta -wine_fn_config_makefile dlls/wintab.dll16 enable_win16 -wine_fn_config_makefile dlls/wintab32 enable_wintab32 -wine_fn_config_makefile dlls/wintab32/tests enable_tests -wine_fn_config_makefile dlls/wintrust enable_wintrust -wine_fn_config_makefile dlls/wintrust/tests enable_tests -wine_fn_config_makefile dlls/wintypes enable_wintypes -wine_fn_config_makefile dlls/wintypes/tests enable_tests -wine_fn_config_makefile dlls/winusb enable_winusb -wine_fn_config_makefile dlls/wlanapi enable_wlanapi -wine_fn_config_makefile dlls/wlanapi/tests enable_tests -wine_fn_config_makefile dlls/wlanui enable_wlanui -wine_fn_config_makefile dlls/wldap32 enable_wldap32 -wine_fn_config_makefile dlls/wldap32/tests enable_tests -wine_fn_config_makefile dlls/wldp enable_wldp -wine_fn_config_makefile dlls/wldp/tests enable_tests -wine_fn_config_makefile dlls/wmasf enable_wmasf -wine_fn_config_makefile dlls/wmi enable_wmi -wine_fn_config_makefile dlls/wmiutils enable_wmiutils -wine_fn_config_makefile dlls/wmiutils/tests enable_tests -wine_fn_config_makefile dlls/wmp enable_wmp -wine_fn_config_makefile dlls/wmp/tests enable_tests -wine_fn_config_makefile dlls/wmphoto enable_wmphoto -wine_fn_config_makefile dlls/wmvcore enable_wmvcore -wine_fn_config_makefile dlls/wmvcore/tests enable_tests -wine_fn_config_makefile dlls/wnaspi32 enable_wnaspi32 -wine_fn_config_makefile dlls/wofutil enable_wofutil -wine_fn_config_makefile dlls/wow32 enable_win16 -wine_fn_config_makefile dlls/wow64 enable_wow64 -wine_fn_config_makefile dlls/wow64cpu enable_wow64cpu -wine_fn_config_makefile dlls/wow64win enable_wow64win -wine_fn_config_makefile dlls/wpc enable_wpc -wine_fn_config_makefile dlls/wpc/tests enable_tests -wine_fn_config_makefile dlls/wpcap enable_wpcap -wine_fn_config_makefile dlls/wpcap/tests enable_tests -wine_fn_config_makefile dlls/ws2_32 enable_ws2_32 -wine_fn_config_makefile dlls/ws2_32/tests enable_tests -wine_fn_config_makefile dlls/wsdapi enable_wsdapi -wine_fn_config_makefile dlls/wsdapi/tests enable_tests -wine_fn_config_makefile dlls/wshom.ocx enable_wshom_ocx -wine_fn_config_makefile dlls/wshom.ocx/tests enable_tests -wine_fn_config_makefile dlls/wsnmp32 enable_wsnmp32 -wine_fn_config_makefile dlls/wsnmp32/tests enable_tests -wine_fn_config_makefile dlls/wsock32 enable_wsock32 -wine_fn_config_makefile dlls/wtsapi32 enable_wtsapi32 -wine_fn_config_makefile dlls/wtsapi32/tests enable_tests -wine_fn_config_makefile dlls/wuapi enable_wuapi -wine_fn_config_makefile dlls/wuaueng enable_wuaueng -wine_fn_config_makefile dlls/x3daudio1_0 enable_x3daudio1_0 -wine_fn_config_makefile dlls/x3daudio1_1 enable_x3daudio1_1 -wine_fn_config_makefile dlls/x3daudio1_2 enable_x3daudio1_2 -wine_fn_config_makefile dlls/x3daudio1_3 enable_x3daudio1_3 -wine_fn_config_makefile dlls/x3daudio1_4 enable_x3daudio1_4 -wine_fn_config_makefile dlls/x3daudio1_5 enable_x3daudio1_5 -wine_fn_config_makefile dlls/x3daudio1_6 enable_x3daudio1_6 -wine_fn_config_makefile dlls/x3daudio1_7 enable_x3daudio1_7 -wine_fn_config_makefile dlls/xactengine2_0 enable_xactengine2_0 -wine_fn_config_makefile dlls/xactengine2_4 enable_xactengine2_4 -wine_fn_config_makefile dlls/xactengine2_7 enable_xactengine2_7 -wine_fn_config_makefile dlls/xactengine2_9 enable_xactengine2_9 -wine_fn_config_makefile dlls/xactengine3_0 enable_xactengine3_0 -wine_fn_config_makefile dlls/xactengine3_1 enable_xactengine3_1 -wine_fn_config_makefile dlls/xactengine3_2 enable_xactengine3_2 -wine_fn_config_makefile dlls/xactengine3_3 enable_xactengine3_3 -wine_fn_config_makefile dlls/xactengine3_4 enable_xactengine3_4 -wine_fn_config_makefile dlls/xactengine3_5 enable_xactengine3_5 -wine_fn_config_makefile dlls/xactengine3_6 enable_xactengine3_6 -wine_fn_config_makefile dlls/xactengine3_7 enable_xactengine3_7 -wine_fn_config_makefile dlls/xactengine3_7/tests enable_tests -wine_fn_config_makefile dlls/xapofx1_1 enable_xapofx1_1 -wine_fn_config_makefile dlls/xapofx1_2 enable_xapofx1_2 -wine_fn_config_makefile dlls/xapofx1_3 enable_xapofx1_3 -wine_fn_config_makefile dlls/xapofx1_4 enable_xapofx1_4 -wine_fn_config_makefile dlls/xapofx1_5 enable_xapofx1_5 -wine_fn_config_makefile dlls/xaudio2_0 enable_xaudio2_0 -wine_fn_config_makefile dlls/xaudio2_1 enable_xaudio2_1 -wine_fn_config_makefile dlls/xaudio2_2 enable_xaudio2_2 -wine_fn_config_makefile dlls/xaudio2_3 enable_xaudio2_3 -wine_fn_config_makefile dlls/xaudio2_4 enable_xaudio2_4 -wine_fn_config_makefile dlls/xaudio2_5 enable_xaudio2_5 -wine_fn_config_makefile dlls/xaudio2_6 enable_xaudio2_6 -wine_fn_config_makefile dlls/xaudio2_7 enable_xaudio2_7 -wine_fn_config_makefile dlls/xaudio2_7/tests enable_tests -wine_fn_config_makefile dlls/xaudio2_8 enable_xaudio2_8 -wine_fn_config_makefile dlls/xaudio2_8/tests enable_tests -wine_fn_config_makefile dlls/xaudio2_9 enable_xaudio2_9 -wine_fn_config_makefile dlls/xinput1_1 enable_xinput1_1 -wine_fn_config_makefile dlls/xinput1_2 enable_xinput1_2 -wine_fn_config_makefile dlls/xinput1_3 enable_xinput1_3 -wine_fn_config_makefile dlls/xinput1_3/tests enable_tests -wine_fn_config_makefile dlls/xinput1_4 enable_xinput1_4 -wine_fn_config_makefile dlls/xinput9_1_0 enable_xinput9_1_0 -wine_fn_config_makefile dlls/xinputuap enable_xinputuap -wine_fn_config_makefile dlls/xmllite enable_xmllite -wine_fn_config_makefile dlls/xmllite/tests enable_tests -wine_fn_config_makefile dlls/xolehlp enable_xolehlp -wine_fn_config_makefile dlls/xpsprint enable_xpsprint -wine_fn_config_makefile dlls/xpssvcs enable_xpssvcs -wine_fn_config_makefile fonts enable_fonts -wine_fn_config_makefile include enable_include -wine_fn_config_makefile libs/adsiid enable_adsiid -wine_fn_config_makefile libs/dmoguids enable_dmoguids -wine_fn_config_makefile libs/dxerr8 enable_dxerr8 -wine_fn_config_makefile libs/dxerr9 enable_dxerr9 -wine_fn_config_makefile libs/dxguid enable_dxguid -wine_fn_config_makefile libs/faudio enable_faudio -wine_fn_config_makefile libs/fluidsynth enable_fluidsynth -wine_fn_config_makefile libs/gsm enable_gsm -wine_fn_config_makefile libs/jpeg enable_jpeg -wine_fn_config_makefile libs/jxr enable_jxr -wine_fn_config_makefile libs/lcms2 enable_lcms2 -wine_fn_config_makefile libs/ldap enable_ldap -wine_fn_config_makefile libs/mfuuid enable_mfuuid -wine_fn_config_makefile libs/mpg123 enable_mpg123 -wine_fn_config_makefile libs/musl enable_musl -wine_fn_config_makefile libs/png enable_png -wine_fn_config_makefile libs/strmbase enable_strmbase -wine_fn_config_makefile libs/strmiids enable_strmiids -wine_fn_config_makefile libs/tiff enable_tiff -wine_fn_config_makefile libs/uuid enable_uuid -wine_fn_config_makefile libs/vkd3d enable_vkd3d -wine_fn_config_makefile libs/wbemuuid enable_wbemuuid -wine_fn_config_makefile libs/wmcodecdspuuid enable_wmcodecdspuuid -wine_fn_config_makefile libs/xml2 enable_xml2 -wine_fn_config_makefile libs/xslt enable_xslt -wine_fn_config_makefile libs/zlib enable_zlib -wine_fn_config_makefile libs/zydis enable_zydis -wine_fn_config_makefile loader enable_loader -wine_fn_config_makefile nls enable_nls -wine_fn_config_makefile po enable_po -wine_fn_config_makefile programs/arp enable_arp -wine_fn_config_makefile programs/aspnet_regiis enable_aspnet_regiis -wine_fn_config_makefile programs/attrib enable_attrib -wine_fn_config_makefile programs/cabarc enable_cabarc -wine_fn_config_makefile programs/cacls enable_cacls -wine_fn_config_makefile programs/certutil enable_certutil -wine_fn_config_makefile programs/chcp.com enable_chcp_com -wine_fn_config_makefile programs/clock enable_clock -wine_fn_config_makefile programs/cmd enable_cmd -wine_fn_config_makefile programs/cmd/tests enable_tests -wine_fn_config_makefile programs/conhost enable_conhost -wine_fn_config_makefile programs/conhost/tests enable_tests -wine_fn_config_makefile programs/control enable_control -wine_fn_config_makefile programs/cscript enable_cscript -wine_fn_config_makefile programs/dism enable_dism -wine_fn_config_makefile programs/dllhost enable_dllhost -wine_fn_config_makefile programs/dplaysvr enable_dplaysvr -wine_fn_config_makefile programs/dpnsvr enable_dpnsvr -wine_fn_config_makefile programs/dpvsetup enable_dpvsetup -wine_fn_config_makefile programs/dxdiag enable_dxdiag -wine_fn_config_makefile programs/eject enable_eject -wine_fn_config_makefile programs/expand enable_expand -wine_fn_config_makefile programs/explorer enable_explorer -wine_fn_config_makefile programs/explorer/tests enable_tests -wine_fn_config_makefile programs/extrac32 enable_extrac32 -wine_fn_config_makefile programs/fc enable_fc -wine_fn_config_makefile programs/find enable_find -wine_fn_config_makefile programs/find/tests enable_tests -wine_fn_config_makefile programs/findstr enable_findstr -wine_fn_config_makefile programs/findstr/tests enable_tests -wine_fn_config_makefile programs/fsutil enable_fsutil -wine_fn_config_makefile programs/fsutil/tests enable_tests -wine_fn_config_makefile programs/hh enable_hh -wine_fn_config_makefile programs/hostname enable_hostname -wine_fn_config_makefile programs/icacls enable_icacls -wine_fn_config_makefile programs/icinfo enable_icinfo -wine_fn_config_makefile programs/iexplore enable_iexplore -wine_fn_config_makefile programs/ipconfig enable_ipconfig -wine_fn_config_makefile programs/klist enable_klist -wine_fn_config_makefile programs/lodctr enable_lodctr -wine_fn_config_makefile programs/mofcomp enable_mofcomp -wine_fn_config_makefile programs/mshta enable_mshta -wine_fn_config_makefile programs/msidb enable_msidb -wine_fn_config_makefile programs/msiexec enable_msiexec -wine_fn_config_makefile programs/msinfo32 enable_msinfo32 -wine_fn_config_makefile programs/net enable_net -wine_fn_config_makefile programs/netsh enable_netsh -wine_fn_config_makefile programs/netstat enable_netstat -wine_fn_config_makefile programs/ngen enable_ngen -wine_fn_config_makefile programs/notepad enable_notepad -wine_fn_config_makefile programs/oleview enable_oleview -wine_fn_config_makefile programs/ping enable_ping -wine_fn_config_makefile programs/plugplay enable_plugplay -wine_fn_config_makefile programs/pnputil enable_pnputil -wine_fn_config_makefile programs/powershell enable_powershell -wine_fn_config_makefile programs/presentationfontcache enable_presentationfontcache -wine_fn_config_makefile programs/progman enable_progman -wine_fn_config_makefile programs/reg enable_reg -wine_fn_config_makefile programs/reg/tests enable_tests -wine_fn_config_makefile programs/regasm enable_regasm -wine_fn_config_makefile programs/regedit enable_regedit -wine_fn_config_makefile programs/regedit/tests enable_tests -wine_fn_config_makefile programs/regini enable_regini -wine_fn_config_makefile programs/regsvcs enable_regsvcs -wine_fn_config_makefile programs/regsvr32 enable_regsvr32 -wine_fn_config_makefile programs/robocopy enable_robocopy -wine_fn_config_makefile programs/rpcss enable_rpcss -wine_fn_config_makefile programs/rundll.exe16 enable_win16 -wine_fn_config_makefile programs/rundll32 enable_rundll32 -wine_fn_config_makefile programs/sc enable_sc -wine_fn_config_makefile programs/sc/tests enable_tests -wine_fn_config_makefile programs/schtasks enable_schtasks -wine_fn_config_makefile programs/schtasks/tests enable_tests -wine_fn_config_makefile programs/sdbinst enable_sdbinst -wine_fn_config_makefile programs/secedit enable_secedit -wine_fn_config_makefile programs/servicemodelreg enable_servicemodelreg -wine_fn_config_makefile programs/services enable_services -wine_fn_config_makefile programs/services/tests enable_tests -wine_fn_config_makefile programs/setx enable_setx -wine_fn_config_makefile programs/shutdown enable_shutdown -wine_fn_config_makefile programs/spoolsv enable_spoolsv -wine_fn_config_makefile programs/start enable_start -wine_fn_config_makefile programs/subst enable_subst -wine_fn_config_makefile programs/svchost enable_svchost -wine_fn_config_makefile programs/systeminfo enable_systeminfo -wine_fn_config_makefile programs/taskkill enable_taskkill -wine_fn_config_makefile programs/tasklist enable_tasklist -wine_fn_config_makefile programs/tasklist/tests enable_tests -wine_fn_config_makefile programs/taskmgr enable_taskmgr -wine_fn_config_makefile programs/termsv enable_termsv -wine_fn_config_makefile programs/uninstaller enable_uninstaller -wine_fn_config_makefile programs/unlodctr enable_unlodctr -wine_fn_config_makefile programs/view enable_view -wine_fn_config_makefile programs/wevtutil enable_wevtutil -wine_fn_config_makefile programs/where enable_where -wine_fn_config_makefile programs/whoami enable_whoami -wine_fn_config_makefile programs/wineboot enable_wineboot -wine_fn_config_makefile programs/winebrowser enable_winebrowser -wine_fn_config_makefile programs/winecfg enable_winecfg -wine_fn_config_makefile programs/wineconsole enable_wineconsole -wine_fn_config_makefile programs/winedbg enable_winedbg -wine_fn_config_makefile programs/winedevice enable_winedevice -wine_fn_config_makefile programs/winefile enable_winefile -wine_fn_config_makefile programs/winemenubuilder enable_winemenubuilder -wine_fn_config_makefile programs/winemine enable_winemine -wine_fn_config_makefile programs/winemsibuilder enable_winemsibuilder -wine_fn_config_makefile programs/winepath enable_winepath -wine_fn_config_makefile programs/winetest enable_winetest -wine_fn_config_makefile programs/winevdm enable_win16 -wine_fn_config_makefile programs/winhelp.exe16 enable_win16 -wine_fn_config_makefile programs/winhlp32 enable_winhlp32 -wine_fn_config_makefile programs/winmgmt enable_winmgmt -wine_fn_config_makefile programs/winoldap.mod16 enable_win16 -wine_fn_config_makefile programs/winver enable_winver -wine_fn_config_makefile programs/wmic enable_wmic -wine_fn_config_makefile programs/wmplayer enable_wmplayer -wine_fn_config_makefile programs/wordpad enable_wordpad -wine_fn_config_makefile programs/write enable_write -wine_fn_config_makefile programs/wscript enable_wscript -wine_fn_config_makefile programs/wscript/tests enable_tests -wine_fn_config_makefile programs/wuauserv enable_wuauserv -wine_fn_config_makefile programs/wusa enable_wusa -wine_fn_config_makefile programs/xcopy enable_xcopy -wine_fn_config_makefile programs/xcopy/tests enable_tests -wine_fn_config_makefile server enable_server -test "x$enable_tools" = xno || wine_fn_config_makefile tools enable_tools -test "x$enable_tools" = xno || wine_fn_config_makefile tools/sfnt2fon enable_sfnt2fon -test "x$enable_tools" = xno || wine_fn_config_makefile tools/widl enable_widl -test "x$enable_tools" = xno || wine_fn_config_makefile tools/winebuild enable_winebuild -test "x$enable_tools" = xno || wine_fn_config_makefile tools/winedump enable_winedump -test "x$enable_tools" = xno || wine_fn_config_makefile tools/winegcc enable_winegcc -test "x$enable_tools" = xno || wine_fn_config_makefile tools/winemaker enable_winemaker -test "x$enable_tools" = xno || wine_fn_config_makefile tools/wmc enable_wmc -test "x$enable_tools" = xno || wine_fn_config_makefile tools/wrc enable_wrc - - -as_fn_append CONFIGURE_TARGETS " TAGS" -as_fn_append CONFIGURE_TARGETS " tags" -as_fn_append CONFIGURE_TARGETS " autom4te.cache" -as_fn_append CONFIGURE_TARGETS " config.log" -as_fn_append CONFIGURE_TARGETS " config.status" -as_fn_append CONFIGURE_TARGETS " include/config.h" -as_fn_append CONFIGURE_TARGETS " include/stamp-h" -test "$wine_binary" = wine || as_fn_append CONFIGURE_TARGETS " loader/wine" - -if test "x$enable_tools" != xno -then - as_fn_append CONFIGURE_TARGETS " tools/makedep$ac_exeext" - ac_config_commands="$ac_config_commands tools/makedep" - -fi - -ac_config_commands="$ac_config_commands Makefile" - - - -SHELL=/bin/sh - - -as_fn_append wine_rules " -all: wine - @echo \"Wine build complete.\" -.INIT: Makefile -.MAKEFILEDEPS: -all: Makefile -Makefile: config.status \$(MAKEDEP) - @./config.status Makefile -depend: \$(MAKEDEP) - \$(MAKEDEP)$makedep_flags" - - -as_fn_append wine_rules " -config.status: ${wine_srcdir}configure - @./config.status --recheck -include/config.h: include/stamp-h -include/stamp-h: ${wine_srcdir}include/config.h.in config.status - @./config.status include/config.h include/stamp-h" - -if test "x$enable_maintainer_mode" = xyes -then - as_fn_append wine_rules " -configure: configure.ac aclocal.m4 - autoconf --warnings=all -include/config.h.in: include/stamp-h.in -include/stamp-h.in: configure.ac aclocal.m4 - autoheader --warnings=all - @echo timestamp > \$@" -fi - -if test "x$enable_tools" != xno -then - as_fn_append wine_rules " -tools/makedep$ac_exeext: ${wine_srcdir}tools/makedep.c include/config.h config.status - @./config.status tools/makedep -Makefile: tools/makedep$ac_exeext" -else - as_fn_append wine_rules " -\$(MAKEDEP): - @echo \"You need to run make in $toolsdir first\" && false" -fi - - -if test -n "$with_wine64" -then - case "$with_wine64" in - /*) reldir="" ;; - *) reldir="../" ;; - esac - rm -f fonts server 2>/dev/null - as_fn_append wine_rules " -all: loader/wine64 loader/wine64-preloader $with_wine64/loader/wine $with_wine64/loader/wine-preloader -loader/wine64 loader/wine64-preloader: - rm -f \$@ && \$(LN_S) $reldir$with_wine64/\$@ \$@ -$with_wine64/loader/wine: - rm -f \$@ && \$(LN_S) $ac_pwd/loader/wine \$@ -$with_wine64/loader/wine-preloader: - rm -f \$@ && \$(LN_S) $ac_pwd/loader/wine-preloader \$@ -clean:: - rm -f loader/wine64 loader/wine64-preloader $with_wine64/loader/wine $with_wine64/loader/wine-preloader" -else - TOP_INSTALL_DEV="$TOP_INSTALL_DEV include" - TOP_INSTALL_LIB="$TOP_INSTALL_LIB \ -fonts \ -loader/wine.inf \ -nls \ -programs/msidb/msidb \ -programs/msiexec/msiexec \ -programs/notepad/notepad \ -programs/regedit/regedit \ -programs/regsvr32/regsvr32 \ -programs/wineboot/wineboot \ -programs/winecfg/winecfg \ -programs/wineconsole/wineconsole \ -programs/winedbg/winedbg \ -programs/winefile/winefile \ -programs/winemine/winemine \ -programs/winepath/winepath \ -server/wineserver" - - case $host_os in - cygwin*|mingw32*|darwin*|macosx*|linux-android*) ;; - *) TOP_INSTALL_LIB="$TOP_INSTALL_LIB loader/wine.desktop" ;; - esac -fi - - -as_fn_append wine_rules " -distclean:: clean - rm -rf autom4te.cache -maintainer-clean:: - rm -f configure include/config.h.in" - - -as_fn_append wine_rules " -dlls/ntdll/unix/version.c: dummy - @version=\`(GIT_DIR=${wine_srcdir}.git git describe HEAD 2>/dev/null || echo \"wine-\$(PACKAGE_VERSION)\") | sed -n -e '\$\$s/\(.*\)/const char wine_build[] = \"\\1\";/p'\` && (echo \$\$version | cmp -s - \$@) || echo \$\$version >\$@ || (rm -f \$@ && exit 1) -programs/winetest/build.rc: dummy - @build=\"STRINGTABLE { 1 \\\"\`GIT_DIR=${wine_srcdir}.git git rev-parse HEAD 2>/dev/null\`\\\" }\" && (echo \$\$build | cmp -s - \$@) || echo \$\$build >\$@ || (rm -f \$@ && exit 1) -programs/winetest/build.nfo: - @-\$(CC) -v 2>\$@ -dlls/wineandroid.drv/wine-debug.apk: dlls/wineandroid.drv/build.gradle ${wine_srcdir}dlls/wineandroid.drv/AndroidManifest.xml ${wine_srcdir}dlls/wineandroid.drv/WineActivity.java ${wine_srcdir}dlls/wineandroid.drv/wine.svg - cd dlls/wineandroid.drv && gradle -q -Psrcdir=$srcdir assembleDebug - mv dlls/wineandroid.drv/build/outputs/apk/wine-debug.apk \$@" - - -TAGSFLAGS="--langmap='c:+.idl.l.rh,make:(Make*.in)'" - -as_fn_append wine_rules " -TAGS etags: - rm -f TAGS - (test -d .git && git ls-files || find -L $srcdir -name '*.[ch]' -print) | xargs etags -a \$(TAGSFLAGS) -tags ctags: - rm -f tags - (test -d .git && git ls-files || find -L $srcdir -name '*.[ch]' -print) | xargs ctags -a \$(TAGSFLAGS) -dummy: -.PHONY: depend dummy install-manpages" - -printf "%s\n" " done" >&6 -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -printf "%s\n" "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else $as_nop - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. -as_nl=' -' -export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi - -# The user is always right. -if ${PATH_SEPARATOR+false} :; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - printf "%s\n" "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else $as_nop - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else $as_nop - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by Wine $as_me 9.0, which was -generated by GNU Autoconf 2.71. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_headers="$ac_config_headers" -config_links="$ac_config_links" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration headers: -$config_headers - -Configuration links: -$config_links - -Configuration commands: -$config_commands - -Report bugs to . -Wine home page: ." - -_ACEOF -ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` -ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config='$ac_cs_config_escaped' -ac_cs_version="\\ -Wine config.status 9.0 -configured by $0, generated by GNU Autoconf 2.71, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2021 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - printf "%s\n" "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - printf "%s\n" "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - printf "%s\n" "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - printf "%s\n" "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -wine_fn_output_makedep () -{ - as_dir=tools; as_fn_mkdir_p - $CC -I${wine_srcdir}tools -Iinclude -I${wine_srcdir}include -D__WINESRC__ -DWINE_UNIX_LIB $EXTRACFLAGS $CPPFLAGS $CFLAGS -o tools/makedep$ac_exeext ${wine_srcdir}tools/makedep.c $LDFLAGS -} -wine_fn_output_makefile () -{ - cat <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$1 && "$wine_makedep"$makedep_flags && return -# This Makefile understands the following targets: -# -# all (default): build wine -# clean: remove all intermediate files -# distclean: also remove all files created by configure -# test: run tests -# testclean: clean test results to force running all tests again -# install-lib: install libraries needed to run applications -# install-dev: install development environment -# install: install everything -# uninstall: uninstall everything -# ctags: create a tags file for vim and others. -# etags: create a TAGS file for Emacs. - -SHELL = $SHELL -PATH_SEPARATOR = $PATH_SEPARATOR -PACKAGE_NAME = $PACKAGE_NAME -PACKAGE_TARNAME = $PACKAGE_TARNAME -PACKAGE_VERSION = $PACKAGE_VERSION -PACKAGE_STRING = $PACKAGE_STRING -PACKAGE_BUGREPORT = $PACKAGE_BUGREPORT -PACKAGE_URL = $PACKAGE_URL -exec_prefix = $exec_prefix -prefix = $prefix -program_transform_name = $program_transform_name -bindir = $bindir -sbindir = $sbindir -libexecdir = $libexecdir -datarootdir = $datarootdir -datadir = $datadir -sysconfdir = $sysconfdir -sharedstatedir = $sharedstatedir -localstatedir = $localstatedir -runstatedir = $runstatedir -includedir = $includedir -oldincludedir = $oldincludedir -docdir = $docdir -infodir = $infodir -htmldir = $htmldir -dvidir = $dvidir -pdfdir = $pdfdir -psdir = $psdir -libdir = $libdir -localedir = $localedir -mandir = $mandir -DEFS = $DEFS -ECHO_C = $ECHO_C -ECHO_N = $ECHO_N -ECHO_T = $ECHO_T -LIBS = $LIBS -build_alias = $build_alias -host_alias = $host_alias -target_alias = $target_alias -system_dllpath = $system_dllpath -build = $build -build_cpu = $build_cpu -build_vendor = $build_vendor -build_os = $build_os -host = $host -host_cpu = $host_cpu -host_vendor = $host_vendor -host_os = $host_os -dlldir = $dlldir -fontdir = $fontdir -nlsdir = $nlsdir -srcdir = $srcdir -SET_MAKE = $SET_MAKE -CC = $CC -CFLAGS = $CFLAGS -LDFLAGS = $LDFLAGS -CPPFLAGS = $CPPFLAGS -ac_ct_CC = $ac_ct_CC -EXEEXT = $EXEEXT -OBJEXT = $OBJEXT -CXX = $CXX -CXXFLAGS = $CXXFLAGS -ac_ct_CXX = $ac_ct_CXX -CPPBIN = $CPPBIN -LD = $LD -TARGETFLAGS = $TARGETFLAGS -toolsext = $toolsext -HOST_ARCH = $HOST_ARCH -aarch64_CC = $aarch64_CC -aarch64_CFLAGS = $aarch64_CFLAGS -aarch64_EXTRACFLAGS = $aarch64_EXTRACFLAGS -aarch64_LDFLAGS = $aarch64_LDFLAGS -aarch64_DEBUG = $aarch64_DEBUG -aarch64_TARGET = $aarch64_TARGET -aarch64_DELAYLOADFLAG = $aarch64_DELAYLOADFLAG -aarch64_DISABLED_SUBDIRS = $aarch64_DISABLED_SUBDIRS -arm_CC = $arm_CC -arm_CFLAGS = $arm_CFLAGS -arm_EXTRACFLAGS = $arm_EXTRACFLAGS -arm_LDFLAGS = $arm_LDFLAGS -arm_DEBUG = $arm_DEBUG -arm_TARGET = $arm_TARGET -arm_DELAYLOADFLAG = $arm_DELAYLOADFLAG -arm_DISABLED_SUBDIRS = $arm_DISABLED_SUBDIRS -arm64ec_CC = $arm64ec_CC -arm64ec_CFLAGS = $arm64ec_CFLAGS -arm64ec_EXTRACFLAGS = $arm64ec_EXTRACFLAGS -arm64ec_LDFLAGS = $arm64ec_LDFLAGS -arm64ec_DEBUG = $arm64ec_DEBUG -arm64ec_TARGET = $arm64ec_TARGET -arm64ec_DELAYLOADFLAG = $arm64ec_DELAYLOADFLAG -arm64ec_DISABLED_SUBDIRS = $arm64ec_DISABLED_SUBDIRS -i386_CC = $i386_CC -i386_CFLAGS = $i386_CFLAGS -i386_EXTRACFLAGS = $i386_EXTRACFLAGS -i386_LDFLAGS = $i386_LDFLAGS -i386_DEBUG = $i386_DEBUG -i386_TARGET = $i386_TARGET -i386_DELAYLOADFLAG = $i386_DELAYLOADFLAG -i386_DISABLED_SUBDIRS = $i386_DISABLED_SUBDIRS -x86_64_CC = $x86_64_CC -x86_64_CFLAGS = $x86_64_CFLAGS -x86_64_EXTRACFLAGS = $x86_64_EXTRACFLAGS -x86_64_LDFLAGS = $x86_64_LDFLAGS -x86_64_DEBUG = $x86_64_DEBUG -x86_64_TARGET = $x86_64_TARGET -x86_64_DELAYLOADFLAG = $x86_64_DELAYLOADFLAG -x86_64_DISABLED_SUBDIRS = $x86_64_DISABLED_SUBDIRS -toolsdir = $toolsdir -MAKEDEP = $MAKEDEP -RUNTESTFLAGS = $RUNTESTFLAGS -SED_CMD = $SED_CMD -FLEX = $FLEX -BISON = $BISON -AR = $AR -ac_ct_AR = $ac_ct_AR -STRIP = $STRIP -RANLIB = $RANLIB -LN_S = $LN_S -GREP = $GREP -EGREP = $EGREP -LDCONFIG = $LDCONFIG -MSGFMT = $MSGFMT -PKG_CONFIG = $PKG_CONFIG -FONTFORGE = $FONTFORGE -RSVG = $RSVG -CONVERT = $CONVERT -ICOTOOL = $ICOTOOL -I386_LIBS = $I386_LIBS -OPENGL_LIBS = $OPENGL_LIBS -DLLFLAGS = $DLLFLAGS -LDDLLFLAGS = $LDDLLFLAGS -LDEXECFLAGS = $LDEXECFLAGS -EXTRACFLAGS = $EXTRACFLAGS -UNIXDLLFLAGS = $UNIXDLLFLAGS -UNIXLDFLAGS = $UNIXLDFLAGS -TOP_INSTALL_LIB = $TOP_INSTALL_LIB -TOP_INSTALL_DEV = $TOP_INSTALL_DEV -WINELOADER_LDFLAGS = $WINELOADER_LDFLAGS -WINEPRELOADER_LDFLAGS = $WINEPRELOADER_LDFLAGS -DLLEXT = $DLLEXT -LDD = $LDD -OTOOL = $OTOOL -READELF = $READELF -SUBDIRS = $SUBDIRS -DISABLED_SUBDIRS = $DISABLED_SUBDIRS -CONFIGURE_TARGETS = $CONFIGURE_TARGETS -CARBON_LIBS = $CARBON_LIBS -COREFOUNDATION_LIBS = $COREFOUNDATION_LIBS -DISKARBITRATION_LIBS = $DISKARBITRATION_LIBS -IOKIT_LIBS = $IOKIT_LIBS -METAL_LIBS = $METAL_LIBS -APPLICATIONSERVICES_LIBS = $APPLICATIONSERVICES_LIBS -CORESERVICES_LIBS = $CORESERVICES_LIBS -APPKIT_LIBS = $APPKIT_LIBS -SECURITY_LIBS = $SECURITY_LIBS -SYSTEMCONFIGURATION_LIBS = $SYSTEMCONFIGURATION_LIBS -COREAUDIO_LIBS = $COREAUDIO_LIBS -OPENCL_LIBS = $OPENCL_LIBS -OBJC = $OBJC -OBJCFLAGS = $OBJCFLAGS -ac_ct_OBJC = $ac_ct_OBJC -WINELOADER_DEPENDS = $WINELOADER_DEPENDS -PE_ARCHS = $PE_ARCHS -MINGW_PKG_CONFIG = $MINGW_PKG_CONFIG -FAUDIO_PE_CFLAGS = $FAUDIO_PE_CFLAGS -FAUDIO_PE_LIBS = $FAUDIO_PE_LIBS -FLUIDSYNTH_PE_CFLAGS = $FLUIDSYNTH_PE_CFLAGS -FLUIDSYNTH_PE_LIBS = $FLUIDSYNTH_PE_LIBS -GSM_PE_CFLAGS = $GSM_PE_CFLAGS -GSM_PE_LIBS = $GSM_PE_LIBS -JPEG_PE_CFLAGS = $JPEG_PE_CFLAGS -JPEG_PE_LIBS = $JPEG_PE_LIBS -JXR_PE_CFLAGS = $JXR_PE_CFLAGS -JXR_PE_LIBS = $JXR_PE_LIBS -LCMS2_PE_CFLAGS = $LCMS2_PE_CFLAGS -LCMS2_PE_LIBS = $LCMS2_PE_LIBS -LDAP_PE_CFLAGS = $LDAP_PE_CFLAGS -LDAP_PE_LIBS = $LDAP_PE_LIBS -MPG123_PE_CFLAGS = $MPG123_PE_CFLAGS -MPG123_PE_LIBS = $MPG123_PE_LIBS -MUSL_PE_CFLAGS = $MUSL_PE_CFLAGS -MUSL_PE_LIBS = $MUSL_PE_LIBS -PNG_PE_CFLAGS = $PNG_PE_CFLAGS -PNG_PE_LIBS = $PNG_PE_LIBS -TIFF_PE_CFLAGS = $TIFF_PE_CFLAGS -TIFF_PE_LIBS = $TIFF_PE_LIBS -VKD3D_PE_CFLAGS = $VKD3D_PE_CFLAGS -VKD3D_PE_LIBS = $VKD3D_PE_LIBS -XML2_PE_CFLAGS = $XML2_PE_CFLAGS -XML2_PE_LIBS = $XML2_PE_LIBS -XSLT_PE_CFLAGS = $XSLT_PE_CFLAGS -XSLT_PE_LIBS = $XSLT_PE_LIBS -ZLIB_PE_CFLAGS = $ZLIB_PE_CFLAGS -ZLIB_PE_LIBS = $ZLIB_PE_LIBS -ZYDIS_PE_CFLAGS = $ZYDIS_PE_CFLAGS -ZYDIS_PE_LIBS = $ZYDIS_PE_LIBS -PTHREAD_LIBS = $PTHREAD_LIBS -XMKMF = $XMKMF -CPP = $CPP -X_CFLAGS = $X_CFLAGS -X_PRE_LIBS = $X_PRE_LIBS -X_LIBS = $X_LIBS -X_EXTRA_LIBS = $X_EXTRA_LIBS -WAYLAND_CLIENT_CFLAGS = $WAYLAND_CLIENT_CFLAGS -WAYLAND_CLIENT_LIBS = $WAYLAND_CLIENT_LIBS -WAYLAND_SCANNER = $WAYLAND_SCANNER -XKBCOMMON_CFLAGS = $XKBCOMMON_CFLAGS -XKBCOMMON_LIBS = $XKBCOMMON_LIBS -XKBREGISTRY_CFLAGS = $XKBREGISTRY_CFLAGS -XKBREGISTRY_LIBS = $XKBREGISTRY_LIBS -PCAP_LIBS = $PCAP_LIBS -PCSCLITE_LIBS = $PCSCLITE_LIBS -INOTIFY_CFLAGS = $INOTIFY_CFLAGS -INOTIFY_LIBS = $INOTIFY_LIBS -DBUS_CFLAGS = $DBUS_CFLAGS -DBUS_LIBS = $DBUS_LIBS -GNUTLS_CFLAGS = $GNUTLS_CFLAGS -GNUTLS_LIBS = $GNUTLS_LIBS -SANE_CFLAGS = $SANE_CFLAGS -SANE_LIBS = $SANE_LIBS -USB_CFLAGS = $USB_CFLAGS -USB_LIBS = $USB_LIBS -GPHOTO2_CFLAGS = $GPHOTO2_CFLAGS -GPHOTO2_LIBS = $GPHOTO2_LIBS -GPHOTO2_PORT_CFLAGS = $GPHOTO2_PORT_CFLAGS -GPHOTO2_PORT_LIBS = $GPHOTO2_PORT_LIBS -RESOLV_LIBS = $RESOLV_LIBS -FREETYPE_CFLAGS = $FREETYPE_CFLAGS -FREETYPE_LIBS = $FREETYPE_LIBS -GETTEXTPO_LIBS = $GETTEXTPO_LIBS -PULSE_CFLAGS = $PULSE_CFLAGS -PULSE_LIBS = $PULSE_LIBS -GSTREAMER_CFLAGS = $GSTREAMER_CFLAGS -GSTREAMER_LIBS = $GSTREAMER_LIBS -ALSA_LIBS = $ALSA_LIBS -OSS4_CFLAGS = $OSS4_CFLAGS -OSS4_LIBS = $OSS4_LIBS -UDEV_CFLAGS = $UDEV_CFLAGS -UDEV_LIBS = $UDEV_LIBS -UNWIND_CFLAGS = $UNWIND_CFLAGS -UNWIND_LIBS = $UNWIND_LIBS -SDL2_CFLAGS = $SDL2_CFLAGS -SDL2_LIBS = $SDL2_LIBS -CAPI20_CFLAGS = $CAPI20_CFLAGS -CAPI20_LIBS = $CAPI20_LIBS -CUPS_CFLAGS = $CUPS_CFLAGS -CUPS_LIBS = $CUPS_LIBS -FONTCONFIG_CFLAGS = $FONTCONFIG_CFLAGS -FONTCONFIG_LIBS = $FONTCONFIG_LIBS -KRB5_CFLAGS = $KRB5_CFLAGS -KRB5_LIBS = $KRB5_LIBS -GSSAPI_CFLAGS = $GSSAPI_CFLAGS -GSSAPI_LIBS = $GSSAPI_LIBS -PROCSTAT_LIBS = $PROCSTAT_LIBS -NETAPI_CFLAGS = $NETAPI_CFLAGS -NETAPI_LIBS = $NETAPI_LIBS -MSVCRTFLAGS = $MSVCRTFLAGS -DELAYLOADFLAG = $DELAYLOADFLAG -WINELOADER_PROGRAMS = $WINELOADER_PROGRAMS -RT_LIBS = $RT_LIBS -TAGSFLAGS = $TAGSFLAGS -LIBOBJS = $LIBOBJS -LTLIBOBJS = $LTLIBOBJS -$SET_MAKE -$wine_rules -_WINE_EOF - as_fn_error $? "could not create Makefile" "$LINENO" 5 -} - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; - "include/stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/stamp-h" ;; - "wine") CONFIG_LINKS="$CONFIG_LINKS wine:tools/winewrapper" ;; - "wine64") CONFIG_LINKS="$CONFIG_LINKS wine64:tools/winewrapper" ;; - "tools/makedep") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/makedep" ;; - "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers - test ${CONFIG_LINKS+y} || CONFIG_LINKS=$config_links - test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -printf "%s\n" "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`printf "%s\n" "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - printf "%s\n" "/* $configure_input */" >&1 \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - printf "%s\n" "/* $configure_input */" >&1 \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - :L) - # - # CONFIG_LINK - # - - if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then - : - else - # Prefer the file from the source tree if names are identical. - if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then - ac_source=$srcdir/$ac_source - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 -printf "%s\n" "$as_me: linking $ac_source to $ac_file" >&6;} - - if test ! -r "$ac_source"; then - as_fn_error $? "$ac_source: file not found" "$LINENO" 5 - fi - rm -f "$ac_file" - - # Try a relative symlink, then a hard link, then a copy. - case $ac_source in - [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; - *) ac_rel_source=$ac_top_build_prefix$ac_source ;; - esac - ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || - ln "$ac_source" "$ac_file" 2>/dev/null || - cp -p "$ac_source" "$ac_file" || - as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 - fi - ;; - :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -printf "%s\n" "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "include/stamp-h":C) echo timestamp > include/stamp-h ;; - "tools/makedep":C) wine_fn_output_makedep || as_fn_exit $? ;; - "Makefile":C) wine_fn_output_makefile Makefile ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -if test "$no_create" = "yes" -then - exit 0 -fi - -ac_save_IFS="$IFS" -if test "x$wine_notices" != x; then - echo >&6 - IFS="|" - for msg in $wine_notices; do - IFS="$ac_save_IFS" - if ${msg:+false} : -then : - -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $msg" >&5 -printf "%s\n" "$as_me: $msg" >&6;} -fi - done -fi -IFS="|" -for msg in $wine_warnings; do - IFS="$ac_save_IFS" - if ${msg:+false} : -then : - -else $as_nop - echo >&2 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $msg" >&5 -printf "%s\n" "$as_me: WARNING: $msg" >&2;} -fi -done -IFS="$ac_save_IFS" - -printf "%s\n" " -$as_me: Finished. Do '${ac_make}' to compile Wine. -" >&6 - - diff --git a/include/config.h.in b/include/config.h.in deleted file mode 100644 index cda76fcfe2e..00000000000 --- a/include/config.h.in +++ /dev/null @@ -1,836 +0,0 @@ -/* include/config.h.in. Generated from configure.ac by autoheader. */ - -#ifndef __WINE_CONFIG_H -#define __WINE_CONFIG_H - -/* Define to the file extension for executables. */ -#undef EXEEXT - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_NAMESER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_USER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CAPI20_H - -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_CL_CL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CUPS_CUPS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CUPS_PPD_H - -/* Define to 1 if you have the `dladdr1' function. */ -#undef HAVE_DLADDR1 - -/* Define to 1 if you have the `dlinfo' function. */ -#undef HAVE_DLINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_EGL_EGL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ELF_H - -/* Define to 1 if you have the `epoll_create' function. */ -#undef HAVE_EPOLL_CREATE - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLOAT_H - -/* Define if FreeType 2 is installed */ -#undef HAVE_FREETYPE - -/* Define to 1 if you have the `fstatfs' function. */ -#undef HAVE_FSTATFS - -/* Define to 1 if you have the header file. */ -#undef HAVE_FT2BUILD_H - -/* Define to 1 if the system has the type `FT_TrueTypeEngineType'. */ -#undef HAVE_FT_TRUETYPEENGINETYPE - -/* Define to 1 if you have the `futimens' function. */ -#undef HAVE_FUTIMENS - -/* Define to 1 if you have the `futimes' function. */ -#undef HAVE_FUTIMES - -/* Define to 1 if you have the `futimesat' function. */ -#undef HAVE_FUTIMESAT - -/* Define to 1 if you have the `getaddrinfo' function. */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the `getattrlist' function. */ -#undef HAVE_GETATTRLIST - -/* Define to 1 if you have the `getauxval' function. */ -#undef HAVE_GETAUXVAL - -/* Define to 1 if you have the `getifaddrs' function. */ -#undef HAVE_GETIFADDRS - -/* Define to 1 if you have the `getrandom' function. */ -#undef HAVE_GETRANDOM - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETTEXT_PO_H - -/* Define to 1 if you have the `gnutls_cipher_init' function. */ -#undef HAVE_GNUTLS_CIPHER_INIT - -/* Define if we have the libgphoto2_port development environment */ -#undef HAVE_GPHOTO2_PORT - -/* Define to 1 if you have the header file. */ -#undef HAVE_GSSAPI_GSSAPI_EXT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_GSSAPI_GSSAPI_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_IFADDRS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `kqueue' function. */ -#undef HAVE_KQUEUE - -/* Define to 1 if you have the header file. */ -#undef HAVE_KRB5_KRB5_H - -/* Define to 1 if you have the `gettextpo' library (-lgettextpo). */ -#undef HAVE_LIBGETTEXTPO - -/* Define to 1 if you have the `procstat' library (-lprocstat). */ -#undef HAVE_LIBPROCSTAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBPROCSTAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBPROC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBUDEV_H - -/* Define to 1 if you have the `unwind' library (-lunwind). */ -#undef HAVE_LIBUNWIND - -/* Define if you have the X Shape extension */ -#undef HAVE_LIBXSHAPE - -/* Define if you have the X Shm extension */ -#undef HAVE_LIBXXSHM - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_CAPI_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_CDROM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_FILTER_H - -/* Define if Linux-style gethostbyname_r and gethostbyaddr_r are available */ -#undef HAVE_LINUX_GETHOSTBYNAME_R_6 - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_HDREG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_HIDRAW_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_INPUT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IPX_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IRDA_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_MAJOR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_RTNETLINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_SERIAL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_UCDROM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_VIDEODEV2_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_WIRELESS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LWP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_CPU_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_SYSARCH_H - -/* Define to 1 if you have the `mach_continuous_time' function. */ -#undef HAVE_MACH_CONTINUOUS_TIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACH_MACH_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACH_O_LOADER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MNTENT_H - -/* Define if MTLDevice protocol has registryID property. */ -#undef HAVE_MTLDEVICE_REGISTRYID - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET6_IP6_VAR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_ICMP6_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_ICMP_VAR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IF_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_PCB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_SYSTM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_ICMP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_VAR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_TCP_FSM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_TCP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_TCP_VAR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_UDP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_UDP_VAR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETIPX_IPX_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_ARP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_DL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_ROUTE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENCL_OPENCL_H - -/* Define to 1 if `numaudioengines' is a member of `oss_sysinfo'. */ -#undef HAVE_OSS_SYSINFO_NUMAUDIOENGINES - -/* Define to 1 if you have the header file. */ -#undef HAVE_PCAP_PCAP_H - -/* Define to 1 if you have the `pipe2' function. */ -#undef HAVE_PIPE2 - -/* Define to 1 if you have the `port_create' function. */ -#undef HAVE_PORT_CREATE - -/* Define to 1 if you have the header file. */ -#undef HAVE_PORT_H - -/* Define to 1 if you have the `posix_fadvise' function. */ -#undef HAVE_POSIX_FADVISE - -/* Define to 1 if you have the `posix_fallocate' function. */ -#undef HAVE_POSIX_FALLOCATE - -/* Define to 1 if you have the `prctl' function. */ -#undef HAVE_PRCTL - -/* Define to 1 if you have the `proc_pidinfo' function. */ -#undef HAVE_PROC_PIDINFO - -/* Define to 1 if you have the `pthread_getthreadid_np' function. */ -#undef HAVE_PTHREAD_GETTHREADID_NP - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTHREAD_NP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PWD_H - -/* Define to 1 if the system has the type `request_sense'. */ -#undef HAVE_REQUEST_SENSE - -/* Define if you have the resolver library and header */ -#undef HAVE_RESOLV - -/* Define to 1 if you have the header file. */ -#undef HAVE_RESOLV_H - -/* Define to 1 if you have the `res_getservers' function. */ -#undef HAVE_RES_GETSERVERS - -/* Define to 1 if you have the header file. */ -#undef HAVE_SCHED_H - -/* Define to 1 if you have the `sched_setaffinity' function. */ -#undef HAVE_SCHED_SETAFFINITY - -/* Define to 1 if you have the `sched_yield' function. */ -#undef HAVE_SCHED_YIELD - -/* Define to 1 if `cmd' is a member of `scsireq_t'. */ -#undef HAVE_SCSIREQ_T_CMD - -/* Define to 1 if you have the header file. */ -#undef HAVE_SCSI_SCSI_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SCSI_SCSI_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SCSI_SG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SDL_H - -/* Define to 1 if you have the `setproctitle' function. */ -#undef HAVE_SETPROCTITLE - -/* Define to 1 if you have the `setprogname' function. */ -#undef HAVE_SETPROGNAME - -/* Define to 1 if `interface_id' is a member of `sg_io_hdr_t'. */ -#undef HAVE_SG_IO_HDR_T_INTERFACE_ID - -/* Define to 1 if `si_fd' is a member of `siginfo_t'. */ -#undef HAVE_SIGINFO_T_SI_FD - -/* Define to 1 if you have the `sigprocmask' function. */ -#undef HAVE_SIGPROCMASK - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if `icp6s_error' is a member of `struct icmp6stat'. */ -#undef HAVE_STRUCT_ICMP6STAT_ICP6S_ERROR - -/* Define to 1 if `icps_error' is a member of `struct icmpstat'. */ -#undef HAVE_STRUCT_ICMPSTAT_ICPS_ERROR - -/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */ -#undef HAVE_STRUCT_IFREQ_IFR_HWADDR - -/* Define to 1 if `ipi6_addr' is a member of `struct in6_pktinfo'. */ -#undef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR - -/* Define to 1 if `ip6s_total' is a member of `struct ip6stat'. */ -#undef HAVE_STRUCT_IP6STAT_IP6S_TOTAL - -/* Define to 1 if `ips_total' is a member of `struct ipstat'. */ -#undef HAVE_STRUCT_IPSTAT_IPS_TOTAL - -/* Define to 1 if `ips_total' is a member of `struct ip_stats'. */ -#undef HAVE_STRUCT_IP_STATS_IPS_TOTAL - -/* Define to 1 if `msg_accrights' is a member of `struct msghdr'. */ -#undef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS - -/* Define to 1 if `mt_blkno' is a member of `struct mtget'. */ -#undef HAVE_STRUCT_MTGET_MT_BLKNO - -/* Define to 1 if `mt_blksiz' is a member of `struct mtget'. */ -#undef HAVE_STRUCT_MTGET_MT_BLKSIZ - -/* Define to 1 if `mt_gstat' is a member of `struct mtget'. */ -#undef HAVE_STRUCT_MTGET_MT_GSTAT - -/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */ -#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID - -/* Define to 1 if `sun_len' is a member of `struct sockaddr_un'. */ -#undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN - -/* Define to 1 if `st_atim' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_ATIM - -/* Define to 1 if `st_atimespec' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_ATIMESPEC - -/* Define to 1 if `st_birthtim' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BIRTHTIM - -/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BIRTHTIME - -/* Define to 1 if `st_birthtimespec' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC - -/* Define to 1 if `st_ctim' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_CTIM - -/* Define to 1 if `st_ctimespec' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_CTIMESPEC - -/* Define to 1 if `st_mtim' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_MTIM - -/* Define to 1 if `st_mtimespec' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_MTIMESPEC - -/* Define to 1 if `__st_birthtim' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT___ST_BIRTHTIM - -/* Define to 1 if `__st_birthtime' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT___ST_BIRTHTIME - -/* Define to 1 if `mem_unit' is a member of `struct sysinfo'. */ -#undef HAVE_STRUCT_SYSINFO_MEM_UNIT - -/* Define to 1 if `totalram' is a member of `struct sysinfo'. */ -#undef HAVE_STRUCT_SYSINFO_TOTALRAM - -/* Define to 1 if `tcps_connattempt' is a member of `struct tcpstat'. */ -#undef HAVE_STRUCT_TCPSTAT_TCPS_CONNATTEMPT - -/* Define to 1 if `tcps_connattempt' is a member of `struct tcp_stats'. */ -#undef HAVE_STRUCT_TCP_STATS_TCPS_CONNATTEMPT - -/* Define to 1 if `udps_ipackets' is a member of `struct udpstat'. */ -#undef HAVE_STRUCT_UDPSTAT_UDPS_IPACKETS - -/* Define to 1 if the system has the type `struct xinpgen'. */ -#undef HAVE_STRUCT_XINPGEN - -/* Define to 1 if `_u._ext.nscount6' is a member of `struct __res_state'. */ -#undef HAVE_STRUCT___RES_STATE__U__EXT_NSCOUNT6 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYSCALL_H - -/* Define to 1 if you have the `sysinfo' function. */ -#undef HAVE_SYSINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_ATTR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_AUXV_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_CDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_CONF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EVENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EXTATTR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_INOTIFY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IPC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MODEM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MTIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PRCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PTRACE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_QUEUE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RANDOM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SCSIIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SHM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SIGNAL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKETVAR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STATFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STATVFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STRTIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSCALL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_THR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UCONTEXT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_USER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VNODE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_XATTR_H - -/* Define to 1 if you have the `tcdrain' function. */ -#undef HAVE_TCDRAIN - -/* Define to 1 if you have the `thr_kill2' function. */ -#undef HAVE_THR_KILL2 - -/* Define to 1 if you have the `udev' library (-ludev). */ -#undef HAVE_UDEV - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_VALGRIND_MEMCHECK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_VALGRIND_VALGRIND_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_SHAPE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XF86VMODE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XF86VMPROTO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XFIXES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XINERAMA_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XINPUT2_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XRANDR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XRENDER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XSHM_H - -/* Define to 1 if `xcookie' is a member of `XEvent'. */ -#undef HAVE_XEVENT_XCOOKIE - -/* Define to 1 if `callback' is a member of `XICCallback'. */ -#undef HAVE_XICCALLBACK_CALLBACK - -/* Define to 1 if you have the header file. */ -#undef HAVE_XKBCOMMON_XKBCOMMON_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_XKBCOMMON_XKBREGISTRY_H - -/* Define if Xrender has the XRenderCreateLinearGradient function */ -#undef HAVE_XRENDERCREATELINEARGRADIENT - -/* Define if Xrender has the XRenderSetPictureTransform function */ -#undef HAVE_XRENDERSETPICTURETRANSFORM - -/* Define if Xrandr has the XRRGetProviderResources function */ -#undef HAVE_XRRGETPROVIDERRESOURCES - -/* Define to 1 if you have the `__builtin_popcount' built-in function. */ -#undef HAVE___BUILTIN_POPCOUNT - -/* Define to 1 if you have the `__clear_cache' (potentially built-in) - function. */ -#undef HAVE___CLEAR_CACHE - -/* Define to 1 if `major', `minor', and `makedev' are declared in . - */ -#undef MAJOR_IN_MKDEV - -/* Define to 1 if `major', `minor', and `makedev' are declared in - . */ -#undef MAJOR_IN_SYSMACROS - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to the soname of the libcups library. */ -#undef SONAME_LIBCUPS - -/* Define to the soname of the libdbus-1 library. */ -#undef SONAME_LIBDBUS_1 - -/* Define to the soname of the libEGL library. */ -#undef SONAME_LIBEGL - -/* Define to the soname of the libfontconfig library. */ -#undef SONAME_LIBFONTCONFIG - -/* Define to the soname of the libfreetype library. */ -#undef SONAME_LIBFREETYPE - -/* Define to the soname of the libGL library. */ -#undef SONAME_LIBGL - -/* Define to the soname of the libGLESv2 library. */ -#undef SONAME_LIBGLESV2 - -/* Define to the soname of the libgnutls library. */ -#undef SONAME_LIBGNUTLS - -/* Define to the soname of the libgssapi_krb5 library. */ -#undef SONAME_LIBGSSAPI_KRB5 - -/* Define to the soname of the libkrb5 library. */ -#undef SONAME_LIBKRB5 - -/* Define to the soname of the libMoltenVK library. */ -#undef SONAME_LIBMOLTENVK - -/* Define to the soname of the libnetapi library. */ -#undef SONAME_LIBNETAPI - -/* Define to the soname of the libodbc library. */ -#undef SONAME_LIBODBC - -/* Define to the soname of the libOSMesa library. */ -#undef SONAME_LIBOSMESA - -/* Define to the soname of the libSDL2 library. */ -#undef SONAME_LIBSDL2 - -/* Define to the soname of the libv4l2 library. */ -#undef SONAME_LIBV4L2 - -/* Define to the soname of the libvulkan library. */ -#undef SONAME_LIBVULKAN - -/* Define to the soname of the libX11 library. */ -#undef SONAME_LIBX11 - -/* Define to the soname of the libXcomposite library. */ -#undef SONAME_LIBXCOMPOSITE - -/* Define to the soname of the libXcursor library. */ -#undef SONAME_LIBXCURSOR - -/* Define to the soname of the libXext library. */ -#undef SONAME_LIBXEXT - -/* Define to the soname of the libXfixes library. */ -#undef SONAME_LIBXFIXES - -/* Define to the soname of the libXi library. */ -#undef SONAME_LIBXI - -/* Define to the soname of the libXinerama library. */ -#undef SONAME_LIBXINERAMA - -/* Define to the soname of the libXrandr library. */ -#undef SONAME_LIBXRANDR - -/* Define to the soname of the libXrender library. */ -#undef SONAME_LIBXRENDER - -/* Define to the soname of the libXxf86vm library. */ -#undef SONAME_LIBXXF86VM - -/* Define to 1 if the `S_IS*' macros in do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if all of the C90 standard headers exist (not just the ones - required in a freestanding environment). This macro is provided for - backward compatibility; new code need not use it. */ -#undef STDC_HEADERS - -/* Define if xattr functions take additional arguments (macOS) */ -#undef XATTR_ADDITIONAL_OPTIONS - -/* Define to 1 if the X Window System is missing or not being used. */ -#undef X_DISPLAY_MISSING - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define to 1 to enable GNU extensions on Linux */ -#undef _GNU_SOURCE - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to 64 to enable 64-bit time_t on Linux */ -#undef _TIME_BITS - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -#endif /* __WINE_CONFIG_H */ From cae723943aba6264d5468161c42acb85538a3d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 4 Dec 2023 18:13:00 +0100 Subject: [PATCH 0005/1506] ntdll, win32u: Remove generated syscall files. --- dlls/ntdll/ntsyscalls.h | 478 --------------------- dlls/win32u/win32syscalls.h | 807 ------------------------------------ 2 files changed, 1285 deletions(-) delete mode 100644 dlls/ntdll/ntsyscalls.h delete mode 100644 dlls/win32u/win32syscalls.h diff --git a/dlls/ntdll/ntsyscalls.h b/dlls/ntdll/ntsyscalls.h deleted file mode 100644 index 7ae20b31159..00000000000 --- a/dlls/ntdll/ntsyscalls.h +++ /dev/null @@ -1,478 +0,0 @@ -/* Automatically generated by tools/make_specfiles */ - -#define ALL_SYSCALLS32 \ - SYSCALL_ENTRY( 0x0000, NtAcceptConnectPort, 24 ) \ - SYSCALL_ENTRY( 0x0001, NtAccessCheck, 32 ) \ - SYSCALL_ENTRY( 0x0002, NtAccessCheckAndAuditAlarm, 44 ) \ - SYSCALL_ENTRY( 0x0003, NtAddAtom, 12 ) \ - SYSCALL_ENTRY( 0x0004, NtAdjustGroupsToken, 24 ) \ - SYSCALL_ENTRY( 0x0005, NtAdjustPrivilegesToken, 24 ) \ - SYSCALL_ENTRY( 0x0006, NtAlertResumeThread, 8 ) \ - SYSCALL_ENTRY( 0x0007, NtAlertThread, 4 ) \ - SYSCALL_ENTRY( 0x0008, NtAlertThreadByThreadId, 4 ) \ - SYSCALL_ENTRY( 0x0009, NtAllocateLocallyUniqueId, 4 ) \ - SYSCALL_ENTRY( 0x000a, NtAllocateUuids, 16 ) \ - SYSCALL_ENTRY( 0x000b, NtAllocateVirtualMemory, 24 ) \ - SYSCALL_ENTRY( 0x000c, NtAllocateVirtualMemoryEx, 28 ) \ - SYSCALL_ENTRY( 0x000d, NtAreMappedFilesTheSame, 8 ) \ - SYSCALL_ENTRY( 0x000e, NtAssignProcessToJobObject, 8 ) \ - SYSCALL_ENTRY( 0x000f, NtCallbackReturn, 12 ) \ - SYSCALL_ENTRY( 0x0010, NtCancelIoFile, 8 ) \ - SYSCALL_ENTRY( 0x0011, NtCancelIoFileEx, 12 ) \ - SYSCALL_ENTRY( 0x0012, NtCancelSynchronousIoFile, 12 ) \ - SYSCALL_ENTRY( 0x0013, NtCancelTimer, 8 ) \ - SYSCALL_ENTRY( 0x0014, NtClearEvent, 4 ) \ - SYSCALL_ENTRY( 0x0015, NtClose, 4 ) \ - SYSCALL_ENTRY( 0x0016, NtCommitTransaction, 8 ) \ - SYSCALL_ENTRY( 0x0017, NtCompareObjects, 8 ) \ - SYSCALL_ENTRY( 0x0018, NtCompleteConnectPort, 4 ) \ - SYSCALL_ENTRY( 0x0019, NtConnectPort, 32 ) \ - SYSCALL_ENTRY( 0x001a, NtContinue, 8 ) \ - SYSCALL_ENTRY( 0x001b, NtCreateDebugObject, 16 ) \ - SYSCALL_ENTRY( 0x001c, NtCreateDirectoryObject, 12 ) \ - SYSCALL_ENTRY( 0x001d, NtCreateEvent, 20 ) \ - SYSCALL_ENTRY( 0x001e, NtCreateFile, 44 ) \ - SYSCALL_ENTRY( 0x001f, NtCreateIoCompletion, 16 ) \ - SYSCALL_ENTRY( 0x0020, NtCreateJobObject, 12 ) \ - SYSCALL_ENTRY( 0x0021, NtCreateKey, 28 ) \ - SYSCALL_ENTRY( 0x0022, NtCreateKeyTransacted, 32 ) \ - SYSCALL_ENTRY( 0x0023, NtCreateKeyedEvent, 16 ) \ - SYSCALL_ENTRY( 0x0024, NtCreateLowBoxToken, 36 ) \ - SYSCALL_ENTRY( 0x0025, NtCreateMailslotFile, 32 ) \ - SYSCALL_ENTRY( 0x0026, NtCreateMutant, 16 ) \ - SYSCALL_ENTRY( 0x0027, NtCreateNamedPipeFile, 56 ) \ - SYSCALL_ENTRY( 0x0028, NtCreatePagingFile, 16 ) \ - SYSCALL_ENTRY( 0x0029, NtCreatePort, 20 ) \ - SYSCALL_ENTRY( 0x002a, NtCreateSection, 28 ) \ - SYSCALL_ENTRY( 0x002b, NtCreateSemaphore, 20 ) \ - SYSCALL_ENTRY( 0x002c, NtCreateSymbolicLinkObject, 16 ) \ - SYSCALL_ENTRY( 0x002d, NtCreateThread, 32 ) \ - SYSCALL_ENTRY( 0x002e, NtCreateThreadEx, 44 ) \ - SYSCALL_ENTRY( 0x002f, NtCreateTimer, 16 ) \ - SYSCALL_ENTRY( 0x0030, NtCreateToken, 52 ) \ - SYSCALL_ENTRY( 0x0031, NtCreateTransaction, 40 ) \ - SYSCALL_ENTRY( 0x0032, NtCreateUserProcess, 44 ) \ - SYSCALL_ENTRY( 0x0033, NtDebugActiveProcess, 8 ) \ - SYSCALL_ENTRY( 0x0034, NtDebugContinue, 12 ) \ - SYSCALL_ENTRY( 0x0035, NtDelayExecution, 8 ) \ - SYSCALL_ENTRY( 0x0036, NtDeleteAtom, 4 ) \ - SYSCALL_ENTRY( 0x0037, NtDeleteFile, 4 ) \ - SYSCALL_ENTRY( 0x0038, NtDeleteKey, 4 ) \ - SYSCALL_ENTRY( 0x0039, NtDeleteValueKey, 8 ) \ - SYSCALL_ENTRY( 0x003a, NtDeviceIoControlFile, 40 ) \ - SYSCALL_ENTRY( 0x003b, NtDisplayString, 4 ) \ - SYSCALL_ENTRY( 0x003c, NtDuplicateObject, 28 ) \ - SYSCALL_ENTRY( 0x003d, NtDuplicateToken, 24 ) \ - SYSCALL_ENTRY( 0x003e, NtEnumerateKey, 24 ) \ - SYSCALL_ENTRY( 0x003f, NtEnumerateValueKey, 24 ) \ - SYSCALL_ENTRY( 0x0040, NtFilterToken, 24 ) \ - SYSCALL_ENTRY( 0x0041, NtFindAtom, 12 ) \ - SYSCALL_ENTRY( 0x0042, NtFlushBuffersFile, 8 ) \ - SYSCALL_ENTRY( 0x0043, NtFlushInstructionCache, 12 ) \ - SYSCALL_ENTRY( 0x0044, NtFlushKey, 4 ) \ - SYSCALL_ENTRY( 0x0045, NtFlushProcessWriteBuffers, 0 ) \ - SYSCALL_ENTRY( 0x0046, NtFlushVirtualMemory, 16 ) \ - SYSCALL_ENTRY( 0x0047, NtFreeVirtualMemory, 16 ) \ - SYSCALL_ENTRY( 0x0048, NtFsControlFile, 40 ) \ - SYSCALL_ENTRY( 0x0049, NtGetContextThread, 8 ) \ - SYSCALL_ENTRY( 0x004a, NtGetCurrentProcessorNumber, 0 ) \ - SYSCALL_ENTRY( 0x004b, NtGetNextThread, 24 ) \ - SYSCALL_ENTRY( 0x004c, NtGetNlsSectionPtr, 20 ) \ - SYSCALL_ENTRY( 0x004d, NtGetWriteWatch, 28 ) \ - SYSCALL_ENTRY( 0x004e, NtImpersonateAnonymousToken, 4 ) \ - SYSCALL_ENTRY( 0x004f, NtInitializeNlsFiles, 12 ) \ - SYSCALL_ENTRY( 0x0050, NtInitiatePowerAction, 16 ) \ - SYSCALL_ENTRY( 0x0051, NtIsProcessInJob, 8 ) \ - SYSCALL_ENTRY( 0x0052, NtListenPort, 8 ) \ - SYSCALL_ENTRY( 0x0053, NtLoadDriver, 4 ) \ - SYSCALL_ENTRY( 0x0054, NtLoadKey, 8 ) \ - SYSCALL_ENTRY( 0x0055, NtLoadKey2, 12 ) \ - SYSCALL_ENTRY( 0x0056, NtLoadKeyEx, 32 ) \ - SYSCALL_ENTRY( 0x0057, NtLockFile, 40 ) \ - SYSCALL_ENTRY( 0x0058, NtLockVirtualMemory, 16 ) \ - SYSCALL_ENTRY( 0x0059, NtMakeTemporaryObject, 4 ) \ - SYSCALL_ENTRY( 0x005a, NtMapViewOfSection, 40 ) \ - SYSCALL_ENTRY( 0x005b, NtMapViewOfSectionEx, 36 ) \ - SYSCALL_ENTRY( 0x005c, NtNotifyChangeDirectoryFile, 36 ) \ - SYSCALL_ENTRY( 0x005d, NtNotifyChangeKey, 40 ) \ - SYSCALL_ENTRY( 0x005e, NtNotifyChangeMultipleKeys, 48 ) \ - SYSCALL_ENTRY( 0x005f, NtOpenDirectoryObject, 12 ) \ - SYSCALL_ENTRY( 0x0060, NtOpenEvent, 12 ) \ - SYSCALL_ENTRY( 0x0061, NtOpenFile, 24 ) \ - SYSCALL_ENTRY( 0x0062, NtOpenIoCompletion, 12 ) \ - SYSCALL_ENTRY( 0x0063, NtOpenJobObject, 12 ) \ - SYSCALL_ENTRY( 0x0064, NtOpenKey, 12 ) \ - SYSCALL_ENTRY( 0x0065, NtOpenKeyEx, 16 ) \ - SYSCALL_ENTRY( 0x0066, NtOpenKeyTransacted, 16 ) \ - SYSCALL_ENTRY( 0x0067, NtOpenKeyTransactedEx, 20 ) \ - SYSCALL_ENTRY( 0x0068, NtOpenKeyedEvent, 12 ) \ - SYSCALL_ENTRY( 0x0069, NtOpenMutant, 12 ) \ - SYSCALL_ENTRY( 0x006a, NtOpenProcess, 16 ) \ - SYSCALL_ENTRY( 0x006b, NtOpenProcessToken, 12 ) \ - SYSCALL_ENTRY( 0x006c, NtOpenProcessTokenEx, 16 ) \ - SYSCALL_ENTRY( 0x006d, NtOpenSection, 12 ) \ - SYSCALL_ENTRY( 0x006e, NtOpenSemaphore, 12 ) \ - SYSCALL_ENTRY( 0x006f, NtOpenSymbolicLinkObject, 12 ) \ - SYSCALL_ENTRY( 0x0070, NtOpenThread, 16 ) \ - SYSCALL_ENTRY( 0x0071, NtOpenThreadToken, 16 ) \ - SYSCALL_ENTRY( 0x0072, NtOpenThreadTokenEx, 20 ) \ - SYSCALL_ENTRY( 0x0073, NtOpenTimer, 12 ) \ - SYSCALL_ENTRY( 0x0074, NtPowerInformation, 20 ) \ - SYSCALL_ENTRY( 0x0075, NtPrivilegeCheck, 12 ) \ - SYSCALL_ENTRY( 0x0076, NtProtectVirtualMemory, 20 ) \ - SYSCALL_ENTRY( 0x0077, NtPulseEvent, 8 ) \ - SYSCALL_ENTRY( 0x0078, NtQueryAttributesFile, 8 ) \ - SYSCALL_ENTRY( 0x0079, NtQueryDefaultLocale, 8 ) \ - SYSCALL_ENTRY( 0x007a, NtQueryDefaultUILanguage, 4 ) \ - SYSCALL_ENTRY( 0x007b, NtQueryDirectoryFile, 44 ) \ - SYSCALL_ENTRY( 0x007c, NtQueryDirectoryObject, 28 ) \ - SYSCALL_ENTRY( 0x007d, NtQueryEaFile, 36 ) \ - SYSCALL_ENTRY( 0x007e, NtQueryEvent, 20 ) \ - SYSCALL_ENTRY( 0x007f, NtQueryFullAttributesFile, 8 ) \ - SYSCALL_ENTRY( 0x0080, NtQueryInformationAtom, 20 ) \ - SYSCALL_ENTRY( 0x0081, NtQueryInformationFile, 20 ) \ - SYSCALL_ENTRY( 0x0082, NtQueryInformationJobObject, 20 ) \ - SYSCALL_ENTRY( 0x0083, NtQueryInformationProcess, 20 ) \ - SYSCALL_ENTRY( 0x0084, NtQueryInformationThread, 20 ) \ - SYSCALL_ENTRY( 0x0085, NtQueryInformationToken, 20 ) \ - SYSCALL_ENTRY( 0x0086, NtQueryInstallUILanguage, 4 ) \ - SYSCALL_ENTRY( 0x0087, NtQueryIoCompletion, 20 ) \ - SYSCALL_ENTRY( 0x0088, NtQueryKey, 20 ) \ - SYSCALL_ENTRY( 0x0089, NtQueryLicenseValue, 20 ) \ - SYSCALL_ENTRY( 0x008a, NtQueryMultipleValueKey, 24 ) \ - SYSCALL_ENTRY( 0x008b, NtQueryMutant, 20 ) \ - SYSCALL_ENTRY( 0x008c, NtQueryObject, 20 ) \ - SYSCALL_ENTRY( 0x008d, NtQueryPerformanceCounter, 8 ) \ - SYSCALL_ENTRY( 0x008e, NtQuerySection, 20 ) \ - SYSCALL_ENTRY( 0x008f, NtQuerySecurityObject, 20 ) \ - SYSCALL_ENTRY( 0x0090, NtQuerySemaphore, 20 ) \ - SYSCALL_ENTRY( 0x0091, NtQuerySymbolicLinkObject, 12 ) \ - SYSCALL_ENTRY( 0x0092, NtQuerySystemEnvironmentValue, 16 ) \ - SYSCALL_ENTRY( 0x0093, NtQuerySystemEnvironmentValueEx, 20 ) \ - SYSCALL_ENTRY( 0x0094, NtQuerySystemInformation, 16 ) \ - SYSCALL_ENTRY( 0x0095, NtQuerySystemInformationEx, 24 ) \ - SYSCALL_ENTRY( 0x0096, NtQuerySystemTime, 4 ) \ - SYSCALL_ENTRY( 0x0097, NtQueryTimer, 20 ) \ - SYSCALL_ENTRY( 0x0098, NtQueryTimerResolution, 12 ) \ - SYSCALL_ENTRY( 0x0099, NtQueryValueKey, 24 ) \ - SYSCALL_ENTRY( 0x009a, NtQueryVirtualMemory, 24 ) \ - SYSCALL_ENTRY( 0x009b, NtQueryVolumeInformationFile, 20 ) \ - SYSCALL_ENTRY( 0x009c, NtQueueApcThread, 20 ) \ - SYSCALL_ENTRY( 0x009d, NtRaiseException, 12 ) \ - SYSCALL_ENTRY( 0x009e, NtRaiseHardError, 24 ) \ - SYSCALL_ENTRY( 0x009f, NtReadFile, 36 ) \ - SYSCALL_ENTRY( 0x00a0, NtReadFileScatter, 36 ) \ - SYSCALL_ENTRY( 0x00a1, NtReadVirtualMemory, 20 ) \ - SYSCALL_ENTRY( 0x00a2, NtRegisterThreadTerminatePort, 4 ) \ - SYSCALL_ENTRY( 0x00a3, NtReleaseKeyedEvent, 16 ) \ - SYSCALL_ENTRY( 0x00a4, NtReleaseMutant, 8 ) \ - SYSCALL_ENTRY( 0x00a5, NtReleaseSemaphore, 12 ) \ - SYSCALL_ENTRY( 0x00a6, NtRemoveIoCompletion, 20 ) \ - SYSCALL_ENTRY( 0x00a7, NtRemoveIoCompletionEx, 24 ) \ - SYSCALL_ENTRY( 0x00a8, NtRemoveProcessDebug, 8 ) \ - SYSCALL_ENTRY( 0x00a9, NtRenameKey, 8 ) \ - SYSCALL_ENTRY( 0x00aa, NtReplaceKey, 12 ) \ - SYSCALL_ENTRY( 0x00ab, NtReplyWaitReceivePort, 16 ) \ - SYSCALL_ENTRY( 0x00ac, NtRequestWaitReplyPort, 12 ) \ - SYSCALL_ENTRY( 0x00ad, NtResetEvent, 8 ) \ - SYSCALL_ENTRY( 0x00ae, NtResetWriteWatch, 12 ) \ - SYSCALL_ENTRY( 0x00af, NtRestoreKey, 12 ) \ - SYSCALL_ENTRY( 0x00b0, NtResumeProcess, 4 ) \ - SYSCALL_ENTRY( 0x00b1, NtResumeThread, 8 ) \ - SYSCALL_ENTRY( 0x00b2, NtRollbackTransaction, 8 ) \ - SYSCALL_ENTRY( 0x00b3, NtSaveKey, 8 ) \ - SYSCALL_ENTRY( 0x00b4, NtSecureConnectPort, 36 ) \ - SYSCALL_ENTRY( 0x00b5, NtSetContextThread, 8 ) \ - SYSCALL_ENTRY( 0x00b6, NtSetDebugFilterState, 12 ) \ - SYSCALL_ENTRY( 0x00b7, NtSetDefaultLocale, 8 ) \ - SYSCALL_ENTRY( 0x00b8, NtSetDefaultUILanguage, 4 ) \ - SYSCALL_ENTRY( 0x00b9, NtSetEaFile, 16 ) \ - SYSCALL_ENTRY( 0x00ba, NtSetEvent, 8 ) \ - SYSCALL_ENTRY( 0x00bb, NtSetInformationDebugObject, 20 ) \ - SYSCALL_ENTRY( 0x00bc, NtSetInformationFile, 20 ) \ - SYSCALL_ENTRY( 0x00bd, NtSetInformationJobObject, 16 ) \ - SYSCALL_ENTRY( 0x00be, NtSetInformationKey, 16 ) \ - SYSCALL_ENTRY( 0x00bf, NtSetInformationObject, 16 ) \ - SYSCALL_ENTRY( 0x00c0, NtSetInformationProcess, 16 ) \ - SYSCALL_ENTRY( 0x00c1, NtSetInformationThread, 16 ) \ - SYSCALL_ENTRY( 0x00c2, NtSetInformationToken, 16 ) \ - SYSCALL_ENTRY( 0x00c3, NtSetInformationVirtualMemory, 24 ) \ - SYSCALL_ENTRY( 0x00c4, NtSetIntervalProfile, 8 ) \ - SYSCALL_ENTRY( 0x00c5, NtSetIoCompletion, 20 ) \ - SYSCALL_ENTRY( 0x00c6, NtSetLdtEntries, 24 ) \ - SYSCALL_ENTRY( 0x00c7, NtSetSecurityObject, 12 ) \ - SYSCALL_ENTRY( 0x00c8, NtSetSystemInformation, 12 ) \ - SYSCALL_ENTRY( 0x00c9, NtSetSystemTime, 8 ) \ - SYSCALL_ENTRY( 0x00ca, NtSetThreadExecutionState, 8 ) \ - SYSCALL_ENTRY( 0x00cb, NtSetTimer, 28 ) \ - SYSCALL_ENTRY( 0x00cc, NtSetTimerResolution, 12 ) \ - SYSCALL_ENTRY( 0x00cd, NtSetValueKey, 24 ) \ - SYSCALL_ENTRY( 0x00ce, NtSetVolumeInformationFile, 20 ) \ - SYSCALL_ENTRY( 0x00cf, NtShutdownSystem, 4 ) \ - SYSCALL_ENTRY( 0x00d0, NtSignalAndWaitForSingleObject, 16 ) \ - SYSCALL_ENTRY( 0x00d1, NtSuspendProcess, 4 ) \ - SYSCALL_ENTRY( 0x00d2, NtSuspendThread, 8 ) \ - SYSCALL_ENTRY( 0x00d3, NtSystemDebugControl, 24 ) \ - SYSCALL_ENTRY( 0x00d4, NtTerminateJobObject, 8 ) \ - SYSCALL_ENTRY( 0x00d5, NtTerminateProcess, 8 ) \ - SYSCALL_ENTRY( 0x00d6, NtTerminateThread, 8 ) \ - SYSCALL_ENTRY( 0x00d7, NtTestAlert, 0 ) \ - SYSCALL_ENTRY( 0x00d8, NtTraceControl, 24 ) \ - SYSCALL_ENTRY( 0x00d9, NtUnloadDriver, 4 ) \ - SYSCALL_ENTRY( 0x00da, NtUnloadKey, 4 ) \ - SYSCALL_ENTRY( 0x00db, NtUnlockFile, 20 ) \ - SYSCALL_ENTRY( 0x00dc, NtUnlockVirtualMemory, 16 ) \ - SYSCALL_ENTRY( 0x00dd, NtUnmapViewOfSection, 8 ) \ - SYSCALL_ENTRY( 0x00de, NtUnmapViewOfSectionEx, 12 ) \ - SYSCALL_ENTRY( 0x00df, NtWaitForAlertByThreadId, 8 ) \ - SYSCALL_ENTRY( 0x00e0, NtWaitForDebugEvent, 16 ) \ - SYSCALL_ENTRY( 0x00e1, NtWaitForKeyedEvent, 16 ) \ - SYSCALL_ENTRY( 0x00e2, NtWaitForMultipleObjects, 20 ) \ - SYSCALL_ENTRY( 0x00e3, NtWaitForSingleObject, 12 ) \ - SYSCALL_ENTRY( 0x00e4, NtWow64AllocateVirtualMemory64, 28 ) \ - SYSCALL_ENTRY( 0x00e5, NtWow64GetNativeSystemInformation, 16 ) \ - SYSCALL_ENTRY( 0x00e6, NtWow64IsProcessorFeaturePresent, 4 ) \ - SYSCALL_ENTRY( 0x00e7, NtWow64ReadVirtualMemory64, 28 ) \ - SYSCALL_ENTRY( 0x00e8, NtWow64WriteVirtualMemory64, 28 ) \ - SYSCALL_ENTRY( 0x00e9, NtWriteFile, 36 ) \ - SYSCALL_ENTRY( 0x00ea, NtWriteFileGather, 36 ) \ - SYSCALL_ENTRY( 0x00eb, NtWriteVirtualMemory, 20 ) \ - SYSCALL_ENTRY( 0x00ec, NtYieldExecution, 0 ) \ - SYSCALL_ENTRY( 0x00ed, wine_nt_to_unix_file_name, 16 ) \ - SYSCALL_ENTRY( 0x00ee, wine_unix_to_nt_file_name, 12 ) - -#define ALL_SYSCALLS64 \ - SYSCALL_ENTRY( 0x0000, NtAcceptConnectPort, 48 ) \ - SYSCALL_ENTRY( 0x0001, NtAccessCheck, 64 ) \ - SYSCALL_ENTRY( 0x0002, NtAccessCheckAndAuditAlarm, 88 ) \ - SYSCALL_ENTRY( 0x0003, NtAddAtom, 24 ) \ - SYSCALL_ENTRY( 0x0004, NtAdjustGroupsToken, 48 ) \ - SYSCALL_ENTRY( 0x0005, NtAdjustPrivilegesToken, 48 ) \ - SYSCALL_ENTRY( 0x0006, NtAlertResumeThread, 16 ) \ - SYSCALL_ENTRY( 0x0007, NtAlertThread, 8 ) \ - SYSCALL_ENTRY( 0x0008, NtAlertThreadByThreadId, 8 ) \ - SYSCALL_ENTRY( 0x0009, NtAllocateLocallyUniqueId, 8 ) \ - SYSCALL_ENTRY( 0x000a, NtAllocateUuids, 32 ) \ - SYSCALL_ENTRY( 0x000b, NtAllocateVirtualMemory, 48 ) \ - SYSCALL_ENTRY( 0x000c, NtAllocateVirtualMemoryEx, 56 ) \ - SYSCALL_ENTRY( 0x000d, NtAreMappedFilesTheSame, 16 ) \ - SYSCALL_ENTRY( 0x000e, NtAssignProcessToJobObject, 16 ) \ - SYSCALL_ENTRY( 0x000f, NtCallbackReturn, 24 ) \ - SYSCALL_ENTRY( 0x0010, NtCancelIoFile, 16 ) \ - SYSCALL_ENTRY( 0x0011, NtCancelIoFileEx, 24 ) \ - SYSCALL_ENTRY( 0x0012, NtCancelSynchronousIoFile, 24 ) \ - SYSCALL_ENTRY( 0x0013, NtCancelTimer, 16 ) \ - SYSCALL_ENTRY( 0x0014, NtClearEvent, 8 ) \ - SYSCALL_ENTRY( 0x0015, NtClose, 8 ) \ - SYSCALL_ENTRY( 0x0016, NtCommitTransaction, 16 ) \ - SYSCALL_ENTRY( 0x0017, NtCompareObjects, 16 ) \ - SYSCALL_ENTRY( 0x0018, NtCompleteConnectPort, 8 ) \ - SYSCALL_ENTRY( 0x0019, NtConnectPort, 64 ) \ - SYSCALL_ENTRY( 0x001a, NtContinue, 16 ) \ - SYSCALL_ENTRY( 0x001b, NtCreateDebugObject, 32 ) \ - SYSCALL_ENTRY( 0x001c, NtCreateDirectoryObject, 24 ) \ - SYSCALL_ENTRY( 0x001d, NtCreateEvent, 40 ) \ - SYSCALL_ENTRY( 0x001e, NtCreateFile, 88 ) \ - SYSCALL_ENTRY( 0x001f, NtCreateIoCompletion, 32 ) \ - SYSCALL_ENTRY( 0x0020, NtCreateJobObject, 24 ) \ - SYSCALL_ENTRY( 0x0021, NtCreateKey, 56 ) \ - SYSCALL_ENTRY( 0x0022, NtCreateKeyTransacted, 64 ) \ - SYSCALL_ENTRY( 0x0023, NtCreateKeyedEvent, 32 ) \ - SYSCALL_ENTRY( 0x0024, NtCreateLowBoxToken, 72 ) \ - SYSCALL_ENTRY( 0x0025, NtCreateMailslotFile, 64 ) \ - SYSCALL_ENTRY( 0x0026, NtCreateMutant, 32 ) \ - SYSCALL_ENTRY( 0x0027, NtCreateNamedPipeFile, 112 ) \ - SYSCALL_ENTRY( 0x0028, NtCreatePagingFile, 32 ) \ - SYSCALL_ENTRY( 0x0029, NtCreatePort, 40 ) \ - SYSCALL_ENTRY( 0x002a, NtCreateSection, 56 ) \ - SYSCALL_ENTRY( 0x002b, NtCreateSemaphore, 40 ) \ - SYSCALL_ENTRY( 0x002c, NtCreateSymbolicLinkObject, 32 ) \ - SYSCALL_ENTRY( 0x002d, NtCreateThread, 64 ) \ - SYSCALL_ENTRY( 0x002e, NtCreateThreadEx, 88 ) \ - SYSCALL_ENTRY( 0x002f, NtCreateTimer, 32 ) \ - SYSCALL_ENTRY( 0x0030, NtCreateToken, 104 ) \ - SYSCALL_ENTRY( 0x0031, NtCreateTransaction, 80 ) \ - SYSCALL_ENTRY( 0x0032, NtCreateUserProcess, 88 ) \ - SYSCALL_ENTRY( 0x0033, NtDebugActiveProcess, 16 ) \ - SYSCALL_ENTRY( 0x0034, NtDebugContinue, 24 ) \ - SYSCALL_ENTRY( 0x0035, NtDelayExecution, 16 ) \ - SYSCALL_ENTRY( 0x0036, NtDeleteAtom, 8 ) \ - SYSCALL_ENTRY( 0x0037, NtDeleteFile, 8 ) \ - SYSCALL_ENTRY( 0x0038, NtDeleteKey, 8 ) \ - SYSCALL_ENTRY( 0x0039, NtDeleteValueKey, 16 ) \ - SYSCALL_ENTRY( 0x003a, NtDeviceIoControlFile, 80 ) \ - SYSCALL_ENTRY( 0x003b, NtDisplayString, 8 ) \ - SYSCALL_ENTRY( 0x003c, NtDuplicateObject, 56 ) \ - SYSCALL_ENTRY( 0x003d, NtDuplicateToken, 48 ) \ - SYSCALL_ENTRY( 0x003e, NtEnumerateKey, 48 ) \ - SYSCALL_ENTRY( 0x003f, NtEnumerateValueKey, 48 ) \ - SYSCALL_ENTRY( 0x0040, NtFilterToken, 48 ) \ - SYSCALL_ENTRY( 0x0041, NtFindAtom, 24 ) \ - SYSCALL_ENTRY( 0x0042, NtFlushBuffersFile, 16 ) \ - SYSCALL_ENTRY( 0x0043, NtFlushInstructionCache, 24 ) \ - SYSCALL_ENTRY( 0x0044, NtFlushKey, 8 ) \ - SYSCALL_ENTRY( 0x0045, NtFlushProcessWriteBuffers, 0 ) \ - SYSCALL_ENTRY( 0x0046, NtFlushVirtualMemory, 32 ) \ - SYSCALL_ENTRY( 0x0047, NtFreeVirtualMemory, 32 ) \ - SYSCALL_ENTRY( 0x0048, NtFsControlFile, 80 ) \ - SYSCALL_ENTRY( 0x0049, NtGetContextThread, 16 ) \ - SYSCALL_ENTRY( 0x004a, NtGetCurrentProcessorNumber, 0 ) \ - SYSCALL_ENTRY( 0x004b, NtGetNextThread, 48 ) \ - SYSCALL_ENTRY( 0x004c, NtGetNlsSectionPtr, 40 ) \ - SYSCALL_ENTRY( 0x004d, NtGetWriteWatch, 56 ) \ - SYSCALL_ENTRY( 0x004e, NtImpersonateAnonymousToken, 8 ) \ - SYSCALL_ENTRY( 0x004f, NtInitializeNlsFiles, 24 ) \ - SYSCALL_ENTRY( 0x0050, NtInitiatePowerAction, 32 ) \ - SYSCALL_ENTRY( 0x0051, NtIsProcessInJob, 16 ) \ - SYSCALL_ENTRY( 0x0052, NtListenPort, 16 ) \ - SYSCALL_ENTRY( 0x0053, NtLoadDriver, 8 ) \ - SYSCALL_ENTRY( 0x0054, NtLoadKey, 16 ) \ - SYSCALL_ENTRY( 0x0055, NtLoadKey2, 24 ) \ - SYSCALL_ENTRY( 0x0056, NtLoadKeyEx, 64 ) \ - SYSCALL_ENTRY( 0x0057, NtLockFile, 80 ) \ - SYSCALL_ENTRY( 0x0058, NtLockVirtualMemory, 32 ) \ - SYSCALL_ENTRY( 0x0059, NtMakeTemporaryObject, 8 ) \ - SYSCALL_ENTRY( 0x005a, NtMapViewOfSection, 80 ) \ - SYSCALL_ENTRY( 0x005b, NtMapViewOfSectionEx, 72 ) \ - SYSCALL_ENTRY( 0x005c, NtNotifyChangeDirectoryFile, 72 ) \ - SYSCALL_ENTRY( 0x005d, NtNotifyChangeKey, 80 ) \ - SYSCALL_ENTRY( 0x005e, NtNotifyChangeMultipleKeys, 96 ) \ - SYSCALL_ENTRY( 0x005f, NtOpenDirectoryObject, 24 ) \ - SYSCALL_ENTRY( 0x0060, NtOpenEvent, 24 ) \ - SYSCALL_ENTRY( 0x0061, NtOpenFile, 48 ) \ - SYSCALL_ENTRY( 0x0062, NtOpenIoCompletion, 24 ) \ - SYSCALL_ENTRY( 0x0063, NtOpenJobObject, 24 ) \ - SYSCALL_ENTRY( 0x0064, NtOpenKey, 24 ) \ - SYSCALL_ENTRY( 0x0065, NtOpenKeyEx, 32 ) \ - SYSCALL_ENTRY( 0x0066, NtOpenKeyTransacted, 32 ) \ - SYSCALL_ENTRY( 0x0067, NtOpenKeyTransactedEx, 40 ) \ - SYSCALL_ENTRY( 0x0068, NtOpenKeyedEvent, 24 ) \ - SYSCALL_ENTRY( 0x0069, NtOpenMutant, 24 ) \ - SYSCALL_ENTRY( 0x006a, NtOpenProcess, 32 ) \ - SYSCALL_ENTRY( 0x006b, NtOpenProcessToken, 24 ) \ - SYSCALL_ENTRY( 0x006c, NtOpenProcessTokenEx, 32 ) \ - SYSCALL_ENTRY( 0x006d, NtOpenSection, 24 ) \ - SYSCALL_ENTRY( 0x006e, NtOpenSemaphore, 24 ) \ - SYSCALL_ENTRY( 0x006f, NtOpenSymbolicLinkObject, 24 ) \ - SYSCALL_ENTRY( 0x0070, NtOpenThread, 32 ) \ - SYSCALL_ENTRY( 0x0071, NtOpenThreadToken, 32 ) \ - SYSCALL_ENTRY( 0x0072, NtOpenThreadTokenEx, 40 ) \ - SYSCALL_ENTRY( 0x0073, NtOpenTimer, 24 ) \ - SYSCALL_ENTRY( 0x0074, NtPowerInformation, 40 ) \ - SYSCALL_ENTRY( 0x0075, NtPrivilegeCheck, 24 ) \ - SYSCALL_ENTRY( 0x0076, NtProtectVirtualMemory, 40 ) \ - SYSCALL_ENTRY( 0x0077, NtPulseEvent, 16 ) \ - SYSCALL_ENTRY( 0x0078, NtQueryAttributesFile, 16 ) \ - SYSCALL_ENTRY( 0x0079, NtQueryDefaultLocale, 16 ) \ - SYSCALL_ENTRY( 0x007a, NtQueryDefaultUILanguage, 8 ) \ - SYSCALL_ENTRY( 0x007b, NtQueryDirectoryFile, 88 ) \ - SYSCALL_ENTRY( 0x007c, NtQueryDirectoryObject, 56 ) \ - SYSCALL_ENTRY( 0x007d, NtQueryEaFile, 72 ) \ - SYSCALL_ENTRY( 0x007e, NtQueryEvent, 40 ) \ - SYSCALL_ENTRY( 0x007f, NtQueryFullAttributesFile, 16 ) \ - SYSCALL_ENTRY( 0x0080, NtQueryInformationAtom, 40 ) \ - SYSCALL_ENTRY( 0x0081, NtQueryInformationFile, 40 ) \ - SYSCALL_ENTRY( 0x0082, NtQueryInformationJobObject, 40 ) \ - SYSCALL_ENTRY( 0x0083, NtQueryInformationProcess, 40 ) \ - SYSCALL_ENTRY( 0x0084, NtQueryInformationThread, 40 ) \ - SYSCALL_ENTRY( 0x0085, NtQueryInformationToken, 40 ) \ - SYSCALL_ENTRY( 0x0086, NtQueryInstallUILanguage, 8 ) \ - SYSCALL_ENTRY( 0x0087, NtQueryIoCompletion, 40 ) \ - SYSCALL_ENTRY( 0x0088, NtQueryKey, 40 ) \ - SYSCALL_ENTRY( 0x0089, NtQueryLicenseValue, 40 ) \ - SYSCALL_ENTRY( 0x008a, NtQueryMultipleValueKey, 48 ) \ - SYSCALL_ENTRY( 0x008b, NtQueryMutant, 40 ) \ - SYSCALL_ENTRY( 0x008c, NtQueryObject, 40 ) \ - SYSCALL_ENTRY( 0x008d, NtQueryPerformanceCounter, 16 ) \ - SYSCALL_ENTRY( 0x008e, NtQuerySection, 40 ) \ - SYSCALL_ENTRY( 0x008f, NtQuerySecurityObject, 40 ) \ - SYSCALL_ENTRY( 0x0090, NtQuerySemaphore, 40 ) \ - SYSCALL_ENTRY( 0x0091, NtQuerySymbolicLinkObject, 24 ) \ - SYSCALL_ENTRY( 0x0092, NtQuerySystemEnvironmentValue, 32 ) \ - SYSCALL_ENTRY( 0x0093, NtQuerySystemEnvironmentValueEx, 40 ) \ - SYSCALL_ENTRY( 0x0094, NtQuerySystemInformation, 32 ) \ - SYSCALL_ENTRY( 0x0095, NtQuerySystemInformationEx, 48 ) \ - SYSCALL_ENTRY( 0x0096, NtQuerySystemTime, 8 ) \ - SYSCALL_ENTRY( 0x0097, NtQueryTimer, 40 ) \ - SYSCALL_ENTRY( 0x0098, NtQueryTimerResolution, 24 ) \ - SYSCALL_ENTRY( 0x0099, NtQueryValueKey, 48 ) \ - SYSCALL_ENTRY( 0x009a, NtQueryVirtualMemory, 48 ) \ - SYSCALL_ENTRY( 0x009b, NtQueryVolumeInformationFile, 40 ) \ - SYSCALL_ENTRY( 0x009c, NtQueueApcThread, 40 ) \ - SYSCALL_ENTRY( 0x009d, NtRaiseException, 24 ) \ - SYSCALL_ENTRY( 0x009e, NtRaiseHardError, 48 ) \ - SYSCALL_ENTRY( 0x009f, NtReadFile, 72 ) \ - SYSCALL_ENTRY( 0x00a0, NtReadFileScatter, 72 ) \ - SYSCALL_ENTRY( 0x00a1, NtReadVirtualMemory, 40 ) \ - SYSCALL_ENTRY( 0x00a2, NtRegisterThreadTerminatePort, 8 ) \ - SYSCALL_ENTRY( 0x00a3, NtReleaseKeyedEvent, 32 ) \ - SYSCALL_ENTRY( 0x00a4, NtReleaseMutant, 16 ) \ - SYSCALL_ENTRY( 0x00a5, NtReleaseSemaphore, 24 ) \ - SYSCALL_ENTRY( 0x00a6, NtRemoveIoCompletion, 40 ) \ - SYSCALL_ENTRY( 0x00a7, NtRemoveIoCompletionEx, 48 ) \ - SYSCALL_ENTRY( 0x00a8, NtRemoveProcessDebug, 16 ) \ - SYSCALL_ENTRY( 0x00a9, NtRenameKey, 16 ) \ - SYSCALL_ENTRY( 0x00aa, NtReplaceKey, 24 ) \ - SYSCALL_ENTRY( 0x00ab, NtReplyWaitReceivePort, 32 ) \ - SYSCALL_ENTRY( 0x00ac, NtRequestWaitReplyPort, 24 ) \ - SYSCALL_ENTRY( 0x00ad, NtResetEvent, 16 ) \ - SYSCALL_ENTRY( 0x00ae, NtResetWriteWatch, 24 ) \ - SYSCALL_ENTRY( 0x00af, NtRestoreKey, 24 ) \ - SYSCALL_ENTRY( 0x00b0, NtResumeProcess, 8 ) \ - SYSCALL_ENTRY( 0x00b1, NtResumeThread, 16 ) \ - SYSCALL_ENTRY( 0x00b2, NtRollbackTransaction, 16 ) \ - SYSCALL_ENTRY( 0x00b3, NtSaveKey, 16 ) \ - SYSCALL_ENTRY( 0x00b4, NtSecureConnectPort, 72 ) \ - SYSCALL_ENTRY( 0x00b5, NtSetContextThread, 16 ) \ - SYSCALL_ENTRY( 0x00b6, NtSetDebugFilterState, 24 ) \ - SYSCALL_ENTRY( 0x00b7, NtSetDefaultLocale, 16 ) \ - SYSCALL_ENTRY( 0x00b8, NtSetDefaultUILanguage, 8 ) \ - SYSCALL_ENTRY( 0x00b9, NtSetEaFile, 32 ) \ - SYSCALL_ENTRY( 0x00ba, NtSetEvent, 16 ) \ - SYSCALL_ENTRY( 0x00bb, NtSetInformationDebugObject, 40 ) \ - SYSCALL_ENTRY( 0x00bc, NtSetInformationFile, 40 ) \ - SYSCALL_ENTRY( 0x00bd, NtSetInformationJobObject, 32 ) \ - SYSCALL_ENTRY( 0x00be, NtSetInformationKey, 32 ) \ - SYSCALL_ENTRY( 0x00bf, NtSetInformationObject, 32 ) \ - SYSCALL_ENTRY( 0x00c0, NtSetInformationProcess, 32 ) \ - SYSCALL_ENTRY( 0x00c1, NtSetInformationThread, 32 ) \ - SYSCALL_ENTRY( 0x00c2, NtSetInformationToken, 32 ) \ - SYSCALL_ENTRY( 0x00c3, NtSetInformationVirtualMemory, 48 ) \ - SYSCALL_ENTRY( 0x00c4, NtSetIntervalProfile, 16 ) \ - SYSCALL_ENTRY( 0x00c5, NtSetIoCompletion, 40 ) \ - SYSCALL_ENTRY( 0x00c6, NtSetLdtEntries, 32 ) \ - SYSCALL_ENTRY( 0x00c7, NtSetSecurityObject, 24 ) \ - SYSCALL_ENTRY( 0x00c8, NtSetSystemInformation, 24 ) \ - SYSCALL_ENTRY( 0x00c9, NtSetSystemTime, 16 ) \ - SYSCALL_ENTRY( 0x00ca, NtSetThreadExecutionState, 16 ) \ - SYSCALL_ENTRY( 0x00cb, NtSetTimer, 56 ) \ - SYSCALL_ENTRY( 0x00cc, NtSetTimerResolution, 24 ) \ - SYSCALL_ENTRY( 0x00cd, NtSetValueKey, 48 ) \ - SYSCALL_ENTRY( 0x00ce, NtSetVolumeInformationFile, 40 ) \ - SYSCALL_ENTRY( 0x00cf, NtShutdownSystem, 8 ) \ - SYSCALL_ENTRY( 0x00d0, NtSignalAndWaitForSingleObject, 32 ) \ - SYSCALL_ENTRY( 0x00d1, NtSuspendProcess, 8 ) \ - SYSCALL_ENTRY( 0x00d2, NtSuspendThread, 16 ) \ - SYSCALL_ENTRY( 0x00d3, NtSystemDebugControl, 48 ) \ - SYSCALL_ENTRY( 0x00d4, NtTerminateJobObject, 16 ) \ - SYSCALL_ENTRY( 0x00d5, NtTerminateProcess, 16 ) \ - SYSCALL_ENTRY( 0x00d6, NtTerminateThread, 16 ) \ - SYSCALL_ENTRY( 0x00d7, NtTestAlert, 0 ) \ - SYSCALL_ENTRY( 0x00d8, NtTraceControl, 48 ) \ - SYSCALL_ENTRY( 0x00d9, NtUnloadDriver, 8 ) \ - SYSCALL_ENTRY( 0x00da, NtUnloadKey, 8 ) \ - SYSCALL_ENTRY( 0x00db, NtUnlockFile, 40 ) \ - SYSCALL_ENTRY( 0x00dc, NtUnlockVirtualMemory, 32 ) \ - SYSCALL_ENTRY( 0x00dd, NtUnmapViewOfSection, 16 ) \ - SYSCALL_ENTRY( 0x00de, NtUnmapViewOfSectionEx, 24 ) \ - SYSCALL_ENTRY( 0x00df, NtWaitForAlertByThreadId, 16 ) \ - SYSCALL_ENTRY( 0x00e0, NtWaitForDebugEvent, 32 ) \ - SYSCALL_ENTRY( 0x00e1, NtWaitForKeyedEvent, 32 ) \ - SYSCALL_ENTRY( 0x00e2, NtWaitForMultipleObjects, 40 ) \ - SYSCALL_ENTRY( 0x00e3, NtWaitForSingleObject, 24 ) \ - SYSCALL_ENTRY( 0x00e4, NtWriteFile, 72 ) \ - SYSCALL_ENTRY( 0x00e5, NtWriteFileGather, 72 ) \ - SYSCALL_ENTRY( 0x00e6, NtWriteVirtualMemory, 40 ) \ - SYSCALL_ENTRY( 0x00e7, NtYieldExecution, 0 ) \ - SYSCALL_ENTRY( 0x00e8, wine_nt_to_unix_file_name, 32 ) \ - SYSCALL_ENTRY( 0x00e9, wine_unix_to_nt_file_name, 24 ) diff --git a/dlls/win32u/win32syscalls.h b/dlls/win32u/win32syscalls.h deleted file mode 100644 index 543583356d9..00000000000 --- a/dlls/win32u/win32syscalls.h +++ /dev/null @@ -1,807 +0,0 @@ -/* Automatically generated by tools/make_specfiles */ - -#define ALL_SYSCALLS32 \ - SYSCALL_ENTRY( 0x0000, NtGdiAbortDoc, 4 ) \ - SYSCALL_ENTRY( 0x0001, NtGdiAbortPath, 4 ) \ - SYSCALL_ENTRY( 0x0002, NtGdiAddFontMemResourceEx, 20 ) \ - SYSCALL_ENTRY( 0x0003, NtGdiAddFontResourceW, 24 ) \ - SYSCALL_ENTRY( 0x0004, NtGdiAlphaBlend, 48 ) \ - SYSCALL_ENTRY( 0x0005, NtGdiAngleArc, 24 ) \ - SYSCALL_ENTRY( 0x0006, NtGdiArcInternal, 40 ) \ - SYSCALL_ENTRY( 0x0007, NtGdiBeginPath, 4 ) \ - SYSCALL_ENTRY( 0x0008, NtGdiBitBlt, 44 ) \ - SYSCALL_ENTRY( 0x0009, NtGdiCloseFigure, 4 ) \ - SYSCALL_ENTRY( 0x000a, NtGdiCombineRgn, 16 ) \ - SYSCALL_ENTRY( 0x000b, NtGdiComputeXformCoefficients, 4 ) \ - SYSCALL_ENTRY( 0x000c, NtGdiCreateBitmap, 20 ) \ - SYSCALL_ENTRY( 0x000d, NtGdiCreateClientObj, 4 ) \ - SYSCALL_ENTRY( 0x000e, NtGdiCreateCompatibleBitmap, 12 ) \ - SYSCALL_ENTRY( 0x000f, NtGdiCreateCompatibleDC, 4 ) \ - SYSCALL_ENTRY( 0x0010, NtGdiCreateDIBBrush, 24 ) \ - SYSCALL_ENTRY( 0x0011, NtGdiCreateDIBSection, 36 ) \ - SYSCALL_ENTRY( 0x0012, NtGdiCreateDIBitmapInternal, 44 ) \ - SYSCALL_ENTRY( 0x0013, NtGdiCreateEllipticRgn, 16 ) \ - SYSCALL_ENTRY( 0x0014, NtGdiCreateHalftonePalette, 4 ) \ - SYSCALL_ENTRY( 0x0015, NtGdiCreateHatchBrushInternal, 12 ) \ - SYSCALL_ENTRY( 0x0016, NtGdiCreateMetafileDC, 4 ) \ - SYSCALL_ENTRY( 0x0017, NtGdiCreatePaletteInternal, 8 ) \ - SYSCALL_ENTRY( 0x0018, NtGdiCreatePatternBrushInternal, 12 ) \ - SYSCALL_ENTRY( 0x0019, NtGdiCreatePen, 16 ) \ - SYSCALL_ENTRY( 0x001a, NtGdiCreateRectRgn, 16 ) \ - SYSCALL_ENTRY( 0x001b, NtGdiCreateRoundRectRgn, 24 ) \ - SYSCALL_ENTRY( 0x001c, NtGdiCreateSolidBrush, 8 ) \ - SYSCALL_ENTRY( 0x001d, NtGdiDdDDICheckVidPnExclusiveOwnership, 4 ) \ - SYSCALL_ENTRY( 0x001e, NtGdiDdDDICloseAdapter, 4 ) \ - SYSCALL_ENTRY( 0x001f, NtGdiDdDDICreateDCFromMemory, 4 ) \ - SYSCALL_ENTRY( 0x0020, NtGdiDdDDICreateDevice, 4 ) \ - SYSCALL_ENTRY( 0x0021, NtGdiDdDDIDestroyDCFromMemory, 4 ) \ - SYSCALL_ENTRY( 0x0022, NtGdiDdDDIDestroyDevice, 4 ) \ - SYSCALL_ENTRY( 0x0023, NtGdiDdDDIEscape, 4 ) \ - SYSCALL_ENTRY( 0x0024, NtGdiDdDDIOpenAdapterFromDeviceName, 4 ) \ - SYSCALL_ENTRY( 0x0025, NtGdiDdDDIOpenAdapterFromHdc, 4 ) \ - SYSCALL_ENTRY( 0x0026, NtGdiDdDDIOpenAdapterFromLuid, 4 ) \ - SYSCALL_ENTRY( 0x0027, NtGdiDdDDIQueryAdapterInfo, 4 ) \ - SYSCALL_ENTRY( 0x0028, NtGdiDdDDIQueryStatistics, 4 ) \ - SYSCALL_ENTRY( 0x0029, NtGdiDdDDIQueryVideoMemoryInfo, 4 ) \ - SYSCALL_ENTRY( 0x002a, NtGdiDdDDISetQueuedLimit, 4 ) \ - SYSCALL_ENTRY( 0x002b, NtGdiDdDDISetVidPnSourceOwner, 4 ) \ - SYSCALL_ENTRY( 0x002c, NtGdiDeleteClientObj, 4 ) \ - SYSCALL_ENTRY( 0x002d, NtGdiDeleteObjectApp, 4 ) \ - SYSCALL_ENTRY( 0x002e, NtGdiDescribePixelFormat, 16 ) \ - SYSCALL_ENTRY( 0x002f, NtGdiDoPalette, 24 ) \ - SYSCALL_ENTRY( 0x0030, NtGdiDrawStream, 12 ) \ - SYSCALL_ENTRY( 0x0031, NtGdiEllipse, 20 ) \ - SYSCALL_ENTRY( 0x0032, NtGdiEndDoc, 4 ) \ - SYSCALL_ENTRY( 0x0033, NtGdiEndPage, 4 ) \ - SYSCALL_ENTRY( 0x0034, NtGdiEndPath, 4 ) \ - SYSCALL_ENTRY( 0x0035, NtGdiEnumFonts, 32 ) \ - SYSCALL_ENTRY( 0x0036, NtGdiEqualRgn, 8 ) \ - SYSCALL_ENTRY( 0x0037, NtGdiExcludeClipRect, 20 ) \ - SYSCALL_ENTRY( 0x0038, NtGdiExtCreatePen, 44 ) \ - SYSCALL_ENTRY( 0x0039, NtGdiExtCreateRegion, 12 ) \ - SYSCALL_ENTRY( 0x003a, NtGdiExtEscape, 32 ) \ - SYSCALL_ENTRY( 0x003b, NtGdiExtFloodFill, 20 ) \ - SYSCALL_ENTRY( 0x003c, NtGdiExtGetObjectW, 12 ) \ - SYSCALL_ENTRY( 0x003d, NtGdiExtSelectClipRgn, 12 ) \ - SYSCALL_ENTRY( 0x003e, NtGdiExtTextOutW, 36 ) \ - SYSCALL_ENTRY( 0x003f, NtGdiFillPath, 4 ) \ - SYSCALL_ENTRY( 0x0040, NtGdiFillRgn, 12 ) \ - SYSCALL_ENTRY( 0x0041, NtGdiFlattenPath, 4 ) \ - SYSCALL_ENTRY( 0x0042, NtGdiFlush, 0 ) \ - SYSCALL_ENTRY( 0x0043, NtGdiFontIsLinked, 4 ) \ - SYSCALL_ENTRY( 0x0044, NtGdiFrameRgn, 20 ) \ - SYSCALL_ENTRY( 0x0045, NtGdiGetAndSetDCDword, 16 ) \ - SYSCALL_ENTRY( 0x0046, NtGdiGetAppClipBox, 8 ) \ - SYSCALL_ENTRY( 0x0047, NtGdiGetBitmapBits, 12 ) \ - SYSCALL_ENTRY( 0x0048, NtGdiGetBitmapDimension, 8 ) \ - SYSCALL_ENTRY( 0x0049, NtGdiGetBoundsRect, 12 ) \ - SYSCALL_ENTRY( 0x004a, NtGdiGetCharABCWidthsW, 24 ) \ - SYSCALL_ENTRY( 0x004b, NtGdiGetCharWidthInfo, 8 ) \ - SYSCALL_ENTRY( 0x004c, NtGdiGetCharWidthW, 24 ) \ - SYSCALL_ENTRY( 0x004d, NtGdiGetColorAdjustment, 8 ) \ - SYSCALL_ENTRY( 0x004e, NtGdiGetDCDword, 12 ) \ - SYSCALL_ENTRY( 0x004f, NtGdiGetDCObject, 8 ) \ - SYSCALL_ENTRY( 0x0050, NtGdiGetDCPoint, 12 ) \ - SYSCALL_ENTRY( 0x0051, NtGdiGetDIBitsInternal, 36 ) \ - SYSCALL_ENTRY( 0x0052, NtGdiGetDeviceCaps, 8 ) \ - SYSCALL_ENTRY( 0x0053, NtGdiGetDeviceGammaRamp, 8 ) \ - SYSCALL_ENTRY( 0x0054, NtGdiGetFontData, 20 ) \ - SYSCALL_ENTRY( 0x0055, NtGdiGetFontFileData, 20 ) \ - SYSCALL_ENTRY( 0x0056, NtGdiGetFontFileInfo, 20 ) \ - SYSCALL_ENTRY( 0x0057, NtGdiGetFontUnicodeRanges, 8 ) \ - SYSCALL_ENTRY( 0x0058, NtGdiGetGlyphIndicesW, 20 ) \ - SYSCALL_ENTRY( 0x0059, NtGdiGetGlyphOutline, 32 ) \ - SYSCALL_ENTRY( 0x005a, NtGdiGetKerningPairs, 12 ) \ - SYSCALL_ENTRY( 0x005b, NtGdiGetNearestColor, 8 ) \ - SYSCALL_ENTRY( 0x005c, NtGdiGetNearestPaletteIndex, 8 ) \ - SYSCALL_ENTRY( 0x005d, NtGdiGetOutlineTextMetricsInternalW, 16 ) \ - SYSCALL_ENTRY( 0x005e, NtGdiGetPath, 16 ) \ - SYSCALL_ENTRY( 0x005f, NtGdiGetPixel, 12 ) \ - SYSCALL_ENTRY( 0x0060, NtGdiGetRandomRgn, 12 ) \ - SYSCALL_ENTRY( 0x0061, NtGdiGetRasterizerCaps, 8 ) \ - SYSCALL_ENTRY( 0x0062, NtGdiGetRealizationInfo, 8 ) \ - SYSCALL_ENTRY( 0x0063, NtGdiGetRegionData, 12 ) \ - SYSCALL_ENTRY( 0x0064, NtGdiGetRgnBox, 8 ) \ - SYSCALL_ENTRY( 0x0065, NtGdiGetSpoolMessage, 16 ) \ - SYSCALL_ENTRY( 0x0066, NtGdiGetSystemPaletteUse, 4 ) \ - SYSCALL_ENTRY( 0x0067, NtGdiGetTextCharsetInfo, 12 ) \ - SYSCALL_ENTRY( 0x0068, NtGdiGetTextExtentExW, 32 ) \ - SYSCALL_ENTRY( 0x0069, NtGdiGetTextFaceW, 16 ) \ - SYSCALL_ENTRY( 0x006a, NtGdiGetTextMetricsW, 12 ) \ - SYSCALL_ENTRY( 0x006b, NtGdiGetTransform, 12 ) \ - SYSCALL_ENTRY( 0x006c, NtGdiGradientFill, 24 ) \ - SYSCALL_ENTRY( 0x006d, NtGdiHfontCreate, 20 ) \ - SYSCALL_ENTRY( 0x006e, NtGdiIcmBrushInfo, 32 ) \ - SYSCALL_ENTRY( 0x006f, NtGdiInitSpool, 0 ) \ - SYSCALL_ENTRY( 0x0070, NtGdiIntersectClipRect, 20 ) \ - SYSCALL_ENTRY( 0x0071, NtGdiInvertRgn, 8 ) \ - SYSCALL_ENTRY( 0x0072, NtGdiLineTo, 12 ) \ - SYSCALL_ENTRY( 0x0073, NtGdiMaskBlt, 52 ) \ - SYSCALL_ENTRY( 0x0074, NtGdiModifyWorldTransform, 12 ) \ - SYSCALL_ENTRY( 0x0075, NtGdiMoveTo, 16 ) \ - SYSCALL_ENTRY( 0x0076, NtGdiOffsetClipRgn, 12 ) \ - SYSCALL_ENTRY( 0x0077, NtGdiOffsetRgn, 12 ) \ - SYSCALL_ENTRY( 0x0078, NtGdiOpenDCW, 32 ) \ - SYSCALL_ENTRY( 0x0079, NtGdiPatBlt, 24 ) \ - SYSCALL_ENTRY( 0x007a, NtGdiPathToRegion, 4 ) \ - SYSCALL_ENTRY( 0x007b, NtGdiPlgBlt, 44 ) \ - SYSCALL_ENTRY( 0x007c, NtGdiPolyDraw, 16 ) \ - SYSCALL_ENTRY( 0x007d, NtGdiPolyPolyDraw, 20 ) \ - SYSCALL_ENTRY( 0x007e, NtGdiPtInRegion, 12 ) \ - SYSCALL_ENTRY( 0x007f, NtGdiPtVisible, 12 ) \ - SYSCALL_ENTRY( 0x0080, NtGdiRectInRegion, 8 ) \ - SYSCALL_ENTRY( 0x0081, NtGdiRectVisible, 8 ) \ - SYSCALL_ENTRY( 0x0082, NtGdiRectangle, 20 ) \ - SYSCALL_ENTRY( 0x0083, NtGdiRemoveFontMemResourceEx, 4 ) \ - SYSCALL_ENTRY( 0x0084, NtGdiRemoveFontResourceW, 24 ) \ - SYSCALL_ENTRY( 0x0085, NtGdiResetDC, 20 ) \ - SYSCALL_ENTRY( 0x0086, NtGdiResizePalette, 8 ) \ - SYSCALL_ENTRY( 0x0087, NtGdiRestoreDC, 8 ) \ - SYSCALL_ENTRY( 0x0088, NtGdiRoundRect, 28 ) \ - SYSCALL_ENTRY( 0x0089, NtGdiSaveDC, 4 ) \ - SYSCALL_ENTRY( 0x008a, NtGdiScaleViewportExtEx, 24 ) \ - SYSCALL_ENTRY( 0x008b, NtGdiScaleWindowExtEx, 24 ) \ - SYSCALL_ENTRY( 0x008c, NtGdiSelectBitmap, 8 ) \ - SYSCALL_ENTRY( 0x008d, NtGdiSelectBrush, 8 ) \ - SYSCALL_ENTRY( 0x008e, NtGdiSelectClipPath, 8 ) \ - SYSCALL_ENTRY( 0x008f, NtGdiSelectFont, 8 ) \ - SYSCALL_ENTRY( 0x0090, NtGdiSelectPen, 8 ) \ - SYSCALL_ENTRY( 0x0091, NtGdiSetBitmapBits, 12 ) \ - SYSCALL_ENTRY( 0x0092, NtGdiSetBitmapDimension, 16 ) \ - SYSCALL_ENTRY( 0x0093, NtGdiSetBoundsRect, 12 ) \ - SYSCALL_ENTRY( 0x0094, NtGdiSetBrushOrg, 16 ) \ - SYSCALL_ENTRY( 0x0095, NtGdiSetColorAdjustment, 8 ) \ - SYSCALL_ENTRY( 0x0096, NtGdiSetDIBitsToDeviceInternal, 64 ) \ - SYSCALL_ENTRY( 0x0097, NtGdiSetDeviceGammaRamp, 8 ) \ - SYSCALL_ENTRY( 0x0098, NtGdiSetLayout, 12 ) \ - SYSCALL_ENTRY( 0x0099, NtGdiSetMagicColors, 12 ) \ - SYSCALL_ENTRY( 0x009a, NtGdiSetMetaRgn, 4 ) \ - SYSCALL_ENTRY( 0x009b, NtGdiSetPixel, 16 ) \ - SYSCALL_ENTRY( 0x009c, NtGdiSetPixelFormat, 8 ) \ - SYSCALL_ENTRY( 0x009d, NtGdiSetRectRgn, 20 ) \ - SYSCALL_ENTRY( 0x009e, NtGdiSetSystemPaletteUse, 8 ) \ - SYSCALL_ENTRY( 0x009f, NtGdiSetTextJustification, 12 ) \ - SYSCALL_ENTRY( 0x00a0, NtGdiSetVirtualResolution, 20 ) \ - SYSCALL_ENTRY( 0x00a1, NtGdiStartDoc, 16 ) \ - SYSCALL_ENTRY( 0x00a2, NtGdiStartPage, 4 ) \ - SYSCALL_ENTRY( 0x00a3, NtGdiStretchBlt, 48 ) \ - SYSCALL_ENTRY( 0x00a4, NtGdiStretchDIBitsInternal, 64 ) \ - SYSCALL_ENTRY( 0x00a5, NtGdiStrokeAndFillPath, 4 ) \ - SYSCALL_ENTRY( 0x00a6, NtGdiStrokePath, 4 ) \ - SYSCALL_ENTRY( 0x00a7, NtGdiSwapBuffers, 4 ) \ - SYSCALL_ENTRY( 0x00a8, NtGdiTransformPoints, 20 ) \ - SYSCALL_ENTRY( 0x00a9, NtGdiTransparentBlt, 44 ) \ - SYSCALL_ENTRY( 0x00aa, NtGdiUnrealizeObject, 4 ) \ - SYSCALL_ENTRY( 0x00ab, NtGdiUpdateColors, 4 ) \ - SYSCALL_ENTRY( 0x00ac, NtGdiWidenPath, 4 ) \ - SYSCALL_ENTRY( 0x00ad, NtUserActivateKeyboardLayout, 8 ) \ - SYSCALL_ENTRY( 0x00ae, NtUserAddClipboardFormatListener, 4 ) \ - SYSCALL_ENTRY( 0x00af, NtUserAssociateInputContext, 12 ) \ - SYSCALL_ENTRY( 0x00b0, NtUserAttachThreadInput, 12 ) \ - SYSCALL_ENTRY( 0x00b1, NtUserBeginPaint, 8 ) \ - SYSCALL_ENTRY( 0x00b2, NtUserBuildHimcList, 16 ) \ - SYSCALL_ENTRY( 0x00b3, NtUserBuildHwndList, 32 ) \ - SYSCALL_ENTRY( 0x00b4, NtUserCallHwnd, 8 ) \ - SYSCALL_ENTRY( 0x00b5, NtUserCallHwndParam, 12 ) \ - SYSCALL_ENTRY( 0x00b6, NtUserCallMsgFilter, 8 ) \ - SYSCALL_ENTRY( 0x00b7, NtUserCallNextHookEx, 16 ) \ - SYSCALL_ENTRY( 0x00b8, NtUserCallNoParam, 4 ) \ - SYSCALL_ENTRY( 0x00b9, NtUserCallOneParam, 8 ) \ - SYSCALL_ENTRY( 0x00ba, NtUserCallTwoParam, 12 ) \ - SYSCALL_ENTRY( 0x00bb, NtUserChangeClipboardChain, 8 ) \ - SYSCALL_ENTRY( 0x00bc, NtUserChangeDisplaySettings, 20 ) \ - SYSCALL_ENTRY( 0x00bd, NtUserCheckMenuItem, 12 ) \ - SYSCALL_ENTRY( 0x00be, NtUserChildWindowFromPointEx, 16 ) \ - SYSCALL_ENTRY( 0x00bf, NtUserClipCursor, 4 ) \ - SYSCALL_ENTRY( 0x00c0, NtUserCloseClipboard, 0 ) \ - SYSCALL_ENTRY( 0x00c1, NtUserCloseDesktop, 4 ) \ - SYSCALL_ENTRY( 0x00c2, NtUserCloseWindowStation, 4 ) \ - SYSCALL_ENTRY( 0x00c3, NtUserCopyAcceleratorTable, 12 ) \ - SYSCALL_ENTRY( 0x00c4, NtUserCountClipboardFormats, 0 ) \ - SYSCALL_ENTRY( 0x00c5, NtUserCreateAcceleratorTable, 8 ) \ - SYSCALL_ENTRY( 0x00c6, NtUserCreateCaret, 16 ) \ - SYSCALL_ENTRY( 0x00c7, NtUserCreateDesktopEx, 24 ) \ - SYSCALL_ENTRY( 0x00c8, NtUserCreateInputContext, 4 ) \ - SYSCALL_ENTRY( 0x00c9, NtUserCreateWindowEx, 68 ) \ - SYSCALL_ENTRY( 0x00ca, NtUserCreateWindowStation, 28 ) \ - SYSCALL_ENTRY( 0x00cb, NtUserDeferWindowPosAndBand, 40 ) \ - SYSCALL_ENTRY( 0x00cc, NtUserDeleteMenu, 12 ) \ - SYSCALL_ENTRY( 0x00cd, NtUserDestroyAcceleratorTable, 4 ) \ - SYSCALL_ENTRY( 0x00ce, NtUserDestroyCursor, 8 ) \ - SYSCALL_ENTRY( 0x00cf, NtUserDestroyInputContext, 4 ) \ - SYSCALL_ENTRY( 0x00d0, NtUserDestroyMenu, 4 ) \ - SYSCALL_ENTRY( 0x00d1, NtUserDestroyWindow, 4 ) \ - SYSCALL_ENTRY( 0x00d2, NtUserDisableThreadIme, 4 ) \ - SYSCALL_ENTRY( 0x00d3, NtUserDispatchMessage, 4 ) \ - SYSCALL_ENTRY( 0x00d4, NtUserDisplayConfigGetDeviceInfo, 4 ) \ - SYSCALL_ENTRY( 0x00d5, NtUserDragDetect, 12 ) \ - SYSCALL_ENTRY( 0x00d6, NtUserDragObject, 20 ) \ - SYSCALL_ENTRY( 0x00d7, NtUserDrawCaptionTemp, 28 ) \ - SYSCALL_ENTRY( 0x00d8, NtUserDrawIconEx, 36 ) \ - SYSCALL_ENTRY( 0x00d9, NtUserDrawMenuBarTemp, 20 ) \ - SYSCALL_ENTRY( 0x00da, NtUserEmptyClipboard, 0 ) \ - SYSCALL_ENTRY( 0x00db, NtUserEnableMenuItem, 12 ) \ - SYSCALL_ENTRY( 0x00dc, NtUserEnableMouseInPointer, 4 ) \ - SYSCALL_ENTRY( 0x00dd, NtUserEnableScrollBar, 12 ) \ - SYSCALL_ENTRY( 0x00de, NtUserEndDeferWindowPosEx, 8 ) \ - SYSCALL_ENTRY( 0x00df, NtUserEndMenu, 0 ) \ - SYSCALL_ENTRY( 0x00e0, NtUserEndPaint, 8 ) \ - SYSCALL_ENTRY( 0x00e1, NtUserEnumDisplayDevices, 16 ) \ - SYSCALL_ENTRY( 0x00e2, NtUserEnumDisplayMonitors, 16 ) \ - SYSCALL_ENTRY( 0x00e3, NtUserEnumDisplaySettings, 16 ) \ - SYSCALL_ENTRY( 0x00e4, NtUserExcludeUpdateRgn, 8 ) \ - SYSCALL_ENTRY( 0x00e5, NtUserFindExistingCursorIcon, 12 ) \ - SYSCALL_ENTRY( 0x00e6, NtUserFindWindowEx, 20 ) \ - SYSCALL_ENTRY( 0x00e7, NtUserFlashWindowEx, 4 ) \ - SYSCALL_ENTRY( 0x00e8, NtUserGetAncestor, 8 ) \ - SYSCALL_ENTRY( 0x00e9, NtUserGetAsyncKeyState, 4 ) \ - SYSCALL_ENTRY( 0x00ea, NtUserGetAtomName, 8 ) \ - SYSCALL_ENTRY( 0x00eb, NtUserGetCaretBlinkTime, 0 ) \ - SYSCALL_ENTRY( 0x00ec, NtUserGetCaretPos, 4 ) \ - SYSCALL_ENTRY( 0x00ed, NtUserGetClassInfoEx, 20 ) \ - SYSCALL_ENTRY( 0x00ee, NtUserGetClassName, 12 ) \ - SYSCALL_ENTRY( 0x00ef, NtUserGetClipboardData, 8 ) \ - SYSCALL_ENTRY( 0x00f0, NtUserGetClipboardFormatName, 12 ) \ - SYSCALL_ENTRY( 0x00f1, NtUserGetClipboardOwner, 0 ) \ - SYSCALL_ENTRY( 0x00f2, NtUserGetClipboardSequenceNumber, 0 ) \ - SYSCALL_ENTRY( 0x00f3, NtUserGetClipboardViewer, 0 ) \ - SYSCALL_ENTRY( 0x00f4, NtUserGetCursor, 0 ) \ - SYSCALL_ENTRY( 0x00f5, NtUserGetCursorFrameInfo, 16 ) \ - SYSCALL_ENTRY( 0x00f6, NtUserGetCursorInfo, 4 ) \ - SYSCALL_ENTRY( 0x00f7, NtUserGetDC, 4 ) \ - SYSCALL_ENTRY( 0x00f8, NtUserGetDCEx, 12 ) \ - SYSCALL_ENTRY( 0x00f9, NtUserGetDisplayConfigBufferSizes, 12 ) \ - SYSCALL_ENTRY( 0x00fa, NtUserGetDoubleClickTime, 0 ) \ - SYSCALL_ENTRY( 0x00fb, NtUserGetDpiForMonitor, 16 ) \ - SYSCALL_ENTRY( 0x00fc, NtUserGetForegroundWindow, 0 ) \ - SYSCALL_ENTRY( 0x00fd, NtUserGetGUIThreadInfo, 8 ) \ - SYSCALL_ENTRY( 0x00fe, NtUserGetIconInfo, 24 ) \ - SYSCALL_ENTRY( 0x00ff, NtUserGetIconSize, 16 ) \ - SYSCALL_ENTRY( 0x0100, NtUserGetInternalWindowPos, 12 ) \ - SYSCALL_ENTRY( 0x0101, NtUserGetKeyNameText, 12 ) \ - SYSCALL_ENTRY( 0x0102, NtUserGetKeyState, 4 ) \ - SYSCALL_ENTRY( 0x0103, NtUserGetKeyboardLayout, 4 ) \ - SYSCALL_ENTRY( 0x0104, NtUserGetKeyboardLayoutList, 8 ) \ - SYSCALL_ENTRY( 0x0105, NtUserGetKeyboardLayoutName, 4 ) \ - SYSCALL_ENTRY( 0x0106, NtUserGetKeyboardState, 4 ) \ - SYSCALL_ENTRY( 0x0107, NtUserGetLayeredWindowAttributes, 16 ) \ - SYSCALL_ENTRY( 0x0108, NtUserGetMenuBarInfo, 16 ) \ - SYSCALL_ENTRY( 0x0109, NtUserGetMenuItemRect, 16 ) \ - SYSCALL_ENTRY( 0x010a, NtUserGetMessage, 16 ) \ - SYSCALL_ENTRY( 0x010b, NtUserGetMouseMovePointsEx, 20 ) \ - SYSCALL_ENTRY( 0x010c, NtUserGetObjectInformation, 20 ) \ - SYSCALL_ENTRY( 0x010d, NtUserGetOpenClipboardWindow, 0 ) \ - SYSCALL_ENTRY( 0x010e, NtUserGetPointerInfoList, 32 ) \ - SYSCALL_ENTRY( 0x010f, NtUserGetPriorityClipboardFormat, 8 ) \ - SYSCALL_ENTRY( 0x0110, NtUserGetProcessDpiAwarenessContext, 4 ) \ - SYSCALL_ENTRY( 0x0111, NtUserGetProcessWindowStation, 0 ) \ - SYSCALL_ENTRY( 0x0112, NtUserGetProp, 8 ) \ - SYSCALL_ENTRY( 0x0113, NtUserGetQueueStatus, 4 ) \ - SYSCALL_ENTRY( 0x0114, NtUserGetRawInputBuffer, 12 ) \ - SYSCALL_ENTRY( 0x0115, NtUserGetRawInputData, 20 ) \ - SYSCALL_ENTRY( 0x0116, NtUserGetRawInputDeviceInfo, 16 ) \ - SYSCALL_ENTRY( 0x0117, NtUserGetRawInputDeviceList, 12 ) \ - SYSCALL_ENTRY( 0x0118, NtUserGetRegisteredRawInputDevices, 12 ) \ - SYSCALL_ENTRY( 0x0119, NtUserGetScrollBarInfo, 12 ) \ - SYSCALL_ENTRY( 0x011a, NtUserGetSystemDpiForProcess, 4 ) \ - SYSCALL_ENTRY( 0x011b, NtUserGetSystemMenu, 8 ) \ - SYSCALL_ENTRY( 0x011c, NtUserGetThreadDesktop, 4 ) \ - SYSCALL_ENTRY( 0x011d, NtUserGetTitleBarInfo, 8 ) \ - SYSCALL_ENTRY( 0x011e, NtUserGetUpdateRect, 12 ) \ - SYSCALL_ENTRY( 0x011f, NtUserGetUpdateRgn, 12 ) \ - SYSCALL_ENTRY( 0x0120, NtUserGetUpdatedClipboardFormats, 12 ) \ - SYSCALL_ENTRY( 0x0121, NtUserGetWindowDC, 4 ) \ - SYSCALL_ENTRY( 0x0122, NtUserGetWindowPlacement, 8 ) \ - SYSCALL_ENTRY( 0x0123, NtUserGetWindowRgnEx, 12 ) \ - SYSCALL_ENTRY( 0x0124, NtUserHideCaret, 4 ) \ - SYSCALL_ENTRY( 0x0125, NtUserHiliteMenuItem, 16 ) \ - SYSCALL_ENTRY( 0x0126, NtUserInitializeClientPfnArrays, 16 ) \ - SYSCALL_ENTRY( 0x0127, NtUserInternalGetWindowIcon, 8 ) \ - SYSCALL_ENTRY( 0x0128, NtUserInternalGetWindowText, 12 ) \ - SYSCALL_ENTRY( 0x0129, NtUserInvalidateRect, 12 ) \ - SYSCALL_ENTRY( 0x012a, NtUserInvalidateRgn, 12 ) \ - SYSCALL_ENTRY( 0x012b, NtUserIsClipboardFormatAvailable, 4 ) \ - SYSCALL_ENTRY( 0x012c, NtUserIsMouseInPointerEnabled, 0 ) \ - SYSCALL_ENTRY( 0x012d, NtUserKillTimer, 8 ) \ - SYSCALL_ENTRY( 0x012e, NtUserLockWindowUpdate, 4 ) \ - SYSCALL_ENTRY( 0x012f, NtUserLogicalToPerMonitorDPIPhysicalPoint, 8 ) \ - SYSCALL_ENTRY( 0x0130, NtUserMapVirtualKeyEx, 12 ) \ - SYSCALL_ENTRY( 0x0131, NtUserMenuItemFromPoint, 16 ) \ - SYSCALL_ENTRY( 0x0132, NtUserMessageCall, 28 ) \ - SYSCALL_ENTRY( 0x0133, NtUserMoveWindow, 24 ) \ - SYSCALL_ENTRY( 0x0134, NtUserMsgWaitForMultipleObjectsEx, 20 ) \ - SYSCALL_ENTRY( 0x0135, NtUserNotifyIMEStatus, 8 ) \ - SYSCALL_ENTRY( 0x0136, NtUserNotifyWinEvent, 16 ) \ - SYSCALL_ENTRY( 0x0137, NtUserOpenClipboard, 8 ) \ - SYSCALL_ENTRY( 0x0138, NtUserOpenDesktop, 12 ) \ - SYSCALL_ENTRY( 0x0139, NtUserOpenInputDesktop, 12 ) \ - SYSCALL_ENTRY( 0x013a, NtUserOpenWindowStation, 8 ) \ - SYSCALL_ENTRY( 0x013b, NtUserPeekMessage, 20 ) \ - SYSCALL_ENTRY( 0x013c, NtUserPerMonitorDPIPhysicalToLogicalPoint, 8 ) \ - SYSCALL_ENTRY( 0x013d, NtUserPostMessage, 16 ) \ - SYSCALL_ENTRY( 0x013e, NtUserPostThreadMessage, 16 ) \ - SYSCALL_ENTRY( 0x013f, NtUserPrintWindow, 12 ) \ - SYSCALL_ENTRY( 0x0140, NtUserQueryDisplayConfig, 24 ) \ - SYSCALL_ENTRY( 0x0141, NtUserQueryInputContext, 8 ) \ - SYSCALL_ENTRY( 0x0142, NtUserRealChildWindowFromPoint, 12 ) \ - SYSCALL_ENTRY( 0x0143, NtUserRedrawWindow, 16 ) \ - SYSCALL_ENTRY( 0x0144, NtUserRegisterClassExWOW, 28 ) \ - SYSCALL_ENTRY( 0x0145, NtUserRegisterHotKey, 16 ) \ - SYSCALL_ENTRY( 0x0146, NtUserRegisterRawInputDevices, 12 ) \ - SYSCALL_ENTRY( 0x0147, NtUserReleaseDC, 8 ) \ - SYSCALL_ENTRY( 0x0148, NtUserRemoveClipboardFormatListener, 4 ) \ - SYSCALL_ENTRY( 0x0149, NtUserRemoveMenu, 12 ) \ - SYSCALL_ENTRY( 0x014a, NtUserRemoveProp, 8 ) \ - SYSCALL_ENTRY( 0x014b, NtUserScrollDC, 28 ) \ - SYSCALL_ENTRY( 0x014c, NtUserScrollWindowEx, 32 ) \ - SYSCALL_ENTRY( 0x014d, NtUserSelectPalette, 12 ) \ - SYSCALL_ENTRY( 0x014e, NtUserSendInput, 12 ) \ - SYSCALL_ENTRY( 0x014f, NtUserSetActiveWindow, 4 ) \ - SYSCALL_ENTRY( 0x0150, NtUserSetCapture, 4 ) \ - SYSCALL_ENTRY( 0x0151, NtUserSetClassLong, 16 ) \ - SYSCALL_ENTRY( 0x0152, NtUserSetClassLongPtr, 16 ) \ - SYSCALL_ENTRY( 0x0153, NtUserSetClassWord, 12 ) \ - SYSCALL_ENTRY( 0x0154, NtUserSetClipboardData, 12 ) \ - SYSCALL_ENTRY( 0x0155, NtUserSetClipboardViewer, 4 ) \ - SYSCALL_ENTRY( 0x0156, NtUserSetCursor, 4 ) \ - SYSCALL_ENTRY( 0x0157, NtUserSetCursorIconData, 16 ) \ - SYSCALL_ENTRY( 0x0158, NtUserSetCursorPos, 8 ) \ - SYSCALL_ENTRY( 0x0159, NtUserSetFocus, 4 ) \ - SYSCALL_ENTRY( 0x015a, NtUserSetInternalWindowPos, 16 ) \ - SYSCALL_ENTRY( 0x015b, NtUserSetKeyboardState, 4 ) \ - SYSCALL_ENTRY( 0x015c, NtUserSetLayeredWindowAttributes, 16 ) \ - SYSCALL_ENTRY( 0x015d, NtUserSetMenu, 8 ) \ - SYSCALL_ENTRY( 0x015e, NtUserSetMenuContextHelpId, 8 ) \ - SYSCALL_ENTRY( 0x015f, NtUserSetMenuDefaultItem, 12 ) \ - SYSCALL_ENTRY( 0x0160, NtUserSetObjectInformation, 16 ) \ - SYSCALL_ENTRY( 0x0161, NtUserSetParent, 8 ) \ - SYSCALL_ENTRY( 0x0162, NtUserSetProcessDpiAwarenessContext, 8 ) \ - SYSCALL_ENTRY( 0x0163, NtUserSetProcessWindowStation, 4 ) \ - SYSCALL_ENTRY( 0x0164, NtUserSetProp, 12 ) \ - SYSCALL_ENTRY( 0x0165, NtUserSetScrollInfo, 16 ) \ - SYSCALL_ENTRY( 0x0166, NtUserSetShellWindowEx, 8 ) \ - SYSCALL_ENTRY( 0x0167, NtUserSetSysColors, 12 ) \ - SYSCALL_ENTRY( 0x0168, NtUserSetSystemMenu, 8 ) \ - SYSCALL_ENTRY( 0x0169, NtUserSetSystemTimer, 12 ) \ - SYSCALL_ENTRY( 0x016a, NtUserSetThreadDesktop, 4 ) \ - SYSCALL_ENTRY( 0x016b, NtUserSetTimer, 20 ) \ - SYSCALL_ENTRY( 0x016c, NtUserSetWinEventHook, 32 ) \ - SYSCALL_ENTRY( 0x016d, NtUserSetWindowLong, 16 ) \ - SYSCALL_ENTRY( 0x016e, NtUserSetWindowLongPtr, 16 ) \ - SYSCALL_ENTRY( 0x016f, NtUserSetWindowPlacement, 8 ) \ - SYSCALL_ENTRY( 0x0170, NtUserSetWindowPos, 28 ) \ - SYSCALL_ENTRY( 0x0171, NtUserSetWindowRgn, 12 ) \ - SYSCALL_ENTRY( 0x0172, NtUserSetWindowWord, 12 ) \ - SYSCALL_ENTRY( 0x0173, NtUserSetWindowsHookEx, 24 ) \ - SYSCALL_ENTRY( 0x0174, NtUserShowCaret, 4 ) \ - SYSCALL_ENTRY( 0x0175, NtUserShowCursor, 4 ) \ - SYSCALL_ENTRY( 0x0176, NtUserShowScrollBar, 12 ) \ - SYSCALL_ENTRY( 0x0177, NtUserShowWindow, 8 ) \ - SYSCALL_ENTRY( 0x0178, NtUserShowWindowAsync, 8 ) \ - SYSCALL_ENTRY( 0x0179, NtUserSystemParametersInfo, 16 ) \ - SYSCALL_ENTRY( 0x017a, NtUserSystemParametersInfoForDpi, 20 ) \ - SYSCALL_ENTRY( 0x017b, NtUserThunkedMenuInfo, 8 ) \ - SYSCALL_ENTRY( 0x017c, NtUserThunkedMenuItemInfo, 24 ) \ - SYSCALL_ENTRY( 0x017d, NtUserToUnicodeEx, 28 ) \ - SYSCALL_ENTRY( 0x017e, NtUserTrackMouseEvent, 4 ) \ - SYSCALL_ENTRY( 0x017f, NtUserTrackPopupMenuEx, 24 ) \ - SYSCALL_ENTRY( 0x0180, NtUserTranslateAccelerator, 12 ) \ - SYSCALL_ENTRY( 0x0181, NtUserTranslateMessage, 8 ) \ - SYSCALL_ENTRY( 0x0182, NtUserUnhookWinEvent, 4 ) \ - SYSCALL_ENTRY( 0x0183, NtUserUnhookWindowsHookEx, 4 ) \ - SYSCALL_ENTRY( 0x0184, NtUserUnregisterClass, 12 ) \ - SYSCALL_ENTRY( 0x0185, NtUserUnregisterHotKey, 8 ) \ - SYSCALL_ENTRY( 0x0186, NtUserUpdateInputContext, 12 ) \ - SYSCALL_ENTRY( 0x0187, NtUserUpdateLayeredWindow, 40 ) \ - SYSCALL_ENTRY( 0x0188, NtUserValidateRect, 8 ) \ - SYSCALL_ENTRY( 0x0189, NtUserVkKeyScanEx, 8 ) \ - SYSCALL_ENTRY( 0x018a, NtUserWaitForInputIdle, 12 ) \ - SYSCALL_ENTRY( 0x018b, NtUserWaitMessage, 0 ) \ - SYSCALL_ENTRY( 0x018c, NtUserWindowFromDC, 4 ) \ - SYSCALL_ENTRY( 0x018d, NtUserWindowFromPoint, 8 ) \ - SYSCALL_ENTRY( 0x018e, __wine_get_file_outline_text_metric, 16 ) \ - SYSCALL_ENTRY( 0x018f, __wine_get_icm_profile, 16 ) \ - SYSCALL_ENTRY( 0x0190, __wine_send_input, 12 ) - -#define ALL_SYSCALLS64 \ - SYSCALL_ENTRY( 0x0000, NtGdiAbortDoc, 8 ) \ - SYSCALL_ENTRY( 0x0001, NtGdiAbortPath, 8 ) \ - SYSCALL_ENTRY( 0x0002, NtGdiAddFontMemResourceEx, 40 ) \ - SYSCALL_ENTRY( 0x0003, NtGdiAddFontResourceW, 48 ) \ - SYSCALL_ENTRY( 0x0004, NtGdiAlphaBlend, 96 ) \ - SYSCALL_ENTRY( 0x0005, NtGdiAngleArc, 48 ) \ - SYSCALL_ENTRY( 0x0006, NtGdiArcInternal, 80 ) \ - SYSCALL_ENTRY( 0x0007, NtGdiBeginPath, 8 ) \ - SYSCALL_ENTRY( 0x0008, NtGdiBitBlt, 88 ) \ - SYSCALL_ENTRY( 0x0009, NtGdiCloseFigure, 8 ) \ - SYSCALL_ENTRY( 0x000a, NtGdiCombineRgn, 32 ) \ - SYSCALL_ENTRY( 0x000b, NtGdiComputeXformCoefficients, 8 ) \ - SYSCALL_ENTRY( 0x000c, NtGdiCreateBitmap, 40 ) \ - SYSCALL_ENTRY( 0x000d, NtGdiCreateClientObj, 8 ) \ - SYSCALL_ENTRY( 0x000e, NtGdiCreateCompatibleBitmap, 24 ) \ - SYSCALL_ENTRY( 0x000f, NtGdiCreateCompatibleDC, 8 ) \ - SYSCALL_ENTRY( 0x0010, NtGdiCreateDIBBrush, 48 ) \ - SYSCALL_ENTRY( 0x0011, NtGdiCreateDIBSection, 72 ) \ - SYSCALL_ENTRY( 0x0012, NtGdiCreateDIBitmapInternal, 88 ) \ - SYSCALL_ENTRY( 0x0013, NtGdiCreateEllipticRgn, 32 ) \ - SYSCALL_ENTRY( 0x0014, NtGdiCreateHalftonePalette, 8 ) \ - SYSCALL_ENTRY( 0x0015, NtGdiCreateHatchBrushInternal, 24 ) \ - SYSCALL_ENTRY( 0x0016, NtGdiCreateMetafileDC, 8 ) \ - SYSCALL_ENTRY( 0x0017, NtGdiCreatePaletteInternal, 16 ) \ - SYSCALL_ENTRY( 0x0018, NtGdiCreatePatternBrushInternal, 24 ) \ - SYSCALL_ENTRY( 0x0019, NtGdiCreatePen, 32 ) \ - SYSCALL_ENTRY( 0x001a, NtGdiCreateRectRgn, 32 ) \ - SYSCALL_ENTRY( 0x001b, NtGdiCreateRoundRectRgn, 48 ) \ - SYSCALL_ENTRY( 0x001c, NtGdiCreateSolidBrush, 16 ) \ - SYSCALL_ENTRY( 0x001d, NtGdiDdDDICheckVidPnExclusiveOwnership, 8 ) \ - SYSCALL_ENTRY( 0x001e, NtGdiDdDDICloseAdapter, 8 ) \ - SYSCALL_ENTRY( 0x001f, NtGdiDdDDICreateDCFromMemory, 8 ) \ - SYSCALL_ENTRY( 0x0020, NtGdiDdDDICreateDevice, 8 ) \ - SYSCALL_ENTRY( 0x0021, NtGdiDdDDIDestroyDCFromMemory, 8 ) \ - SYSCALL_ENTRY( 0x0022, NtGdiDdDDIDestroyDevice, 8 ) \ - SYSCALL_ENTRY( 0x0023, NtGdiDdDDIEscape, 8 ) \ - SYSCALL_ENTRY( 0x0024, NtGdiDdDDIOpenAdapterFromDeviceName, 8 ) \ - SYSCALL_ENTRY( 0x0025, NtGdiDdDDIOpenAdapterFromHdc, 8 ) \ - SYSCALL_ENTRY( 0x0026, NtGdiDdDDIOpenAdapterFromLuid, 8 ) \ - SYSCALL_ENTRY( 0x0027, NtGdiDdDDIQueryAdapterInfo, 8 ) \ - SYSCALL_ENTRY( 0x0028, NtGdiDdDDIQueryStatistics, 8 ) \ - SYSCALL_ENTRY( 0x0029, NtGdiDdDDIQueryVideoMemoryInfo, 8 ) \ - SYSCALL_ENTRY( 0x002a, NtGdiDdDDISetQueuedLimit, 8 ) \ - SYSCALL_ENTRY( 0x002b, NtGdiDdDDISetVidPnSourceOwner, 8 ) \ - SYSCALL_ENTRY( 0x002c, NtGdiDeleteClientObj, 8 ) \ - SYSCALL_ENTRY( 0x002d, NtGdiDeleteObjectApp, 8 ) \ - SYSCALL_ENTRY( 0x002e, NtGdiDescribePixelFormat, 32 ) \ - SYSCALL_ENTRY( 0x002f, NtGdiDoPalette, 48 ) \ - SYSCALL_ENTRY( 0x0030, NtGdiDrawStream, 24 ) \ - SYSCALL_ENTRY( 0x0031, NtGdiEllipse, 40 ) \ - SYSCALL_ENTRY( 0x0032, NtGdiEndDoc, 8 ) \ - SYSCALL_ENTRY( 0x0033, NtGdiEndPage, 8 ) \ - SYSCALL_ENTRY( 0x0034, NtGdiEndPath, 8 ) \ - SYSCALL_ENTRY( 0x0035, NtGdiEnumFonts, 64 ) \ - SYSCALL_ENTRY( 0x0036, NtGdiEqualRgn, 16 ) \ - SYSCALL_ENTRY( 0x0037, NtGdiExcludeClipRect, 40 ) \ - SYSCALL_ENTRY( 0x0038, NtGdiExtCreatePen, 88 ) \ - SYSCALL_ENTRY( 0x0039, NtGdiExtCreateRegion, 24 ) \ - SYSCALL_ENTRY( 0x003a, NtGdiExtEscape, 64 ) \ - SYSCALL_ENTRY( 0x003b, NtGdiExtFloodFill, 40 ) \ - SYSCALL_ENTRY( 0x003c, NtGdiExtGetObjectW, 24 ) \ - SYSCALL_ENTRY( 0x003d, NtGdiExtSelectClipRgn, 24 ) \ - SYSCALL_ENTRY( 0x003e, NtGdiExtTextOutW, 72 ) \ - SYSCALL_ENTRY( 0x003f, NtGdiFillPath, 8 ) \ - SYSCALL_ENTRY( 0x0040, NtGdiFillRgn, 24 ) \ - SYSCALL_ENTRY( 0x0041, NtGdiFlattenPath, 8 ) \ - SYSCALL_ENTRY( 0x0042, NtGdiFlush, 0 ) \ - SYSCALL_ENTRY( 0x0043, NtGdiFontIsLinked, 8 ) \ - SYSCALL_ENTRY( 0x0044, NtGdiFrameRgn, 40 ) \ - SYSCALL_ENTRY( 0x0045, NtGdiGetAndSetDCDword, 32 ) \ - SYSCALL_ENTRY( 0x0046, NtGdiGetAppClipBox, 16 ) \ - SYSCALL_ENTRY( 0x0047, NtGdiGetBitmapBits, 24 ) \ - SYSCALL_ENTRY( 0x0048, NtGdiGetBitmapDimension, 16 ) \ - SYSCALL_ENTRY( 0x0049, NtGdiGetBoundsRect, 24 ) \ - SYSCALL_ENTRY( 0x004a, NtGdiGetCharABCWidthsW, 48 ) \ - SYSCALL_ENTRY( 0x004b, NtGdiGetCharWidthInfo, 16 ) \ - SYSCALL_ENTRY( 0x004c, NtGdiGetCharWidthW, 48 ) \ - SYSCALL_ENTRY( 0x004d, NtGdiGetColorAdjustment, 16 ) \ - SYSCALL_ENTRY( 0x004e, NtGdiGetDCDword, 24 ) \ - SYSCALL_ENTRY( 0x004f, NtGdiGetDCObject, 16 ) \ - SYSCALL_ENTRY( 0x0050, NtGdiGetDCPoint, 24 ) \ - SYSCALL_ENTRY( 0x0051, NtGdiGetDIBitsInternal, 72 ) \ - SYSCALL_ENTRY( 0x0052, NtGdiGetDeviceCaps, 16 ) \ - SYSCALL_ENTRY( 0x0053, NtGdiGetDeviceGammaRamp, 16 ) \ - SYSCALL_ENTRY( 0x0054, NtGdiGetFontData, 40 ) \ - SYSCALL_ENTRY( 0x0055, NtGdiGetFontFileData, 40 ) \ - SYSCALL_ENTRY( 0x0056, NtGdiGetFontFileInfo, 40 ) \ - SYSCALL_ENTRY( 0x0057, NtGdiGetFontUnicodeRanges, 16 ) \ - SYSCALL_ENTRY( 0x0058, NtGdiGetGlyphIndicesW, 40 ) \ - SYSCALL_ENTRY( 0x0059, NtGdiGetGlyphOutline, 64 ) \ - SYSCALL_ENTRY( 0x005a, NtGdiGetKerningPairs, 24 ) \ - SYSCALL_ENTRY( 0x005b, NtGdiGetNearestColor, 16 ) \ - SYSCALL_ENTRY( 0x005c, NtGdiGetNearestPaletteIndex, 16 ) \ - SYSCALL_ENTRY( 0x005d, NtGdiGetOutlineTextMetricsInternalW, 32 ) \ - SYSCALL_ENTRY( 0x005e, NtGdiGetPath, 32 ) \ - SYSCALL_ENTRY( 0x005f, NtGdiGetPixel, 24 ) \ - SYSCALL_ENTRY( 0x0060, NtGdiGetRandomRgn, 24 ) \ - SYSCALL_ENTRY( 0x0061, NtGdiGetRasterizerCaps, 16 ) \ - SYSCALL_ENTRY( 0x0062, NtGdiGetRealizationInfo, 16 ) \ - SYSCALL_ENTRY( 0x0063, NtGdiGetRegionData, 24 ) \ - SYSCALL_ENTRY( 0x0064, NtGdiGetRgnBox, 16 ) \ - SYSCALL_ENTRY( 0x0065, NtGdiGetSpoolMessage, 32 ) \ - SYSCALL_ENTRY( 0x0066, NtGdiGetSystemPaletteUse, 8 ) \ - SYSCALL_ENTRY( 0x0067, NtGdiGetTextCharsetInfo, 24 ) \ - SYSCALL_ENTRY( 0x0068, NtGdiGetTextExtentExW, 64 ) \ - SYSCALL_ENTRY( 0x0069, NtGdiGetTextFaceW, 32 ) \ - SYSCALL_ENTRY( 0x006a, NtGdiGetTextMetricsW, 24 ) \ - SYSCALL_ENTRY( 0x006b, NtGdiGetTransform, 24 ) \ - SYSCALL_ENTRY( 0x006c, NtGdiGradientFill, 48 ) \ - SYSCALL_ENTRY( 0x006d, NtGdiHfontCreate, 40 ) \ - SYSCALL_ENTRY( 0x006e, NtGdiIcmBrushInfo, 64 ) \ - SYSCALL_ENTRY( 0x006f, NtGdiInitSpool, 0 ) \ - SYSCALL_ENTRY( 0x0070, NtGdiIntersectClipRect, 40 ) \ - SYSCALL_ENTRY( 0x0071, NtGdiInvertRgn, 16 ) \ - SYSCALL_ENTRY( 0x0072, NtGdiLineTo, 24 ) \ - SYSCALL_ENTRY( 0x0073, NtGdiMaskBlt, 104 ) \ - SYSCALL_ENTRY( 0x0074, NtGdiModifyWorldTransform, 24 ) \ - SYSCALL_ENTRY( 0x0075, NtGdiMoveTo, 32 ) \ - SYSCALL_ENTRY( 0x0076, NtGdiOffsetClipRgn, 24 ) \ - SYSCALL_ENTRY( 0x0077, NtGdiOffsetRgn, 24 ) \ - SYSCALL_ENTRY( 0x0078, NtGdiOpenDCW, 64 ) \ - SYSCALL_ENTRY( 0x0079, NtGdiPatBlt, 48 ) \ - SYSCALL_ENTRY( 0x007a, NtGdiPathToRegion, 8 ) \ - SYSCALL_ENTRY( 0x007b, NtGdiPlgBlt, 88 ) \ - SYSCALL_ENTRY( 0x007c, NtGdiPolyDraw, 32 ) \ - SYSCALL_ENTRY( 0x007d, NtGdiPolyPolyDraw, 40 ) \ - SYSCALL_ENTRY( 0x007e, NtGdiPtInRegion, 24 ) \ - SYSCALL_ENTRY( 0x007f, NtGdiPtVisible, 24 ) \ - SYSCALL_ENTRY( 0x0080, NtGdiRectInRegion, 16 ) \ - SYSCALL_ENTRY( 0x0081, NtGdiRectVisible, 16 ) \ - SYSCALL_ENTRY( 0x0082, NtGdiRectangle, 40 ) \ - SYSCALL_ENTRY( 0x0083, NtGdiRemoveFontMemResourceEx, 8 ) \ - SYSCALL_ENTRY( 0x0084, NtGdiRemoveFontResourceW, 48 ) \ - SYSCALL_ENTRY( 0x0085, NtGdiResetDC, 40 ) \ - SYSCALL_ENTRY( 0x0086, NtGdiResizePalette, 16 ) \ - SYSCALL_ENTRY( 0x0087, NtGdiRestoreDC, 16 ) \ - SYSCALL_ENTRY( 0x0088, NtGdiRoundRect, 56 ) \ - SYSCALL_ENTRY( 0x0089, NtGdiSaveDC, 8 ) \ - SYSCALL_ENTRY( 0x008a, NtGdiScaleViewportExtEx, 48 ) \ - SYSCALL_ENTRY( 0x008b, NtGdiScaleWindowExtEx, 48 ) \ - SYSCALL_ENTRY( 0x008c, NtGdiSelectBitmap, 16 ) \ - SYSCALL_ENTRY( 0x008d, NtGdiSelectBrush, 16 ) \ - SYSCALL_ENTRY( 0x008e, NtGdiSelectClipPath, 16 ) \ - SYSCALL_ENTRY( 0x008f, NtGdiSelectFont, 16 ) \ - SYSCALL_ENTRY( 0x0090, NtGdiSelectPen, 16 ) \ - SYSCALL_ENTRY( 0x0091, NtGdiSetBitmapBits, 24 ) \ - SYSCALL_ENTRY( 0x0092, NtGdiSetBitmapDimension, 32 ) \ - SYSCALL_ENTRY( 0x0093, NtGdiSetBoundsRect, 24 ) \ - SYSCALL_ENTRY( 0x0094, NtGdiSetBrushOrg, 32 ) \ - SYSCALL_ENTRY( 0x0095, NtGdiSetColorAdjustment, 16 ) \ - SYSCALL_ENTRY( 0x0096, NtGdiSetDIBitsToDeviceInternal, 128 ) \ - SYSCALL_ENTRY( 0x0097, NtGdiSetDeviceGammaRamp, 16 ) \ - SYSCALL_ENTRY( 0x0098, NtGdiSetLayout, 24 ) \ - SYSCALL_ENTRY( 0x0099, NtGdiSetMagicColors, 24 ) \ - SYSCALL_ENTRY( 0x009a, NtGdiSetMetaRgn, 8 ) \ - SYSCALL_ENTRY( 0x009b, NtGdiSetPixel, 32 ) \ - SYSCALL_ENTRY( 0x009c, NtGdiSetPixelFormat, 16 ) \ - SYSCALL_ENTRY( 0x009d, NtGdiSetRectRgn, 40 ) \ - SYSCALL_ENTRY( 0x009e, NtGdiSetSystemPaletteUse, 16 ) \ - SYSCALL_ENTRY( 0x009f, NtGdiSetTextJustification, 24 ) \ - SYSCALL_ENTRY( 0x00a0, NtGdiSetVirtualResolution, 40 ) \ - SYSCALL_ENTRY( 0x00a1, NtGdiStartDoc, 32 ) \ - SYSCALL_ENTRY( 0x00a2, NtGdiStartPage, 8 ) \ - SYSCALL_ENTRY( 0x00a3, NtGdiStretchBlt, 96 ) \ - SYSCALL_ENTRY( 0x00a4, NtGdiStretchDIBitsInternal, 128 ) \ - SYSCALL_ENTRY( 0x00a5, NtGdiStrokeAndFillPath, 8 ) \ - SYSCALL_ENTRY( 0x00a6, NtGdiStrokePath, 8 ) \ - SYSCALL_ENTRY( 0x00a7, NtGdiSwapBuffers, 8 ) \ - SYSCALL_ENTRY( 0x00a8, NtGdiTransformPoints, 40 ) \ - SYSCALL_ENTRY( 0x00a9, NtGdiTransparentBlt, 88 ) \ - SYSCALL_ENTRY( 0x00aa, NtGdiUnrealizeObject, 8 ) \ - SYSCALL_ENTRY( 0x00ab, NtGdiUpdateColors, 8 ) \ - SYSCALL_ENTRY( 0x00ac, NtGdiWidenPath, 8 ) \ - SYSCALL_ENTRY( 0x00ad, NtUserActivateKeyboardLayout, 16 ) \ - SYSCALL_ENTRY( 0x00ae, NtUserAddClipboardFormatListener, 8 ) \ - SYSCALL_ENTRY( 0x00af, NtUserAssociateInputContext, 24 ) \ - SYSCALL_ENTRY( 0x00b0, NtUserAttachThreadInput, 24 ) \ - SYSCALL_ENTRY( 0x00b1, NtUserBeginPaint, 16 ) \ - SYSCALL_ENTRY( 0x00b2, NtUserBuildHimcList, 32 ) \ - SYSCALL_ENTRY( 0x00b3, NtUserBuildHwndList, 64 ) \ - SYSCALL_ENTRY( 0x00b4, NtUserCallHwnd, 16 ) \ - SYSCALL_ENTRY( 0x00b5, NtUserCallHwndParam, 24 ) \ - SYSCALL_ENTRY( 0x00b6, NtUserCallMsgFilter, 16 ) \ - SYSCALL_ENTRY( 0x00b7, NtUserCallNextHookEx, 32 ) \ - SYSCALL_ENTRY( 0x00b8, NtUserCallNoParam, 8 ) \ - SYSCALL_ENTRY( 0x00b9, NtUserCallOneParam, 16 ) \ - SYSCALL_ENTRY( 0x00ba, NtUserCallTwoParam, 24 ) \ - SYSCALL_ENTRY( 0x00bb, NtUserChangeClipboardChain, 16 ) \ - SYSCALL_ENTRY( 0x00bc, NtUserChangeDisplaySettings, 40 ) \ - SYSCALL_ENTRY( 0x00bd, NtUserCheckMenuItem, 24 ) \ - SYSCALL_ENTRY( 0x00be, NtUserChildWindowFromPointEx, 32 ) \ - SYSCALL_ENTRY( 0x00bf, NtUserClipCursor, 8 ) \ - SYSCALL_ENTRY( 0x00c0, NtUserCloseClipboard, 0 ) \ - SYSCALL_ENTRY( 0x00c1, NtUserCloseDesktop, 8 ) \ - SYSCALL_ENTRY( 0x00c2, NtUserCloseWindowStation, 8 ) \ - SYSCALL_ENTRY( 0x00c3, NtUserCopyAcceleratorTable, 24 ) \ - SYSCALL_ENTRY( 0x00c4, NtUserCountClipboardFormats, 0 ) \ - SYSCALL_ENTRY( 0x00c5, NtUserCreateAcceleratorTable, 16 ) \ - SYSCALL_ENTRY( 0x00c6, NtUserCreateCaret, 32 ) \ - SYSCALL_ENTRY( 0x00c7, NtUserCreateDesktopEx, 48 ) \ - SYSCALL_ENTRY( 0x00c8, NtUserCreateInputContext, 8 ) \ - SYSCALL_ENTRY( 0x00c9, NtUserCreateWindowEx, 136 ) \ - SYSCALL_ENTRY( 0x00ca, NtUserCreateWindowStation, 56 ) \ - SYSCALL_ENTRY( 0x00cb, NtUserDeferWindowPosAndBand, 80 ) \ - SYSCALL_ENTRY( 0x00cc, NtUserDeleteMenu, 24 ) \ - SYSCALL_ENTRY( 0x00cd, NtUserDestroyAcceleratorTable, 8 ) \ - SYSCALL_ENTRY( 0x00ce, NtUserDestroyCursor, 16 ) \ - SYSCALL_ENTRY( 0x00cf, NtUserDestroyInputContext, 8 ) \ - SYSCALL_ENTRY( 0x00d0, NtUserDestroyMenu, 8 ) \ - SYSCALL_ENTRY( 0x00d1, NtUserDestroyWindow, 8 ) \ - SYSCALL_ENTRY( 0x00d2, NtUserDisableThreadIme, 8 ) \ - SYSCALL_ENTRY( 0x00d3, NtUserDispatchMessage, 8 ) \ - SYSCALL_ENTRY( 0x00d4, NtUserDisplayConfigGetDeviceInfo, 8 ) \ - SYSCALL_ENTRY( 0x00d5, NtUserDragDetect, 24 ) \ - SYSCALL_ENTRY( 0x00d6, NtUserDragObject, 40 ) \ - SYSCALL_ENTRY( 0x00d7, NtUserDrawCaptionTemp, 56 ) \ - SYSCALL_ENTRY( 0x00d8, NtUserDrawIconEx, 72 ) \ - SYSCALL_ENTRY( 0x00d9, NtUserDrawMenuBarTemp, 40 ) \ - SYSCALL_ENTRY( 0x00da, NtUserEmptyClipboard, 0 ) \ - SYSCALL_ENTRY( 0x00db, NtUserEnableMenuItem, 24 ) \ - SYSCALL_ENTRY( 0x00dc, NtUserEnableMouseInPointer, 8 ) \ - SYSCALL_ENTRY( 0x00dd, NtUserEnableScrollBar, 24 ) \ - SYSCALL_ENTRY( 0x00de, NtUserEndDeferWindowPosEx, 16 ) \ - SYSCALL_ENTRY( 0x00df, NtUserEndMenu, 0 ) \ - SYSCALL_ENTRY( 0x00e0, NtUserEndPaint, 16 ) \ - SYSCALL_ENTRY( 0x00e1, NtUserEnumDisplayDevices, 32 ) \ - SYSCALL_ENTRY( 0x00e2, NtUserEnumDisplayMonitors, 32 ) \ - SYSCALL_ENTRY( 0x00e3, NtUserEnumDisplaySettings, 32 ) \ - SYSCALL_ENTRY( 0x00e4, NtUserExcludeUpdateRgn, 16 ) \ - SYSCALL_ENTRY( 0x00e5, NtUserFindExistingCursorIcon, 24 ) \ - SYSCALL_ENTRY( 0x00e6, NtUserFindWindowEx, 40 ) \ - SYSCALL_ENTRY( 0x00e7, NtUserFlashWindowEx, 8 ) \ - SYSCALL_ENTRY( 0x00e8, NtUserGetAncestor, 16 ) \ - SYSCALL_ENTRY( 0x00e9, NtUserGetAsyncKeyState, 8 ) \ - SYSCALL_ENTRY( 0x00ea, NtUserGetAtomName, 16 ) \ - SYSCALL_ENTRY( 0x00eb, NtUserGetCaretBlinkTime, 0 ) \ - SYSCALL_ENTRY( 0x00ec, NtUserGetCaretPos, 8 ) \ - SYSCALL_ENTRY( 0x00ed, NtUserGetClassInfoEx, 40 ) \ - SYSCALL_ENTRY( 0x00ee, NtUserGetClassName, 24 ) \ - SYSCALL_ENTRY( 0x00ef, NtUserGetClipboardData, 16 ) \ - SYSCALL_ENTRY( 0x00f0, NtUserGetClipboardFormatName, 24 ) \ - SYSCALL_ENTRY( 0x00f1, NtUserGetClipboardOwner, 0 ) \ - SYSCALL_ENTRY( 0x00f2, NtUserGetClipboardSequenceNumber, 0 ) \ - SYSCALL_ENTRY( 0x00f3, NtUserGetClipboardViewer, 0 ) \ - SYSCALL_ENTRY( 0x00f4, NtUserGetCursor, 0 ) \ - SYSCALL_ENTRY( 0x00f5, NtUserGetCursorFrameInfo, 32 ) \ - SYSCALL_ENTRY( 0x00f6, NtUserGetCursorInfo, 8 ) \ - SYSCALL_ENTRY( 0x00f7, NtUserGetDC, 8 ) \ - SYSCALL_ENTRY( 0x00f8, NtUserGetDCEx, 24 ) \ - SYSCALL_ENTRY( 0x00f9, NtUserGetDisplayConfigBufferSizes, 24 ) \ - SYSCALL_ENTRY( 0x00fa, NtUserGetDoubleClickTime, 0 ) \ - SYSCALL_ENTRY( 0x00fb, NtUserGetDpiForMonitor, 32 ) \ - SYSCALL_ENTRY( 0x00fc, NtUserGetForegroundWindow, 0 ) \ - SYSCALL_ENTRY( 0x00fd, NtUserGetGUIThreadInfo, 16 ) \ - SYSCALL_ENTRY( 0x00fe, NtUserGetIconInfo, 48 ) \ - SYSCALL_ENTRY( 0x00ff, NtUserGetIconSize, 32 ) \ - SYSCALL_ENTRY( 0x0100, NtUserGetInternalWindowPos, 24 ) \ - SYSCALL_ENTRY( 0x0101, NtUserGetKeyNameText, 24 ) \ - SYSCALL_ENTRY( 0x0102, NtUserGetKeyState, 8 ) \ - SYSCALL_ENTRY( 0x0103, NtUserGetKeyboardLayout, 8 ) \ - SYSCALL_ENTRY( 0x0104, NtUserGetKeyboardLayoutList, 16 ) \ - SYSCALL_ENTRY( 0x0105, NtUserGetKeyboardLayoutName, 8 ) \ - SYSCALL_ENTRY( 0x0106, NtUserGetKeyboardState, 8 ) \ - SYSCALL_ENTRY( 0x0107, NtUserGetLayeredWindowAttributes, 32 ) \ - SYSCALL_ENTRY( 0x0108, NtUserGetMenuBarInfo, 32 ) \ - SYSCALL_ENTRY( 0x0109, NtUserGetMenuItemRect, 32 ) \ - SYSCALL_ENTRY( 0x010a, NtUserGetMessage, 32 ) \ - SYSCALL_ENTRY( 0x010b, NtUserGetMouseMovePointsEx, 40 ) \ - SYSCALL_ENTRY( 0x010c, NtUserGetObjectInformation, 40 ) \ - SYSCALL_ENTRY( 0x010d, NtUserGetOpenClipboardWindow, 0 ) \ - SYSCALL_ENTRY( 0x010e, NtUserGetPointerInfoList, 64 ) \ - SYSCALL_ENTRY( 0x010f, NtUserGetPriorityClipboardFormat, 16 ) \ - SYSCALL_ENTRY( 0x0110, NtUserGetProcessDpiAwarenessContext, 8 ) \ - SYSCALL_ENTRY( 0x0111, NtUserGetProcessWindowStation, 0 ) \ - SYSCALL_ENTRY( 0x0112, NtUserGetProp, 16 ) \ - SYSCALL_ENTRY( 0x0113, NtUserGetQueueStatus, 8 ) \ - SYSCALL_ENTRY( 0x0114, NtUserGetRawInputBuffer, 24 ) \ - SYSCALL_ENTRY( 0x0115, NtUserGetRawInputData, 40 ) \ - SYSCALL_ENTRY( 0x0116, NtUserGetRawInputDeviceInfo, 32 ) \ - SYSCALL_ENTRY( 0x0117, NtUserGetRawInputDeviceList, 24 ) \ - SYSCALL_ENTRY( 0x0118, NtUserGetRegisteredRawInputDevices, 24 ) \ - SYSCALL_ENTRY( 0x0119, NtUserGetScrollBarInfo, 24 ) \ - SYSCALL_ENTRY( 0x011a, NtUserGetSystemDpiForProcess, 8 ) \ - SYSCALL_ENTRY( 0x011b, NtUserGetSystemMenu, 16 ) \ - SYSCALL_ENTRY( 0x011c, NtUserGetThreadDesktop, 8 ) \ - SYSCALL_ENTRY( 0x011d, NtUserGetTitleBarInfo, 16 ) \ - SYSCALL_ENTRY( 0x011e, NtUserGetUpdateRect, 24 ) \ - SYSCALL_ENTRY( 0x011f, NtUserGetUpdateRgn, 24 ) \ - SYSCALL_ENTRY( 0x0120, NtUserGetUpdatedClipboardFormats, 24 ) \ - SYSCALL_ENTRY( 0x0121, NtUserGetWindowDC, 8 ) \ - SYSCALL_ENTRY( 0x0122, NtUserGetWindowPlacement, 16 ) \ - SYSCALL_ENTRY( 0x0123, NtUserGetWindowRgnEx, 24 ) \ - SYSCALL_ENTRY( 0x0124, NtUserHideCaret, 8 ) \ - SYSCALL_ENTRY( 0x0125, NtUserHiliteMenuItem, 32 ) \ - SYSCALL_ENTRY( 0x0126, NtUserInitializeClientPfnArrays, 32 ) \ - SYSCALL_ENTRY( 0x0127, NtUserInternalGetWindowIcon, 16 ) \ - SYSCALL_ENTRY( 0x0128, NtUserInternalGetWindowText, 24 ) \ - SYSCALL_ENTRY( 0x0129, NtUserInvalidateRect, 24 ) \ - SYSCALL_ENTRY( 0x012a, NtUserInvalidateRgn, 24 ) \ - SYSCALL_ENTRY( 0x012b, NtUserIsClipboardFormatAvailable, 8 ) \ - SYSCALL_ENTRY( 0x012c, NtUserIsMouseInPointerEnabled, 0 ) \ - SYSCALL_ENTRY( 0x012d, NtUserKillTimer, 16 ) \ - SYSCALL_ENTRY( 0x012e, NtUserLockWindowUpdate, 8 ) \ - SYSCALL_ENTRY( 0x012f, NtUserLogicalToPerMonitorDPIPhysicalPoint, 16 ) \ - SYSCALL_ENTRY( 0x0130, NtUserMapVirtualKeyEx, 24 ) \ - SYSCALL_ENTRY( 0x0131, NtUserMenuItemFromPoint, 32 ) \ - SYSCALL_ENTRY( 0x0132, NtUserMessageCall, 56 ) \ - SYSCALL_ENTRY( 0x0133, NtUserMoveWindow, 48 ) \ - SYSCALL_ENTRY( 0x0134, NtUserMsgWaitForMultipleObjectsEx, 40 ) \ - SYSCALL_ENTRY( 0x0135, NtUserNotifyIMEStatus, 16 ) \ - SYSCALL_ENTRY( 0x0136, NtUserNotifyWinEvent, 32 ) \ - SYSCALL_ENTRY( 0x0137, NtUserOpenClipboard, 16 ) \ - SYSCALL_ENTRY( 0x0138, NtUserOpenDesktop, 24 ) \ - SYSCALL_ENTRY( 0x0139, NtUserOpenInputDesktop, 24 ) \ - SYSCALL_ENTRY( 0x013a, NtUserOpenWindowStation, 16 ) \ - SYSCALL_ENTRY( 0x013b, NtUserPeekMessage, 40 ) \ - SYSCALL_ENTRY( 0x013c, NtUserPerMonitorDPIPhysicalToLogicalPoint, 16 ) \ - SYSCALL_ENTRY( 0x013d, NtUserPostMessage, 32 ) \ - SYSCALL_ENTRY( 0x013e, NtUserPostThreadMessage, 32 ) \ - SYSCALL_ENTRY( 0x013f, NtUserPrintWindow, 24 ) \ - SYSCALL_ENTRY( 0x0140, NtUserQueryDisplayConfig, 48 ) \ - SYSCALL_ENTRY( 0x0141, NtUserQueryInputContext, 16 ) \ - SYSCALL_ENTRY( 0x0142, NtUserRealChildWindowFromPoint, 24 ) \ - SYSCALL_ENTRY( 0x0143, NtUserRedrawWindow, 32 ) \ - SYSCALL_ENTRY( 0x0144, NtUserRegisterClassExWOW, 56 ) \ - SYSCALL_ENTRY( 0x0145, NtUserRegisterHotKey, 32 ) \ - SYSCALL_ENTRY( 0x0146, NtUserRegisterRawInputDevices, 24 ) \ - SYSCALL_ENTRY( 0x0147, NtUserReleaseDC, 16 ) \ - SYSCALL_ENTRY( 0x0148, NtUserRemoveClipboardFormatListener, 8 ) \ - SYSCALL_ENTRY( 0x0149, NtUserRemoveMenu, 24 ) \ - SYSCALL_ENTRY( 0x014a, NtUserRemoveProp, 16 ) \ - SYSCALL_ENTRY( 0x014b, NtUserScrollDC, 56 ) \ - SYSCALL_ENTRY( 0x014c, NtUserScrollWindowEx, 64 ) \ - SYSCALL_ENTRY( 0x014d, NtUserSelectPalette, 24 ) \ - SYSCALL_ENTRY( 0x014e, NtUserSendInput, 24 ) \ - SYSCALL_ENTRY( 0x014f, NtUserSetActiveWindow, 8 ) \ - SYSCALL_ENTRY( 0x0150, NtUserSetCapture, 8 ) \ - SYSCALL_ENTRY( 0x0151, NtUserSetClassLong, 32 ) \ - SYSCALL_ENTRY( 0x0152, NtUserSetClassLongPtr, 32 ) \ - SYSCALL_ENTRY( 0x0153, NtUserSetClassWord, 24 ) \ - SYSCALL_ENTRY( 0x0154, NtUserSetClipboardData, 24 ) \ - SYSCALL_ENTRY( 0x0155, NtUserSetClipboardViewer, 8 ) \ - SYSCALL_ENTRY( 0x0156, NtUserSetCursor, 8 ) \ - SYSCALL_ENTRY( 0x0157, NtUserSetCursorIconData, 32 ) \ - SYSCALL_ENTRY( 0x0158, NtUserSetCursorPos, 16 ) \ - SYSCALL_ENTRY( 0x0159, NtUserSetFocus, 8 ) \ - SYSCALL_ENTRY( 0x015a, NtUserSetInternalWindowPos, 32 ) \ - SYSCALL_ENTRY( 0x015b, NtUserSetKeyboardState, 8 ) \ - SYSCALL_ENTRY( 0x015c, NtUserSetLayeredWindowAttributes, 32 ) \ - SYSCALL_ENTRY( 0x015d, NtUserSetMenu, 16 ) \ - SYSCALL_ENTRY( 0x015e, NtUserSetMenuContextHelpId, 16 ) \ - SYSCALL_ENTRY( 0x015f, NtUserSetMenuDefaultItem, 24 ) \ - SYSCALL_ENTRY( 0x0160, NtUserSetObjectInformation, 32 ) \ - SYSCALL_ENTRY( 0x0161, NtUserSetParent, 16 ) \ - SYSCALL_ENTRY( 0x0162, NtUserSetProcessDpiAwarenessContext, 16 ) \ - SYSCALL_ENTRY( 0x0163, NtUserSetProcessWindowStation, 8 ) \ - SYSCALL_ENTRY( 0x0164, NtUserSetProp, 24 ) \ - SYSCALL_ENTRY( 0x0165, NtUserSetScrollInfo, 32 ) \ - SYSCALL_ENTRY( 0x0166, NtUserSetShellWindowEx, 16 ) \ - SYSCALL_ENTRY( 0x0167, NtUserSetSysColors, 24 ) \ - SYSCALL_ENTRY( 0x0168, NtUserSetSystemMenu, 16 ) \ - SYSCALL_ENTRY( 0x0169, NtUserSetSystemTimer, 24 ) \ - SYSCALL_ENTRY( 0x016a, NtUserSetThreadDesktop, 8 ) \ - SYSCALL_ENTRY( 0x016b, NtUserSetTimer, 40 ) \ - SYSCALL_ENTRY( 0x016c, NtUserSetWinEventHook, 64 ) \ - SYSCALL_ENTRY( 0x016d, NtUserSetWindowLong, 32 ) \ - SYSCALL_ENTRY( 0x016e, NtUserSetWindowLongPtr, 32 ) \ - SYSCALL_ENTRY( 0x016f, NtUserSetWindowPlacement, 16 ) \ - SYSCALL_ENTRY( 0x0170, NtUserSetWindowPos, 56 ) \ - SYSCALL_ENTRY( 0x0171, NtUserSetWindowRgn, 24 ) \ - SYSCALL_ENTRY( 0x0172, NtUserSetWindowWord, 24 ) \ - SYSCALL_ENTRY( 0x0173, NtUserSetWindowsHookEx, 48 ) \ - SYSCALL_ENTRY( 0x0174, NtUserShowCaret, 8 ) \ - SYSCALL_ENTRY( 0x0175, NtUserShowCursor, 8 ) \ - SYSCALL_ENTRY( 0x0176, NtUserShowScrollBar, 24 ) \ - SYSCALL_ENTRY( 0x0177, NtUserShowWindow, 16 ) \ - SYSCALL_ENTRY( 0x0178, NtUserShowWindowAsync, 16 ) \ - SYSCALL_ENTRY( 0x0179, NtUserSystemParametersInfo, 32 ) \ - SYSCALL_ENTRY( 0x017a, NtUserSystemParametersInfoForDpi, 40 ) \ - SYSCALL_ENTRY( 0x017b, NtUserThunkedMenuInfo, 16 ) \ - SYSCALL_ENTRY( 0x017c, NtUserThunkedMenuItemInfo, 48 ) \ - SYSCALL_ENTRY( 0x017d, NtUserToUnicodeEx, 56 ) \ - SYSCALL_ENTRY( 0x017e, NtUserTrackMouseEvent, 8 ) \ - SYSCALL_ENTRY( 0x017f, NtUserTrackPopupMenuEx, 48 ) \ - SYSCALL_ENTRY( 0x0180, NtUserTranslateAccelerator, 24 ) \ - SYSCALL_ENTRY( 0x0181, NtUserTranslateMessage, 16 ) \ - SYSCALL_ENTRY( 0x0182, NtUserUnhookWinEvent, 8 ) \ - SYSCALL_ENTRY( 0x0183, NtUserUnhookWindowsHookEx, 8 ) \ - SYSCALL_ENTRY( 0x0184, NtUserUnregisterClass, 24 ) \ - SYSCALL_ENTRY( 0x0185, NtUserUnregisterHotKey, 16 ) \ - SYSCALL_ENTRY( 0x0186, NtUserUpdateInputContext, 24 ) \ - SYSCALL_ENTRY( 0x0187, NtUserUpdateLayeredWindow, 80 ) \ - SYSCALL_ENTRY( 0x0188, NtUserValidateRect, 16 ) \ - SYSCALL_ENTRY( 0x0189, NtUserVkKeyScanEx, 16 ) \ - SYSCALL_ENTRY( 0x018a, NtUserWaitForInputIdle, 24 ) \ - SYSCALL_ENTRY( 0x018b, NtUserWaitMessage, 0 ) \ - SYSCALL_ENTRY( 0x018c, NtUserWindowFromDC, 8 ) \ - SYSCALL_ENTRY( 0x018d, NtUserWindowFromPoint, 16 ) \ - SYSCALL_ENTRY( 0x018e, __wine_get_file_outline_text_metric, 32 ) \ - SYSCALL_ENTRY( 0x018f, __wine_get_icm_profile, 32 ) \ - SYSCALL_ENTRY( 0x0190, __wine_send_input, 24 ) From a757b440aab42af3ecb414475bfa3878ed6f780e Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 18 Jan 2024 18:18:23 +0200 Subject: [PATCH 0006/1506] wine: Add autogen.sh. --- autogen.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000000..afd4a144aad --- /dev/null +++ b/autogen.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +tools/make_requests +dlls/winevulkan/make_vulkan -x vk.xml +autoreconf -ifv +rm -rf autom4te.cache + +echo "Now run ./configure" From 31f954ac23f996029561bb4c3df7fa5810d837cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 14 Nov 2023 13:44:00 +0100 Subject: [PATCH 0007/1506] Revert "makedep: Assume that all modules are built with msvcrt." This reverts commit a9183c7e3bd6ee25aeab2aed6c57a58d9558b614. CW-Bug-Id: #22729 --- tools/makedep.c | 55 +++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 92617142991..09f1f1087a4 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -201,6 +201,7 @@ struct makefile const char *staticlib; const char *importlib; const char *unixlib; + int use_msvcrt; int data_only; int is_win16; int is_exe; @@ -603,17 +604,6 @@ static int is_multiarch( unsigned int arch ) } -/******************************************************************* - * is_using_msvcrt - * - * Check if the files of a makefile use msvcrt by default. - */ -static int is_using_msvcrt( struct makefile *make ) -{ - return make->module || make->testdll; -} - - /******************************************************************* * arch_module_name */ @@ -872,7 +862,7 @@ static struct incl_file *add_generated_source( struct makefile *make, const char file->basename = xstrdup( filename ? filename : name ); file->filename = obj_dir_path( make, file->basename ); file->file->flags = FLAG_GENERATED; - file->use_msvcrt = is_using_msvcrt( make ); + file->use_msvcrt = make->use_msvcrt; list_add_tail( &make->sources, &file->entry ); if (make == include_makefile) { @@ -1623,7 +1613,7 @@ static struct incl_file *add_src_file( struct makefile *make, const char *name ) memset( file, 0, sizeof(*file) ); file->name = xstrdup(name); - file->use_msvcrt = is_using_msvcrt( make ); + file->use_msvcrt = make->use_msvcrt; file->is_external = !!make->extlib; list_add_tail( &make->sources, &file->entry ); if (make == include_makefile) @@ -1821,12 +1811,13 @@ static void add_generated_sources( struct makefile *make ) unsigned int i, arch; struct incl_file *source, *next, *file, *dlldata = NULL; struct strarray objs = get_expanded_make_var_array( make, "EXTRA_OBJS" ); + int multiarch = archs.count > 1 && make->use_msvcrt; LIST_FOR_EACH_ENTRY_SAFE( source, next, &make->sources, struct incl_file, entry ) { for (arch = 0; arch < archs.count; arch++) { - if (!is_multiarch( arch )) continue; + if (!arch != !multiarch) continue; if (source->file->flags & FLAG_IDL_CLIENT) { file = add_generated_source( make, replace_extension( source->name, ".idl", "_c.c" ), NULL, arch ); @@ -1945,7 +1936,7 @@ static void add_generated_sources( struct makefile *make ) { for (arch = 0; arch < archs.count; arch++) { - if (!is_multiarch( arch )) continue; + if (!arch != !multiarch) continue; file = add_generated_source( make, "testlist.o", "testlist.c", arch ); add_dependency( file->file, "wine/test.h", INCL_NORMAL ); add_all_includes( make, file, file->file ); @@ -2199,6 +2190,7 @@ static int is_crt_module( const char *file ) */ static const char *get_default_crt( const struct makefile *make ) { + if (!make->use_msvcrt) return NULL; if (make->module && is_crt_module( make->module )) return NULL; /* don't add crt import to crt dlls */ return !make->testdll && (!make->staticlib || make->extlib) ? "ucrtbase" : "msvcrt"; } @@ -2355,7 +2347,6 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi strarray_add( &ret, strmake( "-I%s", root_src_dir_path( "include/msvcrt" ))); for (i = 0; i < make->include_paths.count; i++) strarray_add( &ret, strmake( "-I%s", make->include_paths.str[i] )); - strarray_add( &ret, get_crt_define( make )); } strarray_addall( &ret, make->define_args ); strarray_addall( &ret, get_expanded_file_local_var( make, obj, "EXTRADEFS" )); @@ -2415,9 +2406,7 @@ static void output_winegcc_command( struct makefile *make, unsigned int arch ) output_filename( tools_path( make, "winebuild" )); } output_filenames( target_flags[arch] ); - if (arch) return; - output_filename( "-mno-cygwin" ); - output_filenames( lddll_flags ); + if (!arch) output_filenames( lddll_flags ); } @@ -2816,6 +2805,7 @@ static void output_source_idl( struct makefile *make, struct incl_file *source, struct strarray multiarch_targets[MAX_ARCHS] = { empty_strarray }; const char *dest; unsigned int i, arch; + int multiarch; if (find_include_file( make, strmake( "%s.h", obj ))) source->file->flags |= FLAG_IDL_HEADER; if (!source->file->flags) return; @@ -2839,9 +2829,10 @@ static void output_source_idl( struct makefile *make, struct incl_file *source, for (i = 0; i < ARRAY_SIZE(idl_outputs); i++) { if (!(source->file->flags & idl_outputs[i].flag)) continue; + multiarch = (make->use_msvcrt && archs.count > 1); for (arch = 0; arch < archs.count; arch++) { - if (!is_multiarch( arch )) continue; + if (!arch != !multiarch) continue; if (make->disabled[arch]) continue; dest = strmake( "%s%s%s", arch_dirs[arch], obj, idl_outputs[i].ext ); if (!find_src_file( make, dest )) strarray_add( &make->clean_files, dest ); @@ -3164,13 +3155,13 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou if (arch) { if (source->file->flags & FLAG_C_UNIX) return; - if (!is_using_msvcrt( make ) && !make->staticlib && !(source->file->flags & FLAG_C_IMPLIB)) return; + if (!make->use_msvcrt && !make->staticlib && !(source->file->flags & FLAG_C_IMPLIB)) return; } else if (source->file->flags & FLAG_C_UNIX) { if (!unix_lib_supported) return; } - else if (archs.count > 1 && is_using_msvcrt( make )) + else if (archs.count > 1 && make->use_msvcrt) { if (!so_dll_supported) return; if (!(source->file->flags & FLAG_C_IMPLIB) && (!make->staticlib || make->extlib)) return; @@ -3191,8 +3182,9 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou output( "%s: %s\n", obj_dir_path( make, obj_name ), source->filename ); output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), arch_make_variable( "CC", arch ), source->filename ); output_filenames( defines ); - if (!source->use_msvcrt) output_filenames( make->unix_cflags ); + if (source->file->flags & FLAG_C_UNIX) output_filenames( make->unix_cflags ); else output_filenames( make->extra_cflags ); + if (!make->use_msvcrt && !make->module) output_filenames( make->unix_cflags ); output_filenames( make->extlib ? extra_cflags_extlib[arch] : extra_cflags[arch] ); if (!arch) { @@ -3368,6 +3360,12 @@ static void output_module( struct makefile *make, unsigned int arch ) strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, arch ) ); if (!arch) strarray_addall( &all_libs, libs ); + if (!make->use_msvcrt) + { + strarray_addall( &all_libs, get_expanded_make_var_array( make, "UNIX_LIBS" )); + strarray_addall( &all_libs, libs ); + } + if (delay_load_flags[arch]) { for (i = 0; i < make->delayimports.count; i++) @@ -3557,7 +3555,7 @@ static void output_test_module( struct makefile *make, unsigned int arch ) output( ": %s", obj_dir_path( make, testmodule )); if (parent) { - char *parent_module = arch_module_name( make->testdll, arch ); + char *parent_module = arch_module_name( make->testdll, parent->use_msvcrt ? arch : 0 ); output_filename( obj_dir_path( parent, parent_module )); if (parent->unixlib) output_filename( obj_dir_path( parent, parent->unixlib )); } @@ -3808,7 +3806,8 @@ static void output_sources( struct makefile *make ) } else if (make->module) { - for (arch = 0; arch < archs.count; arch++) + if (!make->use_msvcrt) output_module( make, 0 ); + else for (arch = 0; arch < archs.count; arch++) { if (is_multiarch( arch )) output_module( make, arch ); if (make->importlib && (is_multiarch( arch ) || !is_native_arch_disabled( make ))) @@ -4232,9 +4231,13 @@ static void load_sources( struct makefile *make ) } make->is_win16 = strarray_exists( &make->extradllflags, "-m16" ); make->data_only = strarray_exists( &make->extradllflags, "-Wb,--data-only" ); + make->use_msvcrt = (make->module || make->testdll || make->is_win16) && + !strarray_exists( &make->extradllflags, "-mcygwin" ); make->is_exe = strarray_exists( &make->extradllflags, "-mconsole" ) || strarray_exists( &make->extradllflags, "-mwindows" ); + if (make->use_msvcrt) strarray_add_uniq( &make->extradllflags, "-mno-cygwin" ); + if (make->module) { /* add default install rules if nothing was specified */ @@ -4291,6 +4294,8 @@ static void load_sources( struct makefile *make ) add_generated_sources( make ); + if (make->use_msvcrt) strarray_add( &make->define_args, get_crt_define( make )); + LIST_FOR_EACH_ENTRY( file, &make->includes, struct incl_file, entry ) parse_file( make, file, 0 ); LIST_FOR_EACH_ENTRY( file, &make->sources, struct incl_file, entry ) get_dependencies( file, file ); From 30ab6b17abc16f098977cc481d616ae7ffc7f35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 26 Sep 2023 16:34:16 +0200 Subject: [PATCH 0008/1506] makedep: Allow using an external wine object dir. CW-Bug-Id: #22729 --- tools/makedep.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 09f1f1087a4..f5f3a39b826 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -143,6 +143,7 @@ static struct strarray subdirs; static struct strarray delay_import_libs; static struct strarray top_install[NB_INSTALL_RULES]; static const char *root_src_dir; +static const char *root_obj_dir; static const char *tools_dir; static const char *tools_ext; static const char *exe_ext; @@ -650,6 +651,16 @@ static char *root_src_dir_path( const char *path ) } +/******************************************************************* + * root_obj_dir_path + */ +static char *root_obj_dir_path( const char *path ) +{ + if (!root_obj_dir) return (char *)path; + return concat_paths( root_obj_dir, path ); +} + + /******************************************************************* * tools_dir_path */ @@ -2398,8 +2409,8 @@ static const char *cmd_prefix( const char *cmd ) */ static void output_winegcc_command( struct makefile *make, unsigned int arch ) { - output( "\t%s%s -o $@", cmd_prefix( "CCLD" ), tools_path( make, "winegcc" )); - output_filename( "--wine-objdir ." ); + output( "\t%s%s -o $@", cmd_prefix( "CCLD" ), tools_path( make, "winegcc" ) ); + output_filename( strmake( "--wine-objdir %s", root_obj_dir_path( "." ) ) ); if (tools_dir) { output_filename( "--winebuild" ); @@ -4283,7 +4294,7 @@ static void load_sources( struct makefile *make ) strarray_add( &make->include_args, strmake( "-I%s", make->src_dir )); if (make->parent_dir) strarray_add( &make->include_args, strmake( "-I%s", src_dir_path( make, make->parent_dir ))); - strarray_add( &make->include_args, "-Iinclude" ); + strarray_add( &make->include_args, strmake( "-I%s", root_obj_dir_path( "include" ) ) ); if (root_src_dir) strarray_add( &make->include_args, strmake( "-I%s", root_src_dir_path( "include" ))); list_init( &make->sources ); @@ -4414,6 +4425,7 @@ int main( int argc, char *argv[] ) top_install[i] = get_expanded_make_var_array( top_makefile, strmake( "TOP_%s", install_variables[i] )); root_src_dir = get_expanded_make_variable( top_makefile, "srcdir" ); + root_obj_dir = get_expanded_make_variable( top_makefile, "objdir" ); tools_dir = get_expanded_make_variable( top_makefile, "toolsdir" ); tools_ext = get_expanded_make_variable( top_makefile, "toolsext" ); exe_ext = get_expanded_make_variable( top_makefile, "EXEEXT" ); From aa5dcc625b69c3846aa4b8b5745c92f40e320414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 26 Sep 2023 16:34:50 +0200 Subject: [PATCH 0009/1506] makedep: Allow include to be missing from SUBDIRS. CW-Bug-Id: #22729 --- tools/makedep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index f5f3a39b826..0610862c981 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1452,9 +1452,9 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ if ((file = open_local_file( make, pFile->name, &pFile->filename ))) return file; /* check for global importlib (module dependency) */ - if (pFile->type == INCL_IMPORTLIB && find_importlib_module( pFile->name )) + if (pFile->type == INCL_IMPORTLIB) { - pFile->filename = pFile->name; + if (find_importlib_module( pFile->name )) pFile->filename = pFile->name; return NULL; } @@ -4494,6 +4494,8 @@ int main( int argc, char *argv[] ) for (i = 0; i < subdirs.count; i++) submakes[i] = parse_makefile( subdirs.str[i] ); + if (!include_makefile) include_makefile = parse_makefile( root_src_dir_path( "include" ) ); + load_sources( top_makefile ); load_sources( include_makefile ); for (i = 0; i < subdirs.count; i++) From 4e06bb49f9b8dfb5d8569c62efa4468dc37c2a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 20 Sep 2023 00:03:48 +0200 Subject: [PATCH 0010/1506] makedep: Allow building modules from external sources. CW-Bug-Id: #22729 --- tools/makedep.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 0610862c981..8d7813c5fe1 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -206,6 +206,7 @@ struct makefile int data_only; int is_win16; int is_exe; + int is_external; int disabled[MAX_ARCHS]; /* values generated at output time */ @@ -1507,7 +1508,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ return file; } - if (make->extlib) return NULL; /* ignore missing files in external libs */ + if (make->extlib || make->is_external) return NULL; /* ignore missing files in external libs */ fprintf( stderr, "%s:%d: error: ", pFile->included_by->file->name, pFile->included_line ); perror( pFile->name ); @@ -1625,7 +1626,7 @@ static struct incl_file *add_src_file( struct makefile *make, const char *name ) memset( file, 0, sizeof(*file) ); file->name = xstrdup(name); file->use_msvcrt = make->use_msvcrt; - file->is_external = !!make->extlib; + file->is_external = !!make->extlib || make->is_external; list_add_tail( &make->sources, &file->entry ); if (make == include_makefile) { @@ -2159,7 +2160,7 @@ static struct strarray add_unix_libraries( const struct makefile *make, struct s struct strarray all_libs = empty_strarray; unsigned int i, j; - if (strcmp( make->unixlib, "ntdll.so" )) strarray_add( &all_libs, "-lntdll" ); + if (strcmp( make->unixlib, "ntdll.so" ) && !make->is_external) strarray_add( &all_libs, "-lntdll" ); strarray_addall( &all_libs, get_expanded_make_var_array( make, "UNIX_LIBS" )); for (i = 0; i < all_libs.count; i++) @@ -4373,7 +4374,7 @@ static int parse_option( const char *opt ) int main( int argc, char *argv[] ) { const char *makeflags = getenv( "MAKEFLAGS" ); - const char *target; + const char *target, *tmp; unsigned int i, j, arch; if (makeflags) parse_makeflags( makeflags ); @@ -4492,7 +4493,16 @@ int main( int argc, char *argv[] ) subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" ); submakes = xmalloc( subdirs.count * sizeof(*submakes) ); - for (i = 0; i < subdirs.count; i++) submakes[i] = parse_makefile( subdirs.str[i] ); + for (i = 0; i < subdirs.count; i++) + { + submakes[i] = parse_makefile( subdirs.str[i] ); + if (*(tmp = subdirs.str[i]) == '/') + { + tmp = strmake( "dlls%s", strrchr( tmp, '/' ) ); + submakes[i]->is_external = 1; + } + submakes[i]->obj_dir = subdirs.str[i] = tmp; + } if (!include_makefile) include_makefile = parse_makefile( root_src_dir_path( "include" ) ); From 6e522216a23e1e43b3b609b516b3a9790cb3891d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 20 Sep 2023 09:49:29 +0200 Subject: [PATCH 0011/1506] makedep: Allow modules to have a different 64bit name. CW-Bug-Id: #22729 --- tools/makedep.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 8d7813c5fe1..8c8d5d70dba 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -197,6 +197,7 @@ struct makefile const char *obj_dir; const char *parent_dir; const char *module; + const char *module_x64; const char *testdll; const char *extlib; const char *staticlib; @@ -3311,12 +3312,15 @@ static const struct static void output_fake_module( struct makefile *make, const char *spec_file ) { unsigned int arch = 0; /* fake modules are always native */ - const char *name = strmake( "%s%s", arch_pe_dirs[arch], make->module ); + const char *name, *module = make->module; if (make->disabled[arch]) return; + if (make->module_x64 && !strcmp( archs.str[arch], "x86_64" )) module = make->module_x64; + + name = strmake( "%s%s", arch_pe_dirs[arch], module ); strarray_add( &make->all_targets[arch], name ); - add_install_rule( make, make->module, arch, name, strmake( "d$(dlldir)/%s", name )); + add_install_rule( make, module, arch, name, strmake( "d$(dlldir)/%s", name )); output( "%s:", obj_dir_path( make, name )); if (spec_file) output_filename( spec_file ); @@ -3343,27 +3347,28 @@ static void output_module( struct makefile *make, unsigned int arch ) struct strarray all_libs = empty_strarray; struct strarray dep_libs = empty_strarray; struct strarray imports = make->imports; - const char *module_name; + const char *module_name, *module = make->module; const char *debug_file; char *spec_file = NULL; unsigned int i; if (make->disabled[arch]) return; + if (make->module_x64 && !strcmp( archs.str[arch], "x86_64" )) module = make->module_x64; if (!make->is_exe) { if (make->data_only || strarray_exists( &make->extradllflags, "-Wl,--subsystem,native" )) { /* spec file is optional */ - struct incl_file *spec = find_src_file( make, replace_extension( make->module, ".dll", ".spec" )); + struct incl_file *spec = find_src_file( make, replace_extension( module, ".dll", ".spec" )); if (spec) spec_file = spec->filename; } - else spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" )); + else spec_file = src_dir_path( make, replace_extension( module, ".dll", ".spec" )); } if (!make->data_only) { - module_name = arch_module_name( make->module, arch ); + module_name = arch_module_name( module, arch ); if (!strarray_exists( &make->extradllflags, "-nodefaultlibs" )) default_imports = get_default_imports( make, imports ); @@ -3387,15 +3392,15 @@ static void output_module( struct makefile *make, unsigned int arch ) } } } - else module_name = strmake( "%s%s", arch_pe_dirs[arch], make->module ); + else module_name = strmake( "%s%s", arch_pe_dirs[arch], module ); strarray_add( &make->all_targets[arch], module_name ); if (make->data_only) - add_install_rule( make, make->module, arch, module_name, - strmake( "d$(dlldir)/%s%s", arch_pe_dirs[arch], make->module )); + add_install_rule( make, module, arch, module_name, + strmake( "d$(dlldir)/%s%s", arch_pe_dirs[arch], module )); else - add_install_rule( make, make->module, arch, module_name, - strmake( "%c%s%s%s", '0' + arch, arch_install_dirs[arch], make->module, + add_install_rule( make, module, arch, module_name, + strmake( "%c%s%s%s", '0' + arch, arch_install_dirs[arch], module, dll_ext[arch] )); output( "%s:", obj_dir_path( make, module_name )); @@ -4217,6 +4222,7 @@ static void load_sources( struct makefile *make ) make->parent_dir = get_expanded_make_variable( make, "PARENTSRC" ); make->module = get_expanded_make_variable( make, "MODULE" ); + make->module_x64 = get_expanded_make_variable( make, "MODULE_x64" ); make->testdll = get_expanded_make_variable( make, "TESTDLL" ); make->staticlib = get_expanded_make_variable( make, "STATICLIB" ); make->importlib = get_expanded_make_variable( make, "IMPORTLIB" ); @@ -4259,6 +4265,7 @@ static void load_sources( struct makefile *make ) if (make->importlib) strarray_add( &make->install[INSTALL_DEV], make->importlib ); if (make->staticlib) strarray_add( &make->install[INSTALL_DEV], make->staticlib ); else strarray_add( &make->install[INSTALL_LIB], make->module ); + if (make->module_x64) strarray_add( &make->install[INSTALL_LIB], make->module_x64 ); } } From 737d94ffbf5fd9405ef88ed9481e7555df71ad14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 20 Sep 2023 09:49:29 +0200 Subject: [PATCH 0012/1506] makedep: Allow unixlibs to have a different 64bit name. CW-Bug-Id: #22729 --- tools/makedep.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index 8c8d5d70dba..b711112d4b0 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -203,6 +203,7 @@ struct makefile const char *staticlib; const char *importlib; const char *unixlib; + const char *unixlib_x64; int use_msvcrt; int data_only; int is_win16; @@ -3469,13 +3470,15 @@ static void output_unix_lib( struct makefile *make ) struct strarray unix_deps = empty_strarray; struct strarray unix_libs = add_unix_libraries( make, &unix_deps ); unsigned int arch = 0; /* unix libs are always native */ + const char *unixlib = make->unixlib; if (make->disabled[arch]) return; + if (make->unixlib_x64 && !strcmp( archs.str[arch], "x86_64" )) unixlib = make->unixlib_x64; - strarray_add( &make->all_targets[arch], make->unixlib ); - add_install_rule( make, make->module, arch, make->unixlib, - strmake( "p%s%s", arch_install_dirs[arch], make->unixlib )); - output( "%s:", obj_dir_path( make, make->unixlib )); + strarray_add( &make->all_targets[arch], unixlib ); + add_install_rule( make, make->module, arch, unixlib, + strmake( "p%s%s", arch_install_dirs[arch], unixlib )); + output( "%s:", obj_dir_path( make, unixlib )); output_filenames_obj_dir( make, make->unixobj_files ); output_filenames( unix_deps ); output( "\n" ); @@ -4227,7 +4230,11 @@ static void load_sources( struct makefile *make ) make->staticlib = get_expanded_make_variable( make, "STATICLIB" ); make->importlib = get_expanded_make_variable( make, "IMPORTLIB" ); make->extlib = get_expanded_make_variable( make, "EXTLIB" ); - if (unix_lib_supported) make->unixlib = get_expanded_make_variable( make, "UNIXLIB" ); + if (unix_lib_supported) + { + make->unixlib = get_expanded_make_variable( make, "UNIXLIB" ); + make->unixlib_x64 = get_expanded_make_variable( make, "UNIXLIB_x64" ); + } make->programs = get_expanded_make_var_array( make, "PROGRAMS" ); make->scripts = get_expanded_make_var_array( make, "SCRIPTS" ); From 6720ff49d235733ebed6dfe9c6ba94538dab5649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 21 Oct 2020 17:19:30 +0200 Subject: [PATCH 0013/1506] makedep: Allow building modules with C++ sources. CW-Bug-Id: #22729 --- tools/makedep.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index b711112d4b0..a6984d4303b 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -208,6 +208,7 @@ struct makefile int data_only; int is_win16; int is_exe; + int has_cxx; int is_external; int disabled[MAX_ARCHS]; @@ -1196,6 +1197,7 @@ static const struct } parse_functions[] = { { ".c", parse_c_file }, + { ".cpp", parse_c_file }, { ".h", parse_c_file }, { ".inl", parse_c_file }, { ".l", parse_c_file }, @@ -2410,9 +2412,11 @@ static const char *cmd_prefix( const char *cmd ) /******************************************************************* * output_winegcc_command */ -static void output_winegcc_command( struct makefile *make, unsigned int arch ) +static void output_winegcc_command( struct makefile *make, unsigned int arch, int is_cxx ) { - output( "\t%s%s -o $@", cmd_prefix( "CCLD" ), tools_path( make, "winegcc" ) ); + const char *tool = tools_path( make, "winegcc" ); + if (is_cxx) strcpy( strrchr( tool, 'w' ), "wineg++" ); + output( "\t%s%s -o $@", cmd_prefix( "CCLD" ), tool ); output_filename( strmake( "--wine-objdir %s", root_obj_dir_path( "." ) ) ); if (tools_dir) { @@ -3123,7 +3127,7 @@ static void output_source_testdll( struct makefile *make, struct incl_file *sour output_filename( tools_path( make, "winebuild" )); output_filename( tools_path( make, "winegcc" )); output( "\n" ); - output_winegcc_command( make, arch ); + output_winegcc_command( make, arch, 0 ); output_filename( "-s" ); output_filenames( dll_flags ); if (arch) output_filenames( get_expanded_arch_var_array( make, "EXTRADLLFLAGS", arch )); @@ -3162,9 +3166,11 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou struct strarray defines, struct strarray *targets, unsigned int arch ) { + const int is_cxx = strendswith( source->name, ".cpp" ); const char *obj_name; if (make->disabled[arch] && !(source->file->flags & FLAG_C_IMPLIB)) return; + make->has_cxx |= is_cxx; if (arch) { @@ -3194,12 +3200,13 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou strarray_add( &make->clean_files, obj_name ); output( "%s: %s\n", obj_dir_path( make, obj_name ), source->filename ); - output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), arch_make_variable( "CC", arch ), source->filename ); + if (is_cxx) output( "\t%s%s -c -o $@ %s", cmd_prefix( "CXX" ), arch_make_variable( "CXX", arch ), source->filename ); + else output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), arch_make_variable( "CC", arch ), source->filename ); output_filenames( defines ); if (source->file->flags & FLAG_C_UNIX) output_filenames( make->unix_cflags ); else output_filenames( make->extra_cflags ); if (!make->use_msvcrt && !make->module) output_filenames( make->unix_cflags ); - output_filenames( make->extlib ? extra_cflags_extlib[arch] : extra_cflags[arch] ); + output_filenames( make->extlib || is_cxx ? extra_cflags_extlib[arch] : extra_cflags[arch] ); if (!arch) { if (source->file->flags & FLAG_C_UNIX) @@ -3220,7 +3227,8 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou } output_filenames( cpp_flags ); - output_filename( arch_make_variable( "CFLAGS", arch )); + if (is_cxx) output_filename( arch_make_variable( "CXXFLAGS", arch )); + else output_filename( arch_make_variable( "CFLAGS", arch )); output( "\n" ); if (make->testdll && strendswith( source->name, ".c" ) && @@ -3329,7 +3337,7 @@ static void output_fake_module( struct makefile *make, const char *spec_file ) output_filename( tools_path( make, "winebuild" )); output_filename( tools_path( make, "winegcc" )); output( "\n" ); - output_winegcc_command( make, arch ); + output_winegcc_command( make, arch, 0 ); output_filename( "-Wb,--fake-module" ); if (!make->is_exe) output_filename( "-shared" ); if (spec_file) output_filename( spec_file ); @@ -3350,7 +3358,7 @@ static void output_module( struct makefile *make, unsigned int arch ) struct strarray imports = make->imports; const char *module_name, *module = make->module; const char *debug_file; - char *spec_file = NULL; + char *tool, *spec_file = NULL; unsigned int i; if (make->disabled[arch]) return; @@ -3410,9 +3418,15 @@ static void output_module( struct makefile *make, unsigned int arch ) output_filenames_obj_dir( make, make->res_files[arch] ); output_filenames( dep_libs ); output_filename( tools_path( make, "winebuild" )); - output_filename( tools_path( make, "winegcc" )); + tool = tools_path( make, "winegcc" ); + output_filename( tool ); + if (make->has_cxx) + { + strcpy( strrchr( tool, 'w' ), "wineg++" ); + output_filename( tool ); + } output( "\n" ); - output_winegcc_command( make, arch ); + output_winegcc_command( make, arch, make->has_cxx ); if (arch) output_filename( "-Wl,--wine-builtin" ); if (!make->is_exe) output_filename( "-shared" ); if (spec_file) output_filename( spec_file ); @@ -3482,7 +3496,8 @@ static void output_unix_lib( struct makefile *make ) output_filenames_obj_dir( make, make->unixobj_files ); output_filenames( unix_deps ); output( "\n" ); - output( "\t%s$(CC) -o $@", cmd_prefix( "CCLD" )); + if (make->has_cxx) output( "\t%s$(CXX) -o $@", cmd_prefix( "CCLD" )); + else output( "\t%s$(CC) -o $@", cmd_prefix( "CCLD" )); output_filenames( get_expanded_make_var_array( make, "UNIXLDFLAGS" )); output_filenames_obj_dir( make, make->unixobj_files ); output_filenames( unix_libs ); @@ -3534,7 +3549,7 @@ static void output_test_module( struct makefile *make, unsigned int arch ) strarray_add( &make->all_targets[arch], testmodule ); strarray_add( &make->clean_files, stripped ); output( "%s:\n", obj_dir_path( make, testmodule )); - output_winegcc_command( make, arch ); + output_winegcc_command( make, arch, 0 ); output_filenames( make->extradllflags ); output_filenames_obj_dir( make, make->object_files[arch] ); output_filenames_obj_dir( make, make->res_files[arch] ); @@ -3544,7 +3559,7 @@ static void output_test_module( struct makefile *make, unsigned int arch ) output_filename( arch_make_variable( "LDFLAGS", arch )); output( "\n" ); output( "%s:\n", obj_dir_path( make, stripped )); - output_winegcc_command( make, arch ); + output_winegcc_command( make, arch, 0 ); output_filename( "-s" ); output_filename( strmake( "-Wb,-F,%s_test.exe", basemodule )); output_filenames( make->extradllflags ); From 6110722aab20949c347158baa6e0fc271bcea077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:03 +0100 Subject: [PATCH 0014/1506] vrclient: winevulkan: Add struct unwrappers for vrclient. --- dlls/winevulkan/vulkan.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 2691624db66..cea8c693cca 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1988,3 +1988,43 @@ NTSTATUS vk_is_available_device_function32(void *arg) struct wine_device *device = wine_device_from_handle(UlongToPtr(params->device)); return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, UlongToPtr(params->name)); } + +DECLSPEC_EXPORT VkDevice __wine_get_native_VkDevice(VkDevice handle) +{ + struct wine_device *device = wine_device_from_handle(handle); + + return device->host_device; +} + +DECLSPEC_EXPORT VkInstance __wine_get_native_VkInstance(VkInstance handle) +{ + struct wine_instance *instance = wine_instance_from_handle(handle);; + + return instance->host_instance; +} + +DECLSPEC_EXPORT VkPhysicalDevice __wine_get_native_VkPhysicalDevice(VkPhysicalDevice handle) +{ + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); + + return phys_dev->host_physical_device; +} + +DECLSPEC_EXPORT VkQueue __wine_get_native_VkQueue(VkQueue handle) +{ + struct wine_queue *queue = wine_queue_from_handle(handle); + + return queue->host_queue; +} + +DECLSPEC_EXPORT VkPhysicalDevice __wine_get_wrapped_VkPhysicalDevice(VkInstance handle, VkPhysicalDevice native_phys_dev) +{ + struct wine_instance *instance = wine_instance_from_handle(handle); + uint32_t i; + for(i = 0; i < instance->phys_dev_count; ++i){ + if(instance->phys_devs[i]->host_physical_device == native_phys_dev) + return instance->phys_devs[i]->handle; + } + WARN("Unknown native physical device: %p\n", native_phys_dev); + return NULL; +} From ef9ab6f82260b1db605bafe90bb861b5b5054094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:07 +0100 Subject: [PATCH 0015/1506] vrclient: Revert "winevulkan: Check if instance extensions are supported." This reverts commit e84999bd7ab859746e893ed2d49b1d42b0323c3a. Vulkan VR games will try to load some extensions that winevulkan doesn't support. --- dlls/winevulkan/vulkan.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index cea8c693cca..89d669d591d 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -540,11 +540,6 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context * { const char *extension_name = dst->ppEnabledExtensionNames[i]; TRACE("Extension %u: %s.\n", i, debugstr_a(extension_name)); - if (!wine_vk_instance_extension_supported(extension_name)) - { - WARN("Extension %s is not supported.\n", debugstr_a(extension_name)); - return VK_ERROR_EXTENSION_NOT_PRESENT; - } if (!strcmp(extension_name, "VK_EXT_debug_utils") || !strcmp(extension_name, "VK_EXT_debug_report")) { object->enable_wrapper_list = VK_TRUE; From 33729d3e03f20aa4dee33ed9796020c4d549996d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:10 +0100 Subject: [PATCH 0016/1506] vrclient: Revert "winevulkan: Check if device extensions are supported." This reverts commit 4907ffdf2a15ab3a1e3749def37f4be67b758a35. Vulkan VR games will try to load some extensions that winevulkan doesn't support. --- dlls/winevulkan/vulkan.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 89d669d591d..4902db630da 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -408,11 +408,6 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de { const char *extension_name = dst->ppEnabledExtensionNames[i]; TRACE("Extension %u: %s.\n", i, debugstr_a(extension_name)); - if (!wine_vk_device_extension_supported(extension_name)) - { - WARN("Extension %s is not supported.\n", debugstr_a(extension_name)); - return VK_ERROR_EXTENSION_NOT_PRESENT; - } } if (phys_dev->external_memory_align) From 9247ecd5cb724c69bab3b67ba3c0236273b009c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:11 +0100 Subject: [PATCH 0017/1506] vrclient: wine.inf: Add OpenXR registry entries. --- loader/wine.inf.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 40549bb34aa..2cfcd0cdb0f 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -95,7 +95,8 @@ AddReg=\ Tapi,\ ThemeManager,\ VersionInfo,\ - LicenseInformation + LicenseInformation,\ + ProtonOverrides [DefaultInstall.ntamd64] RegisterDlls=RegisterDllsSection @@ -120,7 +121,8 @@ AddReg=\ Tapi,\ ThemeManager,\ VersionInfo,\ - LicenseInformation + LicenseInformation,\ + ProtonOverrides [DefaultInstall.ntarm64] RegisterDlls=RegisterDllsSection @@ -160,7 +162,8 @@ AddReg=\ Misc,\ Tapi,\ VersionInfo,\ - LicenseInformation + LicenseInformation,\ + ProtonOverrides [Wow64Install.ntarm] RegisterDlls=RegisterDllsSection @@ -2702,3 +2705,6 @@ EtcFiles = 12,etc InfFiles = 17 NlsFiles = 11 SortFiles = 10,globalization\sorting + +[ProtonOverrides] +HKLM,Software\Khronos\OpenXR\1,"ActiveRuntime",,"C:\openxr\wineopenxr64.json" From 8f03de02a9d9f1d861a12fcea63bd2ee84a277f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:14 +0100 Subject: [PATCH 0018/1506] vrclient: vulkan-1: Prefer builtin. Games that ship their own vulkan-1 will be broken with your VR wrappers. --- dlls/vulkan-1/Makefile.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/dlls/vulkan-1/Makefile.in b/dlls/vulkan-1/Makefile.in index 185d03d32aa..5b1b6eea612 100644 --- a/dlls/vulkan-1/Makefile.in +++ b/dlls/vulkan-1/Makefile.in @@ -2,8 +2,6 @@ MODULE = vulkan-1.dll IMPORTS = user32 IMPORTLIB = vulkan-1 -EXTRADLLFLAGS = -Wb,--prefer-native - SOURCES = \ version.rc \ vulkan.c From bf51ad9947481b857cc91ea353354a1d5abbaf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:16 +0100 Subject: [PATCH 0019/1506] vrclient: winevulkan: Retrieve XR extensions from the environment. --- dlls/winevulkan/vulkan.c | 100 +++++++++++++++++++++++++++++++++++---- 1 file changed, 91 insertions(+), 9 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 4902db630da..7b550857898 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -392,10 +392,68 @@ static void wine_vk_device_get_queues(struct wine_device *device, } } +static char **parse_xr_extensions(unsigned int *len) +{ + char *xr_str, *iter, *start, **list; + unsigned int extension_count = 0, o = 0; + + xr_str = getenv("__WINE_OPENXR_VK_DEVICE_EXTENSIONS"); + if (!xr_str) + { + *len = 0; + return NULL; + } + xr_str = strdup(xr_str); + + TRACE("got var: %s\n", xr_str); + + iter = xr_str; + while(*iter){ + if(*iter++ == ' ') + extension_count++; + } + /* count the one ending in NUL */ + if(iter != xr_str) + extension_count++; + if(!extension_count){ + *len = 0; + return NULL; + } + + TRACE("counted %u extensions\n", extension_count); + + list = malloc(extension_count * sizeof(char *)); + + start = iter = xr_str; + do{ + if(*iter == ' '){ + *iter = 0; + list[o++] = strdup(start); + TRACE("added %s to list\n", list[o-1]); + iter++; + start = iter; + }else if(*iter == 0){ + list[o++] = strdup(start); + TRACE("added %s to list\n", list[o-1]); + break; + }else{ + iter++; + } + }while(1); + + free(xr_str); + + *len = extension_count; + + return list; +} + static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_dev, struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst) { - unsigned int i; + static const char *wine_xr_extension_name = "VK_WINE_openxr_device_extensions"; + unsigned int i, append_xr = 0; + char **xr_extensions_list; *dst = *src; @@ -408,18 +466,42 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de { const char *extension_name = dst->ppEnabledExtensionNames[i]; TRACE("Extension %u: %s.\n", i, debugstr_a(extension_name)); + + if (!strcmp(extension_name, wine_xr_extension_name)) + append_xr = 1; } - if (phys_dev->external_memory_align) + if (append_xr) + xr_extensions_list = parse_xr_extensions(&append_xr); + + if (phys_dev->external_memory_align || append_xr) { const char **new_extensions; - - new_extensions = conversion_context_alloc(ctx, (dst->enabledExtensionCount + 2) * - sizeof(*dst->ppEnabledExtensionNames)); - memcpy(new_extensions, src->ppEnabledExtensionNames, - dst->enabledExtensionCount * sizeof(*dst->ppEnabledExtensionNames)); - new_extensions[dst->enabledExtensionCount++] = "VK_KHR_external_memory"; - new_extensions[dst->enabledExtensionCount++] = "VK_EXT_external_memory_host"; + unsigned int o = 0, count; + + count = dst->enabledExtensionCount; + if (phys_dev->external_memory_align) + count += 2; + if (append_xr) + count += append_xr - 1; + new_extensions = conversion_context_alloc(ctx, count * sizeof(*dst->ppEnabledExtensionNames)); + for (i = 0; i < dst->enabledExtensionCount; ++i) + { + if (append_xr && !strcmp(src->ppEnabledExtensionNames[i], wine_xr_extension_name)) + continue; + new_extensions[o++] = src->ppEnabledExtensionNames[i]; + } + if (phys_dev->external_memory_align) + { + new_extensions[o++] = "VK_KHR_external_memory"; + new_extensions[o++] = "VK_EXT_external_memory_host"; + } + for (i = 0; i < append_xr; ++i) + { + TRACE("\t%s\n", xr_extensions_list[i]); + new_extensions[o++] = xr_extensions_list[i]; + } + dst->enabledExtensionCount = count; dst->ppEnabledExtensionNames = new_extensions; } From 07afcab95347d73d445fbe4d69332d2c8f14e1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 21:24:24 +0100 Subject: [PATCH 0020/1506] vrclient: winevulkan: Add custom Vk structures for creating instance and device through OpenXR. --- dlls/winevulkan/make_vulkan | 35 ++++++++++++++++++++++++++++++++++- dlls/winevulkan/vulkan.c | 25 +++++++++++++++++++++++-- dlls/winex11.drv/vulkan.c | 20 +++++++++++++++++++- 3 files changed, 76 insertions(+), 4 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index ecc84b54a51..cfb71f8bec7 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2490,7 +2490,18 @@ class StructConversionFunction(object): body += " default:\n" if self.direction == Direction.INPUT: - body += ident + "FIXME(\"Unhandled sType %u.\\n\", in_header->sType);\n" + body += ident + "if ((in_header->sType >> 16) == 0x7ead)\n" + body += ident + "{\n" + body += ident + " VkBaseOutStructure *out_ext = conversion_context_alloc(ctx, 32);\n"; + body += ident + " memcpy(out_ext, in_header, 32);\n"; + body += ident + " out_ext->pNext = NULL;\n"; + body += ident + " out_header->pNext = (void *)out_ext;\n"; + body += ident + " out_header = (void *)out_ext;\n"; + body += ident + "}\n" + body += ident + "else\n" + body += ident + "{\n" + body += ident + " FIXME(\"Unhandled sType %u.\\n\", in_header->sType);\n" + body += ident + "}\n" body += " break;\n" body += " }\n" body += " }\n" @@ -3202,6 +3213,28 @@ class VkGenerator(object): f.write(" name -= 2;\n\n") f.write(" return get_vulkan_driver_device_proc_addr(vulkan_funcs, name);\n}\n\n") + f.write("typedef VkResult (WINAPI *PFN_native_vkCreateInstance)(const VkInstanceCreateInfo *, const VkAllocationCallbacks *, VkInstance *,\n") + f.write(" void * (*)(VkInstance, const char *), void *);\n"); + f.write("typedef VkResult (WINAPI *PFN_native_vkCreateDevice)(VkPhysicalDevice, const VkDeviceCreateInfo *, const VkAllocationCallbacks *, VkDevice *,\n"); + f.write(" void * (*)(VkInstance, const char *), void *);\n\n"); + f.write("typedef struct VkCreateInfoWineDeviceCallback {\n"); + f.write(" VkStructureType sType;\n"); + f.write(" const void* pNext;\n"); + f.write(" PFN_native_vkCreateDevice native_create_callback;\n"); + f.write(" void* context;\n"); + f.write("} VkCreateInfoWineDeviceCallback;\n"); + + f.write("#define VK_STRUCTURE_TYPE_CREATE_INFO_WINE_DEVICE_CALLBACK 2125312001\n"); + + f.write("typedef struct VkCreateInfoWineInstanceCallback {\n"); + f.write(" VkStructureType sType;\n"); + f.write(" const void* pNext;\n"); + f.write(" PFN_native_vkCreateInstance native_create_callback;\n"); + f.write(" void* context;\n"); + f.write("} VkCreateInfoWineInstanceCallback;\n"); + + f.write("#define VK_STRUCTURE_TYPE_CREATE_INFO_WINE_INSTANCE_CALLBACK 2125312002\n"); + f.write("#endif /* __WINE_VULKAN_DRIVER_H */\n") def generate_vulkan_spec(self, f): diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 7b550857898..3611ac4abd0 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -453,9 +453,12 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de { static const char *wine_xr_extension_name = "VK_WINE_openxr_device_extensions"; unsigned int i, append_xr = 0; + VkBaseOutStructure *header; char **xr_extensions_list; *dst = *src; + if ((header = (VkBaseOutStructure *)dst->pNext) && header->sType == VK_STRUCTURE_TYPE_CREATE_INFO_WINE_DEVICE_CALLBACK) + dst->pNext = header->pNext; /* Should be filtered out by loader as ICDs don't support layers. */ dst->enabledLayerCount = 0; @@ -813,6 +816,10 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre unsigned int i; VkResult res; + PFN_native_vkCreateDevice native_create_device = NULL; + void *native_create_device_context = NULL; + VkCreateInfoWineDeviceCallback *callback; + if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); @@ -832,11 +839,25 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre object->phys_dev = phys_dev; + if ((callback = (VkCreateInfoWineDeviceCallback *)create_info->pNext) + && callback->sType == VK_STRUCTURE_TYPE_CREATE_INFO_WINE_DEVICE_CALLBACK) + { + native_create_device = callback->native_create_callback; + native_create_device_context = callback->context; + } + init_conversion_context(&ctx); res = wine_vk_device_convert_create_info(phys_dev, &ctx, create_info, &create_info_host); if (res == VK_SUCCESS) - res = instance->funcs.p_vkCreateDevice(phys_dev->host_physical_device, &create_info_host, - NULL /* allocator */, &object->host_device); + { + if (native_create_device) + res = native_create_device(phys_dev->host_physical_device, + &create_info_host, NULL /* allocator */, &object->host_device, + vk_funcs->p_vkGetInstanceProcAddr, native_create_device_context); + else + res = instance->funcs.p_vkCreateDevice(phys_dev->host_physical_device, + &create_info_host, NULL /* allocator */, &object->host_device); + } free_conversion_context(&ctx); WINE_VK_ADD_DISPATCHABLE_MAPPING(instance, device_handle, object->host_device, object); if (res != VK_SUCCESS) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 8d1da4d0ddc..b57282ee85f 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -156,6 +156,7 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo { unsigned int i; const char **enabled_extensions = NULL; + VkBaseOutStructure *header; dst->sType = src->sType; dst->flags = src->flags; @@ -166,6 +167,9 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo dst->enabledExtensionCount = 0; dst->ppEnabledExtensionNames = NULL; + if ((header = (VkBaseOutStructure *)dst->pNext) && header->sType == VK_STRUCTURE_TYPE_CREATE_INFO_WINE_INSTANCE_CALLBACK) + dst->pNext = header->pNext; + if (src->enabledExtensionCount > 0) { enabled_extensions = calloc(src->enabledExtensionCount, sizeof(*src->ppEnabledExtensionNames)); @@ -256,6 +260,9 @@ void vulkan_thread_detach(void) static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkInstance *instance) { + PFN_native_vkCreateInstance native_create_instance = NULL; + void *native_create_instance_context = NULL; + VkCreateInfoWineInstanceCallback *callback; VkInstanceCreateInfo create_info_host; VkResult res; TRACE("create_info %p, allocator %p, instance %p\n", create_info, allocator, instance); @@ -263,6 +270,13 @@ static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *create_info, if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); + if ((callback = (VkCreateInfoWineInstanceCallback *)create_info->pNext) + && callback->sType == VK_STRUCTURE_TYPE_CREATE_INFO_WINE_INSTANCE_CALLBACK) + { + native_create_instance = callback->native_create_callback; + native_create_instance_context = callback->context; + } + /* Perform a second pass on converting VkInstanceCreateInfo. Winevulkan * performed a first pass in which it handles everything except for WSI * functionality such as VK_KHR_win32_surface. Handle this now. @@ -274,7 +288,11 @@ static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *create_info, return res; } - res = pvkCreateInstance(&create_info_host, NULL /* allocator */, instance); + if (native_create_instance) + res = native_create_instance(&create_info_host, NULL /* allocator */, instance, + pvkGetInstanceProcAddr, native_create_instance_context); + else + res = pvkCreateInstance(&create_info_host, NULL /* allocator */, instance); free((void *)create_info_host.ppEnabledExtensionNames); return res; From d97b19b0e7cf97720db066d75da6451cec6c69c2 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 27 Apr 2017 13:25:04 -0500 Subject: [PATCH 0021/1506] HACK: steam: kernelbase: Substitute the current pid for the Steam client pid. --- dlls/kernelbase/process.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 1aeb8f55257..6af6cd4a6e3 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -1108,6 +1108,21 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenProcess( DWORD access, BOOL inherit, DWORD i attr.SecurityDescriptor = NULL; attr.SecurityQualityOfService = NULL; + /* PROTON HACK: + * On Windows, the Steam client puts its process ID into the registry + * at: + * + * [HKCU\Software\Valve\Steam\ActiveProcess] + * PID=dword:00000008 + * + * Games get that pid from the registry and then query it with + * OpenProcess to ensure Steam is running. Since we aren't running the + * Windows Steam in Wine, instead we hack this magic number into the + * registry and then substitute the game's process itself in its place + * so it can query a valid process. + */ + if (id == 0xfffe) id = GetCurrentProcessId(); + cid.UniqueProcess = ULongToHandle(id); cid.UniqueThread = 0; From d140e7e735da481114436d7e74de8897fdf0a9f8 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 13 Jun 2017 12:35:56 -0500 Subject: [PATCH 0022/1506] HACK: steam: ntdll: Append C:/Program Files (x86)/Steam to PATH. --- dlls/ntdll/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 59624bc70f8..464d190be87 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -89,7 +89,7 @@ const WCHAR windows_dir[] = L"C:\\windows"; const WCHAR system_dir[] = L"C:\\windows\\system32\\"; /* system search path */ -static const WCHAR system_path[] = L"C:\\windows\\system32;C:\\windows\\system;C:\\windows"; +static const WCHAR system_path[] = L"C:\\windows\\system32;C:\\windows\\system;C:\\windows;C:\\Program Files (x86)\\Steam"; static BOOL is_prefix_bootstrap; /* are we bootstrapping the prefix? */ static BOOL imports_fixup_done = FALSE; /* set once the imports have been fixed up, before attaching them */ From 14bd35c97a5e490d2942aaaee7a55f1309321dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 14 Nov 2023 11:35:53 +0100 Subject: [PATCH 0023/1506] HACK: steam: wine.inf: Add required Steam registry entries. --- loader/wine.inf.in | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 2cfcd0cdb0f..7368a08ac7f 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -96,7 +96,8 @@ AddReg=\ ThemeManager,\ VersionInfo,\ LicenseInformation,\ - ProtonOverrides + ProtonOverrides,\ + SteamClient [DefaultInstall.ntamd64] RegisterDlls=RegisterDllsSection @@ -122,7 +123,8 @@ AddReg=\ ThemeManager,\ VersionInfo,\ LicenseInformation,\ - ProtonOverrides + ProtonOverrides,\ + SteamClient.ntamd64 [DefaultInstall.ntarm64] RegisterDlls=RegisterDllsSection @@ -163,7 +165,8 @@ AddReg=\ Tapi,\ VersionInfo,\ LicenseInformation,\ - ProtonOverrides + ProtonOverrides,\ + SteamClient.ntamd64 [Wow64Install.ntarm] RegisterDlls=RegisterDllsSection @@ -2706,5 +2709,21 @@ InfFiles = 17 NlsFiles = 11 SortFiles = 10,globalization\sorting +[SteamClient] +HKCU,Software\Valve\Steam,"SteamPath",,"%16422%\Steam" +HKCU,Software\Valve\Steam,"SteamExe",,"%16422%\Steam\Steam.exe" +HKCU,Software\Valve\Steam\ActiveProcess,"PID",0x10001,0x0000fffe +HKCU,Software\Valve\Steam\ActiveProcess,"SteamClientDll",,"%16422%\Steam\steamclient.dll" +HKCU,Software\Valve\Steam\ActiveProcess,"SteamPath",,"%16422%\Steam" + +[SteamClient.ntamd64] +HKCU,Software\Valve\Steam,"SteamPath",,"%16422%\Steam" +HKCU,Software\Valve\Steam,"SteamExe",,"%16422%\Steam\Steam.exe" +HKCU,Software\Valve\Steam\ActiveProcess,"PID",0x10001,0x0000fffe +HKCU,Software\Valve\Steam\ActiveProcess,"SteamClientDll",,"%16426%\Steam\steamclient.dll" +HKCU,Software\Valve\Steam\ActiveProcess,"SteamClientDll64",,"%16426%\Steam\steamclient64.dll" +HKCU,Software\Valve\Steam\ActiveProcess,"SteamPath",,"%16426%\Steam" +HKLM,Software\Wow6432Node\Valve\Steam,"InstallPath",,"%16422%\Steam" + [ProtonOverrides] HKLM,Software\Khronos\OpenXR\1,"ActiveRuntime",,"C:\openxr\wineopenxr64.json" From 044787806f5de7888c63409e588e2b64a554fadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 11:02:52 +0100 Subject: [PATCH 0024/1506] HACK: steam: ntdll: Setup steamclient trampolines to lsteamclient. This uses exec page faults to jump from native steamclient into our lsteamclient entry points. --- dlls/ntdll/loader.c | 23 +++++++++++ dlls/ntdll/unix/loader.c | 70 +++++++++++++++++++++++++++++++++ dlls/ntdll/unix/signal_i386.c | 7 ++++ dlls/ntdll/unix/signal_x86_64.c | 7 ++++ dlls/ntdll/unix/unix_private.h | 1 + dlls/ntdll/unixlib.h | 7 ++++ 6 files changed, 115 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 464d190be87..1e60825b525 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2184,12 +2184,16 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name, DWORD flags, BOOL system, WINE_MODREF **pwm ) { static const char builtin_signature[] = "Wine builtin DLL"; + static HMODULE lsteamclient = NULL; char *signature = (char *)((IMAGE_DOS_HEADER *)*module + 1); + UNICODE_STRING lsteamclient_us; BOOL is_builtin; IMAGE_NT_HEADERS *nt; WINE_MODREF *wm; NTSTATUS status; SIZE_T map_size; + WCHAR *basename, *tmp; + ULONG basename_len; if (!(nt = RtlImageNtHeader( *module ))) return STATUS_INVALID_IMAGE_FORMAT; @@ -2210,6 +2214,25 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name, update_load_config( *module ); + basename = nt_name->Buffer; + if ((tmp = wcsrchr(basename, '\\'))) basename = tmp + 1; + if ((tmp = wcsrchr(basename, '/'))) basename = tmp + 1; + basename_len = wcslen(basename); + if (basename_len >= 4 && !wcscmp(basename + basename_len - 4, L".dll")) basename_len -= 4; + + if ((!RtlCompareUnicodeStrings(basename, basename_len, L"steamclient", 11, TRUE) || + !RtlCompareUnicodeStrings(basename, basename_len, L"steamclient64", 13, TRUE) || + !RtlCompareUnicodeStrings(basename, basename_len, L"gameoverlayrenderer", 19, TRUE) || + !RtlCompareUnicodeStrings(basename, basename_len, L"gameoverlayrenderer64", 21, TRUE)) && + RtlCreateUnicodeStringFromAsciiz(&lsteamclient_us, "lsteamclient.dll") && + (lsteamclient || LdrLoadDll(load_path, 0, &lsteamclient_us, &lsteamclient) == STATUS_SUCCESS)) + { + struct steamclient_setup_trampolines_params params = {.src_mod = *module, .tgt_mod = lsteamclient}; + WINE_UNIX_CALL( unix_steamclient_setup_trampolines, ¶ms ); + wm->ldr.Flags |= LDR_DONT_RESOLVE_REFS; + flags |= DONT_RESOLVE_DLL_REFERENCES; + } + /* fixup imports */ if (!(flags & DONT_RESOLVE_DLL_REFERENCES) && diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 803d8079213..028846f346a 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -972,6 +972,75 @@ static NTSTATUS load_so_dll( void *args ) return status; } +static void *steamclient_srcs[128]; +static void *steamclient_tgts[128]; +static int steamclient_count; + +void *steamclient_handle_fault( LPCVOID addr, DWORD err ) +{ + int i; + + if (!(err & EXCEPTION_EXECUTE_FAULT)) return NULL; + + for (i = 0; i < steamclient_count; ++i) + { + if (addr == steamclient_srcs[i]) + return steamclient_tgts[i]; + } + + return NULL; +} + +static NTSTATUS steamclient_setup_trampolines( void *args ) +{ + struct steamclient_setup_trampolines_params *params = args; + HMODULE src_mod = params->src_mod, tgt_mod = params->tgt_mod; + SYSTEM_BASIC_INFORMATION info; + IMAGE_NT_HEADERS *src_nt = (IMAGE_NT_HEADERS *)((UINT_PTR)src_mod + ((IMAGE_DOS_HEADER *)src_mod)->e_lfanew); + IMAGE_NT_HEADERS *tgt_nt = (IMAGE_NT_HEADERS *)((UINT_PTR)tgt_mod + ((IMAGE_DOS_HEADER *)tgt_mod)->e_lfanew); + IMAGE_SECTION_HEADER *src_sec = (IMAGE_SECTION_HEADER *)(src_nt + 1); + const IMAGE_EXPORT_DIRECTORY *src_exp, *tgt_exp; + const DWORD *names; + SIZE_T size; + void *addr, *src_addr, *tgt_addr; + char *name; + UINT_PTR page_mask; + int i; + + virtual_get_system_info( &info, !!NtCurrentTeb()->WowTebOffset ); + page_mask = info.PageSize - 1; + + for (i = 0; i < src_nt->FileHeader.NumberOfSections; ++i) + { + if (memcmp(src_sec[i].Name, ".text", 5)) continue; + addr = (void *)(((UINT_PTR)src_mod + src_sec[i].VirtualAddress) & ~page_mask); + size = (src_sec[i].Misc.VirtualSize + page_mask) & ~page_mask; + mprotect(addr, size, PROT_READ); + } + + src_exp = get_module_data_dir( src_mod, IMAGE_FILE_EXPORT_DIRECTORY, NULL ); + tgt_exp = get_module_data_dir( tgt_mod, IMAGE_FILE_EXPORT_DIRECTORY, NULL ); + names = (const DWORD *)((UINT_PTR)src_mod + src_exp->AddressOfNames); + for (i = 0; i < src_exp->NumberOfNames; ++i) + { + if (!names[i] || !(name = (char *)((UINT_PTR)src_mod + names[i]))) continue; + if (!(src_addr = (void *)find_named_export(src_mod, src_exp, name))) continue; + if (!(tgt_addr = (void *)find_named_export(tgt_mod, tgt_exp, name))) continue; + assert(steamclient_count < ARRAY_SIZE(steamclient_srcs)); + steamclient_srcs[steamclient_count] = src_addr; + steamclient_tgts[steamclient_count] = tgt_addr; + steamclient_count++; + } + + src_addr = (void *)((UINT_PTR)src_mod + src_nt->OptionalHeader.AddressOfEntryPoint); + tgt_addr = (void *)((UINT_PTR)tgt_mod + tgt_nt->OptionalHeader.AddressOfEntryPoint); + assert(steamclient_count < ARRAY_SIZE(steamclient_srcs)); + steamclient_srcs[steamclient_count] = src_addr; + steamclient_tgts[steamclient_count] = tgt_addr; + steamclient_count++; + + return STATUS_SUCCESS; +} static const unixlib_entry_t unix_call_funcs[] = { @@ -983,6 +1052,7 @@ static const unixlib_entry_t unix_call_funcs[] = unixcall_wine_server_handle_to_fd, unixcall_wine_spawnvp, system_time_precise, + steamclient_setup_trampolines, }; diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 751b0081534..d1b2fb66563 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1906,6 +1906,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) struct xcontext xcontext; ucontext_t *ucontext = sigcontext; void *stack = setup_exception_record( sigcontext, &rec, &xcontext ); + void *steamclient_addr = NULL; switch (TRAP_sig(ucontext)) { @@ -1940,6 +1941,12 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) } break; case TRAP_x86_PAGEFLT: /* Page fault */ + if ((steamclient_addr = steamclient_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09 ))) + { + EIP_sig(ucontext) = (intptr_t)steamclient_addr; + return; + } + rec.NumberParameters = 2; rec.ExceptionInformation[0] = (ERROR_sig(ucontext) >> 1) & 0x09; rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index ab544908883..ae100e05e63 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1929,6 +1929,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) EXCEPTION_RECORD rec = { 0 }; struct xcontext context; ucontext_t *ucontext = init_handler( sigcontext ); + void *steamclient_addr = NULL; rec.ExceptionAddress = (void *)RIP_sig(ucontext); save_context( &context, ucontext ); @@ -1960,6 +1961,12 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) } break; case TRAP_x86_PAGEFLT: /* Page fault */ + if ((steamclient_addr = steamclient_handle_fault( siginfo->si_addr, (ERROR_sig(ucontext) >> 1) & 0x09 ))) + { + RIP_sig(ucontext) = (intptr_t)steamclient_addr; + return; + } + rec.NumberParameters = 2; rec.ExceptionInformation[0] = (ERROR_sig(ucontext) >> 1) & 0x09; rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 07f2724eac7..c2292765ffb 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -226,6 +226,7 @@ extern unsigned int alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, stru data_size_t *ret_len ); extern NTSTATUS system_time_precise( void *args ); +extern void *steamclient_handle_fault( LPCVOID addr, DWORD err ); extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ); extern void *anon_mmap_alloc( size_t size, int prot ); extern void virtual_init(void); diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 9cb444342fe..475e532b8cf 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -66,6 +66,12 @@ struct unwind_builtin_dll_params CONTEXT *context; }; +struct steamclient_setup_trampolines_params +{ + HMODULE src_mod; + HMODULE tgt_mod; +}; + enum ntdll_unix_funcs { unix_load_so_dll, @@ -76,6 +82,7 @@ enum ntdll_unix_funcs unix_wine_server_handle_to_fd, unix_wine_spawnvp, unix_system_time_precise, + unix_steamclient_setup_trampolines, }; extern unixlib_handle_t __wine_unixlib_handle; From 787b1f95b06391ba0bdc22cd431568413bc3f4bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 5 Aug 2020 10:35:50 +0200 Subject: [PATCH 0025/1506] HACK: steam: ntdll: Patch entry points with jumps. As a preferred alternative to noexec pages which makes debugging painful. The noexec can be enabled with WINESTEAMNOEXEC=1 environmnent variable. --- dlls/ntdll/unix/loader.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 028846f346a..49876d2d054 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -991,8 +991,22 @@ void *steamclient_handle_fault( LPCVOID addr, DWORD err ) return NULL; } +static void steamclient_write_jump(void *src_addr, void *tgt_addr) +{ +#ifdef _WIN64 + static const char mov[] = {0x48, 0xb8}; +#else + static const char mov[] = {0xb8}; +#endif + static const char jmp[] = {0xff, 0xe0}; + memcpy(src_addr, mov, sizeof(mov)); + memcpy((char *)src_addr + sizeof(mov), &tgt_addr, sizeof(tgt_addr)); + memcpy((char *)src_addr + sizeof(mov) + sizeof(tgt_addr), jmp, sizeof(jmp)); +} + static NTSTATUS steamclient_setup_trampolines( void *args ) { + static int noexec_cached = -1; struct steamclient_setup_trampolines_params *params = args; HMODULE src_mod = params->src_mod, tgt_mod = params->tgt_mod; SYSTEM_BASIC_INFORMATION info; @@ -1003,10 +1017,13 @@ static NTSTATUS steamclient_setup_trampolines( void *args ) const DWORD *names; SIZE_T size; void *addr, *src_addr, *tgt_addr; - char *name; + char *name, *wsne; UINT_PTR page_mask; int i; + if (noexec_cached == -1) + noexec_cached = (wsne = getenv("WINESTEAMNOEXEC")) && atoi(wsne); + virtual_get_system_info( &info, !!NtCurrentTeb()->WowTebOffset ); page_mask = info.PageSize - 1; @@ -1015,7 +1032,8 @@ static NTSTATUS steamclient_setup_trampolines( void *args ) if (memcmp(src_sec[i].Name, ".text", 5)) continue; addr = (void *)(((UINT_PTR)src_mod + src_sec[i].VirtualAddress) & ~page_mask); size = (src_sec[i].Misc.VirtualSize + page_mask) & ~page_mask; - mprotect(addr, size, PROT_READ); + if (noexec_cached) mprotect(addr, size, PROT_READ); + else mprotect(addr, size, PROT_READ|PROT_WRITE|PROT_EXEC); } src_exp = get_module_data_dir( src_mod, IMAGE_FILE_EXPORT_DIRECTORY, NULL ); @@ -1029,7 +1047,8 @@ static NTSTATUS steamclient_setup_trampolines( void *args ) assert(steamclient_count < ARRAY_SIZE(steamclient_srcs)); steamclient_srcs[steamclient_count] = src_addr; steamclient_tgts[steamclient_count] = tgt_addr; - steamclient_count++; + if (!noexec_cached) steamclient_write_jump(src_addr, tgt_addr); + else steamclient_count++; } src_addr = (void *)((UINT_PTR)src_mod + src_nt->OptionalHeader.AddressOfEntryPoint); @@ -1037,7 +1056,8 @@ static NTSTATUS steamclient_setup_trampolines( void *args ) assert(steamclient_count < ARRAY_SIZE(steamclient_srcs)); steamclient_srcs[steamclient_count] = src_addr; steamclient_tgts[steamclient_count] = tgt_addr; - steamclient_count++; + if (!noexec_cached) steamclient_write_jump(src_addr, tgt_addr); + else steamclient_count++; return STATUS_SUCCESS; } From 8ffaa3972e0ed0b74dba2aa0b460c55e01788369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 14 Dec 2023 14:54:42 +0100 Subject: [PATCH 0026/1506] HACK: proton: server: Avoid relocating steamclient DLLs. CW-Bug-Id: #23139 --- server/mapping.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/mapping.c b/server/mapping.c index f754078acf7..a2c93cb6c1b 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -697,6 +697,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s { static const char builtin_signature[] = "Wine builtin DLL"; static const char fakedll_signature[] = "Wine placeholder DLL"; + static const char valve_signature[] = {'V','L','V',0,1,0,0,0}; IMAGE_COR20_HEADER clr; IMAGE_SECTION_HEADER sec[96]; @@ -786,7 +787,8 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s if (nt.opt.hdr32.SectionAlignment & page_mask) mapping->image.image_flags |= IMAGE_FLAGS_ImageMappedFlat; else if ((nt.opt.hdr32.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) && - (has_relocs || mapping->image.contains_code) && !(clr_va && clr_size)) + (has_relocs || mapping->image.contains_code) && !(clr_va && clr_size) && + memcmp( mz.buffer, valve_signature, sizeof(valve_signature) )) mapping->image.image_flags |= IMAGE_FLAGS_ImageDynamicallyRelocated; break; @@ -834,7 +836,8 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s if (nt.opt.hdr64.SectionAlignment & page_mask) mapping->image.image_flags |= IMAGE_FLAGS_ImageMappedFlat; else if ((nt.opt.hdr64.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) && - (has_relocs || mapping->image.contains_code) && !(clr_va && clr_size)) + (has_relocs || mapping->image.contains_code) && !(clr_va && clr_size) && + memcmp( mz.buffer, valve_signature, sizeof(valve_signature) )) mapping->image.image_flags |= IMAGE_FLAGS_ImageDynamicallyRelocated; break; From 3fc1fd704419535454ce340719a5bcf03c05e1db Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 18 May 2020 14:20:30 -0500 Subject: [PATCH 0027/1506] HACK: steam: wine.inf: Associate the steam protocol with steam.exe. For 2K Launcher. CW-Bug-Id: 18912 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 7368a08ac7f..3b94886c548 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -338,6 +338,7 @@ HKCR,ftp\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1""" HKCR,http\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1""" HKCR,https\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1""" HKCR,mailto\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1""" +HKCR,steam\shell\open\command,,,"""%16426%\Steam\Steam.exe"" -- ""%1""" [ContentIndex] HKLM,System\CurrentControlSet\Control\ContentIndex\Language\Neutral,"WBreakerClass",,"{369647e0-17b0-11ce-9950-00aa004bbb1f}" From 9c10f855a34c78de230546d54d5c1b6eeecd53a9 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 19 Jan 2018 14:01:07 -0600 Subject: [PATCH 0028/1506] HACK: proton: advapi32: Use steamuser as Wine username. --- dlls/advapi32/advapi.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c index 2284e92b263..127cec57252 100644 --- a/dlls/advapi32/advapi.c +++ b/dlls/advapi32/advapi.c @@ -44,14 +44,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi); */ BOOL WINAPI GetUserNameA( LPSTR name, LPDWORD size ) { - DWORD len = GetEnvironmentVariableA( "WINEUSERNAME", name, *size ); - BOOL ret; - - if (!len) return FALSE; - if ((ret = (len < *size))) len++; - else SetLastError( ERROR_INSUFFICIENT_BUFFER ); - *size = len; - return ret; + static const char steamuserA[] = {'s','t','e','a','m','u','s','e','r',0}; + if(*size < ARRAY_SIZE(steamuserA)){ + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + *size = ARRAY_SIZE(steamuserA); + return FALSE; + } + memcpy(name, steamuserA, sizeof(steamuserA)); + *size = ARRAY_SIZE(steamuserA); + return TRUE; } /****************************************************************************** @@ -59,14 +60,15 @@ BOOL WINAPI GetUserNameA( LPSTR name, LPDWORD size ) */ BOOL WINAPI GetUserNameW( LPWSTR name, LPDWORD size ) { - DWORD len = GetEnvironmentVariableW( L"WINEUSERNAME", name, *size ); - BOOL ret; - - if (!len) return FALSE; - if ((ret = (len < *size))) len++; - else SetLastError( ERROR_INSUFFICIENT_BUFFER ); - *size = len; - return ret; + static const WCHAR steamuserW[] = {'s','t','e','a','m','u','s','e','r',0}; + if(*size < ARRAY_SIZE(steamuserW)){ + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + *size = ARRAY_SIZE(steamuserW); + return FALSE; + } + memcpy(name, steamuserW, sizeof(steamuserW)); + *size = ARRAY_SIZE(steamuserW); + return TRUE; } /****************************************************************************** From c67fe722d30360353697d4fcdbc7b8edce74a10e Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 30 Sep 2021 19:44:00 +0200 Subject: [PATCH 0029/1506] HACK: proton: shell32: Never create links to the user's home dirs. --- dlls/shell32/shellpath.c | 178 --------------------------------------- 1 file changed, 178 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 015d7cdd4e2..fc62f760e05 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -2639,180 +2639,6 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) return hr; } -static char *xdg_config; -static DWORD xdg_config_len; - -static BOOL WINAPI init_xdg_dirs( INIT_ONCE *once, void *param, void **context ) -{ - const WCHAR *var, *fmt = L"\\??\\unix%s/user-dirs.dirs"; - char *p; - WCHAR *name, *ptr; - HANDLE file; - DWORD len; - - if (!(var = _wgetenv( L"XDG_CONFIG_HOME" )) || var[0] != '/') - { - if (!(var = _wgetenv( L"WINEHOMEDIR" ))) return TRUE; - fmt = L"%s/.config/user-dirs.dirs"; - } - len = lstrlenW(var) + lstrlenW(fmt); - name = malloc( len * sizeof(WCHAR) ); - swprintf( name, len, fmt, var ); - name[1] = '\\'; /* change \??\ to \\?\ */ - for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\\'; - - file = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); - free( name ); - if (file != INVALID_HANDLE_VALUE) - { - len = GetFileSize( file, NULL ); - if (!(xdg_config = malloc( len + 1 ))) return TRUE; - if (!ReadFile( file, xdg_config, len, &xdg_config_len, NULL )) - { - free( xdg_config ); - xdg_config = NULL; - } - else - { - for (p = xdg_config; p < xdg_config + xdg_config_len; p++) if (*p == '\n') *p = 0; - *p = 0; /* append null to simplify string parsing */ - } - CloseHandle( file ); - } - return TRUE; -} - -static char *get_xdg_path( const char *var ) -{ - static INIT_ONCE once; - char *p, *ret = NULL; - int i; - - InitOnceExecuteOnce( &once, init_xdg_dirs, NULL, NULL ); - if (!xdg_config) return NULL; - - for (p = xdg_config; p < xdg_config + xdg_config_len; p += strlen(p) + 1) - { - while (*p == ' ' || *p == '\t') p++; - if (strncmp( p, var, strlen(var) )) continue; - p += strlen(var); - while (*p == ' ' || *p == '\t') p++; - if (*p != '=') continue; - p++; - while (*p == ' ' || *p == '\t') p++; - if (*p != '"') continue; - p++; - if (*p != '/' && strncmp( p, "$HOME/", 6 )) continue; - - if (!(ret = malloc( strlen(p) + 1 ))) break; - for (i = 0; *p && *p != '"'; i++, p++) - { - if (*p == '\\' && p[1]) p++; - ret[i] = *p; - } - ret[i] = 0; - if (*p != '"') - { - free( ret ); - ret = NULL; - } - break; - } - return ret; -} - -static BOOL link_folder( HANDLE mgr, const UNICODE_STRING *path, const char *link ) -{ - struct mountmgr_shell_folder *ioctl; - DWORD len = sizeof(*ioctl) + path->Length + strlen(link) + 1; - BOOL ret; - - if (!(ioctl = malloc( len ))) return FALSE; - ioctl->create_backup = FALSE; - ioctl->folder_offset = sizeof(*ioctl); - ioctl->folder_size = path->Length; - memcpy( (char *)ioctl + ioctl->folder_offset, path->Buffer, ioctl->folder_size ); - ioctl->symlink_offset = ioctl->folder_offset + ioctl->folder_size; - strcpy( (char *)ioctl + ioctl->symlink_offset, link ); - - ret = DeviceIoControl( mgr, IOCTL_MOUNTMGR_DEFINE_SHELL_FOLDER, ioctl, len, NULL, 0, NULL, NULL ); - free( ioctl ); - return ret; -} - -/****************************************************************************** - * create_link - * - * Sets up a symbolic link for one of the 'My Whatever' shell folders to point - * into the corresponding XDG directory. - */ -static void create_link( const WCHAR *path, const char *xdg_name, const char *default_name ) -{ - UNICODE_STRING nt_name; - char *target = NULL; - HANDLE mgr; - - if ((mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - 0, 0 )) == INVALID_HANDLE_VALUE) - { - FIXME( "failed to connect to mount manager\n" ); - return; - } - - nt_name.Buffer = NULL; - if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL )) goto done; - - if ((target = get_xdg_path( xdg_name ))) - { - if (link_folder( mgr, &nt_name, target )) goto done; - } - link_folder( mgr, &nt_name, default_name ); - -done: - RtlFreeUnicodeString( &nt_name ); - free( target ); - CloseHandle( mgr ); -} - -/****************************************************************************** - * _SHCreateSymbolicLink [Internal] - * - * Sets up a symbolic link for one of the special shell folders to point into - * the users home directory. - * - * PARAMS - * nFolder [I] CSIDL identifying the folder. - */ -static void _SHCreateSymbolicLink(int nFolder, const WCHAR *path) -{ - DWORD folder = nFolder & CSIDL_FOLDER_MASK; - - switch (folder) { - case CSIDL_PERSONAL: - create_link( path, "XDG_DOCUMENTS_DIR", "$HOME/Documents" ); - break; - case CSIDL_DESKTOPDIRECTORY: - create_link( path, "XDG_DESKTOP_DIR", "$HOME/Desktop" ); - break; - case CSIDL_MYPICTURES: - create_link( path, "XDG_PICTURES_DIR", "$HOME/Pictures" ); - break; - case CSIDL_MYVIDEO: - create_link( path, "XDG_VIDEOS_DIR", "$HOME/Movies" ); - break; - case CSIDL_MYMUSIC: - create_link( path, "XDG_MUSIC_DIR", "$HOME/Music" ); - break; - case CSIDL_DOWNLOADS: - create_link( path, "XDG_DOWNLOAD_DIR", "$HOME/Downloads" ); - break; - case CSIDL_TEMPLATES: - create_link( path, "XDG_TEMPLATES_DIR", "$HOME/Templates" ); - break; - } -} - /****************************************************************************** * SHGetFolderPathW [SHELL32.@] * @@ -3001,10 +2827,6 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW( goto end; } - /* create symbolic links rather than directories for specific - * user shell folders */ - _SHCreateSymbolicLink(folder, szBuildPath); - /* create directory/directories */ ret = SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL); if (ret && ret != ERROR_ALREADY_EXISTS) From 4e5d2e3aae85eabeee6921e5d889608ae2881ef6 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 22 Jan 2018 14:35:51 -0600 Subject: [PATCH 0030/1506] HACK: proton: wineboot: Don't show "updating prefix" window. --- programs/wineboot/wineboot.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index c16446cf289..2a8f2edb141 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -1425,37 +1425,6 @@ static BOOL start_services_process(void) return TRUE; } -static INT_PTR CALLBACK wait_dlgproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) -{ - switch (msg) - { - case WM_INITDIALOG: - { - DWORD len; - WCHAR *buffer, text[1024]; - const WCHAR *name = (WCHAR *)lp; - HICON icon = LoadImageW( 0, (LPCWSTR)IDI_WINLOGO, IMAGE_ICON, 48, 48, LR_SHARED ); - SendDlgItemMessageW( hwnd, IDC_WAITICON, STM_SETICON, (WPARAM)icon, 0 ); - SendDlgItemMessageW( hwnd, IDC_WAITTEXT, WM_GETTEXT, 1024, (LPARAM)text ); - len = lstrlenW(text) + lstrlenW(name) + 1; - buffer = malloc( len * sizeof(WCHAR) ); - swprintf( buffer, len, text, name ); - SendDlgItemMessageW( hwnd, IDC_WAITTEXT, WM_SETTEXT, 0, (LPARAM)buffer ); - free( buffer ); - } - break; - } - return 0; -} - -static HWND show_wait_window(void) -{ - HWND hwnd = CreateDialogParamW( GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_WAITDLG), 0, - wait_dlgproc, (LPARAM)prettyprint_configdir() ); - ShowWindow( hwnd, SW_SHOWNORMAL ); - return hwnd; -} - static HANDLE start_rundll32( const WCHAR *inf_path, const WCHAR *install, WORD machine ) { WCHAR app[MAX_PATH + ARRAY_SIZE(L"\\rundll32.exe" )]; @@ -1606,7 +1575,6 @@ static void update_wineprefix( BOOL force ) if ((process = start_rundll32( inf_path, L"PreInstall", IMAGE_FILE_MACHINE_TARGET_HOST ))) { - HWND hwnd = show_wait_window(); for (;;) { if (process) @@ -1627,7 +1595,6 @@ static void update_wineprefix( BOOL force ) process = start_rundll32( inf_path, L"Wow64Install", machines[count].Machine ); count++; } - DestroyWindow( hwnd ); } install_root_pnp_devices(); update_user_profile(); From 42f83f0c459be681c7a141251e1b6df8cd07bd05 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 28 Mar 2018 08:52:14 -0500 Subject: [PATCH 0031/1506] HACK: proton: user32: Replace Wine glass with generic window icon. --- dlls/user32/resources/oic_winlogo.ico | Bin 48230 -> 25214 bytes dlls/user32/resources/oic_winlogo.svg | 1296 ++----------------------- 2 files changed, 63 insertions(+), 1233 deletions(-) diff --git a/dlls/user32/resources/oic_winlogo.ico b/dlls/user32/resources/oic_winlogo.ico index ea183d07bf69e7b4cac5298de0e29b90e1e46abb..8cdda91509f8434ce6417d1bd4eb14584173f353 100644 GIT binary patch literal 25214 zcmeHPNsJsx75&vqx%Yi{ce{GEyX|f_%aOxKAb|!XE=XLt%-90v$bbZrTgFVo!HX;} zn$e6A!ys9+9ALl#qk+D`#S)9e*=sMhdtYpK+a0_YSy5e;nbD+ORoPu8zw|3I;{S;M zGcqDG{{Imr5|eVNs}rONIbI@iNhFysljEf#TPUjoLrhBKP)y|Y3Xw#@$aHnaG*{%sb~d)Q45O;YGGj!xS$sG zHB#iwwWgt*ysVR6e|}+JP2Ibv?h&VwsmZ66k%zqQ`iqb`GcyaE*~aO#>s0wHbXxG# zUtV5T4<09p5?2GyzcssA3s*>>+8TZ zwZ6u5U9BZim+LanP)1&N{f*5H_2kKu6h40PSo7%=*XcC!y6bN~eX2fq?Tdksyzcs2 zTU%=4)kGj9ue-i_PH@$~%=~lWWi$S>Nfl<%INnJwf~=eQp25qDfc8?5c8zf_nB#)^ zEO@Shc_ElHf_@h~Q^EWe%y+@K7mOXj^AwDI!I%+ruV8+H2las%LnvPpj7OBu2Q8#vg` zd}DoUYil2{wZ4)0SUg@@x_^IZX*?cdzH{hkWliOwn#!X?oy;c&5A=_Yc8~TS7)&rf z+|t?E*$eD!8D_qzwz;FWs;ai5xweV*Tqa~+D*zaD(0e} z5@_rdAlKU(u*No!>wYrry3=I;Id@lIZ~D)<>)zfdZ+gOvgXhibal|o2FyqR}1|guFA7#&*bji zyLzo<)>l(gQ*!RyIlacZ^2XQo8jEYIrKKe~fBw8|Y;4G_TetMu>M7P%H$Ht|KKbb} zIeq$cYJK(DyFb(Gs2iXDO0InWRlT0#8j9TOD?Ch+gYxEoSK-2?!zXz(?cL2D8 z+WS+>B+o@Z+(qrxeO9OrL~pW!uHRE^g&wwFpIWwgF6v2-RazlNdUI-(=ecMmy|mv7 zrKES1SfPXT@-i!wYkHRzG(FK{g#_!@#;j0FdT+B8dP#5WutFp0MF}euk=~N|rA^PZ zXnLa+G(Fy8g*fZ)-vLOkXzjK@YlWuMB=84^-ev`dUUR?#HJaX7VFmVI!w%D{y&>!O zgIO<(@8UXz&g1U@&3b%1ZJiRNt_?Fzcb4UL6(Peq~@S(Pwubux<%69(i zm7nXF1mh5A&z{w`^YrwzjzQ3V{`a3hl7IZ^sK=3xiXHyipm5OP-@*TuN$Pj_tAavvvWXW3dn_B{s1UUH|C)U!CUPsiC0S=i~5tdD+l_pixk#%&Yib~frdS9|TZ0t&SO z6F~0&9m*53?F5jrD3j1QF){I5#FkZ1)^5LsgVW6LUo)_SmhcJ+`-1pD34*DF0IZu(t zl(O9Nc~*k+A`GM~w|t(v*gg+p&V}SBr7X96_|x@y6^@O3BW3x?=eP(1{p4fco^uWc z&xX$@pGaBm`$ybDQLiwNvfT2qPf@Wv45Tc#e4h1Tc^F7pZuztuZv6gzh5eNIMaUrd z$;X~f6$aYmV~?o{18wqu`NlUC_Oj*`DZ?$FwgAUOSU_1x`$Mn)FI~Fy8;pl7j){

{LmytS97wSaas3Udd{cu-C?Wt3zeu4MSW=QXt ztlwqS_2kKu6Vx5p#5`@(FnmP0kU?Fc^9FSX*0A5%ZWunMT*yfCQ*mB|?x)K39@6xu z`jP%2`8UmTds+J*XR}lxpkM#f#}bB*H5W2=+fSRVKiJRD%CfNhyxGd})1SUu?9nU; z^z$=^>F4J6KO6MZpFYBj|ISJMUyk2@=*5ze|(eQ-!T3B*~Sz6;sh+ip5uZ* zKmF<3&3AkwSMA&46#D;~%>Op+;nXkA!Ll%7EV+>3r$1vSTvrqV`o(#|j5B2$&+^kh z%s5rHu`s_l7t8ovD+Kh@Kg>8?w(&r}I3LUST_^)=KcnX{c$c;6$0Ay$N5}U2x!wE=Y>@vpiO_Al~#p-HvMrvTNMJ@ z^ndreUsdnC{^dQ5)X}X!&bs5XzM;zt;fHH9>TLXn7cN}*3GxLKzozaNFJAny(LYL~ e9(d6naOSJ`ywf-v%;FqXRNv{pNhCX+C;Klcd1NyH literal 48230 zcmeFa2|U)z_c%V!W8bobDA_`kBB@kDddgmiQX!HevLsouJobIdzGPpMJ!B`M2$c$v zC3`Acg)GniJaxOb+wI=_{r-R7`}usnuh)0(J!U&IbI#0}nKNhR{e%z(Q6o`N1U@Co zT!Tc3zvofGvClnkNjn19Bfs&K%qYFki(6i3x z$j|pFa&rkoxrO@1AQndH5qyPB_bi=E$Euf4Rp7n3@IG(Mq#1v(CwUA zL`zkLs3|U@(TOo+a6TDD#l|2HZ%;&y4Mg&n?B{<2AreDWQeKJzLxPZl?I=o2ss{XSgh=gCNm)BuSXxAtHC4#X?IrNnH1 zh(Q9IyAhuNA9_DCg$j#{5WnCEQc|iyhvghlKyV=N)`-rZe}Z<4HK4%27?hfkhU65- zP*6Z3@c0y|AA5)t6+O`W=LJ+zU5T7s@yOG?73gtA$B#cpPoH-nLxX7GJq($d4xov* zZ%|HtE^=_lLA+c6sG;dTs;+&7c=>!$+|3l^?>_=%@1mZ*UX+jwZJ@Kr#55cFFCD^l zX!heA(l_Wr>KeykCf!Br*m}^T$89Ji>;~GtEfn1djY7j?BhYtQ$khBYs;qp7?iLRM zoo>j@(;e!FM=42AchU%YH~k*Dxu&7RxHeR9rw|Ej@&=yr0jCV;J&8yld|JyN)m6Vi zRn>FoLCZsQ{(>P|%lI1gy&ga*>8a>O&=ib!CMvJ0Kg*NL^@!b*_x67!dy%i0O4x@eh z&5(+UH?p=aLAqzNQE*Tps;;YnzIYDx2O@h1n8YX&J@4#AlT+_dUQq!mC@e)y%@2@Y zpg-CwFodcq7Xasfy_5Xa{TEn~53PegZ< z24($C0i}J`nRU@-luy|#Ux>db_B--7_>!Xx&k9?*{k*O=iX|NouY2(~_y|Z&%`7yV z*zP%zbm|uU-=P!PBX-Y$T-}MkW%j$i*xvqKLz($J{@pNU~no$Rr!}-0&!#J!I`4vVTmFyc~YUc!(JaTsKVF z-FNfH{2$_y22V)H)0+l|pozQBuSYgy{ebX8G~=<{#r^wB_#Q$VOtPiP1x`O8{5~rA zQd|3Mk-szv`7s}jfT29*^(KEg3~RNu?No{cnbgxPM>c?_*oFwfj_x zaS3uGp)F(>&TbHJ-&G;F^H7GQB;#M> zw~Q1X*(am(LfFXpUQEo>7*U{tK)k+_MlNFdpZP!H|5^M;{{JriYyW(s z`&&N|z!7=)>I=fC{dP`;!z(!aSMN(0j<>%$XJ=<(IfxU%8P(R-{+joX1&Fhp@p~%1 zw#4{#&N2SbE=HY~_e;(XB{00a{F=lvKc)k|8p5#rn2s1(c-2^-`$oa<{Xab~l@Jr6&A1Y$RLAylv1JBF{)xM_x(7>3;L4|Fo|@~aU$^vAJb;^kH62dDW5e8^B&*W~B< z9sLOKiRgd82l@X}K>c@Yfy_ekmjXXY|5D_q=|Iv?)1j_Eq<@)>nm?u^7MOT|{sUV; z5DT%ukHZd3{`tK7eGmLe?AvFQ>oXV0D? zbMvR@#EHi!Dk=)XJ!o=r5=lwfLfIsgmzRga!;8?FGp)$pz6#QAAq|ai6dhdx_MHIq z>eVZB`m{gt^^Jo(1N7m;2Q)AUcB!;fh?}CjckhCo%>if#MeXgx)4LPGU|djmWCYY3 zjc~YJur1w%wxdyGY&7cX>Oy&7D@8~Fd3Z#kxWoiBH8q7AA2uOI#%E~v?krSPRD>ug z6Hs$=GvJ+v_6E@)Kxvsk9>S?px)kIz)u7lZ3-$aEk(-8kI{`AH&A+d7BVxd zMW9up%&aUF77>o{ZZ0S}xf$Kcxec_$LK~CF!lDaxc6LJDvFQE#_h{d~eUMiIwsLz! zO&yLNK75EIr4FFP)Ksv&g3%jYK%}H6!A={DY;61h-T__)N`?I3@K7{AKMy#z=;qBf z6dD2cZ00EB?B(xp_CkdS~9Qj*c^>?|rNDM9k`T~PiaN&&lSNJt3uGuTQo&(ZMkFv`r#ggjRO zKNJ%a19bHvPd^{@?%g{S7k?9pi4{TK3FP8ZguK0DAzTMG+aMGO5FJgl!CIn6kDj5l zjC539UXJ$et@&anjgIa|pW z1?o1RG76$Z2qU`K!bo8hn;6$Q(_wGU8bO9YNpznzDE(^x%CW?zA zh6};Ynuw;Sr_r4|cYxj|Nc*34nE!?|)VoX;qUmV(^CE`!2gA>7lG$^(Y{ySAI>p?a zJ;$F!Kc}K9|5*)&*CaTl6-_VZJ$3(Sc?`zzp?_@4?iB4m$tG4>uJ*I4e@nC6_*?jA zq3p_^rT&&Cocde%C!w7;bqary{A-e~>t=^vBYzBJ)(Q%$^ZhaXmy}TzCz6sH?xTN# zaBsuDt7FM~t=bO#6rqZmlf!aukn_sewOw0W~cs$K=CYhotH%w zzilM`l05Yv@(ruSRXMm4s-(<=U!>C|{b7gtH~X^!mHwEIp}BB4AY6|0*s%eV)}Lf!A}-i;O;Gu) zah4O4{aLTtO48-P>W?+!x5qnG$^CoI6m9Xj+|2{_C_ zzWA>-U~t6K;BRp_q!ABezgF@RmmHiX0NRd18E_}f$QT3R;4eBHCFLE^d;L)N%Wj0lUP6&EiC=Wteft9;90fX49x5#_ zLq#QbzMLuUH#Ne0hfK(eMxQ=?LgCSIUvze&ju;dcgX-@$!2NtW+&f32V7L#DjZHvJ zO-(2QbVs7joDAoJP|%x+=Z?I>0+a}PC>>q!7ag{$rW$y2fxGJvI4>k1U${TcFDwK- zEEnC*&4KqEaX@1t=vS4XqY-tp|8xJ>1OLH2KrOAnf>r;OKmi_BDHS0N#a|P4uH8X< zg#Fhj1on`9A45oj`S)?Pt-p(J$NcU(mR$4%1rz_T7~*Ujw@Fg{cK3lhO0UGQnPbg2 zgne4;`A%+Gr}-_;C`@`>Rrc_23-j*1o0K_uzhxsNM!D;dyvT3yV>J8eNDlrMM>2wf za$lnhTnJ6mBSiF9oqvO6>91+TyzhaC_YH_RM1A77b@r=1f&Z?h?{|y;H+|xpotB0F z>z0LK`NfJxruwzLZ+rhYpZP1tm|u2WX567K3Czr2cieA23;$Q6B<7c`4fD&6`OW{T zf&5SOlPJ)s2S9vh_r>vj_5SbgPkVs)Sb!+R;sCn*z0)5M^0|81FoJP@7;a8KD&8)F1dKPPdU1}ytZ|8Xfri8i&H&* z+!)G80?9i8sQ+E0)6&vzF)=f};p*u=1v)_=ynTFlr}$1?eM3W2%cGW7u$4Ur+tkbF zFP`^2?dW&~_PAcK1NBA4MvuFCc}x?_Qd3hC$K)?xN&Hj%**Mr|g-1trHa&cp`{>c5 z?83rAFe60=;_-NIOG`^{0|Nsh1lZWvM0tCAr-1#b1Z;e5VEcOyw$%5a4^3RPwaEqg zX#Oc0|Eyj(nqk1+^`W)BJw$H%!^^A*) z%aog&+Z-+!uE6ESwauG1Uk96CHrT#CfPBpp>-w{H{>gL?U#|jqPg)E%KxgPz%gD$` zV=F5w9YsaO6EGi4K(6Lp0FJ4v+n+db!phOn(F^RBNzb1@ZvY$cOwGO8UN;|4qM`EN z;(UC3=sbLVVtoVr-=$_{+-YoT3LPIGcL)2c-~FbhVtXft&t{euOE<#8y1)kiI4CIS zNkC9QhhKnyH`r2VV1CCE>-e`2|6QX%0|$)71(2r{fPR1lu%|EL-Q8C09356bjy_vh zTP>Pen2j2l7#CeMF}5L=`L2rpxS+eQ*C|gQ?^!o5k690IZ>|400{?~}4?k}$FF)TI zcQ4Nw;N|4sp#R5Zd-{4C!@T$eWAM?_&->zk9D#pBke8p2Gu(Bo`1<>;K-lqb(EsDI zz5IRCL&L)ezyks1^IyJd`;Q|Y2=Wf_e-?N1CLt_5oZ#i}L%az4U*q6TkpkxKLV89z z;bwe1!PD1g0dxxT|1Au-`FY{I{e5R)KPChR2NPf~nDOxOIrP7UetRd!atlk#)qsEi zf`^9(0luqPwROA>A3*%)J5OKV1MXg4ixCkw2>}5S1b_cj*S7bp$%PhXe_UP68f326Lf};O!l;6`^ zNQ5f@_5iK`J^;Z0L|$S65@3!O60))$uRvXI{*_|@{iWpY4j+&L?L<&kb|xexRRaC# zgwv;qbgBSo0_Xr30$c{T3UD331;7))7a$Pi=n?D@q3=N!f3rXT)>Z#V2-(qS$1w}q#)23{Yp;Y3&OnmV4FLA`NR#32o{&OX) zTbBX!PXPU|q5pdbXU;r_^{4@$1@fN)bisPrN1&n_gn2zoSigRRz{fXC5ELAQb?PNy z-@Z1`Gjf5~f1Uh5TPFJY&VwM&b6Bh!p`v0K=kF7-Xgl=&k}F?!Aow4*`gK zaO*EXjmsV$<%<_C z6fDuv1;E!7#QiHAfVhVdWj<;Zg9%^4VuKbin1DqLCUAv{%Ci@bzf}ja(*<=Z|EuVS zxwaMPCq8Z@I@0Os+1SCs(YvLk4@>?0ZdYvIZkjC%`IEDXm8uLO&`EeL`38wfDwc*h>D7y2b*;Y^!@z5 za{nUs5cGe0XlN+$t_3YGFKfeF)^xCa2Em(LdwAD*YQu&Nd%^B33!uQq$9D|)&=3+5 z(h?LDJpButl9!j)OG-*ghW`JTpYLJ3lK{>U=?D9_H1LoD?>K$?`ueWI+h!f0UxbZ~ zZTH5F8xO!(90L2fJlM~bh+{$o2rKLB>uW7d^Z z0R2tGHi33{a7IW3aD};G1n;y}uUxqz0C!xRaHqjfyyL)2F$B_ft?u8?pSq!$I4z@aCOJ_Z5KK0Bx(Qt8c(x0U$tl9^hMeVP$1y z80L8s%#$=2qbtzw*P)K+e+TWvHlhEl;hT+VSohoEO?zKfR@Mi2TRsEt{d<9~M*#J| zz$2jb6@0red;9k75AgQCAKr^Sg|bsHepdf3`hm9d(EbYS13tw04DaWOvhtUXh(p9B zmVxrbvzNhN7WfA<;hO*&py3_B5P$R-N>|_}}vX%ioI=AKen`{4;-n>udfupZJ)U zh);ZMOZ0zuock+XzkJWW{9pWD{71Z%U&^iENu-JGtTYk6`t85>SKA5B#QZ<_Q@^Cw zl6=YkLMxG8>1D!~F#Ysb{~I3!aK!wtzK`lrIXdd~#5I6UK^_O^DdLoZ7sSNd9_=fc z7r-OEcu?gaLIpuI%lbq^AGd+LI(*eo6oS80a6p1`nESp=Ab$QxZXh zJY54UFSQD|gBrFk-&NT~ah$ZksCJP1*O5=@8JvkQ-L}a%^~ocnPw{=X zO!khgKG8e?Z!&fs@O$=jyt3UY{?Wp`6<1=Y6Hm`jk#*$Nh6V9ESq-u&!UJ zU}jyXh>r61Iulm5ZfiN+x_62^|A=B4b?rXh(?V%)v5!a7PN0`N?vib&MHc#roCFiL0OWjvWg!`miDtmPnddxA3X7rj>$%LIh1; z;4N2HT-=Saj`Vl#z^$n*!hP5zG_rQab~)N4x2)0ZgUZcYs@TV<*QVbw+k=4%P3xmP zGClFn@$1QWn`wCB4gDQMcYHEWSZLVXxZd$t22&W~*bEAb5hw>-tg^kbxG{O5=S6v* zXnHH}=ST1q#;sXX;*+Y#;Ep55j?tT3zFZY<<&+&(So~z(su1rjVA}J(Y$83jWY1^a z2r;PaP_K2TPUMxg8j3{65WhB(aSGAl!~IREVQX>X+tcEL)sKoc&en}ew%Ik7T&BQ# z-#=%JhZ~R z^Nz5~Va)csOX84Zg3KG8>A^i&Qtep>D>T-0EMjP1c(R3CCV6 zV5)5@x!m)~CScW3iB1s(VoJ>WokGKA+w1{-&Dtj^h%-{XS}@IF!gGUJl<9{lEz@4R zv70&tT5lzJ8pv>0v%+Ru(Y`m1%DAfmljZ%VeB0C2RI&LF?#{LCuMk(+uZT1CY~eu1 zunXjjD;AS4a#jMWr;g|^eR>y*(cb31;E3{KN6IiV?LfxrttazU8WzI#em9>&pE(P; zXMSV~QV^2PoBSM^SM}+oY0A_`TnakPx6qkqO1@O@>&;pIzI@Wj&-;AJ)C}%^ll1Bg6>{!_Q+7vR->NX4roNLw?PSW7 zm5}~!D<%EF>6G{S@J6M!39_V%2b6bzmWpHw zBg=oloh&4@X{#M}T8h`czX}FKMsYDOZjNic=gfy)o!X)19~}2k_mr9+V|>D|-fW{N z)W6kT>p;gxTq-&HHr_BKES4Jf@y?<-UvjJm!=Bi5WApy%m6PhtXXS;Q>)5XAXOWYo zgrEsigqqxH`NAqWmpUO>AxqR&SoikWW+N zZzA2p#<*7p(aM=pvzwPbn8(rCys|z?G3Kxf--^2`fbXQ_(H(lXr}NC3F^=3x&!U7L z7=p;}ep zCkOZpOs`zMD*mdYW9ZR*i@m+QKlIcIA;S#@w>1^J1>B7`C!Yu#=+hoDo z59o*EhL-2r<#MtiNU$U3&`V{4PIP28lzxsS9&4*BnFtDVS52s|(5 z)7PgfxiH|S*-6cFqTiyP&aH_sv+Y18TP?4vmD529B##?^E3B!dqoZ^8ZDEVWL|SBX zQWDRHj~|~5)_d&`6T>z|+wdP)$5&AM(ykzJa^JrF`wK2T-*VN)#^B?d=hL2>!k#>5 zdG~(p6Fb3HTx!0IAVv#E$aS;KuWM)^eL5kYo}QlUFc3h)s@RymI zZ1~Dv;@>$tV!-dPR)lr0Hg((Ht2%PRtcN5yVFYC0f3awsShVm|hPn`Zii@8sCs_^| zfBUv!K+n)n#9hKU{=SfVBB`FGrLM%LXyy0V>6k_4BRC^to#w@D6LV<34zMoNxipsKW!`;npxU<+uQB`G*MWo1e&^M>gqr208p4tRvS?(#m|wHtS7Wp? zE+_pmZF1j!ivgMU(u6tbv&0#sjRy7Zd7${%ITb+-J%wr`x_gHQX@y4eE`COgDtf0G zmfOeC3z9DX8*HZJ`IuTo)S~vrP|L==e27fQ@Py)CK6kdYvi|!5JI)HT(nqIv@7cG{ zexaa=bHBqY>&}3sNH3{2%s>j)iqTF+_A>3j%}i7;^Ysrk&5pDLDGJRqK4E8UKhw%^ zhbW<>@9TujZ1=T6>Hs zE${#ne}P_Kb->dYlHM9~!jcCAd!8vlVr$yfv@km!T%Yx;+d~q^1BZr9d)i{tqg&65 zt%c)tO8-LRp2q6=swoyV_T#*X&%(x1ii?ZyjVNbyj3m$_PyL3CO;64huoYd7wQQTX zM9K*_wsA=4p@P}(1=UrbEF^&H<^-{rlQ9o8I-dh>&q-a9_E?2~R+yR{N@O4Z`hrRF0KnWFrV24hWe zF^jt5tj~6L!L|Ewt7UgY6;M~Hc|wK#$4dd;Q9}~KtbS^eoShlz>AIIL-8#(@pdfUX zV&G!ao9LU=up?0htLrj9$$s}3G>1K^7a3dBK8plCWI8o*HKuBLwnZNkr9z8m8Wi%K z?z4O~Odp@OYwOcIr;l65ZYXVk;_cmCqJr+~v!xop)E6>z@n%X2(kA6cG_KG?h;iEk zf}GL9^trl1;pPiPz1BMO75yu@ZcGywi?Ob$^UAi=Oj0tV4-B}9({Vv;B0LzqslF<) z*w*HV2v!x!gR+!YbRzT4lx`1sc>bDE%%{fg_=8o{SKQJ7+yYq3N0hl8%23Qkx&?p*o3Ttf^qwMQcNgF{|x z$}ZltjuBha5u*KQm))KB}`q;ZVYQB2mo#k>xBnRx^ zGNO&!eWOSo7YI*wS_xjL!w!^hR}gwAu5zJgcag9k3pLq=7=i0E_t#}F6B47jre{np z4?6GW3_AI2IVlQZJ3SfO{Cr6sY))`^T0Yynbyt(6w^f_C$|l~|Gq#m`-q=i*J25J* zO%;4Z0y5^k{=#@*tajK z-eZJ38at;9&{Ksu)UcwFYh=h3J1(_mlhs=5T+u0gJ9jGp^PjXWc@cj~r(F&c4NERhW^DjuY}4CFKl1H_RVS1jeMxa+T7J3qwK} zvx|$vi|^dgSp1M=FuFJgbEaUrSg^Pv(g5SBFIq1OBCg!|QO^`FxA=K*>Xv1ol2CX2 zf$P+PL*wd-t=2kg@M}W^(t0<}u<6d%lF*M^Ib5aY1V)jp_Z}Ws*kalaqw=wts^RkO z-6gHAyaVQLvXA@w&8c{9Jy<8;B+N>~bi+%&{i@EG)F55GVCXJh(Fe)$d6WC-(*<`- zx7fk<&(UekNj&j6RzqW6&lwVb*rz4;2=LvSo-yhK?Y8^Js=mds5WiMS|3# zPN!k+YpZqAi6{o3Zz-bp+h?_FsD|Xg~a+)oyeOmSQGZQ68Mf;?&gj3sqCw z(XJR$w^8RDJv|9fU<7g;p4!lPdV2bTdhEAU6S<>NJ?oi;Kxo!__VE>ZE2{D>wyLbP z_Zaw5`=<{d9vL#?%gJgtyY(wHZg!SoUY>ijmTdX$Md_mYUC#N9^X)vUJrtJ~AxS!1n1SF(h|f<>MA8b00t?>i+Wy9L}O*qpZClCE7&BGrqZzEr*k zH{5=Inc@vIo_oS=v_=G5a(QRoZjm!s_>7}%dRmlBfitM-6!Xl1n!Y{lZn^kl_UXp! z>6xUIPZQRwbVNnoO~AS`Rt9?I&9_`%9Eqfve&j5aHu@@iRN`p3b(%eC8FI~;atC2{I(AjUQ|?+xX7wj<{$cyv0qE)%@(B5{@2 zc5l$F67n?^g%0AbSXeynEi_be4VQ_tQcP2qE9y2~m^**!#Uw`3ftE1EPsNYsaCAj; zwI4grI$vFL|Jida!)}6G6HenA2CMM0q*d2;kgR3$#$@UIPTRTzXBlKkFQP5`s5}(7 zy2u}LzU9-9S|eTf*ius(wUvE{&mqM_7u*|djg6$@@!rws&hV_edvEx|^S6$Wi#2YC z<$f=mvzOJ1W%wBn>~9i#@#w19txq-_UW;dh`2DWXnD#_O82W&sUWTzspsg3QS*E&% zo%P{T>p5x7^i-UV@)TNar$B9smD>=UKTq0^G=o09u5WpCk5wM~+P*2h+{yPH;_rG@ z+08TODwwgVSW$Y(=~|L<;}}g7M9K4JH{rlDT682tI%;5X86>{RGWG0IMebH_Z%;3; zR`f9X?Bu4$%xrf^MM-9=Vye&S!cQ-8FWqL9sXBmRHyE)3wWCP5<;IL{-1T<%$?`S4 zZ%8c6GM76!g9uJppbw6@I7m6~=4EX^@4s>>@bKYsRK&;?AI&)e${>v2+v&mj3)~M* zKCx^HYM^klbP;qYBde9mH((fxvuxXIa66eKn89^vta6)yzoqn|T~XYSZfF0MZjfKH zMz+no0XrH~!z81X1CL0S?3(X)CNv+Z*|2#-7R|{)RqcX zxc0Imtmkn*f;(+xHHT~1sZ-;)^r^ek;H2Q8GGs++@V22D4Z8!I~u*y6hrl-Ut;c|T$T`?!|ivraN%O+K%jasc#vWnXsp5qdC zapCe69$V{BDcewExhcrW9cb_l;(PW4sT@6egvEvj&&5@<=k>5B6TU2^nXoyzZ-d!g z{VRbZSG`O=>g8}9UJ#t)>Zm)&k47YwO41BgG@e-X`Z;xx{9&wXwWg z{9L64Y9|>Vd|p~oImN!Pb$)<`ynh*=u;)Red9O%m`%))q@~66S-TaLSc57|I_G1^D z>iV2+uh$&&_Vzl>+FbV#E|4TE%P^JO%#DqGPP1LD-)PhOM5B`{DNz`|_w_EdX!YjE zF;#M~)zOqLd3kV~l06b2?_+*>t|@RM%XXRklKGYEq_;87e#TtV<4nN}$<0iZeP?}2 zSyrVLgjTrq8PwEj3t70`r&m_>R8^^Y_zY;}0y%aZaN%y-yQ5JsTKNKeVwWACr_Xlr z9H&`#79~HjIuwSK`-p}SYo~Zs-}8BMJ6&Z(kI$b?80M$Z*7!)T=U*qTauN2yj}N&% zt+=_*`)mxvJi;wAOtj2%a9{UeL*7iTTNe1{RS!CyW%xAJf0moKk!@=QFPJlq_kA3k zvZV_{&&Z%9eAw)5@5-B2g7@+qw|+*rk62RF$i~s+!|ax?bvL&qkn_N4Z*J#svVo}- zSbp4GrOL2&nho=FD~<`%Qcv7kUHW!Z_N()g)}7``@;OM7%#C?aP_Uy@TxCzRa-&0b z#<2ARamHc~-`vj$%*mk9m}M3sHiL>c%cgdWM|n@LeLqd2@d=AdyfzUM6#cg$IL%Wbg#H{`1?leI@6d zuUvVmED);DzJ;5YSEZv-r}J{`J7;xoPipK7s;M-oopB=WwrOp=%}Q1t+wh4&T)D4S z*6*KoG_>KaJaBbfl}Fi0nF2Y^QjplO9F!qwbB{OqcwbMqS(IelA(B85WI~EsFx3{+ zWTacME>6*_RSb;qnr5eu;N5&7IOM1)2#AZwgTJFadPH9@4~3 zYy%{>I(uozSC*}GRgMkj)=b|fsi{{EUaq68cJ?<;rbr>w2}))kUaqwx?je-edCEt; z587NiDROVBF?)Ll`TH}w-jl&ehAXo0#?Oz!F*Ms!@DcS0_8FCsVd|-g^7p1#Ro#$v zsA}%!l(v`Z<1K<%%7sNW6}N+PFX^evb6b=x-a zL`rLx(3V$tys_?-Y?5Yr&15;tXw5pBU_ooD?TL4k*($H&ctalG!df~eK1?9peQkLU z6(|fb&!~8CVW*<2W*RpvU0gKEr#~<`KCU$xE~nPRog9O8b0n}E7}DrFI8>_AFJA2V zT8AWgXCBR{jOfT#Wt>^lBT;zTc{(Sz)5+tF~hyZboJyiCFy$u)A#B=ZZD;EeIZlEQcF+kd1-~3hMQqLy9JwB5RT(3 z>b`AqDk4^%kG7xsvA7C)faEoqIi8$LQKjQYA2;1PlGU_)v2NQ~ zFRB{H;5I7puEqBYoC?N8=n0ERw3o$=nKoW=or}wvv^;g#csNK1H6_cQT{OEDWh zI~H@PCk`FUR|xh_O;{c>-EG1j`cNYL5n0WMzIwz9Ey{>2Vf;S0u5r?ME{GF9P9x(n zF=cM8Gqq+9hI|{QM?B!|g6)<)yI*KTMaho}2*k8Le8{>pRN>U|W*A(NSi1dJUbOycR{xizLyW@?` zI1`M_;u&;vIBj){FFDzsQNW3XK8$LK*k(fWVXIz&mas|8g@wh0S9ed247)Jl_gReH zw7JG}jy?ZW4BD#fEN$6#5(7UQDZB4g+(xcrqm7L*MMFbb5PcIRU?b_eKZ2}N>0U{T zhiCXJ{G@hpiv!GSlTFe z>k?rPYUwO4sdij`oJ2!&{P;tlWmt>Vs`7Miv9OHyE&9&Tx7uqMk`*uK*A5w+@C+-s z(9zp}1n3^9s4`+ydpn77tLm!?$n-hcvYRI(DqbdE`9(IfOv!AXt z2L#m@+`iI&SMUbuyjv4(+DyH^D+nE{^6C*9@<_1@w#oVSS7vX_eO~fl_oMUQv+Ld7 zuI{oq3%MqIm^$YH`#Y3*rOEwoqvZK`J5M~bb|eAi8a5hhy!Y-SR}Bx?x9;lHP*GXo z9N-{dX2eX9Jl^QgUGXApA9}%yTj*8x(YI&zkBgDrib(K*PZKUBKGR&&S3qEY)iPJn zu{cuZ($CO4|L!7H?M&NV7squS$>JU6v0nK6(Q}q6Rt0x2tSl__n5t~pU~Fuc6;!Ye zo3jB8(8xSbcGHTRptH`F;1ejYp3 zjalAB(iZ=2j?FlqyEgO5(PHiPgd#QQEbnB;`(Z21i9$IQkYCX}PT#Q?iS+&D( zNtE35iTJ1PPILL3@*Mk~bqgDACa1`F8?b@?u8xjzo83{$Cmf$&(#qh>0SD z)2IwwnQBP%b8Il7JJRRU9C?Q-t+=LKb#~B)@^bdcNGi^1sVy(*HJG+FQ!^YtZvA}K zPl$AI<+NSMq_f;xic$`lt%@u5CzH?foJYz@%uJSleD9w-zwNcHig{fF<|z6 zW?V22T4M)A$wfW+#_*FT9Ba~zp<+Z21n<(%?DIAU)U^760CLNbdi|yr$kEb z;2`!uw}kL`^y~^tU^oNX*vmi!LvZeyORs6oHc~w5Dfgl$@eh}pBE#M=vROPQ#M!+ zdhXeoC8-L8(dq5Mw+b$16w9wWySwU=HS?kg6^SbQib(%D#Z~D;m!D+K+a}2}^wIZU zv`Bbusk%i|v9&c(gIe#l@)dTzs-ZBSvwi#4xDVCd5oWHuAT7;pgrh|G-Ga~Hx}y6D zYa1msQe|>EAh>HW$FuXTm*Tzqo3!!MGuk;=#%aPN3;uro8qs>zY5Bev%pTQdyt@OeQ4 z8-*w)kt8iWn>pPlDPv0o(=$-UlXsG{k@JlO$3;@68V3iGkjp5g)w&Ck)pAe_OK|5I zJWf7M5$CpRk6Y;-e44u6wrz={7xG`6P*tMI%%TcY43|$(mZer(-zVJg!HMqPCYev% zgK3u!*)|=Q3wk{svMGvfy(keG>9gV|2*;z~WJ>G+!O^*$FZ@H% zQ$cITchff_luxj57`~5ew_GDeE8mDZ$>tt%`C&LQy(29yR_$b+*7-8CWO(l_CCVL& zBM}$+wuPMTsEvt{i6MW{tNq!*YG;&w*eqQN&a4g7{*0Vab-nMImlQ}S<9P6L?ir>G z?!lGyeI*$_Q&T;=qlRRn1kyi$7Jb>{H|R#8f1zmP;#Q>_bqPL#o{=I z0Uy%4`e6^a`s|mO3yvjegl8CY>rja2+{rUWV`$89hoB#x;2^uJ$~-(w!MtZA=g#HY z9>pHd{L9R8ay!bLrH@>D-|*zXb-i_dED;I|>@*$1Yn|_z(0R+8N$F4eLXt~Z;jPWl zCa2isvdHxIZlU<}jEQ7h2;T38phV_}rLD@=$xLM^Unb{tyi7x$BSxO*miHNfvQqwI zv=2lTANJGh9It*MifSrlsuR}r-dl%F#5pu!B+nhk51c>6az=|aPMN%{Pd9b`{e8ID zVS80X;Smzzd$I9?U3#)AzLo8WkKRu5ZKu&QEYD6bfxZ>J$9`|pLLFI9@+&27vd|A> z>+-;g*9&qjx#4?dW|!_AqBK%>RXP>lkfI%bv5y4*!9@NnhwFvAXSaH_d6ZIegog2} zQN_&igmUJdQLt|(;}%lF4s@=@PfewEh+e-QB5i@9tEH4bebm2Ox^A)Ft0mW;pv-nD z^nimTSz@R4lfhFcuHf`GMsns$vOrJf`t!UT8I>Yxv-26MZ*IK|oOoYb`$5UXP)z<# zNrdz|_U9C;%wT<2+PQN2#6*Smx?raAuo0(Of6AdnN!m7jd8&>0?fmDExDZb&>72Zv zX1&K|>}nG-T1(q#qEJA|Vxc zZ(Q){$_ktGRm$#qFa2XjU+`V2I#2(e>tNQIenwQ2WjsFn8Hw^v8__@q(t`1H|1Di^ z_9r76$$Z%3eH6=#m#f*dqMuTqP^+4_6ykU^44;NN?Ev=Qcj zTsRqADjd`jBwIaFNneVh;^G<#A6xHaOgZ6n7||lr4Y`*O4bSE8*qJnXdZ_J0qqg#= zvR*k%t(pkk_4W?wJhD$iGZK~e4>oTispsb9M_=S7)83^QPb0d)H0(3Q+rCnIlkL@a z-!91&FOqz;X`ETYaEKIgWs5=XQDt)V?N<-v&2*2pwcVJSI)wqXG))65N>mvGZ^iR# z7z{jAX6vdb)sAv|>NnM%zab8ry}XgJhnlJEy=&{_kb)CM_|BD7HQwtyuRlkh)^uHJ zefLgt4*P75AfybI^0yCChMz{(1(coKBKPTSmfd!V=hsBZGN@^S7K$YI@QIm$c3tLl zByl*lCo}HD&aumLePx-~b26xQz0nG40tFgF(|~x>%_ta0MrRTd#9%~eyam@e6^w2| zhbY!?OYb7vq(&g!Rb9-W>?G}~-+6ydFuG~g9v$H(yZAY&R;qGNDv35vS=7g~06Ic? zy<=C;>3sJ(C5W1|yxsr%l!FdrkPc0=KVIhBjSH4*SHB6NQK z*fEE-KY`zd(=al;qQ<$vfqUQeYK{n zjh;=i)U+eLaIyWsR_^11xYk4Vl+?SDgz?>KAF;dgw2fOc5_OJAoqB)xt}5G%$43jg z7thpoEzgu7{AUwqZ2p_dxh*lshcbN#M^!s`*ls|HxfvU^k>VaZP=C`>YRvUYXlU2R zhS$QH>y!k>de;wzTBXN)!YS;0zN(UwV|1o87w6PYZISA}$?#c1@+e6h=8GOP+c_wC z?vashadX@;yJO2eHQSmUcQi7Xo8?Zv)MLo+Gp;#yUTxgzok`1unuMn%8@qeQ%HPlV z&DKT=e$gztXuOS-be-DvULVz6pFh@pafkhR%M-WF-o3eHmwV!}GjDns^%Kw1$~2CZ z`5b&ow6ez3?GJQ&dLLH^(qH$1bw{|X+V?kH;OK{&A6Cu(s z>)$;m^fr3RnQQH#Lp0S{8nxJ{Z8xN2x#J!PI8WQw8%7@7>F@ippXbKm&Va*`$#SgA z!I2WgQwy)X1g}W(>^&Oi0|~R*O?4^#%cHJS*=bc9J@ud6PFu%I8Nj!w+-d66S+T{{ z*?$KI8`u1Pc#AefCOyo*hIk6ITHT5JP~2@h5`KR%VsSah**}SdV)SG8EH^u^@YyQ+ z6Kfr-`OH%#a8&iaR_%u;8v|JCq#M~jt)a!085~->cI_O~_;D&l^rp7BQ#Y1BnLs_3 zaU!QYxM^t9oY3*R+gIT=no_9sBg`O~LZr1#=ez6#!Qxd16GDg7^587JjL2fJ!R&h8?L_LXTbYn=_nOgrFu{v6r4 zm=mGPJ452z3oqXhB`wvtc++Df&)LzgEAQ+Q;Zi#%4dbY^!P^AZnW?jds#w*{-s2R4 ztutyaA0xF3UA#x1?_@xni;a6k|G(b811hRz+qRo5AW;w%NfISBQ8I{#h#-i8oK+;W zWF$8^XAqE#Bo)b$Ln9zaPD;)>=M3HbtIv7&zyI&}|D89+J@@UwVt4nhs#SYe?TTxz zDI-RQN=5C(f0y(R_-9LjWQx%bZ;9rL$f6$qm|gr*f8!BUZz|Ohe3YEbYiGT^rw%b zk#xRHO=uPNHB{;^N7Q=TW{y}pSpOue0!DlUkZ0x7yINMwXPta*<_(KfUJ0Ii)EmwV z(Mo%SkuEcdgnPAhMn=*L*58T@xlgV-8YZL95f4ghYgOD0iPFYOnps*uc47Dp-8Rcd z=MNvJY=B1a0Y$&ztubP)JPs=R5D7xJO%*IH!?x8 zc!Z_jbdoXkn&DKe ztuy3|WKN@tnc11&#(LF|7q3XSCnYT@U_5xdsi`zANktU&k2EvWO2xcX88Ko>qVU_) z(^tJwgk(Rz<=+2*z86-41hxTx?&#TUmJgFbt9a+GNN$s3U~Px1$AibZBC7XPhVzMf zZ&C4(L?RZs#m?69?TJZ6E6eXwVHCni6n>-W8}}-aH@Q96E5BTLjyvuy^r>ejv*pzN zzEPC}BLvf44t93-E$EK2m~5J|W7=-R@hfPYX8!Ed*r7l(XTcEeFIEe6yfoC=uSM?O zk2?=r>(QpKxPW($a!qCsYgl2s90rNZ6MhwZbNv_n%ITKoD z9FJ?~$=(zc7)^yCTj+x9>rMt9iBU-7YoytudqVkY-hA!fZfOV0MI?>nh?C}9nuZ>Z z)LxI8mgDP}M0#2Z_4O9^`@{lUwOlM)Ork0-voC&SX@o8W1`1qsaKBkyyWNemP|)y* zS)h2pd?AwlL-fym8XwnSX-23KBy8w~)!D@|rD0jF&q{hxA1S6osY zuGgXu4NHzQ1JzSf!W^Kbfn>iOxM}CE^8{2I=IfC$4gK;9ubd2MX$^nx>p^!fSF1(s zc*{SG3E0r*0o2;~4HQ{QSK|3~P2%TZNPhmBYtf#lfC&$Bdh5YLLy^1xPsc|rGv!1! zt&NZcMMa2pD${gF3z8-F*8cz?mbZ*b-Txe6F9bKE_L_&y{h0H1G8$YhR;h!&dqs6%zkml)CFsuA zV0F#;DRl@TS==O4mI2t+#_;mm*jL*b*@&jQGB2+OlXqRAPE@0SUAPd)spS-(4W=vZ zrP#|Egl~s>L3ZXj(p!{xEaLf|N$mS1E*FcUs&AN)H% zv%I27#s+fzi8iE)14k7Ow^5}o-n@UQru#WwL=J@?u4l>f{NgkF^m`izgO9S0gVYSV zF+2Q-;JeaaipU`|Mc^IDy+GghA;#eod{LlN9v*}iTGQ)vS6iRQkpdIAiTe2_l*&1 z(d6}l)2p|s#&}%zS4mr--}GF$UQBpO0*jsyC0Q5lbE$)ieL52n!}fGl6_pF`q$M}o zOdqc{B151yK{x&o=C%K^NB8{r9{M29DB`KXqT>Eo{Wa6#yxgcMB=U>Dk&O5EQ$5K9 zIa4tkI#N6w$Tb2DMighvwyUQ2&p^3Getta9lXXMWk4HXvNSNw=<=gthA(br5a1H@L zB~Tci4J3>KYkp=H6C4OrYa27-!gR-~;wAn`x9^k;J>jayxsj?$SMtU_s>@x0WdisO zsH?pJzcWn=?~K1a=W8F9#O_&V&#_nDj!DclM;5f6Fy7#VinTh=coXV`{+PR`(Ghx! zznG^_4MA-B=97v$?HYd+BfWy_wgHUm>idN@W%UdDl1}~y`-~WYD3uqKhJpdU0GD{s z2(2pjKr_}9o=@Gdt}B7~o8o{BL$T)h54jlec9wpU_(2d$*I19X32!BBaZuP?O0lA) zmVDRL{W?;-`s!_Bod<+T=#@w#J$HeZc)M)N&gdQEI+zUEFRj@Tl5EeuvO%^-NJF3I~g6vW~A-;h4O>j zD27kf)lCZtQ=UVPyDMqZViNnVM2H)aZL+pt&AiKURmA@+6K_ULUisniT zp|ak^zO##crHF|5hlWlhbp@PPV7mj4I2okJq8bgKk;{3^D`v|a39J~5dyXs+nu;ZM z&s`-XYy1M=t5rDoT%cR&+0c*q{TV!n%Z&iPaBd7ikTX#Ngn?4S*=-4OdPqX)05MS& z{!$;sfTUBSYTi{n-(JNd*eoiWS2rM@+#M49h@aPSF`TL4^33Pvz!LuS^wkmo4v=-n zwg8{{F}>Enrg0+zFPkbF!1W)6-L_g)5JRh774#xN3C&-WnpmGygPKdzdE zk@NU%%q~eoW(o?F>dzXwXp=7guX?oMh6m(-w-Tpf{ulBC4);i}pBuCFZDwXMb&l zTIH+`H{<)oeh!B8D*!fHj2a zG?Z(Ay?PPbM@dMFrGA?VHTU^hpNNFc+T9gh9OF4qFdE%bZ%+{2@Dr`V^(_hHGAe~@m7udb?x~Dq$yI^5dKDFBo z=RB<=m5>zKK}SV)-`~EzE6RC!2_3}2Ue?#dsHuN$PK7sZP1fd&G`juOl0-(K^u*juLJ*S2^RhPVE2Fq2c zsYhUfKJoII^fxl1+-5?drldoC6vXxQ#bh^qL}2P$CVC~1U}L5RPiZRMij36>d&=p$ zYOATh_O0ZL7CM5^`%-rVeJ+Vx-a$!uA(IjltMc>m+RP93U#R2Q$j>#LZ%Jwr?IIu- ztyaULYO2PY3#>JJr%H2WUa%8fYbLgoUE3fPf>JHNp$XE0`kSpC?~Q5~a7Alytaf1Mwh8-RC1P4=Jy#M36QvL%wx8c|2wJ4X>t; zccF#)w=mVIJ!ztlFl2^IH9YdW_k+bLXYe<7mVzl!BS0#^&zBWtpZZ&XR^_`b7F@&h z5u>WW7^~4E;T>w6qyxt5E4;1ixD?J<=_onl8$@NC!;rpbV+5}Hp$WIRM&Lu0*+33@E zy@d6c{Z13qn?=hLpHBY)H3;{7ODqJ+{b7LQ*2TrJa3SVy%UEJLGn$|)U}rPuAotBIV6bNwP@gK%8SjypJ&ls$(N z9C_-88b6kY=@ZSJN}0$vMp4mHh9m`;NRf#XHl5q}#=FN?cT>lITZ0(45{HzU^f@-;d5uUQ1l_G$|+4|aSn zRV8BfG~m&?BXV}i*>$-CN9^IQKmUZ2HzW;=xgeC@LYGt4jT|-{^p&8)<+H>boD$~Y z?fbH)?XugJ2lh`AZ~Xc;!@!%&Ny#z!TW7IdL6Smp=ws9M0?*$r<=P*=MY%)bFHI?#MO;l0B z;qaBUHF|^ua3x<9u79kr zzYL*I*eR?u*c+NvlqCUx7*Go$9x$Ls(cFdZ=WGzs$nc2ow(ij4XcbXlh64aR-+%@6 z99~K@jI?FmmX+!fYwSbtfi3{ro%}&lIar0=7g&EXCv*ZVfY#7K@st+N5=rAQdLv#9 zrJt4V-E@(u=LMGh4v^4{tgG35 zPJ)4arn*-gRqk_fE^9M0LdeL#t4fixN^Ty~FEmEMGe`UrN2Xkh@6X-HnUYf(qG~-S z6=AI%tQ;)DA|lKTk-jeauDqQf4LSB$Z+ODe>=k)Aa-m$mVCQuI&``*h$Rq^vxT>-rsck$9>IBvI?mL)O->8u+^XnBU75J*%st_*~ zr!Oj2hImcqcbf=%alPQW5U)k8_vuOaP}?K~8~6!4L}R5f`7j!O46gz(wB+dO0d-ten&B{`~89>UWp-+%k#=g*gd6>zvU3wa1p zeiVyWq(npgSD=cl$jO!TPsPsa0$ywcR2O$4&%3%`4v36nvNVe4)gbsn%Tfa?)7Stw z#Vs}fS9*kdU?(P<+})+@I!*kE4T5)C2AmeT>)-ikqXAaFsqmsN?uzjz^ggGMQaLfQ z)4v*_D{Wbchsr3tp)O_)_T#wZXJ&2UvGR&3}7UVrx?$7GZYc%QB_3l(t)7~$O4}2e)pYaNF7Dbom+TJ9hYtB^J~I{}8>Gv+P9?AR)29hDi2bgvpD6psf?hXXF#D_EID9;a`>n}S~H5yNl1hz&eeg@ZQz&)B;LRfI71ig}Y}FFD;Lp_jmC z@V=0OaP%5A_nw^QyhTE}A%c7R3cJjlJlfby*yzhJq#B9~C|yQhtzZ3dB_1s9^4My{ zi+B^cYL-KoZWAzZT=&2bx6y(uhyeg9J>+?;i$Xa5CxY-^^krfWA<$3bM9I-an^|HA zAvoa8XaQsCD{@z&bFP$yc!Aa;CXmYODQ>hv;RfEb%Q&i{XRS05ynn{ZmEeDN{e5Hslf5hIxEhfy(6t6j%iOkp+lg6Fy{Zg(#cH ziw)G~JP2Lv4;usN0tn=*;&g3O3I3nWqqMYiw_;gIz+IjMoP0WCe~MrCGialnspYJ{ zoOt1NH60wxv@dBr|G>IijJFvTb&Wv$Hjyu@O`L$sv%#b@>$+XVMV6EWkR2*47+YYl zD}^mbN*5-P{BVqw`3`i1D8rKP)x%4PF8LFrBPq&V^AQUa-eg35o<1x1{g11*dXA20 z+zP9guGjYWJ~DO!BdNRngM(Q=bWD~7+v>Hb^zmjcLmuO1@D9COC>!L)?^T0XG~u*s zDh=@C?_9Zbd~NVb5x`Xk`Clz4P6XM&nXQm~EBU~;4u?upxi1Hj6!H7r!%GWb%1o{P z1-@mt*hcm`T{}@Oetg6F}i(Ph857#YmzI3GdQ zF|ISCmt)&*ZFFbiV!IsJc!#ZeKyCFY6Ad$-u~R}bVjz770=InpCe~}_+^V~N9fQTv zhO19lka+4}*A=hO;wwY0dr59zbh(b_VA_cgoZjVaE0#Q$#O0};QeC;#l)Hof!C{IT z52%k*#K7z5)cT z+UDzQTkv*j0yU=TMjcIL4rDiYSXR5wn&f_o42usGJ4%mwsN*V9kWp| zYnR7vZ=-*eDPxk_DkRyE+Eb;(rk+dGx&U9{7YNOb~Z5|VrO z?)mrk_g|cxaF&khb$#o~zEUdGAE!kl6vo~vCT2QwozRRvMF`9&Q7v?0V7oLcKflbu zo{F4uAukWMeMwFdg4;+7$vb6zr=ReM>l&p%E8YIyLuGARXyJPFv;hN=-i zw_t=;pw78tC7QozC!W^1_znAM-vz)KB~=C&l5$IWdR~34uaAX9<(d!JrUbjoyc-b? zeOscX(iGSEp*2ak(A$#!`f!FheVFYVork0yOnSU`H7C*j;|OED?hEaM?!%Q z3S1?wRg!m86{<>S^w8bWLbI^;p29+~tZn7FwNch9GxED!4`+rGB|FKfZ9(d#W&<#3 z3N3Xy>6e&0L>dsOaWR*et8#aB-Vrn71u2sR#9z2VhaHW^MS+PpV3Y|~kVzi~K+pL0 zm*4dG+N4Rmt`g&e68Z2-yUUiIN*>0=X4{jwF5#eW9o|M=0Ecga0WbKAc%|+8!{mEv z$4ebzfA@TDy*GNk3JY`Dcr(ZN8<_1Q$+zbx=@S>9twqm}`WB$sWtl%3x3Al7H=&c#Rq|bddw-gnOQ&$-|=%~O2vKxoyW1|}e291hIM0|EmJ0A^;9 zoKeOKn!&4E@zuHa+;f@nVo9>i)<~PSRgoRc)R?nLROex;Wh|(@(PhuInzy8KU9d2* z<%yY;8%epgs)JR9>rw#N`%>_;h=_U&sI9ouhWSQGfl%X z4r5D$20LX?fNJ~3w2IQ1a@60dDcq{zOHNAaAiaF~kWtFn<|PJ=iUsJ-pHjfrf_9s& zSBx_SWG>}ger~(jp70YAiO^79C1MsHcT(p``ngP!*rCEKEsoz-&YZIoWcUTu?PES( zQBUvnSfLJJV<9bcu@EcBeHOdmpZGJdR{GY&!GVFMvGH*iGqb!B*Tc1!02=ei&CPA# zmJGP-@Am^}T*oWQnN|T1-)g)Sc)f@`Iy}6L z^_Y-_^||n~uP@41<5_y<6@C6#1Lb!4wrq2qQyn!TA_%;8mKu@2eikx=TC``+9k}+b zJdZ-{Sp-4XD|-MM*hZqS74e+B!jE9iIk-<4CSd50h}`xbD%4M|0uB*|zcxD!<5<~IxSQjoR|a)3*egtW zYYU&UQ+@_s@^r zIr1ZBP>kr@d9f~G)#eKLWGN5$4?F~Uym|BHWHyj-%CYU{J9<0%2P|^0^@lspAz*R* z6*F*lKB(n2(dZzR>2osW5~DGI1^?%ZrdOOI0=CQ4VbMy@DxWp%T!bFW?zTMb{eDYG zc?khq(JU-M%{NMG65X8{8Gp6Yo1?+CIc8ZTy$xpl4KII$&{*Qc%i*K<&oMHGV3DM0 zk_MlnWN|4OGbfid?HfyDp_qa1Bc^{nnwP(Nps=gFd0W!h|K9_%>kFEgBqL$>h86XP`QJtU%AuABJPCT_;5ZQJF$ zln#KKMNUhQ6B7OnX9lku4gH*ZB+SJ84OR0r$nx*p`4b%!Bg+acL7&{!6k6&{m-KZV zJu>LyyI(JER!*Y_784B7h%F=rZ4DfMIQ+72Sos*5mCIpT_|n?^K+;AKK=w%d{3hrN zi-lF)m?_n&My*6=lg}#PHvm*h{Gb+jUK<$}9{x~&*yCwZrovlf1<(1Rw@!oA*{~R2 zG6sr7PH+)IfSXlSu(={LJT(RUC3p_@_3cmt5E45JSzIk)tfAw18^Z@^oTW2Tp1GBd zMGu#0fx&336u2xp`JstCpWHq|&C8W6j!OBhO^gBd>=3(8^Q~8n3u{i>1Nsc%%cJ;Oz+x z!tc#u73(S^(rTnKPGf7zj=N5Y&r6LND=mi!3%}ePEn8MUX%Jhce>--SfKdpPgLu=Y_2{>l3b{ij`I{OXY{W*Xxzc=i-M46tc;J!zs%PzzJ ze0t)R{pi;t=UyCn3Rbr`$qeXBAUWe>*~4FhhEDVx16_Qyp;?irjS`Hc$op~@6(>WY z4why*)6D%>C3`IyO*BMN^&1j+g|C3Ko?ygDAmStyI0U-ro^?wGaFa(|`MJ{e^v4ue zmM#OwNEGrlZgkJrI4KK8z`(d>P&8e13wf|(QA@&CH4{!Qeb6@w%7Q-)2^?7*1IR=z z0~Zn7TtXIVrwir9)!o$Zfv4v$XH?j9lSp(?`nc0@dwtSvrfAA@aZ$6fqWo<{n~8p| zIm1oH8`H->)fi9@Wzs93eEIDyw{P1%YOapIV?Vpw}_IeWb!%8Y_Jed<@A#x8sTl+N8XX-#{3C?~#kSSdXE34SRSMQH{ z+d{fOa0j`W2^=3SULM=+c0o{(+tasAm6`Q60M8S9GnEa81pqnCum0uk?C{PG(ao)i z`3J{OzRY%_E6tb{F5T;sjSSgHXx}6WK!jcI_uQtx*d~rx+PCn)lc$EUVad ztU}Le^p#nf+g5c^zhiw3@4!9L1QE>kG%7t2I3U{2kFz_-H#|MVcRSj6hzo;?sV7o{ znK&td*NLIW53!@+M!*~d>{BtwixP z{d+%t^NC)CFT-|p!0hVcyZZIDDCqenkkb(mE*6Fgrj-I8ZZaP2C z&R0m}D^df6$#F9Ug=)P*n3R;1-AZ3(7U=cqPEUIgG7|tp=5KkJAxS|&Kpd5fuaEmI zY1Vic$~hUv&$8p!Sjp!@3spB~ewH!~eDDm8PaReK29P9!WAnV!3fIlC^2uNYlgC1l z5nybDoL z)qZ$t6u$k!T>9>{oV@v2vUuwsL?&V`n&i!HG zaQhx@fVE1&TBSHN!-Sh*-=5umZ)I+7Zed}e46xI80Dvvqn2tbw>0K3xHD|31=rb{A z{>$CV>6qt_L=y@eKh&D_PGOxmosUJTf7$c}Fp1y4<{ZJ2*aao67oOJ%M+LfQdVOoF zq5qZxtAl=9$RhVq;i`d~^Y1TjDQ)l*Whn@tPl$-*Pm|K)?-JHf1{+FyWPK=#_@56DqfyTcrc3ZckAa+$ULmX@}`?YQO75LF#7;5aC(V}WqNVD?9tM0k(7PcVHRL! zNR2_OO`k2FpOGIet5=7pC!U~RWCGNy7M)2VyJsI2=WqjPug<4!da9S*HSQdQ+w+Wf zFWc4UYHz^JABN}ZjM;I&_}W)nQzHS6vGK7n36m17Q5_;GG1#~G`%%9udAz(tDC$~e z8EK+XjJXn27A$K zJ%Q-;Oih7$JBqpj-#1Wo59ksEm@VC_=AwAdLUE5Nsc>E5+!{0gZo0vCur;!U)O5;M zlYace&t>}uf}<1BfB+QA3>zJtTK!g8S@!Jq?_d4>(ZFXM{4E@=$_~JJPr)JhLB%=N zx>$>cmV*VLo`7?Jdq1t-=?~M$S3y2$@#sKiY6>~85WnV25CWb_m{T8L1@kXrum!dR z+&CD&e5t^2Q$|@q2{i7!kIF^)EiEi`a?N$@8jxk`oOL^Eg_DNo35e64rv@*gPCWM> zS_d4_{Bak70p@#zKN{ua@PIk7!ENrQRxW zJ&ascv=_W46s9Fbd&eYLK`>gSB{@v1PCPnDq|IbE*O_IAHnMG;&a}*F=`*2*GPktI z;ZJUUn%o0dn()J zc7<#$&{sc3@z)6pN?rWCM=pJlg-b}L;&S>V`}nv!C_4$g6#R5INAktYC#)Nq+Y%#w zl~?r-&fXUx=GUi(Mn@fOStw=GgTfRsiKf628`xTtmUVYnXy-_GJ}XHu^mHK=8a_e~ z-8WyHft`k`FQnfA{h>?~&dm1uCtjRIRAFJ^$)Yv#!l&F)6WLImvpAt3|9b1tmb;%B5L2GQ8wAK8^ArWYm!+do6vih%aQAP zyg6REzT1{AwIcS|{L-BHuSf1T*kTA{)!cuNno(xp&5X!DU^_*<%ot#StWo>#p|#CY zf0w-KY!%V(Oeg^Fxk0K5tEOemROb4aV2?{}t~p$5;*z0Wnw}`0*{m5gcrZqRu+aSP|DL-9qupzg9-jB2*qF)`l zoG)*>9L7u^Z}Y}kIHhmAVEPQ1766+&t=^_d2d*tI+79C2p${*rFP7~hme(k82-!-{ zxs*I*xiDxkFmMQl2AB^7#?p>h5UFg^+|C+8R3~Cez6!}syc$+y+x0zffP6}7fP#f= zlcuYFuv6b)!V2`2DVe1`BtcPXr-ROSOMK<>igbGZ({m@LUb2*@Z(v|^L24(M;fmL% z77Nx8CAn`9yh;|6b!wTq!%K{8c*Gn`pekL)YiFeO4l!>PKtPFNWD|XGGT0ZS+Ci!P z`k{iUXDRjh{~t~5!5G3UStaYZH#dF(pT=ws_q7~e8aup_FtvLHP7pzufEX`Km{$S^ysoV1&B=SfNnf$cGbrW&$Dy z1p3D(@B!;v`CmV9K@vBC@BqQ`)$;)XHe?Vi7a#W8zw2O>xhwO++Ri4^KR9SCAth-y zJuCAfGbj5zDK%x^C%|t4dkq@~WZ>`S1;n>;uuDuyPdfp8<$H5;bNhf7es^Saba!-g z^ZKTE?_<90?wQ^(9d)M4(?UJ@4Frn z5;6uj)TcqOxd*m%P=FKt@bA=(O)EG&)GIMH`S52)`^wbx^wRjm#C%YAC>rprq9-ON zch=U{P9~?OPCtLmKk*F?^!mH?W77)=3%DH+77`p59n};4K5omy8-a0fd53XFcck$uxewF_b4o<)qf)gGURTLZ?1333$F<1!* zj6#J*MC4o+y zf?;71yL^21Xi7?Fz|R^2_ynp-n#PV9=;l%=u;9jS@;3$-cN}mBPXSKdN$_5bU{qBH z0iSL95s0hzH|T#58XDOM$Vk3%Ifb^~cf0l}SdwZF~!^2)+MNkFH zPYAdP9|LfjCYEE7o15DJa4YHq{b?Z17B=p`svjF4q*V#@KL+V>0RFLLz}@AXl9Hl? z<*)<1d{TfH@&14C3n~LnL=9jlnGV8N{vEpiL%#<|F9hhn1SAmh%0KrF#{Uk=TmM-gXdXHB3EbOP^)ee3J%|B!C*{RbHP*MQ&R zv0<@s{x1F4bin;gf)%-0koF9aG9Vv7nPC0*VR_I#009gC(X&}uSu-H)_}{4;n-)m> zCy+xRF+lHqF#e_dhYnEQ6o5xv5uD?|^&=pE@G}16`rmN|?Z73F?t4%d=E3`hgz?Yt zSehlD~!2__)_dz}IgeEEyR zHzed%cuaI^c5cpa$+xokZizOHe0zl!_M z*T6h3$uBrC;h%s1?|u&q4gL`j65RCP4gY_J18WC#K>x`f^H?ya{Xeh$)o1@m|7)H; zp{s6)L=?g|8RZ)oxqGN8Kw%bR`1$yv1T=^HxnSMkBxL25%& z!-K)Wu{2gzC5sz3?zytD$vQc^I!6VBhUENp{6M4lq(nO`?{8mUpIu2wi9O&FwFwRj zP4f*7F#fCfzM-MasTt`V0|NuaV0+?YQBhG2u%$^zN=xkn^_S_d;$yD|g@$Z|M@EK& z_D&2dp#2R3YXY19ow(RA!C_$*Aipypoox^gD~loF;g - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b4fd2a22775be9b22cc9558374fabd03104f66ee Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 28 Mar 2018 09:17:30 -0500 Subject: [PATCH 0032/1506] HACK: proton: wine.inf: Don't show crash dialog by default. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 3b94886c548..cb3f9562a92 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -448,6 +448,7 @@ HKLM,%CurrentVersionNT%\AeDebug,"Debugger",2,"winedbg --auto %ld %ld" HKLM,%CurrentVersionNT%\AeDebug,"Auto",2,"1" HKCU,Software\Wine\Debug,"RelayExclude",2,"ntdll.RtlEnterCriticalSection;ntdll.RtlTryEnterCriticalSection;ntdll.RtlLeaveCriticalSection;kernel32.48;kernel32.49;kernel32.94;kernel32.95;kernel32.96;kernel32.97;kernel32.98;kernel32.TlsGetValue;kernel32.TlsSetValue;kernel32.FlsGetValue;kernel32.FlsSetValue;kernel32.SetLastError" HKCU,Software\Wine\Debug,"RelayFromExclude",2,"winex11.drv;winemac.drv;user32;gdi32;advapi32;kernel32" +HKCU,Software\Wine\WineDbg,"ShowCrashDialog",0x00010003,0x00000000 [DirectX] HKLM,Software\Microsoft\DirectX,"Version",,"4.09.00.0904" From dbf9a1adc8befc7ef924b586c829af0d18363811 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 19 Jun 2023 17:45:01 +0300 Subject: [PATCH 0033/1506] winemenubuilder: Force-disable creating associations. CW-Bug-Id: #20433 --- programs/winemenubuilder/winemenubuilder.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 36569fa9d5f..bc92ddd1ccc 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -2864,20 +2864,7 @@ static BOOL init_xdg(void) static BOOL associations_enabled(void) { - BOOL ret = TRUE; - HKEY hkey; - BYTE buf[32]; - DWORD len; - - if ((hkey = open_associations_reg_key())) - { - len = sizeof(buf); - if (!RegQueryValueExA(hkey, "Enable", NULL, NULL, buf, &len)) - ret = IS_OPTION_TRUE(buf[0]); - RegCloseKey( hkey ); - } - - return ret; + return FALSE; } /*********************************************************************** From 2a4c5e079a9f94ac8ff9ea302bbf7148ae2c1ab7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 19 Jun 2023 17:46:18 +0300 Subject: [PATCH 0034/1506] winemenubuilder: Save .desktop files in c:\proton_shortcuts\. CW-Bug-Id: #20433 --- programs/winemenubuilder/winemenubuilder.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index bc92ddd1ccc..a7374bbda27 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1264,7 +1264,7 @@ static BOOL write_desktop_entry(const WCHAR *link, const WCHAR *location, const char *workdir_unix; int needs_chmod = FALSE; const WCHAR *name; - const WCHAR *prefix = _wgetenv( L"WINECONFIGDIR" ); + WCHAR *shortcuts_dir; WINE_TRACE("(%s,%s,%s,%s,%s,%s,%s,%s,%s)\n", wine_dbgstr_w(link), wine_dbgstr_w(location), wine_dbgstr_w(linkname), wine_dbgstr_w(path), wine_dbgstr_w(args), @@ -1272,11 +1272,12 @@ static BOOL write_desktop_entry(const WCHAR *link, const WCHAR *location, const wine_dbgstr_w(wmclass)); name = PathFindFileNameW( linkname ); - if (!location) - { - location = heap_wprintf(L"%s\\%s.desktop", xdg_desktop_dir, name); - needs_chmod = TRUE; - } + + shortcuts_dir = heap_wprintf(L"%s", L"c:\\proton_shortcuts"); + create_directories(shortcuts_dir); + location = heap_wprintf(L"%s\\%s.desktop", shortcuts_dir, name); + heap_free(shortcuts_dir); + needs_chmod = TRUE; file = _wfopen( location, L"wb" ); if (file == NULL) From ea83a7fcfa2fa419aaebcb7fd58db0318aea29ab Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 19 Jun 2023 17:47:02 +0300 Subject: [PATCH 0035/1506] winemenubuilder: User raw exe path in the created .desktop files. We don't need the magic wine/prefix invocations. CW-Bug-Id: #20433 --- programs/winemenubuilder/winemenubuilder.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index a7374bbda27..ca92810c421 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1286,13 +1286,8 @@ static BOOL write_desktop_entry(const WCHAR *link, const WCHAR *location, const fprintf(file, "[Desktop Entry]\n"); fprintf(file, "Name=%s\n", wchars_to_utf8_chars(name)); fprintf(file, "Exec=" ); - if (prefix) - { - char *path = wine_get_unix_file_name( prefix ); - fprintf(file, "env WINEPREFIX=\"%s\" ", path); - heap_free( path ); - } - fprintf(file, "wine %s", escape(path)); + + fprintf(file, "%s", escape(path)); if (args) fprintf(file, " %s", escape(args) ); fputc( '\n', file ); fprintf(file, "Type=Application\n"); From be83a17c01afe2ecb1f0d2bb20a3a45fabd433f8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 19 Jun 2023 17:48:37 +0300 Subject: [PATCH 0036/1506] winemenubuilder: Don't create menu entries. CW-Bug-Id: #20433 --- programs/winemenubuilder/winemenubuilder.c | 100 --------------------- 1 file changed, 100 deletions(-) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index ca92810c421..b05cafdfd7a 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1319,100 +1319,6 @@ static BOOL write_desktop_entry(const WCHAR *link, const WCHAR *location, const return TRUE; } -static BOOL write_directory_entry(const WCHAR *directory, const WCHAR *location) -{ - FILE *file; - - WINE_TRACE("(%s,%s)\n", wine_dbgstr_w(directory), wine_dbgstr_w(location)); - - file = _wfopen( location, L"wb" ); - if (file == NULL) - return FALSE; - - fprintf(file, "[Desktop Entry]\n"); - fprintf(file, "Type=Directory\n"); - if (wcscmp(directory, L"wine") == 0) - { - fprintf(file, "Name=Wine\n"); - fprintf(file, "Icon=wine\n"); - } - else - { - fprintf(file, "Name=%s\n", wchars_to_utf8_chars(directory)); - fprintf(file, "Icon=folder\n"); - } - - fclose(file); - return TRUE; -} - -static BOOL write_menu_file(const WCHAR *windows_link, const WCHAR *link) -{ - WCHAR tempfilename[MAX_PATH]; - FILE *tempfile = NULL; - WCHAR *filename, *lastEntry, *menuPath; - int i; - int count = 0; - BOOL ret = FALSE; - - WINE_TRACE("(%s)\n", wine_dbgstr_w(link)); - - GetTempFileNameW( xdg_menu_dir, L"mnu", 0, tempfilename ); - if (!(tempfile = _wfopen( tempfilename, L"wb" ))) return FALSE; - - fprintf(tempfile, "\n"); - fprintf(tempfile, "

\n"); - fprintf(tempfile, " Applications\n"); - - filename = heap_wprintf(L"wine\\%s.desktop", link); - lastEntry = filename; - for (i = 0; filename[i]; i++) - { - if (filename[i] == '\\') - { - WCHAR *dir_file_name; - const char *prefix = count ? "" : "wine-"; - - filename[i] = 0; - fprintf(tempfile, " \n"); - fprintf(tempfile, " %s%s\n", - prefix, wchars_to_xml_text(filename)); - fprintf(tempfile, " %s%s.directory\n", - prefix, wchars_to_xml_text(filename)); - dir_file_name = heap_wprintf(L"%s\\desktop-directories\\%s%s.directory", - xdg_data_dir, count ? L"" : L"wine-", filename); - if (GetFileAttributesW( dir_file_name ) == INVALID_FILE_ATTRIBUTES) - write_directory_entry(lastEntry, dir_file_name); - free(dir_file_name); - filename[i] = '-'; - lastEntry = &filename[i+1]; - ++count; - } - } - filename[i] = 0; - - fprintf(tempfile, " \n"); - fprintf(tempfile, " %s\n", wchars_to_xml_text(filename)); - fprintf(tempfile, " \n"); - for (i = 0; i < count; i++) - fprintf(tempfile, " \n"); - fprintf(tempfile, "\n"); - - menuPath = heap_wprintf(L"%s\\%s", xdg_menu_dir, filename); - lstrcpyW(menuPath + lstrlenW(menuPath) - lstrlenW(L".desktop"), L".menu"); - - fclose(tempfile); - ret = MoveFileExW( tempfilename, menuPath, MOVEFILE_REPLACE_EXISTING ); - if (ret) - register_menus_entry(menuPath, windows_link); - else - DeleteFileW( tempfilename ); - free(filename); - free(menuPath); - return ret; -} - static BOOL write_menu_entry(const WCHAR *windows_link, const WCHAR *link, const WCHAR *path, const WCHAR *args, const WCHAR *descr, const WCHAR *workdir, const WCHAR *icon, const WCHAR *wmclass) { @@ -1442,12 +1348,6 @@ static BOOL write_menu_entry(const WCHAR *windows_link, const WCHAR *link, const goto end; } - if (!write_menu_file(windows_link, link)) - { - WINE_WARN("couldn't make menu file %s\n", wine_dbgstr_w(filename)); - ret = FALSE; - } - end: free(desktopPath); free(filename); From 1191920363ea024b5a7c43774e709ae6581c74bb Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 19 Jun 2023 17:49:13 +0300 Subject: [PATCH 0037/1506] winemenubuilder: Save icons in c:\proton_shortcuts\icons\ CW-Bug-Id: #20433 --- programs/winemenubuilder/winemenubuilder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index b05cafdfd7a..6d34fa687ad 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1082,7 +1082,8 @@ static HRESULT platform_write_icon(IStream *icoStream, ICONDIRENTRY *iconDirEntr LARGE_INTEGER zero; *nativeIdentifier = compute_native_identifier(exeIndex, icoPathW, destFilename); - iconsDir = heap_wprintf(L"%s\\icons\\hicolor", xdg_data_dir); + iconsDir = heap_wprintf(L"%s", L"c:\\proton_shortcuts\\icons"); + create_directories(iconsDir); for (i = 0; i < numEntries; i++) { From cfb5d6783662432e0bdb2d3a8d85af3c1f3bf47b Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 19 Jun 2023 16:28:01 +0300 Subject: [PATCH 0038/1506] wine.inf: Don't use winemenubuilder to create filetype associations. CW-Bug-Id: #20433 --- loader/wine.inf.in | 1 - 1 file changed, 1 deletion(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index cb3f9562a92..18e492e2dda 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2500,7 +2500,6 @@ StartType=3 ErrorControl=1 [Services] -HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r" HKLM,"System\CurrentControlSet\Services\Eventlog\Application",,16 HKLM,"System\CurrentControlSet\Services\Eventlog\System","Sources",0x10000,"" HKLM,"System\CurrentControlSet\Services\Tcpip\Parameters","DataBasePath",,"%12%\etc" From 265fa9da4fb635c684db88a5711bc2c417ccf41b Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 29 Mar 2018 11:09:53 -0500 Subject: [PATCH 0039/1506] HACK: proton: wine.inf: Add native,builtin overrides for msvcrt DLLs. Squashed with: wine.inf: Set msvcp140_atomic_wait to native,builtin. --- loader/wine.inf.in | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 18e492e2dda..e8b038f448e 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2728,3 +2728,31 @@ HKLM,Software\Wow6432Node\Valve\Steam,"InstallPath",,"%16422%\Steam" [ProtonOverrides] HKLM,Software\Khronos\OpenXR\1,"ActiveRuntime",,"C:\openxr\wineopenxr64.json" +;;Likely want *80 and *90 too, but those require removing Wine's manifest files. +HKCU,Software\Wine\DllOverrides,"atl100",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcp100",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcr100",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"vcomp100",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"atl110",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcp110",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcr110",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"vcomp110",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"atl120",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcp120",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcr120",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"vcomp120",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-conio-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-heap-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-locale-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-math-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-runtime-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-stdio-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"api-ms-win-crt-time-l1-1-0",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"atl140",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"concrt140",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcp140",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcp140_atomic_wait",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"msvcr140",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"ucrtbase",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"vcomp140",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"vcruntime140",0x2,"native,builtin" From ef36c8b5d4a39ab935cc8cb3890524f930420676 Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Fri, 26 Apr 2019 20:40:31 +0200 Subject: [PATCH 0040/1506] HACK: proton: winex11: Fill WM_CLASS based on Steam appid. Some desktop environments (Gnome 3, Cinnamon) decide on an application icon in the following order: - If the first string in WM_CLASS property can be correlated to a name or StartupWMClass key in a .desktop entry file, then the associated icon will be used. - If the second string in WM_CLASS property can be correlated to a name or StartupWMClass key in a .desktop entry file, then the associated icon will be used. - If the application has indicated an icon resource through WM_HINTS property, then the associated X window or pixmaps will be used. Upstream Wine usually deals with this by placing a .desktop file with StartupWMClass filled to match first string in WM_CLASS property (which is the name of exe file being run). Wine in Proton does not do it, but still puts "Wine" as second string, therefore desktop environment can't differentiate between Wine in Proton and Wine installed in OS. By replacing "Wine" with "steam_app_" we force DE to fallback to icon indicated by WM_HINTS (ico file embedded in exe file). Steam can override this behaviour by installing properly crafted .desktop entry file. If SteamAppId environment variable is missing, then generic "steam_proton" name is used instead. --- dlls/winex11.drv/window.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a9d6dbf1121..1fab6b84d52 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -868,8 +868,19 @@ static void set_initial_wm_hints( Display *display, Window window ) /* class hints */ if ((class_hints = XAllocClassHint())) { - class_hints->res_name = process_name; - class_hints->res_class = process_name; + static char steam_proton[] = "steam_proton"; + const char *app_id = getenv("SteamAppId"); + char proton_app_class[128]; + + if(app_id && *app_id){ + snprintf(proton_app_class, sizeof(proton_app_class), "steam_app_%s", app_id); + class_hints->res_name = proton_app_class; + class_hints->res_class = proton_app_class; + }else{ + class_hints->res_name = steam_proton; + class_hints->res_class = steam_proton; + } + XSetClassHint( display, window, class_hints ); XFree( class_hints ); } From c08ed66d0b3d7d3276a8fa0c0d88e2a785ba8328 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 6 Aug 2018 08:06:03 -0500 Subject: [PATCH 0041/1506] HACK: proton: server: Set default timeout to 0 The Steam client will be waiting for the wineserver to exit to set up some environment variables, so make it wait as short as possible. --- server/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.c b/server/main.c index 1248b92f24d..efddef7f715 100644 --- a/server/main.c +++ b/server/main.c @@ -38,7 +38,7 @@ /* command-line options */ int debug_level = 0; int foreground = 0; -timeout_t master_socket_timeout = 3 * -TICKS_PER_SEC; /* master socket timeout, default is 3 seconds */ +timeout_t master_socket_timeout = 0; /* master socket timeout, default is 3 seconds */ const char *server_argv0; /* parse-line args */ From cbb9afcbf642d2f1b0a6bb9ea14d37174571e5e0 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 20 Aug 2018 10:58:09 -0500 Subject: [PATCH 0042/1506] HACK: proton: secur32: Return real Unix username from GetUserNameEx(NameDisplay) --- dlls/secur32/secur32.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/secur32/secur32.c b/dlls/secur32/secur32.c index f757ea6d34f..deae7f1a60d 100644 --- a/dlls/secur32/secur32.c +++ b/dlls/secur32/secur32.c @@ -1158,9 +1158,22 @@ BOOLEAN WINAPI GetUserNameExW( return FALSE; } + case NameDisplay: + { + static const WCHAR wineusernameW[] = {'W','I','N','E','U','S','E','R','N','A','M','E',0}; + + DWORD needed = GetEnvironmentVariableW(wineusernameW, NULL, 0); + if (*nSize < needed) { + *nSize = needed; + SetLastError(ERROR_MORE_DATA); + return FALSE; + } + *nSize = GetEnvironmentVariableW(wineusernameW, lpNameBuffer, *nSize); + return TRUE; + } + case NameUnknown: case NameFullyQualifiedDN: - case NameDisplay: case NameUniqueId: case NameCanonical: case NameUserPrincipal: From 3fa1b4ea2e5e29cd1502c6299a96de40ecbf1a1d Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 24 Sep 2018 12:37:49 -0500 Subject: [PATCH 0043/1506] HACK: proton: dbghelp: Disable DWARF parsing. Patch by Zeb. Our DWARF parser has been known to crash winedbg in some cases. Since probably no concerned parties are going to be using plain winedbg, just don't bother parsing anything. --- dlls/dbghelp/dwarf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 332c3da1059..56a8b93eb9b 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -4205,6 +4205,11 @@ BOOL dwarf2_parse(struct module* module, ULONG_PTR load_offset, struct module_format* dwarf2_modfmt; dwarf2_parse_module_context_t module_ctx; +/* Our DWARF parser has been known to crash winedbg in some cases. Since + * probably no concerned parties are going to be using plain winedbg, just don't + * bother parsing anything. */ +return FALSE; + if (!dwarf2_init_section(&eh_frame, fmap, ".eh_frame", NULL, &eh_frame_sect)) /* lld produces .eh_fram to avoid generating a long name */ dwarf2_init_section(&eh_frame, fmap, ".eh_fram", NULL, &eh_frame_sect); From c527500c0d89482d961c8b7a98123147c4c31fea Mon Sep 17 00:00:00 2001 From: Sven Baars Date: Thu, 5 Dec 2019 13:48:38 +0100 Subject: [PATCH 0044/1506] HACK: proton: ntdll: Return a handle to kernel32 when being asked for mfc42. For some applications mfc42 is loaded, but never actually used. We can add Steam game IDs when we find more of such applications. --- dlls/ntdll/loader.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 1e60825b525..6fed926eeff 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3176,6 +3176,44 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING * return status; } + +static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub ) +{ + while (*str) + { + const WCHAR *p1 = str, *p2 = sub; + while (*p1 && *p2 && tolower(*p1) == tolower(*p2)) { p1++; p2++; } + if (!*p2) return (WCHAR *)str; + str++; + } + return NULL; +} + +static WCHAR *get_env( const WCHAR *var ) +{ + UNICODE_STRING name, value; + + RtlInitUnicodeString( &name, var ); + value.Length = 0; + value.MaximumLength = 0; + value.Buffer = NULL; + + if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) == STATUS_BUFFER_TOO_SMALL) { + + value.Buffer = RtlAllocateHeap( GetProcessHeap(), 0, value.Length + sizeof(WCHAR) ); + value.MaximumLength = value.Length; + + if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) == STATUS_SUCCESS) { + value.Buffer[value.Length / sizeof(WCHAR)] = 0; + return value.Buffer; + } + + RtlFreeHeap( GetProcessHeap(), 0, value.Buffer ); + } + + return NULL; +} + /*********************************************************************** * find_dll_file * @@ -3233,6 +3271,26 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI done: RtlFreeHeap( GetProcessHeap(), 0, fullname ); if (wow64_old_value) RtlWow64EnableFsRedirectionEx( 1, &wow64_old_value ); + + if (status != STATUS_SUCCESS) + { + /* HACK for Proton issue #17 + * + * Some games try to load mfc42.dll, but then proceed to not use it. + * Just return a handle to kernel32 in that case. + */ + WCHAR *sgi = get_env( L"SteamGameId" ); + if (sgi) + { + if (!wcscmp( sgi, L"105450") && + strstriW( libname, L"mfc42" )) + { + WARN_(loaddll)( "Using a fake mfc42 handle\n" ); + status = find_dll_file( load_path, L"kernel32.dll", nt_name, pwm, mapping, image_info, id ); + } + RtlFreeHeap(GetProcessHeap(), 0, sgi); + } + } return status; } From acafad6d542eab1ac2e5a571c46742ea4feccb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 11:08:22 +0100 Subject: [PATCH 0045/1506] HACK: proton: ntdll: Export a function to set a Unix environment variable --- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/unix/env.c | 10 ++++++++++ dlls/wow64/system.c | 12 ++++++++++++ include/winternl.h | 1 + 4 files changed, 24 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 1908a089d44..850299f22ee 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1716,6 +1716,7 @@ @ extern -private __wine_syscall_dispatcher @ extern -private __wine_unix_call_dispatcher @ extern -private __wine_unixlib_handle +@ stdcall -syscall __wine_set_unix_env(ptr ptr) # Debugging @ stdcall -norelay __wine_dbg_write(ptr long) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index ad9ab0dc220..e957b3a38ee 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -2467,3 +2467,13 @@ void WINAPI RtlSetLastWin32Error( DWORD err ) #endif teb->LastErrorValue = err; } + + +/********************************************************************** + * __wine_set_unix_env (ntdll.so) + */ +NTSTATUS WINAPI __wine_set_unix_env( const char *var, const char *val ) +{ + setenv(var, val, 1); + return 0; +} diff --git a/dlls/wow64/system.c b/dlls/wow64/system.c index 7130039e07a..35032d31cfc 100644 --- a/dlls/wow64/system.c +++ b/dlls/wow64/system.c @@ -809,3 +809,15 @@ NTSTATUS WINAPI wow64_NtWow64GetNativeSystemInformation( UINT *args ) return STATUS_INVALID_INFO_CLASS; } } + + +/********************************************************************** + * wow64___wine_set_unix_env + */ +NTSTATUS WINAPI wow64___wine_set_unix_env( UINT *args ) +{ + const char *var = get_ptr( &args ); + const char *val = get_ptr( &args ); + + return __wine_set_unix_env( var, val ); +} diff --git a/include/winternl.h b/include/winternl.h index ff8756211a1..627767cff33 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -5087,6 +5087,7 @@ NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PC /* Wine internal functions */ +NTSYSAPI NTSTATUS WINAPI __wine_set_unix_env( const char *var, const char *val ); NTSYSAPI NTSTATUS WINAPI wine_nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char *nameA, ULONG *size, UINT disposition ); NTSYSAPI NTSTATUS WINAPI wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, ULONG *size ); From 4b12a2b88cfd126e88777bd7c58416f38a1e5f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 18 Dec 2019 13:49:00 +0100 Subject: [PATCH 0046/1506] HACK: proton: ntdll: Strip gameoverlayrenderer.so from LD_PRELOAD before executing explorer.exe. Work around a bug in gameoverlayrenderer which introduces 50ms hangs during XCheckIfEvent after approx 40 minutes of gameplay. The original user32 hack broke Steam overlay in Origin games, and Steam Input consequently. This ntdll implementation should be safer as it'll modify the environment after the new process has started forking. Link: https://github.com/ValveSoftware/Proton/issues/3316 CW-Bug-Id: #18946 --- dlls/ntdll/unix/loader.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 49876d2d054..16df88bbc26 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -548,11 +548,42 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_i WORD machine = pe_info->machine; ULONGLONG res_start = pe_info->base; ULONGLONG res_end = pe_info->base + pe_info->map_size; + const char *ld_preload = getenv( "LD_PRELOAD" ); char preloader_reserve[64], socket_env[64]; if (pe_info->wine_fakedll) res_start = res_end = 0; if (pe_info->image_flags & IMAGE_FLAGS_ComPlusNativeReady) machine = native_machine; + /* HACK: Unset LD_PRELOAD before executing explorer.exe to disable buggy gameoverlayrenderer.so */ + if (ld_preload && argv[2] && !strcmp( argv[2], "C:\\windows\\system32\\explorer.exe" ) && + argv[3] && !strcmp( argv[3], "/desktop" )) + { + static char const gorso[] = "gameoverlayrenderer.so"; + static int gorso_len = sizeof(gorso) - 1; + int len = strlen( ld_preload ); + char *next, *tmp, *env = malloc( sizeof("LD_PRELOAD=") + len ); + + if (!env) return STATUS_NO_MEMORY; + strcpy( env, "LD_PRELOAD=" ); + strcat( env, ld_preload ); + + tmp = env + 11; + do + { + if (!(next = strchr( tmp, ':' ))) next = tmp + strlen( tmp ); + if (next - tmp >= gorso_len && strncmp( next - gorso_len, gorso, gorso_len ) == 0) + { + if (*next) memmove( tmp, next + 1, strlen(next) ); + else *tmp = 0; + next = tmp; + } + else tmp = next + 1; + } + while (*next); + + putenv( env ); + } + signal( SIGPIPE, SIG_DFL ); snprintf( socket_env, sizeof(socket_env), "WINESERVERSOCKET=%u", socketfd ); From ec560a4daf6847b77f89a2e139cbed293a04a1de Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 Nov 2021 18:07:13 +0300 Subject: [PATCH 0047/1506] HACK: ntdll: Enable WINESTEAMNOEXEC for Mafia II. CW-Bug-Id: #19605 --- dlls/ntdll/unix/loader.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 16df88bbc26..9c6fc0f2cc7 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1918,6 +1918,18 @@ static ULONG_PTR get_image_address(void) return 0; } +static void hacks_init(void) +{ + const char *sgi = getenv( "SteamGameId" ); + + switch (sgi ? atoi( sgi ) : -1) + { + case 50130: /* Mafia II */ + setenv( "WINESTEAMNOEXEC", "1", 0 ); + break; + } +} + /*********************************************************************** * start_main_thread */ @@ -1929,6 +1941,7 @@ static void start_main_thread(void) signal_alloc_thread( teb ); dbg_init(); startup_info_size = server_init_process(); + hacks_init(); virtual_map_user_shared_data(); init_cpu_info(); init_files(); From 5d84e095cea1102ebefb2138321ff8387f06789f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 24 Jun 2022 13:03:05 -0500 Subject: [PATCH 0048/1506] HACK: ntdll: Enable WINESTEAMNOEXEC for CoD Black Ops II Multiplayer and Zombies. CW-Bug-Id: #20869 --- dlls/ntdll/unix/loader.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 9c6fc0f2cc7..a4246beeb90 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1925,6 +1925,8 @@ static void hacks_init(void) switch (sgi ? atoi( sgi ) : -1) { case 50130: /* Mafia II */ + case 202990: /* CoD Black Ops II Multiplayer */ + case 212910: /* CoD Black Ops II Zombies */ setenv( "WINESTEAMNOEXEC", "1", 0 ); break; } From d32ab6889db31f26302fd976a8114421abfc2801 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 14 Apr 2023 20:20:21 -0600 Subject: [PATCH 0049/1506] HACK: ntdll: Enable WINESTEAMNOEXEC for Madballs in Babo: Invasion. CW-Bug-Id: #22137 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index a4246beeb90..34acbbd4f33 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1924,6 +1924,7 @@ static void hacks_init(void) switch (sgi ? atoi( sgi ) : -1) { + case 25700: /* Madballs in Babo: Invasion */ case 50130: /* Mafia II */ case 202990: /* CoD Black Ops II Multiplayer */ case 212910: /* CoD Black Ops II Zombies */ From 2f3f5a87e58fdcf79ec356e10eb5c24082aacbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 19:50:28 +0100 Subject: [PATCH 0050/1506] HACK: proton: winex11: Add window manager detection code. --- dlls/winex11.drv/window.c | 93 ++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 7 +++ dlls/winex11.drv/x11drv_main.c | 4 ++ include/ntuser.h | 20 ++++++++ 4 files changed, 124 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1fab6b84d52..e68c4abdf93 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -113,6 +113,97 @@ static const WCHAR clip_window_prop[] = static pthread_mutex_t win_data_mutex = PTHREAD_MUTEX_INITIALIZER; +static int handle_wm_name_badwindow_error( Display *dpy, XErrorEvent *event, void *arg ) +{ + if (event->error_code == BadWindow) + { + WARN( "BadWindow error when reading WM name from window %lx, ignoring.\n", event->resourceid ); + return 1; + } + + return 0; +} + +static int detect_wm(Display *dpy) +{ + Display *display = dpy ? dpy : thread_init_display(); /* DefaultRootWindow is a macro... */ + Window root = DefaultRootWindow(display), *wm_check; + Atom type; + int format, err; + unsigned long count, remaining; + char *wm_name; + + static int cached = -1; + + if(cached < 0){ + + if (XGetWindowProperty( display, root, x11drv_atom(_NET_SUPPORTING_WM_CHECK), 0, + sizeof(*wm_check)/sizeof(CARD32), False, x11drv_atom(WINDOW), + &type, &format, &count, &remaining, (unsigned char **)&wm_check ) == Success){ + if (type == x11drv_atom(WINDOW)){ + /* The window returned by _NET_SUPPORTING_WM_CHECK might be stale, + so we may get errors when asking for its properties */ + X11DRV_expect_error( display, handle_wm_name_badwindow_error, NULL ); + err = XGetWindowProperty( display, *wm_check, x11drv_atom(_NET_WM_NAME), 0, + 256/sizeof(CARD32), False, x11drv_atom(UTF8_STRING), + &type, &format, &count, &remaining, (unsigned char **)&wm_name); + + if (X11DRV_check_error() || err != Success || type != x11drv_atom(UTF8_STRING)){ + X11DRV_expect_error( display, handle_wm_name_badwindow_error, NULL ); + err = XGetWindowProperty( display, *wm_check, x11drv_atom(WM_NAME), 0, + 256/sizeof(CARD32), False, x11drv_atom(STRING), + &type, &format, &count, &remaining, (unsigned char **)&wm_name); + + if (X11DRV_check_error() || err != Success || type != x11drv_atom(STRING)) + wm_name = NULL; + } + + if(wm_name){ + TRACE("Got WM name %s\n", wm_name); + + if((strcmp(wm_name, "GNOME Shell") == 0) || + (strcmp(wm_name, "Mutter") == 0)) + cached = WINE_WM_X11_MUTTER; + else if(strcmp(wm_name, "steamcompmgr") == 0) + cached = WINE_WM_X11_STEAMCOMPMGR; + else if(strcmp(wm_name, "KWin") == 0) + cached = WINE_WM_X11_KDE; + else + cached = WINE_WM_UNKNOWN; + + XFree(wm_name); + }else{ + TRACE("WM did not set _NET_WM_NAME or WM_NAME\n"); + cached = WINE_WM_UNKNOWN; + } + }else + cached = WINE_WM_UNKNOWN; + + XFree(wm_check); + }else + cached = WINE_WM_UNKNOWN; + + __wine_set_window_manager(cached); + } + + return cached; +} + +BOOL wm_is_mutter(Display *display) +{ + return detect_wm(display) == WINE_WM_X11_MUTTER; +} + +BOOL wm_is_kde(Display *display) +{ + return detect_wm(display) == WINE_WM_X11_KDE; +} + +BOOL wm_is_steamcompmgr(Display *display) +{ + return detect_wm(display) == WINE_WM_X11_STEAMCOMPMGR; +} + /*********************************************************************** * http://standards.freedesktop.org/startup-notification-spec */ @@ -1954,6 +2045,8 @@ void X11DRV_SetDesktopWindow( HWND hwnd ) { unsigned int width, height; + detect_wm( gdi_display ); + /* retrieve the real size of the desktop */ SERVER_START_REQ( get_window_rectangles ) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index c80e4b3d3c9..6fae6aa79a2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -475,6 +475,7 @@ enum x11drv_atoms XATOM_TEXT, XATOM_TIMESTAMP, XATOM_UTF8_STRING, + XATOM_STRING, XATOM_RAW_ASCENT, XATOM_RAW_DESCENT, XATOM_RAW_CAP_HEIGHT, @@ -482,6 +483,7 @@ enum x11drv_atoms XATOM_Rel_Y, XATOM_WM_PROTOCOLS, XATOM_WM_DELETE_WINDOW, + XATOM_WM_NAME, XATOM_WM_STATE, XATOM_WM_TAKE_FOCUS, XATOM_DndProtocol, @@ -492,6 +494,7 @@ enum x11drv_atoms XATOM__NET_STARTUP_INFO_BEGIN, XATOM__NET_STARTUP_INFO, XATOM__NET_SUPPORTED, + XATOM__NET_SUPPORTING_WM_CHECK, XATOM__NET_SYSTEM_TRAY_OPCODE, XATOM__NET_SYSTEM_TRAY_S0, XATOM__NET_SYSTEM_TRAY_VISUAL, @@ -543,6 +546,7 @@ enum x11drv_atoms XATOM_WCF_SYLK, XATOM_WCF_TIFF, XATOM_WCF_WAVE, + XATOM_WINDOW, XATOM_image_bmp, XATOM_image_gif, XATOM_image_jpeg, @@ -642,6 +646,9 @@ struct x11drv_win_data unsigned int icon_size; }; +extern BOOL wm_is_mutter(Display *); +extern BOOL wm_is_steamcompmgr(Display *); + extern struct x11drv_win_data *get_win_data( HWND hwnd ); extern void release_win_data( struct x11drv_win_data *data ); extern Window X11DRV_get_whole_window( HWND hwnd ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index d1f31081b09..1e3549ec725 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -139,6 +139,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "TEXT", "TIMESTAMP", "UTF8_STRING", + "STRING", "RAW_ASCENT", "RAW_DESCENT", "RAW_CAP_HEIGHT", @@ -146,6 +147,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "Rel Y", "WM_PROTOCOLS", "WM_DELETE_WINDOW", + "WM_NAME", "WM_STATE", "WM_TAKE_FOCUS", "DndProtocol", @@ -156,6 +158,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "_NET_STARTUP_INFO_BEGIN", "_NET_STARTUP_INFO", "_NET_SUPPORTED", + "_NET_SUPPORTING_WM_CHECK", "_NET_SYSTEM_TRAY_OPCODE", "_NET_SYSTEM_TRAY_S0", "_NET_SYSTEM_TRAY_VISUAL", @@ -207,6 +210,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "WCF_SYLK", "WCF_TIFF", "WCF_WAVE", + "WINDOW", "image/bmp", "image/gif", "image/jpeg", diff --git a/include/ntuser.h b/include/ntuser.h index f23249ace5a..876917af7d3 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1403,4 +1403,24 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show ) /* Wine extensions */ W32KAPI BOOL WINAPI __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); +/* HACK: We use some WM specific hacks in user32 and we need the user + * driver to export that information. */ + +#define WINE_WM_UNKNOWN 0 +#define WINE_WM_X11_MUTTER 1 +#define WINE_WM_X11_STEAMCOMPMGR 2 +#define WINE_WM_X11_KDE 3 + +static inline LONG_PTR __wine_get_window_manager(void) +{ + static const WCHAR __wine_window_managerW[] = {'_','_','w','i','n','e','_','w','i','n','d','o','w','_','m','a','n','a','g','e','r',0}; + return (LONG_PTR)NtUserGetProp(NtUserGetDesktopWindow(), __wine_window_managerW); +} + +static inline void __wine_set_window_manager(LONG_PTR window_manager) +{ + static const WCHAR __wine_window_managerW[] = {'_','_','w','i','n','e','_','w','i','n','d','o','w','_','m','a','n','a','g','e','r',0}; + NtUserSetProp(NtUserGetDesktopWindow(), __wine_window_managerW, (HANDLE)window_manager); +} + #endif /* _NTUSER_ */ From 4343824f37a2cc4369fe090a7a08c2dc0c2bbca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 11 Jan 2023 18:42:15 +0100 Subject: [PATCH 0051/1506] HACK: ntdll: Ignore unsupported Unix locales and initialize regardless. We shouldn't rely very much on Unix locale anymore, and not having the Unix locale configured shouldn't prevent us from running applications in a localized Windows environment if they need it. CW-Bug-Id: #21346 --- dlls/ntdll/unix/env.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index e957b3a38ee..da854ca52d1 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -59,6 +59,7 @@ #include "error.h" WINE_DEFAULT_DEBUG_CHANNEL(environ); +WINE_DECLARE_DEBUG_CHANNEL(nls); PEB *peb = NULL; WOW_PEB *wow_peb = NULL; @@ -275,13 +276,14 @@ static const struct { const char *name; UINT cp; } charset_names[] = static void init_unix_codepage(void) { + const char *name, *ctype; char charset_name[16]; - const char *name; size_t i, j; int min = 0, max = ARRAY_SIZE(charset_names) - 1; - setlocale( LC_CTYPE, "" ); - if (!(name = nl_langinfo( CODESET ))) return; + if (!(ctype = setlocale( LC_CTYPE, "" ))) name = "UTF-8"; + else if (!(name = nl_langinfo( CODESET ))) return; + TRACE_(nls)( "Unix LC_CTYPE %s, using %s codeset\n", debugstr_a(ctype), debugstr_a(name) ); /* remove punctuation characters from charset name */ for (i = j = 0; name[i] && j < sizeof(charset_name)-1; i++) @@ -797,13 +799,22 @@ static const NLS_LOCALE_DATA *get_win_locale( const NLS_LOCALE_HEADER *header, c static void init_locale(void) { struct locale_nls_header *header; + const char *all, *ctype, *messages; const NLS_LOCALE_HEADER *locale_table; const NLS_LOCALE_DATA *locale; char *p; - setlocale( LC_ALL, "" ); - if (!unix_to_win_locale( setlocale( LC_CTYPE, NULL ), system_locale )) system_locale[0] = 0; - if (!unix_to_win_locale( setlocale( LC_MESSAGES, NULL ), user_locale )) user_locale[0] = 0; + if (!(all = setlocale( LC_ALL, "" )) && (all = getenv( "LC_ALL" ))) + FIXME_(nls)( "Failed to set LC_ALL to %s, is the locale supported?\n", debugstr_a(all) ); + if (!(ctype = setlocale( LC_CTYPE, "" )) && (ctype = getenv( "LC_CTYPE" ))) + FIXME_(nls)( "Failed to set LC_CTYPE to %s, is the locale supported?\n", debugstr_a(ctype) ); + if (!(messages = setlocale( LC_MESSAGES, "" )) && (messages = getenv( "LC_MESSAGES" ))) + FIXME_(nls)( "Failed to set LC_MESSAGES to %s, is the locale supported?\n", debugstr_a(messages) ); + + if (!unix_to_win_locale( ctype, system_locale )) system_locale[0] = 0; + TRACE_(nls)( "Unix LC_CTYPE is %s, setting system locale to %s\n", debugstr_a(ctype), debugstr_a(user_locale) ); + if (!unix_to_win_locale( messages, user_locale )) user_locale[0] = 0; + TRACE_(nls)( "Unix LC_MESSAGES is %s, user system locale to %s\n", debugstr_a(messages), debugstr_a(user_locale) ); #ifdef __APPLE__ if (!system_locale[0]) From efd1f5db6589c7843a30fdde55b13b8c53ffb073 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 10 Sep 2020 11:07:01 -0500 Subject: [PATCH 0052/1506] HACK: ntdll: Don't let applications change permissions on wine's files The 2019 VCRuntime installer will chmod a+w on files that it can't open for writing, which would leak through the library symlinks and modify the global installation. --- dlls/ntdll/unix/file.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index ee68e4dee9b..4664380d2c0 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1619,9 +1619,24 @@ static int fd_set_dos_attrib( int fd, UINT attr, BOOL force_set ) else return xattr_fremove( fd, SAMBA_XATTR_DOS_ATTRIB ); } +static unsigned int server_get_unix_name( HANDLE handle, char **unix_name ); + +/* return TRUE if this is a file owned by Wine which applications should not try to mess with. */ +static BOOL is_wine_file( HANDLE handle ) +{ + char *unix_name; + BOOL ret; + + if (server_get_unix_name( handle, &unix_name )) + return FALSE; + ret = strstr(unix_name, "/lib/wine/" ) || strstr( unix_name, "/lib64/wine/" ) ||strstr( unix_name, "/share/wine/" ); + free(unix_name); + return ret; +} + /* set the stat info and file attributes for a file (by file descriptor) */ -static NTSTATUS fd_set_file_info( int fd, UINT attr, BOOL force_set_xattr ) +static NTSTATUS fd_set_file_info( int fd, HANDLE handle, UINT attr, BOOL force_set_xattr ) { struct stat st; @@ -1635,8 +1650,16 @@ static NTSTATUS fd_set_file_info( int fd, UINT attr, BOOL force_set_xattr ) } else { - /* add write permission only where we already have read permission */ - st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask); + if (is_wine_file( handle )) + { + TRACE("HACK: Not giving write permission to wine file!\n"); + return STATUS_ACCESS_DENIED; + } + else + { + /* add write permission only where we already have read permission */ + st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask); + } } if (fchmod( fd, st.st_mode ) == -1) return errno_to_status( errno ); @@ -4592,8 +4615,8 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, status = set_file_times( fd, &mtime, &atime ); if (status == STATUS_SUCCESS) - status = fd_set_file_info( fd, info->FileAttributes, - unix_name && is_hidden_file( unix_name )); + status = fd_set_file_info( fd, handle, info->FileAttributes, + unix_name && is_hidden_file( unix_name ) ); if (needs_close) close( fd ); free( unix_name ); From 2d8ae42af1a10fa3a2a03ee29e28cc930f06e338 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 22 Jul 2021 16:11:18 -0500 Subject: [PATCH 0053/1506] HACK: shell32: Update knownfolder paths in the registry Guilty Gear Strive requires that the path be in the new format. Since we haven't yet found a game that has a problem with the new format, let's just use that in all cases. For Steam cloud sync failures. CW-Bug-Id: #18905 --- dlls/shell32/shellpath.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index fc62f760e05..fce9f522dab 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -2881,6 +2881,8 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen) { + static const WCHAR WineVistaPathsW[] = {'_','_','W','i','n','e','V','i','s','t','a','P','a','t','h','s',0}; + const WCHAR *szValueName; WCHAR buffer[40]; UINT i; @@ -2889,6 +2891,7 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, HKEY hUserKey = NULL, hKey = NULL; DWORD dwType, dwPathLen; LONG ret; + DWORD already_vista_paths = 0; TRACE("%p,%p,%s,%p,%u\n", hRootKey, hToken, debugstr_w(szUserShellFolderPath), folders, foldersLen); @@ -2902,6 +2905,12 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, if (ret) hr = HRESULT_FROM_WIN32(ret); } + + /* check if the registry has already been updated to the vista+ style paths */ + dwPathLen = sizeof(already_vista_paths); + RegQueryValueExW(hUserKey, WineVistaPathsW, NULL, &dwType, + (LPBYTE)&already_vista_paths, &dwPathLen); + for (i = 0; SUCCEEDED(hr) && i < foldersLen; i++) { dwPathLen = MAX_PATH * sizeof(WCHAR); @@ -2914,9 +2923,10 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, szValueName = &buffer[0]; } - if (RegQueryValueExW(hUserKey, szValueName, NULL, - &dwType, (LPBYTE)path, &dwPathLen) || (dwType != REG_SZ && - dwType != REG_EXPAND_SZ)) + if (!already_vista_paths || + RegQueryValueExW(hUserKey, szValueName, NULL, &dwType, + (LPBYTE)path, &dwPathLen) || + (dwType != REG_SZ && dwType != REG_EXPAND_SZ)) { *path = '\0'; if (CSIDL_Data[folders[i]].type == CSIDL_Type_User) @@ -2957,6 +2967,11 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, hToken, SHGFP_TYPE_DEFAULT, path); } } + + already_vista_paths = 1; + RegSetValueExW(hUserKey, WineVistaPathsW, 0, REG_DWORD, + (LPBYTE)&already_vista_paths, sizeof(already_vista_paths)); + if (hUserKey) RegCloseKey(hUserKey); if (hKey) From 0e3df2477a2e0d110cfdb1f77bf56b7e4e396768 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 3 Feb 2022 11:35:13 -0600 Subject: [PATCH 0054/1506] HACK: shell32: Preserve duplicated Documents/Stuff directories --- dlls/shell32/shellpath.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index fce9f522dab..c384919fdc2 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3112,6 +3112,23 @@ static HRESULT create_extra_folders(void) hr = SHGetFolderPathAndSubDirW(0, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_DEFAULT, L"Microsoft\\Windows\\Themes", path); } + + + /* Proton HACK: In older Proton versions, duplicate Stuff directories were + * created at both %PROFILE%\Music and %PROFILE\Documents\Music. Due to + * some bugs when downgrading to those older Proton versions, create those + * missing Documents directories here, too. */ + SHGetFolderPathAndSubDirW(0, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, + SHGFP_TYPE_DEFAULT, L"Downloads", path); + SHGetFolderPathAndSubDirW(0, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, + SHGFP_TYPE_DEFAULT, L"Music", path); + SHGetFolderPathAndSubDirW(0, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, + SHGFP_TYPE_DEFAULT, L"Pictures", path); + SHGetFolderPathAndSubDirW(0, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, + SHGFP_TYPE_DEFAULT, L"Templates", path); + SHGetFolderPathAndSubDirW(0, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, + SHGFP_TYPE_DEFAULT, L"Videos", path); + return hr; } From 57d109c3467638eed20d1fbd5bde68c69b2d11fa Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 23 Sep 2019 13:29:16 -0500 Subject: [PATCH 0055/1506] HACK: dxdiag: Dump to stdout if no filename is given --- programs/dxdiag/main.c | 8 +++++++- programs/dxdiag/output.c | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/programs/dxdiag/main.c b/programs/dxdiag/main.c index b6ea5306d06..47909dcf2c6 100644 --- a/programs/dxdiag/main.c +++ b/programs/dxdiag/main.c @@ -72,7 +72,13 @@ static BOOL process_file_name(const WCHAR *cmdline, enum output_type output_type endptr = cmdline + lstrlenW(cmdline); len = endptr - cmdline; - if (len == 0 || len >= filename_len) + if (len == 0) + { + *filename = 0; + return TRUE; + } + + if (len >= filename_len) return FALSE; memcpy(filename, cmdline, len * sizeof(WCHAR)); diff --git a/programs/dxdiag/output.c b/programs/dxdiag/output.c index a8eb733ba4b..63d091395b0 100644 --- a/programs/dxdiag/output.c +++ b/programs/dxdiag/output.c @@ -149,8 +149,12 @@ static BOOL output_text_information(struct dxdiag_information *dxdiag_info, cons fill_system_text_output_table(dxdiag_info, output_table[0].fields); - hFile = CreateFileW(filename, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (filename && *filename) + hFile = CreateFileW(filename, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + else + hFile = GetStdHandle(STD_OUTPUT_HANDLE); + if (hFile == INVALID_HANDLE_VALUE) { WINE_ERR("File creation failed, last error %lu\n", GetLastError()); @@ -207,7 +211,7 @@ static HRESULT save_xml_document(IXMLDOMDocument *xmldoc, const WCHAR *filename) VARIANT destVar; HRESULT hr; - if (!bstr) + if (!bstr || !filename || !*filename) return E_OUTOFMEMORY; V_VT(&destVar) = VT_BSTR; From 17bd6d834e87b1c5ca66dcc445d1f0b1cfda3a24 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 30 Mar 2018 10:40:43 -0500 Subject: [PATCH 0056/1506] HACK: winedbg: When crash dialog is not shown, dump crash info to stderr Use the real unix stderr via __wine_dbg_output(). CW-Bug-Id: #21872 --- programs/winedbg/debugger.h | 1 + programs/winedbg/tgt_active.c | 3 +++ programs/winedbg/winedbg.c | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index c65b9bfae67..a7591c93a8e 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -311,6 +311,7 @@ extern DWORD dbg_curr_tid; extern dbg_ctx_t dbg_context; extern BOOL dbg_interactiveP; extern HANDLE dbg_houtput; +extern BOOL dbg_use_wine_dbg_output; struct dbg_internal_var { diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 17578857133..8766ee56b56 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -907,6 +907,9 @@ enum dbg_start dbg_active_auto(int argc, char* argv[]) if (event) thread = display_crash_details( event ); if (thread) dbg_houtput = output = create_temp_file(); break; + case TRUE: + dbg_use_wine_dbg_output = TRUE; + break; } input = parser_generate_command_file("echo Modules:", "info share", diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 92fa77429f6..7f11039d0c4 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -82,6 +82,7 @@ DWORD dbg_curr_pid = 0; dbg_ctx_t dbg_context; BOOL dbg_interactiveP = FALSE; HANDLE dbg_houtput = 0; +BOOL dbg_use_wine_dbg_output = FALSE; static struct list dbg_process_list = LIST_INIT(dbg_process_list); @@ -94,6 +95,12 @@ static void dbg_outputA(const char* buffer, int len) DWORD w, i; + if (dbg_use_wine_dbg_output) + { + __wine_dbg_output(buffer); + return; + } + while (len > 0) { unsigned int count = min( len, sizeof(line_buff) - line_pos ); From 023b76bcf361571dc10edd356aaad9f77a3da604 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 18 May 2021 13:34:47 -0500 Subject: [PATCH 0057/1506] HACK: proton: winedbg: Support dumping crash logs to a directory CW-Bug-Id: #18944 --- programs/winedbg/debugger.h | 1 + programs/winedbg/tgt_active.c | 45 +++++++++++++++++++++++++++++++++++ programs/winedbg/winedbg.c | 9 +++---- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index a7591c93a8e..74c935f42db 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -311,6 +311,7 @@ extern DWORD dbg_curr_tid; extern dbg_ctx_t dbg_context; extern BOOL dbg_interactiveP; extern HANDLE dbg_houtput; +extern HANDLE dbg_crash_report_file; extern BOOL dbg_use_wine_dbg_output; struct dbg_internal_var diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 8766ee56b56..23652b77726 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "debugger.h" #include "psapi.h" @@ -816,6 +818,48 @@ static HANDLE create_temp_file(void) NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, 0 ); } +static HANDLE create_crash_report_file(void) +{ + const char *dir = getenv("WINE_CRASH_REPORT_DIR"); + const char *sgi; + char timestr[32]; + char name[MAX_PATH], *c; + time_t t; + struct tm lt; + + if(!dir || dir[0] == 0) + return INVALID_HANDLE_VALUE; + + strcpy(name, dir); + + for(c = name + 1; *c; ++c){ + if(*c == '/'){ + *c = 0; + CreateDirectoryA(name, NULL); + *c = '/'; + } + } + CreateDirectoryA(name, NULL); + + sgi = getenv("SteamGameId"); + + t = time(NULL); + lt = *localtime(&t); + strftime(timestr, ARRAY_SIZE(timestr), "%Y-%m-%d_%H:%M:%S", <); + + /* /path/to/crash/reports/2021-05-18_13:21:15_appid-976310_crash.log */ + snprintf(name, ARRAY_SIZE(name), + "%s%s/%s_appid-%s_crash.log", + dir[0] == '/' ? "Z:/" : "", + dir, + timestr, + sgi ? sgi : "0" + ); + + return CreateFileA( name, GENERIC_WRITE, FILE_SHARE_READ, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 ); +} + /****************************************************************** * dbg_active_attach * @@ -909,6 +953,7 @@ enum dbg_start dbg_active_auto(int argc, char* argv[]) break; case TRUE: dbg_use_wine_dbg_output = TRUE; + dbg_crash_report_file = create_crash_report_file(); break; } diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 7f11039d0c4..7769d20481d 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -82,6 +82,7 @@ DWORD dbg_curr_pid = 0; dbg_ctx_t dbg_context; BOOL dbg_interactiveP = FALSE; HANDLE dbg_houtput = 0; +HANDLE dbg_crash_report_file = INVALID_HANDLE_VALUE; BOOL dbg_use_wine_dbg_output = FALSE; static struct list dbg_process_list = LIST_INIT(dbg_process_list); @@ -96,10 +97,7 @@ static void dbg_outputA(const char* buffer, int len) DWORD w, i; if (dbg_use_wine_dbg_output) - { __wine_dbg_output(buffer); - return; - } while (len > 0) { @@ -114,7 +112,10 @@ static void dbg_outputA(const char* buffer, int len) if (len > 0) i = line_pos; /* buffer is full, flush anyway */ else break; } - WriteFile(dbg_houtput, line_buff, i, &w, NULL); + if (!dbg_use_wine_dbg_output) + WriteFile(dbg_houtput, line_buff, i, &w, NULL); + if (dbg_crash_report_file != INVALID_HANDLE_VALUE) + WriteFile(dbg_crash_report_file, line_buff, i, &w, NULL); memmove( line_buff, line_buff + i, line_pos - i ); line_pos -= i; } From a3132b7d16ba96c5d7944bd55563eaf77f5baef9 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 17 May 2022 09:38:08 +0300 Subject: [PATCH 0058/1506] getminidump: Add a small tool to create minidumps. Signed-off-by: Nikolay Sivov --- configure.ac | 1 + programs/getminidump/Makefile.in | 7 ++++ programs/getminidump/main.c | 60 ++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 programs/getminidump/Makefile.in create mode 100644 programs/getminidump/main.c diff --git a/configure.ac b/configure.ac index 7eed4eb9233..6f16aef7795 100644 --- a/configure.ac +++ b/configure.ac @@ -3436,6 +3436,7 @@ WINE_CONFIG_MAKEFILE(programs/findstr) WINE_CONFIG_MAKEFILE(programs/findstr/tests) WINE_CONFIG_MAKEFILE(programs/fsutil) WINE_CONFIG_MAKEFILE(programs/fsutil/tests) +WINE_CONFIG_MAKEFILE(programs/getminidump) WINE_CONFIG_MAKEFILE(programs/hh) WINE_CONFIG_MAKEFILE(programs/hostname) WINE_CONFIG_MAKEFILE(programs/icacls) diff --git a/programs/getminidump/Makefile.in b/programs/getminidump/Makefile.in new file mode 100644 index 00000000000..56d148dfb9d --- /dev/null +++ b/programs/getminidump/Makefile.in @@ -0,0 +1,7 @@ +MODULE = getminidump.exe +IMPORTS = shcore dbghelp + +EXTRADLLFLAGS = -mwindows -municode + +SOURCES = \ + main.c diff --git a/programs/getminidump/main.c b/programs/getminidump/main.c new file mode 100644 index 00000000000..3cc5010797a --- /dev/null +++ b/programs/getminidump/main.c @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include + +#include +#include +#include + +int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, WCHAR *cmdline, int nCmdShow) +{ + HANDLE process, dumpfile; + WCHAR **argv, *ptr; + DWORD pid; + int argc; + BOOL ret; + + argv = CommandLineToArgvW(cmdline, &argc); + if (argc < 1) return 1; + + ptr = argv[0]; + if (ptr[0] == '0' && towlower(ptr[1]) == 'x') + pid = wcstoul(ptr, NULL, 16); + else + pid = wcstoul(ptr, NULL, 10); + + process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid); + if (!process) + return 2; + + dumpfile = CreateFileW(L"minidump.dmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (dumpfile == INVALID_HANDLE_VALUE) + { + CloseHandle(process); + return 3; + } + + ret = MiniDumpWriteDump(process, pid, dumpfile, MiniDumpNormal | MiniDumpWithFullMemory, NULL, NULL, NULL); + + CloseHandle(dumpfile); + CloseHandle(process); + + return ret ? 0 : 4; +} From 5bfb96e0cbb1b75a94386d7239be6e5379e0057d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Oct 2020 23:37:09 +0200 Subject: [PATCH 0059/1506] dotnetfx35.exe: Add stub program. This makes it possible to override native dotnetfx35 installer, which is broken in an unfixable way. Recent Windows versions also bypass its execution somehow. --- configure.ac | 1 + programs/dotnetfx35/Makefile.in | 7 +++++++ programs/dotnetfx35/main.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 programs/dotnetfx35/Makefile.in create mode 100644 programs/dotnetfx35/main.c diff --git a/configure.ac b/configure.ac index 6f16aef7795..09663996204 100644 --- a/configure.ac +++ b/configure.ac @@ -3421,6 +3421,7 @@ WINE_CONFIG_MAKEFILE(programs/cscript) WINE_CONFIG_MAKEFILE(programs/dism) WINE_CONFIG_MAKEFILE(programs/dllhost) WINE_CONFIG_MAKEFILE(programs/dplaysvr) +WINE_CONFIG_MAKEFILE(programs/dotnetfx35) WINE_CONFIG_MAKEFILE(programs/dpnsvr) WINE_CONFIG_MAKEFILE(programs/dpvsetup) WINE_CONFIG_MAKEFILE(programs/dxdiag) diff --git a/programs/dotnetfx35/Makefile.in b/programs/dotnetfx35/Makefile.in new file mode 100644 index 00000000000..91d0876db61 --- /dev/null +++ b/programs/dotnetfx35/Makefile.in @@ -0,0 +1,7 @@ +MODULE = dotnetfx35.exe +IMPORTS = + +EXTRADLLFLAGS = -mwindows -mno-cygwin + +SOURCES = \ + main.c diff --git a/programs/dotnetfx35/main.c b/programs/dotnetfx35/main.c new file mode 100644 index 00000000000..cd6df5bcf41 --- /dev/null +++ b/programs/dotnetfx35/main.c @@ -0,0 +1,32 @@ +/* + * Fake dotnetfx35.exe installer + * + * Copyright 2020 Rémi Bernon + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dotnetfx); + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + FIXME("stub!"); + return 0; +} From 32c47ee92c3b4aea8f222370d3ff2b9f32ba45c9 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 15 Jan 2019 10:10:47 -0600 Subject: [PATCH 0060/1506] HACK: ntdll: Don't pass SDL_AUDIODRIVER from Linux environment. --- dlls/ntdll/unix/env.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index da854ca52d1..9b7c4ea2cd9 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -343,6 +343,7 @@ static BOOL is_special_env_var( const char *var ) STARTS_WITH( var, "TEMP=" ) || STARTS_WITH( var, "TMP=" ) || STARTS_WITH( var, "QT_" ) || + STARTS_WITH( var, "SDL_AUDIODRIVER=" ) || STARTS_WITH( var, "VK_" )); } From 2f40a858c0a9f5b0c7a4fc16d4fbed8d409b1e3f Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 19 Dec 2019 09:12:17 -0600 Subject: [PATCH 0061/1506] HACK: winex11: Remove nvidia hack workaround. This breaks things for users who legitimately have only one resolution. --- dlls/winex11.drv/xrandr.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index c5e47cb355c..5c7b4d1ab80 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -36,9 +36,6 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(xrandr); -#ifdef HAVE_XRRGETPROVIDERRESOURCES -WINE_DECLARE_DEBUG_CHANNEL(winediag); -#endif #ifdef SONAME_LIBXRANDR @@ -367,7 +364,6 @@ static BOOL is_broken_driver(void) XRRScreenResources *screen_resources; XRROutputInfo *output_info; XRRModeInfo *first_mode; - INT major, event, error; INT output_idx, i, j; BOOL only_one_mode; @@ -418,15 +414,6 @@ static BOOL is_broken_driver(void) if (!only_one_mode) continue; - - /* Check if it is NVIDIA proprietary driver */ - if (XQueryExtension( gdi_display, "NV-CONTROL", &major, &event, &error )) - { - ERR_(winediag)("Broken NVIDIA RandR detected, falling back to RandR 1.0. " - "Please consider using the Nouveau driver instead.\n"); - pXRRFreeScreenResources( screen_resources ); - return TRUE; - } } pXRRFreeScreenResources( screen_resources ); return FALSE; From aaf5b8c5631801cc4fca8be3787ab88f270e49e2 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 23 May 2022 13:17:32 -0500 Subject: [PATCH 0062/1506] HACK: ntdll: Disable 16-bit TIB hack. MechWarrior Online (342200) writes directly to the SubSystemTib field, which Wine would interpret to mean it's a 16-bit executable and then crash. We're unlikely to run into any real 16-bit applications in Proton (they won't work on modern Windows, anyway), so let's just disable that hack entirely. CW-Bug-Id: #20673 --- dlls/kernelbase/loader.c | 2 +- dlls/ntdll/env.c | 2 +- dlls/ntdll/path.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/kernelbase/loader.c b/dlls/kernelbase/loader.c index 59b91596f13..f9aad8e1207 100644 --- a/dlls/kernelbase/loader.c +++ b/dlls/kernelbase/loader.c @@ -301,7 +301,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetModuleFileNameW( HMODULE module, LPWSTR filena UNICODE_STRING name; NTSTATUS status; - if (!module && ((win16_tib = NtCurrentTeb()->Tib.SubSystemTib)) && win16_tib->exe_name) + if (!module && (0 && (win16_tib = NtCurrentTeb()->Tib.SubSystemTib)) && win16_tib->exe_name) { len = min( size, win16_tib->exe_name->Length / sizeof(WCHAR) ); memcpy( filename, win16_tib->exe_name->Buffer, len * sizeof(WCHAR) ); diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 04e4ba94563..1f31629d569 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -586,7 +586,7 @@ NTSTATUS WINAPI RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS **resu if (!DllPath) DllPath = &null_str; if (!CurrentDirectoryName) { - if (NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ + if (0 && NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ curdir = ((WIN16_SUBSYSTEM_TIB *)NtCurrentTeb()->Tib.SubSystemTib)->curdir.DosPath; else curdir = cur_params->CurrentDirectory.DosPath; diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 8956ff07f6c..6aa4bb3fdff 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -528,7 +528,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size) RtlAcquirePebLock(); - if (NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ + if (0 && NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ cd = &((WIN16_SUBSYSTEM_TIB *)NtCurrentTeb()->Tib.SubSystemTib)->curdir.DosPath; else cd = &NtCurrentTeb()->Peb->ProcessParameters->CurrentDirectory.DosPath; @@ -883,7 +883,7 @@ ULONG WINAPI RtlGetCurrentDirectory_U(ULONG buflen, LPWSTR buf) RtlAcquirePebLock(); - if (NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ + if (0 && NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ us = &((WIN16_SUBSYSTEM_TIB *)NtCurrentTeb()->Tib.SubSystemTib)->curdir.DosPath; else us = &NtCurrentTeb()->Peb->ProcessParameters->CurrentDirectory.DosPath; @@ -927,7 +927,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) RtlAcquirePebLock(); - if (NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ + if (0 && NtCurrentTeb()->Tib.SubSystemTib) /* FIXME: hack */ curdir = &((WIN16_SUBSYSTEM_TIB *)NtCurrentTeb()->Tib.SubSystemTib)->curdir; else curdir = &NtCurrentTeb()->Peb->ProcessParameters->CurrentDirectory; From cb513450f9711fe0cf36c52e3259db5369b897cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 2 Nov 2020 13:21:49 +0100 Subject: [PATCH 0063/1506] wine/server: Add traces for client requests. --- dlls/ntdll/unix/thread.c | 2 +- include/wine/server.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 9e84ec3cc96..81420e4c239 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1879,7 +1879,7 @@ static void set_native_thread_name( HANDLE handle, const UNICODE_STRING *name ) #ifdef linux unsigned int status; char path[64], nameA[64]; - int unix_pid, unix_tid, len, fd; + int unix_pid = -1, unix_tid = -1, len, fd; SERVER_START_REQ( get_thread_times ) { diff --git a/include/wine/server.h b/include/wine/server.h index 87b43c7e63f..9ba161b56c1 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -26,6 +26,7 @@ #include #include #include +#include /* client communication functions */ @@ -123,6 +124,8 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) #define SERVER_START_REQ(type) \ do { \ + WINE_DECLARE_DEBUG_CHANNEL(client); \ + static const char *const __req_name = #type; \ struct __server_request_info __req; \ struct type##_request * const req = &__req.u.req.type##_request; \ const struct type##_reply * const reply = &__req.u.reply.type##_reply; \ @@ -130,10 +133,12 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) __req.u.req.request_header.req = REQ_##type; \ __req.data_count = 0; \ (void)reply; \ + TRACE_(client)("%s start\n", __req_name); \ do #define SERVER_END_REQ \ while(0); \ + TRACE_(client)("%s end\n", __req_name); \ } while(0) From 609f8c5a68fb913a5e8dcc2918a5a3ca3eb1349b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 2 Nov 2020 13:32:07 +0100 Subject: [PATCH 0064/1506] ntdll: Add +microsecs channel for precise timestamps. --- dlls/ntdll/thread.c | 10 +++++++++- dlls/ntdll/unix/debug.c | 10 +++++++++- dlls/winecrt0/debug.c | 12 +++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 1206d5b24b8..d98c94ff85f 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread); WINE_DECLARE_DEBUG_CHANNEL(relay); WINE_DECLARE_DEBUG_CHANNEL(pid); WINE_DECLARE_DEBUG_CHANNEL(timestamp); +WINE_DECLARE_DEBUG_CHANNEL(microsecs); struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffe0000; @@ -142,7 +143,14 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_ /* only print header if we are at the beginning of the line */ if (info->out_pos) return 0; - if (TRACE_ON(timestamp)) + if (TRACE_ON(microsecs)) + { + LARGE_INTEGER counter, frequency, microsecs; + NtQueryPerformanceCounter(&counter, &frequency); + microsecs.QuadPart = counter.QuadPart * 1000000 / frequency.QuadPart; + pos += sprintf( pos, "%3u.%06u:", (unsigned int)(microsecs.QuadPart / 1000000), (unsigned int)(microsecs.QuadPart % 1000000) ); + } + else if (TRACE_ON(timestamp)) { ULONG ticks = NtGetTickCount(); pos += sprintf( pos, "%3lu.%03lu:", ticks / 1000, ticks % 1000 ); diff --git a/dlls/ntdll/unix/debug.c b/dlls/ntdll/unix/debug.c index e73ee05fc03..a3b7421362c 100644 --- a/dlls/ntdll/unix/debug.c +++ b/dlls/ntdll/unix/debug.c @@ -44,6 +44,7 @@ WINE_DECLARE_DEBUG_CHANNEL(pid); WINE_DECLARE_DEBUG_CHANNEL(timestamp); +WINE_DECLARE_DEBUG_CHANNEL(microsecs); WINE_DEFAULT_DEBUG_CHANNEL(ntdll); struct debug_info @@ -327,7 +328,14 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_ if (init_done) { - if (TRACE_ON(timestamp)) + if (TRACE_ON(microsecs)) + { + LARGE_INTEGER counter, frequency, microsecs; + NtQueryPerformanceCounter(&counter, &frequency); + microsecs.QuadPart = counter.QuadPart * 1000000 / frequency.QuadPart; + pos += sprintf( pos, "%3u.%06u:", (unsigned int)(microsecs.QuadPart / 1000000), (unsigned int)(microsecs.QuadPart % 1000000) ); + } + else if (TRACE_ON(timestamp)) { UINT ticks = NtGetTickCount(); pos += snprintf( pos, sizeof(info->output) - (pos - info->output), "%3u.%03u:", ticks / 1000, ticks % 1000 ); diff --git a/dlls/winecrt0/debug.c b/dlls/winecrt0/debug.c index 2ac4505fb85..fe516e088c5 100644 --- a/dlls/winecrt0/debug.c +++ b/dlls/winecrt0/debug.c @@ -30,6 +30,7 @@ WINE_DECLARE_DEBUG_CHANNEL(pid); WINE_DECLARE_DEBUG_CHANNEL(timestamp); +WINE_DECLARE_DEBUG_CHANNEL(microsecs); static const char * (__cdecl *p__wine_dbg_strdup)( const char *str ); static int (__cdecl *p__wine_dbg_output)( const char *str ); @@ -189,7 +190,16 @@ static int __cdecl fallback__wine_dbg_header( enum __wine_debug_class cls, /* skip header if partial line and no other thread came in between */ if (partial_line_tid == GetCurrentThreadId()) return 0; - if (TRACE_ON(timestamp)) + if (TRACE_ON(microsecs)) + { + static LARGE_INTEGER frequency; + LARGE_INTEGER counter, microsecs; + if (!frequency.QuadPart) QueryPerformanceFrequency(&frequency); + QueryPerformanceCounter(&counter); + microsecs.QuadPart = counter.QuadPart * 1000000 / frequency.QuadPart; + pos += sprintf( pos, "%3u.%06u:", (unsigned int)(microsecs.QuadPart / 1000000), (unsigned int)(microsecs.QuadPart % 1000000) ); + } + else if (TRACE_ON(timestamp)) { UINT ticks = GetTickCount(); pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 ); From 2af5a3a2689c3d4336103fc9e6cbc68abbf7359f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 21 Jun 2021 21:33:09 +0200 Subject: [PATCH 0065/1506] tools: Add gdbinit helper with LoadSymbolFiles command. To help gdb reload symbol files from /proc//maps, making it possible to load debug info for ELF and PE modules for Wine processes. When sourced (from ~/.gdbinit for instance), this adds a new "load-symbol-files" command (with an "lsf" alias), which automatically calls add-symbol-file on every mapped file that can be read as ELF or PE, with the correct section offset. The command has to be run manually, for instance after executing for a while, to load new modules that may have been loaded, as there's no way for gdb to be notified of such changes automatically. --- tools/Makefile.in | 1 + tools/gdbinit.py | 113 ++++++++++++++++++++++++++++++++++++++++++++ tools/gdbinit.py.in | 1 + 3 files changed, 115 insertions(+) create mode 100644 tools/gdbinit.py create mode 120000 tools/gdbinit.py.in diff --git a/tools/Makefile.in b/tools/Makefile.in index cd643e7e90b..ef27cd88b69 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -2,5 +2,6 @@ PROGRAMS = \ make_xftmpl SOURCES = \ + gdbinit.py.in \ make_xftmpl.c \ wineapploader.in diff --git a/tools/gdbinit.py b/tools/gdbinit.py new file mode 100644 index 00000000000..ba3b7d003ac --- /dev/null +++ b/tools/gdbinit.py @@ -0,0 +1,113 @@ +#!/bin/env python3 + +# Copyright 2021 Rémi Bernon for CodeWeavers +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +from __future__ import print_function + +import gdb +import re +import subprocess +import sys + +class LoadSymbolFiles(gdb.Command): + 'Command to load symbol files directly from /proc//maps.' + + def __init__(self): + sup = super(LoadSymbolFiles, self) + sup.__init__('load-symbol-files', gdb.COMMAND_FILES, gdb.COMPLETE_NONE, + False) + + self.libs = {} + gdb.execute('alias -a lsf = load-symbol-files', True) + + def invoke(self, arg, from_tty): + pid = gdb.selected_inferior().pid + if not pid in self.libs: self.libs[pid] = {} + + def command(cmd, confirm=from_tty, to_string=not from_tty): + gdb.execute(cmd, from_tty=confirm, to_string=to_string) + + def execute(cmd): + return subprocess.check_output(cmd, stderr=subprocess.STDOUT) \ + .decode('utf-8') + + # load mappings addresses + libs = {} + with open('/proc/{}/maps'.format(pid), 'r') as maps: + for line in maps: + addr, _, _, _, node, path = re.split(r'\s+', line, 5) + path = path.strip() + if node == '0': continue + if path in libs: continue + libs[path] = int(addr.split('-')[0], 16) + + # unload symbol file if address changed + for k in set(libs) & set(self.libs[pid]): + if libs[k] != self.libs[pid][k]: + command('remove-symbol-file "{}"'.format(k), confirm=False) + del self.libs[k] + + # load symbol file for new mappings + for k in set(libs) - set(self.libs[pid]): + if arg is not None and re.search(arg, k) is None: continue + addr = self.libs[pid][k] = libs[k] + has_debug = False + offs = None + + try: + out = execute(['file', k]) + except: + continue + + # try loading mapping as ELF + try: + out = execute(['readelf', '-l', k]) + for line in out.split('\n'): + if not 'LOAD' in line: continue + base = int(line.split()[2], 16) + break + except: + # assume mapping is PE + base = -1 + + try: + name = None + cmd = 'add-symbol-file "{}"'.format(k) + out = execute(['objdump', '-h', k]) + for line in out.split('\n'): + if '2**' in line: + _, name, _, vma, _, off, _ = line.split(maxsplit=6) + if base < 0: offs = int(off, 16) + else: offs = int(vma, 16) - base + if 'ALLOC' in line: + cmd += ' -s {} 0x{:x}'.format(name, addr + offs) + elif name in ['.gnu_debuglink', '.debug_info']: + has_debug = True + elif 'DEBUGGING' in line: + has_debug = True + except: + continue + + if not has_debug: + print('no debugging info found in {}'.format(k)) + continue + + print('loading symbols for {}'.format(k)) + command(cmd, confirm=False, to_string=True) + + +LoadSymbolFiles() diff --git a/tools/gdbinit.py.in b/tools/gdbinit.py.in new file mode 120000 index 00000000000..9fb7fdf9b92 --- /dev/null +++ b/tools/gdbinit.py.in @@ -0,0 +1 @@ +gdbinit.py \ No newline at end of file From 1eb6e96529d2758fb5c5723ad232a78a32ce4fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jul 2023 09:23:05 +0200 Subject: [PATCH 0066/1506] Revert "ntoskrnl/tests: Fix a test failure." This reverts commit 03034f2c0ef23964891d60e5995d167a113f2d3e. CW-Bug-Id: #22500 --- dlls/ntoskrnl.exe/tests/driver_pnp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.c b/dlls/ntoskrnl.exe/tests/driver_pnp.c index f66d56de8c7..4f75990444d 100644 --- a/dlls/ntoskrnl.exe/tests/driver_pnp.c +++ b/dlls/ntoskrnl.exe/tests/driver_pnp.c @@ -727,8 +727,7 @@ static NTSTATUS fdo_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG code) * handles to the device are closed (and the user-space thread is * currently blocked in this ioctl and won't close its handle * yet.) */ - todo_wine_if (remove_device_count) - ok(!remove_device_count, "Got %u remove events.\n", remove_device_count); + ok(!remove_device_count, "Got %u remove events.\n", remove_device_count); return STATUS_SUCCESS; } From 1aa855855762af09991706b36ae12c8cef8522aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jul 2023 09:23:11 +0200 Subject: [PATCH 0067/1506] Revert "ntoskrnl: Enumerate child devices on a separate thread." This reverts commit 9fbdf2b43435caf62742d997bf8b3fb8752f606c. CW-Bug-Id: #22500 --- dlls/ntoskrnl.exe/ntoskrnl_private.h | 1 - dlls/ntoskrnl.exe/pnp.c | 40 +--------------------------- dlls/ntoskrnl.exe/tests/driver_pnp.c | 10 +++---- 3 files changed, 6 insertions(+), 45 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl_private.h b/dlls/ntoskrnl.exe/ntoskrnl_private.h index 472dc46fde3..ad53ee181a5 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -22,7 +22,6 @@ #define __WINE_NTOSKRNL_PRIVATE_H #include -#include #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 7444b81823c..3fd42c07613 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -36,12 +36,6 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); WINE_DEFAULT_DEBUG_CHANNEL(plugplay); -DECLARE_CRITICAL_SECTION(invalidated_devices_cs); -static CONDITION_VARIABLE invalidated_devices_cv = CONDITION_VARIABLE_INIT; - -static DEVICE_OBJECT **invalidated_devices; -static size_t invalidated_devices_count; - static inline const char *debugstr_propkey( const DEVPROPKEY *id ) { if (!id) return "(null)"; @@ -489,14 +483,8 @@ void WINAPI IoInvalidateDeviceRelations( DEVICE_OBJECT *device_object, DEVICE_RE switch (type) { case BusRelations: - EnterCriticalSection( &invalidated_devices_cs ); - invalidated_devices = realloc( invalidated_devices, - (invalidated_devices_count + 1) * sizeof(*invalidated_devices) ); - invalidated_devices[invalidated_devices_count++] = device_object; - LeaveCriticalSection( &invalidated_devices_cs ); - WakeConditionVariable( &invalidated_devices_cv ); + handle_bus_relations( device_object ); break; - default: FIXME("Unhandled relation %#x.\n", type); break; @@ -1113,30 +1101,6 @@ static NTSTATUS WINAPI pnp_manager_driver_entry( DRIVER_OBJECT *driver, UNICODE_ return STATUS_SUCCESS; } -static DWORD CALLBACK device_enum_thread_proc(void *arg) -{ - for (;;) - { - DEVICE_OBJECT *device; - - EnterCriticalSection( &invalidated_devices_cs ); - - while (!invalidated_devices_count) - SleepConditionVariableCS( &invalidated_devices_cv, &invalidated_devices_cs, INFINITE ); - - device = invalidated_devices[--invalidated_devices_count]; - - /* Don't hold the CS while enumerating the device. Tests show that - * calling IoInvalidateDeviceRelations() from another thread shouldn't - * block, even if this thread is blocked in an IRP handler. */ - LeaveCriticalSection( &invalidated_devices_cs ); - - handle_bus_relations( device ); - } - - return 0; -} - void pnp_manager_start(void) { WCHAR endpoint[] = L"\\pipe\\wine_plugplay"; @@ -1158,8 +1122,6 @@ void pnp_manager_start(void) RpcStringFreeW( &binding_str ); if (err) ERR("RpcBindingFromStringBinding() failed, error %#lx\n", err); - - CreateThread( NULL, 0, device_enum_thread_proc, NULL, 0, NULL ); } void pnp_manager_stop_driver( struct wine_driver *driver ) diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.c b/dlls/ntoskrnl.exe/tests/driver_pnp.c index 4f75990444d..8d489074f90 100644 --- a/dlls/ntoskrnl.exe/tests/driver_pnp.c +++ b/dlls/ntoskrnl.exe/tests/driver_pnp.c @@ -299,11 +299,11 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp) device->power_state = PowerDeviceD0; status = ZwWaitForSingleObject(device->plug_event, TRUE, &wait_time); - ok(!status, "Failed to wait for child plug event, status %#lx.\n", status); + todo_wine ok(!status, "Failed to wait for child plug event, status %#lx.\n", status); status = ZwSetEvent(device->plug_event2, NULL); ok(!status, "Failed to set event, status %#lx.\n", status); status = ZwWaitForSingleObject(device->plug_event, TRUE, &wait_time); - ok(!status, "Failed to wait for child plug event, status %#lx.\n", status); + todo_wine ok(!status, "Failed to wait for child plug event, status %#lx.\n", status); ret = STATUS_SUCCESS; break; @@ -719,15 +719,15 @@ static NTSTATUS fdo_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG code) * for the other. */ status = ZwSetEvent(plug_event, NULL); - ok(!status, "Failed to set event, status %#lx.\n", status); + todo_wine ok(!status, "Failed to set event, status %#lx.\n", status); status = ZwWaitForSingleObject(plug_event2, TRUE, &wait_time); - ok(!status, "Failed to wait for child plug event, status %#lx.\n", status); + todo_wine ok(!status, "Failed to wait for child plug event, status %#lx.\n", status); ok(surprise_removal_count == 1, "Got %u surprise removal events.\n", surprise_removal_count); /* We shouldn't get IRP_MN_REMOVE_DEVICE until all user-space * handles to the device are closed (and the user-space thread is * currently blocked in this ioctl and won't close its handle * yet.) */ - ok(!remove_device_count, "Got %u remove events.\n", remove_device_count); + todo_wine ok(!remove_device_count, "Got %u remove events.\n", remove_device_count); return STATUS_SUCCESS; } From 8272948a8b8b5a34a6e95db38fad6a687ce2f5a2 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 29 Oct 2019 09:16:37 -0500 Subject: [PATCH 0068/1506] setupapi: Support DICGF_PRESENT when looking for devices CW-Bug-Id: #17243 --- dlls/setupapi/devinst.c | 83 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 7e2d683daa6..864551c7e79 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -103,6 +103,7 @@ static const WCHAR Linked[] = {'L','i','n','k','e','d',0}; static const WCHAR dotInterfaces[] = {'.','I','n','t','e','r','f','a','c','e','s',0}; static const WCHAR AddInterface[] = {'A','d','d','I','n','t','e','r','f','a','c','e',0}; static const WCHAR backslashW[] = {'\\',0}; +static const WCHAR hashW[] = {'#',0}; static const WCHAR emptyW[] = {0}; #define SERVICE_CONTROL_REENUMERATE_ROOT_DEVICES 128 @@ -318,7 +319,6 @@ static WCHAR *get_iface_key_path(struct device_iface *iface) static WCHAR *get_refstr_key_path(struct device_iface *iface) { - static const WCHAR hashW[] = {'#',0}; static const WCHAR slashW[] = {'\\',0}; WCHAR *path, *ptr; size_t len = lstrlenW(DeviceClasses) + 1 + 38 + 1 + lstrlenW(iface->symlink) + 1 + 1; @@ -2424,6 +2424,80 @@ static void SETUPDI_EnumerateInterfaces(HDEVINFO DeviceInfoSet, } } + +/* iterate over all interfaces supported by this device instance. if any of + * them are "linked", return TRUE */ +static BOOL is_device_instance_linked(HKEY interfacesKey, const WCHAR *deviceInstance) +{ + LONG l; + DWORD class_idx = 0, device_idx, len, type; + HKEY class_key, device_key, link_key; + WCHAR class_keyname[40], device_keyname[MAX_DEVICE_ID_LEN]; + WCHAR interface_devinstance[MAX_DEVICE_ID_LEN]; + + while (1) + { + len = ARRAY_SIZE(class_keyname); + l = RegEnumKeyExW(interfacesKey, class_idx++, class_keyname, &len, NULL, NULL, NULL, NULL); + if (l) + break; + + l = RegOpenKeyExW(interfacesKey, class_keyname, 0, KEY_READ, &class_key); + if (l) + continue; + + device_idx = 0; + while (1) + { + len = ARRAY_SIZE(device_keyname); + l = RegEnumKeyExW(class_key, device_idx++, device_keyname, &len, NULL, NULL, NULL, NULL); + if (l) + break; + + l = RegOpenKeyExW(class_key, device_keyname, 0, KEY_READ, &device_key); + if (l) + continue; + + len = ARRAY_SIZE(interface_devinstance); + l = RegQueryValueExW(device_key, DeviceInstance, NULL, &type, (BYTE *)interface_devinstance, &len); + if (l || type != REG_SZ) + { + RegCloseKey(device_key); + continue; + } + + if (lstrcmpiW(interface_devinstance, deviceInstance)) + { + /* not our device instance */ + RegCloseKey(device_key); + continue; + } + + l = RegOpenKeyExW(device_key, hashW, 0, KEY_READ, &link_key); + if (l) + { + RegCloseKey(device_key); + continue; + } + + if (is_linked(link_key)) + { + RegCloseKey(link_key); + RegCloseKey(device_key); + RegCloseKey(class_key); + return TRUE; + } + + RegCloseKey(link_key); + RegCloseKey(device_key); + } + + RegCloseKey(class_key); + } + + return FALSE; +} + static void SETUPDI_EnumerateMatchingDeviceInstances(struct DeviceInfoSet *set, LPCWSTR enumerator, LPCWSTR deviceName, HKEY deviceKey, const GUID *class, DWORD flags) @@ -2432,6 +2506,7 @@ static void SETUPDI_EnumerateMatchingDeviceInstances(struct DeviceInfoSet *set, DWORD i, len; WCHAR deviceInstance[MAX_PATH]; LONG l = ERROR_SUCCESS; + HKEY interfacesKey = SetupDiOpenClassRegKeyExW(NULL, KEY_READ, DIOCR_INTERFACE, NULL, NULL); TRACE("%s %s\n", debugstr_w(enumerator), debugstr_w(deviceName)); @@ -2468,7 +2543,9 @@ static void SETUPDI_EnumerateMatchingDeviceInstances(struct DeviceInfoSet *set, {'%','s','\\','%','s','\\','%','s',0}; if (swprintf(id, ARRAY_SIZE(id), fmt, enumerator, - deviceName, deviceInstance) != -1) + deviceName, deviceInstance) != -1 && + (!(flags & DIGCF_PRESENT) || + is_device_instance_linked(interfacesKey, id))) { create_device(set, &deviceClass, id, FALSE); } @@ -2481,6 +2558,8 @@ static void SETUPDI_EnumerateMatchingDeviceInstances(struct DeviceInfoSet *set, l = ERROR_SUCCESS; } } + + RegCloseKey(interfacesKey); } static void SETUPDI_EnumerateMatchingDevices(HDEVINFO DeviceInfoSet, From 40291d86ed911702f32efde0b7d7d03ac30a8501 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 6 Aug 2019 13:27:25 -0500 Subject: [PATCH 0069/1506] HACK: winebus.sys: Disable UDEV lnxev devices by default. --- dlls/winebus.sys/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index e5adfed8611..cbcb557b3d0 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -749,7 +749,7 @@ static NTSTATUS udev_driver_init(void) bus_options.disable_hidraw = check_bus_option(L"DisableHidraw", 0); if (bus_options.disable_hidraw) TRACE("UDEV hidraw devices disabled in registry\n"); - bus_options.disable_input = check_bus_option(L"DisableInput", 0); + bus_options.disable_input = check_bus_option(L"DisableInput", 1); if (bus_options.disable_input) TRACE("UDEV input devices disabled in registry\n"); bus_options.disable_udevd = check_bus_option(L"DisableUdevd", 0); if (bus_options.disable_udevd) TRACE("UDEV udevd use disabled in registry\n"); From 72503e35e55ff0a2d57341bbd3fa60a076e9304c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Sep 2021 15:07:25 +0200 Subject: [PATCH 0070/1506] HACK: winebus.sys: Prefer devices on UDEV hidraw bus over SDL bus. --- dlls/winebus.sys/main.c | 42 ++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index cbcb557b3d0..ab096319d21 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -71,6 +71,7 @@ struct device_extension { struct list entry; DEVICE_OBJECT *device; + const WCHAR *bus_name; CRITICAL_SECTION cs; enum device_state state; @@ -283,7 +284,7 @@ static void remove_pending_irps(DEVICE_OBJECT *device) } } -static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, UINT64 unix_device) +static DEVICE_OBJECT *bus_create_hid_device(const WCHAR *bus_name, struct device_desc *desc, UINT64 unix_device) { struct device_extension *ext; DEVICE_OBJECT *device; @@ -306,6 +307,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, UINT64 uni /* fill out device_extension struct */ ext = (struct device_extension *)device->DeviceExtension; + ext->bus_name = bus_name; ext->device = device; ext->desc = *desc; ext->index = get_device_index(desc); @@ -334,6 +336,17 @@ static DEVICE_OBJECT *bus_find_unix_device(UINT64 unix_device) return NULL; } +static DEVICE_OBJECT *bus_find_device_from_vid_pid(const WCHAR *bus_name, struct device_desc *desc) +{ + struct device_extension *ext; + + LIST_FOR_EACH_ENTRY(ext, &device_list, struct device_extension, entry) + if (!wcscmp(ext->bus_name, bus_name) && ext->desc.vid == desc->vid && + ext->desc.pid == desc->pid) return ext->device; + + return NULL; +} + static void bus_unlink_hid_device(DEVICE_OBJECT *device) { struct device_extension *ext = (struct device_extension *)device->DeviceExtension; @@ -520,7 +533,7 @@ static void mouse_device_create(void) struct device_create_params params = {{0}}; if (winebus_call(mouse_create, ¶ms)) return; - mouse_obj = bus_create_hid_device(¶ms.desc, params.device); + mouse_obj = bus_create_hid_device(L"WINEBUS", ¶ms.desc, params.device); IoInvalidateDeviceRelations(bus_pdo, BusRelations); } @@ -529,7 +542,7 @@ static void keyboard_device_create(void) struct device_create_params params = {{0}}; if (winebus_call(keyboard_create, ¶ms)) return; - keyboard_obj = bus_create_hid_device(¶ms.desc, params.device); + keyboard_obj = bus_create_hid_device(L"WINEBUS", ¶ms.desc, params.device); IoInvalidateDeviceRelations(bus_pdo, BusRelations); } @@ -577,7 +590,20 @@ static DWORD CALLBACK bus_main_thread(void *args) IoInvalidateDeviceRelations(bus_pdo, BusRelations); break; case BUS_EVENT_TYPE_DEVICE_CREATED: - device = bus_create_hid_device(&event->device_created.desc, event->device); + RtlEnterCriticalSection(&device_list_cs); + if (!wcscmp(bus.name, L"SDL")) + { + if (bus_find_device_from_vid_pid(L"UDEV", &event->device_created.desc)) device = NULL; + else device = bus_create_hid_device(bus.name, &event->device_created.desc, event->device); + } + else if (!wcscmp(bus.name, L"UDEV")) + { + if ((device = bus_find_device_from_vid_pid(L"SDL", &event->device_created.desc))) + bus_unlink_hid_device(device); + device = bus_create_hid_device(bus.name, &event->device_created.desc, event->device); + } + else device = bus_create_hid_device(bus.name, &event->device_created.desc, event->device); + RtlLeaveCriticalSection(&device_list_cs); if (device) IoInvalidateDeviceRelations(bus_pdo, BusRelations); else { @@ -785,11 +811,9 @@ static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) mouse_device_create(); keyboard_device_create(); - if (!check_bus_option(L"Enable SDL", 1) || sdl_driver_init()) - { - udev_driver_init(); - iohid_driver_init(); - } + udev_driver_init(); + iohid_driver_init(); + sdl_driver_init(); irp->IoStatus.Status = STATUS_SUCCESS; break; From b489a0ea67539610191517ce680f2f07490ead45 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 6 Aug 2019 13:37:38 -0500 Subject: [PATCH 0071/1506] winebus.sys: Enable hidraw only for the DS4/DualSense controllers. And SDL for everything else. CW-Bug-Id: #20281 --- dlls/winebus.sys/bus_udev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 34b3305ed88..82dc6321122 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1372,8 +1372,12 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (is_xbox_gamepad(desc.vid, desc.pid)) - desc.is_gamepad = TRUE; + if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid)) + { + TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); + close(fd); + return; + } #ifdef HAS_PROPER_INPUT_HEADER else { From 19c6ccae93d409f381823b85315c221016245945 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 7 Oct 2021 15:29:05 +0200 Subject: [PATCH 0072/1506] HACK: winebus.sys: Ignore blacklisted SDL controllers and joysticks. --- dlls/winebus.sys/bus_sdl.c | 10 +++++++++- dlls/winebus.sys/bus_udev.c | 7 +++++++ dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index ed9d3aed4bd..3053d138279 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -958,7 +958,8 @@ static void sdl_add_device(unsigned int index) id = pSDL_JoystickInstanceID(joystick); - if (pSDL_JoystickGetProductVersion != NULL) { + if (pSDL_JoystickGetProductVersion != NULL) + { desc.vid = pSDL_JoystickGetVendor(joystick); desc.pid = pSDL_JoystickGetProduct(joystick); desc.version = pSDL_JoystickGetProductVersion(joystick); @@ -970,6 +971,13 @@ static void sdl_add_device(unsigned int index) desc.version = 0; } + if (is_sdl_blacklisted(desc.vid, desc.pid)) + { + /* this device is blacklisted */ + TRACE("ignoring %s, in SDL blacklist\n", debugstr_device_desc(&desc)); + return; + } + if (pSDL_JoystickGetSerial && (sdl_serial = pSDL_JoystickGetSerial(joystick))) { ntdll_umbstowcs(sdl_serial, strlen(sdl_serial) + 1, desc.serialnumber, ARRAY_SIZE(desc.serialnumber)); diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 82dc6321122..e4e5cfd1903 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1378,6 +1378,13 @@ static void udev_add_device(struct udev_device *dev, int fd) close(fd); return; } + if (is_sdl_blacklisted(desc.vid, desc.pid)) + { + /* this device is blacklisted */ + TRACE("hidraw %s: ignoring %s, in SDL blacklist\n", debugstr_a(devnode), debugstr_device_desc(&desc)); + close(fd); + return; + } #ifdef HAS_PROPER_INPUT_HEADER else { diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 1ec414cce73..94f4e5641a5 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -266,6 +266,7 @@ extern void hid_device_drop_report(struct unix_device *iface); extern void hid_device_set_effect_state(struct unix_device *iface, BYTE index, BYTE flags); +BOOL is_sdl_blacklisted(WORD vid, WORD pid); BOOL is_xbox_gamepad(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 82eab3717ca..b31f6513f35 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -38,6 +38,24 @@ #include "unix_private.h" +/* logic from SDL2's SDL_ShouldIgnoreGameController */ +BOOL is_sdl_blacklisted(WORD vid, WORD pid) +{ + const char *allow_virtual = getenv("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD"); + const char *whitelist = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"); + const char *blacklist = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES"); + char needle[16]; + + if (vid == 0x28de && pid == 0x11ff && allow_virtual && *allow_virtual && + *allow_virtual != '0' && strcasecmp(allow_virtual, "false")) + return FALSE; + + sprintf(needle, "0x%04x/0x%04x", vid, pid); + if (whitelist) return strcasestr(whitelist, needle) == NULL; + if (blacklist) return strcasestr(blacklist, needle) != NULL; + return FALSE; +} + BOOL is_xbox_gamepad(WORD vid, WORD pid) { if (vid != 0x045e) return FALSE; From 048ecd046d2b33f68aae5f64f1f060509e236331 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 30 Aug 2019 10:20:16 -0500 Subject: [PATCH 0073/1506] HACK: winebus.sys: Override Steam virtual controller vid/pid with Xbox. Matches Windows Steam client behavior. --- dlls/winebus.sys/bus_sdl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 3053d138279..dd0e6717d0d 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -978,6 +978,13 @@ static void sdl_add_device(unsigned int index) return; } + if (desc.vid == 0x28de && desc.pid == 0x11ff) + { + TRACE("Steam virtual controller, pretending it's an Xbox 360 controller\n"); + desc.vid = 0x045e; + desc.pid = 0x028e; + } + if (pSDL_JoystickGetSerial && (sdl_serial = pSDL_JoystickGetSerial(joystick))) { ntdll_umbstowcs(sdl_serial, strlen(sdl_serial) + 1, desc.serialnumber, ARRAY_SIZE(desc.serialnumber)); From a9f8de61a60380f1b27e6176205d8c46804c703d Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 30 Sep 2021 20:38:04 +0200 Subject: [PATCH 0074/1506] winebus.sys: Ignore some joysticks that SDL reports. SDL has a blacklist, but it isn't complete. Ignore some more devices while we fix upstream. --- dlls/winebus.sys/bus_sdl.c | 7 +++++++ dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index dd0e6717d0d..7d3f3d867df 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -978,6 +978,13 @@ static void sdl_add_device(unsigned int index) return; } + if (is_wine_blacklisted(desc.vid, desc.pid)) + { + /* this device is blacklisted */ + TRACE("ignoring %s, in Wine blacklist\n", debugstr_device_desc(&desc)); + return; + } + if (desc.vid == 0x28de && desc.pid == 0x11ff) { TRACE("Steam virtual controller, pretending it's an Xbox 360 controller\n"); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 94f4e5641a5..83b513b4e08 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -267,6 +267,7 @@ extern void hid_device_drop_report(struct unix_device *iface); extern void hid_device_set_effect_state(struct unix_device *iface, BYTE index, BYTE flags); BOOL is_sdl_blacklisted(WORD vid, WORD pid); +BOOL is_wine_blacklisted(WORD vid, WORD pid); BOOL is_xbox_gamepad(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index b31f6513f35..9dae421192f 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -38,6 +38,12 @@ #include "unix_private.h" +BOOL is_wine_blacklisted(WORD vid, WORD pid) +{ + if (vid == 0x056a) return TRUE; /* all Wacom devices */ + return FALSE; +} + /* logic from SDL2's SDL_ShouldIgnoreGameController */ BOOL is_sdl_blacklisted(WORD vid, WORD pid) { From 8b6bbba62c2883feb19294b336420966481bee12 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 10 Nov 2020 18:32:28 +0000 Subject: [PATCH 0075/1506] winebus.sys: Automatically bypass udevd in Flatpak or pressure-vessel. Flatpak uses unprivileged containers that don't normally map uid 0 into the container, so netlink events won't work there, as described in previous commits. Steam's pressure-vessel container tool behaves similarly. --- dlls/winebus.sys/bus_udev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index e4e5cfd1903..88cdf9a92b3 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1776,6 +1776,12 @@ NTSTATUS udev_bus_init(void *args) goto error; } + if (access("/run/pressure-vessel", R_OK) || access("/.flatpak-info", R_OK)) + { + TRACE("Container detected, bypassing udevd by default\n"); + options.disable_udevd = TRUE; + } + #ifdef HAVE_SYS_INOTIFY_H if (options.disable_udevd) monitor_fd = create_inotify(); if (monitor_fd < 0) options.disable_udevd = FALSE; From c712e86133a4ea90b29a68496dfc6d114490dc17 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 10 Nov 2020 19:03:47 +0000 Subject: [PATCH 0076/1506] winebus.sys: Guess the type of evdev input devices. Ordinarily, we can get the type of an evdev input device from udev: the input_id builtin sets udev properties of the form ID_INPUT_FOO that we can read. However, in a container there is no guarantee that the libudev in the container will interoperate with the udevd on the host system, so we need to be prepared to do this ourselves from first principles, using a heuristic similar to the one in udev's input_id. We cannot simply copy the heuristic from udev's input_id, because its licensing is incompatible (GPL). Instead, use a vaguely similar heuristic that works from the same inputs and will generally produce similar results. --- dlls/winebus.sys/bus_udev.c | 325 ++++++++++++++++++++++++++++++++++++ 1 file changed, 325 insertions(+) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 88cdf9a92b3..16016b09566 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -25,6 +25,7 @@ #include "config.h" #include #include +#include #include #include #include @@ -555,6 +556,302 @@ static struct base_device *find_device_from_syspath(const char *path) #define test_bit(arr,bit) (((BYTE*)(arr))[(bit)>>3]&(1<<((bit)&7))) +/* Minimal compatibility with code taken from steam-runtime-tools */ +typedef int gboolean; +#define g_debug(fmt, ...) TRACE(fmt "\n", ## __VA_ARGS__) +#define G_N_ELEMENTS(arr) (sizeof(arr)/sizeof(arr[0])) + +typedef enum +{ + SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK = (1 << 0), + SRT_INPUT_DEVICE_TYPE_FLAGS_ACCELEROMETER = (1 << 1), + SRT_INPUT_DEVICE_TYPE_FLAGS_KEYBOARD = (1 << 2), + SRT_INPUT_DEVICE_TYPE_FLAGS_HAS_KEYS = (1 << 3), + SRT_INPUT_DEVICE_TYPE_FLAGS_MOUSE = (1 << 4), + SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHPAD = (1 << 5), + SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHSCREEN = (1 << 6), + SRT_INPUT_DEVICE_TYPE_FLAGS_TABLET = (1 << 7), + SRT_INPUT_DEVICE_TYPE_FLAGS_TABLET_PAD = (1 << 8), + SRT_INPUT_DEVICE_TYPE_FLAGS_POINTING_STICK = (1 << 9), + SRT_INPUT_DEVICE_TYPE_FLAGS_SWITCH = (1 << 10), + SRT_INPUT_DEVICE_TYPE_FLAGS_NONE = 0 +} SrtInputDeviceTypeFlags; + +#define BITS_PER_LONG (sizeof (unsigned long) * CHAR_BIT) +#define LONGS_FOR_BITS(x) ((((x)-1)/BITS_PER_LONG)+1) +typedef struct +{ + unsigned long ev[LONGS_FOR_BITS (EV_MAX)]; + unsigned long keys[LONGS_FOR_BITS (KEY_MAX)]; + unsigned long abs[LONGS_FOR_BITS (ABS_MAX)]; + unsigned long rel[LONGS_FOR_BITS (REL_MAX)]; + unsigned long ff[LONGS_FOR_BITS (FF_MAX)]; + unsigned long props[LONGS_FOR_BITS (INPUT_PROP_MAX)]; +} SrtEvdevCapabilities; + +static gboolean +_srt_get_caps_from_evdev (int fd, + unsigned int type, + unsigned long *bitmask, + size_t bitmask_len_longs) +{ + size_t bitmask_len_bytes = bitmask_len_longs * sizeof (*bitmask); + + memset (bitmask, 0, bitmask_len_bytes); + + if (ioctl (fd, EVIOCGBIT (type, bitmask_len_bytes), bitmask) < 0) + return FALSE; + + return TRUE; +} + +static gboolean +_srt_evdev_capabilities_set_from_evdev (SrtEvdevCapabilities *caps, + int fd) +{ + if (_srt_get_caps_from_evdev (fd, 0, caps->ev, G_N_ELEMENTS (caps->ev))) + { + _srt_get_caps_from_evdev (fd, EV_KEY, caps->keys, G_N_ELEMENTS (caps->keys)); + _srt_get_caps_from_evdev (fd, EV_ABS, caps->abs, G_N_ELEMENTS (caps->abs)); + _srt_get_caps_from_evdev (fd, EV_REL, caps->rel, G_N_ELEMENTS (caps->rel)); + _srt_get_caps_from_evdev (fd, EV_FF, caps->ff, G_N_ELEMENTS (caps->ff)); + ioctl (fd, EVIOCGPROP (sizeof (caps->props)), caps->props); + return TRUE; + } + + memset (caps, 0, sizeof (*caps)); + return FALSE; +} + +#define JOYSTICK_ABS_AXES \ + ((1 << ABS_X) | (1 << ABS_Y) \ + | (1 << ABS_RX) | (1 << ABS_RY) \ + | (1 << ABS_THROTTLE) | (1 << ABS_RUDDER) \ + | (1 << ABS_WHEEL) | (1 << ABS_GAS) | (1 << ABS_BRAKE) \ + | (1 << ABS_HAT0X) | (1 << ABS_HAT0Y) \ + | (1 << ABS_HAT1X) | (1 << ABS_HAT1Y) \ + | (1 << ABS_HAT2X) | (1 << ABS_HAT2Y) \ + | (1 << ABS_HAT3X) | (1 << ABS_HAT3Y)) + +static const unsigned int first_mouse_button = BTN_MOUSE; +static const unsigned int last_mouse_button = BTN_JOYSTICK - 1; + +static const unsigned int first_joystick_button = BTN_JOYSTICK; +static const unsigned int last_joystick_button = BTN_GAMEPAD - 1; + +static const unsigned int first_gamepad_button = BTN_GAMEPAD; +static const unsigned int last_gamepad_button = BTN_DIGI - 1; + +static const unsigned int first_dpad_button = BTN_DPAD_UP; +static const unsigned int last_dpad_button = BTN_DPAD_RIGHT; + +static const unsigned int first_extra_joystick_button = BTN_TRIGGER_HAPPY; +static const unsigned int last_extra_joystick_button = BTN_TRIGGER_HAPPY40; + +SrtInputDeviceTypeFlags +_srt_evdev_capabilities_guess_type (const SrtEvdevCapabilities *caps) +{ + SrtInputDeviceTypeFlags flags = SRT_INPUT_DEVICE_TYPE_FLAGS_NONE; + unsigned int i; + gboolean has_joystick_axes = FALSE; + gboolean has_joystick_buttons = FALSE; + + /* Some properties let us be fairly sure about a device */ + if (test_bit (caps->props, INPUT_PROP_ACCELEROMETER)) + { + g_debug ("INPUT_PROP_ACCELEROMETER => is accelerometer"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_ACCELEROMETER; + } + + if (test_bit (caps->props, INPUT_PROP_POINTING_STICK)) + { + g_debug ("INPUT_PROP_POINTING_STICK => is pointing stick"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_POINTING_STICK; + } + + if (test_bit (caps->props, INPUT_PROP_BUTTONPAD) + || test_bit (caps->props, INPUT_PROP_TOPBUTTONPAD)) + { + g_debug ("INPUT_PROP_[TOP]BUTTONPAD => is touchpad"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHPAD; + } + + /* Devices with a stylus or pen are assumed to be graphics tablets */ + if (test_bit (caps->keys, BTN_STYLUS) + || test_bit (caps->keys, BTN_TOOL_PEN)) + { + g_debug ("Stylus or pen => is tablet"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_TABLET; + } + + /* Devices that accept a finger touch are assumed to be touchpads or + * touchscreens. + * + * In Steam we mostly only care about these as a way to + * reject non-joysticks, so we're not very precise here yet. + * + * SDL assumes that TOUCH means a touchscreen and FINGER + * means a touchpad. */ + if (flags == SRT_INPUT_DEVICE_TYPE_FLAGS_NONE + && (test_bit (caps->keys, BTN_TOOL_FINGER) + || test_bit (caps->keys, BTN_TOUCH) + || test_bit (caps->props, INPUT_PROP_SEMI_MT))) + { + g_debug ("Finger or touch or semi-MT => is touchpad or touchscreen"); + + if (test_bit (caps->props, INPUT_PROP_POINTER)) + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHPAD; + else + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHSCREEN; + } + + /* Devices with mouse buttons are ... probably mice? */ + if (flags == SRT_INPUT_DEVICE_TYPE_FLAGS_NONE) + { + for (i = first_mouse_button; i <= last_mouse_button; i++) + { + if (test_bit (caps->keys, i)) + { + g_debug ("Mouse button => mouse"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_MOUSE; + } + } + } + + if (flags == SRT_INPUT_DEVICE_TYPE_FLAGS_NONE) + { + for (i = ABS_X; i < ABS_Z; i++) + { + if (!test_bit (caps->abs, i)) + break; + } + + /* If it has 3 axes and no buttons it's probably an accelerometer. */ + if (i == ABS_Z && !test_bit (caps->ev, EV_KEY)) + { + g_debug ("3 left axes and no buttons => accelerometer"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_ACCELEROMETER; + } + + /* Same for RX..RZ (e.g. Wiimote) */ + for (i = ABS_RX; i < ABS_RZ; i++) + { + if (!test_bit (caps->abs, i)) + break; + } + + if (i == ABS_RZ && !test_bit (caps->ev, EV_KEY)) + { + g_debug ("3 right axes and no buttons => accelerometer"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_ACCELEROMETER; + } + } + + /* Bits 1 to 31 are ESC, numbers and Q to D, which SDL and udev both + * consider to be enough to count as a fully-functioned keyboard. */ + if ((caps->keys[0] & 0xfffffffe) == 0xfffffffe) + { + g_debug ("First few keys => keyboard"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_KEYBOARD; + } + + /* If we have *any* keys, consider it to be something a bit + * keyboard-like. Bits 0 to 63 are all keyboard keys. + * Make sure we stop before reaching KEY_UP which is sometimes + * used on game controller mappings, e.g. for the Wiimote. */ + for (i = 0; i < (64 / BITS_PER_LONG); i++) + { + if (caps->keys[i] != 0) + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_HAS_KEYS; + } + + if (caps->abs[0] & JOYSTICK_ABS_AXES) + has_joystick_axes = TRUE; + + /* Flight stick buttons */ + for (i = first_joystick_button; i <= last_joystick_button; i++) + { + if (test_bit (caps->keys, i)) + has_joystick_buttons = TRUE; + } + + /* Gamepad buttons (Xbox, PS3, etc.) */ + for (i = first_gamepad_button; i <= last_gamepad_button; i++) + { + if (test_bit (caps->keys, i)) + has_joystick_buttons = TRUE; + } + + /* Gamepad digital dpad */ + for (i = first_dpad_button; i <= last_dpad_button; i++) + { + if (test_bit (caps->keys, i)) + has_joystick_buttons = TRUE; + } + + /* Steering wheel gear-change buttons */ + for (i = BTN_GEAR_DOWN; i <= BTN_GEAR_UP; i++) + { + if (test_bit (caps->keys, i)) + has_joystick_buttons = TRUE; + } + + /* Reserved space for extra game-controller buttons, e.g. on Corsair + * gaming keyboards */ + for (i = first_extra_joystick_button; i <= last_extra_joystick_button; i++) + { + if (test_bit (caps->keys, i)) + has_joystick_buttons = TRUE; + } + + if (test_bit (caps->keys, last_mouse_button)) + { + /* Mice with a very large number of buttons can apparently + * overflow into the joystick-button space, but they're still not + * joysticks. */ + has_joystick_buttons = FALSE; + } + + /* TODO: Do we want to consider BTN_0 up to BTN_9 to be joystick buttons? + * libmanette and SDL look for BTN_1, udev does not. + * + * They're used by some game controllers, like BTN_1 and BTN_2 for the + * Wiimote, BTN_1..BTN_9 for the SpaceTec SpaceBall and BTN_0..BTN_3 + * for Playstation dance pads, but they're also used by + * non-game-controllers like Logitech mice. For now we entirely ignore + * these buttons: they are not evidence that it's a joystick, but + * neither are they evidence that it *isn't* a joystick. */ + + /* We consider it to be a joystick if there is some evidence that it is, + * and no evidence that it's something else. + * + * Unlike SDL, we accept devices with only axes and no buttons as a + * possible joystick, unless they have X/Y/Z axes in which case we + * assume they're accelerometers. */ + if ((has_joystick_buttons || has_joystick_axes) + && (flags == SRT_INPUT_DEVICE_TYPE_FLAGS_NONE)) + { + g_debug ("Looks like a joystick"); + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK; + } + + /* If we have *any* keys below BTN_MISC, consider it to be something + * a bit keyboard-like, but don't rule out *also* being considered + * to be a joystick (again for e.g. the Wiimote). */ + for (i = 0; i < (BTN_MISC / BITS_PER_LONG); i++) + { + if (caps->keys[i] != 0) + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_HAS_KEYS; + } + + /* Also non-exclusive: don't rule out a device being a joystick and + * having a switch */ + if (test_bit (caps->ev, EV_SW)) + flags |= SRT_INPUT_DEVICE_TYPE_FLAGS_SWITCH; + + return flags; +} + static const USAGE_AND_PAGE *what_am_I(struct udev_device *dev, int fd) { static const USAGE_AND_PAGE Unknown = {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = 0}; @@ -565,6 +862,7 @@ static const USAGE_AND_PAGE *what_am_I(struct udev_device *dev, int fd) static const USAGE_AND_PAGE Tablet = {.UsagePage = HID_USAGE_PAGE_DIGITIZER, .Usage = HID_USAGE_DIGITIZER_PEN}; static const USAGE_AND_PAGE Touchscreen = {.UsagePage = HID_USAGE_PAGE_DIGITIZER, .Usage = HID_USAGE_DIGITIZER_TOUCH_SCREEN}; static const USAGE_AND_PAGE Touchpad = {.UsagePage = HID_USAGE_PAGE_DIGITIZER, .Usage = HID_USAGE_DIGITIZER_TOUCH_PAD}; + SrtEvdevCapabilities caps; struct udev_device *parent = dev; @@ -589,6 +887,33 @@ static const USAGE_AND_PAGE *what_am_I(struct udev_device *dev, int fd) parent = udev_device_get_parent_with_subsystem_devtype(parent, "input", NULL); } + /* In a container, udev properties might not be available. Fall back to deriving the device + * type from the fd's evdev capabilities. */ + if (_srt_evdev_capabilities_set_from_evdev (&caps, fd)) + { + SrtInputDeviceTypeFlags guessed_type; + + guessed_type = _srt_evdev_capabilities_guess_type (&caps); + + if (guessed_type & (SRT_INPUT_DEVICE_TYPE_FLAGS_MOUSE + | SRT_INPUT_DEVICE_TYPE_FLAGS_POINTING_STICK)) + return &Mouse; + else if (guessed_type & SRT_INPUT_DEVICE_TYPE_FLAGS_KEYBOARD) + return &Keyboard; + else if (guessed_type & SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK) + return &Gamepad; + else if (guessed_type & SRT_INPUT_DEVICE_TYPE_FLAGS_HAS_KEYS) + return &Keypad; + else if (guessed_type & SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHPAD) + return &Touchpad; + else if (guessed_type & SRT_INPUT_DEVICE_TYPE_FLAGS_TOUCHSCREEN) + return &Touchscreen; + else if (guessed_type & SRT_INPUT_DEVICE_TYPE_FLAGS_TABLET) + return &Tablet; + + /* Mapped to Unknown: ACCELEROMETER, TABLET_PAD, SWITCH. */ + } + return &Unknown; } From 596efb4f61549161154d1035f95ce20b64697bfc Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 15 Dec 2020 12:23:31 -0600 Subject: [PATCH 0077/1506] winebus.sys: Enable SDL input logging when hid channel is enabled. --- dlls/winebus.sys/bus_sdl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 7d3f3d867df..ad1540af836 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -114,6 +114,7 @@ MAKE_FUNCPTR(SDL_GameControllerAddMapping); MAKE_FUNCPTR(SDL_RegisterEvents); MAKE_FUNCPTR(SDL_PushEvent); MAKE_FUNCPTR(SDL_GetTicks); +MAKE_FUNCPTR(SDL_LogSetPriority); static int (*pSDL_JoystickRumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); static int (*pSDL_JoystickRumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); static Uint16 (*pSDL_JoystickGetProduct)(SDL_Joystick * joystick); @@ -1152,6 +1153,7 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_RegisterEvents); LOAD_FUNCPTR(SDL_PushEvent); LOAD_FUNCPTR(SDL_GetTicks); + LOAD_FUNCPTR(SDL_LogSetPriority); #undef LOAD_FUNCPTR pSDL_JoystickRumble = dlsym(sdl_handle, "SDL_JoystickRumble"); pSDL_JoystickRumbleTriggers = dlsym(sdl_handle, "SDL_JoystickRumbleTriggers"); @@ -1173,6 +1175,11 @@ NTSTATUS sdl_bus_init(void *args) goto failed; } + if (TRACE_ON(hid)) + { + pSDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE); + } + pSDL_JoystickEventState(SDL_ENABLE); pSDL_GameControllerEventState(SDL_ENABLE); From f5a7f847aade4a390d57ee7bc7ee5cf3025bf619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 00:09:20 +0100 Subject: [PATCH 0078/1506] winebus.sys: Add Logitech G920 mapping to the SDL backend. The HID input report format is different between Linux (hid_logitech_hidpp) and Windows when it comes to axis HID usages. To correct that we can use the device through SDL and craft our own HID mapping. --- dlls/winebus.sys/bus_sdl.c | 32 +++++++++++++++++++++++++++----- dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 5 +++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index ad1540af836..f4b27f820eb 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -247,6 +247,13 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) return TRUE; } +static const USAGE_AND_PAGE g920_absolute_usages[] = +{ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_X}, /* wheel */ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_Y}, /* accelerator */ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_Z}, /* brake */ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_RZ}, /* clutch */ +}; static const USAGE_AND_PAGE absolute_axis_usages[] = { {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_X}, @@ -271,6 +278,18 @@ static const USAGE_AND_PAGE relative_axis_usages[] = {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_WHEEL}, }; +static int get_absolute_usages(struct sdl_device *impl, const USAGE_AND_PAGE **absolute_usages) +{ + if (is_logitech_g920(pSDL_JoystickGetVendor(impl->sdl_joystick), pSDL_JoystickGetProduct(impl->sdl_joystick))) + { + *absolute_usages = g920_absolute_usages; + return ARRAY_SIZE(g920_absolute_usages); + } + + *absolute_usages = absolute_axis_usages; + return ARRAY_SIZE(absolute_axis_usages); +} + static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface) { const USAGE_AND_PAGE device_usage = {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_JOYSTICK}; @@ -278,12 +297,15 @@ static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface) int i, button_count, axis_count, ball_count, hat_count; USAGE_AND_PAGE physical_usage; + const USAGE_AND_PAGE *absolute_usages = NULL; + size_t absolute_usages_count = get_absolute_usages(impl, &absolute_usages); + axis_count = pSDL_JoystickNumAxes(impl->sdl_joystick); if (options.split_controllers) axis_count = min(6, axis_count - impl->axis_offset); - if (axis_count > ARRAY_SIZE(absolute_axis_usages)) + if (axis_count > absolute_usages_count) { - FIXME("More than %zu absolute axes found, ignoring.\n", ARRAY_SIZE(absolute_axis_usages)); - axis_count = ARRAY_SIZE(absolute_axis_usages); + FIXME("More than %zu absolute axes found, ignoring.\n", absolute_usages_count); + axis_count = absolute_usages_count; } ball_count = pSDL_JoystickNumBalls(impl->sdl_joystick); @@ -339,8 +361,8 @@ static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface) for (i = 0; i < axis_count; i++) { - if (!hid_device_add_axes(iface, 1, absolute_axis_usages[i].UsagePage, - &absolute_axis_usages[i].Usage, FALSE, -32768, 32767)) + if (!hid_device_add_axes(iface, 1, absolute_usages[i].UsagePage, + &absolute_usages[i].Usage, FALSE, -32768, 32767)) return STATUS_NO_MEMORY; } diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 83b513b4e08..b8278183583 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -271,5 +271,6 @@ BOOL is_wine_blacklisted(WORD vid, WORD pid); BOOL is_xbox_gamepad(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); +BOOL is_logitech_g920(WORD vid, WORD pid); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 9dae421192f..32ab016992e 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -102,6 +102,11 @@ BOOL is_dualsense_gamepad(WORD vid, WORD pid) return FALSE; } +BOOL is_logitech_g920(WORD vid, WORD pid) +{ + return vid == 0x046D && pid == 0xC262; +} + struct mouse_device { struct unix_device unix_device; From 2efbb274bb4b96872db35591ab863931cd709ecd Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 20 Apr 2022 14:09:16 +0300 Subject: [PATCH 0079/1506] winebus.sys: Enable hidraw for Thrustmaster T.Flight Rudder Pedals Link: https://github.com/ValveSoftware/Proton/issues/5749#issuecomment-1102831266 --- dlls/winebus.sys/bus_udev.c | 2 +- dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 16016b09566..767bb11712e 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1697,7 +1697,7 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid)) + if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid) && !is_thrustmaster_rudder_pedals(desc.vid, desc.pid)) { TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); close(fd); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index b8278183583..5b35d6bc733 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -272,5 +272,6 @@ BOOL is_xbox_gamepad(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); BOOL is_logitech_g920(WORD vid, WORD pid); +BOOL is_thrustmaster_rudder_pedals(WORD vid, WORD pid); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 32ab016992e..23f6230732d 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -107,6 +107,11 @@ BOOL is_logitech_g920(WORD vid, WORD pid) return vid == 0x046D && pid == 0xC262; } +BOOL is_thrustmaster_rudder_pedals(WORD vid, WORD pid) +{ + return vid == 0x044F && pid == 0xB679; +} + struct mouse_device { struct unix_device unix_device; From 58bee93cb61261576c6f360c72a50e1067d3340d Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 26 Jul 2022 11:22:26 +0300 Subject: [PATCH 0080/1506] winebus.sys: Enable hidraw for Thrustmaster HOTAS. CW-Bug-Id: #20694 --- dlls/winebus.sys/bus_udev.c | 2 +- dlls/winebus.sys/unix_private.h | 2 +- dlls/winebus.sys/unixlib.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 767bb11712e..34538ed2a5e 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1697,7 +1697,7 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid) && !is_thrustmaster_rudder_pedals(desc.vid, desc.pid)) + if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid) && !is_thrustmaster_hotas(desc.vid, desc.pid)) { TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); close(fd); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 5b35d6bc733..0e1992b8e80 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -272,6 +272,6 @@ BOOL is_xbox_gamepad(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); BOOL is_logitech_g920(WORD vid, WORD pid); -BOOL is_thrustmaster_rudder_pedals(WORD vid, WORD pid); +BOOL is_thrustmaster_hotas(WORD vid, WORD pid); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 23f6230732d..e1406d81812 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -107,9 +107,9 @@ BOOL is_logitech_g920(WORD vid, WORD pid) return vid == 0x046D && pid == 0xC262; } -BOOL is_thrustmaster_rudder_pedals(WORD vid, WORD pid) +BOOL is_thrustmaster_hotas(WORD vid, WORD pid) { - return vid == 0x044F && pid == 0xB679; + return vid == 0x044F && (pid == 0xB679 || pid == 0xB687 || pid == 0xB10A); } struct mouse_device From c90648063a1463d020ae17b589d10b17202ecfd9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 18 Jan 2022 14:29:59 +0200 Subject: [PATCH 0081/1506] dinput: Make it possible to add hacks that override names and GUID of axes. --- dlls/dinput/joystick_hid.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 3320ac92a1c..8bd61412b05 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -540,6 +540,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, struct hid_collection_node *node, *node_end; WORD version = impl->base.dinput->dwVersion; BOOL ret, seen_axis[6] = {0}; + const GUID *hack_guid; + const WCHAR *hack_name; const WCHAR *tmp; button_ofs += impl->caps.NumberInputValueCaps * sizeof(LONG); @@ -559,6 +561,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, value_ofs += (caps->usage_max - caps->usage_min + 1) * sizeof(LONG); else for (j = caps->usage_min; j <= caps->usage_max; ++j) { + hack_name = NULL; + hack_guid = NULL; instance.dwOfs = value_ofs; switch (MAKELONG(j, caps->usage_page)) { @@ -605,12 +609,16 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, } instance.wUsagePage = caps->usage_page; instance.wUsage = j; - instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage ); + if (hack_guid) + instance.guidType = *hack_guid; + else + instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage ); instance.wReportId = caps->report_id; instance.wCollectionNumber = caps->link_collection; instance.dwDimension = caps->units; instance.wExponent = caps->units_exp; - if ((tmp = object_usage_to_string( &instance ))) lstrcpynW( instance.tszName, tmp, MAX_PATH ); + if (hack_name) lstrcpynW( instance.tszName, hack_name, MAX_PATH ); + else if ((tmp = object_usage_to_string( &instance ))) lstrcpynW( instance.tszName, tmp, MAX_PATH ); else swprintf( instance.tszName, MAX_PATH, L"Unknown %u", DIDFT_GETINSTANCE( instance.dwType ) ); check_pid_effect_axis_caps( impl, &instance ); ret = enum_object( impl, filter, flags, callback, object, caps, &instance, data ); From 98f1413ca38852ac15694c3ae599669d2a4aacf3 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 18 Jan 2022 14:30:46 +0200 Subject: [PATCH 0082/1506] dinput: Add mapping for Logitech G920. The wheel has a custom mapping and type override on Windows that do not correspond what dinput would create by itself basing on HID descriptors. --- dlls/dinput/joystick_hid.c | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 8bd61412b05..61e1b9a2a16 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -47,6 +47,9 @@ #include "wine/debug.h" #include "wine/hid.h" +#define VID_LOGITECH 0x046D +#define PID_LOGITECH_G920 0xC262 + WINE_DEFAULT_DEBUG_CHANNEL(dinput); DEFINE_GUID( GUID_DEVINTERFACE_WINEXINPUT,0x6c53d5fd,0x6480,0x440f,0xb6,0x18,0x47,0x67,0x50,0xc5,0xe1,0xa6 ); @@ -572,7 +575,38 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, case MAKELONG(HID_USAGE_GENERIC_RX, HID_USAGE_PAGE_GENERIC): case MAKELONG(HID_USAGE_GENERIC_RY, HID_USAGE_PAGE_GENERIC): case MAKELONG(HID_USAGE_GENERIC_RZ, HID_USAGE_PAGE_GENERIC): - set_axis_type( &instance, seen_axis, j - HID_USAGE_GENERIC_X, &axis ); + if (impl->attrs.VendorID == VID_LOGITECH && impl->attrs.ProductID == PID_LOGITECH_G920) + { + if (j == HID_USAGE_GENERIC_X) + { + set_axis_type( &instance, seen_axis, 0, &axis ); + hack_guid = &GUID_XAxis; + hack_name = L"Wheel axis"; + } + else if (j == HID_USAGE_GENERIC_Y) + { + set_axis_type( &instance, seen_axis, 2, &axis ); + hack_guid = &GUID_YAxis; + hack_name = L"Accelerator"; + } + else if (j == HID_USAGE_GENERIC_Z) + { + set_axis_type( &instance, seen_axis, 5, &axis ); + hack_guid = &GUID_RzAxis; + hack_name = L"Brake"; + } + else if (j == HID_USAGE_GENERIC_RZ) + { + instance.dwType = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 6 + axis++ ); + hack_guid = &GUID_Slider; + hack_name = L"Clutch"; + } + else WARN("unknown axis usage page %x usage %lx for Logitech G920\n", caps->usage_page, j); + } + else + { + set_axis_type( &instance, seen_axis, j - HID_USAGE_GENERIC_X, &axis ); + } instance.dwFlags = DIDOI_ASPECTPOSITION; break; case MAKELONG(HID_USAGE_SIMULATION_STEERING, HID_USAGE_PAGE_SIMULATION): @@ -1539,6 +1573,9 @@ static HRESULT hid_joystick_device_try_open( const WCHAR *path, HANDLE *device, break; } + if (attrs->VendorID == VID_LOGITECH && attrs->ProductID == PID_LOGITECH_G920) + type = DI8DEVTYPE_DRIVING | (DI8DEVTYPEDRIVING_DUALPEDALS << 8); + instance->dwDevType = device_type_for_version( type, version ) | DIDEVTYPE_HID; TRACE("detected device type %#lx\n", instance->dwDevType); From 2fa249a43c39d39bd3aa116b6b1d507311bb21ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 11 Oct 2021 10:48:49 +0200 Subject: [PATCH 0083/1506] HACK: proton: xinput1_3: Check Steam overlay presence and disconnect controllers when enabled. Squashed with: HACK: gamescope: xinput1_3: Ignore gamepad input when Steam Keyboard is opened. --- dlls/xinput1_3/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index e69553fba16..3e3aa95f881 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -122,6 +122,8 @@ static struct xinput_controller controllers[XUSER_MAX_COUNT] = static HMODULE xinput_instance; static HANDLE start_event; static HANDLE update_event; +static HANDLE steam_overlay_event; +static HANDLE steam_keyboard_event; static BOOL find_opened_device(const WCHAR *device_path, int *free_slot) { @@ -741,6 +743,9 @@ static BOOL WINAPI start_update_thread_once( INIT_ONCE *once, void *param, void if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (void*)hid_update_thread_proc, &module)) WARN("Failed to increase module's reference count, error: %lu\n", GetLastError()); + steam_overlay_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_GameOverlayActivated"); + steam_keyboard_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_KeyboardActivated"); + start_event = CreateEventA(NULL, FALSE, FALSE, NULL); if (!start_event) ERR("failed to create start event, error %lu\n", GetLastError()); @@ -827,7 +832,9 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputSetState(DWORD index, XINPUT_VIBRATION *vib if (index >= XUSER_MAX_COUNT) return ERROR_BAD_ARGUMENTS; if (!controller_lock(&controllers[index])) return ERROR_DEVICE_NOT_CONNECTED; - ret = HID_set_state(&controllers[index], vibration); + if (WaitForSingleObject(steam_overlay_event, 0) == WAIT_OBJECT_0) ret = ERROR_SUCCESS; + else if (WaitForSingleObject(steam_keyboard_event, 0) == WAIT_OBJECT_0) ret = ERROR_SUCCESS; + else ret = HID_set_state(&controllers[index], vibration); controller_unlock(&controllers[index]); @@ -845,7 +852,10 @@ static DWORD xinput_get_state(DWORD index, XINPUT_STATE *state) if (index >= XUSER_MAX_COUNT) return ERROR_BAD_ARGUMENTS; if (!controller_lock(&controllers[index])) return ERROR_DEVICE_NOT_CONNECTED; - *state = controllers[index].state; + if (WaitForSingleObject(steam_overlay_event, 0) == WAIT_OBJECT_0) memset(state, 0, sizeof(*state)); + else if (WaitForSingleObject(steam_keyboard_event, 0) == WAIT_OBJECT_0) memset(state, 0, sizeof(*state)); + else *state = controllers[index].state; + controller_unlock(&controllers[index]); return ERROR_SUCCESS; From 85654393d61d26173e7799f7c6bff6fdeda1b342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 9 Jan 2021 20:11:52 +0100 Subject: [PATCH 0084/1506] HACK: proton: dinput: Check Steam overlay presence and clear device state when enabled. CW-Bug-Id: #20083 --- dlls/dinput/dinput_main.c | 7 +++++++ dlls/dinput/dinput_private.h | 2 ++ dlls/dinput/joystick_hid.c | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index f99ebbc2404..384159eba0d 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -486,6 +486,9 @@ void check_dinput_events(void) MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0); } +HANDLE steam_overlay_event; +HANDLE steam_keyboard_event; + BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) { TRACE( "inst %p, reason %lu, reserved %p.\n", inst, reason, reserved ); @@ -494,12 +497,16 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(inst); + steam_overlay_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_GameOverlayActivated"); + steam_keyboard_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_KeyboardActivated"); DINPUT_instance = inst; register_di_em_win_class(); break; case DLL_PROCESS_DETACH: if (reserved) break; unregister_di_em_win_class(); + CloseHandle(steam_overlay_event); + CloseHandle(steam_keyboard_event); break; } return TRUE; diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 0609b816b3b..0dcf76d0564 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -46,6 +46,8 @@ struct dinput extern const IDirectInput7AVtbl dinput7_a_vtbl; extern const IDirectInput8AVtbl dinput8_a_vtbl; +extern HANDLE steam_overlay_event; +extern HANDLE steam_keyboard_event; extern void dinput_internal_addref( struct dinput *dinput ); extern void dinput_internal_release( struct dinput *dinput ); diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 61e1b9a2a16..97165eb18f1 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1138,6 +1138,7 @@ struct parse_device_state_params { BYTE old_state[DEVICE_STATE_MAX_SIZE]; BYTE buttons[128]; + BOOL reset_state; DWORD time; DWORD seq; }; @@ -1153,6 +1154,8 @@ static BOOL check_device_state_button( struct dinput_device *device, UINT index, value = params->buttons[instance->wUsage - 1]; old_value = params->old_state[instance->dwOfs]; + if (params->reset_state) value = 0; + device->device_state[instance->dwOfs] = value; if (old_value != value) queue_event( iface, index, value, params->time, params->seq ); @@ -1238,6 +1241,16 @@ static BOOL read_device_state_value( struct dinput_device *device, UINT index, s if (instance->dwType & DIDFT_AXIS) value = scale_axis_value( logical_value, properties ); else value = scale_value( logical_value, properties ); + if (params->reset_state) + { + if (instance->dwType & DIDFT_POV) value = -1; + else if (instance->dwType & DIDFT_AXIS) + { + if (!properties->range_min) value = properties->range_max / 2; + else value = round( (properties->range_min + properties->range_max) / 2.0 ); + } + } + old_value = *(LONG *)(params->old_state + instance->dwOfs); *(LONG *)(impl->base.device_state + instance->dwOfs) = value; if (old_value != value) queue_event( iface, index, value, params->time, params->seq ); @@ -1267,6 +1280,12 @@ static HRESULT hid_joystick_read( IDirectInputDevice8W *iface ) ret = GetOverlappedResult( impl->device, &impl->read_ovl, &count, FALSE ); + if (WaitForSingleObject(steam_overlay_event, 0) == WAIT_OBJECT_0 || /* steam overlay is enabled */ + WaitForSingleObject(steam_keyboard_event, 0) == WAIT_OBJECT_0) /* steam keyboard is enabled */ + params.reset_state = TRUE; + else + params.reset_state = FALSE; + EnterCriticalSection( &impl->base.crit ); while (ret) { From a516e891dfb86ac7e911cb7d5f3526e5e4f4f920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 4 Feb 2022 11:34:26 +0100 Subject: [PATCH 0085/1506] HACK: proton: hidclass.sys: Do not send WM_INPUT messages when overlay is open. So that games listening to them, such as ICEY, do not have input bleeding through the overlay. Note that some other games, such as Hades, which are reading the HID devices directly, have the input bleeding through on Windows, so we do the same here. CW-Bug-Id: #20083 --- dlls/hidclass.sys/device.c | 7 ++++++- dlls/hidclass.sys/hid.h | 6 ++++++ dlls/hidclass.sys/pnp.c | 12 ++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 8fde1fe10a5..7d1b9d2c356 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -223,6 +223,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack const BOOL polled = ext->u.pdo.information.Polled; ULONG size, report_len = polled ? packet->reportBufferLen : desc->InputLength; struct hid_report *last_report, *report; + BOOL steam_overlay_open = FALSE; struct hid_queue *queue; LIST_ENTRY completed, *entry; RAWINPUT *rawinput; @@ -231,7 +232,11 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack TRACE("device %p, packet %p\n", device, packet); - if (IsEqualGUID( ext->class_guid, &GUID_DEVINTERFACE_HID )) + if (WaitForSingleObject(ext->steam_overlay_event, 0) == WAIT_OBJECT_0 || /* steam overlay is open */ + WaitForSingleObject(ext->steam_keyboard_event, 0) == WAIT_OBJECT_0) /* steam keyboard is open */ + steam_overlay_open = TRUE; + + if (IsEqualGUID( ext->class_guid, &GUID_DEVINTERFACE_HID ) && !steam_overlay_open) { size = offsetof( RAWINPUT, data.hid.bRawData[report_len] ); if (!(rawinput = malloc( size ))) ERR( "Failed to allocate rawinput data!\n" ); diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index 3eefbf87f63..e9bd85612fa 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -84,6 +84,9 @@ typedef struct _BASE_DEVICE_EXTENSION WCHAR container_id[MAX_GUID_STRING_LEN]; const GUID *class_guid; + HANDLE steam_overlay_event; + HANDLE steam_keyboard_event; + BOOL is_fdo; } BASE_DEVICE_EXTENSION; @@ -115,6 +118,9 @@ typedef struct _minidriver PDRIVER_ADD_DEVICE AddDevice; PDRIVER_DISPATCH PNPDispatch; + + HANDLE steam_overlay_event; + HANDLE steam_keyboard_event; } minidriver; void call_minidriver( ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index ab3cd5b2cb5..317bee640d7 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -178,6 +178,9 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b if (get_device_id(bus_pdo, BusQueryContainerID, ext->container_id)) ext->container_id[0] = 0; + ext->steam_overlay_event = minidriver->steam_overlay_event; + ext->steam_keyboard_event = minidriver->steam_keyboard_event; + is_xinput_class = !wcsncmp(device_id, L"WINEXINPUT\\", 7) && wcsstr(device_id, L"&XI_") != NULL; if (is_xinput_class) ext->class_guid = &GUID_DEVINTERFACE_WINEXINPUT; else ext->class_guid = &GUID_DEVINTERFACE_HID; @@ -242,6 +245,9 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo) pdo_ext->u.pdo.information.VersionNumber = attr.VersionNumber; pdo_ext->u.pdo.information.Polled = minidriver->minidriver.DevicesArePolled; + pdo_ext->steam_overlay_event = minidriver->steam_overlay_event; + pdo_ext->steam_keyboard_event = minidriver->steam_keyboard_event; + call_minidriver( IOCTL_HID_GET_DEVICE_DESCRIPTOR, fdo, NULL, 0, &descriptor, sizeof(descriptor), &io ); if (io.Status != STATUS_SUCCESS) { @@ -591,6 +597,9 @@ static void WINAPI driver_unload(DRIVER_OBJECT *driver) if (md->DriverUnload) md->DriverUnload(md->minidriver.DriverObject); list_remove(&md->entry); + + CloseHandle(md->steam_overlay_event); + CloseHandle(md->steam_keyboard_event); free(md); } } @@ -606,6 +615,9 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration) if (!(driver = calloc(1, sizeof(*driver)))) return STATUS_NO_MEMORY; + driver->steam_overlay_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_GameOverlayActivated"); + driver->steam_keyboard_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_KeyboardActivated"); + driver->DriverUnload = registration->DriverObject->DriverUnload; registration->DriverObject->DriverUnload = driver_unload; From 2740bfac21b4dd05c81cdca58320e110da89c14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 09:01:34 +0100 Subject: [PATCH 0086/1506] HACK: proton: winebus.sys: Check for Steam Virtual controller indexes. And expose them as the device input number, in the IG_xx / XI_xx suffixes, and as non-zero values. CW-Bug-Id: #20528 --- dlls/winebus.sys/bus_sdl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index f4b27f820eb..f0541a1f5d8 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -962,7 +962,7 @@ static void sdl_add_device(unsigned int index) SDL_Joystick* joystick; SDL_JoystickID id; SDL_GameController *controller = NULL; - const char *product, *sdl_serial; + const char *product, *sdl_serial, *str; char guid_str[33], buffer[ARRAY_SIZE(desc.product)]; int axis_count, axis_offset; @@ -1015,6 +1015,10 @@ static void sdl_add_device(unsigned int index) desc.pid = 0x028e; } + /* CW-Bug-Id: #20528 Check steam virtual controller indexes to keep them ordered */ + if ((str = pSDL_JoystickName(joystick)) && sscanf(str, "Microsoft X-Box 360 pad %u", &desc.input) == 1) desc.input++; + else desc.input = -1; + if (pSDL_JoystickGetSerial && (sdl_serial = pSDL_JoystickGetSerial(joystick))) { ntdll_umbstowcs(sdl_serial, strlen(sdl_serial) + 1, desc.serialnumber, ARRAY_SIZE(desc.serialnumber)); From e7e16180e7ac3e247e2431a8b339b0b32b7f5cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 23 Nov 2022 01:02:13 +0100 Subject: [PATCH 0087/1506] HACK: proton: xinput1_3: Introduce new open_device_at_index helper. CW-Bug-Id: #20528 --- dlls/xinput1_3/main.c | 119 +++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 55 deletions(-) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index 3e3aa95f881..5e5523b2eb5 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -125,19 +125,6 @@ static HANDLE update_event; static HANDLE steam_overlay_event; static HANDLE steam_keyboard_event; -static BOOL find_opened_device(const WCHAR *device_path, int *free_slot) -{ - int i; - - *free_slot = XUSER_MAX_COUNT; - for (i = XUSER_MAX_COUNT; i > 0; i--) - { - if (!controllers[i - 1].device) *free_slot = i - 1; - else if (!wcsicmp(device_path, controllers[i - 1].device_path)) return TRUE; - } - return FALSE; -} - static void check_value_caps(struct xinput_controller *controller, USHORT usage, HIDP_VALUE_CAPS *caps) { switch (usage) @@ -339,7 +326,40 @@ static DWORD HID_set_state(struct xinput_controller *controller, XINPUT_VIBRATIO return ERROR_SUCCESS; } -static void controller_destroy(struct xinput_controller *controller, BOOL already_removed); +static void controller_disable(struct xinput_controller *controller) +{ + XINPUT_VIBRATION state = {0}; + + if (!controller->enabled) return; + if (controller->caps.Flags & XINPUT_CAPS_FFB_SUPPORTED) HID_set_state(controller, &state); + controller->enabled = FALSE; + + CancelIoEx(controller->device, &controller->hid.read_ovl); + WaitForSingleObject(controller->hid.read_ovl.hEvent, INFINITE); + SetEvent(update_event); +} + +static void controller_destroy(struct xinput_controller *controller, BOOL already_removed) +{ + EnterCriticalSection(&controller->crit); + + if (controller->device) + { + TRACE("removing device %s from index %Iu\n", debugstr_w(controller->device_path), controller - controllers); + + if (!already_removed) controller_disable(controller); + CloseHandle(controller->device); + controller->device = NULL; + + free(controller->hid.input_report_buf); + free(controller->hid.output_report_buf); + free(controller->hid.feature_report_buf); + HidD_FreePreparsedData(controller->hid.preparsed); + memset(&controller->hid, 0, sizeof(controller->hid)); + } + + LeaveCriticalSection(&controller->crit); +} static void controller_enable(struct xinput_controller *controller) { @@ -359,19 +379,6 @@ static void controller_enable(struct xinput_controller *controller) else SetEvent(update_event); } -static void controller_disable(struct xinput_controller *controller) -{ - XINPUT_VIBRATION state = {0}; - - if (!controller->enabled) return; - if (controller->caps.Flags & XINPUT_CAPS_FFB_SUPPORTED) HID_set_state(controller, &state); - controller->enabled = FALSE; - - CancelIoEx(controller->device, &controller->hid.read_ovl); - WaitForSingleObject(controller->hid.read_ovl.hEvent, INFINITE); - SetEvent(update_event); -} - static BOOL controller_init(struct xinput_controller *controller, PHIDP_PREPARSED_DATA preparsed, HIDP_CAPS *caps, HANDLE device, const WCHAR *device_path) { @@ -455,21 +462,17 @@ static BOOL device_is_overridden(HANDLE device) return disable; } -static BOOL try_add_device(const WCHAR *device_path) +static void open_device_at_index(const WCHAR *device_path, int index) { SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; PHIDP_PREPARSED_DATA preparsed; HIDP_CAPS caps; NTSTATUS status; HANDLE device; - int i; - - if (find_opened_device(device_path, &i)) return TRUE; /* already opened */ - if (i == XUSER_MAX_COUNT) return FALSE; /* no more slots */ device = CreateFileW(device_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); - if (device == INVALID_HANDLE_VALUE) return TRUE; + if (device == INVALID_HANDLE_VALUE) return; preparsed = NULL; if (!HidD_GetPreparsedData(device, &preparsed)) @@ -483,13 +486,39 @@ static BOOL try_add_device(const WCHAR *device_path) WARN("ignoring HID device, unsupported usage %04x:%04x\n", caps.UsagePage, caps.Usage); else if (device_is_overridden(device)) WARN("ignoring HID device, overridden for dinput\n"); - else if (!controller_init(&controllers[i], preparsed, &caps, device, device_path)) + else if (!controller_init(&controllers[index], preparsed, &caps, device, device_path)) WARN("ignoring HID device, failed to initialize\n"); else - return TRUE; + { + TRACE("opened device %s at index %u\n", debugstr_w(device_path), index); + return; + } CloseHandle(device); HidD_FreePreparsedData(preparsed); +} + +static BOOL find_opened_device(const WCHAR *device_path, int *free_slot) +{ + int i; + + *free_slot = XUSER_MAX_COUNT; + for (i = XUSER_MAX_COUNT; i > 0; i--) + { + if (!controllers[i - 1].device) *free_slot = i - 1; + else if (!wcsicmp(device_path, controllers[i - 1].device_path)) return TRUE; + } + return FALSE; +} + +static BOOL try_add_device(const WCHAR *device_path) +{ + SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; + int i; + + if (find_opened_device(device_path, &i)) return TRUE; /* already opened */ + if (i == XUSER_MAX_COUNT) return FALSE; /* no more slots */ + open_device_at_index(device_path, i); return TRUE; } @@ -527,26 +556,6 @@ static void update_controller_list(void) SetupDiDestroyDeviceInfoList(set); } -static void controller_destroy(struct xinput_controller *controller, BOOL already_removed) -{ - EnterCriticalSection(&controller->crit); - - if (controller->device) - { - if (!already_removed) controller_disable(controller); - CloseHandle(controller->device); - controller->device = NULL; - - free(controller->hid.input_report_buf); - free(controller->hid.output_report_buf); - free(controller->hid.feature_report_buf); - HidD_FreePreparsedData(controller->hid.preparsed); - memset(&controller->hid, 0, sizeof(controller->hid)); - } - - LeaveCriticalSection(&controller->crit); -} - static LONG sign_extend(ULONG value, const HIDP_VALUE_CAPS *caps) { UINT sign = 1 << (caps->BitSize - 1); From 25ecc6c5c0107599ec3ef40f793eb7fd97c62d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 21 Apr 2022 13:17:38 +0200 Subject: [PATCH 0088/1506] HACK: proton: xinput1_3: Insert Steam virtual controllers in their expected slot. CW-Bug-Id: #20528 --- dlls/xinput1_3/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index 5e5523b2eb5..a18f63545cc 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -508,6 +508,17 @@ static BOOL find_opened_device(const WCHAR *device_path, int *free_slot) if (!controllers[i - 1].device) *free_slot = i - 1; else if (!wcsicmp(device_path, controllers[i - 1].device_path)) return TRUE; } + + /* CW-Bug-Id: #20528 Keep steam virtual controller ordered, swap existing controllers out of the slot */ + if ((swscanf(device_path, L"\\\\?\\hid#vid_045e&pid_028e&xi_%02x#", &i) == 1 || + swscanf(device_path, L"\\\\?\\HID#VID_045E&PID_028E&XI_%02X#", &i) == 1) && + i > 0 && i <= XUSER_MAX_COUNT && *free_slot != i - 1) + { + controller_destroy(&controllers[i - 1], TRUE); + if (*free_slot != XUSER_MAX_COUNT) open_device_at_index(controllers[i - 1].device_path, *free_slot); + *free_slot = i - 1; + } + return FALSE; } From d44c830e2a550c63e1c740ea87e9e9213cf91670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 5 Jan 2022 16:14:02 +0100 Subject: [PATCH 0089/1506] user32: Add or remove rawinput devices individually on WM_DEVICECHANGE. CW-Bug-Id: #19841 CW-Bug-Id: #19843 CW-Bug-Id: #19844 --- dlls/win32u/rawinput.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index bd2e00a31c4..6ca0e5d7141 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -780,7 +780,24 @@ BOOL process_rawinput_message( MSG *msg, UINT hw_id, const struct hardware_msg_d if (msg->message == WM_INPUT_DEVICE_CHANGE) { pthread_mutex_lock( &rawinput_mutex ); - rawinput_update_device_list(); + if (msg_data->rawinput.type != RIM_TYPEHID || msg_data->rawinput.hid.param != GIDC_REMOVAL) + rawinput_update_device_list(); + else + { + struct device *device; + + LIST_FOR_EACH_ENTRY( device, &devices, struct device, entry ) + { + if (device->handle == UlongToHandle(msg_data->rawinput.hid.device)) + { + list_remove( &device->entry ); + NtClose( device->file ); + free( device->data ); + free( device ); + break; + } + } + } pthread_mutex_unlock( &rawinput_mutex ); } else From 72f0f1b232ac1dbb2557962670e92dbcb9cb2069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 09:05:04 +0100 Subject: [PATCH 0090/1506] windows.gaming.input: Only create Gamepad instances for XInput devices. --- dlls/windows.gaming.input/provider.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index 6908d733a53..d0472727224 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -152,16 +152,18 @@ static HRESULT WINAPI wine_provider_get_Type( IWineGameControllerProvider *iface { struct provider *impl = impl_from_IWineGameControllerProvider( iface ); DIDEVICEINSTANCEW instance = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + const WCHAR *tmp; HRESULT hr; TRACE( "iface %p, value %p.\n", iface, value ); if (FAILED(hr = IDirectInputDevice8_GetDeviceInfo( impl->dinput_device, &instance ))) return hr; - switch (GET_DIDEVICE_TYPE( instance.dwDevType )) + if ((tmp = wcschr( impl->device_path + 8, '#' )) && !wcsnicmp( tmp - 6, L"&XI_", 4 )) + *value = WineGameControllerType_Gamepad; + else switch (GET_DIDEVICE_TYPE( instance.dwDevType )) { case DI8DEVTYPE_DRIVING: *value = WineGameControllerType_RacingWheel; break; - case DI8DEVTYPE_GAMEPAD: *value = WineGameControllerType_Gamepad; break; default: { DWORD count = 0; From de0ada60f85743c3477296b9593e606a139ba76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 2 Jun 2022 08:45:04 +0200 Subject: [PATCH 0091/1506] winebus.sys: Always return success from PID effect control. Forza Horizon 5 doesn't like unsupported racing wheel force feedback effects. CW-Bug-Id: #20434 --- dlls/winebus.sys/bus_sdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index f0541a1f5d8..d3c64864cfe 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -615,7 +615,7 @@ static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BY TRACE("iface %p, index %u, control %04x, iterations %u.\n", iface, index, control, iterations); - if (impl->effect_ids[index] < 0) return STATUS_UNSUCCESSFUL; + if (id < 0) return STATUS_SUCCESS; switch (control) { From 28edbfa6a2a32e938ceeb1d262deae18a65f451d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 2 Jun 2022 00:11:15 +0200 Subject: [PATCH 0092/1506] winebus.sys: Enable all PID effect types for wheel devices. Forza Horizon 5 doesn't like unsupported racing wheel force feedback effects and gives up too soon. On Windows many wheel devices have custom drivers which report support for all types of force feedback effects. CW-Bug-Id: #20434 --- dlls/winebus.sys/bus_sdl.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index d3c64864cfe..4215676a986 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -198,7 +198,7 @@ static void set_hat_value(struct unix_device *iface, int index, int value) hid_device_set_hatswitch_y(iface, index, y); } -static BOOL descriptor_add_haptic(struct sdl_device *impl) +static BOOL descriptor_add_haptic(struct sdl_device *impl, BOOL force) { USHORT i, count = 0; USAGE usages[16]; @@ -227,16 +227,16 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) if ((impl->effect_support & EFFECT_SUPPORT_PHYSICAL)) { /* SDL_HAPTIC_SQUARE doesn't exist */ - if (impl->effect_support & SDL_HAPTIC_SINE) usages[count++] = PID_USAGE_ET_SINE; - if (impl->effect_support & SDL_HAPTIC_TRIANGLE) usages[count++] = PID_USAGE_ET_TRIANGLE; - if (impl->effect_support & SDL_HAPTIC_SAWTOOTHUP) usages[count++] = PID_USAGE_ET_SAWTOOTH_UP; - if (impl->effect_support & SDL_HAPTIC_SAWTOOTHDOWN) usages[count++] = PID_USAGE_ET_SAWTOOTH_DOWN; - if (impl->effect_support & SDL_HAPTIC_SPRING) usages[count++] = PID_USAGE_ET_SPRING; - if (impl->effect_support & SDL_HAPTIC_DAMPER) usages[count++] = PID_USAGE_ET_DAMPER; - if (impl->effect_support & SDL_HAPTIC_INERTIA) usages[count++] = PID_USAGE_ET_INERTIA; - if (impl->effect_support & SDL_HAPTIC_FRICTION) usages[count++] = PID_USAGE_ET_FRICTION; - if (impl->effect_support & SDL_HAPTIC_CONSTANT) usages[count++] = PID_USAGE_ET_CONSTANT_FORCE; - if (impl->effect_support & SDL_HAPTIC_RAMP) usages[count++] = PID_USAGE_ET_RAMP; + if (force || (impl->effect_support & SDL_HAPTIC_SINE)) usages[count++] = PID_USAGE_ET_SINE; + if (force || (impl->effect_support & SDL_HAPTIC_TRIANGLE)) usages[count++] = PID_USAGE_ET_TRIANGLE; + if (force || (impl->effect_support & SDL_HAPTIC_SAWTOOTHUP)) usages[count++] = PID_USAGE_ET_SAWTOOTH_UP; + if (force || (impl->effect_support & SDL_HAPTIC_SAWTOOTHDOWN)) usages[count++] = PID_USAGE_ET_SAWTOOTH_DOWN; + if (force || (impl->effect_support & SDL_HAPTIC_SPRING)) usages[count++] = PID_USAGE_ET_SPRING; + if (force || (impl->effect_support & SDL_HAPTIC_DAMPER)) usages[count++] = PID_USAGE_ET_DAMPER; + if (force || (impl->effect_support & SDL_HAPTIC_INERTIA)) usages[count++] = PID_USAGE_ET_INERTIA; + if (force || (impl->effect_support & SDL_HAPTIC_FRICTION)) usages[count++] = PID_USAGE_ET_FRICTION; + if (force || (impl->effect_support & SDL_HAPTIC_CONSTANT)) usages[count++] = PID_USAGE_ET_CONSTANT_FORCE; + if (force || (impl->effect_support & SDL_HAPTIC_RAMP)) usages[count++] = PID_USAGE_ET_RAMP; if (!hid_device_add_physical(&impl->unix_device, usages, count)) return FALSE; @@ -382,7 +382,7 @@ static NTSTATUS build_joystick_report_descriptor(struct unix_device *iface) if (!hid_device_end_input_report(iface)) return STATUS_NO_MEMORY; - if (!descriptor_add_haptic(impl)) + if (!descriptor_add_haptic(impl, physical_usage.Usage == HID_USAGE_SIMULATION_AUTOMOBILE_SIMULATION_DEVICE)) return STATUS_NO_MEMORY; if (!hid_device_end_report_descriptor(iface)) @@ -436,7 +436,7 @@ static NTSTATUS build_controller_report_descriptor(struct unix_device *iface) if (!hid_device_end_input_report(iface)) return STATUS_NO_MEMORY; - if (!descriptor_add_haptic(impl)) + if (!descriptor_add_haptic(impl, FALSE)) return STATUS_NO_MEMORY; if (!hid_device_end_report_descriptor(iface)) From d7d83b27431987878ce3f3a28e0c9895c3a273f8 Mon Sep 17 00:00:00 2001 From: Ivo Ivanov Date: Tue, 25 Oct 2022 14:53:57 +0300 Subject: [PATCH 0093/1506] winebus.sys: Enable hidraw for Simucube racing wheels and Fanatec pedals. Signed-off-by: Ivo Ivanov --- dlls/winebus.sys/bus_udev.c | 3 ++- dlls/winebus.sys/unix_private.h | 2 ++ dlls/winebus.sys/unixlib.c | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 34538ed2a5e..3f7eaba3790 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1697,7 +1697,8 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid) && !is_thrustmaster_hotas(desc.vid, desc.pid)) + if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid) && !is_thrustmaster_hotas(desc.vid, desc.pid) && + !is_simucube_wheel(desc.vid, desc.pid) && !is_fanatec_pedals(desc.vid, desc.pid)) { TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); close(fd); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 0e1992b8e80..9ff3c3d2a72 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -273,5 +273,7 @@ BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); BOOL is_logitech_g920(WORD vid, WORD pid); BOOL is_thrustmaster_hotas(WORD vid, WORD pid); +BOOL is_simucube_wheel(WORD vid, WORD pid); +BOOL is_fanatec_pedals(WORD vid, WORD pid); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index e1406d81812..64ac7fa66ba 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -112,6 +112,24 @@ BOOL is_thrustmaster_hotas(WORD vid, WORD pid) return vid == 0x044F && (pid == 0xB679 || pid == 0xB687 || pid == 0xB10A); } +BOOL is_simucube_wheel(WORD vid, WORD pid) +{ + if (vid != 0x16D0) return FALSE; + if (pid == 0x0D61) return TRUE; /* Simucube 2 Sport */ + if (pid == 0x0D60) return TRUE; /* Simucube 2 Pro */ + if (pid == 0x0D5F) return TRUE; /* Simucube 2 Ultimate */ + if (pid == 0x0D5A) return TRUE; /* Simucube 1 */ + return FALSE; +} + +BOOL is_fanatec_pedals(WORD vid, WORD pid) +{ + if (vid != 0x0EB7) return FALSE; + if (pid == 0x183B) return TRUE; /* Fanatec ClubSport Pedals v3 */ + if (pid == 0x1839) return TRUE; /* Fanatec ClubSport Pedals v1/v2 */ + return FALSE; +} + struct mouse_device { struct unix_device unix_device; From 353f0abb396e3508bdce68e20869330e80726fbd Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 5 Dec 2022 22:31:40 +0200 Subject: [PATCH 0094/1506] winebus.sys: Don't consider wheels / flight sticks as controllers. CW-Bug-Id: #21657 --- dlls/winebus.sys/bus_sdl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 4215676a986..119293fa2d9 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -961,6 +961,7 @@ static void sdl_add_device(unsigned int index) SDL_Joystick* joystick; SDL_JoystickID id; + SDL_JoystickType joystick_type; SDL_GameController *controller = NULL; const char *product, *sdl_serial, *str; char guid_str[33], buffer[ARRAY_SIZE(desc.product)]; @@ -972,7 +973,10 @@ static void sdl_add_device(unsigned int index) return; } - if (options.map_controllers && pSDL_IsGameController(index)) + joystick_type = pSDL_JoystickGetType(joystick); + if (options.map_controllers && pSDL_IsGameController(index) + && joystick_type != SDL_JOYSTICK_TYPE_WHEEL + && joystick_type != SDL_JOYSTICK_TYPE_FLIGHT_STICK) controller = pSDL_GameControllerOpen(index); if (controller) product = pSDL_GameControllerName(controller); From 2e49397bb3e3b1e7855b800d24dd5b42e5da6286 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Fri, 2 Dec 2022 20:56:46 +0200 Subject: [PATCH 0095/1506] dinput: Don't apply G920 mapping when used through windows.gaming.input. Our windows.gaming.input.dll implementation is built on top of dinput while on Windows it seems to be completely independent. This means it doesn't respect the mapping entries created by Logitech's drivers for dinput and does regular axis mapping on top of hid. Because of that we have to ignore our dinput mapping for the device when we know it was opened through the special WGI GUID. --- dlls/dinput/joystick_hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 97165eb18f1..b5fc76b9222 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -175,6 +175,7 @@ struct pid_effect_state struct hid_joystick { struct dinput_device base; + BOOL wgi_device; HANDLE device; OVERLAPPED read_ovl; @@ -575,7 +576,7 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *filter, case MAKELONG(HID_USAGE_GENERIC_RX, HID_USAGE_PAGE_GENERIC): case MAKELONG(HID_USAGE_GENERIC_RY, HID_USAGE_PAGE_GENERIC): case MAKELONG(HID_USAGE_GENERIC_RZ, HID_USAGE_PAGE_GENERIC): - if (impl->attrs.VendorID == VID_LOGITECH && impl->attrs.ProductID == PID_LOGITECH_G920) + if (!impl->wgi_device && impl->attrs.VendorID == VID_LOGITECH && impl->attrs.ProductID == PID_LOGITECH_G920) { if (j == HID_USAGE_GENERIC_X) { @@ -2081,6 +2082,7 @@ HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDi &attrs, &impl->caps, dinput->dwVersion ); else { + impl->wgi_device = TRUE; wcscpy( impl->device_path, *(const WCHAR **)guid ); hr = hid_joystick_device_try_open( impl->device_path, &impl->device, &impl->preparsed, &attrs, &impl->caps, &impl->base.instance, dinput->dwVersion ); From ef1041643ac99c4d3463b8b07689601d861f7e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 3 Dec 2022 08:03:58 +0100 Subject: [PATCH 0096/1506] HACK: winebus.sys: Introduce a new PROTON_ENABLE_HIDRAW environment variable. To easily enable hidraw for new devices. --- dlls/winebus.sys/bus_udev.c | 3 +-- dlls/winebus.sys/unix_private.h | 5 +--- dlls/winebus.sys/unixlib.c | 45 ++++++++++++++------------------- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 3f7eaba3790..d3c4b705968 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1697,8 +1697,7 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (!is_dualshock4_gamepad(desc.vid, desc.pid) && !is_dualsense_gamepad(desc.vid, desc.pid) && !is_thrustmaster_hotas(desc.vid, desc.pid) && - !is_simucube_wheel(desc.vid, desc.pid) && !is_fanatec_pedals(desc.vid, desc.pid)) + if (!is_hidraw_enabled(desc.vid, desc.pid)) { TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); close(fd); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 9ff3c3d2a72..fed2aa9da26 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -268,12 +268,9 @@ extern void hid_device_set_effect_state(struct unix_device *iface, BYTE index, B BOOL is_sdl_blacklisted(WORD vid, WORD pid); BOOL is_wine_blacklisted(WORD vid, WORD pid); -BOOL is_xbox_gamepad(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); BOOL is_logitech_g920(WORD vid, WORD pid); -BOOL is_thrustmaster_hotas(WORD vid, WORD pid); -BOOL is_simucube_wheel(WORD vid, WORD pid); -BOOL is_fanatec_pedals(WORD vid, WORD pid); +BOOL is_hidraw_enabled(WORD vid, WORD pid); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 64ac7fa66ba..97574bc973c 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -62,29 +62,6 @@ BOOL is_sdl_blacklisted(WORD vid, WORD pid) return FALSE; } -BOOL is_xbox_gamepad(WORD vid, WORD pid) -{ - if (vid != 0x045e) return FALSE; - if (pid == 0x0202) return TRUE; /* Xbox Controller */ - if (pid == 0x0285) return TRUE; /* Xbox Controller S */ - if (pid == 0x0289) return TRUE; /* Xbox Controller S */ - if (pid == 0x028e) return TRUE; /* Xbox360 Controller */ - if (pid == 0x028f) return TRUE; /* Xbox360 Wireless Controller */ - if (pid == 0x02d1) return TRUE; /* Xbox One Controller */ - if (pid == 0x02dd) return TRUE; /* Xbox One Controller (Covert Forces/Firmware 2015) */ - if (pid == 0x02e0) return TRUE; /* Xbox One X Controller */ - if (pid == 0x02e3) return TRUE; /* Xbox One Elite Controller */ - if (pid == 0x02e6) return TRUE; /* Wireless XBox Controller Dongle */ - if (pid == 0x02ea) return TRUE; /* Xbox One S Controller */ - if (pid == 0x02fd) return TRUE; /* Xbox One S Controller (Firmware 2017) */ - if (pid == 0x0b00) return TRUE; /* Xbox Elite 2 */ - if (pid == 0x0b05) return TRUE; /* Xbox Elite 2 Wireless */ - if (pid == 0x0b12) return TRUE; /* Xbox Series */ - if (pid == 0x0b13) return TRUE; /* Xbox Series Wireless */ - if (pid == 0x0719) return TRUE; /* Xbox 360 Wireless Adapter */ - return FALSE; -} - BOOL is_dualshock4_gamepad(WORD vid, WORD pid) { if (vid != 0x054c) return FALSE; @@ -107,12 +84,12 @@ BOOL is_logitech_g920(WORD vid, WORD pid) return vid == 0x046D && pid == 0xC262; } -BOOL is_thrustmaster_hotas(WORD vid, WORD pid) +static BOOL is_thrustmaster_hotas(WORD vid, WORD pid) { return vid == 0x044F && (pid == 0xB679 || pid == 0xB687 || pid == 0xB10A); } -BOOL is_simucube_wheel(WORD vid, WORD pid) +static BOOL is_simucube_wheel(WORD vid, WORD pid) { if (vid != 0x16D0) return FALSE; if (pid == 0x0D61) return TRUE; /* Simucube 2 Sport */ @@ -122,7 +99,7 @@ BOOL is_simucube_wheel(WORD vid, WORD pid) return FALSE; } -BOOL is_fanatec_pedals(WORD vid, WORD pid) +static BOOL is_fanatec_pedals(WORD vid, WORD pid) { if (vid != 0x0EB7) return FALSE; if (pid == 0x183B) return TRUE; /* Fanatec ClubSport Pedals v3 */ @@ -130,6 +107,22 @@ BOOL is_fanatec_pedals(WORD vid, WORD pid) return FALSE; } +BOOL is_hidraw_enabled(WORD vid, WORD pid) +{ + const char *enabled = getenv("PROTON_ENABLE_HIDRAW"); + char needle[16]; + + if (is_dualshock4_gamepad(vid, pid)) return TRUE; + if (is_dualsense_gamepad(vid, pid)) return TRUE; + if (is_thrustmaster_hotas(vid, pid)) return TRUE; + if (is_simucube_wheel(vid, pid)) return TRUE; + if (is_fanatec_pedals(vid, pid)) return TRUE; + + sprintf(needle, "0x%04x/0x%04x", vid, pid); + if (enabled) return strcasestr(enabled, needle) != NULL; + return FALSE; +} + struct mouse_device { struct unix_device unix_device; From c83690fa4f65401bff17654d8a30b90cf33cc2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 7 Sep 2023 19:41:46 +0200 Subject: [PATCH 0097/1506] dinput: Assume that clipping the cursor succeeds. Fixes a regression (in Deathloop) where it falls back to SetCursorPos as we now sometimes shrink the clipping rectangle. CW-Bug-Id: #21707 --- dlls/dinput/mouse.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index ec30c825733..d376546f1a9 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -306,8 +306,8 @@ static void warp_check( struct mouse *impl, BOOL force ) if (force || (impl->need_warp && (now - impl->last_warped > interval))) { - RECT rect, new_rect; POINT mapped_center; + RECT rect; impl->last_warped = now; impl->need_warp = FALSE; @@ -328,8 +328,7 @@ static void warp_check( struct mouse *impl, BOOL force ) rect.right = min( rect.right, rect.left + GetSystemMetrics( SM_CXVIRTUALSCREEN ) - 2 ); rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 ); TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect )); - ClipCursor( &rect ); - impl->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect ); + impl->clipped = ClipCursor( &rect ); } } } From de8299c6a1b4c48aa7befc2bec40ae638c3e5124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 8 Sep 2023 19:26:51 +0200 Subject: [PATCH 0098/1506] dinput: Only call SetCursorPos if clipping fails. Fixes mouse sometimes jumping around in Mechwarrior Online on KDE/Wayland. CW-Bug-Id: #22650 --- dlls/dinput/mouse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index d376546f1a9..2d4e0a6b42c 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -313,13 +313,6 @@ static void warp_check( struct mouse *impl, BOOL force ) impl->need_warp = FALSE; if (!GetClientRect( impl->base.win, &rect )) return; MapWindowPoints( impl->base.win, 0, (POINT *)&rect, 2 ); - if (!impl->clipped) - { - mapped_center.x = (rect.left + rect.right) / 2; - mapped_center.y = (rect.top + rect.bottom) / 2; - TRACE( "Warping mouse to x %+ld, y %+ld.\n", mapped_center.x, mapped_center.y ); - SetCursorPos( mapped_center.x, mapped_center.y ); - } if (impl->base.dwCoopLevel & DISCL_EXCLUSIVE) { /* make sure we clip even if the window covers the whole screen */ @@ -330,6 +323,13 @@ static void warp_check( struct mouse *impl, BOOL force ) TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect )); impl->clipped = ClipCursor( &rect ); } + if (!impl->clipped) + { + mapped_center.x = (rect.left + rect.right) / 2; + mapped_center.y = (rect.top + rect.bottom) / 2; + TRACE( "Warping mouse to x %+ld, y %+ld.\n", mapped_center.x, mapped_center.y ); + SetCursorPos( mapped_center.x, mapped_center.y ); + } } } From 2f15da53bf6d849f0ff8ea796c94378658a88501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 27 Sep 2023 08:24:58 +0200 Subject: [PATCH 0099/1506] winebus.sys: Append is_gamepad to the device instance id. Link: https://github.com/ValveSoftware/wine/pull/197 --- dlls/winebus.sys/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index ab096319d21..dae6850415d 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -190,7 +190,10 @@ static WCHAR *get_instance_id(DEVICE_OBJECT *device) WCHAR *dst; if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR)))) - swprintf(dst, len, L"%i&%s&%x&%i", ext->desc.version, ext->desc.serialnumber, ext->desc.uid, ext->index); + { + swprintf(dst, len, L"%u&%s&%x&%u&%u", ext->desc.version, ext->desc.serialnumber, + ext->desc.uid, ext->index, ext->desc.is_gamepad); + } return dst; } From fd6a380797384a81c7b2448abee3aacda6363b14 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sat, 2 Sep 2023 23:00:29 +0200 Subject: [PATCH 0100/1506] winebus.sys: Also pass axis and button count to is_hidraw_enabled() This is useful to detect some devices which do not have a well-known PID set. Link: https://github.com/ValveSoftware/Proton/issues/6839#issuecomment-1703856375 Link: https://github.com/ValveSoftware/wine/pull/197 --- dlls/winebus.sys/bus_udev.c | 11 +++++------ dlls/winebus.sys/unix_private.h | 2 +- dlls/winebus.sys/unixlib.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index d3c4b705968..5da979c6c5a 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1622,6 +1622,7 @@ static void udev_add_device(struct udev_device *dev, int fd) const char *subsystem; const char *devnode; int bus = 0; + int axes = -1, buttons = -1; if (!(devnode = udev_device_get_devnode(dev))) { @@ -1644,6 +1645,9 @@ static void udev_add_device(struct udev_device *dev, int fd) close(fd); return; } + + axes = count_abs_axis(fd); + buttons = count_buttons(fd, NULL); #endif get_device_subsystem_info(dev, "hid", &desc, &bus); @@ -1697,7 +1701,7 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (!is_hidraw_enabled(desc.vid, desc.pid)) + if (!is_hidraw_enabled(desc.vid, desc.pid, axes, buttons)) { TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); close(fd); @@ -1712,12 +1716,7 @@ static void udev_add_device(struct udev_device *dev, int fd) } #ifdef HAS_PROPER_INPUT_HEADER else - { - int axes=0, buttons=0; - axes = count_abs_axis(fd); - buttons = count_buttons(fd, NULL); desc.is_gamepad = (axes == 6 && buttons >= 14); - } #endif TRACE("dev %p, node %s, desc %s.\n", dev, debugstr_a(devnode), debugstr_device_desc(&desc)); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index fed2aa9da26..a70c5fc8a95 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -271,6 +271,6 @@ BOOL is_wine_blacklisted(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); BOOL is_logitech_g920(WORD vid, WORD pid); -BOOL is_hidraw_enabled(WORD vid, WORD pid); +BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 97574bc973c..b202b18a2fe 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -107,7 +107,7 @@ static BOOL is_fanatec_pedals(WORD vid, WORD pid) return FALSE; } -BOOL is_hidraw_enabled(WORD vid, WORD pid) +BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) { const char *enabled = getenv("PROTON_ENABLE_HIDRAW"); char needle[16]; From 1a763f90fde8007679116ac696d1073d4e3a5c2a Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Tue, 29 Aug 2023 19:09:31 +0200 Subject: [PATCH 0101/1506] winebus.sys: Enable hidraw for VKB Gladiator NXT EVO. These devices ship with 128 buttons by default. For game compatibility, the VKB Windows app can be used to change the HID descriptor to show only 32 buttons and have up to 4 virtual devices instead. These devices can also show up as a mouse or keyboard and send proper HID events for that configuration - not tested with this commit. The Linux input layer gets really confused by these devices as the HID descriptor spans multiple ranges of different device type event codes. Hopefully, winebus.sys hidraw mode can work around this. Also needs udev rules to enable hidraw access. Known limits: - Elite Dangerous: 32 buttons - Star Citizen: 50 buttons - some other games: 64 buttons Signed-off-by: Kai Krakow Link: https://github.com/ValveSoftware/wine/pull/197 --- dlls/winebus.sys/unixlib.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index b202b18a2fe..24507d913e0 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -107,6 +107,19 @@ static BOOL is_fanatec_pedals(WORD vid, WORD pid) return FALSE; } +static BOOL is_vkb_controller(WORD vid, WORD pid, INT buttons) +{ + if (vid != 0x231D) return FALSE; + + /* comes with 128 buttons in the default configuration */ + if (buttons == 128) return TRUE; + + /* if customized, less than 128 buttons may be shown, decide by PID */ + if (pid == 0x0200) return TRUE; /* VKBsim Gladiator EVO Right Grip */ + if (pid == 0x0201) return TRUE; /* VKBsim Gladiator EVO Left Grip */ + return FALSE; +} + BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) { const char *enabled = getenv("PROTON_ENABLE_HIDRAW"); @@ -117,6 +130,7 @@ BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) if (is_thrustmaster_hotas(vid, pid)) return TRUE; if (is_simucube_wheel(vid, pid)) return TRUE; if (is_fanatec_pedals(vid, pid)) return TRUE; + if (is_vkb_controller(vid, pid, buttons)) return TRUE; sprintf(needle, "0x%04x/0x%04x", vid, pid); if (enabled) return strcasestr(enabled, needle) != NULL; From c9e4de3e1d55ff401d7acd8cde5216b48dce71d0 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Fri, 1 Sep 2023 05:12:21 +0200 Subject: [PATCH 0102/1506] winebus.sys: Enable hidraw for Virpil Constellation ALPHA-R. Fixes: https://github.com/ValveSoftware/Proton/issues/6839 Link: https://github.com/ValveSoftware/wine/pull/197 --- dlls/winebus.sys/unixlib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 24507d913e0..223e96f3821 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -120,6 +120,18 @@ static BOOL is_vkb_controller(WORD vid, WORD pid, INT buttons) return FALSE; } +static BOOL is_virpil_controller(WORD vid, WORD pid, INT buttons) +{ + if (vid != 0x3344) return FALSE; + + /* comes with 31 buttons in the default configuration, or 128 max */ + if ((buttons == 31) || (buttons == 128)) return TRUE; + + /* if customized, arbitrary amount of buttons may be shown, decide by PID */ + if (pid == 0x412f) return TRUE; /* Virpil Constellation ALPHA-R */ + return FALSE; +} + BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) { const char *enabled = getenv("PROTON_ENABLE_HIDRAW"); @@ -131,6 +143,7 @@ BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) if (is_simucube_wheel(vid, pid)) return TRUE; if (is_fanatec_pedals(vid, pid)) return TRUE; if (is_vkb_controller(vid, pid, buttons)) return TRUE; + if (is_virpil_controller(vid, pid, buttons)) return TRUE; sprintf(needle, "0x%04x/0x%04x", vid, pid); if (enabled) return strcasestr(enabled, needle) != NULL; From 4b1e592f11e8f031089c7239f5eca2d9d6feadd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Nov 2023 00:45:55 +0100 Subject: [PATCH 0103/1506] HACK: winegstreamer: Use a different gst registry file per architecture --- dlls/winegstreamer/unixlib.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index db9d1eb114f..a8ab34f6aef 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -253,6 +253,23 @@ NTSTATUS wg_init_gstreamer(void *arg) char **argv = args; GError *err; + const char *e; + + if ((e = getenv("WINE_GST_REGISTRY_DIR"))) + { + char gst_reg[PATH_MAX]; +#if defined(__x86_64__) + const char *arch = "/registry.x86_64.bin"; +#elif defined(__i386__) + const char *arch = "/registry.i386.bin"; +#else +#error Bad arch +#endif + strcpy(gst_reg, e); + strcat(gst_reg, arch); + setenv("GST_REGISTRY_1_0", gst_reg, 1); + } + if (!gst_init_check(&argc, &argv, &err)) { fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", err->message); From e49946c7872f49ccc90b8468f1201f0e3e92452d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Nov 2023 00:53:28 +0100 Subject: [PATCH 0104/1506] HACK: winegstreamer/wg_parser: Enable protonvideoconv when decodebin fails. Squashed with: HACK: winegstreamer/wg_parser: Fail to plug elements when parser has an error. CW-Bug-Id: #20819 winegstreamer/wg_parser: Block protonvideoconvert autoplug when not trying for it. --- dlls/winegstreamer/wg_parser.c | 79 +++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 7193062e89b..44bb47b90ad 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -30,6 +30,7 @@ #include #include +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_30 #include #include #include @@ -97,6 +98,8 @@ struct wg_parser gchar *sink_caps; struct input_cache_chunk input_cache_chunks[4]; + + bool use_mediaconv; }; static const unsigned int input_cache_chunk_size = 512 << 10; @@ -523,6 +526,8 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, GST_INFO("Using \"%s\".", name); + if (parser->error) + return GST_AUTOPLUG_SELECT_SKIP; if (strstr(name, "Player protection")) { GST_WARNING("Blacklisted a/52 decoder because it only works in Totem."); @@ -533,6 +538,11 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, GST_WARNING("Disabled video acceleration since it breaks in wine."); return GST_AUTOPLUG_SELECT_SKIP; } + if (!strcmp(name, "Proton video converter") && !parser->use_mediaconv) + { + GST_INFO("Skipping \"Proton video converter\"."); + return GST_AUTOPLUG_SELECT_SKIP; + } if (!parser->sink_caps && strstr(klass, GST_ELEMENT_FACTORY_KLASS_DEMUXER)) parser->sink_caps = g_strdup(gst_structure_get_name(gst_caps_get_structure(caps, 0))); @@ -540,6 +550,34 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, return GST_AUTOPLUG_SELECT_TRY; } +static gint find_videoconv_cb(gconstpointer a, gconstpointer b) +{ + const GValue *val_a = a, *val_b = b; + GstElementFactory *factory_a = g_value_get_object(val_a), *factory_b = g_value_get_object(val_b); + const char *name_a = gst_element_factory_get_longname(factory_a), *name_b = gst_element_factory_get_longname(factory_b); + + if (!strcmp(name_a, "Proton video converter")) + return -1; + if (!strcmp(name_b, "Proton video converter")) + return 1; + return 0; +} + +static GValueArray *autoplug_sort_cb(GstElement *bin, GstPad *pad, + GstCaps *caps, GValueArray *factories, gpointer user) +{ + struct wg_parser *parser = user; + GValueArray *ret = g_value_array_copy(factories); + + if (!parser->use_mediaconv) + return NULL; + + GST_DEBUG("parser %p.", parser); + + g_value_array_sort(ret, find_videoconv_cb); + return ret; +} + static void no_more_pads_cb(GstElement *element, gpointer user) { struct wg_parser *parser = user; @@ -1348,9 +1386,12 @@ static gboolean src_activate_mode_cb(GstPad *pad, GstObject *parent, GstPadMode return FALSE; } +static BOOL decodebin_parser_init_gst(struct wg_parser *parser); + static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer user) { struct wg_parser *parser = user; + const GstStructure *structure; gchar *dbg_info = NULL; GError *err = NULL; @@ -1391,6 +1432,21 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use pthread_cond_signal(&parser->init_cond); break; + case GST_MESSAGE_ELEMENT: + structure = gst_message_get_structure(msg); + if (gst_structure_has_name(structure, "missing-plugin")) + { + pthread_mutex_lock(&parser->mutex); + if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst) + { + GST_WARNING("Autoplugged element failed to initialise, trying again with protonvideoconvert."); + parser->error = true; + pthread_cond_signal(&parser->init_cond); + } + pthread_mutex_unlock(&parser->mutex); + } + break; + default: break; } @@ -1555,6 +1611,8 @@ static NTSTATUS wg_parser_connect(void *args) unsigned int i; int ret; + bool use_mediaconv = false; + parser->file_size = params->file_size; parser->sink_connected = true; @@ -1583,9 +1641,16 @@ static NTSTATUS wg_parser_connect(void *args) gst_element_set_state(parser->container, GST_STATE_PAUSED); ret = gst_element_get_state(parser->container, NULL, NULL, -1); + if (ret == GST_STATE_CHANGE_FAILURE) { - GST_ERROR("Failed to play stream."); + if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst) + { + GST_WARNING("Failed to play media, trying again with protonvideoconvert."); + use_mediaconv = true; + } + else + GST_ERROR("Failed to play stream."); goto out; } @@ -1595,6 +1660,8 @@ static NTSTATUS wg_parser_connect(void *args) pthread_cond_wait(&parser->init_cond, &parser->mutex); if (parser->error) { + if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst) + use_mediaconv = true; pthread_mutex_unlock(&parser->mutex); goto out; } @@ -1711,6 +1778,15 @@ static NTSTATUS wg_parser_connect(void *args) pthread_mutex_unlock(&parser->mutex); pthread_cond_signal(&parser->read_cond); + if (use_mediaconv) + { + HRESULT hr; + parser->use_mediaconv = true; + hr = wg_parser_connect(args); + parser->use_mediaconv = false; + return hr; + } + return E_FAIL; } @@ -1774,6 +1850,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) g_signal_connect(element, "pad-removed", G_CALLBACK(pad_removed_cb), parser); g_signal_connect(element, "autoplug-continue", G_CALLBACK(autoplug_continue_cb), parser); g_signal_connect(element, "autoplug-select", G_CALLBACK(autoplug_select_cb), parser); + g_signal_connect(element, "autoplug-sort", G_CALLBACK(autoplug_sort_cb), parser); g_signal_connect(element, "no-more-pads", G_CALLBACK(no_more_pads_cb), parser); pthread_mutex_lock(&parser->mutex); From 3546d68111a9513e83bc613c2b77ff979556f7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Feb 2022 21:31:55 +0100 Subject: [PATCH 0105/1506] HACK: winegstreamer/wg_transform: Check if the decoder accepted our caps. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 CW-Bug-Id: #19854 CW-Bug-Id: #20966 --- dlls/winegstreamer/wg_transform.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index ab5ce381fc5..039e5436d0f 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -448,6 +448,20 @@ NTSTATUS wg_transform_create(void *args) || !push_event(transform->my_src, event)) goto out; + /* Check that the caps event have been accepted */ + if (input_format.major_type == WG_MAJOR_TYPE_VIDEO_H264) + { + GstPad *peer; + if (!(peer = gst_pad_get_peer(transform->my_src))) + goto out; + else if (!gst_pad_has_current_caps(peer)) + { + gst_object_unref(peer); + goto out; + } + gst_object_unref(peer); + } + /* We need to use GST_FORMAT_TIME here because it's the only format * some elements such avdec_wmav2 correctly support. */ gst_segment_init(&transform->segment, GST_FORMAT_TIME); From ebdcf6a3cbc65bb0f2dde9f610acd34b2835f3a3 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 3 Nov 2022 18:54:06 +0200 Subject: [PATCH 0106/1506] HACK: winegstreamer: Detect h264 use and create a tag file. CW-Bug-Id: #21473 --- dlls/winegstreamer/unix_private.h | 35 +++++++++++++++++++++++++++++++ dlls/winegstreamer/wg_parser.c | 15 +++++++++++++ dlls/winegstreamer/wg_transform.c | 4 ++++ 3 files changed, 54 insertions(+) diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index bb2cb864735..55c850bc1a3 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -26,6 +26,11 @@ #include #include +#include +#include +#include +#include + /* unixlib.c */ GST_DEBUG_CATEGORY_EXTERN(wine); @@ -89,4 +94,34 @@ extern void wg_allocator_provide_sample(GstAllocator *allocator, struct wg_sampl extern void wg_allocator_release_sample(GstAllocator *allocator, struct wg_sample *sample, bool discard_data); +static inline void touch_h264_used_tag(void) +{ + const char *e; + + GST_LOG("h264 is used"); + + if ((e = getenv("STEAM_COMPAT_SHADER_PATH"))) + { + char buffer[PATH_MAX]; + int fd; + + snprintf(buffer, sizeof(buffer), "%s/h264-used", e); + + fd = open(buffer, O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + if (fd == -1) + { + GST_WARNING("Failed to open/create \"%s/h264-used\"", e); + return; + } + + futimens(fd, NULL); + + close(fd); + } + else + { + GST_WARNING("STEAM_COMPAT_SHADER_PATH not set, cannot create h264-used file"); + } +} + #endif /* __WINE_WINEGSTREAMER_UNIX_PRIVATE_H */ diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 44bb47b90ad..ebc2ae97c2c 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -517,6 +517,19 @@ static gboolean autoplug_continue_cb(GstElement * decodebin, GstPad *pad, GstCap return !format_is_compressed(&format); } +gboolean caps_detect_h264(GstCapsFeatures *features, GstStructure *structure, gpointer user_data) +{ + const char *cap_name = gst_structure_get_name(structure); + + if (!strcmp(cap_name, "video/x-h264")) + { + touch_h264_used_tag(); + return FALSE; + } + + return TRUE; +} + static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) { @@ -526,6 +539,8 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, GST_INFO("Using \"%s\".", name); + gst_caps_foreach(caps, caps_detect_h264, NULL); + if (parser->error) return GST_AUTOPLUG_SELECT_SKIP; if (strstr(name, "Player protection")) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 039e5436d0f..fe62fe27248 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -300,6 +300,10 @@ NTSTATUS wg_transform_create(void *args) const gchar *media_type; GstEvent *event; + /* to detect h264_decoder_create() */ + if (input_format.major_type == WG_MAJOR_TYPE_VIDEO_H264) + touch_h264_used_tag(); + if (!(transform = calloc(1, sizeof(*transform)))) return STATUS_NO_MEMORY; if (!(transform->container = gst_bin_new("wg_transform"))) From 250c76e5435b2b92e2e9dbd72464a920d02b8390 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 28 Dec 2022 12:09:43 +0200 Subject: [PATCH 0107/1506] winegstreamer/wg_parser: Set n-threads for dav1d to 1. It defaults to `$(nproc)` which causes the memory footprint to skyrocet on high core count systems. Setting it to 1 makes it use a bit less memory that theora decoder and is enough to decode 1080p 30fps stream on 5950x with a speed of 4x the real time. We may want to set it to value higher than 1 for 64bit apps where limited address space is not an issue. 2 or 4 may be optimal for tiling with 2 columns and 2 rosw when encoding the video. CW-Bug-Id: #19516 --- dlls/winegstreamer/wg_parser.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index ebc2ae97c2c..2daab7d887a 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -605,6 +605,24 @@ static void no_more_pads_cb(GstElement *element, gpointer user) pthread_cond_signal(&parser->init_cond); } +static void deep_element_added_cb(GstBin *self, GstBin *sub_bin, GstElement *element, gpointer user) +{ + GstElementFactory *factory = NULL; + const char *name = NULL; + + if (element) + factory = gst_element_get_factory(element); + + if (factory) + name = gst_element_factory_get_longname(factory); + + if (name && strstr(name, "Dav1d")) + { + GST_DEBUG("%s found, setting n-threads to 1.", name); + g_object_set(element, "n-threads", G_GINT64_CONSTANT(1), NULL); + } +} + static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) { struct wg_parser_stream *stream = gst_pad_get_element_private(pad); @@ -1867,6 +1885,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) g_signal_connect(element, "autoplug-select", G_CALLBACK(autoplug_select_cb), parser); g_signal_connect(element, "autoplug-sort", G_CALLBACK(autoplug_sort_cb), parser); g_signal_connect(element, "no-more-pads", G_CALLBACK(no_more_pads_cb), parser); + g_signal_connect(element, "deep-element-added", G_CALLBACK(deep_element_added_cb), parser); pthread_mutex_lock(&parser->mutex); parser->no_more_pads = false; From 2ee1bc78d6b98488ae0ea4775807882999cd9d41 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 17 Jan 2023 14:38:06 +0200 Subject: [PATCH 0108/1506] winegstreamer/wg_parser: Set n-threads for dav1d to 4 in 64 bit mode. CW-Bug-Id: #19516 --- dlls/winegstreamer/wg_parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 2daab7d887a..9df6d814665 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -618,8 +618,13 @@ static void deep_element_added_cb(GstBin *self, GstBin *sub_bin, GstElement *ele if (name && strstr(name, "Dav1d")) { +#if defined(__x86_64__) + GST_DEBUG("%s found, setting n-threads to 4.", name); + g_object_set(element, "n-threads", G_GINT64_CONSTANT(4), NULL); +#else GST_DEBUG("%s found, setting n-threads to 1.", name); g_object_set(element, "n-threads", G_GINT64_CONSTANT(1), NULL); +#endif } } From 90aa8bd751ef1477282d67b38a2057691f1401a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Nov 2023 00:45:19 +0100 Subject: [PATCH 0109/1506] HACK: mfplat: Stub out MFCreateDXGIDeviceManager, to avoid the d3d path. Squashed with: HACK: mfplat: Return E_NOTIMPL from MFCreateDXGIDeviceManager for TOHU. Without this the game renders the videos as garbage. CW-Bug-Id: #20194 HACK: mfplat: Move MFDXGIDeviceManager hack appid list to proton script mfplat: Remove comment about games requiring MFCreateDXGIDeviceManager() hack. It is not outdated and partially incorrect. CW-Bug-Id: #19126 CW-Bug-Id: #20985 --- dlls/mfplat/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index aa987ff0496..4805812e4d1 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -9211,9 +9211,16 @@ static const IMFDXGIDeviceManagerVtbl dxgi_device_manager_vtbl = HRESULT WINAPI MFCreateDXGIDeviceManager(UINT *token, IMFDXGIDeviceManager **manager) { struct dxgi_device_manager *object; + const char *do_not_create = getenv("WINE_DO_NOT_CREATE_DXGI_DEVICE_MANAGER"); TRACE("%p, %p.\n", token, manager); + if (do_not_create && do_not_create[0] != '\0') + { + FIXME("stubbing out\n"); + return E_NOTIMPL; + } + if (!token || !manager) return E_POINTER; From ff469294ac7c11a9c8f34fcba13a447c454ca329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Nov 2023 00:45:19 +0100 Subject: [PATCH 0110/1506] mfplat: Add MFVideoFormat_ABGR32 format information. --- dlls/mfplat/mediatype.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 2ba967c6719..c73c92be642 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -36,6 +36,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_MEDIATYPE_GUID(MFVideoFormat_RGB1, D3DFMT_A1); DEFINE_MEDIATYPE_GUID(MFVideoFormat_RGB4, MAKEFOURCC('4','P','x','x')); +DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32, D3DFMT_A8B8G8R8); DEFINE_MEDIATYPE_GUID(MFVideoFormat_ARGB1555, D3DFMT_A1R5G5B5); DEFINE_MEDIATYPE_GUID(MFVideoFormat_ARGB4444, D3DFMT_A4R4G4B4); /* SDK MFVideoFormat_A2R10G10B10 uses D3DFMT_A2B10G10R10, let's name it the other way */ @@ -2709,6 +2710,7 @@ static const struct uncompressed_video_format video_formats[] = { &MFVideoFormat_RGB32, 32, 3, 1, 0, BI_RGB }, { &MFVideoFormat_RGB565, 16, 3, 1, 0, BI_BITFIELDS }, { &MFVideoFormat_RGB555, 16, 3, 1, 0, BI_RGB }, + { &MFVideoFormat_ABGR32, 32, 3, 1, 0, BI_RGB }, { &MFVideoFormat_A2R10G10B10, 32, 3, 1, 0, -1 }, { &MFVideoFormat_A2B10G10R10, 32, 3, 1, 0, -1 }, { &MFVideoFormat_RGB8, 8, 3, 1, 0, BI_RGB }, @@ -3617,6 +3619,8 @@ DXGI_FORMAT WINAPI MFMapDX9FormatToDXGIFormat(DWORD format) return DXGI_FORMAT_P8; case D3DFMT_A8P8: return DXGI_FORMAT_A8P8; + case D3DFMT_A8B8G8R8: + return DXGI_FORMAT_R8G8B8A8_UNORM; default: return DXGI_FORMAT_UNKNOWN; } From ff8e86819dccc78e0633955d165c4250d6d16914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Nov 2023 00:45:20 +0100 Subject: [PATCH 0111/1506] winegstreamer/wg_format: Add WG_VIDEO_FORMAT_RGBA format. --- dlls/winegstreamer/main.c | 1 + dlls/winegstreamer/mfplat.c | 2 ++ dlls/winegstreamer/quartz_parser.c | 8 ++++++++ dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_format.c | 3 +++ 5 files changed, 15 insertions(+) diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 74a6eee5b1d..9b34468d797 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -646,6 +646,7 @@ bool wg_video_format_is_rgb(enum wg_video_format format) case WG_VIDEO_FORMAT_BGRA: case WG_VIDEO_FORMAT_BGRx: case WG_VIDEO_FORMAT_BGR: + case WG_VIDEO_FORMAT_RGBA: case WG_VIDEO_FORMAT_RGB15: case WG_VIDEO_FORMAT_RGB16: return true; diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 0e1d489d8e5..336a2e1ad46 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -36,6 +36,7 @@ DEFINE_GUID(DMOVideoFormat_RGB24,D3DFMT_R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20 DEFINE_GUID(DMOVideoFormat_RGB565,D3DFMT_R5G6B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32,D3DFMT_A8B8G8R8); DEFINE_MEDIATYPE_GUID(MFAudioFormat_RAW_AAC,WAVE_FORMAT_RAW_AAC1); DEFINE_MEDIATYPE_GUID(MFVideoFormat_VC1S,MAKEFOURCC('V','C','1','S')); DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50,MAKEFOURCC('I','V','5','0')); @@ -437,6 +438,7 @@ video_formats[] = {&MFVideoFormat_ARGB32, WG_VIDEO_FORMAT_BGRA}, {&MFVideoFormat_RGB32, WG_VIDEO_FORMAT_BGRx}, {&MFVideoFormat_RGB24, WG_VIDEO_FORMAT_BGR}, + {&MFVideoFormat_ABGR32, WG_VIDEO_FORMAT_RGBA}, {&MFVideoFormat_RGB555, WG_VIDEO_FORMAT_RGB15}, {&MFVideoFormat_RGB565, WG_VIDEO_FORMAT_RGB16}, {&MFVideoFormat_AYUV, WG_VIDEO_FORMAT_AYUV}, diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 44e13d05c2a..27534326ac4 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -29,6 +29,8 @@ #include "dvdmedia.h" #include "mmreg.h" #include "ks.h" +#include "mfapi.h" +#include "d3d9types.h" #include "wmcodecdsp.h" #include "initguid.h" #include "ksmedia.h" @@ -39,6 +41,7 @@ static const GUID MEDIASUBTYPE_CVID = {mmioFOURCC('c','v','i','d'), 0x0000, 0x00 static const GUID MEDIASUBTYPE_VC1S = {mmioFOURCC('V','C','1','S'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; static const GUID MEDIASUBTYPE_MP3 = {WAVE_FORMAT_MPEGLAYER3, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; static const GUID MEDIASUBTYPE_WMV_Unknown = {0x7ce12ca9, 0xbfbf, 0x43d9, {0x9d, 0x00, 0x82, 0xb8, 0xed, 0x54, 0x31, 0x6b}}; +extern const GUID MFVideoFormat_ABGR32; struct parser { @@ -348,6 +351,7 @@ static unsigned int wg_format_get_max_size_video_raw(enum wg_video_format format { case WG_VIDEO_FORMAT_BGRA: case WG_VIDEO_FORMAT_BGRx: + case WG_VIDEO_FORMAT_RGBA: case WG_VIDEO_FORMAT_AYUV: return width * height * 4; @@ -479,6 +483,7 @@ static const GUID *wg_video_format_get_mediasubtype(enum wg_video_format format) case WG_VIDEO_FORMAT_BGRA: return &MEDIASUBTYPE_ARGB32; case WG_VIDEO_FORMAT_BGRx: return &MEDIASUBTYPE_RGB32; case WG_VIDEO_FORMAT_BGR: return &MEDIASUBTYPE_RGB24; + case WG_VIDEO_FORMAT_RGBA: return &MFVideoFormat_ABGR32; case WG_VIDEO_FORMAT_RGB15: return &MEDIASUBTYPE_RGB555; case WG_VIDEO_FORMAT_RGB16: return &MEDIASUBTYPE_RGB565; case WG_VIDEO_FORMAT_AYUV: return &MEDIASUBTYPE_AYUV; @@ -502,6 +507,7 @@ static DWORD wg_video_format_get_compression(enum wg_video_format format) case WG_VIDEO_FORMAT_BGRA: return BI_RGB; case WG_VIDEO_FORMAT_BGRx: return BI_RGB; case WG_VIDEO_FORMAT_BGR: return BI_RGB; + case WG_VIDEO_FORMAT_RGBA: return BI_RGB; case WG_VIDEO_FORMAT_RGB15: return BI_RGB; case WG_VIDEO_FORMAT_RGB16: return BI_BITFIELDS; case WG_VIDEO_FORMAT_AYUV: return mmioFOURCC('A','Y','U','V'); @@ -525,6 +531,7 @@ static WORD wg_video_format_get_depth(enum wg_video_format format) case WG_VIDEO_FORMAT_BGRA: return 32; case WG_VIDEO_FORMAT_BGRx: return 32; case WG_VIDEO_FORMAT_BGR: return 24; + case WG_VIDEO_FORMAT_RGBA: return 32; case WG_VIDEO_FORMAT_RGB15: return 16; case WG_VIDEO_FORMAT_RGB16: return 16; case WG_VIDEO_FORMAT_AYUV: return 32; @@ -923,6 +930,7 @@ static bool amt_to_wg_format_video(const AM_MEDIA_TYPE *mt, struct wg_format *fo {&MEDIASUBTYPE_ARGB32, WG_VIDEO_FORMAT_BGRA}, {&MEDIASUBTYPE_RGB32, WG_VIDEO_FORMAT_BGRx}, {&MEDIASUBTYPE_RGB24, WG_VIDEO_FORMAT_BGR}, + {&MFVideoFormat_ABGR32, WG_VIDEO_FORMAT_RGBA}, {&MEDIASUBTYPE_RGB555, WG_VIDEO_FORMAT_RGB15}, {&MEDIASUBTYPE_RGB565, WG_VIDEO_FORMAT_RGB16}, {&MEDIASUBTYPE_AYUV, WG_VIDEO_FORMAT_AYUV}, diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 516fc19b4e3..902733c96b6 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -66,6 +66,7 @@ enum wg_video_format WG_VIDEO_FORMAT_BGRA, WG_VIDEO_FORMAT_BGRx, WG_VIDEO_FORMAT_BGR, + WG_VIDEO_FORMAT_RGBA, WG_VIDEO_FORMAT_RGB15, WG_VIDEO_FORMAT_RGB16, diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 6da97685736..34036b50e3d 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -141,6 +141,8 @@ static enum wg_video_format wg_video_format_from_gst(GstVideoFormat format) return WG_VIDEO_FORMAT_BGRx; case GST_VIDEO_FORMAT_BGR: return WG_VIDEO_FORMAT_BGR; + case GST_VIDEO_FORMAT_RGBA: + return WG_VIDEO_FORMAT_RGBA; case GST_VIDEO_FORMAT_RGB15: return WG_VIDEO_FORMAT_RGB15; case GST_VIDEO_FORMAT_RGB16: @@ -566,6 +568,7 @@ static GstVideoFormat wg_video_format_to_gst(enum wg_video_format format) case WG_VIDEO_FORMAT_BGRA: return GST_VIDEO_FORMAT_BGRA; case WG_VIDEO_FORMAT_BGRx: return GST_VIDEO_FORMAT_BGRx; case WG_VIDEO_FORMAT_BGR: return GST_VIDEO_FORMAT_BGR; + case WG_VIDEO_FORMAT_RGBA: return GST_VIDEO_FORMAT_RGBA; case WG_VIDEO_FORMAT_RGB15: return GST_VIDEO_FORMAT_RGB15; case WG_VIDEO_FORMAT_RGB16: return GST_VIDEO_FORMAT_RGB16; case WG_VIDEO_FORMAT_AYUV: return GST_VIDEO_FORMAT_AYUV; From c4fa84181866fa9f28dce15f2bb54258fca9de01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 14 Nov 2023 17:16:23 +0100 Subject: [PATCH 0112/1506] HACK: winegstreamer/media_source: Report streams backwards in media source. --- dlls/winegstreamer/media_source.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 9cc54f8e146..949ff1281bb 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1684,7 +1684,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->duration = max(object->duration, wg_parser_stream_get_duration(wg_stream)); IMFStreamDescriptor_AddRef(descriptor); - object->descriptors[i] = descriptor; + object->descriptors[stream_count - 1 - i] = descriptor; object->streams[i] = stream; object->stream_count++; } @@ -1699,11 +1699,15 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc fail: WARN("Failed to construct MFMediaSource, hr %#lx.\n", hr); - while (object->streams && object->stream_count--) + for (i = 0; i < stream_count; i++) { - struct media_stream *stream = object->streams[object->stream_count]; - IMFStreamDescriptor_Release(object->descriptors[object->stream_count]); - IMFMediaStream_Release(&stream->IMFMediaStream_iface); + if (object->streams && object->streams[i]) + IMFMediaStream_Release(&object->streams[i]->IMFMediaStream_iface); + } + for (i = 0; i < stream_count; i++) + { + if (object->descriptors && object->descriptors[i]) + IMFStreamDescriptor_Release(object->descriptors[i]); } free(object->descriptors); free(object->streams); From 6900668bda136023ab94c550e60e82bc94fceff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 14 Nov 2023 17:19:29 +0100 Subject: [PATCH 0113/1506] HACK: winegstreamer/media_source: Enable one stream for each major type. --- dlls/winegstreamer/media_source.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 949ff1281bb..0e5b6d3513c 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1427,6 +1427,7 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **descriptor) { struct media_source *source = impl_from_IMFMediaSource(iface); + BOOL video_selected = FALSE, audio_selected = FALSE; HRESULT hr; UINT i; @@ -1443,8 +1444,22 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * for (i = 0; i < source->stream_count; ++i) { - if (FAILED(hr = IMFPresentationDescriptor_SelectStream(*descriptor, i))) - WARN("Failed to select stream %u, hr %#lx\n", i, hr); + struct wg_format format; + + wg_format_from_stream_descriptor(source->descriptors[i], &format); + + if (format.major_type >= WG_MAJOR_TYPE_VIDEO) + { + if (!video_selected && FAILED(hr = IMFPresentationDescriptor_SelectStream(*descriptor, i))) + WARN("Failed to select stream %u, hr %#lx\n", i, hr); + video_selected = TRUE; + } + else if (format.major_type >= WG_MAJOR_TYPE_AUDIO) + { + if (!audio_selected && FAILED(hr = IMFPresentationDescriptor_SelectStream(*descriptor, i))) + WARN("Failed to select stream %u, hr %#lx\n", i, hr); + audio_selected = TRUE; + } } hr = S_OK; From c3b815e91adceec111a7bef462d819a5dcd1c94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 23 Nov 2023 00:45:20 +0100 Subject: [PATCH 0114/1506] HACK: winegstreamer/media_source: Add RGB output formats for the source. CW-Bug-Id: #19975 Squashed with: HACK: winegstreamer/media_source: Add WG_VIDEO_FORMAT_BGRx output for the source. CW-Bug-Id: #19516 CW-Bug-Id: #19859 HACK: winegstreamer/media_source: Add WG_VIDEO_FORMAT_RGBA output for the source. --- dlls/winegstreamer/media_source.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 0e5b6d3513c..100e4087b9f 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -391,7 +391,7 @@ static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, wg_par return hr; } -static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *types[6], DWORD *types_count) +static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *types[9], DWORD *types_count) { /* Try to prefer YUV formats over RGB ones. Most decoders output in the * YUV color space, and it's generally much less expensive for @@ -402,6 +402,9 @@ static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *ty WG_VIDEO_FORMAT_YV12, WG_VIDEO_FORMAT_YUY2, WG_VIDEO_FORMAT_I420, + WG_VIDEO_FORMAT_BGRA, + WG_VIDEO_FORMAT_BGRx, + WG_VIDEO_FORMAT_RGBA, }; UINT count = *types_count, i; GUID base_subtype; @@ -443,7 +446,7 @@ static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *ty return hr; } -static HRESULT init_audio_media_types(struct wg_format *format, IMFMediaType *types[6], DWORD *types_count) +static HRESULT init_audio_media_types(struct wg_format *format, IMFMediaType *types[9], DWORD *types_count) { /* Expose at least one PCM and one floating point type for the consumer to pick from. */ @@ -472,7 +475,7 @@ static HRESULT stream_descriptor_create(UINT32 id, struct wg_format *format, IMF { IMFStreamDescriptor *descriptor; IMFMediaTypeHandler *handler; - IMFMediaType *types[6]; + IMFMediaType *types[9]; DWORD count = 0; HRESULT hr; From 1365a4371c4e34b1d4d0b8e8f656ab11d550fdb0 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 25 Nov 2022 18:32:11 -0500 Subject: [PATCH 0115/1506] HACK: winegstreamer/media_source: Expose S16LE as the first native media type. Metal Gear Solid V: The Phantom Pain expects the bps of first native media type returned by MFSourceReader, of a WMA Pro audio stream, to be 16. Here, we ensure that S16LE is exposed first before the preferred format of the gstreamer pipeline. CW-Bug-Id: #21407 --- dlls/winegstreamer/media_source.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 100e4087b9f..7eece1fa1b7 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -449,7 +449,8 @@ static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *ty static HRESULT init_audio_media_types(struct wg_format *format, IMFMediaType *types[9], DWORD *types_count) { /* Expose at least one PCM and one floating point type for the - consumer to pick from. */ + consumer to pick from. Moreover, ensure that we expose S16LE first, + as games such as MGSV expect the native media type to be 16 bps. */ static const enum wg_audio_format audio_types[] = { WG_AUDIO_FORMAT_S16LE, @@ -457,16 +458,25 @@ static HRESULT init_audio_media_types(struct wg_format *format, IMFMediaType *ty }; UINT count = *types_count, i; + BOOL has_native_format = FALSE; + for (i = 0; i < ARRAY_SIZE(audio_types); i++) { - struct wg_format new_format = *format; - if (new_format.u.audio.format == audio_types[i]) - continue; + struct wg_format new_format; + + new_format = *format; new_format.u.audio.format = audio_types[i]; if ((types[count] = mf_media_type_from_wg_format(&new_format))) + { + if (format->u.audio.format == audio_types[i]) + has_native_format = TRUE; count++; + } } + if (!has_native_format && (types[count] = mf_media_type_from_wg_format(format))) + count++; + *types_count = count; return S_OK; } From a2e20ee412e84cb2e3b059b1885f04fa635e775c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 28 Sep 2022 14:09:39 +0200 Subject: [PATCH 0116/1506] HACK: winegstreamer/media_source: Don't flip RGB for Media Foundation clients. This reverts commit 388f76eb6b6623f291ba8df1300d0ae6cc16a980. --- dlls/winegstreamer/gst_private.h | 3 ++- dlls/winegstreamer/main.c | 4 +++- dlls/winegstreamer/media_source.c | 2 +- dlls/winegstreamer/quartz_parser.c | 2 +- dlls/winegstreamer/unixlib.h | 3 +++ dlls/winegstreamer/wg_parser.c | 2 +- dlls/winegstreamer/wm_reader.c | 10 +++++----- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 5e6cbbab5d5..8555ec82300 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -84,7 +84,8 @@ wg_parser_stream_t wg_parser_get_stream(wg_parser_t parser, uint32_t index); void wg_parser_stream_get_preferred_format(wg_parser_stream_t stream, struct wg_format *format); void wg_parser_stream_get_codec_format(wg_parser_stream_t stream, struct wg_format *format); -void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format); +void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format, + uint32_t flags); void wg_parser_stream_disable(wg_parser_stream_t stream); bool wg_parser_stream_get_buffer(wg_parser_t parser, wg_parser_stream_t stream, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 9b34468d797..0800f8d0f48 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -198,12 +198,14 @@ void wg_parser_stream_get_codec_format(wg_parser_stream_t stream, struct wg_form WINE_UNIX_CALL(unix_wg_parser_stream_get_codec_format, ¶ms); } -void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format) +void wg_parser_stream_enable(wg_parser_stream_t stream, const struct wg_format *format, + uint32_t flags) { struct wg_parser_stream_enable_params params = { .stream = stream, .format = format, + .flags = flags, }; TRACE("stream %#I64x, format %p.\n", stream, format); diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 7eece1fa1b7..c3a76a4239e 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -586,7 +586,7 @@ static HRESULT media_stream_start(struct media_stream *stream, BOOL active, BOOL if (FAILED(hr = wg_format_from_stream_descriptor(stream->descriptor, &format))) WARN("Failed to get wg_format from stream descriptor, hr %#lx\n", hr); - wg_parser_stream_enable(stream->wg_stream, &format); + wg_parser_stream_enable(stream->wg_stream, &format, 0); if (FAILED(hr = IMFMediaEventQueue_QueueEventParamUnk(source->event_queue, active ? MEUpdatedStream : MENewStream, &GUID_NULL, S_OK, (IUnknown *)&stream->IMFMediaStream_iface))) diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 27534326ac4..9a0e0edab35 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -1432,7 +1432,7 @@ static HRESULT parser_init_stream(struct strmbase_filter *iface) { ret = amt_to_wg_format(&source->pin.pin.mt, &format); assert(ret); - wg_parser_stream_enable(source->wg_stream, &format); + wg_parser_stream_enable(source->wg_stream, &format, STREAM_ENABLE_FLAG_FLIP_RGB); } else { diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 902733c96b6..4e2ca6b88bd 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -273,10 +273,13 @@ struct wg_parser_stream_get_codec_format_params struct wg_format *format; }; +#define STREAM_ENABLE_FLAG_FLIP_RGB 0x1 + struct wg_parser_stream_enable_params { wg_parser_stream_t stream; const struct wg_format *format; + uint32_t flags; }; struct wg_parser_stream_get_buffer_params diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 9df6d814665..5df62925121 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -257,7 +257,7 @@ static NTSTATUS wg_parser_stream_enable(void *args) if (format->major_type == WG_MAJOR_TYPE_VIDEO) { - bool flip = (format->u.video.height < 0); + bool flip = (params->flags & STREAM_ENABLE_FLAG_FLIP_RGB) && (format->u.video.height < 0); gst_util_set_object_arg(G_OBJECT(stream->flip), "method", flip ? "vertical-flip" : "none"); } diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index e3a2bfc343b..73e208a899a 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1511,7 +1511,7 @@ static HRESULT init_stream(struct wm_reader *reader) if (stream->format.u.video.height > 0) stream->format.u.video.height = -stream->format.u.video.height; } - wg_parser_stream_enable(stream->wg_stream, &stream->format); + wg_parser_stream_enable(stream->wg_stream, &stream->format, STREAM_ENABLE_FLAG_FLIP_RGB); } /* We probably discarded events because streams weren't enabled yet. @@ -1586,7 +1586,7 @@ static HRESULT reinit_stream(struct wm_reader *reader, bool read_compressed) stream->reader = reader; wg_parser_stream_get_preferred_format(stream->wg_stream, &format); if (stream->selection == WMT_ON) - wg_parser_stream_enable(stream->wg_stream, read_compressed ? &format : &stream->format); + wg_parser_stream_enable(stream->wg_stream, read_compressed ? &format : &stream->format, STREAM_ENABLE_FLAG_FLIP_RGB); } /* We probably discarded events because streams weren't enabled yet. @@ -2325,7 +2325,7 @@ static HRESULT WINAPI reader_SetOutputProps(IWMSyncReader2 *iface, DWORD output, } stream->format = format; - wg_parser_stream_enable(stream->wg_stream, &format); + wg_parser_stream_enable(stream->wg_stream, &format, STREAM_ENABLE_FLAG_FLIP_RGB); /* Re-decode any buffers that might have been generated with the old format. * @@ -2472,11 +2472,11 @@ static HRESULT WINAPI reader_SetStreamsSelected(IWMSyncReader2 *iface, { struct wg_format format; wg_parser_stream_get_preferred_format(stream->wg_stream, &format); - wg_parser_stream_enable(stream->wg_stream, &format); + wg_parser_stream_enable(stream->wg_stream, &format, STREAM_ENABLE_FLAG_FLIP_RGB); } else { - wg_parser_stream_enable(stream->wg_stream, &stream->format); + wg_parser_stream_enable(stream->wg_stream, &stream->format, STREAM_ENABLE_FLAG_FLIP_RGB); } } } From 2f6b5bcb2ad4a30f1e502c5d6742717f39b63f21 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 15 Jul 2022 15:12:52 -0400 Subject: [PATCH 0117/1506] winegstreamer/media_source: Add MF_MT_VIDEO_NOMINAL_RANGE attribute to base video output type. --- dlls/winegstreamer/mfplat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 336a2e1ad46..ecebae85ad8 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -528,6 +528,7 @@ static IMFMediaType *mf_media_type_from_wg_format_video(const struct wg_format * IMFMediaType_SetUINT32(type, &MF_MT_COMPRESSED, FALSE); IMFMediaType_SetUINT32(type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); IMFMediaType_SetUINT32(type, &MF_MT_VIDEO_ROTATION, MFVideoRotationFormat_0); + IMFMediaType_SetUINT32(type, &MF_MT_VIDEO_NOMINAL_RANGE, MFNominalRange_Normal); if (format->u.video.height < 0) stride = -stride; From 1daaa475b2beb3a6f627127bb9c7ec8460cb2d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 6 Jun 2023 16:16:10 +0200 Subject: [PATCH 0118/1506] winegstreamer/media_source: Add MF_MT_VIDEO_NOMINAL_RANGE on every video stream types. This seems to be currently required for the source reader to match media types. We need to confirm that the attribute is supposed to be there. CW-Bug-Id: #22324 --- dlls/winegstreamer/media_source.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index c3a76a4239e..ff7d5d2ea70 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -441,6 +441,12 @@ static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *ty } } + for (i = 0; i < count; i++) + { + IMFMediaType_SetUINT32(types[i], &MF_MT_VIDEO_NOMINAL_RANGE, + MFNominalRange_Normal); + } + done: *types_count = count; return hr; From a815b75ce15bcc3c1a1348f0e165372b95affe01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 29 Jun 2023 11:48:55 +0200 Subject: [PATCH 0119/1506] winegstreamer/media_source: Allow concurrent wait_on_sample in the media source. Fixes deadlock in Disaster Report 4: Summer Memories. CW-Bug-Id: #22377 --- dlls/winegstreamer/media_source.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index ff7d5d2ea70..f36f59c7542 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -137,6 +137,9 @@ struct media_stream DWORD stream_id; BOOL active; BOOL eos; + + DWORD busy; + CONDITION_VARIABLE cond; }; enum source_async_op @@ -805,12 +808,25 @@ static HRESULT wait_on_sample(struct media_stream *stream, IUnknown *token) { struct media_source *source = impl_from_IMFMediaSource(stream->media_source); struct wg_parser_buffer buffer; + BOOL ret; TRACE("%p, %p\n", stream, token); - if (wg_parser_stream_get_buffer(source->wg_parser, stream->wg_stream, &buffer)) - return media_stream_send_sample(stream, &buffer, token); + stream->busy = TRUE; + LeaveCriticalSection(&source->cs); + ret = wg_parser_stream_get_buffer(source->wg_parser, stream->wg_stream, &buffer); + EnterCriticalSection(&source->cs); + stream->busy = FALSE; + WakeConditionVariable(&stream->cond); + + if (source->state == SOURCE_SHUTDOWN) + { + WARN("media source has been shutdown, returning\n"); + return MF_E_SHUTDOWN; + } + if (ret) + return media_stream_send_sample(stream, &buffer, token); return media_stream_send_eos(source, stream); } @@ -1572,6 +1588,7 @@ static HRESULT WINAPI media_source_Pause(IMFMediaSource *iface) static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) { struct media_source *source = impl_from_IMFMediaSource(iface); + UINT i; TRACE("%p.\n", iface); @@ -1585,6 +1602,14 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) source->state = SOURCE_SHUTDOWN; + for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + wg_parser_stream_disable(stream->wg_stream); + while (stream->busy) + SleepConditionVariableCS(&stream->cond, &source->cs, INFINITE); + } + wg_parser_disconnect(source->wg_parser); source->read_thread_shutdown = true; From 980543fcbad7c787197840b7fb18d2bead390c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 7 Jul 2023 20:53:07 +0200 Subject: [PATCH 0120/1506] winegstreamer/media_source: Free the media source work queue outside of the CS. Possibly fixing some rare deadlock with MSFS. --- dlls/winegstreamer/media_source.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index f36f59c7542..9c32a759a69 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1392,6 +1392,7 @@ static ULONG WINAPI media_source_Release(IMFMediaSource *iface) if (!ref) { IMFMediaSource_Shutdown(iface); + MFUnlockWorkQueue(source->async_commands_queue); IMFMediaEventQueue_Release(source->event_queue); IMFByteStream_Release(source->byte_stream); wg_parser_destroy(source->wg_parser); From 3c3ab918bb9093503f19642ceaf267815d5a05b6 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 10 Aug 2022 19:11:51 +0200 Subject: [PATCH 0121/1506] HACK: winegstreamer/wg_parser: Use capssetter to ignore non-default YUV color spaces. --- dlls/winegstreamer/wg_parser.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 5df62925121..d54be648e46 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -933,6 +933,49 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser if (!strcmp(name, "video/x-raw")) { + /* Hack?: Flatten down the colorimetry to default values, without + * actually modifying the video at all. + * + * We want to do color matrix conversions when converting from YUV to + * RGB or vice versa. We do *not* want to do color matrix conversions + * when converting YUV <-> YUV or RGB <-> RGB, because these are slow + * (it essentially means always using the slow path, never going through + * liborc). However, we have two videoconvert elements, and it's + * basically impossible to know what conversions each is going to do + * until caps are negotiated (without depending on some implementation + * details, and even then it'snot exactly trivial). And setting + * matrix-mode after caps are negotiated has no effect. + * + * Nor can we just retain colorimetry information the way we retain + * other caps values, because videoconvert automatically clears it if + * not doing passthrough. I think that this would only happen if we have + * to do a double conversion, but that is possible. Not likely, but I + * don't want to have to be the one to find out that there's still a + * game broken. + * + * [Note that we'd actually kind of like to retain colorimetry + * information, just in case it does ever become relevant to pass that + * on to the next DirectShow filter. Hence I think the correct solution + * for upstream is to get videoconvert to Not Do That.] + * + * So as a fallback solution, we force an identity transformation of + * the caps to those with a "default" color matrix—i.e. transform the + * caps, but not the data. We do this by *pre*pending a capssetter to + * the front of the chain, and we remove the matrix-mode setting for the + * videoconvert elements. + */ + if (!(element = create_element("capssetter", "good")) + || !append_element(parser->container, element, &first, &last)) + return false; + gst_util_set_object_arg(G_OBJECT(element), "join", "true"); + /* Actually, this is invalid, but it causes videoconvert to use default + * colorimetry as a result. Yes, this is depending on undocumented + * implementation details. It's a hack. + * + * Sadly there doesn't seem to be a way to get capssetter to clear + * certain fields while leaving others untouched. */ + gst_util_set_object_arg(G_OBJECT(element), "caps", "video/x-raw,colorimetry=0:0:0:0"); + /* DirectShow can express interlaced video, but downstream filters can't * necessarily consume it. In particular, the video renderer can't. */ if (!(element = create_element("deinterlace", "good")) From 0b67574382db622e33a85f1ff06c01cadd26bfab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 May 2023 12:20:17 +0200 Subject: [PATCH 0122/1506] HACK: winegstreamer/wg_parser: Unlink sink pad when freeing streams. As a hack as it is should not be necessary, but, sometimes it looks like the reference leaks. CW-Bug-Id: #22045 --- dlls/winegstreamer/wg_parser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index d54be648e46..7a2933bded2 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -898,8 +898,14 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser) static void free_stream(struct wg_parser_stream *stream) { + GstPad *peer; unsigned int i; + if ((peer = gst_pad_get_peer(stream->my_sink))) + { + gst_pad_unlink(peer, stream->my_sink); + gst_object_unref(peer); + } gst_object_unref(stream->my_sink); if (stream->buffer) From ef501a98e48a384165596e60083220b2a7c69592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 15 Jun 2022 19:12:54 +0200 Subject: [PATCH 0123/1506] HACK: winegstreamer/wg_parser: Set unlimited decodebin buffered size. Fixes problems with Persona 4 while keeping the memory usage lower. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20363 CW-Bug-Id: #20905 CW-Bug-Id: #20980 --- dlls/winegstreamer/wg_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 7a2933bded2..5115f591bf0 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -1933,6 +1933,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) gst_bin_add(GST_BIN(parser->container), element); parser->decodebin = element; + g_object_set(element, "max-size-bytes", G_MAXUINT, NULL); g_signal_connect(element, "pad-added", G_CALLBACK(pad_added_cb), parser); g_signal_connect(element, "pad-removed", G_CALLBACK(pad_removed_cb), parser); g_signal_connect(element, "autoplug-continue", G_CALLBACK(autoplug_continue_cb), parser); From 077a0c1f4ba754643d5a69871c82ae1922882e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 16 May 2023 12:41:04 +0200 Subject: [PATCH 0124/1506] winegstreamer/wg_parser: Request live latency with WINE_ENABLE_GST_LIVE_LATENCY=1. Effectively greatly reducing the memory overhead from avdec_h264, which otherwise starts one decoding thread per frame. CW-Bug-Id: #22045 --- dlls/winegstreamer/wg_parser.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 5115f591bf0..fc38cc3e6ab 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -1372,6 +1372,13 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) gst_query_add_scheduling_mode(query, GST_PAD_MODE_PULL); return TRUE; + case GST_QUERY_LATENCY: + { + const char *live = getenv("WINE_ENABLE_GST_LIVE_LATENCY"); + gst_query_set_latency(query, live && !strcmp(live, "1"), 0, 0); + return TRUE; + } + default: GST_WARNING("Unhandled query type %s.", GST_QUERY_TYPE_NAME(query)); return FALSE; From 68e03e86e112c1d76b0c9704a254f82939f25090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 16 May 2023 12:53:46 +0200 Subject: [PATCH 0125/1506] HACK: ntdll: Enable WINE_ENABLE_GST_LIVE_LATENCY for some games. CW-Bug-Id: #22045 CW-Bug-Id: #22090 --- dlls/ntdll/unix/loader.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 34acbbd4f33..ecf766616ce 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1931,6 +1931,15 @@ static void hacks_init(void) setenv( "WINESTEAMNOEXEC", "1", 0 ); break; } + + if (sgi && (0 + || !strcmp(sgi, "1364780") || !strcmp(sgi, "1952120") || !strcmp(sgi, "2154900") /* Street Fighter 6 */ + || !strcmp(sgi, "1740720") /* Have a Nice Death */ + )) + { + ERR("HACK: setting WINE_ENABLE_GST_LIVE_LATENCY.\n"); + setenv("WINE_ENABLE_GST_LIVE_LATENCY", "1", 0); + } } /*********************************************************************** From edeb7757b9b6ad156838e58514e1c2405de3cd0e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 4 Feb 2022 16:44:54 -0600 Subject: [PATCH 0126/1506] HACK: winegstreamer/wm_reader: Report BGRx for Persona 4 Golden. --- dlls/winegstreamer/wm_reader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 73e208a899a..5cc63e5ad16 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1510,6 +1510,18 @@ static HRESULT init_stream(struct wm_reader *reader) /* API consumers expect RGB video to be bottom-up. */ if (stream->format.u.video.height > 0) stream->format.u.video.height = -stream->format.u.video.height; + + { + /* HACK: Persona 4 Golden tries to read compressed samples, and + * then autoplug them via quartz to a filter that only accepts + * BGRx. This is not trivial to implement. Return BGRx from the + * wmvcore reader for now. */ + + const char *id = getenv("SteamGameId"); + + if (id && !strcmp(id, "1113000")) + stream->format.u.video.format = WG_VIDEO_FORMAT_BGRx; + } } wg_parser_stream_enable(stream->wg_stream, &stream->format, STREAM_ENABLE_FLAG_FLIP_RGB); } From 75bea9c690bc5d6045ce874236e5e1220e1285d0 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 28 Oct 2021 17:47:48 -0500 Subject: [PATCH 0127/1506] HACK: winegstreamer/wm_reader: Report streams in reverse order for wmvcore. --- dlls/winegstreamer/wm_reader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 5cc63e5ad16..4b3b1cb4da3 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1482,7 +1482,7 @@ static HRESULT init_stream(struct wm_reader *reader) { struct wm_stream *stream = &reader->streams[i]; - stream->wg_stream = wg_parser_get_stream(reader->wg_parser, i); + stream->wg_stream = wg_parser_get_stream(reader->wg_parser, reader->stream_count - i - 1); stream->reader = reader; stream->index = i; stream->selection = WMT_ON; @@ -1710,7 +1710,7 @@ static HRESULT wm_reader_read_stream_sample(struct wm_reader *reader, struct wg_ HRESULT hr; BYTE *data; - if (!(stream = wm_reader_get_stream_by_stream_number(reader, buffer->stream + 1))) + if (!(stream = wm_reader_get_stream_by_stream_number(reader, reader->stream_count - buffer->stream))) return E_INVALIDARG; TRACE("Got buffer for '%s' stream %p.\n", get_major_type_string(stream->format.major_type), stream); @@ -1965,7 +1965,7 @@ static HRESULT WINAPI reader_GetNextSample(IWMSyncReader2 *iface, if (!wg_parser_stream_get_buffer(reader->wg_parser, stream ? stream->wg_stream : 0, &wg_buffer)) hr = NS_E_NO_MORE_SAMPLES; else if (SUCCEEDED(hr = wm_reader_read_stream_sample(reader, &wg_buffer, sample, pts, duration, flags))) - stream_number = wg_buffer.stream + 1; + stream_number = reader->stream_count - wg_buffer.stream; } if (stream && hr == NS_E_NO_MORE_SAMPLES) From ee4a0cc4894e21cef81a0d0afc00dc165eeedf8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Jun 2022 16:50:42 +0200 Subject: [PATCH 0128/1506] HACK: winegstreamer/wm_reader: Expose BGRA video format from wm_reader. For Deadly Premonition. CW-Bug-Id: #18799 --- dlls/winegstreamer/wm_reader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 4b3b1cb4da3..4d60f99b60b 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1641,6 +1641,7 @@ static const enum wg_video_format video_formats[] = WG_VIDEO_FORMAT_YUY2, WG_VIDEO_FORMAT_UYVY, WG_VIDEO_FORMAT_YVYU, + WG_VIDEO_FORMAT_BGRA, WG_VIDEO_FORMAT_BGRx, WG_VIDEO_FORMAT_BGR, WG_VIDEO_FORMAT_RGB16, From a97bf94e27b9baf5383eb45db6dc7512e56f4a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 21 Nov 2023 21:34:17 +0100 Subject: [PATCH 0129/1506] HACK: winegstreamer/wm_reader: Use OpenGL video processing pipeline for WMReader. There's many 32-bit games using either the WM reader or the ASF reader filter, and which require conversion from I420 to RGBA. However, ORC fails to create an optimized routine as it doesn't support spilling vector registers and it needs more than what's available in 32-bit x86. The WM reader (and the ASF reader filter) currently reads audio and video samples synchronously, and having a high video decoding latency causes trouble on the audio stream. Using OpenGL to post-process the video, and more specifically for the color conversion makes it generally faster, enough to solve the problem in most cases. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20363 CW-Bug-Id: #20905 CW-Bug-Id: #20980 --- configure.ac | 2 +- dlls/winegstreamer/gst_private.h | 2 +- dlls/winegstreamer/main.c | 5 ++-- dlls/winegstreamer/media_source.c | 2 +- dlls/winegstreamer/quartz_parser.c | 2 +- dlls/winegstreamer/unixlib.c | 32 ++++++++++++++++++-- dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_parser.c | 48 +++++++++++++++++++++++++++++- dlls/winegstreamer/wm_reader.c | 7 +++-- 9 files changed, 89 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 09663996204..a39ef466462 100644 --- a/configure.ac +++ b/configure.ac @@ -1639,7 +1639,7 @@ WINE_NOTICE_WITH(pulse, [test -z "$PULSE_LIBS"], dnl **** Check for gstreamer **** if test "x$with_gstreamer" != "xno" then - WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0],,,, + WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 gstreamer-gl-1.0],,,, [AC_CHECK_HEADER([gst/gst.h], [AC_MSG_CHECKING([whether gint64 defined by gst/gst.h is indeed 64-bit]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 8555ec82300..811f04b9539 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -70,7 +70,7 @@ HRESULT wg_sample_queue_create(struct wg_sample_queue **out); void wg_sample_queue_destroy(struct wg_sample_queue *queue); void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all); -wg_parser_t wg_parser_create(enum wg_parser_type type, bool output_compressed); +wg_parser_t wg_parser_create(enum wg_parser_type type, bool output_compressed, bool use_opengl); void wg_parser_destroy(wg_parser_t parser); HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 0800f8d0f48..c39f216daa5 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -66,17 +66,18 @@ bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size) return TRUE; } -wg_parser_t wg_parser_create(enum wg_parser_type type, bool output_compressed) +wg_parser_t wg_parser_create(enum wg_parser_type type, bool output_compressed, bool use_opengl) { struct wg_parser_create_params params = { .type = type, .output_compressed = output_compressed, + .use_opengl = use_opengl, .err_on = ERR_ON(quartz), .warn_on = WARN_ON(quartz), }; - TRACE("type %#x.\n", type); + TRACE("type %#x, use_opengl %u.\n", type, use_opengl); if (WINE_UNIX_CALL(unix_wg_parser_create, ¶ms)) return 0; diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 9c32a759a69..05cd260faab 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1703,7 +1703,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue))) goto fail; - if (!(parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE))) + if (!(parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE, FALSE))) { hr = E_OUTOFMEMORY; goto fail; diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 9a0e0edab35..45b5f17f934 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -1665,7 +1665,7 @@ static HRESULT parser_create(enum wg_parser_type type, BOOL output_compressed, s if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; - if (!(object->wg_parser = wg_parser_create(type, output_compressed))) + if (!(object->wg_parser = wg_parser_create(type, output_compressed, FALSE))) { free(object); return E_OUTOFMEMORY; diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index a8ab34f6aef..93a86d6b8cb 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -28,10 +28,9 @@ #include #include +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_30 #include -#include -#include -#include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -47,6 +46,8 @@ GST_DEBUG_CATEGORY(wine); +GstGLDisplay *gl_display; + GstStreamType stream_type_from_caps(GstCaps *caps) { const gchar *media_type; @@ -246,6 +247,8 @@ bool push_event(GstPad *pad, GstEvent *event) NTSTATUS wg_init_gstreamer(void *arg) { + static GstGLContext *gl_context; + char arg0[] = "wine"; char arg1[] = "--gst-disable-registry-fork"; char *args[] = {arg0, arg1, NULL}; @@ -281,5 +284,28 @@ NTSTATUS wg_init_gstreamer(void *arg) GST_INFO("GStreamer library version %s; wine built with %d.%d.%d.", gst_version_string(), GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO); + + if (!(gl_display = gst_gl_display_new())) + GST_ERROR("Failed to create OpenGL display"); + else + { + GError *error = NULL; + gboolean ret; + + GST_OBJECT_LOCK(gl_display); + ret = gst_gl_display_create_context(gl_display, NULL, &gl_context, &error); + GST_OBJECT_UNLOCK(gl_display); + g_clear_error(&error); + + if (ret) + gst_gl_display_add_context(gl_display, gl_context); + else + { + GST_ERROR("Failed to create OpenGL context"); + gst_object_unref(gl_display); + gl_display = NULL; + } + } + return STATUS_SUCCESS; } diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 4e2ca6b88bd..55d7613d517 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -224,6 +224,7 @@ struct wg_parser_create_params wg_parser_t parser; wg_parser_type type; UINT8 output_compressed; + UINT8 use_opengl; UINT8 err_on; UINT8 warn_on; }; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index fc38cc3e6ab..ed9c2635a84 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -36,6 +36,8 @@ #include #include +#include + #include "ntstatus.h" #define WIN32_NO_STATUS #include "winternl.h" @@ -43,6 +45,8 @@ #include "unix_private.h" +extern GstGLDisplay *gl_display; + typedef enum { GST_AUTOPLUG_SELECT_TRY, @@ -100,6 +104,8 @@ struct wg_parser struct input_cache_chunk input_cache_chunks[4]; bool use_mediaconv; + bool use_opengl; + GstContext *context; }; static const unsigned int input_cache_chunk_size = 512 << 10; @@ -937,7 +943,32 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser name = gst_structure_get_name(gst_caps_get_structure(caps, 0)); gst_caps_unref(caps); - if (!strcmp(name, "video/x-raw")) + if (!strcmp(name, "video/x-raw") && parser->use_opengl) + { + if (!(element = create_element("glupload", "base")) + || !append_element(parser->container, element, &first, &last)) + return false; + if (!(element = create_element("glcolorconvert", "base")) + || !append_element(parser->container, element, &first, &last)) + return false; + if (!(element = create_element("glvideoflip", "base")) + || !append_element(parser->container, element, &first, &last)) + return false; + stream->flip = element; + if (!(element = create_element("gldeinterlace", "base")) + || !append_element(parser->container, element, &first, &last)) + return false; + if (!(element = create_element("glcolorconvert", "base")) + || !append_element(parser->container, element, &first, &last)) + return false; + if (!(element = create_element("gldownload", "base")) + || !append_element(parser->container, element, &first, &last)) + return false; + + if (!link_src_to_element(pad, first) || !link_element_to_sink(last, stream->my_sink)) + return false; + } + else if (!strcmp(name, "video/x-raw")) { /* Hack?: Flatten down the colorimetry to default values, without * actually modifying the video at all. @@ -1718,6 +1749,8 @@ static NTSTATUS wg_parser_connect(void *args) parser->container = gst_bin_new(NULL); gst_element_set_bus(parser->container, parser->bus); + if (parser->context) + gst_element_set_context(parser->container, parser->context); parser->my_src = gst_pad_new_from_static_template(&src_template, "quartz-src"); gst_pad_set_getrange_function(parser->my_src, src_getrange_cb); @@ -2021,6 +2054,16 @@ static NTSTATUS wg_parser_create(void *args) if (!(parser = calloc(1, sizeof(*parser)))) return E_OUTOFMEMORY; + if ((parser->use_opengl = params->use_opengl && gl_display)) + { + if ((parser->context = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, false))) + gst_context_set_gl_display(parser->context, gl_display); + else + { + GST_ERROR("Failed to create parser context"); + parser->use_opengl = FALSE; + } + } pthread_mutex_init(&parser->mutex, NULL); pthread_cond_init(&parser->init_cond, NULL); @@ -2045,6 +2088,9 @@ static NTSTATUS wg_parser_destroy(void *args) gst_object_unref(parser->bus); } + if (parser->context) + gst_context_unref(parser->context); + pthread_mutex_destroy(&parser->mutex); pthread_cond_destroy(&parser->init_cond); pthread_cond_destroy(&parser->read_cond); diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 4d60f99b60b..9c191a28559 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1452,7 +1452,10 @@ static HRESULT init_stream(struct wm_reader *reader) HRESULT hr; WORD i; - if (!(wg_parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE))) + /* 32-bit GStreamer ORC cannot efficiently convert I420 to RGBA, use OpenGL converter + * in that case but keep the usual codepath otherwise. + */ + if (!(wg_parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE, sizeof(void *) == 4))) return E_OUTOFMEMORY; reader->wg_parser = wg_parser; @@ -1569,7 +1572,7 @@ static HRESULT reinit_stream(struct wm_reader *reader, bool read_compressed) wg_parser_destroy(reader->wg_parser); reader->wg_parser = 0; - if (!(wg_parser = wg_parser_create(WG_PARSER_DECODEBIN, read_compressed))) + if (!(wg_parser = wg_parser_create(WG_PARSER_DECODEBIN, read_compressed, sizeof(void *) == 4 && !read_compressed))) return E_OUTOFMEMORY; reader->wg_parser = wg_parser; From 4cd562ff4bac416b75dea032e2a07c6886619096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 21 Nov 2023 13:47:07 +0100 Subject: [PATCH 0130/1506] HACK: winegstreamer/quartz_parser: Format the decodebin output pins with out%u. King of Fighters XIII requests them by name, to connect them to the Samplegrabber filter. CW-Bug-Id: #20244 --- dlls/winegstreamer/quartz_parser.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 45b5f17f934..6acbb372d20 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -1583,10 +1583,18 @@ static BOOL decodebin_parser_filter_init_gst(struct parser *filter) unsigned int i, stream_count; WCHAR source_name[20]; + const char *sgi = getenv("SteamGameId"); + const WCHAR *format; + + /* King of Fighters XIII requests the WMV decoder filter pins by name + * to connect them to a Sample Grabber filter. + */ + format = (sgi && !strcmp(sgi, "222940")) ? L"out%u" : L"Stream %02u"; + stream_count = wg_parser_get_stream_count(parser); for (i = 0; i < stream_count; ++i) { - swprintf(source_name, ARRAY_SIZE(source_name), L"Stream %02u", i); + swprintf(source_name, ARRAY_SIZE(source_name), format, i); if (!create_pin(filter, wg_parser_get_stream(parser, i), source_name)) return FALSE; } From e8973025e5cb353ea1fdb11f2819a1af81912952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 2 Aug 2022 11:26:20 +0200 Subject: [PATCH 0131/1506] winegstreamer/wg_transform: Allow more input buffer to be queued for uncompressed formats. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20905 --- dlls/winegstreamer/wg_transform.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index fe62fe27248..c84d8f738e2 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -373,6 +373,7 @@ NTSTATUS wg_transform_create(void *args) case WG_MAJOR_TYPE_AUDIO: case WG_MAJOR_TYPE_VIDEO: + transform->attrs.input_queue_length = 16; break; case WG_MAJOR_TYPE_UNKNOWN: GST_FIXME("Format %u not implemented!", input_format.major_type); From 58c8d346005d41390a85eaed4d123618f5d4970b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 17 Aug 2023 11:21:56 +0200 Subject: [PATCH 0132/1506] HACK: winegstreamer/h264_decoder: Do not report live latency for some games. CW-Bug-Id: #22581 --- dlls/winegstreamer/h264_decoder.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 5c48130eee9..0e1792f6b8f 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -117,6 +117,12 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) if (SUCCEEDED(IMFAttributes_GetUINT32(decoder->attributes, &MF_LOW_LATENCY, &low_latency))) attrs.low_latency = !!low_latency; + { + const char *sgi; + if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100"))) + attrs.low_latency = FALSE; + } + if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) return E_FAIL; From 0a4a996f75bd31e9366a8a5975e71501d5b794bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 21 Aug 2023 19:17:48 +0200 Subject: [PATCH 0133/1506] HACK: winegstreamer/wg_transform: Don't add unnecessary and slow? videoflip for some games. CW-Bug-Id: #22581 --- dlls/winegstreamer/wg_transform.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index c84d8f738e2..1f6bdb103d6 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -404,6 +404,19 @@ NTSTATUS wg_transform_create(void *args) break; case WG_MAJOR_TYPE_VIDEO: + { + const char *sgi; + if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100"))) + { + if (!(element = create_element("videoconvert", "base")) + || !append_element(transform->container, element, &first, &last)) + goto out; + gst_util_set_object_arg(G_OBJECT(element), "n-threads", "0"); + /* HACK: skip slow?? videoflip for some games */ + break; + } + } + if (!(element = create_element("videoconvert", "base")) || !append_element(transform->container, element, &first, &last)) goto out; From 8cedd7ae6ba965f49f7bc1737757e6b3208452d4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 21 Aug 2023 12:52:48 -0600 Subject: [PATCH 0134/1506] HACK: winegstreamer/h264_decoder: Disable MF_SA_D3D11_AWARE for some games. CW-Bug-Id: #22581 --- dlls/winegstreamer/h264_decoder.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 0e1792f6b8f..5a098c6e467 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -894,6 +894,12 @@ HRESULT h264_decoder_create(REFIID riid, void **ret) if (FAILED(hr = IMFAttributes_SetUINT32(decoder->attributes, &AVDecVideoAcceleration_H264, TRUE))) goto failed; + { + const char *sgi; + if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100"))) + IMFAttributes_SetUINT32(decoder->attributes, &MF_SA_D3D11_AWARE, FALSE); + } + if (FAILED(hr = MFCreateAttributes(&decoder->output_attributes, 0))) goto failed; if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue))) From 19fe5854dd022e032a350a84ed9705adbd163f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 6 Jul 2021 14:06:11 +0200 Subject: [PATCH 0135/1506] HACK: quartz: Keep a reference on the IMediaPosition interface. In the same way we do for IMediaSeeking. Both interfaces are actually implemented with a shared refcount and releasing both makes the filter be destroyed. For Tokyo Xanadu eX+ crash on launch. CW-Bug-Id: #18994 --- dlls/quartz/filtergraph.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 4100e71be3a..8651d73f539 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -74,6 +74,7 @@ struct filter struct list entry; IBaseFilter *filter; IMediaSeeking *seeking; + IMediaPosition *position; WCHAR *name; BOOL sorting; }; @@ -557,6 +558,7 @@ static BOOL has_output_pins(IBaseFilter *filter) static void update_seeking(struct filter *filter) { + IMediaPosition *position; IMediaSeeking *seeking; if (!filter->seeking) @@ -575,11 +577,19 @@ static void update_seeking(struct filter *filter) IMediaSeeking_Release(seeking); } } + + if (!filter->position) + { + /* Tokyo Xanadu eX+, same as above, same developer, destroys its filter when + * its IMediaPosition interface is released, so cache the interface instead + * of querying for it every time. */ + if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaPosition, (void **)&position))) + filter->position = position; + } } static BOOL is_renderer(struct filter *filter) { - IMediaPosition *media_position; IAMFilterMiscFlags *flags; BOOL ret = FALSE; @@ -589,16 +599,11 @@ static BOOL is_renderer(struct filter *filter) ret = TRUE; IAMFilterMiscFlags_Release(flags); } - else if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaPosition, (void **)&media_position))) - { - if (!has_output_pins(filter->filter)) - ret = TRUE; - IMediaPosition_Release(media_position); - } else { update_seeking(filter); - if (filter->seeking && !has_output_pins(filter->filter)) + if ((filter->seeking || filter->position) && + !has_output_pins(filter->filter)) ret = TRUE; } return ret; @@ -671,6 +676,7 @@ static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface, list_add_head(&graph->filters, &entry->entry); entry->sorting = FALSE; entry->seeking = NULL; + entry->position = NULL; ++graph->version; return duplicate_name ? VFW_S_DUPLICATE_NAME : hr; @@ -738,6 +744,8 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte { IBaseFilter_SetSyncSource(pFilter, NULL); IBaseFilter_Release(pFilter); + if (entry->position) + IMediaPosition_Release(entry->position); if (entry->seeking) IMediaSeeking_Release(entry->seeking); list_remove(&entry->entry); From 58e2d60ac358252d8d668f54f5a09affb69b32d1 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 27 May 2021 19:40:45 +0200 Subject: [PATCH 0136/1506] HACK: mfreadwrite: Ignore source reader flushes for The Medium. --- dlls/mfreadwrite/reader.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c index 057e771ca99..8b729b80455 100644 --- a/dlls/mfreadwrite/reader.c +++ b/dlls/mfreadwrite/reader.c @@ -2104,8 +2104,19 @@ static HRESULT WINAPI src_reader_Flush(IMFSourceReaderEx *iface, DWORD index) struct source_reader *reader = impl_from_IMFSourceReaderEx(iface); HRESULT hr; + const char *sgi; + TRACE("%p, %#lx.\n", iface, index); + sgi = getenv("SteamGameId"); + if (sgi && strcmp(sgi, "1293160") == 0) + { + /* In The Medium flushes sometimes lead to the callback + calling objects that have already been destroyed. */ + WARN("ignoring flush\n"); + return S_OK; + } + EnterCriticalSection(&reader->cs); if (reader->async_callback) From d97504a2d6fe7fd8664f1b9fb7d6534398bea0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 13:21:24 +0100 Subject: [PATCH 0137/1506] strmbase: Add stub IPropertyBag interface for strmbase_filter. Required for Final Fantasy XIV intro video. CW-Bug-Id: #19624 --- include/wine/strmbase.h | 1 + libs/strmbase/filter.c | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 1b4cc3f7657..c5abca26757 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -120,6 +120,7 @@ void strmbase_sink_cleanup(struct strmbase_sink *pin); struct strmbase_filter { IBaseFilter IBaseFilter_iface; + IPropertyBag IPropertyBag_iface; IUnknown IUnknown_inner; IUnknown *outer_unk; LONG refcount; diff --git a/libs/strmbase/filter.c b/libs/strmbase/filter.c index ee41611a198..f9ab84d5a9d 100644 --- a/libs/strmbase/filter.c +++ b/libs/strmbase/filter.c @@ -226,6 +226,8 @@ static HRESULT WINAPI filter_inner_QueryInterface(IUnknown *iface, REFIID iid, v { *out = &filter->IBaseFilter_iface; } + else if (IsEqualIID(iid, &IID_IPropertyBag)) + *out = &filter->IPropertyBag_iface; else { WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); @@ -509,6 +511,51 @@ static const IBaseFilterVtbl filter_vtbl = filter_QueryVendorInfo, }; +static inline struct strmbase_filter *impl_from_IPropertyBag(IPropertyBag *iface) +{ + return CONTAINING_RECORD(iface, struct strmbase_filter, IPropertyBag_iface); +} + +static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out) +{ + struct strmbase_filter *filter = impl_from_IPropertyBag(iface); + return IUnknown_QueryInterface(filter->outer_unk, iid, out); +} + +static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface) +{ + struct strmbase_filter *filter = impl_from_IPropertyBag(iface); + return IUnknown_AddRef(filter->outer_unk); +} + +static ULONG WINAPI property_bag_Release(IPropertyBag *iface) +{ + struct strmbase_filter *filter = impl_from_IPropertyBag(iface); + return IUnknown_Release(filter->outer_unk); +} + +static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *prop_name, VARIANT *value, + IErrorLog *error_log) +{ + FIXME("iface %p, prop_name %s, value %p, error_log %p stub!\n", iface, debugstr_w(prop_name), value, error_log); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *prop_name, VARIANT *value) +{ + FIXME("iface %p, prop_name %s, value %p stub!\n", iface, debugstr_w(prop_name), value); + return E_NOTIMPL; +} + +static const IPropertyBagVtbl property_bag_vtbl = +{ + property_bag_QueryInterface, + property_bag_AddRef, + property_bag_Release, + property_bag_Read, + property_bag_Write, +}; + VOID WINAPI BaseFilterImpl_IncrementPinVersion(struct strmbase_filter *filter) { InterlockedIncrement(&filter->pin_version); @@ -520,6 +567,7 @@ void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer, memset(filter, 0, sizeof(*filter)); filter->IBaseFilter_iface.lpVtbl = &filter_vtbl; + filter->IPropertyBag_iface.lpVtbl = &property_bag_vtbl; filter->IUnknown_inner.lpVtbl = &filter_inner_vtbl; filter->outer_unk = outer ? outer : &filter->IUnknown_inner; filter->refcount = 1; From 1261ea293e9c4f4f5743050372198d0683ec485e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 13:24:44 +0100 Subject: [PATCH 0138/1506] strmbase: Return S_OK from strmbase_filter IPropertyBag_Write. Required for Final Fantasy XIV intro video. CW-Bug-Id: #19624 --- libs/strmbase/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/strmbase/filter.c b/libs/strmbase/filter.c index f9ab84d5a9d..97157478e20 100644 --- a/libs/strmbase/filter.c +++ b/libs/strmbase/filter.c @@ -544,7 +544,7 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *prop_n static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *prop_name, VARIANT *value) { FIXME("iface %p, prop_name %s, value %p stub!\n", iface, debugstr_w(prop_name), value); - return E_NOTIMPL; + return S_OK; } static const IPropertyBagVtbl property_bag_vtbl = From b26513ab26a72aad1e3d02fc2a409db0ebc6b9ce Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 25 Jan 2022 10:29:58 -0600 Subject: [PATCH 0139/1506] HACK: mf: Always allow enumerating source types in topology This lets us connect directly to a source format without a color converter. CW-Bug-Id: #19516 CW-Bug-Id: #19859 --- dlls/mf/session.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index db742350161..242bc3fe88b 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1866,6 +1866,8 @@ static void session_set_topology(struct media_session *session, DWORD flags, IMF { hr = session_bind_output_nodes(topology); + IMFTopology_SetUINT32(topology, &MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES, TRUE); + if (SUCCEEDED(hr)) hr = IMFTopoLoader_Load(session->topo_loader, topology, &resolved_topology, NULL /* FIXME? */); if (SUCCEEDED(hr)) From 92888cd108ea81fb29781bd0bb784c527165d912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 11 Mar 2022 00:26:59 +0100 Subject: [PATCH 0140/1506] HACK: quartz: Return the decodebin filter on WMVideo Decoder DMO lookup. King of Fighters XIII requests it by name, and expects it to be present to connect it to a Samplegrabber filter. CW-Bug-Id: #20244 --- dlls/quartz/filtergraph.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 8651d73f539..efa77e09d0d 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -523,6 +523,13 @@ static IBaseFilter *find_filter_by_name(struct filter_graph *graph, const WCHAR { struct filter *filter; + /* King of Fighters XIII requests the WMV decoder filter by name to + * connect it to a Sample Grabber filter, return our custom decoder + * filter instance instead. + */ + if (!wcscmp(name, L"WMVideo Decoder DMO")) + name = L"GStreamer splitter filter"; + LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry) { if (!wcscmp(filter->name, name)) From b10d09894e9e6b5e46a9a6041b306d93fa9ca34f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 29 Mar 2022 00:48:40 +0300 Subject: [PATCH 0141/1506] HACK: qcap: Return failure from PPB_Load() for UNO. CW-Bug-Id: #20390 --- dlls/qcap/audiorecord.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 775d942f8f8..793348a6925 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -756,12 +756,20 @@ static HRESULT WINAPI PPB_Load(IPersistPropertyBag *iface, IPropertyBag *bag, IE VARIANT var; HRESULT hr; + char sgi[64]; + TRACE("filter %p, bag %p, error_log %p.\n", filter, bag, error_log); V_VT(&var) = VT_I4; if (FAILED(hr = IPropertyBag_Read(bag, L"WaveInID", &var, error_log))) return hr; + if (GetEnvironmentVariableA("SteamGameId", sgi, sizeof(sgi)) && !strcmp(sgi, "470220")) + { + FIXME("HACK: returning error.\n"); + return E_FAIL; + } + EnterCriticalSection(&filter->filter.filter_cs); filter->id = V_I4(&var); LeaveCriticalSection(&filter->filter.filter_cs); From bc7af43bf557dc67bb3c0b2e10138bf507bc000e Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 4 Nov 2021 12:51:31 +0100 Subject: [PATCH 0142/1506] HACK: mfreadwrite/reader: Add a passthrough transform. On Windows media sources typically produce compressed data, so the source reader automatically adds a transform to decompress it. On Wine media sources already care about decompressing data, so there is no need for a transform. However, some applications expect it anyway (e.g., to edit transform attributes) and fail if it's not present. Therefore, this patch adds a trivial passthrough transform implementation to please such programs. CW-Bug-Id: #19126 --- dlls/mfreadwrite/reader.c | 487 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 487 insertions(+) diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c index 8b729b80455..7ff167cc72a 100644 --- a/dlls/mfreadwrite/reader.c +++ b/dlls/mfreadwrite/reader.c @@ -242,6 +242,461 @@ static ULONG source_reader_release(struct source_reader *reader) return refcount; } +struct passthrough_transform +{ + IMFTransform IMFTransform_iface; + LONG refcount; + IMFMediaType *type; + IMFAttributes *attributes; + IMFAttributes *input_attributes; + IMFAttributes *output_attributes; + IMFSample *sample; +}; + +static inline struct passthrough_transform *impl_from_IMFTransform(IMFTransform *iface) +{ + return CONTAINING_RECORD(iface, struct passthrough_transform, IMFTransform_iface); +} + +static HRESULT WINAPI passthrough_transform_QueryInterface(IMFTransform *iface, REFIID riid, void **out) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IMFTransform)) + { + *out = &transform->IMFTransform_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI passthrough_transform_AddRef(IMFTransform *iface) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + ULONG refcount = InterlockedIncrement(&transform->refcount); + + TRACE("%p, refcount %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI passthrough_transform_Release(IMFTransform *iface) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + ULONG refcount = InterlockedDecrement(&transform->refcount); + + TRACE("%p, refcount %lu.\n", iface, refcount); + + if (!refcount) + { + if (transform->type) + IMFMediaType_Release(transform->type); + IMFAttributes_Release(transform->attributes); + IMFAttributes_Release(transform->input_attributes); + IMFAttributes_Release(transform->output_attributes); + if (transform->sample) + IMFSample_Release(transform->sample); + } + + return refcount; +} +static HRESULT WINAPI passthrough_transform_GetStreamLimits(IMFTransform *iface, + DWORD *input_minimum, DWORD *input_maximum, DWORD *output_minimum, DWORD *output_maximum) +{ + TRACE("%p, %p, %p, %p, %p.\n", iface, input_minimum, input_maximum, output_minimum, output_maximum); + + *input_minimum = 1; + *input_maximum = 1; + *output_minimum = 1; + *output_maximum = 1; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetStreamCount(IMFTransform *iface, DWORD *inputs, DWORD *outputs) +{ + TRACE("%p, %p, %p.\n", iface, inputs, outputs); + + *inputs = 1; + *outputs = 1; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetStreamIDs(IMFTransform *iface, + DWORD input_size, DWORD *inputs, DWORD output_size, DWORD *outputs) +{ + TRACE("%p, %ld, %p, %ld, %p.\n", iface, input_size, inputs, output_size, outputs); + + if (input_size < 1 || output_size < 1) + return MF_E_BUFFERTOOSMALL; + + inputs[0] = 0; + outputs[0] = 0; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetInputStreamInfo(IMFTransform *iface, DWORD id, MFT_INPUT_STREAM_INFO *info) +{ + TRACE("%p, %ld, %p.\n", iface, id, info); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + info->hnsMaxLatency = 0; + info->dwFlags = MFT_INPUT_STREAM_PROCESSES_IN_PLACE; + info->cbSize = 0; + info->cbMaxLookahead = 0; + info->cbAlignment = 0; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) +{ + TRACE("%p, %ld, %p.\n", iface, id, info); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + info->dwFlags = MFT_OUTPUT_STREAM_PROVIDES_SAMPLES; + info->cbSize = 0; + info->cbAlignment = 0; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %p.\n", iface, attributes); + + IMFAttributes_AddRef(transform->attributes); + + *attributes = transform->attributes; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetInputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p.\n", iface, id, attributes); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + IMFAttributes_AddRef(transform->input_attributes); + + *attributes = transform->input_attributes; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p.\n", iface, id, attributes); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + IMFAttributes_AddRef(transform->output_attributes); + + *attributes = transform->output_attributes; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_DeleteInputStream(IMFTransform *iface, DWORD id) +{ + TRACE("%p, %ld.\n", iface, id); + + return E_NOTIMPL; +} + +static HRESULT WINAPI passthrough_transform_AddInputStreams(IMFTransform *iface, DWORD streams, DWORD *ids) +{ + TRACE("%p, %ld, %p.\n", iface, streams, ids); + + return E_NOTIMPL; +} + +static HRESULT WINAPI passthrough_transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) +{ + TRACE("%p, %ld, %ld, %p.\n", iface, id, index, type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI passthrough_transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %ld, %p.\n", iface, id, index, type); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (index != 0) + return MF_E_NO_MORE_TYPES; + + if (!transform->type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + *type = transform->type; + IMFMediaType_AddRef(*type); + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p, %ld.\n", iface, id, type, flags); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (!(flags & MFT_SET_TYPE_TEST_ONLY)) + { + if (transform->type) + IMFMediaType_Release(transform->type); + transform->type = type; + IMFMediaType_AddRef(type); + } + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + DWORD cmp_flags; + HRESULT hr; + + TRACE("%p, %ld, %p, %ld.\n", iface, id, type, flags); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (!transform->type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + hr = IMFMediaType_IsEqual(transform->type, type, &cmp_flags); + if (FAILED(hr)) + return hr; + + if (!(cmp_flags & MF_MEDIATYPE_EQUAL_FORMAT_DATA)) + return MF_E_INVALIDMEDIATYPE; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p.\n", iface, id, type); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (!transform->type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + *type = transform->type; + IMFMediaType_AddRef(*type); + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p.\n", iface, id, type); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (!transform->type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + *type = transform->type; + IMFMediaType_AddRef(*type); + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p.\n", iface, id, flags); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + *flags = transform->sample ? 0 : MFT_INPUT_STATUS_ACCEPT_DATA; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_GetOutputStatus(IMFTransform *iface, DWORD *flags) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %p.\n", iface, flags); + + *flags = transform->sample ? MFT_OUTPUT_STATUS_SAMPLE_READY : 0; + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) +{ + FIXME("%p, %s, %s.\n", iface, wine_dbgstr_longlong(lower), wine_dbgstr_longlong(upper)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI passthrough_transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFMediaEvent *event) +{ + FIXME("%p, %ld, %p.\n", iface, id, event); + + return E_NOTIMPL; +} + +static HRESULT WINAPI passthrough_transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) +{ + FIXME("%p, %u, %Iu.\n", iface, message, param); + + return E_NOTIMPL; +} + +static HRESULT WINAPI passthrough_transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + + TRACE("%p, %ld, %p, %ld.\n", iface, id, sample, flags); + + if (id != 0) + return MF_E_INVALIDSTREAMNUMBER; + + if (transform->sample) + return MF_E_NOTACCEPTING; + + transform->sample = sample; + IMFSample_AddRef(sample); + + return S_OK; +} + +static HRESULT WINAPI passthrough_transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, + MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) +{ + struct passthrough_transform *transform = impl_from_IMFTransform(iface); + unsigned int i; + + TRACE("%p, %ld, %ld, %p, %p.\n", iface, flags, count, samples, status); + + if (!transform->sample) + return MF_E_TRANSFORM_NEED_MORE_INPUT; + + if (samples[0].dwStreamID != 0) + return MF_E_INVALIDSTREAMNUMBER; + + samples[0].pSample = transform->sample; + transform->sample = NULL; + + for (i = 1; i < count; ++i) + samples[i].dwStatus = MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE; + + *status = 0; + + return S_OK; +} + +static const IMFTransformVtbl passthrough_transform_vtbl = { + passthrough_transform_QueryInterface, + passthrough_transform_AddRef, + passthrough_transform_Release, + passthrough_transform_GetStreamLimits, + passthrough_transform_GetStreamCount, + passthrough_transform_GetStreamIDs, + passthrough_transform_GetInputStreamInfo, + passthrough_transform_GetOutputStreamInfo, + passthrough_transform_GetAttributes, + passthrough_transform_GetInputStreamAttributes, + passthrough_transform_GetOutputStreamAttributes, + passthrough_transform_DeleteInputStream, + passthrough_transform_AddInputStreams, + passthrough_transform_GetInputAvailableType, + passthrough_transform_GetOutputAvailableType, + passthrough_transform_SetInputType, + passthrough_transform_SetOutputType, + passthrough_transform_GetInputCurrentType, + passthrough_transform_GetOutputCurrentType, + passthrough_transform_GetInputStatus, + passthrough_transform_GetOutputStatus, + passthrough_transform_SetOutputBounds, + passthrough_transform_ProcessEvent, + passthrough_transform_ProcessMessage, + passthrough_transform_ProcessInput, + passthrough_transform_ProcessOutput, +}; + +static HRESULT create_passthrough_transform(IMFTransform **transform) +{ + struct passthrough_transform *obj; + HRESULT hr; + + if (!(obj = calloc(1, sizeof(*obj)))) + return E_OUTOFMEMORY; + + obj->IMFTransform_iface.lpVtbl = &passthrough_transform_vtbl; + obj->refcount = 1; + + hr = MFCreateAttributes(&obj->attributes, 0); + if (SUCCEEDED(hr)) + hr = MFCreateAttributes(&obj->input_attributes, 0); + if (SUCCEEDED(hr)) + hr = MFCreateAttributes(&obj->output_attributes, 0); + + if (SUCCEEDED(hr)) + { + *transform = &obj->IMFTransform_iface; + } + else + { + if (obj->attributes) + IMFAttributes_Release(obj->attributes); + if (obj->input_attributes) + IMFAttributes_Release(obj->input_attributes); + if (obj->output_attributes) + IMFAttributes_Release(obj->output_attributes); + free(obj); + } + + return hr; +} + static HRESULT WINAPI source_reader_async_command_QueryInterface(IUnknown *iface, REFIID riid, void **obj) { if (IsEqualIID(riid, &IID_IUnknown)) @@ -1789,6 +2244,36 @@ static HRESULT source_reader_configure_decoder(struct source_reader *reader, DWO return MF_E_TOPO_CODEC_NOT_FOUND; } +static HRESULT source_reader_add_passthrough_transform(struct source_reader *reader, DWORD index, IMFMediaType *type) +{ + IMFTransform *transform; + HRESULT hr; + + if (FAILED(hr = create_passthrough_transform(&transform))) + return hr; + + if (FAILED(hr = IMFTransform_SetInputType(transform, 0, type, 0))) + { + WARN("Failed to set decoder input type, hr %#lx.\n", hr); + IMFTransform_Release(transform); + return hr; + } + + if (FAILED(hr = IMFTransform_SetOutputType(transform, 0, type, 0))) + { + WARN("Failed to set decoder input type, hr %#lx.\n", hr); + IMFTransform_Release(transform); + return hr; + } + + if (reader->streams[index].decoder.transform) + IMFTransform_Release(reader->streams[index].decoder.transform); + reader->streams[index].decoder.transform = transform; + reader->streams[index].decoder.min_buffer_size = 0; + + return S_OK; +} + static HRESULT source_reader_create_decoder_for_stream(struct source_reader *reader, DWORD index, IMFMediaType *output_type) { MFT_REGISTER_TYPE_INFO in_type, out_type; @@ -1877,6 +2362,8 @@ static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReaderEx *iface, D hr = source_reader_set_compatible_media_type(reader, index, type); if (hr == S_FALSE) hr = source_reader_create_decoder_for_stream(reader, index, type); + else if (hr == S_OK) + hr = source_reader_add_passthrough_transform(reader, index, reader->streams[index].current); if (SUCCEEDED(hr)) hr = source_reader_setup_sample_allocator(reader, index); From 736bdca359a5974bc4d43e1b8710e817b99a3510 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 15 Nov 2021 13:06:10 +0100 Subject: [PATCH 0143/1506] mfreadwrite/reader: Setup the sample allocator in ReadSample. Currently the source reader creates a sample allocator as soon as SetCurrentMediaType() is called. However on Windows if the output attribute MF_SA_D3D11_SHARED_WITHOUT_MUTEX is set on the transform after SetCurrentMediaType() is called, but before ReadSample() is called, the sample allocator will generate shareable samples. In order to emulate the same behavior, we defer creating the sample allocator to the first ReadSample() call, so the most updated attributes are picked up. With this and the previous two patches, some video playback bugs are solved for some games (e.g. Trailmakers, Rustler, TOHU and others) when using DXVK (wined3d doesn't currently support shared resources, so there is no way to check with it). CW-Bug-Id: #19126 --- dlls/mfreadwrite/reader.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c index 7ff167cc72a..3bcd55f53eb 100644 --- a/dlls/mfreadwrite/reader.c +++ b/dlls/mfreadwrite/reader.c @@ -1677,6 +1677,8 @@ static HRESULT source_reader_flush(struct source_reader *reader, unsigned int in return hr; } +static HRESULT source_reader_setup_sample_allocator(struct source_reader *reader, unsigned int index); + static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) { struct source_reader *reader = impl_from_async_commands_callback_IMFAsyncCallback(iface); @@ -1706,7 +1708,15 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb { stream = &reader->streams[stream_index]; - if (!(report_sample = source_reader_get_read_result(reader, stream, command->u.read.flags, &status, + if (!stream->allocator) + { + hr = source_reader_setup_sample_allocator(reader, stream_index); + + if (FAILED(hr)) + WARN("Failed to setup the sample allocator, hr %#lx.\n", hr); + } + + if (SUCCEEDED(hr) && !(report_sample = source_reader_get_read_result(reader, stream, command->u.read.flags, &status, &stream_index, &stream_flags, ×tamp, &sample))) { stream->requests++; @@ -2364,8 +2374,12 @@ static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReaderEx *iface, D hr = source_reader_create_decoder_for_stream(reader, index, type); else if (hr == S_OK) hr = source_reader_add_passthrough_transform(reader, index, reader->streams[index].current); - if (SUCCEEDED(hr)) - hr = source_reader_setup_sample_allocator(reader, index); + + if (reader->streams[index].allocator) + { + IMFVideoSampleAllocatorEx_Release(reader->streams[index].allocator); + reader->streams[index].allocator = NULL; + } LeaveCriticalSection(&reader->cs); @@ -2464,7 +2478,15 @@ static HRESULT source_reader_read_sample(struct source_reader *reader, DWORD ind stream = &reader->streams[stream_index]; - if (!source_reader_get_read_result(reader, stream, flags, &hr, actual_index, stream_flags, + if (!stream->allocator) + { + hr = source_reader_setup_sample_allocator(reader, stream_index); + + if (FAILED(hr)) + WARN("Failed to setup the sample allocator, hr %#lx.\n", hr); + } + + if (SUCCEEDED(hr) && !source_reader_get_read_result(reader, stream, flags, &hr, actual_index, stream_flags, timestamp, sample)) { while (!source_reader_got_response_for_stream(reader, stream) && stream->state != STREAM_STATE_EOS) From 3dfce73776626465f05cc42d4356f932f23909eb Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 6 Jun 2022 13:37:48 +0200 Subject: [PATCH 0144/1506] mfplat/sample: Use Copy2DTo when copying samples, if available. CW-Bug-Id: #19126 --- dlls/mfplat/sample.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c index a50f81c93d4..b4253217325 100644 --- a/dlls/mfplat/sample.c +++ b/dlls/mfplat/sample.c @@ -791,6 +791,28 @@ static HRESULT WINAPI sample_GetTotalLength(IMFSample *iface, DWORD *total_lengt return S_OK; } +static HRESULT copy_2d_buffer(IMFMediaBuffer *src, IMFMediaBuffer *dst) +{ + IMF2DBuffer2 *src2d = NULL, *dst2d = NULL; + HRESULT hr = S_OK; + + hr = IMFMediaBuffer_QueryInterface(src, &IID_IMF2DBuffer2, (void **)&src2d); + + if (SUCCEEDED(hr)) + hr = IMFMediaBuffer_QueryInterface(dst, &IID_IMF2DBuffer2, (void **)&dst2d); + + if (SUCCEEDED(hr)) + hr = IMF2DBuffer2_Copy2DTo(src2d, dst2d); + + if (src2d) + IMF2DBuffer2_Release(src2d); + + if (dst2d) + IMF2DBuffer2_Release(dst2d); + + return hr; +} + static HRESULT WINAPI sample_CopyToBuffer(IMFSample *iface, IMFMediaBuffer *buffer) { struct sample *sample = impl_from_IMFSample(iface); @@ -805,6 +827,15 @@ static HRESULT WINAPI sample_CopyToBuffer(IMFSample *iface, IMFMediaBuffer *buff EnterCriticalSection(&sample->attributes.cs); + if (sample->buffer_count == 1) + { + if (SUCCEEDED(hr = copy_2d_buffer(sample->buffers[0], buffer))) + { + LeaveCriticalSection(&sample->attributes.cs); + return hr; + } + } + total_length = sample_get_total_length(sample); dst_current_length = 0; From 97d978424fd6290cf4b5dab50a5e58a75470d9ec Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 6 Jun 2022 14:56:34 +0200 Subject: [PATCH 0145/1506] mfplat/sample: Use contiguous copy. CW-Bug-Id: #19126 --- dlls/mfplat/sample.c | 52 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c index b4253217325..8e489d22acd 100644 --- a/dlls/mfplat/sample.c +++ b/dlls/mfplat/sample.c @@ -791,24 +791,58 @@ static HRESULT WINAPI sample_GetTotalLength(IMFSample *iface, DWORD *total_lengt return S_OK; } +static HRESULT copy_2d_buffer_from_contiguous(IMFMediaBuffer *src, IMF2DBuffer *dst) +{ + DWORD current_length; + HRESULT hr, hr2; + BYTE *ptr; + + hr = IMFMediaBuffer_Lock(src, &ptr, NULL, ¤t_length); + + if (SUCCEEDED(hr)) + { + hr = IMF2DBuffer_ContiguousCopyFrom(dst, ptr, current_length); + + hr2 = IMFMediaBuffer_Unlock(src); + if (FAILED(hr2)) + WARN("Unlocking source buffer %p failed with hr %#lx.\n", src, hr2); + if (FAILED(hr2) && SUCCEEDED(hr)) + hr = hr2; + } + + return hr; +} + static HRESULT copy_2d_buffer(IMFMediaBuffer *src, IMFMediaBuffer *dst) { - IMF2DBuffer2 *src2d = NULL, *dst2d = NULL; - HRESULT hr = S_OK; + IMF2DBuffer2 *src2d2 = NULL, *dst2d2 = NULL; + IMF2DBuffer *dst2 = NULL; + HRESULT hr; - hr = IMFMediaBuffer_QueryInterface(src, &IID_IMF2DBuffer2, (void **)&src2d); + hr = IMFMediaBuffer_QueryInterface(src, &IID_IMF2DBuffer2, (void **)&src2d2); + + if (SUCCEEDED(hr)) + hr = IMFMediaBuffer_QueryInterface(dst, &IID_IMF2DBuffer2, (void **)&dst2d2); if (SUCCEEDED(hr)) - hr = IMFMediaBuffer_QueryInterface(dst, &IID_IMF2DBuffer2, (void **)&dst2d); + hr = IMF2DBuffer2_Copy2DTo(src2d2, dst2d2); + + if (src2d2) + IMF2DBuffer2_Release(src2d2); + + if (dst2d2) + IMF2DBuffer2_Release(dst2d2); if (SUCCEEDED(hr)) - hr = IMF2DBuffer2_Copy2DTo(src2d, dst2d); + return hr; - if (src2d) - IMF2DBuffer2_Release(src2d); + hr = IMFMediaBuffer_QueryInterface(dst, &IID_IMF2DBuffer, (void **)&dst2); + + if (SUCCEEDED(hr)) + hr = copy_2d_buffer_from_contiguous(src, dst2); - if (dst2d) - IMF2DBuffer2_Release(dst2d); + if (dst2) + IMF2DBuffer_Release(dst2); return hr; } From 8f8b3763178e0677c1cff2ca6121b66bc54f95a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 12 May 2022 22:03:43 +0200 Subject: [PATCH 0146/1506] winegstreamer: Register stub WMVDecMediaObject transform. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 --- dlls/winegstreamer/mfplat.c | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index ecebae85ad8..8165eb44d9c 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -41,6 +41,8 @@ DEFINE_MEDIATYPE_GUID(MFAudioFormat_RAW_AAC,WAVE_FORMAT_RAW_AAC1); DEFINE_MEDIATYPE_GUID(MFVideoFormat_VC1S,MAKEFOURCC('V','C','1','S')); DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50,MAKEFOURCC('I','V','5','0')); +extern GUID MEDIASUBTYPE_VC1S; + struct class_factory { IClassFactory IClassFactory_iface; @@ -880,6 +882,42 @@ static void mf_media_type_to_wg_format_video_indeo(IMFMediaType *type, uint32_t format->u.video_indeo.version = version; } +static void mf_media_type_to_wg_format_wmv(IMFMediaType *type, const GUID *subtype, struct wg_format *format) +{ + UINT64 frame_rate, frame_size; + + format->major_type = WG_MAJOR_TYPE_VIDEO_WMV; + format->u.video_wmv.width = 0; + format->u.video_wmv.height = 0; + format->u.video_wmv.fps_n = 1; + format->u.video_wmv.fps_d = 1; + + if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) + { + format->u.video_wmv.width = (UINT32)(frame_size >> 32); + format->u.video_wmv.height = (UINT32)frame_size; + } + + if (SUCCEEDED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_RATE, &frame_rate)) && (UINT32)frame_rate) + { + format->u.video_wmv.fps_n = (UINT32)(frame_rate >> 32); + format->u.video_wmv.fps_d = (UINT32)frame_rate; + } + + if (IsEqualGUID(subtype, &MFVideoFormat_WMV1)) + format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_WMV1; + else if (IsEqualGUID(subtype, &MFVideoFormat_WMV2)) + format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_WMV2; + else if (IsEqualGUID(subtype, &MFVideoFormat_WMV3)) + format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_WMV3; + else if (IsEqualGUID(subtype, &MEDIASUBTYPE_WMVA)) + format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_WMVA; + else if (IsEqualGUID(subtype, &MFVideoFormat_WVC1)) + format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_WVC1; + else + format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_UNKNOWN; +} + void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) { GUID major_type, subtype; @@ -915,6 +953,16 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) mf_media_type_to_wg_format_video_h264(type, format); else if (IsEqualGUID(&subtype, &MFVideoFormat_IV50)) mf_media_type_to_wg_format_video_indeo(type, 5, format); + else if (IsEqualGUID(&subtype, &MFVideoFormat_WMV1) + || IsEqualGUID(&subtype, &MFVideoFormat_WMV2) + || IsEqualGUID(&subtype, &MFVideoFormat_WMV3) + || IsEqualGUID(&subtype, &MEDIASUBTYPE_WMVP) + || IsEqualGUID(&subtype, &MEDIASUBTYPE_WVP2) + || IsEqualGUID(&subtype, &MEDIASUBTYPE_WMVR) + || IsEqualGUID(&subtype, &MEDIASUBTYPE_WMVA) + || IsEqualGUID(&subtype, &MFVideoFormat_WVC1) + || IsEqualGUID(&subtype, &MEDIASUBTYPE_VC1S)) + mf_media_type_to_wg_format_wmv(type, &subtype, format); else mf_media_type_to_wg_format_video(type, &subtype, format); } From 93760c093ee83018c735a7dd0d4f8cda4d85af66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 20 May 2022 21:48:59 +0200 Subject: [PATCH 0147/1506] qasf: Register ASF Reader filter media type. --- dlls/qasf/qasf.rgs | 15 +++++++++++++++ dlls/qasf/version.rc | 3 +++ 2 files changed, 18 insertions(+) create mode 100644 dlls/qasf/qasf.rgs diff --git a/dlls/qasf/qasf.rgs b/dlls/qasf/qasf.rgs new file mode 100644 index 00000000000..de0d3e425ed --- /dev/null +++ b/dlls/qasf/qasf.rgs @@ -0,0 +1,15 @@ +HKCR +{ + NoRemove 'Media Type' + { + '{e436eb83-524f-11ce-9f53-0020af0ba770}' + { + '{6b6d0801-9ada-11d0-a520-00a0d10129c0}' + { + val '0' = s '0,4,,3026b275' + val '1' = s '0,4,,d129e2d6' + val 'Source Filter' = s '{187463a0-5bb7-11d3-acbe-0080c75e246e}' + } + } + } +} diff --git a/dlls/qasf/version.rc b/dlls/qasf/version.rc index dab46194395..70ec03ad6b1 100644 --- a/dlls/qasf/version.rc +++ b/dlls/qasf/version.rc @@ -24,3 +24,6 @@ #define WINE_PRODUCTVERSION_STR "9.0.0.4503" #include "wine/wine_common_ver.rc" + +/* @makedep: qasf.rgs */ +1 WINE_REGISTRY qasf.rgs From 9205a8a921efd167780fd989ddcff838264e4346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 2 Aug 2022 11:26:09 +0200 Subject: [PATCH 0148/1506] qasf: Keep calling DMO ProcessOutput until error is returned. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20905 --- dlls/qasf/dmowrapper.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dlls/qasf/dmowrapper.c b/dlls/qasf/dmowrapper.c index 95e12e860ae..8b484d9b25a 100644 --- a/dlls/qasf/dmowrapper.c +++ b/dlls/qasf/dmowrapper.c @@ -206,7 +206,6 @@ static HRESULT process_output(struct dmo_wrapper *filter, IMediaObject *dmo) { DMO_OUTPUT_DATA_BUFFER *buffers = filter->buffers; DWORD status, i; - BOOL more_data; HRESULT hr; for (i = 0; i < filter->source_count; ++i) @@ -228,8 +227,6 @@ static HRESULT process_output(struct dmo_wrapper *filter, IMediaObject *dmo) do { - more_data = FALSE; - hr = IMediaObject_ProcessOutput(dmo, DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER, filter->source_count, buffers, &status); if (hr != S_OK) @@ -242,9 +239,6 @@ static HRESULT process_output(struct dmo_wrapper *filter, IMediaObject *dmo) if (!buffers[i].pBuffer) continue; - if (buffers[i].dwStatus & DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE) - more_data = TRUE; - if (buffers[i].dwStatus & DMO_OUTPUT_DATA_BUFFERF_TIME) { if (buffers[i].dwStatus & DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH) @@ -270,7 +264,7 @@ static HRESULT process_output(struct dmo_wrapper *filter, IMediaObject *dmo) } } - } while (more_data); + } while (1); out: for (i = 0; i < filter->source_count; ++i) From 3ea5fe4ba7575a7849a98bb24c588bd842e149db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 2 Aug 2022 10:50:35 +0200 Subject: [PATCH 0149/1506] HACK: winegstreamer/wma_decoder: Allow WMA decoder DMO to pass-through buffers. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20905 --- dlls/winegstreamer/wma_decoder.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index 62279e4d108..d5f5aca38bf 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -29,7 +29,6 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wmadec); -WINE_DECLARE_DEBUG_CHANNEL(winediag); static const GUID *const wma_decoder_input_types[] = { @@ -700,7 +699,6 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index { struct wma_decoder *decoder = impl_from_IMediaObject(iface); struct wg_format wg_format; - unsigned int i; TRACE("iface %p, index %lu, type %p, flags %#lx.\n", iface, index, type, flags); @@ -727,15 +725,8 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Audio)) return DMO_E_TYPE_NOT_ACCEPTED; - for (i = 0; i < ARRAY_SIZE(wma_decoder_input_types); ++i) - if (IsEqualGUID(&type->subtype, wma_decoder_input_types[i])) - break; - if (i == ARRAY_SIZE(wma_decoder_input_types)) - return DMO_E_TYPE_NOT_ACCEPTED; - if (!amt_to_wg_format((const AM_MEDIA_TYPE *)type, &wg_format)) return DMO_E_TYPE_NOT_ACCEPTED; - assert(wg_format.major_type == WG_MAJOR_TYPE_AUDIO_WMA); if (flags & DMO_SET_TYPEF_TEST_ONLY) return S_OK; @@ -1026,32 +1017,11 @@ static const IPropertyBagVtbl property_bag_vtbl = HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out) { - static const struct wg_format output_format = - { - .major_type = WG_MAJOR_TYPE_AUDIO, - .u.audio = - { - .format = WG_AUDIO_FORMAT_F32LE, - .channel_mask = 1, - .channels = 1, - .rate = 44100, - }, - }; - static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_AUDIO_WMA}; - struct wg_transform_attrs attrs = {0}; - wg_transform_t transform; struct wma_decoder *decoder; HRESULT hr; TRACE("outer %p, out %p.\n", outer, out); - if (!(transform = wg_transform_create(&input_format, &output_format, &attrs))) - { - ERR_(winediag)("GStreamer doesn't support WMA decoding, please install appropriate plugins\n"); - return E_FAIL; - } - wg_transform_destroy(transform); - if (!(decoder = calloc(1, sizeof(*decoder)))) return E_OUTOFMEMORY; From bdba19f58a4d135da2c2153aa1d58c9b74422526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 21 Nov 2023 18:42:14 +0100 Subject: [PATCH 0150/1506] HACK: winegstreamer/wma_decoder: Support XMAudio2 input format in WMA decoder. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391 CW-Bug-Id: #16839 CW-Bug-Id: #18678 CW-Bug-Id: #19362 Wine-Staging: mfplat-streaming-support --- dlls/winegstreamer/mfplat.c | 11 ++++++++++- dlls/winegstreamer/quartz_parser.c | 14 ++++++++++++-- dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_format.c | 18 ++++++++++++++---- dlls/winegstreamer/wma_decoder.c | 3 +++ 5 files changed, 40 insertions(+), 7 deletions(-) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 8165eb44d9c..3e5f8c7b1ee 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -38,6 +38,7 @@ DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0 DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32,D3DFMT_A8B8G8R8); DEFINE_MEDIATYPE_GUID(MFAudioFormat_RAW_AAC,WAVE_FORMAT_RAW_AAC1); +DEFINE_MEDIATYPE_GUID(MFAudioFormat_XMAudio2, 0x0166); DEFINE_MEDIATYPE_GUID(MFVideoFormat_VC1S,MAKEFOURCC('V','C','1','S')); DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50,MAKEFOURCC('I','V','5','0')); @@ -750,6 +751,7 @@ static void mf_media_type_to_wg_format_audio_wma(IMFMediaType *type, const GUID { UINT32 rate, depth, channels, block_align, bytes_per_second, codec_data_len; BYTE codec_data[64]; + bool is_xma = false; UINT32 version; if (FAILED(IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &rate))) @@ -791,6 +793,11 @@ static void mf_media_type_to_wg_format_audio_wma(IMFMediaType *type, const GUID version = 3; else if (IsEqualGUID(subtype, &MFAudioFormat_WMAudio_Lossless)) version = 4; + else if (IsEqualGUID(subtype, &MFAudioFormat_XMAudio2)) + { + version = 2; + is_xma = true; + } else { assert(0); @@ -806,6 +813,7 @@ static void mf_media_type_to_wg_format_audio_wma(IMFMediaType *type, const GUID format->u.audio_wma.block_align = block_align; format->u.audio_wma.codec_data_len = codec_data_len; memcpy(format->u.audio_wma.codec_data, codec_data, codec_data_len); + format->u.audio_wma.is_xma = is_xma; } static void mf_media_type_to_wg_format_video_h264(IMFMediaType *type, struct wg_format *format) @@ -940,7 +948,8 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) if (IsEqualGUID(&subtype, &MEDIASUBTYPE_MSAUDIO1) || IsEqualGUID(&subtype, &MFAudioFormat_WMAudioV8) || IsEqualGUID(&subtype, &MFAudioFormat_WMAudioV9) || - IsEqualGUID(&subtype, &MFAudioFormat_WMAudio_Lossless)) + IsEqualGUID(&subtype, &MFAudioFormat_WMAudio_Lossless) || + IsEqualGUID(&subtype, &MFAudioFormat_XMAudio2)) mf_media_type_to_wg_format_audio_wma(type, &subtype, format); else if (IsEqualGUID(&subtype, &MFAudioFormat_AAC) || IsEqualGUID(&subtype, &MFAudioFormat_RAW_AAC)) mf_media_type_to_wg_format_audio_mpeg4(type, &subtype, format); diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 6acbb372d20..42ddb551575 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -41,6 +41,7 @@ static const GUID MEDIASUBTYPE_CVID = {mmioFOURCC('c','v','i','d'), 0x0000, 0x00 static const GUID MEDIASUBTYPE_VC1S = {mmioFOURCC('V','C','1','S'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; static const GUID MEDIASUBTYPE_MP3 = {WAVE_FORMAT_MPEGLAYER3, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; static const GUID MEDIASUBTYPE_WMV_Unknown = {0x7ce12ca9, 0xbfbf, 0x43d9, {0x9d, 0x00, 0x82, 0xb8, 0xed, 0x54, 0x31, 0x6b}}; +static const GUID MEDIASUBTYPE_XMAUDIO2 = {0x0166, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; extern const GUID MFVideoFormat_ABGR32; struct parser @@ -302,6 +303,11 @@ static bool amt_from_wg_format_audio_wma(AM_MEDIA_TYPE *mt, const struct wg_form subtype = &MEDIASUBTYPE_WMAUDIO2; codec_data_len = WMAUDIO2_WFX_EXTRA_BYTES; fmt_tag = WAVE_FORMAT_WMAUDIO2; + if (format->u.audio_wma.is_xma) + { + subtype = &MEDIASUBTYPE_XMAUDIO2; + fmt_tag = 0x0166; + } break; case 3: subtype = &MEDIASUBTYPE_WMAUDIO3; @@ -869,7 +875,8 @@ static bool amt_to_wg_format_audio_mpeg1_layer3(const AM_MEDIA_TYPE *mt, struct return true; } -static bool amt_to_wg_format_audio_wma(const AM_MEDIA_TYPE *mt, struct wg_format *format) +static bool amt_to_wg_format_audio_wma(const AM_MEDIA_TYPE *mt, struct wg_format *format, + bool is_xma) { const WAVEFORMATEX *audio_format = (const WAVEFORMATEX *)mt->pbFormat; @@ -895,6 +902,7 @@ static bool amt_to_wg_format_audio_wma(const AM_MEDIA_TYPE *mt, struct wg_format else assert(false); format->major_type = WG_MAJOR_TYPE_AUDIO_WMA; + format->u.audio_wma.is_xma = is_xma; format->u.audio_wma.bitrate = audio_format->nAvgBytesPerSec * 8; format->u.audio_wma.rate = audio_format->nSamplesPerSec; format->u.audio_wma.depth = audio_format->wBitsPerSample; @@ -1075,7 +1083,9 @@ bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format) || IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMAUDIO2) || IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMAUDIO3) || IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_WMAUDIO_LOSSLESS)) - return amt_to_wg_format_audio_wma(mt, format); + return amt_to_wg_format_audio_wma(mt, format, false); + if (IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_XMAUDIO2)) + return amt_to_wg_format_audio_wma(mt, format, true); return amt_to_wg_format_audio(mt, format); } diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 55d7613d517..4b15168ae62 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -126,6 +126,7 @@ struct wg_format uint32_t block_align; uint32_t codec_data_len; unsigned char codec_data[64]; + UINT8 is_xma; } audio_wma; struct diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 34036b50e3d..7b9a2a3b8b2 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -640,10 +640,20 @@ static GstCaps *wg_format_to_caps_audio_wma(const struct wg_format *format) GstBuffer *buffer; GstCaps *caps; - if (!(caps = gst_caps_new_empty_simple("audio/x-wma"))) - return NULL; - if (format->u.audio_wma.version) - gst_caps_set_simple(caps, "wmaversion", G_TYPE_INT, format->u.audio_wma.version, NULL); + if (format->u.audio_wma.is_xma) + { + if (!(caps = gst_caps_new_empty_simple("audio/x-xma"))) + return NULL; + if (format->u.audio_wma.version) + gst_caps_set_simple(caps, "xmaversion", G_TYPE_INT, format->u.audio_wma.version, NULL); + } + else + { + if (!(caps = gst_caps_new_empty_simple("audio/x-wma"))) + return NULL; + if (format->u.audio_wma.version) + gst_caps_set_simple(caps, "wmaversion", G_TYPE_INT, format->u.audio_wma.version, NULL); + } if (format->u.audio_wma.bitrate) gst_caps_set_simple(caps, "bitrate", G_TYPE_INT, format->u.audio_wma.bitrate, NULL); diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index d5f5aca38bf..9a9ea857e0d 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -30,12 +30,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(wmadec); +extern const GUID MFAudioFormat_XMAudio2; + static const GUID *const wma_decoder_input_types[] = { &MEDIASUBTYPE_MSAUDIO1, &MFAudioFormat_WMAudioV8, &MFAudioFormat_WMAudioV9, &MFAudioFormat_WMAudio_Lossless, + &MFAudioFormat_XMAudio2, }; static const GUID *const wma_decoder_output_types[] = { From 4b928e219d60f20282c831bec0c512ac66dec7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 21 Nov 2023 14:11:01 +0100 Subject: [PATCH 0151/1506] HACK: winegstreamer/wmv_decoder: Implement WMVDecMediaObject pass-through DMO. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 --- dlls/winegstreamer/wmv_decoder.c | 45 +++++++------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/dlls/winegstreamer/wmv_decoder.c b/dlls/winegstreamer/wmv_decoder.c index 89da25074c6..48940573f08 100644 --- a/dlls/winegstreamer/wmv_decoder.c +++ b/dlls/winegstreamer/wmv_decoder.c @@ -28,7 +28,6 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(mfplat); -WINE_DECLARE_DEBUG_CHANNEL(winediag); extern const GUID MEDIASUBTYPE_VC1S; @@ -486,7 +485,6 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index { struct wmv_decoder *decoder = impl_from_IMediaObject(iface); struct wg_format wg_format; - unsigned int i; TRACE("iface %p, index %lu, type %p, flags %#lx.\n", iface, index, type, flags); @@ -511,17 +509,18 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Video)) return DMO_E_TYPE_NOT_ACCEPTED; - for (i = 0; i < ARRAY_SIZE(wmv_decoder_input_types); ++i) - if (IsEqualGUID(&type->subtype, wmv_decoder_input_types[i])) - break; - if (i == ARRAY_SIZE(wmv_decoder_input_types)) - return DMO_E_TYPE_NOT_ACCEPTED; - if (!amt_to_wg_format((const AM_MEDIA_TYPE *)type, &wg_format)) return DMO_E_TYPE_NOT_ACCEPTED; - assert(wg_format.major_type == WG_MAJOR_TYPE_VIDEO_WMV); - wg_format.u.video_wmv.fps_n = 0; - wg_format.u.video_wmv.fps_d = 0; + if (wg_format.major_type == WG_MAJOR_TYPE_VIDEO_WMV) + { + wg_format.u.video_wmv.fps_n = 0; + wg_format.u.video_wmv.fps_d = 0; + } + else if (wg_format.major_type == WG_MAJOR_TYPE_VIDEO) + { + wg_format.u.video.fps_n = 0; + wg_format.u.video.fps_d = 0; + } if (flags & DMO_SET_TYPEF_TEST_ONLY) return S_OK; @@ -880,35 +879,11 @@ static const IPropertyStoreVtbl property_store_vtbl = HRESULT wmv_decoder_create(IUnknown *outer, IUnknown **out) { - static const struct wg_format input_format = - { - .major_type = WG_MAJOR_TYPE_VIDEO_WMV, - .u.video_wmv.format = WG_WMV_VIDEO_FORMAT_WMV3, - }; - static const struct wg_format output_format = - { - .major_type = WG_MAJOR_TYPE_VIDEO, - .u.video = - { - .format = WG_VIDEO_FORMAT_NV12, - .width = 1920, - .height = 1080, - }, - }; - struct wg_transform_attrs attrs = {0}; - wg_transform_t transform; struct wmv_decoder *decoder; HRESULT hr; TRACE("outer %p, out %p.\n", outer, out); - if (!(transform = wg_transform_create(&input_format, &output_format, &attrs))) - { - ERR_(winediag)("GStreamer doesn't support WMV decoding, please install appropriate plugins.\n"); - return E_FAIL; - } - wg_transform_destroy(transform); - if (!(decoder = calloc(1, sizeof(*decoder)))) return E_OUTOFMEMORY; if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue))) From aed2deadc7921f93c8c80ab931002472a8daa7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 17 Aug 2022 08:58:46 +0200 Subject: [PATCH 0152/1506] HACK: quartz: Reduce the number of committed buffers for P4G. The game requests 30 buffers of 8M for the video and 30 additional buffers for the audio stream. We're already near the 32bit VM limit and fragmentation often makes it fail. 8 buffers should hopefully be enough overall. CW-Bug-Id: #20363 --- dlls/quartz/memallocator.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 87869b4d6b2..7a171769574 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -162,6 +162,7 @@ static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator * iface) static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator * iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual) { BaseMemAllocator *This = impl_from_IMemAllocator(iface); + const char *sgi; HRESULT hr; TRACE("(%p)->(%p, %p)\n", This, pRequest, pActual); @@ -169,6 +170,10 @@ static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator * iface, ALLO TRACE("Requested %ld buffers, size %ld, alignment %ld, prefix %ld.\n", pRequest->cBuffers, pRequest->cbBuffer, pRequest->cbAlign, pRequest->cbPrefix); + sgi = getenv("SteamGameId"); + if (sgi && (!strcmp(sgi, "1113000"))) + pRequest->cBuffers = min(8, pRequest->cBuffers); + EnterCriticalSection(This->pCritSect); { if (!list_empty(&This->used_list)) From 3454941bb0fd851182a5ec6dfc9456017a34ced4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 18 Aug 2022 16:38:19 +0200 Subject: [PATCH 0153/1506] HACK: mf/topology_loader: Force initialize downstream media type if it's not. --- dlls/mf/topology_loader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 6b6d39d76d1..def7c28089c 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -347,7 +347,10 @@ static HRESULT get_first_supported_media_type(IMFMediaTypeHandler *handler, IMFM for (i = 0; SUCCEEDED(hr = IMFMediaTypeHandler_GetMediaTypeByIndex(handler, i, &media_type)); i++) { - if (SUCCEEDED(hr = IMFMediaTypeHandler_IsMediaTypeSupported(handler, media_type, NULL))) + /* HACK: Force initialize media type here, this is now something the topology laoder should do + * according to conformance tests but it should hopefully going to solve uninitialized audio + * renderer issues. */ + if (SUCCEEDED(hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, media_type))) { *type = media_type; return hr; From f2a086855a80eeac46b0008ae2736d6371faddac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 22 Aug 2022 18:49:06 +0200 Subject: [PATCH 0154/1506] winegstreamer/wm_reader: Avoid entering sync reader CS in GetNextSample when aggregated. CW-Bug-Id: #21147 --- dlls/winegstreamer/wm_reader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 9c191a28559..f4aef699bbf 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1952,7 +1952,8 @@ static HRESULT WINAPI reader_GetNextSample(IWMSyncReader2 *iface, if (!stream_number && !output_number && !ret_stream_number) return E_INVALIDARG; - EnterCriticalSection(&reader->cs); + if (reader->outer == &reader->IUnknown_inner) + EnterCriticalSection(&reader->cs); if (!stream_number) stream = NULL; @@ -1980,7 +1981,8 @@ static HRESULT WINAPI reader_GetNextSample(IWMSyncReader2 *iface, if (ret_stream_number && (hr == S_OK || stream_number)) *ret_stream_number = stream_number; - LeaveCriticalSection(&reader->cs); + if (reader->outer == &reader->IUnknown_inner) + LeaveCriticalSection(&reader->cs); return hr; } From 72c4083ee44abe0c3ba0505e715e4d67319704eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Sep 2022 08:05:48 +0200 Subject: [PATCH 0155/1506] wmvcore: Spawn stream read threads for async reader streams. CW-Bug-Id: #21147 --- dlls/wmvcore/async_reader.c | 254 +++++++++++++++++++++++++++++++++--- 1 file changed, 234 insertions(+), 20 deletions(-) diff --git a/dlls/wmvcore/async_reader.c b/dlls/wmvcore/async_reader.c index 3a8556a5f0a..6423fe7a2ea 100644 --- a/dlls/wmvcore/async_reader.c +++ b/dlls/wmvcore/async_reader.c @@ -60,12 +60,25 @@ struct async_op struct sample { + struct list entry; INSSBuffer *buffer; QWORD pts, duration; DWORD flags, output; WORD stream; }; +struct stream +{ + struct async_reader *reader; + WORD number; + + HANDLE read_thread; + bool read_requested; + CONDITION_VARIABLE read_cv; + struct list read_samples; + HRESULT read_result; +}; + struct async_reader { IWMReader IWMReader_iface; @@ -79,6 +92,7 @@ struct async_reader LONG refcount; IWMSyncReader2 *reader; + IWMProfile3 *profile; CRITICAL_SECTION cs; @@ -94,6 +108,9 @@ struct async_reader CRITICAL_SECTION callback_cs; CONDITION_VARIABLE callback_cv; + DWORD stream_count; + struct stream *streams; + bool running; struct list async_ops; @@ -293,31 +310,180 @@ static void async_reader_deliver_sample(struct async_reader *reader, struct samp TRACE("Callback returned %#lx.\n", hr); + list_remove(&sample->entry); INSSBuffer_Release(sample->buffer); + free(sample); +} + +static void stream_request_read(struct stream *stream) +{ + stream->read_result = E_PENDING; + stream->read_requested = true; + WakeConditionVariable(&stream->read_cv); +} + +static DWORD WINAPI stream_read_thread(void *arg) +{ + struct stream *stream = arg; + struct async_reader *reader = stream->reader; + struct sample *sample; + HRESULT hr; + + TRACE("reader %p, number %u\n", reader, stream->number); + + EnterCriticalSection(&reader->callback_cs); + + while (reader->running) + { + if (!stream->read_requested) + { + SleepConditionVariableCS(&stream->read_cv, &reader->callback_cs, INFINITE); + continue; + } + + if (!(sample = calloc(1, sizeof(*sample)))) + { + WARN("Failed to allocate memory for sample.\n"); + continue; + } + + while (stream->read_requested) + { + stream->read_requested = false; + + if (sample->buffer) + INSSBuffer_Release(sample->buffer); + sample->buffer = NULL; + + LeaveCriticalSection(&reader->callback_cs); + hr = IWMSyncReader2_GetNextSample(reader->reader, stream->number, + &sample->buffer, &sample->pts, &sample->duration, + &sample->flags, &sample->output, &sample->stream); + EnterCriticalSection(&reader->callback_cs); + } + + if (SUCCEEDED(stream->read_result = hr)) + { + TRACE("Got stream %u buffer with pts %I64d.\n", stream->number, sample->pts); + list_add_tail(&stream->read_samples, &sample->entry); + } + else + { + WARN("Failed to get stream %u sample, hr %#lx.\n", stream->number, stream->read_result); + free(sample); + } + + WakeConditionVariable(&reader->callback_cv); + } + + LeaveCriticalSection(&reader->callback_cs); + + TRACE("Reader is stopping; exiting.\n"); + return 0; +} + +static void stream_flush_samples(struct stream *stream) +{ + struct sample *sample, *next; + + LIST_FOR_EACH_ENTRY_SAFE(sample, next, &stream->read_samples, struct sample, entry) + { + list_remove(&sample->entry); + INSSBuffer_Release(sample->buffer); + free(sample); + } +} + +static void stream_close(struct stream *stream) +{ + if (stream->read_thread) + { + WakeConditionVariable(&stream->read_cv); + WaitForSingleObject(stream->read_thread, INFINITE); + CloseHandle(stream->read_thread); + stream->read_thread = NULL; + } + + stream_flush_samples(stream); +} + +static HRESULT stream_open(struct stream *stream, struct async_reader *reader, WORD number) +{ + if (stream->read_thread) + return S_OK; + + stream->number = number; + stream->reader = reader; + list_init(&stream->read_samples); + + if (!(stream->read_thread = CreateThread(NULL, 0, stream_read_thread, stream, 0, NULL))) + return E_OUTOFMEMORY; + + return S_OK; } -static void callback_thread_run(struct async_reader *reader) +static HRESULT async_reader_get_next_sample(struct async_reader *reader, + struct stream **out_stream, struct sample **out_sample) { + struct sample *sample, *first_sample = NULL; + struct stream *stream, *first_stream = NULL; + WMT_STREAM_SELECTION selection; + struct list *entry; + DWORD i; + + for (i = 0; i < reader->stream_count; ++i) + { + stream = reader->streams + i; + + if (FAILED(IWMSyncReader2_GetStreamSelected(reader->reader, i + 1, &selection)) + || selection == WMT_OFF) + continue; + if (!(entry = list_head(&stream->read_samples))) + { + if (stream->read_result == E_PENDING) + return E_PENDING; + continue; + } + + sample = LIST_ENTRY(entry, struct sample, entry); + if (!first_sample || first_sample->pts > sample->pts) + { + first_stream = stream; + first_sample = sample; + } + } + + if (!first_sample) + return NS_E_NO_MORE_SAMPLES; + + TRACE("Found first stream %u with pts %I64d.\n", first_stream->number, first_sample->pts); + *out_sample = first_sample; + *out_stream = first_stream; + return S_OK; +} + +static void async_reader_deliver_samples(struct async_reader *reader) +{ + static const DWORD zero; + IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced; IWMReaderCallback *callback = reader->callback; - static const DWORD zero; HRESULT hr = S_OK; + TRACE("reader %p\n", reader); + while (reader->running && list_empty(&reader->async_ops)) { - struct sample sample; + struct sample *sample; + struct stream *stream; - LeaveCriticalSection(&reader->callback_cs); - hr = IWMSyncReader2_GetNextSample(reader->reader, 0, &sample.buffer, &sample.pts, - &sample.duration, &sample.flags, &sample.output, &sample.stream); - EnterCriticalSection(&reader->callback_cs); - if (hr != S_OK) + if (FAILED(hr = async_reader_get_next_sample(reader, &stream, &sample))) break; - if (async_reader_wait_pts(reader, sample.pts)) - async_reader_deliver_sample(reader, &sample); - else - INSSBuffer_Release(sample.buffer); + stream_request_read(stream); + + if (async_reader_wait_pts(reader, sample->pts)) + async_reader_deliver_sample(reader, sample); } if (hr == NS_E_NO_MORE_SAMPLES) @@ -325,6 +491,8 @@ static void callback_thread_run(struct async_reader *reader) BOOL user_clock = reader->user_clock; QWORD user_time = reader->user_time; + TRACE("No more streams samples, sending EOF notifications.\n"); + LeaveCriticalSection(&reader->callback_cs); IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK, @@ -342,25 +510,27 @@ static void callback_thread_run(struct async_reader *reader) } EnterCriticalSection(&reader->callback_cs); - - TRACE("Reached end of stream; exiting.\n"); } - else if (hr != S_OK) + else if (hr == E_PENDING) { - ERR("Failed to get sample, hr %#lx.\n", hr); + TRACE("Waiting for more streams samples.\n"); } } static DWORD WINAPI async_reader_callback_thread(void *arg) { - struct async_reader *reader = arg; static const DWORD zero; + + struct async_reader *reader = arg; struct list *entry; HRESULT hr = S_OK; + DWORD i; IWMReaderCallback_OnStatus(reader->callback, WMT_OPENED, S_OK, WMT_TYPE_DWORD, (BYTE *)&zero, reader->context); + TRACE("reader %p\n", reader); + EnterCriticalSection(&reader->callback_cs); while (reader->running) @@ -379,19 +549,28 @@ static DWORD WINAPI async_reader_callback_thread(void *arg) if (SUCCEEDED(hr)) hr = IWMSyncReader2_SetRange(reader->reader, op->u.start.start, op->u.start.duration); if (SUCCEEDED(hr)) + { reader->clock_start = get_current_time(reader); + for (i = 0; i < reader->stream_count; ++i) + { + struct stream *stream = reader->streams + i; + stream_flush_samples(stream); + stream_request_read(stream); + } + } + LeaveCriticalSection(&reader->callback_cs); IWMReaderCallback_OnStatus(reader->callback, WMT_STARTED, hr, WMT_TYPE_DWORD, (BYTE *)&zero, reader->context); EnterCriticalSection(&reader->callback_cs); - - if (SUCCEEDED(hr)) - callback_thread_run(reader); break; } case ASYNC_OP_STOP: + if (SUCCEEDED(hr)) + reader->clock_start = 0; + LeaveCriticalSection(&reader->callback_cs); IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, hr, WMT_TYPE_DWORD, (BYTE *)&zero, reader->context); @@ -412,6 +591,9 @@ static DWORD WINAPI async_reader_callback_thread(void *arg) free(op); } + if (reader->clock_start) + async_reader_deliver_samples(reader); + if (reader->running && list_empty(&reader->async_ops)) SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, INFINITE); } @@ -425,6 +607,7 @@ static DWORD WINAPI async_reader_callback_thread(void *arg) static void async_reader_close(struct async_reader *reader) { struct async_op *op, *next; + int i; if (reader->callback_thread) { @@ -439,6 +622,15 @@ static void async_reader_close(struct async_reader *reader) free(op); } + for (i = 0; reader->streams && i < reader->stream_count; ++i) + { + struct stream *stream = reader->streams + i; + stream_close(stream); + } + free(reader->streams); + reader->streams = NULL; + reader->stream_count = 0; + if (reader->allocator) IWMReaderAllocatorEx_Release(reader->allocator); reader->allocator = NULL; @@ -456,6 +648,7 @@ static void async_reader_close(struct async_reader *reader) static HRESULT async_reader_open(struct async_reader *reader, IWMReaderCallback *callback, void *context) { HRESULT hr = E_OUTOFMEMORY; + DWORD i; IWMReaderCallback_AddRef((reader->callback = callback)); reader->context = context; @@ -470,7 +663,24 @@ static HRESULT async_reader_open(struct async_reader *reader, IWMReaderCallback reader->callback_advanced = NULL; } + if (FAILED(hr = IWMProfile3_GetStreamCount(reader->profile, &reader->stream_count))) + goto error; + + if (!(reader->streams = calloc(reader->stream_count, sizeof(*reader->streams)))) + { + hr = E_OUTOFMEMORY; + goto error; + } + reader->running = true; + + for (i = 0; i < reader->stream_count; ++i) + { + struct stream *stream = reader->streams + i; + if (FAILED(hr = stream_open(stream, reader, i + 1))) + goto error; + } + if (!(reader->callback_thread = CreateThread(NULL, 0, async_reader_callback_thread, reader, 0, NULL))) goto error; @@ -1923,6 +2133,10 @@ static HRESULT WINAPI async_reader_create(IWMReader **reader) (void **)&object->reader))) goto failed; IWMReader_Release(&object->IWMReader_iface); + if (FAILED(hr = IUnknown_QueryInterface(object->reader_inner, &IID_IWMProfile3, + (void **)&object->profile))) + goto failed; + IWMReader_Release(&object->IWMReader_iface); InitializeCriticalSection(&object->cs); object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.cs"); From da9399f2336d7c2288c0ad90e830a98c77edc28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Sep 2022 15:32:14 +0200 Subject: [PATCH 0156/1506] wmvcore: Implement DedicatedDeliveryThread async reader output setting. This restores the todo_wine in the allocator callback as we're now allocating samples in the delivering thread as well. We'll need to create new threads for allocation to match native behavior. CW-Bug-Id: #21147 --- dlls/wmvcore/async_reader.c | 114 ++++++++++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 6 deletions(-) diff --git a/dlls/wmvcore/async_reader.c b/dlls/wmvcore/async_reader.c index 6423fe7a2ea..76e749be690 100644 --- a/dlls/wmvcore/async_reader.c +++ b/dlls/wmvcore/async_reader.c @@ -77,6 +77,11 @@ struct stream CONDITION_VARIABLE read_cv; struct list read_samples; HRESULT read_result; + + bool dedicated_delivery_thread; + HANDLE deliver_thread; + struct list deliver_samples; + CONDITION_VARIABLE deliver_cv; }; struct async_reader @@ -322,6 +327,48 @@ static void stream_request_read(struct stream *stream) WakeConditionVariable(&stream->read_cv); } +static void stream_request_deliver(struct async_reader *reader, struct sample *sample) +{ + struct stream *stream = reader->streams + sample->output; + + list_remove(&sample->entry); + list_add_tail(&stream->deliver_samples, &sample->entry); + WakeConditionVariable(&stream->deliver_cv); +} + +static DWORD WINAPI stream_deliver_thread(void *arg) +{ + struct stream *stream = arg; + struct async_reader *reader = stream->reader; + struct list *entry; + + TRACE("reader %p, number %u\n", reader, stream->number); + + EnterCriticalSection(&reader->callback_cs); + + while (reader->running) + { + if (list_empty(&stream->deliver_samples)) + { + SleepConditionVariableCS(&stream->deliver_cv, &reader->callback_cs, INFINITE); + continue; + } + + while ((entry = list_head(&stream->deliver_samples))) + { + struct sample *sample = LIST_ENTRY(entry, struct sample, entry); + async_reader_deliver_sample(reader, sample); + } + + WakeConditionVariable(&reader->callback_cv); + } + + LeaveCriticalSection(&reader->callback_cs); + + TRACE("Reader is stopping; exiting.\n"); + return 0; +} + static DWORD WINAPI stream_read_thread(void *arg) { struct stream *stream = arg; @@ -392,6 +439,13 @@ static void stream_flush_samples(struct stream *stream) INSSBuffer_Release(sample->buffer); free(sample); } + + LIST_FOR_EACH_ENTRY_SAFE(sample, next, &stream->deliver_samples, struct sample, entry) + { + list_remove(&sample->entry); + INSSBuffer_Release(sample->buffer); + free(sample); + } } static void stream_close(struct stream *stream) @@ -404,6 +458,14 @@ static void stream_close(struct stream *stream) stream->read_thread = NULL; } + if (stream->deliver_thread) + { + WakeConditionVariable(&stream->deliver_cv); + WaitForSingleObject(stream->deliver_thread, INFINITE); + CloseHandle(stream->deliver_thread); + stream->deliver_thread = NULL; + } + stream_flush_samples(stream); } @@ -415,10 +477,17 @@ static HRESULT stream_open(struct stream *stream, struct async_reader *reader, W stream->number = number; stream->reader = reader; list_init(&stream->read_samples); + list_init(&stream->deliver_samples); if (!(stream->read_thread = CreateThread(NULL, 0, stream_read_thread, stream, 0, NULL))) return E_OUTOFMEMORY; + if (!(stream->deliver_thread = CreateThread(NULL, 0, stream_deliver_thread, stream, 0, NULL))) + { + stream_close(stream); + return E_OUTOFMEMORY; + } + return S_OK; } @@ -428,6 +497,7 @@ static HRESULT async_reader_get_next_sample(struct async_reader *reader, struct sample *sample, *first_sample = NULL; struct stream *stream, *first_stream = NULL; WMT_STREAM_SELECTION selection; + BOOL pending = FALSE; struct list *entry; DWORD i; @@ -435,6 +505,8 @@ static HRESULT async_reader_get_next_sample(struct async_reader *reader, { stream = reader->streams + i; + if (!list_empty(&stream->deliver_samples)) + pending = TRUE; if (FAILED(IWMSyncReader2_GetStreamSelected(reader->reader, i + 1, &selection)) || selection == WMT_OFF) continue; @@ -454,7 +526,7 @@ static HRESULT async_reader_get_next_sample(struct async_reader *reader, } if (!first_sample) - return NS_E_NO_MORE_SAMPLES; + return pending ? E_PENDING : NS_E_NO_MORE_SAMPLES; TRACE("Found first stream %u with pts %I64d.\n", first_stream->number, first_sample->pts); *out_sample = first_sample; @@ -474,8 +546,8 @@ static void async_reader_deliver_samples(struct async_reader *reader) while (reader->running && list_empty(&reader->async_ops)) { - struct sample *sample; struct stream *stream; + struct sample *sample; if (FAILED(hr = async_reader_get_next_sample(reader, &stream, &sample))) break; @@ -483,7 +555,12 @@ static void async_reader_deliver_samples(struct async_reader *reader) stream_request_read(stream); if (async_reader_wait_pts(reader, sample->pts)) - async_reader_deliver_sample(reader, sample); + { + if (!stream->dedicated_delivery_thread) + async_reader_deliver_sample(reader, sample); + else + stream_request_deliver(reader, sample); + } } if (hr == NS_E_NO_MORE_SAMPLES) @@ -1253,9 +1330,34 @@ static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *ifa static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num, const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length) { - struct async_reader *This = impl_from_IWMReaderAdvanced6(iface); - FIXME("(%p)->(%lu %s %#x %p %u)\n", This, output_num, debugstr_w(name), type, value, length); - return E_NOTIMPL; + struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface); + struct stream *stream; + HRESULT hr = E_NOTIMPL; + + FIXME("reader %p, output_num %lu, name %s, type %u, value %p, length %u semi-stub!\n", + reader, output_num, debugstr_w(name), type, value, length); + + EnterCriticalSection(&reader->cs); + + if (!reader->streams) + { + LeaveCriticalSection(&reader->cs); + return E_UNEXPECTED; + } + + stream = reader->streams + output_num; + + EnterCriticalSection(&reader->callback_cs); + if (!wcscmp(name, L"DedicatedDeliveryThread")) + { + stream->dedicated_delivery_thread = *(BOOL *)value; + hr = S_OK; + } + LeaveCriticalSection(&reader->callback_cs); + + LeaveCriticalSection(&reader->cs); + + return hr; } static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate) From 4a4a6151188410bc9d226e7e6d1568e2101363e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Sep 2022 21:04:06 +0200 Subject: [PATCH 0157/1506] qasf: Query the IWMReaderAdvanced2 reader interface. CW-Bug-Id: #21147 --- dlls/qasf/asfreader.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 4cf077e9dd3..adbbae671ef 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -438,13 +438,13 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) struct asf_reader *filter = impl_from_strmbase_filter(iface); WMT_STREAM_SELECTION selections[ARRAY_SIZE(filter->streams)]; WORD stream_numbers[ARRAY_SIZE(filter->streams)]; - IWMReaderAdvanced *reader_advanced; + IWMReaderAdvanced2 *reader_advanced; HRESULT hr = S_OK; int i; TRACE("iface %p\n", iface); - if (FAILED(hr = IWMReader_QueryInterface(filter->reader, &IID_IWMReaderAdvanced, (void **)&reader_advanced))) + if (FAILED(hr = IWMReader_QueryInterface(filter->reader, &IID_IWMReaderAdvanced2, (void **)&reader_advanced))) return hr; for (i = 0; i < filter->stream_count; ++i) @@ -464,7 +464,7 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) break; } - if (FAILED(hr = IWMReaderAdvanced_SetAllocateForOutput(reader_advanced, i, TRUE))) + if (FAILED(hr = IWMReaderAdvanced2_SetAllocateForOutput(reader_advanced, i, TRUE))) { WARN("Failed to enable allocation for stream %u, hr %#lx\n", i, hr); break; @@ -495,11 +495,11 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) selections[i] = WMT_ON; } - if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced_SetStreamsSelected(reader_advanced, + if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_SetStreamsSelected(reader_advanced, filter->stream_count, stream_numbers, selections))) WARN("Failed to set reader %p stream selection, hr %#lx\n", filter->reader, hr); - IWMReaderAdvanced_Release(reader_advanced); + IWMReaderAdvanced2_Release(reader_advanced); if (FAILED(hr)) return hr; From f6976b23e7dad93239faee90dfea386093467967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Aug 2022 15:44:15 +0200 Subject: [PATCH 0158/1506] qasf: Set the DedicatedDeliveryThread property according to ReceiveCanBlock. CW-Bug-Id: #21147 --- dlls/qasf/asfreader.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index adbbae671ef..5119af9ffa3 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -440,6 +440,7 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) WORD stream_numbers[ARRAY_SIZE(filter->streams)]; IWMReaderAdvanced2 *reader_advanced; HRESULT hr = S_OK; + BOOL value; int i; TRACE("iface %p\n", iface); @@ -492,6 +493,14 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) break; } + value = IMemInputPin_ReceiveCanBlock(stream->source.pMemInputPin) == S_OK; + if (FAILED(hr = IWMReaderAdvanced2_SetOutputSetting(reader_advanced, i, L"DedicatedDeliveryThread", + WMT_TYPE_BOOL, (BYTE *)&value, sizeof(value)))) + { + WARN("Failed to set DedicatedDeliveryThread for stream %u, hr %#lx\n", i, hr); + break; + } + selections[i] = WMT_ON; } From 377f1c9cd184cbf1ddf46da4a3aace085a72db8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Sep 2022 21:04:37 +0200 Subject: [PATCH 0159/1506] qasf: Set user provided clock and time to prevent waits in WMReader. CW-Bug-Id: #21147 --- dlls/qasf/asfreader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 5119af9ffa3..75e77b9f070 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -508,6 +508,12 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) filter->stream_count, stream_numbers, selections))) WARN("Failed to set reader %p stream selection, hr %#lx\n", filter->reader, hr); + if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_SetUserProvidedClock(reader_advanced, TRUE))) + WARN("Failed to set user provided clock, hr %#lx\n", hr); + + if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_DeliverTime(reader_advanced, -1))) + WARN("Failed to set user time, hr %#lx\n", hr); + IWMReaderAdvanced2_Release(reader_advanced); if (FAILED(hr)) From 36eac37abbf2977f741530a18ace1ec2cb377d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 2 Sep 2022 13:23:21 +0200 Subject: [PATCH 0160/1506] qasf: Increase the minimum number of buffers in asf_reader_DecideBufferSize. Required for Sang Froid. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20905 --- dlls/qasf/asfreader.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 75e77b9f070..f561e72b29e 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -604,7 +604,11 @@ static HRESULT WINAPI asf_reader_DecideBufferSize(struct strmbase_source *iface, buffer_size = format->nAvgBytesPerSec; } - req_props->cBuffers = max(req_props->cBuffers, 1); + if (IsEqualGUID(&stream->source.pin.mt.majortype, &MEDIATYPE_Audio)) + req_props->cBuffers = max(req_props->cBuffers, 50); + else + req_props->cBuffers = max(req_props->cBuffers, 10); + req_props->cbBuffer = max(req_props->cbBuffer, buffer_size); req_props->cbAlign = max(req_props->cbAlign, 1); return IMemAllocator_SetProperties(allocator, req_props, &ret_props); From 96114102e92f1dcc360dd6d93fe5047877457e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 27 May 2022 10:45:33 +0200 Subject: [PATCH 0161/1506] qasf: Implement ASF Reader SourceSeeking interface. CW-Bug-Id: #18799 CW-Bug-Id: #18994 CW-Bug-Id: #20182 CW-Bug-Id: #20905 --- dlls/qasf/asfreader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index f561e72b29e..625b26d439e 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -487,7 +487,7 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) break; } - if (FAILED(hr = IPin_NewSegment(stream->source.pin.peer, 0, 0, 1))) + if (FAILED(hr = IPin_NewSegment(stream->source.pin.peer, stream->seek.llCurrent, stream->seek.llStop, stream->seek.dRate))) { WARN("Failed to start stream %u new segment, hr %#lx\n", i, hr); break; From fb8a5ea7b5faab8996d67aec7fbfbf1c1662d427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 31 Aug 2022 12:50:21 +0200 Subject: [PATCH 0162/1506] HACK: qasf: Only force user provided time to -1 if no quartz clock is set. This satisfies both Sang Froid intro song which expects the audio stream to fast forward decode by not providing any sync source to the filter, and Space Engineers which expects the filter to respect the system clock timing when decoding its videos. This is likely a hack and there's probably something to do with wmvcore sync clock source to make it match quartz clock. CW-Bug-Id: #21139 --- dlls/qasf/asfreader.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 625b26d439e..a0f9ef0c2ff 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -508,11 +508,13 @@ static HRESULT asf_reader_init_stream(struct strmbase_filter *iface) filter->stream_count, stream_numbers, selections))) WARN("Failed to set reader %p stream selection, hr %#lx\n", filter->reader, hr); - if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_SetUserProvidedClock(reader_advanced, TRUE))) + if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_SetUserProvidedClock(reader_advanced, !filter->filter.clock))) WARN("Failed to set user provided clock, hr %#lx\n", hr); - - if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_DeliverTime(reader_advanced, -1))) - WARN("Failed to set user time, hr %#lx\n", hr); + else if (!filter->filter.clock) + { + if (SUCCEEDED(hr) && FAILED(hr = IWMReaderAdvanced2_DeliverTime(reader_advanced, -1))) + WARN("Failed to set user time, hr %#lx\n", hr); + } IWMReaderAdvanced2_Release(reader_advanced); From d960f37934540ad79bc27542b290f3c45c4e04f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Sep 2022 12:09:33 +0200 Subject: [PATCH 0163/1506] quartz: Rename This to filter in the DirectSound Renderer Filter. CW-Bug-Id: #21147 --- dlls/quartz/dsoundrender.c | 242 ++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 10eed43422e..f31c0a4f40a 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -88,17 +88,17 @@ static struct dsound_render *impl_from_IAMDirectSound(IAMDirectSound *iface) return CONTAINING_RECORD(iface, struct dsound_render, IAMDirectSound_iface); } -static REFERENCE_TIME time_from_pos(struct dsound_render *This, DWORD pos) +static REFERENCE_TIME time_from_pos(struct dsound_render *filter, DWORD pos) { - WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->sink.pin.mt.pbFormat; + WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; REFERENCE_TIME ret = 10000000; ret = ret * pos / wfx->nAvgBytesPerSec; return ret; } -static DWORD pos_from_time(struct dsound_render *This, REFERENCE_TIME time) +static DWORD pos_from_time(struct dsound_render *filter, REFERENCE_TIME time) { - WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->sink.pin.mt.pbFormat; + WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; REFERENCE_TIME ret = time; ret *= wfx->nAvgBytesPerSec; ret /= 10000000; @@ -106,56 +106,56 @@ static DWORD pos_from_time(struct dsound_render *This, REFERENCE_TIME time) return ret; } -static void DSoundRender_UpdatePositions(struct dsound_render *This, DWORD *seqwritepos, DWORD *minwritepos) +static void DSoundRender_UpdatePositions(struct dsound_render *filter, DWORD *seqwritepos, DWORD *minwritepos) { - WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->sink.pin.mt.pbFormat; + WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; BYTE *buf1, *buf2; DWORD size1, size2, playpos, writepos, old_writepos, old_playpos, adv; - BOOL writepos_set = This->writepos < This->buf_size; + BOOL writepos_set = filter->writepos < filter->buf_size; /* Update position and zero */ - old_writepos = This->writepos; - old_playpos = This->last_playpos; + old_writepos = filter->writepos; + old_playpos = filter->last_playpos; if (old_writepos <= old_playpos) - old_writepos += This->buf_size; + old_writepos += filter->buf_size; - IDirectSoundBuffer_GetCurrentPosition(This->dsbuffer, &playpos, &writepos); + IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, &playpos, &writepos); if (old_playpos > playpos) - adv = This->buf_size + playpos - old_playpos; + adv = filter->buf_size + playpos - old_playpos; else adv = playpos - old_playpos; - This->last_playpos = playpos; + filter->last_playpos = playpos; if (adv) { TRACE("Moving from %lu to %lu: clearing %lu bytes.\n", old_playpos, playpos, adv); - IDirectSoundBuffer_Lock(This->dsbuffer, old_playpos, adv, (void**)&buf1, &size1, (void**)&buf2, &size2, 0); + IDirectSoundBuffer_Lock(filter->dsbuffer, old_playpos, adv, (void**)&buf1, &size1, (void**)&buf2, &size2, 0); memset(buf1, wfx->wBitsPerSample == 8 ? 128 : 0, size1); memset(buf2, wfx->wBitsPerSample == 8 ? 128 : 0, size2); - IDirectSoundBuffer_Unlock(This->dsbuffer, buf1, size1, buf2, size2); + IDirectSoundBuffer_Unlock(filter->dsbuffer, buf1, size1, buf2, size2); } *minwritepos = writepos; if (!writepos_set || old_writepos < writepos) { if (writepos_set) { - This->writepos = This->buf_size; + filter->writepos = filter->buf_size; FIXME("Underrun of data occurred!\n"); } *seqwritepos = writepos; } else - *seqwritepos = This->writepos; + *seqwritepos = filter->writepos; } -static HRESULT DSoundRender_GetWritePos(struct dsound_render *This, +static HRESULT DSoundRender_GetWritePos(struct dsound_render *filter, DWORD *ret_writepos, REFERENCE_TIME write_at, DWORD *pfree, DWORD *skip) { DWORD writepos, min_writepos, playpos; REFERENCE_TIME max_lag = 50 * 10000; REFERENCE_TIME cur, writepos_t, delta_t; - DSoundRender_UpdatePositions(This, &writepos, &min_writepos); - playpos = This->last_playpos; - if (This->filter.clock) + DSoundRender_UpdatePositions(filter, &writepos, &min_writepos); + playpos = filter->last_playpos; + if (filter->filter.clock) { - IReferenceClock_GetTime(This->filter.clock, &cur); - cur -= This->stream_start; + IReferenceClock_GetTime(filter->filter.clock, &cur); + cur -= filter->stream_start; } else write_at = -1; @@ -169,9 +169,9 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *This, } if (writepos >= playpos) - writepos_t = cur + time_from_pos(This, writepos - playpos); + writepos_t = cur + time_from_pos(filter, writepos - playpos); else - writepos_t = cur + time_from_pos(This, This->buf_size + writepos - playpos); + writepos_t = cur + time_from_pos(filter, filter->buf_size + writepos - playpos); /* write_at: Starting time of sample */ /* cur: current time of play position */ @@ -184,75 +184,75 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *This, REFERENCE_TIME past, min_writepos_t; WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag)); if (min_writepos >= playpos) - min_writepos_t = cur + time_from_pos(This, min_writepos - playpos); + min_writepos_t = cur + time_from_pos(filter, min_writepos - playpos); else - min_writepos_t = cur + time_from_pos(This, This->buf_size - playpos + min_writepos); + min_writepos_t = cur + time_from_pos(filter, filter->buf_size - playpos + min_writepos); past = min_writepos_t - write_at; if (past >= 0) { - DWORD skipbytes = pos_from_time(This, past); + DWORD skipbytes = pos_from_time(filter, past); WARN("Skipping %lu bytes.\n", skipbytes); *skip = skipbytes; *ret_writepos = min_writepos; } else { - DWORD aheadbytes = pos_from_time(This, -past); + DWORD aheadbytes = pos_from_time(filter, -past); WARN("Advancing %lu bytes.\n", aheadbytes); - *ret_writepos = (min_writepos + aheadbytes) % This->buf_size; + *ret_writepos = (min_writepos + aheadbytes) % filter->buf_size; } } else /* delta_t > 0 */ { DWORD aheadbytes; WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag)); - aheadbytes = pos_from_time(This, delta_t); + aheadbytes = pos_from_time(filter, delta_t); WARN("Advancing %lu bytes.\n", aheadbytes); if (delta_t >= DSoundRenderer_Max_Fill) return S_FALSE; - *ret_writepos = (min_writepos + aheadbytes) % This->buf_size; + *ret_writepos = (min_writepos + aheadbytes) % filter->buf_size; } end: if (playpos >= *ret_writepos) *pfree = playpos - *ret_writepos; else - *pfree = This->buf_size + playpos - *ret_writepos; - if (time_from_pos(This, This->buf_size - *pfree) >= DSoundRenderer_Max_Fill) { - TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(This, This->buf_size - *pfree)), + *pfree = filter->buf_size + playpos - *ret_writepos; + if (time_from_pos(filter, filter->buf_size - *pfree) >= DSoundRenderer_Max_Fill) { + TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(filter, filter->buf_size - *pfree)), debugstr_time(DSoundRenderer_Max_Fill)); return S_FALSE; } return S_OK; } -static HRESULT DSoundRender_HandleEndOfStream(struct dsound_render *This) +static HRESULT DSoundRender_HandleEndOfStream(struct dsound_render *filter) { - while (This->filter.state == State_Running) + while (filter->filter.state == State_Running) { DWORD pos1, pos2; - DSoundRender_UpdatePositions(This, &pos1, &pos2); + DSoundRender_UpdatePositions(filter, &pos1, &pos2); if (pos1 == pos2) break; - WaitForSingleObject(This->flush_event, 10); + WaitForSingleObject(filter->flush_event, 10); } return S_OK; } -static HRESULT DSoundRender_SendSampleData(struct dsound_render *This, +static HRESULT DSoundRender_SendSampleData(struct dsound_render *filter, REFERENCE_TIME tStart, REFERENCE_TIME tStop, const BYTE *data, DWORD size) { HRESULT hr; - while (size && This->filter.state != State_Stopped) { + while (size && filter->filter.state != State_Stopped) { DWORD writepos, skip = 0, free, size1, size2, ret; BYTE *buf1, *buf2; - if (This->filter.state == State_Running) - hr = DSoundRender_GetWritePos(This, &writepos, tStart, &free, &skip); + if (filter->filter.state == State_Running) + hr = DSoundRender_GetWritePos(filter, &writepos, tStart, &free, &skip); else hr = S_FALSE; if (hr != S_OK) { - ret = WaitForSingleObject(This->flush_event, 10); - if (This->sink.flushing || This->filter.state == State_Stopped) - return This->filter.state == State_Paused ? S_OK : VFW_E_WRONG_STATE; + ret = WaitForSingleObject(filter->flush_event, 10); + if (filter->sink.flushing || filter->filter.state == State_Stopped) + return filter->filter.state == State_Paused ? S_OK : VFW_E_WRONG_STATE; if (ret != WAIT_TIMEOUT) ERR("WaitForSingleObject() returned %ld.\n", ret); continue; @@ -266,7 +266,7 @@ static HRESULT DSoundRender_SendSampleData(struct dsound_render *This, data += skip; size -= skip; - hr = IDirectSoundBuffer_Lock(This->dsbuffer, writepos, min(free, size), (void**)&buf1, &size1, (void**)&buf2, &size2, 0); + hr = IDirectSoundBuffer_Lock(filter->dsbuffer, writepos, min(free, size), (void**)&buf1, &size1, (void**)&buf2, &size2, 0); if (hr != DS_OK) { ERR("Failed to lock sound buffer, hr %#lx.\n", hr); break; @@ -274,23 +274,23 @@ static HRESULT DSoundRender_SendSampleData(struct dsound_render *This, memcpy(buf1, data, size1); if (size2) memcpy(buf2, data+size1, size2); - IDirectSoundBuffer_Unlock(This->dsbuffer, buf1, size1, buf2, size2); - This->writepos = (writepos + size1 + size2) % This->buf_size; - TRACE("Wrote %lu bytes at %lu, next at %lu - (%lu/%lu)\n", size1+size2, writepos, This->writepos, free, size); + IDirectSoundBuffer_Unlock(filter->dsbuffer, buf1, size1, buf2, size2); + filter->writepos = (writepos + size1 + size2) % filter->buf_size; + TRACE("Wrote %lu bytes at %lu, next at %lu - (%lu/%lu)\n", size1+size2, writepos, filter->writepos, free, size); data += size1 + size2; size -= size1 + size2; } return S_OK; } -static HRESULT DSoundRender_PrepareReceive(struct dsound_render *This, IMediaSample *pSample) +static HRESULT DSoundRender_PrepareReceive(struct dsound_render *filter, IMediaSample *pSample) { HRESULT hr; AM_MEDIA_TYPE *amt; if (IMediaSample_GetMediaType(pSample, &amt) == S_OK) { - AM_MEDIA_TYPE *orig = &This->sink.pin.mt; + AM_MEDIA_TYPE *orig = &filter->sink.pin.mt; WAVEFORMATEX *origfmt = (WAVEFORMATEX *)orig->pbFormat; WAVEFORMATEX *newfmt = (WAVEFORMATEX *)amt->pbFormat; @@ -305,7 +305,7 @@ static HRESULT DSoundRender_PrepareReceive(struct dsound_render *This, IMediaSam { if (origfmt->nSamplesPerSec != newfmt->nSamplesPerSec) { - hr = IDirectSoundBuffer_SetFrequency(This->dsbuffer, + hr = IDirectSoundBuffer_SetFrequency(filter->dsbuffer, newfmt->nSamplesPerSec); if (FAILED(hr)) return VFW_E_TYPE_NOT_ACCEPTED; @@ -320,7 +320,7 @@ static HRESULT DSoundRender_PrepareReceive(struct dsound_render *This, IMediaSam return S_OK; } -static HRESULT DSoundRender_DoRenderSample(struct dsound_render *This, IMediaSample *pSample) +static HRESULT DSoundRender_DoRenderSample(struct dsound_render *filter, IMediaSample *pSample) { LPBYTE pbSrcStream = NULL; LONG cbSrcStream = 0; @@ -347,7 +347,7 @@ static HRESULT DSoundRender_DoRenderSample(struct dsound_render *This, IMediaSam } cbSrcStream = IMediaSample_GetActualDataLength(pSample); - return DSoundRender_SendSampleData(This, tStart, tStop, pbSrcStream, cbSrcStream); + return DSoundRender_SendSampleData(filter, tStart, tStop, pbSrcStream, cbSrcStream); } static HRESULT WINAPI dsound_render_sink_Receive(struct strmbase_sink *iface, IMediaSample *sample) @@ -397,42 +397,42 @@ static HRESULT dsound_render_sink_query_accept(struct strmbase_pin *iface, const static HRESULT dsound_render_sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt) { - struct dsound_render *This = impl_from_strmbase_pin(&iface->pin); + struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin); const WAVEFORMATEX *format = (WAVEFORMATEX *)mt->pbFormat; HRESULT hr = S_OK; DSBUFFERDESC buf_desc; - This->buf_size = format->nAvgBytesPerSec; + filter->buf_size = format->nAvgBytesPerSec; memset(&buf_desc,0,sizeof(DSBUFFERDESC)); buf_desc.dwSize = sizeof(DSBUFFERDESC); buf_desc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY | DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2; - buf_desc.dwBufferBytes = This->buf_size; + buf_desc.dwBufferBytes = filter->buf_size; buf_desc.lpwfxFormat = (WAVEFORMATEX *)format; - hr = IDirectSound8_CreateSoundBuffer(This->dsound, &buf_desc, &This->dsbuffer, NULL); - This->writepos = This->buf_size; + hr = IDirectSound8_CreateSoundBuffer(filter->dsound, &buf_desc, &filter->dsbuffer, NULL); + filter->writepos = filter->buf_size; if (FAILED(hr)) ERR("Failed to create sound buffer, hr %#lx.\n", hr); if (SUCCEEDED(hr)) { - hr = IDirectSoundBuffer_SetVolume(This->dsbuffer, This->volume); + hr = IDirectSoundBuffer_SetVolume(filter->dsbuffer, filter->volume); if (FAILED(hr)) - ERR("Failed to set volume to %ld, hr %#lx.\n", This->volume, hr); + ERR("Failed to set volume to %ld, hr %#lx.\n", filter->volume, hr); - hr = IDirectSoundBuffer_SetPan(This->dsbuffer, This->pan); + hr = IDirectSoundBuffer_SetPan(filter->dsbuffer, filter->pan); if (FAILED(hr)) - ERR("Failed to set pan to %ld, hr %#lx.\n", This->pan, hr); + ERR("Failed to set pan to %ld, hr %#lx.\n", filter->pan, hr); hr = S_OK; } if (FAILED(hr) && hr != VFW_E_ALREADY_CONNECTED) { - if (This->dsbuffer) - IDirectSoundBuffer_Release(This->dsbuffer); - This->dsbuffer = NULL; + if (filter->dsbuffer) + IDirectSoundBuffer_Release(filter->dsbuffer); + filter->dsbuffer = NULL; } return hr; @@ -440,13 +440,13 @@ static HRESULT dsound_render_sink_connect(struct strmbase_sink *iface, IPin *pee static void dsound_render_sink_disconnect(struct strmbase_sink *iface) { - struct dsound_render *This = impl_from_strmbase_pin(&iface->pin); + struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin); TRACE("(%p)->()\n", iface); - if (This->dsbuffer) - IDirectSoundBuffer_Release(This->dsbuffer); - This->dsbuffer = NULL; + if (filter->dsbuffer) + IDirectSoundBuffer_Release(filter->dsbuffer); + filter->dsbuffer = NULL; } static HRESULT dsound_render_sink_eos(struct strmbase_sink *iface) @@ -668,27 +668,27 @@ static const struct strmbase_filter_ops filter_ops = static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface, REFIID riid, LPVOID*ppvObj) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj); + TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), ppvObj); - return IUnknown_QueryInterface(This->filter.outer_unk, riid, ppvObj); + return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppvObj); } static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->()\n", This, iface); + TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_AddRef(This->filter.outer_unk); + return IUnknown_AddRef(filter->filter.outer_unk); } static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->()\n", This, iface); + TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_Release(This->filter.outer_unk); + return IUnknown_Release(filter->filter.outer_unk); } HRESULT WINAPI basic_audio_GetTypeInfoCount(IBasicAudio *iface, UINT *count) @@ -741,63 +741,63 @@ static HRESULT WINAPI basic_audio_Invoke(IBasicAudio *iface, DISPID id, REFIID i static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface, LONG lVolume) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("filter %p, volume %ld.\n", This, lVolume); + TRACE("filter %p, volume %ld.\n", filter, lVolume); if (lVolume > DSBVOLUME_MAX || lVolume < DSBVOLUME_MIN) return E_INVALIDARG; - if (This->dsbuffer) { - if (FAILED(IDirectSoundBuffer_SetVolume(This->dsbuffer, lVolume))) + if (filter->dsbuffer) { + if (FAILED(IDirectSoundBuffer_SetVolume(filter->dsbuffer, lVolume))) return E_FAIL; } - This->volume = lVolume; + filter->volume = lVolume; return S_OK; } static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface, LONG *plVolume) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%p)\n", This, iface, plVolume); + TRACE("(%p/%p)->(%p)\n", filter, iface, plVolume); if (!plVolume) return E_POINTER; - *plVolume = This->volume; + *plVolume = filter->volume; return S_OK; } static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface, LONG lBalance) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("filter %p, balance %ld.\n", This, lBalance); + TRACE("filter %p, balance %ld.\n", filter, lBalance); if (lBalance < DSBPAN_LEFT || lBalance > DSBPAN_RIGHT) return E_INVALIDARG; - if (This->dsbuffer) { - if (FAILED(IDirectSoundBuffer_SetPan(This->dsbuffer, lBalance))) + if (filter->dsbuffer) { + if (FAILED(IDirectSoundBuffer_SetPan(filter->dsbuffer, lBalance))) return E_FAIL; } - This->pan = lBalance; + filter->pan = lBalance; return S_OK; } static HRESULT WINAPI Basicaudio_get_Balance(IBasicAudio *iface, LONG *plBalance) { - struct dsound_render *This = impl_from_IBasicAudio(iface); + struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%p)\n", This, iface, plBalance); + TRACE("(%p/%p)->(%p)\n", filter, iface, plBalance); if (!plBalance) return E_POINTER; - *plBalance = This->pan; + *plBalance = filter->pan; return S_OK; } @@ -821,100 +821,100 @@ static HRESULT WINAPI AMDirectSound_QueryInterface(IAMDirectSound *iface, REFIID riid, LPVOID*ppvObj) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj); + TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), ppvObj); - return IUnknown_QueryInterface(This->filter.outer_unk, riid, ppvObj); + return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppvObj); } static ULONG WINAPI AMDirectSound_AddRef(IAMDirectSound *iface) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - TRACE("(%p/%p)->()\n", This, iface); + TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_AddRef(This->filter.outer_unk); + return IUnknown_AddRef(filter->filter.outer_unk); } static ULONG WINAPI AMDirectSound_Release(IAMDirectSound *iface) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - TRACE("(%p/%p)->()\n", This, iface); + TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_Release(This->filter.outer_unk); + return IUnknown_Release(filter->filter.outer_unk); } /*** IAMDirectSound methods ***/ static HRESULT WINAPI AMDirectSound_GetDirectSoundInterface(IAMDirectSound *iface, IDirectSound **ds) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p): stub\n", This, iface, ds); + FIXME("(%p/%p)->(%p): stub\n", filter, iface, ds); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_GetPrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p): stub\n", This, iface, buf); + FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_GetSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p): stub\n", This, iface, buf); + FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_ReleaseDirectSoundInterface(IAMDirectSound *iface, IDirectSound *ds) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p): stub\n", This, iface, ds); + FIXME("(%p/%p)->(%p): stub\n", filter, iface, ds); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_ReleasePrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p): stub\n", This, iface, buf); + FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_ReleaseSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p): stub\n", This, iface, buf); + FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_SetFocusWindow(IAMDirectSound *iface, HWND hwnd, BOOL bgaudible) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p,%d): stub\n", This, iface, hwnd, bgaudible); + FIXME("(%p/%p)->(%p,%d): stub\n", filter, iface, hwnd, bgaudible); return E_NOTIMPL; } static HRESULT WINAPI AMDirectSound_GetFocusWindow(IAMDirectSound *iface, HWND *hwnd, BOOL *bgaudible) { - struct dsound_render *This = impl_from_IAMDirectSound(iface); + struct dsound_render *filter = impl_from_IAMDirectSound(iface); - FIXME("(%p/%p)->(%p,%p): stub\n", This, iface, hwnd, bgaudible); + FIXME("(%p/%p)->(%p,%p): stub\n", filter, iface, hwnd, bgaudible); return E_NOTIMPL; } From 2affc5e76c89c282fb2f931bbcbe495d130d120e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Sep 2022 12:16:57 +0200 Subject: [PATCH 0164/1506] quartz: Add missing static qualifier to DirectSound Renderer Filter methods. CW-Bug-Id: #21147 --- dlls/quartz/dsoundrender.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index f31c0a4f40a..9f69ab0931c 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -691,21 +691,21 @@ static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) { return IUnknown_Release(filter->filter.outer_unk); } -HRESULT WINAPI basic_audio_GetTypeInfoCount(IBasicAudio *iface, UINT *count) +static HRESULT WINAPI basic_audio_GetTypeInfoCount(IBasicAudio *iface, UINT *count) { TRACE("iface %p, count %p.\n", iface, count); *count = 1; return S_OK; } -HRESULT WINAPI basic_audio_GetTypeInfo(IBasicAudio *iface, UINT index, +static HRESULT WINAPI basic_audio_GetTypeInfo(IBasicAudio *iface, UINT index, LCID lcid, ITypeInfo **typeinfo) { TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo); return strmbase_get_typeinfo(IBasicAudio_tid, typeinfo); } -HRESULT WINAPI basic_audio_GetIDsOfNames(IBasicAudio *iface, REFIID iid, +static HRESULT WINAPI basic_audio_GetIDsOfNames(IBasicAudio *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids) { ITypeInfo *typeinfo; From 5f3a26b1cb7228b47cdaa552a5f17d98bfd65e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Sep 2022 12:19:38 +0200 Subject: [PATCH 0165/1506] quartz: Fix brace wrapping in DirectSound Renderer Filter. CW-Bug-Id: #21147 --- dlls/quartz/dsoundrender.c | 90 ++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 9f69ab0931c..2bf112c1aa9 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -125,7 +125,8 @@ static void DSoundRender_UpdatePositions(struct dsound_render *filter, DWORD *se else adv = playpos - old_playpos; filter->last_playpos = playpos; - if (adv) { + if (adv) + { TRACE("Moving from %lu to %lu: clearing %lu bytes.\n", old_playpos, playpos, adv); IDirectSoundBuffer_Lock(filter->dsbuffer, old_playpos, adv, (void**)&buf1, &size1, (void**)&buf2, &size2, 0); memset(buf1, wfx->wBitsPerSample == 8 ? 128 : 0, size1); @@ -133,13 +134,16 @@ static void DSoundRender_UpdatePositions(struct dsound_render *filter, DWORD *se IDirectSoundBuffer_Unlock(filter->dsbuffer, buf1, size1, buf2, size2); } *minwritepos = writepos; - if (!writepos_set || old_writepos < writepos) { - if (writepos_set) { + if (!writepos_set || old_writepos < writepos) + { + if (writepos_set) + { filter->writepos = filter->buf_size; FIXME("Underrun of data occurred!\n"); } *seqwritepos = writepos; - } else + } + else *seqwritepos = filter->writepos; } @@ -156,14 +160,16 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *filter, { IReferenceClock_GetTime(filter->filter.clock, &cur); cur -= filter->stream_start; - } else + } + else write_at = -1; if (writepos == min_writepos) max_lag = 0; *skip = 0; - if (write_at < 0) { + if (write_at < 0) + { *ret_writepos = writepos; goto end; } @@ -177,10 +183,13 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *filter, /* cur: current time of play position */ /* writepos_t: current time of our pointer play position */ delta_t = write_at - writepos_t; - if (delta_t >= -max_lag && delta_t <= max_lag) { + if (delta_t >= -max_lag && delta_t <= max_lag) + { TRACE("Continuing from old position\n"); *ret_writepos = writepos; - } else if (delta_t < 0) { + } + else if (delta_t < 0) + { REFERENCE_TIME past, min_writepos_t; WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag)); if (min_writepos >= playpos) @@ -188,17 +197,22 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *filter, else min_writepos_t = cur + time_from_pos(filter, filter->buf_size - playpos + min_writepos); past = min_writepos_t - write_at; - if (past >= 0) { + if (past >= 0) + { DWORD skipbytes = pos_from_time(filter, past); WARN("Skipping %lu bytes.\n", skipbytes); *skip = skipbytes; *ret_writepos = min_writepos; - } else { + } + else + { DWORD aheadbytes = pos_from_time(filter, -past); WARN("Advancing %lu bytes.\n", aheadbytes); *ret_writepos = (min_writepos + aheadbytes) % filter->buf_size; } - } else /* delta_t > 0 */ { + } + else /* delta_t > 0 */ + { DWORD aheadbytes; WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag)); aheadbytes = pos_from_time(filter, delta_t); @@ -212,7 +226,8 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *filter, *pfree = playpos - *ret_writepos; else *pfree = filter->buf_size + playpos - *ret_writepos; - if (time_from_pos(filter, filter->buf_size - *pfree) >= DSoundRenderer_Max_Fill) { + if (time_from_pos(filter, filter->buf_size - *pfree) >= DSoundRenderer_Max_Fill) + { TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(filter, filter->buf_size - *pfree)), debugstr_time(DSoundRenderer_Max_Fill)); return S_FALSE; @@ -240,7 +255,8 @@ static HRESULT DSoundRender_SendSampleData(struct dsound_render *filter, { HRESULT hr; - while (size && filter->filter.state != State_Stopped) { + while (size && filter->filter.state != State_Stopped) + { DWORD writepos, skip = 0, free, size1, size2, ret; BYTE *buf1, *buf2; @@ -249,7 +265,8 @@ static HRESULT DSoundRender_SendSampleData(struct dsound_render *filter, else hr = S_FALSE; - if (hr != S_OK) { + if (hr != S_OK) + { ret = WaitForSingleObject(filter->flush_event, 10); if (filter->sink.flushing || filter->filter.state == State_Stopped) return filter->filter.state == State_Paused ? S_OK : VFW_E_WRONG_STATE; @@ -267,7 +284,8 @@ static HRESULT DSoundRender_SendSampleData(struct dsound_render *filter, size -= skip; hr = IDirectSoundBuffer_Lock(filter->dsbuffer, writepos, min(free, size), (void**)&buf1, &size1, (void**)&buf2, &size2, 0); - if (hr != DS_OK) { + if (hr != DS_OK) + { ERR("Failed to lock sound buffer, hr %#lx.\n", hr); break; } @@ -335,7 +353,8 @@ static HRESULT DSoundRender_DoRenderSample(struct dsound_render *filter, IMediaS } hr = IMediaSample_GetTime(pSample, &tStart, &tStop); - if (FAILED(hr)) { + if (FAILED(hr)) + { ERR("Failed to get sample time, hr %#lx.\n", hr); tStart = tStop = -1; } @@ -665,9 +684,8 @@ static const struct strmbase_filter_ops filter_ops = }; /*** IUnknown methods ***/ -static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface, - REFIID riid, - LPVOID*ppvObj) { +static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface, REFIID riid, LPVOID*ppvObj) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), ppvObj); @@ -675,7 +693,8 @@ static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface, return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppvObj); } -static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) { +static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("(%p/%p)->()\n", filter, iface); @@ -683,7 +702,8 @@ static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) { return IUnknown_AddRef(filter->filter.outer_unk); } -static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) { +static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("(%p/%p)->()\n", filter, iface); @@ -739,8 +759,8 @@ static HRESULT WINAPI basic_audio_Invoke(IBasicAudio *iface, DISPID id, REFIID i return hr; } -static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface, - LONG lVolume) { +static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface, LONG lVolume) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("filter %p, volume %ld.\n", filter, lVolume); @@ -748,17 +768,15 @@ static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface, if (lVolume > DSBVOLUME_MAX || lVolume < DSBVOLUME_MIN) return E_INVALIDARG; - if (filter->dsbuffer) { - if (FAILED(IDirectSoundBuffer_SetVolume(filter->dsbuffer, lVolume))) - return E_FAIL; - } + if (filter->dsbuffer && FAILED(IDirectSoundBuffer_SetVolume(filter->dsbuffer, lVolume))) + return E_FAIL; filter->volume = lVolume; return S_OK; } -static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface, - LONG *plVolume) { +static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface, LONG *plVolume) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("(%p/%p)->(%p)\n", filter, iface, plVolume); @@ -770,8 +788,8 @@ static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface, return S_OK; } -static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface, - LONG lBalance) { +static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface, LONG lBalance) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("filter %p, balance %ld.\n", filter, lBalance); @@ -779,17 +797,15 @@ static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface, if (lBalance < DSBPAN_LEFT || lBalance > DSBPAN_RIGHT) return E_INVALIDARG; - if (filter->dsbuffer) { - if (FAILED(IDirectSoundBuffer_SetPan(filter->dsbuffer, lBalance))) - return E_FAIL; - } + if (filter->dsbuffer && FAILED(IDirectSoundBuffer_SetPan(filter->dsbuffer, lBalance))) + return E_FAIL; filter->pan = lBalance; return S_OK; } -static HRESULT WINAPI Basicaudio_get_Balance(IBasicAudio *iface, - LONG *plBalance) { +static HRESULT WINAPI Basicaudio_get_Balance(IBasicAudio *iface, LONG *plBalance) +{ struct dsound_render *filter = impl_from_IBasicAudio(iface); TRACE("(%p/%p)->(%p)\n", filter, iface, plBalance); From 2dd6cc1c66b2360efcb3c5e28db30f798dbddb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Sep 2022 12:20:19 +0200 Subject: [PATCH 0166/1506] quartz: Rename DirectSound Renderer Filter methods to be more consistent. CW-Bug-Id: #21147 --- dlls/quartz/dsoundrender.c | 145 ++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 75 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 2bf112c1aa9..b1172ed78cd 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -683,17 +683,16 @@ static const struct strmbase_filter_ops filter_ops = .filter_wait_state = dsound_render_wait_state, }; -/*** IUnknown methods ***/ -static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface, REFIID riid, LPVOID*ppvObj) +static HRESULT WINAPI basic_audio_QueryInterface(IBasicAudio *iface, REFIID riid, void **out) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), ppvObj); + TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), out); - return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppvObj); + return IUnknown_QueryInterface(filter->filter.outer_unk, riid, out); } -static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) +static ULONG WINAPI basic_audio_AddRef(IBasicAudio *iface) { struct dsound_render *filter = impl_from_IBasicAudio(iface); @@ -702,7 +701,7 @@ static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) return IUnknown_AddRef(filter->filter.outer_unk); } -static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) +static ULONG WINAPI basic_audio_Release(IBasicAudio *iface) { struct dsound_render *filter = impl_from_IBasicAudio(iface); @@ -759,92 +758,89 @@ static HRESULT WINAPI basic_audio_Invoke(IBasicAudio *iface, DISPID id, REFIID i return hr; } -static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface, LONG lVolume) +static HRESULT WINAPI basic_audio_put_Volume(IBasicAudio *iface, LONG volume) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("filter %p, volume %ld.\n", filter, lVolume); + TRACE("filter %p, volume %ld.\n", filter, volume); - if (lVolume > DSBVOLUME_MAX || lVolume < DSBVOLUME_MIN) + if (volume > DSBVOLUME_MAX || volume < DSBVOLUME_MIN) return E_INVALIDARG; - if (filter->dsbuffer && FAILED(IDirectSoundBuffer_SetVolume(filter->dsbuffer, lVolume))) + if (filter->dsbuffer && FAILED(IDirectSoundBuffer_SetVolume(filter->dsbuffer, volume))) return E_FAIL; - filter->volume = lVolume; + filter->volume = volume; return S_OK; } -static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface, LONG *plVolume) +static HRESULT WINAPI basic_audio_get_Volume(IBasicAudio *iface, LONG *volume) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%p)\n", filter, iface, plVolume); + TRACE("(%p/%p)->(%p)\n", filter, iface, volume); - if (!plVolume) + if (!volume) return E_POINTER; - *plVolume = filter->volume; + *volume = filter->volume; return S_OK; } -static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface, LONG lBalance) +static HRESULT WINAPI basic_audio_put_Balance(IBasicAudio *iface, LONG balance) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("filter %p, balance %ld.\n", filter, lBalance); + TRACE("filter %p, balance %ld.\n", filter, balance); - if (lBalance < DSBPAN_LEFT || lBalance > DSBPAN_RIGHT) + if (balance < DSBPAN_LEFT || balance > DSBPAN_RIGHT) return E_INVALIDARG; - if (filter->dsbuffer && FAILED(IDirectSoundBuffer_SetPan(filter->dsbuffer, lBalance))) + if (filter->dsbuffer && FAILED(IDirectSoundBuffer_SetPan(filter->dsbuffer, balance))) return E_FAIL; - filter->pan = lBalance; + filter->pan = balance; return S_OK; } -static HRESULT WINAPI Basicaudio_get_Balance(IBasicAudio *iface, LONG *plBalance) +static HRESULT WINAPI basic_audio_get_Balance(IBasicAudio *iface, LONG *balance) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%p)\n", filter, iface, plBalance); + TRACE("(%p/%p)->(%p)\n", filter, iface, balance); - if (!plBalance) + if (!balance) return E_POINTER; - *plBalance = filter->pan; + *balance = filter->pan; return S_OK; } -static const IBasicAudioVtbl IBasicAudio_Vtbl = +static const IBasicAudioVtbl basic_audio_vtbl = { - Basicaudio_QueryInterface, - Basicaudio_AddRef, - Basicaudio_Release, + basic_audio_QueryInterface, + basic_audio_AddRef, + basic_audio_Release, basic_audio_GetTypeInfoCount, basic_audio_GetTypeInfo, basic_audio_GetIDsOfNames, basic_audio_Invoke, - Basicaudio_put_Volume, - Basicaudio_get_Volume, - Basicaudio_put_Balance, - Basicaudio_get_Balance + basic_audio_put_Volume, + basic_audio_get_Volume, + basic_audio_put_Balance, + basic_audio_get_Balance, }; -/*** IUnknown methods ***/ -static HRESULT WINAPI AMDirectSound_QueryInterface(IAMDirectSound *iface, - REFIID riid, - LPVOID*ppvObj) +static HRESULT WINAPI am_direct_sound_QueryInterface(IAMDirectSound *iface, REFIID riid, void **out) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), ppvObj); + TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), out); - return IUnknown_QueryInterface(filter->filter.outer_unk, riid, ppvObj); + return IUnknown_QueryInterface(filter->filter.outer_unk, riid, out); } -static ULONG WINAPI AMDirectSound_AddRef(IAMDirectSound *iface) +static ULONG WINAPI am_direct_sound_AddRef(IAMDirectSound *iface) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -853,7 +849,7 @@ static ULONG WINAPI AMDirectSound_AddRef(IAMDirectSound *iface) return IUnknown_AddRef(filter->filter.outer_unk); } -static ULONG WINAPI AMDirectSound_Release(IAMDirectSound *iface) +static ULONG WINAPI am_direct_sound_Release(IAMDirectSound *iface) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -862,8 +858,7 @@ static ULONG WINAPI AMDirectSound_Release(IAMDirectSound *iface) return IUnknown_Release(filter->filter.outer_unk); } -/*** IAMDirectSound methods ***/ -static HRESULT WINAPI AMDirectSound_GetDirectSoundInterface(IAMDirectSound *iface, IDirectSound **ds) +static HRESULT WINAPI am_direct_sound_GetDirectSoundInterface(IAMDirectSound *iface, IDirectSound **ds) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -872,7 +867,7 @@ static HRESULT WINAPI AMDirectSound_GetDirectSoundInterface(IAMDirectSound *ifac return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_GetPrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) +static HRESULT WINAPI am_direct_sound_GetPrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -881,7 +876,7 @@ static HRESULT WINAPI AMDirectSound_GetPrimaryBufferInterface(IAMDirectSound *if return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_GetSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) +static HRESULT WINAPI am_direct_sound_GetSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -890,7 +885,7 @@ static HRESULT WINAPI AMDirectSound_GetSecondaryBufferInterface(IAMDirectSound * return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_ReleaseDirectSoundInterface(IAMDirectSound *iface, IDirectSound *ds) +static HRESULT WINAPI am_direct_sound_ReleaseDirectSoundInterface(IAMDirectSound *iface, IDirectSound *ds) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -899,7 +894,7 @@ static HRESULT WINAPI AMDirectSound_ReleaseDirectSoundInterface(IAMDirectSound * return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_ReleasePrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) +static HRESULT WINAPI am_direct_sound_ReleasePrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -908,7 +903,7 @@ static HRESULT WINAPI AMDirectSound_ReleasePrimaryBufferInterface(IAMDirectSound return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_ReleaseSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) +static HRESULT WINAPI am_direct_sound_ReleaseSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -917,7 +912,7 @@ static HRESULT WINAPI AMDirectSound_ReleaseSecondaryBufferInterface(IAMDirectSou return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_SetFocusWindow(IAMDirectSound *iface, HWND hwnd, BOOL bgaudible) +static HRESULT WINAPI am_direct_sound_SetFocusWindow(IAMDirectSound *iface, HWND hwnd, BOOL bgaudible) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -926,7 +921,7 @@ static HRESULT WINAPI AMDirectSound_SetFocusWindow(IAMDirectSound *iface, HWND h return E_NOTIMPL; } -static HRESULT WINAPI AMDirectSound_GetFocusWindow(IAMDirectSound *iface, HWND *hwnd, BOOL *bgaudible) +static HRESULT WINAPI am_direct_sound_GetFocusWindow(IAMDirectSound *iface, HWND *hwnd, BOOL *bgaudible) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); @@ -935,19 +930,19 @@ static HRESULT WINAPI AMDirectSound_GetFocusWindow(IAMDirectSound *iface, HWND * return E_NOTIMPL; } -static const IAMDirectSoundVtbl IAMDirectSound_Vtbl = +static const IAMDirectSoundVtbl am_direct_sound_vtbl = { - AMDirectSound_QueryInterface, - AMDirectSound_AddRef, - AMDirectSound_Release, - AMDirectSound_GetDirectSoundInterface, - AMDirectSound_GetPrimaryBufferInterface, - AMDirectSound_GetSecondaryBufferInterface, - AMDirectSound_ReleaseDirectSoundInterface, - AMDirectSound_ReleasePrimaryBufferInterface, - AMDirectSound_ReleaseSecondaryBufferInterface, - AMDirectSound_SetFocusWindow, - AMDirectSound_GetFocusWindow + am_direct_sound_QueryInterface, + am_direct_sound_AddRef, + am_direct_sound_Release, + am_direct_sound_GetDirectSoundInterface, + am_direct_sound_GetPrimaryBufferInterface, + am_direct_sound_GetSecondaryBufferInterface, + am_direct_sound_ReleaseDirectSoundInterface, + am_direct_sound_ReleasePrimaryBufferInterface, + am_direct_sound_ReleaseSecondaryBufferInterface, + am_direct_sound_SetFocusWindow, + am_direct_sound_GetFocusWindow, }; static struct dsound_render *impl_from_IQualityControl(IQualityControl *iface) @@ -955,26 +950,26 @@ static struct dsound_render *impl_from_IQualityControl(IQualityControl *iface) return CONTAINING_RECORD(iface, struct dsound_render, IQualityControl_iface); } -static HRESULT WINAPI dsound_render_qc_QueryInterface(IQualityControl *iface, +static HRESULT WINAPI quality_control_QueryInterface(IQualityControl *iface, REFIID iid, void **out) { struct dsound_render *filter = impl_from_IQualityControl(iface); return IUnknown_QueryInterface(filter->filter.outer_unk, iid, out); } -static ULONG WINAPI dsound_render_qc_AddRef(IQualityControl *iface) +static ULONG WINAPI quality_control_AddRef(IQualityControl *iface) { struct dsound_render *filter = impl_from_IQualityControl(iface); return IUnknown_AddRef(filter->filter.outer_unk); } -static ULONG WINAPI dsound_render_qc_Release(IQualityControl *iface) +static ULONG WINAPI quality_control_Release(IQualityControl *iface) { struct dsound_render *filter = impl_from_IQualityControl(iface); return IUnknown_Release(filter->filter.outer_unk); } -static HRESULT WINAPI dsound_render_qc_Notify(IQualityControl *iface, +static HRESULT WINAPI quality_control_Notify(IQualityControl *iface, IBaseFilter *sender, Quality q) { struct dsound_render *filter = impl_from_IQualityControl(iface); @@ -985,7 +980,7 @@ static HRESULT WINAPI dsound_render_qc_Notify(IQualityControl *iface, return E_NOTIMPL; } -static HRESULT WINAPI dsound_render_qc_SetSink(IQualityControl *iface, IQualityControl *sink) +static HRESULT WINAPI quality_control_SetSink(IQualityControl *iface, IQualityControl *sink) { struct dsound_render *filter = impl_from_IQualityControl(iface); @@ -994,13 +989,13 @@ static HRESULT WINAPI dsound_render_qc_SetSink(IQualityControl *iface, IQualityC return E_NOTIMPL; } -static const IQualityControlVtbl dsound_render_qc_vtbl = +static const IQualityControlVtbl quality_control_vtbl = { - dsound_render_qc_QueryInterface, - dsound_render_qc_AddRef, - dsound_render_qc_Release, - dsound_render_qc_Notify, - dsound_render_qc_SetSink, + quality_control_QueryInterface, + quality_control_AddRef, + quality_control_Release, + quality_control_Notify, + quality_control_SetSink, }; HRESULT dsound_render_create(IUnknown *outer, IUnknown **out) @@ -1059,9 +1054,9 @@ HRESULT dsound_render_create(IUnknown *outer, IUnknown **out) object->state_event = CreateEventW(NULL, TRUE, TRUE, NULL); object->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL); - object->IBasicAudio_iface.lpVtbl = &IBasicAudio_Vtbl; - object->IAMDirectSound_iface.lpVtbl = &IAMDirectSound_Vtbl; - object->IQualityControl_iface.lpVtbl = &dsound_render_qc_vtbl; + object->IBasicAudio_iface.lpVtbl = &basic_audio_vtbl; + object->IAMDirectSound_iface.lpVtbl = &am_direct_sound_vtbl; + object->IQualityControl_iface.lpVtbl = &quality_control_vtbl; TRACE("Created DirectSound renderer %p.\n", object); *out = &object->filter.IUnknown_inner; From 42ffef5d3ad1a7892766afb7282f6937e49318d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Sep 2022 12:14:53 +0200 Subject: [PATCH 0167/1506] quartz: Make DirectSound Renderer Filter traces more consistent. CW-Bug-Id: #21147 --- dlls/quartz/dsoundrender.c | 88 ++++++++++++++------------------------ 1 file changed, 32 insertions(+), 56 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index b1172ed78cd..1fbea17b200 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -375,6 +375,8 @@ static HRESULT WINAPI dsound_render_sink_Receive(struct strmbase_sink *iface, IM REFERENCE_TIME start, stop; HRESULT hr; + TRACE("filter %p, sample %p.\n", filter, sample); + if (filter->eos || filter->sink.flushing) return S_FALSE; @@ -461,7 +463,7 @@ static void dsound_render_sink_disconnect(struct strmbase_sink *iface) { struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin); - TRACE("(%p)->()\n", iface); + TRACE("filter %p\n", filter); if (filter->dsbuffer) IDirectSoundBuffer_Release(filter->dsbuffer); @@ -686,58 +688,58 @@ static const struct strmbase_filter_ops filter_ops = static HRESULT WINAPI basic_audio_QueryInterface(IBasicAudio *iface, REFIID riid, void **out) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - - TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), out); - return IUnknown_QueryInterface(filter->filter.outer_unk, riid, out); } static ULONG WINAPI basic_audio_AddRef(IBasicAudio *iface) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - - TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_AddRef(filter->filter.outer_unk); } static ULONG WINAPI basic_audio_Release(IBasicAudio *iface) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - - TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_Release(filter->filter.outer_unk); } static HRESULT WINAPI basic_audio_GetTypeInfoCount(IBasicAudio *iface, UINT *count) { - TRACE("iface %p, count %p.\n", iface, count); + struct dsound_render *filter = impl_from_IBasicAudio(iface); + + TRACE("filter %p, count %p.\n", filter, count); + *count = 1; + return S_OK; } static HRESULT WINAPI basic_audio_GetTypeInfo(IBasicAudio *iface, UINT index, LCID lcid, ITypeInfo **typeinfo) { - TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo); + struct dsound_render *filter = impl_from_IBasicAudio(iface); + + TRACE("filter %p, index %u, lcid %lu, typeinfo %p.\n", filter, index, lcid, typeinfo); + return strmbase_get_typeinfo(IBasicAudio_tid, typeinfo); } static HRESULT WINAPI basic_audio_GetIDsOfNames(IBasicAudio *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids) { + struct dsound_render *filter = impl_from_IBasicAudio(iface); ITypeInfo *typeinfo; HRESULT hr; - TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n", - iface, debugstr_guid(iid), names, count, lcid, ids); + TRACE("filter %p, iid %s, names %p, count %u, lcid %lu, ids %p.\n", + filter, debugstr_guid(iid), names, count, lcid, ids); if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicAudio_tid, &typeinfo))) { hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids); ITypeInfo_Release(typeinfo); } + return hr; } @@ -747,14 +749,15 @@ static HRESULT WINAPI basic_audio_Invoke(IBasicAudio *iface, DISPID id, REFIID i ITypeInfo *typeinfo; HRESULT hr; - TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n", - iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg); + TRACE("filter %p, id %ld, iid %s, lcid %lu, flags %u, params %p, result %p, excepinfo %p, error_arg %p.\n", + iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg); if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicAudio_tid, &typeinfo))) { hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg); ITypeInfo_Release(typeinfo); } + return hr; } @@ -778,7 +781,7 @@ static HRESULT WINAPI basic_audio_get_Volume(IBasicAudio *iface, LONG *volume) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%p)\n", filter, iface, volume); + TRACE("filter %p, volume %p.\n", filter, volume); if (!volume) return E_POINTER; @@ -807,7 +810,7 @@ static HRESULT WINAPI basic_audio_get_Balance(IBasicAudio *iface, LONG *balance) { struct dsound_render *filter = impl_from_IBasicAudio(iface); - TRACE("(%p/%p)->(%p)\n", filter, iface, balance); + TRACE("filter %p, balance %p.\n", filter, balance); if (!balance) return E_POINTER; @@ -834,99 +837,74 @@ static const IBasicAudioVtbl basic_audio_vtbl = static HRESULT WINAPI am_direct_sound_QueryInterface(IAMDirectSound *iface, REFIID riid, void **out) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - TRACE("(%p/%p)->(%s, %p)\n", filter, iface, debugstr_guid(riid), out); - return IUnknown_QueryInterface(filter->filter.outer_unk, riid, out); } static ULONG WINAPI am_direct_sound_AddRef(IAMDirectSound *iface) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_AddRef(filter->filter.outer_unk); } static ULONG WINAPI am_direct_sound_Release(IAMDirectSound *iface) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - TRACE("(%p/%p)->()\n", filter, iface); - return IUnknown_Release(filter->filter.outer_unk); } static HRESULT WINAPI am_direct_sound_GetDirectSoundInterface(IAMDirectSound *iface, IDirectSound **ds) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p): stub\n", filter, iface, ds); - + FIXME("filter %p, ds %p stub!\n", filter, ds); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_GetPrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); - + FIXME("filter %p, buf %p stub!\n", filter, buf); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_GetSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); - + FIXME("filter %p, buf %p stub!\n", filter, buf); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_ReleaseDirectSoundInterface(IAMDirectSound *iface, IDirectSound *ds) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p): stub\n", filter, iface, ds); - + FIXME("filter %p, ds %p stub!\n", filter, ds); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_ReleasePrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); - + FIXME("filter %p, buf %p stub!\n", filter, buf); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_ReleaseSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p): stub\n", filter, iface, buf); - + FIXME("filter %p, buf %p stub!\n", filter, buf); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_SetFocusWindow(IAMDirectSound *iface, HWND hwnd, BOOL bgaudible) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p,%d): stub\n", filter, iface, hwnd, bgaudible); - + FIXME("filter %p, hwnd %p, bgaudible %d stub!\n", filter, hwnd, bgaudible); return E_NOTIMPL; } static HRESULT WINAPI am_direct_sound_GetFocusWindow(IAMDirectSound *iface, HWND *hwnd, BOOL *bgaudible) { struct dsound_render *filter = impl_from_IAMDirectSound(iface); - - FIXME("(%p/%p)->(%p,%p): stub\n", filter, iface, hwnd, bgaudible); - + FIXME("filter %p, hwnd %p, bgaudible %p stub!\n", filter, hwnd, bgaudible); return E_NOTIMPL; } @@ -973,19 +951,15 @@ static HRESULT WINAPI quality_control_Notify(IQualityControl *iface, IBaseFilter *sender, Quality q) { struct dsound_render *filter = impl_from_IQualityControl(iface); - FIXME("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s, stub!\n", filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp)); - return E_NOTIMPL; } static HRESULT WINAPI quality_control_SetSink(IQualityControl *iface, IQualityControl *sink) { struct dsound_render *filter = impl_from_IQualityControl(iface); - - FIXME("filter %p, sink %p, stub!\n", filter, sink); - + FIXME("filter %p, sink %p stub!\n", filter, sink); return E_NOTIMPL; } @@ -1009,6 +983,8 @@ HRESULT dsound_render_create(IUnknown *outer, IUnknown **out) IDirectSoundBuffer *buffer; HRESULT hr; + TRACE("outer %p, out %p.\n", outer, out); + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; From 16c5cec263346c5877f19a67c4bb9d6463ca9ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Sep 2022 12:23:09 +0200 Subject: [PATCH 0168/1506] quartz: Simplify DirectSound Renderer Filter sample handling. Writing buffers sequentially instead of trying figuring the write position from the pts throught convoluted logic. CW-Bug-Id: #21147 --- dlls/quartz/dsoundrender.c | 408 +++++++++++++++---------------------- 1 file changed, 168 insertions(+), 240 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 1fbea17b200..e45bf669ff6 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -27,6 +27,7 @@ #include "dshow.h" #include "evcode.h" #include "strmif.h" +#include "initguid.h" #include "dsound.h" #include "amaudio.h" @@ -34,11 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz); -/* NOTE: buffer can still be filled completely, - * but we start waiting until only this amount is buffered - */ -static const REFERENCE_TIME DSoundRenderer_Max_Fill = 150 * 10000; - struct dsound_render { struct strmbase_filter filter; @@ -56,13 +52,15 @@ struct dsound_render /* Signaled when a flush or state change occurs, i.e. anything that needs * to immediately unblock the streaming thread. */ HANDLE flush_event; + HANDLE empty_event; REFERENCE_TIME stream_start; BOOL eos; IDirectSound8 *dsound; - LPDIRECTSOUNDBUFFER dsbuffer; - DWORD buf_size; - DWORD last_playpos, writepos; + IDirectSoundBuffer *dsbuffer; + + DWORD buffer_size; + DWORD write_pos; LONG volume; LONG pan; @@ -88,225 +86,115 @@ static struct dsound_render *impl_from_IAMDirectSound(IAMDirectSound *iface) return CONTAINING_RECORD(iface, struct dsound_render, IAMDirectSound_iface); } -static REFERENCE_TIME time_from_pos(struct dsound_render *filter, DWORD pos) +static HRESULT dsound_render_write_data(struct dsound_render *filter, const void *data, DWORD size) { WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; - REFERENCE_TIME ret = 10000000; - ret = ret * pos / wfx->nAvgBytesPerSec; - return ret; -} + unsigned char silence = wfx->wBitsPerSample == 8 ? 128 : 0; + DWORD play_pos, write_end, size1, size2; + void *data1, *data2; + HRESULT hr; -static DWORD pos_from_time(struct dsound_render *filter, REFERENCE_TIME time) -{ - WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; - REFERENCE_TIME ret = time; - ret *= wfx->nAvgBytesPerSec; - ret /= 10000000; - ret -= ret % wfx->nBlockAlign; - return ret; -} + TRACE("filter %p, data %p, size %#lx\n", filter, data, size); -static void DSoundRender_UpdatePositions(struct dsound_render *filter, DWORD *seqwritepos, DWORD *minwritepos) -{ - WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; - BYTE *buf1, *buf2; - DWORD size1, size2, playpos, writepos, old_writepos, old_playpos, adv; - BOOL writepos_set = filter->writepos < filter->buf_size; - - /* Update position and zero */ - old_writepos = filter->writepos; - old_playpos = filter->last_playpos; - if (old_writepos <= old_playpos) - old_writepos += filter->buf_size; - - IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, &playpos, &writepos); - if (old_playpos > playpos) - adv = filter->buf_size + playpos - old_playpos; - else - adv = playpos - old_playpos; - filter->last_playpos = playpos; - if (adv) - { - TRACE("Moving from %lu to %lu: clearing %lu bytes.\n", old_playpos, playpos, adv); - IDirectSoundBuffer_Lock(filter->dsbuffer, old_playpos, adv, (void**)&buf1, &size1, (void**)&buf2, &size2, 0); - memset(buf1, wfx->wBitsPerSample == 8 ? 128 : 0, size1); - memset(buf2, wfx->wBitsPerSample == 8 ? 128 : 0, size2); - IDirectSoundBuffer_Unlock(filter->dsbuffer, buf1, size1, buf2, size2); - } - *minwritepos = writepos; - if (!writepos_set || old_writepos < writepos) - { - if (writepos_set) - { - filter->writepos = filter->buf_size; - FIXME("Underrun of data occurred!\n"); - } - *seqwritepos = writepos; - } + if (!size) + size = filter->buffer_size / 2; else - *seqwritepos = filter->writepos; -} - -static HRESULT DSoundRender_GetWritePos(struct dsound_render *filter, - DWORD *ret_writepos, REFERENCE_TIME write_at, DWORD *pfree, DWORD *skip) -{ - DWORD writepos, min_writepos, playpos; - REFERENCE_TIME max_lag = 50 * 10000; - REFERENCE_TIME cur, writepos_t, delta_t; + size = min(size, filter->buffer_size / 2); - DSoundRender_UpdatePositions(filter, &writepos, &min_writepos); - playpos = filter->last_playpos; - if (filter->filter.clock) - { - IReferenceClock_GetTime(filter->filter.clock, &cur); - cur -= filter->stream_start; - } + if (filter->write_pos == -1) + filter->write_pos = 0; else - write_at = -1; + { + if (FAILED(hr = IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, + &play_pos, NULL))) + return hr; - if (writepos == min_writepos) - max_lag = 0; + write_end = (filter->write_pos + size) % filter->buffer_size; + if (write_end - filter->write_pos >= play_pos - filter->write_pos) + return S_FALSE; + } - *skip = 0; - if (write_at < 0) + if (FAILED(hr = IDirectSoundBuffer_Lock(filter->dsbuffer, filter->write_pos, + size, &data1, &size1, &data2, &size2, 0))) { - *ret_writepos = writepos; - goto end; + ERR("Failed to lock buffer %p, hr %#lx\n", filter->dsbuffer, hr); + return hr; } - if (writepos >= playpos) - writepos_t = cur + time_from_pos(filter, writepos - playpos); - else - writepos_t = cur + time_from_pos(filter, filter->buf_size + writepos - playpos); + TRACE("Locked data1 %p, size1 %#lx, data2 %p, size2 %#lx\n", data1, size1, data2, size2); - /* write_at: Starting time of sample */ - /* cur: current time of play position */ - /* writepos_t: current time of our pointer play position */ - delta_t = write_at - writepos_t; - if (delta_t >= -max_lag && delta_t <= max_lag) - { - TRACE("Continuing from old position\n"); - *ret_writepos = writepos; - } - else if (delta_t < 0) - { - REFERENCE_TIME past, min_writepos_t; - WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag)); - if (min_writepos >= playpos) - min_writepos_t = cur + time_from_pos(filter, min_writepos - playpos); - else - min_writepos_t = cur + time_from_pos(filter, filter->buf_size - playpos + min_writepos); - past = min_writepos_t - write_at; - if (past >= 0) - { - DWORD skipbytes = pos_from_time(filter, past); - WARN("Skipping %lu bytes.\n", skipbytes); - *skip = skipbytes; - *ret_writepos = min_writepos; - } - else - { - DWORD aheadbytes = pos_from_time(filter, -past); - WARN("Advancing %lu bytes.\n", aheadbytes); - *ret_writepos = (min_writepos + aheadbytes) % filter->buf_size; - } - } - else /* delta_t > 0 */ + if (!data) { - DWORD aheadbytes; - WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag)); - aheadbytes = pos_from_time(filter, delta_t); - WARN("Advancing %lu bytes.\n", aheadbytes); - if (delta_t >= DSoundRenderer_Max_Fill) - return S_FALSE; - *ret_writepos = (min_writepos + aheadbytes) % filter->buf_size; + memset(data1, silence, size1); + memset(data2, silence, size2); } -end: - if (playpos >= *ret_writepos) - *pfree = playpos - *ret_writepos; else - *pfree = filter->buf_size + playpos - *ret_writepos; - if (time_from_pos(filter, filter->buf_size - *pfree) >= DSoundRenderer_Max_Fill) { - TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(filter, filter->buf_size - *pfree)), - debugstr_time(DSoundRenderer_Max_Fill)); - return S_FALSE; + memcpy(data1, data, size1); + data = (char *)data + size1; + memcpy(data2, data, size2); } - return S_OK; -} -static HRESULT DSoundRender_HandleEndOfStream(struct dsound_render *filter) -{ - while (filter->filter.state == State_Running) + if (FAILED(hr = IDirectSoundBuffer_Unlock(filter->dsbuffer, data1, size1, data2, size2))) { - DWORD pos1, pos2; - DSoundRender_UpdatePositions(filter, &pos1, &pos2); - if (pos1 == pos2) - break; - - WaitForSingleObject(filter->flush_event, 10); + ERR("Failed to unlock buffer %p, hr %#lx\n", filter->dsbuffer, hr); + return hr; } + TRACE("Unlocked data1 %p, size1 %#lx, data2 %p, size2 %#lx\n", data1, size1, data2, size2); + + filter->write_pos += size; + filter->write_pos %= filter->buffer_size; + + TRACE("Written size %#lx, write_pos %#lx\n", size, filter->write_pos); + return S_OK; } -static HRESULT DSoundRender_SendSampleData(struct dsound_render *filter, - REFERENCE_TIME tStart, REFERENCE_TIME tStop, const BYTE *data, DWORD size) +static HRESULT dsound_render_wait_play_end(struct dsound_render *filter) { + DWORD start_pos, play_pos, end_pos = filter->write_pos; HRESULT hr; - while (size && filter->filter.state != State_Stopped) + if (FAILED(hr = IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, + &start_pos, NULL))) { - DWORD writepos, skip = 0, free, size1, size2, ret; - BYTE *buf1, *buf2; + ERR("Failed to get buffer positions, hr %#lx\n", hr); + return hr; + } - if (filter->filter.state == State_Running) - hr = DSoundRender_GetWritePos(filter, &writepos, tStart, &free, &skip); - else - hr = S_FALSE; + if (FAILED(hr = dsound_render_write_data(filter, NULL, 0))) + return hr; + + while (filter->filter.state == State_Running) + { + HANDLE handles[] = {filter->empty_event, filter->flush_event}; - if (hr != S_OK) + if (FAILED(hr = IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, + &play_pos, NULL))) { - ret = WaitForSingleObject(filter->flush_event, 10); - if (filter->sink.flushing || filter->filter.state == State_Stopped) - return filter->filter.state == State_Paused ? S_OK : VFW_E_WRONG_STATE; - if (ret != WAIT_TIMEOUT) - ERR("WaitForSingleObject() returned %ld.\n", ret); - continue; + ERR("Failed to get buffer positions, hr %#lx\n", hr); + return hr; } - tStart = -1; - - if (skip) - FIXME("Sample dropped %lu of %lu bytes.\n", skip, size); - if (skip >= size) - return S_OK; - data += skip; - size -= skip; - hr = IDirectSoundBuffer_Lock(filter->dsbuffer, writepos, min(free, size), (void**)&buf1, &size1, (void**)&buf2, &size2, 0); - if (hr != DS_OK) - { - ERR("Failed to lock sound buffer, hr %#lx.\n", hr); + if (play_pos - start_pos >= end_pos - start_pos) break; - } - memcpy(buf1, data, size1); - if (size2) - memcpy(buf2, data+size1, size2); - IDirectSoundBuffer_Unlock(filter->dsbuffer, buf1, size1, buf2, size2); - filter->writepos = (writepos + size1 + size2) % filter->buf_size; - TRACE("Wrote %lu bytes at %lu, next at %lu - (%lu/%lu)\n", size1+size2, writepos, filter->writepos, free, size); - data += size1 + size2; - size -= size1 + size2; + + WARN("Waiting for EOS, start_pos %#lx, play_pos %#lx, end_pos %#lx\n", + start_pos, play_pos, end_pos); + + WaitForMultipleObjects(2, handles, FALSE, INFINITE); } + return S_OK; } -static HRESULT DSoundRender_PrepareReceive(struct dsound_render *filter, IMediaSample *pSample) +static HRESULT dsound_render_configure_buffer(struct dsound_render *filter, IMediaSample *sample) { HRESULT hr; AM_MEDIA_TYPE *amt; - if (IMediaSample_GetMediaType(pSample, &amt) == S_OK) + if (IMediaSample_GetMediaType(sample, &amt) == S_OK) { AM_MEDIA_TYPE *orig = &filter->sink.pin.mt; WAVEFORMATEX *origfmt = (WAVEFORMATEX *)orig->pbFormat; @@ -329,51 +217,24 @@ static HRESULT DSoundRender_PrepareReceive(struct dsound_render *filter, IMediaS return VFW_E_TYPE_NOT_ACCEPTED; FreeMediaType(orig); CopyMediaType(orig, amt); - IMediaSample_SetMediaType(pSample, NULL); + IMediaSample_SetMediaType(sample, NULL); } } else return VFW_E_TYPE_NOT_ACCEPTED; } - return S_OK; -} - -static HRESULT DSoundRender_DoRenderSample(struct dsound_render *filter, IMediaSample *pSample) -{ - LPBYTE pbSrcStream = NULL; - LONG cbSrcStream = 0; - REFERENCE_TIME tStart, tStop; - HRESULT hr; - - hr = IMediaSample_GetPointer(pSample, &pbSrcStream); - if (FAILED(hr)) - { - ERR("Failed to get buffer pointer, hr %#lx.\n", hr); - return hr; - } - - hr = IMediaSample_GetTime(pSample, &tStart, &tStop); - if (FAILED(hr)) - { - ERR("Failed to get sample time, hr %#lx.\n", hr); - tStart = tStop = -1; - } - - if (IMediaSample_IsPreroll(pSample) == S_OK) - { - TRACE("Preroll!\n"); - return S_OK; - } - cbSrcStream = IMediaSample_GetActualDataLength(pSample); - return DSoundRender_SendSampleData(filter, tStart, tStop, pbSrcStream, cbSrcStream); + return S_OK; } static HRESULT WINAPI dsound_render_sink_Receive(struct strmbase_sink *iface, IMediaSample *sample) { struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin); - REFERENCE_TIME start, stop; + WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; + REFERENCE_TIME current = 0, start = 0, stop; HRESULT hr; + BYTE *data; + LONG size; TRACE("filter %p, sample %p.\n", filter, sample); @@ -383,16 +244,62 @@ static HRESULT WINAPI dsound_render_sink_Receive(struct strmbase_sink *iface, IM if (filter->filter.state == State_Stopped) return VFW_E_WRONG_STATE; - if (FAILED(hr = DSoundRender_PrepareReceive(filter, sample))) + if (FAILED(hr = dsound_render_configure_buffer(filter, sample))) return hr; - if (filter->filter.clock && SUCCEEDED(IMediaSample_GetTime(sample, &start, &stop))) - strmbase_passthrough_update_time(&filter->passthrough, start); + if (filter->filter.clock) + { + if (SUCCEEDED(IMediaSample_GetTime(sample, &start, &stop))) + strmbase_passthrough_update_time(&filter->passthrough, start); + + if (filter->stream_start != -1 && SUCCEEDED(IReferenceClock_GetTime(filter->filter.clock, ¤t))) + current -= filter->stream_start; + } if (filter->filter.state == State_Paused) SetEvent(filter->state_event); - return DSoundRender_DoRenderSample(filter, sample); + if (FAILED(hr = IMediaSample_GetPointer(sample, &data))) + { + ERR("Failed to get buffer pointer, hr %#lx.\n", hr); + return hr; + } + + size = IMediaSample_GetActualDataLength(sample); + + if (filter->write_pos == -1 && start > current) + { + /* prepend some silence if the first sample doesn't start at 0 */ + DWORD length = (start - current) * wfx->nAvgBytesPerSec / 10000000; + length -= length % wfx->nBlockAlign; + + if (length != 0 && FAILED(hr = dsound_render_write_data(filter, NULL, length))) + return hr; + } + else if (filter->write_pos == -1 && start < current) + { + /* or skip some data instead if the first sample is late */ + DWORD offset = (current - start) * wfx->nAvgBytesPerSec / 10000000; + offset -= offset % wfx->nBlockAlign; + + data += min(size, offset); + size -= min(size, offset); + } + + while (size && (hr = dsound_render_write_data(filter, data, size)) == S_FALSE) + { + HANDLE handles[] = {filter->empty_event, filter->flush_event}; + + WARN("Could not write %#lx bytes, waiting for buffer to empty.\n", size); + + if (WaitForMultipleObjects(2, handles, FALSE, INFINITE) == WAIT_OBJECT_0 + 1) + { + TRACE("Flush event notified, dropping sample.\n"); + return S_OK; + } + } + + return hr; } static HRESULT dsound_render_sink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out) @@ -420,22 +327,45 @@ static HRESULT dsound_render_sink_connect(struct strmbase_sink *iface, IPin *pee { struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin); const WAVEFORMATEX *format = (WAVEFORMATEX *)mt->pbFormat; - HRESULT hr = S_OK; + IDirectSoundNotify *notify; DSBUFFERDESC buf_desc; - - filter->buf_size = format->nAvgBytesPerSec; + HRESULT hr = S_OK; memset(&buf_desc,0,sizeof(DSBUFFERDESC)); buf_desc.dwSize = sizeof(DSBUFFERDESC); buf_desc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY | DSBCAPS_GLOBALFOCUS | - DSBCAPS_GETCURRENTPOSITION2; - buf_desc.dwBufferBytes = filter->buf_size; + DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY; + buf_desc.dwBufferBytes = format->nAvgBytesPerSec; buf_desc.lpwfxFormat = (WAVEFORMATEX *)format; - hr = IDirectSound8_CreateSoundBuffer(filter->dsound, &buf_desc, &filter->dsbuffer, NULL); - filter->writepos = filter->buf_size; - if (FAILED(hr)) + + filter->buffer_size = format->nAvgBytesPerSec; + filter->write_pos = -1; + + if (FAILED(hr = IDirectSound8_CreateSoundBuffer(filter->dsound, &buf_desc, &filter->dsbuffer, NULL))) ERR("Failed to create sound buffer, hr %#lx.\n", hr); + else if (FAILED(hr = IDirectSoundBuffer_QueryInterface(filter->dsbuffer, &IID_IDirectSoundNotify, + (void **)¬ify))) + ERR("Failed to query IDirectSoundNotify iface, hr %#lx.\n", hr); + else + { + DSBPOSITIONNOTIFY positions[10] = {{.dwOffset = 0, .hEventNotify = filter->empty_event}}; + int i; + + TRACE("Created buffer %p with size %#lx\n", filter->dsbuffer, filter->buffer_size); + + for (i = 1; i < ARRAY_SIZE(positions); ++i) + { + positions[i] = positions[i - 1]; + positions[i].dwOffset += filter->buffer_size / ARRAY_SIZE(positions); + } + + if (FAILED(hr = IDirectSoundNotify_SetNotificationPositions(notify, + ARRAY_SIZE(positions), positions))) + ERR("Failed to set notification positions, hr %#lx\n", hr); + + IDirectSoundNotify_Release(notify); + } if (SUCCEEDED(hr)) { @@ -475,8 +405,6 @@ static HRESULT dsound_render_sink_eos(struct strmbase_sink *iface) struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin); IFilterGraph *graph = filter->filter.graph; IMediaEventSink *event_sink; - void *buffer; - DWORD size; filter->eos = TRUE; @@ -491,11 +419,8 @@ static HRESULT dsound_render_sink_eos(struct strmbase_sink *iface) strmbase_passthrough_eos(&filter->passthrough); SetEvent(filter->state_event); - DSoundRender_HandleEndOfStream(filter); - - IDirectSoundBuffer_Lock(filter->dsbuffer, 0, 0, &buffer, &size, NULL, NULL, DSBLOCK_ENTIREBUFFER); - memset(buffer, 0, size); - IDirectSoundBuffer_Unlock(filter->dsbuffer, buffer, size, NULL, 0); + if (filter->dsbuffer && filter->write_pos != -1) + dsound_render_wait_play_end(filter); return S_OK; } @@ -527,7 +452,7 @@ static HRESULT dsound_render_sink_end_flush(struct strmbase_sink *iface) IDirectSoundBuffer_Lock(filter->dsbuffer, 0, 0, &buffer, &size, NULL, NULL, DSBLOCK_ENTIREBUFFER); memset(buffer, 0, size); IDirectSoundBuffer_Unlock(filter->dsbuffer, buffer, size, NULL, 0); - filter->writepos = filter->buf_size; + filter->write_pos = -1; } LeaveCriticalSection(&filter->filter.stream_cs); @@ -566,6 +491,7 @@ static void dsound_render_destroy(struct strmbase_filter *iface) CloseHandle(filter->state_event); CloseHandle(filter->flush_event); + CloseHandle(filter->empty_event); strmbase_passthrough_cleanup(&filter->passthrough); strmbase_filter_cleanup(&filter->filter); @@ -646,10 +572,10 @@ static HRESULT dsound_render_stop_stream(struct strmbase_filter *iface) struct dsound_render *filter = impl_from_strmbase_filter(iface); if (filter->sink.pin.peer) - { IDirectSoundBuffer_Stop(filter->dsbuffer); - filter->writepos = filter->buf_size; - } + + filter->stream_start = -1; + return S_OK; } @@ -1026,9 +952,11 @@ HRESULT dsound_render_create(IUnknown *outer, IUnknown **out) ISeekingPassThru_Init(&object->passthrough.ISeekingPassThru_iface, TRUE, &object->sink.pin.IPin_iface); strmbase_sink_init(&object->sink, &object->filter, L"Audio Input pin (rendered)", &sink_ops, NULL); + object->stream_start = -1; object->state_event = CreateEventW(NULL, TRUE, TRUE, NULL); object->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL); + object->empty_event = CreateEventW(NULL, FALSE, FALSE, NULL); object->IBasicAudio_iface.lpVtbl = &basic_audio_vtbl; object->IAMDirectSound_iface.lpVtbl = &am_direct_sound_vtbl; From 6392b69d9ad909a5fa07ae56255a6ee3cd79313b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 13 Oct 2022 10:48:51 +0200 Subject: [PATCH 0169/1506] quartz: Handle DirectSound Renderer Filter underruns. CW-Bug-Id: #21192 --- dlls/quartz/dsoundrender.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index e45bf669ff6..7cc27f0f08c 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -90,7 +90,7 @@ static HRESULT dsound_render_write_data(struct dsound_render *filter, const void { WAVEFORMATEX *wfx = (WAVEFORMATEX *)filter->sink.pin.mt.pbFormat; unsigned char silence = wfx->wBitsPerSample == 8 ? 128 : 0; - DWORD play_pos, write_end, size1, size2; + DWORD write_end, size1, size2; void *data1, *data2; HRESULT hr; @@ -105,10 +105,19 @@ static HRESULT dsound_render_write_data(struct dsound_render *filter, const void filter->write_pos = 0; else { + DWORD play_pos, write_pos; + if (FAILED(hr = IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, - &play_pos, NULL))) + &play_pos, &write_pos))) return hr; + if (filter->write_pos - play_pos <= write_pos - play_pos) + { + WARN("Buffer underrun detected, filter %p, dsound play pos %#lx, write pos %#lx, filter write pos %#lx!\n", + filter, play_pos, write_pos, filter->write_pos); + filter->write_pos = write_pos; + } + write_end = (filter->write_pos + size) % filter->buffer_size; if (write_end - filter->write_pos >= play_pos - filter->write_pos) return S_FALSE; From 964a745bedde9e9ef25ffbffca461987eefc0668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 13 Oct 2022 10:48:51 +0200 Subject: [PATCH 0170/1506] quartz: Add an initial silent 30ms to the DirectSound Renderer Filter. To avoid underruns as much as possible. This is required for Persona 4 Golden intro with non-english audio settings. CW-Bug-Id: #21192 --- dlls/quartz/dsoundrender.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 7cc27f0f08c..0967174139f 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -276,10 +276,10 @@ static HRESULT WINAPI dsound_render_sink_Receive(struct strmbase_sink *iface, IM size = IMediaSample_GetActualDataLength(sample); - if (filter->write_pos == -1 && start > current) + if (filter->write_pos == -1 && (start + 300000) > current) { - /* prepend some silence if the first sample doesn't start at 0 */ - DWORD length = (start - current) * wfx->nAvgBytesPerSec / 10000000; + /* prepend at least 30ms of silence before the first sample */ + DWORD length = (start + 300000 - current) * wfx->nAvgBytesPerSec / 10000000; length -= length % wfx->nBlockAlign; if (length != 0 && FAILED(hr = dsound_render_write_data(filter, NULL, length))) From 938c70f5a9c5613db4b1dd7fa749481958514fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 17 Oct 2022 16:57:14 +0200 Subject: [PATCH 0171/1506] quartz: Handle position wrap-around while waiting for DirectSound rendererer EOS. --- dlls/quartz/dsoundrender.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 0967174139f..93bbb264a1e 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -162,7 +162,7 @@ static HRESULT dsound_render_write_data(struct dsound_render *filter, const void static HRESULT dsound_render_wait_play_end(struct dsound_render *filter) { - DWORD start_pos, play_pos, end_pos = filter->write_pos; + DWORD start_pos, play_pos, written, played = 0; HRESULT hr; if (FAILED(hr = IDirectSoundBuffer_GetCurrentPosition(filter->dsbuffer, @@ -172,6 +172,8 @@ static HRESULT dsound_render_wait_play_end(struct dsound_render *filter) return hr; } + written = filter->write_pos - start_pos + (filter->write_pos < start_pos ? filter->buffer_size : 0); + if (FAILED(hr = dsound_render_write_data(filter, NULL, 0))) return hr; @@ -186,13 +188,15 @@ static HRESULT dsound_render_wait_play_end(struct dsound_render *filter) return hr; } - if (play_pos - start_pos >= end_pos - start_pos) + played += play_pos - start_pos + (play_pos < start_pos ? filter->buffer_size : 0); + if (played >= written) break; - WARN("Waiting for EOS, start_pos %#lx, play_pos %#lx, end_pos %#lx\n", - start_pos, play_pos, end_pos); + WARN("Waiting for EOS, start_pos %#lx, play_pos %#lx, written %#lx, played %#lx\n", + start_pos, play_pos, written, played); WaitForMultipleObjects(2, handles, FALSE, INFINITE); + start_pos = play_pos; } return S_OK; From 3e2abf4af0c33eb4d89efd06da9676c1cd1079d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 17 Oct 2022 09:54:50 +0200 Subject: [PATCH 0172/1506] winegstreamer/wg_format: Fill channel position if wg_format is missing channel_mask. CW-Bug-Id: #21409 --- dlls/winegstreamer/wg_format.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 7b9a2a3b8b2..1c9b49a1e55 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -496,6 +496,8 @@ static void wg_channel_mask_to_gst(GstAudioChannelPosition *positions, uint32_t else { GST_WARNING("Incomplete channel mask %#x.", orig_mask); + if (!orig_mask) + positions[i] = position_map[bit]; } } } From b429bba063c5c4d05ba9d45d3e6ead2284ea312c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Nov 2022 19:53:30 -0600 Subject: [PATCH 0173/1506] winegstreamer/wg_parser: Sort streams by stream sequential number when QuickTime demuxer is used. CW-Bug-Id: #21352 --- dlls/winegstreamer/wg_parser.c | 43 +++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index ed9c2635a84..f017a504b39 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -103,6 +103,7 @@ struct wg_parser struct input_cache_chunk input_cache_chunks[4]; + bool using_qtdemux; bool use_mediaconv; bool use_opengl; GstContext *context; @@ -127,6 +128,8 @@ struct wg_parser_stream uint64_t duration; gchar *tags[WG_PARSER_TAG_COUNT]; + gchar *stream_id; + int seq_id; }; static struct wg_parser *get_parser(wg_parser_t parser) @@ -564,6 +567,8 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, GST_INFO("Skipping \"Proton video converter\"."); return GST_AUTOPLUG_SELECT_SKIP; } + if (!strcmp(name, "QuickTime demuxer")) + parser->using_qtdemux = true; if (!parser->sink_caps && strstr(klass, GST_ELEMENT_FACTORY_KLASS_DEMUXER)) parser->sink_caps = g_strdup(gst_structure_get_name(gst_caps_get_structure(caps, 0))); @@ -599,12 +604,38 @@ static GValueArray *autoplug_sort_cb(GstElement *bin, GstPad *pad, return ret; } +static int streams_compare(const void *comp1, const void *comp2) +{ + const struct wg_parser_stream * const *stream1 = comp1; + const struct wg_parser_stream * const *stream2 = comp2; + const char *s1, *s2; + int ret; + + s1 = (*stream1)->stream_id ? strchr((*stream1)->stream_id, '/') : NULL; + s2 = (*stream2)->stream_id ? strchr((*stream2)->stream_id, '/') : NULL; + + if (!s1 || !s2) + { + if (!s1 && !s2) + return (*stream1)->seq_id - (*stream2)->seq_id; + if (!s1) + return -1; + return 1; + } + if ((ret = strcmp(s1, s2))) + return ret; + return (*stream1)->seq_id - (*stream2)->seq_id; +} + static void no_more_pads_cb(GstElement *element, gpointer user) { struct wg_parser *parser = user; GST_DEBUG("parser %p.", parser); + if (parser->using_qtdemux) + qsort(parser->streams, parser->stream_count, sizeof(*parser->streams), streams_compare); + pthread_mutex_lock(&parser->mutex); parser->no_more_pads = true; pthread_mutex_unlock(&parser->mutex); @@ -870,7 +901,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) } } -static struct wg_parser_stream *create_stream(struct wg_parser *parser) +static struct wg_parser_stream *create_stream(struct wg_parser *parser, char *id) { struct wg_parser_stream *stream, **new_array; char pad_name[19]; @@ -884,6 +915,8 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser) gst_segment_init(&stream->segment, GST_FORMAT_UNDEFINED); + stream->stream_id = id; + stream->seq_id = parser->stream_count; stream->parser = parser; stream->number = parser->stream_count; stream->no_more_pads = true; @@ -929,6 +962,10 @@ static void free_stream(struct wg_parser_stream *stream) if (stream->tags[i]) g_free(stream->tags[i]); } + + if (stream->stream_id) + g_free(stream->stream_id); + free(stream); } @@ -1131,7 +1168,7 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) if (gst_pad_is_linked(pad)) return; - if (!(stream = create_stream(parser))) + if (!(stream = create_stream(parser, gst_pad_get_stream_id(pad)))) return; caps = gst_pad_query_caps(pad, NULL); @@ -2028,7 +2065,7 @@ static BOOL wave_parser_init_gst(struct wg_parser *parser) if (!link_src_to_element(parser->my_src, element)) return FALSE; - if (!(stream = create_stream(parser))) + if (!(stream = create_stream(parser, NULL))) return FALSE; if (!link_element_to_sink(element, stream->my_sink)) From a6716acf4128eaf0c786786e71c28d8c1586d672 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 15 Dec 2022 14:20:01 +0100 Subject: [PATCH 0174/1506] mfreadwrite/reader: Consider the transform output attributes for creating shared samples. Some application (e.g., Trailmakers) set MF_SA_D3D11_SHARED_WITHOUT_MUTEX on the transform's output attributes rather than on the reader's attributes. CW-Bug-Id: #19126 CW-Bug-Id: #20985 --- dlls/mfreadwrite/reader.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c index 3bcd55f53eb..1461d7acd7b 100644 --- a/dlls/mfreadwrite/reader.c +++ b/dlls/mfreadwrite/reader.c @@ -2121,20 +2121,33 @@ static HRESULT source_reader_set_compatible_media_type(struct source_reader *rea } static HRESULT source_reader_create_sample_allocator_attributes(const struct source_reader *reader, - IMFAttributes **attributes) + struct media_stream *stream, IMFAttributes **attributes) { - UINT32 shared = 0, shared_without_mutex = 0; + UINT32 reader_shared = 0, reader_shared_without_mutex = 0; + UINT32 output_shared = 0, output_shared_without_mutex = 0; HRESULT hr; if (FAILED(hr = MFCreateAttributes(attributes, 1))) return hr; - IMFAttributes_GetUINT32(reader->attributes, &MF_SA_D3D11_SHARED, &shared); - IMFAttributes_GetUINT32(reader->attributes, &MF_SA_D3D11_SHARED_WITHOUT_MUTEX, &shared_without_mutex); + IMFAttributes_GetUINT32(reader->attributes, &MF_SA_D3D11_SHARED, &reader_shared); + IMFAttributes_GetUINT32(reader->attributes, &MF_SA_D3D11_SHARED_WITHOUT_MUTEX, &reader_shared_without_mutex); - if (shared_without_mutex) + if (stream->decoder.transform) + { + IMFAttributes *output_attributes; + + if (SUCCEEDED(IMFTransform_GetOutputStreamAttributes(stream->decoder.transform, 0, &output_attributes))) + { + IMFAttributes_GetUINT32(output_attributes, &MF_SA_D3D11_SHARED, &output_shared); + IMFAttributes_GetUINT32(output_attributes, &MF_SA_D3D11_SHARED_WITHOUT_MUTEX, &output_shared_without_mutex); + IMFAttributes_Release(output_attributes); + } + } + + if (reader_shared_without_mutex || output_shared_without_mutex) hr = IMFAttributes_SetUINT32(*attributes, &MF_SA_D3D11_SHARED_WITHOUT_MUTEX, TRUE); - else if (shared) + else if (reader_shared || output_shared) hr = IMFAttributes_SetUINT32(*attributes, &MF_SA_D3D11_SHARED, TRUE); return hr; @@ -2170,7 +2183,7 @@ static HRESULT source_reader_setup_sample_allocator(struct source_reader *reader return hr; } - if (FAILED(hr = source_reader_create_sample_allocator_attributes(reader, &attributes))) + if (FAILED(hr = source_reader_create_sample_allocator_attributes(reader, stream, &attributes))) WARN("Failed to create allocator attributes, hr %#lx.\n", hr); if (FAILED(hr = IMFVideoSampleAllocatorEx_InitializeSampleAllocatorEx(stream->allocator, 2, 8, From 2106ad91b893495aadfe91bc3d220cc5c8a1e8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 6 Sep 2022 22:01:26 +0200 Subject: [PATCH 0175/1506] mf: Discard end of presentation on IMFMediaSession_Stop. MR !607 was trying to fix an issue with Life Is Strange Remastered, but although it fixed some race conditions with presentation end, the issue it was trying to fix is still there. The game calls IMFMediaSession_Stop while the presentation is ending, expects that command to quickly execute, interrupting the presentation end and emitting a MESessionStopped event instead of the MESessionEnded. Delaying the Stop command and emitting the MESessionEnded event breaks the game assumptions and it crashes. CW-Bug-Id: #20916 --- dlls/mf/session.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 242bc3fe88b..1fa3ea77348 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -2574,6 +2574,13 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface, EnterCriticalSection(&session->cs); + if ((session->presentation.flags & SESSION_FLAG_END_OF_PRESENTATION) && op->command != SESSION_CMD_STOP) + { + WARN("session %p command is ending, waiting for it to complete.\n", session); + LeaveCriticalSection(&session->cs); + return S_OK; + } + if (session->presentation.flags & SESSION_FLAG_PENDING_COMMAND) { WARN("session %p command is in progress, waiting for it to complete.\n", session); @@ -2600,6 +2607,9 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface, session_pause(session); break; case SESSION_CMD_STOP: + if (session->presentation.flags & SESSION_FLAG_END_OF_PRESENTATION) + session_set_topo_status(session, S_OK, MF_TOPOSTATUS_ENDED); + session_clear_end_of_presentation(session); session_stop(session); break; case SESSION_CMD_CLOSE: @@ -3580,7 +3590,7 @@ static void session_raise_end_of_presentation(struct media_session *session) { if (session_nodes_is_mask_set(session, MF_TOPOLOGY_MAX, SOURCE_FLAG_END_OF_PRESENTATION)) { - session->presentation.flags |= SESSION_FLAG_END_OF_PRESENTATION | SESSION_FLAG_PENDING_COMMAND; + session->presentation.flags |= SESSION_FLAG_END_OF_PRESENTATION; IMFMediaEventQueue_QueueEventParamVar(session->event_queue, MEEndOfPresentation, &GUID_NULL, S_OK, NULL); } } From c38cf029cc117f181c7dedcd5b2e7e9e4ad61cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 31 Oct 2022 10:34:38 +0100 Subject: [PATCH 0176/1506] HACK: mf: Return E_NOTIMPL from media session SetRate if rate is 0 (scrubbing). CW-Bug-Id: #21498 --- dlls/mf/session.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 1fa3ea77348..40fabbca69e 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -4163,6 +4163,13 @@ static HRESULT WINAPI session_rate_control_SetRate(IMFRateControl *iface, BOOL t TRACE("%p, %d, %f.\n", iface, thin, rate); + if (!rate) + { + /* The Anacrusis fails to play its video if we succeed here */ + ERR("Scrubbing not implemented!\n"); + return E_NOTIMPL; + } + if (FAILED(hr = create_session_op(SESSION_CMD_SET_RATE, &op))) return hr; From e285015e53896814701e1bb1ce9e675e29625097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 17:29:05 +0100 Subject: [PATCH 0177/1506] winex11: Always synchronize gdi_display after window creation. --- dlls/winex11.drv/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e68c4abdf93..696edd6675c 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1750,7 +1750,6 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual ) cx = min( max( 1, data->client_rect.right - data->client_rect.left ), 65535 ); cy = min( max( 1, data->client_rect.bottom - data->client_rect.top ), 65535 ); - XSync( gdi_display, False ); /* make sure whole_window is known from gdi_display */ ret = data->client_window = XCreateWindow( gdi_display, data->whole_window ? data->whole_window : dummy_parent, x, y, cx, cy, 0, default_visual.depth, InputOutput, @@ -1837,6 +1836,7 @@ static void create_whole_window( struct x11drv_win_data *data ) sync_window_opacity( data->display, data->whole_window, key, alpha, layered_flags ); XFlush( data->display ); /* make sure the window exists before we start painting to it */ + XSync( gdi_display, False ); /* make sure whole_window is known from gdi_display */ done: if (win_rgn) NtGdiDeleteObjectApp( win_rgn ); From 97f7886db821aca8d026fad87ab96ae88e07aec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 14:22:24 +0100 Subject: [PATCH 0178/1506] winex11: Keep the client window colormap on the GL drawable. Making sure it is kept alive as long as the client window lives. --- dlls/winex11.drv/opengl.c | 12 ++++++++++-- dlls/winex11.drv/vulkan.c | 2 +- dlls/winex11.drv/window.c | 10 ++-------- dlls/winex11.drv/x11drv.h | 3 +-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index bb8f13f78b9..329bca11aad 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -224,6 +224,7 @@ struct gl_drawable enum dc_gl_type type; /* type of GL surface */ GLXDrawable drawable; /* drawable for rendering with GL */ Window window; /* window if drawable is a GLXWindow */ + Colormap colormap; /* colormap for the client window */ Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */ const struct wgl_pixel_format *format; /* pixel format for the drawable */ SIZE pixmap_size; /* pixmap size for GLXPixmap drawables */ @@ -1159,6 +1160,7 @@ static void release_gl_drawable( struct gl_drawable *gl ) TRACE( "destroying %lx drawable %lx\n", gl->window, gl->drawable ); pglXDestroyWindow( gdi_display, gl->drawable ); XDestroyWindow( gdi_display, gl->window ); + XFreeColormap( gdi_display, gl->colormap ); break; case DC_GL_PIXMAP_WIN: TRACE( "destroying pixmap %lx drawable %lx\n", gl->pixmap, gl->drawable ); @@ -1333,7 +1335,10 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel NtUserGetAncestor( hwnd, GA_PARENT ) == NtUserGetDesktopWindow()) /* childless top-level window */ { gl->type = DC_GL_WINDOW; - gl->window = create_client_window( hwnd, visual ); + gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, + (visual->class == PseudoColor || visual->class == GrayScale || + visual->class == DirectColor) ? AllocAll : AllocNone ); + gl->window = create_client_window( hwnd, visual, gl->colormap ); if (gl->window) gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); TRACE( "%p created client %lx drawable %lx\n", hwnd, gl->window, gl->drawable ); @@ -1342,7 +1347,10 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel else if(usexcomposite) { gl->type = DC_GL_CHILD_WIN; - gl->window = create_client_window( hwnd, visual ); + gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, + (visual->class == PseudoColor || visual->class == GrayScale || + visual->class == DirectColor) ? AllocAll : AllocNone ); + gl->window = create_client_window( hwnd, visual, gl->colormap ); if (gl->window) { gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index b57282ee85f..7366759e76c 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -346,7 +346,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, x11_surface->hwnd = create_info->hwnd; if (x11_surface->hwnd) { - x11_surface->window = create_client_window(create_info->hwnd, &default_visual); + x11_surface->window = create_client_window(create_info->hwnd, &default_visual, default_colormap); x11_surface->hwnd_thread_id = NtUserGetWindowThread(x11_surface->hwnd, NULL); } else diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 696edd6675c..58cccb7d77e 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1709,7 +1709,7 @@ Window create_dummy_client_window(void) /********************************************************************** * create_client_window */ -Window create_client_window( HWND hwnd, const XVisualInfo *visual ) +Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ) { Window dummy_parent = get_dummy_parent(); struct x11drv_win_data *data = get_win_data( hwnd ); @@ -1734,12 +1734,7 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual ) TRACE( "%p reparent xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); } - if (data->client_colormap) XFreeColormap( gdi_display, data->client_colormap ); - data->client_colormap = XCreateColormap( gdi_display, dummy_parent, visual->visual, - (visual->class == PseudoColor || - visual->class == GrayScale || - visual->class == DirectColor) ? AllocAll : AllocNone ); - attr.colormap = data->client_colormap; + attr.colormap = colormap; attr.bit_gravity = NorthWestGravity; attr.win_gravity = NorthWestGravity; attr.backing_store = NotUseful; @@ -1992,7 +1987,6 @@ void X11DRV_DestroyWindow( HWND hwnd ) if (thread_data->last_xic_hwnd == hwnd) thread_data->last_xic_hwnd = 0; if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap ); if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask ); - if (data->client_colormap) XFreeColormap( data->display, data->client_colormap ); free( data->icon_bits ); XDeleteContext( gdi_display, (XID)hwnd, win_data_context ); release_win_data( data ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 6fae6aa79a2..d446a1c6e51 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -617,7 +617,6 @@ struct x11drv_win_data Display *display; /* display connection for the thread owning the window */ XVisualInfo vis; /* X visual used by this window */ Colormap whole_colormap; /* colormap if non-default visual */ - Colormap client_colormap; /* colormap for the client window */ HWND hwnd; /* hwnd that this private data belongs to */ Window whole_window; /* X window for the complete window */ Window client_window; /* X window for the client area */ @@ -667,7 +666,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data ) extern void update_net_wm_states( struct x11drv_win_data *data ); extern void make_window_embedded( struct x11drv_win_data *data ); extern Window create_dummy_client_window(void); -extern Window create_client_window( HWND hwnd, const XVisualInfo *visual ); +extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void change_systray_owner( Display *display, Window systray_window ); extern HWND create_foreign_window( Display *display, Window window ); From eb607dd5ba1ae208424c70874ae1d94176c0fe8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 28 Nov 2023 10:57:42 +0100 Subject: [PATCH 0179/1506] winex11: Introduce a new detach_client_window helper. --- dlls/winex11.drv/window.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 58cccb7d77e..60e76f506d8 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1688,6 +1688,25 @@ Window get_dummy_parent(void) } +/********************************************************************** + * detach_client_window + */ +static void detach_client_window( struct x11drv_win_data *data, Window client_window ) +{ + if (data->client_window != client_window || !client_window) return; + data->client_window = 0; + + if (!data->whole_window) return; + + XSelectInput( data->display, client_window, 0 ); + XFlush( data->display ); /* make sure XSelectInput is disabled for client_window after this point */ + XDeleteContext( data->display, client_window, winContext ); + + XReparentWindow( gdi_display, client_window, get_dummy_parent(), 0, 0 ); + TRACE( "%p/%lx detached client window %lx\n", data->hwnd, data->whole_window, client_window ); +} + + /********************************************************************** * create_dummy_client_window */ @@ -1727,12 +1746,7 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo data->window_rect = data->whole_rect = data->client_rect; } - if (data->client_window) - { - XDeleteContext( data->display, data->client_window, winContext ); - XReparentWindow( gdi_display, data->client_window, dummy_parent, 0, 0 ); - TRACE( "%p reparent xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); - } + detach_client_window( data, data->client_window ); attr.colormap = colormap; attr.bit_gravity = NorthWestGravity; @@ -1865,12 +1879,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des } else { - if (data->client_window && !already_destroyed) - { - XSelectInput( data->display, data->client_window, 0 ); - XFlush( data->display ); /* make sure XSelectInput doesn't use client_window after this point */ - XReparentWindow( gdi_display, data->client_window, get_dummy_parent(), 0, 0 ); - } + if (!already_destroyed) detach_client_window( data, data->client_window ); XDeleteContext( data->display, data->whole_window, winContext ); if (!already_destroyed) { From 36597ee89ac37aa234bcd7c8ee285b3d41f3472a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 14:56:57 +0100 Subject: [PATCH 0180/1506] winex11: Introduce a new destroy_client_window helper. --- dlls/winex11.drv/opengl.c | 4 +++- dlls/winex11.drv/vulkan.c | 4 +--- dlls/winex11.drv/window.c | 28 ++++++++++++++++++++++++---- dlls/winex11.drv/x11drv.h | 1 + 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 329bca11aad..4a02f829c31 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -222,6 +222,7 @@ struct gl_drawable { LONG ref; /* reference count */ enum dc_gl_type type; /* type of GL surface */ + HWND hwnd; GLXDrawable drawable; /* drawable for rendering with GL */ Window window; /* window if drawable is a GLXWindow */ Colormap colormap; /* colormap for the client window */ @@ -1159,7 +1160,7 @@ static void release_gl_drawable( struct gl_drawable *gl ) case DC_GL_CHILD_WIN: TRACE( "destroying %lx drawable %lx\n", gl->window, gl->drawable ); pglXDestroyWindow( gdi_display, gl->drawable ); - XDestroyWindow( gdi_display, gl->window ); + destroy_client_window( gl->hwnd, gl->window ); XFreeColormap( gdi_display, gl->colormap ); break; case DC_GL_PIXMAP_WIN: @@ -1329,6 +1330,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->refresh_swap_interval = TRUE; gl->format = format; gl->ref = 1; + gl->hwnd = hwnd; gl->mutable_pf = mutable_pf; if (!known_child && !NtUserGetWindowRelative( hwnd, GW_CHILD ) && diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 7366759e76c..0c888da622b 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -218,9 +218,7 @@ static void wine_vk_surface_release(struct wine_vk_surface *surface) pthread_mutex_unlock(&vulkan_mutex); } - if (surface->window) - XDestroyWindow(gdi_display, surface->window); - + destroy_client_window( surface->hwnd, surface->window ); free(surface); } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 60e76f506d8..e07cebcade6 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1691,7 +1691,7 @@ Window get_dummy_parent(void) /********************************************************************** * detach_client_window */ -static void detach_client_window( struct x11drv_win_data *data, Window client_window ) +static void detach_client_window( struct x11drv_win_data *data, Window client_window, BOOL reparent ) { if (data->client_window != client_window || !client_window) return; data->client_window = 0; @@ -1702,11 +1702,31 @@ static void detach_client_window( struct x11drv_win_data *data, Window client_wi XFlush( data->display ); /* make sure XSelectInput is disabled for client_window after this point */ XDeleteContext( data->display, client_window, winContext ); - XReparentWindow( gdi_display, client_window, get_dummy_parent(), 0, 0 ); + if (reparent) XReparentWindow( gdi_display, client_window, get_dummy_parent(), 0, 0 ); TRACE( "%p/%lx detached client window %lx\n", data->hwnd, data->whole_window, client_window ); } +/********************************************************************** + * destroy_client_window + */ +void destroy_client_window( HWND hwnd, Window client_window ) +{ + struct x11drv_win_data *data; + + if (!client_window) return; + + if ((data = get_win_data( hwnd ))) + { + detach_client_window( data, client_window, FALSE ); + release_win_data( data ); + } + + XDestroyWindow( gdi_display, client_window ); + TRACE( "%p destroyed client window %lx\n", hwnd, client_window ); +} + + /********************************************************************** * create_dummy_client_window */ @@ -1746,7 +1766,7 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo data->window_rect = data->whole_rect = data->client_rect; } - detach_client_window( data, data->client_window ); + detach_client_window( data, data->client_window, TRUE ); attr.colormap = colormap; attr.bit_gravity = NorthWestGravity; @@ -1879,7 +1899,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des } else { - if (!already_destroyed) detach_client_window( data, data->client_window ); + if (!already_destroyed) detach_client_window( data, data->client_window, TRUE ); XDeleteContext( data->display, data->whole_window, winContext ); if (!already_destroyed) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index d446a1c6e51..a3878088daa 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -667,6 +667,7 @@ extern void update_net_wm_states( struct x11drv_win_data *data ); extern void make_window_embedded( struct x11drv_win_data *data ); extern Window create_dummy_client_window(void); extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); +extern void destroy_client_window( HWND hwnd, Window client_window ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void change_systray_owner( Display *display, Window systray_window ); extern HWND create_foreign_window( Display *display, Window window ); From bb8e5c8df72562b0e1e07d461b4160b4ef12bc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 17:29:36 +0100 Subject: [PATCH 0181/1506] winex11: Always use detach_client_window in destroy_whole_window. --- dlls/winex11.drv/window.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e07cebcade6..2fe824c66aa 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1881,7 +1881,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des { TRACE( "win %p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); - if (data->client_window) XDeleteContext( data->display, data->client_window, winContext ); + detach_client_window( data, data->client_window, !already_destroyed ); if (!data->whole_window) { @@ -1899,7 +1899,6 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des } else { - if (!already_destroyed) detach_client_window( data, data->client_window, TRUE ); XDeleteContext( data->display, data->whole_window, winContext ); if (!already_destroyed) { @@ -1908,7 +1907,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des } } if (data->whole_colormap) XFreeColormap( data->display, data->whole_colormap ); - data->whole_window = data->client_window = 0; + data->whole_window = 0; data->whole_colormap = 0; data->wm_state = WithdrawnState; data->net_wm_state = 0; From 3a688408a5eda8aec354510587ef838c5ddedcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 17:29:36 +0100 Subject: [PATCH 0182/1506] winex11: Introduce a new attach_client_window helper. --- dlls/winex11.drv/window.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 2fe824c66aa..8430c08f712 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1707,6 +1707,27 @@ static void detach_client_window( struct x11drv_win_data *data, Window client_wi } +/********************************************************************** + * attach_client_window + */ +static void attach_client_window( struct x11drv_win_data *data, Window client_window ) +{ + if (data->client_window == client_window || !client_window) return; + detach_client_window( data, data->client_window, TRUE ); + data->client_window = client_window; + + if (!data->whole_window) return; + + XSaveContext( data->display, client_window, winContext, (char *)data->hwnd ); + XSelectInput( data->display, client_window, ExposureMask ); + XFlush( data->display ); /* make sure XSelectInput is enabled for client_window after this point */ + + XReparentWindow( gdi_display, client_window, data->whole_window, data->client_rect.left - data->whole_rect.left, + data->client_rect.top - data->whole_rect.top ); + TRACE( "%p/%lx attached client window %lx\n", data->hwnd, data->whole_window, client_window ); +} + + /********************************************************************** * destroy_client_window */ @@ -1934,7 +1955,6 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ) { Window client_window = data->client_window; - Window whole_window = data->whole_window; if (!data->use_alpha == !use_alpha) return; if (data->surface) window_surface_release( data->surface ); @@ -1942,18 +1962,14 @@ void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BO data->use_alpha = use_alpha; if (data->vis.visualid == vis->visualid) return; - data->client_window = 0; - destroy_whole_window( data, client_window != 0 /* don't destroy whole_window until reparented */ ); + client_window = data->client_window; + /* detach the client before re-creating whole_window */ + detach_client_window( data, client_window, TRUE ); + destroy_whole_window( data, FALSE ); data->vis = *vis; create_whole_window( data ); - if (!client_window) return; - /* move the client to the new parent */ - XReparentWindow( gdi_display, client_window, data->whole_window, - data->client_rect.left - data->whole_rect.left, - data->client_rect.top - data->whole_rect.top ); - data->client_window = client_window; - XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before destroying whole_window */ - XDestroyWindow( data->display, whole_window ); + /* attach the client back to the re-created whole_window */ + attach_client_window( data, client_window ); } From a092ebbd0e4501de45778f20af6b298401aec944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 17:29:36 +0100 Subject: [PATCH 0183/1506] winex11: Attach client windows after their creation. We still create them with whole_window parent when it exists as otherwise Steam Overlay will completely mess up later on. CW-Bug-Id: #23195 --- dlls/winex11.drv/window.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 8430c08f712..f7b560fd0ca 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1771,10 +1771,10 @@ Window create_dummy_client_window(void) */ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ) { - Window dummy_parent = get_dummy_parent(); struct x11drv_win_data *data = get_win_data( hwnd ); + Window parent_window, client_window; XSetWindowAttributes attr; - Window ret; + unsigned int attr_mask; int x, y, cx, cy; if (!data) @@ -1787,38 +1787,35 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo data->window_rect = data->whole_rect = data->client_rect; } - detach_client_window( data, data->client_window, TRUE ); - attr.colormap = colormap; attr.bit_gravity = NorthWestGravity; attr.win_gravity = NorthWestGravity; attr.backing_store = NotUseful; attr.border_pixel = 0; + attr_mask = CWColormap | CWBitGravity | CWWinGravity | CWBackingStore | CWBorderPixel; x = data->client_rect.left - data->whole_rect.left; y = data->client_rect.top - data->whole_rect.top; cx = min( max( 1, data->client_rect.right - data->client_rect.left ), 65535 ); cy = min( max( 1, data->client_rect.bottom - data->client_rect.top ), 65535 ); - ret = data->client_window = XCreateWindow( gdi_display, - data->whole_window ? data->whole_window : dummy_parent, - x, y, cx, cy, 0, default_visual.depth, InputOutput, - visual->visual, CWBitGravity | CWWinGravity | - CWBackingStore | CWColormap | CWBorderPixel, &attr ); - if (data->client_window) + /* NOTE: Creating the client windows as child of dummy parent has bad interactions with + * Steam Overlay and will cause whole_window to minimize when the overlay opens... */ + parent_window = data->whole_window ? data->whole_window : get_dummy_parent(); + if ((client_window = XCreateWindow( gdi_display, parent_window, x, y, cx, cy, 0, default_visual.depth, + InputOutput, visual->visual, attr_mask, &attr ))) { - XSaveContext( data->display, data->client_window, winContext, (char *)data->hwnd ); + XFlush( gdi_display ); /* make sure client_window is created for XSelectInput */ + XSync( data->display, False ); /* make sure client_window is known from data->display */ + + attach_client_window( data, client_window ); XMapWindow( gdi_display, data->client_window ); - if (data->whole_window) - { - XFlush( gdi_display ); /* make sure client_window is created for XSelectInput */ - XSync( data->display, False ); /* make sure client_window is known from data->display */ - XSelectInput( data->display, data->client_window, ExposureMask ); - } + TRACE( "%p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); } + release_win_data( data ); - return ret; + return client_window; } From 6701fd90d81b2c46c81aadc3ed9675313c6ac041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 24 Nov 2023 11:09:02 +0100 Subject: [PATCH 0184/1506] winex11: Add traces to vulkan surface grab / release. --- dlls/winex11.drv/vulkan.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 0c888da622b..28897d3ab69 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -200,16 +200,18 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo return VK_SUCCESS; } -static struct wine_vk_surface *wine_vk_surface_grab(struct wine_vk_surface *surface) +static struct wine_vk_surface *wine_vk_surface_grab( struct wine_vk_surface *surface ) { - InterlockedIncrement(&surface->ref); + int refcount = InterlockedIncrement( &surface->ref ); + TRACE( "surface %p, refcount %d.\n", surface, refcount ); return surface; } -static void wine_vk_surface_release(struct wine_vk_surface *surface) +static void wine_vk_surface_release( struct wine_vk_surface *surface ) { - if (InterlockedDecrement(&surface->ref)) - return; + int refcount = InterlockedDecrement( &surface->ref ); + TRACE( "surface %p, refcount %d.\n", surface, refcount ); + if (refcount) return; if (surface->entry.next) { From a795dc6afa5edb63f5162658dc65105be0334b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 28 Nov 2023 11:36:03 +0100 Subject: [PATCH 0185/1506] winex11: Get rid of ref held from the HWND to its Vk surface. --- dlls/winex11.drv/vulkan.c | 32 ++++++++------------------------ dlls/winex11.drv/window.c | 2 +- dlls/winex11.drv/x11drv.h | 2 +- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 28897d3ab69..c84a2d32a04 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -49,8 +49,6 @@ WINE_DECLARE_DEBUG_CHANNEL(fps); static pthread_mutex_t vulkan_mutex; -static XContext vulkan_hwnd_context; - #define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000 static struct list surface_list = LIST_INIT( surface_list ); @@ -140,7 +138,6 @@ static void wine_vk_init(void) #undef LOAD_FUNCPTR #undef LOAD_OPTIONAL_FUNCPTR - vulkan_hwnd_context = XUniqueContext(); return; fail: @@ -200,13 +197,6 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo return VK_SUCCESS; } -static struct wine_vk_surface *wine_vk_surface_grab( struct wine_vk_surface *surface ) -{ - int refcount = InterlockedIncrement( &surface->ref ); - TRACE( "surface %p, refcount %d.\n", surface, refcount ); - return surface; -} - static void wine_vk_surface_release( struct wine_vk_surface *surface ) { int refcount = InterlockedDecrement( &surface->ref ); @@ -224,18 +214,18 @@ static void wine_vk_surface_release( struct wine_vk_surface *surface ) free(surface); } -void wine_vk_surface_destroy(HWND hwnd) +void destroy_vk_surface( HWND hwnd ) { - struct wine_vk_surface *surface; - pthread_mutex_lock(&vulkan_mutex); - if (!XFindContext(gdi_display, (XID)hwnd, vulkan_hwnd_context, (char **)&surface)) + struct wine_vk_surface *surface, *next; + + pthread_mutex_lock( &vulkan_mutex ); + LIST_FOR_EACH_ENTRY_SAFE( surface, next, &surface_list, struct wine_vk_surface, entry ) { + if (surface->hwnd != hwnd) continue; surface->hwnd_thread_id = 0; surface->hwnd = NULL; - wine_vk_surface_release(surface); } - XDeleteContext(gdi_display, (XID)hwnd, vulkan_hwnd_context); - pthread_mutex_unlock(&vulkan_mutex); + pthread_mutex_unlock( &vulkan_mutex ); } void vulkan_thread_detach(void) @@ -252,7 +242,6 @@ void vulkan_thread_detach(void) TRACE("Detaching surface %p, hwnd %p.\n", surface, surface->hwnd); XReparentWindow(gdi_display, surface->window, get_dummy_parent(), 0, 0); XSync(gdi_display, False); - wine_vk_surface_destroy(surface->hwnd); } pthread_mutex_unlock(&vulkan_mutex); } @@ -377,11 +366,6 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, } pthread_mutex_lock(&vulkan_mutex); - if (x11_surface->hwnd) - { - wine_vk_surface_destroy( x11_surface->hwnd ); - XSaveContext(gdi_display, (XID)create_info->hwnd, vulkan_hwnd_context, (char *)wine_vk_surface_grab(x11_surface)); - } list_add_tail(&surface_list, &x11_surface->entry); pthread_mutex_unlock(&vulkan_mutex); @@ -758,7 +742,7 @@ const struct vulkan_funcs *get_vulkan_driver(UINT version) return NULL; } -void wine_vk_surface_destroy(HWND hwnd) +void destroy_vk_surface( HWND hwnd ) { } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f7b560fd0ca..87be315f097 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2033,7 +2033,7 @@ void X11DRV_DestroyWindow( HWND hwnd ) release_win_data( data ); free( data ); destroy_gl_drawable( hwnd ); - wine_vk_surface_destroy( hwnd ); + destroy_vk_surface( hwnd ); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a3878088daa..d6f35c82dd1 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -656,7 +656,7 @@ extern Window get_dummy_parent(void); extern void sync_gl_drawable( HWND hwnd, BOOL known_child ); extern void set_gl_drawable_parent( HWND hwnd, HWND parent ); extern void destroy_gl_drawable( HWND hwnd ); -extern void wine_vk_surface_destroy( HWND hwnd ); +extern void destroy_vk_surface( HWND hwnd ); extern void vulkan_thread_detach(void); extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ); From 778aa200fca5196dd1ac7c512326e76e7ee5290b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 28 Nov 2023 11:36:03 +0100 Subject: [PATCH 0186/1506] winex11: Detach the vulkan surfaces when HWND is destroyed. --- dlls/winex11.drv/vulkan.c | 27 +++++++++++++++++++-------- dlls/winex11.drv/window.c | 2 +- dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index c84a2d32a04..72a89010407 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -214,6 +214,22 @@ static void wine_vk_surface_release( struct wine_vk_surface *surface ) free(surface); } +static void wine_vk_surface_detach( struct wine_vk_surface *surface ) +{ + struct x11drv_win_data *data; + + TRACE( "Detaching surface %p, hwnd %p.\n", surface, surface->hwnd ); + + if ((data = get_win_data( surface->hwnd ))) + { + detach_client_window( data, surface->window, TRUE ); + release_win_data( data ); + } + + surface->hwnd_thread_id = 0; + surface->hwnd = NULL; +} + void destroy_vk_surface( HWND hwnd ) { struct wine_vk_surface *surface, *next; @@ -222,8 +238,7 @@ void destroy_vk_surface( HWND hwnd ) LIST_FOR_EACH_ENTRY_SAFE( surface, next, &surface_list, struct wine_vk_surface, entry ) { if (surface->hwnd != hwnd) continue; - surface->hwnd_thread_id = 0; - surface->hwnd = NULL; + wine_vk_surface_detach( surface ); } pthread_mutex_unlock( &vulkan_mutex ); } @@ -236,12 +251,8 @@ void vulkan_thread_detach(void) pthread_mutex_lock(&vulkan_mutex); LIST_FOR_EACH_ENTRY_SAFE(surface, next, &surface_list, struct wine_vk_surface, entry) { - if (surface->hwnd_thread_id != thread_id) - continue; - - TRACE("Detaching surface %p, hwnd %p.\n", surface, surface->hwnd); - XReparentWindow(gdi_display, surface->window, get_dummy_parent(), 0, 0); - XSync(gdi_display, False); + if (surface->hwnd_thread_id != thread_id) continue; + wine_vk_surface_detach( surface ); } pthread_mutex_unlock(&vulkan_mutex); } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 87be315f097..f09da296b6a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1691,7 +1691,7 @@ Window get_dummy_parent(void) /********************************************************************** * detach_client_window */ -static void detach_client_window( struct x11drv_win_data *data, Window client_window, BOOL reparent ) +void detach_client_window( struct x11drv_win_data *data, Window client_window, BOOL reparent ) { if (data->client_window != client_window || !client_window) return; data->client_window = 0; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index d6f35c82dd1..95b30a7e2af 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -668,6 +668,7 @@ extern void make_window_embedded( struct x11drv_win_data *data ); extern Window create_dummy_client_window(void); extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); extern void destroy_client_window( HWND hwnd, Window client_window ); +extern void detach_client_window( struct x11drv_win_data *data, Window client_window, BOOL reparent ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void change_systray_owner( Display *display, Window systray_window ); extern HWND create_foreign_window( Display *display, Window window ); From 536dbff65275aa901aefc51de701a53fe77278a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 22 Apr 2021 23:38:16 +0200 Subject: [PATCH 0187/1506] winex11: Re-attach vulkan surfaces when images are acquired. --- dlls/winex11.drv/vulkan.c | 41 ++++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/window.c | 2 +- dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 72a89010407..6b3a197372b 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -49,6 +49,8 @@ WINE_DECLARE_DEBUG_CHANNEL(fps); static pthread_mutex_t vulkan_mutex; +static XContext swapchain_context; + #define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000 static struct list surface_list = LIST_INIT( surface_list ); @@ -138,6 +140,7 @@ static void wine_vk_init(void) #undef LOAD_FUNCPTR #undef LOAD_OPTIONAL_FUNCPTR + swapchain_context = XUniqueContext(); return; fail: @@ -197,6 +200,13 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo return VK_SUCCESS; } +static struct wine_vk_surface *wine_vk_surface_grab( struct wine_vk_surface *surface ) +{ + int refcount = InterlockedIncrement( &surface->ref ); + TRACE( "surface %p, refcount %d.\n", surface, refcount ); + return surface; +} + static void wine_vk_surface_release( struct wine_vk_surface *surface ) { int refcount = InterlockedDecrement( &surface->ref ); @@ -304,6 +314,8 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, { struct wine_vk_surface *x11_surface = surface_from_handle(create_info->surface); VkSwapchainCreateInfoKHR create_info_host; + VkResult result; + TRACE("%p %p %p %p\n", device, create_info, allocator, swapchain); if (allocator) @@ -315,7 +327,14 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, create_info_host = *create_info; create_info_host.surface = x11_surface->host_surface; - return pvkCreateSwapchainKHR(device, &create_info_host, NULL /* allocator */, swapchain); + if ((result = pvkCreateSwapchainKHR( device, &create_info_host, NULL /* allocator */, + swapchain )) == VK_SUCCESS) + { + XSaveContext( gdi_display, (XID)(*swapchain), swapchain_context, + (char *)wine_vk_surface_grab( x11_surface ) ); + } + + return result; } static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, @@ -422,12 +441,17 @@ static void X11DRV_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *allocator) { + struct wine_vk_surface *surface; + TRACE("%p, 0x%s %p\n", device, wine_dbgstr_longlong(swapchain), allocator); if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); pvkDestroySwapchainKHR(device, swapchain, NULL /* allocator */); + + if (!XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface )) + wine_vk_surface_release( surface ); } static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name, @@ -654,9 +678,24 @@ static VkResult X11DRV_vkGetSwapchainImagesKHR(VkDevice device, static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *present_info) { VkResult res; + UINT i; TRACE("%p, %p\n", queue, present_info); + for (i = 0; i < present_info->swapchainCount; i++) + { + VkSwapchainKHR swapchain = present_info->pSwapchains[i]; + struct wine_vk_surface *surface; + struct x11drv_win_data *data; + + if (!XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface ) && + (data = get_win_data( surface->hwnd ))) + { + attach_client_window( data, surface->window ); + release_win_data( data ); + } + } + res = pvkQueuePresentKHR(queue, present_info); if (TRACE_ON(fps)) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f09da296b6a..3ce597f95e8 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1710,7 +1710,7 @@ void detach_client_window( struct x11drv_win_data *data, Window client_window, B /********************************************************************** * attach_client_window */ -static void attach_client_window( struct x11drv_win_data *data, Window client_window ) +void attach_client_window( struct x11drv_win_data *data, Window client_window ) { if (data->client_window == client_window || !client_window) return; detach_client_window( data, data->client_window, TRUE ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 95b30a7e2af..8da58645438 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -669,6 +669,7 @@ extern Window create_dummy_client_window(void); extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); extern void destroy_client_window( HWND hwnd, Window client_window ); extern void detach_client_window( struct x11drv_win_data *data, Window client_window, BOOL reparent ); +extern void attach_client_window( struct x11drv_win_data *data, Window client_window ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void change_systray_owner( Display *display, Window systray_window ); extern HWND create_foreign_window( Display *display, Window window ); From 8047d3f145040bea985d2a22fcb79e1c883a0753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 28 Nov 2023 11:52:25 +0100 Subject: [PATCH 0188/1506] winex11: Resize detached vulkan surfaces when HWND is resized. --- dlls/winex11.drv/vulkan.c | 18 ++++++++++++++++++ dlls/winex11.drv/window.c | 1 + dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 20 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 6b3a197372b..236cf1f8663 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -253,6 +253,20 @@ void destroy_vk_surface( HWND hwnd ) pthread_mutex_unlock( &vulkan_mutex ); } +void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ) +{ + struct wine_vk_surface *surface; + + pthread_mutex_lock( &vulkan_mutex ); + LIST_FOR_EACH_ENTRY( surface, &surface_list, struct wine_vk_surface, entry ) + { + if (surface->hwnd != hwnd) continue; + if (!surface->window || surface->window == active) continue; + XConfigureWindow( gdi_display, surface->window, mask, changes ); + } + pthread_mutex_unlock( &vulkan_mutex ); +} + void vulkan_thread_detach(void) { struct wine_vk_surface *surface, *next; @@ -796,6 +810,10 @@ void destroy_vk_surface( HWND hwnd ) { } +void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ) +{ +} + void vulkan_thread_detach(void) { } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 3ce597f95e8..6d5d5b52846 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1571,6 +1571,7 @@ static void sync_client_position( struct x11drv_win_data *data, TRACE( "setting client win %lx pos %d,%d,%dx%d changes=%x\n", data->client_window, changes.x, changes.y, changes.width, changes.height, mask ); XConfigureWindow( gdi_display, data->client_window, mask, &changes ); + resize_vk_surfaces( data->hwnd, data->client_window, mask, &changes ); } } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8da58645438..a90c2c78e4c 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -657,6 +657,7 @@ extern void sync_gl_drawable( HWND hwnd, BOOL known_child ); extern void set_gl_drawable_parent( HWND hwnd, HWND parent ); extern void destroy_gl_drawable( HWND hwnd ); extern void destroy_vk_surface( HWND hwnd ); +extern void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ); extern void vulkan_thread_detach(void); extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ); From 70c2871710a6d5667cee64c1417f8700f392a22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 22 Oct 2021 00:23:49 +0200 Subject: [PATCH 0189/1506] winex11: Rename X11DRV_FLUSH_GL_DRAWABLE to X11DRV_PRESENT_DRAWABLE. --- dlls/winex11.drv/init.c | 8 ++++---- dlls/winex11.drv/opengl.c | 40 +++++++++++++++++++-------------------- dlls/winex11.drv/x11drv.h | 8 ++++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 2cef05d2140..a7758346b29 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -243,16 +243,16 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d return TRUE; } break; - case X11DRV_FLUSH_GL_DRAWABLE: - if (in_count >= sizeof(struct x11drv_escape_flush_gl_drawable)) + case X11DRV_PRESENT_DRAWABLE: + if (in_count >= sizeof(struct x11drv_escape_present_drawable)) { - const struct x11drv_escape_flush_gl_drawable *data = in_data; + const struct x11drv_escape_present_drawable *data = in_data; RECT rect = physDev->dc_rect; OffsetRect( &rect, -physDev->dc_rect.left, -physDev->dc_rect.top ); if (data->flush) XFlush( gdi_display ); XSetFunction( gdi_display, physDev->gc, GXcopy ); - XCopyArea( gdi_display, data->gl_drawable, physDev->drawable, physDev->gc, + XCopyArea( gdi_display, data->drawable, physDev->drawable, physDev->gc, 0, 0, rect.right, rect.bottom, physDev->dc_rect.left, physDev->dc_rect.top ); add_device_bounds( physDev, &rect ); diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 4a02f829c31..01883ecff94 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1990,20 +1990,20 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de static void wglFinish(void) { - struct x11drv_escape_flush_gl_drawable escape; + struct x11drv_escape_present_drawable escape; struct gl_drawable *gl; struct wgl_context *ctx = NtCurrentTeb()->glContext; - escape.code = X11DRV_FLUSH_GL_DRAWABLE; - escape.gl_drawable = 0; + escape.code = X11DRV_PRESENT_DRAWABLE; + escape.drawable = 0; escape.flush = FALSE; if ((gl = get_gl_drawable( NtUserWindowFromDC( ctx->hdc ), 0 ))) { switch (gl->type) { - case DC_GL_PIXMAP_WIN: escape.gl_drawable = gl->pixmap; break; - case DC_GL_CHILD_WIN: escape.gl_drawable = gl->window; break; + case DC_GL_PIXMAP_WIN: escape.drawable = gl->pixmap; break; + case DC_GL_CHILD_WIN: escape.drawable = gl->window; break; default: break; } sync_context(ctx); @@ -2011,26 +2011,26 @@ static void wglFinish(void) } pglFinish(); - if (escape.gl_drawable) + if (escape.drawable) NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); } static void wglFlush(void) { - struct x11drv_escape_flush_gl_drawable escape; + struct x11drv_escape_present_drawable escape; struct gl_drawable *gl; struct wgl_context *ctx = NtCurrentTeb()->glContext; - escape.code = X11DRV_FLUSH_GL_DRAWABLE; - escape.gl_drawable = 0; + escape.code = X11DRV_PRESENT_DRAWABLE; + escape.drawable = 0; escape.flush = FALSE; if ((gl = get_gl_drawable( NtUserWindowFromDC( ctx->hdc ), 0 ))) { switch (gl->type) { - case DC_GL_PIXMAP_WIN: escape.gl_drawable = gl->pixmap; break; - case DC_GL_CHILD_WIN: escape.gl_drawable = gl->window; break; + case DC_GL_PIXMAP_WIN: escape.drawable = gl->pixmap; break; + case DC_GL_CHILD_WIN: escape.drawable = gl->window; break; default: break; } sync_context(ctx); @@ -2038,7 +2038,7 @@ static void wglFlush(void) } pglFlush(); - if (escape.gl_drawable) + if (escape.drawable) NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); } @@ -3358,15 +3358,15 @@ static void X11DRV_WineGL_LoadExtensions(void) */ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) { - struct x11drv_escape_flush_gl_drawable escape; + struct x11drv_escape_present_drawable escape; struct gl_drawable *gl; struct wgl_context *ctx = NtCurrentTeb()->glContext; INT64 ust, msc, sbc, target_sbc = 0; TRACE("(%p)\n", hdc); - escape.code = X11DRV_FLUSH_GL_DRAWABLE; - escape.gl_drawable = 0; + escape.code = X11DRV_PRESENT_DRAWABLE; + escape.drawable = 0; escape.flush = !pglXWaitForSbcOML; if (!(gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc ))) @@ -3387,7 +3387,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) { case DC_GL_PIXMAP_WIN: if (ctx) sync_context( ctx ); - escape.gl_drawable = gl->pixmap; + escape.drawable = gl->pixmap; if (pglXCopySubBufferMESA) { /* (glX)SwapBuffers has an implicit glFlush effect, however * GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before @@ -3408,10 +3408,10 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) case DC_GL_WINDOW: case DC_GL_CHILD_WIN: if (ctx) sync_context( ctx ); - if (gl->type == DC_GL_CHILD_WIN) escape.gl_drawable = gl->window; + if (gl->type == DC_GL_CHILD_WIN) escape.drawable = gl->window; /* fall through */ default: - if (escape.gl_drawable && pglXSwapBuffersMscOML) + if (escape.drawable && pglXSwapBuffersMscOML) { pglFlush(); target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); @@ -3421,12 +3421,12 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) break; } - if (escape.gl_drawable && pglXWaitForSbcOML) + if (escape.drawable && pglXWaitForSbcOML) pglXWaitForSbcOML( gdi_display, gl->drawable, target_sbc, &ust, &msc, &sbc ); release_gl_drawable( gl ); - if (escape.gl_drawable) + if (escape.drawable) NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); return TRUE; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a90c2c78e4c..b87164a5884 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -350,7 +350,7 @@ enum x11drv_escape_codes X11DRV_GET_DRAWABLE, /* get current drawable for a DC */ X11DRV_START_EXPOSURES, /* start graphics exposures */ X11DRV_END_EXPOSURES, /* end graphics exposures */ - X11DRV_FLUSH_GL_DRAWABLE /* flush changes made to the gl drawable */ + X11DRV_PRESENT_DRAWABLE, /* present the drawable on screen */ }; struct x11drv_escape_set_drawable @@ -369,10 +369,10 @@ struct x11drv_escape_get_drawable int pixel_format; /* internal GL pixel format */ }; -struct x11drv_escape_flush_gl_drawable +struct x11drv_escape_present_drawable { - enum x11drv_escape_codes code; /* escape code (X11DRV_FLUSH_GL_DRAWABLE) */ - Drawable gl_drawable; /* GL drawable */ + enum x11drv_escape_codes code; /* escape code (X11DRV_PRESENT_DRAWABLE) */ + Drawable drawable; /* GL / VK drawable */ BOOL flush; /* flush X11 before copying */ }; From a15f9ba345c39c47a106b483bf2c186d6f05efbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Nov 2023 17:57:31 +0100 Subject: [PATCH 0190/1506] winex11: Implement vulkan child windows offscreen rendering. --- dlls/winevulkan/make_vulkan | 2 + dlls/winex11.drv/vulkan.c | 107 +++++++++++++++++++++++++++++++++--- dlls/winex11.drv/window.c | 19 +++++++ dlls/winex11.drv/x11drv.h | 1 + 4 files changed, 122 insertions(+), 7 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index cfb71f8bec7..fc7a822c0e6 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -194,6 +194,8 @@ FUNCTION_OVERRIDES = { # functions for which a user driver entry must be generated USER_DRIVER_FUNCS = { + "vkAcquireNextImage2KHR", + "vkAcquireNextImageKHR", "vkCreateInstance", "vkCreateSwapchainKHR", "vkCreateWin32SurfaceKHR", diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 236cf1f8663..23a6f9c3d23 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -35,6 +35,7 @@ #include "wine/debug.h" #include "x11drv.h" +#include "xcomposite.h" #define VK_NO_PROTOTYPES #define WINE_VK_HOST @@ -63,6 +64,7 @@ struct wine_vk_surface VkSurfaceKHR host_surface; HWND hwnd; DWORD hwnd_thread_id; + BOOL offscreen; /* drawable is offscreen */ }; typedef struct VkXlibSurfaceCreateInfoKHR @@ -74,6 +76,7 @@ typedef struct VkXlibSurfaceCreateInfoKHR Window window; } VkXlibSurfaceCreateInfoKHR; +static VkResult (*pvkAcquireNextImageKHR)(VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence, uint32_t *); static VkResult (*pvkCreateInstance)(const VkInstanceCreateInfo *, const VkAllocationCallbacks *, VkInstance *); static VkResult (*pvkCreateSwapchainKHR)(VkDevice, const VkSwapchainCreateInfoKHR *, const VkAllocationCallbacks *, VkSwapchainKHR *); static VkResult (*pvkCreateXlibSurfaceKHR)(VkInstance, const VkXlibSurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); @@ -117,6 +120,7 @@ static void wine_vk_init(void) #define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) goto fail #define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(vulkan_handle, #f) + LOAD_FUNCPTR(vkAcquireNextImageKHR); LOAD_FUNCPTR(vkCreateInstance); LOAD_FUNCPTR(vkCreateSwapchainKHR); LOAD_FUNCPTR(vkCreateXlibSurfaceKHR); @@ -253,6 +257,31 @@ void destroy_vk_surface( HWND hwnd ) pthread_mutex_unlock( &vulkan_mutex ); } +static BOOL wine_vk_surface_set_offscreen( struct wine_vk_surface *surface, BOOL offscreen ) +{ +#ifdef SONAME_LIBXCOMPOSITE + if (usexcomposite) + { + if (!surface->offscreen && offscreen) + { + FIXME( "Redirecting vulkan surface %lx offscreen, expect degraded performance.\n", surface->window ); + pXCompositeRedirectWindow( gdi_display, surface->window, CompositeRedirectManual ); + } + else if (surface->offscreen && !offscreen) + { + FIXME( "Putting vulkan surface %lx back onscreen, expect standard performance.\n", surface->window ); + pXCompositeUnredirectWindow( gdi_display, surface->window, CompositeRedirectManual ); + } + surface->offscreen = offscreen; + return TRUE; + } +#endif + + if (offscreen) FIXME( "Application requires child window rendering, which is not implemented yet!\n" ); + surface->offscreen = offscreen; + return !offscreen; +} + void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ) { struct wine_vk_surface *surface; @@ -267,6 +296,19 @@ void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *cha pthread_mutex_unlock( &vulkan_mutex ); } +void sync_vk_surface( HWND hwnd, BOOL known_child ) +{ + struct wine_vk_surface *surface; + + pthread_mutex_lock( &vulkan_mutex ); + LIST_FOR_EACH_ENTRY( surface, &surface_list, struct wine_vk_surface, entry ) + { + if (surface->hwnd != hwnd) continue; + wine_vk_surface_set_offscreen( surface, known_child ); + } + pthread_mutex_unlock( &vulkan_mutex ); +} + void vulkan_thread_detach(void) { struct wine_vk_surface *surface, *next; @@ -364,13 +406,6 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); - /* TODO: support child window rendering. */ - if (create_info->hwnd && NtUserGetAncestor(create_info->hwnd, GA_PARENT) != NtUserGetDesktopWindow()) - { - FIXME("Application requires child window rendering, which is not implemented yet!\n"); - return VK_ERROR_INCOMPATIBLE_DRIVER; - } - x11_surface = calloc(1, sizeof(*x11_surface)); if (!x11_surface) return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -396,6 +431,18 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, goto err; } + if (NtUserGetAncestor( create_info->hwnd, GA_PARENT ) != NtUserGetDesktopWindow() || + NtUserGetWindowRelative( create_info->hwnd, GW_CHILD )) + { + TRACE( "hwnd %p creating offscreen child window surface\n", x11_surface->hwnd ); + + if (!wine_vk_surface_set_offscreen( x11_surface, TRUE )) + { + res = VK_ERROR_INCOMPATIBLE_DRIVER; + goto err; + } + } + create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; create_info_host.pNext = NULL; create_info_host.flags = 0; /* reserved */ @@ -689,6 +736,46 @@ static VkResult X11DRV_vkGetSwapchainImagesKHR(VkDevice device, return pvkGetSwapchainImagesKHR(device, swapchain, count, images); } +static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, + VkSemaphore semaphore, VkFence fence, uint32_t *image_index ) +{ + struct wine_vk_surface *surface; + VkResult result; + HDC hdc = 0; + + if (XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface )) + return VK_ERROR_SURFACE_LOST_KHR; + + result = pvkAcquireNextImageKHR( device, swapchain, timeout, semaphore, fence, image_index ); + + if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) && surface->offscreen) + hdc = NtUserGetDCEx( surface->hwnd, 0, DCX_USESTYLE | DCX_CACHE ); + + if (hdc) + { + struct x11drv_escape_present_drawable escape = + { + .code = X11DRV_PRESENT_DRAWABLE, + .drawable = surface->window, + .flush = TRUE, + }; + + NtGdiExtEscape( hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (char *)&escape, 0, NULL ); + NtUserReleaseDC( surface->hwnd, hdc ); + } + + return result; +} + +static VkResult X11DRV_vkAcquireNextImage2KHR( VkDevice device, const VkAcquireNextImageInfoKHR *acquire_info, + uint32_t *image_index ) +{ + static int once; + if (!once++) FIXME( "Emulating vkAcquireNextImage2KHR, ignoring pNext.\n" ); + return X11DRV_vkAcquireNextImageKHR( device, acquire_info->swapchain, acquire_info->timeout, + acquire_info->semaphore, acquire_info->fence, image_index ); +} + static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *present_info) { VkResult res; @@ -747,6 +834,8 @@ static VkSurfaceKHR X11DRV_wine_get_host_surface( VkSurfaceKHR surface ) static const struct vulkan_funcs vulkan_funcs = { + X11DRV_vkAcquireNextImage2KHR, + X11DRV_vkAcquireNextImageKHR, X11DRV_vkCreateInstance, X11DRV_vkCreateSwapchainKHR, X11DRV_vkCreateWin32SurfaceKHR, @@ -814,6 +903,10 @@ void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *cha { } +void sync_vk_surface( HWND hwnd, BOOL known_child ) +{ +} + void vulkan_thread_detach(void) { } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 6d5d5b52846..35e702a191a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1995,6 +1995,17 @@ void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) { struct x11drv_win_data *data; DWORD changed = style->styleNew ^ style->styleOld; + HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); + + if (offset == GWL_STYLE && (changed & WS_CHILD)) + { + if (NtUserGetWindowRelative( parent, GW_CHILD ) || + NtUserGetAncestor( parent, GA_PARENT ) != NtUserGetDesktopWindow()) + sync_vk_surface( parent, TRUE ); + else + sync_vk_surface( parent, FALSE ); + sync_vk_surface( hwnd, style->styleNew & WS_CHILD ); + } if (hwnd == NtUserGetDesktopWindow()) return; if (!(data = get_win_data( hwnd ))) return; @@ -2021,6 +2032,11 @@ void X11DRV_DestroyWindow( HWND hwnd ) { struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_win_data *data; + HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); + + if (!NtUserGetWindowRelative( parent, GW_CHILD ) && + NtUserGetAncestor( parent, GA_PARENT ) == NtUserGetDesktopWindow()) + sync_vk_surface( parent, FALSE ); if (!(data = get_win_data( hwnd ))) return; @@ -2255,6 +2271,7 @@ static struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd, const RECT *wi * that will need clipping support. */ sync_gl_drawable( parent, TRUE ); + sync_vk_surface( parent, TRUE ); display = thread_init_display(); init_clip_window(); /* make sure the clip window is initialized in this thread */ @@ -2670,6 +2687,7 @@ void X11DRV_SetParent( HWND hwnd, HWND parent, HWND old_parent ) destroy_whole_window( data, FALSE ); data->managed = FALSE; } + sync_vk_surface( hwnd, TRUE ); } else /* new top level window */ { @@ -2683,6 +2701,7 @@ void X11DRV_SetParent( HWND hwnd, HWND parent, HWND old_parent ) * that will need clipping support. */ sync_gl_drawable( parent, TRUE ); + sync_vk_surface( parent, TRUE ); fetch_icon_data( hwnd, 0, 0 ); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index b87164a5884..88d48437517 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -657,6 +657,7 @@ extern void sync_gl_drawable( HWND hwnd, BOOL known_child ); extern void set_gl_drawable_parent( HWND hwnd, HWND parent ); extern void destroy_gl_drawable( HWND hwnd ); extern void destroy_vk_surface( HWND hwnd ); +extern void sync_vk_surface( HWND hwnd, BOOL known_child ); extern void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ); extern void vulkan_thread_detach(void); From c3ee88913b59384dbdf172210fc232269fcf1df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 28 Nov 2023 11:52:25 +0100 Subject: [PATCH 0191/1506] winex11: Use a fence to synchronize vulkan child window blit. --- dlls/winex11.drv/vulkan.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 23a6f9c3d23..2badb1e38f3 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -65,6 +65,7 @@ struct wine_vk_surface HWND hwnd; DWORD hwnd_thread_id; BOOL offscreen; /* drawable is offscreen */ + VkPresentModeKHR present_mode; }; typedef struct VkXlibSurfaceCreateInfoKHR @@ -97,6 +98,9 @@ static VkResult (*pvkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint3 static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice, uint32_t, Display *, VisualID); static VkResult (*pvkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *); static VkResult (*pvkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); +static VkResult (*pvkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout); +static VkResult (*pvkCreateFence)(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence); +static void (*pvkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator); static void *X11DRV_get_vk_device_proc_addr(const char *name); static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *name); @@ -141,6 +145,9 @@ static void wine_vk_init(void) LOAD_FUNCPTR(vkQueuePresentKHR); LOAD_OPTIONAL_FUNCPTR(vkGetDeviceGroupSurfacePresentModesKHR); LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDevicePresentRectanglesKHR); + LOAD_FUNCPTR(vkWaitForFences); + LOAD_FUNCPTR(vkCreateFence); + LOAD_FUNCPTR(vkDestroyFence); #undef LOAD_FUNCPTR #undef LOAD_OPTIONAL_FUNCPTR @@ -383,6 +390,11 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, create_info_host = *create_info; create_info_host.surface = x11_surface->host_surface; + /* force fifo when running offscreen so the acquire fence is more likely to be vsynced */ + if (x11_surface->offscreen && create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR) + create_info_host.presentMode = VK_PRESENT_MODE_FIFO_KHR; + x11_surface->present_mode = create_info->presentMode; + if ((result = pvkCreateSwapchainKHR( device, &create_info_host, NULL /* allocator */, swapchain )) == VK_SUCCESS) { @@ -740,12 +752,24 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw VkSemaphore semaphore, VkFence fence, uint32_t *image_index ) { struct wine_vk_surface *surface; + VkFence orig_fence; VkResult result; + BOOL wait_fence; HDC hdc = 0; if (XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface )) return VK_ERROR_SURFACE_LOST_KHR; + wait_fence = surface->offscreen && (surface->present_mode == VK_PRESENT_MODE_MAILBOX_KHR || + surface->present_mode == VK_PRESENT_MODE_FIFO_KHR); + + orig_fence = fence; + if (wait_fence && !fence) + { + VkFenceCreateInfo create_info = {.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO}; + pvkCreateFence( device, &create_info, NULL, &fence ); + } + result = pvkAcquireNextImageKHR( device, swapchain, timeout, semaphore, fence, image_index ); if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) && surface->offscreen) @@ -760,10 +784,13 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw .flush = TRUE, }; + if (wait_fence) pvkWaitForFences( device, 1, &fence, 0, timeout ); NtGdiExtEscape( hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (char *)&escape, 0, NULL ); NtUserReleaseDC( surface->hwnd, hdc ); } + if (fence != orig_fence) pvkDestroyFence( device, fence, NULL ); + return result; } From 17bb6b86c20a7343993e3640247e4bea4a26583a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 22 Apr 2021 23:38:16 +0200 Subject: [PATCH 0192/1506] winevulkan: Add vkAcquireNextImage(2)KHR driver entries. --- dlls/winemac.drv/vulkan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index 22d47155861..53e34a0235b 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -591,6 +591,8 @@ static VkSurfaceKHR macdrv_wine_get_host_surface(VkSurfaceKHR surface) static const struct vulkan_funcs vulkan_funcs = { + NULL, + NULL, macdrv_vkCreateInstance, macdrv_vkCreateSwapchainKHR, macdrv_vkCreateWin32SurfaceKHR, From a4ab8544243492f20b2ae26d8dba7d042911219e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 17 Feb 2023 16:15:06 -0600 Subject: [PATCH 0193/1506] winex11.drv: Don't use offscreen rendering for multiple Vulkan swapchains. Instead, switch the client window if the last presented swapchain has a different one. CW-Bug-Id: #21902 --- dlls/winex11.drv/vulkan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 2badb1e38f3..d31ddab4f03 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -524,7 +524,10 @@ static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapcha pvkDestroySwapchainKHR(device, swapchain, NULL /* allocator */); if (!XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface )) + { wine_vk_surface_release( surface ); + XDeleteContext( gdi_display, (XID)swapchain, swapchain_context ); + } } static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name, From 89af8599cac5d244a07dfd46b0194d966748081b Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 13 Mar 2023 17:41:14 +0800 Subject: [PATCH 0194/1506] HACK: winex11.drv: Disable Vulkan child window rendering for Tales of Berseria. The game creates a top-level window and use it to create a Vulkan surface. It then creates a child window in the top-level window so Vulkan child window rendering gets enabled, causing the game intro video tearing because the use of XCopyArea(). X11 doesn't seem to have proper vertical blanking support so a hack is used instead. CW-Bug-Id: #21949 --- dlls/winex11.drv/vulkan.c | 17 +++++++++++++++++ dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 13 +++++++++++++ 3 files changed, 32 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index d31ddab4f03..0fe70d13dba 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -269,6 +269,12 @@ static BOOL wine_vk_surface_set_offscreen( struct wine_vk_surface *surface, BOOL #ifdef SONAME_LIBXCOMPOSITE if (usexcomposite) { + if (vulkan_disable_child_window_rendering_hack) + { + FIXME("Vulkan child window rendering is supported, but it's disabled.\n"); + return TRUE; + } + if (!surface->offscreen && offscreen) { FIXME( "Redirecting vulkan surface %lx offscreen, expect degraded performance.\n", surface->window ); @@ -307,6 +313,17 @@ void sync_vk_surface( HWND hwnd, BOOL known_child ) { struct wine_vk_surface *surface; + if (vulkan_disable_child_window_rendering_hack) + { + static BOOL once = FALSE; + + if (!once++) + FIXME("Vulkan child window rendering is disabled.\n"); + else + WARN("Vulkan child window rendering is disabled.\n"); + return; + } + pthread_mutex_lock( &vulkan_mutex ); LIST_FOR_EACH_ENTRY( surface, &surface_list, struct wine_vk_surface, entry ) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 88d48437517..f513387d5f2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -937,4 +937,6 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src ) return (p - dst) * sizeof(WCHAR); } +extern BOOL vulkan_disable_child_window_rendering_hack; + #endif /* __WINE_X11DRV_H */ diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 1e3549ec725..1b65e0db90a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -87,6 +87,7 @@ int alloc_system_colors = 256; int xrender_error_base = 0; char *process_name = NULL; WNDPROC client_foreign_window_proc = NULL; +BOOL vulkan_disable_child_window_rendering_hack = FALSE; static x11drv_error_callback err_callback; /* current callback for error */ static Display *err_callback_display; /* display callback is set for */ @@ -707,6 +708,18 @@ static NTSTATUS x11drv_init( void *arg ) X11DRV_InitKeyboard( gdi_display ); if (use_xim) use_xim = xim_init( input_style ); + { + const char *sgi = getenv("SteamGameId"); + const char *e = getenv("WINE_LAYERED_WINDOW_CLIENT_HACK"); + + e = getenv("WINE_DISABLE_VK_CHILD_WINDOW_RENDERING_HACK"); + vulkan_disable_child_window_rendering_hack = + (sgi && ( + !strcmp(sgi, "429660") /* Bug 21949 : Tales of Berseria video tearing */ + )) || + (e && *e != '\0' && *e != '0'); + } + init_user_driver(); X11DRV_DisplayDevices_Init(FALSE); return STATUS_SUCCESS; From 044043075e657f0eeca49274bc9a4825606fb47a Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 11 May 2023 10:29:58 +0800 Subject: [PATCH 0195/1506] HACK: winex11.drv: Disable Vulkan child window rendering for SWORD ART ONLINE Alicization Lycoris. CW-Bug-Id: #21949 --- dlls/winex11.drv/x11drv_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 1b65e0db90a..8e0016d7119 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -715,7 +715,8 @@ static NTSTATUS x11drv_init( void *arg ) e = getenv("WINE_DISABLE_VK_CHILD_WINDOW_RENDERING_HACK"); vulkan_disable_child_window_rendering_hack = (sgi && ( - !strcmp(sgi, "429660") /* Bug 21949 : Tales of Berseria video tearing */ + !strcmp(sgi, "429660") || /* Bug 21949 : Tales of Berseria video tearing */ + !strcmp(sgi, "1009290") /* Bug 21949 : SWORD ART ONLINE Alicization Lycoris video tearing */ )) || (e && *e != '\0' && *e != '0'); } From e17090fee2baaebed06734924e82aa40a3845068 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 20 May 2022 18:45:15 -0500 Subject: [PATCH 0196/1506] winex11.drv: HACK: Add an option to support GDI blits from unmapped Vulkan windows. And enable it for Disgaea 5 Complete. CW-Bug-Id: #19945 CW-Bug-Id: #23169 --- dlls/winex11.drv/vulkan.c | 100 ++++++++++++++++++++++++++++----- dlls/winex11.drv/window.c | 7 +++ dlls/winex11.drv/x11drv.h | 2 + dlls/winex11.drv/x11drv_main.c | 8 +++ 4 files changed, 103 insertions(+), 14 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 0fe70d13dba..e62fdfb8e1c 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -66,6 +66,7 @@ struct wine_vk_surface DWORD hwnd_thread_id; BOOL offscreen; /* drawable is offscreen */ VkPresentModeKHR present_mode; + BOOL gdi_blit_source; /* HACK: gdi blits from the window should work with Vulkan rendered contents. */ }; typedef struct VkXlibSurfaceCreateInfoKHR @@ -264,6 +265,17 @@ void destroy_vk_surface( HWND hwnd ) pthread_mutex_unlock( &vulkan_mutex ); } +static void set_dc_drawable( HDC hdc, Drawable drawable, const RECT *rect ) +{ + struct x11drv_escape_set_drawable escape; + + escape.code = X11DRV_SET_DRAWABLE; + escape.mode = IncludeInferiors; + escape.drawable = drawable; + escape.dc_rect = *rect; + NtGdiExtEscape( hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); +} + static BOOL wine_vk_surface_set_offscreen( struct wine_vk_surface *surface, BOOL offscreen ) { #ifdef SONAME_LIBXCOMPOSITE @@ -328,11 +340,30 @@ void sync_vk_surface( HWND hwnd, BOOL known_child ) LIST_FOR_EACH_ENTRY( surface, &surface_list, struct wine_vk_surface, entry ) { if (surface->hwnd != hwnd) continue; - wine_vk_surface_set_offscreen( surface, known_child ); + wine_vk_surface_set_offscreen( surface, known_child || surface->gdi_blit_source ); } pthread_mutex_unlock( &vulkan_mutex ); } +BOOL wine_vk_direct_window_draw( HWND hwnd ) +{ + struct wine_vk_surface *surface; + BOOL ret = FALSE; + + pthread_mutex_lock(&vulkan_mutex); + LIST_FOR_EACH_ENTRY(surface, &surface_list, struct wine_vk_surface, entry) + { + if (surface->hwnd != hwnd) continue; + if (surface->gdi_blit_source) + { + ret = TRUE; + break; + } + } + pthread_mutex_unlock(&vulkan_mutex); + return ret; +} + void vulkan_thread_detach(void) { struct wine_vk_surface *surface, *next; @@ -460,12 +491,32 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, goto err; } - if (NtUserGetAncestor( create_info->hwnd, GA_PARENT ) != NtUserGetDesktopWindow() || - NtUserGetWindowRelative( create_info->hwnd, GW_CHILD )) + if (vulkan_gdi_blit_source_hack) { - TRACE( "hwnd %p creating offscreen child window surface\n", x11_surface->hwnd ); + RECT rect; - if (!wine_vk_surface_set_offscreen( x11_surface, TRUE )) + NtUserGetWindowRect( create_info->hwnd, &rect ); + if (!is_window_rect_mapped( &rect )) + { + struct x11drv_win_data *data; + + FIXME("HACK: setting gdi_blit_source for hwnd %p, surface %p.\n", x11_surface->hwnd, x11_surface); + x11_surface->gdi_blit_source = TRUE; + + if ((data = get_win_data( x11_surface->hwnd ))) + { + detach_client_window( data, x11_surface->window, TRUE ); + release_win_data( data ); + } + } + } + + if (NtUserGetAncestor( create_info->hwnd, GA_PARENT ) != NtUserGetDesktopWindow() || + NtUserGetWindowRelative( create_info->hwnd, GW_CHILD ) || + x11_surface->gdi_blit_source) + { + TRACE("hwnd %p creating offscreen child window surface\n", x11_surface->hwnd); + if (!wine_vk_surface_set_offscreen(x11_surface, TRUE)) { res = VK_ERROR_INCOMPATIBLE_DRIVER; goto err; @@ -491,6 +542,13 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, *surface = (uintptr_t)x11_surface; + if (x11_surface->gdi_blit_source) + { + /* Make sure window gets surface destroyed. */ + UINT flags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | + SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_STATECHANGED; + NtUserSetWindowPos( x11_surface->hwnd, 0, 0, 0, 0, 0, flags ); + } TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface)); return VK_SUCCESS; @@ -776,6 +834,7 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw VkResult result; BOOL wait_fence; HDC hdc = 0; + RECT rect; if (XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface )) return VK_ERROR_SURFACE_LOST_KHR; @@ -793,19 +852,32 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw result = pvkAcquireNextImageKHR( device, swapchain, timeout, semaphore, fence, image_index ); if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) && surface->offscreen) - hdc = NtUserGetDCEx( surface->hwnd, 0, DCX_USESTYLE | DCX_CACHE ); + { + DWORD dc_flags = DCX_USESTYLE; + if (!surface->gdi_blit_source) dc_flags |= DCX_CACHE; + hdc = NtUserGetDCEx( surface->hwnd, 0, dc_flags ); + } if (hdc) { - struct x11drv_escape_present_drawable escape = + if (wait_fence) pvkWaitForFences( device, 1, &fence, 0, timeout ); + + if (surface->gdi_blit_source) { - .code = X11DRV_PRESENT_DRAWABLE, - .drawable = surface->window, - .flush = TRUE, - }; + NtUserGetClientRect( surface->hwnd, &rect ); + set_dc_drawable( hdc, surface->window, &rect ); + } + else + { + struct x11drv_escape_present_drawable escape = + { + .code = X11DRV_PRESENT_DRAWABLE, + .drawable = surface->window, + .flush = TRUE, + }; + NtGdiExtEscape( hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (char *)&escape, 0, NULL ); + } - if (wait_fence) pvkWaitForFences( device, 1, &fence, 0, timeout ); - NtGdiExtEscape( hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (char *)&escape, 0, NULL ); NtUserReleaseDC( surface->hwnd, hdc ); } @@ -837,7 +909,7 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR * struct x11drv_win_data *data; if (!XFindContext( gdi_display, (XID)swapchain, swapchain_context, (char **)&surface ) && - (data = get_win_data( surface->hwnd ))) + !surface->gdi_blit_source && (data = get_win_data( surface->hwnd ))) { attach_client_window( data, surface->window ); release_win_data( data ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 35e702a191a..dca44dfd7f6 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2754,6 +2754,13 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, if (!data->whole_window && !data->embedded) goto done; if (swp_flags & SWP_HIDEWINDOW) goto done; if (data->use_alpha) goto done; + + if (wine_vk_direct_window_draw( hwnd )) + { + if (*surface) window_surface_release( *surface ); + *surface = NULL; + goto done; + } if (!get_surface_rect( visible_rect, &surface_rect )) goto done; if (*surface) window_surface_release( *surface ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f513387d5f2..71ff7049744 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -660,6 +660,7 @@ extern void destroy_vk_surface( HWND hwnd ); extern void sync_vk_surface( HWND hwnd, BOOL known_child ); extern void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ); extern void vulkan_thread_detach(void); +extern BOOL wine_vk_direct_window_draw( HWND hwnd ); extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ); extern Window init_clip_window(void); @@ -938,5 +939,6 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src ) } extern BOOL vulkan_disable_child_window_rendering_hack; +extern BOOL vulkan_gdi_blit_source_hack; #endif /* __WINE_X11DRV_H */ diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 8e0016d7119..1675d462dc3 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -88,6 +88,7 @@ int xrender_error_base = 0; char *process_name = NULL; WNDPROC client_foreign_window_proc = NULL; BOOL vulkan_disable_child_window_rendering_hack = FALSE; +BOOL vulkan_gdi_blit_source_hack = FALSE; static x11drv_error_callback err_callback; /* current callback for error */ static Display *err_callback_display; /* display callback is set for */ @@ -712,6 +713,13 @@ static NTSTATUS x11drv_init( void *arg ) const char *sgi = getenv("SteamGameId"); const char *e = getenv("WINE_LAYERED_WINDOW_CLIENT_HACK"); + e = getenv("WINE_VK_GDI_BLIT_SOURCE_HACK"); + vulkan_gdi_blit_source_hack = + (sgi && ( + !strcmp(sgi, "803600") /* Disgaea 5 Complete */ + )) || + (e && *e != '\0' && *e != '0'); + e = getenv("WINE_DISABLE_VK_CHILD_WINDOW_RENDERING_HACK"); vulkan_disable_child_window_rendering_hack = (sgi && ( From 11e05c3c076b8f085bf95e4b9183bc75ae3d5eb9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sat, 21 May 2022 20:01:08 -0500 Subject: [PATCH 0197/1506] winex11.drv: Implement other process window Vulkan rendering. CW-Bug-Id: #20680 --- dlls/winex11.drv/vulkan.c | 94 +++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index e62fdfb8e1c..ed0ac94772b 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -67,6 +67,10 @@ struct wine_vk_surface BOOL offscreen; /* drawable is offscreen */ VkPresentModeKHR present_mode; BOOL gdi_blit_source; /* HACK: gdi blits from the window should work with Vulkan rendered contents. */ + BOOL other_process; + Colormap client_colormap; + HDC draw_dc; + unsigned int width, height; }; typedef struct VkXlibSurfaceCreateInfoKHR @@ -232,6 +236,10 @@ static void wine_vk_surface_release( struct wine_vk_surface *surface ) pthread_mutex_unlock(&vulkan_mutex); } + if (surface->draw_dc) + NtGdiDeleteObjectApp( surface->draw_dc ); + if (surface->client_colormap) + XFreeColormap( gdi_display, surface->client_colormap ); destroy_client_window( surface->hwnd, surface->window ); free(surface); } @@ -354,7 +362,7 @@ BOOL wine_vk_direct_window_draw( HWND hwnd ) LIST_FOR_EACH_ENTRY(surface, &surface_list, struct wine_vk_surface, entry) { if (surface->hwnd != hwnd) continue; - if (surface->gdi_blit_source) + if (surface->gdi_blit_source && !surface->other_process) { ret = TRUE; break; @@ -439,7 +447,9 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, create_info_host.surface = x11_surface->host_surface; /* force fifo when running offscreen so the acquire fence is more likely to be vsynced */ - if (x11_surface->offscreen && create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR) + if (x11_surface->gdi_blit_source) + create_info_host.presentMode = VK_PRESENT_MODE_IMMEDIATE_KHR; + else if (x11_surface->offscreen && create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR) create_info_host.presentMode = VK_PRESENT_MODE_FIFO_KHR; x11_surface->present_mode = create_info->presentMode; @@ -460,6 +470,8 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, VkResult res; VkXlibSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *x11_surface; + DWORD hwnd_pid; + RECT rect; TRACE("%p %p %p %p\n", instance, create_info, allocator, surface); @@ -474,8 +486,49 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, x11_surface->hwnd = create_info->hwnd; if (x11_surface->hwnd) { - x11_surface->window = create_client_window(create_info->hwnd, &default_visual, default_colormap); - x11_surface->hwnd_thread_id = NtUserGetWindowThread(x11_surface->hwnd, NULL); + x11_surface->hwnd_thread_id = NtUserGetWindowThread(x11_surface->hwnd, &hwnd_pid); + if (x11_surface->hwnd_thread_id && hwnd_pid != GetCurrentProcessId()) + { + XSetWindowAttributes attr; + + WARN("Other process window %p.\n", x11_surface->hwnd); + NtUserGetClientRect( x11_surface->hwnd, &rect ); + x11_surface->width = max( rect.right - rect.left, 1 ); + x11_surface->height = max( rect.bottom - rect.top, 1 ); + x11_surface->client_colormap = XCreateColormap( gdi_display, get_dummy_parent(), default_visual.visual, + (default_visual.class == PseudoColor || default_visual.class == GrayScale + || default_visual.class == DirectColor) ? AllocAll : AllocNone ); + attr.colormap = x11_surface->client_colormap; + attr.bit_gravity = NorthWestGravity; + attr.win_gravity = NorthWestGravity; + attr.backing_store = NotUseful; + attr.border_pixel = 0; + x11_surface->window = XCreateWindow( gdi_display, + get_dummy_parent(), + 0, 0, x11_surface->width, x11_surface->height, 0, + default_visual.depth, InputOutput, + default_visual.visual, CWBitGravity | CWWinGravity | + CWBackingStore | CWColormap | CWBorderPixel, &attr ); + if (x11_surface->window) + { + const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0}; + UNICODE_STRING device_str; + + XMapWindow( gdi_display, x11_surface->window ); + XSync( gdi_display, False ); + x11_surface->gdi_blit_source = TRUE; + x11_surface->other_process = TRUE; + + RtlInitUnicodeString( &device_str, displayW ); + x11_surface->draw_dc = NtGdiOpenDCW( &device_str, NULL, NULL, 0, TRUE, NULL, NULL, NULL ); + + set_dc_drawable( x11_surface->draw_dc, x11_surface->window, &rect ); + } + } + else + { + x11_surface->window = create_client_window(create_info->hwnd, &default_visual, default_colormap); + } } else { @@ -491,7 +544,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, goto err; } - if (vulkan_gdi_blit_source_hack) + if (!x11_surface->gdi_blit_source && vulkan_gdi_blit_source_hack) { RECT rect; @@ -542,7 +595,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, *surface = (uintptr_t)x11_surface; - if (x11_surface->gdi_blit_source) + if (x11_surface->gdi_blit_source && !x11_surface->other_process) { /* Make sure window gets surface destroyed. */ UINT flags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | @@ -840,7 +893,8 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw return VK_ERROR_SURFACE_LOST_KHR; wait_fence = surface->offscreen && (surface->present_mode == VK_PRESENT_MODE_MAILBOX_KHR || - surface->present_mode == VK_PRESENT_MODE_FIFO_KHR); + surface->present_mode == VK_PRESENT_MODE_FIFO_KHR || + surface->other_process); orig_fence = fence; if (wait_fence && !fence) @@ -854,7 +908,7 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) && surface->offscreen) { DWORD dc_flags = DCX_USESTYLE; - if (!surface->gdi_blit_source) dc_flags |= DCX_CACHE; + if (!surface->gdi_blit_source || surface->other_process) dc_flags |= DCX_CACHE; hdc = NtUserGetDCEx( surface->hwnd, 0, dc_flags ); } @@ -864,8 +918,30 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw if (surface->gdi_blit_source) { + unsigned int width, height; + NtUserGetClientRect( surface->hwnd, &rect ); - set_dc_drawable( hdc, surface->window, &rect ); + if (surface->other_process) + { + width = max( rect.right - rect.left, 1 ); + height = max( rect.bottom - rect.top, 1 ); + if (!NtGdiStretchBlt(hdc, rect.left, rect.top, width, + height, surface->draw_dc, 0, 0, + width, height, SRCCOPY, 0)) + ERR("StretchBlt failed.\n"); + if (width != surface->width || height != surface->height) + { + TRACE("Resizing.\n"); + XMoveResizeWindow( gdi_display, surface->window, 0, 0, width, height); + set_dc_drawable( surface->draw_dc, surface->window, &rect ); + surface->width = width; + surface->height = height; + } + } + else + { + set_dc_drawable( hdc, surface->window, &rect ); + } } else { From 4f578ee543bc8e04b0b7f16c1781b26f27b941af Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 22 Jun 2022 13:20:15 -0500 Subject: [PATCH 0198/1506] winex11.drv: Add WINE_DISABLE_VULKAN_OPWR option. CW-Bug-Id: #20680 --- dlls/winex11.drv/vulkan.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index ed0ac94772b..76eaeff5889 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -27,6 +27,7 @@ #include "config.h" #include +#include #include #include @@ -463,6 +464,17 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, return result; } +static BOOL disable_opwr(void) +{ + static int disable = -1; + if (disable == -1) + { + const char *e = getenv("WINE_DISABLE_VULKAN_OPWR"); + disable = e && atoi(e); + } + return disable; +} + static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) @@ -492,6 +504,14 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, XSetWindowAttributes attr; WARN("Other process window %p.\n", x11_surface->hwnd); + + if (disable_opwr() && x11_surface->hwnd != NtUserGetDesktopWindow()) + { + ERR("HACK: Failing surface creation for other process window %p.\n", create_info->hwnd); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto err; + } + NtUserGetClientRect( x11_surface->hwnd, &rect ); x11_surface->width = max( rect.right - rect.left, 1 ); x11_surface->height = max( rect.bottom - rect.top, 1 ); From fcddd495f388d93af6dfe7d80e74e487581951ac Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 2 May 2023 22:06:23 -0600 Subject: [PATCH 0199/1506] winex11.drv: HACK: Cleanup lost Vulkan surfaces for DOOM (2016). CW-Bug-Id: #21902 --- dlls/winex11.drv/vulkan.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 76eaeff5889..23bb61b2e1d 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -475,6 +475,30 @@ static BOOL disable_opwr(void) return disable; } +static void cleanup_leaked_surfaces(HWND hwnd) +{ + struct wine_vk_surface *surface, *next; + static int cleanup = -1; + + if (cleanup == -1) + { + const char *e = getenv("SteamGameId"); + cleanup = e && !strcmp(e, "379720"); + if (cleanup) + ERR("HACK.\n"); + } + + if (!cleanup) + return; + + LIST_FOR_EACH_ENTRY_SAFE(surface, next, &surface_list, struct wine_vk_surface, entry) + { + if (surface->hwnd != hwnd) + continue; + wine_vk_surface_release(surface); + } +} + static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) @@ -610,6 +634,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, } pthread_mutex_lock(&vulkan_mutex); + cleanup_leaked_surfaces(x11_surface->hwnd); list_add_tail(&surface_list, &x11_surface->entry); pthread_mutex_unlock(&vulkan_mutex); From 8d2f63a4e9bd955de44931a6cb3796676a93ae45 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 10 Sep 2021 22:21:13 +0300 Subject: [PATCH 0200/1506] winex11.drv: Create offscreen GL drawable for layered windows managed through UpdateLayeredWindow(). CW-Bug-ID: #19216 --- dlls/winex11.drv/opengl.c | 77 ++++++++++++++++++++++++++++++--------- dlls/winex11.drv/window.c | 13 +++++++ dlls/winex11.drv/x11drv.h | 2 + 3 files changed, 74 insertions(+), 18 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 01883ecff94..e67d652a89a 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -218,6 +218,12 @@ enum dc_gl_type DC_GL_PBUFFER /* pseudo memory DC using a PBuffer */ }; +enum dc_gl_layered_type +{ + DC_GL_LAYERED_NONE, + DC_GL_LAYERED_UPDATES, +}; + struct gl_drawable { LONG ref; /* reference count */ @@ -229,6 +235,7 @@ struct gl_drawable Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */ const struct wgl_pixel_format *format; /* pixel format for the drawable */ SIZE pixmap_size; /* pixmap size for GLXPixmap drawables */ + enum dc_gl_layered_type layered_type; int swap_interval; BOOL refresh_swap_interval; BOOL mutable_pf; @@ -1306,6 +1313,19 @@ static GLXContext create_glxcontext(Display *display, struct wgl_context *contex } +static enum dc_gl_layered_type get_gl_layered_type( HWND hwnd ) +{ + struct x11drv_win_data *data; + enum dc_gl_layered_type ret; + + if (!(data = get_win_data( hwnd ))) return DC_GL_LAYERED_NONE; + ret = data->layered && !data->layered_attributes ? DC_GL_LAYERED_UPDATES : DC_GL_LAYERED_NONE; + release_win_data( data ); + + return ret; +} + + /*********************************************************************** * create_gl_drawable */ @@ -1333,8 +1353,31 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->hwnd = hwnd; gl->mutable_pf = mutable_pf; - if (!known_child && !NtUserGetWindowRelative( hwnd, GW_CHILD ) && - NtUserGetAncestor( hwnd, GA_PARENT ) == NtUserGetDesktopWindow()) /* childless top-level window */ + gl->layered_type = get_gl_layered_type( hwnd ); + + if (gl->layered_type) + { + struct x11drv_win_data *data; + + if ((data = get_win_data( hwnd ))) + { + detach_client_window( data, data->client_window, TRUE ); + release_win_data( data ); + } + + gl->type = DC_GL_PIXMAP_WIN; + gl->pixmap = XCreatePixmap( gdi_display, root_window, width, height, visual->depth ); + if (gl->pixmap) + { + gl->drawable = pglXCreatePixmap( gdi_display, gl->format->fbconfig, gl->pixmap, NULL ); + if (!gl->drawable) XFreePixmap( gdi_display, gl->pixmap ); + gl->pixmap_size.cx = width; + gl->pixmap_size.cy = height; + } + TRACE( "%p created pixmap drawable %lx for layered window, type %u.\n", hwnd, gl->drawable, gl->layered_type ); + } + else if (!known_child && !NtUserGetWindowRelative( hwnd, GW_CHILD ) && + NtUserGetAncestor( hwnd, GA_PARENT ) == NtUserGetDesktopWindow()) /* childless top-level window */ { gl->type = DC_GL_WINDOW; gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, @@ -1475,24 +1518,22 @@ static BOOL set_pixel_format( HDC hdc, int format, BOOL internal ) */ void sync_gl_drawable( HWND hwnd, BOOL known_child ) { + enum dc_gl_layered_type new_layered_type; struct gl_drawable *old, *new; if (!(old = get_gl_drawable( hwnd, 0 ))) return; - switch (old->type) + new_layered_type = get_gl_layered_type( hwnd ); + if (old->type == DC_GL_PIXMAP_WIN || (known_child && old->type == DC_GL_WINDOW) + || old->layered_type != new_layered_type) { - case DC_GL_WINDOW: - if (!known_child) break; /* Still a childless top-level window */ - /* fall through */ - case DC_GL_PIXMAP_WIN: - if (!(new = create_gl_drawable( hwnd, old->format, known_child, old->mutable_pf ))) break; - mark_drawable_dirty( old, new ); - XFlush( gdi_display ); - TRACE( "Recreated GL drawable %lx to replace %lx\n", new->drawable, old->drawable ); - release_gl_drawable( new ); - break; - default: - break; + if ((new = create_gl_drawable( hwnd, old->format, known_child, old->mutable_pf ))) + { + mark_drawable_dirty( old, new ); + XFlush( gdi_display ); + TRACE( "Recreated GL drawable %lx to replace %lx\n", new->drawable, old->drawable ); + release_gl_drawable( new ); + } } release_gl_drawable( old ); } @@ -2002,7 +2043,7 @@ static void wglFinish(void) { switch (gl->type) { - case DC_GL_PIXMAP_WIN: escape.drawable = gl->pixmap; break; + case DC_GL_PIXMAP_WIN: if (!gl->layered_type) escape.drawable = gl->pixmap; break; case DC_GL_CHILD_WIN: escape.drawable = gl->window; break; default: break; } @@ -2029,7 +2070,7 @@ static void wglFlush(void) { switch (gl->type) { - case DC_GL_PIXMAP_WIN: escape.drawable = gl->pixmap; break; + case DC_GL_PIXMAP_WIN: if (!gl->layered_type) escape.drawable = gl->pixmap; break; case DC_GL_CHILD_WIN: escape.drawable = gl->window; break; default: break; } @@ -3387,7 +3428,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) { case DC_GL_PIXMAP_WIN: if (ctx) sync_context( ctx ); - escape.drawable = gl->pixmap; + if (!gl->layered_type) escape.drawable = gl->pixmap; if (pglXCopySubBufferMESA) { /* (glX)SwapBuffers has an implicit glFlush effect, however * GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index dca44dfd7f6..a088b45a2a0 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1996,6 +1996,7 @@ void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) struct x11drv_win_data *data; DWORD changed = style->styleNew ^ style->styleOld; HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); + BOOL need_sync_gl = FALSE; if (offset == GWL_STYLE && (changed & WS_CHILD)) { @@ -2016,12 +2017,15 @@ void X11DRV_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) if (offset == GWL_EXSTYLE && (changed & WS_EX_LAYERED)) /* changing WS_EX_LAYERED resets attributes */ { data->layered = FALSE; + data->layered_attributes = FALSE; + need_sync_gl = TRUE; set_window_visual( data, &default_visual, FALSE ); sync_window_opacity( data->display, data->whole_window, 0, 0, 0 ); if (data->surface) set_surface_color_key( data->surface, CLR_INVALID ); } done: release_win_data( data ); + if (need_sync_gl) sync_gl_drawable( hwnd, FALSE ); } @@ -3065,6 +3069,7 @@ void X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags ) { struct x11drv_win_data *data = get_win_data( hwnd ); + BOOL need_sync_gl; if (data) { @@ -3075,7 +3080,9 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO if (data->surface) set_surface_color_key( data->surface, (flags & LWA_COLORKEY) ? key : CLR_INVALID ); + need_sync_gl = !data->layered || !data->layered_attributes; data->layered = TRUE; + data->layered_attributes = TRUE; if (!data->mapped) /* mapping is delayed until attributes are set */ { DWORD style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); @@ -3085,10 +3092,12 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO { release_win_data( data ); map_window( hwnd, style ); + if (need_sync_gl) sync_gl_drawable( hwnd, FALSE ); return; } } release_win_data( data ); + if (need_sync_gl) sync_gl_drawable( hwnd, FALSE ); } else { @@ -3117,12 +3126,14 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, BITMAPINFO *bmi = (BITMAPINFO *)buffer; void *src_bits, *dst_bits; RECT rect, src_rect; + BOOL need_sync_gl; HDC hdc = 0; HBITMAP dib; BOOL mapped, ret = FALSE; if (!(data = get_win_data( hwnd ))) return FALSE; + need_sync_gl = !data->layered; data->layered = TRUE; if (!data->embedded && argb_visual.visualid) set_window_visual( data, &argb_visual, TRUE ); @@ -3152,6 +3163,8 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, map_window( hwnd, style ); } + if (need_sync_gl) sync_gl_drawable( hwnd, FALSE ); + if (!surface) return FALSE; if (!info->hdcSrc) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 71ff7049744..6f209e9ac7f 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -630,6 +630,8 @@ struct x11drv_win_data UINT embedded : 1; /* is window an XEMBED client? */ UINT shaped : 1; /* is window using a custom region shape? */ UINT layered : 1; /* is window layered and with valid attributes? */ + UINT layered_attributes : 1; + /* is layered window has leyered attributes set (or otherwise managed with UpdateLayeredWindow()? */ UINT use_alpha : 1; /* does window use an alpha channel? */ UINT skip_taskbar : 1; /* does window should be deleted from taskbar */ UINT add_taskbar : 1; /* does window should be added to taskbar regardless of style */ From 3ad11961b6af4dc3b7238152719658d89e7fc4ea Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 13 Sep 2021 00:39:05 +0300 Subject: [PATCH 0201/1506] winex11.drv: Always sync windowless GL drawables on size change. CW-Bug-ID: #19216 --- dlls/winex11.drv/window.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a088b45a2a0..0df0c91aca9 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2810,6 +2810,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, struct x11drv_win_data *data; UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); RECT old_window_rect, old_whole_rect, old_client_rect; + BOOL needs_resize; int event_type; if (!(data = get_win_data( hwnd ))) return; @@ -2870,13 +2871,13 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, sync_client_position( data, &old_client_rect, &old_whole_rect ); + needs_resize = !data->client_window && (data->client_rect.right - data->client_rect.left != + old_client_rect.right - old_client_rect.left || + data->client_rect.bottom - data->client_rect.top != + old_client_rect.bottom - old_client_rect.top); + if (!data->whole_window) { - BOOL needs_resize = (!data->client_window && - (data->client_rect.right - data->client_rect.left != - old_client_rect.right - old_client_rect.left || - data->client_rect.bottom - data->client_rect.top != - old_client_rect.bottom - old_client_rect.top)); release_win_data( data ); if (needs_resize) sync_gl_drawable( hwnd, FALSE ); return; @@ -2951,6 +2952,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, data->surface->funcs->flush( data->surface ); release_win_data( data ); + if (needs_resize) sync_gl_drawable( hwnd, FALSE ); } /* check if the window icon should be hidden (i.e. moved off-screen) */ From 2d0df227a6520176cb69f6e1ccdf7d519cee5bd0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Sep 2021 21:16:26 +0300 Subject: [PATCH 0202/1506] winex11.drv: Use window surface for GL presentation for layered windows. CW-Bug-ID: #19216 --- dlls/winex11.drv/opengl.c | 85 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index e67d652a89a..8d29025401d 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -222,6 +222,7 @@ enum dc_gl_layered_type { DC_GL_LAYERED_NONE, DC_GL_LAYERED_UPDATES, + DC_GL_LAYERED_ATTRIBUTES, }; struct gl_drawable @@ -1319,7 +1320,8 @@ static enum dc_gl_layered_type get_gl_layered_type( HWND hwnd ) enum dc_gl_layered_type ret; if (!(data = get_win_data( hwnd ))) return DC_GL_LAYERED_NONE; - ret = data->layered && !data->layered_attributes ? DC_GL_LAYERED_UPDATES : DC_GL_LAYERED_NONE; + if (data->layered) ret = data->layered_attributes ? DC_GL_LAYERED_ATTRIBUTES : DC_GL_LAYERED_UPDATES; + else ret = DC_GL_LAYERED_NONE; release_win_data( data ); return ret; @@ -2029,17 +2031,87 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de return TRUE; } +static void update_window_surface(struct gl_drawable *gl, HWND hwnd) +{ + char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; + BITMAPINFO *bmi = (BITMAPINFO *)buffer; + struct window_surface *surface; + struct x11drv_win_data *data; + unsigned int y, width, height, stride, pitch; + BYTE *dst_bits, *src_bits; + XImage *image; + RECT rect; + + TRACE( "gl %p, hwnd %p, gl->layered_type %u.\n", gl, hwnd, gl->layered_type ); + + if (gl->layered_type != DC_GL_LAYERED_ATTRIBUTES || !gl->pixmap) return; + + if (!(data = get_win_data( hwnd ))) return; + + surface = data->surface; + if (!surface) + { + TRACE( "No surface.\n" ); + release_win_data( data ); + return; + } + + rect = data->client_rect; + OffsetRect( &rect, -data->whole_rect.left, -data->whole_rect.top ); + + dst_bits = surface->funcs->get_info( surface, bmi ); + surface->funcs->lock( surface ); + + rect.right = min( rect.right, abs( bmi->bmiHeader.biWidth )); + rect.bottom = min( rect.bottom, abs( bmi->bmiHeader.biHeight )); + + width = min( rect.right - rect.left, gl->pixmap_size.cx ); + height = min( rect.bottom - rect.top, gl->pixmap_size.cy ); + + image = XGetImage( gdi_display, gl->pixmap, 0, 0, width, height, + AllPlanes, ZPixmap ); + if (!image) + { + TRACE( "NULL image.\n" ); + goto done; + } + + if (image->bits_per_pixel != bmi->bmiHeader.biBitCount) + { + static unsigned int once; + + if (!once++) + FIXME("Bits per pixel does not match, image %u, bmi %u.\n", image->bits_per_pixel, bmi->bmiHeader.biBitCount); + goto done; + } + + stride = bmi->bmiHeader.biBitCount / 8; + pitch = (bmi->bmiHeader.biWidth * stride + 3) & ~3; + src_bits = (BYTE *)image->data; + for (y = 0; y < height; ++y) + memcpy( dst_bits + (y + rect.top) * pitch + rect.left * stride, + src_bits + y * image->bytes_per_line, width * stride ); + + add_bounds_rect( surface->funcs->get_bounds( surface ), &rect ); + +done: + surface->funcs->unlock( surface ); + if (image) XDestroyImage( image ); + release_win_data( data ); +} + static void wglFinish(void) { struct x11drv_escape_present_drawable escape; struct gl_drawable *gl; struct wgl_context *ctx = NtCurrentTeb()->glContext; + HWND hwnd; escape.code = X11DRV_PRESENT_DRAWABLE; escape.drawable = 0; escape.flush = FALSE; - if ((gl = get_gl_drawable( NtUserWindowFromDC( ctx->hdc ), 0 ))) + if ((gl = get_gl_drawable( (hwnd = NtUserWindowFromDC( ctx->hdc )), 0 ))) { switch (gl->type) { @@ -2048,6 +2120,7 @@ static void wglFinish(void) default: break; } sync_context(ctx); + update_window_surface( gl, hwnd ); release_gl_drawable( gl ); } @@ -2061,12 +2134,13 @@ static void wglFlush(void) struct x11drv_escape_present_drawable escape; struct gl_drawable *gl; struct wgl_context *ctx = NtCurrentTeb()->glContext; + HWND hwnd; escape.code = X11DRV_PRESENT_DRAWABLE; escape.drawable = 0; escape.flush = FALSE; - if ((gl = get_gl_drawable( NtUserWindowFromDC( ctx->hdc ), 0 ))) + if ((gl = get_gl_drawable( (hwnd = NtUserWindowFromDC( ctx->hdc )), 0 ))) { switch (gl->type) { @@ -2075,6 +2149,7 @@ static void wglFlush(void) default: break; } sync_context(ctx); + update_window_surface( gl, hwnd ); release_gl_drawable( gl ); } @@ -3403,6 +3478,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) struct gl_drawable *gl; struct wgl_context *ctx = NtCurrentTeb()->glContext; INT64 ust, msc, sbc, target_sbc = 0; + HWND hwnd; TRACE("(%p)\n", hdc); @@ -3410,7 +3486,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) escape.drawable = 0; escape.flush = !pglXWaitForSbcOML; - if (!(gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc ))) + if (!(gl = get_gl_drawable( (hwnd = NtUserWindowFromDC( hdc )), hdc ))) { RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return FALSE; @@ -3465,6 +3541,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) if (escape.drawable && pglXWaitForSbcOML) pglXWaitForSbcOML( gdi_display, gl->drawable, target_sbc, &ust, &msc, &sbc ); + update_window_surface( gl, hwnd ); release_gl_drawable( gl ); if (escape.drawable) From fd719ab4dd484a89c58bae70265732e7530b5861 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 17 Feb 2023 16:46:24 -0600 Subject: [PATCH 0203/1506] winex11.drv: Sync parent's GL drawable when child window is destroyed. CW-Bug-Id: #21769 --- dlls/winex11.drv/opengl.c | 12 ++++++++++-- dlls/winex11.drv/window.c | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 8d29025401d..f049668dfa5 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1327,6 +1327,11 @@ static enum dc_gl_layered_type get_gl_layered_type( HWND hwnd ) return ret; } +static BOOL drawable_needs_clipping( HWND hwnd, BOOL known_child ) +{ + if (known_child) return TRUE; + return NtUserGetWindowRelative( hwnd, GW_CHILD ) || NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow(); +} /*********************************************************************** * create_gl_drawable @@ -1378,8 +1383,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel } TRACE( "%p created pixmap drawable %lx for layered window, type %u.\n", hwnd, gl->drawable, gl->layered_type ); } - else if (!known_child && !NtUserGetWindowRelative( hwnd, GW_CHILD ) && - NtUserGetAncestor( hwnd, GA_PARENT ) == NtUserGetDesktopWindow()) /* childless top-level window */ + else if (!drawable_needs_clipping( hwnd, known_child )) /* childless top-level window */ { gl->type = DC_GL_WINDOW; gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, @@ -1526,7 +1530,11 @@ void sync_gl_drawable( HWND hwnd, BOOL known_child ) if (!(old = get_gl_drawable( hwnd, 0 ))) return; new_layered_type = get_gl_layered_type( hwnd ); + + known_child = drawable_needs_clipping( hwnd, known_child ); + if (old->type == DC_GL_PIXMAP_WIN || (known_child && old->type == DC_GL_WINDOW) + || (!known_child && old->type != DC_GL_WINDOW) || old->layered_type != new_layered_type) { if ((new = create_gl_drawable( hwnd, old->format, known_child, old->mutable_pf ))) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 0df0c91aca9..1d62187b912 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2040,7 +2040,10 @@ void X11DRV_DestroyWindow( HWND hwnd ) if (!NtUserGetWindowRelative( parent, GW_CHILD ) && NtUserGetAncestor( parent, GA_PARENT ) == NtUserGetDesktopWindow()) + { + sync_gl_drawable( parent, FALSE ); sync_vk_surface( parent, FALSE ); + } if (!(data = get_win_data( hwnd ))) return; From 5e3551aa33b8613b0a89292cbf08e0548f95f1d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 15:50:58 +0100 Subject: [PATCH 0204/1506] winex11.drv: Use offscreen windows instead of pixmaps for layered windows GL drawing. CW-Bug-Id: #22716 --- dlls/winex11.drv/opengl.c | 62 ++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index f049668dfa5..90172665a5f 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1362,28 +1362,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->layered_type = get_gl_layered_type( hwnd ); - if (gl->layered_type) - { - struct x11drv_win_data *data; - - if ((data = get_win_data( hwnd ))) - { - detach_client_window( data, data->client_window, TRUE ); - release_win_data( data ); - } - - gl->type = DC_GL_PIXMAP_WIN; - gl->pixmap = XCreatePixmap( gdi_display, root_window, width, height, visual->depth ); - if (gl->pixmap) - { - gl->drawable = pglXCreatePixmap( gdi_display, gl->format->fbconfig, gl->pixmap, NULL ); - if (!gl->drawable) XFreePixmap( gdi_display, gl->pixmap ); - gl->pixmap_size.cx = width; - gl->pixmap_size.cy = height; - } - TRACE( "%p created pixmap drawable %lx for layered window, type %u.\n", hwnd, gl->drawable, gl->layered_type ); - } - else if (!drawable_needs_clipping( hwnd, known_child )) /* childless top-level window */ + if (!gl->layered_type && !drawable_needs_clipping( hwnd, known_child )) /* childless top-level window */ { gl->type = DC_GL_WINDOW; gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, @@ -1397,6 +1376,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel #ifdef SONAME_LIBXCOMPOSITE else if(usexcomposite) { + struct x11drv_win_data *data; gl->type = DC_GL_CHILD_WIN; gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, (visual->class == PseudoColor || visual->class == GrayScale || @@ -1407,6 +1387,11 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); pXCompositeRedirectWindow( gdi_display, gl->window, CompositeRedirectManual ); } + if (gl->layered_type && (data = get_win_data( hwnd ))) + { + detach_client_window( data, data->client_window, TRUE ); + release_win_data( data ); + } TRACE( "%p created child %lx drawable %lx\n", hwnd, gl->window, gl->drawable ); } #endif @@ -1533,7 +1518,7 @@ void sync_gl_drawable( HWND hwnd, BOOL known_child ) known_child = drawable_needs_clipping( hwnd, known_child ); - if (old->type == DC_GL_PIXMAP_WIN || (known_child && old->type == DC_GL_WINDOW) + if (old->layered_type || (known_child && old->type == DC_GL_WINDOW) || (!known_child && old->type != DC_GL_WINDOW) || old->layered_type != new_layered_type) { @@ -2039,6 +2024,11 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de return TRUE; } +static int XGetImage_handler( Display *dpy, XErrorEvent *event, void *arg ) +{ + return event->request_code == X_GetImage && event->error_code == BadMatch; +} + static void update_window_surface(struct gl_drawable *gl, HWND hwnd) { char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; @@ -2052,7 +2042,7 @@ static void update_window_surface(struct gl_drawable *gl, HWND hwnd) TRACE( "gl %p, hwnd %p, gl->layered_type %u.\n", gl, hwnd, gl->layered_type ); - if (gl->layered_type != DC_GL_LAYERED_ATTRIBUTES || !gl->pixmap) return; + if (gl->layered_type != DC_GL_LAYERED_ATTRIBUTES || !gl->window) return; if (!(data = get_win_data( hwnd ))) return; @@ -2073,11 +2063,18 @@ static void update_window_surface(struct gl_drawable *gl, HWND hwnd) rect.right = min( rect.right, abs( bmi->bmiHeader.biWidth )); rect.bottom = min( rect.bottom, abs( bmi->bmiHeader.biHeight )); - width = min( rect.right - rect.left, gl->pixmap_size.cx ); - height = min( rect.bottom - rect.top, gl->pixmap_size.cy ); + width = rect.right - rect.left; + height = rect.bottom - rect.top; + + TRACE( "client_rect %s, whole_rect %s bmi %dx%d, rect %s.\n", + wine_dbgstr_rect(&data->client_rect), wine_dbgstr_rect(&data->whole_rect), + (int)bmi->bmiHeader.biWidth, (int)bmi->bmiHeader.biHeight, + wine_dbgstr_rect(&rect) ); - image = XGetImage( gdi_display, gl->pixmap, 0, 0, width, height, + X11DRV_expect_error( gdi_display, XGetImage_handler, NULL ); + image = XGetImage( gdi_display, gl->window, 0, 0, width, height, AllPlanes, ZPixmap ); + if (X11DRV_check_error()) ERR( "XGetImage error.\n" ); if (!image) { TRACE( "NULL image.\n" ); @@ -2099,7 +2096,6 @@ static void update_window_surface(struct gl_drawable *gl, HWND hwnd) for (y = 0; y < height; ++y) memcpy( dst_bits + (y + rect.top) * pitch + rect.left * stride, src_bits + y * image->bytes_per_line, width * stride ); - add_bounds_rect( surface->funcs->get_bounds( surface ), &rect ); done: @@ -2124,7 +2120,7 @@ static void wglFinish(void) switch (gl->type) { case DC_GL_PIXMAP_WIN: if (!gl->layered_type) escape.drawable = gl->pixmap; break; - case DC_GL_CHILD_WIN: escape.drawable = gl->window; break; + case DC_GL_CHILD_WIN: if (!gl->layered_type) escape.drawable = gl->window; break; default: break; } sync_context(ctx); @@ -2153,7 +2149,7 @@ static void wglFlush(void) switch (gl->type) { case DC_GL_PIXMAP_WIN: if (!gl->layered_type) escape.drawable = gl->pixmap; break; - case DC_GL_CHILD_WIN: escape.drawable = gl->window; break; + case DC_GL_CHILD_WIN: if (!gl->layered_type) escape.drawable = gl->window; break; default: break; } sync_context(ctx); @@ -3533,10 +3529,10 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) case DC_GL_WINDOW: case DC_GL_CHILD_WIN: if (ctx) sync_context( ctx ); - if (gl->type == DC_GL_CHILD_WIN) escape.drawable = gl->window; + if (gl->type == DC_GL_CHILD_WIN && !gl->layered_type) escape.drawable = gl->window; /* fall through */ default: - if (escape.drawable && pglXSwapBuffersMscOML) + if ((escape.drawable || gl->layered_type) && pglXSwapBuffersMscOML) { pglFlush(); target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); @@ -3546,7 +3542,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) break; } - if (escape.drawable && pglXWaitForSbcOML) + if ((escape.drawable || gl->layered_type) && pglXWaitForSbcOML) pglXWaitForSbcOML( gdi_display, gl->drawable, target_sbc, &ust, &msc, &sbc ); update_window_surface( gl, hwnd ); From bb4bbce23d1a6ac910b527cf8828022a1167c753 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 10 Sep 2021 21:51:14 +0300 Subject: [PATCH 0205/1506] user32: Allow using surface to paint the client area of OpenGL windows. CW-Bug-ID: #19216 --- dlls/win32u/dce.c | 16 +++++----------- server/window.c | 3 ++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 5df30550cae..f70a2a32be9 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -463,7 +463,6 @@ static void update_visible_region( struct dce *dce ) HRGN vis_rgn = 0; HWND top_win = 0; DWORD flags = dce->flags; - DWORD paint_flags = 0; size_t size = 256; RECT win_rect, top_rect; WND *win; @@ -500,7 +499,6 @@ static void update_visible_region( struct dce *dce ) top_rect.top = reply->top_rect.top; top_rect.right = reply->top_rect.right; top_rect.bottom = reply->top_rect.bottom; - paint_flags = reply->paint_flags; } else size = reply->total_size; } @@ -515,16 +513,12 @@ static void update_visible_region( struct dce *dce ) if (dce->clip_rgn) NtGdiCombineRgn( vis_rgn, vis_rgn, dce->clip_rgn, (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF ); - /* don't use a surface to paint the client area of OpenGL windows */ - if (!(paint_flags & SET_WINPOS_PIXEL_FORMAT) || (flags & DCX_WINDOW)) + win = get_win_ptr( top_win ); + if (win && win != WND_DESKTOP && win != WND_OTHER_PROCESS) { - win = get_win_ptr( top_win ); - if (win && win != WND_DESKTOP && win != WND_OTHER_PROCESS) - { - surface = win->surface; - if (surface) window_surface_add_ref( surface ); - release_win_ptr( win ); - } + surface = win->surface; + if (surface) window_surface_add_ref( surface ); + release_win_ptr( win ); } if (!surface) SetRectEmpty( &top_rect ); diff --git a/server/window.c b/server/window.c index 242e93f303a..a2b277d413a 100644 --- a/server/window.c +++ b/server/window.c @@ -1248,7 +1248,8 @@ static struct region *get_surface_region( struct window *win ) set_region_rect( clip, &win->client_rect ); if (win->win_region && !intersect_window_region( clip, win )) goto error; - if ((win->paint_flags & PAINT_HAS_PIXEL_FORMAT) && !subtract_region( region, region, clip )) + if (!(win->ex_style & WS_EX_LAYERED) && (win->paint_flags & PAINT_HAS_PIXEL_FORMAT) + && !subtract_region( region, region, clip )) goto error; /* clip children */ From ed54442d5e7ffc40405013ac3ba07276c324599a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:32 +0100 Subject: [PATCH 0206/1506] fshack: winex11: Split WM_X11DRV_DESKTOP_RESIZED logic to a separate helper. --- dlls/winex11.drv/window.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1d62187b912..a888bd4e316 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3252,6 +3252,26 @@ static void taskbar_delete_tab( HWND hwnd ) release_win_data( data ); } +static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old_x, UINT old_y ) +{ + /* update the full screen state */ + update_net_wm_states( data ); + + if (data->whole_window) + { + /* sync window position with the new virtual screen rect */ + POINT old_pos = {.x = data->whole_rect.left - old_x, .y = data->whole_rect.top - old_y}; + POINT pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top ); + XWindowChanges changes = {.x = pos.x, .y = pos.y}; + UINT mask = 0; + + if (old_pos.x != pos.x) mask |= CWX; + if (old_pos.y != pos.y) mask |= CWY; + + if (mask) XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes ); + } +} + /********************************************************************** * X11DRV_WindowMessage (X11DRV.@) */ @@ -3273,23 +3293,7 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) case WM_X11DRV_DESKTOP_RESIZED: if ((data = get_win_data( hwnd ))) { - /* update the full screen state */ - update_net_wm_states( data ); - - if (data->whole_window) - { - /* sync window position with the new virtual screen rect */ - POINT old_pos = {.x = data->whole_rect.left - wp, .y = data->whole_rect.top - lp}; - POINT pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top ); - XWindowChanges changes = {.x = pos.x, .y = pos.y}; - UINT mask = 0; - - if (old_pos.x != pos.x) mask |= CWX; - if (old_pos.y != pos.y) mask |= CWY; - - if (mask) XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes ); - } - + handle_window_desktop_resize( data, wp, lp ); release_win_data( data ); } return 0; From 410cdb79bce3550beb6cca70b9a41caca00a1cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:32 +0100 Subject: [PATCH 0207/1506] fshack: winex11: Introduce a new Fullscreen Hack settings handler. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on work by Zhiyi Zhang, includes work by Giovanni Mascellani, Rémi Bernon, Arkadiusz Hiler, Kai Krakow, Joshua Ashton, Zebediah Figura, and Matteo Bruni. --- dlls/winex11.drv/Makefile.in | 1 + dlls/winex11.drv/display.c | 42 +- dlls/winex11.drv/fs.c | 960 +++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 47 ++ dlls/winex11.drv/x11drv_main.c | 11 +- 5 files changed, 1047 insertions(+), 14 deletions(-) create mode 100644 dlls/winex11.drv/fs.c diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in index 6439c78e2e9..7b89cd688b9 100644 --- a/dlls/winex11.drv/Makefile.in +++ b/dlls/winex11.drv/Makefile.in @@ -13,6 +13,7 @@ SOURCES = \ display.c \ dllmain.c \ event.c \ + fs.c \ graphics.c \ init.c \ keyboard.c \ diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 49475571f71..97a2a171ba5 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -61,6 +61,11 @@ void X11DRV_Settings_SetHandler(const struct x11drv_settings_handler *new_handle } } +struct x11drv_settings_handler X11DRV_Settings_GetHandler(void) +{ + return settings_handler; +} + /*********************************************************************** * Default handlers if resolution switching is not enabled * @@ -340,7 +345,6 @@ static LONG apply_display_settings( DEVMODEW *displays, x11drv_settings_id *ids, */ LONG X11DRV_ChangeDisplaySettings( LPDEVMODEW displays, LPCWSTR primary_name, HWND hwnd, DWORD flags, LPVOID lpvoid ) { - INT left_most = INT_MAX, top_most = INT_MAX; LONG count, ret = DISP_CHANGE_BADPARAM; x11drv_settings_id *ids; DEVMODEW *mode; @@ -348,18 +352,13 @@ LONG X11DRV_ChangeDisplaySettings( LPDEVMODEW displays, LPCWSTR primary_name, HW /* Convert virtual screen coordinates to root coordinates, and find display ids. * We cannot safely get the ids while changing modes, as the backend state may be invalidated. */ - for (count = 0, mode = displays; mode->dmSize; mode = NEXT_DEVMODEW(mode), count++) - { - left_most = min( left_most, mode->dmPosition.x ); - top_most = min( top_most, mode->dmPosition.y ); - } + for (count = 0, mode = displays; mode->dmSize; mode = NEXT_DEVMODEW( mode )) count++; if (!(ids = calloc( count, sizeof(*ids) ))) return DISP_CHANGE_FAILED; for (count = 0, mode = displays; mode->dmSize; mode = NEXT_DEVMODEW(mode), count++) { - if (!settings_handler.get_id( mode->dmDeviceName, !wcsicmp( mode->dmDeviceName, primary_name ), ids + count )) goto done; - mode->dmPosition.x -= left_most; - mode->dmPosition.y -= top_most; + BOOL is_primary = !wcsicmp( mode->dmDeviceName, primary_name ); + if (!settings_handler.get_id( mode->dmDeviceName, is_primary, ids + count )) goto done; } /* Detach displays first to free up CRTCs */ @@ -374,21 +373,33 @@ LONG X11DRV_ChangeDisplaySettings( LPDEVMODEW displays, LPCWSTR primary_name, HW POINT virtual_screen_to_root(INT x, INT y) { - RECT virtual = NtUserGetVirtualScreenRect(); + RECT virtual = fs_hack_get_real_virtual_screen(); POINT pt; - pt.x = x - virtual.left; - pt.y = y - virtual.top; + TRACE( "from %d,%d\n", x, y ); + + pt.x = x; + pt.y = y; + fs_hack_point_user_to_real( &pt ); + TRACE( "to real %s\n", wine_dbgstr_point( &pt ) ); + + pt.x -= virtual.left; + pt.y -= virtual.top; + TRACE( "to root %s\n", wine_dbgstr_point( &pt ) ); return pt; } POINT root_to_virtual_screen(INT x, INT y) { - RECT virtual = NtUserGetVirtualScreenRect(); + RECT virtual = fs_hack_get_real_virtual_screen(); POINT pt; + TRACE( "from root %d,%d\n", x, y ); pt.x = x + virtual.left; pt.y = y + virtual.top; + TRACE( "to real %s\n", wine_dbgstr_point( &pt ) ); + fs_hack_point_real_to_user( &pt ); + TRACE( "to user %s\n", wine_dbgstr_point( &pt ) ); return pt; } @@ -481,6 +492,11 @@ void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler } } +struct x11drv_display_device_handler X11DRV_DisplayDevices_GetHandler(void) +{ + return host_handler; +} + void X11DRV_DisplayDevices_RegisterEventHandlers(void) { if (host_handler.register_event_handlers) host_handler.register_event_handlers(); diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c new file mode 100644 index 00000000000..6c9e7a97e01 --- /dev/null +++ b/dlls/winex11.drv/fs.c @@ -0,0 +1,960 @@ +/* + * Fullscreen Hack + * + * Simulate monitor resolution change + * + * Copyright 2020 Andrew Eikum for CodeWeavers + * Copyright 2020 Zhiyi Zhang for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include + +#include "x11drv.h" +#include "wine/debug.h" +#include "wine/list.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fshack); + +static struct x11drv_display_device_handler real_device_handler; +static struct x11drv_settings_handler real_settings_handler; + +static BOOL initialized; + +/* A table of resolutions some games expect but host system may not report */ +static SIZE fs_monitor_sizes[] = +{ + {640, 480}, /* 4:3 */ + {800, 600}, /* 4:3 */ + {1024, 768}, /* 4:3 */ + {1600, 1200}, /* 4:3 */ + {960, 540}, /* 16:9 */ + {1280, 720}, /* 16:9 */ + {1600, 900}, /* 16:9 */ + {1920, 1080}, /* 16:9 */ + {2560, 1440}, /* 16:9 */ + {2880, 1620}, /* 16:9 */ + {3200, 1800}, /* 16:9 */ + {1440, 900}, /* 8:5 */ + {1680, 1050}, /* 8:5 */ + {1920, 1200}, /* 8:5 */ + {2560, 1600}, /* 8:5 */ + {1440, 960}, /* 3:2 */ + {1920, 1280}, /* 3:2 */ + {2560, 1080}, /* 21:9 ultra-wide */ + {1920, 800}, /* 12:5 */ + {3840, 1600}, /* 12:5 */ + {1280, 1024}, /* 5:4 */ +}; + +/* A fake monitor for the fullscreen hack */ +struct fs_monitor +{ + struct list entry; + UINT_PTR gpu_id; + x11drv_settings_id settings_id; + + DEVMODEW user_mode; /* Mode changed to by users */ + DEVMODEW real_mode; /* Mode actually used by the host system */ + double user_to_real_scale; /* Scale factor from fake monitor to real monitor */ + POINT top_left; /* Top left corner of the fake monitor rectangle in real virtual screen coordinates */ +}; + +/* Access to fs_monitors is protected by fs_lock */ +static pthread_mutex_t fs_lock = PTHREAD_MUTEX_INITIALIZER; +static struct list fs_monitors = LIST_INIT( fs_monitors ); + +#define NEXT_DEVMODEW(mode) ((DEVMODEW *)((char *)((mode) + 1) + (mode)->dmDriverExtra)) + +static const char *debugstr_devmode( const DEVMODEW *devmode ) +{ + char buffer[256], *buf = buffer; + + if (devmode->dmFields & DM_BITSPERPEL) + buf += sprintf( buf, "bits %u ", (int)devmode->dmBitsPerPel ); + if (devmode->dmFields & DM_PELSWIDTH) + buf += sprintf( buf, "width %u ", (int)devmode->dmPelsWidth ); + if (devmode->dmFields & DM_PELSHEIGHT) + buf += sprintf( buf, "height %u ", (int)devmode->dmPelsHeight ); + if (devmode->dmFields & DM_DISPLAYFREQUENCY) + buf += sprintf( buf, "%u Hz ", (int)devmode->dmDisplayFrequency ); + if (devmode->dmFields & DM_POSITION) + buf += sprintf( buf, "pos (%d,%d) ", (int)devmode->dmPosition.x, (int)devmode->dmPosition.y ); + if (devmode->dmFields & DM_DISPLAYFLAGS) + buf += sprintf( buf, "flags %#x ", (int)devmode->dmDisplayFlags ); + if (devmode->dmFields & DM_DISPLAYORIENTATION) + buf += sprintf( buf, "orientation %u ", (int)devmode->dmDisplayOrientation ); + + return wine_dbg_sprintf("%s", buffer); +} + +static struct fs_monitor *find_adapter_monitor( struct list *monitors, struct gdi_adapter *adapter, DEVMODEW *mode ) +{ + struct fs_monitor *monitor; + + LIST_FOR_EACH_ENTRY( monitor, monitors, struct fs_monitor, entry ) + { + if (monitor->real_mode.dmPosition.x != mode->dmPosition.x) continue; + if (monitor->real_mode.dmPosition.y != mode->dmPosition.y) continue; + if (monitor->real_mode.dmPelsWidth != mode->dmPelsWidth) continue; + if (monitor->real_mode.dmPelsHeight != mode->dmPelsHeight) continue; + return monitor; + } + + return NULL; +} + +static void update_gpu_monitor_list( struct gdi_gpu *gpu, struct list *monitors ) +{ + struct gdi_adapter *adapters; + struct fs_monitor *monitor; + int count; + + if (!real_device_handler.get_adapters( gpu->id, &adapters, &count )) return; + + while (count--) + { + struct gdi_adapter *adapter = adapters + count; + BOOL is_primary = adapter->state_flags & DISPLAY_DEVICE_PRIMARY_DEVICE; + x11drv_settings_id settings_id; + DEVMODEW mode = {0}; + WCHAR devname[32]; + char buffer[32]; + + TRACE( "adapter %p id %p\n", adapter, (void *)adapter->id ); + + /* Get the settings handler id for the adapter */ + snprintf( buffer, sizeof(buffer), "\\\\.\\DISPLAY%d", count + 1 ); + asciiz_to_unicode( devname, buffer ); + if (!real_settings_handler.get_id( devname, is_primary, &settings_id )) break; + + if (!real_settings_handler.get_current_mode( settings_id, &mode )) + { + WARN( "Failed to get current display mode\n" ); + continue; + } + + if ((monitor = find_adapter_monitor( monitors, adapter, &mode ))) + { + TRACE( "Reusing monitor %p, mode %s\n", monitor, debugstr_devmode( &mode ) ); + list_remove( &monitor->entry ); + } + else if (!(monitor = calloc( 1, sizeof(*monitor) ))) + { + WARN( "Failed to allocate monitor\n" ); + continue; + } + else + { + monitor->gpu_id = gpu->id; + monitor->user_mode = mode; + monitor->real_mode = mode; + monitor->user_to_real_scale = 1.0; + monitor->top_left.x = mode.dmPosition.x; + monitor->top_left.y = mode.dmPosition.y; + + TRACE( "Created monitor %p, mode %s\n", monitor, debugstr_devmode( &mode ) ); + } + + monitor->settings_id = settings_id; + list_add_tail( &fs_monitors, &monitor->entry ); + } + + real_device_handler.free_adapters( adapters ); +} + +static void update_monitor_list( struct gdi_gpu *gpus, int count ) +{ + struct list monitors = LIST_INIT( monitors ); + struct fs_monitor *monitor, *next; + + list_move_tail( &monitors, &fs_monitors ); + + while (count--) + { + struct list gpu_monitors = LIST_INIT( gpu_monitors ); + struct gdi_gpu *gpu = gpus + count; + + TRACE( "gpu %p id %p\n", gpu, (void *)gpu->id ); + + LIST_FOR_EACH_ENTRY_SAFE( monitor, next, &monitors, struct fs_monitor, entry ) + { + if (monitor->gpu_id != gpu->id) continue; + list_remove( &monitor->entry ); + list_add_tail( &gpu_monitors, &monitor->entry ); + } + + update_gpu_monitor_list( gpu, &gpu_monitors ); + + list_move_tail( &monitors, &gpu_monitors ); + } + + LIST_FOR_EACH_ENTRY_SAFE( monitor, next, &monitors, struct fs_monitor, entry ) + { + TRACE( "Removing stale monitor %p with gpu id %p, adapter id %p\n", + monitor, (void *)monitor->gpu_id, (void *)monitor->settings_id.id ); + free( monitor ); + } +} + +static void modes_append( DEVMODEW *modes, UINT *mode_count, UINT *resolutions, DEVMODEW *mode ) +{ + BOOL is_new_resolution; + const char *appid; + int i; + + /* Titan Souls renders incorrectly if we report modes smaller than 800x600 */ + if ((appid = getenv( "SteamAppId" )) && !strcmp( appid, "297130" )) + { + if (mode->dmDisplayOrientation == DMDO_DEFAULT || mode->dmDisplayOrientation == DMDO_180) + { + if (mode->dmPelsHeight <= 600 && !(mode->dmPelsHeight == 600 && mode->dmPelsWidth == 800)) return; + } + else + { + if (mode->dmPelsWidth <= 600 && !(mode->dmPelsWidth == 600 && mode->dmPelsHeight == 800)) return; + } + } + + is_new_resolution = TRUE; + + for (i = 0; i < *mode_count; ++i) + { + if (modes[i].dmPelsWidth != mode->dmPelsWidth) continue; + if (modes[i].dmPelsHeight != mode->dmPelsHeight) continue; + is_new_resolution = FALSE; + + if (modes[i].dmBitsPerPel != mode->dmBitsPerPel) continue; + if (modes[i].dmDisplayFrequency != mode->dmDisplayFrequency) continue; + if (modes[i].dmDisplayOrientation != mode->dmDisplayOrientation) continue; + return; /* The exact mode is already added, nothing to do */ + } + + if (is_new_resolution) + { + /* Some games crash if we report too many unique resolutions (in terms of HxW) */ + if (limit_number_of_resolutions && *resolutions >= limit_number_of_resolutions) return; + *resolutions = *resolutions + 1; + } + + mode->dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | + DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY; + mode->dmSize = sizeof(DEVMODEW); + mode->dmDriverExtra = 0; + mode->dmDisplayFlags = 0; + + TRACE( "adding mode %s\n", debugstr_devmode(mode) ); + + modes[*mode_count] = *mode; + *mode_count = *mode_count + 1; +} + +static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UINT *mode_count ) +{ + UINT i, j, max_count, real_mode_count, resolutions = 0; + DEVMODEW *real_modes, *real_mode, mode_host = {0}; + + *mode_count = 0; + *modes = NULL; + + if (!real_settings_handler.get_current_mode( monitor->settings_id, &mode_host )) return; + /* Fullscreen hack doesn't support changing display orientations */ + if (!real_settings_handler.get_modes( monitor->settings_id, 0, &real_modes, &real_mode_count )) return; + + max_count = ARRAY_SIZE(fs_monitor_sizes) * DEPTH_COUNT + real_mode_count; + if (!(*modes = calloc( max_count, sizeof(DEVMODEW) ))) + { + real_settings_handler.free_modes( real_modes ); + return; + } + + /* Add the current mode early, in case we have to limit */ + modes_append( *modes, mode_count, &resolutions, &mode_host ); + + /* Linux reports far fewer resolutions than Windows. Add modes that some games may expect. */ + for (i = 0; i < ARRAY_SIZE(fs_monitor_sizes); ++i) + { + DEVMODEW mode = mode_host; + + if (mode_host.dmDisplayOrientation == DMDO_DEFAULT || + mode_host.dmDisplayOrientation == DMDO_180) + { + mode.dmPelsWidth = fs_monitor_sizes[i].cx; + mode.dmPelsHeight = fs_monitor_sizes[i].cy; + } + else + { + mode.dmPelsWidth = fs_monitor_sizes[i].cy; + mode.dmPelsHeight = fs_monitor_sizes[i].cx; + } + + /* Don't report modes that are larger than the current mode */ + if (mode.dmPelsWidth > mode_host.dmPelsWidth) continue; + if (mode.dmPelsHeight > mode_host.dmPelsHeight) continue; + + for (j = 0; j < DEPTH_COUNT; ++j) + { + mode.dmBitsPerPel = depths[j]; + mode.dmDisplayFrequency = 60; + modes_append( *modes, mode_count, &resolutions, &mode ); + } + } + + for (i = 0, real_mode = real_modes; i < real_mode_count; ++i) + { + DEVMODEW mode = *real_mode; + + /* Don't report modes that are larger than the current mode */ + if (mode.dmPelsWidth <= mode_host.dmPelsWidth && mode.dmPelsHeight <= mode_host.dmPelsHeight) + modes_append( *modes, mode_count, &resolutions, &mode ); + + real_mode = NEXT_DEVMODEW(real_mode); + } + + real_settings_handler.free_modes( real_modes ); +} + +static struct fs_monitor *monitor_from_settings_id( x11drv_settings_id settings_id ) +{ + struct fs_monitor *monitor; + struct gdi_gpu *gpus; + int count; + + LIST_FOR_EACH_ENTRY( monitor, &fs_monitors, struct fs_monitor, entry ) + if (!memcmp( &monitor->settings_id, &settings_id, sizeof(settings_id) )) return monitor; + + if (real_device_handler.get_gpus( &gpus, &count, FALSE )) + { + update_monitor_list( gpus, count ); + real_device_handler.free_gpus( gpus ); + + LIST_FOR_EACH_ENTRY( monitor, &fs_monitors, struct fs_monitor, entry ) + if (!memcmp( &monitor->settings_id, &settings_id, sizeof(settings_id) )) return monitor; + } + + WARN( "Failed to find monitor for adapter id %p\n", (void *)settings_id.id ); + return NULL; +} + +static BOOL fs_get_modes( x11drv_settings_id id, DWORD flags, DEVMODEW **new_modes, UINT *mode_count ) +{ + struct fs_monitor *monitor; + + TRACE( "id %#zx, flags %#x, modes %p, modes_count %p\n", + (size_t)id.id, (int)flags, new_modes, mode_count ); + + pthread_mutex_lock( &fs_lock ); + + if ((monitor = monitor_from_settings_id( id ))) + monitor_get_modes( monitor, new_modes, mode_count ); + + pthread_mutex_unlock( &fs_lock ); + return monitor && *new_modes; +} + +static void fs_free_modes( DEVMODEW *modes ) +{ + free( modes ); +} + +static BOOL fs_get_current_mode( x11drv_settings_id settings_id, DEVMODEW *mode ) +{ + struct fs_monitor *monitor; + + TRACE( "settings_id %p, mode %p\n", (void *)settings_id.id, mode ); + + pthread_mutex_lock( &fs_lock ); + if ((monitor = monitor_from_settings_id( settings_id ))) + *mode = monitor->user_mode; + pthread_mutex_unlock( &fs_lock ); + + return !!monitor; +} + +static LONG fs_set_current_mode( x11drv_settings_id settings_id, const DEVMODEW *user_mode ) +{ + static const WCHAR fshackW[] = {'f','s','h','a','c','k',0}; + struct fs_monitor *fs_monitor; + DEVMODEW real_mode; + double scale; + + TRACE( "settings_id %p, mode %s\n", (void *)settings_id.id, debugstr_devmode( user_mode ) ); + + pthread_mutex_lock( &fs_lock ); + + if (!(fs_monitor = monitor_from_settings_id( settings_id ))) + { + pthread_mutex_unlock( &fs_lock ); + return DISP_CHANGE_FAILED; + } + + if (is_detached_mode( &fs_monitor->real_mode ) && !is_detached_mode( user_mode )) + { + pthread_mutex_unlock( &fs_lock ); + FIXME( "Attaching adapters is unsupported with fullscreen hack.\n" ); + return DISP_CHANGE_SUCCESSFUL; + } + + /* Real modes may be changed since initialization */ + if (!real_settings_handler.get_current_mode( settings_id, &real_mode )) + { + pthread_mutex_unlock( &fs_lock ); + return DISP_CHANGE_FAILED; + } + + fs_monitor->user_mode = *user_mode; + fs_monitor->real_mode = real_mode; + lstrcpyW( fs_monitor->user_mode.dmDeviceName, fshackW ); + + if (is_detached_mode( user_mode )) + { + fs_monitor->user_to_real_scale = 0; + fs_monitor->top_left.x = 0; + fs_monitor->top_left.y = 0; + } + /* Integer scaling */ + else if (fs_hack_is_integer()) + { + scale = min( real_mode.dmPelsWidth / user_mode->dmPelsWidth, + real_mode.dmPelsHeight / user_mode->dmPelsHeight ); + fs_monitor->user_to_real_scale = scale; + fs_monitor->top_left.x = real_mode.dmPosition.x + + (real_mode.dmPelsWidth - user_mode->dmPelsWidth * scale) / 2; + fs_monitor->top_left.y = real_mode.dmPosition.y + + (real_mode.dmPelsHeight - user_mode->dmPelsHeight * scale) / 2; + } + /* If real mode is narrower than fake mode, scale to fit width */ + else if ((double)real_mode.dmPelsWidth / (double)real_mode.dmPelsHeight < + (double)user_mode->dmPelsWidth / (double)user_mode->dmPelsHeight) + { + scale = (double)real_mode.dmPelsWidth / (double)user_mode->dmPelsWidth; + fs_monitor->user_to_real_scale = scale; + fs_monitor->top_left.x = real_mode.dmPosition.x; + fs_monitor->top_left.y = real_mode.dmPosition.y + + (real_mode.dmPelsHeight - user_mode->dmPelsHeight * scale) / 2; + } + /* Else scale to fit height */ + else + { + scale = (double)real_mode.dmPelsHeight / (double)user_mode->dmPelsHeight; + fs_monitor->user_to_real_scale = scale; + fs_monitor->top_left.x = real_mode.dmPosition.x + + (real_mode.dmPelsWidth - user_mode->dmPelsWidth * scale) / 2; + fs_monitor->top_left.y = real_mode.dmPosition.y; + } + + TRACE( "real_mode x %d y %d width %d height %d\n", (int)real_mode.dmPosition.x, + (int)real_mode.dmPosition.y, (int)real_mode.dmPelsWidth, (int)real_mode.dmPelsHeight ); + TRACE( "user_mode x %d y %d width %d height %d\n", (int)user_mode->dmPosition.x, + (int)user_mode->dmPosition.y, (int)user_mode->dmPelsWidth, (int)user_mode->dmPelsHeight ); + TRACE( "user_to_real_scale %lf\n", fs_monitor->user_to_real_scale ); + TRACE( "top left corner:%s\n", wine_dbgstr_point( &fs_monitor->top_left ) ); + + pthread_mutex_unlock( &fs_lock ); + return DISP_CHANGE_SUCCESSFUL; +} + +/* Display device handler functions */ + +static BOOL fs_get_gpus( struct gdi_gpu **gpus, int *count, BOOL get_properties ) +{ + struct list monitors = LIST_INIT( monitors ); + + TRACE( "gpus %p, count %p\n", gpus, count ); + + if (!real_device_handler.get_gpus( gpus, count, get_properties )) return FALSE; + + pthread_mutex_lock( &fs_lock ); + update_monitor_list( *gpus, *count ); + pthread_mutex_unlock( &fs_lock ); + + return TRUE; +} + +static BOOL fs_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count ) +{ + struct fs_monitor *fs_monitor; + struct gdi_monitor *monitor; + RECT rect; + INT i; + + TRACE( "adapter_id %p, monitors %p, count %p\n", (void *)adapter_id, new_monitors, count ); + + if (!real_device_handler.get_monitors( adapter_id, new_monitors, count )) return FALSE; + + pthread_mutex_lock( &fs_lock ); + + for (i = 0; i < *count; ++i) + { + monitor = &(*new_monitors)[i]; + + LIST_FOR_EACH_ENTRY( fs_monitor, &fs_monitors, struct fs_monitor, entry ) + { + rect.left = fs_monitor->real_mode.dmPosition.x; + rect.top = fs_monitor->real_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->real_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->real_mode.dmPelsHeight; + + if (EqualRect( &rect, &monitor->rc_monitor )) + { + monitor->rc_monitor.left = fs_monitor->user_mode.dmPosition.x; + monitor->rc_monitor.top = fs_monitor->user_mode.dmPosition.y; + monitor->rc_monitor.right = monitor->rc_monitor.left + fs_monitor->user_mode.dmPelsWidth; + monitor->rc_monitor.bottom = monitor->rc_monitor.top + fs_monitor->user_mode.dmPelsHeight; + monitor->rc_work = monitor->rc_monitor; + monitor->state_flags = DISPLAY_DEVICE_ATTACHED; + if (fs_monitor->user_mode.dmPelsWidth && fs_monitor->user_mode.dmPelsHeight) + monitor->state_flags |= DISPLAY_DEVICE_ACTIVE; + } + } + } + + pthread_mutex_unlock( &fs_lock ); + + return TRUE; +} + +/* Fullscreen hack helpers */ + +static struct fs_monitor *monitor_from_handle( HMONITOR handle ) +{ + MONITORINFOEXW info = {.cbSize = sizeof(MONITORINFOEXW)}; + x11drv_settings_id settings_id; + BOOL is_primary; + + TRACE( "handle %p\n", handle ); + + if (!initialized) return NULL; + + if (!NtUserGetMonitorInfo( handle, (MONITORINFO *)&info )) return NULL; + is_primary = !!(info.dwFlags & MONITORINFOF_PRIMARY); + if (!real_settings_handler.get_id( info.szDevice, is_primary, &settings_id )) return FALSE; + return monitor_from_settings_id( settings_id ); +} + +/* Return whether fullscreen hack is enabled on a specific monitor */ +BOOL fs_hack_enabled( HMONITOR monitor ) +{ + struct fs_monitor *fs_monitor; + BOOL enabled = FALSE; + + TRACE( "monitor %p\n", monitor ); + + pthread_mutex_lock( &fs_lock ); + fs_monitor = monitor_from_handle( monitor ); + if (fs_monitor && (fs_monitor->user_mode.dmPelsWidth != fs_monitor->real_mode.dmPelsWidth || + fs_monitor->user_mode.dmPelsHeight != fs_monitor->real_mode.dmPelsHeight)) + enabled = TRUE; + pthread_mutex_unlock( &fs_lock ); + TRACE( "enabled: %s\n", enabled ? "TRUE" : "FALSE" ); + return enabled; +} + +BOOL fs_hack_mapping_required( HMONITOR monitor ) +{ + BOOL required; + + TRACE( "monitor %p\n", monitor ); + + /* steamcompmgr does our mapping for us */ + required = !wm_is_steamcompmgr( NULL ) && fs_hack_enabled( monitor ); + TRACE( "required: %s\n", required ? "TRUE" : "FALSE" ); + return required; +} + +/* Return whether integer scaling is on */ +BOOL fs_hack_is_integer(void) +{ + static int is_int = -1; + if (is_int < 0) + { + const char *e = getenv( "WINE_FULLSCREEN_INTEGER_SCALING" ); + is_int = e && strcmp( e, "0" ); + } + TRACE( "is_interger_scaling: %s\n", is_int ? "TRUE" : "FALSE" ); + return is_int; +} + +HMONITOR fs_hack_monitor_from_rect( const RECT *in_rect ) +{ + RECT rect = *in_rect; + + TRACE( "rect %s\n", wine_dbgstr_rect( &rect ) ); + rect.right = rect.left + 1; + rect.bottom = rect.top + 1; + return NtUserMonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY ); +} + +/* Get the monitor a window is on. MonitorFromWindow() doesn't work here because it finds the + * monitor with the maximum overlapped rectangle when a window is spanned over two monitors, whereas + * for the fullscreen hack, the monitor where the left top corner of the window is on is the correct + * one. For example, a game with a window of 3840x2160 changes the primary monitor to 1280x720, if + * there is a secondary monitor of 3840x2160 to the right, MonitorFromWindow() will return the + * secondary monitor instead of the primary one. */ +HMONITOR fs_hack_monitor_from_hwnd( HWND hwnd ) +{ + RECT rect = {0}; + + if (!NtUserGetWindowRect( hwnd, &rect )) ERR( "Invalid hwnd %p.\n", hwnd ); + + TRACE( "hwnd %p rect %s\n", hwnd, wine_dbgstr_rect( &rect ) ); + return fs_hack_monitor_from_rect( &rect ); +} + +/* Return the rectangle of a monitor in current mode in user virtual screen coordinates */ +RECT fs_hack_current_mode( HMONITOR monitor ) +{ + struct fs_monitor *fs_monitor; + RECT rect = {0}; + + TRACE( "monitor %p\n", monitor ); + + pthread_mutex_lock( &fs_lock ); + fs_monitor = monitor_from_handle( monitor ); + if (!fs_monitor) + { + pthread_mutex_unlock( &fs_lock ); + return rect; + } + + rect.left = fs_monitor->user_mode.dmPosition.x; + rect.top = fs_monitor->user_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->user_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->user_mode.dmPelsHeight; + pthread_mutex_unlock( &fs_lock ); + TRACE( "current mode rect: %s\n", wine_dbgstr_rect( &rect ) ); + return rect; +} + +/* Return the rectangle of a monitor in real mode in real virtual screen coordinates */ +RECT fs_hack_real_mode( HMONITOR monitor ) +{ + struct fs_monitor *fs_monitor; + RECT rect = {0}; + + TRACE( "monitor %p\n", monitor ); + + pthread_mutex_lock( &fs_lock ); + fs_monitor = monitor_from_handle( monitor ); + if (!fs_monitor) + { + pthread_mutex_unlock( &fs_lock ); + return rect; + } + + rect.left = fs_monitor->real_mode.dmPosition.x; + rect.top = fs_monitor->real_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->real_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->real_mode.dmPelsHeight; + pthread_mutex_unlock( &fs_lock ); + TRACE( "real mode rect: %s\n", wine_dbgstr_rect( &rect ) ); + return rect; +} + +/* Return whether width and height are the same as the current mode used by a monitor */ +BOOL fs_hack_matches_current_mode( HMONITOR monitor, INT width, INT height ) +{ + MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; + BOOL matched; + + TRACE( "monitor %p\n", monitor ); + + if (!NtUserGetMonitorInfo( monitor, &info )) return FALSE; + + matched = (width == info.rcMonitor.right - info.rcMonitor.left) && + (height == info.rcMonitor.bottom - info.rcMonitor.top); + TRACE( "matched: %s\n", matched ? "TRUE" : "FALSE" ); + + return matched; +} + +/* Transform a point in user virtual screen coordinates to real virtual screen coordinates */ +void fs_hack_point_user_to_real( POINT *pos ) +{ + struct fs_monitor *fs_monitor; + RECT rect; + + TRACE( "from %s\n", wine_dbgstr_point( pos ) ); + + if (wm_is_steamcompmgr( NULL )) return; + + pthread_mutex_lock( &fs_lock ); + LIST_FOR_EACH_ENTRY( fs_monitor, &fs_monitors, struct fs_monitor, entry ) + { + rect.left = fs_monitor->user_mode.dmPosition.x; + rect.top = fs_monitor->user_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->user_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->user_mode.dmPelsHeight; + + if (PtInRect( &rect, *pos )) + { + pos->x -= fs_monitor->user_mode.dmPosition.x; + pos->y -= fs_monitor->user_mode.dmPosition.y; + pos->x = lround( pos->x * fs_monitor->user_to_real_scale ); + pos->y = lround( pos->y * fs_monitor->user_to_real_scale ); + pos->x += fs_monitor->top_left.x; + pos->y += fs_monitor->top_left.y; + pthread_mutex_unlock( &fs_lock ); + TRACE( "to %s\n", wine_dbgstr_point( pos ) ); + return; + } + } + pthread_mutex_unlock( &fs_lock ); + WARN( "%s not transformed.\n", wine_dbgstr_point( pos ) ); +} + +/* Transform a point in real virtual screen coordinates to user virtual screen coordinates */ +void fs_hack_point_real_to_user( POINT *pos ) +{ + struct fs_monitor *fs_monitor; + RECT rect; + + TRACE( "from %s\n", wine_dbgstr_point( pos ) ); + + if (wm_is_steamcompmgr( NULL )) return; + + pthread_mutex_lock( &fs_lock ); + LIST_FOR_EACH_ENTRY( fs_monitor, &fs_monitors, struct fs_monitor, entry ) + { + rect.left = fs_monitor->real_mode.dmPosition.x; + rect.top = fs_monitor->real_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->real_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->real_mode.dmPelsHeight; + + if (PtInRect( &rect, *pos )) + { + pos->x -= fs_monitor->top_left.x; + pos->y -= fs_monitor->top_left.y; + pos->x = lround( pos->x / fs_monitor->user_to_real_scale ); + pos->y = lround( pos->y / fs_monitor->user_to_real_scale ); + pos->x += fs_monitor->user_mode.dmPosition.x; + pos->y += fs_monitor->user_mode.dmPosition.y; + pos->x = max( pos->x, fs_monitor->user_mode.dmPosition.x ); + pos->y = max( pos->y, fs_monitor->user_mode.dmPosition.y ); + pos->x = min( pos->x, fs_monitor->user_mode.dmPosition.x + + (INT)fs_monitor->user_mode.dmPelsWidth - 1 ); + pos->y = min( pos->y, fs_monitor->user_mode.dmPosition.y + + (INT)fs_monitor->user_mode.dmPelsHeight - 1 ); + pthread_mutex_unlock( &fs_lock ); + TRACE( "to %s\n", wine_dbgstr_point( pos ) ); + return; + } + } + pthread_mutex_unlock( &fs_lock ); + WARN( "%s not transformed.\n", wine_dbgstr_point( pos ) ); +} + +/* Transform RGNDATA in user virtual screen coordinates to real virtual screen coordinates. + * This is for clipping. Be sure to use Unsorted for Xlib calls after this transformation because + * this may break the requirement of using YXBanded. For example, say there are two monitors aligned + * horizontally with the primary monitor on the right. Each of monitor is of real resolution + * 1920x1080 and the fake primary monitor resolution is 1024x768. Then (0, 10, 1024, 768) should be + * transformed to (0, 14, 1920, 1080). While (1024, 10, 2944, 1080) should be transformed to + * (1920, 10, 3840, 1080) and this is breaking YXBanded because it requires y in non-decreasing order */ +void fs_hack_rgndata_user_to_real( RGNDATA *data ) +{ + unsigned int i; + XRectangle *xrect; + RECT rect; + + if (!data || wm_is_steamcompmgr( NULL )) return; + + xrect = (XRectangle *)data->Buffer; + for (i = 0; i < data->rdh.nCount; i++) + { + rect.left = xrect[i].x; + rect.top = xrect[i].y; + rect.right = xrect[i].x + xrect[i].width; + rect.bottom = xrect[i].y + xrect[i].height; + TRACE( "from rect %s\n", wine_dbgstr_rect( &rect ) ); + fs_hack_rect_user_to_real( &rect ); + TRACE( "to rect %s\n", wine_dbgstr_rect( &rect ) ); + xrect[i].x = rect.left; + xrect[i].y = rect.top; + xrect[i].width = rect.right - rect.left; + xrect[i].height = rect.bottom - rect.top; + } +} + +/* Transform a rectangle in user virtual screen coordinates to real virtual screen coordinates. A + * difference compared to fs_hack_point_user_to_real() is that fs_hack_point_user_to_real() finds + * the wrong monitor if the point is on the right edge of the monitor rectangle. For example, when + * there are two monitors of real size 1920x1080, the primary monitor is of user mode 1024x768 and + * the secondary monitor is to the right. Rectangle (0, 0, 1024, 768) should transform to + * (0, 0, 1920, 1080). If (1024, 768) is passed to fs_hack_point_user_to_real(), + * fs_hack_point_user_to_real() will think (1024, 768) is on the secondary monitor, ends up + * returning a wrong result to callers. */ +void fs_hack_rect_user_to_real( RECT *rect ) +{ + struct fs_monitor *fs_monitor; + HMONITOR monitor; + RECT point; + + TRACE( "from %s\n", wine_dbgstr_rect( rect ) ); + + if (wm_is_steamcompmgr( NULL )) return; + + SetRect( &point, rect->left, rect->top, rect->left + 1, rect->top + 1 ); + monitor = NtUserMonitorFromRect( &point, MONITOR_DEFAULTTONEAREST ); + pthread_mutex_lock( &fs_lock ); + fs_monitor = monitor_from_handle( monitor ); + if (!fs_monitor) + { + pthread_mutex_unlock( &fs_lock ); + WARN( "%s not transformed.\n", wine_dbgstr_rect( rect ) ); + return; + } + + OffsetRect( rect, -fs_monitor->user_mode.dmPosition.x, + -fs_monitor->user_mode.dmPosition.y ); + rect->left = lround( rect->left * fs_monitor->user_to_real_scale ); + rect->right = lround( rect->right * fs_monitor->user_to_real_scale ); + rect->top = lround( rect->top * fs_monitor->user_to_real_scale ); + rect->bottom = lround( rect->bottom * fs_monitor->user_to_real_scale ); + OffsetRect( rect, fs_monitor->top_left.x, fs_monitor->top_left.y ); + pthread_mutex_unlock( &fs_lock ); + TRACE( "to %s\n", wine_dbgstr_rect( rect ) ); +} + +/* Get the user_to_real_scale value in a monitor */ +double fs_hack_get_user_to_real_scale( HMONITOR monitor ) +{ + struct fs_monitor *fs_monitor; + double scale = 1.0; + + TRACE( "monitor %p\n", monitor ); + + if (wm_is_steamcompmgr( NULL )) return scale; + + pthread_mutex_lock( &fs_lock ); + fs_monitor = monitor_from_handle( monitor ); + if (!fs_monitor) + { + pthread_mutex_unlock( &fs_lock ); + return scale; + } + scale = fs_monitor->user_to_real_scale; + + pthread_mutex_unlock( &fs_lock ); + TRACE( "scale %lf\n", scale ); + return scale; +} + +/* Get the scaled scree size of a monitor */ +SIZE fs_hack_get_scaled_screen_size( HMONITOR monitor ) +{ + struct fs_monitor *fs_monitor; + SIZE size = {0}; + + TRACE( "monitor %p\n", monitor ); + + pthread_mutex_lock( &fs_lock ); + fs_monitor = monitor_from_handle( monitor ); + if (!fs_monitor) + { + pthread_mutex_unlock( &fs_lock ); + return size; + } + + if (wm_is_steamcompmgr( NULL )) + { + pthread_mutex_unlock( &fs_lock ); + size.cx = fs_monitor->user_mode.dmPelsWidth; + size.cy = fs_monitor->user_mode.dmPelsHeight; + TRACE( "width %d height %d\n", (int)size.cx, (int)size.cy ); + return size; + } + + size.cx = lround( fs_monitor->user_mode.dmPelsWidth * fs_monitor->user_to_real_scale ); + size.cy = lround( fs_monitor->user_mode.dmPelsHeight * fs_monitor->user_to_real_scale ); + pthread_mutex_unlock( &fs_lock ); + TRACE( "width %d height %d\n", (int)size.cx, (int)size.cy ); + return size; +} + +/* Get the real virtual screen size instead of virtual screen size using fake modes */ +RECT fs_hack_get_real_virtual_screen(void) +{ + struct fs_monitor *fs_monitor; + RECT rect, virtual = {0}; + + pthread_mutex_lock( &fs_lock ); + LIST_FOR_EACH_ENTRY( fs_monitor, &fs_monitors, struct fs_monitor, entry ) + { + rect.left = fs_monitor->real_mode.dmPosition.x; + rect.top = fs_monitor->real_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->real_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->real_mode.dmPelsHeight; + + union_rect( &virtual, &virtual, &rect ); + } + pthread_mutex_unlock( &fs_lock ); + TRACE( "real virtual screen rect:%s\n", wine_dbgstr_rect( &virtual ) ); + return virtual; +} + +/* Initialize the fullscreen hack, which is a layer on top of real settings handlers and real + * display device handlers */ +void fs_hack_init(void) +{ + struct x11drv_display_device_handler device_handler; + struct x11drv_settings_handler settings_handler; + struct gdi_gpu *gpus; + int count; + + real_device_handler = X11DRV_DisplayDevices_GetHandler(); + real_settings_handler = X11DRV_Settings_GetHandler(); + + settings_handler.name = "Fullscreen Hack"; + settings_handler.priority = 500; + settings_handler.get_id = real_settings_handler.get_id; + settings_handler.get_modes = fs_get_modes; + settings_handler.free_modes = fs_free_modes; + settings_handler.get_current_mode = fs_get_current_mode; + settings_handler.set_current_mode = fs_set_current_mode; + X11DRV_Settings_SetHandler( &settings_handler ); + + device_handler.name = "Fullscreen Hack"; + device_handler.priority = 500; + device_handler.get_gpus = fs_get_gpus; + device_handler.get_adapters = real_device_handler.get_adapters; + device_handler.get_monitors = fs_get_monitors; + device_handler.free_gpus = real_device_handler.free_gpus; + device_handler.free_adapters = real_device_handler.free_adapters; + device_handler.free_monitors = real_device_handler.free_monitors; + device_handler.register_event_handlers = NULL; + X11DRV_DisplayDevices_SetHandler( &device_handler ); + + if (!real_device_handler.get_gpus( &gpus, &count, FALSE )) + { + ERR("Failed to initialize fshack monitor list.\n"); + return; + } + + pthread_mutex_lock( &fs_lock ); + update_monitor_list( gpus, count ); + pthread_mutex_unlock( &fs_lock ); + real_device_handler.free_gpus( gpus ); + + initialized = TRUE; +} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 6f209e9ac7f..9828d164192 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -459,6 +459,8 @@ extern char *process_name; extern Display *clipboard_display; extern WNDPROC client_foreign_window_proc; +extern int limit_number_of_resolutions; + /* atoms */ enum x11drv_atoms @@ -626,6 +628,7 @@ struct x11drv_win_data XIC xic; /* X input context */ UINT managed : 1; /* is window managed? */ UINT mapped : 1; /* is window mapped? (in either normal or iconic state) */ + UINT fs_hack : 1; /* is window forced / faking fullscreen? */ UINT iconic : 1; /* is window in iconic state? */ UINT embedded : 1; /* is window an XEMBED client? */ UINT shaped : 1; /* is window using a custom region shape? */ @@ -683,6 +686,24 @@ extern void init_win_context(void); extern void *file_list_to_drop_files( const void *data, size_t size, size_t *ret_size ); extern void *uri_list_to_drop_files( const void *data, size_t size, size_t *ret_size ); +extern BOOL fs_hack_enabled( HMONITOR monitor ); +extern BOOL fs_hack_mapping_required( HMONITOR monitor ); +extern BOOL fs_hack_is_integer(void); +extern HMONITOR fs_hack_monitor_from_hwnd( HWND hwnd ); +extern HMONITOR fs_hack_monitor_from_rect( const RECT *rect ); +extern BOOL fs_hack_matches_current_mode( HMONITOR monitor, INT width, INT height ); +extern RECT fs_hack_current_mode( HMONITOR monitor ); +extern RECT fs_hack_real_mode( HMONITOR monitor ); +extern void fs_hack_point_user_to_real( POINT *pos ); +extern void fs_hack_point_real_to_user( POINT *pos ); +extern void fs_hack_rect_user_to_real( RECT *rect ); +extern void fs_hack_rgndata_user_to_real( RGNDATA *data ); +extern double fs_hack_get_user_to_real_scale( HMONITOR ); +extern SIZE fs_hack_get_scaled_screen_size( HMONITOR monitor ); +extern RECT fs_hack_get_real_virtual_screen(void); +extern void fs_hack_init(void); +extern int mode_compare( const void *p1, const void *p2 ); + static inline void mirror_rect( const RECT *window_rect, RECT *rect ) { int width = window_rect->right - window_rect->left; @@ -770,6 +791,7 @@ struct x11drv_settings_handler LONG (*set_current_mode)(x11drv_settings_id id, const DEVMODEW *mode); }; +extern struct x11drv_settings_handler X11DRV_Settings_GetHandler(void); extern void X11DRV_Settings_SetHandler(const struct x11drv_settings_handler *handler); extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ); @@ -825,6 +847,7 @@ struct x11drv_display_device_handler void (*register_event_handlers)(void); }; +extern struct x11drv_display_device_handler X11DRV_DisplayDevices_GetHandler(void); extern void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *handler); extern void X11DRV_DisplayDevices_Init(BOOL force); extern void X11DRV_DisplayDevices_RegisterEventHandlers(void); @@ -919,6 +942,30 @@ static inline BOOL intersect_rect( RECT *dst, const RECT *src1, const RECT *src2 return !IsRectEmpty( dst ); } +static inline void union_rect( RECT *dest, const RECT *src1, const RECT *src2 ) +{ + if (IsRectEmpty( src1 )) + { + if (IsRectEmpty( src2 )) + { + reset_bounds( dest ); + return; + } + else *dest = *src2; + } + else + { + if (IsRectEmpty( src2 )) *dest = *src1; + else + { + dest->left = min( src1->left, src2->left ); + dest->right = max( src1->right, src2->right ); + dest->top = min( src1->top, src2->top ); + dest->bottom = max( src1->bottom, src2->bottom ); + } + } +} + /* registry helpers */ extern HKEY open_hkcu_key( const char *name ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 1675d462dc3..46b35b03782 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -68,7 +68,7 @@ Atom systray_atom = 0; HWND systray_hwnd = 0; unsigned int screen_bpp; Window root_window; -BOOL usexvidmode = TRUE; +BOOL usexvidmode = FALSE; BOOL usexrandr = TRUE; BOOL usexcomposite = TRUE; BOOL use_take_focus = TRUE; @@ -84,6 +84,7 @@ BOOL client_side_with_render = TRUE; BOOL shape_layered_windows = TRUE; int copy_default_colors = 128; int alloc_system_colors = 256; +int limit_number_of_resolutions = 0; int xrender_error_base = 0; char *process_name = NULL; WNDPROC client_foreign_window_proc = NULL; @@ -530,6 +531,9 @@ static void setup_options(void) if (!get_config_key( hkey, appkey, "AllocSystemColors", buffer, sizeof(buffer) )) alloc_system_colors = wcstol( buffer, NULL, 0 ); + if (!get_config_key( hkey, appkey, "LimitNumberOfResolutions", buffer, sizeof(buffer) )) + limit_number_of_resolutions = wcstol( buffer, NULL, 0 ); + get_config_key( hkey, appkey, "InputStyle", input_style, sizeof(input_style) ); NtClose( appkey ); @@ -709,6 +713,11 @@ static NTSTATUS x11drv_init( void *arg ) X11DRV_InitKeyboard( gdi_display ); if (use_xim) use_xim = xim_init( input_style ); + { + const char *e = getenv("WINE_DISABLE_FULLSCREEN_HACK"); + if (!e || *e == '\0' || *e == '0') fs_hack_init(); + } + { const char *sgi = getenv("SteamGameId"); const char *e = getenv("WINE_LAYERED_WINDOW_CLIENT_HACK"); From d08461b3cbd308ae446a13d7167357b149872522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 21:27:30 +0100 Subject: [PATCH 0208/1506] fshack: wine.inf: Limit resolution count for some games. These games have a bug where they crash with more than about 32 resolutions. This happens even on Windows. --- loader/wine.inf.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index e8b038f448e..39c38109ffc 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2756,3 +2756,8 @@ HKCU,Software\Wine\DllOverrides,"msvcr140",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"ucrtbase",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"vcomp140",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"vcruntime140",0x2,"native,builtin" +;;App-specific overrides to limit the number of resolutions +HKCU,Software\Wine\AppDefaults\DarkSoulsIII.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" +HKCU,Software\Wine\AppDefaults\sekiro.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" +HKCU,Software\Wine\AppDefaults\NieRAutomata.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" +HKCU,Software\Wine\AppDefaults\SpellForce.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"16" From ab6305dfa636c6371ec36102a169384e959b7cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:32 +0100 Subject: [PATCH 0209/1506] fshack: winex11: Remap mouse coordinates when fshack is active. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on work by Zhiyi Zhang, includes work by Giovanni Mascellani, Rémi Bernon, Arkadiusz Hiler, Kai Krakow, Joshua Ashton, Zebediah Figura, and Matteo Bruni. --- dlls/winex11.drv/mouse.c | 46 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 612fff9995c..fecd55488bd 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -351,6 +351,7 @@ static BOOL grab_clipping_window( const RECT *clip ) Window clip_window; HCURSOR cursor; POINT pos; + RECT real_clip; /* don't clip in the desktop process */ if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) return TRUE; @@ -379,9 +380,21 @@ static BOOL grab_clipping_window( const RECT *clip ) TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window ); if (!data->clipping_cursor) XUnmapWindow( data->display, clip_window ); + + TRACE( "user clip rect %s\n", wine_dbgstr_rect( clip ) ); + + real_clip = *clip; + fs_hack_rect_user_to_real( &real_clip ); + pos = virtual_screen_to_root( clip->left, clip->top ); + + TRACE( "setting real clip to %s x (%d,%d)\n", wine_dbgstr_point( &pos ), + (int)real_clip.right - (int)real_clip.left, + (int)real_clip.bottom - (int)real_clip.top ); + XMoveResizeWindow( data->display, clip_window, pos.x, pos.y, - max( 1, clip->right - clip->left ), max( 1, clip->bottom - clip->top ) ); + max( 1, real_clip.right - real_clip.left ), + max( 1, real_clip.bottom - real_clip.top ) ); XMapWindow( data->display, clip_window ); /* if the rectangle is shrinking we may get a pointer warp */ @@ -485,11 +498,17 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x thread_data = x11drv_thread_data(); if (!thread_data->clipping_cursor) return; if (thread_data->clip_window != window) return; - pt.x += clip_rect.left; - pt.y += clip_rect.top; + pt.x = clip_rect.left; + pt.y = clip_rect.top; + fs_hack_point_user_to_real( &pt ); + + pt.x += input->mi.dx; + pt.y += input->mi.dy; + fs_hack_point_real_to_user( &pt ); } else if ((data = get_win_data( hwnd ))) { + if (data->fs_hack) fs_hack_point_real_to_user( &pt ); if (window == root_window) pt = root_to_virtual_screen( pt.x, pt.y ); else if (event_root == root_window) pt = root_to_virtual_screen( x_root, y_root ); else @@ -1388,6 +1407,8 @@ BOOL X11DRV_SetCursorPos( INT x, INT y ) return FALSE; } + TRACE( "real setting to %s\n", wine_dbgstr_point( &pos ) ); + XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0, pos.x, pos.y ); data->warp_serial = NextRequest( data->display ); @@ -1396,7 +1417,7 @@ BOOL X11DRV_SetCursorPos( INT x, INT y ) XNoOp( data->display ); XFlush( data->display ); /* avoids bad mouse lag in games that do their own mouse warping */ - TRACE( "warped to %d,%d serial %lu\n", x, y, data->warp_serial ); + TRACE( "warped to (fake) %d,%d serial %lu\n", x, y, data->warp_serial ); return TRUE; } @@ -1721,6 +1742,23 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) return FALSE; } + if (input->mi.dwFlags & MOUSEEVENTF_ABSOLUTE) + fs_hack_point_real_to_user( (POINT *)&input->mi.dx ); + else + { + double user_to_real_scale; + HMONITOR monitor; + RECT rect; + POINT pt; + + NtUserGetCursorPos( &pt ); + SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 ); + monitor = NtUserMonitorFromRect( &rect, MONITOR_DEFAULTTONULL ); + user_to_real_scale = fs_hack_get_user_to_real_scale( monitor ); + input->mi.dx = lround( (double)input->mi.dx / user_to_real_scale ); + input->mi.dy = lround( (double)input->mi.dy / user_to_real_scale ); + } + return TRUE; } From 54ccd98b1ee37858eefb5c4ea0be60cbf2eadfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 19:43:59 +0100 Subject: [PATCH 0210/1506] fshack: winex11: Force windows fullscreen state when fshack is active. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on work by Zhiyi Zhang, includes work by Giovanni Mascellani, Rémi Bernon, Arkadiusz Hiler, Kai Krakow, Joshua Ashton, Zebediah Figura, and Matteo Bruni. fshack: winex11: Use gdi_display for client_window requests. CW-Bug-Id: 16608 fshack: winex11: Resize child window client_windows too. CW-Bug-Id: 16608 fshack: winex11: Factor and fix fshack window resize helper. Fixing some incorrect window positions with Proton 8.0. --- dlls/win32u/window.c | 38 +++++++ dlls/winex11.drv/event.c | 18 +++- dlls/winex11.drv/window.c | 203 +++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/x11drv.h | 1 - include/ntuser.h | 13 +++ 5 files changed, 265 insertions(+), 8 deletions(-) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 69dd8caba5d..946115c1f46 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -652,6 +652,38 @@ HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *class, DWO return NULL; } +static BOOL enum_window_children( HWND *list, WNDENUMPROC func, LPARAM lParam ) +{ + HWND *child_list; + BOOL ret = FALSE; + + for ( ; *list; list++) + { + if (!is_window( *list )) continue; + child_list = list_window_children( 0, *list, NULL, 0 ); + ret = func( *list, lParam ); + if (child_list) + { + if (ret) ret = enum_window_children( child_list, func, lParam ); + free( child_list ); + } + if (!ret) return FALSE; + } + + return TRUE; +} + +static BOOL enum_child_windows( HWND parent, WNDENUMPROC func, LPARAM lParam ) +{ + HWND *list; + BOOL ret; + + if (!(list = list_window_children( 0, parent, NULL, 0 ))) return FALSE; + ret = enum_window_children( list, func, lParam ); + free( list ); + return ret; +} + /***************************************************************** * NtUserGetAncestor (win32u.@) */ @@ -5590,6 +5622,12 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) case NtUserCallHwndParam_ShowOwnedPopups: return show_owned_popups( hwnd, param ); + case NtUserCallHwndParam_EnumChildWindows: + { + struct enum_child_windows_params *params = (void *)param; + return enum_child_windows( hwnd, params->proc, params->lparam ); + } + /* temporary exports */ case NtUserSetWindowStyle: { diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 97ebf4ae0d6..77b7fa50db6 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1085,8 +1085,21 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) } else pos = root_to_virtual_screen( x, y ); - X11DRV_X_to_window_rect( data, &rect, pos.x, pos.y, event->width, event->height ); - if (root_coords) NtUserMapWindowPoints( 0, parent, (POINT *)&rect, 2 ); + if (data->fs_hack) + { + MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; + HMONITOR monitor; + + monitor = fs_hack_monitor_from_hwnd( hwnd ); + NtUserGetMonitorInfo( monitor, &info ); + rect = info.rcMonitor; + TRACE( "monitor %p rect: %s\n", monitor, wine_dbgstr_rect( &rect ) ); + } + else + { + X11DRV_X_to_window_rect( data, &rect, pos.x, pos.y, event->width, event->height ); + if (root_coords) NtUserMapWindowPoints( 0, parent, (POINT *)&rect, 2 ); + } TRACE( "win %p/%lx new X rect %d,%d,%dx%d (event %d,%d,%dx%d)\n", hwnd, data->whole_window, (int)rect.left, (int)rect.top, @@ -1460,6 +1473,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) Window win, w_aux_root, w_aux_child; if (!(data = get_win_data( hWnd ))) return; + ERR( "TODO: fs hack\n" ); cx = data->whole_rect.right - data->whole_rect.left; cy = data->whole_rect.bottom - data->whole_rect.top; win = data->whole_window; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a888bd4e316..019f0c59293 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -468,6 +468,12 @@ static void sync_window_region( struct x11drv_win_data *data, HRGN win_region ) HRGN hrgn = win_region; if (!data->whole_window) return; + + if (data->fs_hack) + { + ERR( "shaped windows with fs hack not supported, things may go badly\n" ); + } + data->shaped = FALSE; if (IsRectEmpty( &data->window_rect )) /* set an empty shape */ @@ -1170,6 +1176,7 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) void update_net_wm_states( struct x11drv_win_data *data ) { UINT i, style, ex_style, new_state = 0; + HMONITOR monitor; if (!data->managed) return; if (data->whole_window == root_window) @@ -1181,12 +1188,19 @@ void update_net_wm_states( struct x11drv_win_data *data ) style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); if (style & WS_MINIMIZE) new_state |= data->net_wm_state & ((1 << NET_WM_STATE_FULLSCREEN)|(1 << NET_WM_STATE_MAXIMIZED)); - if (NtUserIsWindowRectFullScreen( &data->whole_rect )) + monitor = fs_hack_monitor_from_hwnd( data->hwnd ); + if ((!data->fs_hack || fs_hack_enabled( monitor )) && NtUserIsWindowRectFullScreen( &data->whole_rect )) { if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) new_state |= (1 << NET_WM_STATE_MAXIMIZED); else if (!(style & WS_MINIMIZE)) - new_state |= (1 << NET_WM_STATE_FULLSCREEN); + { + if (!wm_is_steamcompmgr( data->display ) || !fs_hack_enabled( monitor )) + { + /* when fs hack is enabled, we don't want steamcompmgr to resize the window to be fullscreened */ + new_state |= (1 << NET_WM_STATE_FULLSCREEN); + } + } } else if (style & WS_MAXIMIZE) new_state |= (1 << NET_WM_STATE_MAXIMIZED); @@ -1482,8 +1496,22 @@ static void sync_window_position( struct x11drv_win_data *data, /* resizing a managed maximized window is not allowed */ if (!(style & WS_MAXIMIZE) || !data->managed) { - changes.width = data->whole_rect.right - data->whole_rect.left; - changes.height = data->whole_rect.bottom - data->whole_rect.top; + if (data->fs_hack) + { + HMONITOR monitor; + RECT rect; + + monitor = fs_hack_monitor_from_hwnd( data->hwnd ); + rect = fs_hack_real_mode( monitor ); + changes.width = rect.right - rect.left; + changes.height = rect.bottom - rect.top; + TRACE( "change width:%d height:%d\n", changes.width, changes.height ); + } + else + { + changes.width = data->whole_rect.right - data->whole_rect.left; + changes.height = data->whole_rect.bottom - data->whole_rect.top; + } /* if window rect is empty force size to 1x1 */ if (changes.width <= 0 || changes.height <= 0) changes.width = changes.height = 1; if (changes.width > 65535) changes.width = 65535; @@ -1566,6 +1594,21 @@ static void sync_client_position( struct x11drv_win_data *data, if (changes.width != old_client_rect->right - old_client_rect->left) mask |= CWWidth; if (changes.height != old_client_rect->bottom - old_client_rect->top) mask |= CWHeight; + if (data->fs_hack) + { + HMONITOR monitor; + RECT rect; + + monitor = fs_hack_monitor_from_hwnd( data->hwnd ); + rect = fs_hack_real_mode( monitor ); + changes.x = 0; + changes.y = 0; + changes.width = rect.right - rect.left; + changes.height = rect.bottom - rect.top; + mask = CWX | CWY | CWWidth | CWHeight; + TRACE( "x:%d y:%d width:%d height:%d\n", changes.x, changes.y, changes.width, changes.height ); + } + if (mask) { TRACE( "setting client win %lx pos %d,%d,%dx%d changes=%x\n", @@ -1800,6 +1843,18 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo cx = min( max( 1, data->client_rect.right - data->client_rect.left ), 65535 ); cy = min( max( 1, data->client_rect.bottom - data->client_rect.top ), 65535 ); + if (data->fs_hack) + { + HMONITOR monitor = fs_hack_monitor_from_hwnd( hwnd ); + RECT rect = fs_hack_real_mode( monitor ); + cx = rect.right - rect.left; + cy = rect.bottom - rect.top; + + TRACE( "width:%d height:%d\n", cx, cy ); + } + + TRACE( "setting client rect: %u, %u x %ux%u\n", x, y, cx, cy ); + /* NOTE: Creating the client windows as child of dummy parent has bad interactions with * Steam Overlay and will cause whole_window to minimize when the overlay opens... */ parent_window = data->whole_window ? data->whole_window : get_dummy_parent(); @@ -1812,6 +1867,9 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo attach_client_window( data, client_window ); XMapWindow( gdi_display, data->client_window ); + /* Save to gdi_display as well for fullscreen hack, needed in X11DRV_query_fs_hack() */ + XSaveContext( gdi_display, data->client_window, winContext, (char *)data->hwnd ); + TRACE( "%p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); } @@ -1855,11 +1913,26 @@ static void create_whole_window( struct x11drv_win_data *data ) mask = get_window_attributes( data, &attr ); + attr.background_pixel = XBlackPixel( data->display, data->vis.screen ); + mask |= CWBackPixel; + if (!(cx = data->whole_rect.right - data->whole_rect.left)) cx = 1; else if (cx > 65535) cx = 65535; if (!(cy = data->whole_rect.bottom - data->whole_rect.top)) cy = 1; else if (cy > 65535) cy = 65535; + if (data->fs_hack) + { + RECT rect = {0, 0, 0, 0}; + HMONITOR monitor; + + monitor = fs_hack_monitor_from_hwnd( data->hwnd ); + rect = fs_hack_real_mode( monitor ); + cx = rect.right - rect.left; + cy = rect.bottom - rect.top; + TRACE( "width:%d height:%d\n", cx, cy ); + } + pos = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top ); data->whole_window = XCreateWindow( data->display, root_window, pos.x, pos.y, cx, cy, 0, data->vis.depth, InputOutput, @@ -2727,6 +2800,85 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec return TRUE; } +static BOOL CALLBACK update_child_window_fshack( HWND hwnd, LPARAM enable ); + +static void window_update_fshack( struct x11drv_win_data *data, const RECT *window_rect_virt, + const RECT *client_rect_virt, BOOL enable ) +{ + BOOL set_hints = window_rect_virt == NULL; /* don't change hints yet in X11DRV_WindowPosChanging */ + RECT window_rect_host, client_rect_host; + + if (wm_is_steamcompmgr( data->display )) return; + if (!!data->fs_hack == !!enable) return; + data->fs_hack = enable; + + if (!window_rect_virt) window_rect_virt = &data->window_rect; + if (!client_rect_virt) client_rect_virt = &data->client_rect; + + if (!enable) + { + window_rect_host = *window_rect_virt; + client_rect_host = data->client_rect; + OffsetRect( &client_rect_host, -data->whole_rect.left, -data->whole_rect.top ); + } + else + { + HMONITOR monitor = fs_hack_monitor_from_hwnd( data->hwnd ); + window_rect_host = fs_hack_real_mode( monitor ); + + if (data->whole_window) /* HACK: top-level window, pretend client rect covers it fully */ + client_rect_host = window_rect_host; + else + { + client_rect_host = *client_rect_virt; + NtUserClientToScreen( data->hwnd, (POINT *)&client_rect_host.left ); + NtUserClientToScreen( data->hwnd, (POINT *)&client_rect_host.right ); + fs_hack_rect_user_to_real( &client_rect_host ); + OffsetRect( &client_rect_host, -window_rect_host.left, -window_rect_host.top ); + } + } + + FIXME( "%sbling fshack for hwnd %p, mapping virt window %s, client %s to host window %s, client %s.\n", + enable ? "Ena" : "Disa", data->hwnd, wine_dbgstr_rect( window_rect_virt ), wine_dbgstr_rect( client_rect_virt ), + wine_dbgstr_rect( &window_rect_host ), wine_dbgstr_rect( &client_rect_host ) ); + + if (data->whole_window) + { + POINT top_left = *(POINT *)&window_rect_host; + OffsetRect( &window_rect_host, -top_left.x, -top_left.y ); + + if (set_hints) set_wm_hints( data ); + + window_rect_host.right = min( max( window_rect_host.right, 1 ), 65535 ); + window_rect_host.bottom = min( max( window_rect_host.bottom, 1 ), 65535 ); + XMoveResizeWindow( data->display, data->whole_window, top_left.x, top_left.y, window_rect_host.right, window_rect_host.bottom ); + + if (set_hints) update_net_wm_states( data ); + } + + if (data->client_window) + { + POINT top_left = *(POINT *)&client_rect_host; + OffsetRect( &client_rect_host, -top_left.x, -top_left.y ); + + client_rect_host.right = min( max( client_rect_host.right, 1 ), 65535 ); + client_rect_host.bottom = min( max( client_rect_host.bottom, 1 ), 65535 ); + XMoveResizeWindow( gdi_display, data->client_window, top_left.x, top_left.y, client_rect_host.right, client_rect_host.bottom ); + + sync_gl_drawable( data->hwnd, !data->whole_window ); + } + + NtUserEnumChildWindows( data->hwnd, update_child_window_fshack, enable ); +} + +static BOOL CALLBACK update_child_window_fshack( HWND hwnd, LPARAM enable ) +{ + struct x11drv_win_data *data; + if (!(data = get_win_data( hwnd ))) return TRUE; + if (data->client_window) window_update_fshack( data, NULL, NULL, enable ); + release_win_data( data ); + return TRUE; +} /*********************************************************************** * WindowPosChanging (X11DRV.@) @@ -2740,9 +2892,17 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, DWORD flags; COLORREF key; BOOL layered = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED; + HMONITOR monitor; if (!data && !(data = X11DRV_create_win_data( hwnd, window_rect, client_rect ))) return TRUE; + monitor = fs_hack_monitor_from_rect( window_rect ); + if (fs_hack_enabled( monitor ) && fs_hack_matches_current_mode( monitor, window_rect->right - window_rect->left, + window_rect->bottom - window_rect->top )) + window_update_fshack( data, window_rect, client_rect, TRUE ); + else + window_update_fshack( data, window_rect, client_rect, FALSE ); + /* check if we need to switch the window to managed */ if (!data->managed && data->whole_window && is_window_managed( hwnd, swp_flags, window_rect )) { @@ -2886,6 +3046,8 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, return; } + if (data->fs_hack) sync_gl_drawable( hwnd, FALSE ); + /* check if we are currently processing an event relevant to this window */ event_type = 0; if (thread_data && @@ -2982,6 +3144,7 @@ UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) DWORD style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_win_data *data = get_win_data( hwnd ); + HMONITOR monitor; if (!data || !data->whole_window) goto done; if (style & WS_MINIMIZE) @@ -3011,7 +3174,21 @@ UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) &root, &x, &y, &width, &height, &border, &depth ); XTranslateCoordinates( thread_data->display, data->whole_window, root, 0, 0, &x, &y, &top ); pos = root_to_virtual_screen( x, y ); - X11DRV_X_to_window_rect( data, rect, pos.x, pos.y, width, height ); + monitor = fs_hack_monitor_from_hwnd( hwnd ); + if (data->fs_hack || + (fs_hack_enabled( monitor ) && + fs_hack_matches_current_mode( monitor, rect->right - rect->left, rect->bottom - rect->top ))) + { + MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; + NtUserGetMonitorInfo( monitor, &info ); + X11DRV_X_to_window_rect( data, rect, info.rcMonitor.left, info.rcMonitor.top, + info.rcMonitor.right - info.rcMonitor.left, + info.rcMonitor.bottom - info.rcMonitor.top ); + } + else + { + X11DRV_X_to_window_rect( data, rect, pos.x, pos.y, width, height ); + } swp &= ~(SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOCLIENTSIZE); done: @@ -3254,6 +3431,16 @@ static void taskbar_delete_tab( HWND hwnd ) static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old_x, UINT old_y ) { + HMONITOR monitor = fs_hack_monitor_from_hwnd( data->hwnd ); + + if (fs_hack_mapping_required( monitor ) && + fs_hack_matches_current_mode( monitor, data->whole_rect.right - data->whole_rect.left, + data->whole_rect.bottom - data->whole_rect.top )) + { + window_update_fshack( data, NULL, NULL, TRUE ); + return; + } + /* update the full screen state */ update_net_wm_states( data ); @@ -3267,9 +3454,15 @@ static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old if (old_pos.x != pos.x) mask |= CWX; if (old_pos.y != pos.y) mask |= CWY; + if (data->fs_hack) mask |= CWX | CWY; if (mask) XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes ); } + + if (!fs_hack_mapping_required( monitor ) || + !fs_hack_matches_current_mode( monitor, data->whole_rect.right - data->whole_rect.left, + data->whole_rect.bottom - data->whole_rect.top )) + window_update_fshack( data, NULL, NULL, FALSE ); } /********************************************************************** diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9828d164192..3d7d92febb6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -702,7 +702,6 @@ extern double fs_hack_get_user_to_real_scale( HMONITOR ); extern SIZE fs_hack_get_scaled_screen_size( HMONITOR monitor ); extern RECT fs_hack_get_real_virtual_screen(void); extern void fs_hack_init(void); -extern int mode_compare( const void *p1, const void *p2 ); static inline void mirror_rect( const RECT *window_rect, RECT *rect ) { diff --git a/include/ntuser.h b/include/ntuser.h index 876917af7d3..cf9ff0ed732 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1230,6 +1230,7 @@ enum NtUserCallHwndParam_SetMDIClientInfo, NtUserCallHwndParam_SetWindowContextHelpId, NtUserCallHwndParam_ShowOwnedPopups, + NtUserCallHwndParam_EnumChildWindows, /* temporary exports */ NtUserSetWindowStyle, }; @@ -1400,6 +1401,18 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show ) return NtUserCallHwndParam( hwnd, show, NtUserCallHwndParam_ShowOwnedPopups ); } +struct enum_child_windows_params +{ + WNDENUMPROC proc; + LPARAM lparam; +}; + +static inline BOOL NtUserEnumChildWindows( HWND hwnd, WNDENUMPROC proc, LPARAM lparam ) +{ + struct enum_child_windows_params params = {.proc = proc, .lparam = lparam}; + return NtUserCallHwndParam( hwnd, (UINT_PTR)¶ms, NtUserCallHwndParam_EnumChildWindows ); +} + /* Wine extensions */ W32KAPI BOOL WINAPI __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); From 4227c049275a21ca33b4a828149b9812c157f0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:32 +0100 Subject: [PATCH 0211/1506] fshack: winex11: Support xrender scaling according to fake resolution. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on work by Zhiyi Zhang, includes work by Giovanni Mascellani, Rémi Bernon, Arkadiusz Hiler, Kai Krakow, Joshua Ashton, Zebediah Figura, and Matteo Bruni. --- dlls/winex11.drv/graphics.c | 3 +- dlls/winex11.drv/xrender.c | 136 +++++++++++++++++++++++++++++++----- 2 files changed, 122 insertions(+), 17 deletions(-) diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index 4a0564392bd..e3c8a4318c8 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -256,8 +256,9 @@ static void update_x11_clipping( X11DRV_PDEVICE *physDev, HRGN rgn ) } else if ((data = X11DRV_GetRegionData( rgn, 0 ))) { + fs_hack_rgndata_user_to_real( data ); XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top, - (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); + (XRectangle *)data->Buffer, data->rdh.nCount, Unsorted ); free( data ); } } diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 74723915fc5..da6c15b9676 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -470,6 +470,7 @@ static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn ) } else if ((data = X11DRV_GetRegionData( rgn, 0 ))) { + fs_hack_rgndata_user_to_real( data ); pXRenderSetPictureClipRectangles( gdi_display, dev->pict, dev->x11dev->dc_rect.left, dev->x11dev->dc_rect.top, (XRectangle *)data->Buffer, data->rdh.nCount ); @@ -1448,13 +1449,71 @@ static void multiply_alpha( Picture pict, XRenderPictFormat *format, int alpha, XFreePixmap( gdi_display, mask_pixmap ); } +/* if we are letterboxing, draw black bars */ +static void fs_hack_draw_black_bars( HMONITOR monitor, Picture dst_pict ) +{ + static const XRenderColor black = {0, 0, 0, 0xffff}; + POINT tl, br; /* top-left / bottom-right */ + RECT user_rect = fs_hack_current_mode( monitor ); + RECT real_rect = fs_hack_real_mode( monitor ); + SIZE scaled_screen = fs_hack_get_scaled_screen_size( monitor ); + XRenderPictureAttributes pa; + + /* first unclip the picture, so that we can actually draw them */ + pa.clip_mask = None; + pXRenderChangePicture( gdi_display, dst_pict, CPClipMask, &pa ); + + tl.x = user_rect.left; + tl.y = user_rect.top; + fs_hack_point_user_to_real( &tl ); + tl.x = tl.x - real_rect.left; + tl.y = tl.y - real_rect.top; + br.x = tl.x + scaled_screen.cx; + br.y = tl.y + scaled_screen.cy; + + if (tl.x > 0) + { + /* black bars left & right */ + pXRenderFillRectangle( gdi_display, PictOpSrc, dst_pict, &black, 0, 0, /* x, y */ + tl.x, real_rect.bottom - real_rect.top ); /* w, h */ + pXRenderFillRectangle( gdi_display, PictOpSrc, dst_pict, &black, br.x, 0, + real_rect.right - real_rect.left - br.x, real_rect.bottom - real_rect.top ); + } + else if (tl.y > 0) + { + /* black bars top & bottom */ + pXRenderFillRectangle( gdi_display, PictOpSrc, dst_pict, &black, 0, 0, + real_rect.right - real_rect.left, tl.y ); + pXRenderFillRectangle( gdi_display, PictOpSrc, dst_pict, &black, 0, br.y, + real_rect.right - real_rect.left, real_rect.bottom - real_rect.top - br.y ); + } +} + /* Helper function for (stretched) blitting using xrender */ -static void xrender_blit( int op, Picture src_pict, Picture mask_pict, Picture dst_pict, - int x_src, int y_src, int width_src, int height_src, - int x_dst, int y_dst, int width_dst, int height_dst, - double xscale, double yscale ) +static void xrender_blit( struct xrender_physdev *physdev, int op, Picture src_pict, Picture mask_pict, + Picture dst_pict, int x_src, int y_src, int width_src, int height_src, int x_dst, + int y_dst, int width_dst, int height_dst, double xscale, double yscale ) { int x_offset, y_offset; + HMONITOR monitor; + + monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( physdev->dev.hdc ) ); + if (fs_hack_mapping_required( monitor )) + { + double user_to_real_scale; + POINT p; + p.x = x_dst; + p.y = y_dst; + fs_hack_point_user_to_real( &p ); + x_dst = p.x; + y_dst = p.y; + + user_to_real_scale = fs_hack_get_user_to_real_scale( monitor ); + width_dst *= user_to_real_scale; + height_dst *= user_to_real_scale; + xscale /= user_to_real_scale; + yscale /= user_to_real_scale; + } if (width_src < 0) { @@ -1495,6 +1554,8 @@ static void xrender_blit( int op, Picture src_pict, Picture mask_pict, Picture d } pXRenderComposite( gdi_display, op, src_pict, mask_pict, dst_pict, x_offset, y_offset, 0, 0, x_dst, y_dst, width_dst, height_dst ); + + if (fs_hack_mapping_required( monitor )) fs_hack_draw_black_bars( monitor, dst_pict ); } /* Helper function for (stretched) mono->color blitting using xrender */ @@ -1654,7 +1715,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr if (physdev_dst->pict_format->depth == 32 && physdev_src->pict_format->depth < 32) mask_pict = get_no_alpha_mask(); - xrender_blit( PictOpSrc, src_pict, mask_pict, dst_pict, + xrender_blit( physdev_dst, PictOpSrc, src_pict, mask_pict, dst_pict, physdev_src->x11dev->dc_rect.left + src->x, physdev_src->x11dev->dc_rect.top + src->y, src->width, src->height, x_dst, y_dst, dst->width, dst->height, xscale, yscale ); @@ -1678,6 +1739,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask RGNDATA *clip_data = NULL; if (clip) clip_data = X11DRV_GetRegionData( clip, 0 ); + fs_hack_rgndata_user_to_real( clip_data ); x_dst = dst->x; y_dst = dst->y; dst_pict = pXRenderCreatePicture( gdi_display, drawable, dst_format, 0, NULL ); @@ -1700,7 +1762,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask } else xscale = yscale = 1; /* no scaling needed with a repeating source */ - xrender_blit( PictOpSrc, src_pict, mask_pict, dst_pict, src->x, src->y, src->width, src->height, + xrender_blit( physdev, PictOpSrc, src_pict, mask_pict, dst_pict, src->x, src->y, src->width, src->height, x_dst, y_dst, dst->width, dst->height, xscale, yscale ); if (drawable) pXRenderFreePicture( gdi_display, dst_pict ); @@ -1716,6 +1778,11 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, struct xrender_physdev *physdev_dst = get_xrender_dev( dst_dev ); struct xrender_physdev *physdev_src = get_xrender_dev( src_dev ); BOOL stretch = (src->width != dst->width) || (src->height != dst->height); + HMONITOR monitor; + + TRACE( "src %d,%d %dx%d vis=%s dst %d,%d %dx%d vis=%s rop=%06x\n", src->x, src->y, src->width, + src->height, wine_dbgstr_rect( &src->visrect ), dst->x, dst->y, dst->width, dst->height, + wine_dbgstr_rect( &dst->visrect ), (int)rop ); if (src_dev->funcs != dst_dev->funcs) { @@ -1727,6 +1794,9 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, if (physdev_dst->format == WXR_FORMAT_MONO && physdev_src->format != WXR_FORMAT_MONO) goto x11drv_fallback; + monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( dst_dev->hdc ) ); + if (fs_hack_mapping_required( monitor )) stretch = TRUE; + /* if not stretching, we only need to handle format conversion */ if (!stretch && physdev_dst->format == physdev_src->format) goto x11drv_fallback; @@ -1745,8 +1815,21 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, tmpGC = XCreateGC( gdi_display, physdev_dst->x11dev->drawable, 0, NULL ); XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors ); XSetGraphicsExposures( gdi_display, tmpGC, False ); - tmp_pixmap = XCreatePixmap( gdi_display, root_window, tmp.visrect.right - tmp.visrect.left, - tmp.visrect.bottom - tmp.visrect.top, physdev_dst->pict_format->depth ); + + if (fs_hack_mapping_required( monitor )) + { + double user_to_real_scale; + SIZE size; + + user_to_real_scale = fs_hack_get_user_to_real_scale( monitor ); + size.cx = (tmp.visrect.right - tmp.visrect.left) * user_to_real_scale; + size.cy = (tmp.visrect.bottom - tmp.visrect.top) * user_to_real_scale; + tmp_pixmap = XCreatePixmap( gdi_display, root_window, size.cx, size.cy, + physdev_dst->pict_format->depth ); + } + else tmp_pixmap = XCreatePixmap( gdi_display, root_window, tmp.visrect.right - tmp.visrect.left, + tmp.visrect.bottom - tmp.visrect.top, + physdev_dst->pict_format->depth ); xrender_stretch_blit( physdev_src, physdev_dst, tmp_pixmap, src, &tmp ); execute_rop( physdev_dst->x11dev, tmp_pixmap, tmpGC, &dst->visrect, rop ); @@ -1781,6 +1864,10 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, Picture src_pict, mask_pict = 0; BOOL use_repeat; + TRACE( "src %d,%d %dx%d vis=%s dst %d,%d %dx%d vis=%s rop=%06x\n", src->x, src->y, src->width, + src->height, wine_dbgstr_rect( &src->visrect ), dst->x, dst->y, dst->width, dst->height, + wine_dbgstr_rect( &dst->visrect ), (int)rop ); + dst_format = physdev->format; src_format = get_xrender_format_from_bitmapinfo( info ); if (!(pict_format = pict_formats[src_format])) goto update_format; @@ -1805,6 +1892,7 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, if (rop != SRCCOPY) { BOOL restore_region = add_extra_clipping_region( physdev->x11dev, clip ); + HMONITOR monitor; /* make coordinates relative to tmp pixmap */ tmp = *dst; @@ -1815,13 +1903,29 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, gc = XCreateGC( gdi_display, physdev->x11dev->drawable, 0, NULL ); XSetSubwindowMode( gdi_display, gc, IncludeInferiors ); XSetGraphicsExposures( gdi_display, gc, False ); - tmp_pixmap = XCreatePixmap( gdi_display, root_window, - tmp.visrect.right - tmp.visrect.left, - tmp.visrect.bottom - tmp.visrect.top, - physdev->pict_format->depth ); + + monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( dev->hdc ) ); + if (fs_hack_mapping_required( monitor )) + { + double user_to_real_scale; + SIZE size; + + user_to_real_scale = fs_hack_get_user_to_real_scale( monitor ); + size.cx = (tmp.visrect.right - tmp.visrect.left) * user_to_real_scale; + size.cy = (tmp.visrect.bottom - tmp.visrect.top) * user_to_real_scale; + tmp_pixmap = XCreatePixmap( gdi_display, root_window, size.cx, size.cy, + physdev->pict_format->depth ); + } + else + { + tmp_pixmap = XCreatePixmap( gdi_display, root_window, + tmp.visrect.right - tmp.visrect.left, + tmp.visrect.bottom - tmp.visrect.top, + physdev->pict_format->depth ); + } xrender_put_image( src_pixmap, src_pict, mask_pict, NULL, physdev->pict_format, - NULL, tmp_pixmap, src, &tmp, use_repeat ); + physdev, tmp_pixmap, src, &tmp, use_repeat ); execute_rop( physdev->x11dev, tmp_pixmap, gc, &dst->visrect, rop ); XFreePixmap( gdi_display, tmp_pixmap ); @@ -1898,7 +2002,7 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct pthread_mutex_lock( &xrender_mutex ); mask_pict = get_mask_pict( func.SourceConstantAlpha * 257 ); - xrender_blit( PictOpOver, src_pict, mask_pict, dst_pict, + xrender_blit( physdev, PictOpOver, src_pict, mask_pict, dst_pict, src->x, src->y, src->width, src->height, physdev->x11dev->dc_rect.left + dst->x, physdev->x11dev->dc_rect.top + dst->y, @@ -1987,7 +2091,7 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, pthread_mutex_lock( &xrender_mutex ); mask_pict = get_mask_pict( blendfn.SourceConstantAlpha * 257 ); - xrender_blit( PictOpOver, src_pict, mask_pict, dst_pict, + xrender_blit( physdev_dst, PictOpOver, src_pict, mask_pict, dst_pict, physdev_src->x11dev->dc_rect.left + src->x, physdev_src->x11dev->dc_rect.top + src->y, src->width, src->height, @@ -2090,7 +2194,7 @@ static BOOL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG n dst_pict = get_xrender_picture( physdev, 0, NULL ); src_pict = pXRenderCreateLinearGradient( gdi_display, &gradient, stops, colors, 2 ); - xrender_blit( PictOpSrc, src_pict, 0, dst_pict, + xrender_blit( physdev, PictOpSrc, src_pict, 0, dst_pict, 0, 0, rc.right - rc.left, rc.bottom - rc.top, physdev->x11dev->dc_rect.left + rc.left, physdev->x11dev->dc_rect.top + rc.top, From d09ab49fbfc3167e4af7d9c6979a58328f2fb1e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:32 +0100 Subject: [PATCH 0212/1506] fshack: winex11: Support opengl scaling according to fake resolution. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on work by Zhiyi Zhang, includes work by Giovanni Mascellani, Rémi Bernon, Arkadiusz Hiler, Kai Krakow, Joshua Ashton, Zebediah Figura, and Matteo Bruni. --- dlls/winex11.drv/opengl.c | 523 +++++++++++++++++++++++++++++++++++++- 1 file changed, 518 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 90172665a5f..1d47e9a6e50 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -43,6 +43,10 @@ #include "winternl.h" #include "wine/debug.h" +#ifndef ARRAY_SIZE +#define ARRAY_SIZE( array ) (sizeof(array) / sizeof((array)[0])) +#endif + #ifdef SONAME_LIBGL WINE_DEFAULT_DEBUG_CHANNEL(wgl); @@ -206,6 +210,13 @@ struct wgl_context struct gl_drawable *drawables[2]; struct gl_drawable *new_drawables[2]; BOOL refresh_drawables; + BOOL fs_hack; + BOOL fs_hack_integer; + GLuint fs_hack_fbo, fs_hack_resolve_fbo; + GLuint fs_hack_color_texture, fs_hack_ds_texture; + GLuint fs_hack_color_renderbuffer, fs_hack_color_resolve_renderbuffer, fs_hack_ds_renderbuffer; + POINT setup_for; + GLuint current_draw_fbo, current_read_fbo; struct list entry; }; @@ -240,6 +251,10 @@ struct gl_drawable int swap_interval; BOOL refresh_swap_interval; BOOL mutable_pf; + BOOL fs_hack; + BOOL fs_hack_did_swapbuf; + BOOL fs_hack_context_set_up; + BOOL has_scissor_indexed; }; struct wgl_pbuffer @@ -376,6 +391,10 @@ static int (*pglXSwapIntervalSGI)(int); static void* (*pglXAllocateMemoryNV)(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); static void (*pglXFreeMemoryNV)(GLvoid *pointer); +static void (*pglScissorIndexed)( GLuint, GLint, GLint, GLsizei, GLsizei ); +static void (*pglScissorIndexedv)( GLuint, const GLint * ); +static void (*pglGetIntegeri_v)( GLenum, GLuint, GLint * ); + /* MESA GLX Extensions */ static void (*pglXCopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); static int (*pglXSwapIntervalMESA)(unsigned int interval); @@ -399,6 +418,29 @@ static void wglFinish(void); static void wglFlush(void); static const GLubyte *wglGetString(GLenum name); +/* Fullscreen hack */ +static void (*pglBindFramebuffer)( GLenum target, GLuint framebuffer ); +static void (*pglBindFramebufferEXT)( GLenum target, GLuint framebuffer ); +static void (*pglBindRenderbuffer)( GLenum target, GLuint renderbuffer ); +static void (*pglBlitFramebuffer)( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, + GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter ); +void (*pglDeleteFramebuffers)( GLsizei n, const GLuint *framebuffers ); +void (*pglDeleteRenderbuffers)( GLsizei n, const GLuint *renderbuffers ); +static void (*pglDrawBuffer)( GLenum buffer ); +static void (*pglFramebufferRenderbuffer)( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ); +static void (*pglFramebufferTexture2D)( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ); +static void (*pglGenFramebuffers)( GLsizei n, GLuint *ids ); +static void (*pglGenRenderbuffers)( GLsizei n, GLuint *renderbuffers ); +static void (*pglReadBuffer)( GLenum src ); +static void (*pglRenderbufferStorage)( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ); +static void (*pglRenderbufferStorageMultisample)( GLenum target, GLsizei samples, GLenum internalformat, + GLsizei width, GLsizei height ); + +static void wglBindFramebuffer( GLenum target, GLuint framebuffer ); +static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ); +static void wglDrawBuffer( GLenum buffer ); +static void wglReadBuffer( GLenum src ); + /* check if the extension is present in the list */ static BOOL has_extension( const char *list, const char *ext ) { @@ -574,9 +616,11 @@ static void init_opengl(void) /* redirect some standard OpenGL functions */ #define REDIRECT(func) \ do { p##func = opengl_funcs.gl.p_##func; opengl_funcs.gl.p_##func = w##func; } while(0) + REDIRECT( glDrawBuffer ); REDIRECT( glFinish ); REDIRECT( glFlush ); REDIRECT( glGetString ); + REDIRECT( glReadBuffer ); #undef REDIRECT pglXGetProcAddressARB = dlsym(opengl_handle, "glXGetProcAddressARB"); @@ -585,6 +629,22 @@ static void init_opengl(void) goto failed; } + /* Fullscreen hack */ +#define LOAD_FUNCPTR(func) p##func = (void *)pglXGetProcAddressARB((const unsigned char *)#func); + LOAD_FUNCPTR( glBindFramebuffer ); + LOAD_FUNCPTR( glBindFramebufferEXT ); + LOAD_FUNCPTR( glBindRenderbuffer ); + LOAD_FUNCPTR( glBlitFramebuffer ); + LOAD_FUNCPTR( glDeleteFramebuffers ); + LOAD_FUNCPTR( glDeleteRenderbuffers ); + LOAD_FUNCPTR( glFramebufferRenderbuffer ); + LOAD_FUNCPTR( glFramebufferTexture2D ); + LOAD_FUNCPTR( glGenFramebuffers ); + LOAD_FUNCPTR( glGenRenderbuffers ); + LOAD_FUNCPTR( glRenderbufferStorage ); + LOAD_FUNCPTR( glRenderbufferStorageMultisample ); +#undef LOAD_FUNCPTR + #define LOAD_FUNCPTR(f) do if((p##f = (void*)pglXGetProcAddressARB((const unsigned char*)#f)) == NULL) \ { \ ERR( "%s not found in libGL, disabling OpenGL.\n", #f ); \ @@ -635,6 +695,10 @@ static void init_opengl(void) /* NV GLX Extension */ LOAD_FUNCPTR(glXAllocateMemoryNV); LOAD_FUNCPTR(glXFreeMemoryNV); + + LOAD_FUNCPTR(glScissorIndexed); + LOAD_FUNCPTR(glScissorIndexedv); + LOAD_FUNCPTR(glGetIntegeri_v); #undef LOAD_FUNCPTR if(!X11DRV_WineGL_InitOpenglInfo()) goto failed; @@ -725,6 +789,13 @@ static void init_opengl(void) pglXSwapBuffersMscOML = pglXGetProcAddressARB( (const GLubyte *)"glXSwapBuffersMscOML" ); } + if (has_extension( glExtensions, "GL_ARB_viewport_array" )) + { + opengl_funcs.ext.p_glGetIntegeri_v = pglGetIntegeri_v; + opengl_funcs.ext.p_glScissorIndexed = pglScissorIndexed; + opengl_funcs.ext.p_glScissorIndexedv = pglScissorIndexedv; + } + X11DRV_WineGL_LoadExtensions(); init_pixel_formats( gdi_display ); return; @@ -1364,6 +1435,8 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel if (!gl->layered_type && !drawable_needs_clipping( hwnd, known_child )) /* childless top-level window */ { + struct x11drv_win_data *data; + gl->type = DC_GL_WINDOW; gl->colormap = XCreateColormap( gdi_display, get_dummy_parent(), visual->visual, (visual->class == PseudoColor || visual->class == GrayScale || @@ -1371,6 +1444,12 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->window = create_client_window( hwnd, visual, gl->colormap ); if (gl->window) gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); + if ((data = get_win_data( hwnd ))) + { + gl->fs_hack = data->fs_hack; + if (gl->fs_hack) TRACE( "Window %p has the fullscreen hack enabled\n", hwnd ); + release_win_data( data ); + } TRACE( "%p created client %lx drawable %lx\n", hwnd, gl->window, gl->drawable ); } #ifdef SONAME_LIBXCOMPOSITE @@ -1511,6 +1590,9 @@ void sync_gl_drawable( HWND hwnd, BOOL known_child ) { enum dc_gl_layered_type new_layered_type; struct gl_drawable *old, *new; + struct x11drv_win_data *data; + + TRACE( "%p\n", hwnd ); if (!(old = get_gl_drawable( hwnd, 0 ))) return; @@ -1530,6 +1612,15 @@ void sync_gl_drawable( HWND hwnd, BOOL known_child ) release_gl_drawable( new ); } } + + if (DC_GL_PIXMAP_WIN != old->type) + { + data = get_win_data( hwnd ); + old->fs_hack = data->fs_hack; + if (old->fs_hack) TRACE( "Window %p has the fullscreen hack enabled\n", hwnd ); + release_win_data( data ); + } + release_gl_drawable( old ); } @@ -1860,6 +1951,8 @@ static BOOL glxdrv_wglDeleteContext(struct wgl_context *ctx) static PROC glxdrv_wglGetProcAddress(LPCSTR lpszProc) { if (!strncmp(lpszProc, "wgl", 3)) return NULL; + if (!strcmp( lpszProc, "glBindFramebuffer" )) return (PROC)(void *)wglBindFramebuffer; + if (!strcmp( lpszProc, "glBindFramebufferEXT" )) return (PROC)(void *)wglBindFramebufferEXT; return pglXGetProcAddressARB((const GLubyte*)lpszProc); } @@ -1879,12 +1972,243 @@ static void set_context_drawables( struct wgl_context *ctx, struct gl_drawable * for (i = 0; i < 4; i++) release_gl_drawable( prev[i] ); } +struct fs_hack_fbconfig_attribs +{ + int render_type; + int buffer_size; + int red_size; + int green_size; + int blue_size; + int alpha_size; + int depth_size; + int stencil_size; + int doublebuffer; + int samples; + int srgb; +}; + +struct fs_hack_fbo_attachments_config +{ + GLint color_internalformat; + GLenum color_format; + GLenum color_type; + GLint ds_internalformat; + GLenum ds_format; + GLenum ds_type; + int samples; +}; + +static void fs_hack_get_attachments_config( struct gl_drawable *gl, struct fs_hack_fbconfig_attribs *attribs, + struct fs_hack_fbo_attachments_config *config ) +{ + if (attribs->render_type != GLX_RGBA_BIT) + FIXME( "Unsupported GLX_RENDER_TYPE %#x.\n", attribs->render_type ); + if (attribs->red_size != 8 || attribs->green_size != 8 || attribs->blue_size != 8) + FIXME( "Unsupported RGBA color sizes {%u, %u, %u, %u}.\n", attribs->red_size, + attribs->green_size, attribs->blue_size, attribs->alpha_size ); + if (attribs->srgb) config->color_internalformat = attribs->alpha_size ? GL_SRGB8_ALPHA8 : GL_SRGB8; + else config->color_internalformat = attribs->alpha_size ? GL_RGBA8 : GL_RGB8; + config->color_format = GL_BGRA; + config->color_type = GL_UNSIGNED_INT_8_8_8_8_REV; + if (attribs->depth_size || attribs->stencil_size) + { + if (attribs->depth_size != 24) FIXME( "Unsupported depth buffer size %u.\n", attribs->depth_size ); + if (attribs->stencil_size && attribs->stencil_size != 8) + FIXME( "Unsupported stencil buffer size %u.\n", attribs->stencil_size ); + config->ds_internalformat = attribs->stencil_size ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT24; + config->ds_format = attribs->stencil_size ? GL_DEPTH_STENCIL : GL_DEPTH_COMPONENT; + config->ds_type = attribs->stencil_size ? GL_UNSIGNED_INT_24_8 : GL_UNSIGNED_INT; + } + else + { + config->ds_internalformat = config->ds_format = config->ds_type = 0; + } + config->samples = attribs->samples; +} + +static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable *gl ) +{ + GLuint prev_draw_fbo, prev_read_fbo, prev_texture, prev_renderbuffer; + float prev_clear_color[4]; + unsigned int i; + struct fs_hack_fbo_attachments_config config; + struct fs_hack_fbconfig_attribs attribs; + static const struct fbconfig_attribs_query + { + int attribute; + unsigned int offset; + } + queries[] = + { + {GLX_RENDER_TYPE, offsetof(struct fs_hack_fbconfig_attribs, render_type)}, + {GLX_BUFFER_SIZE, offsetof(struct fs_hack_fbconfig_attribs, buffer_size)}, + {GLX_RED_SIZE, offsetof(struct fs_hack_fbconfig_attribs, red_size)}, + {GLX_GREEN_SIZE, offsetof(struct fs_hack_fbconfig_attribs, green_size)}, + {GLX_BLUE_SIZE, offsetof(struct fs_hack_fbconfig_attribs, blue_size)}, + {GLX_ALPHA_SIZE, offsetof(struct fs_hack_fbconfig_attribs, alpha_size)}, + {GLX_DEPTH_SIZE, offsetof(struct fs_hack_fbconfig_attribs, depth_size)}, + {GLX_STENCIL_SIZE, offsetof(struct fs_hack_fbconfig_attribs, stencil_size)}, + {GLX_DOUBLEBUFFER, offsetof(struct fs_hack_fbconfig_attribs, doublebuffer)}, + {GLX_SAMPLES_ARB, offsetof(struct fs_hack_fbconfig_attribs, samples)}, + {GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, offsetof(struct fs_hack_fbconfig_attribs, srgb)}, + }; + BYTE *ptr = (BYTE *)&attribs; + + if (ctx->fs_hack) + { + MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; + HMONITOR monitor; + int width, height; + + monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( ctx->hdc ) ); + NtUserGetMonitorInfo( monitor, &info ); + width = info.rcMonitor.right - info.rcMonitor.left; + height = info.rcMonitor.bottom - info.rcMonitor.top; + + TRACE( "Render buffer width:%d height:%d\n", width, height ); + + opengl_funcs.gl.p_glGetIntegerv( GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&prev_draw_fbo ); + opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&prev_read_fbo ); + opengl_funcs.gl.p_glGetIntegerv( GL_TEXTURE_BINDING_2D, (GLint *)&prev_texture ); + opengl_funcs.gl.p_glGetIntegerv( GL_RENDERBUFFER_BINDING, (GLint *)&prev_renderbuffer ); + opengl_funcs.gl.p_glGetFloatv( GL_COLOR_CLEAR_VALUE, prev_clear_color ); + TRACE( "Previous draw FBO %u, read FBO %u for ctx %p\n", prev_draw_fbo, prev_read_fbo, ctx ); + + if (!ctx->fs_hack_fbo) + { + pglGenFramebuffers( 1, &ctx->fs_hack_fbo ); + pglGenFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); + TRACE( "Created FBO %u for fullscreen hack.\n", ctx->fs_hack_fbo ); + } + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_fbo ); + + for (i = 0; i < ARRAY_SIZE(queries); ++i) + pglXGetFBConfigAttrib( gdi_display, gl->format->fbconfig, queries[i].attribute, + (int *)&ptr[queries[i].offset] ); + fs_hack_get_attachments_config( gl, &attribs, &config ); + + if (config.samples) + { + if (!ctx->fs_hack_color_renderbuffer) + pglGenRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); + pglBindRenderbuffer( GL_RENDERBUFFER, ctx->fs_hack_color_renderbuffer ); + pglRenderbufferStorageMultisample( GL_RENDERBUFFER, config.samples, + config.color_internalformat, width, height ); + pglFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, + ctx->fs_hack_color_renderbuffer ); + TRACE( "Created renderbuffer %u for fullscreen hack.\n", ctx->fs_hack_color_renderbuffer ); + pglGenRenderbuffers( 1, &ctx->fs_hack_color_resolve_renderbuffer ); + pglBindRenderbuffer( GL_RENDERBUFFER, ctx->fs_hack_color_resolve_renderbuffer ); + pglRenderbufferStorage( GL_RENDERBUFFER, config.color_internalformat, width, height ); + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); + pglFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, + ctx->fs_hack_color_resolve_renderbuffer ); + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_fbo ); + pglBindRenderbuffer( GL_RENDERBUFFER, prev_renderbuffer ); + TRACE( "Also created renderbuffer %u and FBO %u for color resolve.\n", + ctx->fs_hack_color_resolve_renderbuffer, ctx->fs_hack_resolve_fbo ); + } + else + { + if (!ctx->fs_hack_color_texture) + opengl_funcs.gl.p_glGenTextures( 1, &ctx->fs_hack_color_texture ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_color_texture ); + opengl_funcs.gl.p_glTexImage2D( GL_TEXTURE_2D, 0, config.color_internalformat, width, + height, 0, config.color_format, config.color_type, NULL ); + opengl_funcs.gl.p_glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, prev_texture ); + pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + ctx->fs_hack_color_texture, 0 ); + TRACE( "Created texture %u for fullscreen hack.\n", ctx->fs_hack_color_texture ); + } + + if (config.ds_internalformat) + { + if (config.samples) + { + if (!ctx->fs_hack_ds_renderbuffer) pglGenRenderbuffers( 1, &ctx->fs_hack_ds_renderbuffer ); + pglBindRenderbuffer( GL_RENDERBUFFER, ctx->fs_hack_ds_renderbuffer ); + pglRenderbufferStorageMultisample( GL_RENDERBUFFER, config.samples, + config.ds_internalformat, width, height ); + pglBindRenderbuffer( GL_RENDERBUFFER, prev_renderbuffer ); + if (attribs.depth_size) + pglFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, ctx->fs_hack_ds_renderbuffer ); + if (attribs.stencil_size) + pglFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, ctx->fs_hack_ds_renderbuffer ); + TRACE( "Created DS renderbuffer %u for fullscreen hack.\n", ctx->fs_hack_ds_renderbuffer ); + } + else + { + if (!ctx->fs_hack_ds_texture) + opengl_funcs.gl.p_glGenTextures( 1, &ctx->fs_hack_ds_texture ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_ds_texture ); + opengl_funcs.gl.p_glTexImage2D( GL_TEXTURE_2D, 0, config.ds_internalformat, width, + height, 0, config.ds_format, config.ds_type, NULL ); + opengl_funcs.gl.p_glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, prev_texture ); + if (attribs.depth_size) + pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, ctx->fs_hack_ds_texture, 0 ); + if (attribs.stencil_size) + pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_TEXTURE_2D, ctx->fs_hack_ds_texture, 0 ); + TRACE( "Created DS texture %u for fullscreen hack.\n", ctx->fs_hack_ds_texture ); + } + } + + opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); + if (!gl->fs_hack_context_set_up) opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); + pglDrawBuffer( GL_BACK ); + if (!gl->fs_hack_context_set_up) opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); + opengl_funcs.gl.p_glClearColor( prev_clear_color[0], prev_clear_color[1], + prev_clear_color[2], prev_clear_color[3] ); + wglBindFramebuffer( GL_DRAW_FRAMEBUFFER, prev_draw_fbo ); + wglBindFramebuffer( GL_READ_FRAMEBUFFER, prev_read_fbo ); + + ctx->setup_for.x = width; + ctx->setup_for.y = height; + gl->has_scissor_indexed = has_extension( glExtensions, "GL_ARB_viewport_array" ); + ctx->fs_hack_integer = fs_hack_is_integer(); + gl->fs_hack_context_set_up = TRUE; + } + else + { + TRACE( "Releasing fullscreen hack texture %u and FBO %u\n", ctx->fs_hack_color_texture, ctx->fs_hack_fbo ); + if (ctx->current_draw_fbo == ctx->fs_hack_fbo) + { + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); + ctx->current_draw_fbo = 0; + } + if (ctx->current_read_fbo == ctx->fs_hack_fbo) + { + pglBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); + ctx->current_read_fbo = 0; + } + + pglDeleteRenderbuffers( 1, &ctx->fs_hack_ds_renderbuffer ); + pglDeleteRenderbuffers( 1, &ctx->fs_hack_color_resolve_renderbuffer ); + pglDeleteRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); + opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_ds_texture ); + opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_color_texture ); + ctx->fs_hack_color_renderbuffer = ctx->fs_hack_color_resolve_renderbuffer = ctx->fs_hack_ds_renderbuffer = 0; + ctx->fs_hack_color_texture = ctx->fs_hack_ds_texture = 0; + pglDeleteFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); + pglDeleteFramebuffers( 1, &ctx->fs_hack_fbo ); + ctx->fs_hack_fbo = 0; + + gl->fs_hack_context_set_up = FALSE; + } +} + /*********************************************************************** * glxdrv_wglMakeCurrent */ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) { - BOOL ret = FALSE; + BOOL ret = FALSE, setup_fs_hack = FALSE; struct gl_drawable *gl; TRACE("(%p,%p)\n", hdc, ctx); @@ -1913,10 +2237,17 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) if (ret) { NtCurrentTeb()->glContext = ctx; - ctx->has_been_current = TRUE; + if (ctx->fs_hack != gl->fs_hack || (ctx->fs_hack && ctx->drawables[0] != gl)) + setup_fs_hack = TRUE; ctx->hdc = hdc; set_context_drawables( ctx, gl, gl ); ctx->refresh_drawables = FALSE; + if (setup_fs_hack) + { + ctx->fs_hack = gl->fs_hack; + fs_hack_setup_context( ctx, gl ); + } + ctx->has_been_current = TRUE; pthread_mutex_unlock( &context_mutex ); goto done; } @@ -1930,12 +2261,149 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) return ret; } +static void wglBindFramebuffer( GLenum target, GLuint framebuffer ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + + TRACE( "target %#x, framebuffer %u\n", target, framebuffer ); + if (ctx->fs_hack && !framebuffer) framebuffer = ctx->fs_hack_fbo; + + if (target == GL_DRAW_FRAMEBUFFER || target == GL_FRAMEBUFFER) ctx->current_draw_fbo = framebuffer; + if (target == GL_READ_FRAMEBUFFER || target == GL_FRAMEBUFFER) ctx->current_read_fbo = framebuffer; + + pglBindFramebuffer( target, framebuffer ); +} + +static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + + TRACE( "target %#x, framebuffer %u\n", target, framebuffer ); + if (ctx->fs_hack && !framebuffer) framebuffer = ctx->fs_hack_fbo; + + if (target == GL_DRAW_FRAMEBUFFER || target == GL_FRAMEBUFFER) ctx->current_draw_fbo = framebuffer; + if (target == GL_READ_FRAMEBUFFER || target == GL_FRAMEBUFFER) ctx->current_read_fbo = framebuffer; + + pglBindFramebufferEXT( target, framebuffer ); +} + +static void wglDrawBuffer( GLenum buffer ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + + if (ctx->fs_hack && ctx->current_draw_fbo == ctx->fs_hack_fbo) + { + TRACE( "Overriding %#x with GL_COLOR_ATTACHMENT0\n", buffer ); + buffer = GL_COLOR_ATTACHMENT0; + } + pglDrawBuffer( buffer ); +} + +static void wglReadBuffer( GLenum buffer ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + + if (ctx->fs_hack && ctx->current_read_fbo == ctx->fs_hack_fbo) + { + TRACE( "Overriding %#x with GL_COLOR_ATTACHMENT0\n", buffer ); + buffer = GL_COLOR_ATTACHMENT0; + } + pglReadBuffer( buffer ); +} + +static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + SIZE scaled, src, real; + GLuint prev_draw_fbo, prev_read_fbo; + GLint prev_scissor[4]; + RECT user_rect, real_rect; + POINT scaled_origin; + float prev_clear_color[4]; + HMONITOR monitor; + + monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( ctx->hdc ) ); + scaled = fs_hack_get_scaled_screen_size( monitor ); + user_rect = fs_hack_current_mode( monitor ); + real_rect = fs_hack_real_mode( monitor ); + src.cx = user_rect.right - user_rect.left; + src.cy = user_rect.bottom - user_rect.top; + real.cx = real_rect.right - real_rect.left; + real.cy = real_rect.bottom - real_rect.top; + scaled_origin.x = user_rect.left; + scaled_origin.y = user_rect.top; + fs_hack_point_user_to_real( &scaled_origin ); + scaled_origin.x -= real_rect.left; + scaled_origin.y -= real_rect.top; + + TRACE( "scaled:%dx%d src:%dx%d real:%dx%d user_rect:%s real_rect:%s scaled_origin:%s\n", + (int)scaled.cx, (int)scaled.cy, (int)src.cx, (int)src.cy, (int)real.cx, (int)real.cy, + wine_dbgstr_rect( &user_rect ), wine_dbgstr_rect( &real_rect ), wine_dbgstr_point( &scaled_origin ) ); + + if (ctx->setup_for.x != src.cx || ctx->setup_for.y != src.cy) fs_hack_setup_context( ctx, gl ); + + TRACE( "Blitting from FBO %u %ux%u to %ux%u\n", ctx->fs_hack_fbo, + (int)src.cx, (int)src.cy, (int)scaled.cx, (int)scaled.cy ); + + opengl_funcs.gl.p_glGetIntegerv( GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&prev_draw_fbo ); + opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&prev_read_fbo ); + TRACE( "Previous draw FBO %u, read FBO %u\n", prev_draw_fbo, prev_read_fbo ); + + if (gl->has_scissor_indexed) + { + opengl_funcs.ext.p_glGetIntegeri_v( GL_SCISSOR_BOX, 0, prev_scissor ); + opengl_funcs.ext.p_glScissorIndexed( 0, 0, 0, real.cx, real.cy ); + } + else + { + opengl_funcs.gl.p_glGetIntegerv( GL_SCISSOR_BOX, prev_scissor ); + opengl_funcs.gl.p_glScissor( 0, 0, real.cx, real.cy ); + } + + pglBindFramebuffer( GL_READ_FRAMEBUFFER, ctx->fs_hack_fbo ); + if (ctx->fs_hack_color_resolve_renderbuffer) + { + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); + pglBlitFramebuffer( 0, 0, src.cx, src.cy, 0, 0, src.cx, src.cy, GL_COLOR_BUFFER_BIT, GL_NEAREST ); + pglBindFramebuffer( GL_READ_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); + } + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); + + // HACK + // pglDrawBuffer( draw_buffer ); + pglDrawBuffer( GL_BACK ); + + opengl_funcs.gl.p_glGetFloatv( GL_COLOR_CLEAR_VALUE, prev_clear_color ); + opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); + opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); + opengl_funcs.gl.p_glClearColor( prev_clear_color[0], prev_clear_color[1], prev_clear_color[2], + prev_clear_color[3] ); + + pglBlitFramebuffer( 0, 0, src.cx, src.cy, scaled_origin.x, scaled_origin.y, + scaled_origin.x + scaled.cx, scaled_origin.y + scaled.cy, + GL_COLOR_BUFFER_BIT, ctx->fs_hack_integer ? GL_NEAREST : GL_LINEAR ); + // HACK + if (draw_buffer == GL_FRONT) pglXSwapBuffers( gdi_display, gl->drawable ); + + if (gl->has_scissor_indexed) + { + opengl_funcs.ext.p_glScissorIndexedv( 0, prev_scissor ); + } + else + { + opengl_funcs.gl.p_glScissor( prev_scissor[0], prev_scissor[1], prev_scissor[2], prev_scissor[3] ); + } + + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, prev_draw_fbo ); + pglBindFramebuffer( GL_READ_FRAMEBUFFER, prev_read_fbo ); +} + /*********************************************************************** * X11DRV_wglMakeContextCurrentARB */ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context *ctx ) { - BOOL ret = FALSE; + BOOL ret = FALSE, setup_fs_hack = FALSE; struct gl_drawable *draw_gl, *read_gl = NULL; TRACE("(%p,%p,%p)\n", draw_hdc, read_hdc, ctx); @@ -1958,11 +2426,18 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct read_gl ? read_gl->drawable : 0, ctx->ctx); if (ret) { - ctx->has_been_current = TRUE; + NtCurrentTeb()->glContext = ctx; + if (ctx->fs_hack != draw_gl->fs_hack || (ctx->fs_hack && ctx->drawables[0] != draw_gl)) + setup_fs_hack = TRUE; ctx->hdc = draw_hdc; set_context_drawables( ctx, draw_gl, read_gl ); ctx->refresh_drawables = FALSE; - NtCurrentTeb()->glContext = ctx; + if (setup_fs_hack) + { + ctx->fs_hack = draw_gl->fs_hack; + fs_hack_setup_context( ctx, draw_gl ); + } + ctx->has_been_current = TRUE; pthread_mutex_unlock( &context_mutex ); goto done; } @@ -2124,6 +2599,19 @@ static void wglFinish(void) default: break; } sync_context(ctx); + + if (gl->fs_hack) + { + ctx->fs_hack = gl->fs_hack; + if (!gl->fs_hack_context_set_up) fs_hack_setup_context( ctx, gl ); + if (!gl->fs_hack_did_swapbuf) fs_hack_blit_framebuffer( gl, GL_FRONT ); + } + else if (gl->fs_hack_context_set_up) + { + ctx->fs_hack = FALSE; + fs_hack_setup_context( ctx, gl ); + } + update_window_surface( gl, hwnd ); release_gl_drawable( gl ); } @@ -2153,6 +2641,19 @@ static void wglFlush(void) default: break; } sync_context(ctx); + + if (gl->fs_hack) + { + ctx->fs_hack = gl->fs_hack; + if (!gl->fs_hack_context_set_up) fs_hack_setup_context( ctx, gl ); + if (!gl->fs_hack_did_swapbuf) fs_hack_blit_framebuffer( gl, GL_FRONT ); + } + else if (gl->fs_hack_context_set_up) + { + ctx->fs_hack = FALSE; + fs_hack_setup_context( ctx, gl ); + } + update_window_surface( gl, hwnd ); release_gl_drawable( gl ); } @@ -3538,6 +4039,18 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); break; } + if (gl->fs_hack) + { + ctx->fs_hack = gl->fs_hack; + if (!gl->fs_hack_context_set_up) fs_hack_setup_context( ctx, gl ); + fs_hack_blit_framebuffer( gl, GL_BACK ); + gl->fs_hack_did_swapbuf = TRUE; + } + else if (gl->fs_hack_context_set_up) + { + ctx->fs_hack = FALSE; + fs_hack_setup_context( ctx, gl ); + } pglXSwapBuffers(gdi_display, gl->drawable); break; } From 6bd0924fb6dfc1e44dcc9cfd45a11cd73dcf4fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:32:39 +0100 Subject: [PATCH 0213/1506] fshack: winex11: Protect fshack framebuffer from glFramebufferTexture2D(). glFramebufferTexture2D() just fails with default framebuffer. But when we have substitued fshack framebuffer setting the texture destroys it instead. CW-Bug-Id: #20669 --- dlls/winex11.drv/opengl.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 1d47e9a6e50..b814eada4b2 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -440,6 +440,7 @@ static void wglBindFramebuffer( GLenum target, GLuint framebuffer ); static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ); static void wglDrawBuffer( GLenum buffer ); static void wglReadBuffer( GLenum src ); +static void wglFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ); /* check if the extension is present in the list */ static BOOL has_extension( const char *list, const char *ext ) @@ -1953,6 +1954,7 @@ static PROC glxdrv_wglGetProcAddress(LPCSTR lpszProc) if (!strncmp(lpszProc, "wgl", 3)) return NULL; if (!strcmp( lpszProc, "glBindFramebuffer" )) return (PROC)(void *)wglBindFramebuffer; if (!strcmp( lpszProc, "glBindFramebufferEXT" )) return (PROC)(void *)wglBindFramebufferEXT; + if (!strcmp( lpszProc, "glFramebufferTexture2D" )) return (PROC)(void *)wglFramebufferTexture2D; return pglXGetProcAddressARB((const GLubyte*)lpszProc); } @@ -2261,6 +2263,30 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) return ret; } +static void wglFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + + TRACE( "target %#x, attachment %#x, textarget %#x, texture %u, level %u.\n", target, attachment, + textarget, texture, level ); + + if (ctx->fs_hack) + { + /* glFramebufferTexture2D should fail for default framebuffer 0. + * Let it fail and relay appropriate error instead of breaking fs_hack FBO. */ + if (ctx->current_read_fbo == ctx->fs_hack_fbo) pglBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); + if (ctx->current_draw_fbo == ctx->fs_hack_fbo) pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); + } + pglFramebufferTexture2D( target, attachment, textarget, texture, level ); + if (ctx->fs_hack) + { + if (ctx->current_read_fbo == ctx->fs_hack_fbo) + pglBindFramebuffer( GL_READ_FRAMEBUFFER, ctx->fs_hack_fbo ); + if (ctx->current_draw_fbo == ctx->fs_hack_fbo) + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_fbo ); + } +} + static void wglBindFramebuffer( GLenum target, GLuint framebuffer ) { struct wgl_context *ctx = NtCurrentTeb()->glContext; From 80079fb2148f815e3715750005b479d4cf8c436b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:52 +0100 Subject: [PATCH 0214/1506] fshack: winevulkan: Hook and wrap swapchain objects. --- dlls/winevulkan/make_vulkan | 4 +++ dlls/winevulkan/vulkan.c | 52 ++++++++++++++++++++++++++++++++ dlls/winevulkan/vulkan_private.h | 17 +++++++++++ 3 files changed, 73 insertions(+) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index fc7a822c0e6..a17df6f8829 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -230,6 +230,7 @@ MANUAL_UNIX_THUNKS = { "vkCreateDevice", "vkCreateImage", "vkCreateInstance", + "vkCreateSwapchainKHR", "vkCreateWin32SurfaceKHR", "vkDestroyCommandPool", "vkDestroyDebugReportCallbackEXT", @@ -238,6 +239,7 @@ MANUAL_UNIX_THUNKS = { "vkDestroyDevice", "vkDestroyInstance", "vkDestroySurfaceKHR", + "vkDestroySwapchainKHR", "vkEnumerateDeviceExtensionProperties", "vkEnumerateDeviceLayerProperties", "vkEnumerateInstanceExtensionProperties", @@ -1188,6 +1190,8 @@ class VkHandle(object): return "wine_queue_from_handle({0})->host_queue".format(name) if self.name == "VkSurfaceKHR": return "wine_surface_from_handle({0})->host_surface".format(name) + if self.name == "VkSwapchainKHR": + return "wine_swapchain_from_handle({0})->host_swapchain".format(name) if self.is_dispatchable(): LOGGER.error("Unhandled host handle for: {0}".format(self.name)) return None diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 3611ac4abd0..30d4d047e67 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1544,6 +1544,39 @@ void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice phy properties->externalSemaphoreFeatures = 0; } +VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCreateInfoKHR *info, const VkAllocationCallbacks *allocator, + VkSwapchainKHR *swapchain) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + VkSwapchainCreateInfoKHR create_info_host = *info; + struct wine_swapchain *object; + VkResult res; + + if (!(object = calloc(1, sizeof(*object)))) + { + ERR("Failed to allocate memory for swapchain\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + if (create_info_host.surface) + create_info_host.surface = wine_surface_from_handle(create_info_host.surface)->driver_surface; + if (create_info_host.oldSwapchain) + create_info_host.oldSwapchain = wine_swapchain_from_handle(create_info_host.oldSwapchain)->host_swapchain; + + res = device->funcs.p_vkCreateSwapchainKHR(device->host_device, &create_info_host, NULL, &object->host_swapchain); + + if (res != VK_SUCCESS) + { + free(object); + return res; + } + + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, object->host_swapchain, object->host_swapchain, object); + *swapchain = wine_swapchain_to_handle(object); + + return res; +} + VkResult wine_vkCreateWin32SurfaceKHR(VkInstance handle, const VkWin32SurfaceCreateInfoKHR *createInfo, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) { @@ -1993,6 +2026,25 @@ void wine_vkDestroyDebugReportCallbackEXT(VkInstance handle, VkDebugReportCallba free(object); } +void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR handle, const VkAllocationCallbacks *allocator) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + struct wine_swapchain *swapchain; + + if (!handle) + return; + + swapchain = wine_swapchain_from_handle(handle); + + if (allocator) + FIXME("Support for allocation callbacks not implemented yet\n"); + + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, swapchain); + + device->funcs.p_vkDestroySwapchainKHR(device->host_device, swapchain->host_swapchain, NULL); + free(swapchain); +} + VkResult wine_vkCreateDeferredOperationKHR(VkDevice handle, const VkAllocationCallbacks* allocator, VkDeferredOperationKHR* deferredOperation) diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 12664d361c0..0d3a8cc0c30 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -72,6 +72,23 @@ static inline struct wine_device *wine_device_from_handle(VkDevice handle) return (struct wine_device *)(uintptr_t)handle->base.unix_handle; } +struct wine_swapchain +{ + VkSwapchainKHR host_swapchain; + + struct wine_vk_mapping mapping; +}; + +static inline struct wine_swapchain *wine_swapchain_from_handle(VkSwapchainKHR handle) +{ + return (struct wine_swapchain *)(uintptr_t)handle; +} + +static inline VkSwapchainKHR wine_swapchain_to_handle(struct wine_swapchain *swapchain) +{ + return (VkSwapchainKHR)(uintptr_t)swapchain; +} + struct wine_debug_utils_messenger; struct wine_debug_report_callback From 6e767e9c12b789b1d8ccd88b1829415acb881503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 20:23:26 +0100 Subject: [PATCH 0215/1506] fshack: winevulkan: Support vulkan scaling according to fake resolution. Includes work by Georg Lehmann, Zhiyi Zhang, Brendan Shanks, and Joshua Ashton. --- dlls/winevulkan/make_vulkan | 9 + dlls/winevulkan/vulkan.c | 1227 +++++++++++++++++++++++++++++- dlls/winevulkan/vulkan_private.h | 31 + 3 files changed, 1266 insertions(+), 1 deletion(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index a17df6f8829..5470a8cda69 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -266,6 +266,8 @@ MANUAL_UNIX_THUNKS = { "vkGetPhysicalDeviceImageFormatProperties2KHR", "vkGetPhysicalDeviceSurfaceCapabilities2KHR", "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", + "vkGetSwapchainImagesKHR", + "vkQueuePresentKHR", "vkMapMemory", "vkMapMemory2KHR", "vkUnmapMemory", @@ -3188,6 +3190,13 @@ class VkGenerator(object): f.write("\n") f.write(" /* winevulkan specific functions */\n") f.write(" VkSurfaceKHR (*p_wine_get_host_surface)(VkSurfaceKHR);\n") + f.write("\n") + f.write(" /* Optional. Returns TRUE if FS hack is active, otherwise returns FALSE. If\n") + f.write(" * it returns TRUE, then real_sz will contain the actual display\n") + f.write(" * resolution; user_sz will contain the app's requested mode; and dst_blit\n") + f.write(" * will contain the area to blit the user image to in real coordinates.\n") + f.write(" * All parameters are optional. */\n") + f.write(" VkBool32 (*query_fs_hack)(VkSurfaceKHR surface, VkExtent2D *real_sz, VkExtent2D *user_sz, VkRect2D *dst_blit, VkFilter *filter);\n") f.write("};\n\n") f.write("static inline void *get_vulkan_driver_device_proc_addr(\n") diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 30d4d047e67..151b0113be6 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -22,6 +22,7 @@ #endif #include "config.h" +#include #include #include "vulkan_private.h" @@ -1544,12 +1545,617 @@ void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice phy properties->externalSemaphoreFeatures = 0; } +/* +#version 450 + +layout(binding = 0) uniform sampler2D texSampler; +layout(binding = 1, rgba8) uniform writeonly image2D outImage; +layout(push_constant) uniform pushConstants { + //both in real image coords + vec2 offset; + vec2 extents; +} constants; + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +void main() +{ + vec2 texcoord = (vec2(gl_GlobalInvocationID.xy) - constants.offset) / constants.extents; + vec4 c = texture(texSampler, texcoord); + imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), c.bgra); +} +*/ +const uint32_t blit_comp_spv[] = { + 0x07230203,0x00010000,0x00080006,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, + 0x0006000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x0000000d,0x00060010,0x00000004, + 0x00000011,0x00000008,0x00000008,0x00000001,0x00030003,0x00000002,0x000001c2,0x00040005, + 0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574,0x64726f6f,0x00000000, + 0x00080005,0x0000000d,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x00000044, + 0x00060005,0x00000012,0x68737570,0x736e6f43,0x746e6174,0x00000073,0x00050006,0x00000012, + 0x00000000,0x7366666f,0x00007465,0x00050006,0x00000012,0x00000001,0x65747865,0x0073746e, + 0x00050005,0x00000014,0x736e6f63,0x746e6174,0x00000073,0x00030005,0x00000021,0x00000063, + 0x00050005,0x00000025,0x53786574,0x6c706d61,0x00007265,0x00050005,0x0000002c,0x4974756f, + 0x6567616d,0x00000000,0x00040047,0x0000000d,0x0000000b,0x0000001c,0x00050048,0x00000012, + 0x00000000,0x00000023,0x00000000,0x00050048,0x00000012,0x00000001,0x00000023,0x00000008, + 0x00030047,0x00000012,0x00000002,0x00040047,0x00000025,0x00000022,0x00000000,0x00040047, + 0x00000025,0x00000021,0x00000000,0x00040047,0x0000002c,0x00000022,0x00000000,0x00040047, + 0x0000002c,0x00000021,0x00000001,0x00030047,0x0000002c,0x00000019,0x00040047,0x00000036, + 0x0000000b,0x00000019,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, + 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008, + 0x00000007,0x00000007,0x00040015,0x0000000a,0x00000020,0x00000000,0x00040017,0x0000000b, + 0x0000000a,0x00000003,0x00040020,0x0000000c,0x00000001,0x0000000b,0x0004003b,0x0000000c, + 0x0000000d,0x00000001,0x00040017,0x0000000e,0x0000000a,0x00000002,0x0004001e,0x00000012, + 0x00000007,0x00000007,0x00040020,0x00000013,0x00000009,0x00000012,0x0004003b,0x00000013, + 0x00000014,0x00000009,0x00040015,0x00000015,0x00000020,0x00000001,0x0004002b,0x00000015, + 0x00000016,0x00000000,0x00040020,0x00000017,0x00000009,0x00000007,0x0004002b,0x00000015, + 0x0000001b,0x00000001,0x00040017,0x0000001f,0x00000006,0x00000004,0x00040020,0x00000020, + 0x00000007,0x0000001f,0x00090019,0x00000022,0x00000006,0x00000001,0x00000000,0x00000000, + 0x00000000,0x00000001,0x00000000,0x0003001b,0x00000023,0x00000022,0x00040020,0x00000024, + 0x00000000,0x00000023,0x0004003b,0x00000024,0x00000025,0x00000000,0x0004002b,0x00000006, + 0x00000028,0x00000000,0x00090019,0x0000002a,0x00000006,0x00000001,0x00000000,0x00000000, + 0x00000000,0x00000002,0x00000004,0x00040020,0x0000002b,0x00000000,0x0000002a,0x0004003b, + 0x0000002b,0x0000002c,0x00000000,0x00040017,0x00000030,0x00000015,0x00000002,0x0004002b, + 0x0000000a,0x00000034,0x00000008,0x0004002b,0x0000000a,0x00000035,0x00000001,0x0006002c, + 0x0000000b,0x00000036,0x00000034,0x00000034,0x00000035,0x00050036,0x00000002,0x00000004, + 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007, + 0x0004003b,0x00000020,0x00000021,0x00000007,0x0004003d,0x0000000b,0x0000000f,0x0000000d, + 0x0007004f,0x0000000e,0x00000010,0x0000000f,0x0000000f,0x00000000,0x00000001,0x00040070, + 0x00000007,0x00000011,0x00000010,0x00050041,0x00000017,0x00000018,0x00000014,0x00000016, + 0x0004003d,0x00000007,0x00000019,0x00000018,0x00050083,0x00000007,0x0000001a,0x00000011, + 0x00000019,0x00050041,0x00000017,0x0000001c,0x00000014,0x0000001b,0x0004003d,0x00000007, + 0x0000001d,0x0000001c,0x00050088,0x00000007,0x0000001e,0x0000001a,0x0000001d,0x0003003e, + 0x00000009,0x0000001e,0x0004003d,0x00000023,0x00000026,0x00000025,0x0004003d,0x00000007, + 0x00000027,0x00000009,0x00070058,0x0000001f,0x00000029,0x00000026,0x00000027,0x00000002, + 0x00000028,0x0003003e,0x00000021,0x00000029,0x0004003d,0x0000002a,0x0000002d,0x0000002c, + 0x0004003d,0x0000000b,0x0000002e,0x0000000d,0x0007004f,0x0000000e,0x0000002f,0x0000002e, + 0x0000002e,0x00000000,0x00000001,0x0004007c,0x00000030,0x00000031,0x0000002f,0x0004003d, + 0x0000001f,0x00000032,0x00000021,0x0009004f,0x0000001f,0x00000033,0x00000032,0x00000032, + 0x00000002,0x00000001,0x00000000,0x00000003,0x00040063,0x0000002d,0x00000031,0x00000033, + 0x000100fd,0x00010038 +}; + +static VkResult create_pipeline(struct wine_device *device, struct wine_swapchain *swapchain, VkShaderModule shaderModule) +{ + VkComputePipelineCreateInfo pipelineInfo = {0}; + VkResult res; + + pipelineInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; + pipelineInfo.stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + pipelineInfo.stage.stage = VK_SHADER_STAGE_COMPUTE_BIT; + pipelineInfo.stage.module = shaderModule; + pipelineInfo.stage.pName = "main"; + pipelineInfo.layout = swapchain->pipeline_layout; + pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; + pipelineInfo.basePipelineIndex = -1; + + res = device->funcs.p_vkCreateComputePipelines(device->host_device, VK_NULL_HANDLE, 1, &pipelineInfo, + NULL, &swapchain->pipeline); + if (res != VK_SUCCESS) + { + ERR("vkCreateComputePipelines: %d\n", res); + return res; + } + + return VK_SUCCESS; +} + +static VkResult create_descriptor_set(struct wine_device *device, struct wine_swapchain *swapchain, + struct fs_hack_image *hack) +{ + VkDescriptorImageInfo userDescriptorImageInfo = {0}, realDescriptorImageInfo = {0}; + VkDescriptorSetAllocateInfo descriptorAllocInfo = {0}; + VkWriteDescriptorSet descriptorWrites[2] = {{0}, {0}}; + VkResult res; + + descriptorAllocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + descriptorAllocInfo.descriptorPool = swapchain->descriptor_pool; + descriptorAllocInfo.descriptorSetCount = 1; + descriptorAllocInfo.pSetLayouts = &swapchain->descriptor_set_layout; + + res = device->funcs.p_vkAllocateDescriptorSets(device->host_device, &descriptorAllocInfo, &hack->descriptor_set); + if (res != VK_SUCCESS) + { + ERR("vkAllocateDescriptorSets: %d\n", res); + return res; + } + + userDescriptorImageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + userDescriptorImageInfo.imageView = hack->user_view; + userDescriptorImageInfo.sampler = swapchain->sampler; + + realDescriptorImageInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL; + realDescriptorImageInfo.imageView = hack->blit_view; + + descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + descriptorWrites[0].dstSet = hack->descriptor_set; + descriptorWrites[0].dstBinding = 0; + descriptorWrites[0].dstArrayElement = 0; + descriptorWrites[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + descriptorWrites[0].descriptorCount = 1; + descriptorWrites[0].pImageInfo = &userDescriptorImageInfo; + + descriptorWrites[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + descriptorWrites[1].dstSet = hack->descriptor_set; + descriptorWrites[1].dstBinding = 1; + descriptorWrites[1].dstArrayElement = 0; + descriptorWrites[1].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + descriptorWrites[1].descriptorCount = 1; + descriptorWrites[1].pImageInfo = &realDescriptorImageInfo; + + device->funcs.p_vkUpdateDescriptorSets(device->host_device, 2, descriptorWrites, 0, NULL); + + return VK_SUCCESS; +} + +static VkResult init_blit_images(struct wine_device *device, struct wine_swapchain *swapchain) +{ + VkResult res; + VkSamplerCreateInfo samplerInfo = {0}; + VkDescriptorPoolSize poolSizes[2] = {{0}, {0}}; + VkDescriptorPoolCreateInfo poolInfo = {0}; + VkDescriptorSetLayoutBinding layoutBindings[2] = {{0}, {0}}; + VkDescriptorSetLayoutCreateInfo descriptorLayoutInfo = {0}; + VkPipelineLayoutCreateInfo pipelineLayoutInfo = {0}; + VkPushConstantRange pushConstants; + VkShaderModuleCreateInfo shaderInfo = {0}; + VkShaderModule shaderModule = 0; + VkDeviceSize blitMemTotal = 0, offs; + VkImageCreateInfo imageInfo = {0}; + VkMemoryRequirements blitMemReq; + VkMemoryAllocateInfo allocInfo = {0}; + VkPhysicalDeviceMemoryProperties memProperties; + VkImageViewCreateInfo viewInfo = {0}; + uint32_t blit_memory_type = -1, i; + + samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; + samplerInfo.magFilter = swapchain->fs_hack_filter; + samplerInfo.minFilter = swapchain->fs_hack_filter; + samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; + samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; + samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; + samplerInfo.anisotropyEnable = VK_FALSE; + samplerInfo.maxAnisotropy = 1; + samplerInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK; + samplerInfo.unnormalizedCoordinates = VK_FALSE; + samplerInfo.compareEnable = VK_FALSE; + samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS; + samplerInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; + samplerInfo.mipLodBias = 0.0f; + samplerInfo.minLod = 0.0f; + samplerInfo.maxLod = 0.0f; + + res = device->funcs.p_vkCreateSampler(device->host_device, &samplerInfo, NULL, &swapchain->sampler); + if (res != VK_SUCCESS) + { + WARN("vkCreateSampler failed, res=%d\n", res); + return res; + } + + poolSizes[0].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + poolSizes[0].descriptorCount = swapchain->n_images; + poolSizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + poolSizes[1].descriptorCount = swapchain->n_images; + + poolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; + poolInfo.poolSizeCount = 2; + poolInfo.pPoolSizes = poolSizes; + poolInfo.maxSets = swapchain->n_images; + + res = device->funcs.p_vkCreateDescriptorPool(device->host_device, &poolInfo, NULL, &swapchain->descriptor_pool); + if (res != VK_SUCCESS) + { + ERR("vkCreateDescriptorPool: %d\n", res); + goto fail; + } + + layoutBindings[0].binding = 0; + layoutBindings[0].descriptorCount = 1; + layoutBindings[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + layoutBindings[0].pImmutableSamplers = NULL; + layoutBindings[0].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT; + + layoutBindings[1].binding = 1; + layoutBindings[1].descriptorCount = 1; + layoutBindings[1].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + layoutBindings[1].pImmutableSamplers = NULL; + layoutBindings[1].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT; + + descriptorLayoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; + descriptorLayoutInfo.bindingCount = 2; + descriptorLayoutInfo.pBindings = layoutBindings; + + res = device->funcs.p_vkCreateDescriptorSetLayout(device->host_device, &descriptorLayoutInfo, NULL, + &swapchain->descriptor_set_layout); + if (res != VK_SUCCESS) + { + ERR("vkCreateDescriptorSetLayout: %d\n", res); + goto fail; + } + + pushConstants.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT; + pushConstants.offset = 0; + pushConstants.size = 4 * sizeof(float); /* 2 * vec2 */ + + pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; + pipelineLayoutInfo.setLayoutCount = 1; + pipelineLayoutInfo.pSetLayouts = &swapchain->descriptor_set_layout; + pipelineLayoutInfo.pushConstantRangeCount = 1; + pipelineLayoutInfo.pPushConstantRanges = &pushConstants; + + res = device->funcs.p_vkCreatePipelineLayout(device->host_device, &pipelineLayoutInfo, NULL, + &swapchain->pipeline_layout); + if (res != VK_SUCCESS) + { + ERR("vkCreatePipelineLayout: %d\n", res); + goto fail; + } + + shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; + shaderInfo.codeSize = sizeof(blit_comp_spv); + shaderInfo.pCode = blit_comp_spv; + + res = device->funcs.p_vkCreateShaderModule(device->host_device, &shaderInfo, NULL, &shaderModule); + if (res != VK_SUCCESS) + { + ERR("vkCreateShaderModule: %d\n", res); + goto fail; + } + + res = create_pipeline(device, swapchain, shaderModule); + if (res != VK_SUCCESS) + goto fail; + + device->funcs.p_vkDestroyShaderModule(device->host_device, shaderModule, NULL); + + if (!(swapchain->surface_usage & VK_IMAGE_USAGE_STORAGE_BIT)) + { + TRACE("using intermediate blit images\n"); + /* create intermediate blit images */ + for (i = 0; i < swapchain->n_images; ++i) + { + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; + + imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; + imageInfo.imageType = VK_IMAGE_TYPE_2D; + imageInfo.extent.width = swapchain->real_extent.width; + imageInfo.extent.height = swapchain->real_extent.height; + imageInfo.extent.depth = 1; + imageInfo.mipLevels = 1; + imageInfo.arrayLayers = 1; + imageInfo.format = VK_FORMAT_R8G8B8A8_UNORM; + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + imageInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; + res = device->funcs.p_vkCreateImage(device->host_device, &imageInfo, NULL, &hack->blit_image); + if (res != VK_SUCCESS) + { + ERR("vkCreateImage failed: %d\n", res); + goto fail; + } + + device->funcs.p_vkGetImageMemoryRequirements(device->host_device, hack->blit_image, &blitMemReq); + + offs = blitMemTotal % blitMemReq.alignment; + if (offs) + blitMemTotal += blitMemReq.alignment - offs; + + blitMemTotal += blitMemReq.size; + } + + /* allocate backing memory */ + device->phys_dev->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(device->phys_dev->host_physical_device, &memProperties); + + for (i = 0; i < memProperties.memoryTypeCount; i++) + { + UINT flag = memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + if (flag == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) + { + if (blitMemReq.memoryTypeBits & (1 << i)) + { + blit_memory_type = i; + break; + } + } + } + + if (blit_memory_type == -1) + { + ERR("unable to find suitable memory type\n"); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto fail; + } + + allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + allocInfo.allocationSize = blitMemTotal; + allocInfo.memoryTypeIndex = blit_memory_type; + + res = device->funcs.p_vkAllocateMemory(device->host_device, &allocInfo, NULL, &swapchain->blit_image_memory); + if (res != VK_SUCCESS) + { + ERR("vkAllocateMemory: %d\n", res); + goto fail; + } + + /* bind backing memory and create imageviews */ + blitMemTotal = 0; + for (i = 0; i < swapchain->n_images; ++i) + { + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; + + device->funcs.p_vkGetImageMemoryRequirements(device->host_device, hack->blit_image, &blitMemReq); + + offs = blitMemTotal % blitMemReq.alignment; + if (offs) + blitMemTotal += blitMemReq.alignment - offs; + + res = device->funcs.p_vkBindImageMemory(device->host_device, hack->blit_image, + swapchain->blit_image_memory, blitMemTotal); + if (res != VK_SUCCESS) + { + ERR("vkBindImageMemory: %d\n", res); + goto fail; + } + + blitMemTotal += blitMemReq.size; + } + } + else + TRACE("blitting directly to swapchain images\n"); + + /* create imageviews */ + for (i = 0; i < swapchain->n_images; ++i) + { + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; + + viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + viewInfo.image = hack->blit_image ? hack->blit_image : hack->swapchain_image; + viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; + viewInfo.format = VK_FORMAT_R8G8B8A8_UNORM; + viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + viewInfo.subresourceRange.baseMipLevel = 0; + viewInfo.subresourceRange.levelCount = 1; + viewInfo.subresourceRange.baseArrayLayer = 0; + viewInfo.subresourceRange.layerCount = 1; + + res = device->funcs.p_vkCreateImageView(device->host_device, &viewInfo, NULL, &hack->blit_view); + if (res != VK_SUCCESS) + { + ERR("vkCreateImageView(blit): %d\n", res); + goto fail; + } + + res = create_descriptor_set(device, swapchain, hack); + if (res != VK_SUCCESS) + goto fail; + } + + return VK_SUCCESS; + +fail: + for (i = 0; i < swapchain->n_images; ++i) + { + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; + + device->funcs.p_vkDestroyImageView(device->host_device, hack->blit_view, NULL); + hack->blit_view = VK_NULL_HANDLE; + + device->funcs.p_vkDestroyImage(device->host_device, hack->blit_image, NULL); + hack->blit_image = VK_NULL_HANDLE; + } + + device->funcs.p_vkDestroyShaderModule(device->host_device, shaderModule, NULL); + + device->funcs.p_vkDestroyPipeline(device->host_device, swapchain->pipeline, NULL); + swapchain->pipeline = VK_NULL_HANDLE; + + device->funcs.p_vkDestroyPipelineLayout(device->host_device, swapchain->pipeline_layout, NULL); + swapchain->pipeline_layout = VK_NULL_HANDLE; + + device->funcs.p_vkDestroyDescriptorSetLayout(device->host_device, swapchain->descriptor_set_layout, NULL); + swapchain->descriptor_set_layout = VK_NULL_HANDLE; + + device->funcs.p_vkDestroyDescriptorPool(device->host_device, swapchain->descriptor_pool, NULL); + swapchain->descriptor_pool = VK_NULL_HANDLE; + + device->funcs.p_vkFreeMemory(device->host_device, swapchain->blit_image_memory, NULL); + swapchain->blit_image_memory = VK_NULL_HANDLE; + + device->funcs.p_vkDestroySampler(device->host_device, swapchain->sampler, NULL); + swapchain->sampler = VK_NULL_HANDLE; + + return res; +} + +static void destroy_fs_hack_image(struct wine_device *device, struct wine_swapchain *swapchain, + struct fs_hack_image *hack) +{ + device->funcs.p_vkDestroyImageView(device->host_device, hack->user_view, NULL); + device->funcs.p_vkDestroyImageView(device->host_device, hack->blit_view, NULL); + device->funcs.p_vkDestroyImage(device->host_device, hack->user_image, NULL); + device->funcs.p_vkDestroyImage(device->host_device, hack->blit_image, NULL); + if (hack->cmd) + device->funcs.p_vkFreeCommandBuffers(device->host_device, swapchain->cmd_pools[hack->cmd_queue_idx], + 1, &hack->cmd); + device->funcs.p_vkDestroySemaphore(device->host_device, hack->blit_finished, NULL); +} + +static VkResult init_fs_hack_images(struct wine_device *device, struct wine_swapchain *swapchain, + VkSwapchainCreateInfoKHR *createinfo) +{ + VkResult res; + VkImage *real_images = NULL; + VkDeviceSize userMemTotal = 0, offs; + VkImageCreateInfo imageInfo = {0}; + VkSemaphoreCreateInfo semaphoreInfo = {0}; + VkMemoryRequirements userMemReq; + VkMemoryAllocateInfo allocInfo = {0}; + VkPhysicalDeviceMemoryProperties memProperties; + VkImageViewCreateInfo viewInfo = {0}; + uint32_t count, i = 0, user_memory_type = -1; + + res = device->funcs.p_vkGetSwapchainImagesKHR(device->host_device, swapchain->host_swapchain, &count, NULL); + if (res != VK_SUCCESS) + { + WARN("vkGetSwapchainImagesKHR failed, res=%d\n", res); + return res; + } + + real_images = malloc(count * sizeof(VkImage)); + swapchain->cmd_pools = calloc(device->queue_count, sizeof(VkCommandPool)); + swapchain->fs_hack_images = calloc(count, sizeof(struct fs_hack_image)); + if (!real_images || !swapchain->cmd_pools || !swapchain->fs_hack_images) + goto fail; + + res = device->funcs.p_vkGetSwapchainImagesKHR(device->host_device, swapchain->host_swapchain, &count, real_images); + if (res != VK_SUCCESS) + { + WARN("vkGetSwapchainImagesKHR failed, res=%d\n", res); + goto fail; + } + + /* create user images */ + for (i = 0; i < count; ++i) + { + struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; + + hack->swapchain_image = real_images[i]; + + semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + res = device->funcs.p_vkCreateSemaphore(device->host_device, &semaphoreInfo, NULL, &hack->blit_finished); + if (res != VK_SUCCESS) + { + WARN("vkCreateSemaphore failed, res=%d\n", res); + goto fail; + } + + imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; + imageInfo.imageType = VK_IMAGE_TYPE_2D; + imageInfo.extent.width = swapchain->user_extent.width; + imageInfo.extent.height = swapchain->user_extent.height; + imageInfo.extent.depth = 1; + imageInfo.mipLevels = 1; + imageInfo.arrayLayers = createinfo->imageArrayLayers; + imageInfo.format = createinfo->imageFormat; + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + imageInfo.usage = createinfo->imageUsage | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + imageInfo.sharingMode = createinfo->imageSharingMode; + imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; + imageInfo.queueFamilyIndexCount = createinfo->queueFamilyIndexCount; + imageInfo.pQueueFamilyIndices = createinfo->pQueueFamilyIndices; + res = device->funcs.p_vkCreateImage(device->host_device, &imageInfo, NULL, &hack->user_image); + if (res != VK_SUCCESS) + { + ERR("vkCreateImage failed: %d\n", res); + goto fail; + } + + device->funcs.p_vkGetImageMemoryRequirements(device->host_device, hack->user_image, &userMemReq); + + offs = userMemTotal % userMemReq.alignment; + if (offs) + userMemTotal += userMemReq.alignment - offs; + + userMemTotal += userMemReq.size; + + swapchain->n_images++; + } + + /* allocate backing memory */ + device->phys_dev->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(device->phys_dev->host_physical_device, &memProperties); + + for (i = 0; i < memProperties.memoryTypeCount; i++) + { + UINT flag = memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + if (flag == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) + { + if (userMemReq.memoryTypeBits & (1 << i)) + { + user_memory_type = i; + break; + } + } + } + + if (user_memory_type == -1) + { + ERR("unable to find suitable memory type\n"); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto fail; + } + + allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + allocInfo.allocationSize = userMemTotal; + allocInfo.memoryTypeIndex = user_memory_type; + + res = device->funcs.p_vkAllocateMemory(device->host_device, &allocInfo, NULL, &swapchain->user_image_memory); + if (res != VK_SUCCESS) + { + ERR("vkAllocateMemory: %d\n", res); + goto fail; + } + + /* bind backing memory and create imageviews */ + userMemTotal = 0; + for (i = 0; i < count; ++i) + { + device->funcs.p_vkGetImageMemoryRequirements(device->host_device, swapchain->fs_hack_images[i].user_image, &userMemReq); + + offs = userMemTotal % userMemReq.alignment; + if (offs) + userMemTotal += userMemReq.alignment - offs; + + res = device->funcs.p_vkBindImageMemory(device->host_device, swapchain->fs_hack_images[i].user_image, + swapchain->user_image_memory, userMemTotal); + if (res != VK_SUCCESS) + { + ERR("vkBindImageMemory: %d\n", res); + goto fail; + } + + userMemTotal += userMemReq.size; + + viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + viewInfo.image = swapchain->fs_hack_images[i].user_image; + viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; + viewInfo.format = createinfo->imageFormat; + viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + viewInfo.subresourceRange.baseMipLevel = 0; + viewInfo.subresourceRange.levelCount = 1; + viewInfo.subresourceRange.baseArrayLayer = 0; + viewInfo.subresourceRange.layerCount = 1; + + res = device->funcs.p_vkCreateImageView(device->host_device, &viewInfo, NULL, + &swapchain->fs_hack_images[i].user_view); + if (res != VK_SUCCESS) + { + ERR("vkCreateImageView(user): %d\n", res); + goto fail; + } + } + + free(real_images); + + return VK_SUCCESS; + +fail: + for (i = 0; i < swapchain->n_images; ++i) destroy_fs_hack_image(device, swapchain, &swapchain->fs_hack_images[i]); + free(real_images); + free(swapchain->cmd_pools); + free(swapchain->fs_hack_images); + return res; +} + VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCreateInfoKHR *info, const VkAllocationCallbacks *allocator, VkSwapchainKHR *swapchain) { struct wine_device *device = wine_device_from_handle(device_handle); VkSwapchainCreateInfoKHR create_info_host = *info; struct wine_swapchain *object; + VkExtent2D user_sz; VkResult res; if (!(object = calloc(1, sizeof(*object)))) @@ -1563,6 +2169,41 @@ VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCrea if (create_info_host.oldSwapchain) create_info_host.oldSwapchain = wine_swapchain_from_handle(create_info_host.oldSwapchain)->host_swapchain; + if (vk_funcs->query_fs_hack && + vk_funcs->query_fs_hack(create_info_host.surface, &object->real_extent, &user_sz, + &object->blit_dst, &object->fs_hack_filter) && + create_info_host.imageExtent.width == user_sz.width && + create_info_host.imageExtent.height == user_sz.height) + { + uint32_t count; + VkSurfaceCapabilitiesKHR caps = {0}; + + device->phys_dev->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties(device->phys_dev->host_physical_device, &count, NULL); + + device->queue_props = malloc(sizeof(VkQueueFamilyProperties) * count); + + device->phys_dev->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties(device->phys_dev->host_physical_device, &count, device->queue_props); + + res = device->phys_dev->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device->phys_dev->host_physical_device, create_info_host.surface, &caps); + if (res != VK_SUCCESS) + { + TRACE("vkGetPhysicalDeviceSurfaceCapabilities failed, res=%d\n", res); + free(object); + return res; + } + + object->surface_usage = caps.supportedUsageFlags; + TRACE("surface usage flags: 0x%x\n", object->surface_usage); + + create_info_host.imageExtent = object->real_extent; + create_info_host.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; /* XXX: check if supported by surface */ + + if (create_info_host.imageFormat != VK_FORMAT_B8G8R8A8_UNORM && create_info_host.imageFormat != VK_FORMAT_B8G8R8A8_SRGB) + FIXME("swapchain image format is not BGRA8 UNORM/SRGB. Things may go badly. %d\n", create_info_host.imageFormat); + + object->fs_hack_enabled = TRUE; + } + res = device->funcs.p_vkCreateSwapchainKHR(device->host_device, &create_info_host, NULL, &object->host_swapchain); if (res != VK_SUCCESS) @@ -1571,7 +2212,34 @@ VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCrea return res; } - WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, object->host_swapchain, object->host_swapchain, object); + if (object->fs_hack_enabled) + { + object->user_extent = info->imageExtent; + + res = init_fs_hack_images(device, object, &create_info_host); + if (res != VK_SUCCESS) + { + ERR("creating fs hack images failed: %d\n", res); + device->funcs.p_vkDestroySwapchainKHR(device->host_device, object->host_swapchain, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, object); + free(object); + return res; + } + + /* FIXME: would be nice to do this on-demand, but games can use up all + * memory so we fail to allocate later */ + res = init_blit_images(device, object); + if (res != VK_SUCCESS) + { + ERR("creating blit images failed: %d\n", res); + device->funcs.p_vkDestroySwapchainKHR(device->host_device, object->host_swapchain, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, object); + free(object); + return res; + } + } + + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, object, object->host_swapchain, object); *swapchain = wine_swapchain_to_handle(object); return res; @@ -1883,6 +2551,7 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice handle, struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); struct wine_surface *surface = wine_surface_from_handle(surface_handle); VkResult res; + VkExtent2D user_res; res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev->host_physical_device, surface->driver_surface, capabilities); @@ -1890,6 +2559,14 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice handle, if (res == VK_SUCCESS) adjust_max_image_count(phys_dev, capabilities); + if (res == VK_SUCCESS && vk_funcs->query_fs_hack && + vk_funcs->query_fs_hack(surface->driver_surface, NULL, &user_res, NULL, NULL)) + { + capabilities->currentExtent = user_res; + capabilities->minImageExtent = user_res; + capabilities->maxImageExtent = user_res; + } + return res; } @@ -1901,6 +2578,7 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice handle struct wine_surface *surface = wine_surface_from_handle(surface_info->surface); VkPhysicalDeviceSurfaceInfo2KHR host_info; VkResult res; + VkExtent2D user_res; host_info.sType = surface_info->sType; host_info.pNext = surface_info->pNext; @@ -1911,6 +2589,14 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice handle if (res == VK_SUCCESS) adjust_max_image_count(phys_dev, &capabilities->surfaceCapabilities); + if (res == VK_SUCCESS && vk_funcs->query_fs_hack && + vk_funcs->query_fs_hack(wine_surface_from_handle(surface_info->surface)->driver_surface, NULL, &user_res, NULL, NULL)) + { + capabilities->surfaceCapabilities.currentExtent = user_res; + capabilities->surfaceCapabilities.minImageExtent = user_res; + capabilities->surfaceCapabilities.maxImageExtent = user_res; + } + return res; } @@ -2030,6 +2716,7 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR handle, c { struct wine_device *device = wine_device_from_handle(device_handle); struct wine_swapchain *swapchain; + uint32_t i; if (!handle) return; @@ -2039,12 +2726,550 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR handle, c if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); + if (swapchain->fs_hack_enabled) + { + for (i = 0; i < swapchain->n_images; ++i) destroy_fs_hack_image(device, swapchain, &swapchain->fs_hack_images[i]); + + for (i = 0; i < device->queue_count; ++i) + if (swapchain->cmd_pools[i]) + device->funcs.p_vkDestroyCommandPool(device->host_device, swapchain->cmd_pools[i], NULL); + + device->funcs.p_vkDestroyPipeline(device->host_device, swapchain->pipeline, NULL); + device->funcs.p_vkDestroyPipelineLayout(device->host_device, swapchain->pipeline_layout, NULL); + device->funcs.p_vkDestroyDescriptorSetLayout(device->host_device, swapchain->descriptor_set_layout, NULL); + device->funcs.p_vkDestroyDescriptorPool(device->host_device, swapchain->descriptor_pool, NULL); + device->funcs.p_vkDestroySampler(device->host_device, swapchain->sampler, NULL); + device->funcs.p_vkFreeMemory(device->host_device, swapchain->user_image_memory, NULL); + device->funcs.p_vkFreeMemory(device->host_device, swapchain->blit_image_memory, NULL); + free(swapchain->cmd_pools); + free(swapchain->fs_hack_images); + } + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, swapchain); device->funcs.p_vkDestroySwapchainKHR(device->host_device, swapchain->host_swapchain, NULL); free(swapchain); } +VkResult wine_vkGetSwapchainImagesKHR(VkDevice device_handle, VkSwapchainKHR handle, + uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + struct wine_swapchain *swapchain = wine_swapchain_from_handle(handle); + uint32_t i; + + if (pSwapchainImages && swapchain->fs_hack_enabled) + { + if (*pSwapchainImageCount > swapchain->n_images) + *pSwapchainImageCount = swapchain->n_images; + for (i = 0; i < *pSwapchainImageCount; ++i) pSwapchainImages[i] = swapchain->fs_hack_images[i].user_image; + return *pSwapchainImageCount == swapchain->n_images ? VK_SUCCESS : VK_INCOMPLETE; + } + + return device->funcs.p_vkGetSwapchainImagesKHR(device->host_device, swapchain->host_swapchain, + pSwapchainImageCount, pSwapchainImages); +} + +static VkCommandBuffer create_hack_cmd(struct wine_queue *queue, struct wine_swapchain *swapchain, uint32_t queue_idx) +{ + VkCommandBufferAllocateInfo allocInfo = {0}; + VkCommandBuffer cmd; + VkResult result; + + if (!swapchain->cmd_pools[queue_idx]) + { + VkCommandPoolCreateInfo poolInfo = {0}; + + poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; + poolInfo.queueFamilyIndex = queue_idx; + + result = queue->device->funcs.p_vkCreateCommandPool(queue->device->host_device, &poolInfo, NULL, + &swapchain->cmd_pools[queue_idx]); + if (result != VK_SUCCESS) + { + ERR("vkCreateCommandPool failed, res=%d\n", result); + return NULL; + } + } + + allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; + allocInfo.commandPool = swapchain->cmd_pools[queue_idx]; + allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + allocInfo.commandBufferCount = 1; + + result = queue->device->funcs.p_vkAllocateCommandBuffers(queue->device->host_device, &allocInfo, &cmd); + if (result != VK_SUCCESS) + { + ERR("vkAllocateCommandBuffers failed, res=%d\n", result); + return NULL; + } + + return cmd; +} + +static VkResult record_compute_cmd(struct wine_device *device, struct wine_swapchain *swapchain, + struct fs_hack_image *hack) +{ + VkResult result; + VkImageCopy region = {0}; + VkImageMemoryBarrier barriers[3] = {{0}}; + VkCommandBufferBeginInfo beginInfo = {0}; + float constants[4]; + + TRACE("recording compute command\n"); + +#if 0 + /* DOOM runs out of memory when allocating blit images after loading. */ + if(!swapchain->blit_image_memory){ + result = init_blit_images(device, swapchain); + if(result != VK_SUCCESS) + return result; + } +#endif + + beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; + + device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); + + /* for the cs we run... */ + /* transition user image from PRESENT_SRC to SHADER_READ */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->user_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = 0; + barriers[0].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; + + /* storage image... */ + /* transition blit image from whatever to GENERAL */ + barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + barriers[1].newLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].image = hack->blit_image ? hack->blit_image : hack->swapchain_image; + barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[1].subresourceRange.baseMipLevel = 0; + barriers[1].subresourceRange.levelCount = 1; + barriers[1].subresourceRange.baseArrayLayer = 0; + barriers[1].subresourceRange.layerCount = 1; + barriers[1].srcAccessMask = 0; + barriers[1].dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 2, barriers); + + /* perform blit shader */ + device->funcs.p_vkCmdBindPipeline(hack->cmd, VK_PIPELINE_BIND_POINT_COMPUTE, swapchain->pipeline); + + device->funcs.p_vkCmdBindDescriptorSets(hack->cmd, VK_PIPELINE_BIND_POINT_COMPUTE, + swapchain->pipeline_layout, 0, 1, &hack->descriptor_set, 0, NULL); + + /* vec2: blit dst offset in real coords */ + constants[0] = swapchain->blit_dst.offset.x; + constants[1] = swapchain->blit_dst.offset.y; + /* vec2: blit dst extents in real coords */ + constants[2] = swapchain->blit_dst.extent.width; + constants[3] = swapchain->blit_dst.extent.height; + device->funcs.p_vkCmdPushConstants(hack->cmd, swapchain->pipeline_layout, + VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(constants), constants); + + /* local sizes in shader are 8 */ + device->funcs.p_vkCmdDispatch(hack->cmd, ceil(swapchain->real_extent.width / 8.), + ceil(swapchain->real_extent.height / 8.), 1); + + /* transition user image from SHADER_READ back to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->user_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; + barriers[0].dstAccessMask = 0; + + device->funcs.p_vkCmdPipelineBarrier( + hack->cmd, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, + 0, + 0, NULL, + 0, NULL, + 1, barriers + ); + + if (hack->blit_image) + { + /* for the copy... */ + /* no transition, just a barrier for our access masks (w -> r) */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->blit_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + + /* for the copy... */ + /* transition swapchain image from whatever to TRANSFER_DST + * we don't care about the contents... */ + barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].image = hack->swapchain_image; + barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[1].subresourceRange.baseMipLevel = 0; + barriers[1].subresourceRange.levelCount = 1; + barriers[1].subresourceRange.baseArrayLayer = 0; + barriers[1].subresourceRange.layerCount = 1; + barriers[1].srcAccessMask = 0; + barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 2, barriers); + + /* copy from blit image to swapchain image */ + region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + region.srcSubresource.layerCount = 1; + region.srcOffset.x = 0; + region.srcOffset.y = 0; + region.srcOffset.z = 0; + region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + region.dstSubresource.layerCount = 1; + region.dstOffset.x = 0; + region.dstOffset.y = 0; + region.dstOffset.z = 0; + region.extent.width = swapchain->real_extent.width; + region.extent.height = swapchain->real_extent.height; + region.extent.depth = 1; + + device->funcs.p_vkCmdCopyImage(hack->cmd, hack->blit_image, VK_IMAGE_LAYOUT_GENERAL, + hack->swapchain_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); + + /* transition swapchain image from TRANSFER_DST_OPTIMAL to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->swapchain_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barriers[0].dstAccessMask = 0; + + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, barriers); + } + else + { + /* transition swapchain image from GENERAL to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; + barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->swapchain_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + barriers[0].dstAccessMask = 0; + + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, barriers); + } + + result = device->funcs.p_vkEndCommandBuffer(hack->cmd); + if (result != VK_SUCCESS) + { + ERR("vkEndCommandBuffer: %d\n", result); + return result; + } + + return VK_SUCCESS; +} + +static VkResult record_graphics_cmd(struct wine_device *device, struct wine_swapchain *swapchain, + struct fs_hack_image *hack) +{ + VkClearColorValue black = {{0.f, 0.f, 0.f}}; + VkCommandBufferBeginInfo beginInfo = {0}; + VkImageMemoryBarrier barriers[2] = {{0}}; + VkImageSubresourceRange range = {0}; + VkImageBlit blitregion = {0}; + VkResult result; + + TRACE("recording graphics command\n"); + + beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; + + device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); + + /* transition real image from whatever to TRANSFER_DST_OPTIMAL */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->swapchain_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = 0; + barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + + /* transition user image from PRESENT_SRC to TRANSFER_SRC_OPTIMAL */ + barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].image = hack->user_image; + barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[1].subresourceRange.baseMipLevel = 0; + barriers[1].subresourceRange.levelCount = 1; + barriers[1].subresourceRange.baseArrayLayer = 0; + barriers[1].subresourceRange.layerCount = 1; + barriers[1].srcAccessMask = 0; + barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 2, barriers); + + /* clear the image */ + range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + range.baseMipLevel = 0; + range.levelCount = 1; + range.baseArrayLayer = 0; + range.layerCount = 1; + + device->funcs.p_vkCmdClearColorImage(hack->cmd, hack->swapchain_image, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range); + + /* perform blit */ + blitregion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + blitregion.srcSubresource.layerCount = 1; + blitregion.srcOffsets[0].x = 0; + blitregion.srcOffsets[0].y = 0; + blitregion.srcOffsets[0].z = 0; + blitregion.srcOffsets[1].x = swapchain->user_extent.width; + blitregion.srcOffsets[1].y = swapchain->user_extent.height; + blitregion.srcOffsets[1].z = 1; + blitregion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + blitregion.dstSubresource.layerCount = 1; + blitregion.dstOffsets[0].x = swapchain->blit_dst.offset.x; + blitregion.dstOffsets[0].y = swapchain->blit_dst.offset.y; + blitregion.dstOffsets[0].z = 0; + blitregion.dstOffsets[1].x = swapchain->blit_dst.offset.x + swapchain->blit_dst.extent.width; + blitregion.dstOffsets[1].y = swapchain->blit_dst.offset.y + swapchain->blit_dst.extent.height; + blitregion.dstOffsets[1].z = 1; + + device->funcs.p_vkCmdBlitImage(hack->cmd, hack->user_image, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, hack->swapchain_image, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blitregion, swapchain->fs_hack_filter); + + /* transition real image from TRANSFER_DST to PRESENT_SRC */ + barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[0].image = hack->swapchain_image; + barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[0].subresourceRange.baseMipLevel = 0; + barriers[0].subresourceRange.levelCount = 1; + barriers[0].subresourceRange.baseArrayLayer = 0; + barriers[0].subresourceRange.layerCount = 1; + barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + barriers[0].dstAccessMask = 0; + + /* transition user image from TRANSFER_SRC_OPTIMAL to back to PRESENT_SRC */ + barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barriers[1].image = hack->user_image; + barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barriers[1].subresourceRange.baseMipLevel = 0; + barriers[1].subresourceRange.levelCount = 1; + barriers[1].subresourceRange.baseArrayLayer = 0; + barriers[1].subresourceRange.layerCount = 1; + barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + barriers[1].dstAccessMask = 0; + + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 2, barriers); + + result = device->funcs.p_vkEndCommandBuffer(hack->cmd); + if (result != VK_SUCCESS) + { + ERR("vkEndCommandBuffer: %d\n", result); + return result; + } + + return VK_SUCCESS; +} + +VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pPresentInfo) +{ + struct wine_queue *queue = wine_queue_from_handle(queue_handle); + VkCommandBuffer *blit_cmds = NULL; + struct wine_swapchain *swapchain; + VkPresentInfoKHR our_presentInfo; + VkSubmitInfo submitInfo = {0}; + uint32_t i, n_hacks = 0; + VkSemaphore blit_sema; + VkSwapchainKHR *arr; + uint32_t queue_idx; + VkResult res; + + TRACE("%p, %p\n", queue, pPresentInfo); + + our_presentInfo = *pPresentInfo; + + for (i = 0; i < our_presentInfo.swapchainCount; ++i) + { + swapchain = wine_swapchain_from_handle(our_presentInfo.pSwapchains[i]); + + if (swapchain->fs_hack_enabled) + { + struct fs_hack_image *hack = &swapchain->fs_hack_images[our_presentInfo.pImageIndices[i]]; + + if (!blit_cmds) + { + queue_idx = queue->family_index; + blit_cmds = malloc(our_presentInfo.swapchainCount * sizeof(VkCommandBuffer)); + blit_sema = hack->blit_finished; + } + + if (!hack->cmd || hack->cmd_queue_idx != queue_idx) + { + if (hack->cmd) + queue->device->funcs.p_vkFreeCommandBuffers(queue->device->host_device, + swapchain->cmd_pools[hack->cmd_queue_idx], 1, &hack->cmd); + + hack->cmd_queue_idx = queue_idx; + hack->cmd = create_hack_cmd(queue, swapchain, queue_idx); + + if (!hack->cmd) + { + free(blit_cmds); + return VK_ERROR_DEVICE_LOST; + } + + if (queue->device->queue_props[queue_idx].queueFlags & VK_QUEUE_GRAPHICS_BIT) + res = record_graphics_cmd(queue->device, swapchain, hack); + else if (queue->device->queue_props[queue_idx].queueFlags & VK_QUEUE_COMPUTE_BIT) + res = record_compute_cmd(queue->device, swapchain, hack); + else + { + ERR("Present queue is neither graphics nor compute queue!\n"); + res = VK_ERROR_DEVICE_LOST; + } + + if (res != VK_SUCCESS) + { + queue->device->funcs.p_vkFreeCommandBuffers(queue->device->host_device, + swapchain->cmd_pools[hack->cmd_queue_idx], 1, &hack->cmd); + hack->cmd = NULL; + free(blit_cmds); + return res; + } + } + + blit_cmds[n_hacks] = hack->cmd; + + ++n_hacks; + } + } + + if (n_hacks > 0) + { + VkPipelineStageFlags waitStage, *waitStages, *waitStages_arr = NULL; + + if (pPresentInfo->waitSemaphoreCount > 1) + { + waitStages_arr = malloc(sizeof(VkPipelineStageFlags) * pPresentInfo->waitSemaphoreCount); + for (i = 0; i < pPresentInfo->waitSemaphoreCount; ++i) waitStages_arr[i] = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + waitStages = waitStages_arr; + } + else + { + waitStage = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + waitStages = &waitStage; + } + + /* blit user image to real image */ + submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; + submitInfo.waitSemaphoreCount = pPresentInfo->waitSemaphoreCount; + submitInfo.pWaitSemaphores = pPresentInfo->pWaitSemaphores; + submitInfo.pWaitDstStageMask = waitStages; + submitInfo.commandBufferCount = n_hacks; + submitInfo.pCommandBuffers = blit_cmds; + submitInfo.signalSemaphoreCount = 1; + submitInfo.pSignalSemaphores = &blit_sema; + + res = queue->device->funcs.p_vkQueueSubmit(queue->host_queue, 1, &submitInfo, VK_NULL_HANDLE); + if (res != VK_SUCCESS) + ERR("vkQueueSubmit: %d\n", res); + + free(waitStages_arr); + free(blit_cmds); + + our_presentInfo.waitSemaphoreCount = 1; + our_presentInfo.pWaitSemaphores = &blit_sema; + } + + arr = malloc(our_presentInfo.swapchainCount * sizeof(VkSwapchainKHR)); + if (!arr) + { + ERR("Failed to allocate memory for swapchain array\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + for (i = 0; i < our_presentInfo.swapchainCount; ++i) + arr[i] = wine_swapchain_from_handle(our_presentInfo.pSwapchains[i])->host_swapchain; + + our_presentInfo.pSwapchains = arr; + + res = queue->device->funcs.p_vkQueuePresentKHR(queue->host_queue, &our_presentInfo); + + free(arr); + + return res; +} + VkResult wine_vkCreateDeferredOperationKHR(VkDevice handle, const VkAllocationCallbacks* allocator, VkDeferredOperationKHR* deferredOperation) diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 0d3a8cc0c30..f9064dce614 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -64,6 +64,8 @@ struct wine_device struct wine_queue *queues; uint32_t queue_count; + VkQueueFamilyProperties *queue_props; + struct wine_vk_mapping mapping; }; @@ -72,10 +74,39 @@ static inline struct wine_device *wine_device_from_handle(VkDevice handle) return (struct wine_device *)(uintptr_t)handle->base.unix_handle; } +struct fs_hack_image +{ + uint32_t cmd_queue_idx; + VkCommandBuffer cmd; + VkImage swapchain_image; + VkImage blit_image; + VkImage user_image; + VkSemaphore blit_finished; + VkImageView user_view, blit_view; + VkDescriptorSet descriptor_set; +}; + struct wine_swapchain { VkSwapchainKHR host_swapchain; + /* fs hack data below */ + BOOL fs_hack_enabled; + VkExtent2D user_extent; + VkExtent2D real_extent; + VkImageUsageFlags surface_usage; + VkRect2D blit_dst; + VkCommandPool *cmd_pools; /* VkCommandPool[device->queue_count] */ + VkDeviceMemory user_image_memory, blit_image_memory; + uint32_t n_images; + struct fs_hack_image *fs_hack_images; /* struct fs_hack_image[n_images] */ + VkFilter fs_hack_filter; + VkSampler sampler; + VkDescriptorPool descriptor_pool; + VkDescriptorSetLayout descriptor_set_layout; + VkPipelineLayout pipeline_layout; + VkPipeline pipeline; + struct wine_vk_mapping mapping; }; From 544899a83facceb1b1cff0bfcefe868d4e482ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 20:28:00 +0100 Subject: [PATCH 0216/1506] fshack: winevulkan: Fixes and improvements. Old fshack causes radv assertions because of image view format mismatches. Changes: - drop the vkCmdBlitImage path, it's impossible to keep without VK_KHR_swapchain_mutable_format. - drop the compute+copy path, all drivers support swapchains with storage usage, no reason to keep untested code around. - interpolate in linear color space for slightly better results - improve compute path by interpolating at the pixel center - fix all validation errors Signed-off-by: Georg Lehmann Link: https://github.com/ValveSoftware/wine/pull/158 --- dlls/winevulkan/loader.c | 14 - dlls/winevulkan/vulkan.c | 536 ++++++++----------------------- dlls/winevulkan/vulkan_loader.h | 14 + dlls/winevulkan/vulkan_private.h | 4 +- 4 files changed, 149 insertions(+), 419 deletions(-) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index 19fd240f0cb..c1960cff2ce 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -39,20 +39,6 @@ static HINSTANCE hinstance; static void *wine_vk_get_global_proc_addr(const char *name); -#define wine_vk_find_struct(s, t) wine_vk_find_struct_((void *)s, VK_STRUCTURE_TYPE_##t) -static void *wine_vk_find_struct_(void *s, VkStructureType t) -{ - VkBaseOutStructure *header; - - for (header = s; header; header = header->pNext) - { - if (header->sType == t) - return header; - } - - return NULL; -} - VkResult WINAPI vkEnumerateInstanceLayerProperties(uint32_t *count, VkLayerProperties *properties) { TRACE("%p, %p\n", count, properties); diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 151b0113be6..d7b50bbbc7f 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -851,6 +851,28 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre res = wine_vk_device_convert_create_info(phys_dev, &ctx, create_info, &create_info_host); if (res == VK_SUCCESS) { + VkPhysicalDeviceFeatures features = {0}; + VkPhysicalDeviceFeatures2 *features2; + + /* Enable shaderStorageImageWriteWithoutFormat for fshack + * This is available on all hardware and driver combinations we care about. + */ + if (create_info_host.pEnabledFeatures) + { + features = *create_info_host.pEnabledFeatures; + features.shaderStorageImageWriteWithoutFormat = VK_TRUE; + create_info_host.pEnabledFeatures = &features; + } + if ((features2 = wine_vk_find_struct(&create_info_host, PHYSICAL_DEVICE_FEATURES_2))) + { + features2->features.shaderStorageImageWriteWithoutFormat = VK_TRUE; + } + else if (!create_info_host.pEnabledFeatures) + { + features.shaderStorageImageWriteWithoutFormat = VK_TRUE; + create_info_host.pEnabledFeatures = &features; + } + if (native_create_device) res = native_create_device(phys_dev->host_physical_device, &create_info_host, NULL /* allocator */, &object->host_device, @@ -1546,60 +1568,79 @@ void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice phy } /* -#version 450 +#version 460 + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; layout(binding = 0) uniform sampler2D texSampler; -layout(binding = 1, rgba8) uniform writeonly image2D outImage; +layout(binding = 1) uniform writeonly image2D outImage; layout(push_constant) uniform pushConstants { //both in real image coords vec2 offset; vec2 extents; } constants; -layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; - void main() { vec2 texcoord = (vec2(gl_GlobalInvocationID.xy) - constants.offset) / constants.extents; vec4 c = texture(texSampler, texcoord); - imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), c.bgra); + + // Convert linear -> srgb + bvec3 isLo = lessThanEqual(c.rgb, vec3(0.0031308f)); + vec3 loPart = c.rgb * 12.92f; + vec3 hiPart = pow(c.rgb, vec3(5.0f / 12.0f)) * 1.055f - 0.055f; + c.rgb = mix(hiPart, loPart, isLo); + + imageStore(outImage, ivec2(gl_GlobalInvocationID.xy), c); } + */ const uint32_t blit_comp_spv[] = { - 0x07230203,0x00010000,0x00080006,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b, - 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, - 0x0006000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x0000000d,0x00060010,0x00000004, - 0x00000011,0x00000008,0x00000008,0x00000001,0x00030003,0x00000002,0x000001c2,0x00040005, - 0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574,0x64726f6f,0x00000000, - 0x00080005,0x0000000d,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x00000044, - 0x00060005,0x00000012,0x68737570,0x736e6f43,0x746e6174,0x00000073,0x00050006,0x00000012, - 0x00000000,0x7366666f,0x00007465,0x00050006,0x00000012,0x00000001,0x65747865,0x0073746e, - 0x00050005,0x00000014,0x736e6f63,0x746e6174,0x00000073,0x00030005,0x00000021,0x00000063, - 0x00050005,0x00000025,0x53786574,0x6c706d61,0x00007265,0x00050005,0x0000002c,0x4974756f, - 0x6567616d,0x00000000,0x00040047,0x0000000d,0x0000000b,0x0000001c,0x00050048,0x00000012, - 0x00000000,0x00000023,0x00000000,0x00050048,0x00000012,0x00000001,0x00000023,0x00000008, - 0x00030047,0x00000012,0x00000002,0x00040047,0x00000025,0x00000022,0x00000000,0x00040047, - 0x00000025,0x00000021,0x00000000,0x00040047,0x0000002c,0x00000022,0x00000000,0x00040047, - 0x0000002c,0x00000021,0x00000001,0x00030047,0x0000002c,0x00000019,0x00040047,0x00000036, - 0x0000000b,0x00000019,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, - 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008, - 0x00000007,0x00000007,0x00040015,0x0000000a,0x00000020,0x00000000,0x00040017,0x0000000b, - 0x0000000a,0x00000003,0x00040020,0x0000000c,0x00000001,0x0000000b,0x0004003b,0x0000000c, - 0x0000000d,0x00000001,0x00040017,0x0000000e,0x0000000a,0x00000002,0x0004001e,0x00000012, - 0x00000007,0x00000007,0x00040020,0x00000013,0x00000009,0x00000012,0x0004003b,0x00000013, - 0x00000014,0x00000009,0x00040015,0x00000015,0x00000020,0x00000001,0x0004002b,0x00000015, - 0x00000016,0x00000000,0x00040020,0x00000017,0x00000009,0x00000007,0x0004002b,0x00000015, - 0x0000001b,0x00000001,0x00040017,0x0000001f,0x00000006,0x00000004,0x00040020,0x00000020, - 0x00000007,0x0000001f,0x00090019,0x00000022,0x00000006,0x00000001,0x00000000,0x00000000, - 0x00000000,0x00000001,0x00000000,0x0003001b,0x00000023,0x00000022,0x00040020,0x00000024, - 0x00000000,0x00000023,0x0004003b,0x00000024,0x00000025,0x00000000,0x0004002b,0x00000006, - 0x00000028,0x00000000,0x00090019,0x0000002a,0x00000006,0x00000001,0x00000000,0x00000000, - 0x00000000,0x00000002,0x00000004,0x00040020,0x0000002b,0x00000000,0x0000002a,0x0004003b, - 0x0000002b,0x0000002c,0x00000000,0x00040017,0x00000030,0x00000015,0x00000002,0x0004002b, - 0x0000000a,0x00000034,0x00000008,0x0004002b,0x0000000a,0x00000035,0x00000001,0x0006002c, - 0x0000000b,0x00000036,0x00000034,0x00000034,0x00000035,0x00050036,0x00000002,0x00000004, - 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007, - 0x0004003b,0x00000020,0x00000021,0x00000007,0x0004003d,0x0000000b,0x0000000f,0x0000000d, + 0x07230203,0x00010000,0x0008000a,0x0000005e,0x00000000,0x00020011,0x00000001,0x00020011, + 0x00000038,0x0006000b,0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e, + 0x00000000,0x00000001,0x0006000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x0000000d, + 0x00060010,0x00000004,0x00000011,0x00000008,0x00000008,0x00000001,0x00030003,0x00000002, + 0x000001cc,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x63786574, + 0x64726f6f,0x00000000,0x00080005,0x0000000d,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f, + 0x496e6f69,0x00000044,0x00060005,0x00000012,0x68737570,0x736e6f43,0x746e6174,0x00000073, + 0x00050006,0x00000012,0x00000000,0x7366666f,0x00007465,0x00050006,0x00000012,0x00000001, + 0x65747865,0x0073746e,0x00050005,0x00000014,0x736e6f63,0x746e6174,0x00000073,0x00030005, + 0x00000021,0x00000063,0x00050005,0x00000025,0x53786574,0x6c706d61,0x00007265,0x00040005, + 0x0000002d,0x6f4c7369,0x00000000,0x00040005,0x00000035,0x61506f6c,0x00007472,0x00040005, + 0x0000003a,0x61506968,0x00007472,0x00050005,0x00000055,0x4974756f,0x6567616d,0x00000000, + 0x00040047,0x0000000d,0x0000000b,0x0000001c,0x00050048,0x00000012,0x00000000,0x00000023, + 0x00000000,0x00050048,0x00000012,0x00000001,0x00000023,0x00000008,0x00030047,0x00000012, + 0x00000002,0x00040047,0x00000025,0x00000022,0x00000000,0x00040047,0x00000025,0x00000021, + 0x00000000,0x00040047,0x00000055,0x00000022,0x00000000,0x00040047,0x00000055,0x00000021, + 0x00000001,0x00030047,0x00000055,0x00000019,0x00040047,0x0000005d,0x0000000b,0x00000019, + 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, + 0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007, + 0x00040015,0x0000000a,0x00000020,0x00000000,0x00040017,0x0000000b,0x0000000a,0x00000003, + 0x00040020,0x0000000c,0x00000001,0x0000000b,0x0004003b,0x0000000c,0x0000000d,0x00000001, + 0x00040017,0x0000000e,0x0000000a,0x00000002,0x0004001e,0x00000012,0x00000007,0x00000007, + 0x00040020,0x00000013,0x00000009,0x00000012,0x0004003b,0x00000013,0x00000014,0x00000009, + 0x00040015,0x00000015,0x00000020,0x00000001,0x0004002b,0x00000015,0x00000016,0x00000000, + 0x00040020,0x00000017,0x00000009,0x00000007,0x0004002b,0x00000015,0x0000001b,0x00000001, + 0x00040017,0x0000001f,0x00000006,0x00000004,0x00040020,0x00000020,0x00000007,0x0000001f, + 0x00090019,0x00000022,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001, + 0x00000000,0x0003001b,0x00000023,0x00000022,0x00040020,0x00000024,0x00000000,0x00000023, + 0x0004003b,0x00000024,0x00000025,0x00000000,0x0004002b,0x00000006,0x00000028,0x00000000, + 0x00020014,0x0000002a,0x00040017,0x0000002b,0x0000002a,0x00000003,0x00040020,0x0000002c, + 0x00000007,0x0000002b,0x00040017,0x0000002e,0x00000006,0x00000003,0x0004002b,0x00000006, + 0x00000031,0x3b4d2e1c,0x0006002c,0x0000002e,0x00000032,0x00000031,0x00000031,0x00000031, + 0x00040020,0x00000034,0x00000007,0x0000002e,0x0004002b,0x00000006,0x00000038,0x414eb852, + 0x0004002b,0x00000006,0x0000003d,0x3ed55555,0x0006002c,0x0000002e,0x0000003e,0x0000003d, + 0x0000003d,0x0000003d,0x0004002b,0x00000006,0x00000040,0x3f870a3d,0x0004002b,0x00000006, + 0x00000042,0x3d6147ae,0x0004002b,0x0000000a,0x00000049,0x00000000,0x00040020,0x0000004a, + 0x00000007,0x00000006,0x0004002b,0x0000000a,0x0000004d,0x00000001,0x0004002b,0x0000000a, + 0x00000050,0x00000002,0x00090019,0x00000053,0x00000006,0x00000001,0x00000000,0x00000000, + 0x00000000,0x00000002,0x00000000,0x00040020,0x00000054,0x00000000,0x00000053,0x0004003b, + 0x00000054,0x00000055,0x00000000,0x00040017,0x00000059,0x00000015,0x00000002,0x0004002b, + 0x0000000a,0x0000005c,0x00000008,0x0006002c,0x0000000b,0x0000005d,0x0000005c,0x0000005c, + 0x0000004d,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005, + 0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003b,0x00000020,0x00000021,0x00000007, + 0x0004003b,0x0000002c,0x0000002d,0x00000007,0x0004003b,0x00000034,0x00000035,0x00000007, + 0x0004003b,0x00000034,0x0000003a,0x00000007,0x0004003d,0x0000000b,0x0000000f,0x0000000d, 0x0007004f,0x0000000e,0x00000010,0x0000000f,0x0000000f,0x00000000,0x00000001,0x00040070, 0x00000007,0x00000011,0x00000010,0x00050041,0x00000017,0x00000018,0x00000014,0x00000016, 0x0004003d,0x00000007,0x00000019,0x00000018,0x00050083,0x00000007,0x0000001a,0x00000011, @@ -1607,12 +1648,27 @@ const uint32_t blit_comp_spv[] = { 0x0000001d,0x0000001c,0x00050088,0x00000007,0x0000001e,0x0000001a,0x0000001d,0x0003003e, 0x00000009,0x0000001e,0x0004003d,0x00000023,0x00000026,0x00000025,0x0004003d,0x00000007, 0x00000027,0x00000009,0x00070058,0x0000001f,0x00000029,0x00000026,0x00000027,0x00000002, - 0x00000028,0x0003003e,0x00000021,0x00000029,0x0004003d,0x0000002a,0x0000002d,0x0000002c, - 0x0004003d,0x0000000b,0x0000002e,0x0000000d,0x0007004f,0x0000000e,0x0000002f,0x0000002e, - 0x0000002e,0x00000000,0x00000001,0x0004007c,0x00000030,0x00000031,0x0000002f,0x0004003d, - 0x0000001f,0x00000032,0x00000021,0x0009004f,0x0000001f,0x00000033,0x00000032,0x00000032, - 0x00000002,0x00000001,0x00000000,0x00000003,0x00040063,0x0000002d,0x00000031,0x00000033, - 0x000100fd,0x00010038 + 0x00000028,0x0003003e,0x00000021,0x00000029,0x0004003d,0x0000001f,0x0000002f,0x00000021, + 0x0008004f,0x0000002e,0x00000030,0x0000002f,0x0000002f,0x00000000,0x00000001,0x00000002, + 0x000500bc,0x0000002b,0x00000033,0x00000030,0x00000032,0x0003003e,0x0000002d,0x00000033, + 0x0004003d,0x0000001f,0x00000036,0x00000021,0x0008004f,0x0000002e,0x00000037,0x00000036, + 0x00000036,0x00000000,0x00000001,0x00000002,0x0005008e,0x0000002e,0x00000039,0x00000037, + 0x00000038,0x0003003e,0x00000035,0x00000039,0x0004003d,0x0000001f,0x0000003b,0x00000021, + 0x0008004f,0x0000002e,0x0000003c,0x0000003b,0x0000003b,0x00000000,0x00000001,0x00000002, + 0x0007000c,0x0000002e,0x0000003f,0x00000001,0x0000001a,0x0000003c,0x0000003e,0x0005008e, + 0x0000002e,0x00000041,0x0000003f,0x00000040,0x00060050,0x0000002e,0x00000043,0x00000042, + 0x00000042,0x00000042,0x00050083,0x0000002e,0x00000044,0x00000041,0x00000043,0x0003003e, + 0x0000003a,0x00000044,0x0004003d,0x0000002e,0x00000045,0x0000003a,0x0004003d,0x0000002e, + 0x00000046,0x00000035,0x0004003d,0x0000002b,0x00000047,0x0000002d,0x000600a9,0x0000002e, + 0x00000048,0x00000047,0x00000046,0x00000045,0x00050041,0x0000004a,0x0000004b,0x00000021, + 0x00000049,0x00050051,0x00000006,0x0000004c,0x00000048,0x00000000,0x0003003e,0x0000004b, + 0x0000004c,0x00050041,0x0000004a,0x0000004e,0x00000021,0x0000004d,0x00050051,0x00000006, + 0x0000004f,0x00000048,0x00000001,0x0003003e,0x0000004e,0x0000004f,0x00050041,0x0000004a, + 0x00000051,0x00000021,0x00000050,0x00050051,0x00000006,0x00000052,0x00000048,0x00000002, + 0x0003003e,0x00000051,0x00000052,0x0004003d,0x00000053,0x00000056,0x00000055,0x0004003d, + 0x0000000b,0x00000057,0x0000000d,0x0007004f,0x0000000e,0x00000058,0x00000057,0x00000057, + 0x00000000,0x00000001,0x0004007c,0x00000059,0x0000005a,0x00000058,0x0004003d,0x0000001f, + 0x0000005b,0x00000021,0x00040063,0x00000056,0x0000005a,0x0000005b,0x000100fd,0x00010038 }; static VkResult create_pipeline(struct wine_device *device, struct wine_swapchain *swapchain, VkShaderModule shaderModule) @@ -1700,13 +1756,8 @@ static VkResult init_blit_images(struct wine_device *device, struct wine_swapcha VkPushConstantRange pushConstants; VkShaderModuleCreateInfo shaderInfo = {0}; VkShaderModule shaderModule = 0; - VkDeviceSize blitMemTotal = 0, offs; - VkImageCreateInfo imageInfo = {0}; - VkMemoryRequirements blitMemReq; - VkMemoryAllocateInfo allocInfo = {0}; - VkPhysicalDeviceMemoryProperties memProperties; VkImageViewCreateInfo viewInfo = {0}; - uint32_t blit_memory_type = -1, i; + uint32_t i; samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; samplerInfo.magFilter = swapchain->fs_hack_filter; @@ -1716,7 +1767,7 @@ static VkResult init_blit_images(struct wine_device *device, struct wine_swapcha samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; samplerInfo.anisotropyEnable = VK_FALSE; samplerInfo.maxAnisotropy = 1; - samplerInfo.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK; + samplerInfo.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK; samplerInfo.unnormalizedCoordinates = VK_FALSE; samplerInfo.compareEnable = VK_FALSE; samplerInfo.compareOp = VK_COMPARE_OP_ALWAYS; @@ -1808,112 +1859,15 @@ static VkResult init_blit_images(struct wine_device *device, struct wine_swapcha device->funcs.p_vkDestroyShaderModule(device->host_device, shaderModule, NULL); - if (!(swapchain->surface_usage & VK_IMAGE_USAGE_STORAGE_BIT)) - { - TRACE("using intermediate blit images\n"); - /* create intermediate blit images */ - for (i = 0; i < swapchain->n_images; ++i) - { - struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; - - imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; - imageInfo.imageType = VK_IMAGE_TYPE_2D; - imageInfo.extent.width = swapchain->real_extent.width; - imageInfo.extent.height = swapchain->real_extent.height; - imageInfo.extent.depth = 1; - imageInfo.mipLevels = 1; - imageInfo.arrayLayers = 1; - imageInfo.format = VK_FORMAT_R8G8B8A8_UNORM; - imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; - imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; - imageInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; - imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; - imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; - res = device->funcs.p_vkCreateImage(device->host_device, &imageInfo, NULL, &hack->blit_image); - if (res != VK_SUCCESS) - { - ERR("vkCreateImage failed: %d\n", res); - goto fail; - } - - device->funcs.p_vkGetImageMemoryRequirements(device->host_device, hack->blit_image, &blitMemReq); - - offs = blitMemTotal % blitMemReq.alignment; - if (offs) - blitMemTotal += blitMemReq.alignment - offs; - - blitMemTotal += blitMemReq.size; - } - - /* allocate backing memory */ - device->phys_dev->instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(device->phys_dev->host_physical_device, &memProperties); - - for (i = 0; i < memProperties.memoryTypeCount; i++) - { - UINT flag = memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; - if (flag == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) - { - if (blitMemReq.memoryTypeBits & (1 << i)) - { - blit_memory_type = i; - break; - } - } - } - - if (blit_memory_type == -1) - { - ERR("unable to find suitable memory type\n"); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto fail; - } - - allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; - allocInfo.allocationSize = blitMemTotal; - allocInfo.memoryTypeIndex = blit_memory_type; - - res = device->funcs.p_vkAllocateMemory(device->host_device, &allocInfo, NULL, &swapchain->blit_image_memory); - if (res != VK_SUCCESS) - { - ERR("vkAllocateMemory: %d\n", res); - goto fail; - } - - /* bind backing memory and create imageviews */ - blitMemTotal = 0; - for (i = 0; i < swapchain->n_images; ++i) - { - struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; - - device->funcs.p_vkGetImageMemoryRequirements(device->host_device, hack->blit_image, &blitMemReq); - - offs = blitMemTotal % blitMemReq.alignment; - if (offs) - blitMemTotal += blitMemReq.alignment - offs; - - res = device->funcs.p_vkBindImageMemory(device->host_device, hack->blit_image, - swapchain->blit_image_memory, blitMemTotal); - if (res != VK_SUCCESS) - { - ERR("vkBindImageMemory: %d\n", res); - goto fail; - } - - blitMemTotal += blitMemReq.size; - } - } - else - TRACE("blitting directly to swapchain images\n"); - /* create imageviews */ for (i = 0; i < swapchain->n_images; ++i) { struct fs_hack_image *hack = &swapchain->fs_hack_images[i]; viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; - viewInfo.image = hack->blit_image ? hack->blit_image : hack->swapchain_image; + viewInfo.image = hack->swapchain_image; viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; - viewInfo.format = VK_FORMAT_R8G8B8A8_UNORM; + viewInfo.format = VK_FORMAT_B8G8R8A8_UNORM; viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; viewInfo.subresourceRange.baseMipLevel = 0; viewInfo.subresourceRange.levelCount = 1; @@ -1941,9 +1895,6 @@ static VkResult init_blit_images(struct wine_device *device, struct wine_swapcha device->funcs.p_vkDestroyImageView(device->host_device, hack->blit_view, NULL); hack->blit_view = VK_NULL_HANDLE; - - device->funcs.p_vkDestroyImage(device->host_device, hack->blit_image, NULL); - hack->blit_image = VK_NULL_HANDLE; } device->funcs.p_vkDestroyShaderModule(device->host_device, shaderModule, NULL); @@ -1960,9 +1911,6 @@ static VkResult init_blit_images(struct wine_device *device, struct wine_swapcha device->funcs.p_vkDestroyDescriptorPool(device->host_device, swapchain->descriptor_pool, NULL); swapchain->descriptor_pool = VK_NULL_HANDLE; - device->funcs.p_vkFreeMemory(device->host_device, swapchain->blit_image_memory, NULL); - swapchain->blit_image_memory = VK_NULL_HANDLE; - device->funcs.p_vkDestroySampler(device->host_device, swapchain->sampler, NULL); swapchain->sampler = VK_NULL_HANDLE; @@ -1975,7 +1923,6 @@ static void destroy_fs_hack_image(struct wine_device *device, struct wine_swapch device->funcs.p_vkDestroyImageView(device->host_device, hack->user_view, NULL); device->funcs.p_vkDestroyImageView(device->host_device, hack->blit_view, NULL); device->funcs.p_vkDestroyImage(device->host_device, hack->user_image, NULL); - device->funcs.p_vkDestroyImage(device->host_device, hack->blit_image, NULL); if (hack->cmd) device->funcs.p_vkFreeCommandBuffers(device->host_device, swapchain->cmd_pools[hack->cmd_queue_idx], 1, &hack->cmd); @@ -1983,7 +1930,7 @@ static void destroy_fs_hack_image(struct wine_device *device, struct wine_swapch } static VkResult init_fs_hack_images(struct wine_device *device, struct wine_swapchain *swapchain, - VkSwapchainCreateInfoKHR *createinfo) + const VkSwapchainCreateInfoKHR *createinfo) { VkResult res; VkImage *real_images = NULL; @@ -2041,11 +1988,17 @@ static VkResult init_fs_hack_images(struct wine_device *device, struct wine_swap imageInfo.format = createinfo->imageFormat; imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; - imageInfo.usage = createinfo->imageUsage | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + imageInfo.usage = createinfo->imageUsage | VK_IMAGE_USAGE_SAMPLED_BIT; imageInfo.sharingMode = createinfo->imageSharingMode; imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; imageInfo.queueFamilyIndexCount = createinfo->queueFamilyIndexCount; imageInfo.pQueueFamilyIndices = createinfo->pQueueFamilyIndices; + + if (createinfo->flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) + imageInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT; + else if (createinfo->imageFormat != VK_FORMAT_B8G8R8A8_SRGB) + imageInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; + res = device->funcs.p_vkCreateImage(device->host_device, &imageInfo, NULL, &hack->user_image); if (res != VK_SUCCESS) { @@ -2121,7 +2074,7 @@ static VkResult init_fs_hack_images(struct wine_device *device, struct wine_swap viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; viewInfo.image = swapchain->fs_hack_images[i].user_image; viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; - viewInfo.format = createinfo->imageFormat; + viewInfo.format = VK_FORMAT_B8G8R8A8_SRGB; viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; viewInfo.subresourceRange.baseMipLevel = 0; viewInfo.subresourceRange.levelCount = 1; @@ -2192,13 +2145,14 @@ VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCrea return res; } - object->surface_usage = caps.supportedUsageFlags; - TRACE("surface usage flags: 0x%x\n", object->surface_usage); + if (!(caps.supportedUsageFlags & VK_IMAGE_USAGE_STORAGE_BIT)) + FIXME("Swapchain does not support required VK_IMAGE_USAGE_STORAGE_BIT\n"); create_info_host.imageExtent = object->real_extent; - create_info_host.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; /* XXX: check if supported by surface */ + create_info_host.imageFormat = VK_FORMAT_B8G8R8A8_UNORM; + create_info_host.imageUsage = VK_IMAGE_USAGE_STORAGE_BIT; - if (create_info_host.imageFormat != VK_FORMAT_B8G8R8A8_UNORM && create_info_host.imageFormat != VK_FORMAT_B8G8R8A8_SRGB) + if (info->imageFormat != VK_FORMAT_B8G8R8A8_UNORM && info->imageFormat != VK_FORMAT_B8G8R8A8_SRGB) FIXME("swapchain image format is not BGRA8 UNORM/SRGB. Things may go badly. %d\n", create_info_host.imageFormat); object->fs_hack_enabled = TRUE; @@ -2216,7 +2170,7 @@ VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCrea { object->user_extent = info->imageExtent; - res = init_fs_hack_images(device, object, &create_info_host); + res = init_fs_hack_images(device, object, info); if (res != VK_SUCCESS) { ERR("creating fs hack images failed: %d\n", res); @@ -2226,8 +2180,6 @@ VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCrea return res; } - /* FIXME: would be nice to do this on-demand, but games can use up all - * memory so we fail to allocate later */ res = init_blit_images(device, object); if (res != VK_SUCCESS) { @@ -2740,7 +2692,6 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR handle, c device->funcs.p_vkDestroyDescriptorPool(device->host_device, swapchain->descriptor_pool, NULL); device->funcs.p_vkDestroySampler(device->host_device, swapchain->sampler, NULL); device->funcs.p_vkFreeMemory(device->host_device, swapchain->user_image_memory, NULL); - device->funcs.p_vkFreeMemory(device->host_device, swapchain->blit_image_memory, NULL); free(swapchain->cmd_pools); free(swapchain->fs_hack_images); } @@ -2811,22 +2762,12 @@ static VkResult record_compute_cmd(struct wine_device *device, struct wine_swapc struct fs_hack_image *hack) { VkResult result; - VkImageCopy region = {0}; VkImageMemoryBarrier barriers[3] = {{0}}; VkCommandBufferBeginInfo beginInfo = {0}; float constants[4]; TRACE("recording compute command\n"); -#if 0 - /* DOOM runs out of memory when allocating blit images after loading. */ - if(!swapchain->blit_image_memory){ - result = init_blit_images(device, swapchain); - if(result != VK_SUCCESS) - return result; - } -#endif - beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; @@ -2849,13 +2790,13 @@ static VkResult record_compute_cmd(struct wine_device *device, struct wine_swapc barriers[0].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; /* storage image... */ - /* transition blit image from whatever to GENERAL */ + /* transition swapchain image from whatever to GENERAL */ barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; barriers[1].newLayout = VK_IMAGE_LAYOUT_GENERAL; barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].image = hack->blit_image ? hack->blit_image : hack->swapchain_image; + barriers[1].image = hack->swapchain_image; barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barriers[1].subresourceRange.baseMipLevel = 0; barriers[1].subresourceRange.levelCount = 1; @@ -2876,6 +2817,11 @@ static VkResult record_compute_cmd(struct wine_device *device, struct wine_swapc /* vec2: blit dst offset in real coords */ constants[0] = swapchain->blit_dst.offset.x; constants[1] = swapchain->blit_dst.offset.y; + + /* offset by 0.5f because sampling is relative to pixel center */ + constants[0] -= 0.5f * swapchain->blit_dst.extent.width / swapchain->user_extent.width; + constants[1] -= 0.5f * swapchain->blit_dst.extent.height / swapchain->user_extent.height; + /* vec2: blit dst extents in real coords */ constants[2] = swapchain->blit_dst.extent.width; constants[3] = swapchain->blit_dst.extent.height; @@ -2901,234 +2847,22 @@ static VkResult record_compute_cmd(struct wine_device *device, struct wine_swapc barriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; barriers[0].dstAccessMask = 0; - device->funcs.p_vkCmdPipelineBarrier( - hack->cmd, - VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, - 0, - 0, NULL, - 0, NULL, - 1, barriers - ); - - if (hack->blit_image) - { - /* for the copy... */ - /* no transition, just a barrier for our access masks (w -> r) */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; - barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->blit_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; - barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - - /* for the copy... */ - /* transition swapchain image from whatever to TRANSFER_DST - * we don't care about the contents... */ - barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[1].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].image = hack->swapchain_image; - barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[1].subresourceRange.baseMipLevel = 0; - barriers[1].subresourceRange.levelCount = 1; - barriers[1].subresourceRange.baseArrayLayer = 0; - barriers[1].subresourceRange.layerCount = 1; - barriers[1].srcAccessMask = 0; - barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - - device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 2, barriers); - - /* copy from blit image to swapchain image */ - region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - region.srcSubresource.layerCount = 1; - region.srcOffset.x = 0; - region.srcOffset.y = 0; - region.srcOffset.z = 0; - region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - region.dstSubresource.layerCount = 1; - region.dstOffset.x = 0; - region.dstOffset.y = 0; - region.dstOffset.z = 0; - region.extent.width = swapchain->real_extent.width; - region.extent.height = swapchain->real_extent.height; - region.extent.depth = 1; - - device->funcs.p_vkCmdCopyImage(hack->cmd, hack->blit_image, VK_IMAGE_LAYOUT_GENERAL, - hack->swapchain_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); - - /* transition swapchain image from TRANSFER_DST_OPTIMAL to PRESENT_SRC */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->swapchain_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barriers[0].dstAccessMask = 0; - - device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, barriers); - } - else - { - /* transition swapchain image from GENERAL to PRESENT_SRC */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; - barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->swapchain_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; - barriers[0].dstAccessMask = 0; - - device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, barriers); - } - - result = device->funcs.p_vkEndCommandBuffer(hack->cmd); - if (result != VK_SUCCESS) - { - ERR("vkEndCommandBuffer: %d\n", result); - return result; - } - - return VK_SUCCESS; -} - -static VkResult record_graphics_cmd(struct wine_device *device, struct wine_swapchain *swapchain, - struct fs_hack_image *hack) -{ - VkClearColorValue black = {{0.f, 0.f, 0.f}}; - VkCommandBufferBeginInfo beginInfo = {0}; - VkImageMemoryBarrier barriers[2] = {{0}}; - VkImageSubresourceRange range = {0}; - VkImageBlit blitregion = {0}; - VkResult result; - - TRACE("recording graphics command\n"); - - beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; - beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; - - device->funcs.p_vkBeginCommandBuffer(hack->cmd, &beginInfo); - - /* transition real image from whatever to TRANSFER_DST_OPTIMAL */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->swapchain_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = 0; - barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - - /* transition user image from PRESENT_SRC to TRANSFER_SRC_OPTIMAL */ - barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[1].oldLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; - barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].image = hack->user_image; - barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[1].subresourceRange.baseMipLevel = 0; - barriers[1].subresourceRange.levelCount = 1; - barriers[1].subresourceRange.baseArrayLayer = 0; - barriers[1].subresourceRange.layerCount = 1; - barriers[1].srcAccessMask = 0; - barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; - - device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, - VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 2, barriers); - - /* clear the image */ - range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - range.baseMipLevel = 0; - range.levelCount = 1; - range.baseArrayLayer = 0; - range.layerCount = 1; - - device->funcs.p_vkCmdClearColorImage(hack->cmd, hack->swapchain_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range); - - /* perform blit */ - blitregion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - blitregion.srcSubresource.layerCount = 1; - blitregion.srcOffsets[0].x = 0; - blitregion.srcOffsets[0].y = 0; - blitregion.srcOffsets[0].z = 0; - blitregion.srcOffsets[1].x = swapchain->user_extent.width; - blitregion.srcOffsets[1].y = swapchain->user_extent.height; - blitregion.srcOffsets[1].z = 1; - blitregion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - blitregion.dstSubresource.layerCount = 1; - blitregion.dstOffsets[0].x = swapchain->blit_dst.offset.x; - blitregion.dstOffsets[0].y = swapchain->blit_dst.offset.y; - blitregion.dstOffsets[0].z = 0; - blitregion.dstOffsets[1].x = swapchain->blit_dst.offset.x + swapchain->blit_dst.extent.width; - blitregion.dstOffsets[1].y = swapchain->blit_dst.offset.y + swapchain->blit_dst.extent.height; - blitregion.dstOffsets[1].z = 1; - - device->funcs.p_vkCmdBlitImage(hack->cmd, hack->user_image, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, hack->swapchain_image, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blitregion, swapchain->fs_hack_filter); - - /* transition real image from TRANSFER_DST to PRESENT_SRC */ - barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - barriers[0].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[0].image = hack->swapchain_image; - barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - barriers[0].subresourceRange.baseMipLevel = 0; - barriers[0].subresourceRange.levelCount = 1; - barriers[0].subresourceRange.baseArrayLayer = 0; - barriers[0].subresourceRange.layerCount = 1; - barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; - barriers[0].dstAccessMask = 0; - - /* transition user image from TRANSFER_SRC_OPTIMAL to back to PRESENT_SRC */ + /* transition swapchain image from GENERAL to PRESENT_SRC */ barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - barriers[1].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + barriers[1].oldLayout = VK_IMAGE_LAYOUT_GENERAL; barriers[1].newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - barriers[1].image = hack->user_image; + barriers[1].image = hack->swapchain_image; barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barriers[1].subresourceRange.baseMipLevel = 0; barriers[1].subresourceRange.levelCount = 1; barriers[1].subresourceRange.baseArrayLayer = 0; barriers[1].subresourceRange.layerCount = 1; - barriers[1].srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + barriers[1].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; barriers[1].dstAccessMask = 0; - device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, + device->funcs.p_vkCmdPipelineBarrier(hack->cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 2, barriers); result = device->funcs.p_vkEndCommandBuffer(hack->cmd); @@ -3188,13 +2922,11 @@ VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pP return VK_ERROR_DEVICE_LOST; } - if (queue->device->queue_props[queue_idx].queueFlags & VK_QUEUE_GRAPHICS_BIT) - res = record_graphics_cmd(queue->device, swapchain, hack); - else if (queue->device->queue_props[queue_idx].queueFlags & VK_QUEUE_COMPUTE_BIT) + if (queue->device->queue_props[queue_idx].queueFlags & VK_QUEUE_COMPUTE_BIT) /* TODO */ res = record_compute_cmd(queue->device, swapchain, hack); else { - ERR("Present queue is neither graphics nor compute queue!\n"); + ERR("Present queue does not support compute!\n"); res = VK_ERROR_DEVICE_LOST; } diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h index 6f62201f503..a7c4b388056 100644 --- a/dlls/winevulkan/vulkan_loader.h +++ b/dlls/winevulkan/vulkan_loader.h @@ -144,6 +144,20 @@ struct is_available_device_function_params const char *name; }; +#define wine_vk_find_struct(s, t) wine_vk_find_struct_((void *)s, VK_STRUCTURE_TYPE_##t) +static inline void *wine_vk_find_struct_(void *s, VkStructureType t) +{ + VkBaseOutStructure *header; + + for (header = s; header; header = header->pNext) + { + if (header->sType == t) + return header; + } + + return NULL; +} + #define UNIX_CALL(code, params) WINE_UNIX_CALL(unix_ ## code, params) #endif /* __WINE_VULKAN_LOADER_H */ diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index f9064dce614..a8dd40dd24e 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -79,7 +79,6 @@ struct fs_hack_image uint32_t cmd_queue_idx; VkCommandBuffer cmd; VkImage swapchain_image; - VkImage blit_image; VkImage user_image; VkSemaphore blit_finished; VkImageView user_view, blit_view; @@ -94,10 +93,9 @@ struct wine_swapchain BOOL fs_hack_enabled; VkExtent2D user_extent; VkExtent2D real_extent; - VkImageUsageFlags surface_usage; VkRect2D blit_dst; VkCommandPool *cmd_pools; /* VkCommandPool[device->queue_count] */ - VkDeviceMemory user_image_memory, blit_image_memory; + VkDeviceMemory user_image_memory; uint32_t n_images; struct fs_hack_image *fs_hack_images; /* struct fs_hack_image[n_images] */ VkFilter fs_hack_filter; From e00ee63a5f538dd874359ffc57bd4f439f86305e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:10:32 +0100 Subject: [PATCH 0217/1506] fshack: winex11: Support vulkan scaling according to fake resolution. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on work by Zhiyi Zhang, includes work by Giovanni Mascellani, Rémi Bernon, Arkadiusz Hiler, Kai Krakow, Joshua Ashton, Zebediah Figura, and Matteo Bruni. --- dlls/winex11.drv/vulkan.c | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 23bb61b2e1d..99506788a06 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -1072,6 +1072,68 @@ static VkSurfaceKHR X11DRV_wine_get_host_surface( VkSurfaceKHR surface ) return x11_surface->host_surface; } +static VkBool32 X11DRV_query_fs_hack( VkSurfaceKHR surface, VkExtent2D *real_sz, + VkExtent2D *user_sz, VkRect2D *dst_blit, VkFilter *filter ) +{ + struct wine_vk_surface *x11_surface = surface_from_handle( surface ); + HMONITOR monitor; + HWND hwnd; + + if (wm_is_steamcompmgr( gdi_display )) return VK_FALSE; + if (x11_surface->other_process) return VK_FALSE; + + if (XFindContext( gdi_display, x11_surface->window, winContext, (char **)&hwnd ) != 0) + { + ERR( "Failed to find hwnd context\n" ); + return VK_FALSE; + } + + monitor = fs_hack_monitor_from_hwnd( hwnd ); + if (fs_hack_enabled( monitor )) + { + RECT real_rect = fs_hack_real_mode( monitor ); + RECT user_rect = fs_hack_current_mode( monitor ); + SIZE scaled = fs_hack_get_scaled_screen_size( monitor ); + POINT scaled_origin; + + scaled_origin.x = user_rect.left; + scaled_origin.y = user_rect.top; + fs_hack_point_user_to_real( &scaled_origin ); + scaled_origin.x -= real_rect.left; + scaled_origin.y -= real_rect.top; + + TRACE( "real_rect:%s user_rect:%s scaled:%dx%d scaled_origin:%s\n", + wine_dbgstr_rect( &real_rect ), wine_dbgstr_rect( &user_rect ), + (int)scaled.cx, (int)scaled.cy, wine_dbgstr_point( &scaled_origin ) ); + + if (real_sz) + { + real_sz->width = real_rect.right - real_rect.left; + real_sz->height = real_rect.bottom - real_rect.top; + } + + if (user_sz) + { + user_sz->width = user_rect.right - user_rect.left; + user_sz->height = user_rect.bottom - user_rect.top; + } + + if (dst_blit) + { + dst_blit->offset.x = scaled_origin.x; + dst_blit->offset.y = scaled_origin.y; + dst_blit->extent.width = scaled.cx; + dst_blit->extent.height = scaled.cy; + } + + if (filter) *filter = fs_hack_is_integer() ? VK_FILTER_NEAREST : VK_FILTER_LINEAR; + + return VK_TRUE; + } + + return VK_FALSE; +} + static const struct vulkan_funcs vulkan_funcs = { X11DRV_vkAcquireNextImage2KHR, @@ -1098,6 +1160,7 @@ static const struct vulkan_funcs vulkan_funcs = X11DRV_vkQueuePresentKHR, X11DRV_wine_get_host_surface, + X11DRV_query_fs_hack, }; static void *X11DRV_get_vk_device_proc_addr(const char *name) From 55d91bd3a95378df5194a218304cb439dbd28bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:24:41 +0100 Subject: [PATCH 0218/1506] fshack: winex11: Simply scale offscreen vulkan surfaces. They will be copied manually onto the screen, so we don't need to scale them to the screen dimensions. CW-Bug-Id: 16608 --- dlls/winex11.drv/vulkan.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 99506788a06..cf74af5bcc9 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -1089,7 +1089,7 @@ static VkBool32 X11DRV_query_fs_hack( VkSurfaceKHR surface, VkExtent2D *real_sz, } monitor = fs_hack_monitor_from_hwnd( hwnd ); - if (fs_hack_enabled( monitor )) + if (fs_hack_enabled( monitor ) && !x11_surface->offscreen) { RECT real_rect = fs_hack_real_mode( monitor ); RECT user_rect = fs_hack_current_mode( monitor ); @@ -1130,6 +1130,37 @@ static VkBool32 X11DRV_query_fs_hack( VkSurfaceKHR surface, VkExtent2D *real_sz, return VK_TRUE; } + else if (fs_hack_enabled( monitor )) + { + double scale = fs_hack_get_user_to_real_scale( monitor ); + RECT client_rect; + + NtUserGetClientRect( hwnd, &client_rect ); + + if (real_sz) + { + real_sz->width = (client_rect.right - client_rect.left) * scale; + real_sz->height = (client_rect.bottom - client_rect.top) * scale; + } + + if (user_sz) + { + user_sz->width = client_rect.right - client_rect.left; + user_sz->height = client_rect.bottom - client_rect.top; + } + + if (dst_blit) + { + dst_blit->offset.x = client_rect.left * scale; + dst_blit->offset.y = client_rect.top * scale; + dst_blit->extent.width = (client_rect.right - client_rect.left) * scale; + dst_blit->extent.height = (client_rect.bottom - client_rect.top) * scale; + } + + if (filter) *filter = fs_hack_is_integer() ? VK_FILTER_NEAREST : VK_FILTER_LINEAR; + + return VK_TRUE; + } return VK_FALSE; } From 771f9b3daae5ef902e9b5fe27427414b2122e275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 17 May 2021 10:54:27 +0200 Subject: [PATCH 0219/1506] fshack: winex11: Transform X11DRV_FLUSH_VK_DRAWABLE rects. CW-Bug-Id: #16608 --- dlls/winex11.drv/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index a7758346b29..b85246ee19d 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -248,13 +248,15 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d { const struct x11drv_escape_present_drawable *data = in_data; RECT rect = physDev->dc_rect; + RECT real_rect = physDev->dc_rect; + fs_hack_rect_user_to_real( &real_rect ); OffsetRect( &rect, -physDev->dc_rect.left, -physDev->dc_rect.top ); if (data->flush) XFlush( gdi_display ); XSetFunction( gdi_display, physDev->gc, GXcopy ); XCopyArea( gdi_display, data->drawable, physDev->drawable, physDev->gc, - 0, 0, rect.right, rect.bottom, - physDev->dc_rect.left, physDev->dc_rect.top ); + 0, 0, real_rect.right - real_rect.left, real_rect.bottom - real_rect.top, + real_rect.left, real_rect.top ); add_device_bounds( physDev, &rect ); return TRUE; } From aeddec15321ce3fdc9933edea24bd33c63744f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:16:41 +0100 Subject: [PATCH 0220/1506] fshack: winex11: Clear fs hack depth / stencil attachment. --- dlls/winex11.drv/opengl.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index b814eada4b2..43710be173a 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2031,7 +2031,8 @@ static void fs_hack_get_attachments_config( struct gl_drawable *gl, struct fs_ha static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable *gl ) { GLuint prev_draw_fbo, prev_read_fbo, prev_texture, prev_renderbuffer; - float prev_clear_color[4]; + float prev_clear_color[4], prev_clear_depth; + int prev_clear_stencil; unsigned int i; struct fs_hack_fbo_attachments_config config; struct fs_hack_fbconfig_attribs attribs; @@ -2074,6 +2075,8 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * opengl_funcs.gl.p_glGetIntegerv( GL_TEXTURE_BINDING_2D, (GLint *)&prev_texture ); opengl_funcs.gl.p_glGetIntegerv( GL_RENDERBUFFER_BINDING, (GLint *)&prev_renderbuffer ); opengl_funcs.gl.p_glGetFloatv( GL_COLOR_CLEAR_VALUE, prev_clear_color ); + opengl_funcs.gl.p_glGetFloatv( GL_DEPTH_CLEAR_VALUE, &prev_clear_depth ); + opengl_funcs.gl.p_glGetIntegerv( GL_STENCIL_CLEAR_VALUE, &prev_clear_stencil ); TRACE( "Previous draw FBO %u, read FBO %u for ctx %p\n", prev_draw_fbo, prev_read_fbo, ctx ); if (!ctx->fs_hack_fbo) @@ -2160,13 +2163,23 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * } } - opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); - if (!gl->fs_hack_context_set_up) opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); + if (!gl->fs_hack_context_set_up) + { + opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); + opengl_funcs.gl.p_glClearDepth( 1.0 ); + opengl_funcs.gl.p_glClearStencil( 0 ); + opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); + } pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); pglDrawBuffer( GL_BACK ); - if (!gl->fs_hack_context_set_up) opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); - opengl_funcs.gl.p_glClearColor( prev_clear_color[0], prev_clear_color[1], - prev_clear_color[2], prev_clear_color[3] ); + if (!gl->fs_hack_context_set_up) + { + opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); + opengl_funcs.gl.p_glClearColor( prev_clear_color[0], prev_clear_color[1], + prev_clear_color[2], prev_clear_color[3] ); + opengl_funcs.gl.p_glClearDepth( prev_clear_depth ); + opengl_funcs.gl.p_glClearStencil( prev_clear_stencil ); + } wglBindFramebuffer( GL_DRAW_FRAMEBUFFER, prev_draw_fbo ); wglBindFramebuffer( GL_READ_FRAMEBUFFER, prev_read_fbo ); From bb42bc31afccbb6e9c2555275d08453c6bc2e3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 21:11:10 +0100 Subject: [PATCH 0221/1506] fshack: winex11: Support adjusting gamma in the fshack CW-Bug-Id: 16421 --- dlls/winex11.drv/fs.c | 34 ++ dlls/winex11.drv/opengl.c | 665 ++++++++++++++++++++++++++++++++---- dlls/winex11.drv/x11drv.h | 2 + dlls/winex11.drv/xvidmode.c | 22 +- 4 files changed, 648 insertions(+), 75 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index 6c9e7a97e01..6994e71924a 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -84,6 +84,10 @@ struct fs_monitor static pthread_mutex_t fs_lock = PTHREAD_MUTEX_INITIALIZER; static struct list fs_monitors = LIST_INIT( fs_monitors ); +static WORD gamma_ramp_i[GAMMA_RAMP_SIZE * 3]; +static float gamma_ramp[GAMMA_RAMP_SIZE * 4]; +static LONG gamma_serial; + #define NEXT_DEVMODEW(mode) ((DEVMODEW *)((char *)((mode) + 1) + (mode)->dmDriverExtra)) static const char *debugstr_devmode( const DEVMODEW *devmode ) @@ -958,3 +962,33 @@ void fs_hack_init(void) initialized = TRUE; } + +const float *fs_hack_get_gamma_ramp( LONG *serial ) +{ + if (gamma_serial == 0) return NULL; + if (serial) *serial = gamma_serial; + return gamma_ramp; +} + +void fs_hack_set_gamma_ramp( const WORD *ramp ) +{ + int i; + if (memcmp( gamma_ramp_i, ramp, sizeof(gamma_ramp_i) ) == 0) + { + /* identical */ + return; + } + for (i = 0; i < GAMMA_RAMP_SIZE; ++i) + { + gamma_ramp[i * 4] = ramp[i] / 65535.f; + gamma_ramp[i * 4 + 1] = ramp[i + GAMMA_RAMP_SIZE] / 65535.f; + gamma_ramp[i * 4 + 2] = ramp[i + 2 * GAMMA_RAMP_SIZE] / 65535.f; + } + memcpy( gamma_ramp_i, ramp, sizeof(gamma_ramp_i) ); + InterlockedIncrement( &gamma_serial ); + TRACE( "new gamma serial: %u\n", (int)gamma_serial ); + if (gamma_serial == 0) + { + InterlockedIncrement( &gamma_serial ); + } +} diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 43710be173a..8bfa0d7b53f 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -212,9 +212,11 @@ struct wgl_context BOOL refresh_drawables; BOOL fs_hack; BOOL fs_hack_integer; + BOOL is_core; GLuint fs_hack_fbo, fs_hack_resolve_fbo; GLuint fs_hack_color_texture, fs_hack_ds_texture; - GLuint fs_hack_color_renderbuffer, fs_hack_color_resolve_renderbuffer, fs_hack_ds_renderbuffer; + GLuint fs_hack_color_renderbuffer, fs_hack_ds_renderbuffer; + GLuint fs_hack_gamma_pgm, ramp_ubo; POINT setup_for; GLuint current_draw_fbo, current_read_fbo; struct list entry; @@ -255,6 +257,11 @@ struct gl_drawable BOOL fs_hack_did_swapbuf; BOOL fs_hack_context_set_up; BOOL has_scissor_indexed; + BOOL has_clip_control; + BOOL has_ati_frag_shader; + BOOL has_fragment_program; + BOOL has_vertex_program; + LONG last_gamma_serial; }; struct wgl_pbuffer @@ -391,10 +398,6 @@ static int (*pglXSwapIntervalSGI)(int); static void* (*pglXAllocateMemoryNV)(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); static void (*pglXFreeMemoryNV)(GLvoid *pointer); -static void (*pglScissorIndexed)( GLuint, GLint, GLint, GLsizei, GLsizei ); -static void (*pglScissorIndexedv)( GLuint, const GLint * ); -static void (*pglGetIntegeri_v)( GLenum, GLuint, GLint * ); - /* MESA GLX Extensions */ static void (*pglXCopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); static int (*pglXSwapIntervalMESA)(unsigned int interval); @@ -419,23 +422,59 @@ static void wglFlush(void); static const GLubyte *wglGetString(GLenum name); /* Fullscreen hack */ +static void (*pglActiveTexture)( GLenum texture ); +static void (*pglAttachShader)( GLuint program, GLuint shader ); +static void (*pglBindBuffer)( GLenum target, GLuint buffer ); +static void (*pglBindBufferBase)( GLenum target, GLuint index, GLuint buffer ); +static void (*pglBindBufferRange)( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ); static void (*pglBindFramebuffer)( GLenum target, GLuint framebuffer ); static void (*pglBindFramebufferEXT)( GLenum target, GLuint framebuffer ); static void (*pglBindRenderbuffer)( GLenum target, GLuint renderbuffer ); +static void (*pglBindSampler)( GLuint target, GLuint sampler ); static void (*pglBlitFramebuffer)( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter ); -void (*pglDeleteFramebuffers)( GLsizei n, const GLuint *framebuffers ); -void (*pglDeleteRenderbuffers)( GLsizei n, const GLuint *renderbuffers ); +static void (*pglBufferData)( GLenum target, GLsizeiptr size, const void *data, GLenum usage ); +static void (*pglClipControl)( GLenum origin, GLenum depth ); +static void (*pglColorMaski)( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a ); +static void (*pglCompileShader)( GLuint shader ); +static GLuint (*pglCreateProgram)(void); +static GLuint (*pglCreateShader)( GLenum type ); +static void (*pglDeleteBuffers)( GLsizei n, GLuint *buffers ); +static void (*pglDeleteFramebuffers)( GLsizei n, const GLuint *framebuffers ); +static void (*pglDeleteProgram)( GLuint program ); +static void (*pglDeleteRenderbuffers)( GLsizei n, const GLuint *renderbuffers ); +static void (*pglDeleteShader)( GLuint shader ); +static void (*pglDrawArrays)( GLenum mode, GLint first, GLsizei count ); static void (*pglDrawBuffer)( GLenum buffer ); static void (*pglFramebufferRenderbuffer)( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ); static void (*pglFramebufferTexture2D)( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ); +static void (*pglGenBuffers)( GLsizei n, GLuint *buffers ); static void (*pglGenFramebuffers)( GLsizei n, GLuint *ids ); +static void (*pglGetBooleani_v)( GLenum target, GLuint index, GLboolean *data ); +static void (*pglGetInteger64i_v)( GLenum target, GLuint index, GLint64 *data ); +static void (*pglGetIntegeri_v)( GLenum, GLuint, GLint * ); +static void (*pglGetFloati_v)( GLenum, GLuint, GLfloat * ); static void (*pglGenRenderbuffers)( GLsizei n, GLuint *renderbuffers ); +static void (*pglGetProgramiv)( GLuint program, GLenum pname, GLint *params ); +static void (*pglGetProgramInfoLog)( GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog ); +static void (*pglGetShaderiv)( GLuint shader, GLenum pname, GLint *params ); +static void (*pglGetShaderInfoLog)( GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog ); +static GLuint (*pglGetUniformBlockIndex)( GLuint program, const GLchar *uniformBlockName ); +static GLint (*pglGetUniformLocation)( GLuint program, const GLchar *name ); +static void (*pglLinkProgram)( GLuint program ); static void (*pglReadBuffer)( GLenum src ); static void (*pglRenderbufferStorage)( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ); static void (*pglRenderbufferStorageMultisample)( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height ); - +static void (*pglScissorIndexed)( GLuint, GLint, GLint, GLsizei, GLsizei ); +static void (*pglScissorIndexedv)( GLuint, const GLint * ); +static void (*pglShaderSource)( GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length ); +static void (*pglUniformBlockBinding)( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding ); +static void (*pglUniform1i)( GLint location, GLint v0 ); +static void (*pglUseProgram)( GLuint program ); +static void (*pglViewportIndexedf)( GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h ); +static void (*pglViewportIndexedfv)( GLuint index, const GLfloat *v ); +static void (*pglGetFramebufferAttachmentParameteriv)( GLenum target, GLenum attachment, GLenum pname, GLint *params ); static void wglBindFramebuffer( GLenum target, GLuint framebuffer ); static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ); static void wglDrawBuffer( GLenum buffer ); @@ -632,18 +671,55 @@ static void init_opengl(void) /* Fullscreen hack */ #define LOAD_FUNCPTR(func) p##func = (void *)pglXGetProcAddressARB((const unsigned char *)#func); + LOAD_FUNCPTR( glActiveTexture ); + LOAD_FUNCPTR( glAttachShader ); + LOAD_FUNCPTR( glBindBuffer ); + LOAD_FUNCPTR( glBindBufferBase ); + LOAD_FUNCPTR( glBindBufferRange ); LOAD_FUNCPTR( glBindFramebuffer ); LOAD_FUNCPTR( glBindFramebufferEXT ); LOAD_FUNCPTR( glBindRenderbuffer ); + LOAD_FUNCPTR( glBindSampler ); LOAD_FUNCPTR( glBlitFramebuffer ); + LOAD_FUNCPTR( glBufferData ); + LOAD_FUNCPTR( glClipControl ); + LOAD_FUNCPTR( glColorMaski ); + LOAD_FUNCPTR( glCompileShader ); + LOAD_FUNCPTR( glCreateProgram ); + LOAD_FUNCPTR( glCreateShader ); + LOAD_FUNCPTR( glDeleteBuffers ); LOAD_FUNCPTR( glDeleteFramebuffers ); + LOAD_FUNCPTR( glDeleteProgram ); LOAD_FUNCPTR( glDeleteRenderbuffers ); + LOAD_FUNCPTR( glDeleteShader ); + LOAD_FUNCPTR( glDrawArrays ); LOAD_FUNCPTR( glFramebufferRenderbuffer ); LOAD_FUNCPTR( glFramebufferTexture2D ); + LOAD_FUNCPTR( glGenBuffers ); LOAD_FUNCPTR( glGenFramebuffers ); + LOAD_FUNCPTR( glGetBooleani_v ); + LOAD_FUNCPTR( glGetInteger64i_v ); + LOAD_FUNCPTR( glGetIntegeri_v ); + LOAD_FUNCPTR( glGetFloati_v ); LOAD_FUNCPTR( glGenRenderbuffers ); + LOAD_FUNCPTR( glGetProgramiv ); + LOAD_FUNCPTR( glGetProgramInfoLog ); + LOAD_FUNCPTR( glGetShaderiv ); + LOAD_FUNCPTR( glGetShaderInfoLog ); + LOAD_FUNCPTR( glGetUniformBlockIndex ); + LOAD_FUNCPTR( glGetUniformLocation ); + LOAD_FUNCPTR( glLinkProgram ); LOAD_FUNCPTR( glRenderbufferStorage ); LOAD_FUNCPTR( glRenderbufferStorageMultisample ); + LOAD_FUNCPTR( glScissorIndexed ); + LOAD_FUNCPTR( glScissorIndexedv ); + LOAD_FUNCPTR( glShaderSource ); + LOAD_FUNCPTR( glUniformBlockBinding ); + LOAD_FUNCPTR( glUniform1i ); + LOAD_FUNCPTR( glUseProgram ); + LOAD_FUNCPTR( glViewportIndexedf ); + LOAD_FUNCPTR( glViewportIndexedfv ); + LOAD_FUNCPTR( glGetFramebufferAttachmentParameteriv ); #undef LOAD_FUNCPTR #define LOAD_FUNCPTR(f) do if((p##f = (void*)pglXGetProcAddressARB((const unsigned char*)#f)) == NULL) \ @@ -696,10 +772,6 @@ static void init_opengl(void) /* NV GLX Extension */ LOAD_FUNCPTR(glXAllocateMemoryNV); LOAD_FUNCPTR(glXFreeMemoryNV); - - LOAD_FUNCPTR(glScissorIndexed); - LOAD_FUNCPTR(glScissorIndexedv); - LOAD_FUNCPTR(glGetIntegeri_v); #undef LOAD_FUNCPTR if(!X11DRV_WineGL_InitOpenglInfo()) goto failed; @@ -790,13 +862,6 @@ static void init_opengl(void) pglXSwapBuffersMscOML = pglXGetProcAddressARB( (const GLubyte *)"glXSwapBuffersMscOML" ); } - if (has_extension( glExtensions, "GL_ARB_viewport_array" )) - { - opengl_funcs.ext.p_glGetIntegeri_v = pglGetIntegeri_v; - opengl_funcs.ext.p_glScissorIndexed = pglScissorIndexed; - opengl_funcs.ext.p_glScissorIndexedv = pglScissorIndexedv; - } - X11DRV_WineGL_LoadExtensions(); init_pixel_formats( gdi_display ); return; @@ -1617,7 +1682,7 @@ void sync_gl_drawable( HWND hwnd, BOOL known_child ) if (DC_GL_PIXMAP_WIN != old->type) { data = get_win_data( hwnd ); - old->fs_hack = data->fs_hack; + old->fs_hack = data->fs_hack || fs_hack_get_gamma_ramp( NULL ) != NULL; if (old->fs_hack) TRACE( "Window %p has the fullscreen hack enabled\n", hwnd ); release_win_data( data ); } @@ -1986,7 +2051,6 @@ struct fs_hack_fbconfig_attribs int stencil_size; int doublebuffer; int samples; - int srgb; }; struct fs_hack_fbo_attachments_config @@ -2008,8 +2072,7 @@ static void fs_hack_get_attachments_config( struct gl_drawable *gl, struct fs_ha if (attribs->red_size != 8 || attribs->green_size != 8 || attribs->blue_size != 8) FIXME( "Unsupported RGBA color sizes {%u, %u, %u, %u}.\n", attribs->red_size, attribs->green_size, attribs->blue_size, attribs->alpha_size ); - if (attribs->srgb) config->color_internalformat = attribs->alpha_size ? GL_SRGB8_ALPHA8 : GL_SRGB8; - else config->color_internalformat = attribs->alpha_size ? GL_RGBA8 : GL_RGB8; + config->color_internalformat = attribs->alpha_size ? GL_SRGB8_ALPHA8 : GL_SRGB8; config->color_format = GL_BGRA; config->color_type = GL_UNSIGNED_INT_8_8_8_8_REV; if (attribs->depth_size || attribs->stencil_size) @@ -2028,6 +2091,162 @@ static void fs_hack_get_attachments_config( struct gl_drawable *gl, struct fs_ha config->samples = attribs->samples; } +static const float *fs_hack_get_default_gamma_ramp(void) +{ + static float default_gamma_ramp[GAMMA_RAMP_SIZE * 4]; + static BOOL initialized; + unsigned int i; + + if (!initialized) + { + for (i = 0; i < GAMMA_RAMP_SIZE; i++) + default_gamma_ramp[i * 4] = default_gamma_ramp[i * 4 + 1] = default_gamma_ramp[i * 4 + 2] = i / (float)( GAMMA_RAMP_SIZE - 1 ); + initialized = TRUE; + } + return default_gamma_ramp; +} + +static const char *fs_hack_gamma_vertex_shader_src = +"#version 330\n" +"\n" +"const vec4 square[4] = vec4[4](\n" +" vec4(-1.0, -1.0, 0.0, 1.0),\n" +" vec4(-1.0, 1.0, 0.0, 1.0),\n" +" vec4(1.0, -1.0, 0.0, 1.0),\n" +" vec4(1.0, 1.0, 0.0, 1.0)\n" +");\n" +"const vec2 texsq[4] = vec2[4](\n" +" vec2(0.0, 0.0),\n" +" vec2(0.0, 1.0),\n" +" vec2(1.0, 0.0),\n" +" vec2(1.0, 1.0)\n" +");\n" +"\n" +"out vec2 texCoord;\n" +"\n" +"void main(void)\n" +"{\n" +" gl_Position = square[gl_VertexID];\n" +" texCoord = texsq[gl_VertexID];\n" +"}\n" +; + +static const char *fs_hack_gamma_frag_shader_src = +"#version 330\n" +"\n" +"uniform sampler2D tex;\n" +"in vec2 texCoord;\n" +"layout (std140) uniform ramp {\n" +" vec3 values[256];\n" +"};\n" +"\n" +"layout(location = 0) out vec4 outColor;\n" +"\n" +"void main(void)\n" +"{\n" +" vec4 lookup = texture(tex, texCoord) * 255.0;\n" +" outColor.r = values[int(lookup.r)].r;\n" +" outColor.g = values[int(lookup.g)].g;\n" +" outColor.b = values[int(lookup.b)].b;\n" +" outColor.a = 1.0;\n" +"}\n" +; + +static void fs_hack_setup_gamma_shader( struct wgl_context *ctx, struct gl_drawable *gl ) +{ + GLint success; + GLuint vshader, fshader, program, ramp_index, tex_loc, prev_program; + char errstr[512]; + const float *default_gamma_ramp = fs_hack_get_default_gamma_ramp(); + + opengl_funcs.gl.p_glGetIntegerv( GL_CURRENT_PROGRAM, (GLint *)&prev_program ); + /* vertex shader */ + vshader = pglCreateShader( GL_VERTEX_SHADER ); + if (vshader == 0) + { + ERR( "Failed to create gamma vertex shader\n" ); + return; + } + pglShaderSource( vshader, 1, &fs_hack_gamma_vertex_shader_src, NULL ); + pglCompileShader( vshader ); + + pglGetShaderiv( vshader, GL_COMPILE_STATUS, &success ); + if (!success) + { + pglGetShaderInfoLog( vshader, sizeof(errstr), NULL, errstr ); + ERR( "Compiling gamma vertex shader failed: %s\n", errstr ); + pglDeleteShader( vshader ); + return; + } + + /* fragment shader */ + fshader = pglCreateShader( GL_FRAGMENT_SHADER ); + if (fshader == 0) + { + ERR( "Failed to create gamma fragment shader\n" ); + pglDeleteShader( vshader ); + return; + } + pglShaderSource( fshader, 1, &fs_hack_gamma_frag_shader_src, NULL ); + pglCompileShader( fshader ); + + pglGetShaderiv( fshader, GL_COMPILE_STATUS, &success ); + if (!success) + { + pglGetShaderInfoLog( fshader, sizeof(errstr), NULL, errstr ); + ERR( "Compiling gamma fragment shader failed: %s\n", errstr ); + pglDeleteShader( fshader ); + pglDeleteShader( vshader ); + return; + } + + /* gamma program */ + program = pglCreateProgram(); + if (program == 0) + { + ERR( "Failed to create gamma program\n" ); + pglDeleteShader( fshader ); + pglDeleteShader( vshader ); + return; + } + + pglAttachShader( program, vshader ); + pglAttachShader( program, fshader ); + + pglLinkProgram( program ); + + pglGetProgramiv( program, GL_LINK_STATUS, &success ); + if (!success) + { + pglGetProgramInfoLog( program, sizeof(errstr), NULL, errstr ); + ERR( "Linking gamma shader failed: %s\n", errstr ); + pglDeleteProgram( program ); + pglDeleteShader( fshader ); + pglDeleteShader( vshader ); + return; + } + + pglDeleteShader( fshader ); + pglDeleteShader( vshader ); + + pglGenBuffers( 1, &ctx->ramp_ubo ); + pglBindBuffer( GL_UNIFORM_BUFFER, ctx->ramp_ubo ); + pglBufferData( GL_UNIFORM_BUFFER, sizeof(float) * 4 * GAMMA_RAMP_SIZE, default_gamma_ramp, GL_DYNAMIC_DRAW ); + gl->last_gamma_serial = 0; + + ramp_index = pglGetUniformBlockIndex( program, "ramp" ); + pglUniformBlockBinding( program, ramp_index, 0 ); + + pglUseProgram( program ); + + tex_loc = pglGetUniformLocation( program, "tex" ); + pglUniform1i( tex_loc, 0 ); + + ctx->fs_hack_gamma_pgm = program; + + pglUseProgram( prev_program ); +} + static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable *gl ) { GLuint prev_draw_fbo, prev_read_fbo, prev_texture, prev_renderbuffer; @@ -2053,7 +2272,6 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * {GLX_STENCIL_SIZE, offsetof(struct fs_hack_fbconfig_attribs, stencil_size)}, {GLX_DOUBLEBUFFER, offsetof(struct fs_hack_fbconfig_attribs, doublebuffer)}, {GLX_SAMPLES_ARB, offsetof(struct fs_hack_fbconfig_attribs, samples)}, - {GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, offsetof(struct fs_hack_fbconfig_attribs, srgb)}, }; BYTE *ptr = (BYTE *)&attribs; @@ -2062,6 +2280,7 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; HMONITOR monitor; int width, height; + GLuint profile; monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( ctx->hdc ) ); NtUserGetMonitorInfo( monitor, &info ); @@ -2070,6 +2289,9 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * TRACE( "Render buffer width:%d height:%d\n", width, height ); + opengl_funcs.gl.p_glGetIntegerv( GL_CONTEXT_PROFILE_MASK, (GLint *)&profile ); + ctx->is_core = (profile & GL_CONTEXT_CORE_PROFILE_BIT) != 0; + opengl_funcs.gl.p_glGetIntegerv( GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&prev_draw_fbo ); opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&prev_read_fbo ); opengl_funcs.gl.p_glGetIntegerv( GL_TEXTURE_BINDING_2D, (GLint *)&prev_texture ); @@ -2085,13 +2307,26 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * pglGenFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); TRACE( "Created FBO %u for fullscreen hack.\n", ctx->fs_hack_fbo ); } - pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_fbo ); + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); for (i = 0; i < ARRAY_SIZE(queries); ++i) pglXGetFBConfigAttrib( gdi_display, gl->format->fbconfig, queries[i].attribute, (int *)&ptr[queries[i].offset] ); + + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_fbo ); + fs_hack_get_attachments_config( gl, &attribs, &config ); + if (!ctx->fs_hack_color_texture) opengl_funcs.gl.p_glGenTextures( 1, &ctx->fs_hack_color_texture ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_color_texture ); + opengl_funcs.gl.p_glTexImage2D( GL_TEXTURE_2D, 0, config.color_internalformat, width, + height, 0, config.color_format, config.color_type, NULL ); + opengl_funcs.gl.p_glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 ); + opengl_funcs.gl.p_glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + ctx->fs_hack_integer ? GL_NEAREST : GL_LINEAR ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, prev_texture ); + TRACE( "Created texture %u for fullscreen hack.\n", ctx->fs_hack_color_texture ); + if (config.samples) { if (!ctx->fs_hack_color_renderbuffer) @@ -2101,30 +2336,18 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * config.color_internalformat, width, height ); pglFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ctx->fs_hack_color_renderbuffer ); - TRACE( "Created renderbuffer %u for fullscreen hack.\n", ctx->fs_hack_color_renderbuffer ); - pglGenRenderbuffers( 1, &ctx->fs_hack_color_resolve_renderbuffer ); - pglBindRenderbuffer( GL_RENDERBUFFER, ctx->fs_hack_color_resolve_renderbuffer ); - pglRenderbufferStorage( GL_RENDERBUFFER, config.color_internalformat, width, height ); + TRACE( "Created renderbuffer %u and FBO %u for fullscreen hack.\n", + ctx->fs_hack_color_renderbuffer, ctx->fs_hack_resolve_fbo ); pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); - pglFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, - ctx->fs_hack_color_resolve_renderbuffer ); + pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + ctx->fs_hack_color_texture, 0 ); pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_fbo ); pglBindRenderbuffer( GL_RENDERBUFFER, prev_renderbuffer ); - TRACE( "Also created renderbuffer %u and FBO %u for color resolve.\n", - ctx->fs_hack_color_resolve_renderbuffer, ctx->fs_hack_resolve_fbo ); } else { - if (!ctx->fs_hack_color_texture) - opengl_funcs.gl.p_glGenTextures( 1, &ctx->fs_hack_color_texture ); - opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_color_texture ); - opengl_funcs.gl.p_glTexImage2D( GL_TEXTURE_2D, 0, config.color_internalformat, width, - height, 0, config.color_format, config.color_type, NULL ); - opengl_funcs.gl.p_glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 ); - opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, prev_texture ); pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ctx->fs_hack_color_texture, 0 ); - TRACE( "Created texture %u for fullscreen hack.\n", ctx->fs_hack_color_texture ); } if (config.ds_internalformat) @@ -2163,6 +2386,8 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * } } + fs_hack_setup_gamma_shader( ctx, gl ); + if (!gl->fs_hack_context_set_up) { opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); @@ -2186,6 +2411,13 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * ctx->setup_for.x = width; ctx->setup_for.y = height; gl->has_scissor_indexed = has_extension( glExtensions, "GL_ARB_viewport_array" ); + gl->has_clip_control = has_extension( glExtensions, "GL_ARB_clip_control" ); + gl->has_ati_frag_shader = !ctx->is_core && + has_extension( glExtensions, "GL_ATI_fragment_shader" ); + gl->has_fragment_program = !ctx->is_core && + has_extension( glExtensions, "GL_ARB_fragment_program" ); + gl->has_vertex_program = !ctx->is_core && + has_extension( glExtensions, "GL_ARB_vertex_program" ); ctx->fs_hack_integer = fs_hack_is_integer(); gl->fs_hack_context_set_up = TRUE; } @@ -2203,12 +2435,15 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * ctx->current_read_fbo = 0; } + pglDeleteBuffers( 1, &ctx->ramp_ubo ); + pglDeleteProgram( ctx->fs_hack_gamma_pgm ); + ctx->fs_hack_gamma_pgm = 0; + pglDeleteRenderbuffers( 1, &ctx->fs_hack_ds_renderbuffer ); - pglDeleteRenderbuffers( 1, &ctx->fs_hack_color_resolve_renderbuffer ); pglDeleteRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_ds_texture ); opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_color_texture ); - ctx->fs_hack_color_renderbuffer = ctx->fs_hack_color_resolve_renderbuffer = ctx->fs_hack_ds_renderbuffer = 0; + ctx->fs_hack_color_renderbuffer = ctx->fs_hack_ds_renderbuffer = 0; ctx->fs_hack_color_texture = ctx->fs_hack_ds_texture = 0; pglDeleteFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); pglDeleteFramebuffers( 1, &ctx->fs_hack_fbo ); @@ -2350,16 +2585,284 @@ static void wglReadBuffer( GLenum buffer ) pglReadBuffer( buffer ); } +struct fs_hack_gl_state +{ + GLuint draw_fbo; + GLuint read_fbo; + GLuint program; + GLuint bound_texture; + GLint active_texture; + GLint clip_origin, clip_depth_mode; + GLuint ubo; + GLint64 ubo_size, ubo_start; + GLint viewporti[4]; + GLfloat viewportf[4]; + float clear_color[4]; + GLboolean scissor_test, cull_face, blend, alpha_test, depth_test, stencil_test; + GLboolean arb_frag, arb_vert, ati_frag, fb_srgb; + GLboolean clip_distance[8]; + GLboolean color_mask[4]; + GLuint sampler; +}; + +#define SET 0 +#define RESET 1 + +static void fs_hack_handle_enable_switch( int mode, GLenum cap, GLboolean *b, BOOL new ) +{ + if (mode == SET) + { + *b = opengl_funcs.gl.p_glIsEnabled( cap ); + if (new) opengl_funcs.gl.p_glEnable( cap ); + else opengl_funcs.gl.p_glDisable( cap ); + } + else + { + if (*b) opengl_funcs.gl.p_glEnable( cap ); + else opengl_funcs.gl.p_glDisable( cap ); + } +} + +static void fs_hack_handle_fbo_state( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (mode == SET) + { + opengl_funcs.gl.p_glGetIntegerv( GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&state->draw_fbo ); + opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&state->read_fbo ); + TRACE( "Previous draw FBO %u, read FBO %u\n", state->draw_fbo, state->read_fbo ); + } + else + { + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, state->draw_fbo ); + pglBindFramebuffer( GL_READ_FRAMEBUFFER, state->read_fbo ); + } +} + +static void fs_hack_handle_clip_control( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (!gl->has_clip_control) return; + + if (mode == SET) + { + opengl_funcs.gl.p_glGetIntegerv( GL_CLIP_ORIGIN, (GLint *)&state->clip_origin ); + opengl_funcs.gl.p_glGetIntegerv( GL_CLIP_DEPTH_MODE, (GLint *)&state->clip_depth_mode ); + + pglClipControl( GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE ); + } + else + { + pglClipControl( state->clip_origin, state->clip_depth_mode ); + } +} + +static void fs_hack_handle_shaders( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (gl->has_fragment_program) + fs_hack_handle_enable_switch( mode, GL_FRAGMENT_PROGRAM_ARB, &state->arb_frag, FALSE ); + if (gl->has_vertex_program) + fs_hack_handle_enable_switch( mode, GL_VERTEX_PROGRAM_ARB, &state->arb_vert, FALSE ); + fs_hack_handle_enable_switch( mode, GL_FRAMEBUFFER_SRGB, &state->fb_srgb, TRUE ); + + if (gl->has_ati_frag_shader) + fs_hack_handle_enable_switch( mode, GL_FRAGMENT_SHADER_ATI, &state->ati_frag, FALSE ); + + if (mode == SET) + { + opengl_funcs.gl.p_glGetIntegerv( GL_CURRENT_PROGRAM, (GLint *)&state->program ); + + pglGetIntegeri_v( GL_UNIFORM_BUFFER_BINDING, 0, (GLint *)&state->ubo ); + pglGetInteger64i_v( GL_UNIFORM_BUFFER_START, 0, &state->ubo_start ); + pglGetInteger64i_v( GL_UNIFORM_BUFFER_SIZE, 0, &state->ubo_size ); + + opengl_funcs.gl.p_glGetIntegerv( GL_ACTIVE_TEXTURE, &state->active_texture ); + pglActiveTexture( GL_TEXTURE0 ); + opengl_funcs.gl.p_glGetIntegerv( GL_TEXTURE_BINDING_2D, (GLint *)&state->bound_texture ); + pglGetIntegeri_v( GL_SAMPLER_BINDING, 0, (GLint *)&state->sampler ); + + pglBindBufferBase( GL_UNIFORM_BUFFER, 0, ctx->ramp_ubo ); + + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_color_texture ); + pglBindSampler( 0, 0 ); + + pglUseProgram( ctx->fs_hack_gamma_pgm ); + } + else + { + pglUseProgram( state->program ); + + pglBindSampler( 0, state->sampler ); + + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, state->bound_texture ); + pglActiveTexture( state->active_texture ); + + pglBindBufferRange( GL_UNIFORM_BUFFER, 0, state->ubo, state->ubo_start, state->ubo_size ); + } +} + +static void fs_hack_handle_viewport( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (mode == SET) + { + if (gl->has_scissor_indexed) + { + pglGetFloati_v( GL_VIEWPORT, 0, state->viewportf ); + pglViewportIndexedf( 0, scaled_origin->x, scaled_origin->y, scaled->cx, scaled->cy ); + } + else + { + opengl_funcs.gl.p_glGetIntegerv( GL_VIEWPORT, state->viewporti ); + opengl_funcs.gl.p_glViewport( scaled_origin->x, scaled_origin->y, scaled->cx, scaled->cy ); + } + } + else + { + if (gl->has_scissor_indexed) + { + pglViewportIndexedfv( 0, state->viewportf ); + } + else + { + opengl_funcs.gl.p_glViewport( state->viewporti[0], state->viewporti[1], + state->viewporti[2], state->viewporti[3] ); + } + } +} + +static void fs_hack_handle_clear_color( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (mode == SET) + { + opengl_funcs.gl.p_glGetFloatv( GL_COLOR_CLEAR_VALUE, state->clear_color ); + opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); + } + else + { + opengl_funcs.gl.p_glClearColor( state->clear_color[0], state->clear_color[1], + state->clear_color[2], state->clear_color[3] ); + } +} + +static void fs_hack_handle_clip_distance( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + unsigned int i; + if (mode == SET) + { + for (i = 0; i < ARRAY_SIZE(state->clip_distance); ++i) + { + state->clip_distance[i] = opengl_funcs.gl.p_glIsEnabled( GL_CLIP_DISTANCE0 + i ); + opengl_funcs.gl.p_glDisable( GL_CLIP_DISTANCE0 + i ); + } + } + else + { + for (i = 0; i < ARRAY_SIZE(state->clip_distance); ++i) + { + if (state->clip_distance[i]) opengl_funcs.gl.p_glEnable( GL_CLIP_DISTANCE0 + i ); + } + } +} + +static void fs_hack_handle_color_mask( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (mode == SET) + { + pglGetBooleani_v( GL_COLOR_WRITEMASK, 0, state->color_mask ); + + pglColorMaski( 0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); + } + else + { + pglColorMaski( 0, state->color_mask[0], state->color_mask[1], state->color_mask[2], state->color_mask[3] ); + } +} + +static void fs_hack_handle_scissor( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + fs_hack_handle_enable_switch( mode, GL_SCISSOR_TEST, &state->scissor_test, FALSE ); +} + +static void fs_hack_handle_cull_face( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + fs_hack_handle_enable_switch( mode, GL_CULL_FACE, &state->cull_face, FALSE ); +} + +static void fs_hack_handle_blend( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + fs_hack_handle_enable_switch( mode, GL_BLEND, &state->blend, FALSE ); +} + +static void fs_hack_handle_alpha_test( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + if (ctx->is_core) return; + + fs_hack_handle_enable_switch( mode, GL_ALPHA_TEST, &state->alpha_test, FALSE ); +} + +static void fs_hack_handle_ds_test( int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin ) +{ + fs_hack_handle_enable_switch( mode, GL_DEPTH_TEST, &state->depth_test, FALSE ); + fs_hack_handle_enable_switch( mode, GL_STENCIL_TEST, &state->stencil_test, FALSE ); +} + static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer ) { + static const struct + { + void (*state_handler)(int mode, struct gl_drawable *gl, struct wgl_context *ctx, + struct fs_hack_gl_state *state, const SIZE *real, + const SIZE *scaled, const POINT *scaled_origin); + } + general_state_handlers[] = + { + {fs_hack_handle_fbo_state}, + {fs_hack_handle_scissor}, + {fs_hack_handle_clear_color}, + }, + draw_state_handlers[] = + { + {fs_hack_handle_clip_control}, + {fs_hack_handle_shaders}, + {fs_hack_handle_viewport}, + {fs_hack_handle_cull_face}, + {fs_hack_handle_clip_distance}, + {fs_hack_handle_color_mask}, + {fs_hack_handle_blend}, + {fs_hack_handle_alpha_test}, + {fs_hack_handle_ds_test}, + }; struct wgl_context *ctx = NtCurrentTeb()->glContext; SIZE scaled, src, real; - GLuint prev_draw_fbo, prev_read_fbo; - GLint prev_scissor[4]; RECT user_rect, real_rect; POINT scaled_origin; - float prev_clear_color[4]; HMONITOR monitor; + struct fs_hack_gl_state state; + const float *gamma_ramp; + LONG gamma_serial; + unsigned int i; monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( ctx->hdc ) ); scaled = fs_hack_get_scaled_screen_size( monitor ); @@ -2375,32 +2878,36 @@ static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer scaled_origin.x -= real_rect.left; scaled_origin.y -= real_rect.top; + gamma_ramp = fs_hack_get_gamma_ramp( &gamma_serial ); + TRACE( "scaled:%dx%d src:%dx%d real:%dx%d user_rect:%s real_rect:%s scaled_origin:%s\n", (int)scaled.cx, (int)scaled.cy, (int)src.cx, (int)src.cy, (int)real.cx, (int)real.cy, wine_dbgstr_rect( &user_rect ), wine_dbgstr_rect( &real_rect ), wine_dbgstr_point( &scaled_origin ) ); if (ctx->setup_for.x != src.cx || ctx->setup_for.y != src.cy) fs_hack_setup_context( ctx, gl ); - TRACE( "Blitting from FBO %u %ux%u to %ux%u\n", ctx->fs_hack_fbo, + /* Can't stretch blit with multisampled renderbuffers */ + if (ctx->fs_hack_color_renderbuffer && !gamma_ramp) + { + gamma_ramp = fs_hack_get_default_gamma_ramp(); + gamma_serial = 0; + } + + TRACE( "Stretching from FBO %u %ux%u to %ux%u\n", ctx->fs_hack_fbo, (int)src.cx, (int)src.cy, (int)scaled.cx, (int)scaled.cy ); - opengl_funcs.gl.p_glGetIntegerv( GL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&prev_draw_fbo ); - opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&prev_read_fbo ); - TRACE( "Previous draw FBO %u, read FBO %u\n", prev_draw_fbo, prev_read_fbo ); + for (i = 0; i < ARRAY_SIZE(general_state_handlers); i++) + general_state_handlers[i].state_handler( SET, gl, ctx, &state, &real, &scaled, &scaled_origin ); - if (gl->has_scissor_indexed) + if (gamma_ramp) { - opengl_funcs.ext.p_glGetIntegeri_v( GL_SCISSOR_BOX, 0, prev_scissor ); - opengl_funcs.ext.p_glScissorIndexed( 0, 0, 0, real.cx, real.cy ); - } - else - { - opengl_funcs.gl.p_glGetIntegerv( GL_SCISSOR_BOX, prev_scissor ); - opengl_funcs.gl.p_glScissor( 0, 0, real.cx, real.cy ); + for (i = 0; i < ARRAY_SIZE(draw_state_handlers); i++) + draw_state_handlers[i].state_handler( SET, gl, ctx, &state, &real, &scaled, &scaled_origin ); } pglBindFramebuffer( GL_READ_FRAMEBUFFER, ctx->fs_hack_fbo ); - if (ctx->fs_hack_color_resolve_renderbuffer) + + if (ctx->fs_hack_color_renderbuffer) { pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); pglBlitFramebuffer( 0, 0, src.cx, src.cy, 0, 0, src.cx, src.cy, GL_COLOR_BUFFER_BIT, GL_NEAREST ); @@ -2412,29 +2919,39 @@ static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer // pglDrawBuffer( draw_buffer ); pglDrawBuffer( GL_BACK ); - opengl_funcs.gl.p_glGetFloatv( GL_COLOR_CLEAR_VALUE, prev_clear_color ); - opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT ); - opengl_funcs.gl.p_glClearColor( prev_clear_color[0], prev_clear_color[1], prev_clear_color[2], - prev_clear_color[3] ); - pglBlitFramebuffer( 0, 0, src.cx, src.cy, scaled_origin.x, scaled_origin.y, - scaled_origin.x + scaled.cx, scaled_origin.y + scaled.cy, - GL_COLOR_BUFFER_BIT, ctx->fs_hack_integer ? GL_NEAREST : GL_LINEAR ); - // HACK - if (draw_buffer == GL_FRONT) pglXSwapBuffers( gdi_display, gl->drawable ); - - if (gl->has_scissor_indexed) + if (gamma_ramp) { - opengl_funcs.ext.p_glScissorIndexedv( 0, prev_scissor ); + if (gamma_serial != gl->last_gamma_serial) + { + TRACE( "updating gamma ramp (serial: %u)\n", (int)gamma_serial ); + + pglBufferData( GL_UNIFORM_BUFFER, sizeof(float) * 4 * GAMMA_RAMP_SIZE, gamma_ramp, GL_DYNAMIC_DRAW ); + + gl->last_gamma_serial = gamma_serial; + } + + pglDrawArrays( GL_TRIANGLE_STRIP, 0, 4 ); } else { - opengl_funcs.gl.p_glScissor( prev_scissor[0], prev_scissor[1], prev_scissor[2], prev_scissor[3] ); + pglBlitFramebuffer( 0, 0, src.cx, src.cy, scaled_origin.x, scaled_origin.y, + scaled_origin.x + scaled.cx, scaled_origin.y + scaled.cy, + GL_COLOR_BUFFER_BIT, ctx->fs_hack_integer ? GL_NEAREST : GL_LINEAR ); + } + + // HACK + if (draw_buffer == GL_FRONT) pglXSwapBuffers( gdi_display, gl->drawable ); + + if (gamma_ramp) + { + for (i = 0; i < ARRAY_SIZE(draw_state_handlers); i++) + draw_state_handlers[i].state_handler( RESET, gl, ctx, &state, NULL, NULL, NULL ); } - pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, prev_draw_fbo ); - pglBindFramebuffer( GL_READ_FRAMEBUFFER, prev_read_fbo ); + for (i = 0; i < ARRAY_SIZE(general_state_handlers); i++) + general_state_handlers[i].state_handler( RESET, gl, ctx, &state, NULL, NULL, NULL ); } /*********************************************************************** diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3d7d92febb6..66258be6818 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -702,6 +702,8 @@ extern double fs_hack_get_user_to_real_scale( HMONITOR ); extern SIZE fs_hack_get_scaled_screen_size( HMONITOR monitor ); extern RECT fs_hack_get_real_virtual_screen(void); extern void fs_hack_init(void); +extern const float *fs_hack_get_gamma_ramp( LONG *serial ); +extern void fs_hack_set_gamma_ramp( const WORD *ramp ); static inline void mirror_rect( const RECT *window_rect, RECT *rect ) { diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c index fd9b1e7e8b1..a330cf9ce0e 100644 --- a/dlls/winex11.drv/xvidmode.c +++ b/dlls/winex11.drv/xvidmode.c @@ -550,6 +550,25 @@ void X11DRV_XF86VM_Init(void) #endif /* SONAME_LIBXXF86VM */ +static BOOL CALLBACK gammahack_UpdateWindowGamma( HWND hwnd, LPARAM lparam ) +{ + /* XXX: Technically, the ramp should only apply to windows on the given + * device, but I can't think of a situation in which that would matter. */ + + sync_gl_drawable( hwnd, FALSE ); + + return TRUE; +} + +static BOOL gamma_hack_SetGammaRamp( PHYSDEV dev, const WORD *ramp ) +{ + fs_hack_set_gamma_ramp( ramp ); + + NtUserEnumChildWindows( NtUserGetDesktopWindow(), gammahack_UpdateWindowGamma, 0 ); + + return TRUE; +} + /*********************************************************************** * GetDeviceGammaRamp */ @@ -568,7 +587,8 @@ BOOL X11DRV_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) BOOL X11DRV_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) { #ifdef SONAME_LIBXXF86VM - return X11DRV_XF86VM_SetGammaRamp(ramp); + if (!X11DRV_XF86VM_SetGammaRamp(ramp)) return gamma_hack_SetGammaRamp(dev, ramp); + return TRUE; #else return FALSE; #endif From 7a9dbd862453f415a5c3595914be5b6b97311925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:22:21 +0100 Subject: [PATCH 0222/1506] fshack: winex11: Setup gamma shader only once per context. Fixes GL objects leak and avoids unneccessary shader recreation when the fs_hack_setup_context() is called due to switching GL drawable. For Star Wars - Knights of the Old Republic blank screen. CW-Bug-Id: #19002 --- dlls/winex11.drv/opengl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 8bfa0d7b53f..bdf01a1bb26 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2159,6 +2159,10 @@ static void fs_hack_setup_gamma_shader( struct wgl_context *ctx, struct gl_drawa char errstr[512]; const float *default_gamma_ramp = fs_hack_get_default_gamma_ramp(); + gl->last_gamma_serial = 0; + + if (ctx->fs_hack_gamma_pgm) return; + opengl_funcs.gl.p_glGetIntegerv( GL_CURRENT_PROGRAM, (GLint *)&prev_program ); /* vertex shader */ vshader = pglCreateShader( GL_VERTEX_SHADER ); @@ -2232,7 +2236,6 @@ static void fs_hack_setup_gamma_shader( struct wgl_context *ctx, struct gl_drawa pglGenBuffers( 1, &ctx->ramp_ubo ); pglBindBuffer( GL_UNIFORM_BUFFER, ctx->ramp_ubo ); pglBufferData( GL_UNIFORM_BUFFER, sizeof(float) * 4 * GAMMA_RAMP_SIZE, default_gamma_ramp, GL_DYNAMIC_DRAW ); - gl->last_gamma_serial = 0; ramp_index = pglGetUniformBlockIndex( program, "ramp" ); pglUniformBlockBinding( program, ramp_index, 0 ); From e389ff2a8763fbb3964bd351d895cda4b0a35506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:22:48 +0100 Subject: [PATCH 0223/1506] fshack: winex11: Track if multisample resolve is needed in gl_drawable. As that changes per drawable and not per context. --- dlls/winex11.drv/opengl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index bdf01a1bb26..0769bd98704 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -256,6 +256,7 @@ struct gl_drawable BOOL fs_hack; BOOL fs_hack_did_swapbuf; BOOL fs_hack_context_set_up; + BOOL fs_hack_needs_resolve; BOOL has_scissor_indexed; BOOL has_clip_control; BOOL has_ati_frag_shader; @@ -2332,6 +2333,7 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * if (config.samples) { + gl->fs_hack_needs_resolve = TRUE; if (!ctx->fs_hack_color_renderbuffer) pglGenRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); pglBindRenderbuffer( GL_RENDERBUFFER, ctx->fs_hack_color_renderbuffer ); @@ -2349,6 +2351,7 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * } else { + gl->fs_hack_needs_resolve = FALSE; pglFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ctx->fs_hack_color_texture, 0 ); } @@ -2890,7 +2893,7 @@ static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer if (ctx->setup_for.x != src.cx || ctx->setup_for.y != src.cy) fs_hack_setup_context( ctx, gl ); /* Can't stretch blit with multisampled renderbuffers */ - if (ctx->fs_hack_color_renderbuffer && !gamma_ramp) + if (gl->fs_hack_needs_resolve && !gamma_ramp) { gamma_ramp = fs_hack_get_default_gamma_ramp(); gamma_serial = 0; @@ -2910,7 +2913,7 @@ static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer pglBindFramebuffer( GL_READ_FRAMEBUFFER, ctx->fs_hack_fbo ); - if (ctx->fs_hack_color_renderbuffer) + if (gl->fs_hack_needs_resolve) { pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); pglBlitFramebuffer( 0, 0, src.cx, src.cy, 0, 0, src.cx, src.cy, GL_COLOR_BUFFER_BIT, GL_NEAREST ); From fe5d7df185dfa7b079e9b34811d2e955779e38fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:23:17 +0100 Subject: [PATCH 0224/1506] fshack: winex11: Destroy fshack GL objects only at GL context destroy. --- dlls/winex11.drv/opengl.c | 53 +++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 0769bd98704..e45f7f5ac67 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1983,6 +1983,34 @@ static struct wgl_context *glxdrv_wglCreateContext( HDC hdc ) return ret; } +static void fs_hack_destroy_context( struct wgl_context *ctx ) +{ + GLXContext prev_context; + GLXDrawable prev_drawable; + + if (!ctx->drawables[0]) return; + + prev_context = pglXGetCurrentContext(); + prev_drawable = pglXGetCurrentDrawable(); + pglXMakeCurrent( gdi_display, ctx->drawables[0]->drawable, ctx->ctx ); + + pglDeleteBuffers( 1, &ctx->ramp_ubo ); + pglDeleteProgram( ctx->fs_hack_gamma_pgm ); + ctx->fs_hack_gamma_pgm = 0; + + if (ctx->fs_hack_ds_renderbuffer) pglDeleteRenderbuffers( 1, &ctx->fs_hack_ds_renderbuffer ); + if (ctx->fs_hack_color_renderbuffer) pglDeleteRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); + if (ctx->fs_hack_ds_texture) opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_ds_texture ); + if (ctx->fs_hack_color_texture) opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_color_texture ); + ctx->fs_hack_color_renderbuffer = ctx->fs_hack_ds_renderbuffer = 0; + ctx->fs_hack_color_texture = ctx->fs_hack_ds_texture = 0; + if (ctx->fs_hack_resolve_fbo) pglDeleteFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); + if (ctx->fs_hack_fbo) pglDeleteFramebuffers( 1, &ctx->fs_hack_fbo ); + ctx->fs_hack_resolve_fbo = ctx->fs_hack_fbo = 0; + + pglXMakeCurrent( gdi_display, prev_drawable, prev_context ); +} + /*********************************************************************** * glxdrv_wglDeleteContext */ @@ -1992,6 +2020,8 @@ static BOOL glxdrv_wglDeleteContext(struct wgl_context *ctx) TRACE("(%p)\n", ctx); + fs_hack_destroy_context( ctx ); + pthread_mutex_lock( &context_mutex ); list_remove( &ctx->entry ); LIST_FOR_EACH_ENTRY( pb, &pbuffer_list, struct wgl_pbuffer, entry ) @@ -2308,7 +2338,6 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * if (!ctx->fs_hack_fbo) { pglGenFramebuffers( 1, &ctx->fs_hack_fbo ); - pglGenFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); TRACE( "Created FBO %u for fullscreen hack.\n", ctx->fs_hack_fbo ); } pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); @@ -2334,6 +2363,13 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * if (config.samples) { gl->fs_hack_needs_resolve = TRUE; + + if (!ctx->fs_hack_resolve_fbo) + { + pglGenFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); + TRACE( "Created resolve FBO %u for fullscreen hack.\n", ctx->fs_hack_resolve_fbo ); + } + if (!ctx->fs_hack_color_renderbuffer) pglGenRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); pglBindRenderbuffer( GL_RENDERBUFFER, ctx->fs_hack_color_renderbuffer ); @@ -2440,21 +2476,6 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * pglBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); ctx->current_read_fbo = 0; } - - pglDeleteBuffers( 1, &ctx->ramp_ubo ); - pglDeleteProgram( ctx->fs_hack_gamma_pgm ); - ctx->fs_hack_gamma_pgm = 0; - - pglDeleteRenderbuffers( 1, &ctx->fs_hack_ds_renderbuffer ); - pglDeleteRenderbuffers( 1, &ctx->fs_hack_color_renderbuffer ); - opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_ds_texture ); - opengl_funcs.gl.p_glDeleteTextures( 1, &ctx->fs_hack_color_texture ); - ctx->fs_hack_color_renderbuffer = ctx->fs_hack_ds_renderbuffer = 0; - ctx->fs_hack_color_texture = ctx->fs_hack_ds_texture = 0; - pglDeleteFramebuffers( 1, &ctx->fs_hack_resolve_fbo ); - pglDeleteFramebuffers( 1, &ctx->fs_hack_fbo ); - ctx->fs_hack_fbo = 0; - gl->fs_hack_context_set_up = FALSE; } } From 2dc95394493d43947b2aa034b037787658fe8c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:23:32 +0100 Subject: [PATCH 0225/1506] fshack: winex11: Set viewport in fs_hack_setup_context(). For Star Wars - Knights of the Old Republic blank screen. CW-Bug-Id: #19002 --- dlls/winex11.drv/opengl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index e45f7f5ac67..ec56721f68a 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2430,6 +2430,8 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * fs_hack_setup_gamma_shader( ctx, gl ); + if (!ctx->has_been_current) opengl_funcs.gl.p_glViewport( 0, 0, width, height ); + if (!gl->fs_hack_context_set_up) { opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); From 97a8295e13e44c3eab89e9a90de72c329cfe4fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:23:47 +0100 Subject: [PATCH 0226/1506] fshack: winex11: Also enable fshack for drawable due to gamma in create_gl_drawable(). For Star Wars - Knights of the Old Republic blank screen. CW-Bug-Id: #19002 --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index ec56721f68a..d3f5550bf06 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1513,7 +1513,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); if ((data = get_win_data( hwnd ))) { - gl->fs_hack = data->fs_hack; + gl->fs_hack = data->fs_hack || fs_hack_get_gamma_ramp( NULL ); if (gl->fs_hack) TRACE( "Window %p has the fullscreen hack enabled\n", hwnd ); release_win_data( data ); } From 26fecd0476cf91a83ab648aa0ec25bfafea1067e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:24:01 +0100 Subject: [PATCH 0227/1506] fshack: winex11: Use window dimensions in GL if fshack is enabled for gamma only. For Star Wars - Knights of the Old Republic blank screen. CW-Bug-Id: #19002 fshack: winex11: Use window size for texture and framebuffers in fs_hack_setup_context(). For Star Wars - Knights of the Old Republic blank screen. CW-Bug-Id: #19002 --- dlls/winex11.drv/opengl.c | 45 +++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index d3f5550bf06..b1da1950510 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2311,15 +2311,16 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * if (ctx->fs_hack) { - MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; - HMONITOR monitor; int width, height; + RECT rect = {0}; GLuint profile; + HWND hwnd; - monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( ctx->hdc ) ); - NtUserGetMonitorInfo( monitor, &info ); - width = info.rcMonitor.right - info.rcMonitor.left; - height = info.rcMonitor.bottom - info.rcMonitor.top; + hwnd = NtUserWindowFromDC( ctx->hdc ); + NtUserGetClientRect( hwnd, &rect ); + + width = rect.right - rect.left; + height = rect.bottom - rect.top; TRACE( "Render buffer width:%d height:%d\n", width, height ); @@ -2885,18 +2886,40 @@ static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer }; struct wgl_context *ctx = NtCurrentTeb()->glContext; SIZE scaled, src, real; - RECT user_rect, real_rect; + RECT user_rect = {0}, real_rect; POINT scaled_origin; HMONITOR monitor; struct fs_hack_gl_state state; + struct x11drv_win_data *data; + BOOL window_fs_hack = FALSE; const float *gamma_ramp; LONG gamma_serial; unsigned int i; + HWND hwnd; + + hwnd = NtUserWindowFromDC( ctx->hdc ); + monitor = fs_hack_monitor_from_hwnd( hwnd ); + + if ((data = get_win_data( hwnd ))) + { + window_fs_hack = data->fs_hack; + release_win_data( data ); + } + + if (window_fs_hack) + { + user_rect = fs_hack_current_mode( monitor ); + real_rect = fs_hack_real_mode( monitor ); + scaled = fs_hack_get_scaled_screen_size( monitor ); + } + else + { + NtUserGetClientRect( hwnd, &user_rect ); + real_rect = user_rect; + scaled.cx = user_rect.right - user_rect.left; + scaled.cy = user_rect.bottom - user_rect.top; + } - monitor = fs_hack_monitor_from_hwnd( NtUserWindowFromDC( ctx->hdc ) ); - scaled = fs_hack_get_scaled_screen_size( monitor ); - user_rect = fs_hack_current_mode( monitor ); - real_rect = fs_hack_real_mode( monitor ); src.cx = user_rect.right - user_rect.left; src.cy = user_rect.bottom - user_rect.top; real.cx = real_rect.right - real_rect.left; From c623d3740af3f177dfac19fbe78750a00ef41f8e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Feb 2022 16:03:22 +0300 Subject: [PATCH 0228/1506] fshack: winex11: Blit the contents of current framebuffer to the fshack's framebuffer in fs_hack_setup_context(). CW-Bug-Id: #20102 Some games might not clear the framebuffer on each frame and rely on the data in framebuffer to persist through glFlush(), glFinish() etc. That is currently not the case if the fshack is getting turned on after some drawing was performed already. --- dlls/winex11.drv/opengl.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index b1da1950510..0fcaaed1e8c 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2435,10 +2435,23 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * if (!gl->fs_hack_context_set_up) { - opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); - opengl_funcs.gl.p_glClearDepth( 1.0 ); - opengl_funcs.gl.p_glClearStencil( 0 ); - opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); + if (ctx->has_been_current) + { + GLbitfield mask = GL_COLOR_BUFFER_BIT; + + if (attribs.depth_size) mask |= GL_DEPTH_BUFFER_BIT; + if (attribs.stencil_size) mask |= GL_STENCIL_BUFFER_BIT; + + pglBindFramebuffer( GL_READ_FRAMEBUFFER, 0 ); + pglBlitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, GL_NEAREST ); + } + else + { + opengl_funcs.gl.p_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); + opengl_funcs.gl.p_glClearDepth( 1.0 ); + opengl_funcs.gl.p_glClearStencil( 0 ); + opengl_funcs.gl.p_glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); + } } pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ); pglDrawBuffer( GL_BACK ); From 810340d8c859116de197f5f7aac2f20591f46079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 14:31:54 +0100 Subject: [PATCH 0229/1506] fshack: winex11: Use specific names for textures for SWJKJA. CW-Bug-Id: #20102 --- dlls/winex11.drv/opengl.c | 50 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 0fcaaed1e8c..fb52fba5394 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2281,6 +2281,49 @@ static void fs_hack_setup_gamma_shader( struct wgl_context *ctx, struct gl_drawa pglUseProgram( prev_program ); } +enum fshack_texture_type +{ + FSHACK_TEXTURE_COLOUR, + FSHACK_TEXTURE_DEPTH, + FSHACK_TEXTURE_LAST, +}; + +static void gen_texture( struct wgl_context *ctx, GLuint *tex, enum fshack_texture_type type ) +{ + static const GLuint texture_names[FSHACK_TEXTURE_LAST] = + { + 65535, + 65536, + }; + static int texture_name_hack = -1; + static int once; + + if (ctx->is_core) + { + opengl_funcs.gl.p_glGenTextures( 1, tex ); + return; + } + + if (texture_name_hack == -1) + { + const char *sgi = getenv( "SteamGameId" ); + + texture_name_hack = sgi && !strcmp( sgi, "6020" ); + } + + if (!texture_name_hack || opengl_funcs.gl.p_glIsTexture( texture_names[type] )) + { + if (texture_name_hack) FIXME( "Texture %u already exists.\n", texture_names[type] ); + opengl_funcs.gl.p_glGenTextures( 1, tex ); + return; + } + /* Star Wars Jedi Knight: Jedi Academy uses texture names without allocating + * them with glGenTextures(). Trying to use a texture name which has low chances + * to overlap with what games may use. */ + if (!once++) FIXME( "Using texture name hack.\n" ); + *tex = texture_names[type]; +} + static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable *gl ) { GLuint prev_draw_fbo, prev_read_fbo, prev_texture, prev_renderbuffer; @@ -2351,7 +2394,9 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * fs_hack_get_attachments_config( gl, &attribs, &config ); - if (!ctx->fs_hack_color_texture) opengl_funcs.gl.p_glGenTextures( 1, &ctx->fs_hack_color_texture ); + if (!ctx->fs_hack_color_texture) + gen_texture( ctx, &ctx->fs_hack_color_texture, FSHACK_TEXTURE_COLOUR ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_color_texture ); opengl_funcs.gl.p_glTexImage2D( GL_TEXTURE_2D, 0, config.color_internalformat, width, height, 0, config.color_format, config.color_type, NULL ); @@ -2413,7 +2458,8 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * else { if (!ctx->fs_hack_ds_texture) - opengl_funcs.gl.p_glGenTextures( 1, &ctx->fs_hack_ds_texture ); + gen_texture( ctx, &ctx->fs_hack_ds_texture, FSHACK_TEXTURE_DEPTH ); + opengl_funcs.gl.p_glBindTexture( GL_TEXTURE_2D, ctx->fs_hack_ds_texture ); opengl_funcs.gl.p_glTexImage2D( GL_TEXTURE_2D, 0, config.ds_internalformat, width, height, 0, config.ds_format, config.ds_type, NULL ); From 5ab2cd02c5abb674a6cc103dd8848af9dca160a6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 30 Mar 2022 16:46:17 +0300 Subject: [PATCH 0230/1506] fshack: winex11: Interpolate looked up colour in gamma shader. CW-Bug-Id: #20400 --- dlls/winex11.drv/opengl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index fb52fba5394..c2c8a6f028a 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2173,12 +2173,19 @@ static const char *fs_hack_gamma_frag_shader_src = "\n" "layout(location = 0) out vec4 outColor;\n" "\n" +"vec3 color_from_index(vec3 index)\n" +"{\n" +" ivec3 i = ivec3(index);\n" +" return vec3(values[i.r].r, values[i.g].g, values[i.b].b);\n" +"}\n" +"\n" "void main(void)\n" "{\n" -" vec4 lookup = texture(tex, texCoord) * 255.0;\n" -" outColor.r = values[int(lookup.r)].r;\n" -" outColor.g = values[int(lookup.g)].g;\n" -" outColor.b = values[int(lookup.b)].b;\n" +" vec3 lookup = texture(tex, texCoord).xyz * 255.0;\n" +" vec3 lookup1, lookup2;\n" +" lookup1 = floor(lookup);\n" +" lookup2 = ceil(lookup);\n" +" outColor.xyz = mix(color_from_index(lookup1), color_from_index(lookup2), lookup - lookup1);\n" " outColor.a = 1.0;\n" "}\n" ; From a328508a43850efca3a1060d56697d69d013bfa4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 31 Oct 2022 18:35:03 -0600 Subject: [PATCH 0231/1506] fshack: winex11: Enable specific names for textures for Quake III Arena. CW-Bug-Id: #21474 --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index c2c8a6f028a..9106e2e49a7 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2315,7 +2315,7 @@ static void gen_texture( struct wgl_context *ctx, GLuint *tex, enum fshack_textu { const char *sgi = getenv( "SteamGameId" ); - texture_name_hack = sgi && !strcmp( sgi, "6020" ); + texture_name_hack = sgi && (!strcmp( sgi, "6020" ) || !strcmp( sgi, "2200" )); } if (!texture_name_hack || opengl_funcs.gl.p_glIsTexture( texture_names[type] )) From 0be531f2cd693a78451059604152725dda795b7a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 31 Oct 2022 18:40:10 -0600 Subject: [PATCH 0232/1506] fshack: winex11: Enable specific names for textures for Quake III Team Arena. CW-Bug-Id: #21474 --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 9106e2e49a7..bb327e710ee 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2315,7 +2315,7 @@ static void gen_texture( struct wgl_context *ctx, GLuint *tex, enum fshack_textu { const char *sgi = getenv( "SteamGameId" ); - texture_name_hack = sgi && (!strcmp( sgi, "6020" ) || !strcmp( sgi, "2200" )); + texture_name_hack = sgi && (!strcmp( sgi, "6020" ) || !strcmp( sgi, "2200" ) || !strcmp( sgi, "2350" )); } if (!texture_name_hack || opengl_funcs.gl.p_glIsTexture( texture_names[type] )) From a19f26cd3f548def28571f1d7894cea3345258b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 30 Jan 2023 11:20:36 +0100 Subject: [PATCH 0233/1506] fshack: winex11: Always send WM_X11DRV_DESKTOP_RESIZED to sync fshack. CW-Bug-Id: #21836 --- dlls/winex11.drv/desktop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index d6fa078e8a9..52541bc5422 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -114,9 +114,9 @@ void X11DRV_resize_desktop(void) NtUserSetWindowPos( hwnd, 0, virtual_rect.left, virtual_rect.top, width, height, SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); - if (old_virtual_rect.left != virtual_rect.left || old_virtual_rect.top != virtual_rect.top) - send_message_timeout( HWND_BROADCAST, WM_X11DRV_DESKTOP_RESIZED, old_virtual_rect.left, - old_virtual_rect.top, SMTO_ABORTIFHUNG, 2000, FALSE ); + /* HACK: always send the desktop resize notification, to eventually update fshack on windows */ + send_message_timeout( HWND_BROADCAST, WM_X11DRV_DESKTOP_RESIZED, old_virtual_rect.left, + old_virtual_rect.top, SMTO_ABORTIFHUNG, 2000, FALSE ); old_virtual_rect = virtual_rect; } From af4d289cf7af6afab1135e6bdb3fd420a0b4357a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 13 Feb 2023 14:22:17 +0100 Subject: [PATCH 0234/1506] fshack: winex11: Invalidate swapchains on fshack enable/disable. CW-Bug-Id: #21836 --- dlls/winex11.drv/vulkan.c | 40 +++++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/window.c | 1 + dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 42 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index cf74af5bcc9..0d524bbad36 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -69,6 +69,7 @@ struct wine_vk_surface VkPresentModeKHR present_mode; BOOL gdi_blit_source; /* HACK: gdi blits from the window should work with Vulkan rendered contents. */ BOOL other_process; + BOOL invalidated; Colormap client_colormap; HDC draw_dc; unsigned int width, height; @@ -354,6 +355,18 @@ void sync_vk_surface( HWND hwnd, BOOL known_child ) pthread_mutex_unlock( &vulkan_mutex ); } +void invalidate_vk_surfaces(HWND hwnd) +{ + struct wine_vk_surface *surface; + pthread_mutex_lock(&vulkan_mutex); + LIST_FOR_EACH_ENTRY(surface, &surface_list, struct wine_vk_surface, entry) + { + if (surface->hwnd != hwnd) continue; + surface->invalidated = TRUE; + } + pthread_mutex_unlock(&vulkan_mutex); +} + BOOL wine_vk_direct_window_draw( HWND hwnd ) { struct wine_vk_surface *surface; @@ -453,6 +466,7 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, else if (x11_surface->offscreen && create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR) create_info_host.presentMode = VK_PRESENT_MODE_FIFO_KHR; x11_surface->present_mode = create_info->presentMode; + x11_surface->invalidated = FALSE; if ((result = pvkCreateSwapchainKHR( device, &create_info_host, NULL /* allocator */, swapchain )) == VK_SUCCESS) @@ -1004,6 +1018,9 @@ static VkResult X11DRV_vkAcquireNextImageKHR( VkDevice device, VkSwapchainKHR sw if (fence != orig_fence) pvkDestroyFence( device, fence, NULL ); + if (result == VK_SUCCESS && surface && surface->invalidated) + result = VK_SUBOPTIMAL_KHR; + return result; } @@ -1060,6 +1077,25 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR * } } + if (res == VK_SUCCESS) + { + struct wine_vk_surface *surface; + BOOL invalidated = FALSE; + unsigned int i; + + pthread_mutex_lock(&vulkan_mutex); + for (i = 0; i < present_info->swapchainCount; ++i) + { + if (!XFindContext(gdi_display, (XID)present_info->pSwapchains[i], swapchain_context, (char **)&surface) + && surface->invalidated) + { + invalidated = TRUE; + break; + } + } + pthread_mutex_unlock(&vulkan_mutex); + if (invalidated) res = VK_SUBOPTIMAL_KHR; + } return res; } @@ -1241,6 +1277,10 @@ void sync_vk_surface( HWND hwnd, BOOL known_child ) { } +void invalidate_vk_surfaces(HWND hwnd) +{ +} + void vulkan_thread_detach(void) { } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 019f0c59293..48f0db7fe2f 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2866,6 +2866,7 @@ static void window_update_fshack( struct x11drv_win_data *data, const RECT *wind XMoveResizeWindow( gdi_display, data->client_window, top_left.x, top_left.y, client_rect_host.right, client_rect_host.bottom ); sync_gl_drawable( data->hwnd, !data->whole_window ); + invalidate_vk_surfaces( data->hwnd ); } NtUserEnumChildWindows( data->hwnd, update_child_window_fshack, enable ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 66258be6818..fdf9c77db73 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -664,6 +664,7 @@ extern void destroy_gl_drawable( HWND hwnd ); extern void destroy_vk_surface( HWND hwnd ); extern void sync_vk_surface( HWND hwnd, BOOL known_child ); extern void resize_vk_surfaces( HWND hwnd, Window active, int mask, XWindowChanges *changes ); +extern void invalidate_vk_surfaces( HWND hwnd ); extern void vulkan_thread_detach(void); extern BOOL wine_vk_direct_window_draw( HWND hwnd ); From 401a2a856e39c1b217a48371073b3e6a876d83af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 5 Apr 2023 16:20:42 +0200 Subject: [PATCH 0235/1506] fshack: winex11: Implement _NET_FULLSCREEN_MONITOR support. CW-Bug-Id: #22105 --- dlls/winex11.drv/fs.c | 6 +++++- dlls/winex11.drv/window.c | 3 +++ dlls/winex11.drv/xinerama.c | 10 ++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index 6994e71924a..07bc1ee563c 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -925,10 +925,14 @@ void fs_hack_init(void) struct x11drv_settings_handler settings_handler; struct gdi_gpu *gpus; int count; + RECT rect; real_device_handler = X11DRV_DisplayDevices_GetHandler(); real_settings_handler = X11DRV_Settings_GetHandler(); + rect = get_host_primary_monitor_rect(); + xinerama_init( rect.right - rect.left, rect.bottom - rect.top ); + settings_handler.name = "Fullscreen Hack"; settings_handler.priority = 500; settings_handler.get_id = real_settings_handler.get_id; @@ -946,7 +950,7 @@ void fs_hack_init(void) device_handler.free_gpus = real_device_handler.free_gpus; device_handler.free_adapters = real_device_handler.free_adapters; device_handler.free_monitors = real_device_handler.free_monitors; - device_handler.register_event_handlers = NULL; + device_handler.register_event_handlers = real_device_handler.register_event_handlers; X11DRV_DisplayDevices_SetHandler( &device_handler ); if (!real_device_handler.get_gpus( &gpus, &count, FALSE )) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 48f0db7fe2f..5b6ed8b66d6 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1132,7 +1132,10 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) return; if (!xinerama_get_fullscreen_monitors( &data->whole_rect, monitors )) + { + ERR( "Failed to find xinerama monitors at %s\n", wine_dbgstr_rect(&data->whole_rect) ); return; + } /* If _NET_WM_FULLSCREEN_MONITORS is not set and the fullscreen monitors are spanning only one * monitor then do not set _NET_WM_FULLSCREEN_MONITORS. diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index f0f831cbc1d..456b4c23af8 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -126,7 +126,7 @@ static inline int query_screens(void) /* Get xinerama monitor indices required for _NET_WM_FULLSCREEN_MONITORS */ BOOL xinerama_get_fullscreen_monitors( const RECT *rect, long *indices ) { - RECT window_rect, intersected_rect, monitor_rect; + RECT window_rect, intersected_rect, monitor_rect, virtual; BOOL ret = FALSE; POINT offset; INT i; @@ -140,11 +140,9 @@ BOOL xinerama_get_fullscreen_monitors( const RECT *rect, long *indices ) } /* Convert window rectangle to root coordinates */ - offset = virtual_screen_to_root( rect->left, rect->top ); - window_rect.left = offset.x; - window_rect.top = offset.y; - window_rect.right = window_rect.left + rect->right - rect->left; - window_rect.bottom = window_rect.top + rect->bottom - rect->top; + window_rect = *rect; + virtual = fs_hack_get_real_virtual_screen(); + OffsetRect( &window_rect, -virtual.left, -virtual.top ); /* Compare to xinerama monitor rectangles in root coordinates */ offset.x = INT_MAX; From 1fd6195afc0375ef947b1f47955e3cc51648b0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 7 Apr 2023 10:47:36 +0200 Subject: [PATCH 0236/1506] fshack: winex11: Pass the current HMONITOR to window_update_fshack. As fs_hack_monitor_from_hwnd may use a stale window position, different from the one we get in X11DRV_WindowPosChanging. CW-Bug-Id: #22116 --- dlls/winex11.drv/window.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 5b6ed8b66d6..55d96d85159 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2803,10 +2803,10 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec return TRUE; } -static BOOL CALLBACK update_child_window_fshack( HWND hwnd, LPARAM enable ); +static BOOL CALLBACK update_child_window_fshack( HWND hwnd, LPARAM lparam ); static void window_update_fshack( struct x11drv_win_data *data, const RECT *window_rect_virt, - const RECT *client_rect_virt, BOOL enable ) + const RECT *client_rect_virt, HMONITOR hmonitor, BOOL enable ) { BOOL set_hints = window_rect_virt == NULL; /* don't change hints yet in X11DRV_WindowPosChanging */ RECT window_rect_host, client_rect_host; @@ -2826,8 +2826,7 @@ static void window_update_fshack( struct x11drv_win_data *data, const RECT *wind } else { - HMONITOR monitor = fs_hack_monitor_from_hwnd( data->hwnd ); - window_rect_host = fs_hack_real_mode( monitor ); + window_rect_host = fs_hack_real_mode( hmonitor ); if (data->whole_window) /* HACK: top-level window, pretend client rect covers it fully */ client_rect_host = window_rect_host; @@ -2872,14 +2871,14 @@ static void window_update_fshack( struct x11drv_win_data *data, const RECT *wind invalidate_vk_surfaces( data->hwnd ); } - NtUserEnumChildWindows( data->hwnd, update_child_window_fshack, enable ); + NtUserEnumChildWindows( data->hwnd, update_child_window_fshack, MAKELONG(hmonitor, enable) ); } -static BOOL CALLBACK update_child_window_fshack( HWND hwnd, LPARAM enable ) +static BOOL CALLBACK update_child_window_fshack( HWND hwnd, LPARAM lparam ) { struct x11drv_win_data *data; if (!(data = get_win_data( hwnd ))) return TRUE; - if (data->client_window) window_update_fshack( data, NULL, NULL, enable ); + if (data->client_window) window_update_fshack( data, NULL, NULL, UlongToPtr(LOWORD(lparam)), HIWORD(lparam) ); release_win_data( data ); return TRUE; } @@ -2903,9 +2902,9 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, monitor = fs_hack_monitor_from_rect( window_rect ); if (fs_hack_enabled( monitor ) && fs_hack_matches_current_mode( monitor, window_rect->right - window_rect->left, window_rect->bottom - window_rect->top )) - window_update_fshack( data, window_rect, client_rect, TRUE ); + window_update_fshack( data, window_rect, client_rect, monitor, TRUE ); else - window_update_fshack( data, window_rect, client_rect, FALSE ); + window_update_fshack( data, window_rect, client_rect, monitor, FALSE ); /* check if we need to switch the window to managed */ if (!data->managed && data->whole_window && is_window_managed( hwnd, swp_flags, window_rect )) @@ -3441,7 +3440,7 @@ static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old fs_hack_matches_current_mode( monitor, data->whole_rect.right - data->whole_rect.left, data->whole_rect.bottom - data->whole_rect.top )) { - window_update_fshack( data, NULL, NULL, TRUE ); + window_update_fshack( data, NULL, NULL, monitor, TRUE ); return; } @@ -3466,7 +3465,7 @@ static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old if (!fs_hack_mapping_required( monitor ) || !fs_hack_matches_current_mode( monitor, data->whole_rect.right - data->whole_rect.left, data->whole_rect.bottom - data->whole_rect.top )) - window_update_fshack( data, NULL, NULL, FALSE ); + window_update_fshack( data, NULL, NULL, monitor, FALSE ); } /********************************************************************** From 54b6630ca90a97ce18180f7ef4ef8fbe4d34378f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 21 Feb 2023 10:40:19 -0600 Subject: [PATCH 0237/1506] fshack: winex11: Use hwnd from surface in X11DRV_query_fs_hack(). CW-Bug-Id: #21902 --- dlls/winex11.drv/vulkan.c | 7 +++++-- dlls/winex11.drv/window.c | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 0d524bbad36..412b712f78d 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -1118,9 +1118,12 @@ static VkBool32 X11DRV_query_fs_hack( VkSurfaceKHR surface, VkExtent2D *real_sz, if (wm_is_steamcompmgr( gdi_display )) return VK_FALSE; if (x11_surface->other_process) return VK_FALSE; - if (XFindContext( gdi_display, x11_surface->window, winContext, (char **)&hwnd ) != 0) + if (x11_surface->other_process) + return VK_FALSE; + + if (!(hwnd = x11_surface->hwnd)) { - ERR( "Failed to find hwnd context\n" ); + TRACE("No window.\n"); return VK_FALSE; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 55d96d85159..e4fb4682daa 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1870,9 +1870,6 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo attach_client_window( data, client_window ); XMapWindow( gdi_display, data->client_window ); - /* Save to gdi_display as well for fullscreen hack, needed in X11DRV_query_fs_hack() */ - XSaveContext( gdi_display, data->client_window, winContext, (char *)data->hwnd ); - TRACE( "%p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); } From f220f2f18cf9ad3f51f9dca4ee454e859dc55d56 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 17 May 2023 15:42:34 -0600 Subject: [PATCH 0238/1506] fshack: winex11: Use linear colour internal format for GL fshack buffer. CW-Bug-Id: #22260 --- dlls/winex11.drv/opengl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index bb327e710ee..81c817c036d 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2103,7 +2103,7 @@ static void fs_hack_get_attachments_config( struct gl_drawable *gl, struct fs_ha if (attribs->red_size != 8 || attribs->green_size != 8 || attribs->blue_size != 8) FIXME( "Unsupported RGBA color sizes {%u, %u, %u, %u}.\n", attribs->red_size, attribs->green_size, attribs->blue_size, attribs->alpha_size ); - config->color_internalformat = attribs->alpha_size ? GL_SRGB8_ALPHA8 : GL_SRGB8; + config->color_internalformat = attribs->alpha_size ? GL_RGBA8 : GL_RGB8; config->color_format = GL_BGRA; config->color_type = GL_UNSIGNED_INT_8_8_8_8_REV; if (attribs->depth_size || attribs->stencil_size) @@ -2763,7 +2763,7 @@ static void fs_hack_handle_shaders( int mode, struct gl_drawable *gl, struct wgl fs_hack_handle_enable_switch( mode, GL_FRAGMENT_PROGRAM_ARB, &state->arb_frag, FALSE ); if (gl->has_vertex_program) fs_hack_handle_enable_switch( mode, GL_VERTEX_PROGRAM_ARB, &state->arb_vert, FALSE ); - fs_hack_handle_enable_switch( mode, GL_FRAMEBUFFER_SRGB, &state->fb_srgb, TRUE ); + fs_hack_handle_enable_switch( mode, GL_FRAMEBUFFER_SRGB, &state->fb_srgb, FALSE ); if (gl->has_ati_frag_shader) fs_hack_handle_enable_switch( mode, GL_FRAGMENT_SHADER_ATI, &state->ati_frag, FALSE ); From eb757df0e7d8f70aae438cf1fd3a1dae66a01349 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 23 May 2023 14:41:14 -0600 Subject: [PATCH 0239/1506] fshack: winex11: Add optional extra display mode. CW-Bug-Id: #22285 --- dlls/winex11.drv/fs.c | 69 ++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index 07bc1ee563c..b8bd63ab3cc 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -42,29 +42,35 @@ static struct x11drv_settings_handler real_settings_handler; static BOOL initialized; /* A table of resolutions some games expect but host system may not report */ -static SIZE fs_monitor_sizes[] = -{ - {640, 480}, /* 4:3 */ - {800, 600}, /* 4:3 */ - {1024, 768}, /* 4:3 */ - {1600, 1200}, /* 4:3 */ - {960, 540}, /* 16:9 */ - {1280, 720}, /* 16:9 */ - {1600, 900}, /* 16:9 */ - {1920, 1080}, /* 16:9 */ - {2560, 1440}, /* 16:9 */ - {2880, 1620}, /* 16:9 */ - {3200, 1800}, /* 16:9 */ - {1440, 900}, /* 8:5 */ - {1680, 1050}, /* 8:5 */ - {1920, 1200}, /* 8:5 */ - {2560, 1600}, /* 8:5 */ - {1440, 960}, /* 3:2 */ - {1920, 1280}, /* 3:2 */ - {2560, 1080}, /* 21:9 ultra-wide */ - {1920, 800}, /* 12:5 */ - {3840, 1600}, /* 12:5 */ - {1280, 1024}, /* 5:4 */ +static const struct +{ + SIZE size; + BOOL additional; +} +fs_monitor_sizes[] = +{ + {{640, 480}}, /* 4:3 */ + {{800, 600}}, /* 4:3 */ + {{1024, 768}}, /* 4:3 */ + {{1600, 1200}}, /* 4:3 */ + {{960, 540}}, /* 16:9 */ + {{1280, 720}}, /* 16:9 */ + {{1600, 900}}, /* 16:9 */ + {{1920, 1080}}, /* 16:9 */ + {{2560, 1440}}, /* 16:9 */ + {{2880, 1620}}, /* 16:9 */ + {{3200, 1800}}, /* 16:9 */ + {{1440, 900}}, /* 8:5 */ + {{1680, 1050}}, /* 8:5 */ + {{1920, 1200}}, /* 8:5 */ + {{2560, 1600}}, /* 8:5 */ + {{1440, 960}}, /* 3:2 */ + {{1920, 1280}}, /* 3:2 */ + {{2560, 1080}}, /* 21:9 ultra-wide */ + {{1920, 800}}, /* 12:5 */ + {{3840, 1600}}, /* 12:5 */ + {{1280, 1024}}, /* 5:4 */ + {{1280, 768}, TRUE }, }; /* A fake monitor for the fullscreen hack */ @@ -277,6 +283,8 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN { UINT i, j, max_count, real_mode_count, resolutions = 0; DEVMODEW *real_modes, *real_mode, mode_host = {0}; + BOOL additional_modes = FALSE; + const char *env; *mode_count = 0; *modes = NULL; @@ -295,21 +303,28 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN /* Add the current mode early, in case we have to limit */ modes_append( *modes, mode_count, &resolutions, &mode_host ); + if ((env = getenv( "WINE_ADDITIONAL_DISPLAY_MODES" ))) + additional_modes = (env[0] != '0'); + else if ((env = getenv( "SteamAppId" ))) + additional_modes = !strcmp( env, "979400" ); + /* Linux reports far fewer resolutions than Windows. Add modes that some games may expect. */ for (i = 0; i < ARRAY_SIZE(fs_monitor_sizes); ++i) { DEVMODEW mode = mode_host; + if (!additional_modes && fs_monitor_sizes[i].additional) continue; + if (mode_host.dmDisplayOrientation == DMDO_DEFAULT || mode_host.dmDisplayOrientation == DMDO_180) { - mode.dmPelsWidth = fs_monitor_sizes[i].cx; - mode.dmPelsHeight = fs_monitor_sizes[i].cy; + mode.dmPelsWidth = fs_monitor_sizes[i].size.cx; + mode.dmPelsHeight = fs_monitor_sizes[i].size.cy; } else { - mode.dmPelsWidth = fs_monitor_sizes[i].cy; - mode.dmPelsHeight = fs_monitor_sizes[i].cx; + mode.dmPelsWidth = fs_monitor_sizes[i].size.cy; + mode.dmPelsHeight = fs_monitor_sizes[i].size.cx; } /* Don't report modes that are larger than the current mode */ From 8a51f32dbab68d0cc376f2d2de2e4d43805b5e62 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 9 Jun 2023 18:40:56 +0800 Subject: [PATCH 0240/1506] fshack: winex11: Use width and height to check if the current mode is a landscape mode. Check the ratio of dmPelsWidth to dmPelsHeight to determine whether the host is currently in portrait or landscape orientation. DMDO_DEFAULT is the natural orientation of the device, which isn't necessarily a landscape mode. CW-Bug-Id: #21774 --- dlls/winex11.drv/fs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index b8bd63ab3cc..b28cc9482f3 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -283,7 +283,7 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN { UINT i, j, max_count, real_mode_count, resolutions = 0; DEVMODEW *real_modes, *real_mode, mode_host = {0}; - BOOL additional_modes = FALSE; + BOOL additional_modes = FALSE, landscape; const char *env; *mode_count = 0; @@ -300,6 +300,11 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN return; } + /* Check the ratio of dmPelsWidth to dmPelsHeight to determine whether the host is currently in + * portrait or landscape orientation. DMDO_DEFAULT is the natural orientation of the device, + * which isn't necessarily a landscape mode */ + landscape = mode_host.dmPelsWidth >= mode_host.dmPelsHeight; + /* Add the current mode early, in case we have to limit */ modes_append( *modes, mode_count, &resolutions, &mode_host ); @@ -315,8 +320,7 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN if (!additional_modes && fs_monitor_sizes[i].additional) continue; - if (mode_host.dmDisplayOrientation == DMDO_DEFAULT || - mode_host.dmDisplayOrientation == DMDO_180) + if (landscape) { mode.dmPelsWidth = fs_monitor_sizes[i].size.cx; mode.dmPelsHeight = fs_monitor_sizes[i].size.cy; From be6c10744033a706e53623181807b08e30044e0f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 17 Aug 2023 19:28:17 -0600 Subject: [PATCH 0241/1506] fshack: winex11: Sync GL drawable outside of win data lock in X11DRV_WindowPosChanged(). CW-Bug-Id: #22608 --- dlls/winex11.drv/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e4fb4682daa..3e12c8402bc 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3046,7 +3046,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, return; } - if (data->fs_hack) sync_gl_drawable( hwnd, FALSE ); + if (data->fs_hack) needs_resize = TRUE; /* check if we are currently processing an event relevant to this window */ event_type = 0; From 40da3b260922947bf55efccfe2dae2ffae0188bd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 17 Aug 2023 19:22:27 -0600 Subject: [PATCH 0242/1506] fshack: winex11: Support fshack on offscreen drawables. CW-Bug-Id: #22608 --- dlls/winex11.drv/opengl.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 81c817c036d..4a5e0ba2b5f 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1533,9 +1533,11 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); pXCompositeRedirectWindow( gdi_display, gl->window, CompositeRedirectManual ); } - if (gl->layered_type && (data = get_win_data( hwnd ))) + if ((data = get_win_data( hwnd ))) { - detach_client_window( data, data->client_window, TRUE ); + gl->fs_hack = data->fs_hack || fs_hack_get_gamma_ramp( NULL ); + if (gl->fs_hack) TRACE( "Window %p has the fullscreen hack enabled\n", hwnd ); + if (gl->layered_type) detach_client_window( data, data->client_window, TRUE ); release_win_data( data ); } TRACE( "%p created child %lx drawable %lx\n", hwnd, gl->window, gl->drawable ); @@ -2990,11 +2992,20 @@ static void fs_hack_blit_framebuffer( struct gl_drawable *gl, GLenum draw_buffer src.cy = user_rect.bottom - user_rect.top; real.cx = real_rect.right - real_rect.left; real.cy = real_rect.bottom - real_rect.top; - scaled_origin.x = user_rect.left; - scaled_origin.y = user_rect.top; - fs_hack_point_user_to_real( &scaled_origin ); - scaled_origin.x -= real_rect.left; - scaled_origin.y -= real_rect.top; + if (gl->type != DC_GL_CHILD_WIN) + { + scaled_origin.x = user_rect.left; + scaled_origin.y = user_rect.top; + fs_hack_point_user_to_real( &scaled_origin ); + scaled_origin.x -= real_rect.left; + scaled_origin.y -= real_rect.top; + } + else + { + /* ExtEscape performs the fshack offset. */ + scaled_origin.x = 0; + scaled_origin.y = 0; + } gamma_ramp = fs_hack_get_gamma_ramp( &gamma_serial ); @@ -4707,12 +4718,6 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) if (gl->type == DC_GL_CHILD_WIN && !gl->layered_type) escape.drawable = gl->window; /* fall through */ default: - if ((escape.drawable || gl->layered_type) && pglXSwapBuffersMscOML) - { - pglFlush(); - target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); - break; - } if (gl->fs_hack) { ctx->fs_hack = gl->fs_hack; @@ -4725,6 +4730,12 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) ctx->fs_hack = FALSE; fs_hack_setup_context( ctx, gl ); } + if ((escape.drawable || gl->layered_type) && pglXSwapBuffersMscOML) + { + pglFlush(); + target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); + break; + } pglXSwapBuffers(gdi_display, gl->drawable); break; } From f87a852557b370618ede08bacc9b2259992845ba Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 17 Aug 2023 14:36:39 -0600 Subject: [PATCH 0243/1506] fshack: winex11: Always blit fs_hack in wglFlush and wglFinish when drawing to front buffer. CW-Bug-Id: #22608 --- dlls/winex11.drv/opengl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 4a5e0ba2b5f..9359b2ac2f1 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -219,6 +219,7 @@ struct wgl_context GLuint fs_hack_gamma_pgm, ramp_ubo; POINT setup_for; GLuint current_draw_fbo, current_read_fbo; + BOOL drawing_to_front; struct list entry; }; @@ -2663,6 +2664,9 @@ static void wglDrawBuffer( GLenum buffer ) { struct wgl_context *ctx = NtCurrentTeb()->glContext; + TRACE( "buffer %#x.\n", buffer ); + + ctx->drawing_to_front = (buffer == GL_FRONT); if (ctx->fs_hack && ctx->current_draw_fbo == ctx->fs_hack_fbo) { TRACE( "Overriding %#x with GL_COLOR_ATTACHMENT0\n", buffer ); @@ -3289,7 +3293,7 @@ static void wglFinish(void) { ctx->fs_hack = gl->fs_hack; if (!gl->fs_hack_context_set_up) fs_hack_setup_context( ctx, gl ); - if (!gl->fs_hack_did_swapbuf) fs_hack_blit_framebuffer( gl, GL_FRONT ); + if (!gl->fs_hack_did_swapbuf || ctx->drawing_to_front) fs_hack_blit_framebuffer( gl, GL_FRONT ); } else if (gl->fs_hack_context_set_up) { @@ -3331,7 +3335,7 @@ static void wglFlush(void) { ctx->fs_hack = gl->fs_hack; if (!gl->fs_hack_context_set_up) fs_hack_setup_context( ctx, gl ); - if (!gl->fs_hack_did_swapbuf) fs_hack_blit_framebuffer( gl, GL_FRONT ); + if (!gl->fs_hack_did_swapbuf || ctx->drawing_to_front) fs_hack_blit_framebuffer( gl, GL_FRONT ); } else if (gl->fs_hack_context_set_up) { From d2b4c069dcc6b5b2ecfa6122252d87c7c6f5e21e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 May 2023 23:02:58 +0300 Subject: [PATCH 0244/1506] fshack: winex11: Resolve fbo for glCopyTexSubImage2D. Based on a patch by Illia Polishchuk from https://github.com/ValveSoftware/wine/pull/189 GL_INVALID_OPERATION is generated if: the effective value of GL_SAMPLE_BUFFERS for the read framebuffer is one. CW-Bug-Id: #22662 --- dlls/winex11.drv/opengl.c | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 9359b2ac2f1..6d8627c70c7 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -220,6 +220,7 @@ struct wgl_context POINT setup_for; GLuint current_draw_fbo, current_read_fbo; BOOL drawing_to_front; + BOOL fs_hack_needs_resolve; struct list entry; }; @@ -477,11 +478,13 @@ static void (*pglUseProgram)( GLuint program ); static void (*pglViewportIndexedf)( GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h ); static void (*pglViewportIndexedfv)( GLuint index, const GLfloat *v ); static void (*pglGetFramebufferAttachmentParameteriv)( GLenum target, GLenum attachment, GLenum pname, GLint *params ); +static void (*pglCopyTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); static void wglBindFramebuffer( GLenum target, GLuint framebuffer ); static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ); static void wglDrawBuffer( GLenum buffer ); static void wglReadBuffer( GLenum src ); static void wglFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ); +static void wglCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); /* check if the extension is present in the list */ static BOOL has_extension( const char *list, const char *ext ) @@ -663,6 +666,7 @@ static void init_opengl(void) REDIRECT( glFlush ); REDIRECT( glGetString ); REDIRECT( glReadBuffer ); + REDIRECT( glCopyTexSubImage2D ); #undef REDIRECT pglXGetProcAddressARB = dlsym(opengl_handle, "glXGetProcAddressARB"); @@ -2533,6 +2537,7 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * gl->has_vertex_program = !ctx->is_core && has_extension( glExtensions, "GL_ARB_vertex_program" ); ctx->fs_hack_integer = fs_hack_is_integer(); + ctx->fs_hack_needs_resolve = gl->fs_hack_needs_resolve; gl->fs_hack_context_set_up = TRUE; } else @@ -2687,6 +2692,49 @@ static void wglReadBuffer( GLenum buffer ) pglReadBuffer( buffer ); } +static BOOL resolve_fs_hack_fbo( GLuint *old_read_fbo ) +{ + struct wgl_context *ctx = NtCurrentTeb()->glContext; + GLuint old_draw_fbo; + unsigned int cx, cy; + RECT user_rect; + HWND hwnd; + + if (!ctx || !ctx->fs_hack || !ctx->fs_hack_needs_resolve) return FALSE; + if (!ctx->fs_hack_needs_resolve) return FALSE; + if (ctx->current_read_fbo != ctx->fs_hack_fbo) return FALSE; + if (!(hwnd = NtUserWindowFromDC( ctx->hdc ))) return FALSE; + + NtUserGetClientRect( hwnd, &user_rect ); + cx = user_rect.right - user_rect.left; + cy = user_rect.bottom - user_rect.top; + + TRACE( "resolving fbo, %ux%u.\n", cx, cy ); + + opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)old_read_fbo ); + opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&old_draw_fbo ); + + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); + pglBlitFramebuffer( 0, 0, cx, cy, 0, 0, cx, cy, GL_COLOR_BUFFER_BIT, GL_NEAREST ); + pglBindFramebuffer( GL_READ_FRAMEBUFFER, ctx->fs_hack_resolve_fbo ); + pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, old_draw_fbo ); + + return TRUE; +} + +static void wglCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) +{ + GLuint old_read_fbo; + BOOL restore; + + TRACE( "target %#x, level %d, offset %dx%d, origin %dx%d, size %dx%d.\n", + target, level, xoffset, yoffset, x, y, width, height ); + + restore = resolve_fs_hack_fbo( &old_read_fbo ); + pglCopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height ); + if (restore) pglBindFramebuffer( GL_READ_FRAMEBUFFER, old_read_fbo ); +} + struct fs_hack_gl_state { GLuint draw_fbo; From ce5a43564ff6ce3baea1a795a5764334b122b61d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 28 Aug 2023 18:10:10 -0600 Subject: [PATCH 0245/1506] fshack: winex11: Resolve fbo for glCopyTexImage2D. CW-Bug-Id: #22662 --- dlls/winex11.drv/opengl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 6d8627c70c7..5e76628a16e 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -478,12 +478,14 @@ static void (*pglUseProgram)( GLuint program ); static void (*pglViewportIndexedf)( GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h ); static void (*pglViewportIndexedfv)( GLuint index, const GLfloat *v ); static void (*pglGetFramebufferAttachmentParameteriv)( GLenum target, GLenum attachment, GLenum pname, GLint *params ); +static void (*pglCopyTexImage2D)( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); static void (*pglCopyTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); static void wglBindFramebuffer( GLenum target, GLuint framebuffer ); static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ); static void wglDrawBuffer( GLenum buffer ); static void wglReadBuffer( GLenum src ); static void wglFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ); +static void wglCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); static void wglCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); /* check if the extension is present in the list */ @@ -667,6 +669,7 @@ static void init_opengl(void) REDIRECT( glGetString ); REDIRECT( glReadBuffer ); REDIRECT( glCopyTexSubImage2D ); + REDIRECT( glCopyTexImage2D ); #undef REDIRECT pglXGetProcAddressARB = dlsym(opengl_handle, "glXGetProcAddressARB"); @@ -2735,6 +2738,19 @@ static void wglCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLi if (restore) pglBindFramebuffer( GL_READ_FRAMEBUFFER, old_read_fbo ); } +static void wglCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) +{ + GLuint old_read_fbo; + BOOL restore; + + TRACE( "target %#x, level %d, internalformat %#x, origin %dx%d, size %dx%d, border %d.\n", + target, level, internalformat, x, y, width, height, border ); + + restore = resolve_fs_hack_fbo( &old_read_fbo ); + pglCopyTexImage2D( target, level, internalformat, x, y, width, height, border ); + if (restore) pglBindFramebuffer( GL_READ_FRAMEBUFFER, old_read_fbo ); +} + struct fs_hack_gl_state { GLuint draw_fbo; From 07ae462ac4e36b76d7f38268e100ba871ec2f4e2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 28 Aug 2023 18:19:47 -0600 Subject: [PATCH 0246/1506] fshack: winex11: Resolve fbo for glReadPixels. CW-Bug-Id: #22662 --- dlls/winex11.drv/opengl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 5e76628a16e..93b79d914a8 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -480,6 +480,7 @@ static void (*pglViewportIndexedfv)( GLuint index, const GLfloat *v ); static void (*pglGetFramebufferAttachmentParameteriv)( GLenum target, GLenum attachment, GLenum pname, GLint *params ); static void (*pglCopyTexImage2D)( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); static void (*pglCopyTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +static void (*pglReadPixels)( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * data); static void wglBindFramebuffer( GLenum target, GLuint framebuffer ); static void wglBindFramebufferEXT( GLenum target, GLuint framebuffer ); static void wglDrawBuffer( GLenum buffer ); @@ -487,6 +488,7 @@ static void wglReadBuffer( GLenum src ); static void wglFramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ); static void wglCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); static void wglCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); +static void wglReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * data); /* check if the extension is present in the list */ static BOOL has_extension( const char *list, const char *ext ) @@ -670,6 +672,7 @@ static void init_opengl(void) REDIRECT( glReadBuffer ); REDIRECT( glCopyTexSubImage2D ); REDIRECT( glCopyTexImage2D ); + REDIRECT( glReadPixels ); #undef REDIRECT pglXGetProcAddressARB = dlsym(opengl_handle, "glXGetProcAddressARB"); @@ -2751,6 +2754,18 @@ static void wglCopyTexImage2D( GLenum target, GLint level, GLenum internalformat if (restore) pglBindFramebuffer( GL_READ_FRAMEBUFFER, old_read_fbo ); } +static void wglReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * data) +{ + GLuint old_read_fbo; + BOOL restore; + + TRACE( "origin %dx%d, size %dx%d, format %#x, type %#x, data %p.\n", x, y, width, height, format, type, data ); + + restore = resolve_fs_hack_fbo( &old_read_fbo ); + pglReadPixels( x, y, width, height, format, type, data ); + if (restore) pglBindFramebuffer( GL_READ_FRAMEBUFFER, old_read_fbo ); +} + struct fs_hack_gl_state { GLuint draw_fbo; From d63f6426428318ba92cdd1e2241e4b97ce8b5949 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 31 Oct 2023 17:55:00 -0600 Subject: [PATCH 0247/1506] fshack: winex11: Add optional centered low res modes. CW-Bug-Id: #22802 --- dlls/winex11.drv/fs.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index b28cc9482f3..d48ee26bfb5 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -257,6 +257,8 @@ static void modes_append( DEVMODEW *modes, UINT *mode_count, UINT *resolutions, if (modes[i].dmBitsPerPel != mode->dmBitsPerPel) continue; if (modes[i].dmDisplayFrequency != mode->dmDisplayFrequency) continue; if (modes[i].dmDisplayOrientation != mode->dmDisplayOrientation) continue; + if ((mode->dmFields & DM_DISPLAYFIXEDOUTPUT) != (modes[i].dmFields & DM_DISPLAYFIXEDOUTPUT)) continue; + if (mode->dmFields & DM_DISPLAYFIXEDOUTPUT && modes[i].dmDisplayFixedOutput != mode->dmDisplayFixedOutput) continue; return; /* The exact mode is already added, nothing to do */ } @@ -268,7 +270,7 @@ static void modes_append( DEVMODEW *modes, UINT *mode_count, UINT *resolutions, } mode->dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | - DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY; + DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY | (mode->dmFields & DM_DISPLAYFIXEDOUTPUT); mode->dmSize = sizeof(DEVMODEW); mode->dmDriverExtra = 0; mode->dmDisplayFlags = 0; @@ -283,7 +285,7 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN { UINT i, j, max_count, real_mode_count, resolutions = 0; DEVMODEW *real_modes, *real_mode, mode_host = {0}; - BOOL additional_modes = FALSE, landscape; + BOOL additional_modes = FALSE, center_modes = FALSE, landscape; const char *env; *mode_count = 0; @@ -293,7 +295,14 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN /* Fullscreen hack doesn't support changing display orientations */ if (!real_settings_handler.get_modes( monitor->settings_id, 0, &real_modes, &real_mode_count )) return; + if ((env = getenv( "WINE_CENTER_DISPLAY_MODES" ))) + center_modes = (env[0] != '0'); + else if ((env = getenv( "SteamAppId" ))) + center_modes = !strcmp( env, "359870" ); + max_count = ARRAY_SIZE(fs_monitor_sizes) * DEPTH_COUNT + real_mode_count; + if (center_modes) max_count += ARRAY_SIZE(fs_monitor_sizes) + real_mode_count; + if (!(*modes = calloc( max_count, sizeof(DEVMODEW) ))) { real_settings_handler.free_modes( real_modes ); @@ -341,6 +350,13 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN mode.dmDisplayFrequency = 60; modes_append( *modes, mode_count, &resolutions, &mode ); } + + if (center_modes && mode.dmPelsWidth != mode_host.dmPelsWidth && mode.dmPelsHeight != mode_host.dmPelsHeight) + { + mode.dmFields |= DM_DISPLAYFIXEDOUTPUT; + mode.dmDisplayFixedOutput = DMDFO_CENTER; + modes_append( *modes, mode_count, &resolutions, &mode ); + } } for (i = 0, real_mode = real_modes; i < real_mode_count; ++i) @@ -349,8 +365,17 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN /* Don't report modes that are larger than the current mode */ if (mode.dmPelsWidth <= mode_host.dmPelsWidth && mode.dmPelsHeight <= mode_host.dmPelsHeight) + { modes_append( *modes, mode_count, &resolutions, &mode ); + if (center_modes && mode.dmPelsWidth != mode_host.dmPelsWidth && mode.dmPelsHeight != mode_host.dmPelsHeight) + { + mode.dmFields |= DM_DISPLAYFIXEDOUTPUT; + mode.dmDisplayFixedOutput = DMDFO_CENTER; + modes_append( *modes, mode_count, &resolutions, &mode ); + } + } + real_mode = NEXT_DEVMODEW(real_mode); } From 92d0d43260a0a1b1e04df9ccb371974722b270ff Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Sat, 4 Nov 2023 16:09:02 +0800 Subject: [PATCH 0248/1506] fshack: winex11: Use fs_hack_monitor_from_rect() in X11DRV_ShowWindow(). fs_hack_monitor_from_hwnd() returns the primary monitor when the window is minimized. So a fullscreen window on the secondary monitor that later gets minimized may be moved to the primary monitor when fs_hack_monitor_from_hwnd() returns the primary monitor. Instead, we should use fs_hack_monitor_from_rect() and use the updated window rectangle to retrieve the monitor a window should be fullscreen on. fs_hack_monitor_from_hwnd() should only be used when not expecting window position changes. --- dlls/winex11.drv/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 3e12c8402bc..728ce2da84f 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3174,7 +3174,7 @@ UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) &root, &x, &y, &width, &height, &border, &depth ); XTranslateCoordinates( thread_data->display, data->whole_window, root, 0, 0, &x, &y, &top ); pos = root_to_virtual_screen( x, y ); - monitor = fs_hack_monitor_from_hwnd( hwnd ); + monitor = fs_hack_monitor_from_rect( rect ); if (data->fs_hack || (fs_hack_enabled( monitor ) && fs_hack_matches_current_mode( monitor, rect->right - rect->left, rect->bottom - rect->top ))) From 533169f5ab8ea1cb8cf4b02d0f4860f8d5fe49ef Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 23 Jul 2021 13:46:32 -0400 Subject: [PATCH 0249/1506] user32: Raise EVENT_OBJECT_FOCUS WinEvent when window receives focus. Signed-off-by: Connor McAdams CW-Bug-Id: #18351 --- dlls/win32u/input.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 3ee46f0bfcf..1666e24e09b 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1813,7 +1813,7 @@ BOOL release_capture(void) * * Change the focus window, sending the WM_SETFOCUS and WM_KILLFOCUS messages */ -static HWND set_focus_window( HWND hwnd ) +static HWND set_focus_window( HWND hwnd, BOOL from_active ) { HWND previous = 0, ime_hwnd; BOOL ret; @@ -1830,6 +1830,9 @@ static HWND set_focus_window( HWND hwnd ) if (previous) { + if (!NtUserIsWindow(hwnd) && !from_active) + NtUserNotifyWinEvent( EVENT_OBJECT_FOCUS, previous, OBJID_CLIENT, CHILDID_SELF ); + send_message( previous, WM_KILLFOCUS, (WPARAM)hwnd, 0 ); ime_hwnd = get_default_ime_window( previous ); @@ -1842,6 +1845,8 @@ static HWND set_focus_window( HWND hwnd ) if (is_window(hwnd)) { user_driver->pSetFocus(hwnd); + if (!from_active) + NtUserNotifyWinEvent( EVENT_OBJECT_FOCUS, hwnd, OBJID_CLIENT, CHILDID_SELF ); ime_hwnd = get_default_ime_window( hwnd ); if (ime_hwnd) @@ -1954,7 +1959,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) if (hwnd == info.hwndActive) { if (!info.hwndFocus || !hwnd || NtUserGetAncestor( info.hwndFocus, GA_ROOT ) != hwnd) - set_focus_window( hwnd ); + set_focus_window( hwnd, TRUE ); } } @@ -2048,7 +2053,7 @@ HWND WINAPI NtUserSetFocus( HWND hwnd ) } /* change focus and send messages */ - return set_focus_window( hwnd ); + return set_focus_window( hwnd, FALSE ); } /******************************************************************* From e750c17b8a540320989bf890596361d427b8c788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 18:21:29 +0100 Subject: [PATCH 0250/1506] user32: Prevent a recursive loop with the activation messages. When activating a window and sending activation messages to the window procedure, Windows avoids a recursive loop by not sending more of these messages or hooks while it's still activating the window. CW-Bug-Id: #19612 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46274 Wine-Staging: user32-recursive-activation --- dlls/win32u/input.c | 16 +++++++++++----- dlls/win32u/ntuser_private.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 1666e24e09b..7ef4ab5a88a 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1867,7 +1867,7 @@ static HWND set_focus_window( HWND hwnd, BOOL from_active ) static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) { HWND previous = get_active_window(); - BOOL ret; + BOOL ret = FALSE; DWORD old_thread, new_thread; CBTACTIVATESTRUCT cbt; @@ -1877,6 +1877,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) goto done; } + if (prev) *prev = previous; + if (win_set_flags( hwnd, WIN_IS_ACTIVATING, 0 ) & WIN_IS_ACTIVATING) return TRUE; + /* call CBT hook chain */ cbt.fMouse = mouse; cbt.hWndActive = previous; @@ -1896,7 +1899,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) previous = wine_server_ptr_handle( reply->previous ); } SERVER_END_REQ; - if (!ret) return FALSE; + if (!ret) goto done; if (prev) *prev = previous; if (previous == hwnd) goto done; @@ -1906,7 +1909,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) if (send_message( hwnd, WM_QUERYNEWPALETTE, 0, 0 )) send_message_timeout( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0, SMTO_ABORTIFHUNG, 2000, FALSE ); - if (!is_window(hwnd)) return FALSE; + if (!(ret = is_window(hwnd))) goto done; } old_thread = previous ? get_window_thread( previous, NULL ) : 0; @@ -1940,7 +1943,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) if (is_window(hwnd)) { - send_message( hwnd, WM_NCACTIVATE, hwnd == NtUserGetForegroundWindow(), (LPARAM)previous ); + send_message( hwnd, WM_NCACTIVATE, + (hwnd == NtUserGetForegroundWindow()) && !(win_get_flags(previous) & WIN_IS_ACTIVATING), + (LPARAM)previous ); send_message( hwnd, WM_ACTIVATE, MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, is_iconic(hwnd) ), (LPARAM)previous ); @@ -1964,8 +1969,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) } done: + win_set_flags( hwnd, 0, WIN_IS_ACTIVATING ); if (hwnd) clip_fullscreen_window( hwnd, FALSE ); - return TRUE; + return ret; } /********************************************************************** diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 11bb7f4baf6..2297af8bdd6 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -104,6 +104,7 @@ typedef struct tagWND #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */ #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */ #define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */ +#define WIN_IS_ACTIVATING 0x0100 /* the window is being activated */ #define WND_OTHER_PROCESS ((WND *)1) /* returned by get_win_ptr on unknown window handles */ #define WND_DESKTOP ((WND *)2) /* returned by get_win_ptr on the desktop window */ From 79d556b2d71bb68d53a2277b0f399c6c82fc38e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 18:23:08 +0100 Subject: [PATCH 0251/1506] user32: Use PostMessageW in set_foreground_window. Instead of SendNotifyMessageW for WM_WINE_SETACTIVEWINDOW. CW-Bug-Id: #19612 --- dlls/win32u/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 7ef4ab5a88a..f3451dcd57b 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2087,14 +2087,12 @@ BOOL set_foreground_window( HWND hwnd, BOOL mouse ) if (ret && previous != hwnd) { if (send_msg_old) /* old window belongs to other thread */ - NtUserMessageCall( previous, WM_WINE_SETACTIVEWINDOW, 0, 0, - 0, NtUserSendNotifyMessage, FALSE ); + NtUserPostMessage( previous, WM_WINE_SETACTIVEWINDOW, 0, 0 ); else if (send_msg_new) /* old window belongs to us but new one to other thread */ ret = set_active_window( 0, NULL, mouse, TRUE ); if (send_msg_new) /* new window belongs to other thread */ - NtUserMessageCall( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, 0, - 0, NtUserSendNotifyMessage, FALSE ); + NtUserPostMessage( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, 0 ); else /* new window belongs to us */ ret = set_active_window( hwnd, NULL, mouse, TRUE ); } From 887e52bcc9a969edac3adf27e1c99d98d7a9ac95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 18:24:02 +0100 Subject: [PATCH 0252/1506] user32: Do not deactivate if thread is foreground. Instead of only checking that the window is foreground. CW-Bug-Id: #19612 --- dlls/win32u/message.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 91f836a60bd..0b4b2f6b7ba 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2102,7 +2102,8 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR if (is_desktop_window( hwnd )) return 0; return set_window_style( hwnd, wparam, lparam ); case WM_WINE_SETACTIVEWINDOW: - if (!wparam && NtUserGetForegroundWindow() == hwnd) return 0; + if (!wparam && NtUserGetWindowThread( NtUserGetForegroundWindow(), NULL ) == GetCurrentThreadId()) + return 0; return (LRESULT)NtUserSetActiveWindow( (HWND)wparam ); case WM_WINE_KEYBOARD_LL_HOOK: case WM_WINE_MOUSE_LL_HOOK: From a445d35ced5c05b586f4e0f5c821926502cb2440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 18:24:57 +0100 Subject: [PATCH 0253/1506] user32: Send WM_NCACTIVATE on SetForegroundWindow call. When window is already active but has lost foreground, as shown by concurrent SetForegroundWindow tests. CW-Bug-Id: #19612 --- dlls/win32u/input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index f3451dcd57b..0336fb3da75 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2091,6 +2091,10 @@ BOOL set_foreground_window( HWND hwnd, BOOL mouse ) else if (send_msg_new) /* old window belongs to us but new one to other thread */ ret = set_active_window( 0, NULL, mouse, TRUE ); + /* already active, set_active_window will do no nothing */ + if (!send_msg_new && hwnd == get_active_window()) + send_message( hwnd, WM_NCACTIVATE, TRUE, (LPARAM)hwnd ); + if (send_msg_new) /* new window belongs to other thread */ NtUserPostMessage( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, 0 ); else /* new window belongs to us */ From 5061238d3fc06777be2e0b107f86f0f410231082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 18:25:44 +0100 Subject: [PATCH 0254/1506] user32: Send WM_*FOCUS messages even if already focused. CW-Bug-Id: #19612 --- dlls/win32u/input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 0336fb3da75..19ff4c74978 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1813,7 +1813,7 @@ BOOL release_capture(void) * * Change the focus window, sending the WM_SETFOCUS and WM_KILLFOCUS messages */ -static HWND set_focus_window( HWND hwnd, BOOL from_active ) +static HWND set_focus_window( HWND hwnd, BOOL from_active, BOOL force ) { HWND previous = 0, ime_hwnd; BOOL ret; @@ -1827,6 +1827,7 @@ static HWND set_focus_window( HWND hwnd, BOOL from_active ) SERVER_END_REQ; if (!ret) return 0; if (previous == hwnd) return previous; + if (!force && hwnd == previous) return previous; if (previous) { @@ -1964,7 +1965,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) if (hwnd == info.hwndActive) { if (!info.hwndFocus || !hwnd || NtUserGetAncestor( info.hwndFocus, GA_ROOT ) != hwnd) - set_focus_window( hwnd, TRUE ); + set_focus_window( hwnd, TRUE, FALSE ); } } @@ -2059,7 +2060,7 @@ HWND WINAPI NtUserSetFocus( HWND hwnd ) } /* change focus and send messages */ - return set_focus_window( hwnd, FALSE ); + return set_focus_window( hwnd, FALSE, hwnd != previous ); } /******************************************************************* From 0c34aa7270346300c94bf9bed765c78a674481e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jan 2022 18:26:41 +0100 Subject: [PATCH 0255/1506] server: Drop pending internal messages in set_active_window. When changing the active window in the foreground thread. CW-Bug-Id: #19612 --- dlls/win32u/input.c | 1 + server/protocol.def | 1 + server/queue.c | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 19ff4c74978..6ca58457f25 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1896,6 +1896,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) SERVER_START_REQ( set_active_window ) { req->handle = wine_server_user_handle( hwnd ); + req->internal_msg = WM_WINE_SETACTIVEWINDOW; if ((ret = !wine_server_call_err( req ))) previous = wine_server_ptr_handle( reply->previous ); } diff --git a/server/protocol.def b/server/protocol.def index 5d60e7fcda3..17043b187e9 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2917,6 +2917,7 @@ enum coords_relative /* Set the current thread active window */ @REQ(set_active_window) user_handle_t handle; /* handle to the active window */ + unsigned int internal_msg; /* set active window internal message */ @REPLY user_handle_t previous; /* handle to the previous active window */ @END diff --git a/server/queue.c b/server/queue.c index cd913ae03e5..e5df1e25833 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3264,7 +3264,11 @@ DECL_HANDLER(set_focus_window) /* set the current thread active window */ DECL_HANDLER(set_active_window) { + struct message *msg, *next; struct msg_queue *queue = get_current_queue(); + struct desktop *desktop; + + if (!(desktop = get_thread_desktop( current, 0 ))) return; reply->previous = 0; if (queue && check_queue_input_window( queue, req->handle )) @@ -3273,9 +3277,17 @@ DECL_HANDLER(set_active_window) { reply->previous = queue->input->active; queue->input->active = get_user_full_handle( req->handle ); + + if (desktop->foreground_input == queue->input && req->handle != reply->previous) + { + LIST_FOR_EACH_ENTRY_SAFE( msg, next, &queue->msg_list[POST_MESSAGE], struct message, entry ) + if (msg->msg == req->internal_msg) remove_queue_message( queue, msg, POST_MESSAGE ); + } } else set_error( STATUS_INVALID_HANDLE ); } + + release_object( desktop ); } From b58ffd5c3b6c887acf19406308ee68109960e0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 18 Oct 2019 11:39:19 +0200 Subject: [PATCH 0256/1506] winex11.drv: Pass XEvent instead of XClientMessageEvent to handlers. This is to avoid a dubious cast from XClientMessageEvent to XEvent in next patch. --- dlls/winex11.drv/event.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 77b7fa50db6..dccbaa15c1c 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -597,8 +597,10 @@ static void set_focus( Display *display, HWND hwnd, Time time ) /********************************************************************** * handle_manager_message */ -static void handle_manager_message( HWND hwnd, XClientMessageEvent *event ) +static void handle_manager_message( HWND hwnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; + if (hwnd != NtUserGetDesktopWindow()) return; if (systray_atom && event->data.l[1] == systray_atom) @@ -612,8 +614,9 @@ static void handle_manager_message( HWND hwnd, XClientMessageEvent *event ) /********************************************************************** * handle_wm_protocols */ -static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) +static void handle_wm_protocols( HWND hwnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; Atom protocol = (Atom)event->data.l[0]; Time event_time = (Time)event->data.l[1]; @@ -1581,8 +1584,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) /********************************************************************** * handle_xembed_protocol */ -static void handle_xembed_protocol( HWND hwnd, XClientMessageEvent *event ) +static void handle_xembed_protocol( HWND hwnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; + switch (event->data.l[1]) { case XEMBED_EMBEDDED_NOTIFY: @@ -1637,8 +1642,9 @@ static void handle_xembed_protocol( HWND hwnd, XClientMessageEvent *event ) /********************************************************************** * handle_dnd_protocol */ -static void handle_dnd_protocol( HWND hwnd, XClientMessageEvent *event ) +static void handle_dnd_protocol( HWND hwnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; Window root, child; int root_x, root_y, child_x, child_y; unsigned int u; @@ -1660,8 +1666,9 @@ static void handle_dnd_protocol( HWND hwnd, XClientMessageEvent *event ) * * Handle an XdndEnter event. */ -static void handle_xdnd_enter_event( HWND hWnd, XClientMessageEvent *event ) +static void handle_xdnd_enter_event( HWND hWnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; struct format_entry *data; unsigned long count = 0; Atom *xdndtypes; @@ -1764,8 +1771,9 @@ static long drop_effect_to_xdnd_action( UINT effect ) } -static void handle_xdnd_position_event( HWND hwnd, XClientMessageEvent *event ) +static void handle_xdnd_position_event( HWND hwnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; struct dnd_position_event_params params; XClientMessageEvent e; UINT effect; @@ -1797,8 +1805,9 @@ static void handle_xdnd_position_event( HWND hwnd, XClientMessageEvent *event ) } -static void handle_xdnd_drop_event( HWND hwnd, XClientMessageEvent *event ) +static void handle_xdnd_drop_event( HWND hwnd, XEvent *xev ) { + XClientMessageEvent *event = &xev->xclient; XClientMessageEvent e; DWORD effect; @@ -1818,7 +1827,7 @@ static void handle_xdnd_drop_event( HWND hwnd, XClientMessageEvent *event ) } -static void handle_xdnd_leave_event( HWND hwnd, XClientMessageEvent *event ) +static void handle_xdnd_leave_event( HWND hwnd, XEvent *xev ) { x11drv_client_call( client_dnd_leave_event, 0 ); } @@ -1826,8 +1835,8 @@ static void handle_xdnd_leave_event( HWND hwnd, XClientMessageEvent *event ) struct client_message_handler { - int atom; /* protocol atom */ - void (*handler)(HWND, XClientMessageEvent *); /* corresponding handler function */ + int atom; /* protocol atom */ + void (*handler)(HWND, XEvent *); /* corresponding handler function */ }; static const struct client_message_handler client_messages[] = @@ -1863,7 +1872,7 @@ static BOOL X11DRV_ClientMessage( HWND hwnd, XEvent *xev ) { if (event->message_type == X11DRV_Atoms[client_messages[i].atom - FIRST_XATOM]) { - client_messages[i].handler( hwnd, event ); + client_messages[i].handler( hwnd, xev ); return TRUE; } } From 058a5556151a5954c19f649d05189b5c43c543af Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 12 Feb 2018 09:15:07 -0600 Subject: [PATCH 0257/1506] winex11.drv: Log more information about X11 errors. --- dlls/winex11.drv/x11drv_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 46b35b03782..7e17501e320 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -321,6 +321,9 @@ static int error_handler( Display *display, XErrorEvent *error_evt ) error_evt->serial, error_evt->request_code ); assert( 0 ); } + TRACE("passing on error %d req %d:%d res 0x%lx\n", + error_evt->error_code, error_evt->request_code, + error_evt->minor_code, error_evt->resourceid); old_error_handler( display, error_evt ); return 0; } From d30ce49ed8b40b9c29b5cc374987cacef6619a51 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 27 Jun 2018 10:06:48 -0500 Subject: [PATCH 0258/1506] HACK: winex11.drv: Let the WM focus our windows by default. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should fix game windows not being in focus when first started and when exiting, which can cause surprising keyboard behavior (e.g. accidentally Alt-F4ing Steam itself, which is in the background). This may break modal dialogs in some WMs (fvwm2?) which do not respect our responses to WM_TAKE_FOCUS. For games that show that issue, we can re-enable UseTakeFocus. From Zeb: """ The basic problem, if I understand it correctly, is that Wine uses the "globally active" focus model by default. This means that the window manager won't focus our windows unless we respond in the affirmative to a WM_TAKE_FOCUS event. Since the GUI thread isn't processing messages, this doesn't happen. Luckily, there is a very easy workaround: create the registry key HKCU\Software\Wine\X11 Driver and set the somewhat inaptly named value "UseTakeFocus" to "N" (i.e. No). This causes Wine to use the "locally active" model instead, which means that the window manager will focus our windows when it sees fit—i.e. when the user clicks on them, or when they are created. """ --- dlls/winex11.drv/x11drv_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 7e17501e320..761e14c9c1c 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -71,7 +71,7 @@ Window root_window; BOOL usexvidmode = FALSE; BOOL usexrandr = TRUE; BOOL usexcomposite = TRUE; -BOOL use_take_focus = TRUE; +BOOL use_take_focus = FALSE; BOOL use_primary_selection = FALSE; BOOL use_system_cursors = TRUE; BOOL grab_fullscreen = FALSE; From 2fb1c1c5a0b667721c88bcd9b584e5e6b32fa391 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 30 Jan 2020 14:44:00 -0600 Subject: [PATCH 0259/1506] HACK: gamescope: user32: On steamcompmgr, don't limit window size to screen size HACK: user32: Don't resize new windows to fit the display. --- dlls/win32u/defwnd.c | 12 ++++++++++-- dlls/win32u/window.c | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index cba5f02c02e..ec959a5f1a4 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -480,8 +480,16 @@ static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos ) if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) { MINMAXINFO info = get_min_max_info( hwnd ); - winpos->cx = min( winpos->cx, info.ptMaxTrackSize.x ); - winpos->cy = min( winpos->cy, info.ptMaxTrackSize.y ); + + /* HACK: This code changes the window's size to fit the display. However, + * some games (Bayonetta, Dragon's Dogma) will then have the incorrect + * render size. So just let windows be too big to fit the display. */ + if (__wine_get_window_manager() != WINE_WM_X11_STEAMCOMPMGR) + { + winpos->cx = min( winpos->cx, info.ptMaxTrackSize.x ); + winpos->cy = min( winpos->cy, info.ptMaxTrackSize.y ); + } + if (!(style & WS_MINIMIZE)) { winpos->cx = max( winpos->cx, info.ptMinTrackSize.x ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 946115c1f46..bb02898e90d 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5284,8 +5284,18 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, if ((cs.style & WS_THICKFRAME) || !(cs.style & (WS_POPUP | WS_CHILD))) { MINMAXINFO info = get_min_max_info( hwnd ); - cx = max( min( cx, info.ptMaxTrackSize.x ), info.ptMinTrackSize.x ); - cy = max( min( cy, info.ptMaxTrackSize.y ), info.ptMinTrackSize.y ); + + /* HACK: This code changes the window's size to fit the display. However, + * some games (Bayonetta, Dragon's Dogma) will then have the incorrect + * render size. So just let windows be too big to fit the display. */ + if (__wine_get_window_manager() != WINE_WM_X11_STEAMCOMPMGR) + { + cx = min( cx, info.ptMaxTrackSize.x ); + cy = min( cy, info.ptMaxTrackSize.y ); + } + + cx = max( cx, info.ptMinTrackSize.x ); + cy = max( cy, info.ptMinTrackSize.y ); } if (cx < 0) cx = 0; From 1fbb9d33058188960b27452b449ad62432042718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 16 Mar 2020 19:52:52 +0100 Subject: [PATCH 0260/1506] HACK: gamescope: user32: Pretend that windows are undecorated with gamescope. The original commit made all window have their client rect always match their window rects. This was to make sure games always use the full available window size, even when windowed, and end up with an optimal rendering area. Some games, such as Bayonetta or Dragon's Dogma: Dark Arisen, ask for an optimal window size, but, when in windowed mode, the client rect is then adjusted to add a title bar and borders. On Windows, the back buffer is always the requested size, but the rendering is then scaled to match the client rect. With Proton and gamescope, we want to avoid this suboptimal scaling, and make sure both front and back buffer are optimally sized, including when in windowed mode. Then, we still need to keep adjustments on WS_POPUP / WS_EX_TOOLWINDOW windows: This styles usually translates into a single pixel border, and is used for splash screens. Several of them do not expect their client rect to be sized as the window rect and it causes a visible 1px white border on the bottom and the right of the window. WS_EX_TOOLWINDOW should be safe enough, as it means the window is not supposed to be displayed in the taskbar or in the alt-tab menu, which is unlikely for an actual game window. WS_POPUP otoh means that only a 1px border is used, which should not make much of a difference with an undecorated window (although it could cause suboptimal client rect sizes, which we wanted to solve in the first place). CW-Bug-Id: #17639 CW-Bug-Id: #20038 --- dlls/user32/nonclient.c | 4 ++++ dlls/win32u/defwnd.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 00c7368c516..61648c758ff 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -21,6 +21,7 @@ #include "user_private.h" #include "controls.h" #include "wine/debug.h" +#include "ntuser.h" WINE_DEFAULT_DEBUG_CHANNEL(nonclient); @@ -31,6 +32,9 @@ static void adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD exStyl { int adjust = 0; + if (__wine_get_window_manager() == WINE_WM_X11_STEAMCOMPMGR && !((style & WS_POPUP) && (exStyle & WS_EX_TOOLWINDOW))) + return; + if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) adjust = 1; /* for the outer frame always present */ else if ((exStyle & WS_EX_DLGMODALFRAME) || (style & (WS_THICKFRAME|WS_DLGFRAME))) diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index ec959a5f1a4..b7153095e55 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -1863,6 +1863,9 @@ static void handle_nc_calc_size( HWND hwnd, WPARAM wparam, RECT *win_rect ) if (!win_rect) return; + if (__wine_get_window_manager() == WINE_WM_X11_STEAMCOMPMGR && !((style & WS_POPUP) && (ex_style & WS_EX_TOOLWINDOW))) + return; + if (!(style & WS_MINIMIZE)) { AdjustWindowRectEx( &rect, style, FALSE, ex_style & ~WS_EX_CLIENTEDGE ); From a59887ba7360effe98bf0feef9cc5be6f7b41023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 28 May 2021 17:41:43 +0200 Subject: [PATCH 0261/1506] HACK: gamescope: winex11.drv: Disable gamescope hacks for Street Fighter V. CW-Bug-Id: #18903 --- dlls/winex11.drv/window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 728ce2da84f..8797b810f46 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -132,6 +132,7 @@ static int detect_wm(Display *dpy) int format, err; unsigned long count, remaining; char *wm_name; + char const *sgi = getenv("SteamGameId"); static int cached = -1; @@ -183,6 +184,11 @@ static int detect_wm(Display *dpy) }else cached = WINE_WM_UNKNOWN; + /* Street Fighter V expects a certain sequence of window resizes + or gets stuck on startup. The AdjustWindowRect / WM_NCCALCSIZE + hacks confuse it completely, so let's disable them */ + if (sgi && !strcmp(sgi, "310950")) cached = WINE_WM_UNKNOWN; + __wine_set_window_manager(cached); } From 2690be20be4fa8e32280b229f34f47fb686a6918 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 18 Sep 2018 14:48:58 -0500 Subject: [PATCH 0262/1506] winex11.drv: Allow the application to change window size and states during PropertyNotify. On focus loss, fullscreened DDLC changes to a 1x1 pixel window and minimizes. On restore, it un-minimizes and changes back to fullscreen size. However, this restoring happens during the PropertyNotify handler, which means we didn't update size or the NET_WM_STATEs. --- dlls/winex11.drv/window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 8797b810f46..d14c59e3329 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3080,7 +3080,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, } /* don't change position if we are about to minimize or maximize a managed window */ - if (!event_type && + if ((!event_type || event_type == PropertyNotify) && !(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE)))) sync_window_position( data, swp_flags, &old_window_rect, &old_whole_rect, &old_client_rect ); @@ -3114,7 +3114,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, else { if (swp_flags & (SWP_FRAMECHANGED|SWP_STATECHANGED)) set_wm_hints( data ); - if (!event_type) update_net_wm_states( data ); + if (!event_type || event_type == PropertyNotify) update_net_wm_states( data ); } } From a2f7e0b3e7928caeee51140d8e33fd5a657069ac Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 11 Jan 2019 11:31:13 -0600 Subject: [PATCH 0263/1506] winex11.drv: Don't show border if WS_CAPTION is unset. Into the Breach wants a borderless window with WS_THICKFRAME. If we leave the BORDER and RESIZEH styles on, then we get a window with a border and a caption on Linux. --- dlls/winex11.drv/window.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d14c59e3329..d49b1700264 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -416,7 +416,10 @@ static unsigned long get_mwm_decorations( struct x11drv_win_data *data, if (style & WS_MAXIMIZEBOX) ret |= MWM_DECOR_MAXIMIZE; } if (ex_style & WS_EX_DLGMODALFRAME) ret |= MWM_DECOR_BORDER; - else if (style & WS_THICKFRAME) ret |= MWM_DECOR_BORDER | MWM_DECOR_RESIZEH; + else if (style & WS_THICKFRAME){ + if((style & WS_CAPTION) == WS_CAPTION) + ret |= MWM_DECOR_BORDER | MWM_DECOR_RESIZEH; + } else if ((style & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) ret |= MWM_DECOR_BORDER; return ret; } From 8b2fa912b4390b4421ae226b9f4c4a79e551df24 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 11 Jan 2019 11:34:03 -0600 Subject: [PATCH 0264/1506] winex11.drv: Ignore ConfigureNotify messages if there is a FULLSCREEN WM state pending. Into the Breach goes fullscreen by first maximizing, then setting the window to fullscreen in a separate call. Mutter processes the maximize request _after_ Wine has sent the fullscreen request. As a result, we get a ConfigureNotify for the size of the workspace when we expect the window to be fullscreened. We then notify ITB that it is no longer fullscreen, which begins the process over again, causing an infinite loop. This fixes that by setting a flag if we have a fullscreen request pending and ignoring ConfigureNotify requests if it is set. We unset it when we receive a _NET_WM_STATE PropertyNotify event that contains the FULLSCREEN flag. --- dlls/winex11.drv/event.c | 35 +++++++++++++++++++++++++++++++++++ dlls/winex11.drv/window.c | 9 +++++++++ dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 45 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index dccbaa15c1c..2c19747fcec 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1067,6 +1067,12 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) event->serial, data->configure_serial ); goto done; } + if (data->pending_fullscreen) + { + TRACE( "win %p/%lx event %d,%d,%dx%d pending_fullscreen is pending, so ignoring\n", hwnd, + data->whole_window, event->x, event->y, event->width, event->height ); + goto done; + } /* Get geometry */ @@ -1314,15 +1320,44 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat } +static void handle__net_wm_state_notify( HWND hwnd, XPropertyEvent *event ) +{ + struct x11drv_win_data *data = get_win_data( hwnd ); + + if (data->pending_fullscreen) + { + read_net_wm_states( event->display, data ); + if (data->net_wm_state & (1 << NET_WM_STATE_FULLSCREEN)) + { + data->pending_fullscreen = FALSE; + TRACE( "PropertyNotify _NET_WM_STATE, now %#x, pending_fullscreen no longer pending.\n", (UINT)data->net_wm_state ); + } + else TRACE( "PropertyNotify _NET_WM_STATE, now %#x, pending_fullscreen still pending.\n", (UINT)data->net_wm_state ); + } + + release_win_data( data ); +} + + /*********************************************************************** * X11DRV_PropertyNotify */ static BOOL X11DRV_PropertyNotify( HWND hwnd, XEvent *xev ) { XPropertyEvent *event = &xev->xproperty; + char *name; if (!hwnd) return FALSE; + + name = XGetAtomName( event->display, event->atom ); + if (name) + { + TRACE( "win %p PropertyNotify atom: %s, state: 0x%x\n", hwnd, name, event->state ); + XFree( name ); + } + if (event->atom == x11drv_atom(WM_STATE)) handle_wm_state_notify( hwnd, event, TRUE ); + else if (event->atom == x11drv_atom( _NET_WM_STATE )) handle__net_wm_state_notify( hwnd, event ); return TRUE; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d49b1700264..1baedaec80e 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1266,6 +1266,12 @@ void update_net_wm_states( struct x11drv_win_data *data ) i, data->hwnd, data->whole_window, (new_state & (1 << i)) != 0, (data->net_wm_state & (1 << i)) != 0 ); + if (i == NET_WM_STATE_FULLSCREEN) + { + data->pending_fullscreen = (new_state & (1 << i)) != 0; + TRACE( "set pending_fullscreen to: %u\n", data->pending_fullscreen ); + } + xev.xclient.data.l[0] = (new_state & (1 << i)) ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; xev.xclient.data.l[1] = X11DRV_Atoms[net_wm_state_atoms[i] - FIRST_XATOM]; xev.xclient.data.l[2] = ((net_wm_state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) ? @@ -1395,6 +1401,7 @@ static void unmap_window( HWND hwnd ) data->mapped = FALSE; data->net_wm_state = 0; + data->pending_fullscreen = FALSE; } release_win_data( data ); } @@ -1411,6 +1418,7 @@ void make_window_embedded( struct x11drv_win_data *data ) if (!data->managed) XUnmapWindow( data->display, data->whole_window ); else XWithdrawWindow( data->display, data->whole_window, data->vis.screen ); data->net_wm_state = 0; + data->pending_fullscreen = FALSE; } data->embedded = TRUE; data->managed = TRUE; @@ -2012,6 +2020,7 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des data->whole_colormap = 0; data->wm_state = WithdrawnState; data->net_wm_state = 0; + data->pending_fullscreen = FALSE; data->mapped = FALSE; if (data->xic) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index fdf9c77db73..e931b7ea052 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -626,6 +626,7 @@ struct x11drv_win_data RECT whole_rect; /* X window rectangle for the whole window relative to win32 parent window client area */ RECT client_rect; /* client area relative to win32 parent window client area */ XIC xic; /* X input context */ + UINT pending_fullscreen : 1; /* HACK: pending change to fullscreen state */ UINT managed : 1; /* is window managed? */ UINT mapped : 1; /* is window mapped? (in either normal or iconic state) */ UINT fs_hack : 1; /* is window forced / faking fullscreen? */ From f00e9e283bd8b84b9a00b631903d4f0983991aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 26 Jun 2019 18:42:37 +0200 Subject: [PATCH 0265/1506] HACK: mutter: winex11.drv: Workaround mutter issue #649. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When decorations are modified too quickly, mutter loses tracks of the reparenting requests and does not gives focus back to the window. Signed-off-by: Rémi Bernon --- dlls/winex11.drv/window.c | 44 ++++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/x11drv.h | 4 ++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1baedaec80e..504180eb217 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -53,7 +53,6 @@ #include "wine/debug.h" #include "wine/server.h" -#include "mwm.h" WINE_DEFAULT_DEBUG_CHANNEL(x11drv); WINE_DECLARE_DEBUG_CHANNEL(systray); @@ -843,13 +842,22 @@ static void set_size_hints( struct x11drv_win_data *data, DWORD style ) XFree( size_hints ); } +static Bool is_unmap_notify( Display *display, XEvent *event, XPointer arg ) +{ + struct x11drv_win_data *data = (struct x11drv_win_data *)arg; + return event->xany.serial >= data->unmapnotify_serial && + event->xany.window == data->whole_window && + event->type == UnmapNotify; +} /*********************************************************************** * set_mwm_hints */ static void set_mwm_hints( struct x11drv_win_data *data, UINT style, UINT ex_style ) { + GUITHREADINFO info = {.cbSize = sizeof(GUITHREADINFO)}; MwmHints mwm_hints; + int enable_mutter_workaround, mapped; if (data->hwnd == NtUserGetDesktopWindow()) { @@ -881,12 +889,46 @@ static void set_mwm_hints( struct x11drv_win_data *data, UINT style, UINT ex_sty TRACE( "%p setting mwm hints to %lx,%lx (style %x exstyle %x)\n", data->hwnd, mwm_hints.decorations, mwm_hints.functions, style, ex_style ); + enable_mutter_workaround = wm_is_mutter(data->display) && NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) && + info.hwndFocus == data->hwnd && !!data->prev_hints.decorations != !!mwm_hints.decorations && + root_window == DefaultRootWindow(data->display); + + /* workaround for mutter gitlab bug #649, we cannot trust the + * data->mapped flag as mapping is asynchronous. + */ + if (enable_mutter_workaround) + { + XWindowAttributes attr; + + mapped = data->mapped; + if (XGetWindowAttributes( data->display, data->whole_window, &attr )) + mapped = (attr.map_state != IsUnmapped); + } + mwm_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; mwm_hints.input_mode = 0; mwm_hints.status = 0; + data->unmapnotify_serial = NextRequest( data->display ); XChangeProperty( data->display, data->whole_window, x11drv_atom(_MOTIF_WM_HINTS), x11drv_atom(_MOTIF_WM_HINTS), 32, PropModeReplace, (unsigned char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) ); + + if (enable_mutter_workaround) + { + XEvent event; + + /* workaround for mutter gitlab bug #649, wait for the map notify + * event each time the decorations are modified before modifying + * them again. + */ + if (mapped) + { + TRACE("workaround mutter bug #649, waiting for UnmapNotify\n"); + XPeekIfEvent( data->display, &event, is_unmap_notify, (XPointer)data ); + } + } + + data->prev_hints = mwm_hints; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index e931b7ea052..fa99a04de90 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -68,6 +68,8 @@ typedef int Status; #include "wine/list.h" #include "wine/debug.h" +#include "mwm.h" + #define MAX_DASHLEN 16 #define WINE_XDND_VERSION 5 @@ -643,12 +645,14 @@ struct x11drv_win_data int wm_state; /* current value of the WM_STATE property */ DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */ + unsigned long unmapnotify_serial; /* serial number of last UnmapNotify event */ unsigned long configure_serial; /* serial number of last configure request */ struct window_surface *surface; Pixmap icon_pixmap; Pixmap icon_mask; unsigned long *icon_bits; unsigned int icon_size; + MwmHints prev_hints; }; extern BOOL wm_is_mutter(Display *); From fef64845284fbf4fdd044b3ae6f2e771db2dd859 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 21 Aug 2018 14:47:33 -0500 Subject: [PATCH 0266/1506] HACK: mutter: winex11.drv: Workaround mutter issue #273. This would cause fullscreen windows to lose keyboard focus. --- dlls/winex11.drv/event.c | 22 ++++++++++++++++++++++ dlls/winex11.drv/window.c | 10 ++++++++++ dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 33 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 2c19747fcec..ece04a5dd2e 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -804,8 +804,30 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) */ static void focus_out( Display *display , HWND hwnd ) { + struct x11drv_win_data *data; + if (xim_in_compose_mode()) return; + data = get_win_data(hwnd); + if(data){ + LARGE_INTEGER frequency, counter; + ULONGLONG now; + NtQueryPerformanceCounter( &counter, &frequency ); + now = 1000 * counter.QuadPart / frequency.QuadPart; + if(data->take_focus_back > 0 && + now >= data->take_focus_back && + now - data->take_focus_back < 1000){ + data->take_focus_back = 0; + TRACE("workaround mutter bug, taking focus back\n"); + XSetInputFocus( data->display, data->whole_window, RevertToParent, CurrentTime); + release_win_data(data); + /* don't inform win32 client */ + return; + } + data->take_focus_back = 0; + release_win_data(data); + } + x11drv_thread_data()->last_focus = hwnd; xim_set_focus( hwnd, FALSE ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 504180eb217..8248f1c2b88 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -928,6 +928,16 @@ static void set_mwm_hints( struct x11drv_win_data *data, UINT style, UINT ex_sty } } + if (wm_is_mutter(data->display) && NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) && + info.hwndFocus == data->hwnd && !!data->prev_hints.decorations != !!mwm_hints.decorations) + { + LARGE_INTEGER frequency, counter; + /* workaround for mutter gitlab bug #273 */ + TRACE("workaround mutter bug, setting take_focus_back\n"); + NtQueryPerformanceCounter( &counter, &frequency ); + data->take_focus_back = 1000 * counter.QuadPart / frequency.QuadPart; + } + data->prev_hints = mwm_hints; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index fa99a04de90..4449e5d66e9 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -642,6 +642,7 @@ struct x11drv_win_data UINT skip_taskbar : 1; /* does window should be deleted from taskbar */ UINT add_taskbar : 1; /* does window should be added to taskbar regardless of style */ UINT net_wm_fullscreen_monitors_set : 1; /* is _NET_WM_FULLSCREEN_MONITORS set */ + ULONGLONG take_focus_back; int wm_state; /* current value of the WM_STATE property */ DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */ From a4c6b58a472ffb1733fa9f137d8ac571a81c8cab Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 25 Sep 2020 12:58:52 +0300 Subject: [PATCH 0267/1506] HACK: mutter: winex11.drv: Avoid setting empty shape for window on mutter. --- dlls/winex11.drv/bitblt.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 94aa06773a7..e6890495a51 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1750,8 +1750,21 @@ static void update_surface_region( struct x11drv_window_surface *surface ) if ((data = X11DRV_GetRegionData( rgn, 0 ))) { - XShapeCombineRectangles( gdi_display, surface->window, ShapeBounding, 0, 0, - (XRectangle *)data->Buffer, data->rdh.nCount, ShapeSet, YXBanded ); + if (!data->rdh.nCount && wm_is_mutter(gdi_display)) + { + XRectangle xrect; + + xrect.x = xrect.y = -1; + xrect.width = 1; + xrect.height = 1; + XShapeCombineRectangles( gdi_display, surface->window, ShapeBounding, 0, 0, + &xrect, 1, ShapeSet, YXBanded ); + } + else + { + XShapeCombineRectangles( gdi_display, surface->window, ShapeBounding, 0, 0, + (XRectangle *)data->Buffer, data->rdh.nCount, ShapeSet, YXBanded ); + } free( data ); } From 96eda2fd0e8a3b136a95e816f8630cead39599f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 7 Mar 2022 16:53:09 +0100 Subject: [PATCH 0268/1506] winex11.drv: Call SetForegroundWindow instead of SetActiveWindow on restore. So that the window is both active and foreground before we send the SC_RESTORE command. Project Cars 3 expects that as it tries to reacquire DInput devices on SC_RESTORE. CW-Bug-Id: #19011 CW-Bug-Id: #20227 --- dlls/winex11.drv/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index ece04a5dd2e..2d4fcce90c1 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1318,7 +1318,7 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); release_win_data( data ); if ((style & (WS_MINIMIZE | WS_VISIBLE)) == (WS_MINIMIZE | WS_VISIBLE)) - NtUserSetActiveWindow( hwnd ); + NtUserSetForegroundWindow( hwnd ); send_message( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 ); return; } From 3d302ce2ac28cb0b014f31c52adcc96e4fd0d1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Nov 2021 10:54:06 +0100 Subject: [PATCH 0269/1506] HACK: proton: winex11.drv: Track GAMESCOPE_FOCUSED_APP property changes. CW-Bug-Id: #19673 CW-Bug-Id: #19991 --- dlls/winex11.drv/event.c | 32 ++++++++++++++++++++++++++++++++ dlls/winex11.drv/window.c | 4 +++- dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 3 ++- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 2d4fcce90c1..a7bbdc5f162 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1360,6 +1360,36 @@ static void handle__net_wm_state_notify( HWND hwnd, XPropertyEvent *event ) release_win_data( data ); } +static int handle_gamescope_focused_app_error( Display *dpy, XErrorEvent *event, void *arg ) +{ + WARN( "Failed to read GAMESCOPE_FOCUSED_APP property, ignoring.\n" ); + return 1; +} + +static void handle_gamescope_focused_app( XPropertyEvent *event ) +{ + static const char *sgi = NULL; + + unsigned long count, remaining, *property; + int format, app_id, focused_app_id; + Atom type; + + if (!sgi && !(sgi = getenv( "SteamGameId" ))) return; + app_id = atoi( sgi ); + + X11DRV_expect_error( event->display, handle_gamescope_focused_app_error, NULL ); + XGetWindowProperty( event->display, DefaultRootWindow( event->display ), x11drv_atom( GAMESCOPE_FOCUSED_APP ), + 0, ~0UL, False, XA_CARDINAL, &type, &format, &count, &remaining, (unsigned char **)&property ); + if (X11DRV_check_error()) focused_app_id = app_id; + else + { + if (!property) focused_app_id = app_id; + else focused_app_id = *property; + XFree( property ); + } + + TRACE( "Got app id %u, focused app %u\n", app_id, focused_app_id ); +} /*********************************************************************** * X11DRV_PropertyNotify @@ -1369,6 +1399,8 @@ static BOOL X11DRV_PropertyNotify( HWND hwnd, XEvent *xev ) XPropertyEvent *event = &xev->xproperty; char *name; + if (event->atom == x11drv_atom( GAMESCOPE_FOCUSED_APP )) handle_gamescope_focused_app( event ); + if (!hwnd) return FALSE; name = XGetAtomName( event->display, event->atom ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 8248f1c2b88..b369e22ec52 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2361,6 +2361,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd ) data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0, InputOnly, default_visual.visual, CWOverrideRedirect | CWEventMask, &attr ); + XSelectInput( data->display, DefaultRootWindow( data->display ), PropertyChangeMask ); XFlush( data->display ); NtUserSetProp( hwnd, clip_window_prop, (HANDLE)data->clip_window ); X11DRV_DisplayDevices_RegisterEventHandlers(); @@ -2552,7 +2553,8 @@ void X11DRV_SystrayDockInit( HWND hwnd ) sprintf( systray_buffer, "_NET_SYSTEM_TRAY_S%u", DefaultScreen( display ) ); systray_atom = XInternAtom( display, systray_buffer, False ); } - XSelectInput( display, root_window, StructureNotifyMask ); + + XSelectInput( display, DefaultRootWindow( display ), StructureNotifyMask | PropertyChangeMask ); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 4449e5d66e9..ca603cdf029 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -560,6 +560,7 @@ enum x11drv_atoms XATOM_text_rtf, XATOM_text_richtext, XATOM_text_uri_list, + XATOM_GAMESCOPE_FOCUSED_APP, NB_XATOMS }; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 761e14c9c1c..09855139bdf 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -222,7 +222,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "text/plain", "text/rtf", "text/richtext", - "text/uri-list" + "text/uri-list", + "GAMESCOPE_FOCUSED_APP" }; /*********************************************************************** From 5bae82a59a4122dccc8741eb69be1a36e5c1ad34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 17 Dec 2020 18:47:44 +0100 Subject: [PATCH 0270/1506] HACK: proton: winex11.drv: Check Steam overlay presence and drop events when enabled. Squashed with: winex11.drv: Don't allow querying pointer while overlay is active. HACK: gamescope: winex11.drv: Ignore mouse events when Steam Keyboard is opened. Using a global __wine_steamclient_KeyboardActivated event. We need to keep keyboard events though as it's how the OSK will communicate its input. CW-Bug-Id: #19673 winex11.drv: Don't fail GetCursorPos() from X11DRV_GetCursorPos() when Steam overlay is active. CW-Bug-Id: #20732 HACK: gamescope: winex11.drv: Turn OSK input filtering messages to FIXME. --- dlls/winex11.drv/event.c | 30 ++++++++++++++++++++++++++++-- dlls/winex11.drv/mouse.c | 4 ++++ dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 21 +++++++++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index a7bbdc5f162..725540c3630 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -405,13 +405,23 @@ static BOOL process_events( Display *display, Bool (*filter)(Display*, XEvent*,X { XEvent event, prev_event; int count = 0; - BOOL queued = FALSE; + BOOL queued = FALSE, overlay_enabled = FALSE, steam_keyboard_opened = FALSE; enum event_merge_action action = MERGE_DISCARD; + ULONG_PTR overlay_filter = QS_KEY | QS_MOUSEBUTTON | QS_MOUSEMOVE; + ULONG_PTR keyboard_filter = QS_MOUSEBUTTON | QS_MOUSEMOVE; + LARGE_INTEGER timeout = {0}; + + if (NtWaitForSingleObject(steam_overlay_event, FALSE, &timeout) == WAIT_OBJECT_0) + overlay_enabled = TRUE; + if (NtWaitForSingleObject(steam_keyboard_event, FALSE, &timeout) == WAIT_OBJECT_0) + steam_keyboard_opened = TRUE; prev_event.type = 0; while (XCheckIfEvent( display, &event, filter, (char *)arg )) { count++; + if (overlay_enabled && filter_event( display, &event, (char *)overlay_filter )) continue; + if (steam_keyboard_opened && filter_event( display, &event, (char *)keyboard_filter )) continue; if (XFilterEvent( &event, None )) { /* @@ -1369,9 +1379,11 @@ static int handle_gamescope_focused_app_error( Display *dpy, XErrorEvent *event, static void handle_gamescope_focused_app( XPropertyEvent *event ) { static const char *sgi = NULL; + static BOOL steam_keyboard_opened; unsigned long count, remaining, *property; int format, app_id, focused_app_id; + BOOL keyboard_opened; Atom type; if (!sgi && !(sgi = getenv( "SteamGameId" ))) return; @@ -1388,7 +1400,21 @@ static void handle_gamescope_focused_app( XPropertyEvent *event ) XFree( property ); } - TRACE( "Got app id %u, focused app %u\n", app_id, focused_app_id ); + keyboard_opened = app_id != focused_app_id; + if (steam_keyboard_opened == keyboard_opened) return; + steam_keyboard_opened = keyboard_opened; + + FIXME( "HACK: Got app id %u, focused app %u\n", app_id, focused_app_id ); + if (keyboard_opened) + { + FIXME( "HACK: Steam Keyboard is opened, filtering events.\n" ); + NtSetEvent( steam_keyboard_event, NULL ); + } + else + { + FIXME( "HACK: Steam Keyboard is closed, stopping events filter.\n" ); + NtResetEvent( steam_keyboard_event, NULL ); + } } /*********************************************************************** diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index fecd55488bd..8c0968ed2d3 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1427,11 +1427,15 @@ BOOL X11DRV_SetCursorPos( INT x, INT y ) BOOL X11DRV_GetCursorPos(LPPOINT pos) { Display *display = thread_init_display(); + LARGE_INTEGER timeout = {0}; Window root, child; int rootX, rootY, winX, winY; unsigned int xstate; BOOL ret; + if (NtWaitForSingleObject(steam_overlay_event, FALSE, &timeout) == WAIT_OBJECT_0) return TRUE; + if (NtWaitForSingleObject(steam_keyboard_event, FALSE, &timeout) == WAIT_OBJECT_0) return TRUE; + ret = XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &winX, &winY, &xstate ); if (ret) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index ca603cdf029..061495dd73b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -460,6 +460,8 @@ extern int xrender_error_base; extern char *process_name; extern Display *clipboard_display; extern WNDPROC client_foreign_window_proc; +extern HANDLE steam_overlay_event; +extern HANDLE steam_keyboard_event; extern int limit_number_of_resolutions; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 09855139bdf..aad8a4a3e83 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -90,6 +90,8 @@ char *process_name = NULL; WNDPROC client_foreign_window_proc = NULL; BOOL vulkan_disable_child_window_rendering_hack = FALSE; BOOL vulkan_gdi_blit_source_hack = FALSE; +HANDLE steam_overlay_event; +HANDLE steam_keyboard_event; static x11drv_error_callback err_callback; /* current callback for error */ static Display *err_callback_display; /* display callback is set for */ @@ -664,6 +666,25 @@ static NTSTATUS x11drv_init( void *arg ) struct init_params *params = arg; Display *display; void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL ); + OBJECT_ATTRIBUTES attr; + WCHAR buffer[MAX_PATH]; + char path[MAX_PATH]; + UNICODE_STRING str; + + RtlInitUnicodeString( &str, buffer ); + InitializeObjectAttributes( &attr, &str, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, 0, NULL ); + + str.Length = sprintf( path, "\\Sessions\\%u\\BaseNamedObjects\\__wine_steamclient_GameOverlayActivated", + (int)NtCurrentTeb()->Peb->SessionId ); + ascii_to_unicode( buffer, path, str.Length + 1 ); + str.Length *= sizeof(WCHAR); + NtCreateEvent( &steam_overlay_event, EVENT_ALL_ACCESS, &attr, NotificationEvent, FALSE ); + + str.Length = sprintf( path, "\\Sessions\\%u\\BaseNamedObjects\\__wine_steamclient_KeyboardActivated", + (int)NtCurrentTeb()->Peb->SessionId ); + ascii_to_unicode( buffer, path, str.Length + 1 ); + str.Length *= sizeof(WCHAR); + NtCreateEvent( &steam_keyboard_event, EVENT_ALL_ACCESS, &attr, NotificationEvent, FALSE ); if (!libx11) { From 3609acfaef708db6d134804273280698c8b309d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 18 May 2022 20:12:41 +0200 Subject: [PATCH 0271/1506] HACK: proton: winex11.drv: Expose GWL_STYLE and GWL_EXSTYLE as X11 properties. As _WINE_HWND_STYLE and _WINE_HWND_EXSTYLE respectively. CW-Bug-Id: #20663 --- dlls/winex11.drv/window.c | 17 +++++++++++++++++ dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 2 ++ 3 files changed, 21 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index b369e22ec52..31e64f6ad3d 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1947,6 +1947,19 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colo } +void set_hwnd_style_props( Display *display, Window window, HWND hwnd ) +{ + DWORD style = NtUserGetWindowLongW( hwnd, GWL_STYLE ), exstyle = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ); + + TRACE( "display %p, window %lx, hwnd %p\n", display, window, hwnd ); + + XChangeProperty( display, window, x11drv_atom(_WINE_HWND_STYLE), XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&style, sizeof(style) / 4 ); + XChangeProperty( display, window, x11drv_atom(_WINE_HWND_EXSTYLE), XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&exstyle, sizeof(exstyle) / 4 ); +} + + /********************************************************************** * create_whole_window * @@ -2014,6 +2027,8 @@ static void create_whole_window( struct x11drv_win_data *data ) XSaveContext( data->display, data->whole_window, winContext, (char *)data->hwnd ); NtUserSetProp( data->hwnd, whole_window_prop, (HANDLE)data->whole_window ); + set_hwnd_style_props( data->display, data->whole_window, data->hwnd ); + /* set the window text */ if (!NtUserInternalGetWindowText( data->hwnd, text, ARRAY_SIZE( text ))) text[0] = 0; sync_window_text( data->display, data->whole_window, text ); @@ -3118,6 +3133,8 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, return; } + set_hwnd_style_props( data->display, data->whole_window, data->hwnd ); + if (data->fs_hack) needs_resize = TRUE; /* check if we are currently processing an event relevant to this window */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 061495dd73b..114a5825baf 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -529,6 +529,8 @@ enum x11drv_atoms XATOM__GTK_WORKAREAS_D0, XATOM__XEMBED, XATOM__XEMBED_INFO, + XATOM__WINE_HWND_STYLE, + XATOM__WINE_HWND_EXSTYLE, XATOM_XdndAware, XATOM_XdndEnter, XATOM_XdndPosition, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index aad8a4a3e83..ccde7455f84 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -192,6 +192,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "_GTK_WORKAREAS_D0", "_XEMBED", "_XEMBED_INFO", + "_WINE_HWND_STYLE", + "_WINE_HWND_EXSTYLE", "XdndAware", "XdndEnter", "XdndPosition", From 436bc1a76dba5c54b980cea5d971d594321e49e4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 31 Aug 2021 00:41:15 +0300 Subject: [PATCH 0272/1506] winex11.drv: HACK: Mind insert_after X11DRV_WindowPosChanged in some cases. Fixes FH4 rendering black window until focus is lost. CW-Bug-Id: #19335 --- dlls/winex11.drv/window.c | 49 +++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 31e64f6ad3d..b90074ae65d 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1554,16 +1554,17 @@ void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect, int x, i * * Synchronize the X window position with the Windows one */ -static void sync_window_position( struct x11drv_win_data *data, +static HWND sync_window_position( struct x11drv_win_data *data, UINT swp_flags, const RECT *old_window_rect, const RECT *old_whole_rect, const RECT *old_client_rect ) { DWORD style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); DWORD ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); + HWND prev_window = NULL; XWindowChanges changes; unsigned int mask = 0; - if (data->managed && data->iconic) return; + if (data->managed && data->iconic) return NULL; /* resizing a managed maximized window is not allowed */ if (!(style & WS_MAXIMIZE) || !data->managed) @@ -1604,9 +1605,10 @@ static void sync_window_position( struct x11drv_win_data *data, { /* find window that this one must be after */ HWND prev = NtUserGetWindowRelative( data->hwnd, GW_HWNDPREV ); + while (prev && !(NtUserGetWindowLongW( prev, GWL_STYLE ) & WS_VISIBLE)) prev = NtUserGetWindowRelative( prev, GW_HWNDPREV ); - if (!prev) /* top child */ + if (!(prev_window = prev)) /* top child */ { changes.stack_mode = Above; mask |= CWStackMode; @@ -1620,6 +1622,7 @@ static void sync_window_position( struct x11drv_win_data *data, update_net_wm_states( data ); data->configure_serial = NextRequest( data->display ); XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes ); + #ifdef HAVE_LIBXSHAPE if (IsRectEmpty( old_window_rect ) != IsRectEmpty( &data->window_rect )) sync_window_region( data, (HRGN)1 ); @@ -1640,6 +1643,8 @@ static void sync_window_position( struct x11drv_win_data *data, (int)(data->whole_rect.right - data->whole_rect.left), (int)(data->whole_rect.bottom - data->whole_rect.top), changes.sibling, mask, data->configure_serial ); + + return prev_window; } @@ -3048,6 +3053,25 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, } +static void restack_windows( struct x11drv_win_data *data, HWND prev ) +{ + struct x11drv_win_data *prev_data; + + TRACE("data->hwnd %p, prev %p.\n", data->hwnd, prev); + + while (prev) + { + if (!(prev_data = get_win_data( prev ))) break; + + TRACE( "Raising window %p.\n", prev ); + + if (prev_data->whole_window && data->display == prev_data->display) + XRaiseWindow( prev_data->display, prev_data->whole_window ); + release_win_data( prev_data ); + prev = NtUserGetWindowRelative( prev, GW_HWNDPREV ); + } +} + /*********************************************************************** * WindowPosChanged (X11DRV.@) */ @@ -3060,6 +3084,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, struct x11drv_win_data *data; UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); RECT old_window_rect, old_whole_rect, old_client_rect; + HWND prev_window = NULL; BOOL needs_resize; int event_type; @@ -3165,7 +3190,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, /* don't change position if we are about to minimize or maximize a managed window */ if ((!event_type || event_type == PropertyNotify) && !(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE)))) - sync_window_position( data, swp_flags, &old_window_rect, &old_whole_rect, &old_client_rect ); + prev_window = sync_window_position( data, swp_flags, &old_window_rect, &old_whole_rect, &old_client_rect ); if ((new_style & WS_VISIBLE) && ((new_style & WS_MINIMIZE) || is_window_rect_mapped( rectWindow ))) @@ -3181,6 +3206,10 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, release_win_data( data ); if (needs_icon) fetch_icon_data( hwnd, 0, 0 ); if (needs_map) map_window( hwnd, new_style ); + + if (!(data = get_win_data( hwnd ))) return; + restack_windows( data, prev_window ); + release_win_data( data ); return; } else if ((swp_flags & SWP_STATECHANGED) && (!data->iconic != !(new_style & WS_MINIMIZE))) @@ -3197,10 +3226,20 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, else { if (swp_flags & (SWP_FRAMECHANGED|SWP_STATECHANGED)) set_wm_hints( data ); - if (!event_type || event_type == PropertyNotify) update_net_wm_states( data ); + if (!event_type || event_type == PropertyNotify) + { + update_net_wm_states( data ); + if (!prev_window && insert_after && data->net_wm_state & (1 << NET_WM_STATE_FULLSCREEN)) + { + prev_window = NtUserGetWindowRelative( hwnd, GW_HWNDPREV ); + if (prev_window != insert_after) prev_window = NULL; + } + } } } + restack_windows( data, prev_window ); + XFlush( data->display ); /* make sure changes are done before we start painting again */ if (data->surface && data->vis.visualid != default_visual.visualid) data->surface->funcs->flush( data->surface ); From a282dd8f5f82adee27363c65c843ba1b2baf6035 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 24 Jun 2022 18:53:58 -0500 Subject: [PATCH 0273/1506] winex11.drv: Add an option to always Increment configure_serial in X11DRV_WindowPosChanged(). And enable it for Dokyusei Bangin' Summer. CW-Bug-Id: #20665 --- dlls/winex11.drv/window.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index b90074ae65d..08e88ac4ddd 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3052,6 +3052,20 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, return TRUE; } +static BOOL option_increament_configure_serial(void) +{ + static int increment = -1; + if (increment == -1) + { + const char *e = getenv( "WINE_INCREMENT_CONFIGURE_SERIAL" ); + + if (e) + increment = atoi( e ); + else + increment = (e = getenv( "SteamGameId" )) && !strcmp( e, "1689910" ); + } + return increment; +} static void restack_windows( struct x11drv_win_data *data, HWND prev ) { @@ -3188,9 +3202,13 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, } /* don't change position if we are about to minimize or maximize a managed window */ - if ((!event_type || event_type == PropertyNotify) && - !(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE)))) - prev_window = sync_window_position( data, swp_flags, &old_window_rect, &old_whole_rect, &old_client_rect ); + if (!event_type || event_type == PropertyNotify) + { + if (!(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE)))) + prev_window = sync_window_position( data, swp_flags, &old_window_rect, &old_whole_rect, &old_client_rect ); + else if (option_increament_configure_serial()) + data->configure_serial = NextRequest( data->display ); + } if ((new_style & WS_VISIBLE) && ((new_style & WS_MINIMIZE) || is_window_rect_mapped( rectWindow ))) From 6e2a12b59dc406d4400e60c8a76ae877e301a8df Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Sun, 10 Oct 2021 20:53:45 +0200 Subject: [PATCH 0274/1506] HACK: winex11.drv: Workaround issue with Into The Breach fullscreen mode. --- dlls/winex11.drv/event.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 725540c3630..0d667410462 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1149,6 +1149,21 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) /* Compare what has changed */ + { + const char *steamgameid = getenv( "SteamGameId" ); + + if (steamgameid && !strcmp( steamgameid, "590380" )) + { + /* Into The Breach is extremely picky about the size of its window. */ + if (NtUserIsWindowRectFullScreen( &data->whole_rect ) && NtUserIsWindowRectFullScreen( &rect )) + { + TRACE( "window is fullscreen and new size is also fullscreen, so preserving window size\n" ); + rect.right = rect.left + (data->whole_rect.right - data->whole_rect.left); + rect.bottom = rect.top + (data->whole_rect.bottom - data->whole_rect.top); + } + } + } + x = rect.left; y = rect.top; cx = rect.right - rect.left; From e09b165ede56d30e2cd1b86364511a8e601a55cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Dec 2022 21:21:50 +0100 Subject: [PATCH 0275/1506] HACK: winex11.drv: Workaround focusing out of exclusive fullscreen windows. This retargets some old window manager workarounds which don't seem to be required anymore for the original issues but is still necessary to be able to focus out of exclusive fullscreen windows. Original commits were: commit e35f70c300b8f59e1d45e7c9d7b3b93d55741955 Author: Andrew Eikum Date: Tue Sep 18 08:11:59 2018 -0500 winex11: Don't set ABOVE on minimized fullscreened windows This is a workaround for mutter bug #306. commit 41022f9151475da15ec64a2ac64fd4830253e3f5 Author: Andrew Eikum Date: Mon Jun 1 09:18:35 2020 -0500 winex11.drv: Don't set ABOVE for fullscreen windows on KDE --- dlls/winex11.drv/window.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 08e88ac4ddd..4646eef1f90 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1270,7 +1270,15 @@ void update_net_wm_states( struct x11drv_win_data *data ) new_state |= (1 << NET_WM_STATE_MAXIMIZED); ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); - if (ex_style & WS_EX_TOPMOST) + if ((ex_style & WS_EX_TOPMOST) && + /* This workaround was initially targetting some mutter and KDE issues, but + * removing it causes failure to focus out from exclusive fullscreen windows. + * + * Many games do not have any specific logic to get out of exclusive fullscreen + * mode, and we have currently no way to tell exclusive fullscreen from a window + * with topmost + fullscreen styles, so we cannot properly implement it either. + */ + !(new_state & (1 << NET_WM_STATE_FULLSCREEN))) new_state |= (1 << NET_WM_STATE_ABOVE); if (!data->add_taskbar) { From 688629f89863226e3a7c5544d81d69bb639937c6 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sun, 10 Oct 2021 20:48:24 +0200 Subject: [PATCH 0276/1506] winex11.drv: Bypass compositor in fullscreen mode. Bypass the compositor in fullscreen mode. This reduces stutter introduced by window updates in the background and also allows for maybe a few more FPS. To not change the visual appearance of the desktop for windowed games, this hack only enables itself when the game was switched to fullscreen mode, and returns to default WM setting when the game leaves fullscreen mode. Compositors tend to cause severe stutter if the game is GPU-bound. --- dlls/winex11.drv/window.c | 5 +++++ dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 1 + 3 files changed, 7 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 4646eef1f90..95dc242fc31 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1239,6 +1239,7 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) */ void update_net_wm_states( struct x11drv_win_data *data ) { + unsigned long net_wm_bypass_compositor = 0; UINT i, style, ex_style, new_state = 0; HMONITOR monitor; @@ -1262,6 +1263,7 @@ void update_net_wm_states( struct x11drv_win_data *data ) if (!wm_is_steamcompmgr( data->display ) || !fs_hack_enabled( monitor )) { /* when fs hack is enabled, we don't want steamcompmgr to resize the window to be fullscreened */ + net_wm_bypass_compositor = 1; new_state |= (1 << NET_WM_STATE_FULLSCREEN); } } @@ -1342,6 +1344,9 @@ void update_net_wm_states( struct x11drv_win_data *data ) } data->net_wm_state = new_state; update_net_wm_fullscreen_monitors( data ); + + XChangeProperty( data->display, data->whole_window, x11drv_atom(_NET_WM_BYPASS_COMPOSITOR), XA_CARDINAL, + 32, PropModeReplace, (unsigned char *)&net_wm_bypass_compositor, 1 ); } /*********************************************************************** diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 114a5825baf..cf50feccb80 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -504,6 +504,7 @@ enum x11drv_atoms XATOM__NET_SYSTEM_TRAY_OPCODE, XATOM__NET_SYSTEM_TRAY_S0, XATOM__NET_SYSTEM_TRAY_VISUAL, + XATOM__NET_WM_BYPASS_COMPOSITOR, XATOM__NET_WM_FULLSCREEN_MONITORS, XATOM__NET_WM_ICON, XATOM__NET_WM_MOVERESIZE, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index ccde7455f84..f2d00cada55 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -167,6 +167,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "_NET_SYSTEM_TRAY_OPCODE", "_NET_SYSTEM_TRAY_S0", "_NET_SYSTEM_TRAY_VISUAL", + "_NET_WM_BYPASS_COMPOSITOR", "_NET_WM_FULLSCREEN_MONITORS", "_NET_WM_ICON", "_NET_WM_MOVERESIZE", From 3275587df4928842285e449065b2b8fa508076ed Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 6 Apr 2020 15:30:40 +0800 Subject: [PATCH 0277/1506] winex11.drv: Bypass compositor only when a window is full virtual screen. Bypass compositor only when a window is full virtual screen. Otherwise, it might cause flicking on other monitors. Signed-off-by: Zhiyi Zhang --- dlls/winex11.drv/window.c | 10 +++++++++- dlls/winex11.drv/x11drv.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 95dc242fc31..f04087e90fd 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -388,6 +388,13 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl return NtUserIsWindowRectFullScreen( &data->whole_rect ); } +BOOL is_window_rect_full_virtual_screen( const RECT *rect ) +{ + RECT virtual_rect = NtUserGetVirtualScreenRect(); + return (rect->left <= virtual_rect.left && rect->right >= virtual_rect.right && + rect->top <= virtual_rect.top && rect->bottom >= virtual_rect.bottom); +} + /*********************************************************************** * get_mwm_decorations */ @@ -1263,7 +1270,8 @@ void update_net_wm_states( struct x11drv_win_data *data ) if (!wm_is_steamcompmgr( data->display ) || !fs_hack_enabled( monitor )) { /* when fs hack is enabled, we don't want steamcompmgr to resize the window to be fullscreened */ - net_wm_bypass_compositor = 1; + if (is_window_rect_full_virtual_screen( &data->whole_rect )) + net_wm_bypass_compositor = 1; new_state |= (1 << NET_WM_STATE_FULLSCREEN); } } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index cf50feccb80..a7d836c3704 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -754,6 +754,8 @@ extern BOOL xinerama_get_fullscreen_monitors( const RECT *rect, long *indices ); extern void xinerama_init( unsigned int width, unsigned int height ); extern void init_recursive_mutex( pthread_mutex_t *mutex ); +extern BOOL is_window_rect_full_virtual_screen( const RECT *rect ); + #define DEPTH_COUNT 3 extern const unsigned int *depths; From 0cbf019a7c0f6d573341257405d6ecb0529eaf8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 3 Dec 2023 12:18:27 +0100 Subject: [PATCH 0278/1506] winex11.drv: Do not move window with _NET_WM_STATE_FULLSCREEN set. Signed-off-by: Zhiyi Zhang --- dlls/winex11.drv/window.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f04087e90fd..1eb2927c12a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1581,6 +1581,7 @@ static HWND sync_window_position( struct x11drv_win_data *data, { DWORD style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); DWORD ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); + RECT original_rect = {0}; HWND prev_window = NULL; XWindowChanges changes; unsigned int mask = 0; @@ -1640,10 +1641,21 @@ static HWND sync_window_position( struct x11drv_win_data *data, set_size_hints( data, style ); set_mwm_hints( data, style, ex_style ); + /* KWin doesn't allow moving a window with _NET_WM_STATE_FULLSCREEN set. So we need to remove + * _NET_WM_STATE_FULLSCREEN before moving the window and restore it later */ + if (wm_is_kde( data->display ) && NtUserIsWindowRectFullScreen( &data->whole_rect )) + { + original_rect = data->whole_rect; + SetRectEmpty( &data->whole_rect ); + } update_net_wm_states( data ); data->configure_serial = NextRequest( data->display ); XReconfigureWMWindow( data->display, data->whole_window, data->vis.screen, mask, &changes ); - + if (!IsRectEmpty( &original_rect )) + { + data->whole_rect = original_rect; + update_net_wm_states( data ); + } #ifdef HAVE_LIBXSHAPE if (IsRectEmpty( old_window_rect ) != IsRectEmpty( &data->window_rect )) sync_window_region( data, (HRGN)1 ); From b16eaf883ddf4df60ff984a4ce7a312713bcde3a Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 11 Nov 2020 10:41:42 +0800 Subject: [PATCH 0279/1506] winex11.drv: Call XIconifyWindow() after XMapWindow() with a minimized window. Mutter always unminimizes a window when handling map requests. So a window could be in normal state as far as Mutter concerns while Wine mistakenly considers it still minimized. Fix Disgaea PC black screen after Alt+Tab in fullscreen mode. CW-Bug-Id: #18364 Signed-off-by: Zhiyi Zhang --- dlls/winex11.drv/window.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1eb2927c12a..73c42083618 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1439,6 +1439,9 @@ static void map_window( HWND hwnd, DWORD new_style ) update_net_wm_states( data ); sync_window_style( data ); XMapWindow( data->display, data->whole_window ); + /* Mutter always unminimizes windows when handling map requests. Restore iconic state */ + if (new_style & WS_MINIMIZE) + XIconifyWindow( data->display, data->whole_window, data->vis.screen ); XFlush( data->display ); if (data->surface && data->vis.visualid != default_visual.visualid) data->surface->funcs->flush( data->surface ); @@ -3269,9 +3272,17 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, data->iconic = (new_style & WS_MINIMIZE) != 0; TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic ); if (data->iconic) + { XIconifyWindow( data->display, data->whole_window, data->vis.screen ); + } else if (is_window_rect_mapped( rectWindow )) + { + /* whole_window could be both iconic and mapped. Since XMapWindow() doesn't do + * anything if the window is already mapped, we need to unmap it first */ + if (data->mapped) + XUnmapWindow( data->display, data->whole_window ); XMapWindow( data->display, data->whole_window ); + } update_net_wm_states( data ); } else From ab58c997dc75afe217e6f14a903dd52126b1dcce Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Jun 2022 13:52:21 -0500 Subject: [PATCH 0280/1506] winex11.drv: HACK: Add timeout for unmap_notify wait in set_mwm_hints(). This is a change to the old hack: "HACK: mutter: winex11.drv: Workaround mutter issue #649." In case the earlier messages have not been processed yet the wait may hang forever. An example of such sequence is hiding a window and then changing (possible another window's) styles without pumping messages in between. Indirectly related to Bug #20769, Bug #16369. CW-Bug-Id: #20769 CW-Bug-Id: #16369 --- dlls/winex11.drv/window.c | 41 +++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 73c42083618..1dea131c85e 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -26,6 +26,7 @@ #include "config.h" +#include #include #include #include @@ -849,12 +850,21 @@ static void set_size_hints( struct x11drv_win_data *data, DWORD style ) XFree( size_hints ); } +struct is_unmap_notify_param +{ + struct x11drv_win_data *data; + BOOL found; +}; + static Bool is_unmap_notify( Display *display, XEvent *event, XPointer arg ) { - struct x11drv_win_data *data = (struct x11drv_win_data *)arg; - return event->xany.serial >= data->unmapnotify_serial && - event->xany.window == data->whole_window && - event->type == UnmapNotify; + struct is_unmap_notify_param *p = (struct is_unmap_notify_param *)arg; + + if (!p->found) + p->found = event->type == UnmapNotify && + event->xany.serial >= p->data->unmapnotify_serial && + event->xany.window == p->data->whole_window; + return False; } /*********************************************************************** @@ -920,18 +930,33 @@ static void set_mwm_hints( struct x11drv_win_data *data, UINT style, UINT ex_sty x11drv_atom(_MOTIF_WM_HINTS), 32, PropModeReplace, (unsigned char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) ); - if (enable_mutter_workaround) + if (enable_mutter_workaround && mapped) { + DWORD end = NtGetTickCount() + 100; + struct is_unmap_notify_param p; + struct pollfd pfd; XEvent event; + int timeout; /* workaround for mutter gitlab bug #649, wait for the map notify * event each time the decorations are modified before modifying * them again. */ - if (mapped) + p.data = data; + p.found = FALSE; + TRACE("workaround mutter bug #649, waiting for UnmapNotify\n"); + pfd.fd = ConnectionNumber(data->display); + pfd.events = POLLIN; + for (;;) { - TRACE("workaround mutter bug #649, waiting for UnmapNotify\n"); - XPeekIfEvent( data->display, &event, is_unmap_notify, (XPointer)data ); + XCheckIfEvent( data->display, &event, is_unmap_notify, (XPointer)&p ); + if (p.found) break; + timeout = end - NtGetTickCount(); + if (timeout <= 0 || poll( &pfd, 1, timeout ) != 1) + { + WARN( "window %p/%lx unmap_notify wait timed out.\n", data->hwnd, data->whole_window ); + break; + } } } From b161c69143ab580a0d67536980af0bfbe8a77b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 5 Apr 2023 16:20:15 +0200 Subject: [PATCH 0281/1506] winex11: Avoid updating fullscreen monitor info when minimized. CW-Bug-Id: #22105 --- dlls/winex11.drv/window.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1dea131c85e..d1ca193fa1f 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1376,7 +1376,9 @@ void update_net_wm_states( struct x11drv_win_data *data ) } } data->net_wm_state = new_state; - update_net_wm_fullscreen_monitors( data ); + + if (!(style & WS_MINIMIZE)) + update_net_wm_fullscreen_monitors( data ); XChangeProperty( data->display, data->whole_window, x11drv_atom(_NET_WM_BYPASS_COMPOSITOR), XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&net_wm_bypass_compositor, 1 ); From 4040413e3ed35e1e43e033fc8017e94ea968a6da Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 14 Aug 2023 17:17:05 +0800 Subject: [PATCH 0282/1506] winex11.drv: Set _NET_WM_FULLSCREEN_MONITORS only when necessary. If _NET_WM_FULLSCREEN_MONITORS is set then the property needs to be updated because it can't be deleted by sending a _NET_WM_FULLSCREEN_MONITORS client message to the root window according to the wm-spec version 1.4. Having the window spanning more than two monitors also needs the property set. In other cases, _NET_WM_FULLSCREEN_MONITORS doesn't need to be set. What's more, setting _NET_WM_FULLSCREEN_MONITORS adds a constraint on Mutter so that such a window can't be moved to another monitor by using the Shift+Super+Up/Down/Left/Right shortcut. So the property should be added only when necessary. CW-Bug-Id: #22540 --- dlls/winex11.drv/window.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d1ca193fa1f..c952a40f623 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1244,6 +1244,38 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) && !data->net_wm_fullscreen_monitors_set) return; + /* If _NET_WM_FULLSCREEN_MONITORS is not set and the fullscreen monitors are spanning only one + * monitor then do not set _NET_WM_FULLSCREEN_MONITORS. + * + * If _NET_WM_FULLSCREEN_MONITORS is set then the property needs to be updated because it can't + * be deleted by sending a _NET_WM_FULLSCREEN_MONITORS client message to the root window + * according to the wm-spec version 1.4. Having the window spanning more than two monitors also + * needs the property set. In other cases, _NET_WM_FULLSCREEN_MONITORS doesn't need to be set. + * What's more, setting _NET_WM_FULLSCREEN_MONITORS adds a constraint on Mutter so that such a + * window can't be moved to another monitor by using the Shift+Super+Up/Down/Left/Right + * shortcut. So the property should be added only when necessary. */ + if (monitors[0] == monitors[1] && monitors[1] == monitors[2] && monitors[2] == monitors[3]) + { + unsigned long count, remaining; + BOOL prop_found = FALSE; + long *prop_data; + int format; + Atom type; + + if (!XGetWindowProperty( data->display, data->whole_window, + x11drv_atom(_NET_WM_FULLSCREEN_MONITORS), 0, ~0, False, + XA_CARDINAL, &type, &format, &count, &remaining, + (unsigned char **)&prop_data )) + { + if (type == XA_CARDINAL && format == 32 && count == 4) + prop_found = TRUE; + XFree(prop_data); + } + + if (!prop_found) + return; + } + if (!data->mapped) { XChangeProperty( data->display, data->whole_window, x11drv_atom(_NET_WM_FULLSCREEN_MONITORS), From d9533153241c145630ab33771aa530de95a6743f Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 6 Nov 2020 12:20:16 -0600 Subject: [PATCH 0283/1506] Revert "winex11.drv: Interpret mouse 6/7 as horiz scroll." This reverts commit 893080e4df5a45929320ebb88b8668eea316476c. We have a trade-off here between supporting horizontal scroll, or mapping those actions to the XBUTTON{1,2} messages. Some users were using those buttons in their games, which broke with this change. It seems more likely that the extra button mapping will be useful than horizontal scrolling, so let's revert this commit. --- dlls/winex11.drv/mouse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 8c0968ed2d3..39df342bbc5 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -75,8 +75,8 @@ static const UINT button_down_flags[NB_BUTTONS] = MOUSEEVENTF_RIGHTDOWN, MOUSEEVENTF_WHEEL, MOUSEEVENTF_WHEEL, - MOUSEEVENTF_HWHEEL, - MOUSEEVENTF_HWHEEL, + MOUSEEVENTF_XDOWN, /* FIXME: horizontal wheel */ + MOUSEEVENTF_XDOWN, MOUSEEVENTF_XDOWN, MOUSEEVENTF_XDOWN }; @@ -88,8 +88,8 @@ static const UINT button_up_flags[NB_BUTTONS] = MOUSEEVENTF_RIGHTUP, 0, 0, - 0, - 0, + MOUSEEVENTF_XUP, + MOUSEEVENTF_XUP, MOUSEEVENTF_XUP, MOUSEEVENTF_XUP }; @@ -101,8 +101,8 @@ static const UINT button_down_data[NB_BUTTONS] = 0, WHEEL_DELTA, -WHEEL_DELTA, - -WHEEL_DELTA, - WHEEL_DELTA, + XBUTTON1, + XBUTTON2, XBUTTON1, XBUTTON2 }; @@ -114,8 +114,8 @@ static const UINT button_up_data[NB_BUTTONS] = 0, 0, 0, - 0, - 0, + XBUTTON1, + XBUTTON2, XBUTTON1, XBUTTON2 }; From 76404a4580711e346de467cddb8c712b72e385e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Jan 2020 12:45:32 +0100 Subject: [PATCH 0284/1506] winex11.drv: Rename EVENT_x11_time_to_win32_time to x11drv_time_to_ticks. --- dlls/winex11.drv/event.c | 8 ++++---- dlls/winex11.drv/keyboard.c | 2 +- dlls/winex11.drv/mouse.c | 10 +++++----- dlls/winex11.drv/wintab.c | 6 +++--- dlls/winex11.drv/x11drv.h | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 0d667410462..9f4ec8fb364 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -493,12 +493,12 @@ BOOL X11DRV_ProcessEvents( DWORD mask ) } /*********************************************************************** - * EVENT_x11_time_to_win32_time + * x11drv_time_to_ticks * * Make our timer and the X timer line up as best we can * Pass 0 to retrieve the current adjustment value (times -1) */ -DWORD EVENT_x11_time_to_win32_time(Time time) +DWORD x11drv_time_to_ticks( Time time ) { static DWORD adjust = 0; DWORD now = NtGetTickCount(); @@ -559,10 +559,10 @@ static void set_input_focus( struct x11drv_win_data *data ) if (!data->whole_window) return; - if (EVENT_x11_time_to_win32_time(0)) + if (x11drv_time_to_ticks(0)) /* ICCCM says don't use CurrentTime, so try to use last message time if possible */ /* FIXME: this is not entirely correct */ - timestamp = NtUserGetThreadInfo()->message_time - EVENT_x11_time_to_win32_time(0); + timestamp = NtUserGetThreadInfo()->message_time - x11drv_time_to_ticks(0); else timestamp = CurrentTime; diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 5c7f6c37276..8fa45d9551c 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1353,7 +1353,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) DWORD dwFlags; int ascii_chars; XIC xic = X11DRV_get_ic( hwnd ); - DWORD event_time = EVENT_x11_time_to_win32_time(event->time); + DWORD event_time = x11drv_time_to_ticks( event->time ); Status status = 0; TRACE_(key)("type %d, window %lx, state 0x%04x, keycode %u\n", diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 39df342bbc5..38d44c38e33 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1561,7 +1561,7 @@ BOOL X11DRV_ButtonPress( HWND hwnd, XEvent *xev ) input.mi.dy = event->y; input.mi.mouseData = button_down_data[buttonNum]; input.mi.dwFlags = button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; - input.mi.time = EVENT_x11_time_to_win32_time( event->time ); + input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; update_user_time( event->time ); @@ -1588,7 +1588,7 @@ BOOL X11DRV_ButtonRelease( HWND hwnd, XEvent *xev ) input.mi.dy = event->y; input.mi.mouseData = button_up_data[buttonNum]; input.mi.dwFlags = button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; - input.mi.time = EVENT_x11_time_to_win32_time( event->time ); + input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; map_event_coords( hwnd, event->window, event->root, event->x_root, event->y_root, &input ); @@ -1612,7 +1612,7 @@ BOOL X11DRV_MotionNotify( HWND hwnd, XEvent *xev ) input.mi.dy = event->y; input.mi.mouseData = 0; input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; - input.mi.time = EVENT_x11_time_to_win32_time( event->time ); + input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; if (!hwnd && is_old_motion_event( event->serial )) @@ -1645,7 +1645,7 @@ BOOL X11DRV_EnterNotify( HWND hwnd, XEvent *xev ) input.mi.dy = event->y; input.mi.mouseData = 0; input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; - input.mi.time = EVENT_x11_time_to_win32_time( event->time ); + input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; if (is_old_motion_event( event->serial )) @@ -1783,7 +1783,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.type = INPUT_MOUSE; input.mi.mouseData = 0; input.mi.dwFlags = MOUSEEVENTF_MOVE; - input.mi.time = EVENT_x11_time_to_win32_time( event->time ); + input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; input.mi.dx = 0; input.mi.dy = 0; diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index 6f1437f14c6..7855175a29b 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -895,7 +895,7 @@ static BOOL motion_event( HWND hwnd, XEvent *event ) /* Set cursor to inverted if cursor is the eraser */ gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0); - gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(motion->time); + gMsgPacket.pkTime = x11drv_time_to_ticks(motion->time); gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkCursor = curnum; gMsgPacket.pkX = motion->axis_data[0]; @@ -928,7 +928,7 @@ static BOOL button_event( HWND hwnd, XEvent *event ) /* Set cursor to inverted if cursor is the eraser */ gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0); set_button_state(curnum, button->deviceid); - gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(button->time); + gMsgPacket.pkTime = x11drv_time_to_ticks(button->time); gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkCursor = curnum; if (button->axes_count > 0) { @@ -978,7 +978,7 @@ static BOOL proximity_event( HWND hwnd, XEvent *event ) /* Set cursor to inverted if cursor is the eraser */ gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0); gMsgPacket.pkStatus |= (event->type==proximity_out_type)?TPS_PROXIMITY:0; - gMsgPacket.pkTime = EVENT_x11_time_to_win32_time(proximity->time); + gMsgPacket.pkTime = x11drv_time_to_ticks(proximity->time); gMsgPacket.pkSerialNumber = gSerial++; gMsgPacket.pkCursor = curnum; gMsgPacket.pkX = proximity->axis_data[0]; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a7d836c3704..4d6297ebcbd 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -597,7 +597,7 @@ extern int xinput2_opcode; extern Bool (*pXGetEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event ); extern void (*pXFreeEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event ); -extern DWORD EVENT_x11_time_to_win32_time(Time time); +extern DWORD x11drv_time_to_ticks( Time time ); /* X11 driver private messages */ enum x11drv_window_messages From 55549a2319f7727e2e22052b1d1b94af26d4d792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Jan 2020 16:33:11 +0100 Subject: [PATCH 0285/1506] winex11.drv: Split XInput2 thread initialization. And rename the library and function loader to X11DRV_XInput2_Load. --- dlls/winex11.drv/mouse.c | 42 ++++++++++++++++++++++------------ dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 4 +++- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 38d44c38e33..04dd95ec4e3 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -253,6 +253,30 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator } +/*********************************************************************** + * X11DRV_XInput2_Init + */ +void X11DRV_XInput2_Init(void) +{ +#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H + struct x11drv_thread_data *data = x11drv_thread_data(); + int major = 2, minor = 0; + + if (xinput2_available && + !pXIQueryVersion( data->display, &major, &minor )) + { + TRACE( "XInput2 %d.%d available\n", major, minor ); + data->xi2_state = xi_disabled; + } + else + { + data->xi2_state = xi_unavailable; + WARN( "XInput 2.0 not available\n" ); + } +#endif +} + + /*********************************************************************** * enable_xinput2 */ @@ -264,19 +288,7 @@ static void enable_xinput2(void) unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; int count; - if (!xinput2_available) return; - - if (data->xi2_state == xi_unknown) - { - int major = 2, minor = 0; - if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled; - else - { - data->xi2_state = xi_unavailable; - WARN( "X Input 2 not available\n" ); - } - } - if (data->xi2_state == xi_unavailable) return; + if (data->xi2_state != xi_disabled) return; if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return; mask.mask = mask_bits; @@ -1797,9 +1809,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) /*********************************************************************** - * X11DRV_XInput2_Init + * X11DRV_XInput2_Load */ -void X11DRV_XInput2_Init(void) +void X11DRV_XInput2_Load(void) { #if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H) int event, error; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 4d6297ebcbd..9b703487fae 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -267,6 +267,7 @@ extern void X11DRV_ThreadDetach(void); /* X11 driver internal functions */ extern void X11DRV_Xcursor_Init(void); +extern void X11DRV_XInput2_Load(void); extern void X11DRV_XInput2_Init(void); extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index f2d00cada55..7f61b136eac 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -735,7 +735,7 @@ static NTSTATUS x11drv_init( void *arg ) #ifdef SONAME_LIBXCOMPOSITE X11DRV_XComposite_Init(); #endif - X11DRV_XInput2_Init(); + X11DRV_XInput2_Load(); XkbUseExtension( gdi_display, NULL, NULL ); X11DRV_InitKeyboard( gdi_display ); @@ -849,6 +849,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) if (use_xim) xim_thread_attach( data ); + X11DRV_XInput2_Init(); + return data; } From 31ecb3bf00630c855bcf2543b9920dc9a496f9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 14 Nov 2021 14:09:48 +0100 Subject: [PATCH 0286/1506] winex11.drv: Advertise XInput2 version 2.1 support. Under XInput2 protocol version < 2.1, RawEvents are not supposed to be sent if a pointer grab is active. However slave device events are still received regardless of this specification and Wine implemented a workaround to receive RawEvents during pointer grabs by listening to these slave device events. Then, as soon as a mouse button is pressed only the grabbing client will receive the raw motion events. By advertising the support of XInput2 version >= 2.1, where RawEvents are sent even during pointer grabs, we ensure to receive the RawMotion events from the desktop window thread, even if a mouse grab is active. It is now also possible to simplify the code by listening to master device events only and get rid of slave device id tracking. --- dlls/winex11.drv/mouse.c | 46 ++++++++------------------------------- dlls/winex11.drv/x11drv.h | 3 --- 2 files changed, 9 insertions(+), 40 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 04dd95ec4e3..3a9413b88bc 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -260,7 +260,7 @@ void X11DRV_XInput2_Init(void) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H struct x11drv_thread_data *data = x11drv_thread_data(); - int major = 2, minor = 0; + int major = 2, minor = 1; if (xinput2_available && !pXIQueryVersion( data->display, &major, &minor )) @@ -271,7 +271,7 @@ void X11DRV_XInput2_Init(void) else { data->xi2_state = xi_unavailable; - WARN( "XInput 2.0 not available\n" ); + WARN( "XInput 2.1 not available\n" ); } #endif } @@ -293,7 +293,7 @@ static void enable_xinput2(void) mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); - mask.deviceid = XIAllDevices; + mask.deviceid = XIAllMasterDevices; memset( mask_bits, 0, sizeof(mask_bits) ); XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); @@ -305,16 +305,6 @@ static void enable_xinput2(void) update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); pXIFreeDeviceInfo( pointer_info ); - /* This device info list is only used to find the initial current slave if - * no XI_DeviceChanged events happened. If any hierarchy change occurred that - * might be relevant here (eg. user switching mice after (un)plugging), a - * XI_DeviceChanged event will point us to the right slave. So this list is - * safe to be obtained statically at enable_xinput2() time. - */ - if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices ); - data->xi2_devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count ); - data->xi2_current_slave = 0; - data->xi2_state = xi_enabled; } @@ -336,17 +326,15 @@ static void disable_xinput2(void) mask.mask = NULL; mask.mask_len = 0; - mask.deviceid = XIAllDevices; + mask.deviceid = XIAllMasterDevices; pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); - pXIFreeDeviceInfo( data->xi2_devices ); + data->x_valuator.number = -1; data->y_valuator.number = -1; data->x_valuator.value = 0; data->y_valuator.value = 0; - data->xi2_devices = NULL; data->xi2_core_pointer = 0; - data->xi2_current_slave = 0; #endif } @@ -544,6 +532,8 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x input->mi.dy = pt.y; } + + /*********************************************************************** * send_mouse_input * @@ -1684,7 +1674,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) if (event->reason != XISlaveSwitch) return FALSE; update_relative_valuators( event->classes, event->num_classes ); - data->xi2_current_slave = event->sourceid; return TRUE; } @@ -1700,25 +1689,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (x->number < 0 || y->number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; if (thread_data->xi2_state != xi_enabled) return FALSE; - - /* If there is no slave currently detected, no previous motion nor device - * change events were received. Look it up now on the device list in this - * case. - */ - if (!thread_data->xi2_current_slave) - { - XIDeviceInfo *devices = thread_data->xi2_devices; - - for (i = 0; i < thread_data->xi2_device_count; i++) - { - if (devices[i].use != XISlavePointer) continue; - if (devices[i].deviceid != event->deviceid) continue; - if (devices[i].attachment != thread_data->xi2_core_pointer) continue; - thread_data->xi2_current_slave = event->deviceid; - break; - } - } - if (event->deviceid != thread_data->xi2_current_slave) return FALSE; + if (event->deviceid != thread_data->xi2_core_pointer) return FALSE; virtual_rect = NtUserGetVirtualScreenRect(); @@ -1778,6 +1749,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) return TRUE; } + /*********************************************************************** * X11DRV_RawMotion */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9b703487fae..472a0538dd4 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -399,12 +399,9 @@ struct x11drv_thread_data BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */ - void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */ - int xi2_device_count; XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; int xi2_core_pointer; /* XInput2 core pointer id */ - int xi2_current_slave; /* Current slave driving the Core pointer */ #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ }; From 055b0958fb880e3543486beca7058bc640c707ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 14 Nov 2021 14:35:52 +0100 Subject: [PATCH 0287/1506] winex11.drv: Check for XInput2 core pointer on initialization. --- dlls/winex11.drv/mouse.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 3a9413b88bc..ae4f00f0d43 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -262,14 +262,15 @@ void X11DRV_XInput2_Init(void) struct x11drv_thread_data *data = x11drv_thread_data(); int major = 2, minor = 1; - if (xinput2_available && - !pXIQueryVersion( data->display, &major, &minor )) + if (xinput2_available && pXIQueryVersion( data->display, &major, &minor ) == Success && + pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) { TRACE( "XInput2 %d.%d available\n", major, minor ); data->xi2_state = xi_disabled; } else { + data->xi2_core_pointer = 0; data->xi2_state = xi_unavailable; WARN( "XInput 2.1 not available\n" ); } @@ -289,7 +290,6 @@ static void enable_xinput2(void) int count; if (data->xi2_state != xi_disabled) return; - if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return; mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); @@ -334,7 +334,6 @@ static void disable_xinput2(void) data->y_valuator.number = -1; data->x_valuator.value = 0; data->y_valuator.value = 0; - data->xi2_core_pointer = 0; #endif } From 5808e3d4718ed9575201dc1e013256b38d836faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 14 Nov 2021 14:38:45 +0100 Subject: [PATCH 0288/1506] winex11.drv: Reset XInput2 valuators only on DeviceChange events. --- dlls/winex11.drv/mouse.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index ae4f00f0d43..b36622fb895 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -329,11 +329,6 @@ static void disable_xinput2(void) mask.deviceid = XIAllMasterDevices; pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); - - data->x_valuator.number = -1; - data->y_valuator.number = -1; - data->x_valuator.value = 0; - data->y_valuator.value = 0; #endif } From ed3b7c9f184e6c423516525b602345c809a3cdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 14 Nov 2021 14:39:51 +0100 Subject: [PATCH 0289/1506] winex11.drv: Stop tracking XInput2 enabled state. It should not be very useful anymore and it'll be meaningless later. --- dlls/winex11.drv/mouse.c | 21 --------------------- dlls/winex11.drv/x11drv.h | 1 - 2 files changed, 22 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index b36622fb895..2eb3a134850 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -264,14 +264,10 @@ void X11DRV_XInput2_Init(void) if (xinput2_available && pXIQueryVersion( data->display, &major, &minor ) == Success && pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) - { TRACE( "XInput2 %d.%d available\n", major, minor ); - data->xi2_state = xi_disabled; - } else { data->xi2_core_pointer = 0; - data->xi2_state = xi_unavailable; WARN( "XInput 2.1 not available\n" ); } #endif @@ -289,8 +285,6 @@ static void enable_xinput2(void) unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; int count; - if (data->xi2_state != xi_disabled) return; - mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); mask.deviceid = XIAllMasterDevices; @@ -304,8 +298,6 @@ static void enable_xinput2(void) pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count ); update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); pXIFreeDeviceInfo( pointer_info ); - - data->xi2_state = xi_enabled; } #endif @@ -319,11 +311,6 @@ static void disable_xinput2(void) struct x11drv_thread_data *data = x11drv_thread_data(); XIEventMask mask; - if (data->xi2_state != xi_enabled) return; - - TRACE( "disabling\n" ); - data->xi2_state = xi_disabled; - mask.mask = NULL; mask.mask_len = 0; mask.deviceid = XIAllMasterDevices; @@ -364,13 +351,6 @@ static BOOL grab_clipping_window( const RECT *clip ) /* enable XInput2 unless we are already clipping */ if (!data->clipping_cursor) enable_xinput2(); - if (data->xi2_state != xi_enabled) - { - WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) ); - NtUserClipCursor( NULL ); - return TRUE; - } - TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window ); if (!data->clipping_cursor) XUnmapWindow( data->display, clip_window ); @@ -1682,7 +1662,6 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (x->number < 0 || y->number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; - if (thread_data->xi2_state != xi_enabled) return FALSE; if (event->deviceid != thread_data->xi2_core_pointer) return FALSE; virtual_rect = NtUserGetVirtualScreenRect(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 472a0538dd4..337dc88d65a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -398,7 +398,6 @@ struct x11drv_thread_data Window clip_window; /* window used for cursor clipping */ BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */ XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; int xi2_core_pointer; /* XInput2 core pointer id */ From 2805a7ccd86d19ec8bbd98ac922498a86def61bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 19 Dec 2019 22:34:44 +0100 Subject: [PATCH 0290/1506] winex11.drv: Keep track of pointer and device button mappings. We are going to receive raw button events and we will need to apply the correct button mappings ourselves. Original patch by Andrew Eikum . --- dlls/winex11.drv/keyboard.c | 23 ++++++--- dlls/winex11.drv/mouse.c | 92 +++++++++++++++++++++++++++++++--- dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 1 + 4 files changed, 104 insertions(+), 13 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 8fa45d9551c..6a199a0afbf 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1848,13 +1848,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event ) { HWND hwnd; - XRefreshKeyboardMapping(&event->xmapping); - X11DRV_InitKeyboard( event->xmapping.display ); + switch (event->xmapping.request) + { + case MappingModifier: + case MappingKeyboard: + XRefreshKeyboardMapping( &event->xmapping ); + X11DRV_InitKeyboard( event->xmapping.display ); + + hwnd = get_focus(); + if (!hwnd) hwnd = get_active_window(); + NtUserPostMessage( hwnd, WM_INPUTLANGCHANGEREQUEST, + 0 /*FIXME*/, (LPARAM)NtUserGetKeyboardLayout(0) ); + break; + + case MappingPointer: + X11DRV_InitMouse( event->xmapping.display ); + break; + } - hwnd = get_focus(); - if (!hwnd) hwnd = get_active_window(); - NtUserPostMessage( hwnd, WM_INPUTLANGCHANGEREQUEST, - 0 /*FIXME*/, (LPARAM)NtUserGetKeyboardLayout(0) ); return TRUE; } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 2eb3a134850..0884ee3dc26 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -30,6 +30,9 @@ #include #include #include +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H +#include +#endif #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H #include #endif @@ -137,6 +140,14 @@ MAKE_FUNCPTR(XISelectEvents); #undef MAKE_FUNCPTR #endif +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H +#define MAKE_FUNCPTR(f) static typeof(f) * p##f +MAKE_FUNCPTR(XOpenDevice); +MAKE_FUNCPTR(XCloseDevice); +MAKE_FUNCPTR(XGetDeviceButtonMapping); +#undef MAKE_FUNCPTR +#endif + /*********************************************************************** * X11DRV_Xcursor_Init * @@ -224,6 +235,65 @@ void set_window_cursor( Window window, HCURSOR handle ) XFlush( gdi_display ); } +struct mouse_button_mapping +{ + int deviceid; + unsigned int button_count; + unsigned char buttons[256]; +}; + +static struct mouse_button_mapping *pointer_mapping; + +static void update_pointer_mapping( Display *display ) +{ + struct mouse_button_mapping *tmp; + + if (!(tmp = malloc( sizeof(*tmp) ))) + { + WARN("Unable to allocate device mapping.\n"); + return; + } + + tmp->button_count = ARRAY_SIZE( tmp->buttons ); + tmp->button_count = XGetPointerMapping( display, tmp->buttons, tmp->button_count ); + + free( InterlockedExchangePointer( (void**)&pointer_mapping, tmp ) ); +} + +static void update_device_mapping( Display *display, int deviceid ) +{ +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H + struct mouse_button_mapping *tmp; + XDevice *device; + + if (!(device = pXOpenDevice( display, deviceid ))) + { + WARN( "Unable to open cursor device %d\n", deviceid ); + return; + } + + if (!(tmp = malloc( sizeof(*tmp) ))) + { + WARN( "Unable to allocate device mapping.\n" ); + pXCloseDevice( display, device ); + return; + } + + tmp->deviceid = deviceid; + tmp->button_count = ARRAY_SIZE( tmp->buttons ); + tmp->button_count = pXGetDeviceButtonMapping( display, device, tmp->buttons, tmp->button_count ); + + free( InterlockedExchangePointer( (void**)&device_mapping, tmp ) ); + + pXCloseDevice( display, device ); +#endif +} + +void X11DRV_InitMouse( Display *display ) +{ + update_pointer_mapping( display ); +} + #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H /*********************************************************************** * update_relative_valuators @@ -1637,17 +1707,18 @@ BOOL X11DRV_EnterNotify( HWND hwnd, XEvent *xev ) #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H /*********************************************************************** - * X11DRV_DeviceChanged + * X11DRV_XIDeviceChangedEvent */ -static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) +static BOOL X11DRV_XIDeviceChangedEvent( XIDeviceChangedEvent *event ) { - XIDeviceChangedEvent *event = xev->data; struct x11drv_thread_data *data = x11drv_thread_data(); if (event->deviceid != data->xi2_core_pointer) return FALSE; if (event->reason != XISlaveSwitch) return FALSE; update_relative_valuators( event->classes, event->num_classes ); + update_device_mapping( event->display, event->sourceid ); + return TRUE; } @@ -1752,13 +1823,12 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ - /*********************************************************************** * X11DRV_XInput2_Load */ void X11DRV_XInput2_Load(void) { -#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H) +#if defined(SONAME_LIBXI) int event, error; void *libxi_handle = dlopen( SONAME_LIBXI, RTLD_NOW ); @@ -1774,11 +1844,20 @@ void X11DRV_XInput2_Load(void) return; \ } +#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H LOAD_FUNCPTR(XIGetClientPointer); LOAD_FUNCPTR(XIFreeDeviceInfo); LOAD_FUNCPTR(XIQueryDevice); LOAD_FUNCPTR(XIQueryVersion); LOAD_FUNCPTR(XISelectEvents); +#endif + +#ifdef HAVE_X11_EXTENSIONS_XINPUT_H + LOAD_FUNCPTR(XOpenDevice); + LOAD_FUNCPTR(XCloseDevice); + LOAD_FUNCPTR(XGetDeviceButtonMapping); +#endif + #undef LOAD_FUNCPTR xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error ); @@ -1809,8 +1888,7 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) switch (event->evtype) { case XI_DeviceChanged: - ret = X11DRV_DeviceChanged( event ); - break; + return X11DRV_XIDeviceChangedEvent( event->data ); case XI_RawMotion: ret = X11DRV_RawMotion( event ); break; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 337dc88d65a..7a2f559fc52 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -735,6 +735,7 @@ extern void retry_grab_clipping_window(void); extern void ungrab_clipping_window(void); extern void move_resize_window( HWND hwnd, int dir ); extern void X11DRV_InitKeyboard( Display *display ); +extern void X11DRV_InitMouse( Display *display ); extern BOOL X11DRV_ProcessEvents( DWORD mask ); extern HWND *build_hwnd_list(void); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 7f61b136eac..fbdfda5d3c1 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -739,6 +739,7 @@ static NTSTATUS x11drv_init( void *arg ) XkbUseExtension( gdi_display, NULL, NULL ); X11DRV_InitKeyboard( gdi_display ); + X11DRV_InitMouse( gdi_display ); if (use_xim) use_xim = xim_init( input_style ); { From 9960a4edf526bf5e97470ce35b7b8f91093a1edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 14 Nov 2021 14:40:55 +0100 Subject: [PATCH 0291/1506] winex11.drv: Support XInput2 events for individual windows. This will allow us to listen to the XInput version of several events, which can bring additional information. --- dlls/winex11.drv/desktop.c | 1 + dlls/winex11.drv/event.c | 16 ++++++ dlls/winex11.drv/mouse.c | 107 +++++++++++++++++++++++++++---------- dlls/winex11.drv/window.c | 3 ++ dlls/winex11.drv/x11drv.h | 1 + 5 files changed, 99 insertions(+), 29 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 52541bc5422..ba55b71deb4 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -86,6 +86,7 @@ BOOL X11DRV_CreateDesktop( const WCHAR *name, UINT width, UINT height ) 0, 0, width, height, 0, default_visual.depth, InputOutput, default_visual.visual, CWEventMask | CWCursor | CWColormap, &win_attr ); if (!win) return FALSE; + X11DRV_XInput2_Enable( display, win, win_attr.event_mask ); XFlush( display ); X11DRV_init_desktop( win, width, height ); diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 9f4ec8fb364..09369abee11 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -235,6 +235,22 @@ static Bool filter_event( Display *display, XEvent *event, char *arg ) return (mask & QS_MOUSEBUTTON) != 0; #ifdef GenericEvent case GenericEvent: +#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H + if (event->xcookie.extension == xinput2_opcode) + { + switch (event->xcookie.evtype) + { + case XI_RawButtonPress: + case XI_RawButtonRelease: + return (mask & QS_MOUSEBUTTON) != 0; + case XI_RawMotion: + return (mask & QS_INPUT) != 0; + case XI_DeviceChanged: + return (mask & (QS_INPUT|QS_MOUSEBUTTON)) != 0; + } + } +#endif + return (mask & QS_SENDMESSAGE) != 0; #endif case MotionNotify: case EnterNotify: diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 0884ee3dc26..22ec9cb8d81 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -345,25 +345,42 @@ void X11DRV_XInput2_Init(void) /*********************************************************************** - * enable_xinput2 + * X11DRV_XInput2_Enable */ -static void enable_xinput2(void) +void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) { struct x11drv_thread_data *data = x11drv_thread_data(); - XIEventMask mask; - XIDeviceInfo *pointer_info; unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; + BOOL raw = (window == None); + XIDeviceInfo *pointer_info; + XIEventMask mask; int count; mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); mask.deviceid = XIAllMasterDevices; memset( mask_bits, 0, sizeof(mask_bits) ); - XISetMask( mask_bits, XI_DeviceChanged ); - XISetMask( mask_bits, XI_RawMotion ); - XISetMask( mask_bits, XI_ButtonPress ); - pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); + /* FIXME: steam overlay doesn't like if we use XI2 for non-raw events */ + + if (event_mask & PointerMotionMask) + { + XISetMask( mask_bits, XI_DeviceChanged ); + if (raw) XISetMask( mask_bits, XI_RawMotion ); + } + if (event_mask & ButtonPressMask) + { + XISetMask( mask_bits, XI_DeviceChanged ); + if (raw) XISetMask( mask_bits, XI_RawButtonPress ); + } + if (event_mask & ButtonReleaseMask) + { + XISetMask( mask_bits, XI_DeviceChanged ); + if (raw) XISetMask( mask_bits, XI_RawButtonRelease ); + } + + pXISelectEvents( display, raw ? DefaultRootWindow( display ) : window, &mask, 1 ); + if (!raw) XSelectInput( display, window, event_mask ); pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count ); update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); @@ -372,24 +389,6 @@ static void enable_xinput2(void) #endif -/*********************************************************************** - * disable_xinput2 - */ -static void disable_xinput2(void) -{ -#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - struct x11drv_thread_data *data = x11drv_thread_data(); - XIEventMask mask; - - mask.mask = NULL; - mask.mask_len = 0; - mask.deviceid = XIAllMasterDevices; - - pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); -#endif -} - - /*********************************************************************** * grab_clipping_window * @@ -419,7 +418,7 @@ static BOOL grab_clipping_window( const RECT *clip ) } /* enable XInput2 unless we are already clipping */ - if (!data->clipping_cursor) enable_xinput2(); + if (!data->clipping_cursor) X11DRV_XInput2_Enable( data->display, None, PointerMotionMask ); TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window ); @@ -464,7 +463,7 @@ static BOOL grab_clipping_window( const RECT *clip ) if (!clipping_cursor) { - disable_xinput2(); + X11DRV_XInput2_Enable( data->display, None, 0 ); return FALSE; } clip_rect = *clip; @@ -493,7 +492,7 @@ void ungrab_clipping_window(void) if (clipping_cursor) XUngrabPointer( data->display, CurrentTime ); clipping_cursor = FALSE; data->clipping_cursor = FALSE; - disable_xinput2(); + X11DRV_XInput2_Enable( data->display, None, 0 ); } /*********************************************************************** @@ -1821,6 +1820,52 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) return TRUE; } +static BOOL X11DRV_XIDeviceEvent( XIDeviceEvent *event ) +{ + DWORD button = event->detail - 1; + INPUT input; + HWND hwnd; + + if (XFindContext( event->display, event->event, winContext, (char **)&hwnd ) != 0) + hwnd = 0; /* not for a registered window */ + if (!hwnd && event->event == root_window) hwnd = NtUserGetDesktopWindow(); + + TRACE( "evtype %u hwnd %p/%lx pos %f,%f detail %u flags %#x serial %lu\n", + event->evtype, hwnd, event->event, event->event_x, event->event_y, event->detail, event->flags, event->serial ); + + if (!hwnd && is_old_motion_event( event->serial )) + { + TRACE( "pos %f,%f old serial %lu, ignoring\n", event->event_x, event->event_y, event->serial ); + return FALSE; + } + + input.mi.dx = event->event_x; + input.mi.dy = event->event_y; + input.mi.mouseData = 0; + input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; + input.mi.time = x11drv_time_to_ticks( event->time ); + input.mi.dwExtraInfo = 0; + + switch (event->evtype) + { + case XI_ButtonPress: + if (button >= NB_BUTTONS) return FALSE; + update_user_time( event->time ); + input.mi.mouseData = button_down_data[button]; + input.mi.dwFlags |= button_down_flags[button]; + break; + case XI_ButtonRelease: + if (button >= NB_BUTTONS) return FALSE; + input.mi.mouseData = button_up_data[button]; + input.mi.dwFlags |= button_up_flags[button]; + break; + } + + map_event_coords( hwnd, event->event, event->root, event->root_x, event->root_y, &input ); + send_mouse_input( hwnd, event->event, event->detail, &input ); + return TRUE; +} + #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ /*********************************************************************** @@ -1892,6 +1937,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) case XI_RawMotion: ret = X11DRV_RawMotion( event ); break; + case XI_Motion: + case XI_ButtonPress: + case XI_ButtonRelease: + return X11DRV_XIDeviceEvent( event->data ); default: TRACE( "Unhandled event %#x\n", event->evtype ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c952a40f623..5b6627ab63f 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -469,6 +469,7 @@ static void sync_window_style( struct x11drv_win_data *data ) int mask = get_window_attributes( data, &attr ); XChangeWindowAttributes( data->display, data->whole_window, mask, &attr ); + X11DRV_XInput2_Enable( data->display, data->whole_window, attr.event_mask ); } } @@ -2121,6 +2122,7 @@ static void create_whole_window( struct x11drv_win_data *data ) data->vis.visual, mask, &attr ); if (!data->whole_window) goto done; + X11DRV_XInput2_Enable( data->display, data->whole_window, attr.event_mask ); set_initial_wm_hints( data->display, data->whole_window ); set_wm_hints( data ); @@ -2476,6 +2478,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd ) data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0, InputOnly, default_visual.visual, CWOverrideRedirect | CWEventMask, &attr ); + X11DRV_XInput2_Enable( data->display, data->clip_window, attr.event_mask ); XSelectInput( data->display, DefaultRootWindow( data->display ), PropertyChangeMask ); XFlush( data->display ); NtUserSetProp( hwnd, clip_window_prop, (HANDLE)data->clip_window ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 7a2f559fc52..65e947d195f 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -269,6 +269,7 @@ extern void X11DRV_ThreadDetach(void); extern void X11DRV_Xcursor_Init(void); extern void X11DRV_XInput2_Load(void); extern void X11DRV_XInput2_Init(void); +extern void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ); extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits, From 7ecb696933b019dbb6b124ca1e18f87838fee8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Aug 2019 14:37:20 +0200 Subject: [PATCH 0292/1506] server: Add send_hardware_message flags for rawinput translation. --- dlls/win32u/message.c | 2 ++ server/protocol.def | 1 + server/queue.c | 12 ++++++------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 0b4b2f6b7ba..48408df7aa8 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3527,6 +3527,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.mouse.flags = input->mi.dwFlags; req->input.mouse.time = input->mi.time; req->input.mouse.info = input->mi.dwExtraInfo; + req->flags |= SEND_HWMSG_RAWINPUT; affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP | @@ -3538,6 +3539,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.kbd.flags = input->ki.dwFlags; req->input.kbd.time = input->ki.time; req->input.kbd.info = input->ki.dwExtraInfo; + req->flags |= SEND_HWMSG_RAWINPUT; affects_key_state = TRUE; break; case INPUT_HARDWARE: diff --git a/server/protocol.def b/server/protocol.def index 17043b187e9..550d0befaf4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2156,6 +2156,7 @@ enum message_type int new_y; @END #define SEND_HWMSG_INJECTED 0x01 +#define SEND_HWMSG_RAWINPUT 0x02 /* Get a message from the current queue */ diff --git a/server/queue.c b/server/queue.c index e5df1e25833..92eb32df4e7 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1859,7 +1859,7 @@ static int queue_rawinput_message( struct process* process, void *arg ) /* queue a hardware message for a mouse event */ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, - unsigned int origin, struct msg_queue *sender ) + unsigned int origin, struct msg_queue *sender, unsigned int req_flags ) { const struct rawinput_device *device; struct hardware_msg_data *msg_data; @@ -1914,7 +1914,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons y = desktop->cursor.y; } - if ((foreground = get_foreground_thread( desktop, win ))) + if ((req_flags & SEND_HWMSG_RAWINPUT) && (foreground = get_foreground_thread( desktop, win ))) { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; @@ -1974,7 +1974,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons /* queue a hardware message for a keyboard event */ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, - unsigned int origin, struct msg_queue *sender ) + unsigned int origin, struct msg_queue *sender, unsigned int req_flags ) { struct hw_msg_source source = { IMDT_KEYBOARD, origin }; const struct rawinput_device *device; @@ -2052,7 +2052,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c break; } - if ((foreground = get_foreground_thread( desktop, win ))) + if ((req_flags & SEND_HWMSG_RAWINPUT) && (foreground = get_foreground_thread( desktop, win ))) { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; @@ -2684,10 +2684,10 @@ DECL_HANDLER(send_hardware_message) switch (req->input.type) { case INPUT_MOUSE: - reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender ); + reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags ); break; case INPUT_KEYBOARD: - reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender ); + reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, req->flags ); break; case INPUT_HARDWARE: queue_custom_hardware_message( desktop, req->win, origin, &req->input ); From d0e7743acedf7c2026adfdc2bbbc4a205ec2f761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Mar 2021 23:29:28 +0100 Subject: [PATCH 0293/1506] user32: Set SEND_HWMSG_RAWINPUT flags only when RAWINPUT is set. So we can generate legacy messages only by calling __wine_send_input with NULL rawinput, and generate WM_INPUT messages only by calling __wine_send_input with INPUT_HARDWARE input type and a rawinput. --- dlls/win32u/input.c | 3 ++- dlls/win32u/message.c | 4 ++-- dlls/wineandroid.drv/keyboard.c | 3 ++- dlls/wineandroid.drv/window.c | 5 +++-- dlls/winemac.drv/keyboard.c | 3 ++- dlls/winemac.drv/mouse.c | 3 ++- dlls/winex11.drv/keyboard.c | 3 ++- dlls/winex11.drv/mouse.c | 11 +++++++---- 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 6ca58457f25..ff148b4cbd7 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -664,6 +664,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) { UINT i; NTSTATUS status = STATUS_SUCCESS; + RAWINPUT rawinput; if (size != sizeof(INPUT)) { @@ -693,7 +694,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) update_mouse_coords( &input ); /* fallthrough */ case INPUT_KEYBOARD: - status = send_hardware_message( 0, &input, NULL, SEND_HWMSG_INJECTED ); + status = send_hardware_message( 0, &input, &rawinput, SEND_HWMSG_INJECTED ); break; case INPUT_HARDWARE: RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 48408df7aa8..1dc4a02731d 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3527,7 +3527,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.mouse.flags = input->mi.dwFlags; req->input.mouse.time = input->mi.time; req->input.mouse.info = input->mi.dwExtraInfo; - req->flags |= SEND_HWMSG_RAWINPUT; + if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT; affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP | @@ -3539,7 +3539,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.kbd.flags = input->ki.dwFlags; req->input.kbd.time = input->ki.time; req->input.kbd.info = input->ki.dwExtraInfo; - req->flags |= SEND_HWMSG_RAWINPUT; + if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT; affects_key_state = TRUE; break; case INPUT_HARDWARE: diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index 9f369094949..1606afb3f86 100644 --- a/dlls/wineandroid.drv/keyboard.c +++ b/dlls/wineandroid.drv/keyboard.c @@ -671,6 +671,7 @@ static BOOL get_async_key_state( BYTE state[256] ) static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags ) { + RAWINPUT rawinput; INPUT input; input.type = INPUT_KEYBOARD; @@ -680,7 +681,7 @@ static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags ) input.ki.time = 0; input.ki.dwExtraInfo = 0; - __wine_send_input( hwnd, &input, NULL ); + __wine_send_input( hwnd, &input, &rawinput ); } /*********************************************************************** diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index d62a2c53909..47a424b40b8 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -421,6 +421,7 @@ static int process_events( DWORD mask ) DPI_AWARENESS_CONTEXT context; struct java_event *event, *next, *previous; unsigned int count = 0; + RAWINPUT rawinput; assert( GetCurrentThreadId() == desktop_tid ); @@ -514,7 +515,7 @@ static int process_events( DWORD mask ) } SERVER_END_REQ; } - __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, NULL ); + __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, &rawinput ); } break; @@ -528,7 +529,7 @@ static int process_events( DWORD mask ) event->data.kbd.input.ki.wVk, event->data.kbd.input.ki.wVk, event->data.kbd.input.ki.wScan ); update_keyboard_lock_state( event->data.kbd.input.ki.wVk, event->data.kbd.lock_state ); - __wine_send_input( 0, &event->data.kbd.input, NULL ); + __wine_send_input( 0, &event->data.kbd.input, &rawinput ); break; default: diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index bf1daa7a5df..b378bb0c99e 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -990,6 +990,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) */ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, unsigned int flags, unsigned int time) { + RAWINPUT rawinput; INPUT input; TRACE_(key)("hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags); @@ -1001,7 +1002,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, unsigned input.ki.time = time; input.ki.dwExtraInfo = 0; - __wine_send_input(hwnd, &input, NULL); + __wine_send_input(hwnd, &input, &rawinput); } diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index 2f05a33a8b5..5799cb06a19 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -129,6 +129,7 @@ static const CFStringRef cocoa_cursor_names[] = static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, int x, int y, DWORD mouse_data, BOOL drag, unsigned long time) { + RAWINPUT rawinput; INPUT input; HWND top_level_hwnd; @@ -158,7 +159,7 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, input.mi.time = time; input.mi.dwExtraInfo = 0; - __wine_send_input(top_level_hwnd, &input, NULL); + __wine_send_input(top_level_hwnd, &input, &rawinput); } diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 6a199a0afbf..731adc0265b 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1121,6 +1121,7 @@ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e) */ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, UINT flags, UINT time ) { + RAWINPUT rawinput; INPUT input; TRACE_(key)( "hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags ); @@ -1132,7 +1133,7 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, UINT fl input.ki.time = time; input.ki.dwExtraInfo = 0; - __wine_send_input( hwnd, &input, NULL ); + __wine_send_input( hwnd, &input, &rawinput ); } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 22ec9cb8d81..b0588ad4728 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -585,6 +585,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input ) { struct x11drv_win_data *data; + RAWINPUT rawinput; input->type = INPUT_MOUSE; @@ -592,7 +593,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU { struct x11drv_thread_data *thread_data = x11drv_thread_data(); if (!thread_data->clipping_cursor || thread_data->clip_window != window) return; - __wine_send_input( hwnd, input, NULL ); + __wine_send_input( hwnd, input, &rawinput ); return; } @@ -619,7 +620,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; } - __wine_send_input( hwnd, input, NULL ); + __wine_send_input( hwnd, input, &rawinput ); } #ifdef SONAME_LIBXCURSOR @@ -1553,6 +1554,7 @@ void move_resize_window( HWND hwnd, int dir ) { MSG msg; INPUT input; + RAWINPUT rawinput; int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; @@ -1568,7 +1570,7 @@ void move_resize_window( HWND hwnd, int dir ) input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = NtGetTickCount(); input.mi.dwExtraInfo = 0; - __wine_send_input( hwnd, &input, NULL ); + __wine_send_input( hwnd, &input, &rawinput ); } while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) @@ -1799,6 +1801,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { XIRawEvent *event = xev->data; + RAWINPUT rawinput; INPUT input; if (broken_rawevents && is_old_motion_event( xev->serial )) @@ -1816,7 +1819,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; - __wine_send_input( 0, &input, NULL ); + __wine_send_input( 0, &input, &rawinput ); return TRUE; } From 9a27f58656a23ce4249eb90b02501e5abf617133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 25 Mar 2021 14:26:35 +0100 Subject: [PATCH 0294/1506] user32: Support sending RIM_TYPEMOUSE through __wine_send_input. --- dlls/win32u/message.c | 6 ++++++ server/queue.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 1dc4a02731d..af8fc439a03 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3552,6 +3552,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.hw.rawinput.type = rawinput->header.dwType; switch (rawinput->header.dwType) { + case RIM_TYPEMOUSE: + req->input.hw.rawinput.mouse.x = rawinput->data.mouse.lLastX; + req->input.hw.rawinput.mouse.y = rawinput->data.mouse.lLastY; + req->input.hw.rawinput.mouse.data = rawinput->data.mouse.ulRawButtons; + req->input.hw.lparam = rawinput->data.mouse.usFlags; + break; case RIM_TYPEHID: req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); req->input.hw.rawinput.hid.param = rawinput->header.wParam; diff --git a/server/queue.c b/server/queue.c index 92eb32df4e7..497718bea8e 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2146,6 +2146,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ msg_data->size = sizeof(*msg_data) + report_size; msg_data->rawinput = input->hw.rawinput; + if (input->hw.msg == WM_INPUT && input->hw.rawinput.type == RIM_TYPEMOUSE) + msg_data->flags = input->hw.lparam; + enum_processes( queue_rawinput_message, &raw_msg ); return; } From 217526b4e938d1fe29a59dd061a7a45540bad633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 25 Oct 2021 11:45:47 +0200 Subject: [PATCH 0295/1506] winex11.drv: Listen to RawMotion and RawButton* events in the desktop thread. We still need to send "normal" input from the clipping window thread to trigger low-level hooks callbacks when clipping cursor. This is for instance used in our dinput implementation. --- dlls/winex11.drv/event.c | 10 +++- dlls/winex11.drv/mouse.c | 103 ++++++++++++++++++++++++++++++--- dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 2 + 4 files changed, 107 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 09369abee11..9e8c9d67d61 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -327,6 +327,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE */ static enum event_merge_action merge_events( XEvent *prev, XEvent *next ) { +#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H + struct x11drv_thread_data *thread_data = x11drv_thread_data(); +#endif + switch (prev->type) { case ConfigureNotify: @@ -358,19 +362,21 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next ) case GenericEvent: if (next->xcookie.extension != xinput2_opcode) break; if (next->xcookie.evtype != XI_RawMotion) break; - if (x11drv_thread_data()->warp_serial) break; + if (thread_data->xi2_rawinput_only) break; + if (thread_data->warp_serial) break; return MERGE_KEEP; } break; case GenericEvent: if (prev->xcookie.extension != xinput2_opcode) break; if (prev->xcookie.evtype != XI_RawMotion) break; + if (thread_data->xi2_rawinput_only) break; switch (next->type) { case GenericEvent: if (next->xcookie.extension != xinput2_opcode) break; if (next->xcookie.evtype != XI_RawMotion) break; - if (x11drv_thread_data()->warp_serial) break; + if (thread_data->warp_serial) break; return merge_raw_motion_events( prev->xcookie.data, next->xcookie.data ); #endif } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index b0588ad4728..661f3159d1b 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -243,6 +243,7 @@ struct mouse_button_mapping }; static struct mouse_button_mapping *pointer_mapping; +static struct mouse_button_mapping *device_mapping; static void update_pointer_mapping( Display *display ) { @@ -361,6 +362,11 @@ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) mask.deviceid = XIAllMasterDevices; memset( mask_bits, 0, sizeof(mask_bits) ); + if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) + data->xi2_rawinput_only = TRUE; + else + data->xi2_rawinput_only = FALSE; + /* FIXME: steam overlay doesn't like if we use XI2 for non-raw events */ if (event_mask & PointerMotionMask) @@ -492,7 +498,10 @@ void ungrab_clipping_window(void) if (clipping_cursor) XUngrabPointer( data->display, CurrentTime ); clipping_cursor = FALSE; data->clipping_cursor = FALSE; - X11DRV_XInput2_Enable( data->display, None, 0 ); + + /* desktop window needs to listen to XInput2 events all the time for rawinput to work */ + if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) != GetCurrentThreadId()) + X11DRV_XInput2_Enable( data->display, None, 0 ); } /*********************************************************************** @@ -585,7 +594,6 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input ) { struct x11drv_win_data *data; - RAWINPUT rawinput; input->type = INPUT_MOUSE; @@ -593,7 +601,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU { struct x11drv_thread_data *thread_data = x11drv_thread_data(); if (!thread_data->clipping_cursor || thread_data->clip_window != window) return; - __wine_send_input( hwnd, input, &rawinput ); + __wine_send_input( hwnd, input, NULL ); return; } @@ -620,7 +628,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; } - __wine_send_input( hwnd, input, &rawinput ); + __wine_send_input( hwnd, input, NULL ); } #ifdef SONAME_LIBXCURSOR @@ -1554,7 +1562,6 @@ void move_resize_window( HWND hwnd, int dir ) { MSG msg; INPUT input; - RAWINPUT rawinput; int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; @@ -1570,7 +1577,7 @@ void move_resize_window( HWND hwnd, int dir ) input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = NtGetTickCount(); input.mi.dwExtraInfo = 0; - __wine_send_input( hwnd, &input, &rawinput ); + __wine_send_input( hwnd, &input, NULL ); } while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) @@ -1800,6 +1807,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) */ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { + struct x11drv_thread_data *thread_data = x11drv_thread_data(); XIRawEvent *event = xev->data; RAWINPUT rawinput; INPUT input; @@ -1819,7 +1827,84 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; - __wine_send_input( 0, &input, &rawinput ); + if (!thread_data->xi2_rawinput_only) + __wine_send_input( 0, &input, NULL ); + else + { + rawinput.header.dwType = RIM_TYPEMOUSE; + rawinput.header.dwSize = offsetof(RAWINPUT, data) + sizeof(RAWMOUSE); + rawinput.header.hDevice = ULongToHandle(1); /* WINE_MOUSE_HANDLE */ + rawinput.header.wParam = RIM_INPUT; + rawinput.data.mouse.usFlags = input.mi.dwFlags; + rawinput.data.mouse.ulRawButtons = 0; + rawinput.data.mouse.usButtonData = 0; + rawinput.data.mouse.usButtonFlags = 0; + rawinput.data.mouse.lLastX = input.mi.dx; + rawinput.data.mouse.lLastY = input.mi.dy; + rawinput.data.mouse.ulExtraInformation = 0; + + input.type = INPUT_HARDWARE; + input.hi.uMsg = WM_INPUT; + input.hi.wParamH = 0; + input.hi.wParamL = 0; + if (rawinput.data.mouse.lLastX || rawinput.data.mouse.lLastY) + __wine_send_input( 0, &input, &rawinput ); + } + + return TRUE; +} + +/*********************************************************************** + * X11DRV_RawButtonEvent + */ +static BOOL X11DRV_RawButtonEvent( XGenericEventCookie *cookie ) +{ + struct x11drv_thread_data *thread_data = x11drv_thread_data(); + XIRawEvent *event = cookie->data; + int button = event->detail - 1; + RAWINPUT rawinput; + INPUT input; + + if (!device_mapping || device_mapping->deviceid != event->sourceid) + update_device_mapping( event->display, event->sourceid ); + + if (button >= 0 && device_mapping) + button = device_mapping->buttons[button] - 1; + + if (button >= 0 && pointer_mapping) + button = pointer_mapping->buttons[button] - 1; + + if (button < 0 || button >= NB_BUTTONS) return FALSE; + if (event->deviceid != thread_data->xi2_core_pointer) return FALSE; + + TRACE( "raw button %u (raw: %u) %s\n", button, event->detail, event->evtype == XI_RawButtonRelease ? "up" : "down" ); + + rawinput.header.dwType = RIM_TYPEMOUSE; + rawinput.header.dwSize = offsetof(RAWINPUT, data) + sizeof(RAWMOUSE); + rawinput.header.hDevice = ULongToHandle(1); /* WINE_MOUSE_HANDLE */ + rawinput.header.wParam = RIM_INPUT; + if (event->evtype == XI_RawButtonRelease) + { + rawinput.data.mouse.usFlags = button_up_flags[button]; + rawinput.data.mouse.ulRawButtons = button_up_data[button]; + } + else + { + rawinput.data.mouse.usFlags = button_down_flags[button]; + rawinput.data.mouse.ulRawButtons = button_down_data[button]; + } + rawinput.data.mouse.usButtonData = 0; + rawinput.data.mouse.usButtonFlags = 0; + rawinput.data.mouse.lLastX = 0; + rawinput.data.mouse.lLastY = 0; + rawinput.data.mouse.ulExtraInformation = 0; + + input.type = INPUT_HARDWARE; + input.hi.uMsg = WM_INPUT; + input.hi.wParamH = 0; + input.hi.wParamL = 0; + if (rawinput.data.mouse.usFlags || rawinput.data.mouse.ulRawButtons) + __wine_send_input( 0, &input, &rawinput ); return TRUE; } @@ -1940,6 +2025,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) case XI_RawMotion: ret = X11DRV_RawMotion( event ); break; + case XI_RawButtonPress: + case XI_RawButtonRelease: + ret = X11DRV_RawButtonEvent( event ); + break; case XI_Motion: case XI_ButtonPress: case XI_ButtonRelease: diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 65e947d195f..fac4a41de05 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -402,6 +402,7 @@ struct x11drv_thread_data XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; int xi2_core_pointer; /* XInput2 core pointer id */ + int xi2_rawinput_only; #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ }; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index fbdfda5d3c1..4a0cc3a4d53 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -851,6 +851,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) if (use_xim) xim_thread_attach( data ); X11DRV_XInput2_Init(); + if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) + X11DRV_XInput2_Enable( data->display, None, PointerMotionMask|ButtonPressMask|ButtonReleaseMask ); return data; } From c2b7453b05b74b012c2417f6953846680a6bd3fb Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 20 Jun 2018 15:07:28 -0500 Subject: [PATCH 0296/1506] HACK: user32: Remove hooks that time out. In accordance with Win7+ behaviour. --- dlls/win32u/hook.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index 378eda40abb..7cdd327a9f5 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -204,6 +204,7 @@ static LRESULT call_hook( struct win_hook_params *info, const WCHAR *module, siz size_t message_size, BOOL ansi ) { DWORD_PTR ret = 0; + LRESULT lres = 0; if (info->tid) { @@ -218,20 +219,26 @@ static LRESULT call_hook( struct win_hook_params *info, const WCHAR *module, siz switch(info->id) { case WH_KEYBOARD_LL: - send_internal_message_timeout( info->pid, info->tid, WM_WINE_KEYBOARD_LL_HOOK, - info->wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG, - get_ll_hook_timeout(), &ret ); + lres = send_internal_message_timeout( info->pid, info->tid, WM_WINE_KEYBOARD_LL_HOOK, + info->wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG, + get_ll_hook_timeout(), &ret ); break; case WH_MOUSE_LL: - send_internal_message_timeout( info->pid, info->tid, WM_WINE_MOUSE_LL_HOOK, - info->wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG, - get_ll_hook_timeout(), &ret ); + lres = send_internal_message_timeout( info->pid, info->tid, WM_WINE_MOUSE_LL_HOOK, + info->wparam, (LPARAM)&h_extra, SMTO_ABORTIFHUNG, + get_ll_hook_timeout(), &ret ); break; default: ERR("Unknown hook id %d\n", info->id); assert(0); break; } + + if (!lres && RtlGetLastWin32Error() == ERROR_TIMEOUT) + { + TRACE( "Hook %p timed out; removing it.\n", info->handle ); + NtUserUnhookWindowsHookEx( info->handle ); + } } else if (info->proc) { From 8fa1095bb13ea7f366ade8c4345bb3aeead259ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 28 Oct 2021 09:11:02 +0200 Subject: [PATCH 0297/1506] server: Clear the MOUSEEVENTF_(ABSOLUTE|VIRTUALDESK) flags. For rawinput messages, as user32 is currently only expecting relative motion. --- server/queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c index 497718bea8e..c60e9ce7c5b 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1926,7 +1926,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons msg_data = &raw_msg.data; msg_data->info = input->mouse.info; msg_data->size = sizeof(*msg_data); - msg_data->flags = flags; + msg_data->flags = flags & ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); msg_data->rawinput.type = RIM_TYPEMOUSE; msg_data->rawinput.mouse.x = x - desktop->cursor.x; msg_data->rawinput.mouse.y = y - desktop->cursor.y; From 46ac5fbd1680e61e7f2b57b6edeabc678cfa8e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 25 Oct 2021 11:26:43 +0200 Subject: [PATCH 0298/1506] user32: Add support for absolute rawinput messages. --- dlls/win32u/rawinput.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index 6ca0e5d7141..e5eab049fa3 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -96,7 +96,9 @@ static bool rawinput_from_hardware_message( RAWINPUT *rawinput, const struct har rawinput->header.hDevice = WINE_MOUSE_HANDLE; rawinput->header.wParam = 0; - rawinput->data.mouse.usFlags = MOUSE_MOVE_RELATIVE; + rawinput->data.mouse.usFlags = msg_data->flags & MOUSEEVENTF_ABSOLUTE ? MOUSE_MOVE_ABSOLUTE : MOUSE_MOVE_RELATIVE; + if (msg_data->flags & MOUSEEVENTF_VIRTUALDESK) rawinput->data.mouse.usFlags |= MOUSE_VIRTUAL_DESKTOP; + rawinput->data.mouse.usButtonFlags = 0; rawinput->data.mouse.usButtonData = 0; for (i = 1; i < ARRAY_SIZE(button_flags); ++i) From dda751149ea103082d9530f15b701b76f515cb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 25 Oct 2021 11:22:04 +0200 Subject: [PATCH 0299/1506] server: Stop enforcing relative rawinput mouse positions. --- server/queue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/queue.c b/server/queue.c index c60e9ce7c5b..e5bd191affc 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1926,10 +1926,10 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons msg_data = &raw_msg.data; msg_data->info = input->mouse.info; msg_data->size = sizeof(*msg_data); - msg_data->flags = flags & ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); + msg_data->flags = flags; msg_data->rawinput.type = RIM_TYPEMOUSE; - msg_data->rawinput.mouse.x = x - desktop->cursor.x; - msg_data->rawinput.mouse.y = y - desktop->cursor.y; + msg_data->rawinput.mouse.x = (flags & MOUSEEVENTF_MOVE) ? input->mouse.x : 0; + msg_data->rawinput.mouse.y = (flags & MOUSEEVENTF_MOVE) ? input->mouse.y : 0; msg_data->rawinput.mouse.data = input->mouse.data; enum_processes( queue_rawinput_message, &raw_msg ); From 6f82a5e7f3fb62eb9a1509f244de0460111401a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 24 Oct 2021 16:27:40 +0200 Subject: [PATCH 0300/1506] winex11.drv: Simplify XInput2 valuator lookup. Valuator names aren't well specified, and although they usually are Rel X/Y or Abs X/Y, there are cases where the X/Y names are something else. Just assume that the first two valuators are the X/Y axes, as it seems to be generally the case. --- dlls/winex11.drv/mouse.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 661f3159d1b..ff12cd4d321 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -299,26 +299,25 @@ void X11DRV_InitMouse( Display *display ) /*********************************************************************** * update_relative_valuators */ -static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuators) +static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes ) { struct x11drv_thread_data *thread_data = x11drv_thread_data(); - int i; + XIValuatorClassInfo *valuator; thread_data->x_valuator.number = -1; thread_data->y_valuator.number = -1; - for (i = 0; i < n_valuators; i++) + while (num_classes--) { - XIValuatorClassInfo *class = (XIValuatorClassInfo *)valuators[i]; - if (valuators[i]->type != XIValuatorClass) continue; - if (class->label == x11drv_atom( Rel_X ) || - (!class->label && class->number == 0 && class->mode == XIModeRelative)) - thread_data->x_valuator = *class; - else if (class->label == x11drv_atom( Rel_Y ) || - (!class->label && class->number == 1 && class->mode == XIModeRelative)) - thread_data->y_valuator = *class; + valuator = (XIValuatorClassInfo *)classes[num_classes]; + if (classes[num_classes]->type != XIValuatorClass) continue; + if (valuator->number == 0 && valuator->mode == XIModeRelative) thread_data->x_valuator = *valuator; + if (valuator->number == 1 && valuator->mode == XIModeRelative) thread_data->y_valuator = *valuator; } + if (thread_data->x_valuator.number < 0 || thread_data->y_valuator.number < 0) + WARN( "X/Y axis valuators not found, ignoring RawMotion events\n" ); + thread_data->x_valuator.value = 0; thread_data->y_valuator.value = 0; } From c1c674c7c55daad3a41ebdb2eb6e9ecbb93531f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 7 Jan 2022 10:39:14 +0100 Subject: [PATCH 0301/1506] winex11.drv: Add support for absolute RawMotion events. --- dlls/winex11.drv/mouse.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index ff12cd4d321..5c0f8449197 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -311,12 +311,18 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes { valuator = (XIValuatorClassInfo *)classes[num_classes]; if (classes[num_classes]->type != XIValuatorClass) continue; - if (valuator->number == 0 && valuator->mode == XIModeRelative) thread_data->x_valuator = *valuator; - if (valuator->number == 1 && valuator->mode == XIModeRelative) thread_data->y_valuator = *valuator; + if (valuator->number == 0) thread_data->x_valuator = *valuator; + if (valuator->number == 1) thread_data->y_valuator = *valuator; } if (thread_data->x_valuator.number < 0 || thread_data->y_valuator.number < 0) WARN( "X/Y axis valuators not found, ignoring RawMotion events\n" ); + else if (thread_data->x_valuator.mode != thread_data->y_valuator.mode) + { + WARN( "Relative/Absolute mismatch between X/Y axis, ignoring RawMotion events\n" ); + thread_data->x_valuator.number = -1; + thread_data->y_valuator.number = -1; + } thread_data->x_valuator.value = 0; thread_data->y_valuator.value = 0; @@ -1742,7 +1748,15 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (!event->valuators.mask_len) return FALSE; if (event->deviceid != thread_data->xi2_core_pointer) return FALSE; - virtual_rect = NtUserGetVirtualScreenRect(); + if (x->mode == XIModeRelative && y->mode == XIModeRelative) + input->mi.dwFlags &= ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); + else if (x->mode == XIModeAbsolute && y->mode == XIModeAbsolute) + input->mi.dwFlags |= MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; + else + FIXME( "Unsupported relative/absolute X/Y axis mismatch\n." ); + + if (input->mi.dwFlags & MOUSEEVENTF_VIRTUALDESK) SetRect( &virtual_rect, 0, 0, 65535, 65535 ); + else virtual_rect = NtUserGetVirtualScreenRect(); if (x->max <= x->min) x_scale = 1; else x_scale = (virtual_rect.right - virtual_rect.left) / (x->max - x->min); @@ -1755,12 +1769,14 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (i == x->number) { x_value = *values; - x->value += x_value * x_scale; + if (x->mode == XIModeRelative) x->value += x_value * x_scale; + else x->value = (x_value - x->min) * x_scale; } if (i == y->number) { y_value = *values; - y->value += y_value * y_scale; + if (y->mode == XIModeRelative) y->value += y_value * y_scale; + else y->value = (y_value - y->min) * y_scale; } values++; } @@ -1774,7 +1790,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) x->value -= input->mi.dx; y->value -= input->mi.dy; - if (!input->mi.dx && !input->mi.dy) + if (!(input->mi.dwFlags & MOUSEEVENTF_ABSOLUTE) && !input->mi.dx && !input->mi.dy) { TRACE( "accumulating motion\n" ); return FALSE; From 1e9cd185a088dfbd7e604f4ae7a7a39d319ff1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 6 Dec 2023 15:53:19 +0100 Subject: [PATCH 0302/1506] winex11.drv: Send relative RawMotion events unprocessed. This makes relative raw input independent from cursor speed, as it is the case on Windows. Absolute raw input is already translated to virtual desktop space, and cursor speed is meaningless in this case. This does not support mixed relative/absolute X/Y axis. --- dlls/winex11.drv/mouse.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 5c0f8449197..02a1b5ae8c0 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1735,12 +1735,12 @@ static BOOL X11DRV_XIDeviceChangedEvent( XIDeviceChangedEvent *event ) return TRUE; } -static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) +static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input, RAWINPUT *rawinput ) { struct x11drv_thread_data *thread_data = x11drv_thread_data(); XIValuatorClassInfo *x = &thread_data->x_valuator, *y = &thread_data->y_valuator; - double x_value = 0, y_value = 0, x_scale, y_scale; - const double *values = event->valuators.values; + const double *values = event->valuators.values, *raw_values = event->raw_values; + double x_raw = 0, y_raw = 0, x_value = 0, y_value = 0, x_scale, y_scale; RECT virtual_rect; int i; @@ -1768,16 +1768,19 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) if (!XIMaskIsSet( event->valuators.mask, i )) continue; if (i == x->number) { + x_raw = *raw_values; x_value = *values; if (x->mode == XIModeRelative) x->value += x_value * x_scale; else x->value = (x_value - x->min) * x_scale; } if (i == y->number) { + y_raw = *raw_values; y_value = *values; if (y->mode == XIModeRelative) y->value += y_value * y_scale; else y->value = (y_value - y->min) * y_scale; } + raw_values++; values++; } @@ -1790,12 +1793,6 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) x->value -= input->mi.dx; y->value -= input->mi.dy; - if (!(input->mi.dwFlags & MOUSEEVENTF_ABSOLUTE) && !input->mi.dx && !input->mi.dy) - { - TRACE( "accumulating motion\n" ); - return FALSE; - } - if (input->mi.dwFlags & MOUSEEVENTF_ABSOLUTE) fs_hack_point_real_to_user( (POINT *)&input->mi.dx ); else @@ -1813,6 +1810,11 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) input->mi.dy = lround( (double)input->mi.dy / user_to_real_scale ); } + if (x->mode != XIModeAbsolute) rawinput->data.mouse.lLastX = x_raw; + else rawinput->data.mouse.lLastX = input->mi.dx; + if (y->mode != XIModeAbsolute) rawinput->data.mouse.lLastY = y_raw; + else rawinput->data.mouse.lLastY = input->mi.dy; + return TRUE; } @@ -1840,7 +1842,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.mi.dwExtraInfo = 0; input.mi.dx = 0; input.mi.dy = 0; - if (!map_raw_event_coords( event, &input )) return FALSE; + if (!map_raw_event_coords( event, &input, &rawinput )) return FALSE; if (!thread_data->xi2_rawinput_only) __wine_send_input( 0, &input, NULL ); @@ -1854,8 +1856,6 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) rawinput.data.mouse.ulRawButtons = 0; rawinput.data.mouse.usButtonData = 0; rawinput.data.mouse.usButtonFlags = 0; - rawinput.data.mouse.lLastX = input.mi.dx; - rawinput.data.mouse.lLastY = input.mi.dy; rawinput.data.mouse.ulExtraInformation = 0; input.type = INPUT_HARDWARE; From aa369b8cc50e674de3b2c39c4b324506c638da82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 10 Mar 2023 20:51:53 +0100 Subject: [PATCH 0303/1506] user32: Add more devnotify traces on +rawinput. CW-Bug-Id: #22037 --- dlls/user32/input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 8f3cd8acae7..238571361c8 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -31,6 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(win); WINE_DECLARE_DEBUG_CHANNEL(keyboard); +WINE_DECLARE_DEBUG_CHANNEL(rawinput); /*********************************************************************** * get_locale_kbd_layout @@ -502,6 +503,7 @@ BOOL WINAPI UnloadKeyboardLayout( HKL layout ) static DWORD CALLBACK devnotify_window_callbackW(HANDLE handle, DWORD flags, DEV_BROADCAST_HDR *header) { + TRACE_(rawinput)("handle %p, flags %#lx, header %p\n", handle, flags, header); SendMessageTimeoutW(handle, WM_DEVICECHANGE, flags, (LPARAM)header, SMTO_ABORTIFHUNG, 2000, NULL); return 0; } @@ -585,7 +587,7 @@ HDEVNOTIFY WINAPI RegisterDeviceNotificationW( HANDLE handle, void *filter, DWOR struct device_notification_details details; DEV_BROADCAST_HDR *header = filter; - TRACE("handle %p, filter %p, flags %#lx\n", handle, filter, flags); + TRACE_(rawinput)("handle %p, filter %p, flags %#lx\n", handle, filter, flags); if (flags & ~(DEVICE_NOTIFY_SERVICE_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES)) { From b1ca9ad99eaa709198ac3bdb34ae2c62fe1f87c0 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 7 Dec 2020 09:31:52 +0100 Subject: [PATCH 0304/1506] winex11.drv: Recognize the keyboard in a locale-independent way. Try to recognize the keyboard comparing keysyms instead of converting them to multibyte strings, which makes the process locale-dependent and therefore more fragile. Unfortunately this means that the layout tables might need to be updated. However, this change is known to fix the recognitions of a few keys in the French layout. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605 CW-Bug-Id: #16793 --- dlls/winex11.drv/keyboard.c | 62 +++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 731adc0265b..b561bd997b6 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1440,6 +1440,35 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) return TRUE; } +/* From the point of view of this function there are two types of + * keys: those for which the mapping to vkey and scancode depends on + * the keyboard layout (i.e., letters, numbers, punctuation) and those + * for which it doesn't (control keys); since this function is used to + * recognize the keyboard layout and map keysyms to vkeys and + * scancodes, we are only concerned about the first type, and map + * everything in the second type to zero. + */ +static char keysym_to_char( KeySym keysym ) +{ + /* Dead keys */ + if (0xfe50 <= keysym && keysym < 0xfed0) + return KEYBOARD_MapDeadKeysym( keysym ); + + /* Control keys (there is nothing allocated below 0xfc00, but I + take some margin in case something is added in the future) */ + if (0xf000 <= keysym && keysym < 0x10000) + return 0; + + /* XFree86 vendor keys */ + if (0x10000000 <= keysym) + return 0; + + /* "Normal" keys: return last octet, because our tables don't have + more than that; it would be better to extend the tables and + compare the whole keysym, but it's a lot of work... */ + return keysym & 0xff; +} + /********************************************************************** * X11DRV_KEYBOARD_DetectLayout * @@ -1470,22 +1499,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) /* get data for keycode from X server */ for (i = 0; i < syms; i++) { if (!(keysym = XkbKeycodeToKeysym( display, keyc, 0, i ))) continue; - /* Allow both one-byte and two-byte national keysyms */ - if ((keysym < 0x8000) && (keysym != ' ')) - { - if (!XkbTranslateKeySym(display, &keysym, 0, &ckey[keyc][i], 1, NULL)) - { - TRACE("XKB could not translate keysym %04lx\n", keysym); - /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent - * with appropriate ShiftMask and Mode_switch, use XLookupString - * to get character in the local encoding. - */ - ckey[keyc][i] = keysym & 0xFF; - } - } - else { - ckey[keyc][i] = KEYBOARD_MapDeadKeysym(keysym); - } + ckey[keyc][i] = keysym_to_char(keysym); } } @@ -1660,20 +1674,8 @@ void X11DRV_InitKeyboard( Display *display ) /* we seem to need to search the layout-dependent scancodes */ int maxlen=0,maxval=-1,ok; for (i=0; i Date: Mon, 7 Dec 2020 09:49:53 +0100 Subject: [PATCH 0305/1506] winex11.drv: Dump keysyms and translations for all keys. Dump all we can see about the user keyboard, so that their +keyboard logs can be used to fix layout tables. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30984 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605 CW-Bug-Id: #16793 --- dlls/winex11.drv/keyboard.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index b561bd997b6..a0e8047605c 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1500,6 +1500,19 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) for (i = 0; i < syms; i++) { if (!(keysym = XkbKeycodeToKeysym( display, keyc, 0, i ))) continue; ckey[keyc][i] = keysym_to_char(keysym); + if (TRACE_ON(keyboard)) + { + char buf[32]; + WCHAR bufW[32]; + int len, lenW; + KeySym orig_keysym = keysym; + len = XkbTranslateKeySym(display, &keysym, 0, buf, sizeof(buf), NULL); + lenW = ntdll_umbstowcs(buf, len, bufW, ARRAY_SIZE(bufW)); + if (lenW < ARRAY_SIZE(bufW)) + bufW[lenW] = 0; + TRACE("keycode %u, index %d, orig_keysym 0x%04lx, keysym 0x%04lx, buf %s, bufW %s\n", + keyc, i, orig_keysym, keysym, debugstr_a(buf), debugstr_w(bufW)); + } } } From df0082fd206c22300e26ff6dda465b166d9b6d9e Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Wed, 17 Oct 2018 19:55:27 +0300 Subject: [PATCH 0306/1506] winex11.drv: Ignore clip_reset when trying to clip the mouse after the desktop has been resized. This fixes the mouse clipping when the desktop is resized multiple times in a row. CW-Bug-Id: #21879 --- dlls/win32u/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index ff148b4cbd7..28cd0a11677 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2533,7 +2533,7 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) if (!NtUserGetWindowRect( hwnd, &rect )) return FALSE; if (!NtUserIsWindowRectFullScreen( &rect )) return FALSE; if (is_captured_by_system()) return FALSE; - if (NtGetTickCount() - thread_info->clipping_reset < 1000) return FALSE; + if (!reset && NtGetTickCount() - thread_info->clipping_reset < 1000) return FALSE; if (!reset && clipping_cursor && thread_info->clipping_cursor) return FALSE; /* already clipping */ if (!(monitor = NtUserMonitorFromWindow( hwnd, MONITOR_DEFAULTTONEAREST ))) return FALSE; From ba29dfc16cb77c34a62fd24d15bfb78a8d41496d Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Sat, 20 Oct 2018 18:07:12 +0300 Subject: [PATCH 0307/1506] winex11.drv: Enable fullscreen clipping even if not already clipping. CW-Bug-Id: #21879 --- dlls/win32u/input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 28cd0a11677..5f083a787e9 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2605,11 +2605,11 @@ BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ) { struct user_thread_info *thread_info = get_user_thread_info(); RECT rect, virtual_rect = NtUserGetVirtualScreenRect(); - BOOL was_clipping, empty = !!(flags & SET_CURSOR_NOCLIP); + BOOL empty = !!(flags & SET_CURSOR_NOCLIP); TRACE( "hwnd %p, flags %#x, reset %u\n", hwnd, flags, reset ); - if ((was_clipping = thread_info->clipping_cursor)) InterlockedDecrement( &clipping_cursor ); + if (thread_info->clipping_cursor) InterlockedDecrement( &clipping_cursor ); thread_info->clipping_cursor = FALSE; if (reset) @@ -2627,7 +2627,7 @@ BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ) if (empty && !(flags & SET_CURSOR_FSCLIP)) { /* if currently clipping, check if we should switch to fullscreen clipping */ - if (was_clipping && clip_fullscreen_window( hwnd, TRUE )) return TRUE; + if (clip_fullscreen_window( hwnd, TRUE )) return TRUE; return user_driver->pClipCursor( NULL, FALSE ); } From 9e5e225dba0f887c9c07771390de2485a07d38f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 21 Jan 2020 21:05:05 +0100 Subject: [PATCH 0308/1506] winex11.drv: Ignore ClipCursor if desktop window is foreground. CW-Bug-Id: #21879 --- dlls/win32u/input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 5f083a787e9..0cca9791903 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2648,6 +2648,12 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect ) TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) ); + if (NtUserGetForegroundWindow() == NtUserGetDesktopWindow()) + { + WARN( "desktop is foreground, ignoring ClipCursor\n" ); + rect = NULL; + } + if (rect) { if (rect->left > rect->right || rect->top > rect->bottom) return FALSE; From 309d7d65768b3c702bda4b0d6b09a4b6588c9883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 19 Sep 2019 15:42:09 +0200 Subject: [PATCH 0309/1506] winex11.drv: Wait for pointer grab on FocusIn/WM_TAKE_FOCUS events. The FocusIn/WM_TAKE_FOCUS events are received as soon as a window is clicked, but when some modifier key is pressed or when the click is on the window frame, the WM may still be controlling the window size or position. It usually grabs the cursor while doing so - and if not then there's apparently nothing we can do. When using undecorated mode we handle this case "correctly" by going through the corresponding Windows non-client message loop until mouse buttons are released, but when using decorated windows the window decoration is empty from the Wine perspective and any window event is considered as happening in the client area. This leads to some issues when the window is moved or resized, with applications applying clipping rectangles immediately and not updating it on subsequent window move/resize messages. Delaying the WM_ACTIVATE until the WM releases its grab and the window move is complete helps solving this situation. This delay is implemented here by resending the FocusIn/WM_TAKE_FOCUS events to the window until the cursor can be grabbed and then processing them normally. winex11.drv: Fix focus delay issues with desktop clipping. CW-Bug-Id: #21879 --- dlls/winex11.drv/event.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 9e8c9d67d61..23d45ed8cf0 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -271,6 +271,27 @@ static Bool filter_event( Display *display, XEvent *event, char *arg ) } } +static void wait_grab_pointer( Display *display ) +{ + RECT rect; + + /* release cursor grab held by any Wine process */ + NtUserGetClipCursor( &rect ); + NtUserClipCursor( NULL ); + + while (XGrabPointer( display, root_window, False, 0, GrabModeAsync, GrabModeAsync, + None, None, CurrentTime ) != GrabSuccess) + { + LARGE_INTEGER timeout = {.QuadPart = -10 * (ULONGLONG)10000}; + NtDelayExecution( FALSE, &timeout ); + } + + XUngrabPointer( display, CurrentTime ); + XFlush( display ); + + /* restore the previously used clipping rect */ + NtUserClipCursor( &rect ); +} enum event_merge_action { @@ -608,6 +629,8 @@ static void set_focus( Display *display, HWND hwnd, Time time ) Window win; GUITHREADINFO threadinfo; + wait_grab_pointer( display ); + TRACE( "setting foreground window to %p\n", hwnd ); NtUserSetForegroundWindow( hwnd ); From ad9126d3cbf825c20d25115af8b3996fb5d81d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 17 Dec 2019 16:58:07 +0100 Subject: [PATCH 0310/1506] Revert "winex11.drv: Only call XWarpPointer if we can get exclusive pointer grab." This reverts commit 74efb3e872aebf57a42d62b52e149ae26f320c9a. We are now only activating windows only once the window manager has released its grab, it should be safer to let them move the pointer around and this should not be needed anymore. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47771 CW-Bug-Id: #21879 --- dlls/winex11.drv/mouse.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 02a1b5ae8c0..bb5198de7a4 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1457,23 +1457,10 @@ BOOL X11DRV_SetCursorPos( INT x, INT y ) return FALSE; } - if (!clipping_cursor && - XGrabPointer( data->display, root_window, False, - PointerMotionMask | ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync, None, None, CurrentTime ) != GrabSuccess) - { - WARN( "refusing to warp pointer to %u, %u without exclusive grab\n", (int)pos.x, (int)pos.y ); - return FALSE; - } - TRACE( "real setting to %s\n", wine_dbgstr_point( &pos ) ); XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0, pos.x, pos.y ); data->warp_serial = NextRequest( data->display ); - - if (!clipping_cursor) - XUngrabPointer( data->display, CurrentTime ); - XNoOp( data->display ); XFlush( data->display ); /* avoids bad mouse lag in games that do their own mouse warping */ TRACE( "warped to (fake) %d,%d serial %lu\n", x, y, data->warp_serial ); From 5312bd7758569b86da8373a1beeb83a2dd95ca95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 9 Dec 2019 20:28:20 +0100 Subject: [PATCH 0311/1506] HACK: mutter: winex11.drv: Add a bit of delay before restoring mouse grabs on FocusIn. CW-Bug-Id: #21879 --- dlls/winex11.drv/event.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 23d45ed8cf0..b83917034b7 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -829,6 +829,17 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) if (is_virtual_desktop() && hwnd == NtUserGetDesktopWindow()) retry_grab_clipping_window(); if (hwnd == NtUserGetDesktopWindow()) return FALSE; + /* Focus was just restored but it can be right after super was + * pressed and gnome-shell needs a bit of time to respond and + * toggle the activity view. If we grab the cursor right away + * it will cancel it and super key will do nothing. + */ + if (event->mode == NotifyUngrab && wm_is_mutter(event->display)) + { + LARGE_INTEGER timeout = {.QuadPart = 100 * -10000}; + NtDelayExecution( FALSE, &timeout ); + } + x11drv_thread_data()->keymapnotify_hwnd = hwnd; /* when keyboard grab is released, re-apply the cursor clipping rect */ From cdec86ac22be0b0a7980786a2c56f71cacc976c5 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 15 Mar 2021 12:01:25 -0500 Subject: [PATCH 0312/1506] winex11.drv: Flush X connection after ungrabbing the pointer. CW-Bug-Id: #18169 CW-Bug-Id: #21879 --- dlls/winex11.drv/mouse.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index bb5198de7a4..1f2a26e5ea7 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -500,7 +500,11 @@ void ungrab_clipping_window(void) TRACE( "no longer clipping\n" ); XUnmapWindow( data->display, clip_window ); - if (clipping_cursor) XUngrabPointer( data->display, CurrentTime ); + if (clipping_cursor) + { + XUngrabPointer( data->display, CurrentTime ); + XFlush( data->display ); + } clipping_cursor = FALSE; data->clipping_cursor = FALSE; From d3a0e4fc5ceff44317836a2ced0913e24c520c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Jun 2023 10:37:59 +0200 Subject: [PATCH 0313/1506] win32u: Keep the clipping rectangle inside a fullscreen window. CW-Bug-Id: #21707 --- dlls/win32u/input.c | 22 ++++++++++++++++++++-- dlls/win32u/sysparams.c | 2 +- dlls/win32u/win32u_private.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 0cca9791903..57037dcabb5 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2642,13 +2642,15 @@ BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ) */ BOOL WINAPI NtUserClipCursor( const RECT *rect ) { + static int keep_inside_window = -1; + HWND foreground = NtUserGetForegroundWindow(); UINT dpi; BOOL ret; - RECT new_rect; + RECT new_rect, full_rect; TRACE( "Clipping to %s\n", wine_dbgstr_rect(rect) ); - if (NtUserGetForegroundWindow() == NtUserGetDesktopWindow()) + if (foreground == NtUserGetDesktopWindow()) { WARN( "desktop is foreground, ignoring ClipCursor\n" ); rect = NULL; @@ -2663,6 +2665,22 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect ) new_rect = map_dpi_rect( *rect, dpi, get_monitor_dpi( monitor )); rect = &new_rect; } + + if (keep_inside_window == -1) + { + const char *sgi = getenv( "SteamGameId" ); + keep_inside_window = sgi && !strcmp( sgi, "730830" ); /* Escape from Monkey Island */ + } + + /* keep the mouse clipped inside of a fullscreen foreground window */ + if (keep_inside_window && NtUserGetWindowRect( foreground, &full_rect ) && is_window_rect_full_screen( &full_rect )) + { + full_rect.left = max( full_rect.left, min( full_rect.right - 1, rect->left ) ); + full_rect.right = max( full_rect.left, min( full_rect.right - 1, rect->right ) ); + full_rect.top = max( full_rect.top, min( full_rect.bottom - 1, rect->top ) ); + full_rect.bottom = max( full_rect.top, min( full_rect.bottom - 1, rect->bottom ) ); + rect = &full_rect; + } } SERVER_START_REQ( set_cursor ) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index ad6e7dce39b..cea7e2cbc73 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2329,7 +2329,7 @@ RECT get_virtual_screen_rect( UINT dpi ) return rect; } -static BOOL is_window_rect_full_screen( const RECT *rect ) +BOOL is_window_rect_full_screen( const RECT *rect ) { struct monitor *monitor; BOOL ret = FALSE; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index b08c0ceb716..6b518e6023d 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -178,6 +178,7 @@ extern int get_system_metrics( int index ); extern UINT get_thread_dpi(void); extern DPI_AWARENESS get_thread_dpi_awareness(void); extern RECT get_virtual_screen_rect( UINT dpi ); +extern BOOL is_window_rect_full_screen( const RECT *rect ); extern BOOL is_exiting_thread( DWORD tid ); extern POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ); extern RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ); From 88ee01769e91a555050a929af649eb450857e72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 Mar 2021 00:10:49 +0100 Subject: [PATCH 0314/1506] winex11.drv: Move Xfixes extension query to process_attach. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45277 CW-Bug-Id: 16608 --- dlls/winex11.drv/clipboard.c | 26 ++------------ dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 63 ++++++++++++++++++++++++++++++++++ dlls/winex11.drv/xfixes.h | 36 +++++++++++++++++++ 4 files changed, 103 insertions(+), 24 deletions(-) create mode 100644 dlls/winex11.drv/xfixes.h diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 087e0aab79b..3714e15780d 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -83,6 +83,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "x11drv.h" +#include "xfixes.h" #ifdef HAVE_X11_EXTENSIONS_XFIXES_H #include @@ -199,7 +200,6 @@ static UINT rendered_formats; static ULONG last_clipboard_update; static struct clipboard_format **current_x11_formats; static unsigned int nb_current_x11_formats; -static BOOL use_xfixes; Display *clipboard_display = NULL; @@ -2170,28 +2170,6 @@ static BOOL selection_notify_event( HWND hwnd, XEvent *event ) static void xfixes_init(void) { #ifdef SONAME_LIBXFIXES - typeof(XFixesSelectSelectionInput) *pXFixesSelectSelectionInput; - typeof(XFixesQueryExtension) *pXFixesQueryExtension; - typeof(XFixesQueryVersion) *pXFixesQueryVersion; - - int event_base, error_base; - int major = 3, minor = 0; - void *handle; - - handle = dlopen(SONAME_LIBXFIXES, RTLD_NOW); - if (!handle) return; - - pXFixesQueryExtension = dlsym(handle, "XFixesQueryExtension"); - if (!pXFixesQueryExtension) return; - pXFixesQueryVersion = dlsym(handle, "XFixesQueryVersion"); - if (!pXFixesQueryVersion) return; - pXFixesSelectSelectionInput = dlsym(handle, "XFixesSelectSelectionInput"); - if (!pXFixesSelectSelectionInput) return; - - if (!pXFixesQueryExtension(clipboard_display, &event_base, &error_base)) - return; - pXFixesQueryVersion(clipboard_display, &major, &minor); - use_xfixes = (major >= 1); if (!use_xfixes) return; pXFixesSelectSelectionInput(clipboard_display, import_window, x11drv_atom(CLIPBOARD), @@ -2205,7 +2183,7 @@ static void xfixes_init(void) XFixesSelectionWindowDestroyNotifyMask | XFixesSelectionClientCloseNotifyMask); } - X11DRV_register_event_handler(event_base + XFixesSelectionNotify, + X11DRV_register_event_handler(xfixes_event_base + XFixesSelectionNotify, selection_notify_event, "XFixesSelectionNotify"); TRACE("xfixes succesully initialized\n"); #else diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index fac4a41de05..620eadee8ae 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -449,6 +449,7 @@ extern BOOL use_primary_selection; extern BOOL use_system_cursors; extern BOOL grab_fullscreen; extern BOOL usexcomposite; +extern BOOL use_xfixes; extern BOOL managed_mode; extern BOOL decorated_mode; extern BOOL private_color_map; @@ -456,6 +457,7 @@ extern int primary_monitor; extern int copy_default_colors; extern int alloc_system_colors; extern int xrender_error_base; +extern int xfixes_event_base; extern char *process_name; extern Display *clipboard_display; extern WNDPROC client_foreign_window_proc; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 4a0cc3a4d53..c989d557c91 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -50,6 +50,7 @@ #include "x11drv.h" #include "winreg.h" #include "xcomposite.h" +#include "xfixes.h" #include "wine/server.h" #include "wine/debug.h" #include "wine/list.h" @@ -71,6 +72,7 @@ Window root_window; BOOL usexvidmode = FALSE; BOOL usexrandr = TRUE; BOOL usexcomposite = TRUE; +BOOL use_xfixes = FALSE; BOOL use_take_focus = FALSE; BOOL use_primary_selection = FALSE; BOOL use_system_cursors = TRUE; @@ -86,6 +88,7 @@ int copy_default_colors = 128; int alloc_system_colors = 256; int limit_number_of_resolutions = 0; int xrender_error_base = 0; +int xfixes_event_base = 0; char *process_name = NULL; WNDPROC client_foreign_window_proc = NULL; BOOL vulkan_disable_child_window_rendering_hack = FALSE; @@ -608,6 +611,63 @@ static void X11DRV_XComposite_Init(void) } #endif /* defined(SONAME_LIBXCOMPOSITE) */ +#ifdef SONAME_LIBXFIXES + +#define MAKE_FUNCPTR(f) typeof(f) * p##f; +MAKE_FUNCPTR(XFixesQueryExtension) +MAKE_FUNCPTR(XFixesQueryVersion) +MAKE_FUNCPTR(XFixesCreateRegion) +MAKE_FUNCPTR(XFixesCreateRegionFromGC) +MAKE_FUNCPTR(XFixesSelectSelectionInput) +#undef MAKE_FUNCPTR + +static void x11drv_load_xfixes(void) +{ + int event, error, major = 3, minor = 0; + void *xfixes; + + if (!(xfixes = dlopen(SONAME_LIBXFIXES, RTLD_NOW))) + { + WARN("Xfixes library %s not found, disabled.\n", SONAME_LIBXFIXES); + return; + } + +#define LOAD_FUNCPTR(f) \ + if (!(p##f = dlsym(xfixes, #f))) \ + { \ + WARN("Xfixes function %s not found, disabled\n", #f); \ + dlclose(xfixes); \ + return; \ + } + LOAD_FUNCPTR(XFixesQueryExtension) + LOAD_FUNCPTR(XFixesQueryVersion) + LOAD_FUNCPTR(XFixesCreateRegion) + LOAD_FUNCPTR(XFixesCreateRegionFromGC) + LOAD_FUNCPTR(XFixesSelectSelectionInput) +#undef LOAD_FUNCPTR + + if (!pXFixesQueryExtension(gdi_display, &event, &error)) + { + WARN("Xfixes extension not found, disabled.\n"); + dlclose(xfixes); + return; + } + + if (!pXFixesQueryVersion(gdi_display, &major, &minor) || + major < 2) + { + WARN("Xfixes version 2.0 not found, disabled.\n"); + dlclose(xfixes); + return; + } + + TRACE("Xfixes, error %d, event %d, version %d.%d found\n", + error, event, major, minor); + use_xfixes = TRUE; + xfixes_event_base = event; +} +#endif /* SONAME_LIBXFIXES */ + static void init_visuals( Display *display, int screen ) { int count; @@ -732,6 +792,9 @@ static NTSTATUS x11drv_init( void *arg ) X11DRV_XF86VM_Init(); /* initialize XRandR */ X11DRV_XRandR_Init(); +#ifdef SONAME_LIBXFIXES + x11drv_load_xfixes(); +#endif #ifdef SONAME_LIBXCOMPOSITE X11DRV_XComposite_Init(); #endif diff --git a/dlls/winex11.drv/xfixes.h b/dlls/winex11.drv/xfixes.h new file mode 100644 index 00000000000..f3beea5efed --- /dev/null +++ b/dlls/winex11.drv/xfixes.h @@ -0,0 +1,36 @@ +/* + * Wine X11DRV Xfixes interface + * + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#ifndef __WINE_XFIXES_H +#define __WINE_XFIXES_H + +#ifndef __WINE_CONFIG_H +# error You must include config.h to use this header +#endif + +#ifdef SONAME_LIBXFIXES +#include +#define MAKE_FUNCPTR(f) extern typeof(f) * p##f; +MAKE_FUNCPTR(XFixesQueryExtension) +MAKE_FUNCPTR(XFixesQueryVersion) +MAKE_FUNCPTR(XFixesSelectSelectionInput) +#undef MAKE_FUNCPTR +#endif /* defined(SONAME_LIBXFIXES) */ + +#endif /* __WINE_XFIXES_H */ From 97688ca3cfdd6e5ea6f51e9eda0716d1946aae31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 25 Jul 2023 10:38:35 +0200 Subject: [PATCH 0315/1506] winex11: Use XFixes to hide cursor before warping it. XWayland only allows warping the cursor if it is not visible. Fixes a regression from the periodic cursor sync removal. CW-Bug-Id: #21879 --- dlls/winex11.drv/mouse.c | 4 +++- dlls/winex11.drv/x11drv_main.c | 4 ++++ dlls/winex11.drv/xfixes.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 1f2a26e5ea7..c052bdd692c 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -54,6 +54,7 @@ MAKE_FUNCPTR(XcursorLibraryLoadCursor); #define OEMRESOURCE #include "x11drv.h" +#include "xfixes.h" #include "winreg.h" #include "wine/server.h" #include "wine/debug.h" @@ -1463,9 +1464,10 @@ BOOL X11DRV_SetCursorPos( INT x, INT y ) TRACE( "real setting to %s\n", wine_dbgstr_point( &pos ) ); + pXFixesHideCursor( data->display, root_window ); XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0, pos.x, pos.y ); data->warp_serial = NextRequest( data->display ); - XNoOp( data->display ); + pXFixesShowCursor( data->display, root_window ); XFlush( data->display ); /* avoids bad mouse lag in games that do their own mouse warping */ TRACE( "warped to (fake) %d,%d serial %lu\n", x, y, data->warp_serial ); return TRUE; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index c989d557c91..6488114a7d6 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -614,11 +614,13 @@ static void X11DRV_XComposite_Init(void) #ifdef SONAME_LIBXFIXES #define MAKE_FUNCPTR(f) typeof(f) * p##f; +MAKE_FUNCPTR(XFixesHideCursor) MAKE_FUNCPTR(XFixesQueryExtension) MAKE_FUNCPTR(XFixesQueryVersion) MAKE_FUNCPTR(XFixesCreateRegion) MAKE_FUNCPTR(XFixesCreateRegionFromGC) MAKE_FUNCPTR(XFixesSelectSelectionInput) +MAKE_FUNCPTR(XFixesShowCursor) #undef MAKE_FUNCPTR static void x11drv_load_xfixes(void) @@ -639,11 +641,13 @@ static void x11drv_load_xfixes(void) dlclose(xfixes); \ return; \ } + LOAD_FUNCPTR(XFixesHideCursor) LOAD_FUNCPTR(XFixesQueryExtension) LOAD_FUNCPTR(XFixesQueryVersion) LOAD_FUNCPTR(XFixesCreateRegion) LOAD_FUNCPTR(XFixesCreateRegionFromGC) LOAD_FUNCPTR(XFixesSelectSelectionInput) + LOAD_FUNCPTR(XFixesShowCursor) #undef LOAD_FUNCPTR if (!pXFixesQueryExtension(gdi_display, &event, &error)) diff --git a/dlls/winex11.drv/xfixes.h b/dlls/winex11.drv/xfixes.h index f3beea5efed..6cd4e48425b 100644 --- a/dlls/winex11.drv/xfixes.h +++ b/dlls/winex11.drv/xfixes.h @@ -27,9 +27,11 @@ #ifdef SONAME_LIBXFIXES #include #define MAKE_FUNCPTR(f) extern typeof(f) * p##f; +MAKE_FUNCPTR(XFixesHideCursor) MAKE_FUNCPTR(XFixesQueryExtension) MAKE_FUNCPTR(XFixesQueryVersion) MAKE_FUNCPTR(XFixesSelectSelectionInput) +MAKE_FUNCPTR(XFixesShowCursor) #undef MAKE_FUNCPTR #endif /* defined(SONAME_LIBXFIXES) */ From f4939225cf18a90bc73da2c13af3d6f498c4bb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 8 Sep 2023 14:24:11 +0200 Subject: [PATCH 0316/1506] winex11: Always ignore MotionNotify event after SetCursorPos. Trying to workaround spurious Wayland mouse motion. CW-Bug-Id: #22650 --- dlls/winex11.drv/mouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index c052bdd692c..b8bd05f76db 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1667,7 +1667,7 @@ BOOL X11DRV_MotionNotify( HWND hwnd, XEvent *xev ) input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; - if (!hwnd && is_old_motion_event( event->serial )) + if (is_old_motion_event( event->serial )) { TRACE( "pos %d,%d old serial %lu, ignoring\n", event->x, event->y, event->serial ); return FALSE; @@ -1929,7 +1929,7 @@ static BOOL X11DRV_XIDeviceEvent( XIDeviceEvent *event ) TRACE( "evtype %u hwnd %p/%lx pos %f,%f detail %u flags %#x serial %lu\n", event->evtype, hwnd, event->event, event->event_x, event->event_y, event->detail, event->flags, event->serial ); - if (!hwnd && is_old_motion_event( event->serial )) + if (is_old_motion_event( event->serial )) { TRACE( "pos %f,%f old serial %lu, ignoring\n", event->event_x, event->event_y, event->serial ); return FALSE; From dd5cb640c2c4f3729da6eb317af76a28f0c1bf0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 29 Nov 2023 14:52:21 +0100 Subject: [PATCH 0317/1506] HACK: winex11: Drop X11DRV_GetCursorPos entirely. CW-Bug-Id: #22849 --- dlls/winex11.drv/init.c | 1 - dlls/winex11.drv/mouse.c | 25 ------------------------- dlls/winex11.drv/x11drv.h | 1 - 3 files changed, 27 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index b85246ee19d..5576fdd50e6 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -403,7 +403,6 @@ static const struct user_driver_funcs x11drv_funcs = .pNotifyIMEStatus = X11DRV_NotifyIMEStatus, .pDestroyCursorIcon = X11DRV_DestroyCursorIcon, .pSetCursor = X11DRV_SetCursor, - .pGetCursorPos = X11DRV_GetCursorPos, .pSetCursorPos = X11DRV_SetCursorPos, .pClipCursor = X11DRV_ClipCursor, .pSystrayDockInit = X11DRV_SystrayDockInit, diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index b8bd05f76db..53e8080339b 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1473,31 +1473,6 @@ BOOL X11DRV_SetCursorPos( INT x, INT y ) return TRUE; } -/*********************************************************************** - * GetCursorPos (X11DRV.@) - */ -BOOL X11DRV_GetCursorPos(LPPOINT pos) -{ - Display *display = thread_init_display(); - LARGE_INTEGER timeout = {0}; - Window root, child; - int rootX, rootY, winX, winY; - unsigned int xstate; - BOOL ret; - - if (NtWaitForSingleObject(steam_overlay_event, FALSE, &timeout) == WAIT_OBJECT_0) return TRUE; - if (NtWaitForSingleObject(steam_keyboard_event, FALSE, &timeout) == WAIT_OBJECT_0) return TRUE; - - ret = XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &winX, &winY, &xstate ); - if (ret) - { - POINT old = *pos; - *pos = root_to_virtual_screen( winX, winY ); - TRACE( "pointer at %s server pos %s\n", wine_dbgstr_point(pos), wine_dbgstr_point(&old) ); - } - return ret; -} - /*********************************************************************** * ClipCursor (X11DRV.@) */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 620eadee8ae..c9ebb4ce7dd 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -217,7 +217,6 @@ extern void X11DRV_NotifyIMEStatus( HWND hwnd, UINT status ); extern void X11DRV_DestroyCursorIcon( HCURSOR handle ); extern void X11DRV_SetCursor( HWND hwnd, HCURSOR handle ); extern BOOL X11DRV_SetCursorPos( INT x, INT y ); -extern BOOL X11DRV_GetCursorPos( LPPOINT pos ); extern BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset ); extern void X11DRV_SystrayDockInit( HWND systray ); extern BOOL X11DRV_SystrayDockInsert( HWND owner, UINT cx, UINT cy, void *icon ); From 1822e583b8587305047539482c4da38040c0fee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 4 Oct 2021 20:57:55 +0200 Subject: [PATCH 0318/1506] user32: Add support for sending and receiving WM_POINTER* messages. CW-Bug-Id: #18214 --- dlls/user32/misc.c | 3 ++- dlls/win32u/message.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c index 497d40e9dc6..1087bdbbd21 100644 --- a/dlls/user32/misc.c +++ b/dlls/user32/misc.c @@ -497,7 +497,8 @@ BOOL WINAPI GetPointerType(UINT32 id, POINTER_INPUT_TYPE *type) return FALSE; } - *type = PT_MOUSE; + if (id == 1) *type = PT_MOUSE; + else *type = PT_TOUCH; return TRUE; } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index af8fc439a03..f749eb1b14d 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2321,6 +2321,15 @@ static void handle_keyboard_repeat_message( HWND hwnd ) } +static BOOL process_pointer_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data ) +{ + msg->lParam = MAKELONG( msg_data->rawinput.mouse.x, msg_data->rawinput.mouse.y ); + msg->wParam = msg_data->rawinput.mouse.data; + msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt ); + return TRUE; +} + + /*********************************************************************** * process_keyboard_message * @@ -2664,6 +2673,9 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardwar if (msg->message == WM_INPUT || msg->message == WM_INPUT_DEVICE_CHANGE) ret = process_rawinput_message( msg, hw_id, msg_data ); + else if (msg->message == WM_POINTERDOWN || msg->message == WM_POINTERUP || + msg->message == WM_POINTERUPDATE) + ret = process_pointer_message( msg, hw_id, msg_data ); else if (is_keyboard_message( msg->message )) ret = process_keyboard_message( msg, hw_id, hwnd_filter, first, last, remove ); else if (is_mouse_message( msg->message )) @@ -3549,6 +3561,9 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r { case WM_INPUT: case WM_INPUT_DEVICE_CHANGE: + case WM_POINTERDOWN: + case WM_POINTERUP: + case WM_POINTERUPDATE: req->input.hw.rawinput.type = rawinput->header.dwType; switch (rawinput->header.dwType) { From 8d492f6582e0510a4a4012ba087ec7b5216e7284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 4 Oct 2021 20:58:19 +0200 Subject: [PATCH 0319/1506] server: Add support for WM_POINTER* dispatching. CW-Bug-Id: #18214 server: Keep desktop cursor position updated while touch is set. CW-Bug-Id: #19994 --- server/queue.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/server/queue.c b/server/queue.c index e5bd191affc..76088e51e15 100644 --- a/server/queue.c +++ b/server/queue.c @@ -635,6 +635,7 @@ static inline int get_hardware_msg_bit( unsigned int message ) if (message >= WM_KEYFIRST && message <= WM_KEYLAST) return QS_KEY; if (message == WM_WINE_CLIPCURSOR) return QS_RAWINPUT; if (message == WM_WINE_SETCURSOR) return QS_RAWINPUT; + if (message == WM_POINTERDOWN || message == WM_POINTERUP || message == WM_POINTERUPDATE) return QS_POINTER; return QS_MOUSEBUTTON; } @@ -1611,6 +1612,7 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru *msg_code = msg->msg; switch (get_hardware_msg_bit( msg->msg )) { + case QS_POINTER: case QS_RAWINPUT: if (!(win = msg->win) && input) win = input->focus; break; @@ -1681,6 +1683,13 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg if (msg->wparam == VK_SHIFT || msg->wparam == VK_LSHIFT || msg->wparam == VK_RSHIFT) msg->lparam &= ~(KF_EXTENDED << 16); break; + case QS_POINTER: + if (IS_POINTER_PRIMARY_WPARAM( msg_data->rawinput.mouse.data )) + { + prepend_cursor_history( msg->x, msg->y, msg->time, msg_data->info ); + if (update_desktop_cursor_pos( desktop, msg->win, msg->x, msg->y )) always_queue = 1; + } + break; case QS_MOUSEMOVE: prepend_cursor_history( msg->x, msg->y, msg->time, msg_data->info ); /* fallthrough */ @@ -2153,14 +2162,28 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ return; } + if (input->hw.msg == WM_POINTERDOWN || input->hw.msg == WM_POINTERUP || + input->hw.msg == WM_POINTERUPDATE) + source.device = IMDT_TOUCH; + if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return; + if (input->hw.msg == WM_POINTERDOWN || input->hw.msg == WM_POINTERUP || + input->hw.msg == WM_POINTERUPDATE) + { + msg_data = msg->data; + msg_data->info = 0; + msg_data->size = sizeof(*msg_data); + msg_data->flags = input->hw.lparam; + msg_data->rawinput = input->hw.rawinput; + } + msg->win = get_user_full_handle( win ); msg->msg = input->hw.msg; msg->wparam = 0; msg->lparam = input->hw.lparam; - msg->x = desktop->cursor.x; - msg->y = desktop->cursor.y; + msg->x = input->hw.rawinput.mouse.x; + msg->y = input->hw.rawinput.mouse.y; queue_hardware_message( desktop, msg, 1 ); } @@ -2301,7 +2324,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user data->hw_id = msg->unique_id; set_reply_data( msg->data, msg->data_size ); - if ((get_hardware_msg_bit( msg->msg ) == QS_RAWINPUT && (flags & PM_REMOVE)) || + if ((get_hardware_msg_bit( msg->msg ) & (QS_RAWINPUT | QS_POINTER) && (flags & PM_REMOVE)) || is_internal_hardware_message( msg->msg )) release_hardware_message( current->queue, data->hw_id ); return 1; From 0310325e80c07c84f9754d5270c8dbe8e68b45f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Oct 2021 16:11:24 +0200 Subject: [PATCH 0320/1506] winex11.drv: Select XI_RawTouch* input and translate to WM_POINTER*. CW-Bug-Id: #18214 winex11.drv: Only send WM_POINTER messages from the desktop rawinput-only thread. Instead of sending duplicate messages from any thread using XInput2, for instance when cursor is clipped. --- dlls/winex11.drv/event.c | 3 ++ dlls/winex11.drv/mouse.c | 79 ++++++++++++++++++++++++++++++++++++--- dlls/winex11.drv/x11drv.h | 2 + 3 files changed, 79 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index b83917034b7..d076703c79b 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -244,6 +244,9 @@ static Bool filter_event( Display *display, XEvent *event, char *arg ) case XI_RawButtonRelease: return (mask & QS_MOUSEBUTTON) != 0; case XI_RawMotion: + case XI_RawTouchBegin: + case XI_RawTouchUpdate: + case XI_RawTouchEnd: return (mask & QS_INPUT) != 0; case XI_DeviceChanged: return (mask & (QS_INPUT|QS_MOUSEBUTTON)) != 0; diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 53e8080339b..42e5a990d7d 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -337,7 +337,7 @@ void X11DRV_XInput2_Init(void) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H struct x11drv_thread_data *data = x11drv_thread_data(); - int major = 2, minor = 1; + int major = 2, minor = 2; if (xinput2_available && pXIQueryVersion( data->display, &major, &minor ) == Success && pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) @@ -345,7 +345,7 @@ void X11DRV_XInput2_Init(void) else { data->xi2_core_pointer = 0; - WARN( "XInput 2.1 not available\n" ); + WARN( "XInput 2.2 not available\n" ); } #endif } @@ -378,7 +378,13 @@ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) if (event_mask & PointerMotionMask) { XISetMask( mask_bits, XI_DeviceChanged ); - if (raw) XISetMask( mask_bits, XI_RawMotion ); + if (raw) + { + XISetMask( mask_bits, XI_RawMotion ); + XISetMask( mask_bits, XI_RawTouchBegin ); + XISetMask( mask_bits, XI_RawTouchUpdate ); + XISetMask( mask_bits, XI_RawTouchEnd ); + } } if (event_mask & ButtonPressMask) { @@ -1719,7 +1725,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input, RAWINPUT *raw if (x->mode == XIModeRelative && y->mode == XIModeRelative) input->mi.dwFlags &= ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); else if (x->mode == XIModeAbsolute && y->mode == XIModeAbsolute) - input->mi.dwFlags |= MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK; + input->mi.dwFlags |= MOUSEEVENTF_ABSOLUTE; else FIXME( "Unsupported relative/absolute X/Y axis mismatch\n." ); @@ -1805,7 +1811,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.type = INPUT_MOUSE; input.mi.mouseData = 0; - input.mi.dwFlags = MOUSEEVENTF_MOVE; + input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK; input.mi.time = x11drv_time_to_ticks( event->time ); input.mi.dwExtraInfo = 0; input.mi.dx = 0; @@ -1988,6 +1994,63 @@ void X11DRV_XInput2_Load(void) #endif } +static BOOL X11DRV_RawTouchEvent( XGenericEventCookie *xev ) +{ + struct x11drv_thread_data *thread_data = x11drv_thread_data(); + XIRawEvent *event = xev->data; + RAWINPUT rawinput = + { + .header = + { + .dwType = RIM_TYPEMOUSE, + .dwSize = offsetof(RAWINPUT, data) + sizeof(RAWMOUSE), + .hDevice = ULongToHandle(1), /* WINE_MOUSE_HANDLE */ + .wParam = RIM_INPUT, + }, + }; + INPUT input = + { + .type = INPUT_MOUSE, + }; + int flags = 0; + POINT pos; + + if (!thread_data->xi2_rawinput_only) return FALSE; + if (!map_raw_event_coords( event, &input, &rawinput )) return FALSE; + if (!(input.mi.dwFlags & MOUSEEVENTF_ABSOLUTE)) return FALSE; + pos.x = input.mi.dx; + pos.y = input.mi.dy; + + flags = POINTER_MESSAGE_FLAG_INRANGE | POINTER_MESSAGE_FLAG_INCONTACT; + if (!thread_data->xi2_active_touches) thread_data->xi2_primary_touchid = event->detail; + if (thread_data->xi2_primary_touchid == event->detail) flags |= POINTER_MESSAGE_FLAG_PRIMARY; + + input.type = INPUT_HARDWARE; + switch (event->evtype) + { + case XI_RawTouchBegin: + input.hi.uMsg = WM_POINTERDOWN; + flags |= POINTER_MESSAGE_FLAG_NEW; + thread_data->xi2_active_touches++; + TRACE("XI_RawTouchBegin detail %u pos %dx%d, flags %#x\n", event->detail, (int)pos.x, (int)pos.y, flags); + break; + case XI_RawTouchEnd: + input.hi.uMsg = WM_POINTERUP; + thread_data->xi2_active_touches--; + TRACE("XI_RawTouchEnd detail %u pos %dx%d, flags %#x\n", event->detail, (int)pos.x, (int)pos.y, flags); + break; + case XI_RawTouchUpdate: + input.hi.uMsg = WM_POINTERUPDATE; + TRACE("XI_RawTouchUpdate detail %u pos %dx%d, flags %#x\n", event->detail, (int)pos.x, (int)pos.y, flags); + break; + } + + rawinput.data.mouse.usFlags = 0; + rawinput.data.mouse.ulRawButtons = MAKELONG( event->detail, flags ); + + __wine_send_input( 0, &input, &rawinput ); + return TRUE; +} /*********************************************************************** * X11DRV_GenericEvent @@ -2017,6 +2080,12 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) case XI_ButtonRelease: return X11DRV_XIDeviceEvent( event->data ); + case XI_RawTouchBegin: + case XI_RawTouchUpdate: + case XI_RawTouchEnd: + ret = X11DRV_RawTouchEvent( event ); + break; + default: TRACE( "Unhandled event %#x\n", event->evtype ); break; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index c9ebb4ce7dd..214de7b7771 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -402,6 +402,8 @@ struct x11drv_thread_data XIValuatorClassInfo y_valuator; int xi2_core_pointer; /* XInput2 core pointer id */ int xi2_rawinput_only; + int xi2_active_touches; + int xi2_primary_touchid; #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ }; From 020a74a6b19decf4d0a531c0634dc9b352dc4809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 08:36:32 +0100 Subject: [PATCH 0321/1506] winex11.drv: Send legacy and rawinput mouse messages on touch input. CW-Bug-Id: #18214 --- dlls/winex11.drv/mouse.c | 16 ++++++++++++++++ server/queue.c | 2 ++ 2 files changed, 18 insertions(+) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 42e5a990d7d..2b71108a54c 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -2048,6 +2048,22 @@ static BOOL X11DRV_RawTouchEvent( XGenericEventCookie *xev ) rawinput.data.mouse.usFlags = 0; rawinput.data.mouse.ulRawButtons = MAKELONG( event->detail, flags ); + __wine_send_input( 0, &input, &rawinput ); + if (!(flags & POINTER_MESSAGE_FLAG_PRIMARY)) return TRUE; + + input.type = INPUT_MOUSE; + input.mi.mouseData = 0; + input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; + if (event->evtype == XI_RawTouchBegin) input.mi.dwFlags |= MOUSEEVENTF_LEFTDOWN; + if (event->evtype == XI_RawTouchEnd) input.mi.dwFlags |= MOUSEEVENTF_LEFTUP; + input.mi.time = x11drv_time_to_ticks( event->time ); + input.mi.dx = rawinput.data.mouse.lLastX; + input.mi.dy = rawinput.data.mouse.lLastY; + input.mi.dwExtraInfo = 0xff515700; + + rawinput.data.mouse.usFlags = input.mi.dwFlags; + rawinput.data.mouse.ulRawButtons = 0; + __wine_send_input( 0, &input, &rawinput ); return TRUE; } diff --git a/server/queue.c b/server/queue.c index 76088e51e15..aa51719ee14 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1896,6 +1896,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons WM_MOUSEHWHEEL /* 0x1000 = MOUSEEVENTF_HWHEEL */ }; + if ((input->mouse.info & 0xffffff00) == 0xff515700) source.origin = IMDT_TOUCH; + desktop->cursor.last_change = get_tick_count(); flags = input->mouse.flags; time = input->mouse.time; From 35ee39bc1e3a73cf7c35a1dd56fd61ffaf93a6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 9 Nov 2021 02:30:41 +0100 Subject: [PATCH 0322/1506] server: Continuously send pointer update messages while it's down. CW-Bug-Id: #18214 server: Clear POINTER_MESSAGE_FLAG_NEW from the correct field. CW-Bug-Id: #19994 server: Merge WM_POINTERUPDATE messages together. CW-Bug-Id: #19994 server: Keep desktop cursor position updated while touch is set. CW-Bug-Id: #19994 --- server/queue.c | 116 +++++++++++++++++++++++++++++++++++++++++++- server/user.h | 2 + server/window.c | 1 + server/winstation.c | 2 + 4 files changed, 120 insertions(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c index aa51719ee14..de276fa295a 100644 --- a/server/queue.c +++ b/server/queue.c @@ -655,6 +655,36 @@ static inline unsigned int get_unique_id(void) return id; } +static int merge_pointer_update_message( struct thread_input *input, const struct message *msg ) +{ + struct hardware_msg_data *prev_data, *msg_data = msg->data; + struct message *prev; + struct list *ptr; + + for (ptr = list_tail( &input->msg_list ); ptr; ptr = list_prev( &input->msg_list, ptr )) + { + prev = LIST_ENTRY( ptr, struct message, entry ); + if (prev->msg != WM_POINTERUPDATE || !(prev_data = prev->data)) continue; + if (LOWORD(prev_data->rawinput.mouse.data) == LOWORD(msg_data->rawinput.mouse.data)) break; + } + if (!ptr) return 0; + if (prev->result) return 0; + if (prev->win && msg->win && prev->win != msg->win) return 0; + if (prev->type != msg->type) return 0; + /* now we can merge it */ + prev->wparam = msg->wparam; + prev->lparam = msg->lparam; + prev->x = msg->x; + prev->y = msg->y; + prev->time = msg->time; + prev_data->rawinput.mouse.data |= msg_data->rawinput.mouse.data; + prev_data->rawinput.mouse.x = msg_data->rawinput.mouse.x; + prev_data->rawinput.mouse.y = msg_data->rawinput.mouse.y; + list_remove( ptr ); + list_add_tail( &input->msg_list, ptr ); + return 1; +} + /* try to merge a WM_MOUSEMOVE message with the last in the list; return 1 if successful */ static int merge_mousemove( struct thread_input *input, const struct message *msg ) { @@ -664,7 +694,7 @@ static int merge_mousemove( struct thread_input *input, const struct message *ms for (ptr = list_tail( &input->msg_list ); ptr; ptr = list_prev( &input->msg_list, ptr )) { prev = LIST_ENTRY( ptr, struct message, entry ); - if (prev->msg != WM_INPUT) break; + if (prev->msg != WM_INPUT && prev->msg != WM_POINTERUPDATE) break; } if (!ptr) return 0; if (prev->result) return 0; @@ -719,6 +749,7 @@ static int merge_message( struct thread_input *input, const struct message *msg if (msg->msg == WM_MOUSEMOVE) return merge_mousemove( input, msg ); if (msg->msg == WM_WINE_CLIPCURSOR) return merge_unique_message( input, WM_WINE_CLIPCURSOR, msg ); if (msg->msg == WM_WINE_SETCURSOR) return merge_unique_message( input, WM_WINE_SETCURSOR, msg ); + if (msg->msg == WM_POINTERUPDATE) return merge_pointer_update_message( input, msg ); return 0; } @@ -2122,6 +2153,58 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c return wait; } +struct touch +{ + struct list entry; + struct desktop *desktop; + user_handle_t win; + hw_input_t input; + struct timeout_user *timeout; +}; + +static void queue_touch_input_message( void *private ) +{ + struct hw_msg_source source = { IMDT_UNAVAILABLE, IMDT_TOUCH }; + struct touch *touch = private; + struct desktop *desktop = touch->desktop; + const hw_input_t *input = &touch->input; + user_handle_t win = touch->win; + struct hardware_msg_data *msg_data; + struct message *msg; + + if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return; + + msg_data = msg->data; + msg_data->info = 0; + msg_data->size = sizeof(*msg_data); + msg_data->flags = input->hw.lparam; + msg_data->rawinput = input->hw.rawinput; + + msg->win = get_user_full_handle( win ); + msg->msg = input->hw.msg; + msg->wparam = 0; + msg->lparam = input->hw.lparam; + msg->x = input->hw.rawinput.mouse.x; + msg->y = input->hw.rawinput.mouse.y; + + queue_hardware_message( desktop, msg, 1 ); + touch->timeout = add_timeout_user( -160000, queue_touch_input_message, touch ); +} + +static struct touch *find_touch_input( struct desktop *desktop, unsigned int id ) +{ + struct touch *touch; + + LIST_FOR_EACH_ENTRY( touch, &desktop->touches, struct touch, entry ) + if (LOWORD(touch->input.hw.rawinput.mouse.data) == id) return touch; + + touch = mem_alloc( sizeof(struct touch) ); + list_add_tail( &desktop->touches, &touch->entry ); + touch->desktop = desktop; + touch->timeout = NULL; + return touch; +} + /* queue a hardware message for a custom type of event */ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_t win, unsigned int origin, const hw_input_t *input ) @@ -2129,6 +2212,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ struct hw_msg_source source = { IMDT_UNAVAILABLE, origin }; struct hardware_msg_data *msg_data; struct rawinput_message raw_msg; + struct touch *touch; struct message *msg; data_size_t report_size = 0; @@ -2178,6 +2262,21 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ msg_data->size = sizeof(*msg_data); msg_data->flags = input->hw.lparam; msg_data->rawinput = input->hw.rawinput; + touch = find_touch_input( desktop, LOWORD(input->hw.rawinput.mouse.data) ); + if (touch->timeout) remove_timeout_user( touch->timeout ); + if (input->hw.msg != WM_POINTERUP) + { + touch->win = win; + touch->input = *input; + touch->input.hw.msg = WM_POINTERUPDATE; + touch->input.hw.rawinput.mouse.data &= ~(POINTER_MESSAGE_FLAG_NEW << 16); + touch->timeout = add_timeout_user( -160000, queue_touch_input_message, touch ); + } + else + { + list_remove( &touch->entry ); + free( touch ); + } } msg->win = get_user_full_handle( win ); @@ -2504,6 +2603,21 @@ void post_win_event( struct thread *thread, unsigned int event, } } +void free_touches( struct desktop *desktop, user_handle_t window ) +{ + struct touch *touch, *next; + + LIST_FOR_EACH_ENTRY_SAFE( touch, next, &desktop->touches, struct touch, entry ) + { + if (!window || touch->win == window) + { + list_remove( &touch->entry ); + if (touch->timeout) remove_timeout_user( touch->timeout ); + free( touch ); + } + } +} + /* free all hotkeys on a desktop, optionally filtering by window */ void free_hotkeys( struct desktop *desktop, user_handle_t window ) { diff --git a/server/user.h b/server/user.h index 8fa55e09b0f..f3936b7579c 100644 --- a/server/user.h +++ b/server/user.h @@ -72,6 +72,7 @@ struct desktop struct hook_table *global_hooks; /* table of global hooks on this desktop */ struct list hotkeys; /* list of registered hotkeys */ struct timeout_user *close_timeout; /* timeout before closing the desktop */ + struct list touches; /* list of active touches */ struct thread_input *foreground_input; /* thread input of foreground thread */ unsigned int users; /* processes and threads using this desktop */ struct global_cursor cursor; /* global cursor information */ @@ -121,6 +122,7 @@ extern void post_win_event( struct thread *thread, unsigned int event, const WCHAR *module, data_size_t module_size, user_handle_t handle ); extern void free_hotkeys( struct desktop *desktop, user_handle_t window ); +extern void free_touches( struct desktop *desktop, user_handle_t window ); /* region functions */ diff --git a/server/window.c b/server/window.c index a2b277d413a..bd11d0d32de 100644 --- a/server/window.c +++ b/server/window.c @@ -2026,6 +2026,7 @@ void free_window_handle( struct window *win ) if (win == progman_window) progman_window = NULL; if (win == taskman_window) taskman_window = NULL; free_hotkeys( win->desktop, win->handle ); + free_touches( win->desktop, win->handle ); cleanup_clipboard_window( win->desktop, win->handle ); destroy_properties( win ); if (is_desktop_window(win)) diff --git a/server/winstation.c b/server/winstation.c index 5903497d61e..33803ec1990 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -240,6 +240,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned memset( desktop->keystate, 0, sizeof(desktop->keystate) ); list_add_tail( &winstation->desktops, &desktop->entry ); list_init( &desktop->hotkeys ); + list_init( &desktop->touches ); } else { @@ -292,6 +293,7 @@ static void desktop_destroy( struct object *obj ) struct desktop *desktop = (struct desktop *)obj; free_hotkeys( desktop, 0 ); + free_touches( desktop, 0 ); if (desktop->top_window) free_window_handle( desktop->top_window ); if (desktop->msg_window) free_window_handle( desktop->msg_window ); if (desktop->global_hooks) release_object( desktop->global_hooks ); From 2fceda0fa8bdb948c8ee723c8726b038c6e71a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 28 Oct 2021 16:41:17 +0200 Subject: [PATCH 0323/1506] HACK: gamescope: winex11.drv: Use native screen rect for absolute raw event positions. CW-Bug-Id: #18214 --- dlls/winex11.drv/display.c | 3 +++ dlls/winex11.drv/mouse.c | 1 + dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 5 insertions(+) diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 97a2a171ba5..4a97f324482 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv); static struct x11drv_display_device_handler host_handler; static struct x11drv_settings_handler settings_handler; +RECT native_screen_rect; #define NEXT_DEVMODEW(mode) ((DEVMODEW *)((char *)((mode) + 1) + (mode)->dmDriverExtra)) @@ -616,4 +617,6 @@ void X11DRV_DisplayDevices_Init(BOOL force) if (force) force_display_devices_refresh = TRUE; /* trigger refresh in win32u */ NtUserGetDisplayConfigBufferSizes( QDC_ONLY_ACTIVE_PATHS, &num_path, &num_mode ); + + if (!native_screen_rect.bottom) native_screen_rect = NtUserGetVirtualScreenRect(); } diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 2b71108a54c..1c853e9393f 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1730,6 +1730,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input, RAWINPUT *raw FIXME( "Unsupported relative/absolute X/Y axis mismatch\n." ); if (input->mi.dwFlags & MOUSEEVENTF_VIRTUALDESK) SetRect( &virtual_rect, 0, 0, 65535, 65535 ); + else if (wm_is_steamcompmgr( event->display )) virtual_rect = native_screen_rect; else virtual_rect = NtUserGetVirtualScreenRect(); if (x->max <= x->min) x_scale = 1; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 214de7b7771..d5f40de97cc 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -761,6 +761,7 @@ extern BOOL is_window_rect_full_virtual_screen( const RECT *rect ); #define DEPTH_COUNT 3 extern const unsigned int *depths; +extern RECT native_screen_rect; /* Use a distinct type for the settings id, to avoid mixups other types of ids */ typedef struct { ULONG_PTR id; } x11drv_settings_id; From 86201b97e6cfbde0c181e76816aaf8b50aa313a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Oct 2021 14:47:24 +0200 Subject: [PATCH 0324/1506] user32: Translate WM_POINTER* messages to WM_TOUCH in DefWindowProc. CW-Bug-Id: #18214 --- dlls/user32/input.c | 9 --------- dlls/user32/user32.spec | 2 +- dlls/win32u/defwnd.c | 32 ++++++++++++++++++++++++++++++++ dlls/win32u/input.c | 9 +++++++++ dlls/win32u/main.c | 5 +++++ dlls/win32u/win32u.spec | 2 +- dlls/wow64win/user.c | 8 ++++++++ include/ntuser.h | 1 + 8 files changed, 57 insertions(+), 11 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 238571361c8..9b2648332cd 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -712,15 +712,6 @@ BOOL WINAPI GetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, return FALSE; } -/********************************************************************** - * IsTouchWindow (USER32.@) - */ -BOOL WINAPI IsTouchWindow( HWND hwnd, ULONG *flags ) -{ - FIXME( "hwnd %p, flags %p stub!\n", hwnd, flags ); - return FALSE; -} - /***************************************************************************** * RegisterTouchWindow (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 042730845f1..e8282c6b5a6 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -482,7 +482,7 @@ @ stdcall IsProcessDPIAware() @ stdcall IsRectEmpty(ptr) # @ stub IsServerSideWindow -@ stdcall IsTouchWindow(long ptr) +@ stdcall IsTouchWindow(long ptr) NtUserIsTouchWindow @ stdcall IsValidDpiAwarenessContext(long) @ stdcall IsWinEventHookInstalled(long) @ stdcall IsWindow(long) diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index b7153095e55..6828c30c115 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -30,6 +30,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(win); +#define WINE_MOUSE_HANDLE ((HANDLE)1) +#define WINE_KEYBOARD_HANDLE ((HANDLE)2) #define DRAG_FILE 0x454c4946 @@ -2953,6 +2955,36 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, 0, NtUserSendMessage, ansi ); } break; + + case WM_POINTERDOWN: + case WM_POINTERUP: + case WM_POINTERUPDATE: + { + TOUCHINPUT touchinput; + + if (!NtUserIsTouchWindow( hwnd, NULL )) return 0; + touchinput.x = LOWORD( lparam ) * 100; + touchinput.y = HIWORD( lparam ) * 100; + touchinput.hSource = WINE_MOUSE_HANDLE; + touchinput.dwID = GET_POINTERID_WPARAM( wparam ); + touchinput.dwFlags = TOUCHEVENTF_NOCOALESCE | TOUCHEVENTF_PALM; + if (msg == WM_POINTERDOWN) touchinput.dwFlags |= TOUCHEVENTF_DOWN; + if (msg == WM_POINTERUP) touchinput.dwFlags |= TOUCHEVENTF_UP; + if (msg == WM_POINTERUPDATE) touchinput.dwFlags |= TOUCHEVENTF_MOVE; + if (IS_POINTER_PRIMARY_WPARAM( wparam )) touchinput.dwFlags |= TOUCHEVENTF_PRIMARY; + touchinput.dwMask = 0; + touchinput.dwTime = NtGetTickCount(); + touchinput.dwExtraInfo = 0; + touchinput.cxContact = 0; + touchinput.cyContact = 0; + + send_message( hwnd, WM_TOUCH, MAKELONG( 1, 0 ), (LPARAM)&touchinput ); + break; + } + + case WM_TOUCH: + /* FIXME: CloseTouchInputHandle( (HTOUCHINPUT)lparam ); */ + return 0; } return result; diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 57037dcabb5..9f08e2de435 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2561,6 +2561,15 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) return ret; } +/********************************************************************** + * NtUserIsTouchWindow (win32u.@) + */ +BOOL WINAPI NtUserIsTouchWindow( HWND hwnd, ULONG *flags ) +{ + FIXME( "hwnd %p, flags %p stub!\n", hwnd, flags ); + return FALSE; +} + /********************************************************************** * NtUserGetPointerInfoList (win32u.@) */ diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index 2dc66e5df11..1808c59d030 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -1636,6 +1636,11 @@ BOOL SYSCALL_API NtUserIsMouseInPointerEnabled(void) __ASM_SYSCALL_FUNC( __id_NtUserIsMouseInPointerEnabled ); } +BOOL SYSCALL_API NtUserIsTouchWindow( HWND hwnd, ULONG *flags ) +{ + __ASM_SYSCALL_FUNC( __id_NtUserIsTouchWindow ); +} + BOOL SYSCALL_API NtUserKillTimer( HWND hwnd, UINT_PTR id ) { __ASM_SYSCALL_FUNC( __id_NtUserKillTimer ); diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 24dccb6ec1d..a5460c8b117 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1056,7 +1056,7 @@ @ stub NtUserIsNonClientDpiScalingEnabled @ stub NtUserIsResizeLayoutSynchronizationEnabled @ stub NtUserIsTopLevelWindow -@ stub NtUserIsTouchWindow +@ stdcall -syscall NtUserIsTouchWindow(long ptr) @ stub NtUserIsWindowBroadcastingDpiToChildren @ stub NtUserIsWindowGDIScaledDpiMessageEnabled @ stdcall -syscall NtUserKillTimer(long long) diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 44b422ef62c..36a28f7435a 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3226,6 +3226,14 @@ NTSTATUS WINAPI wow64_NtUserIsMouseInPointerEnabled( UINT *args ) return NtUserIsMouseInPointerEnabled(); } +NTSTATUS WINAPI wow64_NtUserIsTouchWindow( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + ULONG *flags = get_ptr( &args ); + + return NtUserIsTouchWindow( hwnd, flags ); +} + NTSTATUS WINAPI wow64_NtUserKillTimer( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index cf9ff0ed732..b6775a40495 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -688,6 +688,7 @@ W32KAPI BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ); W32KAPI BOOL WINAPI NtUserIsMouseInPointerEnabled(void); W32KAPI BOOL WINAPI NtUserInvalidateRect( HWND hwnd, const RECT *rect, BOOL erase ); W32KAPI BOOL WINAPI NtUserInvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase ); +W32KAPI BOOL WINAPI NtUserIsTouchWindow( HWND hwnd, ULONG *flags ); W32KAPI BOOL WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id ); W32KAPI BOOL WINAPI NtUserLockWindowUpdate( HWND hwnd ); W32KAPI BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt ); From 29c51ea9cd42f7644248348624d0d8226d6e9902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 22 Nov 2022 08:45:36 +0100 Subject: [PATCH 0325/1506] user32: Implement semi-stub touch input support. CW-Bug-Id: #18214 --- dlls/user32/input.c | 21 +++++++++------------ dlls/win32u/input.c | 21 +++++++++++++++++++-- dlls/win32u/ntuser_private.h | 1 + dlls/win32u/sysparams.c | 6 ++++++ dlls/win32u/win32u_private.h | 2 ++ include/ntuser.h | 2 ++ 6 files changed, 39 insertions(+), 14 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 9b2648332cd..b295c4c4dff 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -697,9 +697,8 @@ LRESULT WINAPI DefRawInputProc( RAWINPUT **data, INT data_count, UINT header_siz */ BOOL WINAPI CloseTouchInputHandle( HTOUCHINPUT handle ) { - FIXME( "handle %p stub!\n", handle ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + TRACE( "handle %p.\n", handle ); + return TRUE; } /***************************************************************************** @@ -707,9 +706,9 @@ BOOL WINAPI CloseTouchInputHandle( HTOUCHINPUT handle ) */ BOOL WINAPI GetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, int size ) { - FIXME( "handle %p, count %u, ptr %p, size %u stub!\n", handle, count, ptr, size ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + TRACE( "handle %p, count %u, ptr %p, size %u.\n", handle, count, ptr, size ); + *ptr = *(TOUCHINPUT *)handle; + return TRUE; } /***************************************************************************** @@ -717,9 +716,8 @@ BOOL WINAPI GetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, */ BOOL WINAPI RegisterTouchWindow( HWND hwnd, ULONG flags ) { - FIXME( "hwnd %p, flags %#lx stub!\n", hwnd, flags ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + TRACE( "hwnd %p, flags %#lx.\n", hwnd, flags ); + return NtUserCallTwoParam( (ULONG_PTR)hwnd, flags, NtUserCallTwoParam_RegisterTouchWindow ); } /***************************************************************************** @@ -727,9 +725,8 @@ BOOL WINAPI RegisterTouchWindow( HWND hwnd, ULONG flags ) */ BOOL WINAPI UnregisterTouchWindow( HWND hwnd ) { - FIXME( "hwnd %p stub!\n", hwnd ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + TRACE( "hwnd %p.\n", hwnd ); + return NtUserCallOneParam( (ULONG_PTR)hwnd, NtUserCallOneParam_UnregisterTouchWindow ); } /***************************************************************************** diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 9f08e2de435..7984fe9f385 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2566,8 +2566,25 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) */ BOOL WINAPI NtUserIsTouchWindow( HWND hwnd, ULONG *flags ) { - FIXME( "hwnd %p, flags %p stub!\n", hwnd, flags ); - return FALSE; + DWORD win_flags = win_set_flags( hwnd, 0, 0 ); + TRACE( "hwnd %p, flags %p.\n", hwnd, flags ); + return (win_flags & WIN_IS_TOUCH) != 0; +} + + +BOOL register_touch_window( HWND hwnd, UINT flags ) +{ + DWORD win_flags = win_set_flags( hwnd, WIN_IS_TOUCH, 0 ); + TRACE( "hwnd %p, flags %#x.\n", hwnd, flags ); + return (win_flags & WIN_IS_TOUCH) == 0; +} + + +BOOL unregister_touch_window( HWND hwnd ) +{ + DWORD win_flags = win_set_flags( hwnd, 0, WIN_IS_TOUCH ); + TRACE( "hwnd %p.\n", hwnd ); + return (win_flags & WIN_IS_TOUCH) != 0; } /********************************************************************** diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 2297af8bdd6..782172377c9 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -105,6 +105,7 @@ typedef struct tagWND #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */ #define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */ #define WIN_IS_ACTIVATING 0x0100 /* the window is being activated */ +#define WIN_IS_TOUCH 0x0200 /* the window has been registered for touch input */ #define WND_OTHER_PROCESS ((WND *)1) /* returned by get_win_ptr on unknown window handles */ #define WND_DESKTOP ((WND *)2) /* returned by get_win_ptr on the desktop window */ diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index cea7e2cbc73..2d14438dec9 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6338,6 +6338,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserCallOneParam_SetKeyboardAutoRepeat: return set_keyboard_auto_repeat( arg ); + case NtUserCallOneParam_UnregisterTouchWindow: + return unregister_touch_window( (HWND)arg ); + /* temporary exports */ case NtUserGetDeskPattern: return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg ); @@ -6370,6 +6373,9 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code case NtUserCallTwoParam_MonitorFromRect: return HandleToUlong( monitor_from_rect( (const RECT *)arg1, arg2, get_thread_dpi() )); + case NtUserCallTwoParam_RegisterTouchWindow: + return register_touch_window( (HWND)arg1, arg2 ); + case NtUserCallTwoParam_SetCaretPos: return set_caret_pos( arg1, arg2 ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 6b518e6023d..805a34a635a 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -108,6 +108,8 @@ extern void update_mouse_tracking_info( HWND hwnd ); extern BOOL get_clip_cursor( RECT *rect ); extern BOOL process_wine_clipcursor( HWND hwnd, UINT flags, BOOL reset ); extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ); +extern BOOL register_touch_window( HWND hwnd, UINT flags ); +extern BOOL unregister_touch_window( HWND hwnd ); /* menu.c */ extern HMENU create_menu( BOOL is_popup ); diff --git a/include/ntuser.h b/include/ntuser.h index b6775a40495..405a74c0361 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -893,6 +893,7 @@ enum NtUserCallOneParam_SetCaretBlinkTime, NtUserCallOneParam_SetProcessDefaultLayout, NtUserCallOneParam_SetKeyboardAutoRepeat, + NtUserCallOneParam_UnregisterTouchWindow, /* temporary exports */ NtUserGetDeskPattern, }; @@ -1019,6 +1020,7 @@ enum NtUserCallTwoParam_GetMonitorInfo, NtUserCallTwoParam_GetSystemMetricsForDpi, NtUserCallTwoParam_MonitorFromRect, + NtUserCallTwoParam_RegisterTouchWindow, NtUserCallTwoParam_SetCaretPos, NtUserCallTwoParam_SetIconParam, NtUserCallTwoParam_UnhookWindowsHook, From 6ea20f9a3b8a32fa2df5c535304bf87fc8f79750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 21 May 2021 14:57:46 +0200 Subject: [PATCH 0326/1506] user32: Implement rudimentary EnableMouseInPointer support. CW-Bug-Id: 18943 Squashed with: user32: Send EnableMouseInPointer emulated messages earlier. Emulating these messages should probably be done elsewhere. CW-Bug-Id: #21331 winex11.drv: Send legacy and rawinput mouse messages on touch input. CW-Bug-Id: #18214 user32: Better emulate EnableMouseInPointer messages. This is still not very good, but it better matches what Windows does, and it fixes mouse input with Return to Monkey Island. CW-Bug-Id: #21331 --- dlls/win32u/input.c | 8 ++++--- dlls/win32u/message.c | 45 ++++++++++++++++++++++++++++++++++++ dlls/win32u/win32u_private.h | 1 + 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 7984fe9f385..19388f7d9b5 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -546,6 +546,8 @@ static WCHAR kbd_tables_vkey_to_wchar( const KBDTABLES *tables, UINT vkey, const #undef NEXT_ENTRY +BOOL enable_mouse_in_pointer = FALSE; + /******************************************************************* * NtUserGetForegroundWindow (win32u.@) */ @@ -2485,9 +2487,9 @@ void toggle_caret( HWND hwnd ) */ BOOL WINAPI NtUserEnableMouseInPointer( BOOL enable ) { - FIXME( "enable %u stub!\n", enable ); - RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + FIXME( "enable %u semi-stub!\n", enable ); + enable_mouse_in_pointer = TRUE; + return TRUE; } /********************************************************************** diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index f749eb1b14d..a1c010f2024 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2491,6 +2491,51 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt ); SetThreadDpiAwarenessContext( get_window_dpi_awareness_context( msg->hwnd )); + if ((extra_info & 0xffffff00) != 0xff515700 && enable_mouse_in_pointer) + { + WORD flags = POINTER_MESSAGE_FLAG_PRIMARY; + DWORD message = 0; + + switch (msg->message) + { + case WM_MOUSEMOVE: + message = WM_POINTERUPDATE; + flags |= POINTER_MESSAGE_FLAG_INRANGE; + break; + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_XBUTTONDOWN: + message = WM_POINTERDOWN; + flags |= POINTER_MESSAGE_FLAG_INRANGE|POINTER_MESSAGE_FLAG_INCONTACT; + if (msg->message == WM_LBUTTONDOWN) flags |= POINTER_MESSAGE_FLAG_FIRSTBUTTON; + if (msg->message == WM_RBUTTONDOWN) flags |= POINTER_MESSAGE_FLAG_SECONDBUTTON; + if (msg->message == WM_MBUTTONDOWN) flags |= POINTER_MESSAGE_FLAG_THIRDBUTTON; + if (msg->message == WM_XBUTTONDOWN && LOWORD( msg->wParam ) == MK_LBUTTON) flags |= POINTER_MESSAGE_FLAG_FIRSTBUTTON; + if (msg->message == WM_XBUTTONDOWN && LOWORD( msg->wParam ) == MK_RBUTTON) flags |= POINTER_MESSAGE_FLAG_SECONDBUTTON; + if (msg->message == WM_XBUTTONDOWN && LOWORD( msg->wParam ) == MK_MBUTTON) flags |= POINTER_MESSAGE_FLAG_THIRDBUTTON; + if (msg->message == WM_XBUTTONDOWN && LOWORD( msg->wParam ) == MK_XBUTTON1) flags |= POINTER_MESSAGE_FLAG_FOURTHBUTTON; + if (msg->message == WM_XBUTTONDOWN && LOWORD( msg->wParam ) == MK_XBUTTON2) flags |= POINTER_MESSAGE_FLAG_FIFTHBUTTON; + break; + case WM_LBUTTONUP: + case WM_RBUTTONUP: + case WM_MBUTTONUP: + case WM_XBUTTONUP: + message = WM_POINTERUP; + break; + case WM_MOUSEWHEEL: + message = WM_POINTERWHEEL; + flags = HIWORD( msg->wParam ); + break; + case WM_MOUSEHWHEEL: + message = WM_POINTERHWHEEL; + flags = HIWORD( msg->wParam ); + break; + } + + if (message) send_message( msg->hwnd, message, MAKELONG( 1, flags ), MAKELONG( msg->pt.x, msg->pt.y ) ); + } + /* FIXME: is this really the right place for this hook? */ event.message = msg->message; event.time = msg->time; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 805a34a635a..cc2df00348f 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -89,6 +89,7 @@ extern BOOL register_imm_window( HWND hwnd ); extern void unregister_imm_window( HWND hwnd ); /* input.c */ +extern BOOL enable_mouse_in_pointer; extern BOOL grab_pointer; extern BOOL grab_fullscreen; extern BOOL destroy_caret(void); From a7467b6cb52c347284f21c68adc6fd743f77e4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 27 Feb 2023 23:01:03 +0100 Subject: [PATCH 0327/1506] user32: Move GetTouchInputInfo to win32u NtUserGetTouchInputInfo. CW-Bug-Id: #21796 --- dlls/user32/input.c | 10 ---------- dlls/user32/user32.spec | 2 +- dlls/win32u/input.c | 10 ++++++++++ dlls/win32u/main.c | 5 +++++ dlls/win32u/ntuser_private.h | 8 ++++++++ dlls/win32u/win32u.spec | 2 +- dlls/wow64win/user.c | 10 ++++++++++ include/ntuser.h | 1 + 8 files changed, 36 insertions(+), 12 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index b295c4c4dff..f91b65a5f56 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -701,16 +701,6 @@ BOOL WINAPI CloseTouchInputHandle( HTOUCHINPUT handle ) return TRUE; } -/***************************************************************************** - * GetTouchInputInfo (USER32.@) - */ -BOOL WINAPI GetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, int size ) -{ - TRACE( "handle %p, count %u, ptr %p, size %u.\n", handle, count, ptr, size ); - *ptr = *(TOUCHINPUT *)handle; - return TRUE; -} - /***************************************************************************** * RegisterTouchWindow (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index e8282c6b5a6..e8d94f86af6 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -398,7 +398,7 @@ @ stdcall GetThreadDpiHostingBehavior() @ stdcall GetTitleBarInfo(long ptr) NtUserGetTitleBarInfo @ stdcall GetTopWindow(long) -@ stdcall GetTouchInputInfo(long long ptr long) +@ stdcall GetTouchInputInfo(long long ptr long) NtUserGetTouchInputInfo @ stdcall GetUpdateRect(long ptr long) NtUserGetUpdateRect @ stdcall GetUpdateRgn(long long long) NtUserGetUpdateRgn @ stdcall GetUpdatedClipboardFormats(ptr long ptr) NtUserGetUpdatedClipboardFormats diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 19388f7d9b5..1107e12e8c6 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2729,3 +2729,13 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect ) return ret; } + +/***************************************************************************** + * NtUserGetTouchInputInfo (WIN32U.@) + */ +BOOL WINAPI NtUserGetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, int size ) +{ + TRACE( "handle %p, count %u, ptr %p, size %u.\n", handle, count, ptr, size ); + *ptr = *(TOUCHINPUT *)handle; + return TRUE; +} diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index 1808c59d030..ea3578407a1 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -1559,6 +1559,11 @@ BOOL SYSCALL_API NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info ) __ASM_SYSCALL_FUNC( __id_NtUserGetTitleBarInfo ); } +BOOL SYSCALL_API NtUserGetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, int size ) +{ + __ASM_SYSCALL_FUNC( __id_NtUserGetTouchInputInfo ); +} + BOOL SYSCALL_API NtUserGetUpdateRect( HWND hwnd, RECT *rect, BOOL erase ) { __ASM_SYSCALL_FUNC( __id_NtUserGetUpdateRect ); diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 782172377c9..fa93498e32a 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -116,6 +116,13 @@ static inline BOOL is_broadcast( HWND hwnd ) return hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST; } +struct touchinput_thread_data +{ + BYTE index; /* history index */ + TOUCHINPUT current[8]; /* current touch state */ + TOUCHINPUT history[128][8]; /* touches history buffer */ +}; + /* this is the structure stored in TEB->Win32ClientInfo */ /* no attempt is made to keep the layout compatible with the Windows one */ struct user_thread_info @@ -136,6 +143,7 @@ struct user_thread_info HKL kbd_layout; /* Current keyboard layout */ UINT kbd_layout_id; /* Current keyboard layout ID */ struct rawinput_thread_data *rawinput; /* RawInput thread local data / buffer */ + struct touchinput_thread_data *touchinput; /* touch input thread local buffer */ UINT spy_indent; /* Current spy indent */ BOOL clipping_cursor; /* thread is currently clipping */ DWORD clipping_reset; /* time when clipping was last reset */ diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index a5460c8b117..e5586fd67a6 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -999,7 +999,7 @@ @ stub NtUserGetThreadState @ stdcall -syscall NtUserGetTitleBarInfo(long ptr) @ stub NtUserGetTopLevelWindow -@ stub NtUserGetTouchInputInfo +@ stdcall -syscall NtUserGetTouchInputInfo(ptr long ptr long) @ stub NtUserGetTouchValidationStatus @ stub NtUserGetUniformSpaceMapping @ stdcall -syscall NtUserGetUpdateRect(long ptr long) diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 36a28f7435a..a1ff594f5d3 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3058,6 +3058,16 @@ NTSTATUS WINAPI wow64_NtUserGetTitleBarInfo( UINT *args ) return NtUserGetTitleBarInfo( hwnd, info ); } +NTSTATUS WINAPI wow64_NtUserGetTouchInputInfo( UINT *args ) +{ + HTOUCHINPUT handle = get_handle( &args ); + UINT count = get_ulong( &args ); + TOUCHINPUT *ptr = get_ptr( &args ); + int size = get_ulong( &args ); + + return NtUserGetTouchInputInfo( handle, count, ptr, size ); +} + NTSTATUS WINAPI wow64_NtUserGetUpdateRect( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 405a74c0361..738fe055ff7 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -671,6 +671,7 @@ W32KAPI ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process ); W32KAPI HMENU WINAPI NtUserGetSystemMenu( HWND hwnd, BOOL revert ); W32KAPI HDESK WINAPI NtUserGetThreadDesktop( DWORD thread ); W32KAPI BOOL WINAPI NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info ); +W32KAPI BOOL WINAPI NtUserGetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, int size ); W32KAPI INT WINAPI NtUserGetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ); W32KAPI BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size ); W32KAPI BOOL WINAPI NtUserGetUpdateRect( HWND hwnd, RECT *rect, BOOL erase ); From 5f5c8d1654fcb154137fec034ad23bbfb44d1f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 13 Jan 2023 10:59:12 +0100 Subject: [PATCH 0328/1506] win32u: Support multiple touches in WM_TOUCH message. CW-Bug-Id: #21796 CW-Bug-Id: #22849 --- dlls/win32u/defwnd.c | 74 ++++++++++++++++++++++++++++++++++---------- dlls/win32u/input.c | 14 ++++++++- 2 files changed, 70 insertions(+), 18 deletions(-) diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 6828c30c115..83d21dff680 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2397,6 +2397,14 @@ static LRESULT handle_nc_mouse_leave( HWND hwnd ) return 0; } +static struct touchinput_thread_data *touch_input_thread_data(void) +{ + struct user_thread_info *thread_info = get_user_thread_info(); + struct touchinput_thread_data *data = thread_info->touchinput; + + if (!data) data = thread_info->touchinput = calloc( 1, sizeof(struct touchinput_thread_data) ); + return data; +} LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { @@ -2960,25 +2968,57 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, case WM_POINTERUP: case WM_POINTERUPDATE: { - TOUCHINPUT touchinput; + TOUCHINPUT *touches, *end, *touch, *match = NULL; + struct touchinput_thread_data *thread_data; + UINT i; if (!NtUserIsTouchWindow( hwnd, NULL )) return 0; - touchinput.x = LOWORD( lparam ) * 100; - touchinput.y = HIWORD( lparam ) * 100; - touchinput.hSource = WINE_MOUSE_HANDLE; - touchinput.dwID = GET_POINTERID_WPARAM( wparam ); - touchinput.dwFlags = TOUCHEVENTF_NOCOALESCE | TOUCHEVENTF_PALM; - if (msg == WM_POINTERDOWN) touchinput.dwFlags |= TOUCHEVENTF_DOWN; - if (msg == WM_POINTERUP) touchinput.dwFlags |= TOUCHEVENTF_UP; - if (msg == WM_POINTERUPDATE) touchinput.dwFlags |= TOUCHEVENTF_MOVE; - if (IS_POINTER_PRIMARY_WPARAM( wparam )) touchinput.dwFlags |= TOUCHEVENTF_PRIMARY; - touchinput.dwMask = 0; - touchinput.dwTime = NtGetTickCount(); - touchinput.dwExtraInfo = 0; - touchinput.cxContact = 0; - touchinput.cyContact = 0; - - send_message( hwnd, WM_TOUCH, MAKELONG( 1, 0 ), (LPARAM)&touchinput ); + if (!(thread_data = touch_input_thread_data())) return 0; + + touches = thread_data->current; + end = touches + ARRAY_SIZE(thread_data->current); + for (touch = touches; touch < end && touch->dwID; touch++) + { + if (touch->dwID == GET_POINTERID_WPARAM( wparam )) match = touch; + touch->dwFlags &= ~TOUCHEVENTF_DOWN; + touch->dwFlags |= TOUCHEVENTF_MOVE; + } + if (match) touch = match; + + if (touch == end || (msg != WM_POINTERDOWN && !touch->dwID)) + { + if (msg != WM_POINTERDOWN) FIXME("Touch point not found!\n"); + else FIXME("Unsupported number of touch points!\n"); + break; + } + + while (end > (touch + 1) && !(end - 1)->dwID) end--; + + touch->x = LOWORD( lparam ) * 100; + touch->y = HIWORD( lparam ) * 100; + touch->hSource = WINE_MOUSE_HANDLE; + touch->dwID = GET_POINTERID_WPARAM( wparam ); + touch->dwFlags = 0; + if (msg == WM_POINTERUP) touch->dwFlags |= TOUCHEVENTF_UP; + if (msg == WM_POINTERDOWN) touch->dwFlags |= TOUCHEVENTF_INRANGE | TOUCHEVENTF_DOWN; + if (msg == WM_POINTERUPDATE) touch->dwFlags |= TOUCHEVENTF_INRANGE | TOUCHEVENTF_MOVE; + if (IS_POINTER_PRIMARY_WPARAM( wparam )) touch->dwFlags |= TOUCHEVENTF_PRIMARY; + touch->dwMask = 0; + touch->dwTime = NtGetTickCount(); + touch->dwExtraInfo = 0; + touch->cxContact = 0; + touch->cyContact = 0; + + i = thread_data->index++ % ARRAY_SIZE(thread_data->history); + memcpy( thread_data->history + i, thread_data->current, sizeof(thread_data->current) ); + + send_message( hwnd, WM_TOUCH, MAKELONG(end - touches, 0), (LPARAM)i ); + + if (msg == WM_POINTERUP) + { + while (++touch < end) *(touch - 1) = *touch; + memset( touch - 1, 0, sizeof(*touch) ); + } break; } diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 1107e12e8c6..7c71a69be63 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2735,7 +2735,19 @@ BOOL WINAPI NtUserClipCursor( const RECT *rect ) */ BOOL WINAPI NtUserGetTouchInputInfo( HTOUCHINPUT handle, UINT count, TOUCHINPUT *ptr, int size ) { + struct user_thread_info *thread_info = get_user_thread_info(); + struct touchinput_thread_data *thread_data; + UINT index = (ULONG_PTR)handle; + TRACE( "handle %p, count %u, ptr %p, size %u.\n", handle, count, ptr, size ); - *ptr = *(TOUCHINPUT *)handle; + + if (!thread_info || !(thread_data = thread_info->touchinput) || size != sizeof(TOUCHINPUT) || + index >= ARRAY_SIZE(thread_data->history)) + { + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + memcpy( ptr, thread_data->history + index, min( count, ARRAY_SIZE(thread_data->current) ) * size ); return TRUE; } From b8e7de62809fde014ee305bf84d404fdf8c87c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0329/1506] server: Create a desktop shared mapping. Based on a patch by Huw Davies . --- server/directory.c | 17 +++++++++++++++++ server/file.h | 6 ++++++ server/mapping.c | 29 +++++++++++++++++++++++++++++ server/protocol.def | 6 ++++++ server/user.h | 2 ++ server/winstation.c | 24 ++++++++++++++++++++++++ 6 files changed, 84 insertions(+) diff --git a/server/directory.c b/server/directory.c index 23d7eb0a2b7..5c8671d6146 100644 --- a/server/directory.c +++ b/server/directory.c @@ -37,6 +37,7 @@ #include "process.h" #include "file.h" #include "unicode.h" +#include "user.h" #define HASH_SIZE 7 /* default hash size */ @@ -277,6 +278,22 @@ struct object *get_directory_obj( struct process *process, obj_handle_t handle ) return get_handle_obj( process, handle, 0, &directory_ops ); } +struct object *create_desktop_map_directory( struct winstation *winstation ) +{ + static const WCHAR dir_desktop_mapsW[] = {'_','_','w','i','n','e','_','d','e','s','k','t','o','p','_','m','a','p','p','i','n','g','s'}; + static const struct unicode_str dir_desktop_maps_str = {dir_desktop_mapsW, sizeof(dir_desktop_mapsW)}; + struct object *root; + struct directory *mapping_root, *ret; + const struct unicode_str winsta_name = {winstation->obj.name->name, winstation->obj.name->len}; + + root = winstation->obj.name->parent; + mapping_root = create_directory( root, &dir_desktop_maps_str, OBJ_OPENIF, HASH_SIZE, NULL ); + ret = create_directory( &mapping_root->obj, &winsta_name, OBJ_OPENIF, HASH_SIZE, NULL ); + release_object( &mapping_root->obj ); + + return &ret->obj; +} + /* Global initialization */ static void create_session( unsigned int id ) diff --git a/server/file.h b/server/file.h index 39a833cd105..2f61e0acd4f 100644 --- a/server/file.h +++ b/server/file.h @@ -158,6 +158,10 @@ extern struct timeout_user *add_timeout_user( timeout_t when, timeout_callback f extern void remove_timeout_user( struct timeout_user *user ); extern const char *get_timeout_str( timeout_t timeout ); +/* directory functions */ + +extern struct object *create_desktop_map_directory( struct winstation *winstation ); + /* file functions */ extern struct file *get_file_obj( struct process *process, obj_handle_t handle, @@ -186,6 +190,8 @@ extern void free_mapped_views( struct process *process ); extern int get_page_size(void); extern struct mapping *create_fd_mapping( struct object *root, const struct unicode_str *name, struct fd *fd, unsigned int attr, const struct security_descriptor *sd ); +extern struct object *create_shared_mapping( struct object *root, const struct unicode_str *name, mem_size_t size, + unsigned int attr, const struct security_descriptor *sd, void **ptr ); extern struct object *create_user_data_mapping( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ); diff --git a/server/mapping.c b/server/mapping.c index a2c93cb6c1b..9d0c1c24613 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -161,6 +162,7 @@ struct mapping pe_image_info_t image; /* image info (for PE image mapping) */ struct ranges *committed; /* list of committed ranges in this mapping */ struct shared_map *shared; /* temp file for shared PE mapping */ + void *shared_ptr; /* mmaped pointer for shared mappings */ }; static void mapping_dump( struct object *obj, int verbose ); @@ -949,6 +951,7 @@ static struct mapping *create_mapping( struct object *root, const struct unicode mapping->fd = NULL; mapping->shared = NULL; mapping->committed = NULL; + mapping->shared_ptr = MAP_FAILED; if (!(mapping->flags = get_mapping_flags( handle, flags ))) goto error; @@ -1149,6 +1152,7 @@ static void mapping_destroy( struct object *obj ) if (mapping->fd) release_object( mapping->fd ); if (mapping->committed) release_object( mapping->committed ); if (mapping->shared) release_object( mapping->shared ); + if (mapping->shared_ptr != MAP_FAILED) munmap( mapping->shared_ptr, mapping->size ); } static enum server_fd_type mapping_get_fd_type( struct fd *fd ) @@ -1225,6 +1229,31 @@ int get_page_size(void) return page_mask + 1; } +struct object *create_shared_mapping( struct object *root, const struct unicode_str *name, mem_size_t size, + unsigned int attr, const struct security_descriptor *sd, void **ptr ) +{ + static unsigned int access = FILE_READ_DATA | FILE_WRITE_DATA; + struct mapping *mapping; + + if (!(mapping = create_mapping( root, name, attr, size, SEC_COMMIT, 0, access, sd ))) return NULL; + + if (mapping->shared_ptr == MAP_FAILED) + { + int fd = get_unix_fd( mapping->fd ); + + mapping->shared_ptr = mmap( NULL, mapping->size, PROT_WRITE, MAP_SHARED, fd, 0 ); + if (mapping->shared_ptr == MAP_FAILED) + { + fprintf( stderr, "wine: Failed to map shared memory: %u %m\n", errno ); + release_object( &mapping->obj ); + return NULL; + } + } + + *ptr = mapping->shared_ptr; + return &mapping->obj; +} + struct object *create_user_data_mapping( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ) { diff --git a/server/protocol.def b/server/protocol.def index 550d0befaf4..5d22a9dfaa2 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -893,6 +893,12 @@ typedef struct lparam_t info; } cursor_pos_t; +struct desktop_shared_memory +{ + int placeholder; +}; +typedef volatile struct desktop_shared_memory desktop_shm_t; + /****************************************************************/ /* Request declarations */ diff --git a/server/user.h b/server/user.h index f3936b7579c..8d5e6c5a47e 100644 --- a/server/user.h +++ b/server/user.h @@ -77,6 +77,8 @@ struct desktop unsigned int users; /* processes and threads using this desktop */ struct global_cursor cursor; /* global cursor information */ unsigned char keystate[256]; /* asynchronous key state */ + struct object *shared_mapping; /* desktop shared memory mapping */ + const desktop_shm_t *shared; /* desktop shared memory */ }; /* user handles functions */ diff --git a/server/winstation.c b/server/winstation.c index 33803ec1990..7f2d5276092 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -217,6 +217,22 @@ struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, u return (struct desktop *)get_handle_obj( process, handle, access, &desktop_ops ); } +static int init_desktop_mapping( struct desktop *desktop, const struct unicode_str *name ) +{ + struct object *dir; + + desktop->shared = NULL; + desktop->shared_mapping = NULL; + + if (!(dir = create_desktop_map_directory( desktop->winstation ))) return 0; + if ((desktop->shared_mapping = create_shared_mapping( dir, name, sizeof(struct desktop_shared_memory), + 0, NULL, (void **)&desktop->shared ))) + memset( (void *)desktop->shared, 0, sizeof(*desktop->shared) ); + release_object( dir ); + + return !!desktop->shared; +} + /* create a desktop object */ static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr, unsigned int flags, struct winstation *winstation ) @@ -241,6 +257,11 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned list_add_tail( &winstation->desktops, &desktop->entry ); list_init( &desktop->hotkeys ); list_init( &desktop->touches ); + if (!init_desktop_mapping( desktop, name )) + { + release_object( desktop ); + return NULL; + } } else { @@ -299,6 +320,8 @@ static void desktop_destroy( struct object *obj ) if (desktop->global_hooks) release_object( desktop->global_hooks ); if (desktop->close_timeout) remove_timeout_user( desktop->close_timeout ); list_remove( &desktop->entry ); + if (desktop->shared_mapping) release_object( desktop->shared_mapping ); + desktop->shared_mapping = NULL; release_object( desktop->winstation ); } @@ -314,6 +337,7 @@ static void close_desktop_timeout( void *private ) desktop->close_timeout = NULL; unlink_named_object( &desktop->obj ); /* make sure no other process can open it */ + unlink_named_object( desktop->shared_mapping ); post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */ } From 2482cae90a581361f8ec17fdf9cfa8625e88cda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0330/1506] server: Use the helper to update the cursor last change time. Based on a patch by Huw Davies . --- server/queue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c index de276fa295a..b5885bb54ad 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1929,7 +1929,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if ((input->mouse.info & 0xffffff00) == 0xff515700) source.origin = IMDT_TOUCH; - desktop->cursor.last_change = get_tick_count(); + /* update last desktop cursor change time */ + update_desktop_cursor_pos( desktop, desktop->cursor.win, desktop->cursor.x, desktop->cursor.y ); + flags = input->mouse.flags; time = input->mouse.time; if (!time) time = desktop->cursor.last_change; From 3cdb4e3d225ed6f6aaefccbd9c26de612f6a8248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0331/1506] server: Move the cursor position and last change time to the shared data. Based on a patch by Huw Davies . --- server/protocol.def | 9 +++++- server/queue.c | 74 +++++++++++++++++++++++++++------------------ server/user.h | 3 -- 3 files changed, 53 insertions(+), 33 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index 5d22a9dfaa2..2e998171d49 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -893,9 +893,16 @@ typedef struct lparam_t info; } cursor_pos_t; +struct shared_cursor +{ + int x; /* cursor position */ + int y; + unsigned int last_change; /* time of last position change */ +}; + struct desktop_shared_memory { - int placeholder; + struct shared_cursor cursor; /* global cursor information */ }; typedef volatile struct desktop_shared_memory desktop_shm_t; diff --git a/server/queue.c b/server/queue.c index b5885bb54ad..0dc406c3932 100644 --- a/server/queue.c +++ b/server/queue.c @@ -232,6 +232,16 @@ static unsigned int last_input_time; static cursor_pos_t cursor_history[64]; static unsigned int cursor_history_latest; +#define SHARED_WRITE_BEGIN( object, type ) \ + do { \ + const type *__shared = (object)->shared; \ + type *shared = (type *)__shared; \ + do + +#define SHARED_WRITE_END \ + while(0); \ + } while(0); + static void queue_hardware_message( struct desktop *desktop, struct message *msg, int always_queue ); static void free_message( struct message *msg ); @@ -423,8 +433,8 @@ static void queue_cursor_message( struct desktop *desktop, user_handle_t win, un msg->msg = message; msg->wparam = wparam; msg->lparam = lparam; - msg->x = desktop->cursor.x; - msg->y = desktop->cursor.y; + msg->x = desktop->shared->cursor.x; + msg->y = desktop->shared->cursor.y; if (!(msg->win = win) && (input = desktop->foreground_input)) msg->win = input->active; queue_hardware_message( desktop, msg, 1 ); } @@ -463,13 +473,19 @@ static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win, int x, int y ) { int updated; + unsigned int time = get_tick_count(); x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); y = max( min( y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); - updated = (desktop->cursor.x != x || desktop->cursor.y != y); - desktop->cursor.x = x; - desktop->cursor.y = y; - desktop->cursor.last_change = get_tick_count(); + updated = (desktop->shared->cursor.x != x || desktop->shared->cursor.y != y); + + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + shared->cursor.x = x; + shared->cursor.y = y; + shared->cursor.last_change = time; + } + SHARED_WRITE_END if (!win || !is_window_visible( win ) || is_window_transparent( win )) win = shallow_window_from_point( desktop, x, y ); @@ -515,8 +531,8 @@ static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsig { struct desktop *desktop = queue->input->desktop; - *x = desktop->cursor.x; - *y = desktop->cursor.y; + *x = desktop->shared->cursor.x; + *y = desktop->shared->cursor.y; *time = get_tick_count(); } @@ -540,9 +556,9 @@ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsig else desktop->cursor.clip = top_rect; /* warp the mouse to be inside the clip rect */ - x = max( min( desktop->cursor.x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); - y = max( min( desktop->cursor.y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); - if (x != desktop->cursor.x || y != desktop->cursor.y) set_cursor_pos( desktop, x, y ); + x = max( min( desktop->shared->cursor.x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); + y = max( min( desktop->shared->cursor.y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); + if (x != desktop->shared->cursor.x || y != desktop->shared->cursor.y) set_cursor_pos( desktop, x, y ); /* request clip cursor rectangle reset to the desktop thread */ if (reset) post_desktop_message( desktop, WM_WINE_CLIPCURSOR, flags, FALSE ); @@ -1735,8 +1751,8 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg if (desktop->keystate[VK_XBUTTON2] & 0x80) msg->wparam |= MK_XBUTTON2; break; } - msg->x = desktop->cursor.x; - msg->y = desktop->cursor.y; + msg->x = desktop->shared->cursor.x; + msg->y = desktop->shared->cursor.y; if (msg->win && (thread = get_window_thread( msg->win ))) { @@ -1930,11 +1946,11 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if ((input->mouse.info & 0xffffff00) == 0xff515700) source.origin = IMDT_TOUCH; /* update last desktop cursor change time */ - update_desktop_cursor_pos( desktop, desktop->cursor.win, desktop->cursor.x, desktop->cursor.y ); + update_desktop_cursor_pos( desktop, desktop->cursor.win, desktop->shared->cursor.x, desktop->shared->cursor.y ); flags = input->mouse.flags; time = input->mouse.time; - if (!time) time = desktop->cursor.last_change; + if (!time) time = desktop->shared->cursor.last_change; if (flags & MOUSEEVENTF_MOVE) { @@ -1943,19 +1959,19 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons x = input->mouse.x; y = input->mouse.y; if (flags & ~(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE) && - x == desktop->cursor.x && y == desktop->cursor.y) + x == desktop->shared->cursor.x && y == desktop->shared->cursor.y) flags &= ~MOUSEEVENTF_MOVE; } else { - x = desktop->cursor.x + input->mouse.x; - y = desktop->cursor.y + input->mouse.y; + x = desktop->shared->cursor.x + input->mouse.x; + y = desktop->shared->cursor.y + input->mouse.y; } } else { - x = desktop->cursor.x; - y = desktop->cursor.y; + x = desktop->shared->cursor.x; + y = desktop->shared->cursor.y; } if ((req_flags & SEND_HWMSG_RAWINPUT) && (foreground = get_foreground_thread( desktop, win ))) @@ -2822,8 +2838,8 @@ DECL_HANDLER(send_hardware_message) } } - reply->prev_x = desktop->cursor.x; - reply->prev_y = desktop->cursor.y; + reply->prev_x = desktop->shared->cursor.x; + reply->prev_y = desktop->shared->cursor.y; switch (req->input.type) { @@ -2841,8 +2857,8 @@ DECL_HANDLER(send_hardware_message) } if (thread) release_object( thread ); - reply->new_x = desktop->cursor.x; - reply->new_y = desktop->cursor.y; + reply->new_x = desktop->shared->cursor.x; + reply->new_y = desktop->shared->cursor.y; release_object( desktop ); } @@ -3546,8 +3562,8 @@ DECL_HANDLER(set_cursor) reply->prev_handle = input->cursor; reply->prev_count = input->cursor_count; - reply->prev_x = desktop->cursor.x; - reply->prev_y = desktop->cursor.y; + reply->prev_x = desktop->shared->cursor.x; + reply->prev_y = desktop->shared->cursor.y; if (req->flags & SET_CURSOR_HANDLE) { @@ -3570,10 +3586,10 @@ DECL_HANDLER(set_cursor) if (req->flags & (SET_CURSOR_HANDLE | SET_CURSOR_COUNT)) update_desktop_cursor_handle( desktop, input ); - reply->new_x = desktop->cursor.x; - reply->new_y = desktop->cursor.y; + reply->new_x = desktop->shared->cursor.x; + reply->new_y = desktop->shared->cursor.y; reply->new_clip = desktop->cursor.clip; - reply->last_change = desktop->cursor.last_change; + reply->last_change = desktop->shared->cursor.last_change; } /* Get the history of the 64 last cursor positions */ diff --git a/server/user.h b/server/user.h index 8d5e6c5a47e..ca247fd5642 100644 --- a/server/user.h +++ b/server/user.h @@ -54,10 +54,7 @@ struct winstation struct global_cursor { - int x; /* cursor position */ - int y; rectangle_t clip; /* cursor clip rectangle */ - unsigned int last_change; /* time of last position change */ user_handle_t win; /* window that contains the cursor */ }; From eea5ea4a25319825ef6dfff7f9962aa7ffe32974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 4 Aug 2023 17:14:30 +0200 Subject: [PATCH 0332/1506] server: Add a sequence number to the shared data. The client should check that the lower SEQUENCE_MASK_BITS are zero before reading the data and confirm that the number is unchanged when it's finished. Based on a patch by Huw Davies . --- server/protocol.def | 1 + server/queue.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index 2e998171d49..290a244c8e5 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -902,6 +902,7 @@ struct shared_cursor struct desktop_shared_memory { + unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ struct shared_cursor cursor; /* global cursor information */ }; typedef volatile struct desktop_shared_memory desktop_shm_t; diff --git a/server/queue.c b/server/queue.c index 0dc406c3932..eb1968f0c09 100644 --- a/server/queue.c +++ b/server/queue.c @@ -232,14 +232,24 @@ static unsigned int last_input_time; static cursor_pos_t cursor_history[64]; static unsigned int cursor_history_latest; -#define SHARED_WRITE_BEGIN( object, type ) \ - do { \ - const type *__shared = (object)->shared; \ - type *shared = (type *)__shared; \ +#if defined(__i386__) || defined(__x86_64__) +#define __SHARED_INCREMENT_SEQ( x ) ++(x) +#else +#define __SHARED_INCREMENT_SEQ( x ) __atomic_add_fetch( &(x), 1, __ATOMIC_RELEASE ) +#endif + +#define SHARED_WRITE_BEGIN( object, type ) \ + do { \ + const type *__shared = (object)->shared; \ + type *shared = (type *)__shared; \ + unsigned int __seq = __SHARED_INCREMENT_SEQ( shared->seq ); \ + assert( (__seq & 1) != 0 ); \ do -#define SHARED_WRITE_END \ - while(0); \ +#define SHARED_WRITE_END \ + while(0); \ + __seq = __SHARED_INCREMENT_SEQ( shared->seq ) - __seq; \ + assert( __seq == 1 ); \ } while(0); static void queue_hardware_message( struct desktop *desktop, struct message *msg, int always_queue ); From 832c2da3de93af248e8e850f3723ce8a07f46cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0333/1506] user32: Use the desktop shared data for GetCursorPos(). Based on a patch by Huw Davies . --- dlls/win32u/input.c | 20 +++++------ dlls/win32u/ntuser_private.h | 27 +++++++++++++++ dlls/win32u/sysparams.c | 6 ++++ dlls/win32u/winstation.c | 65 ++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 11 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 7c71a69be63..873517f4d22 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -752,25 +752,23 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y ) */ BOOL get_cursor_pos( POINT *pt ) { - BOOL ret; + const desktop_shm_t *shared = get_desktop_shared_memory(); DWORD last_change; + BOOL ret = TRUE; UINT dpi; - if (!pt) return FALSE; + if (!pt || !shared) return FALSE; - SERVER_START_REQ( set_cursor ) + SHARED_READ_BEGIN( shared, desktop_shm_t ) { - if ((ret = !wine_server_call( req ))) - { - pt->x = reply->new_x; - pt->y = reply->new_y; - last_change = reply->last_change; - } + pt->x = shared->cursor.x; + pt->y = shared->cursor.y; + last_change = shared->cursor.last_change; } - SERVER_END_REQ; + SHARED_READ_END /* query new position from graphics driver if we haven't updated recently */ - if (ret && NtGetTickCount() - last_change > 100) ret = user_driver->pGetCursorPos( pt ); + if (NtGetTickCount() - last_change > 100) ret = user_driver->pGetCursorPos( pt ); if (ret && (dpi = get_thread_dpi())) { HMONITOR monitor = monitor_from_point( *pt, MONITOR_DEFAULTTOPRIMARY, 0 ); diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index fa93498e32a..4166f24adf0 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -147,6 +147,7 @@ struct user_thread_info UINT spy_indent; /* Current spy indent */ BOOL clipping_cursor; /* thread is currently clipping */ DWORD clipping_reset; /* time when clipping was last reset */ + const desktop_shm_t *desktop_shm; /* Ptr to server's desktop shared memory */ }; C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) ); @@ -271,6 +272,9 @@ void release_user_handle_ptr( void *ptr ); void *next_process_user_handle_ptr( HANDLE *handle, unsigned int type ); UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask ); +/* winstation.c */ +extern const desktop_shm_t *get_desktop_shared_memory(void); + static inline UINT win_get_flags( HWND hwnd ) { return win_set_flags( hwnd, 0, 0 ); @@ -280,4 +284,27 @@ WND *get_win_ptr( HWND hwnd ); BOOL is_child( HWND parent, HWND child ); BOOL is_window( HWND hwnd ); +#if defined(__i386__) || defined(__x86_64__) +#define __SHARED_READ_SEQ( x ) (x) +#define __SHARED_READ_FENCE do {} while(0) +#else +#define __SHARED_READ_SEQ( x ) __atomic_load_n( &(x), __ATOMIC_RELAXED ) +#define __SHARED_READ_FENCE __atomic_thread_fence( __ATOMIC_ACQUIRE ) +#endif + +#define SHARED_READ_BEGIN( ptr, type ) \ + do { \ + const type *__shared = (ptr); \ + unsigned int __seq; \ + do { \ + while ((__seq = __SHARED_READ_SEQ( __shared->seq )) & 1) YieldProcessor(); \ + __SHARED_READ_FENCE; \ + do + +#define SHARED_READ_END \ + while (0); \ + __SHARED_READ_FENCE; \ + } while (__SHARED_READ_SEQ( __shared->seq ) != __seq); \ + } while(0); + #endif /* __WINE_NTUSER_PRIVATE_H */ diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 2d14438dec9..9a58b063f20 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6206,6 +6206,12 @@ static void thread_detach(void) cleanup_imm_thread(); NtClose( thread_info->server_queue ); + if (thread_info->desktop_shm) + { + NtUnmapViewOfSection( GetCurrentProcess(), (void *)thread_info->desktop_shm ); + thread_info->desktop_shm = NULL; + } + exiting_thread_id = 0; } diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index b187b246941..30a7b765d55 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -265,6 +265,11 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ) thread_info->client_info.msg_window = 0; if (key_state_info) key_state_info->time = 0; if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( TRUE ); + if (thread_info->desktop_shm) + { + NtUnmapViewOfSection( GetCurrentProcess(), (void *)thread_info->desktop_shm ); + thread_info->desktop_shm = NULL; + } } return ret; } @@ -607,6 +612,66 @@ static const WCHAR *get_default_desktop( void *buf, size_t buf_size ) return defaultW; } +static volatile void *map_shared_memory_section( const WCHAR *name, SIZE_T size, HANDLE root ) +{ + OBJECT_ATTRIBUTES attr; + UNICODE_STRING section_str; + HANDLE handle; + UINT status; + void *ptr; + + RtlInitUnicodeString( §ion_str, name ); + InitializeObjectAttributes( &attr, §ion_str, 0, root, NULL ); + if (!(status = NtOpenSection( &handle, SECTION_ALL_ACCESS, &attr ))) + { + ptr = NULL; + status = NtMapViewOfSection( handle, GetCurrentProcess(), &ptr, 0, 0, NULL, + &size, ViewUnmap, 0, PAGE_READONLY ); + NtClose( handle ); + } + + if (status) + { + WARN( "Failed to map view of section %s, status %#x\n", debugstr_w(name), status ); + return NULL; + } + + return ptr; +} + +const desktop_shm_t *get_desktop_shared_memory(void) +{ + static const WCHAR dir_desktop_maps[] = + { + '_','_','w','i','n','e','_','d','e','s','k','t','o','p','_','m','a','p','p','i','n','g','s','\\',0 + }; + struct user_thread_info *thread_info = get_user_thread_info(); + HANDLE root, handles[2]; + WCHAR buf[MAX_PATH], *ptr; + DWORD i, needed; + + if (thread_info->desktop_shm) return thread_info->desktop_shm; + + handles[0] = NtUserGetProcessWindowStation(); + handles[1] = NtUserGetThreadDesktop( GetCurrentThreadId() ); + + memcpy( buf, dir_desktop_maps, wcslen(dir_desktop_maps) * sizeof(WCHAR) ); + ptr = buf + wcslen(dir_desktop_maps); + + for (i = 0; i < 2; i++) + { + NtUserGetObjectInformation( handles[i], UOI_NAME, (void *)ptr, sizeof(buf) - (ptr - buf) * sizeof(WCHAR), &needed ); + ptr += needed / sizeof(WCHAR); + if (i == 0) *(ptr - 1) = '\\'; + } + + root = get_winstations_dir_handle(); + thread_info->desktop_shm = map_shared_memory_section( buf, sizeof(*thread_info->desktop_shm), root ); + NtClose( root ); + + return thread_info->desktop_shm; +} + /*********************************************************************** * winstation_init * From 9d995440fc16046d9675155eaa9bfbaa65641a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0334/1506] server: Support sealing shared mappings against future writes / resizes. Making sure that only wineserver can write. This guards against calls to write(2) and mmap(2), protecting the mappings from writes to leaked fds. As wineserver already has write mmaped the pages, it won't need mmap(2) anymore. --- configure.ac | 1 + server/mapping.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/configure.ac b/configure.ac index a39ef466462..749bbc7f814 100644 --- a/configure.ac +++ b/configure.ac @@ -2086,6 +2086,7 @@ AC_CHECK_FUNCS(\ getrandom \ kqueue \ mach_continuous_time \ + memfd_create \ pipe2 \ port_create \ posix_fadvise \ diff --git a/server/mapping.c b/server/mapping.c index 9d0c1c24613..7a07575bca2 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -44,6 +44,10 @@ #include "request.h" #include "security.h" +#ifndef F_SEAL_FUTURE_WRITE +#define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */ +#endif + /* list of memory ranges, used to store committed info */ struct ranges { @@ -285,6 +289,7 @@ int grow_file( int unix_fd, file_pos_t new_size ) return 0; } +#ifndef HAVE_MEMFD_CREATE /* simplified version of mkstemps() */ static int make_temp_file( char name[16] ) { @@ -318,10 +323,23 @@ static int check_current_dir_for_exec(void) unlink( tmpfn ); return (ret != MAP_FAILED); } +#endif /* create a temp file for anonymous mappings */ static int create_temp_file( file_pos_t size ) { +#ifdef HAVE_MEMFD_CREATE + int fd = memfd_create( "wine-mapping", MFD_ALLOW_SEALING ); + if (fd != -1) + { + if (!grow_file( fd, size )) + { + close( fd ); + fd = -1; + } + } + else file_set_error(); +#else static int temp_dir_fd = -1; char tmpfn[16]; int fd; @@ -354,6 +372,7 @@ static int create_temp_file( file_pos_t size ) else file_set_error(); if (temp_dir_fd != server_dir_fd) fchdir( server_dir_fd ); +#endif return fd; } @@ -1248,6 +1267,11 @@ struct object *create_shared_mapping( struct object *root, const struct unicode_ release_object( &mapping->obj ); return NULL; } + +#if defined(HAVE_MEMFD_CREATE) && defined(F_ADD_SEALS) + /* protect the mapping against any future writable mapping, resize or re-sealing */ + fcntl( fd, F_ADD_SEALS, F_SEAL_FUTURE_WRITE | F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL ); +#endif } *ptr = mapping->shared_ptr; From b207fe24220131e4071e11a590d0fa3038d33ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0335/1506] server: Store the cursor clip rect in the shared data. Based on a patch by Huw Davies . --- server/protocol.def | 1 + server/queue.c | 25 +++++++++++++++---------- server/user.h | 1 - 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index 290a244c8e5..f496158652e 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -898,6 +898,7 @@ struct shared_cursor int x; /* cursor position */ int y; unsigned int last_change; /* time of last position change */ + rectangle_t clip; /* cursor clip rectangle */ }; struct desktop_shared_memory diff --git a/server/queue.c b/server/queue.c index eb1968f0c09..d861d7ee929 100644 --- a/server/queue.c +++ b/server/queue.c @@ -426,7 +426,7 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour static int is_cursor_clipped( struct desktop *desktop ) { - rectangle_t top_rect, clip_rect = desktop->cursor.clip; + rectangle_t top_rect, clip_rect = desktop->shared->cursor.clip; get_top_window_rectangle( desktop, &top_rect ); return !is_rect_equal( &clip_rect, &top_rect ); } @@ -485,8 +485,8 @@ static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win int updated; unsigned int time = get_tick_count(); - x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); - y = max( min( y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); + x = max( min( x, desktop->shared->cursor.clip.right - 1 ), desktop->shared->cursor.clip.left ); + y = max( min( y, desktop->shared->cursor.clip.bottom - 1 ), desktop->shared->cursor.clip.top ); updated = (desktop->shared->cursor.x != x || desktop->shared->cursor.y != y); SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) @@ -549,25 +549,30 @@ static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsig /* set the cursor clip rectangle */ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsigned int flags, int reset ) { - rectangle_t top_rect; + rectangle_t top_rect, new_rect; int x, y; get_top_window_rectangle( desktop, &top_rect ); if (rect) { - rectangle_t new_rect = *rect; + new_rect = *rect; if (new_rect.left < top_rect.left) new_rect.left = top_rect.left; if (new_rect.right > top_rect.right) new_rect.right = top_rect.right; if (new_rect.top < top_rect.top) new_rect.top = top_rect.top; if (new_rect.bottom > top_rect.bottom) new_rect.bottom = top_rect.bottom; if (new_rect.left > new_rect.right || new_rect.top > new_rect.bottom) new_rect = top_rect; - desktop->cursor.clip = new_rect; } - else desktop->cursor.clip = top_rect; + else new_rect = top_rect; + + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + shared->cursor.clip = new_rect; + } + SHARED_WRITE_END /* warp the mouse to be inside the clip rect */ - x = max( min( desktop->shared->cursor.x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); - y = max( min( desktop->shared->cursor.y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); + x = max( min( desktop->shared->cursor.x, new_rect.right - 1 ), new_rect.left ); + y = max( min( desktop->shared->cursor.y, new_rect.bottom - 1 ), new_rect.top ); if (x != desktop->shared->cursor.x || y != desktop->shared->cursor.y) set_cursor_pos( desktop, x, y ); /* request clip cursor rectangle reset to the desktop thread */ @@ -3598,7 +3603,7 @@ DECL_HANDLER(set_cursor) reply->new_x = desktop->shared->cursor.x; reply->new_y = desktop->shared->cursor.y; - reply->new_clip = desktop->cursor.clip; + reply->new_clip = desktop->shared->cursor.clip; reply->last_change = desktop->shared->cursor.last_change; } diff --git a/server/user.h b/server/user.h index ca247fd5642..706ef472a3b 100644 --- a/server/user.h +++ b/server/user.h @@ -54,7 +54,6 @@ struct winstation struct global_cursor { - rectangle_t clip; /* cursor clip rectangle */ user_handle_t win; /* window that contains the cursor */ }; From 0be446d184d745ac0be6a16f83d4b2cc756c096c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0336/1506] server: Get rid of the global cursor structure. Based on a patch by Huw Davies . --- server/queue.c | 10 +++++----- server/user.h | 7 +------ server/winstation.c | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/server/queue.c b/server/queue.c index d861d7ee929..84acd91a539 100644 --- a/server/queue.c +++ b/server/queue.c @@ -454,7 +454,7 @@ static struct thread_input *get_desktop_cursor_thread_input( struct desktop *des struct thread_input *input = NULL; struct thread *thread; - if ((thread = get_window_thread( desktop->cursor.win ))) + if ((thread = get_window_thread( desktop->cursor_win ))) { if (thread->queue) input = thread->queue->input; release_object( thread ); @@ -465,9 +465,9 @@ static struct thread_input *get_desktop_cursor_thread_input( struct desktop *des static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t win ) { - int updated = win != desktop->cursor.win; + int updated = win != desktop->cursor_win; struct thread_input *input; - desktop->cursor.win = win; + desktop->cursor_win = win; if (updated && (input = get_desktop_cursor_thread_input( desktop ))) { @@ -508,7 +508,7 @@ static void update_desktop_cursor_handle( struct desktop *desktop, struct thread { if (input == get_desktop_cursor_thread_input( desktop )) { - user_handle_t handle = input->cursor_count < 0 ? 0 : input->cursor, win = desktop->cursor.win; + user_handle_t handle = input->cursor_count < 0 ? 0 : input->cursor, win = desktop->cursor_win; /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle ); @@ -1961,7 +1961,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if ((input->mouse.info & 0xffffff00) == 0xff515700) source.origin = IMDT_TOUCH; /* update last desktop cursor change time */ - update_desktop_cursor_pos( desktop, desktop->cursor.win, desktop->shared->cursor.x, desktop->shared->cursor.y ); + update_desktop_cursor_pos( desktop, desktop->cursor_win, desktop->shared->cursor.x, desktop->shared->cursor.y ); flags = input->mouse.flags; time = input->mouse.time; diff --git a/server/user.h b/server/user.h index 706ef472a3b..67919aa10a7 100644 --- a/server/user.h +++ b/server/user.h @@ -52,11 +52,6 @@ struct winstation struct namespace *desktop_names; /* namespace for desktops of this winstation */ }; -struct global_cursor -{ - user_handle_t win; /* window that contains the cursor */ -}; - struct desktop { struct object obj; /* object header */ @@ -71,8 +66,8 @@ struct desktop struct list touches; /* list of active touches */ struct thread_input *foreground_input; /* thread input of foreground thread */ unsigned int users; /* processes and threads using this desktop */ - struct global_cursor cursor; /* global cursor information */ unsigned char keystate[256]; /* asynchronous key state */ + user_handle_t cursor_win; /* window that contains the cursor */ struct object *shared_mapping; /* desktop shared memory mapping */ const desktop_shm_t *shared; /* desktop shared memory */ }; diff --git a/server/winstation.c b/server/winstation.c index 7f2d5276092..18108b9987a 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -252,7 +252,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned desktop->close_timeout = NULL; desktop->foreground_input = NULL; desktop->users = 0; - memset( &desktop->cursor, 0, sizeof(desktop->cursor) ); + desktop->cursor_win = 0; memset( desktop->keystate, 0, sizeof(desktop->keystate) ); list_add_tail( &winstation->desktops, &desktop->entry ); list_init( &desktop->hotkeys ); From 67da720e80e69f935e6307a446d18f0029a0b342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0337/1506] server: Use a separate variable to determine the message on Alt release. Based on a patch by Huw Davies . --- server/queue.c | 11 +++++------ server/user.h | 3 ++- server/winstation.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/queue.c b/server/queue.c index 84acd91a539..9d3ab98ef21 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2093,17 +2093,16 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if (input->kbd.flags & KEYEVENTF_KEYUP) { /* send WM_SYSKEYUP if Alt still pressed and no other key in between */ - /* we use 0x02 as a flag to track if some other SYSKEYUP was sent already */ - if ((desktop->keystate[VK_MENU] & 0x82) != 0x82) break; + if (!(desktop->keystate[VK_MENU] & 0x80) || !desktop->last_press_alt) break; message_code = WM_SYSKEYUP; - desktop->keystate[VK_MENU] &= ~0x02; + desktop->last_press_alt = 0; } else { /* send WM_SYSKEYDOWN for Alt except with Ctrl */ if (desktop->keystate[VK_CONTROL] & 0x80) break; message_code = WM_SYSKEYDOWN; - desktop->keystate[VK_MENU] |= 0x02; + desktop->last_press_alt = 1; } break; @@ -2113,7 +2112,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if (!(input->kbd.flags & KEYEVENTF_KEYUP)) break; if (!(desktop->keystate[VK_MENU] & 0x80)) break; message_code = WM_SYSKEYUP; - desktop->keystate[VK_MENU] &= ~0x02; + desktop->last_press_alt = 0; break; default: @@ -2123,7 +2122,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c /* fall through */ case VK_F10: message_code = (input->kbd.flags & KEYEVENTF_KEYUP) ? WM_SYSKEYUP : WM_SYSKEYDOWN; - desktop->keystate[VK_MENU] &= ~0x02; + desktop->last_press_alt = 0; break; } diff --git a/server/user.h b/server/user.h index 67919aa10a7..0ad24ba20df 100644 --- a/server/user.h +++ b/server/user.h @@ -66,8 +66,9 @@ struct desktop struct list touches; /* list of active touches */ struct thread_input *foreground_input; /* thread input of foreground thread */ unsigned int users; /* processes and threads using this desktop */ - unsigned char keystate[256]; /* asynchronous key state */ user_handle_t cursor_win; /* window that contains the cursor */ + unsigned char keystate[256]; /* asynchronous key state */ + unsigned int last_press_alt:1; /* last key press was Alt (used to determine msg on Alt release) */ struct object *shared_mapping; /* desktop shared memory mapping */ const desktop_shm_t *shared; /* desktop shared memory */ }; diff --git a/server/winstation.c b/server/winstation.c index 18108b9987a..65b259cb6f4 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -253,6 +253,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned desktop->foreground_input = NULL; desktop->users = 0; desktop->cursor_win = 0; + desktop->last_press_alt = 0; memset( desktop->keystate, 0, sizeof(desktop->keystate) ); list_add_tail( &winstation->desktops, &desktop->entry ); list_init( &desktop->hotkeys ); From d3b1dea84f432a657cce722bb9a2d4f54880fdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:53 +0200 Subject: [PATCH 0338/1506] server: Simplify update_input_key_state(). Based on a patch by Huw Davies . --- server/queue.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server/queue.c b/server/queue.c index 9d3ab98ef21..945271d85ec 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1501,7 +1501,7 @@ static struct timer *set_timer( struct msg_queue *queue, unsigned int rate ) } /* change the input key state for a given key */ -static void set_input_key_state( unsigned char *keystate, unsigned char key, int down ) +static void set_input_key_state( unsigned char *keystate, unsigned char key, unsigned char down ) { if (down) { @@ -1515,31 +1515,30 @@ static void set_input_key_state( unsigned char *keystate, unsigned char key, int static void update_input_key_state( struct desktop *desktop, unsigned char *keystate, unsigned int msg, lparam_t wparam ) { - unsigned char key; - int down = 0; + unsigned char key, down = 0, down_val = (keystate == desktop->keystate) ? 0xc0 : 0x80; switch (msg) { case WM_LBUTTONDOWN: - down = (keystate == desktop->keystate) ? 0xc0 : 0x80; + down = down_val; /* fall through */ case WM_LBUTTONUP: set_input_key_state( keystate, VK_LBUTTON, down ); break; case WM_MBUTTONDOWN: - down = (keystate == desktop->keystate) ? 0xc0 : 0x80; + down = down_val; /* fall through */ case WM_MBUTTONUP: set_input_key_state( keystate, VK_MBUTTON, down ); break; case WM_RBUTTONDOWN: - down = (keystate == desktop->keystate) ? 0xc0 : 0x80; + down = down_val; /* fall through */ case WM_RBUTTONUP: set_input_key_state( keystate, VK_RBUTTON, down ); break; case WM_XBUTTONDOWN: - down = (keystate == desktop->keystate) ? 0xc0 : 0x80; + down = down_val; /* fall through */ case WM_XBUTTONUP: if (wparam >> 16 == XBUTTON1) set_input_key_state( keystate, VK_XBUTTON1, down ); @@ -1547,7 +1546,7 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys break; case WM_KEYDOWN: case WM_SYSKEYDOWN: - down = (keystate == desktop->keystate) ? 0xc0 : 0x80; + down = down_val; /* fall through */ case WM_KEYUP: case WM_SYSKEYUP: From ecbf5e0369b00d215b1be6e0b69b14cc8fd484e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0339/1506] server: Use separate functions to update the desktop and input keystates. Based on a patch by Huw Davies . --- server/queue.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/server/queue.c b/server/queue.c index 945271d85ec..60056e1601e 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1512,10 +1512,10 @@ static void set_input_key_state( unsigned char *keystate, unsigned char key, uns } /* update the input key state for a keyboard message */ -static void update_input_key_state( struct desktop *desktop, unsigned char *keystate, - unsigned int msg, lparam_t wparam ) +static void update_key_state( unsigned char *keystate, unsigned int msg, + lparam_t wparam, int desktop ) { - unsigned char key, down = 0, down_val = (keystate == desktop->keystate) ? 0xc0 : 0x80; + unsigned char key, down = 0, down_val = desktop ? 0xc0 : 0x80; switch (msg) { @@ -1574,25 +1574,35 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys } } +static void update_input_key_state( struct thread_input *input, unsigned int msg, lparam_t wparam ) +{ + update_key_state( input->keystate, msg, wparam, 0 ); +} + +static void update_desktop_key_state( struct desktop *desktop, unsigned int msg, lparam_t wparam ) +{ + update_key_state( desktop->keystate, msg, wparam, 1 ); +} + /* update the desktop key state according to a mouse message flags */ static void update_desktop_mouse_state( struct desktop *desktop, unsigned int flags, lparam_t wparam ) { if (flags & MOUSEEVENTF_LEFTDOWN) - update_input_key_state( desktop, desktop->keystate, WM_LBUTTONDOWN, wparam ); + update_desktop_key_state( desktop, WM_LBUTTONDOWN, wparam ); if (flags & MOUSEEVENTF_LEFTUP) - update_input_key_state( desktop, desktop->keystate, WM_LBUTTONUP, wparam ); + update_desktop_key_state( desktop, WM_LBUTTONUP, wparam ); if (flags & MOUSEEVENTF_RIGHTDOWN) - update_input_key_state( desktop, desktop->keystate, WM_RBUTTONDOWN, wparam ); + update_desktop_key_state( desktop, WM_RBUTTONDOWN, wparam ); if (flags & MOUSEEVENTF_RIGHTUP) - update_input_key_state( desktop, desktop->keystate, WM_RBUTTONUP, wparam ); + update_desktop_key_state( desktop, WM_RBUTTONUP, wparam ); if (flags & MOUSEEVENTF_MIDDLEDOWN) - update_input_key_state( desktop, desktop->keystate, WM_MBUTTONDOWN, wparam ); + update_desktop_key_state( desktop, WM_MBUTTONDOWN, wparam ); if (flags & MOUSEEVENTF_MIDDLEUP) - update_input_key_state( desktop, desktop->keystate, WM_MBUTTONUP, wparam ); + update_desktop_key_state( desktop, WM_MBUTTONUP, wparam ); if (flags & MOUSEEVENTF_XDOWN) - update_input_key_state( desktop, desktop->keystate, WM_XBUTTONDOWN, wparam ); + update_desktop_key_state( desktop, WM_XBUTTONDOWN, wparam ); if (flags & MOUSEEVENTF_XUP) - update_input_key_state( desktop, desktop->keystate, WM_XBUTTONUP, wparam ); + update_desktop_key_state( desktop, WM_XBUTTONUP, wparam ); } /* release the hardware message currently being processed by the given thread */ @@ -1620,7 +1630,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i } if (clr_bit) clear_queue_bits( queue, clr_bit ); - update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam ); + update_input_key_state( input, msg->msg, msg->wparam ); list_remove( &msg->entry ); free_message( msg ); } @@ -1732,7 +1742,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg struct hardware_msg_data *msg_data = msg->data; unsigned int msg_code; - update_input_key_state( desktop, desktop->keystate, msg->msg, msg->wparam ); + update_desktop_key_state( desktop, msg->msg, msg->wparam ); last_input_time = get_tick_count(); if (msg->msg != WM_MOUSEMOVE) always_queue = 1; @@ -1778,7 +1788,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg win = find_hardware_message_window( desktop, input, msg, &msg_code, &thread ); if (!win || !thread) { - if (input) update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam ); + if (input) update_input_key_state( input, msg->msg, msg->wparam ); free_message( msg ); return; } @@ -2149,7 +2159,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if ((device = current->process->rawinput_kbd) && (device->flags & RIDEV_NOLEGACY)) { - update_input_key_state( desktop, desktop->keystate, message_code, vkey ); + update_desktop_key_state( desktop, message_code, vkey ); return 0; } @@ -2403,7 +2413,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user if (!win || !win_thread) { /* no window at all, remove it */ - update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam ); + update_input_key_state( input, msg->msg, msg->wparam ); list_remove( &msg->entry ); free_message( msg ); continue; @@ -2419,7 +2429,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user else { /* for another thread input, drop it */ - update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam ); + update_input_key_state( input, msg->msg, msg->wparam ); list_remove( &msg->entry ); free_message( msg ); } From 063e5c8ed8a612ee50ce92a447bef0737675e073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0340/1506] server: Move the desktop keystate to shared memory. Based on a patch by Huw Davies . --- server/protocol.def | 1 + server/queue.c | 73 +++++++++++++++++++++++++++------------------ server/winstation.c | 1 - 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index f496158652e..8f35a0772f4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -905,6 +905,7 @@ struct desktop_shared_memory { unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ struct shared_cursor cursor; /* global cursor information */ + unsigned char keystate[256]; /* asynchronous key state */ }; typedef volatile struct desktop_shared_memory desktop_shm_t; diff --git a/server/queue.c b/server/queue.c index 60056e1601e..ee5c320c016 100644 --- a/server/queue.c +++ b/server/queue.c @@ -294,7 +294,8 @@ static struct thread_input *create_thread_input( struct thread *thread ) release_object( input ); return NULL; } - memcpy( input->desktop_keystate, input->desktop->keystate, sizeof(input->desktop_keystate) ); + memcpy( input->desktop_keystate, (void *)input->desktop->shared->keystate, + sizeof(input->desktop_keystate) ); } return input; } @@ -358,8 +359,8 @@ static void sync_input_keystate( struct thread_input *input ) if (!input->desktop || input->keystate_lock) return; for (i = 0; i < sizeof(input->keystate); ++i) { - if (input->desktop_keystate[i] == input->desktop->keystate[i]) continue; - input->keystate[i] = input->desktop_keystate[i] = input->desktop->keystate[i]; + if (input->desktop_keystate[i] == input->desktop->shared->keystate[i]) continue; + input->keystate[i] = input->desktop_keystate[i] = input->desktop->shared->keystate[i]; } } @@ -1501,7 +1502,7 @@ static struct timer *set_timer( struct msg_queue *queue, unsigned int rate ) } /* change the input key state for a given key */ -static void set_input_key_state( unsigned char *keystate, unsigned char key, unsigned char down ) +static void set_input_key_state( volatile unsigned char *keystate, unsigned char key, unsigned char down ) { if (down) { @@ -1512,7 +1513,7 @@ static void set_input_key_state( unsigned char *keystate, unsigned char key, uns } /* update the input key state for a keyboard message */ -static void update_key_state( unsigned char *keystate, unsigned int msg, +static void update_key_state( volatile unsigned char *keystate, unsigned int msg, lparam_t wparam, int desktop ) { unsigned char key, down = 0, down_val = desktop ? 0xc0 : 0x80; @@ -1581,7 +1582,11 @@ static void update_input_key_state( struct thread_input *input, unsigned int msg static void update_desktop_key_state( struct desktop *desktop, unsigned int msg, lparam_t wparam ) { - update_key_state( desktop->keystate, msg, wparam, 1 ); + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + update_key_state( shared->keystate, msg, wparam, 1 ); + } + SHARED_WRITE_END } /* update the desktop key state according to a mouse message flags */ @@ -1642,10 +1647,10 @@ static int queue_hotkey_message( struct desktop *desktop, struct message *msg ) if (msg->msg != WM_KEYDOWN && msg->msg != WM_SYSKEYDOWN) return 0; - if (desktop->keystate[VK_MENU] & 0x80) modifiers |= MOD_ALT; - if (desktop->keystate[VK_CONTROL] & 0x80) modifiers |= MOD_CONTROL; - if (desktop->keystate[VK_SHIFT] & 0x80) modifiers |= MOD_SHIFT; - if ((desktop->keystate[VK_LWIN] & 0x80) || (desktop->keystate[VK_RWIN] & 0x80)) modifiers |= MOD_WIN; + if (desktop->shared->keystate[VK_MENU] & 0x80) modifiers |= MOD_ALT; + if (desktop->shared->keystate[VK_CONTROL] & 0x80) modifiers |= MOD_CONTROL; + if (desktop->shared->keystate[VK_SHIFT] & 0x80) modifiers |= MOD_SHIFT; + if ((desktop->shared->keystate[VK_LWIN] & 0x80) || (desktop->shared->keystate[VK_RWIN] & 0x80)) modifiers |= MOD_WIN; LIST_FOR_EACH_ENTRY( hotkey, &desktop->hotkeys, struct hotkey, entry ) { @@ -1750,7 +1755,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg { case QS_KEY: if (queue_hotkey_message( desktop, msg )) return; - if (desktop->keystate[VK_MENU] & 0x80) msg->lparam |= KF_ALTDOWN << 16; + if (desktop->shared->keystate[VK_MENU] & 0x80) msg->lparam |= KF_ALTDOWN << 16; if (msg->wparam == VK_SHIFT || msg->wparam == VK_LSHIFT || msg->wparam == VK_RSHIFT) msg->lparam &= ~(KF_EXTENDED << 16); break; @@ -1766,13 +1771,13 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg /* fallthrough */ case QS_MOUSEBUTTON: if (update_desktop_cursor_pos( desktop, msg->win, msg->x, msg->y )) always_queue = 1; - if (desktop->keystate[VK_LBUTTON] & 0x80) msg->wparam |= MK_LBUTTON; - if (desktop->keystate[VK_MBUTTON] & 0x80) msg->wparam |= MK_MBUTTON; - if (desktop->keystate[VK_RBUTTON] & 0x80) msg->wparam |= MK_RBUTTON; - if (desktop->keystate[VK_SHIFT] & 0x80) msg->wparam |= MK_SHIFT; - if (desktop->keystate[VK_CONTROL] & 0x80) msg->wparam |= MK_CONTROL; - if (desktop->keystate[VK_XBUTTON1] & 0x80) msg->wparam |= MK_XBUTTON1; - if (desktop->keystate[VK_XBUTTON2] & 0x80) msg->wparam |= MK_XBUTTON2; + if (desktop->shared->keystate[VK_LBUTTON] & 0x80) msg->wparam |= MK_LBUTTON; + if (desktop->shared->keystate[VK_MBUTTON] & 0x80) msg->wparam |= MK_MBUTTON; + if (desktop->shared->keystate[VK_RBUTTON] & 0x80) msg->wparam |= MK_RBUTTON; + if (desktop->shared->keystate[VK_SHIFT] & 0x80) msg->wparam |= MK_SHIFT; + if (desktop->shared->keystate[VK_CONTROL] & 0x80) msg->wparam |= MK_CONTROL; + if (desktop->shared->keystate[VK_XBUTTON1] & 0x80) msg->wparam |= MK_XBUTTON1; + if (desktop->shared->keystate[VK_XBUTTON2] & 0x80) msg->wparam |= MK_XBUTTON2; break; } msg->x = desktop->shared->cursor.x; @@ -2102,14 +2107,14 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if (input->kbd.flags & KEYEVENTF_KEYUP) { /* send WM_SYSKEYUP if Alt still pressed and no other key in between */ - if (!(desktop->keystate[VK_MENU] & 0x80) || !desktop->last_press_alt) break; + if (!(desktop->shared->keystate[VK_MENU] & 0x80) || !desktop->last_press_alt) break; message_code = WM_SYSKEYUP; desktop->last_press_alt = 0; } else { /* send WM_SYSKEYDOWN for Alt except with Ctrl */ - if (desktop->keystate[VK_CONTROL] & 0x80) break; + if (desktop->shared->keystate[VK_CONTROL] & 0x80) break; message_code = WM_SYSKEYDOWN; desktop->last_press_alt = 1; } @@ -2119,15 +2124,15 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c case VK_RCONTROL: /* send WM_SYSKEYUP on release if Alt still pressed */ if (!(input->kbd.flags & KEYEVENTF_KEYUP)) break; - if (!(desktop->keystate[VK_MENU] & 0x80)) break; + if (!(desktop->shared->keystate[VK_MENU] & 0x80)) break; message_code = WM_SYSKEYUP; desktop->last_press_alt = 0; break; default: /* send WM_SYSKEY for Alt-anykey and for F10 */ - if (desktop->keystate[VK_CONTROL] & 0x80) break; - if (!(desktop->keystate[VK_MENU] & 0x80)) break; + if (desktop->shared->keystate[VK_CONTROL] & 0x80) break; + if (!(desktop->shared->keystate[VK_MENU] & 0x80)) break; /* fall through */ case VK_F10: message_code = (input->kbd.flags & KEYEVENTF_KEYUP) ? WM_SYSKEYUP : WM_SYSKEYDOWN; @@ -2181,7 +2186,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if (input->kbd.flags & KEYEVENTF_EXTENDEDKEY) flags |= KF_EXTENDED; /* FIXME: set KF_DLGMODE and KF_MENUMODE when needed */ if (input->kbd.flags & KEYEVENTF_KEYUP) flags |= KF_REPEAT | KF_UP; - else if (desktop->keystate[vkey] & 0x80) flags |= KF_REPEAT; + else if (desktop->shared->keystate[vkey] & 0x80) flags |= KF_REPEAT; msg->wparam = vkey; msg->lparam |= flags << 16; @@ -3367,10 +3372,14 @@ DECL_HANDLER(get_key_state) if (!(desktop = get_thread_desktop( current, 0 ))) return; if (req->key >= 0) { - reply->state = desktop->keystate[req->key & 0xff]; - desktop->keystate[req->key & 0xff] &= ~0x40; + reply->state = desktop->shared->keystate[req->key & 0xff]; + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + shared->keystate[req->key & 0xff] &= ~0x40; + } + SHARED_WRITE_END } - set_reply_data( desktop->keystate, size ); + set_reply_data( (void *)desktop->shared->keystate, size ); release_object( desktop ); } else @@ -3395,10 +3404,16 @@ DECL_HANDLER(set_key_state) data_size_t size = min( 256, get_req_data_size() ); memcpy( queue->input->keystate, get_req_data(), size ); - memcpy( queue->input->desktop_keystate, queue->input->desktop->keystate, 256 ); + memcpy( queue->input->desktop_keystate, (void *)queue->input->desktop->shared->keystate, + sizeof(queue->input->desktop_keystate) ); if (req->async && (desktop = get_thread_desktop( current, 0 ))) { - memcpy( desktop->keystate, get_req_data(), size ); + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + memcpy( (void *)shared->keystate, get_req_data(), size ); + } + SHARED_WRITE_END + release_object( desktop ); } } diff --git a/server/winstation.c b/server/winstation.c index 65b259cb6f4..07719ebbdf9 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -254,7 +254,6 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned desktop->users = 0; desktop->cursor_win = 0; desktop->last_press_alt = 0; - memset( desktop->keystate, 0, sizeof(desktop->keystate) ); list_add_tail( &winstation->desktops, &desktop->entry ); list_init( &desktop->hotkeys ); list_init( &desktop->touches ); From 210e28953aa34c927a6f7c0518fad17523f314d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0341/1506] user32: Use the shared data if possible for GetAsyncKeyState(). Based on a patch by Huw Davies . --- dlls/win32u/hook.c | 2 -- dlls/win32u/input.c | 39 +++++++++--------------------------- dlls/win32u/message.c | 16 +++------------ dlls/win32u/ntuser_private.h | 8 -------- dlls/win32u/sysparams.c | 2 -- dlls/win32u/win32u_private.h | 1 - dlls/win32u/winstation.c | 2 -- 7 files changed, 12 insertions(+), 58 deletions(-) diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index 7cdd327a9f5..f37928e5836 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -347,8 +347,6 @@ static LRESULT call_hook( struct win_hook_params *info, const WCHAR *module, siz if (params != info) free( params ); } - if (info->id == WH_KEYBOARD_LL || info->id == WH_MOUSE_LL) - InterlockedIncrement( &global_key_state_counter ); /* force refreshing the key state cache */ return ret; } diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 873517f4d22..23fa53f8896 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -406,7 +406,6 @@ static const KBDTABLES kbdus_tables = static LONG clipping_cursor; /* clipping thread counter */ -LONG global_key_state_counter = 0; BOOL grab_pointer = TRUE; BOOL grab_fullscreen = FALSE; @@ -811,52 +810,32 @@ static void check_for_events( UINT flags ) */ SHORT WINAPI NtUserGetAsyncKeyState( INT key ) { - struct user_key_state_info *key_state_info = get_user_thread_info()->key_state; - INT counter = global_key_state_counter; - BYTE prev_key_state; + const desktop_shm_t *shared = get_desktop_shared_memory(); + BYTE state; SHORT ret; - if (key < 0 || key >= 256) return 0; + if (key < 0 || key >= 256 || !shared) return 0; check_for_events( QS_INPUT ); - if (key_state_info && !(key_state_info->state[key] & 0xc0) && - key_state_info->counter == counter && NtGetTickCount() - key_state_info->time < 50) - { - /* use cached value */ - return 0; - } - else if (!key_state_info) + SHARED_READ_BEGIN( shared, desktop_shm_t ) { - key_state_info = calloc( 1, sizeof(*key_state_info) ); - get_user_thread_info()->key_state = key_state_info; + state = shared->keystate[key]; } + SHARED_READ_END + if (!(state & 0x40)) return (state & 0x80) << 8; + + /* Need to make a server call to reset the last pressed bit */ ret = 0; SERVER_START_REQ( get_key_state ) { req->async = 1; req->key = key; - if (key_state_info) - { - prev_key_state = key_state_info->state[key]; - wine_server_set_reply( req, key_state_info->state, sizeof(key_state_info->state) ); - } if (!wine_server_call( req )) { if (reply->state & 0x40) ret |= 0x0001; if (reply->state & 0x80) ret |= 0x8000; - if (key_state_info) - { - /* force refreshing the key state cache - some multithreaded programs - * (like Adobe Photoshop CS5) expect that changes to the async key state - * are also immediately available in other threads. */ - if (prev_key_state != key_state_info->state[key]) - counter = InterlockedIncrement( &global_key_state_counter ); - - key_state_info->time = NtGetTickCount(); - key_state_info->counter = counter; - } } } SERVER_END_REQ; diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index a1c010f2024..a7266a6b768 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3543,7 +3543,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r int prev_x, prev_y, new_x, new_y; USAGE hid_usage_page, hid_usage; NTSTATUS ret; - BOOL wait, affects_key_state = FALSE; + BOOL wait; info.type = MSG_HARDWARE; info.dest_tid = 0; @@ -3585,10 +3585,6 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.mouse.time = input->mi.time; req->input.mouse.info = input->mi.dwExtraInfo; if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT; - affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | - MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | - MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP | - MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)); break; case INPUT_KEYBOARD: req->input.kbd.vkey = input->ki.wVk; @@ -3597,7 +3593,6 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.kbd.time = input->ki.time; req->input.kbd.info = input->ki.dwExtraInfo; if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT; - affects_key_state = TRUE; break; case INPUT_HARDWARE: req->input.hw.msg = input->hi.uMsg; @@ -3644,13 +3639,8 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r } SERVER_END_REQ; - if (!ret) - { - if (affects_key_state) - InterlockedIncrement( &global_key_state_counter ); /* force refreshing the key state cache */ - if ((flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y)) - user_driver->pSetCursorPos( new_x, new_y ); - } + if (!ret && (flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y)) + user_driver->pSetCursorPos( new_x, new_y ); if (wait) { diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 4166f24adf0..d6743483581 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -137,7 +137,6 @@ struct user_thread_info HHOOK hook; /* Current hook */ UINT active_hooks; /* Bitmap of active hooks */ struct received_message_info *receive_info; /* Message being currently received */ - struct user_key_state_info *key_state; /* Cache of global key state */ struct imm_thread_data *imm_thread_data; /* IMM thread data */ MSG key_repeat_msg; /* Last WM_KEYDOWN message to repeat */ HKL kbd_layout; /* Current keyboard layout */ @@ -157,13 +156,6 @@ static inline struct user_thread_info *get_user_thread_info(void) return CONTAINING_RECORD( NtUserGetThreadInfo(), struct user_thread_info, client_info ); } -struct user_key_state_info -{ - UINT time; /* Time of last key state refresh */ - INT counter; /* Counter to invalidate the key state */ - BYTE state[256]; /* State for each key */ -}; - struct hook_extra_info { HHOOK handle; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 9a58b063f20..708f8988db4 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6198,8 +6198,6 @@ static void thread_detach(void) user_driver->pThreadDetach(); - free( thread_info->key_state ); - thread_info->key_state = 0; free( thread_info->rawinput ); destroy_thread_windows(); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index cc2df00348f..d0eb4a7acaf 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -93,7 +93,6 @@ extern BOOL enable_mouse_in_pointer; extern BOOL grab_pointer; extern BOOL grab_fullscreen; extern BOOL destroy_caret(void); -extern LONG global_key_state_counter; extern HWND get_active_window(void); extern HWND get_capture(void); extern BOOL get_cursor_pos( POINT *pt ); diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 30a7b765d55..ff71992781f 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -260,10 +260,8 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ) if (ret) /* reset the desktop windows */ { struct user_thread_info *thread_info = get_user_thread_info(); - struct user_key_state_info *key_state_info = thread_info->key_state; thread_info->client_info.top_window = 0; thread_info->client_info.msg_window = 0; - if (key_state_info) key_state_info->time = 0; if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( TRUE ); if (thread_info->desktop_shm) { From 8e6caf3f5e751b5202efdc455d43214d037e5a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0342/1506] user32: Refresh active hook list only when needed. Instead of doing it on every get_message request. --- dlls/win32u/hook.c | 29 ++++++++++++++++++++++++----- dlls/win32u/message.c | 4 +++- server/hook.c | 8 +++++++- server/protocol.def | 8 +++++++- server/queue.c | 2 -- server/user.h | 1 - 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index f37928e5836..2dadf485c0f 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -60,12 +60,31 @@ static const char *debugstr_hook_id( unsigned int id ) return hook_names[id - WH_MINHOOK]; } -BOOL is_hooked( INT id ) +/*********************************************************************** + * get_active_hooks + * + */ +static UINT get_active_hooks(void) { struct user_thread_info *thread_info = get_user_thread_info(); - if (!thread_info->active_hooks) return TRUE; - return (thread_info->active_hooks & (1 << (id - WH_MINHOOK))) != 0; + if (!thread_info->active_hooks) + { + SERVER_START_REQ( get_active_hooks ) + { + if (!wine_server_call( req )) thread_info->active_hooks = reply->active_hooks; + } + SERVER_END_REQ; + } + + return thread_info->active_hooks; +} + +BOOL is_hooked( INT id ) +{ + UINT active_hooks = get_active_hooks(); + if (!active_hooks) return TRUE; + return (active_hooks & (1 << (id - WH_MINHOOK))) != 0; } /*********************************************************************** @@ -432,7 +451,7 @@ LRESULT call_message_hooks( INT id, INT code, WPARAM wparam, LPARAM lparam, size if (!is_hooked( id )) { - TRACE( "skipping hook %s mask %x\n", hook_names[id-WH_MINHOOK], thread_info->active_hooks ); + TRACE( "skipping hook %s mask %x\n", hook_names[id-WH_MINHOOK], get_active_hooks() ); return 0; } @@ -571,7 +590,7 @@ void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG c if (!is_hooked( WH_WINEVENT )) { - TRACE( "skipping hook mask %x\n", thread_info->active_hooks ); + TRACE( "skipping hook mask %x\n", get_active_hooks() ); return; } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index a7266a6b768..2f1e11f89d2 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2787,12 +2787,14 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, info.msg.pt.x = reply->x; info.msg.pt.y = reply->y; hw_id = 0; - thread_info->active_hooks = reply->active_hooks; } else buffer_size = reply->total; } SERVER_END_REQ; + /* force refreshing hooks */ + thread_info->active_hooks = 0; + if (res) { free( buffer ); diff --git a/server/hook.c b/server/hook.c index 5abdf39ad37..dd3657c2eac 100644 --- a/server/hook.c +++ b/server/hook.c @@ -355,7 +355,7 @@ static int is_hook_active( struct hook_table *table, int index ) } /* get a bitmap of all active hooks for the current thread */ -unsigned int get_active_hooks(void) +static unsigned int get_active_hooks(void) { struct hook_table *table = get_queue_hooks( current ); struct hook_table *global_hooks = get_global_hooks( current ); @@ -382,6 +382,12 @@ struct thread *get_first_global_hook( int id ) return hook->owner; } +/* get thread active hooks */ +DECL_HANDLER(get_active_hooks) +{ + reply->active_hooks = get_active_hooks(); +} + /* set a window hook */ DECL_HANDLER(set_hook) { diff --git a/server/protocol.def b/server/protocol.def index 8f35a0772f4..cb54b6ebb79 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2193,7 +2193,6 @@ enum message_type int x; /* message x position */ int y; /* message y position */ unsigned int time; /* message time */ - unsigned int active_hooks; /* active hooks bitmap */ data_size_t total; /* total size of extra data */ VARARG(data,message_data); /* message data for sent messages */ @END @@ -2990,6 +2989,13 @@ enum caret_state }; +/* get thread active hooks */ +@REQ(get_active_hooks) +@REPLY + unsigned int active_hooks; /* active hooks bitmap */ +@END + + /* Set a window hook */ @REQ(set_hook) int id; /* id of the hook */ diff --git a/server/queue.c b/server/queue.c index ee5c320c016..50e00d26641 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2912,8 +2912,6 @@ DECL_HANDLER(get_message) user_handle_t get_win = get_user_full_handle( req->get_win ); unsigned int filter = req->flags >> 16; - reply->active_hooks = get_active_hooks(); - if (get_win && get_win != 1 && get_win != -1 && !get_user_object( get_win, USER_WINDOW )) { set_win32_error( ERROR_INVALID_WINDOW_HANDLE ); diff --git a/server/user.h b/server/user.h index 0ad24ba20df..c753e1799a4 100644 --- a/server/user.h +++ b/server/user.h @@ -91,7 +91,6 @@ extern void cleanup_clipboard_thread( struct thread *thread ); /* hook functions */ extern void remove_thread_hooks( struct thread *thread ); -extern unsigned int get_active_hooks(void); extern struct thread *get_first_global_hook( int id ); /* queue functions */ From 1af924a77889c0420c745abeb37a6de667c742e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0343/1506] server: Cleanup message queue on thread exit. When threads are killed they don't get a chance to close their message queue handle which is kept in user_thread_info->server_queue, and the message queues are kept alive on the server side. In this case, msg_queue_destroy and cleanup_results are never called, leaving message results referencing the stale queue in other thread message queues. Later, when the messages from the other threads are cleaned up this causes invalid shared memory access when we try to update the queue bits from the message results. This doesn't cause much trouble upstream because it only leaks queue objects, which are always valid in memory, but it breaks with Proton shared memory patches, and the recent unmap fixes, as the queue bits are now in unmapped memory. This is probably a hack because it should probably instead close the handle on behalf of the dying thread, but this doesn't play well with process handle caches we use for fsync / esync. The handle should be closed on process exit anyway. --- server/queue.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/server/queue.c b/server/queue.c index 50e00d26641..90ab998aed2 100644 --- a/server/queue.c +++ b/server/queue.c @@ -130,6 +130,7 @@ struct msg_queue int quit_message; /* is there a pending quit message? */ int exit_code; /* exit code of pending quit message */ int cursor_count; /* per-queue cursor show count */ + int destroyed; /* queue has been cleaned up */ struct list msg_list[NB_MSG_KINDS]; /* lists of messages */ struct list send_result; /* stack of sent messages waiting for result */ struct list callback_result; /* list of callback messages waiting for result */ @@ -343,15 +344,6 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ return queue; } -/* free the message queue of a thread at thread exit */ -void free_msg_queue( struct thread *thread ) -{ - remove_thread_hooks( thread ); - if (!thread->queue) return; - release_object( thread->queue ); - thread->queue = NULL; -} - /* synchronize thread input keystate with the desktop */ static void sync_input_keystate( struct thread_input *input ) { @@ -1208,9 +1200,8 @@ static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *en queue->changed_mask = 0; } -static void msg_queue_destroy( struct object *obj ) +static void cleanup_msg_queue( struct msg_queue *queue ) { - struct msg_queue *queue = (struct msg_queue *)obj; struct list *ptr; struct hotkey *hotkey, *hotkey2; int i; @@ -1245,6 +1236,23 @@ static void msg_queue_destroy( struct object *obj ) release_object( queue->input ); if (queue->hooks) release_object( queue->hooks ); if (queue->fd) release_object( queue->fd ); + queue->destroyed = 1; +} + +static void msg_queue_destroy( struct object *obj ) +{ + struct msg_queue *queue = (struct msg_queue *)obj; + if (!queue->destroyed) cleanup_msg_queue( queue ); +} + +/* free the message queue of a thread at thread exit */ +void free_msg_queue( struct thread *thread ) +{ + remove_thread_hooks( thread ); + if (!thread->queue) return; + cleanup_msg_queue( thread->queue ); + release_object( thread->queue ); + thread->queue = NULL; } static void msg_queue_poll_event( struct fd *fd, int event ) From 53e80e5e40e82649da6153858aa53651b8558003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Dec 2023 14:43:57 +0100 Subject: [PATCH 0344/1506] server: Cleanup message queue on thread exit. When threads are killed they don't get a chance to close their message queue handle which is kept in user_thread_info->server_queue, and the message queues are kept alive on the server side. In this case, msg_queue_destroy and cleanup_results are never called, leaving message results referencing the stale queue in other thread message queues. Later, when the messages from the other threads are cleaned up this causes invalid shared memory access when we try to update the queue bits from the message results. This doesn't cause much trouble upstream because it only leaks queue objects, which are always valid in memory, but it breaks with Proton shared memory patches, and the recent unmap fixes, as the queue bits are now in unmapped memory. This is probably a hack because it should probably instead close the handle on behalf of the dying thread, but this doesn't play well with process handle caches we use for fsync / esync. The handle should be closed on process exit anyway. --- dlls/win32u/message.c | 36 ++++++++++++++++++- dlls/win32u/ntuser_private.h | 2 ++ dlls/win32u/sysparams.c | 6 ++++ dlls/win32u/winstation.c | 15 ++++++++ server/directory.c | 15 ++++++++ server/file.h | 1 + server/protocol.def | 11 ++++++ server/queue.c | 70 +++++++++++++++++++++++++++++++++++- server/thread.c | 32 +++++++++++++++++ server/thread.h | 2 ++ 10 files changed, 188 insertions(+), 2 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 2f1e11f89d2..f84069ef6f1 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2747,8 +2747,10 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, LRESULT result; struct user_thread_info *thread_info = get_user_thread_info(); INPUT_MESSAGE_SOURCE prev_source = thread_info->client_info.msg_source; + const queue_shm_t *shared = get_queue_shared_memory(); struct received_message_info info; unsigned int hw_id = 0; /* id of previous hardware message */ + BOOL skip = FALSE; void *buffer; size_t buffer_size = 1024; @@ -2762,10 +2764,42 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, NTSTATUS res; size_t size = 0; const message_data_t *msg_data = buffer; + UINT wake_mask = changed_mask & (QS_SENDMESSAGE | QS_SMRESULT); + DWORD clear_bits = 0, filter = flags >> 16 ? flags >> 16 : QS_ALLINPUT; + if (filter & QS_POSTMESSAGE) + { + clear_bits |= QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER; + if (first == 0 && last == ~0U) clear_bits |= QS_ALLPOSTMESSAGE; + } + if (filter & QS_INPUT) clear_bits |= QS_INPUT; + if (filter & QS_PAINT) clear_bits |= QS_PAINT; + + /* FIXME: if filter includes QS_RAWINPUT we have to translate hardware messages */ + if (filter & QS_RAWINPUT) filter |= QS_KEY | QS_MOUSEMOVE | QS_MOUSEBUTTON; thread_info->client_info.msg_source = prev_source; - SERVER_START_REQ( get_message ) + if (!shared) skip = FALSE; + else SHARED_READ_BEGIN( shared, queue_shm_t ) + { + /* not created yet */ + if (!shared->created) skip = FALSE; + /* if the masks need an update */ + else if (shared->wake_mask != wake_mask) skip = FALSE; + else if (shared->changed_mask != changed_mask) skip = FALSE; + /* or if the queue is signaled */ + else if (shared->wake_bits & wake_mask) skip = FALSE; + else if (shared->changed_bits & changed_mask) skip = FALSE; + /* or if the filter matches some bits */ + else if (shared->wake_bits & filter) skip = FALSE; + /* or if we should clear some bits */ + else if (shared->changed_bits & clear_bits) skip = FALSE; + else skip = TRUE; + } + SHARED_READ_END + + if (skip) res = STATUS_PENDING; + else SERVER_START_REQ( get_message ) { req->flags = flags; req->get_win = wine_server_user_handle( hwnd ); diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index d6743483581..d5894c075fa 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -147,6 +147,7 @@ struct user_thread_info BOOL clipping_cursor; /* thread is currently clipping */ DWORD clipping_reset; /* time when clipping was last reset */ const desktop_shm_t *desktop_shm; /* Ptr to server's desktop shared memory */ + const queue_shm_t *queue_shm; /* Ptr to server's thread queue shared memory */ }; C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) ); @@ -266,6 +267,7 @@ UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask ); /* winstation.c */ extern const desktop_shm_t *get_desktop_shared_memory(void); +extern const queue_shm_t *get_queue_shared_memory(void); static inline UINT win_get_flags( HWND hwnd ) { diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 708f8988db4..e8cfc4ad8f2 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6210,6 +6210,12 @@ static void thread_detach(void) thread_info->desktop_shm = NULL; } + if (thread_info->queue_shm) + { + NtUnmapViewOfSection( GetCurrentProcess(), (void *)thread_info->queue_shm ); + thread_info->queue_shm = NULL; + } + exiting_thread_id = 0; } diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index ff71992781f..4731f2b7194 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -670,6 +670,21 @@ const desktop_shm_t *get_desktop_shared_memory(void) return thread_info->desktop_shm; } +const queue_shm_t *get_queue_shared_memory(void) +{ + struct user_thread_info *thread_info = get_user_thread_info(); + UINT tid = GetCurrentThreadId(); + WCHAR bufferW[MAX_PATH]; + char buffer[MAX_PATH]; + + if (thread_info->queue_shm) return thread_info->queue_shm; + + snprintf( buffer, ARRAY_SIZE(buffer), "\\KernelObjects\\__wine_thread_mappings\\%08x-queue", tid ); + asciiz_to_unicode( bufferW, buffer ); + thread_info->queue_shm = map_shared_memory_section( bufferW, sizeof(*thread_info->queue_shm), NULL ); + return thread_info->queue_shm; +} + /*********************************************************************** * winstation_init * diff --git a/server/directory.c b/server/directory.c index 5c8671d6146..e169cc2d011 100644 --- a/server/directory.c +++ b/server/directory.c @@ -294,6 +294,21 @@ struct object *create_desktop_map_directory( struct winstation *winstation ) return &ret->obj; } +struct object *create_thread_map_directory( void ) +{ + static const WCHAR dir_kernelW[] = {'K','e','r','n','e','l','O','b','j','e','c','t','s'}; + static const WCHAR dir_thread_mapsW[] = {'_','_','w','i','n','e','_','t','h','r','e','a','d','_','m','a','p','p','i','n','g','s'}; + static const struct unicode_str dir_kernel_str = {dir_kernelW, sizeof(dir_kernelW)}; + static const struct unicode_str dir_thread_maps_str = {dir_thread_mapsW, sizeof(dir_thread_mapsW)}; + struct directory *mapping_root, *ret; + + mapping_root = create_directory( &root_directory->obj, &dir_kernel_str, OBJ_OPENIF, HASH_SIZE, NULL ); + ret = create_directory( &mapping_root->obj, &dir_thread_maps_str, OBJ_OPENIF, HASH_SIZE, NULL ); + release_object( &mapping_root->obj ); + + return &ret->obj; +} + /* Global initialization */ static void create_session( unsigned int id ) diff --git a/server/file.h b/server/file.h index 2f61e0acd4f..b8edec64af4 100644 --- a/server/file.h +++ b/server/file.h @@ -161,6 +161,7 @@ extern const char *get_timeout_str( timeout_t timeout ); /* directory functions */ extern struct object *create_desktop_map_directory( struct winstation *winstation ); +extern struct object *create_thread_map_directory( void ); /* file functions */ diff --git a/server/protocol.def b/server/protocol.def index cb54b6ebb79..b0048907ade 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -909,6 +909,17 @@ struct desktop_shared_memory }; typedef volatile struct desktop_shared_memory desktop_shm_t; +struct queue_shared_memory +{ + unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ + int created; /* queue has been created */ + unsigned int wake_bits; + unsigned int changed_bits; + unsigned int wake_mask; + unsigned int changed_mask; +}; +typedef volatile struct queue_shared_memory queue_shm_t; + /****************************************************************/ /* Request declarations */ diff --git a/server/queue.c b/server/queue.c index 90ab998aed2..d0edb97ce40 100644 --- a/server/queue.c +++ b/server/queue.c @@ -143,6 +143,7 @@ struct msg_queue struct hook_table *hooks; /* hook table */ timeout_t last_get_msg; /* time of last get message call */ int keystate_lock; /* owns an input keystate lock */ + const queue_shm_t *shared; /* thread queue shared memory ptr */ }; struct hotkey @@ -325,6 +326,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->hotkey_count = 0; queue->quit_message = 0; queue->cursor_count = 0; + queue->destroyed = 0; queue->recv_result = NULL; queue->next_timer_id = 0x7fff; queue->timeout = NULL; @@ -332,12 +334,19 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->hooks = NULL; queue->last_get_msg = current_time; queue->keystate_lock = 0; + queue->shared = thread->queue_shared; list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); list_init( &queue->expired_timers ); for (i = 0; i < NB_MSG_KINDS; i++) list_init( &queue->msg_list[i] ); + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->created = TRUE; + } + SHARED_WRITE_END + thread->queue = queue; } if (new_input) release_object( new_input ); @@ -615,6 +624,14 @@ static inline void set_queue_bits( struct msg_queue *queue, unsigned int bits ) } queue->wake_bits |= bits; queue->changed_bits |= bits; + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->wake_bits = queue->wake_bits; + shared->changed_bits = queue->changed_bits; + } + SHARED_WRITE_END + if (is_signaled( queue )) wake_up( &queue->obj, 0 ); } @@ -628,6 +645,13 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits if (queue->keystate_lock) unlock_input_keystate( queue->input ); queue->keystate_lock = 0; } + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->wake_bits = queue->wake_bits; + shared->changed_bits = queue->changed_bits; + } + SHARED_WRITE_END } /* check if message is matched by the filter */ @@ -1198,6 +1222,13 @@ static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *en struct msg_queue *queue = (struct msg_queue *)obj; queue->wake_mask = 0; queue->changed_mask = 0; + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->wake_mask = queue->wake_mask; + shared->changed_mask = queue->changed_mask; + } + SHARED_WRITE_END } static void cleanup_msg_queue( struct msg_queue *queue ) @@ -2749,10 +2780,27 @@ DECL_HANDLER(set_queue_mask) queue->changed_mask = req->changed_mask; reply->wake_bits = queue->wake_bits; reply->changed_bits = queue->changed_bits; + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->wake_mask = queue->wake_mask; + shared->changed_mask = queue->changed_mask; + } + SHARED_WRITE_END + if (is_signaled( queue )) { /* if skip wait is set, do what would have been done in the subsequent wait */ - if (req->skip_wait) queue->wake_mask = queue->changed_mask = 0; + if (req->skip_wait) + { + queue->wake_mask = queue->changed_mask = 0; + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->wake_mask = queue->wake_mask; + shared->changed_mask = queue->changed_mask; + } + SHARED_WRITE_END + } else wake_up( &queue->obj, 0 ); } } @@ -2768,6 +2816,12 @@ DECL_HANDLER(get_queue_status) reply->wake_bits = queue->wake_bits; reply->changed_bits = queue->changed_bits; queue->changed_bits &= ~req->clear_bits; + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->changed_bits = queue->changed_bits; + } + SHARED_WRITE_END } else reply->wake_bits = reply->changed_bits = 0; } @@ -2947,6 +3001,12 @@ DECL_HANDLER(get_message) if (filter & QS_INPUT) queue->changed_bits &= ~QS_INPUT; if (filter & QS_PAINT) queue->changed_bits &= ~QS_PAINT; + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->changed_bits = queue->changed_bits; + } + SHARED_WRITE_END + /* then check for posted messages */ if ((filter & QS_POSTMESSAGE) && get_posted_message( queue, get_win, req->get_first, req->get_last, req->flags, reply )) @@ -3005,6 +3065,14 @@ DECL_HANDLER(get_message) if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event ); queue->wake_mask = req->wake_mask; queue->changed_mask = req->changed_mask; + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->wake_mask = queue->wake_mask; + shared->changed_mask = queue->changed_mask; + } + SHARED_WRITE_END + set_error( STATUS_PENDING ); /* FIXME */ } diff --git a/server/thread.c b/server/thread.c index 50eddabe8eb..75d132a093c 100644 --- a/server/thread.c +++ b/server/thread.c @@ -50,6 +50,7 @@ #include "request.h" #include "user.h" #include "security.h" +#include "unicode.h" /* thread queues */ @@ -246,6 +247,8 @@ static inline void init_thread_structure( struct thread *thread ) thread->token = NULL; thread->desc = NULL; thread->desc_len = 0; + thread->queue_shared_mapping = NULL; + thread->queue_shared = NULL; thread->creation_time = current_time; thread->exit_time = 0; @@ -295,6 +298,28 @@ static struct context *create_thread_context( struct thread *thread ) } +static volatile void *init_queue_mapping( struct thread *thread ) +{ + struct unicode_str name; + struct object *dir = create_thread_map_directory(); + char nameA[MAX_PATH]; + WCHAR *nameW; + + if (!dir) return NULL; + + sprintf( nameA, "%08x-queue", thread->id ); + nameW = ascii_to_unicode_str( nameA, &name ); + + thread->queue_shared_mapping = create_shared_mapping( dir, &name, sizeof(struct queue_shared_memory), + OBJ_OPENIF, NULL, (void **)&thread->queue_shared ); + release_object( dir ); + if (thread->queue_shared_mapping) memset( (void *)thread->queue_shared, 0, sizeof(*thread->queue_shared) ); + + free( nameW ); + return thread->queue_shared; +} + + /* create a new thread */ struct thread *create_thread( int fd, struct process *process, const struct security_descriptor *sd ) { @@ -361,6 +386,11 @@ struct thread *create_thread( int fd, struct process *process, const struct secu release_object( thread ); return NULL; } + if (!init_queue_mapping( thread )) + { + release_object( thread ); + return NULL; + } if (process->desktop) { @@ -429,6 +459,8 @@ static void cleanup_thread( struct thread *thread ) } } free( thread->desc ); + if (thread->queue_shared_mapping) release_object( thread->queue_shared_mapping ); + thread->queue_shared_mapping = NULL; thread->req_data = NULL; thread->reply_data = NULL; thread->request_fd = NULL; diff --git a/server/thread.h b/server/thread.h index 8dcf966a90a..3b2e87dfb1e 100644 --- a/server/thread.h +++ b/server/thread.h @@ -90,6 +90,8 @@ struct thread struct list kernel_object; /* list of kernel object pointers */ data_size_t desc_len; /* thread description length in bytes */ WCHAR *desc; /* thread description string */ + struct object *queue_shared_mapping; /* thread queue shared memory mapping */ + queue_shm_t *queue_shared; /* thread queue shared memory ptr */ }; extern struct thread *current; From 1d1c5ce03ce9c5b346161731044353b671313d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0345/1506] user32: Don't check for driver events so often. Now that PeekMessage may return quickly we don't want to check for driver events on every call. --- dlls/win32u/message.c | 14 ++++++++++---- dlls/win32u/ntuser_private.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index f84069ef6f1..b89e434c993 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3074,7 +3074,8 @@ static HANDLE get_server_queue_handle(void) /* check for driver events if we detect that the app is not properly consuming messages */ static inline void check_for_driver_events( UINT msg ) { - if (get_user_thread_info()->message_count > 200) + struct user_thread_info *thread_info = get_user_thread_info(); + if (thread_info->message_count > 200) { flush_window_surfaces( FALSE ); user_driver->pProcessEvents( QS_ALLINPUT ); @@ -3082,9 +3083,9 @@ static inline void check_for_driver_events( UINT msg ) else if (msg == WM_TIMER || msg == WM_SYSTIMER) { /* driver events should have priority over timers, so make sure we'll check for them soon */ - get_user_thread_info()->message_count += 100; + thread_info->message_count += 100; } - else get_user_thread_info()->message_count++; + else thread_info->message_count++; } /* helper for kernel32->ntdll timeout format conversion */ @@ -3264,17 +3265,21 @@ BOOL WINAPI NtUserWaitMessage(void) */ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ) { + struct user_thread_info *thread_info = get_user_thread_info(); MSG msg; int ret; user_check_not_lock(); - check_for_driver_events( 0 ); + if (thread_info->last_driver_time != NtGetTickCount()) + check_for_driver_events( 0 ); ret = peek_message( &msg, hwnd, first, last, flags, 0 ); if (ret < 0) return FALSE; if (!ret) { + if (thread_info->last_driver_time == NtGetTickCount()) return FALSE; + thread_info->last_driver_time = NtGetTickCount(); flush_window_surfaces( TRUE ); ret = wait_message( 0, NULL, 0, QS_ALLINPUT, 0 ); /* if we received driver events, check again for a pending message */ @@ -3282,6 +3287,7 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, U } check_for_driver_events( msg.message ); + thread_info->last_driver_time = NtGetTickCount() - 1; /* copy back our internal safe copy of message data to msg_out. * msg_out is a variable from the *program*, so it can't be used diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index d5894c075fa..b4cd318720d 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -131,6 +131,7 @@ struct user_thread_info HANDLE server_queue; /* Handle to server-side queue */ DWORD wake_mask; /* Current queue wake mask */ DWORD changed_mask; /* Current queue changed mask */ + DWORD last_driver_time; /* Get/PeekMessage driver event time */ WORD message_count; /* Get/PeekMessage loop counter */ WORD hook_call_depth; /* Number of recursively called hook procs */ WORD hook_unicode; /* Is current hook unicode? */ From e55b7e67a859cdbdb2d5d9abb37a7d64acc6b035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 4 Aug 2023 17:31:38 +0200 Subject: [PATCH 0346/1506] user32: Call get_message request at least once every 3s. So that the thread queue isn't incorrectly flagged as hung. --- dlls/win32u/message.c | 3 ++- dlls/win32u/ntuser_private.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index b89e434c993..014da031033 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2779,7 +2779,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->client_info.msg_source = prev_source; - if (!shared) skip = FALSE; + if (!shared || NtGetTickCount() - thread_info->last_getmsg_time >= 3000) skip = FALSE; else SHARED_READ_BEGIN( shared, queue_shm_t ) { /* not created yet */ @@ -2809,6 +2809,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, req->wake_mask = changed_mask & (QS_SENDMESSAGE | QS_SMRESULT); req->changed_mask = changed_mask; wine_server_set_reply( req, buffer, buffer_size ); + thread_info->last_getmsg_time = NtGetTickCount(); if (!(res = wine_server_call( req ))) { size = wine_server_reply_size( reply ); diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index b4cd318720d..17a14bacf89 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -132,6 +132,7 @@ struct user_thread_info DWORD wake_mask; /* Current queue wake mask */ DWORD changed_mask; /* Current queue changed mask */ DWORD last_driver_time; /* Get/PeekMessage driver event time */ + DWORD last_getmsg_time; /* Get/PeekMessage last request time */ WORD message_count; /* Get/PeekMessage loop counter */ WORD hook_call_depth; /* Number of recursively called hook procs */ WORD hook_unicode; /* Is current hook unicode? */ From 87ab047322ba61f20213942ef64d4254cd94cc15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0347/1506] user32: Allocate heap in peek_message only when necessary. --- dlls/win32u/message.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 014da031033..f6f94a7b3ce 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2749,13 +2749,12 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, INPUT_MESSAGE_SOURCE prev_source = thread_info->client_info.msg_source; const queue_shm_t *shared = get_queue_shared_memory(); struct received_message_info info; + unsigned char buffer_init[1024]; unsigned int hw_id = 0; /* id of previous hardware message */ + void *buffer = buffer_init; BOOL skip = FALSE; - void *buffer; size_t buffer_size = 1024; - if (!(buffer = malloc( buffer_size ))) return -1; - if (!first && !last) last = ~0; if (hwnd == HWND_BROADCAST) hwnd = HWND_TOPMOST; @@ -2832,19 +2831,22 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, if (res) { - free( buffer ); if (res == STATUS_PENDING) { thread_info->wake_mask = changed_mask & (QS_SENDMESSAGE | QS_SMRESULT); thread_info->changed_mask = changed_mask; + if (buffer != buffer_init) free( buffer ); return 0; } if (res != STATUS_BUFFER_OVERFLOW) { RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); + if (buffer != buffer_init) free( buffer ); return -1; } - if (!(buffer = malloc( buffer_size ))) return -1; + if (buffer == buffer_init) buffer = malloc( buffer_size ); + else buffer = realloc( buffer, buffer_size ); + if (!buffer) return -1; continue; } @@ -2861,6 +2863,12 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, break; case MSG_NOTIFY: info.flags = ISMEX_NOTIFY; + /* unpack_message may have to reallocate */ + if (buffer == buffer_init) + { + buffer = malloc( buffer_size ); + memcpy( buffer, buffer_init, buffer_size ); + } if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, &info.msg.lParam, &buffer, size )) continue; @@ -2939,6 +2947,12 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, continue; case MSG_OTHER_PROCESS: info.flags = ISMEX_SEND; + /* unpack_message may have to reallocate */ + if (buffer == buffer_init) + { + buffer = malloc( buffer_size ); + memcpy( buffer, buffer_init, buffer_size ); + } if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, &info.msg.lParam, &buffer, size )) { @@ -2961,7 +2975,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->client_info.message_pos = MAKELONG( info.msg.pt.x, info.msg.pt.y ); thread_info->client_info.message_time = info.msg.time; thread_info->client_info.message_extra = msg_data->hardware.info; - free( buffer ); + if (buffer != buffer_init) free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, sizeof(*msg) ); return 1; } @@ -2976,7 +2990,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, /* if this is a nested call return right away */ if (first == info.msg.message && last == info.msg.message) { - free( buffer ); + if (buffer != buffer_init) free( buffer ); return 0; } } @@ -3015,7 +3029,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->client_info.message_time = info.msg.time; thread_info->client_info.message_extra = 0; thread_info->client_info.msg_source = msg_source_unavailable; - free( buffer ); + if (buffer != buffer_init) free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, sizeof(*msg) ); return 1; } From 665b1945117d330cbaa7de71d1e295688ce055f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0348/1506] user32: Yield thread in peek_message when no message was found. --- dlls/win32u/message.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index f6f94a7b3ce..6b964f71c24 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2836,6 +2836,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->wake_mask = changed_mask & (QS_SENDMESSAGE | QS_SMRESULT); thread_info->changed_mask = changed_mask; if (buffer != buffer_init) free( buffer ); + NtYieldExecution(); return 0; } if (res != STATUS_BUFFER_OVERFLOW) From d792ca351d1ca76576bc7b6d9b1a7e4dca3153a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 19 Jun 2023 08:58:52 +0200 Subject: [PATCH 0349/1506] server: Create a thread input shared mapping. --- server/protocol.def | 9 +++++++++ server/queue.c | 29 ++++++++++++++++++++++++++++- server/thread.c | 41 ++++++++++++++++++++++++++++++++++++++++- server/thread.h | 2 ++ 4 files changed, 79 insertions(+), 2 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index b0048907ade..f4b850ea3c5 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -917,9 +917,18 @@ struct queue_shared_memory unsigned int changed_bits; unsigned int wake_mask; unsigned int changed_mask; + thread_id_t input_tid; }; typedef volatile struct queue_shared_memory queue_shm_t; +struct input_shared_memory +{ + unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ + int created; + thread_id_t tid; +}; +typedef volatile struct input_shared_memory input_shm_t; + /****************************************************************/ /* Request declarations */ diff --git a/server/queue.c b/server/queue.c index d0edb97ce40..ff39474e1ee 100644 --- a/server/queue.c +++ b/server/queue.c @@ -115,6 +115,8 @@ struct thread_input unsigned char keystate[256]; /* state of each key */ unsigned char desktop_keystate[256]; /* desktop keystate when keystate was synced */ int keystate_lock; /* keystate is locked */ + struct object *shared_mapping; /* thread input shared memory mapping */ + const input_shm_t *shared; /* thread input shared memory ptr */ }; struct msg_queue @@ -279,6 +281,8 @@ static struct thread_input *create_thread_input( struct thread *thread ) if ((input = alloc_object( &thread_input_ops ))) { + input->shared_mapping = grab_object( thread->input_shared_mapping ); + input->shared = thread->input_shared; input->focus = 0; input->capture = 0; input->active = 0; @@ -298,6 +302,12 @@ static struct thread_input *create_thread_input( struct thread *thread ) } memcpy( input->desktop_keystate, (void *)input->desktop->shared->keystate, sizeof(input->desktop_keystate) ); + + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->created = TRUE; + } + SHARED_WRITE_END } return input; } @@ -349,7 +359,16 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ thread->queue = queue; } - if (new_input) release_object( new_input ); + if (new_input) + { + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->input_tid = new_input->shared->tid; + } + SHARED_WRITE_END + + release_object( new_input ); + } return queue; } @@ -397,6 +416,13 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_ queue->input = (struct thread_input *)grab_object( new_input ); if (queue->keystate_lock) lock_input_keystate( queue->input ); new_input->cursor_count += queue->cursor_count; + + SHARED_WRITE_BEGIN( queue, queue_shm_t ) + { + shared->input_tid = queue->input->shared->tid; + } + SHARED_WRITE_END + return 1; } @@ -1314,6 +1340,7 @@ static void thread_input_destroy( struct object *obj ) if (desktop->foreground_input == input) desktop->foreground_input = NULL; release_object( desktop ); } + release_object( input->shared_mapping ); } /* fix the thread input data when a window is destroyed */ diff --git a/server/thread.c b/server/thread.c index 75d132a093c..1955463fc9f 100644 --- a/server/thread.c +++ b/server/thread.c @@ -249,6 +249,8 @@ static inline void init_thread_structure( struct thread *thread ) thread->desc_len = 0; thread->queue_shared_mapping = NULL; thread->queue_shared = NULL; + thread->input_shared_mapping = NULL; + thread->input_shared = NULL; thread->creation_time = current_time; thread->exit_time = 0; @@ -313,13 +315,43 @@ static volatile void *init_queue_mapping( struct thread *thread ) thread->queue_shared_mapping = create_shared_mapping( dir, &name, sizeof(struct queue_shared_memory), OBJ_OPENIF, NULL, (void **)&thread->queue_shared ); release_object( dir ); - if (thread->queue_shared_mapping) memset( (void *)thread->queue_shared, 0, sizeof(*thread->queue_shared) ); + if (thread->queue_shared_mapping) + { + memset( (void *)thread->queue_shared, 0, sizeof(*thread->queue_shared) ); + thread->queue_shared->input_tid = thread->id; + } free( nameW ); return thread->queue_shared; } +static volatile void *init_input_mapping( struct thread *thread ) +{ + struct unicode_str name; + struct object *dir = create_thread_map_directory(); + char nameA[MAX_PATH]; + WCHAR *nameW; + + if (!dir) return NULL; + + sprintf( nameA, "%08x-input", thread->id ); + nameW = ascii_to_unicode_str( nameA, &name ); + + thread->input_shared_mapping = create_shared_mapping( dir, &name, sizeof(struct input_shared_memory), + OBJ_OPENIF, NULL, (void **)&thread->input_shared ); + release_object( dir ); + if (thread->input_shared_mapping) + { + memset( (void *)thread->input_shared, 0, sizeof(*thread->input_shared) ); + thread->input_shared->tid = thread->id; + } + + free( nameW ); + return thread->input_shared; +} + + /* create a new thread */ struct thread *create_thread( int fd, struct process *process, const struct security_descriptor *sd ) { @@ -391,6 +423,11 @@ struct thread *create_thread( int fd, struct process *process, const struct secu release_object( thread ); return NULL; } + if (!init_input_mapping( thread )) + { + release_object( thread ); + return NULL; + } if (process->desktop) { @@ -461,6 +498,8 @@ static void cleanup_thread( struct thread *thread ) free( thread->desc ); if (thread->queue_shared_mapping) release_object( thread->queue_shared_mapping ); thread->queue_shared_mapping = NULL; + if (thread->input_shared_mapping) release_object( thread->input_shared_mapping ); + thread->input_shared_mapping = NULL; thread->req_data = NULL; thread->reply_data = NULL; thread->request_fd = NULL; diff --git a/server/thread.h b/server/thread.h index 3b2e87dfb1e..65d7db6ce17 100644 --- a/server/thread.h +++ b/server/thread.h @@ -92,6 +92,8 @@ struct thread WCHAR *desc; /* thread description string */ struct object *queue_shared_mapping; /* thread queue shared memory mapping */ queue_shm_t *queue_shared; /* thread queue shared memory ptr */ + struct object *input_shared_mapping; /* thread input shared memory mapping */ + input_shm_t *input_shared; /* thread input shared memory ptr */ }; extern struct thread *current; From 5e0d77d33bc0c3eaef518782a55180e815d4181b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:54 +0200 Subject: [PATCH 0350/1506] server: Move active window to input shared memory. --- server/protocol.def | 1 + server/queue.c | 59 ++++++++++++++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index f4b850ea3c5..3db0199a78b 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -926,6 +926,7 @@ struct input_shared_memory unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ int created; thread_id_t tid; + user_handle_t active; /* handle to the active window */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index ff39474e1ee..97f58a14f07 100644 --- a/server/queue.c +++ b/server/queue.c @@ -102,7 +102,6 @@ struct thread_input struct desktop *desktop; /* desktop that this thread input belongs to */ user_handle_t focus; /* focus window */ user_handle_t capture; /* capture window */ - user_handle_t active; /* active window */ user_handle_t menu_owner; /* current menu owner window */ user_handle_t move_size; /* current moving/resizing window */ user_handle_t caret; /* caret window */ @@ -285,7 +284,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) input->shared = thread->input_shared; input->focus = 0; input->capture = 0; - input->active = 0; input->menu_owner = 0; input->move_size = 0; input->cursor = 0; @@ -305,6 +303,7 @@ static struct thread_input *create_thread_input( struct thread *thread ) SHARED_WRITE_BEGIN( input, input_shm_t ) { + shared->active = 0; shared->created = TRUE; } SHARED_WRITE_END @@ -473,7 +472,7 @@ static void queue_cursor_message( struct desktop *desktop, user_handle_t win, un msg->lparam = lparam; msg->x = desktop->shared->cursor.x; msg->y = desktop->shared->cursor.y; - if (!(msg->win = win) && (input = desktop->foreground_input)) msg->win = input->active; + if (!(msg->win = win) && (input = desktop->foreground_input)) msg->win = input->shared->active; queue_hardware_message( desktop, msg, 1 ); } @@ -1326,7 +1325,7 @@ static void thread_input_dump( struct object *obj, int verbose ) { struct thread_input *input = (struct thread_input *)obj; fprintf( stderr, "Thread input focus=%08x capture=%08x active=%08x\n", - input->focus, input->capture, input->active ); + input->focus, input->capture, input->shared->active ); } static void thread_input_destroy( struct object *obj ) @@ -1350,7 +1349,13 @@ static inline void thread_input_cleanup_window( struct msg_queue *queue, user_ha if (window == input->focus) input->focus = 0; if (window == input->capture) input->capture = 0; - if (window == input->active) input->active = 0; + + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + if (window == shared->active) shared->active = 0; + } + SHARED_WRITE_END + if (window == input->menu_owner) input->menu_owner = 0; if (window == input->move_size) input->move_size = 0; if (window == input->caret) set_caret_window( input, 0 ); @@ -1386,7 +1391,7 @@ int init_thread_queue( struct thread *thread ) int attach_thread_input( struct thread *thread_from, struct thread *thread_to ) { struct desktop *desktop; - struct thread_input *input; + struct thread_input *input, *old_input; int ret; if (!thread_to->queue && !(thread_to->queue = create_msg_queue( thread_to, NULL ))) return 0; @@ -1403,8 +1408,14 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to ) if (thread_from->queue) { - if (!input->focus) input->focus = thread_from->queue->input->focus; - if (!input->active) input->active = thread_from->queue->input->active; + old_input = thread_from->queue->input; + if (!input->focus) input->focus = old_input->focus; + + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + if (!shared->active) shared->active = old_input->shared->active; + } + SHARED_WRITE_END } ret = assign_thread_input( thread_from, input ); @@ -1430,12 +1441,21 @@ void detach_thread_input( struct thread *thread_from ) } release_object( thread ); } - if (old_input->active && (thread = get_window_thread( old_input->active ))) + if (old_input->shared->active && (thread = get_window_thread( old_input->shared->active ))) { if (thread == thread_from) { - input->active = old_input->active; - old_input->active = 0; + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->active = old_input->shared->active; + } + SHARED_WRITE_END + + SHARED_WRITE_BEGIN( old_input, input_shm_t ) + { + shared->active = 0; + } + SHARED_WRITE_END } release_object( thread ); } @@ -1761,7 +1781,7 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru case QS_KEY: if (input && !(win = input->focus)) { - win = input->active; + win = input->shared->active; if (*msg_code < WM_SYSKEYDOWN) *msg_code += WM_SYSKEYDOWN - WM_KEYDOWN; } break; @@ -3446,7 +3466,7 @@ DECL_HANDLER(get_thread_input) { reply->focus = input->focus; reply->capture = input->capture; - reply->active = input->active; + reply->active = input->shared->active; reply->menu_owner = input->menu_owner; reply->move_size = input->move_size; reply->caret = input->caret; @@ -3456,7 +3476,7 @@ DECL_HANDLER(get_thread_input) } /* foreground window is active window of foreground thread */ - reply->foreground = desktop->foreground_input ? desktop->foreground_input->active : 0; + reply->foreground = desktop->foreground_input ? desktop->foreground_input->shared->active : 0; if (thread) release_object( thread ); release_object( desktop ); } @@ -3528,7 +3548,7 @@ DECL_HANDLER(set_foreground_window) struct msg_queue *queue = get_current_queue(); if (!(desktop = get_thread_desktop( current, 0 ))) return; - reply->previous = desktop->foreground_input ? desktop->foreground_input->active : 0; + reply->previous = desktop->foreground_input ? desktop->foreground_input->shared->active : 0; reply->send_msg_old = (reply->previous && desktop->foreground_input != queue->input); reply->send_msg_new = FALSE; @@ -3574,8 +3594,13 @@ DECL_HANDLER(set_active_window) { if (!req->handle || make_window_active( req->handle )) { - reply->previous = queue->input->active; - queue->input->active = get_user_full_handle( req->handle ); + user_handle_t active = get_user_full_handle( req->handle ); + reply->previous = queue->input->shared->active; + SHARED_WRITE_BEGIN( queue->input, input_shm_t ) + { + shared->active = active; + } + SHARED_WRITE_END if (desktop->foreground_input == queue->input && req->handle != reply->previous) { From c63f17759a0696587ef5caffd9450ad595749015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 3 Aug 2023 16:19:03 +0200 Subject: [PATCH 0351/1506] server: Move focus window to input shared memory. --- server/protocol.def | 1 + server/queue.c | 41 +++++++++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index 3db0199a78b..9e8d2f51ed7 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -926,6 +926,7 @@ struct input_shared_memory unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ int created; thread_id_t tid; + user_handle_t focus; /* handle to the focus window */ user_handle_t active; /* handle to the active window */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index 97f58a14f07..b686e6a8480 100644 --- a/server/queue.c +++ b/server/queue.c @@ -100,7 +100,6 @@ struct thread_input { struct object obj; /* object header */ struct desktop *desktop; /* desktop that this thread input belongs to */ - user_handle_t focus; /* focus window */ user_handle_t capture; /* capture window */ user_handle_t menu_owner; /* current menu owner window */ user_handle_t move_size; /* current moving/resizing window */ @@ -282,7 +281,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) { input->shared_mapping = grab_object( thread->input_shared_mapping ); input->shared = thread->input_shared; - input->focus = 0; input->capture = 0; input->menu_owner = 0; input->move_size = 0; @@ -303,6 +301,7 @@ static struct thread_input *create_thread_input( struct thread *thread ) SHARED_WRITE_BEGIN( input, input_shm_t ) { + shared->focus = 0; shared->active = 0; shared->created = TRUE; } @@ -1325,7 +1324,7 @@ static void thread_input_dump( struct object *obj, int verbose ) { struct thread_input *input = (struct thread_input *)obj; fprintf( stderr, "Thread input focus=%08x capture=%08x active=%08x\n", - input->focus, input->capture, input->shared->active ); + input->shared->focus, input->capture, input->shared->active ); } static void thread_input_destroy( struct object *obj ) @@ -1347,11 +1346,11 @@ static inline void thread_input_cleanup_window( struct msg_queue *queue, user_ha { struct thread_input *input = queue->input; - if (window == input->focus) input->focus = 0; if (window == input->capture) input->capture = 0; SHARED_WRITE_BEGIN( input, input_shm_t ) { + if (window == shared->focus) shared->focus = 0; if (window == shared->active) shared->active = 0; } SHARED_WRITE_END @@ -1409,10 +1408,10 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to ) if (thread_from->queue) { old_input = thread_from->queue->input; - if (!input->focus) input->focus = old_input->focus; SHARED_WRITE_BEGIN( input, input_shm_t ) { + if (!shared->focus) shared->focus = old_input->shared->focus; if (!shared->active) shared->active = old_input->shared->active; } SHARED_WRITE_END @@ -1432,12 +1431,21 @@ void detach_thread_input( struct thread *thread_from ) if ((input = create_thread_input( thread_from ))) { - if (old_input->focus && (thread = get_window_thread( old_input->focus ))) + if (old_input->shared->focus && (thread = get_window_thread( old_input->shared->focus ))) { if (thread == thread_from) { - input->focus = old_input->focus; - old_input->focus = 0; + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->focus = old_input->shared->focus; + } + SHARED_WRITE_END + + SHARED_WRITE_BEGIN( old_input, input_shm_t ) + { + shared->focus = 0; + } + SHARED_WRITE_END } release_object( thread ); } @@ -1776,10 +1784,10 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru { case QS_POINTER: case QS_RAWINPUT: - if (!(win = msg->win) && input) win = input->focus; + if (!(win = msg->win) && input) win = input->shared->focus; break; case QS_KEY: - if (input && !(win = input->focus)) + if (input && !(win = input->shared->focus)) { win = input->shared->active; if (*msg_code < WM_SYSKEYDOWN) *msg_code += WM_SYSKEYDOWN - WM_KEYDOWN; @@ -1947,7 +1955,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa static struct thread *get_foreground_thread( struct desktop *desktop, user_handle_t window ) { /* if desktop has no foreground process, assume the receiving window is */ - if (desktop->foreground_input) return get_window_thread( desktop->foreground_input->focus ); + if (desktop->foreground_input) return get_window_thread( desktop->foreground_input->shared->focus ); if (window) return get_window_thread( window ); return NULL; } @@ -3464,7 +3472,7 @@ DECL_HANDLER(get_thread_input) if (input) { - reply->focus = input->focus; + reply->focus = input->shared->focus; reply->capture = input->capture; reply->active = input->shared->active; reply->menu_owner = input->menu_owner; @@ -3574,8 +3582,13 @@ DECL_HANDLER(set_focus_window) reply->previous = 0; if (queue && check_queue_input_window( queue, req->handle )) { - reply->previous = queue->input->focus; - queue->input->focus = get_user_full_handle( req->handle ); + user_handle_t focus = get_user_full_handle( req->handle ); + reply->previous = queue->input->shared->focus; + SHARED_WRITE_BEGIN( queue->input, input_shm_t ) + { + shared->focus = focus; + } + SHARED_WRITE_END } } From d09168de01a7961832af0da44ce8623f6b43b609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0352/1506] server: Add foreground TID to desktop shared memory. --- server/protocol.def | 1 + server/queue.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/server/protocol.def b/server/protocol.def index 9e8d2f51ed7..b1df9f7a8f2 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -906,6 +906,7 @@ struct desktop_shared_memory unsigned int seq; /* sequence number - server updating if (seq & 1) != 0 */ struct shared_cursor cursor; /* global cursor information */ unsigned char keystate[256]; /* asynchronous key state */ + thread_id_t foreground_tid; /* tid of the foreground thread */ }; typedef volatile struct desktop_shared_memory desktop_shm_t; diff --git a/server/queue.c b/server/queue.c index b686e6a8480..7df51069253 100644 --- a/server/queue.c +++ b/server/queue.c @@ -614,6 +614,11 @@ static void set_foreground_input( struct desktop *desktop, struct thread_input * if (desktop->foreground_input == input) return; set_clip_rectangle( desktop, NULL, SET_CURSOR_NOCLIP, 1 ); desktop->foreground_input = input; + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + shared->foreground_tid = input ? input->shared->tid : 0; + } + SHARED_WRITE_END } /* get the hook table for a given thread */ From 4e8bf9091b704d93a8dd9214a7398fc965249279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 3 Aug 2023 16:20:39 +0200 Subject: [PATCH 0353/1506] server: Move capture window to input shared memory. As well as menu owner / menu size window handles. --- server/protocol.def | 3 +++ server/queue.c | 44 +++++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index b1df9f7a8f2..f1ba9089b0e 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -928,7 +928,10 @@ struct input_shared_memory int created; thread_id_t tid; user_handle_t focus; /* handle to the focus window */ + user_handle_t capture; /* handle to the capture window */ user_handle_t active; /* handle to the active window */ + user_handle_t menu_owner; /* handle to the menu owner */ + user_handle_t move_size; /* handle to the moving/resizing window */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index 7df51069253..79ebd0150c0 100644 --- a/server/queue.c +++ b/server/queue.c @@ -100,9 +100,6 @@ struct thread_input { struct object obj; /* object header */ struct desktop *desktop; /* desktop that this thread input belongs to */ - user_handle_t capture; /* capture window */ - user_handle_t menu_owner; /* current menu owner window */ - user_handle_t move_size; /* current moving/resizing window */ user_handle_t caret; /* caret window */ rectangle_t caret_rect; /* caret rectangle */ int caret_hide; /* caret hide count */ @@ -281,9 +278,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) { input->shared_mapping = grab_object( thread->input_shared_mapping ); input->shared = thread->input_shared; - input->capture = 0; - input->menu_owner = 0; - input->move_size = 0; input->cursor = 0; input->cursor_count = 0; list_init( &input->msg_list ); @@ -303,7 +297,10 @@ static struct thread_input *create_thread_input( struct thread *thread ) { shared->focus = 0; shared->active = 0; + shared->capture = 0; shared->created = TRUE; + shared->menu_owner = 0; + shared->move_size = 0; } SHARED_WRITE_END } @@ -1329,7 +1326,7 @@ static void thread_input_dump( struct object *obj, int verbose ) { struct thread_input *input = (struct thread_input *)obj; fprintf( stderr, "Thread input focus=%08x capture=%08x active=%08x\n", - input->shared->focus, input->capture, input->shared->active ); + input->shared->focus, input->shared->capture, input->shared->active ); } static void thread_input_destroy( struct object *obj ) @@ -1351,17 +1348,16 @@ static inline void thread_input_cleanup_window( struct msg_queue *queue, user_ha { struct thread_input *input = queue->input; - if (window == input->capture) input->capture = 0; - SHARED_WRITE_BEGIN( input, input_shm_t ) { if (window == shared->focus) shared->focus = 0; + if (window == shared->capture) shared->capture = 0; if (window == shared->active) shared->active = 0; + if (window == shared->menu_owner) shared->menu_owner = 0; + if (window == shared->move_size) shared->move_size = 0; } SHARED_WRITE_END - if (window == input->menu_owner) input->menu_owner = 0; - if (window == input->move_size) input->move_size = 0; if (window == input->caret) set_caret_window( input, 0 ); } @@ -1800,7 +1796,7 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru break; case QS_MOUSEMOVE: case QS_MOUSEBUTTON: - if (!input || !(win = input->capture)) + if (!input || !(win = input->shared->capture)) { if (is_window_visible( msg->win ) && !is_window_transparent( msg->win )) win = msg->win; else win = shallow_window_from_point( desktop, msg->x, msg->y ); @@ -3478,10 +3474,10 @@ DECL_HANDLER(get_thread_input) if (input) { reply->focus = input->shared->focus; - reply->capture = input->capture; + reply->capture = input->shared->capture; reply->active = input->shared->active; - reply->menu_owner = input->menu_owner; - reply->move_size = input->move_size; + reply->menu_owner = input->shared->menu_owner; + reply->move_size = input->shared->move_size; reply->caret = input->caret; reply->cursor = input->cursor; reply->show_count = input->cursor_count; @@ -3642,18 +3638,24 @@ DECL_HANDLER(set_capture_window) if (queue && check_queue_input_window( queue, req->handle )) { struct thread_input *input = queue->input; + user_handle_t capture = get_user_full_handle( req->handle ); /* if in menu mode, reject all requests to change focus, except if the menu bit is set */ - if (input->menu_owner && !(req->flags & CAPTURE_MENU)) + if (input->shared->menu_owner && !(req->flags & CAPTURE_MENU)) { set_error(STATUS_ACCESS_DENIED); return; } - reply->previous = input->capture; - input->capture = get_user_full_handle( req->handle ); - input->menu_owner = (req->flags & CAPTURE_MENU) ? input->capture : 0; - input->move_size = (req->flags & CAPTURE_MOVESIZE) ? input->capture : 0; - reply->full_handle = input->capture; + reply->previous = input->shared->capture; + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->capture = capture; + shared->menu_owner = (req->flags & CAPTURE_MENU) ? shared->capture : 0; + shared->move_size = (req->flags & CAPTURE_MOVESIZE) ? shared->capture : 0; + } + SHARED_WRITE_END + + reply->full_handle = input->shared->capture; } } From b031a1b144aae61dedb81cc6d45d450474317c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 3 Aug 2023 16:21:19 +0200 Subject: [PATCH 0354/1506] server: Move caret window and rect to input shared memory. --- server/protocol.def | 2 ++ server/queue.c | 59 +++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index f1ba9089b0e..e81b7090d4e 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -932,6 +932,8 @@ struct input_shared_memory user_handle_t active; /* handle to the active window */ user_handle_t menu_owner; /* handle to the menu owner */ user_handle_t move_size; /* handle to the moving/resizing window */ + user_handle_t caret; /* handle to the caret window */ + rectangle_t caret_rect; /* caret rectangle */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index 79ebd0150c0..381fc4a4937 100644 --- a/server/queue.c +++ b/server/queue.c @@ -100,8 +100,6 @@ struct thread_input { struct object obj; /* object header */ struct desktop *desktop; /* desktop that this thread input belongs to */ - user_handle_t caret; /* caret window */ - rectangle_t caret_rect; /* caret rectangle */ int caret_hide; /* caret hide count */ int caret_state; /* caret on/off state */ user_handle_t cursor; /* current cursor */ @@ -254,17 +252,17 @@ static unsigned int cursor_history_latest; static void queue_hardware_message( struct desktop *desktop, struct message *msg, int always_queue ); static void free_message( struct message *msg ); -/* set the caret window in a given thread input */ -static void set_caret_window( struct thread_input *input, user_handle_t win ) +/* set the caret window in a given thread input, requires write lock on the thread input shared member */ +static void set_caret_window( struct thread_input *input, input_shm_t *shared, user_handle_t win ) { - if (!win || win != input->caret) + if (!win || win != shared->caret) { - input->caret_rect.left = 0; - input->caret_rect.top = 0; - input->caret_rect.right = 0; - input->caret_rect.bottom = 0; + shared->caret_rect.left = 0; + shared->caret_rect.top = 0; + shared->caret_rect.right = 0; + shared->caret_rect.bottom = 0; } - input->caret = win; + shared->caret = win; input->caret_hide = 1; input->caret_state = 0; } @@ -281,7 +279,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) input->cursor = 0; input->cursor_count = 0; list_init( &input->msg_list ); - set_caret_window( input, 0 ); memset( input->keystate, 0, sizeof(input->keystate) ); input->keystate_lock = 0; @@ -301,6 +298,7 @@ static struct thread_input *create_thread_input( struct thread *thread ) shared->created = TRUE; shared->menu_owner = 0; shared->move_size = 0; + set_caret_window( input, shared, 0 ); } SHARED_WRITE_END } @@ -1355,10 +1353,10 @@ static inline void thread_input_cleanup_window( struct msg_queue *queue, user_ha if (window == shared->active) shared->active = 0; if (window == shared->menu_owner) shared->menu_owner = 0; if (window == shared->move_size) shared->move_size = 0; + if (window == shared->caret) set_caret_window( input, shared, 0 ); } SHARED_WRITE_END - if (window == input->caret) set_caret_window( input, 0 ); } /* check if the specified window can be set in the input data of a given queue */ @@ -3478,10 +3476,10 @@ DECL_HANDLER(get_thread_input) reply->active = input->shared->active; reply->menu_owner = input->shared->menu_owner; reply->move_size = input->shared->move_size; - reply->caret = input->caret; + reply->caret = input->shared->caret; reply->cursor = input->cursor; reply->show_count = input->cursor_count; - reply->rect = input->caret_rect; + reply->rect = input->shared->caret_rect; } /* foreground window is active window of foreground thread */ @@ -3669,15 +3667,20 @@ DECL_HANDLER(set_caret_window) if (queue && check_queue_input_window( queue, req->handle )) { struct thread_input *input = queue->input; + user_handle_t caret = get_user_full_handle(req->handle); - reply->previous = input->caret; - reply->old_rect = input->caret_rect; + reply->previous = input->shared->caret; + reply->old_rect = input->shared->caret_rect; reply->old_hide = input->caret_hide; reply->old_state = input->caret_state; - set_caret_window( input, get_user_full_handle(req->handle) ); - input->caret_rect.right = input->caret_rect.left + req->width; - input->caret_rect.bottom = input->caret_rect.top + req->height; + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + set_caret_window( input, shared, caret ); + shared->caret_rect.right = shared->caret_rect.left + req->width; + shared->caret_rect.bottom = shared->caret_rect.top + req->height; + } + SHARED_WRITE_END } } @@ -3690,22 +3693,26 @@ DECL_HANDLER(set_caret_info) if (!queue) return; input = queue->input; - reply->full_handle = input->caret; - reply->old_rect = input->caret_rect; + reply->full_handle = input->shared->caret; + reply->old_rect = input->shared->caret_rect; reply->old_hide = input->caret_hide; reply->old_state = input->caret_state; - if (req->handle && get_user_full_handle(req->handle) != input->caret) + if (req->handle && get_user_full_handle(req->handle) != input->shared->caret) { set_error( STATUS_ACCESS_DENIED ); return; } if (req->flags & SET_CARET_POS) { - input->caret_rect.right += req->x - input->caret_rect.left; - input->caret_rect.bottom += req->y - input->caret_rect.top; - input->caret_rect.left = req->x; - input->caret_rect.top = req->y; + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->caret_rect.right += req->x - shared->caret_rect.left; + shared->caret_rect.bottom += req->y - shared->caret_rect.top; + shared->caret_rect.left = req->x; + shared->caret_rect.top = req->y; + } + SHARED_WRITE_END } if (req->flags & SET_CARET_HIDE) { From 9eea380d82051eb18f56b822f6620667b9213b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 19 Jun 2023 09:02:43 +0200 Subject: [PATCH 0355/1506] user32: Use input shared memory for GetGUIThreadInfo. When the current thread is requested. --- dlls/win32u/message.c | 28 +++++++++++++++++++++ dlls/win32u/ntuser_private.h | 4 +++ dlls/win32u/sysparams.c | 12 +++++++++ dlls/win32u/winstation.c | 48 ++++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 6b964f71c24..2eb49dd5d5c 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2136,6 +2136,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR */ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info ) { + const input_shm_t *shared; BOOL ret; if (info->cbSize != sizeof(*info)) @@ -2144,6 +2145,33 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info ) return FALSE; } + if (id == GetCurrentThreadId()) shared = get_input_shared_memory(); + else if (id == 0) shared = get_foreground_shared_memory(); + else shared = NULL; + + if (shared) + { + SHARED_READ_BEGIN( shared, input_shm_t ) + { + info->flags = 0; + info->hwndActive = wine_server_ptr_handle( shared->active ); + info->hwndFocus = wine_server_ptr_handle( shared->focus ); + info->hwndCapture = wine_server_ptr_handle( shared->capture ); + info->hwndMenuOwner = wine_server_ptr_handle( shared->menu_owner ); + info->hwndMoveSize = wine_server_ptr_handle( shared->move_size ); + info->hwndCaret = wine_server_ptr_handle( shared->caret ); + info->rcCaret.left = shared->caret_rect.left; + info->rcCaret.top = shared->caret_rect.top; + info->rcCaret.right = shared->caret_rect.right; + info->rcCaret.bottom = shared->caret_rect.bottom; + if (shared->menu_owner) info->flags |= GUI_INMENUMODE; + if (shared->move_size) info->flags |= GUI_INMOVESIZE; + if (shared->caret) info->flags |= GUI_CARETBLINKING; + } + SHARED_READ_END + return TRUE; + } + SERVER_START_REQ( get_thread_input ) { req->tid = id; diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 17a14bacf89..c0120f89ebc 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -150,6 +150,8 @@ struct user_thread_info DWORD clipping_reset; /* time when clipping was last reset */ const desktop_shm_t *desktop_shm; /* Ptr to server's desktop shared memory */ const queue_shm_t *queue_shm; /* Ptr to server's thread queue shared memory */ + const input_shm_t *input_shm; /* Ptr to server's thread input shared memory */ + const input_shm_t *foreground_shm; /* Ptr to server's foreground thread input shared memory */ }; C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) ); @@ -270,6 +272,8 @@ UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask ); /* winstation.c */ extern const desktop_shm_t *get_desktop_shared_memory(void); extern const queue_shm_t *get_queue_shared_memory(void); +extern const input_shm_t *get_input_shared_memory(void); +extern const input_shm_t *get_foreground_shared_memory(void); static inline UINT win_get_flags( HWND hwnd ) { diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index e8cfc4ad8f2..986a066ab60 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6216,6 +6216,18 @@ static void thread_detach(void) thread_info->queue_shm = NULL; } + if (thread_info->input_shm) + { + NtUnmapViewOfSection( GetCurrentProcess(), (void *)thread_info->input_shm ); + thread_info->input_shm = NULL; + } + + if (thread_info->foreground_shm) + { + NtUnmapViewOfSection( GetCurrentProcess(), (void *)thread_info->foreground_shm ); + thread_info->foreground_shm = NULL; + } + exiting_thread_id = 0; } diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 4731f2b7194..b04c0bbc910 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -685,6 +685,54 @@ const queue_shm_t *get_queue_shared_memory(void) return thread_info->queue_shm; } +static const input_shm_t *get_thread_input_shared_memory( UINT tid, const input_shm_t *input_shm ) +{ + WCHAR bufferW[MAX_PATH]; + char buffer[MAX_PATH]; + + if (input_shm && input_shm->tid == tid) return input_shm; + if (input_shm) NtUnmapViewOfSection( GetCurrentProcess(), (void *)input_shm ); + + snprintf( buffer, ARRAY_SIZE(buffer), "\\KernelObjects\\__wine_thread_mappings\\%08x-input", tid ); + asciiz_to_unicode( bufferW, buffer ); + return map_shared_memory_section( bufferW, sizeof(*input_shm), NULL ); +} + +const input_shm_t *get_input_shared_memory(void) +{ + const queue_shm_t *queue = get_queue_shared_memory(); + struct user_thread_info *thread_info = get_user_thread_info(); + UINT tid; + + if (!queue) return NULL; + SHARED_READ_BEGIN( queue, queue_shm_t ) + { + tid = queue->input_tid; + } + SHARED_READ_END + + thread_info->input_shm = get_thread_input_shared_memory( tid, thread_info->input_shm ); + return thread_info->input_shm; +} + +const input_shm_t *get_foreground_shared_memory(void) +{ + const desktop_shm_t *desktop = get_desktop_shared_memory(); + struct user_thread_info *thread_info = get_user_thread_info(); + UINT tid; + + if (!desktop) return NULL; + SHARED_READ_BEGIN( desktop, desktop_shm_t ) + { + tid = desktop->foreground_tid; + } + SHARED_READ_END + + if (!tid) return NULL; + thread_info->foreground_shm = get_thread_input_shared_memory( tid, thread_info->foreground_shm ); + return thread_info->foreground_shm; +} + /*********************************************************************** * winstation_init * From d307834d6750dd524e666185844d40b1d989da8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 3 Aug 2023 16:21:51 +0200 Subject: [PATCH 0356/1506] server: Add cursor handle and count to desktop shared memory. --- server/protocol.def | 2 ++ server/queue.c | 66 +++++++++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index e81b7090d4e..306f71b7257 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -933,7 +933,9 @@ struct input_shared_memory user_handle_t menu_owner; /* handle to the menu owner */ user_handle_t move_size; /* handle to the moving/resizing window */ user_handle_t caret; /* handle to the caret window */ + user_handle_t cursor; /* handle to the cursor */ rectangle_t caret_rect; /* caret rectangle */ + int cursor_count; /* cursor show count */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index 381fc4a4937..54ba5ffd182 100644 --- a/server/queue.c +++ b/server/queue.c @@ -102,8 +102,6 @@ struct thread_input struct desktop *desktop; /* desktop that this thread input belongs to */ int caret_hide; /* caret hide count */ int caret_state; /* caret on/off state */ - user_handle_t cursor; /* current cursor */ - int cursor_count; /* cursor show count */ struct list msg_list; /* list of hardware messages */ unsigned char keystate[256]; /* state of each key */ unsigned char desktop_keystate[256]; /* desktop keystate when keystate was synced */ @@ -276,8 +274,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) { input->shared_mapping = grab_object( thread->input_shared_mapping ); input->shared = thread->input_shared; - input->cursor = 0; - input->cursor_count = 0; list_init( &input->msg_list ); memset( input->keystate, 0, sizeof(input->keystate) ); input->keystate_lock = 0; @@ -298,6 +294,8 @@ static struct thread_input *create_thread_input( struct thread *thread ) shared->created = TRUE; shared->menu_owner = 0; shared->move_size = 0; + shared->cursor = 0; + shared->cursor_count = 0; set_caret_window( input, shared, 0 ); } SHARED_WRITE_END @@ -402,13 +400,23 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_ } if (queue->input) { - queue->input->cursor_count -= queue->cursor_count; + SHARED_WRITE_BEGIN( queue->input, input_shm_t ) + { + shared->cursor_count -= queue->cursor_count; + } + SHARED_WRITE_END + if (queue->keystate_lock) unlock_input_keystate( queue->input ); release_object( queue->input ); } queue->input = (struct thread_input *)grab_object( new_input ); if (queue->keystate_lock) lock_input_keystate( queue->input ); - new_input->cursor_count += queue->cursor_count; + + SHARED_WRITE_BEGIN( new_input, input_shm_t ) + { + shared->cursor_count += queue->cursor_count; + } + SHARED_WRITE_END SHARED_WRITE_BEGIN( queue, queue_shm_t ) { @@ -492,7 +500,7 @@ static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t if (updated && (input = get_desktop_cursor_thread_input( desktop ))) { - user_handle_t handle = input->cursor_count < 0 ? 0 : input->cursor; + user_handle_t handle = input->shared->cursor_count < 0 ? 0 : input->shared->cursor; /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle ); @@ -529,7 +537,7 @@ static void update_desktop_cursor_handle( struct desktop *desktop, struct thread { if (input == get_desktop_cursor_thread_input( desktop )) { - user_handle_t handle = input->cursor_count < 0 ? 0 : input->cursor, win = desktop->cursor_win; + user_handle_t handle = input->shared->cursor_count < 0 ? 0 : input->shared->cursor, win = desktop->cursor_win; /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle ); @@ -1286,7 +1294,12 @@ static void cleanup_msg_queue( struct msg_queue *queue ) free( timer ); } if (queue->timeout) remove_timeout_user( queue->timeout ); - queue->input->cursor_count -= queue->cursor_count; + SHARED_WRITE_BEGIN( queue->input, input_shm_t ) + { + shared->cursor_count -= queue->cursor_count; + } + SHARED_WRITE_END + if (queue->keystate_lock) unlock_input_keystate( queue->input ); release_object( queue->input ); if (queue->hooks) release_object( queue->hooks ); @@ -3477,8 +3490,8 @@ DECL_HANDLER(get_thread_input) reply->menu_owner = input->shared->menu_owner; reply->move_size = input->shared->move_size; reply->caret = input->shared->caret; - reply->cursor = input->cursor; - reply->show_count = input->cursor_count; + reply->cursor = input->shared->cursor; + reply->show_count = input->shared->cursor_count; reply->rect = input->shared->caret_rect; } @@ -3751,25 +3764,32 @@ DECL_HANDLER(set_cursor) input = queue->input; desktop = input->desktop; - reply->prev_handle = input->cursor; - reply->prev_count = input->cursor_count; + reply->prev_handle = input->shared->cursor; + reply->prev_count = input->shared->cursor_count; reply->prev_x = desktop->shared->cursor.x; reply->prev_y = desktop->shared->cursor.y; - if (req->flags & SET_CURSOR_HANDLE) + if ((req->flags & SET_CURSOR_HANDLE) && req->handle && + !get_user_object( req->handle, USER_CLIENT )) { - if (req->handle && !get_user_object( req->handle, USER_CLIENT )) - { - set_win32_error( ERROR_INVALID_CURSOR_HANDLE ); - return; - } - input->cursor = req->handle; + set_win32_error( ERROR_INVALID_CURSOR_HANDLE ); + return; } - if (req->flags & SET_CURSOR_COUNT) + + SHARED_WRITE_BEGIN( input, input_shm_t ) { - queue->cursor_count += req->show_count; - input->cursor_count += req->show_count; + if (req->flags & SET_CURSOR_HANDLE) + { + shared->cursor = req->handle; + } + if (req->flags & SET_CURSOR_COUNT) + { + queue->cursor_count += req->show_count; + shared->cursor_count += req->show_count; + } } + SHARED_WRITE_END + if (req->flags & SET_CURSOR_POS) set_cursor_pos( desktop, req->x, req->y ); if (req->flags & SET_CURSOR_CLIP) set_clip_rectangle( desktop, &req->clip, req->flags, 0 ); if (req->flags & SET_CURSOR_NOCLIP) set_clip_rectangle( desktop, NULL, SET_CURSOR_NOCLIP, 0 ); From a1dabc98a1acb774755f5a18fbbacb0f714f65e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0357/1506] user32: Use input shared memory for GetCursorInfo. --- dlls/win32u/input.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 23fa53f8896..f50182d5b5b 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -552,14 +552,17 @@ BOOL enable_mouse_in_pointer = FALSE; */ HWND WINAPI NtUserGetForegroundWindow(void) { + const input_shm_t *shared = get_foreground_shared_memory(); HWND ret = 0; - SERVER_START_REQ( get_thread_input ) + if (!shared) return 0; + + SHARED_READ_BEGIN( shared, input_shm_t ) { - req->tid = 0; - if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->foreground ); + ret = wine_server_ptr_handle( shared->active ); } - SERVER_END_REQ; + SHARED_READ_END + return ret; } @@ -781,20 +784,19 @@ BOOL get_cursor_pos( POINT *pt ) */ BOOL WINAPI NtUserGetCursorInfo( CURSORINFO *info ) { + const input_shm_t *shared = get_foreground_shared_memory(); BOOL ret; if (!info) return FALSE; - SERVER_START_REQ( get_thread_input ) + if (!shared) ret = FALSE; + else SHARED_READ_BEGIN( shared, input_shm_t ) { - req->tid = 0; - if ((ret = !wine_server_call( req ))) - { - info->hCursor = wine_server_ptr_handle( reply->cursor ); - info->flags = reply->show_count >= 0 ? CURSOR_SHOWING : 0; - } + info->hCursor = wine_server_ptr_handle( shared->cursor ); + info->flags = (shared->cursor_count >= 0) ? CURSOR_SHOWING : 0; + ret = TRUE; } - SERVER_END_REQ; + SHARED_READ_END get_cursor_pos( &info->ptScreenPos ); return ret; } From afb2240d8d05903f06a60e0eabff6376164a3afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0358/1506] server: Remove cursor and show_count from get_thread_input. --- server/protocol.def | 2 -- server/queue.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index 306f71b7257..beaca971f20 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2916,8 +2916,6 @@ enum coords_relative user_handle_t menu_owner; /* handle to the menu owner */ user_handle_t move_size; /* handle to the moving/resizing window */ user_handle_t caret; /* handle to the caret window */ - user_handle_t cursor; /* handle to the cursor */ - int show_count; /* cursor show count */ rectangle_t rect; /* caret rectangle */ @END diff --git a/server/queue.c b/server/queue.c index 54ba5ffd182..f9ba1fe5b70 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3490,8 +3490,6 @@ DECL_HANDLER(get_thread_input) reply->menu_owner = input->shared->menu_owner; reply->move_size = input->shared->move_size; reply->caret = input->shared->caret; - reply->cursor = input->shared->cursor; - reply->show_count = input->shared->cursor_count; reply->rect = input->shared->caret_rect; } From 815e035dd5abae2dc31287910680e9934619276c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0359/1506] server: Remove foreground window from get_thread_input. --- server/protocol.def | 1 - server/queue.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index beaca971f20..e797a31de8e 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2912,7 +2912,6 @@ enum coords_relative user_handle_t focus; /* handle to the focus window */ user_handle_t capture; /* handle to the capture window */ user_handle_t active; /* handle to the active window */ - user_handle_t foreground; /* handle to the global foreground window */ user_handle_t menu_owner; /* handle to the menu owner */ user_handle_t move_size; /* handle to the moving/resizing window */ user_handle_t caret; /* handle to the caret window */ diff --git a/server/queue.c b/server/queue.c index f9ba1fe5b70..3af77d540d8 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3493,8 +3493,6 @@ DECL_HANDLER(get_thread_input) reply->rect = input->shared->caret_rect; } - /* foreground window is active window of foreground thread */ - reply->foreground = desktop->foreground_input ? desktop->foreground_input->shared->active : 0; if (thread) release_object( thread ); release_object( desktop ); } From 731801a6eba6a5624974049ab4a52b610ca12c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0360/1506] server: Only return full keystate when requested. --- server/queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/queue.c b/server/queue.c index 3af77d540d8..cc1200d1c1d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3516,7 +3516,7 @@ DECL_HANDLER(get_key_state) } SHARED_WRITE_END } - set_reply_data( (void *)desktop->shared->keystate, size ); + else set_reply_data( (void *)desktop->shared->keystate, size ); release_object( desktop ); } else @@ -3528,7 +3528,7 @@ DECL_HANDLER(get_key_state) sync_input_keystate( queue->input ); reply->state = keystate[req->key & 0xff]; } - set_reply_data( keystate, size ); + else set_reply_data( keystate, size ); } } From 188e465db93f5e2de9cabc72c3c9eac3c9913338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 3 Aug 2023 16:23:12 +0200 Subject: [PATCH 0361/1506] server: Expose thread input keystate through shared memory. --- server/protocol.def | 1 + server/queue.c | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index e797a31de8e..b4043210aeb 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -936,6 +936,7 @@ struct input_shared_memory user_handle_t cursor; /* handle to the cursor */ rectangle_t caret_rect; /* caret rectangle */ int cursor_count; /* cursor show count */ + unsigned char keystate[256]; /* key state */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index cc1200d1c1d..9e27df09866 100644 --- a/server/queue.c +++ b/server/queue.c @@ -103,7 +103,6 @@ struct thread_input int caret_hide; /* caret hide count */ int caret_state; /* caret on/off state */ struct list msg_list; /* list of hardware messages */ - unsigned char keystate[256]; /* state of each key */ unsigned char desktop_keystate[256]; /* desktop keystate when keystate was synced */ int keystate_lock; /* keystate is locked */ struct object *shared_mapping; /* thread input shared memory mapping */ @@ -275,7 +274,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) input->shared_mapping = grab_object( thread->input_shared_mapping ); input->shared = thread->input_shared; list_init( &input->msg_list ); - memset( input->keystate, 0, sizeof(input->keystate) ); input->keystate_lock = 0; if (!(input->desktop = get_thread_desktop( thread, 0 /* FIXME: access rights */ ))) @@ -291,12 +289,13 @@ static struct thread_input *create_thread_input( struct thread *thread ) shared->focus = 0; shared->active = 0; shared->capture = 0; - shared->created = TRUE; shared->menu_owner = 0; shared->move_size = 0; shared->cursor = 0; shared->cursor_count = 0; set_caret_window( input, shared, 0 ); + memset( (void *)shared->keystate, 0, sizeof(shared->keystate) ); + shared->created = TRUE; } SHARED_WRITE_END } @@ -368,11 +367,16 @@ static void sync_input_keystate( struct thread_input *input ) { int i; if (!input->desktop || input->keystate_lock) return; - for (i = 0; i < sizeof(input->keystate); ++i) + + SHARED_WRITE_BEGIN( input, input_shm_t ) { - if (input->desktop_keystate[i] == input->desktop->shared->keystate[i]) continue; - input->keystate[i] = input->desktop_keystate[i] = input->desktop->shared->keystate[i]; + for (i = 0; i < sizeof(shared->keystate); ++i) + { + if (input->desktop_keystate[i] == input->desktop->shared->keystate[i]) continue; + shared->keystate[i] = input->desktop_keystate[i] = input->desktop->shared->keystate[i]; + } } + SHARED_WRITE_END } /* locks thread input keystate to prevent synchronization */ @@ -1430,7 +1434,14 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to ) } ret = assign_thread_input( thread_from, input ); - if (ret) memset( input->keystate, 0, sizeof(input->keystate) ); + if (ret) + { + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + memset( (void *)shared->keystate, 0, sizeof(shared->keystate) ); + } + SHARED_WRITE_END + } release_object( input ); return ret; } @@ -1683,7 +1694,11 @@ static void update_key_state( volatile unsigned char *keystate, unsigned int msg static void update_input_key_state( struct thread_input *input, unsigned int msg, lparam_t wparam ) { - update_key_state( input->keystate, msg, wparam, 0 ); + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + update_key_state( shared->keystate, msg, wparam, 0 ); + } + SHARED_WRITE_END } static void update_desktop_key_state( struct desktop *desktop, unsigned int msg, lparam_t wparam ) @@ -3522,7 +3537,7 @@ DECL_HANDLER(get_key_state) else { struct msg_queue *queue = get_current_queue(); - unsigned char *keystate = queue->input->keystate; + unsigned char *keystate = (void *)queue->input->shared->keystate; if (req->key >= 0) { sync_input_keystate( queue->input ); @@ -3540,7 +3555,12 @@ DECL_HANDLER(set_key_state) struct msg_queue *queue = get_current_queue(); data_size_t size = min( 256, get_req_data_size() ); - memcpy( queue->input->keystate, get_req_data(), size ); + SHARED_WRITE_BEGIN( queue->input, input_shm_t ) + { + memcpy( (void *)shared->keystate, get_req_data(), size ); + } + SHARED_WRITE_END + memcpy( queue->input->desktop_keystate, (void *)queue->input->desktop->shared->keystate, sizeof(queue->input->desktop_keystate) ); if (req->async && (desktop = get_thread_desktop( current, 0 ))) From c34b2352fc946b294763ca8bc0e333334323318b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0362/1506] user32: Use input shared memory in GetKeyboardState. --- dlls/win32u/input.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index f50182d5b5b..14d475a1065 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -969,11 +969,26 @@ SHORT WINAPI NtUserGetKeyState( INT vkey ) */ BOOL WINAPI NtUserGetKeyboardState( BYTE *state ) { - BOOL ret; + const input_shm_t *shared = get_input_shared_memory(); + BOOL ret, skip = TRUE; UINT i; TRACE("(%p)\n", state); + if (!shared) skip = FALSE; + else SHARED_READ_BEGIN( shared, input_shm_t ) + { + if (!shared->created) skip = FALSE; /* server needs to create the queue */ + else memcpy( state, (const void *)shared->keystate, 256 ); + } + SHARED_READ_END + + if (skip) + { + for (i = 0; i < 256; i++) state[i] &= 0x81; + return TRUE; + } + memset( state, 0, 256 ); SERVER_START_REQ( get_key_state ) { From 4585a11442fb945f24160ae2e4670ac4813fdd86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 3 Aug 2023 16:24:48 +0200 Subject: [PATCH 0363/1506] server: Expose thread input keystate lock through shared memory. --- server/protocol.def | 1 + server/queue.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index b4043210aeb..739f02fc137 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -937,6 +937,7 @@ struct input_shared_memory rectangle_t caret_rect; /* caret rectangle */ int cursor_count; /* cursor show count */ unsigned char keystate[256]; /* key state */ + int keystate_lock; /* keystate is locked */ }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index 9e27df09866..b59dc948bff 100644 --- a/server/queue.c +++ b/server/queue.c @@ -104,7 +104,6 @@ struct thread_input int caret_state; /* caret on/off state */ struct list msg_list; /* list of hardware messages */ unsigned char desktop_keystate[256]; /* desktop keystate when keystate was synced */ - int keystate_lock; /* keystate is locked */ struct object *shared_mapping; /* thread input shared memory mapping */ const input_shm_t *shared; /* thread input shared memory ptr */ }; @@ -274,7 +273,6 @@ static struct thread_input *create_thread_input( struct thread *thread ) input->shared_mapping = grab_object( thread->input_shared_mapping ); input->shared = thread->input_shared; list_init( &input->msg_list ); - input->keystate_lock = 0; if (!(input->desktop = get_thread_desktop( thread, 0 /* FIXME: access rights */ ))) { @@ -294,6 +292,7 @@ static struct thread_input *create_thread_input( struct thread *thread ) shared->cursor = 0; shared->cursor_count = 0; set_caret_window( input, shared, 0 ); + shared->keystate_lock = 0; memset( (void *)shared->keystate, 0, sizeof(shared->keystate) ); shared->created = TRUE; } @@ -366,7 +365,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ static void sync_input_keystate( struct thread_input *input ) { int i; - if (!input->desktop || input->keystate_lock) return; + if (!input->desktop || input->shared->keystate_lock) return; SHARED_WRITE_BEGIN( input, input_shm_t ) { @@ -382,14 +381,23 @@ static void sync_input_keystate( struct thread_input *input ) /* locks thread input keystate to prevent synchronization */ static void lock_input_keystate( struct thread_input *input ) { - input->keystate_lock++; + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->keystate_lock++; + } + SHARED_WRITE_END } /* unlock the thread input keystate and synchronize it again */ static void unlock_input_keystate( struct thread_input *input ) { - input->keystate_lock--; - if (!input->keystate_lock) sync_input_keystate( input ); + SHARED_WRITE_BEGIN( input, input_shm_t ) + { + shared->keystate_lock--; + } + SHARED_WRITE_END + + if (!input->shared->keystate_lock) sync_input_keystate( input ); } /* change the thread input data of a given thread */ From 79022f3e7dfe9d73ac716426c5c53eb03cfc7e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 16 Jun 2023 09:58:55 +0200 Subject: [PATCH 0364/1506] user32: Use input shared memory for GetKeyState. --- dlls/win32u/input.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 14d475a1065..d1658565f37 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -952,9 +952,20 @@ HKL WINAPI NtUserGetKeyboardLayout( DWORD thread_id ) */ SHORT WINAPI NtUserGetKeyState( INT vkey ) { + const input_shm_t *shared = get_input_shared_memory(); SHORT retval = 0; + BOOL skip = TRUE; - SERVER_START_REQ( get_key_state ) + if (!shared) skip = FALSE; + else SHARED_READ_BEGIN( shared, input_shm_t ) + { + if (!shared->created) skip = FALSE; /* server needs to create the queue */ + else if (!shared->keystate_lock) skip = FALSE; /* server needs to call sync_input_keystate */ + else retval = (signed char)(shared->keystate[vkey & 0xff] & 0x81); + } + SHARED_READ_END + + if (!skip) SERVER_START_REQ( get_key_state ) { req->key = vkey; if (!wine_server_call( req )) retval = (signed char)(reply->state & 0x81); From e3555864053efd164a048ab933bccb6e3b6d6d34 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 12 Jan 2023 19:02:11 -0600 Subject: [PATCH 0365/1506] win32u: Avoid calling server in NtUserGetKeyState() when input keystate is in sync. CW-Bug-Id: #21761 --- dlls/win32u/input.c | 16 ++++++++++++++-- server/protocol.def | 2 ++ server/queue.c | 6 +++++- server/winstation.c | 3 +++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index d1658565f37..bc55a085f33 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -953,6 +953,7 @@ HKL WINAPI NtUserGetKeyboardLayout( DWORD thread_id ) SHORT WINAPI NtUserGetKeyState( INT vkey ) { const input_shm_t *shared = get_input_shared_memory(); + const desktop_shm_t *desktop_shared; SHORT retval = 0; BOOL skip = TRUE; @@ -960,8 +961,19 @@ SHORT WINAPI NtUserGetKeyState( INT vkey ) else SHARED_READ_BEGIN( shared, input_shm_t ) { if (!shared->created) skip = FALSE; /* server needs to create the queue */ - else if (!shared->keystate_lock) skip = FALSE; /* server needs to call sync_input_keystate */ - else retval = (signed char)(shared->keystate[vkey & 0xff] & 0x81); + else if (!shared->keystate_lock) + { + desktop_shared = get_desktop_shared_memory(); + if (!desktop_shared) skip = FALSE; + else SHARED_READ_BEGIN( desktop_shared, desktop_shm_t ) + { + if (shared->sync_serial != desktop_shared->update_serial) + skip = FALSE; /* server needs to call sync_input_keystate */ + } + SHARED_READ_END + } + if (skip) + retval = (signed char)(shared->keystate[vkey & 0xff] & 0x81); } SHARED_READ_END diff --git a/server/protocol.def b/server/protocol.def index 739f02fc137..4051b8d25d4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -907,6 +907,7 @@ struct desktop_shared_memory struct shared_cursor cursor; /* global cursor information */ unsigned char keystate[256]; /* asynchronous key state */ thread_id_t foreground_tid; /* tid of the foreground thread */ + __int64 update_serial; }; typedef volatile struct desktop_shared_memory desktop_shm_t; @@ -938,6 +939,7 @@ struct input_shared_memory int cursor_count; /* cursor show count */ unsigned char keystate[256]; /* key state */ int keystate_lock; /* keystate is locked */ + __int64 sync_serial; }; typedef volatile struct input_shared_memory input_shm_t; diff --git a/server/queue.c b/server/queue.c index b59dc948bff..7a4d45659ba 100644 --- a/server/queue.c +++ b/server/queue.c @@ -374,8 +374,9 @@ static void sync_input_keystate( struct thread_input *input ) if (input->desktop_keystate[i] == input->desktop->shared->keystate[i]) continue; shared->keystate[i] = input->desktop_keystate[i] = input->desktop->shared->keystate[i]; } + shared->sync_serial = input->desktop->shared->update_serial; } - SHARED_WRITE_END + SHARED_WRITE_END; } /* locks thread input keystate to prevent synchronization */ @@ -1713,6 +1714,7 @@ static void update_desktop_key_state( struct desktop *desktop, unsigned int msg, { SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) { + ++shared->update_serial; update_key_state( shared->keystate, msg, wparam, 1 ); } SHARED_WRITE_END @@ -3535,6 +3537,7 @@ DECL_HANDLER(get_key_state) reply->state = desktop->shared->keystate[req->key & 0xff]; SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) { + ++shared->update_serial; shared->keystate[req->key & 0xff] &= ~0x40; } SHARED_WRITE_END @@ -3575,6 +3578,7 @@ DECL_HANDLER(set_key_state) { SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) { + ++shared->update_serial; memcpy( (void *)shared->keystate, get_req_data(), size ); } SHARED_WRITE_END diff --git a/server/winstation.c b/server/winstation.c index 07719ebbdf9..a0c41ea21a2 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -227,7 +227,10 @@ static int init_desktop_mapping( struct desktop *desktop, const struct unicode_s if (!(dir = create_desktop_map_directory( desktop->winstation ))) return 0; if ((desktop->shared_mapping = create_shared_mapping( dir, name, sizeof(struct desktop_shared_memory), 0, NULL, (void **)&desktop->shared ))) + { memset( (void *)desktop->shared, 0, sizeof(*desktop->shared) ); + ((desktop_shm_t *)desktop->shared)->update_serial = 1; + } release_object( dir ); return !!desktop->shared; From 9ceae59cebd111f0fb06d63ad1495ea1becd714b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Dec 2023 15:03:25 +0100 Subject: [PATCH 0366/1506] HACK: user32: Always call get_message request after waiting. Because with esync and fsync the wait happens on the client-side, so we need to make the request to do the server side effects. --- dlls/win32u/message.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 2eb49dd5d5c..7f2fe415c7e 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2770,7 +2770,7 @@ static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardwar * available; -1 on error. * All pending sent messages are processed before returning. */ -static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, UINT changed_mask ) +static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, UINT changed_mask, BOOL waited ) { LRESULT result; struct user_thread_info *thread_info = get_user_thread_info(); @@ -2806,7 +2806,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->client_info.msg_source = prev_source; - if (!shared || NtGetTickCount() - thread_info->last_getmsg_time >= 3000) skip = FALSE; + if (waited || !shared || NtGetTickCount() - thread_info->last_getmsg_time >= 3000) skip = FALSE; else SHARED_READ_BEGIN( shared, queue_shm_t ) { /* not created yet */ @@ -3025,7 +3025,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, } else peek_message( msg, info.msg.hwnd, info.msg.message, - info.msg.message, flags | PM_REMOVE, changed_mask ); + info.msg.message, flags | PM_REMOVE, changed_mask, TRUE ); continue; } if (info.msg.message >= WM_DDE_FIRST && info.msg.message <= WM_DDE_LAST) @@ -3088,7 +3088,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, static void process_sent_messages(void) { MSG msg; - peek_message( &msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, 0 ); + peek_message( &msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE, 0, FALSE ); } /*********************************************************************** @@ -3317,7 +3317,7 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, U if (thread_info->last_driver_time != NtGetTickCount()) check_for_driver_events( 0 ); - ret = peek_message( &msg, hwnd, first, last, flags, 0 ); + ret = peek_message( &msg, hwnd, first, last, flags, 0, FALSE ); if (ret < 0) return FALSE; if (!ret) @@ -3327,7 +3327,7 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, U flush_window_surfaces( TRUE ); ret = wait_message( 0, NULL, 0, QS_ALLINPUT, 0 ); /* if we received driver events, check again for a pending message */ - if (ret == WAIT_TIMEOUT || peek_message( &msg, hwnd, first, last, flags, 0 ) <= 0) return FALSE; + if (ret == WAIT_TIMEOUT || peek_message( &msg, hwnd, first, last, flags, 0, TRUE ) <= 0) return FALSE; } check_for_driver_events( msg.message ); @@ -3369,7 +3369,7 @@ BOOL WINAPI NtUserGetMessage( MSG *msg, HWND hwnd, UINT first, UINT last ) } else mask = QS_ALLINPUT; - while (!(ret = peek_message( msg, hwnd, first, last, PM_REMOVE | (mask << 16), mask ))) + while (!(ret = peek_message( msg, hwnd, first, last, PM_REMOVE | (mask << 16), mask, TRUE ))) { wait_objects( 1, &server_queue, INFINITE, mask & (QS_SENDMESSAGE | QS_SMRESULT), mask, 0 ); } From 38660173bb5aa5250ad414ac27517dce25b30a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 1 Mar 2021 20:19:52 +0100 Subject: [PATCH 0367/1506] HACK: user32: Always pretend that GetAsyncKeyState recent bit is 0. --- dlls/win32u/input.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index bc55a085f33..2a4c2123169 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -814,7 +814,6 @@ SHORT WINAPI NtUserGetAsyncKeyState( INT key ) { const desktop_shm_t *shared = get_desktop_shared_memory(); BYTE state; - SHORT ret; if (key < 0 || key >= 256 || !shared) return 0; @@ -826,23 +825,7 @@ SHORT WINAPI NtUserGetAsyncKeyState( INT key ) } SHARED_READ_END - if (!(state & 0x40)) return (state & 0x80) << 8; - - /* Need to make a server call to reset the last pressed bit */ - ret = 0; - SERVER_START_REQ( get_key_state ) - { - req->async = 1; - req->key = key; - if (!wine_server_call( req )) - { - if (reply->state & 0x40) ret |= 0x0001; - if (reply->state & 0x80) ret |= 0x8000; - } - } - SERVER_END_REQ; - - return ret; + return (state & 0x80) << 8; } /*********************************************************************** From ee26301492801941e02cf5fdc26600765b48dc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 27 Jun 2023 09:06:05 +0200 Subject: [PATCH 0368/1506] imm32: Avoid closing the input context on CPS_CANCEL. CW-Bug-Id: #22370 --- dlls/imm32/ime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/imm32/ime.c b/dlls/imm32/ime.c index 60672b366ab..3db318662b9 100644 --- a/dlls/imm32/ime.c +++ b/dlls/imm32/ime.c @@ -696,7 +696,8 @@ BOOL WINAPI NotifyIME( HIMC himc, DWORD action, DWORD index, DWORD value ) } case CPS_CANCEL: input_context_set_comp_str( ctx, NULL, 0 ); - ImmSetOpenStatus( himc, FALSE ); + if ((msg = ime_set_composition_status( himc, FALSE ))) ime_send_message( himc, msg, 0, 0 ); + NtUserNotifyIMEStatus( ctx->hWnd, FALSE ); break; default: FIXME( "himc %p, action %#lx, index %#lx, value %#lx stub!\n", himc, action, index, value ); From 24ff1c0cd4bcaf44a6b572ef80e311bc0534f92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 8 Aug 2023 17:55:31 +0200 Subject: [PATCH 0369/1506] imm32: Return success from WM_IME_CONTROL. CW-Bug-Id: #22569 --- dlls/imm32/ime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/imm32/ime.c b/dlls/imm32/ime.c index 3db318662b9..f0f01b5a9c5 100644 --- a/dlls/imm32/ime.c +++ b/dlls/imm32/ime.c @@ -433,7 +433,7 @@ static LRESULT WINAPI ime_ui_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LP case WM_IME_CONTROL: FIXME( "hwnd %p, himc %p, msg %s, wparam %s, lparam %#Ix stub!\n", hwnd, himc, debugstr_wm_ime(msg), debugstr_imc(wparam), lparam ); - return 1; + return 0; } return DefWindowProcW( hwnd, msg, wparam, lparam ); From 3aeef946d5e24de9f9f47f94e3b316fc720d8749 Mon Sep 17 00:00:00 2001 From: Etaash Mathamsetty Date: Mon, 16 Oct 2023 15:33:54 -0400 Subject: [PATCH 0370/1506] winex11.drv: Ensure initialized thread data in X11DRV_get_ic. Link: https://github.com/ValveSoftware/wine/pull/201 --- dlls/winex11.drv/xim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 209d63f0402..b4d675dc446 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -501,7 +501,7 @@ XIC X11DRV_get_ic( HWND hwnd ) XIC ret; if (!(data = get_win_data( hwnd ))) return 0; - x11drv_thread_data()->last_xic_hwnd = hwnd; + x11drv_init_thread_data()->last_xic_hwnd = hwnd; if (!(ret = data->xic) && (xim = x11drv_thread_data()->xim)) ret = data->xic = xic_create( xim, hwnd, data->whole_window ); release_win_data( data ); From e8801e96fedf67b88e6f3f5d9f9e2d9fbef64e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 12:57:48 +0100 Subject: [PATCH 0371/1506] winex11.drv: Add a GPU for each Vulkan device that was not tied to an XRandR provider. This assures that each Vulkan device has a LUID assigned (see X11DRV_InitGpu and VkPhysicalDeviceIDProperties). LUIDs are important for DirectX <-> Vulkan interop. VKD3D-Proton and DXVK's DXGI use that to identify which underlaying Vulkan device to use for the selected adapter. This change fixes GPU selection in Hitman 2 in DX12 mode. Without it VKD3D-Proton resorts to a heuristic (vid/pid matching, and if that fails use the first device in enumeration order) which can select the wrong one on some multi-GPU Nvidia setups due to nvapihack. This also fixes Forza Horizon 4 on Wayland as XWayland doesn't expose providers which results in missing LUIDs even for the GPU driving the outputs. CW-Bug-Id: #18737 CW-Bug-Id: #18925 --- dlls/winex11.drv/xrandr.c | 149 +++++++++++++++++++++++++++++++++++--- 1 file changed, 139 insertions(+), 10 deletions(-) diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 5c7b4d1ab80..ade0db94b24 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -612,6 +612,113 @@ static BOOL is_crtc_primary( RECT primary, const XRRCrtcInfo *crtc ) crtc->y + crtc->height == primary.bottom; } +static void add_remaining_gpus_via_vulkan( struct gdi_gpu **gpus, int *count ) +{ + static const char *extensions[] = + { + VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, + }; + const struct vulkan_funcs *vulkan_funcs = get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION ); + PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR; + PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices; + uint32_t device_count; + VkPhysicalDevice *vk_physical_devices = NULL; + VkPhysicalDeviceProperties2 properties2; + VkInstanceCreateInfo create_info; + VkPhysicalDeviceIDProperties id; + VkInstance vk_instance = NULL; + INT gpu_idx, device_idx; + INT original_gpu_count = *count; + struct gdi_gpu *new_gpu; + BOOL new; + VkResult vr; + + memset( &create_info, 0, sizeof(create_info) ); + create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + create_info.enabledExtensionCount = ARRAY_SIZE(extensions); + create_info.ppEnabledExtensionNames = extensions; + vr = vulkan_funcs->p_vkCreateInstance( &create_info, NULL, &vk_instance ); + + if (vr != VK_SUCCESS) + { + WARN("Failed to create a Vulkan instance, vr %d.\n", vr); + goto done; + } + +#define LOAD_VK_FUNC(f) \ + if (!(p##f = (void *)vulkan_funcs->p_vkGetInstanceProcAddr( vk_instance, #f ))) \ + { \ + WARN("Failed to load " #f ".\n"); \ + goto done; \ + } + + LOAD_VK_FUNC(vkEnumeratePhysicalDevices) + LOAD_VK_FUNC(vkGetPhysicalDeviceProperties2KHR) +#undef LOAD_VK_FUNC + + vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, NULL ); + if (vr != VK_SUCCESS || !device_count) + { + WARN("No Vulkan device found, vr %d, device_count %d.\n", vr, device_count); + goto done; + } + + if (!(vk_physical_devices = calloc( device_count, sizeof(*vk_physical_devices) ))) + goto done; + + vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, vk_physical_devices ); + if (vr != VK_SUCCESS) + { + WARN("vkEnumeratePhysicalDevices failed, vr %d.\n", vr); + goto done; + } + + for (device_idx = 0; device_idx < device_count; ++device_idx) + { + memset( &id, 0, sizeof(id) ); + id.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; + properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + properties2.pNext = &id; + + pvkGetPhysicalDeviceProperties2KHR( vk_physical_devices[device_idx], &properties2 ); + + /* Ignore Khronos vendor IDs */ + if (properties2.properties.vendorID >= 0x10000) + continue; + + new = TRUE; + for (gpu_idx = 0; gpu_idx < original_gpu_count; ++gpu_idx) + { + if (!memcmp( &(*gpus)[gpu_idx].vulkan_uuid, id.deviceUUID, sizeof(id.deviceUUID) )) + { + new = FALSE; + break; + } + } + + if (!new) + continue; + + *gpus = realloc( *gpus, (*count + 1) * sizeof(**gpus) ); + if (!gpus) goto done; + new_gpu = &(*gpus)[(*count)++]; + memset( new_gpu, 0, sizeof(*new_gpu) ); + new_gpu->id = -1; + + memcpy( &new_gpu->vulkan_uuid, id.deviceUUID, sizeof(id.deviceUUID) ); + new_gpu->vendor_id = properties2.properties.vendorID; + new_gpu->device_id = properties2.properties.deviceID; + ntdll_umbstowcs( properties2.properties.deviceName, -1, new_gpu->name, ARRAY_SIZE(new_gpu->name) ); + + TRACE("Added a new GPU via Vulkan: %04x:%04x %s\n", new_gpu->vendor_id, new_gpu->device_id, debugstr_w(new_gpu->name)); + } + +done: + free( vk_physical_devices ); + if (vk_instance) + vulkan_funcs->p_vkDestroyInstance( vk_instance, NULL ); +} + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProviderInfo *provider_info, @@ -759,6 +866,7 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p XRRProviderInfo *provider_info = NULL; XRRCrtcInfo *crtc_info = NULL; INT primary_provider = -1; + INT gpu_count = 0; RECT primary_rect; BOOL ret = FALSE; DWORD len; @@ -772,22 +880,17 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p if (!provider_resources) goto done; - gpus = calloc( provider_resources->nproviders ? provider_resources->nproviders : 1, sizeof(*gpus) ); - if (!gpus) - goto done; - /* Some XRandR implementations don't support providers. * In this case, report a fake one to try searching adapters in screen resources */ if (!provider_resources->nproviders) { WARN("XRandR implementation doesn't report any providers, faking one.\n"); - lstrcpyW( gpus[0].name, wine_adapterW ); - *new_gpus = gpus; - *count = 1; - ret = TRUE; - goto done; + goto fallback; } + gpus = calloc( provider_resources->nproviders, sizeof(*gpus) ); + if (!gpus) goto done; + primary_rect = get_primary_rect( screen_resources ); for (i = 0; i < provider_resources->nproviders; ++i) { @@ -821,6 +924,7 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p /* FIXME: Add an alternate method of getting PCI IDs, for systems that don't support Vulkan */ } pXRRFreeProviderInfo( provider_info ); + gpu_count++; } /* Make primary GPU the first */ @@ -831,8 +935,29 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p gpus[primary_provider] = tmp; } +fallback: + /* Add the Vulkan only GPUs only if we need all the detailed properties */ + if (get_properties) + add_remaining_gpus_via_vulkan( &gpus, &gpu_count ); + + if (gpu_count == 0) + { + /* we need at least one for get_adapters() / get_id() */ + gpus = calloc( 1, sizeof(*gpus) ); + if (!gpus) goto done; + lstrcpyW( gpus[0].name, wine_adapterW ); + gpu_count = 1; + } + else if (gpus[0].id == -1) + { + /* the only GPUs we have are from Vulkan, mark the first one + * as main so that we can use screen resources for adapters, + * see xrandr14_get_adapters() */ + gpus[0].id = 0; + } + *new_gpus = gpus; - *count = provider_resources->nproviders; + *count = gpu_count; ret = TRUE; done: if (provider_resources) @@ -872,6 +997,10 @@ static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad if (!screen_resources) goto done; + /* Vulkan-only, adapter-less GPU */ + if (gpu_id == -1) + goto done; + if (gpu_id) { provider_info = pXRRGetProviderInfo( gdi_display, screen_resources, gpu_id ); From a2c4d36637d02fab55d2dd839783195fac6bf556 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 5 Dec 2023 16:27:34 +0100 Subject: [PATCH 0372/1506] HACK: winex11, winevulkan: Support faking GPU PCI IDs. CW-Bug-Id: #23140 --- dlls/winevulkan/loader.c | 37 +++++++++++++++++++++++++++++++++ dlls/winevulkan/make_vulkan | 1 + dlls/winevulkan/vulkan_loader.h | 3 +++ dlls/winex11.drv/display.c | 22 ++++++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index c1960cff2ce..3f6204139fb 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -416,6 +416,41 @@ static void fill_luid_property(VkPhysicalDeviceProperties2 *properties2) device_node_mask); } +static void fixup_device_id(UINT *vendor_id, UINT *device_id) +{ + const char *sgi; + + if (*vendor_id == 0x10de /* NVIDIA */ && (sgi = getenv("WINE_HIDE_NVIDIA_GPU")) && *sgi != '0') + { + *vendor_id = 0x1002; /* AMD */ + *device_id = 0x73df; /* RX 6700XT */ + } + else if (*vendor_id == 0x1002 /* AMD */ && (sgi = getenv("WINE_HIDE_AMD_GPU")) && *sgi != '0') + { + *vendor_id = 0x10de; /* NVIDIA */ + *device_id = 0x2487; /* RTX 3060 */ + } + else if (*vendor_id == 0x1002 && *device_id == 0x163f && (sgi = getenv("WINE_HIDE_VANGOGH_GPU")) && *sgi != '0') + { + *device_id = 0x687f; /* Radeon RX Vega 56/64 */ + } +} + +void WINAPI vkGetPhysicalDeviceProperties(VkPhysicalDevice physical_device, + VkPhysicalDeviceProperties *properties) +{ + struct vkGetPhysicalDeviceProperties_params params; + NTSTATUS status; + + TRACE("%p, %p\n", physical_device, properties); + + params.physicalDevice = physical_device; + params.pProperties = properties; + status = UNIX_CALL(vkGetPhysicalDeviceProperties, ¶ms); + assert(!status); + fixup_device_id(&properties->vendorID, &properties->deviceID); +} + void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, VkPhysicalDeviceProperties2 *properties2) { @@ -429,6 +464,7 @@ void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, status = UNIX_CALL(vkGetPhysicalDeviceProperties2, ¶ms); assert(!status); fill_luid_property(properties2); + fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID); } void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, @@ -444,6 +480,7 @@ void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, status = UNIX_CALL(vkGetPhysicalDeviceProperties2KHR, ¶ms); assert(!status); fill_luid_property(properties2); + fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID); } VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 5470a8cda69..874e1b51acb 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -293,6 +293,7 @@ MANUAL_LOADER_THUNKS = { "vkEnumerateInstanceExtensionProperties", "vkEnumerateInstanceVersion", "vkFreeCommandBuffers", + "vkGetPhysicalDeviceProperties", "vkGetPhysicalDeviceProperties2", "vkGetPhysicalDeviceProperties2KHR", } diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h index a7c4b388056..70efc2bfa73 100644 --- a/dlls/winevulkan/vulkan_loader.h +++ b/dlls/winevulkan/vulkan_loader.h @@ -20,6 +20,9 @@ #ifndef __WINE_VULKAN_LOADER_H #define __WINE_VULKAN_LOADER_H +#include +#include + #include "ntstatus.h" #define WIN32_NO_STATUS #include diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 4a97f324482..d2c353250b9 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -530,6 +530,26 @@ static const char *debugstr_devmodew( const DEVMODEW *devmode ) position ); } +static void fixup_device_id(UINT *vendor_id, UINT *device_id) +{ + const char *sgi; + + if (*vendor_id == 0x10de /* NVIDIA */ && (sgi = getenv("WINE_HIDE_NVIDIA_GPU")) && *sgi != '0') + { + *vendor_id = 0x1002; /* AMD */ + *device_id = 0x73df; /* RX 6700XT */ + } + else if (*vendor_id == 0x1002 /* AMD */ && (sgi = getenv("WINE_HIDE_AMD_GPU")) && *sgi != '0') + { + *vendor_id = 0x10de; /* NVIDIA */ + *device_id = 0x2487; /* RTX 3060 */ + } + else if (*vendor_id == 0x1002 && *device_id == 0x163f && (sgi = getenv("WINE_HIDE_VANGOGH_GPU")) && *sgi != '0') + { + *device_id = 0x687f; /* Radeon RX Vega 56/64 */ + } +} + BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { struct gdi_adapter *adapters; @@ -551,6 +571,8 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage for (gpu = 0; gpu < gpu_count; gpu++) { + fixup_device_id( &gpus[gpu].vendor_id, &gpus[gpu].device_id ); + device_manager->add_gpu( &gpus[gpu], param ); /* Initialize adapters */ From 597aba9385cddd224216ed1f532fc1065a843bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 23:36:54 +0100 Subject: [PATCH 0373/1506] server: Introduce new set_thread_priority helper. --- server/thread.c | 44 +++++++++++++++++++++++++++++++------------- server/thread.h | 1 + 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/server/thread.c b/server/thread.c index 1955463fc9f..b7b5813f3db 100644 --- a/server/thread.c +++ b/server/thread.c @@ -677,25 +677,39 @@ affinity_t get_thread_affinity( struct thread *thread ) #define THREAD_PRIORITY_REALTIME_HIGHEST 6 #define THREAD_PRIORITY_REALTIME_LOWEST -7 +int set_thread_priority( struct thread *thread, int priority_class, int priority ) +{ + int max = THREAD_PRIORITY_HIGHEST; + int min = THREAD_PRIORITY_LOWEST; + if (priority_class == PROCESS_PRIOCLASS_REALTIME) + { + max = THREAD_PRIORITY_REALTIME_HIGHEST; + min = THREAD_PRIORITY_REALTIME_LOWEST; + } + if ((priority < min || priority > max) && + priority != THREAD_PRIORITY_IDLE && + priority != THREAD_PRIORITY_TIME_CRITICAL) + { + errno = EINVAL; + return -1; + } + + if (thread->process->priority == priority_class && + thread->priority == priority) + return 0; + thread->priority = priority; + + return 0; +} + /* set all information about a thread */ static void set_thread_info( struct thread *thread, const struct set_thread_info_request *req ) { if (req->mask & SET_THREAD_INFO_PRIORITY) { - int max = THREAD_PRIORITY_HIGHEST; - int min = THREAD_PRIORITY_LOWEST; - if (thread->process->priority == PROCESS_PRIOCLASS_REALTIME) - { - max = THREAD_PRIORITY_REALTIME_HIGHEST; - min = THREAD_PRIORITY_REALTIME_LOWEST; - } - if ((req->priority >= min && req->priority <= max) || - req->priority == THREAD_PRIORITY_IDLE || - req->priority == THREAD_PRIORITY_TIME_CRITICAL) - thread->priority = req->priority; - else - set_error( STATUS_INVALID_PARAMETER ); + if (set_thread_priority( thread, thread->process->priority, req->priority )) + file_set_error(); } if (req->mask & SET_THREAD_INFO_AFFINITY) { @@ -1484,7 +1498,10 @@ DECL_HANDLER(init_first_thread) if (!process->parent_id) process->affinity = current->affinity = get_thread_affinity( current ); else + { + set_thread_priority( current, current->process->priority, current->priority ); set_thread_affinity( current, current->affinity ); + } debug_level = max( debug_level, req->debug_level ); @@ -1515,6 +1532,7 @@ DECL_HANDLER(init_thread) init_thread_context( current ); generate_debug_event( current, DbgCreateThreadStateChange, &req->entry ); + set_thread_priority( current, current->process->priority, current->priority ); set_thread_affinity( current, current->affinity ); reply->suspend = (current->suspend || current->process->suspend || current->context != NULL); diff --git a/server/thread.h b/server/thread.h index 65d7db6ce17..0c28242533e 100644 --- a/server/thread.h +++ b/server/thread.h @@ -123,6 +123,7 @@ extern void thread_cancel_apc( struct thread *thread, struct object *owner, enum extern int thread_add_inflight_fd( struct thread *thread, int client, int server ); extern int thread_get_inflight_fd( struct thread *thread, int client ); extern struct token *thread_get_impersonation_token( struct thread *thread ); +extern int set_thread_priority( struct thread *thread, int priority_class, int priority ); extern int set_thread_affinity( struct thread *thread, affinity_t affinity ); extern int suspend_thread( struct thread *thread ); extern int resume_thread( struct thread *thread ); From d5282571674f6b171f515e0d8606540086ab198f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 1 Dec 2023 23:40:17 +0100 Subject: [PATCH 0374/1506] ntdll: Set RLIMIT_NICE to its hard limit. --- dlls/ntdll/unix/loader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index ecf766616ce..d3f3321b199 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2297,6 +2297,9 @@ DECLSPEC_EXPORT void __wine_main( int argc, char *argv[], char *envp[] ) #ifdef RLIMIT_AS set_max_limit( RLIMIT_AS ); #endif +#ifdef RLIMIT_NICE + set_max_limit( RLIMIT_NICE ); +#endif virtual_init(); init_environment(); From eb9c4e1af47273bee23db76c7756885fe5e8703f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 29 Nov 2023 22:40:49 +0300 Subject: [PATCH 0375/1506] server: Use setpriority to update thread niceness when safe. --- configure.ac | 10 ++++++++ server/main.c | 1 + server/object.h | 4 ++++ server/thread.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) diff --git a/configure.ac b/configure.ac index 749bbc7f814..c6c8d2ab5e6 100644 --- a/configure.ac +++ b/configure.ac @@ -2122,6 +2122,16 @@ then AC_DEFINE(HAVE_SCHED_SETAFFINITY, 1, [Define to 1 if you have the `sched_setaffinity' function.]) fi +AC_CACHE_CHECK([for setpriority],wine_cv_have_setpriority, + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[#define _GNU_SOURCE +#include +#include ]], [[setpriority(0, 0, 0);]])],[wine_cv_have_setpriority=yes],[wine_cv_have_setpriority=no])) +if test "$wine_cv_have_setpriority" = "yes" +then + AC_DEFINE(HAVE_SETPRIORITY, 1, [Define to 1 if you have the `setpriority' function.]) +fi + dnl **** Check for types **** AC_C_INLINE diff --git a/server/main.c b/server/main.c index efddef7f715..e2ae1bcaabc 100644 --- a/server/main.c +++ b/server/main.c @@ -234,6 +234,7 @@ int main( int argc, char *argv[] ) init_signals(); init_memory(); init_directories( load_intl_file() ); + init_threading(); init_registry(); main_loop(); return 0; diff --git a/server/object.h b/server/object.h index dfdd691601f..66012fbc4af 100644 --- a/server/object.h +++ b/server/object.h @@ -277,6 +277,10 @@ extern struct object *get_directory_obj( struct process *process, obj_handle_t h extern int directory_link_name( struct object *obj, struct object_name *name, struct object *parent ); extern void init_directories( struct fd *intl_fd ); +/* thread functions */ + +extern void init_threading(void); + /* symbolic link functions */ extern struct object *create_root_symlink( struct object *root, const struct unicode_str *name, diff --git a/server/thread.c b/server/thread.c index b7b5813f3db..b0617eda41d 100644 --- a/server/thread.c +++ b/server/thread.c @@ -37,6 +37,9 @@ #define _WITH_CPU_SET_T #include #endif +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -216,6 +219,27 @@ static const struct fd_ops thread_fd_ops = }; static struct list thread_list = LIST_INIT(thread_list); +#ifdef __linux__ +static int nice_limit; +#endif + +void init_threading(void) +{ +#ifdef __linux__ +#ifdef RLIMIT_NICE + struct rlimit rlimit; + if (!getrlimit( RLIMIT_NICE, &rlimit )) + { + rlimit.rlim_cur = rlimit.rlim_max; + setrlimit( RLIMIT_NICE, &rlimit ); + if (rlimit.rlim_max <= 40) nice_limit = 20 - rlimit.rlim_max; + else if (rlimit.rlim_max == -1) nice_limit = -20; + if (nice_limit >= 0 && debug_level) fprintf(stderr, "wine: RLIMIT_NICE is <= 20, unable to use setpriority safely\n"); + } +#endif + if (nice_limit < 0 && debug_level) fprintf(stderr, "wine: Using setpriority to control niceness in the [%d,%d] range\n", nice_limit, -nice_limit ); +#endif +} /* initialize the structure for a newly allocated thread */ static inline void init_thread_structure( struct thread *thread ) @@ -674,9 +698,48 @@ affinity_t get_thread_affinity( struct thread *thread ) return mask; } +static int get_base_priority( int priority_class, int priority ) +{ + /* offsets taken from https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities */ + static const int class_offsets[] = { 4, 8, 13, 24, 6, 10 }; + if (priority == THREAD_PRIORITY_IDLE) return (priority_class == PROCESS_PRIOCLASS_REALTIME ? 16 : 1); + if (priority == THREAD_PRIORITY_TIME_CRITICAL) return (priority_class == PROCESS_PRIOCLASS_REALTIME ? 31 : 15); + if (priority_class >= ARRAY_SIZE(class_offsets)) return 8; + return class_offsets[priority_class - 1] + priority; +} + +#ifdef __linux__ +/* maps an NT application band [1,15] base priority to [-nice_limit, nice_limit] */ +static int get_unix_niceness( int base_priority ) +{ + int min = -nice_limit, max = nice_limit, range = max - min; + return min + (base_priority - 1) * range / 14; +} +#endif + #define THREAD_PRIORITY_REALTIME_HIGHEST 6 #define THREAD_PRIORITY_REALTIME_LOWEST -7 +static void apply_thread_priority( struct thread *thread, int priority_class, int priority ) +{ + int base_priority = get_base_priority( priority_class, priority ); +#ifdef __linux__ + int niceness; + + /* FIXME: handle REALTIME class using SCHED_RR if possible, for now map it to highest non-realtime band */ + if (priority_class == PROCESS_PRIOCLASS_REALTIME) base_priority = 15; +#ifdef HAVE_SETPRIORITY + if (nice_limit < 0) + { + niceness = get_unix_niceness( base_priority ); + if (setpriority( PRIO_PROCESS, thread->unix_tid, niceness ) != 0) + fprintf( stderr, "wine: setpriority %d for pid %d failed: %d\n", niceness, thread->unix_tid, errno ); + return; + } +#endif +#endif +} + int set_thread_priority( struct thread *thread, int priority_class, int priority ) { int max = THREAD_PRIORITY_HIGHEST; @@ -699,6 +762,7 @@ int set_thread_priority( struct thread *thread, int priority_class, int priority return 0; thread->priority = priority; + apply_thread_priority( thread, priority_class, priority ); return 0; } From e2003d21cf32c21c475291802d0af1fd385cb0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 29 Nov 2023 23:20:41 +0300 Subject: [PATCH 0376/1506] server: Check wineserver privileges on init with -20 niceness. --- server/thread.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/thread.c b/server/thread.c index b0617eda41d..08742786b03 100644 --- a/server/thread.c +++ b/server/thread.c @@ -228,7 +228,14 @@ void init_threading(void) #ifdef __linux__ #ifdef RLIMIT_NICE struct rlimit rlimit; - if (!getrlimit( RLIMIT_NICE, &rlimit )) +#endif +#ifdef HAVE_SETPRIORITY + /* if wineserver has cap_sys_nice we are unlimited, but leave -20 to the user */ + if (!setpriority( PRIO_PROCESS, getpid(), -20 )) nice_limit = -19; + setpriority( PRIO_PROCESS, getpid(), 0 ); +#endif +#ifdef RLIMIT_NICE + if (!nice_limit && !getrlimit( RLIMIT_NICE, &rlimit )) { rlimit.rlim_cur = rlimit.rlim_max; setrlimit( RLIMIT_NICE, &rlimit ); From 8a75c57f6e9858e253a09f9a5401605097e1e069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Dec 2023 17:27:46 +0100 Subject: [PATCH 0377/1506] HACK: wineboot: Print more information when TSC calibration fails. --- programs/wineboot/wineboot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 2a8f2edb141..30a930ed281 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -332,7 +332,13 @@ static UINT64 read_tsc_frequency(void) } while (error > 500 && --retries); - if (!retries) WARN( "TSC frequency calibration failed, unstable TSC?\n" ); + if (!retries) + { + FIXME( "TSC frequency calibration failed, unstable TSC?"); + FIXME( "time0 %I64u ns, time1 %I64u ns\n", time0 * 100, time1 * 100 ); + FIXME( "tsc2 - tsc0 %I64u, tsc3 - tsc1 %I64u\n", tsc2 - tsc0, tsc3 - tsc1 ); + FIXME( "freq0 %I64u Hz, freq2 %I64u Hz, error %I64u ppm\n", freq0, freq1, error ); + } else { freq = (freq0 + freq1) / 2; From 1795fe5a115f3ae6f7f927e10dfbf04bae03ee53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 29 Jun 2023 14:36:32 +0200 Subject: [PATCH 0378/1506] winhttp: Move connect end checks out of the loop. This is only done when InitializeSecurityContextW returns SEC_E_OK, which will break out of the loop, and the checks forcefully break out of the loop if any failed. CW-Bug-Id: #18449 CW-Bug-Id: #22371 --- dlls/winhttp/net.c | 80 ++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index e46f2023fae..784a07116b1 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -387,60 +387,58 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur status = InitializeSecurityContextW(cred_handle, &ctx, hostname, isc_req_flags, 0, 0, &in_desc, 0, NULL, &out_desc, &attrs, NULL); TRACE( "InitializeSecurityContext ret %#lx\n", status ); + if(status == SEC_E_OK && in_bufs[1].BufferType == SECBUFFER_EXTRA) + FIXME("SECBUFFER_EXTRA not supported\n"); + } - if(status == SEC_E_OK) { - if(in_bufs[1].BufferType == SECBUFFER_EXTRA) - FIXME("SECBUFFER_EXTRA not supported\n"); - - status = QueryContextAttributesW(&ctx, SECPKG_ATTR_STREAM_SIZES, &conn->ssl_sizes); - if(status != SEC_E_OK) { - WARN("Could not get sizes\n"); - break; - } + free(read_buf); - status = QueryContextAttributesW(&ctx, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (void*)&cert); - if(status == SEC_E_OK) { - res = netconn_verify_cert(cert, hostname, security_flags, check_revocation); - CertFreeCertificateContext(cert); - if(res != ERROR_SUCCESS) { - WARN( "cert verify failed: %lu\n", res ); - break; - } - }else { - WARN("Could not get cert\n"); - break; - } + if(status != SEC_E_OK || res != ERROR_SUCCESS) + goto failed; - conn->ssl_read_buf = malloc(conn->ssl_sizes.cbHeader + conn->ssl_sizes.cbMaximumMessage + conn->ssl_sizes.cbTrailer); - if(!conn->ssl_read_buf) { - res = ERROR_OUTOFMEMORY; - break; - } - conn->ssl_write_buf = malloc(conn->ssl_sizes.cbHeader + conn->ssl_sizes.cbMaximumMessage + conn->ssl_sizes.cbTrailer); - if(!conn->ssl_write_buf) { - res = ERROR_OUTOFMEMORY; - break; - } - } + status = QueryContextAttributesW(&ctx, SECPKG_ATTR_STREAM_SIZES, &conn->ssl_sizes); + if(status != SEC_E_OK) { + WARN("Could not get sizes\n"); + goto failed; } - free(read_buf); + status = QueryContextAttributesW(&ctx, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (void*)&cert); + if(status != SEC_E_OK) { + WARN("Could not get cert\n"); + goto failed; + } - if(status != SEC_E_OK || res != ERROR_SUCCESS) { - WARN( "Failed to initialize security context: %#lx\n", status ); - free(conn->ssl_read_buf); - conn->ssl_read_buf = NULL; - free(conn->ssl_write_buf); - conn->ssl_write_buf = NULL; - DeleteSecurityContext(&ctx); - return ERROR_WINHTTP_SECURE_CHANNEL_ERROR; + res = netconn_verify_cert(cert, hostname, security_flags, check_revocation); + CertFreeCertificateContext(cert); + if(res != ERROR_SUCCESS) { + WARN( "cert verify failed: %lu\n", res ); + goto failed; } + conn->ssl_read_buf = malloc(conn->ssl_sizes.cbHeader + conn->ssl_sizes.cbMaximumMessage + conn->ssl_sizes.cbTrailer); + if(!conn->ssl_read_buf) { + res = ERROR_OUTOFMEMORY; + goto failed; + } + conn->ssl_write_buf = malloc(conn->ssl_sizes.cbHeader + conn->ssl_sizes.cbMaximumMessage + conn->ssl_sizes.cbTrailer); + if(!conn->ssl_write_buf) { + res = ERROR_OUTOFMEMORY; + goto failed; + } TRACE("established SSL connection\n"); conn->secure = TRUE; conn->ssl_ctx = ctx; return ERROR_SUCCESS; + +failed: + WARN( "Failed to initialize security context: %#lx\n", status ); + free(conn->ssl_read_buf); + conn->ssl_read_buf = NULL; + free(conn->ssl_write_buf); + conn->ssl_write_buf = NULL; + DeleteSecurityContext(&ctx); + return ERROR_WINHTTP_SECURE_CHANNEL_ERROR; } static DWORD send_ssl_chunk( struct netconn *conn, const void *msg, size_t size, WSAOVERLAPPED *ovr ) From 2c08a30f699c9f540b441cece363522c6266b77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 29 Jun 2023 14:39:06 +0200 Subject: [PATCH 0379/1506] winhttp: Introduce new netconn_negotiate helper. CW-Bug-Id: #18449 CW-Bug-Id: #22371 --- dlls/winhttp/net.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index 784a07116b1..c2964c8fb16 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -306,28 +306,24 @@ void netconn_release( struct netconn *conn ) free(conn); } -DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD security_flags, CredHandle *cred_handle, - BOOL check_revocation ) +static DWORD netconn_negotiate( struct netconn *conn, WCHAR *hostname, CredHandle *cred_handle, + CtxtHandle *ctx ) { SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}, in_bufs[2] = {{0, SECBUFFER_TOKEN}, {0, SECBUFFER_EMPTY}}; SecBufferDesc out_desc = {SECBUFFER_VERSION, 1, &out_buf}, in_desc = {SECBUFFER_VERSION, 2, in_bufs}; BYTE *read_buf; SIZE_T read_buf_size = 2048; ULONG attrs = 0; - CtxtHandle ctx; SSIZE_T size; - const CERT_CONTEXT *cert; SECURITY_STATUS status; - DWORD res = ERROR_SUCCESS; const DWORD isc_req_flags = ISC_REQ_ALLOCATE_MEMORY|ISC_REQ_USE_SESSION_KEY|ISC_REQ_CONFIDENTIALITY |ISC_REQ_SEQUENCE_DETECT|ISC_REQ_REPLAY_DETECT|ISC_REQ_MANUAL_CRED_VALIDATION; if (!(read_buf = malloc( read_buf_size ))) return ERROR_OUTOFMEMORY; - memset( &ctx, 0, sizeof(ctx) ); status = InitializeSecurityContextW(cred_handle, NULL, hostname, isc_req_flags, 0, 0, NULL, 0, - &ctx, &out_desc, &attrs, NULL); + ctx, &out_desc, &attrs, NULL); assert(status != SEC_E_OK); @@ -340,7 +336,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur size = sock_send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, NULL); if(size != out_buf.cbBuffer) { ERR("send failed\n"); - res = ERROR_WINHTTP_SECURE_CHANNEL_ERROR; + status = ERROR_WINHTTP_SECURE_CHANNEL_ERROR; break; } @@ -384,7 +380,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur in_bufs[0].cbBuffer += size; in_bufs[0].pvBuffer = read_buf; - status = InitializeSecurityContextW(cred_handle, &ctx, hostname, isc_req_flags, 0, 0, &in_desc, + status = InitializeSecurityContextW(cred_handle, ctx, hostname, isc_req_flags, 0, 0, &in_desc, 0, NULL, &out_desc, &attrs, NULL); TRACE( "InitializeSecurityContext ret %#lx\n", status ); if(status == SEC_E_OK && in_bufs[1].BufferType == SECBUFFER_EXTRA) @@ -393,6 +389,18 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur free(read_buf); + return status; +} + +DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD security_flags, CredHandle *cred_handle, + BOOL check_revocation ) +{ + CtxtHandle ctx = {0}; + const CERT_CONTEXT *cert; + SECURITY_STATUS status; + DWORD res = ERROR_SUCCESS; + + status = netconn_negotiate(conn, hostname, cred_handle, &ctx); if(status != SEC_E_OK || res != ERROR_SUCCESS) goto failed; From 7e4170f86751ef98c8132f6c64627a8199266522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 29 Jun 2023 16:01:39 +0200 Subject: [PATCH 0380/1506] winhttp: Handle SEC_I_RENEGOTIATE after DecryptMessage. By performing renegotiation as we should, instead of incorrectly returning ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED. MSDN says we should pass returned SECBUFFER_EXTRA as SECBUFFER_TOKEN, so we also do that, although it's usually empty. CW-Bug-Id: #18449 CW-Bug-Id: #22371 --- dlls/winhttp/net.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index c2964c8fb16..695b370a810 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -307,7 +307,7 @@ void netconn_release( struct netconn *conn ) } static DWORD netconn_negotiate( struct netconn *conn, WCHAR *hostname, CredHandle *cred_handle, - CtxtHandle *ctx ) + CtxtHandle *prev_ctx, SecBufferDesc *prev_buf, CtxtHandle *ctx ) { SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}, in_bufs[2] = {{0, SECBUFFER_TOKEN}, {0, SECBUFFER_EMPTY}}; SecBufferDesc out_desc = {SECBUFFER_VERSION, 1, &out_buf}, in_desc = {SECBUFFER_VERSION, 2, in_bufs}; @@ -322,8 +322,9 @@ static DWORD netconn_negotiate( struct netconn *conn, WCHAR *hostname, CredHandl if (!(read_buf = malloc( read_buf_size ))) return ERROR_OUTOFMEMORY; - status = InitializeSecurityContextW(cred_handle, NULL, hostname, isc_req_flags, 0, 0, NULL, 0, + status = InitializeSecurityContextW(cred_handle, prev_ctx, hostname, isc_req_flags, 0, 0, prev_buf, 0, ctx, &out_desc, &attrs, NULL); + if (!ctx) ctx = prev_ctx; assert(status != SEC_E_OK); @@ -400,7 +401,7 @@ DWORD netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD secur SECURITY_STATUS status; DWORD res = ERROR_SUCCESS; - status = netconn_negotiate(conn, hostname, cred_handle, &ctx); + status = netconn_negotiate(conn, hostname, cred_handle, NULL, NULL, &ctx); if(status != SEC_E_OK || res != ERROR_SUCCESS) goto failed; @@ -561,8 +562,23 @@ static DWORD read_ssl_chunk( struct netconn *conn, void *buf, SIZE_T buf_size, S break; case SEC_I_RENEGOTIATE: + { + SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}; + SecBufferDesc out_desc = {SECBUFFER_VERSION, 1, &out_buf}; + TRACE("renegotiate\n"); - return ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED; + + for(i = 0; i < ARRAY_SIZE(bufs); i++) { + if(bufs[i].BufferType == SECBUFFER_EXTRA) { + out_buf.cbBuffer = bufs[i].cbBuffer; + out_buf.pvBuffer = bufs[i].pvBuffer; + } + } + + res = netconn_negotiate(conn, conn->host->hostname, NULL, &conn->ssl_ctx, &out_desc, NULL); + if (res != SEC_E_OK) return res; + continue; + } case SEC_I_CONTEXT_EXPIRED: TRACE("context expired\n"); From 188a2fa3f9ac590c2fef9f7215fb4e6869a1e2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Dec 2023 17:29:39 +0100 Subject: [PATCH 0381/1506] secur32: Perform TLS re-handshake after SEC_I_RENEGOTIATE was returned. Even if input buffer is empty, as this is often the case. CW-Bug-Id: #18449 CW-Bug-Id: #22371 --- dlls/secur32/schannel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index d2e4a07fa23..66b5f587644 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -65,6 +65,7 @@ struct schan_context enum control_token control_token; unsigned int alert_type; unsigned int alert_number; + BOOL rehandshake_requested; }; static struct schan_handle *schan_handle_table; @@ -897,7 +898,7 @@ static SECURITY_STATUS establish_context( buffer = &pInput->pBuffers[idx]; ptr = buffer->pvBuffer; - if (buffer->cbBuffer < ctx->header_size) + if (buffer->cbBuffer < ctx->header_size && !ctx->rehandshake_requested) { TRACE("Expected at least %Iu bytes, but buffer only contains %lu bytes.\n", ctx->header_size, buffer->cbBuffer); @@ -914,7 +915,7 @@ static SECURITY_STATUS establish_context( ptr += record_size; } - if (!expected_size) + if (!expected_size && !ctx->rehandshake_requested) { TRACE("Expected at least %Iu bytes, but buffer only contains %lu bytes.\n", max(ctx->header_size, record_size), buffer->cbBuffer); @@ -966,6 +967,7 @@ static SECURITY_STATUS establish_context( params.alert_type = ctx->alert_type; params.alert_number = ctx->alert_number; ctx->control_token = CONTROL_TOKEN_NONE; + ctx->rehandshake_requested = FALSE; ret = GNUTLS_CALL( handshake, ¶ms ); if (output_buffer_idx != -1) @@ -1568,6 +1570,7 @@ static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle buffer->BufferType = SECBUFFER_STREAM_HEADER; buffer->cbBuffer = ctx->header_size; + if (status == SEC_I_RENEGOTIATE) ctx->rehandshake_requested = TRUE; return status; } From 2a67a25a35b660811dc284bc678066bca0bd0365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 25 Oct 2023 17:24:56 +0200 Subject: [PATCH 0382/1506] dmime: Implement IDirectMusicTrack_EndPlay for wave track. CW-Bug-Id: #16680 CW-Bug-Id: #20424 CW-Bug-Id: #22409 --- dlls/dmime/wavetrack.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/dmime/wavetrack.c b/dlls/dmime/wavetrack.c index 7f2fe4a8e5f..3dabbc645e6 100644 --- a/dlls/dmime/wavetrack.c +++ b/dlls/dmime/wavetrack.c @@ -139,7 +139,20 @@ static HRESULT WINAPI wave_track_InitPlay(IDirectMusicTrack8 *iface, static HRESULT WINAPI wave_track_EndPlay(IDirectMusicTrack8 *iface, void *pStateData) { struct wave_track *This = impl_from_IDirectMusicTrack8(iface); + struct wave_part *part; + struct wave_item *item; + FIXME("(%p, %p): stub\n", This, pStateData); + + LIST_FOR_EACH_ENTRY(part, &This->parts, struct wave_part, entry) + { + LIST_FOR_EACH_ENTRY(item, &part->items, struct wave_item, entry) + { + if (!item->buffer) continue; + IDirectSoundBuffer_Stop(item->buffer); + } + } + return S_OK; } From bd3c09a036f8ec906e9c74dc8ad380d4bf090261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 26 Oct 2023 14:19:31 +0200 Subject: [PATCH 0383/1506] dmime: Stop previously playing primary segment in PlaySegmentEx. CW-Bug-Id: #16680 CW-Bug-Id: #20424 CW-Bug-Id: #22409 --- dlls/dmime/performance.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index bd596750f34..666e50787e3 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -1583,6 +1583,13 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface, if (FAILED(hr = IUnknown_QueryInterface(source, &IID_IDirectMusicSegment, (void **)&segment))) return hr; + if (primary && SUCCEEDED(hr = IDirectMusicPerformance8_GetSegmentState(iface, &state, start_time))) + { + if (FAILED(hr = IDirectMusicPerformance_Stop(&This->IDirectMusicPerformance8_iface, NULL, state, start_time, 0))) + ERR("Failed to stop current previous segment, hr %#lx\n", hr); + IDirectMusicSegmentState_Release(state); + } + EnterCriticalSection(&This->safe); if (primary) performance_set_primary_segment(This, segment); From 48b13a0cbb406d7ecef4643ff556e4c18ebff853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 26 Oct 2023 14:26:41 +0200 Subject: [PATCH 0384/1506] HACK: dmime: Don't send segment end message for secondary segments. CW-Bug-Id: #16680 CW-Bug-Id: #20424 CW-Bug-Id: #22409 --- dlls/dmime/dmime_private.h | 2 +- dlls/dmime/performance.c | 2 +- dlls/dmime/segmentstate.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h index ed1589ece1a..4644e060828 100644 --- a/dlls/dmime/dmime_private.h +++ b/dlls/dmime/dmime_private.h @@ -72,7 +72,7 @@ extern void set_audiopath_perf_pointer(IDirectMusicAudioPath*,IDirectMusicPerfor extern void set_audiopath_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*); extern void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath*,IDirectSoundBuffer*); -extern HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time, +extern HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time, DWORD segment_flags, IDirectMusicPerformance8 *performance, IDirectMusicSegmentState **ret_iface); extern HRESULT segment_state_play(IDirectMusicSegmentState *iface, IDirectMusicPerformance8 *performance); extern HRESULT segment_state_tick(IDirectMusicSegmentState *iface, IDirectMusicPerformance8 *performance); diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 666e50787e3..ca425c90a75 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -1596,7 +1596,7 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface, if (control) performance_set_control_segment(This, segment); if ((!(music_time = start_time) && FAILED(hr = IDirectMusicPerformance8_GetTime(iface, NULL, &music_time))) - || FAILED(hr = segment_state_create(segment, music_time, iface, &state))) + || FAILED(hr = segment_state_create(segment, music_time, segment_flags, iface, &state))) { if (primary) performance_set_primary_segment(This, NULL); if (control) performance_set_control_segment(This, NULL); diff --git a/dlls/dmime/segmentstate.c b/dlls/dmime/segmentstate.c index 3b939bc95ca..fa6f2df098a 100644 --- a/dlls/dmime/segmentstate.c +++ b/dlls/dmime/segmentstate.c @@ -54,6 +54,7 @@ struct segment_state MUSIC_TIME played; BOOL auto_download; DWORD repeats; + DWORD flags; struct list tracks; }; @@ -106,7 +107,7 @@ static ULONG WINAPI segment_state_Release(IDirectMusicSegmentState8 *iface) if (!ref) { - segment_state_end_play((IDirectMusicSegmentState *)iface, NULL); + if (!(This->flags & DMUS_SEGF_SECONDARY)) segment_state_end_play((IDirectMusicSegmentState *)iface, NULL); if (This->segment) IDirectMusicSegment_Release(This->segment); free(This); } @@ -210,7 +211,7 @@ HRESULT create_dmsegmentstate(REFIID riid, void **ret_iface) return hr; } -HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time, +HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time, DWORD segment_flags, IDirectMusicPerformance8 *performance, IDirectMusicSegmentState **ret_iface) { IDirectMusicSegmentState *iface; @@ -224,6 +225,7 @@ HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time if (FAILED(hr = create_dmsegmentstate(&IID_IDirectMusicSegmentState, (void **)&iface))) return hr; This = impl_from_IDirectMusicSegmentState8((IDirectMusicSegmentState8 *)iface); + This->flags = segment_flags; This->segment = segment; IDirectMusicSegment_AddRef(This->segment); @@ -319,6 +321,7 @@ static HRESULT segment_state_play_chunk(struct segment_state *This, IDirectMusic { MUSIC_TIME end_time = This->start_time + This->played; + if (This->flags & DMUS_SEGF_SECONDARY) return S_OK; if (FAILED(hr = performance_send_segment_end(performance, end_time, iface, FALSE))) { ERR("Failed to send segment end, hr %#lx\n", hr); From 18a494ea68997642fff44f9f965e3c1148558644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 20 Apr 2021 11:08:53 +0200 Subject: [PATCH 0385/1506] HACK: user32: Disable layered windows support for Zombie Army 4. CW-Bug-Id: 18691 --- dlls/win32u/window.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index bb02898e90d..9da201e427f 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1234,6 +1234,7 @@ static HWND set_window_owner( HWND hwnd, HWND owner ) /* Helper function for SetWindowLong(). */ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOOL ansi ) { + const char *sgi = getenv( "SteamGameId" ); BOOL ok, made_visible = FALSE; LONG_PTR retval = 0; STYLESTRUCT style; @@ -1289,6 +1290,8 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO if (win->dwStyle & WS_MINIMIZE) newval |= WS_MINIMIZE; break; case GWL_EXSTYLE: + /* FIXME: Layered windows don't work well right now, disable them */ + if (sgi && !strcmp( sgi, "694280" )) newval &= ~WS_EX_LAYERED; style.styleOld = win->dwExStyle; style.styleNew = newval; release_win_ptr( win ); From 5a7bc8a7249bead68039af2c667aa6dd17148899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 20 Apr 2021 19:37:22 +0200 Subject: [PATCH 0386/1506] HACK: user32: Disable layered windows for Strange Brigade. CW-Bug-Id: 18691 --- dlls/win32u/window.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 9da201e427f..c235c1e89eb 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1292,6 +1292,7 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO case GWL_EXSTYLE: /* FIXME: Layered windows don't work well right now, disable them */ if (sgi && !strcmp( sgi, "694280" )) newval &= ~WS_EX_LAYERED; + if (sgi && !strcmp( sgi, "312670" )) newval &= ~WS_EX_LAYERED; style.styleOld = win->dwExStyle; style.styleNew = newval; release_win_ptr( win ); From 1e2d6e2101b852b64113a6faaffb196d88b412e3 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 28 Apr 2021 14:32:04 -0500 Subject: [PATCH 0387/1506] HACK: user32: Disable layered windows for Evil Genius 2. CW-Bug-Id: 18691 --- dlls/win32u/window.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index c235c1e89eb..e563076171e 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1293,6 +1293,7 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO /* FIXME: Layered windows don't work well right now, disable them */ if (sgi && !strcmp( sgi, "694280" )) newval &= ~WS_EX_LAYERED; if (sgi && !strcmp( sgi, "312670" )) newval &= ~WS_EX_LAYERED; + if (sgi && !strcmp( sgi, "700600" )) newval &= ~WS_EX_LAYERED; style.styleOld = win->dwExStyle; style.styleNew = newval; release_win_ptr( win ); From ae22950f9ba0b381b72846f088bf98126bc6dfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 16 Nov 2021 21:41:28 +0100 Subject: [PATCH 0388/1506] HACK: mscoree: Build a dummy CameraQuakeViewer.dll for Nights of Azure. The game references types from a non-existing DLL, and Mono cannot be taught to handle it easily. This is an ugly hack to make sure the load succeeds. CW-Bug-Id: #19046 --- dlls/mscoree/metahost.c | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index bb7e10ca0bf..50927f62234 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -1723,6 +1723,44 @@ static MonoAssembly* mono_assembly_try_load(WCHAR *path) return result; } +static BOOL compile_assembly(const char *source, const char *target, char *target_path, DWORD target_path_len) +{ + static const char *csc = "C:\\windows\\Microsoft.NET\\Framework\\v2.0.50727\\csc.exe"; + char cmdline[2 * MAX_PATH + 74], tmp[MAX_PATH], tmpdir[MAX_PATH], source_path[MAX_PATH]; + STARTUPINFOA si = {.cb = sizeof(STARTUPINFOA)}; + PROCESS_INFORMATION pi; + HANDLE file; + DWORD size; + BOOL ret; + LUID id; + + if (!PathFileExistsA(csc)) return FALSE; + if (!AllocateLocallyUniqueId(&id)) return FALSE; + + GetTempPathA(MAX_PATH, tmp); + if (!GetTempFileNameA(tmp, "assembly", id.LowPart, tmpdir)) return FALSE; + if (!CreateDirectoryA(tmpdir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) return FALSE; + + snprintf(source_path, MAX_PATH, "%s\\source.cs", tmpdir); + snprintf(target_path, target_path_len, "%s\\%s", tmpdir, target); + + file = CreateFileA(source_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + if (file == INVALID_HANDLE_VALUE) return FALSE; + ret = WriteFile(file, source, strlen(source), &size, NULL); + CloseHandle(file); + if (!ret) return FALSE; + + snprintf(cmdline, ARRAY_SIZE(cmdline), "%s /t:library /out:\"%s\" \"%s\"", csc, target_path, source_path); + ret = CreateProcessA(csc, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + if (!ret) return FALSE; + + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + return PathFileExistsA(target_path); +} + static MonoAssembly* CDECL mono_assembly_preload_hook_fn(MonoAssemblyName *aname, char **assemblies_path, void *user_data) { int flags = 0; @@ -1811,6 +1849,30 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam } } + if (!strcmp(assemblyname, "CameraQuakeViewer")) + { + /* HACK for Nights of Azure which references type from a non-existing DLL. + * Native .NET framework normally gets away with it but Mono cannot + * due to some deeply rooted differences. */ + const char* sgi = getenv("SteamGameId"); + if (sgi && !strcmp(sgi, "527280")) + { + char assembly_path[MAX_PATH]; + + FIXME("HACK: Building CameraQuakeViewer.dll\n"); + + if (compile_assembly("namespace CQViewer { class CQMgr {} }", "CameraQuakeViewer.dll", assembly_path, MAX_PATH)) + result = mono_assembly_open(assembly_path, &stat); + else + ERR("HACK: Failed to build CameraQuakeViewer.dll\n"); + + if (result) + goto done; + else + ERR("HACK: Failed to load CameraQuakeViewer.dll\n"); + } + } + if ((search_flags & ASSEMBLY_SEARCH_GAC) != 0) { stringnameW_size = MultiByteToWideChar(CP_UTF8, 0, stringname, -1, NULL, 0); From 6229fd6759e67f5efcd9d5b5d15ff8eb5cfc1c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 14 Dec 2022 21:57:01 +0100 Subject: [PATCH 0389/1506] HACK: ntdll: Set LIBGL_ALWAYS_SOFTWARE for Witcher 3 (Launcher). CW-Bug-Id: #21699 --- dlls/ntdll/unix/loader.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index d3f3321b199..dd30c79f755 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1940,6 +1940,11 @@ static void hacks_init(void) ERR("HACK: setting WINE_ENABLE_GST_LIVE_LATENCY.\n"); setenv("WINE_ENABLE_GST_LIVE_LATENCY", "1", 0); } + if (sgi && !strcmp(sgi, "292030")) + { + ERR("HACK: setting LIBGL_ALWAYS_SOFTWARE.\n"); + setenv("LIBGL_ALWAYS_SOFTWARE", "1", 0); + } } /*********************************************************************** From d686dcec82ee78493358688b3e1b5979b6cd8f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 16 Jun 2021 17:36:15 +0200 Subject: [PATCH 0390/1506] devenum: Register IEEE float for Direct Sound default device. Fixes some music does not play in Planet Coaster. CW-Bug-Id: #18986 --- dlls/devenum/createdevenum.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index bc91b235804..16a2dcc565b 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -473,7 +473,7 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons static const WCHAR defaultW[] = L"Default DirectSound Device"; IPropertyBag *prop_bag = NULL; REGFILTERPINS2 rgpins = {0}; - REGPINTYPES rgtypes = {0}; + REGPINTYPES rgtypes[2] = {}; REGFILTER2 rgf = {0}; WCHAR clsid[CHARS_IN_GUID]; VARIANT var; @@ -504,10 +504,12 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons rgf.rgPins2 = &rgpins; rgpins.dwFlags = REG_PINFLAG_B_RENDERER; /* FIXME: native registers many more formats */ - rgpins.nMediaTypes = 1; - rgpins.lpMediaType = &rgtypes; - rgtypes.clsMajorType = &MEDIATYPE_Audio; - rgtypes.clsMinorType = &MEDIASUBTYPE_PCM; + rgpins.nMediaTypes = 2; + rgpins.lpMediaType = rgtypes; + rgtypes[0].clsMajorType = &MEDIATYPE_Audio; + rgtypes[0].clsMinorType = &MEDIASUBTYPE_PCM; + rgtypes[1].clsMajorType = &MEDIATYPE_Audio; + rgtypes[1].clsMinorType = &MEDIASUBTYPE_IEEE_FLOAT; write_filter_data(prop_bag, &rgf); From 42fdb739e7deeef663ed38de6398848422194917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 15 Dec 2022 23:28:52 +0100 Subject: [PATCH 0391/1506] dsound: Initialize primary buffer with device's channel layout Fixes surround sound in some games, like Borderlands GOTY and Dead Space. --- dlls/dsound/dsound.c | 77 +----------------------------------- dlls/dsound/dsound_private.h | 1 - dlls/dsound/primary.c | 75 ++++++++++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 77 deletions(-) diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index b35f9c7cbdd..b1c0c76c367 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -23,7 +23,6 @@ #include #include #include -#include #define COBJMACROS @@ -137,9 +136,9 @@ static HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice) device->ref = 1; device->priolevel = DSSCL_NORMAL; device->stopped = 1; - device->speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, DSSPEAKER_GEOMETRY_WIDE); - DSOUND_ParseSpeakerConfig(device); + device->speaker_config = 0; + device->num_speakers = 0; /* 3D listener initial parameters */ device->ds3dl.dwSize = sizeof(DS3DLISTENER); @@ -1122,75 +1121,3 @@ HRESULT WINAPI DirectSoundCreate8( return hr; } - -void DSOUND_ParseSpeakerConfig(DirectSoundDevice *device) -{ - switch (DSSPEAKER_CONFIG(device->speaker_config)) { - case DSSPEAKER_MONO: - device->speaker_angles[0] = M_PI/180.0f * 0.0f; - device->speaker_num[0] = 0; - device->num_speakers = 1; - device->lfe_channel = -1; - break; - - case DSSPEAKER_STEREO: - case DSSPEAKER_HEADPHONE: - device->speaker_angles[0] = M_PI/180.0f * -90.0f; - device->speaker_angles[1] = M_PI/180.0f * 90.0f; - device->speaker_num[0] = 0; /* Left */ - device->speaker_num[1] = 1; /* Right */ - device->num_speakers = 2; - device->lfe_channel = -1; - break; - - case DSSPEAKER_QUAD: - device->speaker_angles[0] = M_PI/180.0f * -135.0f; - device->speaker_angles[1] = M_PI/180.0f * -45.0f; - device->speaker_angles[2] = M_PI/180.0f * 45.0f; - device->speaker_angles[3] = M_PI/180.0f * 135.0f; - device->speaker_num[0] = 2; /* Rear left */ - device->speaker_num[1] = 0; /* Front left */ - device->speaker_num[2] = 1; /* Front right */ - device->speaker_num[3] = 3; /* Rear right */ - device->num_speakers = 4; - device->lfe_channel = -1; - break; - - case DSSPEAKER_5POINT1_BACK: - device->speaker_angles[0] = M_PI/180.0f * -135.0f; - device->speaker_angles[1] = M_PI/180.0f * -45.0f; - device->speaker_angles[2] = M_PI/180.0f * 0.0f; - device->speaker_angles[3] = M_PI/180.0f * 45.0f; - device->speaker_angles[4] = M_PI/180.0f * 135.0f; - device->speaker_angles[5] = 9999.0f; - device->speaker_num[0] = 4; /* Rear left */ - device->speaker_num[1] = 0; /* Front left */ - device->speaker_num[2] = 2; /* Front centre */ - device->speaker_num[3] = 1; /* Front right */ - device->speaker_num[4] = 5; /* Rear right */ - device->speaker_num[5] = 3; /* LFE */ - device->num_speakers = 6; - device->lfe_channel = 3; - break; - - case DSSPEAKER_5POINT1_SURROUND: - device->speaker_angles[0] = M_PI/180.0f * -90.0f; - device->speaker_angles[1] = M_PI/180.0f * -30.0f; - device->speaker_angles[2] = M_PI/180.0f * 0.0f; - device->speaker_angles[3] = M_PI/180.0f * 30.0f; - device->speaker_angles[4] = M_PI/180.0f * 90.0f; - device->speaker_angles[5] = 9999.0f; - device->speaker_num[0] = 4; /* Rear left */ - device->speaker_num[1] = 0; /* Front left */ - device->speaker_num[2] = 2; /* Front centre */ - device->speaker_num[3] = 1; /* Front right */ - device->speaker_num[4] = 5; /* Rear right */ - device->speaker_num[5] = 3; /* LFE */ - device->num_speakers = 6; - device->lfe_channel = 3; - break; - - default: - WARN("unknown speaker_config %lu\n", device->speaker_config); - } -} diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 34498125317..c79cb565373 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -208,7 +208,6 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, void **ppv); HRESULT DSOUND_Create(REFIID riid, void **ppv); HRESULT DSOUND_Create8(REFIID riid, void **ppv); HRESULT IDirectSoundImpl_Create(IUnknown *outer_unk, REFIID riid, void **ppv, BOOL has_ds8); -void DSOUND_ParseSpeakerConfig(DirectSoundDevice *device); /* primary.c */ diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 2e2473b4db2..8cfcd1d8a28 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -24,6 +24,7 @@ */ #include +#include #define COBJMACROS #include "windef.h" @@ -107,6 +108,78 @@ static DWORD DSOUND_FindSpeakerConfig(IMMDevice *mmdevice, int channels) return def; } +static void DSOUND_ParseSpeakerConfig(DirectSoundDevice *device) +{ + switch (DSSPEAKER_CONFIG(device->speaker_config)) { + case DSSPEAKER_MONO: + device->speaker_angles[0] = M_PI/180.0f * 0.0f; + device->speaker_num[0] = 0; + device->num_speakers = 1; + device->lfe_channel = -1; + break; + + case DSSPEAKER_STEREO: + case DSSPEAKER_HEADPHONE: + device->speaker_angles[0] = M_PI/180.0f * -90.0f; + device->speaker_angles[1] = M_PI/180.0f * 90.0f; + device->speaker_num[0] = 0; /* Left */ + device->speaker_num[1] = 1; /* Right */ + device->num_speakers = 2; + device->lfe_channel = -1; + break; + + case DSSPEAKER_QUAD: + device->speaker_angles[0] = M_PI/180.0f * -135.0f; + device->speaker_angles[1] = M_PI/180.0f * -45.0f; + device->speaker_angles[2] = M_PI/180.0f * 45.0f; + device->speaker_angles[3] = M_PI/180.0f * 135.0f; + device->speaker_num[0] = 2; /* Rear left */ + device->speaker_num[1] = 0; /* Front left */ + device->speaker_num[2] = 1; /* Front right */ + device->speaker_num[3] = 3; /* Rear right */ + device->num_speakers = 4; + device->lfe_channel = -1; + break; + + case DSSPEAKER_5POINT1_BACK: + device->speaker_angles[0] = M_PI/180.0f * -135.0f; + device->speaker_angles[1] = M_PI/180.0f * -45.0f; + device->speaker_angles[2] = M_PI/180.0f * 0.0f; + device->speaker_angles[3] = M_PI/180.0f * 45.0f; + device->speaker_angles[4] = M_PI/180.0f * 135.0f; + device->speaker_angles[5] = 9999.0f; + device->speaker_num[0] = 4; /* Rear left */ + device->speaker_num[1] = 0; /* Front left */ + device->speaker_num[2] = 2; /* Front centre */ + device->speaker_num[3] = 1; /* Front right */ + device->speaker_num[4] = 5; /* Rear right */ + device->speaker_num[5] = 3; /* LFE */ + device->num_speakers = 6; + device->lfe_channel = 3; + break; + + case DSSPEAKER_5POINT1_SURROUND: + device->speaker_angles[0] = M_PI/180.0f * -90.0f; + device->speaker_angles[1] = M_PI/180.0f * -30.0f; + device->speaker_angles[2] = M_PI/180.0f * 0.0f; + device->speaker_angles[3] = M_PI/180.0f * 30.0f; + device->speaker_angles[4] = M_PI/180.0f * 90.0f; + device->speaker_angles[5] = 9999.0f; + device->speaker_num[0] = 4; /* Rear left */ + device->speaker_num[1] = 0; /* Front left */ + device->speaker_num[2] = 2; /* Front centre */ + device->speaker_num[3] = 1; /* Front right */ + device->speaker_num[4] = 5; /* Rear right */ + device->speaker_num[5] = 3; /* LFE */ + device->num_speakers = 6; + device->lfe_channel = 3; + break; + + default: + WARN("unknown speaker_config %lu\n", device->speaker_config); + } +} + static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client, BOOL forcewave, WAVEFORMATEX **wfx) { @@ -121,7 +194,7 @@ static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client if (FAILED(hr)) return hr; - if (mixwfe->Format.nChannels < device->num_speakers) { + if (device->num_speakers == 0 || mixwfe->Format.nChannels < device->num_speakers) { device->speaker_config = DSOUND_FindSpeakerConfig(device->mmdevice, mixwfe->Format.nChannels); DSOUND_ParseSpeakerConfig(device); } else if (mixwfe->Format.nChannels > device->num_speakers) { From aeb1a99187c39b2ddfc9fceda325599021fa6a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 5 Apr 2023 12:38:11 +0200 Subject: [PATCH 0392/1506] ddraw: Remove topmost from the previous window when releasing exclusive cooperative level. Fixes The Binding of Isaac staying topmost, regression after upstream commit e44afcd8bf17eb628fcb1ea0b012970b6e611da4. Note: this is possibly a hack and maybe we should use exclusive_window instead, but it is cleared when focus is lost in device_parent_activate, and removing topmost there as well is a bigger, riskier change. CW-Bug-Id: #22108 --- dlls/ddraw/ddraw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 5887854556b..8603f4a1113 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -978,7 +978,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window, topmost bit unless the DDSCL_NOWINDOWCHANGES flag is set in this call that sets it to normal, not in the old coop level. */ if (!(cooplevel & DDSCL_NOWINDOWCHANGES)) - SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(ddraw->dest_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); if (restore_mode_on_normal && FAILED(ddraw7_RestoreDisplayMode(&ddraw->IDirectDraw7_iface))) ERR("RestoreDisplayMode failed\n"); From 12967662f7b4f94de2a453b32b8b3c7e5fdf8ecb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 Jul 2022 20:01:17 -0500 Subject: [PATCH 0393/1506] win32u: Don't load bitmap only TTF fonts without bitmap table. CW-Bug-Id: #20934 --- dlls/win32u/freetype.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/freetype.c b/dlls/win32u/freetype.c index 701e15c110d..f6f2f8ac702 100644 --- a/dlls/win32u/freetype.c +++ b/dlls/win32u/freetype.c @@ -256,6 +256,8 @@ MAKE_FUNCPTR(FcStrSetMember); #define GET_BE_DWORD(x) RtlUlongByteSwap(x) #endif +#define MS_EBDT_TAG MS_MAKE_TAG('E','B','D','T') + /* 'gasp' flags */ #define GASP_GRIDFIT 0x01 #define GASP_DOGRAY 0x02 @@ -1179,6 +1181,8 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr struct stat st; DWORD face_count; int fd, length; + FT_Error error; + FT_ULong len; TRACE( "unix_name %s, face_index %u, data_ptr %p, data_size %u, flags %#x\n", unix_name, face_index, data_ptr, data_size, flags ); @@ -1270,7 +1274,20 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr This->ntm_flags = get_ntm_flags( This->ft_face ); This->font_version = get_font_version( This->ft_face ); - if (!This->scalable) get_bitmap_size( This->ft_face, &This->size ); + if (!This->scalable) + { + error = pFT_Load_Sfnt_Table( This->ft_face, RtlUlongByteSwap(MS_EBDT_TAG), 0, NULL, &len ); + if (error == FT_Err_Table_Missing) + { + WARN( "EBDT table is missing in bitmap only font %s.\n", + debugstr_w(ft_face_get_family_name( This->ft_face, system_lcid ))); + pFT_Done_Face( This->ft_face ); + free( This ); + This = NULL; + goto done; + } + get_bitmap_size( This->ft_face, &This->size ); + } get_fontsig( This->ft_face, &This->fs ); } else From 70570b8cdcf3d35b2c6dcd7a5311190162360fee Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 24 Jun 2021 17:27:08 +0200 Subject: [PATCH 0394/1506] HACK: win32u/font: Support font linking for Arial and Courier New. This helps the Rockstar installer to fallback to appropriate fonts for CJK languages. CW-Bug-Id: #18969 CW-Bug-Id: #19917 --- dlls/win32u/font.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index af1a9b97f67..c5cf09f56f7 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -1556,6 +1556,14 @@ static const WCHAR ms_minchoW[] = {'M','S',' ','M','i','n','c','h','o',0}; static const WCHAR ms_p_minchoW[] = {'M','S',' ','P','M','i','n','c','h','o',0}; +static const WCHAR arialW[] = + {'A','r','i','a','l',0}; +static const WCHAR arial_boldW[] = + {'A','r','i','a','l',' ','B','o','l','d',0}; +static const WCHAR courier_newW[] = + {'C','o','u','r','i','e','r',' ','N','e','w',0}; +static const WCHAR courier_new_boldW[] = + {'C','o','u','r','i','e','r',' ','N','e','w',' ','B','o','l','d',0}; static const WCHAR * const font_links_list[] = { @@ -3098,6 +3106,10 @@ static void update_font_system_link_info(void) } set_multi_value_key(hkey, link_reg->font_name, link, len); } + set_multi_value_key(hkey, arialW, link, len); + set_multi_value_key(hkey, arial_boldW, link, len); + set_multi_value_key(hkey, courier_newW, link, len); + set_multi_value_key(hkey, courier_new_boldW, link, len); NtClose( hkey ); } } @@ -3136,7 +3148,13 @@ static void update_codepage( UINT screen_dpi ) if (query_reg_ascii_value( wine_fonts_key, "Codepages", info, sizeof(value_buffer) )) { cp_match = !wcscmp( (const WCHAR *)info->Data, cpbufW ); - if (cp_match && screen_dpi == font_dpi) return; /* already set correctly */ + if (cp_match && screen_dpi == font_dpi) + { + /* already set correctly, but, as a HACK, update font link + info anyway, so that old Proton prefixes are fixed */ + update_font_system_link_info(); + return; + } TRACE( "updating registry, codepages/logpixels changed %s/%u -> %u,%u/%u\n", debugstr_w((const WCHAR *)info->Data), font_dpi, ansi_cp.CodePage, oem_cp.CodePage, screen_dpi ); } From b5f900925d06a90ae395b84e27a1ab8859b32f6a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 23 Oct 2018 16:18:20 +0300 Subject: [PATCH 0395/1506] wine.inf: Add font registry entries. --- loader/wine.inf.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 39c38109ffc..15d402ac5b5 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -270,6 +270,7 @@ CurrentVersion="Software\Microsoft\Windows\CurrentVersion" CurrentVersionNT="Software\Microsoft\Windows NT\CurrentVersion" FontSubStr="Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes" Control="System\CurrentControlSet\Control" +FontsNT="Software\Microsoft\Windows NT\CurrentVersion\Fonts" [Classes] HKCR,.chm,,2,"chm.file" @@ -520,6 +521,10 @@ HKLM,%FontSubStr%,"Times New Roman CYR,204",,"Times New Roman,204" HKLM,%FontSubStr%,"Times New Roman Greek,161",,"Times New Roman,161" HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162" HKLM,System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts,"LogPixels",0x10003,0x00000060 +HKLM,%FontsNT%,"Arial (TrueType)",,"arial.ttf" +HKLM,%FontsNT%,"Arial Bold (TrueType)",,"arialbd.ttf" +HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" +HKLM,%FontsNT%,"Courier New (TrueType)",,"cour.ttf" [MCI] HKLM,%Mci32Str%,"AVIVideo",,"mciavi32.dll" From ab960656bc6882ea73d4b713466824957d6d4331 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 30 Oct 2018 13:04:06 -0500 Subject: [PATCH 0396/1506] wine.inf: Substitute Times New Roman for Palatino Linotype For AOE2HD launcher. CW-Bug-Id: #16410 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 15d402ac5b5..a6bae330c0b 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -525,6 +525,7 @@ HKLM,%FontsNT%,"Arial (TrueType)",,"arial.ttf" HKLM,%FontsNT%,"Arial Bold (TrueType)",,"arialbd.ttf" HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" HKLM,%FontsNT%,"Courier New (TrueType)",,"cour.ttf" +HKCU,Software\Wine\Fonts\Replacements,"Palatino Linotype",,"Times New Roman" [MCI] HKLM,%Mci32Str%,"AVIVideo",,"mciavi32.dll" From d4111819d68ecedb86876302b2ed46bd3437bc20 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 10 Aug 2021 11:56:55 +0200 Subject: [PATCH 0397/1506] HACK: loader/wine.inf: Add registry entries for the new fonts. They are required for DWrite to enumerate the fonts. For Cyberpunk 2077 launcher font support. CW-Bug-Id: #19125 --- loader/wine.inf.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index a6bae330c0b..e559b180b3d 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -525,6 +525,10 @@ HKLM,%FontsNT%,"Arial (TrueType)",,"arial.ttf" HKLM,%FontsNT%,"Arial Bold (TrueType)",,"arialbd.ttf" HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" HKLM,%FontsNT%,"Courier New (TrueType)",,"cour.ttf" +HKLM,%FontsNT%,"Malgun Gothic (TrueType)",,"malgun.ttf" +HKLM,%FontsNT%,"Microsoft YaHei (TrueType)",,"msyh.ttf" +HKLM,%FontsNT%,"MS Gothic (TrueType)",,"msgothic.ttc" +HKLM,%FontsNT%,"SimSun (TrueType)",,"simsun.ttc" HKCU,Software\Wine\Fonts\Replacements,"Palatino Linotype",,"Times New Roman" [MCI] From 9a30f2a07494af20703954b98f0392ab1ca8be4a Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Sun, 26 Sep 2021 14:58:45 +0800 Subject: [PATCH 0398/1506] loader/wine.inf: Add registry entries for Microsoft Sans Serif (micross.ttf) and Nirmala UI (nirmala.ttf). CW-Bug-Id: #17132 --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index e559b180b3d..7811ab38c94 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -526,8 +526,10 @@ HKLM,%FontsNT%,"Arial Bold (TrueType)",,"arialbd.ttf" HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" HKLM,%FontsNT%,"Courier New (TrueType)",,"cour.ttf" HKLM,%FontsNT%,"Malgun Gothic (TrueType)",,"malgun.ttf" +HKLM,%FontsNT%,"Microsoft Sans Serif (TrueType)",,"micross.ttf" HKLM,%FontsNT%,"Microsoft YaHei (TrueType)",,"msyh.ttf" HKLM,%FontsNT%,"MS Gothic (TrueType)",,"msgothic.ttc" +HKLM,%FontsNT%,"Nirmala UI (TrueType)",,"nirmala.ttf" HKLM,%FontsNT%,"SimSun (TrueType)",,"simsun.ttc" HKCU,Software\Wine\Fonts\Replacements,"Palatino Linotype",,"Times New Roman" From f1b6ae244813e151380755addd8f1beb84a02ee5 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 12 Jan 2023 16:57:40 +0100 Subject: [PATCH 0399/1506] dwrite: Use fonts distributed with Proton as fallback. --- dlls/dwrite/analyzer.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 8f7327278d7..c528a85c31f 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -248,7 +248,7 @@ system_fallback_config[] = { "0D00-0D7F", L"Noto Sans Malayalam" }, { "0D80-0DFF", L"Noto Sans Sinhala" }, - { "0E00-0E7F", L"Noto Sans Thai" }, + { "0E00-0E7F", L"Microsoft Sans Serif" }, { "0E80-0EFF", L"Noto Sans Lao" }, { "0F00-0FFF", L"Noto Serif Tibetan" }, @@ -268,7 +268,7 @@ system_fallback_config[] = { "1100-11FF, 3130-318F, " "3200-321F, 3260-327F, " "A960-A97F, AC00-D7FF, " - "D7B0-D7FF", L"Noto Sans CJK KR" }, + "D7B0-D7FF", L"Malgun Gothic" }, { "1680-169F", L"Noto Sans Ogham" }, @@ -297,27 +297,27 @@ system_fallback_config[] = /* CJK Radicals Supplement - 2E80-2EFF */ - { "2E80-2EFF", L"Noto Sans CJK SC", L"zh-Hans" }, + { "2E80-2EFF", L"Microsoft YaHei", L"zh-Hans" }, { "2E80-2EFF", L"Noto Sans CJK TC", L"zh-Hant" }, - { "2E80-2EFF", L"Noto Sans CJK KR", L"ko" }, + { "2E80-2EFF", L"Malgun Gothic", L"ko" }, /* CJK Symbols and Punctuation - 3000-303F Hiragana - 3040-309F Katakana - 30A0-30FF Katakana Phonetic Ext. - 31F0-31FF */ - { "3000-30FF, 31F0-31FF", L"Noto Sans CJK SC", L"zh-Hans" }, + { "3000-30FF, 31F0-31FF", L"Microsoft YaHei", L"zh-Hans" }, { "3000-30FF, 31F0-31FF", L"Noto Sans CJK TC", L"zh-Hant" }, - { "3000-30FF, 31F0-31FF", L"Noto Sans CJK KR", L"ko" }, - { "3000-30FF, 31F0-31FF", L"Noto Sans CJK JP" }, + { "3000-30FF, 31F0-31FF", L"Malgun Gothic", L"ko" }, + { "3000-30FF, 31F0-31FF", L"MS Gothic" }, /* CJK Unified Ext A - 3400-4DBF CJK Unified - 4E00-9FFF */ - { "3400-4DBF, 4E00-9FFF", L"Noto Sans CJK SC", L"zh-Hans" }, + { "3400-4DBF, 4E00-9FFF", L"Microsoft YaHei", L"zh-Hans" }, { "3400-4DBF, 4E00-9FFF", L"Noto Sans CJK TC", L"zh-Hant" }, - { "3400-4DBF, 4E00-9FFF", L"Noto Sans CJK KR", L"ko" }, - { "3400-4DBF, 4E00-9FFF", L"Noto Sans CJK JP" }, + { "3400-4DBF, 4E00-9FFF", L"Malgun Gothic", L"ko" }, + { "3400-4DBF, 4E00-9FFF", L"MS Gothic" }, { "A000-A4CF", L"Noto Sans Yi" }, { "A4D0-A4FF", L"Noto Sans Lisu" }, @@ -333,30 +333,30 @@ system_fallback_config[] = /* CJK Compatibility Ideographs - F900-FAFF */ - { "F900-FAFF", L"Noto Sans CJK SC", L"zh-Hans" }, + { "F900-FAFF", L"Microsoft YaHei", L"zh-Hans" }, { "F900-FAFF", L"Noto Sans CJK TC", L"zh-Hant" }, - { "F900-FAFF", L"Noto Sans CJK KR", L"ko" }, - { "F900-FAFF", L"Noto Sans CJK JP" }, + { "F900-FAFF", L"Malgun Gothic", L"ko" }, + { "F900-FAFF", L"MS Gothic" }, /* Vertical Forms - FE10-FE1F */ - { "FE10-FE1F", L"Noto Sans CJK SC", L"zh-Hans" }, - { "FE10-FE1F", L"Noto Sans CJK KR", L"ko" }, + { "FE10-FE1F", L"Microsoft YaHei", L"zh-Hans" }, + { "FE10-FE1F", L"Malgun Gothic", L"ko" }, { "FE10-FE1F", L"Noto Sans CJK TC" }, /* CJK Compatibility Forms - FE30-FE4F Small Form Variants - FE50-FE6F */ - { "FE30-FE6F", L"Noto Sans CJK SC", L"zh-Hans" }, - { "FE30-FE6F", L"Noto Sans CJK KR", L"ko" }, - { "FE30-FE6F", L"Noto Sans CJK JP", L"ja" }, + { "FE30-FE6F", L"Microsoft YaHei", L"zh-Hans" }, + { "FE30-FE6F", L"Malgun Gothic", L"ko" }, + { "FE30-FE6F", L"MS Gothic", L"ja" }, { "FE30-FE6F", L"Noto Sans CJK TC" }, /* Halfwidth and Fullwidth Forms */ - { "FF00-FFEF", L"Noto Sans CJK SC", L"zh-Hans" }, + { "FF00-FFEF", L"Microsoft YaHei", L"zh-Hans" }, { "FF00-FFEF", L"Noto Sans CJK TC", L"zh-Hant" }, - { "FF00-FFEF", L"Noto Sans CJK KR", L"ko" }, - { "FF00-FFEF", L"Noto Sans CJK JP" }, + { "FF00-FFEF", L"Malgun Gothic", L"ko" }, + { "FF00-FFEF", L"MS Gothic" }, }; struct text_source_context From 9e3e8e972eeb814d009311084b32cd2aa8b3a64d Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 24 Jan 2023 12:12:01 +0100 Subject: [PATCH 0400/1506] loader: Install all fonts provided by Proton in the registry. --- loader/wine.inf.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 7811ab38c94..c430a90e141 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -523,14 +523,24 @@ HKLM,%FontSubStr%,"Times New Roman TUR,162",,"Times New Roman,162" HKLM,System\CurrentControlSet\Hardware Profiles\Current\Software\Fonts,"LogPixels",0x10003,0x00000060 HKLM,%FontsNT%,"Arial (TrueType)",,"arial.ttf" HKLM,%FontsNT%,"Arial Bold (TrueType)",,"arialbd.ttf" -HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" HKLM,%FontsNT%,"Courier New (TrueType)",,"cour.ttf" +HKLM,%FontsNT%,"Courier New Bold (TrueType)",,"courbd.ttf" HKLM,%FontsNT%,"Malgun Gothic (TrueType)",,"malgun.ttf" +HKLM,%FontsNT%,"Marlett (TrueType)",,"marlett.ttf" HKLM,%FontsNT%,"Microsoft Sans Serif (TrueType)",,"micross.ttf" -HKLM,%FontsNT%,"Microsoft YaHei (TrueType)",,"msyh.ttf" HKLM,%FontsNT%,"MS Gothic (TrueType)",,"msgothic.ttc" +HKLM,%FontsNT%,"MS PGothic (TrueType)",,"msgothic.ttc" +HKLM,%FontsNT%,"MS UI Gothic (TrueType)",,"msgothic.ttc" +HKLM,%FontsNT%,"Microsoft YaHei (TrueType)",,"msyh.ttf" HKLM,%FontsNT%,"Nirmala UI (TrueType)",,"nirmala.ttf" HKLM,%FontsNT%,"SimSun (TrueType)",,"simsun.ttc" +HKLM,%FontsNT%,"NSimSun (TrueType)",,"simsun.ttc" +HKLM,%FontsNT%,"Symbol (TrueType)",,"symbol.ttf" +HKLM,%FontsNT%,"Tahoma (TrueType)",,"tahoma.ttf" +HKLM,%FontsNT%,"Tahoma Bold (TrueType)",,"tahomabd.ttf" +HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" +HKLM,%FontsNT%,"Webdings (TrueType)",,"webdings.ttf" +HKLM,%FontsNT%,"Wingdings (TrueType)",,"wingdings.ttf" HKCU,Software\Wine\Fonts\Replacements,"Palatino Linotype",,"Times New Roman" [MCI] From aa91d771e84b737c95a7d23325040341bd1eeba7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 17 Oct 2023 20:11:43 -0600 Subject: [PATCH 0401/1506] wine.inf: Substitute Times New Roman for Verdana. CW-Bug-Id: #22875 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index c430a90e141..55dfd7363a0 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -542,6 +542,7 @@ HKLM,%FontsNT%,"Times New Roman (TrueType)",,"times.ttf" HKLM,%FontsNT%,"Webdings (TrueType)",,"webdings.ttf" HKLM,%FontsNT%,"Wingdings (TrueType)",,"wingdings.ttf" HKCU,Software\Wine\Fonts\Replacements,"Palatino Linotype",,"Times New Roman" +HKCU,Software\Wine\Fonts\Replacements,"Verdana",,"Times New Roman" [MCI] HKLM,%Mci32Str%,"AVIVideo",,"mciavi32.dll" From d098d5cf8708edb184f221acb4c19d496b64fa14 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 15 Nov 2023 19:03:11 -0600 Subject: [PATCH 0402/1506] win32u: Store effective AA flags in gdi_font. CW-Bug-Id: #22992 --- dlls/win32u/font.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index c5cf09f56f7..6094ea0261b 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -4689,6 +4689,7 @@ static HFONT font_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) *aa_flags = font_smoothing; } *aa_flags = font_funcs->get_aa_flags( font, *aa_flags, antialias_fakes ); + font->aa_flags = *aa_flags; } TRACE( "%p %s %d aa %x\n", hfont, debugstr_w(lf.lfFaceName), (int)lf.lfHeight, *aa_flags ); pthread_mutex_unlock( &font_lock ); From fdfa017922adbed979aa3f813967977748259979 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 15 Nov 2023 21:37:09 -0600 Subject: [PATCH 0403/1506] win32u: Set all glyph load flags in get_load_flags(). CW-Bug-Id: #22992 --- dlls/win32u/freetype.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/win32u/freetype.c b/dlls/win32u/freetype.c index f6f2f8ac702..558adb69f9d 100644 --- a/dlls/win32u/freetype.c +++ b/dlls/win32u/freetype.c @@ -3420,10 +3420,13 @@ static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int b return needed; } -static FT_Int get_load_flags( UINT format ) +static FT_Int get_load_flags( UINT format, BOOL vertical_metrics, BOOL force_no_bitmap ) { FT_Int load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; + if (vertical_metrics) load_flags |= FT_LOAD_VERTICAL_LAYOUT; + if (force_no_bitmap || format != GGO_BITMAP) load_flags |= FT_LOAD_NO_BITMAP; + if (format & GGO_UNHINTED) return load_flags | FT_LOAD_NO_HINTING; @@ -3463,7 +3466,7 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT FT_Glyph_Metrics metrics; FT_Error err; FT_BBox bbox; - FT_Int load_flags = get_load_flags(format); + FT_Int load_flags; FT_Matrix transform_matrices[3], *matrices = NULL; BOOL vertical_metrics; @@ -3473,8 +3476,6 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT font->matrix.eM11, font->matrix.eM12, font->matrix.eM21, font->matrix.eM22); - format &= ~GGO_UNHINTED; - matrices = get_transform_matrices( font, tategaki, lpmat, transform_matrices ); vertical_metrics = (tategaki && FT_HAS_VERTICAL(ft_face)); @@ -3482,9 +3483,7 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT properly scaled and correct in 2.4.0 or greater */ if (vertical_metrics && FT_SimpleVersion < FT_VERSION_VALUE(2, 4, 0)) vertical_metrics = FALSE; - - if (matrices || format != GGO_BITMAP) load_flags |= FT_LOAD_NO_BITMAP; - if (vertical_metrics) load_flags |= FT_LOAD_VERTICAL_LAYOUT; + load_flags = get_load_flags(format, vertical_metrics, !!matrices); err = pFT_Load_Glyph(ft_face, glyph, load_flags); if (err && !(load_flags & FT_LOAD_NO_HINTING)) @@ -3499,6 +3498,8 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT return GDI_ERROR; } + format &= ~GGO_UNHINTED; + metrics = ft_face->glyph->metrics; if(font->fake_bold) { if (!get_bold_glyph_outline(ft_face->glyph, font->ppem, &metrics) && metrics.width) From 7a433892887fb907c94d67ccbb018ccfae08d25f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 15 Nov 2023 21:30:12 -0600 Subject: [PATCH 0404/1506] win32u: Use font AA flags when querying glyph outline with GGO_METRICS. CW-Bug-Id: #22992 --- dlls/win32u/freetype.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/freetype.c b/dlls/win32u/freetype.c index 558adb69f9d..b6f85bf2594 100644 --- a/dlls/win32u/freetype.c +++ b/dlls/win32u/freetype.c @@ -3469,6 +3469,7 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT FT_Int load_flags; FT_Matrix transform_matrices[3], *matrices = NULL; BOOL vertical_metrics; + UINT effective_format = format; TRACE("%p, %04x, %08x, %p, %08x, %p, %p\n", font, glyph, format, lpgm, buflen, buf, lpmat); @@ -3478,14 +3479,22 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT matrices = get_transform_matrices( font, tategaki, lpmat, transform_matrices ); + if ((format & ~GGO_GLYPH_INDEX) == GGO_METRICS) + effective_format = font->aa_flags | (format & GGO_GLYPH_INDEX); vertical_metrics = (tategaki && FT_HAS_VERTICAL(ft_face)); /* there is a freetype bug where vertical metrics are only properly scaled and correct in 2.4.0 or greater */ if (vertical_metrics && FT_SimpleVersion < FT_VERSION_VALUE(2, 4, 0)) vertical_metrics = FALSE; - load_flags = get_load_flags(format, vertical_metrics, !!matrices); + load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices); err = pFT_Load_Glyph(ft_face, glyph, load_flags); + if (err && format != effective_format) + { + WARN("Failed to load glyph %#x, retrying with GGO_METRICS. Error %#x.\n", glyph, err); + load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices); + err = pFT_Load_Glyph(ft_face, glyph, load_flags); + } if (err && !(load_flags & FT_LOAD_NO_HINTING)) { WARN("Failed to load glyph %#x, retrying without hinting. Error %#x.\n", glyph, err); From cc55620472fb2656fc7262f6f14539368f3991f4 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 9 Feb 2023 21:24:57 +0200 Subject: [PATCH 0405/1506] HACK: kernelbase: Do not flash the winedbg console window. Depending on what the crashing software does with the handles / own console we may end up creating a new console window for windbg. Since Proton defaults to starting windbg in a non-interactive mode without displaying the crash dialog and redirects the log to unix's stderr we want to avoid confusing users. CW-Bug-Id: #21872 --- dlls/kernelbase/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c index edb6d321a46..26d95404429 100644 --- a/dlls/kernelbase/debug.c +++ b/dlls/kernelbase/debug.c @@ -600,7 +600,7 @@ static BOOL start_debugger( EXCEPTION_POINTERS *epointers, HANDLE event ) startup.cb = sizeof(startup); startup.dwFlags = STARTF_USESHOWWINDOW; startup.wShowWindow = SW_SHOWNORMAL; - ret = CreateProcessW( NULL, cmdline, NULL, NULL, TRUE, 0, env, NULL, &startup, &info ); + ret = CreateProcessW( NULL, cmdline, NULL, NULL, TRUE, CREATE_NO_WINDOW, env, NULL, &startup, &info ); FreeEnvironmentStringsW( env ); if (ret) From f78e25665a95effd245cb53831012649fd70e38c Mon Sep 17 00:00:00 2001 From: Timo Gurr Date: Fri, 17 Feb 2023 14:29:25 +0100 Subject: [PATCH 0406/1506] wine.inf: HACK: Disable SpeechSynthesisWrapper.dll for Pentiment. The game crashes when utilizing it and works without it, like seen already on the Steam Deck with its specific depot. https://steamdb.info/depot/1205522/ https://github.com/ValveSoftware/Proton/issues/6415#issuecomment-1379357568 Link: https://github.com/ValveSoftware/Proton/pull/6479 Link: https://github.com/ValveSoftware/wine/pull/176 --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 55dfd7363a0..03dd8c0927d 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2784,3 +2784,5 @@ HKCU,Software\Wine\AppDefaults\DarkSoulsIII.exe\X11 Driver,"LimitNumberOfResolut HKCU,Software\Wine\AppDefaults\sekiro.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" HKCU,Software\Wine\AppDefaults\NieRAutomata.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" HKCU,Software\Wine\AppDefaults\SpellForce.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"16" +;;Other app-specific overrides +HKCU,Software\Wine\AppDefaults\Pentiment.exe\DllOverrides,"SpeechSynthesisWrapper",,"disabled" From dd19de2f5d1a93636c88a975e446ee14389c37d4 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 6 Jun 2023 11:30:37 +0300 Subject: [PATCH 0407/1506] wine.inf: HACK: Disable SpeechSynthWrapper.dll for Grounded. The game crashes when utilizing it and works without it, like seen already on the Steam Deck with its specific depot. CW-Bug-Id: #20918 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 03dd8c0927d..e9cfdae5743 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2786,3 +2786,4 @@ HKCU,Software\Wine\AppDefaults\NieRAutomata.exe\X11 Driver,"LimitNumberOfResolut HKCU,Software\Wine\AppDefaults\SpellForce.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"16" ;;Other app-specific overrides HKCU,Software\Wine\AppDefaults\Pentiment.exe\DllOverrides,"SpeechSynthesisWrapper",,"disabled" +HKCU,Software\Wine\AppDefaults\Maine-Win64-Shipping.exe\DllOverrides,"SpeechSynthWrapper",0x2,"disabled" From c4720a65fbc4483fd24c7335b91e79a619e04a4e Mon Sep 17 00:00:00 2001 From: Bitwolf <65789901+Bitwolfies@users.noreply.github.com> Date: Thu, 23 Feb 2023 13:05:59 -0800 Subject: [PATCH 0408/1506] wine.inf: Use included d3d8.dll with Bloodrayne Terminal Cut 1/2. Proton defaults to use the built-in DirectX 8 implementation but the game ships with it's own d3d8.dll which uses DirectX 9 internally. This helps with massive slowdowns and a few other misc bugs. LinK: https://github.com/ValveSoftware/wine/pull/179 --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index e9cfdae5743..9910f216a90 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2787,3 +2787,5 @@ HKCU,Software\Wine\AppDefaults\SpellForce.exe\X11 Driver,"LimitNumberOfResolutio ;;Other app-specific overrides HKCU,Software\Wine\AppDefaults\Pentiment.exe\DllOverrides,"SpeechSynthesisWrapper",,"disabled" HKCU,Software\Wine\AppDefaults\Maine-Win64-Shipping.exe\DllOverrides,"SpeechSynthWrapper",0x2,"disabled" +HKCU,Software\Wine\AppDefaults\rayne1.exe\DllOverrides,"d3d8",,"native" +HKCU,Software\Wine\AppDefaults\rayne2.exe\DllOverrides,"d3d8",,"native" From 82cfbba67dd765d621cc893c8c09c597fb77a032 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 24 Jul 2023 13:19:04 +0300 Subject: [PATCH 0409/1506] wine.inf.in: Use native vulkan-1 for RDR2. So we don't depend only on the app id and play manifest to have the game playable. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 9910f216a90..9db37f73ffb 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2789,3 +2789,4 @@ HKCU,Software\Wine\AppDefaults\Pentiment.exe\DllOverrides,"SpeechSynthesisWrappe HKCU,Software\Wine\AppDefaults\Maine-Win64-Shipping.exe\DllOverrides,"SpeechSynthWrapper",0x2,"disabled" HKCU,Software\Wine\AppDefaults\rayne1.exe\DllOverrides,"d3d8",,"native" HKCU,Software\Wine\AppDefaults\rayne2.exe\DllOverrides,"d3d8",,"native" +HKCU,Software\Wine\AppDefaults\RDR2.exe\DllOverrides,"vulkan-1",,"native" From b17f8747c65556b8e8004492b8a6e8af150c1c8b Mon Sep 17 00:00:00 2001 From: Liam Middlebrook Date: Mon, 11 Oct 2021 11:16:49 +0200 Subject: [PATCH 0410/1506] loader: Set default regkey for NVIDIA NGX FullPath Sets the default location for the NVIDIA NGX SDK search-path to be C:\Windows\System32\ This is required for supporting NVIDIA DLSS within Proton. Reviewed-by: Adam Moss --- loader/wine.inf.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 9db37f73ffb..dd394f8ac12 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -96,6 +96,7 @@ AddReg=\ ThemeManager,\ VersionInfo,\ LicenseInformation,\ + NVIDIANGX, \ ProtonOverrides,\ SteamClient @@ -123,6 +124,7 @@ AddReg=\ ThemeManager,\ VersionInfo,\ LicenseInformation,\ + NVIDIANGX, \ ProtonOverrides,\ SteamClient.ntamd64 @@ -165,6 +167,7 @@ AddReg=\ Tapi,\ VersionInfo,\ LicenseInformation,\ + NVIDIANGX, \ ProtonOverrides,\ SteamClient.ntamd64 @@ -2749,6 +2752,9 @@ HKCU,Software\Valve\Steam\ActiveProcess,"SteamClientDll64",,"%16426%\Steam\steam HKCU,Software\Valve\Steam\ActiveProcess,"SteamPath",,"%16426%\Steam" HKLM,Software\Wow6432Node\Valve\Steam,"InstallPath",,"%16422%\Steam" +[NVIDIANGX] +HKLM,Software\NVIDIA Corporation\Global\NGXCore,"FullPath",,"C:\Windows\System32" + [ProtonOverrides] HKLM,Software\Khronos\OpenXR\1,"ActiveRuntime",,"C:\openxr\wineopenxr64.json" ;;Likely want *80 and *90 too, but those require removing Wine's manifest files. From 0097b32c879ed92d3c44d1ba9a4054469013cc1a Mon Sep 17 00:00:00 2001 From: Liam Middlebrook Date: Wed, 8 Sep 2021 11:30:28 -0700 Subject: [PATCH 0411/1506] nvcuda: Add stub DLL This is needed for DLSS versions 2.1.38 through 2.1.40 to work within Proton, as they contain a link-time dependency on nvcuda.dll. In the case of what is needed by DLSS, no ordinals need to be exported for nvcuda.dll to successfully load. Signed-off-by: Liam Middlebrook Link: https://github.com/ValveSoftware/wine/pull/119 --- configure.ac | 1 + dlls/nvcuda/Makefile.in | 1 + dlls/nvcuda/nvcuda.spec | 0 3 files changed, 2 insertions(+) create mode 100644 dlls/nvcuda/Makefile.in create mode 100644 dlls/nvcuda/nvcuda.spec diff --git a/configure.ac b/configure.ac index c6c8d2ab5e6..1c00bf8023e 100644 --- a/configure.ac +++ b/configure.ac @@ -2966,6 +2966,7 @@ WINE_CONFIG_MAKEFILE(dlls/ntoskrnl.exe) WINE_CONFIG_MAKEFILE(dlls/ntoskrnl.exe/tests) WINE_CONFIG_MAKEFILE(dlls/ntprint) WINE_CONFIG_MAKEFILE(dlls/ntprint/tests) +WINE_CONFIG_MAKEFILE(dlls/nvcuda) WINE_CONFIG_MAKEFILE(dlls/objsel) WINE_CONFIG_MAKEFILE(dlls/odbc32) WINE_CONFIG_MAKEFILE(dlls/odbcbcp) diff --git a/dlls/nvcuda/Makefile.in b/dlls/nvcuda/Makefile.in new file mode 100644 index 00000000000..6890c798d63 --- /dev/null +++ b/dlls/nvcuda/Makefile.in @@ -0,0 +1 @@ +MODULE = nvcuda.dll diff --git a/dlls/nvcuda/nvcuda.spec b/dlls/nvcuda/nvcuda.spec new file mode 100644 index 00000000000..e69de29bb2d From 6edc8d7b3787952d131353223a2d5f496fd87fcd Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 15 Jul 2020 14:57:28 -0500 Subject: [PATCH 0412/1506] wineboot: On prefix upgrade, update win10 build number Some games (Death Stranding) require later build numbers than we had shipped earlier. So fix it up on existing prefixes. --- programs/wineboot/wineboot.c | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 30a930ed281..cc135538375 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -1548,6 +1548,46 @@ static void update_user_profile(void) LocalFree(sid); } +static void update_win_version(void) +{ + static const WCHAR win10_buildW[] = L"19043"; + static const WCHAR win10_ntW[] = L"6.3"; + + HKEY cv_h; + DWORD type, sz; + WCHAR current_version[256]; + + if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", + 0, KEY_ALL_ACCESS, &cv_h) == ERROR_SUCCESS){ + /* get the current windows version */ + sz = sizeof(current_version); + if(RegQueryValueExW(cv_h, L"CurrentVersion", NULL, &type, (BYTE *)current_version, &sz) == ERROR_SUCCESS && + type == REG_SZ){ + if(!wcscmp(current_version, L"6.3") || !wcscmp(current_version, L"10.0")){ + RegSetValueExW(cv_h, L"CurrentVersion", 0, REG_SZ, (const BYTE *)win10_ntW, sizeof(win10_ntW)); + RegSetValueExW(cv_h, L"CurrentBuild", 0, REG_SZ, (const BYTE *)win10_buildW, sizeof(win10_buildW)); + RegSetValueExW(cv_h, L"CurrentBuildNumber", 0, REG_SZ, (const BYTE *)win10_buildW, sizeof(win10_buildW)); + } + } + RegCloseKey(cv_h); + } + + if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion", + 0, KEY_ALL_ACCESS, &cv_h) == ERROR_SUCCESS){ + /* get the current windows version */ + sz = sizeof(current_version); + if(RegQueryValueExW(cv_h, L"CurrentVersion", NULL, &type, (BYTE *)current_version, &sz) == ERROR_SUCCESS && + type == REG_SZ){ + if(!wcscmp(current_version, L"6.3") || !wcscmp(current_version, L"10.0")){ + RegSetValueExW(cv_h, L"CurrentVersion", 0, REG_SZ, (const BYTE *)win10_ntW, sizeof(win10_ntW)); + RegSetValueExW(cv_h, L"CurrentBuild", 0, REG_SZ, (const BYTE *)win10_buildW, sizeof(win10_buildW)); + RegSetValueExW(cv_h, L"CurrentBuildNumber", 0, REG_SZ, (const BYTE *)win10_buildW, sizeof(win10_buildW)); + } + } + RegCloseKey(cv_h); + } +} + /* execute rundll32 on the wine.inf file if necessary */ static void update_wineprefix( BOOL force ) { @@ -1604,6 +1644,7 @@ static void update_wineprefix( BOOL force ) } install_root_pnp_devices(); update_user_profile(); + update_win_version(); WINE_MESSAGE( "wine: configuration in %s has been updated.\n", debugstr_w(prettyprint_configdir()) ); } From 0eab6d1827a2b5d51dc976f9d357c50399b409e4 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Thu, 22 Apr 2021 14:35:40 -0500 Subject: [PATCH 0413/1506] HACK: mscoree: For M&B2:Bannerlord, redirect ManagedStarter loads to Bannerlord.exe For M&B2:Bannerlord. CW-Bug-Id: #18843 --- dlls/mscoree/metahost.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 50927f62234..f55bdbb2445 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -1849,6 +1849,30 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam } } + if (!strcmp(assemblyname, "ManagedStarter")) + { + /* HACK for Mount & Blade II: Bannerlord + * + * The launcher executable uses an AssemblyResolve event handler + * to redirect loads of the "ManagedStarter" assembly to + * Bannerlord.exe. Due to Mono issue #11319, the runtime attempts + * to load ManagedStarter before executing the static constructor + * that adds this event handler. We work around this by doing the + * same thing in our own assembly load hook. */ + const char* sgi = getenv("SteamGameId"); + if (sgi && !strcmp(sgi, "261550")) + { + FIXME("hack, using Bannerlord.exe\n"); + + result = mono_assembly_open("Bannerlord.exe", &stat); + + if (result) + goto done; + else + ERR("Bannerlord.exe failed to load\n"); + } + } + if (!strcmp(assemblyname, "CameraQuakeViewer")) { /* HACK for Nights of Azure which references type from a non-existing DLL. From 2532c3c5467725b35bc7f7884d6be4353fb75cb7 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 7 Jun 2022 13:02:38 -0500 Subject: [PATCH 0414/1506] HACK: mscoree: Add hack for missing UnrealEdCSharp assembly for Karmaflow CW-Bug-Id: #20672 --- dlls/mscoree/metahost.c | 60 +++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index f55bdbb2445..336129b18ca 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -1793,6 +1793,8 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam static const WCHAR dotdllW[] = {'.','d','l','l',0}; static const WCHAR dotexeW[] = {'.','e','x','e',0}; + const char *sgi = getenv("SteamGameId"); + stringname = mono_stringify_assembly_name(aname); assemblyname = mono_assembly_name_get_name(aname); culture = mono_assembly_name_get_culture(aname); @@ -1859,7 +1861,6 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam * to load ManagedStarter before executing the static constructor * that adds this event handler. We work around this by doing the * same thing in our own assembly load hook. */ - const char* sgi = getenv("SteamGameId"); if (sgi && !strcmp(sgi, "261550")) { FIXME("hack, using Bannerlord.exe\n"); @@ -1873,27 +1874,52 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam } } - if (!strcmp(assemblyname, "CameraQuakeViewer")) + /* HACK for games which reference a type from a non-existing DLL. + * Native .NET framework normally gets away with it but Mono cannot + * due to some deeply rooted differences. */ + if (sgi) { - /* HACK for Nights of Azure which references type from a non-existing DLL. - * Native .NET framework normally gets away with it but Mono cannot - * due to some deeply rooted differences. */ - const char* sgi = getenv("SteamGameId"); - if (sgi && !strcmp(sgi, "527280")) + size_t i; + + static const struct { + const char *assembly_name; + const char *module_name; + const char *appid; + const char *source; + } assembly_hacks[] = { + { + "CameraQuakeViewer", + "CameraQuakeViewer.dll", + "527280", /* Nights of Azure */ + "namespace CQViewer { class CQMgr {} }" + }, + { + "UnrealEdCSharp", + "UnrealEdCSharp.dll", + "317940", /* Karmaflow */ + "namespace ContentBrowser { class IContentBrowserBackendInterface {} class Package {} } " + }, + }; + + for (i = 0; i < ARRAY_SIZE(assembly_hacks); ++i) { - char assembly_path[MAX_PATH]; + if (!strcmp(assemblyname, assembly_hacks[i].assembly_name) && + !strcmp(sgi, assembly_hacks[i].appid)) + { + char assembly_path[MAX_PATH]; - FIXME("HACK: Building CameraQuakeViewer.dll\n"); + FIXME("HACK: Building %s\n", assembly_hacks[i].module_name); - if (compile_assembly("namespace CQViewer { class CQMgr {} }", "CameraQuakeViewer.dll", assembly_path, MAX_PATH)) - result = mono_assembly_open(assembly_path, &stat); - else - ERR("HACK: Failed to build CameraQuakeViewer.dll\n"); + if (compile_assembly(assembly_hacks[i].source, assembly_hacks[i].module_name, assembly_path, MAX_PATH)) + result = mono_assembly_open(assembly_path, &stat); + else + ERR("HACK: Failed to build %s\n", assembly_hacks[i].assembly_name); - if (result) - goto done; - else - ERR("HACK: Failed to load CameraQuakeViewer.dll\n"); + if (result) + goto done; + + ERR("HACK: Failed to load %s\n", assembly_hacks[i].assembly_name); + } } } From ed14fff244c5fb9fab7b7266e971f7993928c55c Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 10 Dec 2018 12:48:41 -0600 Subject: [PATCH 0415/1506] winepulse: Set PulseAudio application name property in the environment. So PA doesn't present all Wine applications as "wine-preloader", and allows PA to store per-application settings. --- dlls/winepulse.drv/pulse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 62658fc98e6..9c777471334 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -395,6 +395,7 @@ static HRESULT pulse_connect(const char *name) pa_context_unref(pulse_ctx); pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), name); + setenv("PULSE_PROP_application.name", name, 1); if (!pulse_ctx) { ERR("Failed to create context\n"); return E_FAIL; From f98d479c37add3c461844aab019b146bc4a25831 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 21 Mar 2022 14:02:30 -0500 Subject: [PATCH 0416/1506] msv1_0: Downgrade missing ntlm_auth message This appears in almost every log and is almost never actually a problem. --- dlls/msv1_0/unixlib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/msv1_0/unixlib.c b/dlls/msv1_0/unixlib.c index b51dde2ef0a..42bef3a28ce 100644 --- a/dlls/msv1_0/unixlib.c +++ b/dlls/msv1_0/unixlib.c @@ -43,7 +43,6 @@ extern char **environ; WINE_DEFAULT_DEBUG_CHANNEL(ntlm); -WINE_DECLARE_DEBUG_CHANNEL(winediag); #define INITIAL_BUFFER_SIZE 200 @@ -233,7 +232,7 @@ static NTSTATUS ntlm_check_version( void *args ) status = STATUS_SUCCESS; } - if (status) ERR_(winediag)( "ntlm_auth was not found. Make sure that ntlm_auth >= 3.0.25 is in your path. " + if (status) WARN( "ntlm_auth was not found. Make sure that ntlm_auth >= 3.0.25 is in your path. " "Usually, you can find it in the winbind package of your distribution.\n" ); ntlm_cleanup( &ctx ); return status; From 62d5eff1ae57700fcc86f9ef0788a4162cbd7333 Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Fri, 9 Jun 2023 16:59:27 -0300 Subject: [PATCH 0417/1506] mf: Clear end of presentation if topo_status is not invalid. Cw-Bug-Id: #22719 Cw-Bug-Id: #21809 --- dlls/mf/session.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 40fabbca69e..c5bbc2e4126 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -2609,7 +2609,8 @@ static HRESULT WINAPI session_commands_callback_Invoke(IMFAsyncCallback *iface, case SESSION_CMD_STOP: if (session->presentation.flags & SESSION_FLAG_END_OF_PRESENTATION) session_set_topo_status(session, S_OK, MF_TOPOSTATUS_ENDED); - session_clear_end_of_presentation(session); + if (session->presentation.topo_status != MF_TOPOSTATUS_INVALID) + session_clear_end_of_presentation(session); session_stop(session); break; case SESSION_CMD_CLOSE: From 617c34184385950b90d235798a0888c8d4486b18 Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 31 Oct 2023 20:44:53 -0300 Subject: [PATCH 0418/1506] mf: Signal event_cond in wg_parser_stream_disable. A workaround to fix a hang in media_source_Shutdown in old media source, because the wg_parser receives an EOS signal after media_source_Shutdown disabled the streams, and event_cond never gets signaled so it never stops being busy. Cw-Bug-Id: #21809 --- dlls/winegstreamer/wg_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index f017a504b39..5eb2f174a5a 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -284,6 +284,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) stream->enabled = false; stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN; pthread_mutex_unlock(&parser->mutex); + pthread_cond_signal(&stream->event_cond); pthread_cond_signal(&stream->event_empty_cond); return S_OK; } From 9b9a30194780f93b4956d285e1cf01b147601939 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Jan 2020 21:39:23 +0300 Subject: [PATCH 0419/1506] ntdll: Increase step after failed map attempt in try_map_free_area(). --- dlls/ntdll/unix/virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index abe1b4dc4ec..b307337b93e 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1301,6 +1301,7 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step, step == 0) break; start = (char *)start + step; + step *= 2; } return NULL; From f1292811e14a4218e36309b308b888fb3173d5b5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Jul 2020 18:40:39 +0300 Subject: [PATCH 0420/1506] ntdll: Increase free ranges view block size on 64 bit. --- dlls/ntdll/unix/virtual.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index b307337b93e..3be59de16ec 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -205,7 +205,11 @@ static BYTE *pages_vprot; #endif static struct file_view *view_block_start, *view_block_end, *next_free_view; +#ifdef _WIN64 +static const size_t view_block_size = 0x200000; +#else static const size_t view_block_size = 0x100000; +#endif static void *preload_reserve_start; static void *preload_reserve_end; static BOOL force_exec_prot; /* whether to force PROT_EXEC on all PROT_READ mmaps */ From ec79967c3bbb839071586accdb98cf91581f1640 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Nov 2019 12:19:20 +0300 Subject: [PATCH 0421/1506] ntdll: Force virtual memory allocation order. Windows allocates virtual memory strictly bottom up or top down depending on the requested flags (when ASLR is disabled). Modern Linux VM allocator always allocates memory top down. Some applications break if the allocated memory addresses are from higher memory than they expect. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48175 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46568 --- dlls/ntdll/unix/virtual.c | 410 +++++++++++++++----------------------- 1 file changed, 164 insertions(+), 246 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 3be59de16ec..3597ef7e8c8 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1241,43 +1241,15 @@ static struct file_view *find_view_range( const void *addr, size_t size ) } -/*********************************************************************** - * find_view_inside_range - * - * Find first (resp. last, if top_down) view inside a range. - * virtual_mutex must be held by caller. - */ -static struct wine_rb_entry *find_view_inside_range( void **base_ptr, void **end_ptr, int top_down ) -{ - struct wine_rb_entry *first = NULL, *ptr = views_tree.root; - void *base = *base_ptr, *end = *end_ptr; - - /* find the first (resp. last) view inside the range */ - while (ptr) - { - struct file_view *view = WINE_RB_ENTRY_VALUE( ptr, struct file_view, entry ); - if ((char *)view->base + view->size >= (char *)end) - { - end = min( end, view->base ); - ptr = ptr->left; - } - else if (view->base <= base) - { - base = max( (char *)base, (char *)view->base + view->size ); - ptr = ptr->right; - } - else - { - first = ptr; - ptr = top_down ? ptr->right : ptr->left; - } - } - - *base_ptr = base; - *end_ptr = end; - return first; -} +struct alloc_area +{ + size_t size; + ptrdiff_t step; + int unix_prot; + BOOL top_down; + UINT_PTR align_mask; +}; /*********************************************************************** * try_map_free_area @@ -1312,112 +1284,6 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step, } -/*********************************************************************** - * map_free_area - * - * Find a free area between views inside the specified range and map it. - * virtual_mutex must be held by caller. - */ -static void *map_free_area( void *base, void *end, size_t size, int top_down, int unix_prot, size_t align_mask ) -{ - struct wine_rb_entry *first = find_view_inside_range( &base, &end, top_down ); - ptrdiff_t step = top_down ? -(align_mask + 1) : (align_mask + 1); - void *start; - - if (top_down) - { - start = ROUND_ADDR( (char *)end - size, align_mask ); - if (start >= end || start < base) return NULL; - - while (first) - { - struct file_view *view = WINE_RB_ENTRY_VALUE( first, struct file_view, entry ); - if ((start = try_map_free_area( (char *)view->base + view->size, (char *)start + size, step, - start, size, unix_prot ))) break; - start = ROUND_ADDR( (char *)view->base - size, align_mask ); - /* stop if remaining space is not large enough */ - if (!start || start >= end || start < base) return NULL; - first = rb_prev( first ); - } - } - else - { - start = ROUND_ADDR( (char *)base + align_mask, align_mask ); - if (!start || start >= end || (char *)end - (char *)start < size) return NULL; - - while (first) - { - struct file_view *view = WINE_RB_ENTRY_VALUE( first, struct file_view, entry ); - if ((start = try_map_free_area( start, view->base, step, - start, size, unix_prot ))) break; - start = ROUND_ADDR( (char *)view->base + view->size + align_mask, align_mask ); - /* stop if remaining space is not large enough */ - if (!start || start >= end || (char *)end - (char *)start < size) return NULL; - first = rb_next( first ); - } - } - - if (!first) - start = try_map_free_area( base, end, step, start, size, unix_prot ); - - if (!start) - ERR( "couldn't map free area in range %p-%p, size %p\n", base, end, (void *)size ); - - return start; -} - - -/*********************************************************************** - * find_reserved_free_area - * - * Find a free area between views inside the specified range. - * virtual_mutex must be held by caller. - * The range must be inside a reserved area. - */ -static void *find_reserved_free_area( void *base, void *end, size_t size, int top_down, size_t align_mask ) -{ - struct range_entry *range; - void *start; - - base = ROUND_ADDR( (char *)base + align_mask, align_mask ); - end = (char *)ROUND_ADDR( (char *)end - size, align_mask ) + size; - - if (top_down) - { - start = (char *)end - size; - range = free_ranges_lower_bound( start ); - assert(range != free_ranges_end && range->end >= start); - - if ((char *)range->end - (char *)start < size) start = ROUND_ADDR( (char *)range->end - size, align_mask ); - do - { - if (start >= end || start < base || (char *)end - (char *)start < size) return NULL; - if (start < range->end && start >= range->base && (char *)range->end - (char *)start >= size) break; - if (--range < free_ranges) return NULL; - start = ROUND_ADDR( (char *)range->end - size, align_mask ); - } - while (1); - } - else - { - start = base; - range = free_ranges_lower_bound( start ); - assert(range != free_ranges_end && range->end >= start); - - if (start < range->base) start = ROUND_ADDR( (char *)range->base + align_mask, align_mask ); - do - { - if (start >= end || start < base || (char *)end - (char *)start < size) return NULL; - if (start < range->end && start >= range->base && (char *)range->end - (char *)start >= size) break; - if (++range == free_ranges_end) return NULL; - start = ROUND_ADDR( (char *)range->base + align_mask, align_mask ); - } - while (1); - } - return start; -} - - /*********************************************************************** * remove_reserved_area * @@ -1527,8 +1393,7 @@ static void free_view( struct file_view *view ) */ static void unregister_view( struct file_view *view ) { - if (mmap_is_in_reserved_area( view->base, view->size )) - free_ranges_remove_view( view ); + free_ranges_remove_view( view ); wine_rb_remove( &views_tree, &view->entry ); } @@ -1556,8 +1421,7 @@ static void delete_view( struct file_view *view ) /* [in] View */ static void register_view( struct file_view *view ) { wine_rb_put( &views_tree, view->base, &view->entry ); - if (mmap_is_in_reserved_area( view->base, view->size )) - free_ranges_insert_view( view ); + free_ranges_insert_view( view ); } @@ -1830,89 +1694,176 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want return ptr; } - -/*********************************************************************** - * find_reserved_free_area_outside_preloader - * - * Find a free area inside a reserved area, skipping the preloader reserved range. - * virtual_mutex must be held by caller. - */ -static void *find_reserved_free_area_outside_preloader( void *start, void *end, size_t size, - int top_down, size_t align_mask ) +static void *try_map_free_area_range( struct alloc_area *area, char *start, char *end ) { - void *ret; + char *alloc_start; - if (preload_reserve_end >= end) + if (area->top_down) { - if (preload_reserve_start <= start) return NULL; /* no space in that area */ - if (preload_reserve_start < end) end = preload_reserve_start; + if (end - start < area->size) return NULL; + alloc_start = ROUND_ADDR( end - area->size, area->align_mask ); + return try_map_free_area( start, alloc_start + area->size, area->step, alloc_start, area->size, area->unix_prot ); } - else if (preload_reserve_start <= start) - { - if (preload_reserve_end > start) start = preload_reserve_end; - } - else /* range is split in two by the preloader reservation, try both parts */ + + alloc_start = ROUND_ADDR( start + area->align_mask, area->align_mask ); + return try_map_free_area( start, end, area->step, alloc_start, area->size, area->unix_prot ); +} + +static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char *end ) +{ + UINT_PTR align_mask = area->align_mask; + char *intersect_start, *intersect_end, *result, *alloc_start; + struct reserved_area *res_area; + + TRACE("range %p-%p.\n", base, end); + + if (base >= end) + return NULL; + + if (area->top_down) { - if (top_down) + if ((ULONG_PTR)end < area->size) return NULL; + alloc_start = ROUND_ADDR( end - area->size, align_mask ); + if (alloc_start >= end || alloc_start < base) return NULL; + + LIST_FOR_EACH_ENTRY_REV( res_area, &reserved_areas, struct reserved_area, entry ) { - ret = find_reserved_free_area( preload_reserve_end, end, size, top_down, align_mask ); - if (ret) return ret; - end = preload_reserve_start; + char *res_start = res_area->base; + char *res_end = res_start + res_area->size; + + if (res_start >= end) continue; + if (res_end <= base) break; + + intersect_start = max( res_start, base ); + intersect_end = min( res_end, end ); + assert( intersect_start <= intersect_end ); + if ((result = try_map_free_area_range( area, intersect_end, end))) return result; + + if (intersect_end - intersect_start >= area->size) + { + alloc_start = ROUND_ADDR( intersect_end - area->size, align_mask ); + if (alloc_start >= intersect_start) + { + if ((result = anon_mmap_fixed( alloc_start, area->size, area->unix_prot, 0 )) != alloc_start) + ERR("Could not map in reserved area, alloc_start %p, size %p.\n", + alloc_start, (void *)area->size); + return result; + } + } + + end = intersect_start; + if (end - base < area->size) return NULL; } - else + return try_map_free_area_range( area, base, end ); + } + + if (base + align_mask < base) return NULL; + alloc_start = ROUND_ADDR( base + align_mask, align_mask ); + if (alloc_start >= end || end - alloc_start < area->size) + return NULL; + + LIST_FOR_EACH_ENTRY( res_area, &reserved_areas, struct reserved_area, entry ) + { + char *res_start = res_area->base; + char *res_end = res_start + res_area->size; + + if (res_end <= base) continue; + if (res_start >= end) break; + + intersect_start = max( res_start, base ); + intersect_end = min( res_end, end ); + assert( intersect_start <= intersect_end ); + if ((result = try_map_free_area_range( area, base, intersect_start ))) return result; + + if (intersect_end - intersect_start >= area->size) { - ret = find_reserved_free_area( start, preload_reserve_start, size, top_down, align_mask ); - if (ret) return ret; - start = preload_reserve_end; + alloc_start = ROUND_ADDR( intersect_start + align_mask, align_mask ); + if (alloc_start + area->size <= intersect_end) + { + if ((result = anon_mmap_fixed( alloc_start, area->size, area->unix_prot, 0 )) != alloc_start) + ERR("Could not map in reserved area, alloc_start %p, size %p.\n", alloc_start, (void *)area->size); + return result; + } } + base = intersect_end; + if (end - base < area->size) return NULL; } - return find_reserved_free_area( start, end, size, top_down, align_mask ); + return try_map_free_area_range( area, base, end ); } -/*********************************************************************** - * map_reserved_area - * - * Try to map some space inside a reserved area. - * virtual_mutex must be held by caller. - */ -static void *map_reserved_area( void *limit_low, void *limit_high, size_t size, int top_down, - int unix_prot, size_t align_mask ) +static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BOOL top_down, int unix_prot, UINT_PTR align_mask ) { - void *ptr = NULL; - struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry ); + struct range_entry *range, *ranges_start, *ranges_end; + char *reserve_start, *reserve_end; + struct alloc_area area; + void *result = NULL; + char *base, *end; + int ranges_inc; + + TRACE("limit %p-%p, size %p, top_down %#x.\n", limit_low, limit_high, (void *)size, top_down); if (top_down) { - LIST_FOR_EACH_ENTRY_REV( area, &reserved_areas, struct reserved_area, entry ) - { - void *start = area->base; - void *end = (char *)start + area->size; - - if (start >= limit_high) continue; - if (end <= limit_low) return NULL; - if (start < limit_low) start = limit_low; - if (end > limit_high) end = limit_high; - ptr = find_reserved_free_area_outside_preloader( start, end, size, top_down, align_mask ); - if (ptr) break; - } + ranges_start = free_ranges_end - 1; + ranges_end = free_ranges - 1; + ranges_inc = -1; } else { - LIST_FOR_EACH_ENTRY( area, &reserved_areas, struct reserved_area, entry ) + ranges_start = free_ranges; + ranges_end = free_ranges_end; + ranges_inc = 1; + } + + memset( &area, 0, sizeof(area) ); + area.step = top_down ? -(align_mask + 1) : (align_mask + 1); + area.size = size; + area.top_down = top_down; + area.unix_prot = unix_prot; + area.align_mask = align_mask; + + reserve_start = preload_reserve_start; + reserve_end = preload_reserve_end; + + for (range = ranges_start; range != ranges_end; range += ranges_inc) + { + base = range->base; + end = range->end; + + TRACE("range %p-%p.\n", base, end); + + if (base < limit_low) base = limit_low; + if (end > limit_high) end = limit_high; + if (base > end || end - base < size) continue; + + if (reserve_end >= base) { - void *start = area->base; - void *end = (char *)start + area->size; - - if (start >= limit_high) return NULL; - if (end <= limit_low) continue; - if (start < limit_low) start = limit_low; - if (end > limit_high) end = limit_high; - ptr = find_reserved_free_area_outside_preloader( start, end, size, top_down, align_mask ); - if (ptr) break; + if (reserve_end >= end) + { + if (reserve_start <= base) + continue; /* no space in that area */ + + if (reserve_start < end) + end = reserve_start; + } + else if (reserve_start <= base) + { + base = reserve_end; + } + else + { + /* range is split in two by the preloader reservation, try first part. */ + if ((result = alloc_free_area_in_range( &area, base, reserve_start ))) + break; + /* then fall through to try second part. */ + base = reserve_end; + } } + + if ((result = alloc_free_area_in_range( &area, base, end ))) + break; } - if (ptr && anon_mmap_fixed( ptr, size, unix_prot, 0 ) != ptr) ptr = NULL; - return ptr; + return result; } /*********************************************************************** @@ -2016,48 +1967,13 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, } else { - void *start = address_space_start; - void *end = min( user_space_limit, host_addr_space_limit ); - size_t view_size, unmap_size; - + limit_high = limit_high ? min( limit_high + 1, (UINT_PTR)user_space_limit) : (UINT_PTR)user_space_limit; + if (limit_low < (ULONG_PTR)address_space_start) limit_low = (ULONG_PTR)address_space_start; if (!align_mask) align_mask = granularity_mask; - view_size = size + align_mask + 1; - - if (limit_low && (void *)limit_low > start) start = (void *)limit_low; - if (limit_high && (void *)limit_high < end) end = (char *)limit_high + 1; - - if ((ptr = map_reserved_area( start, end, size, top_down, get_unix_prot(vprot), align_mask ))) - { - TRACE( "got mem in reserved area %p-%p\n", ptr, (char *)ptr + size ); - goto done; - } - if (start > address_space_start || end < host_addr_space_limit || top_down) - { - if (!(ptr = map_free_area( start, end, size, top_down, get_unix_prot(vprot), align_mask ))) - return STATUS_NO_MEMORY; - TRACE( "got mem with map_free_area %p-%p\n", ptr, (char *)ptr + size ); - goto done; - } - - for (;;) - { - if ((ptr = anon_mmap_alloc( view_size, get_unix_prot(vprot) )) == MAP_FAILED) - { - status = (errno == ENOMEM) ? STATUS_NO_MEMORY : STATUS_INVALID_PARAMETER; - ERR( "anon mmap error %s, size %p, unix_prot %#x\n", - strerror(errno), (void *)view_size, get_unix_prot( vprot ) ); - return status; - } - TRACE( "got mem with anon mmap %p-%p\n", ptr, (char *)ptr + size ); - /* if we got something beyond the user limit, unmap it and retry */ - if (!is_beyond_limit( ptr, view_size, user_space_limit )) break; - unmap_size = unmap_area_above_user_limit( ptr, view_size ); - if (unmap_size) munmap( ptr, unmap_size ); - } - ptr = unmap_extra_space( ptr, view_size, size, align_mask ); + if (!(ptr = alloc_free_area( (void *)limit_low, (void *)limit_high, size, top_down, get_unix_prot( vprot ), align_mask ))) + return STATUS_NO_MEMORY; } -done: status = create_view( view_ret, ptr, size, vprot ); if (status != STATUS_SUCCESS) unmap_area( ptr, size ); return status; @@ -3236,6 +3152,7 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P done: server_leave_uninterrupted_section( &virtual_mutex, &sigset ); if (needs_close) close( unix_handle ); + TRACE("status %#x.\n", res); return res; } @@ -6142,6 +6059,7 @@ NTSTATUS WINAPI NtWow64AllocateVirtualMemory64( HANDLE process, ULONG64 *ret, UL *ret = (ULONG_PTR)base; *size_ptr = size; } + TRACE("status %#x.\n", status); return status; } From 9f4c384bf3e638a47b36f3bb942cff834d1a4cba Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 1 Dec 2023 14:55:20 -0600 Subject: [PATCH 0422/1506] ntdll: Exclude natively mapped areas from free areas list. --- dlls/ntdll/unix/virtual.c | 104 ++++++++++++++++++++++++++++++++++---- 1 file changed, 95 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 3597ef7e8c8..636a699303a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -127,6 +127,7 @@ struct file_view #define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */ #define VPROT_PLACEHOLDER 0x0400 #define VPROT_FREE_PLACEHOLDER 0x0800 +#define VPROT_NATIVE 0x1000 /* Conversion from VPROT_* to Win32 flags */ static const BYTE VIRTUAL_Win32Flags[16] = @@ -175,6 +176,8 @@ static void *working_set_limit = (void *)0x7fff0000; static void *host_addr_space_limit; /* top of the host virtual address space */ static struct file_view *arm64ec_view; +static const ptrdiff_t max_try_map_step = 0x40000000; +static BOOL increase_try_map_step = TRUE; ULONG_PTR user_space_wow_limit = 0; struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffe0000; @@ -1129,7 +1132,9 @@ static void dump_view( struct file_view *view ) BYTE prot = get_page_vprot( addr ); TRACE( "View: %p - %p", addr, addr + view->size - 1 ); - if (view->protect & VPROT_SYSTEM) + if (view->protect & VPROT_NATIVE) + TRACE(" (native)\n"); + else if (view->protect & VPROT_SYSTEM) TRACE( " (builtin image)\n" ); else if (view->protect & VPROT_FREE_PLACEHOLDER) TRACE( " (placeholder)\n" ); @@ -1249,6 +1254,8 @@ struct alloc_area int unix_prot; BOOL top_down; UINT_PTR align_mask; + char *native_mapped; + size_t native_mapped_size; }; /*********************************************************************** @@ -1257,9 +1264,12 @@ struct alloc_area * Try mmaping some expected free memory region, eventually stepping and * retrying inside it, and return where it actually succeeded, or NULL. */ -static void* try_map_free_area( void *base, void *end, ptrdiff_t step, - void *start, size_t size, int unix_prot ) +static void* try_map_free_area( struct alloc_area *area, void *base, void *end, void *start ) { + ptrdiff_t step = area->step; + size_t abs_step = step > 0 ? step : -step; + size_t size = area->size; + int unix_prot = area->unix_prot; void *ptr; while (start && base <= start && (char*)start + size <= (char*)end) @@ -1272,12 +1282,19 @@ static void* try_map_free_area( void *base, void *end, ptrdiff_t step, strerror(errno), start, (char *)start + size, unix_prot ); return NULL; } + if (!area->native_mapped && step && abs_step < (granularity_mask + 1) * 2) + { + area->native_mapped = start; + area->native_mapped_size = abs_step; + area->native_mapped_size = min(area->native_mapped_size, (char *)end - (char *)start); + } if ((step > 0 && (char *)end - (char *)start < step) || (step < 0 && (char *)start - (char *)base < -step) || step == 0) break; start = (char *)start + step; - step *= 2; + if (increase_try_map_step && llabs(step) < max_try_map_step) + step *= 2; } return NULL; @@ -1702,11 +1719,11 @@ static void *try_map_free_area_range( struct alloc_area *area, char *start, char { if (end - start < area->size) return NULL; alloc_start = ROUND_ADDR( end - area->size, area->align_mask ); - return try_map_free_area( start, alloc_start + area->size, area->step, alloc_start, area->size, area->unix_prot ); + return try_map_free_area( area, start, alloc_start + area->size, alloc_start ); } alloc_start = ROUND_ADDR( start + area->align_mask, area->align_mask ); - return try_map_free_area( start, end, area->step, alloc_start, area->size, area->unix_prot ); + return try_map_free_area( area, start, end, alloc_start ); } static void *alloc_free_area_in_range( struct alloc_area *area, char *base, char *end ) @@ -1796,9 +1813,10 @@ static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BO struct range_entry *range, *ranges_start, *ranges_end; char *reserve_start, *reserve_end; struct alloc_area area; - void *result = NULL; + char *result = NULL; char *base, *end; int ranges_inc; + UINT status; TRACE("limit %p-%p, size %p, top_down %#x.\n", limit_low, limit_high, (void *)size, top_down); @@ -1863,6 +1881,50 @@ static void *alloc_free_area( char *limit_low, char *limit_high, size_t size, BO if ((result = alloc_free_area_in_range( &area, base, end ))) break; } + + if (area.native_mapped) + { + char *native_mapped_start, *native_mapped_end; + + TRACE("Excluding %p - %p from free list.\n", + area.native_mapped, (char *)area.native_mapped + area.native_mapped_size ); + + native_mapped_start = ROUND_ADDR(area.native_mapped, granularity_mask); + native_mapped_end = ROUND_ADDR(area.native_mapped + area.native_mapped_size + granularity_mask, + granularity_mask); + + if (result >= native_mapped_end || result + size < native_mapped_start) + /* In case of top down allocation try_map_free_area() result area can overlap the + * area previously marked as native if the latter was unmapped behind our back. */ + { + struct file_view *prev, *next; + + prev = find_view_range( native_mapped_start - 1, native_mapped_end - native_mapped_start + 2 ); + if (prev && (char *)prev->base >= native_mapped_end) + { + next = prev; + prev = WINE_RB_ENTRY_VALUE( rb_prev( &next->entry ), struct file_view, entry ); + } + else if (prev) next = WINE_RB_ENTRY_VALUE( rb_next( &prev->entry ), struct file_view, entry ); + else next = NULL; + + if (prev && prev->protect & VPROT_NATIVE && (char *)prev->base + prev->size >= native_mapped_start) + { + assert( (char *)prev->base + prev->size == native_mapped_start ); + native_mapped_start = prev->base; + delete_view( prev ); + } + if (next && next->protect & VPROT_NATIVE && native_mapped_end >= (char *)next->base) + { + assert( native_mapped_end == (char *)next->base ); + native_mapped_end = (char *)next->base + next->size; + delete_view( next ); + } + if ((status = create_view( &next, native_mapped_start, native_mapped_end - native_mapped_start, + VPROT_SYSTEM | VPROT_NATIVE ))) + ERR("Could not create view for natively mapped area, status %#x.\n", status); + } + } return result; } @@ -1922,6 +1984,17 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot ) return status; } +static void clear_native_views(void) +{ + struct file_view *view, *next_view; + + WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR( view, next_view, &views_tree, struct file_view, entry ) + { + if (view->protect & VPROT_NATIVE) + delete_view( view ); + } +} + /*********************************************************************** * map_view * @@ -1972,7 +2045,15 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, if (!align_mask) align_mask = granularity_mask; if (!(ptr = alloc_free_area( (void *)limit_low, (void *)limit_high, size, top_down, get_unix_prot( vprot ), align_mask ))) - return STATUS_NO_MEMORY; + { + WARN("Allocation failed, clearing native views.\n"); + + clear_native_views(); + if (!is_win64) increase_try_map_step = FALSE; + ptr = alloc_free_area( (void *)limit_low, (void *)limit_high, size, top_down, get_unix_prot( vprot ), align_mask ); + if (!is_win64) increase_try_map_step = TRUE; + if (!ptr) return STATUS_NO_MEMORY; + } } status = create_view( view_ret, ptr, size, vprot ); if (status != STATUS_SUCCESS) unmap_area( ptr, size ); @@ -4286,7 +4367,12 @@ void virtual_set_force_exec( BOOL enable ) WINE_RB_FOR_EACH_ENTRY( view, &views_tree, struct file_view, entry ) { /* file mappings are always accessible */ - BYTE commit = is_view_valloc( view ) ? 0 : VPROT_COMMITTED; + BYTE commit; + + if (view->protect & VPROT_NATIVE) + continue; + + commit = is_view_valloc( view ) ? 0 : VPROT_COMMITTED; mprotect_range( view->base, view->size, commit, 0 ); } From af8ab05b7931136a920a28cb73074c25bca1def9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 May 2020 14:32:09 +0300 Subject: [PATCH 0423/1506] ntdll: Use kernel soft dirty flags for write watches support. Requires kernel patches to have effect. --- dlls/kernel32/tests/virtual.c | 54 +++++++++++- dlls/ntdll/unix/virtual.c | 153 +++++++++++++++++++++++++++++++--- 2 files changed, 191 insertions(+), 16 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index c54fb16ba15..445f519f409 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -2127,15 +2127,61 @@ static void test_write_watch(void) ok( count == 1, "wrong count %Iu\n", count ); ok( results[0] == base + 5*pagesize, "wrong result %p\n", results[0] ); + ret = pResetWriteWatch( base, size ); + ok( !ret, "pResetWriteWatch failed %u\n", GetLastError() ); + + ret = VirtualProtect( base, 6*pagesize, PAGE_READWRITE, &old_prot ); + ok( ret, "VirtualProtect failed error %u\n", GetLastError() ); + ok( old_prot == PAGE_NOACCESS, "wrong old prot %x\n", old_prot ); + + base[3*pagesize + 200] = 3; + base[5*pagesize + 200] = 3; + ret = VirtualFree( base, size, MEM_DECOMMIT ); ok( ret, "VirtualFree failed %lu\n", GetLastError() ); count = 64; ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); - ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); - ok( count == 1 || broken(count == 0), /* win98 */ - "wrong count %Iu\n", count ); - if (count) ok( results[0] == base + 5*pagesize, "wrong result %p\n", results[0] ); + ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); + ok( !count, "wrong count %lu\n", count ); + + base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_READWRITE ); + ok(!!base, "VirtualAlloc failed.\n"); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); + ok( !count, "wrong count %lu\n", count ); + + base[3*pagesize + 200] = 3; + ret = VirtualProtect( base, 6*pagesize, PAGE_READWRITE, &old_prot ); + ok( ret, "VirtualProtect failed error %u\n", GetLastError() ); + ok( old_prot == PAGE_READWRITE, "wrong old prot %x\n", old_prot ); + + base[5*pagesize + 200] = 3; + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); + ok( count == 2, "wrong count %lu\n", count ); + ok( results[0] == base + 3*pagesize && results[1] == base + 5*pagesize, "wrong result %p\n", results[0] ); + + ret = VirtualFree( base, size, MEM_DECOMMIT ); + ok( ret, "VirtualFree failed %u\n", GetLastError() ); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); + todo_wine ok( count == 1, "wrong count %lu\n", count ); + ok( results[0] == base + 3*pagesize, "wrong result %p\n", results[0] ); + + base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_READWRITE ); + ok(!!base, "VirtualAlloc failed.\n"); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); + todo_wine ok( count == 1, "wrong count %lu\n", count ); + ok( results[0] == base + 3*pagesize, "wrong result %p\n", results[0] ); VirtualFree( base, 0, MEM_RELEASE ); } diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 636a699303a..aab67d9b08f 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -207,6 +207,13 @@ static BYTE **pages_vprot; static BYTE *pages_vprot; #endif +static BOOL use_kernel_writewatch; +static int pagemap_fd, pagemap_reset_fd, clear_refs_fd; +#define PAGE_FLAGS_BUFFER_LENGTH 1024 +#define PM_SOFT_DIRTY_PAGE (1ull << 57) + +static void reset_write_watches( void *base, SIZE_T size ); + static struct file_view *view_block_start, *view_block_end, *next_free_view; #ifdef _WIN64 static const size_t view_block_size = 0x200000; @@ -1115,7 +1122,7 @@ static int get_unix_prot( BYTE vprot ) if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ; - if (vprot & VPROT_WRITEWATCH) prot &= ~PROT_WRITE; + if (vprot & VPROT_WRITEWATCH && !use_kernel_writewatch) prot &= ~PROT_WRITE; } if (!prot) prot = PROT_NONE; return prot; @@ -1491,6 +1498,13 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz TRACE( "forcing exec permission on %p-%p\n", base, (char *)base + size - 1 ); mprotect( base, size, unix_prot | PROT_EXEC ); } + + if (vprot & VPROT_WRITEWATCH && use_kernel_writewatch) + { + madvise( view->base, view->size, MADV_NOHUGEPAGE ); + reset_write_watches( view->base, view->size ); + } + return STATUS_SUCCESS; } @@ -1610,7 +1624,7 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr { int unix_prot = get_unix_prot(vprot); - if (view->protect & VPROT_WRITEWATCH) + if (!use_kernel_writewatch && view->protect & VPROT_WRITEWATCH) { /* each page may need different protections depending on write watch flag */ set_page_vprot_bits( base, size, vprot & ~VPROT_WRITEWATCH, ~vprot & ~VPROT_WRITEWATCH ); @@ -1687,8 +1701,24 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size */ static void reset_write_watches( void *base, SIZE_T size ) { - set_page_vprot_bits( base, size, VPROT_WRITEWATCH, 0 ); - mprotect_range( base, size, 0, 0 ); + if (use_kernel_writewatch) + { + char buffer[17]; + ssize_t ret; + + memset(buffer, 0, sizeof(buffer)); + buffer[0] = '6'; + *(void **)&buffer[1] = base; + *(void **)&buffer[1 + 8] = (char *)base + size; + + if ((ret = write(clear_refs_fd, buffer, sizeof(buffer))) != sizeof(buffer)) + ERR("Could not clear soft dirty bits, ret %zd, error %s.\n", ret, strerror(errno)); + } + else + { + set_page_vprot_bits( base, size, VPROT_WRITEWATCH, 0 ); + mprotect_range( base, size, 0, 0 ); + } } @@ -2021,7 +2051,11 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, view->protect = vprot | VPROT_PLACEHOLDER; set_vprot( view, base, size, vprot ); - if (vprot & VPROT_WRITEWATCH) reset_write_watches( base, size ); + if (vprot & VPROT_WRITEWATCH) + { + madvise( base, size, MADV_NOHUGEPAGE ); + reset_write_watches( base, size ); + } *view_ret = view; return STATUS_SUCCESS; } @@ -2190,6 +2224,9 @@ static NTSTATUS decommit_pages( struct file_view *view, size_t start, size_t siz if (!size) size = view->size; if (anon_mmap_fixed( (char *)view->base + start, size, PROT_NONE, 0 ) != MAP_FAILED) { + if (use_kernel_writewatch && view->protect & VPROT_WRITEWATCH) + madvise( view->base, view->size, MADV_NOHUGEPAGE ); + set_page_vprot_bits( (char *)view->base + start, size, 0, VPROT_COMMITTED ); return STATUS_SUCCESS; } @@ -3282,6 +3319,7 @@ void virtual_init(void) size_t size; int i; pthread_mutexattr_t attr; + const char *env_var; pthread_mutexattr_init( &attr ); pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); @@ -3295,6 +3333,24 @@ void virtual_init(void) host_addr_space_limit = address_space_limit; #endif + if (!((env_var = getenv("WINE_DISABLE_KERNEL_WRITEWATCH")) && atoi(env_var)) + && (pagemap_reset_fd = open("/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC)) != -1) + { + use_kernel_writewatch = TRUE; + if ((pagemap_fd = open("/proc/self/pagemap", O_RDONLY | O_CLOEXEC)) == -1) + { + ERR("Could not open pagemap file, error %s.\n", strerror(errno)); + exit(-1); + } + if ((clear_refs_fd = open("/proc/self/clear_refs", O_WRONLY | O_CLOEXEC)) == -1) + { + ERR("Could not open clear_refs file, error %s.\n", strerror(errno)); + exit(-1); + } + if (ERR_ON(virtual)) + MESSAGE("wine: using kernel write watches (experimental).\n"); + } + if (preload_info && *preload_info) for (i = 0; (*preload_info)[i].size; i++) mmap_add_reserved_area( (*preload_info)[i].addr, (*preload_info)[i].size ); @@ -4002,7 +4058,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) } else ret = grow_thread_stack( page, &stack_info ); } - else if (err & EXCEPTION_WRITE_FAULT) + else if (!use_kernel_writewatch && err & EXCEPTION_WRITE_FAULT) { if (vprot & VPROT_WRITEWATCH) { @@ -4086,11 +4142,11 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat for (i = 0; i < size; i += page_size) { BYTE vprot = get_page_vprot( addr + i ); - if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; + if (!use_kernel_writewatch && vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; if (!(get_unix_prot( vprot & ~VPROT_WRITEWATCH ) & PROT_WRITE)) return STATUS_INVALID_USER_BUFFER; } - if (*has_write_watch) + if (!use_kernel_writewatch && *has_write_watch) mprotect_range( addr, size, 0, VPROT_WRITEWATCH ); /* temporarily enable write access */ return STATUS_SUCCESS; } @@ -5841,17 +5897,90 @@ NTSTATUS WINAPI NtGetWriteWatch( HANDLE process, ULONG flags, PVOID base, SIZE_T char *addr = base; char *end = addr + size; - while (pos < *count && addr < end) + if (use_kernel_writewatch) { - if (!(get_page_vprot( addr ) & VPROT_WRITEWATCH)) addresses[pos++] = addr; - addr += page_size; + static UINT64 buffer[PAGE_FLAGS_BUFFER_LENGTH]; + unsigned int i, length; + ssize_t read_length; + + if (flags & WRITE_WATCH_FLAG_RESET) + { + if (is_win64) + { + addresses[0] = end; + if ((read_length = pread(pagemap_reset_fd, addresses, *count * sizeof(*addresses), + ((ULONG_PTR)addr >> page_shift) * sizeof(*addresses))) == -1) + { + ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); + status = STATUS_INVALID_ADDRESS; + goto done; + } + *count = read_length / sizeof(*addresses); + *granularity = page_size; + goto done; + } + + while (pos < *count && addr < end) + { + length = min(PAGE_FLAGS_BUFFER_LENGTH, *count - pos); + + buffer[0] = (ULONG_PTR)end; + if ((read_length = pread(pagemap_reset_fd, buffer, length * sizeof(*buffer), + ((ULONG_PTR)addr >> page_shift) * sizeof(*buffer))) == -1) + { + ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); + status = STATUS_INVALID_ADDRESS; + goto done; + } + read_length /= sizeof(*buffer); + for (i = 0; i < read_length; ++i) + { + assert(pos < *count); + addresses[pos++] = (void *)(ULONG_PTR)buffer[i]; + } + if (read_length < length) + break; + addr = (char *)(ULONG_PTR)buffer[read_length - 1] + page_size; + } + } + else + { + while (pos < *count && addr < end) + { + length = min(PAGE_FLAGS_BUFFER_LENGTH, (end - addr) >> page_shift); + + if ((read_length = pread(pagemap_fd, buffer, length * sizeof(*buffer), + ((ULONG_PTR)addr >> page_shift) * sizeof(*buffer))) != length * sizeof(*buffer)) + { + ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); + status = STATUS_INVALID_ADDRESS; + goto done; + } + for (i = 0; i < length && pos < *count; ++i) + { + if (buffer[i] & PM_SOFT_DIRTY_PAGE) + addresses[pos++] = addr; + + addr += page_size; + } + } + } + } + else + { + while (pos < *count && addr < end) + { + if (!(get_page_vprot( addr ) & VPROT_WRITEWATCH)) addresses[pos++] = addr; + addr += page_size; + } + if (flags & WRITE_WATCH_FLAG_RESET) reset_write_watches( base, addr - (char *)base ); } - if (flags & WRITE_WATCH_FLAG_RESET) reset_write_watches( base, addr - (char *)base ); *count = pos; *granularity = page_size; } else status = STATUS_INVALID_PARAMETER; +done: server_leave_uninterrupted_section( &virtual_mutex, &sigset ); return status; } From 60b7ce66f2d4c96240dd8baf8e0e9110d4ebd14b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 13 May 2020 13:55:55 +0300 Subject: [PATCH 0424/1506] ntdll: Add WINE_DISABLE_WRITE_WATCH env var to disable write watch support. Massively improves performance for corert games (Streets of Rage 4). Could be fixed properly with Linux kernel changes. --- dlls/ntdll/unix/virtual.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index aab67d9b08f..707eb513a54 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4523,6 +4523,22 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ SIZE_T size = *size_ptr; NTSTATUS status = STATUS_SUCCESS; + if (type & MEM_WRITE_WATCH) + { + static int disable = -1; + + if (disable == -1) + { + const char *env_var; + + if ((disable = (env_var = getenv("WINE_DISABLE_WRITE_WATCH")) && atoi(env_var))) + FIXME("Disabling write watch support.\n"); + } + + if (disable) + return STATUS_NOT_SUPPORTED; + } + /* Round parameters to a page boundary */ if (is_beyond_limit( 0, size, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE; From 498f70e9ca11d5bba6cbd855c559fc6e15d4c63f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 29 Dec 2022 11:30:18 -0600 Subject: [PATCH 0425/1506] ntdll: HACK: Load Unix libs at once in load_builtin_unixlib(). CW-Bug-Id: #21736 --- dlls/ntdll/unix/virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 707eb513a54..787f12f1615 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -689,6 +689,7 @@ NTSTATUS load_builtin_unixlib( void *module, const char *name ) if (builtin->module != module) continue; if (!builtin->unix_path) builtin->unix_path = strdup( name ); else status = STATUS_IMAGE_ALREADY_LOADED; + if (!builtin->unix_handle) builtin->unix_handle = dlopen( builtin->unix_path, RTLD_NOW ); break; } server_leave_uninterrupted_section( &virtual_mutex, &sigset ); From c0e905bb929a68340c5610b4d5828385b1a9ebf7 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 4 Mar 2020 18:49:37 +0100 Subject: [PATCH 0426/1506] HACK: ntdll: Mark first gta5.exe page as copied. --- dlls/ntdll/unix/virtual.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 787f12f1615..7a4bc0afe02 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -122,6 +122,7 @@ struct file_view #define VPROT_GUARD 0x10 #define VPROT_COMMITTED 0x20 #define VPROT_WRITEWATCH 0x40 +#define VPROT_COPIED 0x80 /* per-mapping protection flags */ #define VPROT_ARM64EC 0x0100 /* view may contain ARM64EC code */ #define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */ @@ -1102,7 +1103,8 @@ static const char *get_prot_str( BYTE prot ) buffer[0] = (prot & VPROT_COMMITTED) ? 'c' : '-'; buffer[1] = (prot & VPROT_GUARD) ? 'g' : ((prot & VPROT_WRITEWATCH) ? 'H' : '-'); buffer[2] = (prot & VPROT_READ) ? 'r' : '-'; - buffer[3] = (prot & VPROT_WRITECOPY) ? 'W' : ((prot & VPROT_WRITE) ? 'w' : '-'); + buffer[3] = (prot & VPROT_WRITECOPY) ? (prot & VPROT_COPIED ? 'w' : 'W') + : ((prot & VPROT_WRITE) ? 'w' : '-'); buffer[4] = (prot & VPROT_EXEC) ? 'x' : '-'; buffer[5] = 0; return buffer; @@ -1517,7 +1519,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz */ static DWORD get_win32_prot( BYTE vprot, unsigned int map_prot ) { - DWORD ret = VIRTUAL_Win32Flags[vprot & 0x0f]; + DWORD ret; + + if ((vprot & (VPROT_COPIED | VPROT_WRITECOPY)) == (VPROT_COPIED | VPROT_WRITECOPY)) + vprot = (vprot & ~VPROT_WRITECOPY) | VPROT_WRITE; + ret = VIRTUAL_Win32Flags[vprot & 0x0f]; if (vprot & VPROT_GUARD) ret |= PAGE_GUARD; if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE; return ret; @@ -4994,6 +5000,24 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T { old = get_win32_prot( vprot, view->protect ); status = set_protection( view, base, size, new_prot ); + + /* GTA5 HACK: Mark first page as copied. */ + if (status == STATUS_SUCCESS && (view->protect & SEC_IMAGE) && + base == (void*)NtCurrentTeb()->Peb->ImageBaseAddress) + { + const WCHAR gta5W[] = { 'g','t','a','5','.','e','x','e',0 }; + WCHAR *name, *p; + + name = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; + p = wcsrchr(name, '\\'); + p = p ? p+1 : name; + + if(!wcsicmp(p, gta5W)) + { + FIXME("HACK: changing GTA5.exe vprot\n"); + set_page_vprot_bits(base, page_size, VPROT_COPIED, 0); + } + } } else status = STATUS_NOT_COMMITTED; } From 98be50f863f472c0062f6ce52935d3b664d4c9db Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Wed, 17 Oct 2018 04:13:37 -0700 Subject: [PATCH 0427/1506] ntdll/loader: add support for overriding IMAGE_FILE_LARGE_ADDRESS_AWARE --- dlls/kernel32/heap.c | 8 +++++++- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/unix/unix_private.h | 2 ++ dlls/ntdll/unix/virtual.c | 22 ++++++++++++++++++++-- dlls/wow64/system.c | 6 ++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index 1ec2f5cce0d..10f6895478e 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -42,6 +42,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(globalmem); +extern BOOL WINAPI __wine_needs_override_large_address_aware(void); + /*********************************************************************** * HeapCreate (KERNEL32.@) * @@ -424,6 +426,7 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) OSVERSIONINFOW osver; #ifndef _WIN64 IMAGE_NT_HEADERS *nt = RtlImageNtHeader( GetModuleHandleW(0) ); + static int force_large_address_aware = -1; #endif /* Because GlobalMemoryStatus is identical to GlobalMemoryStatusEX save @@ -450,6 +453,8 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) lpBuffer->dwAvailVirtual = memstatus.ullAvailVirtual; #ifndef _WIN64 + if (force_large_address_aware == -1) + force_large_address_aware = __wine_needs_override_large_address_aware(); if ( osver.dwMajorVersion >= 5 || osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) { lpBuffer->dwTotalPhys = min( memstatus.ullTotalPhys, MAXDWORD ); @@ -463,7 +468,8 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) /* values are limited to 2Gb unless the app has the IMAGE_FILE_LARGE_ADDRESS_AWARE flag */ /* page file sizes are not limited (Adobe Illustrator 8 depends on this) */ - if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) + if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) && + !force_large_address_aware) { if (lpBuffer->dwTotalPhys > MAXLONG) lpBuffer->dwTotalPhys = MAXLONG; if (lpBuffer->dwAvailPhys > MAXLONG) lpBuffer->dwAvailPhys = MAXLONG; diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 850299f22ee..805aaf188c8 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1733,3 +1733,4 @@ # Filesystem @ stdcall -syscall wine_nt_to_unix_file_name(ptr ptr ptr long) @ stdcall -syscall wine_unix_to_nt_file_name(str ptr ptr) +@ stdcall -syscall __wine_needs_override_large_address_aware() diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index c2292765ffb..20fb3b6b7c9 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -529,4 +529,6 @@ static inline NTSTATUS map_section( HANDLE mapping, void **ptr, SIZE_T *size, UL 0, NULL, size, ViewShare, 0, protect ); } +BOOL WINAPI __wine_needs_override_large_address_aware(void); + #endif /* __NTDLL_UNIX_PRIVATE_H */ diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 7a4bc0afe02..d2d07829e34 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4486,6 +4486,24 @@ static void virtual_release_address_space(void) #endif /* _WIN64 */ +BOOL WINAPI __wine_needs_override_large_address_aware(void) +{ + static int needs_override = -1; + + if (needs_override == -1) + { + const char *str = getenv( "WINE_LARGE_ADDRESS_AWARE" ); + + needs_override = !str || atoi(str) == 1; + } + return needs_override; +} + +static BOOL is_large_address_aware(void) +{ + return (main_image_info.ImageCharacteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) + || __wine_needs_override_large_address_aware(); +} /*********************************************************************** * virtual_set_large_address_space @@ -4497,7 +4515,7 @@ void virtual_set_large_address_space(void) if (is_win64) { if (is_wow64()) - user_space_wow_limit = ((main_image_info.ImageCharacteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) ? limit_4g : limit_2g) - 1; + user_space_wow_limit = (is_large_address_aware() ? limit_4g : limit_2g) - 1; #ifndef __APPLE__ /* don't free the zerofill section on macOS */ else if ((main_image_info.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA) && (main_image_info.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)) @@ -4506,7 +4524,7 @@ void virtual_set_large_address_space(void) } else { - if (!(main_image_info.ImageCharacteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) return; + if (!is_large_address_aware()) return; free_reserved_memory( (char *)0x80000000, address_space_limit ); } user_space_limit = working_set_limit = address_space_limit; diff --git a/dlls/wow64/system.c b/dlls/wow64/system.c index 35032d31cfc..51c568fedda 100644 --- a/dlls/wow64/system.c +++ b/dlls/wow64/system.c @@ -821,3 +821,9 @@ NTSTATUS WINAPI wow64___wine_set_unix_env( UINT *args ) return __wine_set_unix_env( var, val ); } + +BOOL WINAPI __wine_needs_override_large_address_aware(void); +NTSTATUS WINAPI wow64___wine_needs_override_large_address_aware( UINT * args ) +{ + return __wine_needs_override_large_address_aware(); +} From aba1daa97ad720bfbb2d999878b5c652409b1c4d Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 12 Dec 2022 05:41:47 +0200 Subject: [PATCH 0428/1506] configure: Check for sys/eventfd.h, ppoll(), and shm_open(). We use ppoll() instead of poll() for the better time granularity. Although perhaps we shouldn't since the server doesn't do this. Wine-Staging: eventfd_synchronization --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 1c00bf8023e..45ae883ddc6 100644 --- a/configure.ac +++ b/configure.ac @@ -458,6 +458,7 @@ AC_CHECK_HEADERS(\ sys/cdio.h \ sys/epoll.h \ sys/event.h \ + sys/eventfd.h \ sys/extattr.h \ sys/filio.h \ sys/ipc.h \ @@ -2091,6 +2092,7 @@ AC_CHECK_FUNCS(\ port_create \ posix_fadvise \ posix_fallocate \ + ppoll \ prctl \ proc_pidinfo \ sched_yield \ @@ -2114,6 +2116,12 @@ case $host_os in ;; esac +ac_save_LIBS=$LIBS +AC_SEARCH_LIBS(shm_open, rt, + [AC_DEFINE(HAVE_SHM_OPEN, 1, [Define to 1 if you have the `shm_open' function.]) + test "$ac_res" = "none required" || AC_SUBST(RT_LIBS,"$ac_res")]) +LIBS=$ac_save_LIBS + AC_CACHE_CHECK([for sched_setaffinity],wine_cv_have_sched_setaffinity, AC_LINK_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[sched_setaffinity(0, 0, 0);]])],[wine_cv_have_sched_setaffinity=yes],[wine_cv_have_sched_setaffinity=no])) From 41923549a7e5abfbe13fc4a4578bf6247510c2a3 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 7 Jun 2018 20:09:59 -0500 Subject: [PATCH 0429/1506] server: Create server objects for eventfd-based synchronization objects. Wine-Staging: eventfd_synchronization --- server/Makefile.in | 1 + server/esync.c | 318 ++++++++++++++++++++++++++++++++++++++++++++ server/esync.h | 24 ++++ server/main.c | 4 + server/protocol.def | 25 +++- 5 files changed, 371 insertions(+), 1 deletion(-) create mode 100644 server/esync.c create mode 100644 server/esync.h diff --git a/server/Makefile.in b/server/Makefile.in index 7b46b924c46..79d05f2318c 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -11,6 +11,7 @@ SOURCES = \ debugger.c \ device.c \ directory.c \ + esync.c \ event.c \ fd.c \ file.c \ diff --git a/server/esync.c b/server/esync.c new file mode 100644 index 00000000000..35b4833fd4c --- /dev/null +++ b/server/esync.c @@ -0,0 +1,318 @@ +/* + * eventfd-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + + +#include +#include +#include +#ifdef HAVE_SYS_EVENTFD_H +# include +#endif +#include +#ifdef HAVE_SYS_STAT_H +# include +#endif +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" + +#include "handle.h" +#include "request.h" +#include "file.h" + +int do_esync(void) +{ +#ifdef HAVE_SYS_EVENTFD_H + static int do_esync_cached = -1; + + if (do_esync_cached == -1) + do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC")); + + return do_esync_cached; +#else + return 0; +#endif +} + +static char shm_name[29]; +static int shm_fd; +static off_t shm_size; +static void **shm_addrs; +static int shm_addrs_size; /* length of the allocated shm_addrs array */ +static long pagesize; + +static void shm_cleanup(void) +{ + close( shm_fd ); + if (shm_unlink( shm_name ) == -1) + perror( "shm_unlink" ); +} + +void esync_init(void) +{ + struct stat st; + + if (fstat( config_dir_fd, &st ) == -1) + fatal_error( "cannot stat config dir\n" ); + + if (st.st_ino != (unsigned long)st.st_ino) + sprintf( shm_name, "/wine-%lx%08lx-esync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino ); + else + sprintf( shm_name, "/wine-%lx-esync", (unsigned long)st.st_ino ); + + shm_unlink( shm_name ); + + shm_fd = shm_open( shm_name, O_RDWR | O_CREAT | O_EXCL, 0644 ); + if (shm_fd == -1) + perror( "shm_open" ); + + pagesize = sysconf( _SC_PAGESIZE ); + + shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); + shm_addrs_size = 128; + + shm_size = pagesize; + if (ftruncate( shm_fd, shm_size ) == -1) + perror( "ftruncate" ); + + fprintf( stderr, "esync: up and running.\n" ); + + atexit( shm_cleanup ); +} + +struct esync +{ + struct object obj; /* object header */ + int fd; /* eventfd file descriptor */ + enum esync_type type; + unsigned int shm_idx; /* index into the shared memory section */ +}; + +static void esync_dump( struct object *obj, int verbose ); +static void esync_destroy( struct object *obj ); + +static const struct object_ops esync_ops = +{ + sizeof(struct esync), /* size */ + &no_type, /* type */ + esync_dump, /* dump */ + no_add_queue, /* add_queue */ + NULL, /* remove_queue */ + NULL, /* signaled */ + NULL, /* satisfied */ + no_signal, /* signal */ + no_get_fd, /* get_fd */ + default_map_access, /* map_access */ + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + default_get_full_name, /* get_full_name */ + no_lookup_name, /* lookup_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ + no_open_file, /* open_file */ + no_kernel_obj_list, /* get_kernel_obj_list */ + no_close_handle, /* close_handle */ + esync_destroy /* destroy */ +}; + +static void esync_dump( struct object *obj, int verbose ) +{ + struct esync *esync = (struct esync *)obj; + assert( obj->ops == &esync_ops ); + fprintf( stderr, "esync fd=%d\n", esync->fd ); +} + +static void esync_destroy( struct object *obj ) +{ + struct esync *esync = (struct esync *)obj; + close( esync->fd ); +} + +static int type_matches( enum esync_type type1, enum esync_type type2 ) +{ + return (type1 == type2) || + ((type1 == ESYNC_AUTO_EVENT || type1 == ESYNC_MANUAL_EVENT) && + (type2 == ESYNC_AUTO_EVENT || type2 == ESYNC_MANUAL_EVENT)); +} + +static void *get_shm( unsigned int idx ) +{ + int entry = (idx * 8) / pagesize; + int offset = (idx * 8) % pagesize; + + if (entry >= shm_addrs_size) + { + int new_size = max(shm_addrs_size * 2, entry + 1); + + if (!(shm_addrs = realloc( shm_addrs, new_size * sizeof(shm_addrs[0]) ))) + fprintf( stderr, "esync: couldn't expand shm_addrs array to size %d\n", entry + 1 ); + + memset( shm_addrs + shm_addrs_size, 0, (new_size - shm_addrs_size) * sizeof(shm_addrs[0]) ); + + shm_addrs_size = new_size; + } + + if (!shm_addrs[entry]) + { + void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize ); + if (addr == (void *)-1) + { + fprintf( stderr, "esync: failed to map page %d (offset %#lx): ", entry, entry * pagesize ); + perror( "mmap" ); + } + + if (debug_level) + fprintf( stderr, "esync: Mapping page %d at %p.\n", entry, addr ); + + if (__sync_val_compare_and_swap( &shm_addrs[entry], 0, addr )) + munmap( addr, pagesize ); /* someone beat us to it */ + } + + return (void *)((unsigned long)shm_addrs[entry] + offset); +} + +struct semaphore +{ + int max; + int count; +}; +C_ASSERT(sizeof(struct semaphore) == 8); + +struct esync *create_esync( struct object *root, const struct unicode_str *name, + unsigned int attr, int initval, int max, enum esync_type type, + const struct security_descriptor *sd ) +{ +#ifdef HAVE_SYS_EVENTFD_H + struct esync *esync; + + if ((esync = create_named_object( root, &esync_ops, name, attr, sd ))) + { + if (get_error() != STATUS_OBJECT_NAME_EXISTS) + { + int flags = EFD_CLOEXEC | EFD_NONBLOCK; + + if (type == ESYNC_SEMAPHORE) + flags |= EFD_SEMAPHORE; + + /* initialize it if it didn't already exist */ + esync->fd = eventfd( initval, flags ); + if (esync->fd == -1) + { + perror( "eventfd" ); + file_set_error(); + release_object( esync ); + return NULL; + } + esync->type = type; + + /* Use the fd as index, since that'll be unique across all + * processes, but should hopefully end up also allowing reuse. */ + esync->shm_idx = esync->fd + 1; /* we keep index 0 reserved */ + while (esync->shm_idx * 8 >= shm_size) + { + /* Better expand the shm section. */ + shm_size += pagesize; + if (ftruncate( shm_fd, shm_size ) == -1) + { + fprintf( stderr, "esync: couldn't expand %s to size %ld: ", + shm_name, (long)shm_size ); + perror( "ftruncate" ); + } + } + + /* Initialize the shared memory portion. We want to do this on the + * server side to avoid a potential though unlikely race whereby + * the same object is opened and used between the time it's created + * and the time its shared memory portion is initialized. */ + switch (type) + { + case ESYNC_SEMAPHORE: + { + struct semaphore *semaphore = get_shm( esync->shm_idx ); + semaphore->max = max; + semaphore->count = initval; + break; + } + default: + assert( 0 ); + } + } + else + { + /* validate the type */ + if (!type_matches( type, esync->type )) + { + release_object( &esync->obj ); + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + return NULL; + } + } + } + return esync; +#else + /* FIXME: Provide a fallback implementation using pipe(). */ + set_error( STATUS_NOT_IMPLEMENTED ); + return NULL; +#endif +} + +DECL_HANDLER(create_esync) +{ + struct esync *esync; + struct unicode_str name; + struct object *root; + const struct security_descriptor *sd; + const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); + + if (!do_esync()) + { + set_error( STATUS_NOT_IMPLEMENTED ); + return; + } + + if (!req->type) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + + if (!objattr) return; + + if ((esync = create_esync( root, &name, objattr->attributes, req->initval, req->max, req->type, sd ))) + { + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, esync, req->access, objattr->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, esync, + req->access, objattr->attributes ); + + reply->type = esync->type; + reply->shm_idx = esync->shm_idx; + send_client_fd( current->process, esync->fd, reply->handle ); + release_object( esync ); + } + + if (root) release_object( root ); +} diff --git a/server/esync.h b/server/esync.h new file mode 100644 index 00000000000..00f9e638d83 --- /dev/null +++ b/server/esync.h @@ -0,0 +1,24 @@ +/* + * eventfd-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +extern int do_esync(void); +void esync_init(void); diff --git a/server/main.c b/server/main.c index e2ae1bcaabc..c4bb790db8a 100644 --- a/server/main.c +++ b/server/main.c @@ -34,6 +34,7 @@ #include "thread.h" #include "request.h" #include "unicode.h" +#include "esync.h" /* command-line options */ int debug_level = 0; @@ -229,6 +230,9 @@ int main( int argc, char *argv[] ) sock_init(); open_master_socket(); + if (do_esync()) + esync_init(); + if (debug_level) fprintf( stderr, "wineserver: starting (pid=%ld)\n", (long) getpid() ); set_current_time(); init_signals(); diff --git a/server/protocol.def b/server/protocol.def index 4051b8d25d4..a9fb8a2ede0 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3928,7 +3928,6 @@ struct handle_info obj_handle_t handle; /* process handle */ @END - /* Iterate thread list for process */ @REQ(get_next_thread) obj_handle_t process; /* process handle */ @@ -3939,3 +3938,27 @@ struct handle_info @REPLY obj_handle_t handle; /* next thread handle */ @END + +enum esync_type +{ + ESYNC_SEMAPHORE = 1, + ESYNC_AUTO_EVENT, + ESYNC_MANUAL_EVENT, + ESYNC_MUTEX, + ESYNC_AUTO_SERVER, + ESYNC_MANUAL_SERVER, + ESYNC_QUEUE, +}; + +/* Create a new eventfd-based synchronization object */ +@REQ(create_esync) + unsigned int access; /* wanted access rights */ + int initval; /* initial value */ + int type; /* type of esync object */ + int max; /* maximum count on a semaphore */ + VARARG(objattr,object_attributes); /* object attributes */ +@REPLY + obj_handle_t handle; /* handle to the object */ + int type; /* actual type (may be different for events) */ + unsigned int shm_idx; +@END From ebfe11c9ea76eb1ec1d04b6aa3a103df58a73d0e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 12:09:22 -0500 Subject: [PATCH 0430/1506] ntdll: Create eventfd-based objects for semaphores. Wine-Staging: eventfd_synchronization --- dlls/ntdll/Makefile.in | 1 + dlls/ntdll/unix/esync.c | 270 +++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 35 +++++ dlls/ntdll/unix/loader.c | 2 + dlls/ntdll/unix/server.c | 4 +- dlls/ntdll/unix/sync.c | 4 + server/esync.c | 1 + 7 files changed, 315 insertions(+), 2 deletions(-) create mode 100644 dlls/ntdll/unix/esync.c create mode 100644 dlls/ntdll/unix/esync.h diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index d3f2a0e5523..70fac547c57 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -48,6 +48,7 @@ SOURCES = \ unix/cdrom.c \ unix/debug.c \ unix/env.c \ + unix/esync.c \ unix/file.c \ unix/loader.c \ unix/loadorder.c \ diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c new file mode 100644 index 00000000000..89b8542433e --- /dev/null +++ b/dlls/ntdll/unix/esync.c @@ -0,0 +1,270 @@ +/* + * eventfd-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_STAT_H +# include +#endif +#include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" +#include "wine/server.h" +#include "wine/debug.h" + +#include "unix_private.h" +#include "esync.h" + +WINE_DEFAULT_DEBUG_CHANNEL(esync); + +int do_esync(void) +{ +#ifdef HAVE_SYS_EVENTFD_H + static int do_esync_cached = -1; + + if (do_esync_cached == -1) + do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC")); + + return do_esync_cached; +#else + static int once; + if (!once++) + FIXME("eventfd not supported on this platform.\n"); + return 0; +#endif +} + +struct esync +{ + enum esync_type type; + int fd; + void *shm; +}; + +struct semaphore +{ + int max; + int count; +}; +C_ASSERT(sizeof(struct semaphore) == 8); + +static char shm_name[29]; +static int shm_fd; +static void **shm_addrs; +static int shm_addrs_size; /* length of the allocated shm_addrs array */ +static long pagesize; + +static pthread_mutex_t shm_addrs_mutex = PTHREAD_MUTEX_INITIALIZER; + +static void *get_shm( unsigned int idx ) +{ + int entry = (idx * 8) / pagesize; + int offset = (idx * 8) % pagesize; + void *ret; + + pthread_mutex_lock( &shm_addrs_mutex ); + + if (entry >= shm_addrs_size) + { + int new_size = max(shm_addrs_size * 2, entry + 1); + + if (!(shm_addrs = realloc( shm_addrs, new_size * sizeof(shm_addrs[0]) ))) + ERR("Failed to grow shm_addrs array to size %d.\n", shm_addrs_size); + memset( shm_addrs + shm_addrs_size, 0, (new_size - shm_addrs_size) * sizeof(shm_addrs[0]) ); + shm_addrs_size = new_size; + } + + if (!shm_addrs[entry]) + { + void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize ); + if (addr == (void *)-1) + ERR("Failed to map page %d (offset %#lx).\n", entry, entry * pagesize); + + TRACE("Mapping page %d at %p.\n", entry, addr); + + if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 )) + munmap( addr, pagesize ); /* someone beat us to it */ + } + + ret = (void *)((unsigned long)shm_addrs[entry] + offset); + + pthread_mutex_unlock( &shm_addrs_mutex ); + + return ret; +} + +/* We'd like lookup to be fast. To that end, we use a static list indexed by handle. + * This is copied and adapted from the fd cache code. */ + +#define ESYNC_LIST_BLOCK_SIZE (65536 / sizeof(struct esync)) +#define ESYNC_LIST_ENTRIES 256 + +static struct esync *esync_list[ESYNC_LIST_ENTRIES]; +static struct esync esync_list_initial_block[ESYNC_LIST_BLOCK_SIZE]; + +static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) +{ + UINT_PTR idx = (((UINT_PTR)handle) >> 2) - 1; + *entry = idx / ESYNC_LIST_BLOCK_SIZE; + return idx % ESYNC_LIST_BLOCK_SIZE; +} + +static struct esync *add_to_list( HANDLE handle, enum esync_type type, int fd, void *shm ) +{ + UINT_PTR entry, idx = handle_to_index( handle, &entry ); + + if (entry >= ESYNC_LIST_ENTRIES) + { + FIXME( "too many allocated handles, not caching %p\n", handle ); + return FALSE; + } + + if (!esync_list[entry]) /* do we need to allocate a new block of entries? */ + { + if (!entry) esync_list[0] = esync_list_initial_block; + else + { + void *ptr = anon_mmap_alloc( ESYNC_LIST_BLOCK_SIZE * sizeof(struct esync), + PROT_READ | PROT_WRITE ); + if (ptr == MAP_FAILED) return FALSE; + esync_list[entry] = ptr; + } + } + + if (!InterlockedCompareExchange( (LONG *)&esync_list[entry][idx].type, type, 0 )) + { + esync_list[entry][idx].fd = fd; + esync_list[entry][idx].shm = shm; + } + return &esync_list[entry][idx]; +} + +static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, int initval, int max ) +{ + NTSTATUS ret; + data_size_t len; + struct object_attributes *objattr; + obj_handle_t fd_handle; + unsigned int shm_idx; + sigset_t sigset; + int fd; + + if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; + + /* We have to synchronize on the fd cache CS so that our calls to + * receive_fd don't race with theirs. */ + server_enter_uninterrupted_section( &fd_cache_mutex, &sigset ); + SERVER_START_REQ( create_esync ) + { + req->access = access; + req->initval = initval; + req->type = type; + req->max = max; + wine_server_add_data( req, objattr, len ); + ret = wine_server_call( req ); + if (!ret || ret == STATUS_OBJECT_NAME_EXISTS) + { + *handle = wine_server_ptr_handle( reply->handle ); + type = reply->type; + shm_idx = reply->shm_idx; + fd = receive_fd( &fd_handle ); + assert( wine_server_ptr_handle(fd_handle) == *handle ); + } + } + SERVER_END_REQ; + server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); + + if (!ret || ret == STATUS_OBJECT_NAME_EXISTS) + { + add_to_list( *handle, type, fd, shm_idx ? get_shm( shm_idx ) : 0 ); + TRACE("-> handle %p, fd %d.\n", *handle, fd); + } + + free( objattr ); + return ret; +} + +extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) +{ + TRACE("name %s, initial %d, max %d.\n", + attr ? debugstr_us(attr->ObjectName) : "", (int)initial, (int)max); + + return create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial, max ); +} + +void esync_init(void) +{ + struct stat st; + + if (!do_esync()) + { + /* make sure the server isn't running with WINEESYNC */ + HANDLE handle; + NTSTATUS ret; + + ret = create_esync( 0, &handle, 0, NULL, 0, 0 ); + if (ret != STATUS_NOT_IMPLEMENTED) + { + ERR("Server is running with WINEESYNC but this process is not, please enable WINEESYNC or restart wineserver.\n"); + exit(1); + } + + return; + } + + if (stat( config_dir, &st ) == -1) + ERR("Cannot stat %s\n", config_dir); + + if (st.st_ino != (unsigned long)st.st_ino) + sprintf( shm_name, "/wine-%lx%08lx-esync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino ); + else + sprintf( shm_name, "/wine-%lx-esync", (unsigned long)st.st_ino ); + + if ((shm_fd = shm_open( shm_name, O_RDWR, 0644 )) == -1) + { + /* probably the server isn't running with WINEESYNC, tell the user and bail */ + if (errno == ENOENT) + ERR("Failed to open esync shared memory file; make sure no stale wineserver instances are running without WINEESYNC.\n"); + else + ERR("Failed to initialize shared memory: %s\n", strerror( errno )); + exit(1); + } + + pagesize = sysconf( _SC_PAGESIZE ); + + shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); + shm_addrs_size = 128; +} diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h new file mode 100644 index 00000000000..5fec18860f8 --- /dev/null +++ b/dlls/ntdll/unix/esync.h @@ -0,0 +1,35 @@ +/* + * eventfd-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +extern int do_esync(void); +extern void esync_init(void); + +extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); + + +/* We have to synchronize on the fd cache mutex so that our calls to receive_fd + * don't race with theirs. It looks weird, I know. + * + * If we weren't trying to avoid touching the code I'd rename the mutex to + * "server_fd_mutex" or something similar. */ +extern pthread_mutex_t fd_cache_mutex; + +extern int receive_fd( obj_handle_t *handle ); diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index dd30c79f755..93331de1b1f 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -88,6 +88,7 @@ extern char **environ; #include "winioctl.h" #include "winternl.h" #include "unix_private.h" +#include "esync.h" #include "wine/list.h" #include "ntsyscalls.h" #include "wine/debug.h" @@ -1959,6 +1960,7 @@ static void start_main_thread(void) dbg_init(); startup_info_size = server_init_process(); hacks_init(); + esync_init(); virtual_map_user_shared_data(); init_cpu_info(); init_files(); diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 53fcc61ccf3..79e2a9171c3 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -103,7 +103,7 @@ sigset_t server_block_set; /* signals to block during server calls */ static int fd_socket = -1; /* socket to exchange file descriptors with the server */ static int initial_cwd = -1; static pid_t server_pid; -static pthread_mutex_t fd_cache_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t fd_cache_mutex = PTHREAD_MUTEX_INITIALIZER; /* atomically exchange a 64-bit value */ static inline LONG64 interlocked_xchg64( LONG64 *dest, LONG64 val ) @@ -918,7 +918,7 @@ void wine_server_send_fd( int fd ) * * Receive a file descriptor passed from the server. */ -static int receive_fd( obj_handle_t *handle ) +int receive_fd( obj_handle_t *handle ) { struct iovec vec; struct msghdr msghdr; diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index bfbcaf4a851..f21ceb80298 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -63,6 +63,7 @@ #include "wine/server.h" #include "wine/debug.h" #include "unix_private.h" +#include "esync.h" WINE_DEFAULT_DEBUG_CHANNEL(sync); @@ -272,6 +273,9 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ if (max <= 0 || initial < 0 || initial > max) return STATUS_INVALID_PARAMETER; if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; + if (do_esync()) + return esync_create_semaphore( handle, access, attr, initial, max ); + SERVER_START_REQ( create_semaphore ) { req->access = access; diff --git a/server/esync.c b/server/esync.c index 35b4833fd4c..75ef586df30 100644 --- a/server/esync.c +++ b/server/esync.c @@ -41,6 +41,7 @@ #include "handle.h" #include "request.h" #include "file.h" +#include "esync.h" int do_esync(void) { From 1082e15153485344d6037fbbb6fb008fcbc22b9f Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 12:16:34 -0500 Subject: [PATCH 0431/1506] ntdll: Implement NtReleaseSemaphore(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 43 +++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 47 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 89b8542433e..50bf84eabe5 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #ifdef HAVE_SYS_STAT_H @@ -170,6 +171,16 @@ static struct esync *add_to_list( HANDLE handle, enum esync_type type, int fd, v return &esync_list[entry][idx]; } +static struct esync *get_cached_object( HANDLE handle ) +{ + UINT_PTR entry, idx = handle_to_index( handle, &entry ); + + if (entry >= ESYNC_LIST_ENTRIES || !esync_list[entry]) return NULL; + if (!esync_list[entry][idx].type) return NULL; + + return &esync_list[entry][idx]; +} + static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval, int max ) { @@ -225,6 +236,38 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, return create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial, max ); } +NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) +{ + struct esync *obj; + struct semaphore *semaphore; + uint64_t count64 = count; + ULONG current; + + TRACE("%p, %d, %p.\n", handle, (int)count, prev); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + semaphore = obj->shm; + + do + { + current = semaphore->count; + + if (count + current > semaphore->max) + return STATUS_SEMAPHORE_LIMIT_EXCEEDED; + } while (InterlockedCompareExchange( (LONG *)&semaphore->count, count + current, current ) != current); + + if (prev) *prev = current; + + /* We don't have to worry about a race between increasing the count and + * write(). The fact that we were able to increase the count means that we + * have permission to actually write that many releases to the semaphore. */ + + if (write( obj->fd, &count64, sizeof(count64) ) == -1) + return errno_to_status( errno ); + + return STATUS_SUCCESS; +} + void esync_init(void) { struct stat st; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 5fec18860f8..cbaaed3e308 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -23,6 +23,7 @@ extern void esync_init(void); extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); +extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); /* We have to synchronize on the fd cache mutex so that our calls to receive_fd diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index f21ceb80298..c85f985b4f3 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -358,6 +358,9 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, ULONG *previous { unsigned int ret; + if (do_esync()) + return esync_release_semaphore( handle, count, previous ); + SERVER_START_REQ( release_semaphore ) { req->handle = wine_server_obj_handle( handle ); From 892833113c5867a74a59aea5e514634d9ce90c6a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 12:20:44 -0500 Subject: [PATCH 0432/1506] ntdll: Implement NtClose(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 18 ++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/server.c | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 50bf84eabe5..e289dc13c01 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -181,6 +181,24 @@ static struct esync *get_cached_object( HANDLE handle ) return &esync_list[entry][idx]; } +NTSTATUS esync_close( HANDLE handle ) +{ + UINT_PTR entry, idx = handle_to_index( handle, &entry ); + + TRACE("%p.\n", handle); + + if (entry < ESYNC_LIST_ENTRIES && esync_list[entry]) + { + if (InterlockedExchange((LONG *)&esync_list[entry][idx].type, 0)) + { + close( esync_list[entry][idx].fd ); + return STATUS_SUCCESS; + } + } + + return STATUS_INVALID_HANDLE; +} + static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval, int max ) { diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index cbaaed3e308..c63491dcaad 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -20,6 +20,7 @@ extern int do_esync(void); extern void esync_init(void); +extern NTSTATUS esync_close( HANDLE handle ); extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 79e2a9171c3..8cbebd34b5f 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -79,6 +79,7 @@ #include "wine/server.h" #include "wine/debug.h" #include "unix_private.h" +#include "esync.h" #include "ddk/wdm.h" WINE_DEFAULT_DEBUG_CHANNEL(server); @@ -1841,6 +1842,9 @@ NTSTATUS WINAPI NtClose( HANDLE handle ) * retrieve it again */ fd = remove_fd_from_cache( handle ); + if (do_esync()) + esync_close( handle ); + SERVER_START_REQ( close_handle ) { req->handle = wine_server_obj_handle( handle ); From 4aed3c7ce6138708368dec1aea1a01475b1043b5 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 12:34:42 -0500 Subject: [PATCH 0433/1506] ntdll: Implement NtWaitForMultipleObjects(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 168 ++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 3 + dlls/ntdll/unix/sync.c | 7 ++ 3 files changed, 178 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index e289dc13c01..660809bcfab 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -34,6 +34,12 @@ #ifdef HAVE_SYS_STAT_H # include #endif +#ifdef HAVE_POLL_H +#include +#endif +#ifdef HAVE_SYS_POLL_H +# include +#endif #include #include @@ -286,6 +292,168 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) return STATUS_SUCCESS; } +#define TICKSPERSEC 10000000 +#define TICKSPERMSEC 10000 + +static LONGLONG update_timeout( ULONGLONG end ) +{ + LARGE_INTEGER now; + LONGLONG timeleft; + + NtQuerySystemTime( &now ); + timeleft = end - now.QuadPart; + if (timeleft < 0) timeleft = 0; + return timeleft; +} + +static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end ) +{ + if (end) + { + LONGLONG timeleft = update_timeout( *end ); + +#ifdef HAVE_PPOLL + /* We use ppoll() if available since the time granularity is better. */ + struct timespec tmo_p; + tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; + return ppoll( fds, nfds, &tmo_p, NULL ); +#else + return poll( fds, nfds, timeleft / TICKSPERMSEC ); +#endif + } + else + return poll( fds, nfds, -1 ); +} + +static void update_grabbed_object( struct esync *obj ) +{ + if (obj->type == ESYNC_SEMAPHORE) + { + struct semaphore *semaphore = obj->shm; + /* We don't have to worry about a race between this and read(); the + * fact that we were able to grab it at all means the count is nonzero, + * and if someone else grabbed it then the count must have been >= 2, + * etc. */ + InterlockedExchangeAdd( (LONG *)&semaphore->count, -1 ); + } +} + +/* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we + * need to delegate to server_select(). */ +NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, + BOOLEAN alertable, const LARGE_INTEGER *timeout ) +{ + struct esync *objs[MAXIMUM_WAIT_OBJECTS]; + struct pollfd fds[MAXIMUM_WAIT_OBJECTS]; + int has_esync = 0, has_server = 0; + LONGLONG timeleft; + LARGE_INTEGER now; + ULONGLONG end; + int i, ret; + + NtQuerySystemTime( &now ); + if (timeout) + { + if (timeout->QuadPart == TIMEOUT_INFINITE) + timeout = NULL; + else if (timeout->QuadPart >= 0) + end = timeout->QuadPart; + else + end = now.QuadPart - timeout->QuadPart; + } + + for (i = 0; i < count; i++) + { + if ((objs[i] = get_cached_object( handles[i] ))) + has_esync = 1; + else + has_server = 1; + } + + if (has_esync && has_server) + FIXME("Can't wait on esync and server objects at the same time!\n"); + else if (has_server) + return STATUS_NOT_IMPLEMENTED; + + if (TRACE_ON(esync)) + { + TRACE("Waiting for %s of %d handles:", wait_any ? "any" : "all", (int)count); + for (i = 0; i < count; i++) + TRACE(" %p", handles[i]); + + if (!timeout) + TRACE(", timeout = INFINITE.\n"); + else + { + timeleft = update_timeout( end ); + TRACE(", timeout = %ld.%07ld sec.\n", + (long) timeleft / TICKSPERSEC, (long) timeleft % TICKSPERSEC); + } + } + + if (wait_any || count == 1) + { + for (i = 0; i < count; i++) + { + fds[i].fd = objs[i] ? objs[i]->fd : -1; + fds[i].events = POLLIN; + } + + while (1) + { + ret = do_poll( fds, count, timeout ? &end : NULL ); + if (ret > 0) + { + /* Find out which object triggered the wait. */ + for (i = 0; i < count; i++) + { + struct esync *obj = objs[i]; + + if (fds[i].revents & (POLLERR | POLLHUP | POLLNVAL)) + { + ERR("Polling on fd %d returned %#x.\n", fds[i].fd, fds[i].revents); + return STATUS_INVALID_HANDLE; + } + + if (obj) + { + int64_t value; + ssize_t size; + + if ((size = read( fds[i].fd, &value, sizeof(value) )) == sizeof(value)) + { + /* We found our object. */ + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + update_grabbed_object( obj ); + return i; + } + } + } + + /* If we got here, someone else stole (or reset, etc.) whatever + * we were waiting for. So keep waiting. */ + NtQuerySystemTime( &now ); + } + else if (ret == 0) + { + TRACE("Wait timed out.\n"); + return STATUS_TIMEOUT; + } + else + { + ERR("ppoll failed: %s\n", strerror( errno )); + return errno_to_status( errno ); + } + } + } + else + { + FIXME("Wait-all not implemented.\n"); + return STATUS_NOT_IMPLEMENTED; + } +} + void esync_init(void) { struct stat st; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index c63491dcaad..92b609ebd27 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -26,6 +26,9 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); +extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, + BOOLEAN alertable, const LARGE_INTEGER *timeout ); + /* We have to synchronize on the fd cache mutex so that our calls to receive_fd * don't race with theirs. It looks weird, I know. diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index c85f985b4f3..79141999e33 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1479,6 +1479,13 @@ NTSTATUS WINAPI NtWaitForMultipleObjects( DWORD count, const HANDLE *handles, BO if (!count || count > MAXIMUM_WAIT_OBJECTS) return STATUS_INVALID_PARAMETER_1; + if (do_esync()) + { + NTSTATUS ret = esync_wait_objects( count, handles, wait_any, alertable, timeout ); + if (ret != STATUS_NOT_IMPLEMENTED) + return ret; + } + if (alertable) flags |= SELECT_ALERTABLE; select_op.wait.op = wait_any ? SELECT_WAIT : SELECT_WAIT_ALL; for (i = 0; i < count; i++) select_op.wait.handles[i] = wine_server_obj_handle( handles[i] ); From 3376970bcc3053275aa658efbf0ede282e089eac Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 14:40:43 -0500 Subject: [PATCH 0434/1506] ntdll, server: Implement NtCreateEvent(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 27 +++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 3 +++ dlls/ntdll/unix/sync.c | 4 ++++ server/esync.c | 15 +++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 660809bcfab..a072f6f4804 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -86,6 +86,13 @@ struct semaphore }; C_ASSERT(sizeof(struct semaphore) == 8); +struct event +{ + int signaled; + int locked; +}; +C_ASSERT(sizeof(struct event) == 8); + static char shm_name[29]; static int shm_fd; static void **shm_addrs; @@ -292,6 +299,18 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) return STATUS_SUCCESS; } +NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, EVENT_TYPE event_type, BOOLEAN initial ) +{ + enum esync_type type = (event_type == SynchronizationEvent ? ESYNC_AUTO_EVENT : ESYNC_MANUAL_EVENT); + + TRACE("name %s, %s-reset, initial %d.\n", + attr ? debugstr_us(attr->ObjectName) : "", + event_type == NotificationEvent ? "manual" : "auto", initial); + + return create_esync( type, handle, access, attr, initial, 0 ); +} + #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 @@ -337,6 +356,14 @@ static void update_grabbed_object( struct esync *obj ) * etc. */ InterlockedExchangeAdd( (LONG *)&semaphore->count, -1 ); } + else if (obj->type == ESYNC_AUTO_EVENT) + { + struct event *event = obj->shm; + /* We don't have to worry about a race between this and read(), since + * this is just a hint, and the real state is in the kernel object. + * This might already be 0, but that's okay! */ + event->signaled = 0; + } } /* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 92b609ebd27..7bb963faf51 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -26,6 +26,9 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); +extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); + extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 79141999e33..161c170f59c 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -387,6 +387,10 @@ NTSTATUS WINAPI NtCreateEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_ *handle = 0; if (type != NotificationEvent && type != SynchronizationEvent) return STATUS_INVALID_PARAMETER; + + if (do_esync()) + return esync_create_event( handle, access, attr, type, state ); + if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; SERVER_START_REQ( create_event ) diff --git a/server/esync.c b/server/esync.c index 75ef586df30..6a63c0dd5e9 100644 --- a/server/esync.c +++ b/server/esync.c @@ -201,6 +201,13 @@ struct semaphore }; C_ASSERT(sizeof(struct semaphore) == 8); +struct event +{ + int signaled; + int locked; +}; +C_ASSERT(sizeof(struct event) == 8); + struct esync *create_esync( struct object *root, const struct unicode_str *name, unsigned int attr, int initval, int max, enum esync_type type, const struct security_descriptor *sd ) @@ -256,6 +263,14 @@ struct esync *create_esync( struct object *root, const struct unicode_str *name, semaphore->count = initval; break; } + case ESYNC_AUTO_EVENT: + case ESYNC_MANUAL_EVENT: + { + struct event *event = get_shm( esync->shm_idx ); + event->signaled = initval ? 1 : 0; + event->locked = 0; + break; + } default: assert( 0 ); } From 08d235715f47953ae5c9d5d00cf2bf8c008b6741 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 14:46:24 -0500 Subject: [PATCH 0435/1506] ntdll: Implement NtSetEvent(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 15 +++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index a072f6f4804..34314d8cb32 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -311,6 +311,21 @@ NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, return create_esync( type, handle, access, attr, initial, 0 ); } +NTSTATUS esync_set_event( HANDLE handle ) +{ + static const uint64_t value = 1; + struct esync *obj; + + TRACE("%p.\n", handle); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + + if (write( obj->fd, &value, sizeof(value) ) == -1) + ERR("write: %s\n", strerror(errno)); + + return STATUS_SUCCESS; +} + #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 7bb963faf51..d92165214d6 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -28,6 +28,7 @@ extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); +extern NTSTATUS esync_set_event( HANDLE handle ); extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 161c170f59c..706d381d7c7 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -439,8 +439,12 @@ NTSTATUS WINAPI NtOpenEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_AT */ NTSTATUS WINAPI NtSetEvent( HANDLE handle, LONG *prev_state ) { + /* This comment is a dummy to make sure this patch applies in the right place. */ unsigned int ret; + if (do_esync()) + return esync_set_event( handle ); + SERVER_START_REQ( event_op ) { req->handle = wine_server_obj_handle( handle ); From c3bb69414f02d41a29d3df6eb7e79b64af8b1a27 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 14:51:21 -0500 Subject: [PATCH 0436/1506] ntdll: Implement NtResetEvent(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 15 +++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 34314d8cb32..5f4904d4872 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -326,6 +326,21 @@ NTSTATUS esync_set_event( HANDLE handle ) return STATUS_SUCCESS; } +NTSTATUS esync_reset_event( HANDLE handle ) +{ + uint64_t value; + struct esync *obj; + + TRACE("%p.\n", handle); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + + if (read( obj->fd, &value, sizeof(value) ) == -1 && errno != EWOULDBLOCK && errno != EAGAIN) + ERR("read: %s\n", strerror(errno)); + + return STATUS_SUCCESS; +} + #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index d92165214d6..6e5d6233a2e 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -28,6 +28,7 @@ extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); +extern NTSTATUS esync_reset_event( HANDLE handle ); extern NTSTATUS esync_set_event( HANDLE handle ); extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 706d381d7c7..fdf4215039b 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -462,8 +462,13 @@ NTSTATUS WINAPI NtSetEvent( HANDLE handle, LONG *prev_state ) */ NTSTATUS WINAPI NtResetEvent( HANDLE handle, LONG *prev_state ) { + /* This comment is a dummy to make sure this patch applies in the right place. */ unsigned int ret; + if (do_esync()) + return esync_reset_event( handle ); + + SERVER_START_REQ( event_op ) { req->handle = wine_server_obj_handle( handle ); From fa7783e45e59c933a8938079d6733fe64e61b040 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 14:57:42 -0500 Subject: [PATCH 0437/1506] ntdll: Implement waiting on manual-reset events. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 5f4904d4872..0d15defdd9c 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -34,12 +34,7 @@ #ifdef HAVE_SYS_STAT_H # include #endif -#ifdef HAVE_POLL_H #include -#endif -#ifdef HAVE_SYS_POLL_H -# include -#endif #include #include @@ -478,12 +473,24 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an int64_t value; ssize_t size; - if ((size = read( fds[i].fd, &value, sizeof(value) )) == sizeof(value)) + if (obj->type == ESYNC_MANUAL_EVENT) + { + /* Don't grab the object, just check if it's signaled. */ + if (fds[i].revents & POLLIN) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + } + else { - /* We found our object. */ - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - update_grabbed_object( obj ); - return i; + if ((size = read( fds[i].fd, &value, sizeof(value) )) == sizeof(value)) + { + /* We found our object. */ + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + update_grabbed_object( obj ); + return i; + } } } } From 37eb12f03153dfad7554e7fee4a621ec501167f7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 18:51:40 -0500 Subject: [PATCH 0438/1506] server: Add an object operation to grab the esync file descriptor. Split off to decrease patch size. Wine-Staging: eventfd_synchronization --- server/async.c | 2 ++ server/atom.c | 1 + server/change.c | 1 + server/clipboard.c | 1 + server/completion.c | 1 + server/console.c | 7 +++++++ server/debugger.c | 2 ++ server/device.c | 4 ++++ server/directory.c | 2 ++ server/esync.c | 1 + server/event.c | 2 ++ server/fd.c | 4 ++++ server/file.c | 1 + server/handle.c | 1 + server/hook.c | 1 + server/mailslot.c | 4 ++++ server/mapping.c | 3 +++ server/mutex.c | 1 + server/named_pipe.c | 5 +++++ server/object.h | 2 ++ server/process.c | 3 +++ server/queue.c | 2 ++ server/registry.c | 1 + server/request.c | 1 + server/semaphore.c | 1 + server/serial.c | 1 + server/signal.c | 1 + server/sock.c | 3 +++ server/symlink.c | 1 + server/thread.c | 3 +++ server/timer.c | 1 + server/token.c | 1 + server/window.c | 1 + server/winstation.c | 2 ++ 34 files changed, 68 insertions(+) diff --git a/server/async.c b/server/async.c index 9cb251df5ce..337bba8631b 100644 --- a/server/async.c +++ b/server/async.c @@ -77,6 +77,7 @@ static const struct object_ops async_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ async_signaled, /* signaled */ + NULL, /* get_esync_fd */ async_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -676,6 +677,7 @@ static const struct object_ops iosb_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/atom.c b/server/atom.c index ff0799f5880..d9824de8eac 100644 --- a/server/atom.c +++ b/server/atom.c @@ -79,6 +79,7 @@ static const struct object_ops atom_table_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/change.c b/server/change.c index 843e495411c..5f1cf9b880b 100644 --- a/server/change.c +++ b/server/change.c @@ -112,6 +112,7 @@ static const struct object_ops dir_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ dir_get_fd, /* get_fd */ diff --git a/server/clipboard.c b/server/clipboard.c index 8118a467dd8..8b265f2dcea 100644 --- a/server/clipboard.c +++ b/server/clipboard.c @@ -76,6 +76,7 @@ static const struct object_ops clipboard_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/completion.c b/server/completion.c index 6933195e72d..3d4be86a212 100644 --- a/server/completion.c +++ b/server/completion.c @@ -75,6 +75,7 @@ static const struct object_ops completion_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ completion_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/console.c b/server/console.c index b64283baf4a..1cc9eea6a50 100644 --- a/server/console.c +++ b/server/console.c @@ -81,6 +81,7 @@ static const struct object_ops console_ops = console_add_queue, /* add_queue */ remove_queue, /* remove_queue */ console_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_get_fd, /* get_fd */ @@ -158,6 +159,7 @@ static const struct object_ops console_server_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ console_server_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_server_get_fd, /* get_fd */ @@ -227,6 +229,7 @@ static const struct object_ops screen_buffer_ops = screen_buffer_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ screen_buffer_get_fd, /* get_fd */ @@ -276,6 +279,7 @@ static const struct object_ops console_device_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -313,6 +317,7 @@ static const struct object_ops console_input_ops = console_input_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_input_get_fd, /* get_fd */ @@ -370,6 +375,7 @@ static const struct object_ops console_output_ops = console_output_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_output_get_fd, /* get_fd */ @@ -428,6 +434,7 @@ static const struct object_ops console_connection_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_connection_get_fd, /* get_fd */ diff --git a/server/debugger.c b/server/debugger.c index 48adb244b09..d85a2000684 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -86,6 +86,7 @@ static const struct object_ops debug_event_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ debug_event_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -114,6 +115,7 @@ static const struct object_ops debug_obj_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ debug_obj_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/device.c b/server/device.c index 436dac6bfe9..f730fa81afa 100644 --- a/server/device.c +++ b/server/device.c @@ -66,6 +66,7 @@ static const struct object_ops irp_call_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -106,6 +107,7 @@ static const struct object_ops device_manager_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ device_manager_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -163,6 +165,7 @@ static const struct object_ops device_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -215,6 +218,7 @@ static const struct object_ops device_file_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ device_file_get_fd, /* get_fd */ diff --git a/server/directory.c b/server/directory.c index e169cc2d011..dc3f0cf3cf8 100644 --- a/server/directory.c +++ b/server/directory.c @@ -70,6 +70,7 @@ static const struct object_ops object_type_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -120,6 +121,7 @@ static const struct object_ops directory_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/esync.c b/server/esync.c index 6a63c0dd5e9..f95dc5a391f 100644 --- a/server/esync.c +++ b/server/esync.c @@ -122,6 +122,7 @@ static const struct object_ops esync_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/event.c b/server/event.c index f1b79b1b35e..c727bfdd1ba 100644 --- a/server/event.c +++ b/server/event.c @@ -72,6 +72,7 @@ static const struct object_ops event_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ event_signaled, /* signaled */ + NULL, /* get_esync_fd */ event_satisfied, /* satisfied */ event_signal, /* signal */ no_get_fd, /* get_fd */ @@ -119,6 +120,7 @@ static const struct object_ops keyed_event_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ keyed_event_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/fd.c b/server/fd.c index 8576882aaa9..f9f747016b3 100644 --- a/server/fd.c +++ b/server/fd.c @@ -169,6 +169,7 @@ static const struct object_ops fd_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -210,6 +211,7 @@ static const struct object_ops device_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -250,6 +252,7 @@ static const struct object_ops inode_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -292,6 +295,7 @@ static const struct object_ops file_lock_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ file_lock_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/file.c b/server/file.c index 76c687833c9..26c62809d33 100644 --- a/server/file.c +++ b/server/file.c @@ -94,6 +94,7 @@ static const struct object_ops file_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ file_get_fd, /* get_fd */ diff --git a/server/handle.c b/server/handle.c index 0595fdb403b..d41c7e86454 100644 --- a/server/handle.c +++ b/server/handle.c @@ -126,6 +126,7 @@ static const struct object_ops handle_table_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/hook.c b/server/hook.c index dd3657c2eac..95a588c843b 100644 --- a/server/hook.c +++ b/server/hook.c @@ -80,6 +80,7 @@ static const struct object_ops hook_table_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/mailslot.c b/server/mailslot.c index 2d8697ec9bd..4cf9b73f784 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -74,6 +74,7 @@ static const struct object_ops mailslot_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ mailslot_get_fd, /* get_fd */ @@ -133,6 +134,7 @@ static const struct object_ops mail_writer_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ mail_writer_get_fd, /* get_fd */ @@ -196,6 +198,7 @@ static const struct object_ops mailslot_device_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -226,6 +229,7 @@ static const struct object_ops mailslot_device_file_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ mailslot_device_file_get_fd, /* get_fd */ diff --git a/server/mapping.c b/server/mapping.c index 7a07575bca2..bc971fa91c4 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -72,6 +72,7 @@ static const struct object_ops ranges_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -108,6 +109,7 @@ static const struct object_ops shared_map_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -182,6 +184,7 @@ static const struct object_ops mapping_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ mapping_get_fd, /* get_fd */ diff --git a/server/mutex.c b/server/mutex.c index af0efe72132..4785a830e92 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -73,6 +73,7 @@ static const struct object_ops mutex_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ mutex_signaled, /* signaled */ + NULL, /* get_esync_fd */ mutex_satisfied, /* satisfied */ mutex_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/named_pipe.c b/server/named_pipe.c index f3404a33c3b..f28cb14cb45 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -119,6 +119,7 @@ static const struct object_ops named_pipe_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -167,6 +168,7 @@ static const struct object_ops pipe_server_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ @@ -211,6 +213,7 @@ static const struct object_ops pipe_client_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ @@ -258,6 +261,7 @@ static const struct object_ops named_pipe_device_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -289,6 +293,7 @@ static const struct object_ops named_pipe_device_file_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ named_pipe_device_file_get_fd, /* get_fd */ diff --git a/server/object.h b/server/object.h index 66012fbc4af..51ee819415a 100644 --- a/server/object.h +++ b/server/object.h @@ -78,6 +78,8 @@ struct object_ops void (*remove_queue)(struct object *,struct wait_queue_entry *); /* is object signaled? */ int (*signaled)(struct object *,struct wait_queue_entry *); + /* return the esync fd for this object */ + int (*get_esync_fd)(struct object *, enum esync_type *type); /* wait satisfied */ void (*satisfied)(struct object *,struct wait_queue_entry *); /* signal an object */ diff --git a/server/process.c b/server/process.c index a0d5ea64d97..777bf7c2fe2 100644 --- a/server/process.c +++ b/server/process.c @@ -105,6 +105,7 @@ static const struct object_ops process_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ process_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -156,6 +157,7 @@ static const struct object_ops startup_info_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ startup_info_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -217,6 +219,7 @@ static const struct object_ops job_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ job_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/queue.c b/server/queue.c index 7a4d45659ba..e709f0348f8 100644 --- a/server/queue.c +++ b/server/queue.c @@ -166,6 +166,7 @@ static const struct object_ops msg_queue_ops = msg_queue_add_queue, /* add_queue */ msg_queue_remove_queue, /* remove_queue */ msg_queue_signaled, /* signaled */ + NULL, /* get_esync_fd */ msg_queue_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -203,6 +204,7 @@ static const struct object_ops thread_input_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/registry.c b/server/registry.c index 0128b8be9d8..c071f42532b 100644 --- a/server/registry.c +++ b/server/registry.c @@ -180,6 +180,7 @@ static const struct object_ops key_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/request.c b/server/request.c index 7021741c765..ca83fdbd2af 100644 --- a/server/request.c +++ b/server/request.c @@ -90,6 +90,7 @@ static const struct object_ops master_socket_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/semaphore.c b/server/semaphore.c index 53b42a886df..e3889f24601 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -70,6 +70,7 @@ static const struct object_ops semaphore_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ semaphore_signaled, /* signaled */ + NULL, /* get_esync_fd */ semaphore_satisfied, /* satisfied */ semaphore_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/serial.c b/server/serial.c index d665eb7fa35..11e204e4419 100644 --- a/server/serial.c +++ b/server/serial.c @@ -85,6 +85,7 @@ static const struct object_ops serial_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ serial_get_fd, /* get_fd */ diff --git a/server/signal.c b/server/signal.c index 19b76d44c16..55cd6aa037e 100644 --- a/server/signal.c +++ b/server/signal.c @@ -62,6 +62,7 @@ static const struct object_ops handler_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/sock.c b/server/sock.c index 84c0d4a4931..177e7e6dded 100644 --- a/server/sock.c +++ b/server/sock.c @@ -453,6 +453,7 @@ static const struct object_ops sock_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ sock_get_fd, /* get_fd */ @@ -3554,6 +3555,7 @@ static const struct object_ops ifchange_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ ifchange_get_fd, /* get_fd */ @@ -3775,6 +3777,7 @@ static const struct object_ops socket_device_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/symlink.c b/server/symlink.c index dd28efd3a75..c7f34412317 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -71,6 +71,7 @@ static const struct object_ops symlink_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/thread.c b/server/thread.c index 08742786b03..f579ffddad8 100644 --- a/server/thread.c +++ b/server/thread.c @@ -100,6 +100,7 @@ static const struct object_ops thread_apc_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ thread_apc_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -142,6 +143,7 @@ static const struct object_ops context_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ context_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -191,6 +193,7 @@ static const struct object_ops thread_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ thread_signaled, /* signaled */ + NULL, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/timer.c b/server/timer.c index 96dc9d00ca1..f59902d5607 100644 --- a/server/timer.c +++ b/server/timer.c @@ -76,6 +76,7 @@ static const struct object_ops timer_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ timer_signaled, /* signaled */ + NULL, /* get_esync_fd */ timer_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/token.c b/server/token.c index 4df8d2e0c6e..8b4d2f0c1b1 100644 --- a/server/token.c +++ b/server/token.c @@ -143,6 +143,7 @@ static const struct object_ops token_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/window.c b/server/window.c index bd11d0d32de..f6b9a25baa4 100644 --- a/server/window.c +++ b/server/window.c @@ -107,6 +107,7 @@ static const struct object_ops window_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/winstation.c b/server/winstation.c index a0c41ea21a2..ae1123c1d38 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -76,6 +76,7 @@ static const struct object_ops winstation_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -116,6 +117,7 @@ static const struct object_ops desktop_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ + NULL, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ From b277f205b956f0ef0f66259e2f9d0cd97514c206 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 18:55:49 -0500 Subject: [PATCH 0439/1506] server: Add a request to get the eventfd file descriptor associated with a waitable handle. Wine-Staging: eventfd_synchronization --- server/esync.c | 37 +++++++++++++++++++++++++++++++++++++ server/protocol.def | 8 ++++++++ 2 files changed, 45 insertions(+) diff --git a/server/esync.c b/server/esync.c index f95dc5a391f..85f7f1e060f 100644 --- a/server/esync.c +++ b/server/esync.c @@ -333,3 +333,40 @@ DECL_HANDLER(create_esync) if (root) release_object( root ); } + +/* Retrieve a file descriptor for an esync object which will be signaled by the + * server. The client should only read from (i.e. wait on) this object. */ +DECL_HANDLER(get_esync_fd) +{ + struct object *obj; + enum esync_type type; + int fd; + + if (!(obj = get_handle_obj( current->process, req->handle, SYNCHRONIZE, NULL ))) + return; + + if (obj->ops->get_esync_fd) + { + fd = obj->ops->get_esync_fd( obj, &type ); + reply->type = type; + if (obj->ops == &esync_ops) + { + struct esync *esync = (struct esync *)obj; + reply->shm_idx = esync->shm_idx; + } + else + reply->shm_idx = 0; + send_client_fd( current->process, fd, req->handle ); + } + else + { + if (debug_level) + { + fprintf( stderr, "%04x: esync: can't wait on object: ", current->id ); + obj->ops->dump( obj, 0 ); + } + set_error( STATUS_NOT_IMPLEMENTED ); + } + + release_object( obj ); +} diff --git a/server/protocol.def b/server/protocol.def index a9fb8a2ede0..6e67af1636e 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3962,3 +3962,11 @@ enum esync_type int type; /* actual type (may be different for events) */ unsigned int shm_idx; @END + +/* Retrieve the esync fd for an object. */ +@REQ(get_esync_fd) + obj_handle_t handle; /* handle to the object */ +@REPLY + int type; + unsigned int shm_idx; +@END From f8408057d3999cc4f481f8cad37642e4458c3834 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 15:11:12 -0500 Subject: [PATCH 0440/1506] server: Create eventfd file descriptors for process objects. Wine-Staging: eventfd_synchronization --- server/esync.c | 18 ++++++++++++++++++ server/esync.h | 1 + server/process.c | 16 +++++++++++++++- server/process.h | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/server/esync.c b/server/esync.c index 85f7f1e060f..44214e5fe02 100644 --- a/server/esync.c +++ b/server/esync.c @@ -295,6 +295,24 @@ struct esync *create_esync( struct object *root, const struct unicode_str *name, #endif } +/* Create a file descriptor for an existing handle. + * Caller must close the handle when it's done; it's not linked to an esync + * server object in any way. */ +int esync_create_fd( int initval, int flags ) +{ +#ifdef HAVE_SYS_EVENTFD_H + int fd; + + fd = eventfd( initval, flags | EFD_CLOEXEC | EFD_NONBLOCK ); + if (fd == -1) + perror( "eventfd" ); + + return fd; +#else + return -1; +#endif +} + DECL_HANDLER(create_esync) { struct esync *esync; diff --git a/server/esync.h b/server/esync.h index 00f9e638d83..8522d8a69ae 100644 --- a/server/esync.h +++ b/server/esync.h @@ -22,3 +22,4 @@ extern int do_esync(void); void esync_init(void); +int esync_create_fd( int initval, int flags ); diff --git a/server/process.c b/server/process.c index 777bf7c2fe2..f5b919cba00 100644 --- a/server/process.c +++ b/server/process.c @@ -63,6 +63,7 @@ #include "request.h" #include "user.h" #include "security.h" +#include "esync.h" /* process object */ @@ -95,6 +96,7 @@ static struct security_descriptor *process_get_sd( struct object *obj ); static void process_poll_event( struct fd *fd, int event ); static struct list *process_get_kernel_obj_list( struct object *obj ); static void process_destroy( struct object *obj ); +static int process_get_esync_fd( struct object *obj, enum esync_type *type ); static void terminate_process( struct process *process, struct thread *skip, int exit_code ); static const struct object_ops process_ops = @@ -105,7 +107,7 @@ static const struct object_ops process_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ process_signaled, /* signaled */ - NULL, /* get_esync_fd */ + process_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -686,6 +688,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla process->rawinput_mouse = NULL; process->rawinput_kbd = NULL; memset( &process->image_info, 0, sizeof(process->image_info) ); + process->esync_fd = -1; list_init( &process->kernel_object ); list_init( &process->thread_list ); list_init( &process->locks ); @@ -742,6 +745,9 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla if (!token_assign_label( process->token, &high_label_sid )) goto error; + if (do_esync()) + process->esync_fd = esync_create_fd( 0, 0 ); + set_fd_events( process->msg_fd, POLLIN ); /* start listening to events */ return process; @@ -789,6 +795,7 @@ static void process_destroy( struct object *obj ) free( process->rawinput_devices ); free( process->dir_cache ); free( process->image ); + if (do_esync()) close( process->esync_fd ); } /* dump a process on stdout for debugging purposes */ @@ -806,6 +813,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry return !process->running_threads; } +static int process_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct process *process = (struct process *)obj; + *type = ESYNC_MANUAL_SERVER; + return process->esync_fd; +} + static unsigned int process_map_access( struct object *obj, unsigned int access ) { access = default_map_access( obj, access ); diff --git a/server/process.h b/server/process.h index 97e0d455ece..a0a071d8f88 100644 --- a/server/process.h +++ b/server/process.h @@ -85,6 +85,7 @@ struct process const struct rawinput_device *rawinput_kbd; /* rawinput keyboard device, if any */ struct list kernel_object; /* list of kernel object pointers */ pe_image_info_t image_info; /* main exe image info */ + int esync_fd; /* esync file descriptor (signaled on exit) */ }; /* process functions */ From 07524cd5960a10c10b2e357e1c385563d3f264db Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 15:19:37 -0500 Subject: [PATCH 0441/1506] ntdll, server: Implement waiting on server-bound objects. The code here is sort of self-explanatory, but since I split it up over several patches I'll provide a quick explanation. The basic principle is that we can create an eventfd descriptor for any synchronizable handle, and signal it on the server side whenever a wakeup would be triggered. This means not only that we can wait simultaneously on esync primitives and on other primitives, but that we can do it all in "user-mode", i.e. without having to make a server call. With this patch we break waiting on svcctl.exe. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 84 ++++++++++++++++++++++++++++++++++++++--- server/esync.c | 16 ++++++++ server/esync.h | 1 + server/thread.c | 4 ++ 4 files changed, 99 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 0d15defdd9c..e783517f644 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -189,6 +189,72 @@ static struct esync *get_cached_object( HANDLE handle ) return &esync_list[entry][idx]; } +/* Gets an object. This is either a proper esync object (i.e. an event, + * semaphore, etc. created using create_esync) or a generic synchronizable + * server-side object which the server will signal (e.g. a process, thread, + * message queue, etc.) */ +static NTSTATUS get_object( HANDLE handle, struct esync **obj ) +{ + NTSTATUS ret = STATUS_SUCCESS; + enum esync_type type = 0; + unsigned int shm_idx = 0; + obj_handle_t fd_handle; + sigset_t sigset; + int fd = -1; + + if ((*obj = get_cached_object( handle ))) return STATUS_SUCCESS; + + if ((INT_PTR)handle < 0) + { + /* We can deal with pseudo-handles, but it's just easier this way */ + return STATUS_NOT_IMPLEMENTED; + } + + if (!handle) + { + /* Shadow of the Tomb Raider really likes passing in NULL handles to + * various functions. Concerning, but let's avoid a server call. */ + return STATUS_INVALID_HANDLE; + } + + /* We need to try grabbing it from the server. */ + server_enter_uninterrupted_section( &fd_cache_mutex, &sigset ); + if (!(*obj = get_cached_object( handle ))) + { + SERVER_START_REQ( get_esync_fd ) + { + req->handle = wine_server_obj_handle( handle ); + if (!(ret = wine_server_call( req ))) + { + type = reply->type; + shm_idx = reply->shm_idx; + fd = receive_fd( &fd_handle ); + assert( wine_server_ptr_handle(fd_handle) == handle ); + } + } + SERVER_END_REQ; + } + server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); + + if (*obj) + { + /* We managed to grab it while in the CS; return it. */ + return STATUS_SUCCESS; + } + + if (ret) + { + WARN("Failed to retrieve fd for handle %p, status %#x.\n", handle, (unsigned int)ret); + *obj = NULL; + return ret; + } + + TRACE("Got fd %d for handle %p.\n", fd, handle); + + *obj = add_to_list( handle, type, fd, shm_idx ? get_shm( shm_idx ) : 0 ); + return ret; +} + NTSTATUS esync_close( HANDLE handle ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); @@ -268,10 +334,11 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) struct semaphore *semaphore; uint64_t count64 = count; ULONG current; + NTSTATUS ret; TRACE("%p, %d, %p.\n", handle, (int)count, prev); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj))) return ret; semaphore = obj->shm; do @@ -310,10 +377,11 @@ NTSTATUS esync_set_event( HANDLE handle ) { static const uint64_t value = 1; struct esync *obj; + NTSTATUS ret; TRACE("%p.\n", handle); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj))) return ret; if (write( obj->fd, &value, sizeof(value) ) == -1) ERR("write: %s\n", strerror(errno)); @@ -325,10 +393,11 @@ NTSTATUS esync_reset_event( HANDLE handle ) { uint64_t value; struct esync *obj; + NTSTATUS ret; TRACE("%p.\n", handle); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj))) return ret; if (read( obj->fd, &value, sizeof(value) ) == -1 && errno != EWOULDBLOCK && errno != EAGAIN) ERR("read: %s\n", strerror(errno)); @@ -417,10 +486,13 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an for (i = 0; i < count; i++) { - if ((objs[i] = get_cached_object( handles[i] ))) + ret = get_object( handles[i], &objs[i] ); + if (ret == STATUS_SUCCESS) has_esync = 1; - else + else if (ret == STATUS_NOT_IMPLEMENTED) has_server = 1; + else + return ret; } if (has_esync && has_server) @@ -473,7 +545,7 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an int64_t value; ssize_t size; - if (obj->type == ESYNC_MANUAL_EVENT) + if (obj->type == ESYNC_MANUAL_EVENT || obj->type == ESYNC_MANUAL_SERVER) { /* Don't grab the object, just check if it's signaled. */ if (fds[i].revents & POLLIN) diff --git a/server/esync.c b/server/esync.c index 44214e5fe02..60e98936455 100644 --- a/server/esync.c +++ b/server/esync.c @@ -313,6 +313,22 @@ int esync_create_fd( int initval, int flags ) #endif } +/* Wake up a server-side esync object. */ +void esync_wake_up( struct object *obj ) +{ + static const uint64_t value = 1; + enum esync_type dummy; + int fd; + + if (obj->ops->get_esync_fd) + { + fd = obj->ops->get_esync_fd( obj, &dummy ); + + if (write( fd, &value, sizeof(value) ) == -1) + perror( "esync: write" ); + } +} + DECL_HANDLER(create_esync) { struct esync *esync; diff --git a/server/esync.h b/server/esync.h index 8522d8a69ae..1241e6d9f1a 100644 --- a/server/esync.h +++ b/server/esync.h @@ -23,3 +23,4 @@ extern int do_esync(void); void esync_init(void); int esync_create_fd( int initval, int flags ); +void esync_wake_up( struct object *obj ); diff --git a/server/thread.c b/server/thread.c index f579ffddad8..e744b98feaa 100644 --- a/server/thread.c +++ b/server/thread.c @@ -54,6 +54,7 @@ #include "user.h" #include "security.h" #include "unicode.h" +#include "esync.h" /* thread queues */ @@ -1218,6 +1219,9 @@ void wake_up( struct object *obj, int max ) struct list *ptr; int ret; + if (do_esync()) + esync_wake_up( obj ); + LIST_FOR_EACH( ptr, &obj->wait_queue ) { struct wait_queue_entry *entry = LIST_ENTRY( ptr, struct wait_queue_entry, entry ); From 4b3bbaaa8ca4bad55cdecc530af304c147b18311 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 21:01:24 -0500 Subject: [PATCH 0442/1506] server: Create eventfd file descriptors for event objects. We still need this, since there are some events which the server signals. This lets system processes shut down. Wine-Staging: eventfd_synchronization --- server/esync.c | 8 ++++++++ server/esync.h | 1 + server/event.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/server/esync.c b/server/esync.c index 60e98936455..b37438cbecc 100644 --- a/server/esync.c +++ b/server/esync.c @@ -329,6 +329,14 @@ void esync_wake_up( struct object *obj ) } } +void esync_clear( int fd ) +{ + uint64_t value; + + /* we don't care about the return value */ + read( fd, &value, sizeof(value) ); +} + DECL_HANDLER(create_esync) { struct esync *esync; diff --git a/server/esync.h b/server/esync.h index 1241e6d9f1a..d259b5f604d 100644 --- a/server/esync.h +++ b/server/esync.h @@ -24,3 +24,4 @@ extern int do_esync(void); void esync_init(void); int esync_create_fd( int initval, int flags ); void esync_wake_up( struct object *obj ); +void esync_clear( int fd ); diff --git a/server/event.c b/server/event.c index c727bfdd1ba..f1a88e3d23f 100644 --- a/server/event.c +++ b/server/event.c @@ -35,6 +35,7 @@ #include "thread.h" #include "request.h" #include "security.h" +#include "esync.h" static const WCHAR event_name[] = {'E','v','e','n','t'}; @@ -56,13 +57,16 @@ struct event struct list kernel_object; /* list of kernel object pointers */ int manual_reset; /* is it a manual reset event? */ int signaled; /* event has been signaled */ + int esync_fd; /* esync file descriptor */ }; static void event_dump( struct object *obj, int verbose ); static int event_signaled( struct object *obj, struct wait_queue_entry *entry ); static void event_satisfied( struct object *obj, struct wait_queue_entry *entry ); +static int event_get_esync_fd( struct object *obj, enum esync_type *type ); static int event_signal( struct object *obj, unsigned int access); static struct list *event_get_kernel_obj_list( struct object *obj ); +static void event_destroy( struct object *obj ); static const struct object_ops event_ops = { @@ -72,7 +76,7 @@ static const struct object_ops event_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ event_signaled, /* signaled */ - NULL, /* get_esync_fd */ + event_get_esync_fd, /* get_esync_fd */ event_satisfied, /* satisfied */ event_signal, /* signal */ no_get_fd, /* get_fd */ @@ -86,7 +90,7 @@ static const struct object_ops event_ops = no_open_file, /* open_file */ event_get_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ - no_destroy /* destroy */ + event_destroy /* destroy */ }; @@ -152,6 +156,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name, list_init( &event->kernel_object ); event->manual_reset = manual_reset; event->signaled = initial_state; + + if (do_esync()) + event->esync_fd = esync_create_fd( initial_state, 0 ); } } return event; @@ -180,6 +187,9 @@ void set_event( struct event *event ) void reset_event( struct event *event ) { event->signaled = 0; + + if (do_esync()) + esync_clear( event->esync_fd ); } static void event_dump( struct object *obj, int verbose ) @@ -197,6 +207,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry ) return event->signaled; } +static int event_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct event *event = (struct event *)obj; + *type = event->manual_reset ? ESYNC_MANUAL_SERVER : ESYNC_AUTO_SERVER; + return event->esync_fd; +} + static void event_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct event *event = (struct event *)obj; @@ -225,6 +242,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj ) return &event->kernel_object; } +static void event_destroy( struct object *obj ) +{ + struct event *event = (struct event *)obj; + + if (do_esync()) + close( event->esync_fd ); +} + struct keyed_event *create_keyed_event( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ) { From edfac69959a40121a7e3aa22981bbe03a8cd1119 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 21:43:37 -0500 Subject: [PATCH 0443/1506] server: Allow (re)setting esync events on the server side. Some server calls pass an event handle, most notably asyncs. We need to be able to handle these correctly. Accordingly we pass them along to esync if it turns out the underlying object is actually an esync object. In an ideal world we'd just convert all instances of events on the server side to use esyncs instead. But we want to keep esync perfectly configurable, so this is how we do it. Wine-Staging: eventfd_synchronization --- server/esync.c | 22 +++++++++++++++++++++- server/esync.h | 6 ++++++ server/event.c | 15 +++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/server/esync.c b/server/esync.c index b37438cbecc..669afbc70d7 100644 --- a/server/esync.c +++ b/server/esync.c @@ -114,7 +114,7 @@ struct esync static void esync_dump( struct object *obj, int verbose ); static void esync_destroy( struct object *obj ); -static const struct object_ops esync_ops = +const struct object_ops esync_ops = { sizeof(struct esync), /* size */ &no_type, /* type */ @@ -337,6 +337,26 @@ void esync_clear( int fd ) read( fd, &value, sizeof(value) ); } +/* Server-side event support. */ +void esync_set_event( struct esync *esync ) +{ + static const uint64_t value = 1; + + assert( esync->obj.ops == &esync_ops ); + if (write( esync->fd, &value, sizeof(value) ) == -1) + perror( "esync: write" ); +} + +void esync_reset_event( struct esync *esync ) +{ + static uint64_t value = 1; + + assert( esync->obj.ops == &esync_ops ); + + /* we don't care about the return value */ + read( esync->fd, &value, sizeof(value) ); +} + DECL_HANDLER(create_esync) { struct esync *esync; diff --git a/server/esync.h b/server/esync.h index d259b5f604d..689d8569b73 100644 --- a/server/esync.h +++ b/server/esync.h @@ -25,3 +25,9 @@ void esync_init(void); int esync_create_fd( int initval, int flags ); void esync_wake_up( struct object *obj ); void esync_clear( int fd ); + +struct esync; + +extern const struct object_ops esync_ops; +void esync_set_event( struct esync *esync ); +void esync_reset_event( struct esync *esync ); diff --git a/server/event.c b/server/event.c index f1a88e3d23f..f4ca3e48c6f 100644 --- a/server/event.c +++ b/server/event.c @@ -166,6 +166,10 @@ struct event *create_event( struct object *root, const struct unicode_str *name, struct event *get_event_obj( struct process *process, obj_handle_t handle, unsigned int access ) { + struct object *obj; + if (do_esync() && (obj = get_handle_obj( process, handle, access, &esync_ops))) + return (struct event *)obj; /* even though it's not an event */ + return (struct event *)get_handle_obj( process, handle, access, &event_ops ); } @@ -179,6 +183,12 @@ static void pulse_event( struct event *event ) void set_event( struct event *event ) { + if (do_esync() && event->obj.ops == &esync_ops) + { + esync_set_event( (struct esync *)event ); + return; + } + event->signaled = 1; /* wake up all waiters if manual reset, a single one otherwise */ wake_up( &event->obj, !event->manual_reset ); @@ -186,6 +196,11 @@ void set_event( struct event *event ) void reset_event( struct event *event ) { + if (do_esync() && event->obj.ops == &esync_ops) + { + esync_reset_event( (struct esync *)event ); + return; + } event->signaled = 0; if (do_esync()) From 2b4d4ea92fbc8b06c21cef2eb2d8a4e3e0514503 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 21:58:37 -0500 Subject: [PATCH 0444/1506] ntdll: Try again if poll() returns EINTR. I originally had this return STATUS_USER_APC, but that isn't correct. The server code here is a bit confusing, but only the thread that waits *during* the suspend should receive STATUS_USER_APC (and I imagine that it really should receive STATUS_KERNEL_APC instead). The thread that is suspended should just keep on waiting. Besides, we could be suspended for reasons other than to deliver a system APC. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index e783517f644..2f402eb77cd 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -421,22 +421,32 @@ static LONGLONG update_timeout( ULONGLONG end ) static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end ) { - if (end) + int ret; + + do { - LONGLONG timeleft = update_timeout( *end ); + if (end) + { + LONGLONG timeleft = update_timeout( *end ); #ifdef HAVE_PPOLL - /* We use ppoll() if available since the time granularity is better. */ - struct timespec tmo_p; - tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - return ppoll( fds, nfds, &tmo_p, NULL ); + /* We use ppoll() if available since the time granularity is better. */ + struct timespec tmo_p; + tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; + ret = ppoll( fds, nfds, &tmo_p, NULL ); #else - return poll( fds, nfds, timeleft / TICKSPERMSEC ); + ret = poll( fds, nfds, timeleft / TICKSPERMSEC ); #endif - } - else - return poll( fds, nfds, -1 ); + } + else + ret = poll( fds, nfds, -1 ); + + /* If we receive EINTR we were probably suspended (SIGUSR1), possibly for a + * system APC. The right thing to do is just try again. */ + } while (ret < 0 && errno == EINTR); + + return ret; } static void update_grabbed_object( struct esync *obj ) From 1d1b08a9f3723c4494c8b3e1817d25dc4add0c4f Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 22:04:29 -0500 Subject: [PATCH 0445/1506] server: Create eventfd file descriptors for thread objects. Wine-Staging: eventfd_synchronization --- server/thread.c | 17 ++++++++++++++++- server/thread.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/server/thread.c b/server/thread.c index e744b98feaa..69b919d400e 100644 --- a/server/thread.c +++ b/server/thread.c @@ -181,6 +181,7 @@ struct type_descr thread_type = static void dump_thread( struct object *obj, int verbose ); static int thread_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int thread_get_esync_fd( struct object *obj, enum esync_type *type ); static unsigned int thread_map_access( struct object *obj, unsigned int access ); static void thread_poll_event( struct fd *fd, int event ); static struct list *thread_get_kernel_obj_list( struct object *obj ); @@ -194,7 +195,7 @@ static const struct object_ops thread_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ thread_signaled, /* signaled */ - NULL, /* get_esync_fd */ + thread_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -262,6 +263,7 @@ static inline void init_thread_structure( struct thread *thread ) thread->context = NULL; thread->teb = 0; thread->entry_point = 0; + thread->esync_fd = -1; thread->system_regs = 0; thread->queue = NULL; thread->wait = NULL; @@ -474,6 +476,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu } } + if (do_esync()) + thread->esync_fd = esync_create_fd( 0, 0 ); + set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */ add_process_thread( thread->process, thread ); return thread; @@ -556,6 +561,9 @@ static void destroy_thread( struct object *obj ) release_object( thread->process ); if (thread->id) free_ptid( thread->id ); if (thread->token) release_object( thread->token ); + + if (do_esync()) + close( thread->esync_fd ); } /* dump a thread on stdout for debugging purposes */ @@ -574,6 +582,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry ) return (mythread->state == TERMINATED); } +static int thread_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct thread *thread = (struct thread *)obj; + *type = ESYNC_MANUAL_SERVER; + return thread->esync_fd; +} + static unsigned int thread_map_access( struct object *obj, unsigned int access ) { access = default_map_access( obj, access ); diff --git a/server/thread.h b/server/thread.h index 0c28242533e..8086a98156e 100644 --- a/server/thread.h +++ b/server/thread.h @@ -54,6 +54,7 @@ struct thread struct process *process; thread_id_t id; /* thread id */ struct list mutex_list; /* list of currently owned mutexes */ + int esync_fd; /* esync file descriptor (signalled on exit) */ unsigned int system_regs; /* which system regs have been set */ struct msg_queue *queue; /* message queue */ struct thread_wait *wait; /* current wait condition if sleeping */ From a19f07807f1fc1795c3bd1c4df67d12af818010f Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 8 Jun 2018 23:30:17 -0500 Subject: [PATCH 0446/1506] rpcrt4: Avoid closing the server thread handle while it is being waited on. This, or something like this, should go upstream. This is invalid behaviour. Wine-Staging: eventfd_synchronization --- dlls/rpcrt4/rpc_server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c index 41431ebca02..77b5d83b3c0 100644 --- a/dlls/rpcrt4/rpc_server.c +++ b/dlls/rpcrt4/rpc_server.c @@ -701,10 +701,6 @@ static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg) } LeaveCriticalSection(&cps->cs); - EnterCriticalSection(&listen_cs); - CloseHandle(cps->server_thread); - cps->server_thread = NULL; - LeaveCriticalSection(&listen_cs); TRACE("done\n"); return 0; } @@ -1570,7 +1566,10 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void ) LIST_FOR_EACH_ENTRY(protseq, &protseqs, RpcServerProtseq, entry) { if ((wait_thread = protseq->server_thread)) + { + protseq->server_thread = NULL; break; + } } LeaveCriticalSection(&server_cs); if (!wait_thread) @@ -1579,6 +1578,7 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void ) TRACE("waiting for thread %lu\n", GetThreadId(wait_thread)); LeaveCriticalSection(&listen_cs); WaitForSingleObject(wait_thread, INFINITE); + CloseHandle(wait_thread); EnterCriticalSection(&listen_cs); } if (listen_done_event == event) From 4caea3cb53a249f3d9d20e6ddc56e2367eb89bae Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:01:56 -0500 Subject: [PATCH 0447/1506] server: Create eventfd file descriptors for message queues. Wine-Staging: eventfd_synchronization --- server/queue.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c index e709f0348f8..a0071d231cc 100644 --- a/server/queue.c +++ b/server/queue.c @@ -42,6 +42,7 @@ #include "process.h" #include "request.h" #include "user.h" +#include "esync.h" #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE #define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST)) @@ -135,6 +136,7 @@ struct msg_queue timeout_t last_get_msg; /* time of last get message call */ int keystate_lock; /* owns an input keystate lock */ const queue_shm_t *shared; /* thread queue shared memory ptr */ + int esync_fd; /* esync file descriptor (signalled on message) */ }; struct hotkey @@ -151,6 +153,7 @@ static void msg_queue_dump( struct object *obj, int verbose ); static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *entry ); static void msg_queue_remove_queue( struct object *obj, struct wait_queue_entry *entry ); static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int msg_queue_get_esync_fd( struct object *obj, enum esync_type *type ); static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ); static void msg_queue_destroy( struct object *obj ); static void msg_queue_poll_event( struct fd *fd, int event ); @@ -166,7 +169,7 @@ static const struct object_ops msg_queue_ops = msg_queue_add_queue, /* add_queue */ msg_queue_remove_queue, /* remove_queue */ msg_queue_signaled, /* signaled */ - NULL, /* get_esync_fd */ + msg_queue_get_esync_fd, /* get_esync_fd */ msg_queue_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -336,6 +339,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->last_get_msg = current_time; queue->keystate_lock = 0; queue->shared = thread->queue_shared; + queue->esync_fd = -1; list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); @@ -348,6 +352,9 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ } SHARED_WRITE_END + if (do_esync()) + queue->esync_fd = esync_create_fd( 0, 0 ); + thread->queue = queue; } if (new_input) @@ -693,6 +700,9 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits queue->keystate_lock = 0; } + if (do_esync() && !is_signaled( queue )) + esync_clear( queue->esync_fd ); + SHARED_WRITE_BEGIN( queue, queue_shm_t ) { shared->wake_bits = queue->wake_bits; @@ -1264,6 +1274,13 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr return ret || is_signaled( queue ); } +static int msg_queue_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct msg_queue *queue = (struct msg_queue *)obj; + *type = ESYNC_QUEUE; + return queue->esync_fd; +} + static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; @@ -1320,6 +1337,7 @@ static void cleanup_msg_queue( struct msg_queue *queue ) if (queue->hooks) release_object( queue->hooks ); if (queue->fd) release_object( queue->fd ); queue->destroyed = 1; + if (do_esync()) close( queue->esync_fd ); } static void msg_queue_destroy( struct object *obj ) @@ -2897,6 +2915,9 @@ DECL_HANDLER(set_queue_mask) } else wake_up( &queue->obj, 0 ); } + + if (do_esync() && !is_signaled( queue )) + esync_clear( queue->esync_fd ); } } @@ -2911,6 +2932,9 @@ DECL_HANDLER(get_queue_status) reply->changed_bits = queue->changed_bits; queue->changed_bits &= ~req->clear_bits; + if (do_esync() && !is_signaled( queue )) + esync_clear( queue->esync_fd ); + SHARED_WRITE_BEGIN( queue, queue_shm_t ) { shared->changed_bits = queue->changed_bits; @@ -3168,6 +3192,10 @@ DECL_HANDLER(get_message) SHARED_WRITE_END set_error( STATUS_PENDING ); /* FIXME */ + + if (do_esync() && !is_signaled( queue )) + esync_clear( queue->esync_fd ); + } From dcd0f106ec9a64ddc0eb3fb94003290987b25e8a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:11:23 -0500 Subject: [PATCH 0448/1506] server, ntdll: Implement message waits. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 51 +++++++++++++++++++++++++++++++++++++++-- server/protocol.def | 5 ++++ server/queue.c | 21 +++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 2f402eb77cd..91ac73399e5 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -472,12 +472,13 @@ static void update_grabbed_object( struct esync *obj ) /* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we * need to delegate to server_select(). */ -NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, +static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { struct esync *objs[MAXIMUM_WAIT_OBJECTS]; struct pollfd fds[MAXIMUM_WAIT_OBJECTS]; int has_esync = 0, has_server = 0; + BOOL msgwait = FALSE; LONGLONG timeleft; LARGE_INTEGER now; ULONGLONG end; @@ -505,6 +506,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an return ret; } + if (objs[count - 1] && objs[count - 1]->type == ESYNC_QUEUE) + msgwait = TRUE; + if (has_esync && has_server) FIXME("Can't wait on esync and server objects at the same time!\n"); else if (has_server) @@ -516,6 +520,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an for (i = 0; i < count; i++) TRACE(" %p", handles[i]); + if (msgwait) + TRACE(" or driver events"); + if (!timeout) TRACE(", timeout = INFINITE.\n"); else @@ -555,7 +562,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an int64_t value; ssize_t size; - if (obj->type == ESYNC_MANUAL_EVENT || obj->type == ESYNC_MANUAL_SERVER) + if (obj->type == ESYNC_MANUAL_EVENT + || obj->type == ESYNC_MANUAL_SERVER + || obj->type == ESYNC_QUEUE) { /* Don't grab the object, just check if it's signaled. */ if (fds[i].revents & POLLIN) @@ -600,6 +609,44 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an } } +/* We need to let the server know when we are doing a message wait, and when we + * are done with one, so that all of the code surrounding hung queues works. + * We also need this for WaitForInputIdle(). */ +static void server_set_msgwait( int in_msgwait ) +{ + SERVER_START_REQ( esync_msgwait ) + { + req->in_msgwait = in_msgwait; + wine_server_call( req ); + } + SERVER_END_REQ; +} + +/* This is a very thin wrapper around the proper implementation above. The + * purpose is to make sure the server knows when we are doing a message wait. + * This is separated into a wrapper function since there are at least a dozen + * exit paths from esync_wait_objects(). */ +NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, + BOOLEAN alertable, const LARGE_INTEGER *timeout ) +{ + BOOL msgwait = FALSE; + struct esync *obj; + NTSTATUS ret; + + if (count && !get_object( handles[count - 1], &obj ) && obj->type == ESYNC_QUEUE) + { + msgwait = TRUE; + server_set_msgwait( 1 ); + } + + ret = __esync_wait_objects( count, handles, wait_any, alertable, timeout ); + + if (msgwait) + server_set_msgwait( 0 ); + + return ret; +} + void esync_init(void) { struct stat st; diff --git a/server/protocol.def b/server/protocol.def index 6e67af1636e..2d6581d5d6c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3970,3 +3970,8 @@ enum esync_type int type; unsigned int shm_idx; @END + +/* Notify the server that we are doing a message wait or done with one. */ +@REQ(esync_msgwait) + int in_msgwait; /* are we in a message wait? */ +@END diff --git a/server/queue.c b/server/queue.c index a0071d231cc..ce818042475 100644 --- a/server/queue.c +++ b/server/queue.c @@ -137,6 +137,7 @@ struct msg_queue int keystate_lock; /* owns an input keystate lock */ const queue_shm_t *shared; /* thread queue shared memory ptr */ int esync_fd; /* esync file descriptor (signalled on message) */ + int esync_in_msgwait; /* our thread is currently waiting on us */ }; struct hotkey @@ -340,6 +341,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->keystate_lock = 0; queue->shared = thread->queue_shared; queue->esync_fd = -1; + queue->esync_in_msgwait = 0; list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); @@ -1219,6 +1221,10 @@ static int is_queue_hung( struct msg_queue *queue ) if (get_wait_queue_thread(entry)->queue == queue) return 0; /* thread is waiting on queue -> not hung */ } + + if (do_esync() && queue->esync_in_msgwait) + return 0; /* thread is waiting on queue in absentia -> not hung */ + return 1; } @@ -3949,3 +3955,18 @@ DECL_HANDLER(update_rawinput_devices) process->rawinput_mouse = find_rawinput_device( process, 1, 2 ); process->rawinput_kbd = find_rawinput_device( process, 1, 6 ); } + +DECL_HANDLER(esync_msgwait) +{ + struct msg_queue *queue = get_current_queue(); + + if (!queue) return; + queue->esync_in_msgwait = req->in_msgwait; + + if (current->process->idle_event && !(queue->wake_mask & QS_SMRESULT)) + set_event( current->process->idle_event ); + + /* and start/stop waiting on the driver */ + if (queue->fd) + set_fd_events( queue->fd, req->in_msgwait ? POLLIN : 0 ); +} From 67e226dcbabfe017accf8a615de92af64df3f012 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 9 Jun 2018 15:39:37 -0500 Subject: [PATCH 0449/1506] server: Create eventfd descriptors for device manager objects. We don't have to worry about synchronization here because wine_ntoskrnl_main_loop() is only ever called from one thread per winedevice process. This lets drivers like mountmgr finally work, and so winecfg can open the Drives tab. Wine-Staging: eventfd_synchronization --- server/device.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/server/device.c b/server/device.c index f730fa81afa..c45d0102a56 100644 --- a/server/device.c +++ b/server/device.c @@ -38,6 +38,7 @@ #include "handle.h" #include "request.h" #include "process.h" +#include "esync.h" /* IRP object */ @@ -93,10 +94,12 @@ struct device_manager struct list requests; /* list of pending irps across all devices */ struct irp_call *current_call; /* call currently executed on client side */ struct wine_rb_tree kernel_objects; /* map of objects that have client side pointer associated */ + int esync_fd; /* esync file descriptor */ }; static void device_manager_dump( struct object *obj, int verbose ); static int device_manager_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int device_manager_get_esync_fd( struct object *obj, enum esync_type *type ); static void device_manager_destroy( struct object *obj ); static const struct object_ops device_manager_ops = @@ -107,7 +110,7 @@ static const struct object_ops device_manager_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ device_manager_signaled, /* signaled */ - NULL, /* get_esync_fd */ + device_manager_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -751,6 +754,9 @@ static void delete_file( struct device_file *file ) /* terminate all pending requests */ LIST_FOR_EACH_ENTRY_SAFE( irp, next, &file->requests, struct irp_call, dev_entry ) { + if (do_esync() && file->device->manager && list_empty( &file->device->manager->requests )) + esync_clear( file->device->manager->esync_fd ); + list_remove( &irp->mgr_entry ); set_irp_result( irp, STATUS_FILE_DELETED, NULL, 0, 0 ); } @@ -786,6 +792,13 @@ static int device_manager_signaled( struct object *obj, struct wait_queue_entry return !list_empty( &manager->requests ); } +static int device_manager_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct device_manager *manager = (struct device_manager *)obj; + *type = ESYNC_MANUAL_SERVER; + return manager->esync_fd; +} + static void device_manager_destroy( struct object *obj ) { struct device_manager *manager = (struct device_manager *)obj; @@ -820,6 +833,9 @@ static void device_manager_destroy( struct object *obj ) assert( !irp->file && !irp->async ); release_object( irp ); } + + if (do_esync()) + close( manager->esync_fd ); } static struct device_manager *create_device_manager(void) @@ -832,6 +848,9 @@ static struct device_manager *create_device_manager(void) list_init( &manager->devices ); list_init( &manager->requests ); wine_rb_init( &manager->kernel_objects, compare_kernel_object ); + + if (do_esync()) + manager->esync_fd = esync_create_fd( 0, 0 ); } return manager; } @@ -1021,6 +1040,9 @@ DECL_HANDLER(get_next_device_request) /* we already own the object if it's only on manager queue */ if (irp->file) grab_object( irp ); manager->current_call = irp; + + if (do_esync() && list_empty( &manager->requests )) + esync_clear( manager->esync_fd ); } else close_handle( current->process, reply->next ); } From 2efbebccaf4811f0be28e11e7a9bef6222a9230b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:34:56 -0500 Subject: [PATCH 0450/1506] ntdll, server: Implement NtCreateMutant(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 16 ++++++++++++++++ dlls/ntdll/unix/esync.h | 3 +++ dlls/ntdll/unix/sync.c | 4 ++++ server/esync.c | 14 ++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 91ac73399e5..263b3ef2184 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -81,6 +81,13 @@ struct semaphore }; C_ASSERT(sizeof(struct semaphore) == 8); +struct mutex +{ + DWORD tid; + int count; /* recursion count */ +}; +C_ASSERT(sizeof(struct mutex) == 8); + struct event { int signaled; @@ -405,6 +412,15 @@ NTSTATUS esync_reset_event( HANDLE handle ) return STATUS_SUCCESS; } +NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ) +{ + TRACE("name %s, initial %d.\n", + attr ? debugstr_us(attr->ObjectName) : "", initial); + + return create_esync( ESYNC_MUTEX, handle, access, attr, initial ? 0 : 1, 0 ); +} + #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 6e5d6233a2e..9b2f88670d1 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -31,6 +31,9 @@ extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, extern NTSTATUS esync_reset_event( HANDLE handle ); extern NTSTATUS esync_set_event( HANDLE handle ); +extern NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); + extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index fdf4215039b..1bf4a381a8f 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -555,6 +555,10 @@ NTSTATUS WINAPI NtCreateMutant( HANDLE *handle, ACCESS_MASK access, const OBJECT struct object_attributes *objattr; *handle = 0; + + if (do_esync()) + return esync_create_mutex( handle, access, attr, owned ); + if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; SERVER_START_REQ( create_mutex ) diff --git a/server/esync.c b/server/esync.c index 669afbc70d7..3f1c61bc1f0 100644 --- a/server/esync.c +++ b/server/esync.c @@ -202,6 +202,13 @@ struct semaphore }; C_ASSERT(sizeof(struct semaphore) == 8); +struct mutex +{ + DWORD tid; + int count; /* recursion count */ +}; +C_ASSERT(sizeof(struct mutex) == 8); + struct event { int signaled; @@ -272,6 +279,13 @@ struct esync *create_esync( struct object *root, const struct unicode_str *name, event->locked = 0; break; } + case ESYNC_MUTEX: + { + struct mutex *mutex = get_shm( esync->shm_idx ); + mutex->tid = initval ? 0 : current->id; + mutex->count = initval ? 0 : 1; + break; + } default: assert( 0 ); } From c6ce38566956dac83f8b3e63b50578c54446ebbf Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:37:49 -0500 Subject: [PATCH 0451/1506] ntdll: Implement NtReleaseMutant(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 34 ++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 38 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 263b3ef2184..829388bc68b 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -421,6 +421,40 @@ NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, return create_esync( ESYNC_MUTEX, handle, access, attr, initial ? 0 : 1, 0 ); } +NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ) +{ + struct esync *obj; + struct mutex *mutex; + static const uint64_t value = 1; + NTSTATUS ret; + + TRACE("%p, %p.\n", handle, prev); + + if ((ret = get_object( handle, &obj ))) return ret; + mutex = obj->shm; + + /* This is thread-safe, because the only thread that can change the tid to + * or from our tid is ours. */ + if (mutex->tid != GetCurrentThreadId()) return STATUS_MUTANT_NOT_OWNED; + + if (prev) *prev = mutex->count; + + mutex->count--; + + if (!mutex->count) + { + /* This is also thread-safe, as long as signaling the file is the last + * thing we do. Other threads don't care about the tid if it isn't + * theirs. */ + mutex->tid = 0; + + if (write( obj->fd, &value, sizeof(value) ) == -1) + return errno_to_status( errno ); + } + + return STATUS_SUCCESS; +} + #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 9b2f88670d1..8eaa79a5823 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -33,6 +33,7 @@ extern NTSTATUS esync_set_event( HANDLE handle ); extern NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); +extern NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ); extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 1bf4a381a8f..20391617e40 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -608,6 +608,9 @@ NTSTATUS WINAPI NtReleaseMutant( HANDLE handle, LONG *prev_count ) { unsigned int ret; + if (do_esync()) + return esync_release_mutex( handle, prev_count ); + SERVER_START_REQ( release_mutex ) { req->handle = wine_server_obj_handle( handle ); From 7cb103e34b950b766bce97d1ee8b79459c7fdaf7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:42:13 -0500 Subject: [PATCH 0452/1506] ntdll: Implement waiting on mutexes. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 829388bc68b..7c09f8a3503 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -501,7 +501,16 @@ static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end ) static void update_grabbed_object( struct esync *obj ) { - if (obj->type == ESYNC_SEMAPHORE) + if (obj->type == ESYNC_MUTEX) + { + struct mutex *mutex = obj->shm; + /* We don't have to worry about a race between this and read(); the + * fact that we grabbed it means the count is now zero, so nobody else + * can (and the only thread that can release it is us). */ + mutex->tid = GetCurrentThreadId(); + mutex->count++; + } + else if (obj->type == ESYNC_SEMAPHORE) { struct semaphore *semaphore = obj->shm; /* We don't have to worry about a race between this and read(); the @@ -587,7 +596,25 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA { for (i = 0; i < count; i++) { - fds[i].fd = objs[i] ? objs[i]->fd : -1; + struct esync *obj = objs[i]; + + if (obj && obj->type == ESYNC_MUTEX) + { + /* If we already own the mutex, return immediately. */ + /* Note: This violates the assumption that the *first* object + * to be signaled will be returned. If that becomes a problem, + * we can always check the state of each object before waiting. */ + struct mutex *mutex = (struct mutex *)obj; + + if (mutex->tid == GetCurrentThreadId()) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->count++; + return i; + } + } + + fds[i].fd = obj ? obj->fd : -1; fds[i].events = POLLIN; } From 4a3db556ba9c895b0a6f3230b57e421304c08b9a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:47:38 -0500 Subject: [PATCH 0453/1506] ntdll: Implement wait-all. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 142 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 129 insertions(+), 13 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 7c09f8a3503..8874a16d475 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -541,7 +541,9 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA LONGLONG timeleft; LARGE_INTEGER now; ULONGLONG end; - int i, ret; + int64_t value; + ssize_t size; + int i, j, ret; NtQuerySystemTime( &now ); if (timeout) @@ -636,9 +638,6 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA if (obj) { - int64_t value; - ssize_t size; - if (obj->type == ESYNC_MANUAL_EVENT || obj->type == ESYNC_MANUAL_SERVER || obj->type == ESYNC_QUEUE) @@ -667,22 +666,139 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA * we were waiting for. So keep waiting. */ NtQuerySystemTime( &now ); } - else if (ret == 0) + else + goto err; + } + } + else + { + /* Wait-all is a little trickier to implement correctly. Fortunately, + * it's not as common. + * + * The idea is basically just to wait in sequence on every object in the + * set. Then when we're done, try to grab them all in a tight loop. If + * that fails, release any resources we've grabbed (and yes, we can + * reliably do this—it's just mutexes and semaphores that we have to + * put back, and in both cases we just put back 1), and if any of that + * fails we start over. + * + * What makes this inherently bad is that we might temporarily grab a + * resource incorrectly. Hopefully it'll be quick (and hey, it won't + * block on wineserver) so nobody will notice. Besides, consider: if + * object A becomes signaled but someone grabs it before we can grab it + * and everything else, then they could just as well have grabbed it + * before it became signaled. Similarly if object A was signaled and we + * were blocking on object B, then B becomes available and someone grabs + * A before we can, then they might have grabbed A before B became + * signaled. In either case anyone who tries to wait on A or B will be + * waiting for an instant while we put things back. */ + + while (1) + { +tryagain: + /* First step: try to poll on each object in sequence. */ + fds[0].events = POLLIN; + for (i = 0; i < count; i++) { - TRACE("Wait timed out.\n"); - return STATUS_TIMEOUT; + struct esync *obj = objs[i]; + + fds[0].fd = obj ? obj->fd : -1; + + if (obj && obj->type == ESYNC_MUTEX) + { + /* It might be ours. */ + struct mutex *mutex = obj->shm; + + if (mutex->tid == GetCurrentThreadId()) + continue; + } + + ret = do_poll( fds, 1, timeout ? &end : NULL ); + if (ret <= 0) + goto err; + + if (fds[0].revents & (POLLHUP | POLLERR | POLLNVAL)) + { + ERR("Polling on fd %d returned %#x.\n", fds[0].fd, fds[0].revents); + return STATUS_INVALID_HANDLE; + } } - else + + /* If we got here and we haven't timed out, that means all of the + * handles were signaled. Check to make sure they still are. */ + for (i = 0; i < count; i++) { - ERR("ppoll failed: %s\n", strerror( errno )); - return errno_to_status( errno ); + fds[i].fd = objs[i] ? objs[i]->fd : -1; + fds[i].events = POLLIN; } - } + + /* Poll everything to see if they're still signaled. */ + ret = poll( fds, count, 0 ); + if (ret == count) + { + /* Quick, grab everything. */ + for (i = 0; i < count; i++) + { + struct esync *obj = objs[i]; + + switch (obj->type) + { + case ESYNC_MUTEX: + { + struct mutex *mutex = obj->shm; + if (mutex->tid == GetCurrentThreadId()) + break; + /* otherwise fall through */ + } + case ESYNC_SEMAPHORE: + case ESYNC_AUTO_EVENT: + if ((size = read( fds[i].fd, &value, sizeof(value) )) != sizeof(value)) + { + /* We were too slow. Put everything back. */ + value = 1; + for (j = i; j >= 0; j--) + { + if (write( obj->fd, &value, sizeof(value) ) == -1) + return errno_to_status( errno ); + } + + goto tryagain; /* break out of two loops and a switch */ + } + break; + default: + /* If a manual-reset event changed between there and + * here, it's shouldn't be a problem. */ + break; + } + } + + /* If we got here, we successfully waited on every object. */ + /* Make sure to let ourselves know that we grabbed the mutexes + * and semaphores. */ + for (i = 0; i < count; i++) + update_grabbed_object( objs[i] ); + + TRACE("Wait successful.\n"); + return STATUS_SUCCESS; + } + + /* If we got here, ppoll() returned less than all of our objects. + * So loop back to the beginning and try again. */ + } /* while(1) */ + } /* else (wait-all) */ + +err: + /* We should only get here if poll() failed. */ + + if (ret == 0) + { + TRACE("Wait timed out.\n"); + return STATUS_TIMEOUT; } else { - FIXME("Wait-all not implemented.\n"); - return STATUS_NOT_IMPLEMENTED; + ERR("ppoll failed: %s\n", strerror(errno)); + return errno_to_status( errno ); } } From 6ca8127be5a379e1e72a64eedaa1f6149c0ed7dd Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 9 Jun 2018 22:44:57 -0500 Subject: [PATCH 0454/1506] esync: Add a README. Wine-Staging: eventfd_synchronization --- README.esync | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 README.esync diff --git a/README.esync b/README.esync new file mode 100644 index 00000000000..8fcb969011b --- /dev/null +++ b/README.esync @@ -0,0 +1,184 @@ +This is eventfd-based synchronization, or 'esync' for short. Turn it on with +WINEESYNC=1 (note that it checks the presence and not the value); debug it +with +esync. + +The aim is to execute all synchronization operations in "user-space", that is, +without going through wineserver. We do this using Linux's eventfd +facility. The main impetus to using eventfd is so that we can poll multiple +objects at once; in particular we can't do this with futexes, or pthread +semaphores, or the like. The only way I know of to wait on any of multiple +objects is to use select/poll/epoll to wait on multiple fds, and eventfd gives +us those fds in a quite usable way. + +Whenever a semaphore, event, or mutex is created, we have the server, instead +of creating a traditional server-side event/semaphore/mutex, instead create an +'esync' primitive. These live in esync.c and are very slim objects; in fact, +they don't even know what type of primitive they are. The server is involved +at all because we still need a way of creating named objects, passing handles +to another process, etc. + +The server creates an eventfd file descriptor with the requested parameters +and passes it back to ntdll. ntdll creates an object of the appropriate type, +then caches it in a table. This table is copied almost wholesale from the fd +cache code in server.c. + +Specific operations follow quite straightforwardly from eventfd: + +* To release an object, or set an event, we simply write() to it. +* An object is signalled if read() succeeds on it. Notably, we create all + eventfd descriptors with O_NONBLOCK, so that we can atomically check if an + object is signalled and grab it if it is. This also lets us reset events. +* For objects whose state should not be reset upon waiting—e.g. manual-reset + events—we simply check for the POLLIN flag instead of reading. +* Semaphores are handled by the EFD_SEMAPHORE flag. This matches up quite well + (although with some difficulties; see below). +* Mutexes store their owner thread locally. This isn't reliable information if + a different process's thread owns the mutex, but this doesn't matter—a + thread should only care whether it owns the mutex, so it knows whether to + try waiting on it or simply to increase the recursion count. + +The interesting part about esync is that (almost) all waits happen in ntdll, +including those on server-bound objects. The idea here is that on the server +side, for any waitable object, we create an eventfd file descriptor (not an +esync primitive), and then pass it to ntdll if the program tries to wait on +it. These are cached too, so only the first wait will require a round trip to +the server. Then the server signals the file descriptor as appropriate, and +thereby wakes up the client. So far this is implemented for processes, +threads, message queues (difficult; see below), and device managers (necessary +for drivers to work). All of these are necessarily server-bound, so we +wouldn't really gain anything by signalling on the client side instead. Of +course, except possibly for message queues, it's not likely that any program +(cutting-edge D3D game or not) is going to be causing a great wineserver load +by waiting on any of these objects; the motivation was rather to provide a way +to wait on ntdll-bound and server-bound objects at the same time. + +Some cases are still passed to the server, and there's probably no reason not +to keep them that way. Those that I noticed while testing include: async +objects, which are internal to the file APIs and never exposed to userspace, +startup_info objects, which are internal to the loader and signalled when a +process starts, and keyed events, which are exposed through an ntdll API +(although not through kernel32) but can't be mixed with other objects (you +have to use NtWaitForKeyedEvent()). Other cases include: named pipes, debug +events, sockets, and timers. It's unlikely we'll want to optimize debug events +or sockets (or any of the other, rather rare, objects), but it is possible +we'll want to optimize named pipes or timers. + +There were two sort of complications when working out the above. The first one +was events. The trouble is that (1) the server actually creates some events by +itself and (2) the server sometimes manipulates events passed by the +client. Resolving the first case was easy enough, and merely entailed creating +eventfd descriptors for the events the same way as for processes and threads +(note that we don't really lose anything this way; the events include +"LowMemoryCondition" and the event that signals system processes to shut +down). For the second case I basically had to hook the server-side event +functions to redirect to esync versions if the event was actually an esync +primitive. + +The second complication was message queues. The difficulty here is that X11 +signals events by writing into a pipe (at least I think it's a pipe?), and so +as a result wineserver has to poll on that descriptor. In theory we could just +let wineserver do so and then signal us as appropriate, except that wineserver +only polls on the pipe when the thread is waiting for events (otherwise we'd +get e.g. keyboard input while the thread is doing something else, and spin +forever trying to wake up a thread that doesn't care). The obvious solution is +just to poll on that fd ourselves, and that's what I did—it's just that +getting the fd from wineserver was kind of ugly, and the code for waiting was +also kind of ugly basically because we have to wait on both X11's fd and the +"normal" process/thread-style wineserver fd that we use to signal sent +messages. The upshot about the whole thing was that races are basically +impossible, since a thread can only wait on its own queue. + +I had kind of figured that APCs just wouldn't work, but then poll() spat EINTR +at me and I realized that this wasn't necessarily true. It seems that the +server will suspend a thread when trying to deliver a system APC to a thread +that's not waiting, and since the server has no idea that we're waiting it +just suspends us. This of course interrupts poll(), which complains at us, and +it turns out that just returning STATUS_USER_APC in that case is enough to +make rpcrt4 happy. + +There are a couple things that this infrastructure can't handle, although +surprisingly there aren't that many. In particular: +* We can't return the previous count on a semaphore, since we have no way to + query the count on a semaphore through eventfd. Currently the code lies and + returns 1 every time. We can make this work (in a single process, or [if + necessary] in multiple processes through shared memory) by keeping a count + locally. We can't guarantee that it's the exact count at the moment the + semaphore was released, but I guess any program that runs into that race + shouldn't be depending on that fact anyway. +* Similarly, we can't enforce the maximum count on a semaphore, since we have + no way to get the current count and subsequently compare it with the + maximum. +* We can't use NtQueryMutant to get the mutant's owner or count if it lives in + a different process. If necessary we can use shared memory to make this + work, I guess, but see below. +* User APCs don't work. However, it's not impossible to make them work; in + particular I think this could be relatively easily implemented by waiting on + another internal file descriptor when we execute an alertable wait. +* Implementing wait-all, i.e. WaitForMultipleObjects(..., TRUE, ...), is not + exactly possible the way we'd like it to be possible. In theory that + function should wait until it knows all objects are available, then grab + them all at once atomically. The server (like the kernel) can do this + because the server is single-threaded and can't race with itself. We can't + do this in ntdll, though. The approach I've taken I've laid out in great + detail in the relevant patch, but for a quick summary we poll on each object + until it's signaled (but don't grab it), check them all again, and if + they're all signaled we try to grab them all at once in a tight loop, and if + we fail on any of them we reset the count on whatever we shouldn't have + consumed. Such a blip would necessarily be very quick. +* The whole patchset only works on Linux, where eventfd is available. However, + it should be possible to make it work on a Mac, since eventfd is just a + quicker, easier way to use pipes (i.e. instead of writing 1 to the fd you'd + write 1 byte; instead of reading a 64-bit value from the fd you'd read as + many bytes as you can carry, which is admittedly less than 2**64 but + can probably be something reasonable.) It's also possible, although I + haven't yet looked, to use some different kind of synchronization + primitives, but pipes would be easiest to tack onto this framework. +* We might hit the maximum number of open fd's. On my system the soft limit is + 1024 and the hard limit is 1048576. I'm inclined to hope this won't be an + issue, since a hypothetical Linux port of any application might just as well + use the same number of eventfds. +* PulseEvent() can't work the way it's supposed to work. Fortunately it's rare + and deprecated. It's also explicitly mentioned on MSDN that a thread can + miss the notification for a kernel APC, so in a sense we're not necessarily + doing anything wrong. + +There are some things that are perfectly implementable but that I just haven't +done yet: +* NtOpen* (aka Open*). This is just a matter of adding another open_esync + request analogous to those for other server primitives. +* NtQuery*. This can be done to some degree (the difficulties are outlined + above). That said, these APIs aren't exposed through kernel32 in any way, so + I doubt anyone is going to be using them. +* SignalObjectAndWait(). The server combines this into a single operation, but + according to MSDN it doesn't need to be atomic, so we can just signal the + appropriate object and wait, and woe betide anyone who gets in the way of + those two operations. +* Other synchronizable server primitives. It's unlikely we'll need any of + these, except perhaps named pipes (which would honestly be rather difficult) + and (maybe) timers. + +This patchset was inspired by Daniel Santos' "hybrid synchronization" +patchset. My idea was to create a framework whereby even contended waits could +be executed in userspace, eliminating a lot of the complexity that his +synchronization primitives used. I do however owe some significant gratitude +toward him for setting me on the right path. + +I've tried to maximize code separation, both to make any potential rebases +easier and to ensure that esync is only active when configured. All code in +existing source files is guarded with "if (do_esync())", and generally that +condition is followed by "return esync_version_of_this_method(...);", where +the latter lives in esync.c and is declared in esync.h. I've also tried to +make the patchset very clear and readable—to write it as if I were going to +submit it upstream. (Some intermediate patches do break things, which Wine is +generally against, but I think it's for the better in this case.) I have cut +some corners, though; there is some error checking missing, or implicit +assumptions that the program is behaving correctly. + +I've tried to be careful about races. There are a lot of comments whose +purpose are basically to assure me that races are impossible. In most cases we +don't have to worry about races since all of the low-level synchronization is +done by the kernel. + +Anyway, yeah, this is esync. Use it if you like. + +--Zebediah Figura \ No newline at end of file From f54eec6bf472cedebd2c37d8b99624057071123d Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:52:39 -0500 Subject: [PATCH 0455/1506] ntdll: Implement NtSignalAndWaitForSingleObject(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 28 ++++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 8874a16d475..2c7702cd120 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -840,6 +840,34 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an return ret; } +NTSTATUS esync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, + const LARGE_INTEGER *timeout ) +{ + struct esync *obj; + NTSTATUS ret; + + if ((ret = get_object( signal, &obj ))) return ret; + + switch (obj->type) + { + case ESYNC_SEMAPHORE: + ret = esync_release_semaphore( signal, 1, NULL ); + break; + case ESYNC_AUTO_EVENT: + case ESYNC_MANUAL_EVENT: + ret = esync_set_event( signal ); + break; + case ESYNC_MUTEX: + ret = esync_release_mutex( signal, NULL ); + break; + default: + return STATUS_OBJECT_TYPE_MISMATCH; + } + if (ret) return ret; + + return esync_wait_objects( 1, &wait, TRUE, alertable, timeout ); +} + void esync_init(void) { struct stat st; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 8eaa79a5823..88a6d5c8975 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -37,6 +37,8 @@ extern NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ); extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); +extern NTSTATUS esync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, + const LARGE_INTEGER *timeout ); /* We have to synchronize on the fd cache mutex so that our calls to receive_fd diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 20391617e40..12ed44f7a8e 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1531,6 +1531,9 @@ NTSTATUS WINAPI NtSignalAndWaitForSingleObject( HANDLE signal, HANDLE wait, select_op_t select_op; UINT flags = SELECT_INTERRUPTIBLE; + if (do_esync()) + return esync_signal_and_wait( signal, wait, alertable, timeout ); + if (!signal) return STATUS_INVALID_HANDLE; if (alertable) flags |= SELECT_ALERTABLE; From 97c459e2f765693d80bb9ce79a1f6725c67621bd Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:56:09 -0500 Subject: [PATCH 0456/1506] ntdll: Implement NtOpenSemaphore(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 47 +++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 2 ++ dlls/ntdll/unix/sync.c | 4 ++++ server/esync.c | 31 +++++++++++++++++++++++++++ server/protocol.def | 12 +++++++++++ 5 files changed, 96 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 2c7702cd120..ee550e29b74 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -326,6 +326,45 @@ static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, ACCESS_MASK return ret; } +static NTSTATUS open_esync( enum esync_type type, HANDLE *handle, + ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ) +{ + NTSTATUS ret; + obj_handle_t fd_handle; + unsigned int shm_idx; + sigset_t sigset; + int fd; + + server_enter_uninterrupted_section( &fd_cache_mutex, &sigset ); + SERVER_START_REQ( open_esync ) + { + req->access = access; + req->attributes = attr->Attributes; + req->rootdir = wine_server_obj_handle( attr->RootDirectory ); + req->type = type; + if (attr->ObjectName) + wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length ); + if (!(ret = wine_server_call( req ))) + { + *handle = wine_server_ptr_handle( reply->handle ); + type = reply->type; + shm_idx = reply->shm_idx; + fd = receive_fd( &fd_handle ); + assert( wine_server_ptr_handle(fd_handle) == *handle ); + } + } + SERVER_END_REQ; + server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); + + if (!ret) + { + add_to_list( *handle, type, fd, shm_idx ? get_shm( shm_idx ) : 0 ); + + TRACE("-> handle %p, fd %d.\n", *handle, fd); + } + return ret; +} + extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) { @@ -335,6 +374,14 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, return create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial, max ); } +NTSTATUS esync_open_semaphore( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ) +{ + TRACE("name %s.\n", debugstr_us(attr->ObjectName)); + + return open_esync( ESYNC_SEMAPHORE, handle, access, attr ); +} + NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) { struct esync *obj; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 88a6d5c8975..6818be9c16f 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -24,6 +24,8 @@ extern NTSTATUS esync_close( HANDLE handle ); extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); +extern NTSTATUS esync_open_semaphore( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 12ed44f7a8e..31253e2235b 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -300,6 +300,10 @@ NTSTATUS WINAPI NtOpenSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJEC unsigned int ret; *handle = 0; + + if (do_esync()) + return esync_open_semaphore( handle, access, attr ); + if ((ret = validate_open_object_attributes( attr ))) return ret; SERVER_START_REQ( open_semaphore ) diff --git a/server/esync.c b/server/esync.c index 3f1c61bc1f0..eca9b6aa67d 100644 --- a/server/esync.c +++ b/server/esync.c @@ -410,6 +410,37 @@ DECL_HANDLER(create_esync) if (root) release_object( root ); } +DECL_HANDLER(open_esync) +{ + struct unicode_str name = get_req_unicode_str(); + + reply->handle = open_object( current->process, req->rootdir, req->access, + &esync_ops, &name, req->attributes ); + + /* send over the fd */ + if (reply->handle) + { + struct esync *esync; + + if (!(esync = (struct esync *)get_handle_obj( current->process, reply->handle, + 0, &esync_ops ))) + return; + + if (!type_matches( req->type, esync->type )) + { + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + release_object( esync ); + return; + } + + reply->type = esync->type; + reply->shm_idx = esync->shm_idx; + + send_client_fd( current->process, esync->fd, reply->handle ); + release_object( esync ); + } +} + /* Retrieve a file descriptor for an esync object which will be signaled by the * server. The client should only read from (i.e. wait on) this object. */ DECL_HANDLER(get_esync_fd) diff --git a/server/protocol.def b/server/protocol.def index 2d6581d5d6c..0786eca012b 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3963,6 +3963,18 @@ enum esync_type unsigned int shm_idx; @END +@REQ(open_esync) + unsigned int access; /* wanted access rights */ + unsigned int attributes; /* object attributes */ + obj_handle_t rootdir; /* root directory */ + int type; /* type of esync object (above) */ + VARARG(name,unicode_str); /* object name */ +@REPLY + obj_handle_t handle; /* handle to the event */ + int type; /* type of esync object (above) */ + unsigned int shm_idx; /* this object's index into the shm section */ +@END + /* Retrieve the esync fd for an object. */ @REQ(get_esync_fd) obj_handle_t handle; /* handle to the object */ From 217a9bb77005954046ccd91168b818ce51f6e86d Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:58:19 -0500 Subject: [PATCH 0457/1506] ntdll: Implement NtOpenEvent(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 8 ++++++++ dlls/ntdll/unix/esync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index ee550e29b74..38a6d30c868 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -427,6 +427,14 @@ NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, return create_esync( type, handle, access, attr, initial, 0 ); } +NTSTATUS esync_open_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ) +{ + TRACE("name %s.\n", debugstr_us(attr->ObjectName)); + + return open_esync( ESYNC_AUTO_EVENT, handle, access, attr ); /* doesn't matter which */ +} + NTSTATUS esync_set_event( HANDLE handle ) { static const uint64_t value = 1; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 6818be9c16f..03894d61fcf 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -30,6 +30,8 @@ extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); +extern NTSTATUS esync_open_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS esync_reset_event( HANDLE handle ); extern NTSTATUS esync_set_event( HANDLE handle ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 31253e2235b..fcd0413ce42 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -423,6 +423,9 @@ NTSTATUS WINAPI NtOpenEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_AT *handle = 0; if ((ret = validate_open_object_attributes( attr ))) return ret; + if (do_esync()) + return esync_open_event( handle, access, attr ); + SERVER_START_REQ( open_event ) { req->access = access; From b2bf453be8d56fb68c59440de0fb704186353317 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:59:35 -0500 Subject: [PATCH 0458/1506] ntdll: Implement NtOpenMutant(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 8 ++++++++ dlls/ntdll/unix/esync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 38a6d30c868..875bf9cd652 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -476,6 +476,14 @@ NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, return create_esync( ESYNC_MUTEX, handle, access, attr, initial ? 0 : 1, 0 ); } +NTSTATUS esync_open_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ) +{ + TRACE("name %s.\n", debugstr_us(attr->ObjectName)); + + return open_esync( ESYNC_MUTEX, handle, access, attr ); +} + NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ) { struct esync *obj; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 03894d61fcf..ac12604a815 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -37,6 +37,8 @@ extern NTSTATUS esync_set_event( HANDLE handle ); extern NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); +extern NTSTATUS esync_open_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ); extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index fcd0413ce42..33a1dc77c47 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -593,6 +593,9 @@ NTSTATUS WINAPI NtOpenMutant( HANDLE *handle, ACCESS_MASK access, const OBJECT_A *handle = 0; if ((ret = validate_open_object_attributes( attr ))) return ret; + if (do_esync()) + return esync_open_mutex( handle, access, attr ); + SERVER_START_REQ( open_mutex ) { req->access = access; From 0d096bf619ddde6fbbaafc2ddbe8e3255ecd6cef Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 10 Jun 2018 19:08:18 -0500 Subject: [PATCH 0459/1506] server: Implement esync_map_access(). Wine-Staging: eventfd_synchronization --- server/esync.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/esync.c b/server/esync.c index eca9b6aa67d..3a334b3b330 100644 --- a/server/esync.c +++ b/server/esync.c @@ -112,6 +112,7 @@ struct esync }; static void esync_dump( struct object *obj, int verbose ); +static unsigned int esync_map_access( struct object *obj, unsigned int access ); static void esync_destroy( struct object *obj ); const struct object_ops esync_ops = @@ -126,7 +127,7 @@ const struct object_ops esync_ops = NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ - default_map_access, /* map_access */ + esync_map_access, /* map_access */ default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ default_get_full_name, /* get_full_name */ @@ -146,6 +147,16 @@ static void esync_dump( struct object *obj, int verbose ) fprintf( stderr, "esync fd=%d\n", esync->fd ); } +static unsigned int esync_map_access( struct object *obj, unsigned int access ) +{ + /* Sync objects have the same flags. */ + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | EVENT_QUERY_STATE; + if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | EVENT_MODIFY_STATE; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE; + if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_ALL | EVENT_QUERY_STATE | EVENT_MODIFY_STATE; + return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + static void esync_destroy( struct object *obj ) { struct esync *esync = (struct esync *)obj; From 3d360c4c106f11e82520d6f307b1b780038a02c8 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:03:05 -0500 Subject: [PATCH 0460/1506] server: Implement NtDuplicateObject(). Wine-Staging: eventfd_synchronization --- server/esync.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/esync.c b/server/esync.c index 3a334b3b330..c5587bef6cf 100644 --- a/server/esync.c +++ b/server/esync.c @@ -112,6 +112,7 @@ struct esync }; static void esync_dump( struct object *obj, int verbose ); +static int esync_get_esync_fd( struct object *obj, enum esync_type *type ); static unsigned int esync_map_access( struct object *obj, unsigned int access ); static void esync_destroy( struct object *obj ); @@ -123,7 +124,7 @@ const struct object_ops esync_ops = no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ - NULL, /* get_esync_fd */ + esync_get_esync_fd, /* get_esync_fd */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -147,6 +148,13 @@ static void esync_dump( struct object *obj, int verbose ) fprintf( stderr, "esync fd=%d\n", esync->fd ); } +static int esync_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct esync *esync = (struct esync *)obj; + *type = esync->type; + return esync->fd; +} + static unsigned int esync_map_access( struct object *obj, unsigned int access ) { /* Sync objects have the same flags. */ From 89d9005f294387a5ecb00a4badc9d7829a733100 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 15 Jun 2018 11:01:44 -0500 Subject: [PATCH 0461/1506] server: Create eventfd descriptors for timers. Wine-Staging: eventfd_synchronization --- server/timer.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/server/timer.c b/server/timer.c index f59902d5607..36645a2a8d2 100644 --- a/server/timer.c +++ b/server/timer.c @@ -35,6 +35,7 @@ #include "file.h" #include "handle.h" #include "request.h" +#include "esync.h" static const WCHAR timer_name[] = {'T','i','m','e','r'}; @@ -61,10 +62,12 @@ struct timer struct thread *thread; /* thread that set the APC function */ client_ptr_t callback; /* callback APC function */ client_ptr_t arg; /* callback argument */ + int esync_fd; /* esync file descriptor */ }; static void timer_dump( struct object *obj, int verbose ); static int timer_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int timer_get_esync_fd( struct object *obj, enum esync_type *type ); static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry ); static void timer_destroy( struct object *obj ); @@ -76,7 +79,7 @@ static const struct object_ops timer_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ timer_signaled, /* signaled */ - NULL, /* get_esync_fd */ + timer_get_esync_fd, /* get_esync_fd */ timer_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -111,6 +114,10 @@ static struct timer *create_timer( struct object *root, const struct unicode_str timer->period = 0; timer->timeout = NULL; timer->thread = NULL; + timer->esync_fd = -1; + + if (do_esync()) + timer->esync_fd = esync_create_fd( 0, 0 ); } } return timer; @@ -182,6 +189,9 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period { period = 0; /* period doesn't make any sense for a manual timer */ timer->signaled = 0; + + if (do_esync()) + esync_clear( timer->esync_fd ); } timer->when = (expire <= 0) ? expire - monotonic_time : max( expire, current_time ); timer->period = period; @@ -209,6 +219,13 @@ static int timer_signaled( struct object *obj, struct wait_queue_entry *entry ) return timer->signaled; } +static int timer_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct timer *timer = (struct timer *)obj; + *type = timer->manual ? ESYNC_MANUAL_SERVER : ESYNC_AUTO_SERVER; + return timer->esync_fd; +} + static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct timer *timer = (struct timer *)obj; @@ -223,6 +240,7 @@ static void timer_destroy( struct object *obj ) if (timer->timeout) remove_timeout_user( timer->timeout ); if (timer->thread) release_object( timer->thread ); + if (do_esync()) close( timer->esync_fd ); } /* create a timer */ From 821c9f6c8d7ae56c0d879f6daff06f10f2ccc111 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:17:31 -0500 Subject: [PATCH 0462/1506] ntdll, server: Implement alertable waits. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 77 +++++++++++++++++++++++++++++++--- dlls/ntdll/unix/unix_private.h | 1 + dlls/ntdll/unix/virtual.c | 1 + server/esync.c | 20 +++++++-- server/esync.h | 1 + server/protocol.def | 4 ++ server/thread.c | 13 ++++++ server/thread.h | 1 + 8 files changed, 109 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 875bf9cd652..db453daa229 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -597,17 +597,42 @@ static void update_grabbed_object( struct esync *obj ) static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { + static const LARGE_INTEGER zero; + struct esync *objs[MAXIMUM_WAIT_OBJECTS]; - struct pollfd fds[MAXIMUM_WAIT_OBJECTS]; + struct pollfd fds[MAXIMUM_WAIT_OBJECTS + 1]; int has_esync = 0, has_server = 0; BOOL msgwait = FALSE; LONGLONG timeleft; LARGE_INTEGER now; + DWORD pollcount; ULONGLONG end; int64_t value; ssize_t size; int i, j, ret; + /* Grab the APC fd if we don't already have it. */ + if (alertable && ntdll_get_thread_data()->esync_apc_fd == -1) + { + obj_handle_t fd_handle; + sigset_t sigset; + int fd = -1; + + server_enter_uninterrupted_section( &fd_cache_mutex, &sigset ); + SERVER_START_REQ( get_esync_apc_fd ) + { + if (!(ret = wine_server_call( req ))) + { + fd = receive_fd( &fd_handle ); + assert( fd_handle == GetCurrentThreadId() ); + } + } + SERVER_END_REQ; + server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); + + ntdll_get_thread_data()->esync_apc_fd = fd; + } + NtQuerySystemTime( &now ); if (timeout) { @@ -646,6 +671,8 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA if (msgwait) TRACE(" or driver events"); + if (alertable) + TRACE(", alertable"); if (!timeout) TRACE(", timeout = INFINITE.\n"); @@ -682,12 +709,27 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA fds[i].fd = obj ? obj->fd : -1; fds[i].events = POLLIN; } + if (alertable) + { + fds[i].fd = ntdll_get_thread_data()->esync_apc_fd; + fds[i].events = POLLIN; + i++; + } + pollcount = i; while (1) { - ret = do_poll( fds, count, timeout ? &end : NULL ); + ret = do_poll( fds, pollcount, timeout ? &end : NULL ); if (ret > 0) { + /* We must check this first! The server may set an event that + * we're waiting on, but we need to return STATUS_USER_APC. */ + if (alertable) + { + if (fds[pollcount - 1].revents & POLLIN) + goto userapc; + } + /* Find out which object triggered the wait. */ for (i = 0; i < count; i++) { @@ -761,6 +803,14 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA tryagain: /* First step: try to poll on each object in sequence. */ fds[0].events = POLLIN; + pollcount = 1; + if (alertable) + { + /* We also need to wait on APCs. */ + fds[1].fd = ntdll_get_thread_data()->esync_apc_fd; + fds[1].events = POLLIN; + pollcount++; + } for (i = 0; i < count; i++) { struct esync *obj = objs[i]; @@ -776,9 +826,11 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA continue; } - ret = do_poll( fds, 1, timeout ? &end : NULL ); + ret = do_poll( fds, pollcount, timeout ? &end : NULL ); if (ret <= 0) goto err; + else if (alertable && (fds[1].revents & POLLIN)) + goto userapc; if (fds[0].revents & (POLLHUP | POLLERR | POLLNVAL)) { @@ -794,10 +846,12 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA fds[i].fd = objs[i] ? objs[i]->fd : -1; fds[i].events = POLLIN; } + /* There's no reason to check for APCs here. */ + pollcount = i; /* Poll everything to see if they're still signaled. */ - ret = poll( fds, count, 0 ); - if (ret == count) + ret = poll( fds, pollcount, 0 ); + if (ret == pollcount) { /* Quick, grab everything. */ for (i = 0; i < count; i++) @@ -863,6 +917,19 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA ERR("ppoll failed: %s\n", strerror(errno)); return errno_to_status( errno ); } + +userapc: + TRACE("Woken up by user APC.\n"); + + /* We have to make a server call anyway to get the APC to execute, so just + * delegate down to server_select(). */ + ret = server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, &zero ); + + /* This can happen if we received a system APC, and the APC fd was woken up + * before we got SIGUSR1. poll() doesn't return EINTR in that case. The + * right thing to do seems to be to return STATUS_USER_APC anyway. */ + if (ret == STATUS_TIMEOUT) ret = STATUS_USER_APC; + return ret; } /* We need to let the server know when we are doing a message wait, and when we diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 20fb3b6b7c9..48bb596df99 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -93,6 +93,7 @@ struct ntdll_thread_data { void *cpu_data[16]; /* reserved for CPU-specific data */ void *kernel_stack; /* stack for thread startup and kernel syscalls */ + int esync_apc_fd; /* fd to wait on for user APCs */ int request_fd; /* fd for sending server requests */ int reply_fd; /* fd for receiving server replies */ int wait_fd[2]; /* fd for sleeping server requests */ diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index d2d07829e34..2309f936f66 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3707,6 +3707,7 @@ static TEB *init_teb( void *ptr, BOOL is_wow ) teb->StaticUnicodeString.Buffer = teb->StaticUnicodeBuffer; teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer); thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; + thread_data->esync_apc_fd = -1; thread_data->request_fd = -1; thread_data->reply_fd = -1; thread_data->wait_fd[0] = -1; diff --git a/server/esync.c b/server/esync.c index c5587bef6cf..0c365006f0b 100644 --- a/server/esync.c +++ b/server/esync.c @@ -346,19 +346,25 @@ int esync_create_fd( int initval, int flags ) #endif } +/* Wake up a specific fd. */ +void esync_wake_fd( int fd ) +{ + static const uint64_t value = 1; + + if (write( fd, &value, sizeof(value) ) == -1) + perror( "esync: write" ); +} + /* Wake up a server-side esync object. */ void esync_wake_up( struct object *obj ) { - static const uint64_t value = 1; enum esync_type dummy; int fd; if (obj->ops->get_esync_fd) { fd = obj->ops->get_esync_fd( obj, &dummy ); - - if (write( fd, &value, sizeof(value) ) == -1) - perror( "esync: write" ); + esync_wake_fd( fd ); } } @@ -496,3 +502,9 @@ DECL_HANDLER(get_esync_fd) release_object( obj ); } + +/* Return the fd used for waiting on user APCs. */ +DECL_HANDLER(get_esync_apc_fd) +{ + send_client_fd( current->process, current->esync_apc_fd, current->id ); +} diff --git a/server/esync.h b/server/esync.h index 689d8569b73..e1588d205d9 100644 --- a/server/esync.h +++ b/server/esync.h @@ -23,6 +23,7 @@ extern int do_esync(void); void esync_init(void); int esync_create_fd( int initval, int flags ); +void esync_wake_fd( int fd ); void esync_wake_up( struct object *obj ); void esync_clear( int fd ); diff --git a/server/protocol.def b/server/protocol.def index 0786eca012b..d5026dce3d9 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3987,3 +3987,7 @@ enum esync_type @REQ(esync_msgwait) int in_msgwait; /* are we in a message wait? */ @END + +/* Retrieve the fd to wait on for user APCs. */ +@REQ(get_esync_apc_fd) +@END diff --git a/server/thread.c b/server/thread.c index 69b919d400e..9592ae6c8bf 100644 --- a/server/thread.c +++ b/server/thread.c @@ -264,6 +264,7 @@ static inline void init_thread_structure( struct thread *thread ) thread->teb = 0; thread->entry_point = 0; thread->esync_fd = -1; + thread->esync_apc_fd = -1; thread->system_regs = 0; thread->queue = NULL; thread->wait = NULL; @@ -477,7 +478,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu } if (do_esync()) + { thread->esync_fd = esync_create_fd( 0, 0 ); + thread->esync_apc_fd = esync_create_fd( 0, 0 ); + } set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */ add_process_thread( thread->process, thread ); @@ -1321,8 +1325,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr grab_object( apc ); list_add_tail( queue, &apc->entry ); if (!list_prev( queue, &apc->entry )) /* first one */ + { wake_thread( thread ); + if (do_esync() && queue == &thread->user_apc) + esync_wake_fd( thread->esync_apc_fd ); + } + return 1; } @@ -1368,6 +1377,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system apc = LIST_ENTRY( ptr, struct thread_apc, entry ); list_remove( ptr ); } + + if (do_esync() && list_empty( &thread->system_apc ) && list_empty( &thread->user_apc )) + esync_clear( thread->esync_apc_fd ); + return apc; } diff --git a/server/thread.h b/server/thread.h index 8086a98156e..a01d492361d 100644 --- a/server/thread.h +++ b/server/thread.h @@ -55,6 +55,7 @@ struct thread thread_id_t id; /* thread id */ struct list mutex_list; /* list of currently owned mutexes */ int esync_fd; /* esync file descriptor (signalled on exit) */ + int esync_apc_fd; /* esync apc fd (signalled when APCs are present) */ unsigned int system_regs; /* which system regs have been set */ struct msg_queue *queue; /* message queue */ struct thread_wait *wait; /* current wait condition if sleeping */ From 669f8f0620dfa0b6cc02abeaf9f58fc4c5ef01a6 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 10 Jun 2018 13:53:08 -0500 Subject: [PATCH 0463/1506] esync: Update README. Wine-Staging: eventfd_synchronization --- README.esync | 48 +++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/README.esync b/README.esync index 8fcb969011b..627cc3f481e 100644 --- a/README.esync +++ b/README.esync @@ -88,32 +88,23 @@ also kind of ugly basically because we have to wait on both X11's fd and the messages. The upshot about the whole thing was that races are basically impossible, since a thread can only wait on its own queue. -I had kind of figured that APCs just wouldn't work, but then poll() spat EINTR -at me and I realized that this wasn't necessarily true. It seems that the -server will suspend a thread when trying to deliver a system APC to a thread -that's not waiting, and since the server has no idea that we're waiting it -just suspends us. This of course interrupts poll(), which complains at us, and -it turns out that just returning STATUS_USER_APC in that case is enough to -make rpcrt4 happy. +System APCs already work, since the server will forcibly suspend a thread if +it's not already waiting, and so we just need to check for EINTR from +poll(). User APCs and alertable waits are implemented in a similar style to +message queues (well, sort of): whenever someone executes an alertable wait, +we add an additional eventfd to the list, which the server signals when an APC +arrives. If that eventfd gets signaled, we hand it off to the server to take +care of, and return STATUS_USER_APC. + +Originally I kept the volatile state of semaphores and mutexes inside a +variable local to the handle, with the knowledge that this would break if +someone tried to open the handle elsewhere or duplicate it. It did, and so now +this state is stored inside shared memory. This is of the POSIX variety, is +allocated by the server (but never mapped there) and lives under the path +"/wine-esync". There are a couple things that this infrastructure can't handle, although surprisingly there aren't that many. In particular: -* We can't return the previous count on a semaphore, since we have no way to - query the count on a semaphore through eventfd. Currently the code lies and - returns 1 every time. We can make this work (in a single process, or [if - necessary] in multiple processes through shared memory) by keeping a count - locally. We can't guarantee that it's the exact count at the moment the - semaphore was released, but I guess any program that runs into that race - shouldn't be depending on that fact anyway. -* Similarly, we can't enforce the maximum count on a semaphore, since we have - no way to get the current count and subsequently compare it with the - maximum. -* We can't use NtQueryMutant to get the mutant's owner or count if it lives in - a different process. If necessary we can use shared memory to make this - work, I guess, but see below. -* User APCs don't work. However, it's not impossible to make them work; in - particular I think this could be relatively easily implemented by waiting on - another internal file descriptor when we execute an alertable wait. * Implementing wait-all, i.e. WaitForMultipleObjects(..., TRUE, ...), is not exactly possible the way we'd like it to be possible. In theory that function should wait until it knows all objects are available, then grab @@ -144,18 +135,13 @@ surprisingly there aren't that many. In particular: There are some things that are perfectly implementable but that I just haven't done yet: -* NtOpen* (aka Open*). This is just a matter of adding another open_esync - request analogous to those for other server primitives. -* NtQuery*. This can be done to some degree (the difficulties are outlined - above). That said, these APIs aren't exposed through kernel32 in any way, so +* NtQuery*. That said, these APIs aren't exposed through kernel32 in any way, so I doubt anyone is going to be using them. -* SignalObjectAndWait(). The server combines this into a single operation, but - according to MSDN it doesn't need to be atomic, so we can just signal the - appropriate object and wait, and woe betide anyone who gets in the way of - those two operations. * Other synchronizable server primitives. It's unlikely we'll need any of these, except perhaps named pipes (which would honestly be rather difficult) and (maybe) timers. +* Access masks. We'd need to store these inside ntdll, and validate them when + someone tries to execute esync operations. This patchset was inspired by Daniel Santos' "hybrid synchronization" patchset. My idea was to create a framework whereby even contended waits could From 108d555ad71a121603a44316382c545136edf5b8 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 13 Jun 2018 22:25:40 -0500 Subject: [PATCH 0464/1506] kernel32/tests: Mark some existing tests as failing under esync. Wine-Staging: eventfd_synchronization --- dlls/kernel32/tests/sync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 56a9d6e4859..f1ea2d671be 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -268,7 +268,8 @@ static void test_mutex(void) SetLastError(0xdeadbeef); hOpened = OpenMutexA(GENERIC_READ | GENERIC_WRITE, FALSE, "WineTestMutex"); ok(hOpened != NULL, "OpenMutex failed with error %ld\n", GetLastError()); - wait_ret = WaitForSingleObject(hOpened, INFINITE); + wait_ret = WaitForSingleObject(hOpened, 0); +todo_wine_if(getenv("WINEESYNC")) /* XFAIL: validation is not implemented */ ok(wait_ret == WAIT_FAILED, "WaitForSingleObject succeeded\n"); CloseHandle(hOpened); @@ -299,6 +300,7 @@ static void test_mutex(void) SetLastError(0xdeadbeef); ret = ReleaseMutex(hCreated); +todo_wine_if(getenv("WINEESYNC")) /* XFAIL: due to the above */ ok(!ret && (GetLastError() == ERROR_NOT_OWNER), "ReleaseMutex should have failed with ERROR_NOT_OWNER instead of %ld\n", GetLastError()); From 3ae889468da25830d32a5068cd3c81c9d01430b5 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 13 Jun 2018 22:40:47 -0500 Subject: [PATCH 0465/1506] kernel32/tests: Add some semaphore tests. Wine-Staging: eventfd_synchronization --- dlls/kernel32/tests/sync.c | 98 +++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index f1ea2d671be..3d387aced35 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -627,7 +627,10 @@ static void test_event(void) static void test_semaphore(void) { - HANDLE handle, handle2; + HANDLE handle, handle2, handles[2]; + DWORD ret; + LONG prev; + int i; /* test case sensitivity */ @@ -669,6 +672,99 @@ static void test_semaphore(void) ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError()); CloseHandle( handle ); + + handle = CreateSemaphoreA( NULL, 0, 5, NULL ); + ok(!!handle, "CreateSemaphore failed: %lu\n", GetLastError()); + + ret = WaitForSingleObject( handle, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ret = ReleaseSemaphore( handle, 1, &prev ); + ok(ret, "got error %lu\n", GetLastError()); + ok(prev == 0, "got prev %ld\n", prev); + + ret = ReleaseSemaphore( handle, 1, &prev ); + ok(ret, "got error %lu\n", GetLastError()); + ok(prev == 1, "got prev %ld\n", prev); + + ret = ReleaseSemaphore( handle, 5, &prev ); + ok(!ret, "got %ld\n", ret); + ok(GetLastError() == ERROR_TOO_MANY_POSTS, "got error %lu\n", GetLastError()); + ok(prev == 1, "got prev %ld\n", prev); + + ret = ReleaseSemaphore( handle, 2, &prev ); + ok(ret, "got error %lu\n", GetLastError()); + ok(prev == 2, "got prev %ld\n", prev); + + ret = ReleaseSemaphore( handle, 1, &prev ); + ok(ret, "got error %lu\n", GetLastError()); + ok(prev == 4, "got prev %ld\n", prev); + + for (i = 0; i < 5; i++) + { + ret = WaitForSingleObject( handle, 0 ); + ok(ret == 0, "got %lu\n", ret); + } + + ret = WaitForSingleObject( handle, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + handle2 = CreateSemaphoreA( NULL, 3, 5, NULL ); + ok(!!handle2, "CreateSemaphore failed: %lu\n", GetLastError()); + + ret = ReleaseSemaphore( handle2, 1, &prev ); + ok(ret, "got error %lu\n", GetLastError()); + ok(prev == 3, "got prev %ld\n", prev); + + for (i = 0; i < 4; i++) + { + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == 0, "got %lu\n", ret); + } + + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + handles[0] = handle; + handles[1] = handle2; + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ReleaseSemaphore( handle, 1, NULL ); + ReleaseSemaphore( handle2, 1, NULL ); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 1, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ReleaseSemaphore( handle, 1, NULL ); + ReleaseSemaphore( handle2, 1, NULL ); + + ret = WaitForMultipleObjects( 2, handles, TRUE, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ReleaseSemaphore( handle, 1, NULL ); + + ret = WaitForMultipleObjects( 2, handles, TRUE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ret = WaitForSingleObject( handle, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = CloseHandle( handle ); + ok(ret, "got error %lu\n", ret); + + ret = CloseHandle( handle2 ); + ok(ret, "got error %lu\n", ret); } static void test_waitable_timer(void) From 77b6e6f129d0a5b8fc47aaa75fb0169df229353e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 13 Jun 2018 22:59:37 -0500 Subject: [PATCH 0466/1506] kernel32/tests: Add some event tests. Wine-Staging: eventfd_synchronization --- dlls/kernel32/tests/sync.c | 119 ++++++++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 3d387aced35..a3992810266 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -514,12 +514,13 @@ static void test_slist(void) static void test_event(void) { - HANDLE handle, handle2; + HANDLE handle, handle2, handles[2]; SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; ACL acl; DWORD ret; BOOL val; + int i; /* no sd */ handle = CreateEventA(NULL, FALSE, FALSE, __FILE__ ": Test Event"); @@ -623,6 +624,122 @@ static void test_event(void) ok( ret, "QueryMemoryResourceNotification failed err %lu\n", GetLastError() ); ok( val == FALSE || val == TRUE, "wrong value %u\n", val ); CloseHandle( handle ); + + handle = CreateEventA( NULL, TRUE, FALSE, NULL ); + ok(!!handle, "got error %lu\n", GetLastError()); + + ret = WaitForSingleObject( handle, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ret = SetEvent( handle ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = SetEvent( handle ); + ok(ret, "got error %lu\n", GetLastError()); + + for (i = 0; i < 100; i++) + { + ret = WaitForSingleObject( handle, 0 ); + ok(ret == 0, "got %lu\n", ret); + } + + ret = ResetEvent( handle ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = ResetEvent( handle ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = WaitForSingleObject( handle, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + handle2 = CreateEventA( NULL, FALSE, TRUE, NULL ); + ok(!!handle2, "got error %lu\n", GetLastError()); + + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ret = SetEvent( handle2 ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = SetEvent( handle2 ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = ResetEvent( handle2 ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = ResetEvent( handle2 ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + handles[0] = handle; + handles[1] = handle2; + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + SetEvent( handle ); + SetEvent( handle2 ); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ResetEvent( handle ); + SetEvent( handle2 ); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 1, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + SetEvent( handle ); + SetEvent( handle2 ); + + ret = WaitForMultipleObjects( 2, handles, TRUE, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, TRUE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + SetEvent( handle2 ); + ResetEvent( handle ); + + ret = WaitForMultipleObjects( 2, handles, TRUE, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + ret = WaitForSingleObject( handle2, 0 ); + ok(ret == 0, "got %lu\n", ret); + + handles[0] = handle2; + handles[1] = handle; + SetEvent( handle ); + SetEvent( handle2 ); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 1, "got %lu\n", ret); + + ret = WaitForMultipleObjects( 2, handles, FALSE, 0 ); + ok(ret == 1, "got %lu\n", ret); + + ret = CloseHandle( handle ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = CloseHandle( handle2 ); + ok(ret, "got error %lu\n", GetLastError()); } static void test_semaphore(void) From c16f26dee1224b9f09c22f8f8ce08292414e5b22 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 13 Jun 2018 23:32:04 -0500 Subject: [PATCH 0467/1506] kernel32/tests: Add some mutex tests. Wine-Staging: eventfd_synchronization --- dlls/kernel32/tests/sync.c | 94 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index a3992810266..0d668f4e55e 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -227,8 +227,23 @@ static void test_temporary_objects(void) ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError()); } +static HANDLE mutex, mutex2, mutices[2]; + +static DWORD WINAPI mutex_thread( void *param ) +{ + DWORD expect = (DWORD)(DWORD_PTR)param; + DWORD ret; + + ret = WaitForSingleObject( mutex, 0 ); + ok(ret == expect, "expected %lu, got %lu\n", expect, ret); + + if (!ret) ReleaseMutex( mutex ); + return 0; +} + static void test_mutex(void) { + HANDLE thread; DWORD wait_ret; BOOL ret; HANDLE hCreated; @@ -339,6 +354,85 @@ todo_wine_if(getenv("WINEESYNC")) /* XFAIL: due to the above */ CloseHandle(hOpened); CloseHandle(hCreated); + + mutex = CreateMutexA( NULL, FALSE, NULL ); + ok(!!mutex, "got error %lu\n", GetLastError()); + + ret = ReleaseMutex( mutex ); + ok(!ret, "got %d\n", ret); + ok(GetLastError() == ERROR_NOT_OWNER, "got error %lu\n", GetLastError()); + + for (i = 0; i < 100; i++) + { + ret = WaitForSingleObject( mutex, 0 ); + ok(ret == 0, "got %u\n", ret); + } + + for (i = 0; i < 100; i++) + { + ret = ReleaseMutex( mutex ); + ok(ret, "got error %lu\n", GetLastError()); + } + + ret = ReleaseMutex( mutex ); + ok(!ret, "got %d\n", ret); + ok(GetLastError() == ERROR_NOT_OWNER, "got error %lu\n", GetLastError()); + + thread = CreateThread( NULL, 0, mutex_thread, (void *)0, 0, NULL ); + ret = WaitForSingleObject( thread, 2000 ); + ok(ret == 0, "wait failed: %u\n", ret); + + WaitForSingleObject( mutex, 0 ); + + thread = CreateThread( NULL, 0, mutex_thread, (void *)WAIT_TIMEOUT, 0, NULL ); + ret = WaitForSingleObject( thread, 2000 ); + ok(ret == 0, "wait failed: %u\n", ret); + + ret = ReleaseMutex( mutex ); + ok(ret, "got error %lu\n", GetLastError()); + + thread = CreateThread( NULL, 0, mutex_thread, (void *)0, 0, NULL ); + ret = WaitForSingleObject( thread, 2000 ); + ok(ret == 0, "wait failed: %u\n", ret); + + mutex2 = CreateMutexA( NULL, TRUE, NULL ); + ok(!!mutex2, "got error %lu\n", GetLastError()); + + ret = ReleaseMutex( mutex2 ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = ReleaseMutex( mutex2 ); + ok(!ret, "got %d\n", ret); + ok(GetLastError() == ERROR_NOT_OWNER, "got error %lu\n", GetLastError()); + + mutices[0] = mutex; + mutices[1] = mutex2; + + ret = WaitForMultipleObjects( 2, mutices, FALSE, 0 ); + ok(ret == 0, "got %u\n", ret); + + ret = ReleaseMutex( mutex ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = ReleaseMutex( mutex2 ); + ok(!ret, "got %d\n", ret); + ok(GetLastError() == ERROR_NOT_OWNER, "got error %lu\n", GetLastError()); + + ret = WaitForMultipleObjects( 2, mutices, TRUE, 0 ); + ok(ret == 0, "got %u\n", ret); + + ret = ReleaseMutex( mutex ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = ReleaseMutex( mutex2 ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = CloseHandle( mutex ); + ok(ret, "got error %lu\n", GetLastError()); + + ret = CloseHandle( mutex2 ); + ok(ret, "got error %lu\n", GetLastError()); + } static void test_slist(void) From e09691efc9a2ffea9aed25be52bc4453ec903960 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 13 Jun 2018 23:58:01 -0500 Subject: [PATCH 0468/1506] kernel32/tests: Add some tests for wait timeouts. Wine-Staging: eventfd_synchronization --- dlls/kernel32/tests/sync.c | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 0d668f4e55e..2f612390151 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -57,6 +57,7 @@ static BOOLEAN (WINAPI *pTryAcquireSRWLockShared)(PSRWLOCK); static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG_PTR, SIZE_T *, ULONG, ULONG); static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG); +static NTSTATUS (WINAPI *pNtQuerySystemTime)(LARGE_INTEGER *); static NTSTATUS (WINAPI *pNtWaitForSingleObject)(HANDLE, BOOLEAN, const LARGE_INTEGER *); static NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*); static PSLIST_ENTRY (__fastcall *pRtlInterlockedPushListSList)(PSLIST_HEADER list, PSLIST_ENTRY first, @@ -1530,11 +1531,15 @@ static HANDLE modify_handle(HANDLE handle, DWORD modify) return ULongToHandle(tmp); } +#define TIMEOUT_INFINITE (((LONGLONG)0x7fffffff) << 32 | 0xffffffff) + static void test_WaitForSingleObject(void) { HANDLE signaled, nonsignaled, invalid; + LARGE_INTEGER ntnow, ntthen; LARGE_INTEGER timeout; NTSTATUS status; + DWORD now, then; DWORD ret; signaled = CreateEventW(NULL, TRUE, TRUE, NULL); @@ -1619,6 +1624,68 @@ static void test_WaitForSingleObject(void) status = pNtWaitForSingleObject(GetCurrentThread(), FALSE, &timeout); ok(status == STATUS_TIMEOUT, "expected STATUS_TIMEOUT, got %08lx\n", status); + ret = WaitForSingleObject( signaled, 0 ); + ok(ret == 0, "got %lu\n", ret); + + ret = WaitForSingleObject( nonsignaled, 0 ); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + + /* test that a timed wait actually does wait */ + now = GetTickCount(); + ret = WaitForSingleObject( nonsignaled, 100 ); + then = GetTickCount(); + ok(ret == WAIT_TIMEOUT, "got %lu\n", ret); + ok(abs((then - now) - 100) < 5, "got %lu ms\n", then - now); + + now = GetTickCount(); + ret = WaitForSingleObject( signaled, 100 ); + then = GetTickCount(); + ok(ret == 0, "got %lu\n", ret); + ok(abs(then - now) < 5, "got %lu ms\n", then - now); + + ret = WaitForSingleObject( signaled, INFINITE ); + ok(ret == 0, "got %lu\n", ret); + + /* test NT timeouts */ + pNtQuerySystemTime( &ntnow ); + timeout.QuadPart = ntnow.QuadPart + 100 * 10000; + status = pNtWaitForSingleObject( nonsignaled, FALSE, &timeout ); + pNtQuerySystemTime( &ntthen ); + ok(status == STATUS_TIMEOUT, "got %#lx\n", status); + ok(abs(((ntthen.QuadPart - ntnow.QuadPart) / 10000) - 100) < 5, "got %s ns\n", + wine_dbgstr_longlong((ntthen.QuadPart - ntnow.QuadPart) * 100)); + + pNtQuerySystemTime( &ntnow ); + timeout.QuadPart = -100 * 10000; + status = pNtWaitForSingleObject( nonsignaled, FALSE, &timeout ); + pNtQuerySystemTime( &ntthen ); + ok(status == STATUS_TIMEOUT, "got %#lx\n", status); + ok(abs(((ntthen.QuadPart - ntnow.QuadPart) / 10000) - 100) < 5, "got %s ns\n", + wine_dbgstr_longlong((ntthen.QuadPart - ntnow.QuadPart) * 100)); + + status = pNtWaitForSingleObject( signaled, FALSE, NULL ); + ok(status == 0, "got %#lx\n", status); + + timeout.QuadPart = TIMEOUT_INFINITE; + status = pNtWaitForSingleObject( signaled, FALSE, &timeout ); + ok(status == 0, "got %#lx\n", status); + + pNtQuerySystemTime( &ntnow ); + timeout.QuadPart = ntnow.QuadPart; + status = pNtWaitForSingleObject( nonsignaled, FALSE, &timeout ); + pNtQuerySystemTime( &ntthen ); + ok(status == STATUS_TIMEOUT, "got %#lx\n", status); + ok(abs((ntthen.QuadPart - ntnow.QuadPart) / 10000) < 5, "got %s ns\n", + wine_dbgstr_longlong((ntthen.QuadPart - ntnow.QuadPart) * 100)); + + pNtQuerySystemTime( &ntnow ); + timeout.QuadPart = ntnow.QuadPart - 100 * 10000; + status = pNtWaitForSingleObject( nonsignaled, FALSE, &timeout ); + pNtQuerySystemTime( &ntthen ); + ok(status == STATUS_TIMEOUT, "got %#lx\n", status); + ok(abs((ntthen.QuadPart - ntnow.QuadPart) / 10000) < 5, "got %s ns\n", + wine_dbgstr_longlong((ntthen.QuadPart - ntnow.QuadPart) * 100)); + CloseHandle(signaled); CloseHandle(nonsignaled); } @@ -3176,6 +3243,7 @@ START_TEST(sync) pTryAcquireSRWLockShared = (void *)GetProcAddress(hdll, "TryAcquireSRWLockShared"); pNtAllocateVirtualMemory = (void *)GetProcAddress(hntdll, "NtAllocateVirtualMemory"); pNtFreeVirtualMemory = (void *)GetProcAddress(hntdll, "NtFreeVirtualMemory"); + pNtQuerySystemTime = (void *)GetProcAddress(hntdll, "NtQuerySystemTime"); pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject"); pNtWaitForMultipleObjects = (void *)GetProcAddress(hntdll, "NtWaitForMultipleObjects"); pRtlInterlockedPushListSList = (void *)GetProcAddress(hntdll, "RtlInterlockedPushListSList"); From 23b55f9feb9ef4873cecce933bfcf4cb101fa4f6 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 26 Jun 2018 18:44:44 -0500 Subject: [PATCH 0469/1506] kernel32/tests: Zigzag test. The primary function is to check for races. The secondary function is to measure performance. Wine-Staging: eventfd_synchronization --- dlls/kernel32/tests/sync.c | 79 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 2f612390151..f1d0dfc3d27 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -3217,6 +3217,84 @@ static void test_QueueUserAPC(void) ok(apc_count == 1, "APC count %u\n", apc_count); } +static int zigzag_state, zigzag_count[2], zigzag_stop; + +static DWORD CALLBACK zigzag_event0(void *arg) +{ + HANDLE *events = arg; + + while (!zigzag_stop) + { + WaitForSingleObject(events[0], INFINITE); + ResetEvent(events[0]); + ok(zigzag_state == 0, "got wrong state %d\n", zigzag_state); + zigzag_state++; + SetEvent(events[1]); + zigzag_count[0]++; + } + trace("thread 0 got done\n"); + return 0; +} + +static DWORD CALLBACK zigzag_event1(void *arg) +{ + HANDLE *events = arg; + + while (!zigzag_stop) + { + WaitForSingleObject(events[1], INFINITE); + ResetEvent(events[1]); + ok(zigzag_state == 1, "got wrong state %d\n", zigzag_state); + zigzag_state--; + SetEvent(events[0]); + zigzag_count[1]++; + } + trace("thread 1 got done\n"); + return 0; +} + +static void test_zigzag_event(void) +{ + /* The basic idea is to test SetEvent/Wait back and forth between two + * threads. Each thread clears their own event, sets some common data, + * signals the other's, then waits on their own. We make sure the common + * data is always in the right state. We also print performance data. */ + + HANDLE threads[2], events[2]; + BOOL ret; + + events[0] = CreateEventA(NULL, FALSE, FALSE, NULL); + events[1] = CreateEventA(NULL, FALSE, FALSE, NULL); + + threads[0] = CreateThread(NULL, 0, zigzag_event0, events, 0, NULL); + threads[1] = CreateThread(NULL, 0, zigzag_event1, events, 0, NULL); + + zigzag_state = 0; + zigzag_count[0] = zigzag_count[1] = 0; + zigzag_stop = 0; + + trace("starting zigzag test (events)\n"); + SetEvent(events[0]); + Sleep(2000); + zigzag_stop = 1; + ret = WaitForMultipleObjects(2, threads, FALSE, INFINITE); + trace("%d\n", ret); + ok(ret == 0 || ret == 1, "wait failed: %u\n", ret); + + ok(zigzag_count[0] == zigzag_count[1] || zigzag_count[0] == zigzag_count[1] + 1, + "count did not match: %d != %d\n", zigzag_count[0], zigzag_count[1]); + + /* signal the other thread to finish, if it didn't already + * (in theory they both would at the same time, but there's a slight race on teardown if we get + * thread 1 SetEvent -> thread 0 ResetEvent -> thread 0 Wait -> thread 1 exits */ + zigzag_state = 1-ret; + SetEvent(events[1-ret]); + ret = WaitForSingleObject(threads[1-ret], 1000); + ok(!ret, "wait failed: %u\n", ret); + + trace("count: %d\n", zigzag_count[0]); +} + START_TEST(sync) { char **argv; @@ -3288,5 +3366,6 @@ START_TEST(sync) test_srwlock_example(); test_alertable_wait(); test_apc_deadlock(); + test_zigzag_event(); test_crit_section(); } From 5009d4b08a1018e563f3a7138e8acc3b35c006ee Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:24:17 -0500 Subject: [PATCH 0470/1506] ntdll: Implement NtQuerySemaphore(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 19 +++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index db453daa229..d0ddd0c265e 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -415,6 +415,25 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) return STATUS_SUCCESS; } +NTSTATUS esync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ) +{ + struct esync *obj; + struct semaphore *semaphore; + SEMAPHORE_BASIC_INFORMATION *out = info; + NTSTATUS ret; + + TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); + + if ((ret = get_object( handle, &obj ))) return ret; + semaphore = obj->shm; + + out->CurrentCount = semaphore->count; + out->MaximumCount = semaphore->max; + if (ret_len) *ret_len = sizeof(*out); + + return STATUS_SUCCESS; +} + NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE event_type, BOOLEAN initial ) { diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index ac12604a815..e7d4cd2aba4 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -26,6 +26,7 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); extern NTSTATUS esync_open_semaphore( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); +extern NTSTATUS esync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 33a1dc77c47..c9450003ce3 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -340,6 +340,9 @@ NTSTATUS WINAPI NtQuerySemaphore( HANDLE handle, SEMAPHORE_INFORMATION_CLASS cla if (len != sizeof(SEMAPHORE_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH; + if (do_esync()) + return esync_query_semaphore( handle, info, ret_len ); + SERVER_START_REQ( query_semaphore ) { req->handle = wine_server_obj_handle( handle ); From f1725526e31e3aa76bccf2094b10c34836d4dcea Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:26:56 -0500 Subject: [PATCH 0471/1506] ntdll: Implement NtQueryEvent(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 20 ++++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index d0ddd0c265e..e5d6ca145a5 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -486,6 +486,26 @@ NTSTATUS esync_reset_event( HANDLE handle ) return STATUS_SUCCESS; } +NTSTATUS esync_query_event( HANDLE handle, void *info, ULONG *ret_len ) +{ + struct esync *obj; + EVENT_BASIC_INFORMATION *out = info; + struct pollfd fd; + NTSTATUS ret; + + TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); + + if ((ret = get_object( handle, &obj ))) return ret; + + fd.fd = obj->fd; + fd.events = POLLIN; + out->EventState = poll( &fd, 1, 0 ); + out->EventType = (obj->type == ESYNC_AUTO_EVENT ? SynchronizationEvent : NotificationEvent); + if (ret_len) *ret_len = sizeof(*out); + + return STATUS_SUCCESS; +} + NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ) { diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index e7d4cd2aba4..9a0fcd163dd 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -33,6 +33,7 @@ extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS esync_open_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); +extern NTSTATUS esync_query_event( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS esync_reset_event( HANDLE handle ); extern NTSTATUS esync_set_event( HANDLE handle ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index c9450003ce3..2fea9f532bd 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -539,6 +539,9 @@ NTSTATUS WINAPI NtQueryEvent( HANDLE handle, EVENT_INFORMATION_CLASS class, if (len != sizeof(EVENT_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH; + if (do_esync()) + return esync_query_event( handle, info, ret_len ); + SERVER_START_REQ( query_event ) { req->handle = wine_server_obj_handle( handle ); From 241f39c02ac5a89f36f2ee1c452c481c56f6f639 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:28:58 -0500 Subject: [PATCH 0472/1506] ntdll: Implement NtQueryMutant(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 20 ++++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index e5d6ca145a5..7ee00ab3489 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -557,6 +557,26 @@ NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ) return STATUS_SUCCESS; } +NTSTATUS esync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) +{ + struct esync *obj; + struct mutex *mutex; + MUTANT_BASIC_INFORMATION *out = info; + NTSTATUS ret; + + TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); + + if ((ret = get_object( handle, &obj ))) return ret; + mutex = obj->shm; + + out->CurrentCount = 1 - mutex->count; + out->OwnedByCaller = (mutex->tid == GetCurrentThreadId()); + out->AbandonedState = FALSE; + if (ret_len) *ret_len = sizeof(*out); + + return STATUS_SUCCESS; +} + #define TICKSPERSEC 10000000 #define TICKSPERMSEC 10000 diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 9a0fcd163dd..61846238ab7 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -41,6 +41,7 @@ extern NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); extern NTSTATUS esync_open_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); +extern NTSTATUS esync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ); extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 2fea9f532bd..5d25f086d5d 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -657,6 +657,9 @@ NTSTATUS WINAPI NtQueryMutant( HANDLE handle, MUTANT_INFORMATION_CLASS class, if (len != sizeof(MUTANT_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH; + if (do_esync()) + return esync_query_mutex( handle, info, ret_len ); + SERVER_START_REQ( query_mutex ) { req->handle = wine_server_obj_handle( handle ); From 30a2b74e116fd703dbdea5d9423e40dfaff0c349 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 7 Jul 2018 12:57:47 +0200 Subject: [PATCH 0473/1506] server: Create eventfd descriptors for pseudo-fd objects and use them for named pipes. Wine-Staging: eventfd_synchronization --- server/fd.c | 22 ++++++++++++++++++++++ server/file.h | 1 + server/named_pipe.c | 4 ++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/server/fd.c b/server/fd.c index f9f747016b3..75af39b134e 100644 --- a/server/fd.c +++ b/server/fd.c @@ -96,6 +96,7 @@ #include "handle.h" #include "process.h" #include "request.h" +#include "esync.h" #include "winternl.h" #include "winioctl.h" @@ -156,6 +157,7 @@ struct fd struct completion *completion; /* completion object attached to this fd */ apc_param_t comp_key; /* completion key to set in completion events */ unsigned int comp_flags; /* completion flags */ + int esync_fd; /* esync file descriptor */ }; static void fd_dump( struct object *obj, int verbose ); @@ -1569,6 +1571,9 @@ static void fd_destroy( struct object *obj ) if (fd->unix_fd != -1) close( fd->unix_fd ); free( fd->unix_name ); } + + if (do_esync()) + close( fd->esync_fd ); } /* check if the desired access is possible without violating */ @@ -1687,6 +1692,7 @@ static struct fd *alloc_fd_object(void) fd->poll_index = -1; fd->completion = NULL; fd->comp_flags = 0; + fd->esync_fd = -1; init_async_queue( &fd->read_q ); init_async_queue( &fd->write_q ); init_async_queue( &fd->wait_q ); @@ -1728,11 +1734,15 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use fd->completion = NULL; fd->comp_flags = 0; fd->no_fd_status = STATUS_BAD_DEVICE_TYPE; + fd->esync_fd = -1; init_async_queue( &fd->read_q ); init_async_queue( &fd->write_q ); init_async_queue( &fd->wait_q ); list_init( &fd->inode_entry ); list_init( &fd->locks ); + + if (do_esync()) + fd->esync_fd = esync_create_fd( 0, 0 ); return fd; } @@ -2144,6 +2154,9 @@ void set_fd_signaled( struct fd *fd, int signaled ) if (fd->comp_flags & FILE_SKIP_SET_EVENT_ON_HANDLE) return; fd->signaled = signaled; if (signaled) wake_up( fd->user, 0 ); + + if (do_esync() && !signaled) + esync_clear( fd->esync_fd ); } /* check if events are pending and if yes return which one(s) */ @@ -2169,6 +2182,15 @@ int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry ) return ret; } +int default_fd_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct fd *fd = get_obj_fd( obj ); + int ret = fd->esync_fd; + *type = ESYNC_MANUAL_SERVER; + release_object( fd ); + return ret; +} + int default_fd_get_poll_events( struct fd *fd ) { int events = 0; diff --git a/server/file.h b/server/file.h index b8edec64af4..fadb3436add 100644 --- a/server/file.h +++ b/server/file.h @@ -108,6 +108,7 @@ extern char *dup_fd_name( struct fd *root, const char *name ) __WINE_DEALLOC(fre extern void get_nt_name( struct fd *fd, struct unicode_str *name ); extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry ); +extern int default_fd_get_esync_fd( struct object *obj, enum esync_type *type ); extern int default_fd_get_poll_events( struct fd *fd ); extern void default_poll_event( struct fd *fd, int event ); extern void fd_cancel_async( struct fd *fd, struct async *async ); diff --git a/server/named_pipe.c b/server/named_pipe.c index f28cb14cb45..a90ec606226 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -168,7 +168,7 @@ static const struct object_ops pipe_server_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ - NULL, /* get_esync_fd */ + default_fd_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ @@ -213,7 +213,7 @@ static const struct object_ops pipe_client_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ - NULL, /* get_esync_fd */ + default_fd_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ From ba4b209b18de66f13e7719109ec5cf56eda46fec Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 4 Jul 2018 14:58:33 +0200 Subject: [PATCH 0474/1506] esync: Update README. Wine-Staging: eventfd_synchronization --- README.esync | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.esync b/README.esync index 627cc3f481e..30e241755ad 100644 --- a/README.esync +++ b/README.esync @@ -2,6 +2,29 @@ This is eventfd-based synchronization, or 'esync' for short. Turn it on with WINEESYNC=1 (note that it checks the presence and not the value); debug it with +esync. +== BUGS AND LIMITATIONS == + +Please let me know if you find any bugs. If you can, also attach a log with ++seh,+pid,+esync,+server. + +If you get something like "eventfd: Too many open files" and then things start +crashing, you've probably run out of file descriptors. esync creates one +eventfd descriptor for each synchronization object, and some games may use a +large number of these. Linux by default limits a process to 4096 file +descriptors, which probably was reasonable back in the nineties but isn't +really anymore. (Fortunately Debian and derivatives [Ubuntu, Mint] already +have a reasonable limit.) To raise the limit you'll want to edit +/etc/security/limits.conf and add a line like + +* hard nofile 1048576 + +then restart your session. + +Also note that if the wineserver has esync active, all clients also must, and +vice versa. Otherwise things will probably crash quite badly. + +== EXPLANATION == + The aim is to execute all synchronization operations in "user-space", that is, without going through wineserver. We do this using Linux's eventfd facility. The main impetus to using eventfd is so that we can poll multiple @@ -135,8 +158,6 @@ surprisingly there aren't that many. In particular: There are some things that are perfectly implementable but that I just haven't done yet: -* NtQuery*. That said, these APIs aren't exposed through kernel32 in any way, so - I doubt anyone is going to be using them. * Other synchronizable server primitives. It's unlikely we'll need any of these, except perhaps named pipes (which would honestly be rather difficult) and (maybe) timers. From 036b4bd7e6f57acca2c3dcb879e9d8af8f874ae7 Mon Sep 17 00:00:00 2001 From: Mathieu Comandon Date: Sat, 21 Jul 2018 12:56:50 -0700 Subject: [PATCH 0475/1506] esync: Add note about file limits not being raised when using systemd. Wine-Staging: eventfd_synchronization --- README.esync | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.esync b/README.esync index 30e241755ad..7706f395ebd 100644 --- a/README.esync +++ b/README.esync @@ -20,6 +20,16 @@ have a reasonable limit.) To raise the limit you'll want to edit then restart your session. +On distributions using systemd, the settings in `/etc/security/limits.conf` will +be overridden by systemd's own settings. If you run `ulimit -Hn` and it returns +a lower number than the one you've previously set then you can set + +DefaultLimitNOFILE=100000 + +in both `/etc/systemd/system.conf` and `/etc/systemd/user.conf`. You can then +execute `sudo systemctl daemon-reexec` and restart your session. Check again +with `ulimit -Hn` that the limit is correct. + Also note that if the wineserver has esync active, all clients also must, and vice versa. Otherwise things will probably crash quite badly. @@ -188,4 +198,4 @@ done by the kernel. Anyway, yeah, this is esync. Use it if you like. ---Zebediah Figura \ No newline at end of file +--Zebediah Figura From 5dad82cbddd503a32ec243ff44c33b790a71787e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:37:29 -0500 Subject: [PATCH 0476/1506] ntdll: Try to avoid poll() for uncontended objects. Just semaphores and mutexes thus far. We don't have to worry about races because this is just a hint: we still call read() eventually. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 60 ++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 7ee00ab3489..84a4dc18a14 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -745,23 +745,63 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA if (wait_any || count == 1) { + /* Try to check objects now, so we can obviate poll() at least. */ for (i = 0; i < count; i++) { struct esync *obj = objs[i]; - if (obj && obj->type == ESYNC_MUTEX) + if (obj) { - /* If we already own the mutex, return immediately. */ - /* Note: This violates the assumption that the *first* object - * to be signaled will be returned. If that becomes a problem, - * we can always check the state of each object before waiting. */ - struct mutex *mutex = (struct mutex *)obj; + switch (obj->type) + { + case ESYNC_MUTEX: + { + struct mutex *mutex = obj->shm; - if (mutex->tid == GetCurrentThreadId()) + if (mutex->tid == GetCurrentThreadId()) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->count++; + return i; + } + else if (!mutex->count) + { + if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value)) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->tid = GetCurrentThreadId(); + mutex->count++; + return i; + } + } + break; + } + case ESYNC_SEMAPHORE: { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - mutex->count++; - return i; + struct semaphore *semaphore = obj->shm; + + if (semaphore->count) + { + if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value)) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + InterlockedDecrement( (LONG *)&semaphore->count ); + return i; + } + } + break; + } + case ESYNC_AUTO_EVENT: + case ESYNC_MANUAL_EVENT: + /* TODO */ + break; + case ESYNC_AUTO_SERVER: + case ESYNC_MANUAL_SERVER: + case ESYNC_QUEUE: + /* We can't wait on any of these. Fortunately I don't think + * they'll ever be uncontended anyway (at least, they won't be + * performance-critical). */ + break; } } From fb516e619e24bf38290a733a4aa02989b4cb5949 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:44:26 -0500 Subject: [PATCH 0477/1506] ntdll, server: Try to avoid poll() for signaled events. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 147 ++++++++++++++++++++++++++++++++++++++-- server/esync.c | 61 +++++++++++++++-- 2 files changed, 197 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 84a4dc18a14..880cf5006ae 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -454,18 +454,103 @@ NTSTATUS esync_open_event( HANDLE *handle, ACCESS_MASK access, return open_esync( ESYNC_AUTO_EVENT, handle, access, attr ); /* doesn't matter which */ } +static inline void small_pause(void) +{ +#ifdef __i386__ + __asm__ __volatile__( "rep;nop" : : : "memory" ); +#else + __asm__ __volatile__( "" : : : "memory" ); +#endif +} + +/* Manual-reset events are actually racier than other objects in terms of shm + * state. With other objects, races don't matter, because we only treat the shm + * state as a hint that lets us skip poll()—we still have to read(). But with + * manual-reset events we don't, which means that the shm state can be out of + * sync with the actual state. + * + * In general we shouldn't have to worry about races between modifying the + * event and waiting on it. If the state changes while we're waiting, it's + * equally plausible that we caught it before or after the state changed. + * However, we can have races between SetEvent() and ResetEvent(), so that the + * event has inconsistent internal state. + * + * To solve this we have to use the other field to lock the event. Currently + * this is implemented as a spinlock, but I'm not sure if a futex might be + * better. I'm also not sure if it's possible to obviate locking by arranging + * writes and reads in a certain way. + * + * Note that we don't have to worry about locking in esync_wait_objects(). + * There's only two general patterns: + * + * WaitFor() SetEvent() + * ------------------------- + * read() + * signaled = 0 + * signaled = 1 + * write() + * ------------------------- + * read() + * signaled = 1 + * signaled = 0 + * + * ------------------------- + * + * That is, if SetEvent() tries to signal the event before WaitFor() resets its + * signaled state, it won't bother trying to write(), and then the signaled + * state will be reset, so the result is a consistent non-signaled event. + * There's several variations to this pattern but all of them are protected in + * the same way. Note however this is why we have to use interlocked_xchg() + * event inside of the lock. + */ + +/* Removing this spinlock is harder than it looks. esync_wait_objects() can + * deal with inconsistent state well enough, and a race between SetEvent() and + * ResetEvent() gives us license to yield either result as long as we act + * consistently, but that's not enough. Notably, esync_wait_objects() should + * probably act like a fence, so that the second half of esync_set_event() does + * not seep past a subsequent reset. That's one problem, but no guarantee there + * aren't others. */ + NTSTATUS esync_set_event( HANDLE handle ) { static const uint64_t value = 1; struct esync *obj; + struct event *event; NTSTATUS ret; TRACE("%p.\n", handle); - if ((ret = get_object( handle, &obj))) return ret; + if ((ret = get_object( handle, &obj ))) return ret; + event = obj->shm; + + if (obj->type == ESYNC_MANUAL_EVENT) + { + /* Acquire the spinlock. */ + while (InterlockedCompareExchange( (LONG *)&event->locked, 1, 0 )) + small_pause(); + } + + /* For manual-reset events, as long as we're in a lock, we can take the + * optimization of only calling write() if the event wasn't already + * signaled. + * + * For auto-reset events, esync_wait_objects() must grab the kernel object. + * Thus if we got into a race so that the shm state is signaled but the + * eventfd is unsignaled (i.e. reset shm, set shm, set fd, reset fd), we + * *must* signal the fd now, or any waiting threads will never wake up. */ + + if (!InterlockedExchange( (LONG *)&event->signaled, 1 ) || obj->type == ESYNC_AUTO_EVENT) + { + if (write( obj->fd, &value, sizeof(value) ) == -1) + ERR("write: %s\n", strerror(errno)); + } - if (write( obj->fd, &value, sizeof(value) ) == -1) - ERR("write: %s\n", strerror(errno)); + if (obj->type == ESYNC_MANUAL_EVENT) + { + /* Release the spinlock. */ + event->locked = 0; + } return STATUS_SUCCESS; } @@ -474,14 +559,40 @@ NTSTATUS esync_reset_event( HANDLE handle ) { uint64_t value; struct esync *obj; + struct event *event; NTSTATUS ret; TRACE("%p.\n", handle); - if ((ret = get_object( handle, &obj))) return ret; + if ((ret = get_object( handle, &obj ))) return ret; + event = obj->shm; - if (read( obj->fd, &value, sizeof(value) ) == -1 && errno != EWOULDBLOCK && errno != EAGAIN) - ERR("read: %s\n", strerror(errno)); + if (obj->type == ESYNC_MANUAL_EVENT) + { + /* Acquire the spinlock. */ + while (InterlockedCompareExchange( (LONG *)&event->locked, 1, 0 )) + small_pause(); + } + + /* For manual-reset events, as long as we're in a lock, we can take the + * optimization of only calling read() if the event was already signaled. + * + * For auto-reset events, we have no guarantee that the previous "signaled" + * state is actually correct. We need to leave both states unsignaled after + * leaving this function, so we always have to read(). */ + if (InterlockedExchange( (LONG *)&event->signaled, 0 ) || obj->type == ESYNC_AUTO_EVENT) + { + if (read( obj->fd, &value, sizeof(value) ) == -1 && errno != EWOULDBLOCK && errno != EAGAIN) + { + ERR("read: %s\n", strerror(errno)); + } + } + + if (obj->type == ESYNC_MANUAL_EVENT) + { + /* Release the spinlock. */ + event->locked = 0; + } return STATUS_SUCCESS; } @@ -792,9 +903,31 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA break; } case ESYNC_AUTO_EVENT: + { + struct event *event = obj->shm; + + if (event->signaled) + { + if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value)) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + event->signaled = 0; + return i; + } + } + break; + } case ESYNC_MANUAL_EVENT: - /* TODO */ + { + struct event *event = obj->shm; + + if (event->signaled) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } break; + } case ESYNC_AUTO_SERVER: case ESYNC_MANUAL_SERVER: case ESYNC_QUEUE: diff --git a/server/esync.c b/server/esync.c index 0c365006f0b..20ea97869e9 100644 --- a/server/esync.c +++ b/server/esync.c @@ -376,24 +376,77 @@ void esync_clear( int fd ) read( fd, &value, sizeof(value) ); } +static inline void small_pause(void) +{ +#ifdef __i386__ + __asm__ __volatile__( "rep;nop" : : : "memory" ); +#else + __asm__ __volatile__( "" : : : "memory" ); +#endif +} + /* Server-side event support. */ void esync_set_event( struct esync *esync ) { static const uint64_t value = 1; + struct event *event = get_shm( esync->shm_idx ); assert( esync->obj.ops == &esync_ops ); - if (write( esync->fd, &value, sizeof(value) ) == -1) - perror( "esync: write" ); + assert( event != NULL ); + + if (debug_level) + fprintf( stderr, "esync_set_event() fd=%d\n", esync->fd ); + + if (esync->type == ESYNC_MANUAL_EVENT) + { + /* Acquire the spinlock. */ + while (__sync_val_compare_and_swap( &event->locked, 0, 1 )) + small_pause(); + } + + if (!__atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST )) + { + if (write( esync->fd, &value, sizeof(value) ) == -1) + perror( "esync: write" ); + } + + if (esync->type == ESYNC_MANUAL_EVENT) + { + /* Release the spinlock. */ + event->locked = 0; + } } void esync_reset_event( struct esync *esync ) { static uint64_t value = 1; + struct event *event = get_shm( esync->shm_idx ); assert( esync->obj.ops == &esync_ops ); + assert( event != NULL ); - /* we don't care about the return value */ - read( esync->fd, &value, sizeof(value) ); + if (debug_level) + fprintf( stderr, "esync_reset_event() fd=%d\n", esync->fd ); + + if (esync->type == ESYNC_MANUAL_EVENT) + { + /* Acquire the spinlock. */ + while (__sync_val_compare_and_swap( &event->locked, 0, 1 )) + small_pause(); + } + + /* Only bother signaling the fd if we weren't already signaled. */ + if (__atomic_exchange_n( &event->signaled, 0, __ATOMIC_SEQ_CST )) + { + /* we don't care about the return value */ + read( esync->fd, &value, sizeof(value) ); + } + + if (esync->type == ESYNC_MANUAL_EVENT) + { + /* Release the spinlock. */ + event->locked = 0; + } } DECL_HANDLER(create_esync) From 0677cd8b3178c76cc8f0331f1721bfcf38f2036e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 4 Aug 2018 15:18:24 -0500 Subject: [PATCH 0478/1506] esync: Update README. Wine-Staging: eventfd_synchronization --- README.esync | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/README.esync b/README.esync index 7706f395ebd..b64bfefc1a3 100644 --- a/README.esync +++ b/README.esync @@ -5,7 +5,7 @@ with +esync. == BUGS AND LIMITATIONS == Please let me know if you find any bugs. If you can, also attach a log with -+seh,+pid,+esync,+server. ++seh,+pid,+esync,+server,+timestamp. If you get something like "eventfd: Too many open files" and then things start crashing, you've probably run out of file descriptors. esync creates one @@ -20,11 +20,11 @@ have a reasonable limit.) To raise the limit you'll want to edit then restart your session. -On distributions using systemd, the settings in `/etc/security/limits.conf` will -be overridden by systemd's own settings. If you run `ulimit -Hn` and it returns -a lower number than the one you've previously set then you can set +On distributions using systemd, the settings in `/etc/security/limits.conf` +will be overridden by systemd's own settings. If you run `ulimit -Hn` and it +returns a lower number than the one you've previously set, then you can set -DefaultLimitNOFILE=100000 +DefaultLimitNOFILE=1048576 in both `/etc/systemd/system.conf` and `/etc/systemd/user.conf`. You can then execute `sudo systemctl daemon-reexec` and restart your session. Check again @@ -157,10 +157,6 @@ surprisingly there aren't that many. In particular: can probably be something reasonable.) It's also possible, although I haven't yet looked, to use some different kind of synchronization primitives, but pipes would be easiest to tack onto this framework. -* We might hit the maximum number of open fd's. On my system the soft limit is - 1024 and the hard limit is 1048576. I'm inclined to hope this won't be an - issue, since a hypothetical Linux port of any application might just as well - use the same number of eventfds. * PulseEvent() can't work the way it's supposed to work. Fortunately it's rare and deprecated. It's also explicitly mentioned on MSDN that a thread can miss the notification for a kernel APC, so in a sense we're not necessarily From 3285ff0dfa705fd2a861c020c07d89fc80edc02a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 17:56:40 -0500 Subject: [PATCH 0479/1506] ntdll: Implement NtPulseEvent(). Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 25 +++++++++++++++++++++++++ dlls/ntdll/unix/esync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 29 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 880cf5006ae..e9aa3b5194f 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -597,6 +597,31 @@ NTSTATUS esync_reset_event( HANDLE handle ) return STATUS_SUCCESS; } +NTSTATUS esync_pulse_event( HANDLE handle ) +{ + uint64_t value = 1; + struct esync *obj; + NTSTATUS ret; + + TRACE("%p.\n", handle); + + if ((ret = get_object( handle, &obj ))) return ret; + + /* This isn't really correct; an application could miss the write. + * Unfortunately we can't really do much better. Fortunately this is rarely + * used (and publicly deprecated). */ + if (write( obj->fd, &value, sizeof(value) ) == -1) + return errno_to_status( errno ); + + /* Try to give other threads a chance to wake up. Hopefully erring on this + * side is the better thing to do... */ + NtYieldExecution(); + + read( obj->fd, &value, sizeof(value) ); + + return STATUS_SUCCESS; +} + NTSTATUS esync_query_event( HANDLE handle, void *info, ULONG *ret_len ) { struct esync *obj; diff --git a/dlls/ntdll/unix/esync.h b/dlls/ntdll/unix/esync.h index 61846238ab7..59f8809fc1a 100644 --- a/dlls/ntdll/unix/esync.h +++ b/dlls/ntdll/unix/esync.h @@ -33,6 +33,7 @@ extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS esync_open_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); +extern NTSTATUS esync_pulse_event( HANDLE handle ); extern NTSTATUS esync_query_event( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS esync_reset_event( HANDLE handle ); extern NTSTATUS esync_set_event( HANDLE handle ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 5d25f086d5d..3a9fc76c2e4 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -508,6 +508,9 @@ NTSTATUS WINAPI NtPulseEvent( HANDLE handle, LONG *prev_state ) { unsigned int ret; + if (do_esync()) + return esync_pulse_event( handle ); + SERVER_START_REQ( event_op ) { req->handle = wine_server_obj_handle( handle ); From bdcb61bc3a5b3bd4f2c722793b1b4dde54275a6c Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 19 Aug 2018 13:40:05 -0500 Subject: [PATCH 0480/1506] esync: Update README. Wine-Staging: eventfd_synchronization --- README.esync | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.esync b/README.esync index b64bfefc1a3..11d86563a10 100644 --- a/README.esync +++ b/README.esync @@ -1,6 +1,5 @@ This is eventfd-based synchronization, or 'esync' for short. Turn it on with -WINEESYNC=1 (note that it checks the presence and not the value); debug it -with +esync. +WINEESYNC=1; debug it with +esync. == BUGS AND LIMITATIONS == From 15fe50402be3d8379befa4fd2ee63b6fd874a1cc Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 24 Apr 2019 23:21:25 -0500 Subject: [PATCH 0481/1506] server: Create esync file descriptors for true file objects and use them for directory change notifications. Wine-Staging: eventfd_synchronization --- server/change.c | 2 +- server/fd.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/change.c b/server/change.c index 5f1cf9b880b..6bd6920fdb5 100644 --- a/server/change.c +++ b/server/change.c @@ -112,7 +112,7 @@ static const struct object_ops dir_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ - NULL, /* get_esync_fd */ + default_fd_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ dir_get_fd, /* get_fd */ diff --git a/server/fd.c b/server/fd.c index 75af39b134e..4149c9d4637 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1699,6 +1699,9 @@ static struct fd *alloc_fd_object(void) list_init( &fd->inode_entry ); list_init( &fd->locks ); + if (do_esync()) + fd->esync_fd = esync_create_fd( 1, 0 ); + if ((fd->poll_index = add_poll_user( fd )) == -1) { release_object( fd ); From 8a63663844f682e6736bd0992801ffb578b32a56 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 18:01:32 -0500 Subject: [PATCH 0482/1506] ntdll, server: Abandon esync mutexes on thread exit. Wine-Staging: eventfd_synchronization --- dlls/ntdll/unix/esync.c | 31 ++++++++++++++++++++++++++----- server/esync.c | 25 +++++++++++++++++++++++++ server/esync.h | 1 + server/thread.c | 2 ++ 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index e9aa3b5194f..da3d3a2ab29 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -707,7 +707,7 @@ NTSTATUS esync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) out->CurrentCount = 1 - mutex->count; out->OwnedByCaller = (mutex->tid == GetCurrentThreadId()); - out->AbandonedState = FALSE; + out->AbandonedState = (mutex->tid == ~0); if (ret_len) *ret_len = sizeof(*out); return STATUS_SUCCESS; @@ -757,14 +757,19 @@ static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end ) return ret; } -static void update_grabbed_object( struct esync *obj ) +/* Return TRUE if abandoned. */ +static BOOL update_grabbed_object( struct esync *obj ) { + BOOL ret = FALSE; + if (obj->type == ESYNC_MUTEX) { struct mutex *mutex = obj->shm; /* We don't have to worry about a race between this and read(); the * fact that we grabbed it means the count is now zero, so nobody else * can (and the only thread that can release it is us). */ + if (mutex->tid == ~0) + ret = TRUE; mutex->tid = GetCurrentThreadId(); mutex->count++; } @@ -785,6 +790,8 @@ static void update_grabbed_object( struct esync *obj ) * This might already be 0, but that's okay! */ event->signaled = 0; } + + return ret; } /* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we @@ -904,7 +911,13 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA { if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value)) { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (mutex->tid == ~0) + { + TRACE("Woken up by abandoned mutex %p [%d].\n", handles[i], i); + i += STATUS_ABANDONED_WAIT_0; + } + else + TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->tid = GetCurrentThreadId(); mutex->count++; return i; @@ -1017,7 +1030,8 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA { /* We found our object. */ TRACE("Woken up by handle %p [%d].\n", handles[i], i); - update_grabbed_object( obj ); + if (update_grabbed_object( obj )) + return STATUS_ABANDONED_WAIT_0 + i; return i; } } @@ -1110,6 +1124,8 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA ret = poll( fds, pollcount, 0 ); if (ret == pollcount) { + BOOL abandoned = FALSE; + /* Quick, grab everything. */ for (i = 0; i < count; i++) { @@ -1150,8 +1166,13 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA /* Make sure to let ourselves know that we grabbed the mutexes * and semaphores. */ for (i = 0; i < count; i++) - update_grabbed_object( objs[i] ); + abandoned |= update_grabbed_object( objs[i] ); + if (abandoned) + { + TRACE("Wait successful, but some object(s) were abandoned.\n"); + return STATUS_ABANDONED; + } TRACE("Wait successful.\n"); return STATUS_SUCCESS; } diff --git a/server/esync.c b/server/esync.c index 20ea97869e9..e193f61b3a7 100644 --- a/server/esync.c +++ b/server/esync.c @@ -103,12 +103,15 @@ void esync_init(void) atexit( shm_cleanup ); } +static struct list mutex_list = LIST_INIT(mutex_list); + struct esync { struct object obj; /* object header */ int fd; /* eventfd file descriptor */ enum esync_type type; unsigned int shm_idx; /* index into the shared memory section */ + struct list mutex_entry; /* entry in the mutex list (if applicable) */ }; static void esync_dump( struct object *obj, int verbose ); @@ -168,6 +171,8 @@ static unsigned int esync_map_access( struct object *obj, unsigned int access ) static void esync_destroy( struct object *obj ) { struct esync *esync = (struct esync *)obj; + if (esync->type == ESYNC_MUTEX) + list_remove( &esync->mutex_entry ); close( esync->fd ); } @@ -303,6 +308,7 @@ struct esync *create_esync( struct object *root, const struct unicode_str *name, struct mutex *mutex = get_shm( esync->shm_idx ); mutex->tid = initval ? 0 : current->id; mutex->count = initval ? 0 : 1; + list_add_tail( &mutex_list, &esync->mutex_entry ); break; } default: @@ -449,6 +455,25 @@ void esync_reset_event( struct esync *esync ) } } +void esync_abandon_mutexes( struct thread *thread ) +{ + struct esync *esync; + + LIST_FOR_EACH_ENTRY( esync, &mutex_list, struct esync, mutex_entry ) + { + struct mutex *mutex = get_shm( esync->shm_idx ); + + if (mutex->tid == thread->id) + { + if (debug_level) + fprintf( stderr, "esync_abandon_mutexes() fd=%d\n", esync->fd ); + mutex->tid = ~0; + mutex->count = 0; + esync_wake_fd( esync->fd ); + } + } +} + DECL_HANDLER(create_esync) { struct esync *esync; diff --git a/server/esync.h b/server/esync.h index e1588d205d9..d39f4efa3ec 100644 --- a/server/esync.h +++ b/server/esync.h @@ -32,3 +32,4 @@ struct esync; extern const struct object_ops esync_ops; void esync_set_event( struct esync *esync ); void esync_reset_event( struct esync *esync ); +void esync_abandon_mutexes( struct thread *thread ); diff --git a/server/thread.c b/server/thread.c index 9592ae6c8bf..e906e0c07c9 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1476,6 +1476,8 @@ void kill_thread( struct thread *thread, int violent_death ) } kill_console_processes( thread, 0 ); abandon_mutexes( thread ); + if (do_esync()) + esync_abandon_mutexes( thread ); wake_up( &thread->obj, 0 ); if (violent_death) send_thread_signal( thread, SIGQUIT ); cleanup_thread( thread ); From 87810e31a5ae52e59fd8ef6f14d9e868c72e0952 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 17 Oct 2020 19:13:16 -0500 Subject: [PATCH 0483/1506] server: Create esync file descriptors for console servers. Wine-Staging: eventfd_synchronization --- server/console.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/server/console.c b/server/console.c index 1cc9eea6a50..dbd4a97459c 100644 --- a/server/console.c +++ b/server/console.c @@ -41,6 +41,7 @@ #include "wincon.h" #include "winternl.h" #include "wine/condrv.h" +#include "esync.h" struct screen_buffer; @@ -131,20 +132,22 @@ struct console_host_ioctl struct console_server { - struct object obj; /* object header */ - struct fd *fd; /* pseudo-fd for ioctls */ - struct console *console; /* attached console */ - struct list queue; /* ioctl queue */ - struct list read_queue; /* blocking read queue */ + struct object obj; /* object header */ + struct fd *fd; /* pseudo-fd for ioctls */ + struct console *console; /* attached console */ + struct list queue; /* ioctl queue */ + struct list read_queue; /* blocking read queue */ unsigned int busy : 1; /* flag if server processing an ioctl */ unsigned int once_input : 1; /* flag if input thread has already been requested */ - int term_fd; /* UNIX terminal fd */ - struct termios termios; /* original termios */ + int term_fd; /* UNIX terminal fd */ + struct termios termios; /* original termios */ + int esync_fd; }; static void console_server_dump( struct object *obj, int verbose ); static void console_server_destroy( struct object *obj ); static int console_server_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int console_server_get_esync_fd( struct object *obj, enum esync_type *type ); static struct fd *console_server_get_fd( struct object *obj ); static struct object *console_server_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr, struct object *root ); @@ -159,7 +162,7 @@ static const struct object_ops console_server_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ console_server_signaled, /* signaled */ - NULL, /* get_esync_fd */ + console_server_get_esync_fd, /* get_esync_fd */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_server_get_fd, /* get_fd */ @@ -597,6 +600,8 @@ static void disconnect_console_server( struct console_server *server ) list_remove( &call->entry ); console_host_ioctl_terminate( call, STATUS_CANCELLED ); } + if (do_esync()) + esync_clear( server->esync_fd ); while (!list_empty( &server->read_queue )) { struct console_host_ioctl *call = LIST_ENTRY( list_head( &server->read_queue ), struct console_host_ioctl, entry ); @@ -879,6 +884,7 @@ static void console_server_destroy( struct object *obj ) assert( obj->ops == &console_server_ops ); disconnect_console_server( server ); if (server->fd) release_object( server->fd ); + if (do_esync()) close( server->esync_fd ); } static struct object *console_server_lookup_name( struct object *obj, struct unicode_str *name, @@ -920,6 +926,13 @@ static int console_server_signaled( struct object *obj, struct wait_queue_entry return !server->console || !list_empty( &server->queue ); } +static int console_server_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct console_server *server = (struct console_server*)obj; + *type = ESYNC_MANUAL_SERVER; + return server->esync_fd; +} + static struct fd *console_server_get_fd( struct object* obj ) { struct console_server *server = (struct console_server*)obj; @@ -951,6 +964,10 @@ static struct object *create_console_server( void ) return NULL; } allow_fd_caching(server->fd); + server->esync_fd = -1; + + if (do_esync()) + server->esync_fd = esync_create_fd( 0, 0 ); return &server->obj; } @@ -1564,6 +1581,8 @@ DECL_HANDLER(get_next_console_request) /* set result of previous ioctl */ ioctl = LIST_ENTRY( list_head( &server->queue ), struct console_host_ioctl, entry ); list_remove( &ioctl->entry ); + if (do_esync() && list_empty( &server->queue )) + esync_clear( server->esync_fd ); } if (ioctl) @@ -1649,6 +1668,8 @@ DECL_HANDLER(get_next_console_request) { set_error( STATUS_PENDING ); } + if (do_esync() && list_empty( &server->queue )) + esync_clear( server->esync_fd ); release_object( server ); } From 38b5ef03fd17dc439b90a43d6c7209ee9ce41308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20P=C3=A1ral?= Date: Wed, 10 Oct 2018 19:17:00 +0200 Subject: [PATCH 0484/1506] readme: only adjust hard limit in systemd (#20) Instead of increasing both soft and hard fileno limit in systemd instructions, increase just the hard limit. Soft limit needs to stay at 1024 for compatibility with programs using select() instead of newer poll()/epoll(), otherwise such programs might fail. --- README.esync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.esync b/README.esync index 11d86563a10..6520f2da564 100644 --- a/README.esync +++ b/README.esync @@ -23,7 +23,7 @@ On distributions using systemd, the settings in `/etc/security/limits.conf` will be overridden by systemd's own settings. If you run `ulimit -Hn` and it returns a lower number than the one you've previously set, then you can set -DefaultLimitNOFILE=1048576 +DefaultLimitNOFILE=1024:1048576 in both `/etc/systemd/system.conf` and `/etc/systemd/user.conf`. You can then execute `sudo systemctl daemon-reexec` and restart your session. Check again From a2481b61e9cb5390bd4a942a1f3f8517fa031916 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 12 Mar 2021 23:58:39 +0300 Subject: [PATCH 0485/1506] esync: Fix restoring the objects state on wait all objects retry. For Forza Horizon 4. --- dlls/ntdll/unix/esync.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index da3d3a2ab29..6eea9d3afc4 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -1146,10 +1146,22 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA { /* We were too slow. Put everything back. */ value = 1; - for (j = i; j >= 0; j--) + for (j = i - 1; j >= 0; j--) { - if (write( obj->fd, &value, sizeof(value) ) == -1) + struct esync *obj = objs[j]; + + if (obj->type == ESYNC_MUTEX) + { + struct mutex *mutex = obj->shm; + + if (mutex->tid == GetCurrentThreadId()) + continue; + } + if (write( fds[j].fd, &value, sizeof(value) ) == -1) + { + ERR("write failed.\n"); return errno_to_status( errno ); + } } goto tryagain; /* break out of two loops and a switch */ From 6eb724bcb051bf7e56cebf4df70fd5f72d53b00e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 15:17:29 -0500 Subject: [PATCH 0486/1506] server: Create server objects for futex-based synchronization objects. --- server/Makefile.in | 1 + server/fsync.c | 286 ++++++++++++++++++++++++++++++++++++++++++++ server/fsync.h | 22 ++++ server/main.c | 4 + server/protocol.def | 11 ++ 5 files changed, 324 insertions(+) create mode 100644 server/fsync.c create mode 100644 server/fsync.h diff --git a/server/Makefile.in b/server/Makefile.in index 79d05f2318c..a98615cce72 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -15,6 +15,7 @@ SOURCES = \ event.c \ fd.c \ file.c \ + fsync.c \ handle.c \ hook.c \ mach.c \ diff --git a/server/fsync.c b/server/fsync.c new file mode 100644 index 00000000000..5f36e988803 --- /dev/null +++ b/server/fsync.c @@ -0,0 +1,286 @@ +/* + * futex-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_SYS_SYSCALL_H +# include +#endif +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" + +#include "handle.h" +#include "request.h" +#include "fsync.h" + +#include "pshpack4.h" +struct futex_wait_block +{ + int *addr; +#if __SIZEOF_POINTER__ == 4 + int pad; +#endif + int val; +}; +#include "poppack.h" + +static inline int futex_wait_multiple( const struct futex_wait_block *futexes, + int count, const struct timespec *timeout ) +{ + return syscall( __NR_futex, futexes, 13, count, timeout, 0, 0 ); +} + +int do_fsync(void) +{ +#ifdef __linux__ + static int do_fsync_cached = -1; + + if (do_fsync_cached == -1) + { + static const struct timespec zero; + futex_wait_multiple( NULL, 0, &zero ); + do_fsync_cached = getenv("WINEFSYNC") && atoi(getenv("WINEFSYNC")) && errno != ENOSYS; + } + + return do_fsync_cached; +#else + return 0; +#endif +} + +static char shm_name[29]; +static int shm_fd; +static off_t shm_size; +static void **shm_addrs; +static int shm_addrs_size; /* length of the allocated shm_addrs array */ +static long pagesize; + +static void shm_cleanup(void) +{ + close( shm_fd ); + if (shm_unlink( shm_name ) == -1) + perror( "shm_unlink" ); +} + +void fsync_init(void) +{ + struct stat st; + + if (fstat( config_dir_fd, &st ) == -1) + fatal_error( "cannot stat config dir\n" ); + + if (st.st_ino != (unsigned long)st.st_ino) + sprintf( shm_name, "/wine-%lx%08lx-fsync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino ); + else + sprintf( shm_name, "/wine-%lx-fsync", (unsigned long)st.st_ino ); + + if (!shm_unlink( shm_name )) + fprintf( stderr, "fsync: warning: a previous shm file %s was not properly removed\n", shm_name ); + + shm_fd = shm_open( shm_name, O_RDWR | O_CREAT | O_EXCL, 0644 ); + if (shm_fd == -1) + perror( "shm_open" ); + + pagesize = sysconf( _SC_PAGESIZE ); + + shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); + shm_addrs_size = 128; + + shm_size = pagesize; + if (ftruncate( shm_fd, shm_size ) == -1) + perror( "ftruncate" ); + + atexit( shm_cleanup ); +} + +struct fsync +{ + struct object obj; + unsigned int shm_idx; +}; + +static void fsync_dump( struct object *obj, int verbose ); +static void fsync_destroy( struct object *obj ); + +static const struct object_ops fsync_ops = +{ + sizeof(struct fsync), /* size */ + &no_type, /* type */ + fsync_dump, /* dump */ + no_add_queue, /* add_queue */ + NULL, /* remove_queue */ + NULL, /* signaled */ + NULL, /* get_esync_fd */ + NULL, /* satisfied */ + no_signal, /* signal */ + no_get_fd, /* get_fd */ + default_map_access, /* map_access */ + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + default_get_full_name, /* get_full_name */ + no_lookup_name, /* lookup_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ + no_open_file, /* open_file */ + no_kernel_obj_list, /* get_kernel_obj_list */ + no_close_handle, /* close_handle */ + fsync_destroy /* destroy */ +}; + +static void fsync_dump( struct object *obj, int verbose ) +{ + struct fsync *fsync = (struct fsync *)obj; + assert( obj->ops == &fsync_ops ); + fprintf( stderr, "fsync idx=%d\n", fsync->shm_idx ); +} + +static void fsync_destroy( struct object *obj ) +{ +} + +static void *get_shm( unsigned int idx ) +{ + int entry = (idx * 8) / pagesize; + int offset = (idx * 8) % pagesize; + + if (entry >= shm_addrs_size) + { + int new_size = max(shm_addrs_size * 2, entry + 1); + + if (!(shm_addrs = realloc( shm_addrs, new_size * sizeof(shm_addrs[0]) ))) + fprintf( stderr, "fsync: couldn't expand shm_addrs array to size %d\n", entry + 1 ); + + memset( shm_addrs + shm_addrs_size, 0, (new_size - shm_addrs_size) * sizeof(shm_addrs[0]) ); + + shm_addrs_size = new_size; + } + + if (!shm_addrs[entry]) + { + void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize ); + if (addr == (void *)-1) + { + fprintf( stderr, "fsync: failed to map page %d (offset %#lx): ", entry, entry * pagesize ); + perror( "mmap" ); + } + + if (debug_level) + fprintf( stderr, "fsync: Mapping page %d at %p.\n", entry, addr ); + + if (__sync_val_compare_and_swap( &shm_addrs[entry], 0, addr )) + munmap( addr, pagesize ); /* someone beat us to it */ + } + + return (void *)((unsigned long)shm_addrs[entry] + offset); +} + +/* FIXME: This is rather inefficient... */ +static unsigned int shm_idx_counter = 1; + +struct fsync *create_fsync( struct object *root, const struct unicode_str *name, + unsigned int attr, int low, int high, + const struct security_descriptor *sd ) +{ +#ifdef __linux__ + struct fsync *fsync; + + if ((fsync = create_named_object( root, &fsync_ops, name, attr, sd ))) + { + if (get_error() != STATUS_OBJECT_NAME_EXISTS) + { + int *shm; + + /* initialize it if it didn't already exist */ + + fsync->shm_idx = shm_idx_counter++; + while (fsync->shm_idx * 8 >= shm_size) + { + /* Better expand the shm section. */ + shm_size += pagesize; + if (ftruncate( shm_fd, shm_size ) == -1) + { + fprintf( stderr, "fsync: couldn't expand %s to size %lld: ", + shm_name, (long long)shm_size ); + perror( "ftruncate" ); + } + } + + /* Initialize the shared memory portion. We want to do this on the + * server side to avoid a potential though unlikely race whereby + * the same object is opened and used between the time it's created + * and the time its shared memory portion is initialized. */ + + shm = get_shm( fsync->shm_idx ); + assert(shm); + shm[0] = low; + shm[1] = high; + } + } + + return fsync; +#else + set_error( STATUS_NOT_IMPLEMENTED ); + return NULL; +#endif +} + +DECL_HANDLER(create_fsync) +{ + struct fsync *fsync; + struct unicode_str name; + struct object *root; + const struct security_descriptor *sd; + const struct object_attributes *objattr = get_req_object_attributes( &sd, &name, &root ); + + if (!do_fsync()) + { + set_error( STATUS_NOT_IMPLEMENTED ); + return; + } + + if (!objattr) return; + + if ((fsync = create_fsync( root, &name, objattr->attributes, req->low, + req->high, sd ))) + { + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, fsync, req->access, objattr->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, fsync, + req->access, objattr->attributes ); + + reply->shm_idx = fsync->shm_idx; + release_object( fsync ); + } + + if (root) release_object( root ); +} diff --git a/server/fsync.h b/server/fsync.h new file mode 100644 index 00000000000..0b7e46cdaf3 --- /dev/null +++ b/server/fsync.h @@ -0,0 +1,22 @@ +/* + * futex-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +extern int do_fsync(void); +extern void fsync_init(void); diff --git a/server/main.c b/server/main.c index c4bb790db8a..457b044a36a 100644 --- a/server/main.c +++ b/server/main.c @@ -35,6 +35,7 @@ #include "request.h" #include "unicode.h" #include "esync.h" +#include "fsync.h" /* command-line options */ int debug_level = 0; @@ -230,6 +231,9 @@ int main( int argc, char *argv[] ) sock_init(); open_master_socket(); + if (do_fsync()) + fsync_init(); + if (do_esync()) esync_init(); diff --git a/server/protocol.def b/server/protocol.def index d5026dce3d9..2243d97dcfe 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3991,3 +3991,14 @@ enum esync_type /* Retrieve the fd to wait on for user APCs. */ @REQ(get_esync_apc_fd) @END + +/* Create a new futex-based synchronization object */ +@REQ(create_fsync) + unsigned int access; /* wanted access rights */ + int low; /* initial value of low word */ + int high; /* initial value of high word */ + VARARG(objattr,object_attributes); /* object attributes */ +@REPLY + obj_handle_t handle; /* handle to the object */ + unsigned int shm_idx; /* this object's index into the shm section */ +@END From aa5882ca868f95b82b392f7363e1ad4c998b1b8f Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 19:14:24 -0500 Subject: [PATCH 0487/1506] ntdll: Create futex-based objects for semaphores. --- dlls/ntdll/Makefile.in | 1 + dlls/ntdll/unix/fsync.c | 287 +++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 25 ++++ dlls/ntdll/unix/loader.c | 2 + dlls/ntdll/unix/sync.c | 4 + 5 files changed, 319 insertions(+) create mode 100644 dlls/ntdll/unix/fsync.c create mode 100644 dlls/ntdll/unix/fsync.h diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 70fac547c57..0ce1f44a34d 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -50,6 +50,7 @@ SOURCES = \ unix/env.c \ unix/esync.c \ unix/file.c \ + unix/fsync.c \ unix/loader.c \ unix/loadorder.c \ unix/process.c \ diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c new file mode 100644 index 00000000000..c1530300e18 --- /dev/null +++ b/dlls/ntdll/unix/fsync.c @@ -0,0 +1,287 @@ +/* + * futex-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_SYS_SYSCALL_H +# include +#endif +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" +#include "wine/debug.h" +#include "wine/server.h" + +#include "unix_private.h" +#include "fsync.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fsync); + +#include "pshpack4.h" +struct futex_wait_block +{ + int *addr; +#if __SIZEOF_POINTER__ == 4 + int pad; +#endif + int val; +}; +#include "poppack.h" + +static inline int futex_wait_multiple( const struct futex_wait_block *futexes, + int count, const struct timespec *timeout ) +{ + return syscall( __NR_futex, futexes, 13, count, timeout, 0, 0 ); +} + +int do_fsync(void) +{ +#ifdef __linux__ + static int do_fsync_cached = -1; + + if (do_fsync_cached == -1) + { + static const struct timespec zero; + futex_wait_multiple( NULL, 0, &zero ); + do_fsync_cached = getenv("WINEFSYNC") && atoi(getenv("WINEFSYNC")) && errno != ENOSYS; + } + + return do_fsync_cached; +#else + static int once; + if (!once++) + FIXME("futexes not supported on this platform.\n"); + return 0; +#endif +} + +enum fsync_type +{ + FSYNC_SEMAPHORE = 1, +}; + +struct fsync +{ + enum fsync_type type; + void *shm; /* pointer to shm section */ +}; + +struct semaphore +{ + int count; + int max; +}; +C_ASSERT(sizeof(struct semaphore) == 8); + + +static char shm_name[29]; +static int shm_fd; +static void **shm_addrs; +static int shm_addrs_size; /* length of the allocated shm_addrs array */ +static long pagesize; + +static void *get_shm( unsigned int idx ) +{ + int entry = (idx * 8) / pagesize; + int offset = (idx * 8) % pagesize; + + if (entry >= shm_addrs_size) + { + int new_size = max(shm_addrs_size * 2, entry + 1); + + if (!(shm_addrs = realloc( shm_addrs, new_size * sizeof(shm_addrs[0]) ))) + ERR("Failed to grow shm_addrs array to size %d.\n", shm_addrs_size); + memset( shm_addrs + shm_addrs_size, 0, (new_size - shm_addrs_size) * sizeof(shm_addrs[0]) ); + shm_addrs_size = new_size; + } + + if (!shm_addrs[entry]) + { + void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize ); + if (addr == (void *)-1) + ERR("Failed to map page %d (offset %#lx).\n", entry, entry * pagesize); + + TRACE("Mapping page %d at %p.\n", entry, addr); + + if (__sync_val_compare_and_swap( &shm_addrs[entry], 0, addr )) + munmap( addr, pagesize ); /* someone beat us to it */ + } + + return (void *)((unsigned long)shm_addrs[entry] + offset); +} + +/* We'd like lookup to be fast. To that end, we use a static list indexed by handle. + * This is copied and adapted from the fd cache code. */ + +#define FSYNC_LIST_BLOCK_SIZE (65536 / sizeof(struct fsync)) +#define FSYNC_LIST_ENTRIES 256 + +static struct fsync *fsync_list[FSYNC_LIST_ENTRIES]; +static struct fsync fsync_list_initial_block[FSYNC_LIST_BLOCK_SIZE]; + +static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) +{ + UINT_PTR idx = (((UINT_PTR)handle) >> 2) - 1; + *entry = idx / FSYNC_LIST_BLOCK_SIZE; + return idx % FSYNC_LIST_BLOCK_SIZE; +} + +static struct fsync *add_to_list( HANDLE handle, enum fsync_type type, void *shm ) +{ + UINT_PTR entry, idx = handle_to_index( handle, &entry ); + + if (entry >= FSYNC_LIST_ENTRIES) + { + FIXME( "too many allocated handles, not caching %p\n", handle ); + return FALSE; + } + + if (!fsync_list[entry]) /* do we need to allocate a new block of entries? */ + { + if (!entry) fsync_list[0] = fsync_list_initial_block; + else + { + void *ptr = anon_mmap_alloc( FSYNC_LIST_BLOCK_SIZE * sizeof(struct fsync), + PROT_READ | PROT_WRITE ); + if (ptr == MAP_FAILED) return FALSE; + fsync_list[entry] = ptr; + } + } + + if (!__sync_val_compare_and_swap((int *)&fsync_list[entry][idx].type, 0, type )) + fsync_list[entry][idx].shm = shm; + + return &fsync_list[entry][idx]; +} + +static struct fsync *get_cached_object( HANDLE handle ) +{ + UINT_PTR entry, idx = handle_to_index( handle, &entry ); + + if (entry >= FSYNC_LIST_ENTRIES || !fsync_list[entry]) return NULL; + if (!fsync_list[entry][idx].type) return NULL; + + return &fsync_list[entry][idx]; +} + +static NTSTATUS create_fsync( enum fsync_type type, HANDLE *handle, + ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int low, int high ) +{ + NTSTATUS ret; + data_size_t len; + struct object_attributes *objattr; + unsigned int shm_idx; + + if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; + + SERVER_START_REQ( create_fsync ) + { + req->access = access; + req->low = low; + req->high = high; + wine_server_add_data( req, objattr, len ); + ret = wine_server_call( req ); + if (!ret || ret == STATUS_OBJECT_NAME_EXISTS) + { + *handle = wine_server_ptr_handle( reply->handle ); + shm_idx = reply->shm_idx; + } + } + SERVER_END_REQ; + + if (!ret || ret == STATUS_OBJECT_NAME_EXISTS) + { + add_to_list( *handle, type, get_shm( shm_idx )); + TRACE("-> handle %p, shm index %d.\n", *handle, shm_idx); + } + + free( objattr ); + return ret; +} + +void fsync_init(void) +{ + struct stat st; + + if (!do_fsync()) + { + /* make sure the server isn't running with WINEFSYNC */ + HANDLE handle; + NTSTATUS ret; + + ret = create_fsync( 0, &handle, 0, NULL, 0, 0 ); + if (ret != STATUS_NOT_IMPLEMENTED) + { + ERR("Server is running with WINEFSYNC but this process is not, please enable WINEFSYNC or restart wineserver.\n"); + exit(1); + } + + return; + } + + if (stat( config_dir, &st ) == -1) + ERR("Cannot stat %s\n", config_dir); + + if (st.st_ino != (unsigned long)st.st_ino) + sprintf( shm_name, "/wine-%lx%08lx-fsync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino ); + else + sprintf( shm_name, "/wine-%lx-fsync", (unsigned long)st.st_ino ); + + if ((shm_fd = shm_open( shm_name, O_RDWR, 0644 )) == -1) + { + /* probably the server isn't running with WINEFSYNC, tell the user and bail */ + if (errno == ENOENT) + ERR("Failed to open fsync shared memory file; make sure no stale wineserver instances are running without WINEFSYNC.\n"); + else + ERR("Failed to initialize shared memory: %s\n", strerror( errno )); + exit(1); + } + + pagesize = sysconf( _SC_PAGESIZE ); + + shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); + shm_addrs_size = 128; +} + +NTSTATUS fsync_create_semaphore( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max ) +{ + TRACE("name %s, initial %d, max %d.\n", + attr ? debugstr_us(attr->ObjectName) : "", (int)initial, (int)max); + + return create_fsync( FSYNC_SEMAPHORE, handle, access, attr, initial, max ); +} diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h new file mode 100644 index 00000000000..273a4817dd0 --- /dev/null +++ b/dlls/ntdll/unix/fsync.h @@ -0,0 +1,25 @@ +/* + * futex-based synchronization objects + * + * Copyright (C) 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +extern int do_fsync(void); +extern void fsync_init(void); + +extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 93331de1b1f..0712ddd3fdf 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -89,6 +89,7 @@ extern char **environ; #include "winternl.h" #include "unix_private.h" #include "esync.h" +#include "fsync.h" #include "wine/list.h" #include "ntsyscalls.h" #include "wine/debug.h" @@ -1960,6 +1961,7 @@ static void start_main_thread(void) dbg_init(); startup_info_size = server_init_process(); hacks_init(); + fsync_init(); esync_init(); virtual_map_user_shared_data(); init_cpu_info(); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 3a9fc76c2e4..08ee792d0ec 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -64,6 +64,7 @@ #include "wine/debug.h" #include "unix_private.h" #include "esync.h" +#include "fsync.h" WINE_DEFAULT_DEBUG_CHANNEL(sync); @@ -273,6 +274,9 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ if (max <= 0 || initial < 0 || initial > max) return STATUS_INVALID_PARAMETER; if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; + if (do_fsync()) + return fsync_create_semaphore( handle, access, attr, initial, max ); + if (do_esync()) return esync_create_semaphore( handle, access, attr, initial, max ); From c0afb2dfba2d8c229d64b4e2f8983ee4ae9c5fd4 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 19:21:55 -0500 Subject: [PATCH 0488/1506] ntdll: Implement NtReleaseSemaphore(). --- dlls/ntdll/unix/fsync.c | 31 +++++++++++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ server/esync.c | 1 + 4 files changed, 36 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c1530300e18..5281d1cbce8 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -68,6 +68,11 @@ static inline int futex_wait_multiple( const struct futex_wait_block *futexes, return syscall( __NR_futex, futexes, 13, count, timeout, 0, 0 ); } +static inline int futex_wake( int *addr, int val ) +{ + return syscall( __NR_futex, addr, 1, val, NULL, 0, 0 ); +} + int do_fsync(void) { #ifdef __linux__ @@ -285,3 +290,29 @@ NTSTATUS fsync_create_semaphore( HANDLE *handle, ACCESS_MASK access, return create_fsync( FSYNC_SEMAPHORE, handle, access, attr, initial, max ); } + +NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) +{ + struct fsync *obj; + struct semaphore *semaphore; + ULONG current; + + TRACE("%p, %d, %p.\n", handle, (int)count, prev); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + semaphore = obj->shm; + + do + { + current = semaphore->count; + if (count + current > semaphore->max) + return STATUS_SEMAPHORE_LIMIT_EXCEEDED; + } while (__sync_val_compare_and_swap( &semaphore->count, current, count + current ) != current); + + if (prev) *prev = current; + + if (!current) + futex_wake( &semaphore->count, count ); + + return STATUS_SUCCESS; +} diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 273a4817dd0..0ec618385ed 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -23,3 +23,4 @@ extern void fsync_init(void); extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); +extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 08ee792d0ec..075c93b6bad 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -369,6 +369,9 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, ULONG *previous { unsigned int ret; + if (do_fsync()) + return fsync_release_semaphore( handle, count, previous ); + if (do_esync()) return esync_release_semaphore( handle, count, previous ); diff --git a/server/esync.c b/server/esync.c index e193f61b3a7..fc8120f9449 100644 --- a/server/esync.c +++ b/server/esync.c @@ -23,6 +23,7 @@ #include #include +#include #include #ifdef HAVE_SYS_EVENTFD_H # include From 888ffe704d9797af9eb00860be4532a2feeb4bfa Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 15:50:37 -0500 Subject: [PATCH 0489/1506] ntdll: Close fsync objects. --- dlls/ntdll/unix/fsync.c | 15 +++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/server.c | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 5281d1cbce8..2f199286950 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -203,6 +203,21 @@ static struct fsync *get_cached_object( HANDLE handle ) return &fsync_list[entry][idx]; } +NTSTATUS fsync_close( HANDLE handle ) +{ + UINT_PTR entry, idx = handle_to_index( handle, &entry ); + + TRACE("%p.\n", handle); + + if (entry < FSYNC_LIST_ENTRIES && fsync_list[entry]) + { + if (__atomic_exchange_n( &fsync_list[entry][idx].type, 0, __ATOMIC_SEQ_CST )) + return STATUS_SUCCESS; + } + + return STATUS_INVALID_HANDLE; +} + static NTSTATUS create_fsync( enum fsync_type type, HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int low, int high ) { diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 0ec618385ed..ed10eeb2d7b 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -20,6 +20,7 @@ extern int do_fsync(void); extern void fsync_init(void); +extern NTSTATUS fsync_close( HANDLE handle ); extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 8cbebd34b5f..9fb202bc430 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -80,6 +80,7 @@ #include "wine/debug.h" #include "unix_private.h" #include "esync.h" +#include "fsync.h" #include "ddk/wdm.h" WINE_DEFAULT_DEBUG_CHANNEL(server); @@ -1842,6 +1843,9 @@ NTSTATUS WINAPI NtClose( HANDLE handle ) * retrieve it again */ fd = remove_fd_from_cache( handle ); + if (do_fsync()) + fsync_close( handle ); + if (do_esync()) esync_close( handle ); From 9122ffe93b3bff7b3592db594d3ac148f793c8a0 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:25:59 -0500 Subject: [PATCH 0490/1506] ntdll: Implement waiting on fsync objects. --- dlls/ntdll/unix/fsync.c | 145 ++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 3 + dlls/ntdll/unix/sync.c | 7 ++ 3 files changed, 155 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 2f199286950..504806ae10a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -331,3 +331,148 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) return STATUS_SUCCESS; } + +static LONGLONG update_timeout( ULONGLONG end ) +{ + LARGE_INTEGER now; + LONGLONG timeleft; + + NtQuerySystemTime( &now ); + timeleft = end - now.QuadPart; + if (timeleft < 0) timeleft = 0; + return timeleft; +} + +NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, + BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) +{ + struct futex_wait_block futexes[MAXIMUM_WAIT_OBJECTS]; + struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; + int has_fsync = 0, has_server = 0; + int dummy_futex = 0; + LONGLONG timeleft; + LARGE_INTEGER now; + ULONGLONG end; + int i, ret; + + NtQuerySystemTime( &now ); + if (timeout) + { + if (timeout->QuadPart == TIMEOUT_INFINITE) + timeout = NULL; + else if (timeout->QuadPart > 0) + end = timeout->QuadPart; + else + end = now.QuadPart - timeout->QuadPart; + } + + for (i = 0; i < count; i++) + { + if ((objs[i] = get_cached_object( handles[i] ))) + has_fsync = 1; + else + has_server = 1; + } + + if (has_fsync && has_server) + FIXME("Can't wait on fsync and server objects at the same time!\n"); + else if (has_server) + return STATUS_NOT_IMPLEMENTED; + + if (TRACE_ON(fsync)) + { + TRACE("Waiting for %s of %d handles:", wait_any ? "any" : "all", (int)count); + for (i = 0; i < count; i++) + TRACE(" %p", handles[i]); + + if (!timeout) + TRACE(", timeout = INFINITE.\n"); + else + { + timeleft = update_timeout( end ); + TRACE(", timeout = %ld.%07ld sec.\n", + (long) (timeleft / TICKSPERSEC), (long) (timeleft % TICKSPERSEC)); + } + } + + if (wait_any || count == 1) + { + while (1) + { + /* Try to grab anything. */ + + for (i = 0; i < count; i++) + { + struct fsync *obj = objs[i]; + + if (obj) + { + switch (obj->type) + { + case FSYNC_SEMAPHORE: + { + struct semaphore *semaphore = obj->shm; + int current; + + do + { + if (!(current = semaphore->count)) break; + } while (__sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) != current); + + if (current) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + + futexes[i].addr = &semaphore->count; + futexes[i].val = current; + break; + } + default: + assert(0); + } + } + else + { + /* Avoid breaking things entirely. */ + futexes[i].addr = &dummy_futex; + futexes[i].val = dummy_futex; + } + +#if __SIZEOF_POINTER__ == 4 + futexes[i].pad = 0; +#endif + } + + /* Looks like everything is contended, so wait. */ + + if (timeout) + { + LONGLONG timeleft = update_timeout( end ); + struct timespec tmo_p; + tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; + + ret = futex_wait_multiple( futexes, count, &tmo_p ); + } + else + ret = futex_wait_multiple( futexes, count, NULL ); + + /* FUTEX_WAIT_MULTIPLE can succeed or return -EINTR, -EAGAIN, + * -EFAULT/-EACCES, -ETIMEDOUT. In the first three cases we need to + * try again, bad address is already handled by the fact that we + * tried to read from it, so only break out on a timeout. */ + if (ret == -1 && errno == ETIMEDOUT) + { + TRACE("Wait timed out.\n"); + return STATUS_TIMEOUT; + } + } /* while (1) */ + } + else + { + FIXME("Wait-all not implemented.\n"); + return STATUS_NOT_IMPLEMENTED; + } +} diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index ed10eeb2d7b..4a5c00ca0a7 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -25,3 +25,6 @@ extern NTSTATUS fsync_close( HANDLE handle ); extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); + +extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, + BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 075c93b6bad..d9ef3cb6bde 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1528,6 +1528,13 @@ NTSTATUS WINAPI NtWaitForMultipleObjects( DWORD count, const HANDLE *handles, BO if (!count || count > MAXIMUM_WAIT_OBJECTS) return STATUS_INVALID_PARAMETER_1; + if (do_fsync()) + { + NTSTATUS ret = fsync_wait_objects( count, handles, wait_any, alertable, timeout ); + if (ret != STATUS_NOT_IMPLEMENTED) + return ret; + } + if (do_esync()) { NTSTATUS ret = esync_wait_objects( count, handles, wait_any, alertable, timeout ); From 6bea0e083d3e36b4aab3d09d99787f2ab2de3b6a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:31:54 -0500 Subject: [PATCH 0491/1506] ntdll: Create fsync objects for events. --- dlls/ntdll/unix/fsync.c | 20 ++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 25 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 504806ae10a..2a7dee5f661 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -97,6 +97,8 @@ int do_fsync(void) enum fsync_type { FSYNC_SEMAPHORE = 1, + FSYNC_AUTO_EVENT, + FSYNC_MANUAL_EVENT, }; struct fsync @@ -112,6 +114,12 @@ struct semaphore }; C_ASSERT(sizeof(struct semaphore) == 8); +struct event +{ + int signaled; + int unused; +}; +C_ASSERT(sizeof(struct event) == 8); static char shm_name[29]; static int shm_fd; @@ -332,6 +340,18 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, EVENT_TYPE event_type, BOOLEAN initial ) +{ + enum fsync_type type = (event_type == SynchronizationEvent ? FSYNC_AUTO_EVENT : FSYNC_MANUAL_EVENT); + + TRACE("name %s, %s-reset, initial %d.\n", + attr ? debugstr_us(attr->ObjectName) : "", + event_type == NotificationEvent ? "manual" : "auto", initial); + + return create_fsync( type, handle, access, attr, initial, 0xdeadbeef ); +} + static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 4a5c00ca0a7..cc93044f38f 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -25,6 +25,8 @@ extern NTSTATUS fsync_close( HANDLE handle ); extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); +extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index d9ef3cb6bde..fe11bc38233 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -402,6 +402,9 @@ NTSTATUS WINAPI NtCreateEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_ *handle = 0; if (type != NotificationEvent && type != SynchronizationEvent) return STATUS_INVALID_PARAMETER; + if (do_fsync()) + return fsync_create_event( handle, access, attr, type, state ); + if (do_esync()) return esync_create_event( handle, access, attr, type, state ); From c51c998b497f66a708cd44c964e726a1e13c657b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:36:16 -0500 Subject: [PATCH 0492/1506] ntdll: Implement NtSetEvent(). --- dlls/ntdll/unix/fsync.c | 20 ++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 2a7dee5f661..a8c364162cc 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -352,6 +353,25 @@ NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, return create_fsync( type, handle, access, attr, initial, 0xdeadbeef ); } +NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) +{ + struct event *event; + struct fsync *obj; + LONG current; + + TRACE("%p.\n", handle); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + event = obj->shm; + + if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) + futex_wake( &event->signaled, obj->type == FSYNC_AUTO_EVENT ? 1 : INT_MAX ); + + if (prev) *prev = current; + + return STATUS_SUCCESS; +} + static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index cc93044f38f..2ba03261c17 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -27,6 +27,7 @@ extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); +extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index fe11bc38233..854799c30ec 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -462,6 +462,9 @@ NTSTATUS WINAPI NtSetEvent( HANDLE handle, LONG *prev_state ) /* This comment is a dummy to make sure this patch applies in the right place. */ unsigned int ret; + if (do_fsync()) + return fsync_set_event( handle, prev_state ); + if (do_esync()) return esync_set_event( handle ); From bcba4f81e31d4118608bda66cbbde7a6f1959679 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:39:38 -0500 Subject: [PATCH 0493/1506] ntdll: Implement NtResetEvent(). --- dlls/ntdll/unix/fsync.c | 18 ++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 22 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index a8c364162cc..c7b4ee1a298 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -372,6 +372,24 @@ NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) +{ + struct event *event; + struct fsync *obj; + LONG current; + + TRACE("%p.\n", handle); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + event = obj->shm; + + current = __atomic_exchange_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); + + if (prev) *prev = current; + + return STATUS_SUCCESS; +} + static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 2ba03261c17..56afeb1f9e8 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -28,6 +28,7 @@ extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); +extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 854799c30ec..ef39b1b8b42 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -488,6 +488,9 @@ NTSTATUS WINAPI NtResetEvent( HANDLE handle, LONG *prev_state ) /* This comment is a dummy to make sure this patch applies in the right place. */ unsigned int ret; + if (do_fsync()) + return fsync_reset_event( handle, prev_state ); + if (do_esync()) return esync_reset_event( handle ); From c7546a222f0e7ed2e81fe1f43656d23067d438fe Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:45:43 -0500 Subject: [PATCH 0494/1506] ntdll: Implement waiting on events. --- dlls/ntdll/unix/fsync.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c7b4ee1a298..e7a495be365 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -487,6 +487,34 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, futexes[i].val = current; break; } + case FSYNC_AUTO_EVENT: + { + struct event *event = obj->shm; + + if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + + futexes[i].addr = &event->signaled; + futexes[i].val = 0; + break; + } + case FSYNC_MANUAL_EVENT: + { + struct event *event = obj->shm; + + if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + + futexes[i].addr = &event->signaled; + futexes[i].val = 0; + break; + } default: assert(0); } From ae25db4d519d156d24c5e78fb20ef85070b08a50 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:52:01 -0500 Subject: [PATCH 0495/1506] server: Add an object operation to grab the fsync shm index. --- server/async.c | 2 ++ server/atom.c | 1 + server/change.c | 1 + server/clipboard.c | 1 + server/completion.c | 1 + server/console.c | 7 +++++++ server/debugger.c | 2 ++ server/device.c | 4 ++++ server/directory.c | 2 ++ server/esync.c | 1 + server/event.c | 2 ++ server/fd.c | 4 ++++ server/file.c | 1 + server/fsync.c | 1 + server/handle.c | 1 + server/hook.c | 1 + server/mailslot.c | 4 ++++ server/mapping.c | 3 +++ server/mutex.c | 1 + server/named_pipe.c | 5 +++++ server/object.h | 2 ++ server/process.c | 3 +++ server/queue.c | 2 ++ server/registry.c | 1 + server/request.c | 1 + server/semaphore.c | 1 + server/serial.c | 1 + server/signal.c | 1 + server/sock.c | 3 +++ server/symlink.c | 1 + server/thread.c | 3 +++ server/timer.c | 1 + server/token.c | 1 + server/window.c | 1 + server/winstation.c | 2 ++ 35 files changed, 69 insertions(+) diff --git a/server/async.c b/server/async.c index 337bba8631b..91f0d87f9df 100644 --- a/server/async.c +++ b/server/async.c @@ -78,6 +78,7 @@ static const struct object_ops async_ops = remove_queue, /* remove_queue */ async_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ async_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -678,6 +679,7 @@ static const struct object_ops iosb_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/atom.c b/server/atom.c index d9824de8eac..6b95a546597 100644 --- a/server/atom.c +++ b/server/atom.c @@ -80,6 +80,7 @@ static const struct object_ops atom_table_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/change.c b/server/change.c index 6bd6920fdb5..8e19fc4bc2b 100644 --- a/server/change.c +++ b/server/change.c @@ -113,6 +113,7 @@ static const struct object_ops dir_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ default_fd_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ dir_get_fd, /* get_fd */ diff --git a/server/clipboard.c b/server/clipboard.c index 8b265f2dcea..f24924eafa5 100644 --- a/server/clipboard.c +++ b/server/clipboard.c @@ -77,6 +77,7 @@ static const struct object_ops clipboard_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/completion.c b/server/completion.c index 3d4be86a212..33266c596da 100644 --- a/server/completion.c +++ b/server/completion.c @@ -76,6 +76,7 @@ static const struct object_ops completion_ops = remove_queue, /* remove_queue */ completion_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/console.c b/server/console.c index dbd4a97459c..43248d359ca 100644 --- a/server/console.c +++ b/server/console.c @@ -83,6 +83,7 @@ static const struct object_ops console_ops = remove_queue, /* remove_queue */ console_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_get_fd, /* get_fd */ @@ -163,6 +164,7 @@ static const struct object_ops console_server_ops = remove_queue, /* remove_queue */ console_server_signaled, /* signaled */ console_server_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_server_get_fd, /* get_fd */ @@ -233,6 +235,7 @@ static const struct object_ops screen_buffer_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ screen_buffer_get_fd, /* get_fd */ @@ -283,6 +286,7 @@ static const struct object_ops console_device_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -321,6 +325,7 @@ static const struct object_ops console_input_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_input_get_fd, /* get_fd */ @@ -379,6 +384,7 @@ static const struct object_ops console_output_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_output_get_fd, /* get_fd */ @@ -438,6 +444,7 @@ static const struct object_ops console_connection_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_connection_get_fd, /* get_fd */ diff --git a/server/debugger.c b/server/debugger.c index d85a2000684..b0cd35604d2 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -87,6 +87,7 @@ static const struct object_ops debug_event_ops = remove_queue, /* remove_queue */ debug_event_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -116,6 +117,7 @@ static const struct object_ops debug_obj_ops = remove_queue, /* remove_queue */ debug_obj_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/device.c b/server/device.c index c45d0102a56..8613cee58af 100644 --- a/server/device.c +++ b/server/device.c @@ -69,6 +69,7 @@ static const struct object_ops irp_call_ops = NULL, /* signaled */ NULL, /* get_esync_fd */ NULL, /* satisfied */ + NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ default_map_access, /* map_access */ @@ -111,6 +112,7 @@ static const struct object_ops device_manager_ops = remove_queue, /* remove_queue */ device_manager_signaled, /* signaled */ device_manager_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -169,6 +171,7 @@ static const struct object_ops device_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -222,6 +225,7 @@ static const struct object_ops device_file_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ device_file_get_fd, /* get_fd */ diff --git a/server/directory.c b/server/directory.c index dc3f0cf3cf8..878941cddbf 100644 --- a/server/directory.c +++ b/server/directory.c @@ -71,6 +71,7 @@ static const struct object_ops object_type_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -122,6 +123,7 @@ static const struct object_ops directory_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/esync.c b/server/esync.c index fc8120f9449..064bdd61b25 100644 --- a/server/esync.c +++ b/server/esync.c @@ -129,6 +129,7 @@ const struct object_ops esync_ops = NULL, /* remove_queue */ NULL, /* signaled */ esync_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/event.c b/server/event.c index f4ca3e48c6f..f5a25c02293 100644 --- a/server/event.c +++ b/server/event.c @@ -77,6 +77,7 @@ static const struct object_ops event_ops = remove_queue, /* remove_queue */ event_signaled, /* signaled */ event_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ event_satisfied, /* satisfied */ event_signal, /* signal */ no_get_fd, /* get_fd */ @@ -125,6 +126,7 @@ static const struct object_ops keyed_event_ops = remove_queue, /* remove_queue */ keyed_event_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/fd.c b/server/fd.c index 4149c9d4637..acd3789193a 100644 --- a/server/fd.c +++ b/server/fd.c @@ -172,6 +172,7 @@ static const struct object_ops fd_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -214,6 +215,7 @@ static const struct object_ops device_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -255,6 +257,7 @@ static const struct object_ops inode_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -298,6 +301,7 @@ static const struct object_ops file_lock_ops = remove_queue, /* remove_queue */ file_lock_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/file.c b/server/file.c index 26c62809d33..5be9578ce48 100644 --- a/server/file.c +++ b/server/file.c @@ -95,6 +95,7 @@ static const struct object_ops file_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ file_get_fd, /* get_fd */ diff --git a/server/fsync.c b/server/fsync.c index 5f36e988803..55a8e709dbf 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -140,6 +140,7 @@ static const struct object_ops fsync_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/handle.c b/server/handle.c index d41c7e86454..48b5d8101bb 100644 --- a/server/handle.c +++ b/server/handle.c @@ -127,6 +127,7 @@ static const struct object_ops handle_table_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/hook.c b/server/hook.c index 95a588c843b..3a89a883c3c 100644 --- a/server/hook.c +++ b/server/hook.c @@ -81,6 +81,7 @@ static const struct object_ops hook_table_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/mailslot.c b/server/mailslot.c index 4cf9b73f784..41fb020aaf0 100644 --- a/server/mailslot.c +++ b/server/mailslot.c @@ -75,6 +75,7 @@ static const struct object_ops mailslot_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ mailslot_get_fd, /* get_fd */ @@ -135,6 +136,7 @@ static const struct object_ops mail_writer_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ mail_writer_get_fd, /* get_fd */ @@ -199,6 +201,7 @@ static const struct object_ops mailslot_device_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -230,6 +233,7 @@ static const struct object_ops mailslot_device_file_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ mailslot_device_file_get_fd, /* get_fd */ diff --git a/server/mapping.c b/server/mapping.c index bc971fa91c4..75f2ce4fc2b 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -73,6 +73,7 @@ static const struct object_ops ranges_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -110,6 +111,7 @@ static const struct object_ops shared_map_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -185,6 +187,7 @@ static const struct object_ops mapping_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ mapping_get_fd, /* get_fd */ diff --git a/server/mutex.c b/server/mutex.c index 4785a830e92..2503d12057f 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -74,6 +74,7 @@ static const struct object_ops mutex_ops = remove_queue, /* remove_queue */ mutex_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ mutex_satisfied, /* satisfied */ mutex_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/named_pipe.c b/server/named_pipe.c index a90ec606226..1a168f0b395 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -120,6 +120,7 @@ static const struct object_ops named_pipe_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -169,6 +170,7 @@ static const struct object_ops pipe_server_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ default_fd_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ @@ -214,6 +216,7 @@ static const struct object_ops pipe_client_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ default_fd_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ @@ -262,6 +265,7 @@ static const struct object_ops named_pipe_device_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -294,6 +298,7 @@ static const struct object_ops named_pipe_device_file_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ named_pipe_device_file_get_fd, /* get_fd */ diff --git a/server/object.h b/server/object.h index 51ee819415a..632b20a548c 100644 --- a/server/object.h +++ b/server/object.h @@ -80,6 +80,8 @@ struct object_ops int (*signaled)(struct object *,struct wait_queue_entry *); /* return the esync fd for this object */ int (*get_esync_fd)(struct object *, enum esync_type *type); + /* return the fsync shm idx for this object */ + unsigned int (*get_fsync_idx)(struct object *); /* wait satisfied */ void (*satisfied)(struct object *,struct wait_queue_entry *); /* signal an object */ diff --git a/server/process.c b/server/process.c index f5b919cba00..1db0d52cb34 100644 --- a/server/process.c +++ b/server/process.c @@ -108,6 +108,7 @@ static const struct object_ops process_ops = remove_queue, /* remove_queue */ process_signaled, /* signaled */ process_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -160,6 +161,7 @@ static const struct object_ops startup_info_ops = remove_queue, /* remove_queue */ startup_info_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -222,6 +224,7 @@ static const struct object_ops job_ops = remove_queue, /* remove_queue */ job_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/queue.c b/server/queue.c index ce818042475..ddb4122bb9d 100644 --- a/server/queue.c +++ b/server/queue.c @@ -171,6 +171,7 @@ static const struct object_ops msg_queue_ops = msg_queue_remove_queue, /* remove_queue */ msg_queue_signaled, /* signaled */ msg_queue_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ msg_queue_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -209,6 +210,7 @@ static const struct object_ops thread_input_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/registry.c b/server/registry.c index c071f42532b..5bd196be10d 100644 --- a/server/registry.c +++ b/server/registry.c @@ -181,6 +181,7 @@ static const struct object_ops key_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/request.c b/server/request.c index ca83fdbd2af..343e1a92e0e 100644 --- a/server/request.c +++ b/server/request.c @@ -91,6 +91,7 @@ static const struct object_ops master_socket_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/semaphore.c b/server/semaphore.c index e3889f24601..d354892c224 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -71,6 +71,7 @@ static const struct object_ops semaphore_ops = remove_queue, /* remove_queue */ semaphore_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ semaphore_satisfied, /* satisfied */ semaphore_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/serial.c b/server/serial.c index 11e204e4419..1915d00a977 100644 --- a/server/serial.c +++ b/server/serial.c @@ -86,6 +86,7 @@ static const struct object_ops serial_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ serial_get_fd, /* get_fd */ diff --git a/server/signal.c b/server/signal.c index 55cd6aa037e..802b7f936b9 100644 --- a/server/signal.c +++ b/server/signal.c @@ -63,6 +63,7 @@ static const struct object_ops handler_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/sock.c b/server/sock.c index 177e7e6dded..ed79d961c38 100644 --- a/server/sock.c +++ b/server/sock.c @@ -454,6 +454,7 @@ static const struct object_ops sock_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ sock_get_fd, /* get_fd */ @@ -3556,6 +3557,7 @@ static const struct object_ops ifchange_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ ifchange_get_fd, /* get_fd */ @@ -3778,6 +3780,7 @@ static const struct object_ops socket_device_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/symlink.c b/server/symlink.c index c7f34412317..47098fe5823 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -72,6 +72,7 @@ static const struct object_ops symlink_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/thread.c b/server/thread.c index e906e0c07c9..ce90d8cfe74 100644 --- a/server/thread.c +++ b/server/thread.c @@ -102,6 +102,7 @@ static const struct object_ops thread_apc_ops = remove_queue, /* remove_queue */ thread_apc_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -145,6 +146,7 @@ static const struct object_ops context_ops = remove_queue, /* remove_queue */ context_signaled, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -196,6 +198,7 @@ static const struct object_ops thread_ops = remove_queue, /* remove_queue */ thread_signaled, /* signaled */ thread_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/timer.c b/server/timer.c index 36645a2a8d2..9ec9604aa0e 100644 --- a/server/timer.c +++ b/server/timer.c @@ -80,6 +80,7 @@ static const struct object_ops timer_ops = remove_queue, /* remove_queue */ timer_signaled, /* signaled */ timer_get_esync_fd, /* get_esync_fd */ + NULL, /* get_fsync_idx */ timer_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/token.c b/server/token.c index 8b4d2f0c1b1..0529d967b8a 100644 --- a/server/token.c +++ b/server/token.c @@ -144,6 +144,7 @@ static const struct object_ops token_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/window.c b/server/window.c index f6b9a25baa4..184d4e2e212 100644 --- a/server/window.c +++ b/server/window.c @@ -108,6 +108,7 @@ static const struct object_ops window_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ diff --git a/server/winstation.c b/server/winstation.c index ae1123c1d38..be33253d675 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -77,6 +77,7 @@ static const struct object_ops winstation_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -118,6 +119,7 @@ static const struct object_ops desktop_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ From 8bd11328793276f74980fd03003fc1300c86c613 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 16:57:08 -0500 Subject: [PATCH 0496/1506] server: Add a request to get the shm index associated with a waitable handle. --- dlls/ntdll/unix/fsync.c | 7 ------- server/fsync.c | 28 ++++++++++++++++++++++++++++ server/object.h | 2 +- server/protocol.def | 16 ++++++++++++++++ 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index e7a495be365..2f680212fc0 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -95,13 +95,6 @@ int do_fsync(void) #endif } -enum fsync_type -{ - FSYNC_SEMAPHORE = 1, - FSYNC_AUTO_EVENT, - FSYNC_MANUAL_EVENT, -}; - struct fsync { enum fsync_type type; diff --git a/server/fsync.c b/server/fsync.c index 55a8e709dbf..21f41f54ca1 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -285,3 +285,31 @@ DECL_HANDLER(create_fsync) if (root) release_object( root ); } + + +/* Retrieve the index of a shm section which will be signaled by the server. */ +DECL_HANDLER(get_fsync_idx) +{ + struct object *obj; + enum fsync_type type; + + if (!(obj = get_handle_obj( current->process, req->handle, SYNCHRONIZE, NULL ))) + return; + + if (obj->ops->get_fsync_idx) + { + reply->shm_idx = obj->ops->get_fsync_idx( obj, &type ); + reply->type = type; + } + else + { + if (debug_level) + { + fprintf( stderr, "%04x: fsync: can't wait on object: ", current->id ); + obj->ops->dump( obj, 0 ); + } + set_error( STATUS_NOT_IMPLEMENTED ); + } + + release_object( obj ); +} diff --git a/server/object.h b/server/object.h index 632b20a548c..c482b8ceeef 100644 --- a/server/object.h +++ b/server/object.h @@ -81,7 +81,7 @@ struct object_ops /* return the esync fd for this object */ int (*get_esync_fd)(struct object *, enum esync_type *type); /* return the fsync shm idx for this object */ - unsigned int (*get_fsync_idx)(struct object *); + unsigned int (*get_fsync_idx)(struct object *, enum fsync_type *type); /* wait satisfied */ void (*satisfied)(struct object *,struct wait_queue_entry *); /* signal an object */ diff --git a/server/protocol.def b/server/protocol.def index 2243d97dcfe..d32ae3a27a3 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3992,6 +3992,14 @@ enum esync_type @REQ(get_esync_apc_fd) @END +enum fsync_type +{ + FSYNC_SEMAPHORE = 1, + FSYNC_AUTO_EVENT, + FSYNC_MANUAL_EVENT, + FSYNC_MANUAL_SERVER, +}; + /* Create a new futex-based synchronization object */ @REQ(create_fsync) unsigned int access; /* wanted access rights */ @@ -4002,3 +4010,11 @@ enum esync_type obj_handle_t handle; /* handle to the object */ unsigned int shm_idx; /* this object's index into the shm section */ @END + +/* Retrieve the shm index for an object. */ +@REQ(get_fsync_idx) + obj_handle_t handle; /* handle to the object */ +@REPLY + int type; + unsigned int shm_idx; +@END From 3958bc7081ba094c03daa995067f20c7d4b1557f Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 17:20:36 -0500 Subject: [PATCH 0497/1506] server: Create futex sections for process objects. --- server/fsync.c | 49 +++++++++++++++++++++++++++++------------------- server/fsync.h | 1 + server/process.c | 15 ++++++++++++++- server/process.h | 1 + 4 files changed, 46 insertions(+), 20 deletions(-) diff --git a/server/fsync.c b/server/fsync.c index 21f41f54ca1..ae4dc7d7318 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -207,6 +207,35 @@ static void *get_shm( unsigned int idx ) /* FIXME: This is rather inefficient... */ static unsigned int shm_idx_counter = 1; +unsigned int fsync_alloc_shm( int low, int high ) +{ +#ifdef __linux__ + int shm_idx = shm_idx_counter++; + int *shm; + + while (shm_idx * 8 >= shm_size) + { + /* Better expand the shm section. */ + shm_size += pagesize; + if (ftruncate( shm_fd, shm_size ) == -1) + { + fprintf( stderr, "fsync: couldn't expand %s to size %jd: ", + shm_name, shm_size ); + perror( "ftruncate" ); + } + } + + shm = get_shm( shm_idx ); + assert(shm); + shm[0] = low; + shm[1] = high; + + return shm_idx; +#else + return 0; +#endif +} + struct fsync *create_fsync( struct object *root, const struct unicode_str *name, unsigned int attr, int low, int high, const struct security_descriptor *sd ) @@ -218,32 +247,14 @@ struct fsync *create_fsync( struct object *root, const struct unicode_str *name, { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { - int *shm; - /* initialize it if it didn't already exist */ - fsync->shm_idx = shm_idx_counter++; - while (fsync->shm_idx * 8 >= shm_size) - { - /* Better expand the shm section. */ - shm_size += pagesize; - if (ftruncate( shm_fd, shm_size ) == -1) - { - fprintf( stderr, "fsync: couldn't expand %s to size %lld: ", - shm_name, (long long)shm_size ); - perror( "ftruncate" ); - } - } - /* Initialize the shared memory portion. We want to do this on the * server side to avoid a potential though unlikely race whereby * the same object is opened and used between the time it's created * and the time its shared memory portion is initialized. */ - shm = get_shm( fsync->shm_idx ); - assert(shm); - shm[0] = low; - shm[1] = high; + fsync->shm_idx = fsync_alloc_shm( low, high ); } } diff --git a/server/fsync.h b/server/fsync.h index 0b7e46cdaf3..bbd104f3e16 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -20,3 +20,4 @@ extern int do_fsync(void); extern void fsync_init(void); +extern unsigned int fsync_alloc_shm( int low, int high ); diff --git a/server/process.c b/server/process.c index 1db0d52cb34..38303e04193 100644 --- a/server/process.c +++ b/server/process.c @@ -64,6 +64,7 @@ #include "user.h" #include "security.h" #include "esync.h" +#include "fsync.h" /* process object */ @@ -97,6 +98,7 @@ static void process_poll_event( struct fd *fd, int event ); static struct list *process_get_kernel_obj_list( struct object *obj ); static void process_destroy( struct object *obj ); static int process_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int process_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void terminate_process( struct process *process, struct thread *skip, int exit_code ); static const struct object_ops process_ops = @@ -108,7 +110,7 @@ static const struct object_ops process_ops = remove_queue, /* remove_queue */ process_signaled, /* signaled */ process_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + process_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -692,6 +694,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla process->rawinput_kbd = NULL; memset( &process->image_info, 0, sizeof(process->image_info) ); process->esync_fd = -1; + process->fsync_idx = 0; list_init( &process->kernel_object ); list_init( &process->thread_list ); list_init( &process->locks ); @@ -748,6 +751,9 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla if (!token_assign_label( process->token, &high_label_sid )) goto error; + if (do_fsync()) + process->fsync_idx = fsync_alloc_shm( 0, 0 ); + if (do_esync()) process->esync_fd = esync_create_fd( 0, 0 ); @@ -823,6 +829,13 @@ static int process_get_esync_fd( struct object *obj, enum esync_type *type ) return process->esync_fd; } +static unsigned int process_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct process *process = (struct process *)obj; + *type = FSYNC_MANUAL_SERVER; + return process->fsync_idx; +} + static unsigned int process_map_access( struct object *obj, unsigned int access ) { access = default_map_access( obj, access ); diff --git a/server/process.h b/server/process.h index a0a071d8f88..4b80b8863b8 100644 --- a/server/process.h +++ b/server/process.h @@ -86,6 +86,7 @@ struct process struct list kernel_object; /* list of kernel object pointers */ pe_image_info_t image_info; /* main exe image info */ int esync_fd; /* esync file descriptor (signaled on exit) */ + unsigned int fsync_idx; }; /* process functions */ From 2bab7398c6e8c3576e11ade09602d80dc02db1cc Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 17:30:47 -0500 Subject: [PATCH 0498/1506] ntdll, server: Implement waiting on server-bound objects. --- dlls/ntdll/unix/fsync.c | 51 +++++++++++++++++++++++++++++++++++++++-- server/fsync.c | 27 ++++++++++++++++++++++ server/fsync.h | 2 ++ server/thread.c | 4 ++++ 4 files changed, 82 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 2f680212fc0..ec8b3121ed1 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -205,6 +205,49 @@ static struct fsync *get_cached_object( HANDLE handle ) return &fsync_list[entry][idx]; } +/* Gets an object. This is either a proper fsync object (i.e. an event, + * semaphore, etc. created using create_fsync) or a generic synchronizable + * server-side object which the server will signal (e.g. a process, thread, + * message queue, etc.) */ +static NTSTATUS get_object( HANDLE handle, struct fsync **obj ) +{ + NTSTATUS ret = STATUS_SUCCESS; + unsigned int shm_idx = 0; + enum fsync_type type; + + if ((*obj = get_cached_object( handle ))) return STATUS_SUCCESS; + + if ((INT_PTR)handle < 0) + { + /* We can deal with pseudo-handles, but it's just easier this way */ + return STATUS_NOT_IMPLEMENTED; + } + + /* We need to try grabbing it from the server. */ + SERVER_START_REQ( get_fsync_idx ) + { + req->handle = wine_server_obj_handle( handle ); + if (!(ret = wine_server_call( req ))) + { + shm_idx = reply->shm_idx; + type = reply->type; + } + } + SERVER_END_REQ; + + if (ret) + { + WARN("Failed to retrieve shm index for handle %p, status %#x.\n", handle, (unsigned int)ret); + *obj = NULL; + return ret; + } + + TRACE("Got shm index %d for handle %p.\n", shm_idx, handle); + + *obj = add_to_list( handle, type, get_shm( shm_idx ) ); + return ret; +} + NTSTATUS fsync_close( HANDLE handle ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); @@ -419,10 +462,13 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) { - if ((objs[i] = get_cached_object( handles[i] ))) + ret = get_object( handles[i], &objs[i] ); + if (ret == STATUS_SUCCESS) has_fsync = 1; - else + else if (ret == STATUS_NOT_IMPLEMENTED) has_server = 1; + else + return ret; } if (has_fsync && has_server) @@ -495,6 +541,7 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, break; } case FSYNC_MANUAL_EVENT: + case FSYNC_MANUAL_SERVER: { struct event *event = obj->shm; diff --git a/server/fsync.c b/server/fsync.c index ae4dc7d7318..da30d94f1f7 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -265,6 +266,32 @@ struct fsync *create_fsync( struct object *root, const struct unicode_str *name, #endif } +static inline int futex_wake( int *addr, int val ) +{ + return syscall( __NR_futex, addr, 1, val, NULL, 0, 0 ); +} + +/* shm layout for events or event-like objects. */ +struct fsync_event +{ + int signaled; + int unused; +}; + +void fsync_wake_up( struct object *obj ) +{ + struct fsync_event *event; + enum fsync_type type; + + if (obj->ops->get_fsync_idx) + { + event = get_shm( obj->ops->get_fsync_idx( obj, &type ) ); + + if (!__atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST )) + futex_wake( &event->signaled, INT_MAX ); + } +} + DECL_HANDLER(create_fsync) { struct fsync *fsync; diff --git a/server/fsync.h b/server/fsync.h index bbd104f3e16..2ff98cb64cb 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -21,3 +21,5 @@ extern int do_fsync(void); extern void fsync_init(void); extern unsigned int fsync_alloc_shm( int low, int high ); +extern void fsync_wake_up( struct object *obj ); +extern void fsync_clear( struct object *obj ); diff --git a/server/thread.c b/server/thread.c index ce90d8cfe74..6c46fc492cf 100644 --- a/server/thread.c +++ b/server/thread.c @@ -55,6 +55,7 @@ #include "security.h" #include "unicode.h" #include "esync.h" +#include "fsync.h" /* thread queues */ @@ -1241,6 +1242,9 @@ void wake_up( struct object *obj, int max ) struct list *ptr; int ret; + if (do_fsync()) + fsync_wake_up( obj ); + if (do_esync()) esync_wake_up( obj ); From c93fc0dc56069af4849c1785c1a9886a3ca3cc11 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 17:37:55 -0500 Subject: [PATCH 0499/1506] server: Create futexes for event objects. --- server/event.c | 21 ++++++++++++++++++++- server/fsync.c | 13 +++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/server/event.c b/server/event.c index f5a25c02293..9acd7fa263c 100644 --- a/server/event.c +++ b/server/event.c @@ -36,6 +36,7 @@ #include "request.h" #include "security.h" #include "esync.h" +#include "fsync.h" static const WCHAR event_name[] = {'E','v','e','n','t'}; @@ -58,12 +59,14 @@ struct event int manual_reset; /* is it a manual reset event? */ int signaled; /* event has been signaled */ int esync_fd; /* esync file descriptor */ + unsigned int fsync_idx; }; static void event_dump( struct object *obj, int verbose ); static int event_signaled( struct object *obj, struct wait_queue_entry *entry ); static void event_satisfied( struct object *obj, struct wait_queue_entry *entry ); static int event_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int event_get_fsync_idx( struct object *obj, enum fsync_type *type ); static int event_signal( struct object *obj, unsigned int access); static struct list *event_get_kernel_obj_list( struct object *obj ); static void event_destroy( struct object *obj ); @@ -77,7 +80,7 @@ static const struct object_ops event_ops = remove_queue, /* remove_queue */ event_signaled, /* signaled */ event_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + event_get_fsync_idx, /* get_fsync_idx */ event_satisfied, /* satisfied */ event_signal, /* signal */ no_get_fd, /* get_fd */ @@ -159,6 +162,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name, event->manual_reset = manual_reset; event->signaled = initial_state; + if (do_fsync()) + event->fsync_idx = fsync_alloc_shm( initial_state, 0 ); + if (do_esync()) event->esync_fd = esync_create_fd( initial_state, 0 ); } @@ -181,6 +187,9 @@ static void pulse_event( struct event *event ) /* wake up all waiters if manual reset, a single one otherwise */ wake_up( &event->obj, !event->manual_reset ); event->signaled = 0; + + if (do_fsync()) + fsync_clear( &event->obj ); } void set_event( struct event *event ) @@ -205,6 +214,9 @@ void reset_event( struct event *event ) } event->signaled = 0; + if (do_fsync()) + fsync_clear( &event->obj ); + if (do_esync()) esync_clear( event->esync_fd ); } @@ -231,6 +243,13 @@ static int event_get_esync_fd( struct object *obj, enum esync_type *type ) return event->esync_fd; } +static unsigned int event_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct event *event = (struct event *)obj; + *type = FSYNC_MANUAL_SERVER; + return event->fsync_idx; +} + static void event_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct event *event = (struct event *)obj; diff --git a/server/fsync.c b/server/fsync.c index da30d94f1f7..07c0367d02c 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -292,6 +292,19 @@ void fsync_wake_up( struct object *obj ) } } +void fsync_clear( struct object *obj ) +{ + struct fsync_event *event; + enum fsync_type type; + + if (obj->ops->get_fsync_idx) + { + event = get_shm( obj->ops->get_fsync_idx( obj, &type ) ); + + __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); + } +} + DECL_HANDLER(create_fsync) { struct fsync *fsync; From 7fe825927c7e83008777e458304d3273df64cd6e Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 17:44:18 -0500 Subject: [PATCH 0500/1506] server: Allow (re)setting fsync events on the server side. --- server/event.c | 16 ++++++++++++++++ server/fsync.c | 19 ++++++++++++++++++- server/fsync.h | 6 ++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/server/event.c b/server/event.c index 9acd7fa263c..aa1b0a4002a 100644 --- a/server/event.c +++ b/server/event.c @@ -175,6 +175,10 @@ struct event *create_event( struct object *root, const struct unicode_str *name, struct event *get_event_obj( struct process *process, obj_handle_t handle, unsigned int access ) { struct object *obj; + + if (do_fsync() && (obj = get_handle_obj( process, handle, access, &fsync_ops))) + return (struct event *)obj; /* even though it's not an event */ + if (do_esync() && (obj = get_handle_obj( process, handle, access, &esync_ops))) return (struct event *)obj; /* even though it's not an event */ @@ -194,6 +198,12 @@ static void pulse_event( struct event *event ) void set_event( struct event *event ) { + if (do_fsync() && event->obj.ops == &fsync_ops) + { + fsync_set_event( (struct fsync *)event ); + return; + } + if (do_esync() && event->obj.ops == &esync_ops) { esync_set_event( (struct esync *)event ); @@ -207,6 +217,12 @@ void set_event( struct event *event ) void reset_event( struct event *event ) { + if (do_fsync() && event->obj.ops == &fsync_ops) + { + fsync_reset_event( (struct fsync *)event ); + return; + } + if (do_esync() && event->obj.ops == &esync_ops) { esync_reset_event( (struct esync *)event ); diff --git a/server/fsync.c b/server/fsync.c index 07c0367d02c..1d6a49fb517 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -132,7 +132,7 @@ struct fsync static void fsync_dump( struct object *obj, int verbose ); static void fsync_destroy( struct object *obj ); -static const struct object_ops fsync_ops = +const struct object_ops fsync_ops = { sizeof(struct fsync), /* size */ &no_type, /* type */ @@ -305,6 +305,23 @@ void fsync_clear( struct object *obj ) } } +void fsync_set_event( struct fsync *fsync ) +{ + struct fsync_event *event = get_shm( fsync->shm_idx ); + assert( fsync->obj.ops == &fsync_ops ); + + if (!__atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST )) + futex_wake( &event->signaled, INT_MAX ); +} + +void fsync_reset_event( struct fsync *fsync ) +{ + struct fsync_event *event = get_shm( fsync->shm_idx ); + assert( fsync->obj.ops == &fsync_ops ); + + __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); +} + DECL_HANDLER(create_fsync) { struct fsync *fsync; diff --git a/server/fsync.h b/server/fsync.h index 2ff98cb64cb..087d482717b 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -23,3 +23,9 @@ extern void fsync_init(void); extern unsigned int fsync_alloc_shm( int low, int high ); extern void fsync_wake_up( struct object *obj ); extern void fsync_clear( struct object *obj ); + +struct fsync; + +extern const struct object_ops fsync_ops; +extern void fsync_set_event( struct fsync *fsync ); +extern void fsync_reset_event( struct fsync *fsync ); From 14397f6fccbe464df611da71d25dfec87e09dc74 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 17:47:50 -0500 Subject: [PATCH 0501/1506] server: Create futexes for thread objects. --- server/thread.c | 14 +++++++++++++- server/thread.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/server/thread.c b/server/thread.c index 6c46fc492cf..0ca74e6a7ab 100644 --- a/server/thread.c +++ b/server/thread.c @@ -185,6 +185,7 @@ struct type_descr thread_type = static void dump_thread( struct object *obj, int verbose ); static int thread_signaled( struct object *obj, struct wait_queue_entry *entry ); static int thread_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int thread_get_fsync_idx( struct object *obj, enum fsync_type *type ); static unsigned int thread_map_access( struct object *obj, unsigned int access ); static void thread_poll_event( struct fd *fd, int event ); static struct list *thread_get_kernel_obj_list( struct object *obj ); @@ -199,7 +200,7 @@ static const struct object_ops thread_ops = remove_queue, /* remove_queue */ thread_signaled, /* signaled */ thread_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + thread_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -269,6 +270,7 @@ static inline void init_thread_structure( struct thread *thread ) thread->entry_point = 0; thread->esync_fd = -1; thread->esync_apc_fd = -1; + thread->fsync_idx = 0; thread->system_regs = 0; thread->queue = NULL; thread->wait = NULL; @@ -481,6 +483,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu } } + if (do_fsync()) + thread->fsync_idx = fsync_alloc_shm( 0, 0 ); + if (do_esync()) { thread->esync_fd = esync_create_fd( 0, 0 ); @@ -597,6 +602,13 @@ static int thread_get_esync_fd( struct object *obj, enum esync_type *type ) return thread->esync_fd; } +static unsigned int thread_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct thread *thread = (struct thread *)obj; + *type = FSYNC_MANUAL_SERVER; + return thread->fsync_idx; +} + static unsigned int thread_map_access( struct object *obj, unsigned int access ) { access = default_map_access( obj, access ); diff --git a/server/thread.h b/server/thread.h index a01d492361d..ec271f5cab4 100644 --- a/server/thread.h +++ b/server/thread.h @@ -56,6 +56,7 @@ struct thread struct list mutex_list; /* list of currently owned mutexes */ int esync_fd; /* esync file descriptor (signalled on exit) */ int esync_apc_fd; /* esync apc fd (signalled when APCs are present) */ + unsigned int fsync_idx; unsigned int system_regs; /* which system regs have been set */ struct msg_queue *queue; /* message queue */ struct thread_wait *wait; /* current wait condition if sleeping */ From 775d7fb3372b741c29e3721a01d60edebc560ce9 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 17:53:59 -0500 Subject: [PATCH 0502/1506] server: Create futexes for message queues. --- server/protocol.def | 1 + server/queue.c | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/server/protocol.def b/server/protocol.def index d32ae3a27a3..ac5f200122c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3998,6 +3998,7 @@ enum fsync_type FSYNC_AUTO_EVENT, FSYNC_MANUAL_EVENT, FSYNC_MANUAL_SERVER, + FSYNC_QUEUE, }; /* Create a new futex-based synchronization object */ diff --git a/server/queue.c b/server/queue.c index ddb4122bb9d..50e58d31501 100644 --- a/server/queue.c +++ b/server/queue.c @@ -43,6 +43,7 @@ #include "request.h" #include "user.h" #include "esync.h" +#include "fsync.h" #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE #define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST)) @@ -138,6 +139,7 @@ struct msg_queue const queue_shm_t *shared; /* thread queue shared memory ptr */ int esync_fd; /* esync file descriptor (signalled on message) */ int esync_in_msgwait; /* our thread is currently waiting on us */ + unsigned int fsync_idx; }; struct hotkey @@ -155,6 +157,7 @@ static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *ent static void msg_queue_remove_queue( struct object *obj, struct wait_queue_entry *entry ); static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entry ); static int msg_queue_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int msg_queue_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ); static void msg_queue_destroy( struct object *obj ); static void msg_queue_poll_event( struct fd *fd, int event ); @@ -171,7 +174,7 @@ static const struct object_ops msg_queue_ops = msg_queue_remove_queue, /* remove_queue */ msg_queue_signaled, /* signaled */ msg_queue_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + msg_queue_get_fsync_idx, /* get_fsync_idx */ msg_queue_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -344,21 +347,25 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->shared = thread->queue_shared; queue->esync_fd = -1; queue->esync_in_msgwait = 0; + queue->fsync_idx = 0; list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); list_init( &queue->expired_timers ); for (i = 0; i < NB_MSG_KINDS; i++) list_init( &queue->msg_list[i] ); + if (do_fsync()) + queue->fsync_idx = fsync_alloc_shm( 0, 0 ); + + if (do_esync()) + queue->esync_fd = esync_create_fd( 0, 0 ); + SHARED_WRITE_BEGIN( queue, queue_shm_t ) { shared->created = TRUE; } SHARED_WRITE_END - if (do_esync()) - queue->esync_fd = esync_create_fd( 0, 0 ); - thread->queue = queue; } if (new_input) @@ -704,6 +711,9 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits queue->keystate_lock = 0; } + if (do_fsync() && !is_signaled( queue )) + fsync_clear( &queue->obj ); + if (do_esync() && !is_signaled( queue )) esync_clear( queue->esync_fd ); @@ -1289,6 +1299,13 @@ static int msg_queue_get_esync_fd( struct object *obj, enum esync_type *type ) return queue->esync_fd; } +static unsigned int msg_queue_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct msg_queue *queue = (struct msg_queue *)obj; + *type = FSYNC_QUEUE; + return queue->fsync_idx; +} + static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; @@ -2924,6 +2941,9 @@ DECL_HANDLER(set_queue_mask) else wake_up( &queue->obj, 0 ); } + if (do_fsync() && !is_signaled( queue )) + fsync_clear( &queue->obj ); + if (do_esync() && !is_signaled( queue )) esync_clear( queue->esync_fd ); } @@ -2940,6 +2960,9 @@ DECL_HANDLER(get_queue_status) reply->changed_bits = queue->changed_bits; queue->changed_bits &= ~req->clear_bits; + if (do_fsync() && !is_signaled( queue )) + fsync_clear( &queue->obj ); + if (do_esync() && !is_signaled( queue )) esync_clear( queue->esync_fd ); @@ -3201,6 +3224,9 @@ DECL_HANDLER(get_message) set_error( STATUS_PENDING ); /* FIXME */ + if (do_fsync() && !is_signaled( queue )) + fsync_clear( &queue->obj ); + if (do_esync() && !is_signaled( queue )) esync_clear( queue->esync_fd ); From e1e1e5385bed846a11675c4186b523ef50381917 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 19:24:15 -0500 Subject: [PATCH 0503/1506] server, ntdll: Implement message waits. The approach of giving the queue fd to ntdll to wait on doesn't work here. Fortunately, the way esync has ended up lends itself very easily to a rather clean approach: let the server do it the normal way. --- dlls/ntdll/unix/fsync.c | 52 ++++++++++++++++++++++++++++++++++++++++- server/protocol.def | 4 ++++ server/queue.c | 20 ++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index ec8b3121ed1..edad675fa7a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -437,12 +437,13 @@ static LONGLONG update_timeout( ULONGLONG end ) return timeleft; } -NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, +static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { struct futex_wait_block futexes[MAXIMUM_WAIT_OBJECTS]; struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; int has_fsync = 0, has_server = 0; + BOOL msgwait = FALSE; int dummy_futex = 0; LONGLONG timeleft; LARGE_INTEGER now; @@ -471,6 +472,9 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, return ret; } + if (objs[count - 1] && objs[count - 1]->type == FSYNC_QUEUE) + msgwait = TRUE; + if (has_fsync && has_server) FIXME("Can't wait on fsync and server objects at the same time!\n"); else if (has_server) @@ -482,6 +486,9 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) TRACE(" %p", handles[i]); + if (msgwait) + TRACE(" or driver events"); + if (!timeout) TRACE(", timeout = INFINITE.\n"); else @@ -542,6 +549,7 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, } case FSYNC_MANUAL_EVENT: case FSYNC_MANUAL_SERVER: + case FSYNC_QUEUE: { struct event *event = obj->shm; @@ -602,3 +610,45 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, return STATUS_NOT_IMPLEMENTED; } } + +/* Like esync, we need to let the server know when we are doing a message wait, + * and when we are done with one, so that all of the code surrounding hung + * queues works, and we also need this for WaitForInputIdle(). + * + * Unlike esync, we can't wait on the queue fd itself locally. Instead we let + * the server do that for us, the way it normally does. This could actually + * work for esync too, and that might be better. */ +static void server_set_msgwait( int in_msgwait ) +{ + SERVER_START_REQ( fsync_msgwait ) + { + req->in_msgwait = in_msgwait; + wine_server_call( req ); + } + SERVER_END_REQ; +} + +/* This is a very thin wrapper around the proper implementation above. The + * purpose is to make sure the server knows when we are doing a message wait. + * This is separated into a wrapper function since there are at least a dozen + * exit paths from fsync_wait_objects(). */ +NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, + BOOLEAN alertable, const LARGE_INTEGER *timeout ) +{ + BOOL msgwait = FALSE; + struct fsync *obj; + NTSTATUS ret; + + if (!get_object( handles[count - 1], &obj ) && obj->type == FSYNC_QUEUE) + { + msgwait = TRUE; + server_set_msgwait( 1 ); + } + + ret = __fsync_wait_objects( count, handles, wait_any, alertable, timeout ); + + if (msgwait) + server_set_msgwait( 0 ); + + return ret; +} diff --git a/server/protocol.def b/server/protocol.def index ac5f200122c..8eb4ab0b004 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -4019,3 +4019,7 @@ enum fsync_type int type; unsigned int shm_idx; @END + +@REQ(fsync_msgwait) + int in_msgwait; /* are we in a message wait? */ +@END diff --git a/server/queue.c b/server/queue.c index 50e58d31501..3526cfee3f3 100644 --- a/server/queue.c +++ b/server/queue.c @@ -140,6 +140,7 @@ struct msg_queue int esync_fd; /* esync file descriptor (signalled on message) */ int esync_in_msgwait; /* our thread is currently waiting on us */ unsigned int fsync_idx; + int fsync_in_msgwait; /* our thread is currently waiting on us */ }; struct hotkey @@ -348,6 +349,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->esync_fd = -1; queue->esync_in_msgwait = 0; queue->fsync_idx = 0; + queue->fsync_in_msgwait = 0; list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); @@ -1234,6 +1236,9 @@ static int is_queue_hung( struct msg_queue *queue ) return 0; /* thread is waiting on queue -> not hung */ } + if (do_fsync() && queue->fsync_in_msgwait) + return 0; /* thread is waiting on queue in absentia -> not hung */ + if (do_esync() && queue->esync_in_msgwait) return 0; /* thread is waiting on queue in absentia -> not hung */ @@ -3998,3 +4003,18 @@ DECL_HANDLER(esync_msgwait) if (queue->fd) set_fd_events( queue->fd, req->in_msgwait ? POLLIN : 0 ); } + +DECL_HANDLER(fsync_msgwait) +{ + struct msg_queue *queue = get_current_queue(); + + if (!queue) return; + queue->fsync_in_msgwait = req->in_msgwait; + + if (current->process->idle_event && !(queue->wake_mask & QS_SMRESULT)) + set_event( current->process->idle_event ); + + /* and start/stop waiting on the driver */ + if (queue->fd) + set_fd_events( queue->fd, req->in_msgwait ? POLLIN : 0 ); +} From a986d6dd884e502aa039379afda2b7e82184d0da Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 19:29:56 -0500 Subject: [PATCH 0504/1506] server: Create futexes for device manager objects. --- server/device.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/server/device.c b/server/device.c index 8613cee58af..90e0a0c1fee 100644 --- a/server/device.c +++ b/server/device.c @@ -39,6 +39,7 @@ #include "request.h" #include "process.h" #include "esync.h" +#include "fsync.h" /* IRP object */ @@ -96,11 +97,13 @@ struct device_manager struct irp_call *current_call; /* call currently executed on client side */ struct wine_rb_tree kernel_objects; /* map of objects that have client side pointer associated */ int esync_fd; /* esync file descriptor */ + unsigned int fsync_idx; }; static void device_manager_dump( struct object *obj, int verbose ); static int device_manager_signaled( struct object *obj, struct wait_queue_entry *entry ); static int device_manager_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int device_manager_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void device_manager_destroy( struct object *obj ); static const struct object_ops device_manager_ops = @@ -112,7 +115,7 @@ static const struct object_ops device_manager_ops = remove_queue, /* remove_queue */ device_manager_signaled, /* signaled */ device_manager_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + device_manager_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -758,6 +761,9 @@ static void delete_file( struct device_file *file ) /* terminate all pending requests */ LIST_FOR_EACH_ENTRY_SAFE( irp, next, &file->requests, struct irp_call, dev_entry ) { + if (do_fsync() && file->device->manager && list_empty( &file->device->manager->requests )) + fsync_clear( &file->device->manager->obj ); + if (do_esync() && file->device->manager && list_empty( &file->device->manager->requests )) esync_clear( file->device->manager->esync_fd ); @@ -803,6 +809,13 @@ static int device_manager_get_esync_fd( struct object *obj, enum esync_type *typ return manager->esync_fd; } +static unsigned int device_manager_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct device_manager *manager = (struct device_manager *)obj; + *type = FSYNC_MANUAL_SERVER; + return manager->fsync_idx; +} + static void device_manager_destroy( struct object *obj ) { struct device_manager *manager = (struct device_manager *)obj; @@ -853,6 +866,9 @@ static struct device_manager *create_device_manager(void) list_init( &manager->requests ); wine_rb_init( &manager->kernel_objects, compare_kernel_object ); + if (do_fsync()) + manager->fsync_idx = fsync_alloc_shm( 0, 0 ); + if (do_esync()) manager->esync_fd = esync_create_fd( 0, 0 ); } @@ -1045,6 +1061,9 @@ DECL_HANDLER(get_next_device_request) if (irp->file) grab_object( irp ); manager->current_call = irp; + if (do_fsync() && list_empty( &manager->requests )) + fsync_clear( &manager->obj ); + if (do_esync() && list_empty( &manager->requests )) esync_clear( manager->esync_fd ); } From b48a1bd74a70221bf9dbe5876b45f9e23c768f28 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 19:36:23 -0500 Subject: [PATCH 0505/1506] ntdll: Implement NtCreateMutant(). --- dlls/ntdll/unix/fsync.c | 17 +++++++++++++++++ dlls/ntdll/unix/fsync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ server/protocol.def | 1 + 4 files changed, 23 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index edad675fa7a..9d4d61ad389 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -115,6 +115,13 @@ struct event }; C_ASSERT(sizeof(struct event) == 8); +struct mutex +{ + int tid; + int count; /* recursion count */ +}; +C_ASSERT(sizeof(struct mutex) == 8); + static char shm_name[29]; static int shm_fd; static void **shm_addrs; @@ -426,6 +433,16 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ) +{ + TRACE("name %s, initial %d.\n", + attr ? debugstr_us(attr->ObjectName) : "", initial); + + return create_fsync( FSYNC_MUTEX, handle, access, attr, + initial ? GetCurrentThreadId() : 0, initial ? 1 : 0 ); +} + static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 56afeb1f9e8..e7cc1e87b4e 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -29,6 +29,8 @@ extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); +extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index ef39b1b8b42..a21b372e0d9 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -588,6 +588,9 @@ NTSTATUS WINAPI NtCreateMutant( HANDLE *handle, ACCESS_MASK access, const OBJECT *handle = 0; + if (do_fsync()) + return fsync_create_mutex( handle, access, attr, owned ); + if (do_esync()) return esync_create_mutex( handle, access, attr, owned ); diff --git a/server/protocol.def b/server/protocol.def index 8eb4ab0b004..d0f9c715a54 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3997,6 +3997,7 @@ enum fsync_type FSYNC_SEMAPHORE = 1, FSYNC_AUTO_EVENT, FSYNC_MANUAL_EVENT, + FSYNC_MUTEX, FSYNC_MANUAL_SERVER, FSYNC_QUEUE, }; From a3324abb11bd4f89117988236ce1d5d019062fea Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 19:42:17 -0500 Subject: [PATCH 0506/1506] ntdll: Implement NtReleaseMutant(). --- dlls/ntdll/unix/fsync.c | 23 +++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 27 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 9d4d61ad389..22b67e5d4a4 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -443,6 +443,29 @@ NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, initial ? GetCurrentThreadId() : 0, initial ? 1 : 0 ); } +NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) +{ + struct mutex *mutex; + struct fsync *obj; + + TRACE("%p, %p.\n", handle, prev); + + if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + mutex = obj->shm; + + if (mutex->tid != GetCurrentThreadId()) return STATUS_MUTANT_NOT_OWNED; + + if (prev) *prev = mutex->count; + + if (!--mutex->count) + { + __atomic_store_n( &mutex->tid, 0, __ATOMIC_SEQ_CST ); + futex_wake( &mutex->tid, 1 ); + } + + return STATUS_SUCCESS; +} + static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index e7cc1e87b4e..1867ba88112 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -31,6 +31,7 @@ extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); +extern NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index a21b372e0d9..456531267e5 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -646,6 +646,9 @@ NTSTATUS WINAPI NtReleaseMutant( HANDLE handle, LONG *prev_count ) { unsigned int ret; + if (do_fsync()) + return fsync_release_mutex( handle, prev_count ); + if (do_esync()) return esync_release_mutex( handle, prev_count ); From 0e61751fddda33bb1e87c00107da680f6a77afa1 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 19:46:17 -0500 Subject: [PATCH 0507/1506] ntdll: Implement waiting on mutexes. --- dlls/ntdll/unix/fsync.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 22b67e5d4a4..f4d3c8953cf 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -573,6 +573,28 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, futexes[i].val = current; break; } + case FSYNC_MUTEX: + { + struct mutex *mutex = obj->shm; + + if (mutex->tid == GetCurrentThreadId()) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->count++; + return i; + } + + if (!__sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() )) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->count = 1; + return i; + } + + futexes[i].addr = &mutex->tid; + futexes[i].val = mutex->tid; + break; + } case FSYNC_AUTO_EVENT: { struct event *event = obj->shm; From 26ede2ce1e39574e153703a703654e71db8aaa59 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 1 Sep 2018 20:35:44 -0500 Subject: [PATCH 0508/1506] ntdll: Implement wait-all. --- dlls/ntdll/unix/fsync.c | 204 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 201 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index f4d3c8953cf..0c382de40ae 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -74,6 +74,11 @@ static inline int futex_wake( int *addr, int val ) return syscall( __NR_futex, addr, 1, val, NULL, 0, 0 ); } +static inline int futex_wait( int *addr, int val, struct timespec *timeout ) +{ + return syscall( __NR_futex, addr, 0, val, timeout, 0, 0 ); +} + int do_fsync(void) { #ifdef __linux__ @@ -477,6 +482,29 @@ static LONGLONG update_timeout( ULONGLONG end ) return timeleft; } +static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end ) +{ + int ret; + + if (end) + { + LONGLONG timeleft = update_timeout( *end ); + struct timespec tmo_p; + tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; + ret = futex_wait( addr, val, &tmo_p ); + } + else + ret = futex_wait( addr, val, NULL ); + + if (!ret) + return 0; + else if (ret < 0 && errno == ETIMEDOUT) + return STATUS_TIMEOUT; + else + return STATUS_PENDING; +} + static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { @@ -668,9 +696,179 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } else { - FIXME("Wait-all not implemented.\n"); - return STATUS_NOT_IMPLEMENTED; - } + /* Wait-all is a little trickier to implement correctly. Fortunately, + * it's not as common. + * + * The idea is basically just to wait in sequence on every object in the + * set. Then when we're done, try to grab them all in a tight loop. If + * that fails, release any resources we've grabbed (and yes, we can + * reliably do this—it's just mutexes and semaphores that we have to + * put back, and in both cases we just put back 1), and if any of that + * fails we start over. + * + * What makes this inherently bad is that we might temporarily grab a + * resource incorrectly. Hopefully it'll be quick (and hey, it won't + * block on wineserver) so nobody will notice. Besides, consider: if + * object A becomes signaled but someone grabs it before we can grab it + * and everything else, then they could just as well have grabbed it + * before it became signaled. Similarly if object A was signaled and we + * were blocking on object B, then B becomes available and someone grabs + * A before we can, then they might have grabbed A before B became + * signaled. In either case anyone who tries to wait on A or B will be + * waiting for an instant while we put things back. */ + + NTSTATUS status = STATUS_SUCCESS; + int current; + + while (1) + { +tryagain: + /* First step: try to wait on each object in sequence. */ + + for (i = 0; i < count; i++) + { + struct fsync *obj = objs[i]; + + if (obj && obj->type == FSYNC_MUTEX) + { + struct mutex *mutex = obj->shm; + + if (mutex->tid == GetCurrentThreadId()) + continue; + + while ((current = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ))) + { + status = do_single_wait( &mutex->tid, current, timeout ? &end : NULL ); + if (status != STATUS_PENDING) + break; + } + } + else if (obj) + { + /* this works for semaphores too */ + struct event *event = obj->shm; + + while (!__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + { + status = do_single_wait( &event->signaled, 0, timeout ? &end : NULL ); + if (status != STATUS_PENDING) + break; + } + } + + if (status == STATUS_TIMEOUT) + { + TRACE("Wait timed out.\n"); + return status; + } + } + + /* If we got here and we haven't timed out, that means all of the + * handles were signaled. Check to make sure they still are. */ + for (i = 0; i < count; i++) + { + struct fsync *obj = objs[i]; + + if (obj && obj->type == FSYNC_MUTEX) + { + struct mutex *mutex = obj->shm; + + if (mutex->tid == GetCurrentThreadId()) + continue; /* ok */ + + if (__atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST )) + goto tryagain; + } + else if (obj) + { + struct event *event = obj->shm; + + if (!__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + goto tryagain; + } + } + + /* Yep, still signaled. Now quick, grab everything. */ + for (i = 0; i < count; i++) + { + struct fsync *obj = objs[i]; + switch (obj->type) + { + case FSYNC_MUTEX: + { + struct mutex *mutex = obj->shm; + if (mutex->tid == GetCurrentThreadId()) + break; + if (__sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() )) + goto tooslow; + break; + } + case FSYNC_SEMAPHORE: + { + struct semaphore *semaphore = obj->shm; + if (__sync_fetch_and_sub( &semaphore->count, 1 ) <= 0) + goto tooslow; + break; + } + case FSYNC_AUTO_EVENT: + { + struct event *event = obj->shm; + if (!__sync_val_compare_and_swap( &event->signaled, 1, 0 )) + goto tooslow; + break; + } + default: + /* If a manual-reset event changed between there and + * here, it's shouldn't be a problem. */ + break; + } + } + + /* If we got here, we successfully waited on every object. + * Make sure to let ourselves know that we grabbed the mutexes. */ + for (i = 0; i < count; i++) + { + if (objs[i] && objs[i]->type == FSYNC_MUTEX) + { + struct mutex *mutex = objs[i]->shm; + mutex->count++; + } + } + + TRACE("Wait successful.\n"); + return STATUS_SUCCESS; + +tooslow: + for (--i; i >= 0; i--) + { + struct fsync *obj = objs[i]; + switch (obj->type) + { + case FSYNC_MUTEX: + { + struct mutex *mutex = obj->shm; + __atomic_store_n( &mutex->tid, 0, __ATOMIC_SEQ_CST ); + break; + } + case FSYNC_SEMAPHORE: + { + struct semaphore *semaphore = obj->shm; + __sync_fetch_and_add( &semaphore->count, 1 ); + break; + } + case FSYNC_AUTO_EVENT: + { + struct event *event = obj->shm; + __atomic_store_n( &event->signaled, 1, __ATOMIC_SEQ_CST ); + break; + } + default: + /* doesn't need to be put back */ + break; + } + } + } /* while (1) */ + } /* else (wait-all) */ } /* Like esync, we need to let the server know when we are doing a message wait, From 54ad5ea391c97b70be1beb297b5766cd42ec6abf Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 11:41:07 -0500 Subject: [PATCH 0509/1506] ntdll: Implement NtSignalAndWaitForSingleObject(). --- dlls/ntdll/unix/fsync.c | 28 ++++++++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 0c382de40ae..b5116e07920 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -912,3 +912,31 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an return ret; } + +NTSTATUS fsync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, + const LARGE_INTEGER *timeout ) +{ + struct fsync *obj = get_cached_object( signal ); + NTSTATUS ret; + + if (!obj) return STATUS_INVALID_HANDLE; + + switch (obj->type) + { + case FSYNC_SEMAPHORE: + ret = fsync_release_semaphore( signal, 1, NULL ); + break; + case FSYNC_AUTO_EVENT: + case FSYNC_MANUAL_EVENT: + ret = fsync_set_event( signal, NULL ); + break; + case FSYNC_MUTEX: + ret = fsync_release_mutex( signal, NULL ); + break; + default: + return STATUS_OBJECT_TYPE_MISMATCH; + } + if (ret) return ret; + + return fsync_wait_objects( 1, &wait, TRUE, alertable, timeout ); +} diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 1867ba88112..c39c3a14e59 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -35,3 +35,5 @@ extern NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); +extern NTSTATUS fsync_signal_and_wait( HANDLE signal, HANDLE wait, + BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 456531267e5..cdda6307be9 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1582,6 +1582,9 @@ NTSTATUS WINAPI NtSignalAndWaitForSingleObject( HANDLE signal, HANDLE wait, select_op_t select_op; UINT flags = SELECT_INTERRUPTIBLE; + if (do_fsync()) + return fsync_signal_and_wait( signal, wait, alertable, timeout ); + if (do_esync()) return esync_signal_and_wait( signal, wait, alertable, timeout ); From 19824958f0adfd570070d9add90056d6d7720d51 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 11:48:26 -0500 Subject: [PATCH 0510/1506] server, ntdll: Also store the fsync type in the server. --- dlls/ntdll/unix/fsync.c | 2 ++ server/fsync.c | 26 +++++++++++++++++++++++--- server/protocol.def | 2 ++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index b5116e07920..e65abc525ed 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -290,12 +290,14 @@ static NTSTATUS create_fsync( enum fsync_type type, HANDLE *handle, req->access = access; req->low = low; req->high = high; + req->type = type; wine_server_add_data( req, objattr, len ); ret = wine_server_call( req ); if (!ret || ret == STATUS_OBJECT_NAME_EXISTS) { *handle = wine_server_ptr_handle( reply->handle ); shm_idx = reply->shm_idx; + type = reply->type; } } SERVER_END_REQ; diff --git a/server/fsync.c b/server/fsync.c index 1d6a49fb517..d32d5f9c689 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -127,6 +127,7 @@ struct fsync { struct object obj; unsigned int shm_idx; + enum fsync_type type; }; static void fsync_dump( struct object *obj, int verbose ); @@ -237,9 +238,16 @@ unsigned int fsync_alloc_shm( int low, int high ) #endif } +static int type_matches( enum fsync_type type1, enum fsync_type type2 ) +{ + return (type1 == type2) || + ((type1 == FSYNC_AUTO_EVENT || type1 == FSYNC_MANUAL_EVENT) && + (type2 == FSYNC_AUTO_EVENT || type2 == FSYNC_MANUAL_EVENT)); +} + struct fsync *create_fsync( struct object *root, const struct unicode_str *name, - unsigned int attr, int low, int high, - const struct security_descriptor *sd ) + unsigned int attr, int low, int high, enum fsync_type type, + const struct security_descriptor *sd ) { #ifdef __linux__ struct fsync *fsync; @@ -256,6 +264,17 @@ struct fsync *create_fsync( struct object *root, const struct unicode_str *name, * and the time its shared memory portion is initialized. */ fsync->shm_idx = fsync_alloc_shm( low, high ); + fsync->type = type; + } + else + { + /* validate the type */ + if (!type_matches( type, fsync->type )) + { + release_object( &fsync->obj ); + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + return NULL; + } } } @@ -339,7 +358,7 @@ DECL_HANDLER(create_fsync) if (!objattr) return; if ((fsync = create_fsync( root, &name, objattr->attributes, req->low, - req->high, sd ))) + req->high, req->type, sd ))) { if (get_error() == STATUS_OBJECT_NAME_EXISTS) reply->handle = alloc_handle( current->process, fsync, req->access, objattr->attributes ); @@ -348,6 +367,7 @@ DECL_HANDLER(create_fsync) req->access, objattr->attributes ); reply->shm_idx = fsync->shm_idx; + reply->type = fsync->type; release_object( fsync ); } diff --git a/server/protocol.def b/server/protocol.def index d0f9c715a54..2b9f3bd1333 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -4007,9 +4007,11 @@ enum fsync_type unsigned int access; /* wanted access rights */ int low; /* initial value of low word */ int high; /* initial value of high word */ + int type; /* type of fsync object */ VARARG(objattr,object_attributes); /* object attributes */ @REPLY obj_handle_t handle; /* handle to the object */ + int type; /* type of fsync object */ unsigned int shm_idx; /* this object's index into the shm section */ @END From 49eeda2756010fa7586494157fab48e4fecfc21c Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 12:02:39 -0500 Subject: [PATCH 0511/1506] ntdll, server: Implement NtOpenSemaphore(). --- dlls/ntdll/unix/fsync.c | 40 ++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ server/fsync.c | 27 +++++++++++++++++++++++++++ server/protocol.def | 13 +++++++++++++ 5 files changed, 85 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index e65abc525ed..81bd29634b1 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -312,6 +312,38 @@ static NTSTATUS create_fsync( enum fsync_type type, HANDLE *handle, return ret; } +static NTSTATUS open_fsync( enum fsync_type type, HANDLE *handle, + ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ) +{ + NTSTATUS ret; + unsigned int shm_idx; + + SERVER_START_REQ( open_fsync ) + { + req->access = access; + req->attributes = attr->Attributes; + req->rootdir = wine_server_obj_handle( attr->RootDirectory ); + req->type = type; + if (attr->ObjectName) + wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length ); + if (!(ret = wine_server_call( req ))) + { + *handle = wine_server_ptr_handle( reply->handle ); + type = reply->type; + shm_idx = reply->shm_idx; + } + } + SERVER_END_REQ; + + if (!ret) + { + add_to_list( *handle, type, get_shm( shm_idx ) ); + + TRACE("-> handle %p, shm index %u.\n", *handle, shm_idx); + } + return ret; +} + void fsync_init(void) { struct stat st; @@ -365,6 +397,14 @@ NTSTATUS fsync_create_semaphore( HANDLE *handle, ACCESS_MASK access, return create_fsync( FSYNC_SEMAPHORE, handle, access, attr, initial, max ); } +NTSTATUS fsync_open_semaphore( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ) +{ + TRACE("name %s.\n", debugstr_us(attr->ObjectName)); + + return open_fsync( FSYNC_SEMAPHORE, handle, access, attr ); +} + NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) { struct fsync *obj; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index c39c3a14e59..b70851499fe 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -25,6 +25,8 @@ extern NTSTATUS fsync_close( HANDLE handle ); extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max); extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); +extern NTSTATUS fsync_open_semaphore( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index cdda6307be9..d8d7656ddc6 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -305,6 +305,9 @@ NTSTATUS WINAPI NtOpenSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJEC *handle = 0; + if (do_fsync()) + return fsync_open_semaphore( handle, access, attr ); + if (do_esync()) return esync_open_semaphore( handle, access, attr ); diff --git a/server/fsync.c b/server/fsync.c index d32d5f9c689..3fbc1734735 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -374,6 +374,33 @@ DECL_HANDLER(create_fsync) if (root) release_object( root ); } +DECL_HANDLER(open_fsync) +{ + struct unicode_str name = get_req_unicode_str(); + + reply->handle = open_object( current->process, req->rootdir, req->access, + &fsync_ops, &name, req->attributes ); + + if (reply->handle) + { + struct fsync *fsync; + + if (!(fsync = (struct fsync *)get_handle_obj( current->process, reply->handle, + 0, &fsync_ops ))) + return; + + if (!type_matches( req->type, fsync->type )) + { + set_error( STATUS_OBJECT_TYPE_MISMATCH ); + release_object( fsync ); + return; + } + + reply->type = fsync->type; + reply->shm_idx = fsync->shm_idx; + release_object( fsync ); + } +} /* Retrieve the index of a shm section which will be signaled by the server. */ DECL_HANDLER(get_fsync_idx) diff --git a/server/protocol.def b/server/protocol.def index 2b9f3bd1333..64734fa0457 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -4015,6 +4015,19 @@ enum fsync_type unsigned int shm_idx; /* this object's index into the shm section */ @END +/* Open an fsync object */ +@REQ(open_fsync) + unsigned int access; /* wanted access rights */ + unsigned int attributes; /* object attributes */ + obj_handle_t rootdir; /* root directory */ + int type; /* type of fsync object */ + VARARG(name,unicode_str); /* object name */ +@REPLY + obj_handle_t handle; /* handle to the event */ + int type; /* type of fsync object */ + unsigned int shm_idx; /* this object's index into the shm section */ +@END + /* Retrieve the shm index for an object. */ @REQ(get_fsync_idx) obj_handle_t handle; /* handle to the object */ From 395a704bd29f7875bdc0b27d4886c6edb6813d68 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 12:05:37 -0500 Subject: [PATCH 0512/1506] ntdll: Implement NtOpenEvent(). --- dlls/ntdll/unix/fsync.c | 8 ++++++++ dlls/ntdll/unix/fsync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 81bd29634b1..dfb54c667a8 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -443,6 +443,14 @@ NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, return create_fsync( type, handle, access, attr, initial, 0xdeadbeef ); } +NTSTATUS fsync_open_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ) +{ + TRACE("name %s.\n", debugstr_us(attr->ObjectName)); + + return open_fsync( FSYNC_AUTO_EVENT, handle, access, attr ); +} + NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) { struct event *event; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index b70851499fe..9a777ef3521 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -29,6 +29,8 @@ extern NTSTATUS fsync_open_semaphore( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); +extern NTSTATUS fsync_open_event( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index d8d7656ddc6..378e2d20989 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -439,6 +439,9 @@ NTSTATUS WINAPI NtOpenEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_AT *handle = 0; if ((ret = validate_open_object_attributes( attr ))) return ret; + if (do_fsync()) + return fsync_open_event( handle, access, attr ); + if (do_esync()) return esync_open_event( handle, access, attr ); From 8bd2c1692e803b476dc4948e76871cd708b707ad Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 12:06:40 -0500 Subject: [PATCH 0513/1506] ntdll: Implement NtOpenMutant(). --- dlls/ntdll/unix/fsync.c | 8 ++++++++ dlls/ntdll/unix/fsync.h | 2 ++ dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index dfb54c667a8..383df952e4b 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -498,6 +498,14 @@ NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, initial ? GetCurrentThreadId() : 0, initial ? 1 : 0 ); } +NTSTATUS fsync_open_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ) +{ + TRACE("name %s.\n", debugstr_us(attr->ObjectName)); + + return open_fsync( FSYNC_MUTEX, handle, access, attr ); +} + NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) { struct mutex *mutex; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 9a777ef3521..0fc2305bd5c 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -35,6 +35,8 @@ extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); +extern NTSTATUS fsync_open_mutex( HANDLE *handle, ACCESS_MASK access, + const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 378e2d20989..38a5cd5cbb2 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -627,6 +627,9 @@ NTSTATUS WINAPI NtOpenMutant( HANDLE *handle, ACCESS_MASK access, const OBJECT_A *handle = 0; if ((ret = validate_open_object_attributes( attr ))) return ret; + if (do_fsync()) + return fsync_open_mutex( handle, access, attr ); + if (do_esync()) return esync_open_mutex( handle, access, attr ); From 3caca34611e7f1e30110127c2564522194bc66fb Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 12:07:48 -0500 Subject: [PATCH 0514/1506] server: Implement fsync_map_access(). --- server/fsync.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/fsync.c b/server/fsync.c index 3fbc1734735..1df3aff91b6 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -131,6 +131,7 @@ struct fsync }; static void fsync_dump( struct object *obj, int verbose ); +static unsigned int fsync_map_access( struct object *obj, unsigned int access ); static void fsync_destroy( struct object *obj ); const struct object_ops fsync_ops = @@ -146,7 +147,7 @@ const struct object_ops fsync_ops = NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ - default_map_access, /* map_access */ + fsync_map_access, /* map_access */ default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ default_get_full_name, /* get_full_name */ @@ -166,6 +167,16 @@ static void fsync_dump( struct object *obj, int verbose ) fprintf( stderr, "fsync idx=%d\n", fsync->shm_idx ); } +static unsigned int fsync_map_access( struct object *obj, unsigned int access ) +{ + /* Sync objects have the same flags. */ + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | EVENT_QUERY_STATE; + if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | EVENT_MODIFY_STATE; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE; + if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_ALL | EVENT_QUERY_STATE | EVENT_MODIFY_STATE; + return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); +} + static void fsync_destroy( struct object *obj ) { } From 13b0b7bdd287d22af1c479b810de3f21872f8b2b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 12:12:10 -0500 Subject: [PATCH 0515/1506] ntdll, server: Implement handle duplication. --- dlls/ntdll/unix/fsync.c | 16 ++++++++++------ server/fsync.c | 10 +++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 383df952e4b..142e3ee284b 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -410,10 +410,11 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) struct fsync *obj; struct semaphore *semaphore; ULONG current; + NTSTATUS ret; TRACE("%p, %d, %p.\n", handle, (int)count, prev); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj ))) return ret; semaphore = obj->shm; do @@ -456,10 +457,11 @@ NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) struct event *event; struct fsync *obj; LONG current; + NTSTATUS ret; TRACE("%p.\n", handle); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj ))) return ret; event = obj->shm; if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) @@ -475,10 +477,11 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) struct event *event; struct fsync *obj; LONG current; + NTSTATUS ret; TRACE("%p.\n", handle); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj ))) return ret; event = obj->shm; current = __atomic_exchange_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); @@ -510,10 +513,11 @@ NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) { struct mutex *mutex; struct fsync *obj; + NTSTATUS ret; TRACE("%p, %p.\n", handle, prev); - if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE; + if ((ret = get_object( handle, &obj ))) return ret; mutex = obj->shm; if (mutex->tid != GetCurrentThreadId()) return STATUS_MUTANT_NOT_OWNED; @@ -974,10 +978,10 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an NTSTATUS fsync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { - struct fsync *obj = get_cached_object( signal ); + struct fsync *obj; NTSTATUS ret; - if (!obj) return STATUS_INVALID_HANDLE; + if ((ret = get_object( signal, &obj ))) return ret; switch (obj->type) { diff --git a/server/fsync.c b/server/fsync.c index 1df3aff91b6..73d1873759b 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -131,6 +131,7 @@ struct fsync }; static void fsync_dump( struct object *obj, int verbose ); +static unsigned int fsync_get_fsync_idx( struct object *obj, enum fsync_type *type ); static unsigned int fsync_map_access( struct object *obj, unsigned int access ); static void fsync_destroy( struct object *obj ); @@ -143,7 +144,7 @@ const struct object_ops fsync_ops = NULL, /* remove_queue */ NULL, /* signaled */ NULL, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + fsync_get_fsync_idx, /* get_fsync_idx */ NULL, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -167,6 +168,13 @@ static void fsync_dump( struct object *obj, int verbose ) fprintf( stderr, "fsync idx=%d\n", fsync->shm_idx ); } +static unsigned int fsync_get_fsync_idx( struct object *obj, enum fsync_type *type) +{ + struct fsync *fsync = (struct fsync *)obj; + *type = fsync->type; + return fsync->shm_idx; +} + static unsigned int fsync_map_access( struct object *obj, unsigned int access ) { /* Sync objects have the same flags. */ From ee5d96af5e16ce9e0e609a4502d7d1eb3b6198c8 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 2 Sep 2018 13:19:09 -0500 Subject: [PATCH 0516/1506] ntdll, server: Implement alertable waits. --- dlls/ntdll/unix/fsync.c | 107 +++++++++++++++++++++++++++++---- dlls/ntdll/unix/unix_private.h | 1 + dlls/ntdll/unix/virtual.c | 1 + server/fsync.c | 33 ++++++---- server/fsync.h | 2 + server/protocol.def | 5 ++ server/thread.c | 10 +++ server/thread.h | 1 + 8 files changed, 135 insertions(+), 25 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 142e3ee284b..9518f1f0960 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -544,20 +544,53 @@ static LONGLONG update_timeout( ULONGLONG end ) return timeleft; } -static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end ) +static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN alertable ) { int ret; - if (end) + if (alertable) { - LONGLONG timeleft = update_timeout( *end ); - struct timespec tmo_p; - tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - ret = futex_wait( addr, val, &tmo_p ); + struct event *apc_event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); + struct futex_wait_block futexes[2]; + + if (__atomic_load_n( &apc_event->signaled, __ATOMIC_SEQ_CST )) + return STATUS_USER_APC; + + futexes[0].addr = addr; + futexes[0].val = val; + futexes[1].addr = &apc_event->signaled; + futexes[1].val = 0; +#if __SIZEOF_POINTER__ == 4 + futexes[0].pad = futexes[1].pad = 0; +#endif + + if (end) + { + LONGLONG timeleft = update_timeout( *end ); + struct timespec tmo_p; + tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; + ret = futex_wait_multiple( futexes, 2, &tmo_p ); + } + else + ret = futex_wait_multiple( futexes, 2, NULL ); + + if (__atomic_load_n( &apc_event->signaled, __ATOMIC_SEQ_CST )) + return STATUS_USER_APC; } else - ret = futex_wait( addr, val, NULL ); + { + if (end) + { + LONGLONG timeleft = update_timeout( *end ); + struct timespec tmo_p; + tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; + ret = futex_wait( addr, val, &tmo_p ); + } + else + ret = futex_wait( addr, val, NULL ); + } if (!ret) return 0; @@ -570,16 +603,30 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end ) static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { - struct futex_wait_block futexes[MAXIMUM_WAIT_OBJECTS]; + static const LARGE_INTEGER zero = {0}; + + struct futex_wait_block futexes[MAXIMUM_WAIT_OBJECTS + 1]; struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; int has_fsync = 0, has_server = 0; BOOL msgwait = FALSE; int dummy_futex = 0; LONGLONG timeleft; LARGE_INTEGER now; + DWORD waitcount; ULONGLONG end; int i, ret; + /* Grab the APC futex if we don't already have it. */ + if (alertable && !ntdll_get_thread_data()->fsync_apc_idx) + { + SERVER_START_REQ( get_fsync_apc_idx ) + { + if (!(ret = wine_server_call( req ))) + ntdll_get_thread_data()->fsync_apc_idx = reply->shm_idx; + } + SERVER_END_REQ; + } + NtQuerySystemTime( &now ); if (timeout) { @@ -618,6 +665,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (msgwait) TRACE(" or driver events"); + if (alertable) + TRACE(", alertable"); if (!timeout) TRACE(", timeout = INFINITE.\n"); @@ -731,6 +780,21 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, #endif } + if (alertable) + { + struct event *event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); + if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + goto userapc; + + futexes[i].addr = &event->signaled; + futexes[i].val = 0; +#if __SIZEOF_POINTER__ == 4 + futexes[i].pad = 0; +#endif + i++; + } + waitcount = i; + /* Looks like everything is contended, so wait. */ if (timeout) @@ -740,10 +804,10 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - ret = futex_wait_multiple( futexes, count, &tmo_p ); + ret = futex_wait_multiple( futexes, waitcount, &tmo_p ); } else - ret = futex_wait_multiple( futexes, count, NULL ); + ret = futex_wait_multiple( futexes, waitcount, NULL ); /* FUTEX_WAIT_MULTIPLE can succeed or return -EINTR, -EAGAIN, * -EFAULT/-EACCES, -ETIMEDOUT. In the first three cases we need to @@ -800,7 +864,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, while ((current = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ))) { - status = do_single_wait( &mutex->tid, current, timeout ? &end : NULL ); + status = do_single_wait( &mutex->tid, current, timeout ? &end : NULL, alertable ); if (status != STATUS_PENDING) break; } @@ -812,7 +876,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, while (!__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) { - status = do_single_wait( &event->signaled, 0, timeout ? &end : NULL ); + status = do_single_wait( &event->signaled, 0, timeout ? &end : NULL, alertable ); if (status != STATUS_PENDING) break; } @@ -823,6 +887,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Wait timed out.\n"); return status; } + else if (status == STATUS_USER_APC) + goto userapc; } /* If we got here and we haven't timed out, that means all of the @@ -931,6 +997,21 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } } /* while (1) */ } /* else (wait-all) */ + + assert(0); /* shouldn't reach here... */ + +userapc: + TRACE("Woken up by user APC.\n"); + + /* We have to make a server call anyway to get the APC to execute, so just + * delegate down to server_wait(). */ + ret = server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, &zero ); + + /* This can happen if we received a system APC, and the APC fd was woken up + * before we got SIGUSR1. poll() doesn't return EINTR in that case. The + * right thing to do seems to be to return STATUS_USER_APC anyway. */ + if (ret == STATUS_TIMEOUT) ret = STATUS_USER_APC; + return ret; } /* Like esync, we need to let the server know when we are doing a message wait, diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 48bb596df99..0cef1f0d428 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -94,6 +94,7 @@ struct ntdll_thread_data void *cpu_data[16]; /* reserved for CPU-specific data */ void *kernel_stack; /* stack for thread startup and kernel syscalls */ int esync_apc_fd; /* fd to wait on for user APCs */ + unsigned int fsync_apc_idx; int request_fd; /* fd for sending server requests */ int reply_fd; /* fd for receiving server replies */ int wait_fd[2]; /* fd for sleeping server requests */ diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 2309f936f66..5bcfe79dcd6 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3708,6 +3708,7 @@ static TEB *init_teb( void *ptr, BOOL is_wow ) teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer); thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; thread_data->esync_apc_fd = -1; + thread_data->fsync_apc_idx = 0; thread_data->request_fd = -1; thread_data->reply_fd = -1; thread_data->wait_fd[0] = -1; diff --git a/server/fsync.c b/server/fsync.c index 73d1873759b..10d8eb74bc3 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -316,31 +316,35 @@ struct fsync_event int unused; }; +void fsync_wake_futex( unsigned int shm_idx ) +{ + struct fsync_event *event = get_shm( shm_idx ); + + if (!__atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST )) + futex_wake( &event->signaled, INT_MAX ); +} + void fsync_wake_up( struct object *obj ) { - struct fsync_event *event; enum fsync_type type; if (obj->ops->get_fsync_idx) - { - event = get_shm( obj->ops->get_fsync_idx( obj, &type ) ); + fsync_wake_futex( obj->ops->get_fsync_idx( obj, &type ) ); +} - if (!__atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST )) - futex_wake( &event->signaled, INT_MAX ); - } +void fsync_clear_futex( unsigned int shm_idx ) +{ + struct fsync_event *event = get_shm( shm_idx ); + + __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); } void fsync_clear( struct object *obj ) { - struct fsync_event *event; enum fsync_type type; if (obj->ops->get_fsync_idx) - { - event = get_shm( obj->ops->get_fsync_idx( obj, &type ) ); - - __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); - } + fsync_clear_futex( obj->ops->get_fsync_idx( obj, &type ) ); } void fsync_set_event( struct fsync *fsync ) @@ -447,3 +451,8 @@ DECL_HANDLER(get_fsync_idx) release_object( obj ); } + +DECL_HANDLER(get_fsync_apc_idx) +{ + reply->shm_idx = current->fsync_apc_idx; +} diff --git a/server/fsync.h b/server/fsync.h index 087d482717b..f6f1a48b31e 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -21,6 +21,8 @@ extern int do_fsync(void); extern void fsync_init(void); extern unsigned int fsync_alloc_shm( int low, int high ); +extern void fsync_wake_futex( unsigned int shm_idx ); +extern void fsync_clear_futex( unsigned int shm_idx ); extern void fsync_wake_up( struct object *obj ); extern void fsync_clear( struct object *obj ); diff --git a/server/protocol.def b/server/protocol.def index 64734fa0457..916d0b2e2d4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -4039,3 +4039,8 @@ enum fsync_type @REQ(fsync_msgwait) int in_msgwait; /* are we in a message wait? */ @END + +@REQ(get_fsync_apc_idx) +@REPLY + unsigned int shm_idx; +@END diff --git a/server/thread.c b/server/thread.c index 0ca74e6a7ab..4aaab7c6f54 100644 --- a/server/thread.c +++ b/server/thread.c @@ -484,7 +484,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu } if (do_fsync()) + { thread->fsync_idx = fsync_alloc_shm( 0, 0 ); + thread->fsync_apc_idx = fsync_alloc_shm( 0, 0 ); + } if (do_esync()) { @@ -661,6 +664,7 @@ static struct thread_apc *create_apc( struct object *owner, const apc_call_t *ca apc->result.type = APC_NONE; if (owner) grab_object( owner ); } + return apc; } @@ -1347,6 +1351,9 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr { wake_thread( thread ); + if (do_fsync() && queue == &thread->user_apc) + fsync_wake_futex( thread->fsync_apc_idx ); + if (do_esync() && queue == &thread->user_apc) esync_wake_fd( thread->esync_apc_fd ); } @@ -1397,6 +1404,9 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system list_remove( ptr ); } + if (do_fsync() && list_empty( &thread->system_apc ) && list_empty( &thread->user_apc )) + fsync_clear_futex( thread->fsync_apc_idx ); + if (do_esync() && list_empty( &thread->system_apc ) && list_empty( &thread->user_apc )) esync_clear( thread->esync_apc_fd ); diff --git a/server/thread.h b/server/thread.h index ec271f5cab4..041eb000171 100644 --- a/server/thread.h +++ b/server/thread.h @@ -57,6 +57,7 @@ struct thread int esync_fd; /* esync file descriptor (signalled on exit) */ int esync_apc_fd; /* esync apc fd (signalled when APCs are present) */ unsigned int fsync_idx; + unsigned int fsync_apc_idx; unsigned int system_regs; /* which system regs have been set */ struct msg_queue *queue; /* message queue */ struct thread_wait *wait; /* current wait condition if sleeping */ From 45ff80baf4aec0ffa3626cfe8b137fdca01c47b1 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 10:45:10 -0600 Subject: [PATCH 0517/1506] ntdll: Wake all threads in futex_wake(). Because wait-all exists, this unfortunately seems necessary. --- dlls/ntdll/unix/fsync.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 9518f1f0960..690898f7eac 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -426,8 +426,7 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) if (prev) *prev = current; - if (!current) - futex_wake( &semaphore->count, count ); + futex_wake( &semaphore->count, INT_MAX ); return STATUS_SUCCESS; } @@ -465,7 +464,7 @@ NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) event = obj->shm; if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) - futex_wake( &event->signaled, obj->type == FSYNC_AUTO_EVENT ? 1 : INT_MAX ); + futex_wake( &event->signaled, INT_MAX ); if (prev) *prev = current; @@ -527,7 +526,7 @@ NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) if (!--mutex->count) { __atomic_store_n( &mutex->tid, 0, __ATOMIC_SEQ_CST ); - futex_wake( &mutex->tid, 1 ); + futex_wake( &mutex->tid, INT_MAX ); } return STATUS_SUCCESS; From 80839a14ece945a6e5f69407a18333389a379e60 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 11:02:28 -0600 Subject: [PATCH 0518/1506] server: Create futex sections for timer objects. --- dlls/ntdll/unix/fsync.c | 3 +++ server/protocol.def | 1 + server/timer.c | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 690898f7eac..f2ae70ee1ab 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -734,6 +734,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, break; } case FSYNC_AUTO_EVENT: + case FSYNC_AUTO_SERVER: { struct event *event = obj->shm; @@ -938,6 +939,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, break; } case FSYNC_AUTO_EVENT: + case FSYNC_AUTO_SERVER: { struct event *event = obj->shm; if (!__sync_val_compare_and_swap( &event->signaled, 1, 0 )) @@ -984,6 +986,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, break; } case FSYNC_AUTO_EVENT: + case FSYNC_AUTO_SERVER: { struct event *event = obj->shm; __atomic_store_n( &event->signaled, 1, __ATOMIC_SEQ_CST ); diff --git a/server/protocol.def b/server/protocol.def index 916d0b2e2d4..2d91baf245a 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3998,6 +3998,7 @@ enum fsync_type FSYNC_AUTO_EVENT, FSYNC_MANUAL_EVENT, FSYNC_MUTEX, + FSYNC_AUTO_SERVER, FSYNC_MANUAL_SERVER, FSYNC_QUEUE, }; diff --git a/server/timer.c b/server/timer.c index 9ec9604aa0e..afc12ff03ad 100644 --- a/server/timer.c +++ b/server/timer.c @@ -36,6 +36,7 @@ #include "handle.h" #include "request.h" #include "esync.h" +#include "fsync.h" static const WCHAR timer_name[] = {'T','i','m','e','r'}; @@ -63,11 +64,13 @@ struct timer client_ptr_t callback; /* callback APC function */ client_ptr_t arg; /* callback argument */ int esync_fd; /* esync file descriptor */ + unsigned int fsync_idx; /* fsync shm index */ }; static void timer_dump( struct object *obj, int verbose ); static int timer_signaled( struct object *obj, struct wait_queue_entry *entry ); static int timer_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int timer_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry ); static void timer_destroy( struct object *obj ); @@ -80,7 +83,7 @@ static const struct object_ops timer_ops = remove_queue, /* remove_queue */ timer_signaled, /* signaled */ timer_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + timer_get_fsync_idx, /* get_fsync_idx */ timer_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -117,6 +120,9 @@ static struct timer *create_timer( struct object *root, const struct unicode_str timer->thread = NULL; timer->esync_fd = -1; + if (do_fsync()) + timer->fsync_idx = fsync_alloc_shm( 0, 0 ); + if (do_esync()) timer->esync_fd = esync_create_fd( 0, 0 ); } @@ -191,6 +197,9 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period period = 0; /* period doesn't make any sense for a manual timer */ timer->signaled = 0; + if (do_fsync()) + fsync_clear( &timer->obj ); + if (do_esync()) esync_clear( timer->esync_fd ); } @@ -227,6 +236,13 @@ static int timer_get_esync_fd( struct object *obj, enum esync_type *type ) return timer->esync_fd; } +static unsigned int timer_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct timer *timer = (struct timer *)obj; + *type = timer->manual ? FSYNC_MANUAL_SERVER : FSYNC_AUTO_SERVER; + return timer->fsync_idx; +} + static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct timer *timer = (struct timer *)obj; From 412e2c97a72ca36bdc449e3eae97f813591ba25a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 11:07:55 -0600 Subject: [PATCH 0519/1506] server: Create futex sections for console input events objects. --- server/console.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/server/console.c b/server/console.c index 43248d359ca..ca1ab046648 100644 --- a/server/console.c +++ b/server/console.c @@ -42,6 +42,7 @@ #include "winternl.h" #include "wine/condrv.h" #include "esync.h" +#include "fsync.h" struct screen_buffer; @@ -143,12 +144,14 @@ struct console_server int term_fd; /* UNIX terminal fd */ struct termios termios; /* original termios */ int esync_fd; + unsigned int fsync_idx; }; static void console_server_dump( struct object *obj, int verbose ); static void console_server_destroy( struct object *obj ); static int console_server_signaled( struct object *obj, struct wait_queue_entry *entry ); static int console_server_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int console_server_get_fsync_idx( struct object *obj, enum fsync_type *type ); static struct fd *console_server_get_fd( struct object *obj ); static struct object *console_server_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr, struct object *root ); @@ -164,7 +167,7 @@ static const struct object_ops console_server_ops = remove_queue, /* remove_queue */ console_server_signaled, /* signaled */ console_server_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + console_server_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ console_server_get_fd, /* get_fd */ @@ -607,6 +610,8 @@ static void disconnect_console_server( struct console_server *server ) list_remove( &call->entry ); console_host_ioctl_terminate( call, STATUS_CANCELLED ); } + if (do_fsync()) + fsync_clear( &server->obj ); if (do_esync()) esync_clear( server->esync_fd ); while (!list_empty( &server->read_queue )) @@ -940,6 +945,13 @@ static int console_server_get_esync_fd( struct object *obj, enum esync_type *typ return server->esync_fd; } +static unsigned int console_server_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct console_server *server = (struct console_server*)obj; + *type = FSYNC_MANUAL_SERVER; + return server->fsync_idx; +} + static struct fd *console_server_get_fd( struct object* obj ) { struct console_server *server = (struct console_server*)obj; @@ -972,6 +984,10 @@ static struct object *create_console_server( void ) } allow_fd_caching(server->fd); server->esync_fd = -1; + server->fsync_idx = 0; + + if (do_fsync()) + server->fsync_idx = fsync_alloc_shm( 0, 0 ); if (do_esync()) server->esync_fd = esync_create_fd( 0, 0 ); @@ -1588,6 +1604,8 @@ DECL_HANDLER(get_next_console_request) /* set result of previous ioctl */ ioctl = LIST_ENTRY( list_head( &server->queue ), struct console_host_ioctl, entry ); list_remove( &ioctl->entry ); + if (do_fsync() && list_empty( &server->queue )) + fsync_clear( &server->obj ); if (do_esync() && list_empty( &server->queue )) esync_clear( server->esync_fd ); } @@ -1675,6 +1693,8 @@ DECL_HANDLER(get_next_console_request) { set_error( STATUS_PENDING ); } + if (do_fsync() && list_empty( &server->queue )) + fsync_clear( &server->obj ); if (do_esync() && list_empty( &server->queue )) esync_clear( server->esync_fd ); From f80e4109a9ab24e921738f2206dfaa8ab786b9bd Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 11:23:23 -0600 Subject: [PATCH 0520/1506] ntdll: Implement NtQuerySemaphore(). --- dlls/ntdll/unix/fsync.c | 19 +++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index f2ae70ee1ab..fb51a55aed7 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -431,6 +431,25 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ) +{ + struct fsync *obj; + struct semaphore *semaphore; + SEMAPHORE_BASIC_INFORMATION *out = info; + NTSTATUS ret; + + TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); + + if ((ret = get_object( handle, &obj ))) return ret; + semaphore = obj->shm; + + out->CurrentCount = semaphore->count; + out->MaximumCount = semaphore->max; + if (ret_len) *ret_len = sizeof(*out); + + return STATUS_SUCCESS; +} + NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE event_type, BOOLEAN initial ) { diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 0fc2305bd5c..72a36d4517e 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -27,6 +27,7 @@ extern NTSTATUS fsync_create_semaphore(HANDLE *handle, ACCESS_MASK access, extern NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ); extern NTSTATUS fsync_open_semaphore( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); +extern NTSTATUS fsync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS fsync_create_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN initial ); extern NTSTATUS fsync_open_event( HANDLE *handle, ACCESS_MASK access, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 38a5cd5cbb2..cdcb6d8ed79 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -347,6 +347,9 @@ NTSTATUS WINAPI NtQuerySemaphore( HANDLE handle, SEMAPHORE_INFORMATION_CLASS cla if (len != sizeof(SEMAPHORE_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH; + if (do_fsync()) + return fsync_query_semaphore( handle, info, ret_len ); + if (do_esync()) return esync_query_semaphore( handle, info, ret_len ); From ba93d8006d221c81b43baac7170408f7cc09d036 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 20:11:08 -0500 Subject: [PATCH 0521/1506] ntdll: Implement NtQueryEvent(). --- dlls/ntdll/unix/fsync.c | 19 +++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index fb51a55aed7..3cb8cb50d36 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -509,6 +509,25 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_query_event( HANDLE handle, void *info, ULONG *ret_len ) +{ + struct event *event; + struct fsync *obj; + EVENT_BASIC_INFORMATION *out = info; + NTSTATUS ret; + + TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); + + if ((ret = get_object( handle, &obj ))) return ret; + event = obj->shm; + + out->EventState = event->signaled; + out->EventType = (obj->type == FSYNC_AUTO_EVENT ? SynchronizationEvent : NotificationEvent); + if (ret_len) *ret_len = sizeof(*out); + + return STATUS_SUCCESS; +} + NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ) { diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 72a36d4517e..388ae479eed 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -34,6 +34,7 @@ extern NTSTATUS fsync_open_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); +extern NTSTATUS fsync_query_event( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); extern NTSTATUS fsync_open_mutex( HANDLE *handle, ACCESS_MASK access, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index cdcb6d8ed79..355bce64cfd 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -567,6 +567,9 @@ NTSTATUS WINAPI NtQueryEvent( HANDLE handle, EVENT_INFORMATION_CLASS class, if (len != sizeof(EVENT_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH; + if (do_fsync()) + return fsync_query_event( handle, info, ret_len ); + if (do_esync()) return esync_query_event( handle, info, ret_len ); From a8d3d0b34ce2c40e081101ce483a57e531848913 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 11:29:55 -0600 Subject: [PATCH 0522/1506] ntdll: Implement NtQueryMutant(). --- dlls/ntdll/unix/fsync.c | 20 ++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 3cb8cb50d36..522803268dc 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -570,6 +570,26 @@ NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) +{ + struct fsync *obj; + struct mutex *mutex; + MUTANT_BASIC_INFORMATION *out = info; + NTSTATUS ret; + + TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); + + if ((ret = get_object( handle, &obj ))) return ret; + mutex = obj->shm; + + out->CurrentCount = 1 - mutex->count; + out->OwnedByCaller = (mutex->tid == GetCurrentThreadId()); + out->AbandonedState = FALSE; + if (ret_len) *ret_len = sizeof(*out); + + return STATUS_SUCCESS; +} + static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 388ae479eed..fe354b39dad 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -40,6 +40,7 @@ extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, extern NTSTATUS fsync_open_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ); +extern NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 355bce64cfd..6b14b04172f 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -697,6 +697,9 @@ NTSTATUS WINAPI NtQueryMutant( HANDLE handle, MUTANT_INFORMATION_CLASS class, if (len != sizeof(MUTANT_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH; + if (do_fsync()) + return fsync_query_mutex( handle, info, ret_len ); + if (do_esync()) return esync_query_mutex( handle, info, ret_len ); From 84601dcff9bbb67e77b9525e0317c0a5f0bb0996 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 11:35:22 -0600 Subject: [PATCH 0523/1506] server: Create futex sections for pseudo-fd objects and use them for named pipes. --- server/fd.c | 18 ++++++++++++++++++ server/file.h | 1 + server/named_pipe.c | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/server/fd.c b/server/fd.c index acd3789193a..2999e3b7395 100644 --- a/server/fd.c +++ b/server/fd.c @@ -97,6 +97,7 @@ #include "process.h" #include "request.h" #include "esync.h" +#include "fsync.h" #include "winternl.h" #include "winioctl.h" @@ -158,6 +159,7 @@ struct fd apc_param_t comp_key; /* completion key to set in completion events */ unsigned int comp_flags; /* completion flags */ int esync_fd; /* esync file descriptor */ + unsigned int fsync_idx; /* fsync shm index */ }; static void fd_dump( struct object *obj, int verbose ); @@ -1748,8 +1750,12 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use list_init( &fd->inode_entry ); list_init( &fd->locks ); + if (do_fsync()) + fd->fsync_idx = fsync_alloc_shm( 0, 0 ); + if (do_esync()) fd->esync_fd = esync_create_fd( 0, 0 ); + return fd; } @@ -2162,6 +2168,9 @@ void set_fd_signaled( struct fd *fd, int signaled ) fd->signaled = signaled; if (signaled) wake_up( fd->user, 0 ); + if (do_fsync() && !signaled) + fsync_clear( &fd->obj ); + if (do_esync() && !signaled) esync_clear( fd->esync_fd ); } @@ -2198,6 +2207,15 @@ int default_fd_get_esync_fd( struct object *obj, enum esync_type *type ) return ret; } +unsigned int default_fd_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct fd *fd = get_obj_fd( obj ); + unsigned int ret = fd->fsync_idx; + *type = FSYNC_MANUAL_SERVER; + release_object( fd ); + return ret; +} + int default_fd_get_poll_events( struct fd *fd ) { int events = 0; diff --git a/server/file.h b/server/file.h index fadb3436add..0554ef903dc 100644 --- a/server/file.h +++ b/server/file.h @@ -109,6 +109,7 @@ extern void get_nt_name( struct fd *fd, struct unicode_str *name ); extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry ); extern int default_fd_get_esync_fd( struct object *obj, enum esync_type *type ); +extern unsigned int default_fd_get_fsync_idx( struct object *obj, enum fsync_type *type ); extern int default_fd_get_poll_events( struct fd *fd ); extern void default_poll_event( struct fd *fd, int event ); extern void fd_cancel_async( struct fd *fd, struct async *async ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 1a168f0b395..4efa51e2fec 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -170,7 +170,7 @@ static const struct object_ops pipe_server_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ default_fd_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + default_fd_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ @@ -216,7 +216,7 @@ static const struct object_ops pipe_client_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ default_fd_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + default_fd_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ pipe_end_get_fd, /* get_fd */ From f5c817d06cb7dac545a35c790919ef0be3dddfca Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 3 Mar 2019 11:44:00 -0600 Subject: [PATCH 0524/1506] server: Create futex sections for true file objects and use them for directory change notifications. --- server/change.c | 2 +- server/fd.c | 3 +++ server/fsync.c | 13 ++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/change.c b/server/change.c index 8e19fc4bc2b..22cf041ca80 100644 --- a/server/change.c +++ b/server/change.c @@ -113,7 +113,7 @@ static const struct object_ops dir_ops = remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ default_fd_get_esync_fd, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + default_fd_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ dir_get_fd, /* get_fd */ diff --git a/server/fd.c b/server/fd.c index 2999e3b7395..c85d25e9566 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1708,6 +1708,9 @@ static struct fd *alloc_fd_object(void) if (do_esync()) fd->esync_fd = esync_create_fd( 1, 0 ); + if (do_fsync()) + fd->fsync_idx = fsync_alloc_shm( 1, 0 ); + if ((fd->poll_index = add_poll_user( fd )) == -1) { release_object( fd ); diff --git a/server/fsync.c b/server/fsync.c index 10d8eb74bc3..6a67d22d14e 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -85,6 +85,8 @@ static void **shm_addrs; static int shm_addrs_size; /* length of the allocated shm_addrs array */ static long pagesize; +static int is_fsync_initialized; + static void shm_cleanup(void) { close( shm_fd ); @@ -120,6 +122,8 @@ void fsync_init(void) if (ftruncate( shm_fd, shm_size ) == -1) perror( "ftruncate" ); + is_fsync_initialized = 1; + atexit( shm_cleanup ); } @@ -231,9 +235,16 @@ static unsigned int shm_idx_counter = 1; unsigned int fsync_alloc_shm( int low, int high ) { #ifdef __linux__ - int shm_idx = shm_idx_counter++; + int shm_idx; int *shm; + /* this is arguably a bit of a hack, but we need some way to prevent + * allocating shm for the master socket */ + if (!is_fsync_initialized) + return 0; + + shm_idx = shm_idx_counter++; + while (shm_idx * 8 >= shm_size) { /* Better expand the shm section. */ From f4b6716fd72a585a79044d7694f74d6c9164b6a2 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 4 Jun 2019 12:29:31 -0500 Subject: [PATCH 0525/1506] ntdll: Skip zero-length waits. An optimization that avoids a syscall. --- dlls/ntdll/unix/fsync.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 522803268dc..30c996a6329 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -855,7 +855,14 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, /* Looks like everything is contended, so wait. */ - if (timeout) + if (timeout && !timeout->QuadPart) + { + /* Unlike esync, we already know that we've timed out, so we + * can avoid a syscall. */ + TRACE("Wait timed out.\n"); + return STATUS_TIMEOUT; + } + else if (timeout) { LONGLONG timeleft = update_timeout( end ); struct timespec tmo_p; From 4751074016f0b8c514d3d218b56da5679e3fea44 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 13 Jun 2019 12:58:27 -0500 Subject: [PATCH 0526/1506] server: Add a diagnostic message for fsync. --- server/fsync.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/fsync.c b/server/fsync.c index 6a67d22d14e..d4dbd66d22a 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -124,6 +124,8 @@ void fsync_init(void) is_fsync_initialized = 1; + fprintf( stderr, "fsync: up and running.\n" ); + atexit( shm_cleanup ); } From 309c2b741714ef71911cc3a548e09151a662a264 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 13 Jun 2019 12:59:53 -0500 Subject: [PATCH 0527/1506] ntdll, server: Make extra sure that esync is never used if fsync is used. --- dlls/ntdll/unix/esync.c | 3 ++- server/esync.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 6eea9d3afc4..7c39f02da50 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -47,6 +47,7 @@ #include "unix_private.h" #include "esync.h" +#include "fsync.h" WINE_DEFAULT_DEBUG_CHANNEL(esync); @@ -56,7 +57,7 @@ int do_esync(void) static int do_esync_cached = -1; if (do_esync_cached == -1) - do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC")); + do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC")) && !do_fsync(); return do_esync_cached; #else diff --git a/server/esync.c b/server/esync.c index 064bdd61b25..a5164435ed6 100644 --- a/server/esync.c +++ b/server/esync.c @@ -43,6 +43,7 @@ #include "request.h" #include "file.h" #include "esync.h" +#include "fsync.h" int do_esync(void) { @@ -50,7 +51,7 @@ int do_esync(void) static int do_esync_cached = -1; if (do_esync_cached == -1) - do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC")); + do_esync_cached = getenv("WINEESYNC") && atoi(getenv("WINEESYNC")) && !do_fsync(); return do_esync_cached; #else From cdad4e7509affc0e7a098927af730c20a0e85b7d Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 17 Jul 2019 15:29:04 -0500 Subject: [PATCH 0528/1506] ntdll, server: Switch to testing ABI. --- dlls/ntdll/unix/fsync.c | 6 +++++- server/fsync.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 30c996a6329..885633296a4 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -60,13 +60,14 @@ struct futex_wait_block int pad; #endif int val; + int bitset; }; #include "poppack.h" static inline int futex_wait_multiple( const struct futex_wait_block *futexes, int count, const struct timespec *timeout ) { - return syscall( __NR_futex, futexes, 13, count, timeout, 0, 0 ); + return syscall( __NR_futex, futexes, 31, count, timeout, 0, 0 ); } static inline int futex_wake( int *addr, int val ) @@ -620,6 +621,7 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler #if __SIZEOF_POINTER__ == 4 futexes[0].pad = futexes[1].pad = 0; #endif + futexes[0].bitset = futexes[1].bitset = ~0; if (end) { @@ -836,6 +838,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, #if __SIZEOF_POINTER__ == 4 futexes[i].pad = 0; #endif + futexes[i].bitset = ~0; } if (alertable) @@ -849,6 +852,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, #if __SIZEOF_POINTER__ == 4 futexes[i].pad = 0; #endif + futexes[i].bitset = ~0; i++; } waitcount = i; diff --git a/server/fsync.c b/server/fsync.c index d4dbd66d22a..2cb804517dc 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -57,7 +57,7 @@ struct futex_wait_block static inline int futex_wait_multiple( const struct futex_wait_block *futexes, int count, const struct timespec *timeout ) { - return syscall( __NR_futex, futexes, 13, count, timeout, 0, 0 ); + return syscall( __NR_futex, futexes, 31, count, timeout, 0, 0 ); } int do_fsync(void) From 67fc77ef3db69ac3bd5fd1fd70a33a2b1dd545b5 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 23 Jul 2019 17:22:44 -0500 Subject: [PATCH 0529/1506] ntdll: Check the APC futex first. --- dlls/ntdll/unix/fsync.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 885633296a4..92c8bb4b7ef 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -743,6 +743,16 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { /* Try to grab anything. */ + if (alertable) + { + /* We must check this first! The server may set an event that + * we're waiting on, but we need to return STATUS_USER_APC. */ + struct event *event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); + TRACE("...%d\n", __atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )); + if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + goto userapc; + } + for (i = 0; i < count; i++) { struct fsync *obj = objs[i]; @@ -844,9 +854,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (alertable) { struct event *event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); - if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) - goto userapc; - + /* We already checked if it was signaled; don't bother doing it again. */ futexes[i].addr = &event->signaled; futexes[i].val = 0; #if __SIZEOF_POINTER__ == 4 From 3b7574de68d2479c63a13dafc9f45d0d12d39a83 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 24 Jul 2019 14:44:15 -0500 Subject: [PATCH 0530/1506] server: Fix an invalid use of fsync_clear(). The fd object has no get_fsync_idx callback, so this would do nothing. --- server/fd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/fd.c b/server/fd.c index c85d25e9566..a5ab3c4c46c 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2172,7 +2172,7 @@ void set_fd_signaled( struct fd *fd, int signaled ) if (signaled) wake_up( fd->user, 0 ); if (do_fsync() && !signaled) - fsync_clear( &fd->obj ); + fsync_clear( fd->user ); if (do_esync() && !signaled) esync_clear( fd->esync_fd ); From 04f32708472f50717053efe5cb44d7750c203aae Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 24 Jul 2019 14:45:24 -0500 Subject: [PATCH 0531/1506] server: Be a little more careful about futex operations. --- server/fd.c | 2 ++ server/fsync.c | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/server/fd.c b/server/fd.c index a5ab3c4c46c..99b55e863dd 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1699,6 +1699,7 @@ static struct fd *alloc_fd_object(void) fd->completion = NULL; fd->comp_flags = 0; fd->esync_fd = -1; + fd->fsync_idx = 0; init_async_queue( &fd->read_q ); init_async_queue( &fd->write_q ); init_async_queue( &fd->wait_q ); @@ -1747,6 +1748,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use fd->comp_flags = 0; fd->no_fd_status = STATUS_BAD_DEVICE_TYPE; fd->esync_fd = -1; + fd->fsync_idx = 0; init_async_queue( &fd->read_q ); init_async_queue( &fd->write_q ); init_async_queue( &fd->wait_q ); diff --git a/server/fsync.c b/server/fsync.c index 2cb804517dc..ca57d7f9cb8 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -331,8 +331,15 @@ struct fsync_event void fsync_wake_futex( unsigned int shm_idx ) { - struct fsync_event *event = get_shm( shm_idx ); + struct fsync_event *event; + if (debug_level) + fprintf( stderr, "fsync_wake_futex: index %u\n", shm_idx ); + + if (!shm_idx) + return; + + event = get_shm( shm_idx ); if (!__atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST )) futex_wake( &event->signaled, INT_MAX ); } @@ -341,14 +348,24 @@ void fsync_wake_up( struct object *obj ) { enum fsync_type type; + if (debug_level) + fprintf( stderr, "fsync_wake_up: object %p\n", obj ); + if (obj->ops->get_fsync_idx) fsync_wake_futex( obj->ops->get_fsync_idx( obj, &type ) ); } void fsync_clear_futex( unsigned int shm_idx ) { - struct fsync_event *event = get_shm( shm_idx ); + struct fsync_event *event; + if (debug_level) + fprintf( stderr, "fsync_clear_futex: index %u\n", shm_idx ); + + if (!shm_idx) + return; + + event = get_shm( shm_idx ); __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); } @@ -356,6 +373,9 @@ void fsync_clear( struct object *obj ) { enum fsync_type type; + if (debug_level) + fprintf( stderr, "fsync_clear: object %p\n", obj ); + if (obj->ops->get_fsync_idx) fsync_clear_futex( obj->ops->get_fsync_idx( obj, &type ) ); } From acb2dc4d0745f06c1afabae9ef893b988c5eabd7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 24 Jul 2019 15:02:01 -0500 Subject: [PATCH 0532/1506] ntdll: Catch closed handles more gracefully. --- dlls/ntdll/unix/fsync.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 92c8bb4b7ef..af0d688b85c 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -759,6 +759,13 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (obj) { + if (!obj->type) /* gcc complains if we put this in the switch */ + { + /* Someone probably closed an object while waiting on it. */ + WARN("Handle %p has type 0; was it closed?\n", handles[i]); + return STATUS_INVALID_HANDLE; + } + switch (obj->type) { case FSYNC_SEMAPHORE: @@ -835,6 +842,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, break; } default: + ERR("Invalid type %#x for handle %p.\n", obj->type, handles[i]); assert(0); } } From b7b8e5686dcb535b5667b4ad292ade24764dff70 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 24 Jul 2019 15:04:08 -0500 Subject: [PATCH 0533/1506] ntdll: Implement fsync_pulse_event(). --- dlls/ntdll/unix/fsync.c | 29 +++++++++++++++++++++++++++++ dlls/ntdll/unix/fsync.h | 1 + dlls/ntdll/unix/sync.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index af0d688b85c..feb5fc17100 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -510,6 +510,35 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) return STATUS_SUCCESS; } +NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ) +{ + struct event *event; + struct fsync *obj; + LONG current; + NTSTATUS ret; + + TRACE("%p.\n", handle); + + if ((ret = get_object( handle, &obj ))) return ret; + event = obj->shm; + + /* This isn't really correct; an application could miss the write. + * Unfortunately we can't really do much better. Fortunately this is rarely + * used (and publicly deprecated). */ + if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) + futex_wake( &event->signaled, INT_MAX ); + + /* Try to give other threads a chance to wake up. Hopefully erring on this + * side is the better thing to do... */ + NtYieldExecution(); + + __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); + + if (prev) *prev = current; + + return STATUS_SUCCESS; +} + NTSTATUS fsync_query_event( HANDLE handle, void *info, ULONG *ret_len ) { struct event *event; diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index fe354b39dad..763e7891ab8 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -34,6 +34,7 @@ extern NTSTATUS fsync_open_event( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); extern NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ); +extern NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ); extern NTSTATUS fsync_query_event( HANDLE handle, void *info, ULONG *ret_len ); extern NTSTATUS fsync_create_mutex( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 6b14b04172f..565c90bac23 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -533,6 +533,9 @@ NTSTATUS WINAPI NtPulseEvent( HANDLE handle, LONG *prev_state ) { unsigned int ret; + if (do_fsync()) + return fsync_pulse_event( handle, prev_state ); + if (do_esync()) return esync_pulse_event( handle ); From 70af8770cd425bd8be5f2ddadde6774bfd3cb3e8 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 31 Jul 2019 12:18:37 -0500 Subject: [PATCH 0534/1506] server: Print a message when using server-side synchronization. --- server/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/main.c b/server/main.c index 457b044a36a..9559ad83584 100644 --- a/server/main.c +++ b/server/main.c @@ -237,6 +237,9 @@ int main( int argc, char *argv[] ) if (do_esync()) esync_init(); + if (!do_fsync() && !do_esync()) + fprintf( stderr, "wineserver: using server-side synchronization.\n" ); + if (debug_level) fprintf( stderr, "wineserver: starting (pid=%ld)\n", (long) getpid() ); set_current_time(); init_signals(); From ebcf0fac198733d83d27462e05b7d5bbc54043b9 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 7 Aug 2019 17:07:15 -0500 Subject: [PATCH 0535/1506] ntdll: Store the fsync APC futex in the thread data directly. Essentially so we can take get_shm() out of any critical paths. --- dlls/ntdll/unix/fsync.c | 26 +++++++++++++++----------- dlls/ntdll/unix/unix_private.h | 2 +- dlls/ntdll/unix/virtual.c | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index feb5fc17100..bf3581aa0cd 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -637,15 +637,15 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler if (alertable) { - struct event *apc_event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); + int *apc_futex = ntdll_get_thread_data()->fsync_apc_futex; struct futex_wait_block futexes[2]; - if (__atomic_load_n( &apc_event->signaled, __ATOMIC_SEQ_CST )) + if (__atomic_load_n( apc_futex, __ATOMIC_SEQ_CST )) return STATUS_USER_APC; futexes[0].addr = addr; futexes[0].val = val; - futexes[1].addr = &apc_event->signaled; + futexes[1].addr = apc_futex; futexes[1].val = 0; #if __SIZEOF_POINTER__ == 4 futexes[0].pad = futexes[1].pad = 0; @@ -663,7 +663,7 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler else ret = futex_wait_multiple( futexes, 2, NULL ); - if (__atomic_load_n( &apc_event->signaled, __ATOMIC_SEQ_CST )) + if (__atomic_load_n( apc_futex, __ATOMIC_SEQ_CST )) return STATUS_USER_APC; } else @@ -705,14 +705,21 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, int i, ret; /* Grab the APC futex if we don't already have it. */ - if (alertable && !ntdll_get_thread_data()->fsync_apc_idx) + if (alertable && !ntdll_get_thread_data()->fsync_apc_futex) { + unsigned int idx = 0; SERVER_START_REQ( get_fsync_apc_idx ) { if (!(ret = wine_server_call( req ))) - ntdll_get_thread_data()->fsync_apc_idx = reply->shm_idx; + idx = reply->shm_idx; } SERVER_END_REQ; + + if (idx) + { + struct event *apc_event = get_shm( idx ); + ntdll_get_thread_data()->fsync_apc_futex = &apc_event->signaled; + } } NtQuerySystemTime( &now ); @@ -776,9 +783,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { /* We must check this first! The server may set an event that * we're waiting on, but we need to return STATUS_USER_APC. */ - struct event *event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); - TRACE("...%d\n", __atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )); - if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + if (__atomic_load_n( ntdll_get_thread_data()->fsync_apc_futex, __ATOMIC_SEQ_CST )) goto userapc; } @@ -890,9 +895,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (alertable) { - struct event *event = get_shm( ntdll_get_thread_data()->fsync_apc_idx ); /* We already checked if it was signaled; don't bother doing it again. */ - futexes[i].addr = &event->signaled; + futexes[i].addr = ntdll_get_thread_data()->fsync_apc_futex; futexes[i].val = 0; #if __SIZEOF_POINTER__ == 4 futexes[i].pad = 0; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 0cef1f0d428..02b77ad220c 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -94,7 +94,7 @@ struct ntdll_thread_data void *cpu_data[16]; /* reserved for CPU-specific data */ void *kernel_stack; /* stack for thread startup and kernel syscalls */ int esync_apc_fd; /* fd to wait on for user APCs */ - unsigned int fsync_apc_idx; + int *fsync_apc_futex; int request_fd; /* fd for sending server requests */ int reply_fd; /* fd for receiving server replies */ int wait_fd[2]; /* fd for sleeping server requests */ diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 5bcfe79dcd6..a2a342e37a2 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3708,7 +3708,7 @@ static TEB *init_teb( void *ptr, BOOL is_wow ) teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer); thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; thread_data->esync_apc_fd = -1; - thread_data->fsync_apc_idx = 0; + thread_data->fsync_apc_futex = NULL; thread_data->request_fd = -1; thread_data->reply_fd = -1; thread_data->wait_fd[0] = -1; From 8726895ea032921e6ba8b941b6f0dc16e060140c Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 7 Aug 2019 17:14:59 -0500 Subject: [PATCH 0536/1506] ntdll/fsync: Lock accessing the shm_addrs array. --- dlls/ntdll/unix/fsync.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index bf3581aa0cd..b2de9354939 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -134,10 +134,15 @@ static void **shm_addrs; static int shm_addrs_size; /* length of the allocated shm_addrs array */ static long pagesize; +static pthread_mutex_t shm_addrs_mutex = PTHREAD_MUTEX_INITIALIZER; + static void *get_shm( unsigned int idx ) { int entry = (idx * 8) / pagesize; int offset = (idx * 8) % pagesize; + void *ret; + + pthread_mutex_lock( &shm_addrs_mutex ); if (entry >= shm_addrs_size) { @@ -161,7 +166,11 @@ static void *get_shm( unsigned int idx ) munmap( addr, pagesize ); /* someone beat us to it */ } - return (void *)((unsigned long)shm_addrs[entry] + offset); + ret = (void *)((unsigned long)shm_addrs[entry] + offset); + + pthread_mutex_unlock( &shm_addrs_mutex ); + + return ret; } /* We'd like lookup to be fast. To that end, we use a static list indexed by handle. From abf1d8429bbdea0a793e23c02aae4a8d589cdc08 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 8 Aug 2019 17:12:46 -0500 Subject: [PATCH 0537/1506] ntdll/fsync: Fix a race condition when waiting on a mutex. --- dlls/ntdll/unix/fsync.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index b2de9354939..d3d4a3943e7 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -834,6 +834,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, case FSYNC_MUTEX: { struct mutex *mutex = obj->shm; + int tid; if (mutex->tid == GetCurrentThreadId()) { @@ -842,7 +843,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return i; } - if (!__sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() )) + if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() ))) { TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count = 1; @@ -850,7 +851,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } futexes[i].addr = &mutex->tid; - futexes[i].val = mutex->tid; + futexes[i].val = tid; break; } case FSYNC_AUTO_EVENT: From 147c8f0dd4294a3edf5dfe71b03f551ac5b72830 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 19 Aug 2019 18:25:42 -0500 Subject: [PATCH 0538/1506] ntdll/fsync: Introduce a configurable spin count. --- dlls/ntdll/unix/fsync.c | 68 +++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index d3d4a3943e7..2e633c51792 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -64,6 +64,15 @@ struct futex_wait_block }; #include "poppack.h" +static inline void small_pause(void) +{ +#if defined(__i386__) || defined(__x86_64__) + __asm__ __volatile__( "rep;nop" : : : "memory" ); +#else + __asm__ __volatile__( "" : : : "memory" ); +#endif +} + static inline int futex_wait_multiple( const struct futex_wait_block *futexes, int count, const struct timespec *timeout ) { @@ -80,6 +89,8 @@ static inline int futex_wait( int *addr, int val, struct timespec *timeout ) return syscall( __NR_futex, addr, 0, val, timeout, 0, 0 ); } +static unsigned int spincount; + int do_fsync(void) { #ifdef __linux__ @@ -90,6 +101,8 @@ int do_fsync(void) static const struct timespec zero; futex_wait_multiple( NULL, 0, &zero ); do_fsync_cached = getenv("WINEFSYNC") && atoi(getenv("WINEFSYNC")) && errno != ENOSYS; + if (getenv("WINEFSYNC_SPINCOUNT")) + spincount = atoi(getenv("WINEFSYNC_SPINCOUNT")); } return do_fsync_cached; @@ -707,6 +720,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, int has_fsync = 0, has_server = 0; BOOL msgwait = FALSE; int dummy_futex = 0; + unsigned int spin; LONGLONG timeleft; LARGE_INTEGER now; DWORD waitcount; @@ -816,19 +830,23 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct semaphore *semaphore = obj->shm; int current; - do - { - if (!(current = semaphore->count)) break; - } while (__sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) != current); - - if (current) + /* It would be a little clearer (and less error-prone) + * to use a dedicated interlocked_dec_if_nonzero() + * helper, but nesting loops like that is probably not + * great for performance... */ + for (spin = 0; spin <= spincount || current; ++spin) { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - return i; + if ((current = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST )) + && __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) == current) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + small_pause(); } futexes[i].addr = &semaphore->count; - futexes[i].val = current; + futexes[i].val = 0; break; } case FSYNC_MUTEX: @@ -843,11 +861,15 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return i; } - if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() ))) + for (spin = 0; spin <= spincount; ++spin) { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - mutex->count = 1; - return i; + if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() ))) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->count = 1; + return i; + } + small_pause(); } futexes[i].addr = &mutex->tid; @@ -859,10 +881,14 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct event *event = obj->shm; - if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) + for (spin = 0; spin <= spincount; ++spin) { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - return i; + if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + small_pause(); } futexes[i].addr = &event->signaled; @@ -875,10 +901,14 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct event *event = obj->shm; - if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + for (spin = 0; spin <= spincount; ++spin) { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - return i; + if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + return i; + } + small_pause(); } futexes[i].addr = &event->signaled; From 3c8a45c0e3d8e767b1f9b9f0664086c53b367b43 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 17 Feb 2020 11:57:40 -0600 Subject: [PATCH 0539/1506] ntdll, server: Abandon fsync mutexes on thread exit. --- dlls/ntdll/unix/fsync.c | 35 ++++++++++++++++++++++++++++------- server/fsync.c | 33 +++++++++++++++++++++++++++++++++ server/fsync.h | 1 + server/thread.c | 2 ++ 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 2e633c51792..da5245f9e85 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -636,7 +636,7 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) out->CurrentCount = 1 - mutex->count; out->OwnedByCaller = (mutex->tid == GetCurrentThreadId()); - out->AbandonedState = FALSE; + out->AbandonedState = (mutex->tid == ~0); if (ret_len) *ret_len = sizeof(*out); return STATUS_SUCCESS; @@ -869,6 +869,12 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, mutex->count = 1; return i; } + else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, GetCurrentThreadId() )) == ~0) + { + TRACE("Woken up by abandoned mutex %p [%d].\n", handles[i], i); + mutex->count = 1; + return STATUS_ABANDONED_WAIT_0 + i; + } small_pause(); } @@ -1006,7 +1012,11 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, while (1) { + BOOL abandoned; + tryagain: + abandoned = FALSE; + /* First step: try to wait on each object in sequence. */ for (i = 0; i < count; i++) @@ -1058,11 +1068,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (obj && obj->type == FSYNC_MUTEX) { struct mutex *mutex = obj->shm; + int tid = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ); - if (mutex->tid == GetCurrentThreadId()) - continue; /* ok */ - - if (__atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST )) + if (tid && tid != ~0 && tid != GetCurrentThreadId()) goto tryagain; } else if (obj) @@ -1083,10 +1091,15 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, case FSYNC_MUTEX: { struct mutex *mutex = obj->shm; - if (mutex->tid == GetCurrentThreadId()) + int tid = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ); + if (tid == GetCurrentThreadId()) break; - if (__sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() )) + if (tid && tid != ~0) + goto tooslow; + if (__sync_val_compare_and_swap( &mutex->tid, tid, GetCurrentThreadId() ) != tid) goto tooslow; + if (tid == ~0) + abandoned = TRUE; break; } case FSYNC_SEMAPHORE: @@ -1122,6 +1135,11 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } } + if (abandoned) + { + TRACE("Wait successful, but some object(s) were abandoned.\n"); + return STATUS_ABANDONED; + } TRACE("Wait successful.\n"); return STATUS_SUCCESS; @@ -1134,6 +1152,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, case FSYNC_MUTEX: { struct mutex *mutex = obj->shm; + /* HACK: This won't do the right thing with abandoned + * mutexes, but fixing it is probably more trouble than + * it's worth. */ __atomic_store_n( &mutex->tid, 0, __ATOMIC_SEQ_CST ); break; } diff --git a/server/fsync.c b/server/fsync.c index ca57d7f9cb8..3ad59f4735f 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -129,11 +129,14 @@ void fsync_init(void) atexit( shm_cleanup ); } +static struct list mutex_list = LIST_INIT(mutex_list); + struct fsync { struct object obj; unsigned int shm_idx; enum fsync_type type; + struct list mutex_entry; }; static void fsync_dump( struct object *obj, int verbose ); @@ -193,6 +196,9 @@ static unsigned int fsync_map_access( struct object *obj, unsigned int access ) static void fsync_destroy( struct object *obj ) { + struct fsync *fsync = (struct fsync *)obj; + if (fsync->type == FSYNC_MUTEX) + list_remove( &fsync->mutex_entry ); } static void *get_shm( unsigned int idx ) @@ -297,6 +303,8 @@ struct fsync *create_fsync( struct object *root, const struct unicode_str *name, fsync->shm_idx = fsync_alloc_shm( low, high ); fsync->type = type; + if (type == FSYNC_MUTEX) + list_add_tail( &mutex_list, &fsync->mutex_entry ); } else { @@ -397,6 +405,31 @@ void fsync_reset_event( struct fsync *fsync ) __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); } +struct mutex +{ + int tid; + int count; /* recursion count */ +}; + +void fsync_abandon_mutexes( struct thread *thread ) +{ + struct fsync *fsync; + + LIST_FOR_EACH_ENTRY( fsync, &mutex_list, struct fsync, mutex_entry ) + { + struct mutex *mutex = get_shm( fsync->shm_idx ); + + if (mutex->tid == thread->id) + { + if (debug_level) + fprintf( stderr, "fsync_abandon_mutexes() idx=%d\n", fsync->shm_idx ); + mutex->tid = ~0; + mutex->count = 0; + futex_wake( &mutex->tid, INT_MAX ); + } + } +} + DECL_HANDLER(create_fsync) { struct fsync *fsync; diff --git a/server/fsync.h b/server/fsync.h index f6f1a48b31e..a91939b7f0a 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -31,3 +31,4 @@ struct fsync; extern const struct object_ops fsync_ops; extern void fsync_set_event( struct fsync *fsync ); extern void fsync_reset_event( struct fsync *fsync ); +extern void fsync_abandon_mutexes( struct thread *thread ); diff --git a/server/thread.c b/server/thread.c index 4aaab7c6f54..3f246f128bf 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1505,6 +1505,8 @@ void kill_thread( struct thread *thread, int violent_death ) } kill_console_processes( thread, 0 ); abandon_mutexes( thread ); + if (do_fsync()) + fsync_abandon_mutexes( thread ); if (do_esync()) esync_abandon_mutexes( thread ); wake_up( &thread->obj, 0 ); From 3ed94a67cf5626372e4732b5d58faa8245c15916 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 18 Mar 2020 20:03:42 -0500 Subject: [PATCH 0540/1506] ntdll: Default the spin count to 100. --- dlls/ntdll/unix/fsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index da5245f9e85..c28b4e27597 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -89,7 +89,7 @@ static inline int futex_wait( int *addr, int val, struct timespec *timeout ) return syscall( __NR_futex, addr, 0, val, timeout, 0, 0 ); } -static unsigned int spincount; +static unsigned int spincount = 100; int do_fsync(void) { From 101bee08d73e9c24077c57c07f5f1865f063cfd3 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 13 Mar 2020 15:52:15 -0500 Subject: [PATCH 0541/1506] ntdll: Implement an esync/fsync path for alertable NtDelayExecution(). --- dlls/ntdll/unix/esync.c | 4 ++-- dlls/ntdll/unix/fsync.c | 6 +++--- dlls/ntdll/unix/sync.c | 19 ++++++++++++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 7c39f02da50..823e78eaf5a 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -858,7 +858,7 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA return ret; } - if (objs[count - 1] && objs[count - 1]->type == ESYNC_QUEUE) + if (count && objs[count - 1] && objs[count - 1]->type == ESYNC_QUEUE) msgwait = TRUE; if (has_esync && has_server) @@ -887,7 +887,7 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA } } - if (wait_any || count == 1) + if (wait_any || count <= 1) { /* Try to check objects now, so we can obviate poll() at least. */ for (i = 0; i < count; i++) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c28b4e27597..f419e4b826d 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -767,7 +767,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return ret; } - if (objs[count - 1] && objs[count - 1]->type == FSYNC_QUEUE) + if (count && objs[count - 1] && objs[count - 1]->type == FSYNC_QUEUE) msgwait = TRUE; if (has_fsync && has_server) @@ -796,7 +796,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } } - if (wait_any || count == 1) + if (wait_any || count <= 1) { while (1) { @@ -1223,7 +1223,7 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an struct fsync *obj; NTSTATUS ret; - if (!get_object( handles[count - 1], &obj ) && obj->type == FSYNC_QUEUE) + if (count && !get_object( handles[count - 1], &obj ) && obj->type == FSYNC_QUEUE) { msgwait = TRUE; server_set_msgwait( 1 ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 565c90bac23..388eb2508d9 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1639,7 +1639,24 @@ NTSTATUS WINAPI NtYieldExecution(void) NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeout ) { /* if alertable, we need to query the server */ - if (alertable) return server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, timeout ); + if (alertable) + { + if (do_fsync()) + { + NTSTATUS ret = fsync_wait_objects( 0, NULL, TRUE, TRUE, timeout ); + if (ret != STATUS_NOT_IMPLEMENTED) + return ret; + } + + if (do_esync()) + { + NTSTATUS ret = esync_wait_objects( 0, NULL, TRUE, TRUE, timeout ); + if (ret != STATUS_NOT_IMPLEMENTED) + return ret; + } + + return server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, timeout ); + } if (!timeout || timeout->QuadPart == TIMEOUT_INFINITE) /* sleep forever */ { From ea33f2c40f333dc92f12963c98e82fe9c212cf08 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 25 Jun 2021 23:17:43 +0300 Subject: [PATCH 0542/1506] esync, fsync: Use usleep(0) instead of NtYieldExecution() in esync_pulse_event(). For Mafia III: Definitive Edition when FPS limit is set. CW-Bug-Id: #19024 --- dlls/ntdll/unix/esync.c | 2 +- dlls/ntdll/unix/fsync.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 823e78eaf5a..159d25349dc 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -616,7 +616,7 @@ NTSTATUS esync_pulse_event( HANDLE handle ) /* Try to give other threads a chance to wake up. Hopefully erring on this * side is the better thing to do... */ - NtYieldExecution(); + usleep(0); read( obj->fd, &value, sizeof(value) ); diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index f419e4b826d..2ee7a1d2cb9 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -552,7 +552,7 @@ NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ) /* Try to give other threads a chance to wake up. Hopefully erring on this * side is the better thing to do... */ - NtYieldExecution(); + usleep(0); __atomic_store_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); From 739f2c30e002274c25547d7c9f4e782ea5853a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= Date: Fri, 27 Nov 2020 14:05:14 -0300 Subject: [PATCH 0543/1506] ntdll: Call waitv just when nr_futexes > 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit futex_waitv() needs to do an extra copy from userspace compared to futex(), so use the latter when we are waiting in a single futex. Signed-off-by: André Almeida Link: https://github.com/ValveSoftware/wine/pull/128 --- dlls/ntdll/unix/fsync.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 2ee7a1d2cb9..54e45d6471a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -968,10 +968,18 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - ret = futex_wait_multiple( futexes, waitcount, &tmo_p ); + if (waitcount == 1) + ret = futex_wait( futexes[0].addr, futexes[0].val, &tmo_p ); + else + ret = futex_wait_multiple( futexes, waitcount, &tmo_p ); } else - ret = futex_wait_multiple( futexes, waitcount, NULL ); + { + if (waitcount == 1) + ret = futex_wait( futexes[0].addr, futexes[0].val, NULL ); + else + ret = futex_wait_multiple( futexes, waitcount, NULL ); + } /* FUTEX_WAIT_MULTIPLE can succeed or return -EINTR, -EAGAIN, * -EFAULT/-EACCES, -ETIMEDOUT. In the first three cases we need to From 047de7b795e5a9a73f83ca72ba0bb959ccef9423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= Date: Wed, 20 Oct 2021 10:35:58 -0300 Subject: [PATCH 0544/1506] ntdll/fsync: Encapsulate timeout conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify the wait path by dealing with the timeout conversion inside of futex_wait. Signed-off-by: André Almeida Link: https://github.com/ValveSoftware/wine/pull/128 --- dlls/ntdll/unix/fsync.c | 94 ++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 54e45d6471a..9d09bd1555a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -73,10 +73,32 @@ static inline void small_pause(void) #endif } +static LONGLONG update_timeout( ULONGLONG end ) +{ + LARGE_INTEGER now; + LONGLONG timeleft; + + NtQuerySystemTime( &now ); + timeleft = end - now.QuadPart; + if (timeleft < 0) timeleft = 0; + return timeleft; +} + static inline int futex_wait_multiple( const struct futex_wait_block *futexes, - int count, const struct timespec *timeout ) + int count, const ULONGLONG *end ) { - return syscall( __NR_futex, futexes, 31, count, timeout, 0, 0 ); + if (end) + { + LONGLONG timeleft = update_timeout( *end ); + struct timespec timeout; + timeout.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + timeout.tv_nsec = (timeleft % TICKSPERSEC) * 100; + return syscall( __NR_futex, futexes, 31, count, timeout, 0, 0 ); + } + else + { + return syscall( __NR_futex, futexes, 31, count, NULL, 0, 0 ); + } } static inline int futex_wake( int *addr, int val ) @@ -84,9 +106,20 @@ static inline int futex_wake( int *addr, int val ) return syscall( __NR_futex, addr, 1, val, NULL, 0, 0 ); } -static inline int futex_wait( int *addr, int val, struct timespec *timeout ) +static inline int futex_wait( int *addr, int val, const ULONGLONG *end ) { - return syscall( __NR_futex, addr, 0, val, timeout, 0, 0 ); + if (end) + { + LONGLONG timeleft = update_timeout( *end ); + struct timespec timeout; + timeout.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + timeout.tv_nsec = (timeleft % TICKSPERSEC) * 100; + return syscall( __NR_futex, addr, 0, val, &timeout, 0, 0 ); + } + else + { + return syscall( __NR_futex, addr, 0, val, NULL, 0, 0 ); + } } static unsigned int spincount = 100; @@ -642,17 +675,6 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) return STATUS_SUCCESS; } -static LONGLONG update_timeout( ULONGLONG end ) -{ - LARGE_INTEGER now; - LONGLONG timeleft; - - NtQuerySystemTime( &now ); - timeleft = end - now.QuadPart; - if (timeleft < 0) timeleft = 0; - return timeleft; -} - static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN alertable ) { int ret; @@ -674,32 +696,14 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler #endif futexes[0].bitset = futexes[1].bitset = ~0; - if (end) - { - LONGLONG timeleft = update_timeout( *end ); - struct timespec tmo_p; - tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - ret = futex_wait_multiple( futexes, 2, &tmo_p ); - } - else - ret = futex_wait_multiple( futexes, 2, NULL ); + ret = futex_wait_multiple( futexes, 2, end ); if (__atomic_load_n( apc_futex, __ATOMIC_SEQ_CST )) return STATUS_USER_APC; } else { - if (end) - { - LONGLONG timeleft = update_timeout( *end ); - struct timespec tmo_p; - tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - ret = futex_wait( addr, val, &tmo_p ); - } - else - ret = futex_wait( addr, val, NULL ); + ret = futex_wait( addr, val, end ); } if (!ret) @@ -961,25 +965,11 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Wait timed out.\n"); return STATUS_TIMEOUT; } - else if (timeout) - { - LONGLONG timeleft = update_timeout( end ); - struct timespec tmo_p; - tmo_p.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - tmo_p.tv_nsec = (timeleft % TICKSPERSEC) * 100; - if (waitcount == 1) - ret = futex_wait( futexes[0].addr, futexes[0].val, &tmo_p ); - else - ret = futex_wait_multiple( futexes, waitcount, &tmo_p ); - } + if (waitcount == 1) + ret = futex_wait( futexes[0].addr, futexes[0].val, timeout ? &end : NULL ); else - { - if (waitcount == 1) - ret = futex_wait( futexes[0].addr, futexes[0].val, NULL ); - else - ret = futex_wait_multiple( futexes, waitcount, NULL ); - } + ret = futex_wait_multiple( futexes, waitcount, timeout ? &end : NULL ); /* FUTEX_WAIT_MULTIPLE can succeed or return -EINTR, -EAGAIN, * -EFAULT/-EACCES, -ETIMEDOUT. In the first three cases we need to From 6887e2c14b6d549d407827e01a8ca96ec06a1311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= Date: Thu, 21 Oct 2021 13:36:14 -0300 Subject: [PATCH 0545/1506] ntdll/fsync: Support futex_waitv() API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since an interface for wait on multiple futexes was merged, we no longer need to support different interfaces. Drop out FUTEX_WAIT_MULTIPLE (opcode 31) in favor of the futex_waitv() interface accepted by upstream Linux. Signed-off-by: André Almeida Link: https://github.com/ValveSoftware/wine/pull/128 --- dlls/ntdll/unix/fsync.c | 101 ++++++++++++++++++++-------------------- server/fsync.c | 19 ++------ 2 files changed, 55 insertions(+), 65 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 9d09bd1555a..c72c4be6774 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -39,6 +39,7 @@ # include #endif #include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -53,16 +54,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsync); #include "pshpack4.h" -struct futex_wait_block -{ - int *addr; -#if __SIZEOF_POINTER__ == 4 - int pad; +#include "poppack.h" + +/* futex_waitv interface */ + +#ifndef __NR_futex_waitv + +# define __NR_futex_waitv 449 +# define FUTEX_32 2 +struct futex_waitv { + uint64_t val; + uint64_t uaddr; + uint32_t flags; + uint32_t __reserved; +}; + #endif - int val; - int bitset; + +#define u64_to_ptr(x) (void *)(uintptr_t)(x) + +struct timespec64 +{ + long long tv_sec; + long long tv_nsec; }; -#include "poppack.h" static inline void small_pause(void) { @@ -84,20 +99,29 @@ static LONGLONG update_timeout( ULONGLONG end ) return timeleft; } -static inline int futex_wait_multiple( const struct futex_wait_block *futexes, +static inline void futex_vector_set( struct futex_waitv *waitv, int *addr, int val ) +{ + waitv->uaddr = (uintptr_t) addr; + waitv->val = val; + waitv->flags = FUTEX_32; + waitv->__reserved = 0; +} + +static inline int futex_wait_multiple( const struct futex_waitv *futexes, int count, const ULONGLONG *end ) { if (end) { - LONGLONG timeleft = update_timeout( *end ); - struct timespec timeout; - timeout.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - timeout.tv_nsec = (timeleft % TICKSPERSEC) * 100; - return syscall( __NR_futex, futexes, 31, count, timeout, 0, 0 ); + struct timespec64 timeout; + ULONGLONG tmp = *end - SECS_1601_TO_1970 * TICKSPERSEC; + timeout.tv_sec = tmp / (ULONGLONG)TICKSPERSEC; + timeout.tv_nsec = (tmp % TICKSPERSEC) * 100; + + return syscall( __NR_futex_waitv, futexes, count, 0, &timeout, CLOCK_REALTIME ); } else { - return syscall( __NR_futex, futexes, 31, count, NULL, 0, 0 ); + return syscall( __NR_futex_waitv, futexes, count, 0, NULL, 0 ); } } @@ -131,8 +155,7 @@ int do_fsync(void) if (do_fsync_cached == -1) { - static const struct timespec zero; - futex_wait_multiple( NULL, 0, &zero ); + syscall( __NR_futex_waitv, NULL, 0, 0, NULL, 0 ); do_fsync_cached = getenv("WINEFSYNC") && atoi(getenv("WINEFSYNC")) && errno != ENOSYS; if (getenv("WINEFSYNC_SPINCOUNT")) spincount = atoi(getenv("WINEFSYNC_SPINCOUNT")); @@ -682,19 +705,13 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler if (alertable) { int *apc_futex = ntdll_get_thread_data()->fsync_apc_futex; - struct futex_wait_block futexes[2]; + struct futex_waitv futexes[2]; if (__atomic_load_n( apc_futex, __ATOMIC_SEQ_CST )) return STATUS_USER_APC; - futexes[0].addr = addr; - futexes[0].val = val; - futexes[1].addr = apc_futex; - futexes[1].val = 0; -#if __SIZEOF_POINTER__ == 4 - futexes[0].pad = futexes[1].pad = 0; -#endif - futexes[0].bitset = futexes[1].bitset = ~0; + futex_vector_set( &futexes[0], addr, val ); + futex_vector_set( &futexes[1], apc_futex, 0 ); ret = futex_wait_multiple( futexes, 2, end ); @@ -719,7 +736,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { static const LARGE_INTEGER zero = {0}; - struct futex_wait_block futexes[MAXIMUM_WAIT_OBJECTS + 1]; + struct futex_waitv futexes[MAXIMUM_WAIT_OBJECTS + 1]; struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; int has_fsync = 0, has_server = 0; BOOL msgwait = FALSE; @@ -849,8 +866,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, small_pause(); } - futexes[i].addr = &semaphore->count; - futexes[i].val = 0; + futex_vector_set( &futexes[i], &semaphore->count, 0 ); break; } case FSYNC_MUTEX: @@ -882,8 +898,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, small_pause(); } - futexes[i].addr = &mutex->tid; - futexes[i].val = tid; + futex_vector_set( &futexes[i], &mutex->tid, tid ); break; } case FSYNC_AUTO_EVENT: @@ -901,8 +916,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, small_pause(); } - futexes[i].addr = &event->signaled; - futexes[i].val = 0; + futex_vector_set( &futexes[i], &event->signaled, 0 ); break; } case FSYNC_MANUAL_EVENT: @@ -921,8 +935,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, small_pause(); } - futexes[i].addr = &event->signaled; - futexes[i].val = 0; + futex_vector_set( &futexes[i], &event->signaled, 0 ); break; } default: @@ -933,26 +946,14 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, else { /* Avoid breaking things entirely. */ - futexes[i].addr = &dummy_futex; - futexes[i].val = dummy_futex; + futex_vector_set( &futexes[i], &dummy_futex, dummy_futex ); } - -#if __SIZEOF_POINTER__ == 4 - futexes[i].pad = 0; -#endif - futexes[i].bitset = ~0; } if (alertable) { /* We already checked if it was signaled; don't bother doing it again. */ - futexes[i].addr = ntdll_get_thread_data()->fsync_apc_futex; - futexes[i].val = 0; -#if __SIZEOF_POINTER__ == 4 - futexes[i].pad = 0; -#endif - futexes[i].bitset = ~0; - i++; + futex_vector_set( &futexes[i++], ntdll_get_thread_data()->fsync_apc_futex, 0 ); } waitcount = i; @@ -967,7 +968,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } if (waitcount == 1) - ret = futex_wait( futexes[0].addr, futexes[0].val, timeout ? &end : NULL ); + ret = futex_wait( u64_to_ptr(futexes[0].uaddr), futexes[0].val, timeout ? &end : NULL ); else ret = futex_wait_multiple( futexes, waitcount, timeout ? &end : NULL ); diff --git a/server/fsync.c b/server/fsync.c index 3ad59f4735f..593070ad62e 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -44,21 +44,11 @@ #include "fsync.h" #include "pshpack4.h" -struct futex_wait_block -{ - int *addr; -#if __SIZEOF_POINTER__ == 4 - int pad; -#endif - int val; -}; #include "poppack.h" -static inline int futex_wait_multiple( const struct futex_wait_block *futexes, - int count, const struct timespec *timeout ) -{ - return syscall( __NR_futex, futexes, 31, count, timeout, 0, 0 ); -} +#ifndef __NR_futex_waitv +#define __NR_futex_waitv 449 +#endif int do_fsync(void) { @@ -67,8 +57,7 @@ int do_fsync(void) if (do_fsync_cached == -1) { - static const struct timespec zero; - futex_wait_multiple( NULL, 0, &zero ); + syscall( __NR_futex_waitv, 0, 0, 0, 0, 0); do_fsync_cached = getenv("WINEFSYNC") && atoi(getenv("WINEFSYNC")) && errno != ENOSYS; } From e269c18092ff4653bf4b00433bb22a2abab0d303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= Date: Thu, 21 Oct 2021 20:33:58 -0300 Subject: [PATCH 0546/1506] ntdll/fsync: Use absolute timeouts for futex_wait MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the FUTEX_WAIT_BITSET operation instead of FUTEX_WAIT, that allow us to use absolute timeouts rather than relative ones that requires an extra syscall to update the timeout. Signed-off-by: André Almeida Link: https://github.com/ValveSoftware/wine/pull/128 --- dlls/ntdll/unix/fsync.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c72c4be6774..66e2b6a6841 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -56,6 +56,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsync); #include "pshpack4.h" #include "poppack.h" +#define FUTEX_WAIT_BITSET 9 +#define FUTEX_CLOCK_REALTIME 256 +#define FUTEX_BITSET_MATCH_ANY 0xffffffff + /* futex_waitv interface */ #ifndef __NR_futex_waitv @@ -134,11 +138,13 @@ static inline int futex_wait( int *addr, int val, const ULONGLONG *end ) { if (end) { - LONGLONG timeleft = update_timeout( *end ); struct timespec timeout; - timeout.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; - timeout.tv_nsec = (timeleft % TICKSPERSEC) * 100; - return syscall( __NR_futex, addr, 0, val, &timeout, 0, 0 ); + ULONGLONG tmp = *end - SECS_1601_TO_1970 * TICKSPERSEC; + timeout.tv_sec = tmp / (ULONGLONG)TICKSPERSEC; + timeout.tv_nsec = (tmp % TICKSPERSEC) * 100; + + return syscall( __NR_futex, addr, FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, + val, &timeout, 0, FUTEX_BITSET_MATCH_ANY ); } else { From d4710b8803f37df06ede73da5b42daa1d72600de Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 1 Apr 2021 20:19:35 +0300 Subject: [PATCH 0547/1506] esync, fsync: Yield execution before alertable wait for AC Odyssey. CW-Bug-ID: #18881 --- dlls/ntdll/unix/esync.c | 11 +++++++++++ dlls/ntdll/unix/fsync.c | 9 +++++++++ dlls/ntdll/unix/loader.c | 8 ++++++++ dlls/ntdll/unix/unix_private.h | 2 ++ 4 files changed, 30 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 159d25349dc..12d7f7e4938 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -947,6 +947,8 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA if (event->signaled) { + if (ac_odyssey && alertable) + usleep( 0 ); if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value)) { TRACE("Woken up by handle %p [%d].\n", handles[i], i); @@ -962,6 +964,12 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA if (event->signaled) { + if (ac_odyssey && alertable) + { + usleep( 0 ); + if (!event->signaled) + break; + } TRACE("Woken up by handle %p [%d].\n", handles[i], i); return i; } @@ -990,6 +998,9 @@ static NTSTATUS __esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEA while (1) { + if (ac_odyssey && alertable) + usleep( 0 ); + ret = do_poll( fds, pollcount, timeout ? &end : NULL ); if (ret > 0) { diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 66e2b6a6841..65fc9d2ac81 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -916,6 +916,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) { + if (ac_odyssey && alertable) + usleep( 0 ); + TRACE("Woken up by handle %p [%d].\n", handles[i], i); return i; } @@ -935,6 +938,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) { + if (ac_odyssey && alertable) + usleep( 0 ); + TRACE("Woken up by handle %p [%d].\n", handles[i], i); return i; } @@ -965,6 +971,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, /* Looks like everything is contended, so wait. */ + if (ac_odyssey && alertable) + usleep( 0 ); + if (timeout && !timeout->QuadPart) { /* Unlike esync, we already know that we've timed out, so we diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 0712ddd3fdf..f9ec5504310 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1920,10 +1920,18 @@ static ULONG_PTR get_image_address(void) return 0; } +BOOL ac_odyssey; + static void hacks_init(void) { const char *sgi = getenv( "SteamGameId" ); + if (main_argc > 1 && strstr(main_argv[1], "ACOdyssey.exe")) + { + ERR("HACK: AC Odyssey sync tweak on.\n"); + ac_odyssey = TRUE; + } + switch (sgi ? atoi( sgi ) : -1) { case 25700: /* Madballs in Babo: Invasion */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 02b77ad220c..61d94a16edc 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -178,6 +178,8 @@ extern SYSTEM_CPU_INFORMATION cpu_info; extern struct ldt_copy __wine_ldt_copy; #endif +extern BOOL ac_odyssey; + extern void init_environment(void); extern void init_startup_info(void); extern void *create_startup_info( const UNICODE_STRING *nt_image, ULONG process_flags, From 87ba19d548f368e5834080714e041b38c777dcf9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 6 Apr 2021 19:43:48 +0300 Subject: [PATCH 0548/1506] ntdll: Simulate async file read and IO cancellation to workaround AC:Odyssey out of order dialogues bug. CW-Bug-ID: #18881 --- dlls/ntdll/unix/file.c | 237 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 4664380d2c0..ddea0e994cc 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -5408,6 +5408,230 @@ static unsigned int set_pending_write( HANDLE device ) return status; } +static pthread_mutex_t async_file_read_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t async_file_read_cond = PTHREAD_COND_INITIALIZER; + +struct async_file_read_job +{ + HANDLE handle; + int unix_handle; + int needs_close; + HANDLE event; + IO_STATUS_BLOCK *io; + void *buffer; + ULONG length; + LARGE_INTEGER offset; + DWORD thread_id; + LONG cancelled; + struct list queue_entry; + struct async_file_read_job *next; +}; + + +static struct list async_file_read_queue = LIST_INIT( async_file_read_queue ); +static struct async_file_read_job *async_file_read_running, *async_file_read_free; + +static void async_file_complete_io( struct async_file_read_job *job, NTSTATUS status, ULONG total ) +{ + job->io->Status = status; + job->io->Information = total; + + if (job->event) NtSetEvent( job->event, NULL ); +} + +static void *async_file_read_thread(void *dummy) +{ + struct async_file_read_job *job, *ptr; + ULONG buffer_length = 0; + void *buffer = NULL; + struct list *entry; + NTSTATUS status; + ULONG total; + int result; + + pthread_mutex_lock( &async_file_read_mutex ); + while (1) + { + while (!(entry = list_head( &async_file_read_queue ))) + { + pthread_cond_wait( &async_file_read_cond, &async_file_read_mutex ); + continue; + } + + job = LIST_ENTRY( entry, struct async_file_read_job, queue_entry ); + list_remove( entry ); + + total = 0; + + if ( job->cancelled ) + { + pthread_mutex_unlock( &async_file_read_mutex ); + status = STATUS_CANCELLED; + goto done; + } + + job->next = async_file_read_running; + async_file_read_running = job; + pthread_mutex_unlock( &async_file_read_mutex ); + + if (!buffer_length) + { + buffer = malloc(job->length); + buffer_length = job->length; + } + else if (buffer_length < job->length) + { + buffer = realloc(buffer, job->length); + buffer_length = job->length; + } + + while ((result = pread( job->unix_handle, buffer, job->length, job->offset.QuadPart )) == -1) + { + if (errno != EINTR) + { + status = errno_to_status( errno ); + goto done; + } + if (job->cancelled) + break; + } + + total = result; + status = (total || !job->length) ? STATUS_SUCCESS : STATUS_END_OF_FILE; +done: + if (job->needs_close) close( job->unix_handle ); + + if (!InterlockedCompareExchange(&job->cancelled, 1, 0)) + { + if (status == STATUS_SUCCESS) + memcpy( job->buffer, buffer, total ); + + async_file_complete_io( job, status, total ); + } + + pthread_mutex_lock( &async_file_read_mutex ); + + if (status != STATUS_CANCELLED) + { + ptr = async_file_read_running; + if (job == ptr) + { + async_file_read_running = job->next; + } + else + { + while (ptr && ptr->next != job) + ptr = ptr->next; + + assert( ptr ); + ptr->next = job->next; + } + } + + job->next = async_file_read_free; + async_file_read_free = job; + } + + return NULL; +} + +static pthread_once_t async_file_read_once = PTHREAD_ONCE_INIT; + +static void async_file_read_init(void) +{ + pthread_t async_file_read_thread_id; + pthread_attr_t pthread_attr; + + ERR("HACK: AC Odyssey async read workaround.\n"); + + pthread_attr_init( &pthread_attr ); + pthread_attr_setscope( &pthread_attr, PTHREAD_SCOPE_SYSTEM ); + pthread_attr_setdetachstate( &pthread_attr, PTHREAD_CREATE_DETACHED ); + + pthread_create( &async_file_read_thread_id, &pthread_attr, (void * (*)(void *))async_file_read_thread, NULL); + pthread_attr_destroy( &pthread_attr ); +} + +static NTSTATUS queue_async_file_read( HANDLE handle, int unix_handle, int needs_close, HANDLE event, + IO_STATUS_BLOCK *io, void *buffer, ULONG length, LARGE_INTEGER *offset ) +{ + struct async_file_read_job *job; + + pthread_once( &async_file_read_once, async_file_read_init ); + + NtResetEvent( event, NULL ); + + pthread_mutex_lock( &async_file_read_mutex ); + + if (async_file_read_free) + { + job = async_file_read_free; + async_file_read_free = async_file_read_free->next; + } + else + { + if (!(job = malloc( sizeof(*job) ))) + { + pthread_mutex_unlock( &async_file_read_mutex ); + return STATUS_NO_MEMORY; + } + } + + job->handle = handle; + job->unix_handle = unix_handle; + job->needs_close = needs_close; + job->event = event; + job->io = io; + job->buffer = buffer; + job->length = length; + job->offset = *offset; + job->thread_id = GetCurrentThreadId(); + job->cancelled = 0; + + list_add_tail( &async_file_read_queue, &job->queue_entry ); + + pthread_cond_signal( &async_file_read_cond ); + pthread_mutex_unlock( &async_file_read_mutex ); + + return STATUS_PENDING; +} + +static NTSTATUS cancel_async_file_read( HANDLE handle, IO_STATUS_BLOCK *io ) +{ + DWORD thread_id = GetCurrentThreadId(); + struct async_file_read_job *job; + unsigned int count = 0; + + TRACE( "handle %p, io %p.\n", handle, io ); + + pthread_mutex_lock( &async_file_read_mutex ); + job = async_file_read_running; + while (job) + { + if (((io && job->io == io) + || (!io && job->handle == handle && job->thread_id == thread_id)) + && !InterlockedCompareExchange(&job->cancelled, 1, 0)) + { + async_file_complete_io( job, STATUS_CANCELLED, 0 ); + ++count; + } + job = job->next; + } + + LIST_FOR_EACH_ENTRY( job, &async_file_read_queue, struct async_file_read_job, queue_entry ) + { + if (((io && job->io == io) + || (!io && job->handle == handle && job->thread_id == thread_id)) + && !InterlockedCompareExchange(&job->cancelled, 1, 0)) + { + async_file_complete_io( job, STATUS_CANCELLED, 0 ); + ++count; + } + } + + pthread_mutex_unlock( &async_file_read_mutex ); + return count ? STATUS_SUCCESS : STATUS_NOT_FOUND; +} /****************************************************************************** * NtReadFile (NTDLL.@) @@ -5449,6 +5673,13 @@ NTSTATUS WINAPI NtReadFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo goto done; } + if (ac_odyssey && async_read && length && event && !apc) + { + status = queue_async_file_read( handle, unix_handle, needs_close, event, io, buffer, length, offset ); + needs_close = 0; + goto err; + } + if (offset && offset->QuadPart != FILE_USE_FILE_POINTER_POSITION) { /* async I/O doesn't make sense on regular files */ @@ -6258,6 +6489,9 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status ) TRACE( "%p %p\n", handle, io_status ); + if (ac_odyssey && !cancel_async_file_read( handle, NULL )) + return (io_status->Status = STATUS_SUCCESS); + SERVER_START_REQ( cancel_async ) { req->handle = wine_server_obj_handle( handle ); @@ -6283,6 +6517,9 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE handle, IO_STATUS_BLOCK *io, IO_STATUS_ TRACE( "%p %p %p\n", handle, io, io_status ); + if (ac_odyssey && !cancel_async_file_read( handle, io )) + return (io_status->Status = STATUS_SUCCESS); + SERVER_START_REQ( cancel_async ) { req->handle = wine_server_obj_handle( handle ); From 643ba36eeb0efde55fb722c0fcfaabed4cc6330d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 15 Feb 2022 17:20:40 +0300 Subject: [PATCH 0549/1506] fsync: Add WINE_FSYNC_SIMULATE_SCHED_QUANTUM config option. And auto enable it for Uplay laucher. CW-Bug-Id: #20155 --- dlls/ntdll/unix/fsync.c | 17 ++++++++++++++++- dlls/ntdll/unix/loader.c | 9 +++++++++ dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 65fc9d2ac81..193bd37e6b8 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -111,6 +111,15 @@ static inline void futex_vector_set( struct futex_waitv *waitv, int *addr, int v waitv->__reserved = 0; } +static void simulate_sched_quantum(void) +{ + if (!fsync_simulate_sched_quantum) return; + /* futex wait is often very quick to resume a waiting thread when woken. + * That reveals synchonization bugs in some games which happen to work on + * Windows due to the waiting threads having some minimal delay to wake up. */ + usleep(0); +} + static inline int futex_wait_multiple( const struct futex_waitv *futexes, int count, const ULONGLONG *end ) { @@ -744,8 +753,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct futex_waitv futexes[MAXIMUM_WAIT_OBJECTS + 1]; struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; + BOOL msgwait = FALSE, waited = FALSE; int has_fsync = 0, has_server = 0; - BOOL msgwait = FALSE; int dummy_futex = 0; unsigned int spin; LONGLONG timeleft; @@ -867,6 +876,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, && __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) == current) { TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); return i; } small_pause(); @@ -884,6 +894,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count++; + if (waited) simulate_sched_quantum(); return i; } @@ -893,6 +904,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count = 1; + if (waited) simulate_sched_quantum(); return i; } else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, GetCurrentThreadId() )) == ~0) @@ -920,6 +932,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, usleep( 0 ); TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); return i; } small_pause(); @@ -942,6 +955,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, usleep( 0 ); TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); return i; } small_pause(); @@ -996,6 +1010,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Wait timed out.\n"); return STATUS_TIMEOUT; } + else waited = TRUE; } /* while (1) */ } else diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index f9ec5504310..c1d7ff801d4 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1921,16 +1921,25 @@ static ULONG_PTR get_image_address(void) } BOOL ac_odyssey; +BOOL fsync_simulate_sched_quantum; static void hacks_init(void) { const char *sgi = getenv( "SteamGameId" ); + const char *env_str; if (main_argc > 1 && strstr(main_argv[1], "ACOdyssey.exe")) { ERR("HACK: AC Odyssey sync tweak on.\n"); ac_odyssey = TRUE; } + env_str = getenv("WINE_FSYNC_SIMULATE_SCHED_QUANTUM"); + if (env_str) + fsync_simulate_sched_quantum = !!atoi(env_str); + else if (main_argc > 1) + fsync_simulate_sched_quantum = !!strstr(main_argv[1], "Ubisoft Game Launcher\\upc.exe"); + if (fsync_simulate_sched_quantum) + ERR("HACK: Simulating sched quantum in fsync.\n"); switch (sgi ? atoi( sgi ) : -1) { diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 61d94a16edc..cc5f1ffc9e0 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -179,6 +179,7 @@ extern struct ldt_copy __wine_ldt_copy; #endif extern BOOL ac_odyssey; +extern BOOL fsync_simulate_sched_quantum; extern void init_environment(void); extern void init_startup_info(void); From ed9f17f61a935059d143f6b8d9bad59328f5a608 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 2 Feb 2022 17:02:44 -0500 Subject: [PATCH 0550/1506] esync: Type-check HANDLE in esync_set_event. Signed-off-by: Derek Lesho --- dlls/ntdll/unix/esync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 12d7f7e4938..7b85981cd77 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -525,6 +525,9 @@ NTSTATUS esync_set_event( HANDLE handle ) if ((ret = get_object( handle, &obj ))) return ret; event = obj->shm; + if (obj->type != ESYNC_MANUAL_EVENT && obj->type != ESYNC_AUTO_EVENT) + return STATUS_OBJECT_TYPE_MISMATCH; + if (obj->type == ESYNC_MANUAL_EVENT) { /* Acquire the spinlock. */ From d86b58e1f5a54a267dabfbfc75dafb93a1678b40 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Mon, 14 Feb 2022 12:51:27 -0500 Subject: [PATCH 0551/1506] fsync: Type-check HANDLE in fsync_set_event(). Signed-off-by: Derek Lesho --- dlls/ntdll/unix/fsync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 193bd37e6b8..f9b75fd2faf 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -576,6 +576,9 @@ NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) if ((ret = get_object( handle, &obj ))) return ret; event = obj->shm; + if (obj->type != FSYNC_MANUAL_EVENT && obj->type != FSYNC_AUTO_EVENT) + return STATUS_OBJECT_TYPE_MISMATCH; + if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) futex_wake( &event->signaled, INT_MAX ); From a1a7dae41fd7225b10eef5cbd88aebbf95293af3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 18 Feb 2022 12:56:58 +0300 Subject: [PATCH 0552/1506] fsync: Fix semaphore grab attempt on wait all path. CW-Bug-Id: #20189 --- dlls/ntdll/unix/fsync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index f9b75fd2faf..321a6b5a79a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -1137,7 +1137,10 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, case FSYNC_SEMAPHORE: { struct semaphore *semaphore = obj->shm; - if (__sync_fetch_and_sub( &semaphore->count, 1 ) <= 0) + int current; + + if (!(current = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST )) + || __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) != current) goto tooslow; break; } From a96aa91aa785a90ce0a05b9b8247b180dfdfc392 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 18 Feb 2022 12:58:53 +0300 Subject: [PATCH 0553/1506] fsync: Always check for NULL object on wait all path. CW-Bug-Id: #20189 --- dlls/ntdll/unix/fsync.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 321a6b5a79a..c386b748430 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -1118,6 +1118,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) { struct fsync *obj = objs[i]; + if (!obj) continue; switch (obj->type) { case FSYNC_MUTEX: @@ -1182,6 +1183,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, for (--i; i >= 0; i--) { struct fsync *obj = objs[i]; + if (!obj) continue; switch (obj->type) { case FSYNC_MUTEX: From 8cbe7c2daf202e909ab8dfe3d7078668a1ec868b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 18 Feb 2022 13:04:01 +0300 Subject: [PATCH 0554/1506] fsync: Get rid of spin before futex wait. CW-Bug-Id: #20189 --- dlls/ntdll/unix/fsync.c | 99 +++++++++++++---------------------------- 1 file changed, 31 insertions(+), 68 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c386b748430..dc974a7e4d1 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -83,15 +83,6 @@ struct timespec64 long long tv_nsec; }; -static inline void small_pause(void) -{ -#if defined(__i386__) || defined(__x86_64__) - __asm__ __volatile__( "rep;nop" : : : "memory" ); -#else - __asm__ __volatile__( "" : : : "memory" ); -#endif -} - static LONGLONG update_timeout( ULONGLONG end ) { LARGE_INTEGER now; @@ -153,7 +144,7 @@ static inline int futex_wait( int *addr, int val, const ULONGLONG *end ) timeout.tv_nsec = (tmp % TICKSPERSEC) * 100; return syscall( __NR_futex, addr, FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, - val, &timeout, 0, FUTEX_BITSET_MATCH_ANY ); + val, &timeout, 0, FUTEX_BITSET_MATCH_ANY ); } else { @@ -161,8 +152,6 @@ static inline int futex_wait( int *addr, int val, const ULONGLONG *end ) } } -static unsigned int spincount = 100; - int do_fsync(void) { #ifdef __linux__ @@ -172,8 +161,6 @@ int do_fsync(void) { syscall( __NR_futex_waitv, NULL, 0, 0, NULL, 0 ); do_fsync_cached = getenv("WINEFSYNC") && atoi(getenv("WINEFSYNC")) && errno != ENOSYS; - if (getenv("WINEFSYNC_SPINCOUNT")) - spincount = atoi(getenv("WINEFSYNC_SPINCOUNT")); } return do_fsync_cached; @@ -759,7 +746,6 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, BOOL msgwait = FALSE, waited = FALSE; int has_fsync = 0, has_server = 0; int dummy_futex = 0; - unsigned int spin; LONGLONG timeleft; LARGE_INTEGER now; DWORD waitcount; @@ -869,22 +855,13 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct semaphore *semaphore = obj->shm; int current; - /* It would be a little clearer (and less error-prone) - * to use a dedicated interlocked_dec_if_nonzero() - * helper, but nesting loops like that is probably not - * great for performance... */ - for (spin = 0; spin <= spincount || current; ++spin) + if ((current = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST )) + && __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) == current) { - if ((current = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST )) - && __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) == current) - { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - if (waited) simulate_sched_quantum(); - return i; - } - small_pause(); + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); + return i; } - futex_vector_set( &futexes[i], &semaphore->count, 0 ); break; } @@ -901,22 +878,18 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return i; } - for (spin = 0; spin <= spincount; ++spin) + if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() ))) { - if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() ))) - { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - mutex->count = 1; - if (waited) simulate_sched_quantum(); - return i; - } - else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, GetCurrentThreadId() )) == ~0) - { - TRACE("Woken up by abandoned mutex %p [%d].\n", handles[i], i); - mutex->count = 1; - return STATUS_ABANDONED_WAIT_0 + i; - } - small_pause(); + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + mutex->count = 1; + if (waited) simulate_sched_quantum(); + return i; + } + else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, GetCurrentThreadId() )) == ~0) + { + TRACE("Woken up by abandoned mutex %p [%d].\n", handles[i], i); + mutex->count = 1; + return STATUS_ABANDONED_WAIT_0 + i; } futex_vector_set( &futexes[i], &mutex->tid, tid ); @@ -927,20 +900,15 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct event *event = obj->shm; - for (spin = 0; spin <= spincount; ++spin) + if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) { - if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) - { - if (ac_odyssey && alertable) - usleep( 0 ); - - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - if (waited) simulate_sched_quantum(); - return i; - } - small_pause(); - } + if (ac_odyssey && alertable) + usleep( 0 ); + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); + return i; + } futex_vector_set( &futexes[i], &event->signaled, 0 ); break; } @@ -950,20 +918,15 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct event *event = obj->shm; - for (spin = 0; spin <= spincount; ++spin) + if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) { - if (__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) - { - if (ac_odyssey && alertable) - usleep( 0 ); - - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - if (waited) simulate_sched_quantum(); - return i; - } - small_pause(); - } + if (ac_odyssey && alertable) + usleep( 0 ); + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); + return i; + } futex_vector_set( &futexes[i], &event->signaled, 0 ); break; } From 1c16b590a1c97bce8822450d16928af7e62db4be Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 18 Feb 2022 12:46:59 +0300 Subject: [PATCH 0555/1506] fsync: Always use futex_waitv for wait. CW-Bug-Id: #20189 --- dlls/ntdll/unix/fsync.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index dc974a7e4d1..64eed0c1e23 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -56,10 +56,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsync); #include "pshpack4.h" #include "poppack.h" -#define FUTEX_WAIT_BITSET 9 -#define FUTEX_CLOCK_REALTIME 256 -#define FUTEX_BITSET_MATCH_ANY 0xffffffff - /* futex_waitv interface */ #ifndef __NR_futex_waitv @@ -134,24 +130,6 @@ static inline int futex_wake( int *addr, int val ) return syscall( __NR_futex, addr, 1, val, NULL, 0, 0 ); } -static inline int futex_wait( int *addr, int val, const ULONGLONG *end ) -{ - if (end) - { - struct timespec timeout; - ULONGLONG tmp = *end - SECS_1601_TO_1970 * TICKSPERSEC; - timeout.tv_sec = tmp / (ULONGLONG)TICKSPERSEC; - timeout.tv_nsec = (tmp % TICKSPERSEC) * 100; - - return syscall( __NR_futex, addr, FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, - val, &timeout, 0, FUTEX_BITSET_MATCH_ANY ); - } - else - { - return syscall( __NR_futex, addr, 0, val, NULL, 0, 0 ); - } -} - int do_fsync(void) { #ifdef __linux__ @@ -705,17 +683,18 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN alertable ) { + struct futex_waitv futexes[2]; int ret; + futex_vector_set( &futexes[0], addr, val ); + if (alertable) { int *apc_futex = ntdll_get_thread_data()->fsync_apc_futex; - struct futex_waitv futexes[2]; if (__atomic_load_n( apc_futex, __ATOMIC_SEQ_CST )) return STATUS_USER_APC; - futex_vector_set( &futexes[0], addr, val ); futex_vector_set( &futexes[1], apc_futex, 0 ); ret = futex_wait_multiple( futexes, 2, end ); @@ -725,7 +704,7 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler } else { - ret = futex_wait( addr, val, end ); + ret = futex_wait_multiple( futexes, 1, end ); } if (!ret) @@ -962,10 +941,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return STATUS_TIMEOUT; } - if (waitcount == 1) - ret = futex_wait( u64_to_ptr(futexes[0].uaddr), futexes[0].val, timeout ? &end : NULL ); - else - ret = futex_wait_multiple( futexes, waitcount, timeout ? &end : NULL ); + ret = futex_wait_multiple( futexes, waitcount, timeout ? &end : NULL ); /* FUTEX_WAIT_MULTIPLE can succeed or return -EINTR, -EAGAIN, * -EFAULT/-EACCES, -ETIMEDOUT. In the first three cases we need to From a925f31546de8f3137a3e2711579e985c6f3bca0 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 21 Feb 2022 12:32:49 -0600 Subject: [PATCH 0556/1506] ntdll: Include linux/futex.h in fsync.c. --- configure.ac | 1 + dlls/ntdll/unix/fsync.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index 45ae883ddc6..c1564565c0f 100644 --- a/configure.ac +++ b/configure.ac @@ -424,6 +424,7 @@ AC_CHECK_HEADERS(\ link.h \ linux/cdrom.h \ linux/filter.h \ + linux/futex.h \ linux/hdreg.h \ linux/hidraw.h \ linux/input.h \ diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 64eed0c1e23..f620b5caff8 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -38,6 +38,9 @@ #ifdef HAVE_SYS_SYSCALL_H # include #endif +#ifdef HAVE_LINUX_FUTEX_H +# include +#endif #include #include From be971cfd3e49ec4ce2b736b7479a03f7a2f1cb3b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 27 Apr 2022 15:52:53 -0500 Subject: [PATCH 0557/1506] fsync: Reuse shared mem indices. CW-Bug-Id: #20560 --- server/console.c | 1 + server/device.c | 2 ++ server/event.c | 2 ++ server/fd.c | 1 + server/fsync.c | 66 +++++++++++++++++++++++++++++++++++++++++++++--- server/fsync.h | 1 + server/process.c | 1 + server/queue.c | 1 + server/thread.c | 7 +++++ server/timer.c | 2 ++ 10 files changed, 81 insertions(+), 3 deletions(-) diff --git a/server/console.c b/server/console.c index ca1ab046648..9084e5a3828 100644 --- a/server/console.c +++ b/server/console.c @@ -897,6 +897,7 @@ static void console_server_destroy( struct object *obj ) disconnect_console_server( server ); if (server->fd) release_object( server->fd ); if (do_esync()) close( server->esync_fd ); + if (server->fsync_idx) fsync_free_shm_idx( server->fsync_idx ); } static struct object *console_server_lookup_name( struct object *obj, struct unicode_str *name, diff --git a/server/device.c b/server/device.c index 90e0a0c1fee..7e9911efb6a 100644 --- a/server/device.c +++ b/server/device.c @@ -853,6 +853,7 @@ static void device_manager_destroy( struct object *obj ) if (do_esync()) close( manager->esync_fd ); + if (manager->fsync_idx) fsync_free_shm_idx( manager->fsync_idx ); } static struct device_manager *create_device_manager(void) @@ -865,6 +866,7 @@ static struct device_manager *create_device_manager(void) list_init( &manager->devices ); list_init( &manager->requests ); wine_rb_init( &manager->kernel_objects, compare_kernel_object ); + manager->fsync_idx = 0; if (do_fsync()) manager->fsync_idx = fsync_alloc_shm( 0, 0 ); diff --git a/server/event.c b/server/event.c index aa1b0a4002a..b93a9960ad2 100644 --- a/server/event.c +++ b/server/event.c @@ -161,6 +161,7 @@ struct event *create_event( struct object *root, const struct unicode_str *name, list_init( &event->kernel_object ); event->manual_reset = manual_reset; event->signaled = initial_state; + event->fsync_idx = 0; if (do_fsync()) event->fsync_idx = fsync_alloc_shm( initial_state, 0 ); @@ -300,6 +301,7 @@ static void event_destroy( struct object *obj ) if (do_esync()) close( event->esync_fd ); + if (event->fsync_idx) fsync_free_shm_idx( event->fsync_idx ); } struct keyed_event *create_keyed_event( struct object *root, const struct unicode_str *name, diff --git a/server/fd.c b/server/fd.c index 99b55e863dd..d18ed4fc8e4 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1580,6 +1580,7 @@ static void fd_destroy( struct object *obj ) if (do_esync()) close( fd->esync_fd ); + if (fd->fsync_idx) fsync_free_shm_idx( fd->fsync_idx ); } /* check if the desired access is possible without violating */ diff --git a/server/fsync.c b/server/fsync.c index 593070ad62e..3c1e709d7e3 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef HAVE_SYS_STAT_H # include #endif @@ -76,6 +77,12 @@ static long pagesize; static int is_fsync_initialized; +static uint64_t *shm_idx_free_map; +static uint32_t shm_idx_free_map_size; /* uint64_t word count */ +static uint32_t shm_idx_free_search_start_hint; + +#define BITS_IN_FREE_MAP_WORD (8 * sizeof(*shm_idx_free_map)) + static void shm_cleanup(void) { close( shm_fd ); @@ -115,6 +122,11 @@ void fsync_init(void) fprintf( stderr, "fsync: up and running.\n" ); + shm_idx_free_map_size = 256; + shm_idx_free_map = malloc( shm_idx_free_map_size * sizeof(*shm_idx_free_map) ); + memset( shm_idx_free_map, 0xff, shm_idx_free_map_size * sizeof(*shm_idx_free_map) ); + shm_idx_free_map[0] &= ~(uint64_t)1; /* Avoid allocating shm_index 0. */ + atexit( shm_cleanup ); } @@ -188,6 +200,7 @@ static void fsync_destroy( struct object *obj ) struct fsync *fsync = (struct fsync *)obj; if (fsync->type == FSYNC_MUTEX) list_remove( &fsync->mutex_entry ); + fsync_free_shm_idx( fsync->shm_idx ); } static void *get_shm( unsigned int idx ) @@ -226,12 +239,22 @@ static void *get_shm( unsigned int idx ) return (void *)((unsigned long)shm_addrs[entry] + offset); } -/* FIXME: This is rather inefficient... */ -static unsigned int shm_idx_counter = 1; +static int alloc_shm_idx_from_word( unsigned int word_index ) +{ + int ret; + + if (!shm_idx_free_map[word_index]) return 0; + + ret = __builtin_ctzll( shm_idx_free_map[word_index] ); + shm_idx_free_map[word_index] &= ~((uint64_t)1 << ret); + shm_idx_free_search_start_hint = shm_idx_free_map[word_index] ? word_index : word_index + 1; + return word_index * BITS_IN_FREE_MAP_WORD + ret; +} unsigned int fsync_alloc_shm( int low, int high ) { #ifdef __linux__ + unsigned int i; int shm_idx; int *shm; @@ -240,7 +263,29 @@ unsigned int fsync_alloc_shm( int low, int high ) if (!is_fsync_initialized) return 0; - shm_idx = shm_idx_counter++; + /* shm_idx_free_search_start_hint is always at the first word with a free index or before that. */ + for (i = shm_idx_free_search_start_hint; i < shm_idx_free_map_size; ++i) + if ((shm_idx = alloc_shm_idx_from_word( i ))) break; + + if (!shm_idx) + { + uint32_t old_size, new_size; + uint64_t *new_alloc; + + old_size = shm_idx_free_map_size; + new_size = old_size + 256; + new_alloc = realloc( shm_idx_free_map, new_size * sizeof(*new_alloc) ); + if (!new_alloc) + { + fprintf( stderr, "fsync: couldn't expand shm_idx_free_map to size %zd.", + new_size * sizeof(*new_alloc) ); + return 0; + } + memset( new_alloc + old_size, 0xff, (new_size - old_size) * sizeof(*new_alloc) ); + shm_idx_free_map = new_alloc; + shm_idx_free_map_size = new_size; + shm_idx = alloc_shm_idx_from_word( old_size ); + } while (shm_idx * 8 >= shm_size) { @@ -265,6 +310,21 @@ unsigned int fsync_alloc_shm( int low, int high ) #endif } +void fsync_free_shm_idx( int shm_idx ) +{ + unsigned int idx; + uint64_t mask; + + assert( shm_idx ); + assert( shm_idx < shm_idx_free_map_size * BITS_IN_FREE_MAP_WORD ); + idx = shm_idx / BITS_IN_FREE_MAP_WORD; + mask = (uint64_t)1 << (shm_idx % BITS_IN_FREE_MAP_WORD); + assert( !(shm_idx_free_map[idx] & mask) ); + shm_idx_free_map[idx] |= mask; + if (idx < shm_idx_free_search_start_hint) + shm_idx_free_search_start_hint = idx; +} + static int type_matches( enum fsync_type type1, enum fsync_type type2 ) { return (type1 == type2) || diff --git a/server/fsync.h b/server/fsync.h index a91939b7f0a..ee1a729e77e 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -21,6 +21,7 @@ extern int do_fsync(void); extern void fsync_init(void); extern unsigned int fsync_alloc_shm( int low, int high ); +extern void fsync_free_shm_idx( int shm_idx ); extern void fsync_wake_futex( unsigned int shm_idx ); extern void fsync_clear_futex( unsigned int shm_idx ); extern void fsync_wake_up( struct object *obj ); diff --git a/server/process.c b/server/process.c index 38303e04193..d43df3d15f6 100644 --- a/server/process.c +++ b/server/process.c @@ -805,6 +805,7 @@ static void process_destroy( struct object *obj ) free( process->dir_cache ); free( process->image ); if (do_esync()) close( process->esync_fd ); + if (process->fsync_idx) fsync_free_shm_idx( process->fsync_idx ); } /* dump a process on stdout for debugging purposes */ diff --git a/server/queue.c b/server/queue.c index 3526cfee3f3..fb6fe2d9478 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1374,6 +1374,7 @@ static void msg_queue_destroy( struct object *obj ) { struct msg_queue *queue = (struct msg_queue *)obj; if (!queue->destroyed) cleanup_msg_queue( queue ); + if (queue->fsync_idx) fsync_free_shm_idx( queue->fsync_idx ); } /* free the message queue of a thread at thread exit */ diff --git a/server/thread.c b/server/thread.c index 3f246f128bf..21de26a194f 100644 --- a/server/thread.c +++ b/server/thread.c @@ -483,6 +483,8 @@ struct thread *create_thread( int fd, struct process *process, const struct secu } } + thread->fsync_idx = 0; + if (do_fsync()) { thread->fsync_idx = fsync_alloc_shm( 0, 0 ); @@ -580,6 +582,11 @@ static void destroy_thread( struct object *obj ) if (do_esync()) close( thread->esync_fd ); + if (thread->fsync_idx) + { + fsync_free_shm_idx( thread->fsync_idx ); + fsync_free_shm_idx( thread->fsync_apc_idx ); + } } /* dump a thread on stdout for debugging purposes */ diff --git a/server/timer.c b/server/timer.c index afc12ff03ad..884ace9376f 100644 --- a/server/timer.c +++ b/server/timer.c @@ -119,6 +119,7 @@ static struct timer *create_timer( struct object *root, const struct unicode_str timer->timeout = NULL; timer->thread = NULL; timer->esync_fd = -1; + timer->fsync_idx = 0; if (do_fsync()) timer->fsync_idx = fsync_alloc_shm( 0, 0 ); @@ -258,6 +259,7 @@ static void timer_destroy( struct object *obj ) if (timer->timeout) remove_timeout_user( timer->timeout ); if (timer->thread) release_object( timer->thread ); if (do_esync()) close( timer->esync_fd ); + if (timer->fsync_idx) fsync_free_shm_idx( timer->fsync_idx ); } /* create a timer */ From eb6a27a9dc9f965e8ebbe4a703f5e8b0e748554d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 29 Apr 2022 16:57:13 -0500 Subject: [PATCH 0558/1506] fsync: Use CLOCK_MONOTONIC for relative timeouts. CW-Bug-Id: #20548 Test shows that relative wait timeouts on Windows do not include the time spent is suspend. Using CLOCK_MONOTONIC on Linux is a closer approximation for that. --- dlls/ntdll/unix/fsync.c | 88 +++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index f620b5caff8..f83b17d4710 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -82,13 +82,50 @@ struct timespec64 long long tv_nsec; }; -static LONGLONG update_timeout( ULONGLONG end ) +static LONGLONG nt_time_from_ts( struct timespec *ts ) { - LARGE_INTEGER now; + return ticks_from_time_t( ts->tv_sec ) + (ts->tv_nsec + 50) / 100; +} + +static void get_wait_end_time( const LARGE_INTEGER **timeout, struct timespec64 *end, clockid_t *clock_id ) +{ + ULONGLONG nt_end; + + if (!*timeout) return; + if ((*timeout)->QuadPart == TIMEOUT_INFINITE) + { + *timeout = NULL; + return; + } + + if ((*timeout)->QuadPart > 0) + { + nt_end = (*timeout)->QuadPart; + *clock_id = CLOCK_REALTIME; + } + else + { + struct timespec ts; + + clock_gettime( CLOCK_MONOTONIC, &ts ); + nt_end = nt_time_from_ts( &ts ) - (*timeout)->QuadPart; + *clock_id = CLOCK_MONOTONIC; + } + + nt_end -= SECS_1601_TO_1970 * TICKSPERSEC; + end->tv_sec = nt_end / (ULONGLONG)TICKSPERSEC; + end->tv_nsec = (nt_end % TICKSPERSEC) * 100; +} + +static LONGLONG update_timeout( const struct timespec64 *end, clockid_t clock_id ) +{ + struct timespec end_ts, ts; LONGLONG timeleft; - NtQuerySystemTime( &now ); - timeleft = end - now.QuadPart; + clock_gettime( clock_id, &ts ); + end_ts.tv_sec = end->tv_sec; + end_ts.tv_nsec = end->tv_nsec; + timeleft = nt_time_from_ts( &end_ts ) - nt_time_from_ts( &ts ); if (timeleft < 0) timeleft = 0; return timeleft; } @@ -111,21 +148,12 @@ static void simulate_sched_quantum(void) } static inline int futex_wait_multiple( const struct futex_waitv *futexes, - int count, const ULONGLONG *end ) + int count, const struct timespec64 *end, clockid_t clock_id ) { if (end) - { - struct timespec64 timeout; - ULONGLONG tmp = *end - SECS_1601_TO_1970 * TICKSPERSEC; - timeout.tv_sec = tmp / (ULONGLONG)TICKSPERSEC; - timeout.tv_nsec = (tmp % TICKSPERSEC) * 100; - - return syscall( __NR_futex_waitv, futexes, count, 0, &timeout, CLOCK_REALTIME ); - } + return syscall( __NR_futex_waitv, futexes, count, 0, end, clock_id ); else - { return syscall( __NR_futex_waitv, futexes, count, 0, NULL, 0 ); - } } static inline int futex_wake( int *addr, int val ) @@ -684,7 +712,8 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) return STATUS_SUCCESS; } -static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN alertable ) +static NTSTATUS do_single_wait( int *addr, int val, const struct timespec64 *end, clockid_t clock_id, + BOOLEAN alertable ) { struct futex_waitv futexes[2]; int ret; @@ -700,14 +729,14 @@ static NTSTATUS do_single_wait( int *addr, int val, ULONGLONG *end, BOOLEAN aler futex_vector_set( &futexes[1], apc_futex, 0 ); - ret = futex_wait_multiple( futexes, 2, end ); + ret = futex_wait_multiple( futexes, 2, end, clock_id ); if (__atomic_load_n( apc_futex, __ATOMIC_SEQ_CST )) return STATUS_USER_APC; } else { - ret = futex_wait_multiple( futexes, 1, end ); + ret = futex_wait_multiple( futexes, 1, end, clock_id ); } if (!ret) @@ -727,11 +756,11 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; BOOL msgwait = FALSE, waited = FALSE; int has_fsync = 0, has_server = 0; + clockid_t clock_id = 0; + struct timespec64 end; int dummy_futex = 0; LONGLONG timeleft; - LARGE_INTEGER now; DWORD waitcount; - ULONGLONG end; int i, ret; /* Grab the APC futex if we don't already have it. */ @@ -752,16 +781,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } } - NtQuerySystemTime( &now ); - if (timeout) - { - if (timeout->QuadPart == TIMEOUT_INFINITE) - timeout = NULL; - else if (timeout->QuadPart > 0) - end = timeout->QuadPart; - else - end = now.QuadPart - timeout->QuadPart; - } + get_wait_end_time( &timeout, &end, &clock_id ); for (i = 0; i < count; i++) { @@ -797,7 +817,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE(", timeout = INFINITE.\n"); else { - timeleft = update_timeout( end ); + timeleft = update_timeout( &end, clock_id ); TRACE(", timeout = %ld.%07ld sec.\n", (long) (timeleft / TICKSPERSEC), (long) (timeleft % TICKSPERSEC)); } @@ -944,7 +964,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return STATUS_TIMEOUT; } - ret = futex_wait_multiple( futexes, waitcount, timeout ? &end : NULL ); + ret = futex_wait_multiple( futexes, waitcount, timeout ? &end : NULL, clock_id ); /* FUTEX_WAIT_MULTIPLE can succeed or return -EINTR, -EAGAIN, * -EFAULT/-EACCES, -ETIMEDOUT. In the first three cases we need to @@ -1006,7 +1026,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, while ((current = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ))) { - status = do_single_wait( &mutex->tid, current, timeout ? &end : NULL, alertable ); + status = do_single_wait( &mutex->tid, current, timeout ? &end : NULL, clock_id, alertable ); if (status != STATUS_PENDING) break; } @@ -1018,7 +1038,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, while (!__atomic_load_n( &event->signaled, __ATOMIC_SEQ_CST )) { - status = do_single_wait( &event->signaled, 0, timeout ? &end : NULL, alertable ); + status = do_single_wait( &event->signaled, 0, timeout ? &end : NULL, clock_id, alertable ); if (status != STATUS_PENDING) break; } From 5ce45b53b224d0c6e76cde7d101698c0fc35e207 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Jul 2022 10:27:12 -0500 Subject: [PATCH 0559/1506] fsync: Return a copy of the object instead of cache pointer from get_object(). CW-Bug-Id: #20826 --- dlls/ntdll/unix/fsync.c | 123 +++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index f83b17d4710..c397129680a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -269,14 +269,14 @@ static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) return idx % FSYNC_LIST_BLOCK_SIZE; } -static struct fsync *add_to_list( HANDLE handle, enum fsync_type type, void *shm ) +static void add_to_list( HANDLE handle, enum fsync_type type, void *shm ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); if (entry >= FSYNC_LIST_ENTRIES) { FIXME( "too many allocated handles, not caching %p\n", handle ); - return FALSE; + return; } if (!fsync_list[entry]) /* do we need to allocate a new block of entries? */ @@ -286,38 +286,37 @@ static struct fsync *add_to_list( HANDLE handle, enum fsync_type type, void *shm { void *ptr = anon_mmap_alloc( FSYNC_LIST_BLOCK_SIZE * sizeof(struct fsync), PROT_READ | PROT_WRITE ); - if (ptr == MAP_FAILED) return FALSE; + if (ptr == MAP_FAILED) return; fsync_list[entry] = ptr; } } if (!__sync_val_compare_and_swap((int *)&fsync_list[entry][idx].type, 0, type )) fsync_list[entry][idx].shm = shm; - - return &fsync_list[entry][idx]; } -static struct fsync *get_cached_object( HANDLE handle ) +static BOOL get_cached_object( HANDLE handle, struct fsync *obj ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); - if (entry >= FSYNC_LIST_ENTRIES || !fsync_list[entry]) return NULL; - if (!fsync_list[entry][idx].type) return NULL; + if (entry >= FSYNC_LIST_ENTRIES || !fsync_list[entry]) return FALSE; + if (!fsync_list[entry][idx].type) return FALSE; - return &fsync_list[entry][idx]; + *obj = fsync_list[entry][idx]; + return TRUE; } /* Gets an object. This is either a proper fsync object (i.e. an event, * semaphore, etc. created using create_fsync) or a generic synchronizable * server-side object which the server will signal (e.g. a process, thread, * message queue, etc.) */ -static NTSTATUS get_object( HANDLE handle, struct fsync **obj ) +static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) { NTSTATUS ret = STATUS_SUCCESS; unsigned int shm_idx = 0; enum fsync_type type; - if ((*obj = get_cached_object( handle ))) return STATUS_SUCCESS; + if (get_cached_object( handle, obj )) return STATUS_SUCCESS; if ((INT_PTR)handle < 0) { @@ -340,13 +339,14 @@ static NTSTATUS get_object( HANDLE handle, struct fsync **obj ) if (ret) { WARN("Failed to retrieve shm index for handle %p, status %#x.\n", handle, (unsigned int)ret); - *obj = NULL; return ret; } TRACE("Got shm index %d for handle %p.\n", shm_idx, handle); - *obj = add_to_list( handle, type, get_shm( shm_idx ) ); + obj->type = type; + obj->shm = get_shm( shm_idx ); + add_to_list( handle, type, obj->shm ); return ret; } @@ -497,7 +497,7 @@ NTSTATUS fsync_open_semaphore( HANDLE *handle, ACCESS_MASK access, NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) { - struct fsync *obj; + struct fsync obj; struct semaphore *semaphore; ULONG current; NTSTATUS ret; @@ -505,7 +505,7 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) TRACE("%p, %d, %p.\n", handle, (int)count, prev); if ((ret = get_object( handle, &obj ))) return ret; - semaphore = obj->shm; + semaphore = obj.shm; do { @@ -523,7 +523,7 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) NTSTATUS fsync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ) { - struct fsync *obj; + struct fsync obj; struct semaphore *semaphore; SEMAPHORE_BASIC_INFORMATION *out = info; NTSTATUS ret; @@ -531,7 +531,7 @@ NTSTATUS fsync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ) TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); if ((ret = get_object( handle, &obj ))) return ret; - semaphore = obj->shm; + semaphore = obj.shm; out->CurrentCount = semaphore->count; out->MaximumCount = semaphore->max; @@ -563,16 +563,16 @@ NTSTATUS fsync_open_event( HANDLE *handle, ACCESS_MASK access, NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) { struct event *event; - struct fsync *obj; + struct fsync obj; LONG current; NTSTATUS ret; TRACE("%p.\n", handle); if ((ret = get_object( handle, &obj ))) return ret; - event = obj->shm; + event = obj.shm; - if (obj->type != FSYNC_MANUAL_EVENT && obj->type != FSYNC_AUTO_EVENT) + if (obj.type != FSYNC_MANUAL_EVENT && obj.type != FSYNC_AUTO_EVENT) return STATUS_OBJECT_TYPE_MISMATCH; if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) @@ -586,14 +586,14 @@ NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) { struct event *event; - struct fsync *obj; + struct fsync obj; LONG current; NTSTATUS ret; TRACE("%p.\n", handle); if ((ret = get_object( handle, &obj ))) return ret; - event = obj->shm; + event = obj.shm; current = __atomic_exchange_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); @@ -605,14 +605,14 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ) { struct event *event; - struct fsync *obj; + struct fsync obj; LONG current; NTSTATUS ret; TRACE("%p.\n", handle); if ((ret = get_object( handle, &obj ))) return ret; - event = obj->shm; + event = obj.shm; /* This isn't really correct; an application could miss the write. * Unfortunately we can't really do much better. Fortunately this is rarely @@ -634,17 +634,17 @@ NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ) NTSTATUS fsync_query_event( HANDLE handle, void *info, ULONG *ret_len ) { struct event *event; - struct fsync *obj; + struct fsync obj; EVENT_BASIC_INFORMATION *out = info; NTSTATUS ret; TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); if ((ret = get_object( handle, &obj ))) return ret; - event = obj->shm; + event = obj.shm; out->EventState = event->signaled; - out->EventType = (obj->type == FSYNC_AUTO_EVENT ? SynchronizationEvent : NotificationEvent); + out->EventType = (obj.type == FSYNC_AUTO_EVENT ? SynchronizationEvent : NotificationEvent); if (ret_len) *ret_len = sizeof(*out); return STATUS_SUCCESS; @@ -671,13 +671,13 @@ NTSTATUS fsync_open_mutex( HANDLE *handle, ACCESS_MASK access, NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) { struct mutex *mutex; - struct fsync *obj; + struct fsync obj; NTSTATUS ret; TRACE("%p, %p.\n", handle, prev); if ((ret = get_object( handle, &obj ))) return ret; - mutex = obj->shm; + mutex = obj.shm; if (mutex->tid != GetCurrentThreadId()) return STATUS_MUTANT_NOT_OWNED; @@ -694,7 +694,7 @@ NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) { - struct fsync *obj; + struct fsync obj; struct mutex *mutex; MUTANT_BASIC_INFORMATION *out = info; NTSTATUS ret; @@ -702,7 +702,7 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len); if ((ret = get_object( handle, &obj ))) return ret; - mutex = obj->shm; + mutex = obj.shm; out->CurrentCount = 1 - mutex->count; out->OwnedByCaller = (mutex->tid == GetCurrentThreadId()); @@ -753,7 +753,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, static const LARGE_INTEGER zero = {0}; struct futex_waitv futexes[MAXIMUM_WAIT_OBJECTS + 1]; - struct fsync *objs[MAXIMUM_WAIT_OBJECTS]; + struct fsync objs[MAXIMUM_WAIT_OBJECTS]; BOOL msgwait = FALSE, waited = FALSE; int has_fsync = 0, has_server = 0; clockid_t clock_id = 0; @@ -787,14 +787,28 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { ret = get_object( handles[i], &objs[i] ); if (ret == STATUS_SUCCESS) + { + if (!objs[i].type) + { + /* Someone probably closed an object while waiting on it. */ + WARN("Handle %p has type 0; was it closed?\n", handles[i]); + return STATUS_INVALID_HANDLE; + } has_fsync = 1; + } else if (ret == STATUS_NOT_IMPLEMENTED) + { + objs[i].type = 0; + objs[i].shm = NULL; has_server = 1; + } else + { return ret; + } } - if (count && objs[count - 1] && objs[count - 1]->type == FSYNC_QUEUE) + if (count && objs[count - 1].type == FSYNC_QUEUE) msgwait = TRUE; if (has_fsync && has_server) @@ -839,17 +853,10 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) { - struct fsync *obj = objs[i]; + struct fsync *obj = &objs[i]; - if (obj) + if (obj->type) { - if (!obj->type) /* gcc complains if we put this in the switch */ - { - /* Someone probably closed an object while waiting on it. */ - WARN("Handle %p has type 0; was it closed?\n", handles[i]); - return STATUS_INVALID_HANDLE; - } - switch (obj->type) { case FSYNC_SEMAPHORE: @@ -1015,9 +1022,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) { - struct fsync *obj = objs[i]; + struct fsync *obj = &objs[i]; - if (obj && obj->type == FSYNC_MUTEX) + if (obj->type == FSYNC_MUTEX) { struct mutex *mutex = obj->shm; @@ -1031,7 +1038,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, break; } } - else if (obj) + else if (obj->type) { /* this works for semaphores too */ struct event *event = obj->shm; @@ -1057,9 +1064,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, * handles were signaled. Check to make sure they still are. */ for (i = 0; i < count; i++) { - struct fsync *obj = objs[i]; + struct fsync *obj = &objs[i]; - if (obj && obj->type == FSYNC_MUTEX) + if (obj->type == FSYNC_MUTEX) { struct mutex *mutex = obj->shm; int tid = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ); @@ -1067,7 +1074,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (tid && tid != ~0 && tid != GetCurrentThreadId()) goto tryagain; } - else if (obj) + else if (obj->type) { struct event *event = obj->shm; @@ -1079,8 +1086,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, /* Yep, still signaled. Now quick, grab everything. */ for (i = 0; i < count; i++) { - struct fsync *obj = objs[i]; - if (!obj) continue; + struct fsync *obj = &objs[i]; + if (!obj->type) continue; switch (obj->type) { case FSYNC_MUTEX: @@ -1126,9 +1133,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, * Make sure to let ourselves know that we grabbed the mutexes. */ for (i = 0; i < count; i++) { - if (objs[i] && objs[i]->type == FSYNC_MUTEX) + if (objs[i].type == FSYNC_MUTEX) { - struct mutex *mutex = objs[i]->shm; + struct mutex *mutex = objs[i].shm; mutex->count++; } } @@ -1144,8 +1151,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, tooslow: for (--i; i >= 0; i--) { - struct fsync *obj = objs[i]; - if (!obj) continue; + struct fsync *obj = &objs[i]; + if (!obj->type) continue; switch (obj->type) { case FSYNC_MUTEX: @@ -1219,10 +1226,10 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an BOOLEAN alertable, const LARGE_INTEGER *timeout ) { BOOL msgwait = FALSE; - struct fsync *obj; + struct fsync obj; NTSTATUS ret; - if (count && !get_object( handles[count - 1], &obj ) && obj->type == FSYNC_QUEUE) + if (count && !get_object( handles[count - 1], &obj ) && obj.type == FSYNC_QUEUE) { msgwait = TRUE; server_set_msgwait( 1 ); @@ -1239,12 +1246,12 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an NTSTATUS fsync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { - struct fsync *obj; + struct fsync obj; NTSTATUS ret; if ((ret = get_object( signal, &obj ))) return ret; - switch (obj->type) + switch (obj.type) { case FSYNC_SEMAPHORE: ret = fsync_release_semaphore( signal, 1, NULL ); From ea368c961e43e6cd54cd23e628d86923bf5623b7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Jul 2022 11:40:08 -0500 Subject: [PATCH 0560/1506] fsync: Synchronize access to object cache. CW-Bug-Id: #20826 --- dlls/ntdll/unix/fsync.c | 57 +++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c397129680a..d6b5dba1202 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -261,6 +261,7 @@ static void *get_shm( unsigned int idx ) static struct fsync *fsync_list[FSYNC_LIST_ENTRIES]; static struct fsync fsync_list_initial_block[FSYNC_LIST_BLOCK_SIZE]; +static int cache_locked; static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) { @@ -269,6 +270,26 @@ static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) return idx % FSYNC_LIST_BLOCK_SIZE; } +static void small_pause(void) +{ +#ifdef __i386__ + __asm__ __volatile__( "rep;nop" : : : "memory" ); +#else + __asm__ __volatile__( "" : : : "memory" ); +#endif +} + +static void lock_obj_cache(void) +{ + while (__sync_val_compare_and_swap( &cache_locked, 0, 1 )) + small_pause(); +} + +static void unlock_obj_cache(void) +{ + __atomic_store_n( &cache_locked, 0, __ATOMIC_SEQ_CST ); +} + static void add_to_list( HANDLE handle, enum fsync_type type, void *shm ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); @@ -287,23 +308,29 @@ static void add_to_list( HANDLE handle, enum fsync_type type, void *shm ) void *ptr = anon_mmap_alloc( FSYNC_LIST_BLOCK_SIZE * sizeof(struct fsync), PROT_READ | PROT_WRITE ); if (ptr == MAP_FAILED) return; - fsync_list[entry] = ptr; + if (__sync_val_compare_and_swap( &fsync_list[entry], NULL, ptr )) + munmap( ptr, FSYNC_LIST_BLOCK_SIZE * sizeof(struct fsync) ); } } - if (!__sync_val_compare_and_swap((int *)&fsync_list[entry][idx].type, 0, type )) - fsync_list[entry][idx].shm = shm; + lock_obj_cache(); + fsync_list[entry][idx].type = type; + fsync_list[entry][idx].shm = shm; + unlock_obj_cache(); } static BOOL get_cached_object( HANDLE handle, struct fsync *obj ) { + BOOL ret = TRUE; UINT_PTR entry, idx = handle_to_index( handle, &entry ); if (entry >= FSYNC_LIST_ENTRIES || !fsync_list[entry]) return FALSE; - if (!fsync_list[entry][idx].type) return FALSE; - *obj = fsync_list[entry][idx]; - return TRUE; + lock_obj_cache(); + if (!fsync_list[entry][idx].type) ret = FALSE; + else *obj = fsync_list[entry][idx]; + unlock_obj_cache(); + return ret; } /* Gets an object. This is either a proper fsync object (i.e. an event, @@ -358,7 +385,16 @@ NTSTATUS fsync_close( HANDLE handle ) if (entry < FSYNC_LIST_ENTRIES && fsync_list[entry]) { - if (__atomic_exchange_n( &fsync_list[entry][idx].type, 0, __ATOMIC_SEQ_CST )) + enum fsync_type type; + + lock_obj_cache(); + if ((type = fsync_list[entry][idx].type)) + { + fsync_list[entry][idx].type = 0; + fsync_list[entry][idx].shm = NULL; + } + unlock_obj_cache(); + if (type) return STATUS_SUCCESS; } @@ -788,12 +824,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, ret = get_object( handles[i], &objs[i] ); if (ret == STATUS_SUCCESS) { - if (!objs[i].type) - { - /* Someone probably closed an object while waiting on it. */ - WARN("Handle %p has type 0; was it closed?\n", handles[i]); - return STATUS_INVALID_HANDLE; - } + assert( objs[i].type ); has_fsync = 1; } else if (ret == STATUS_NOT_IMPLEMENTED) From 9d651bf3c80fd280e4cafc5901197429d3d0a63f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 1 Aug 2022 10:50:13 -0500 Subject: [PATCH 0561/1506] fsync: Use atomic cache stores and load instead of locking cache. CW-Bug-Id: #21050 (replaces "fsync: Synchronize access to object cache.") --- dlls/ntdll/unix/fsync.c | 91 +++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 49 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index d6b5dba1202..0e3752421ed 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -259,9 +259,16 @@ static void *get_shm( unsigned int idx ) #define FSYNC_LIST_BLOCK_SIZE (65536 / sizeof(struct fsync)) #define FSYNC_LIST_ENTRIES 256 -static struct fsync *fsync_list[FSYNC_LIST_ENTRIES]; -static struct fsync fsync_list_initial_block[FSYNC_LIST_BLOCK_SIZE]; -static int cache_locked; +struct fsync_cache +{ + enum fsync_type type; + unsigned int shm_idx; +}; + +C_ASSERT(sizeof(struct fsync_cache) == sizeof(uint64_t)); + +static struct fsync_cache *fsync_list[FSYNC_LIST_ENTRIES]; +static struct fsync_cache fsync_list_initial_block[FSYNC_LIST_BLOCK_SIZE]; static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) { @@ -270,29 +277,10 @@ static inline UINT_PTR handle_to_index( HANDLE handle, UINT_PTR *entry ) return idx % FSYNC_LIST_BLOCK_SIZE; } -static void small_pause(void) -{ -#ifdef __i386__ - __asm__ __volatile__( "rep;nop" : : : "memory" ); -#else - __asm__ __volatile__( "" : : : "memory" ); -#endif -} - -static void lock_obj_cache(void) -{ - while (__sync_val_compare_and_swap( &cache_locked, 0, 1 )) - small_pause(); -} - -static void unlock_obj_cache(void) -{ - __atomic_store_n( &cache_locked, 0, __ATOMIC_SEQ_CST ); -} - -static void add_to_list( HANDLE handle, enum fsync_type type, void *shm ) +static void add_to_list( HANDLE handle, enum fsync_type type, unsigned int shm_idx ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); + struct fsync_cache cache; if (entry >= FSYNC_LIST_ENTRIES) { @@ -305,32 +293,41 @@ static void add_to_list( HANDLE handle, enum fsync_type type, void *shm ) if (!entry) fsync_list[0] = fsync_list_initial_block; else { - void *ptr = anon_mmap_alloc( FSYNC_LIST_BLOCK_SIZE * sizeof(struct fsync), + void *ptr = anon_mmap_alloc( FSYNC_LIST_BLOCK_SIZE * sizeof(*fsync_list[entry]), PROT_READ | PROT_WRITE ); if (ptr == MAP_FAILED) return; if (__sync_val_compare_and_swap( &fsync_list[entry], NULL, ptr )) - munmap( ptr, FSYNC_LIST_BLOCK_SIZE * sizeof(struct fsync) ); + munmap( ptr, FSYNC_LIST_BLOCK_SIZE * sizeof(*fsync_list[entry]) ); } } - lock_obj_cache(); - fsync_list[entry][idx].type = type; - fsync_list[entry][idx].shm = shm; - unlock_obj_cache(); + cache.type = type; + cache.shm_idx = shm_idx; + __atomic_store_n( (uint64_t *)&fsync_list[entry][idx], *(uint64_t *)&cache, __ATOMIC_SEQ_CST ); } static BOOL get_cached_object( HANDLE handle, struct fsync *obj ) { - BOOL ret = TRUE; UINT_PTR entry, idx = handle_to_index( handle, &entry ); + struct fsync_cache cache; if (entry >= FSYNC_LIST_ENTRIES || !fsync_list[entry]) return FALSE; - lock_obj_cache(); - if (!fsync_list[entry][idx].type) ret = FALSE; - else *obj = fsync_list[entry][idx]; - unlock_obj_cache(); - return ret; +again: + *(uint64_t *)&cache = __atomic_load_n( (uint64_t *)&fsync_list[entry][idx], __ATOMIC_SEQ_CST ); + + if (!cache.type || !cache.shm_idx) return FALSE; + + obj->type = cache.type; + obj->shm = get_shm( cache.shm_idx ); + if (*(uint64_t *)&cache != __atomic_load_n( (uint64_t *)&fsync_list[entry][idx], __ATOMIC_SEQ_CST )) + { + /* This check does not strictly guarantee that we avoid the potential race but is supposed to greatly + * reduce the probability of that. */ + FIXME( "Cache changed while getting object.\n" ); + goto again; + } + return TRUE; } /* Gets an object. This is either a proper fsync object (i.e. an event, @@ -373,7 +370,7 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) obj->type = type; obj->shm = get_shm( shm_idx ); - add_to_list( handle, type, obj->shm ); + add_to_list( handle, type, shm_idx ); return ret; } @@ -385,17 +382,13 @@ NTSTATUS fsync_close( HANDLE handle ) if (entry < FSYNC_LIST_ENTRIES && fsync_list[entry]) { - enum fsync_type type; + struct fsync_cache cache; - lock_obj_cache(); - if ((type = fsync_list[entry][idx].type)) - { - fsync_list[entry][idx].type = 0; - fsync_list[entry][idx].shm = NULL; - } - unlock_obj_cache(); - if (type) - return STATUS_SUCCESS; + cache.type = 0; + cache.shm_idx = 0; + *(uint64_t *)&cache = __atomic_exchange_n( (uint64_t *)&fsync_list[entry][idx], + *(uint64_t *)&cache, __ATOMIC_SEQ_CST ); + if (cache.type) return STATUS_SUCCESS; } return STATUS_INVALID_HANDLE; @@ -430,7 +423,7 @@ static NTSTATUS create_fsync( enum fsync_type type, HANDLE *handle, if (!ret || ret == STATUS_OBJECT_NAME_EXISTS) { - add_to_list( *handle, type, get_shm( shm_idx )); + add_to_list( *handle, type, shm_idx ); TRACE("-> handle %p, shm index %d.\n", *handle, shm_idx); } @@ -463,7 +456,7 @@ static NTSTATUS open_fsync( enum fsync_type type, HANDLE *handle, if (!ret) { - add_to_list( *handle, type, get_shm( shm_idx ) ); + add_to_list( *handle, type, shm_idx ); TRACE("-> handle %p, shm index %u.\n", *handle, shm_idx); } From 067fd39a1e79416d8ca96925a48b395ab551a1ec Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Jul 2022 15:11:23 -0500 Subject: [PATCH 0562/1506] fsync: Implement reference counting for sync objects shared memory. CW-Bug-Id: #20826 --- dlls/ntdll/unix/fsync.c | 150 ++++++++++++++++++++++++++++++++++++---- server/fsync.c | 64 ++++++++++++++++- server/fsync.h | 1 + server/process.c | 6 +- server/protocol.def | 5 ++ 5 files changed, 210 insertions(+), 16 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 0e3752421ed..309e2eb2aff 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -191,22 +191,28 @@ struct semaphore { int count; int max; + int ref; + int last_pid; }; -C_ASSERT(sizeof(struct semaphore) == 8); +C_ASSERT(sizeof(struct semaphore) == 16); struct event { int signaled; int unused; + int ref; + int last_pid; }; -C_ASSERT(sizeof(struct event) == 8); +C_ASSERT(sizeof(struct event) == 16); struct mutex { int tid; int count; /* recursion count */ + int ref; + int last_pid; }; -C_ASSERT(sizeof(struct mutex) == 8); +C_ASSERT(sizeof(struct mutex) == 16); static char shm_name[29]; static int shm_fd; @@ -218,8 +224,8 @@ static pthread_mutex_t shm_addrs_mutex = PTHREAD_MUTEX_INITIALIZER; static void *get_shm( unsigned int idx ) { - int entry = (idx * 8) / pagesize; - int offset = (idx * 8) % pagesize; + int entry = (idx * 16) / pagesize; + int offset = (idx * 16) % pagesize; void *ret; pthread_mutex_lock( &shm_addrs_mutex ); @@ -306,6 +312,59 @@ static void add_to_list( HANDLE handle, enum fsync_type type, unsigned int shm_i __atomic_store_n( (uint64_t *)&fsync_list[entry][idx], *(uint64_t *)&cache, __ATOMIC_SEQ_CST ); } +static void grab_object( struct fsync *obj ) +{ + int *shm = obj->shm; + + __atomic_add_fetch( &shm[2], 1, __ATOMIC_SEQ_CST ); +} + +static unsigned int shm_index_from_shm( char *shm ) +{ + unsigned int count = shm_addrs_size; + unsigned int i, idx_offset; + + for (i = 0; i < count; ++i) + { + if (shm >= (char *)shm_addrs[i] && shm < (char *)shm_addrs[i] + pagesize) + { + idx_offset = (shm - (char *)shm_addrs[i]) / 16; + return i * (pagesize / 16) + idx_offset; + } + } + + ERR( "Index for shm %p not found.\n", shm ); + return ~0u; +} + +static void put_object( struct fsync *obj ) +{ + int *shm = obj->shm; + + if (__atomic_load_n( &shm[2], __ATOMIC_SEQ_CST ) == 1) + { + /* We are holding the last reference, it should be released on server so shm idx get freed. */ + SERVER_START_REQ( fsync_free_shm_idx ) + { + req->shm_idx = shm_index_from_shm( obj->shm ); + wine_server_call( req ); + } + SERVER_END_REQ; + } + else + { + __atomic_sub_fetch( &shm[2], 1, __ATOMIC_SEQ_CST ); + } +} + +static void put_object_from_wait( struct fsync *obj ) +{ + int *shm = obj->shm; + + __sync_val_compare_and_swap( &shm[3], GetCurrentProcessId(), 0 ); + put_object( obj ); +} + static BOOL get_cached_object( HANDLE handle, struct fsync *obj ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); @@ -320,10 +379,13 @@ static BOOL get_cached_object( HANDLE handle, struct fsync *obj ) obj->type = cache.type; obj->shm = get_shm( cache.shm_idx ); - if (*(uint64_t *)&cache != __atomic_load_n( (uint64_t *)&fsync_list[entry][idx], __ATOMIC_SEQ_CST )) + grab_object( obj ); + if (((int *)obj->shm)[2] < 2 || + *(uint64_t *)&cache != __atomic_load_n( (uint64_t *)&fsync_list[entry][idx], __ATOMIC_SEQ_CST )) { /* This check does not strictly guarantee that we avoid the potential race but is supposed to greatly * reduce the probability of that. */ + put_object( obj ); FIXME( "Cache changed while getting object.\n" ); goto again; } @@ -371,9 +433,24 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) obj->type = type; obj->shm = get_shm( shm_idx ); add_to_list( handle, type, shm_idx ); + /* get_fsync_idx server request increments shared mem refcount, so not grabbing object here. */ return ret; } +static NTSTATUS get_object_for_wait( HANDLE handle, struct fsync *obj ) +{ + NTSTATUS ret; + int *shm; + + if ((ret = get_object( handle, obj ))) return ret; + + shm = obj->shm; + /* Give wineserver a chance to cleanup shm index if the process + * is killed while we are waiting on the object. */ + __atomic_store_n( &shm[3], GetCurrentProcessId(), __ATOMIC_SEQ_CST ); + return STATUS_SUCCESS; +} + NTSTATUS fsync_close( HANDLE handle ) { UINT_PTR entry, idx = handle_to_index( handle, &entry ); @@ -540,13 +617,17 @@ NTSTATUS fsync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) { current = semaphore->count; if (count + current > semaphore->max) + { + put_object( &obj ); return STATUS_SEMAPHORE_LIMIT_EXCEEDED; + } } while (__sync_val_compare_and_swap( &semaphore->count, current, count + current ) != current); if (prev) *prev = current; futex_wake( &semaphore->count, INT_MAX ); + put_object( &obj ); return STATUS_SUCCESS; } @@ -566,6 +647,7 @@ NTSTATUS fsync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ) out->MaximumCount = semaphore->max; if (ret_len) *ret_len = sizeof(*out); + put_object( &obj ); return STATUS_SUCCESS; } @@ -602,13 +684,17 @@ NTSTATUS fsync_set_event( HANDLE handle, LONG *prev ) event = obj.shm; if (obj.type != FSYNC_MANUAL_EVENT && obj.type != FSYNC_AUTO_EVENT) + { + put_object( &obj ); return STATUS_OBJECT_TYPE_MISMATCH; + } if (!(current = __atomic_exchange_n( &event->signaled, 1, __ATOMIC_SEQ_CST ))) futex_wake( &event->signaled, INT_MAX ); if (prev) *prev = current; + put_object( &obj ); return STATUS_SUCCESS; } @@ -628,6 +714,7 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) if (prev) *prev = current; + put_object( &obj ); return STATUS_SUCCESS; } @@ -657,6 +744,7 @@ NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ) if (prev) *prev = current; + put_object( &obj ); return STATUS_SUCCESS; } @@ -676,6 +764,7 @@ NTSTATUS fsync_query_event( HANDLE handle, void *info, ULONG *ret_len ) out->EventType = (obj.type == FSYNC_AUTO_EVENT ? SynchronizationEvent : NotificationEvent); if (ret_len) *ret_len = sizeof(*out); + put_object( &obj ); return STATUS_SUCCESS; } @@ -708,7 +797,11 @@ NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) if ((ret = get_object( handle, &obj ))) return ret; mutex = obj.shm; - if (mutex->tid != GetCurrentThreadId()) return STATUS_MUTANT_NOT_OWNED; + if (mutex->tid != GetCurrentThreadId()) + { + put_object( &obj ); + return STATUS_MUTANT_NOT_OWNED; + } if (prev) *prev = mutex->count; @@ -718,6 +811,7 @@ NTSTATUS fsync_release_mutex( HANDLE handle, LONG *prev ) futex_wake( &mutex->tid, INT_MAX ); } + put_object( &obj ); return STATUS_SUCCESS; } @@ -738,6 +832,7 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) out->AbandonedState = (mutex->tid == ~0); if (ret_len) *ret_len = sizeof(*out); + put_object( &obj ); return STATUS_SUCCESS; } @@ -776,6 +871,14 @@ static NTSTATUS do_single_wait( int *addr, int val, const struct timespec64 *end return STATUS_PENDING; } +static void put_objects( struct fsync *objs, unsigned int count ) +{ + unsigned int i; + + for (i = 0; i < count; ++i) + if (objs[i].type) put_object_from_wait( &objs[i] ); +} + static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any, BOOLEAN alertable, const LARGE_INTEGER *timeout ) { @@ -814,7 +917,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) { - ret = get_object( handles[i], &objs[i] ); + ret = get_object_for_wait( handles[i], &objs[i] ); if (ret == STATUS_SUCCESS) { assert( objs[i].type ); @@ -828,6 +931,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, } else { + put_objects( objs, i ); return ret; } } @@ -838,7 +942,10 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (has_fsync && has_server) FIXME("Can't wait on fsync and server objects at the same time!\n"); else if (has_server) + { + put_objects( objs, count ); return STATUS_NOT_IMPLEMENTED; + } if (TRACE_ON(fsync)) { @@ -893,6 +1000,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { TRACE("Woken up by handle %p [%d].\n", handles[i], i); if (waited) simulate_sched_quantum(); + put_objects( objs, count ); return i; } futex_vector_set( &futexes[i], &semaphore->count, 0 ); @@ -908,6 +1016,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count++; if (waited) simulate_sched_quantum(); + put_objects( objs, count ); return i; } @@ -916,12 +1025,14 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count = 1; if (waited) simulate_sched_quantum(); + put_objects( objs, count ); return i; } else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, GetCurrentThreadId() )) == ~0) { TRACE("Woken up by abandoned mutex %p [%d].\n", handles[i], i); mutex->count = 1; + put_objects( objs, count ); return STATUS_ABANDONED_WAIT_0 + i; } @@ -940,6 +1051,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Woken up by handle %p [%d].\n", handles[i], i); if (waited) simulate_sched_quantum(); + put_objects( objs, count ); return i; } futex_vector_set( &futexes[i], &event->signaled, 0 ); @@ -958,6 +1070,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, TRACE("Woken up by handle %p [%d].\n", handles[i], i); if (waited) simulate_sched_quantum(); + put_objects( objs, count ); return i; } futex_vector_set( &futexes[i], &event->signaled, 0 ); @@ -992,6 +1105,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, /* Unlike esync, we already know that we've timed out, so we * can avoid a syscall. */ TRACE("Wait timed out.\n"); + put_objects( objs, count ); return STATUS_TIMEOUT; } @@ -1004,6 +1118,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (ret == -1 && errno == ETIMEDOUT) { TRACE("Wait timed out.\n"); + put_objects( objs, count ); return STATUS_TIMEOUT; } else waited = TRUE; @@ -1078,6 +1193,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (status == STATUS_TIMEOUT) { TRACE("Wait timed out.\n"); + put_objects( objs, count ); return status; } else if (status == STATUS_USER_APC) @@ -1167,9 +1283,11 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, if (abandoned) { TRACE("Wait successful, but some object(s) were abandoned.\n"); + put_objects( objs, count ); return STATUS_ABANDONED; } TRACE("Wait successful.\n"); + put_objects( objs, count ); return STATUS_SUCCESS; tooslow: @@ -1214,6 +1332,8 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, userapc: TRACE("Woken up by user APC.\n"); + put_objects( objs, count ); + /* We have to make a server call anyway to get the APC to execute, so just * delegate down to server_wait(). */ ret = server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, &zero ); @@ -1253,10 +1373,14 @@ NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an struct fsync obj; NTSTATUS ret; - if (count && !get_object( handles[count - 1], &obj ) && obj.type == FSYNC_QUEUE) + if (count && !get_object( handles[count - 1], &obj )) { - msgwait = TRUE; - server_set_msgwait( 1 ); + if (obj.type == FSYNC_QUEUE) + { + msgwait = TRUE; + server_set_msgwait( 1 ); + } + put_object( &obj ); } ret = __fsync_wait_objects( count, handles, wait_any, alertable, timeout ); @@ -1288,8 +1412,10 @@ NTSTATUS fsync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, ret = fsync_release_mutex( signal, NULL ); break; default: - return STATUS_OBJECT_TYPE_MISMATCH; + ret = STATUS_OBJECT_TYPE_MISMATCH; + break; } + put_object( &obj ); if (ret) return ret; return fsync_wait_objects( 1, &wait, TRUE, alertable, timeout ); diff --git a/server/fsync.c b/server/fsync.c index 3c1e709d7e3..0e3862389da 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -205,8 +205,8 @@ static void fsync_destroy( struct object *obj ) static void *get_shm( unsigned int idx ) { - int entry = (idx * 8) / pagesize; - int offset = (idx * 8) % pagesize; + int entry = (idx * 16) / pagesize; + int offset = (idx * 16) % pagesize; if (entry >= shm_addrs_size) { @@ -287,7 +287,7 @@ unsigned int fsync_alloc_shm( int low, int high ) shm_idx = alloc_shm_idx_from_word( old_size ); } - while (shm_idx * 8 >= shm_size) + while (shm_idx * 16 >= shm_size) { /* Better expand the shm section. */ shm_size += pagesize; @@ -303,6 +303,8 @@ unsigned int fsync_alloc_shm( int low, int high ) assert(shm); shm[0] = low; shm[1] = high; + shm[2] = 1; /* Reference count. */ + shm[3] = 0; /* Last reference process id. */ return shm_idx; #else @@ -314,9 +316,24 @@ void fsync_free_shm_idx( int shm_idx ) { unsigned int idx; uint64_t mask; + int *shm; assert( shm_idx ); assert( shm_idx < shm_idx_free_map_size * BITS_IN_FREE_MAP_WORD ); + + shm = get_shm( shm_idx ); + if (shm[2] <= 0) + { + fprintf( stderr, "wineserver: fsync err: shm refcount is %d.\n", shm[2] ); + return; + } + + if (__atomic_sub_fetch( &shm[2], 1, __ATOMIC_SEQ_CST )) + { + /* Sync object is still referenced in a process. */ + return; + } + idx = shm_idx / BITS_IN_FREE_MAP_WORD; mask = (uint64_t)1 << (shm_idx % BITS_IN_FREE_MAP_WORD); assert( !(shm_idx_free_map[idx] & mask) ); @@ -325,6 +342,31 @@ void fsync_free_shm_idx( int shm_idx ) shm_idx_free_search_start_hint = idx; } +/* Try to cleanup the shared mem indices locked by the wait on the killed processes. + * This is not fully reliable but should avoid leaking the majority of indices on + * process kill. */ +void fsync_cleanup_process_shm_indices( process_id_t id ) +{ + uint64_t free_word; + unsigned int i, j; + void *shmbase; + int *shm; + + for (i = 0; i < shm_idx_free_map_size; ++i) + { + free_word = shm_idx_free_map[i]; + if (free_word == ~(uint64_t)0) continue; + shmbase = get_shm( i * BITS_IN_FREE_MAP_WORD ); + for (j = !i; j < BITS_IN_FREE_MAP_WORD; ++j) + { + shm = (int *)((char *)shmbase + j * 16); + if (!(free_word & ((uint64_t)1 << j)) && shm[3] == id + && __atomic_load_n( &shm[2], __ATOMIC_SEQ_CST ) == 1) + fsync_free_shm_idx( i * BITS_IN_FREE_MAP_WORD + j ); + } + } +} + static int type_matches( enum fsync_type type1, enum fsync_type type2 ) { return (type1 == type2) || @@ -384,6 +426,8 @@ struct fsync_event { int signaled; int unused; + int ref; + int last_pid; }; void fsync_wake_futex( unsigned int shm_idx ) @@ -551,8 +595,12 @@ DECL_HANDLER(get_fsync_idx) if (obj->ops->get_fsync_idx) { + int *shm; + reply->shm_idx = obj->ops->get_fsync_idx( obj, &type ); reply->type = type; + shm = get_shm( reply->shm_idx ); + __atomic_add_fetch( &shm[2], 1, __ATOMIC_SEQ_CST ); } else { @@ -571,3 +619,13 @@ DECL_HANDLER(get_fsync_apc_idx) { reply->shm_idx = current->fsync_apc_idx; } + +DECL_HANDLER(fsync_free_shm_idx) +{ + if (!req->shm_idx || req->shm_idx >= shm_idx_free_map_size * BITS_IN_FREE_MAP_WORD) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + fsync_free_shm_idx( req->shm_idx ); +} diff --git a/server/fsync.h b/server/fsync.h index ee1a729e77e..d4bd889a7f8 100644 --- a/server/fsync.h +++ b/server/fsync.h @@ -33,3 +33,4 @@ extern const struct object_ops fsync_ops; extern void fsync_set_event( struct fsync *fsync ); extern void fsync_reset_event( struct fsync *fsync ); extern void fsync_abandon_mutexes( struct thread *thread ); +extern void fsync_cleanup_process_shm_indices( process_id_t id ); diff --git a/server/process.c b/server/process.c index d43df3d15f6..8b867a26c8a 100644 --- a/server/process.c +++ b/server/process.c @@ -805,7 +805,11 @@ static void process_destroy( struct object *obj ) free( process->dir_cache ); free( process->image ); if (do_esync()) close( process->esync_fd ); - if (process->fsync_idx) fsync_free_shm_idx( process->fsync_idx ); + if (process->fsync_idx) + { + fsync_cleanup_process_shm_indices( process->id ); + fsync_free_shm_idx( process->fsync_idx ); + } } /* dump a process on stdout for debugging purposes */ diff --git a/server/protocol.def b/server/protocol.def index 2d91baf245a..9d211b683eb 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -4045,3 +4045,8 @@ enum fsync_type @REPLY unsigned int shm_idx; @END + +@REQ(fsync_free_shm_idx) + unsigned int shm_idx; +@REPLY +@END From 3b2446833d393a9e5a3e9bab4a03cbb671560def Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 1 Aug 2022 10:53:28 -0500 Subject: [PATCH 0563/1506] fsync: Increase shm page size. CW-Bug-Id: #21050 --- dlls/ntdll/unix/fsync.c | 19 +++++++++---------- server/fsync.c | 19 +++++++++---------- server/protocol.def | 2 ++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 309e2eb2aff..e709f2cbc00 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -218,14 +218,13 @@ static char shm_name[29]; static int shm_fd; static void **shm_addrs; static int shm_addrs_size; /* length of the allocated shm_addrs array */ -static long pagesize; static pthread_mutex_t shm_addrs_mutex = PTHREAD_MUTEX_INITIALIZER; static void *get_shm( unsigned int idx ) { - int entry = (idx * 16) / pagesize; - int offset = (idx * 16) % pagesize; + int entry = (idx * 16) / FSYNC_SHM_PAGE_SIZE; + int offset = (idx * 16) % FSYNC_SHM_PAGE_SIZE; void *ret; pthread_mutex_lock( &shm_addrs_mutex ); @@ -242,14 +241,16 @@ static void *get_shm( unsigned int idx ) if (!shm_addrs[entry]) { - void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize ); + void *addr = mmap( NULL, FSYNC_SHM_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, + (off_t)entry * FSYNC_SHM_PAGE_SIZE ); if (addr == (void *)-1) - ERR("Failed to map page %d (offset %#lx).\n", entry, entry * pagesize); + ERR("Failed to map page %d (offset %s).\n", entry, + wine_dbgstr_longlong((off_t)entry * FSYNC_SHM_PAGE_SIZE)); TRACE("Mapping page %d at %p.\n", entry, addr); if (__sync_val_compare_and_swap( &shm_addrs[entry], 0, addr )) - munmap( addr, pagesize ); /* someone beat us to it */ + munmap( addr, FSYNC_SHM_PAGE_SIZE ); /* someone beat us to it */ } ret = (void *)((unsigned long)shm_addrs[entry] + offset); @@ -326,10 +327,10 @@ static unsigned int shm_index_from_shm( char *shm ) for (i = 0; i < count; ++i) { - if (shm >= (char *)shm_addrs[i] && shm < (char *)shm_addrs[i] + pagesize) + if (shm >= (char *)shm_addrs[i] && shm < (char *)shm_addrs[i] + FSYNC_SHM_PAGE_SIZE) { idx_offset = (shm - (char *)shm_addrs[i]) / 16; - return i * (pagesize / 16) + idx_offset; + return i * (FSYNC_SHM_PAGE_SIZE / 16) + idx_offset; } } @@ -578,8 +579,6 @@ void fsync_init(void) exit(1); } - pagesize = sysconf( _SC_PAGESIZE ); - shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); shm_addrs_size = 128; } diff --git a/server/fsync.c b/server/fsync.c index 0e3862389da..dc50aa0a1f3 100644 --- a/server/fsync.c +++ b/server/fsync.c @@ -73,7 +73,6 @@ static int shm_fd; static off_t shm_size; static void **shm_addrs; static int shm_addrs_size; /* length of the allocated shm_addrs array */ -static long pagesize; static int is_fsync_initialized; @@ -109,12 +108,10 @@ void fsync_init(void) if (shm_fd == -1) perror( "shm_open" ); - pagesize = sysconf( _SC_PAGESIZE ); - shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); shm_addrs_size = 128; - shm_size = pagesize; + shm_size = FSYNC_SHM_PAGE_SIZE; if (ftruncate( shm_fd, shm_size ) == -1) perror( "ftruncate" ); @@ -205,8 +202,8 @@ static void fsync_destroy( struct object *obj ) static void *get_shm( unsigned int idx ) { - int entry = (idx * 16) / pagesize; - int offset = (idx * 16) % pagesize; + int entry = (idx * 16) / FSYNC_SHM_PAGE_SIZE; + int offset = (idx * 16) % FSYNC_SHM_PAGE_SIZE; if (entry >= shm_addrs_size) { @@ -222,10 +219,12 @@ static void *get_shm( unsigned int idx ) if (!shm_addrs[entry]) { - void *addr = mmap( NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, entry * pagesize ); + void *addr = mmap( NULL, FSYNC_SHM_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, + (off_t)entry * FSYNC_SHM_PAGE_SIZE ); if (addr == (void *)-1) { - fprintf( stderr, "fsync: failed to map page %d (offset %#lx): ", entry, entry * pagesize ); + fprintf( stderr, "fsync: failed to map page %d (offset %#zx): ", + entry, (size_t)entry * FSYNC_SHM_PAGE_SIZE ); perror( "mmap" ); } @@ -233,7 +232,7 @@ static void *get_shm( unsigned int idx ) fprintf( stderr, "fsync: Mapping page %d at %p.\n", entry, addr ); if (__sync_val_compare_and_swap( &shm_addrs[entry], 0, addr )) - munmap( addr, pagesize ); /* someone beat us to it */ + munmap( addr, FSYNC_SHM_PAGE_SIZE ); /* someone beat us to it */ } return (void *)((unsigned long)shm_addrs[entry] + offset); @@ -290,7 +289,7 @@ unsigned int fsync_alloc_shm( int low, int high ) while (shm_idx * 16 >= shm_size) { /* Better expand the shm section. */ - shm_size += pagesize; + shm_size += FSYNC_SHM_PAGE_SIZE; if (ftruncate( shm_fd, shm_size ) == -1) { fprintf( stderr, "fsync: couldn't expand %s to size %jd: ", diff --git a/server/protocol.def b/server/protocol.def index 9d211b683eb..311265289bd 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3992,6 +3992,8 @@ enum esync_type @REQ(get_esync_apc_fd) @END +#define FSYNC_SHM_PAGE_SIZE 0x10000 + enum fsync_type { FSYNC_SEMAPHORE = 1, From 75ec6162846bbcf9c0d59a6e72221c15207139e3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 1 Aug 2022 11:01:51 -0500 Subject: [PATCH 0564/1506] fsync: Use static shm_addrs array and get rid of locking in get_shm(). CW-Bug-Id: #21050 --- dlls/ntdll/unix/fsync.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index e709f2cbc00..be27906a37c 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -216,27 +216,18 @@ C_ASSERT(sizeof(struct mutex) == 16); static char shm_name[29]; static int shm_fd; -static void **shm_addrs; -static int shm_addrs_size; /* length of the allocated shm_addrs array */ - -static pthread_mutex_t shm_addrs_mutex = PTHREAD_MUTEX_INITIALIZER; +static volatile void *shm_addrs[8192]; static void *get_shm( unsigned int idx ) { int entry = (idx * 16) / FSYNC_SHM_PAGE_SIZE; int offset = (idx * 16) % FSYNC_SHM_PAGE_SIZE; - void *ret; - - pthread_mutex_lock( &shm_addrs_mutex ); - if (entry >= shm_addrs_size) + if (entry >= ARRAY_SIZE(shm_addrs)) { - int new_size = max(shm_addrs_size * 2, entry + 1); - - if (!(shm_addrs = realloc( shm_addrs, new_size * sizeof(shm_addrs[0]) ))) - ERR("Failed to grow shm_addrs array to size %d.\n", shm_addrs_size); - memset( shm_addrs + shm_addrs_size, 0, (new_size - shm_addrs_size) * sizeof(shm_addrs[0]) ); - shm_addrs_size = new_size; + ERR( "idx %u exceeds maximum of %u.\n", idx, + (unsigned int)ARRAY_SIZE(shm_addrs) * (FSYNC_SHM_PAGE_SIZE / 16) ); + return NULL; } if (!shm_addrs[entry]) @@ -253,11 +244,7 @@ static void *get_shm( unsigned int idx ) munmap( addr, FSYNC_SHM_PAGE_SIZE ); /* someone beat us to it */ } - ret = (void *)((unsigned long)shm_addrs[entry] + offset); - - pthread_mutex_unlock( &shm_addrs_mutex ); - - return ret; + return (char *)shm_addrs[entry] + offset; } /* We'd like lookup to be fast. To that end, we use a static list indexed by handle. @@ -322,10 +309,9 @@ static void grab_object( struct fsync *obj ) static unsigned int shm_index_from_shm( char *shm ) { - unsigned int count = shm_addrs_size; unsigned int i, idx_offset; - for (i = 0; i < count; ++i) + for (i = 0; i < ARRAY_SIZE(shm_addrs); ++i) { if (shm >= (char *)shm_addrs[i] && shm < (char *)shm_addrs[i] + FSYNC_SHM_PAGE_SIZE) { @@ -578,9 +564,6 @@ void fsync_init(void) ERR("Failed to initialize shared memory: %s\n", strerror( errno )); exit(1); } - - shm_addrs = calloc( 128, sizeof(shm_addrs[0]) ); - shm_addrs_size = 128; } NTSTATUS fsync_create_semaphore( HANDLE *handle, ACCESS_MASK access, From 7d02e2264a8595175610a058f206e7d639bf8232 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 16 Aug 2022 12:34:09 -0500 Subject: [PATCH 0565/1506] esync, fsync: Support waiting on file handles. CW-Bug-Id: #21132 --- server/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/file.c b/server/file.c index 5be9578ce48..500ffcac153 100644 --- a/server/file.c +++ b/server/file.c @@ -94,8 +94,8 @@ static const struct object_ops file_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ default_fd_signaled, /* signaled */ - NULL, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + default_fd_get_esync_fd, /* get_esync_fd */ + default_fd_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ file_get_fd, /* get_fd */ From 8d91a44d3338699aaa42ebb33fa329ac45f668ef Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 7 Dec 2021 11:16:40 +0300 Subject: [PATCH 0566/1506] server: Split waitable object off completion port. CW-Bug-Id: #19621 --- server/completion.c | 120 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 24 deletions(-) diff --git a/server/completion.c b/server/completion.c index 33266c596da..915a083e642 100644 --- a/server/completion.c +++ b/server/completion.c @@ -56,15 +56,52 @@ struct type_descr completion_type = }, }; -struct completion +struct completion_wait { struct object obj; struct list queue; unsigned int depth; }; +struct completion +{ + struct object obj; + struct completion_wait *wait; +}; + +static void completion_wait_dump( struct object*, int ); +static int completion_wait_signaled( struct object *obj, struct wait_queue_entry *entry ); +static void completion_wait_destroy( struct object * ); + +static const struct object_ops completion_wait_ops = +{ + sizeof(struct completion_wait), /* size */ + &no_type, /* type */ + completion_wait_dump, /* dump */ + add_queue, /* add_queue */ + remove_queue, /* remove_queue */ + completion_wait_signaled, /* signaled */ + NULL, /* get_esync_fd */ + NULL, /* get_fsync_idx */ + no_satisfied, /* satisfied */ + no_signal, /* signal */ + no_get_fd, /* get_fd */ + default_map_access, /* map_access */ + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + no_get_full_name, /* get_full_name */ + no_lookup_name, /* lookup_name */ + no_link_name, /* link_name */ + NULL, /* unlink_name */ + no_open_file, /* open_file */ + no_kernel_obj_list, /* get_kernel_obj_list */ + no_close_handle, /* close_handle */ + completion_wait_destroy /* destroy */ +}; + static void completion_dump( struct object*, int ); -static int completion_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int completion_add_queue( struct object *obj, struct wait_queue_entry *entry ); +static void completion_remove_queue( struct object *obj, struct wait_queue_entry *entry ); static void completion_destroy( struct object * ); static const struct object_ops completion_ops = @@ -72,9 +109,9 @@ static const struct object_ops completion_ops = sizeof(struct completion), /* size */ &completion_type, /* type */ completion_dump, /* dump */ - add_queue, /* add_queue */ - remove_queue, /* remove_queue */ - completion_signaled, /* signaled */ + completion_add_queue, /* add_queue */ + completion_remove_queue, /* remove_queue */ + NULL, /* signaled */ NULL, /* get_esync_fd */ NULL, /* get_fsync_idx */ no_satisfied, /* satisfied */ @@ -102,30 +139,63 @@ struct comp_msg unsigned int status; }; -static void completion_destroy( struct object *obj) +static void completion_wait_destroy( struct object *obj) { - struct completion *completion = (struct completion *) obj; + struct completion_wait *wait = (struct completion_wait *)obj; struct comp_msg *tmp, *next; - LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &completion->queue, struct comp_msg, queue_entry ) + LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &wait->queue, struct comp_msg, queue_entry ) { free( tmp ); } } +static void completion_wait_dump( struct object *obj, int verbose ) +{ + struct completion_wait *wait = (struct completion_wait *)obj; + + assert( obj->ops == &completion_wait_ops ); + fprintf( stderr, "Completion depth=%u\n", wait->depth ); +} + +static int completion_wait_signaled( struct object *obj, struct wait_queue_entry *entry ) +{ + struct completion_wait *wait = (struct completion_wait *)obj; + + assert( obj->ops == &completion_wait_ops ); + return !list_empty( &wait->queue ); +} + static void completion_dump( struct object *obj, int verbose ) { - struct completion *completion = (struct completion *) obj; + struct completion *completion = (struct completion *)obj; + + assert( obj->ops == &completion_ops ); + completion->wait->obj.ops->dump( &completion->wait->obj, verbose ); +} + +static int completion_add_queue( struct object *obj, struct wait_queue_entry *entry ) +{ + struct completion *completion = (struct completion *)obj; + + assert( obj->ops == &completion_ops ); + return completion->wait->obj.ops->add_queue( &completion->wait->obj, entry ); +} + +static void completion_remove_queue( struct object *obj, struct wait_queue_entry *entry ) +{ + struct completion *completion = (struct completion *)obj; assert( obj->ops == &completion_ops ); - fprintf( stderr, "Completion depth=%u\n", completion->depth ); + completion->wait->obj.ops->remove_queue( &completion->wait->obj, entry ); } -static int completion_signaled( struct object *obj, struct wait_queue_entry *entry ) +static void completion_destroy( struct object *obj ) { struct completion *completion = (struct completion *)obj; - return !list_empty( &completion->queue ); + assert( obj->ops == &completion_ops ); + release_object( &completion->wait->obj ); } static struct completion *create_completion( struct object *root, const struct unicode_str *name, @@ -134,15 +204,17 @@ static struct completion *create_completion( struct object *root, const struct u { struct completion *completion; - if ((completion = create_named_object( root, &completion_ops, name, attr, sd ))) + if (!(completion = create_named_object( root, &completion_ops, name, attr, sd ))) return NULL; + if (get_error() == STATUS_OBJECT_NAME_EXISTS) return completion; + if (!(completion->wait = alloc_object( &completion_wait_ops ))) { - if (get_error() != STATUS_OBJECT_NAME_EXISTS) - { - list_init( &completion->queue ); - completion->depth = 0; - } + release_object( completion ); + set_error( STATUS_NO_MEMORY ); + return NULL; } + list_init( &completion->wait->queue ); + completion->wait->depth = 0; return completion; } @@ -164,9 +236,9 @@ void add_completion( struct completion *completion, apc_param_t ckey, apc_param_ msg->status = status; msg->information = information; - list_add_tail( &completion->queue, &msg->queue_entry ); - completion->depth++; - wake_up( &completion->obj, 1 ); + list_add_tail( &completion->wait->queue, &msg->queue_entry ); + completion->wait->depth++; + wake_up( &completion->wait->obj, 1 ); } /* create a completion */ @@ -220,13 +292,13 @@ DECL_HANDLER(remove_completion) if (!completion) return; - entry = list_head( &completion->queue ); + entry = list_head( &completion->wait->queue ); if (!entry) set_error( STATUS_PENDING ); else { list_remove( entry ); - completion->depth--; + completion->wait->depth--; msg = LIST_ENTRY( entry, struct comp_msg, queue_entry ); reply->ckey = msg->ckey; reply->cvalue = msg->cvalue; @@ -245,7 +317,7 @@ DECL_HANDLER(query_completion) if (!completion) return; - reply->depth = completion->depth; + reply->depth = completion->wait->depth; release_object( completion ); } From e25ed4df57731394bdb7e42d08eaf1e99507926f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 7 Dec 2021 12:27:17 +0300 Subject: [PATCH 0567/1506] server: Abandon wait when completion port is closed. CW-Bug-Id: #19621 Based on patches by Alexey Prokhin. --- dlls/ntdll/tests/sync.c | 65 +++++++++++++++++++++++++++++++++++++++++ server/completion.c | 25 ++++++++++++---- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/tests/sync.c b/dlls/ntdll/tests/sync.c index f356d3ec38f..95229f2513d 100644 --- a/dlls/ntdll/tests/sync.c +++ b/dlls/ntdll/tests/sync.c @@ -837,6 +837,70 @@ static void test_tid_alert( char **argv ) CloseHandle( pi.hThread ); } +static HANDLE test_close_io_completion_port_ready, test_close_io_completion_test_ready; +static HANDLE test_close_io_completion_port; + +static DWORD WINAPI test_close_io_completion_thread(void *param) +{ + FILE_IO_COMPLETION_INFORMATION info; + IO_STATUS_BLOCK iosb; + ULONG_PTR key, value; + NTSTATUS status; + ULONG count; + DWORD ret; + + ret = WaitForSingleObject( test_close_io_completion_port_ready, INFINITE ); + ok( ret == WAIT_OBJECT_0, "Got unexpected ret %#x.\n", ret ); + SetEvent( test_close_io_completion_test_ready ); + status = NtRemoveIoCompletion( test_close_io_completion_port, &key, &value, &iosb, NULL ); + if (status == STATUS_INVALID_HANDLE) + skip( "Handle closed before wait started.\n" ); + else + ok( status == STATUS_ABANDONED_WAIT_0, "Got unexpected status %#x.\n", status ); + + ret = WaitForSingleObject( test_close_io_completion_port_ready, INFINITE ); + ok( ret == WAIT_OBJECT_0, "Got unexpected ret %#x.\n", ret ); + SetEvent( test_close_io_completion_test_ready ); + count = 0xdeadbeef; + status = NtRemoveIoCompletionEx( test_close_io_completion_port, &info, 1, &count, NULL, FALSE ); + ok( count == 1, "Got unexpected count %u.\n", count ); + if (status == STATUS_INVALID_HANDLE) + skip( "Handle closed before wait started.\n" ); + else + ok( status == STATUS_ABANDONED_WAIT_0, "Got unexpected status %#x.\n", status ); + + return 0; +} + +static void test_close_io_completion(void) +{ + NTSTATUS status; + unsigned int i; + HANDLE thread; + DWORD ret; + + test_close_io_completion_port_ready = CreateEventA(NULL, FALSE, FALSE, NULL); + test_close_io_completion_test_ready = CreateEventA(NULL, FALSE, FALSE, NULL); + + thread = CreateThread( NULL, 0, test_close_io_completion_thread, NULL, 0, NULL ); + ok( !!thread, "Failed to create thread, error %u.\n", GetLastError() ); + + for (i = 0; i < 2; ++i) + { + status = NtCreateIoCompletion( &test_close_io_completion_port, IO_COMPLETION_ALL_ACCESS, NULL, 0 ); + ok( !status, "Got unexpected status %#x.\n", status ); + ret = SignalObjectAndWait( test_close_io_completion_port_ready, test_close_io_completion_test_ready, + INFINITE, FALSE ); + ok( ret == WAIT_OBJECT_0, "Got unexpected ret %#x.\n", ret ); + Sleep(10); + status = pNtClose( test_close_io_completion_port ); + ok( !status, "Got unexpected status %#x.\n", status ); + } + + WaitForSingleObject( thread, INFINITE ); + CloseHandle( thread ); +} + START_TEST(sync) { HMODULE module = GetModuleHandleA("ntdll.dll"); @@ -884,4 +948,5 @@ START_TEST(sync) test_keyed_events(); test_resource(); test_tid_alert( argv ); + test_close_io_completion(); } diff --git a/server/completion.c b/server/completion.c index 915a083e642..1d70897db83 100644 --- a/server/completion.c +++ b/server/completion.c @@ -56,11 +56,14 @@ struct type_descr completion_type = }, }; +struct completion; + struct completion_wait { - struct object obj; - struct list queue; - unsigned int depth; + struct object obj; + struct completion *completion; + struct list queue; + unsigned int depth; }; struct completion @@ -71,6 +74,7 @@ struct completion static void completion_wait_dump( struct object*, int ); static int completion_wait_signaled( struct object *obj, struct wait_queue_entry *entry ); +static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ); static void completion_wait_destroy( struct object * ); static const struct object_ops completion_wait_ops = @@ -83,7 +87,7 @@ static const struct object_ops completion_wait_ops = completion_wait_signaled, /* signaled */ NULL, /* get_esync_fd */ NULL, /* get_fsync_idx */ - no_satisfied, /* satisfied */ + completion_wait_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ default_map_access, /* map_access */ @@ -163,7 +167,15 @@ static int completion_wait_signaled( struct object *obj, struct wait_queue_entry struct completion_wait *wait = (struct completion_wait *)obj; assert( obj->ops == &completion_wait_ops ); - return !list_empty( &wait->queue ); + return !wait->completion || !list_empty( &wait->queue ); +} + +static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ) +{ + struct completion_wait *wait = (struct completion_wait *)obj; + + assert( obj->ops == &completion_wait_ops ); + if (!wait->completion) make_wait_abandoned( entry ); } static void completion_dump( struct object *obj, int verbose ) @@ -195,6 +207,8 @@ static void completion_destroy( struct object *obj ) struct completion *completion = (struct completion *)obj; assert( obj->ops == &completion_ops ); + completion->wait->completion = NULL; + wake_up( &completion->wait->obj, 0 ); release_object( &completion->wait->obj ); } @@ -213,6 +227,7 @@ static struct completion *create_completion( struct object *root, const struct u return NULL; } + completion->wait->completion = completion; list_init( &completion->wait->queue ); completion->wait->depth = 0; return completion; From fbb56d336a7817009144113fb93995033a801e10 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 7 Dec 2021 13:33:01 +0300 Subject: [PATCH 0568/1506] server: Ensure completion port wait object exists after successful wait. CW-Bug-Id: #19621 Based on the problem analysis by Andrew Eikum. --- dlls/ntdll/unix/sync.c | 6 ++++++ server/completion.c | 36 ++++++++++++++++++++++++++++++------ server/protocol.def | 1 + server/thread.c | 2 ++ server/thread.h | 1 + 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 388eb2508d9..f83a81afd9a 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -2014,6 +2014,7 @@ NTSTATUS WINAPI NtRemoveIoCompletion( HANDLE handle, ULONG_PTR *key, ULONG_PTR * IO_STATUS_BLOCK *io, LARGE_INTEGER *timeout ) { unsigned int status; + int waited = 0; TRACE( "(%p, %p, %p, %p, %p)\n", handle, key, value, io, timeout ); @@ -2022,6 +2023,7 @@ NTSTATUS WINAPI NtRemoveIoCompletion( HANDLE handle, ULONG_PTR *key, ULONG_PTR * SERVER_START_REQ( remove_completion ) { req->handle = wine_server_obj_handle( handle ); + req->waited = waited; if (!(status = wine_server_call( req ))) { *key = reply->ckey; @@ -2034,6 +2036,7 @@ NTSTATUS WINAPI NtRemoveIoCompletion( HANDLE handle, ULONG_PTR *key, ULONG_PTR * if (status != STATUS_PENDING) return status; status = NtWaitForSingleObject( handle, FALSE, timeout ); if (status != WAIT_OBJECT_0) return status; + waited = 1; } } @@ -2045,6 +2048,7 @@ NTSTATUS WINAPI NtRemoveIoCompletionEx( HANDLE handle, FILE_IO_COMPLETION_INFORM ULONG *written, LARGE_INTEGER *timeout, BOOLEAN alertable ) { unsigned int status; + int waited = 0; ULONG i = 0; TRACE( "%p %p %u %p %p %u\n", handle, info, (int)count, written, timeout, alertable ); @@ -2056,6 +2060,7 @@ NTSTATUS WINAPI NtRemoveIoCompletionEx( HANDLE handle, FILE_IO_COMPLETION_INFORM SERVER_START_REQ( remove_completion ) { req->handle = wine_server_obj_handle( handle ); + req->waited = waited; if (!(status = wine_server_call( req ))) { info[i].CompletionKey = reply->ckey; @@ -2075,6 +2080,7 @@ NTSTATUS WINAPI NtRemoveIoCompletionEx( HANDLE handle, FILE_IO_COMPLETION_INFORM } status = NtWaitForSingleObject( handle, alertable, timeout ); if (status != WAIT_OBJECT_0) break; + waited = 1; } *written = i ? i : 1; return status; diff --git a/server/completion.c b/server/completion.c index 1d70897db83..cbafe811796 100644 --- a/server/completion.c +++ b/server/completion.c @@ -173,9 +173,16 @@ static int completion_wait_signaled( struct object *obj, struct wait_queue_entry static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct completion_wait *wait = (struct completion_wait *)obj; + struct thread *thread; assert( obj->ops == &completion_wait_ops ); - if (!wait->completion) make_wait_abandoned( entry ); + if (wait->completion) + { + thread = get_wait_queue_thread( entry ); + if (thread->locked_completion) release_object( thread->locked_completion ); + thread->locked_completion = grab_object( obj ); + } + else make_wait_abandoned( entry ); } static void completion_dump( struct object *obj, int verbose ) @@ -301,19 +308,36 @@ DECL_HANDLER(add_completion) /* get completion from completion port */ DECL_HANDLER(remove_completion) { - struct completion* completion = get_completion_obj( current->process, req->handle, IO_COMPLETION_MODIFY_STATE ); + struct completion* completion; + struct completion_wait *wait; struct list *entry; struct comp_msg *msg; - if (!completion) return; + if (req->waited && (wait = (struct completion_wait *)current->locked_completion)) + current->locked_completion = NULL; + else + { + if (current->locked_completion) + { + release_object( current->locked_completion ); + current->locked_completion = NULL; + } + completion = get_completion_obj( current->process, req->handle, IO_COMPLETION_MODIFY_STATE ); + if (!completion) return; + + wait = (struct completion_wait *)grab_object( completion->wait ); + release_object( completion ); + } - entry = list_head( &completion->wait->queue ); + assert( wait->obj.ops == &completion_wait_ops ); + + entry = list_head( &wait->queue ); if (!entry) set_error( STATUS_PENDING ); else { list_remove( entry ); - completion->wait->depth--; + wait->depth--; msg = LIST_ENTRY( entry, struct comp_msg, queue_entry ); reply->ckey = msg->ckey; reply->cvalue = msg->cvalue; @@ -322,7 +346,7 @@ DECL_HANDLER(remove_completion) free( msg ); } - release_object( completion ); + release_object( wait ); } /* get queue depth for completion port */ diff --git a/server/protocol.def b/server/protocol.def index 311265289bd..d8265e7dcb6 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3705,6 +3705,7 @@ struct handle_info /* get completion from completion port queue */ @REQ(remove_completion) obj_handle_t handle; /* port handle */ + int waited; /* port was just successfully waited on */ @REPLY apc_param_t ckey; /* completion key */ apc_param_t cvalue; /* completion value */ diff --git a/server/thread.c b/server/thread.c index 21de26a194f..6745b257a7a 100644 --- a/server/thread.c +++ b/server/thread.c @@ -298,6 +298,7 @@ static inline void init_thread_structure( struct thread *thread ) thread->creation_time = current_time; thread->exit_time = 0; + thread->locked_completion = NULL; list_init( &thread->mutex_list ); list_init( &thread->system_apc ); @@ -579,6 +580,7 @@ static void destroy_thread( struct object *obj ) release_object( thread->process ); if (thread->id) free_ptid( thread->id ); if (thread->token) release_object( thread->token ); + if (thread->locked_completion) release_object( thread->locked_completion ); if (do_esync()) close( thread->esync_fd ); diff --git a/server/thread.h b/server/thread.h index 041eb000171..dbd2e32c0f6 100644 --- a/server/thread.h +++ b/server/thread.h @@ -94,6 +94,7 @@ struct thread struct list kernel_object; /* list of kernel object pointers */ data_size_t desc_len; /* thread description length in bytes */ WCHAR *desc; /* thread description string */ + struct object *locked_completion; /* completion port wait object successfully waited by the thread */ struct object *queue_shared_mapping; /* thread queue shared memory mapping */ queue_shm_t *queue_shared; /* thread queue shared memory ptr */ struct object *input_shared_mapping; /* thread input shared memory mapping */ From 8dde1bb89bd226e1077a9cb1a11c8b2c01d6d98b Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Thu, 23 Apr 2020 12:29:55 +0300 Subject: [PATCH 0569/1506] kernelbase: Set the proper error code in GetQueuedCompletionStatus{Ex} when the handle is closed. Planet Zoo relies on it being ERROR_ABANDONED_WAIT_0. --- dlls/kernelbase/sync.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c index b2086207caa..406af74c269 100644 --- a/dlls/kernelbase/sync.c +++ b/dlls/kernelbase/sync.c @@ -1172,6 +1172,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetQueuedCompletionStatus( HANDLE port, LPDWORD co } if (status == STATUS_TIMEOUT) SetLastError( WAIT_TIMEOUT ); + else if (status == ERROR_WAIT_NO_CHILDREN) SetLastError( ERROR_ABANDONED_WAIT_0 ); else SetLastError( RtlNtStatusToDosError(status) ); return FALSE; } @@ -1193,6 +1194,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetQueuedCompletionStatusEx( HANDLE port, OVERLAPP if (ret == STATUS_SUCCESS) return TRUE; else if (ret == STATUS_TIMEOUT) SetLastError( WAIT_TIMEOUT ); else if (ret == STATUS_USER_APC) SetLastError( WAIT_IO_COMPLETION ); + else if (ret == ERROR_WAIT_NO_CHILDREN) SetLastError( ERROR_ABANDONED_WAIT_0 ); else SetLastError( RtlNtStatusToDosError(ret) ); return FALSE; } From 9dd028203dc6122bd62d0005d4a46c285fb1b710 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 17 Aug 2022 18:22:35 -0500 Subject: [PATCH 0570/1506] ntdll: Enable WINE_FSYNC_SIMULATE_SCHED_QUANTUM for Planet Zoo. CW-Bug-Id: #21142 --- dlls/ntdll/unix/loader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c1d7ff801d4..a0b27a3dd3c 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1937,7 +1937,10 @@ static void hacks_init(void) if (env_str) fsync_simulate_sched_quantum = !!atoi(env_str); else if (main_argc > 1) + { fsync_simulate_sched_quantum = !!strstr(main_argv[1], "Ubisoft Game Launcher\\upc.exe"); + fsync_simulate_sched_quantum = fsync_simulate_sched_quantum || !!strstr(main_argv[1], "PlanetZoo.exe"); + } if (fsync_simulate_sched_quantum) ERR("HACK: Simulating sched quantum in fsync.\n"); From cfa7ea534040f7513da90f7013433dd3969a49a8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 9 Sep 2022 17:37:39 -0500 Subject: [PATCH 0571/1506] ntdll: Enable WINE_FSYNC_SIMULATE_SCHED_QUANTUM for GTA5. CW-Bug-Id: #21194 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index a0b27a3dd3c..8d8c1700937 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1940,6 +1940,7 @@ static void hacks_init(void) { fsync_simulate_sched_quantum = !!strstr(main_argv[1], "Ubisoft Game Launcher\\upc.exe"); fsync_simulate_sched_quantum = fsync_simulate_sched_quantum || !!strstr(main_argv[1], "PlanetZoo.exe"); + fsync_simulate_sched_quantum = fsync_simulate_sched_quantum || !!strstr(main_argv[1], "GTA5.exe"); } if (fsync_simulate_sched_quantum) ERR("HACK: Simulating sched quantum in fsync.\n"); From ba766a27c3e186e1cd82ac9998a6bcd77aa0d471 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 9 Sep 2022 18:21:26 -0500 Subject: [PATCH 0572/1506] ntdll: HACK: Add WINE_ALERT_SIMULATE_SCHED_QUANTUM option. And enable it for GTA 5. CW-Bug-Id: #21194 --- dlls/ntdll/unix/loader.c | 11 +++++++++++ dlls/ntdll/unix/sync.c | 8 ++++++++ dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 20 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 8d8c1700937..60488301f16 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1922,6 +1922,7 @@ static ULONG_PTR get_image_address(void) BOOL ac_odyssey; BOOL fsync_simulate_sched_quantum; +BOOL alert_simulate_sched_quantum; static void hacks_init(void) { @@ -1945,6 +1946,16 @@ static void hacks_init(void) if (fsync_simulate_sched_quantum) ERR("HACK: Simulating sched quantum in fsync.\n"); + env_str = getenv("WINE_ALERT_SIMULATE_SCHED_QUANTUM"); + if (env_str) + alert_simulate_sched_quantum = !!atoi(env_str); + else if (main_argc > 1) + { + alert_simulate_sched_quantum = !!strstr(main_argv[1], "GTA5.exe"); + } + if (alert_simulate_sched_quantum) + ERR("HACK: Simulating sched quantum in NtWaitForAlertByThreadId.\n"); + switch (sgi ? atoi( sgi ) : -1) { case 25700: /* Madballs in Babo: Invasion */ diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index f83a81afd9a..ed30388b026 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -2706,6 +2706,7 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEGER *timeout ) { union tid_alert_entry *entry = get_tid_alert_entry( NtCurrentTeb()->ClientId.UniqueThread ); + BOOL waited = FALSE; NTSTATUS status; TRACE( "%p %s\n", address, debugstr_timeout( timeout ) ); @@ -2741,8 +2742,15 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG else ret = futex_wait( futex, 0, NULL ); + if (!timeout || timeout->QuadPart) + waited = TRUE; + if (ret == -1 && errno == ETIMEDOUT) return STATUS_TIMEOUT; } + + if (alert_simulate_sched_quantum && waited) + usleep(0); + return STATUS_ALERTED; } #endif diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index cc5f1ffc9e0..92668512e90 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -180,6 +180,7 @@ extern struct ldt_copy __wine_ldt_copy; extern BOOL ac_odyssey; extern BOOL fsync_simulate_sched_quantum; +extern BOOL alert_simulate_sched_quantum; extern void init_environment(void); extern void init_startup_info(void); From ce9cde9bdc535bf820e529ee29ca17e5b2fdf9c8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Dec 2022 16:21:50 -0600 Subject: [PATCH 0573/1506] ntdll: HACK: Also simulate async file read and IO cancellation for Immortals Fenyx Rising. CW-Bug-Id: #21711 --- dlls/ntdll/unix/loader.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 60488301f16..9cdfed963f8 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1929,11 +1929,15 @@ static void hacks_init(void) const char *sgi = getenv( "SteamGameId" ); const char *env_str; - if (main_argc > 1 && strstr(main_argv[1], "ACOdyssey.exe")) - { - ERR("HACK: AC Odyssey sync tweak on.\n"); + env_str = getenv("WINE_SIMULATE_ASYNC_READ"); + if (env_str) + ac_odyssey = !!atoi(env_str); + else if (main_argc > 1 && (strstr(main_argv[1], "ACOdyssey.exe") || strstr(main_argv[1], "ImmortalsFenyxRising.exe"))) ac_odyssey = TRUE; - } + + if (ac_odyssey) + ERR("HACK: AC Odyssey sync tweak on.\n"); + env_str = getenv("WINE_FSYNC_SIMULATE_SCHED_QUANTUM"); if (env_str) fsync_simulate_sched_quantum = !!atoi(env_str); From 3c72ae428129d4757d7d1052ed8a19335ab009bf Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 23 Jan 2023 21:23:28 -0600 Subject: [PATCH 0574/1506] esync, fsync: Support wait on completion ports. CW-Bug-Id: #21831 --- server/completion.c | 88 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 7 deletions(-) diff --git a/server/completion.c b/server/completion.c index cbafe811796..3ed7b2ff2a3 100644 --- a/server/completion.c +++ b/server/completion.c @@ -30,7 +30,7 @@ #include #include - +#include #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" @@ -40,7 +40,8 @@ #include "file.h" #include "handle.h" #include "request.h" - +#include "esync.h" +#include "fsync.h" static const WCHAR completion_name[] = {'I','o','C','o','m','p','l','e','t','i','o','n'}; @@ -64,6 +65,8 @@ struct completion_wait struct completion *completion; struct list queue; unsigned int depth; + int esync_fd; + unsigned int fsync_idx; }; struct completion @@ -75,6 +78,8 @@ struct completion static void completion_wait_dump( struct object*, int ); static int completion_wait_signaled( struct object *obj, struct wait_queue_entry *entry ); static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ); +static int completion_wait_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int completion_wait_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void completion_wait_destroy( struct object * ); static const struct object_ops completion_wait_ops = @@ -85,8 +90,8 @@ static const struct object_ops completion_wait_ops = add_queue, /* add_queue */ remove_queue, /* remove_queue */ completion_wait_signaled, /* signaled */ - NULL, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + completion_wait_get_esync_fd, /* get_esync_fd */ + completion_wait_get_fsync_idx, /* get_fsync_idx */ completion_wait_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -106,6 +111,8 @@ static const struct object_ops completion_wait_ops = static void completion_dump( struct object*, int ); static int completion_add_queue( struct object *obj, struct wait_queue_entry *entry ); static void completion_remove_queue( struct object *obj, struct wait_queue_entry *entry ); +static int completion_get_esync_fd( struct object *obj, enum esync_type *type ); +static unsigned int completion_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void completion_destroy( struct object * ); static const struct object_ops completion_ops = @@ -116,8 +123,8 @@ static const struct object_ops completion_ops = completion_add_queue, /* add_queue */ completion_remove_queue, /* remove_queue */ NULL, /* signaled */ - NULL, /* get_esync_fd */ - NULL, /* get_fsync_idx */ + completion_get_esync_fd, /* get_esync_fd */ + completion_get_fsync_idx, /* get_fsync_idx */ no_satisfied, /* satisfied */ no_signal, /* signal */ no_get_fd, /* get_fd */ @@ -152,6 +159,11 @@ static void completion_wait_destroy( struct object *obj) { free( tmp ); } + + if (do_esync()) + close( wait->esync_fd ); + + if (wait->fsync_idx) fsync_free_shm_idx( wait->fsync_idx ); } static void completion_wait_dump( struct object *obj, int verbose ) @@ -170,6 +182,23 @@ static int completion_wait_signaled( struct object *obj, struct wait_queue_entry return !wait->completion || !list_empty( &wait->queue ); } +static int completion_wait_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct completion_wait *wait = (struct completion_wait *)obj; + + *type = ESYNC_MANUAL_SERVER; + return wait->esync_fd; +} + +static unsigned int completion_wait_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct completion_wait *wait = (struct completion_wait *)obj; + + assert( obj->ops == &completion_wait_ops ); + *type = FSYNC_MANUAL_SERVER; + return wait->fsync_idx; +} + static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct completion_wait *wait = (struct completion_wait *)obj; @@ -209,6 +238,22 @@ static void completion_remove_queue( struct object *obj, struct wait_queue_entry completion->wait->obj.ops->remove_queue( &completion->wait->obj, entry ); } +static int completion_get_esync_fd( struct object *obj, enum esync_type *type ) +{ + struct completion *completion = (struct completion *)obj; + + assert( obj->ops == &completion_ops ); + return completion->wait->obj.ops->get_esync_fd( &completion->wait->obj, type ); +} + +static unsigned int completion_get_fsync_idx( struct object *obj, enum fsync_type *type ) +{ + struct completion *completion = (struct completion *)obj; + + assert( obj->ops == &completion_ops ); + return completion->wait->obj.ops->get_fsync_idx( &completion->wait->obj, type ); +} + static void completion_destroy( struct object *obj ) { struct completion *completion = (struct completion *)obj; @@ -237,6 +282,14 @@ static struct completion *create_completion( struct object *root, const struct u completion->wait->completion = completion; list_init( &completion->wait->queue ); completion->wait->depth = 0; + completion->wait->fsync_idx = 0; + + if (do_fsync()) + completion->wait->fsync_idx = fsync_alloc_shm( 0, 0 ); + + if (do_esync()) + completion->wait->esync_fd = esync_create_fd( 0, 0 ); + return completion; } @@ -260,6 +313,7 @@ void add_completion( struct completion *completion, apc_param_t ckey, apc_param_ list_add_tail( &completion->wait->queue, &msg->queue_entry ); completion->wait->depth++; + wake_up( &completion->wait->obj, 1 ); } @@ -333,7 +387,18 @@ DECL_HANDLER(remove_completion) entry = list_head( &wait->queue ); if (!entry) - set_error( STATUS_PENDING ); + { + if (wait->completion) + { + if (do_fsync() || do_esync()) + { + /* completion_wait_satisfied is not called, so lock completion here. */ + current->locked_completion = grab_object( wait ); + } + set_error( STATUS_PENDING ); + } + else set_error( STATUS_ABANDONED_WAIT_0 ); + } else { list_remove( entry ); @@ -344,6 +409,15 @@ DECL_HANDLER(remove_completion) reply->status = msg->status; reply->information = msg->information; free( msg ); + + if (!completion_wait_signaled( &wait->obj, NULL )) + { + if (do_fsync()) + fsync_clear( &wait->obj ); + + if (do_esync()) + esync_clear( wait->esync_fd ); + } } release_object( wait ); From fa2e7224e08179417d43c62bc8113685b670faf2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 7 Mar 2023 15:54:01 -0600 Subject: [PATCH 0575/1506] fsync: Retry grabbing semaphore if count has changed. CW-Bug-Id: #21996 --- dlls/ntdll/unix/fsync.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index be27906a37c..4dade5eb27f 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -975,15 +975,18 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, case FSYNC_SEMAPHORE: { struct semaphore *semaphore = obj->shm; - int current; + int current, new; - if ((current = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST )) - && __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) == current) + new = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST ); + while ((current = new)) { - TRACE("Woken up by handle %p [%d].\n", handles[i], i); - if (waited) simulate_sched_quantum(); - put_objects( objs, count ); - return i; + if ((new = __sync_val_compare_and_swap( &semaphore->count, current, current - 1 )) == current) + { + TRACE("Woken up by handle %p [%d].\n", handles[i], i); + if (waited) simulate_sched_quantum(); + put_objects( objs, count ); + return i; + } } futex_vector_set( &futexes[i], &semaphore->count, 0 ); break; @@ -1229,10 +1232,15 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, case FSYNC_SEMAPHORE: { struct semaphore *semaphore = obj->shm; - int current; + int current, new; - if (!(current = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST )) - || __sync_val_compare_and_swap( &semaphore->count, current, current - 1 ) != current) + new = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST ); + while ((current = new)) + { + if ((new = __sync_val_compare_and_swap( &semaphore->count, current, current - 1 )) == current) + break; + } + if (!current) goto tooslow; break; } From 1f907e33609c14ecac945292b9f761d28bebba68 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 27 Apr 2023 16:53:17 -0600 Subject: [PATCH 0576/1506] fsync: Cache current process ID. CW-Bug-Id: #22194 --- dlls/ntdll/unix/fsync.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 4dade5eb27f..c5d38754ea6 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -59,6 +59,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsync); #include "pshpack4.h" #include "poppack.h" +static int current_pid; + /* futex_waitv interface */ #ifndef __NR_futex_waitv @@ -348,7 +350,7 @@ static void put_object_from_wait( struct fsync *obj ) { int *shm = obj->shm; - __sync_val_compare_and_swap( &shm[3], GetCurrentProcessId(), 0 ); + __sync_val_compare_and_swap( &shm[3], current_pid, 0 ); put_object( obj ); } @@ -434,7 +436,7 @@ static NTSTATUS get_object_for_wait( HANDLE handle, struct fsync *obj ) shm = obj->shm; /* Give wineserver a chance to cleanup shm index if the process * is killed while we are waiting on the object. */ - __atomic_store_n( &shm[3], GetCurrentProcessId(), __ATOMIC_SEQ_CST ); + __atomic_store_n( &shm[3], current_pid, __ATOMIC_SEQ_CST ); return STATUS_SUCCESS; } @@ -564,6 +566,9 @@ void fsync_init(void) ERR("Failed to initialize shared memory: %s\n", strerror( errno )); exit(1); } + + current_pid = GetCurrentProcessId(); + assert(current_pid); } NTSTATUS fsync_create_semaphore( HANDLE *handle, ACCESS_MASK access, From 5fe3571986dbd70a5a6ca11f5864a4a17a2607de Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 27 Apr 2023 16:56:26 -0600 Subject: [PATCH 0577/1506] fsync: Cache current TID in __fsync_wait_objects(). CW-Bug-Id: #22194 --- dlls/ntdll/unix/fsync.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index c5d38754ea6..d3ad9788600 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -871,6 +871,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { static const LARGE_INTEGER zero = {0}; + int current_tid = 0; +#define CURRENT_TID (current_tid ? current_tid : (current_tid = GetCurrentThreadId())) + struct futex_waitv futexes[MAXIMUM_WAIT_OBJECTS + 1]; struct fsync objs[MAXIMUM_WAIT_OBJECTS]; BOOL msgwait = FALSE, waited = FALSE; @@ -1001,7 +1004,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct mutex *mutex = obj->shm; int tid; - if (mutex->tid == GetCurrentThreadId()) + if (mutex->tid == CURRENT_TID) { TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count++; @@ -1010,7 +1013,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return i; } - if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, GetCurrentThreadId() ))) + if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, CURRENT_TID ))) { TRACE("Woken up by handle %p [%d].\n", handles[i], i); mutex->count = 1; @@ -1018,7 +1021,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, put_objects( objs, count ); return i; } - else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, GetCurrentThreadId() )) == ~0) + else if (tid == ~0 && (tid = __sync_val_compare_and_swap( &mutex->tid, ~0, CURRENT_TID )) == ~0) { TRACE("Woken up by abandoned mutex %p [%d].\n", handles[i], i); mutex->count = 1; @@ -1157,7 +1160,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct mutex *mutex = obj->shm; - if (mutex->tid == GetCurrentThreadId()) + if (mutex->tid == CURRENT_TID) continue; while ((current = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ))) @@ -1201,7 +1204,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct mutex *mutex = obj->shm; int tid = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ); - if (tid && tid != ~0 && tid != GetCurrentThreadId()) + if (tid && tid != ~0 && tid != CURRENT_TID) goto tryagain; } else if (obj->type) @@ -1224,11 +1227,11 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct mutex *mutex = obj->shm; int tid = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST ); - if (tid == GetCurrentThreadId()) + if (tid == CURRENT_TID) break; if (tid && tid != ~0) goto tooslow; - if (__sync_val_compare_and_swap( &mutex->tid, tid, GetCurrentThreadId() ) != tid) + if (__sync_val_compare_and_swap( &mutex->tid, tid, CURRENT_TID ) != tid) goto tooslow; if (tid == ~0) abandoned = TRUE; @@ -1338,6 +1341,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, * right thing to do seems to be to return STATUS_USER_APC anyway. */ if (ret == STATUS_TIMEOUT) ret = STATUS_USER_APC; return ret; +#undef CURRENT_TID } /* Like esync, we need to let the server know when we are doing a message wait, From 2e9b6e6677fb0ae225ec5892ca3f0c0c680acf0f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 27 Apr 2023 17:32:38 -0600 Subject: [PATCH 0578/1506] fsync: Add WINE_FSYNC_YIELD_TO_WAITERS option. CW-Bug-Id: #22194 --- dlls/ntdll/unix/fsync.c | 37 +++++++++++++++++++++++++++++++--- dlls/ntdll/unix/loader.c | 7 +++++++ dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index d3ad9788600..0e862e5bbc2 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -426,7 +426,7 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) return ret; } -static NTSTATUS get_object_for_wait( HANDLE handle, struct fsync *obj ) +static NTSTATUS get_object_for_wait( HANDLE handle, struct fsync *obj, int *prev_pid ) { NTSTATUS ret; int *shm; @@ -436,7 +436,10 @@ static NTSTATUS get_object_for_wait( HANDLE handle, struct fsync *obj ) shm = obj->shm; /* Give wineserver a chance to cleanup shm index if the process * is killed while we are waiting on the object. */ - __atomic_store_n( &shm[3], current_pid, __ATOMIC_SEQ_CST ); + if (fsync_yield_to_waiters) + *prev_pid = __atomic_exchange_n( &shm[3], current_pid, __ATOMIC_SEQ_CST ); + else + __atomic_store_n( &shm[3], current_pid, __ATOMIC_SEQ_CST ); return STATUS_SUCCESS; } @@ -823,6 +826,24 @@ NTSTATUS fsync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) return STATUS_SUCCESS; } +static inline void try_yield_to_waiters( int prev_pid ) +{ + if (!fsync_yield_to_waiters) return; + + /* On Windows singaling an object will wake the threads waiting on the object. With fsync + * it may happen that signaling thread (or other thread) grabs the object before the already waiting + * thread gets a chance. Try to workaround that for the affected apps. Non-zero 'prev_pid' indicates + * that the object is grabbed in __fsync_wait_objects() by some other thread. It is the same for + * a non-current pid, but we may currently have a stale PID on an object from a terminated process + * and it is probably safer to skip this workaround. This won't work great if the object is used in 'wait all' + * and the waiter is blocked on the other object. + * This check is also not entirely reliable as if multiple waiters from the same process enter + * __fsync_wait_objects() the first one leaving will clear 'last_pid' in the object. */ + + if (prev_pid == current_pid) + usleep(0); +} + static NTSTATUS do_single_wait( int *addr, int val, const struct timespec64 *end, clockid_t clock_id, BOOLEAN alertable ) { @@ -877,6 +898,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, struct futex_waitv futexes[MAXIMUM_WAIT_OBJECTS + 1]; struct fsync objs[MAXIMUM_WAIT_OBJECTS]; BOOL msgwait = FALSE, waited = FALSE; + int prev_pids[MAXIMUM_WAIT_OBJECTS]; int has_fsync = 0, has_server = 0; clockid_t clock_id = 0; struct timespec64 end; @@ -907,7 +929,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, for (i = 0; i < count; i++) { - ret = get_object_for_wait( handles[i], &objs[i] ); + ret = get_object_for_wait( handles[i], &objs[i], &prev_pids[i] ); if (ret == STATUS_SUCCESS) { assert( objs[i].type ); @@ -986,6 +1008,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, int current, new; new = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST ); + if (!waited && new) + try_yield_to_waiters(prev_pids[i]); + while ((current = new)) { if ((new = __sync_val_compare_and_swap( &semaphore->count, current, current - 1 )) == current) @@ -1013,6 +1038,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, return i; } + if (!waited && !mutex->tid) + try_yield_to_waiters(prev_pids[i]); + if (!(tid = __sync_val_compare_and_swap( &mutex->tid, 0, CURRENT_TID ))) { TRACE("Woken up by handle %p [%d].\n", handles[i], i); @@ -1037,6 +1065,9 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles, { struct event *event = obj->shm; + if (!waited && event->signaled) + try_yield_to_waiters(prev_pids[i]); + if (__sync_val_compare_and_swap( &event->signaled, 1, 0 )) { if (ac_odyssey && alertable) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 9cdfed963f8..723b033751a 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1923,6 +1923,7 @@ static ULONG_PTR get_image_address(void) BOOL ac_odyssey; BOOL fsync_simulate_sched_quantum; BOOL alert_simulate_sched_quantum; +BOOL fsync_yield_to_waiters; static void hacks_init(void) { @@ -1960,6 +1961,12 @@ static void hacks_init(void) if (alert_simulate_sched_quantum) ERR("HACK: Simulating sched quantum in NtWaitForAlertByThreadId.\n"); + env_str = getenv("WINE_FSYNC_YIELD_TO_WAITERS"); + if (env_str) + fsync_yield_to_waiters = !!atoi(env_str); + if (fsync_yield_to_waiters) + ERR("HACK: fsync: yield to waiters.\n"); + switch (sgi ? atoi( sgi ) : -1) { case 25700: /* Madballs in Babo: Invasion */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 92668512e90..c61187266e6 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -181,6 +181,7 @@ extern struct ldt_copy __wine_ldt_copy; extern BOOL ac_odyssey; extern BOOL fsync_simulate_sched_quantum; extern BOOL alert_simulate_sched_quantum; +extern BOOL fsync_yield_to_waiters; extern void init_environment(void); extern void init_startup_info(void); From 4d9d9f347214ba852f7cea8d033f241c1cc55fd6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 27 Apr 2023 18:19:01 -0600 Subject: [PATCH 0579/1506] ntdll: HACK: Enable WINE_FSYNC_YIELD_TO_WAITERS for FFXIII. CW-Bug-Id: #22194 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 723b033751a..249aa70e01d 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1964,6 +1964,7 @@ static void hacks_init(void) env_str = getenv("WINE_FSYNC_YIELD_TO_WAITERS"); if (env_str) fsync_yield_to_waiters = !!atoi(env_str); + else if (sgi) fsync_yield_to_waiters = !strcmp(sgi, "292120"); if (fsync_yield_to_waiters) ERR("HACK: fsync: yield to waiters.\n"); From b2d168ec8aadd8c66e0556dad2467b6cac302037 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 21 Nov 2023 18:06:59 -0600 Subject: [PATCH 0580/1506] ntdll: HACK: Enable fsync_yield_to_waiters for LIGHTNING RETURNS: FFXIII. CW-Bug-Id: #23021 --- dlls/ntdll/unix/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 249aa70e01d..1bc6e147818 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1964,7 +1964,7 @@ static void hacks_init(void) env_str = getenv("WINE_FSYNC_YIELD_TO_WAITERS"); if (env_str) fsync_yield_to_waiters = !!atoi(env_str); - else if (sgi) fsync_yield_to_waiters = !strcmp(sgi, "292120"); + else if (sgi) fsync_yield_to_waiters = !strcmp(sgi, "292120") || !strcmp(sgi, "345350"); if (fsync_yield_to_waiters) ERR("HACK: fsync: yield to waiters.\n"); From 5643bc14e8b79545887af6db6b76fe73b91360e8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 6 Dec 2023 21:06:56 -0600 Subject: [PATCH 0581/1506] ntdll: HACK: Enable fsync_yield_to_waiters for FFXIII-2. CW-Bug-Id: #23021 --- dlls/ntdll/unix/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 1bc6e147818..af3055bc93b 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1964,7 +1964,7 @@ static void hacks_init(void) env_str = getenv("WINE_FSYNC_YIELD_TO_WAITERS"); if (env_str) fsync_yield_to_waiters = !!atoi(env_str); - else if (sgi) fsync_yield_to_waiters = !strcmp(sgi, "292120") || !strcmp(sgi, "345350"); + else if (sgi) fsync_yield_to_waiters = !strcmp(sgi, "292120") || !strcmp(sgi, "345350") || !strcmp(sgi, "292140"); if (fsync_yield_to_waiters) ERR("HACK: fsync: yield to waiters.\n"); From c4b4157c28e4fc1a7934a62241f10e706ae0a6e3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 13 Mar 2023 21:39:04 -0600 Subject: [PATCH 0582/1506] fsync: Avoid race between NtClose() and get_object(). CW-Bug-Id: #22029 --- dlls/ntdll/unix/fsync.c | 19 ++++++++++++++++--- dlls/ntdll/unix/fsync.h | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 0e862e5bbc2..3aa32872a80 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -374,8 +374,9 @@ static BOOL get_cached_object( HANDLE handle, struct fsync *obj ) { /* This check does not strictly guarantee that we avoid the potential race but is supposed to greatly * reduce the probability of that. */ + FIXME( "Cache changed while getting object, handle %p, shm_idx %d, refcount %d.\n", + handle, cache.shm_idx, ((int *)obj->shm)[2] ); put_object( obj ); - FIXME( "Cache changed while getting object.\n" ); goto again; } return TRUE; @@ -390,6 +391,7 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) NTSTATUS ret = STATUS_SUCCESS; unsigned int shm_idx = 0; enum fsync_type type; + sigset_t sigset; if (get_cached_object( handle, obj )) return STATUS_SUCCESS; @@ -399,7 +401,17 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) return STATUS_NOT_IMPLEMENTED; } - /* We need to try grabbing it from the server. */ + + /* We need to try grabbing it from the server. Uninterrupted section + * is needed to avoid race with NtClose() which first calls fsync_close() + * and then closes handle on server. Without the section we might cache + * already closed handle back. */ + server_enter_uninterrupted_section( &fd_cache_mutex, &sigset ); + if (get_cached_object( handle, obj )) + { + server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); + return STATUS_SUCCESS; + } SERVER_START_REQ( get_fsync_idx ) { req->handle = wine_server_obj_handle( handle ); @@ -410,6 +422,8 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) } } SERVER_END_REQ; + if (!ret) add_to_list( handle, type, shm_idx ); + server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); if (ret) { @@ -421,7 +435,6 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) obj->type = type; obj->shm = get_shm( shm_idx ); - add_to_list( handle, type, shm_idx ); /* get_fsync_idx server request increments shared mem refcount, so not grabbing object here. */ return ret; } diff --git a/dlls/ntdll/unix/fsync.h b/dlls/ntdll/unix/fsync.h index 763e7891ab8..6005c0fa322 100644 --- a/dlls/ntdll/unix/fsync.h +++ b/dlls/ntdll/unix/fsync.h @@ -47,3 +47,8 @@ extern NTSTATUS fsync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN BOOLEAN alertable, const LARGE_INTEGER *timeout ); extern NTSTATUS fsync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable, const LARGE_INTEGER *timeout ); + +/* We have to synchronize on the fd cache mutex so that fsync_close(), close_handle() sequence + * called from NtClose() doesn't race with get_fsync_idx(), add_to_list() sequence called + * from get_object(). */ +extern pthread_mutex_t fd_cache_mutex; From 4ce5048522221c7b56016d2ba6c884bbdd3b2cdf Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 3 Jul 2023 13:30:33 -0600 Subject: [PATCH 0583/1506] fsync: Check for NULL handle in get_object(). CW-Bug-Id: #22395 --- dlls/ntdll/unix/fsync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 3aa32872a80..8f20f7cab4a 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -401,6 +401,7 @@ static NTSTATUS get_object( HANDLE handle, struct fsync *obj ) return STATUS_NOT_IMPLEMENTED; } + if (!handle) return STATUS_INVALID_HANDLE; /* We need to try grabbing it from the server. Uninterrupted section * is needed to avoid race with NtClose() which first calls fsync_close() From 639e475a4e36bf339b63741ccda9c647ecfa83aa Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 9 Jun 2023 15:12:31 +0800 Subject: [PATCH 0584/1506] fsync: Type-check HANDLE in fsync_reset_event(). Oddworld: Stranger's Wrath HD (15750) calls ResetEvent() on a file handle and then waits for the handle with an infinite timeout. Without esync/fsync, NtResetEvent() should return STATUS_OBJECT_TYPE_MISMATCH because the handle is not an event handle. With esync/fsync, the file handle is set to non-signaled successfully and causes the game to hang at start-up. The same check should also apply to fsync_pulse_event(), esync_reset_event(), and esync_pulse_event(). CW-Bug-Id: #22326 --- dlls/ntdll/unix/fsync.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 8f20f7cab4a..3dfa7c4e035 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -714,6 +714,12 @@ NTSTATUS fsync_reset_event( HANDLE handle, LONG *prev ) if ((ret = get_object( handle, &obj ))) return ret; event = obj.shm; + if (obj.type != FSYNC_MANUAL_EVENT && obj.type != FSYNC_AUTO_EVENT) + { + put_object( &obj ); + return STATUS_OBJECT_TYPE_MISMATCH; + } + current = __atomic_exchange_n( &event->signaled, 0, __ATOMIC_SEQ_CST ); if (prev) *prev = current; From 24ce12faa661000267b5c11f1ae56814f23fd3f1 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 9 Jun 2023 15:13:12 +0800 Subject: [PATCH 0585/1506] fsync: Type-check HANDLE in fsync_pulse_event(). CW-Bug-Id: #22326 --- dlls/ntdll/unix/fsync.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c index 3dfa7c4e035..c3da44e4f26 100644 --- a/dlls/ntdll/unix/fsync.c +++ b/dlls/ntdll/unix/fsync.c @@ -740,6 +740,12 @@ NTSTATUS fsync_pulse_event( HANDLE handle, LONG *prev ) if ((ret = get_object( handle, &obj ))) return ret; event = obj.shm; + if (obj.type != FSYNC_MANUAL_EVENT && obj.type != FSYNC_AUTO_EVENT) + { + put_object( &obj ); + return STATUS_OBJECT_TYPE_MISMATCH; + } + /* This isn't really correct; an application could miss the write. * Unfortunately we can't really do much better. Fortunately this is rarely * used (and publicly deprecated). */ From 93ffa6d39ac7f8da5cda49cc400f4ddc39de7e95 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 9 Jun 2023 15:14:59 +0800 Subject: [PATCH 0586/1506] esync: Type-check HANDLE in esync_reset_event(). CW-Bug-Id: #22326 --- dlls/ntdll/unix/esync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 7b85981cd77..8b3983151d3 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -571,6 +571,9 @@ NTSTATUS esync_reset_event( HANDLE handle ) if ((ret = get_object( handle, &obj ))) return ret; event = obj->shm; + if (obj->type != ESYNC_MANUAL_EVENT && obj->type != ESYNC_AUTO_EVENT) + return STATUS_OBJECT_TYPE_MISMATCH; + if (obj->type == ESYNC_MANUAL_EVENT) { /* Acquire the spinlock. */ From 98308ae11611562c73dc7e7d9f6eafa0e6c822a2 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 9 Jun 2023 15:15:55 +0800 Subject: [PATCH 0587/1506] esync: Type-check HANDLE in esync_pulse_event(). CW-Bug-Id: #22326 --- dlls/ntdll/unix/esync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c index 8b3983151d3..3074f7c72ea 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c @@ -614,6 +614,9 @@ NTSTATUS esync_pulse_event( HANDLE handle ) if ((ret = get_object( handle, &obj ))) return ret; + if (obj->type != ESYNC_MANUAL_EVENT && obj->type != ESYNC_AUTO_EVENT) + return STATUS_OBJECT_TYPE_MISMATCH; + /* This isn't really correct; an application could miss the write. * Unfortunately we can't really do much better. Fortunately this is rarely * used (and publicly deprecated). */ From 25e820b8d938593eeb32b6aa09f2b1d78302996a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 23 Jul 2018 19:53:20 +0200 Subject: [PATCH 0588/1506] amd_ags_x64: Import v5.1.1 amd_ags.h. Imported from https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK. --- dlls/amd_ags_x64/amd_ags.h | 944 +++++++++++++++++++++++++++++++++++++ 1 file changed, 944 insertions(+) create mode 100644 dlls/amd_ags_x64/amd_ags.h diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h new file mode 100644 index 00000000000..9c3e37e52e5 --- /dev/null +++ b/dlls/amd_ags_x64/amd_ags.h @@ -0,0 +1,944 @@ +// +// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +/// \file +/// \mainpage +/// AGS Library Overview +/// -------------------- +/// This document provides an overview of the AGS (AMD GPU Services) library. The AGS library provides software developers with the ability to query +/// AMD GPU software and hardware state information that is not normally available through standard operating systems or graphic APIs. +/// +/// The latest version of the API is publicly hosted here: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/. +/// It is also worth checking http://gpuopen.com/gaming-product/amd-gpu-services-ags-library/ for any updates and articles on AGS. +/// \internal +/// Online documentation is publicly hosted here: http://gpuopen-librariesandsdks.github.io/ags/ +/// \endinternal +/// +/// What's new in AGS 5.1.1 since version 5.0.6 +/// --------------------------------------- +/// AGS 5.1.1 includes the following updates: +/// * An API change for DX11 extensions +/// - It is now mandatory to call agsDriverExtensionsDX11_CreateDevice() when creating a device if the user wants to access any DX11 AMD extensions. +/// - The corresponding agsDriverExtensionsDX11_DestroyDevice() call must be called to release the device and free up the internal resources allocated by the create call. +/// * App registration extension for DX11. +/// * Freesync 2 HDR support. +/// * Wave reduce and wave scan shader extensions. +/// * AMD user markers for DX12. +/// * Eyefinity bug fixes. +/// * MultiDrawIndexedInstancedIndirectCountIndirect parameter bug fix. +/// * Static lib versions of the binary. +/// * VS2017 support for the samples. +/// +/// What's new in AGS 5.x since version 4.x +/// --------------------------------------- +/// Version 5.x is a major overhaul of the library designed to provide a much clearer view of the GPUs in the system and the displays attached to them. +/// It also exposes the ability to query each display for HDR capabilities and put those HDR capable displays into various HDR modes. +/// Some functions such as agsGetGPUMemorySize and agsGetEyefinityConfigInfo have been removed in favor of including this information in the device & display enumeration. +/// Features include: +/// * Full GPU enumeration with adapter string, device id, revision id and vendor id. +/// * Per GPU display enumeration including information on display name, resolution and HDR capabilities. +/// * Optional user supplied memory allocator. +/// * Function to set displays into HDR mode. +/// * A Microsoft WACK compliant version of the library. +/// * DirectX11 shader compiler controls. +/// * DirectX11 multiview extension enabling MultiView and MultiRes rendering. +/// * DirectX11 Crossfire API now supports using the API without needing a driver profile. Can also specify the transfer engine. +/// +/// Using the AGS library +/// --------------------- +/// It is recommended to take a look at the source code for the samples that come with the AGS SDK: +/// * AGSSample +/// * CrossfireSample +/// * EyefinitySample +/// The AGSSample application is the simplest of the three examples and demonstrates the code required to initialize AGS and use it to query the GPU and Eyefinity state. +/// The CrossfireSample application demonstrates the use of the new API to transfer resources on GPUs in Crossfire mode. Lastly, the EyefinitySample application provides a more +/// extensive example of Eyefinity setup than the basic example provided in AGSSample. +/// There are other samples on Github that demonstrate the DirectX shader extensions, such as the Barycentrics11 and Barycentrics12 samples. +/// +/// To add AGS support to an existing project, follow these steps: +/// * Link your project against the correct import library. Choose from either the 32 bit or 64 bit version. +/// * Copy the AGS dll into the same directory as your game executable. +/// * Include the amd_ags.h header file from your source code. +/// * Include the AGS hlsl files if you are using the shader intrinsics. +/// * Declare a pointer to an AGSContext and make this available for all subsequent calls to AGS. +/// * On game initialization, call agsInit() passing in the address of the context. On success, this function will return a valid context pointer. +/// * The agsInit() function should be called before the D3D device is created if the Crossfire mode is specified. +/// +/// Don't forget to cleanup AGS by calling agsDeInit() when the app exits, after the device has been destroyed. + +#ifndef AMD_AGS_H +#define AMD_AGS_H + +#define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version +#define AMD_AGS_VERSION_MINOR 1 ///< AGS minor version +#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version + +#ifdef __cplusplus +extern "C" { +#endif + + +#define AMD_AGS_API __declspec(dllexport) ///< AGS calling convention + +// Forward declaration of D3D11 types +struct IDXGIAdapter; +enum D3D_DRIVER_TYPE; +enum D3D_FEATURE_LEVEL; +struct DXGI_SWAP_CHAIN_DESC; +struct ID3D11Device; +struct ID3D11DeviceContext; +struct IDXGISwapChain; +struct ID3D11Resource; +struct ID3D11Buffer; +struct ID3D11Texture1D; +struct ID3D11Texture2D; +struct ID3D11Texture3D; +struct D3D11_BUFFER_DESC; +struct D3D11_TEXTURE1D_DESC; +struct D3D11_TEXTURE2D_DESC; +struct D3D11_TEXTURE3D_DESC; +struct D3D11_SUBRESOURCE_DATA; +struct tagRECT; +typedef tagRECT D3D11_RECT; ///< typedef this ourselves so we don't have to drag d3d11.h in + +// Forward declaration of D3D12 types +struct ID3D12Device; +struct ID3D12GraphicsCommandList; + + +/// The return codes +enum AGSReturnCode +{ + AGS_SUCCESS, ///< Successful function call + AGS_FAILURE, ///< Failed to complete call for some unspecified reason + AGS_INVALID_ARGS, ///< Invalid arguments into the function + AGS_OUT_OF_MEMORY, ///< Out of memory when allocating space internally + AGS_ERROR_MISSING_DLL, ///< Returned when a driver dll fails to load - most likely due to not being present in legacy driver installation + AGS_ERROR_LEGACY_DRIVER, ///< Returned if a feature is not present in the installed driver + AGS_EXTENSION_NOT_SUPPORTED, ///< Returned if the driver does not support the requested driver extension + AGS_ADL_FAILURE, ///< Failure in ADL (the AMD Display Library) +}; + +/// The DirectX11 extension support bits +enum AGSDriverExtensionDX11 +{ + AGS_DX11_EXTENSION_QUADLIST = 1 << 0, + AGS_DX11_EXTENSION_SCREENRECTLIST = 1 << 1, + AGS_DX11_EXTENSION_UAV_OVERLAP = 1 << 2, + AGS_DX11_EXTENSION_DEPTH_BOUNDS_TEST = 1 << 3, + AGS_DX11_EXTENSION_MULTIDRAWINDIRECT = 1 << 4, + AGS_DX11_EXTENSION_MULTIDRAWINDIRECT_COUNTINDIRECT = 1 << 5, + AGS_DX11_EXTENSION_CROSSFIRE_API = 1 << 6, + AGS_DX11_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 7, + AGS_DX11_EXTENSION_INTRINSIC_READLANE = 1 << 8, + AGS_DX11_EXTENSION_INTRINSIC_LANEID = 1 << 9, + AGS_DX11_EXTENSION_INTRINSIC_SWIZZLE = 1 << 10, + AGS_DX11_EXTENSION_INTRINSIC_BALLOT = 1 << 11, + AGS_DX11_EXTENSION_INTRINSIC_MBCOUNT = 1 << 12, + AGS_DX11_EXTENSION_INTRINSIC_COMPARE3 = 1 << 13, + AGS_DX11_EXTENSION_INTRINSIC_BARYCENTRICS = 1 << 14, + AGS_DX11_EXTENSION_INTRINSIC_WAVE_REDUCE = 1 << 15, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX11_EXTENSION_INTRINSIC_WAVE_SCAN = 1 << 16, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX11_EXTENSION_CREATE_SHADER_CONTROLS = 1 << 17, + AGS_DX11_EXTENSION_MULTIVIEW = 1 << 18, + AGS_DX11_EXTENSION_APP_REGISTRATION = 1 << 19 ///< Supported in Radeon Software Version 17.9.1 onwards. +}; + +/// The DirectX12 extension support bits +enum AGSDriverExtensionDX12 +{ + AGS_DX12_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 0, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_READLANE = 1 << 1, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_LANEID = 1 << 2, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_SWIZZLE = 1 << 3, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_BALLOT = 1 << 4, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_MBCOUNT = 1 << 5, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_COMPARE3 = 1 << 6, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_BARYCENTRICS = 1 << 7, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_WAVE_REDUCE = 1 << 8, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX12_EXTENSION_INTRINSIC_WAVE_SCAN = 1 << 9, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX12_EXTENSION_USER_MARKERS = 1 << 10 ///< Supported in Radeon Software Version 17.9.1 onwards. +}; + +/// The space id for DirectX12 intrinsic support +const unsigned int AGS_DX12_SHADER_INSTRINSICS_SPACE_ID = 0x7FFF0ADE; // 2147420894 + + +/// Additional topologies supported via extensions +enum AGSPrimitiveTopology +{ + AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, + AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 +}; + +/// The different modes to control Crossfire behavior. +enum AGSCrossfireMode +{ + AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering + AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile + AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering +}; + + +/// The Crossfire API transfer types +enum AGSAfrTransferType +{ + AGS_AFR_TRANSFER_DEFAULT = 0, ///< Default Crossfire driver resource tracking + AGS_AFR_TRANSFER_DISABLE = 1, ///< Turn off driver resource tracking + AGS_AFR_TRANSFER_1STEP_P2P = 2, ///< App controlled GPU to next GPU transfer + AGS_AFR_TRANSFER_2STEP_NO_BROADCAST = 3, ///< App controlled GPU to next GPU transfer using intermediate system memory + AGS_AFR_TRANSFER_2STEP_WITH_BROADCAST = 4, ///< App controlled GPU to all render GPUs transfer using intermediate system memory +}; + +/// The Crossfire API transfer engines +enum AGSAfrTransferEngine +{ + AGS_AFR_TRANSFERENGINE_DEFAULT = 0, ///< Use default engine for Crossfire API transfers + AGS_AFR_TRANSFERENGINE_3D_ENGINE = 1, ///< Use 3D engine for Crossfire API transfers + AGS_AFR_TRANSFERENGINE_COPY_ENGINE = 2, ///< Use Copy engine for Crossfire API transfers +}; + +/// The display flags describing various properties of the display. +enum AGSDisplayFlags +{ + AGS_DISPLAYFLAG_PRIMARY_DISPLAY = 1 << 0, ///< Whether this display is marked as the primary display. Not set on the WACK version. + AGS_DISPLAYFLAG_HDR10 = 1 << 1, ///< HDR10 is supported on this display + AGS_DISPLAYFLAG_DOLBYVISION = 1 << 2, ///< Dolby Vision is supported on this display + AGS_DISPLAYFLAG_FREESYNC = 1 << 3, ///< Freesync is supported on this display + AGS_DISPLAYFLAG_FREESYNC_2 = 1 << 4, ///< Freesync 2 is supported on this display + AGS_DISPLAYFLAG_EYEFINITY_IN_GROUP = 1 << 5, ///< The display is part of the Eyefinity group + AGS_DISPLAYFLAG_EYEFINITY_PREFERRED_DISPLAY = 1 << 6, ///< The display is the preferred display in the Eyefinity group for displaying the UI + AGS_DISPLAYFLAG_EYEFINITY_IN_PORTRAIT_MODE = 1 << 7, ///< The display is in the Eyefinity group but in portrait mode +}; + +struct AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInit + +/// The rectangle struct used by AGS. +struct AGSRect +{ + int offsetX; ///< Offset on X axis + int offsetY; ///< Offset on Y axis + int width; ///< Width of rectangle + int height; ///< Height of rectangle +}; + +/// The clip rectangle struct used by \ref agsDriverExtensionsDX11_SetClipRects +struct AGSClipRect +{ + /// The inclusion mode for the rect + enum Mode + { + ClipRectIncluded = 0, ///< Include the rect + ClipRectExcluded = 1 ///< Exclude the rect + }; + + Mode mode; ///< Include/exclude rect region + AGSRect rect; ///< The rect to include/exclude +}; + +/// The display info struct used to describe a display enumerated by AGS +struct AGSDisplayInfo +{ + char name[ 256 ]; ///< The name of the display + char displayDeviceName[ 32 ]; ///< The display device name, i.e. DISPLAY_DEVICE::DeviceName + + unsigned int displayFlags; ///< Bitfield of ::AGSDisplayFlags + + int maxResolutionX; ///< The maximum supported resolution of the unrotated display + int maxResolutionY; ///< The maximum supported resolution of the unrotated display + float maxRefreshRate; ///< The maximum supported refresh rate of the display + + AGSRect currentResolution; ///< The current resolution and position in the desktop, ignoring Eyefinity bezel compensation + AGSRect visibleResolution; ///< The visible resolution and position. When Eyefinity bezel compensation is enabled this will + ///< be the sub region in the Eyefinity single large surface (SLS) + float currentRefreshRate; ///< The current refresh rate + + int eyefinityGridCoordX; ///< The X coordinate in the Eyefinity grid. -1 if not in an Eyefinity group + int eyefinityGridCoordY; ///< The Y coordinate in the Eyefinity grid. -1 if not in an Eyefinity group + + double chromaticityRedX; ///< Red display primary X coord + double chromaticityRedY; ///< Red display primary Y coord + + double chromaticityGreenX; ///< Green display primary X coord + double chromaticityGreenY; ///< Green display primary Y coord + + double chromaticityBlueX; ///< Blue display primary X coord + double chromaticityBlueY; ///< Blue display primary Y coord + + double chromaticityWhitePointX; ///< White point X coord + double chromaticityWhitePointY; ///< White point Y coord + + double screenDiffuseReflectance; ///< Percentage expressed between 0 - 1 + double screenSpecularReflectance; ///< Percentage expressed between 0 - 1 + + double minLuminance; ///< The minimum luminance of the display in nits + double maxLuminance; ///< The maximum luminance of the display in nits + double avgLuminance; ///< The average luminance of the display in nits + + int logicalDisplayIndex; ///< The internally used index of this display + int adlAdapterIndex; ///< The internally used ADL adapter index +}; + +/// The device info struct used to describe a physical GPU enumerated by AGS +struct AGSDeviceInfo +{ + /// The architecture version + enum ArchitectureVersion + { + ArchitectureVersion_Unknown, ///< Unknown architecture, potentially from another IHV. Check AGSDeviceInfo::vendorId + ArchitectureVersion_PreGCN, ///< AMD architecture, pre-GCN + ArchitectureVersion_GCN ///< AMD GCN architecture + }; + + ArchitectureVersion architectureVersion; ///< Set to Unknown if not AMD hardware + const char* adapterString; ///< The adapter name string + int vendorId; ///< The vendor id + int deviceId; ///< The device id + int revisionId; ///< The revision id + + int numCUs; ///< Number of GCN compute units. Zero if not GCN + int coreClock; ///< Core clock speed at 100% power in MHz + int memoryClock; ///< Memory clock speed at 100% power in MHz + float teraFlops; ///< Teraflops of GPU. Zero if not GCN. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD + + int isPrimaryDevice; ///< Whether or not this is the primary adapter in the system. Not set on the WACK version. + long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. + + int numDisplays; ///< The number of active displays found to be attached to this adapter. + AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + + int eyefinityEnabled; ///< Indicates if Eyefinity is active + int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface. + int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface. + int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. + + int adlAdapterIndex; ///< Internally used index into the ADL list of adapters +}; + +/// \defgroup general General API functions +/// API for initialization, cleanup, HDR display modes and Crossfire GPU count +/// @{ + +typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( int allocationSize ); ///< AGS user defined allocation prototype +typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype + + /// The configuration options that can be passed in to \ref agsInit +struct AGSConfiguration +{ + AGS_ALLOC_CALLBACK allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used + AGS_FREE_CALLBACK freeCallback; ///< Optional memory freeing callback. If not supplied, free() is used + AGSCrossfireMode crossfireMode; ///< Desired Crossfire mode +}; + +/// The top level GPU information returned from \ref agsInit +struct AGSGPUInfo +{ + int agsVersionMajor; ///< Major field of Major.Minor.Patch AGS version number + int agsVersionMinor; ///< Minor field of Major.Minor.Patch AGS version number + int agsVersionPatch; ///< Patch field of Major.Minor.Patch AGS version number + int isWACKCompliant; ///< 1 if WACK compliant. + + const char* driverVersion; ///< The AMD driver package version + const char* radeonSoftwareVersion; ///< The Radeon Software Version + + int numDevices; ///< Number of GPUs in the system + AGSDeviceInfo* devices; ///< List of GPUs in the system +}; + +/// The struct to specify the display settings to the driver. +struct AGSDisplaySettings +{ + /// The display mode + enum Mode + { + Mode_SDR, ///< SDR mode + Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. + Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. + Mode_Freesync2_scRGB, ///< Freesync2 scRGB, requiring an FP16 swapchain. Values in the range of 0.0 to 125.0 where 125.0 == AGSDisplayInfo::maxLuminance. + Mode_DolbyVision ///< Dolby Vision, requiring an 8888 UNORM swapchain + }; + + Mode mode; ///< The display mode to set the display into + + double chromaticityRedX; ///< Red display primary X coord + double chromaticityRedY; ///< Red display primary Y coord + + double chromaticityGreenX; ///< Green display primary X coord + double chromaticityGreenY; ///< Green display primary Y coord + + double chromaticityBlueX; ///< Blue display primary X coord + double chromaticityBlueY; ///< Blue display primary Y coord + + double chromaticityWhitePointX; ///< White point X coord + double chromaticityWhitePointY; ///< White point Y coord + + double minLuminance; ///< The minimum scene luminance in nits + double maxLuminance; ///< The maximum scene luminance in nits + + double maxContentLightLevel; ///< The maximum content light level in nits (MaxCLL) + double maxFrameAverageLightLevel; ///< The maximum frame average light level in nits (MaxFALL) +}; + +/// +/// Function used to initialize the AGS library. +/// Must be called prior to any of the subsequent AGS API calls. +/// Must be called prior to ID3D11Device or ID3D12Device creation. +/// \note This function will fail with AGS_ERROR_LEGACY_DRIVER in Catalyst versions before 12.20. +/// \note It is good practice to check the AGS version returned from AGSGPUInfo against the version defined in the header in case a mismatch between the dll and header has occurred. +/// +/// \param [in, out] context Address of a pointer to a context. This function allocates a context on the heap which is then required for all subsequent API calls. +/// \param [in] config Optional pointer to a AGSConfiguration struct to override the default library configuration. +/// \param [out] gpuInfo Optional pointer to a AGSGPUInfo struct which will get filled in for all the GPUs in the system. +/// +AMD_AGS_API AGSReturnCode agsInit( AGSContext** context, const AGSConfiguration* config, AGSGPUInfo* gpuInfo ); + +/// +/// Function used to clean up the AGS library. +/// +/// \param [in] context Pointer to a context. This function will deallocate the context from the heap. +/// +AMD_AGS_API AGSReturnCode agsDeInit( AGSContext* context ); + +/// +/// Function used to query the number of GPUs used for Crossfire acceleration. +/// This may be different from the total number of GPUs present in the system. +/// +/// \param [in] context Pointer to a context. +/// \param [out] numGPUs Number of GPUs used for Crossfire acceleration +/// +AMD_AGS_API AGSReturnCode agsGetCrossfireGPUCount( AGSContext* context, int* numGPUs ); + +/// +/// Function used to set a specific display into HDR mode +/// \note Setting all of the values apart from color space and transfer function to zero will cause the display to use defaults. +/// \note Call this function after each mode change (switch to fullscreen, any change in swapchain etc). +/// \note HDR10 PQ mode requires a 1010102 swapchain. +/// \note HDR10 scRGB mode requires an FP16 swapchain. +/// \note Freesync2 Gamma mode requires a 1010102 swapchain. +/// \note Freesync2 scRGB mode requires an FP16 swapchain. +/// \note Dolby Vision requires a 8888 UNORM swapchain. +/// +/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] deviceIndex The index of the device listed in \ref AGSGPUInfo::devices. +/// \param [in] displayIndex The index of the display listed in \ref AGSDeviceInfo::displays. +/// \param [in] settings Pointer to the display settings to use. +/// +AMD_AGS_API AGSReturnCode agsSetDisplayMode( AGSContext* context, int deviceIndex, int displayIndex, const AGSDisplaySettings* settings ); + +/// @} + +/// \defgroup dx12 DirectX12 Extensions +/// DirectX12 driver extensions +/// @{ + +/// \defgroup dx12init Initialization and Cleanup +/// @{ + +/// +/// Function used to initialize the AMD-specific driver extensions for D3D12. +/// Extensions require support in the driver, therefore it is important to check the extensionsSupported bitfield. +/// +/// When using the HLSL shader extensions please note: +/// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION option, otherwise it will not work. +/// * The intrinsic instructions require a 5.1 shader model. +/// * The Root Signature will need to use an extra resource and sampler. These are not real resources/samplers, they are just used to encode the intrinsic instruction. +/// +/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] device The D3D12 device. +/// \param [out] extensionsSupported Pointer to a bit mask that this function will fill in to indicate which extensions are supported. See ::AGSDriverExtensionDX12 +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_Init( AGSContext* context, ID3D12Device* device, unsigned int* extensionsSupported ); + +/// +/// Function used to cleanup any AMD-specific driver extensions for D3D12 +/// +/// \param [in] context Pointer to a context. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DeInit( AGSContext* context ); + +/// @} + +/// \defgroup dx12usermarkers User Markers +/// @{ + +/// +/// Function used to push an AMD user marker onto the command list. +/// This is only has an effect if AGS_DX12_EXTENSION_USER_MARKERS is present in the extensionsSupported bitfield of agsDriverExtensionsDX12_Init() +/// Supported in Radeon Software Version 17.9.1 onwards. +/// +/// \param [in] context Pointer to a context. +/// \param [in] commandList Pointer to the command list. +/// \param [in] data The marker string. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_PushMarker( AGSContext* context, ID3D12GraphicsCommandList* commandList, const char* data ); + +/// +/// Function used to pop an AMD user marker on the command list. +/// Supported in Radeon Software Version 17.9.1 onwards. +/// +/// \param [in] context Pointer to a context. +/// \param [in] commandList Pointer to the command list. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_PopMarker( AGSContext* context, ID3D12GraphicsCommandList* commandList ); + +/// +/// Function used to insert an single event AMD user marker onto the command list. +/// Supported in Radeon Software Version 17.9.1 onwards. +/// +/// \param [in] context Pointer to a context. +/// \param [in] commandList Pointer to the command list. +/// \param [in] data The marker string. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_SetMarker( AGSContext* context, ID3D12GraphicsCommandList* commandList, const char* data ); + +/// @} + +/// @} + +/// \defgroup dx11 DirectX11 Extensions +/// DirectX11 driver extensions +/// @{ + +/// \defgroup dx11init Device creation and cleanup +/// It is now mandatory to call agsDriverExtensionsDX11_CreateDevice() when creating a device if the user wants to access any DX11 AMD extensions. +/// The corresponding agsDriverExtensionsDX11_DestroyDevice() call must be called to release the device and free up the internal resources allocated by the create call. +/// @{ + +/// The struct to specify the existing DX11 device creation parameters +struct AGSDX11DeviceCreationParams +{ + IDXGIAdapter* pAdapter; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + D3D_DRIVER_TYPE DriverType; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + HMODULE Software; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + UINT Flags; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + const D3D_FEATURE_LEVEL* pFeatureLevels; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + UINT FeatureLevels; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + UINT SDKVersion; ///< Consult the DX documentation on D3D11CreateDevice for this parameter + const DXGI_SWAP_CHAIN_DESC* pSwapChainDesc; ///< Optional swapchain description. Specify this to invoke D3D11CreateDeviceAndSwapChain instead of D3D11CreateDevice. This must be null on the WACK compliant version +}; + +#define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX11ExtensionParams +#define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version + +/// The struct to specify DX11 additional device creation parameters +struct AGSDX11ExtensionParams +{ + unsigned int uavSlot; ///< The UAV slot reserved for intrinsic support. This must match the slot defined in the HLSL, i.e. #define AmdDxExtShaderIntrinsicsUAVSlot. + /// The default slot is 7, but the caller is free to use an alternative slot. + const WCHAR* pAppName; ///< Application name + UINT appVersion; ///< Application version + const WCHAR* pEngineName; ///< Engine name + UINT engineVersion; ///< Engine version +}; + +/// The struct to hold all the returned parameters from the device creation call +struct AGSDX11ReturnedParams +{ + ID3D11Device* pDevice; ///< The newly created device + D3D_FEATURE_LEVEL FeatureLevel; ///< The feature level supported by the newly created device + ID3D11DeviceContext* pImmediateContext; ///< The newly created immediate device context + IDXGISwapChain* pSwapChain; ///< The newly created swap chain. This is only created if a valid pSwapChainDesc is supplied in AGSDX11DeviceCreationParams. This is not supported on the WACK compliant version + unsigned int extensionsSupported; ///< Bit mask that \ref agsDriverExtensionsDX11_CreateDevice will fill in to indicate which extensions are supported. See AGSDriverExtensionDX11 +}; + +/// +/// Function used to create a D3D11 device with additional AMD-specific initialization parameters. +/// +/// When using the HLSL shader extensions please note: +/// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION option, otherwise it will not work. +/// +/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] creationParams Pointer to the struct to specify the existing DX11 device creation parameters. +/// \param [in] extensionParams Optional pointer to the struct to specify DX11 additional device creation parameters. +/// \param [out] returnedParams Pointer to struct to hold all the returned parameters from the call. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateDevice( AGSContext* context, AGSDX11DeviceCreationParams* creationParams, AGSDX11ExtensionParams* extensionParams, AGSDX11ReturnedParams* returnedParams ); + +/// +/// Function to destroy the D3D11 device. +/// This call will also cleanup any AMD-specific driver extensions for D3D11. +/// +/// \param [in] context Pointer to a context. +/// \param [in] device Pointer to the D3D11 device. +/// \param [out] references Optional pointer to an unsigned int that will be set to the value returned from device->Release(). +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice( AGSContext* context, ID3D11Device* device, unsigned int* references ); + +/// @} + + +/// \defgroup dx11appreg App Registration +/// @{ +/// This extension allows an apllication to voluntarily register itself with the driver, providing a more robust app detection solution and avoid the issue of the driver +/// relying on exe names to match the app to a driver profile. +/// This feature is supported in Radeon Software Version 17.9.2 onwards. +/// Rules: +/// * AppName or EngineName must be set, but both are not required. Engine profiles will be used only if app specific profiles do not exist. +/// * In an engine, the EngineName should be set, so a default profile can be built. If an app modifies the engine, the AppName should be set, to allow a profile for the specific app. +/// * Version number is not mandatory, but heavily suggested. The use of which can prevent the use of profiles for incompatible versions (for instance engine versions that introduce or change features), and can help prevent older profiles from being used (and introducing new bugs) before the profile is tested with new app builds. +/// * If Version numbers are used and a new version is introduced, a new profile will not be enabled until an AMD engineer has been able to update a previous profile, or make a new one. +/// +/// The cases for profile selection are as follows: +/// +/// |Case|Profile Applied| +/// |----|---------------| +/// | App or Engine Version has profile | The profile is used. | +/// | App or Engine Version num < profile version num | The closest profile > the version number is used. | +/// | App or Engine Version num > profile version num | No profile selected/The previous method is used. | +/// | App and Engine Version have profile | The App's profile is used. | +/// | App and Engine Version num < profile version | The closest App profile > the version number is used. | +/// | App and Engine Version, no App profile found | The Engine profile will be used. | +/// | App/Engine name but no Version, has profile | The latest profile is used. | +/// | No name or version, or no profile | The previous app detection method is used. | +/// +/// As shown above, if an App name is given, and a profile is found for that app, that will be prioritized. The Engine name and profile will be used only if no app name is given, or no viable profile is found for the app name. +/// In the case that App nor Engine have a profile, the previous app detection methods will be used. If given a version number that is larger than any profile version number, no profile will be selected. +/// This is specifically to prevent cases where an update to an engine or app will cause catastrophic breaks in the profile, allowing an engineer to test the profile before clearing it for public use with the new engine/app update. +/// +/// @} + +/// \defgroup dx11misc Misc Extensions +/// API for depth bounds test, UAV overlap and prim topologies +/// @{ + +/// +/// Function used to set the primitive topology. If you are using any of the extended topology types, then this function should +/// be called to set ALL topology types. +/// +/// The Quad List extension is a convenient way to submit quads without using an index buffer. Note that this still submits two triangles at the driver level. +/// In order to use this function, AGS must already be initialized and agsDriverExtensionsDX11_Init must have been called successfully. +/// +/// The Screen Rect extension, which is only available on GCN hardware, allows the user to pass in three of the four corners of a rectangle. +/// The hardware then uses the bounding box of the vertices to rasterize the rectangle primitive (i.e. as a rectangle rather than two triangles). +/// \note Note that this will not return valid interpolated values, only valid SV_Position values. +/// \note If either the Quad List or Screen Rect extension are used, then agsDriverExtensionsDX11_IASetPrimitiveTopology should be called in place of the native DirectX11 equivalent all the time. +/// +/// \param [in] context Pointer to a context. +/// \param [in] topology The topology to set on the D3D11 device. This can be either an AGS-defined topology such as AGS_PRIMITIVE_TOPOLOGY_QUAD_LIST +/// or a standard D3D-defined topology such as D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP. +/// NB. the AGS-defined types will require casting to a D3D_PRIMITIVE_TOPOLOGY type. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_IASetPrimitiveTopology( AGSContext* context, enum D3D_PRIMITIVE_TOPOLOGY topology ); + +/// +/// Function used indicate to the driver it can overlap the subsequent batch of back-to-back dispatches. +/// When calling back-to-back draw calls or dispatch calls that write to the same UAV, the AMD DX11 driver will automatically insert a barrier to ensure there are no write after write (WAW) hazards. +/// If the app can guarantee there is no overlap between the writes between these calls, then this extension will remove those barriers allowing the work to run in parallel on the GPU. +/// +/// Usage would be as follows: +/// \code{.cpp} +/// // Disable automatic WAW syncs +/// agsDriverExtensionsDX11_BeginUAVOverlap( m_agsContext ); +/// +/// // Submit back-to-back dispatches that write to the same UAV +/// m_device->Dispatch( ... ); // First half of UAV +/// m_device->Dispatch( ... ); // Second half of UAV +/// +/// // Reenable automatic WAW syncs +/// agsDriverExtensionsDX11_EndUAVOverlap( m_agsContext ); +/// \endcode +/// +/// \param [in] context Pointer to a context. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_BeginUAVOverlap( AGSContext* context ); + +/// +/// Function used indicate to the driver it can no longer overlap the batch of back-to-back dispatches that has been submitted. +/// +/// \param [in] context Pointer to a context. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_EndUAVOverlap( AGSContext* context ); + +/// +/// Function used to set the depth bounds test extension +/// +/// \param [in] context Pointer to a context. +/// \param [in] enabled Whether to enable or disable the depth bounds testing. If disabled, the next two args are ignored. +/// \param [in] minDepth The near depth range to clip against. +/// \param [in] maxDepth The far depth range to clip against. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* context, bool enabled, float minDepth, float maxDepth ); + +/// @} + +/// \defgroup mdi Multi Draw Indirect (MDI) +/// API for dispatching multiple instanced draw commands. +/// The multi draw indirect extensions allow multiple sets of DrawInstancedIndirect to be submitted in one API call. +/// The draw calls are issued on the GPU's command processor (CP), potentially saving the significant CPU overheads incurred by submitting the equivalent draw calls on the CPU. +/// +/// The extension allows the following code: +/// \code{.cpp} +/// // Submit n batches of DrawIndirect calls +/// for ( int i = 0; i < n; i++ ) +/// DrawIndexedInstancedIndirect( buffer, i * sizeof( cmd ) ); +/// \endcode +/// To be replaced by the following call: +/// \code{.cpp} +/// // Submit all n batches in one call +/// agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( m_agsContext, n, buffer, 0, sizeof( cmd ) ); +/// \endcode +/// +/// The buffer used for the indirect args must be of the following formats: +/// \code{.cpp} +/// // Buffer layout for agsDriverExtensions_MultiDrawInstancedIndirect +/// struct DrawInstancedIndirectArgs +/// { +/// UINT VertexCountPerInstance; +/// UINT InstanceCount; +/// UINT StartVertexLocation; +/// UINT StartInstanceLocation; +/// }; +/// +/// // Buffer layout for agsDriverExtensions_MultiDrawIndexedInstancedIndirect +/// struct DrawIndexedInstancedIndirectArgs +/// { +/// UINT IndexCountPerInstance; +/// UINT InstanceCount; +/// UINT StartIndexLocation; +/// UINT BaseVertexLocation; +/// UINT StartInstanceLocation; +/// }; +/// \endcode +/// +/// @{ + +/// +/// Function used to submit a batch of draws via MultiDrawIndirect +/// +/// \param [in] context Pointer to a context. +/// \param [in] drawCount The number of draws. +/// \param [in] pBufferForArgs The args buffer. +/// \param [in] alignedByteOffsetForArgs The offset into the args buffer. +/// \param [in] byteStrideForArgs The per element stride of the args buffer. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirect( AGSContext* context, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); + +/// +/// Function used to submit a batch of draws via MultiDrawIndirect +/// +/// \param [in] context Pointer to a context. +/// \param [in] drawCount The number of draws. +/// \param [in] pBufferForArgs The args buffer. +/// \param [in] alignedByteOffsetForArgs The offset into the args buffer. +/// \param [in] byteStrideForArgs The per element stride of the args buffer. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( AGSContext* context, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); + +/// +/// Function used to submit a batch of draws via MultiDrawIndirect +/// +/// \param [in] context Pointer to a context. +/// \param [in] pBufferForDrawCount The draw count buffer. +/// \param [in] alignedByteOffsetForDrawCount The offset into the draw count buffer. +/// \param [in] pBufferForArgs The args buffer. +/// \param [in] alignedByteOffsetForArgs The offset into the args buffer. +/// \param [in] byteStrideForArgs The per element stride of the args buffer. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect( AGSContext* context, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); + +/// +/// Function used to submit a batch of draws via MultiDrawIndirect +/// +/// \param [in] context Pointer to a context. +/// \param [in] pBufferForDrawCount The draw count buffer. +/// \param [in] alignedByteOffsetForDrawCount The offset into the draw count buffer. +/// \param [in] pBufferForArgs The args buffer. +/// \param [in] alignedByteOffsetForArgs The offset into the args buffer. +/// \param [in] byteStrideForArgs The per element stride of the args buffer. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect( AGSContext* context, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); + +/// @} + +/// \defgroup shadercompiler Shader Compiler Controls +/// API for controlling DirectX11 shader compilation. +/// Check support for this feature using the AGS_DX11_EXTENSION_CREATE_SHADER_CONTROLS bit. +/// Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. +/// @{ + +/// +/// This method can be used to limit the maximum number of threads the driver uses for asynchronous shader compilation. +/// Setting it to 0 will disable asynchronous compilation completely and force the shaders to be compiled "inline" on the threads that call Create*Shader. +/// +/// This method can only be called before any shaders are created and being compiled by the driver. +/// If this method is called after shaders have been created the function will return AGS_FAILURE. +/// This function only sets an upper limit.The driver may create fewer threads than allowed by this function. +/// +/// \param [in] context Pointer to a context. +/// \param [in] numberOfThreads The maximum number of threads to use. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount( AGSContext* context, unsigned int numberOfThreads ); + +/// +/// This method can be used to determine the total number of asynchronous shader compile jobs that are either +/// queued for waiting for compilation or being compiled by the driver’s asynchronous compilation threads. +/// This method can be called at any during the lifetime of the driver. +/// +/// \param [in] context Pointer to a context. +/// \param [out] numberOfJobs Pointer to the number of jobs in flight currently. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NumPendingAsyncCompileJobs( AGSContext* context, unsigned int* numberOfJobs ); + +/// +/// This method can be used to enable or disable the disk based shader cache. +/// Enabling/disabling the disk cache is not supported if is it disabled explicitly via Radeon Settings or by an app profile. +/// Calling this method under these conditions will result in AGS_FAILURE being returned. +/// It is recommended that this method be called before any shaders are created by the application and being compiled by the driver. +/// Doing so at any other time may result in the cache being left in an inconsistent state. +/// +/// \param [in] context Pointer to a context. +/// \param [in] enable Whether to enable the disk cache. 0 to disable, 1 to enable. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDiskShaderCacheEnabled( AGSContext* context, int enable ); + +/// @} + +/// \defgroup multiview Multiview +/// API for multiview broadcasting. +/// Check support for this feature using the AGS_DX11_EXTENSION_MULTIVIEW bit. +/// Supported in Radeon Software Version 16.12.1 (driver version 16.50.2001) onwards. +/// @{ + +/// +/// Function to control draw calls replication to multiple viewports and RT slices. +/// Setting any mask to 0 disables draw replication. +/// +/// \param [in] context Pointer to a context. +/// \param [in] vpMask Viewport control bit mask. +/// \param [in] rtSliceMask RT slice control bit mask. +/// \param [in] vpMaskPerRtSliceEnabled If 0, 16 lower bits of vpMask apply to all RT slices; if 1 each 16 bits of 64-bit mask apply to corresponding 4 RT slices. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetViewBroadcastMasks( AGSContext* context, unsigned long long vpMask, unsigned long long rtSliceMask, int vpMaskPerRtSliceEnabled ); + +/// +/// Function returns max number of supported clip rectangles. +/// +/// \param [in] context Pointer to a context. +/// \param [out] maxRectCount Returned max number of clip rectangles. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_GetMaxClipRects( AGSContext* context, unsigned int* maxRectCount ); + +/// +/// Function sets clip rectangles. +/// +/// \param [in] context Pointer to a context. +/// \param [in] clipRectCount Number of specified clip rectangles. Use 0 to disable clip rectangles. +/// \param [in] clipRects Array of clip rectangles. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetClipRects( AGSContext* context, unsigned int clipRectCount, const AGSClipRect* clipRects ); + +/// @} + +/// \defgroup cfxapi Explicit Crossfire API +/// API for explicit control over Crossfire +/// @{ + +/// +/// Function to create a Direct3D11 resource with the specified AFR transfer type and specified transfer engine. +/// +/// \param [in] context Pointer to a context. +/// \param [in] desc Pointer to the D3D11 resource description. +/// \param [in] initialData Optional pointer to the initializing data for the resource. +/// \param [out] buffer Returned pointer to the resource. +/// \param [in] transferType The transfer behavior. +/// \param [in] transferEngine The transfer engine to use. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateBuffer( AGSContext* context, const D3D11_BUFFER_DESC* desc, const D3D11_SUBRESOURCE_DATA* initialData, ID3D11Buffer** buffer, AGSAfrTransferType transferType, AGSAfrTransferEngine transferEngine ); + +/// +/// Function to create a Direct3D11 resource with the specified AFR transfer type and specified transfer engine. +/// +/// \param [in] context Pointer to a context. +/// \param [in] desc Pointer to the D3D11 resource description. +/// \param [in] initialData Optional pointer to the initializing data for the resource. +/// \param [out] texture1D Returned pointer to the resource. +/// \param [in] transferType The transfer behavior. +/// \param [in] transferEngine The transfer engine to use. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateTexture1D( AGSContext* context, const D3D11_TEXTURE1D_DESC* desc, const D3D11_SUBRESOURCE_DATA* initialData, ID3D11Texture1D** texture1D, AGSAfrTransferType transferType, AGSAfrTransferEngine transferEngine ); + +/// +/// Function to create a Direct3D11 resource with the specified AFR transfer type and specified transfer engine. +/// +/// \param [in] context Pointer to a context. +/// \param [in] desc Pointer to the D3D11 resource description. +/// \param [in] initialData Optional pointer to the initializing data for the resource. +/// \param [out] texture2D Returned pointer to the resource. +/// \param [in] transferType The transfer behavior. +/// \param [in] transferEngine The transfer engine to use. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateTexture2D( AGSContext* context, const D3D11_TEXTURE2D_DESC* desc, const D3D11_SUBRESOURCE_DATA* initialData, ID3D11Texture2D** texture2D, AGSAfrTransferType transferType, AGSAfrTransferEngine transferEngine ); + +/// +/// Function to create a Direct3D11 resource with the specified AFR transfer type and specified transfer engine. +/// +/// \param [in] context Pointer to a context. +/// \param [in] desc Pointer to the D3D11 resource description. +/// \param [in] initialData Optional pointer to the initializing data for the resource. +/// \param [out] texture3D Returned pointer to the resource. +/// \param [in] transferType The transfer behavior. +/// \param [in] transferEngine The transfer engine to use. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateTexture3D( AGSContext* context, const D3D11_TEXTURE3D_DESC* desc, const D3D11_SUBRESOURCE_DATA* initialData, ID3D11Texture3D** texture3D, AGSAfrTransferType transferType, AGSAfrTransferEngine transferEngine ); + +/// +/// Function to notify the driver that we have finished writing to the resource this frame. +/// This will initiate a transfer for AGS_AFR_TRANSFER_1STEP_P2P, +/// AGS_AFR_TRANSFER_2STEP_NO_BROADCAST, and AGS_AFR_TRANSFER_2STEP_WITH_BROADCAST. +/// +/// \param [in] context Pointer to a context. +/// \param [in] resource Pointer to the resource. +/// \param [in] transferRegions An array of transfer regions (can be null to specify the whole area). +/// \param [in] subresourceArray An array of subresource indices (can be null to specify all subresources). +/// \param [in] numSubresources The number of subresources in subresourceArray OR number of transferRegions. Use 0 to specify ALL subresources and one transferRegion (which may be null if specifying the whole area). +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NotifyResourceEndWrites( AGSContext* context, ID3D11Resource* resource, const D3D11_RECT* transferRegions, const unsigned int* subresourceArray, unsigned int numSubresources ); + +/// +/// This will notify the driver that the app will begin read/write access to the resource. +/// +/// \param [in] context Pointer to a context. +/// \param [in] resource Pointer to the resource. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NotifyResourceBeginAllAccess( AGSContext* context, ID3D11Resource* resource ); + +/// +/// This is used for AGS_AFR_TRANSFER_1STEP_P2P to notify when it is safe to initiate a transfer. +/// This call in frame N-(NumGpus-1) allows a 1 step P2P in frame N to start. +/// This should be called after agsDriverExtensionsDX11_NotifyResourceEndWrites. +/// +/// \param [in] context Pointer to a context. +/// \param [in] resource Pointer to the resource. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NotifyResourceEndAllAccess( AGSContext* context, ID3D11Resource* resource ); + +/// @} + +/// @} + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // AMD_AGS_H From 351db010421cb0634a87e820add429eda3b42abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 23 Jul 2018 19:53:20 +0200 Subject: [PATCH 0589/1506] amd_ags_x64: Make amd_ags.h usable with gcc. --- dlls/amd_ags_x64/amd_ags.h | 110 +++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 59 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 9c3e37e52e5..a83a1f88692 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -96,8 +96,7 @@ extern "C" { #endif - -#define AMD_AGS_API __declspec(dllexport) ///< AGS calling convention +#define AMD_AGS_API WINAPI // Forward declaration of D3D11 types struct IDXGIAdapter; @@ -117,8 +116,6 @@ struct D3D11_TEXTURE1D_DESC; struct D3D11_TEXTURE2D_DESC; struct D3D11_TEXTURE3D_DESC; struct D3D11_SUBRESOURCE_DATA; -struct tagRECT; -typedef tagRECT D3D11_RECT; ///< typedef this ourselves so we don't have to drag d3d11.h in // Forward declaration of D3D12 types struct ID3D12Device; @@ -126,7 +123,7 @@ struct ID3D12GraphicsCommandList; /// The return codes -enum AGSReturnCode +typedef enum AGSReturnCode { AGS_SUCCESS, ///< Successful function call AGS_FAILURE, ///< Failed to complete call for some unspecified reason @@ -136,10 +133,10 @@ enum AGSReturnCode AGS_ERROR_LEGACY_DRIVER, ///< Returned if a feature is not present in the installed driver AGS_EXTENSION_NOT_SUPPORTED, ///< Returned if the driver does not support the requested driver extension AGS_ADL_FAILURE, ///< Failure in ADL (the AMD Display Library) -}; +} AGSReturnCode; /// The DirectX11 extension support bits -enum AGSDriverExtensionDX11 +typedef enum AGSDriverExtensionDX11 { AGS_DX11_EXTENSION_QUADLIST = 1 << 0, AGS_DX11_EXTENSION_SCREENRECTLIST = 1 << 1, @@ -161,10 +158,10 @@ enum AGSDriverExtensionDX11 AGS_DX11_EXTENSION_CREATE_SHADER_CONTROLS = 1 << 17, AGS_DX11_EXTENSION_MULTIVIEW = 1 << 18, AGS_DX11_EXTENSION_APP_REGISTRATION = 1 << 19 ///< Supported in Radeon Software Version 17.9.1 onwards. -}; +} AGSDriverExtensionDX11; /// The DirectX12 extension support bits -enum AGSDriverExtensionDX12 +typedef enum AGSDriverExtensionDX12 { AGS_DX12_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 0, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. AGS_DX12_EXTENSION_INTRINSIC_READLANE = 1 << 1, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. @@ -177,48 +174,48 @@ enum AGSDriverExtensionDX12 AGS_DX12_EXTENSION_INTRINSIC_WAVE_REDUCE = 1 << 8, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX12_EXTENSION_INTRINSIC_WAVE_SCAN = 1 << 9, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX12_EXTENSION_USER_MARKERS = 1 << 10 ///< Supported in Radeon Software Version 17.9.1 onwards. -}; +} AGSDriverExtensionDX12; /// The space id for DirectX12 intrinsic support const unsigned int AGS_DX12_SHADER_INSTRINSICS_SPACE_ID = 0x7FFF0ADE; // 2147420894 /// Additional topologies supported via extensions -enum AGSPrimitiveTopology +typedef enum AGSPrimitiveTopology { AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 -}; +} AGSPrimitiveTopology; /// The different modes to control Crossfire behavior. -enum AGSCrossfireMode +typedef enum AGSCrossfireMode { AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering -}; +} AGSCrossfireMode; /// The Crossfire API transfer types -enum AGSAfrTransferType +typedef enum AGSAfrTransferType { AGS_AFR_TRANSFER_DEFAULT = 0, ///< Default Crossfire driver resource tracking AGS_AFR_TRANSFER_DISABLE = 1, ///< Turn off driver resource tracking AGS_AFR_TRANSFER_1STEP_P2P = 2, ///< App controlled GPU to next GPU transfer AGS_AFR_TRANSFER_2STEP_NO_BROADCAST = 3, ///< App controlled GPU to next GPU transfer using intermediate system memory AGS_AFR_TRANSFER_2STEP_WITH_BROADCAST = 4, ///< App controlled GPU to all render GPUs transfer using intermediate system memory -}; +} AGSAfrTransferType; /// The Crossfire API transfer engines -enum AGSAfrTransferEngine +typedef enum AGSAfrTransferEngine { AGS_AFR_TRANSFERENGINE_DEFAULT = 0, ///< Use default engine for Crossfire API transfers AGS_AFR_TRANSFERENGINE_3D_ENGINE = 1, ///< Use 3D engine for Crossfire API transfers AGS_AFR_TRANSFERENGINE_COPY_ENGINE = 2, ///< Use Copy engine for Crossfire API transfers -}; +} AGSAfrTransferEngine; /// The display flags describing various properties of the display. -enum AGSDisplayFlags +typedef enum AGSDisplayFlags { AGS_DISPLAYFLAG_PRIMARY_DISPLAY = 1 << 0, ///< Whether this display is marked as the primary display. Not set on the WACK version. AGS_DISPLAYFLAG_HDR10 = 1 << 1, ///< HDR10 is supported on this display @@ -228,35 +225,33 @@ enum AGSDisplayFlags AGS_DISPLAYFLAG_EYEFINITY_IN_GROUP = 1 << 5, ///< The display is part of the Eyefinity group AGS_DISPLAYFLAG_EYEFINITY_PREFERRED_DISPLAY = 1 << 6, ///< The display is the preferred display in the Eyefinity group for displaying the UI AGS_DISPLAYFLAG_EYEFINITY_IN_PORTRAIT_MODE = 1 << 7, ///< The display is in the Eyefinity group but in portrait mode -}; +} AGSDisplayFlags; -struct AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInit +typedef struct AGSContext AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInit /// The rectangle struct used by AGS. -struct AGSRect +typedef struct AGSRect { int offsetX; ///< Offset on X axis int offsetY; ///< Offset on Y axis int width; ///< Width of rectangle int height; ///< Height of rectangle -}; +} AGSRect; /// The clip rectangle struct used by \ref agsDriverExtensionsDX11_SetClipRects -struct AGSClipRect +typedef struct AGSClipRect { /// The inclusion mode for the rect - enum Mode + enum { ClipRectIncluded = 0, ///< Include the rect ClipRectExcluded = 1 ///< Exclude the rect - }; - - Mode mode; ///< Include/exclude rect region + } mode; ; ///< Include/exclude rect region AGSRect rect; ///< The rect to include/exclude -}; +} AGSClipRect; /// The display info struct used to describe a display enumerated by AGS -struct AGSDisplayInfo +typedef struct AGSDisplayInfo { char name[ 256 ]; ///< The name of the display char displayDeviceName[ 32 ]; ///< The display device name, i.e. DISPLAY_DEVICE::DeviceName @@ -296,19 +291,19 @@ struct AGSDisplayInfo int logicalDisplayIndex; ///< The internally used index of this display int adlAdapterIndex; ///< The internally used ADL adapter index -}; +} AGSDisplayInfo; -/// The device info struct used to describe a physical GPU enumerated by AGS -struct AGSDeviceInfo +/// The architecture version +typedef enum ArchitectureVersion { - /// The architecture version - enum ArchitectureVersion - { - ArchitectureVersion_Unknown, ///< Unknown architecture, potentially from another IHV. Check AGSDeviceInfo::vendorId - ArchitectureVersion_PreGCN, ///< AMD architecture, pre-GCN - ArchitectureVersion_GCN ///< AMD GCN architecture - }; + ArchitectureVersion_Unknown, ///< Unknown architecture, potentially from another IHV. Check \ref AGSDeviceInfo::vendorId + ArchitectureVersion_PreGCN, ///< AMD architecture, pre-GCN + ArchitectureVersion_GCN ///< AMD GCN architecture +} ArchitectureVersion; +/// The device info struct used to describe a physical GPU enumerated by AGS +typedef struct AGSDeviceInfo +{ ArchitectureVersion architectureVersion; ///< Set to Unknown if not AMD hardware const char* adapterString; ///< The adapter name string int vendorId; ///< The vendor id @@ -334,7 +329,7 @@ struct AGSDeviceInfo int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. int adlAdapterIndex; ///< Internally used index into the ADL list of adapters -}; +} AGSDeviceInfo; /// \defgroup general General API functions /// API for initialization, cleanup, HDR display modes and Crossfire GPU count @@ -343,16 +338,15 @@ struct AGSDeviceInfo typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( int allocationSize ); ///< AGS user defined allocation prototype typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype - /// The configuration options that can be passed in to \ref agsInit -struct AGSConfiguration +/// The configuration options that can be passed in to \ref agsInit +typedef struct AGSConfiguration { AGS_ALLOC_CALLBACK allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used AGS_FREE_CALLBACK freeCallback; ///< Optional memory freeing callback. If not supplied, free() is used - AGSCrossfireMode crossfireMode; ///< Desired Crossfire mode -}; +} AGSConfiguration; /// The top level GPU information returned from \ref agsInit -struct AGSGPUInfo +typedef struct AGSGPUInfo { int agsVersionMajor; ///< Major field of Major.Minor.Patch AGS version number int agsVersionMinor; ///< Minor field of Major.Minor.Patch AGS version number @@ -364,22 +358,20 @@ struct AGSGPUInfo int numDevices; ///< Number of GPUs in the system AGSDeviceInfo* devices; ///< List of GPUs in the system -}; +} AGSGPUInfo; /// The struct to specify the display settings to the driver. -struct AGSDisplaySettings +typedef struct AGSDisplaySettings { /// The display mode - enum Mode + enum { Mode_SDR, ///< SDR mode Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. Mode_Freesync2_scRGB, ///< Freesync2 scRGB, requiring an FP16 swapchain. Values in the range of 0.0 to 125.0 where 125.0 == AGSDisplayInfo::maxLuminance. Mode_DolbyVision ///< Dolby Vision, requiring an 8888 UNORM swapchain - }; - - Mode mode; ///< The display mode to set the display into + } mode; ///< The display mode to set the display into double chromaticityRedX; ///< Red display primary X coord double chromaticityRedY; ///< Red display primary Y coord @@ -398,7 +390,7 @@ struct AGSDisplaySettings double maxContentLightLevel; ///< The maximum content light level in nits (MaxCLL) double maxFrameAverageLightLevel; ///< The maximum frame average light level in nits (MaxFALL) -}; +} AGSDisplaySettings; /// /// Function used to initialize the AGS library. @@ -526,7 +518,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_SetMarker( AGSContext* context /// @{ /// The struct to specify the existing DX11 device creation parameters -struct AGSDX11DeviceCreationParams +typedef struct AGSDX11DeviceCreationParams { IDXGIAdapter* pAdapter; ///< Consult the DX documentation on D3D11CreateDevice for this parameter D3D_DRIVER_TYPE DriverType; ///< Consult the DX documentation on D3D11CreateDevice for this parameter @@ -536,13 +528,13 @@ struct AGSDX11DeviceCreationParams UINT FeatureLevels; ///< Consult the DX documentation on D3D11CreateDevice for this parameter UINT SDKVersion; ///< Consult the DX documentation on D3D11CreateDevice for this parameter const DXGI_SWAP_CHAIN_DESC* pSwapChainDesc; ///< Optional swapchain description. Specify this to invoke D3D11CreateDeviceAndSwapChain instead of D3D11CreateDevice. This must be null on the WACK compliant version -}; +} AGSDX11DeviceCreationParams; #define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX11ExtensionParams #define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version /// The struct to specify DX11 additional device creation parameters -struct AGSDX11ExtensionParams +typedef struct AGSDX11ExtensionParams { unsigned int uavSlot; ///< The UAV slot reserved for intrinsic support. This must match the slot defined in the HLSL, i.e. #define AmdDxExtShaderIntrinsicsUAVSlot. /// The default slot is 7, but the caller is free to use an alternative slot. @@ -550,17 +542,17 @@ struct AGSDX11ExtensionParams UINT appVersion; ///< Application version const WCHAR* pEngineName; ///< Engine name UINT engineVersion; ///< Engine version -}; +} AGSDX11ExtensionParams; /// The struct to hold all the returned parameters from the device creation call -struct AGSDX11ReturnedParams +typedef struct AGSDX11ReturnedParams { ID3D11Device* pDevice; ///< The newly created device D3D_FEATURE_LEVEL FeatureLevel; ///< The feature level supported by the newly created device ID3D11DeviceContext* pImmediateContext; ///< The newly created immediate device context IDXGISwapChain* pSwapChain; ///< The newly created swap chain. This is only created if a valid pSwapChainDesc is supplied in AGSDX11DeviceCreationParams. This is not supported on the WACK compliant version unsigned int extensionsSupported; ///< Bit mask that \ref agsDriverExtensionsDX11_CreateDevice will fill in to indicate which extensions are supported. See AGSDriverExtensionDX11 -}; +} AGSDX11ReturnedParams; /// /// Function used to create a D3D11 device with additional AMD-specific initialization parameters. From 760d0b55f7834ca17e40d190a58116ecc2f87c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 23 Jul 2018 19:53:20 +0200 Subject: [PATCH 0590/1506] amd_ags_x64: Add dll. This is needed to avoid Wolfenstein 2 showing a driver warning dialog on AMD hardware. --- configure.ac | 1 + dlls/amd_ags_x64/Makefile.in | 7 + dlls/amd_ags_x64/amd_ags_x64.spec | 29 +++++ dlls/amd_ags_x64/amd_ags_x64_main.c | 193 ++++++++++++++++++++++++++++ 4 files changed, 230 insertions(+) create mode 100644 dlls/amd_ags_x64/Makefile.in create mode 100644 dlls/amd_ags_x64/amd_ags_x64.spec create mode 100644 dlls/amd_ags_x64/amd_ags_x64_main.c diff --git a/configure.ac b/configure.ac index c1564565c0f..ec29d4203f7 100644 --- a/configure.ac +++ b/configure.ac @@ -2432,6 +2432,7 @@ WINE_CONFIG_MAKEFILE(dlls/advapi32/tests) WINE_CONFIG_MAKEFILE(dlls/advpack) WINE_CONFIG_MAKEFILE(dlls/advpack/tests) WINE_CONFIG_MAKEFILE(dlls/amsi) +WINE_CONFIG_MAKEFILE(dlls/amd_ags_x64) WINE_CONFIG_MAKEFILE(dlls/amstream) WINE_CONFIG_MAKEFILE(dlls/amstream/tests) WINE_CONFIG_MAKEFILE(dlls/apisetschema) diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in new file mode 100644 index 00000000000..aa9036f1318 --- /dev/null +++ b/dlls/amd_ags_x64/Makefile.in @@ -0,0 +1,7 @@ +EXTRADEFS = -DWINE_NO_LONG_TYPES +MODULE = amd_ags_x64.dll +IMPORTS = vulkan-1 +IMPORTLIB = amd_ags_x64 + +SOURCES = \ + amd_ags_x64_main.c diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec new file mode 100644 index 00000000000..b4da6136a64 --- /dev/null +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -0,0 +1,29 @@ +1 stdcall agsDeInit(ptr) +2 stub agsDriverExtensionsDX11_BeginUAVOverlap +3 stub agsDriverExtensionsDX11_CreateBuffer +4 stub agsDriverExtensionsDX11_CreateTexture1D +5 stub agsDriverExtensionsDX11_CreateTexture2D +6 stub agsDriverExtensionsDX11_CreateTexture3D +7 stub agsDriverExtensionsDX11_DeInit +8 stub agsDriverExtensionsDX11_EndUAVOverlap +9 stub agsDriverExtensionsDX11_GetMaxClipRects +10 stub agsDriverExtensionsDX11_IASetPrimitiveTopology +11 stub agsDriverExtensionsDX11_Init +12 stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect +13 stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect +14 stub agsDriverExtensionsDX11_MultiDrawInstancedIndirect +15 stub agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect +16 stub agsDriverExtensionsDX11_NotifyResourceBeginAllAccess +17 stub agsDriverExtensionsDX11_NotifyResourceEndAllAccess +18 stub agsDriverExtensionsDX11_NotifyResourceEndWrites +19 stub agsDriverExtensionsDX11_NumPendingAsyncCompileJobs +20 stub agsDriverExtensionsDX11_SetClipRects +21 stub agsDriverExtensionsDX11_SetDepthBounds +22 stub agsDriverExtensionsDX11_SetDiskShaderCacheEnabled +23 stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount +24 stub agsDriverExtensionsDX11_SetViewBroadcastMasks +25 stub agsDriverExtensionsDX12_DeInit +26 stub agsDriverExtensionsDX12_Init +27 stub agsGetCrossfireGPUCount +28 stdcall agsInit(ptr ptr ptr) +29 stub agsSetDisplayMode diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c new file mode 100644 index 00000000000..382447089bc --- /dev/null +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -0,0 +1,193 @@ +#include "config.h" + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" +#include "wine/heap.h" + +#include "wine/vulkan.h" + +#include "d3d11.h" +#include "d3d12.h" + +#include "amd_ags.h" + +WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); + +struct AGSContext +{ + unsigned int device_count; + AGSDeviceInfo *devices; + VkPhysicalDeviceProperties *properties; +}; + +static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, + VkPhysicalDeviceProperties **out) +{ + VkPhysicalDeviceProperties *properties = NULL; + VkPhysicalDevice *vk_physical_devices = NULL; + VkInstance vk_instance = VK_NULL_HANDLE; + VkInstanceCreateInfo create_info; + AGSReturnCode ret = AGS_SUCCESS; + uint32_t count, i; + VkResult vr; + + *out = NULL; + *out_count = 0; + + memset(&create_info, 0, sizeof(create_info)); + create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + if ((vr = vkCreateInstance(&create_info, NULL, &vk_instance) < 0)) + { + WARN("Failed to create Vulkan instance, vr %d.\n", vr); + goto done; + } + + if ((vr = vkEnumeratePhysicalDevices(vk_instance, &count, NULL)) < 0) + { + WARN("Failed to enumerate devices, vr %d.\n", vr); + goto done; + } + + if (!(vk_physical_devices = heap_calloc(count, sizeof(*vk_physical_devices)))) + { + WARN("Failed to allocate memory.\n"); + ret = AGS_OUT_OF_MEMORY; + goto done; + } + + if ((vr = vkEnumeratePhysicalDevices(vk_instance, &count, vk_physical_devices)) < 0) + { + WARN("Failed to enumerate devices, vr %d.\n", vr); + goto done; + } + + if (!(properties = heap_calloc(count, sizeof(*properties)))) + { + WARN("Failed to allocate memory.\n"); + ret = AGS_OUT_OF_MEMORY; + goto done; + } + + for (i = 0; i < count; ++i) + vkGetPhysicalDeviceProperties(vk_physical_devices[i], &properties[i]); + + *out_count = count; + *out = properties; + +done: + heap_free(vk_physical_devices); + if (vk_instance) + vkDestroyInstance(vk_instance, NULL); + return ret; +} + +static AGSReturnCode init_ags_context(AGSContext *context) +{ + AGSReturnCode ret; + unsigned int i; + + context->device_count = 0; + context->devices = NULL; + context->properties = NULL; + + ret = vk_get_physical_device_properties(&context->device_count, &context->properties); + if (ret != AGS_SUCCESS || !context->device_count) + return ret; + + if (!(context->devices = heap_calloc(context->device_count, sizeof(*context->devices)))) + { + WARN("Failed to allocate memory.\n"); + heap_free(context->properties); + return AGS_OUT_OF_MEMORY; + } + + for (i = 0; i < context->device_count; ++i) + { + const VkPhysicalDeviceProperties *vk_properties = &context->properties[i]; + AGSDeviceInfo *device = &context->devices[i]; + + device->adapterString = vk_properties->deviceName; + device->vendorId = vk_properties->vendorID; + device->deviceId = vk_properties->deviceID; + + if (device->vendorId == 0x1002) + device->architectureVersion = ArchitectureVersion_GCN; + + if (!i) + device->isPrimaryDevice = 1; + } + + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *config, AGSGPUInfo *gpu_info) +{ + struct AGSContext *object; + AGSReturnCode ret; + + TRACE("context %p, config %p, gpu_info %p.\n", context, config, gpu_info); + + if (!context || !gpu_info) + return AGS_INVALID_ARGS; + + if (config) + FIXME("Ignoring config %p.\n", config); + + if (!(object = heap_alloc(sizeof(*object)))) + return AGS_OUT_OF_MEMORY; + + if ((ret = init_ags_context(object)) != AGS_SUCCESS) + { + heap_free(object); + return ret; + } + + memset(gpu_info, 0, sizeof(*gpu_info)); + gpu_info->agsVersionMajor = AMD_AGS_VERSION_MAJOR; + gpu_info->agsVersionMinor = AMD_AGS_VERSION_MINOR; + gpu_info->agsVersionPatch = AMD_AGS_VERSION_PATCH; + gpu_info->driverVersion = "18.10.16-180516a-328911C-RadeonSoftwareAdrenalin"; + gpu_info->radeonSoftwareVersion = "18.5.1"; + gpu_info->numDevices = object->device_count; + gpu_info->devices = object->devices; + + TRACE("Created context %p.\n", object); + + *context = object; + + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDeInit(AGSContext *context) +{ + TRACE("context %p.\n", context); + + if (context) + { + heap_free(context->properties); + heap_free(context->devices); + heap_free(context); + } + + return AGS_SUCCESS; +} + +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) +{ + TRACE("%p, %u, %p.\n", instance, reason, reserved); + + switch (reason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* Prefer native. */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(instance); + break; + } + + return TRUE; +} From b7d6af7c15f0aaeec4133a03feb379216a3eeb11 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 1 Oct 2019 09:28:29 +0800 Subject: [PATCH 0591/1506] amd_ags_x64: Add agsGetCrossfireGPUCount stub. Signed-off-by: Zhiyi Zhang --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index b4da6136a64..a302d2fc657 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -24,6 +24,6 @@ 24 stub agsDriverExtensionsDX11_SetViewBroadcastMasks 25 stub agsDriverExtensionsDX12_DeInit 26 stub agsDriverExtensionsDX12_Init -27 stub agsGetCrossfireGPUCount +27 stdcall agsGetCrossfireGPUCount(ptr ptr) 28 stdcall agsInit(ptr ptr ptr) 29 stub agsSetDisplayMode diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 382447089bc..26b39991525 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -176,6 +176,17 @@ AGSReturnCode WINAPI agsDeInit(AGSContext *context) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count) +{ + TRACE("context %p gpu_count %p stub!\n", context, gpu_count); + + if (!context || !gpu_count) + return AGS_INVALID_ARGS; + + *gpu_count = 1; + return AGS_SUCCESS; +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From 50a934060872e42c6ad4369babc1e8d7a99453d0 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Thu, 11 Jun 2020 15:39:32 -0700 Subject: [PATCH 0592/1506] amd_ags_x64: Build with msvcrt. Signed-off-by: Brendan Shanks --- dlls/amd_ags_x64/Makefile.in | 2 ++ dlls/amd_ags_x64/amd_ags_x64_main.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in index aa9036f1318..b2c2a28c064 100644 --- a/dlls/amd_ags_x64/Makefile.in +++ b/dlls/amd_ags_x64/Makefile.in @@ -3,5 +3,7 @@ MODULE = amd_ags_x64.dll IMPORTS = vulkan-1 IMPORTLIB = amd_ags_x64 +EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native + SOURCES = \ amd_ags_x64_main.c diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 26b39991525..e339d7b7d2b 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1,5 +1,3 @@ -#include "config.h" - #include #include @@ -193,8 +191,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) switch (reason) { - case DLL_WINE_PREATTACH: - return FALSE; /* Prefer native. */ case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(instance); break; From abd88b0b2a9350cb65bb32e4cbe1697a4c929c42 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Thu, 11 Jun 2020 17:33:56 -0700 Subject: [PATCH 0593/1506] amd_ags_x64: Update to 5.2.0. --- dlls/amd_ags_x64/amd_ags.h | 577 +++++++++++++++++++++++----- dlls/amd_ags_x64/amd_ags_x64_main.c | 60 ++- 2 files changed, 531 insertions(+), 106 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index a83a1f88692..b647f912aa7 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,7 +24,7 @@ /// \mainpage /// AGS Library Overview /// -------------------- -/// This document provides an overview of the AGS (AMD GPU Services) library. The AGS library provides software developers with the ability to query +/// This document provides an overview of the AGS (AMD GPU Services) library. The AGS library provides software developers with the ability to query /// AMD GPU software and hardware state information that is not normally available through standard operating systems or graphic APIs. /// /// The latest version of the API is publicly hosted here: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/. @@ -33,6 +33,15 @@ /// Online documentation is publicly hosted here: http://gpuopen-librariesandsdks.github.io/ags/ /// \endinternal /// +/// What's new in AGS 5.2.0 since version 5.1 +/// --------------------------------------- +/// AGS 5.2 includes the following updates: +/// * DX12 app registration API +/// * DX11 breadcrumb marker API for tracking down GPU hangs:\ref agsDriverExtensionsDX11_WriteBreadcrumb +/// * DX12 extensions now require the creation of the device via \ref agsDriverExtensionsDX12_CreateDevice +/// * agsGetCrossfireGPUCount has been removed in favor of retrieving the value from \ref agsDriverExtensionsDX11_CreateDevice +/// * API change that fixes a reference leak in \ref agsDriverExtensionsDX11_DestroyDevice +/// /// What's new in AGS 5.1.1 since version 5.0.6 /// --------------------------------------- /// AGS 5.1.1 includes the following updates: @@ -50,7 +59,7 @@ /// /// What's new in AGS 5.x since version 4.x /// --------------------------------------- -/// Version 5.x is a major overhaul of the library designed to provide a much clearer view of the GPUs in the system and the displays attached to them. +/// Version 5.x is a major overhaul of the library designed to provide a much clearer view of the GPUs in the system and the displays attached to them. /// It also exposes the ability to query each display for HDR capabilities and put those HDR capable displays into various HDR modes. /// Some functions such as agsGetGPUMemorySize and agsGetEyefinityConfigInfo have been removed in favor of including this information in the device & display enumeration. /// Features include: @@ -69,8 +78,8 @@ /// * AGSSample /// * CrossfireSample /// * EyefinitySample -/// The AGSSample application is the simplest of the three examples and demonstrates the code required to initialize AGS and use it to query the GPU and Eyefinity state. -/// The CrossfireSample application demonstrates the use of the new API to transfer resources on GPUs in Crossfire mode. Lastly, the EyefinitySample application provides a more +/// The AGSSample application is the simplest of the three examples and demonstrates the code required to initialize AGS and use it to query the GPU and Eyefinity state. +/// The CrossfireSample application demonstrates the use of the new API to transfer resources on GPUs in Crossfire mode. Lastly, the EyefinitySample application provides a more /// extensive example of Eyefinity setup than the basic example provided in AGSSample. /// There are other samples on Github that demonstrate the DirectX shader extensions, such as the Barycentrics11 and Barycentrics12 samples. /// @@ -80,17 +89,16 @@ /// * Include the amd_ags.h header file from your source code. /// * Include the AGS hlsl files if you are using the shader intrinsics. /// * Declare a pointer to an AGSContext and make this available for all subsequent calls to AGS. -/// * On game initialization, call agsInit() passing in the address of the context. On success, this function will return a valid context pointer. -/// * The agsInit() function should be called before the D3D device is created if the Crossfire mode is specified. +/// * On game initialization, call \ref agsInit passing in the address of the context. On success, this function will return a valid context pointer. /// -/// Don't forget to cleanup AGS by calling agsDeInit() when the app exits, after the device has been destroyed. +/// Don't forget to cleanup AGS by calling \ref agsDeInit when the app exits, after the device has been destroyed. #ifndef AMD_AGS_H #define AMD_AGS_H #define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version -#define AMD_AGS_VERSION_MINOR 1 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version +#define AMD_AGS_VERSION_MINOR 2 ///< AGS minor version +#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version #ifdef __cplusplus extern "C" { @@ -138,42 +146,44 @@ typedef enum AGSReturnCode /// The DirectX11 extension support bits typedef enum AGSDriverExtensionDX11 { - AGS_DX11_EXTENSION_QUADLIST = 1 << 0, - AGS_DX11_EXTENSION_SCREENRECTLIST = 1 << 1, - AGS_DX11_EXTENSION_UAV_OVERLAP = 1 << 2, - AGS_DX11_EXTENSION_DEPTH_BOUNDS_TEST = 1 << 3, - AGS_DX11_EXTENSION_MULTIDRAWINDIRECT = 1 << 4, - AGS_DX11_EXTENSION_MULTIDRAWINDIRECT_COUNTINDIRECT = 1 << 5, - AGS_DX11_EXTENSION_CROSSFIRE_API = 1 << 6, - AGS_DX11_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 7, - AGS_DX11_EXTENSION_INTRINSIC_READLANE = 1 << 8, - AGS_DX11_EXTENSION_INTRINSIC_LANEID = 1 << 9, - AGS_DX11_EXTENSION_INTRINSIC_SWIZZLE = 1 << 10, - AGS_DX11_EXTENSION_INTRINSIC_BALLOT = 1 << 11, - AGS_DX11_EXTENSION_INTRINSIC_MBCOUNT = 1 << 12, - AGS_DX11_EXTENSION_INTRINSIC_COMPARE3 = 1 << 13, - AGS_DX11_EXTENSION_INTRINSIC_BARYCENTRICS = 1 << 14, + AGS_DX11_EXTENSION_QUADLIST = 1 << 0, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_SCREENRECTLIST = 1 << 1, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_UAV_OVERLAP = 1 << 2, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_DEPTH_BOUNDS_TEST = 1 << 3, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_MULTIDRAWINDIRECT = 1 << 4, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_MULTIDRAWINDIRECT_COUNTINDIRECT = 1 << 5, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_CROSSFIRE_API = 1 << 6, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 7, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_READLANE = 1 << 8, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_LANEID = 1 << 9, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_SWIZZLE = 1 << 10, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_BALLOT = 1 << 11, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_MBCOUNT = 1 << 12, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_MED3 = 1 << 13, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_BARYCENTRICS = 1 << 14, ///< Supported in Radeon Software Version 16.9.2 onwards. AGS_DX11_EXTENSION_INTRINSIC_WAVE_REDUCE = 1 << 15, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX11_EXTENSION_INTRINSIC_WAVE_SCAN = 1 << 16, ///< Supported in Radeon Software Version 17.9.1 onwards. - AGS_DX11_EXTENSION_CREATE_SHADER_CONTROLS = 1 << 17, - AGS_DX11_EXTENSION_MULTIVIEW = 1 << 18, - AGS_DX11_EXTENSION_APP_REGISTRATION = 1 << 19 ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX11_EXTENSION_CREATE_SHADER_CONTROLS = 1 << 17, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX11_EXTENSION_MULTIVIEW = 1 << 18, ///< Supported in Radeon Software Version 16.12.1 onwards. + AGS_DX11_EXTENSION_APP_REGISTRATION = 1 << 19, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX11_EXTENSION_BREADCRUMB_MARKERS = 1 << 20, ///< Supported in Radeon Software Version 17.11.1 onwards. } AGSDriverExtensionDX11; /// The DirectX12 extension support bits typedef enum AGSDriverExtensionDX12 { - AGS_DX12_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 0, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_READLANE = 1 << 1, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_LANEID = 1 << 2, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_SWIZZLE = 1 << 3, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_BALLOT = 1 << 4, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_MBCOUNT = 1 << 5, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_COMPARE3 = 1 << 6, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. - AGS_DX12_EXTENSION_INTRINSIC_BARYCENTRICS = 1 << 7, ///< Supported in Radeon Software Version 16.9.2 (driver version 16.40.2311) onwards. + AGS_DX12_EXTENSION_INTRINSIC_READFIRSTLANE = 1 << 0, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_READLANE = 1 << 1, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_LANEID = 1 << 2, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_SWIZZLE = 1 << 3, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_BALLOT = 1 << 4, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_MBCOUNT = 1 << 5, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_MED3 = 1 << 6, ///< Supported in Radeon Software Version 16.9.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_BARYCENTRICS = 1 << 7, ///< Supported in Radeon Software Version 16.9.2 onwards. AGS_DX12_EXTENSION_INTRINSIC_WAVE_REDUCE = 1 << 8, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX12_EXTENSION_INTRINSIC_WAVE_SCAN = 1 << 9, ///< Supported in Radeon Software Version 17.9.1 onwards. - AGS_DX12_EXTENSION_USER_MARKERS = 1 << 10 ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX12_EXTENSION_USER_MARKERS = 1 << 10, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX12_EXTENSION_APP_REGISTRATION = 1 << 11 ///< Supported in Radeon Software Version 17.9.1 onwards. } AGSDriverExtensionDX12; /// The space id for DirectX12 intrinsic support @@ -183,37 +193,10 @@ const unsigned int AGS_DX12_SHADER_INSTRINSICS_SPACE_ID = 0x7FFF0ADE; // 2147420 /// Additional topologies supported via extensions typedef enum AGSPrimitiveTopology { - AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, - AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 + AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, ///< Quad list + AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 ///< Screen rect list } AGSPrimitiveTopology; -/// The different modes to control Crossfire behavior. -typedef enum AGSCrossfireMode -{ - AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering - AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile - AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering -} AGSCrossfireMode; - - -/// The Crossfire API transfer types -typedef enum AGSAfrTransferType -{ - AGS_AFR_TRANSFER_DEFAULT = 0, ///< Default Crossfire driver resource tracking - AGS_AFR_TRANSFER_DISABLE = 1, ///< Turn off driver resource tracking - AGS_AFR_TRANSFER_1STEP_P2P = 2, ///< App controlled GPU to next GPU transfer - AGS_AFR_TRANSFER_2STEP_NO_BROADCAST = 3, ///< App controlled GPU to next GPU transfer using intermediate system memory - AGS_AFR_TRANSFER_2STEP_WITH_BROADCAST = 4, ///< App controlled GPU to all render GPUs transfer using intermediate system memory -} AGSAfrTransferType; - -/// The Crossfire API transfer engines -typedef enum AGSAfrTransferEngine -{ - AGS_AFR_TRANSFERENGINE_DEFAULT = 0, ///< Use default engine for Crossfire API transfers - AGS_AFR_TRANSFERENGINE_3D_ENGINE = 1, ///< Use 3D engine for Crossfire API transfers - AGS_AFR_TRANSFERENGINE_COPY_ENGINE = 2, ///< Use Copy engine for Crossfire API transfers -} AGSAfrTransferEngine; - /// The display flags describing various properties of the display. typedef enum AGSDisplayFlags { @@ -227,6 +210,13 @@ typedef enum AGSDisplayFlags AGS_DISPLAYFLAG_EYEFINITY_IN_PORTRAIT_MODE = 1 << 7, ///< The display is in the Eyefinity group but in portrait mode } AGSDisplayFlags; +/// The display settings flags. +typedef enum AGSDisplaySettingsFlags +{ + AGS_DISPLAYSETTINGSFLAG_DISABLE_LOCAL_DIMMING = 1 << 0, ///< Disables local dimming if possible +} AGSDisplaySettingsFlags; + + typedef struct AGSContext AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInit /// The rectangle struct used by AGS. @@ -302,7 +292,7 @@ typedef enum ArchitectureVersion } ArchitectureVersion; /// The device info struct used to describe a physical GPU enumerated by AGS -typedef struct AGSDeviceInfo +typedef struct AGSDeviceInfo_511 { ArchitectureVersion architectureVersion; ///< Set to Unknown if not AMD hardware const char* adapterString; ///< The adapter name string @@ -329,20 +319,71 @@ typedef struct AGSDeviceInfo int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. int adlAdapterIndex; ///< Internally used index into the ADL list of adapters +} AGSDeviceInfo_511; + +/// The device info struct used to describe a physical GPU enumerated by AGS +typedef struct AGSDeviceInfo_520 +{ + const char* adapterString; ///< The adapter name string + ArchitectureVersion architectureVersion; ///< Set to Unknown if not AMD hardware + int vendorId; ///< The vendor id + int deviceId; ///< The device id + int revisionId; ///< The revision id + + int numCUs; ///< Number of compute units. Zero if not GCN onwards + int numROPs; ///< Number of ROPs + int coreClock; ///< Core clock speed at 100% power in MHz + int memoryClock; ///< Memory clock speed at 100% power in MHz + int memoryBandwidth; ///< Memory bandwidth in MB/s + float teraFlops; ///< Teraflops of GPU. Zero if not GCN onwards. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD + + int isPrimaryDevice; ///< Whether or not this is the primary adapter in the system. Not set on the WACK version. + long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. + + int numDisplays; ///< The number of active displays found to be attached to this adapter. + AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + + int eyefinityEnabled; ///< Indicates if Eyefinity is active + int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface. + int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface. + int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. + + int adlAdapterIndex; ///< Internally used index into the ADL list of adapters +} AGSDeviceInfo_520; + +typedef union AGSDeviceInfo +{ + AGSDeviceInfo_511 agsDeviceInfo511; + AGSDeviceInfo_520 agsDeviceInfo520; } AGSDeviceInfo; /// \defgroup general General API functions /// API for initialization, cleanup, HDR display modes and Crossfire GPU count /// @{ -typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( int allocationSize ); ///< AGS user defined allocation prototype -typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype +typedef void* (__stdcall *AGS_ALLOC_CALLBACK_511)( int allocationSize ); ///< AGS user defined allocation prototype +typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( size_t allocationSize ); ///< AGS user defined allocation prototype +typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype /// The configuration options that can be passed in to \ref agsInit -typedef struct AGSConfiguration +typedef struct AGSConfiguration_511 +{ + AGS_ALLOC_CALLBACK_511 allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used + AGS_FREE_CALLBACK freeCallback; ///< Optional memory freeing callback. If not supplied, free() is used +} AGSConfiguration_511; + +typedef struct AGSConfiguration_520 { AGS_ALLOC_CALLBACK allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used AGS_FREE_CALLBACK freeCallback; ///< Optional memory freeing callback. If not supplied, free() is used +} AGSConfiguration_520; + +typedef union AGSConfiguration +{ + AGSConfiguration_511 agsConfiguration511; + AGSConfiguration_520 agsConfiguration520; } AGSConfiguration; /// The top level GPU information returned from \ref agsInit @@ -369,7 +410,7 @@ typedef struct AGSDisplaySettings Mode_SDR, ///< SDR mode Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. - Mode_Freesync2_scRGB, ///< Freesync2 scRGB, requiring an FP16 swapchain. Values in the range of 0.0 to 125.0 where 125.0 == AGSDisplayInfo::maxLuminance. + Mode_Freesync2_scRGB, ///< Freesync2 scRGB, requiring an FP16 swapchain. 1.0 == 80 nits. Tonemap your scene to the range of 0.0 to AGSDisplayInfo::maxLuminance. Mode_DolbyVision ///< Dolby Vision, requiring an 8888 UNORM swapchain } mode; ///< The display mode to set the display into @@ -390,13 +431,16 @@ typedef struct AGSDisplaySettings double maxContentLightLevel; ///< The maximum content light level in nits (MaxCLL) double maxFrameAverageLightLevel; ///< The maximum frame average light level in nits (MaxFALL) + + // ADDED IN 5.2.0 + int flags; ///< Bitfield of ::AGSDisplaySettingsFlags } AGSDisplaySettings; /// /// Function used to initialize the AGS library. /// Must be called prior to any of the subsequent AGS API calls. /// Must be called prior to ID3D11Device or ID3D12Device creation. -/// \note This function will fail with AGS_ERROR_LEGACY_DRIVER in Catalyst versions before 12.20. +/// \note This function will fail with \ref AGS_ERROR_LEGACY_DRIVER in Catalyst versions before 12.20. /// \note It is good practice to check the AGS version returned from AGSGPUInfo against the version defined in the header in case a mismatch between the dll and header has occurred. /// /// \param [in, out] context Address of a pointer to a context. This function allocates a context on the heap which is then required for all subsequent API calls. @@ -419,6 +463,7 @@ AMD_AGS_API AGSReturnCode agsDeInit( AGSContext* context ); /// \param [in] context Pointer to a context. /// \param [out] numGPUs Number of GPUs used for Crossfire acceleration /// +/// REMOVED IN 5.2.0 AMD_AGS_API AGSReturnCode agsGetCrossfireGPUCount( AGSContext* context, int* numGPUs ); /// @@ -427,7 +472,6 @@ AMD_AGS_API AGSReturnCode agsGetCrossfireGPUCount( AGSContext* context, int* num /// \note Call this function after each mode change (switch to fullscreen, any change in swapchain etc). /// \note HDR10 PQ mode requires a 1010102 swapchain. /// \note HDR10 scRGB mode requires an FP16 swapchain. -/// \note Freesync2 Gamma mode requires a 1010102 swapchain. /// \note Freesync2 scRGB mode requires an FP16 swapchain. /// \note Dolby Vision requires a 8888 UNORM swapchain. /// @@ -444,9 +488,65 @@ AMD_AGS_API AGSReturnCode agsSetDisplayMode( AGSContext* context, int deviceInde /// DirectX12 driver extensions /// @{ -/// \defgroup dx12init Initialization and Cleanup +/// \defgroup dx12init Device creation and cleanup +/// It is now mandatory to call \ref agsDriverExtensionsDX12_CreateDevice when creating a device if the user wants to access any future DX12 AMD extensions. +/// The corresponding \ref agsDriverExtensionsDX12_DestroyDevice call must be called to release the device and free up the internal resources allocated by the create call. /// @{ +/// The struct to specify the DX12 device creation parameters +typedef struct AGSDX12DeviceCreationParams +{ + IDXGIAdapter* pAdapter; ///< Pointer to the adapter to use when creating the device. This may be null. + IID iid; ///< The interface ID for the type of device to be created. + D3D_FEATURE_LEVEL FeatureLevel; ///< The minimum feature level to create the device with. +} AGSDX12DeviceCreationParams; + +#define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX12ExtensionParams and \ref AGSDX11ExtensionParams +#define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version + +/// The struct to specify DX12 additional device creation parameters +typedef struct AGSDX12ExtensionParams +{ + const WCHAR* pAppName; ///< Application name + const WCHAR* pEngineName; ///< Engine name + unsigned int appVersion; ///< Application version + unsigned int engineVersion; ///< Engine version +} AGSDX12ExtensionParams; + +/// The struct to hold all the returned parameters from the device creation call +typedef struct AGSDX12ReturnedParams +{ + ID3D12Device* pDevice; ///< The newly created device + unsigned int extensionsSupported; ///< Bit mask that \ref agsDriverExtensionsDX12_CreateDevice will fill in to indicate which extensions are supported. See \ref AGSDriverExtensionDX12 +} AGSDX12ReturnedParams; + + +/// +/// Function used to create a D3D12 device with additional AMD-specific initialization parameters. +/// +/// When using the HLSL shader extensions please note: +/// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION (/Od) option, otherwise it will not work. +/// * The shader compiler needs D3DCOMPILE_ENABLE_STRICTNESS (/Ges) enabled. +/// * The intrinsic instructions require a 5.1 shader model. +/// * The Root Signature will need to use an extra resource and sampler. These are not real resources/samplers, they are just used to encode the intrinsic instruction. +/// +/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] creationParams Pointer to the struct to specify the existing DX12 device creation parameters. +/// \param [in] extensionParams Optional pointer to the struct to specify DX12 additional device creation parameters. +/// \param [out] returnedParams Pointer to struct to hold all the returned parameters from the call. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_CreateDevice( AGSContext* context, const AGSDX12DeviceCreationParams* creationParams, const AGSDX12ExtensionParams* extensionParams, AGSDX12ReturnedParams* returnedParams ); + +/// +/// Function to destroy the D3D12 device. +/// This call will also cleanup any AMD-specific driver extensions for D3D12. +/// +/// \param [in] context Pointer to a context. +/// \param [in] device Pointer to the D3D12 device. +/// \param [out] deviceReferences Optional pointer to an unsigned int that will be set to the value returned from device->Release(). +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DestroyDevice( AGSContext* context, ID3D12Device* device, unsigned int* deviceReferences ); + /// /// Function used to initialize the AMD-specific driver extensions for D3D12. /// Extensions require support in the driver, therefore it is important to check the extensionsSupported bitfield. @@ -460,6 +560,7 @@ AMD_AGS_API AGSReturnCode agsSetDisplayMode( AGSContext* context, int deviceInde /// \param [in] device The D3D12 device. /// \param [out] extensionsSupported Pointer to a bit mask that this function will fill in to indicate which extensions are supported. See ::AGSDriverExtensionDX12 /// +/// REMOVED IN 5.2.0 AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_Init( AGSContext* context, ID3D12Device* device, unsigned int* extensionsSupported ); /// @@ -467,6 +568,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_Init( AGSContext* context, ID3 /// /// \param [in] context Pointer to a context. /// +/// REMOVED IN 5.2.0 AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DeInit( AGSContext* context ); /// @} @@ -476,7 +578,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DeInit( AGSContext* context ); /// /// Function used to push an AMD user marker onto the command list. -/// This is only has an effect if AGS_DX12_EXTENSION_USER_MARKERS is present in the extensionsSupported bitfield of agsDriverExtensionsDX12_Init() +/// This is only has an effect if AGS_DX12_EXTENSION_USER_MARKERS is present in the extensionsSupported bitfield of \ref agsDriverExtensionsDX12_CreateDevice /// Supported in Radeon Software Version 17.9.1 onwards. /// /// \param [in] context Pointer to a context. @@ -513,10 +615,18 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_SetMarker( AGSContext* context /// @{ /// \defgroup dx11init Device creation and cleanup -/// It is now mandatory to call agsDriverExtensionsDX11_CreateDevice() when creating a device if the user wants to access any DX11 AMD extensions. -/// The corresponding agsDriverExtensionsDX11_DestroyDevice() call must be called to release the device and free up the internal resources allocated by the create call. +/// It is now mandatory to call \ref agsDriverExtensionsDX11_CreateDevice when creating a device if the user wants to access any DX11 AMD extensions. +/// The corresponding \ref agsDriverExtensionsDX11_DestroyDevice call must be called to release the device and free up the internal resources allocated by the create call. /// @{ +/// The different modes to control Crossfire behavior. +typedef enum AGSCrossfireMode +{ + AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering + AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile + AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering +} AGSCrossfireMode; + /// The struct to specify the existing DX11 device creation parameters typedef struct AGSDX11DeviceCreationParams { @@ -530,11 +640,8 @@ typedef struct AGSDX11DeviceCreationParams const DXGI_SWAP_CHAIN_DESC* pSwapChainDesc; ///< Optional swapchain description. Specify this to invoke D3D11CreateDeviceAndSwapChain instead of D3D11CreateDevice. This must be null on the WACK compliant version } AGSDX11DeviceCreationParams; -#define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX11ExtensionParams -#define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version - /// The struct to specify DX11 additional device creation parameters -typedef struct AGSDX11ExtensionParams +typedef struct AGSDX11ExtensionParams_511 { unsigned int uavSlot; ///< The UAV slot reserved for intrinsic support. This must match the slot defined in the HLSL, i.e. #define AmdDxExtShaderIntrinsicsUAVSlot. /// The default slot is 7, but the caller is free to use an alternative slot. @@ -542,30 +649,80 @@ typedef struct AGSDX11ExtensionParams UINT appVersion; ///< Application version const WCHAR* pEngineName; ///< Engine name UINT engineVersion; ///< Engine version +} AGSDX11ExtensionParams_511; + +typedef struct AGSDX11ExtensionParams_520 +{ + const WCHAR* pAppName; ///< Application name + const WCHAR* pEngineName; ///< Engine name + unsigned int appVersion; ///< Application version + unsigned int engineVersion; ///< Engine version + unsigned int numBreadcrumbMarkers; ///< The number of breadcrumb markers to allocate. Each marker is a uint64 (ie 8 bytes). If 0, the system is disabled. + unsigned int uavSlot; ///< The UAV slot reserved for intrinsic support. This must match the slot defined in the HLSL, i.e. "#define AmdDxExtShaderIntrinsicsUAVSlot". + /// The default slot is 7, but the caller is free to use an alternative slot. + /// If 0 is specified, then the default of 7 will be used. + AGSCrossfireMode crossfireMode; ///< Desired Crossfire mode +} AGSDX11ExtensionParams_520; + +typedef union AGSDX11ExtensionParams +{ + AGSDX11ExtensionParams_511 agsDX11ExtensionParams511; + AGSDX11ExtensionParams_520 agsDX11ExtensionParams520; } AGSDX11ExtensionParams; /// The struct to hold all the returned parameters from the device creation call -typedef struct AGSDX11ReturnedParams +typedef struct AGSDX11ReturnedParams_511 { ID3D11Device* pDevice; ///< The newly created device D3D_FEATURE_LEVEL FeatureLevel; ///< The feature level supported by the newly created device ID3D11DeviceContext* pImmediateContext; ///< The newly created immediate device context IDXGISwapChain* pSwapChain; ///< The newly created swap chain. This is only created if a valid pSwapChainDesc is supplied in AGSDX11DeviceCreationParams. This is not supported on the WACK compliant version unsigned int extensionsSupported; ///< Bit mask that \ref agsDriverExtensionsDX11_CreateDevice will fill in to indicate which extensions are supported. See AGSDriverExtensionDX11 +} AGSDX11ReturnedParams_511; + +typedef struct AGSDX11ReturnedParams_520 +{ + ID3D11Device* pDevice; ///< The newly created device + ID3D11DeviceContext* pImmediateContext; ///< The newly created immediate device context + IDXGISwapChain* pSwapChain; ///< The newly created swap chain. This is only created if a valid pSwapChainDesc is supplied in AGSDX11DeviceCreationParams. This is not supported on the WACK compliant version + D3D_FEATURE_LEVEL FeatureLevel; ///< The feature level supported by the newly created device + unsigned int extensionsSupported; ///< Bit mask that \ref agsDriverExtensionsDX11_CreateDevice will fill in to indicate which extensions are supported. See \ref AGSDriverExtensionDX11 + unsigned int crossfireGPUCount; ///< The number of GPUs that are active for this app + void* breadcrumbBuffer; ///< The CPU buffer returned if the initialization of the breadcrumb was successful. +} AGSDX11ReturnedParams_520; + +typedef union AGSDX11ReturnedParams +{ + AGSDX11ReturnedParams_511 agsDX11ReturnedParams511; + AGSDX11ReturnedParams_520 agsDX11ReturnedParams520; } AGSDX11ReturnedParams; /// /// Function used to create a D3D11 device with additional AMD-specific initialization parameters. /// /// When using the HLSL shader extensions please note: -/// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION option, otherwise it will not work. +/// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION (/Od) option, otherwise it will not work. +/// * The shader compiler needs D3DCOMPILE_ENABLE_STRICTNESS (/Ges) enabled. /// /// \param [in] context Pointer to a context. This is generated by \ref agsInit /// \param [in] creationParams Pointer to the struct to specify the existing DX11 device creation parameters. /// \param [in] extensionParams Optional pointer to the struct to specify DX11 additional device creation parameters. /// \param [out] returnedParams Pointer to struct to hold all the returned parameters from the call. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateDevice( AGSContext* context, AGSDX11DeviceCreationParams* creationParams, AGSDX11ExtensionParams* extensionParams, AGSDX11ReturnedParams* returnedParams ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateDevice( AGSContext* context, const AGSDX11DeviceCreationParams* creationParams, const AGSDX11ExtensionParams* extensionParams, AGSDX11ReturnedParams* returnedParams ); + +/// +/// Function to destroy the D3D11 device and its immediate context. +/// This call will also cleanup any AMD-specific driver extensions for D3D11. +/// +/// \param [in] context Pointer to a context. +/// \param [in] device Pointer to the D3D11 device. +/// \param [out] deviceReferences Optional pointer to an unsigned int that will be set to the value returned from device->Release(). +/// \param [in] immediateContext Pointer to the D3D11 immediate device context. +/// \param [out] immediateContextReferences Optional pointer to an unsigned int that will be set to the value returned from immediateContext->Release(). +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice_520( AGSContext* context, ID3D11Device* device, unsigned int* deviceReferences, ID3D11DeviceContext* immediateContext, unsigned int* immediateContextReferences ); + /// /// Function to destroy the D3D11 device. @@ -575,7 +732,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_CreateDevice( AGSContext* cont /// \param [in] device Pointer to the D3D11 device. /// \param [out] references Optional pointer to an unsigned int that will be set to the value returned from device->Release(). /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice( AGSContext* context, ID3D11Device* device, unsigned int* references ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice_511( AGSContext* context, ID3D11Device* device, unsigned int* references ); /// @} @@ -610,6 +767,211 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice( AGSContext* con /// /// @} +/// \defgroup breadcrumbs Breadcrumb API +/// API for writing top-of-pipe and bottom-of-pipe markers to help track down GPU hangs. +/// +/// The API is available if the \ref AGS_DX11_EXTENSION_BREADCRUMB_MARKERS is present in \ref AGSDX11ReturnedParams::extensionsSupported. +/// +/// To use the API, a non zero value needs to be specificed in \ref AGSDX11ExtensionParams::numBreadcrumbMarkers. This enables the API (if available) and allocates a system memory buffer +/// which is returned to the user in \ref AGSDX11ReturnedParams::breadcrumbBuffer. +/// +/// The user can now write markers before and after draw calls using \ref agsDriverExtensionsDX11_WriteBreadcrumb. +/// +/// \section background Background +/// +/// A top-of-pipe (TOP) command is scheduled for execution as soon as the command processor (CP) reaches the command. +/// A bottom-of-pipe (BOP) command is scheduled for execution once the previous rendering commands (draw and dispatch) finish execution. +/// TOP and BOP commands do not block CP. i.e. the CP schedules the command for execution then proceeds to the next command without waiting. +/// To effectively use TOP and BOP commands, it is important to understand how they interact with rendering commands: +/// +/// When the CP encounters a rendering command it queues it for execution and moves to the next command. The queued rendering commands are issued in order. +/// There can be multiple rendering commands running in parallel. When a rendering command is issued we say it is at the top of the pipe. When a rendering command +/// finishes execution we say it has reached the bottom of the pipe. +/// +/// A BOP command remains in a waiting queue and is executed once prior rendering commands finish. The queue of BOP commands is limited to 64 entries in GCN generation 1, 2, 3, 4 and 5. +/// If the 64 limit is reached the CP will stop queueing BOP commands and also rendering commands. Developers should limit the number of BOP commands that write markers to avoid contention. +/// In general, developers should limit both TOP and BOP commands to avoid stalling the CP. +/// +/// \subsection eg1 Example 1: +/// +/// \code{.cpp} +/// // Start of a command buffer +/// WriteMarker(TopOfPipe, 1) +/// WriteMarker(BottomOfPipe, 2) +/// WriteMarker(BottomOfPipe, 3) +/// DrawX +/// WriteMarker(BottomOfPipe, 4) +/// WriteMarker(BottomOfPipe, 5) +/// WriteMarker(TopOfPipe, 6) +/// // End of command buffer +/// \endcode +/// +/// In the above example, the CP writes markers 1, 2 and 3 without waiting: +/// Marker 1 is TOP so it's independent from other commands +/// There's no wait for marker 2 and 3 because there are no draws preceding the BOP commands +/// Marker 4 is only written once DrawX finishes execution +/// Marker 5 doesn't wait for additional draws so it is written right after marker 4 +/// Marker 6 can be written as soon as the CP reaches the command. For instance, it is very possible that CP writes marker 6 while DrawX +/// is running and therefore marker 6 gets written before markers 4 and 5 +/// +/// \subsection eg2 Example 2: +/// +/// \code{.cpp} +/// WriteMarker(TopOfPipe, 1) +/// DrawX +/// WriteMarker(BottomOfPipe, 2) +/// WriteMarker(TopOfPipe, 3) +/// DrawY +/// WriteMarker(BottomOfPipe, 4) +/// \endcode +/// +/// In this example marker 1 is written before the start of DrawX +/// Marker 2 is written once DrawX finishes execution +/// Similarly marker 3 is written before the start of DrawY +/// Marker 4 is written once DrawY finishes execution +/// In case of a GPU hang, if markers 1 and 3 are written but markers 2 and 4 are missing we can conclude that: +/// The CP has reached both DrawX and DrawY commands since marker 1 and 3 are present +/// The fact that marker 2 and 4 are missing means that either DrawX is hanging while DrawY is at the top of the pipe or both DrawX and DrawY +/// started and both are simultaneously hanging +/// +/// \subsection eg3 Example 3: +/// +/// \code{.cpp} +/// // Start of a command buffer +/// WriteMarker(BottomOfPipe, 1) +/// DrawX +/// WriteMarker(BottomOfPipe, 2) +/// DrawY +/// WriteMarker(BottomOfPipe, 3) +/// DrawZ +/// WriteMarker(BottomOfPipe, 4) +/// // End of command buffer +/// \endcode +/// +/// In this example marker 1 is written before the start of DrawX +/// Marker 2 is written once DrawX finishes +/// Marker 3 is written once DrawY finishes +/// Marker 4 is written once DrawZ finishes +/// If the GPU hangs and only marker 1 is written we can conclude that the hang is happening in either DrawX, DrawY or DrawZ +/// If the GPU hangs and only marker 1 and 2 are written we can conclude that the hang is happening in DrawY or DrawZ +/// If the GPU hangs and only marker 4 is missing we can conclude that the hang is happening in DrawZ +/// +/// \subsection eg4 Example 4: +/// +/// \code{.cpp} +/// Start of a command buffer +/// WriteMarker(TopOfPipe, 1) +/// DrawX +/// WriteMarker(TopOfPipe, 2) +/// DrawY +/// WriteMarker(TopOfPipe, 3) +/// DrawZ +/// // End of command buffer +/// \endcode +/// +/// In this example, in case the GPU hangs and only marker 1 is written we can conclude that the hang is happening in DrawX +/// In case the GPU hangs and only marker 1 and 2 are written we can conclude that the hang is happening in DrawX or DrawY +/// In case the GPU hangs and all 3 markers are written we can conclude that the hang is happening in any of DrawX, DrawY or DrawZ +/// +/// \subsection eg5 Example 5: +/// +/// \code{.cpp} +/// DrawX +/// WriteMarker(TopOfPipe, 1) +/// WriteMarker(BottomOfPipe, 2) +/// DrawY +/// WriteMarker(TopOfPipe, 3) +/// WriteMarker(BottomOfPipe, 4) +/// \endcode +/// +/// Marker 1 is written right after DrawX is queued for execution. +/// Marker 2 is only written once DrawX finishes execution. +/// Marker 3 is written right after DrawY is queued for execution. +/// Marker 4 is only written once DrawY finishes execution +/// If marker 1 is written we would know that the CP has reached the command DrawX (DrawX at the top of the pipe). +/// If marker 2 is written we can say that DrawX has finished execution (DrawX at the bottom of the pipe). +/// In case the GPU hangs and only marker 1 and 3 are written we can conclude that the hang is happening in DrawX or DrawY +/// In case the GPU hangs and only marker 1 is written we can conclude that the hang is happening in DrawX +/// In case the GPU hangs and only marker 4 is missing we can conclude that the hang is happening in DrawY +/// +/// \section data Retrieving GPU Data +/// +/// In the event of a GPU hang, the user can inspect the system memory buffer to determine which draw has caused the hang. +/// For example: +/// \code{.cpp} +/// // Force the work to be flushed to prevent CPU ahead of GPU +/// g_pImmediateContext->Flush(); +/// +/// // Present the information rendered to the back buffer to the front buffer (the screen) +/// HRESULT hr = g_pSwapChain->Present( 0, 0 ); +/// +/// // Read the marker data buffer once detect device lost +/// if ( hr != S_OK ) +/// { +/// for (UINT i = 0; i < g_NumMarkerWritten; i++) +/// { +/// UINT64* pTempData; +/// pTempData = static_cast(pMarkerBuffer); +/// +/// // Write the marker data to file +/// ofs << i << "\r\n"; +/// ofs << std::hex << *(pTempData + i * 2) << "\r\n"; +/// ofs << std::hex << *(pTempData + (i * 2 + 1)) << "\r\n"; +/// +/// WCHAR s1[256]; +/// setlocale(LC_NUMERIC, "en_US.iso88591"); +/// +/// // Output the marker data to console +/// swprintf(s1, 256, L" The Draw count is %d; The Top maker is % 016llX and the Bottom marker is % 016llX \r\n", i, *(pTempData + i * 2), *(pTempData + (i * 2 + 1))); +/// +/// OutputDebugStringW(s1); +/// } +/// } +/// \endcode +/// +/// The console output would resemble something like: +/// \code{.cpp} +/// D3D11: Removing Device. +/// D3D11 ERROR: ID3D11Device::RemoveDevice: Device removal has been triggered for the following reason (DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of time to execute its commands, or the hardware crashed/hung. As a result, the TDR (Timeout Detection and Recovery) mechanism has been triggered. The current Device Context was executing commands when the hang occurred. The application may want to respawn and fallback to less aggressive use of the display hardware). [ EXECUTION ERROR #378: DEVICE_REMOVAL_PROCESS_AT_FAULT] +/// The Draw count is 0; The Top maker is 00000000DEADCAFE and the Bottom marker is 00000000DEADBEEF +/// The Draw count is 1; The Top maker is 00000000DEADCAFE and the Bottom marker is 00000000DEADBEEF +/// The Draw count is 2; The Top maker is 00000000DEADCAFE and the Bottom marker is 00000000DEADBEEF +/// The Draw count is 3; The Top maker is 00000000DEADCAFE and the Bottom marker is 00000000DEADBEEF +/// The Draw count is 4; The Top maker is 00000000DEADCAFE and the Bottom marker is 00000000DEADBEEF +/// The Draw count is 5; The Top maker is CDCDCDCDCDCDCDCD and the Bottom marker is CDCDCDCDCDCDCDCD +/// The Draw count is 6; The Top maker is CDCDCDCDCDCDCDCD and the Bottom marker is CDCDCDCDCDCDCDCD +/// The Draw count is 7; The Top maker is CDCDCDCDCDCDCDCD and the Bottom marker is CDCDCDCDCDCDCDCD +/// \endcode +/// +/// @{ + +/// The breadcrumb marker struct used by \ref agsDriverExtensionsDX11_WriteBreadcrumb +typedef struct AGSBreadcrumbMarker +{ + unsigned long long markerData; ///< The user data to write. + enum + { + TopOfPipe = 0, ///< Top-of-pipe marker + BottomOfPipe = 1 ///< Bottom-of-pipe marker + } type; ///< Whether this marker is top or bottom of pipe. + unsigned int index; ///< The index of the marker. This should be less than the value specified in \ref AGSDX11ExtensionParams::numBreadcrumbMarkers +} AGSBreadcrumbMarker; + +/// +/// Function to write a breadcrumb marker. +/// +/// This method inserts a write marker operation in the GPU command stream. In the case where the GPU is hanging the write +/// command will never be reached and the marker will never get written to memory. +/// +/// In order to use this function, \ref AGSDX11ExtensionParams::numBreadcrumbMarkers must be set to a non zero value. +/// +/// \param [in] context Pointer to a context. +/// \param [in] marker Pointer to a marker. +/// +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_WriteBreadcrumb( AGSContext* context, const AGSBreadcrumbMarker* marker ); + +/// @} + /// \defgroup dx11misc Misc Extensions /// API for depth bounds test, UAV overlap and prim topologies /// @{ @@ -618,34 +980,37 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice( AGSContext* con /// Function used to set the primitive topology. If you are using any of the extended topology types, then this function should /// be called to set ALL topology types. /// -/// The Quad List extension is a convenient way to submit quads without using an index buffer. Note that this still submits two triangles at the driver level. +/// The Quad List extension is a convenient way to submit quads without using an index buffer. Note that this still submits two triangles at the driver level. /// In order to use this function, AGS must already be initialized and agsDriverExtensionsDX11_Init must have been called successfully. /// -/// The Screen Rect extension, which is only available on GCN hardware, allows the user to pass in three of the four corners of a rectangle. -/// The hardware then uses the bounding box of the vertices to rasterize the rectangle primitive (i.e. as a rectangle rather than two triangles). +/// The Screen Rect extension, which is only available on GCN hardware, allows the user to pass in three of the four corners of a rectangle. +/// The hardware then uses the bounding box of the vertices to rasterize the rectangle primitive (i.e. as a rectangle rather than two triangles). /// \note Note that this will not return valid interpolated values, only valid SV_Position values. /// \note If either the Quad List or Screen Rect extension are used, then agsDriverExtensionsDX11_IASetPrimitiveTopology should be called in place of the native DirectX11 equivalent all the time. /// /// \param [in] context Pointer to a context. -/// \param [in] topology The topology to set on the D3D11 device. This can be either an AGS-defined topology such as AGS_PRIMITIVE_TOPOLOGY_QUAD_LIST +/// \param [in] topology The topology to set on the D3D11 device. This can be either an AGS-defined topology such as AGS_PRIMITIVE_TOPOLOGY_QUADLIST /// or a standard D3D-defined topology such as D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP. /// NB. the AGS-defined types will require casting to a D3D_PRIMITIVE_TOPOLOGY type. /// AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_IASetPrimitiveTopology( AGSContext* context, enum D3D_PRIMITIVE_TOPOLOGY topology ); /// -/// Function used indicate to the driver it can overlap the subsequent batch of back-to-back dispatches. +/// Function used indicate to the driver that it doesn't need to sync the UAVs bound for the subsequent set of back-to-back dispatches. /// When calling back-to-back draw calls or dispatch calls that write to the same UAV, the AMD DX11 driver will automatically insert a barrier to ensure there are no write after write (WAW) hazards. /// If the app can guarantee there is no overlap between the writes between these calls, then this extension will remove those barriers allowing the work to run in parallel on the GPU. /// /// Usage would be as follows: /// \code{.cpp} +/// m_device->Dispatch( ... ); // First call that writes to the UAV +/// /// // Disable automatic WAW syncs /// agsDriverExtensionsDX11_BeginUAVOverlap( m_agsContext ); /// -/// // Submit back-to-back dispatches that write to the same UAV -/// m_device->Dispatch( ... ); // First half of UAV -/// m_device->Dispatch( ... ); // Second half of UAV +/// // Submit other dispatches that write to the same UAV concurrently +/// m_device->Dispatch( ... ); +/// m_device->Dispatch( ... ); +/// m_device->Dispatch( ... ); /// /// // Reenable automatic WAW syncs /// agsDriverExtensionsDX11_EndUAVOverlap( m_agsContext ); @@ -713,6 +1078,8 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* co /// }; /// \endcode /// +/// Example usage can be seen in AMD's GeometryFX (https://github.com/GPUOpen-Effects/GeometryFX). In particular, in this file: https://github.com/GPUOpen-Effects/GeometryFX/blob/master/amd_geometryfx/src/AMD_GeometryFX_Filtering.cpp +/// /// @{ /// @@ -846,6 +1213,24 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetClipRects( AGSContext* cont /// API for explicit control over Crossfire /// @{ +/// The Crossfire API transfer types +typedef enum AGSAfrTransferType +{ + AGS_AFR_TRANSFER_DEFAULT = 0, ///< Default Crossfire driver resource tracking + AGS_AFR_TRANSFER_DISABLE = 1, ///< Turn off driver resource tracking + AGS_AFR_TRANSFER_1STEP_P2P = 2, ///< App controlled GPU to next GPU transfer + AGS_AFR_TRANSFER_2STEP_NO_BROADCAST = 3, ///< App controlled GPU to next GPU transfer using intermediate system memory + AGS_AFR_TRANSFER_2STEP_WITH_BROADCAST = 4, ///< App controlled GPU to all render GPUs transfer using intermediate system memory +} AGSAfrTransferType; + +/// The Crossfire API transfer engines +typedef enum AGSAfrTransferEngine +{ + AGS_AFR_TRANSFERENGINE_DEFAULT = 0, ///< Use default engine for Crossfire API transfers + AGS_AFR_TRANSFERENGINE_3D_ENGINE = 1, ///< Use 3D engine for Crossfire API transfers + AGS_AFR_TRANSFERENGINE_COPY_ENGINE = 2, ///< Use Copy engine for Crossfire API transfers +} AGSAfrTransferEngine; + /// /// Function to create a Direct3D11 resource with the specified AFR transfer type and specified transfer engine. /// @@ -916,9 +1301,9 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NotifyResourceEndWrites( AGSCo AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NotifyResourceBeginAllAccess( AGSContext* context, ID3D11Resource* resource ); /// -/// This is used for AGS_AFR_TRANSFER_1STEP_P2P to notify when it is safe to initiate a transfer. -/// This call in frame N-(NumGpus-1) allows a 1 step P2P in frame N to start. -/// This should be called after agsDriverExtensionsDX11_NotifyResourceEndWrites. +/// This is used for AGS_AFR_TRANSFER_1STEP_P2P to notify when it is safe to initiate a transfer. +/// This call in frame N-(NumGpus-1) allows a 1 step P2P in frame N to start. +/// This should be called after agsDriverExtensionsDX11_NotifyResourceEndWrites. /// /// \param [in] context Pointer to a context. /// \param [in] resource Pointer to the resource. diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index e339d7b7d2b..5c8bcaf395b 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -15,8 +15,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); +enum amd_ags_version +{ + AMD_AGS_VERSION_5_1_1, + AMD_AGS_VERSION_5_2_0, + + AMD_AGS_VERSION_COUNT +}; + +struct +{ + int major; + int minor; + int patch; +} +static const amd_ags_versions[AMD_AGS_VERSION_COUNT] = +{ + {5, 1, 1}, + {5, 2, 0}, +}; + struct AGSContext { + enum amd_ags_version version; unsigned int device_count; AGSDeviceInfo *devices; VkPhysicalDeviceProperties *properties; @@ -88,6 +109,8 @@ static AGSReturnCode init_ags_context(AGSContext *context) AGSReturnCode ret; unsigned int i; + // TODO: version check + context->version = AMD_AGS_VERSION_5_1_1; context->device_count = 0; context->devices = NULL; context->properties = NULL; @@ -108,15 +131,32 @@ static AGSReturnCode init_ags_context(AGSContext *context) const VkPhysicalDeviceProperties *vk_properties = &context->properties[i]; AGSDeviceInfo *device = &context->devices[i]; - device->adapterString = vk_properties->deviceName; - device->vendorId = vk_properties->vendorID; - device->deviceId = vk_properties->deviceID; + switch (context->version) + { + case AMD_AGS_VERSION_5_1_1: + device->agsDeviceInfo511.adapterString = vk_properties->deviceName; + device->agsDeviceInfo511.vendorId = vk_properties->vendorID; + device->agsDeviceInfo511.deviceId = vk_properties->deviceID; + + if (device->agsDeviceInfo511.vendorId == 0x1002) + device->agsDeviceInfo511.architectureVersion = ArchitectureVersion_GCN; - if (device->vendorId == 0x1002) - device->architectureVersion = ArchitectureVersion_GCN; + if (!i) + device->agsDeviceInfo511.isPrimaryDevice = 1; + break; + case AMD_AGS_VERSION_5_2_0: + default: + device->agsDeviceInfo520.adapterString = vk_properties->deviceName; + device->agsDeviceInfo520.vendorId = vk_properties->vendorID; + device->agsDeviceInfo520.deviceId = vk_properties->deviceID; + + if (device->agsDeviceInfo520.vendorId == 0x1002) + device->agsDeviceInfo520.architectureVersion = ArchitectureVersion_GCN; - if (!i) - device->isPrimaryDevice = 1; + if (!i) + device->agsDeviceInfo520.isPrimaryDevice = 1; + break; + } } return AGS_SUCCESS; @@ -145,9 +185,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi } memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->agsVersionMajor = AMD_AGS_VERSION_MAJOR; - gpu_info->agsVersionMinor = AMD_AGS_VERSION_MINOR; - gpu_info->agsVersionPatch = AMD_AGS_VERSION_PATCH; + gpu_info->agsVersionMajor = amd_ags_versions[object->version].major; + gpu_info->agsVersionMinor = amd_ags_versions[object->version].minor; + gpu_info->agsVersionPatch = amd_ags_versions[object->version].patch; gpu_info->driverVersion = "18.10.16-180516a-328911C-RadeonSoftwareAdrenalin"; gpu_info->radeonSoftwareVersion = "18.5.1"; gpu_info->numDevices = object->device_count; From 31b661f384416988b57f7ac6be8048128516d17a Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 17 Jun 2020 14:32:18 -0700 Subject: [PATCH 0594/1506] amd_ags_x64: Update to 5.2.1. --- dlls/amd_ags_x64/amd_ags.h | 14 ++++++++++---- dlls/amd_ags_x64/amd_ags_x64_main.c | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index b647f912aa7..c39adb53678 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -33,6 +33,12 @@ /// Online documentation is publicly hosted here: http://gpuopen-librariesandsdks.github.io/ags/ /// \endinternal /// +/// What's new in AGS 5.2.1 since version 5.2.0 +/// --------------------------------------- +/// * Fix for crash when using Eyefinity +/// * Fix for DX12 app registration in the UWP version +/// +/// /// What's new in AGS 5.2.0 since version 5.1 /// --------------------------------------- /// AGS 5.2 includes the following updates: @@ -98,7 +104,7 @@ #define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version #define AMD_AGS_VERSION_MINOR 2 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version +#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version #ifdef __cplusplus extern "C" { @@ -622,7 +628,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_SetMarker( AGSContext* context /// The different modes to control Crossfire behavior. typedef enum AGSCrossfireMode { - AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering + AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering. If this mode is specified, do NOT use the agsDriverExtensionsDX11_Create*() APIs to create resources AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering } AGSCrossfireMode; @@ -739,7 +745,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice_511( AGSContext* /// \defgroup dx11appreg App Registration /// @{ -/// This extension allows an apllication to voluntarily register itself with the driver, providing a more robust app detection solution and avoid the issue of the driver +/// This extension allows an apllication to voluntarily register itself with the driver, providing a more robust app detection solution and avoid the issue of the driver /// relying on exe names to match the app to a driver profile. /// This feature is supported in Radeon Software Version 17.9.2 onwards. /// Rules: @@ -1151,7 +1157,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount( /// /// This method can be used to determine the total number of asynchronous shader compile jobs that are either -/// queued for waiting for compilation or being compiled by the driver’s asynchronous compilation threads. +/// queued for waiting for compilation or being compiled by the driverÂ’s asynchronous compilation threads. /// This method can be called at any during the lifetime of the driver. /// /// \param [in] context Pointer to a context. diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 5c8bcaf395b..e8b55bf9d42 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -19,6 +19,7 @@ enum amd_ags_version { AMD_AGS_VERSION_5_1_1, AMD_AGS_VERSION_5_2_0, + AMD_AGS_VERSION_5_2_1, AMD_AGS_VERSION_COUNT }; @@ -33,6 +34,7 @@ static const amd_ags_versions[AMD_AGS_VERSION_COUNT] = { {5, 1, 1}, {5, 2, 0}, + {5, 2, 1}, }; struct AGSContext @@ -145,6 +147,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) device->agsDeviceInfo511.isPrimaryDevice = 1; break; case AMD_AGS_VERSION_5_2_0: + case AMD_AGS_VERSION_5_2_1: default: device->agsDeviceInfo520.adapterString = vk_properties->deviceName; device->agsDeviceInfo520.vendorId = vk_properties->vendorID; From 082d03cd0991b0a4229b460044285cf21a1d97a0 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 17 Jun 2020 14:44:25 -0700 Subject: [PATCH 0595/1506] amd_ags_x64: Update to 5.3.0. --- dlls/amd_ags_x64/amd_ags.h | 98 +++++++++++++++++++++++------ dlls/amd_ags_x64/amd_ags_x64_main.c | 3 + 2 files changed, 82 insertions(+), 19 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index c39adb53678..58f7bb84e37 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -33,6 +33,14 @@ /// Online documentation is publicly hosted here: http://gpuopen-librariesandsdks.github.io/ags/ /// \endinternal /// +/// --------------------------------------- +/// What's new in AGS 5.3 since version 5.2 +/// --------------------------------------- +/// AGS 5.3 includes the following updates: +/// * DX11 deferred context support for Multi Draw Indirect and UAV Overlap extensions. +/// * A Radeon Software Version helper to determine whether the installed driver meets your game's minimum driver version requirements. +/// * Freesync2 Gamma 2.2 mode which uses a 1010102 swapchain and can be considered as an alternative to using the 64 bit swapchain required for Freesync2 scRGB. +/// /// What's new in AGS 5.2.1 since version 5.2.0 /// --------------------------------------- /// * Fix for crash when using Eyefinity @@ -103,8 +111,8 @@ #define AMD_AGS_H #define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version -#define AMD_AGS_VERSION_MINOR 2 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version +#define AMD_AGS_VERSION_MINOR 3 ///< AGS minor version +#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version #ifdef __cplusplus extern "C" { @@ -112,6 +120,9 @@ extern "C" { #define AMD_AGS_API WINAPI +#define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX12ExtensionParams and \ref AGSDX11ExtensionParams and the Radeon Software Version +#define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version + // Forward declaration of D3D11 types struct IDXGIAdapter; enum D3D_DRIVER_TYPE; @@ -147,6 +158,7 @@ typedef enum AGSReturnCode AGS_ERROR_LEGACY_DRIVER, ///< Returned if a feature is not present in the installed driver AGS_EXTENSION_NOT_SUPPORTED, ///< Returned if the driver does not support the requested driver extension AGS_ADL_FAILURE, ///< Failure in ADL (the AMD Display Library) + AGS_DX_FAILURE ///< Failure from DirectX runtime } AGSReturnCode; /// The DirectX11 extension support bits @@ -173,6 +185,9 @@ typedef enum AGSDriverExtensionDX11 AGS_DX11_EXTENSION_MULTIVIEW = 1 << 18, ///< Supported in Radeon Software Version 16.12.1 onwards. AGS_DX11_EXTENSION_APP_REGISTRATION = 1 << 19, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX11_EXTENSION_BREADCRUMB_MARKERS = 1 << 20, ///< Supported in Radeon Software Version 17.11.1 onwards. + AGS_DX11_EXTENSION_MDI_DEFERRED_CONTEXTS = 1 << 21, ///< Supported in Radeon Software Version XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onwards. + AGS_DX11_EXTENSION_UAV_OVERLAP_DEFERRED_CONTEXTS = 1 << 22, ///< Supported in Radeon Software Version XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onwards. + AGS_DX11_EXTENSION_DEPTH_BOUNDS_DEFERRED_CONTEXTS = 1 << 23 ///< Supported in Radeon Software Version XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onwards. } AGSDriverExtensionDX11; /// The DirectX12 extension support bits @@ -417,6 +432,8 @@ typedef struct AGSDisplaySettings Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. Mode_Freesync2_scRGB, ///< Freesync2 scRGB, requiring an FP16 swapchain. 1.0 == 80 nits. Tonemap your scene to the range of 0.0 to AGSDisplayInfo::maxLuminance. + // Mode_Freesync2_Gamma22 ADDED IN 5.3.0 + Mode_Freesync2_Gamma22, ///< Freesync2 Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. Mode_DolbyVision ///< Dolby Vision, requiring an 8888 UNORM swapchain } mode; ///< The display mode to set the display into @@ -442,6 +459,24 @@ typedef struct AGSDisplaySettings int flags; ///< Bitfield of ::AGSDisplaySettingsFlags } AGSDisplaySettings; +/// The result returned from \ref agsCheckDriverVersion +typedef enum AGSDriverVersionResult +{ + AGS_SOFTWAREVERSIONCHECK_OK, ///< The reported Radeon Software Version is newer or the same as the required version + AGS_SOFTWAREVERSIONCHECK_OLDER, ///< The reported Radeon Software Version is older than the required version + AGS_SOFTWAREVERSIONCHECK_UNDEFINED ///< The check could not determine as result. This could be because it is a private or custom driver or just invalid arguments. +} AGSDriverVersionResult; + +/// +/// Helper function to check the installed software version against the required software version. +/// +/// \param [in] radeonSoftwareVersionReported The Radeon Software Version returned from \ref AGSGPUInfo::radeonSoftwareVersion. +/// \param [in] radeonSoftwareVersionRequired The Radeon Software Version to check against. This is specificed using \ref AGS_MAKE_VERSION. +/// \return The result of the check. +/// +AMD_AGS_API AGSDriverVersionResult agsCheckDriverVersion( const char* radeonSoftwareVersionReported, unsigned int radeonSoftwareVersionRequired ); + + /// /// Function used to initialize the AGS library. /// Must be called prior to any of the subsequent AGS API calls. @@ -494,7 +529,7 @@ AMD_AGS_API AGSReturnCode agsSetDisplayMode( AGSContext* context, int deviceInde /// DirectX12 driver extensions /// @{ -/// \defgroup dx12init Device creation and cleanup +/// \defgroup dx12init Device and device object creation and cleanup /// It is now mandatory to call \ref agsDriverExtensionsDX12_CreateDevice when creating a device if the user wants to access any future DX12 AMD extensions. /// The corresponding \ref agsDriverExtensionsDX12_DestroyDevice call must be called to release the device and free up the internal resources allocated by the create call. /// @{ @@ -507,9 +542,6 @@ typedef struct AGSDX12DeviceCreationParams D3D_FEATURE_LEVEL FeatureLevel; ///< The minimum feature level to create the device with. } AGSDX12DeviceCreationParams; -#define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX12ExtensionParams and \ref AGSDX11ExtensionParams -#define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version - /// The struct to specify DX12 additional device creation parameters typedef struct AGSDX12ExtensionParams { @@ -628,7 +660,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_SetMarker( AGSContext* context /// The different modes to control Crossfire behavior. typedef enum AGSCrossfireMode { - AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering. If this mode is specified, do NOT use the agsDriverExtensionsDX11_Create*() APIs to create resources + AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering. If this mode is specified, do NOT use the agsDriverExtensionsDX11_Create*() APIs to create resources AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering } AGSCrossfireMode; @@ -978,8 +1010,8 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_WriteBreadcrumb( AGSContext* c /// @} -/// \defgroup dx11misc Misc Extensions -/// API for depth bounds test, UAV overlap and prim topologies +/// \defgroup dx11Topology Extended Topology +/// API for primitive topologies /// @{ /// @@ -1001,6 +1033,12 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_WriteBreadcrumb( AGSContext* c /// AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_IASetPrimitiveTopology( AGSContext* context, enum D3D_PRIMITIVE_TOPOLOGY topology ); +/// @} + +/// \defgroup dx11UAVOverlap UAV Overlap +/// API for enabling overlapping UAV writes +/// @{ + /// /// Function used indicate to the driver that it doesn't need to sync the UAVs bound for the subsequent set of back-to-back dispatches. /// When calling back-to-back draw calls or dispatch calls that write to the same UAV, the AMD DX11 driver will automatically insert a barrier to ensure there are no write after write (WAW) hazards. @@ -1023,25 +1061,39 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_IASetPrimitiveTopology( AGSCon /// \endcode /// /// \param [in] context Pointer to a context. +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. +/// with the AGS_DX11_EXTENSION_DEFERRED_CONTEXTS bit. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_BeginUAVOverlap( AGSContext* context ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_BeginUAVOverlap_520( AGSContext* context ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_BeginUAVOverlap( AGSContext* context, ID3D11DeviceContext* dxContext ); /// /// Function used indicate to the driver it can no longer overlap the batch of back-to-back dispatches that has been submitted. /// /// \param [in] context Pointer to a context. +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. +/// with the AGS_DX11_EXTENSION_DEFERRED_CONTEXTS bit. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_EndUAVOverlap( AGSContext* context ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_EndUAVOverlap_520( AGSContext* context ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_EndUAVOverlap( AGSContext* context, ID3D11DeviceContext* dxContext ); + +/// @} + +/// \defgroup dx11DepthBoundsTest Depth Bounds Test +/// API for enabling depth bounds testing +/// @{ /// /// Function used to set the depth bounds test extension /// -/// \param [in] context Pointer to a context. +/// \param [in] context Pointer to a context +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. /// \param [in] enabled Whether to enable or disable the depth bounds testing. If disabled, the next two args are ignored. /// \param [in] minDepth The near depth range to clip against. /// \param [in] maxDepth The far depth range to clip against. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* context, bool enabled, float minDepth, float maxDepth ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds_520( AGSContext* context, bool enabled, float minDepth, float maxDepth ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* context, ID3D11DeviceContext* dxContext, bool enabled, float minDepth, float maxDepth ); /// @} @@ -1054,12 +1106,12 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* co /// \code{.cpp} /// // Submit n batches of DrawIndirect calls /// for ( int i = 0; i < n; i++ ) -/// DrawIndexedInstancedIndirect( buffer, i * sizeof( cmd ) ); +/// deviceContext->DrawIndexedInstancedIndirect( buffer, i * sizeof( cmd ) ); /// \endcode /// To be replaced by the following call: /// \code{.cpp} /// // Submit all n batches in one call -/// agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( m_agsContext, n, buffer, 0, sizeof( cmd ) ); +/// agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( m_agsContext, deviceContext, n, buffer, 0, sizeof( cmd ) ); /// \endcode /// /// The buffer used for the indirect args must be of the following formats: @@ -1092,47 +1144,55 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* co /// Function used to submit a batch of draws via MultiDrawIndirect /// /// \param [in] context Pointer to a context. +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. /// \param [in] drawCount The number of draws. /// \param [in] pBufferForArgs The args buffer. /// \param [in] alignedByteOffsetForArgs The offset into the args buffer. /// \param [in] byteStrideForArgs The per element stride of the args buffer. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirect( AGSContext* context, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirect_520( AGSContext* context, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirect( AGSContext* context, ID3D11DeviceContext* dxContext, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); /// /// Function used to submit a batch of draws via MultiDrawIndirect /// /// \param [in] context Pointer to a context. +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. /// \param [in] drawCount The number of draws. /// \param [in] pBufferForArgs The args buffer. /// \param [in] alignedByteOffsetForArgs The offset into the args buffer. /// \param [in] byteStrideForArgs The per element stride of the args buffer. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( AGSContext* context, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect_520( AGSContext* context, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect( AGSContext* context, ID3D11DeviceContext* dxContext, unsigned int drawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); /// /// Function used to submit a batch of draws via MultiDrawIndirect /// /// \param [in] context Pointer to a context. +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. /// \param [in] pBufferForDrawCount The draw count buffer. /// \param [in] alignedByteOffsetForDrawCount The offset into the draw count buffer. /// \param [in] pBufferForArgs The args buffer. /// \param [in] alignedByteOffsetForArgs The offset into the args buffer. /// \param [in] byteStrideForArgs The per element stride of the args buffer. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect( AGSContext* context, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect_520( AGSContext* context, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect( AGSContext* context, ID3D11DeviceContext* dxContext, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); /// /// Function used to submit a batch of draws via MultiDrawIndirect /// /// \param [in] context Pointer to a context. +/// \param [in] dxContext Pointer to the DirectX device context. If this is to work using the non-immediate context, then you need to check support. If nullptr is specified, then the immediate context is assumed. /// \param [in] pBufferForDrawCount The draw count buffer. /// \param [in] alignedByteOffsetForDrawCount The offset into the draw count buffer. /// \param [in] pBufferForArgs The args buffer. /// \param [in] alignedByteOffsetForArgs The offset into the args buffer. /// \param [in] byteStrideForArgs The per element stride of the args buffer. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect( AGSContext* context, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect_520( AGSContext* context, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect( AGSContext* context, ID3D11DeviceContext* dxContext, ID3D11Buffer* pBufferForDrawCount, unsigned int alignedByteOffsetForDrawCount, ID3D11Buffer* pBufferForArgs, unsigned int alignedByteOffsetForArgs, unsigned int byteStrideForArgs ); /// @} diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index e8b55bf9d42..b3cf309da41 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -20,6 +20,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_1_1, AMD_AGS_VERSION_5_2_0, AMD_AGS_VERSION_5_2_1, + AMD_AGS_VERSION_5_3_0, AMD_AGS_VERSION_COUNT }; @@ -35,6 +36,7 @@ static const amd_ags_versions[AMD_AGS_VERSION_COUNT] = {5, 1, 1}, {5, 2, 0}, {5, 2, 1}, + {5, 3, 0}, }; struct AGSContext @@ -148,6 +150,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) break; case AMD_AGS_VERSION_5_2_0: case AMD_AGS_VERSION_5_2_1: + case AMD_AGS_VERSION_5_3_0: default: device->agsDeviceInfo520.adapterString = vk_properties->deviceName; device->agsDeviceInfo520.vendorId = vk_properties->vendorID; From 1e49110e35c309892d56662f109b06c7ae009b8c Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 17 Jun 2020 15:03:02 -0700 Subject: [PATCH 0596/1506] amd_ags_x64: Update to 5.4.0. --- dlls/amd_ags_x64/amd_ags.h | 92 ++++++++++++++++++++++++++--- dlls/amd_ags_x64/amd_ags_x64_main.c | 15 ++++- 2 files changed, 99 insertions(+), 8 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 58f7bb84e37..c615ba4c203 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -34,6 +34,14 @@ /// \endinternal /// /// --------------------------------------- +/// What's new in AGS 5.4 since version 5.3 +/// --------------------------------------- +/// AGS 5.4 includes the following updates: +/// * A more detailed description of the GPU architecture, now including RDNA GPUs. +/// * Navi 10, Navi 14 and Radeon 7 core and memory speeds returned. +/// * Draw index and Atomic U64 intrinsics for both DX11 and DX12. +/// +/// --------------------------------------- /// What's new in AGS 5.3 since version 5.2 /// --------------------------------------- /// AGS 5.3 includes the following updates: @@ -111,7 +119,7 @@ #define AMD_AGS_H #define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version -#define AMD_AGS_VERSION_MINOR 3 ///< AGS minor version +#define AMD_AGS_VERSION_MINOR 4 ///< AGS minor version #define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version #ifdef __cplusplus @@ -185,9 +193,11 @@ typedef enum AGSDriverExtensionDX11 AGS_DX11_EXTENSION_MULTIVIEW = 1 << 18, ///< Supported in Radeon Software Version 16.12.1 onwards. AGS_DX11_EXTENSION_APP_REGISTRATION = 1 << 19, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX11_EXTENSION_BREADCRUMB_MARKERS = 1 << 20, ///< Supported in Radeon Software Version 17.11.1 onwards. - AGS_DX11_EXTENSION_MDI_DEFERRED_CONTEXTS = 1 << 21, ///< Supported in Radeon Software Version XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onwards. - AGS_DX11_EXTENSION_UAV_OVERLAP_DEFERRED_CONTEXTS = 1 << 22, ///< Supported in Radeon Software Version XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onwards. - AGS_DX11_EXTENSION_DEPTH_BOUNDS_DEFERRED_CONTEXTS = 1 << 23 ///< Supported in Radeon Software Version XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onwards. + AGS_DX11_EXTENSION_MDI_DEFERRED_CONTEXTS = 1 << 21, ///< Supported in Radeon Software Version 18.8.1 onwards. + AGS_DX11_EXTENSION_UAV_OVERLAP_DEFERRED_CONTEXTS = 1 << 22, ///< Supported in Radeon Software Version 18.8.1 onwards. + AGS_DX11_EXTENSION_DEPTH_BOUNDS_DEFERRED_CONTEXTS = 1 << 23, ///< Supported in Radeon Software Version 18.8.1 onwards. + AGS_DX11_EXTENSION_INTRINSIC_DRAW_INDEX = 1 << 24, ///< Supported in Radeon Software Version 19.12.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_ATOMIC_U64 = 1 << 25 ///< Supported in Radeon Software Version 19.12.2 onwards. } AGSDriverExtensionDX11; /// The DirectX12 extension support bits @@ -204,7 +214,10 @@ typedef enum AGSDriverExtensionDX12 AGS_DX12_EXTENSION_INTRINSIC_WAVE_REDUCE = 1 << 8, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX12_EXTENSION_INTRINSIC_WAVE_SCAN = 1 << 9, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX12_EXTENSION_USER_MARKERS = 1 << 10, ///< Supported in Radeon Software Version 17.9.1 onwards. - AGS_DX12_EXTENSION_APP_REGISTRATION = 1 << 11 ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX12_EXTENSION_APP_REGISTRATION = 1 << 11, ///< Supported in Radeon Software Version 17.9.1 onwards. + AGS_DX12_EXTENSION_INTRINSIC_UAV_BIND_SLOT = 1 << 12, ///< Supported in Radeon Software Version 19.5.1 onwards. + AGS_DX12_EXTENSION_INTRINSIC_DRAW_INDEX = 1 << 13, ///< Supported in Radeon Software Version 19.12.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_ATOMIC_U64 = 1 << 14 ///< Supported in Radeon Software Version 19.12.2 onwards. } AGSDriverExtensionDX12; /// The space id for DirectX12 intrinsic support @@ -312,6 +325,19 @@ typedef enum ArchitectureVersion ArchitectureVersion_GCN ///< AMD GCN architecture } ArchitectureVersion; +/// The ASIC family +typedef enum AsicFamily +{ + AsicFamily_Unknown, ///< Unknown architecture, potentially from another IHV. Check \ref AGSDeviceInfo::vendorId + AsicFamily_PreGCN, ///< Pre GCN architecture. + AsicFamily_GCN1, ///< AMD GCN 1 architecture: Oland, Cape Verde, Pitcairn & Tahiti. + AsicFamily_GCN2, ///< AMD GCN 2 architecture: Hawaii & Bonaire. This also includes APUs Kaveri and Carrizo. + AsicFamily_GCN3, ///< AMD GCN 3 architecture: Tonga & Fiji. + AsicFamily_GCN4, ///< AMD GCN 4 architecture: Polaris. + AsicFamily_Vega, ///< AMD Vega architecture, including Raven Ridge (ie AMD Ryzen CPU + AMD Vega GPU). + AsicFamily_RDNA ///< AMD RDNA architecture +} AsicFamily; + /// The device info struct used to describe a physical GPU enumerated by AGS typedef struct AGSDeviceInfo_511 { @@ -374,10 +400,48 @@ typedef struct AGSDeviceInfo_520 int adlAdapterIndex; ///< Internally used index into the ADL list of adapters } AGSDeviceInfo_520; +/// The device info struct used to describe a physical GPU enumerated by AGS +typedef struct AGSDeviceInfo_540 +{ + const char* adapterString; ///< The adapter name string + AsicFamily asicFamily; ///< Set to Unknown if not AMD hardware + int isAPU; ///< Whether or not this is an APU + int vendorId; ///< The vendor id + int deviceId; ///< The device id + int revisionId; ///< The revision id + + int numCUs; ///< Number of compute units. + int numWGPs; ///< Number of RDNA Work Group Processors. Only valid if ASIC is RDNA onwards. + + int numROPs; ///< Number of ROPs + int coreClock; ///< Core clock speed at 100% power in MHz + int memoryClock; ///< Memory clock speed at 100% power in MHz + int memoryBandwidth; ///< Memory bandwidth in MB/s + float teraFlops; ///< Teraflops of GPU. Zero if not GCN onwards. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD + + int isPrimaryDevice; ///< Whether or not this is the primary adapter in the system. Not set on the WACK version. + unsigned long long localMemoryInBytes; ///< The size of local memory in bytes. + unsigned long long sharedMemoryInBytes; ///< The size of system memory available to the GPU in bytes. It is important to factor this into your VRAM budget for APUs + ///< as the reported local memory will only be a small fraction of the total memory available to the GPU. + + int numDisplays; ///< The number of active displays found to be attached to this adapter. + AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + + int eyefinityEnabled; ///< Indicates if Eyefinity is active + int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface. + int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface. + int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. + + int adlAdapterIndex; ///< Internally used index into the ADL list of adapters +} AGSDeviceInfo_540; + typedef union AGSDeviceInfo { AGSDeviceInfo_511 agsDeviceInfo511; AGSDeviceInfo_520 agsDeviceInfo520; + AGSDeviceInfo_540 agsDeviceInfo540; } AGSDeviceInfo; /// \defgroup general General API functions @@ -549,6 +613,8 @@ typedef struct AGSDX12ExtensionParams const WCHAR* pEngineName; ///< Engine name unsigned int appVersion; ///< Application version unsigned int engineVersion; ///< Engine version + // ADDED IN 5.4.0 + unsigned int uavSlot; ///< The UAV slot reserved for intrinsic support. Refer to the \ref agsDriverExtensionsDX12_CreateDevice documentation for more details. } AGSDX12ExtensionParams; /// The struct to hold all the returned parameters from the device creation call @@ -566,7 +632,19 @@ typedef struct AGSDX12ReturnedParams /// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION (/Od) option, otherwise it will not work. /// * The shader compiler needs D3DCOMPILE_ENABLE_STRICTNESS (/Ges) enabled. /// * The intrinsic instructions require a 5.1 shader model. -/// * The Root Signature will need to use an extra resource and sampler. These are not real resources/samplers, they are just used to encode the intrinsic instruction. +/// * The Root Signature will need to reserve an extra UAV resource slot. This is not a real resource that requires allocating, it is just used to encode the intrinsic instructions. +/// +/// The easiest way to set up the reserved UAV slot is to specify it at u0. The register space id will automatically be assumed to be \ref AGS_DX12_SHADER_INSTRINSICS_SPACE_ID. +/// The HLSL expects this as default and the set up code would look similar to this: +/// \code{.cpp} +/// CD3DX12_DESCRIPTOR_RANGE range[]; +/// ... +/// range[ 0 ].Init( D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, AGS_DX12_SHADER_INSTRINSICS_SPACE_ID ); // u0 at driver-reserved space id +/// \endcode +/// +/// Newer drivers also support a user-specified slot in which case the register space id is assumed to be 0. It is important that the \ref AGS_DX12_EXTENSION_INTRINSIC_UAV_BIND_SLOT bit is set +/// to ensure the driver can support this. If not, then u0 and \ref AGS_DX12_SHADER_INSTRINSICS_SPACE_ID must be used. +/// If the driver does support this feature and a non zero slot is required, then the HLSL must also define AMD_EXT_SHADER_INTRINSIC_UAV_OVERRIDE as the matching slot value. /// /// \param [in] context Pointer to a context. This is generated by \ref agsInit /// \param [in] creationParams Pointer to the struct to specify the existing DX12 device creation parameters. @@ -616,7 +694,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DeInit( AGSContext* context ); /// /// Function used to push an AMD user marker onto the command list. -/// This is only has an effect if AGS_DX12_EXTENSION_USER_MARKERS is present in the extensionsSupported bitfield of \ref agsDriverExtensionsDX12_CreateDevice +/// This is only has an effect if \ref AGS_DX12_EXTENSION_USER_MARKERS is present in the extensionsSupported bitfield of \ref agsDriverExtensionsDX12_CreateDevice /// Supported in Radeon Software Version 17.9.1 onwards. /// /// \param [in] context Pointer to a context. diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index b3cf309da41..9b45ec721c2 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -21,6 +21,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_2_0, AMD_AGS_VERSION_5_2_1, AMD_AGS_VERSION_5_3_0, + AMD_AGS_VERSION_5_4_0, AMD_AGS_VERSION_COUNT }; @@ -37,6 +38,7 @@ static const amd_ags_versions[AMD_AGS_VERSION_COUNT] = {5, 2, 0}, {5, 2, 1}, {5, 3, 0}, + {5, 4, 0}, }; struct AGSContext @@ -151,7 +153,6 @@ static AGSReturnCode init_ags_context(AGSContext *context) case AMD_AGS_VERSION_5_2_0: case AMD_AGS_VERSION_5_2_1: case AMD_AGS_VERSION_5_3_0: - default: device->agsDeviceInfo520.adapterString = vk_properties->deviceName; device->agsDeviceInfo520.vendorId = vk_properties->vendorID; device->agsDeviceInfo520.deviceId = vk_properties->deviceID; @@ -162,6 +163,18 @@ static AGSReturnCode init_ags_context(AGSContext *context) if (!i) device->agsDeviceInfo520.isPrimaryDevice = 1; break; + case AMD_AGS_VERSION_5_4_0: + default: + device->agsDeviceInfo540.adapterString = vk_properties->deviceName; + device->agsDeviceInfo540.vendorId = vk_properties->vendorID; + device->agsDeviceInfo540.deviceId = vk_properties->deviceID; + + if (device->agsDeviceInfo540.vendorId == 0x1002) + device->agsDeviceInfo540.asicFamily = AsicFamily_GCN4; + + if (!i) + device->agsDeviceInfo540.isPrimaryDevice = 1; + break; } } From 1af211c5e1237c89870b59f7856447bd5b05c1b9 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 17 Jun 2020 15:16:44 -0700 Subject: [PATCH 0597/1506] amd_ags_x64: Update to 5.4.1 --- dlls/amd_ags_x64/amd_ags.h | 101 +++++++++++++++++++++++----- dlls/amd_ags_x64/amd_ags_x64_main.c | 15 ++++- 2 files changed, 98 insertions(+), 18 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index c615ba4c203..30f3735915c 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -34,11 +34,21 @@ /// \endinternal /// /// --------------------------------------- +/// What's new in AGS 5.4.1 since version 5.4.0 +/// --------------------------------------- +/// AGS 5.4.1 includes the following updates: +/// * AsicFamily_Count to help with code maintenance. +/// * Visual Studio 2019 support. +/// * x86 support +/// * BaseInstance and BaseVertex intrinsics along with corresponding caps bits. +/// * GetWaveSize intrinsic along with corresponding caps bits. +/// +/// --------------------------------------- /// What's new in AGS 5.4 since version 5.3 /// --------------------------------------- /// AGS 5.4 includes the following updates: /// * A more detailed description of the GPU architecture, now including RDNA GPUs. -/// * Navi 10, Navi 14 and Radeon 7 core and memory speeds returned. +/// * Radeon 7 core and memory speeds returned. /// * Draw index and Atomic U64 intrinsics for both DX11 and DX12. /// /// --------------------------------------- @@ -47,7 +57,7 @@ /// AGS 5.3 includes the following updates: /// * DX11 deferred context support for Multi Draw Indirect and UAV Overlap extensions. /// * A Radeon Software Version helper to determine whether the installed driver meets your game's minimum driver version requirements. -/// * Freesync2 Gamma 2.2 mode which uses a 1010102 swapchain and can be considered as an alternative to using the 64 bit swapchain required for Freesync2 scRGB. +/// * Freesync HDR Gamma 2.2 mode which uses a 1010102 swapchain and can be considered as an alternative to using the 64 bit swapchain required for Freesync HDR scRGB. /// /// What's new in AGS 5.2.1 since version 5.2.0 /// --------------------------------------- @@ -120,16 +130,19 @@ #define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version #define AMD_AGS_VERSION_MINOR 4 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version +#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version #ifdef __cplusplus extern "C" { #endif +/// \defgroup Defines AGS defines +/// @{ #define AMD_AGS_API WINAPI #define AGS_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) ///< Macro to create the app and engine versions for the fields in \ref AGSDX12ExtensionParams and \ref AGSDX11ExtensionParams and the Radeon Software Version #define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version +/// @} // Forward declaration of D3D11 types struct IDXGIAdapter; @@ -154,6 +167,8 @@ struct D3D11_SUBRESOURCE_DATA; struct ID3D12Device; struct ID3D12GraphicsCommandList; +/// \defgroup enums General enumerations +/// @{ /// The return codes typedef enum AGSReturnCode @@ -162,8 +177,10 @@ typedef enum AGSReturnCode AGS_FAILURE, ///< Failed to complete call for some unspecified reason AGS_INVALID_ARGS, ///< Invalid arguments into the function AGS_OUT_OF_MEMORY, ///< Out of memory when allocating space internally - AGS_ERROR_MISSING_DLL, ///< Returned when a driver dll fails to load - most likely due to not being present in legacy driver installation - AGS_ERROR_LEGACY_DRIVER, ///< Returned if a feature is not present in the installed driver + AGS_MISSING_D3D_DLL, ///< Returned when a D3D dll fails to load + AGS_LEGACY_DRIVER, ///< Returned if a feature is not present in the installed driver + // AGS_NO_AMD_DRIVER_INSTALLED ADDED IN 5.4.1 + AGS_NO_AMD_DRIVER_INSTALLED, ///< Returned if the AMD GPU driver does not appear to be installed AGS_EXTENSION_NOT_SUPPORTED, ///< Returned if the driver does not support the requested driver extension AGS_ADL_FAILURE, ///< Failure in ADL (the AMD Display Library) AGS_DX_FAILURE ///< Failure from DirectX runtime @@ -197,7 +214,10 @@ typedef enum AGSDriverExtensionDX11 AGS_DX11_EXTENSION_UAV_OVERLAP_DEFERRED_CONTEXTS = 1 << 22, ///< Supported in Radeon Software Version 18.8.1 onwards. AGS_DX11_EXTENSION_DEPTH_BOUNDS_DEFERRED_CONTEXTS = 1 << 23, ///< Supported in Radeon Software Version 18.8.1 onwards. AGS_DX11_EXTENSION_INTRINSIC_DRAW_INDEX = 1 << 24, ///< Supported in Radeon Software Version 19.12.2 onwards. - AGS_DX11_EXTENSION_INTRINSIC_ATOMIC_U64 = 1 << 25 ///< Supported in Radeon Software Version 19.12.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_ATOMIC_U64 = 1 << 25, ///< Supported in Radeon Software Version 19.12.2 onwards. + AGS_DX11_EXTENSION_INTRINSIC_GET_WAVE_SIZE = 1 << 26, ///< Supported in Radeon Software Version 20.2.1 onwards. + AGS_DX11_EXTENSION_INTRINSIC_BASE_VERTEX = 1 << 27, ///< Supported in Radeon Software Version 20.2.1 onwards. + AGS_DX11_EXTENSION_INTRINSIC_BASE_INSTANCE = 1 << 28 ///< Supported in Radeon Software Version 20.2.1 onwards. } AGSDriverExtensionDX11; /// The DirectX12 extension support bits @@ -217,7 +237,10 @@ typedef enum AGSDriverExtensionDX12 AGS_DX12_EXTENSION_APP_REGISTRATION = 1 << 11, ///< Supported in Radeon Software Version 17.9.1 onwards. AGS_DX12_EXTENSION_INTRINSIC_UAV_BIND_SLOT = 1 << 12, ///< Supported in Radeon Software Version 19.5.1 onwards. AGS_DX12_EXTENSION_INTRINSIC_DRAW_INDEX = 1 << 13, ///< Supported in Radeon Software Version 19.12.2 onwards. - AGS_DX12_EXTENSION_INTRINSIC_ATOMIC_U64 = 1 << 14 ///< Supported in Radeon Software Version 19.12.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_ATOMIC_U64 = 1 << 14, ///< Supported in Radeon Software Version 19.12.2 onwards. + AGS_DX12_EXTENSION_INTRINSIC_BASE_VERTEX = 1 << 15, ///< Supported in Radeon Software Version 20.2.1 onwards. + AGS_DX12_EXTENSION_INTRINSIC_BASE_INSTANCE = 1 << 16, ///< Supported in Radeon Software Version 20.2.1 onwards. + AGS_DX12_EXTENSION_INTRINSIC_GET_WAVE_SIZE = 1 << 17 ///< Supported in Radeon Software Version 20.5.1 onwards. } AGSDriverExtensionDX12; /// The space id for DirectX12 intrinsic support @@ -238,7 +261,7 @@ typedef enum AGSDisplayFlags AGS_DISPLAYFLAG_HDR10 = 1 << 1, ///< HDR10 is supported on this display AGS_DISPLAYFLAG_DOLBYVISION = 1 << 2, ///< Dolby Vision is supported on this display AGS_DISPLAYFLAG_FREESYNC = 1 << 3, ///< Freesync is supported on this display - AGS_DISPLAYFLAG_FREESYNC_2 = 1 << 4, ///< Freesync 2 is supported on this display + AGS_DISPLAYFLAG_FREESYNC_HDR = 1 << 4, ///< Freesync HDR is supported on this display AGS_DISPLAYFLAG_EYEFINITY_IN_GROUP = 1 << 5, ///< The display is part of the Eyefinity group AGS_DISPLAYFLAG_EYEFINITY_PREFERRED_DISPLAY = 1 << 6, ///< The display is the preferred display in the Eyefinity group for displaying the UI AGS_DISPLAYFLAG_EYEFINITY_IN_PORTRAIT_MODE = 1 << 7, ///< The display is in the Eyefinity group but in portrait mode @@ -250,6 +273,7 @@ typedef enum AGSDisplaySettingsFlags AGS_DISPLAYSETTINGSFLAG_DISABLE_LOCAL_DIMMING = 1 << 0, ///< Disables local dimming if possible } AGSDisplaySettingsFlags; +/// @} typedef struct AGSContext AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInit @@ -280,7 +304,7 @@ typedef struct AGSDisplayInfo char name[ 256 ]; ///< The name of the display char displayDeviceName[ 32 ]; ///< The display device name, i.e. DISPLAY_DEVICE::DeviceName - unsigned int displayFlags; ///< Bitfield of ::AGSDisplayFlags + unsigned int displayFlags; ///< Bitfield of \ref AGSDisplayFlags int maxResolutionX; ///< The maximum supported resolution of the unrotated display int maxResolutionY; ///< The maximum supported resolution of the unrotated display @@ -335,7 +359,9 @@ typedef enum AsicFamily AsicFamily_GCN3, ///< AMD GCN 3 architecture: Tonga & Fiji. AsicFamily_GCN4, ///< AMD GCN 4 architecture: Polaris. AsicFamily_Vega, ///< AMD Vega architecture, including Raven Ridge (ie AMD Ryzen CPU + AMD Vega GPU). - AsicFamily_RDNA ///< AMD RDNA architecture + AsicFamily_RDNA, ///< AMD RDNA architecture + + AsicFamily_Count ///< Number of enumerated ASIC families } AsicFamily; /// The device info struct used to describe a physical GPU enumerated by AGS @@ -437,11 +463,47 @@ typedef struct AGSDeviceInfo_540 int adlAdapterIndex; ///< Internally used index into the ADL list of adapters } AGSDeviceInfo_540; +/// The device info struct used to describe a physical GPU enumerated by AGS +typedef struct AGSDeviceInfo_541 +{ + const char* adapterString; ///< The adapter name string + AsicFamily asicFamily; ///< Set to Unknown if not AMD hardware + int isAPU; ///< Whether or not this is an APU + int vendorId; ///< The vendor id + int deviceId; ///< The device id + int revisionId; ///< The revision id + + int numCUs; ///< Number of compute units. + int numWGPs; ///< Number of RDNA Work Group Processors. Only valid if ASIC is RDNA onwards. + + int numROPs; ///< Number of ROPs + int coreClock; ///< Core clock speed at 100% power in MHz + int memoryClock; ///< Memory clock speed at 100% power in MHz + int memoryBandwidth; ///< Memory bandwidth in MB/s + float teraFlops; ///< Teraflops of GPU. Zero if not GCN onwards. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD + + int isPrimaryDevice; ///< Whether or not this is the primary adapter in the system. Not set on the WACK version. + long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. + + int numDisplays; ///< The number of active displays found to be attached to this adapter. + AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + + int eyefinityEnabled; ///< Indicates if Eyefinity is active + int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface. + int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface. + int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. + + int adlAdapterIndex; ///< Internally used index into the ADL list of adapters +} AGSDeviceInfo_541; + typedef union AGSDeviceInfo { AGSDeviceInfo_511 agsDeviceInfo511; AGSDeviceInfo_520 agsDeviceInfo520; AGSDeviceInfo_540 agsDeviceInfo540; + AGSDeviceInfo_541 agsDeviceInfo541; } AGSDeviceInfo; /// \defgroup general General API functions @@ -495,10 +557,12 @@ typedef struct AGSDisplaySettings Mode_SDR, ///< SDR mode Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. - Mode_Freesync2_scRGB, ///< Freesync2 scRGB, requiring an FP16 swapchain. 1.0 == 80 nits. Tonemap your scene to the range of 0.0 to AGSDisplayInfo::maxLuminance. - // Mode_Freesync2_Gamma22 ADDED IN 5.3.0 - Mode_Freesync2_Gamma22, ///< Freesync2 Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. - Mode_DolbyVision ///< Dolby Vision, requiring an 8888 UNORM swapchain + Mode_FreesyncHDR_scRGB, ///< Freesync HDR scRGB, requiring an FP16 swapchain. A value of 1.0 == 80 nits. + // Mode_FreesyncHDR_Gamma22 ADDED IN 5.3.0 + Mode_FreesyncHDR_Gamma22, ///< Freesync HDR Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. + Mode_DolbyVision, ///< Dolby Vision, requiring an 8888 UNORM swapchain + + Mode_Count ///< Number of enumerated display modes } mode; ///< The display mode to set the display into double chromaticityRedX; ///< Red display primary X coord @@ -545,7 +609,9 @@ AMD_AGS_API AGSDriverVersionResult agsCheckDriverVersion( const char* radeonSoft /// Function used to initialize the AGS library. /// Must be called prior to any of the subsequent AGS API calls. /// Must be called prior to ID3D11Device or ID3D12Device creation. -/// \note This function will fail with \ref AGS_ERROR_LEGACY_DRIVER in Catalyst versions before 12.20. +/// \note The caller of this function should handle the possibility of the call failing in the cases below. One option is to do a vendor id check and only call \ref agsInit if there is an AMD GPU present. +/// \note This function will fail with \ref AGS_NO_AMD_DRIVER_INSTALLED if there is no AMD driver found on the system. +/// \note This function will fail with \ref AGS_LEGACY_DRIVER in Catalyst versions before 12.20. /// \note It is good practice to check the AGS version returned from AGSGPUInfo against the version defined in the header in case a mismatch between the dll and header has occurred. /// /// \param [in, out] context Address of a pointer to a context. This function allocates a context on the heap which is then required for all subsequent API calls. @@ -577,7 +643,8 @@ AMD_AGS_API AGSReturnCode agsGetCrossfireGPUCount( AGSContext* context, int* num /// \note Call this function after each mode change (switch to fullscreen, any change in swapchain etc). /// \note HDR10 PQ mode requires a 1010102 swapchain. /// \note HDR10 scRGB mode requires an FP16 swapchain. -/// \note Freesync2 scRGB mode requires an FP16 swapchain. +/// \note Freesync HDR scRGB mode requires an FP16 swapchain. +/// \note Freesync HDR Gamma 2.2 mode requires a 1010102 swapchain. /// \note Dolby Vision requires a 8888 UNORM swapchain. /// /// \param [in] context Pointer to a context. This is generated by \ref agsInit diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 9b45ec721c2..85b2db0b936 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -22,6 +22,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_2_1, AMD_AGS_VERSION_5_3_0, AMD_AGS_VERSION_5_4_0, + AMD_AGS_VERSION_5_4_1, AMD_AGS_VERSION_COUNT }; @@ -39,6 +40,7 @@ static const amd_ags_versions[AMD_AGS_VERSION_COUNT] = {5, 2, 1}, {5, 3, 0}, {5, 4, 0}, + {5, 4, 1}, }; struct AGSContext @@ -164,7 +166,6 @@ static AGSReturnCode init_ags_context(AGSContext *context) device->agsDeviceInfo520.isPrimaryDevice = 1; break; case AMD_AGS_VERSION_5_4_0: - default: device->agsDeviceInfo540.adapterString = vk_properties->deviceName; device->agsDeviceInfo540.vendorId = vk_properties->vendorID; device->agsDeviceInfo540.deviceId = vk_properties->deviceID; @@ -175,6 +176,18 @@ static AGSReturnCode init_ags_context(AGSContext *context) if (!i) device->agsDeviceInfo540.isPrimaryDevice = 1; break; + case AMD_AGS_VERSION_5_4_1: + default: + device->agsDeviceInfo541.adapterString = vk_properties->deviceName; + device->agsDeviceInfo541.vendorId = vk_properties->vendorID; + device->agsDeviceInfo541.deviceId = vk_properties->deviceID; + + if (device->agsDeviceInfo541.vendorId == 0x1002) + device->agsDeviceInfo541.asicFamily = AsicFamily_GCN4; + + if (!i) + device->agsDeviceInfo541.isPrimaryDevice = 1; + break; } } From 4051ff4a3baf88827b44b63d66e17a167bb004c3 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 17 Jun 2020 16:33:08 -0700 Subject: [PATCH 0598/1506] amd_ags_x64: Fill in localMemoryInBytes. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 39 ++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 85b2db0b936..d845a0978d8 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -49,12 +49,14 @@ struct AGSContext unsigned int device_count; AGSDeviceInfo *devices; VkPhysicalDeviceProperties *properties; + VkPhysicalDeviceMemoryProperties *memory_properties; }; static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, - VkPhysicalDeviceProperties **out) + VkPhysicalDeviceProperties **out, VkPhysicalDeviceMemoryProperties **out_memory) { VkPhysicalDeviceProperties *properties = NULL; + VkPhysicalDeviceMemoryProperties *memory_properties = NULL; VkPhysicalDevice *vk_physical_devices = NULL; VkInstance vk_instance = VK_NULL_HANDLE; VkInstanceCreateInfo create_info; @@ -99,11 +101,23 @@ static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, goto done; } + if (!(memory_properties = heap_calloc(count, sizeof(*memory_properties)))) + { + WARN("Failed to allocate memory.\n"); + heap_free(properties); + ret = AGS_OUT_OF_MEMORY; + goto done; + } + for (i = 0; i < count; ++i) vkGetPhysicalDeviceProperties(vk_physical_devices[i], &properties[i]); + for (i = 0; i < count; ++i) + vkGetPhysicalDeviceMemoryProperties(vk_physical_devices[i], &memory_properties[i]); + *out_count = count; *out = properties; + *out_memory = memory_properties; done: heap_free(vk_physical_devices); @@ -115,15 +129,16 @@ static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, static AGSReturnCode init_ags_context(AGSContext *context) { AGSReturnCode ret; - unsigned int i; + unsigned int i, j; // TODO: version check context->version = AMD_AGS_VERSION_5_1_1; context->device_count = 0; context->devices = NULL; context->properties = NULL; + context->memory_properties = NULL; - ret = vk_get_physical_device_properties(&context->device_count, &context->properties); + ret = vk_get_physical_device_properties(&context->device_count, &context->properties, &context->memory_properties); if (ret != AGS_SUCCESS || !context->device_count) return ret; @@ -131,13 +146,26 @@ static AGSReturnCode init_ags_context(AGSContext *context) { WARN("Failed to allocate memory.\n"); heap_free(context->properties); + heap_free(context->memory_properties); return AGS_OUT_OF_MEMORY; } for (i = 0; i < context->device_count; ++i) { const VkPhysicalDeviceProperties *vk_properties = &context->properties[i]; + const VkPhysicalDeviceMemoryProperties *vk_memory_properties = &context->memory_properties[i]; AGSDeviceInfo *device = &context->devices[i]; + VkDeviceSize local_memory_size = 0; + + for (j = 0; j < vk_memory_properties->memoryHeapCount; j++) + { + if (vk_memory_properties->memoryHeaps[j].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) + { + local_memory_size = vk_memory_properties->memoryHeaps[j].size; + break; + } + } + TRACE("reporting local memory size 0x%s bytes\n", wine_dbgstr_longlong(local_memory_size)); switch (context->version) { @@ -145,6 +173,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) device->agsDeviceInfo511.adapterString = vk_properties->deviceName; device->agsDeviceInfo511.vendorId = vk_properties->vendorID; device->agsDeviceInfo511.deviceId = vk_properties->deviceID; + device->agsDeviceInfo511.localMemoryInBytes = local_memory_size; if (device->agsDeviceInfo511.vendorId == 0x1002) device->agsDeviceInfo511.architectureVersion = ArchitectureVersion_GCN; @@ -158,6 +187,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) device->agsDeviceInfo520.adapterString = vk_properties->deviceName; device->agsDeviceInfo520.vendorId = vk_properties->vendorID; device->agsDeviceInfo520.deviceId = vk_properties->deviceID; + device->agsDeviceInfo520.localMemoryInBytes = local_memory_size; if (device->agsDeviceInfo520.vendorId == 0x1002) device->agsDeviceInfo520.architectureVersion = ArchitectureVersion_GCN; @@ -169,6 +199,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) device->agsDeviceInfo540.adapterString = vk_properties->deviceName; device->agsDeviceInfo540.vendorId = vk_properties->vendorID; device->agsDeviceInfo540.deviceId = vk_properties->deviceID; + device->agsDeviceInfo540.localMemoryInBytes = local_memory_size; if (device->agsDeviceInfo540.vendorId == 0x1002) device->agsDeviceInfo540.asicFamily = AsicFamily_GCN4; @@ -181,6 +212,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) device->agsDeviceInfo541.adapterString = vk_properties->deviceName; device->agsDeviceInfo541.vendorId = vk_properties->vendorID; device->agsDeviceInfo541.deviceId = vk_properties->deviceID; + device->agsDeviceInfo541.localMemoryInBytes = local_memory_size; if (device->agsDeviceInfo541.vendorId == 0x1002) device->agsDeviceInfo541.asicFamily = AsicFamily_GCN4; @@ -238,6 +270,7 @@ AGSReturnCode WINAPI agsDeInit(AGSContext *context) if (context) { + heap_free(context->memory_properties); heap_free(context->properties); heap_free(context->devices); heap_free(context); From 878a441d944e4b196f2fc20d6b7da3b3047f4b33 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 17 Jun 2020 16:36:24 -0700 Subject: [PATCH 0599/1506] amd_ags_x64: Update reported driver version to 20.20.2. Needed to silence warnings in Red Dead Redemption 2. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index d845a0978d8..62a1a02c823 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -252,8 +252,8 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi gpu_info->agsVersionMajor = amd_ags_versions[object->version].major; gpu_info->agsVersionMinor = amd_ags_versions[object->version].minor; gpu_info->agsVersionPatch = amd_ags_versions[object->version].patch; - gpu_info->driverVersion = "18.10.16-180516a-328911C-RadeonSoftwareAdrenalin"; - gpu_info->radeonSoftwareVersion = "18.5.1"; + gpu_info->driverVersion = "20.20.2-180516a-328911C-RadeonSoftwareAdrenalin"; + gpu_info->radeonSoftwareVersion = "20.20.2"; gpu_info->numDevices = object->device_count; gpu_info->devices = object->devices; From bf513737c73df67063b1b8655e49eb02d311b0a1 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Thu, 25 Jun 2020 15:54:59 -0700 Subject: [PATCH 0600/1506] amd_ags_x64: Detect library version from DLL included with game. --- dlls/amd_ags_x64/Makefile.in | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 70 ++++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in index b2c2a28c064..5cd98895ff6 100644 --- a/dlls/amd_ags_x64/Makefile.in +++ b/dlls/amd_ags_x64/Makefile.in @@ -1,6 +1,6 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = amd_ags_x64.dll -IMPORTS = vulkan-1 +IMPORTS = version vulkan-1 IMPORTLIB = amd_ags_x64 EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 62a1a02c823..b2f8149bcd8 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -126,13 +126,79 @@ static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, return ret; } +static enum amd_ags_version determine_ags_version(void) +{ + /* AMD AGS is not binary compatible between versions (even minor versions), and the game + * does not request a specific version when calling agsInit(). + * Checking the version of amd_ags_x64.dll shipped with the game is the only way to + * determine what version the game was built against. + * + * An update to AGS 5.4.1 included an amd_ags_x64.dll with no file version info. + * In case of an error, assume it's that version. + */ + enum amd_ags_version ret = AMD_AGS_VERSION_5_4_1; + DWORD infosize; + void *infobuf = NULL; + void *val; + UINT vallen, i; + VS_FIXEDFILEINFO *info; + UINT16 major, minor, patch; + + infosize = GetFileVersionInfoSizeW(L"amd_ags_x64.dll", NULL); + if (!infosize) + { + WARN("Unable to determine desired version of amd_ags_x64.dll.\n"); + goto done; + } + + if (!(infobuf = heap_alloc(infosize))) + { + WARN("Failed to allocate memory.\n"); + goto done; + } + + if (!GetFileVersionInfoW(L"amd_ags_x64.dll", 0, infosize, infobuf)) + { + WARN("Unable to determine desired version of amd_ags_x64.dll.\n"); + goto done; + } + + if (!VerQueryValueW(infobuf, L"\\", &val, &vallen) || (vallen != sizeof(VS_FIXEDFILEINFO))) + { + WARN("Unable to determine desired version of amd_ags_x64.dll.\n"); + goto done; + } + + info = val; + major = info->dwFileVersionMS >> 16; + minor = info->dwFileVersionMS; + patch = info->dwFileVersionLS >> 16; + TRACE("Found amd_ags_x64.dll v%d.%d.%d\n", major, minor, patch); + + for (i = 0; i < ARRAY_SIZE(amd_ags_versions); i++) + { + if ((major == amd_ags_versions[i].major) && + (minor == amd_ags_versions[i].minor) && + (patch == amd_ags_versions[i].patch)) + { + ret = i; + break; + } + } + +done: + heap_free(infobuf); + TRACE("Using AGS v%d.%d.%d interface\n", + amd_ags_versions[ret].major, amd_ags_versions[ret].minor, amd_ags_versions[ret].patch); + return ret; +} + static AGSReturnCode init_ags_context(AGSContext *context) { AGSReturnCode ret; unsigned int i, j; - // TODO: version check - context->version = AMD_AGS_VERSION_5_1_1; + context->version = determine_ags_version(); context->device_count = 0; context->devices = NULL; context->properties = NULL; From 4d8a8a8aa6409955f84732827264d063c1952db7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 21 Apr 2021 16:16:55 +0300 Subject: [PATCH 0601/1506] setupapi: Don't install built-in amd_ags_x64.dll in system32/syswow64. The DLL ships with the games and having the built-in version in system32/syswow64 has unexpected consequences. If the game is launched from a subdirectory, but the DLL is in current working directory, the built-in takes precedence as CWD has lower search priority than system directories (with the default SafeDllSearchMode). By not installing amd_ags_x64.dll in system32/syswow64 the built-in is still picked up correctly from lib/ when necessary. This fixes Evil Genius 2. CW-Bug-Id: 18804 --- dlls/setupapi/fakedll.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c index 25305d8a4f6..fb01d21b3ba 100644 --- a/dlls/setupapi/fakedll.c +++ b/dlls/setupapi/fakedll.c @@ -978,6 +978,7 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *wildcard, if (lstrlenW( data.name ) > max_dll_name_len) continue; if (!wcscmp( data.name, L"." )) continue; if (!wcscmp( data.name, L".." )) continue; + if (!wcscmp( data.name, L"amd_ags_x64.dll" )) continue; lstrcpyW( name, data.name ); if (default_ext) /* inside build dir */ { From 7fce7d8936b642fc3b92b75a548d6534092940c9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 20:21:29 +0300 Subject: [PATCH 0602/1506] amd_ags_x64: Don't use ordinals in spec file. For Forza Horizon 4. --- dlls/amd_ags_x64/amd_ags_x64.spec | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index a302d2fc657..c571dac2184 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -1,29 +1,29 @@ -1 stdcall agsDeInit(ptr) -2 stub agsDriverExtensionsDX11_BeginUAVOverlap -3 stub agsDriverExtensionsDX11_CreateBuffer -4 stub agsDriverExtensionsDX11_CreateTexture1D -5 stub agsDriverExtensionsDX11_CreateTexture2D -6 stub agsDriverExtensionsDX11_CreateTexture3D -7 stub agsDriverExtensionsDX11_DeInit -8 stub agsDriverExtensionsDX11_EndUAVOverlap -9 stub agsDriverExtensionsDX11_GetMaxClipRects -10 stub agsDriverExtensionsDX11_IASetPrimitiveTopology -11 stub agsDriverExtensionsDX11_Init -12 stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect -13 stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect -14 stub agsDriverExtensionsDX11_MultiDrawInstancedIndirect -15 stub agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect -16 stub agsDriverExtensionsDX11_NotifyResourceBeginAllAccess -17 stub agsDriverExtensionsDX11_NotifyResourceEndAllAccess -18 stub agsDriverExtensionsDX11_NotifyResourceEndWrites -19 stub agsDriverExtensionsDX11_NumPendingAsyncCompileJobs -20 stub agsDriverExtensionsDX11_SetClipRects -21 stub agsDriverExtensionsDX11_SetDepthBounds -22 stub agsDriverExtensionsDX11_SetDiskShaderCacheEnabled -23 stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount -24 stub agsDriverExtensionsDX11_SetViewBroadcastMasks -25 stub agsDriverExtensionsDX12_DeInit -26 stub agsDriverExtensionsDX12_Init -27 stdcall agsGetCrossfireGPUCount(ptr ptr) -28 stdcall agsInit(ptr ptr ptr) -29 stub agsSetDisplayMode +@ stdcall agsDeInit(ptr) +@ stub agsDriverExtensionsDX11_BeginUAVOverlap +@ stub agsDriverExtensionsDX11_CreateBuffer +@ stub agsDriverExtensionsDX11_CreateTexture1D +@ stub agsDriverExtensionsDX11_CreateTexture2D +@ stub agsDriverExtensionsDX11_CreateTexture3D +@ stub agsDriverExtensionsDX11_DeInit +@ stub agsDriverExtensionsDX11_EndUAVOverlap +@ stub agsDriverExtensionsDX11_GetMaxClipRects +@ stub agsDriverExtensionsDX11_IASetPrimitiveTopology +@ stub agsDriverExtensionsDX11_Init +@ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect +@ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect +@ stub agsDriverExtensionsDX11_MultiDrawInstancedIndirect +@ stub agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect +@ stub agsDriverExtensionsDX11_NotifyResourceBeginAllAccess +@ stub agsDriverExtensionsDX11_NotifyResourceEndAllAccess +@ stub agsDriverExtensionsDX11_NotifyResourceEndWrites +@ stub agsDriverExtensionsDX11_NumPendingAsyncCompileJobs +@ stub agsDriverExtensionsDX11_SetClipRects +@ stub agsDriverExtensionsDX11_SetDepthBounds +@ stub agsDriverExtensionsDX11_SetDiskShaderCacheEnabled +@ stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount +@ stub agsDriverExtensionsDX11_SetViewBroadcastMasks +@ stub agsDriverExtensionsDX12_DeInit +@ stub agsDriverExtensionsDX12_Init +@ stdcall agsGetCrossfireGPUCount(ptr ptr) +@ stdcall agsInit(ptr ptr ptr) +@ stub agsSetDisplayMode From 23bc5b3c15022fa8d3bb8f5271fa8df951f79157 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 20:07:28 +0300 Subject: [PATCH 0603/1506] amd_ags_x64: Add more stubs to spec file. For Forza Horizon 4. --- dlls/amd_ags_x64/amd_ags_x64.spec | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index c571dac2184..f483cc6380b 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -1,10 +1,15 @@ @ stdcall agsDeInit(ptr) +@ stub agsCheckDriverVersion @ stub agsDriverExtensionsDX11_BeginUAVOverlap @ stub agsDriverExtensionsDX11_CreateBuffer +@ stub agsDriverExtensionsDX11_CreateDevice +@ stub agsDriverExtensionsDX11_CreateFromDevice @ stub agsDriverExtensionsDX11_CreateTexture1D @ stub agsDriverExtensionsDX11_CreateTexture2D @ stub agsDriverExtensionsDX11_CreateTexture3D @ stub agsDriverExtensionsDX11_DeInit +@ stub agsDriverExtensionsDX11_Destroy +@ stub agsDriverExtensionsDX11_DestroyDevice @ stub agsDriverExtensionsDX11_EndUAVOverlap @ stub agsDriverExtensionsDX11_GetMaxClipRects @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology @@ -22,8 +27,16 @@ @ stub agsDriverExtensionsDX11_SetDiskShaderCacheEnabled @ stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount @ stub agsDriverExtensionsDX11_SetViewBroadcastMasks +@ stub agsDriverExtensionsDX11_WriteBreadcrumb +@ stub agsDriverExtensionsDX12_CreateDevice +@ stub agsDriverExtensionsDX12_CreateFromDevice @ stub agsDriverExtensionsDX12_DeInit +@ stub agsDriverExtensionsDX12_Destroy +@ stub agsDriverExtensionsDX12_DestroyDevice @ stub agsDriverExtensionsDX12_Init +@ stub agsDriverExtensionsDX12_PopMarker +@ stub agsDriverExtensionsDX12_PushMarker +@ stub agsDriverExtensionsDX12_SetMarker @ stdcall agsGetCrossfireGPUCount(ptr ptr) @ stdcall agsInit(ptr ptr ptr) @ stub agsSetDisplayMode From 7cd170c7d35b88b2bea837efa402502e84841122 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 20:30:22 +0300 Subject: [PATCH 0604/1506] amd_ags_x64: Add partial stub for agsCheckDriverVersion(). For Forza Horizon 4. --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index f483cc6380b..6806b145751 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -1,5 +1,5 @@ @ stdcall agsDeInit(ptr) -@ stub agsCheckDriverVersion +@ stdcall agsCheckDriverVersion(ptr long) @ stub agsDriverExtensionsDX11_BeginUAVOverlap @ stub agsDriverExtensionsDX11_CreateBuffer @ stub agsDriverExtensionsDX11_CreateDevice diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index b2f8149bcd8..d4bc099dedb 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -356,6 +356,13 @@ AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count return AGS_SUCCESS; } +AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported, unsigned int version_required) +{ + FIXME("version_reported %s, version_required %d semi-stub.\n", debugstr_a(version_reported), version_required); + + return AGS_SOFTWAREVERSIONCHECK_OK; +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From 9152fd514aee573764246dfcf370606cb76c7970 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 20:35:31 +0300 Subject: [PATCH 0605/1506] amd_ags_x64: Implement agsDriverExtensionsDX12_CreateDevice(). For Forza Horizon 4. --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 43 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 6806b145751..7551a9346d8 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -28,7 +28,7 @@ @ stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount @ stub agsDriverExtensionsDX11_SetViewBroadcastMasks @ stub agsDriverExtensionsDX11_WriteBreadcrumb -@ stub agsDriverExtensionsDX12_CreateDevice +@ stdcall agsDriverExtensionsDX12_CreateDevice(ptr ptr ptr ptr) @ stub agsDriverExtensionsDX12_CreateFromDevice @ stub agsDriverExtensionsDX12_DeInit @ stub agsDriverExtensionsDX12_Destroy diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index d4bc099dedb..f54b40da609 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -52,6 +52,21 @@ struct AGSContext VkPhysicalDeviceMemoryProperties *memory_properties; }; +static HMODULE hd3d12; +static typeof(D3D12CreateDevice) *pD3D12CreateDevice; + +static BOOL load_d3d12_functions(void) +{ + if (hd3d12) + return TRUE; + + if (!(hd3d12 = LoadLibraryA("d3d12.dll"))) + return FALSE; + + pD3D12CreateDevice = (void *)GetProcAddress(hd3d12, "D3D12CreateDevice"); + return TRUE; +} + static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, VkPhysicalDeviceProperties **out, VkPhysicalDeviceMemoryProperties **out_memory) { @@ -356,6 +371,34 @@ AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensionsDX12_CreateDevice(AGSContext *context, + const AGSDX12DeviceCreationParams *creation_params, const AGSDX12ExtensionParams *extension_params, + AGSDX12ReturnedParams *returned_params) +{ + HRESULT hr; + + TRACE("feature level %#x, app %s, engine %s %#x %#x.\n", creation_params->FeatureLevel, debugstr_w(extension_params->pAppName), + debugstr_w(extension_params->pEngineName), extension_params->appVersion, extension_params->engineVersion); + + if (!load_d3d12_functions()) + { + ERR("Could not load d3d12.dll.\n"); + return AGS_MISSING_D3D_DLL; + } + + memset(returned_params, 0, sizeof(*returned_params)); + if (FAILED(hr = pD3D12CreateDevice((IUnknown *)creation_params->pAdapter, creation_params->FeatureLevel, + &creation_params->iid, (void **)&returned_params->pDevice))) + { + ERR("D3D12CreateDevice failed, hr %#x.\n", hr); + return AGS_DX_FAILURE; + } + + TRACE("Created d3d12 device %p.\n", returned_params->pDevice); + + return AGS_SUCCESS; +} + AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported, unsigned int version_required) { FIXME("version_reported %s, version_required %d semi-stub.\n", debugstr_a(version_reported), version_required); From 45cf8980b08366b2d33cfb32143f8c6739d6fb75 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 17:29:31 +0300 Subject: [PATCH 0606/1506] amd_ags_x64: Fix devices array layout. And refactor multiple layout device structure handling on the way to avoid more switches in future patches. For Forza Horizon 4. --- dlls/amd_ags_x64/amd_ags.h | 10 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 152 +++++++++++++++------------- 2 files changed, 83 insertions(+), 79 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 30f3735915c..47ed5b91a14 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -498,13 +498,7 @@ typedef struct AGSDeviceInfo_541 int adlAdapterIndex; ///< Internally used index into the ADL list of adapters } AGSDeviceInfo_541; -typedef union AGSDeviceInfo -{ - AGSDeviceInfo_511 agsDeviceInfo511; - AGSDeviceInfo_520 agsDeviceInfo520; - AGSDeviceInfo_540 agsDeviceInfo540; - AGSDeviceInfo_541 agsDeviceInfo541; -} AGSDeviceInfo; +struct AGSDeviceInfo; /// \defgroup general General API functions /// API for initialization, cleanup, HDR display modes and Crossfire GPU count @@ -545,7 +539,7 @@ typedef struct AGSGPUInfo const char* radeonSoftwareVersion; ///< The Radeon Software Version int numDevices; ///< Number of GPUs in the system - AGSDeviceInfo* devices; ///< List of GPUs in the system + struct AGSDeviceInfo* devices; ///< List of GPUs in the system } AGSGPUInfo; /// The struct to specify the display settings to the driver. diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index f54b40da609..1669f08fae7 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1,5 +1,6 @@ #include #include +#include #include "windef.h" #include "winbase.h" @@ -27,27 +28,74 @@ enum amd_ags_version AMD_AGS_VERSION_COUNT }; -struct +static const struct { int major; int minor; int patch; + unsigned int device_size; } -static const amd_ags_versions[AMD_AGS_VERSION_COUNT] = +amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {5, 1, 1}, - {5, 2, 0}, - {5, 2, 1}, - {5, 3, 0}, - {5, 4, 0}, - {5, 4, 1}, + {5, 1, 1, sizeof(AGSDeviceInfo_511)}, + {5, 2, 0, sizeof(AGSDeviceInfo_520)}, + {5, 2, 1, sizeof(AGSDeviceInfo_520)}, + {5, 3, 0, sizeof(AGSDeviceInfo_520)}, + {5, 4, 0, sizeof(AGSDeviceInfo_540)}, + {5, 4, 1, sizeof(AGSDeviceInfo_541)}, }; +#define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name)}} +#define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ + -1}} +#define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, \ + -1, -1, offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name)}} + +#define DEVICE_FIELD_adapterString 0 +#define DEVICE_FIELD_architectureVersion 1 +#define DEVICE_FIELD_asicFamily 2 +#define DEVICE_FIELD_vendorId 3 +#define DEVICE_FIELD_deviceId 4 +#define DEVICE_FIELD_isPrimaryDevice 5 +#define DEVICE_FIELD_localMemoryInBytes 6 + +static const struct +{ + unsigned int field_index; + int offset[AMD_AGS_VERSION_COUNT]; +} +device_struct_fields[] = +{ + DEF_FIELD(adapterString), + DEF_FIELD_520_BELOW(architectureVersion), + DEF_FIELD_540_UP(asicFamily), + DEF_FIELD(vendorId), + DEF_FIELD(deviceId), + DEF_FIELD(isPrimaryDevice), + DEF_FIELD(localMemoryInBytes), +}; + +#undef DEF_FIELD + +#define GET_DEVICE_FIELD_ADDR(device, name, type, version) \ + (device_struct_fields[DEVICE_FIELD_##name].offset[version] == -1 ? NULL \ + : (type *)((BYTE *)device + device_struct_fields[DEVICE_FIELD_##name].offset[version])) + +#define SET_DEVICE_FIELD(device, name, type, version, value) { \ + type *addr; \ + if ((addr = GET_DEVICE_FIELD_ADDR(device, name, type, version))) \ + *addr = value; \ + } + struct AGSContext { enum amd_ags_version version; unsigned int device_count; - AGSDeviceInfo *devices; + struct AGSDeviceInfo *devices; VkPhysicalDeviceProperties *properties; VkPhysicalDeviceMemoryProperties *memory_properties; }; @@ -190,11 +238,11 @@ static enum amd_ags_version determine_ags_version(void) patch = info->dwFileVersionLS >> 16; TRACE("Found amd_ags_x64.dll v%d.%d.%d\n", major, minor, patch); - for (i = 0; i < ARRAY_SIZE(amd_ags_versions); i++) + for (i = 0; i < ARRAY_SIZE(amd_ags_info); i++) { - if ((major == amd_ags_versions[i].major) && - (minor == amd_ags_versions[i].minor) && - (patch == amd_ags_versions[i].patch)) + if ((major == amd_ags_info[i].major) && + (minor == amd_ags_info[i].minor) && + (patch == amd_ags_info[i].patch)) { ret = i; break; @@ -204,7 +252,7 @@ static enum amd_ags_version determine_ags_version(void) done: heap_free(infobuf); TRACE("Using AGS v%d.%d.%d interface\n", - amd_ags_versions[ret].major, amd_ags_versions[ret].minor, amd_ags_versions[ret].patch); + amd_ags_info[ret].major, amd_ags_info[ret].minor, amd_ags_info[ret].patch); return ret; } @@ -212,6 +260,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) { AGSReturnCode ret; unsigned int i, j; + BYTE *device; context->version = determine_ags_version(); context->device_count = 0; @@ -223,7 +272,9 @@ static AGSReturnCode init_ags_context(AGSContext *context) if (ret != AGS_SUCCESS || !context->device_count) return ret; - if (!(context->devices = heap_calloc(context->device_count, sizeof(*context->devices)))) + assert(context->version < AMD_AGS_VERSION_COUNT); + + if (!(context->devices = heap_calloc(context->device_count, amd_ags_info[context->version].device_size))) { WARN("Failed to allocate memory.\n"); heap_free(context->properties); @@ -231,11 +282,11 @@ static AGSReturnCode init_ags_context(AGSContext *context) return AGS_OUT_OF_MEMORY; } + device = (BYTE *)context->devices; for (i = 0; i < context->device_count; ++i) { const VkPhysicalDeviceProperties *vk_properties = &context->properties[i]; const VkPhysicalDeviceMemoryProperties *vk_memory_properties = &context->memory_properties[i]; - AGSDeviceInfo *device = &context->devices[i]; VkDeviceSize local_memory_size = 0; for (j = 0; j < vk_memory_properties->memoryHeapCount; j++) @@ -248,60 +299,19 @@ static AGSReturnCode init_ags_context(AGSContext *context) } TRACE("reporting local memory size 0x%s bytes\n", wine_dbgstr_longlong(local_memory_size)); - switch (context->version) + SET_DEVICE_FIELD(device, adapterString, const char *, context->version, vk_properties->deviceName); + SET_DEVICE_FIELD(device, vendorId, int, context->version, vk_properties->vendorID); + SET_DEVICE_FIELD(device, deviceId, int, context->version, vk_properties->deviceID); + if (vk_properties->vendorID == 0x1002) { - case AMD_AGS_VERSION_5_1_1: - device->agsDeviceInfo511.adapterString = vk_properties->deviceName; - device->agsDeviceInfo511.vendorId = vk_properties->vendorID; - device->agsDeviceInfo511.deviceId = vk_properties->deviceID; - device->agsDeviceInfo511.localMemoryInBytes = local_memory_size; - - if (device->agsDeviceInfo511.vendorId == 0x1002) - device->agsDeviceInfo511.architectureVersion = ArchitectureVersion_GCN; - - if (!i) - device->agsDeviceInfo511.isPrimaryDevice = 1; - break; - case AMD_AGS_VERSION_5_2_0: - case AMD_AGS_VERSION_5_2_1: - case AMD_AGS_VERSION_5_3_0: - device->agsDeviceInfo520.adapterString = vk_properties->deviceName; - device->agsDeviceInfo520.vendorId = vk_properties->vendorID; - device->agsDeviceInfo520.deviceId = vk_properties->deviceID; - device->agsDeviceInfo520.localMemoryInBytes = local_memory_size; - - if (device->agsDeviceInfo520.vendorId == 0x1002) - device->agsDeviceInfo520.architectureVersion = ArchitectureVersion_GCN; - - if (!i) - device->agsDeviceInfo520.isPrimaryDevice = 1; - break; - case AMD_AGS_VERSION_5_4_0: - device->agsDeviceInfo540.adapterString = vk_properties->deviceName; - device->agsDeviceInfo540.vendorId = vk_properties->vendorID; - device->agsDeviceInfo540.deviceId = vk_properties->deviceID; - device->agsDeviceInfo540.localMemoryInBytes = local_memory_size; - - if (device->agsDeviceInfo540.vendorId == 0x1002) - device->agsDeviceInfo540.asicFamily = AsicFamily_GCN4; - - if (!i) - device->agsDeviceInfo540.isPrimaryDevice = 1; - break; - case AMD_AGS_VERSION_5_4_1: - default: - device->agsDeviceInfo541.adapterString = vk_properties->deviceName; - device->agsDeviceInfo541.vendorId = vk_properties->vendorID; - device->agsDeviceInfo541.deviceId = vk_properties->deviceID; - device->agsDeviceInfo541.localMemoryInBytes = local_memory_size; - - if (device->agsDeviceInfo541.vendorId == 0x1002) - device->agsDeviceInfo541.asicFamily = AsicFamily_GCN4; - - if (!i) - device->agsDeviceInfo541.isPrimaryDevice = 1; - break; + SET_DEVICE_FIELD(device, architectureVersion, ArchitectureVersion, context->version, ArchitectureVersion_GCN); + SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, AsicFamily_GCN4); } + SET_DEVICE_FIELD(device, localMemoryInBytes, ULONG64, context->version, local_memory_size); + if (!i) + SET_DEVICE_FIELD(device, isPrimaryDevice, int, context->version, 1); + + device += amd_ags_info[context->version].device_size; } return AGS_SUCCESS; @@ -330,9 +340,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi } memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->agsVersionMajor = amd_ags_versions[object->version].major; - gpu_info->agsVersionMinor = amd_ags_versions[object->version].minor; - gpu_info->agsVersionPatch = amd_ags_versions[object->version].patch; + gpu_info->agsVersionMajor = amd_ags_info[object->version].major; + gpu_info->agsVersionMinor = amd_ags_info[object->version].minor; + gpu_info->agsVersionPatch = amd_ags_info[object->version].patch; gpu_info->driverVersion = "20.20.2-180516a-328911C-RadeonSoftwareAdrenalin"; gpu_info->radeonSoftwareVersion = "20.20.2"; gpu_info->numDevices = object->device_count; From 691036be0e5fb2a996bb618b9cbe97895b1e757c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 19:33:36 +0300 Subject: [PATCH 0607/1506] amd_ags_x64: Fill display info in AGS context. For Forza Horizon 4. --- dlls/amd_ags_x64/Makefile.in | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 130 +++++++++++++++++++++++++++- 2 files changed, 130 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in index 5cd98895ff6..74253dcf5fd 100644 --- a/dlls/amd_ags_x64/Makefile.in +++ b/dlls/amd_ags_x64/Makefile.in @@ -1,6 +1,6 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = amd_ags_x64.dll -IMPORTS = version vulkan-1 +IMPORTS = version vulkan-1 user32 IMPORTLIB = amd_ags_x64 EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 1669f08fae7..0b56fdf477c 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -62,6 +62,8 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = #define DEVICE_FIELD_deviceId 4 #define DEVICE_FIELD_isPrimaryDevice 5 #define DEVICE_FIELD_localMemoryInBytes 6 +#define DEVICE_FIELD_numDisplays 7 +#define DEVICE_FIELD_displays 8 static const struct { @@ -77,6 +79,8 @@ device_struct_fields[] = DEF_FIELD(deviceId), DEF_FIELD(isPrimaryDevice), DEF_FIELD(localMemoryInBytes), + DEF_FIELD(numDisplays), + DEF_FIELD(displays), }; #undef DEF_FIELD @@ -256,6 +260,116 @@ static enum amd_ags_version determine_ags_version(void) return ret; } +struct monitor_enum_context +{ + const char *adapter_name; + AGSDisplayInfo **ret_displays; + int *ret_display_count; +}; + +static BOOL WINAPI monitor_enum_proc(HMONITOR hmonitor, HDC hdc, RECT *rect, LPARAM context) +{ + struct monitor_enum_context *c = (struct monitor_enum_context *)context; + MONITORINFOEXA monitor_info; + AGSDisplayInfo *new_alloc; + DISPLAY_DEVICEA device; + AGSDisplayInfo *info; + unsigned int i, mode; + DEVMODEA dev_mode; + + + monitor_info.cbSize = sizeof(monitor_info); + GetMonitorInfoA(hmonitor, (MONITORINFO *)&monitor_info); + TRACE("monitor_info.szDevice %s.\n", debugstr_a(monitor_info.szDevice)); + + device.cb = sizeof(device); + i = 0; + while (EnumDisplayDevicesA(NULL, i, &device, 0)) + { + TRACE("device.DeviceName %s, device.DeviceString %s.\n", debugstr_a(device.DeviceName), debugstr_a(device.DeviceString)); + ++i; + if (strcmp(device.DeviceString, c->adapter_name) || strcmp(device.DeviceName, monitor_info.szDevice)) + continue; + + if (*c->ret_display_count) + { + if (!(new_alloc = heap_realloc(*c->ret_displays, sizeof(*new_alloc) * (*c->ret_display_count + 1)))) + { + ERR("No memory."); + return FALSE; + } + *c->ret_displays = new_alloc; + } + else if (!(*c->ret_displays = heap_alloc(sizeof(**c->ret_displays)))) + { + ERR("No memory."); + return FALSE; + } + info = &(*c->ret_displays)[*c->ret_display_count]; + memset(info, 0, sizeof(*info)); + strcpy(info->displayDeviceName, device.DeviceName); + if (EnumDisplayDevicesA(info->displayDeviceName, 0, &device, 0)) + { + strcpy(info->name, device.DeviceString); + } + else + { + ERR("Could not get monitor name for device %s.\n", debugstr_a(info->displayDeviceName)); + strcpy(info->name, "Unknown"); + } + if (monitor_info.dwFlags & MONITORINFOF_PRIMARY) + info->displayFlags |= AGS_DISPLAYFLAG_PRIMARY_DISPLAY; + + mode = 0; + memset(&dev_mode, 0, sizeof(dev_mode)); + dev_mode.dmSize = sizeof(dev_mode); + while (EnumDisplaySettingsExA(monitor_info.szDevice, mode, &dev_mode, EDS_RAWMODE)) + { + ++mode; + if (dev_mode.dmPelsWidth > info->maxResolutionX) + info->maxResolutionX = dev_mode.dmPelsWidth; + if (dev_mode.dmPelsHeight > info->maxResolutionY) + info->maxResolutionY = dev_mode.dmPelsHeight; + if (dev_mode.dmDisplayFrequency > info->maxRefreshRate) + info->maxRefreshRate = dev_mode.dmDisplayFrequency; + memset(&dev_mode, 0, sizeof(dev_mode)); + dev_mode.dmSize = sizeof(dev_mode); + } + + info->currentResolution.offsetX = monitor_info.rcMonitor.left; + info->currentResolution.offsetY = monitor_info.rcMonitor.top; + info->currentResolution.width = monitor_info.rcMonitor.right - monitor_info.rcMonitor.left; + info->currentResolution.height = monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top; + info->visibleResolution = info->currentResolution; + + memset(&dev_mode, 0, sizeof(dev_mode)); + dev_mode.dmSize = sizeof(dev_mode); + + if (EnumDisplaySettingsExA(monitor_info.szDevice, ENUM_CURRENT_SETTINGS, &dev_mode, EDS_RAWMODE)) + info->currentRefreshRate = dev_mode.dmDisplayFrequency; + else + ERR("Could not get current display settings.\n"); + ++*c->ret_display_count; + + TRACE("Added display %s for %s.\n", debugstr_a(monitor_info.szDevice), debugstr_a(c->adapter_name)); + } + + return TRUE; +} + +static void init_device_displays(const char *adapter_name, AGSDisplayInfo **ret_displays, int *ret_display_count) +{ + struct monitor_enum_context context; + + TRACE("adapter_name %s.\n", debugstr_a(adapter_name)); + + context.adapter_name = adapter_name; + context.ret_displays = ret_displays; + context.ret_display_count = ret_display_count; + + EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, (LPARAM)&context); +} + static AGSReturnCode init_ags_context(AGSContext *context) { AGSReturnCode ret; @@ -297,7 +411,8 @@ static AGSReturnCode init_ags_context(AGSContext *context) break; } } - TRACE("reporting local memory size 0x%s bytes\n", wine_dbgstr_longlong(local_memory_size)); + TRACE("device %s, %04x:%04x, reporting local memory size 0x%s bytes\n", debugstr_a(vk_properties->deviceName), + vk_properties->vendorID, vk_properties->deviceID, wine_dbgstr_longlong(local_memory_size)); SET_DEVICE_FIELD(device, adapterString, const char *, context->version, vk_properties->deviceName); SET_DEVICE_FIELD(device, vendorId, int, context->version, vk_properties->vendorID); @@ -311,6 +426,10 @@ static AGSReturnCode init_ags_context(AGSContext *context) if (!i) SET_DEVICE_FIELD(device, isPrimaryDevice, int, context->version, 1); + init_device_displays(vk_properties->deviceName, + GET_DEVICE_FIELD_ADDR(device, displays, AGSDisplayInfo *, context->version), + GET_DEVICE_FIELD_ADDR(device, numDisplays, int, context->version)); + device += amd_ags_info[context->version].device_size; } @@ -357,12 +476,21 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi AGSReturnCode WINAPI agsDeInit(AGSContext *context) { + unsigned int i; + BYTE *device; + TRACE("context %p.\n", context); if (context) { heap_free(context->memory_properties); heap_free(context->properties); + device = (BYTE *)context->devices; + for (i = 0; i < context->device_count; ++i) + { + heap_free(*GET_DEVICE_FIELD_ADDR(device, displays, AGSDisplayInfo *, context->version)); + device += amd_ags_info[context->version].device_size; + } heap_free(context->devices); heap_free(context); } From 4b6eaa0fe9c6c0a0335f7d7aa00a61f63831252a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 20:03:12 +0300 Subject: [PATCH 0608/1506] amd_ags_x64: Bump driver version. For Forza Horizon 4. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 0b56fdf477c..3a4dafa7a3a 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -462,8 +462,8 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi gpu_info->agsVersionMajor = amd_ags_info[object->version].major; gpu_info->agsVersionMinor = amd_ags_info[object->version].minor; gpu_info->agsVersionPatch = amd_ags_info[object->version].patch; - gpu_info->driverVersion = "20.20.2-180516a-328911C-RadeonSoftwareAdrenalin"; - gpu_info->radeonSoftwareVersion = "20.20.2"; + gpu_info->driverVersion = "20.50.03.05-210326a-365573E-RadeonSoftwareAdrenalin2020"; + gpu_info->radeonSoftwareVersion = "21.3.2"; gpu_info->numDevices = object->device_count; gpu_info->devices = object->devices; From 2cf11633567169f397db77d739d445f6e3306c08 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 8 May 2021 04:39:30 +0100 Subject: [PATCH 0609/1506] amd_ags_x64: Implement agsDriverExtensionsDX12_DestroyDevice Signed-off-by: Joshua Ashton --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 7551a9346d8..ae825462f28 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -32,7 +32,7 @@ @ stub agsDriverExtensionsDX12_CreateFromDevice @ stub agsDriverExtensionsDX12_DeInit @ stub agsDriverExtensionsDX12_Destroy -@ stub agsDriverExtensionsDX12_DestroyDevice +@ stdcall agsDriverExtensionsDX12_DestroyDevice(ptr ptr ptr) @ stub agsDriverExtensionsDX12_Init @ stub agsDriverExtensionsDX12_PopMarker @ stub agsDriverExtensionsDX12_PushMarker diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 3a4dafa7a3a..81942e4041e 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -9,6 +9,7 @@ #include "wine/vulkan.h" +#define COBJMACROS #include "d3d11.h" #include "d3d12.h" @@ -537,6 +538,20 @@ AGSReturnCode WINAPI agsDriverExtensionsDX12_CreateDevice(AGSContext *context, return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensionsDX12_DestroyDevice(AGSContext* context, ID3D12Device* device, unsigned int* device_refs) +{ + ULONG ref_count; + + if (!device) + return AGS_SUCCESS; + + ref_count = ID3D12Device_Release(device); + if (device_refs) + *device_refs = (unsigned int)ref_count; + + return AGS_SUCCESS; +} + AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported, unsigned int version_required) { FIXME("version_reported %s, version_required %d semi-stub.\n", debugstr_a(version_reported), version_required); From 4e1489b3ee955290cdafc7cb18704aa5645b609e Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 8 May 2021 04:41:40 +0100 Subject: [PATCH 0610/1506] amd_ags_x64: Implement AGS 5.4.2 Signed-off-by: Joshua Ashton --- dlls/amd_ags_x64/amd_ags.h | 46 ++++++++++++++++++++++++++++- dlls/amd_ags_x64/amd_ags_x64_main.c | 8 +++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 47ed5b91a14..0656e3fbbb3 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -34,6 +34,13 @@ /// \endinternal /// /// --------------------------------------- +/// What's new in AGS 5.4.2 since version 5.4.1 +/// --------------------------------------- +/// AGS 5.4.2 includes the following updates: +/// * sharedMemoryInBytes has been reinstated. +/// * Clock speed returned for APUs. +/// +/// --------------------------------------- /// What's new in AGS 5.4.1 since version 5.4.0 /// --------------------------------------- /// AGS 5.4.1 includes the following updates: @@ -130,7 +137,7 @@ #define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version #define AMD_AGS_VERSION_MINOR 4 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version +#define AMD_AGS_VERSION_PATCH 2 ///< AGS patch version #ifdef __cplusplus extern "C" { @@ -498,6 +505,43 @@ typedef struct AGSDeviceInfo_541 int adlAdapterIndex; ///< Internally used index into the ADL list of adapters } AGSDeviceInfo_541; +/// The device info struct used to describe a physical GPU enumerated by AGS +typedef struct AGSDeviceInfo_542 +{ + const char* adapterString; ///< The adapter name string + AsicFamily asicFamily; ///< Set to Unknown if not AMD hardware + int isAPU; ///< Whether or not this is an APU + int vendorId; ///< The vendor id + int deviceId; ///< The device id + int revisionId; ///< The revision id + + int numCUs; ///< Number of compute units. + int numWGPs; ///< Number of RDNA Work Group Processors. Only valid if ASIC is RDNA onwards. + + int numROPs; ///< Number of ROPs + int coreClock; ///< Core clock speed at 100% power in MHz + int memoryClock; ///< Memory clock speed at 100% power in MHz + int memoryBandwidth; ///< Memory bandwidth in MB/s + float teraFlops; ///< Teraflops of GPU. Zero if not GCN onwards. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD + + int isPrimaryDevice; ///< Whether or not this is the primary adapter in the system. Not set on the WACK version. + unsigned long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. + unsigned long long sharedMemoryInBytes; ///< The size of system memory available to the GPU in bytes. It is important to factor this into your VRAM budget for APUs + ///< as the reported local memory will only be a small fraction of the total memory available to the GPU. + + int numDisplays; ///< The number of active displays found to be attached to this adapter. + AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + + int eyefinityEnabled; ///< Indicates if Eyefinity is active + int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface. + int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface. + int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. + + int adlAdapterIndex; ///< Internally used index into the ADL list of adapters +} AGSDeviceInfo_542; + struct AGSDeviceInfo; /// \defgroup general General API functions diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 81942e4041e..750401a845e 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -25,6 +25,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_3_0, AMD_AGS_VERSION_5_4_0, AMD_AGS_VERSION_5_4_1, + AMD_AGS_VERSION_5_4_2, AMD_AGS_VERSION_COUNT }; @@ -44,17 +45,18 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {5, 3, 0, sizeof(AGSDeviceInfo_520)}, {5, 4, 0, sizeof(AGSDeviceInfo_540)}, {5, 4, 1, sizeof(AGSDeviceInfo_541)}, + {5, 4, 2, sizeof(AGSDeviceInfo_542)}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name)}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name)}} #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ - -1}} + -1, -1}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name)}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name)}} #define DEVICE_FIELD_adapterString 0 #define DEVICE_FIELD_architectureVersion 1 From 06c8474bc77ecabdb5656a4af7168c05bc221875 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 8 May 2021 05:14:39 +0100 Subject: [PATCH 0611/1506] amd_ags_x64: Implement AGS 6.0.0 Signed-off-by: Joshua Ashton --- dlls/amd_ags_x64/amd_ags.h | 409 +++++++++++++++++++++++----- dlls/amd_ags_x64/amd_ags_x64.spec | 3 + dlls/amd_ags_x64/amd_ags_x64_main.c | 137 ++++++++-- 3 files changed, 468 insertions(+), 81 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 0656e3fbbb3..af9c48c1dd5 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -34,6 +34,20 @@ /// \endinternal /// /// --------------------------------------- +/// What's new in AGS 6.0 since version 5.4.2 +/// --------------------------------------- +/// AGS 6.0 includes the following updates: +/// * DX12 ray tracing hit token for RDNA2 hardware. +/// * Shader intrinsic that exposes ReadLaneAt in DX12. +/// * Shader intrinsics that expose explicit float conversions in DX12. +/// * Refactored and revised API to minimize user error. +/// * Added agsGetVersionNumber. +/// * Detection for external GPUs. +/// * Detection of RDNA2 architecture. +/// * Grouped the more established intrinsics together into per year support. +/// * Function pointer typedefs for the API +/// +/// --------------------------------------- /// What's new in AGS 5.4.2 since version 5.4.1 /// --------------------------------------- /// AGS 5.4.2 includes the following updates: @@ -128,16 +142,16 @@ /// * Include the amd_ags.h header file from your source code. /// * Include the AGS hlsl files if you are using the shader intrinsics. /// * Declare a pointer to an AGSContext and make this available for all subsequent calls to AGS. -/// * On game initialization, call \ref agsInit passing in the address of the context. On success, this function will return a valid context pointer. +/// * On game initialization, call \ref agsInitialize passing in the address of the context. On success, this function will return a valid context pointer. /// -/// Don't forget to cleanup AGS by calling \ref agsDeInit when the app exits, after the device has been destroyed. +/// Don't forget to cleanup AGS by calling \ref agsDeInitialize when the app exits, after the device has been destroyed. #ifndef AMD_AGS_H #define AMD_AGS_H -#define AMD_AGS_VERSION_MAJOR 5 ///< AGS major version -#define AMD_AGS_VERSION_MINOR 4 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 2 ///< AGS patch version +#define AMD_AGS_VERSION_MAJOR 6 ///< AGS major version +#define AMD_AGS_VERSION_MINOR 0 ///< AGS minor version +#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version #ifdef __cplusplus extern "C" { @@ -151,14 +165,17 @@ extern "C" { #define AGS_UNSPECIFIED_VERSION 0xFFFFAD00 ///< Use this to specify no version /// @} -// Forward declaration of D3D11 types +// Forward declaration of D3D and DXGI types struct IDXGIAdapter; +struct IDXGISwapChain; +struct DXGI_SWAP_CHAIN_DESC; enum D3D_DRIVER_TYPE; enum D3D_FEATURE_LEVEL; -struct DXGI_SWAP_CHAIN_DESC; + enum D3D_PRIMITIVE_TOPOLOGY; + +// Forward declaration of D3D11 types struct ID3D11Device; struct ID3D11DeviceContext; -struct IDXGISwapChain; struct ID3D11Resource; struct ID3D11Buffer; struct ID3D11Texture1D; @@ -253,14 +270,6 @@ typedef enum AGSDriverExtensionDX12 /// The space id for DirectX12 intrinsic support const unsigned int AGS_DX12_SHADER_INSTRINSICS_SPACE_ID = 0x7FFF0ADE; // 2147420894 - -/// Additional topologies supported via extensions -typedef enum AGSPrimitiveTopology -{ - AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, ///< Quad list - AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 ///< Screen rect list -} AGSPrimitiveTopology; - /// The display flags describing various properties of the display. typedef enum AGSDisplayFlags { @@ -282,7 +291,7 @@ typedef enum AGSDisplaySettingsFlags /// @} -typedef struct AGSContext AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInit +typedef struct AGSContext AGSContext; ///< All function calls in AGS require a pointer to a context. This is generated via \ref agsInitialize /// The rectangle struct used by AGS. typedef struct AGSRect @@ -293,25 +302,64 @@ typedef struct AGSRect int height; ///< Height of rectangle } AGSRect; -/// The clip rectangle struct used by \ref agsDriverExtensionsDX11_SetClipRects -typedef struct AGSClipRect +/// The display info struct used to describe a display enumerated by AGS +typedef struct AGSDisplayInfo_511 { - /// The inclusion mode for the rect - enum - { - ClipRectIncluded = 0, ///< Include the rect - ClipRectExcluded = 1 ///< Exclude the rect - } mode; ; ///< Include/exclude rect region - AGSRect rect; ///< The rect to include/exclude -} AGSClipRect; + char name[ 256 ]; ///< The name of the display + char displayDeviceName[ 32 ]; ///< The display device name, i.e. DISPLAY_DEVICE::DeviceName + + unsigned int displayFlags; ///< Bitfield of \ref AGSDisplayFlags + + int maxResolutionX; ///< The maximum supported resolution of the unrotated display + int maxResolutionY; ///< The maximum supported resolution of the unrotated display + float maxRefreshRate; ///< The maximum supported refresh rate of the display + + AGSRect currentResolution; ///< The current resolution and position in the desktop, ignoring Eyefinity bezel compensation + AGSRect visibleResolution; ///< The visible resolution and position. When Eyefinity bezel compensation is enabled this will + ///< be the sub region in the Eyefinity single large surface (SLS) + float currentRefreshRate; ///< The current refresh rate + + int eyefinityGridCoordX; ///< The X coordinate in the Eyefinity grid. -1 if not in an Eyefinity group + int eyefinityGridCoordY; ///< The Y coordinate in the Eyefinity grid. -1 if not in an Eyefinity group + + double chromaticityRedX; ///< Red display primary X coord + double chromaticityRedY; ///< Red display primary Y coord + + double chromaticityGreenX; ///< Green display primary X coord + double chromaticityGreenY; ///< Green display primary Y coord + + double chromaticityBlueX; ///< Blue display primary X coord + double chromaticityBlueY; ///< Blue display primary Y coord + + double chromaticityWhitePointX; ///< White point X coord + double chromaticityWhitePointY; ///< White point Y coord + + double screenDiffuseReflectance; ///< Percentage expressed between 0 - 1 + double screenSpecularReflectance; ///< Percentage expressed between 0 - 1 + + double minLuminance; ///< The minimum luminance of the display in nits + double maxLuminance; ///< The maximum luminance of the display in nits + double avgLuminance; ///< The average luminance of the display in nits + + int logicalDisplayIndex; ///< The internally used index of this display + int adlAdapterIndex; ///< The internally used ADL adapter index +} AGSDisplayInfo_511; /// The display info struct used to describe a display enumerated by AGS -typedef struct AGSDisplayInfo +typedef struct AGSDisplayInfo_600 { char name[ 256 ]; ///< The name of the display char displayDeviceName[ 32 ]; ///< The display device name, i.e. DISPLAY_DEVICE::DeviceName - unsigned int displayFlags; ///< Bitfield of \ref AGSDisplayFlags + unsigned int isPrimaryDisplay : 1; ///< Whether this display is marked as the primary display + unsigned int HDR10 : 1; ///< HDR10 is supported on this display + unsigned int dolbyVision : 1; ///< Dolby Vision is supported on this display + unsigned int freesync : 1; ///< Freesync is supported on this display + unsigned int freesyncHDR : 1; ///< Freesync HDR is supported on this display + unsigned int eyefinityInGroup : 1; ///< The display is part of the Eyefinity group + unsigned int eyefinityPreferredDisplay : 1; ///< The display is the preferred display in the Eyefinity group for displaying the UI + unsigned int eyefinityInPortraitMode : 1; ///< The display is in the Eyefinity group but in portrait mode + unsigned int reservedPadding : 24; ///< Reserved for future use int maxResolutionX; ///< The maximum supported resolution of the unrotated display int maxResolutionY; ///< The maximum supported resolution of the unrotated display @@ -346,7 +394,8 @@ typedef struct AGSDisplayInfo int logicalDisplayIndex; ///< The internally used index of this display int adlAdapterIndex; ///< The internally used ADL adapter index -} AGSDisplayInfo; + int reserved; ///< reserved field +} AGSDisplayInfo_600; /// The architecture version typedef enum ArchitectureVersion @@ -367,6 +416,7 @@ typedef enum AsicFamily AsicFamily_GCN4, ///< AMD GCN 4 architecture: Polaris. AsicFamily_Vega, ///< AMD Vega architecture, including Raven Ridge (ie AMD Ryzen CPU + AMD Vega GPU). AsicFamily_RDNA, ///< AMD RDNA architecture + AsicFamily_RDNA2, ///< AMD RDNA2 architecture AsicFamily_Count ///< Number of enumerated ASIC families } AsicFamily; @@ -389,7 +439,7 @@ typedef struct AGSDeviceInfo_511 long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. int numDisplays; ///< The number of active displays found to be attached to this adapter. - AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + AGSDisplayInfo_511* displays; ///< List of displays allocated by AGS to be numDisplays in length. int eyefinityEnabled; ///< Indicates if Eyefinity is active int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. @@ -421,7 +471,7 @@ typedef struct AGSDeviceInfo_520 long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. int numDisplays; ///< The number of active displays found to be attached to this adapter. - AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + AGSDisplayInfo_511* displays; ///< List of displays allocated by AGS to be numDisplays in length. int eyefinityEnabled; ///< Indicates if Eyefinity is active int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. @@ -458,7 +508,7 @@ typedef struct AGSDeviceInfo_540 ///< as the reported local memory will only be a small fraction of the total memory available to the GPU. int numDisplays; ///< The number of active displays found to be attached to this adapter. - AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + AGSDisplayInfo_511* displays; ///< List of displays allocated by AGS to be numDisplays in length. int eyefinityEnabled; ///< Indicates if Eyefinity is active int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. @@ -493,7 +543,7 @@ typedef struct AGSDeviceInfo_541 long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. int numDisplays; ///< The number of active displays found to be attached to this adapter. - AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + AGSDisplayInfo_511* displays; ///< List of displays allocated by AGS to be numDisplays in length. int eyefinityEnabled; ///< Indicates if Eyefinity is active int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. @@ -530,7 +580,7 @@ typedef struct AGSDeviceInfo_542 ///< as the reported local memory will only be a small fraction of the total memory available to the GPU. int numDisplays; ///< The number of active displays found to be attached to this adapter. - AGSDisplayInfo* displays; ///< List of displays allocated by AGS to be numDisplays in length. + AGSDisplayInfo_511* displays; ///< List of displays allocated by AGS to be numDisplays in length. int eyefinityEnabled; ///< Indicates if Eyefinity is active int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. @@ -542,6 +592,47 @@ typedef struct AGSDeviceInfo_542 int adlAdapterIndex; ///< Internally used index into the ADL list of adapters } AGSDeviceInfo_542; +/// The device info struct used to describe a physical GPU enumerated by AGS +typedef struct AGSDeviceInfo_600 +{ + const char* adapterString; ///< The adapter name string + AsicFamily asicFamily; ///< Set to Unknown if not AMD hardware + unsigned int isAPU : 1; ///< Whether this device is an APU + unsigned int isPrimaryDevice : 1; ///< Whether this device is marked as the primary device + unsigned int isExternal :1; ///< Whether this device is a detachable, external device + unsigned int reservedPadding : 29; ///< Reserved for future use + + int vendorId; ///< The vendor id + int deviceId; ///< The device id + int revisionId; ///< The revision id + + int numCUs; ///< Number of compute units + int numWGPs; ///< Number of RDNA Work Group Processors. Only valid if ASIC is RDNA onwards. + + int numROPs; ///< Number of ROPs + int coreClock; ///< Core clock speed at 100% power in MHz + int memoryClock; ///< Memory clock speed at 100% power in MHz + int memoryBandwidth; ///< Memory bandwidth in MB/s + float teraFlops; ///< Teraflops of GPU. Zero if not GCN onwards. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD + + unsigned long long localMemoryInBytes; ///< The size of local memory in bytes. 0 for non AMD hardware. + unsigned long long sharedMemoryInBytes; ///< The size of system memory available to the GPU in bytes. It is important to factor this into your VRAM budget for APUs + ///< as the reported local memory will only be a small fraction of the total memory available to the GPU. + + int numDisplays; ///< The number of active displays found to be attached to this adapter. + AGSDisplayInfo_600* displays; ///< List of displays allocated by AGS to be numDisplays in length. + + int eyefinityEnabled; ///< Indicates if Eyefinity is active + int eyefinityGridWidth; ///< Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityGridHeight; ///< Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + int eyefinityResolutionX; ///< Contains width in pixels of the multi-monitor Single Large Surface. + int eyefinityResolutionY; ///< Contains height in pixels of the multi-monitor Single Large Surface. + int eyefinityBezelCompensated; ///< Indicates if bezel compensation is used for the current SLS display area. 1 if enabled, and 0 if disabled. + + int adlAdapterIndex; ///< Internally used index into the ADL list of adapters + int reserved; ///< reserved field +} AGSDeviceInfo_600; + struct AGSDeviceInfo; /// \defgroup general General API functions @@ -552,7 +643,7 @@ typedef void* (__stdcall *AGS_ALLOC_CALLBACK_511)( int allocationSize ); ///< typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( size_t allocationSize ); ///< AGS user defined allocation prototype typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype -/// The configuration options that can be passed in to \ref agsInit +/// The configuration options that can be passed in to \ref agsInititalize typedef struct AGSConfiguration_511 { AGS_ALLOC_CALLBACK_511 allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used @@ -571,8 +662,8 @@ typedef union AGSConfiguration AGSConfiguration_520 agsConfiguration520; } AGSConfiguration; -/// The top level GPU information returned from \ref agsInit -typedef struct AGSGPUInfo +/// The top level GPU information returned from \ref agsInitialize +typedef struct AGSGPUInfo_511 { int agsVersionMajor; ///< Major field of Major.Minor.Patch AGS version number int agsVersionMinor; ///< Minor field of Major.Minor.Patch AGS version number @@ -584,24 +675,35 @@ typedef struct AGSGPUInfo int numDevices; ///< Number of GPUs in the system struct AGSDeviceInfo* devices; ///< List of GPUs in the system -} AGSGPUInfo; +} AGSGPUInfo_511; -/// The struct to specify the display settings to the driver. -typedef struct AGSDisplaySettings +/// The top level GPU information returned from \ref agsInit +typedef struct AGSGPUInfo_600 { - /// The display mode - enum - { - Mode_SDR, ///< SDR mode - Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. - Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. - Mode_FreesyncHDR_scRGB, ///< Freesync HDR scRGB, requiring an FP16 swapchain. A value of 1.0 == 80 nits. - // Mode_FreesyncHDR_Gamma22 ADDED IN 5.3.0 - Mode_FreesyncHDR_Gamma22, ///< Freesync HDR Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. - Mode_DolbyVision, ///< Dolby Vision, requiring an 8888 UNORM swapchain + const char* driverVersion; ///< The AMD driver package version + const char* radeonSoftwareVersion; ///< The Radeon Software Version + + int numDevices; ///< Number of GPUs in the system + struct AGSDeviceInfo* devices; ///< List of GPUs in the system +} AGSGPUInfo_600; - Mode_Count ///< Number of enumerated display modes - } mode; ///< The display mode to set the display into +/// The display mode +typedef enum AGSDisplaySettings_Mode +{ + Mode_SDR, ///< SDR mode + Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. + Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. + Mode_FreesyncHDR_scRGB, ///< Freesync HDR scRGB, requiring an FP16 swapchain. A value of 1.0 == 80 nits. + Mode_FreesyncHDR_Gamma22, ///< Freesync HDR Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. + Mode_DolbyVision, ///< Dolby Vision, requiring an 8888 UNORM swapchain + + Mode_Count ///< Number of enumerated display modes +} AGSDisplaySettings_Mode; + +/// The struct to specify the display settings to the driver. +typedef struct AGSDisplaySettings_511 +{ + AGSDisplaySettings_Mode mode; ///< The display mode to set the display into double chromaticityRedX; ///< Red display primary X coord double chromaticityRedY; ///< Red display primary Y coord @@ -623,6 +725,39 @@ typedef struct AGSDisplaySettings // ADDED IN 5.2.0 int flags; ///< Bitfield of ::AGSDisplaySettingsFlags +} AGSDisplaySettings_511; + +/// The struct to specify the display settings to the driver. +typedef struct AGSDisplaySettings_600 +{ + AGSDisplaySettings_Mode mode; ///< The display mode to set the display into + + double chromaticityRedX; ///< Red display primary X coord + double chromaticityRedY; ///< Red display primary Y coord + + double chromaticityGreenX; ///< Green display primary X coord + double chromaticityGreenY; ///< Green display primary Y coord + + double chromaticityBlueX; ///< Blue display primary X coord + double chromaticityBlueY; ///< Blue display primary Y coord + + double chromaticityWhitePointX; ///< White point X coord + double chromaticityWhitePointY; ///< White point Y coord + + double minLuminance; ///< The minimum scene luminance in nits + double maxLuminance; ///< The maximum scene luminance in nits + + double maxContentLightLevel; ///< The maximum content light level in nits (MaxCLL) + double maxFrameAverageLightLevel; ///< The maximum frame average light level in nits (MaxFALL) + + unsigned int disableLocalDimming : 1; ///< Disables local dimming if possible + unsigned int reservedPadding : 31; ///< Reserved +} AGSDisplaySettings_600; + +typedef union AGSDisplaySettings +{ + AGSDisplaySettings_511 agsDisplaySettings511; + AGSDisplaySettings_600 agsDisplaySettings600; } AGSDisplaySettings; /// The result returned from \ref agsCheckDriverVersion @@ -642,6 +777,12 @@ typedef enum AGSDriverVersionResult /// AMD_AGS_API AGSDriverVersionResult agsCheckDriverVersion( const char* radeonSoftwareVersionReported, unsigned int radeonSoftwareVersionRequired ); +/// +/// Function to return the AGS version number. +/// +/// \return The version number made using AGS_MAKE_VERSION( AMD_AGS_VERSION_MAJOR, AMD_AGS_VERSION_MINOR, AMD_AGS_VERSION_PATCH ). +/// +AMD_AGS_API int agsGetVersionNumber( void ); /// /// Function used to initialize the AGS library. @@ -656,7 +797,23 @@ AMD_AGS_API AGSDriverVersionResult agsCheckDriverVersion( const char* radeonSoft /// \param [in] config Optional pointer to a AGSConfiguration struct to override the default library configuration. /// \param [out] gpuInfo Optional pointer to a AGSGPUInfo struct which will get filled in for all the GPUs in the system. /// -AMD_AGS_API AGSReturnCode agsInit( AGSContext** context, const AGSConfiguration* config, AGSGPUInfo* gpuInfo ); +AMD_AGS_API AGSReturnCode agsInit( AGSContext** context, const AGSConfiguration* config, AGSGPUInfo_511* gpuInfo ); + +/// +/// Function used to initialize the AGS library. +/// agsVersion must be specified as AGS_MAKE_VERSION( AMD_AGS_VERSION_MAJOR, AMD_AGS_VERSION_MINOR, AMD_AGS_VERSION_PATCH ) or the call will return \ref AGS_INVALID_ARGS. +/// Must be called prior to any of the subsequent AGS API calls. +/// Must be called prior to ID3D11Device or ID3D12Device creation. +/// \note The caller of this function should handle the possibility of the call failing in the cases below. One option is to do a vendor id check and only call \ref agsInitialize if there is an AMD GPU present. +/// \note This function will fail with \ref AGS_NO_AMD_DRIVER_INSTALLED if there is no AMD driver found on the system. +/// \note This function will fail with \ref AGS_LEGACY_DRIVER in Catalyst versions before 12.20. +/// +/// \param [in] agsVersion The API version specified using the \ref AGS_MAKE_VERSION macro. If this does not match the version in the binary this initialization call will fail. +/// \param [in] config Optional pointer to a AGSConfiguration struct to override the default library configuration. +/// \param [out] context Address of a pointer to a context. This function allocates a context on the heap which is then required for all subsequent API calls. +/// \param [out] gpuInfo Optional pointer to a AGSGPUInfo struct which will get filled in for all the GPUs in the system. +/// +AMD_AGS_API AGSReturnCode agsInitialize( int agsVersion, const AGSConfiguration* config, AGSContext** context, AGSGPUInfo_600* gpuInfo ); /// /// Function used to clean up the AGS library. @@ -665,6 +822,13 @@ AMD_AGS_API AGSReturnCode agsInit( AGSContext** context, const AGSConfiguration* /// AMD_AGS_API AGSReturnCode agsDeInit( AGSContext* context ); +/// +/// Function used to clean up the AGS library. +/// +/// \param [in] context Pointer to a context. This function will deallocate the context from the heap. +/// +AMD_AGS_API AGSReturnCode agsDeInitialize( AGSContext* context ); + /// /// Function used to query the number of GPUs used for Crossfire acceleration. /// This may be different from the total number of GPUs present in the system. @@ -685,7 +849,7 @@ AMD_AGS_API AGSReturnCode agsGetCrossfireGPUCount( AGSContext* context, int* num /// \note Freesync HDR Gamma 2.2 mode requires a 1010102 swapchain. /// \note Dolby Vision requires a 8888 UNORM swapchain. /// -/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] context Pointer to a context. This is generated by \ref agsInitialize /// \param [in] deviceIndex The index of the device listed in \ref AGSGPUInfo::devices. /// \param [in] displayIndex The index of the display listed in \ref AGSDeviceInfo::displays. /// \param [in] settings Pointer to the display settings to use. @@ -726,6 +890,29 @@ typedef struct AGSDX12ExtensionParams typedef struct AGSDX12ReturnedParams { ID3D12Device* pDevice; ///< The newly created device + /* + This was changed to a struct in 6.0.0+ but it's still the size of an unsigned int. + Ignoring this change for now. + + typedef struct ExtensionsSupported /// Extensions for DX12 + { + unsigned int intrinsics16 : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. ReadFirstLane, ReadLane, LaneID, Swizzle, Ballot, MBCount, Med3, Barycentrics + unsigned int intrinsics17 : 1; ///< Supported in Radeon Software Version 17.9.1 onwards. WaveReduce, WaveScan + unsigned int userMarkers : 1; ///< Supported in Radeon Software Version 17.9.1 onwards. + unsigned int appRegistration : 1; ///< Supported in Radeon Software Version 17.9.1 onwards. + unsigned int UAVBindSlot : 1; ///< Supported in Radeon Software Version 19.5.1 onwards. + unsigned int intrinsics19 : 1; ///< Supported in Radeon Software Version 19.12.2 onwards. DrawIndex, AtomicU64 + unsigned int baseVertex : 1; ///< Supported in Radeon Software Version 20.2.1 onwards. + unsigned int baseInstance : 1; ///< Supported in Radeon Software Version 20.2.1 onwards. + unsigned int getWaveSize : 1; ///< Supported in Radeon Software Version 20.5.1 onwards. + unsigned int floatConversion : 1; ///< Supported in Radeon Software Version 20.5.1 onwards. + unsigned int readLaneAt : 1; ///< Supported in Radeon Software Version 20.11.1 onwards. + unsigned int rayHitToken : 1; ///< Supported in Radeon Software Version 20.11.1 onwards. + unsigned int padding : 20; ///< Reserved + } ExtensionsSupported; + ExtensionsSupported extensionsSupported; ///< List of supported extensions + */ + unsigned int extensionsSupported; ///< Bit mask that \ref agsDriverExtensionsDX12_CreateDevice will fill in to indicate which extensions are supported. See \ref AGSDriverExtensionDX12 } AGSDX12ReturnedParams; @@ -747,11 +934,11 @@ typedef struct AGSDX12ReturnedParams /// range[ 0 ].Init( D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, AGS_DX12_SHADER_INSTRINSICS_SPACE_ID ); // u0 at driver-reserved space id /// \endcode /// -/// Newer drivers also support a user-specified slot in which case the register space id is assumed to be 0. It is important that the \ref AGS_DX12_EXTENSION_INTRINSIC_UAV_BIND_SLOT bit is set +/// Newer drivers also support a user-specified slot in which case the register space id is assumed to be 0. It is important that the \ref AGSDX12ReturnedParams::ExtensionsSupported::UAVBindSlot bit is set. /// to ensure the driver can support this. If not, then u0 and \ref AGS_DX12_SHADER_INSTRINSICS_SPACE_ID must be used. /// If the driver does support this feature and a non zero slot is required, then the HLSL must also define AMD_EXT_SHADER_INTRINSIC_UAV_OVERRIDE as the matching slot value. /// -/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] context Pointer to a context. This is generated by \ref agsInitialize /// \param [in] creationParams Pointer to the struct to specify the existing DX12 device creation parameters. /// \param [in] extensionParams Optional pointer to the struct to specify DX12 additional device creation parameters. /// \param [out] returnedParams Pointer to struct to hold all the returned parameters from the call. @@ -777,7 +964,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DestroyDevice( AGSContext* con /// * The intrinsic instructions require a 5.1 shader model. /// * The Root Signature will need to use an extra resource and sampler. These are not real resources/samplers, they are just used to encode the intrinsic instruction. /// -/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] context Pointer to a context. This is generated by \ref agsInitialize /// \param [in] device The D3D12 device. /// \param [out] extensionsSupported Pointer to a bit mask that this function will fill in to indicate which extensions are supported. See ::AGSDriverExtensionDX12 /// @@ -799,7 +986,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_DeInit( AGSContext* context ); /// /// Function used to push an AMD user marker onto the command list. -/// This is only has an effect if \ref AGS_DX12_EXTENSION_USER_MARKERS is present in the extensionsSupported bitfield of \ref agsDriverExtensionsDX12_CreateDevice +/// This is only has an effect if \ref AGSDX12ReturnedParams::ExtensionsSupported::userMarkers is present. /// Supported in Radeon Software Version 17.9.1 onwards. /// /// \param [in] context Pointer to a context. @@ -912,10 +1099,47 @@ typedef struct AGSDX11ReturnedParams_520 void* breadcrumbBuffer; ///< The CPU buffer returned if the initialization of the breadcrumb was successful. } AGSDX11ReturnedParams_520; +typedef struct AGSDX11ExtensionsSupported_600 /// Extensions for DX11 +{ + unsigned int quadList : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int screenRectList : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int uavOverlap : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int depthBoundsTest : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int multiDrawIndirect : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int multiDrawIndirectCountIndirect : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int crossfireAPI : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int createShaderControls : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. + unsigned int intrinsics16 : 1; ///< Supported in Radeon Software Version 16.9.2 onwards. ReadFirstLane, ReadLane, LaneID, Swizzle, Ballot, MBCount, Med3, Barycentrics + unsigned int multiView : 1; ///< Supported in Radeon Software Version 16.12.1 onwards. + unsigned int intrinsics17 : 1; ///< Supported in Radeon Software Version 17.9.1 onwards. WaveReduce, WaveScan + unsigned int appRegistration : 1; ///< Supported in Radeon Software Version 17.9.1 onwards. + unsigned int breadcrumbMarkers : 1; ///< Supported in Radeon Software Version 17.11.1 onwards. + unsigned int MDIDeferredContexts : 1; ///< Supported in Radeon Software Version 18.8.1 onwards. + unsigned int UAVOverlapDeferredContexts : 1; ///< Supported in Radeon Software Version 18.8.1 onwards. + unsigned int depthBoundsDeferredContexts : 1; ///< Supported in Radeon Software Version 18.8.1 onwards. + unsigned int intrinsics19 : 1; ///< Supported in Radeon Software Version 19.12.2 onwards. DrawIndex, AtomicU64 + unsigned int getWaveSize : 1; ///< Supported in Radeon Software Version 20.2.1 onwards. + unsigned int baseVertex : 1; ///< Supported in Radeon Software Version 20.2.1 onwards. + unsigned int baseInstance : 1; ///< Supported in Radeon Software Version 20.2.1 onwards. + unsigned int padding : 12; ///< Reserved +} AGSDX11ExtensionsSupported_600; + +typedef struct AGSDX11ReturnedParams_600 +{ + ID3D11Device* pDevice; ///< The newly created device + ID3D11DeviceContext* pImmediateContext; ///< The newly created immediate device context + IDXGISwapChain* pSwapChain; ///< The newly created swap chain. This is only created if a valid pSwapChainDesc is supplied in AGSDX11DeviceCreationParams. + D3D_FEATURE_LEVEL featureLevel; ///< The feature level supported by the newly created device + AGSDX11ExtensionsSupported_600 extensionsSupported; ///< List of supported extensions + unsigned int crossfireGPUCount; ///< The number of GPUs that are active for this app + void* breadcrumbBuffer; ///< The CPU buffer returned if the initialization of the breadcrumb was successful +} AGSDX11ReturnedParams_600; + typedef union AGSDX11ReturnedParams { AGSDX11ReturnedParams_511 agsDX11ReturnedParams511; AGSDX11ReturnedParams_520 agsDX11ReturnedParams520; + AGSDX11ReturnedParams_600 agsDX11ReturnedParams600; } AGSDX11ReturnedParams; /// @@ -925,7 +1149,7 @@ typedef union AGSDX11ReturnedParams /// * The shader compiler should not use the D3DCOMPILE_SKIP_OPTIMIZATION (/Od) option, otherwise it will not work. /// * The shader compiler needs D3DCOMPILE_ENABLE_STRICTNESS (/Ges) enabled. /// -/// \param [in] context Pointer to a context. This is generated by \ref agsInit +/// \param [in] context Pointer to a context. This is generated by \ref agsInititalize /// \param [in] creationParams Pointer to the struct to specify the existing DX11 device creation parameters. /// \param [in] extensionParams Optional pointer to the struct to specify DX11 additional device creation parameters. /// \param [out] returnedParams Pointer to struct to hold all the returned parameters from the call. @@ -991,7 +1215,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_DestroyDevice_511( AGSContext* /// \defgroup breadcrumbs Breadcrumb API /// API for writing top-of-pipe and bottom-of-pipe markers to help track down GPU hangs. /// -/// The API is available if the \ref AGS_DX11_EXTENSION_BREADCRUMB_MARKERS is present in \ref AGSDX11ReturnedParams::extensionsSupported. +/// The API is available if the \ref AGSDX11ReturnedParams::ExtensionsSupported::breadcrumbMarkers is present. /// /// To use the API, a non zero value needs to be specificed in \ref AGSDX11ExtensionParams::numBreadcrumbMarkers. This enables the API (if available) and allocates a system memory buffer /// which is returned to the user in \ref AGSDX11ReturnedParams::breadcrumbBuffer. @@ -1197,6 +1421,13 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_WriteBreadcrumb( AGSContext* c /// API for primitive topologies /// @{ +/// Additional topologies supported via extensions +typedef enum AGSPrimitiveTopology +{ + AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, ///< Quad list + AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 ///< Screen rect list +} AGSPrimitiveTopology; + /// /// Function used to set the primitive topology. If you are using any of the extended topology types, then this function should /// be called to set ALL topology types. @@ -1447,6 +1678,22 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetViewBroadcastMasks( AGSCont /// AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_GetMaxClipRects( AGSContext* context, unsigned int* maxRectCount ); +/// The inclusion mode for the rect +typedef enum AGSClipRect_Mode +{ + ClipRectIncluded = 0, ///< Include the rect + ClipRectExcluded = 1 ///< Exclude the rect +} AGSClipRect_Mode; + +/// The clip rectangle struct used by \ref agsDriverExtensionsDX11_SetClipRects +typedef struct AGSClipRect +{ + AGSClipRect_Mode mode; ///< Include/exclude rect region + AGSRect rect; ///< The rect to include/exclude +} AGSClipRect; + + + /// /// Function sets clip rectangles. /// @@ -1563,6 +1810,46 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_NotifyResourceEndAllAccess( AG /// @} +/// \defgroup typedefs Function pointer typedefs +/// List of function pointer typedefs for the API +/// @{ + +typedef AMD_AGS_API AGSDriverVersionResult (*AGS_CHECKDRIVERVERSION)( const char*, unsigned int ); ///< \ref agsCheckDriverVersion +typedef AMD_AGS_API int (*AGS_GETVERSIONNUMBER)( void ); ///< \ref agsGetVersionNumber +typedef AMD_AGS_API AGSReturnCode (*AGS_INITIALIZE)( int, const AGSConfiguration*, AGSContext**, AGSGPUInfo_600* ); ///< \ref agsInitialize +typedef AMD_AGS_API AGSReturnCode (*AGS_DEINITIALIZE)( AGSContext* ); ///< \ref agsDeInitialize +typedef AMD_AGS_API AGSReturnCode (*AGS_SETDISPLAYMODE)( AGSContext*, int, int, const AGSDisplaySettings* ); ///< \ref agsSetDisplayMode +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX12_CREATEDEVICE)( AGSContext*, const AGSDX12DeviceCreationParams*, const AGSDX12ExtensionParams*, AGSDX12ReturnedParams* ); ///< \ref agsDriverExtensionsDX12_CreateDevice +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX12_DESTROYDEVICE)( AGSContext*, ID3D12Device*, unsigned int* ); ///< \ref agsDriverExtensionsDX12_DestroyDevice +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX12_PUSHMARKER)( AGSContext*, ID3D12GraphicsCommandList*, const char* ); ///< \ref agsDriverExtensionsDX12_PushMarker +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX12_POPMARKER)( AGSContext*, ID3D12GraphicsCommandList* ); ///< \ref agsDriverExtensionsDX12_PopMarker +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX12_SETMARKER)( AGSContext*, ID3D12GraphicsCommandList*, const char* ); ///< \ref agsDriverExtensionsDX12_SetMarker +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_CREATEDEVICE)( AGSContext*, const AGSDX11DeviceCreationParams*, const AGSDX11ExtensionParams*, AGSDX11ReturnedParams* ); ///< \ref agsDriverExtensionsDX11_CreateDevice +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_DESTROYDEVICE)( AGSContext*, ID3D11Device*, unsigned int*, ID3D11DeviceContext*, unsigned int* ); ///< \ref agsDriverExtensionsDX11_DestroyDevice +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_WRITEBREADCRUMB)( AGSContext*, const AGSBreadcrumbMarker* ); ///< \ref agsDriverExtensionsDX11_WriteBreadcrumb +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_IASETPRIMITIVETOPOLOGY)( AGSContext*, enum D3D_PRIMITIVE_TOPOLOGY ); ///< \ref agsDriverExtensionsDX11_IASetPrimitiveTopology +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_BEGINUAVOVERLAP)( AGSContext*, ID3D11DeviceContext* ); ///< \ref agsDriverExtensionsDX11_BeginUAVOverlap +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_ENDUAVOVERLAP)( AGSContext*, ID3D11DeviceContext* ); ///< \ref agsDriverExtensionsDX11_EndUAVOverlap +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_SETDEPTHBOUNDS)( AGSContext*, ID3D11DeviceContext*, bool, float, float ); ///< \ref agsDriverExtensionsDX11_SetDepthBounds +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_MULTIDRAWINSTANCEDINDIRECT)( AGSContext*, ID3D11DeviceContext*, unsigned int, ID3D11Buffer*, unsigned int, unsigned int ); ///< \ref agsDriverExtensionsDX11_MultiDrawInstancedIndirect +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_MULTIDRAWINDEXEDINSTANCEDINDIRECT)( AGSContext*, ID3D11DeviceContext*, unsigned int, ID3D11Buffer*, unsigned int, unsigned int ); ///< \ref agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_MULTIDRAWINSTANCEDINDIRECTCOUNTINDIRECT)( AGSContext*, ID3D11DeviceContext*, ID3D11Buffer*, unsigned int, ID3D11Buffer*, unsigned int, unsigned int ); ///< \ref agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_MULTIDRAWINDEXEDINSTANCEDINDIRECTCOUNTINDIRECT)( AGSContext*, ID3D11DeviceContext*, ID3D11Buffer*, unsigned int, ID3D11Buffer*, unsigned int, unsigned int ); ///< \ref agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_SETMAXASYNCCOMPILETHREADCOUNT)( AGSContext*, unsigned int ); ///< \ref agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_NUMPENDINGASYNCOMPILEJOBS)( AGSContext*, unsigned int* ); ///< \ref agsDriverExtensionsDX11_NumPendingAsyncCompileJobs +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_SETDISKSHADERCACHEENABLED)( AGSContext*, int ); ///< \ref agsDriverExtensionsDX11_SetDiskShaderCacheEnabled +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_SETVIEWBROADCASTMASKS)( AGSContext*, unsigned long long, unsigned long long, int ); ///< \ref agsDriverExtensionsDX11_SetViewBroadcastMasks +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_GETMAXCLIPRECTS)( AGSContext*, unsigned int* ); ///< \ref agsDriverExtensionsDX11_GetMaxClipRects +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_SETCLIPRECTS)( AGSContext*, unsigned int, const AGSClipRect* ); ///< \ref agsDriverExtensionsDX11_SetClipRects +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_CREATEBUFFER)( AGSContext*, const D3D11_BUFFER_DESC*, const D3D11_SUBRESOURCE_DATA*, ID3D11Buffer**, AGSAfrTransferType, AGSAfrTransferEngine ); ///< \ref agsDriverExtensionsDX11_CreateBuffer +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_CREATETEXTURE1D)( AGSContext*, const D3D11_TEXTURE1D_DESC*, const D3D11_SUBRESOURCE_DATA*, ID3D11Texture1D**, AGSAfrTransferType, AGSAfrTransferEngine ); ///< \ref agsDriverExtensionsDX11_CreateTexture1D +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_CREATETEXTURE2D)( AGSContext*, const D3D11_TEXTURE2D_DESC*, const D3D11_SUBRESOURCE_DATA*, ID3D11Texture2D**, AGSAfrTransferType, AGSAfrTransferEngine ); ///< \ref agsDriverExtensionsDX11_CreateTexture2D +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_CREATETEXTURE3D)( AGSContext*, const D3D11_TEXTURE3D_DESC*, const D3D11_SUBRESOURCE_DATA*, ID3D11Texture3D**, AGSAfrTransferType, AGSAfrTransferEngine ); ///< \ref agsDriverExtensionsDX11_CreateTexture3D +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_NOTIFYRESOURCEENDWRITES)( AGSContext*, ID3D11Resource*, const D3D11_RECT*, const unsigned int*, unsigned int ); ///< \ref agsDriverExtensionsDX11_NotifyResourceEndWrites +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_NOTIFYRESOURCEBEGINALLACCESS)( AGSContext*, ID3D11Resource* ); ///< \ref agsDriverExtensionsDX11_NotifyResourceBeginAllAccess +typedef AMD_AGS_API AGSReturnCode (*AGS_DRIVEREXTENSIONSDX11_NOTIFYRESOURCEENDALLACCESS)( AGSContext*, ID3D11Resource* ); ///< \ref agsDriverExtensionsDX11_NotifyResourceEndAllAccess +/// @} + #ifdef __cplusplus } // extern "C" #endif diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index ae825462f28..562c4103343 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -1,4 +1,5 @@ @ stdcall agsDeInit(ptr) +@ stdcall agsDeInitialize(ptr) @ stdcall agsCheckDriverVersion(ptr long) @ stub agsDriverExtensionsDX11_BeginUAVOverlap @ stub agsDriverExtensionsDX11_CreateBuffer @@ -38,5 +39,7 @@ @ stub agsDriverExtensionsDX12_PushMarker @ stub agsDriverExtensionsDX12_SetMarker @ stdcall agsGetCrossfireGPUCount(ptr ptr) +@ stdcall agsGetVersionNumber() @ stdcall agsInit(ptr ptr ptr) +@ stdcall agsInitialize(long ptr ptr ptr) @ stub agsSetDisplayMode diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 750401a845e..88ce02f9e1b 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -26,6 +26,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_4_0, AMD_AGS_VERSION_5_4_1, AMD_AGS_VERSION_5_4_2, + AMD_AGS_VERSION_6_0_0, AMD_AGS_VERSION_COUNT }; @@ -46,17 +47,21 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {5, 4, 0, sizeof(AGSDeviceInfo_540)}, {5, 4, 1, sizeof(AGSDeviceInfo_541)}, {5, 4, 2, sizeof(AGSDeviceInfo_542)}, + {6, 0, 0, sizeof(AGSDeviceInfo_600)}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name)}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ - -1, -1}} + -1, -1, -1}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name)}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name)}} +#define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1}} #define DEVICE_FIELD_adapterString 0 #define DEVICE_FIELD_architectureVersion 1 @@ -80,7 +85,7 @@ device_struct_fields[] = DEF_FIELD_540_UP(asicFamily), DEF_FIELD(vendorId), DEF_FIELD(deviceId), - DEF_FIELD(isPrimaryDevice), + DEF_FIELD_600_BELOW(isPrimaryDevice), DEF_FIELD(localMemoryInBytes), DEF_FIELD(numDisplays), DEF_FIELD(displays), @@ -263,20 +268,20 @@ static enum amd_ags_version determine_ags_version(void) return ret; } -struct monitor_enum_context +struct monitor_enum_context_600 { const char *adapter_name; - AGSDisplayInfo **ret_displays; + AGSDisplayInfo_600 **ret_displays; int *ret_display_count; }; -static BOOL WINAPI monitor_enum_proc(HMONITOR hmonitor, HDC hdc, RECT *rect, LPARAM context) +static BOOL WINAPI monitor_enum_proc_600(HMONITOR hmonitor, HDC hdc, RECT *rect, LPARAM context) { - struct monitor_enum_context *c = (struct monitor_enum_context *)context; + struct monitor_enum_context_600 *c = (struct monitor_enum_context_600 *)context; MONITORINFOEXA monitor_info; - AGSDisplayInfo *new_alloc; + AGSDisplayInfo_600 *new_alloc; DISPLAY_DEVICEA device; - AGSDisplayInfo *info; + AGSDisplayInfo_600 *info; unsigned int i, mode; DEVMODEA dev_mode; @@ -321,7 +326,7 @@ static BOOL WINAPI monitor_enum_proc(HMONITOR hmonitor, HDC hdc, RECT *rect, LPA strcpy(info->name, "Unknown"); } if (monitor_info.dwFlags & MONITORINFOF_PRIMARY) - info->displayFlags |= AGS_DISPLAYFLAG_PRIMARY_DISPLAY; + info->isPrimaryDisplay = 1; mode = 0; memset(&dev_mode, 0, sizeof(dev_mode)); @@ -360,9 +365,9 @@ static BOOL WINAPI monitor_enum_proc(HMONITOR hmonitor, HDC hdc, RECT *rect, LPA return TRUE; } -static void init_device_displays(const char *adapter_name, AGSDisplayInfo **ret_displays, int *ret_display_count) +static void init_device_displays_600(const char *adapter_name, AGSDisplayInfo_600 **ret_displays, int *ret_display_count) { - struct monitor_enum_context context; + struct monitor_enum_context_600 context; TRACE("adapter_name %s.\n", debugstr_a(adapter_name)); @@ -370,9 +375,32 @@ static void init_device_displays(const char *adapter_name, AGSDisplayInfo **ret_ context.ret_displays = ret_displays; context.ret_display_count = ret_display_count; - EnumDisplayMonitors(NULL, NULL, monitor_enum_proc, (LPARAM)&context); + EnumDisplayMonitors(NULL, NULL, monitor_enum_proc_600, (LPARAM)&context); +} + +static void init_device_displays_511(const char *adapter_name, AGSDisplayInfo_511 **ret_displays, int *ret_display_count) +{ + AGSDisplayInfo_600 *displays = NULL; + int display_count = 0; + int i; + *ret_displays = NULL; + *ret_display_count = 0; + + init_device_displays_600(adapter_name, &displays, &display_count); + + if ((*ret_displays = heap_alloc(sizeof(**ret_displays) * display_count))) + { + for (i = 0; i < display_count; i++) + { + memcpy(&(*ret_displays)[i], &displays[i], sizeof(AGSDisplayInfo_511)); + } + *ret_display_count = display_count; + } + + heap_free(displays); } + static AGSReturnCode init_ags_context(AGSContext *context) { AGSReturnCode ret; @@ -427,11 +455,31 @@ static AGSReturnCode init_ags_context(AGSContext *context) } SET_DEVICE_FIELD(device, localMemoryInBytes, ULONG64, context->version, local_memory_size); if (!i) - SET_DEVICE_FIELD(device, isPrimaryDevice, int, context->version, 1); + { + if (context->version >= AMD_AGS_VERSION_6_0_0) + { + // This is a bitfield now... Nice... + struct AGSDeviceInfo_600 *device_600 = (struct AGSDeviceInfo_600 *)device; + device_600->isPrimaryDevice = 1; + } + else + { + SET_DEVICE_FIELD(device, isPrimaryDevice, int, context->version, 1); + } + } - init_device_displays(vk_properties->deviceName, - GET_DEVICE_FIELD_ADDR(device, displays, AGSDisplayInfo *, context->version), - GET_DEVICE_FIELD_ADDR(device, numDisplays, int, context->version)); + if (context->version >= AMD_AGS_VERSION_6_0_0) + { + init_device_displays_600(vk_properties->deviceName, + GET_DEVICE_FIELD_ADDR(device, displays, AGSDisplayInfo_600 *, context->version), + GET_DEVICE_FIELD_ADDR(device, numDisplays, int, context->version)); + } + else + { + init_device_displays_511(vk_properties->deviceName, + GET_DEVICE_FIELD_ADDR(device, displays, AGSDisplayInfo_511 *, context->version), + GET_DEVICE_FIELD_ADDR(device, numDisplays, int, context->version)); + } device += amd_ags_info[context->version].device_size; } @@ -439,7 +487,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) return AGS_SUCCESS; } -AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *config, AGSGPUInfo *gpu_info) +AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *config, AGSGPUInfo_511 *gpu_info) { struct AGSContext *object; AGSReturnCode ret; @@ -477,7 +525,47 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi return AGS_SUCCESS; } +AGSReturnCode WINAPI agsInitialize(int ags_version, const AGSConfiguration *config, AGSContext **context, AGSGPUInfo_600 *gpu_info) +{ + struct AGSContext *object; + AGSReturnCode ret; + + TRACE("ags_verison %d, context %p, config %p, gpu_info %p.\n", ags_version, context, config, gpu_info); + + if (!context || !gpu_info) + return AGS_INVALID_ARGS; + + if (config) + FIXME("Ignoring config %p.\n", config); + + if (!(object = heap_alloc(sizeof(*object)))) + return AGS_OUT_OF_MEMORY; + + if ((ret = init_ags_context(object)) != AGS_SUCCESS) + { + heap_free(object); + return ret; + } + + memset(gpu_info, 0, sizeof(*gpu_info)); + gpu_info->driverVersion = "20.50.03.05-210326a-365573E-RadeonSoftwareAdrenalin2020"; + gpu_info->radeonSoftwareVersion = "21.3.2"; + gpu_info->numDevices = object->device_count; + gpu_info->devices = object->devices; + + TRACE("Created context %p.\n", object); + + *context = object; + + return AGS_SUCCESS; +} + AGSReturnCode WINAPI agsDeInit(AGSContext *context) +{ + return agsDeInitialize(context); +} + +AGSReturnCode WINAPI agsDeInitialize(AGSContext *context) { unsigned int i; BYTE *device; @@ -491,7 +579,7 @@ AGSReturnCode WINAPI agsDeInit(AGSContext *context) device = (BYTE *)context->devices; for (i = 0; i < context->device_count; ++i) { - heap_free(*GET_DEVICE_FIELD_ADDR(device, displays, AGSDisplayInfo *, context->version)); + heap_free(*GET_DEVICE_FIELD_ADDR(device, displays, void *, context->version)); device += amd_ags_info[context->version].device_size; } heap_free(context->devices); @@ -561,6 +649,15 @@ AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported return AGS_SOFTWAREVERSIONCHECK_OK; } +int WINAPI agsGetVersionNumber(void) +{ + enum amd_ags_version version = determine_ags_version(); + + TRACE("version %d.\n", version); + + return AGS_MAKE_VERSION(amd_ags_info[version].major, amd_ags_info[version].minor, amd_ags_info[version].patch); +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From 86ae41d01c8e117d57f67565bc618febed19244b Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 8 May 2021 05:20:08 +0100 Subject: [PATCH 0612/1506] amd_ags_x64: Implement AGS 6.0.1 Signed-off-by: Joshua Ashton --- dlls/amd_ags_x64/amd_ags.h | 8 ++++---- dlls/amd_ags_x64/amd_ags_x64_main.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index af9c48c1dd5..20fef455f00 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -151,7 +151,7 @@ #define AMD_AGS_VERSION_MAJOR 6 ///< AGS major version #define AMD_AGS_VERSION_MINOR 0 ///< AGS minor version -#define AMD_AGS_VERSION_PATCH 0 ///< AGS patch version +#define AMD_AGS_VERSION_PATCH 1 ///< AGS patch version #ifdef __cplusplus extern "C" { @@ -906,8 +906,8 @@ typedef struct AGSDX12ReturnedParams unsigned int baseInstance : 1; ///< Supported in Radeon Software Version 20.2.1 onwards. unsigned int getWaveSize : 1; ///< Supported in Radeon Software Version 20.5.1 onwards. unsigned int floatConversion : 1; ///< Supported in Radeon Software Version 20.5.1 onwards. - unsigned int readLaneAt : 1; ///< Supported in Radeon Software Version 20.11.1 onwards. - unsigned int rayHitToken : 1; ///< Supported in Radeon Software Version 20.11.1 onwards. + unsigned int readLaneAt : 1; ///< Supported in Radeon Software Version 20.11.2 onwards. + unsigned int rayHitToken : 1; ///< Supported in Radeon Software Version 20.11.2 onwards. unsigned int padding : 20; ///< Reserved } ExtensionsSupported; ExtensionsSupported extensionsSupported; ///< List of supported extensions @@ -1631,7 +1631,7 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount( /// /// This method can be used to determine the total number of asynchronous shader compile jobs that are either -/// queued for waiting for compilation or being compiled by the driverÂ’s asynchronous compilation threads. +/// queued for waiting for compilation or being compiled by the driverÂ’'s asynchronous compilation threads. /// This method can be called at any during the lifetime of the driver. /// /// \param [in] context Pointer to a context. diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 88ce02f9e1b..b1910def3cd 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -27,6 +27,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_4_1, AMD_AGS_VERSION_5_4_2, AMD_AGS_VERSION_6_0_0, + AMD_AGS_VERSION_6_0_1, AMD_AGS_VERSION_COUNT }; @@ -48,20 +49,24 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {5, 4, 1, sizeof(AGSDeviceInfo_541)}, {5, 4, 2, sizeof(AGSDeviceInfo_542)}, {6, 0, 0, sizeof(AGSDeviceInfo_600)}, + {6, 0, 1, sizeof(AGSDeviceInfo_600)}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ + offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ - -1, -1, -1}} + -1, -1, -1, -1}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ + offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1}} + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1, \ + -1}} #define DEVICE_FIELD_adapterString 0 #define DEVICE_FIELD_architectureVersion 1 From 037e62d18e31ca735fd0ad091eea56f6e8215db1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 6 Oct 2021 22:56:07 +0300 Subject: [PATCH 0613/1506] amd_ags_x64: Add agsDriverExtensionsDX11_Init() semi-stub. --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 562c4103343..ebb026da35e 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -14,7 +14,7 @@ @ stub agsDriverExtensionsDX11_EndUAVOverlap @ stub agsDriverExtensionsDX11_GetMaxClipRects @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology -@ stub agsDriverExtensionsDX11_Init +@ stdcall agsDriverExtensionsDX11_Init(ptr ptr long ptr) @ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect @ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect @ stub agsDriverExtensionsDX11_MultiDrawInstancedIndirect diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index b1910def3cd..5b6d852b9e7 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -663,6 +663,14 @@ int WINAPI agsGetVersionNumber(void) return AGS_MAKE_VERSION(amd_ags_info[version].major, amd_ags_info[version].minor, amd_ags_info[version].patch); } +AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext* context, ID3D11Device* device, unsigned int uavSlot, unsigned int* extensionsSupported ) +{ + FIXME("context %p, device %p, uavSlot %u, extensionsSupported %p stub.\n", context, device, uavSlot, extensionsSupported); + + *extensionsSupported = 0; + return AGS_SUCCESS; +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From ad3cdb9d9fadb8cae436731d78aaffa32847e49d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 10 Nov 2021 22:11:59 +0300 Subject: [PATCH 0614/1506] amd_ags_x64: Bump driver version to 21.10.2. For FH5. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 5b6d852b9e7..24b16021acf 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -518,8 +518,8 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi gpu_info->agsVersionMajor = amd_ags_info[object->version].major; gpu_info->agsVersionMinor = amd_ags_info[object->version].minor; gpu_info->agsVersionPatch = amd_ags_info[object->version].patch; - gpu_info->driverVersion = "20.50.03.05-210326a-365573E-RadeonSoftwareAdrenalin2020"; - gpu_info->radeonSoftwareVersion = "21.3.2"; + gpu_info->driverVersion = "21.30.25.05-211005a-372402E-RadeonSoftware"; + gpu_info->radeonSoftwareVersion = "21.10.2"; gpu_info->numDevices = object->device_count; gpu_info->devices = object->devices; @@ -553,8 +553,8 @@ AGSReturnCode WINAPI agsInitialize(int ags_version, const AGSConfiguration *conf } memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->driverVersion = "20.50.03.05-210326a-365573E-RadeonSoftwareAdrenalin2020"; - gpu_info->radeonSoftwareVersion = "21.3.2"; + gpu_info->driverVersion = "21.30.25.05-211005a-372402E-RadeonSoftware"; + gpu_info->radeonSoftwareVersion = "21.10.2"; gpu_info->numDevices = object->device_count; gpu_info->devices = object->devices; From 8123ca36b28d97b88448a833116bb1e91fb9bb76 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 2 Feb 2022 16:36:37 +0300 Subject: [PATCH 0615/1506] amd_ags_x64: Implement agsDriverExtensionsDX11_CreateDevice(). CW-Bug-Id: #19944 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 106 +++++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 11 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index ebb026da35e..d4a558729aa 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -3,7 +3,7 @@ @ stdcall agsCheckDriverVersion(ptr long) @ stub agsDriverExtensionsDX11_BeginUAVOverlap @ stub agsDriverExtensionsDX11_CreateBuffer -@ stub agsDriverExtensionsDX11_CreateDevice +@ stdcall agsDriverExtensionsDX11_CreateDevice(ptr ptr ptr ptr) @ stub agsDriverExtensionsDX11_CreateFromDevice @ stub agsDriverExtensionsDX11_CreateTexture1D @ stub agsDriverExtensionsDX11_CreateTexture2D diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 24b16021acf..6ae20547e7a 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -38,18 +38,19 @@ static const struct int minor; int patch; unsigned int device_size; + unsigned int dx11_returned_params_size; } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {5, 1, 1, sizeof(AGSDeviceInfo_511)}, - {5, 2, 0, sizeof(AGSDeviceInfo_520)}, - {5, 2, 1, sizeof(AGSDeviceInfo_520)}, - {5, 3, 0, sizeof(AGSDeviceInfo_520)}, - {5, 4, 0, sizeof(AGSDeviceInfo_540)}, - {5, 4, 1, sizeof(AGSDeviceInfo_541)}, - {5, 4, 2, sizeof(AGSDeviceInfo_542)}, - {6, 0, 0, sizeof(AGSDeviceInfo_600)}, - {6, 0, 1, sizeof(AGSDeviceInfo_600)}, + {5, 1, 1, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511)}, + {5, 2, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, + {5, 2, 1, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, + {5, 3, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, + {5, 4, 0, sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520)}, + {5, 4, 1, sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520)}, + {5, 4, 2, sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520)}, + {6, 0, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, + {6, 0, 1, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ @@ -117,8 +118,10 @@ struct AGSContext VkPhysicalDeviceMemoryProperties *memory_properties; }; -static HMODULE hd3d12; +static HMODULE hd3d11, hd3d12; static typeof(D3D12CreateDevice) *pD3D12CreateDevice; +static typeof(D3D11CreateDevice) *pD3D11CreateDevice; +static typeof(D3D11CreateDeviceAndSwapChain) *pD3D11CreateDeviceAndSwapChain; static BOOL load_d3d12_functions(void) { @@ -132,6 +135,19 @@ static BOOL load_d3d12_functions(void) return TRUE; } +static BOOL load_d3d11_functions(void) +{ + if (hd3d11) + return TRUE; + + if (!(hd3d11 = LoadLibraryA("d3d11.dll"))) + return FALSE; + + pD3D11CreateDevice = (void *)GetProcAddress(hd3d11, "D3D11CreateDevice"); + pD3D11CreateDeviceAndSwapChain = (void *)GetProcAddress(hd3d11, "D3D11CreateDeviceAndSwapChain"); + return TRUE; +} + static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, VkPhysicalDeviceProperties **out, VkPhysicalDeviceMemoryProperties **out_memory) { @@ -605,6 +621,76 @@ AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, + const AGSDX11DeviceCreationParams* creation_params, const AGSDX11ExtensionParams* extension_params, + AGSDX11ReturnedParams* returned_params ) +{ + ID3D11DeviceContext *device_context; + IDXGISwapChain *swapchain = NULL; + D3D_FEATURE_LEVEL feature_level; + ID3D11Device *device; + HRESULT hr; + + TRACE("feature levels %u, pSwapChainDesc %p, app %s, engine %s %#x %#x.\n", creation_params->FeatureLevels, + creation_params->pSwapChainDesc, + debugstr_w(extension_params->agsDX11ExtensionParams511.pAppName), + debugstr_w(extension_params->agsDX11ExtensionParams511.pEngineName), + extension_params->agsDX11ExtensionParams511.appVersion, + extension_params->agsDX11ExtensionParams511.engineVersion); + + if (!load_d3d11_functions()) + { + ERR("Could not load d3d11.dll.\n"); + return AGS_MISSING_D3D_DLL; + } + memset( returned_params, 0, amd_ags_info[context->version].dx11_returned_params_size ); + if (creation_params->pSwapChainDesc) + { + hr = pD3D11CreateDeviceAndSwapChain(creation_params->pAdapter, creation_params->DriverType, + creation_params->Software, creation_params->Flags, creation_params->pFeatureLevels, + creation_params->FeatureLevels, creation_params->SDKVersion, creation_params->pSwapChainDesc, + &swapchain, &device, &feature_level, &device_context); + } + else + { + hr = pD3D11CreateDevice(creation_params->pAdapter, creation_params->DriverType, + creation_params->Software, creation_params->Flags, creation_params->pFeatureLevels, + creation_params->FeatureLevels, creation_params->SDKVersion, + &device, &feature_level, &device_context); + } + if (FAILED(hr)) + { + ERR("Device creation failed, hr %#x.\n", hr); + return AGS_DX_FAILURE; + } + if (context->version < AMD_AGS_VERSION_5_2_0) + { + AGSDX11ReturnedParams_511 *r = &returned_params->agsDX11ReturnedParams511; + r->pDevice = device; + r->pImmediateContext = device_context; + r->pSwapChain = swapchain; + r->FeatureLevel = feature_level; + } + else if (context->version < AMD_AGS_VERSION_6_0_0) + { + AGSDX11ReturnedParams_520 *r = &returned_params->agsDX11ReturnedParams520; + r->pDevice = device; + r->pImmediateContext = device_context; + r->pSwapChain = swapchain; + r->FeatureLevel = feature_level; + } + else + { + AGSDX11ReturnedParams_600 *r = &returned_params->agsDX11ReturnedParams600; + r->pDevice = device; + r->pImmediateContext = device_context; + r->pSwapChain = swapchain; + r->featureLevel = feature_level; + } + + return AGS_SUCCESS; +} + AGSReturnCode WINAPI agsDriverExtensionsDX12_CreateDevice(AGSContext *context, const AGSDX12DeviceCreationParams *creation_params, const AGSDX12ExtensionParams *extension_params, AGSDX12ReturnedParams *returned_params) From 80a9a17fcfd5add95f12dda88f5e44644b34e7eb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 2 Feb 2022 17:07:53 +0300 Subject: [PATCH 0616/1506] amd_ags_x64: Add stub for agsDriverExtensionsDX11_SetDepthBounds(). CW-Bug-Id: #19944 --- dlls/amd_ags_x64/amd_ags.h | 6 ++++-- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 30 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 20fef455f00..9b521de75b8 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -1506,8 +1506,10 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_EndUAVOverlap( AGSContext* con /// \param [in] minDepth The near depth range to clip against. /// \param [in] maxDepth The far depth range to clip against. /// -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds_520( AGSContext* context, bool enabled, float minDepth, float maxDepth ); -AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* context, ID3D11DeviceContext* dxContext, bool enabled, float minDepth, float maxDepth ); +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds( AGSContext* context, bool enabled, float minDepth, float maxDepth ); + +/* Since 5.3.0 */ +AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_SetDepthBounds_530( AGSContext* context, ID3D11DeviceContext* dxContext, bool enabled, float minDepth, float maxDepth ); /// @} diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index d4a558729aa..e531dda9340 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -24,7 +24,7 @@ @ stub agsDriverExtensionsDX11_NotifyResourceEndWrites @ stub agsDriverExtensionsDX11_NumPendingAsyncCompileJobs @ stub agsDriverExtensionsDX11_SetClipRects -@ stub agsDriverExtensionsDX11_SetDepthBounds +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_SetDepthBounds() DX11_SetDepthBounds_impl @ stub agsDriverExtensionsDX11_SetDiskShaderCacheEnabled @ stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount @ stub agsDriverExtensionsDX11_SetViewBroadcastMasks diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 6ae20547e7a..589996594f8 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -8,6 +8,7 @@ #include "wine/heap.h" #include "wine/vulkan.h" +#include "wine/asm.h" #define COBJMACROS #include "d3d11.h" @@ -770,3 +771,32 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) return TRUE; } + +#ifdef __x86_64__ +AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds(AGSContext* context, bool enabled, + float minDepth, float maxDepth ) +{ + static int once; + + if (!once++) + FIXME("context %p, enabled %#x, minDepth %f, maxDepth %f stub.\n", context, enabled, minDepth, maxDepth); + return AGS_EXTENSION_NOT_SUPPORTED; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds_530(AGSContext* context, + ID3D11DeviceContext* dxContext, bool enabled, float minDepth, float maxDepth ) +{ + static int once; + + if (!once++) + FIXME("context %p, enabled %#x, minDepth %f, maxDepth %f stub.\n", context, enabled, minDepth, maxDepth); + return AGS_EXTENSION_NOT_SUPPORTED; +} + +__ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $3,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) +#endif From 76086ef64c21e903a6f111effd47fd9942e52e9c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 2 Feb 2022 17:42:41 +0300 Subject: [PATCH 0617/1506] amd_ags_x64: Implement agsDriverExtensionsDX11_DestroyDevice(). CW-Bug-Id: #19944 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 39 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index e531dda9340..3d9800469a1 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -10,7 +10,7 @@ @ stub agsDriverExtensionsDX11_CreateTexture3D @ stub agsDriverExtensionsDX11_DeInit @ stub agsDriverExtensionsDX11_Destroy -@ stub agsDriverExtensionsDX11_DestroyDevice +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_DestroyDevice() @ stub agsDriverExtensionsDX11_EndUAVOverlap @ stub agsDriverExtensionsDX11_GetMaxClipRects @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 589996594f8..b58926c928c 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -799,4 +799,43 @@ __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) + +AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_520(AGSContext *context, ID3D11Device* device, + unsigned int *device_ref, ID3D11DeviceContext *device_context, + unsigned int *context_ref) +{ + ULONG ref; + + TRACE("context %p, device %p, device_ref %p, device_context %p, context_ref %p.\n", + context, device, device_ref, device_context, context_ref); + + if (!device) + return AGS_SUCCESS; + + ref = ID3D11Device_Release(device); + if (device_ref) + *device_ref = ref; + + if (!device_context) + return AGS_SUCCESS; + + ref = ID3D11DeviceContext_Release(device_context); + if (context_ref) + *context_ref = ref; + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_511(AGSContext *context, ID3D11Device *device, + unsigned int *references ) +{ + TRACE("context %p, device %p, references %p.\n", context, device, references); + + return agsDriverExtensionsDX11_DestroyDevice_520(context, device, references, NULL, NULL); +} +__ASM_GLOBAL_FUNC( agsDriverExtensionsDX11_DestroyDevice, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $1,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_511") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_520") ) #endif From 2402281636ed244643e1dbf9500655b7e1c80c67 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 21 Dec 2022 15:45:58 -0600 Subject: [PATCH 0618/1506] amd_ags_x64: Copy native module to a temporary file for getting version info. Otherwise we are searching for version info in our builtin module (that changed with Wine 8.0). --- dlls/amd_ags_x64/amd_ags_x64_main.c | 34 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index b58926c928c..97cc6d48afa 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -240,29 +240,48 @@ static enum amd_ags_version determine_ags_version(void) UINT vallen, i; VS_FIXEDFILEINFO *info; UINT16 major, minor, patch; + WCHAR dllname[MAX_PATH], temp_path[MAX_PATH], temp_name[MAX_PATH]; - infosize = GetFileVersionInfoSizeW(L"amd_ags_x64.dll", NULL); + *temp_name = 0; + if (!(infosize = GetModuleFileNameW(GetModuleHandleW(L"amd_ags_x64.dll"), dllname, ARRAY_SIZE(dllname))) + || infosize == ARRAY_SIZE(dllname)) + { + ERR("GetModuleFileNameW failed.\n"); + goto done; + } + if (!GetTempPathW(MAX_PATH, temp_path) || !GetTempFileNameW(temp_path, L"tmp", 0, temp_name)) + { + ERR("Failed getting temp file name.\n"); + goto done; + } + if (!CopyFileW(dllname, temp_name, FALSE)) + { + ERR("Failed to copy file.\n"); + goto done; + } + + infosize = GetFileVersionInfoSizeW(temp_name, NULL); if (!infosize) { - WARN("Unable to determine desired version of amd_ags_x64.dll.\n"); + ERR("Unable to determine desired version of amd_ags_x64.dll.\n"); goto done; } if (!(infobuf = heap_alloc(infosize))) { - WARN("Failed to allocate memory.\n"); + ERR("Failed to allocate memory.\n"); goto done; } - if (!GetFileVersionInfoW(L"amd_ags_x64.dll", 0, infosize, infobuf)) + if (!GetFileVersionInfoW(temp_name, 0, infosize, infobuf)) { - WARN("Unable to determine desired version of amd_ags_x64.dll.\n"); + ERR("Unable to determine desired version of amd_ags_x64.dll.\n"); goto done; } if (!VerQueryValueW(infobuf, L"\\", &val, &vallen) || (vallen != sizeof(VS_FIXEDFILEINFO))) { - WARN("Unable to determine desired version of amd_ags_x64.dll.\n"); + ERR("Unable to determine desired version of amd_ags_x64.dll.\n"); goto done; } @@ -284,6 +303,9 @@ static enum amd_ags_version determine_ags_version(void) } done: + if (*temp_name) + DeleteFileW(temp_name); + heap_free(infobuf); TRACE("Using AGS v%d.%d.%d interface\n", amd_ags_info[ret].major, amd_ags_info[ret].minor, amd_ags_info[ret].patch); From e2daa85bdb702e64149e7d01fa028662b12c7c9f Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 10 Apr 2023 16:54:38 +0800 Subject: [PATCH 0619/1506] amd_ags_x64: Stub agsSetDisplayMode(). CW-Bug-Id: #22067 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 3d9800469a1..ece559ca9d3 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -42,4 +42,4 @@ @ stdcall agsGetVersionNumber() @ stdcall agsInit(ptr ptr ptr) @ stdcall agsInitialize(long ptr ptr ptr) -@ stub agsSetDisplayMode +@ stdcall agsSetDisplayMode(ptr long long ptr) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 97cc6d48afa..32f618c95dc 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -633,6 +633,17 @@ AGSReturnCode WINAPI agsDeInitialize(AGSContext *context) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsSetDisplayMode(AGSContext *context, int device_index, int display_index, const AGSDisplaySettings *settings) +{ + FIXME("context %p device_index %d display_index %d settings %p stub!\n", context, device_index, + display_index, settings); + + if (!context) + return AGS_INVALID_ARGS; + + return AGS_SUCCESS; +} + AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count) { TRACE("context %p gpu_count %p stub!\n", context, gpu_count); From bc21fddfe1ed888cb497be8137d1a03c48e37200 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 19 Apr 2023 13:22:16 -0600 Subject: [PATCH 0620/1506] amd_ags_x64: Add agsDriverExtensionsDX11_BeginUAVOverlap() stub. CW-Bug-Id: #22146 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index ece559ca9d3..876ceee1273 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -1,7 +1,7 @@ @ stdcall agsDeInit(ptr) @ stdcall agsDeInitialize(ptr) @ stdcall agsCheckDriverVersion(ptr long) -@ stub agsDriverExtensionsDX11_BeginUAVOverlap +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_BeginUAVOverlap() DX11_BeginUAVOverlap_impl @ stub agsDriverExtensionsDX11_CreateBuffer @ stdcall agsDriverExtensionsDX11_CreateDevice(ptr ptr ptr ptr) @ stub agsDriverExtensionsDX11_CreateFromDevice diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 32f618c95dc..b6af95bd2b7 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -833,6 +833,32 @@ __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) +AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap_520(AGSContext *context) +{ + static int once; + + if (!once++) + FIXME("context %p stub.\n", context); + return AGS_EXTENSION_NOT_SUPPORTED; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap(AGSContext *context, ID3D11DeviceContext *dx_context) +{ + static int once; + + if (!once++) + FIXME("context %p, dx_context %p stub.\n", context, dx_context); + + return AGS_EXTENSION_NOT_SUPPORTED; +} + +__ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $3,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap_520") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap") ) + AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_520(AGSContext *context, ID3D11Device* device, unsigned int *device_ref, ID3D11DeviceContext *device_context, unsigned int *context_ref) From c734915e382539163c4eea2bbd44df43a08f097f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 19 Apr 2023 14:41:04 -0600 Subject: [PATCH 0621/1506] amd_ags_x64: Add agsDriverExtensionsDX11_EndUAVOverlap() stub. CW-Bug-Id: #22146 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 876ceee1273..a825a450cfa 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -11,7 +11,7 @@ @ stub agsDriverExtensionsDX11_DeInit @ stub agsDriverExtensionsDX11_Destroy @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_DestroyDevice() -@ stub agsDriverExtensionsDX11_EndUAVOverlap +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_EndUAVOverlap() DX11_EndUAVOverlap_impl @ stub agsDriverExtensionsDX11_GetMaxClipRects @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology @ stdcall agsDriverExtensionsDX11_Init(ptr ptr long ptr) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index b6af95bd2b7..43b72d908ee 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -859,6 +859,32 @@ __ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, "jmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap") ) +AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap_520(AGSContext *context) +{ + static int once; + + if (!once++) + FIXME("context %p stub.\n", context); + return AGS_EXTENSION_NOT_SUPPORTED; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap(AGSContext *context, ID3D11DeviceContext *dx_context) +{ + static int once; + + if (!once++) + FIXME("context %p, dx_context %p stub.\n", context, dx_context); + + return AGS_EXTENSION_NOT_SUPPORTED; +} + +__ASM_GLOBAL_FUNC( DX11_EndUAVOverlap_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $3,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap_520") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap") ) + AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_520(AGSContext *context, ID3D11Device* device, unsigned int *device_ref, ID3D11DeviceContext *device_context, unsigned int *context_ref) From 0a78b9e1a15182e998511855439566c94130dd7a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 19 Apr 2023 14:50:31 -0600 Subject: [PATCH 0622/1506] amd_ags_x64: Store d3d11 immediate context in AGS context. CW-Bug-Id: #22242 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 65 ++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 43b72d908ee..74d6c8e432c 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -117,6 +117,7 @@ struct AGSContext struct AGSDeviceInfo *devices; VkPhysicalDeviceProperties *properties; VkPhysicalDeviceMemoryProperties *memory_properties; + ID3D11DeviceContext *d3d11_context; }; static HMODULE hd3d11, hd3d12; @@ -451,11 +452,9 @@ static AGSReturnCode init_ags_context(AGSContext *context) unsigned int i, j; BYTE *device; + memset(context, 0, sizeof(*context)); + context->version = determine_ags_version(); - context->device_count = 0; - context->devices = NULL; - context->properties = NULL; - context->memory_properties = NULL; ret = vk_get_physical_device_properties(&context->device_count, &context->properties, &context->memory_properties); if (ret != AGS_SUCCESS || !context->device_count) @@ -616,19 +615,24 @@ AGSReturnCode WINAPI agsDeInitialize(AGSContext *context) TRACE("context %p.\n", context); - if (context) + if (!context) + return AGS_SUCCESS; + + if (context->d3d11_context) { - heap_free(context->memory_properties); - heap_free(context->properties); - device = (BYTE *)context->devices; - for (i = 0; i < context->device_count; ++i) - { - heap_free(*GET_DEVICE_FIELD_ADDR(device, displays, void *, context->version)); - device += amd_ags_info[context->version].device_size; - } - heap_free(context->devices); - heap_free(context); + ID3D11DeviceContext_Release(context->d3d11_context); + context->d3d11_context = NULL; + } + heap_free(context->memory_properties); + heap_free(context->properties); + device = (BYTE *)context->devices; + for (i = 0; i < context->device_count; ++i) + { + heap_free(*GET_DEVICE_FIELD_ADDR(device, displays, void *, context->version)); + device += amd_ags_info[context->version].device_size; } + heap_free(context->devices); + heap_free(context); return AGS_SUCCESS; } @@ -722,6 +726,15 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, r->featureLevel = feature_level; } + if (context->version < AMD_AGS_VERSION_5_3_0) + { + /* Later versions pass context to functions explicitly, no need to keep it. */ + if (context->d3d11_context) + ID3D11DeviceContext_Release(context->d3d11_context); + ID3D11DeviceContext_AddRef(device_context); + context->d3d11_context = device_context; + } + return AGS_SUCCESS; } @@ -783,11 +796,25 @@ int WINAPI agsGetVersionNumber(void) return AGS_MAKE_VERSION(amd_ags_info[version].major, amd_ags_info[version].minor, amd_ags_info[version].patch); } -AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext* context, ID3D11Device* device, unsigned int uavSlot, unsigned int* extensionsSupported ) +AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext *context, ID3D11Device *device, unsigned int uavSlot, unsigned int *extensionsSupported ) { FIXME("context %p, device %p, uavSlot %u, extensionsSupported %p stub.\n", context, device, uavSlot, extensionsSupported); *extensionsSupported = 0; + if (device) + { + if (context->version < AMD_AGS_VERSION_5_3_0) + { + /* Later versions pass context to functions explicitly, no need to keep it. */ + if (context->d3d11_context) + { + ID3D11DeviceContext_Release(context->d3d11_context); + context->d3d11_context = NULL; + } + ID3D11Device_GetImmediateContext(device, &context->d3d11_context); + } + } + return AGS_SUCCESS; } @@ -897,6 +924,12 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_520(AGSContext *conte if (!device) return AGS_SUCCESS; + if (context->d3d11_context) + { + ID3D11DeviceContext_Release(context->d3d11_context); + context->d3d11_context = NULL; + } + ref = ID3D11Device_Release(device); if (device_ref) *device_ref = ref; From 08660ced85a0971871e0e05a42996db196d076fb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 19 Apr 2023 18:09:02 -0600 Subject: [PATCH 0623/1506] amd_ags_x64: Implement agsDriverExtensionsDX11_SetDepthBounds(). CW-Bug-Id: #22242 --- dlls/amd_ags_x64/Makefile.in | 3 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 78 +++++++++++++++--- dlls/amd_ags_x64/dxvk_interfaces.idl | 116 +++++++++++++++++++++++++++ 3 files changed, 186 insertions(+), 11 deletions(-) create mode 100644 dlls/amd_ags_x64/dxvk_interfaces.idl diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in index 74253dcf5fd..123d0603869 100644 --- a/dlls/amd_ags_x64/Makefile.in +++ b/dlls/amd_ags_x64/Makefile.in @@ -6,4 +6,5 @@ IMPORTLIB = amd_ags_x64 EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native SOURCES = \ - amd_ags_x64_main.c + amd_ags_x64_main.c \ + dxvk_interfaces.idl diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 74d6c8e432c..3c5f3043c21 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -14,6 +14,10 @@ #include "d3d11.h" #include "d3d12.h" +#include "initguid.h" + +#include "dxvk_interfaces.h" + #include "amd_ags.h" WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); @@ -118,6 +122,7 @@ struct AGSContext VkPhysicalDeviceProperties *properties; VkPhysicalDeviceMemoryProperties *memory_properties; ID3D11DeviceContext *d3d11_context; + AGSDX11ExtensionsSupported_600 extensions; }; static HMODULE hd3d11, hd3d12; @@ -659,6 +664,23 @@ AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count return AGS_SUCCESS; } +static void get_dx11_extensions_supported(ID3D11Device *device, AGSDX11ExtensionsSupported_600 *extensions) +{ + ID3D11VkExtDevice *ext_device; + + if (FAILED(ID3D11Device_QueryInterface(device, &IID_ID3D11VkExtDevice, (void **)&ext_device))) + { + TRACE("No ID3D11VkExtDevice.\n"); + return; + } + + extensions->depthBoundsTest = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_DEPTH_BOUNDS); + + ID3D11VkExtDevice_Release(ext_device); + + TRACE("extensions %#x.\n", *(unsigned int *)extensions); +} + AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, const AGSDX11DeviceCreationParams* creation_params, const AGSDX11ExtensionParams* extension_params, AGSDX11ReturnedParams* returned_params ) @@ -701,6 +723,9 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, ERR("Device creation failed, hr %#x.\n", hr); return AGS_DX_FAILURE; } + + get_dx11_extensions_supported(device, &context->extensions); + if (context->version < AMD_AGS_VERSION_5_2_0) { AGSDX11ReturnedParams_511 *r = &returned_params->agsDX11ReturnedParams511; @@ -708,6 +733,7 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, r->pImmediateContext = device_context; r->pSwapChain = swapchain; r->FeatureLevel = feature_level; + r->extensionsSupported = *(unsigned int *)&context->extensions; } else if (context->version < AMD_AGS_VERSION_6_0_0) { @@ -716,6 +742,7 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, r->pImmediateContext = device_context; r->pSwapChain = swapchain; r->FeatureLevel = feature_level; + r->extensionsSupported = *(unsigned int *)&context->extensions; } else { @@ -724,6 +751,7 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_CreateDevice( AGSContext* context, r->pImmediateContext = device_context; r->pSwapChain = swapchain; r->featureLevel = feature_level; + r->extensionsSupported = context->extensions; } if (context->version < AMD_AGS_VERSION_5_3_0) @@ -813,6 +841,8 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext *context, ID3D11De } ID3D11Device_GetImmediateContext(device, &context->d3d11_context); } + get_dx11_extensions_supported(device, &context->extensions); + *extensionsSupported = *(unsigned int *)&context->extensions; } return AGS_SUCCESS; @@ -833,24 +863,52 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) } #ifdef __x86_64__ + +static AGSReturnCode set_depth_bounds(AGSContext* context, ID3D11DeviceContext *dx_context, bool enabled, + float min_depth, float max_depth) +{ + ID3D11VkExtContext *ext_context; + + if (!context->extensions.depthBoundsTest) + return AGS_EXTENSION_NOT_SUPPORTED; + + if (FAILED(ID3D11DeviceContext_QueryInterface(dx_context, &IID_ID3D11VkExtContext, (void **)&ext_context))) + { + TRACE("No ID3D11VkExtContext.\n"); + return AGS_EXTENSION_NOT_SUPPORTED; + } + ID3D11VkExtContext_SetDepthBoundsTest(ext_context, enabled, min_depth, max_depth); + ID3D11VkExtContext_Release(ext_context); + return AGS_SUCCESS; +} + AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds(AGSContext* context, bool enabled, - float minDepth, float maxDepth ) + float min_depth, float max_depth ) { - static int once; + TRACE("context %p, enabled %d, min_depth %f, max_depth %f.\n", context, enabled, min_depth, max_depth); - if (!once++) - FIXME("context %p, enabled %#x, minDepth %f, maxDepth %f stub.\n", context, enabled, minDepth, maxDepth); - return AGS_EXTENSION_NOT_SUPPORTED; + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + return set_depth_bounds(context, context->d3d11_context, enabled, min_depth, max_depth); } AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds_530(AGSContext* context, - ID3D11DeviceContext* dxContext, bool enabled, float minDepth, float maxDepth ) + ID3D11DeviceContext* dx_context, bool enabled, float min_depth, float max_depth ) { - static int once; + TRACE("context %p, dx_context %p, enabled %d, min_depth %f, max_depth %f.\n", context, dx_context, enabled, + min_depth, max_depth); - if (!once++) - FIXME("context %p, enabled %#x, minDepth %f, maxDepth %f stub.\n", context, enabled, minDepth, maxDepth); - return AGS_EXTENSION_NOT_SUPPORTED; + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + return set_depth_bounds(context, dx_context, enabled, min_depth, max_depth); } __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, diff --git a/dlls/amd_ags_x64/dxvk_interfaces.idl b/dlls/amd_ags_x64/dxvk_interfaces.idl new file mode 100644 index 00000000000..c632d926fb2 --- /dev/null +++ b/dlls/amd_ags_x64/dxvk_interfaces.idl @@ -0,0 +1,116 @@ +/* + * Copyright 2023 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "d3d11.idl"; + +typedef enum D3D11_VK_EXTENSION +{ + D3D11_VK_EXT_MULTI_DRAW_INDIRECT, + D3D11_VK_EXT_MULTI_DRAW_INDIRECT_COUNT, + D3D11_VK_EXT_DEPTH_BOUNDS, + D3D11_VK_EXT_BARRIER_CONTROL, + D3D11_VK_NVX_BINARY_IMPORT, + D3D11_VK_NVX_IMAGE_VIEW_HANDLE, +} D3D11_VK_EXTENSION; + +typedef enum D3D11_VK_BARRIER_CONTROL +{ + D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE = 0x1, + D3D11_VK_BARRIER_CONTROL_IGNORE_GRAPHICS_UAV = 0x2, +} D3D11_VK_BARRIER_CONTROL; + +[ + object, + uuid(bb8a4fb9-3935-4762-b44b-35189a26414a), + local, + pointer_default(unique) +] +interface ID3D11VkExtShader : IUnknown +{ + HRESULT GetSpirvCode([in, out] SIZE_T *code_size, [out] void *code); +} + +[ + object, + uuid(8a6e3c42-f74c-45b7-8265-a231b677ca17), + local, + pointer_default(unique) +] +interface ID3D11VkExtDevice : IUnknown +{ + BOOL GetExtensionSupport([in] D3D11_VK_EXTENSION extension); +} + +[ + object, + uuid(cfcf64ef-9586-46d0-bca4-97cf2ca61b06), + local, + pointer_default(unique) +] +interface ID3D11VkExtDevice1 : ID3D11VkExtDevice +{ + BOOL GetResourceHandleGPUVirtualAddressAndSizeNVX([in] void *object, [out] UINT64 *gpu_va_start, + [out] UINT64 *gpu_va_size); + BOOL CreateUnorderedAccessViewAndGetDriverHandleNVX([in] ID3D11Resource *resource, + [in] const D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, [out] ID3D11UnorderedAccessView **uav, + UINT32 *driver_handle); + BOOL CreateShaderResourceViewAndGetDriverHandleNVX([in] ID3D11Resource *resource, + [in] const D3D11_SHADER_RESOURCE_VIEW_DESC* desc, [out] ID3D11ShaderResourceView **srv, + UINT32 *dirver_handle); + BOOL CreateSamplerStateAndGetDriverHandleNVX([in] const D3D11_SAMPLER_DESC *sample_desc, + [out] ID3D11SamplerState **sample_state, UINT32 *driver_handle); + BOOL CreateCubinComputeShaderWithNameNVX([in] const void *cubin, [in] UINT32 size, [in] UINT32 block_x, + [in] UINT32 block_y, [in] UINT32 block_z, [in] const char *shader_name, [out] IUnknown **shader); + BOOL GetCudaTextureObjectNVX([in] UINT32 srv_driver_hadnle, [in] UINT32 sample_driver_handle, + [out] UINT32 *cuda_texture_handle); +} + +[ + object, + uuid(fd0bca13-5cb6-4c3a-987e-4750de2ca791), + local, + pointer_default(unique) +] +interface ID3D11VkExtContext : IUnknown +{ + void MultiDrawIndirect([in] UINT draw_count, [in] ID3D11Buffer *buffer_for_args, [in] UINT byte_offset_for_args, + [in] UINT byte_stride_for_args); + void MultiDrawIndexedIndirect([in] UINT draw_count, [in] ID3D11Buffer *buffer_for_args, + [in] UINT byte_offset_for_args, [in] UINT byte_stride_for_args); + void MultiDrawIndirectCount([in] UINT max_draw_count, [in] ID3D11Buffer *buffer_for_count, + [in] UINT byte_offset_for_count, [in] ID3D11Buffer *buffer_for_args, + [in] UINT byte_offset_for_args, [in] UINT byte_stride_for_args); + void MultiDrawIndexedIndirectCount([in] UINT max_draw_count, [in] ID3D11Buffer *buffer_for_count, + [in] UINT byte_offset_for_count, [in] ID3D11Buffer *buffer_for_args, + [in] UINT byte_offset_for_args, [in] UINT byte_stride_for_args); + void SetDepthBoundsTest([in] BOOL enable, [in] FLOAT min_depth_bounds, [in] FLOAT max_depth_bounds); + void SetBarrierControl([in] UINT control_flags); +} + +[ + object, + uuid(874b09b2-ae0b-41d8-8476-5f3b7a0e879d), + local, + pointer_default(unique) +] +interface ID3D11VkExtContext1 : ID3D11VkExtContext +{ + BOOL LaunchCubinShaderNVX([in] IUnknown *shader,[in] UINT32 grid_x, [in] UINT32 grid_y, [in] UINT32 grid_z, + [in] const void *params, [in] UINT32 param_size, [in] void * const *read_resources, + [in] UINT32 read_resource_count, [in] void* const *write_resources, [in] UINT32 write_resources_count); +} From 305053ca8a26e7a919aa71dfee07c84b2648883f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 4 May 2023 20:15:20 -0600 Subject: [PATCH 0624/1506] amd_ags_x64: Implement UAV overlap. CW-Bug-Id: #22242 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 66 ++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 3c5f3043c21..db1b3294902 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -675,6 +675,8 @@ static void get_dx11_extensions_supported(ID3D11Device *device, AGSDX11Extension } extensions->depthBoundsTest = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_DEPTH_BOUNDS); + extensions->uavOverlap = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_BARRIER_CONTROL); + extensions->UAVOverlapDeferredContexts = extensions->uavOverlap; ID3D11VkExtDevice_Release(ext_device); @@ -918,23 +920,48 @@ __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) +static AGSReturnCode update_uav_overlap(AGSContext* context, ID3D11DeviceContext *dx_context, BOOL set) +{ + ID3D11VkExtContext *ext_context; + + if (!context->extensions.uavOverlap) + return AGS_EXTENSION_NOT_SUPPORTED; + + if (FAILED(ID3D11DeviceContext_QueryInterface(dx_context, &IID_ID3D11VkExtContext, (void **)&ext_context))) + { + TRACE("No ID3D11VkExtContext.\n"); + return AGS_EXTENSION_NOT_SUPPORTED; + } + + ID3D11VkExtContext_SetBarrierControl(ext_context, set ? D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE : 0); + ID3D11VkExtContext_Release(ext_context); + return AGS_SUCCESS; +} + AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap_520(AGSContext *context) { - static int once; + TRACE("context %p.\n", context); - if (!once++) - FIXME("context %p stub.\n", context); - return AGS_EXTENSION_NOT_SUPPORTED; + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + return update_uav_overlap(context, context->d3d11_context, TRUE); } AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap(AGSContext *context, ID3D11DeviceContext *dx_context) { - static int once; + TRACE("context %p, dx_context %p.\n", context, dx_context); - if (!once++) - FIXME("context %p, dx_context %p stub.\n", context, dx_context); + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } - return AGS_EXTENSION_NOT_SUPPORTED; + return update_uav_overlap(context, dx_context, TRUE); } __ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, @@ -946,21 +973,28 @@ __ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap_520(AGSContext *context) { - static int once; + TRACE("context %p.\n", context); - if (!once++) - FIXME("context %p stub.\n", context); - return AGS_EXTENSION_NOT_SUPPORTED; + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + return update_uav_overlap(context, context->d3d11_context, FALSE); } AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap(AGSContext *context, ID3D11DeviceContext *dx_context) { - static int once; + TRACE("context %p, dx_context %p.\n", context, dx_context); - if (!once++) - FIXME("context %p, dx_context %p stub.\n", context, dx_context); + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } - return AGS_EXTENSION_NOT_SUPPORTED; + return update_uav_overlap(context, dx_context, FALSE); } __ASM_GLOBAL_FUNC( DX11_EndUAVOverlap_impl, From 3f0218e89d9964a8cbea89f2de8639e7bda72189 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 May 2023 17:16:58 -0600 Subject: [PATCH 0625/1506] amd_ags_x64: Update to 6.1.0. --- dlls/amd_ags_x64/amd_ags.h | 5 +++-- dlls/amd_ags_x64/amd_ags_x64_main.c | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 9b521de75b8..f0afda73d37 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -417,6 +417,7 @@ typedef enum AsicFamily AsicFamily_Vega, ///< AMD Vega architecture, including Raven Ridge (ie AMD Ryzen CPU + AMD Vega GPU). AsicFamily_RDNA, ///< AMD RDNA architecture AsicFamily_RDNA2, ///< AMD RDNA2 architecture + AsicFamily_RDNA3, ///< AMD RDNA3 architecture AsicFamily_Count ///< Number of enumerated ASIC families } AsicFamily; @@ -1422,11 +1423,11 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX11_WriteBreadcrumb( AGSContext* c /// @{ /// Additional topologies supported via extensions -typedef enum AGSPrimitiveTopology +typedef enum AGSPrimitiveTopologyDX11 { AGS_PRIMITIVE_TOPOLOGY_QUADLIST = 7, ///< Quad list AGS_PRIMITIVE_TOPOLOGY_SCREENRECTLIST = 9 ///< Screen rect list -} AGSPrimitiveTopology; +} AGSPrimitiveTopologyDX11; /// /// Function used to set the primitive topology. If you are using any of the extended topology types, then this function should diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index db1b3294902..97bdeb2dc87 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -33,6 +33,7 @@ enum amd_ags_version AMD_AGS_VERSION_5_4_2, AMD_AGS_VERSION_6_0_0, AMD_AGS_VERSION_6_0_1, + AMD_AGS_VERSION_6_1_0, AMD_AGS_VERSION_COUNT }; @@ -56,23 +57,24 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {5, 4, 2, sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520)}, {6, 0, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, {6, 0, 1, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, + {6, 1, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ - -1, -1, -1, -1}} + -1, -1, -1, -1, -1}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1, \ - -1}} + -1, -1}} #define DEVICE_FIELD_adapterString 0 #define DEVICE_FIELD_architectureVersion 1 From 76d9fe43cce9bfe48fa829d4672edd8671d72874 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 May 2023 17:43:41 -0600 Subject: [PATCH 0626/1506] amd_ags_x64: Set isAPU field in device info. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 97bdeb2dc87..dcba20458fc 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -71,6 +71,10 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} +#define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, \ + -1, -1, offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ + -1, -1, -1}} #define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1, \ @@ -85,6 +89,7 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = #define DEVICE_FIELD_localMemoryInBytes 6 #define DEVICE_FIELD_numDisplays 7 #define DEVICE_FIELD_displays 8 +#define DEVICE_FIELD_isAPU 9 static const struct { @@ -102,6 +107,7 @@ device_struct_fields[] = DEF_FIELD(localMemoryInBytes), DEF_FIELD(numDisplays), DEF_FIELD(displays), + DEF_FIELD_540_600(isAPU), }; #undef DEF_FIELD @@ -482,6 +488,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) { const VkPhysicalDeviceProperties *vk_properties = &context->properties[i]; const VkPhysicalDeviceMemoryProperties *vk_memory_properties = &context->memory_properties[i]; + struct AGSDeviceInfo_600 *device_600 = (struct AGSDeviceInfo_600 *)device; VkDeviceSize local_memory_size = 0; for (j = 0; j < vk_memory_properties->memoryHeapCount; j++) @@ -492,7 +499,9 @@ static AGSReturnCode init_ags_context(AGSContext *context) break; } } - TRACE("device %s, %04x:%04x, reporting local memory size 0x%s bytes\n", debugstr_a(vk_properties->deviceName), + + TRACE("device %s, type %d, %04x:%04x, reporting local memory size 0x%s bytes\n", + debugstr_a(vk_properties->deviceName), vk_properties->deviceType, vk_properties->vendorID, vk_properties->deviceID, wine_dbgstr_longlong(local_memory_size)); SET_DEVICE_FIELD(device, adapterString, const char *, context->version, vk_properties->deviceName); @@ -502,6 +511,13 @@ static AGSReturnCode init_ags_context(AGSContext *context) { SET_DEVICE_FIELD(device, architectureVersion, ArchitectureVersion, context->version, ArchitectureVersion_GCN); SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, AsicFamily_GCN4); + if (vk_properties->deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) + { + if (context->version >= AMD_AGS_VERSION_6_0_0) + device_600->isAPU = 1; + else + SET_DEVICE_FIELD(device, isAPU, int, context->version, 1); + } } SET_DEVICE_FIELD(device, localMemoryInBytes, ULONG64, context->version, local_memory_size); if (!i) @@ -509,7 +525,6 @@ static AGSReturnCode init_ags_context(AGSContext *context) if (context->version >= AMD_AGS_VERSION_6_0_0) { // This is a bitfield now... Nice... - struct AGSDeviceInfo_600 *device_600 = (struct AGSDeviceInfo_600 *)device; device_600->isPrimaryDevice = 1; } else From feb765e5354939041024796e504222bd715ad185 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 May 2023 17:55:53 -0600 Subject: [PATCH 0627/1506] amd_ags_x64: Skip non-physical devices. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index dcba20458fc..3706e21915c 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -221,10 +221,18 @@ static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, } for (i = 0; i < count; ++i) + { vkGetPhysicalDeviceProperties(vk_physical_devices[i], &properties[i]); - - for (i = 0; i < count; ++i) + if (properties[i].deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU + && properties[i].deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) + { + TRACE("Skipping device type %d.\n", properties[i].deviceType); + --i; + --count; + continue; + } vkGetPhysicalDeviceMemoryProperties(vk_physical_devices[i], &memory_properties[i]); + } *out_count = count; *out = properties; From 891337c51995caf1c7c1512de1713646a76f222b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 10 Jul 2020 10:09:21 +0200 Subject: [PATCH 0628/1506] atiadlxx: Add stub DLL, disabled by default. This is required by several Call of Duty games when using AMD GPU. --- configure.ac | 1 + dlls/atiadlxx/Makefile.in | 6 + dlls/atiadlxx/atiadlxx.spec | 1138 +++++++++++++++++++++++++++++++++ dlls/atiadlxx/atiadlxx_main.c | 91 +++ loader/wine.inf.in | 1 + 5 files changed, 1237 insertions(+) create mode 100644 dlls/atiadlxx/Makefile.in create mode 100644 dlls/atiadlxx/atiadlxx.spec create mode 100644 dlls/atiadlxx/atiadlxx_main.c diff --git a/configure.ac b/configure.ac index ec29d4203f7..2e6e905e83a 100644 --- a/configure.ac +++ b/configure.ac @@ -2440,6 +2440,7 @@ WINE_CONFIG_MAKEFILE(dlls/apphelp) WINE_CONFIG_MAKEFILE(dlls/apphelp/tests) WINE_CONFIG_MAKEFILE(dlls/appwiz.cpl) WINE_CONFIG_MAKEFILE(dlls/appxdeploymentclient) +WINE_CONFIG_MAKEFILE(dlls/atiadlxx) WINE_CONFIG_MAKEFILE(dlls/atl) WINE_CONFIG_MAKEFILE(dlls/atl/tests) WINE_CONFIG_MAKEFILE(dlls/atl100) diff --git a/dlls/atiadlxx/Makefile.in b/dlls/atiadlxx/Makefile.in new file mode 100644 index 00000000000..80f456edb75 --- /dev/null +++ b/dlls/atiadlxx/Makefile.in @@ -0,0 +1,6 @@ +EXTRADEFS = -DWINE_NO_LONG_TYPES +MODULE = atiadlxx.dll +EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native + +SOURCES = \ + atiadlxx_main.c diff --git a/dlls/atiadlxx/atiadlxx.spec b/dlls/atiadlxx/atiadlxx.spec new file mode 100644 index 00000000000..e2a1f46a838 --- /dev/null +++ b/dlls/atiadlxx/atiadlxx.spec @@ -0,0 +1,1138 @@ +@ stub ADL2_ADC_CurrentProfileFromDrv_Get +@ stub ADL2_ADC_Display_AdapterDeviceProfileEx_Get +@ stub ADL2_ADC_DrvDataToProfile_Copy +@ stub ADL2_ADC_FindClosestMode_Get +@ stub ADL2_ADC_IsDevModeEqual_Get +@ stub ADL2_ADC_Profile_Apply +@ stub ADL2_APO_AudioDelayAdjustmentInfo_Get +@ stub ADL2_APO_AudioDelay_Restore +@ stub ADL2_APO_AudioDelay_Set +@ stub ADL2_AdapterLimitation_Caps +@ stub ADL2_AdapterX2_Caps +@ stub ADL2_Adapter_AMDAndNonAMDDIsplayClone_Get +@ stub ADL2_Adapter_ASICFamilyType_Get +@ stub ADL2_Adapter_ASICInfo_Get +@ stub ADL2_Adapter_Accessibility_Get +@ stub ADL2_Adapter_AceDefaults_Restore +@ stub ADL2_Adapter_Active_Get +@ stub ADL2_Adapter_Active_Set +@ stub ADL2_Adapter_Active_SetPrefer +@ stub ADL2_Adapter_AdapterInfoX2_Get +@ stub ADL2_Adapter_AdapterInfoX3_Get +@ stub ADL2_Adapter_AdapterInfoX4_Get +@ stub ADL2_Adapter_AdapterInfo_Get +@ stub ADL2_Adapter_AdapterList_Disable +@ stub ADL2_Adapter_AdapterLocationPath_Get +@ stub ADL2_Adapter_Aspects_Get +@ stub ADL2_Adapter_AudioChannelSplitConfiguration_Get +@ stub ADL2_Adapter_AudioChannelSplit_Disable +@ stub ADL2_Adapter_AudioChannelSplit_Enable +@ stub ADL2_Adapter_BigSw_Info_Get +@ stub ADL2_Adapter_BlackAndWhiteLevelSupport_Get +@ stub ADL2_Adapter_BlackAndWhiteLevel_Get +@ stub ADL2_Adapter_BlackAndWhiteLevel_Set +@ stub ADL2_Adapter_BoardLayout_Get +@ stub ADL2_Adapter_Caps +@ stub ADL2_Adapter_ChipSetInfo_Get +@ stub ADL2_Adapter_CloneTypes_Get +@ stub ADL2_Adapter_ConfigMemory_Cap +@ stub ADL2_Adapter_ConfigMemory_Get +@ stub ADL2_Adapter_ConfigureState_Get +@ stub ADL2_Adapter_ConnectionData_Get +@ stub ADL2_Adapter_ConnectionData_Remove +@ stub ADL2_Adapter_ConnectionData_Set +@ stub ADL2_Adapter_ConnectionState_Get +@ stub ADL2_Adapter_CrossDisplayPlatformInfo_Get +@ stub ADL2_Adapter_CrossGPUClone_Disable +@ stub ADL2_Adapter_CrossdisplayAdapterRole_Caps +@ stub ADL2_Adapter_CrossdisplayInfoX2_Set +@ stub ADL2_Adapter_CrossdisplayInfo_Get +@ stub ADL2_Adapter_CrossdisplayInfo_Set +@ stub ADL2_Adapter_CrossfireX2_Get +@ stub ADL2_Adapter_Crossfire_Caps +@ stub ADL2_Adapter_Crossfire_Get +@ stub ADL2_Adapter_Crossfire_Set +@ stub ADL2_Adapter_DefaultAudioChannelTable_Load +@ stub ADL2_Adapter_Desktop_Caps +@ stub ADL2_Adapter_Desktop_SupportedSLSGridTypes_Get +@ stub ADL2_Adapter_DeviceID_Get +@ stub ADL2_Adapter_DisplayAudioEndpoint_Enable +@ stub ADL2_Adapter_DisplayAudioEndpoint_Mute +@ stub ADL2_Adapter_DisplayAudioInfo_Get +@ stub ADL2_Adapter_DisplayGTCCaps_Get +@ stub ADL2_Adapter_Display_Caps +@ stub ADL2_Adapter_DriverSettings_Get +@ stub ADL2_Adapter_DriverSettings_Set +@ stub ADL2_Adapter_ECC_ErrorInjection_Set +@ stub ADL2_Adapter_ECC_ErrorRecords_Get +@ stub ADL2_Adapter_EDC_ErrorInjection_Set +@ stub ADL2_Adapter_EDC_ErrorRecords_Get +@ stub ADL2_Adapter_EDIDManagement_Caps +@ stub ADL2_Adapter_EmulationMode_Set +@ stub ADL2_Adapter_ExtInfo_Get +@ stub ADL2_Adapter_Feature_Caps +@ stub ADL2_Adapter_FrameMetrics_Caps +@ stub ADL2_Adapter_FrameMetrics_FrameDuration_Disable +@ stub ADL2_Adapter_FrameMetrics_FrameDuration_Enable +@ stub ADL2_Adapter_FrameMetrics_FrameDuration_Get +@ stub ADL2_Adapter_FrameMetrics_FrameDuration_Start +@ stub ADL2_Adapter_FrameMetrics_FrameDuration_Stop +@ stub ADL2_Adapter_FrameMetrics_Get +@ stub ADL2_Adapter_FrameMetrics_Start +@ stub ADL2_Adapter_FrameMetrics_Stop +@ stub ADL2_Adapter_Gamma_Get +@ stub ADL2_Adapter_Gamma_Set +@ stub ADL2_Adapter_Graphic_Core_Info_Get +@ stub ADL2_Adapter_HBC_Caps +@ stub ADL2_Adapter_HBM_ECC_UC_Check +@ stub ADL2_Adapter_Headless_Get +@ stub ADL2_Adapter_ID_Get +@ stub ADL2_Adapter_IsGamingDriver_Info_Get +@ stub ADL2_Adapter_LocalDisplayConfig_Get +@ stub ADL2_Adapter_LocalDisplayConfig_Set +@ stub ADL2_Adapter_LocalDisplayState_Get +@ stub ADL2_Adapter_MVPU_Set +@ stub ADL2_Adapter_MaxCursorSize_Get +@ stub ADL2_Adapter_MemoryInfo2_Get +@ stub ADL2_Adapter_MemoryInfo_Get +@ stub ADL2_Adapter_MirabilisSupport_Get +@ stub ADL2_Adapter_ModeSwitch +@ stub ADL2_Adapter_ModeTimingOverride_Caps +@ stub ADL2_Adapter_Modes_ReEnumerate +@ stub ADL2_Adapter_NumberOfActivatableSources_Get +@ stdcall ADL2_Adapter_NumberOfAdapters_Get(ptr ptr) +@ stub ADL2_Adapter_ObservedClockInfo_Get +@ stub ADL2_Adapter_PMLog_Start +@ stub ADL2_Adapter_PMLog_Stop +@ stub ADL2_Adapter_PMLog_Support_Get +@ stub ADL2_Adapter_PreFlipPostProcessing_Disable +@ stub ADL2_Adapter_PreFlipPostProcessing_Enable +@ stub ADL2_Adapter_PreFlipPostProcessing_Get_Status +@ stub ADL2_Adapter_PreFlipPostProcessing_Select_LUT_Algorithm +@ stub ADL2_Adapter_PreFlipPostProcessing_Select_LUT_Buffer +@ stub ADL2_Adapter_PreFlipPostProcessing_Unselect_LUT_Buffer +@ stub ADL2_Adapter_Primary_Get +@ stub ADL2_Adapter_Primary_Set +@ stub ADL2_Adapter_RAS_ErrorInjection_Set +@ stub ADL2_Adapter_RegValueInt_Get +@ stub ADL2_Adapter_RegValueInt_Set +@ stub ADL2_Adapter_RegValueString_Get +@ stub ADL2_Adapter_RegValueString_Set +@ stub ADL2_Adapter_SWInfo_Get +@ stub ADL2_Adapter_Speed_Caps +@ stub ADL2_Adapter_Speed_Get +@ stub ADL2_Adapter_Speed_Set +@ stub ADL2_Adapter_SupportedConnections_Get +@ stub ADL2_Adapter_TRNG_Get +@ stub ADL2_Adapter_Tear_Free_Cap +@ stub ADL2_Adapter_VRAMUsage_Get +@ stub ADL2_Adapter_VariBrightEnable_Set +@ stub ADL2_Adapter_VariBrightLevel_Get +@ stub ADL2_Adapter_VariBrightLevel_Set +@ stub ADL2_Adapter_VariBright_Caps +@ stub ADL2_Adapter_VerndorID_Int_get +@ stub ADL2_Adapter_VideoBiosInfo_Get +@ stub ADL2_Adapter_VideoTheaterModeInfo_Get +@ stub ADL2_Adapter_VideoTheaterModeInfo_Set +@ stub ADL2_Adapter_XConnectSupport_Get +@ stub ADL2_ApplicationProfilesX2_AppInterceptionList_Set +@ stub ADL2_ApplicationProfilesX2_AppStartStopInfo_Get +@ stub ADL2_ApplicationProfiles_AppInterceptionList_Set +@ stub ADL2_ApplicationProfiles_AppInterception_Set +@ stub ADL2_ApplicationProfiles_AppStartStopInfo_Get +@ stub ADL2_ApplicationProfiles_AppStartStop_Resume +@ stub ADL2_ApplicationProfiles_Applications_Get +@ stub ADL2_ApplicationProfiles_ConvertToCompact +@ stub ADL2_ApplicationProfiles_DriverAreaPrivacy_Get +@ stub ADL2_ApplicationProfiles_GetCustomization +@ stub ADL2_ApplicationProfiles_HitListsX2_Get +@ stub ADL2_ApplicationProfiles_HitListsX3_Get +@ stub ADL2_ApplicationProfiles_HitLists_Get +@ stub ADL2_ApplicationProfiles_ProfileApplicationX2_Assign +@ stub ADL2_ApplicationProfiles_ProfileApplication_Assign +@ stub ADL2_ApplicationProfiles_ProfileOfAnApplicationX2_Search +@ stub ADL2_ApplicationProfiles_ProfileOfAnApplication_InMemorySearch +@ stub ADL2_ApplicationProfiles_ProfileOfAnApplication_Search +@ stub ADL2_ApplicationProfiles_Profile_Create +@ stub ADL2_ApplicationProfiles_Profile_Exist +@ stub ADL2_ApplicationProfiles_Profile_Remove +@ stub ADL2_ApplicationProfiles_PropertyType_Get +@ stub ADL2_ApplicationProfiles_Release_Get +@ stub ADL2_ApplicationProfiles_RemoveApplication +@ stub ADL2_ApplicationProfiles_StatusInfo_Get +@ stub ADL2_ApplicationProfiles_System_Reload +@ stub ADL2_ApplicationProfiles_User_Load +@ stub ADL2_ApplicationProfiles_User_Unload +@ stub ADL2_Audio_CurrentSampleRate_Get +@ stub ADL2_AutoTuningResult_Get +@ stub ADL2_BOOST_Settings_Get +@ stub ADL2_BOOST_Settings_Set +@ stub ADL2_Blockchain_BlockchainMode_Caps +@ stub ADL2_Blockchain_BlockchainMode_Get +@ stub ADL2_Blockchain_BlockchainMode_Set +@ stub ADL2_Blockchain_Hashrate_Set +@ stub ADL2_CDS_UnsafeMode_Set +@ stub ADL2_CHILL_SettingsX2_Get +@ stub ADL2_CHILL_SettingsX2_Set +@ stub ADL2_CV_DongleSettings_Get +@ stub ADL2_CV_DongleSettings_Reset +@ stub ADL2_CV_DongleSettings_Set +@ stub ADL2_Chill_Caps_Get +@ stub ADL2_Chill_Settings_Get +@ stub ADL2_Chill_Settings_Notify +@ stub ADL2_Chill_Settings_Set +@ stub ADL2_CustomFan_Caps +@ stub ADL2_CustomFan_Get +@ stub ADL2_CustomFan_Set +@ stub ADL2_DELAG_Settings_Get +@ stub ADL2_DELAG_Settings_Set +@ stub ADL2_DFP_AllowOnlyCETimings_Get +@ stub ADL2_DFP_AllowOnlyCETimings_Set +@ stub ADL2_DFP_BaseAudioSupport_Get +@ stub ADL2_DFP_GPUScalingEnable_Get +@ stub ADL2_DFP_GPUScalingEnable_Set +@ stub ADL2_DFP_HDMISupport_Get +@ stub ADL2_DFP_MVPUAnalogSupport_Get +@ stub ADL2_DFP_PixelFormat_Caps +@ stub ADL2_DFP_PixelFormat_Get +@ stub ADL2_DFP_PixelFormat_Set +@ stub ADL2_DVRSupport_Get +@ stub ADL2_Desktop_DOPP_Enable +@ stub ADL2_Desktop_DOPP_EnableX2 +@ stub ADL2_Desktop_Detach +@ stub ADL2_Desktop_Device_Create +@ stub ADL2_Desktop_Device_Destroy +@ stub ADL2_Desktop_ExclusiveModeX2_Get +@ stub ADL2_Desktop_HardwareCursor_SetBitmap +@ stub ADL2_Desktop_HardwareCursor_SetPosition +@ stub ADL2_Desktop_HardwareCursor_Toggle +@ stub ADL2_Desktop_PFPAComplete_Set +@ stub ADL2_Desktop_PFPAState_Get +@ stub ADL2_Desktop_PrimaryInfo_Get +@ stub ADL2_Desktop_TextureState_Get +@ stub ADL2_Desktop_Texture_Enable +@ stub ADL2_Device_PMLog_Device_Create +@ stub ADL2_Device_PMLog_Device_Destroy +@ stub ADL2_DisplayScaling_Set +@ stub ADL2_Display_AdapterID_Get +@ stub ADL2_Display_AdjustCaps_Get +@ stub ADL2_Display_AdjustmentCoherent_Get +@ stub ADL2_Display_AdjustmentCoherent_Set +@ stub ADL2_Display_AudioMappingInfo_Get +@ stub ADL2_Display_AvivoColor_Get +@ stub ADL2_Display_AvivoCurrentColor_Set +@ stub ADL2_Display_AvivoDefaultColor_Set +@ stub ADL2_Display_BackLight_Get +@ stub ADL2_Display_BackLight_Set +@ stub ADL2_Display_BezelOffsetSteppingSize_Get +@ stub ADL2_Display_BezelOffset_Set +@ stub ADL2_Display_BezelSupported_Validate +@ stub ADL2_Display_Capabilities_Get +@ stub ADL2_Display_ColorCaps_Get +@ stub ADL2_Display_ColorDepth_Get +@ stub ADL2_Display_ColorDepth_Set +@ stub ADL2_Display_ColorTemperatureSourceDefault_Get +@ stub ADL2_Display_ColorTemperatureSource_Get +@ stub ADL2_Display_ColorTemperatureSource_Set +@ stub ADL2_Display_Color_Get +@ stub ADL2_Display_Color_Set +@ stub ADL2_Display_ConnectedDisplays_Get +@ stub ADL2_Display_ContainerID_Get +@ stub ADL2_Display_ControllerOverlayAdjustmentCaps_Get +@ stub ADL2_Display_ControllerOverlayAdjustmentData_Get +@ stub ADL2_Display_ControllerOverlayAdjustmentData_Set +@ stub ADL2_Display_CustomizedModeListNum_Get +@ stub ADL2_Display_CustomizedModeList_Get +@ stub ADL2_Display_CustomizedMode_Add +@ stub ADL2_Display_CustomizedMode_Delete +@ stub ADL2_Display_CustomizedMode_Validate +@ stub ADL2_Display_DCE_Get +@ stub ADL2_Display_DCE_Set +@ stub ADL2_Display_DDCBlockAccess_Get +@ stub ADL2_Display_DDCInfo2_Get +@ stub ADL2_Display_DDCInfo_Get +@ stub ADL2_Display_Deflicker_Get +@ stub ADL2_Display_Deflicker_Set +@ stub ADL2_Display_DeviceConfig_Get +@ stub ADL2_Display_DisplayContent_Cap +@ stub ADL2_Display_DisplayContent_Get +@ stub ADL2_Display_DisplayContent_Set +@ stub ADL2_Display_DisplayInfo_Get +@ stub ADL2_Display_DisplayMapConfigX2_Set +@ stub ADL2_Display_DisplayMapConfig_Get +@ stub ADL2_Display_DisplayMapConfig_PossibleAddAndRemove +@ stub ADL2_Display_DisplayMapConfig_Set +@ stub ADL2_Display_DisplayMapConfig_Validate +@ stub ADL2_Display_DitherState_Get +@ stub ADL2_Display_DitherState_Set +@ stub ADL2_Display_Downscaling_Caps +@ stub ADL2_Display_DpMstAuxMsg_Get +@ stub ADL2_Display_DpMstInfo_Get +@ stub ADL2_Display_DummyVirtual_Destroy +@ stub ADL2_Display_DummyVirtual_Get +@ stub ADL2_Display_EdidData_Get +@ stub ADL2_Display_EdidData_Set +@ stub ADL2_Display_EnumDisplays_Get +@ stub ADL2_Display_FilterSVideo_Get +@ stub ADL2_Display_FilterSVideo_Set +@ stub ADL2_Display_ForcibleDisplay_Get +@ stub ADL2_Display_ForcibleDisplay_Set +@ stub ADL2_Display_FormatsOverride_Get +@ stub ADL2_Display_FormatsOverride_Set +@ stub ADL2_Display_FreeSyncState_Get +@ stub ADL2_Display_FreeSyncState_Set +@ stub ADL2_Display_FreeSync_Cap +@ stub ADL2_Display_GamutMapping_Get +@ stub ADL2_Display_GamutMapping_Reset +@ stub ADL2_Display_GamutMapping_Set +@ stub ADL2_Display_Gamut_Caps +@ stub ADL2_Display_Gamut_Get +@ stub ADL2_Display_Gamut_Set +@ stub ADL2_Display_HDCP_Get +@ stub ADL2_Display_HDCP_Set +@ stub ADL2_Display_HDRState_Get +@ stub ADL2_Display_HDRState_Set +@ stub ADL2_Display_ImageExpansion_Get +@ stub ADL2_Display_ImageExpansion_Set +@ stub ADL2_Display_InfoPacket_Get +@ stub ADL2_Display_InfoPacket_Set +@ stub ADL2_Display_IsVirtual_Get +@ stub ADL2_Display_LCDRefreshRateCapability_Get +@ stub ADL2_Display_LCDRefreshRateOptions_Get +@ stub ADL2_Display_LCDRefreshRateOptions_Set +@ stub ADL2_Display_LCDRefreshRate_Get +@ stub ADL2_Display_LCDRefreshRate_Set +@ stub ADL2_Display_Limits_Get +@ stub ADL2_Display_MVPUCaps_Get +@ stub ADL2_Display_MVPUStatus_Get +@ stub ADL2_Display_ModeTimingOverrideInfo_Get +@ stub ADL2_Display_ModeTimingOverrideListX2_Get +@ stub ADL2_Display_ModeTimingOverrideListX3_Get +@ stub ADL2_Display_ModeTimingOverrideList_Get +@ stub ADL2_Display_ModeTimingOverrideX2_Get +@ stub ADL2_Display_ModeTimingOverrideX2_Set +@ stub ADL2_Display_ModeTimingOverrideX3_Get +@ stub ADL2_Display_ModeTimingOverride_Delete +@ stub ADL2_Display_ModeTimingOverride_Get +@ stub ADL2_Display_ModeTimingOverride_Set +@ stub ADL2_Display_Modes_Get +@ stub ADL2_Display_Modes_Set +@ stub ADL2_Display_Modes_X2_Get +@ stub ADL2_Display_MonitorPowerState_Set +@ stub ADL2_Display_NativeAUXChannel_Access +@ stub ADL2_Display_NeedWorkaroundFor5Clone_Get +@ stub ADL2_Display_NumberOfDisplays_Get +@ stub ADL2_Display_ODClockConfig_Set +@ stub ADL2_Display_ODClockInfo_Get +@ stub ADL2_Display_Overlap_NotifyAdjustment +@ stub ADL2_Display_Overlap_Set +@ stub ADL2_Display_Overscan_Get +@ stub ADL2_Display_Overscan_Set +@ stub ADL2_Display_PixelFormatDefault_Get +@ stub ADL2_Display_PixelFormat_Get +@ stub ADL2_Display_PixelFormat_Set +@ stub ADL2_Display_Position_Get +@ stub ADL2_Display_Position_Set +@ stub ADL2_Display_PossibleMapping_Get +@ stub ADL2_Display_PossibleMode_Get +@ stub ADL2_Display_PowerXpressActiveGPU_Get +@ stub ADL2_Display_PowerXpressActiveGPU_Set +@ stub ADL2_Display_PowerXpressActvieGPUR2_Get +@ stub ADL2_Display_PowerXpressVersion_Get +@ stub ADL2_Display_PowerXpress_AutoSwitchConfig_Get +@ stub ADL2_Display_PowerXpress_AutoSwitchConfig_Set +@ stub ADL2_Display_PreferredMode_Get +@ stub ADL2_Display_PreservedAspectRatio_Get +@ stub ADL2_Display_PreservedAspectRatio_Set +@ stub ADL2_Display_Property_Get +@ stub ADL2_Display_Property_Set +@ stub ADL2_Display_RcDisplayAdjustment +@ stub ADL2_Display_ReGammaCoefficients_Get +@ stub ADL2_Display_ReGammaCoefficients_Set +@ stub ADL2_Display_ReducedBlanking_Get +@ stub ADL2_Display_ReducedBlanking_Set +@ stub ADL2_Display_RegammaR1_Get +@ stub ADL2_Display_RegammaR1_Set +@ stub ADL2_Display_Regamma_Get +@ stub ADL2_Display_Regamma_Set +@ stub ADL2_Display_SLSBuilder_CommonMode_Get +@ stub ADL2_Display_SLSBuilder_Create +@ stub ADL2_Display_SLSBuilder_DisplaysCanBeNextCandidateInSLS_Get +@ stub ADL2_Display_SLSBuilder_DisplaysCanBeNextCandidateToEnabled_Get +@ stub ADL2_Display_SLSBuilder_Get +@ stub ADL2_Display_SLSBuilder_IsActive_Notify +@ stub ADL2_Display_SLSBuilder_MaxSLSLayoutSize_Get +@ stub ADL2_Display_SLSBuilder_TimeOut_Get +@ stub ADL2_Display_SLSBuilder_Update +@ stub ADL2_Display_SLSGrid_Caps +@ stub ADL2_Display_SLSMapConfigX2_Delete +@ stub ADL2_Display_SLSMapConfigX2_Get +@ stub ADL2_Display_SLSMapConfig_Create +@ stub ADL2_Display_SLSMapConfig_Delete +@ stub ADL2_Display_SLSMapConfig_Get +@ stub ADL2_Display_SLSMapConfig_ImageCropType_Set +@ stub ADL2_Display_SLSMapConfig_Rearrange +@ stub ADL2_Display_SLSMapConfig_SetState +@ stub ADL2_Display_SLSMapConfig_SupportedImageCropType_Get +@ stub ADL2_Display_SLSMapConfig_Valid +@ stub ADL2_Display_SLSMapIndexList_Get +@ stub ADL2_Display_SLSMapIndex_Get +@ stub ADL2_Display_SLSMiddleMode_Get +@ stub ADL2_Display_SLSMiddleMode_Set +@ stub ADL2_Display_SLSRecords_Get +@ stub ADL2_Display_Sharpness_Caps +@ stub ADL2_Display_Sharpness_Get +@ stub ADL2_Display_Sharpness_Info_Get +@ stub ADL2_Display_Sharpness_Set +@ stub ADL2_Display_Size_Get +@ stub ADL2_Display_Size_Set +@ stub ADL2_Display_SourceContentAttribute_Get +@ stub ADL2_Display_SourceContentAttribute_Set +@ stub ADL2_Display_SplitDisplay_Caps +@ stub ADL2_Display_SplitDisplay_Get +@ stub ADL2_Display_SplitDisplay_RestoreDesktopConfiguration +@ stub ADL2_Display_SplitDisplay_Set +@ stub ADL2_Display_SupportedColorDepth_Get +@ stub ADL2_Display_SupportedPixelFormat_Get +@ stub ADL2_Display_SwitchingCapability_Get +@ stub ADL2_Display_TVCaps_Get +@ stub ADL2_Display_TargetTimingX2_Get +@ stub ADL2_Display_TargetTiming_Get +@ stub ADL2_Display_UnderScan_Auto_Get +@ stub ADL2_Display_UnderScan_Auto_Set +@ stub ADL2_Display_UnderscanState_Get +@ stub ADL2_Display_UnderscanState_Set +@ stub ADL2_Display_UnderscanSupport_Get +@ stub ADL2_Display_Underscan_Get +@ stub ADL2_Display_Underscan_Set +@ stub ADL2_Display_Vector_Get +@ stub ADL2_Display_ViewPort_Cap +@ stub ADL2_Display_ViewPort_Get +@ stub ADL2_Display_ViewPort_Set +@ stub ADL2_Display_VirtualType_Get +@ stub ADL2_Display_WriteAndReadI2C +@ stub ADL2_Display_WriteAndReadI2CLargePayload +@ stub ADL2_Display_WriteAndReadI2CRev_Get +@ stub ADL2_ElmCompatibilityMode_Caps +@ stub ADL2_ElmCompatibilityMode_Status_Get +@ stub ADL2_ElmCompatibilityMode_Status_Set +@ stub ADL2_ExclusiveModeGet +@ stub ADL2_FPS_Caps +@ stub ADL2_FPS_Settings_Get +@ stub ADL2_FPS_Settings_Reset +@ stub ADL2_FPS_Settings_Set +@ stub ADL2_Feature_Settings_Get +@ stub ADL2_Feature_Settings_Set +@ stub ADL2_Flush_Driver_Data +@ stub ADL2_GPUVMPageSize_Info_Get +@ stub ADL2_GPUVMPageSize_Info_Set +@ stub ADL2_GPUVerInfo_Get +@ stub ADL2_GcnAsicInfo_Get +@ stub ADL2_Graphics_IsDetachableGraphicsPlatform_Get +@ stub ADL2_Graphics_IsGfx9AndAbove +@ stub ADL2_Graphics_MantleVersion_Get +@ stub ADL2_Graphics_Platform_Get +@ stdcall ADL2_Graphics_VersionsX2_Get(ptr ptr) +@ stub ADL2_Graphics_Versions_Get +@ stub ADL2_Graphics_VulkanVersion_Get +@ stub ADL2_HybridGraphicsGPU_Set +@ stub ADL2_MGPUSLS_Status_Set +@ stub ADL2_MMD_FeatureList_Get +@ stub ADL2_MMD_FeatureValuesX2_Get +@ stub ADL2_MMD_FeatureValuesX2_Set +@ stub ADL2_MMD_FeatureValues_Get +@ stub ADL2_MMD_FeatureValues_Set +@ stub ADL2_MMD_FeaturesX2_Caps +@ stub ADL2_MMD_Features_Caps +@ stub ADL2_MMD_VideoAdjustInfo_Get +@ stub ADL2_MMD_VideoAdjustInfo_Set +@ stub ADL2_MMD_VideoColor_Caps +@ stub ADL2_MMD_VideoColor_Get +@ stub ADL2_MMD_VideoColor_Set +@ stub ADL2_MMD_Video_Caps +@ stub ADL2_Main_ControlX2_Create +@ stdcall ADL2_Main_Control_Create(ptr long ptr) +@ stub ADL2_Main_Control_Destroy +@ stub ADL2_Main_Control_GetProcAddress +@ stub ADL2_Main_Control_IsFunctionValid +@ stub ADL2_Main_Control_Refresh +@ stub ADL2_Main_LogDebug_Set +@ stub ADL2_Main_LogError_Set +@ stub ADL2_New_QueryPMLogData_Get +@ stub ADL2_Overdrive5_CurrentActivity_Get +@ stub ADL2_Overdrive5_FanSpeedInfo_Get +@ stub ADL2_Overdrive5_FanSpeedToDefault_Set +@ stub ADL2_Overdrive5_FanSpeed_Get +@ stub ADL2_Overdrive5_FanSpeed_Set +@ stub ADL2_Overdrive5_ODParameters_Get +@ stub ADL2_Overdrive5_ODPerformanceLevels_Get +@ stub ADL2_Overdrive5_ODPerformanceLevels_Set +@ stub ADL2_Overdrive5_PowerControlAbsValue_Caps +@ stub ADL2_Overdrive5_PowerControlAbsValue_Get +@ stub ADL2_Overdrive5_PowerControlAbsValue_Set +@ stub ADL2_Overdrive5_PowerControlInfo_Get +@ stub ADL2_Overdrive5_PowerControl_Caps +@ stub ADL2_Overdrive5_PowerControl_Get +@ stub ADL2_Overdrive5_PowerControl_Set +@ stub ADL2_Overdrive5_Temperature_Get +@ stub ADL2_Overdrive5_ThermalDevices_Enum +@ stub ADL2_Overdrive6_AdvancedFan_Caps +@ stub ADL2_Overdrive6_CapabilitiesEx_Get +@ stub ADL2_Overdrive6_Capabilities_Get +@ stub ADL2_Overdrive6_ControlI2C +@ stub ADL2_Overdrive6_CurrentPower_Get +@ stub ADL2_Overdrive6_CurrentStatus_Get +@ stub ADL2_Overdrive6_FanPWMLimitData_Get +@ stub ADL2_Overdrive6_FanPWMLimitData_Set +@ stub ADL2_Overdrive6_FanPWMLimitRangeInfo_Get +@ stub ADL2_Overdrive6_FanSpeed_Get +@ stub ADL2_Overdrive6_FanSpeed_Reset +@ stub ADL2_Overdrive6_FanSpeed_Set +@ stub ADL2_Overdrive6_FuzzyController_Caps +@ stub ADL2_Overdrive6_MaxClockAdjust_Get +@ stub ADL2_Overdrive6_PowerControlInfo_Get +@ stub ADL2_Overdrive6_PowerControlInfo_Get_X2 +@ stub ADL2_Overdrive6_PowerControl_Caps +@ stub ADL2_Overdrive6_PowerControl_Get +@ stub ADL2_Overdrive6_PowerControl_Set +@ stub ADL2_Overdrive6_StateEx_Get +@ stub ADL2_Overdrive6_StateEx_Set +@ stub ADL2_Overdrive6_StateInfo_Get +@ stub ADL2_Overdrive6_State_Reset +@ stub ADL2_Overdrive6_State_Set +@ stub ADL2_Overdrive6_TargetTemperatureData_Get +@ stub ADL2_Overdrive6_TargetTemperatureData_Set +@ stub ADL2_Overdrive6_TargetTemperatureRangeInfo_Get +@ stub ADL2_Overdrive6_TemperatureEx_Get +@ stub ADL2_Overdrive6_Temperature_Get +@ stub ADL2_Overdrive6_ThermalController_Caps +@ stub ADL2_Overdrive6_ThermalLimitUnlock_Get +@ stub ADL2_Overdrive6_ThermalLimitUnlock_Set +@ stub ADL2_Overdrive6_VoltageControlInfo_Get +@ stub ADL2_Overdrive6_VoltageControl_Get +@ stub ADL2_Overdrive6_VoltageControl_Set +@ stub ADL2_Overdrive8_Current_SettingX2_Get +@ stub ADL2_Overdrive8_Current_SettingX3_Get +@ stub ADL2_Overdrive8_Current_Setting_Get +@ stub ADL2_Overdrive8_Init_SettingX2_Get +@ stub ADL2_Overdrive8_Init_Setting_Get +@ stub ADL2_Overdrive8_PMLogSenorRange_Caps +@ stub ADL2_Overdrive8_PMLogSenorType_Support_Get +@ stub ADL2_Overdrive8_PMLog_ShareMemory_Read +@ stub ADL2_Overdrive8_PMLog_ShareMemory_Start +@ stub ADL2_Overdrive8_PMLog_ShareMemory_Stop +@ stub ADL2_Overdrive8_PMLog_ShareMemory_Support +@ stub ADL2_Overdrive8_Setting_Set +@ stub ADL2_OverdriveN_AutoWattman_Caps +@ stub ADL2_OverdriveN_AutoWattman_Get +@ stub ADL2_OverdriveN_AutoWattman_Set +@ stub ADL2_OverdriveN_CapabilitiesX2_Get +@ stub ADL2_OverdriveN_Capabilities_Get +@ stub ADL2_OverdriveN_CountOfEvents_Get +@ stub ADL2_OverdriveN_FanControl_Get +@ stub ADL2_OverdriveN_FanControl_Set +@ stub ADL2_OverdriveN_MemoryClocksX2_Get +@ stub ADL2_OverdriveN_MemoryClocksX2_Set +@ stub ADL2_OverdriveN_MemoryClocks_Get +@ stub ADL2_OverdriveN_MemoryClocks_Set +@ stub ADL2_OverdriveN_MemoryTimingLevel_Get +@ stub ADL2_OverdriveN_MemoryTimingLevel_Set +@ stub ADL2_OverdriveN_PerformanceStatus_Get +@ stub ADL2_OverdriveN_PowerLimit_Get +@ stub ADL2_OverdriveN_PowerLimit_Set +@ stub ADL2_OverdriveN_SCLKAutoOverClock_Get +@ stub ADL2_OverdriveN_SCLKAutoOverClock_Set +@ stub ADL2_OverdriveN_SettingsExt_Get +@ stub ADL2_OverdriveN_SettingsExt_Set +@ stub ADL2_OverdriveN_SystemClocksX2_Get +@ stub ADL2_OverdriveN_SystemClocksX2_Set +@ stub ADL2_OverdriveN_SystemClocks_Get +@ stub ADL2_OverdriveN_SystemClocks_Set +@ stub ADL2_OverdriveN_Temperature_Get +@ stub ADL2_OverdriveN_Test_Set +@ stub ADL2_OverdriveN_ThrottleNotification_Get +@ stub ADL2_OverdriveN_ZeroRPMFan_Get +@ stub ADL2_OverdriveN_ZeroRPMFan_Set +@ stub ADL2_Overdrive_Caps +@ stub ADL2_PPLogSettings_Get +@ stub ADL2_PPLogSettings_Set +@ stub ADL2_PPW_Caps +@ stub ADL2_PPW_Status_Get +@ stub ADL2_PPW_Status_Set +@ stub ADL2_PageMigration_Settings_Get +@ stub ADL2_PageMigration_Settings_Set +@ stub ADL2_PerGPU_GDEvent_Register +@ stub ADL2_PerGPU_GDEvent_UnRegister +@ stub ADL2_PerfTuning_Status_Get +@ stub ADL2_PerfTuning_Status_Set +@ stub ADL2_PerformanceTuning_Caps +@ stub ADL2_PowerStates_Get +@ stub ADL2_PowerXpress_AncillaryDevices_Get +@ stub ADL2_PowerXpress_Config_Caps +@ stub ADL2_PowerXpress_Configuration_Get +@ stub ADL2_PowerXpress_ExtendedBatteryMode_Caps +@ stub ADL2_PowerXpress_ExtendedBatteryMode_Get +@ stub ADL2_PowerXpress_ExtendedBatteryMode_Set +@ stub ADL2_PowerXpress_LongIdleDetect_Get +@ stub ADL2_PowerXpress_LongIdleDetect_Set +@ stub ADL2_PowerXpress_PowerControlMode_Get +@ stub ADL2_PowerXpress_PowerControlMode_Set +@ stub ADL2_PowerXpress_Scheme_Get +@ stub ADL2_PowerXpress_Scheme_Set +@ stub ADL2_RIS_Settings_Get +@ stub ADL2_RIS_Settings_Set +@ stub ADL2_RegisterEvent +@ stub ADL2_RegisterEventX2 +@ stub ADL2_Remap +@ stub ADL2_RemoteDisplay_Destroy +@ stub ADL2_RemoteDisplay_Display_Acquire +@ stub ADL2_RemoteDisplay_Display_Release +@ stub ADL2_RemoteDisplay_Display_Release_All +@ stub ADL2_RemoteDisplay_Hdcp20_Create +@ stub ADL2_RemoteDisplay_Hdcp20_Destroy +@ stub ADL2_RemoteDisplay_Hdcp20_Notify +@ stub ADL2_RemoteDisplay_Hdcp20_Process +@ stub ADL2_RemoteDisplay_IEPort_Set +@ stub ADL2_RemoteDisplay_Initialize +@ stub ADL2_RemoteDisplay_Nofitiation_Register +@ stub ADL2_RemoteDisplay_Notification_UnRegister +@ stub ADL2_RemoteDisplay_Support_Caps +@ stub ADL2_RemoteDisplay_VirtualWirelessAdapter_InUse_Get +@ stub ADL2_RemoteDisplay_VirtualWirelessAdapter_Info_Get +@ stub ADL2_RemoteDisplay_VirtualWirelessAdapter_RadioState_Get +@ stub ADL2_RemoteDisplay_VirtualWirelessAdapter_WPSSetting_Change +@ stub ADL2_RemoteDisplay_VirtualWirelessAdapter_WPSSetting_Get +@ stub ADL2_RemoteDisplay_WFDDeviceInfo_Get +@ stub ADL2_RemoteDisplay_WFDDeviceName_Change +@ stub ADL2_RemoteDisplay_WFDDevice_StatusInfo_Get +@ stub ADL2_RemoteDisplay_WFDDiscover_Start +@ stub ADL2_RemoteDisplay_WFDDiscover_Stop +@ stub ADL2_RemoteDisplay_WFDLink_Connect +@ stub ADL2_RemoteDisplay_WFDLink_Creation_Accept +@ stub ADL2_RemoteDisplay_WFDLink_Disconnect +@ stub ADL2_RemoteDisplay_WFDLink_WPS_Process +@ stub ADL2_RemoteDisplay_WFDWDSPSettings_Set +@ stub ADL2_RemoteDisplay_WirelessDisplayEnableDisable_Commit +@ stub ADL2_RemotePlay_ControlFlags_Set +@ stub ADL2_ScreenPoint_AudioMappingInfo_Get +@ stub ADL2_Send +@ stub ADL2_SendX2 +@ stub ADL2_Stereo3D_2DPackedFormat_Set +@ stub ADL2_Stereo3D_3DCursorOffset_Get +@ stub ADL2_Stereo3D_3DCursorOffset_Set +@ stub ADL2_Stereo3D_CurrentFormat_Get +@ stub ADL2_Stereo3D_Info_Get +@ stub ADL2_Stereo3D_Modes_Get +@ stub ADL2_SwitchableGraphics_Applications_Get +@ stub ADL2_TV_Standard_Get +@ stub ADL2_TV_Standard_Set +@ stub ADL2_TurboSyncSupport_Get +@ stub ADL2_UnRegisterEvent +@ stub ADL2_UnRegisterEventX2 +@ stub ADL2_User_Settings_Notify +@ stub ADL2_WS_Overdrive_Caps +@ stub ADL2_Win_IsHybridAI +@ stub ADL2_Workstation_8BitGrayscale_Get +@ stub ADL2_Workstation_8BitGrayscale_Set +@ stub ADL2_Workstation_AdapterNumOfGLSyncConnectors_Get +@ stub ADL2_Workstation_Caps +@ stub ADL2_Workstation_DeepBitDepthX2_Get +@ stub ADL2_Workstation_DeepBitDepthX2_Set +@ stub ADL2_Workstation_DeepBitDepth_Get +@ stub ADL2_Workstation_DeepBitDepth_Set +@ stub ADL2_Workstation_DisplayGLSyncMode_Get +@ stub ADL2_Workstation_DisplayGLSyncMode_Set +@ stub ADL2_Workstation_DisplayGenlockCapable_Get +@ stub ADL2_Workstation_ECCData_Get +@ stub ADL2_Workstation_ECCX2_Get +@ stub ADL2_Workstation_ECC_Caps +@ stub ADL2_Workstation_ECC_Get +@ stub ADL2_Workstation_ECC_Set +@ stub ADL2_Workstation_GLSyncCounters_Get +@ stub ADL2_Workstation_GLSyncGenlockConfiguration_Get +@ stub ADL2_Workstation_GLSyncGenlockConfiguration_Set +@ stub ADL2_Workstation_GLSyncModuleDetect_Get +@ stub ADL2_Workstation_GLSyncModuleInfo_Get +@ stub ADL2_Workstation_GLSyncPortState_Get +@ stub ADL2_Workstation_GLSyncPortState_Set +@ stub ADL2_Workstation_GLSyncSupportedTopology_Get +@ stub ADL2_Workstation_GlobalEDIDPersistence_Get +@ stub ADL2_Workstation_GlobalEDIDPersistence_Set +@ stub ADL2_Workstation_LoadBalancing_Caps +@ stub ADL2_Workstation_LoadBalancing_Get +@ stub ADL2_Workstation_LoadBalancing_Set +@ stub ADL2_Workstation_RAS_ErrorCounts_Get +@ stub ADL2_Workstation_RAS_ErrorCounts_Reset +@ stub ADL2_Workstation_SDISegmentList_Get +@ stub ADL2_Workstation_SDI_Caps +@ stub ADL2_Workstation_SDI_Get +@ stub ADL2_Workstation_SDI_Set +@ stub ADL2_Workstation_Stereo_Get +@ stub ADL2_Workstation_Stereo_Set +@ stub ADL2_Workstation_UnsupportedDisplayModes_Enable +@ stub ADL_ADC_CurrentProfileFromDrv_Get +@ stub ADL_ADC_Display_AdapterDeviceProfileEx_Get +@ stub ADL_ADC_DrvDataToProfile_Copy +@ stub ADL_ADC_FindClosestMode_Get +@ stub ADL_ADC_IsDevModeEqual_Get +@ stub ADL_ADC_Profile_Apply +@ stub ADL_APO_AudioDelayAdjustmentInfo_Get +@ stub ADL_APO_AudioDelay_Restore +@ stub ADL_APO_AudioDelay_Set +@ stub ADL_AdapterLimitation_Caps +@ stub ADL_AdapterX2_Caps +@ stub ADL_Adapter_ASICFamilyType_Get +@ stub ADL_Adapter_ASICInfo_Get +@ stub ADL_Adapter_Accessibility_Get +@ stub ADL_Adapter_Active_Get +@ stub ADL_Adapter_Active_Set +@ stub ADL_Adapter_Active_SetPrefer +@ stub ADL_Adapter_AdapterInfoX2_Get +@ stub ADL_Adapter_AdapterInfo_Get +@ stub ADL_Adapter_AdapterList_Disable +@ stub ADL_Adapter_Aspects_Get +@ stub ADL_Adapter_AudioChannelSplitConfiguration_Get +@ stub ADL_Adapter_AudioChannelSplit_Disable +@ stub ADL_Adapter_AudioChannelSplit_Enable +@ stub ADL_Adapter_BigSw_Info_Get +@ stub ADL_Adapter_BlackAndWhiteLevelSupport_Get +@ stub ADL_Adapter_BlackAndWhiteLevel_Get +@ stub ADL_Adapter_BlackAndWhiteLevel_Set +@ stub ADL_Adapter_BoardLayout_Get +@ stub ADL_Adapter_Caps +@ stub ADL_Adapter_ChipSetInfo_Get +@ stub ADL_Adapter_ConfigMemory_Cap +@ stub ADL_Adapter_ConfigMemory_Get +@ stub ADL_Adapter_ConfigureState_Get +@ stub ADL_Adapter_ConnectionData_Get +@ stub ADL_Adapter_ConnectionData_Remove +@ stub ADL_Adapter_ConnectionData_Set +@ stub ADL_Adapter_ConnectionState_Get +@ stub ADL_Adapter_CrossDisplayPlatformInfo_Get +@ stub ADL_Adapter_CrossdisplayAdapterRole_Caps +@ stub ADL_Adapter_CrossdisplayInfoX2_Set +@ stub ADL_Adapter_CrossdisplayInfo_Get +@ stub ADL_Adapter_CrossdisplayInfo_Set +@ stub ADL_Adapter_CrossfireX2_Get +@ stub ADL_Adapter_Crossfire_Caps +@ stub ADL_Adapter_Crossfire_Get +@ stub ADL_Adapter_Crossfire_Set +@ stub ADL_Adapter_DefaultAudioChannelTable_Load +@ stub ADL_Adapter_DisplayAudioEndpoint_Enable +@ stub ADL_Adapter_DisplayAudioEndpoint_Mute +@ stub ADL_Adapter_DisplayAudioInfo_Get +@ stub ADL_Adapter_DisplayGTCCaps_Get +@ stub ADL_Adapter_Display_Caps +@ stub ADL_Adapter_DriverSettings_Get +@ stub ADL_Adapter_DriverSettings_Set +@ stub ADL_Adapter_EDIDManagement_Caps +@ stub ADL_Adapter_EmulationMode_Set +@ stub ADL_Adapter_ExtInfo_Get +@ stub ADL_Adapter_Gamma_Get +@ stub ADL_Adapter_Gamma_Set +@ stub ADL_Adapter_ID_Get +@ stub ADL_Adapter_LocalDisplayConfig_Get +@ stub ADL_Adapter_LocalDisplayConfig_Set +@ stub ADL_Adapter_LocalDisplayState_Get +@ stub ADL_Adapter_MaxCursorSize_Get +@ stub ADL_Adapter_MemoryInfo2_Get +@ stub ADL_Adapter_MemoryInfo_Get +@ stub ADL_Adapter_MirabilisSupport_Get +@ stub ADL_Adapter_ModeSwitch +@ stub ADL_Adapter_ModeTimingOverride_Caps +@ stub ADL_Adapter_Modes_ReEnumerate +@ stub ADL_Adapter_NumberOfActivatableSources_Get +@ stub ADL_Adapter_NumberOfAdapters_Get +@ stub ADL_Adapter_ObservedClockInfo_Get +@ stub ADL_Adapter_ObservedGameClockInfo_Get +@ stub ADL_Adapter_Primary_Get +@ stub ADL_Adapter_Primary_Set +@ stub ADL_Adapter_RegValueInt_Get +@ stub ADL_Adapter_RegValueInt_Set +@ stub ADL_Adapter_RegValueString_Get +@ stub ADL_Adapter_RegValueString_Set +@ stub ADL_Adapter_SWInfo_Get +@ stub ADL_Adapter_Speed_Caps +@ stub ADL_Adapter_Speed_Get +@ stub ADL_Adapter_Speed_Set +@ stub ADL_Adapter_SupportedConnections_Get +@ stub ADL_Adapter_Tear_Free_Cap +@ stub ADL_Adapter_VariBrightEnable_Set +@ stub ADL_Adapter_VariBrightLevel_Get +@ stub ADL_Adapter_VariBrightLevel_Set +@ stub ADL_Adapter_VariBright_Caps +@ stub ADL_Adapter_VideoBiosInfo_Get +@ stub ADL_Adapter_VideoTheaterModeInfo_Get +@ stub ADL_Adapter_VideoTheaterModeInfo_Set +@ stub ADL_ApplicationProfiles_Applications_Get +@ stub ADL_ApplicationProfiles_ConvertToCompact +@ stub ADL_ApplicationProfiles_DriverAreaPrivacy_Get +@ stub ADL_ApplicationProfiles_GetCustomization +@ stub ADL_ApplicationProfiles_HitListsX2_Get +@ stub ADL_ApplicationProfiles_HitLists_Get +@ stub ADL_ApplicationProfiles_ProfileApplicationX2_Assign +@ stub ADL_ApplicationProfiles_ProfileApplication_Assign +@ stub ADL_ApplicationProfiles_ProfileOfAnApplicationX2_Search +@ stub ADL_ApplicationProfiles_ProfileOfAnApplication_InMemorySearch +@ stub ADL_ApplicationProfiles_ProfileOfAnApplication_Search +@ stub ADL_ApplicationProfiles_Profile_Create +@ stub ADL_ApplicationProfiles_Profile_Exist +@ stub ADL_ApplicationProfiles_Profile_Remove +@ stub ADL_ApplicationProfiles_PropertyType_Get +@ stub ADL_ApplicationProfiles_Release_Get +@ stub ADL_ApplicationProfiles_RemoveApplication +@ stub ADL_ApplicationProfiles_StatusInfo_Get +@ stub ADL_ApplicationProfiles_System_Reload +@ stub ADL_ApplicationProfiles_User_Load +@ stub ADL_ApplicationProfiles_User_Unload +@ stub ADL_Audio_CurrentSampleRate_Get +@ stub ADL_CDS_UnsafeMode_Set +@ stub ADL_CV_DongleSettings_Get +@ stub ADL_CV_DongleSettings_Reset +@ stub ADL_CV_DongleSettings_Set +@ stub ADL_DFP_AllowOnlyCETimings_Get +@ stub ADL_DFP_AllowOnlyCETimings_Set +@ stub ADL_DFP_BaseAudioSupport_Get +@ stub ADL_DFP_GPUScalingEnable_Get +@ stub ADL_DFP_GPUScalingEnable_Set +@ stub ADL_DFP_HDMISupport_Get +@ stub ADL_DFP_MVPUAnalogSupport_Get +@ stub ADL_DFP_PixelFormat_Caps +@ stub ADL_DFP_PixelFormat_Get +@ stub ADL_DFP_PixelFormat_Set +@ stub ADL_DisplayScaling_Set +@ stub ADL_Display_AdapterID_Get +@ stub ADL_Display_AdjustCaps_Get +@ stub ADL_Display_AdjustmentCoherent_Get +@ stub ADL_Display_AdjustmentCoherent_Set +@ stub ADL_Display_AudioMappingInfo_Get +@ stub ADL_Display_AvivoColor_Get +@ stub ADL_Display_AvivoCurrentColor_Set +@ stub ADL_Display_AvivoDefaultColor_Set +@ stub ADL_Display_BackLight_Get +@ stub ADL_Display_BackLight_Set +@ stub ADL_Display_BezelOffsetSteppingSize_Get +@ stub ADL_Display_BezelOffset_Set +@ stub ADL_Display_BezelSupported_Validate +@ stub ADL_Display_Capabilities_Get +@ stub ADL_Display_ColorCaps_Get +@ stub ADL_Display_ColorDepth_Get +@ stub ADL_Display_ColorDepth_Set +@ stub ADL_Display_ColorTemperatureSource_Get +@ stub ADL_Display_ColorTemperatureSource_Set +@ stub ADL_Display_Color_Get +@ stub ADL_Display_Color_Set +@ stub ADL_Display_ConnectedDisplays_Get +@ stub ADL_Display_ContainerID_Get +@ stub ADL_Display_ControllerOverlayAdjustmentCaps_Get +@ stub ADL_Display_ControllerOverlayAdjustmentData_Get +@ stub ADL_Display_ControllerOverlayAdjustmentData_Set +@ stub ADL_Display_CurrentPixelClock_Get +@ stub ADL_Display_CustomizedModeListNum_Get +@ stub ADL_Display_CustomizedModeList_Get +@ stub ADL_Display_CustomizedMode_Add +@ stub ADL_Display_CustomizedMode_Delete +@ stub ADL_Display_CustomizedMode_Validate +@ stub ADL_Display_DCE_Get +@ stub ADL_Display_DCE_Set +@ stub ADL_Display_DDCBlockAccess_Get +@ stub ADL_Display_DDCInfo2_Get +@ stub ADL_Display_DDCInfo_Get +@ stub ADL_Display_Deflicker_Get +@ stub ADL_Display_Deflicker_Set +@ stub ADL_Display_DeviceConfig_Get +@ stub ADL_Display_DisplayContent_Cap +@ stub ADL_Display_DisplayContent_Get +@ stub ADL_Display_DisplayContent_Set +@ stub ADL_Display_DisplayInfo_Get +@ stub ADL_Display_DisplayMapConfig_Get +@ stub ADL_Display_DisplayMapConfig_PossibleAddAndRemove +@ stub ADL_Display_DisplayMapConfig_Set +@ stub ADL_Display_DisplayMapConfig_Validate +@ stub ADL_Display_DitherState_Get +@ stub ADL_Display_DitherState_Set +@ stub ADL_Display_Downscaling_Caps +@ stub ADL_Display_DpMstInfo_Get +@ stub ADL_Display_EdidData_Get +@ stub ADL_Display_EdidData_Set +@ stub ADL_Display_EnumDisplays_Get +@ stub ADL_Display_FilterSVideo_Get +@ stub ADL_Display_FilterSVideo_Set +@ stub ADL_Display_ForcibleDisplay_Get +@ stub ADL_Display_ForcibleDisplay_Set +@ stub ADL_Display_FormatsOverride_Get +@ stub ADL_Display_FormatsOverride_Set +@ stub ADL_Display_FreeSyncState_Get +@ stub ADL_Display_FreeSyncState_Set +@ stub ADL_Display_FreeSync_Cap +@ stub ADL_Display_GamutMapping_Get +@ stub ADL_Display_GamutMapping_Reset +@ stub ADL_Display_GamutMapping_Set +@ stub ADL_Display_Gamut_Caps +@ stub ADL_Display_Gamut_Get +@ stub ADL_Display_Gamut_Set +@ stub ADL_Display_ImageExpansion_Get +@ stub ADL_Display_ImageExpansion_Set +@ stub ADL_Display_InfoPacket_Get +@ stub ADL_Display_InfoPacket_Set +@ stub ADL_Display_LCDRefreshRateCapability_Get +@ stub ADL_Display_LCDRefreshRateOptions_Get +@ stub ADL_Display_LCDRefreshRateOptions_Set +@ stub ADL_Display_LCDRefreshRate_Get +@ stub ADL_Display_LCDRefreshRate_Set +@ stub ADL_Display_Limits_Get +@ stub ADL_Display_MVPUCaps_Get +@ stub ADL_Display_MVPUStatus_Get +@ stub ADL_Display_ModeTimingOverrideInfo_Get +@ stub ADL_Display_ModeTimingOverrideListX2_Get +@ stub ADL_Display_ModeTimingOverrideList_Get +@ stub ADL_Display_ModeTimingOverrideX2_Get +@ stub ADL_Display_ModeTimingOverride_Delete +@ stub ADL_Display_ModeTimingOverride_Get +@ stub ADL_Display_ModeTimingOverride_Set +@ stub ADL_Display_Modes_Get +@ stub ADL_Display_Modes_Set +@ stub ADL_Display_MonitorPowerState_Set +@ stub ADL_Display_NativeAUXChannel_Access +@ stub ADL_Display_NeedWorkaroundFor5Clone_Get +@ stub ADL_Display_NumberOfDisplays_Get +@ stub ADL_Display_ODClockConfig_Set +@ stub ADL_Display_ODClockInfo_Get +@ stub ADL_Display_Overlap_Set +@ stub ADL_Display_Overscan_Get +@ stub ADL_Display_Overscan_Set +@ stub ADL_Display_PixelClockAllowableRange_Set +@ stub ADL_Display_PixelClockCaps_Get +@ stub ADL_Display_PixelFormat_Get +@ stub ADL_Display_PixelFormat_Set +@ stub ADL_Display_Position_Get +@ stub ADL_Display_Position_Set +@ stub ADL_Display_PossibleMapping_Get +@ stub ADL_Display_PossibleMode_Get +@ stub ADL_Display_PowerXpressActiveGPU_Get +@ stub ADL_Display_PowerXpressActiveGPU_Set +@ stub ADL_Display_PowerXpressActvieGPUR2_Get +@ stub ADL_Display_PowerXpressVersion_Get +@ stub ADL_Display_PowerXpress_AutoSwitchConfig_Get +@ stub ADL_Display_PowerXpress_AutoSwitchConfig_Set +@ stub ADL_Display_PreservedAspectRatio_Get +@ stub ADL_Display_PreservedAspectRatio_Set +@ stub ADL_Display_Property_Get +@ stub ADL_Display_Property_Set +@ stub ADL_Display_RcDisplayAdjustment +@ stub ADL_Display_ReGammaCoefficients_Get +@ stub ADL_Display_ReGammaCoefficients_Set +@ stub ADL_Display_ReducedBlanking_Get +@ stub ADL_Display_ReducedBlanking_Set +@ stub ADL_Display_RegammaR1_Get +@ stub ADL_Display_RegammaR1_Set +@ stub ADL_Display_Regamma_Get +@ stub ADL_Display_Regamma_Set +@ stub ADL_Display_SLSGrid_Caps +@ stub ADL_Display_SLSMapConfigX2_Get +@ stub ADL_Display_SLSMapConfig_Create +@ stub ADL_Display_SLSMapConfig_Delete +@ stub ADL_Display_SLSMapConfig_Get +@ stub ADL_Display_SLSMapConfig_Rearrange +@ stub ADL_Display_SLSMapConfig_SetState +@ stub ADL_Display_SLSMapIndexList_Get +@ stub ADL_Display_SLSMapIndex_Get +@ stub ADL_Display_SLSMiddleMode_Get +@ stub ADL_Display_SLSMiddleMode_Set +@ stub ADL_Display_SLSRecords_Get +@ stub ADL_Display_Sharpness_Caps +@ stub ADL_Display_Sharpness_Get +@ stub ADL_Display_Sharpness_Info_Get +@ stub ADL_Display_Sharpness_Set +@ stub ADL_Display_Size_Get +@ stub ADL_Display_Size_Set +@ stub ADL_Display_SourceContentAttribute_Get +@ stub ADL_Display_SourceContentAttribute_Set +@ stub ADL_Display_SplitDisplay_Caps +@ stub ADL_Display_SplitDisplay_Get +@ stub ADL_Display_SplitDisplay_RestoreDesktopConfiguration +@ stub ADL_Display_SplitDisplay_Set +@ stub ADL_Display_SupportedColorDepth_Get +@ stub ADL_Display_SupportedPixelFormat_Get +@ stub ADL_Display_SwitchingCapability_Get +@ stub ADL_Display_TVCaps_Get +@ stub ADL_Display_TargetTiming_Get +@ stub ADL_Display_UnderScan_Auto_Get +@ stub ADL_Display_UnderScan_Auto_Set +@ stub ADL_Display_Underscan_Get +@ stub ADL_Display_Underscan_Set +@ stub ADL_Display_Vector_Get +@ stub ADL_Display_ViewPort_Cap +@ stub ADL_Display_ViewPort_Get +@ stub ADL_Display_ViewPort_Set +@ stub ADL_Display_WriteAndReadI2C +@ stub ADL_Display_WriteAndReadI2CLargePayload +@ stub ADL_Display_WriteAndReadI2CRev_Get +@ stub ADL_Flush_Driver_Data +@ stub ADL_Graphics_Platform_Get +@ stdcall ADL_Graphics_Versions_Get(ptr) +@ stub ADL_MMD_FeatureList_Get +@ stub ADL_MMD_FeatureValuesX2_Get +@ stub ADL_MMD_FeatureValuesX2_Set +@ stub ADL_MMD_FeatureValues_Get +@ stub ADL_MMD_FeatureValues_Set +@ stub ADL_MMD_FeaturesX2_Caps +@ stub ADL_MMD_Features_Caps +@ stub ADL_MMD_VideoAdjustInfo_Get +@ stub ADL_MMD_VideoAdjustInfo_Set +@ stub ADL_MMD_VideoColor_Caps +@ stub ADL_MMD_VideoColor_Get +@ stub ADL_MMD_VideoColor_Set +@ stub ADL_MMD_Video_Caps +@ stub ADL_Main_ControlX2_Create +@ stdcall ADL_Main_Control_Create(ptr long) +@ stdcall ADL_Main_Control_Destroy() +@ stub ADL_Main_Control_GetProcAddress +@ stub ADL_Main_Control_IsFunctionValid +@ stub ADL_Main_Control_Refresh +@ stub ADL_Main_LogDebug_Set +@ stub ADL_Main_LogError_Set +@ stub ADL_Overdrive5_CurrentActivity_Get +@ stub ADL_Overdrive5_FanSpeedInfo_Get +@ stub ADL_Overdrive5_FanSpeedToDefault_Set +@ stub ADL_Overdrive5_FanSpeed_Get +@ stub ADL_Overdrive5_FanSpeed_Set +@ stub ADL_Overdrive5_ODParameters_Get +@ stub ADL_Overdrive5_ODPerformanceLevels_Get +@ stub ADL_Overdrive5_ODPerformanceLevels_Set +@ stub ADL_Overdrive5_PowerControlAbsValue_Caps +@ stub ADL_Overdrive5_PowerControlAbsValue_Get +@ stub ADL_Overdrive5_PowerControlAbsValue_Set +@ stub ADL_Overdrive5_PowerControlInfo_Get +@ stub ADL_Overdrive5_PowerControl_Caps +@ stub ADL_Overdrive5_PowerControl_Get +@ stub ADL_Overdrive5_PowerControl_Set +@ stub ADL_Overdrive5_Temperature_Get +@ stub ADL_Overdrive5_ThermalDevices_Enum +@ stub ADL_Overdrive6_AdvancedFan_Caps +@ stub ADL_Overdrive6_CapabilitiesEx_Get +@ stub ADL_Overdrive6_Capabilities_Get +@ stub ADL_Overdrive6_CurrentStatus_Get +@ stub ADL_Overdrive6_FanPWMLimitData_Get +@ stub ADL_Overdrive6_FanPWMLimitData_Set +@ stub ADL_Overdrive6_FanPWMLimitRangeInfo_Get +@ stub ADL_Overdrive6_FanSpeed_Get +@ stub ADL_Overdrive6_FanSpeed_Reset +@ stub ADL_Overdrive6_FanSpeed_Set +@ stub ADL_Overdrive6_FuzzyController_Caps +@ stub ADL_Overdrive6_MaxClockAdjust_Get +@ stub ADL_Overdrive6_PowerControlInfo_Get +@ stub ADL_Overdrive6_PowerControl_Caps +@ stub ADL_Overdrive6_PowerControl_Get +@ stub ADL_Overdrive6_PowerControl_Set +@ stub ADL_Overdrive6_StateEx_Get +@ stub ADL_Overdrive6_StateEx_Set +@ stub ADL_Overdrive6_StateInfo_Get +@ stub ADL_Overdrive6_State_Reset +@ stub ADL_Overdrive6_State_Set +@ stub ADL_Overdrive6_TargetTemperatureData_Get +@ stub ADL_Overdrive6_TargetTemperatureData_Set +@ stub ADL_Overdrive6_TargetTemperatureRangeInfo_Get +@ stub ADL_Overdrive6_Temperature_Get +@ stub ADL_Overdrive6_ThermalController_Caps +@ stub ADL_Overdrive6_ThermalLimitUnlock_Get +@ stub ADL_Overdrive6_ThermalLimitUnlock_Set +@ stub ADL_Overdrive6_VoltageControlInfo_Get +@ stub ADL_Overdrive6_VoltageControl_Get +@ stub ADL_Overdrive6_VoltageControl_Set +@ stub ADL_Overdrive_Caps +@ stub ADL_PowerXpress_AncillaryDevices_Get +@ stub ADL_PowerXpress_Config_Caps +@ stub ADL_PowerXpress_ExtendedBatteryMode_Caps +@ stub ADL_PowerXpress_ExtendedBatteryMode_Get +@ stub ADL_PowerXpress_ExtendedBatteryMode_Set +@ stub ADL_PowerXpress_LongIdleDetect_Get +@ stub ADL_PowerXpress_LongIdleDetect_Set +@ stub ADL_PowerXpress_PowerControlMode_Get +@ stub ADL_PowerXpress_PowerControlMode_Set +@ stub ADL_PowerXpress_Scheme_Get +@ stub ADL_PowerXpress_Scheme_Set +@ stub ADL_Remap +@ stub ADL_RemoteDisplay_Destroy +@ stub ADL_RemoteDisplay_Display_Acquire +@ stub ADL_RemoteDisplay_Display_Release +@ stub ADL_RemoteDisplay_Display_Release_All +@ stub ADL_RemoteDisplay_Hdcp20_Create +@ stub ADL_RemoteDisplay_Hdcp20_Destroy +@ stub ADL_RemoteDisplay_Hdcp20_Notify +@ stub ADL_RemoteDisplay_Hdcp20_Process +@ stub ADL_RemoteDisplay_IEPort_Set +@ stub ADL_RemoteDisplay_Initialize +@ stub ADL_RemoteDisplay_Nofitiation_Register +@ stub ADL_RemoteDisplay_Notification_UnRegister +@ stub ADL_RemoteDisplay_Support_Caps +@ stub ADL_RemoteDisplay_VirtualWirelessAdapter_InUse_Get +@ stub ADL_RemoteDisplay_VirtualWirelessAdapter_Info_Get +@ stub ADL_RemoteDisplay_VirtualWirelessAdapter_RadioState_Get +@ stub ADL_RemoteDisplay_VirtualWirelessAdapter_WPSSetting_Change +@ stub ADL_RemoteDisplay_VirtualWirelessAdapter_WPSSetting_Get +@ stub ADL_RemoteDisplay_WFDDeviceInfo_Get +@ stub ADL_RemoteDisplay_WFDDeviceName_Change +@ stub ADL_RemoteDisplay_WFDDevice_StatusInfo_Get +@ stub ADL_RemoteDisplay_WFDDiscover_Start +@ stub ADL_RemoteDisplay_WFDDiscover_Stop +@ stub ADL_RemoteDisplay_WFDLink_Connect +@ stub ADL_RemoteDisplay_WFDLink_Creation_Accept +@ stub ADL_RemoteDisplay_WFDLink_Disconnect +@ stub ADL_RemoteDisplay_WFDLink_WPS_Process +@ stub ADL_RemoteDisplay_WFDWDSPSettings_Set +@ stub ADL_RemoteDisplay_WirelessDisplayEnableDisable_Commit +@ stub ADL_ScreenPoint_AudioMappingInfo_Get +@ stub ADL_Stereo3D_2DPackedFormat_Set +@ stub ADL_Stereo3D_3DCursorOffset_Get +@ stub ADL_Stereo3D_3DCursorOffset_Set +@ stub ADL_Stereo3D_CurrentFormat_Get +@ stub ADL_Stereo3D_Info_Get +@ stub ADL_Stereo3D_Modes_Get +@ stub ADL_TV_Standard_Get +@ stub ADL_TV_Standard_Set +@ stub ADL_Win_IsHybridAI +@ stub ADL_Workstation_8BitGrayscale_Get +@ stub ADL_Workstation_8BitGrayscale_Set +@ stub ADL_Workstation_AdapterNumOfGLSyncConnectors_Get +@ stub ADL_Workstation_Caps +@ stub ADL_Workstation_DeepBitDepthX2_Get +@ stub ADL_Workstation_DeepBitDepthX2_Set +@ stub ADL_Workstation_DeepBitDepth_Get +@ stub ADL_Workstation_DeepBitDepth_Set +@ stub ADL_Workstation_DisplayGLSyncMode_Get +@ stub ADL_Workstation_DisplayGLSyncMode_Set +@ stub ADL_Workstation_DisplayGenlockCapable_Get +@ stub ADL_Workstation_ECCData_Get +@ stub ADL_Workstation_ECCX2_Get +@ stub ADL_Workstation_ECC_Caps +@ stub ADL_Workstation_ECC_Get +@ stub ADL_Workstation_ECC_Set +@ stub ADL_Workstation_GLSyncCounters_Get +@ stub ADL_Workstation_GLSyncGenlockConfiguration_Get +@ stub ADL_Workstation_GLSyncGenlockConfiguration_Set +@ stub ADL_Workstation_GLSyncModuleDetect_Get +@ stub ADL_Workstation_GLSyncModuleInfo_Get +@ stub ADL_Workstation_GLSyncPortState_Get +@ stub ADL_Workstation_GLSyncPortState_Set +@ stub ADL_Workstation_GLSyncSupportedTopology_Get +@ stub ADL_Workstation_GlobalEDIDPersistence_Get +@ stub ADL_Workstation_GlobalEDIDPersistence_Set +@ stub ADL_Workstation_LoadBalancing_Caps +@ stub ADL_Workstation_LoadBalancing_Get +@ stub ADL_Workstation_LoadBalancing_Set +@ stub ADL_Workstation_RAS_Get_Error_Counts +@ stub ADL_Workstation_RAS_Get_Features +@ stub ADL_Workstation_RAS_Reset_Error_Counts +@ stub ADL_Workstation_RAS_Set_Features +@ stub ADL_Workstation_SDISegmentList_Get +@ stub ADL_Workstation_SDI_Caps +@ stub ADL_Workstation_SDI_Get +@ stub ADL_Workstation_SDI_Set +@ stub ADL_Workstation_Stereo_Get +@ stub ADL_Workstation_Stereo_Set +@ stub ADL_Workstation_UnsupportedDisplayModes_Enable +@ stub AmdPowerXpressRequestHighPerformance +@ stub Desktop_Detach +@ stub Send +@ stub SendX2 diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c new file mode 100644 index 00000000000..0b037bb1946 --- /dev/null +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -0,0 +1,91 @@ +#include + +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(atiadlxx); + +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) +{ + TRACE("(%p, %u, %p)\n", instance, reason, reserved); + + switch (reason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(instance); + break; + } + + return TRUE; +} + +typedef void *(CALLBACK *ADL_MAIN_MALLOC_CALLBACK)(int); +typedef void *ADL_CONTEXT_HANDLE; + +typedef struct ADLVersionsInfo +{ + char strDriverVer[256]; + char strCatalystVersion[256]; + char strCatalystWebLink[256]; +} ADLVersionsInfo, *LPADLVersionsInfo; + +typedef struct ADLVersionsInfoX2 +{ + char strDriverVer[256]; + char strCatalystVersion[256]; + char strCrimsonVersion[256]; + char strCatalystWebLink[256]; +} ADLVersionsInfoX2, *LPADLVersionsInfoX2; + +static const ADLVersionsInfo version = { + "16.11.2", + "16.11.2", + "", +}; + +static const ADLVersionsInfoX2 version2 = { + "16.11.2", + "16.11.2", + "16.11.2", + "", +}; + +int WINAPI ADL2_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK cb, int arg, ADL_CONTEXT_HANDLE *ptr) +{ + FIXME("cb %p, arg %d, ptr %p stub!\n", cb, arg, ptr); + return 0; +} + +int WINAPI ADL_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK cb, int arg) +{ + FIXME("cb %p, arg %d stub!\n", cb, arg); + return 0; +} + +int WINAPI ADL_Main_Control_Destroy(void) +{ + FIXME("stub!\n"); + return 0; +} + +int WINAPI ADL2_Adapter_NumberOfAdapters_Get(ADL_CONTEXT_HANDLE *ptr, int *count) +{ + FIXME("ptr %p, count %p stub!\n", ptr, count); + *count = 0; + return 0; +} + +int WINAPI ADL2_Graphics_VersionsX2_Get(ADL_CONTEXT_HANDLE *ptr, ADLVersionsInfoX2 *ver) +{ + FIXME("ptr %p, ver %p stub!\n", ptr, ver); + memcpy(ver, &version2, sizeof(version2)); + return 0; +} + +int WINAPI ADL_Graphics_Versions_Get(ADLVersionsInfo *ver) +{ + FIXME("ver %p stub!\n", ver); + memcpy(ver, &version, sizeof(version)); + return 0; +} diff --git a/loader/wine.inf.in b/loader/wine.inf.in index dd394f8ac12..c28c91d45a8 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2785,6 +2785,7 @@ HKCU,Software\Wine\DllOverrides,"msvcr140",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"ucrtbase",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"vcomp140",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"vcruntime140",0x2,"native,builtin" +HKCU,Software\Wine\DllOverrides,"atiadlxx",,"disabled" ;;App-specific overrides to limit the number of resolutions HKCU,Software\Wine\AppDefaults\DarkSoulsIII.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" HKCU,Software\Wine\AppDefaults\sekiro.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" From 8fea37f8661f9c4eb895e37d781e81c971164bf9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 12 Oct 2020 17:46:27 +0300 Subject: [PATCH 0629/1506] atiadlxx: Stub GPU/display enumeration and clock/memory info. Shadow of War uses atiadlxx to query the following GPU information: * current memory frequency * current core frequency * memory size * memory bandwidth Those are used to apprise the GPU and recommend user settings. Most of them can be fetched via AMD's powerplay sysfs entries / wined3d helpers. The only value that is not exposed is the memory bandwith so we set it to the value my RX580 reports on Windows. Because of that on high end system the game may recommend lower settings than it would with the real value, and the other way around on low end systems. We also report some "sane default" in case we can't find the powerplay entries - this may be the case with nvapi hack enabled when we report any NVIDIA card as RX480. ADL2 stubs used by Call of Duty games are untouched and still report 0 GPUs. --- dlls/atiadlxx/Makefile.in | 2 + dlls/atiadlxx/atiadlxx.spec | 18 +- dlls/atiadlxx/atiadlxx_main.c | 369 ++++++++++++++++++++++++++++++++-- 3 files changed, 367 insertions(+), 22 deletions(-) diff --git a/dlls/atiadlxx/Makefile.in b/dlls/atiadlxx/Makefile.in index 80f456edb75..f8423899b3e 100644 --- a/dlls/atiadlxx/Makefile.in +++ b/dlls/atiadlxx/Makefile.in @@ -1,5 +1,7 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = atiadlxx.dll +IMPORTS = wined3d + EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native SOURCES = \ diff --git a/dlls/atiadlxx/atiadlxx.spec b/dlls/atiadlxx/atiadlxx.spec index e2a1f46a838..e2fb060ae8d 100644 --- a/dlls/atiadlxx/atiadlxx.spec +++ b/dlls/atiadlxx/atiadlxx.spec @@ -681,14 +681,14 @@ @ stub ADL_APO_AudioDelay_Set @ stub ADL_AdapterLimitation_Caps @ stub ADL_AdapterX2_Caps -@ stub ADL_Adapter_ASICFamilyType_Get +@ stdcall ADL_Adapter_ASICFamilyType_Get(long ptr ptr) @ stub ADL_Adapter_ASICInfo_Get @ stub ADL_Adapter_Accessibility_Get @ stub ADL_Adapter_Active_Get @ stub ADL_Adapter_Active_Set @ stub ADL_Adapter_Active_SetPrefer @ stub ADL_Adapter_AdapterInfoX2_Get -@ stub ADL_Adapter_AdapterInfo_Get +@ stdcall ADL_Adapter_AdapterInfo_Get(ptr long) @ stub ADL_Adapter_AdapterList_Disable @ stub ADL_Adapter_Aspects_Get @ stub ADL_Adapter_AudioChannelSplitConfiguration_Get @@ -714,8 +714,8 @@ @ stub ADL_Adapter_CrossdisplayInfo_Get @ stub ADL_Adapter_CrossdisplayInfo_Set @ stub ADL_Adapter_CrossfireX2_Get -@ stub ADL_Adapter_Crossfire_Caps -@ stub ADL_Adapter_Crossfire_Get +@ stdcall ADL_Adapter_Crossfire_Caps(long ptr ptr ptr) +@ stdcall ADL_Adapter_Crossfire_Get(long ptr ptr) @ stub ADL_Adapter_Crossfire_Set @ stub ADL_Adapter_DefaultAudioChannelTable_Load @ stub ADL_Adapter_DisplayAudioEndpoint_Enable @@ -736,14 +736,14 @@ @ stub ADL_Adapter_LocalDisplayState_Get @ stub ADL_Adapter_MaxCursorSize_Get @ stub ADL_Adapter_MemoryInfo2_Get -@ stub ADL_Adapter_MemoryInfo_Get +@ stdcall ADL_Adapter_MemoryInfo_Get(long ptr) @ stub ADL_Adapter_MirabilisSupport_Get @ stub ADL_Adapter_ModeSwitch @ stub ADL_Adapter_ModeTimingOverride_Caps @ stub ADL_Adapter_Modes_ReEnumerate @ stub ADL_Adapter_NumberOfActivatableSources_Get -@ stub ADL_Adapter_NumberOfAdapters_Get -@ stub ADL_Adapter_ObservedClockInfo_Get +@ stdcall ADL_Adapter_NumberOfAdapters_Get(ptr) +@ stdcall ADL_Adapter_ObservedClockInfo_Get(long ptr ptr) @ stub ADL_Adapter_ObservedGameClockInfo_Get @ stub ADL_Adapter_Primary_Get @ stub ADL_Adapter_Primary_Set @@ -844,7 +844,7 @@ @ stub ADL_Display_DisplayContent_Cap @ stub ADL_Display_DisplayContent_Get @ stub ADL_Display_DisplayContent_Set -@ stub ADL_Display_DisplayInfo_Get +@ stdcall ADL_Display_DisplayInfo_Get(long long ptr long) @ stub ADL_Display_DisplayMapConfig_Get @ stub ADL_Display_DisplayMapConfig_PossibleAddAndRemove @ stub ADL_Display_DisplayMapConfig_Set @@ -969,7 +969,7 @@ @ stub ADL_Display_WriteAndReadI2CLargePayload @ stub ADL_Display_WriteAndReadI2CRev_Get @ stub ADL_Flush_Driver_Data -@ stub ADL_Graphics_Platform_Get +@ stdcall ADL_Graphics_Platform_Get(ptr) @ stdcall ADL_Graphics_Versions_Get(ptr) @ stub ADL_MMD_FeatureList_Get @ stub ADL_MMD_FeatureValuesX2_Get diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 0b037bb1946..b1e7551ac82 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -1,8 +1,43 @@ +/* Headers: https://github.com/GPUOpen-LibrariesAndSDKs/display-library */ + #include +#include +#include +#define COBJMACROS #include "windef.h" #include "winbase.h" +#include "winuser.h" +#include "objbase.h" #include "wine/debug.h" +#include "wine/wined3d.h" + +#define MAX_GPUS 64 +#define VENDOR_AMD 0x1002 + +#define ADL_OK 0 +#define ADL_ERR -1 +#define ADL_ERR_INVALID_PARAM -3 +#define ADL_ERR_INVALID_ADL_IDX -5 +#define ADL_ERR_NOT_SUPPORTED -8 +#define ADL_ERR_NULL_POINTER -9 + +#define ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED 0x00000001 +#define ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED 0x00000002 +#define ADL_DISPLAY_DISPLAYINFO_MASK 0x31fff + +#define ADL_ASIC_DISCRETE (1 << 0) +#define ADL_ASIC_MASK 0xAF + +enum ADLPlatForm +{ + GRAPHICS_PLATFORM_DESKTOP = 0, + GRAPHICS_PLATFORM_MOBILE = 1 +}; +#define GRAPHICS_PLATFORM_UNKNOWN -1 + + +static struct wined3d *wined3d; WINE_DEFAULT_DEBUG_CHANNEL(atiadlxx); @@ -23,21 +58,83 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) typedef void *(CALLBACK *ADL_MAIN_MALLOC_CALLBACK)(int); typedef void *ADL_CONTEXT_HANDLE; +ADL_MAIN_MALLOC_CALLBACK adl_malloc; +#define ADL_MAX_PATH 256 + typedef struct ADLVersionsInfo { - char strDriverVer[256]; - char strCatalystVersion[256]; - char strCatalystWebLink[256]; + char strDriverVer[ADL_MAX_PATH]; + char strCatalystVersion[ADL_MAX_PATH]; + char strCatalystWebLink[ADL_MAX_PATH]; } ADLVersionsInfo, *LPADLVersionsInfo; typedef struct ADLVersionsInfoX2 { - char strDriverVer[256]; - char strCatalystVersion[256]; - char strCrimsonVersion[256]; - char strCatalystWebLink[256]; + char strDriverVer[ADL_MAX_PATH]; + char strCatalystVersion[ADL_MAX_PATH]; + char strCrimsonVersion[ADL_MAX_PATH]; + char strCatalystWebLink[ADL_MAX_PATH]; } ADLVersionsInfoX2, *LPADLVersionsInfoX2; +typedef struct ADLAdapterInfo { + int iSize; + int iAdapterIndex; + char strUDID[ADL_MAX_PATH]; + int iBusNumber; + int iDeviceNumber; + int iFunctionNumber; + int iVendorID; + char strAdapterName[ADL_MAX_PATH]; + char strDisplayName[ADL_MAX_PATH]; + int iPresent; + int iExist; + char strDriverPath[ADL_MAX_PATH]; + char strDriverPathExt[ADL_MAX_PATH]; + char strPNPString[ADL_MAX_PATH]; + int iOSDisplayIndex; +} ADLAdapterInfo, *LPADLAdapterInfo; + +typedef struct ADLDisplayID +{ + int iDisplayLogicalIndex; + int iDisplayPhysicalIndex; + int iDisplayLogicalAdapterIndex; + int iDisplayPhysicalAdapterIndex; +} ADLDisplayID, *LPADLDisplayID; + +typedef struct ADLDisplayInfo +{ + ADLDisplayID displayID; + int iDisplayControllerIndex; + char strDisplayName[ADL_MAX_PATH]; + char strDisplayManufacturerName[ADL_MAX_PATH]; + int iDisplayType; + int iDisplayOutputType; + int iDisplayConnector; + int iDisplayInfoMask; + int iDisplayInfoValue; +} ADLDisplayInfo, *LPADLDisplayInfo; + +typedef struct ADLCrossfireComb +{ + int iNumLinkAdapter; + int iAdaptLink[3]; +} ADLCrossfireComb; + +typedef struct ADLCrossfireInfo +{ + int iErrorCode; + int iState; + int iSupported; +} ADLCrossfireInfo; + +typedef struct ADLMemoryInfo +{ + long long iMemorySize; + char strMemoryType[ADL_MAX_PATH]; + long long iMemoryBandwidth; +} ADLMemoryInfo, *LPADLMemoryInfo; + static const ADLVersionsInfo version = { "16.11.2", "16.11.2", @@ -54,38 +151,284 @@ static const ADLVersionsInfoX2 version2 = { int WINAPI ADL2_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK cb, int arg, ADL_CONTEXT_HANDLE *ptr) { FIXME("cb %p, arg %d, ptr %p stub!\n", cb, arg, ptr); - return 0; + return ADL_OK; } int WINAPI ADL_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK cb, int arg) { FIXME("cb %p, arg %d stub!\n", cb, arg); - return 0; + adl_malloc = cb; + + if ((wined3d = wined3d_create(0))) + return ADL_OK; + else + return ADL_ERR; } int WINAPI ADL_Main_Control_Destroy(void) { FIXME("stub!\n"); - return 0; + + if (wined3d != NULL) + wined3d_decref(wined3d); + + return ADL_OK; } int WINAPI ADL2_Adapter_NumberOfAdapters_Get(ADL_CONTEXT_HANDLE *ptr, int *count) { FIXME("ptr %p, count %p stub!\n", ptr, count); + *count = 0; - return 0; + + return ADL_OK; } int WINAPI ADL2_Graphics_VersionsX2_Get(ADL_CONTEXT_HANDLE *ptr, ADLVersionsInfoX2 *ver) { FIXME("ptr %p, ver %p stub!\n", ptr, ver); memcpy(ver, &version2, sizeof(version2)); - return 0; + return ADL_OK; } int WINAPI ADL_Graphics_Versions_Get(ADLVersionsInfo *ver) { FIXME("ver %p stub!\n", ver); memcpy(ver, &version, sizeof(version)); - return 0; + return ADL_OK; +} + +int WINAPI ADL_Adapter_NumberOfAdapters_Get(int *count) +{ + FIXME("count %p stub!\n", count); + *count = wined3d_get_adapter_count(wined3d); + TRACE("*count = %d\n", *count); + return ADL_OK; +} + +static BOOL get_adapter_identifier(int index, struct wined3d_adapter_identifier *identifier) +{ + struct wined3d_adapter *adapter; + HRESULT hr; + + adapter = wined3d_get_adapter(wined3d, index); + if (adapter == NULL) + return FALSE; + + memset(identifier, 0, sizeof(*identifier)); + hr = wined3d_adapter_get_identifier(adapter, 0, identifier); + + if (!SUCCEEDED(hr)) + return FALSE; + + return TRUE; +} + +/* yep, seriously */ +static int convert_vendor_id(int id) +{ + char str[16]; + snprintf(str, ARRAY_SIZE(str), "%x", id); + return atoi(str); +} + +int WINAPI ADL_Adapter_AdapterInfo_Get(ADLAdapterInfo *adapters, int input_size) +{ + int count, i; + struct wined3d_adapter_identifier identifier; + + FIXME("adapters %p, input_size %d, stub!\n", adapters, input_size); + + count = wined3d_get_adapter_count(wined3d); + + if (!adapters) return ADL_ERR_INVALID_PARAM; + if (input_size != count * sizeof(ADLAdapterInfo)) return ADL_ERR_INVALID_PARAM; + + memset(adapters, 0, input_size); + + for (i = 0; i < count; i++) + { + adapters[i].iSize = sizeof(ADLAdapterInfo); + adapters[i].iAdapterIndex = i; + + if (!get_adapter_identifier(i, &identifier)) + return ADL_ERR; + + adapters[i].iVendorID = convert_vendor_id(identifier.vendor_id); + } + + return ADL_OK; +} + +int WINAPI ADL_Display_DisplayInfo_Get(int adapter_index, int *num_displays, ADLDisplayInfo **info, int force_detect) +{ + struct wined3d_adapter *adapter; + struct wined3d_output *output; + int i; + + FIXME("adapter %d, num_displays %p, info %p stub!\n", adapter_index, num_displays, info); + + if (info == NULL || num_displays == NULL) return ADL_ERR_NULL_POINTER; + + adapter = wined3d_get_adapter(wined3d, adapter_index); + if (adapter == NULL) return ADL_ERR_INVALID_PARAM; + + *num_displays = wined3d_adapter_get_output_count(adapter); + + if (*num_displays == 0) + return ADL_OK; + + *info = adl_malloc(*num_displays * sizeof(**info)); + memset(*info, 0, *num_displays * sizeof(**info)); + + for (i = 0; i < *num_displays; i++) + { + output = wined3d_adapter_get_output(adapter, i); + if (output == NULL) + return ADL_ERR; + + (*info)[i].displayID.iDisplayLogicalIndex = i; + (*info)[i].iDisplayInfoValue = ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED; + (*info)[i].iDisplayInfoMask = (*info)[i].iDisplayInfoValue; + } + + return ADL_OK; +} + +int WINAPI ADL_Adapter_Crossfire_Caps(int adapter_index, int *preffered, int *num_comb, ADLCrossfireComb** comb) +{ + FIXME("adapter %d, preffered %p, num_comb %p, comb %p stub!\n", adapter_index, preffered, num_comb, comb); + return ADL_ERR; +} + +int WINAPI ADL_Adapter_Crossfire_Get(int adapter_index, ADLCrossfireComb *comb, ADLCrossfireInfo *info) +{ + FIXME("adapter %d, comb %p, info %p, stub!\n", adapter_index, comb, info); + return ADL_ERR; +} + +int WINAPI ADL_Adapter_ASICFamilyType_Get(int adapter_index, int *asic_type, int *valids) +{ + struct wined3d_adapter_identifier identifier; + + FIXME("adapter %d, asic_type %p, valids %p, stub!\n", adapter_index, asic_type, valids); + + if (asic_type == NULL || valids == NULL) + return ADL_ERR_NULL_POINTER; + + if (!get_adapter_identifier(adapter_index, &identifier)) + return ADL_ERR_INVALID_ADL_IDX; + + if (identifier.vendor_id != VENDOR_AMD) + return ADL_ERR_NOT_SUPPORTED; + + *asic_type = ADL_ASIC_DISCRETE; + *valids = ADL_ASIC_MASK; + + return ADL_OK; +} + +static int get_max_clock(const char *clock, int default_value) +{ + char path[MAX_PATH], line[256]; + FILE *file; + int drm_card, value = 0; + + for (drm_card = 0; drm_card < MAX_GPUS; drm_card++) + { + sprintf(path, "/sys/class/drm/card%d/device/pp_dpm_%s", drm_card, clock); + file = fopen(path, "r"); + + if (file == NULL) + continue; + + while (fgets(line, sizeof(line), file) != NULL) + { + char *number; + + number = strchr(line, ' '); + if (number == NULL) + { + WARN("pp_dpm_%s file has unexpected format\n", clock); + break; + } + + number++; + value = max(strtol(number, NULL, 0), value); + } + } + + if (value != 0) + return value; + + return default_value; +} + +/* documented in the "Linux Specific APIs" section, present and used on Windows */ +/* the name and documentation suggests that this returns current freqs, but it's actually max */ +int WINAPI ADL_Adapter_ObservedClockInfo_Get(int adapter_index, int *core_clock, int *memory_clock) +{ + struct wined3d_adapter_identifier identifier; + + FIXME("adapter %d, core_clock %p, memory_clock %p, stub!\n", adapter_index, core_clock, memory_clock); + + if (core_clock == NULL || memory_clock == NULL) return ADL_ERR; + if (!get_adapter_identifier(adapter_index, &identifier)) return ADL_ERR; + if (identifier.vendor_id != VENDOR_AMD) return ADL_ERR_INVALID_ADL_IDX; + + /* default values based on RX580 */ + *core_clock = get_max_clock("sclk", 1350); + *memory_clock = get_max_clock("mclk", 2000); + + TRACE("*core_clock: %i, *memory_clock %i\n", *core_clock, *memory_clock); + + return ADL_OK; +} + +/* documented in the "Linux Specific APIs" section, present and used on Windows */ +int WINAPI ADL_Adapter_MemoryInfo_Get(int adapter_index, ADLMemoryInfo *mem_info) +{ + struct wined3d_adapter_identifier identifier; + + FIXME("adapter %d, mem_info %p stub!\n", adapter_index, mem_info); + + if (mem_info == NULL) return ADL_ERR_NULL_POINTER; + if (!get_adapter_identifier(adapter_index, &identifier)) return ADL_ERR_INVALID_ADL_IDX; + if (identifier.vendor_id != VENDOR_AMD) return ADL_ERR; + + mem_info->iMemorySize = identifier.video_memory; + mem_info->iMemoryBandwidth = 256000; /* not exposed on Linux, probably needs a lookup table */ + + TRACE("iMemoryBandwidth %s, iMemorySize %s\n", + wine_dbgstr_longlong(mem_info->iMemoryBandwidth), + wine_dbgstr_longlong(mem_info->iMemorySize)); + return ADL_OK; +} + +int WINAPI ADL_Graphics_Platform_Get(int *platform) +{ + struct wined3d_adapter_identifier identifier; + int count, i; + + FIXME("platform %p, stub!\n", platform); + + *platform = GRAPHICS_PLATFORM_UNKNOWN; + + count = wined3d_get_adapter_count(wined3d); + + for (i = 0; i < count; i ++) + { + if (!get_adapter_identifier(i, &identifier)) + continue; + + if (identifier.vendor_id == VENDOR_AMD) + *platform = GRAPHICS_PLATFORM_DESKTOP; + } + + /* NOTE: The real value can be obtained by doing: + * 1. ioctl(DRM_AMDGPU_INFO) with AMDGPU_INFO_DEV_INFO - dev_info.ids_flags & AMDGPU_IDS_FLAGS_FUSION + * 2. VkPhysicalDeviceType() if we ever switch to wined3d vk adapter implementation + */ + + return ADL_OK; } From 482dfd93b8f6ed24c9110b8234780762c2022a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 3 Nov 2020 16:26:52 +0100 Subject: [PATCH 0630/1506] atiadlxx: Update fake driver version to 20.10.1. --- dlls/atiadlxx/atiadlxx_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index b1e7551ac82..f85c7f8ba62 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -136,15 +136,15 @@ typedef struct ADLMemoryInfo } ADLMemoryInfo, *LPADLMemoryInfo; static const ADLVersionsInfo version = { - "16.11.2", - "16.11.2", + "20.10.1", + "20.10.1", "", }; static const ADLVersionsInfoX2 version2 = { - "16.11.2", - "16.11.2", - "16.11.2", + "20.10.1", + "20.10.1", + "20.10.1", "", }; From f4b07a6593fea0352bc0dfd7d0f2fb9b66979c77 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 15 Nov 2021 11:33:45 -0600 Subject: [PATCH 0631/1506] atiadlxx: Update fake driver version to 21.20.01 Age of Empires IV wants this. CW-Bug-ID: #19602 --- dlls/atiadlxx/atiadlxx_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index f85c7f8ba62..65c6d6ca988 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -136,15 +136,15 @@ typedef struct ADLMemoryInfo } ADLMemoryInfo, *LPADLMemoryInfo; static const ADLVersionsInfo version = { - "20.10.1", - "20.10.1", + "21.20.01", + "21.20.01", "", }; static const ADLVersionsInfoX2 version2 = { - "20.10.1", - "20.10.1", - "20.10.1", + "21.20.01", + "21.20.01", + "21.20.01", "", }; From fb2c5eb532aa8265568f8adaaf3de865d5172fc0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 25 Nov 2021 21:26:01 +0300 Subject: [PATCH 0632/1506] atiadlxx: Add stub for ADL_Display_DisplayMapConfig_Get(). CW-Bug-Id: #19687 --- dlls/atiadlxx/atiadlxx.spec | 2 +- dlls/atiadlxx/atiadlxx_main.c | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/dlls/atiadlxx/atiadlxx.spec b/dlls/atiadlxx/atiadlxx.spec index e2fb060ae8d..1e447f38ded 100644 --- a/dlls/atiadlxx/atiadlxx.spec +++ b/dlls/atiadlxx/atiadlxx.spec @@ -845,7 +845,7 @@ @ stub ADL_Display_DisplayContent_Get @ stub ADL_Display_DisplayContent_Set @ stdcall ADL_Display_DisplayInfo_Get(long long ptr long) -@ stub ADL_Display_DisplayMapConfig_Get +@ stdcall ADL_Display_DisplayMapConfig_Get(long ptr ptr ptr ptr long) @ stub ADL_Display_DisplayMapConfig_PossibleAddAndRemove @ stub ADL_Display_DisplayMapConfig_Set @ stub ADL_Display_DisplayMapConfig_Validate diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 65c6d6ca988..2f9b1102c37 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -135,6 +135,40 @@ typedef struct ADLMemoryInfo long long iMemoryBandwidth; } ADLMemoryInfo, *LPADLMemoryInfo; +typedef struct ADLDisplayTarget +{ + ADLDisplayID displayID; + int iDisplayMapIndex; + int iDisplayTargetMask; + int iDisplayTargetValue; +} ADLDisplayTarget, *LPADLDisplayTarget; + +typedef struct ADLMode +{ + int iAdapterIndex; + ADLDisplayID displayID; + int iXPos; + int iYPos; + int iXRes; + int iYRes; + int iColourDepth; + float fRefreshRate; + int iOrientation; + int iModeFlag; + int iModeMask; + int iModeValue; +} ADLMode, *LPADLMode; + +typedef struct ADLDisplayMap +{ + int iDisplayMapIndex; + ADLMode displayMode; + int iNumDisplayTarget; + int iFirstDisplayTargetArrayIndex; + int iDisplayMapMask; + int iDisplayMapValue; +} ADLDisplayMap, *LPADLDisplayMap; + static const ADLVersionsInfo version = { "21.20.01", "21.20.01", @@ -432,3 +466,15 @@ int WINAPI ADL_Graphics_Platform_Get(int *platform) return ADL_OK; } + + +int WINAPI ADL_Display_DisplayMapConfig_Get(int adapter_index, int *display_map_count, ADLDisplayMap **display_maps, + int *display_target_count, ADLDisplayTarget **display_targets, int options) +{ + FIXME("adapter_index %d, display_map_count %p, display_maps %p, " + "display_target_count %p, display_targets %p, options %d stub.\n", + adapter_index, display_map_count, display_maps, display_target_count, + display_targets, options); + + return ADL_ERR; +} From 93afea98f8683e387446c17759160123e6e8b964 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 29 Dec 2021 18:00:39 +0200 Subject: [PATCH 0633/1506] atiadlxx: Query the information from dxgi instead of wined3d. so it works with DXVK's DXGI vendor/product mangling. --- dlls/atiadlxx/Makefile.in | 2 +- dlls/atiadlxx/atiadlxx_main.c | 101 +++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 45 deletions(-) diff --git a/dlls/atiadlxx/Makefile.in b/dlls/atiadlxx/Makefile.in index f8423899b3e..cc6b51bf2bc 100644 --- a/dlls/atiadlxx/Makefile.in +++ b/dlls/atiadlxx/Makefile.in @@ -1,6 +1,6 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = atiadlxx.dll -IMPORTS = wined3d +IMPORTS = dxgi EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 2f9b1102c37..6ef2edd356c 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -9,8 +9,10 @@ #include "winbase.h" #include "winuser.h" #include "objbase.h" +#include "initguid.h" #include "wine/debug.h" -#include "wine/wined3d.h" + +#include "dxgi.h" #define MAX_GPUS 64 #define VENDOR_AMD 0x1002 @@ -37,7 +39,7 @@ enum ADLPlatForm #define GRAPHICS_PLATFORM_UNKNOWN -1 -static struct wined3d *wined3d; +static IDXGIFactory *dxgi_factory; WINE_DEFAULT_DEBUG_CHANNEL(atiadlxx); @@ -193,7 +195,8 @@ int WINAPI ADL_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK cb, int arg) FIXME("cb %p, arg %d stub!\n", cb, arg); adl_malloc = cb; - if ((wined3d = wined3d_create(0))) + + if (SUCCEEDED(CreateDXGIFactory(&IID_IDXGIFactory, (void**) &dxgi_factory))) return ADL_OK; else return ADL_ERR; @@ -203,8 +206,8 @@ int WINAPI ADL_Main_Control_Destroy(void) { FIXME("stub!\n"); - if (wined3d != NULL) - wined3d_decref(wined3d); + if (dxgi_factory != NULL) + IUnknown_Release(dxgi_factory); return ADL_OK; } @@ -234,28 +237,34 @@ int WINAPI ADL_Graphics_Versions_Get(ADLVersionsInfo *ver) int WINAPI ADL_Adapter_NumberOfAdapters_Get(int *count) { + IDXGIAdapter *adapter; + FIXME("count %p stub!\n", count); - *count = wined3d_get_adapter_count(wined3d); + + *count = 0; + while (SUCCEEDED(IDXGIFactory_EnumAdapters(dxgi_factory, *count, &adapter))) + { + (*count)++; + IUnknown_Release(adapter); + } + TRACE("*count = %d\n", *count); return ADL_OK; } -static BOOL get_adapter_identifier(int index, struct wined3d_adapter_identifier *identifier) +static int get_adapter_desc(int adapter_index, DXGI_ADAPTER_DESC *desc) { - struct wined3d_adapter *adapter; + IDXGIAdapter *adapter; HRESULT hr; - adapter = wined3d_get_adapter(wined3d, index); - if (adapter == NULL) - return FALSE; + if (FAILED(IDXGIFactory_EnumAdapters(dxgi_factory, adapter_index, &adapter))) + return ADL_ERR; - memset(identifier, 0, sizeof(*identifier)); - hr = wined3d_adapter_get_identifier(adapter, 0, identifier); + hr = IDXGIAdapter_GetDesc(adapter, desc); - if (!SUCCEEDED(hr)) - return FALSE; + IUnknown_Release(adapter); - return TRUE; + return SUCCEEDED(hr) ? ADL_OK : ADL_ERR; } /* yep, seriously */ @@ -269,11 +278,11 @@ static int convert_vendor_id(int id) int WINAPI ADL_Adapter_AdapterInfo_Get(ADLAdapterInfo *adapters, int input_size) { int count, i; - struct wined3d_adapter_identifier identifier; + DXGI_ADAPTER_DESC adapter_desc; FIXME("adapters %p, input_size %d, stub!\n", adapters, input_size); - count = wined3d_get_adapter_count(wined3d); + ADL_Adapter_NumberOfAdapters_Get(&count); if (!adapters) return ADL_ERR_INVALID_PARAM; if (input_size != count * sizeof(ADLAdapterInfo)) return ADL_ERR_INVALID_PARAM; @@ -285,10 +294,10 @@ int WINAPI ADL_Adapter_AdapterInfo_Get(ADLAdapterInfo *adapters, int input_size) adapters[i].iSize = sizeof(ADLAdapterInfo); adapters[i].iAdapterIndex = i; - if (!get_adapter_identifier(i, &identifier)) + if (get_adapter_desc(i, &adapter_desc) != ADL_OK) return ADL_ERR; - adapters[i].iVendorID = convert_vendor_id(identifier.vendor_id); + adapters[i].iVendorID = convert_vendor_id(adapter_desc.VendorId); } return ADL_OK; @@ -296,18 +305,26 @@ int WINAPI ADL_Adapter_AdapterInfo_Get(ADLAdapterInfo *adapters, int input_size) int WINAPI ADL_Display_DisplayInfo_Get(int adapter_index, int *num_displays, ADLDisplayInfo **info, int force_detect) { - struct wined3d_adapter *adapter; - struct wined3d_output *output; + IDXGIAdapter *adapter; + IDXGIOutput *output; int i; FIXME("adapter %d, num_displays %p, info %p stub!\n", adapter_index, num_displays, info); if (info == NULL || num_displays == NULL) return ADL_ERR_NULL_POINTER; - adapter = wined3d_get_adapter(wined3d, adapter_index); - if (adapter == NULL) return ADL_ERR_INVALID_PARAM; + if (FAILED(IDXGIFactory_EnumAdapters(dxgi_factory, adapter_index, &adapter))) + return ADL_ERR_INVALID_PARAM; + + *num_displays = 0; + + while (SUCCEEDED(IDXGIAdapter_EnumOutputs(adapter, *num_displays, &output))) + { + (*num_displays)++; + IUnknown_Release(output); + } - *num_displays = wined3d_adapter_get_output_count(adapter); + IUnknown_Release(adapter); if (*num_displays == 0) return ADL_OK; @@ -317,10 +334,6 @@ int WINAPI ADL_Display_DisplayInfo_Get(int adapter_index, int *num_displays, ADL for (i = 0; i < *num_displays; i++) { - output = wined3d_adapter_get_output(adapter, i); - if (output == NULL) - return ADL_ERR; - (*info)[i].displayID.iDisplayLogicalIndex = i; (*info)[i].iDisplayInfoValue = ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED; (*info)[i].iDisplayInfoMask = (*info)[i].iDisplayInfoValue; @@ -343,17 +356,17 @@ int WINAPI ADL_Adapter_Crossfire_Get(int adapter_index, ADLCrossfireComb *comb, int WINAPI ADL_Adapter_ASICFamilyType_Get(int adapter_index, int *asic_type, int *valids) { - struct wined3d_adapter_identifier identifier; + DXGI_ADAPTER_DESC adapter_desc; FIXME("adapter %d, asic_type %p, valids %p, stub!\n", adapter_index, asic_type, valids); if (asic_type == NULL || valids == NULL) return ADL_ERR_NULL_POINTER; - if (!get_adapter_identifier(adapter_index, &identifier)) + if (get_adapter_desc(adapter_index, &adapter_desc) != ADL_OK) return ADL_ERR_INVALID_ADL_IDX; - if (identifier.vendor_id != VENDOR_AMD) + if (adapter_desc.VendorId != VENDOR_AMD) return ADL_ERR_NOT_SUPPORTED; *asic_type = ADL_ASIC_DISCRETE; @@ -402,13 +415,13 @@ static int get_max_clock(const char *clock, int default_value) /* the name and documentation suggests that this returns current freqs, but it's actually max */ int WINAPI ADL_Adapter_ObservedClockInfo_Get(int adapter_index, int *core_clock, int *memory_clock) { - struct wined3d_adapter_identifier identifier; + DXGI_ADAPTER_DESC adapter_desc; FIXME("adapter %d, core_clock %p, memory_clock %p, stub!\n", adapter_index, core_clock, memory_clock); if (core_clock == NULL || memory_clock == NULL) return ADL_ERR; - if (!get_adapter_identifier(adapter_index, &identifier)) return ADL_ERR; - if (identifier.vendor_id != VENDOR_AMD) return ADL_ERR_INVALID_ADL_IDX; + if (get_adapter_desc(adapter_index, &adapter_desc) != ADL_OK) return ADL_ERR; + if (adapter_desc.VendorId != VENDOR_AMD) return ADL_ERR_INVALID_ADL_IDX; /* default values based on RX580 */ *core_clock = get_max_clock("sclk", 1350); @@ -422,15 +435,15 @@ int WINAPI ADL_Adapter_ObservedClockInfo_Get(int adapter_index, int *core_clock, /* documented in the "Linux Specific APIs" section, present and used on Windows */ int WINAPI ADL_Adapter_MemoryInfo_Get(int adapter_index, ADLMemoryInfo *mem_info) { - struct wined3d_adapter_identifier identifier; + DXGI_ADAPTER_DESC adapter_desc; FIXME("adapter %d, mem_info %p stub!\n", adapter_index, mem_info); if (mem_info == NULL) return ADL_ERR_NULL_POINTER; - if (!get_adapter_identifier(adapter_index, &identifier)) return ADL_ERR_INVALID_ADL_IDX; - if (identifier.vendor_id != VENDOR_AMD) return ADL_ERR; + if (get_adapter_desc(adapter_index, &adapter_desc) != ADL_OK) return ADL_ERR_INVALID_ADL_IDX; + if (adapter_desc.VendorId != VENDOR_AMD) return ADL_ERR; - mem_info->iMemorySize = identifier.video_memory; + mem_info->iMemorySize = adapter_desc.DedicatedVideoMemory; mem_info->iMemoryBandwidth = 256000; /* not exposed on Linux, probably needs a lookup table */ TRACE("iMemoryBandwidth %s, iMemorySize %s\n", @@ -441,27 +454,27 @@ int WINAPI ADL_Adapter_MemoryInfo_Get(int adapter_index, ADLMemoryInfo *mem_info int WINAPI ADL_Graphics_Platform_Get(int *platform) { - struct wined3d_adapter_identifier identifier; + DXGI_ADAPTER_DESC adapter_desc; int count, i; FIXME("platform %p, stub!\n", platform); *platform = GRAPHICS_PLATFORM_UNKNOWN; - count = wined3d_get_adapter_count(wined3d); + ADL_Adapter_NumberOfAdapters_Get(&count); for (i = 0; i < count; i ++) { - if (!get_adapter_identifier(i, &identifier)) + if (get_adapter_desc(i, &adapter_desc) != ADL_OK) continue; - if (identifier.vendor_id == VENDOR_AMD) + if (adapter_desc.VendorId == VENDOR_AMD) *platform = GRAPHICS_PLATFORM_DESKTOP; } /* NOTE: The real value can be obtained by doing: * 1. ioctl(DRM_AMDGPU_INFO) with AMDGPU_INFO_DEV_INFO - dev_info.ids_flags & AMDGPU_IDS_FLAGS_FUSION - * 2. VkPhysicalDeviceType() if we ever switch to wined3d vk adapter implementation + * 2. VkPhysicalDeviceType() if we ever want to use Vulkan directly */ return ADL_OK; From bebd52251b6cd4d7cff0bf005248ce42e32b59ad Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 11 Oct 2022 20:48:10 -0500 Subject: [PATCH 0634/1506] atiadlxx: Bump driver version. CW-Bug-Id: #21397 --- dlls/atiadlxx/atiadlxx_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 6ef2edd356c..21dfbe71096 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -172,16 +172,16 @@ typedef struct ADLDisplayMap } ADLDisplayMap, *LPADLDisplayMap; static const ADLVersionsInfo version = { - "21.20.01", - "21.20.01", + "22.20.19.16-221003a-384125E-AMD-Software-Adrenalin-Edition", "", + "http://support.amd.com/drivers/xml/driver_09_us.xml", }; static const ADLVersionsInfoX2 version2 = { - "21.20.01", - "21.20.01", - "21.20.01", + "22.20.19.16-221003a-384125E-AMD-Software-Adrenalin-Edition", "", + "22.10.1", + "http://support.amd.com/drivers/xml/driver_09_us.xml", }; int WINAPI ADL2_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK cb, int arg, ADL_CONTEXT_HANDLE *ptr) From 9694f3352e73d22b5fbbabf9f77b06eaa933bc8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 30 Sep 2021 20:01:10 +0200 Subject: [PATCH 0635/1506] wine.inf: Enable builtin atiadlxx for Call of Duty games. The games call several functions from this DLL to check driver version, which we stub to some acceptable value to avoid warnings. --- loader/wine.inf.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index c28c91d45a8..cebbdedc399 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2797,3 +2797,10 @@ HKCU,Software\Wine\AppDefaults\Maine-Win64-Shipping.exe\DllOverrides,"SpeechSynt HKCU,Software\Wine\AppDefaults\rayne1.exe\DllOverrides,"d3d8",,"native" HKCU,Software\Wine\AppDefaults\rayne2.exe\DllOverrides,"d3d8",,"native" HKCU,Software\Wine\AppDefaults\RDR2.exe\DllOverrides,"vulkan-1",,"native" +;;App-specific overrides for atiadlxx.dll. +HKCU,Software\Wine\AppDefaults\s2_sp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\s2_mp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\h1_sp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\h1_mp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\iw7_ship.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\BlackOps3.exe\DllOverrides,"atiadlxx",,"builtin" From 6b38d47d8410493fbdf46b4f69e9ed7ebd0190d4 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 13 Oct 2020 18:20:39 +0300 Subject: [PATCH 0636/1506] wine.inf: Enable atiadlxx and disable ags for Shadow of War. With the recent stubs game is able to use our atiadlxx without crashing. This helps with getting the resolution list populated with AMD GPUs. AGS has to be force disabled - the dll ships with the game and uses a bunch of more complex ADL2 calls that remain unimplemented. The game works fine if the DLL is not found. --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index cebbdedc399..0f2c54e92b5 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2797,6 +2797,7 @@ HKCU,Software\Wine\AppDefaults\Maine-Win64-Shipping.exe\DllOverrides,"SpeechSynt HKCU,Software\Wine\AppDefaults\rayne1.exe\DllOverrides,"d3d8",,"native" HKCU,Software\Wine\AppDefaults\rayne2.exe\DllOverrides,"d3d8",,"native" HKCU,Software\Wine\AppDefaults\RDR2.exe\DllOverrides,"vulkan-1",,"native" +HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"amd_ags_x64",,"disabled" ;;App-specific overrides for atiadlxx.dll. HKCU,Software\Wine\AppDefaults\s2_sp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\s2_mp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" @@ -2804,3 +2805,4 @@ HKCU,Software\Wine\AppDefaults\h1_sp64_ship.exe\DllOverrides,"atiadlxx",,"builti HKCU,Software\Wine\AppDefaults\h1_mp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\iw7_ship.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\BlackOps3.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin" From 6f56c838bf9b3fa913141565a57bf387b5b9c9d6 Mon Sep 17 00:00:00 2001 From: Anna Lasky Date: Fri, 5 Feb 2021 08:31:07 -0600 Subject: [PATCH 0637/1506] wine.inf: Use built-in atiadlxx for Need For Speed. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 0f2c54e92b5..0f62ca5ea09 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2805,4 +2805,5 @@ HKCU,Software\Wine\AppDefaults\h1_sp64_ship.exe\DllOverrides,"atiadlxx",,"builti HKCU,Software\Wine\AppDefaults\h1_mp64_ship.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\iw7_ship.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\BlackOps3.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\NFS16.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin" From 026c1a0807656a8485d33cba9dd17dccb536b6f6 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 15 Mar 2021 13:24:34 -0500 Subject: [PATCH 0638/1506] wine.inf: Use built-in atiadlxx for DIRT5. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 0f62ca5ea09..4cab443c976 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2807,3 +2807,4 @@ HKCU,Software\Wine\AppDefaults\iw7_ship.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\BlackOps3.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\NFS16.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" From 7b7449fa76cf099320406f6218748f07ce92bf8e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 27 Oct 2021 17:25:25 +0300 Subject: [PATCH 0639/1506] wine.inf: Use built-in atiadlxx for GotG. CW-Bug-ID: #19579 Avoids the warning about too old drivers on start. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 4cab443c976..da038d4ba38 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2808,3 +2808,4 @@ HKCU,Software\Wine\AppDefaults\BlackOps3.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\NFS16.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" From d369abf1e203d3e003e9f4ada5fd6626674d3b68 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Sun, 12 Dec 2021 14:07:16 +0100 Subject: [PATCH 0640/1506] wine.inf: Use built-in atiadlxx for Age of Empires IV. CW-Bug-ID: #19602 Avoids the warning about too old drivers on start. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index da038d4ba38..0eeea655344 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2809,3 +2809,4 @@ HKCU,Software\Wine\AppDefaults\NFS16.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"builtin" From 9861f10eed9b25cd39be1a163d9943b9c1e7cde4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 25 Nov 2021 21:33:24 +0300 Subject: [PATCH 0641/1506] wine.inf: Use built-in atiadlxx for Marvel's Avengers. CW-Bug-Id: #19687 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 0eeea655344..b7c57f02d9f 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2810,3 +2810,4 @@ HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\Avengers.exe\DllOverrides,"atiadlxx",,"builtin" From 0de0e2dea9b38a7cf7970215b8f8254f7d2eda6c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 2 Feb 2022 18:26:36 +0300 Subject: [PATCH 0642/1506] wine.inf: Use built-in atiadlxx for STAR WARS Squadrons. CW-Bug-Id: #19944 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index b7c57f02d9f..d6f33cc4542 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2811,3 +2811,4 @@ HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\Avengers.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\starwarssquadrons.exe\DllOverrides,"atiadlxx",,"builtin" From 8b8803a45468b21a7f9f73ce05a28df420535bcc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 29 Jun 2022 11:12:42 -0500 Subject: [PATCH 0643/1506] wine.inf: Use built-in atiadlxx for Plants vs Zombies Garden Warfare 2. CW-Bug-Id: #20818 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index d6f33cc4542..ccf2dd84081 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2812,3 +2812,4 @@ HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\Avengers.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\starwarssquadrons.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\GW2.Main_Win64_Retail.exe\DllOverrides,"atiadlxx",,"builtin" From 372b3a25bf2376d46bc66cacd2b7e5e2fef7d4ee Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 11 Oct 2022 20:51:30 -0500 Subject: [PATCH 0644/1506] wine.inf: Use built-in atiadlxx for Spider-Man Remastered. CW-Bug-Id: #21397 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index ccf2dd84081..b00535b880b 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2813,3 +2813,4 @@ HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"built HKCU,Software\Wine\AppDefaults\Avengers.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\starwarssquadrons.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\GW2.Main_Win64_Retail.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\Spider-Man.exe\DllOverrides,"atiadlxx",,"builtin" From f3bb6476fe965d72ae98f389930f14f996be4dd6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 20 Jul 2023 20:45:34 -0600 Subject: [PATCH 0645/1506] amd_ags_x64, atiadlxx: Bump driver version. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 11 +++++++---- dlls/atiadlxx/atiadlxx_main.c | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 3706e21915c..facea4ff622 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -22,6 +22,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); +static const char driver_version[] = "23.10.01.45-230626a-393367C-AMD-Software-Adrenalin-Edition"; +static const char radeon_version[] = "23.7.1"; + enum amd_ags_version { AMD_AGS_VERSION_5_1_1, @@ -586,8 +589,8 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi gpu_info->agsVersionMajor = amd_ags_info[object->version].major; gpu_info->agsVersionMinor = amd_ags_info[object->version].minor; gpu_info->agsVersionPatch = amd_ags_info[object->version].patch; - gpu_info->driverVersion = "21.30.25.05-211005a-372402E-RadeonSoftware"; - gpu_info->radeonSoftwareVersion = "21.10.2"; + gpu_info->driverVersion = driver_version; + gpu_info->radeonSoftwareVersion = radeon_version; gpu_info->numDevices = object->device_count; gpu_info->devices = object->devices; @@ -621,8 +624,8 @@ AGSReturnCode WINAPI agsInitialize(int ags_version, const AGSConfiguration *conf } memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->driverVersion = "21.30.25.05-211005a-372402E-RadeonSoftware"; - gpu_info->radeonSoftwareVersion = "21.10.2"; + gpu_info->driverVersion = driver_version; + gpu_info->radeonSoftwareVersion = radeon_version; gpu_info->numDevices = object->device_count; gpu_info->devices = object->devices; diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 21dfbe71096..7104bcfa723 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -172,15 +172,15 @@ typedef struct ADLDisplayMap } ADLDisplayMap, *LPADLDisplayMap; static const ADLVersionsInfo version = { - "22.20.19.16-221003a-384125E-AMD-Software-Adrenalin-Edition", + "23.10.01.45-230626a-393367C-AMD-Software-Adrenalin-Edition", "", "http://support.amd.com/drivers/xml/driver_09_us.xml", }; static const ADLVersionsInfoX2 version2 = { - "22.20.19.16-221003a-384125E-AMD-Software-Adrenalin-Edition", + "23.10.01.45-230626a-393367C-AMD-Software-Adrenalin-Edition", "", - "22.10.1", + "23.7.1", "http://support.amd.com/drivers/xml/driver_09_us.xml", }; From 47e09fe92737724e5820772026ad5c643fd1565b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 14 Aug 2023 16:41:03 -0600 Subject: [PATCH 0646/1506] amd_ags_x64, atiadlxx: Bump driver version. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 4 ++-- dlls/atiadlxx/atiadlxx_main.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index facea4ff622..6a8167d0a59 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -22,8 +22,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); -static const char driver_version[] = "23.10.01.45-230626a-393367C-AMD-Software-Adrenalin-Edition"; -static const char radeon_version[] = "23.7.1"; +static const char driver_version[] = "23.10.23.02-230720a-394204C-AMD-Software-Adrenalin-Edition"; +static const char radeon_version[] = "23.8.1"; enum amd_ags_version { diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 7104bcfa723..8c52dbdc601 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -172,15 +172,15 @@ typedef struct ADLDisplayMap } ADLDisplayMap, *LPADLDisplayMap; static const ADLVersionsInfo version = { - "23.10.01.45-230626a-393367C-AMD-Software-Adrenalin-Edition", + "23.10.23.02-230720a-394204C-AMD-Software-Adrenalin-Edition", "", "http://support.amd.com/drivers/xml/driver_09_us.xml", }; static const ADLVersionsInfoX2 version2 = { - "23.10.01.45-230626a-393367C-AMD-Software-Adrenalin-Edition", + "23.10.23.02-230720a-394204C-AMD-Software-Adrenalin-Edition", "", - "23.7.1", + "23.8.1", "http://support.amd.com/drivers/xml/driver_09_us.xml", }; From d78146a7572cc4a8ad12ce24b4cce20ba06930c9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 25 Aug 2023 14:40:35 -0600 Subject: [PATCH 0647/1506] amd_ags_x64: Support version 5.0.5. Elden Ring is using this version. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 6a8167d0a59..7cc3c2476d2 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -27,6 +27,7 @@ static const char radeon_version[] = "23.8.1"; enum amd_ags_version { + AMD_AGS_VERSION_5_0_5, AMD_AGS_VERSION_5_1_1, AMD_AGS_VERSION_5_2_0, AMD_AGS_VERSION_5_2_1, @@ -51,6 +52,7 @@ static const struct } amd_ags_info[AMD_AGS_VERSION_COUNT] = { + {5, 0, 5, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511)}, {5, 1, 1, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511)}, {5, 2, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, {5, 2, 1, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, @@ -63,22 +65,22 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {6, 1, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, }; -#define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} -#define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ -1, -1, -1, -1, -1}} -#define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, \ +#define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} -#define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, \ +#define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ -1, -1, -1}} -#define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1, \ -1, -1}} @@ -941,9 +943,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds_530(AGSContext* cont return set_depth_bounds(context, dx_context, enabled, min_depth, max_depth); } +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $3,%eax\n\t" + "cmp $4,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) @@ -992,9 +995,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap(AGSContext *context return update_uav_overlap(context, dx_context, TRUE); } +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); __ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $3,%eax\n\t" + "cmp $4,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap") ) @@ -1025,9 +1029,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap(AGSContext *context, return update_uav_overlap(context, dx_context, FALSE); } +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); __ASM_GLOBAL_FUNC( DX11_EndUAVOverlap_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $3,%eax\n\t" + "cmp $4,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap") ) @@ -1070,9 +1075,11 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_511(AGSContext *conte return agsDriverExtensionsDX11_DestroyDevice_520(context, device, references, NULL, NULL); } + +C_ASSERT(AMD_AGS_VERSION_5_2_0 == 2); __ASM_GLOBAL_FUNC( agsDriverExtensionsDX11_DestroyDevice, "mov (%rcx),%eax\n\t" /* version */ - "cmp $1,%eax\n\t" + "cmp $2,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_511") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_520") ) From 3d9e32fa88984ef252aabbe79b33ccd36261cf3d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 28 Aug 2023 11:46:57 -0600 Subject: [PATCH 0648/1506] amd_ags_x64: Fill chroma info in AGSDisplayInfo. Based on a patch by Joshua Ashton. CW-Bug-Id: #22677 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 107 +++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 7cc3c2476d2..1b55df5d798 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -11,10 +11,11 @@ #include "wine/asm.h" #define COBJMACROS +#include "initguid.h" #include "d3d11.h" #include "d3d12.h" -#include "initguid.h" +#include "dxgi1_6.h" #include "dxvk_interfaces.h" @@ -344,8 +345,103 @@ struct monitor_enum_context_600 const char *adapter_name; AGSDisplayInfo_600 **ret_displays; int *ret_display_count; + IDXGIFactory1 *dxgi_factory; }; +static void create_dxgi_factory(HMODULE *hdxgi, IDXGIFactory1 **factory) +{ + typeof(CreateDXGIFactory1) *pCreateDXGIFactory1; + + *factory = NULL; + + if (!(*hdxgi = LoadLibraryW(L"dxgi.dll"))) + { + ERR("Could not load dxgi.dll.\n"); + return; + } + + if (!(pCreateDXGIFactory1 = (void *)GetProcAddress(*hdxgi, "CreateDXGIFactory1"))) + { + ERR("Could not find CreateDXGIFactory1.\n"); + return; + } + + if (FAILED(pCreateDXGIFactory1(&IID_IDXGIFactory1, (void**)factory))) + return; +} + +static void release_dxgi_factory(HMODULE hdxgi, IDXGIFactory1 *factory) +{ + if (factory) + IDXGIFactory1_Release(factory); + if (hdxgi) + FreeLibrary(hdxgi); +} + +static void fill_chroma_info(AGSDisplayInfo_600 *info, struct monitor_enum_context_600 *c, HMONITOR monitor) +{ + DXGI_OUTPUT_DESC1 output_desc; + IDXGIAdapter1 *adapter; + IDXGIOutput6 *output6; + IDXGIOutput *output; + BOOL found = FALSE; + unsigned int i, j; + HRESULT hr; + + i = 0; + while (!found && (SUCCEEDED(IDXGIFactory1_EnumAdapters1(c->dxgi_factory, i++, &adapter)))) + { + j = 0; + while (SUCCEEDED(IDXGIAdapter1_EnumOutputs(adapter, j++, &output))) + { + hr = IDXGIOutput_QueryInterface(output, &IID_IDXGIOutput6, (void**)&output6); + IDXGIOutput_Release(output); + if (FAILED(hr)) + { + WARN("Failed to query IDXGIOutput6.\n"); + continue; + } + hr = IDXGIOutput6_GetDesc1(output6, &output_desc); + IDXGIOutput6_Release(output6); + + if (FAILED(hr) || output_desc.Monitor != monitor) + continue; + found = TRUE; + + TRACE("output_desc.ColorSpace %#x.\n", output_desc.ColorSpace); + if (output_desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) + { + TRACE("Reporting monitor %s as HDR10 supported.\n", debugstr_a(info->displayDeviceName)); + info->HDR10 = 1; + } + + info->chromaticityRedX = output_desc.RedPrimary[0]; + info->chromaticityRedY = output_desc.RedPrimary[1]; + info->chromaticityGreenX = output_desc.GreenPrimary[0]; + info->chromaticityGreenY = output_desc.GreenPrimary[1]; + info->chromaticityBlueX = output_desc.BluePrimary[0]; + info->chromaticityBlueY = output_desc.BluePrimary[1]; + info->chromaticityWhitePointX = output_desc.WhitePoint[0]; + info->chromaticityWhitePointY = output_desc.WhitePoint[1]; + + TRACE("chromacity: (%.6lf, %.6lf) (%.6lf, %.6lf) (%.6lf, %.6lf).\n", info->chromaticityRedX, + info->chromaticityRedY, info->chromaticityGreenX, info->chromaticityGreenY, info->chromaticityBlueX, + info->chromaticityBlueY); + + info->screenDiffuseReflectance = 0; + info->screenSpecularReflectance = 0; + + info->minLuminance = output_desc.MinLuminance; + info->maxLuminance = output_desc.MaxLuminance; + info->avgLuminance = output_desc.MaxFullFrameLuminance; + } + IDXGIAdapter1_Release(adapter); + } + + if (!found) + WARN("dxgi output not found.\n"); +} + static BOOL WINAPI monitor_enum_proc_600(HMONITOR hmonitor, HDC hdc, RECT *rect, LPARAM context) { struct monitor_enum_context_600 *c = (struct monitor_enum_context_600 *)context; @@ -415,6 +511,9 @@ static BOOL WINAPI monitor_enum_proc_600(HMONITOR hmonitor, HDC hdc, RECT *rect, dev_mode.dmSize = sizeof(dev_mode); } + info->eyefinityGridCoordX = -1; + info->eyefinityGridCoordY = -1; + info->currentResolution.offsetX = monitor_info.rcMonitor.left; info->currentResolution.offsetY = monitor_info.rcMonitor.top; info->currentResolution.width = monitor_info.rcMonitor.right - monitor_info.rcMonitor.left; @@ -428,6 +527,9 @@ static BOOL WINAPI monitor_enum_proc_600(HMONITOR hmonitor, HDC hdc, RECT *rect, info->currentRefreshRate = dev_mode.dmDisplayFrequency; else ERR("Could not get current display settings.\n"); + + fill_chroma_info(info, c, hmonitor); + ++*c->ret_display_count; TRACE("Added display %s for %s.\n", debugstr_a(monitor_info.szDevice), debugstr_a(c->adapter_name)); @@ -439,14 +541,17 @@ static BOOL WINAPI monitor_enum_proc_600(HMONITOR hmonitor, HDC hdc, RECT *rect, static void init_device_displays_600(const char *adapter_name, AGSDisplayInfo_600 **ret_displays, int *ret_display_count) { struct monitor_enum_context_600 context; + HMODULE hdxgi; TRACE("adapter_name %s.\n", debugstr_a(adapter_name)); context.adapter_name = adapter_name; context.ret_displays = ret_displays; context.ret_display_count = ret_display_count; + create_dxgi_factory(&hdxgi, &context.dxgi_factory); EnumDisplayMonitors(NULL, NULL, monitor_enum_proc_600, (LPARAM)&context); + release_dxgi_factory(hdxgi, context.dxgi_factory); } static void init_device_displays_511(const char *adapter_name, AGSDisplayInfo_511 **ret_displays, int *ret_display_count) From 539c8ff7ce4ab7e4d396bd8f05d0176be469ea85 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 26 Aug 2023 15:01:32 +0100 Subject: [PATCH 0649/1506] amd_ags_x64: Add definitions for AGSDisplaySettings_506 The enum stuff is slightly different here. Signed-off-by: Joshua Ashton CW-Bug-Id: #22677 --- dlls/amd_ags_x64/amd_ags.h | 55 ++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index f0afda73d37..52276cc1935 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -689,22 +689,54 @@ typedef struct AGSGPUInfo_600 } AGSGPUInfo_600; /// The display mode -typedef enum AGSDisplaySettings_Mode +typedef enum AGSDisplaySettings_Mode_506 { - Mode_SDR, ///< SDR mode - Mode_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. - Mode_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. - Mode_FreesyncHDR_scRGB, ///< Freesync HDR scRGB, requiring an FP16 swapchain. A value of 1.0 == 80 nits. - Mode_FreesyncHDR_Gamma22, ///< Freesync HDR Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. - Mode_DolbyVision, ///< Dolby Vision, requiring an 8888 UNORM swapchain + Mode_506_SDR, ///< SDR mode + Mode_506_scRGB, ///< scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. Uses REC709 primaries. + Mode_506_PQ, ///< PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. Uses BT2020 primaries. + Mode_506_DolbyVision ///< Dolby Vision, requiring an 8888 UNORM swapchain +} AGSDisplaySettings_Mode_506; - Mode_Count ///< Number of enumerated display modes -} AGSDisplaySettings_Mode; +typedef enum AGSDisplaySettings_Mode_600 +{ + Mode_600_SDR, ///< SDR mode + Mode_600_HDR10_PQ, ///< HDR10 PQ encoding, requiring a 1010102 UNORM swapchain and PQ encoding in the output shader. + Mode_600_HDR10_scRGB, ///< HDR10 scRGB, requiring an FP16 swapchain. Values of 1.0 == 80 nits, 125.0 == 10000 nits. + Mode_600_FreesyncHDR_scRGB, ///< Freesync HDR scRGB, requiring an FP16 swapchain. A value of 1.0 == 80 nits. + Mode_600_FreesyncHDR_Gamma22, ///< Freesync HDR Gamma 2.2, requiring a 1010102 UNORM swapchain. The output needs to be encoded to gamma 2.2. + Mode_600_DolbyVision, ///< Dolby Vision, requiring an 8888 UNORM swapchain + + Mode_600_Count ///< Number of enumerated display modes +} AGSDisplaySettings_Mode_600; + +/// The struct to specify the display settings to the driver. +typedef struct AGSDisplaySettings_506 +{ + AGSDisplaySettings_Mode_506 mode; ///< The display mode to set the display into + + double chromaticityRedX; ///< Red display primary X coord + double chromaticityRedY; ///< Red display primary Y coord + + double chromaticityGreenX; ///< Green display primary X coord + double chromaticityGreenY; ///< Green display primary Y coord + + double chromaticityBlueX; ///< Blue display primary X coord + double chromaticityBlueY; ///< Blue display primary Y coord + + double chromaticityWhitePointX; ///< White point X coord + double chromaticityWhitePointY; ///< White point Y coord + + double minLuminance; ///< The minimum scene luminance in nits + double maxLuminance; ///< The maximum scene luminance in nits + + double maxContentLightLevel; ///< The maximum content light level in nits (MaxCLL) + double maxFrameAverageLightLevel; ///< The maximum frame average light level in nits (MaxFALL) +} AGSDisplaySettings_506; /// The struct to specify the display settings to the driver. typedef struct AGSDisplaySettings_511 { - AGSDisplaySettings_Mode mode; ///< The display mode to set the display into + AGSDisplaySettings_Mode_600 mode; ///< The display mode to set the display into double chromaticityRedX; ///< Red display primary X coord double chromaticityRedY; ///< Red display primary Y coord @@ -731,7 +763,7 @@ typedef struct AGSDisplaySettings_511 /// The struct to specify the display settings to the driver. typedef struct AGSDisplaySettings_600 { - AGSDisplaySettings_Mode mode; ///< The display mode to set the display into + AGSDisplaySettings_Mode_600 mode; ///< The display mode to set the display into double chromaticityRedX; ///< Red display primary X coord double chromaticityRedY; ///< Red display primary Y coord @@ -757,6 +789,7 @@ typedef struct AGSDisplaySettings_600 typedef union AGSDisplaySettings { + AGSDisplaySettings_506 agsDisplaySettings506; AGSDisplaySettings_511 agsDisplaySettings511; AGSDisplaySettings_600 agsDisplaySettings600; } AGSDisplaySettings; From 94ab061b367feca9021ced2ac75421632a1c74a7 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 26 Aug 2023 15:02:15 +0100 Subject: [PATCH 0650/1506] amd_ags_x64: Implement agsSetDisplayMode Gets HDR working with Elden Ring. With minor changes by Paul Gofman: - update for prior changes (create dxgi factory when needed); - still return success if anything goes wrong with getting dxgi custom interface; - add a trace with chromacity; - remove '!' in trace messages. CW-Bug-Id: #22677 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 97 +++++++++++++++++++++++++++- dlls/amd_ags_x64/dxvk_interfaces.idl | 35 ++++++++++ 2 files changed, 130 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 1b55df5d798..ca0fb573e3e 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -777,15 +777,108 @@ AGSReturnCode WINAPI agsDeInitialize(AGSContext *context) return AGS_SUCCESS; } +static DXGI_COLOR_SPACE_TYPE convert_ags_colorspace_506(AGSDisplaySettings_Mode_506 mode) +{ + switch (mode) + { + default: + ERR("Unknown color space in AGS: %d.\n", mode); + /* fallthrough */ + case Mode_506_SDR: + TRACE("Setting Mode_506_SDR.\n"); + return DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; + case Mode_506_PQ: + TRACE("Setting Mode_506_PQ.\n"); + return DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; + case Mode_506_scRGB: + TRACE("Setting Mode_506_scRGB.\n"); + return DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709; + } +} + +static DXGI_COLOR_SPACE_TYPE convert_ags_colorspace_600(AGSDisplaySettings_Mode_600 mode) +{ + switch (mode) + { + default: + ERR("Unknown color space in AGS: %d\n", mode); + /* fallthrough */ + case Mode_600_SDR: + TRACE("Setting Mode_600_SDR.\n"); + return DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; + case Mode_600_HDR10_PQ: + TRACE("Setting Mode_600_HDR10_PQ.\n"); + return DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; + case Mode_600_HDR10_scRGB: + TRACE("Setting Mode_600_HDR10_scRGB.\n"); + return DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709; + } +} + +static DXGI_HDR_METADATA_HDR10 convert_ags_metadata(const AGSDisplaySettings_600 *settings) +{ + DXGI_HDR_METADATA_HDR10 metadata; + metadata.RedPrimary[0] = settings->chromaticityRedX * 50000; + metadata.RedPrimary[1] = settings->chromaticityRedY * 50000; + metadata.GreenPrimary[0] = settings->chromaticityGreenX * 50000; + metadata.GreenPrimary[1] = settings->chromaticityGreenY * 50000; + metadata.BluePrimary[0] = settings->chromaticityBlueX * 50000; + metadata.BluePrimary[1] = settings->chromaticityBlueY * 50000; + metadata.WhitePoint[0] = settings->chromaticityWhitePointX * 50000; + metadata.WhitePoint[1] = settings->chromaticityWhitePointY * 50000; + metadata.MaxMasteringLuminance = settings->maxLuminance; + metadata.MinMasteringLuminance = settings->minLuminance / 0.0001f; + metadata.MaxContentLightLevel = settings->maxContentLightLevel; + metadata.MaxFrameAverageLightLevel = settings->maxFrameAverageLightLevel; + return metadata; +} + AGSReturnCode WINAPI agsSetDisplayMode(AGSContext *context, int device_index, int display_index, const AGSDisplaySettings *settings) { - FIXME("context %p device_index %d display_index %d settings %p stub!\n", context, device_index, + const AGSDisplaySettings_506 *settings506 = &settings->agsDisplaySettings506; + const AGSDisplaySettings_600 *settings600 = &settings->agsDisplaySettings600; + IDXGIVkInteropFactory1 *dxgi_interop = NULL; + DXGI_COLOR_SPACE_TYPE colorspace; + DXGI_HDR_METADATA_HDR10 metadata; + AGSReturnCode ret = AGS_SUCCESS; + IDXGIFactory1 *dxgi_factory; + HMODULE hdxgi; + + TRACE("context %p device_index %d display_index %d settings %p\n", context, device_index, display_index, settings); if (!context) return AGS_INVALID_ARGS; - return AGS_SUCCESS; + create_dxgi_factory(&hdxgi, &dxgi_factory); + if (!dxgi_factory) + goto done; + + if (FAILED(IDXGIFactory1_QueryInterface(dxgi_factory, &IID_IDXGIVkInteropFactory1, (void**)&dxgi_interop))) + { + WARN("Failed to get IDXGIVkInteropFactory1.\n"); + goto done; + } + + colorspace = context->version < AMD_AGS_VERSION_5_1_1 + ? convert_ags_colorspace_506(settings506->mode) + : convert_ags_colorspace_600(settings600->mode); + /* Settings 506, 511 and 600 are identical aside from enum order + use + * of bitfield flags we do not use. */ + metadata = convert_ags_metadata(settings600); + + TRACE("chromacity: (%.6lf, %.6lf) (%.6lf, %.6lf) (%.6lf, %.6lf).\n", settings600->chromaticityRedX, + settings600->chromaticityRedY, settings600->chromaticityGreenX, settings600->chromaticityGreenY, + settings600->chromaticityBlueX, settings600->chromaticityBlueY); + + if (FAILED(IDXGIVkInteropFactory1_SetGlobalHDRState(dxgi_interop, colorspace, &metadata))) + ret = AGS_DX_FAILURE; + +done: + if (dxgi_interop) + IDXGIVkInteropFactory1_Release(dxgi_interop); + release_dxgi_factory(hdxgi, dxgi_factory); + return ret; } AGSReturnCode WINAPI agsGetCrossfireGPUCount(AGSContext *context, int *gpu_count) diff --git a/dlls/amd_ags_x64/dxvk_interfaces.idl b/dlls/amd_ags_x64/dxvk_interfaces.idl index c632d926fb2..110cdb94896 100644 --- a/dlls/amd_ags_x64/dxvk_interfaces.idl +++ b/dlls/amd_ags_x64/dxvk_interfaces.idl @@ -17,6 +17,11 @@ */ import "d3d11.idl"; +import "dxgi1_6.idl"; + +typedef struct VkInstance_T *VkInstance; +typedef void (__stdcall *PFN_vkVoidFunction)(void); +typedef PFN_vkVoidFunction (__stdcall *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); typedef enum D3D11_VK_EXTENSION { @@ -114,3 +119,33 @@ interface ID3D11VkExtContext1 : ID3D11VkExtContext [in] const void *params, [in] UINT32 param_size, [in] void * const *read_resources, [in] UINT32 read_resource_count, [in] void* const *write_resources, [in] UINT32 write_resources_count); } + +[ + object, + uuid(4c5e1b0d-b0c8-4131-bfd8-9b2476f7f408), + local, + pointer_default(unique) +] +interface IDXGIVkInteropFactory : IUnknown +{ + void GetVulkanInstance( + [out] VkInstance *pInstance, + [out] PFN_vkGetInstanceProcAddr *ppfnVkGetInstanceProcAddr); +} + +[ + object, + uuid(2a289dbd-2d0a-4a51-89f7-f2adce465cd6), + local, + pointer_default(unique) +] +interface IDXGIVkInteropFactory1 : IDXGIVkInteropFactory +{ + HRESULT GetGlobalHDRState( + [out] DXGI_COLOR_SPACE_TYPE *pOutColorSpace, + [out] DXGI_HDR_METADATA_HDR10 *ppOutMetadata) = 0; + + HRESULT SetGlobalHDRState( + [in] DXGI_COLOR_SPACE_TYPE ColorSpace, + [in] const DXGI_HDR_METADATA_HDR10 *pMetadata) = 0; +} From 37750385efcf689a2e68d76075dac1e1f1174bc3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 24 Oct 2023 12:17:28 -0600 Subject: [PATCH 0651/1506] amd_ags_x64,atiadll,wbemprox,win32u: Bump AMD driver version. --- dlls/amd_ags_x64/amd_ags_x64_main.c | 4 ++-- dlls/atiadlxx/atiadlxx_main.c | 6 +++--- dlls/wbemprox/builtin.c | 4 ++-- dlls/win32u/sysparams.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index ca0fb573e3e..1ee87f77a1e 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -23,8 +23,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); -static const char driver_version[] = "23.10.23.02-230720a-394204C-AMD-Software-Adrenalin-Edition"; -static const char radeon_version[] = "23.8.1"; +static const char driver_version[] = "23.19.02-230831a-396538C-AMD-Software-Adrenalin-Edition"; +static const char radeon_version[] = "23.10.2"; enum amd_ags_version { diff --git a/dlls/atiadlxx/atiadlxx_main.c b/dlls/atiadlxx/atiadlxx_main.c index 8c52dbdc601..8fdd2e55d02 100644 --- a/dlls/atiadlxx/atiadlxx_main.c +++ b/dlls/atiadlxx/atiadlxx_main.c @@ -172,15 +172,15 @@ typedef struct ADLDisplayMap } ADLDisplayMap, *LPADLDisplayMap; static const ADLVersionsInfo version = { - "23.10.23.02-230720a-394204C-AMD-Software-Adrenalin-Edition", + "23.19.02-230831a-396538C-AMD-Software-Adrenalin-Edition", "", "http://support.amd.com/drivers/xml/driver_09_us.xml", }; static const ADLVersionsInfoX2 version2 = { - "23.10.23.02-230720a-394204C-AMD-Software-Adrenalin-Edition", + "23.19.02-230831a-396538C-AMD-Software-Adrenalin-Edition", "", - "23.8.1", + "23.10.2", "http://support.amd.com/drivers/xml/driver_09_us.xml", }; diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 31df1f5c920..67b446722fc 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -4195,8 +4195,8 @@ static enum fill_status fill_videocontroller( struct table *table, const struct rec->current_verticalres = vres; rec->description = wcsdup( name ); rec->device_id = L"VideoController1"; - rec->driverdate = L"20230420000000.000000-000"; - rec->driverversion = L"31.0.14051.5006"; + rec->driverdate = L"20230831000000.000000-000"; + rec->driverversion = L"31.0.21902.5"; rec->installeddriver = get_videocontroller_installeddriver( desc.VendorId ); rec->name = wcsdup( name ); rec->pnpdevice_id = get_videocontroller_pnpdeviceid( &desc ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 986a066ab60..dda7a665d23 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1399,7 +1399,7 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) break; /* AMD */ case 0x1002: - sprintf( buffer, "31.0.14051.5006" ); + sprintf( buffer, "31.0.21902.5" ); break; /* Nvidia */ case 0x10de: From 2adc7a5175bfd900549eed1a0c205695f4c07fd2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Nov 2023 16:06:37 -0600 Subject: [PATCH 0652/1506] amd_ags_x64: Implement agsDriverExtensionsDX11_DeInit(). CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index a825a450cfa..d8126fa961a 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -8,7 +8,7 @@ @ stub agsDriverExtensionsDX11_CreateTexture1D @ stub agsDriverExtensionsDX11_CreateTexture2D @ stub agsDriverExtensionsDX11_CreateTexture3D -@ stub agsDriverExtensionsDX11_DeInit +@ stdcall agsDriverExtensionsDX11_DeInit(ptr) @ stub agsDriverExtensionsDX11_Destroy @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_DestroyDevice() @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_EndUAVOverlap() DX11_EndUAVOverlap_impl diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 1ee87f77a1e..3a9f99c1bc4 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1078,6 +1078,19 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext *context, ID3D11De return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensionsDX11_DeInit( AGSContext* context ) +{ + TRACE("context %p.\n", context); + + if (context->d3d11_context) + { + ID3D11DeviceContext_Release(context->d3d11_context); + context->d3d11_context = NULL; + } + + return AGS_SUCCESS; +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From 72f2590d2592767ad5e2dbf4eebf903990854b22 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Nov 2023 16:22:26 -0600 Subject: [PATCH 0653/1506] amd_ags_x64: Factor out get_version_number(). CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 3a9f99c1bc4..96f952aed96 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -251,6 +251,20 @@ static AGSReturnCode vk_get_physical_device_properties(unsigned int *out_count, return ret; } +static enum amd_ags_version get_version_number(int ags_version) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(amd_ags_info); i++) + if (AGS_MAKE_VERSION(amd_ags_info[i].major, amd_ags_info[i].minor, amd_ags_info[i].patch) == ags_version) + { + TRACE("Found AGS v%d.%d.%d.\n", amd_ags_info[i].major, amd_ags_info[i].minor, amd_ags_info[i].patch); + return i; + } + ERR("Unknown ags_version %#x, using 5.4.1.\n", ags_version); + return AMD_AGS_VERSION_5_4_1; +} + static enum amd_ags_version determine_ags_version(void) { /* AMD AGS is not binary compatible between versions (even minor versions), and the game @@ -265,7 +279,7 @@ static enum amd_ags_version determine_ags_version(void) DWORD infosize; void *infobuf = NULL; void *val; - UINT vallen, i; + UINT vallen; VS_FIXEDFILEINFO *info; UINT16 major, minor, patch; WCHAR dllname[MAX_PATH], temp_path[MAX_PATH], temp_name[MAX_PATH]; @@ -318,17 +332,7 @@ static enum amd_ags_version determine_ags_version(void) minor = info->dwFileVersionMS; patch = info->dwFileVersionLS >> 16; TRACE("Found amd_ags_x64.dll v%d.%d.%d\n", major, minor, patch); - - for (i = 0; i < ARRAY_SIZE(amd_ags_info); i++) - { - if ((major == amd_ags_info[i].major) && - (minor == amd_ags_info[i].minor) && - (patch == amd_ags_info[i].patch)) - { - ret = i; - break; - } - } + ret = get_version_number(AGS_MAKE_VERSION(major, minor, patch)); done: if (*temp_name) From 1d4f88a56ae57f159414b3736784500e65174594 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 27 Sep 2023 20:32:35 -0600 Subject: [PATCH 0654/1506] amd_ags_x64: Use version provided for agsInitialize(). CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 96f952aed96..1d31494b986 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -265,7 +265,7 @@ static enum amd_ags_version get_version_number(int ags_version) return AMD_AGS_VERSION_5_4_1; } -static enum amd_ags_version determine_ags_version(void) +static enum amd_ags_version determine_ags_version(int ags_version) { /* AMD AGS is not binary compatible between versions (even minor versions), and the game * does not request a specific version when calling agsInit(). @@ -284,6 +284,11 @@ static enum amd_ags_version determine_ags_version(void) UINT16 major, minor, patch; WCHAR dllname[MAX_PATH], temp_path[MAX_PATH], temp_name[MAX_PATH]; + TRACE("ags_version %#x.\n", ags_version); + + if (ags_version) + return get_version_number(ags_version); + *temp_name = 0; if (!(infosize = GetModuleFileNameW(GetModuleHandleW(L"amd_ags_x64.dll"), dllname, ARRAY_SIZE(dllname))) || infosize == ARRAY_SIZE(dllname)) @@ -581,7 +586,7 @@ static void init_device_displays_511(const char *adapter_name, AGSDisplayInfo_51 } -static AGSReturnCode init_ags_context(AGSContext *context) +static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) { AGSReturnCode ret; unsigned int i, j; @@ -589,7 +594,7 @@ static AGSReturnCode init_ags_context(AGSContext *context) memset(context, 0, sizeof(*context)); - context->version = determine_ags_version(); + context->version = determine_ags_version(ags_version); ret = vk_get_physical_device_properties(&context->device_count, &context->properties, &context->memory_properties); if (ret != AGS_SUCCESS || !context->device_count) @@ -690,7 +695,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi if (!(object = heap_alloc(sizeof(*object)))) return AGS_OUT_OF_MEMORY; - if ((ret = init_ags_context(object)) != AGS_SUCCESS) + if ((ret = init_ags_context(object, 0)) != AGS_SUCCESS) { heap_free(object); return ret; @@ -728,7 +733,7 @@ AGSReturnCode WINAPI agsInitialize(int ags_version, const AGSConfiguration *conf if (!(object = heap_alloc(sizeof(*object)))) return AGS_OUT_OF_MEMORY; - if ((ret = init_ags_context(object)) != AGS_SUCCESS) + if ((ret = init_ags_context(object, ags_version)) != AGS_SUCCESS) { heap_free(object); return ret; @@ -1051,7 +1056,7 @@ AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported int WINAPI agsGetVersionNumber(void) { - enum amd_ags_version version = determine_ags_version(); + enum amd_ags_version version = determine_ags_version(0); TRACE("version %d.\n", version); From 879f6bceb5b2d5578d41c8dc146ea485f108ae5c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Nov 2023 16:57:24 -0600 Subject: [PATCH 0655/1506] amd_ags_x64: Factor out get_ags_version_from_resource(). CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 90 ++++++++++++++++------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 1d31494b986..c2a94703285 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -265,6 +265,52 @@ static enum amd_ags_version get_version_number(int ags_version) return AMD_AGS_VERSION_5_4_1; } +static BOOL get_ags_version_from_resource(const WCHAR *filename, enum amd_ags_version *ret) +{ + DWORD infosize; + void *infobuf; + void *val; + UINT vallen; + VS_FIXEDFILEINFO *info; + UINT16 major, minor, patch; + + infosize = GetFileVersionInfoSizeW(filename, NULL); + if (!infosize) + { + ERR("File version info not found, err %u.\n", GetLastError()); + return FALSE; + } + + if (!(infobuf = heap_alloc(infosize))) + { + ERR("Failed to allocate memory.\n"); + return FALSE; + } + + if (!GetFileVersionInfoW(filename, 0, infosize, infobuf)) + { + ERR("GetFileVersionInfoW failed, err %u.\n", GetLastError()); + heap_free(infobuf); + return FALSE; + } + + if (!VerQueryValueW(infobuf, L"\\", &val, &vallen) || (vallen != sizeof(VS_FIXEDFILEINFO))) + { + ERR("Version value not found, err %u.\n", GetLastError()); + heap_free(infobuf); + return FALSE; + } + + info = val; + major = info->dwFileVersionMS >> 16; + minor = info->dwFileVersionMS; + patch = info->dwFileVersionLS >> 16; + TRACE("Found amd_ags_x64.dll v%d.%d.%d\n", major, minor, patch); + *ret = get_version_number(AGS_MAKE_VERSION(major, minor, patch)); + heap_free(infobuf); + return TRUE; +} + static enum amd_ags_version determine_ags_version(int ags_version) { /* AMD AGS is not binary compatible between versions (even minor versions), and the game @@ -276,13 +322,8 @@ static enum amd_ags_version determine_ags_version(int ags_version) * In case of an error, assume it's that version. */ enum amd_ags_version ret = AMD_AGS_VERSION_5_4_1; - DWORD infosize; - void *infobuf = NULL; - void *val; - UINT vallen; - VS_FIXEDFILEINFO *info; - UINT16 major, minor, patch; WCHAR dllname[MAX_PATH], temp_path[MAX_PATH], temp_name[MAX_PATH]; + DWORD size; TRACE("ags_version %#x.\n", ags_version); @@ -290,8 +331,8 @@ static enum amd_ags_version determine_ags_version(int ags_version) return get_version_number(ags_version); *temp_name = 0; - if (!(infosize = GetModuleFileNameW(GetModuleHandleW(L"amd_ags_x64.dll"), dllname, ARRAY_SIZE(dllname))) - || infosize == ARRAY_SIZE(dllname)) + if (!(size = GetModuleFileNameW(GetModuleHandleW(L"amd_ags_x64.dll"), dllname, ARRAY_SIZE(dllname))) + || size == ARRAY_SIZE(dllname)) { ERR("GetModuleFileNameW failed.\n"); goto done; @@ -307,43 +348,12 @@ static enum amd_ags_version determine_ags_version(int ags_version) goto done; } - infosize = GetFileVersionInfoSizeW(temp_name, NULL); - if (!infosize) - { - ERR("Unable to determine desired version of amd_ags_x64.dll.\n"); - goto done; - } - - if (!(infobuf = heap_alloc(infosize))) - { - ERR("Failed to allocate memory.\n"); - goto done; - } - - if (!GetFileVersionInfoW(temp_name, 0, infosize, infobuf)) - { - ERR("Unable to determine desired version of amd_ags_x64.dll.\n"); - goto done; - } - - if (!VerQueryValueW(infobuf, L"\\", &val, &vallen) || (vallen != sizeof(VS_FIXEDFILEINFO))) - { - ERR("Unable to determine desired version of amd_ags_x64.dll.\n"); - goto done; - } - - info = val; - major = info->dwFileVersionMS >> 16; - minor = info->dwFileVersionMS; - patch = info->dwFileVersionLS >> 16; - TRACE("Found amd_ags_x64.dll v%d.%d.%d\n", major, minor, patch); - ret = get_version_number(AGS_MAKE_VERSION(major, minor, patch)); + get_ags_version_from_resource(temp_name, &ret); done: if (*temp_name) DeleteFileW(temp_name); - heap_free(infobuf); TRACE("Using AGS v%d.%d.%d interface\n", amd_ags_info[ret].major, amd_ags_info[ret].minor, amd_ags_info[ret].patch); return ret; From 43199e410f7803203101cc3fa17e74ffc6c0f390 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Nov 2023 17:08:32 -0600 Subject: [PATCH 0656/1506] amd_ags_x64: Try to get version from agsGetVersionNumber() if there is no version resource. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index c2a94703285..c51ec4b2507 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -323,6 +323,8 @@ static enum amd_ags_version determine_ags_version(int ags_version) */ enum amd_ags_version ret = AMD_AGS_VERSION_5_4_1; WCHAR dllname[MAX_PATH], temp_path[MAX_PATH], temp_name[MAX_PATH]; + int (WINAPI *pagsGetVersionNumber)(void); + HMODULE hnative = NULL; DWORD size; TRACE("ags_version %#x.\n", ags_version); @@ -348,9 +350,26 @@ static enum amd_ags_version determine_ags_version(int ags_version) goto done; } - get_ags_version_from_resource(temp_name, &ret); + if (get_ags_version_from_resource(temp_name, &ret)) + goto done; + + if (!(hnative = LoadLibraryW(temp_name))) + { + ERR("LoadLibraryW failed for %s.\n", debugstr_w(temp_name)); + goto done; + } + + if ((pagsGetVersionNumber = (void *)GetProcAddress(hnative, "agsGetVersionNumber"))) + { + ags_version = pagsGetVersionNumber(); + ret = get_version_number(ags_version); + TRACE("Got version %#x (%d) from agsGetVersionNumber.\n", ags_version, ret); + } done: + if (hnative) + FreeLibrary(hnative); + if (*temp_name) DeleteFileW(temp_name); From 6fca349165a44e7fbd4352b5163646f4e8f2b614 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Nov 2023 17:19:25 -0600 Subject: [PATCH 0657/1506] amd_ags_x64: Distinguish some versions through available exports if other methods failed. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index c51ec4b2507..ad1681b9abc 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -311,15 +311,29 @@ static BOOL get_ags_version_from_resource(const WCHAR *filename, enum amd_ags_ve return TRUE; } +static enum amd_ags_version guess_version_from_exports(HMODULE hnative) +{ + /* Known DLL versions without version info: + * - An update to AGS 5.4.1 included an amd_ags_x64.dll with no file version info; + * - CoD: Modern Warfare Remastered (2017) ships dll without version info which is version 5.0.1 + * (not tagged in AGSSDK history), compatible with 5.0.5. + */ + if (GetProcAddress(hnative, "agsDriverExtensionsDX11_Init")) + { + /* agsDriverExtensionsDX11_Init was deprecated in 5.3.0 */ + TRACE("agsDriverExtensionsDX11_Init found.\n"); + return AMD_AGS_VERSION_5_0_5; + } + TRACE("Returning 5.4.1.\n"); + return AMD_AGS_VERSION_5_4_1; +} + static enum amd_ags_version determine_ags_version(int ags_version) { /* AMD AGS is not binary compatible between versions (even minor versions), and the game * does not request a specific version when calling agsInit(). * Checking the version of amd_ags_x64.dll shipped with the game is the only way to * determine what version the game was built against. - * - * An update to AGS 5.4.1 included an amd_ags_x64.dll with no file version info. - * In case of an error, assume it's that version. */ enum amd_ags_version ret = AMD_AGS_VERSION_5_4_1; WCHAR dllname[MAX_PATH], temp_path[MAX_PATH], temp_name[MAX_PATH]; @@ -364,8 +378,11 @@ static enum amd_ags_version determine_ags_version(int ags_version) ags_version = pagsGetVersionNumber(); ret = get_version_number(ags_version); TRACE("Got version %#x (%d) from agsGetVersionNumber.\n", ags_version, ret); + goto done; } + ret = guess_version_from_exports(hnative); + done: if (hnative) FreeLibrary(hnative); From 9a15c2f737bfaf0a8193b443818c27b4c8b8a12b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 9 Nov 2023 17:53:47 -0600 Subject: [PATCH 0658/1506] amd_ags_x64: Recognize version 6.2.0. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags.h | 14 ++++++++------ dlls/amd_ags_x64/amd_ags_x64_main.c | 12 +++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 52276cc1935..aac9fb1413c 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -207,7 +207,8 @@ typedef enum AGSReturnCode AGS_NO_AMD_DRIVER_INSTALLED, ///< Returned if the AMD GPU driver does not appear to be installed AGS_EXTENSION_NOT_SUPPORTED, ///< Returned if the driver does not support the requested driver extension AGS_ADL_FAILURE, ///< Failure in ADL (the AMD Display Library) - AGS_DX_FAILURE ///< Failure from DirectX runtime + AGS_DX_FAILURE, ///< Failure from DirectX runtime + AGS_D3DDEVICE_NOT_CREATED, ///< Failure due to not creating the D3D device successfully via AGS. } AGSReturnCode; /// The DirectX11 extension support bits @@ -268,7 +269,7 @@ typedef enum AGSDriverExtensionDX12 } AGSDriverExtensionDX12; /// The space id for DirectX12 intrinsic support -const unsigned int AGS_DX12_SHADER_INSTRINSICS_SPACE_ID = 0x7FFF0ADE; // 2147420894 +const unsigned int AGS_DX12_SHADER_INTRINSICS_SPACE_ID = 0x7FFF0ADE; // 2147420894 /// The display flags describing various properties of the display. typedef enum AGSDisplayFlags @@ -942,7 +943,8 @@ typedef struct AGSDX12ReturnedParams unsigned int floatConversion : 1; ///< Supported in Radeon Software Version 20.5.1 onwards. unsigned int readLaneAt : 1; ///< Supported in Radeon Software Version 20.11.2 onwards. unsigned int rayHitToken : 1; ///< Supported in Radeon Software Version 20.11.2 onwards. - unsigned int padding : 20; ///< Reserved + unsigned int shaderClock : 1; ///< Supported in Radeon Software Version 23.1.1 onwards. + unsigned int padding : 19; ///< Reserved } ExtensionsSupported; ExtensionsSupported extensionsSupported; ///< List of supported extensions */ @@ -960,16 +962,16 @@ typedef struct AGSDX12ReturnedParams /// * The intrinsic instructions require a 5.1 shader model. /// * The Root Signature will need to reserve an extra UAV resource slot. This is not a real resource that requires allocating, it is just used to encode the intrinsic instructions. /// -/// The easiest way to set up the reserved UAV slot is to specify it at u0. The register space id will automatically be assumed to be \ref AGS_DX12_SHADER_INSTRINSICS_SPACE_ID. +/// The easiest way to set up the reserved UAV slot is to specify it at u0. The register space id will automatically be assumed to be \ref AGS_DX12_SHADER_INTRINSICS_SPACE_ID. /// The HLSL expects this as default and the set up code would look similar to this: /// \code{.cpp} /// CD3DX12_DESCRIPTOR_RANGE range[]; /// ... -/// range[ 0 ].Init( D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, AGS_DX12_SHADER_INSTRINSICS_SPACE_ID ); // u0 at driver-reserved space id +/// range[ 0 ].Init( D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, AGS_DX12_SHADER_INTRINSICS_SPACE_ID ); // u0 at driver-reserved space id /// \endcode /// /// Newer drivers also support a user-specified slot in which case the register space id is assumed to be 0. It is important that the \ref AGSDX12ReturnedParams::ExtensionsSupported::UAVBindSlot bit is set. -/// to ensure the driver can support this. If not, then u0 and \ref AGS_DX12_SHADER_INSTRINSICS_SPACE_ID must be used. +/// to ensure the driver can support this. If not, then u0 and \ref AGS_DX12_SHADER_INTRINSICS_SPACE_ID must be used. /// If the driver does support this feature and a non zero slot is required, then the HLSL must also define AMD_EXT_SHADER_INTRINSIC_UAV_OVERRIDE as the matching slot value. /// /// \param [in] context Pointer to a context. This is generated by \ref agsInitialize diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index ad1681b9abc..154e74cf1d6 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -39,6 +39,7 @@ enum amd_ags_version AMD_AGS_VERSION_6_0_0, AMD_AGS_VERSION_6_0_1, AMD_AGS_VERSION_6_1_0, + AMD_AGS_VERSION_6_2_0, AMD_AGS_VERSION_COUNT }; @@ -64,27 +65,28 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {6, 0, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, {6, 0, 1, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, {6, 1, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, + {6, 2, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ - -1, -1, -1, -1, -1}} + -1, -1, -1, -1, -1, -1}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ - -1, -1, -1}} + -1, -1, -1, -1}} #define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1, \ - -1, -1}} + -1, -1, -1}} #define DEVICE_FIELD_adapterString 0 #define DEVICE_FIELD_architectureVersion 1 From 8f66996fb0c10b97ee79cbfe415cde64b7dd9877 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Nov 2023 14:30:36 -0600 Subject: [PATCH 0659/1506] amd_ags_x64: Add Unix library. CW-Bug-Id: #22976 --- configure.ac | 9 +++++ dlls/amd_ags_x64/Makefile.in | 4 +++ dlls/amd_ags_x64/amd_ags_x64_main.c | 24 +++++++++++++ dlls/amd_ags_x64/unixlib.c | 54 +++++++++++++++++++++++++++++ dlls/amd_ags_x64/unixlib.h | 26 ++++++++++++++ 5 files changed, 117 insertions(+) create mode 100644 dlls/amd_ags_x64/unixlib.c create mode 100644 dlls/amd_ags_x64/unixlib.h diff --git a/configure.ac b/configure.ac index 2e6e905e83a..a2ee6f5d795 100644 --- a/configure.ac +++ b/configure.ac @@ -1487,6 +1487,15 @@ fi WINE_WARNING_WITH(gnutls,[test "x$ac_cv_lib_soname_gnutls" = "x"], [libgnutls ${notice_platform}development files not found, no schannel support.]) +dnl **** Check for libdrm **** +WINE_PACKAGE_FLAGS(DRM,[libdrm],,,, + [AC_CHECK_HEADERS([xf86drm.h], + [WINE_CHECK_SONAME(drm,drmOpen,,,[$DRM_LIBS])])]) + +WINE_PACKAGE_FLAGS(DRMAMDGPU,[libdrm_amdgpu],,,, + [AC_CHECK_HEADERS([amdgpu_drm.h], + [WINE_CHECK_SONAME(drm_amdgpu,amdgpu_query_info,,,[$DRMAMDGPU_LIBS])])]) + dnl **** Check for SANE **** if test "x$with_sane" != "xno" then diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in index 123d0603869..b8463820d76 100644 --- a/dlls/amd_ags_x64/Makefile.in +++ b/dlls/amd_ags_x64/Makefile.in @@ -1,5 +1,8 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = amd_ags_x64.dll +UNIXLIB = amd_ags_x64.so +UNIX_CFLAGS = $(DRM_CFLAGS) +UNIX_LIBS = $(DRM_LIBS) $(DRMAMDGPU_LIBS) IMPORTS = version vulkan-1 user32 IMPORTLIB = amd_ags_x64 @@ -7,4 +10,5 @@ EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native SOURCES = \ amd_ags_x64_main.c \ + unixlib.c \ dxvk_interfaces.idl diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 154e74cf1d6..e4abe1abf0c 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -2,8 +2,11 @@ #include #include +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" +#include "winternl.h" #include "wine/debug.h" #include "wine/heap.h" @@ -21,8 +24,27 @@ #include "amd_ags.h" +#include "unixlib.h" + WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); +#define AMD_AGS_CALL(func, args) WINE_UNIX_CALL( unix_ ## func, args ) + +static INIT_ONCE unix_init_once = INIT_ONCE_STATIC_INIT; +static BOOL unix_lib_initialized; + +static BOOL WINAPI init_unix_lib_once( INIT_ONCE *once, void *param, void **context ) +{ + unix_lib_initialized = !__wine_init_unix_call() && !AMD_AGS_CALL( init, NULL ); + return TRUE; +} + +static BOOL init_unix_lib(void) +{ + InitOnceExecuteOnce( &unix_init_once, init_unix_lib_once, NULL, NULL ); + return unix_lib_initialized; +} + static const char driver_version[] = "23.19.02-230831a-396538C-AMD-Software-Adrenalin-Edition"; static const char radeon_version[] = "23.10.2"; @@ -684,6 +706,8 @@ static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) SET_DEVICE_FIELD(device, deviceId, int, context->version, vk_properties->deviceID); if (vk_properties->vendorID == 0x1002) { + if (!init_unix_lib()) + ERR("Failed to load unix lib.\n"); SET_DEVICE_FIELD(device, architectureVersion, ArchitectureVersion, context->version, ArchitectureVersion_GCN); SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, AsicFamily_GCN4); if (vk_properties->deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) diff --git a/dlls/amd_ags_x64/unixlib.c b/dlls/amd_ags_x64/unixlib.c new file mode 100644 index 00000000000..513c1903e4f --- /dev/null +++ b/dlls/amd_ags_x64/unixlib.c @@ -0,0 +1,54 @@ +/* + * Unix library for amd_ags_x64 functions + * + * Copyright 2023 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include +#include + +#include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" + +#include "wine/debug.h" + +#include "unixlib.h" + +WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); + +static NTSTATUS init( void *args ) +{ + TRACE(".\n"); + return STATUS_SUCCESS; +} + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + init, +}; diff --git a/dlls/amd_ags_x64/unixlib.h b/dlls/amd_ags_x64/unixlib.h new file mode 100644 index 00000000000..d3427519867 --- /dev/null +++ b/dlls/amd_ags_x64/unixlib.h @@ -0,0 +1,26 @@ +/* + * Unix library interface + * + * Copyright 2023 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/unixlib.h" + +enum amd_ags_funcs +{ + unix_init, +}; From 88e9fad9f2a5ba765bddda82326a2451a7e5b544 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Nov 2023 15:27:38 -0600 Subject: [PATCH 0660/1506] amd_ags_x64: Load libdrm amdgpu info. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/unixlib.c | 61 +++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/unixlib.c b/dlls/amd_ags_x64/unixlib.c index 513c1903e4f..d054b17e84c 100644 --- a/dlls/amd_ags_x64/unixlib.c +++ b/dlls/amd_ags_x64/unixlib.c @@ -27,9 +27,13 @@ #include #include #include +#include +#include +#include #include #include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -42,9 +46,64 @@ WINE_DEFAULT_DEBUG_CHANNEL(amd_ags); +#define MAX_DEVICE_COUNT 64 + +static unsigned int device_count; +static struct drm_amdgpu_info_device *amd_info; + static NTSTATUS init( void *args ) { - TRACE(".\n"); + drmDevicePtr devices[MAX_DEVICE_COUNT]; + amdgpu_device_handle h; + uint32_t major, minor; + int i, count, fd, ret; + + device_count = 0; + + if ((count = drmGetDevices(devices, MAX_DEVICE_COUNT)) <= 0) + { + ERR("drmGetDevices failed, err %d.\n", count); + return STATUS_UNSUCCESSFUL; + } + TRACE("Got %d devices.\n", count); + for (i = 0; i < count; ++i) + { + if (!devices[i] || !devices[i]->nodes[DRM_NODE_RENDER]) + { + TRACE("No render node, skipping.\n"); + continue; + } + if ((fd = open(devices[i]->nodes[DRM_NODE_RENDER], O_RDONLY | O_CLOEXEC)) < 0) + { + ERR("Failed to open device %s, errno %d.\n", devices[i]->nodes[DRM_NODE_RENDER], errno); + continue; + } + if ((ret = amdgpu_device_initialize(fd, &major, &minor, &h))) + { + WARN("Failed to initialize amdgpu device bustype %d, %04x:%04x, err %d.\n", devices[i]->bustype, + devices[i]->deviceinfo.pci->vendor_id, devices[i]->deviceinfo.pci->device_id, ret); + close(fd); + continue; + } + amd_info = realloc(amd_info, (device_count + 1) * sizeof(*amd_info)); + /* amdgpu_query_info() doesn't fail on short buffer (filling in the available buffer size). So older or + * newer DRM version should be fine but zero init the structure to avoid random values. */ + memset(&amd_info[device_count], 0, sizeof(*amd_info)); + if (!(ret = amdgpu_query_info(h, AMDGPU_INFO_DEV_INFO, sizeof(*amd_info), &amd_info[device_count]))) + { + TRACE("Got amdgpu info for device id %04x, family %#x, external_rev %#x, chip_rev %#x.\n", + amd_info[device_count].device_id, amd_info[device_count].family, amd_info[device_count].external_rev, + amd_info[device_count].chip_rev); + ++device_count; + } + else + { + ERR("amdgpu_query_info failed, ret %d.\n", ret); + } + amdgpu_device_deinitialize(h); + close(fd); + } + drmFreeDevices(devices, count); return STATUS_SUCCESS; } From 43afbcc0bda11bf746da06cabf2c54e390b9565f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Nov 2023 15:41:50 -0600 Subject: [PATCH 0661/1506] amd_ags_x64: Try to guess asicFamily from amdgpu info. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 42 +++++++---- dlls/amd_ags_x64/unixlib.c | 106 ++++++++++++++++++++++++++++ dlls/amd_ags_x64/unixlib.h | 9 +++ 3 files changed, 142 insertions(+), 15 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index e4abe1abf0c..7a485a6cf61 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -73,21 +73,22 @@ static const struct int patch; unsigned int device_size; unsigned int dx11_returned_params_size; + int max_asicFamily; } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {5, 0, 5, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511)}, - {5, 1, 1, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511)}, - {5, 2, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, - {5, 2, 1, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, - {5, 3, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520)}, - {5, 4, 0, sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520)}, - {5, 4, 1, sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520)}, - {5, 4, 2, sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520)}, - {6, 0, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, - {6, 0, 1, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, - {6, 1, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, - {6, 2, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600)}, + {5, 0, 5, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {5, 1, 1, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {5, 2, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {5, 2, 1, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {5, 3, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {5, 4, 0, sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {5, 4, 1, sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {5, 4, 2, sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {6, 0, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, + {6, 0, 1, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, + {6, 1, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, + {6, 2, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ @@ -706,10 +707,21 @@ static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) SET_DEVICE_FIELD(device, deviceId, int, context->version, vk_properties->deviceID); if (vk_properties->vendorID == 0x1002) { - if (!init_unix_lib()) - ERR("Failed to load unix lib.\n"); + struct get_device_info_params params = + { + .device_id = vk_properties->deviceID, + }; + SET_DEVICE_FIELD(device, architectureVersion, ArchitectureVersion, context->version, ArchitectureVersion_GCN); - SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, AsicFamily_GCN4); + if (init_unix_lib() && !AMD_AGS_CALL(get_device_info, ¶ms)) + { + SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, + min(params.asic_family, amd_ags_info[context->version].max_asicFamily)); + } + else + { + SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, AsicFamily_GCN4); + } if (vk_properties->deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) { if (context->version >= AMD_AGS_VERSION_6_0_0) diff --git a/dlls/amd_ags_x64/unixlib.c b/dlls/amd_ags_x64/unixlib.c index d054b17e84c..704c219c757 100644 --- a/dlls/amd_ags_x64/unixlib.c +++ b/dlls/amd_ags_x64/unixlib.c @@ -107,7 +107,113 @@ static NTSTATUS init( void *args ) return STATUS_SUCCESS; } +typedef enum AsicFamily +{ + AsicFamily_Unknown, ///< Unknown architecture, potentially from another IHV. Check \ref AGSDeviceInfo::vendorId + AsicFamily_PreGCN, ///< Pre GCN architecture. + AsicFamily_GCN1, ///< AMD GCN 1 architecture: Oland, Cape Verde, Pitcairn & Tahiti. + AsicFamily_GCN2, ///< AMD GCN 2 architecture: Hawaii & Bonaire. This also includes APUs Kaveri and Carrizo. + AsicFamily_GCN3, ///< AMD GCN 3 architecture: Tonga & Fiji. + AsicFamily_GCN4, ///< AMD GCN 4 architecture: Polaris. + AsicFamily_Vega, ///< AMD Vega architecture, including Raven Ridge (ie AMD Ryzen CPU + AMD Vega GPU). + AsicFamily_RDNA, ///< AMD RDNA architecture + AsicFamily_RDNA2, ///< AMD RDNA2 architecture + AsicFamily_RDNA3, ///< AMD RDNA3 architecture +} AsicFamily; + +/* Constants from Mesa source. */ +#define FAMILY_UNKNOWN 0x00 +#define FAMILY_TN 0x69 /* # 105 / Trinity APUs */ +#define FAMILY_SI 0x6E /* # 110 / Southern Islands: Tahiti, Pitcairn, CapeVerde, Oland, Hainan */ +#define FAMILY_CI 0x78 /* # 120 / Sea Islands: Bonaire, Hawaii */ +#define FAMILY_KV 0x7D /* # 125 / Kaveri APUs: Spectre, Spooky, Kalindi, Godavari */ +#define FAMILY_VI 0x82 /* # 130 / Volcanic Islands: Iceland, Tonga, Fiji */ +#define FAMILY_POLARIS 0x82 /* # 130 / Polaris: 10, 11, 12 */ +#define FAMILY_CZ 0x87 /* # 135 / Carrizo APUs: Carrizo, Stoney */ +#define FAMILY_AI 0x8D /* # 141 / Vega: 10, 20 */ +#define FAMILY_RV 0x8E /* # 142 / Raven */ +#define FAMILY_NV 0x8F /* # 143 / Navi: 10 */ +#define FAMILY_VGH 0x90 /* # 144 / Van Gogh */ +#define FAMILY_NV3 0x91 /* # 145 / Navi: 3x */ +#define FAMILY_RMB 0x92 /* # 146 / Rembrandt */ +#define FAMILY_RPL 0x95 /* # 149 / Raphael */ +#define FAMILY_GFX1103 0x94 +#define FAMILY_GFX1150 0x96 +#define FAMILY_MDN 0x97 /* # 151 / Mendocino */ + +static void fill_device_info(struct drm_amdgpu_info_device *info, struct get_device_info_params *out) +{ + uint32_t erev = info->external_rev; + + out->asic_family = AsicFamily_Unknown; + switch (info->family) + { + case FAMILY_AI: + case FAMILY_RV: + out->asic_family = AsicFamily_Vega; + break; + + /* Treat pre-Polaris cards as Polaris. */ + case FAMILY_CZ: + case FAMILY_SI: + case FAMILY_CI: + case FAMILY_KV: + case FAMILY_POLARIS: + out->asic_family = AsicFamily_GCN4; + break; + + case FAMILY_NV: + if (erev >= 0x01 && erev < 0x28) + out->asic_family = AsicFamily_RDNA; + else if (erev >= 0x28 && erev < 0x50) + out->asic_family = AsicFamily_RDNA2; + break; + + case FAMILY_RMB: + case FAMILY_RPL: + case FAMILY_MDN: + case FAMILY_VGH: + out->asic_family = AsicFamily_RDNA2; + break; + + case FAMILY_NV3: + case FAMILY_GFX1103: + case FAMILY_GFX1150: + out->asic_family = AsicFamily_RDNA3; + break; + } + TRACE("family %u, erev %#x -> asicFamily %d.\n", info->family, erev, out->asic_family); + if (out->asic_family == AsicFamily_Unknown && info->family != FAMILY_UNKNOWN) + { + if (info->family > FAMILY_GFX1150) + out->asic_family = AsicFamily_RDNA3; + else + out->asic_family = AsicFamily_GCN4; + + FIXME("Unrecognized family %u, erev %#x -> defaulting to %d.\n", info->family, erev, + out->asic_family); + } +} + +static NTSTATUS get_device_info( void *args ) +{ + struct get_device_info_params *params = args; + unsigned int i; + + for (i = 0; i < device_count; ++i) + { + if (amd_info[i].device_id != params->device_id) + continue; + TRACE("device %04x found.\n", params->device_id); + fill_device_info(&amd_info[i], params); + return STATUS_SUCCESS; + } + TRACE("Device %04x not found.\n", params->device_id); + return STATUS_NOT_FOUND; +} + const unixlib_entry_t __wine_unix_call_funcs[] = { init, + get_device_info, }; diff --git a/dlls/amd_ags_x64/unixlib.h b/dlls/amd_ags_x64/unixlib.h index d3427519867..c895a0499fc 100644 --- a/dlls/amd_ags_x64/unixlib.h +++ b/dlls/amd_ags_x64/unixlib.h @@ -23,4 +23,13 @@ enum amd_ags_funcs { unix_init, + unix_get_device_info, +}; + +struct get_device_info_params +{ + uint32_t device_id; + uint32_t _pad; + /* Output parameters. */ + uint32_t asic_family; }; From 66cf7acb05b966aac09d39bac1f89a3ef57fd250 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Nov 2023 18:11:41 -0600 Subject: [PATCH 0662/1506] amd_ags_x64: Fill more device info fields. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 26 +++++++++++++++ dlls/amd_ags_x64/unixlib.c | 51 +++++++++++++++++++++++++++++ dlls/amd_ags_x64/unixlib.h | 7 ++++ 3 files changed, 84 insertions(+) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 7a485a6cf61..a6cc83d6699 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -98,6 +98,10 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ -1, -1, -1, -1, -1, -1}} +#define DEF_FIELD_520_UP(name) {DEVICE_FIELD_##name, {-1, -1, offsetof(AGSDeviceInfo_520, name), \ + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ -1, -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ @@ -122,6 +126,14 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = #define DEVICE_FIELD_displays 8 #define DEVICE_FIELD_isAPU 9 +#define DEVICE_FIELD_numCUs 10 +#define DEVICE_FIELD_coreClock 11 +#define DEVICE_FIELD_memoryClock 12 +#define DEVICE_FIELD_teraFlops 13 +#define DEVICE_FIELD_numWGPs 14 +#define DEVICE_FIELD_numROPs 15 +#define DEVICE_FIELD_memoryBandwidth 16 + static const struct { unsigned int field_index; @@ -139,6 +151,13 @@ device_struct_fields[] = DEF_FIELD(numDisplays), DEF_FIELD(displays), DEF_FIELD_540_600(isAPU), + DEF_FIELD(numCUs), + DEF_FIELD(coreClock), + DEF_FIELD(memoryClock), + DEF_FIELD(teraFlops), + DEF_FIELD_540_UP(numWGPs), + DEF_FIELD_520_UP(numROPs), + DEF_FIELD_520_UP(memoryBandwidth), }; #undef DEF_FIELD @@ -717,6 +736,13 @@ static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) { SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, min(params.asic_family, amd_ags_info[context->version].max_asicFamily)); + SET_DEVICE_FIELD(device, numCUs, int, context->version, params.num_cu); + SET_DEVICE_FIELD(device, numWGPs, int, context->version, params.num_wgp); + SET_DEVICE_FIELD(device, numROPs, int, context->version, params.num_rops); + SET_DEVICE_FIELD(device, coreClock, int, context->version, params.core_clock); + SET_DEVICE_FIELD(device, memoryClock, int, context->version, params.memory_clock); + SET_DEVICE_FIELD(device, memoryBandwidth, int, context->version, params.memory_bandwidth); + SET_DEVICE_FIELD(device, teraFlops, float, context->version, params.teraflops); } else { diff --git a/dlls/amd_ags_x64/unixlib.c b/dlls/amd_ags_x64/unixlib.c index 704c219c757..be94b75eab9 100644 --- a/dlls/amd_ags_x64/unixlib.c +++ b/dlls/amd_ags_x64/unixlib.c @@ -107,6 +107,42 @@ static NTSTATUS init( void *args ) return STATUS_SUCCESS; } +#ifndef AMDGPU_VRAM_TYPE_DDR5 +# define AMDGPU_VRAM_TYPE_DDR5 10 +#endif +#ifndef AMDGPU_VRAM_TYPE_LPDDR4 +# define AMDGPU_VRAM_TYPE_LPDDR4 11 +#endif +#ifndef AMDGPU_VRAM_TYPE_LPDDR5 +# define AMDGPU_VRAM_TYPE_LPDDR5 12 +#endif + +/* From Mesa source. */ +static uint32_t memory_ops_per_clock(uint32_t vram_type) +{ + /* Based on MemoryOpsPerClockTable from PAL. */ + switch (vram_type) { + case AMDGPU_VRAM_TYPE_GDDR1: + case AMDGPU_VRAM_TYPE_GDDR3: /* last in low-end Evergreen */ + case AMDGPU_VRAM_TYPE_GDDR4: /* last in R7xx, not used much */ + case AMDGPU_VRAM_TYPE_UNKNOWN: + default: + return 0; + case AMDGPU_VRAM_TYPE_DDR2: + case AMDGPU_VRAM_TYPE_DDR3: + case AMDGPU_VRAM_TYPE_DDR4: + case AMDGPU_VRAM_TYPE_LPDDR4: + case AMDGPU_VRAM_TYPE_HBM: /* same for HBM2 and HBM3 */ + return 2; + case AMDGPU_VRAM_TYPE_DDR5: + case AMDGPU_VRAM_TYPE_LPDDR5: + case AMDGPU_VRAM_TYPE_GDDR5: /* last in Polaris and low-end Navi14 */ + return 4; + case AMDGPU_VRAM_TYPE_GDDR6: + return 16; + } +} + typedef enum AsicFamily { AsicFamily_Unknown, ///< Unknown architecture, potentially from another IHV. Check \ref AGSDeviceInfo::vendorId @@ -141,6 +177,8 @@ typedef enum AsicFamily #define FAMILY_GFX1150 0x96 #define FAMILY_MDN 0x97 /* # 151 / Mendocino */ +#define ROUND_DIV(value, div) (((value) + (div) / 2) / (div)) + static void fill_device_info(struct drm_amdgpu_info_device *info, struct get_device_info_params *out) { uint32_t erev = info->external_rev; @@ -193,6 +231,19 @@ static void fill_device_info(struct drm_amdgpu_info_device *info, struct get_dev FIXME("Unrecognized family %u, erev %#x -> defaulting to %d.\n", info->family, erev, out->asic_family); } + + out->num_cu = info->cu_active_number; + out->num_wgp = out->asic_family >= AsicFamily_RDNA ? out->num_cu / 2 : 0; + out->num_rops = info->num_rb_pipes * 4; + TRACE("num_cu %d, num_wgp %d, num_rops %d.\n", out->num_cu, out->num_wgp, out->num_rops); + out->core_clock = ROUND_DIV(info->max_engine_clock, 1000); + out->memory_clock = ROUND_DIV(info->max_memory_clock, 1000); + out->memory_bandwidth = ROUND_DIV(info->max_memory_clock * memory_ops_per_clock(info->vram_type) + * info->vram_bit_width / 8, 1000); + TRACE("core_clock %uMHz, memory_clock %uMHz, memory_bandwidth %u.\n", + out->core_clock, out->memory_clock, out->memory_bandwidth); + out->teraflops = 1e-9f * info->max_engine_clock * info->cu_active_number * 64 * 2; + TRACE("teraflops %.2f.\n", out->teraflops); } static NTSTATUS get_device_info( void *args ) diff --git a/dlls/amd_ags_x64/unixlib.h b/dlls/amd_ags_x64/unixlib.h index c895a0499fc..72422e1535c 100644 --- a/dlls/amd_ags_x64/unixlib.h +++ b/dlls/amd_ags_x64/unixlib.h @@ -32,4 +32,11 @@ struct get_device_info_params uint32_t _pad; /* Output parameters. */ uint32_t asic_family; + uint32_t num_cu; + uint32_t num_wgp; + uint32_t num_rops; + uint32_t core_clock; + uint32_t memory_clock; + uint32_t memory_bandwidth; + float teraflops; }; From db5789f5791d2c94e161cce5c8d437e7e82734af Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 23 Nov 2023 18:53:03 -0600 Subject: [PATCH 0663/1506] amd_ags_x64: Downgrade agsCheckDriverVersion() message to WARN. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index a6cc83d6699..cbd60af6af3 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1159,7 +1159,7 @@ AGSReturnCode WINAPI agsDriverExtensionsDX12_DestroyDevice(AGSContext* context, AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported, unsigned int version_required) { - FIXME("version_reported %s, version_required %d semi-stub.\n", debugstr_a(version_reported), version_required); + WARN("version_reported %s, version_required %d semi-stub.\n", debugstr_a(version_reported), version_required); return AGS_SOFTWAREVERSIONCHECK_OK; } From 96a8b7cf72309f276f08571228be887f75e4511a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 24 Nov 2023 11:24:03 -0600 Subject: [PATCH 0664/1506] amd_ags_x64: Workaround zero clock reporting on Vangogh GPU. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/unixlib.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/amd_ags_x64/unixlib.c b/dlls/amd_ags_x64/unixlib.c index be94b75eab9..7e5bc5bf4d6 100644 --- a/dlls/amd_ags_x64/unixlib.c +++ b/dlls/amd_ags_x64/unixlib.c @@ -182,6 +182,7 @@ typedef enum AsicFamily static void fill_device_info(struct drm_amdgpu_info_device *info, struct get_device_info_params *out) { uint32_t erev = info->external_rev; + uint64_t max_engine_clock_khz, max_memory_clock_khz; out->asic_family = AsicFamily_Unknown; switch (info->family) @@ -236,13 +237,19 @@ static void fill_device_info(struct drm_amdgpu_info_device *info, struct get_dev out->num_wgp = out->asic_family >= AsicFamily_RDNA ? out->num_cu / 2 : 0; out->num_rops = info->num_rb_pipes * 4; TRACE("num_cu %d, num_wgp %d, num_rops %d.\n", out->num_cu, out->num_wgp, out->num_rops); - out->core_clock = ROUND_DIV(info->max_engine_clock, 1000); - out->memory_clock = ROUND_DIV(info->max_memory_clock, 1000); - out->memory_bandwidth = ROUND_DIV(info->max_memory_clock * memory_ops_per_clock(info->vram_type) + /* These numbers are zero on Vangogh, workaround that (similar to how it is currently done + * in Mesa src/amd/common/ac_rgp.c. */ + if (!(max_engine_clock_khz = info->max_engine_clock)) + max_engine_clock_khz = 1300000; + if (!(max_memory_clock_khz = info->max_memory_clock)) + max_memory_clock_khz = 687000; + out->core_clock = ROUND_DIV(max_engine_clock_khz, 1000); + out->memory_clock = ROUND_DIV(max_memory_clock_khz, 1000); + out->memory_bandwidth = ROUND_DIV(max_memory_clock_khz * memory_ops_per_clock(info->vram_type) * info->vram_bit_width / 8, 1000); TRACE("core_clock %uMHz, memory_clock %uMHz, memory_bandwidth %u.\n", out->core_clock, out->memory_clock, out->memory_bandwidth); - out->teraflops = 1e-9f * info->max_engine_clock * info->cu_active_number * 64 * 2; + out->teraflops = 1e-9f * max_engine_clock_khz * info->cu_active_number * 64 * 2; TRACE("teraflops %.2f.\n", out->teraflops); } From 2645a5b6d8cf72810ca1fb2522293875e6932b24 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 1 Dec 2023 11:19:56 -0600 Subject: [PATCH 0665/1506] amd_ags_x64: Store AGS version as a single value in ags_info. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 56 ++++++++++++++++------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index cbd60af6af3..49e8a348c2c 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -68,27 +68,25 @@ enum amd_ags_version static const struct { - int major; - int minor; - int patch; + unsigned int ags_public_version; unsigned int device_size; unsigned int dx11_returned_params_size; int max_asicFamily; } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {5, 0, 5, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, - {5, 1, 1, sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, - {5, 2, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, - {5, 2, 1, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, - {5, 3, 0, sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, - {5, 4, 0, sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, - {5, 4, 1, sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, - {5, 4, 2, sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, - {6, 0, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, - {6, 0, 1, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, - {6, 1, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, - {6, 2, 0, sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, + {AGS_MAKE_VERSION(5, 0, 5), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(5, 2, 0), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {AGS_MAKE_VERSION(5, 3, 0), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {AGS_MAKE_VERSION(5, 4, 0), sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {AGS_MAKE_VERSION(5, 4, 1), sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {AGS_MAKE_VERSION(5, 4, 2), sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {AGS_MAKE_VERSION(6, 0, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, + {AGS_MAKE_VERSION(6, 0, 1), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, + {AGS_MAKE_VERSION(6, 1, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, + {AGS_MAKE_VERSION(6, 2, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ @@ -188,6 +186,15 @@ static typeof(D3D12CreateDevice) *pD3D12CreateDevice; static typeof(D3D11CreateDevice) *pD3D11CreateDevice; static typeof(D3D11CreateDeviceAndSwapChain) *pD3D11CreateDeviceAndSwapChain; +#define AGS_VER_MAJOR(ver) ((ver) >> 22) +#define AGS_VER_MINOR(ver) (((ver) >> 12) & ((1 << 10) - 1)) +#define AGS_VER_PATCH(ver) ((ver) & ((1 << 12) - 1)) + +static const char *debugstr_agsversion(unsigned int ags_version) +{ + return wine_dbg_sprintf("%d.%d.%d", AGS_VER_MAJOR(ags_version), AGS_VER_MINOR(ags_version), AGS_VER_PATCH(ags_version)); +} + static BOOL load_d3d12_functions(void) { if (hd3d12) @@ -300,12 +307,12 @@ static enum amd_ags_version get_version_number(int ags_version) unsigned int i; for (i = 0; i < ARRAY_SIZE(amd_ags_info); i++) - if (AGS_MAKE_VERSION(amd_ags_info[i].major, amd_ags_info[i].minor, amd_ags_info[i].patch) == ags_version) + if (amd_ags_info[i].ags_public_version == ags_version) { - TRACE("Found AGS v%d.%d.%d.\n", amd_ags_info[i].major, amd_ags_info[i].minor, amd_ags_info[i].patch); + TRACE("Found AGS v%s.\n", debugstr_agsversion(ags_version)); return i; } - ERR("Unknown ags_version %#x, using 5.4.1.\n", ags_version); + ERR("Unknown ags_version %s, using 5.4.1.\n", debugstr_agsversion(ags_version)); return AMD_AGS_VERSION_5_4_1; } @@ -421,7 +428,7 @@ static enum amd_ags_version determine_ags_version(int ags_version) { ags_version = pagsGetVersionNumber(); ret = get_version_number(ags_version); - TRACE("Got version %#x (%d) from agsGetVersionNumber.\n", ags_version, ret); + TRACE("Got version %s (%d) from agsGetVersionNumber.\n", debugstr_agsversion(ags_version), ret); goto done; } @@ -434,8 +441,7 @@ static enum amd_ags_version determine_ags_version(int ags_version) if (*temp_name) DeleteFileW(temp_name); - TRACE("Using AGS v%d.%d.%d interface\n", - amd_ags_info[ret].major, amd_ags_info[ret].minor, amd_ags_info[ret].patch); + TRACE("Using AGS v%s interface\n", debugstr_agsversion(amd_ags_info[ret].ags_public_version)); return ret; } @@ -812,9 +818,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi } memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->agsVersionMajor = amd_ags_info[object->version].major; - gpu_info->agsVersionMinor = amd_ags_info[object->version].minor; - gpu_info->agsVersionPatch = amd_ags_info[object->version].patch; + gpu_info->agsVersionMajor = AGS_VER_MAJOR(amd_ags_info[object->version].ags_public_version); + gpu_info->agsVersionMinor = AGS_VER_MINOR(amd_ags_info[object->version].ags_public_version);; + gpu_info->agsVersionPatch = AGS_VER_PATCH(amd_ags_info[object->version].ags_public_version);; gpu_info->driverVersion = driver_version; gpu_info->radeonSoftwareVersion = radeon_version; gpu_info->numDevices = object->device_count; @@ -1170,7 +1176,7 @@ int WINAPI agsGetVersionNumber(void) TRACE("version %d.\n", version); - return AGS_MAKE_VERSION(amd_ags_info[version].major, amd_ags_info[version].minor, amd_ags_info[version].patch); + return amd_ags_info[version].ags_public_version; } AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext *context, ID3D11Device *device, unsigned int uavSlot, unsigned int *extensionsSupported ) From ebde33a3508c1d18ac428dbdddc1f17ea6cf4a7f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 1 Dec 2023 12:38:30 -0600 Subject: [PATCH 0666/1506] amd_ags_x64: Coalesce some identical version definitions. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 118 ++++++++++++++-------------- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 49e8a348c2c..0e6359aec35 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -53,65 +53,60 @@ enum amd_ags_version AMD_AGS_VERSION_5_0_5, AMD_AGS_VERSION_5_1_1, AMD_AGS_VERSION_5_2_0, - AMD_AGS_VERSION_5_2_1, AMD_AGS_VERSION_5_3_0, AMD_AGS_VERSION_5_4_0, AMD_AGS_VERSION_5_4_1, AMD_AGS_VERSION_5_4_2, AMD_AGS_VERSION_6_0_0, - AMD_AGS_VERSION_6_0_1, AMD_AGS_VERSION_6_1_0, - AMD_AGS_VERSION_6_2_0, AMD_AGS_VERSION_COUNT }; static const struct { - unsigned int ags_public_version; + unsigned int ags_min_public_version; + unsigned int ags_max_public_version; unsigned int device_size; unsigned int dx11_returned_params_size; int max_asicFamily; } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {AGS_MAKE_VERSION(5, 0, 5), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, - {AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, - {AGS_MAKE_VERSION(5, 2, 0), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, - {AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, - {AGS_MAKE_VERSION(5, 3, 0), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, - {AGS_MAKE_VERSION(5, 4, 0), sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, - {AGS_MAKE_VERSION(5, 4, 1), sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, - {AGS_MAKE_VERSION(5, 4, 2), sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, - {AGS_MAKE_VERSION(6, 0, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, - {AGS_MAKE_VERSION(6, 0, 1), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, - {AGS_MAKE_VERSION(6, 1, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, - {AGS_MAKE_VERSION(6, 2, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, + {AGS_MAKE_VERSION(5, 0, 5), AGS_MAKE_VERSION(5, 0, 5), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(5, 1, 1), AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(5, 2, 0), AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {AGS_MAKE_VERSION(5, 3, 0), AGS_MAKE_VERSION(5, 3, 0), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, + {AGS_MAKE_VERSION(5, 4, 0), AGS_MAKE_VERSION(5, 4, 0), sizeof(AGSDeviceInfo_540), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {AGS_MAKE_VERSION(5, 4, 1), AGS_MAKE_VERSION(5, 4, 1), sizeof(AGSDeviceInfo_541), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {AGS_MAKE_VERSION(5, 4, 2), AGS_MAKE_VERSION(5, 4, 2), sizeof(AGSDeviceInfo_542), sizeof(AGSDX11ReturnedParams_520), AsicFamily_RDNA}, + {AGS_MAKE_VERSION(6, 0, 0), AGS_MAKE_VERSION(6, 0, 1), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA2}, + {AGS_MAKE_VERSION(6, 1, 0), AGS_MAKE_VERSION(6, 2, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, }; #define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ - offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ - offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), -1, \ - -1, -1, -1, -1, -1, -1}} + offsetof(AGSDeviceInfo_520, name), -1, \ + -1, -1, -1, -1}} #define DEF_FIELD_520_UP(name) {DEVICE_FIELD_##name, {-1, -1, offsetof(AGSDeviceInfo_520, name), \ - offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ - -1, -1, offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), offsetof(AGSDeviceInfo_600, name), \ - offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} + -1, offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ + offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} #define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ - -1, -1, offsetof(AGSDeviceInfo_540, name), \ + -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ - -1, -1, -1, -1}} + -1, -1}} #define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ - offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ - offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), -1, \ - -1, -1, -1}} + offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ + offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ + -1, -1}} #define DEVICE_FIELD_adapterString 0 #define DEVICE_FIELD_architectureVersion 1 @@ -179,6 +174,7 @@ struct AGSContext VkPhysicalDeviceMemoryProperties *memory_properties; ID3D11DeviceContext *d3d11_context; AGSDX11ExtensionsSupported_600 extensions; + unsigned int public_version; }; static HMODULE hd3d11, hd3d12; @@ -307,16 +303,16 @@ static enum amd_ags_version get_version_number(int ags_version) unsigned int i; for (i = 0; i < ARRAY_SIZE(amd_ags_info); i++) - if (amd_ags_info[i].ags_public_version == ags_version) + if (ags_version >= amd_ags_info[i].ags_min_public_version && ags_version <= amd_ags_info[i].ags_max_public_version) { - TRACE("Found AGS v%s.\n", debugstr_agsversion(ags_version)); + TRACE("Found AGS v%s (internal %d).\n", debugstr_agsversion(ags_version), i); return i; } ERR("Unknown ags_version %s, using 5.4.1.\n", debugstr_agsversion(ags_version)); return AMD_AGS_VERSION_5_4_1; } -static BOOL get_ags_version_from_resource(const WCHAR *filename, enum amd_ags_version *ret) +static BOOL get_ags_version_from_resource(const WCHAR *filename, enum amd_ags_version *ret, int *public_version) { DWORD infosize; void *infobuf; @@ -356,8 +352,9 @@ static BOOL get_ags_version_from_resource(const WCHAR *filename, enum amd_ags_ve major = info->dwFileVersionMS >> 16; minor = info->dwFileVersionMS; patch = info->dwFileVersionLS >> 16; + *public_version = AGS_MAKE_VERSION(major, minor, patch); TRACE("Found amd_ags_x64.dll v%d.%d.%d\n", major, minor, patch); - *ret = get_version_number(AGS_MAKE_VERSION(major, minor, patch)); + *ret = get_version_number(*public_version); heap_free(infobuf); return TRUE; } @@ -379,7 +376,7 @@ static enum amd_ags_version guess_version_from_exports(HMODULE hnative) return AMD_AGS_VERSION_5_4_1; } -static enum amd_ags_version determine_ags_version(int ags_version) +static enum amd_ags_version determine_ags_version(int *ags_version) { /* AMD AGS is not binary compatible between versions (even minor versions), and the game * does not request a specific version when calling agsInit(). @@ -392,10 +389,10 @@ static enum amd_ags_version determine_ags_version(int ags_version) HMODULE hnative = NULL; DWORD size; - TRACE("ags_version %#x.\n", ags_version); + TRACE("*ags_version %#x.\n", *ags_version); - if (ags_version) - return get_version_number(ags_version); + if (*ags_version) + return get_version_number(*ags_version); *temp_name = 0; if (!(size = GetModuleFileNameW(GetModuleHandleW(L"amd_ags_x64.dll"), dllname, ARRAY_SIZE(dllname))) @@ -415,7 +412,7 @@ static enum amd_ags_version determine_ags_version(int ags_version) goto done; } - if (get_ags_version_from_resource(temp_name, &ret)) + if (get_ags_version_from_resource(temp_name, &ret, ags_version)) goto done; if (!(hnative = LoadLibraryW(temp_name))) @@ -426,22 +423,25 @@ static enum amd_ags_version determine_ags_version(int ags_version) if ((pagsGetVersionNumber = (void *)GetProcAddress(hnative, "agsGetVersionNumber"))) { - ags_version = pagsGetVersionNumber(); - ret = get_version_number(ags_version); - TRACE("Got version %s (%d) from agsGetVersionNumber.\n", debugstr_agsversion(ags_version), ret); + *ags_version = pagsGetVersionNumber(); + ret = get_version_number(*ags_version); + TRACE("Got version %s (%d) from agsGetVersionNumber.\n", debugstr_agsversion(*ags_version), ret); goto done; } ret = guess_version_from_exports(hnative); done: + if (!*ags_version) + *ags_version = amd_ags_info[ret].ags_max_public_version; + if (hnative) FreeLibrary(hnative); if (*temp_name) DeleteFileW(temp_name); - TRACE("Using AGS v%s interface\n", debugstr_agsversion(amd_ags_info[ret].ags_public_version)); + TRACE("Using AGS v%s (internal %d) interface\n", debugstr_agsversion(*ags_version), ret); return ret; } @@ -690,7 +690,8 @@ static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) memset(context, 0, sizeof(*context)); - context->version = determine_ags_version(ags_version); + context->version = determine_ags_version(&ags_version); + context->public_version = ags_version; ret = vk_get_physical_device_properties(&context->device_count, &context->properties, &context->memory_properties); if (ret != AGS_SUCCESS || !context->device_count) @@ -818,9 +819,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi } memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->agsVersionMajor = AGS_VER_MAJOR(amd_ags_info[object->version].ags_public_version); - gpu_info->agsVersionMinor = AGS_VER_MINOR(amd_ags_info[object->version].ags_public_version);; - gpu_info->agsVersionPatch = AGS_VER_PATCH(amd_ags_info[object->version].ags_public_version);; + gpu_info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); + gpu_info->agsVersionMinor = AGS_VER_MINOR(object->public_version); + gpu_info->agsVersionPatch = AGS_VER_PATCH(object->public_version); gpu_info->driverVersion = driver_version; gpu_info->radeonSoftwareVersion = radeon_version; gpu_info->numDevices = object->device_count; @@ -1172,11 +1173,12 @@ AGSDriverVersionResult WINAPI agsCheckDriverVersion(const char* version_reported int WINAPI agsGetVersionNumber(void) { - enum amd_ags_version version = determine_ags_version(0); + int public_version = 0; + enum amd_ags_version version = determine_ags_version(&public_version); - TRACE("version %d.\n", version); + TRACE("version %s (internal %d).\n", debugstr_agsversion(public_version), version); - return amd_ags_info[version].ags_public_version; + return public_version; } AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext *context, ID3D11Device *device, unsigned int uavSlot, unsigned int *extensionsSupported ) @@ -1279,10 +1281,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds_530(AGSContext* cont return set_depth_bounds(context, dx_context, enabled, min_depth, max_depth); } -C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 3); __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $4,%eax\n\t" + "cmp $3,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) @@ -1331,10 +1333,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap(AGSContext *context return update_uav_overlap(context, dx_context, TRUE); } -C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 3); __ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $4,%eax\n\t" + "cmp $3,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap") ) @@ -1365,10 +1367,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap(AGSContext *context, return update_uav_overlap(context, dx_context, FALSE); } -C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 3); __ASM_GLOBAL_FUNC( DX11_EndUAVOverlap_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $4,%eax\n\t" + "cmp $3,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap") ) From 96871b0a83ec17fa79354a07c80bf04d74c3c171 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 1 Dec 2023 13:02:58 -0600 Subject: [PATCH 0667/1506] amd_ags_x64: Recognize versions 5.0.1 - 5.0.6. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 0e6359aec35..9bd75ad000d 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -73,7 +73,7 @@ static const struct } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {AGS_MAKE_VERSION(5, 0, 5), AGS_MAKE_VERSION(5, 0, 5), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(5, 0, 0), AGS_MAKE_VERSION(5, 0, 6), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 1, 1), AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 2, 0), AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, {AGS_MAKE_VERSION(5, 3, 0), AGS_MAKE_VERSION(5, 3, 0), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, From 8915f49986b7d11b889fa58bacd3fdaf0f214193 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 14 Aug 2023 20:04:14 -0600 Subject: [PATCH 0668/1506] wine.inf: Enable builtin atiadlxx for Ratchet & Clank: Rift Apart. CW-Bug-Id: #22607 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index b00535b880b..aa865f5a9ed 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2814,3 +2814,4 @@ HKCU,Software\Wine\AppDefaults\Avengers.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\starwarssquadrons.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\GW2.Main_Win64_Retail.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\Spider-Man.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\RiftApart.exe\DllOverrides,"atiadlxx",,"builtin" From 6eae55d6d26cf75e2a5e58a510dc168f9bc5022a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Dec 2023 13:42:57 -0600 Subject: [PATCH 0669/1506] include: Define bcrypt DH parameters structure and constants. --- include/bcrypt.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/bcrypt.h b/include/bcrypt.h index 7f768f61679..b8b682c4746 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -118,6 +118,8 @@ typedef LONG NTSTATUS; #define BCRYPT_KDF_TLS_PRF L"TLS_PRF" #define BCRYPT_KDF_SP80056A_CONCAT L"SP800_56A_CONCAT" #define BCRYPT_KDF_RAW_SECRET L"TRUNCATE" + +#define BCRYPT_DH_PARAMETERS L"DHParameters" #else static const WCHAR BCRYPT_ALGORITHM_NAME[] = {'A','l','g','o','r','i','t','h','m','N','a','m','e',0}; static const WCHAR BCRYPT_AUTH_TAG_LENGTH[] = {'A','u','t','h','T','a','g','L','e','n','g','t','h',0}; @@ -198,6 +200,7 @@ static const WCHAR BCRYPT_KDF_HMAC[] = {'H','M','A','C',0}; static const WCHAR BCRYPT_KDF_TLS_PRF[] = {'T','L','S','_','P','R','F',0}; static const WCHAR BCRYPT_KDF_SP80056A_CONCAT[] = {'S','P','8','0','0','_','5','6','A','_','C','O','N','C','A','T',0}; static const WCHAR BCRYPT_KDF_RAW_SECRET[] = {'T','R','U','N','C','A','T','E',0}; +#define BCRYPT_DH_PARAMETERS u"DHParameters" #endif #define BCRYPT_ECDSA_PUBLIC_P256_MAGIC 0x31534345 @@ -398,6 +401,15 @@ typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER ULONG cbKeyData; } BCRYPT_KEY_DATA_BLOB_HEADER, *PBCRYPT_KEY_DATA_BLOB_HEADER; +typedef struct _BCRYPT_DH_PARAMETER_HEADER +{ + ULONG cbLength; + ULONG dwMagic; + ULONG cbKeyLength; +} BCRYPT_DH_PARAMETER_HEADER; + +#define BCRYPT_DH_PARAMETERS_MAGIC 0x4d504844 + #define KDF_HASH_ALGORITHM 0x00000000 #define KDF_SECRET_PREPEND 0x00000001 #define KDF_SECRET_APPEND 0x00000002 From cc6c77736a0de31daee3b5696f6f71d93a6132a9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 Mar 2021 21:58:44 +0300 Subject: [PATCH 0670/1506] bcrypt/tests: Add test for DH secret agreement. --- dlls/bcrypt/tests/bcrypt.c | 358 +++++++++++++++++++++++++++++++++++++ 1 file changed, 358 insertions(+) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 45e03e5d15b..2b2f41a841b 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -3961,6 +3961,362 @@ static void test_RC4(void) ok(status == STATUS_SUCCESS, "got %#lx\n", status); } +static void test_dh_SecretAgreement(void) +{ + static BCryptBuffer hash_param_buffers[] = + { + { + sizeof(BCRYPT_SHA256_ALGORITHM), + KDF_HASH_ALGORITHM, + (void *)BCRYPT_SHA256_ALGORITHM, + } + }; + + static BCryptBufferDesc hash_params = + { + BCRYPTBUFFER_VERSION, + ARRAY_SIZE(hash_param_buffers), + hash_param_buffers, + }; + + static const ULONG private_key_data[] = + { + 0xc4caf69c, 0x57b4db27, 0x36f7135f, 0x5ccba686, 0xc37b8819, 0x1d35c9b2, 0xbb07a1cf, 0x0c5d1c1b, + 0xc79acb10, 0x31dfdabb, 0x702e02b9, 0x1efab345, 0x262a8074, 0x5edf7698, 0x9b9dc630, 0x13c34b93, + 0xacbc928b, 0xb79eed8c, 0x7413dce9, 0xa5521280, 0x88d8e695, 0xa310269f, 0xca7c5719, 0xcd0c775b, + 0x9a6e2cf2, 0x9e235c51, 0xf49db62d, 0x28e72424, 0x4a44da5a, 0x3d98268d, 0x8e4d2be3, 0x254e44e6, + + 0x18a67e55, 0x572e13a1, 0x46f81ca8, 0xc331c9b9, 0xf8fe3dd4, 0x8a889e5a, 0x6c0505fd, 0xbd97a121, + 0xed2dbd67, 0xf39efa8e, 0x36f9c287, 0xf6bbfa6c, 0x461e42ad, 0x17dc170e, 0xc002dc2e, 0x4813d9a4, + 0x0b6fabb8, 0x6a9e1860, 0xa8a8cbd9, 0xb7ed6b5d, 0xabb34d23, 0xf2fbe1fd, 0x8670df1e, 0xba7fa4e6, + 0xf7039712, 0x94448f30, 0xe10c812e, 0x3e311976, 0xcfdd72c4, 0xbdbea98f, 0xc9a540d6, 0x89646d57, + + 0x7ab63b33, 0x03a1e9b6, 0x947f7a9b, 0x5ae59eeb, 0x1d12eb05, 0x3f425d92, 0xe028c6ba, 0xbf90ddc9, + 0xb554f55a, 0x7aeb88b6, 0x4a443a5f, 0xbab35111, 0x82c78a0c, 0x298dd482, 0x02937cb1, 0xc94cdc2e, + 0x59b010eb, 0x3bbc0a2b, 0xd845fee0, 0x04c1d0db, 0x0c8c9424, 0x1cafd4b2, 0x9aa7aed9, 0x6a478486, + 0xa8841fd7, 0xbfeff40a, 0x8fd7bcc5, 0x3bb28977, 0x2b9a7955, 0xa55cd2e4, 0x1b6ad657, 0x067cdf21, + + 0x06f36920, 0x63280e1b, 0xf17d930f, 0xa06e74a8, 0x463b3a6f, 0x2a464507, 0x93f8a982, 0x8f620a7d, + 0xeda32d11, 0x9706a6d4, 0x33dce588, 0x75a1c446, 0x048ab567, 0xd735aafa, 0x806f7c1c, 0xdcb9651a, + 0x26acf3b4, 0x45f91cc9, 0x2a0de6fc, 0xf3c03d0c, 0xf5aee0aa, 0x3eeaaf36, 0x18ccee61, 0x83faa783, + 0x4b2b5250, 0xf4ccea22, 0x5ac0714b, 0x3f0b2bc6, 0x481b13ce, 0x12040ea7, 0x66e0bbed, 0x158e1a67, + }; + static const ULONG raw_shared_secret[] = + { + 0x375d89b5, 0x35a9c270, 0xfbc5ba82, 0x09eb3069, 0xd50965b0, 0xace510f7, 0x981e8731, 0x80a76115, + 0xf386d348, 0xca17b8df, 0x0b0e84ec, 0xf81f756e, 0x5030fa20, 0x03113b71, 0x97b7e879, 0x899b5fae, + 0xe6913299, 0x09270076, 0x39bc813a, 0xde3ef070, 0x65ad5b3a, 0x2b7c4ba4, 0x86c98ef9, 0x3236feaf, + 0x3e0253f7, 0x0489d2dd, 0x97669a3d, 0x50242fca, 0x5d4aecb1, 0xcf2d805f, 0x2258afff, 0x750e92cd, + }; + static const ULONG sha1_shared_secret[] = + { + 0x0babba9c, 0x0bdeacbd, 0x04e36574, 0xdd504dcd, 0x0cd88db0, + }; + static const ULONG sha256_shared_secret[] = + { + 0x3213db5b, 0x8cc8250b, 0xc829eaab, 0x00933709, 0x68160aa9, 0xfb9f1e20, 0xf92368e6, 0x2b8e18eb, + }; + + BCRYPT_DH_PARAMETER_HEADER *dh_header; + BCRYPT_SECRET_HANDLE secret, secret2; + BCRYPT_DH_KEY_BLOB *dh_key_blob; + static const ULONG length = 1024; + BCRYPT_KEY_HANDLE key, key2; + BCRYPT_ALG_HANDLE alg; + UCHAR buffer[2048]; + NTSTATUS status; + unsigned int i; + ULONG size; + + status = BCryptOpenAlgorithmProvider(&alg, BCRYPT_DH_ALGORITHM, NULL, 0); + ok(!status, "got %08lx\n", status); + if (status) + return; + + key = NULL; + + status = BCryptGenerateKeyPair(alg, &key, 256, 0); + ok(status == STATUS_INVALID_PARAMETER, "got %08lx\n", status); + + status = BCryptGenerateKeyPair(alg, &key, length, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(key != NULL, "key not set\n"); + + memset(buffer, 0xcc, sizeof(buffer)); + status = BCryptGetProperty(key, BCRYPT_DH_PARAMETERS, buffer, sizeof(buffer), &size, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptExportKey(key, NULL, BCRYPT_DH_PUBLIC_BLOB, buffer, sizeof(buffer), &size, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptFinalizeKeyPair(key, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + size = 0xdeadbeef; + status = BCryptGetProperty(key, BCRYPT_DH_PARAMETERS, NULL, sizeof(buffer), &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == sizeof(BCRYPT_DH_PARAMETER_HEADER) + length / 8 * 2, "Got unexpected size %lu.\n", size); + + size = 0xdeadbeef; + status = BCryptGetProperty(key, BCRYPT_DH_PARAMETERS, buffer, 28, &size, 0); + ok(status == STATUS_BUFFER_TOO_SMALL, "got %08lx\n", status); + ok(size == sizeof(BCRYPT_DH_PARAMETER_HEADER) + length / 8 * 2, "Got unexpected size %lu.\n", size); + + size = 0xdeadbeef; + status = BCryptGetProperty(key, BCRYPT_DH_PARAMETERS, buffer, sizeof(buffer), &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == sizeof(BCRYPT_DH_PARAMETER_HEADER) + length / 8 * 2, "Got unexpected size %lu.\n", size); + + dh_header = (BCRYPT_DH_PARAMETER_HEADER *)buffer; + ok(dh_header->cbLength == sizeof(*dh_header) + length / 8 * 2, "Got unexpected length %lu.\n", dh_header->cbLength); + ok(dh_header->cbKeyLength == length / 8, "Got unexpected length %lu.\n", dh_header->cbKeyLength); + ok(dh_header->dwMagic == BCRYPT_DH_PARAMETERS_MAGIC, "Got unexpected magic %#lx.\n", dh_header->dwMagic); + + status = BCryptDestroyKey(key); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + dh_key_blob = (BCRYPT_DH_KEY_BLOB *)buffer; + dh_key_blob->dwMagic = BCRYPT_DH_PRIVATE_MAGIC; + dh_key_blob->cbKey = length / 8; + memcpy(dh_key_blob + 1, private_key_data, sizeof(private_key_data)); + size = sizeof(buffer); + status = BCryptImportKeyPair(alg, NULL, BCRYPT_DH_PRIVATE_BLOB, &key, buffer, size, 0); + ok(status == STATUS_INVALID_PARAMETER, "got %08lx\n", status); + size = sizeof(*dh_key_blob) + length / 8 * 4; + status = BCryptImportKeyPair(alg, NULL, BCRYPT_DH_PRIVATE_BLOB, &key, buffer, size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + memset(buffer, 0xcc, sizeof(buffer)); + size = 0xdeadbeef; + status = BCryptExportKey(key, NULL, BCRYPT_DH_PUBLIC_BLOB, NULL, 0, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == sizeof(BCRYPT_DH_KEY_BLOB) + length / 8 * 3, "Got unexpected size %lu.\n", size); + + size = 0xdeadbeef; + status = BCryptExportKey(key, NULL, BCRYPT_DH_PUBLIC_BLOB, buffer, sizeof(buffer), &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == sizeof(BCRYPT_DH_KEY_BLOB) + length / 8 * 3, "Got unexpected size %lu.\n", size); + dh_key_blob = (BCRYPT_DH_KEY_BLOB *)buffer; + ok(dh_key_blob->dwMagic == BCRYPT_DH_PUBLIC_MAGIC, "Got unexpected magic %#lx.\n", dh_key_blob->dwMagic); + ok(dh_key_blob->cbKey == length / 8, "Got unexpected length %lu.\n", dh_key_blob->cbKey); + ok(!memcmp(dh_key_blob + 1, private_key_data, length / 8 * 3), "Key data does not match.\n"); + + status = BCryptGenerateKeyPair(alg, &key2, length, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + dh_header = (BCRYPT_DH_PARAMETER_HEADER *)buffer; + dh_header->dwMagic = BCRYPT_DH_PARAMETERS_MAGIC; + dh_header->cbLength = sizeof(*dh_header) + length / 8 * 2; + dh_header->cbKeyLength = length / 8; + memcpy(dh_header + 1, private_key_data, length / 8 * 2); + status = BCryptSetProperty(key2, BCRYPT_DH_PARAMETERS, buffer, dh_header->cbLength, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptFinalizeKeyPair(key2, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptExportKey(key2, NULL, BCRYPT_DH_PUBLIC_BLOB, buffer, sizeof(buffer), &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == sizeof(BCRYPT_DH_KEY_BLOB) + length / 8 * 3, "Got unexpected size %lu.\n", size); + ok(dh_key_blob->dwMagic == BCRYPT_DH_PUBLIC_MAGIC, "Got unexpected dwMagic %#lx.\n", dh_key_blob->dwMagic); + ok(dh_key_blob->cbKey == length / 8, "Got unexpected length %lu.\n", dh_key_blob->cbKey); + ok(!memcmp(dh_key_blob + 1, private_key_data, length / 8 * 2), "DH parameters do not match.\n"); + ok(memcmp((BYTE *)(dh_key_blob + 1) + length / 8 * 2, (BYTE *)private_key_data + length / 8 * 2, length / 8), + "Random public key data matches.\n"); + + memset(buffer, 0xcc, sizeof(buffer)); + status = BCryptExportKey(key, NULL, BCRYPT_DH_PRIVATE_BLOB, buffer, sizeof(buffer), &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + dh_key_blob = (BCRYPT_DH_KEY_BLOB *)buffer; + ok(size == sizeof(BCRYPT_DH_KEY_BLOB) + length / 8 * 4, "Got unexpected size %lu.\n", size); + ok(dh_key_blob->dwMagic == BCRYPT_DH_PRIVATE_MAGIC, "Got unexpected dwMagic %#lx.\n", dh_key_blob->dwMagic); + ok(dh_key_blob->cbKey == length / 8, "Got unexpected length %lu.\n", dh_key_blob->cbKey); + ok(!memcmp(dh_key_blob + 1, private_key_data, length / 8 * 4), "Private key data does not match.\n"); + + status = BCryptSecretAgreement(NULL, key, &secret, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptSecretAgreement(key, NULL, &secret, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptSecretAgreement(key, key, NULL, 0); + ok(status == STATUS_INVALID_PARAMETER, "got %08lx\n", status); + + status = BCryptSecretAgreement(key, key, &secret, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptDeriveKey(NULL, L"HASH", NULL, NULL, 0, &size, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptDeriveKey(key, L"HASH", NULL, NULL, 0, &size, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptDeriveKey(secret, NULL, NULL, NULL, 0, &size, 0); + ok(status == STATUS_INVALID_PARAMETER, "got %08lx\n", status); + + size = 0xdeadbeef; + status = BCryptDeriveKey(secret, L"HASH", NULL, NULL, 0, &size, 0); + ok(size == 20, "Got unexpected size %lu.\n", size); + + size = 0xdeadbeef; + status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, NULL, 0, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == length / 8, "Got unexpected size %lu.\n", size); + + status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buffer, 128, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == length / 8, "Got unexpected size %lu.\n", size); + ok(!memcmp(buffer, raw_shared_secret, size), "Raw shared secret data does not match.\n"); + + size = sizeof(buffer); + memset(buffer, 0xcc, sizeof(buffer)); + status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, NULL, buffer, 128, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == 20, "Got unexpected size %lu.\n", size); + ok(!memcmp(buffer, sha1_shared_secret, sizeof(sha1_shared_secret)), "sha1 shared secret data does not match.\n"); + + size = sizeof(buffer); + status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, buffer, size, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == 32, "Got unexpected size %lu.\n", size); + ok(!memcmp(buffer, sha256_shared_secret, sizeof(sha256_shared_secret)), "sha1 shared secret data does not match.\n"); + + for (i = size; i < sizeof(buffer); ++i) + if (buffer[i] != 0xcc) + break; + ok(i == sizeof(buffer), "Buffer modified at %i, value %#x.\n", i, buffer[i]); + + status = BCryptDestroySecret(secret); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptSecretAgreement(key, key2, &secret, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptSecretAgreement(key2, key, &secret2, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buffer, 128, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buffer + size, 128, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(!memcmp(buffer, buffer + size, size), "Shared secrets do not match.\n"); + + status = BCryptDestroyHash(secret); + ok(status == STATUS_INVALID_PARAMETER, "got %08lx\n", status); + + status = BCryptDestroyKey(secret); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptDestroySecret(NULL); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptDestroySecret(alg); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + + status = BCryptDestroySecret(secret); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptDestroyKey(key); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptDestroyKey(key2); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptCloseAlgorithmProvider(alg, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); +} + +static void test_dh_SecretAgreement_values(void) +{ + static const ULONG private_key_data[] = + { + 0xffffffff, 0xffffffff, 0xa2da0fc9, 0x34c26821, 0x8b62c6c4, 0xd11cdc80, 0x084e0229, 0x74cc678a, + 0xa6be0b02, 0x229b133b, 0x79084a51, 0xdd04348e, 0xb31995ef, 0x1b433acd, 0x6d0a2b30, 0x37145ff2, + 0x6d35e14f, 0x45c2516d, 0x76b585e4, 0xc67e5e62, 0xe9424cf4, 0x6bed37a6, 0xb65cff0b, 0xedb706f4, + 0xfb6b38ee, 0xa59f895a, 0x11249fae, 0xe61f4b7c, 0x51662849, 0x8153e6ec, 0xffffffff, 0xffffffff, + + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, + + 0xa0c3c734, 0xc130c92d, 0x5265abf8, 0xff409f17, 0xbcdce187, 0xff64dae3, 0x170560aa, 0xb2423ed8, + 0x9ee5a8b9, 0x92548030, 0x02bba1f9, 0x823e39a4, 0x69c438f5, 0xf91016ac, 0x89bfd166, 0x7f996446, + 0x86224203, 0x15bf689c, 0x619354a4, 0x0c1d3a1f, 0x11bcf3d2, 0x58aae029, 0x41c69824, 0x3fafc179, + 0xa742747c, 0x60658c7a, 0xd3b0bde4, 0x78d3f08b, 0x6cefa061, 0x33752536, 0xe84d4901, 0x48cd73f4, + + 0x8d449700, 0x1f95120e, 0xceb31745, 0x3663177b, 0xbd9bb2d5, 0x9c23c0d9, 0x814d34f8, 0xbc54edb0, + 0xb874659a, 0x3bac8a30, 0xa1f3dd46, 0x1705c900, 0xbc46fefe, 0x7d13875b, 0x3064351a, 0x4bd89a1c, + 0x9e938761, 0x931949db, 0x34490719, 0x84fb08ca, 0xa9dd355a, 0x5b3f5061, 0x2ac96663, 0xc594429e, + 0xbe58395d, 0x2f7d872a, 0x303d37b3, 0xa3a9b606, 0x735a6732, 0xa095bd95, 0x3d55a7c3, 0x00e54635, + }; + static const ULONG peer_key_data[] = + { + 0xffffffff, 0xffffffff, 0xa2da0fc9, 0x34c26821, 0x8b62c6c4, 0xd11cdc80, 0x084e0229, 0x74cc678a, + 0xa6be0b02, 0x229b133b, 0x79084a51, 0xdd04348e, 0xb31995ef, 0x1b433acd, 0x6d0a2b30, 0x37145ff2, + 0x6d35e14f, 0x45c2516d, 0x76b585e4, 0xc67e5e62, 0xe9424cf4, 0x6bed37a6, 0xb65cff0b, 0xedb706f4, + 0xfb6b38ee, 0xa59f895a, 0x11249fae, 0xe61f4b7c, 0x51662849, 0x8153e6ec, 0xffffffff, 0xffffffff, + + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, + + 0x3bf7404b, 0x6284fffe, 0x97c0d565, 0xd830c658, 0xcc21bf39, 0xcae45bb6, 0x019df7df, 0xbf4cd293, + 0x6bf1989d, 0x78a81f52, 0xa4ed861c, 0x6bacf493, 0xa3e700d1, 0xd06cc206, 0x411b9727, 0x01e9c9ab, + 0x9b7e6efa, 0xf46bb25d, 0xd1027242, 0x6130787c, 0xa7b87d8b, 0xfee41492, 0x50db6213, 0x321199b6, + 0x7dace53a, 0xe8b1ec51, 0x2181b113, 0x3b33e3c0, 0x5b3a2d67, 0xbd34f0c1, 0x7037c542, 0x4a8d5540, + }; + static const ULONG raw_shared_secret[] = + { + 0x0815f37d, 0x19ee74ab, 0x9f63f123, 0xe1b3f10c, 0xbcc9be83, 0xaddf5b9d, 0x28174e72, 0xf8a33825, + 0xfc74e47d, 0x2c950888, 0xf5b776d9, 0xfc712fef, 0x5b213b32, 0x489a9829, 0xfc0a4d1d, 0x6e641d3b, + 0x3bb2ff57, 0x63500318, 0x081ee54f, 0xf33a2805, 0xb3759e98, 0xa9a64afe, 0x964b8897, 0x04691bbc, + 0x80f4aae1, 0x617405ee, 0xab71724d, 0x6c10c214, 0x6f60b96f, 0xdc777b0b, 0x22f40d4f, 0x8a1c4eb5, + }; + + BCRYPT_DH_KEY_BLOB *dh_key_blob; + static const ULONG length = 1024; + BCRYPT_KEY_HANDLE key, key2; + BCRYPT_SECRET_HANDLE secret; + BCRYPT_ALG_HANDLE alg; + UCHAR buffer[2048]; + NTSTATUS status; + ULONG size; + + status = BCryptOpenAlgorithmProvider(&alg, BCRYPT_DH_ALGORITHM, NULL, 0); + ok(!status, "got %08lx\n", status); + + dh_key_blob = (BCRYPT_DH_KEY_BLOB *)buffer; + dh_key_blob->dwMagic = BCRYPT_DH_PRIVATE_MAGIC; + dh_key_blob->cbKey = length / 8; + memcpy(dh_key_blob + 1, private_key_data, sizeof(private_key_data)); + + size = sizeof(*dh_key_blob) + length / 8 * 4; + status = BCryptImportKeyPair(alg, NULL, BCRYPT_DH_PRIVATE_BLOB, &key, buffer, size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + dh_key_blob = (BCRYPT_DH_KEY_BLOB *)buffer; + dh_key_blob->dwMagic = BCRYPT_DH_PUBLIC_MAGIC; + dh_key_blob->cbKey = length / 8; + memcpy(dh_key_blob + 1, peer_key_data, sizeof(peer_key_data)); + + size = sizeof(*dh_key_blob) + length / 8 * 3; + status = BCryptImportKeyPair(alg, NULL, BCRYPT_DH_PUBLIC_BLOB, &key2, buffer, size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptSecretAgreement(key, key2, &secret, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + + status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buffer, 128, &size, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + ok(size == length / 8, "Got unexpected size %lu.\n", size); + ok(!memcmp(buffer, raw_shared_secret, size), "Raw shared secret data does not match.\n"); + + status = BCryptDestroySecret(secret); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptDestroyKey(key); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptDestroyKey(key2); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); +} + START_TEST(bcrypt) { HMODULE module; @@ -3999,6 +4355,8 @@ START_TEST(bcrypt) test_SecretAgreement(); test_rsa_encrypt(); test_RC4(); + test_dh_SecretAgreement(); + test_dh_SecretAgreement_values(); FreeLibrary(module); } From ca71621b644aba7daa51256b7707095fb6ed1a6d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 7 Dec 2020 12:59:55 +0300 Subject: [PATCH 0671/1506] bcrypt: Reimplement DH using libgmp instead of private gnutls functions. --- configure.ac | 8 + dlls/bcrypt/Makefile.in | 2 +- dlls/bcrypt/bcrypt_internal.h | 5 + dlls/bcrypt/bcrypt_main.c | 37 ++ dlls/bcrypt/gnutls.c | 757 ++++++++++++++++++++++------------ dlls/bcrypt/tests/bcrypt.c | 29 +- 6 files changed, 576 insertions(+), 262 deletions(-) diff --git a/configure.ac b/configure.ac index a2ee6f5d795..f1b265b1978 100644 --- a/configure.ac +++ b/configure.ac @@ -1496,6 +1496,14 @@ WINE_PACKAGE_FLAGS(DRMAMDGPU,[libdrm_amdgpu],,,, [AC_CHECK_HEADERS([amdgpu_drm.h], [WINE_CHECK_SONAME(drm_amdgpu,amdgpu_query_info,,,[$DRMAMDGPU_LIBS])])]) +dnl **** Check for libgmp **** +if test "x$with_gnutls" != "xno" +then + WINE_PACKAGE_FLAGS(GMP,[gmp],[-lgmp],,, + [AC_CHECK_HEADERS([gmp.h], + [WINE_CHECK_SONAME(gmp,__gmpz_init,,[GMP_CFLAGS=""],[$GMP_LIBS],[[libgmp-*]])])]) +fi + dnl **** Check for SANE **** if test "x$with_sane" != "xno" then diff --git a/dlls/bcrypt/Makefile.in b/dlls/bcrypt/Makefile.in index 542837b2a7a..782bd31b996 100644 --- a/dlls/bcrypt/Makefile.in +++ b/dlls/bcrypt/Makefile.in @@ -2,7 +2,7 @@ MODULE = bcrypt.dll IMPORTS = advapi32 IMPORTLIB = bcrypt UNIXLIB = bcrypt.so -UNIX_CFLAGS = $(GNUTLS_CFLAGS) +UNIX_CFLAGS = $(GNUTLS_CFLAGS) $(GMP_CFLAGS) SOURCES = \ bcrypt_main.c \ diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h index cfbc5d2ac83..94117370f0a 100644 --- a/dlls/bcrypt/bcrypt_internal.h +++ b/dlls/bcrypt/bcrypt_internal.h @@ -175,6 +175,8 @@ struct key_symmetric }; #define KEY_FLAG_LEGACY_DSA_V2 0x00000001 +#define KEY_FLAG_DH_PARAMS_SET 0x00000002 +#define KEY_FLAG_FINALIZED 0x00000004 struct key_asymmetric { @@ -285,6 +287,8 @@ struct key_asymmetric_verify_params #define KEY_EXPORT_FLAG_PUBLIC 0x00000001 #define KEY_EXPORT_FLAG_RSA_FULL 0x00000002 +#define KEY_EXPORT_FLAG_DH_PARAMETERS 0x00000004 + struct key_asymmetric_export_params { struct key *key; @@ -295,6 +299,7 @@ struct key_asymmetric_export_params }; #define KEY_IMPORT_FLAG_PUBLIC 0x00000001 +#define KEY_IMPORT_FLAG_DH_PARAMETERS 0x00000002 struct key_asymmetric_import_params { struct key *key; diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 26472cbfe2b..46ecec06473 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -853,6 +853,21 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *value, ULONG size, ULONG flags ) { + if (key->alg_id == ALG_ID_DH) + { + if (!lstrcmpW( prop, BCRYPT_DH_PARAMETERS )) + { + struct key_asymmetric_import_params params; + + params.key = key; + params.flags = KEY_IMPORT_FLAG_DH_PARAMETERS; + params.buf = value; + params.len = size; + return UNIX_CALL( key_asymmetric_import, ¶ms ); + } + return STATUS_NOT_IMPLEMENTED; + } + if (!wcscmp( prop, BCRYPT_CHAINING_MODE )) { if (!wcscmp( (WCHAR *)value, BCRYPT_CHAIN_MODE_ECB )) @@ -902,6 +917,20 @@ static NTSTATUS get_hash_property( const struct hash *hash, const WCHAR *prop, U return status; } +static NTSTATUS get_dh_property( const struct key *key, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size ) +{ + struct key_asymmetric_export_params params; + + if (wcscmp( prop, BCRYPT_DH_PARAMETERS )) return STATUS_NOT_SUPPORTED; + + params.key = (struct key *)key; + params.flags = KEY_EXPORT_FLAG_DH_PARAMETERS; + params.buf = buf; + params.len = size; + params.ret_len = ret_size; + return UNIX_CALL( key_asymmetric_export, ¶ms ); +} + static NTSTATUS get_key_property( const struct key *key, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size ) { if (!wcscmp( prop, BCRYPT_KEY_STRENGTH )) @@ -925,6 +954,9 @@ static NTSTATUS get_key_property( const struct key *key, const WCHAR *prop, UCHA if (!wcscmp( prop, BCRYPT_AUTH_TAG_LENGTH )) return STATUS_NOT_SUPPORTED; return get_aes_property( key->u.s.mode, prop, buf, size, ret_size ); + case ALG_ID_DH: + return get_dh_property( key, prop, buf, size, ret_size ); + default: FIXME( "unsupported algorithm %u\n", key->alg_id ); return STATUS_NOT_IMPLEMENTED; @@ -1176,6 +1208,8 @@ static NTSTATUS key_asymmetric_create( enum alg_id alg_id, ULONG bitlen, struct return STATUS_NOT_IMPLEMENTED; } + if (alg_id == ALG_ID_DH && bitlen < 512) return STATUS_INVALID_PARAMETER; + if (!(key = calloc( 1, sizeof(*key) ))) return STATUS_NO_MEMORY; key->hdr.magic = MAGIC_KEY; key->alg_id = alg_id; @@ -2488,6 +2522,9 @@ NTSTATUS WINAPI BCryptSecretAgreement( BCRYPT_KEY_HANDLE privkey_handle, BCRYPT_ if (!privkey || !pubkey) return STATUS_INVALID_HANDLE; if (!is_agreement_key( privkey ) || !is_agreement_key( pubkey )) return STATUS_NOT_SUPPORTED; if (!ret_handle) return STATUS_INVALID_PARAMETER; + if (privkey->alg_id != pubkey->alg_id) return STATUS_INVALID_PARAMETER; + if (privkey->alg_id == ALG_ID_DH && !(privkey->u.a.flags & pubkey->u.a.flags & KEY_FLAG_FINALIZED)) return STATUS_INVALID_PARAMETER; + if (privkey->u.a.bitlen != pubkey->u.a.bitlen) return STATUS_INVALID_PARAMETER; if (!(secret = calloc( 1, sizeof(*secret) ))) return STATUS_NO_MEMORY; secret->hdr.magic = MAGIC_SECRET; diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 68f84a553d2..41d3ccd0f19 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -48,6 +48,15 @@ #include "wine/debug.h" +#include + +#ifdef HAVE_GMP_H +#include +#endif + +#include +#include + WINE_DEFAULT_DEBUG_CHANNEL(bcrypt); WINE_DECLARE_DEBUG_CHANNEL(winediag); @@ -87,6 +96,11 @@ union key_data gnutls_privkey_t privkey; gnutls_pubkey_t pubkey; } a; + struct /* DH */ + { + UCHAR *privkey; + UCHAR *pubkey; + } d; }; C_ASSERT( sizeof(union key_data) <= sizeof(((struct key *)0)->private) ); @@ -95,6 +109,33 @@ static union key_data *key_data( struct key *key ) return (union key_data *)key->private; } +static unsigned int dh_pubkey_len( struct key *key ) +{ + return sizeof(BCRYPT_DH_KEY_BLOB) + key->u.a.bitlen / 8 * 3; +} + +static void dh_key_free( struct key *key ) +{ + free( key_data(key)->d.privkey ); + key_data(key)->d.privkey = NULL; + free( key_data(key)->d.pubkey ); + key_data(key)->d.pubkey = NULL; +} + +static void dh_key_alloc_pub( struct key *key ) +{ + if (key_data(key)->d.pubkey) return; + key_data(key)->d.pubkey = calloc( 1, dh_pubkey_len( key )); +} + +static void dh_key_alloc_priv( struct key *key ) +{ + unsigned int bitlen = key->u.a.bitlen; + + if (key_data(key)->d.privkey) return; + key_data(key)->d.privkey = calloc( 1, bitlen / 8 ); +} + /* Not present in gnutls version < 3.0 */ static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t, void *, size_t); static int (*pgnutls_cipher_add_auth)(gnutls_cipher_hd_t, const void *, size_t); @@ -155,6 +196,13 @@ static int (*pgnutls_privkey_import_dh_raw)(gnutls_privkey_t, const gnutls_dh_pa static int (*pgnutls_pubkey_import_dh_raw)(gnutls_pubkey_t, const gnutls_dh_params_t, const gnutls_datum_t *); static void *libgnutls_handle; + +static int (*pgnutls_dh_params_generate2)(gnutls_dh_params_t dparams, unsigned int bits); +static int (*pgnutls_dh_params_import_raw2)(gnutls_dh_params_t dh_params, const gnutls_datum_t * prime, + const gnutls_datum_t * generator, unsigned key_bits); +static int (*pgnutls_dh_params_export_raw)(gnutls_dh_params_t params, gnutls_datum_t * prime, + gnutls_datum_t * generator, unsigned int *bits); + #define MAKE_FUNCPTR(f) static typeof(f) * p##f MAKE_FUNCPTR(gnutls_cipher_decrypt2); MAKE_FUNCPTR(gnutls_cipher_deinit); @@ -178,6 +226,22 @@ MAKE_FUNCPTR(gnutls_pubkey_deinit); MAKE_FUNCPTR(gnutls_pubkey_encrypt_data); MAKE_FUNCPTR(gnutls_pubkey_import_privkey); MAKE_FUNCPTR(gnutls_pubkey_init); + +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) +static BOOL dh_supported; +static void *libgmp_handle; + +MAKE_FUNCPTR(mpz_init); +MAKE_FUNCPTR(mpz_clear); +MAKE_FUNCPTR(mpz_cmp); +MAKE_FUNCPTR(_mpz_cmp_ui); +MAKE_FUNCPTR(mpz_sizeinbase); +MAKE_FUNCPTR(mpz_import); +MAKE_FUNCPTR(mpz_export); +MAKE_FUNCPTR(mpz_mod); +MAKE_FUNCPTR(mpz_powm); +MAKE_FUNCPTR(mpz_sub_ui); +#endif #undef MAKE_FUNCPTR static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size) @@ -401,6 +465,37 @@ static NTSTATUS gnutls_process_attach( void *args ) LOAD_FUNCPTR(gnutls_pubkey_init); #undef LOAD_FUNCPTR +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) +#define LOAD_FUNCPTR_STR(f) #f +#define LOAD_FUNCPTR(f) \ + if (!(p##f = dlsym( libgmp_handle, LOAD_FUNCPTR_STR(f) ))) \ + { \ + ERR( "failed to load %s\n", LOAD_FUNCPTR_STR(f) ); \ + goto fail; \ + } + + if ((libgmp_handle = dlopen( SONAME_LIBGMP, RTLD_NOW ))) + { + LOAD_FUNCPTR(mpz_init); + LOAD_FUNCPTR(mpz_clear); + LOAD_FUNCPTR(mpz_cmp); + LOAD_FUNCPTR(_mpz_cmp_ui); + LOAD_FUNCPTR(mpz_sizeinbase); + LOAD_FUNCPTR(mpz_import); + LOAD_FUNCPTR(mpz_export); + LOAD_FUNCPTR(mpz_mod); + LOAD_FUNCPTR(mpz_powm); + LOAD_FUNCPTR(mpz_sub_ui); + } + else + { + ERR_(winediag)( "failed to load libgmp, no support for DH\n" ); + goto fail; + } +#undef LOAD_FUNCPTR +#undef LOAD_FUNCPTR_STR +#endif + #define LOAD_FUNCPTR_OPT(f) \ if (!(p##f = dlsym( libgnutls_handle, #f ))) \ { \ @@ -445,6 +540,33 @@ static NTSTATUS gnutls_process_attach( void *args ) pgnutls_perror( ret ); goto fail; } + if (!(pgnutls_dh_params_init = dlsym( libgnutls_handle, "gnutls_dh_params_init" ))) + { + WARN("gnutls_dh_params_init not found\n"); + } + if (!(pgnutls_dh_params_deinit = dlsym( libgnutls_handle, "gnutls_dh_params_deinit" ))) + { + WARN("gnutls_dh_params_deinit not found\n"); + } + if (!(pgnutls_dh_params_generate2 = dlsym( libgnutls_handle, "gnutls_dh_params_generate2" ))) + { + WARN("gnutls_dh_params_generate2 not found\n"); + } + if (!(pgnutls_dh_params_import_raw2 = dlsym( libgnutls_handle, "gnutls_dh_params_import_raw2" ))) + { + WARN("gnutls_dh_params_import_raw2 not found\n"); + } + if (!(pgnutls_dh_params_export_raw = dlsym( libgnutls_handle, "gnutls_dh_params_export_raw" ))) + { + WARN("gnutls_dh_params_export_raw not found\n"); + } + +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) + dh_supported = pgnutls_dh_params_init && pgnutls_dh_params_generate2 && pgnutls_dh_params_import_raw2 + && libgmp_handle; +#else + ERR_(winediag)("Compiled without DH support.\n"); +#endif if (TRACE_ON( bcrypt )) { @@ -457,6 +579,14 @@ static NTSTATUS gnutls_process_attach( void *args ) fail: dlclose( libgnutls_handle ); libgnutls_handle = NULL; + +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) + if (libgmp_handle) + { + dlclose( libgmp_handle ); + libgmp_handle = NULL; + } +#endif return STATUS_DLL_NOT_FOUND; } @@ -469,6 +599,11 @@ static NTSTATUS gnutls_process_detach( void *args ) libgnutls_handle = NULL; } return STATUS_SUCCESS; + +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) + dlclose( libgmp_handle ); + libgmp_handle = NULL; +#endif } struct buffer @@ -1004,6 +1139,183 @@ static NTSTATUS key_export_dsa_capi_public( struct key *key, UCHAR *buf, ULONG l return status; } +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) +static NTSTATUS CDECL gen_random(void *buffer, unsigned int length) +{ + unsigned int read_size; + int dev_random; + + dev_random = open("/dev/urandom", O_RDONLY); + if (dev_random == -1) + { + FIXME("couldn't open /dev/urandom.\n"); + return STATUS_INTERNAL_ERROR; + } + + read_size = read(dev_random, buffer, length); + close(dev_random); + if (read_size != length) + { + FIXME("Could not read from /dev/urandom."); + return STATUS_INTERNAL_ERROR; + } + return STATUS_SUCCESS; +} + +static void import_mpz(mpz_t value, const void *input, unsigned int length) +{ + pmpz_import(value, length, 1, 1, 0, 0, input); +} + +static void export_mpz(void *output, unsigned int length, const mpz_t value) +{ + size_t export_length; + unsigned int offset; + + export_length = (pmpz_sizeinbase(value, 2) + 7) / 8; + assert(export_length <= length); + offset = length - export_length; + memset(output, 0, offset); + pmpz_export((BYTE *)output + offset, &export_length, 1, 1, 0, 0, value); + if (!export_length) + { + ERR("Zero export length, value bits %u.\n", (unsigned)pmpz_sizeinbase(value, 2)); + memset((BYTE *)output + offset, 0, length - offset); + } + else + { + assert(export_length + offset == length); + } +} + +static NTSTATUS CDECL key_dh_generate( struct key *key ) +{ + NTSTATUS status = STATUS_SUCCESS; + mpz_t p, psub1, g, privkey, pubkey; + ULONG key_length; + unsigned int i; + int ret; + + if (!dh_supported) + { + ERR("DH is not available.\n"); + return STATUS_NOT_IMPLEMENTED; + } + + if (key->u.a.flags & KEY_FLAG_FINALIZED) + { + WARN( "Key is already finalized.\n" ); + return STATUS_INVALID_HANDLE; + } + + key_length = key->u.a.bitlen / 8; + + if (!(key->u.a.flags & KEY_FLAG_DH_PARAMS_SET)) + { + gnutls_datum_t prime, generator; + gnutls_dh_params_t dh_params; + + if ((ret = pgnutls_dh_params_init( &dh_params ))) + { + pgnutls_perror( ret ); + return STATUS_INTERNAL_ERROR; + } + dh_key_alloc_pub( key ); + + if ((ret = pgnutls_dh_params_generate2( dh_params, key->u.a.bitlen ))) + { + pgnutls_perror( ret ); + pgnutls_dh_params_deinit( dh_params ); + return STATUS_INTERNAL_ERROR; + } + if ((ret = pgnutls_dh_params_export_raw( dh_params, &prime, &generator, NULL ))) + { + pgnutls_perror( ret ); + pgnutls_dh_params_deinit( dh_params ); + return STATUS_INTERNAL_ERROR; + } + pgnutls_dh_params_deinit( dh_params ); + + + export_gnutls_datum( (UCHAR *)((BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1), key_length, &prime, 1 ); + export_gnutls_datum( (UCHAR *)((BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1) + key_length, + key_length, &generator, 1 ); + free( prime.data ); + free( generator.data ); + + key->u.a.flags |= KEY_FLAG_DH_PARAMS_SET; + } + dh_key_alloc_priv( key ); + + pmpz_init(p); + pmpz_init(psub1); + pmpz_init(g); + pmpz_init(pubkey); + pmpz_init(privkey); + + import_mpz(p, (BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1, key_length); + if (!mpz_sgn(p)) + { + ERR("Got zero modulus.\n"); + status = STATUS_INTERNAL_ERROR; + goto done; + } + pmpz_sub_ui(psub1, p, 1); + + import_mpz(g, (UCHAR *)((BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1) + key_length, key_length); + if (!mpz_sgn(g)) + { + ERR("Got zero generator.\n"); + status = STATUS_INTERNAL_ERROR; + goto done; + } + for (i = 0; i < 3; ++i) + { + if ((status = gen_random(key_data(key)->d.privkey, key_length))) + { + goto done; + } + import_mpz(privkey, key_data(key)->d.privkey, key_length); + + pmpz_mod(privkey, privkey, p); + pmpz_powm(pubkey, g, privkey, p); + if (p_mpz_cmp_ui(pubkey, 1)) + break; + } + if (i == 3) + { + ERR("Could not generate key after 3 iterations.\n"); + status = STATUS_INTERNAL_ERROR; + goto done; + } + + if (pmpz_cmp(pubkey, psub1) >= 0) + { + ERR("pubkey > p - 1.\n"); + status = STATUS_INTERNAL_ERROR; + goto done; + } + + export_mpz(key_data(key)->d.privkey, key_length, privkey); + export_mpz((UCHAR *)((BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1) + 2 * key_length, key_length, pubkey); + key->u.a.flags |= KEY_FLAG_FINALIZED; + +done: + pmpz_clear(psub1); + pmpz_clear(p); + pmpz_clear(g); + pmpz_clear(pubkey); + pmpz_clear(privkey); + return status; +} +#else +static NTSTATUS CDECL key_dh_generate( struct key *key ) +{ + ERR("Compiled without DH support.\n"); + return STATUS_NOT_IMPLEMENTED; +} +#endif + static NTSTATUS key_asymmetric_generate( void *args ) { struct key *key = args; @@ -1014,7 +1326,7 @@ static NTSTATUS key_asymmetric_generate( void *args ) int ret; if (!libgnutls_handle) return STATUS_INTERNAL_ERROR; - if (key_data(key)->a.privkey) return STATUS_INVALID_HANDLE; + if (key->alg_id != ALG_ID_DH && key_data(key)->a.privkey) return STATUS_INVALID_HANDLE; switch (key->alg_id) { @@ -1025,9 +1337,7 @@ static NTSTATUS key_asymmetric_generate( void *args ) break; case ALG_ID_DH: - pk_alg = GNUTLS_PK_DH; - bitlen = key->u.a.bitlen; - break; + return key_dh_generate( key ); case ALG_ID_DSA: pk_alg = GNUTLS_PK_DSA; @@ -1058,6 +1368,7 @@ static NTSTATUS key_asymmetric_generate( void *args ) } if ((ret = pgnutls_pubkey_init( &pubkey ))) { + ERR("gnutls error bitlen %u.\n", bitlen); pgnutls_perror( ret ); pgnutls_privkey_deinit( privkey ); return STATUS_INTERNAL_ERROR; @@ -1582,109 +1893,6 @@ static NTSTATUS key_import_dsa_capi_public( struct key *key, UCHAR *buf, ULONG l return STATUS_SUCCESS; } -static NTSTATUS key_export_dh_public( struct key *key, UCHAR *buf, ULONG len, ULONG *ret_len ) -{ - BCRYPT_DH_KEY_BLOB *dh_blob = (BCRYPT_DH_KEY_BLOB *)buf; - ULONG size = key->u.a.bitlen / 8; - gnutls_dh_params_t params; - gnutls_datum_t p, g, y, x = {0}; - UCHAR *dst; - int ret = GNUTLS_E_INVALID_REQUEST; - - if ((ret = pgnutls_dh_params_init( ¶ms )) < 0) - { - pgnutls_perror( ret ); - return STATUS_INTERNAL_ERROR; - } - - if (key_data(key)->a.pubkey) - ret = pgnutls_pubkey_export_dh_raw( key_data(key)->a.pubkey, params, &y, 0 ); - else if (key_data(key)->a.privkey) - ret = pgnutls_privkey_export_dh_raw( key_data(key)->a.privkey, params, &y, &x, 0 ); - - if (ret) - { - pgnutls_perror( ret ); - pgnutls_dh_params_deinit( params ); - return STATUS_INTERNAL_ERROR; - } - - if ((ret = pgnutls_dh_params_export_raw( params, &p, &g, NULL )) < 0) - { - pgnutls_perror( ret ); - free( y.data ); free( x.data ); - pgnutls_dh_params_deinit( params ); - return STATUS_INTERNAL_ERROR; - } - - *ret_len = sizeof(*dh_blob) + EXPORT_SIZE(p, size, 1) + EXPORT_SIZE(g, size, 1) + EXPORT_SIZE(y, size, 1); - if (len >= *ret_len && buf) - { - dst = (UCHAR *)(dh_blob + 1); - dst += export_gnutls_datum( dst, size, &p, 1 ); - dst += export_gnutls_datum( dst, size, &g, 1 ); - dst += export_gnutls_datum( dst, size, &y, 1 ); - - dh_blob->dwMagic = BCRYPT_DH_PUBLIC_MAGIC; - dh_blob->cbKey = size; - } - - free( p.data ); free( g.data ); free( y.data ); free( x.data ); - return STATUS_SUCCESS; -} - -static NTSTATUS key_export_dh( struct key *key, UCHAR *buf, ULONG len, ULONG *ret_len ) -{ - BCRYPT_DH_KEY_BLOB *dh_blob = (BCRYPT_DH_KEY_BLOB *)buf; - gnutls_datum_t p, g, y, x; - gnutls_dh_params_t params; - ULONG size = key->u.a.bitlen / 8; - UCHAR *dst; - int ret; - - if (!key_data(key)->a.privkey) return STATUS_INVALID_PARAMETER; - - if ((ret = pgnutls_dh_params_init( ¶ms )) < 0) - { - pgnutls_perror( ret ); - return STATUS_INTERNAL_ERROR; - } - - ret = pgnutls_privkey_export_dh_raw( key_data(key)->a.privkey, params, &y, &x, 0 ); - if (ret) - { - pgnutls_perror( ret ); - pgnutls_dh_params_deinit( params ); - return STATUS_INTERNAL_ERROR; - } - - if ((ret = pgnutls_dh_params_export_raw( params, &p, &g, NULL )) < 0) - { - pgnutls_perror( ret ); - free( y.data ); free( x.data ); - pgnutls_dh_params_deinit( params ); - return STATUS_INTERNAL_ERROR; - } - - *ret_len = sizeof(*dh_blob) + EXPORT_SIZE(p, size, 1) + EXPORT_SIZE(g, size, 1) + - EXPORT_SIZE(y, size, 1) + EXPORT_SIZE(x, size, 1); - if (len >= *ret_len && buf) - { - dst = (UCHAR *)(dh_blob + 1); - dst += export_gnutls_datum( dst, size, &p, 1 ); - dst += export_gnutls_datum( dst, size, &g, 1 ); - dst += export_gnutls_datum( dst, size, &y, 1 ); - dst += export_gnutls_datum( dst, size, &x, 1 ); - - dh_blob->dwMagic = BCRYPT_DH_PRIVATE_MAGIC; - dh_blob->cbKey = size; - } - - free( p.data ); free( g.data ); free( y.data ); free( x.data ); - pgnutls_dh_params_deinit( params ); - return STATUS_SUCCESS; -} - static NTSTATUS key_asymmetric_export( void *args ) { const struct key_asymmetric_export_params *params = args; @@ -1719,118 +1927,55 @@ static NTSTATUS key_asymmetric_export( void *args ) return STATUS_NOT_IMPLEMENTED; case ALG_ID_DH: - if (flags & KEY_EXPORT_FLAG_PUBLIC) - return key_export_dh_public( key, params->buf, params->len, params->ret_len ); - return key_export_dh( key, params->buf, params->len, params->ret_len ); - - default: - FIXME( "algorithm %u not yet supported\n", key->alg_id ); - return STATUS_NOT_IMPLEMENTED; - } -} - -static NTSTATUS key_import_dh_public( struct key *key, UCHAR *buf, ULONG len ) -{ - BCRYPT_DH_KEY_BLOB *dh_blob; - gnutls_dh_params_t params; - gnutls_datum_t p, g, y; - gnutls_pubkey_t handle; - int ret; - - if ((ret = pgnutls_pubkey_init( &handle ))) - { - pgnutls_perror( ret ); - return STATUS_INTERNAL_ERROR; - } - - if ((ret = pgnutls_dh_params_init( ¶ms )) < 0) - { - pgnutls_perror( ret ); - pgnutls_pubkey_deinit( handle ); - return STATUS_INTERNAL_ERROR; - } - - dh_blob = (BCRYPT_DH_KEY_BLOB *)buf; - p.data = buf + sizeof(*dh_blob); - p.size = dh_blob->cbKey; - g.data = buf + sizeof(*dh_blob) + dh_blob->cbKey; - g.size = dh_blob->cbKey; - y.data = buf + sizeof(*dh_blob) + dh_blob->cbKey * 2; - y.size = dh_blob->cbKey; - - if ((ret = pgnutls_dh_params_import_raw( params, &p, &g )) < 0) - { - pgnutls_perror( ret ); - pgnutls_dh_params_deinit( params ); - pgnutls_pubkey_deinit( handle ); - return STATUS_INTERNAL_ERROR; - } - - ret = pgnutls_pubkey_import_dh_raw( handle, params, &y ); - pgnutls_dh_params_deinit( params ); - if (ret < 0) - { - pgnutls_perror( ret ); - pgnutls_pubkey_deinit( handle ); - return STATUS_INTERNAL_ERROR; - } + if (!(key->u.a.flags & KEY_FLAG_FINALIZED)) + { + WARN( "Key is not finalized.\n" ); + return STATUS_INVALID_HANDLE; + } - if (key_data(key)->a.pubkey) pgnutls_pubkey_deinit( key_data(key)->a.pubkey ); - key_data(key)->a.pubkey = handle; - return STATUS_SUCCESS; -} + if (flags & KEY_EXPORT_FLAG_DH_PARAMETERS) + { + BCRYPT_DH_PARAMETER_HEADER *h; + unsigned int data_size; + + data_size = sizeof(BCRYPT_DH_PARAMETER_HEADER) + key->u.a.bitlen / 8 * 2; + if (params->ret_len) *params->ret_len = data_size; + if (!params->buf) return STATUS_SUCCESS; + if (params->len < data_size) return STATUS_BUFFER_TOO_SMALL; + + h = (BCRYPT_DH_PARAMETER_HEADER *)params->buf; + h->cbLength = data_size; + h->dwMagic = BCRYPT_DH_PARAMETERS_MAGIC; + h->cbKeyLength = key->u.a.bitlen / 8; + memcpy( h + 1, (BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1, h->cbKeyLength * 2); + } + else + { + BCRYPT_DH_KEY_BLOB *h = (BCRYPT_DH_KEY_BLOB *)params->buf; + BOOL dh_private = !(flags & KEY_EXPORT_FLAG_PUBLIC); -static NTSTATUS key_import_dh( struct key *key, UCHAR *buf, ULONG len ) -{ - BCRYPT_DH_KEY_BLOB *dh_blob; - gnutls_dh_params_t params; - gnutls_datum_t p, g, y, x; - gnutls_privkey_t handle; - int ret; + if (!key_data(key)->d.pubkey || (dh_private && !key_data(key)->d.privkey)) + return STATUS_INVALID_HANDLE; - if ((ret = pgnutls_privkey_init( &handle ))) - { - pgnutls_perror( ret ); - return STATUS_INTERNAL_ERROR; - } + *params->ret_len = dh_pubkey_len( key ); + if (dh_private) + *params->ret_len += key->u.a.bitlen / 8; - if ((ret = pgnutls_dh_params_init( ¶ms )) < 0) - { - pgnutls_perror( ret ); - pgnutls_privkey_deinit( handle ); - return STATUS_INTERNAL_ERROR; - } + if (params->len < *params->ret_len) return STATUS_SUCCESS; - dh_blob = (BCRYPT_DH_KEY_BLOB *)buf; - p.data = buf + sizeof(*dh_blob); - p.size = dh_blob->cbKey; - g.data = buf + sizeof(*dh_blob) + dh_blob->cbKey; - g.size = dh_blob->cbKey; - y.data = buf + sizeof(*dh_blob) + dh_blob->cbKey * 2; - y.size = dh_blob->cbKey; - x.data = buf + sizeof(*dh_blob) + dh_blob->cbKey * 3; - x.size = dh_blob->cbKey; + memcpy(params->buf, key_data(key)->d.pubkey, dh_pubkey_len( key )); + if (dh_private) + memcpy(params->buf + dh_pubkey_len( key ), key_data(key)->d.privkey, key->u.a.bitlen / 8); - if ((ret = pgnutls_dh_params_import_raw( params, &p, &g )) < 0) - { - pgnutls_perror( ret ); - pgnutls_dh_params_deinit( params ); - pgnutls_privkey_deinit( handle ); - return STATUS_INTERNAL_ERROR; - } + h->dwMagic = dh_private ? BCRYPT_DH_PRIVATE_MAGIC : BCRYPT_DH_PUBLIC_MAGIC; + h->cbKey = key->u.a.bitlen / 8; + } + return STATUS_SUCCESS; - ret = pgnutls_privkey_import_dh_raw( handle, params, &y, &x ); - pgnutls_dh_params_deinit( params ); - if (ret < 0) - { - pgnutls_perror( ret ); - pgnutls_privkey_deinit( handle ); - return STATUS_INTERNAL_ERROR; + default: + FIXME( "algorithm %u not yet supported\n", key->alg_id ); + return STATUS_NOT_IMPLEMENTED; } - - if (key_data(key)->a.privkey) pgnutls_privkey_deinit( key_data(key)->a.privkey ); - key_data(key)->a.privkey = handle; - return STATUS_SUCCESS; } static NTSTATUS key_asymmetric_import( void *args ) @@ -1875,9 +2020,56 @@ static NTSTATUS key_asymmetric_import( void *args ) return STATUS_NOT_IMPLEMENTED; case ALG_ID_DH: - if (flags & KEY_IMPORT_FLAG_PUBLIC) - return key_import_dh_public( key, params->buf, params->len ); - return key_import_dh( key, params->buf, params->len ); + if (key->u.a.flags & KEY_FLAG_FINALIZED) + { + ERR( "Key is alrady finalized.\n" ); + return STATUS_INVALID_HANDLE; + } + if (flags & KEY_IMPORT_FLAG_DH_PARAMETERS) + { + const BCRYPT_DH_PARAMETER_HEADER *h = (const BCRYPT_DH_PARAMETER_HEADER *)params->buf; + ULONG param_size = sizeof(BCRYPT_DH_PARAMETER_HEADER) + key->u.a.bitlen / 8 * 2; + + if (params->len < param_size) return STATUS_BUFFER_TOO_SMALL; + if (!h || h->cbLength != param_size || h->dwMagic != BCRYPT_DH_PARAMETERS_MAGIC + || h->cbKeyLength != key->u.a.bitlen / 8) + return STATUS_INVALID_PARAMETER; + + dh_key_alloc_pub( key ); + memcpy((BCRYPT_DH_KEY_BLOB *)key_data(key)->d.pubkey + 1, h + 1, h->cbKeyLength * 2); + key->u.a.flags |= KEY_FLAG_DH_PARAMS_SET; + } + else + { + BCRYPT_DH_KEY_BLOB *h = (BCRYPT_DH_KEY_BLOB *)params->buf; + BOOL dh_private = !(flags & KEY_IMPORT_FLAG_PUBLIC); + ULONG size; + + if (h->dwMagic != (dh_private ? BCRYPT_DH_PRIVATE_MAGIC : BCRYPT_DH_PUBLIC_MAGIC)) + { + WARN("unexpected dwMagic %#x.\n", (int)h->dwMagic); + return STATUS_INVALID_PARAMETER; + } + + size = sizeof(*h) + h->cbKey * 3; + if (dh_private) + size += h->cbKey; + if (params->len != size) return STATUS_INVALID_PARAMETER; + if (h->cbKey * 8 < 512) return STATUS_INVALID_PARAMETER; + + dh_key_alloc_pub( key ); + + memcpy( key_data(key)->d.pubkey, params->buf, dh_pubkey_len( key )); + key->u.a.flags |= KEY_FLAG_DH_PARAMS_SET; + + if (dh_private) + { + dh_key_alloc_priv( key ); + memcpy( key_data(key)->d.privkey, params->buf + sizeof(*h) + h->cbKey * 3, h->cbKey); + } + key->u.a.flags |= KEY_FLAG_FINALIZED; + } + return STATUS_SUCCESS; default: FIXME( "algorithm %u not yet supported\n", key->alg_id ); @@ -2298,8 +2490,15 @@ static NTSTATUS key_asymmetric_destroy( void *args ) { struct key *key = args; - if (key_data(key)->a.privkey) pgnutls_privkey_deinit( key_data(key)->a.privkey ); - if (key_data(key)->a.pubkey) pgnutls_pubkey_deinit( key_data(key)->a.pubkey ); + if (key->alg_id == ALG_ID_DH) + { + dh_key_free( key ); + } + else + { + if (key_data(key)->a.privkey) pgnutls_privkey_deinit( key_data(key)->a.privkey ); + if (key_data(key)->a.pubkey) pgnutls_pubkey_deinit( key_data(key)->a.pubkey ); + } return STATUS_SUCCESS; } @@ -2351,22 +2550,7 @@ static NTSTATUS dup_privkey( struct key *key_orig, struct key *key_copy ) free( x.data ); free( y.data ); free( k.data ); break; } - case ALG_ID_DH: - { - gnutls_dh_params_t params; - gnutls_datum_t y, x; - if ((ret = pgnutls_dh_params_init( ¶ms )) < 0) break; - if ((ret = pgnutls_privkey_export_dh_raw( key_data(key_orig)->a.privkey, params, &y, &x, 0 )) < 0) - { - pgnutls_dh_params_deinit( params ); - break; - } - ret = pgnutls_privkey_import_dh_raw( privkey, params, &y, &x ); - pgnutls_dh_params_deinit( params ); - free( x.data ); free( y.data ); - break; - } default: ERR( "unhandled algorithm %u\n", key_orig->alg_id ); pgnutls_privkey_deinit( privkey ); @@ -2430,22 +2614,6 @@ static NTSTATUS dup_pubkey( struct key *key_orig, struct key *key_copy ) free( x.data ); free( y.data ); break; } - case ALG_ID_DH: - { - gnutls_dh_params_t params; - gnutls_datum_t y; - - if ((ret = pgnutls_dh_params_init( ¶ms )) < 0) break; - if ((ret = pgnutls_pubkey_export_dh_raw( key_data(key_orig)->a.pubkey, params, &y, 0 )) < 0) - { - pgnutls_dh_params_deinit( params ); - break; - } - ret = pgnutls_pubkey_import_dh_raw( pubkey, params, &y ); - pgnutls_dh_params_deinit( params ); - free( y.data ); - break; - } default: ERR( "unhandled algorithm %u\n", key_orig->alg_id ); pgnutls_pubkey_deinit( pubkey ); @@ -2468,6 +2636,23 @@ static NTSTATUS key_asymmetric_duplicate( void *args ) const struct key_asymmetric_duplicate_params *params = args; NTSTATUS status; + if (params->key_orig->alg_id == ALG_ID_DH) + { + union key_data *s = key_data( params->key_orig ); + union key_data *d = key_data( params->key_copy ); + if (s->d.privkey) + { + dh_key_alloc_priv( params->key_copy ); + memcpy( d->d.privkey, s->d.privkey, params->key_orig->u.a.bitlen / 8 ); + } + if (s->d.pubkey) + { + dh_key_alloc_pub( params->key_copy ); + memcpy( d->d.pubkey, s->d.pubkey, dh_pubkey_len( params->key_orig )); + } + return STATUS_SUCCESS; + } + if (key_data(params->key_orig)->a.privkey && (status = dup_privkey( params->key_orig, params->key_copy ))) return status; @@ -2529,14 +2714,80 @@ static NTSTATUS key_asymmetric_encrypt( void *args ) static NTSTATUS key_asymmetric_derive_key( void *args ) { const struct key_asymmetric_derive_key_params *params = args; - gnutls_datum_t s; - int ret; + gnutls_datum_t s = { NULL }; + struct key *priv_key; + struct key *peer_key; - if ((ret = pgnutls_privkey_derive_secret( key_data(params->privkey)->a.privkey, - key_data(params->pubkey)->a.pubkey, NULL, &s, 0 ))) + priv_key = params->privkey; + peer_key = params->pubkey; + + switch (priv_key->alg_id) { - pgnutls_perror( ret ); - return STATUS_INTERNAL_ERROR; + case ALG_ID_DH: +#if defined(HAVE_GMP_H) && defined(SONAME_LIBGMP) + { + mpz_t p, priv, peer, k; + ULONG key_length; + + if (!dh_supported) + { + ERR("DH is not available.\n"); + return STATUS_NOT_IMPLEMENTED; + } + + if (!(priv_key->u.a.flags & KEY_FLAG_FINALIZED) || !(peer_key->u.a.flags & KEY_FLAG_FINALIZED) + || !key_data(priv_key)->d.privkey) + { + WARN( "Keys are not initialized.\n" ); + return STATUS_INVALID_HANDLE; + } + + key_length = priv_key->u.a.bitlen / 8; + + if (memcmp((BCRYPT_DH_KEY_BLOB *)key_data(priv_key)->d.pubkey + 1, + (BCRYPT_DH_KEY_BLOB *)key_data(peer_key)->d.pubkey + 1, 2 * key_length)) + { + ERR("peer DH paramaters do not match.\n"); + return STATUS_INTERNAL_ERROR; + } + + pmpz_init(p); + pmpz_init(priv); + pmpz_init(peer); + pmpz_init(k); + + import_mpz(p, (BCRYPT_DH_KEY_BLOB *)key_data(priv_key)->d.pubkey + 1, key_length); + if (pmpz_sizeinbase(p, 2) < 2) + { + ERR("Invalid prime.\n"); + pmpz_clear(p); + pmpz_clear(priv); + pmpz_clear(peer); + pmpz_clear(k); + return STATUS_INTERNAL_ERROR; + } + import_mpz(priv, key_data(priv_key)->d.privkey, key_length); + import_mpz(peer, key_data(peer_key)->d.pubkey + sizeof(BCRYPT_DH_KEY_BLOB) + 2 * key_length, key_length); + pmpz_powm(k, peer, priv, p); + + s.size = key_length; + s.data = malloc( s.size ); + export_mpz(s.data, key_length, k); + + pmpz_clear(p); + pmpz_clear(priv); + pmpz_clear(peer); + pmpz_clear(k); + break; + } +#else + ERR_(winediag)("Compiled without DH support.\n"); + return STATUS_NOT_IMPLEMENTED; +#endif + + default: + ERR( "unhandled algorithm %u\n", priv_key->alg_id ); + return STATUS_INVALID_HANDLE; } if (!params->output) *params->ret_len = s.size; diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 2b2f41a841b..0601335dd1e 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -3236,12 +3236,7 @@ static void test_DH(void) ok(key != NULL, "key not set\n"); status = BCryptFinalizeKeyPair(key, 0); - todo_wine ok(status == STATUS_SUCCESS, "got %#lx\n", status); - if (status != STATUS_SUCCESS) - { - BCryptDestroyKey(key); - return; - } + ok(status == STATUS_SUCCESS, "got %#lx\n", status); size = 0; status = BCryptExportKey(key, NULL, BCRYPT_DH_PUBLIC_BLOB, NULL, 0, &size, 0); @@ -3914,7 +3909,7 @@ static void test_SecretAgreement(void) BCryptCloseAlgorithmProvider(alg, 0); return; } - todo_wine ok(status == STATUS_SUCCESS, "got %#lx\n", status); + ok(status == STATUS_SUCCESS, "got %#lx\n", status); status = BCryptSecretAgreement(key, key, &secret, 0); ok(status == STATUS_SUCCESS, "got %#lx\n", status); @@ -3923,7 +3918,7 @@ static void test_SecretAgreement(void) ok(status == STATUS_SUCCESS, "got %#lx\n", status); status = BCryptDeriveKey(secret, L"HASH", NULL, NULL, 0, &size, 0); - todo_wine ok(status == STATUS_SUCCESS, "got %#lx\n", status); + ok(status == STATUS_SUCCESS, "got %#lx\n", status); status = BCryptDestroySecret(secret); ok(status == STATUS_SUCCESS, "got %#lx\n", status); @@ -4086,6 +4081,9 @@ static void test_dh_SecretAgreement(void) status = BCryptImportKeyPair(alg, NULL, BCRYPT_DH_PRIVATE_BLOB, &key, buffer, size, 0); ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptFinalizeKeyPair(key, 0); + ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status); + memset(buffer, 0xcc, sizeof(buffer)); size = 0xdeadbeef; status = BCryptExportKey(key, NULL, BCRYPT_DH_PUBLIC_BLOB, NULL, 0, &size, 0); @@ -4101,6 +4099,14 @@ static void test_dh_SecretAgreement(void) ok(dh_key_blob->cbKey == length / 8, "Got unexpected length %lu.\n", dh_key_blob->cbKey); ok(!memcmp(dh_key_blob + 1, private_key_data, length / 8 * 3), "Key data does not match.\n"); + status = BCryptImportKeyPair(alg, NULL, BCRYPT_DH_PUBLIC_BLOB, &key2, buffer, size, 0); + ok(status == STATUS_SUCCESS, "got %#lx.\n", status); + status = BCryptFinalizeKeyPair(key2, 0); + ok(status == STATUS_INVALID_HANDLE, "got %#lx.\n", status); + status = BCryptSecretAgreement(key2, key2, &secret, 0); + todo_wine ok(status == STATUS_INVALID_PARAMETER, "got %08lx\n", status); + BCryptDestroyKey(key2); + status = BCryptGenerateKeyPair(alg, &key2, length, 0); ok(status == STATUS_SUCCESS, "got %08lx\n", status); dh_header = (BCRYPT_DH_PARAMETER_HEADER *)buffer; @@ -4110,8 +4116,15 @@ static void test_dh_SecretAgreement(void) memcpy(dh_header + 1, private_key_data, length / 8 * 2); status = BCryptSetProperty(key2, BCRYPT_DH_PARAMETERS, buffer, dh_header->cbLength, 0); ok(status == STATUS_SUCCESS, "got %08lx\n", status); + status = BCryptSetProperty(key2, BCRYPT_DH_PARAMETERS, buffer, dh_header->cbLength, 0); + ok(status == STATUS_SUCCESS, "got %08lx\n", status); status = BCryptFinalizeKeyPair(key2, 0); ok(status == STATUS_SUCCESS, "got %08lx\n", status); + if (0) + { + /* Crashes on Windows. */ + BCryptSetProperty(key2, BCRYPT_DH_PARAMETERS, buffer, dh_header->cbLength, 0); + } status = BCryptExportKey(key2, NULL, BCRYPT_DH_PUBLIC_BLOB, buffer, sizeof(buffer), &size, 0); ok(status == STATUS_SUCCESS, "got %08lx\n", status); From 8ae2eb018d5b6ea97879f2acc4623afa4de6bc83 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 8 Dec 2020 01:43:33 +0300 Subject: [PATCH 0672/1506] bcrypt: Add support for calculating secret ecc keys. (updated by Paul Gofman) For Rainbow 6: Siege. --- configure.ac | 14 +++ dlls/bcrypt/gnutls.c | 230 +++++++++++++++++++++++++++++++++++++ dlls/bcrypt/tests/bcrypt.c | 10 +- 3 files changed, 250 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index f1b265b1978..7831bad5230 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,7 @@ AC_ARG_WITH(dbus, AS_HELP_STRING([--without-dbus],[do not use DBus (dynamic AC_ARG_WITH(float-abi, AS_HELP_STRING([--with-float-abi=abi],[specify the ABI (soft|softfp|hard) for ARM platforms])) AC_ARG_WITH(fontconfig,AS_HELP_STRING([--without-fontconfig],[do not use fontconfig])) AC_ARG_WITH(freetype, AS_HELP_STRING([--without-freetype],[do not use the FreeType library])) +AC_ARG_WITH(gcrypt, AS_HELP_STRING([--without-gcrypt],[do not use libgcrypt])) AC_ARG_WITH(gettext, AS_HELP_STRING([--without-gettext],[do not use gettext])) AC_ARG_WITH(gettextpo, AS_HELP_STRING([--with-gettextpo],[use the GetTextPO library to rebuild po files]), [if test "x$withval" = "xno"; then ac_cv_header_gettext_po_h=no; fi]) @@ -1884,6 +1885,19 @@ fi WINE_NOTICE_WITH(vulkan,[test "x$ac_cv_lib_soname_vulkan" = "x" -a "x$ac_cv_lib_soname_MoltenVK" = "x"], [libvulkan and libMoltenVK ${notice_platform}development files not found, Vulkan won't be supported.]) +dnl **** Check for gcrypt **** +if test "x$with_gcrypt" != "xno" +then + WINE_PACKAGE_FLAGS(GCRYPT,[libgcrypt],,,, + [AC_CHECK_HEADERS([gcrypt.h]) + if test "$ac_cv_header_gcrypt_h" = "yes" + then + WINE_CHECK_SONAME(gcrypt,gcry_sexp_build,,,[$GCRYPT_LIBS]) + fi]) +fi +WINE_NOTICE_WITH(gcrypt,[test "x$ac_cv_lib_soname_gcrypt" = "x"], + [libgcrypt ${notice_platform}development files not found, GCRYPT won't be supported.]) + dnl **** Check for gcc specific options **** if test "x${GCC}" = "xyes" diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 41d3ccd0f19..7838c3b927c 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -57,6 +57,10 @@ #include #include +#ifdef HAVE_GCRYPT_H +#include +#endif + WINE_DEFAULT_DEBUG_CHANNEL(bcrypt); WINE_DECLARE_DEBUG_CHANNEL(winediag); @@ -203,6 +207,12 @@ static int (*pgnutls_dh_params_import_raw2)(gnutls_dh_params_t dh_params, const static int (*pgnutls_dh_params_export_raw)(gnutls_dh_params_t params, gnutls_datum_t * prime, gnutls_datum_t * generator, unsigned int *bits); +static int (*pgnutls_ecdh_compute_key)(gnutls_ecc_curve_t curve, + const gnutls_datum_t *x, const gnutls_datum_t *y, + const gnutls_datum_t *k, + const gnutls_datum_t *peer_x, const gnutls_datum_t *peer_y, + gnutls_datum_t *Z); + #define MAKE_FUNCPTR(f) static typeof(f) * p##f MAKE_FUNCPTR(gnutls_cipher_decrypt2); MAKE_FUNCPTR(gnutls_cipher_deinit); @@ -242,6 +252,24 @@ MAKE_FUNCPTR(mpz_mod); MAKE_FUNCPTR(mpz_powm); MAKE_FUNCPTR(mpz_sub_ui); #endif + +#if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) +static BOOL gcrypt_available; +static void *libgcrypt_handle; + +MAKE_FUNCPTR(gcry_check_version); +MAKE_FUNCPTR(gcry_sexp_build); +MAKE_FUNCPTR(gcry_pk_encrypt); +MAKE_FUNCPTR(gcry_mpi_new); +MAKE_FUNCPTR(gcry_mpi_print); +MAKE_FUNCPTR(gcry_sexp_release); +MAKE_FUNCPTR(gcry_mpi_release); +MAKE_FUNCPTR(gcry_strsource); +MAKE_FUNCPTR(gcry_strerror); +MAKE_FUNCPTR(gcry_sexp_find_token); +MAKE_FUNCPTR(gcry_sexp_nth_mpi); +#endif + #undef MAKE_FUNCPTR static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size) @@ -496,6 +524,36 @@ static NTSTATUS gnutls_process_attach( void *args ) #undef LOAD_FUNCPTR_STR #endif +#if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) +#define LOAD_FUNCPTR(f) \ + if (!(p##f = dlsym( libgcrypt_handle, #f ))) \ + { \ + WARN( "failed to load %s\n", #f ); \ + gcrypt_available = FALSE; \ + } + + if ((libgcrypt_handle = dlopen( SONAME_LIBGCRYPT, RTLD_NOW ))) + { + gcrypt_available = TRUE; + + LOAD_FUNCPTR(gcry_check_version); + LOAD_FUNCPTR(gcry_sexp_build); + LOAD_FUNCPTR(gcry_pk_encrypt); + LOAD_FUNCPTR(gcry_mpi_new); + LOAD_FUNCPTR(gcry_mpi_print); + LOAD_FUNCPTR(gcry_sexp_release); + LOAD_FUNCPTR(gcry_mpi_release); + LOAD_FUNCPTR(gcry_strsource); + LOAD_FUNCPTR(gcry_strerror); + LOAD_FUNCPTR(gcry_sexp_find_token); + LOAD_FUNCPTR(gcry_sexp_nth_mpi); + } + else + WARN("failed to load gcrypt, no support for ECC secret agreement\n"); + +#undef LOAD_FUNCPTR +#endif + #define LOAD_FUNCPTR_OPT(f) \ if (!(p##f = dlsym( libgnutls_handle, #f ))) \ { \ @@ -568,6 +626,12 @@ static NTSTATUS gnutls_process_attach( void *args ) ERR_(winediag)("Compiled without DH support.\n"); #endif + if (!(pgnutls_ecdh_compute_key = dlsym( libgnutls_handle, "_gnutls_ecdh_compute_key" )) + && !(pgnutls_ecdh_compute_key = dlsym( libgnutls_handle, "gnutls_ecdh_compute_key" ))) + { + WARN("gnutls_ecdh_compute_key not found\n"); + } + if (TRACE_ON( bcrypt )) { pgnutls_global_set_log_level( 4 ); @@ -604,6 +668,11 @@ static NTSTATUS gnutls_process_detach( void *args ) dlclose( libgmp_handle ); libgmp_handle = NULL; #endif + +#if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) + dlclose( libgcrypt_handle ); + libgcrypt_handle = NULL; +#endif } struct buffer @@ -2711,6 +2780,60 @@ static NTSTATUS key_asymmetric_encrypt( void *args ) return status; } +#if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) +static NTSTATUS gcrypt_extract_result_into_secret(gcry_sexp_t result, gnutls_datum_t *s) +{ + NTSTATUS status = STATUS_SUCCESS; + gcry_mpi_t fullcoords = NULL; + gcry_sexp_t fragment = NULL; + UCHAR *tmp_buffer = NULL; + gcry_error_t err; + size_t size; + + fragment = pgcry_sexp_find_token( result, "s", 0 ); + if (!fragment) + { + status = STATUS_NO_MEMORY; + goto done; + } + + fullcoords = pgcry_sexp_nth_mpi( fragment, 1, GCRYMPI_FMT_USG ); + if (!fullcoords) + { + status = STATUS_NO_MEMORY; + goto done; + } + + if ((err = pgcry_mpi_print( GCRYMPI_FMT_USG, NULL, 0, &size, fullcoords)) ) + { + ERR("Error = %s/%s.\n", pgcry_strsource( err ), pgcry_strerror( err )); + status = STATUS_INTERNAL_ERROR; + goto done; + } + + tmp_buffer = malloc(size); + if ((err = pgcry_mpi_print( GCRYMPI_FMT_STD, tmp_buffer, size, NULL, fullcoords)) ) + { + ERR( "Error = %s/%s.\n", pgcry_strsource(err), pgcry_strerror(err) ); + status = STATUS_INTERNAL_ERROR; + goto done; + } + + s->size = size / 2; + s->data = malloc( s->size ); + memcpy( s->data, tmp_buffer + size % 2, size / 2 ); + +done: + free( tmp_buffer ); + + pgcry_mpi_release( fullcoords ); + pgcry_sexp_release( fragment ); + + return status; +} +#endif + + static NTSTATUS key_asymmetric_derive_key( void *args ) { const struct key_asymmetric_derive_key_params *params = args; @@ -2785,6 +2908,113 @@ static NTSTATUS key_asymmetric_derive_key( void *args ) return STATUS_NOT_IMPLEMENTED; #endif + case ALG_ID_ECDH_P256: + case ALG_ID_ECDH_P384: +/* this is necessary since GNUTLS doesn't support ECDH public key encryption, maybe we can replace this when it does: + https://github.com/gnutls/gnutls/blob/cdc4fc288d87f91f974aa23b6e8595a53970ce00/lib/nettle/pk.c#L495 */ +#if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) + { + gcry_sexp_t xchg_result = NULL; + gcry_sexp_t privkey = NULL; + gcry_sexp_t pubkey = NULL; + const char *pubkey_format; + BCRYPT_ECCKEY_BLOB *h; + UCHAR *privkey_blob; + UCHAR *pubkey_raw; + gcry_error_t err; + ULONG key_length; + NTSTATUS status; + ULONG key_len; + + if (!gcrypt_available) + { + ERR("ECDH secret agreement is not available.\n"); + return STATUS_NOT_IMPLEMENTED; + } + + if (priv_key->alg_id == ALG_ID_ECDH_P256) + { + pubkey_format = "NIST P-256"; + key_length = 32; + } + else if (priv_key->alg_id == ALG_ID_ECDH_P384) + { + pubkey_format = "NIST P-384"; + key_length = 48; + } + else return STATUS_NOT_IMPLEMENTED; + + if (key_length != priv_key->u.a.bitlen / 8) + { + ERR( "Key length mismatch, key->u.a.bitlen %u, key_length %u.\n", (int)priv_key->u.a.bitlen, + (int)key_length ); + return STATUS_INVALID_PARAMETER; + } + + if ((status = key_export_ecc( priv_key, NULL, 0, &key_len ))) + return status; + privkey_blob = malloc( key_len ); + if ((status = key_export_ecc( priv_key, privkey_blob, key_len, &key_len ))) + { + free( privkey_blob ); + return status; + } + + if ((status = key_export_ecc_public( peer_key, NULL, 0, &key_len ))) + return status; + h = malloc( key_len ); + if ((status = key_export_ecc_public( peer_key, (UCHAR *)h, key_len, &key_len ))) + { + free( privkey_blob ); + return status; + } + + /* copy public key into temporary buffer so we can prepend 0x04 (to indicate it is uncompressed) */ + pubkey_raw = malloc( (key_length * 2) + 1 ); + pubkey_raw[0] = 0x04; + memcpy( pubkey_raw + 1, h + 1, key_length * 2 ); + free( h ); + + err = pgcry_sexp_build( &pubkey, NULL, "(key-data(public-key(ecdh(curve %s)(q %b))))", pubkey_format, + (key_length * 2) + 1, pubkey_raw ); + free( pubkey_raw ); + if (err) + { + free( privkey_blob ); + ERR( "Failed to build gcrypt public key. err %s/%s\n", pgcry_strsource( err ), pgcry_strerror( err )); + return STATUS_INTERNAL_ERROR; + } + + err = pgcry_sexp_build( &privkey, NULL, "(data(flags raw)(value %b))", key_length, + privkey_blob + sizeof(BCRYPT_ECCKEY_BLOB) + key_length * 2 ); + free( privkey_blob ); + if (err) + { + pgcry_sexp_release( pubkey ); + return STATUS_INTERNAL_ERROR; + } + err = pgcry_pk_encrypt( &xchg_result, privkey, pubkey ); + pgcry_sexp_release( privkey ); + pgcry_sexp_release( pubkey ); + if (err) + { + ERR( "Failed to perform key exchange. err %s/%s\n", pgcry_strsource( err ), pgcry_strerror( err )); + return STATUS_INTERNAL_ERROR; + } + status = gcrypt_extract_result_into_secret( xchg_result, &s ); + pgcry_sexp_release(xchg_result); + if (status) + { + ERR("Failed to extract secret key.\n"); + return status; + } + break; + } +#else + WARN("Compiled without ECC secret support.\n"); + return STATUS_NOT_IMPLEMENTED; +#endif + default: ERR( "unhandled algorithm %u\n", priv_key->alg_id ); return STATUS_INVALID_HANDLE; diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 0601335dd1e..e7d9e25421d 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -3057,10 +3057,13 @@ static void test_ECDH(void) win_skip("BCRYPT_KDF_RAW_SECRET not supported\n"); goto raw_secret_end; } - todo_wine ok(status == STATUS_SUCCESS, "got %#lx\n", status); - if (status != STATUS_SUCCESS) goto raw_secret_end; + ok(status == STATUS_SUCCESS, "got %#lx\n", status); ok(size == 32, "size of secret key incorrect, got %lu, expected 32\n", size); + if (!size) + goto raw_secret_end; + + buf = malloc(size); status = BCryptDeriveKey(secret, BCRYPT_KDF_RAW_SECRET, NULL, buf, size, &size, 0); ok(status == STATUS_SUCCESS, "got %#lx\n", status); @@ -3069,7 +3072,7 @@ static void test_ECDH(void) raw_secret_end: status = BCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0); - todo_wine ok (status == STATUS_SUCCESS, "got %#lx\n", status); + ok (status == STATUS_SUCCESS, "got %#lx\n", status); if (status != STATUS_SUCCESS) goto derive_end; ok (size == 20, "got %lu\n", size); @@ -3869,7 +3872,6 @@ static void test_SecretAgreement(void) ok(status == STATUS_INVALID_PARAMETER, "got %#lx\n", status); status = BCryptDeriveKey(secret, L"HASH", NULL, NULL, 0, &size, 0); - todo_wine ok(status == STATUS_SUCCESS, "got %#lx\n", status); status = BCryptDestroyHash(secret); From 9a3a66b46f751699275f956165a34984a3b096a1 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 1 Oct 2021 14:34:58 +0200 Subject: [PATCH 0673/1506] bcrypt: Add support for none and OAEP-padded asymmetric key encryption. (updated by Paul Gofman) For DayZ. CW-Bug-Id: #18973 --- dlls/bcrypt/bcrypt_internal.h | 2 + dlls/bcrypt/bcrypt_main.c | 9 +- dlls/bcrypt/gnutls.c | 168 ++++++++++++++++++++++++++++++++++ dlls/bcrypt/tests/bcrypt.c | 14 ++- 4 files changed, 179 insertions(+), 14 deletions(-) diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h index 94117370f0a..a350bffe7d0 100644 --- a/dlls/bcrypt/bcrypt_internal.h +++ b/dlls/bcrypt/bcrypt_internal.h @@ -254,6 +254,8 @@ struct key_asymmetric_encrypt_params UCHAR *output; ULONG output_len; ULONG *ret_len; + void *padding; + ULONG flags; }; struct key_asymmetric_duplicate_params diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 46ecec06473..bfe26a26931 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -732,7 +732,7 @@ static NTSTATUS get_rsa_property( enum chain_mode mode, const WCHAR *prop, UCHAR { *ret_size = sizeof(ULONG); if (size < sizeof(ULONG)) return STATUS_BUFFER_TOO_SMALL; - if (buf) *(ULONG *)buf = BCRYPT_SUPPORTED_PAD_PKCS1_SIG; + if (buf) *(ULONG *)buf = BCRYPT_SUPPORTED_PAD_PKCS1_SIG | BCRYPT_SUPPORTED_PAD_OAEP; return STATUS_SUCCESS; } @@ -2267,11 +2267,6 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp } else { - if (flags & BCRYPT_PAD_NONE || flags & BCRYPT_PAD_OAEP) - { - FIXME( "flags %#lx not implemented\n", flags ); - return STATUS_NOT_IMPLEMENTED; - } if (!is_asymmetric_encryption_key( key )) return STATUS_NOT_SUPPORTED; asymmetric_params.input = input; @@ -2280,6 +2275,8 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp asymmetric_params.output = output; asymmetric_params.output_len = output_len; asymmetric_params.ret_len = ret_len; + asymmetric_params.padding = padding; + asymmetric_params.flags = flags; ret = UNIX_CALL(key_asymmetric_encrypt, &asymmetric_params); } diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 7838c3b927c..a782cec588c 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -268,6 +268,7 @@ MAKE_FUNCPTR(gcry_strsource); MAKE_FUNCPTR(gcry_strerror); MAKE_FUNCPTR(gcry_sexp_find_token); MAKE_FUNCPTR(gcry_sexp_nth_mpi); +MAKE_FUNCPTR(gcry_sexp_nth_data); #endif #undef MAKE_FUNCPTR @@ -547,6 +548,7 @@ static NTSTATUS gnutls_process_attach( void *args ) LOAD_FUNCPTR(gcry_strerror); LOAD_FUNCPTR(gcry_sexp_find_token); LOAD_FUNCPTR(gcry_sexp_nth_mpi); + LOAD_FUNCPTR(gcry_sexp_nth_data); } else WARN("failed to load gcrypt, no support for ECC secret agreement\n"); @@ -2754,6 +2756,169 @@ static NTSTATUS key_asymmetric_decrypt( void *args ) return status; } +#if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) +const char * gcrypt_hash_algorithm_name(LPCWSTR alg_id) +{ + if (!wcscmp( alg_id, BCRYPT_SHA1_ALGORITHM )) return "sha1"; + if (!wcscmp( alg_id, BCRYPT_SHA256_ALGORITHM )) return "sha256"; + if (!wcscmp( alg_id, BCRYPT_SHA384_ALGORITHM )) return "sha384"; + if (!wcscmp( alg_id, BCRYPT_SHA512_ALGORITHM )) return "sha512"; + if (!wcscmp( alg_id, BCRYPT_MD2_ALGORITHM )) return "md2"; + if (!wcscmp( alg_id, BCRYPT_MD5_ALGORITHM )) return "md5"; + return NULL; +} + +static NTSTATUS key_asymmetric_encrypt_gcrypt( void *args ) +{ + const struct key_asymmetric_encrypt_params *params = args; + struct key *key = params->key; + UCHAR *input = params->input; + ULONG input_len = params->input_len; + UCHAR *output = params->output; + ULONG *ret_len = params->ret_len; + void *padding = params->padding; + ULONG flags = params->flags; + BCRYPT_OAEP_PADDING_INFO *oaep_info = padding; + NTSTATUS status; + gcry_sexp_t sexp_pubkey = NULL; + gcry_sexp_t sexp_result = NULL; + gcry_sexp_t sexp_input = NULL; + BCRYPT_RSAKEY_BLOB *rsa_blob; + gcry_sexp_t mpi_a = NULL; + gnutls_datum_t result; + size_t result_len; + gcry_error_t err; + ULONG len; + + if (!gcrypt_available) + { + ERR("Asymmetric encryption not available.\n"); + return STATUS_INTERNAL_ERROR; + } + + if (key->alg_id != ALG_ID_RSA) + { + FIXME("Unsupported algorithm id: %u\n", key->alg_id); + return STATUS_INTERNAL_ERROR; + } + + if (flags == BCRYPT_PAD_NONE && input_len != key->u.a.bitlen / 8) + { + WARN( "Invalid input_len %u for BCRYPT_PAD_NONE.\n", (int)input_len ); + return STATUS_INVALID_PARAMETER; + } + + /* import RSA key */ + if ((status = key_export_rsa_public( key, NULL, 0, &len ))) + { + ERR( "Key export failed.\n" ); + return status; + } + rsa_blob = malloc( len ); + if ((status = key_export_rsa_public( key, (UCHAR *)rsa_blob, len, &len ))) + { + ERR( "Key export failed.\n" ); + return status; + } + err = pgcry_sexp_build(&sexp_pubkey, NULL, + "(public-key(rsa (e %b)(n %b)))", + rsa_blob->cbPublicExp, + (UCHAR *)(rsa_blob + 1), + rsa_blob->cbModulus, + (UCHAR *)(rsa_blob + 1) + rsa_blob->cbPublicExp); + free( rsa_blob ); + if (err) + { + ERR("Failed to build gcrypt public key\n"); + goto done; + } + + /* import input data with necessary padding */ + if (flags == BCRYPT_PAD_PKCS1) + { + err = pgcry_sexp_build(&sexp_input, NULL, + "(data(flags pkcs1)(value %b))", + input_len, + input); + } + else if (flags == BCRYPT_PAD_OAEP) + { + if (oaep_info->pbLabel) + err = pgcry_sexp_build(&sexp_input, NULL, + "(data(flags oaep)(hash-algo %s)(label %b)(value %b))", + gcrypt_hash_algorithm_name(oaep_info->pszAlgId), + oaep_info->cbLabel, + oaep_info->pbLabel, + input_len, + input); + else + err = pgcry_sexp_build(&sexp_input, NULL, + "(data(flags oaep)(hash-algo %s)(value %b))", + gcrypt_hash_algorithm_name(oaep_info->pszAlgId), + input_len, + input); + } + else if (flags == BCRYPT_PAD_NONE) + { + err = pgcry_sexp_build(&sexp_input, NULL, + "(data(flags raw)(value %b))", + input_len, + input); + } + else + { + status = STATUS_INVALID_PARAMETER; + goto done; + } + + if (err) + { + ERR("Failed to build gcrypt padded input data\n"); + goto done; + } + + if ((err = pgcry_pk_encrypt(&sexp_result, sexp_input, sexp_pubkey))) + { + ERR("Failed to encrypt data\n"); + goto done; + } + + mpi_a = pgcry_sexp_find_token(sexp_result, "a", 0); + result.data = (void *)pgcry_sexp_nth_data(mpi_a, 1, &result_len); + + result.size = result_len; + result_len = EXPORT_SIZE(result, key->u.a.bitlen / 8, 1); + *ret_len = result_len; + + if (params->output_len >= result_len) export_gnutls_datum(output, params->output_len, &result, 1); + else if (params->output_len == 0) status = STATUS_SUCCESS; + else status = STATUS_BUFFER_TOO_SMALL; + +done: + pgcry_sexp_release(sexp_input); + pgcry_sexp_release(sexp_pubkey); + pgcry_sexp_release(sexp_result); + pgcry_sexp_release(mpi_a); + + if (status) + return status; + + if (err) + { + ERR("Error = %s/%s\n", pgcry_strsource (err), pgcry_strerror (err)); + return STATUS_INTERNAL_ERROR; + } + + return STATUS_SUCCESS; +} +#else +static NTSTATUS key_asymmetric_encrypt_gcrypt( void *args ) +{ + ERR("Asymmetric key encryption not supported without gcrypt.\n"); + return STATUS_NOT_IMPLEMENTED; +} +#endif + static NTSTATUS key_asymmetric_encrypt( void *args ) { const struct key_asymmetric_encrypt_params *params = args; @@ -2763,6 +2928,9 @@ static NTSTATUS key_asymmetric_encrypt( void *args ) if (!key_data(params->key)->a.pubkey) return STATUS_INVALID_HANDLE; + if (params->flags == BCRYPT_PAD_NONE || params->flags == BCRYPT_PAD_OAEP) + return key_asymmetric_encrypt_gcrypt( args ); + d.data = params->input; d.size = params->input_len; if ((ret = pgnutls_pubkey_encrypt_data(key_data(params->key)->a.pubkey, 0, &d, &e))) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index e7d9e25421d..72e7dcd9f28 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -2478,7 +2478,6 @@ static void test_rsa_encrypt(void) ret = BCryptImportKeyPair(rsa, NULL, BCRYPT_RSAPRIVATE_BLOB, &key, rsaPrivateBlob, sizeof(rsaPrivateBlob), 0); ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); - todo_wine { /* No padding */ memset(input_no_padding, 0, sizeof(input_no_padding)); strcpy((char *)input_no_padding, "Hello World"); @@ -2504,11 +2503,11 @@ static void test_rsa_encrypt(void) ok(!memcmp(encrypted_a, encrypted_b, encrypted_size), "Both outputs should be the same\n"); ok(!memcmp(encrypted_b, rsa_encrypted_no_padding, encrypted_size), "Data mismatch.\n"); + decrypted_size = 0xdeadbeef; BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_NONE); - ok(decrypted_size == sizeof(input_no_padding), "got %lu\n", decrypted_size); + todo_wine ok(decrypted_size == sizeof(input_no_padding), "got %lu\n", decrypted_size); BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_NONE); - ok(!memcmp(decrypted, input_no_padding, sizeof(input_no_padding)), "Decrypted output it's not what expected\n"); - } + todo_wine ok(!memcmp(decrypted, input_no_padding, sizeof(input_no_padding)), "Decrypted output it's not what expected\n"); encrypted_size = 60; /* PKCS1 Padding */ @@ -2532,7 +2531,6 @@ static void test_rsa_encrypt(void) BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_PKCS1); ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n"); - todo_wine { encrypted_size = 60; /* OAEP Padding */ ret = BCryptEncrypt(key, input, sizeof(input), &oaep_pad, NULL, 0, NULL, 0, &encrypted_size, BCRYPT_PAD_OAEP); @@ -2553,10 +2551,10 @@ static void test_rsa_encrypt(void) decrypted_size = 0; memset(decrypted, 0, sizeof(decrypted)); BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_OAEP); - ok(decrypted_size == sizeof(input), "got %lu\n", decrypted_size); + todo_wine ok(decrypted_size == sizeof(input), "got %lu\n", decrypted_size); BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_OAEP); - ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n"); - } + todo_wine ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n"); + free(encrypted_a); free(encrypted_b); From 630b04426df120a25b89a5eef788d44da78628b7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Dec 2023 21:08:37 -0600 Subject: [PATCH 0674/1506] bcrypt: Add support for none and OAEP padded asymmetric key decryption. CW-Bug-Id: #18973 --- dlls/bcrypt/bcrypt_internal.h | 2 + dlls/bcrypt/bcrypt_main.c | 7 +- dlls/bcrypt/gnutls.c | 146 ++++++++++++++++++++++++++++++++++ dlls/bcrypt/tests/bcrypt.c | 14 ++-- 4 files changed, 158 insertions(+), 11 deletions(-) diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h index a350bffe7d0..e9b651db036 100644 --- a/dlls/bcrypt/bcrypt_internal.h +++ b/dlls/bcrypt/bcrypt_internal.h @@ -244,6 +244,8 @@ struct key_asymmetric_decrypt_params UCHAR *output; ULONG output_len; ULONG *ret_len; + void *padding; + ULONG flags; }; struct key_asymmetric_encrypt_params diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index bfe26a26931..7217e96ab32 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -2309,11 +2309,6 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp } else { - if (flags & BCRYPT_PAD_NONE || flags & BCRYPT_PAD_OAEP) - { - FIXME( "flags %#lx not implemented\n", flags ); - return STATUS_NOT_IMPLEMENTED; - } if (!is_asymmetric_encryption_key( key )) return STATUS_NOT_SUPPORTED; params.key = key; @@ -2322,6 +2317,8 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp params.output = output; params.output_len = output_len; params.ret_len = ret_len; + params.padding = padding; + params.flags = flags; ret = UNIX_CALL(key_asymmetric_decrypt, ¶ms); } diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index a782cec588c..4abe0c354ed 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -257,9 +257,11 @@ MAKE_FUNCPTR(mpz_sub_ui); static BOOL gcrypt_available; static void *libgcrypt_handle; +MAKE_FUNCPTR(gcry_control); MAKE_FUNCPTR(gcry_check_version); MAKE_FUNCPTR(gcry_sexp_build); MAKE_FUNCPTR(gcry_pk_encrypt); +MAKE_FUNCPTR(gcry_pk_decrypt); MAKE_FUNCPTR(gcry_mpi_new); MAKE_FUNCPTR(gcry_mpi_print); MAKE_FUNCPTR(gcry_sexp_release); @@ -537,9 +539,11 @@ static NTSTATUS gnutls_process_attach( void *args ) { gcrypt_available = TRUE; + LOAD_FUNCPTR(gcry_control); LOAD_FUNCPTR(gcry_check_version); LOAD_FUNCPTR(gcry_sexp_build); LOAD_FUNCPTR(gcry_pk_encrypt); + LOAD_FUNCPTR(gcry_pk_decrypt); LOAD_FUNCPTR(gcry_mpi_new); LOAD_FUNCPTR(gcry_mpi_print); LOAD_FUNCPTR(gcry_sexp_release); @@ -549,6 +553,12 @@ static NTSTATUS gnutls_process_attach( void *args ) LOAD_FUNCPTR(gcry_sexp_find_token); LOAD_FUNCPTR(gcry_sexp_nth_mpi); LOAD_FUNCPTR(gcry_sexp_nth_data); + + if (0) + { + pgcry_control(GCRYCTL_SET_VERBOSITY, 9); + pgcry_control(GCRYCTL_SET_DEBUG_FLAGS, ~0u); + } } else WARN("failed to load gcrypt, no support for ECC secret agreement\n"); @@ -2733,6 +2743,8 @@ static NTSTATUS key_asymmetric_duplicate( void *args ) return STATUS_SUCCESS; } +static NTSTATUS key_asymmetric_decrypt_gcrypt( void *args ); + static NTSTATUS key_asymmetric_decrypt( void *args ) { const struct key_asymmetric_decrypt_params *params = args; @@ -2740,6 +2752,9 @@ static NTSTATUS key_asymmetric_decrypt( void *args ) NTSTATUS status = STATUS_SUCCESS; int ret; + if (params->flags == BCRYPT_PAD_NONE || params->flags == BCRYPT_PAD_OAEP) + return key_asymmetric_decrypt_gcrypt( args ); + e.data = params->input; e.size = params->input_len; if ((ret = pgnutls_privkey_decrypt_data( key_data(params->key)->a.privkey, 0, &e, &d ))) @@ -2911,12 +2926,143 @@ static NTSTATUS key_asymmetric_encrypt_gcrypt( void *args ) return STATUS_SUCCESS; } + +static NTSTATUS key_asymmetric_decrypt_gcrypt( void *args ) +{ + const struct key_asymmetric_encrypt_params *params = args; + gnutls_datum_t m, e, d, p, q, u, e1, e2; + struct key *key = params->key; + UCHAR *input = params->input; + ULONG input_len = params->input_len; + UCHAR *output = params->output; + ULONG *ret_len = params->ret_len; + void *padding = params->padding; + ULONG flags = params->flags; + BCRYPT_OAEP_PADDING_INFO *oaep_info = padding; + NTSTATUS status; + gcry_sexp_t sexp_privkey = NULL; + gcry_sexp_t sexp_result = NULL; + gcry_sexp_t sexp_input = NULL; + gnutls_datum_t result; + size_t result_len; + gcry_error_t err; + int ret; + + if (!gcrypt_available) + { + ERR( "Asymmetric decryption not available.\n" ); + return STATUS_INTERNAL_ERROR; + } + + if (key->alg_id != ALG_ID_RSA) + { + FIXME( "Unsupported algorithm id: %u\n", key->alg_id ); + return STATUS_INTERNAL_ERROR; + } + + if ((ret = pgnutls_privkey_export_rsa_raw( key_data(key)->a.privkey, &m, &e, &d, &p, &q, &u, &e1, &e2 ))) + { + pgnutls_perror( ret ); + return STATUS_INTERNAL_ERROR; + } + err = pgcry_sexp_build(&sexp_privkey, NULL, + "(private-key(rsa (e %b)(n %b)(d %b)))", + e.size, e.data, + m.size, m.data, + d.size, d.data); + free( m.data ); free( e.data ); free( d.data ); free( p.data ); free( q.data ); free( u.data ); + free( e1.data ); free( e2.data ); + + if (err) + { + ERR( "Failed to build gcrypt private key\n" ); + status = STATUS_INVALID_PARAMETER; + goto done; + } + + if (flags == BCRYPT_PAD_PKCS1) err = pgcry_sexp_build( &sexp_input, NULL, "(enc-val (flags pkcs1)(rsa (a %b)))", input_len, input ); + else if (flags == BCRYPT_PAD_OAEP) + { + if (oaep_info->pbLabel) + err = pgcry_sexp_build( &sexp_input, NULL, + "(enc-val (flags oaep)(hash-algo %s)(label %b)(rsa (a %b)))", + gcrypt_hash_algorithm_name(oaep_info->pszAlgId), + oaep_info->cbLabel, + oaep_info->pbLabel, + input_len, + input ); + else + err = pgcry_sexp_build( &sexp_input, NULL, + "(enc-val (flags oaep)(hash-algo %s)(rsa (a %b)))", + gcrypt_hash_algorithm_name(oaep_info->pszAlgId), + input_len, + input ); + } + else if (flags == BCRYPT_PAD_NONE) err = pgcry_sexp_build( &sexp_input, NULL, "(enc-val (flags raw)(rsa (a %b)))", input_len, input ); + else + { + status = STATUS_INVALID_PARAMETER; + goto done; + } + + if (err) + { + ERR( "Failed to build gcrypt padded input data\n" ); + status = STATUS_INVALID_PARAMETER; + goto done; + } + + if ((err = pgcry_pk_decrypt( &sexp_result, sexp_input, sexp_privkey ))) + { + ERR( "Failed to decrypt data\n" ); + status = STATUS_INVALID_PARAMETER; + goto done; + } + + result.data = (void *)pgcry_sexp_nth_data(sexp_result, 1, &result_len); + result.size = result_len; + if (flags == BCRYPT_PAD_NONE) result_len = EXPORT_SIZE(result, key->u.a.bitlen / 8, 1); + *ret_len = result_len; + + if (params->output_len >= result_len) + { + status = STATUS_SUCCESS; + if (flags == BCRYPT_PAD_NONE) + export_gnutls_datum(output, params->output_len, &result, 1); + else + memcpy(output, result.data, result_len); + } + else if (params->output_len == 0) status = STATUS_SUCCESS; + else status = STATUS_BUFFER_TOO_SMALL; + +done: + pgcry_sexp_release(sexp_input); + pgcry_sexp_release(sexp_privkey); + pgcry_sexp_release(sexp_result); + + if (status) return status; + + if (err) + { + ERR( "Error %s/%s\n", pgcry_strsource (err), pgcry_strerror (err) ); + return STATUS_INTERNAL_ERROR; + } + + return STATUS_SUCCESS; +} + #else static NTSTATUS key_asymmetric_encrypt_gcrypt( void *args ) { ERR("Asymmetric key encryption not supported without gcrypt.\n"); return STATUS_NOT_IMPLEMENTED; } + +static NTSTATUS key_asymmetric_decrypt_gcrypt( void *args ) +{ + ERR("Asymmetric key encryption not supported without gcrypt.\n"); + return STATUS_NOT_IMPLEMENTED; +} #endif static NTSTATUS key_asymmetric_encrypt( void *args ) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 72e7dcd9f28..04b85be7b5e 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -2505,9 +2505,9 @@ static void test_rsa_encrypt(void) decrypted_size = 0xdeadbeef; BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_NONE); - todo_wine ok(decrypted_size == sizeof(input_no_padding), "got %lu\n", decrypted_size); + ok(decrypted_size == sizeof(input_no_padding), "got %lu\n", decrypted_size); BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_NONE); - todo_wine ok(!memcmp(decrypted, input_no_padding, sizeof(input_no_padding)), "Decrypted output it's not what expected\n"); + ok(!memcmp(decrypted, input_no_padding, sizeof(input_no_padding)), "Decrypted output it's not what expected\n"); encrypted_size = 60; /* PKCS1 Padding */ @@ -2550,10 +2550,12 @@ static void test_rsa_encrypt(void) decrypted_size = 0; memset(decrypted, 0, sizeof(decrypted)); - BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_OAEP); - todo_wine ok(decrypted_size == sizeof(input), "got %lu\n", decrypted_size); - BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_OAEP); - todo_wine ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n"); + ret = BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_OAEP); + ok(ret == STATUS_SUCCESS, "got %lx\n", ret); + ok(decrypted_size == sizeof(input), "got %lu\n", decrypted_size); + ret = BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_OAEP); + ok(ret == STATUS_SUCCESS, "got %lx\n", ret); + ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n"); free(encrypted_a); From 6332e600f6717e7406710a9d19571a4e1f8b29fc Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Fri, 25 Aug 2023 09:34:45 +0200 Subject: [PATCH 0675/1506] dbghelp: Protect ELF's link_map walking in case of bogus entries. That's not fixing the cause of the bug below, but protects it from hanging while walking the bogus list. CW-Bug-Id: #22658 --- dlls/dbghelp/elf_module.c | 86 +++++++++++++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 16 deletions(-) diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index 00e69d290e2..372dbf72a75 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -1464,6 +1464,59 @@ static BOOL elf_search_and_load_file(struct process* pcs, const WCHAR* filename, typedef BOOL (*enum_elf_modules_cb)(const WCHAR*, ULONG_PTR load_addr, ULONG_PTR dyn_addr, BOOL is_system, void* user); +static BOOL elf_linkmap_validate_entry(const struct process* pcs, DWORD64 base, DWORD64 name_addr, WCHAR* buffer, SIZE_T buflen) +{ + static DWORD page_size; + MEMORY_BASIC_INFORMATION mem_info; + char bufstr[MAX_PATH]; + + if (!page_size) + { + SYSTEM_INFO sys_info; + GetSystemInfo(&sys_info); + page_size = sys_info.dwPageSize; + } + if (base & (page_size - 1)) + { + WARN("Unaligned base addr=%I64x page_size=%lx\n", base, page_size); + return FALSE; + } + if (VirtualQueryEx(pcs->handle, (void*)(ULONG_PTR)base, &mem_info, sizeof(mem_info))) + { + if (mem_info.BaseAddress != (void*)(ULONG_PTR)base) + { + WARN("Invalid base addr %I64x (beg map at %p)\n", base, mem_info.BaseAddress); + return FALSE; + } + } + else + { + /* Some ELF modules are loaded in 32bit mode above 2G limit, + * and virtual query will fail on these addresses when process is not large address aware. + * Don't consider this as an error for a 32bit debuggee. + */ + if (pcs->is_64bit) + { + WARN("Invalid base addr %I64x\n", base); + return FALSE; + } + } + + memset(bufstr, ' ', sizeof(bufstr)); + if (!read_process_memory(pcs, name_addr, bufstr, sizeof(bufstr))) + { + WARN("Invalid name_address %I64x\n", name_addr); + return FALSE; + } + if (!memchr(bufstr, '\0', sizeof(bufstr))) + { + WARN("Unterminated string %s\n", wine_dbgstr_an(bufstr, sizeof(bufstr))); + return FALSE; + } + MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, buffer, buflen); + return TRUE; +} + /****************************************************************** * elf_enum_modules_internal * @@ -1473,8 +1526,7 @@ static BOOL elf_enum_modules_internal(const struct process* pcs, const WCHAR* main_name, enum_elf_modules_cb cb, void* user) { - WCHAR bufstrW[MAX_PATH]; - char bufstr[256]; + WCHAR bufstr[MAX_PATH]; ULONG_PTR lm_addr; if (pcs->is_host_64bit) @@ -1508,15 +1560,16 @@ static BOOL elf_enum_modules_internal(const struct process* pcs, if (!read_process_memory(pcs, lm_addr, &lm, sizeof(lm))) return FALSE; - if (lm.l_prev && /* skip first entry, normally debuggee itself */ - lm.l_name && read_process_memory(pcs, lm.l_name, bufstr, sizeof(bufstr))) + /* skip first entry(normally debuggee itself) and entries without names */ + if (!lm.l_prev || !lm.l_name) continue; + if (!elf_linkmap_validate_entry(pcs, lm.l_addr, lm.l_name, bufstr, ARRAY_SIZE(bufstr))) { - bufstr[sizeof(bufstr) - 1] = '\0'; - MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, ARRAY_SIZE(bufstrW)); - if (main_name && !bufstrW[0]) lstrcpyW(bufstrW, main_name); - if (!cb(bufstrW, (ULONG_PTR)lm.l_addr, (ULONG_PTR)lm.l_ld, FALSE, user)) - break; + FIXME("Incorrect link_map entry, bailing out\n"); + return FALSE; } + if (main_name && !bufstr[0]) lstrcpyW(bufstr, main_name); + if (!cb(bufstr, (ULONG_PTR)lm.l_addr, (ULONG_PTR)lm.l_ld, FALSE, user)) + break; } } else @@ -1550,15 +1603,16 @@ static BOOL elf_enum_modules_internal(const struct process* pcs, if (!read_process_memory(pcs, lm_addr, &lm, sizeof(lm))) return FALSE; - if (lm.l_prev && /* skip first entry, normally debuggee itself */ - lm.l_name && read_process_memory(pcs, lm.l_name, bufstr, sizeof(bufstr))) + /* skip first entry(normally debuggee itself) and entries without names */ + if (!lm.l_prev || !lm.l_name) continue; + if (!elf_linkmap_validate_entry(pcs, lm.l_addr, lm.l_name, bufstr, ARRAY_SIZE(bufstr))) { - bufstr[sizeof(bufstr) - 1] = '\0'; - MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, ARRAY_SIZE(bufstrW)); - if (main_name && !bufstrW[0]) lstrcpyW(bufstrW, main_name); - if (!cb(bufstrW, (ULONG_PTR)lm.l_addr, (ULONG_PTR)lm.l_ld, FALSE, user)) - break; + FIXME("Incorrect link_map entry, bailing out\n"); + return FALSE; } + if (main_name && !bufstr[0]) lstrcpyW(bufstr, main_name); + if (!cb(bufstr, (ULONG_PTR)lm.l_addr, (ULONG_PTR)lm.l_ld, FALSE, user)) + break; } } From 847d33708bdd77f569f57b6674cdd656b29d957f Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0676/1506] windows.media.speech: Adding a couple of synthesizer's options tests. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/tests/speech.c | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index ea1487d379c..ba1acb0aa62 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -1024,16 +1024,54 @@ static void test_SpeechSynthesizer(void) if (hr == S_OK) { + ISpeechSynthesizerOptions2 *options2; ISpeechSynthesizerOptions3 *options3; + boolean bool_value; + DOUBLE double_value; + enum SpeechAppendedSilence silence_value; + enum SpeechPunctuationSilence punctuation_value; check_interface(options, &IID_IAgileObject, TRUE); + bool_value = 0xff; + hr = ISpeechSynthesizerOptions_get_IncludeSentenceBoundaryMetadata(options, &bool_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(! bool_value, "Got unepected option %u\n", bool_value); + bool_value = 0xff; + hr = ISpeechSynthesizerOptions_get_IncludeWordBoundaryMetadata(options, &bool_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!bool_value, "Got unepected option %u\n", bool_value); + check_optional_interface(options, &IID_ISpeechSynthesizerOptions2, TRUE); /* Requires Win10 >= 1709 */ + hr = ISpeechSynthesizerOptions_QueryInterface(options, &IID_ISpeechSynthesizerOptions2, (void **)&options2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ISpeechSynthesizerOptions2_get_AudioPitch(options2, &double_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(double_value == 1.0f, "Got unepected option %f\n", double_value); + + hr = ISpeechSynthesizerOptions2_get_AudioVolume(options2, &double_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(double_value == 1.0f, "Got unepected option %f\n", double_value); + + hr = ISpeechSynthesizerOptions2_get_SpeakingRate(options2, &double_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(double_value == 1.0f, "Got unepected option %f\n", double_value); + + ISpeechSynthesizerOptions2_Release(options2); hr = ISpeechSynthesizerOptions_QueryInterface(options, &IID_ISpeechSynthesizerOptions3, (void **)&options3); ok(hr == S_OK || broken(hr == E_NOINTERFACE), "Got unexpected hr %#lx.\n", hr); /* Requires Win10 >= 1803 */ if (hr == S_OK) { + hr = ISpeechSynthesizerOptions3_get_AppendedSilence(options3, &silence_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(silence_value == SpeechAppendedSilence_Default, "Got unepected option %u\n", silence_value); + + hr = ISpeechSynthesizerOptions3_get_PunctuationSilence(options3, &punctuation_value); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(punctuation_value == SpeechPunctuationSilence_Default, "Got unepected option %u\n", punctuation_value); + ref = ISpeechSynthesizerOptions3_Release(options3); ok(ref == 2, "Got unexpected ref %lu.\n", ref); } From 69274abc05655d99e16f92ab50fe933cfad07a52 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0677/1506] windows.media.speech: Add basic implementation on synthesizer options. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/synthesizer.c | 326 ++++++++++++++++++++++- dlls/windows.media.speech/tests/speech.c | 2 +- 2 files changed, 325 insertions(+), 3 deletions(-) diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index 39d14b84ab7..95dfe3150bb 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -280,6 +280,309 @@ static HRESULT synthesis_stream_create( ISpeechSynthesisStream **out ) return hr; } +/* + * + * SpeechSynthesizerOptions runtimeclass + * + */ +struct synthesizer_options +{ + ISpeechSynthesizerOptions ISpeechSynthesizerOptions_iface; + ISpeechSynthesizerOptions2 ISpeechSynthesizerOptions2_iface; + ISpeechSynthesizerOptions3 ISpeechSynthesizerOptions3_iface; + LONG ref; + + /* options */ + boolean include_word_boundary; + boolean include_sentence_boundary; + + /* options 2 */ + double audio_volume; + double speaking_rate; + double audio_pitch; + + /* options 3 */ + enum SpeechAppendedSilence appended_silence; + enum SpeechPunctuationSilence punctuation_silence; +}; + +static inline struct synthesizer_options *impl_from_ISpeechSynthesizerOptions( ISpeechSynthesizerOptions *iface ) +{ + return CONTAINING_RECORD(iface, struct synthesizer_options, ISpeechSynthesizerOptions_iface); +} + +static HRESULT WINAPI synthesizer_options_QueryInterface( ISpeechSynthesizerOptions *iface, REFIID iid, void **out) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_ISpeechSynthesizerOptions)) + { + IInspectable_AddRef((*out = &impl->ISpeechSynthesizerOptions_iface)); + return S_OK; + } + + if (IsEqualGUID(iid, &IID_ISpeechSynthesizerOptions2)) + { + IInspectable_AddRef((*out = &impl->ISpeechSynthesizerOptions2_iface)); + return S_OK; + } + + if (IsEqualGUID(iid, &IID_ISpeechSynthesizerOptions3)) + { + IInspectable_AddRef((*out = &impl->ISpeechSynthesizerOptions3_iface)); + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI synthesizer_options_AddRef( ISpeechSynthesizerOptions *iface ) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI synthesizer_options_Release( ISpeechSynthesizerOptions *iface ) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + + TRACE("iface %p, ref %lu.\n", iface, ref); + if (ref == 0) + free(impl); + return ref; +} + +static HRESULT WINAPI synthesizer_options_GetIids( ISpeechSynthesizerOptions *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub.\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesizer_options_GetRuntimeClassName( ISpeechSynthesizerOptions *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub.\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesizer_options_GetTrustLevel( ISpeechSynthesizerOptions *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub.\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI synthesizer_options_get_IncludeWordBoundaryMetadata( ISpeechSynthesizerOptions *iface, boolean *value ) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + TRACE("iface %p, value %p semi-stub.\n", iface, value); + + *value = impl->include_word_boundary; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options_put_IncludeWordBoundaryMetadata( ISpeechSynthesizerOptions *iface, boolean value ) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + TRACE("iface %p, value %s semi-stub.\n", iface, value ? "true" : "false"); + + impl->include_word_boundary = value; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options_get_IncludeSentenceBoundaryMetadata( ISpeechSynthesizerOptions *iface, boolean *value ) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + TRACE("iface %p, value %p stub.\n", iface, value); + + *value = impl->include_sentence_boundary; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options_put_IncludeSentenceBoundaryMetadata( ISpeechSynthesizerOptions *iface, boolean value ) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions(iface); + TRACE("iface %p, value %s stub.\n", iface, value ? "true" : "false"); + + impl->include_sentence_boundary = value; + return S_OK; +} + +static const struct ISpeechSynthesizerOptionsVtbl synthesizer_options_vtbl = +{ + /*** IUnknown methods ***/ + synthesizer_options_QueryInterface, + synthesizer_options_AddRef, + synthesizer_options_Release, + /*** IInspectable methods ***/ + synthesizer_options_GetIids, + synthesizer_options_GetRuntimeClassName, + synthesizer_options_GetTrustLevel, + /*** ISpeechSynthesizerOptions methods ***/ + synthesizer_options_get_IncludeWordBoundaryMetadata, + synthesizer_options_put_IncludeWordBoundaryMetadata, + synthesizer_options_get_IncludeSentenceBoundaryMetadata, + synthesizer_options_put_IncludeSentenceBoundaryMetadata, +}; + +DEFINE_IINSPECTABLE(synthesizer_options2, ISpeechSynthesizerOptions2, struct synthesizer_options, ISpeechSynthesizerOptions_iface) + +static HRESULT WINAPI synthesizer_options2_get_AudioVolume( ISpeechSynthesizerOptions2 *iface, DOUBLE *value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions2(iface); + + TRACE("iface %p value %p semi-stub!\n", iface, value); + *value = impl->audio_volume; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options2_put_AudioVolume( ISpeechSynthesizerOptions2 *iface, DOUBLE value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions2(iface); + + TRACE("iface %p value %g semi-stub!\n", iface, value); + impl->audio_volume = value; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options2_get_SpeakingRate( ISpeechSynthesizerOptions2 *iface, DOUBLE *value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions2(iface); + + TRACE("iface %p value %p semi-stub!\n", iface, value); + *value = impl->speaking_rate; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options2_put_SpeakingRate( ISpeechSynthesizerOptions2 *iface, DOUBLE value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions2(iface); + + TRACE("iface %p value %g semi-stub!\n", iface, value); + impl->speaking_rate = value; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options2_get_AudioPitch( ISpeechSynthesizerOptions2 *iface, DOUBLE *value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions2(iface); + + TRACE("iface %p value %p semi-stub!\n", iface, value); + *value = impl->audio_pitch; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options2_put_AudioPitch( ISpeechSynthesizerOptions2 *iface, DOUBLE value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions2(iface); + + TRACE("iface %p value %g semi-stub!\n", iface, value); + impl->audio_pitch = value; + return S_OK; +} + +static const struct ISpeechSynthesizerOptions2Vtbl synthesizer_options2_vtbl = +{ + /*** IUnknown methods ***/ + synthesizer_options2_QueryInterface, + synthesizer_options2_AddRef, + synthesizer_options2_Release, + /*** IInspectable methods ***/ + synthesizer_options2_GetIids, + synthesizer_options2_GetRuntimeClassName, + synthesizer_options2_GetTrustLevel, + /*** ISpeechSynthesizerOptions methods ***/ + synthesizer_options2_get_AudioVolume, + synthesizer_options2_put_AudioVolume, + synthesizer_options2_get_SpeakingRate, + synthesizer_options2_put_SpeakingRate, + synthesizer_options2_get_AudioPitch, + synthesizer_options2_put_AudioPitch, +}; + +DEFINE_IINSPECTABLE(synthesizer_options3, ISpeechSynthesizerOptions3, struct synthesizer_options, ISpeechSynthesizerOptions_iface) + +static HRESULT WINAPI synthesizer_options3_get_AppendedSilence( ISpeechSynthesizerOptions3 *iface, enum SpeechAppendedSilence *value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions3(iface); + + TRACE("iface %p value %p semi-stub!\n", iface, value); + *value = impl->appended_silence; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options3_put_AppendedSilence( ISpeechSynthesizerOptions3 *iface, enum SpeechAppendedSilence value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions3(iface); + + TRACE("iface %p value %u semi-stub!\n", iface, value); + impl->appended_silence = value; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options3_get_PunctuationSilence( ISpeechSynthesizerOptions3 *iface, enum SpeechPunctuationSilence *value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions3(iface); + + TRACE("iface %p value %p semi-stub!\n", iface, value); + *value = impl->punctuation_silence; + return S_OK; +} + +static HRESULT WINAPI synthesizer_options3_put_PunctuationSilence( ISpeechSynthesizerOptions3 *iface, enum SpeechPunctuationSilence value) +{ + struct synthesizer_options *impl = impl_from_ISpeechSynthesizerOptions3(iface); + + TRACE("iface %p value %u semi-stub!\n", iface, value); + impl->punctuation_silence = value; + return S_OK; +} + +static const struct ISpeechSynthesizerOptions3Vtbl synthesizer_options3_vtbl = +{ + /*** IUnknown methods ***/ + synthesizer_options3_QueryInterface, + synthesizer_options3_AddRef, + synthesizer_options3_Release, + /*** IInspectable methods ***/ + synthesizer_options3_GetIids, + synthesizer_options3_GetRuntimeClassName, + synthesizer_options3_GetTrustLevel, + /*** ISpeechSynthesizerOptions methods ***/ + synthesizer_options3_get_AppendedSilence, + synthesizer_options3_put_AppendedSilence, + synthesizer_options3_get_PunctuationSilence, + synthesizer_options3_put_PunctuationSilence, +}; + +static HRESULT synthesizer_options_allocate( struct synthesizer_options **out ) +{ + struct synthesizer_options *options; + + if (!(options = calloc(1, sizeof(*options)))) return E_OUTOFMEMORY; + + options->ISpeechSynthesizerOptions_iface.lpVtbl = &synthesizer_options_vtbl; + options->ISpeechSynthesizerOptions2_iface.lpVtbl = &synthesizer_options2_vtbl; + options->ISpeechSynthesizerOptions3_iface.lpVtbl = &synthesizer_options3_vtbl; + /* all other values default to 0 or false */ + options->audio_pitch = 1.0; + options->audio_volume = 1.0; + options->speaking_rate = 1.0; + options->ref = 1; + *out = options; + + return S_OK; +} + /* * * SpeechSynthesizer runtimeclass @@ -292,6 +595,8 @@ struct synthesizer ISpeechSynthesizer2 ISpeechSynthesizer2_iface; IClosable IClosable_iface; LONG ref; + + struct synthesizer_options *options; }; /* @@ -352,7 +657,11 @@ static ULONG WINAPI synthesizer_Release( ISpeechSynthesizer *iface ) TRACE("iface %p, ref %lu.\n", iface, ref); if (!ref) + { + if (impl->options) + ISpeechSynthesizerOptions_Release(&impl->options->ISpeechSynthesizerOptions_iface); free(impl); + } return ref; } @@ -440,8 +749,21 @@ DEFINE_IINSPECTABLE(synthesizer2, ISpeechSynthesizer2, struct synthesizer, ISpee static HRESULT WINAPI synthesizer2_get_Options( ISpeechSynthesizer2 *iface, ISpeechSynthesizerOptions **value ) { - FIXME("iface %p, value %p stub.\n", iface, value); - return E_NOTIMPL; + struct synthesizer *impl = impl_from_ISpeechSynthesizer2(iface); + + WARN("iface %p, value %p semi-stub.\n", iface, value); + if (!impl->options) + { + struct synthesizer_options *options; + HRESULT hr = synthesizer_options_allocate(&options); + if (FAILED(hr)) return hr; + + if (InterlockedCompareExchangePointer((void **)&impl->options, options, NULL) != NULL) + /* another thread beat us */ + ISpeechSynthesizerOptions_AddRef(&options->ISpeechSynthesizerOptions_iface); + } + ISpeechSynthesizerOptions_AddRef(*value = &impl->options->ISpeechSynthesizerOptions_iface); + return S_OK; } static const struct ISpeechSynthesizer2Vtbl synthesizer2_vtbl = diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index ba1acb0aa62..08d4cf02b03 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -1020,7 +1020,7 @@ static void test_SpeechSynthesizer(void) ISpeechSynthesizerOptions *options; hr = ISpeechSynthesizer2_get_Options(synthesizer2, &options); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) { From 772858e911a75a2d111581d8fe3458e6ab2ffd15 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0678/1506] windows.media.speech: Add more tests about IVoiceInformation. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/tests/speech.c | 73 +++++++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 08d4cf02b03..20e4bfbb472 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -674,6 +674,66 @@ static HRESULT WINAPI iterable_hstring_create_static( struct iterable_hstring *i return S_OK; } +#define check_comparable_presence(a, b) _check_comparable_presence( __LINE__, (a), (b)) +static void _check_comparable_presence( unsigned line, IVectorView_VoiceInformation *voices, IVoiceInformation *voice) +{ + HSTRING in_display, in_id, in_language; + HSTRING vc_display, vc_id, vc_language; + IVoiceInformation *vc_voice; + enum VoiceGender in_gender, vc_gender; + UINT32 size, idx, found_count = 0; + HRESULT hr; + INT32 cmp; + + hr = IVoiceInformation_get_DisplayName(voice, &in_display); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Id(voice, &in_id); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Language(voice, &in_language); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Gender(voice, &in_gender); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVectorView_VoiceInformation_get_Size(voices, &size); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + for (idx = 0; SUCCEEDED(hr = IVectorView_VoiceInformation_GetAt(voices, idx, &vc_voice)); idx++) + { + hr = IVoiceInformation_get_DisplayName(vc_voice, &vc_display); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Id(vc_voice, &vc_id); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Language(vc_voice, &vc_language); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Gender(vc_voice, &vc_gender); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + trace("%u] %s/%s/%s/%u\n", + idx - 1, debugstr_hstring(vc_display), debugstr_hstring(vc_id), debugstr_hstring(vc_language), vc_gender); + + if (SUCCEEDED(WindowsCompareStringOrdinal(in_display, vc_display, &cmp)) && !cmp && + SUCCEEDED(WindowsCompareStringOrdinal(in_id, vc_id, &cmp)) && !cmp && + SUCCEEDED(WindowsCompareStringOrdinal(in_language, vc_language, &cmp)) && !cmp && + in_gender == vc_gender) + { + found_count++; + } + WindowsDeleteString(vc_display); + WindowsDeleteString(vc_id); + WindowsDeleteString(vc_language); + IVoiceInformation_Release(vc_voice); + } + ok(hr == E_BOUNDS, "Got unexpected hr %#lx.\n", hr); + ok(idx != 0, "Vector view shouldn't be empty!\n"); + ok(idx == size, "Incoherent index/size %u/%u!\n", idx, size); + + ok_(__FILE__, line)(found_count == 1, "Found several (%u) instances of %s/%s/%s/%u\n", + found_count, + debugstr_hstring(in_display), debugstr_hstring(in_id), debugstr_hstring(in_language), in_gender); + + WindowsDeleteString(in_display); + WindowsDeleteString(in_id); + WindowsDeleteString(in_language); +} + static void test_ActivationFactory(void) { static const WCHAR *synthesizer_name = L"Windows.Media.SpeechSynthesis.SpeechSynthesizer"; @@ -798,7 +858,8 @@ static void test_SpeechSynthesizer(void) HMODULE hdll; HSTRING str, str2; HRESULT hr; - UINT32 size; + UINT32 size, idx; + BOOLEAN found; ULONG ref; hr = RoInitialize(RO_INIT_MULTITHREADED); @@ -892,13 +953,19 @@ static void test_SpeechSynthesizer(void) ok(hr == S_OK, "IVectorView_VoiceInformation_GetMany failed, hr %#lx\n", hr); ok(size == 0, "IVectorView_VoiceInformation_GetMany returned count %u\n", size); - IVectorView_VoiceInformation_Release(voices); - hr = IInstalledVoicesStatic_get_DefaultVoice(voices_static, &voice); todo_wine ok(hr == S_OK, "IInstalledVoicesStatic_get_DefaultVoice failed, hr %#lx\n", hr); if (hr == S_OK) { + /* check that VoiceInformation in static vector voice are not shared when exposed to user */ + idx = size; + hr = IVectorView_VoiceInformation_IndexOf(voices, voice, &idx, &found); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!found, "Shouldn't find default element\n"); + + check_comparable_presence(voices, voice); + IVoiceInformation_get_Description(voice, &str2); trace("SpeechSynthesizer default voice %s.\n", debugstr_hstring(str2)); From c5e279a2149ace9f611aef36287e380d1c27f472 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0679/1506] windows.media.speech: Add basic implementation of IVoiceInformation. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/synthesizer.c | 181 ++++++++++++++++++++++++ 1 file changed, 181 insertions(+) diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index 95dfe3150bb..f49e06dbd4c 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -23,6 +23,187 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); +struct voice_information +{ + IVoiceInformation IVoiceInformation_iface; + LONG ref; + + HSTRING id; + HSTRING display_name; + HSTRING language; + HSTRING description; + VoiceGender gender; +}; + +static inline struct voice_information *impl_from_IVoiceInformation( IVoiceInformation *iface ) +{ + return CONTAINING_RECORD(iface, struct voice_information, IVoiceInformation_iface); +} + +static void voice_information_delete( struct voice_information *voice_info ) +{ + WindowsDeleteString(voice_info->id); + WindowsDeleteString(voice_info->display_name); + WindowsDeleteString(voice_info->language); + WindowsDeleteString(voice_info->description); + free(voice_info); +} + +static HRESULT WINAPI voice_information_QueryInterface( IVoiceInformation *iface, REFIID iid, void **ppvObject) +{ + struct voice_information *impl = impl_from_IVoiceInformation( iface ); + + TRACE("iface %p, riid %s, ppv %p\n", iface, wine_dbgstr_guid(iid), ppvObject); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IVoiceInformation)) + { + IInspectable_AddRef((*ppvObject = &impl->IVoiceInformation_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI voice_information_AddRef( IVoiceInformation *iface ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI voice_information_Release( IVoiceInformation *iface ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + /* all voices are (for now) statically allocated in all_voices vector. so don't free them */ + return ref; +} + +static HRESULT WINAPI voice_information_GetIids( IVoiceInformation *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI voice_information_GetRuntimeClassName( IVoiceInformation *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI voice_information_GetTrustLevel( IVoiceInformation *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI voice_information_get_DisplayName( IVoiceInformation *iface, HSTRING *value ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + + TRACE("iface %p, value %p!n", iface, value); + return WindowsDuplicateString(impl->display_name, value); +} + +static HRESULT WINAPI voice_information_get_Id( IVoiceInformation *iface, HSTRING *value ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + + TRACE("iface %p, value %p\n", iface, value); + return WindowsDuplicateString(impl->id, value); +} + +static HRESULT WINAPI voice_information_get_Language( IVoiceInformation *iface, HSTRING *value ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + + TRACE("iface %p, value %p\n", iface, value); + return WindowsDuplicateString(impl->language, value); +} + +static HRESULT WINAPI voice_information_get_Description( IVoiceInformation *iface, HSTRING *value ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + + TRACE("iface %p, value %p\n", iface, value); + return WindowsDuplicateString(impl->description, value); +} + +static HRESULT WINAPI voice_information_get_Gender( IVoiceInformation *iface, VoiceGender *value ) +{ + struct voice_information *impl = impl_from_IVoiceInformation(iface); + + TRACE("iface %p, value %p\n", iface, value); + *value = impl->gender; + return S_OK; +} + +static const struct IVoiceInformationVtbl voice_information_vtbl = +{ + /*** IUnknown methods ***/ + voice_information_QueryInterface, + voice_information_AddRef, + voice_information_Release, + + /*** IInspectable methods ***/ + voice_information_GetIids, + voice_information_GetRuntimeClassName, + voice_information_GetTrustLevel, + + /*** IVoiceInformation methods ***/ + voice_information_get_DisplayName, + voice_information_get_Id, + voice_information_get_Language, + voice_information_get_Description, + voice_information_get_Gender, +}; + +HRESULT voice_information_allocate(const WCHAR *display_name, const WCHAR *id, const WCHAR *locale, + VoiceGender gender, IVoiceInformation **pvoice) +{ + struct voice_information *voice_info; + WCHAR *description; + HRESULT hr; + size_t len, langlen; + + voice_info = calloc(1, sizeof(*voice_info)); + if (!voice_info) return E_OUTOFMEMORY; + + len = wcslen(display_name) + 3; + langlen = GetLocaleInfoEx(locale, LOCALE_SLOCALIZEDDISPLAYNAME, NULL, 0); + description = malloc((len + langlen) * sizeof(WCHAR)); + wcscpy(description, display_name); + wcscat(description, L" - "); + GetLocaleInfoEx(locale, LOCALE_SLOCALIZEDDISPLAYNAME, description + len, langlen); + + hr = WindowsCreateString(display_name, wcslen(display_name), &voice_info->display_name); + if (SUCCEEDED(hr)) + hr = WindowsCreateString(id, wcslen(id), &voice_info->id); + if (SUCCEEDED(hr)) + hr = WindowsCreateString(locale, wcslen(locale), &voice_info->language); + if (SUCCEEDED(hr)) + hr = WindowsCreateString(description, len + langlen - 1, &voice_info->description); + if (SUCCEEDED(hr)) + { + voice_info->gender = gender; + voice_info->IVoiceInformation_iface.lpVtbl = &voice_information_vtbl; + + *pvoice = &voice_info->IVoiceInformation_iface; + } + else + { + voice_information_delete(voice_info); + } + free(description); + return hr; +} + /* * * IVectorView_VoiceInformation From 48a3d3e8d183cfcf8879251599dda16f1db22394 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0680/1506] windows.media.speech: Finish implement the voice information view. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/private.h | 10 +++ dlls/windows.media.speech/synthesizer.c | 95 ++++++++++++++++++++---- dlls/windows.media.speech/tests/speech.c | 2 +- 3 files changed, 92 insertions(+), 15 deletions(-) diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h index e80d73ec1fb..d03fe0e773e 100644 --- a/dlls/windows.media.speech/private.h +++ b/dlls/windows.media.speech/private.h @@ -126,4 +126,14 @@ HRESULT vector_inspectable_create( const struct vector_iids *iids, IVector_IInsp #define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \ DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface ) +struct synth_provider +{ + struct IVoiceInformation **voices; + unsigned num_voices; + void (*dispose)(struct synth_provider *provider); +}; + +HRESULT voice_information_allocate(const WCHAR *display_name, const WCHAR *id, const WCHAR *locale, + VoiceGender gender, IVoiceInformation **pvoice); + #endif diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index f49e06dbd4c..02e3e76e183 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -214,6 +214,8 @@ struct voice_information_vector { IVectorView_VoiceInformation IVectorView_VoiceInformation_iface; LONG ref; + + struct synth_provider provider; }; static inline struct voice_information_vector *impl_from_IVectorView_VoiceInformation( IVectorView_VoiceInformation *iface ) @@ -225,7 +227,7 @@ static HRESULT WINAPI vector_view_voice_information_QueryInterface( IVectorView_ { struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); - TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + TRACE("iface %p, iid %s, out %p\n", iface, debugstr_guid(iid), out); if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IInspectable) || @@ -276,23 +278,39 @@ static HRESULT WINAPI vector_view_voice_information_GetTrustLevel( IVectorView_V static HRESULT WINAPI vector_view_voice_information_GetAt( IVectorView_VoiceInformation *iface, UINT32 index, IVoiceInformation **value ) { - FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); - *value = NULL; - return E_BOUNDS; + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + TRACE("iface %p, index %#x, value %p\n", iface, index, value); + if (index >= impl->provider.num_voices) + { + *value = NULL; + return E_BOUNDS; + } + IVoiceInformation_AddRef( *value = impl->provider.voices[index] ); + return S_OK; } static HRESULT WINAPI vector_view_voice_information_get_Size( IVectorView_VoiceInformation *iface, UINT32 *value ) { - FIXME("iface %p, value %p stub!\n", iface, value); - *value = 0; + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + TRACE("iface %p, value %p\n", iface, value); + *value = impl->provider.num_voices; return S_OK; } static HRESULT WINAPI vector_view_voice_information_IndexOf( IVectorView_VoiceInformation *iface, IVoiceInformation *element, UINT32 *index, BOOLEAN *found ) { - FIXME("iface %p, element %p, index %p, found %p stub!\n", iface, element, index, found); - *index = 0; + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + int i; + + TRACE("iface %p, element %p, index %p, found %p\n", iface, element, index, found); + for (i = 0; i < impl->provider.num_voices; i++) + if (element == impl->provider.voices[i]) + { + *index = i; + *found = TRUE; + return S_OK; + } *found = FALSE; return S_OK; } @@ -300,8 +318,18 @@ static HRESULT WINAPI vector_view_voice_information_IndexOf( IVectorView_VoiceIn static HRESULT WINAPI vector_view_voice_information_GetMany( IVectorView_VoiceInformation *iface, UINT32 start_index, UINT32 items_size, IVoiceInformation **items, UINT *value ) { - FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value); - *value = 0; + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + int i; + + TRACE("iface %p, start_index %#x, items %p, value %p\n", iface, start_index, items, value); + if (start_index >= impl->provider.num_voices) + { + *value = 0; + return S_OK; + } + *value = min(impl->provider.num_voices - start_index, items_size); + for (i = 0; i < *value; i++) + IVoiceInformation_AddRef(items[i] = impl->provider.voices[start_index + i]); return S_OK; } @@ -324,7 +352,8 @@ static const struct IVectorView_VoiceInformationVtbl vector_view_voice_informati static struct voice_information_vector all_voices = { {&vector_view_voice_information_vtbl}, - 0 + 0, + {}, }; /* @@ -1107,6 +1136,26 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, }; +static HRESULT dummy_provider_init(struct synth_provider *provider) +{ + HRESULT hr; + WCHAR locale[LOCALE_NAME_MAX_LENGTH]; + + if (GetUserDefaultLocaleName(locale, ARRAY_SIZE(locale)) > ARRAY_SIZE(locale)) + return E_OUTOFMEMORY; + + provider->voices = calloc(1, sizeof(all_voices.provider.voices[0])); + if (!provider->voices) return E_OUTOFMEMORY; + hr = voice_information_allocate(L"Dummy voice", L"--noid--", locale, VoiceGender_Male, &provider->voices[0]); + if (FAILED(hr)) + { + free(provider->voices); + } + else + provider->num_voices = 1; + return hr; +} + /* * * IInstalledVoicesStatic for SpeechSynthesizer runtimeclass @@ -1115,12 +1164,30 @@ static const struct IActivationFactoryVtbl factory_vtbl = DEFINE_IINSPECTABLE(installed_voices_static, IInstalledVoicesStatic, struct synthesizer_statics, IActivationFactory_iface) +static CRITICAL_SECTION allvoices_cs; +static CRITICAL_SECTION_DEBUG allvoices_critsect_debug = +{ + 0, 0, &allvoices_cs, + { &allvoices_critsect_debug.ProcessLocksList, &allvoices_critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": allvoices_cs") } +}; +static CRITICAL_SECTION allvoices_cs = { &allvoices_critsect_debug, -1, 0, 0, 0, 0 }; + static HRESULT WINAPI installed_voices_static_get_AllVoices( IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value ) { + HRESULT hr; + TRACE("iface %p, value %p.\n", iface, value); - *value = &all_voices.IVectorView_VoiceInformation_iface; - IVectorView_VoiceInformation_AddRef(*value); - return S_OK; + + EnterCriticalSection(&allvoices_cs); + if (all_voices.provider.num_voices == 0) + hr = dummy_provider_init(&all_voices.provider); + else + hr = S_OK; + if (SUCCEEDED(hr)) + IVectorView_VoiceInformation_AddRef(*value = &all_voices.IVectorView_VoiceInformation_iface); + LeaveCriticalSection(&allvoices_cs); + return hr; } static HRESULT WINAPI installed_voices_static_get_DefaultVoice( IInstalledVoicesStatic *iface, IVoiceInformation **value ) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 20e4bfbb472..3dda92c632f 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -942,7 +942,7 @@ static void test_SpeechSynthesizer(void) size = 0xdeadbeef; hr = IVectorView_VoiceInformation_get_Size(voices, &size); ok(hr == S_OK, "IVectorView_VoiceInformation_get_Size voices failed, hr %#lx\n", hr); - todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size); + ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size); voice = (IVoiceInformation *)0xdeadbeef; hr = IVectorView_VoiceInformation_GetAt(voices, size, &voice); From 4f82aa8c9f112bf10c75ba6cc9735dec6e34d71c Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0681/1506] windows.media.speech: Add more tests about voice selection. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/tests/speech.c | 34 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 3dda92c632f..ffc63e751c7 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -856,7 +856,7 @@ static void test_SpeechSynthesizer(void) IClosable *closable; struct async_inspectable_handler async_inspectable_handler; HMODULE hdll; - HSTRING str, str2; + HSTRING str, str2, default_voice_id; HRESULT hr; UINT32 size, idx; BOOLEAN found; @@ -966,13 +966,18 @@ static void test_SpeechSynthesizer(void) check_comparable_presence(voices, voice); - IVoiceInformation_get_Description(voice, &str2); + hr = IVoiceInformation_get_Description(voice, &str2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); trace("SpeechSynthesizer default voice %s.\n", debugstr_hstring(str2)); - WindowsDeleteString(str2); + + hr = IVoiceInformation_get_Id(voice, &default_voice_id); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ref = IVoiceInformation_Release(voice); ok(ref == 0, "Got unexpected ref %lu.\n", ref); } + else default_voice_id = NULL; IInstalledVoicesStatic_Release(voices_static); IAgileObject_Release(agile_object); @@ -989,6 +994,29 @@ static void test_SpeechSynthesizer(void) hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechSynthesizer, (void **)&synthesizer); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ISpeechSynthesizer_get_Voice(synthesizer, &voice); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + if (default_voice_id) + { + if (hr == S_OK) + { + INT32 cmp; + IVoiceInformation_get_Id(voice, &str); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = WindowsCompareStringOrdinal(str, default_voice_id, &cmp); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = WindowsDeleteString(str); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + IVoiceInformation_Release(voice); + } + + hr = WindowsDeleteString(default_voice_id); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + } + /* Test SynthesizeTextToStreamAsync */ hr = WindowsCreateString(simple_synth_text, wcslen(simple_synth_text), &str); ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr); From 364cd6626c5975ce22778a317b062aa8324d2ce8 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0682/1506] windows.media.speech: Implement default voice. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/synthesizer.c | 50 +++++++++++++++++-- dlls/windows.media.speech/tests/speech.c | 61 +++++++++++------------- 2 files changed, 73 insertions(+), 38 deletions(-) diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index 02e3e76e183..0d352ae8c26 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -33,6 +33,7 @@ struct voice_information HSTRING language; HSTRING description; VoiceGender gender; + BOOL is_static; }; static inline struct voice_information *impl_from_IVoiceInformation( IVoiceInformation *iface ) @@ -81,7 +82,9 @@ static ULONG WINAPI voice_information_Release( IVoiceInformation *iface ) struct voice_information *impl = impl_from_IVoiceInformation(iface); ULONG ref = InterlockedDecrement(&impl->ref); TRACE("iface %p, ref %lu.\n", iface, ref); - /* all voices are (for now) statically allocated in all_voices vector. so don't free them */ + /* only deallocate non static instances */ + if (!ref && !impl->is_static) + voice_information_delete(impl); return ref; } @@ -192,8 +195,8 @@ HRESULT voice_information_allocate(const WCHAR *display_name, const WCHAR *id, c if (SUCCEEDED(hr)) { voice_info->gender = gender; + voice_info->is_static = TRUE; voice_info->IVoiceInformation_iface.lpVtbl = &voice_information_vtbl; - *pvoice = &voice_info->IVoiceInformation_iface; } else @@ -204,6 +207,35 @@ HRESULT voice_information_allocate(const WCHAR *display_name, const WCHAR *id, c return hr; } +HRESULT voice_information_clone(IVoiceInformation *voice, IVoiceInformation **out) +{ + struct voice_information *voice_info; + HRESULT hr; + + voice_info = calloc(1, sizeof(*voice_info)); + if (!voice_info) return E_OUTOFMEMORY; + + hr = IVoiceInformation_get_DisplayName(voice, &voice_info->display_name); + if (SUCCEEDED(hr)) + hr = IVoiceInformation_get_Id(voice, &voice_info->id); + if (SUCCEEDED(hr)) + hr = IVoiceInformation_get_Language(voice, &voice_info->language); + if (SUCCEEDED(hr)) + hr = IVoiceInformation_get_Description(voice, &voice_info->description); + if (SUCCEEDED(hr)) + hr = IVoiceInformation_get_Gender(voice, &voice_info->gender); + if (SUCCEEDED(hr)) + { + voice_info->IVoiceInformation_iface.lpVtbl = &voice_information_vtbl; + voice_info->ref = 1; + *out = &voice_info->IVoiceInformation_iface; + } + else + voice_information_delete(voice_info); + + return hr; +} + /* * * IVectorView_VoiceInformation @@ -1192,8 +1224,18 @@ static HRESULT WINAPI installed_voices_static_get_AllVoices( IInstalledVoicesSta static HRESULT WINAPI installed_voices_static_get_DefaultVoice( IInstalledVoicesStatic *iface, IVoiceInformation **value ) { - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + struct IVoiceInformation *static_voice; + HRESULT hr; + + TRACE("iface %p, value %p\n", iface, value); + + EnterCriticalSection(&allvoices_cs); + hr = IVectorView_VoiceInformation_GetAt(&all_voices.IVectorView_VoiceInformation_iface, 0, &static_voice); + if (SUCCEEDED(hr)) + hr = voice_information_clone(static_voice, value); + LeaveCriticalSection(&allvoices_cs); + + return hr; } static const struct IInstalledVoicesStaticVtbl installed_voices_static_vtbl = diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index ffc63e751c7..0dadd9465f0 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -954,30 +954,26 @@ static void test_SpeechSynthesizer(void) ok(size == 0, "IVectorView_VoiceInformation_GetMany returned count %u\n", size); hr = IInstalledVoicesStatic_get_DefaultVoice(voices_static, &voice); - todo_wine ok(hr == S_OK, "IInstalledVoicesStatic_get_DefaultVoice failed, hr %#lx\n", hr); + ok(hr == S_OK, "IInstalledVoicesStatic_get_DefaultVoice failed, hr %#lx\n", hr); - if (hr == S_OK) - { - /* check that VoiceInformation in static vector voice are not shared when exposed to user */ - idx = size; - hr = IVectorView_VoiceInformation_IndexOf(voices, voice, &idx, &found); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - ok(!found, "Shouldn't find default element\n"); + /* check that VoiceInformation in static vector voice are not shared when exposed to user */ + idx = size; + hr = IVectorView_VoiceInformation_IndexOf(voices, voice, &idx, &found); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!found, "Shouldn't find default element\n"); - check_comparable_presence(voices, voice); + check_comparable_presence(voices, voice); - hr = IVoiceInformation_get_Description(voice, &str2); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - trace("SpeechSynthesizer default voice %s.\n", debugstr_hstring(str2)); - WindowsDeleteString(str2); + hr = IVoiceInformation_get_Description(voice, &str2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + trace("SpeechSynthesizer default voice %s.\n", debugstr_hstring(str2)); + WindowsDeleteString(str2); - hr = IVoiceInformation_get_Id(voice, &default_voice_id); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Id(voice, &default_voice_id); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - ref = IVoiceInformation_Release(voice); - ok(ref == 0, "Got unexpected ref %lu.\n", ref); - } - else default_voice_id = NULL; + ref = IVoiceInformation_Release(voice); + ok(ref == 0, "Got unexpected ref %lu.\n", ref); IInstalledVoicesStatic_Release(voices_static); IAgileObject_Release(agile_object); @@ -997,26 +993,23 @@ static void test_SpeechSynthesizer(void) hr = ISpeechSynthesizer_get_Voice(synthesizer, &voice); todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - if (default_voice_id) + if (hr == S_OK) { - if (hr == S_OK) - { - INT32 cmp; - IVoiceInformation_get_Id(voice, &str); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = WindowsCompareStringOrdinal(str, default_voice_id, &cmp); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - - hr = WindowsDeleteString(str); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - - IVoiceInformation_Release(voice); - } + INT32 cmp; + IVoiceInformation_get_Id(voice, &str); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = WindowsCompareStringOrdinal(str, default_voice_id, &cmp); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = WindowsDeleteString(default_voice_id); + hr = WindowsDeleteString(str); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + IVoiceInformation_Release(voice); } + hr = WindowsDeleteString(default_voice_id); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + /* Test SynthesizeTextToStreamAsync */ hr = WindowsCreateString(simple_synth_text, wcslen(simple_synth_text), &str); ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr); From 1574fc2fd5472390cad5bcbc299827ecacadbf2a Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 4 Jul 2023 12:40:52 +0200 Subject: [PATCH 0683/1506] windows.media.speech: Implement get/put voice on synthesizer. Signed-off-by: Eric Pouech CW-Bug-Id: #20134 --- dlls/windows.media.speech/synthesizer.c | 57 ++++++++++++++++++++++-- dlls/windows.media.speech/tests/speech.c | 22 +++++---- 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c index 0d352ae8c26..bdf7325f669 100644 --- a/dlls/windows.media.speech/synthesizer.c +++ b/dlls/windows.media.speech/synthesizer.c @@ -839,6 +839,7 @@ struct synthesizer LONG ref; struct synthesizer_options *options; + IVoiceInformation *current_voice; }; /* @@ -902,6 +903,8 @@ static ULONG WINAPI synthesizer_Release( ISpeechSynthesizer *iface ) { if (impl->options) ISpeechSynthesizerOptions_Release(&impl->options->ISpeechSynthesizerOptions_iface); + if (impl->current_voice) + IVoiceInformation_Release(impl->current_voice); free(impl); } @@ -954,14 +957,49 @@ static HRESULT WINAPI synthesizer_SynthesizeSsmlToStreamAsync( ISpeechSynthesize static HRESULT WINAPI synthesizer_put_Voice( ISpeechSynthesizer *iface, IVoiceInformation *value ) { - FIXME("iface %p, value %p stub.\n", iface, value); - return E_NOTIMPL; + struct synthesizer *impl = impl_from_ISpeechSynthesizer(iface); + IVoiceInformation *voice; + HSTRING id, id2; + HRESULT hr; + INT32 cmp, idx; + + TRACE("iface %p, value %p semi-stub.\n", iface, value); + + hr = IVoiceInformation_get_Id(value, &id); + if (FAILED(hr)) return hr; + + for (idx = 0; ; idx++) + { + if (SUCCEEDED(hr = IVectorView_VoiceInformation_GetAt(&all_voices.IVectorView_VoiceInformation_iface, idx, &voice))) + { + if (SUCCEEDED(hr = IVoiceInformation_get_Id(voice, &id2))) + { + hr = WindowsCompareStringOrdinal(id, id2, &cmp); + WindowsDeleteString(id2); + } + IVoiceInformation_Release(voice); + } + if (FAILED(hr) || cmp == 0) break; + } + WindowsDeleteString(id); + + if (SUCCEEDED(hr)) + { + if (impl->current_voice) + IVoiceInformation_Release(impl->current_voice); + IVoiceInformation_AddRef(impl->current_voice = value); + } + return hr; } static HRESULT WINAPI synthesizer_get_Voice( ISpeechSynthesizer *iface, IVoiceInformation **value ) { - FIXME("iface %p, value %p stub.\n", iface, value); - return E_NOTIMPL; + struct synthesizer *impl = impl_from_ISpeechSynthesizer(iface); + + TRACE("iface %p, value %p.\n", iface, value); + if (!impl->current_voice) return E_NOTIMPL; + IVoiceInformation_AddRef(*value = impl->current_voice); + return S_OK; } static const struct ISpeechSynthesizerVtbl synthesizer_vtbl = @@ -1136,7 +1174,9 @@ static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLev static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) { + struct IVoiceInformation *static_voice; struct synthesizer *impl; + HRESULT hr; TRACE("iface %p, instance %p.\n", iface, instance); @@ -1149,6 +1189,15 @@ static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInsp impl->ISpeechSynthesizer_iface.lpVtbl = &synthesizer_vtbl; impl->ISpeechSynthesizer2_iface.lpVtbl = &synthesizer2_vtbl; impl->IClosable_iface.lpVtbl = &closable_vtbl; + /* assuming default is the first one... */ + hr = IVectorView_VoiceInformation_GetAt(&all_voices.IVectorView_VoiceInformation_iface, 0, &static_voice); + if (SUCCEEDED(hr)) + hr = voice_information_clone(static_voice, &impl->current_voice); + if (FAILED(hr)) + { + free(impl); + return hr; + } impl->ref = 1; *instance = (IInspectable *)&impl->ISpeechSynthesizer_iface; diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 0dadd9465f0..ade056a0a39 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -861,6 +861,7 @@ static void test_SpeechSynthesizer(void) UINT32 size, idx; BOOLEAN found; ULONG ref; + INT32 cmp; hr = RoInitialize(RO_INIT_MULTITHREADED); ok(hr == S_OK, "RoInitialize failed, hr %#lx\n", hr); @@ -991,21 +992,18 @@ static void test_SpeechSynthesizer(void) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ISpeechSynthesizer_get_Voice(synthesizer, &voice); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - INT32 cmp; - IVoiceInformation_get_Id(voice, &str); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = WindowsCompareStringOrdinal(str, default_voice_id, &cmp); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IVoiceInformation_get_Id(voice, &str); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = WindowsDeleteString(str); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = WindowsCompareStringOrdinal(str, default_voice_id, &cmp); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - IVoiceInformation_Release(voice); - } + hr = WindowsDeleteString(str); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + IVoiceInformation_Release(voice); hr = WindowsDeleteString(default_voice_id); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); From aeb623627b71ef9a28ceada07e0b2b63e6ee5606 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 12 Dec 2023 12:38:37 +0200 Subject: [PATCH 0684/1506] amd_ags_x64: Prefer builtin. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/Makefile.in b/dlls/amd_ags_x64/Makefile.in index b8463820d76..03441315802 100644 --- a/dlls/amd_ags_x64/Makefile.in +++ b/dlls/amd_ags_x64/Makefile.in @@ -6,7 +6,7 @@ UNIX_LIBS = $(DRM_LIBS) $(DRMAMDGPU_LIBS) IMPORTS = version vulkan-1 user32 IMPORTLIB = amd_ags_x64 -EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native +EXTRADLLFLAGS = -mno-cygwin SOURCES = \ amd_ags_x64_main.c \ From c191d43c346a3bc4cd31cf42adf5a445ec61ad95 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Jul 2020 15:00:34 +0300 Subject: [PATCH 0685/1506] ntdll: Support x86_64 syscall emulation. Wine-Staging: ntdll-Syscall_Emulation --- configure.ac | 1 + dlls/ntdll/unix/signal_x86_64.c | 191 ++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) diff --git a/configure.ac b/configure.ac index 7831bad5230..18682f36d8b 100644 --- a/configure.ac +++ b/configure.ac @@ -432,6 +432,7 @@ AC_CHECK_HEADERS(\ linux/ioctl.h \ linux/major.h \ linux/param.h \ + linux/seccomp.h \ linux/serial.h \ linux/types.h \ linux/ucdrom.h \ diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index ae100e05e63..fb7bfa185aa 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -27,6 +27,7 @@ #include "config.h" #include +#include #include #include #include @@ -34,6 +35,8 @@ #include #include #include +#include +#include #include #ifdef HAVE_MACHINE_SYSARCH_H # include @@ -65,6 +68,14 @@ # include #endif +#if defined(HAVE_LINUX_FILTER_H) && defined(HAVE_LINUX_SECCOMP_H) && defined(HAVE_SYS_PRCTL_H) +#define HAVE_SECCOMP 1 +# include +# include +# include +# include +#endif + #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" @@ -1783,6 +1794,185 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) return 0; } +#ifdef HAVE_SECCOMP +static void sigsys_handler( int signal, siginfo_t *siginfo, void *sigcontext ) +{ + extern const void *__wine_syscall_dispatcher_prolog_end_ptr; + struct syscall_frame *frame = amd64_thread_data()->syscall_frame; + ucontext_t *ctx = sigcontext; + + TRACE_(seh)("SIGSYS, rax %#llx, rip %#llx.\n", ctx->uc_mcontext.gregs[REG_RAX], + ctx->uc_mcontext.gregs[REG_RIP]); + + if (ctx->uc_mcontext.gregs[REG_RAX] == 0xffff) + { + /* Test syscall from the Unix side (install_bpf). */ + ctx->uc_mcontext.gregs[REG_RAX] = STATUS_INVALID_PARAMETER; + return; + } + + frame->rip = ctx->uc_mcontext.gregs[REG_RIP] + 0xb; + frame->rcx = ctx->uc_mcontext.gregs[REG_RIP]; + frame->eflags = ctx->uc_mcontext.gregs[REG_EFL]; + frame->restore_flags = 0; + ctx->uc_mcontext.gregs[REG_RCX] = (ULONG_PTR)frame; + ctx->uc_mcontext.gregs[REG_R11] = frame->eflags; + ctx->uc_mcontext.gregs[REG_EFL] &= ~0x100; /* clear single-step flag */ + ctx->uc_mcontext.gregs[REG_RIP] = (ULONG64)__wine_syscall_dispatcher_prolog_end_ptr; +} +#endif + +#ifdef HAVE_SECCOMP +static int sc_seccomp(unsigned int operation, unsigned int flags, void *args) +{ +#ifndef __NR_seccomp +# define __NR_seccomp 317 +#endif + return syscall(__NR_seccomp, operation, flags, args); +} +#endif + +static void check_bpf_jit_enable(void) +{ + char enabled; + int fd; + + fd = open("/proc/sys/net/core/bpf_jit_enable", O_RDONLY); + if (fd == -1) + { + WARN_(seh)("Could not open /proc/sys/net/core/bpf_jit_enable.\n"); + return; + } + + if (read(fd, &enabled, sizeof(enabled)) == sizeof(enabled)) + { + TRACE_(seh)("enabled %#x.\n", enabled); + + if (enabled != '1') + ERR_(seh)("BPF JIT is not enabled in the kernel, enable it to reduce syscall emulation overhead.\n"); + } + else + { + WARN_(seh)("Could not read /proc/sys/net/core/bpf_jit_enable.\n"); + } + close(fd); +} + +static void install_bpf(struct sigaction *sig_act) +{ +#ifdef HAVE_SECCOMP +# ifndef SECCOMP_FILTER_FLAG_SPEC_ALLOW +# define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2) +# endif + +# ifndef SECCOMP_SET_MODE_FILTER +# define SECCOMP_SET_MODE_FILTER 1 +# endif + static const BYTE syscall_trap_test[] = + { + 0x48, 0x89, 0xf8, /* mov %rdi, %rax */ + 0x0f, 0x05, /* syscall */ + 0xc3, /* retq */ + }; + static const unsigned int flags = SECCOMP_FILTER_FLAG_SPEC_ALLOW; + +#define NATIVE_SYSCALL_ADDRESS_START 0x700000000000 + + static struct sock_filter filter[] = + { + BPF_STMT(BPF_LD | BPF_W | BPF_ABS, offsetof(struct seccomp_data, instruction_pointer) + 4), + /* Native libs are loaded at high addresses. */ + BPF_JUMP(BPF_JMP | BPF_JGT | BPF_K, NATIVE_SYSCALL_ADDRESS_START >> 32, 0, 1), + BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), + /* Allow i386. */ + BPF_STMT(BPF_LD | BPF_W | BPF_ABS, offsetof(struct seccomp_data, arch)), + BPF_JUMP (BPF_JMP | BPF_JEQ | BPF_K, AUDIT_ARCH_X86_64, 1, 0), + BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), + /* Allow wine64-preloader */ + BPF_STMT(BPF_LD | BPF_W | BPF_ABS, offsetof(struct seccomp_data, instruction_pointer)), + BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 0x7d400000, 1, 0), + BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_TRAP), + BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 0x7d402000, 0, 1), + BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_TRAP), + BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), + }; + long (*test_syscall)(long sc_number); + struct syscall_frame *frame = amd64_thread_data()->syscall_frame; + struct sock_fprog prog; + NTSTATUS status; + + if ((ULONG_PTR)sc_seccomp < NATIVE_SYSCALL_ADDRESS_START + || (ULONG_PTR)syscall < NATIVE_SYSCALL_ADDRESS_START) + { + ERR_(seh)("Native libs are being loaded in low addresses, sc_seccomp %p, syscall %p, not installing seccomp.\n", + sc_seccomp, syscall); + ERR_(seh)("The known reasons are /proc/sys/vm/legacy_va_layout set to 1 or 'ulimit -s' being 'unlimited'.\n"); + return; + } + + sig_act->sa_sigaction = sigsys_handler; + memset(&prog, 0, sizeof(prog)); + + sigaction(SIGSYS, sig_act, NULL); + + frame->syscall_flags = syscall_flags; + + test_syscall = mmap((void *)0x600000000000, 0x1000, PROT_EXEC | PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANON, -1, 0); + if (test_syscall != (void *)0x600000000000) + { + int ret; + + ERR("Could not allocate test syscall, falling back to seccomp presence check, test_syscall %p, errno %d.\n", + test_syscall, errno); + if (test_syscall != MAP_FAILED) munmap(test_syscall, 0x1000); + + if ((ret = prctl(PR_GET_SECCOMP, 0, NULL, 0, 0))) + { + if (ret == 2) + TRACE_(seh)("Seccomp filters already installed.\n"); + else + ERR_(seh)("Seccomp filters cannot be installed, ret %d, error %s.\n", ret, strerror(errno)); + return; + } + } + else + { + memcpy(test_syscall, syscall_trap_test, sizeof(syscall_trap_test)); + status = test_syscall(0xffff); + munmap(test_syscall, 0x1000); + if (status == STATUS_INVALID_PARAMETER) + { + TRACE_(seh)("Seccomp filters already installed.\n"); + return; + } + if (status != -ENOSYS && (status != -1 || errno != ENOSYS)) + { + ERR_(seh)("Unexpected status %#x, errno %d.\n", status, errno); + return; + } + } + + TRACE_(seh)("Installing seccomp filters.\n"); + + prog.len = ARRAY_SIZE(filter); + prog.filter = filter; + + if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) + { + ERR_(seh)("prctl(PR_SET_NO_NEW_PRIVS, ...): %s.\n", strerror(errno)); + return; + } + if (sc_seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog)) + { + ERR_(seh)("prctl(PR_SET_SECCOMP, ...): %s.\n", strerror(errno)); + return; + } + check_bpf_jit_enable(); +#else + WARN_(seh)("Built without seccomp.\n"); +#endif +} /*********************************************************************** * handle_interrupt @@ -2467,6 +2657,7 @@ void signal_init_process(void) if (sigaction( SIGSEGV, &sig_act, NULL ) == -1) goto error; if (sigaction( SIGILL, &sig_act, NULL ) == -1) goto error; if (sigaction( SIGBUS, &sig_act, NULL ) == -1) goto error; + install_bpf(&sig_act); return; error: From 2c10dcc95447611a196430464a20f5f7db2f6bf4 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Sun, 10 Oct 2021 22:03:21 +0200 Subject: [PATCH 0686/1506] HACK: ntdll: Support x86_64 syscall emulation for Red Dead Redemption 2. CW-Bug-Id: #19085 --- dlls/ntdll/unix/signal_x86_64.c | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index fb7bfa185aa..c1b50af194a 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1820,6 +1820,46 @@ static void sigsys_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ctx->uc_mcontext.gregs[REG_EFL] &= ~0x100; /* clear single-step flag */ ctx->uc_mcontext.gregs[REG_RIP] = (ULONG64)__wine_syscall_dispatcher_prolog_end_ptr; } + +/* syscall numbers are for Windows 10 2009 (build 19043) */ +static struct +{ + unsigned int win_syscall_nr; + unsigned int wine_syscall_nr; + void *function; +} +syscall_nr_translation[] = +{ + {0x19, ~0u, NtQueryInformationProcess}, + {0x36, ~0u, NtQuerySystemInformation}, + {0xf2, ~0u, NtGetContextThread}, + {0x55, ~0u, NtCreateFile}, + {0x08, ~0u, NtWriteFile}, + {0x06, ~0u, NtReadFile}, + {0x0f, ~0u, NtClose}, + {0x23, ~0u, NtQueryVirtualMemory}, +}; + +static void sigsys_handler_rdr2( int signal, siginfo_t *siginfo, void *sigcontext ) +{ + ucontext_t *ctx = sigcontext; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(syscall_nr_translation); ++i) + { + if (ctx->uc_mcontext.gregs[REG_RAX] == syscall_nr_translation[i].win_syscall_nr) + { + ctx->uc_mcontext.gregs[REG_RAX] = syscall_nr_translation[i].wine_syscall_nr; + sigsys_handler( signal, siginfo, sigcontext ); + return; + } + } + + if (ctx->uc_mcontext.gregs[REG_RAX] == 0xffff) + sigsys_handler( signal, siginfo, sigcontext ); + else + FIXME_(seh)("Unhandled syscall %#llx.\n", ctx->uc_mcontext.gregs[REG_RAX]); +} #endif #ifdef HAVE_SECCOMP @@ -1899,6 +1939,7 @@ static void install_bpf(struct sigaction *sig_act) long (*test_syscall)(long sc_number); struct syscall_frame *frame = amd64_thread_data()->syscall_frame; struct sock_fprog prog; + unsigned int i, j; NTSTATUS status; if ((ULONG_PTR)sc_seccomp < NATIVE_SYSCALL_ADDRESS_START @@ -1913,6 +1954,28 @@ static void install_bpf(struct sigaction *sig_act) sig_act->sa_sigaction = sigsys_handler; memset(&prog, 0, sizeof(prog)); + { + const char *sgi = getenv("SteamGameId"); + if (sgi && (!strcmp(sgi, "1174180") || !strcmp(sgi, "1404210"))) + { + /* Use specific signal handler. */ + sig_act->sa_sigaction = sigsys_handler_rdr2; + + for (i = 0; i < KeServiceDescriptorTable->ServiceLimit; ++i) + { + for (j = 0; j < ARRAY_SIZE(syscall_nr_translation); ++j) + if ((void *)KeServiceDescriptorTable->ServiceTable[i] == syscall_nr_translation[j].function) + { + syscall_nr_translation[j].wine_syscall_nr = i; + break; + } + } + + for (j = 0; j < ARRAY_SIZE(syscall_nr_translation); ++j) + assert( syscall_nr_translation[j].wine_syscall_nr != ~0u ); + } + } + sigaction(SIGSYS, sig_act, NULL); frame->syscall_flags = syscall_flags; From 8846ab275f277702dba0055a4f8f595e3054541c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 29 Sep 2021 14:39:06 +0300 Subject: [PATCH 0687/1506] wine.inf: Add ReleaseId and DisplayVersion to %CurrentVersionNT%. CW-Bug-Id: #19484 --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index aa865f5a9ed..547930dc7bc 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2547,8 +2547,10 @@ HKLM,%CurrentVersionNT%,"DigitalProductId",1,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 +HKLM,%CurrentVersionNT%,"DisplayVersion",2,"21H1" HKLM,%CurrentVersionNT%,"EditionId",2,"Professional" HKLM,%CurrentVersionNT%,"ProductName",2,"Windows 10 Pro" +HKLM,%CurrentVersionNT%,"ReleaseId",,"2009" HKLM,%Control%\ProductOptions,"ProductType",2,"WinNT" HKLM,%Control%\Windows,"CSDVersion",0x10003,0 HKLM,%Control%\Session Manager\Environment,"OS",2,"Windows_NT" From ca3bb65cf9970b5b43e42b3a14c5c20552b2c510 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 10 Nov 2021 20:30:40 +0300 Subject: [PATCH 0688/1506] wine.inf: HACK: Spoof Win81 for msedgewebview2.exe. A proper fix depends on other process window Vulkan rendering and Direct Compositing implementation. CW-Bug-ID: #19618 For FH5. --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 547930dc7bc..5f676db760f 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2812,6 +2812,7 @@ HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\msedgewebview2.exe,"Version",,"win81" HKCU,Software\Wine\AppDefaults\Avengers.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\starwarssquadrons.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\GW2.Main_Win64_Retail.exe\DllOverrides,"atiadlxx",,"builtin" From 2cb6981edd6371df06063c787c2f9f10f0aefeac Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Tue, 6 Sep 2022 13:40:05 -0500 Subject: [PATCH 0689/1506] Enable field-loading hack for Primal Carnage: Extinction. --- dlls/mscoree/metahost.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 336129b18ca..0e468386d2c 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -1899,6 +1899,12 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam "317940", /* Karmaflow */ "namespace ContentBrowser { class IContentBrowserBackendInterface {} class Package {} } " }, + { + "UnrealEdCSharp", + "UnrealEdCSharp.dll", + "321360", /* Primal Carnage: Extinction */ + "namespace ContentBrowser { class IContentBrowserBackendInterface {} class Package {} } " + }, }; for (i = 0; i < ARRAY_SIZE(assembly_hacks); ++i) From e7dbf03c5e6b5dc0ead8b823702e8c8ddbdff6ff Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Mon, 9 Oct 2023 15:49:27 -0500 Subject: [PATCH 0690/1506] mscoree: Add work-around for Grotesque Tactics. CW-Bug-Id: #22841 --- dlls/mscoree/metahost.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c index 0e468386d2c..21c1b07dde5 100644 --- a/dlls/mscoree/metahost.c +++ b/dlls/mscoree/metahost.c @@ -1905,6 +1905,12 @@ static MonoAssembly* CDECL wine_mono_assembly_preload_hook_v2_fn(MonoAssemblyNam "321360", /* Primal Carnage: Extinction */ "namespace ContentBrowser { class IContentBrowserBackendInterface {} class Package {} } " }, + { + "DockPanel", + "DockPanel.dll", + "46450", /* Grotesque Tactics: Evil Heroes */ + "namespace WeifenLuo.WinFormsUI { class DockPanel {} }" + }, }; for (i = 0; i < ARRAY_SIZE(assembly_hacks); ++i) From ae570046741c676a9fdd339df21a18ca5057edf5 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 7 Apr 2020 11:05:47 -0500 Subject: [PATCH 0691/1506] mmdevapi: Add stub IAudioClockAdjustment implementation CW-Bug-Id: #17818 --- dlls/mmdevapi/client.c | 47 ++++++++++++++++++++++++++++++++++++++++ dlls/mmdevapi/mmdevdrv.h | 1 + 2 files changed, 48 insertions(+) diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index 3e0c70a44f4..c7d95a3ac91 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -89,6 +89,11 @@ static inline struct audio_client *impl_from_IAudioClock2(IAudioClock2 *iface) return CONTAINING_RECORD(iface, struct audio_client, IAudioClock2_iface); } +static inline ACImpl *impl_from_IAudioClockAdjustment(IAudioClockAdjustment *iface) +{ + return CONTAINING_RECORD(iface, ACImpl, IAudioClockAdjustment_iface); +} + static inline struct audio_client *impl_from_IAudioRenderClient(IAudioRenderClient *iface) { return CONTAINING_RECORD(iface, struct audio_client, IAudioRenderClient_iface); @@ -407,6 +412,8 @@ const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl = static HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, REFIID riid, void **ppv) { + struct audio_client *This = impl_from_IAudioClient3(iface); + TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); if (!ppv) @@ -417,6 +424,8 @@ static HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, REFIID riid, v IsEqualIID(riid, &IID_IAudioClient2) || IsEqualIID(riid, &IID_IAudioClient3)) *ppv = iface; + else if (IsEqualIID(riid, &IID_IAudioClockAdjustment)) + *ppv = &This->IAudioClockAdjustment_iface; else if(IsEqualIID(riid, &IID_IMarshal)) { struct audio_client *This = impl_from_IAudioClient3(iface); return IUnknown_QueryInterface(This->marshal, riid, ppv); @@ -1131,6 +1140,43 @@ const IAudioClock2Vtbl AudioClock2_Vtbl = clock2_GetDevicePosition }; +static HRESULT WINAPI AudioClockAdjustment_QueryInterface(IAudioClockAdjustment *iface, + REFIID riid, void **ppv) +{ + ACImpl *This = impl_from_IAudioClockAdjustment(iface); + return IAudioClock_QueryInterface(&This->IAudioClock_iface, riid, ppv); +} + +static ULONG WINAPI AudioClockAdjustment_AddRef(IAudioClockAdjustment *iface) +{ + ACImpl *This = impl_from_IAudioClockAdjustment(iface); + return IAudioClient_AddRef((IAudioClient *)&This->IAudioClient3_iface); +} + +static ULONG WINAPI AudioClockAdjustment_Release(IAudioClockAdjustment *iface) +{ + ACImpl *This = impl_from_IAudioClockAdjustment(iface); + return IAudioClient_Release((IAudioClient *)&This->IAudioClient3_iface); +} + +static HRESULT WINAPI AudioClockAdjustment_SetSampleRate(IAudioClockAdjustment *iface, + float new_rate) +{ + ACImpl *This = impl_from_IAudioClockAdjustment(iface); + + TRACE("(%p)->(%f)\n", This, new_rate); + + return E_NOTIMPL; +} + +const IAudioClockAdjustmentVtbl AudioClockAdjustment_Vtbl = +{ + AudioClockAdjustment_QueryInterface, + AudioClockAdjustment_AddRef, + AudioClockAdjustment_Release, + AudioClockAdjustment_SetSampleRate +}; + static HRESULT WINAPI render_QueryInterface(IAudioRenderClient *iface, REFIID riid, void **ppv) { struct audio_client *This = impl_from_IAudioRenderClient(iface); @@ -1417,6 +1463,7 @@ HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out) This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl; This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl; + This->IAudioClockAdjustment_iface.lpVtbl = &AudioClockAdjustment_Vtbl; This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl; This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl; diff --git a/dlls/mmdevapi/mmdevdrv.h b/dlls/mmdevapi/mmdevdrv.h index df21859cbad..004de87f11c 100644 --- a/dlls/mmdevapi/mmdevdrv.h +++ b/dlls/mmdevapi/mmdevdrv.h @@ -60,6 +60,7 @@ struct audio_client { IAudioCaptureClient IAudioCaptureClient_iface; IAudioClock IAudioClock_iface; IAudioClock2 IAudioClock2_iface; + IAudioClockAdjustment IAudioClockAdjustment_iface; IAudioStreamVolume IAudioStreamVolume_iface; LONG ref; From c79eac6bce2427f87b8c5cd1dc021336ea7357a7 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 1 Oct 2021 12:47:58 +0200 Subject: [PATCH 0692/1506] mmdevapi: Implement IAudioClockAdjustment::SetSampleRate CW-Bug-Id: #17818 --- dlls/mmdevapi/client.c | 11 +++++++- dlls/mmdevapi/unixlib.h | 8 ++++++ dlls/winealsa.drv/alsa.c | 2 ++ dlls/winecoreaudio.drv/coreaudio.c | 2 ++ dlls/wineoss.drv/oss.c | 2 ++ dlls/winepulse.drv/pulse.c | 41 +++++++++++++++++++++++++++++- 6 files changed, 64 insertions(+), 2 deletions(-) diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index c7d95a3ac91..0adb8bc5aa1 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -1163,10 +1163,19 @@ static HRESULT WINAPI AudioClockAdjustment_SetSampleRate(IAudioClockAdjustment * float new_rate) { ACImpl *This = impl_from_IAudioClockAdjustment(iface); + struct set_sample_rate_params params; TRACE("(%p)->(%f)\n", This, new_rate); - return E_NOTIMPL; + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + params.new_rate = new_rate; + + wine_unix_call(set_sample_rate, ¶ms); + + return params.result; } const IAudioClockAdjustmentVtbl AudioClockAdjustment_Vtbl = diff --git a/dlls/mmdevapi/unixlib.h b/dlls/mmdevapi/unixlib.h index d83ed918a51..2b29f6441ce 100644 --- a/dlls/mmdevapi/unixlib.h +++ b/dlls/mmdevapi/unixlib.h @@ -216,6 +216,13 @@ struct set_event_handle_params HRESULT result; }; +struct set_sample_rate_params +{ + stream_handle stream; + float new_rate; + HRESULT result; +}; + struct test_connect_params { const WCHAR *name; @@ -323,6 +330,7 @@ enum unix_funcs get_position, set_volumes, set_event_handle, + set_sample_rate, test_connect, is_started, get_prop_value, diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 94fc3c6fa4b..285d7ecf6de 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -2532,6 +2532,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = alsa_set_volumes, alsa_set_event_handle, alsa_not_implemented, + alsa_not_implemented, alsa_is_started, alsa_get_prop_value, alsa_not_implemented, @@ -2988,6 +2989,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = alsa_wow64_set_volumes, alsa_wow64_set_event_handle, alsa_not_implemented, + alsa_not_implemented, alsa_is_started, alsa_wow64_get_prop_value, alsa_not_implemented, diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index d78744455a8..375d53b968f 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1873,6 +1873,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = unix_set_volumes, unix_set_event_handle, unix_not_implemented, + unix_not_implemented, unix_is_started, unix_get_prop_value, unix_midi_init, @@ -2328,6 +2329,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = unix_wow64_set_volumes, unix_wow64_set_event_handle, unix_not_implemented, + unix_not_implemented, unix_is_started, unix_wow64_get_prop_value, unix_wow64_midi_init, diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 9a7a0fbb5d9..41a82cbf5da 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1731,6 +1731,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = oss_get_position, oss_set_volumes, oss_set_event_handle, + NULL, oss_test_connect, oss_is_started, oss_get_prop_value, @@ -2226,6 +2227,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = oss_wow64_get_position, oss_wow64_set_volumes, oss_wow64_set_event_handle, + oss_not_implemented, oss_wow64_test_connect, oss_is_started, oss_wow64_get_prop_value, diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 9c777471334..944cf938bdc 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -724,7 +724,7 @@ static void pulse_probe_settings(int render, const char *pulse_name, WAVEFORMATE ret = -1; else if (render) ret = pa_stream_connect_playback(stream, pulse_name, &attr, - PA_STREAM_START_CORKED|PA_STREAM_FIX_RATE|PA_STREAM_FIX_CHANNELS|PA_STREAM_EARLY_REQUESTS, NULL, NULL); + PA_STREAM_START_CORKED|PA_STREAM_FIX_RATE|PA_STREAM_FIX_CHANNELS|PA_STREAM_EARLY_REQUESTS|PA_STREAM_VARIABLE_RATE, NULL, NULL); else ret = pa_stream_connect_record(stream, pulse_name, &attr, PA_STREAM_START_CORKED|PA_STREAM_FIX_RATE|PA_STREAM_FIX_CHANNELS|PA_STREAM_EARLY_REQUESTS); if (ret >= 0) { @@ -1071,6 +1071,8 @@ static HRESULT pulse_stream_connect(struct pulse_stream *stream, const char *pul else pulse_name = NULL; /* use default */ + if (stream->dataflow == eRender) flags |= PA_STREAM_VARIABLE_RATE; + if (stream->dataflow == eRender) ret = pa_stream_connect_playback(stream->stream, pulse_name, &attr, flags, NULL, NULL); else @@ -2439,6 +2441,41 @@ static NTSTATUS pulse_set_event_handle(void *args) return STATUS_SUCCESS; } +static NTSTATUS pulse_set_sample_rate(void *args) +{ + struct set_sample_rate_params *params = args; + struct pulse_stream *stream = handle_get_stream(params->stream); + HRESULT hr = S_OK; + pa_operation *o; + int success; + + pulse_lock(); + if (!pulse_stream_valid(stream)) + hr = AUDCLNT_E_DEVICE_INVALIDATED; + else + { + if (!(o = pa_stream_update_sample_rate(stream->stream, params->new_rate, pulse_op_cb, &success))) + success = 0; + else + { + while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) + pthread_cond_wait(&pulse_cond, &pulse_mutex); + pa_operation_unref(o); + } + + if (!success) hr = E_FAIL; + else + { + stream->ss.rate = params->new_rate; + stream->period_bytes = pa_frame_size(&stream->ss) * muldiv(stream->mmdev_period_usec, stream->ss.rate, 1000000); + } + } + pulse_unlock(); + + params->result = hr; + return STATUS_SUCCESS; +} + static NTSTATUS pulse_is_started(void *args) { struct is_started_params *params = args; @@ -2563,6 +2600,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_get_position, pulse_set_volumes, pulse_set_event_handle, + pulse_set_sample_rate, pulse_test_connect, pulse_is_started, pulse_get_prop_value, @@ -3034,6 +3072,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_wow64_get_position, pulse_wow64_set_volumes, pulse_wow64_set_event_handle, + pulse_not_implemented, pulse_wow64_test_connect, pulse_is_started, pulse_wow64_get_prop_value, From e6b1797954d7aaf241d514eb5f0b7edf6a24396d Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 28 Dec 2021 12:05:22 -0600 Subject: [PATCH 0693/1506] xaudio2: Prefer native This should be safe now on 64-bit due to the top-down allocation patches. --- dlls/x3daudio1_0/Makefile.in | 2 ++ dlls/x3daudio1_1/Makefile.in | 2 ++ dlls/x3daudio1_2/Makefile.in | 2 ++ dlls/x3daudio1_3/Makefile.in | 2 ++ dlls/x3daudio1_4/Makefile.in | 2 ++ dlls/x3daudio1_5/Makefile.in | 2 ++ dlls/x3daudio1_6/Makefile.in | 2 ++ dlls/x3daudio1_7/Makefile.in | 2 ++ dlls/xactengine2_0/Makefile.in | 2 ++ dlls/xactengine2_4/Makefile.in | 2 ++ dlls/xactengine2_7/Makefile.in | 2 ++ dlls/xactengine2_9/Makefile.in | 2 ++ dlls/xactengine3_0/Makefile.in | 2 ++ dlls/xactengine3_1/Makefile.in | 2 ++ dlls/xactengine3_2/Makefile.in | 2 ++ dlls/xactengine3_3/Makefile.in | 2 ++ dlls/xactengine3_4/Makefile.in | 2 ++ dlls/xactengine3_5/Makefile.in | 2 ++ dlls/xactengine3_6/Makefile.in | 2 ++ dlls/xactengine3_7/Makefile.in | 2 ++ dlls/xapofx1_1/Makefile.in | 2 ++ dlls/xapofx1_2/Makefile.in | 2 ++ dlls/xapofx1_3/Makefile.in | 2 ++ dlls/xapofx1_4/Makefile.in | 2 ++ dlls/xapofx1_5/Makefile.in | 2 ++ dlls/xaudio2_0/Makefile.in | 2 ++ dlls/xaudio2_1/Makefile.in | 2 ++ dlls/xaudio2_2/Makefile.in | 2 ++ dlls/xaudio2_3/Makefile.in | 2 ++ dlls/xaudio2_4/Makefile.in | 2 ++ dlls/xaudio2_5/Makefile.in | 2 ++ dlls/xaudio2_6/Makefile.in | 2 ++ dlls/xaudio2_7/Makefile.in | 2 ++ dlls/xaudio2_8/Makefile.in | 2 ++ dlls/xaudio2_9/Makefile.in | 2 ++ 35 files changed, 70 insertions(+) diff --git a/dlls/x3daudio1_0/Makefile.in b/dlls/x3daudio1_0/Makefile.in index d3c2cbe6743..ab5af4ac64c 100644 --- a/dlls/x3daudio1_0/Makefile.in +++ b/dlls/x3daudio1_0/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_1/Makefile.in b/dlls/x3daudio1_1/Makefile.in index 8dfccce11d8..6b25e3909d4 100644 --- a/dlls/x3daudio1_1/Makefile.in +++ b/dlls/x3daudio1_1/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_2/Makefile.in b/dlls/x3daudio1_2/Makefile.in index 699aac41317..150028ad434 100644 --- a/dlls/x3daudio1_2/Makefile.in +++ b/dlls/x3daudio1_2/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_3/Makefile.in b/dlls/x3daudio1_3/Makefile.in index 093fe118089..c87c19da479 100644 --- a/dlls/x3daudio1_3/Makefile.in +++ b/dlls/x3daudio1_3/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_4/Makefile.in b/dlls/x3daudio1_4/Makefile.in index c67d6535a4d..a3319b81c87 100644 --- a/dlls/x3daudio1_4/Makefile.in +++ b/dlls/x3daudio1_4/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_5/Makefile.in b/dlls/x3daudio1_5/Makefile.in index 471e2c6b052..3b548bf9548 100644 --- a/dlls/x3daudio1_5/Makefile.in +++ b/dlls/x3daudio1_5/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_6/Makefile.in b/dlls/x3daudio1_6/Makefile.in index 7fb6f052729..956c3691204 100644 --- a/dlls/x3daudio1_6/Makefile.in +++ b/dlls/x3daudio1_6/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/x3daudio1_7/Makefile.in b/dlls/x3daudio1_7/Makefile.in index fd22a260f07..b906e9146a5 100644 --- a/dlls/x3daudio1_7/Makefile.in +++ b/dlls/x3daudio1_7/Makefile.in @@ -4,5 +4,7 @@ PARENTSRC = ../xaudio2_7 IMPORTS = $(FAUDIO_PE_LIBS) EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c diff --git a/dlls/xactengine2_0/Makefile.in b/dlls/xactengine2_0/Makefile.in index 2064afadc3d..ea57370f978 100644 --- a/dlls/xactengine2_0/Makefile.in +++ b/dlls/xactengine2_0/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0200 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine2_4/Makefile.in b/dlls/xactengine2_4/Makefile.in index b61774d6693..4771318e118 100644 --- a/dlls/xactengine2_4/Makefile.in +++ b/dlls/xactengine2_4/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0204 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine2_7/Makefile.in b/dlls/xactengine2_7/Makefile.in index bd91161fd2c..faae6a20d47 100644 --- a/dlls/xactengine2_7/Makefile.in +++ b/dlls/xactengine2_7/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0207 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine2_9/Makefile.in b/dlls/xactengine2_9/Makefile.in index 10e0578a82c..016efa9c76f 100644 --- a/dlls/xactengine2_9/Makefile.in +++ b/dlls/xactengine2_9/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0209 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_0/Makefile.in b/dlls/xactengine3_0/Makefile.in index b944a7d5a7a..a52a282fdf2 100644 --- a/dlls/xactengine3_0/Makefile.in +++ b/dlls/xactengine3_0/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0300 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_1/Makefile.in b/dlls/xactengine3_1/Makefile.in index 410ac6ce4f2..6f2466d7f25 100644 --- a/dlls/xactengine3_1/Makefile.in +++ b/dlls/xactengine3_1/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0301 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_2/Makefile.in b/dlls/xactengine3_2/Makefile.in index 32d855dd2c3..70c3491ce4a 100644 --- a/dlls/xactengine3_2/Makefile.in +++ b/dlls/xactengine3_2/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0302 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_3/Makefile.in b/dlls/xactengine3_3/Makefile.in index 650b577a16c..47795dcdf61 100644 --- a/dlls/xactengine3_3/Makefile.in +++ b/dlls/xactengine3_3/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0303 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_4/Makefile.in b/dlls/xactengine3_4/Makefile.in index 1fad4f2f4c4..fa459af88ca 100644 --- a/dlls/xactengine3_4/Makefile.in +++ b/dlls/xactengine3_4/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0304 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_5/Makefile.in b/dlls/xactengine3_5/Makefile.in index 1e74124da75..bb1a25e9ca0 100644 --- a/dlls/xactengine3_5/Makefile.in +++ b/dlls/xactengine3_5/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0305 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_6/Makefile.in b/dlls/xactengine3_6/Makefile.in index 12861dbfad9..3bc68714461 100644 --- a/dlls/xactengine3_6/Makefile.in +++ b/dlls/xactengine3_6/Makefile.in @@ -4,6 +4,8 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0306 PARENTSRC = ../xactengine3_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xactengine3_7/Makefile.in b/dlls/xactengine3_7/Makefile.in index e9b815b9b6a..8883b860c1c 100644 --- a/dlls/xactengine3_7/Makefile.in +++ b/dlls/xactengine3_7/Makefile.in @@ -3,6 +3,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) ole32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) EXTRADEFS = -DXACT3_VER=0x0307 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xact_classes.idl \ xact_dll.c diff --git a/dlls/xapofx1_1/Makefile.in b/dlls/xapofx1_1/Makefile.in index 81e2e5ae95b..19ca4c103b3 100644 --- a/dlls/xapofx1_1/Makefile.in +++ b/dlls/xapofx1_1/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) ole32 EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ version.rc \ xapo.c \ diff --git a/dlls/xapofx1_2/Makefile.in b/dlls/xapofx1_2/Makefile.in index 63534142460..88532c05aa4 100644 --- a/dlls/xapofx1_2/Makefile.in +++ b/dlls/xapofx1_2/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) ole32 EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xapofx.c \ diff --git a/dlls/xapofx1_3/Makefile.in b/dlls/xapofx1_3/Makefile.in index e0c2a17f9e2..49223bf9504 100644 --- a/dlls/xapofx1_3/Makefile.in +++ b/dlls/xapofx1_3/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) ole32 EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ version.rc \ xapo.c \ diff --git a/dlls/xapofx1_4/Makefile.in b/dlls/xapofx1_4/Makefile.in index 43dde8f047e..19881955d1c 100644 --- a/dlls/xapofx1_4/Makefile.in +++ b/dlls/xapofx1_4/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) ole32 EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xapofx.c \ diff --git a/dlls/xapofx1_5/Makefile.in b/dlls/xapofx1_5/Makefile.in index fb534286626..d3586b26d34 100644 --- a/dlls/xapofx1_5/Makefile.in +++ b/dlls/xapofx1_5/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) ole32 EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xapofx.c \ diff --git a/dlls/xaudio2_0/Makefile.in b/dlls/xaudio2_0/Makefile.in index 64a0efd3925..b7b969445df 100644 --- a/dlls/xaudio2_0/Makefile.in +++ b/dlls/xaudio2_0/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_1/Makefile.in b/dlls/xaudio2_1/Makefile.in index ebfe545f31e..0b5a7c148b0 100644 --- a/dlls/xaudio2_1/Makefile.in +++ b/dlls/xaudio2_1/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_2/Makefile.in b/dlls/xaudio2_2/Makefile.in index 3bc76019aff..7daefa0d1d7 100644 --- a/dlls/xaudio2_2/Makefile.in +++ b/dlls/xaudio2_2/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_3/Makefile.in b/dlls/xaudio2_3/Makefile.in index dec87cf0bcd..bbb5796f3fc 100644 --- a/dlls/xaudio2_3/Makefile.in +++ b/dlls/xaudio2_3/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_4/Makefile.in b/dlls/xaudio2_4/Makefile.in index 37c0a361a7a..4ceba7d7145 100644 --- a/dlls/xaudio2_4/Makefile.in +++ b/dlls/xaudio2_4/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_5/Makefile.in b/dlls/xaudio2_5/Makefile.in index 75ec4a32d4e..39bc137f5a3 100644 --- a/dlls/xaudio2_5/Makefile.in +++ b/dlls/xaudio2_5/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_6/Makefile.in b/dlls/xaudio2_6/Makefile.in index ba84d189fc4..5cbb89528e0 100644 --- a/dlls/xaudio2_6/Makefile.in +++ b/dlls/xaudio2_6/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ xapo.c \ xaudio_allocator.c \ diff --git a/dlls/xaudio2_7/Makefile.in b/dlls/xaudio2_7/Makefile.in index 0d88bfe6dd3..f219420bda2 100644 --- a/dlls/xaudio2_7/Makefile.in +++ b/dlls/xaudio2_7/Makefile.in @@ -3,6 +3,8 @@ MODULE = xaudio2_7.dll IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c \ xapo.c \ diff --git a/dlls/xaudio2_8/Makefile.in b/dlls/xaudio2_8/Makefile.in index b5406fe7fd0..f4a15960e2e 100644 --- a/dlls/xaudio2_8/Makefile.in +++ b/dlls/xaudio2_8/Makefile.in @@ -5,6 +5,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ x3daudio.c \ xapo.c \ diff --git a/dlls/xaudio2_9/Makefile.in b/dlls/xaudio2_9/Makefile.in index 1db3ea4e9c0..9dd1795006b 100644 --- a/dlls/xaudio2_9/Makefile.in +++ b/dlls/xaudio2_9/Makefile.in @@ -4,6 +4,8 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid EXTRAINCL = $(FAUDIO_PE_CFLAGS) PARENTSRC = ../xaudio2_7 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ version.rc \ x3daudio.c \ From d9e7ec6030c085f6d93e6cbe70bbd802501e5d13 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 31 Jan 2022 10:57:51 -0600 Subject: [PATCH 0694/1506] mmdevapi: Force PCM format for DeviceFormat property Native xaudio2 returns this format directly from GetDeviceDetails. Far Cry 4 expects to get a PCM format from GetDeviceDetails, so we need to set it to PCM here. --- dlls/mmdevapi/devenum.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c index 246625286b8..daafb4a822e 100644 --- a/dlls/mmdevapi/devenum.c +++ b/dlls/mmdevapi/devenum.c @@ -497,6 +497,7 @@ static HRESULT set_format(MMDevice *dev) HRESULT hr; IAudioClient *client; WAVEFORMATEX *fmt; + WAVEFORMATEXTENSIBLE *fmtex; PROPVARIANT pv = { VT_EMPTY }; hr = AudioClient_Create(&dev->devguid, &dev->IMMDevice_iface, &client); @@ -511,6 +512,24 @@ static HRESULT set_format(MMDevice *dev) IAudioClient_Release(client); + /* for most devices, native Windows only allows PCM formats for + * DeviceFormat. GetMixFormat often returns float. */ + if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE){ + fmtex = (WAVEFORMATEXTENSIBLE *)fmt; + if(IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)){ + fmt->wBitsPerSample = 16; + fmt->nBlockAlign = fmt->wBitsPerSample * fmt->nChannels / 8; + fmt->nAvgBytesPerSec = fmt->nSamplesPerSec * fmt->nBlockAlign; + fmtex->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + fmtex->Samples.wValidBitsPerSample = fmt->wBitsPerSample; + } + }else if(fmt->wFormatTag == WAVE_FORMAT_IEEE_FLOAT){ + fmt->wFormatTag = WAVE_FORMAT_PCM; + fmt->wBitsPerSample = 16; + fmt->nBlockAlign = fmt->wBitsPerSample * fmt->nChannels / 8; + fmt->nAvgBytesPerSec = fmt->nSamplesPerSec * fmt->nBlockAlign; + } + pv.vt = VT_BLOB; pv.blob.cbSize = sizeof(WAVEFORMATEX) + fmt->cbSize; pv.blob.pBlobData = (BYTE*)fmt; From 47d7b646dde80e7986e6a69760777c1d17d733ab Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 22 Dec 2021 00:57:25 +0300 Subject: [PATCH 0695/1506] wine.inf: Set a valid Win10 ProductId. CW-Bug-Id: #19702 --- loader/wine.inf.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 5f676db760f..4dc1ef087a3 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -370,7 +370,7 @@ HKCU,%CurrentVersion%\Run,,16 HKCU,%CurrentVersionNT%\Winlogon,,16 HKLM,%CurrentVersion%,"CommonFilesDir",,"%16427%" HKLM,%CurrentVersion%,"FirstInstallDateTime",1,21,81,7c,23 -HKLM,%CurrentVersion%,"ProductId",,"12345-oem-0000001-54321" +HKLM,%CurrentVersion%,"ProductId",,"00330-50000-00000-AAOEM" HKLM,%CurrentVersion%,"ProgramFilesDir",,"%16422%" HKLM,%CurrentVersion%,"ProgramFilesPath",0x20000,"%%ProgramFiles%%" HKLM,%CurrentVersion%,"RegisteredOrganization",2,"" @@ -395,7 +395,7 @@ HKLM,%CurrentVersion%\Shell Extensions\Approved,,16 HKLM,%CurrentVersion%\Time Zones,"SymbolicLinkValue",0x60000,"\Registry\Machine\%CurrentVersionNT%\Time Zones" HKLM,%CurrentVersion%\Uninstall,,16 HKLM,%CurrentVersionNT%,"InstallDate",0x10003,1273299354 -HKLM,%CurrentVersionNT%,"ProductId",,"12345-oem-0000001-54321" +HKLM,%CurrentVersionNT%,"ProductId",,"00330-50000-00000-AAOEM" HKLM,%CurrentVersionNT%,"RegisteredOrganization",2,"" HKLM,%CurrentVersionNT%,"RegisteredOwner",2,"" HKLM,%CurrentVersionNT%,"SystemRoot",,"%10%" From 19aaac5898db6d706dbc45dbd74c1e33b133b90e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 22 Dec 2021 00:59:32 +0300 Subject: [PATCH 0696/1506] wineboot: Generate better DigitalProductId. CW-Bug-Id: #19702 --- loader/wine.inf.in | 2 +- programs/wineboot/wineboot.c | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 4dc1ef087a3..4b1ce2feece 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2540,7 +2540,7 @@ HKLM,%CurrentVersionNT%,"CurrentMinorVersionNumber",0x10003,0 HKLM,%CurrentVersionNT%,"CurrentBuild",2,"19043" HKLM,%CurrentVersionNT%,"CurrentBuildNumber",2,"19043" HKLM,%CurrentVersionNT%,"CurrentType",2,"Multiprocessor Free" -HKLM,%CurrentVersionNT%,"DigitalProductId",1,00,00,00,00,00,00,00,00,00,00,00,\ +HKLM,%CurrentVersionNT%,"DigitalProductId",2,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index cc135538375..160a1d43786 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -68,6 +68,7 @@ #include #include #include +#include #include #include #include @@ -1746,6 +1747,52 @@ static void usage( int status ) exit( status ); } +static void create_digitalproductid(void) +{ + BYTE digital_product_id[0xa4]; + char product_id[256]; + LSTATUS status; + unsigned int i; + DWORD size; + DWORD type; + HKEY key; + + if ((status = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", + 0, KEY_ALL_ACCESS, &key ))) + return; + size = sizeof(product_id); + status = RegQueryValueExA( key, "ProductId", NULL, &type, (BYTE *)product_id, &size ); + if (status) goto done; + if (!size) goto done; + if (product_id[size - 1]) + { + if (size == sizeof(product_id)) goto done; + product_id[size++] = 0; + } + + if (!RegQueryValueExA( key, "DigitalProductId", NULL, &type, NULL, &size ) && size == sizeof(digital_product_id)) + { + if (RegQueryValueExA( key, "DigitalProductId", NULL, &type, digital_product_id, &size )) + goto done; + for (i = 0; i < size; ++i) + if (digital_product_id[i]) break; + if (i < size) goto done; + } + + memset( digital_product_id, 0, sizeof(digital_product_id) ); + *(DWORD *)digital_product_id = sizeof(digital_product_id); + digital_product_id[4] = 3; + strcpy( (char *)digital_product_id + 8, product_id ); + *(DWORD *)(digital_product_id + 0x20) = 0x0cec; + *(DWORD *)(digital_product_id + 0x34) = 0x0cec; + strcpy( (char *)digital_product_id + 0x24, "[TH] X19-99481" ); + digital_product_id[0x42] = 8; + RtlGenRandom( digital_product_id + 0x38, 0x18 ); + RegSetValueExA( key, "DigitalProductId", 0, REG_BINARY, digital_product_id, sizeof(digital_product_id) ); +done: + RegCloseKey( key ); +} + int __cdecl main( int argc, char *argv[] ) { /* First, set the current directory to SystemRoot */ @@ -1856,6 +1903,7 @@ int __cdecl main( int argc, char *argv[] ) } if (init || update) update_wineprefix( update ); + create_digitalproductid(); create_volatile_environment_registry_key(); ProcessRunKeys( HKEY_LOCAL_MACHINE, L"RunOnce", TRUE, TRUE ); From 717894cbb4d2fe3902fafc3200c8a4fa2e09c443 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 16 Oct 2016 03:21:42 +0200 Subject: [PATCH 0697/1506] server: Improve STATUS_CANNOT_DELETE checks for directory case. Wine-Staging: server-File_Permissions --- server/fd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/fd.c b/server/fd.c index d18ed4fc8e4..6cf8fb3ad06 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1914,6 +1914,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam int root_fd = -1; int rw_mode; char *path; + int created = (flags & O_CREAT); if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) || ((options & FILE_DIRECTORY_FILE) && (flags & O_TRUNC))) @@ -1952,6 +1953,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam file_set_error(); goto error; } + created = 0; } flags &= ~(O_CREAT | O_EXCL | O_TRUNC); } @@ -2034,7 +2036,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam } /* can't unlink files if we don't have permission to access */ - if ((options & FILE_DELETE_ON_CLOSE) && !(flags & O_CREAT) && + if ((options & FILE_DELETE_ON_CLOSE) && !created && !(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) { set_error( STATUS_CANNOT_DELETE ); From 2da7fe668973eeeb828ad59ab68189cf410e7460 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Apr 2015 03:58:47 +0200 Subject: [PATCH 0698/1506] server: Allow to open files without any permission bits. (try 2) Changes in v2: * As suggested by Piotr, fix the problem for both files and directories. * Pay attention to requested access attributes - this fixes a couple more todo_wine's. Wine-Staging: server-File_Permissions --- dlls/advapi32/tests/security.c | 32 ++++++++++++-------------------- server/fd.c | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 2840f6bd75a..9569272e0db 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3782,17 +3782,13 @@ static void test_CreateDirectoryA(void) error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, (PSID *)&owner, NULL, &pDacl, NULL, &pSD); - todo_wine ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %ld\n", error); - if (error == ERROR_SUCCESS) - { - bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); - ok(bret, "GetAclInformation failed\n"); - todo_wine - ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n", - acl_size.AceCount); - LocalFree(pSD); - } + bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); + ok(bret, "GetAclInformation failed\n"); + todo_wine + ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n", + acl_size.AceCount); + LocalFree(pSD); CloseHandle(hTemp); /* Test inheritance of ACLs in NtCreateFile without security descriptor */ @@ -3861,17 +3857,13 @@ static void test_CreateDirectoryA(void) error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, (PSID *)&owner, NULL, &pDacl, NULL, &pSD); - todo_wine ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %ld\n", error); - if (error == ERROR_SUCCESS) - { - bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); - ok(bret, "GetAclInformation failed\n"); - todo_wine - ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n", - acl_size.AceCount); - LocalFree(pSD); - } + bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); + ok(bret, "GetAclInformation failed\n"); + todo_wine + ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n", + acl_size.AceCount); + LocalFree(pSD); CloseHandle(hTemp); done: diff --git a/server/fd.c b/server/fd.c index 6cf8fb3ad06..d789895628b 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1914,6 +1914,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam int root_fd = -1; int rw_mode; char *path; + int do_chmod = 0; int created = (flags & O_CREAT); if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) || @@ -1973,6 +1974,23 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT)) fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode ); } + else if (errno == EACCES) + { + /* try to change permissions temporarily to open a file descriptor */ + if (!(access & (FILE_UNIX_WRITE_ACCESS | FILE_UNIX_READ_ACCESS | DELETE)) && + !stat( name, &st ) && st.st_uid == getuid() && + !chmod( name, st.st_mode | S_IRUSR )) + { + fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode ); + *mode = st.st_mode; + do_chmod = 1; + } + else + { + set_error( STATUS_ACCESS_DENIED ); + goto error; + } + } if (fd->unix_fd == -1) { @@ -1981,6 +1999,8 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam set_error( STATUS_OBJECT_NAME_INVALID ); else file_set_error(); + + if (do_chmod) chmod( name, *mode ); goto error; } } @@ -1996,6 +2016,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam closed_fd->unix_fd = fd->unix_fd; closed_fd->disp_flags = 0; closed_fd->unix_name = fd->unix_name; + if (do_chmod) chmod( name, *mode ); fstat( fd->unix_fd, &st ); *mode = st.st_mode; From 29b2b9931b5359026bb367e8dbc4090f8046feaf Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Apr 2015 03:58:53 +0200 Subject: [PATCH 0699/1506] server: When creating new directories temporarily give read-permissions until they are opened. Wine-Staging: server-File_Permissions --- server/fd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/fd.c b/server/fd.c index d789895628b..07f44b94cff 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1947,7 +1947,12 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam /* create the directory if needed */ if ((options & FILE_DIRECTORY_FILE) && (flags & O_CREAT)) { - if (mkdir( name, *mode ) == -1) + if (mkdir( name, *mode | S_IRUSR ) != -1) + { + /* remove S_IRUSR later, after we have opened the directory */ + do_chmod = !(*mode & S_IRUSR); + } + else { if (errno != EEXIST || (flags & O_EXCL)) { From 3592b7897a6bd5ede01e78a49f2a746183e58fcb Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Apr 2015 03:58:59 +0200 Subject: [PATCH 0700/1506] advapi32/tests: Add tests for ACL inheritance in CreateDirectoryA. Wine-Staging: server-File_Permissions --- dlls/advapi32/tests/security.c | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 9569272e0db..00baf703a38 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3866,6 +3866,76 @@ static void test_CreateDirectoryA(void) LocalFree(pSD); CloseHandle(hTemp); + /* Test inheritance of ACLs in CreateDirectory without security descriptor */ + strcpy(tmpfile, tmpdir); + lstrcatA(tmpfile, "/tmpdir"); + bret = CreateDirectoryA(tmpfile, NULL); + ok(bret == TRUE, "CreateDirectoryA failed with error %u\n", GetLastError()); + + error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, + OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + (PSID *)&owner, NULL, &pDacl, NULL, &pSD); + ok(error == ERROR_SUCCESS, "Failed to get permissions on file\n"); + test_inherited_dacl(pDacl, admin_sid, user_sid, + OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERITED_ACE, + 0x1f01ff, TRUE, TRUE, TRUE, __LINE__); + LocalFree(pSD); + bret = RemoveDirectoryA(tmpfile); + ok(bret == TRUE, "RemoveDirectoryA failed with error %u\n", GetLastError()); + + /* Test inheritance of ACLs in CreateDirectory with security descriptor */ + pSD = &sd; + InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION); + pDacl = HeapAlloc(GetProcessHeap(), 0, sizeof(ACL)); + bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION); + ok(bret, "Failed to initialize ACL\n"); + bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE); + ok(bret, "Failed to add ACL to security desciptor\n"); + + strcpy(tmpfile, tmpdir); + lstrcatA(tmpfile, "/tmpdir1"); + + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = pSD; + sa.bInheritHandle = TRUE; + bret = CreateDirectoryA(tmpfile, &sa); + ok(bret == TRUE, "CreateDirectoryA failed with error %u\n", GetLastError()); + HeapFree(GetProcessHeap(), 0, pDacl); + + error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, + OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + (PSID *)&owner, NULL, &pDacl, NULL, &pSD); + ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n", error); + bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); + ok(bret, "GetAclInformation failed\n"); + todo_wine + ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%d != 0).\n", + acl_size.AceCount); + LocalFree(pSD); + + SetLastError(0xdeadbeef); + bret = RemoveDirectoryA(tmpfile); + error = GetLastError(); + ok(bret == FALSE, "RemoveDirectoryA unexpected succeeded\n"); + ok(error == ERROR_ACCESS_DENIED, "expected ERROR_ACCESS_DENIED, got %u\n", error); + + pSD = &sd; + InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION); + pDacl = HeapAlloc(GetProcessHeap(), 0, 100); + bret = InitializeAcl(pDacl, 100, ACL_REVISION); + ok(bret, "Failed to initialize ACL.\n"); + bret = pAddAccessAllowedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid); + ok(bret, "Failed to add Current User to ACL.\n"); + bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE); + ok(bret, "Failed to add ACL to security desciptor.\n"); + error = pSetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, + NULL, pDacl, NULL); + ok(error == ERROR_SUCCESS, "SetNamedSecurityInfoA failed with error %u\n", error); + HeapFree(GetProcessHeap(), 0, pDacl); + + bret = RemoveDirectoryA(tmpfile); + ok(bret == TRUE, "RemoveDirectoryA failed with error %u\n", GetLastError()); + done: HeapFree(GetProcessHeap(), 0, user); bret = RemoveDirectoryA(tmpdir); From 1c908cf3a2b2c6765a54226d648fb4ab0272b51e Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Apr 2015 03:59:05 +0200 Subject: [PATCH 0701/1506] advapi32/tests: Add ACL inheritance tests for creating subdirectories with NtCreateFile. Wine-Staging: server-File_Permissions --- dlls/advapi32/tests/security.c | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 00baf703a38..9057c300995 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3936,6 +3936,82 @@ static void test_CreateDirectoryA(void) bret = RemoveDirectoryA(tmpfile); ok(bret == TRUE, "RemoveDirectoryA failed with error %u\n", GetLastError()); + /* Test inheritance of ACLs in NtCreateFile(..., FILE_DIRECTORY_FILE, ...) without security descriptor */ + strcpy(tmpfile, tmpdir); + lstrcatA(tmpfile, "/tmpdir"); + get_nt_pathW(tmpfile, &tmpfileW); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &tmpfileW; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + status = pNtCreateFile(&hTemp, GENERIC_READ | DELETE, &attr, &io, NULL, FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, FILE_CREATE, FILE_DIRECTORY_FILE | FILE_DELETE_ON_CLOSE, NULL, 0); + ok(!status, "NtCreateFile failed with %08x\n", status); + RtlFreeUnicodeString(&tmpfileW); + + error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, + OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + (PSID *)&owner, NULL, &pDacl, NULL, &pSD); + ok(error == ERROR_SUCCESS, "Failed to get permissions on file\n"); + test_inherited_dacl(pDacl, admin_sid, user_sid, + OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERITED_ACE, + 0x1f01ff, TRUE, TRUE, TRUE, __LINE__); + LocalFree(pSD); + CloseHandle(hTemp); + + /* Test inheritance of ACLs in NtCreateFile(..., FILE_DIRECTORY_FILE, ...) with security descriptor */ + pSD = &sd; + InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION); + pDacl = HeapAlloc(GetProcessHeap(), 0, sizeof(ACL)); + bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION); + ok(bret, "Failed to initialize ACL\n"); + bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE); + ok(bret, "Failed to add ACL to security desciptor\n"); + + strcpy(tmpfile, tmpdir); + lstrcatA(tmpfile, "/tmpdir2"); + get_nt_pathW(tmpfile, &tmpfileW); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &tmpfileW; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.SecurityDescriptor = pSD; + attr.SecurityQualityOfService = NULL; + + status = pNtCreateFile(&hTemp, GENERIC_READ | DELETE, &attr, &io, NULL, FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, FILE_CREATE, FILE_DIRECTORY_FILE | FILE_DELETE_ON_CLOSE, NULL, 0); + ok(!status, "NtCreateFile failed with %08x\n", status); + RtlFreeUnicodeString(&tmpfileW); + HeapFree(GetProcessHeap(), 0, pDacl); + + error = GetSecurityInfo(hTemp, SE_FILE_OBJECT, + OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + (PSID *)&owner, NULL, &pDacl, NULL, &pSD); + ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n", error); + bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); + ok(bret, "GetAclInformation failed\n"); + todo_wine + ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%d != 0).\n", + acl_size.AceCount); + LocalFree(pSD); + + error = pGetNamedSecurityInfoA(tmpfile, SE_FILE_OBJECT, + OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + (PSID *)&owner, NULL, &pDacl, NULL, &pSD); + ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n", error); + bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); + ok(bret, "GetAclInformation failed\n"); + todo_wine + ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%d != 0).\n", + acl_size.AceCount); + LocalFree(pSD); + CloseHandle(hTemp); + done: HeapFree(GetProcessHeap(), 0, user); bret = RemoveDirectoryA(tmpdir); From debba8769cf743f78ade1780372537286f0c88c9 Mon Sep 17 00:00:00 2001 From: Qian Hong Date: Fri, 15 May 2015 15:28:17 +0800 Subject: [PATCH 0702/1506] ntdll/tests: Added tests for open behaviour on readonly files. Wine-Staging: server-File_Permissions --- dlls/ntdll/tests/file.c | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index da3611f74f2..04beeca4c2d 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -4735,6 +4735,83 @@ static void test_NtCreateFile(void) RemoveDirectoryW( path ); } +static void test_readonly(void) +{ + static const WCHAR fooW[] = {'f','o','o',0}; + NTSTATUS status; + HANDLE handle; + WCHAR path[MAX_PATH]; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + UNICODE_STRING nameW; + + GetTempPathW(MAX_PATH, path); + GetTempFileNameW(path, fooW, 0, path); + DeleteFileW(path); + pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL); + + attr.Length = sizeof(attr); + attr.RootDirectory = NULL; + attr.ObjectName = &nameW; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + status = pNtCreateFile(&handle, GENERIC_READ, &attr, &io, NULL, FILE_ATTRIBUTE_READONLY, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_CREATE, 0, NULL, 0); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, GENERIC_WRITE, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_ACCESS_DENIED, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, GENERIC_READ, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, FILE_READ_ATTRIBUTES, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, FILE_WRITE_ATTRIBUTES, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + todo_wine ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, DELETE, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, READ_CONTROL, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, WRITE_DAC, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, WRITE_OWNER, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle(handle); + + status = pNtOpenFile(&handle, SYNCHRONIZE, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); + ok(status == STATUS_SUCCESS, "got %#x\n", status); + CloseHandle( handle ); + + pRtlFreeUnicodeString(&nameW); + SetFileAttributesW(path, FILE_ATTRIBUTE_ARCHIVE); + DeleteFileW(path); +} + static void test_read_write(void) { static const char contents[14] = "1234567890abcd"; @@ -5875,6 +5952,7 @@ START_TEST(file) test_read_write(); test_NtCreateFile(); + test_readonly(); create_file_test(); open_file_test(); delete_file_test(); From 072c122e04e6c70251253256e37d9c4ed6540942 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 3 Jun 2015 05:43:31 +0200 Subject: [PATCH 0703/1506] server: FILE_WRITE_ATTRIBUTES should succeed for readonly files. Wine-Staging: server-File_Permissions --- dlls/ntdll/tests/file.c | 2 +- server/fd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 04beeca4c2d..4b0d8f9fd37 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -4779,7 +4779,7 @@ static void test_readonly(void) status = pNtOpenFile(&handle, FILE_WRITE_ATTRIBUTES, &attr, &io, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT); - todo_wine ok(status == STATUS_SUCCESS, "got %#x\n", status); + ok(status == STATUS_SUCCESS, "got %#x\n", status); CloseHandle(handle); status = pNtOpenFile(&handle, DELETE, &attr, &io, diff --git a/server/fd.c b/server/fd.c index 07f44b94cff..d1ac7506a5f 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1982,7 +1982,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam else if (errno == EACCES) { /* try to change permissions temporarily to open a file descriptor */ - if (!(access & (FILE_UNIX_WRITE_ACCESS | FILE_UNIX_READ_ACCESS | DELETE)) && + if (!(access & ((FILE_UNIX_WRITE_ACCESS | FILE_UNIX_READ_ACCESS | DELETE) & ~FILE_WRITE_ATTRIBUTES)) && !stat( name, &st ) && st.st_uid == getuid() && !chmod( name, st.st_mode | S_IRUSR )) { From ae659100f551f1e0d8b02781d51b3a4266595fec Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 13 Jul 2020 10:21:49 -0500 Subject: [PATCH 0704/1506] ntdll: Handle NULL object name buffer in nt_to_unix_file_name_attr(). CW-Bug-Id: #17864 --- dlls/ntdll/tests/file.c | 22 +++++++++++++++++++++- dlls/ntdll/unix/file.c | 5 ++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 4b0d8f9fd37..78087114d06 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -145,16 +145,36 @@ static void create_file_test(void) static const WCHAR pathInvalidDosW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\',0}; static const char testdata[] = "Hello World"; FILE_NETWORK_OPEN_INFORMATION info; + UNICODE_STRING nameW, null_string; NTSTATUS status; HANDLE dir, file; WCHAR path[MAX_PATH]; OBJECT_ATTRIBUTES attr; IO_STATUS_BLOCK io; - UNICODE_STRING nameW; LARGE_INTEGER offset; char buf[32]; DWORD ret; + attr.Length = sizeof(attr); + attr.RootDirectory = NULL; + attr.ObjectName = &null_string; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + null_string.Buffer = NULL; + null_string.Length = 256; + + /* try various open modes and options on directories */ + status = pNtCreateFile( &dir, GENERIC_READ|GENERIC_WRITE, &attr, &io, NULL, 0, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0 ); + ok( status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#x.\n", status ); + + null_string.Length = 0; + status = pNtCreateFile( &dir, GENERIC_READ|GENERIC_WRITE, &attr, &io, NULL, 0, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0 ); + ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "Got unexpected status %#x.\n", status ); + GetCurrentDirectoryW( MAX_PATH, path ); pRtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL ); attr.Length = sizeof(attr); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index ddea0e994cc..367cc6763cd 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -3499,7 +3499,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char name = nameW->Buffer; name_len = nameW->Length / sizeof(WCHAR); - if (!name_len || name[0] != '\\') return STATUS_OBJECT_PATH_SYNTAX_BAD; + if (!name || !name_len || name[0] != '\\') return STATUS_OBJECT_PATH_SYNTAX_BAD; if (!(pos = get_dos_prefix_len( nameW ))) return STATUS_BAD_DEVICE_TYPE; /* no DOS prefix, assume NT native name */ @@ -3610,6 +3610,9 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U int name_len, unix_len; NTSTATUS status; + if (!attr->ObjectName->Buffer && attr->ObjectName->Length) + return STATUS_ACCESS_VIOLATION; + if (!attr->RootDirectory) /* without root dir fall back to normal lookup */ return nt_to_unix_file_name_no_root( attr->ObjectName, name_ret, disposition ); From 83e30e835c2099d9b9ab2e4e704ad64efd2f6cb7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 26 Jun 2020 15:26:53 +0300 Subject: [PATCH 0705/1506] Avoid undefined result in ntdll_wcstoumbs() in case of error. CW-Bug-Id: #17864 Undefined result is due to RtlUnicodeToUTF8N() not setting output length on error which is a correct behaviour according to existing tests. 'Planet Zoo' is affected which passes NULL object name buffer to NtCreateFile(). Signed-off-by: Paul Gofman --- dlls/ntdll/unix/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 9b7c4ea2cd9..ff3f28d93e1 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -399,7 +399,7 @@ DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) */ int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ) { - unsigned int i, reslen; + unsigned int i, reslen = 0; if (unix_cp.CodePage != CP_UTF8) { From da536399f4b3815fde57dbca72cfc23ba5d1a9d3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sat, 22 May 2021 01:23:33 +0300 Subject: [PATCH 0706/1506] server: Update system regs from set_thread_context handler only. CW-Bug-Id: #18957 --- server/thread.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/thread.c b/server/thread.c index 6745b257a7a..8e0d9816996 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1923,9 +1923,7 @@ DECL_HANDLER(select) { apc_call_t *data; data_size_t size = sizeof(*data) + (ctx->regs[CTX_WOW].flags ? 2 : 1) * sizeof(context_t); - unsigned int flags = system_flags & ctx->regs[CTX_NATIVE].flags; - if (flags) set_thread_context( current, &ctx->regs[CTX_NATIVE], flags ); size = min( size, get_reply_max_size() ); if ((data = set_reply_data_size( size ))) { @@ -2171,7 +2169,7 @@ DECL_HANDLER(set_thread_context) unsigned int flags = system_flags & contexts[CTX_NATIVE].flags; if (thread != current) stop_thread( thread ); - else if (flags) set_thread_context( thread, &contexts[CTX_NATIVE], flags ); + if (flags) set_thread_context( thread, &contexts[CTX_NATIVE], flags ); if (thread->context && !get_error()) { From 660ff2f269094bc5e06ea6bd8ec2d6d3c7ec043d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 24 May 2021 14:37:35 +0300 Subject: [PATCH 0707/1506] ntdll: Update cached debug registers in call_init_thunk(). CW-Bug-Id: #18957 --- dlls/ntdll/unix/signal_i386.c | 14 +++++++++++++- dlls/ntdll/unix/signal_x86_64.c | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index d1b2fb66563..3fc563310ce 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -2505,7 +2505,19 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB ((XSAVE_FORMAT *)context.ExtendedRegisters)->MxCsr = 0x1f80; if ((ctx = get_cpu_area( IMAGE_FILE_MACHINE_I386 ))) *ctx = context; - if (suspend) wait_suspend( &context ); + if (suspend) + { + wait_suspend( &context ); + if (context.ContextFlags & CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386) + { + x86_thread_data()->dr0 = context.Dr0; + x86_thread_data()->dr1 = context.Dr1; + x86_thread_data()->dr2 = context.Dr2; + x86_thread_data()->dr3 = context.Dr3; + x86_thread_data()->dr6 = context.Dr6; + x86_thread_data()->dr7 = context.Dr7; + } + } ctx = (CONTEXT *)((ULONG_PTR)context.Esp & ~3) - 1; *ctx = context; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index c1b50af194a..cb3a05883c2 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2794,7 +2794,19 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB *(XSAVE_FORMAT *)wow_context->ExtendedRegisters = context.FltSave; } - if (suspend) wait_suspend( &context ); + if (suspend) + { + wait_suspend( &context ); + if (context.ContextFlags & CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64) + { + amd64_thread_data()->dr0 = context.Dr0; + amd64_thread_data()->dr1 = context.Dr1; + amd64_thread_data()->dr2 = context.Dr2; + amd64_thread_data()->dr3 = context.Dr3; + amd64_thread_data()->dr6 = context.Dr6; + amd64_thread_data()->dr7 = context.Dr7; + } + } ctx = (CONTEXT *)((ULONG_PTR)context.Rsp & ~15) - 1; *ctx = context; From 8d4d307cb20c30e43c14e49578028190abeee676 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sat, 22 May 2021 03:08:55 +0300 Subject: [PATCH 0708/1506] ntdll: Use cached debug registers in NtGetContextThread() if hw debug breakpoints are disabled. CW-Bug-Id: #18957 --- dlls/ntdll/unix/signal_i386.c | 37 ++++++++++++++++++++++++--------- dlls/ntdll/unix/signal_x86_64.c | 37 ++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 3fc563310ce..cb1a1f03199 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1047,10 +1047,15 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) struct syscall_frame *frame = x86_thread_data()->syscall_frame; DWORD needed_flags = context->ContextFlags & ~CONTEXT_i386; BOOL self = (handle == GetCurrentThread()); + BOOL use_cached_debug_regs = FALSE; NTSTATUS ret; - /* debug registers require a server call */ - if (needed_flags & CONTEXT_DEBUG_REGISTERS) self = FALSE; + if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) + { + /* debug registers require a server call if hw breakpoints are enabled */ + if (x86_thread_data()->dr7 & 0xff) self = FALSE; + else use_cached_debug_regs = TRUE; + } if (!self) { @@ -1158,15 +1163,27 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) xstate->YmmContext = frame->xstate.YmmContext; } } - /* update the cached version of the debug registers */ - if (needed_flags & CONTEXT_DEBUG_REGISTERS) + if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386)) { - x86_thread_data()->dr0 = context->Dr0; - x86_thread_data()->dr1 = context->Dr1; - x86_thread_data()->dr2 = context->Dr2; - x86_thread_data()->dr3 = context->Dr3; - x86_thread_data()->dr6 = context->Dr6; - x86_thread_data()->dr7 = context->Dr7; + if (use_cached_debug_regs) + { + context->Dr0 = x86_thread_data()->dr0; + context->Dr1 = x86_thread_data()->dr1; + context->Dr2 = x86_thread_data()->dr2; + context->Dr3 = x86_thread_data()->dr3; + context->Dr6 = x86_thread_data()->dr6; + context->Dr7 = x86_thread_data()->dr7; + } + else + { + /* update the cached version of the debug registers */ + x86_thread_data()->dr0 = context->Dr0; + x86_thread_data()->dr1 = context->Dr1; + x86_thread_data()->dr2 = context->Dr2; + x86_thread_data()->dr3 = context->Dr3; + x86_thread_data()->dr6 = context->Dr6; + x86_thread_data()->dr7 = context->Dr7; + } } } diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index cb3a05883c2..92e5759bc3d 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1084,10 +1084,15 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) { struct syscall_frame *frame = amd64_thread_data()->syscall_frame; DWORD needed_flags = context->ContextFlags & ~CONTEXT_AMD64; + BOOL use_cached_debug_regs = FALSE; BOOL self = (handle == GetCurrentThread()); - /* debug registers require a server call */ - if (needed_flags & CONTEXT_DEBUG_REGISTERS) self = FALSE; + if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) + { + /* debug registers require a server call if hw breakpoints are enabled */ + if (amd64_thread_data()->dr7 & 0xff) self = FALSE; + else use_cached_debug_regs = TRUE; + } if (!self) { @@ -1186,15 +1191,27 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) memcpy( &xstate->YmmContext, &frame->xstate.YmmContext, sizeof(xstate->YmmContext) ); } } - /* update the cached version of the debug registers */ - if (needed_flags & CONTEXT_DEBUG_REGISTERS) + if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) { - amd64_thread_data()->dr0 = context->Dr0; - amd64_thread_data()->dr1 = context->Dr1; - amd64_thread_data()->dr2 = context->Dr2; - amd64_thread_data()->dr3 = context->Dr3; - amd64_thread_data()->dr6 = context->Dr6; - amd64_thread_data()->dr7 = context->Dr7; + if (use_cached_debug_regs) + { + context->Dr0 = amd64_thread_data()->dr0; + context->Dr1 = amd64_thread_data()->dr1; + context->Dr2 = amd64_thread_data()->dr2; + context->Dr3 = amd64_thread_data()->dr3; + context->Dr6 = amd64_thread_data()->dr6; + context->Dr7 = amd64_thread_data()->dr7; + } + else + { + /* update the cached version of the debug registers */ + amd64_thread_data()->dr0 = context->Dr0; + amd64_thread_data()->dr1 = context->Dr1; + amd64_thread_data()->dr2 = context->Dr2; + amd64_thread_data()->dr3 = context->Dr3; + amd64_thread_data()->dr6 = context->Dr6; + amd64_thread_data()->dr7 = context->Dr7; + } } return STATUS_SUCCESS; } From 98bd5df0ee5b718b8b4f62f54757fc6a4e5e8593 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 21 May 2021 15:10:07 +0300 Subject: [PATCH 0709/1506] ntdll: Read process memory on the client side in NtReadVirtualMemory(). CW-Bug-Id: 18957 --- dlls/ntdll/unix/server.c | 2 +- dlls/ntdll/unix/virtual.c | 46 +++++++++++++++++++++++++++++++++++++++ server/process.c | 2 ++ server/protocol.def | 1 + 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 9fb202bc430..1fef65c48ce 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1606,7 +1606,7 @@ size_t server_init_process(void) (version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" ); #if defined(__linux__) && defined(HAVE_PRCTL) /* work around Ubuntu's ptrace breakage */ - if (server_pid != -1) prctl( 0x59616d61 /* PR_SET_PTRACER */, server_pid ); + if (server_pid != -1) prctl( 0x59616d61 /* PR_SET_PTRACER */, PR_SET_PTRACER_ANY ); #endif /* ignore SIGPIPE so that we get an EPIPE error instead */ diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index a2a342e37a2..9a2a40c44ea 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -64,6 +64,8 @@ # include #endif +#include + #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" @@ -6083,7 +6085,50 @@ NTSTATUS WINAPI NtReadVirtualMemory( HANDLE process, const void *addr, void *buf SIZE_T size, SIZE_T *bytes_read ) { unsigned int status; +#ifdef linux + struct iovec local, remote; + int unix_pid; + ssize_t ret; + + SERVER_START_REQ( read_process_memory ) + { + req->handle = wine_server_obj_handle( process ); + status = wine_server_call( req ); + unix_pid = reply->unix_pid; + } + SERVER_END_REQ; + + if (status) + { + WARN( "Could not get unix_pid for process %p, status %#x.\n", process, status ); + size = 0; + goto done; + } + + local.iov_base = buffer; + local.iov_len = size; + remote.iov_base = (void *)addr; + remote.iov_len = size; + + if ((ret = process_vm_readv( unix_pid, &local, 1, &remote, 1, 0 )) != size) + { + WARN( "Error reading memory from process %p, addr %p, size %p, buffer %p, ret %p, errno %d.\n", + process, addr, (void *)size, buffer, (void *)ret, errno ); + + if (ret == -1) + { + status = errno == ESRCH ? STATUS_PARTIAL_COPY : errno_to_status( errno ); + size = 0; + } + else + { + status = STATUS_PARTIAL_COPY; + size = ret; + } + } +done: +#else if (virtual_check_buffer_for_write( buffer, size )) { SERVER_START_REQ( read_process_memory ) @@ -6100,6 +6145,7 @@ NTSTATUS WINAPI NtReadVirtualMemory( HANDLE process, const void *addr, void *buf status = STATUS_ACCESS_VIOLATION; size = 0; } +#endif if (bytes_read) *bytes_read = size; return status; } diff --git a/server/process.c b/server/process.c index 8b867a26c8a..70fc05cb282 100644 --- a/server/process.c +++ b/server/process.c @@ -1682,6 +1682,8 @@ DECL_HANDLER(read_process_memory) if (!(process = get_process_from_handle( req->handle, PROCESS_VM_READ ))) return; + reply->unix_pid = process->unix_pid; + if (len) { char *buffer = mem_alloc( len ); diff --git a/server/protocol.def b/server/protocol.def index d8265e7dcb6..aaf593efbd5 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1858,6 +1858,7 @@ struct process_info obj_handle_t handle; /* process handle */ client_ptr_t addr; /* addr to read from */ @REPLY + int unix_pid; /* Unix pid of new process */ VARARG(data,bytes); /* result data */ @END From 36c2dcd5695f2166da51553d9b777b06e1013ec4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 2 Nov 2020 23:03:20 +0300 Subject: [PATCH 0710/1506] ntdll: Implement CPU topology override. --- dlls/ntdll/unix/server.c | 3 + dlls/ntdll/unix/system.c | 179 +++++++++++++++++++++++++++++---- dlls/ntdll/unix/thread.c | 15 ++- dlls/ntdll/unix/unix_private.h | 1 + server/process.c | 30 ++++++ server/process.h | 2 + server/protocol.def | 7 ++ server/thread.c | 30 +++++- server/trace.c | 19 ++++ 9 files changed, 262 insertions(+), 24 deletions(-) diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 1fef65c48ce..68628acba63 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1675,6 +1675,7 @@ size_t server_init_process(void) */ void server_init_process_done(void) { + struct cpu_topology_override *cpu_override = get_cpu_topology_override(); void *entry, *teb; unsigned int status; int suspend; @@ -1699,6 +1700,8 @@ void server_init_process_done(void) /* Signal the parent process to continue */ SERVER_START_REQ( init_process_done ) { + if (cpu_override) + wine_server_add_data( req, cpu_override, sizeof(*cpu_override) ); req->teb = wine_server_client_ptr( teb ); req->peb = NtCurrentTeb64() ? NtCurrentTeb64()->Peb : wine_server_client_ptr( peb ); #ifdef __i386__ diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 879a5893758..3dc5c704aa9 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -238,6 +239,13 @@ static unsigned int logical_proc_info_ex_size, logical_proc_info_ex_alloc_size; static pthread_mutex_t timezone_mutex = PTHREAD_MUTEX_INITIALIZER; +static struct +{ + struct cpu_topology_override mapping; + BOOL smt; +} +cpu_override; + /******************************************************************************* * Architecture specific feature detection for CPUs * @@ -566,6 +574,91 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info ) #endif /* End architecture specific feature detection for CPUs */ +static void fill_cpu_override(unsigned int host_cpu_count) +{ + const char *env_override = getenv("WINE_CPU_TOPOLOGY"); + unsigned int i; + char *s; + + if (!env_override) + return; + + cpu_override.mapping.cpu_count = strtol(env_override, &s, 10); + if (s == env_override) + goto error; + + if (!cpu_override.mapping.cpu_count || cpu_override.mapping.cpu_count > MAXIMUM_PROCESSORS) + { + ERR("Invalid logical CPU count %u, limit %u.\n", cpu_override.mapping.cpu_count, MAXIMUM_PROCESSORS); + goto error; + } + + if (tolower(*s) == 's') + { + cpu_override.mapping.cpu_count *= 2; + if (cpu_override.mapping.cpu_count > MAXIMUM_PROCESSORS) + { + ERR("Logical CPU count exceeds limit %u.\n", MAXIMUM_PROCESSORS); + goto error; + } + cpu_override.smt = TRUE; + ++s; + } + if (*s != ':') + goto error; + ++s; + for (i = 0; i < cpu_override.mapping.cpu_count; ++i) + { + char *next; + + if (i) + { + if (*s != ',') + { + if (!*s) + ERR("Incomplete host CPU mapping string, %u CPUs mapping required.\n", + cpu_override.mapping.cpu_count); + goto error; + } + ++s; + } + + cpu_override.mapping.host_cpu_id[i] = strtol(s, &next, 10); + if (next == s) + goto error; + if (cpu_override.mapping.host_cpu_id[i] >= host_cpu_count) + { + ERR("Invalid host CPU index %u (host_cpu_count %u).\n", + cpu_override.mapping.host_cpu_id[i], host_cpu_count); + goto error; + } + s = next; + } + if (*s) + goto error; + + if (ERR_ON(ntdll)) + { + MESSAGE("wine: overriding CPU configuration, %u logical CPUs, host CPUs ", cpu_override.mapping.cpu_count); + for (i = 0; i < cpu_override.mapping.cpu_count; ++i) + { + if (i) + MESSAGE(","); + MESSAGE("%u", cpu_override.mapping.host_cpu_id[i]); + } + MESSAGE(".\n"); + } + return; +error: + cpu_override.mapping.cpu_count = 0; + ERR("Invalid WINE_CPU_TOPOLOGY string %s (%s).\n", debugstr_a(env_override), debugstr_a(s)); +} + +struct cpu_topology_override *get_cpu_topology_override(void) +{ + return cpu_override.mapping.cpu_count ? &cpu_override.mapping : NULL; +} + static BOOL grow_logical_proc_buf(void) { SYSTEM_LOGICAL_PROCESSOR_INFORMATION *new_data; @@ -617,6 +710,7 @@ static DWORD count_bits( ULONG_PTR mask ) static BOOL logical_proc_info_ex_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel, DWORD id, ULONG_PTR mask ) { SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *dataex; + unsigned int phys_cpu_id; unsigned int ofs = 0; while (ofs < logical_proc_info_ex_size) @@ -646,8 +740,10 @@ static BOOL logical_proc_info_ex_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel, dataex->Processor.Flags = count_bits( mask ) > 1 ? LTP_PC_SMT : 0; else dataex->Processor.Flags = 0; - if (rel == RelationProcessorCore && id / 32 < performance_cores_capacity) - dataex->Processor.EfficiencyClass = (performance_cores[id / 32] >> (id % 32)) & 1; + + phys_cpu_id = cpu_override.mapping.cpu_count ? cpu_override.mapping.host_cpu_id[id] : id; + if (rel == RelationProcessorCore && phys_cpu_id / 32 < performance_cores_capacity) + dataex->Processor.EfficiencyClass = (performance_cores[phys_cpu_id / 32] >> (phys_cpu_id % 32)) & 1; else dataex->Processor.EfficiencyClass = 0; dataex->Processor.GroupCount = 1; @@ -895,11 +991,13 @@ static NTSTATUS create_logical_proc_info(void) static const char core_info[] = "/sys/devices/system/cpu/cpu%u/topology/%s"; static const char cache_info[] = "/sys/devices/system/cpu/cpu%u/cache/index%u/%s"; static const char numa_info[] = "/sys/devices/system/node/node%u/cpumap"; - + const char *env_fake_logical_cores = getenv("WINE_LOGICAL_CPUS_AS_CORES"); + BOOL fake_logical_cpus_as_cores = env_fake_logical_cores && atoi(env_fake_logical_cores); FILE *fcpu_list, *fnuma_list, *f; unsigned int beg, end, i, j, r, num_cpus = 0, max_cpus = 0; char op, name[MAX_PATH]; ULONG_PTR all_cpus_mask = 0; + unsigned int cpu_id; /* On systems with a large number of CPU cores (32 or 64 depending on 32-bit or 64-bit), * we have issues parsing processor information: @@ -926,6 +1024,12 @@ static NTSTATUS create_logical_proc_info(void) if (op == '-') fscanf(fcpu_list, "%u%c ", &end, &op); else end = beg; + if (cpu_override.mapping.cpu_count) + { + beg = 0; + end = cpu_override.mapping.cpu_count - 1; + } + for(i = beg; i <= end; i++) { unsigned int phys_core = 0; @@ -937,7 +1041,7 @@ static NTSTATUS create_logical_proc_info(void) continue; } - snprintf(name, sizeof(name), core_info, i, "physical_package_id"); + snprintf(name, sizeof(name), core_info, cpu_override.mapping.cpu_count ? cpu_override.mapping.host_cpu_id[i] : i, "physical_package_id"); f = fopen(name, "r"); if (f) { @@ -964,19 +1068,32 @@ static NTSTATUS create_logical_proc_info(void) /* Mask of logical threads sharing same physical core in kernel core numbering. */ snprintf(name, sizeof(name), core_info, i, "thread_siblings"); - if(!sysfs_parse_bitmap(name, &thread_mask)) thread_mask = 1<NumberOfProcessors = num; + + fill_cpu_override(num); + + peb->NumberOfProcessors = cpu_override.mapping.cpu_count + ? cpu_override.mapping.cpu_count : num; get_cpuinfo( &cpu_info ); TRACE( "<- CPU arch %d, level %d, rev %d, features 0x%x\n", (int)cpu_info.ProcessorArchitecture, (int)cpu_info.ProcessorLevel, diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 81420e4c239..88fb940f6a5 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -2471,7 +2471,20 @@ ULONG WINAPI NtGetCurrentProcessorNumber(void) #if defined(__linux__) && defined(__NR_getcpu) int res = syscall(__NR_getcpu, &processor, NULL, NULL); - if (res != -1) return processor; + if (res != -1) + { + struct cpu_topology_override *override = get_cpu_topology_override(); + unsigned int i; + + if (!override) + return processor; + + for (i = 0; i < override->cpu_count; ++i) + if (override->host_cpu_id[i] == processor) + return i; + + WARN("Thread is running on processor which is not in the defined override.\n"); + } #endif if (peb->NumberOfProcessors > 1) diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index c61187266e6..a9b434e39fa 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -327,6 +327,7 @@ extern void init_files(void); extern void init_cpu_info(void); extern void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ); extern void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULONG_PTR information, BOOL mark_pending ); +extern struct cpu_topology_override *get_cpu_topology_override(void); extern NTSTATUS unixcall_wine_dbg_write( void *args ); extern NTSTATUS unixcall_wine_server_call( void *args ); diff --git a/server/process.c b/server/process.c index 70fc05cb282..20d959b661f 100644 --- a/server/process.c +++ b/server/process.c @@ -100,6 +100,7 @@ static void process_destroy( struct object *obj ); static int process_get_esync_fd( struct object *obj, enum esync_type *type ); static unsigned int process_get_fsync_idx( struct object *obj, enum fsync_type *type ); static void terminate_process( struct process *process, struct thread *skip, int exit_code ); +static void set_process_affinity( struct process *process, affinity_t affinity ); static const struct object_ops process_ops = { @@ -695,6 +696,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla memset( &process->image_info, 0, sizeof(process->image_info) ); process->esync_fd = -1; process->fsync_idx = 0; + process->cpu_override.cpu_count = 0; list_init( &process->kernel_object ); list_init( &process->thread_list ); list_init( &process->locks ); @@ -1454,6 +1456,26 @@ DECL_HANDLER(init_process_done) struct memory_view *view; client_ptr_t base; const pe_image_info_t *image_info; + const struct cpu_topology_override *cpu_override = get_req_data(); + unsigned int have_cpu_override = get_req_data_size() / sizeof(*cpu_override); + unsigned int i; + + if (have_cpu_override) + { + if (cpu_override->cpu_count > ARRAY_SIZE(process->wine_cpu_id_from_host)) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + for (i = 0; i < cpu_override->cpu_count; ++i) + { + if (cpu_override->host_cpu_id[i] >= ARRAY_SIZE(process->wine_cpu_id_from_host)) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + } + } if (is_process_init_done(process)) { @@ -1483,6 +1505,14 @@ DECL_HANDLER(init_process_done) if (process->debug_obj) set_process_debug_flag( process, 1 ); reply->entry = current->entry_point; reply->suspend = (current->suspend || process->suspend); + + if (have_cpu_override) + { + process->cpu_override = *cpu_override; + memset( process->wine_cpu_id_from_host, 0, sizeof(process->wine_cpu_id_from_host) ); + for (i = 0; i < process->cpu_override.cpu_count; ++i) + process->wine_cpu_id_from_host[process->cpu_override.host_cpu_id[i]] = i; + } } /* open a handle to a process */ diff --git a/server/process.h b/server/process.h index 4b80b8863b8..112aa5d5062 100644 --- a/server/process.h +++ b/server/process.h @@ -87,6 +87,8 @@ struct process pe_image_info_t image_info; /* main exe image info */ int esync_fd; /* esync file descriptor (signaled on exit) */ unsigned int fsync_idx; + struct cpu_topology_override cpu_override; /* Overridden CPUs to host CPUs mapping. */ + unsigned char wine_cpu_id_from_host[64]; /* Host to overridden CPU mapping. */ }; /* process functions */ diff --git a/server/protocol.def b/server/protocol.def index aaf593efbd5..a82eec95c80 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -893,6 +893,12 @@ typedef struct lparam_t info; } cursor_pos_t; +struct cpu_topology_override +{ + unsigned int cpu_count; + unsigned char host_cpu_id[64]; +}; + struct shared_cursor { int x; /* cursor position */ @@ -1009,6 +1015,7 @@ typedef volatile struct input_shared_memory input_shm_t; client_ptr_t ldt_copy; /* address of LDT copy (in process address space) */ @REPLY client_ptr_t entry; /* process entry point */ + VARARG(cpu_override,cpu_topology_override); /* Overridden CPUs to host CPUs mapping. */ int suspend; /* is process suspended? */ @END diff --git a/server/thread.c b/server/thread.c index 8e0d9816996..8c8d8b868da 100644 --- a/server/thread.c +++ b/server/thread.c @@ -730,8 +730,19 @@ int set_thread_affinity( struct thread *thread, affinity_t affinity ) CPU_ZERO( &set ); for (i = 0, mask = 1; mask; i++, mask <<= 1) - if (affinity & mask) CPU_SET( i, &set ); - + if (affinity & mask) + { + if (thread->process->cpu_override.cpu_count) + { + if (i >= thread->process->cpu_override.cpu_count) + break; + CPU_SET( thread->process->cpu_override.host_cpu_id[i], &set ); + } + else + { + CPU_SET( i, &set ); + } + } ret = sched_setaffinity( thread->unix_tid, sizeof(set), &set ); } #endif @@ -749,8 +760,21 @@ affinity_t get_thread_affinity( struct thread *thread ) unsigned int i; if (!sched_getaffinity( thread->unix_tid, sizeof(set), &set )) + { for (i = 0; i < 8 * sizeof(mask); i++) - if (CPU_ISSET( i, &set )) mask |= (affinity_t)1 << i; + if (CPU_ISSET( i, &set )) + { + if (thread->process->cpu_override.cpu_count) + { + if (i < ARRAY_SIZE(thread->process->wine_cpu_id_from_host)) + mask |= (affinity_t)1 << thread->process->wine_cpu_id_from_host[i]; + } + else + { + mask |= (affinity_t)1 << i; + } + } + } } #endif if (!mask) mask = ~(affinity_t)0; diff --git a/server/trace.c b/server/trace.c index 1b65d2b977e..313a4541a1a 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1383,6 +1383,24 @@ static void dump_varargs_handle_infos( const char *prefix, data_size_t size ) fputc( '}', stderr ); } +static void dump_varargs_cpu_topology_override( const char *prefix, data_size_t size ) +{ + const struct cpu_topology_override *cpu_topology = cur_data; + unsigned int i; + + if (size < sizeof(*cpu_topology)) + return; + + fprintf( stderr,"%s{", prefix ); + for (i = 0; i < cpu_topology->cpu_count; ++i) + { + if (i) fputc( ',', stderr ); + fprintf( stderr, "%u", cpu_topology->host_cpu_id[i] ); + } + fputc( '}', stderr ); + remove_data( size ); +} + typedef void (*dump_func)( const void *req ); /* Everything below this line is generated automatically by tools/make_requests */ @@ -1462,6 +1480,7 @@ static void dump_init_process_done_request( const struct init_process_done_reque static void dump_init_process_done_reply( const struct init_process_done_reply *req ) { dump_uint64( " entry=", &req->entry ); + dump_varargs_cpu_topology_override( ", cpu_override=", cur_size ); fprintf( stderr, ", suspend=%d", req->suspend ); } From 144f57af41c22505ba2f4f5cdfe56eaf4becd184 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 25 Mar 2021 17:53:37 +0300 Subject: [PATCH 0711/1506] wine.inf: Create package repository for VCLibs.140. For Forza Horizon 4. --- loader/wine.inf.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 4b1ce2feece..c9ba98adfd9 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -89,6 +89,7 @@ AddReg=\ MCI,\ Misc,\ OLE,\ + Packages,\ Printing,\ Services, \ SessionMgr,\ @@ -117,6 +118,7 @@ AddReg=\ MCI,\ Misc,\ OLE,\ + Packages.ntamd64,\ Printing,\ Services, \ SessionMgr,\ @@ -145,6 +147,7 @@ AddReg=\ MCI,\ Misc,\ OLE,\ + Packages.ntarm64,\ Printing,\ Services, \ SessionMgr,\ @@ -164,6 +167,7 @@ AddReg=\ DirectX,\ MCI,\ Misc,\ + Packages.wow64,\ Tapi,\ VersionInfo,\ LicenseInformation,\ @@ -274,6 +278,7 @@ CurrentVersionNT="Software\Microsoft\Windows NT\CurrentVersion" FontSubStr="Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes" Control="System\CurrentControlSet\Control" FontsNT="Software\Microsoft\Windows NT\CurrentVersion\Fonts" +Packages="Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages" [Classes] HKCR,.chm,,2,"chm.file" @@ -666,6 +671,18 @@ HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserCho HKLM,"Software\Microsoft\OLE","EnableDCOM",,"Y" HKLM,"Software\Microsoft\OLE","EnableRemoteConnect",,"N" +[Packages] +HKLM,"%Packages%\Microsoft.VCLibs.140.00_14.0.29231.0_x86__8wekyb3d8bbwe","Path",0x00020002,"%SystemRoot%\system32" + +[Packages.ntamd64] +HKLM,"%Packages%\Microsoft.VCLibs.140.00_14.0.29231.0_x64__8wekyb3d8bbwe","Path",0x00020002,"%SystemRoot%\system32" + +[Packages.wow64] +HKLM,"%Packages%\Microsoft.VCLibs.140.00_14.0.29231.0_x86__8wekyb3d8bbwe","Path",0x00020002,"%SystemRoot%\syswow64" + +[Packages.arm64] +HKLM,"%Packages%\Microsoft.VCLibs.140.00_14.0.29231.0_arm64__8wekyb3d8bbwe","Path",0x00020002,"%SystemRoot%\system32" + [Printing] HKLM,%Control%\Print\Monitors\Local Port,"Driver",2,"localspl.dll" HKLM,%Control%\Print\Printers,"DefaultSpoolDirectory",2,"%11%\spool\printers" From 4e98da7ad082fdd5fac76cd3002eb5b813e364d5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 15 Mar 2021 21:59:00 +0300 Subject: [PATCH 0712/1506] kernel32: Implement GetPackagesByPackageFamily(). For Forza Horizon 4. --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/tests/version.c | 132 ++++++++++++++++++++++++++++++++++ dlls/kernelbase/version.c | 131 ++++++++++++++++++++++++++++----- include/appmodel.h | 2 + 4 files changed, 250 insertions(+), 17 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index bb9c8fbfe0e..d9c5548c659 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -774,7 +774,7 @@ @ stdcall -import GetUserPreferredUILanguages(long ptr ptr ptr) @ stdcall GetPackageFamilyName(long ptr ptr) kernelbase.GetPackageFamilyName @ stdcall GetPackageFullName(long ptr ptr) kernelbase.GetPackageFullName -@ stdcall GetPackagesByPackageFamily(wstr ptr ptr ptr ptr) kernelbase.GetPackagesByPackageFamily +@ stdcall -import GetPackagesByPackageFamily(wstr ptr ptr ptr ptr) @ stdcall GetPackagePathByFullName(wstr ptr wstr) kernelbase.GetPackagePathByFullName @ stdcall -import GetPhysicallyInstalledSystemMemory(ptr) @ stdcall -import GetPriorityClass(long) diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c index 1c280d2b2eb..27c8ea04b76 100644 --- a/dlls/kernel32/tests/version.c +++ b/dlls/kernel32/tests/version.c @@ -23,6 +23,7 @@ #include "winternl.h" #include "appmodel.h" +static LONG (WINAPI * pGetPackagesByPackageFamily)(const WCHAR *, UINT32 *, WCHAR **, UINT32 *, WCHAR *); static BOOL (WINAPI * pGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD *); static UINT (WINAPI * pGetSystemFirmwareTable)(DWORD, DWORD, void *, DWORD); static LONG (WINAPI * pPackageIdFromFullName)(const WCHAR *, UINT32, UINT32 *, BYTE *); @@ -43,6 +44,7 @@ static void init_function_pointers(void) hmod = GetModuleHandleA("kernel32.dll"); + GET_PROC(GetPackagesByPackageFamily); GET_PROC(GetProductInfo); GET_PROC(GetSystemFirmwareTable); GET_PROC(PackageIdFromFullName); @@ -1075,6 +1077,135 @@ static void test_pe_os_version(void) } } + +static void test_package_info(void) +{ + static const WCHAR package_family_msvc140[] = L"Microsoft.VCLibs.140.00_8wekyb3d8bbwe"; + UINT32 count, length, curr_length, size; + WCHAR *full_names[32]; + BYTE id_buffer[512]; + WCHAR buffer[2048]; + BOOL arch_found; + SYSTEM_INFO si; + unsigned int i; + PACKAGE_ID *id; + DWORD arch; + LONG ret; + + if (!pGetPackagesByPackageFamily) + { + win_skip("GetPackagesByPackageFamily not available.\n"); + return; + } + + GetSystemInfo(&si); + arch = si.wProcessorArchitecture; + + count = 0; + length = 0; + ret = pGetPackagesByPackageFamily(L"Unknown_8wekyb3d8bbwe", &count, NULL, &length, NULL); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(!count, "Got unexpected count %u.\n", count); + ok(!length, "Got unexpected length %u.\n", length); + + count = 0; + length = 0; + ret = pGetPackagesByPackageFamily(L"Unknown_iekyb3d8bbwe", &count, NULL, &length, NULL); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(!count, "Got unexpected count %u.\n", count); + ok(!length, "Got unexpected length %u.\n", length); + + count = 0xdeadbeef; + length = 0xdeadbeef; + ret = pGetPackagesByPackageFamily(L"Unknown", &count, NULL, &length, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(count == 0xdeadbeef, "Got unexpected count %u.\n", count); + ok(length == 0xdeadbeef, "Got unexpected length %u.\n", length); + + count = 0; + length = 0; + ret = pGetPackagesByPackageFamily(L"Unknown", &count, NULL, &length, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(!count, "Got unexpected count %u.\n", count); + ok(!length, "Got unexpected length %u.\n", length); + + count = 0; + length = 0; + ret = pGetPackagesByPackageFamily(L"Unknown_8wekyb3d8bbwe_b", &count, NULL, &length, NULL); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(!count, "Got unexpected count %u.\n", count); + ok(!length, "Got unexpected length %u.\n", length); + + count = 0; + length = 0; + ret = pGetPackagesByPackageFamily(L"Unknown_", &count, NULL, &length, NULL); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(!count, "Got unexpected count %u.\n", count); + ok(!length, "Got unexpected length %u.\n", length); + + length = 0; + ret = pGetPackagesByPackageFamily(package_family_msvc140, NULL, NULL, &length, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(!length, "Got unexpected length %u.\n", length); + + count = 0; + ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, NULL, NULL, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(!count, "Got unexpected count %u.\n", count); + + count = ARRAY_SIZE(full_names); + length = ARRAY_SIZE(buffer); + ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, NULL, &length, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(count == ARRAY_SIZE(full_names), "Got unexpected count %u.\n", count); + ok(length == ARRAY_SIZE(buffer), "Got unexpected length %u.\n", length); + + ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, full_names, &length, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(count == ARRAY_SIZE(full_names), "Got unexpected count %u.\n", count); + ok(length == ARRAY_SIZE(buffer), "Got unexpected length %u.\n", length); + + ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, NULL, &length, buffer); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + ok(count == ARRAY_SIZE(full_names), "Got unexpected count %u.\n", count); + ok(length == ARRAY_SIZE(buffer), "Got unexpected length %u.\n", length); + + count = 0; + length = 0; + ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, NULL, &length, NULL); + if (!ret && !count && !length) + { + win_skip("Package VCLibs.140.00 is not installed.\n"); + return; + } + + ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %u.\n", ret); + ok(count >= 1, "Got unexpected count %u.\n", count); + ok(length > 1, "Got unexpected length %u.\n", length); + + ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, full_names, &length, buffer); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(count >= 1, "Got unexpected count %u.\n", count); + ok(length > 1, "Got unexpected length %u.\n", length); + + id = (PACKAGE_ID *)id_buffer; + curr_length = 0; + arch_found = FALSE; + for (i = 0; i < count; ++i) + { + curr_length += lstrlenW(full_names[i]) + 1; + + size = sizeof(id_buffer); + ret = pPackageIdFromFullName(full_names[i], 0, &size, id_buffer); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + + if (id->processorArchitecture == arch) + arch_found = TRUE; + } + ok(curr_length == length, "Got unexpected length %u.\n", length); + ok(arch_found, "Did not find package for current arch.\n"); +} + START_TEST(version) { char **argv; @@ -1102,4 +1233,5 @@ START_TEST(version) test_pe_os_version(); test_GetSystemFirmwareTable(); test_PackageIdFromFullName(); + test_package_info(); } diff --git a/dlls/kernelbase/version.c b/dlls/kernelbase/version.c index 0636634badb..e3ea92d24d8 100644 --- a/dlls/kernelbase/version.c +++ b/dlls/kernelbase/version.c @@ -37,10 +37,12 @@ #include "winnls.h" #include "winternl.h" #include "winerror.h" +#include "winreg.h" #include "appmodel.h" #include "kernelbase.h" #include "wine/debug.h" +#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(ver); @@ -159,6 +161,8 @@ static const struct } }; +static const WCHAR packages_key_name[] = L"Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows" + L"\\CurrentVersion\\AppModel\\PackageRepository\\Packages"; /****************************************************************************** * init_current_version @@ -1602,22 +1606,6 @@ LONG WINAPI /* DECLSPEC_HOTPATCH */ GetPackageFamilyName( HANDLE process, UINT32 return APPMODEL_ERROR_NO_PACKAGE; } -/*********************************************************************** - * GetPackagesByPackageFamily (kernelbase.@) - */ -LONG WINAPI DECLSPEC_HOTPATCH GetPackagesByPackageFamily(const WCHAR *family_name, UINT32 *count, - WCHAR *full_names, UINT32 *buffer_len, WCHAR *buffer) -{ - FIXME( "(%s %p %p %p %p): stub\n", debugstr_w(family_name), count, full_names, buffer_len, buffer ); - - if (!count || !buffer_len) - return ERROR_INVALID_PARAMETER; - - *count = 0; - *buffer_len = 0; - return ERROR_SUCCESS; -} - /*********************************************************************** * GetPackagePathByFullName (kernelbase.@) */ @@ -1744,3 +1732,114 @@ LONG WINAPI PackageIdFromFullName(const WCHAR *full_name, UINT32 flags, UINT32 * return ERROR_SUCCESS; } + + +/*********************************************************************** + * GetPackagesByPackageFamily (kernelbase.@) + */ +LONG WINAPI GetPackagesByPackageFamily(const WCHAR *family_name, UINT32 *count, WCHAR **full_names, + UINT32 *buffer_length, WCHAR *buffer) +{ + UINT32 curr_count, curr_length, package_id_buf_size, size; + unsigned int i, name_len, publisher_id_len; + DWORD subkey_count, max_key_len, length; + const WCHAR *publisher_id; + WCHAR *package_name; + BOOL short_buffer; + PACKAGE_ID *id; + HKEY key; + + TRACE("family_name %s, count %p, full_names %p, buffer_length %p, buffer %p.\n", + debugstr_w(family_name), count, full_names, buffer_length, buffer); + + if (!buffer_length || !count || !family_name) + return ERROR_INVALID_PARAMETER; + + if ((*buffer_length || *count) && (!full_names || !buffer)) + return ERROR_INVALID_PARAMETER; + + if (!(publisher_id = wcschr(family_name, L'_'))) + return ERROR_INVALID_PARAMETER; + + name_len = publisher_id - family_name; + ++publisher_id; + publisher_id_len = lstrlenW(publisher_id); + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, packages_key_name, 0, KEY_READ, &key)) + { + ERR("Key open failed.\n"); + *count = 0; + *buffer_length = 0; + return ERROR_SUCCESS; + } + if (RegQueryInfoKeyW(key, NULL, NULL, NULL, &subkey_count, &max_key_len, NULL, NULL, NULL, NULL, NULL, NULL)) + { + ERR("Query key info failed.\n"); + RegCloseKey(key); + *count = 0; + *buffer_length = 0; + return ERROR_SUCCESS; + } + + if (!(package_name = heap_alloc((max_key_len + 1) * sizeof(*package_name)))) + { + ERR("No memory.\n"); + RegCloseKey(key); + return ERROR_OUTOFMEMORY; + } + + package_id_buf_size = sizeof(*id) + (max_key_len + 1) * sizeof(WCHAR); + if (!(id = heap_alloc(package_id_buf_size))) + { + ERR("No memory.\n"); + heap_free(package_name); + RegCloseKey(key); + return ERROR_OUTOFMEMORY; + } + + curr_count = curr_length = 0; + for (i = 0; i < subkey_count; ++i) + { + length = max_key_len + 1; + if (RegEnumKeyExW(key, i, package_name, &length, NULL, NULL, NULL, NULL)) + { + ERR("Error enumerating key %u.\n", i); + continue; + } + + size = package_id_buf_size; + if (PackageIdFromFullName(package_name, 0, &size, (BYTE *)id)) + { + ERR("Error getting package id from full name.\n"); + continue; + } + + if (lstrlenW(id->name) != name_len) + continue; + if (wcsnicmp(family_name, id->name, name_len)) + continue; + + if (lstrlenW(id->publisherId) != publisher_id_len) + continue; + if (wcsnicmp(publisher_id, id->publisherId, publisher_id_len)) + continue; + if (curr_length + length < *buffer_length) + { + memcpy(buffer + curr_length, package_name, (length + 1) * sizeof(*package_name)); + if (curr_count < *count) + full_names[curr_count] = buffer + curr_length; + } + curr_length += length + 1; + ++curr_count; + } + + heap_free(id); + heap_free(package_name); + RegCloseKey(key); + + short_buffer = curr_length > *buffer_length || curr_count > *count; + *count = curr_count; + *buffer_length = curr_length; + + return short_buffer ? ERROR_INSUFFICIENT_BUFFER : ERROR_SUCCESS; +} diff --git a/include/appmodel.h b/include/appmodel.h index 8c219e8080a..1e7eb88a43b 100644 --- a/include/appmodel.h +++ b/include/appmodel.h @@ -89,6 +89,8 @@ LONG WINAPI AppPolicyGetProcessTerminationMethod(HANDLE token, AppPolicyProcessT LONG WINAPI AppPolicyGetShowDeveloperDiagnostic(HANDLE token, AppPolicyShowDeveloperDiagnostic *policy); LONG WINAPI AppPolicyGetThreadInitializationType(HANDLE token, AppPolicyThreadInitializationType *policy); LONG WINAPI AppPolicyGetWindowingModel(HANDLE processToken, AppPolicyWindowingModel *policy); +LONG WINAPI GetPackagesByPackageFamily(const WCHAR *family_name, UINT32 *count, WCHAR **full_names, + UINT32 *buffer_length, WCHAR *buffer); LONG WINAPI PackageIdFromFullName(const WCHAR *full_name, UINT32 flags, UINT32 *buffer_length, BYTE *buffer); #if defined(__cplusplus) From ab0981928bad9f5c40b0c4b1d4cb9cbd5ca9e288 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 26 Mar 2021 01:10:08 +0300 Subject: [PATCH 0713/1506] kernel32: Implement PackageFullNameFromId(). For Forza Horizon 4. --- dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/tests/version.c | 22 ++++++++++++++++- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/version.c | 43 +++++++++++++++++++++++++++++++++ include/appmodel.h | 1 + 5 files changed, 67 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index d9c5548c659..1d1f4a03ae3 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1163,6 +1163,7 @@ @ stdcall -import PeekConsoleInputW(ptr ptr long ptr) @ stdcall -import PeekNamedPipe(long ptr long ptr ptr ptr) @ stdcall -import PostQueuedCompletionStatus(long long ptr ptr) +@ stdcall -import PackageFullNameFromId(ptr ptr ptr) @ stdcall -import PackageIdFromFullName(wstr long ptr ptr) @ stdcall PowerClearRequest(long long) @ stdcall PowerCreateRequest(ptr) diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c index 27c8ea04b76..799ad475fb9 100644 --- a/dlls/kernel32/tests/version.c +++ b/dlls/kernel32/tests/version.c @@ -26,6 +26,7 @@ static LONG (WINAPI * pGetPackagesByPackageFamily)(const WCHAR *, UINT32 *, WCHAR **, UINT32 *, WCHAR *); static BOOL (WINAPI * pGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD *); static UINT (WINAPI * pGetSystemFirmwareTable)(DWORD, DWORD, void *, DWORD); +static LONG (WINAPI * pPackageFullNameFromId)(const PACKAGE_ID *, UINT32 *, WCHAR *); static LONG (WINAPI * pPackageIdFromFullName)(const WCHAR *, UINT32, UINT32 *, BYTE *); static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, void *, ULONG, ULONG *); static NTSTATUS (WINAPI * pRtlGetVersion)(RTL_OSVERSIONINFOEXW *); @@ -47,6 +48,7 @@ static void init_function_pointers(void) GET_PROC(GetPackagesByPackageFamily); GET_PROC(GetProductInfo); GET_PROC(GetSystemFirmwareTable); + GET_PROC(PackageFullNameFromId); GET_PROC(PackageIdFromFullName); hmod = GetModuleHandleA("ntdll.dll"); @@ -803,9 +805,11 @@ static void test_PackageIdFromFullName(void) { 0, PROCESSOR_ARCHITECTURE_INTEL, {{.Major = 1, .Minor = 2, .Build = 3, .Revision = 4}}, - (WCHAR *)L"TestPackage", NULL, + (WCHAR *)L"TestPackage", (WCHAR *)L"TestResource", (WCHAR *)L"TestResourceId", (WCHAR *)L"0abcdefghjkme" }; + static const WCHAR test_package_fullname[] = + L"TestPackage_1.2.3.4_x86_TestResourceId_0abcdefghjkme"; UINT32 size, expected_size; PACKAGE_ID test_id; WCHAR fullname[512]; @@ -918,6 +922,22 @@ static void test_PackageIdFromFullName(void) size = sizeof(id_buffer); ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86_0abcdefghjkme", 0, &size, id_buffer); ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %lu.\n", ret); + + ret = pPackageFullNameFromId(&test_package_id, NULL, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + + size = sizeof(fullname); + ret = pPackageFullNameFromId(&test_package_id, &size, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + + size = 0; + ret = pPackageFullNameFromId(&test_package_id, &size, NULL); + ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %u.\n", ret); + ok(size == lstrlenW(test_package_fullname) + 1, "Got unexpected size %u.\n", size); + + ret = pPackageFullNameFromId(&test_package_id, &size, fullname); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(!lstrcmpW(fullname, test_package_fullname), "Got unexpected fullname %s.\n", debugstr_w(fullname)); } #define TEST_VERSION_WIN7 1 diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index ffb153a46ee..3f034da248b 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1043,7 +1043,7 @@ # @ stub PackageFamilyNameFromFullName # @ stub PackageFamilyNameFromId # @ stub PackageFamilyNameFromProductId -# @ stub PackageFullNameFromId +@ stdcall PackageFullNameFromId(ptr ptr ptr) # @ stub PackageFullNameFromProductId @ stdcall PackageIdFromFullName(wstr long ptr ptr) # @ stub PackageIdFromProductId diff --git a/dlls/kernelbase/version.c b/dlls/kernelbase/version.c index e3ea92d24d8..4f620a343df 100644 --- a/dlls/kernelbase/version.c +++ b/dlls/kernelbase/version.c @@ -1644,6 +1644,16 @@ static UINT32 processor_arch_from_string(const WCHAR *str, unsigned int len) return ~0u; } +const WCHAR *string_from_processor_arch(UINT32 code) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(arch_names); ++i) + if (code == arch_names[i].code) + return arch_names[i].name; + return NULL; +} + /*********************************************************************** * PackageIdFromFullName (kernelbase.@) */ @@ -1734,6 +1744,39 @@ LONG WINAPI PackageIdFromFullName(const WCHAR *full_name, UINT32 flags, UINT32 * } +/*********************************************************************** + * PackageFullNameFromId (kernelbase.@) + */ +LONG WINAPI PackageFullNameFromId(const PACKAGE_ID *package_id, UINT32 *length, WCHAR *full_name) +{ + WCHAR ver_str[5 * 4 + 3 + 1]; + const WCHAR *arch_str; + UINT32 have_length; + + TRACE("package_id %p, length %p, full_name %p.\n", package_id, length, full_name); + + if (!package_id || !length) + return ERROR_INVALID_PARAMETER; + if (!full_name && *length) + return ERROR_INVALID_PARAMETER; + if (!package_id->name || !package_id->resourceId || !package_id->publisherId + || !(arch_str = string_from_processor_arch(package_id->processorArchitecture))) + return ERROR_INVALID_PARAMETER; + + swprintf(ver_str, ARRAY_SIZE(ver_str), L"%u.%u.%u.%u", package_id->version.Major, + package_id->version.Minor, package_id->version.Build, package_id->version.Revision); + have_length = *length; + *length = lstrlenW(package_id->name) + 1 + lstrlenW(ver_str) + 1 + lstrlenW(arch_str) + 1 + + lstrlenW(package_id->resourceId) + 1 + lstrlenW(package_id->publisherId) + 1; + + if (have_length < *length) + return ERROR_INSUFFICIENT_BUFFER; + + swprintf(full_name, *length, L"%s_%s_%s_%s_%s", package_id->name, ver_str, arch_str, package_id->resourceId, package_id->publisherId); + return ERROR_SUCCESS; +} + + /*********************************************************************** * GetPackagesByPackageFamily (kernelbase.@) */ diff --git a/include/appmodel.h b/include/appmodel.h index 1e7eb88a43b..c3a42567a42 100644 --- a/include/appmodel.h +++ b/include/appmodel.h @@ -91,6 +91,7 @@ LONG WINAPI AppPolicyGetThreadInitializationType(HANDLE token, AppPolicyThreadIn LONG WINAPI AppPolicyGetWindowingModel(HANDLE processToken, AppPolicyWindowingModel *policy); LONG WINAPI GetPackagesByPackageFamily(const WCHAR *family_name, UINT32 *count, WCHAR **full_names, UINT32 *buffer_length, WCHAR *buffer); +LONG WINAPI PackageFullNameFromId(const PACKAGE_ID *package_id, UINT32 *length, WCHAR *full_name); LONG WINAPI PackageIdFromFullName(const WCHAR *full_name, UINT32 flags, UINT32 *buffer_length, BYTE *buffer); #if defined(__cplusplus) From 6bc06a511cd6fa3b5c939ba7701344eb4bc38835 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 15 Mar 2021 22:05:19 +0300 Subject: [PATCH 0714/1506] kernel32: Implement GetPackagePath(). For Forza Horizon 4. --- dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/tests/version.c | 64 +++++++++++++++++++++++-- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/version.c | 82 +++++++++++++++++++++++++++++++++ include/appmodel.h | 1 + 5 files changed, 144 insertions(+), 6 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 1d1f4a03ae3..35d7d1eb9c4 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -774,6 +774,7 @@ @ stdcall -import GetUserPreferredUILanguages(long ptr ptr ptr) @ stdcall GetPackageFamilyName(long ptr ptr) kernelbase.GetPackageFamilyName @ stdcall GetPackageFullName(long ptr ptr) kernelbase.GetPackageFullName +@ stdcall -import GetPackagePath(ptr long ptr ptr) @ stdcall -import GetPackagesByPackageFamily(wstr ptr ptr ptr ptr) @ stdcall GetPackagePathByFullName(wstr ptr wstr) kernelbase.GetPackagePathByFullName @ stdcall -import GetPhysicallyInstalledSystemMemory(ptr) diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c index 799ad475fb9..1db7053ea3b 100644 --- a/dlls/kernel32/tests/version.c +++ b/dlls/kernel32/tests/version.c @@ -23,6 +23,7 @@ #include "winternl.h" #include "appmodel.h" +static LONG (WINAPI * pGetPackagePath)(const PACKAGE_ID *, const UINT32, UINT32 *, WCHAR *); static LONG (WINAPI * pGetPackagesByPackageFamily)(const WCHAR *, UINT32 *, WCHAR **, UINT32 *, WCHAR *); static BOOL (WINAPI * pGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD *); static UINT (WINAPI * pGetSystemFirmwareTable)(DWORD, DWORD, void *, DWORD); @@ -45,6 +46,7 @@ static void init_function_pointers(void) hmod = GetModuleHandleA("kernel32.dll"); + GET_PROC(GetPackagePath); GET_PROC(GetPackagesByPackageFamily); GET_PROC(GetProductInfo); GET_PROC(GetSystemFirmwareTable); @@ -1101,15 +1103,15 @@ static void test_pe_os_version(void) static void test_package_info(void) { static const WCHAR package_family_msvc140[] = L"Microsoft.VCLibs.140.00_8wekyb3d8bbwe"; - UINT32 count, length, curr_length, size; + UINT32 count, length, curr_length, size, path_length, total_length; + WCHAR buffer[2048], path[MAX_PATH]; + PACKAGE_ID *id, saved_id; WCHAR *full_names[32]; BYTE id_buffer[512]; - WCHAR buffer[2048]; + DWORD arch, attrib; BOOL arch_found; SYSTEM_INFO si; unsigned int i; - PACKAGE_ID *id; - DWORD arch; LONG ret; if (!pGetPackagesByPackageFamily) @@ -1190,6 +1192,10 @@ static void test_package_info(void) ok(count == ARRAY_SIZE(full_names), "Got unexpected count %u.\n", count); ok(length == ARRAY_SIZE(buffer), "Got unexpected length %u.\n", length); + length = 0; + ret = pGetPackagePath(NULL, 0, &length, NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + count = 0; length = 0; ret = pGetPackagesByPackageFamily(package_family_msvc140, &count, NULL, &length, NULL); @@ -1208,6 +1214,7 @@ static void test_package_info(void) ok(count >= 1, "Got unexpected count %u.\n", count); ok(length > 1, "Got unexpected length %u.\n", length); + total_length = length; id = (PACKAGE_ID *)id_buffer; curr_length = 0; arch_found = FALSE; @@ -1221,9 +1228,56 @@ static void test_package_info(void) if (id->processorArchitecture == arch) arch_found = TRUE; + + path_length = 0; + ret = pGetPackagePath(id, 0, &path_length, NULL); + ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %u.\n", ret); + ok(path_length > 1, "Got unexpected path_length %u.\n", path_length); + + length = path_length; + ret = pGetPackagePath(id, 0, &length, path); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + ok(length == path_length, "Got unexpected length %u.\n", length); + attrib = GetFileAttributesW(path); + ok(attrib != INVALID_FILE_ATTRIBUTES && attrib & FILE_ATTRIBUTE_DIRECTORY, + "Got unexpected attrib %#x, GetLastError() %u.\n", attrib, GetLastError()); } - ok(curr_length == length, "Got unexpected length %u.\n", length); + ok(curr_length == total_length, "Got unexpected length %u.\n", length); ok(arch_found, "Did not find package for current arch.\n"); + + size = sizeof(id_buffer); + ret = pPackageIdFromFullName(full_names[0], 0, &size, id_buffer); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + saved_id = *id; + + id->publisherId = NULL; + length = ARRAY_SIZE(path); + ret = pGetPackagePath(id, 0, &length, path); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + + *id = saved_id; + id->name = NULL; + length = ARRAY_SIZE(path); + ret = pGetPackagePath(id, 0, &length, path); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + + *id = saved_id; + id->publisher = NULL; + length = ARRAY_SIZE(path); + ret = pGetPackagePath(id, 0, &length, path); + ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret); + + *id = saved_id; + id->processorArchitecture = ~0u; + length = ARRAY_SIZE(path); + ret = pGetPackagePath(id, 0, &length, path); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret); + + *id = saved_id; + id->name[0] = L'X'; + length = ARRAY_SIZE(path); + ret = pGetPackagePath(id, 0, &length, path); + ok(ret == ERROR_NOT_FOUND, "Got unexpected ret %u.\n", ret); } START_TEST(version) diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 3f034da248b..4e8b741d1b5 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -630,7 +630,7 @@ # @ stub GetPackageInfo # @ stub GetPackageInstallTime # @ stub GetPackageOSMaxVersionTested -# @ stub GetPackagePath +@ stdcall GetPackagePath(ptr long ptr ptr) @ stdcall GetPackagePathByFullName(wstr ptr wstr) # @ stub GetPackagePathOnVolume # @ stub GetPackageProperty diff --git a/dlls/kernelbase/version.c b/dlls/kernelbase/version.c index 4f620a343df..6ce0aaaada1 100644 --- a/dlls/kernelbase/version.c +++ b/dlls/kernelbase/version.c @@ -1886,3 +1886,85 @@ LONG WINAPI GetPackagesByPackageFamily(const WCHAR *family_name, UINT32 *count, return short_buffer ? ERROR_INSUFFICIENT_BUFFER : ERROR_SUCCESS; } + + +/*********************************************************************** + * GetPackagePath (kernelbase.@) + */ +LONG WINAPI GetPackagePath(const PACKAGE_ID *package_id, const UINT32 reserved, UINT32 *length, WCHAR *path) +{ + WCHAR *key_name = NULL, *expanded_path = NULL; + UINT32 required_length, have_length; + unsigned int offset; + HKEY key = NULL; + DWORD size; + LONG ret; + + TRACE("package_id %p, reserved %u, length %p, path %p.\n", package_id, reserved, length, path); + + if (!length) + return ERROR_INVALID_PARAMETER; + if (!path && *length) + return ERROR_INVALID_PARAMETER; + + required_length = 0; + if ((ret = PackageFullNameFromId(package_id, &required_length, NULL)) != ERROR_INSUFFICIENT_BUFFER) + return ret; + + offset = lstrlenW(packages_key_name) + 1; + if (!(key_name = heap_alloc((offset + required_length) * sizeof(WCHAR)))) + { + ERR("No memory."); + return ERROR_OUTOFMEMORY; + } + + if ((ret = PackageFullNameFromId(package_id, &required_length, key_name + offset))) + goto done; + + memcpy(key_name, packages_key_name, (offset - 1) * sizeof(WCHAR)); + key_name[offset - 1] = L'\\'; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, key_name, 0, KEY_READ, &key)) + { + WARN("Key %s not found.\n", debugstr_w(key_name)); + ret = ERROR_NOT_FOUND; + goto done; + } + if (RegGetValueW(key, NULL, L"Path", RRF_RT_REG_SZ, NULL, NULL, &size)) + { + WARN("Path value not found in %s.\n", debugstr_w(key_name)); + ret = ERROR_NOT_FOUND; + goto done; + } + if (!(expanded_path = heap_alloc(size))) + { + ERR("No memory."); + ret = ERROR_OUTOFMEMORY; + goto done; + } + if (RegGetValueW(key, NULL, L"Path", RRF_RT_REG_SZ, NULL, expanded_path, &size)) + { + WARN("Could not get Path value from %s.\n", debugstr_w(key_name)); + ret = ERROR_NOT_FOUND; + goto done; + } + + have_length = *length; + *length = lstrlenW(expanded_path) + 1; + if (have_length >= *length) + { + memcpy(path, expanded_path, *length * sizeof(*path)); + ret = ERROR_SUCCESS; + } + else + { + ret = ERROR_INSUFFICIENT_BUFFER; + } + +done: + if (key) + RegCloseKey(key); + heap_free(expanded_path); + heap_free(key_name); + return ret; +} diff --git a/include/appmodel.h b/include/appmodel.h index c3a42567a42..cab001f60c7 100644 --- a/include/appmodel.h +++ b/include/appmodel.h @@ -89,6 +89,7 @@ LONG WINAPI AppPolicyGetProcessTerminationMethod(HANDLE token, AppPolicyProcessT LONG WINAPI AppPolicyGetShowDeveloperDiagnostic(HANDLE token, AppPolicyShowDeveloperDiagnostic *policy); LONG WINAPI AppPolicyGetThreadInitializationType(HANDLE token, AppPolicyThreadInitializationType *policy); LONG WINAPI AppPolicyGetWindowingModel(HANDLE processToken, AppPolicyWindowingModel *policy); +LONG WINAPI GetPackagePath(const PACKAGE_ID *package_id, const UINT32 reserved, UINT32 *length, WCHAR *path); LONG WINAPI GetPackagesByPackageFamily(const WCHAR *family_name, UINT32 *count, WCHAR **full_names, UINT32 *buffer_length, WCHAR *buffer); LONG WINAPI PackageFullNameFromId(const PACKAGE_ID *package_id, UINT32 *length, WCHAR *full_name); From 89833b18fb64c262e8af31873b536890373bb625 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 27 Sep 2022 11:30:06 -0500 Subject: [PATCH 0715/1506] kernelbase: HACK: Do not expose version info for builtin DLLs for VC redists. So VC Runtime 2013 redist actually installs the libraries. CW-Bug-Id: #21343 --- dlls/kernelbase/version.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dlls/kernelbase/version.c b/dlls/kernelbase/version.c index 6ce0aaaada1..7a980493aaa 100644 --- a/dlls/kernelbase/version.c +++ b/dlls/kernelbase/version.c @@ -780,6 +780,27 @@ DWORD WINAPI GetFileVersionInfoSizeExW( DWORD flags, LPCWSTR filename, LPDWORD r if ((hModule = LoadLibraryExW( filename, 0, LOAD_LIBRARY_AS_IMAGE_RESOURCE ))) { HRSRC hRsrc = NULL; + + static const char builtin_signature[] = "Wine builtin DLL"; + HMODULE mod = (HMODULE)((ULONG_PTR)hModule & ~(ULONG_PTR)3); + char *signature = (char *)((IMAGE_DOS_HEADER *)mod + 1); + WCHAR exe_name[MAX_PATH]; + IMAGE_NT_HEADERS *nt; + DWORD exe_name_len; + + if ((exe_name_len = GetModuleFileNameW( NULL, exe_name, ARRAY_SIZE(exe_name) )) + && exe_name_len >= 16 + && (!memcmp( exe_name + exe_name_len - 16, L"vcredist_x64.exe", 16 * sizeof(*exe_name) ) + || !memcmp( exe_name + exe_name_len - 16, L"vcredist_x86.exe", 16 * sizeof(*exe_name) )) + && (nt = RtlImageNtHeader( mod )) && (char *)nt - signature >= sizeof(builtin_signature) + && !memcmp( signature, builtin_signature, sizeof(builtin_signature) )) + { + ERR("HACK: not exposing version info.\n"); + FreeLibrary( hModule ); + SetLastError( ERROR_RESOURCE_NAME_NOT_FOUND ); + return 0; + } + if (!(flags & FILE_VER_GET_LOCALISED)) { LANGID english = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); From f5a6936f1411f14048264a848f21304b97e2b8cd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 30 Jul 2021 21:01:13 +0300 Subject: [PATCH 0716/1506] kernelbase: HACK: Force CEF software rendering for UplayWebCore. Work around Uplay crash. (To be revisited once builtin d3dcompiler is added). --- dlls/kernelbase/process.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 6af6cd4a6e3..f81bb821ea8 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -32,6 +32,7 @@ #include "kernelbase.h" #include "wine/debug.h" #include "wine/condrv.h" +#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(process); @@ -541,7 +542,31 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR } else { - if (!(tidy_cmdline = get_file_name( cmd_line, name, ARRAY_SIZE(name) ))) return FALSE; + static const WCHAR *opt = L" --use-gl=swiftshader"; + WCHAR *cmdline_new = NULL; + + if (cmd_line && wcsstr( cmd_line, L"UplayWebCore.exe" )) + { + FIXME( "HACK: appending %s to command line %s.\n", debugstr_w(opt), debugstr_w(cmd_line) ); + + cmdline_new = heap_alloc( sizeof(WCHAR) * (lstrlenW(cmd_line) + lstrlenW(opt) + 1) ); + lstrcpyW(cmdline_new, cmd_line); + lstrcatW(cmdline_new, opt); + } + + tidy_cmdline = get_file_name( cmdline_new ? cmdline_new : cmd_line, name, ARRAY_SIZE(name) ); + + if (!tidy_cmdline) + { + heap_free( cmdline_new ); + return FALSE; + } + + if (cmdline_new) + { + if (cmdline_new == tidy_cmdline) cmd_line = NULL; + else heap_free( cmdline_new ); + } app_name = name; } From 26b0f8c2bbbc4e6c84deaf92e442d82c22644856 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Jul 2021 17:36:04 +0300 Subject: [PATCH 0717/1506] kernel32: Align stack pointer for lstrcpyA() on x64. For Blood of Steel crash on launch. CW-Bug-Id: #19148 --- dlls/kernel32/virtual.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c index 0314b362e86..c4b4fc225a4 100644 --- a/dlls/kernel32/virtual.c +++ b/dlls/kernel32/virtual.c @@ -35,6 +35,7 @@ #include "psapi.h" #include "wine/exception.h" #include "wine/debug.h" +#include "wine/asm.h" #include "kernel_private.h" @@ -293,7 +294,8 @@ LPWSTR WINAPI lstrcatW( LPWSTR dst, LPCWSTR src ) * lstrcpyA (KERNEL32.@) * lstrcpy (KERNEL32.@) */ -LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src ) +#ifdef __x86_64__ +LPSTR WINAPI lstrcpyA_impl( LPSTR dst, LPCSTR src ) { __TRY { @@ -309,6 +311,42 @@ LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src ) return dst; } +__ASM_GLOBAL_FUNC( lstrcpyA, + ".byte 0x48, 0x8d, 0xa4, 0x24, 0x00, 0x00, 0x00, 0x00\n\t" + "pushq %rbp\n\t" + __ASM_SEH(".seh_pushreg %rbp\n\t") + __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") + __ASM_CFI(".cfi_rel_offset %rbp,0\n\t") + "movq %rsp,%rbp\n\t" + __ASM_SEH(".seh_setframe %rbp,0\n\t") + __ASM_CFI(".cfi_def_cfa_register %rbp\n\t") + __ASM_SEH(".seh_endprologue\n\t") + "subq $0x20,%rsp\n\t" + "andq $~15,%rsp\n\t" + "call " __ASM_NAME("lstrcpyA_impl") "\n\t" + "leaq 0(%rbp),%rsp\n\t" + __ASM_CFI(".cfi_def_cfa_register %rsp\n\t") + "popq %rbp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") + __ASM_CFI(".cfi_same_value %rbp\n\t") + "ret" ) +#else /* __x86_64__ */ +LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src ) +{ + __TRY + { + /* this is how Windows does it */ + memmove( dst, src, strlen(src)+1 ); + } + __EXCEPT( badptr_handler ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + __ENDTRY + return dst; +} +#endif /*********************************************************************** * lstrcpyW (KERNEL32.@) From eff7707e714efc63cc568b963a5cbedc104acacf Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 14 Jul 2021 20:45:38 +0300 Subject: [PATCH 0718/1506] ntdll: Add stub implementation for NtSetInformationFile(FileAllocationInformation). CW-Bug-Id: #19085 --- dlls/ntdll/unix/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 367cc6763cd..c8bbcce413f 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -4659,6 +4659,15 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, else status = STATUS_INVALID_PARAMETER_3; break; + case FileAllocationInformation: + { + const FILE_ALLOCATION_INFORMATION *info = ptr; + + FIXME("FileAllocationInformation AllocationSize %p stub.\n", (void *)(ULONG_PTR)info->AllocationSize.QuadPart); + io->Status = STATUS_SUCCESS; + break; + } + case FilePipeInformation: if (len >= sizeof(FILE_PIPE_INFORMATION)) { From 12421a943b5290d806f5e952f271955992ddc42e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 14 Jul 2021 20:43:39 +0300 Subject: [PATCH 0719/1506] ntdll: Support '\??\GlobalRoot' prefix in get_dos_prefix_len(). CW-Bug-Id: #19085 --- dlls/ntdll/unix/file.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index c8bbcce413f..597135e71ad 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -3110,16 +3110,31 @@ static inline int get_dos_prefix_len( const UNICODE_STRING *name ) { static const WCHAR nt_prefixW[] = {'\\','?','?','\\'}; static const WCHAR dosdev_prefixW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\'}; + static const WCHAR globalrootW[] = {'\\','?','?','\\','G','l','o','b','a','l','R','o','o','t'}; + int prefix_len = 0; + WCHAR *prefix; + USHORT length; - if (name->Length >= sizeof(nt_prefixW) && - !memcmp( name->Buffer, nt_prefixW, sizeof(nt_prefixW) )) - return ARRAY_SIZE( nt_prefixW ); + prefix = name->Buffer; + length = name->Length; - if (name->Length >= sizeof(dosdev_prefixW) && - !wcsnicmp( name->Buffer, dosdev_prefixW, ARRAY_SIZE( dosdev_prefixW ))) - return ARRAY_SIZE( dosdev_prefixW ); + if (length >= ARRAY_SIZE( globalrootW ) && + !wcsnicmp( prefix, globalrootW, ARRAY_SIZE( globalrootW ))) + { + WARN("Stripping off GlobalRoot prefix.\n"); + prefix += ARRAY_SIZE( globalrootW ); + prefix_len += ARRAY_SIZE( globalrootW ); + length -= ARRAY_SIZE( globalrootW ); + } - return 0; + if (length >= sizeof(nt_prefixW) && + !memcmp( prefix, nt_prefixW, sizeof(nt_prefixW) )) + prefix_len += ARRAY_SIZE( nt_prefixW ); + else if (length >= sizeof(dosdev_prefixW) && + !wcsnicmp( prefix, dosdev_prefixW, ARRAY_SIZE( dosdev_prefixW ))) + prefix_len += ARRAY_SIZE( dosdev_prefixW ); + + return prefix_len; } From 78a39430de455b34a1656eaba394228ac9e0fe63 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Sep 2021 18:01:42 +0300 Subject: [PATCH 0720/1506] kernelbase: Return an error from InitializeProcessForWsWatch() stub. CW-Bug-Id: #19445 For DeathLoop. --- dlls/kernelbase/debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c index 26d95404429..17ce2e7be05 100644 --- a/dlls/kernelbase/debug.c +++ b/dlls/kernelbase/debug.c @@ -1665,7 +1665,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetWsChangesEx( HANDLE process, PSAPI_WS_WATCH_INF BOOL WINAPI /* DECLSPEC_HOTPATCH */ InitializeProcessForWsWatch( HANDLE process ) { FIXME( "(process=%p): stub\n", process ); - return TRUE; + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; } From 1422991c8776c2bab95673584c95bbf46bcb811b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 19 Nov 2021 16:30:57 +0300 Subject: [PATCH 0721/1506] kernelbase: HACK: Force CEF in process GPU rendering for Paradox launcher. To be removed once other process Vulkan rendering is implemented. CW-Bug-Id: #19617 Signed-off-by: Paul Gofman --- dlls/kernelbase/process.c | 49 ++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index f81bb821ea8..1dd627d258d 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -505,6 +505,33 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalA( HANDLE token, const char * return ret; } +static const WCHAR *hack_append_command_line( const WCHAR *cmd ) +{ + static const struct + { + const WCHAR *exe_name; + const WCHAR *append; + } + options[] = + { + {L"UplayWebCore.exe", L" --use-gl=swiftshader"}, + {L"Paradox Launcher.exe", L" --use-gl=swiftshader --in-process-gpu"}, + }; + unsigned int i; + + if (!cmd) return NULL; + + for (i = 0; i < ARRAY_SIZE(options); ++i) + { + if (wcsstr( cmd, options[i].exe_name )) + { + FIXME( "HACK: appending %s to command line.\n", debugstr_w(options[i].append) ); + return options[i].append; + } + } + return NULL; +} + /********************************************************************** * CreateProcessInternalW (kernelbase.@) */ @@ -521,6 +548,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR RTL_USER_PROCESS_PARAMETERS *params = NULL; RTL_USER_PROCESS_INFORMATION rtl_info; HANDLE parent = 0, debug = 0; + const WCHAR *append; ULONG nt_flags = 0; USHORT machine = 0; NTSTATUS status; @@ -539,33 +567,38 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR return FALSE; swprintf( tidy_cmdline, lstrlenW(app_name) + 3, L"\"%s\"", app_name ); } + else if ((append = hack_append_command_line( app_name ))) + { + tidy_cmdline = RtlAllocateHeap( GetProcessHeap(), 0, + sizeof(WCHAR) * (lstrlenW(cmd_line) + lstrlenW(append) + 1) ); + lstrcpyW(tidy_cmdline, cmd_line); + lstrcatW(tidy_cmdline, append); + } } else { - static const WCHAR *opt = L" --use-gl=swiftshader"; WCHAR *cmdline_new = NULL; - if (cmd_line && wcsstr( cmd_line, L"UplayWebCore.exe" )) + if ((append = hack_append_command_line( cmd_line ))) { - FIXME( "HACK: appending %s to command line %s.\n", debugstr_w(opt), debugstr_w(cmd_line) ); - - cmdline_new = heap_alloc( sizeof(WCHAR) * (lstrlenW(cmd_line) + lstrlenW(opt) + 1) ); + cmdline_new = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(WCHAR) + * (lstrlenW(cmd_line) + lstrlenW(append) + 1) ); lstrcpyW(cmdline_new, cmd_line); - lstrcatW(cmdline_new, opt); + lstrcatW(cmdline_new, append); } tidy_cmdline = get_file_name( cmdline_new ? cmdline_new : cmd_line, name, ARRAY_SIZE(name) ); if (!tidy_cmdline) { - heap_free( cmdline_new ); + HeapFree( GetProcessHeap(), 0, cmdline_new ); return FALSE; } if (cmdline_new) { if (cmdline_new == tidy_cmdline) cmd_line = NULL; - else heap_free( cmdline_new ); + else HeapFree( GetProcessHeap(), 0, cmdline_new ); } app_name = name; } From eafe176e9b9cd6dfb33494363e993500c7c9f002 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 21 Jan 2022 14:42:12 -0500 Subject: [PATCH 0722/1506] kernelbase: Add stub for GetConsoleSelectionInfo. Signed-off-by: Derek Lesho --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernelbase/console.c | 8 ++++++++ dlls/kernelbase/kernelbase.spec | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 35d7d1eb9c4..fb4e21adc30 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -620,7 +620,7 @@ @ stdcall -import GetConsoleProcessList(ptr long) @ stdcall -import GetConsoleScreenBufferInfo(long ptr) @ stdcall -import GetConsoleScreenBufferInfoEx(long ptr) -# @ stub GetConsoleSelectionInfo +@ stdcall -import GetConsoleSelectionInfo(ptr) @ stdcall -import GetConsoleTitleA(ptr long) @ stdcall -import GetConsoleTitleW(ptr long) @ stdcall -import GetConsoleWindow() diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 4209d2e6991..0f349f9939b 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -1065,6 +1065,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleScreenBufferInfoEx( HANDLE handle, } +BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleSelectionInfo(CONSOLE_SELECTION_INFO *info) +{ + FIXME("stub (%p)\n", info); + info->dwFlags = CONSOLE_NO_SELECTION; + return TRUE; +} + + /****************************************************************************** * GetConsoleTitleA (kernelbase.@) */ diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 4e8b741d1b5..62b3b4d0488 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -472,6 +472,7 @@ @ stdcall GetConsoleProcessList(ptr long) @ stdcall GetConsoleScreenBufferInfo(long ptr) @ stdcall GetConsoleScreenBufferInfoEx(long ptr) +@ stdcall GetConsoleSelectionInfo(ptr) @ stdcall GetConsoleTitleA(ptr long) @ stdcall GetConsoleTitleW(ptr long) @ stdcall GetConsoleWindow() From acafbd0224e9148a80678cb31952e55f258c2b5e Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 30 Mar 2021 21:45:05 -0400 Subject: [PATCH 0723/1506] kernelbase: Redirect BattlEye Launcher process creation to game executable. Signed-off-by: Derek Lesho CW-Bug-Id: #16650 --- dlls/kernelbase/process.c | 200 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 1dd627d258d..ffb95471f9b 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -26,6 +26,7 @@ #include "windef.h" #include "winbase.h" #include "winnls.h" +#include "winver.h" #include "wincontypes.h" #include "winternl.h" @@ -505,6 +506,197 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalA( HANDLE token, const char * return ret; } +static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len, WCHAR **cmd_line) +{ + WCHAR full_path[MAX_PATH], config_path[MAX_PATH]; + WCHAR *p; + UINT size; + void *block; + DWORD *translation; + char buf[100]; + char *product_name; + int launcher_exe_len, game_exe_len, arg_len; + HANDLE launcher_cfg; + LARGE_INTEGER launcher_cfg_size; + char *configs, *config, *arch_32_exe = NULL, *arch_64_exe = NULL, *game_exe, *be_arg = NULL; + BOOL wow64; + WCHAR *new_cmd_line; + + if (!GetLongPathNameW( app_name, full_path, MAX_PATH )) lstrcpynW( full_path, app_name, MAX_PATH ); + if (!GetFullPathNameW( full_path, MAX_PATH, full_path, NULL )) lstrcpynW( full_path, app_name, MAX_PATH ); + + /* We detect the BattlEye launcher executable through the product name property, as the executable name varies */ + size = GetFileVersionInfoSizeExW(0, full_path, NULL); + if (!size) + return 0; + + block = HeapAlloc( GetProcessHeap(), 0, size ); + + if (!GetFileVersionInfoExW(0, full_path, 0, size, block)) + { + HeapFree( GetProcessHeap(), 0, block ); + return 0; + } + + if (!VerQueryValueA(block, "\\VarFileInfo\\Translation", (void **) &translation, &size) || size != 4) + { + HeapFree( GetProcessHeap(), 0, block ); + return 0; + } + + sprintf(buf, "\\StringFileInfo\\%08lx\\ProductName", MAKELONG(HIWORD(*translation), LOWORD(*translation))); + + if (!VerQueryValueA(block, buf, (void **) &product_name, &size)) + { + HeapFree( GetProcessHeap(), 0, block ); + return 0; + } + + if (strcmp(product_name, "BattlEye Launcher")) + { + HeapFree( GetProcessHeap(), 0, block); + return 0; + } + + HeapFree( GetProcessHeap(), 0, block ); + + TRACE("Detected launch of a BattlEye Launcher, attempting to launch game executable instead.\n"); + + lstrcpynW(config_path, full_path, MAX_PATH); + + for (p = config_path + wcslen(config_path); p != config_path; --p) + if (*p == '\\') break; + + if (*p == '\\') + { + *p = 0; + launcher_exe_len = wcslen(p + 1); + } + else + launcher_exe_len = wcslen(full_path); + + lstrcatW(config_path, L"\\BattlEye\\BELauncher.ini"); + + launcher_cfg = CreateFileW(config_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (launcher_cfg == INVALID_HANDLE_VALUE) + return 0; + + if(!GetFileSizeEx(launcher_cfg, &launcher_cfg_size) || launcher_cfg_size.u.HighPart) + { + CloseHandle(launcher_cfg); + return 0; + } + + configs = HeapAlloc( GetProcessHeap(), 0, launcher_cfg_size.u.LowPart); + + if (!ReadFile(launcher_cfg, configs, launcher_cfg_size.u.LowPart, (DWORD *)&size, NULL) || size != launcher_cfg_size.u.LowPart) + { + CloseHandle(launcher_cfg); + HeapFree( GetProcessHeap(), 0, configs ); + return 0; + } + + CloseHandle(launcher_cfg); + + config = configs; + do + { + if (!strncmp(config, "32BitExe=", 9)) + arch_32_exe = config + 9; + + if (!strncmp(config, "64BitExe=", 9)) + arch_64_exe = config + 9; + + if (!strncmp(config, "BEArg=", 6)) + be_arg = config + 6; + } + while ((config = strchr(config, '\n')) && *(config++)); + + if (arch_64_exe && (sizeof(void *) == 8 || (IsWow64Process(GetCurrentProcess(), &wow64) && wow64))) + game_exe = arch_64_exe; + else if (arch_32_exe) + game_exe = arch_32_exe; + else + { + HeapFree( GetProcessHeap(), 0, configs ); + WARN("Failed to find game executable name from BattlEye config.\n"); + return 0; + } + + if (strchr(game_exe, '\r')) + *(strchr(game_exe, '\r')) = 0; + if (strchr(game_exe, '\n')) + *(strchr(game_exe, '\n')) = 0; + game_exe_len = MultiByteToWideChar(CP_ACP, 0, game_exe, -1, NULL, 0) - 1; + + if (be_arg) + { + if (strchr(be_arg, '\r')) + *(strchr(be_arg, '\r')) = 0; + if (strchr(be_arg, '\n')) + *(strchr(be_arg, '\n')) = 0; + arg_len = MultiByteToWideChar(CP_ACP, 0, be_arg, -1, NULL, 0) - 1; + } + + TRACE("Launching game executable %s for BattlEye.\n", game_exe); + + if ((wcslen(app_name) - launcher_exe_len) + game_exe_len + 1 > new_name_len) + { + HeapFree( GetProcessHeap(), 0, configs ); + WARN("Game executable path doesn't fit in buffer.\n"); + return 0; + } + + wcscpy(new_name, app_name); + p = new_name + wcslen(new_name) - launcher_exe_len; + MultiByteToWideChar(CP_ACP, 0, game_exe, -1, p, game_exe_len + 1); + + /* find and replace executable name in command line, and add BE argument */ + p = *cmd_line; + if (p[0] == '\"') + p++; + + if (!wcsncmp(p, app_name, wcslen(app_name))) + p += wcslen(app_name) - launcher_exe_len; + else + p = NULL; + + if (p || be_arg) + { + size = wcslen(*cmd_line) + 1; + if (p) + size += game_exe_len - launcher_exe_len; + if (be_arg) + size += 1 /* space */ + arg_len; + size *= sizeof(WCHAR); + + /* freed by parent function */ + new_cmd_line = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ); + + if (p) + { + lstrcpynW(new_cmd_line, *cmd_line, p - *cmd_line); + MultiByteToWideChar(CP_ACP, 0, game_exe, -1, new_cmd_line + wcslen(new_cmd_line), game_exe_len + 1); + wcscat(new_cmd_line, p + launcher_exe_len); + } + else + { + wcscpy(new_cmd_line, *cmd_line); + } + + if (be_arg) + { + wcscat(new_cmd_line, L" "); + MultiByteToWideChar(CP_ACP, 0, be_arg, -1, new_cmd_line + wcslen(new_cmd_line), arg_len + 1); + } + + *cmd_line = new_cmd_line; + } + + HeapFree( GetProcessHeap(), 0, configs ); + return 1; +} + static const WCHAR *hack_append_command_line( const WCHAR *cmd ) { static const struct @@ -603,6 +795,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR app_name = name; } + p = tidy_cmdline; + if (battleye_launcher_redirect_hack( app_name, name, ARRAY_SIZE(name), &tidy_cmdline )) + { + app_name = name; + if (p != tidy_cmdline && p != cmd_line) + HeapFree( GetProcessHeap(), 0, p ); + } + /* Warn if unsupported features are used */ if (flags & (IDLE_PRIORITY_CLASS | HIGH_PRIORITY_CLASS | REALTIME_PRIORITY_CLASS | From 0d4a7e67b913c48d340ee35e62350c4e6dc2f0d6 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 21 Jan 2022 14:40:43 -0500 Subject: [PATCH 0724/1506] battleye: Add launcher process instead of redirecting CreateProcess call. Fixes Arma 3 Launcher CW-Bug-Id: #18934 --- configure.ac | 1 + dlls/kernelbase/process.c | 134 ++++---------------------------- programs/belauncher/Makefile.in | 7 ++ programs/belauncher/main.c | 118 ++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 119 deletions(-) create mode 100644 programs/belauncher/Makefile.in create mode 100644 programs/belauncher/main.c diff --git a/configure.ac b/configure.ac index 18682f36d8b..3f7ce9aed9a 100644 --- a/configure.ac +++ b/configure.ac @@ -3462,6 +3462,7 @@ WINE_CONFIG_MAKEFILE(po) WINE_CONFIG_MAKEFILE(programs/arp) WINE_CONFIG_MAKEFILE(programs/aspnet_regiis) WINE_CONFIG_MAKEFILE(programs/attrib) +WINE_CONFIG_MAKEFILE(programs/belauncher) WINE_CONFIG_MAKEFILE(programs/cabarc) WINE_CONFIG_MAKEFILE(programs/cacls) WINE_CONFIG_MAKEFILE(programs/certutil) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index ffb95471f9b..109fa6c7fec 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -508,18 +508,15 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalA( HANDLE token, const char * static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len, WCHAR **cmd_line) { - WCHAR full_path[MAX_PATH], config_path[MAX_PATH]; + static const WCHAR belauncherW[] = L"c:\\windows\\system32\\belauncher.exe"; + + WCHAR full_path[MAX_PATH]; WCHAR *p; UINT size; void *block; DWORD *translation; char buf[100]; char *product_name; - int launcher_exe_len, game_exe_len, arg_len; - HANDLE launcher_cfg; - LARGE_INTEGER launcher_cfg_size; - char *configs, *config, *arch_32_exe = NULL, *arch_64_exe = NULL, *game_exe, *be_arg = NULL; - BOOL wow64; WCHAR *new_cmd_line; if (!GetLongPathNameW( app_name, full_path, MAX_PATH )) lstrcpynW( full_path, app_name, MAX_PATH ); @@ -560,96 +557,15 @@ static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_nam HeapFree( GetProcessHeap(), 0, block ); - TRACE("Detected launch of a BattlEye Launcher, attempting to launch game executable instead.\n"); - - lstrcpynW(config_path, full_path, MAX_PATH); - - for (p = config_path + wcslen(config_path); p != config_path; --p) - if (*p == '\\') break; - - if (*p == '\\') - { - *p = 0; - launcher_exe_len = wcslen(p + 1); - } - else - launcher_exe_len = wcslen(full_path); - - lstrcatW(config_path, L"\\BattlEye\\BELauncher.ini"); - - launcher_cfg = CreateFileW(config_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (launcher_cfg == INVALID_HANDLE_VALUE) - return 0; - - if(!GetFileSizeEx(launcher_cfg, &launcher_cfg_size) || launcher_cfg_size.u.HighPart) - { - CloseHandle(launcher_cfg); - return 0; - } - - configs = HeapAlloc( GetProcessHeap(), 0, launcher_cfg_size.u.LowPart); - - if (!ReadFile(launcher_cfg, configs, launcher_cfg_size.u.LowPart, (DWORD *)&size, NULL) || size != launcher_cfg_size.u.LowPart) - { - CloseHandle(launcher_cfg); - HeapFree( GetProcessHeap(), 0, configs ); - return 0; - } - - CloseHandle(launcher_cfg); - - config = configs; - do - { - if (!strncmp(config, "32BitExe=", 9)) - arch_32_exe = config + 9; - - if (!strncmp(config, "64BitExe=", 9)) - arch_64_exe = config + 9; - - if (!strncmp(config, "BEArg=", 6)) - be_arg = config + 6; - } - while ((config = strchr(config, '\n')) && *(config++)); - - if (arch_64_exe && (sizeof(void *) == 8 || (IsWow64Process(GetCurrentProcess(), &wow64) && wow64))) - game_exe = arch_64_exe; - else if (arch_32_exe) - game_exe = arch_32_exe; - else - { - HeapFree( GetProcessHeap(), 0, configs ); - WARN("Failed to find game executable name from BattlEye config.\n"); - return 0; - } - - if (strchr(game_exe, '\r')) - *(strchr(game_exe, '\r')) = 0; - if (strchr(game_exe, '\n')) - *(strchr(game_exe, '\n')) = 0; - game_exe_len = MultiByteToWideChar(CP_ACP, 0, game_exe, -1, NULL, 0) - 1; - - if (be_arg) - { - if (strchr(be_arg, '\r')) - *(strchr(be_arg, '\r')) = 0; - if (strchr(be_arg, '\n')) - *(strchr(be_arg, '\n')) = 0; - arg_len = MultiByteToWideChar(CP_ACP, 0, be_arg, -1, NULL, 0) - 1; - } - - TRACE("Launching game executable %s for BattlEye.\n", game_exe); + TRACE("Detected launch of a BattlEye Launcher, redirecting to Proton version.\n"); - if ((wcslen(app_name) - launcher_exe_len) + game_exe_len + 1 > new_name_len) + if (new_name_len < wcslen(belauncherW) + 1) { - HeapFree( GetProcessHeap(), 0, configs ); WARN("Game executable path doesn't fit in buffer.\n"); return 0; } - wcscpy(new_name, app_name); - p = new_name + wcslen(new_name) - launcher_exe_len; - MultiByteToWideChar(CP_ACP, 0, game_exe, -1, p, game_exe_len + 1); + wcscpy(new_name, belauncherW); /* find and replace executable name in command line, and add BE argument */ p = *cmd_line; @@ -657,43 +573,23 @@ static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_nam p++; if (!wcsncmp(p, app_name, wcslen(app_name))) - p += wcslen(app_name) - launcher_exe_len; - else - p = NULL; - - if (p || be_arg) { - size = wcslen(*cmd_line) + 1; - if (p) - size += game_exe_len - launcher_exe_len; - if (be_arg) - size += 1 /* space */ + arg_len; - size *= sizeof(WCHAR); + new_cmd_line = HeapAlloc( GetProcessHeap(), 0, ( wcslen(*cmd_line) + wcslen(belauncherW) + 1 - wcslen(app_name) ) * sizeof(WCHAR) ); - /* freed by parent function */ - new_cmd_line = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ); + wcscpy(new_cmd_line, *cmd_line); + p = new_cmd_line; + if (p[0] == '\"') + p++; - if (p) - { - lstrcpynW(new_cmd_line, *cmd_line, p - *cmd_line); - MultiByteToWideChar(CP_ACP, 0, game_exe, -1, new_cmd_line + wcslen(new_cmd_line), game_exe_len + 1); - wcscat(new_cmd_line, p + launcher_exe_len); - } - else - { - wcscpy(new_cmd_line, *cmd_line); - } + memmove( p + wcslen(belauncherW), p + wcslen(app_name), (wcslen(p) - wcslen(belauncherW)) * sizeof(WCHAR) ); + memcpy( p, belauncherW, wcslen(belauncherW) * sizeof(WCHAR) ); - if (be_arg) - { - wcscat(new_cmd_line, L" "); - MultiByteToWideChar(CP_ACP, 0, be_arg, -1, new_cmd_line + wcslen(new_cmd_line), arg_len + 1); - } + TRACE("old command line %s.\n", debugstr_w(*cmd_line)); + TRACE("new command line %s.\n", debugstr_w(new_cmd_line)); *cmd_line = new_cmd_line; } - HeapFree( GetProcessHeap(), 0, configs ); return 1; } diff --git a/programs/belauncher/Makefile.in b/programs/belauncher/Makefile.in new file mode 100644 index 00000000000..9800c0b45ba --- /dev/null +++ b/programs/belauncher/Makefile.in @@ -0,0 +1,7 @@ +MODULE = belauncher.exe +IMPORTS = + +EXTRADLLFLAGS = -mwindows -municode + +SOURCES = \ + main.c \ diff --git a/programs/belauncher/main.c b/programs/belauncher/main.c new file mode 100644 index 00000000000..004a7d1a711 --- /dev/null +++ b/programs/belauncher/main.c @@ -0,0 +1,118 @@ +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(belauncher); + +int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow) +{ + char *configs, *config, *arch_32_exe = NULL, *arch_64_exe = NULL, *game_exe, *be_arg = NULL; + LARGE_INTEGER launcher_cfg_size; + unsigned char battleye_status; + int game_exe_len, arg_len; + PROCESS_INFORMATION pi; + HANDLE launcher_cfg; + LPWSTR launch_cmd; + STARTUPINFOW si = {0}; + DWORD size; + BOOL wow64; + + battleye_status = 0x3; /* Starting */ + _write(1, &battleye_status, 1); + + launcher_cfg = CreateFileW(L"Battleye\\BELauncher.ini", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (launcher_cfg == INVALID_HANDLE_VALUE) + goto start_failed; + + if(!GetFileSizeEx(launcher_cfg, &launcher_cfg_size) || launcher_cfg_size.u.HighPart) + { + CloseHandle(launcher_cfg); + goto start_failed; + } + + configs = HeapAlloc( GetProcessHeap(), 0, launcher_cfg_size.u.LowPart); + + if (!ReadFile(launcher_cfg, configs, launcher_cfg_size.u.LowPart, &size, NULL) || size != launcher_cfg_size.u.LowPart) + { + CloseHandle(launcher_cfg); + HeapFree( GetProcessHeap(), 0, configs ); + goto start_failed; + } + + CloseHandle(launcher_cfg); + + config = configs; + do + { + if (!strncmp(config, "32BitExe=", 9)) + arch_32_exe = config + 9; + + if (!strncmp(config, "64BitExe=", 9)) + arch_64_exe = config + 9; + + if (!strncmp(config, "BEArg=", 6)) + be_arg = config + 6; + } + while ((config = strchr(config, '\n')) && *(config++)); + + if (arch_64_exe && (sizeof(void *) == 8 || (IsWow64Process(GetCurrentProcess(), &wow64) && wow64))) + game_exe = arch_64_exe; + else if (arch_32_exe) + game_exe = arch_32_exe; + else + { + HeapFree( GetProcessHeap(), 0, configs ); + WINE_WARN("Failed to find game executable name from BattlEye config.\n"); + goto start_failed; + } + + if (strchr(game_exe, '\r')) + *(strchr(game_exe, '\r')) = 0; + if (strchr(game_exe, '\n')) + *(strchr(game_exe, '\n')) = 0; + game_exe_len = MultiByteToWideChar(CP_ACP, 0, game_exe, -1, NULL, 0) - 1; + + if (!be_arg) arg_len = 0; + else + { + if (strchr(be_arg, '\r')) + *(strchr(be_arg, '\r')) = 0; + if (strchr(be_arg, '\n')) + *(strchr(be_arg, '\n')) = 0; + arg_len = MultiByteToWideChar(CP_ACP, 0, be_arg, -1, NULL, 0) - 1; + } + + WINE_TRACE("Launching game executable %s for BattlEye.\n", game_exe); + battleye_status = 0x9; /* Launching Game */ + _write(1, &battleye_status, 1); + + launch_cmd = HeapAlloc(GetProcessHeap(), 0, (game_exe_len + 1 + wcslen(cmdline) + 1 + arg_len + 1) * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, game_exe, -1, launch_cmd, game_exe_len + 1); + launch_cmd[game_exe_len] = ' '; + + wcscpy(launch_cmd + game_exe_len + 1, cmdline); + launch_cmd[game_exe_len + 1 + wcslen(cmdline)] = ' '; + + MultiByteToWideChar(CP_ACP, 0, be_arg, -1, launch_cmd + game_exe_len + 1 + wcslen(cmdline) + 1, arg_len + 1); + + if (!CreateProcessW(NULL, launch_cmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) + { + battleye_status = 0xA; /* Launch Failed */ + _write(1, &battleye_status, 1); + + HeapFree( GetProcessHeap(), 0, launch_cmd ); + return GetLastError(); + } + HeapFree( GetProcessHeap(), 0, launch_cmd ); + + WaitForSingleObject(pi.hProcess, INFINITE); + CloseHandle(pi.hProcess); + return 0; + +start_failed: + battleye_status = 0x4; /* Start Failed */ + _write(1, &battleye_status, 1); + return 0; +} From 82437b6ebdbe615efba6b75952486fa64cd164ff Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 26 Mar 2021 10:48:14 -0400 Subject: [PATCH 0725/1506] ntdll: Try to load builtin DLLs from Battleye Runtime directory. Signed-off-by: Derek Lesho CW-Bug-Id: #16650 --- dlls/ntdll/unix/loader.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index af3055bc93b..c6ff35935f9 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -340,11 +340,14 @@ static const char *get_pe_dir( WORD machine ) static void set_dll_path(void) { - char *p, *path = getenv( "WINEDLLPATH" ); + char *p, *path = getenv( "WINEDLLPATH" ), *be_runtime = getenv( "PROTON_BATTLEYE_RUNTIME" ); int i, count = 0; if (path) for (p = path, count = 1; *p; p++) if (*p == ':') count++; + if (be_runtime) + count += 2; + dll_paths = malloc( (count + 2) * sizeof(*dll_paths) ); count = 0; @@ -357,6 +360,24 @@ static void set_dll_path(void) free( path ); } + if (be_runtime) + { + const char lib32[] = "/v1/lib/wine/"; + const char lib64[] = "/v1/lib64/wine/"; + + p = malloc( strlen(be_runtime) + strlen(lib32) + 1 ); + strcpy(p, be_runtime); + strcat(p, lib32); + + dll_paths[count++] = p; + + p = malloc( strlen(be_runtime) + strlen(lib64) + 1 ); + strcpy(p, be_runtime); + strcat(p, lib64); + + dll_paths[count++] = p; + } + for (i = 0; i < count; i++) dll_path_maxlen = max( dll_path_maxlen, strlen(dll_paths[i]) ); dll_paths[count] = NULL; } From 156462ac21f0adca4b9811439f1076f2ff07002f Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Mon, 6 Dec 2021 15:13:40 +0100 Subject: [PATCH 0726/1506] ntdll: Load EAC bridge files from PROTON_EAC_RUNTIME path. --- dlls/ntdll/unix/loader.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c6ff35935f9..ea2ad0d584c 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -340,7 +340,7 @@ static const char *get_pe_dir( WORD machine ) static void set_dll_path(void) { - char *p, *path = getenv( "WINEDLLPATH" ), *be_runtime = getenv( "PROTON_BATTLEYE_RUNTIME" ); + char *p, *path = getenv( "WINEDLLPATH" ), *be_runtime = getenv( "PROTON_BATTLEYE_RUNTIME" ), *eac_runtime = getenv( "PROTON_EAC_RUNTIME" ); int i, count = 0; if (path) for (p = path, count = 1; *p; p++) if (*p == ':') count++; @@ -348,6 +348,9 @@ static void set_dll_path(void) if (be_runtime) count += 2; + if (eac_runtime) + count += 2; + dll_paths = malloc( (count + 2) * sizeof(*dll_paths) ); count = 0; @@ -378,6 +381,24 @@ static void set_dll_path(void) dll_paths[count++] = p; } + if (eac_runtime) + { + const char lib32[] = "/v2/lib32/"; + const char lib64[] = "/v2/lib64/"; + + p = malloc( strlen(eac_runtime) + strlen(lib32) + 1 ); + strcpy(p, eac_runtime); + strcat(p, lib32); + + dll_paths[count++] = p; + + p = malloc( strlen(eac_runtime) + strlen(lib64) + 1 ); + strcpy(p, eac_runtime); + strcat(p, lib64); + + dll_paths[count++] = p; + } + for (i = 0; i < count; i++) dll_path_maxlen = max( dll_path_maxlen, strlen(dll_paths[i]) ); dll_paths[count] = NULL; } From 5a19653cc9487a083bb32f47329717132c0051dc Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 18 Jan 2022 17:16:15 -0500 Subject: [PATCH 0727/1506] ntdll: Only load EAC bridge when Linux library is present. --- dlls/ntdll/unix/loadorder.c | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/dlls/ntdll/unix/loadorder.c b/dlls/ntdll/unix/loadorder.c index aa987a80186..3d9575d83f2 100644 --- a/dlls/ntdll/unix/loadorder.c +++ b/dlls/ntdll/unix/loadorder.c @@ -378,6 +378,10 @@ void set_load_order_app_name( const WCHAR *app_name ) */ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) { + static const WCHAR easyanticheat_x86W[] = {'e','a','s','y','a','n','t','i','c','h','e','a','t','_','x','8','6','.','d','l','l',0}; + static const WCHAR easyanticheat_x64W[] = {'e','a','s','y','a','n','t','i','c','h','e','a','t','_','x','6','4','.','d','l','l',0}; + static const WCHAR soW[] = {'s','o',0}; + static const WCHAR prefixW[] = {'\\','?','?','\\'}; enum loadorder ret = LO_INVALID; const WCHAR *path = nt_name->Buffer; @@ -391,6 +395,41 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) TRACE("looking for %s\n", debugstr_w(path)); + /* HACK: special logic for easyanticheat bridge: only load the bridge (builtin) if there exists a native version of the library next to the windows version */ + basename = get_basename((WCHAR *)path); + if (!wcsicmp(basename, easyanticheat_x86W) || !wcsicmp(basename, easyanticheat_x64W)) + { + UNICODE_STRING eac_unix_name; + OBJECT_ATTRIBUTES attr; + char *unix_path = NULL; + NTSTATUS status; + + len = wcslen(nt_name->Buffer); + eac_unix_name.Buffer = malloc( (len + 1) * sizeof(WCHAR) ); + wcscpy(eac_unix_name.Buffer, nt_name->Buffer); + + basename = get_basename(eac_unix_name.Buffer); + wcscpy(&basename[18], soW); + eac_unix_name.Length = eac_unix_name.MaximumLength = wcslen(eac_unix_name.Buffer) * sizeof(WCHAR); + InitializeObjectAttributes(&attr, &eac_unix_name, 0, NULL, NULL); + + if (!(status = nt_to_unix_file_name(&attr, &unix_path, FILE_OPEN))) + { + free(unix_path); + free(eac_unix_name.Buffer); + ret = LO_BUILTIN; + TRACE( "got hardcoded %s for %s, as the eac unix library is present\n", debugstr_loadorder(ret), debugstr_w(path) ); + return ret; + } + else + { + ret = LO_NATIVE; + TRACE( "got hardcoded %s for %s, as the eac unix library (%s) is not present. status %x\n", debugstr_loadorder(ret), debugstr_w(path), debugstr_w(eac_unix_name.Buffer), (int)status ); + free(eac_unix_name.Buffer); + return ret; + } + } + /* Strip path information if the module resides in the system directory */ if (!wcsnicmp( system_dir + 4, path, wcslen(system_dir) - 4 )) From 3671dc59a189a81cafaf4c645f115db9603780cd Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 16 Feb 2022 14:24:41 -0500 Subject: [PATCH 0728/1506] kernelbase: Don't load EAC bridge in the EAC Launcher process. Signed-off-by: Derek Lesho --- dlls/kernelbase/process.c | 64 ++++++++++++++++++++++++++++--------- dlls/ntdll/unix/loadorder.c | 21 ++++++++++++ 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 109fa6c7fec..d9754f10ed0 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -506,39 +506,35 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalA( HANDLE token, const char * return ret; } -static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len, WCHAR **cmd_line) +/* Returns TRUE if the product name of the app matches the parameter */ +static BOOL product_name_matches(const WCHAR *app_name, const char *match) { - static const WCHAR belauncherW[] = L"c:\\windows\\system32\\belauncher.exe"; - WCHAR full_path[MAX_PATH]; - WCHAR *p; - UINT size; - void *block; DWORD *translation; - char buf[100]; char *product_name; - WCHAR *new_cmd_line; + char buf[100]; + void *block; + UINT size; if (!GetLongPathNameW( app_name, full_path, MAX_PATH )) lstrcpynW( full_path, app_name, MAX_PATH ); if (!GetFullPathNameW( full_path, MAX_PATH, full_path, NULL )) lstrcpynW( full_path, app_name, MAX_PATH ); - /* We detect the BattlEye launcher executable through the product name property, as the executable name varies */ size = GetFileVersionInfoSizeExW(0, full_path, NULL); if (!size) - return 0; + return FALSE; block = HeapAlloc( GetProcessHeap(), 0, size ); if (!GetFileVersionInfoExW(0, full_path, 0, size, block)) { HeapFree( GetProcessHeap(), 0, block ); - return 0; + return FALSE; } if (!VerQueryValueA(block, "\\VarFileInfo\\Translation", (void **) &translation, &size) || size != 4) { HeapFree( GetProcessHeap(), 0, block ); - return 0; + return FALSE; } sprintf(buf, "\\StringFileInfo\\%08lx\\ProductName", MAKELONG(HIWORD(*translation), LOWORD(*translation))); @@ -546,16 +542,28 @@ static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_nam if (!VerQueryValueA(block, buf, (void **) &product_name, &size)) { HeapFree( GetProcessHeap(), 0, block ); - return 0; + return FALSE; } - if (strcmp(product_name, "BattlEye Launcher")) + if (strcmp(product_name, match)) { HeapFree( GetProcessHeap(), 0, block); - return 0; + return FALSE; } HeapFree( GetProcessHeap(), 0, block ); + return TRUE; +} + +static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len, WCHAR **cmd_line) +{ + static const WCHAR belauncherW[] = L"c:\\windows\\system32\\belauncher.exe"; + WCHAR *new_cmd_line; + WCHAR *p; + + /* We detect the BattlEye launcher executable through the product name property, as the executable name varies */ + if (!product_name_matches(app_name, "BattlEye Launcher")) + return 0; TRACE("Detected launch of a BattlEye Launcher, redirecting to Proton version.\n"); @@ -724,6 +732,32 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR goto done; } + /* Set PROTON_EAC_LAUNCHER_PROCESS when launching the EAC launcher to let ntdll know to load the native EAC client library. + - We don't do this check in ntdll itself because it's harder to get the product name there + - we don't overwrite WINEDLLOVERRIDES because it's fetched from the unix environment */ + { + UNICODE_STRING is_eac_launcher_us; + UNICODE_STRING one_us; + + WCHAR *new_env = RtlAllocateHeap( GetProcessHeap(), 0, params->EnvironmentSize ); + memcpy(new_env, params->Environment, params->EnvironmentSize); + + RtlDestroyProcessParameters( params ); + + RtlInitUnicodeString( &is_eac_launcher_us, L"PROTON_EAC_LAUNCHER_PROCESS" ); + RtlInitUnicodeString( &one_us, L"1" ); + RtlSetEnvironmentVariable( &new_env, &is_eac_launcher_us, product_name_matches(app_name, "EasyAntiCheat Launcher") ? &one_us : NULL ); + + params = create_process_params( app_name, tidy_cmdline, cur_dir, new_env, flags | CREATE_UNICODE_ENVIRONMENT, startup_info ); + + RtlFreeHeap(GetProcessHeap(), 0, new_env); + if (!params) + { + status = STATUS_NO_MEMORY; + goto done; + } + } + if (flags & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS)) { if ((status = DbgUiConnectToDbg())) goto done; diff --git a/dlls/ntdll/unix/loadorder.c b/dlls/ntdll/unix/loadorder.c index 3d9575d83f2..a13d54ec263 100644 --- a/dlls/ntdll/unix/loadorder.c +++ b/dlls/ntdll/unix/loadorder.c @@ -59,6 +59,7 @@ static HANDLE std_key; static HANDLE app_key; static BOOL init_done; static BOOL main_exe_loaded; +static BOOL eac_launcher_process; /*************************************************************************** @@ -362,11 +363,24 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, WCHA */ void set_load_order_app_name( const WCHAR *app_name ) { + static const WCHAR eac_launcherW[] = {'P','R','O','T','O','N','_','E','A','C','_','L','A','U','N','C','H','E','R','_','P','R','O','C','E','S','S',0}; const WCHAR *p; if ((p = wcsrchr( app_name, '\\' ))) app_name = p + 1; app_key = open_app_key( app_name ); main_exe_loaded = TRUE; + + p = NtCurrentTeb()->Peb->ProcessParameters->Environment; + while(*p) + { + if (!wcsncmp( p, eac_launcherW, ARRAY_SIZE(eac_launcherW) - 1 )) + { + eac_launcher_process = TRUE; + break; + } + + p += wcslen(p) + 1; + } } @@ -404,6 +418,13 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) char *unix_path = NULL; NTSTATUS status; + if (eac_launcher_process) + { + ret = LO_NATIVE; + TRACE("got hardcoded %s for %s, as this is the EAC launcher process\n", debugstr_loadorder(ret), debugstr_w(path) ); + return ret; + } + len = wcslen(nt_name->Buffer); eac_unix_name.Buffer = malloc( (len + 1) * sizeof(WCHAR) ); wcscpy(eac_unix_name.Buffer, nt_name->Buffer); From 227bf8ad3a4c679a233561400297674cdb68f015 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 16 Feb 2022 14:26:51 -0500 Subject: [PATCH 0729/1506] ntdll: Decide load order of easyanticheat.dll based off bridge detection logic. Signed-off-by: Derek Lesho --- dlls/ntdll/unix/loadorder.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/loadorder.c b/dlls/ntdll/unix/loadorder.c index a13d54ec263..bbe50928880 100644 --- a/dlls/ntdll/unix/loadorder.c +++ b/dlls/ntdll/unix/loadorder.c @@ -394,6 +394,7 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) { static const WCHAR easyanticheat_x86W[] = {'e','a','s','y','a','n','t','i','c','h','e','a','t','_','x','8','6','.','d','l','l',0}; static const WCHAR easyanticheat_x64W[] = {'e','a','s','y','a','n','t','i','c','h','e','a','t','_','x','6','4','.','d','l','l',0}; + static const WCHAR easyanticheatW[] = {'e','a','s','y','a','n','t','i','c','h','e','a','t','.','d','l','l',0}; static const WCHAR soW[] = {'s','o',0}; static const WCHAR prefixW[] = {'\\','?','?','\\'}; @@ -411,7 +412,7 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) /* HACK: special logic for easyanticheat bridge: only load the bridge (builtin) if there exists a native version of the library next to the windows version */ basename = get_basename((WCHAR *)path); - if (!wcsicmp(basename, easyanticheat_x86W) || !wcsicmp(basename, easyanticheat_x64W)) + if (!wcsicmp(basename, easyanticheat_x86W) || !wcsicmp(basename, easyanticheat_x64W) || !wcsicmp(basename, easyanticheatW)) { UNICODE_STRING eac_unix_name; OBJECT_ATTRIBUTES attr; @@ -426,10 +427,12 @@ enum loadorder get_load_order( const UNICODE_STRING *nt_name ) } len = wcslen(nt_name->Buffer); - eac_unix_name.Buffer = malloc( (len + 1) * sizeof(WCHAR) ); + eac_unix_name.Buffer = malloc( (len + 5) * sizeof(WCHAR) ); wcscpy(eac_unix_name.Buffer, nt_name->Buffer); basename = get_basename(eac_unix_name.Buffer); + if (!wcsicmp(basename, easyanticheatW)) + wcscpy(basename, easyanticheat_x64W); wcscpy(&basename[18], soW); eac_unix_name.Length = eac_unix_name.MaximumLength = wcslen(eac_unix_name.Buffer) * sizeof(WCHAR); InitializeObjectAttributes(&attr, &eac_unix_name, 0, NULL, NULL); From 4ac86ebb87dac50c03f7e09ea56f5b85600be16f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 11 Mar 2022 15:46:11 +0300 Subject: [PATCH 0730/1506] kernelbase: HACK: Force CEF swiftshader for Montaro/nw.exe. CW-Bug-Id: #20284 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index d9754f10ed0..6b4f776f671 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -612,6 +612,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) { {L"UplayWebCore.exe", L" --use-gl=swiftshader"}, {L"Paradox Launcher.exe", L" --use-gl=swiftshader --in-process-gpu"}, + {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, }; unsigned int i; From cd74058aa4972ded5809c88be2e3cdbcc47fbcfa Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sun, 22 May 2022 11:53:12 -0500 Subject: [PATCH 0731/1506] kernelbase: HACK: Force CEF swiftshader for EpicOnlineServicesUIHelper. Enabling other process window rendering makes it dependent on the missing d3dcompiler features. CW-Bug-Id: #20680 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 6b4f776f671..bdc3e1caa36 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -613,6 +613,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"UplayWebCore.exe", L" --use-gl=swiftshader"}, {L"Paradox Launcher.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, + {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, }; unsigned int i; From 04a1a5d877e4cd5c67b0d52fe6ab937f74e6c998 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 Aug 2022 11:56:39 -0500 Subject: [PATCH 0732/1506] ntdll: HACK: Add an option to report ntdll from RtlPcToFileHeader() for PC in Unix lib. CW-Bug-Id: #21065 (to be dropped once we have no blocking calls to Unix native libs going wthout wine_syscall_dispatcher). --- dlls/ntdll/loader.c | 9 +++++++++ dlls/ntdll/unix/loader.c | 20 ++++++++++++++++++++ dlls/ntdll/unixlib.h | 1 + 3 files changed, 30 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 6fed926eeff..acd0eb2cd8d 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4570,6 +4570,15 @@ PVOID WINAPI RtlPcToFileHeader( PVOID pc, PVOID *address ) RtlEnterCriticalSection( &loader_section ); if (!LdrFindEntryForAddress( pc, &module )) ret = module->DllBase; RtlLeaveCriticalSection( &loader_section ); + + if (!ret && WINE_UNIX_CALL( unix_is_pc_in_native_so, pc )) + { + LDR_DATA_TABLE_ENTRY *mod; + + mod = CONTAINING_RECORD( node_ntdll->Modules.Flink, LDR_DATA_TABLE_ENTRY, NodeModuleLink ); + ret = mod->DllBase; + } + *address = ret; return ret; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index ea2ad0d584c..4745cabd917 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1137,6 +1137,21 @@ static NTSTATUS steamclient_setup_trampolines( void *args ) return STATUS_SUCCESS; } +static BOOL report_native_pc_as_ntdll; + +static NTSTATUS is_pc_in_native_so(void *pc) +{ + Dl_info info; + + if (!report_native_pc_as_ntdll || !dladdr( pc, &info )) return FALSE; + + TRACE( "pc %p, module %s.\n", pc, debugstr_a(info.dli_fname) ); + + if (strstr( info.dli_fname, ".dll.so")) return FALSE; + + return TRUE; +} + static const unixlib_entry_t unix_call_funcs[] = { load_so_dll, @@ -1148,6 +1163,7 @@ static const unixlib_entry_t unix_call_funcs[] = unixcall_wine_spawnvp, system_time_precise, steamclient_setup_trampolines, + is_pc_in_native_so, }; @@ -2020,6 +2036,10 @@ static void hacks_init(void) break; } + env_str = getenv("WINE_UNIX_PC_AS_NTDLL"); + if (env_str) report_native_pc_as_ntdll = atoi(env_str); + else if (sgi) report_native_pc_as_ntdll = !strcmp(sgi, "700330"); + if (sgi && (0 || !strcmp(sgi, "1364780") || !strcmp(sgi, "1952120") || !strcmp(sgi, "2154900") /* Street Fighter 6 */ || !strcmp(sgi, "1740720") /* Have a Nice Death */ diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 475e532b8cf..5430b8f0fe9 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -83,6 +83,7 @@ enum ntdll_unix_funcs unix_wine_spawnvp, unix_system_time_precise, unix_steamclient_setup_trampolines, + unix_is_pc_in_native_so, }; extern unixlib_handle_t __wine_unixlib_handle; From ef7f14098e44d88e544ebaa22d215dd879f4bf51 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 19 Nov 2021 16:30:57 +0300 Subject: [PATCH 0733/1506] wine.inf: Restore default libglesv2 load order for Paradox launcher. Remove order override instead of reverting commit 13ac81ffd075d9e92486a395be9cfe822562e718 to correctly update existing prefixes. CW-Bug-Id: #19617 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index c9ba98adfd9..964f37d2798 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2827,6 +2827,7 @@ HKCU,Software\Wine\AppDefaults\BlackOps3.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\NFS16.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\ShadowOfWar.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\DIRT5.exe\DllOverrides,"atiadlxx",,"builtin" +HKCU,Software\Wine\AppDefaults\Paradox Launcher.exe\DllOverrides,,4, HKCU,Software\Wine\AppDefaults\gotg.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\RelicCardinal.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\msedgewebview2.exe,"Version",,"win81" From a864939a31a528eb39063dda9d843b73f2fb87ac Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 29 Jun 2022 14:09:43 -0500 Subject: [PATCH 0734/1506] ntdll: HACK: Add WINE_NO_PRIV_ELEVATION option and auto enable it for Aquarist - My First Job. CW-Bug-Id: #20846 --- dlls/ntdll/unix/loader.c | 5 +++++ dlls/ntdll/unix/security.c | 3 +++ dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 9 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 4745cabd917..af55b0398e2 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1982,6 +1982,7 @@ BOOL ac_odyssey; BOOL fsync_simulate_sched_quantum; BOOL alert_simulate_sched_quantum; BOOL fsync_yield_to_waiters; +BOOL no_priv_elevation; static void hacks_init(void) { @@ -2036,6 +2037,10 @@ static void hacks_init(void) break; } + env_str = getenv("WINE_NO_PRIV_ELEVATION"); + if (env_str) no_priv_elevation = atoi(env_str); + else if (sgi) no_priv_elevation = !strcmp(sgi, "1584660"); + env_str = getenv("WINE_UNIX_PC_AS_NTDLL"); if (env_str) report_native_pc_as_ntdll = atoi(env_str); else if (sgi) report_native_pc_as_ntdll = !strcmp(sgi, "700330"); diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c index 3f66d959373..8226a4b14fc 100644 --- a/dlls/ntdll/unix/security.c +++ b/dlls/ntdll/unix/security.c @@ -519,6 +519,8 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c if (!status) *type = reply->elevation; } SERVER_END_REQ; + if (!status && no_priv_elevation) + *(TOKEN_ELEVATION_TYPE *)info = TokenElevationTypeLimited; break; case TokenElevation: @@ -529,6 +531,7 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c req->handle = wine_server_obj_handle( token ); status = wine_server_call( req ); if (!status) elevation->TokenIsElevated = (reply->elevation == TokenElevationTypeFull); + if (!status && no_priv_elevation) elevation->TokenIsElevated = 0; } SERVER_END_REQ; break; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index a9b434e39fa..39d0b039982 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -182,6 +182,7 @@ extern BOOL ac_odyssey; extern BOOL fsync_simulate_sched_quantum; extern BOOL alert_simulate_sched_quantum; extern BOOL fsync_yield_to_waiters; +extern BOOL no_priv_elevation; extern void init_environment(void); extern void init_startup_info(void); From 3a17c729de24bfe936bd9ea366c4d39e6619c049 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Jul 2022 20:00:08 -0500 Subject: [PATCH 0735/1506] ntdll: HACK: Report LocalSystem accound SID for MicrosoftEdgeUpdate. CW-Bug-Id: #20967 --- dlls/ntdll/unix/loader.c | 8 ++++++++ dlls/ntdll/unix/security.c | 22 ++++++++++++++++++++++ dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 31 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index af55b0398e2..3f4224e1692 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1983,6 +1983,7 @@ BOOL fsync_simulate_sched_quantum; BOOL alert_simulate_sched_quantum; BOOL fsync_yield_to_waiters; BOOL no_priv_elevation; +BOOL localsystem_sid; static void hacks_init(void) { @@ -2045,6 +2046,13 @@ static void hacks_init(void) if (env_str) report_native_pc_as_ntdll = atoi(env_str); else if (sgi) report_native_pc_as_ntdll = !strcmp(sgi, "700330"); + if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) + { + ERR("HACK: reporting LocalSystem account SID.\n"); + localsystem_sid = TRUE; + return; + } + if (sgi && (0 || !strcmp(sgi, "1364780") || !strcmp(sgi, "1952120") || !strcmp(sgi, "2154900") /* Street Fighter 6 */ || !strcmp(sgi, "1740720") /* Have a Nice Death */ diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c index 8226a4b14fc..4933bf389b5 100644 --- a/dlls/ntdll/unix/security.c +++ b/dlls/ntdll/unix/security.c @@ -323,6 +323,28 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c switch (class) { case TokenUser: + if (localsystem_sid) + { + static const struct sid local_system_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_LOCAL_SYSTEM_RID } }; + DWORD sid_len = offsetof( struct sid, sub_auth[local_system_sid.sub_count] ); + TOKEN_USER *tuser; + PSID sid; + + if (retlen) *retlen = sid_len + sizeof(TOKEN_USER); + if (sid_len + sizeof(TOKEN_USER) > length) + { + status = STATUS_BUFFER_TOO_SMALL; + } + else + { + tuser = info; + sid = tuser + 1; + tuser->User.Sid = sid; + tuser->User.Attributes = 0; + memcpy( sid, &local_system_sid, sid_len ); + } + break; + } SERVER_START_REQ( get_token_sid ) { TOKEN_USER *tuser = info; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 39d0b039982..33f23864b86 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -183,6 +183,7 @@ extern BOOL fsync_simulate_sched_quantum; extern BOOL alert_simulate_sched_quantum; extern BOOL fsync_yield_to_waiters; extern BOOL no_priv_elevation; +extern BOOL localsystem_sid; extern void init_environment(void); extern void init_startup_info(void); From c43a95df08287e255052bb3b7aefd03e25d2dc96 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 28 Oct 2022 20:24:29 -0500 Subject: [PATCH 0736/1506] kernelbase: HACK: Force GL QtWebEngine rendering for EADesktop. CW-Bug-Id: #21497 --- dlls/kernelbase/process.c | 31 +++++++++++++++++++++++++++++++ dlls/ntdll/unix/loader.c | 8 ++++++++ 2 files changed, 39 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index bdc3e1caa36..e431f2e8a98 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -1932,6 +1932,37 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW( LPCWSTR name, LPCWSTR val return FALSE; } + if (name && !lstrcmpW( name, L"QT_OPENGL" ) && value && !lstrcmpW( value, L"angle" )) + { + static const WCHAR *names[] = + { + L"\\EADesktop.exe", + L"\\Link2EA.exe", + L"\\EAConnect_microsoft.exe", + L"\\EALaunchHelper.exe", + L"\\EACrashReporter.exe", + L"EA Desktop\\ErrorReporter.exe", + }; + unsigned int i, len; + WCHAR module[256]; + DWORD size; + + if ((size = GetModuleFileNameW( NULL, module, ARRAY_SIZE(module) )) && size < ARRAY_SIZE(module)) + { + for (i = 0; i < ARRAY_SIZE(names); ++i) + { + len = lstrlenW(names[i]); + if (size > len && !memcmp( module + size - len, names[i], len * sizeof(*module) )) + { + value = L"desktop"; + FIXME( "HACK: setting QT_OPENGL=desktop.\n" ); + break; + } + } + } + } + + RtlInitUnicodeString( &us_name, name ); if (value) { diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 3f4224e1692..5292a7e31ed 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2066,6 +2066,14 @@ static void hacks_init(void) ERR("HACK: setting LIBGL_ALWAYS_SOFTWARE.\n"); setenv("LIBGL_ALWAYS_SOFTWARE", "1", 0); } + + if (main_argc > 1 && (strstr(main_argv[1], "\\EADesktop.exe") || strstr(main_argv[1], "\\Link2EA.exe") + || strstr(main_argv[1], "EA Desktop\\ErrorReporter.exe") || strstr(main_argv[1], "\\EAConnect_microsoft.exe") + || strstr(main_argv[1], "\\EALaunchHelper.exe") || strstr(main_argv[1], "\\EACrashReporter.exe"))) + { + ERR("HACK: setting LIBGL_ALWAYS_SOFTWARE.\n"); + setenv("LIBGL_ALWAYS_SOFTWARE", "1", 0); + } } /*********************************************************************** From dc6bd5820f5f3d2fba351a9d1ad0fdb2be9ad5c0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sat, 18 Dec 2021 00:24:39 +0300 Subject: [PATCH 0737/1506] ntdll: Change module search order in LdrFindEntryForAddress(). CW-Bug-Id: #19827 To be dropped once we have module search tree implementation. --- dlls/ntdll/loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index acd0eb2cd8d..0aee489662a 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1860,10 +1860,10 @@ NTSTATUS WINAPI LdrFindEntryForAddress( const void *addr, PLDR_DATA_TABLE_ENTRY PLIST_ENTRY mark, entry; PLDR_DATA_TABLE_ENTRY mod; - mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList; - for (entry = mark->Flink; entry != mark; entry = entry->Flink) + mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList; + for (entry = mark->Blink; entry != mark; entry = entry->Blink) { - mod = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks); + mod = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); if (mod->DllBase <= addr && (const char *)addr < (char*)mod->DllBase + mod->SizeOfImage) { From 9a19387feb6b4044a89efb06db9d491ea7fa4568 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 4 Jan 2022 17:41:46 +0300 Subject: [PATCH 0738/1506] advapi32: Initialize computer SID from registry. CW-Bug-Id: #19702 --- dlls/advapi32/security.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 8d0c6977d72..43c35b14eca 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -244,12 +244,42 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) return Result; } +static BOOL WINAPI init_computer_sid( INIT_ONCE *init_once, void *parameter, void **context ) +{ + DWORD *sub_authority = parameter; + unsigned int i, count; + DWORD len, index; + BOOL found = FALSE; + DWORD values[3]; + char buffer[64]; + LSTATUS status; + + len = ARRAY_SIZE(buffer); + index = 0; + while (!(status = RegEnumKeyExA( HKEY_USERS, index, buffer, &len, NULL, NULL, NULL, NULL ))) + { + count = sscanf(buffer, "S-1-5-21-%lu-%lu-%lu", &values[0], &values[1], &values[2]); + if (count == 3) + { + if (found) + ERR( "Multiple users are not supported.\n" ); + for (i = 0; i < 3; ++i) + sub_authority[i] = values[i]; + found = TRUE; + } + ++index; + len = ARRAY_SIZE(buffer); + } + return found; +} + /************************************************************ * ADVAPI_GetComputerSid */ BOOL ADVAPI_GetComputerSid(PSID sid) { - static const struct /* same fields as struct SID */ + static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; + static struct /* same fields as struct SID */ { BYTE Revision; BYTE SubAuthorityCount; @@ -258,6 +288,9 @@ BOOL ADVAPI_GetComputerSid(PSID sid) } computer_sid = { SID_REVISION, 4, { SECURITY_NT_AUTHORITY }, { SECURITY_NT_NON_UNIQUE, 0, 0, 0 } }; + if (!InitOnceExecuteOnce( &init_once, init_computer_sid, computer_sid.SubAuthority + 1, NULL )) + ERR( "Could not initialize computer sid.\n" ); + memcpy( sid, &computer_sid, sizeof(computer_sid) ); return TRUE; } From 5c6bf0404b5be869e5a84647be89dbcfa730be0d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 4 Jan 2022 17:42:35 +0300 Subject: [PATCH 0739/1506] sechost: Initialize computer SID from registry. CW-Bug-Id: #19702 --- dlls/sechost/security.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/dlls/sechost/security.c b/dlls/sechost/security.c index 90e227b2948..e2906fa1c02 100644 --- a/dlls/sechost/security.c +++ b/dlls/sechost/security.c @@ -580,9 +580,39 @@ BOOL WINAPI DECLSPEC_HOTPATCH ConvertSecurityDescriptorToStringSecurityDescripto return TRUE; } +static BOOL WINAPI init_computer_sid( INIT_ONCE *init_once, void *parameter, void **context ) +{ + DWORD *sub_authority = parameter; + unsigned int i, count; + DWORD len, index; + BOOL found = FALSE; + UINT values[3]; + char buffer[64]; + LSTATUS status; + + len = ARRAY_SIZE(buffer); + index = 0; + while (!(status = RegEnumKeyExA( HKEY_USERS, index, buffer, &len, NULL, NULL, NULL, NULL ))) + { + count = sscanf(buffer, "S-1-5-21-%u-%u-%u", &values[0], &values[1], &values[2]); + if (count == 3) + { + if (found) + ERR( "Multiple users are not supported.\n" ); + for (i = 0; i < 3; ++i) + sub_authority[i] = values[i]; + found = TRUE; + } + ++index; + len = ARRAY_SIZE(buffer); + } + return found; +} + static BOOL get_computer_sid( PSID sid ) { - static const struct /* same fields as struct SID */ + static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; + static struct /* same fields as struct SID */ { BYTE Revision; BYTE SubAuthorityCount; @@ -591,6 +621,9 @@ static BOOL get_computer_sid( PSID sid ) } computer_sid = { SID_REVISION, 4, { SECURITY_NT_AUTHORITY }, { SECURITY_NT_NON_UNIQUE, 0, 0, 0 } }; + if (!InitOnceExecuteOnce( &init_once, init_computer_sid, computer_sid.SubAuthority + 1, NULL )) + ERR( "Could not initialize computer sid.\n" ); + memcpy( sid, &computer_sid, sizeof(computer_sid) ); return TRUE; } From 638f5d5b29d3f87905f172ae60ac042ddeb9c5e3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 22 Dec 2021 00:52:53 +0300 Subject: [PATCH 0740/1506] server: Initialize local user SID with unique values. CW-Bug-Id: #19702 --- server/main.c | 2 ++ server/security.h | 4 +++- server/token.c | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/server/main.c b/server/main.c index 9559ad83584..d0a0a4879b5 100644 --- a/server/main.c +++ b/server/main.c @@ -34,6 +34,7 @@ #include "thread.h" #include "request.h" #include "unicode.h" +#include "security.h" #include "esync.h" #include "fsync.h" @@ -244,6 +245,7 @@ int main( int argc, char *argv[] ) set_current_time(); init_signals(); init_memory(); + init_user_sid(); init_directories( load_intl_file() ); init_threading(); init_registry(); diff --git a/server/security.h b/server/security.h index 58ab1594eae..8bba8c59565 100644 --- a/server/security.h +++ b/server/security.h @@ -45,7 +45,7 @@ extern const struct luid SeImpersonatePrivilege; extern const struct luid SeCreateGlobalPrivilege; extern const struct sid world_sid; -extern const struct sid local_user_sid; +extern struct sid local_user_sid; extern const struct sid local_system_sid; extern const struct sid builtin_users_sid; extern const struct sid builtin_admins_sid; @@ -60,6 +60,7 @@ struct ace unsigned int mask; }; + /* token functions */ extern struct token *get_token_obj( struct process *process, obj_handle_t handle, unsigned int access ); @@ -122,6 +123,7 @@ static inline struct ace *set_ace( struct ace *ace, const struct sid *sid, unsig extern void security_set_thread_token( struct thread *thread, obj_handle_t handle ); extern const struct sid *security_unix_uid_to_sid( uid_t uid ); +extern void init_user_sid(void); extern int check_object_access( struct token *token, struct object *obj, unsigned int *access ); static inline int thread_single_check_privilege( struct thread *thread, struct luid priv ) diff --git a/server/token.c b/server/token.c index 0529d967b8a..ecb639ec636 100644 --- a/server/token.c +++ b/server/token.c @@ -23,11 +23,15 @@ #include "config.h" #include +#include #include #include #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -73,7 +77,7 @@ struct sid_attrs const struct sid world_sid = { SID_REVISION, 1, SECURITY_WORLD_SID_AUTHORITY, { SECURITY_WORLD_RID } }; const struct sid local_system_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_LOCAL_SYSTEM_RID } }; const struct sid high_label_sid = { SID_REVISION, 1, SECURITY_MANDATORY_LABEL_AUTHORITY, { SECURITY_MANDATORY_HIGH_RID } }; -const struct sid local_user_sid = { SID_REVISION, 5, SECURITY_NT_AUTHORITY, { SECURITY_NT_NON_UNIQUE, 0, 0, 0, 1000 } }; + struct sid local_user_sid = { SID_REVISION, 5, SECURITY_NT_AUTHORITY, { SECURITY_NT_NON_UNIQUE, 0, 0, 0, 1000 } }; const struct sid builtin_admins_sid = { SID_REVISION, 2, SECURITY_NT_AUTHORITY, { SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS } }; const struct sid builtin_users_sid = { SID_REVISION, 2, SECURITY_NT_AUTHORITY, { SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_USERS } }; const struct sid domain_users_sid = { SID_REVISION, 5, SECURITY_NT_AUTHORITY, { SECURITY_NT_NON_UNIQUE, 0, 0, 0, DOMAIN_GROUP_RID_USERS } }; @@ -201,6 +205,35 @@ const struct sid *security_unix_uid_to_sid( uid_t uid ) return &anonymous_logon_sid; } +void init_user_sid(void) +{ + char machine_id[17]; + uint64_t id; + size_t n; + FILE *f; + + f = fopen( "/etc/machine-id", "r" ); + if (!f) + { + fprintf( stderr, "Failed to open /etc/machine-id, error %s.\n", strerror( errno )); + return; + } + + n = fread( machine_id, sizeof(*machine_id), 16, f ); + fclose(f); + + if (n != 16) + { + fprintf( stderr, "Failed to read /etc/machine-id, error %s.\n", strerror( errno )); + return; + } + machine_id[n] = 0; + id = strtoull( machine_id, NULL, 0x10 ); + local_user_sid.sub_auth[1] = id >> 32; + local_user_sid.sub_auth[2] = id & 0xffffffff; + local_user_sid.sub_auth[3] = getuid(); +} + static int acl_is_valid( const struct acl *acl, data_size_t size ) { ULONG i; From cf08808609a9010a489309ef0a00a92d4c54a400 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 1 Apr 2022 17:39:50 +0300 Subject: [PATCH 0741/1506] msvcrt: HACK: Introduce asm wrapper for _isatty on x64. CW-Bug-Id: #20419 --- dlls/msvcrt/file.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 3c1d9572585..3de12d1087f 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -44,6 +44,7 @@ #include "mtdll.h" #include "wine/asm.h" #include "wine/debug.h" +#include "wine/asm.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); @@ -818,12 +819,28 @@ static int msvcrt_flush_buffer(FILE* file) /********************************************************************* * _isatty (MSVCRT.@) */ +#ifdef __x86_64__ +int CDECL MSVCRT__isatty(int fd) +{ + TRACE(":fd (%d)\n",fd); + + return get_ioinfo_nolock(fd)->wxflag & WX_TTY; +} +__ASM_GLOBAL_FUNC( _isatty, + "sub $0x30,%rsp\n\t" + "lea MSVCRT___pioinfo(%rip),%rdx\n\t" + "nop;nop;nop;nop;nop;nop;nop;nop;nop\n\t" + "add $0x30,%rsp\n\t" + "jmp " __ASM_NAME( "MSVCRT__isatty" ) ) +#else int CDECL _isatty(int fd) { TRACE(":fd (%d)\n",fd); return get_ioinfo_nolock(fd)->wxflag & WX_TTY; } +#endif + /* INTERNAL: Allocate stdio file buffer */ static BOOL msvcrt_alloc_buffer(FILE* file) From fabf4c267281ac0bc0baa534a50c103524289e4e Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Thu, 30 Sep 2021 14:38:33 +0200 Subject: [PATCH 0742/1506] sechost: Fake presence of BEService service for ARK: Survival Evolved. The game uses the presence and status of BEService to determine whether or not the game is running in BattlEye. Since with the Proton Bridge we don't have a dedicated background service, we can just pretend the service is always running. CW-Bug-Id: #16650 --- dlls/sechost/service.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/sechost/service.c b/dlls/sechost/service.c index 240e048a4a5..c5834f9f618 100644 --- a/dlls/sechost/service.c +++ b/dlls/sechost/service.c @@ -313,6 +313,8 @@ SC_HANDLE WINAPI DECLSPEC_HOTPATCH OpenServiceW( SC_HANDLE manager, const WCHAR SC_RPC_HANDLE handle = NULL; DWORD err; + char str[64]; + TRACE( "%p %s %#lx\n", manager, debugstr_w(name), access ); if (!manager) @@ -321,6 +323,14 @@ SC_HANDLE WINAPI DECLSPEC_HOTPATCH OpenServiceW( SC_HANDLE manager, const WCHAR return NULL; } + /* HACK for ARK: Survivial Evolved checking the status of BEService to determine whether BE is enabled. */ + if(GetEnvironmentVariableA("SteamGameId", str, sizeof(str)) && !strcmp(str, "346110") && + !wcscmp(name, L"BEService")) + { + WARN("HACK: returning fake service handle for BEService.\n"); + return (void *)0xdeadbeef; + } + __TRY { err = svcctl_OpenServiceW( manager, name, access, &handle ); @@ -1105,6 +1115,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH QueryServiceStatusEx( SC_HANDLE service, SC_STATUS { DWORD err; + char str[64]; + TRACE( "%p %d %p %ld %p\n", service, level, buffer, size, ret_size ); if (level != SC_STATUS_PROCESS_INFO) return set_error( ERROR_INVALID_LEVEL ); @@ -1115,6 +1127,24 @@ BOOL WINAPI DECLSPEC_HOTPATCH QueryServiceStatusEx( SC_HANDLE service, SC_STATUS return set_error( ERROR_INSUFFICIENT_BUFFER ); } + /* HACK for ARK: Survivial Evolved checking the status of BEService to determine whether BE is enabled. */ + if(GetEnvironmentVariableA("SteamGameId", str, sizeof(str)) && !strcmp(str, "346110") && + service == (void *)0xdeadbeef) + { + SERVICE_STATUS_PROCESS *status = (SERVICE_STATUS_PROCESS *)buffer; + WARN("HACK: returning fake data for BEService.\n"); + status->dwServiceType = SERVICE_WIN32_OWN_PROCESS; + status->dwCurrentState = SERVICE_RUNNING; + status->dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_STOP; + status->dwWin32ExitCode = NO_ERROR; + status->dwServiceSpecificExitCode = 0; + status->dwCheckPoint = 0; + status->dwWaitHint = 0; + status->dwProcessId = 0xdeadbee0; + status->dwServiceFlags = 0; + return TRUE; + } + __TRY { err = svcctl_QueryServiceStatusEx( service, level, buffer, size, ret_size ); From 47a1620c6478b013fcfd0b73603721e11edba057 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 22 Feb 2022 13:12:09 -0500 Subject: [PATCH 0743/1506] Fall Guys EOS overlay in process GPU. --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index e431f2e8a98..1eee356d1b8 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -613,6 +613,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"UplayWebCore.exe", L" --use-gl=swiftshader"}, {L"Paradox Launcher.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, + {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, }; unsigned int i; From dbaea1117ded7416b3cc9ca2d76600add9550a73 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 Apr 2022 20:35:03 +0300 Subject: [PATCH 0744/1506] wined3d: Post WM_ACTIVATEAPP upon receiving WM_SIZE in device_process_message(). CW-Bug-Id: #20422 --- dlls/wined3d/device.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 4aeade1d2de..f786452773a 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5369,6 +5369,11 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL DefWindowProcA(window, message, wparam, lparam); } } + else if (message == WM_SIZE) + { + if (!IsIconic(window)) + PostMessageW(window, WM_ACTIVATEAPP, 1, GetCurrentThreadId()); + } if (unicode) return CallWindowProcW(proc, window, message, wparam, lparam); From c82afa79954e4488f67ea5e0194fe955aefcc8dc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 Apr 2022 20:34:07 +0300 Subject: [PATCH 0745/1506] wined3d: Ignore multiple app activation messages in device_process_message(). CW-Bug-Id: #20422 CW-Bug-Id: #21462 --- dlls/wined3d/device.c | 13 +++++-- dlls/wined3d/wined3d_main.c | 71 ++++++++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 4 ++ 3 files changed, 85 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f786452773a..0177c5ced43 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5346,7 +5346,10 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL } else if (message == WM_DISPLAYCHANGE) { + BOOL inside_mode_change = wined3d_set_inside_mode_change(window, TRUE); + device->device_parent->ops->mode_changed(device->device_parent); + wined3d_set_inside_mode_change(window, inside_mode_change); } else if (message == WM_ACTIVATEAPP) { @@ -5356,8 +5359,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL * (e.g. Deus Ex: GOTY) to destroy the device, so take care to * deactivate the implicit swapchain last, and to avoid accessing the * "device" pointer afterwards. */ - while (i--) - wined3d_swapchain_activate(device->swapchains[i], wparam); + if (!wparam || !wined3d_get_activate_processed(window)) + { + wined3d_set_activate_processed(window, !!wparam); + while (i--) + wined3d_swapchain_activate(device->swapchains[i], wparam); + } } else if (message == WM_SYSCOMMAND) { @@ -5369,7 +5376,7 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL DefWindowProcA(window, message, wparam, lparam); } } - else if (message == WM_SIZE) + else if (message == WM_SIZE && !wined3d_get_inside_mode_change(window)) { if (!IsIconic(window)) PostMessageW(window, WM_ACTIVATEAPP, 1, GetCurrentThreadId()); diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 1368b4fc905..83fa519f3e5 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -42,6 +42,8 @@ struct wined3d_wndproc HWND window; BOOL unicode; BOOL filter; + BOOL activate_processed; + BOOL inside_mode_change; WNDPROC proc; struct wined3d_device *device; uint32_t flags; @@ -633,6 +635,73 @@ BOOL wined3d_filter_messages(HWND window, BOOL filter) return ret; } +BOOL wined3d_get_activate_processed(HWND window) +{ + struct wined3d_wndproc *entry; + BOOL ret; + + wined3d_wndproc_mutex_lock(); + + if (!(entry = wined3d_find_wndproc(window, NULL))) + { + wined3d_wndproc_mutex_unlock(); + return FALSE; + } + ret = entry->activate_processed; + wined3d_wndproc_mutex_unlock(); + return ret; +} + +void wined3d_set_activate_processed(HWND window, BOOL activate_processed) +{ + struct wined3d_wndproc *entry; + + wined3d_wndproc_mutex_lock(); + + if (!(entry = wined3d_find_wndproc(window, NULL))) + { + wined3d_wndproc_mutex_unlock(); + return; + } + entry->activate_processed = activate_processed; + wined3d_wndproc_mutex_unlock(); +} + +BOOL wined3d_get_inside_mode_change(HWND window) +{ + struct wined3d_wndproc *entry; + BOOL ret; + + wined3d_wndproc_mutex_lock(); + + if (!(entry = wined3d_find_wndproc(window, NULL))) + { + wined3d_wndproc_mutex_unlock(); + return FALSE; + } + ret = entry->inside_mode_change; + wined3d_wndproc_mutex_unlock(); + return ret; +} + +BOOL wined3d_set_inside_mode_change(HWND window, BOOL inside_mode_change) +{ + struct wined3d_wndproc *entry; + BOOL ret; + + wined3d_wndproc_mutex_lock(); + + if (!(entry = wined3d_find_wndproc(window, NULL))) + { + wined3d_wndproc_mutex_unlock(); + return FALSE; + } + ret = entry->inside_mode_change; + entry->inside_mode_change = inside_mode_change; + wined3d_wndproc_mutex_unlock(); + return ret; +} + static LRESULT CALLBACK wined3d_wndproc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) { struct wined3d_wndproc *entry; @@ -769,6 +838,8 @@ BOOL CDECL wined3d_register_window(struct wined3d *wined3d, HWND window, entry->device = device; entry->wined3d = wined3d; entry->flags = flags; + entry->activate_processed = FALSE; + entry->inside_mode_change = FALSE; wined3d_wndproc_mutex_unlock(); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 238456e78d8..55ef62a92b9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2785,6 +2785,10 @@ struct wined3d BOOL wined3d_filter_messages(HWND window, BOOL filter); HRESULT wined3d_init(struct wined3d *wined3d, uint32_t flags); void wined3d_unregister_window(HWND window); +BOOL wined3d_get_activate_processed(HWND window); +void wined3d_set_activate_processed(HWND window, BOOL activate_processed); +BOOL wined3d_get_inside_mode_change(HWND window); +BOOL wined3d_set_inside_mode_change(HWND window, BOOL inside_mode_change); BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size); From c56076c5870ef7f26b52b0704464bc5d9ab9f2c9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 11 Nov 2022 15:44:05 -0600 Subject: [PATCH 0746/1506] gdi32: Add stub for D3DKMTEnumAdapters2(). CW-Bug-Id: #21558 --- dlls/gdi32/gdi32.spec | 1 + dlls/gdi32/objects.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 0ad47111eaa..44783e3600a 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -79,6 +79,7 @@ @ stdcall D3DKMTCreateDevice(ptr) win32u.NtGdiDdDDICreateDevice @ stdcall D3DKMTDestroyDCFromMemory(ptr) win32u.NtGdiDdDDIDestroyDCFromMemory @ stdcall D3DKMTDestroyDevice(ptr) win32u.NtGdiDdDDIDestroyDevice +@ stdcall D3DKMTEnumAdapters2(ptr) @ stdcall D3DKMTEscape(ptr) win32u.NtGdiDdDDIEscape @ stdcall D3DKMTOpenAdapterFromDeviceName(ptr) win32u.NtGdiDdDDIOpenAdapterFromDeviceName @ stdcall D3DKMTOpenAdapterFromGdiDisplayName(ptr) diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 070ce9c3885..bddc29a3007 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -971,6 +971,12 @@ NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName( D3DKMT_OPENADAPTERFROMGDIDI return status; } +NTSTATUS WINAPI D3DKMTEnumAdapters2( const void *param ) +{ + FIXME( "param %p stub.\n", param ); + return STATUS_NOT_SUPPORTED; +} + /*********************************************************************** * SetObjectOwner (GDI32.@) */ From a6b953ea4959f441e305e2cf4747bf4dd0252b6f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 4 Nov 2020 18:08:21 +0300 Subject: [PATCH 0747/1506] ws2_32: HACK Fail 'download-alt.easyanticheat.net' DNS name resolution. CW-Bug-Id: #16695 --- dlls/ws2_32/protocol.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c index c19f8430d98..b74de9ffa8e 100644 --- a/dlls/ws2_32/protocol.c +++ b/dlls/ws2_32/protocol.c @@ -148,6 +148,25 @@ static int dns_only_query( const char *node, const struct addrinfo *hints, struc return 0; } +static BOOL eac_download_hack(void) +{ + static int eac_download_hack_enabled = -1; + char str[64]; + + if (eac_download_hack_enabled == -1) + { + if (GetEnvironmentVariableA("WINE_DISABLE_EAC_ALT_DOWNLOAD", str, sizeof(str))) + eac_download_hack_enabled = !!atoi(str); + else + eac_download_hack_enabled = GetEnvironmentVariableA("SteamGameId", str, sizeof(str)) + && !strcmp(str, "626690"); + + if (eac_download_hack_enabled) + ERR("HACK: failing download-alt.easyanticheat.net resolution.\n"); + } + return eac_download_hack_enabled; +} + /*********************************************************************** * getaddrinfo (ws2_32.@) */ @@ -169,6 +188,12 @@ int WINAPI getaddrinfo( const char *node, const char *service, if (node) { + if (eac_download_hack() && !strcmp(node, "download-alt.easyanticheat.net")) + { + SetLastError(WSAHOST_NOT_FOUND); + return WSAHOST_NOT_FOUND; + } + if (!node[0]) { if (!(fqdn = get_fqdn())) return WSA_NOT_ENOUGH_MEMORY; @@ -927,6 +952,12 @@ struct hostent * WINAPI gethostbyname( const char *name ) return NULL; } + if (eac_download_hack() && name && !strcmp(name, "download-alt.easyanticheat.net")) + { + SetLastError( WSAHOST_NOT_FOUND ); + return NULL; + } + if ((ret = WS_CALL( gethostname, ¶ms ))) { SetLastError( ret ); From f5309046b435b6cd2783377b03afa55f2119f553 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 15 Jun 2022 17:21:55 -0500 Subject: [PATCH 0748/1506] ntdll: Do not open directory file when setting the same directory path. CW-Bug-Id: #20815 --- dlls/ntdll/path.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 6aa4bb3fdff..dda6ba4ee53 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -914,13 +914,13 @@ ULONG WINAPI RtlGetCurrentDirectory_U(ULONG buflen, LPWSTR buf) NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) { FILE_FS_DEVICE_INFORMATION device_info; + ULONG size, compare_size; OBJECT_ATTRIBUTES attr; UNICODE_STRING newdir; IO_STATUS_BLOCK io; CURDIR *curdir; HANDLE handle; NTSTATUS nts; - ULONG size; PWSTR ptr; newdir.Buffer = NULL; @@ -938,6 +938,22 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) goto out; } + size = newdir.Length / sizeof(WCHAR); + ptr = newdir.Buffer; + ptr += 4; /* skip \??\ prefix */ + size -= 4; + + if (size && ptr[size - 1] == '\\') compare_size = size - 1; + else compare_size = size; + + if (curdir->DosPath.Length == (compare_size + 1) * sizeof(WCHAR) + && !memcmp( curdir->DosPath.Buffer, ptr, compare_size * sizeof(WCHAR) )) + { + TRACE( "dir %s is the same as current.\n", debugstr_us(dir) ); + nts = STATUS_SUCCESS; + goto out; + } + attr.Length = sizeof(attr); attr.RootDirectory = 0; attr.Attributes = OBJ_CASE_INSENSITIVE; @@ -962,10 +978,6 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) curdir->Handle = handle; /* append trailing \ if missing */ - size = newdir.Length / sizeof(WCHAR); - ptr = newdir.Buffer; - ptr += 4; /* skip \??\ prefix */ - size -= 4; if (size && ptr[size - 1] != '\\') ptr[size++] = '\\'; /* convert \??\UNC\ path to \\ prefix */ From faffafadade80afd2205d564ea9c85f1f125a28d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 17 Sep 2021 21:49:11 +0300 Subject: [PATCH 0749/1506] advapi32: HACK: Don't free provider library in CryptReleaseContext() for DeathLoop. CW-Bug-Id: #19427 Avoids a lockup in DeathLoop. To be dropped once we have a GetModuleHandle() not blocking on the loader lock. --- dlls/advapi32/crypt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c index 73c9b1d219d..c3f927cfb60 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -645,9 +645,19 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags) if (InterlockedDecrement(&pProv->refcount) == 0) { + static unsigned int once; + char sgi[64]; + ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags); pProv->dwMagic = 0; - FreeLibrary(pProv->hModule); + if(GetEnvironmentVariableA("SteamGameId", sgi, sizeof(sgi)) && !strcmp(sgi, "1252330")) + { + if (!once++) FIXME("HACK: not freeing provider library.\n"); + } + else + { + FreeLibrary(pProv->hModule); + } #if 0 CRYPT_Free(pProv->pVTable->pContextInfo); #endif From 96e3ee88b6b23d47ef6ef21adacaee0f72351e05 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Jun 2022 13:41:44 -0500 Subject: [PATCH 0750/1506] ntdll: Factor out validate_context_xstate() function. CW-Bug-Id: #20821 --- dlls/ntdll/unix/signal_i386.c | 4 +--- dlls/ntdll/unix/signal_x86_64.c | 4 +--- dlls/ntdll/unix/thread.c | 17 +++++++++++++++++ dlls/ntdll/unix/unix_private.h | 1 + 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index cb1a1f03199..67f9c5c1a70 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1149,9 +1149,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) - || context_ex->XState.Length > sizeof(XSTATE)) - return STATUS_INVALID_PARAMETER; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 92e5759bc3d..d83839591a0 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1177,9 +1177,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) - || context_ex->XState.Length > sizeof(XSTATE)) - return STATUS_INVALID_PARAMETER; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 88fb940f6a5..94fdcbf9a52 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -158,6 +158,23 @@ void fpu_to_fpux( XMM_SAVE_AREA32 *fpux, const I386_FLOATING_SAVE_AREA *fpu ) } +/*********************************************************************** + * validate_context_xstate + */ +BOOL validate_context_xstate( CONTEXT *context ) +{ + CONTEXT_EX *context_ex; + + context_ex = (CONTEXT_EX *)(context + 1); + + if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) + || context_ex->XState.Length > sizeof(XSTATE)) + return FALSE; + + return TRUE; +} + + /*********************************************************************** * get_server_context_flags */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 33f23864b86..904a35f471b 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -229,6 +229,7 @@ extern void DECLSPEC_NORETURN abort_process( int status ); extern void DECLSPEC_NORETURN exit_process( int status ); extern void wait_suspend( CONTEXT *context ); extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ); +extern BOOL validate_context_xstate( CONTEXT *context ); extern NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *self, USHORT machine ); extern NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT machine ); extern unsigned int alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret, From 92fe92017e5b6e1cee22b2d4d6b86dbb5014e5c9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Jun 2022 13:50:10 -0500 Subject: [PATCH 0751/1506] ntdll: Validate context xstate at once in NtGetContextThread(). CW-Bug-Id: #20821 --- dlls/ntdll/unix/signal_i386.c | 4 ++-- dlls/ntdll/unix/signal_x86_64.c | 4 ++-- dlls/ntdll/unix/thread.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 67f9c5c1a70..c372b5bf3a0 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1050,6 +1050,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) BOOL use_cached_debug_regs = FALSE; NTSTATUS ret; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) { /* debug registers require a server call if hw breakpoints are enabled */ @@ -1149,8 +1151,6 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; - mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index d83839591a0..d8d5678ec80 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1087,6 +1087,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) BOOL use_cached_debug_regs = FALSE; BOOL self = (handle == GetCurrentThread()); + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) { /* debug registers require a server call if hw breakpoints are enabled */ @@ -1177,8 +1179,6 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; - mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 94fdcbf9a52..34f2781c71a 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -165,6 +165,8 @@ BOOL validate_context_xstate( CONTEXT *context ) { CONTEXT_EX *context_ex; + if (!((context->ContextFlags & 0x40) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX))) return TRUE; + context_ex = (CONTEXT_EX *)(context + 1); if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) From f3757df4074d132647aa74be1428b9948ff0a7ad Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Jun 2022 13:25:39 -0500 Subject: [PATCH 0752/1506] ntdll: Validate xstate alignment in validate_context_xstate(). CW-Bug-Id: #20821 --- dlls/ntdll/tests/exception.c | 14 ++++++++++++++ dlls/ntdll/unix/thread.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 76190aef75a..bb62d4627a5 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -10895,6 +10895,7 @@ static void test_extended_context(void) CONTEXT_EX *context_ex; CONTEXT *context; unsigned data[8]; + NTSTATUS status; HANDLE thread; ULONG64 mask; XSTATE *xs; @@ -11688,6 +11689,19 @@ static void test_extended_context(void) thread = CreateThread(NULL, 0, test_extended_context_thread, 0, CREATE_SUSPENDED, NULL); ok(!!thread, "Failed to create thread.\n"); + /* Unaligned xstate. */ + length = sizeof(context_buffer); + memset(context_buffer, 0xcc, sizeof(context_buffer)); + bret = pInitializeContext(context_buffer, CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT, + &context, &length); + ok(bret, "Got unexpected bret %#x.\n", bret); + context_ex = (CONTEXT_EX *)(context + 1); + context_ex->XState.Offset += 0x10; + status = pNtGetContextThread(thread, context); + ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status); + status = pNtGetContextThread(GetCurrentThread(), context); + ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status); + bret = pInitializeContext(context_buffer, CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT, &context, &length); ok(bret, "Got unexpected bret %#x.\n", bret); diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 34f2781c71a..e7c6c5f560a 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -173,6 +173,8 @@ BOOL validate_context_xstate( CONTEXT *context ) || context_ex->XState.Length > sizeof(XSTATE)) return FALSE; + if (((ULONG_PTR)context_ex + context_ex->XState.Offset) & 63) return FALSE; + return TRUE; } From a1b16ab50b8a60aa6539152abb847b5cd0ddec3a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 5 Jan 2022 13:31:14 +0300 Subject: [PATCH 0753/1506] audioses: Add stub dll. CW-Bug-Id: #19918 --- configure.ac | 1 + dlls/audioses/Makefile.in | 1 + dlls/audioses/audioses.spec | 11 +++++++++++ 3 files changed, 13 insertions(+) create mode 100644 dlls/audioses/Makefile.in create mode 100644 dlls/audioses/audioses.spec diff --git a/configure.ac b/configure.ac index 3f7ce9aed9a..7a71c20c8d9 100644 --- a/configure.ac +++ b/configure.ac @@ -2485,6 +2485,7 @@ WINE_CONFIG_MAKEFILE(dlls/atl90) WINE_CONFIG_MAKEFILE(dlls/atlthunk) WINE_CONFIG_MAKEFILE(dlls/atlthunk/tests) WINE_CONFIG_MAKEFILE(dlls/atmlib) +WINE_CONFIG_MAKEFILE(dlls/audioses) WINE_CONFIG_MAKEFILE(dlls/authz) WINE_CONFIG_MAKEFILE(dlls/avicap32) WINE_CONFIG_MAKEFILE(dlls/avifil32) diff --git a/dlls/audioses/Makefile.in b/dlls/audioses/Makefile.in new file mode 100644 index 00000000000..370949ea4fe --- /dev/null +++ b/dlls/audioses/Makefile.in @@ -0,0 +1 @@ +MODULE = audioses.dll diff --git a/dlls/audioses/audioses.spec b/dlls/audioses/audioses.spec new file mode 100644 index 00000000000..a1884e53243 --- /dev/null +++ b/dlls/audioses/audioses.spec @@ -0,0 +1,11 @@ +# @ stub AUDIOSES_1 +# @ stub AUDIOSES_2 +# @ stub AUDIOSES_3 +# @ stub AUDIOSES_4 +# @ stub AUDIOSES_5 +# @ stub DllCanUnloadNow +# @ stub AUDIOSES_7 +# @ stub DllGetActivationFactory +# @ stub DllGetClassObject +# @ stub DllRegisterServer +# @ stub DllUnregisterServer From 874a8551c73ce29d0cfeed00dfe2e416459d3c7f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 12 Aug 2022 18:12:29 -0500 Subject: [PATCH 0754/1506] ddraw: Force x87 arithmetic. CW-Bug-Id: #21119 --- dlls/ddraw/ddraw_private.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index f40188f75ef..b1fd015aa14 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -19,6 +19,10 @@ #ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H +#ifdef __i386__ +#pragma GCC target ("fpmath=387") +#endif + #include #include #include From bc760f26f85204b377701537f74078717b318a9b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 14 Nov 2022 13:39:39 -0600 Subject: [PATCH 0755/1506] windowscodecs: HACK: Avoid using __builtin_frame_address() for setjmp(). This is a workaround to compiler bug (observed with Mingw / Gcc 10.x). CW-Bug-Id: #21563 --- dlls/windowscodecs/wincodecs_private.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 9da717fc345..76db7439db1 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -398,4 +398,9 @@ extern HRESULT CommonDecoder_CreateInstance(struct decoder *decoder, extern HRESULT CommonEncoder_CreateInstance(struct encoder *encoder, const struct encoder_info *encoder_info, REFIID iid, void** ppv); +#ifdef _WIN64 +#undef setjmp +#define setjmp(buf) _setjmpex(buf, NULL) +#endif + #endif /* WINCODECS_PRIVATE_H */ From a65aa9c07be77d44fdc3392ef11a4b581128485e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 10 Mar 2022 17:58:41 +0300 Subject: [PATCH 0756/1506] ntdll: HACK: Delay resuming thread after suspending self. CW-Bug-Id: #20270 Fixes a random hang on exit in Little Nightmares 2. --- dlls/ntdll/unix/thread.c | 5 ++++- server/thread.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index e7c6c5f560a..64cad6e7c0e 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1613,6 +1613,7 @@ NTSTATUS WINAPI NtOpenThread( HANDLE *handle, ACCESS_MASK access, */ NTSTATUS WINAPI NtSuspendThread( HANDLE handle, ULONG *count ) { + BOOL self = FALSE; unsigned int ret; SERVER_START_REQ( suspend_thread ) @@ -1620,10 +1621,12 @@ NTSTATUS WINAPI NtSuspendThread( HANDLE handle, ULONG *count ) req->handle = wine_server_obj_handle( handle ); if (!(ret = wine_server_call( req ))) { - if (count) *count = reply->count; + self = reply->count & 0x80000000; + if (count) *count = reply->count & 0x7fffffff; } } SERVER_END_REQ; + if (self) usleep( 0 ); return ret; } diff --git a/server/thread.c b/server/thread.c index 8c8d8b868da..a6039b35d9d 100644 --- a/server/thread.c +++ b/server/thread.c @@ -912,7 +912,11 @@ int suspend_thread( struct thread *thread ) int old_count = thread->suspend; if (thread->suspend < MAXIMUM_SUSPEND_COUNT) { - if (!(thread->process->suspend + thread->suspend++)) stop_thread( thread ); + if (!(thread->process->suspend + thread->suspend++)) + { + stop_thread( thread ); + if (thread == current) return old_count | 0x80000000; + } } else set_error( STATUS_SUSPEND_COUNT_EXCEEDED ); return old_count; From a9715fedac42405da3592875719f21059807e68e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 Apr 2022 20:30:55 +0300 Subject: [PATCH 0757/1506] wine.inf: Set display mode parameters for Star Wars: Episode I Racer. CW-Bug-Id: #20422 --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 964f37d2798..3d94b1781ba 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2836,3 +2836,5 @@ HKCU,Software\Wine\AppDefaults\starwarssquadrons.exe\DllOverrides,"atiadlxx",,"b HKCU,Software\Wine\AppDefaults\GW2.Main_Win64_Retail.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\Spider-Man.exe\DllOverrides,"atiadlxx",,"builtin" HKCU,Software\Wine\AppDefaults\RiftApart.exe\DllOverrides,"atiadlxx",,"builtin" +HKLM,Software\Wow6432Node\lucasarts entertainment company llc\Star Wars: Episode I Racer\v1.0,"Display Height",0x10001,480 +HKLM,Software\Wow6432Node\lucasarts entertainment company llc\Star Wars: Episode I Racer\v1.0,"Display Width",0x10001,640 From 1db25d33dc1026482b30bafee2242aa9bf2c79a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Tue, 30 Nov 2021 16:32:34 +0300 Subject: [PATCH 0758/1506] ntdll: Implement opening files through nt device paths. CW-Bug-Id: #19697 For Eternal Return. --- dlls/ntdll/tests/file.c | 25 +++++++- dlls/ntdll/unix/file.c | 134 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 156 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 78087114d06..c8e598b9288 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -136,19 +136,23 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) static void create_file_test(void) { + static const WCHAR notepadW[] = {'n','o','t','e','p','a','d','.','e','x','e',0}; static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t', '\\','f','a','i','l','i','n','g',0}; + static const WCHAR systemrootExplorerW[] = {'\\','S','y','s','t','e','m','R','o','o','t', + '\\','e','x','p','l','o','r','e','r','.','e','x','e',0}; static const WCHAR questionmarkInvalidNameW[] = {'a','f','i','l','e','?',0}; static const WCHAR pipeInvalidNameW[] = {'a','|','b',0}; static const WCHAR pathInvalidNtW[] = {'\\','\\','?','\\',0}; static const WCHAR pathInvalidNt2W[] = {'\\','?','?','\\',0}; static const WCHAR pathInvalidDosW[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\',0}; static const char testdata[] = "Hello World"; + static const WCHAR sepW[] = {'\\',0}; FILE_NETWORK_OPEN_INFORMATION info; UNICODE_STRING nameW, null_string; NTSTATUS status; HANDLE dir, file; - WCHAR path[MAX_PATH]; + WCHAR path[MAX_PATH], temp[MAX_PATH]; OBJECT_ATTRIBUTES attr; IO_STATUS_BLOCK io; LARGE_INTEGER offset; @@ -347,6 +351,25 @@ static void create_file_test(void) status = pNtQueryFullAttributesFile( &attr, &info ); ok( status == STATUS_OBJECT_NAME_INVALID, "query %s failed %lx\n", wine_dbgstr_w(nameW.Buffer), status ); + + GetWindowsDirectoryW( path, MAX_PATH ); + path[2] = 0; + ok( QueryDosDeviceW( path, temp, MAX_PATH ), + "QueryDosDeviceW failed with error %u\n", GetLastError() ); + lstrcatW( temp, sepW ); + lstrcatW( temp, path+3 ); + lstrcatW( temp, sepW ); + lstrcatW( temp, notepadW ); + + pRtlInitUnicodeString( &nameW, temp ); + status = pNtQueryFullAttributesFile( &attr, &info ); + ok( status == STATUS_SUCCESS, + "query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); + + pRtlInitUnicodeString( &nameW, systemrootExplorerW ); + status = pNtQueryFullAttributesFile( &attr, &info ); + ok( status == STATUS_SUCCESS, + "query %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); } static void open_file_test(void) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 597135e71ad..54847281181 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -3608,7 +3608,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char /****************************************************************************** - * nt_to_unix_file_name + * nt_to_unix_file_name_internal * * Convert a file name from NT namespace to Unix namespace. * @@ -3616,7 +3616,7 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is * returned, but the unix name is still filled in properly. */ -NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition ) +NTSTATUS nt_to_unix_file_name_internal( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition ) { enum server_fd_type type; int old_cwd, root_fd, needs_close; @@ -3677,6 +3677,136 @@ NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, U } +/* read the contents of an NT symlink object */ +static NTSTATUS read_nt_symlink( HANDLE root, UNICODE_STRING *name, WCHAR *target, size_t length ) +{ + OBJECT_ATTRIBUTES attr; + UNICODE_STRING targetW; + NTSTATUS status; + HANDLE handle; + + attr.Length = sizeof(attr); + attr.RootDirectory = root; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.ObjectName = name; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if (!(status = NtOpenSymbolicLinkObject( &handle, SYMBOLIC_LINK_QUERY, &attr ))) + { + targetW.Buffer = target; + targetW.MaximumLength = (length - 1) * sizeof(WCHAR); + status = NtQuerySymbolicLinkObject( handle, &targetW, NULL ); + NtClose( handle ); + } + + return status; +} + +/* try to find dos device based on nt device name */ +static NTSTATUS nt_to_dos_device( WCHAR *name, size_t length, WCHAR *device_ret ) +{ + static const WCHAR dosdevicesW[] = {'\\','D','o','s','D','e','v','i','c','e','s',0}; + UNICODE_STRING dosdevW = { sizeof(dosdevicesW) - sizeof(WCHAR), sizeof(dosdevicesW), (WCHAR *)dosdevicesW }; + WCHAR symlinkW[MAX_DIR_ENTRY_LEN]; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + char data[1024]; + HANDLE handle; + ULONG ctx = 0; + + DIRECTORY_BASIC_INFORMATION *info = (DIRECTORY_BASIC_INFORMATION *)data; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &dosdevW; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + status = NtOpenDirectoryObject( &handle, FILE_LIST_DIRECTORY, &attr ); + if (status) return STATUS_BAD_DEVICE_TYPE; + + while (!NtQueryDirectoryObject( handle, info, sizeof(data), TRUE, FALSE, &ctx, NULL )) + { + if (read_nt_symlink( handle, &info->ObjectName, symlinkW, MAX_DIR_ENTRY_LEN )) continue; + if (wcsnicmp( symlinkW, name, length )) continue; + if (info->ObjectName.Length != 2 * sizeof(WCHAR) || info->ObjectName.Buffer[1] != ':') continue; + + *device_ret = info->ObjectName.Buffer[0]; + NtClose( handle ); + return STATUS_SUCCESS; + } + + NtClose( handle ); + return STATUS_BAD_DEVICE_TYPE; +} + +/****************************************************************************** + * nt_to_unix_file_name + * + * Convert a file name from NT namespace to Unix namespace. + * + * If disposition is not FILE_OPEN or FILE_OVERWRITE, the last path + * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is + * returned, but the unix name is still filled in properly. + */ +NTSTATUS nt_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char **name_ret, UINT disposition ) +{ + static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0}; + static const WCHAR dosprefixW[] = {'\\','?','?','\\'}; + static const WCHAR deviceW[] = {'\\','D','e','v','i','c','e','\\',0}; + WCHAR *name, *ptr, *prefix, buffer[3] = {'c',':',0}; + UNICODE_STRING dospathW, *nameW; + OBJECT_ATTRIBUTES attr_copy; + size_t offset, name_len; + NTSTATUS status; + + if (attr->RootDirectory) return nt_to_unix_file_name_internal( attr, name_ret, disposition ); + + nameW = attr->ObjectName; + + if (nameW->Length >= sizeof(deviceW) - sizeof(WCHAR) + && !wcsnicmp( nameW->Buffer, deviceW, ARRAY_SIZE(deviceW) - 1 )) + { + offset = sizeof(deviceW) / sizeof(WCHAR); + while (offset * sizeof(WCHAR) < nameW->Length && nameW->Buffer[ offset ] != '\\') offset++; + if ((status = nt_to_dos_device( nameW->Buffer, offset, buffer ))) return status; + prefix = buffer; + } + else if (nameW->Length >= sizeof(systemrootW) - sizeof(WCHAR) && + !wcsnicmp( nameW->Buffer, systemrootW, ARRAY_SIZE(systemrootW) - 1 )) + { + offset = (sizeof(systemrootW) - 1) / sizeof(WCHAR); + prefix = user_shared_data->NtSystemRoot; + } + else + return nt_to_unix_file_name_internal( attr, name_ret, disposition ); + + name_len = sizeof(dosprefixW) + wcslen(prefix) * sizeof(WCHAR) + + sizeof(WCHAR) /* '\\' */ + nameW->Length - offset * sizeof(WCHAR) + sizeof(WCHAR); + if (!(name = malloc( name_len ))) + return STATUS_NO_MEMORY; + + ptr = name; + memcpy( ptr, dosprefixW, sizeof(dosprefixW) ); + ptr += sizeof(dosprefixW) / sizeof(WCHAR); + wcscpy( ptr, prefix ); + ptr += wcslen(ptr); + *ptr++ = '\\'; + memcpy( ptr, nameW->Buffer + offset, nameW->Length - offset * sizeof(WCHAR) ); + ptr[ nameW->Length / sizeof(WCHAR) - offset ] = 0; + + dospathW.Buffer = name; + dospathW.Length = wcslen( name ) * sizeof(WCHAR); + attr_copy = *attr; + attr_copy.ObjectName = &dospathW; + status = nt_to_unix_file_name_internal( &attr_copy, name_ret, disposition ); + + free( name ); + return status; +} + /****************************************************************************** * wine_nt_to_unix_file_name * From b037f69d587a57ce72d4579ec50a4f5c171cef1c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 11 Oct 2021 11:13:39 +0200 Subject: [PATCH 0759/1506] ntdll: Resolve drive symlinks when querying section names. Based on a patch by Sebastian Lackner. For BeamNG.drive. CW-Bug-Id: 18793 --- dlls/ntdll/unix/virtual.c | 83 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 9a2a40c44ea..ed850f4772b 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -5360,6 +5360,86 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr, return STATUS_SUCCESS; } +static NTSTATUS read_nt_symlink( UNICODE_STRING *name, WCHAR *target, DWORD size ) +{ + NTSTATUS status; + OBJECT_ATTRIBUTES attr; + HANDLE handle; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.ObjectName = name; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if (!(status = NtOpenSymbolicLinkObject( &handle, SYMBOLIC_LINK_QUERY, &attr ))) + { + UNICODE_STRING targetW; + targetW.Buffer = target; + targetW.MaximumLength = (size - 1) * sizeof(WCHAR); + status = NtQuerySymbolicLinkObject( handle, &targetW, NULL ); + if (!status) target[targetW.Length / sizeof(WCHAR)] = 0; + NtClose( handle ); + } + return status; +} + +static NTSTATUS resolve_drive_symlink( UNICODE_STRING *name, SIZE_T max_name_len, SIZE_T *ret_len, NTSTATUS status ) +{ + static int enabled = -1; + + static const WCHAR dosprefixW[] = {'\\','?','?','\\'}; + UNICODE_STRING device_name; + SIZE_T required_length, symlink_len; + WCHAR symlink[256]; + size_t offset = 0; + + if (enabled == -1) + { + const char *sgi = getenv("SteamGameId"); + + enabled = sgi && !strcmp(sgi, "284160"); + } + if (!enabled) return status; + if (status == STATUS_INFO_LENGTH_MISMATCH) + { + /* FIXME */ + *ret_len += 64; + return status; + } + if (status) return status; + + if (name->Length < sizeof(dosprefixW) || + memcmp( name->Buffer, dosprefixW, sizeof(dosprefixW) )) + return STATUS_SUCCESS; + + offset = ARRAY_SIZE(dosprefixW); + while (offset * sizeof(WCHAR) < name->Length && name->Buffer[ offset ] != '\\') offset++; + + device_name = *name; + device_name.Length = offset * sizeof(WCHAR); + if ((status = read_nt_symlink( &device_name, symlink, ARRAY_SIZE( symlink )))) + { + ERR("read_nt_symlink failed, status %#x.\n", (int)status); + return status; + } + symlink_len = wcslen( symlink ); + required_length = symlink_len * sizeof(WCHAR) + + name->Length - offset * sizeof(WCHAR) + sizeof(WCHAR); + if (ret_len) + *ret_len = sizeof(MEMORY_SECTION_NAME) + required_length; + if (required_length > max_name_len) + return STATUS_INFO_LENGTH_MISMATCH; + + memmove( name->Buffer + symlink_len, name->Buffer + offset, name->Length - offset * sizeof(WCHAR) ); + memcpy( name->Buffer, symlink, symlink_len * sizeof(WCHAR) ); + name->MaximumLength = required_length; + name->Length = required_length - sizeof(WCHAR); + name->Buffer[name->Length / sizeof(WCHAR)] = 0; + return STATUS_SUCCESS; +} + static unsigned int get_memory_section_name( HANDLE process, LPCVOID addr, MEMORY_SECTION_NAME *info, SIZE_T len, SIZE_T *ret_len ) { @@ -5388,7 +5468,8 @@ static unsigned int get_memory_section_name( HANDLE process, LPCVOID addr, } } SERVER_END_REQ; - return status; + + return resolve_drive_symlink( &info->SectionFileName, len - sizeof(*info), ret_len, status ); } static unsigned int get_memory_image_info( HANDLE process, LPCVOID addr, MEMORY_IMAGE_INFORMATION *info, From f171ae23077bb55151dde043c9a13e9da7175471 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 14 Dec 2021 13:01:58 +0100 Subject: [PATCH 0760/1506] HACK: server: Fake success when trying to bind to an IPX address. --- server/sock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/sock.c b/server/sock.c index ed79d961c38..9283ad07cbb 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2978,7 +2978,11 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (check_addr_usage( sock, &bind_addr, v6only )) return; - if (bind( unix_fd, &bind_addr.addr, unix_len ) < 0) + /* Quake (and similar family) fails if we can't bind to an IPX address. This often + * doesn't work on Linux, so just fake success. */ + if (unix_addr.addr.sa_family == AF_IPX) + fprintf( stderr, "wine: HACK: Faking AF_IPX bind success.\n" ); + else if (bind( unix_fd, &bind_addr.addr, unix_len ) < 0) { if (errno == EADDRINUSE && sock->reuseaddr) errno = EACCES; From 26a4288662ca4ca00b5f48b801b2a583e1daf0c7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 15 Mar 2021 13:10:16 -0500 Subject: [PATCH 0761/1506] ntdll: HACK: Add WINE_HEAP_DELAY_FREE variable to force the use of pending free buffer. CW-Bug-Id: #20334 --- dlls/ntdll/heap.c | 8 +++--- dlls/ntdll/loader.c | 57 +++++++++++++++++++++-------------------- dlls/ntdll/ntdll_misc.h | 2 ++ 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 4dc3e7296b6..7819f8bdfd7 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -328,6 +328,8 @@ C_ASSERT( HEAP_MIN_LARGE_BLOCK_SIZE <= HEAP_INITIAL_GROW_SIZE ); #define HEAP_VALIDATE_PARAMS 0x40000000 #define HEAP_CHECKING_ENABLED 0x80000000 +BOOL delay_heap_free = FALSE; + static struct heap *process_heap; /* main process heap */ static NTSTATUS heap_free_block_lfh( struct heap *heap, ULONG flags, struct block *block ); @@ -1478,8 +1480,8 @@ static void heap_set_debug_flags( HANDLE handle ) } } - if ((heap->flags & HEAP_GROWABLE) && !heap->pending_free && - ((flags & HEAP_FREE_CHECKING_ENABLED) || RUNNING_ON_VALGRIND)) + if (delay_heap_free || ((heap->flags & HEAP_GROWABLE) && !heap->pending_free && + ((flags & HEAP_FREE_CHECKING_ENABLED) || RUNNING_ON_VALGRIND))) { heap->pending_free = RtlAllocateHeap( handle, HEAP_ZERO_MEMORY, MAX_FREE_PENDING * sizeof(*heap->pending_free) ); @@ -2612,7 +2614,7 @@ NTSTATUS WINAPI RtlSetHeapInformation( HANDLE handle, HEAP_INFORMATION_CLASS inf FIXME( "HeapCompatibilityInformation %lu not implemented!\n", compat_info ); return STATUS_UNSUCCESSFUL; } - if (InterlockedCompareExchange( &heap->compat_info, compat_info, HEAP_STD ) != HEAP_STD) + if (!delay_heap_free && InterlockedCompareExchange( &heap->compat_info, compat_info, HEAP_STD ) != HEAP_STD) return STATUS_UNSUCCESSFUL; return STATUS_SUCCESS; } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 0aee489662a..866641dcb15 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -208,6 +208,21 @@ static inline BOOL contains_path( LPCWSTR name ) return ((*name && (name[1] == ':')) || wcschr(name, '/') || wcschr(name, '\\')); } +static BOOL get_env( const WCHAR *var, WCHAR *val, unsigned int len ) +{ + UNICODE_STRING name, value; + + name.Length = wcslen( var ) * sizeof(WCHAR); + name.MaximumLength = name.Length + sizeof(WCHAR); + name.Buffer = (WCHAR *)var; + + value.Length = 0; + value.MaximumLength = len; + value.Buffer = val; + + return !RtlQueryEnvironmentVariable_U( NULL, &name, &value ); +} + #define RTL_UNLOAD_EVENT_TRACE_NUMBER 64 typedef struct _RTL_UNLOAD_EVENT_TRACE @@ -3189,31 +3204,6 @@ static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub ) return NULL; } -static WCHAR *get_env( const WCHAR *var ) -{ - UNICODE_STRING name, value; - - RtlInitUnicodeString( &name, var ); - value.Length = 0; - value.MaximumLength = 0; - value.Buffer = NULL; - - if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) == STATUS_BUFFER_TOO_SMALL) { - - value.Buffer = RtlAllocateHeap( GetProcessHeap(), 0, value.Length + sizeof(WCHAR) ); - value.MaximumLength = value.Length; - - if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) == STATUS_SUCCESS) { - value.Buffer[value.Length / sizeof(WCHAR)] = 0; - return value.Buffer; - } - - RtlFreeHeap( GetProcessHeap(), 0, value.Buffer ); - } - - return NULL; -} - /*********************************************************************** * find_dll_file * @@ -3279,8 +3269,9 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI * Some games try to load mfc42.dll, but then proceed to not use it. * Just return a handle to kernel32 in that case. */ - WCHAR *sgi = get_env( L"SteamGameId" ); - if (sgi) + WCHAR sgi[32]; + + if (get_env( L"SteamGameId", sgi, sizeof(sgi) )) { if (!wcscmp( sgi, L"105450") && strstriW( libname, L"mfc42" )) @@ -3288,7 +3279,6 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI WARN_(loaddll)( "Using a fake mfc42 handle\n" ); status = find_dll_file( load_path, L"kernel32.dll", nt_name, pwm, mapping, image_info, id ); } - RtlFreeHeap(GetProcessHeap(), 0, sgi); } } return status; @@ -4364,6 +4354,7 @@ void loader_init( CONTEXT *context, void **entry ) ANSI_STRING ctrl_routine = RTL_CONSTANT_STRING( "CtrlRoutine" ); WINE_MODREF *kernel32; PEB *peb = NtCurrentTeb()->Peb; + WCHAR env_str[16]; NtQueryVirtualMemory( GetCurrentProcess(), LdrInitializeThunk, MemoryBasicInformation, &meminfo, sizeof(meminfo), NULL ); @@ -4373,6 +4364,16 @@ void loader_init( CONTEXT *context, void **entry ) peb->TlsBitmap = &tls_bitmap; peb->TlsExpansionBitmap = &tls_expansion_bitmap; peb->LoaderLock = &loader_section; + + if (get_env( L"WINE_HEAP_DELAY_FREE", env_str, sizeof(env_str)) ) + { + if (env_str[0] == L'1') + { + ERR( "Enabling heap free delay hack.\n" ); + delay_heap_free = TRUE; + } + } + peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL ); RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 ); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index a7967a6c242..623acc1da00 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -47,6 +47,8 @@ static const UINT_PTR page_size = 0x1000; extern UINT_PTR page_size; #endif +extern BOOL delay_heap_free; + /* exceptions */ extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context ); extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec ); From fc5af91913aa83ee06ba2872168c734d4b0901e4 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 25 Feb 2022 11:03:00 +0800 Subject: [PATCH 0762/1506] HACK: ntdll: Replace STATUS_NETWORK_UNREACHABLE with STATUS_SUCCESS in sock_send() for VRChat UDP sockets. On Windows, when resuming from sleep and network is temporarily unavailable but network adapters are still up, send() for UDP sockets sliently drop UDP packets and report STATUS_SUCCESS. On Linux, sendmsg() reports ENETUNREACH, which eventually translated to winsock error WSAENETUNREACH and make VRChat show an internal error message and hang. CW-Bug-Id: #20008 Signed-off-by: Zhiyi Zhang --- dlls/ntdll/unix/socket.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 4e6781df607..28f1b6d83b2 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -153,6 +153,8 @@ struct async_transmit_ioctl LARGE_INTEGER offset; }; +static int get_sock_type( HANDLE handle ); + static NTSTATUS sock_errno_to_status( int err ) { switch (err) @@ -1062,6 +1064,21 @@ static NTSTATUS try_send( int fd, struct async_send_ioctl *async ) return STATUS_SUCCESS; } +static void hack_update_status( HANDLE handle, unsigned int *status ) +{ + /* HACK: VRChat relies on send() reporting STATUS_SUCCESS for dropped UDP sockets when the + * network is actually lost but network adapters are still up on Windows. Fix VRChat internal + * error bug when resuming from sleep */ + const char *appid; + + if (*status == STATUS_NETWORK_UNREACHABLE && get_sock_type( handle ) == SOCK_DGRAM + && (appid = getenv( "SteamAppId" )) && !strcmp( appid, "438100" )) + { + WARN( "Replacing STATUS_NETWORK_UNREACHABLE with STATUS_SUCCESS for VRChat.\n" ); + *status = STATUS_SUCCESS; + } +} + static BOOL async_send_proc( void *user, ULONG_PTR *info, unsigned int *status ) { struct async_send_ioctl *async = user; @@ -1076,6 +1093,7 @@ static BOOL async_send_proc( void *user, ULONG_PTR *info, unsigned int *status ) *status = try_send( fd, async ); TRACE( "got status %#x\n", *status ); + hack_update_status( async->io.handle, status ); if (needs_close) close( fd ); @@ -1142,6 +1160,8 @@ static NTSTATUS sock_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi ULONG_PTR information; status = try_send( fd, async ); + hack_update_status( handle, &status ); + if (status == STATUS_DEVICE_NOT_READY && (force_async || !nonblocking)) status = STATUS_PENDING; @@ -1212,7 +1232,6 @@ static NTSTATUS sock_ioctl_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap return sock_send( handle, event, apc, apc_user, io, fd, async, force_async ); } - NTSTATUS sock_write( HANDLE handle, int fd, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, IO_STATUS_BLOCK *io, const void *buffer, ULONG length ) { From 72c83690354adb0d3f81e171f5fba938a4ac2755 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 10 Feb 2022 16:17:41 +0300 Subject: [PATCH 0763/1506] ntdll: Guard against syscall stack overrun. --- dlls/ntdll/unix/signal_arm.c | 4 ++++ dlls/ntdll/unix/signal_arm64.c | 4 ++++ dlls/ntdll/unix/signal_i386.c | 4 ++++ dlls/ntdll/unix/signal_x86_64.c | 4 ++++ dlls/ntdll/unix/unix_private.h | 10 +++++++++- dlls/ntdll/unix/virtual.c | 6 ++++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c index 5115fa7ec3a..afa3e71c5e2 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -1304,6 +1304,10 @@ static BOOL handle_syscall_fault( ucontext_t *context, EXCEPTION_RECORD *rec ) (DWORD)IP_sig(context), (DWORD)SP_sig(context), (DWORD)LR_sig(context), (DWORD)PC_sig(context), (DWORD)CPSR_sig(context) ); + if (rec->ExceptionCode == STATUS_ACCESS_VIOLATION + && is_inside_syscall_stack_guard( (char *)rec->ExceptionInformation[1] )) + ERR_(seh)( "Syscall stack overrun.\n "); + if (ntdll_get_thread_data()->jmp_buf) { TRACE( "returning to handler\n" ); diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index f96ec330796..389f16f89d9 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -1271,6 +1271,10 @@ static BOOL handle_syscall_fault( ucontext_t *context, EXCEPTION_RECORD *rec ) (DWORD64)REGn_sig(28, context), (DWORD64)FP_sig(context), (DWORD64)LR_sig(context), (DWORD64)SP_sig(context) ); + if (rec->ExceptionCode == STATUS_ACCESS_VIOLATION + && is_inside_syscall_stack_guard( (char *)rec->ExceptionInformation[1] )) + ERR_(seh)( "Syscall stack overrun.\n "); + if (ntdll_get_thread_data()->jmp_buf) { TRACE( "returning to handler\n" ); diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index c372b5bf3a0..d39117b64fc 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1846,6 +1846,10 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, void *stack_ptr, context->Ebp, context->Esp, context->SegCs, context->SegDs, context->SegEs, context->SegFs, context->SegGs, context->EFlags ); + if (rec->ExceptionCode == STATUS_ACCESS_VIOLATION + && is_inside_syscall_stack_guard( (char *)rec->ExceptionInformation[1] )) + ERR_(seh)( "Syscall stack overrun.\n "); + if (ntdll_get_thread_data()->jmp_buf) { TRACE( "returning to handler\n" ); diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index d8d5678ec80..de8aaecf94c 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2128,6 +2128,10 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, EXCEPTION_RECORD *rec, TRACE_(seh)( " r12=%016lx r13=%016lx r14=%016lx r15=%016lx\n", context->R12, context->R13, context->R14, context->R15 ); + if (rec->ExceptionCode == STATUS_ACCESS_VIOLATION + && is_inside_syscall_stack_guard( (char *)rec->ExceptionInformation[1] )) + ERR_(seh)( "Syscall stack overrun.\n "); + if (ntdll_get_thread_data()->jmp_buf) { TRACE_(seh)( "returning to handler\n" ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 904a35f471b..55d3a0fb53c 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -127,7 +127,8 @@ static const SIZE_T teb_size = 0x3800; /* TEB64 + TEB32 + debug info */ static const SIZE_T signal_stack_mask = 0xffff; static const SIZE_T signal_stack_size = 0x10000 - 0x3800; static const SIZE_T kernel_stack_size = 0x100000; -static const SIZE_T min_kernel_stack = 0x2000; +static const SIZE_T kernel_stack_guard_size = 0x1000; +static const SIZE_T min_kernel_stack = 0x3000; static const LONG teb_offset = 0x2000; #define FILE_WRITE_TO_END_OF_FILE ((LONGLONG)-1) @@ -388,6 +389,13 @@ static inline BOOL is_inside_signal_stack( void *ptr ) (char *)ptr < (char *)get_signal_stack() + signal_stack_size); } +static inline BOOL is_inside_syscall_stack_guard( const char *stack_ptr ) +{ + const char *kernel_stack = ntdll_get_thread_data()->kernel_stack; + + return (stack_ptr >= kernel_stack && stack_ptr < kernel_stack + kernel_stack_guard_size); +} + static inline void mutex_lock( pthread_mutex_t *mutex ) { if (!process_exiting) pthread_mutex_lock( mutex ); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index ed850f4772b..d6dbd917ce5 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3929,6 +3929,12 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR limit_low, UL VPROT_READ | VPROT_WRITE | VPROT_COMMITTED | VPROT_GUARD ); mprotect_range( view->base, 2 * page_size , 0, 0 ); } + else + { + /* setup kernel stack no access guard page */ + set_page_vprot( view->base, kernel_stack_guard_size, VPROT_COMMITTED | VPROT_READ ); + mprotect_range( view->base, kernel_stack_guard_size, 0, 0 ); + } VIRTUAL_DEBUG_DUMP_VIEW( view ); /* note: limit is lower than base since the stack grows down */ From fffa15b9be8c18c818771bf4118e8a852b685f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Thu, 1 Jun 2017 06:04:53 +0200 Subject: [PATCH 0764/1506] ntdll: Fix holes in ELF mappings. (v2) Based on a patch by Andrew Wesie. Included to fix crash on startup of WRC8. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44650 Link: https://github.com/wine-staging/wine-staging/tree/v6.3/patches/ntdll-Builtin_Prot Link: https://github.com/ValveSoftware/wine/pull/121 CW-Bug-Id: #19337 --- dlls/ntdll/unix/virtual.c | 25 +++++++++++++++++++++++++ dlls/psapi/tests/psapi_main.c | 14 +++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index d6dbd917ce5..a1a97ac1f4a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4043,6 +4043,16 @@ static NTSTATUS grow_thread_stack( char *page, struct thread_stack_info *stack_i } +/*********************************************************************** + * is_system_range + */ +static inline BOOL is_system_range( const void *addr, size_t size ) +{ + struct file_view *view = find_view( addr, size ); + return view && (view->protect & VPROT_SYSTEM); +} + + /*********************************************************************** * virtual_handle_fault */ @@ -4089,6 +4099,21 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) ret = STATUS_SUCCESS; } } + else if (!err && (get_unix_prot( vprot ) & PROT_READ) && is_system_range( page, page_size )) + { + int unix_prot = get_unix_prot( vprot ); + unsigned char vec; + + TRACE("yolo\n"); + + mprotect_range( page, page_size, 0, 0 ); + if (!mincore( page, page_size, &vec ) && (vec & 1)) + ret = STATUS_SUCCESS; + else if (anon_mmap_fixed( page, page_size, unix_prot, 0 ) == page) + ret = STATUS_SUCCESS; + else + set_page_vprot_bits( page, page_size, 0, VPROT_READ | VPROT_EXEC ); + } mutex_unlock( &virtual_mutex ); return ret; } diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c index e7e5e5f04e6..17df780ba0c 100644 --- a/dlls/psapi/tests/psapi_main.c +++ b/dlls/psapi/tests/psapi_main.c @@ -581,6 +581,7 @@ static void test_EnumProcessModulesEx(void) static void test_GetModuleInformation(void) { HMODULE hMod = GetModuleHandleA(NULL); + DWORD *tmp, counter = 0; MODULEINFO info; DWORD ret; @@ -600,10 +601,21 @@ static void test_GetModuleInformation(void) GetModuleInformation(hpQV, hMod, &info, sizeof(info)-1); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %ld\n", GetLastError()); - SetLastError(0xdeadbeef); ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info)); ok(ret == 1, "failed with %ld\n", GetLastError()); ok(info.lpBaseOfDll == hMod, "lpBaseOfDll=%p hMod=%p\n", info.lpBaseOfDll, hMod); + + hMod = LoadLibraryA("shell32.dll"); + ok(hMod != NULL, "Failed to load shell32.dll, error: %u\n", GetLastError()); + + ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info)); + ok(ret == 1, "failed with %d\n", GetLastError()); + info.SizeOfImage /= sizeof(DWORD); + for (tmp = (DWORD *)hMod; info.SizeOfImage; info.SizeOfImage--) + counter ^= *tmp++; + trace("xor of shell32: %08x\n", counter); + + FreeLibrary(hMod); } static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin) From 4703b100e324673214247b60a1172fae5f10c22e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 17 Nov 2022 20:00:24 -0600 Subject: [PATCH 0765/1506] ntdll: Return FILE_DEVICE_UNKNOWN for Unix FIFOs and sockets from get_device_info(). CW-Bug-Id: #21570 --- dlls/ntdll/unix/file.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 54847281181..c251d9c1955 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -7026,7 +7026,7 @@ NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info ) } else if (S_ISFIFO( st.st_mode ) || S_ISSOCK( st.st_mode )) { - info->DeviceType = FILE_DEVICE_NAMED_PIPE; + info->DeviceType = FILE_DEVICE_UNKNOWN; } else if (is_device_placeholder( fd )) { @@ -7135,10 +7135,11 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io void *buffer, ULONG length, FS_INFORMATION_CLASS info_class ) { + enum server_fd_type fd_type; int fd, needs_close; unsigned int status; - status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL ); + status = server_get_unix_fd( handle, 0, &fd, &needs_close, &fd_type, NULL ); if (status == STATUS_BAD_DEVICE_TYPE) { struct async_irp *async; @@ -7205,7 +7206,15 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io { FILE_FS_DEVICE_INFORMATION *info = buffer; - if ((status = get_device_info( fd, info )) == STATUS_SUCCESS) + if (fd_type == FD_TYPE_SOCKET || fd_type == FD_TYPE_PIPE) + { + info->Characteristics = 0; + info->DeviceType = FILE_DEVICE_NAMED_PIPE; + status = STATUS_SUCCESS; + } + else status = get_device_info( fd, info ); + + if (!status) io->Information = sizeof(*info); } break; From 5572c6eefa1da1d4c2eb77f11769f649c603e406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Fri, 24 Apr 2020 14:37:58 +0300 Subject: [PATCH 0766/1506] server: Try to retrieve the unix name on handles created from file descriptors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46070 Signed-off-by: Gabriel Ivăncescu Fixes Unity of Command II, and possibly other games that use Python38.dll. --- server/fd.c | 39 +++++++++++++++++++++++++++++++++++++++ server/file.c | 1 + server/file.h | 2 ++ 3 files changed, 42 insertions(+) diff --git a/server/fd.c b/server/fd.c index d1ac7506a5f..36e4697e33b 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2132,6 +2132,45 @@ struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops, int unix_fd, s return NULL; } +void set_unix_name_of_fd( struct fd *fd, const struct stat *fd_st ) +{ +#ifdef __linux__ + static const char procfs_fmt[] = "/proc/self/fd/%d"; + + char path[PATH_MAX], procfs_path[sizeof(procfs_fmt) - 2 /* %d */ + 11]; + struct stat path_st; + ssize_t len; + + sprintf( procfs_path, procfs_fmt, fd->unix_fd ); + len = readlink( procfs_path, path, sizeof(path) ); + if (len == -1 || len >= sizeof(path) ) + return; + path[len] = '\0'; + + /* Make sure it's an absolute path, has at least one hardlink, and the same inode */ + if (path[0] != '/' || stat( path, &path_st ) || path_st.st_nlink < 1 || + path_st.st_dev != fd_st->st_dev || path_st.st_ino != fd_st->st_ino) + return; + + if (!(fd->unix_name = mem_alloc( len + 1 ))) + return; + memcpy( fd->unix_name, path, len + 1 ); + +#elif defined(F_GETPATH) + char path[PATH_MAX]; + size_t size; + + if (fcntl( fd->unix_fd, F_GETPATH, path ) == -1 || path[0] != '/') + return; + + size = strlen(path) + 1; + if (!(fd->unix_name = mem_alloc( size ))) + return; + memcpy( fd->unix_name, path, size ); + +#endif +} + /* retrieve the object that is using an fd */ void *get_fd_user( struct fd *fd ) { diff --git a/server/file.c b/server/file.c index 500ffcac153..bea0d09f9de 100644 --- a/server/file.c +++ b/server/file.c @@ -157,6 +157,7 @@ struct file *create_file_for_fd( int fd, unsigned int access, unsigned int shari release_object( file ); return NULL; } + set_unix_name_of_fd( file->fd, &st ); allow_fd_caching( file->fd ); return file; } diff --git a/server/file.h b/server/file.h index 0554ef903dc..f89ee4ea8af 100644 --- a/server/file.h +++ b/server/file.h @@ -22,6 +22,7 @@ #define __WINE_SERVER_FILE_H #include +#include #include "object.h" @@ -85,6 +86,7 @@ extern struct fd *open_fd( struct fd *root, const char *name, struct unicode_str unsigned int sharing, unsigned int options ); extern struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops, int unix_fd, struct object *user, unsigned int options ); +extern void set_unix_name_of_fd( struct fd *fd, const struct stat *fd_st ); extern struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sharing, unsigned int options ); extern struct fd *get_fd_object_for_mapping( struct fd *fd, unsigned int access, unsigned int sharing ); From 354560cbe5cd40a7bba23ba893270f93a564de4a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 20 Dec 2022 13:56:34 -0600 Subject: [PATCH 0767/1506] ntdll: Stop unwinding in RtlCaptureStackBackTrace() if unwind data is unavailable on x64. CW-Bug-Id: #21719 --- dlls/ntdll/signal_x86_64.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 379d011bf88..b24dbca7893 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -268,7 +268,7 @@ static void dump_scope_table( ULONG64 base, const SCOPE_TABLE *table ) static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEXT *context ) { LDR_DATA_TABLE_ENTRY *module; - NTSTATUS status; + NTSTATUS status = STATUS_SUCCESS; dispatch->ImageBase = 0; dispatch->ScopeIndex = 0; @@ -299,7 +299,11 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX } if (status != STATUS_UNSUCCESSFUL) return status; } - else WARN( "exception data not found in %s\n", debugstr_w(module->BaseDllName.Buffer) ); + else + { + WARN( "exception data not found in %s\n", debugstr_w(module->BaseDllName.Buffer) ); + status = STATUS_UNSUCCESSFUL; + } /* no exception information, treat as a leaf function */ @@ -307,7 +311,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX dispatch->LanguageHandler = NULL; context->Rip = *(ULONG64 *)context->Rsp; context->Rsp = context->Rsp + sizeof(ULONG64); - return STATUS_SUCCESS; + return status ? STATUS_NOT_FOUND : STATUS_SUCCESS; } @@ -459,7 +463,7 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex for (;;) { status = virtual_unwind( UNW_FLAG_EHANDLER, &dispatch, &context ); - if (status != STATUS_SUCCESS) return status; + if (status != STATUS_SUCCESS && status != STATUS_NOT_FOUND) return status; unwind_done: if (!dispatch.EstablisherFrame) break; @@ -1394,7 +1398,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec for (;;) { status = virtual_unwind( UNW_FLAG_UHANDLER, &dispatch, &new_context ); - if (status != STATUS_SUCCESS) raise_status( status, rec ); + if (status != STATUS_SUCCESS && status != STATUS_NOT_FOUND) raise_status( status, rec ); unwind_done: if (!dispatch.EstablisherFrame) break; From 2ec5ce401da9846f474ce96d315a7851d89eb8a2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 29 Nov 2022 16:40:42 -0600 Subject: [PATCH 0768/1506] ntdll: Improve faults logging. CW-Bug-Id: #21601 --- dlls/ntdll/signal_i386.c | 12 +++++++ dlls/ntdll/signal_x86_64.c | 27 ++++++++++++--- dlls/ntdll/unix/loader.c | 37 ++++++++++++++++++++ dlls/ntdll/unix/signal_i386.c | 3 ++ dlls/ntdll/unix/signal_x86_64.c | 61 +++++++++++++++++++++++++++++++++ dlls/ntdll/unix/unix_private.h | 2 ++ dlls/ntdll/unixlib.h | 14 ++++++++ 7 files changed, 152 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 37360929ba6..5165023c1b0 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -215,6 +215,18 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) for (c = 0; c < rec->NumberParameters; c++) TRACE( " info[%ld]=%08Ix\n", c, rec->ExceptionInformation[c] ); + if (WINE_BACKTRACE_LOG_ON()) + { + struct debugstr_pc_args params; + char buffer[256]; + + params.pc = rec->ExceptionAddress; + params.buffer = buffer; + params.size = sizeof(buffer); + if (!WINE_UNIX_CALL( unix_debugstr_pc, ¶ms )) + WINE_BACKTRACE_LOG( "--- Exception %#lx at %s.\n", rec->ExceptionCode, buffer ); + } + if (rec->ExceptionCode == EXCEPTION_WINE_STUB) { if (rec->ExceptionInformation[1] >> 16) diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index b24dbca7893..31fc44906fa 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -262,10 +262,18 @@ static void dump_scope_table( ULONG64 base, const SCOPE_TABLE *table ) } +static BOOL need_backtrace( DWORD exc_code ) +{ + if (!WINE_BACKTRACE_LOG_ON()) return FALSE; + return exc_code != EXCEPTION_WINE_NAME_THREAD && exc_code != DBG_PRINTEXCEPTION_WIDE_C + && exc_code != DBG_PRINTEXCEPTION_C && exc_code != EXCEPTION_WINE_CXX_EXCEPTION + && exc_code != 0x6ba; +} + /*********************************************************************** * virtual_unwind */ -static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEXT *context ) +static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEXT *context, BOOL dump_backtrace ) { LDR_DATA_TABLE_ENTRY *module; NTSTATUS status = STATUS_SUCCESS; @@ -278,6 +286,14 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX if ((dispatch->FunctionEntry = lookup_function_info( context->Rip, &dispatch->ImageBase, &module ))) { + if (dump_backtrace) + { + if (module) + WINE_BACKTRACE_LOG( "%p: %s + %p.\n", (void *)context->Rip, debugstr_w(module->BaseDllName.Buffer), + (void *)((char *)context->Rip - (char *)dispatch->ImageBase) ); + else + WINE_BACKTRACE_LOG( "%p: unknown module.\n", (void *)context->Rip ); + } dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, context->Rip, dispatch->FunctionEntry, context, &dispatch->HandlerData, &dispatch->EstablisherFrame, @@ -462,7 +478,7 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex dispatch.HistoryTable = &table; for (;;) { - status = virtual_unwind( UNW_FLAG_EHANDLER, &dispatch, &context ); + status = virtual_unwind( UNW_FLAG_EHANDLER, &dispatch, &context, need_backtrace( rec->ExceptionCode )); if (status != STATUS_SUCCESS && status != STATUS_NOT_FOUND) return status; unwind_done: @@ -550,6 +566,9 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) NTSTATUS status; DWORD c; + if (need_backtrace( rec->ExceptionCode )) + WINE_BACKTRACE_LOG( "--- Exception %#x.\n", (int)rec->ExceptionCode ); + TRACE_(seh)( "code=%lx flags=%lx addr=%p ip=%Ix\n", rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Rip ); for (c = 0; c < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); c++) @@ -1397,7 +1416,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec for (;;) { - status = virtual_unwind( UNW_FLAG_UHANDLER, &dispatch, &new_context ); + status = virtual_unwind( UNW_FLAG_UHANDLER, &dispatch, &new_context, FALSE ); if (status != STATUS_SUCCESS && status != STATUS_NOT_FOUND) raise_status( status, rec ); unwind_done: @@ -1643,7 +1662,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, if (hash) *hash = 0; for (i = 0; i < skip + count; i++) { - status = virtual_unwind( UNW_FLAG_NHANDLER, &dispatch, &context ); + status = virtual_unwind( UNW_FLAG_NHANDLER, &dispatch, &context, FALSE ); if (status != STATUS_SUCCESS) return i; if (!dispatch.EstablisherFrame) break; diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 5292a7e31ed..c168d31b526 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1137,6 +1137,42 @@ static NTSTATUS steamclient_setup_trampolines( void *args ) return STATUS_SUCCESS; } +static BOOL debugstr_pc_impl( void *pc, char *buffer, unsigned int size ) +{ + unsigned int len; + char *s = buffer; + Dl_info info; + + snprintf( s, size, "%p:", pc ); + if (!dladdr( pc, &info )) return FALSE; + + s += (len = strlen( s )); + size -= len; + snprintf( s, size, " %s + %#zx", info.dli_fname, (char *)pc - (char *)info.dli_fbase ); + if (info.dli_sname) + { + s += (len = strlen( s )); + size -= len; + snprintf( s, size, " (%s + %#zx)", info.dli_sname, (char *)pc - (char *)info.dli_saddr ); + } + return TRUE; +} + +static NTSTATUS debugstr_pc( void *args ) +{ + struct debugstr_pc_args *params = args; + + return debugstr_pc_impl( params->pc, params->buffer, params->size ) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; +} + +const char * wine_debuginfostr_pc( void *pc ) +{ + char buffer[256]; + + debugstr_pc_impl( pc, buffer, sizeof(buffer) ); + return __wine_dbg_strdup( buffer ); +} + static BOOL report_native_pc_as_ntdll; static NTSTATUS is_pc_in_native_so(void *pc) @@ -1164,6 +1200,7 @@ static const unixlib_entry_t unix_call_funcs[] = system_time_precise, steamclient_setup_trampolines, is_pc_in_native_so, + debugstr_pc, }; diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index d39117b64fc..eb40bda2d94 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1864,6 +1864,9 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, void *stack_ptr, } else { + WINE_BACKTRACE_LOG( "--- Exception %#lx at %s.\n", rec->ExceptionCode, + wine_debuginfostr_pc( rec->ExceptionAddress )); + TRACE( "returning to user mode ip=%08x ret=%08lx\n", frame->eip, rec->ExceptionCode ); stack = (UINT *)frame; *(--stack) = rec->ExceptionCode; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index de8aaecf94c..684b3d52448 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -575,6 +575,7 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame,CONTEXT *contex TRACE( "function %lx base %p cie %p len %x id %x version %x aug '%s' code_align %lu data_align %ld retaddr %s\n", ip, bases->func, cie, cie->length, cie->id, cie->version, cie->augmentation, info.code_align, info.data_align, dwarf_reg_names[info.retaddr_reg] ); + WINE_BACKTRACE_LOG( "%s.\n", wine_debuginfostr_pc((void *)context->Rip) ); end = NULL; for (augmentation = cie->augmentation; *augmentation; augmentation++) @@ -2101,6 +2102,47 @@ static inline BOOL handle_interrupt( ucontext_t *sigcontext, EXCEPTION_RECORD *r return TRUE; } +static void dump_syscall_fault( CONTEXT *context, DWORD exc_code ) +{ + struct syscall_frame *frame = amd64_thread_data()->syscall_frame; + struct unwind_builtin_dll_params params; + + __TRY + { + DISPATCHER_CONTEXT dispatch; + + context->ContextFlags &= ~0x40; + + dispatch.EstablisherFrame = context->Rsp; + dispatch.TargetIp = 0; + dispatch.ContextRecord = context; + dispatch.HistoryTable = NULL; + + params.type = UNW_FLAG_UHANDLER; + params.dispatch = &dispatch; + params.context = context; + + while (1) + { + if (context->Rip >= (ULONG_PTR)__wine_syscall_dispatcher + && context->Rip <= (ULONG_PTR)__wine_syscall_dispatcher_return) + { + WINE_BACKTRACE_LOG( "__wine_syscall_dispatcher.\n" ); + break; + } + if (unwind_builtin_dll( ¶ms )) + break; + } + } + __EXCEPT + { + WINE_BACKTRACE_LOG( "Fault during unwind.\n" ); + } + __ENDTRY + + WINE_BACKTRACE_LOG( "returning to user mode ip=%016lx ret=%08x\n", frame->rip, exc_code ); + __wine_syscall_dispatcher_return( frame, exc_code ); +} /*********************************************************************** * handle_syscall_fault @@ -2142,6 +2184,25 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, EXCEPTION_RECORD *rec, } else { + const char *kernel_stack = ntdll_get_thread_data()->kernel_stack; + char *stack = (char *)RSP_sig(sigcontext); + + WINE_BACKTRACE_LOG( "--- Exception %#x at %s.\n", rec->ExceptionCode, + wine_debuginfostr_pc( rec->ExceptionAddress )); + + if (!process_exiting && WINE_BACKTRACE_LOG_ON() && stack > kernel_stack + kernel_stack_guard_size + 4096) + { + stack = (char *)((ULONG_PTR)stack & ~(ULONG_PTR)15); + stack -= sizeof(*context); + RDI_sig(sigcontext) = (ULONG_PTR)stack; + RSI_sig(sigcontext) = rec->ExceptionCode; + memcpy( stack, context, sizeof(*context) ); + stack -= 0x28; + RIP_sig(sigcontext) = (ULONG_PTR)dump_syscall_fault; + RSP_sig(sigcontext) = (ULONG_PTR)stack; + return TRUE; + } + TRACE_(seh)( "returning to user mode ip=%016lx ret=%08x\n", frame->rip, rec->ExceptionCode ); RDI_sig(sigcontext) = (ULONG_PTR)frame; RSI_sig(sigcontext) = rec->ExceptionCode; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 55d3a0fb53c..cb85d26509b 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -355,6 +355,8 @@ extern void call_raise_user_exception_dispatcher(void); #define IMAGE_DLLCHARACTERISTICS_PREFER_NATIVE 0x0010 /* Wine extension */ +extern const char * wine_debuginfostr_pc(void *pc); + #define TICKSPERSEC 10000000 #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)86400) diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 5430b8f0fe9..e0870584a68 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -72,6 +72,13 @@ struct steamclient_setup_trampolines_params HMODULE tgt_mod; }; +struct debugstr_pc_args +{ + void *pc; + char *buffer; + unsigned int size; +}; + enum ntdll_unix_funcs { unix_load_so_dll, @@ -84,8 +91,15 @@ enum ntdll_unix_funcs unix_system_time_precise, unix_steamclient_setup_trampolines, unix_is_pc_in_native_so, + unix_debugstr_pc, }; extern unixlib_handle_t __wine_unixlib_handle; +#define WINE_BACKTRACE_LOG_ON() WARN_ON(seh) + +#define WINE_BACKTRACE_LOG(args...) do { \ + WARN_(seh)("backtrace: " args); \ + } while (0) + #endif /* __NTDLL_UNIXLIB_H */ From 76dc8861d1c4da611caef84b7e82013dcc702cb3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 2 Feb 2023 17:06:35 -0600 Subject: [PATCH 0769/1506] kernel32/tests: Add tests for known dlls load specifics. CW-Bug-Id: #21866 --- dlls/kernel32/tests/module.c | 90 ++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index 35c7c552dd5..0e38ce80f54 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -1627,6 +1627,95 @@ static void test_ddag_node(void) ok( se == node->Dependencies.Tail, "Expected end of the list.\n" ); } +#define check_dll_path(a, b) check_dll_path_( __LINE__, a, b ) +static void check_dll_path_( unsigned int line, HMODULE h, const char *expected ) +{ + char path[MAX_PATH]; + DWORD ret; + + *path = 0; + ret = GetModuleFileNameA( h, path, MAX_PATH); + ok_(__FILE__, line)( ret && ret < MAX_PATH, "Got %lu.\n", ret ); + ok_(__FILE__, line)( !stricmp( path, expected ), "Got %s.\n", debugstr_a(path) ); +} + +static void test_known_dlls_load(void) +{ + static const char apiset_dll[] = "ext-ms-win-base-psapi-l1-1-0.dll"; + char system_path[MAX_PATH], local_path[MAX_PATH]; + static const char dll[] = "psapi.dll"; + HMODULE hlocal, hsystem, hapiset, h; + BOOL ret; + + if (GetModuleHandleA( dll ) || GetModuleHandleA( apiset_dll )) + { + skip( "%s is already loaded, skipping test.\n", dll ); + return; + } + + hapiset = LoadLibraryA( apiset_dll ); + if (!hapiset) + { + win_skip( "%s is not available.\n", apiset_dll ); + return; + } + FreeLibrary( hapiset ); + + GetSystemDirectoryA( system_path, sizeof(system_path) ); + strcat( system_path, "\\" ); + strcat( system_path, dll ); + + GetCurrentDirectoryA( sizeof(local_path), local_path ); + strcat( local_path, "\\" ); + strcat( local_path, dll ); + + /* Known dll is always found in system dir, regardless of its presence in the application dir. */ + ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_USER_DIRS ); + ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() ); + h = LoadLibraryA( dll ); + ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_DEFAULT_DIRS ); + ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() ); + todo_wine ok( !!h, "Got NULL.\n" ); + hapiset = GetModuleHandleA( apiset_dll ); + ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); + FreeLibrary( h ); + + h = LoadLibraryExA( dll, 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR ); + todo_wine ok( !!h, "Got NULL.\n" ); + hapiset = GetModuleHandleA( apiset_dll ); + ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); + FreeLibrary( h ); + + /* Put dll to the current directory. */ + create_test_dll( dll ); + + h = LoadLibraryExA( dll, 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR ); + ok( !!h, "Got NULL.\n" ); + hapiset = GetModuleHandleA( apiset_dll ); + todo_wine ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); + FreeLibrary( h ); + + /* Local version can still be loaded if dll name contains path. */ + hlocal = LoadLibraryA( local_path ); + ok( !!hlocal, "Got NULL.\n" ); + check_dll_path( hlocal, local_path ); + + /* dll without path will match the loaded one. */ + hsystem = LoadLibraryA( dll ); + ok( hsystem == hlocal, "Got %p, %p.\n", hsystem, hlocal ); + h = GetModuleHandleA( dll ); + ok( h == hlocal, "Got %p, %p.\n", h, hlocal ); + + /* apiset dll won't match the one loaded not from system dir. */ + hapiset = GetModuleHandleA( apiset_dll ); + ok( !hapiset, "Got %p.\n", hapiset ); + + FreeLibrary( hsystem ); + FreeLibrary( hlocal ); + + DeleteFileA( dll ); +} + START_TEST(module) { WCHAR filenameW[MAX_PATH]; @@ -1663,4 +1752,5 @@ START_TEST(module) test_LdrGetDllFullName(); test_apisets(); test_ddag_node(); + test_known_dlls_load(); } From 560856ba66e6e8ddd1211fdd76529e65b2723629 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 2 Feb 2023 14:48:37 -0600 Subject: [PATCH 0770/1506] ntdll: Factor out prepend_system_dir() function. CW-Bug-Id: #21866 --- dlls/ntdll/loader.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 866641dcb15..142fd939ed5 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3004,6 +3004,23 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname ) } +/****************************************************************************** + * prepend_system_dir + */ +static NTSTATUS prepend_system_dir( const WCHAR *name, ULONG name_length, WCHAR **fullname ) +{ + ULONG len; + + len = wcslen( system_dir ) + name_length; + if (!(*fullname = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) + return STATUS_NO_MEMORY; + wcscpy( *fullname, system_dir ); + memcpy( *fullname + wcslen( system_dir ), name, name_length * sizeof(WCHAR) ); + (*fullname)[len] = 0; + + return STATUS_SUCCESS; +} + /****************************************************************************** * find_apiset_dll @@ -3013,18 +3030,11 @@ static NTSTATUS find_apiset_dll( const WCHAR *name, WCHAR **fullname ) const API_SET_NAMESPACE *map = NtCurrentTeb()->Peb->ApiSetMap; const API_SET_NAMESPACE_ENTRY *entry; UNICODE_STRING str; - ULONG len; if (get_apiset_entry( map, name, wcslen(name), &entry )) return STATUS_APISET_NOT_PRESENT; if (get_apiset_target( map, entry, NULL, &str )) return STATUS_DLL_NOT_FOUND; - len = wcslen( system_dir ) + str.Length / sizeof(WCHAR); - if (!(*fullname = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) - return STATUS_NO_MEMORY; - wcscpy( *fullname, system_dir ); - memcpy( *fullname + wcslen( system_dir ), str.Buffer, str.Length ); - (*fullname)[len] = 0; - return STATUS_SUCCESS; + return prepend_system_dir( str.Buffer, str.Length / sizeof(WCHAR), fullname ); } From 07bfd19704ad3a3580a5fa8688b3a4a82878ea0e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 7 Feb 2023 10:16:36 -0600 Subject: [PATCH 0771/1506] loader/wine.inf: Add known dlls key. CW-Bug-Id: #21866 --- loader/wine.inf.in | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 3d94b1781ba..e8755fdc16a 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -507,6 +507,51 @@ HKLM,%Control%\Session Manager\Environment,"windir",0x00020000,"%SystemRoot%" HKLM,%Control%\Session Manager\Environment,"winsysdir",,"%11%" HKLM,%Control%\Session Manager\Memory Management,PagingFiles,,"%24%\pagefile.sys 27 77" HKLM,%Control%\Session Manager\Memory Management,WriteWatch,0x00040002,1 +;;KnownDLLs +HKLM,%Control%\Session Manager\KnownDLLs,"_wow64cpu",,"wow64cpu.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"_wowarmhw",,"wowarmhw.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"_xtajit",,"_xtajit.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"advapi32",,"advapi32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"clbcatq",,"clbcatq.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"combase",,"combase.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"COMDLG32",,"COMDLG32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"coml2",,"coml2.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"DifxApi",,"difxapi.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"gdi32",,"gdi32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"gdiplus",,"gdiplus.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"IMAGEHLP",,"IMAGEHLP.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"IMM32",,"IMM32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"kernel32",,"kernel32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"MSCTF",,"MSCTF.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"MSVCRT",,"MSVCRT.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"NORMALIZ",,"NORMALIZ.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"NSI",,"NSI.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"ole32",,"ole32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"OLEAUT32",,"OLEAUT32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"PSAPI",,"PSAPI.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"rpcrt4",,"rpcrt4.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"sechost",,"sechost.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"Setupapi",,"Setupapi.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"SHCORE",,"SHCORE.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"SHELL32",,"SHELL32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"SHLWAPI",,"SHLWAPI.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"user32",,"user32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"wow64",,"wow64.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"wow64win",,"wow64win.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"WS2_32",,"WS2_32.dll" +;;KnownDLLs not present in registry on Windows but present in \\KnownDLLs directory +HKLM,%Control%\Session Manager\KnownDLLs,"ucrtbase",,"ucrtbase.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"msvcp_win",,"msvcp_win.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"bcrypt",,"bcrypt.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"COMCTL32",,"COMCTL32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"cfgmgr32",,"cfgmgr32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"ntdll",,"ntdll.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"bcryptPrimitives",,"bcryptPrimitives.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"win32u",,"win32u.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"gdi32full",,"gdi32full.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"WINTRUST",,"WINTRUST.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"CRYPT32",,"CRYPT32.dll" +HKLM,%Control%\Session Manager\KnownDLLs,"WLDAP32",,"WLDAP32.dll" [Fonts] HKLM,%FontSubStr%,"Arial Baltic,186",,"Arial,186" From 38caaef57f3fb88777c935874bd9428091b50299 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 2 Feb 2023 17:14:54 -0600 Subject: [PATCH 0772/1506] ntdll: Load known dlls from system directory. CW-Bug-Id: #21866 --- dlls/kernel32/tests/module.c | 9 ++++-- dlls/ntdll/loader.c | 54 +++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index 0e38ce80f54..7dd1125a0a6 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -1675,13 +1675,15 @@ static void test_known_dlls_load(void) h = LoadLibraryA( dll ); ret = pSetDefaultDllDirectories( LOAD_LIBRARY_SEARCH_DEFAULT_DIRS ); ok( ret, "SetDefaultDllDirectories failed err %lu\n", GetLastError() ); - todo_wine ok( !!h, "Got NULL.\n" ); + ok( !!h, "Got NULL.\n" ); + check_dll_path( h, system_path ); hapiset = GetModuleHandleA( apiset_dll ); ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); FreeLibrary( h ); h = LoadLibraryExA( dll, 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR ); - todo_wine ok( !!h, "Got NULL.\n" ); + ok( !!h, "Got NULL.\n" ); + check_dll_path( h, system_path ); hapiset = GetModuleHandleA( apiset_dll ); ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); FreeLibrary( h ); @@ -1691,8 +1693,9 @@ static void test_known_dlls_load(void) h = LoadLibraryExA( dll, 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR ); ok( !!h, "Got NULL.\n" ); + check_dll_path( h, system_path ); hapiset = GetModuleHandleA( apiset_dll ); - todo_wine ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); + ok( hapiset == h, "Got %p, %p.\n", hapiset, h ); FreeLibrary( h ); /* Local version can still be loaded if dll name contains path. */ diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 142fd939ed5..7084d874d92 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -34,6 +34,7 @@ #include "wine/exception.h" #include "wine/debug.h" #include "wine/list.h" +#include "wine/rbtree.h" #include "ntdll_misc.h" #include "ddk/wdm.h" @@ -189,6 +190,13 @@ static WINE_MODREF *last_failed_modref; static LDR_DDAG_NODE *node_ntdll, *node_kernel32; +struct known_dll +{ + struct rb_entry entry; + WCHAR name[1]; +}; +static struct rb_tree known_dlls; + static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, DWORD flags, WINE_MODREF** pwm, BOOL system ); static NTSTATUS process_attach( LDR_DDAG_NODE *node, LPVOID lpReserved ); static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports, @@ -3223,6 +3231,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI WINE_MODREF **pwm, HANDLE *mapping, SECTION_IMAGE_INFORMATION *image_info, struct file_id *id ) { + const WCHAR *known_dll_name = NULL; WCHAR *fullname = NULL; NTSTATUS status; ULONG wow64_old_value = 0; @@ -3255,6 +3264,12 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI goto done; } } + if (!fullname && rb_get( &known_dlls, libname )) + { + prepend_system_dir( libname, wcslen(libname), &fullname ); + known_dll_name = libname; + libname = fullname; + } } if (RtlDetermineDosPathNameType_U( libname ) == RELATIVE_PATH) @@ -3264,7 +3279,11 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI status = find_builtin_without_file( libname, nt_name, pwm, mapping, image_info, id ); } else if (!(status = RtlDosPathNameToNtPathName_U_WithStatus( libname, nt_name, NULL, NULL ))) + { status = open_dll_file( nt_name, pwm, mapping, image_info, id ); + if (status == STATUS_DLL_NOT_FOUND && known_dll_name) + status = find_builtin_without_file( known_dll_name, nt_name, pwm, mapping, image_info, id ); + } if (status == STATUS_NOT_SUPPORTED) status = STATUS_INVALID_IMAGE_FORMAT; @@ -4180,17 +4199,31 @@ static void process_breakpoint(void) __ENDTRY } +/************************************************************************* + * compare_known_dlls + */ +static int compare_known_dlls( const void *name, const struct wine_rb_entry *entry ) +{ + struct known_dll *known_dll = WINE_RB_ENTRY_VALUE( entry, struct known_dll, entry ); + + return wcsicmp( name, known_dll->name ); +} /*********************************************************************** * load_global_options */ static void load_global_options(void) { + char buffer[256]; + KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; OBJECT_ATTRIBUTES attr; UNICODE_STRING bootstrap_mode_str = RTL_CONSTANT_STRING( L"WINEBOOTSTRAPMODE" ); UNICODE_STRING session_manager_str = RTL_CONSTANT_STRING( L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" ); - UNICODE_STRING val_str; + UNICODE_STRING val_str, name_str; + struct known_dll *known_dll; + ULONG idx = 0, size; + NTSTATUS status; HANDLE hkey; val_str.MaximumLength = 0; @@ -4210,6 +4243,25 @@ static void load_global_options(void) query_dword_option( hkey, L"SafeDllSearchMode", &dll_safe_mode ); NtClose( hkey ); } + + rb_init( &known_dlls, compare_known_dlls ); + + RtlInitUnicodeString( &name_str, + L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager\\KnownDLLs" ); + if (NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr )) return; + while (1) + { + status = NtEnumerateValueKey( hkey, idx++, KeyValuePartialInformation, buffer, sizeof(buffer), &size ); + if (status == STATUS_BUFFER_OVERFLOW) continue; + if (status) break; + if (info->Type != REG_SZ) continue; + + known_dll = RtlAllocateHeap( GetProcessHeap(), 0, offsetof(struct known_dll, name[0]) + info->DataLength ); + if (!known_dll) break; + memcpy( known_dll->name, info->Data, info->DataLength ); + rb_put( &known_dlls, known_dll->name, &known_dll->entry ); + } + NtClose( hkey ); } From aaeaefacf5ca11dd6d6e9e8c168c4ea18f233885 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 20 Mar 2023 10:03:16 -0600 Subject: [PATCH 0773/1506] ntdll: HACK: Search for ucrtbase using common rules. CW-Bug-Id: #22048 --- dlls/ntdll/loader.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 7084d874d92..02e73477f43 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3017,8 +3017,18 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname ) */ static NTSTATUS prepend_system_dir( const WCHAR *name, ULONG name_length, WCHAR **fullname ) { + static const WCHAR ucrtbase[] = L"ucrtbase.dll"; ULONG len; + if (name_length == sizeof(ucrtbase) / sizeof(*ucrtbase) - 1 && !_wcsnicmp( name, ucrtbase, name_length )) + { + if (!(*fullname = RtlAllocateHeap( GetProcessHeap(), 0, (name_length + 1) * sizeof(WCHAR) ))) + return STATUS_NO_MEMORY; + memcpy( *fullname, name, name_length * sizeof(WCHAR) ); + (*fullname)[name_length] = 0; + return STATUS_SUCCESS; + } + len = wcslen( system_dir ) + name_length; if (!(*fullname = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return STATUS_NO_MEMORY; From 0f4e6d8a492632cee31d56bec5027aa9220a5bba Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 7 Apr 2023 19:59:49 -0600 Subject: [PATCH 0774/1506] wined3d: Set window state from the calling thread. This effectively reverts commit 1765c4594f6a11fe0df1aed7261cfafdb7514c43. CW-Bug-Id: #22121 --- dlls/wined3d/swapchain.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 8a02847c840..6e9e5af7254 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -2191,7 +2191,6 @@ static void set_window_state(struct wined3d_window_state *s) static const UINT timeout = 1500; DWORD window_tid = GetWindowThreadProcessId(s->window, NULL); DWORD tid = GetCurrentThreadId(); - HANDLE thread; TRACE("Window %p belongs to thread %#lx.\n", s->window, window_tid); /* If the window belongs to a different thread, modifying the style and/or @@ -2209,18 +2208,8 @@ static void set_window_state(struct wined3d_window_state *s) else KillTimer(s->window, WINED3D_WINDOW_TOPMOST_TIMER_ID); } - - set_window_state_thread(s); - } - else if ((thread = CreateThread(NULL, 0, set_window_state_thread, s, 0, NULL))) - { - SetThreadDescription(thread, L"wined3d_set_window_state"); - CloseHandle(thread); - } - else - { - ERR("Failed to create thread.\n"); } + set_window_state_thread(s); } HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state, From 051d16b7814d176cfd74249b36faace38e402374 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 15 Feb 2023 21:00:47 -0600 Subject: [PATCH 0775/1506] kernelbase: Do not attempt to start winedbg if logging is disabled. CW-Bug-Id: #20812 --- dlls/kernelbase/debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c index 17ce2e7be05..6423ff4573d 100644 --- a/dlls/kernelbase/debug.c +++ b/dlls/kernelbase/debug.c @@ -635,6 +635,8 @@ static BOOL start_debugger_atomic( EXCEPTION_POINTERS *epointers ) { static HANDLE once; + if (!ERR_ON(seh)) return FALSE; + if (once == 0) { OBJECT_ATTRIBUTES attr; From 6820fdab727af422023838037318a98b4ee4083a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 27 Mar 2023 10:44:52 -0600 Subject: [PATCH 0776/1506] kernelbase: HACK: Force swiftshader for Olympia Rising. CW-Bug-Id: #22076 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 1eee356d1b8..c35be013ea1 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -615,6 +615,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, + {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, }; unsigned int i; From 57c730331b7d4988cc01c21809667edc3e5d9f59 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 27 Mar 2023 21:18:36 -0600 Subject: [PATCH 0777/1506] wined3d: Rename Deck GPU in description table. CW-Bug-Id: #22080 --- dlls/wined3d/directx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index ab4fa04b3cf..8af03012ed4 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -544,7 +544,7 @@ static const struct wined3d_gpu_description gpu_description_table[] = {HW_VENDOR_AMD, CARD_AMD_RADEON_RX_NAVI_21, "Radeon RX 6800/6800 XT / 6900 XT", DRIVER_AMD_RX, 16384}, {HW_VENDOR_AMD, CARD_AMD_RADEON_PRO_V620, "Radeon Pro V620", DRIVER_AMD_RX, 32768}, {HW_VENDOR_AMD, CARD_AMD_RADEON_PRO_V620_VF, "Radeon Pro V620 VF", DRIVER_AMD_RX, 32768}, - {HW_VENDOR_AMD, CARD_AMD_VANGOGH, "AMD VANGOGH", DRIVER_AMD_RX, 4096}, + {HW_VENDOR_AMD, CARD_AMD_VANGOGH, "AMD Radeon VANGOGH", DRIVER_AMD_RX, 4096}, {HW_VENDOR_AMD, CARD_AMD_RAPHAEL, "AMD Radeon(TM) Graphics", DRIVER_AMD_RX, 4096}, /* Red Hat */ From 103d3584a8fe0a2c0cd3d1e60d95dd4a6c9c0b38 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 24 Mar 2023 17:32:02 -0600 Subject: [PATCH 0778/1506] wineboot: Load root certificates on prefix update. CW-Bug-Id: #22034 --- programs/wineboot/Makefile.in | 2 +- programs/wineboot/wineboot.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/programs/wineboot/Makefile.in b/programs/wineboot/Makefile.in index 7c61102c40e..6ffab89d2da 100644 --- a/programs/wineboot/Makefile.in +++ b/programs/wineboot/Makefile.in @@ -1,6 +1,6 @@ MODULE = wineboot.exe IMPORTS = uuid advapi32 ws2_32 kernelbase -DELAYIMPORTS = shell32 shlwapi version user32 setupapi newdev +DELAYIMPORTS = shell32 shlwapi version user32 setupapi newdev crypt32 EXTRADLLFLAGS = -mconsole diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 160a1d43786..0ea276f6876 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -79,6 +79,7 @@ #include #include #include +#include #include "resource.h" WINE_DEFAULT_DEBUG_CHANNEL(wineboot); @@ -1589,6 +1590,15 @@ static void update_win_version(void) } } +static void update_root_certs(void) +{ + HCERTSTORE store; + + store = CertOpenStore( CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0, 0, CERT_STORE_OPEN_EXISTING_FLAG + | CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE, L"Root"); + CertCloseStore( store, 0 ); +} + /* execute rundll32 on the wine.inf file if necessary */ static void update_wineprefix( BOOL force ) { @@ -1646,6 +1656,7 @@ static void update_wineprefix( BOOL force ) install_root_pnp_devices(); update_user_profile(); update_win_version(); + update_root_certs(); WINE_MESSAGE( "wine: configuration in %s has been updated.\n", debugstr_w(prettyprint_configdir()) ); } From 9f0295d42d1d5d2c4857029778eda68a994c6178 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 14 Mar 2023 21:12:22 -0600 Subject: [PATCH 0779/1506] ntdll: HACK: Add WINE_SIMULATE_WRITECOPY option. CW-Bug-Id: #22034 --- dlls/ntdll/unix/loader.c | 5 +++++ dlls/ntdll/unix/unix_private.h | 1 + dlls/ntdll/unix/virtual.c | 13 +++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c168d31b526..d18b46f3ae0 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2021,6 +2021,7 @@ BOOL alert_simulate_sched_quantum; BOOL fsync_yield_to_waiters; BOOL no_priv_elevation; BOOL localsystem_sid; +BOOL simulate_writecopy; static void hacks_init(void) { @@ -2083,6 +2084,10 @@ static void hacks_init(void) if (env_str) report_native_pc_as_ntdll = atoi(env_str); else if (sgi) report_native_pc_as_ntdll = !strcmp(sgi, "700330"); + env_str = getenv("WINE_SIMULATE_WRITECOPY"); + if (env_str) simulate_writecopy = atoi(env_str); + else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730"); + if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) { ERR("HACK: reporting LocalSystem account SID.\n"); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index cb85d26509b..e731652561a 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -185,6 +185,7 @@ extern BOOL alert_simulate_sched_quantum; extern BOOL fsync_yield_to_waiters; extern BOOL no_priv_elevation; extern BOOL localsystem_sid; +extern BOOL simulate_writecopy; extern void init_environment(void); extern void init_startup_info(void); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index a1a97ac1f4a..4953a2086ec 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -5054,10 +5054,19 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T old = get_win32_prot( vprot, view->protect ); status = set_protection( view, base, size, new_prot ); - /* GTA5 HACK: Mark first page as copied. */ - if (status == STATUS_SUCCESS && (view->protect & SEC_IMAGE) && + if (simulate_writecopy && status == STATUS_SUCCESS + && ((old == PAGE_WRITECOPY || old == PAGE_EXECUTE_WRITECOPY))) + { + TRACE("Setting VPROT_COPIED.\n"); + + set_page_vprot_bits(base, size, VPROT_COPIED, 0); + vprot |= VPROT_COPIED; + old = get_win32_prot( vprot, view->protect ); + } + else if (status == STATUS_SUCCESS && (view->protect & SEC_IMAGE) && base == (void*)NtCurrentTeb()->Peb->ImageBaseAddress) { + /* GTA5 HACK: Mark first page as copied. */ const WCHAR gta5W[] = { 'g','t','a','5','.','e','x','e',0 }; WCHAR *name, *p; From 87602628da7ee710203b75daed81ce777243ebef Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 24 Mar 2023 18:12:29 -0600 Subject: [PATCH 0780/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for Purgo box. CW-Bug-Id: #22034 --- dlls/ntdll/unix/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index d18b46f3ae0..6145ab31ae7 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2086,7 +2086,7 @@ static void hacks_init(void) env_str = getenv("WINE_SIMULATE_WRITECOPY"); if (env_str) simulate_writecopy = atoi(env_str); - else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730"); + else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") || !strcmp(sgi, "1680700"); if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) { From 1e2980f8b137dd8d61444977c75c169e7d37fa80 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 20 Mar 2023 17:48:40 -0600 Subject: [PATCH 0781/1506] kernelbase: HACK: Add --use-angle=d3d9 command line option for nw.exe.exe. CW-Bug-Id: #22042 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index c35be013ea1..92a7fc72d00 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -616,6 +616,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, + {L"nw.exe.exe", L" --use-angle=d3d9"}, }; unsigned int i; From e7131f4a02373ad37a1a7a68a6dfdb37f8c9f33b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 22 Mar 2023 14:31:03 -0600 Subject: [PATCH 0782/1506] crypt32: Add WINE_ADDITIONAL_CERTS_DIR option. CW-Bug-Id: #22063 --- dlls/crypt32/unixlib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/crypt32/unixlib.c b/dlls/crypt32/unixlib.c index 72770caab5f..feb0c360d68 100644 --- a/dlls/crypt32/unixlib.c +++ b/dlls/crypt32/unixlib.c @@ -623,6 +623,7 @@ static const char * const CRYPT_knownLocations[] = { static void load_root_certs(void) { + const char *additional_dir; unsigned int i; #ifdef __APPLE__ @@ -660,6 +661,9 @@ static void load_root_certs(void) for (i = 0; i < ARRAY_SIZE(CRYPT_knownLocations) && list_empty(&root_cert_list); i++) import_certs_from_path( CRYPT_knownLocations[i], TRUE ); + + if ((additional_dir = getenv( "WINE_ADDITIONAL_CERTS_DIR" ))) + import_certs_from_path( additional_dir, TRUE ); } static NTSTATUS enum_root_certs( void *args ) From 27ae8fcee8dc39fe2180627dd10c052c3141e1ef Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 11 Apr 2023 14:04:18 -0600 Subject: [PATCH 0783/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for Breakout 13. CW-Bug-Id: #22130 --- dlls/ntdll/unix/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 6145ab31ae7..adcbfd3e227 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2086,7 +2086,8 @@ static void hacks_init(void) env_str = getenv("WINE_SIMULATE_WRITECOPY"); if (env_str) simulate_writecopy = atoi(env_str); - else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") || !strcmp(sgi, "1680700"); + else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") || !strcmp(sgi, "1680700") + || !strcmp(sgi, "2095300"); if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) { From f5256bcaa1634da666b511d797fd088828077213 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 11 Apr 2023 16:34:16 +0800 Subject: [PATCH 0784/1506] HACK: ntdll: Enable WINE_SIMULATE_WRITECOPY for Mr. Hopp's Playhouse 3. CW-Bug-Id: #22127 --- dlls/ntdll/unix/loader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index adcbfd3e227..19d30b4f0d5 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2086,8 +2086,10 @@ static void hacks_init(void) env_str = getenv("WINE_SIMULATE_WRITECOPY"); if (env_str) simulate_writecopy = atoi(env_str); - else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") || !strcmp(sgi, "1680700") - || !strcmp(sgi, "2095300"); + else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") /* Dawn of Corruption */ + || !strcmp(sgi, "1680700") /* Purgo box */ + || !strcmp(sgi, "2095300") /* Breakout 13 */ + || !strcmp(sgi, "2176450"); /* Mr. Hopp's Playhouse 3 */ if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) { From 72fb91c7e4a8a6f1a3e101abf6c24fe1c26f09d0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 10 Apr 2023 20:27:49 -0600 Subject: [PATCH 0785/1506] setupapi: Don't use NULL as key value in get_device_property(). CW-Bug-Id: #22126 --- dlls/setupapi/devinst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 864551c7e79..0b827d3ab9b 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4451,7 +4451,7 @@ static LSTATUS get_device_property(struct device *device, const DEVPROPKEY *prop if (!ls) { value_size = prop_buff_size; - ls = RegQueryValueExW(hkey, NULL, NULL, &value_type, prop_buff, &value_size); + ls = RegQueryValueExW(hkey, L"", NULL, &value_type, prop_buff, &value_size); RegCloseKey(hkey); } From be7ceeafa2ed77ae461bc5a51d0651db7e62b7a3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 10 Apr 2023 20:28:51 -0600 Subject: [PATCH 0786/1506] combase: Don't use NULL as key value in get_object_dll_path(). CW-Bug-Id: #22126 --- dlls/combase/apartment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/combase/apartment.c b/dlls/combase/apartment.c index 92f1e32c502..3bafac4b85d 100644 --- a/dlls/combase/apartment.c +++ b/dlls/combase/apartment.c @@ -719,7 +719,7 @@ static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst WCHAR src[MAX_PATH]; DWORD dwLength = dstlen * sizeof(WCHAR); - if ((ret = RegQueryValueExW(regdata->u.hkey, NULL, NULL, &keytype, (BYTE*)src, &dwLength)) == ERROR_SUCCESS) + if ((ret = RegQueryValueExW(regdata->u.hkey, L"", NULL, &keytype, (BYTE*)src, &dwLength)) == ERROR_SUCCESS) { if (keytype == REG_EXPAND_SZ) { From 0d5132bf05a03446802fe5f759fdf04b81c1027f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 10 Apr 2023 20:30:22 -0600 Subject: [PATCH 0787/1506] shell32: Don't use NULL as key value in ShellExecute_GetClassKey(). CW-Bug-Id: #22126 --- dlls/shell32/shlexec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index eb9ca4a06df..2fdbdebe94b 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -1124,13 +1124,13 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei ) if (r != ERROR_SUCCESS ) return hkey; - r = RegQueryValueExW( hkey, NULL, 0, &type, NULL, &sz ); + r = RegQueryValueExW( hkey, L"", 0, &type, NULL, &sz ); if ( r == ERROR_SUCCESS && type == REG_SZ ) { sz += sizeof (WCHAR); cls = malloc( sz ); cls[0] = 0; - RegQueryValueExW( hkey, NULL, 0, &type, (LPBYTE) cls, &sz ); + RegQueryValueExW( hkey, L"", 0, &type, (LPBYTE) cls, &sz ); } RegCloseKey( hkey ); From c26f6b042f1d2e72f8d444744150a9ecc3260d68 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 10 Apr 2023 21:07:10 -0600 Subject: [PATCH 0788/1506] ntdll: Add PROTON_DISABLE_LSTEAMCLIENT config option. CW-Bug-Id: #22126 --- dlls/ntdll/loader.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 02e73477f43..24efd25e8db 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2196,6 +2196,18 @@ static NTSTATUS perform_relocations( void *module, IMAGE_NT_HEADERS *nt, SIZE_T return STATUS_SUCCESS; } +static int use_lsteamclient(void) +{ + WCHAR env[32]; + static int use = -1; + + if (use != -1) return use; + + use = !get_env( L"PROTON_DISABLE_LSTEAMCLIENT", env, sizeof(env) ) || *env == '0'; + if (!use) + ERR("lsteamclient disabled.\n"); + return use; +} /************************************************************************* * build_module @@ -2243,7 +2255,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name, basename_len = wcslen(basename); if (basename_len >= 4 && !wcscmp(basename + basename_len - 4, L".dll")) basename_len -= 4; - if ((!RtlCompareUnicodeStrings(basename, basename_len, L"steamclient", 11, TRUE) || + if (use_lsteamclient() && (!RtlCompareUnicodeStrings(basename, basename_len, L"steamclient", 11, TRUE) || !RtlCompareUnicodeStrings(basename, basename_len, L"steamclient64", 13, TRUE) || !RtlCompareUnicodeStrings(basename, basename_len, L"gameoverlayrenderer", 19, TRUE) || !RtlCompareUnicodeStrings(basename, basename_len, L"gameoverlayrenderer64", 21, TRUE)) && From fd61e125f0bec5ebc28556051d9fbfe85009c1ed Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 7 Mar 2023 09:01:39 -0600 Subject: [PATCH 0789/1506] kernelbase: HACK: Force Angle GL instead of Swiftshader for Paradox Launcher. CW-Bug-Id: #21997 --- dlls/kernelbase/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 92a7fc72d00..2a16e8ca418 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -611,7 +611,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) options[] = { {L"UplayWebCore.exe", L" --use-gl=swiftshader"}, - {L"Paradox Launcher.exe", L" --use-gl=swiftshader --in-process-gpu"}, + {L"Paradox Launcher.exe", L" --use-angle=gl"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, From a2e89d3ac297e1d52811f6a59c51dbe83d52334c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 5 Apr 2023 11:31:10 -0600 Subject: [PATCH 0790/1506] kernelbase: HACK: Add --use-gl=swiftshader for DC Universe Online/LaunchPad.exe. CW-Bug-Id: #22083 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 2a16e8ca418..2f1a5d2100f 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -617,6 +617,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, {L"nw.exe.exe", L" --use-angle=d3d9"}, + {L"DC Universe Online\\LaunchPad.exe", L" --use-gl=swiftshader"}, }; unsigned int i; From 6d2719ef2669a0ab3c51e74bbd38b1a8698a8c42 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 5 Apr 2023 11:33:40 -0600 Subject: [PATCH 0791/1506] kernelbase: HACK: Add --use-gl=swiftshader for Planetside 2/LaunchPad.exe. CW-Bug-Id: #22083 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 2f1a5d2100f..f2f6bb8d5db 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -618,6 +618,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, {L"nw.exe.exe", L" --use-angle=d3d9"}, {L"DC Universe Online\\LaunchPad.exe", L" --use-gl=swiftshader"}, + {L"PlanetSide 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, }; unsigned int i; From 1a24dd24cedb217efc81e89efd68cdbeb5e3cb22 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 12 Apr 2023 18:25:03 -0600 Subject: [PATCH 0792/1506] kernelbase: Remove command line fixup code from battleye_launcher_redirect_hack(). CW-Bug-Id: #22133 --- dlls/kernelbase/process.c | 45 ++++++--------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index f2f6bb8d5db..98af91c47a7 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -555,49 +555,23 @@ static BOOL product_name_matches(const WCHAR *app_name, const char *match) return TRUE; } -static int battleye_launcher_redirect_hack(const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len, WCHAR **cmd_line) +static int battleye_launcher_redirect_hack( const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len ) { static const WCHAR belauncherW[] = L"c:\\windows\\system32\\belauncher.exe"; - WCHAR *new_cmd_line; - WCHAR *p; /* We detect the BattlEye launcher executable through the product name property, as the executable name varies */ - if (!product_name_matches(app_name, "BattlEye Launcher")) + if (!product_name_matches( app_name, "BattlEye Launcher" )) return 0; - TRACE("Detected launch of a BattlEye Launcher, redirecting to Proton version.\n"); + TRACE( "Detected launch of a BattlEye Launcher, redirecting to Proton version.\n" ); - if (new_name_len < wcslen(belauncherW) + 1) + if (new_name_len < wcslen( belauncherW ) + 1) { - WARN("Game executable path doesn't fit in buffer.\n"); + ERR( "Game executable path doesn't fit in buffer.\n" ); return 0; } - wcscpy(new_name, belauncherW); - - /* find and replace executable name in command line, and add BE argument */ - p = *cmd_line; - if (p[0] == '\"') - p++; - - if (!wcsncmp(p, app_name, wcslen(app_name))) - { - new_cmd_line = HeapAlloc( GetProcessHeap(), 0, ( wcslen(*cmd_line) + wcslen(belauncherW) + 1 - wcslen(app_name) ) * sizeof(WCHAR) ); - - wcscpy(new_cmd_line, *cmd_line); - p = new_cmd_line; - if (p[0] == '\"') - p++; - - memmove( p + wcslen(belauncherW), p + wcslen(app_name), (wcslen(p) - wcslen(belauncherW)) * sizeof(WCHAR) ); - memcpy( p, belauncherW, wcslen(belauncherW) * sizeof(WCHAR) ); - - TRACE("old command line %s.\n", debugstr_w(*cmd_line)); - TRACE("new command line %s.\n", debugstr_w(new_cmd_line)); - - *cmd_line = new_cmd_line; - } - + wcscpy( new_name, belauncherW ); return 1; } @@ -706,13 +680,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR app_name = name; } - p = tidy_cmdline; - if (battleye_launcher_redirect_hack( app_name, name, ARRAY_SIZE(name), &tidy_cmdline )) - { + if (battleye_launcher_redirect_hack( app_name, name, ARRAY_SIZE(name) )) app_name = name; - if (p != tidy_cmdline && p != cmd_line) - HeapFree( GetProcessHeap(), 0, p ); - } /* Warn if unsupported features are used */ From 03c5bcc06a75824438bbcb75b2856645978d24a4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 12 Apr 2023 18:51:15 -0600 Subject: [PATCH 0793/1506] kernelbase: Set PROTON_ORIG_LAUNCHER_NAME when starting builtin BattleEye launcher. CW-Bug-Id: #22133 --- dlls/kernelbase/process.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 98af91c47a7..375a0f416a5 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -555,9 +555,11 @@ static BOOL product_name_matches(const WCHAR *app_name, const char *match) return TRUE; } -static int battleye_launcher_redirect_hack( const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len ) +static int battleye_launcher_redirect_hack( const WCHAR *app_name, WCHAR *new_name, DWORD new_name_len, + WCHAR **orig_app_name ) { static const WCHAR belauncherW[] = L"c:\\windows\\system32\\belauncher.exe"; + unsigned int len; /* We detect the BattlEye launcher executable through the product name property, as the executable name varies */ if (!product_name_matches( app_name, "BattlEye Launcher" )) @@ -571,6 +573,13 @@ static int battleye_launcher_redirect_hack( const WCHAR *app_name, WCHAR *new_na return 0; } + len = (wcslen( app_name ) + 1) * sizeof(*app_name); + if (!(*orig_app_name = HeapAlloc( GetProcessHeap(), 0, len ))) + { + ERR( "No memory.\n" ); + return 0; + } + memcpy( *orig_app_name, app_name, len ); wcscpy( new_name, belauncherW ); return 1; } @@ -621,7 +630,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR { const struct proc_thread_attr *handle_list = NULL, *job_list = NULL; WCHAR name[MAX_PATH]; - WCHAR *p, *tidy_cmdline = cmd_line; + WCHAR *p, *tidy_cmdline = cmd_line, *orig_app_name = NULL; RTL_USER_PROCESS_PARAMETERS *params = NULL; RTL_USER_PROCESS_INFORMATION rtl_info; HANDLE parent = 0, debug = 0; @@ -680,7 +689,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR app_name = name; } - if (battleye_launcher_redirect_hack( app_name, name, ARRAY_SIZE(name) )) + if (battleye_launcher_redirect_hack( app_name, name, ARRAY_SIZE(name), &orig_app_name )) app_name = name; /* Warn if unsupported features are used */ @@ -704,6 +713,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR if (!(params = create_process_params( app_name, tidy_cmdline, cur_dir, env, flags, startup_info ))) { + HeapFree( GetProcessHeap(), 0, orig_app_name ); status = STATUS_NO_MEMORY; goto done; } @@ -712,18 +722,25 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR - We don't do this check in ntdll itself because it's harder to get the product name there - we don't overwrite WINEDLLOVERRIDES because it's fetched from the unix environment */ { - UNICODE_STRING is_eac_launcher_us; - UNICODE_STRING one_us; + UNICODE_STRING name, value; WCHAR *new_env = RtlAllocateHeap( GetProcessHeap(), 0, params->EnvironmentSize ); memcpy(new_env, params->Environment, params->EnvironmentSize); RtlDestroyProcessParameters( params ); - RtlInitUnicodeString( &is_eac_launcher_us, L"PROTON_EAC_LAUNCHER_PROCESS" ); - RtlInitUnicodeString( &one_us, L"1" ); - RtlSetEnvironmentVariable( &new_env, &is_eac_launcher_us, product_name_matches(app_name, "EasyAntiCheat Launcher") ? &one_us : NULL ); + RtlInitUnicodeString( &name, L"PROTON_EAC_LAUNCHER_PROCESS" ); + RtlInitUnicodeString( &value, L"1" ); + RtlSetEnvironmentVariable( &new_env, &name, product_name_matches(app_name, "EasyAntiCheat Launcher") ? &value : NULL ); + + if (orig_app_name) + { + RtlInitUnicodeString( &name, L"PROTON_ORIG_LAUNCHER_NAME" ); + RtlInitUnicodeString( &value, orig_app_name ); + RtlSetEnvironmentVariable( &new_env, &name, &value ); + } + HeapFree( GetProcessHeap(), 0, orig_app_name ); params = create_process_params( app_name, tidy_cmdline, cur_dir, new_env, flags | CREATE_UNICODE_ENVIRONMENT, startup_info ); RtlFreeHeap(GetProcessHeap(), 0, new_env); From 41513c2e36b38549eb9af3ac7e298d3a42a2c102 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 12 Apr 2023 19:42:00 -0600 Subject: [PATCH 0794/1506] belauncher: Use original launcher .exe path to find BELauncher.ini and executable. CW-Bug-Id: #22133 --- programs/belauncher/Makefile.in | 2 +- programs/belauncher/main.c | 54 ++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/programs/belauncher/Makefile.in b/programs/belauncher/Makefile.in index 9800c0b45ba..882d914bc03 100644 --- a/programs/belauncher/Makefile.in +++ b/programs/belauncher/Makefile.in @@ -1,5 +1,5 @@ MODULE = belauncher.exe -IMPORTS = +IMPORTS = shlwapi EXTRADLLFLAGS = -mwindows -municode diff --git a/programs/belauncher/main.c b/programs/belauncher/main.c index 004a7d1a711..a40e7cf8853 100644 --- a/programs/belauncher/main.c +++ b/programs/belauncher/main.c @@ -1,6 +1,7 @@ #define WIN32_LEAN_AND_MEAN #include #include +#include #include "wine/debug.h" @@ -9,9 +10,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(belauncher); int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow) { char *configs, *config, *arch_32_exe = NULL, *arch_64_exe = NULL, *game_exe, *be_arg = NULL; + WCHAR path[MAX_PATH], *p, config_path[MAX_PATH]; LARGE_INTEGER launcher_cfg_size; unsigned char battleye_status; - int game_exe_len, arg_len; + int game_exe_len, arg_len, path_len; PROCESS_INFORMATION pi; HANDLE launcher_cfg; LPWSTR launch_cmd; @@ -22,9 +24,31 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm battleye_status = 0x3; /* Starting */ _write(1, &battleye_status, 1); - launcher_cfg = CreateFileW(L"Battleye\\BELauncher.ini", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + *path = 0; + if ((size = GetEnvironmentVariableW(L"PROTON_ORIG_LAUNCHER_NAME", path, ARRAY_SIZE(path))) && size <= ARRAY_SIZE(path)) + { + WINE_TRACE("PROTON_ORIG_LAUNCHER_NAME %s.\n", wine_dbgstr_w(path)); + + for (p = path + wcslen(path); p != path; --p) + if (*p == '\\') break; + if (*p == '\\') + ++p; + *p = 0; + } + + wcscpy(config_path, path); + wcscat(config_path, L"Battleye\\BELauncher.ini"); + launcher_cfg = CreateFileW(config_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (launcher_cfg == INVALID_HANDLE_VALUE) + { + *path = 0; + launcher_cfg = CreateFileW(L"Battleye\\BELauncher.ini", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + } if (launcher_cfg == INVALID_HANDLE_VALUE) + { + WINE_ERR("BELauncher.ini not found.\n"); goto start_failed; + } if(!GetFileSizeEx(launcher_cfg, &launcher_cfg_size) || launcher_cfg_size.u.HighPart) { @@ -64,7 +88,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm else { HeapFree( GetProcessHeap(), 0, configs ); - WINE_WARN("Failed to find game executable name from BattlEye config.\n"); + WINE_ERR("Failed to find game executable name from BattlEye config.\n"); goto start_failed; } @@ -88,21 +112,28 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm battleye_status = 0x9; /* Launching Game */ _write(1, &battleye_status, 1); - launch_cmd = HeapAlloc(GetProcessHeap(), 0, (game_exe_len + 1 + wcslen(cmdline) + 1 + arg_len + 1) * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, game_exe, -1, launch_cmd, game_exe_len + 1); - launch_cmd[game_exe_len] = ' '; + if (PathIsRelativeA(game_exe)) + path_len = wcslen(path); + else + path_len = 0; + + launch_cmd = HeapAlloc(GetProcessHeap(), 0, (path_len + game_exe_len + 1 + wcslen(cmdline) + 1 + arg_len + 1) * sizeof(WCHAR)); - wcscpy(launch_cmd + game_exe_len + 1, cmdline); - launch_cmd[game_exe_len + 1 + wcslen(cmdline)] = ' '; + memcpy(launch_cmd, path, path_len * sizeof(*path)); - MultiByteToWideChar(CP_ACP, 0, be_arg, -1, launch_cmd + game_exe_len + 1 + wcslen(cmdline) + 1, arg_len + 1); + MultiByteToWideChar(CP_ACP, 0, game_exe, -1, launch_cmd + path_len, game_exe_len + 1); + launch_cmd[path_len + game_exe_len] = ' '; + + wcscpy(launch_cmd + path_len + game_exe_len + 1, cmdline); + launch_cmd[path_len + game_exe_len + 1 + wcslen(cmdline)] = ' '; + + MultiByteToWideChar(CP_ACP, 0, be_arg, -1, launch_cmd + path_len + game_exe_len + 1 + wcslen(cmdline) + 1, arg_len + 1); if (!CreateProcessW(NULL, launch_cmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) { + WINE_ERR("CreateProcessW failed.\n"); battleye_status = 0xA; /* Launch Failed */ _write(1, &battleye_status, 1); - - HeapFree( GetProcessHeap(), 0, launch_cmd ); return GetLastError(); } HeapFree( GetProcessHeap(), 0, launch_cmd ); @@ -112,6 +143,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm return 0; start_failed: + WINE_ERR("Failed.\n"); battleye_status = 0x4; /* Start Failed */ _write(1, &battleye_status, 1); return 0; From 004aa52dae12e74aeabbbf93d6b1a739b1cdf1bd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 19 Apr 2023 15:32:38 -0600 Subject: [PATCH 0795/1506] belauncher: Null terminate launch_cmd if be_arg is empty. CW-Bug-Id: #22146 --- programs/belauncher/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/programs/belauncher/main.c b/programs/belauncher/main.c index a40e7cf8853..c8b8ccbf532 100644 --- a/programs/belauncher/main.c +++ b/programs/belauncher/main.c @@ -127,7 +127,13 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm wcscpy(launch_cmd + path_len + game_exe_len + 1, cmdline); launch_cmd[path_len + game_exe_len + 1 + wcslen(cmdline)] = ' '; - MultiByteToWideChar(CP_ACP, 0, be_arg, -1, launch_cmd + path_len + game_exe_len + 1 + wcslen(cmdline) + 1, arg_len + 1); + + if (!MultiByteToWideChar(CP_ACP, 0, be_arg, -1, launch_cmd + path_len + game_exe_len + 1 + wcslen(cmdline) + 1, arg_len + 1)) + launch_cmd[path_len + game_exe_len + 1 + wcslen(cmdline)] = 0; + + WINE_TRACE("game_exe %s, cmdline %s.\n", wine_dbgstr_a(game_exe), wine_dbgstr_w(cmdline)); + WINE_TRACE("path %s, be_arg %s.\n", wine_dbgstr_w(path), wine_dbgstr_a(be_arg)); + WINE_TRACE("launch_cmd %s.\n", wine_dbgstr_w(launch_cmd)); if (!CreateProcessW(NULL, launch_cmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) { From 018519c984b45e86794fa77ffcab965f1cbc08fe Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 19 Apr 2023 17:00:49 -0600 Subject: [PATCH 0796/1506] belauncher: Support --exe command line option. CW-Bug-Id: #22146 --- programs/belauncher/Makefile.in | 2 +- programs/belauncher/main.c | 64 +++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/programs/belauncher/Makefile.in b/programs/belauncher/Makefile.in index 882d914bc03..927983f7423 100644 --- a/programs/belauncher/Makefile.in +++ b/programs/belauncher/Makefile.in @@ -1,5 +1,5 @@ MODULE = belauncher.exe -IMPORTS = shlwapi +IMPORTS = shlwapi shcore EXTRADLLFLAGS = -mwindows -municode diff --git a/programs/belauncher/main.c b/programs/belauncher/main.c index c8b8ccbf532..213378fd108 100644 --- a/programs/belauncher/main.c +++ b/programs/belauncher/main.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "wine/debug.h" @@ -9,8 +10,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(belauncher); int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow) { - char *configs, *config, *arch_32_exe = NULL, *arch_64_exe = NULL, *game_exe, *be_arg = NULL; - WCHAR path[MAX_PATH], *p, config_path[MAX_PATH]; + char *configs, *config, *arch_32_exe = NULL, *arch_64_exe = NULL, *game_exe = NULL, *be_arg = NULL; + WCHAR path[MAX_PATH], *p, config_path[MAX_PATH], game_exeW[MAX_PATH], **argvW; LARGE_INTEGER launcher_cfg_size; unsigned char battleye_status; int game_exe_len, arg_len, path_len; @@ -18,6 +19,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm HANDLE launcher_cfg; LPWSTR launch_cmd; STARTUPINFOW si = {0}; + int i, argc; DWORD size; BOOL wow64; @@ -81,22 +83,47 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm } while ((config = strchr(config, '\n')) && *(config++)); - if (arch_64_exe && (sizeof(void *) == 8 || (IsWow64Process(GetCurrentProcess(), &wow64) && wow64))) - game_exe = arch_64_exe; - else if (arch_32_exe) - game_exe = arch_32_exe; - else + *game_exeW = 0; + game_exe_len = 0; + + if ((argvW = CommandLineToArgvW(cmdline, &argc))) { - HeapFree( GetProcessHeap(), 0, configs ); - WINE_ERR("Failed to find game executable name from BattlEye config.\n"); - goto start_failed; + for (i = 0; i < argc; ++i) + { + if (!wcscmp(argvW[i], L"-exe") && i < argc - 1) + { + wcscpy(game_exeW, argvW[i + 1]); + game_exe_len = wcslen(game_exeW); + break; + } + } } - if (strchr(game_exe, '\r')) - *(strchr(game_exe, '\r')) = 0; - if (strchr(game_exe, '\n')) - *(strchr(game_exe, '\n')) = 0; - game_exe_len = MultiByteToWideChar(CP_ACP, 0, game_exe, -1, NULL, 0) - 1; + if (!*game_exeW) + { + if (arch_64_exe && (sizeof(void *) == 8 || (IsWow64Process(GetCurrentProcess(), &wow64) && wow64))) + game_exe = arch_64_exe; + else if (arch_32_exe) + game_exe = arch_32_exe; + else + { + HeapFree( GetProcessHeap(), 0, configs ); + WINE_ERR("Failed to find game executable name from BattlEye config.\n"); + goto start_failed; + } + + if (strchr(game_exe, '\r')) + *(strchr(game_exe, '\r')) = 0; + if (strchr(game_exe, '\n')) + *(strchr(game_exe, '\n')) = 0; + game_exe_len = MultiByteToWideChar(CP_ACP, 0, game_exe, -1, game_exeW, ARRAY_SIZE(game_exeW)); + if (!game_exe_len) + { + WINE_ERR("Failed to convert game_exe %s.\n", wine_dbgstr_a(game_exe)); + goto start_failed; + } + --game_exe_len; + } if (!be_arg) arg_len = 0; else @@ -112,7 +139,7 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm battleye_status = 0x9; /* Launching Game */ _write(1, &battleye_status, 1); - if (PathIsRelativeA(game_exe)) + if (PathIsRelativeW(game_exeW)) path_len = wcslen(path); else path_len = 0; @@ -121,17 +148,16 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm memcpy(launch_cmd, path, path_len * sizeof(*path)); - MultiByteToWideChar(CP_ACP, 0, game_exe, -1, launch_cmd + path_len, game_exe_len + 1); + memcpy(launch_cmd + path_len, game_exeW, game_exe_len * sizeof(*launch_cmd)); launch_cmd[path_len + game_exe_len] = ' '; wcscpy(launch_cmd + path_len + game_exe_len + 1, cmdline); launch_cmd[path_len + game_exe_len + 1 + wcslen(cmdline)] = ' '; - if (!MultiByteToWideChar(CP_ACP, 0, be_arg, -1, launch_cmd + path_len + game_exe_len + 1 + wcslen(cmdline) + 1, arg_len + 1)) launch_cmd[path_len + game_exe_len + 1 + wcslen(cmdline)] = 0; - WINE_TRACE("game_exe %s, cmdline %s.\n", wine_dbgstr_a(game_exe), wine_dbgstr_w(cmdline)); + WINE_TRACE("game_exe %s, cmdline %s.\n", wine_dbgstr_w(game_exeW), wine_dbgstr_w(cmdline)); WINE_TRACE("path %s, be_arg %s.\n", wine_dbgstr_w(path), wine_dbgstr_a(be_arg)); WINE_TRACE("launch_cmd %s.\n", wine_dbgstr_w(launch_cmd)); From 24ccfc3218e3f0450ff6ada78109c8d0c76f78f9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 28 Apr 2023 14:44:16 -0600 Subject: [PATCH 0797/1506] ntdll: HACK: Abort process on syscall fault when terminating. CW-Bug-Id: #22206 --- dlls/ntdll/unix/process.c | 12 ++++++++++++ dlls/ntdll/unix/signal_x86_64.c | 6 ++++++ dlls/ntdll/unix/unix_private.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 71eab55920d..3f05fe9be2e 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -983,6 +983,8 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_ return status; } +BOOL terminate_process_running; +LONG terminate_process_exit_code; /****************************************************************************** * NtTerminateProcess (NTDLL.@) @@ -992,6 +994,14 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) unsigned int ret; BOOL self; + TRACE("handle %p, exit_code %d, process_exiting %d.\n", handle, (int)exit_code, process_exiting); + + if (handle == GetCurrentProcess()) + { + terminate_process_running = TRUE; + terminate_process_exit_code = exit_code; + } + SERVER_START_REQ( terminate_process ) { req->handle = wine_server_obj_handle( handle ); @@ -1000,6 +1010,8 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) self = reply->self; } SERVER_END_REQ; + + TRACE("handle %p, self %d, process_exiting %d.\n", handle, self, process_exiting); if (self) { if (!handle) process_exiting = TRUE; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 684b3d52448..ea826a7e8dc 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2170,6 +2170,12 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, EXCEPTION_RECORD *rec, TRACE_(seh)( " r12=%016lx r13=%016lx r14=%016lx r15=%016lx\n", context->R12, context->R13, context->R14, context->R15 ); + if (terminate_process_running) + { + FIXME_(seh)( "Process is terminating, aborting.\n" ); + abort_process( terminate_process_exit_code ); + } + if (rec->ExceptionCode == STATUS_ACCESS_VIOLATION && is_inside_syscall_stack_guard( (char *)rec->ExceptionInformation[1] )) ERR_(seh)( "Syscall stack overrun.\n "); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index e731652561a..b09255e8dbd 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -170,6 +170,8 @@ extern const WCHAR system_dir[]; extern unsigned int supported_machines_count; extern USHORT supported_machines[8]; extern BOOL process_exiting; +extern BOOL terminate_process_running; +extern LONG terminate_process_exit_code; extern HANDLE keyed_event; extern timeout_t server_start_time; extern sigset_t server_block_set; From 988ed7cef7c734708b61bad84911486ed3107b7e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 1 May 2023 21:19:09 -0600 Subject: [PATCH 0798/1506] ntdll: HACK: Set thread teb earlier in start_main_thread(). CW-Bug-Id: #22218 --- dlls/ntdll/unix/loader.c | 3 +++ dlls/ntdll/unix/signal_i386.c | 6 ++++++ dlls/ntdll/unix/signal_x86_64.c | 4 ++++ dlls/ntdll/unix/unix_private.h | 1 + 4 files changed, 14 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 19d30b4f0d5..d3dea1b0dd1 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2138,6 +2138,9 @@ static void start_main_thread(void) virtual_map_user_shared_data(); init_cpu_info(); init_files(); + + set_thread_teb( teb ); + init_startup_info(); *(ULONG_PTR *)&peb->CloudFileFlags = get_image_address(); set_load_order_app_name( main_wargv[0] ); diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index eb40bda2d94..5b7d460372c 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -2393,6 +2393,12 @@ void signal_init_threading(void) #endif } +void set_thread_teb( TEB *teb ) +{ + struct x86_thread_data *thread_data = (struct x86_thread_data *)&teb->GdiTebBatch; + + ldt_set_fs( thread_data->fs, teb ); +} /********************************************************************** * signal_alloc_thread diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index ea826a7e8dc..63f732b45b4 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2814,6 +2814,10 @@ void signal_init_process(void) exit(1); } +void set_thread_teb( TEB *teb ) +{ + arch_prctl( ARCH_SET_GS, teb ); +} /*********************************************************************** * call_init_thunk diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index b09255e8dbd..5e4cfbd834b 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -288,6 +288,7 @@ extern BOOL get_thread_times( int unix_pid, int unix_tid, LARGE_INTEGER *kernel_ LARGE_INTEGER *user_time ); extern void signal_init_threading(void); extern NTSTATUS signal_alloc_thread( TEB *teb ); +extern void set_thread_teb( TEB *teb ); extern void signal_free_thread( TEB *teb ); extern void signal_init_process(void); extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg, From 20d7c6d6e0c2ad95b3dcec9b054893e888023c5d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 May 2023 17:23:40 -0600 Subject: [PATCH 0799/1506] ntdll: Do not inherit Unix std handles for files without a name. CW-Bug-Id: #22237 --- dlls/ntdll/unix/env.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index ff3f28d93e1..29f5aa2b17f 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1394,6 +1394,27 @@ static void add_registry_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size ) } } +static void get_std_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ) +{ + IO_STATUS_BLOCK io; + FILE_POSITION_INFORMATION pos_info; + FILE_NAME_INFORMATION name_info; + NTSTATUS status; + + wine_server_fd_to_handle( fd, access, attributes, handle ); + if (!*handle) return; + + /* Python checks if a file is seekable and if so expects the file name to be gettable from handle. */ + if (NtQueryInformationFile( *handle, &io, &pos_info, sizeof(pos_info), FilePositionInformation )) + return; + + TRACE("handle for fd %d is seekable.\n", fd); + if (!(status = NtQueryInformationFile( *handle, &io, &name_info, sizeof(name_info), FileNameInformation )) + || status == STATUS_BUFFER_OVERFLOW) return; + TRACE("closing handle for fd %d.\n", fd); + NtClose( *handle ); + *handle = NULL; +} /************************************************************************* * get_initial_console @@ -1404,9 +1425,9 @@ static void get_initial_console( RTL_USER_PROCESS_PARAMETERS *params ) { int output_fd = -1; - wine_server_fd_to_handle( 0, GENERIC_READ|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdInput ); - wine_server_fd_to_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdOutput ); - wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdError ); + get_std_handle( 0, GENERIC_READ|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdInput ); + get_std_handle( 1, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdOutput ); + get_std_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, ¶ms->hStdError ); if (main_image_info.SubSystemType != IMAGE_SUBSYSTEM_WINDOWS_CUI) return; From 84cc4a87f7ec8f4fe77217b6fbdf18509ae30ad5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 12 May 2023 19:22:44 -0600 Subject: [PATCH 0800/1506] ntdll: Add WINE_KERNEL_STACK_SIZE option. CW-Bug-Id: #22247 --- dlls/ntdll/unix/loader.c | 8 ++++++++ dlls/ntdll/unix/unix_private.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index d3dea1b0dd1..428c803fd45 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2022,6 +2022,7 @@ BOOL fsync_yield_to_waiters; BOOL no_priv_elevation; BOOL localsystem_sid; BOOL simulate_writecopy; +SIZE_T kernel_stack_size = 0x100000; static void hacks_init(void) { @@ -2098,6 +2099,13 @@ static void hacks_init(void) return; } + if ((env_str = getenv( "WINE_KERNEL_STACK_SIZE" ))) + kernel_stack_size = atoll( env_str ) * 1024; + else if (sgi && !strcmp( sgi, "702700" )) + kernel_stack_size = 200 * 1024; + if (kernel_stack_size != 0x100000) + ERR( "HACK: setting kernel_stack_size to %luKB.\n", (long)(kernel_stack_size / 1024) ); + if (sgi && (0 || !strcmp(sgi, "1364780") || !strcmp(sgi, "1952120") || !strcmp(sgi, "2154900") /* Street Fighter 6 */ || !strcmp(sgi, "1740720") /* Have a Nice Death */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 5e4cfbd834b..bcee4508b65 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -126,7 +126,7 @@ static const SIZE_T page_size = 0x1000; static const SIZE_T teb_size = 0x3800; /* TEB64 + TEB32 + debug info */ static const SIZE_T signal_stack_mask = 0xffff; static const SIZE_T signal_stack_size = 0x10000 - 0x3800; -static const SIZE_T kernel_stack_size = 0x100000; +extern SIZE_T kernel_stack_size; static const SIZE_T kernel_stack_guard_size = 0x1000; static const SIZE_T min_kernel_stack = 0x3000; static const LONG teb_offset = 0x2000; From 9c86a09614d5444cd55dedf8bf67bbddf658d4f4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 15 May 2023 19:00:02 -0600 Subject: [PATCH 0801/1506] wined3d: Avoid sysmem pinning streaming buffer. CW-Bug-Id: #22259 Currently that happens on _SOFTWARE_VERTEXPROCESSING devices and prevents _MAP_DISCARD and _MAP_NOOVERWRITE optimization. --- dlls/wined3d/buffer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 57c6085c10a..052ff32d850 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1369,7 +1369,7 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d access |= WINED3D_RESOURCE_ACCESS_MAP_W; if (FAILED(hr = resource_init(resource, device, WINED3D_RTYPE_BUFFER, format, - WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->bind_flags, access, + WINED3D_MULTISAMPLE_NONE, 0, desc->usage & ~WINED3DUSAGE_PRIVATE, desc->bind_flags, access, desc->byte_width, 1, 1, desc->byte_width, parent, parent_ops, &buffer_resource_ops))) { WARN("Failed to initialize resource, hr %#lx.\n", hr); @@ -1382,8 +1382,8 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d TRACE("buffer %p, size %#x, usage %#x, memory @ %p.\n", buffer, buffer->resource.size, buffer->resource.usage, buffer->resource.heap_memory); - if (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING - || (desc->usage & WINED3DUSAGE_MANAGED)) + if (!(desc->usage & WINED3DUSAGE_PRIVATE) && (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING + || (desc->usage & WINED3DUSAGE_MANAGED))) { /* SWvp and managed buffers always return the same pointer in buffer * maps and retain data in DISCARD maps. Keep a system memory copy of @@ -1760,7 +1760,7 @@ static HRESULT wined3d_streaming_buffer_prepare(struct wined3d_device *device, TRACE("Growing buffer to %u bytes.\n", size); desc.byte_width = size; - desc.usage = WINED3DUSAGE_DYNAMIC; + desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_PRIVATE; desc.bind_flags = buffer->bind_flags; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.misc_flags = 0; From 740b21bc1a72631289542a6b1f8fbeffb6d49a1e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 17 May 2023 21:08:23 -0600 Subject: [PATCH 0802/1506] kernelbase: HACK: Add WINE_SHRINK_ENV option. CW-Bug-Id: #22272 --- dlls/kernelbase/process.c | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 375a0f416a5..6c03d84ff3b 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -1723,6 +1723,59 @@ LPSTR WINAPI DECLSPEC_HOTPATCH GetEnvironmentStringsA(void) return ret; } +static void hack_shrink_environment( WCHAR *env, SIZE_T len ) +{ + static int enabled = -1; + static const char *skip[] = + { + "SteamGenericControllers=", + "STEAM_RUNTIME_LIBRARY_PATH=", + "SDL_GAMECONTROLLER_IGNORE_DEVICES=", + "SDL_GAMECONTROLLERCONFIG=", + "LD_LIBRARY_PATH=", + "ORIG_LD_LIBRARY_PATH=", + "LS_COLORS=", + "BASH_FUNC_", + "XDG_DATA_DIRS=", + }; + SIZE_T l; + unsigned int i, j; + + if (enabled == -1) + { + WCHAR str[40]; + + *str = 0; + if (GetEnvironmentVariableW( L"WINE_SHRINK_ENV", str, sizeof(str)) ) + enabled = *str != '0'; + else if (GetEnvironmentVariableW( L"SteamGameId", str, sizeof(str)) ) + enabled = !wcscmp( str, L"431590" ); + else + enabled = 0; + + if (enabled) + ERR( "HACK: shrinking environment size.\n" ); + } + + if (!enabled) return; + + while (*env) + { + for (i = 0; i < ARRAY_SIZE(skip); ++i) + { + j = 0; + while (skip[i][j] && skip[i][j] == env[j]) + ++j; + if (!skip[i][j]) break; + } + l = lstrlenW( env ); + len -= (l + 1) * sizeof(WCHAR); + if (i == ARRAY_SIZE(skip)) + env += l + 1; + else + memmove( env, env + l + 1, len ); + } +} /*********************************************************************** * GetEnvironmentStringsW (kernelbase.@) @@ -1735,7 +1788,10 @@ LPWSTR WINAPI DECLSPEC_HOTPATCH GetEnvironmentStringsW(void) RtlAcquirePebLock(); len = get_env_length( NtCurrentTeb()->Peb->ProcessParameters->Environment ) * sizeof(WCHAR); if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) + { memcpy( ret, NtCurrentTeb()->Peb->ProcessParameters->Environment, len ); + hack_shrink_environment( ret, len ); + } RtlReleasePebLock(); return ret; } From 5ea8346470c4a9d34fc6810959993dc52eb02d88 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 22 Sep 2022 15:48:40 -0500 Subject: [PATCH 0803/1506] msvcrt: HACK: Disable SSE2 support for Indiana Jones and The Emperor Tomb. CW-Bug-Id: #21330 --- dlls/msvcrt/math.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index a62705bc8f4..4318abde082 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -72,6 +72,15 @@ void msvcrt_init_math( void *module ) sse2_supported = IsProcessorFeaturePresent( PF_XMMI64_INSTRUCTIONS_AVAILABLE ); #if _MSVCR_VER <=71 sse2_enabled = FALSE; + { + char sgi[64]; + + if (GetEnvironmentVariableA("SteamGameId", sgi, sizeof(sgi)) && !strcmp(sgi, "560430")) + { + sse2_supported = FALSE; + FIXME("HACK: disabling sse2 support in msvcrt.\n"); + } + } #else sse2_enabled = sse2_supported; #endif From 50efce094e6fbcdf3571a3c18fe0c1dcb2a70b93 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 22 Sep 2022 15:50:33 -0500 Subject: [PATCH 0804/1506] msvcrt: HACK: Disable SSE2 support for DarkStar One. CW-Bug-Id: #21330 --- dlls/msvcrt/math.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 4318abde082..e86ee97f716 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -75,7 +75,8 @@ void msvcrt_init_math( void *module ) { char sgi[64]; - if (GetEnvironmentVariableA("SteamGameId", sgi, sizeof(sgi)) && !strcmp(sgi, "560430")) + if (GetEnvironmentVariableA("SteamGameId", sgi, sizeof(sgi)) + && (!strcmp(sgi, "560430") || !strcmp(sgi, "12330"))) { sse2_supported = FALSE; FIXME("HACK: disabling sse2 support in msvcrt.\n"); From 91d495491ef9b571193653cf112da5437433f25f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 31 May 2023 14:47:40 -0600 Subject: [PATCH 0805/1506] kernelbase: HACK: Force Angle Vulkan instead of GL for UplayWebCore. CW-Bug-Id: #22307 --- dlls/kernelbase/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 6c03d84ff3b..7601f2c4c01 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -593,7 +593,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) } options[] = { - {L"UplayWebCore.exe", L" --use-gl=swiftshader"}, + {L"UplayWebCore.exe", L" --use-angle=vulkan"}, {L"Paradox Launcher.exe", L" --use-angle=gl"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, From f5ab6e8a089750f04616df6194fcad1d0d6c49c3 Mon Sep 17 00:00:00 2001 From: Ziqing Hui Date: Wed, 22 Mar 2023 15:41:00 +0800 Subject: [PATCH 0806/1506] kernelbase: HACK: Force desktop GL for PaladinLias. CW-Bug-Id: #20816 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 7601f2c4c01..d5d1e25287f 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -602,6 +602,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"nw.exe.exe", L" --use-angle=d3d9"}, {L"DC Universe Online\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"PlanetSide 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, + {L"PaladinLias\\Game.exe", L" --use-gl=desktop"}, }; unsigned int i; From 95cc9265da54f4dc4cfdb6a4fbc22fb687d52f12 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 18 Aug 2023 18:44:58 -0600 Subject: [PATCH 0807/1506] ntdll: HACK: Enable vk_x11_override_min_image_count, vk_x11_strict_image_count for Rainbow Six Extraction. CW-Bug-Id: #22634 --- dlls/ntdll/unix/loader.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 428c803fd45..43e9d92a409 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2127,6 +2127,13 @@ static void hacks_init(void) ERR("HACK: setting LIBGL_ALWAYS_SOFTWARE.\n"); setenv("LIBGL_ALWAYS_SOFTWARE", "1", 0); } + + if (sgi && !strcmp(sgi, "2379390")) + { + ERR("HACK: setting vk_x11_override_min_image_count, vk_x11_strict_image_count.\n"); + setenv("vk_x11_override_min_image_count", "2", 0); + setenv("vk_x11_strict_image_count", "true", 0); + } } /*********************************************************************** From 645ee7bad9a130043bd87af4a4e6c5fdb5a37e74 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 11 Jul 2023 14:29:15 -0600 Subject: [PATCH 0808/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for Idol Hands 2. CW-Bug-Id: #22425 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 43e9d92a409..926ab20b7cd 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2090,6 +2090,7 @@ static void hacks_init(void) else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") /* Dawn of Corruption */ || !strcmp(sgi, "1680700") /* Purgo box */ || !strcmp(sgi, "2095300") /* Breakout 13 */ + || !strcmp(sgi, "2053940") /* Idol Hands 2 */ || !strcmp(sgi, "2176450"); /* Mr. Hopp's Playhouse 3 */ if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) From cc98a311f5c4f1ff3f38461817984991953c9692 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 21 Jul 2023 21:09:41 -0600 Subject: [PATCH 0809/1506] wine.inf: Set FLG_HEAP_ENABLE_FREE_CHECK for Chaos Code. CW-Bug-Id: #21739 --- loader/wine.inf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index e8755fdc16a..49c49142fd7 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -430,6 +430,8 @@ HKLM,%CurrentVersionNT%\Ports,,16 HKLM,%CurrentVersionNT%\Print,,16 HKLM,%CurrentVersionNT%\ProfileList,,16 HKLM,%CurrentVersionNT%\Winlogon,"Shell",,"explorer.exe" +;; App specific heap debug flags +HKLM,%CurrentVersionNT%\Image File Execution Options\ChaosCode.exe,GlobalFlag,0x00040002,0x00000020 [CurrentVersionWow64.ntamd64] HKLM,%CurrentVersion%,"ProgramFilesDir (x86)",,"%16426%" From 5daecd62ddda139dad8b8b4e1866ae331f43e92e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 3 Aug 2023 13:38:37 -0600 Subject: [PATCH 0810/1506] winex11.drv: Override GL vendor for Paradox Launcher. CW-Bug-Id: #22492 --- dlls/winex11.drv/opengl.c | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 93b79d914a8..082dd1d5ac1 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -37,6 +37,8 @@ #ifdef HAVE_SYS_UN_H #include #endif +#include +#include #include "x11drv.h" #include "xcomposite.h" @@ -3433,6 +3435,52 @@ static void wglFlush(void) static const GLubyte *wglGetString(GLenum name) { + static int override_vendor = -1; + if (override_vendor == -1) + { + int fd; + char buffer[4096], *env; + int sz; + + override_vendor = 0; + if ((env = getenv("WINE_GL_HIDE_NVIDIA"))) + { + override_vendor = env[0] != '0'; + } + else + { + fd = open("/proc/self/cmdline", O_RDONLY); + if (fd != -1) + { + if ((sz = read(fd, buffer, sizeof(buffer) - 1)) > 0) + { + buffer[sz] = 0; + if (strstr(buffer, "\\Paradox Launcher.exe")) + { + FIXME("HACK: overriding GL vendor and renderer.\n"); + override_vendor = 1; + } + } + close(fd); + } + } + } + if (override_vendor) + { + const GLubyte *s; + if (name == GL_RENDERER) + { + s = pglGetString(name); + if (s && strstr((const char *)s, "NVIDIA")) return (const GLubyte *)"AMD Radeon Graphics"; + return s; + } + else if (name == GL_VENDOR) + { + s = pglGetString(name); + if (s && strstr((const char *)s, "NVIDIA")) return (const GLubyte *)"AMD"; + return s; + } + } if (name == GL_EXTENSIONS && glExtensions) return (const GLubyte *)glExtensions; return pglGetString(name); } From 0963a3f26affe43c5d467f0497dfae039c8ff122 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 9 Aug 2023 16:05:55 -0600 Subject: [PATCH 0811/1506] nsiproxy.sys: HACK: Add an option to fake eth adapter presence. CW-Bug-Id: #22580 --- dlls/nsiproxy.sys/ndis.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c index 372272dd115..9e9bb8aaac2 100644 --- a/dlls/nsiproxy.sys/ndis.c +++ b/dlls/nsiproxy.sys/ndis.c @@ -105,6 +105,8 @@ struct if_entry static struct list if_list = LIST_INIT( if_list ); static pthread_mutex_t if_list_lock = PTHREAD_MUTEX_INITIALIZER; +static BOOL have_ethernet_iface; + static struct if_entry *find_entry_from_index( UINT index ) { struct if_entry *entry; @@ -275,7 +277,22 @@ static WCHAR *strdupAtoW( const char *str ) return ret; } -static struct if_entry *add_entry( UINT index, char *name ) +static int fake_ethernet_adapter(void) +{ + static int cached = -1; + + if (cached == -1) + { + const char *s; + if ((s = getenv( "WINE_FAKE_ETH_PRESENCE" ))) + cached = atoi( s ); + else + cached = (s = getenv( "SteamGameId" )) && !strcmp( s, "1293830" ); + } + return cached; +} + +static struct if_entry *add_entry( UINT index, const char *name ) { struct if_entry *entry; int name_len = strlen( name ); @@ -304,6 +321,10 @@ static struct if_entry *add_entry( UINT index, char *name ) memcpy( entry->if_guid.Data4 + 2, "NetDev", 6 ); list_add_tail( &if_list, &entry->entry ); + + if (entry->if_luid.Info.IfType == MIB_IF_TYPE_ETHERNET) + have_ethernet_iface = TRUE; + return entry; } @@ -311,6 +332,7 @@ static unsigned int update_if_table( void ) { struct if_nameindex *indices = if_nameindex(), *entry; unsigned int append_count = 0; + struct if_entry *if_entry; for (entry = indices; entry->if_index; entry++) { @@ -319,6 +341,14 @@ static unsigned int update_if_table( void ) } if_freenameindex( indices ); + + if (!have_ethernet_iface && fake_ethernet_adapter() && (if_entry = add_entry( 0xdeadbeef, "eth0faked" ))) + { + if_entry->if_type = if_entry->if_luid.Info.IfType = MIB_IF_TYPE_ETHERNET; + have_ethernet_iface = TRUE; + ++append_count; + } + return append_count; } From 8934f3a0f40917ad023b9b3b90e09927b9615053 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 21 Aug 2023 20:26:03 -0600 Subject: [PATCH 0812/1506] kernelbase: HACK: Try harder to force GL QtWebEngine rendering for EADesktop. CW-Bug-Id: #22640 --- dlls/kernelbase/process.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index d5d1e25287f..8b6e65b88b7 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -2002,6 +2002,16 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW( LPCWSTR name, LPCWSTR val len = lstrlenW(names[i]); if (size > len && !memcmp( module + size - len, names[i], len * sizeof(*module) )) { + HMODULE h = GetModuleHandleW(L"Qt5Core.dll"); + void (WINAPI *QCoreApplication_setAttribute)(int attr, BOOL set); + + QCoreApplication_setAttribute = (void *)GetProcAddress(h, "?setAttribute@QCoreApplication@@SAXW4ApplicationAttribute@Qt@@_N@Z"); + if (QCoreApplication_setAttribute) + { + QCoreApplication_setAttribute(16 /* AA_UseOpenGLES */, 0); + QCoreApplication_setAttribute(15 /* AA_UseDesktopOpenGL */, 1); + } + else ERR("QCoreApplication_setAttribute not found, h %p.\n", h); value = L"desktop"; FIXME( "HACK: setting QT_OPENGL=desktop.\n" ); break; From 965d7a5f89365b6a60a59a642903de11aeed7001 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 1 Aug 2023 09:09:37 -0600 Subject: [PATCH 0813/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for UplayWebCore. CW-Bug-Id: #22534 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 926ab20b7cd..8f96c84073b 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2087,6 +2087,7 @@ static void hacks_init(void) env_str = getenv("WINE_SIMULATE_WRITECOPY"); if (env_str) simulate_writecopy = atoi(env_str); + else if (main_argc > 1 && strstr(main_argv[1], "UplayWebCore.exe")) simulate_writecopy = TRUE; else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") /* Dawn of Corruption */ || !strcmp(sgi, "1680700") /* Purgo box */ || !strcmp(sgi, "2095300") /* Breakout 13 */ From 5776ded797ee4586a9636bb6a8c031337ed6b205 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 19 Jun 2023 17:50:33 -0600 Subject: [PATCH 0814/1506] ntdll: Reimplement NtSaveKey() on the client side. CW-Bug-Id: #22347 --- dlls/ntdll/unix/registry.c | 290 ++++++++++++++++++++++++++++++++++++- server/protocol.def | 14 +- server/registry.c | 124 +++++++++++++--- 3 files changed, 399 insertions(+), 29 deletions(-) diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c index e19414bfa86..88ad7e569a1 100644 --- a/dlls/ntdll/unix/registry.c +++ b/dlls/ntdll/unix/registry.c @@ -27,6 +27,8 @@ #include #include +#include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -68,6 +70,248 @@ NTSTATUS open_hkcu_key( const char *path, HANDLE *key ) return NtCreateKey( key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ); } +/* dump a Unicode string with proper escaping */ +int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2] ) +{ + static const char escapes[32] = ".......abtnvfr.............e...."; + char buffer[256]; + char *pos = buffer; + int count = 0; + + for (len /= sizeof(WCHAR); len; str++, len--) + { + if (pos > buffer + sizeof(buffer) - 8) + { + fwrite( buffer, pos - buffer, 1, f ); + count += pos - buffer; + pos = buffer; + } + if (*str > 127) /* hex escape */ + { + if (len > 1 && str[1] < 128 && isxdigit( (char)str[1] )) + pos += sprintf( pos, "\\x%04x", *str ); + else + pos += sprintf( pos, "\\x%x", *str ); + continue; + } + if (*str < 32) /* octal or C escape */ + { + if (!*str && len == 1) continue; /* do not output terminating NULL */ + if (escapes[*str] != '.') + pos += sprintf( pos, "\\%c", escapes[*str] ); + else if (len > 1 && str[1] >= '0' && str[1] <= '7') + pos += sprintf( pos, "\\%03o", *str ); + else + pos += sprintf( pos, "\\%o", *str ); + continue; + } + if (*str == '\\' || *str == escape[0] || *str == escape[1]) *pos++ = '\\'; + *pos++ = *str; + } + fwrite( buffer, pos - buffer, 1, f ); + count += pos - buffer; + return count; +} + +struct saved_key +{ + data_size_t namelen; + WCHAR *name; + data_size_t classlen; + WCHAR *class; + int value_count; + int subkey_count; + unsigned int is_symlink; + timeout_t modif; + struct saved_key *parent; +}; + +/* read serialized key data */ +static char *fill_saved_key( struct saved_key *key, struct saved_key *parent, char *data ) +{ + key->parent = parent; + key->namelen = *(data_size_t *)data; + data += sizeof(data_size_t); + key->name = (WCHAR *)data; + data += key->namelen; + key->classlen = *(data_size_t *)data; + data += sizeof(data_size_t); + key->class = (WCHAR *)data; + data += key->classlen; + key->value_count = *(int *)data; + data += sizeof(int); + key->subkey_count = *(int *)data; + data += sizeof(int); + key->is_symlink = *(unsigned int *)data; + data += sizeof(unsigned int); + key->modif = *(timeout_t *)data; + data += sizeof(timeout_t); + + return data; +} + +/* dump serialized key full path */ +static char *dump_parents( char *data, FILE *f, int count ) +{ + data_size_t len; + WCHAR *name; + + len = *(data_size_t *)data; + data += sizeof(data_size_t); + name = (WCHAR *)data; + data += len; + + if (count > 1) + { + data = dump_parents( data, f, count - 1); + fprintf( f, "\\\\" ); + } + dump_strW( name, len, f, "[]" ); + return data; +} + +/* dump the full path of a key */ +static void dump_path( const struct saved_key *key, const struct saved_key *base, FILE *f ) +{ + if (key->parent && key->parent != base) + { + dump_path( key->parent, base, f ); + fprintf( f, "\\\\" ); + } + dump_strW( key->name, key->namelen, f, "[]" ); +} + +/* dump a value to a text file */ +static char *dump_value( char *data, FILE *f ) +{ + unsigned int i, dw; + int count; + data_size_t namelen, valuelen; + char *valuedata; + WCHAR *name; + unsigned int type; + + namelen = *(data_size_t *)data; + data += sizeof(data_size_t); + name = (WCHAR *)data; + data += namelen; + type = *(unsigned int *)data; + data += sizeof(unsigned int); + valuelen = *(data_size_t *)data; + data += sizeof(data_size_t); + valuedata = data; + data += valuelen; + + if (namelen) + { + fputc( '\"', f ); + count = 1 + dump_strW( name, namelen, f, "\"\"" ); + count += fprintf( f, "\"=" ); + } + else count = fprintf( f, "@=" ); + + switch(type) + { + case REG_SZ: + case REG_EXPAND_SZ: + case REG_MULTI_SZ: + /* only output properly terminated strings in string format */ + if (valuelen < sizeof(WCHAR)) break; + if (valuelen % sizeof(WCHAR)) break; + if (((WCHAR *)valuedata)[valuelen / sizeof(WCHAR) - 1]) break; + if (type != REG_SZ) fprintf( f, "str(%x):", type ); + fputc( '\"', f ); + dump_strW( (WCHAR *)valuedata, valuelen, f, "\"\"" ); + fprintf( f, "\"\n" ); + return data; + + case REG_DWORD: + if (valuelen != sizeof(dw)) break; + memcpy( &dw, valuedata, sizeof(dw) ); + fprintf( f, "dword:%08x\n", dw ); + return data; + } + + if (type == REG_BINARY) count += fprintf( f, "hex:" ); + else count += fprintf( f, "hex(%x):", type ); + for (i = 0; i < valuelen; i++) + { + count += fprintf( f, "%02x", *((unsigned char *)valuedata + i) ); + if (i < valuelen-1) + { + fputc( ',', f ); + if (++count > 76) + { + fprintf( f, "\\\n " ); + count = 2; + } + } + } + fputc( '\n', f ); + return data; +} + +/* save a registry key and all its subkeys to a text file */ +static char *save_subkeys( char *data, struct saved_key *parent, struct saved_key *base, FILE *f ) +{ + struct saved_key key; + int i; + + if (!base) base = &key; + data = fill_saved_key( &key, parent, data ); + + /* save key if it has either some values or no subkeys, or needs special options */ + /* keys with no values but subkeys are saved implicitly by saving the subkeys */ + if ((key.value_count > 0) || !key.subkey_count || key.classlen || key.is_symlink) + { + fprintf( f, "\n[" ); + if (parent) dump_path( &key, base, f ); + fprintf( f, "] %u\n", (unsigned int)((key.modif - SECS_1601_TO_1970 * TICKSPERSEC) / TICKSPERSEC) ); + fprintf( f, "#time=%x%08x\n", (unsigned int)(key.modif >> 32), (unsigned int)key.modif ); + if (key.classlen) + { + fprintf( f, "#class=\"" ); + dump_strW( key.class, key.classlen, f, "\"\"" ); + fprintf( f, "\"\n" ); + } + if (key.is_symlink) fputs( "#link\n", f ); + for (i = 0; i < key.value_count; i++) data = dump_value( data, f ); + } + for (i = 0; i < key.subkey_count; i++) data = save_subkeys( data, &key, base, f ); + return data; +} + +/* save a registry branch to a file */ +static void save_all_subkeys( char *data, FILE *f ) +{ + enum prefix_type prefix_type; + int parent_count; + + prefix_type = *(int *)data; + data += sizeof(int); + + parent_count = *(int *)data; + data += sizeof(int); + + fprintf( f, "WINE REGISTRY Version 2\n" ); + fprintf( f, ";; All keys relative to " ); + data = dump_parents( data, f, parent_count ); + fprintf( f, "\n" ); + + switch (prefix_type) + { + case PREFIX_32BIT: + fprintf( f, "\n#arch=win32\n" ); + break; + case PREFIX_64BIT: + fprintf( f, "\n#arch=win64\n" ); + break; + default: + break; + } + save_subkeys( data, NULL, NULL, f ); +} + /****************************************************************************** * NtCreateKey (NTDLL.@) @@ -791,17 +1035,53 @@ NTSTATUS WINAPI NtUnloadKey( OBJECT_ATTRIBUTES *attr ) */ NTSTATUS WINAPI NtSaveKey( HANDLE key, HANDLE file ) { + data_size_t size = 0; unsigned int ret; + char *data = NULL; + int fd, fd2, needs_close = 0; + FILE *f; TRACE( "(%p,%p)\n", key, file ); - SERVER_START_REQ( save_registry ) + while (1) { - req->hkey = wine_server_obj_handle( key ); - req->file = wine_server_obj_handle( file ); - ret = wine_server_call( req ); + SERVER_START_REQ( save_registry ) + { + req->hkey = wine_server_obj_handle( key ); + if (size) wine_server_set_reply( req, data, size ); + ret = wine_server_call( req ); + size = reply->total; + } + SERVER_END_REQ; + + if (!ret) break; + free( data ); + if (ret != STATUS_BUFFER_TOO_SMALL) return ret; + if (!(data = malloc( size ))) + { + ERR( "No memory.\n" ); + return STATUS_NO_MEMORY; + } } - SERVER_END_REQ; + + if ((ret = server_get_unix_fd( file, FILE_WRITE_DATA, &fd, &needs_close, NULL, NULL ))) goto done; + if ((fd2 = dup( fd )) == -1) + { + ret = errno_to_status( errno ); + goto done; + } + if (!(f = fdopen( fd2, "w" ))) + { + close( fd2 ); + ret = errno_to_status( errno ); + goto done; + } + save_all_subkeys( data, f ); + if (fclose(f)) ret = errno_to_status( errno ); + +done: + if (needs_close) close( fd ); + free( data ); return ret; } diff --git a/server/protocol.def b/server/protocol.def index a82eec95c80..a0c7540a2ff 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1988,11 +1988,19 @@ struct process_info @END -/* Save a registry branch to a file */ +/* Return full registry branch non-volatile data for saving */ @REQ(save_registry) - obj_handle_t hkey; /* key to save */ - obj_handle_t file; /* file to save to */ + obj_handle_t hkey; /* key to save */ +@REPLY + data_size_t total; /* total length needed for data */ + VARARG(data,bytes); /* registry data */ @END +enum prefix_type +{ + PREFIX_UNKNOWN, + PREFIX_32BIT, + PREFIX_64BIT, +}; /* Add a registry key change notification */ diff --git a/server/registry.c b/server/registry.c index 5bd196be10d..a25c15bbcf3 100644 --- a/server/registry.c +++ b/server/registry.c @@ -124,7 +124,7 @@ static struct key *root_key; static const timeout_t ticks_1601_to_1970 = (timeout_t)86400 * (369 * 365 + 89) * TICKS_PER_SEC; static const timeout_t save_period = 30 * -TICKS_PER_SEC; /* delay between periodic saves */ static struct timeout_user *save_timeout_user; /* saving timer */ -static enum prefix_type { PREFIX_UNKNOWN, PREFIX_32BIT, PREFIX_64BIT } prefix_type; +static enum prefix_type prefix_type; static const WCHAR wow6432node[] = {'W','o','w','6','4','3','2','N','o','d','e'}; static const WCHAR symlink_value[] = {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e'}; @@ -2021,29 +2021,104 @@ static void save_all_subkeys( struct key *key, FILE *f ) save_subkeys( key, key, f ); } -/* save a registry branch to a file handle */ -static void save_registry( struct key *key, obj_handle_t handle ) +static data_size_t serialize_value( const struct key_value *value, char *buf ) { - struct file *file; - int fd; + data_size_t size; - if (!(file = get_file_obj( current->process, handle, FILE_WRITE_DATA ))) return; - fd = dup( get_file_unix_fd( file ) ); - release_object( file ); - if (fd != -1) + size = sizeof(data_size_t) + value->namelen + sizeof(unsigned int) + sizeof(data_size_t) + value->len; + if (!buf) return size; + + *(data_size_t *)buf = value->namelen; + buf += sizeof(data_size_t); + memcpy( buf, value->name, value->namelen ); + buf += value->namelen; + + *(unsigned int *)buf = value->type; + buf += sizeof(unsigned int); + + *(data_size_t *)buf = value->len; + buf += sizeof(data_size_t); + memcpy( buf, value->data, value->len ); + + return size; +} + +/* save a registry key with subkeys to a buffer */ +static data_size_t serialize_key( const struct key *key, char *buf ) +{ + data_size_t size; + int subkey_count, i; + + if (key->flags & KEY_VOLATILE) return 0; + + size = sizeof(data_size_t) + key->obj.name->len + sizeof(data_size_t) + key->classlen + sizeof(int) + sizeof(int) + + sizeof(unsigned int) + sizeof(timeout_t); + for (i = 0; i <= key->last_value; i++) + size += serialize_value( &key->values[i], buf ? buf + size : NULL ); + subkey_count = 0; + for (i = 0; i <= key->last_subkey; i++) { - FILE *f = fdopen( fd, "w" ); - if (f) - { - save_all_subkeys( key, f ); - if (fclose( f )) file_set_error(); - } - else - { - file_set_error(); - close( fd ); - } + if (key->subkeys[i]->flags & KEY_VOLATILE) continue; + size += serialize_key( key->subkeys[i], buf ? buf + size : NULL ); + ++subkey_count; + } + if (!buf) return size; + + *(data_size_t *)buf = key->obj.name->len; + buf += sizeof(data_size_t); + memcpy( buf, key->obj.name->name, key->obj.name->len ); + buf += key->obj.name->len; + + *(data_size_t *)buf = key->classlen; + buf += sizeof(data_size_t); + memcpy( buf, key->class, key->classlen ); + buf += key->classlen; + + *(int *)buf = key->last_value + 1; + buf += sizeof(int); + + *(int *)buf = subkey_count; + buf += sizeof(int); + + *(unsigned int *)buf = key->flags & KEY_SYMLINK; + buf += sizeof(unsigned int); + + *(timeout_t *)buf = key->modif; + + return size; +} + +/* save registry branch to buffer */ +static data_size_t save_registry( const struct key *key, char *buf ) +{ + int *parent_count = NULL; + const struct key *parent; + data_size_t size; + + size = sizeof(int) + sizeof(int); + if (buf) + { + *(int *)buf = prefix_type; + buf += sizeof(int); + parent_count = (int *)buf; + buf += sizeof(int); + *parent_count = 0; } + + parent = key; + do + { + size += sizeof(data_size_t) + parent->obj.name->len; + if (!buf) continue; + ++*parent_count; + *(data_size_t *)buf = parent->obj.name->len; + buf += sizeof(data_size_t); + memcpy( buf, parent->obj.name->name, parent->obj.name->len ); + buf += parent->obj.name->len; + } while ((parent = get_parent( parent ))); + + size += serialize_key( key, buf ); + return size; } /* save a registry branch to a file */ @@ -2370,6 +2445,7 @@ DECL_HANDLER(unload_registry) DECL_HANDLER(save_registry) { struct key *key; + char *data; if (!thread_single_check_privilege( current, SeBackupPrivilege )) { @@ -2379,7 +2455,13 @@ DECL_HANDLER(save_registry) if ((key = get_hkey_obj( req->hkey, 0 ))) { - save_registry( key, req->file ); + reply->total = save_registry( key, NULL ); + if (reply->total <= get_reply_max_size()) + { + if ((data = set_reply_data_size( reply->total ))) + save_registry( key, data ); + } + else set_error( STATUS_BUFFER_TOO_SMALL ); release_object( key ); } } From a0be13d87c9d7a57b12988eaa86bef9d3b394004 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 20 Jun 2023 11:54:06 -0600 Subject: [PATCH 0815/1506] ntdll: Implement NtFlushKey(). CW-Bug-Id: #22347 --- dlls/ntdll/unix/registry.c | 155 +++++++++++++++++++++++++++++++++++-- server/protocol.def | 12 +++ server/registry.c | 94 ++++++++++++++++++++-- 3 files changed, 247 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c index 88ad7e569a1..492dd00d67a 100644 --- a/dlls/ntdll/unix/registry.c +++ b/dlls/ntdll/unix/registry.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -282,8 +284,9 @@ static char *save_subkeys( char *data, struct saved_key *parent, struct saved_ke } /* save a registry branch to a file */ -static void save_all_subkeys( char *data, FILE *f ) +static char *save_all_subkeys( char *data, FILE *f ) { + /* Output registry format should match server/registry.c:save_all_subkeys(). */ enum prefix_type prefix_type; int parent_count; @@ -309,7 +312,7 @@ static void save_all_subkeys( char *data, FILE *f ) default: break; } - save_subkeys( data, NULL, NULL, f ); + return save_subkeys( data, NULL, NULL, f ); } @@ -916,22 +919,162 @@ NTSTATUS WINAPI NtNotifyChangeKey( HANDLE key, HANDLE event, PIO_APC_ROUTINE apc io, filter, subtree, buffer, length, async ); } +/* acquire mutex for registry flush operation */ +static HANDLE get_key_flush_mutex(void) +{ + WCHAR bufferW[256]; + UNICODE_STRING name = {.Buffer = bufferW}; + OBJECT_ATTRIBUTES attr; + char buffer[256]; + HANDLE mutex; + + snprintf( buffer, ARRAY_SIZE(buffer), "\\Sessions\\%u\\BaseNamedObjects\\__wine_regkey_flush", + (int)NtCurrentTeb()->Peb->SessionId ); + name.Length = name.MaximumLength = (strlen(buffer) + 1) * sizeof(WCHAR); + ascii_to_unicode( bufferW, buffer, name.Length / sizeof(WCHAR) ); + + InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL ); + if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return NULL; + NtWaitForSingleObject( mutex, FALSE, NULL ); + return mutex; +} + +/* release registry flush mutex */ +static void release_key_flush_mutex( HANDLE mutex ) +{ + NtReleaseMutant( mutex, NULL ); + NtClose( mutex ); +} + +/* save registry branch to Wine regsitry storage file */ +static NTSTATUS save_registry_branch( char **data ) +{ + static const char temp_fn[] = "savereg.tmp"; + char *file_name, *path = NULL, *tmp = NULL; + int file_name_len, path_len, fd; + struct stat st; + NTSTATUS ret; + FILE *f; + + file_name_len = *(int *)*data; + *data += sizeof(int); + file_name = *data; + *data += file_name_len; + + path_len = strlen( config_dir ) + 1 + file_name_len + 1; + if (!(path = malloc( path_len ))) return STATUS_NO_MEMORY; + sprintf( path, "%s/%s", config_dir, file_name ); + + if ((fd = open( path, O_WRONLY )) != -1) + { + /* if file is not a regular file or has multiple links or is accessed + * via symbolic links, write directly into it; otherwise use a temp file */ + if (!lstat( path, &st ) && (!S_ISREG(st.st_mode) || st.st_nlink > 1)) + { + ftruncate( fd, 0 ); + goto save; + } + close( fd ); + } + + /* create a temp file in the same directory */ + if (!(tmp = malloc( strlen( config_dir ) + 1 + strlen( temp_fn ) + 1 ))) + { + ret = STATUS_NO_MEMORY; + goto done; + } + sprintf( tmp, "%s/%s", config_dir, temp_fn ); + + if ((fd = open( tmp, O_CREAT | O_EXCL | O_WRONLY, 0666 )) == -1) + { + ret = errno_to_status( errno ); + goto done; + } + +save: + if (!(f = fdopen( fd, "w" ))) + { + ret = errno_to_status( errno ); + if (tmp) unlink( tmp ); + close( fd ); + goto done; + } + + *data = save_all_subkeys( *data, f ); + + ret = fclose( f ) ? errno_to_status( errno ) : STATUS_SUCCESS; + if (tmp) + { + if (!ret && rename( tmp, path )) ret = errno_to_status( errno ); + if (ret) unlink( tmp ); + } + +done: + free( tmp ); + free( path ); + return ret; +} /****************************************************************************** * NtFlushKey (NTDLL.@) */ NTSTATUS WINAPI NtFlushKey( HANDLE key ) { + abstime_t timestamp_counter; + data_size_t size = 0; unsigned int ret; + char *data = NULL, *curr_data; + HANDLE mutex; + int i, branch_count, branch; TRACE( "key=%p\n", key ); - SERVER_START_REQ( flush_key ) + mutex = get_key_flush_mutex(); + + while (1) { - req->hkey = wine_server_obj_handle( key ); - ret = wine_server_call( req ); + SERVER_START_REQ( flush_key ) + { + req->hkey = wine_server_obj_handle( key ); + if (size) wine_server_set_reply( req, data, size ); + ret = wine_server_call( req ); + size = reply->total; + branch_count = reply->branch_count; + timestamp_counter = reply->timestamp_counter; + } + SERVER_END_REQ; + + if (ret != STATUS_BUFFER_TOO_SMALL) break; + free( data ); + if (!(data = malloc( size ))) + { + ERR( "No memory.\n" ); + ret = STATUS_NO_MEMORY; + goto done; + } } - SERVER_END_REQ; + if (ret) goto done; + + curr_data = data; + for (i = 0; i < branch_count; ++i) + { + branch = *(int *)curr_data; + curr_data += sizeof(int); + if ((ret = save_registry_branch( &curr_data ))) goto done; + + SERVER_START_REQ( flush_key_done ) + { + req->branch = branch; + req->timestamp_counter = timestamp_counter; + ret = wine_server_call( req ); + } + SERVER_END_REQ; + if (ret) break; + } + +done: + release_key_flush_mutex( mutex ); + free( data ); return ret; } diff --git a/server/protocol.def b/server/protocol.def index a0c7540a2ff..5d238ba7503 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1908,6 +1908,18 @@ struct process_info /* Flush a registry key */ @REQ(flush_key) obj_handle_t hkey; /* handle to the key */ +@REPLY + abstime_t timestamp_counter; /* branch last change timestamp counter */ + data_size_t total; /* total length needed for data */ + int branch_count; /* number of registry branches to flush */ + VARARG(data,bytes); /* registry data */ +@END + + +/* Clear KEY_DIRTY after key flush */ +@REQ(flush_key_done) + abstime_t timestamp_counter; /* timestamp counter returned from flush_key */ + int branch; /* saved registry branch id */ @END diff --git a/server/registry.c b/server/registry.c index a25c15bbcf3..021bbae75f9 100644 --- a/server/registry.c +++ b/server/registry.c @@ -90,6 +90,7 @@ struct key unsigned int flags; /* flags */ timeout_t modif; /* last modification time */ struct list notify_list; /* list of notifications */ + abstime_t timestamp_counter; /* timestamp counter at last change */ }; /* key flags */ @@ -118,6 +119,8 @@ struct key_value #define MAX_NAME_LEN 256 /* max. length of a key name */ #define MAX_VALUE_LEN 16383 /* max. length of a value name */ +static abstime_t change_timestamp_counter; + /* the root of the registry tree */ static struct key *root_key; @@ -710,6 +713,7 @@ static struct key *create_key_object( struct object *parent, const struct unicod key->last_value = -1; key->values = NULL; key->modif = modif; + key->timestamp_counter = 0; list_init( &key->notify_list ); if (options & REG_OPTION_CREATE_LINK) key->flags |= KEY_SYMLINK; @@ -730,23 +734,25 @@ static struct key *create_key_object( struct object *parent, const struct unicod /* mark a key and all its parents as dirty (modified) */ static void make_dirty( struct key *key ) { + ++change_timestamp_counter; while (key) { if (key->flags & (KEY_DIRTY|KEY_VOLATILE)) return; /* nothing to do */ key->flags |= KEY_DIRTY; + key->timestamp_counter = change_timestamp_counter; key = get_parent( key ); } } /* mark a key and all its subkeys as clean (not modified) */ -static void make_clean( struct key *key ) +static void make_clean( struct key *key, abstime_t timestamp_counter ) { int i; if (key->flags & KEY_VOLATILE) return; if (!(key->flags & KEY_DIRTY)) return; - key->flags &= ~KEY_DIRTY; - for (i = 0; i <= key->last_subkey; i++) make_clean( key->subkeys[i] ); + if (key->timestamp_counter <= timestamp_counter) key->flags &= ~KEY_DIRTY; + for (i = 0; i <= key->last_subkey; i++) make_clean( key->subkeys[i], timestamp_counter ); } /* go through all the notifications and send them if necessary */ @@ -2003,6 +2009,7 @@ void init_registry(void) /* save a registry branch to a file */ static void save_all_subkeys( struct key *key, FILE *f ) { + /* Registry format in ntdll/registry.c:save_all_subkeys() should match. */ fprintf( f, "WINE REGISTRY Version 2\n" ); fprintf( f, ";; All keys relative to " ); dump_path( key, NULL, f ); @@ -2191,7 +2198,7 @@ static int save_branch( struct key *key, const char *path ) done: free( tmp ); - if (ret) make_clean( key ); + if (ret) make_clean( key, key->timestamp_counter ); return ret; } @@ -2239,6 +2246,36 @@ static int is_wow64_thread( struct thread *thread ) return (is_machine_64bit( native_machine ) && !is_machine_64bit( thread->process->machine )); } +/* find all the branches inside the specified key or the branch containing the key */ +static void find_branches_for_key( struct key *key, int *branches, int *branch_count ) +{ + struct key *k; + int i; + + *branch_count = 0; + for (i = 0; i < save_branch_count; i++) + { + k = save_branch_info[i].key; + while ((k = get_parent(k))) + { + if (k != key) continue; + branches[(*branch_count)++] = i; + break; + } + } + + if (*branch_count) return; + + do + { + for (i = 0; i < save_branch_count; i++) + { + if(key != save_branch_info[i].key) continue; + branches[(*branch_count)++] = i; + return; + } + } while ((key = get_parent( key ))); +} /* create a registry key */ DECL_HANDLER(create_key) @@ -2303,15 +2340,56 @@ DECL_HANDLER(delete_key) } } -/* flush a registry key */ +/* return registry branches snaphot data for flushing key */ DECL_HANDLER(flush_key) { struct key *key = get_hkey_obj( req->hkey, 0 ); - if (key) + int branches[3], branch_count = 0, i, path_len; + char *data; + + if (!key) return; + + reply->total = 0; + reply->branch_count = 0; + if ((key->flags & KEY_DIRTY) && !(key->flags & KEY_VOLATILE)) + find_branches_for_key( key, branches, &branch_count ); + release_object( key ); + + reply->timestamp_counter = change_timestamp_counter; + for (i = 0; i < branch_count; ++i) { - /* we don't need to do anything here with the current implementation */ - release_object( key ); + if (!(save_branch_info[branches[i]].key->flags & KEY_DIRTY)) continue; + ++reply->branch_count; + path_len = strlen( save_branch_info[branches[i]].path ) + 1; + reply->total += sizeof(int) + sizeof(int) + path_len + save_registry( save_branch_info[branches[i]].key, NULL ); + } + if (reply->total > get_reply_max_size()) + { + set_error( STATUS_BUFFER_TOO_SMALL ); + return; } + + if (!(data = set_reply_data_size( reply->total ))) return; + + for (i = 0; i < branch_count; ++i) + { + if (!(save_branch_info[branches[i]].key->flags & KEY_DIRTY)) continue; + *(int *)data = branches[i]; + data += sizeof(int); + path_len = strlen( save_branch_info[branches[i]].path ) + 1; + *(int *)data = path_len; + data += sizeof(int); + memcpy( data, save_branch_info[branches[i]].path, path_len ); + data += path_len; + data += save_registry( save_branch_info[branches[i]].key, data ); + } +} + +/* clear dirty state after successful registry branch flush */ +DECL_HANDLER(flush_key_done) +{ + if (req->branch < save_branch_count) make_clean( save_branch_info[req->branch].key, req->timestamp_counter ); + else set_error( STATUS_INVALID_PARAMETER ); } /* enumerate registry subkeys */ From 9c53ba5a5d44f68f7aaf7d48a0b4c3be3e86ed3c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 20 Jun 2023 12:17:36 -0600 Subject: [PATCH 0816/1506] mountmgr.sys: Perform periodic registry flush instead of server. CW-Bug-Id: #22347 --- dlls/mountmgr.sys/mountmgr.c | 22 ++++++++++++++++++++++ server/registry.c | 26 -------------------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index ad3c034fe0f..05dbaf9f7d2 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -609,6 +609,27 @@ static DWORD WINAPI run_loop_thread( void *arg ) return MOUNTMGR_CALL( run_loop, ¶ms ); } +static DWORD WINAPI registry_flush_thread( void *arg ) +{ + UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\Registry" ); + OBJECT_ATTRIBUTES attr; + HANDLE root; + + InitializeObjectAttributes( &attr, &name, 0, 0, NULL ); + if (NtOpenKeyEx( &root, MAXIMUM_ALLOWED, &attr, 0 )) + { + ERR( "Failed opening root registry key.\n" ); + return 0; + } + + for (;;) + { + Sleep( 30000 ); + if (NtFlushKey( root )) ERR( "Failed flushing registry.\n" ); + } + + return 0; +} /* main entry point for the mount point manager driver */ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) @@ -652,6 +673,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) thread = CreateThread( NULL, 0, device_op_thread, NULL, 0, NULL ); CloseHandle( CreateThread( NULL, 0, run_loop_thread, thread, 0, NULL )); + CloseHandle( CreateThread( NULL, 0, registry_flush_thread, thread, 0, NULL )); #ifdef _WIN64 /* create a symlink so that the Wine port overrides key can be edited with 32-bit reg or regedit */ diff --git a/server/registry.c b/server/registry.c index 021bbae75f9..2baf9e40839 100644 --- a/server/registry.c +++ b/server/registry.c @@ -125,15 +125,12 @@ static abstime_t change_timestamp_counter; static struct key *root_key; static const timeout_t ticks_1601_to_1970 = (timeout_t)86400 * (369 * 365 + 89) * TICKS_PER_SEC; -static const timeout_t save_period = 30 * -TICKS_PER_SEC; /* delay between periodic saves */ -static struct timeout_user *save_timeout_user; /* saving timer */ static enum prefix_type prefix_type; static const WCHAR wow6432node[] = {'W','o','w','6','4','3','2','N','o','d','e'}; static const WCHAR symlink_value[] = {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e'}; static const struct unicode_str symlink_str = { symlink_value, sizeof(symlink_value) }; -static void set_periodic_save_timer(void); static struct key_value *find_value( const struct key *key, const struct unicode_str *name, int *index ); /* information about where to save a registry branch */ @@ -1984,9 +1981,6 @@ void init_registry(void) release_object( hklm ); release_object( hkcu ); - /* start the periodic save timer */ - set_periodic_save_timer(); - /* create windows directories */ if (!mkdir( "drive_c/windows", 0777 )) @@ -2202,26 +2196,6 @@ static int save_branch( struct key *key, const char *path ) return ret; } -/* periodic saving of the registry */ -static void periodic_save( void *arg ) -{ - int i; - - if (fchdir( config_dir_fd ) == -1) return; - save_timeout_user = NULL; - for (i = 0; i < save_branch_count; i++) - save_branch( save_branch_info[i].key, save_branch_info[i].path ); - if (fchdir( server_dir_fd ) == -1) fatal_error( "chdir to server dir: %s\n", strerror( errno )); - set_periodic_save_timer(); -} - -/* start the periodic save timer */ -static void set_periodic_save_timer(void) -{ - if (save_timeout_user) remove_timeout_user( save_timeout_user ); - save_timeout_user = add_timeout_user( save_period, periodic_save, NULL ); -} - /* save the modified registry branches to disk */ void flush_registry(void) { From e0981e129041084d1727b73a2757044f0c17bcc1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Jun 2023 15:30:13 -0600 Subject: [PATCH 0817/1506] rsaenh: Store keys as volatile for SF6. CW-Bug-Id: #22347 --- dlls/rsaenh/rsaenh.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index 3a2d7126ca4..3e4646a9517 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -1211,9 +1211,20 @@ static void store_key_permissions(HCRYPTKEY hCryptKey, HKEY hKey, DWORD dwKeySpe */ static BOOL create_container_key(KEYCONTAINER *pKeyContainer, REGSAM sam, HKEY *phKey) { + static DWORD key_options = ~0ul; CHAR szRSABase[sizeof(RSAENH_REGKEY) + MAX_PATH]; HKEY hRootKey; + if (key_options == ~0ul) + { + const char *sgi; + + if ((sgi = getenv("SteamGameId")) && !strcmp(sgi, "1364780")) + key_options = REG_OPTION_VOLATILE; + else + key_options = REG_OPTION_NON_VOLATILE; + } + sprintf(szRSABase, RSAENH_REGKEY, pKeyContainer->szName); if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) @@ -1224,7 +1235,7 @@ static BOOL create_container_key(KEYCONTAINER *pKeyContainer, REGSAM sam, HKEY * /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ return RegCreateKeyExA(hRootKey, szRSABase, 0, NULL, - REG_OPTION_NON_VOLATILE, sam, NULL, phKey, NULL) + key_options, sam, NULL, phKey, NULL) == ERROR_SUCCESS; } From 6186e2aef7c2b847624f6ac9875a921388f3f243 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Fri, 1 Sep 2023 00:54:36 +0200 Subject: [PATCH 0818/1506] kernelbase: HACK: Add --use-gl=swiftshader for EverQuest 2/LaunchPad.exe. CW-Bug-Id: #18509 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 8b6e65b88b7..2628ffaf19c 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -603,6 +603,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"DC Universe Online\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"PlanetSide 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"PaladinLias\\Game.exe", L" --use-gl=desktop"}, + {L"EverQuest 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, }; unsigned int i; From 1fa14c3dea8ce6bdf778859c8f12d93af18b7e11 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 17 Apr 2014 16:07:46 -0600 Subject: [PATCH 0819/1506] server: Unify the storage of security attributes for files and directories. (try 7) CW-Bug-Id: #22436 --- server/change.c | 45 ++++++--------------------------------------- server/file.c | 34 ++++++++++++++++++++++------------ server/file.h | 2 ++ 3 files changed, 30 insertions(+), 51 deletions(-) diff --git a/server/change.c b/server/change.c index 22cf041ca80..f9f3df88616 100644 --- a/server/change.c +++ b/server/change.c @@ -366,48 +366,15 @@ static int dir_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info ) { struct dir *dir = (struct dir *)obj; - const struct sid *owner; - struct stat st; - mode_t mode; - int unix_fd; + struct fd *fd; + int ret; assert( obj->ops == &dir_ops ); - unix_fd = get_dir_unix_fd( dir ); - - if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) return 1; - - if (set_info & OWNER_SECURITY_INFORMATION) - { - owner = sd_get_owner( sd ); - if (!owner) - { - set_error( STATUS_INVALID_SECURITY_DESCR ); - return 0; - } - if (!obj->sd || !equal_sid( owner, sd_get_owner( obj->sd ) )) - { - /* FIXME: get Unix uid and call fchown */ - } - } - else if (obj->sd) - owner = sd_get_owner( obj->sd ); - else - owner = token_get_owner( current->process->token ); - - if (set_info & DACL_SECURITY_INFORMATION) - { - /* keep the bits that we don't map to access rights in the ACL */ - mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); - mode |= sd_to_mode( sd, owner ); - - if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1) - { - file_set_error(); - return 0; - } - } - return 1; + fd = dir_get_fd( obj ); + ret = set_file_sd( obj, fd, &dir->mode, &dir->uid, sd, set_info ); + release_object( fd ); + return ret; } static struct change_record *get_first_change_record( struct dir *dir ) diff --git a/server/file.c b/server/file.c index bea0d09f9de..5bbdd210a37 100644 --- a/server/file.c +++ b/server/file.c @@ -500,18 +500,13 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner return new_mode; } -static int file_set_sd( struct object *obj, const struct security_descriptor *sd, - unsigned int set_info ) +int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid, + const struct security_descriptor *sd, unsigned int set_info ) { - struct file *file = (struct file *)obj; + int unix_fd = get_unix_fd( fd ); const struct sid *owner; struct stat st; - mode_t mode; - int unix_fd; - - assert( obj->ops == &file_ops ); - - unix_fd = get_file_unix_fd( file ); + mode_t new_mode; if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) return 1; @@ -538,10 +533,10 @@ static int file_set_sd( struct object *obj, const struct security_descriptor *sd if (set_info & DACL_SECURITY_INFORMATION) { /* keep the bits that we don't map to access rights in the ACL */ - mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); - mode |= sd_to_mode( sd, owner ); + new_mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); + new_mode |= sd_to_mode( sd, owner ); - if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1) + if (((st.st_mode ^ new_mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, new_mode ) == -1) { file_set_error(); return 0; @@ -586,6 +581,21 @@ static struct list *file_get_kernel_obj_list( struct object *obj ) return &file->kernel_object; } +static int file_set_sd( struct object *obj, const struct security_descriptor *sd, + unsigned int set_info ) +{ + struct file *file = (struct file *)obj; + struct fd *fd; + int ret; + + assert( obj->ops == &file_ops ); + + fd = file_get_fd( obj ); + ret = set_file_sd( obj, fd, &file->mode, &file->uid, sd, set_info ); + release_object( fd ); + return ret; +} + static void file_destroy( struct object *obj ) { struct file *file = (struct file *)obj; diff --git a/server/file.h b/server/file.h index f89ee4ea8af..a77fb447f3f 100644 --- a/server/file.h +++ b/server/file.h @@ -178,6 +178,8 @@ extern void file_set_error(void); extern struct security_descriptor *mode_to_sd( mode_t mode, const struct sid *user, const struct sid *group ); extern mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner ); extern int is_file_executable( const char *name ); +extern int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid, + const struct security_descriptor *sd, unsigned int set_info ); /* file mapping functions */ From ae67664239416403f67248ed6808748a08d9bc48 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 17 Apr 2014 16:07:50 -0600 Subject: [PATCH 0820/1506] server: Unify the retrieval of security attributes for files and directories. (try 7) CW-Bug-Id: #22436 --- server/change.c | 32 +++++--------------------------- server/file.c | 32 +++++++++++++++++++++----------- server/file.h | 2 ++ 3 files changed, 28 insertions(+), 38 deletions(-) diff --git a/server/change.c b/server/change.c index f9f3df88616..030d93cb4c9 100644 --- a/server/change.c +++ b/server/change.c @@ -326,39 +326,17 @@ static struct fd *dir_get_fd( struct object *obj ) return (struct fd *)grab_object( dir->fd ); } -static int get_dir_unix_fd( struct dir *dir ) -{ - return get_unix_fd( dir->fd ); -} - static struct security_descriptor *dir_get_sd( struct object *obj ) { struct dir *dir = (struct dir *)obj; - int unix_fd; - struct stat st; struct security_descriptor *sd; - assert( obj->ops == &dir_ops ); - - unix_fd = get_dir_unix_fd( dir ); - - if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) - return obj->sd; - - /* mode and uid the same? if so, no need to re-generate security descriptor */ - if (obj->sd && - (st.st_mode & (S_IRWXU|S_IRWXO)) == (dir->mode & (S_IRWXU|S_IRWXO)) && - (st.st_uid == dir->uid)) - return obj->sd; + struct fd *fd; - sd = mode_to_sd( st.st_mode, - security_unix_uid_to_sid( st.st_uid ), - token_get_primary_group( current->process->token )); - if (!sd) return obj->sd; + assert( obj->ops == &dir_ops ); - dir->mode = st.st_mode; - dir->uid = st.st_uid; - free( obj->sd ); - obj->sd = sd; + fd = dir_get_fd( obj ); + sd = get_file_sd( obj, fd, &dir->mode, &dir->uid ); + release_object( fd ); return sd; } diff --git a/server/file.c b/server/file.c index 5bbdd210a37..0b51b9d3a2f 100644 --- a/server/file.c +++ b/server/file.c @@ -390,23 +390,19 @@ struct security_descriptor *mode_to_sd( mode_t mode, const struct sid *user, con return sd; } -static struct security_descriptor *file_get_sd( struct object *obj ) +struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode_t *mode, + uid_t *uid ) { - struct file *file = (struct file *)obj; + int unix_fd = get_unix_fd( fd ); struct stat st; - int unix_fd; struct security_descriptor *sd; - assert( obj->ops == &file_ops ); - - unix_fd = get_file_unix_fd( file ); - if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) return obj->sd; /* mode and uid the same? if so, no need to re-generate security descriptor */ - if (obj->sd && (st.st_mode & (S_IRWXU|S_IRWXO)) == (file->mode & (S_IRWXU|S_IRWXO)) && - (st.st_uid == file->uid)) + if (obj->sd && (st.st_mode & (S_IRWXU|S_IRWXO)) == (*mode & (S_IRWXU|S_IRWXO)) && + (st.st_uid == *uid)) return obj->sd; sd = mode_to_sd( st.st_mode, @@ -414,13 +410,27 @@ static struct security_descriptor *file_get_sd( struct object *obj ) token_get_primary_group( current->process->token )); if (!sd) return obj->sd; - file->mode = st.st_mode; - file->uid = st.st_uid; + *mode = st.st_mode; + *uid = st.st_uid; free( obj->sd ); obj->sd = sd; return sd; } +static struct security_descriptor *file_get_sd( struct object *obj ) +{ + struct file *file = (struct file *)obj; + struct security_descriptor *sd; + struct fd *fd; + + assert( obj->ops == &file_ops ); + + fd = file_get_fd( obj ); + sd = get_file_sd( obj, fd, &file->mode, &file->uid ); + release_object( fd ); + return sd; +} + static mode_t file_access_to_mode( unsigned int access ) { mode_t mode = 0; diff --git a/server/file.h b/server/file.h index a77fb447f3f..5346402bfe8 100644 --- a/server/file.h +++ b/server/file.h @@ -180,6 +180,8 @@ extern mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid extern int is_file_executable( const char *name ); extern int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid, const struct security_descriptor *sd, unsigned int set_info ); +extern struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode_t *mode, + uid_t *uid ); /* file mapping functions */ From 50f3e62484005b800353e391879a77e962e815e3 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 30 Mar 2015 12:32:34 +0200 Subject: [PATCH 0821/1506] server: Add a helper function set_sd_from_token_internal to merge two security descriptors. CW-Bug-Id: #22436 --- server/object.c | 59 +++++++++++++++++++++++++++++++------------------ server/object.h | 3 +++ 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/server/object.c b/server/object.c index 89e541ffb6b..29f1ea96129 100644 --- a/server/object.c +++ b/server/object.c @@ -548,8 +548,9 @@ struct security_descriptor *default_get_sd( struct object *obj ) return obj->sd; } -int set_sd_defaults_from_token( struct object *obj, const struct security_descriptor *sd, - unsigned int set_info, struct token *token ) +struct security_descriptor *set_sd_from_token_internal( const struct security_descriptor *sd, + const struct security_descriptor *old_sd, + unsigned int set_info, struct token *token ) { struct security_descriptor new_sd, *new_sd_ptr; int present; @@ -558,8 +559,6 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri struct acl *replaced_sacl = NULL; char *ptr; - if (!set_info) return 1; - new_sd.control = sd->control & ~SE_SELF_RELATIVE; if (set_info & OWNER_SECURITY_INFORMATION && sd->owner_len) @@ -567,10 +566,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri owner = sd_get_owner( sd ); new_sd.owner_len = sd->owner_len; } - else if (obj->sd && obj->sd->owner_len) + else if (old_sd && old_sd->owner_len) { - owner = sd_get_owner( obj->sd ); - new_sd.owner_len = obj->sd->owner_len; + owner = sd_get_owner( old_sd ); + new_sd.owner_len = old_sd->owner_len; } else if (token) { @@ -584,10 +583,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri group = sd_get_group( sd ); new_sd.group_len = sd->group_len; } - else if (obj->sd && obj->sd->group_len) + else if (old_sd && old_sd->group_len) { - group = sd_get_group( obj->sd ); - new_sd.group_len = obj->sd->group_len; + group = sd_get_group( old_sd ); + new_sd.group_len = old_sd->group_len; } else if (token) { @@ -605,20 +604,20 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri else if (set_info & LABEL_SECURITY_INFORMATION && present) { const struct acl *old_sacl = NULL; - if (obj->sd && obj->sd->control & SE_SACL_PRESENT) old_sacl = sd_get_sacl( obj->sd, &present ); - if (!(replaced_sacl = replace_security_labels( old_sacl, sacl ))) return 0; + if (old_sd && old_sd->control & SE_SACL_PRESENT) old_sacl = sd_get_sacl( old_sd, &present ); + if (!(replaced_sacl = replace_security_labels( old_sacl, sacl ))) return NULL; new_sd.control |= SE_SACL_PRESENT; new_sd.sacl_len = replaced_sacl->size; sacl = replaced_sacl; } else { - if (obj->sd) sacl = sd_get_sacl( obj->sd, &present ); + if (old_sd) sacl = sd_get_sacl( old_sd, &present ); - if (obj->sd && present) + if (old_sd && present) { new_sd.control |= SE_SACL_PRESENT; - new_sd.sacl_len = obj->sd->sacl_len; + new_sd.sacl_len = old_sd->sacl_len; } else new_sd.sacl_len = 0; @@ -632,12 +631,12 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri } else { - if (obj->sd) dacl = sd_get_dacl( obj->sd, &present ); + if (old_sd) dacl = sd_get_dacl( old_sd, &present ); - if (obj->sd && present) + if (old_sd && present) { new_sd.control |= SE_DACL_PRESENT; - new_sd.dacl_len = obj->sd->dacl_len; + new_sd.dacl_len = old_sd->dacl_len; } else if (token) { @@ -653,7 +652,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri if (!ptr) { free( replaced_sacl ); - return 0; + return NULL; } new_sd_ptr = (struct security_descriptor*)ptr; @@ -668,9 +667,25 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri memcpy( ptr, dacl, new_sd.dacl_len ); free( replaced_sacl ); - free( obj->sd ); - obj->sd = new_sd_ptr; - return 1; + return new_sd_ptr; +} + +int set_sd_defaults_from_token( struct object *obj, const struct security_descriptor *sd, + unsigned int set_info, struct token *token ) +{ + struct security_descriptor *new_sd; + + if (!set_info) return 1; + + new_sd = set_sd_from_token_internal( sd, obj->sd, set_info, token ); + if (new_sd) + { + free( obj->sd ); + obj->sd = new_sd; + return 1; + } + + return 0; } /** Set the security descriptor using the current primary token for defaults. */ diff --git a/server/object.h b/server/object.h index c482b8ceeef..3b405e36db0 100644 --- a/server/object.h +++ b/server/object.h @@ -175,6 +175,9 @@ extern struct fd *no_get_fd( struct object *obj ); extern unsigned int default_map_access( struct object *obj, unsigned int access ); extern struct security_descriptor *default_get_sd( struct object *obj ); extern int default_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info ); +extern struct security_descriptor *set_sd_from_token_internal( const struct security_descriptor *sd, + const struct security_descriptor *old_sd, + unsigned int set_info, struct token *token ); extern int set_sd_defaults_from_token( struct object *obj, const struct security_descriptor *sd, unsigned int set_info, struct token *token ); extern WCHAR *no_get_full_name( struct object *obj, data_size_t *ret_len ); From b69289cb2b28f6c680fd1f400e4ffa441953526d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 30 Mar 2015 12:50:21 +0200 Subject: [PATCH 0822/1506] server: Temporarily store the full security descriptor for file objects. CW-Bug-Id: #22436 --- dlls/advapi32/tests/security.c | 16 ++---- server/change.c | 8 ++- server/file.c | 100 +++++++++++++++++++++------------ server/file.h | 3 +- 4 files changed, 80 insertions(+), 47 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 9057c300995..353ae61427b 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3774,7 +3774,6 @@ static void test_CreateDirectoryA(void) ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %ld\n", error); bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); ok(bret, "GetAclInformation failed\n"); - todo_wine ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n", acl_size.AceCount); LocalFree(pSD); @@ -3785,7 +3784,6 @@ static void test_CreateDirectoryA(void) ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %ld\n", error); bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); ok(bret, "GetAclInformation failed\n"); - todo_wine ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%ld != 0).\n", acl_size.AceCount); LocalFree(pSD); @@ -3908,7 +3906,6 @@ static void test_CreateDirectoryA(void) ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n", error); bret = GetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); ok(bret, "GetAclInformation failed\n"); - todo_wine ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%d != 0).\n", acl_size.AceCount); LocalFree(pSD); @@ -5043,23 +5040,22 @@ static void test_GetSecurityInfo(void) bret = GetAce(pDacl, 0, (VOID **)&ace); ok(bret, "Failed to get Current User ACE.\n"); bret = EqualSid(&ace->SidStart, user_sid); - todo_wine ok(bret, "Current User ACE (%s) != Current User SID (%s).\n", - debugstr_sid(&ace->SidStart), debugstr_sid(user_sid)); + ok(bret, "Current User ACE (%s) != Current User SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(user_sid)); ok(((ACE_HEADER *)ace)->AceFlags == 0, "Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); - ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%lx != 0x1f01ff)\n", - ace->Mask); + todo_wine ok(ace->Mask == 0x1f01ff, + "Current User ACE has unexpected mask (0x%lx != 0x1f01ff)\n", ace->Mask); } if (acl_size.AceCount > 1) { bret = GetAce(pDacl, 1, (VOID **)&ace); ok(bret, "Failed to get Administators Group ACE.\n"); bret = EqualSid(&ace->SidStart, admin_sid); - todo_wine ok(bret, "Administators Group ACE (%s) != Administators Group SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(admin_sid)); + ok(bret, "Administators Group ACE (%s) != Administators Group SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(admin_sid)); ok(((ACE_HEADER *)ace)->AceFlags == 0, "Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); - ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%lx != 0x1f01ff)\n", - ace->Mask); + todo_wine ok(ace->Mask == 0x1f01ff, + "Administators Group ACE has unexpected mask (0x%lx != 0x1f01ff)\n", ace->Mask); } LocalFree(pSD); CloseHandle(obj); diff --git a/server/change.c b/server/change.c index 030d93cb4c9..8a97b66409d 100644 --- a/server/change.c +++ b/server/change.c @@ -1080,7 +1080,8 @@ static void dir_add_to_existing_notify( struct dir *dir ) #endif /* HAVE_SYS_INOTIFY_H */ -struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode ) +struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode, + const struct security_descriptor *sd ) { struct dir *dir; @@ -1100,6 +1101,11 @@ struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode ) dir->client_process = NULL; set_fd_user( fd, &dir_fd_ops, &dir->obj ); + if (sd) dir_set_sd( &dir->obj, sd, OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION | + SACL_SECURITY_INFORMATION ); + dir_add_to_existing_notify( dir ); return &dir->obj; diff --git a/server/file.c b/server/file.c index 0b51b9d3a2f..2db89ae19f9 100644 --- a/server/file.c +++ b/server/file.c @@ -189,7 +189,8 @@ struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigne return file; } -static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_t mode ) +static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_t mode, + const struct security_descriptor *sd ) { struct file *file = alloc_object( &file_ops ); @@ -201,6 +202,12 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_ list_init( &file->kernel_object ); grab_object( fd ); set_fd_user( fd, &file_fd_ops, &file->obj ); + + if (sd) file_set_sd( &file->obj, sd, OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION | + SACL_SECURITY_INFORMATION ); + return &file->obj; } @@ -273,11 +280,11 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si if (!fd) goto done; if (S_ISDIR(mode)) - obj = create_dir_obj( fd, access, mode ); + obj = create_dir_obj( fd, access, mode, sd ); else if (S_ISCHR(mode) && is_serial_fd( fd )) obj = create_serial( fd ); else - obj = create_file_obj( fd, access, mode ); + obj = create_file_obj( fd, access, mode, sd ); release_object( fd ); @@ -513,46 +520,66 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid, const struct security_descriptor *sd, unsigned int set_info ) { + struct security_descriptor *new_sd; int unix_fd = get_unix_fd( fd ); - const struct sid *owner; + const struct sid *owner, *group; struct stat st; mode_t new_mode; - if (unix_fd == -1 || fstat( unix_fd, &st ) == -1) return 1; + if (!set_info || unix_fd == -1 || fstat( unix_fd, &st ) == -1) return 1; + if (!obj->sd) get_file_sd( obj, fd, mode, uid ); - if (set_info & OWNER_SECURITY_INFORMATION) - { - owner = sd_get_owner( sd ); - if (!owner) - { - set_error( STATUS_INVALID_SECURITY_DESCR ); - return 0; - } - if (!obj->sd || !equal_sid( owner, sd_get_owner( obj->sd ) )) - { - /* FIXME: get Unix uid and call fchown */ - } - } - else if (obj->sd) - owner = sd_get_owner( obj->sd ); - else - owner = token_get_owner( current->process->token ); + /* calculate the new sd, save to a temporary variable before assigning */ + new_sd = set_sd_from_token_internal( sd, obj->sd, set_info, current->process->token ); + if (new_sd) + { + if (set_info & OWNER_SECURITY_INFORMATION) + { + owner = sd_get_owner( new_sd ); + assert( owner ); - /* group and sacl not supported */ + if (!obj->sd || !equal_sid( owner, sd_get_owner( obj->sd ) )) + { + /* FIXME: get Unix uid and call fchown */ + } + } - if (set_info & DACL_SECURITY_INFORMATION) - { - /* keep the bits that we don't map to access rights in the ACL */ - new_mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); - new_mode |= sd_to_mode( sd, owner ); + if (set_info & GROUP_SECURITY_INFORMATION) + { + group = sd_get_group( new_sd ); + assert( group ); - if (((st.st_mode ^ new_mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, new_mode ) == -1) + if (!obj->sd || !equal_sid( group, sd_get_group( obj->sd ) )) + { + /* FIXME: get Unix uid and call fchown */ + } + } + + if (set_info & DACL_SECURITY_INFORMATION) { - file_set_error(); - return 0; - } - } - return 1; + owner = sd_get_owner( new_sd ); + assert( owner ); + + /* keep the bits that we don't map to access rights in the ACL */ + new_mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX); + new_mode |= sd_to_mode( new_sd, owner ); + + if (((st.st_mode ^ new_mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, new_mode ) == -1) + { + free( new_sd ); + file_set_error(); + return 0; + } + + *mode = (*mode & S_IFMT) | new_mode; + } + + free( obj->sd ); + obj->sd = new_sd; + return 1; + } + + return 0; } static struct object *file_lookup_name( struct object *obj, struct unicode_str *name, @@ -692,7 +719,10 @@ DECL_HANDLER(create_file) if ((file = create_file( root_fd, name, name_len, nt_name, req->access, req->sharing, req->create, req->options, req->attrs, sd ))) { - reply->handle = alloc_handle( current->process, file, req->access, objattr->attributes ); + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, file, req->access, objattr->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, file, req->access, objattr->attributes ); release_object( file ); } if (root_fd) release_object( root_fd ); diff --git a/server/file.h b/server/file.h index 5346402bfe8..7374eab536d 100644 --- a/server/file.h +++ b/server/file.h @@ -221,7 +221,8 @@ extern struct object *create_unix_device( struct object *root, const struct unic extern void do_change_notify( int unix_fd ); extern void sigio_callback(void); -extern struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode ); +extern struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode, + const struct security_descriptor *sd ); extern struct dir *get_dir_obj( struct process *process, obj_handle_t handle, unsigned int access ); /* completion */ From dbf4128a80713049cb91d933637181779d866446 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Mon, 30 Mar 2015 13:04:23 +0200 Subject: [PATCH 0823/1506] server: Store file security attributes with extended file attributes. (v8) CW-Bug-Id: #22436 --- server/file.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/server/file.c b/server/file.c index 2db89ae19f9..6214858bca3 100644 --- a/server/file.c +++ b/server/file.c @@ -31,11 +31,21 @@ #include #include #include +#include #include #ifdef HAVE_UTIME_H #include #endif #include +#ifdef HAVE_ATTR_XATTR_H +#undef XATTR_ADDITIONAL_OPTIONS +#include +#elif defined(HAVE_SYS_XATTR_H) +#include +#endif +#ifdef HAVE_SYS_EXTATTR_H +#include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -63,6 +73,21 @@ struct type_descr file_type = }, }; +#ifndef XATTR_USER_PREFIX +#define XATTR_USER_PREFIX "user." +#endif +#ifndef XATTR_SIZE_MAX +#define XATTR_SIZE_MAX 65536 +#endif + +/* We intentionally do not match the Samba 4 extended attribute for NT security descriptors (SDs): + * 1) Samba stores this information using an internal data structure (we use a flat NT SD). + * 2) Samba uses the attribute "security.NTACL". This attribute is within a namespace that only + * the administrator has write access to, which prohibits the user from copying the attributes + * when copying a file and would require Wine to run with adminstrative privileges. + */ +#define WINE_XATTR_SD XATTR_USER_PREFIX "wine.sd" + struct file { struct object obj; /* object header */ @@ -217,6 +242,56 @@ int is_file_executable( const char *name ) return len >= 4 && (!strcasecmp( name + len - 4, ".exe") || !strcasecmp( name + len - 4, ".com" )); } +#ifdef HAVE_SYS_EXTATTR_H +static inline int xattr_valid_namespace( const char *name ) +{ + if (strncmp( XATTR_USER_PREFIX, name, XATTR_USER_PREFIX_LEN ) != 0) + { + errno = EPERM; + return 0; + } + return 1; +} +#endif + +static int xattr_fset( int filedes, const char *name, void *value, size_t size ) +{ +#if defined(XATTR_ADDITIONAL_OPTIONS) + return fsetxattr( filedes, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) + return fsetxattr( filedes, name, value, size, 0 ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_set_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); +#else + errno = ENOSYS; + return -1; +#endif +} + +static void set_xattr_sd( int fd, const struct security_descriptor *sd ) +{ + char buffer[XATTR_SIZE_MAX]; + int present, len; + const struct acl *dacl; + + /* there's no point in storing the security descriptor if there's no DACL */ + if (!sd) return; + dacl = sd_get_dacl( sd, &present ); + if (!present || !dacl) return; + + len = 2 + sizeof(struct security_descriptor) + sd->owner_len + + sd->group_len + sd->sacl_len + sd->dacl_len; + if (len > XATTR_SIZE_MAX) return; + + /* include the descriptor revision and resource manager control bits */ + buffer[0] = SECURITY_DESCRIPTOR_REVISION; + buffer[1] = 0; + memcpy( &buffer[2], sd, len - 2 ); + xattr_fset( fd, WINE_XATTR_SD, buffer, len ); +} + static struct object *create_file( struct fd *root, const char *nameptr, data_size_t len, struct unicode_str nt_name, unsigned int access, unsigned int sharing, int create, @@ -574,6 +649,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid, *mode = (*mode & S_IFMT) | new_mode; } + /* extended attributes are set after the file mode, to ensure it stays in sync */ + set_xattr_sd( unix_fd, new_sd ); + free( obj->sd ); obj->sd = new_sd; return 1; From 33cd190c6ec9c0615d62df964736f21c86326fc7 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 18 Apr 2014 14:05:32 -0600 Subject: [PATCH 0824/1506] server: Convert return of file security masks with generic access mappings. (try 7) CW-Bug-Id: #22436 --- dlls/advapi32/tests/security.c | 6 +++--- server/file.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 353ae61427b..890ee5df610 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -5043,8 +5043,8 @@ static void test_GetSecurityInfo(void) ok(bret, "Current User ACE (%s) != Current User SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(user_sid)); ok(((ACE_HEADER *)ace)->AceFlags == 0, "Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); - todo_wine ok(ace->Mask == 0x1f01ff, - "Current User ACE has unexpected mask (0x%lx != 0x1f01ff)\n", ace->Mask); + ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%lx != 0x1f01ff)\n", + ace->Mask); } if (acl_size.AceCount > 1) { @@ -5054,7 +5054,7 @@ static void test_GetSecurityInfo(void) ok(bret, "Administators Group ACE (%s) != Administators Group SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(admin_sid)); ok(((ACE_HEADER *)ace)->AceFlags == 0, "Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); - todo_wine ok(ace->Mask == 0x1f01ff, + ok(ace->Mask == 0x1f01ff, "Administators Group ACE has unexpected mask (0x%lx != 0x1f01ff)\n", ace->Mask); } LocalFree(pSD); diff --git a/server/file.c b/server/file.c index 6214858bca3..fe1d09ed819 100644 --- a/server/file.c +++ b/server/file.c @@ -472,6 +472,26 @@ struct security_descriptor *mode_to_sd( mode_t mode, const struct sid *user, con return sd; } +/* Convert generic rights into standard access rights */ +static void convert_generic_sd( struct security_descriptor *sd ) +{ + const struct acl *dacl; + int present; + + dacl = sd_get_dacl( sd, &present ); + if (present && dacl) + { + const struct ace *ace = (const struct ace *)(dacl + 1); + ULONG i; + + for (i = 0; i < dacl->count; i++, ace = ace_next( ace )) + { + DWORD *mask = (DWORD *)(ace + 1); + *mask = map_access( *mask, &file_type.mapping ); + } + } +} + struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid ) { @@ -608,6 +628,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid, new_sd = set_sd_from_token_internal( sd, obj->sd, set_info, current->process->token ); if (new_sd) { + /* convert generic rights into standard access rights */ + convert_generic_sd( new_sd ); + if (set_info & OWNER_SECURITY_INFORMATION) { owner = sd_get_owner( new_sd ); From 7b6a901c9d207f1269ea99206c473b481f8d54ee Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 18 Apr 2014 14:01:35 -0600 Subject: [PATCH 0825/1506] server: Retrieve file security attributes with extended file attributes. (try 7) CW-Bug-Id: #22436 --- dlls/advapi32/tests/security.c | 19 ++++++------- server/file.c | 50 ++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 890ee5df610..a2f8c6574cb 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3728,7 +3728,7 @@ static void test_CreateDirectoryA(void) } ok(!error, "GetNamedSecurityInfo failed with error %ld\n", error); test_inherited_dacl(pDacl, admin_sid, user_sid, OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE, - 0x1f01ff, FALSE, TRUE, FALSE, __LINE__); + 0x1f01ff, FALSE, FALSE, FALSE, __LINE__); LocalFree(pSD); /* Test inheritance of ACLs in CreateFile without security descriptor */ @@ -4182,21 +4182,20 @@ static void test_GetNamedSecurityInfoA(void) bret = GetAce(pDacl, 0, (VOID **)&ace); ok(bret, "Failed to get Current User ACE.\n"); bret = EqualSid(&ace->SidStart, user_sid); - todo_wine ok(bret, "Current User ACE (%s) != Current User SID (%s).\n", - debugstr_sid(&ace->SidStart), debugstr_sid(user_sid)); + ok(bret, "Current User ACE (%s) != Current User SID (%s).\n", + debugstr_sid(&ace->SidStart), debugstr_sid(user_sid)); ok(((ACE_HEADER *)ace)->AceFlags == 0, "Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); - ok(ace->Mask == 0x1f01ff, "Current User ACE has unexpected mask (0x%lx != 0x1f01ff)\n", - ace->Mask); + ok(ace->Mask == 0x1f01ff, + "Current User ACE has unexpected mask (0x%lx != 0x1f01ff)\n", ace->Mask); } if (acl_size.AceCount > 1) { bret = GetAce(pDacl, 1, (VOID **)&ace); ok(bret, "Failed to get Administators Group ACE.\n"); bret = EqualSid(&ace->SidStart, admin_sid); - todo_wine ok(bret || broken(!bret) /* win2k */, - "Administators Group ACE (%s) != Administators Group SID (%s).\n", - debugstr_sid(&ace->SidStart), debugstr_sid(admin_sid)); + ok(bret || broken(!bret) /* win2k */, "Administators Group ACE (%s) != Administators Group SID (%s).\n", + debugstr_sid(&ace->SidStart), debugstr_sid(admin_sid)); ok(((ACE_HEADER *)ace)->AceFlags == 0, "Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags); ok(ace->Mask == 0x1f01ff || broken(ace->Mask == GENERIC_ALL) /* win2k */, @@ -4223,8 +4222,8 @@ static void test_GetNamedSecurityInfoA(void) { bret = GetAce(pDacl, 0, (VOID **)&ace); ok(bret, "Failed to get ACE.\n"); - todo_wine ok(((ACE_HEADER *)ace)->AceFlags & INHERITED_ACE, - "ACE has unexpected flags: 0x%x\n", ((ACE_HEADER *)ace)->AceFlags); + ok(((ACE_HEADER *)ace)->AceFlags & INHERITED_ACE, + "ACE has unexpected flags: 0x%x\n", ((ACE_HEADER *)ace)->AceFlags); } LocalFree(pSD); diff --git a/server/file.c b/server/file.c index fe1d09ed819..6da354af245 100644 --- a/server/file.c +++ b/server/file.c @@ -44,6 +44,7 @@ #include #endif #ifdef HAVE_SYS_EXTATTR_H +#undef XATTR_ADDITIONAL_OPTIONS #include #endif @@ -76,6 +77,9 @@ struct type_descr file_type = #ifndef XATTR_USER_PREFIX #define XATTR_USER_PREFIX "user." #endif +#ifndef XATTR_USER_PREFIX_LEN +#define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1) +#endif #ifndef XATTR_SIZE_MAX #define XATTR_SIZE_MAX 65536 #endif @@ -254,6 +258,22 @@ static inline int xattr_valid_namespace( const char *name ) } #endif +static int xattr_fget( int filedes, const char *name, void *value, size_t size ) +{ +#if defined(XATTR_ADDITIONAL_OPTIONS) + return fgetxattr( filedes, name, value, size, 0, 0 ); +#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H) + return fgetxattr( filedes, name, value, size ); +#elif defined(HAVE_SYS_EXTATTR_H) + if (!xattr_valid_namespace( name )) return -1; + return extattr_get_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN], + value, size ); +#else + errno = ENOSYS; + return -1; +#endif +} + static int xattr_fset( int filedes, const char *name, void *value, size_t size ) { #if defined(XATTR_ADDITIONAL_OPTIONS) @@ -492,6 +512,29 @@ static void convert_generic_sd( struct security_descriptor *sd ) } } +static struct security_descriptor *get_xattr_sd( int fd ) +{ + struct security_descriptor *sd; + char buffer[XATTR_SIZE_MAX]; + int n; + + n = xattr_fget( fd, WINE_XATTR_SD, buffer, sizeof(buffer) ); + if (n == -1 || n < 2 + sizeof(struct security_descriptor)) return NULL; + + /* validate that we can handle the descriptor */ + if (buffer[0] != SECURITY_DESCRIPTOR_REVISION || buffer[1] != 0 || + !sd_is_valid( (struct security_descriptor *)&buffer[2], n - 2 )) + return NULL; + + sd = mem_alloc( n - 2 ); + if (sd) + { + memcpy( sd, &buffer[2], n - 2 ); + convert_generic_sd( sd ); /* for backwards compatibility */ + } + return sd; +} + struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid ) { @@ -507,9 +550,10 @@ struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode (st.st_uid == *uid)) return obj->sd; - sd = mode_to_sd( st.st_mode, - security_unix_uid_to_sid( st.st_uid ), - token_get_primary_group( current->process->token )); + sd = get_xattr_sd( unix_fd ); + if (!sd) sd = mode_to_sd( st.st_mode, + security_unix_uid_to_sid( st.st_uid ), + token_get_primary_group( current->process->token )); if (!sd) return obj->sd; *mode = st.st_mode; From 4cd5885624be7ac6c9eec48a3e076014c2ba2de0 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Tue, 12 Sep 2023 12:06:15 +0200 Subject: [PATCH 0826/1506] kernelbase: HACK: Add --use-gl=swiftshader for Everquest F2P/LaunchPad.exe. CW-Bug-Id: #18509 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 2628ffaf19c..fdb0f133342 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -604,6 +604,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"PlanetSide 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"PaladinLias\\Game.exe", L" --use-gl=desktop"}, {L"EverQuest 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, + {L"Everquest F2P\\LaunchPad.exe", L" --use-gl=swiftshader"}, }; unsigned int i; From 8fccbe8b51c8eb3ae02533704d07fffa64f039e4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Sep 2023 15:13:10 -0600 Subject: [PATCH 0827/1506] kernelbase, winex11.drv: HACK: Add --use-angle=gl for Red Tie Runner. And override Nvidia in GL so that works on Nvidia. CW-Bug-Id: #22742 --- dlls/kernelbase/process.c | 1 + dlls/winex11.drv/opengl.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index fdb0f133342..9f9301d8de7 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -605,6 +605,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"PaladinLias\\Game.exe", L" --use-gl=desktop"}, {L"EverQuest 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"Everquest F2P\\LaunchPad.exe", L" --use-gl=swiftshader"}, + {L"Red Tie Runner.exe", L" --use-angle=gl"}, }; unsigned int i; diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 082dd1d5ac1..387428d673a 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -3455,7 +3455,7 @@ static const GLubyte *wglGetString(GLenum name) if ((sz = read(fd, buffer, sizeof(buffer) - 1)) > 0) { buffer[sz] = 0; - if (strstr(buffer, "\\Paradox Launcher.exe")) + if (strstr(buffer, "\\Paradox Launcher.exe") || strstr(buffer, "Red Tie Runner.exe")) { FIXME("HACK: overriding GL vendor and renderer.\n"); override_vendor = 1; From 8b111b55549b8797ca4faa187027e5e5fd29e741 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Sep 2023 15:16:10 -0600 Subject: [PATCH 0828/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for Red Tie Runner. CW-Bug-Id: #22742 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 8f96c84073b..994413c1658 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2092,6 +2092,7 @@ static void hacks_init(void) || !strcmp(sgi, "1680700") /* Purgo box */ || !strcmp(sgi, "2095300") /* Breakout 13 */ || !strcmp(sgi, "2053940") /* Idol Hands 2 */ + || !strcmp(sgi, "391150") /* Red Tie Runner */ || !strcmp(sgi, "2176450"); /* Mr. Hopp's Playhouse 3 */ if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) From e32d27591edeea3e653ccabe1503c2c5379aff45 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 20 Sep 2023 15:45:43 -0600 Subject: [PATCH 0829/1506] wine.inf: Set FLG_HEAP_ENABLE_FREE_CHECK for Crysis 2 Remastered. CW-Bug-Id: #22761 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 49c49142fd7..732e997787b 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -432,6 +432,7 @@ HKLM,%CurrentVersionNT%\ProfileList,,16 HKLM,%CurrentVersionNT%\Winlogon,"Shell",,"explorer.exe" ;; App specific heap debug flags HKLM,%CurrentVersionNT%\Image File Execution Options\ChaosCode.exe,GlobalFlag,0x00040002,0x00000020 +HKLM,%CurrentVersionNT%\Image File Execution Options\Crysis2Remastered.exe,GlobalFlag,0x00040002,0x00000020 [CurrentVersionWow64.ntamd64] HKLM,%CurrentVersion%,"ProgramFilesDir (x86)",,"%16426%" From aa4121770f746ddea98779c3c8e6fb7407d9dce4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 21 Sep 2023 16:23:33 -0600 Subject: [PATCH 0830/1506] ntdll: Remove entries from queue in RtlWakeAddressAll(). CW-Bug-Id: #22770 --- dlls/ntdll/sync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index bb5dcbb66e6..6c719874ee2 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -929,8 +929,8 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size void WINAPI RtlWakeAddressAll( const void *addr ) { struct futex_queue *queue = get_futex_queue( addr ); + struct futex_entry *entry, *next; unsigned int count = 0, i; - struct futex_entry *entry; DWORD tids[256]; TRACE("%p\n", addr); @@ -942,10 +942,12 @@ void WINAPI RtlWakeAddressAll( const void *addr ) if (!queue->queue.next) list_init(&queue->queue); - LIST_FOR_EACH_ENTRY( entry, &queue->queue, struct futex_entry, entry ) + LIST_FOR_EACH_ENTRY_SAFE( entry, next, &queue->queue, struct futex_entry, entry ) { if (entry->addr == addr) { + entry->addr = NULL; + list_remove( &entry->entry ); /* Try to buffer wakes, so that we don't make a system call while * holding a spinlock. */ if (count < ARRAY_SIZE(tids)) From be8a9640e3edc6fc3665b4e559117c03ba7b9b46 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 21 Sep 2023 16:29:14 -0600 Subject: [PATCH 0831/1506] ntdll: Pre-check entry->addr before taking a spin lock in RtlWaitOnAddress(). CW-Bug-Id: #22770 --- dlls/ntdll/sync.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 6c719874ee2..d872d75fdd1 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -911,11 +911,14 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size ret = NtWaitForAlertByThreadId( NULL, timeout ); - spin_lock( &queue->lock ); - /* We may have already been removed by a call to RtlWakeAddressSingle(). */ + /* We may have already been removed by a call to RtlWakeAddressSingle() or RtlWakeAddressAll(). */ if (entry.addr) - list_remove( &entry.entry ); - spin_unlock( &queue->lock ); + { + spin_lock( &queue->lock ); + if (entry.addr) + list_remove( &entry.entry ); + spin_unlock( &queue->lock ); + } TRACE("returning %#lx\n", ret); From 3f373cd0da83809280ac2ecc51e94ff5fc584eba Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 11 Sep 2020 17:55:59 +1000 Subject: [PATCH 0832/1506] include: Remove interfaces already define in msxml6.idl Signed-off-by: Alistair Leslie-Hughes CW-Bug-Id: #22822 --- dlls/msxml3/factory.c | 1 + dlls/msxml3/tests/saxreader.c | 1 + dlls/msxml3/tests/schema.c | 5 ++ dlls/msxml3/uuid.c | 11 ++++ include/msxml2.idl | 109 ---------------------------------- include/msxml6.idl | 24 ++++---- 6 files changed, 30 insertions(+), 121 deletions(-) diff --git a/dlls/msxml3/factory.c b/dlls/msxml3/factory.c index c2d3cd30c60..243ee379712 100644 --- a/dlls/msxml3/factory.c +++ b/dlls/msxml3/factory.c @@ -31,6 +31,7 @@ #include "ole2.h" #include "msxml.h" #include "msxml2.h" +#include "msxml6.h" #include "xmlparser.h" /* undef the #define in msxml2 so that we can access the v.2 version diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index e123d4eba5a..48cfa8f5593 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -29,6 +29,7 @@ #include "windows.h" #include "ole2.h" #include "msxml2.h" +#include "msxml6.h" #include "msxml2did.h" #include "ocidl.h" #include "dispex.h" diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c index efc3a8e56e3..a4fe29aca02 100644 --- a/dlls/msxml3/tests/schema.c +++ b/dlls/msxml3/tests/schema.c @@ -32,6 +32,11 @@ #include "dispex.h" #include "cguid.h" +DEFINE_GUID(CLSID_MXXMLWriter60, 0x88d96a0f, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_SAXAttributes60, 0x88d96a0e, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_SAXXMLReader60, 0x88d96a0c, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); + #include "wine/test.h" #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) diff --git a/dlls/msxml3/uuid.c b/dlls/msxml3/uuid.c index 4abbe5e4763..333d4f3d3c7 100644 --- a/dlls/msxml3/uuid.c +++ b/dlls/msxml3/uuid.c @@ -41,6 +41,17 @@ #include "initguid.h" #include "msxml2.h" +/* Cannot include msxml6 here since we will get a duplicate LIBID_MSXML2 error. */ +DEFINE_GUID(CLSID_FreeThreadedDOMDocument60, 0x88d96a06, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_MXNamespaceManager60, 0x88d96a11, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_MXXMLWriter60, 0x88d96a0f, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_SAXAttributes60, 0x88d96a0e, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_SAXXMLReader60, 0x88d96a0c, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_ServerXMLHTTP60, 0x88d96a0b, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_XMLHTTP60, 0x88d96a0a, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_XSLTemplate60, 0x88d96a08, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); + /* * Note that because of a #define in msxml2.h, we end up initializing * CLSID_DOMDocument2 to be the v.3 version independent DOMDocument diff --git a/include/msxml2.idl b/include/msxml2.idl index ede4113ecbf..85bb6a5b0cb 100644 --- a/include/msxml2.idl +++ b/include/msxml2.idl @@ -1612,15 +1612,6 @@ coclass FreeThreadedDOMDocument40 [default, source] dispinterface XMLDOMDocumentEvents; } -[ - uuid(88d96a06-f192-11d4-a65f-0040963251e5), -] -coclass FreeThreadedDOMDocument60 -{ - [default] interface IXMLDOMDocument3; - [default, source] dispinterface XMLDOMDocumentEvents; -} - [ helpstring("Free threaded XML DOM Document"), progid("Msxml2.FreeThreadedDOMDocument"), @@ -1662,14 +1653,6 @@ coclass XMLHTTP40 [default] interface IXMLHTTPRequest; } -[ - uuid(88d96a0a-f192-11d4-a65f-0040963251e5) -] -coclass XMLHTTP60 -{ - [default] interface IXMLHTTPRequest; -} - [ helpstring("XML HTTP"), progid("Msxml2.XMLHTTP"), @@ -1702,14 +1685,6 @@ coclass ServerXMLHTTP40 [default] interface IServerXMLHTTPRequest2; } -[ - uuid(88d96a0b-f192-11d4-a65f-0040963251e5) -] -coclass ServerXMLHTTP60 -{ - [default] interface IServerXMLHTTPRequest2; -} - [ helpstring("Server XML HTTP"), progid("Msxml2.ServerXMLHTTP"), @@ -1750,14 +1725,6 @@ coclass XMLSchemaCache40 [default] interface IXMLDOMSchemaCollection2; } -[ - uuid(88d96a07-f192-11d4-a65f-0040963251e5) -] -coclass XMLSchemaCache60 -{ - [default] interface IXMLDOMSchemaCollection2; -} - [ helpstring("XML Schema Cache"), progid("Msxml2.XMLSchemaCache"), @@ -1798,14 +1765,6 @@ coclass XSLTemplate40 [default] interface IXSLTemplate; } -[ - uuid(88d96a08-f192-11d4-a65f-0040963251e5) -] -coclass XSLTemplate60 -{ - [default] interface IXSLTemplate; -} - [ helpstring("XSL Template"), progid("Msxml2.XSLTemplate"), @@ -3297,15 +3256,6 @@ coclass SAXXMLReader40 interface ISAXXMLReader; } -[ - uuid(88d96a0c-f192-11d4-a65f-0040963251e5) -] -coclass SAXXMLReader60 -{ - [default] interface IVBSAXXMLReader; - interface ISAXXMLReader; -} - [ helpstring("SAX XML Reader"), progid("Msxml2.SAXXMLReader"), @@ -3380,26 +3330,6 @@ coclass MXHTMLWriter40 interface IVBSAXLexicalHandler; } -[ - uuid(88d96a10-f192-11d4-a65f-0040963251e5) -] -coclass MXHTMLWriter60 -{ - [default] interface IMXWriter; - - interface ISAXContentHandler; - interface ISAXDeclHandler; - interface ISAXDTDHandler; - interface ISAXErrorHandler; - interface ISAXLexicalHandler; - - interface IVBSAXContentHandler; - interface IVBSAXDeclHandler; - interface IVBSAXDTDHandler; - interface IVBSAXErrorHandler; - interface IVBSAXLexicalHandler; -} - [ helpstring("MXXMLWriter 3.0"), progid("Msxml2.MXXMLWriter.3.0"), @@ -3444,26 +3374,6 @@ coclass MXXMLWriter40 interface IVBSAXLexicalHandler; } -[ - uuid(88d96a0f-f192-11d4-a65f-0040963251e5) -] -coclass MXXMLWriter60 -{ - [default] interface IMXWriter; - - interface ISAXContentHandler; - interface ISAXDeclHandler; - interface ISAXDTDHandler; - interface ISAXErrorHandler; - interface ISAXLexicalHandler; - - interface IVBSAXContentHandler; - interface IVBSAXDeclHandler; - interface IVBSAXDTDHandler; - interface IVBSAXErrorHandler; - interface IVBSAXLexicalHandler; -} - [ helpstring("MXXMLWriter"), progid("Msxml2.MXXMLWriter"), @@ -3506,15 +3416,6 @@ coclass MXNamespaceManager40 interface IMXNamespaceManager; } -[ - uuid(88d96a11-f192-11d4-a65f-0040963251e5) -] -coclass MXNamespaceManager60 -{ - [default] interface IVBMXNamespaceManager; - interface IMXNamespaceManager; -} - [ helpstring("SAXAttributes 3.0"), progid("Msxml2.SAXAttributes.3.0"), @@ -3539,16 +3440,6 @@ coclass SAXAttributes40 interface ISAXAttributes; } -[ - uuid(88d96a0e-f192-11d4-a65f-0040963251e5) -] -coclass SAXAttributes60 -{ - [default] interface IMXAttributes; - interface IVBSAXAttributes; - interface ISAXAttributes; -} - [ helpstring("SAXAttributes"), progid("Msxml2.SAXAttributes"), diff --git a/include/msxml6.idl b/include/msxml6.idl index d4a5c490243..7396826a1f6 100644 --- a/include/msxml6.idl +++ b/include/msxml6.idl @@ -3065,18 +3065,6 @@ coclass DOMDocument60 [default, source] dispinterface XMLDOMDocumentEvents; } -[ - helpstring("Free threaded XML DOM Document 6.0"), - progid("Msxml2.FreeThreadedDOMDocument.6.0"), - threading(both), - uuid(88d96a06-f192-11d4-a65f-0040963251e5), -] -coclass FreeThreadedDOMDocument60 -{ - [default] interface IXMLDOMDocument3; - [default, source] dispinterface XMLDOMDocumentEvents; -} - [ helpstring("SAX XML Reader 6.0"), progid("Msxml2.SAXXMLReader.6.0"), @@ -3182,6 +3170,18 @@ coclass XSLTemplate60 [default] interface IXSLTemplate; } +[ + helpstring("Free threaded XML DOM Document 6.0"), + progid("Msxml2.FreeThreadedDOMDocument.6.0"), + threading(both), + uuid(88d96a06-f192-11d4-a65f-0040963251e5), +] +coclass FreeThreadedDOMDocument60 +{ + [default] interface IXMLDOMDocument3; + [default, source] dispinterface XMLDOMDocumentEvents; +} + [ helpstring("XML HTTP 6.0"), progid("Msxml2.XMLHTTP.6.0"), From b3aae2aaea319d5d371e8ad16117c6d20aa471ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 8 Sep 2020 18:43:52 +0200 Subject: [PATCH 0833/1506] msxml3: Implement FreeThreadedXMLHTTP60. Update from Gijs Vermeulen CW-Bug-Id: #22822 --- dlls/msxml3/Makefile.in | 2 +- dlls/msxml3/factory.c | 5 + dlls/msxml3/httprequest.c | 495 +++++++++++++++++++++++++++++++++++- dlls/msxml3/msxml_private.h | 1 + dlls/msxml3/tests/httpreq.c | 395 +++++++++++++++++++++++++++- dlls/msxml3/tests/schema.c | 6 + dlls/msxml3/uuid.c | 5 + include/msxml6.idl | 22 +- 8 files changed, 915 insertions(+), 16 deletions(-) diff --git a/dlls/msxml3/Makefile.in b/dlls/msxml3/Makefile.in index 7e59a223143..5044c4e2c79 100644 --- a/dlls/msxml3/Makefile.in +++ b/dlls/msxml3/Makefile.in @@ -1,5 +1,5 @@ MODULE = msxml3.dll -IMPORTS = $(XSLT_PE_LIBS) $(XML2_PE_LIBS) uuid urlmon shlwapi oleaut32 ole32 user32 advapi32 +IMPORTS = $(XSLT_PE_LIBS) $(XML2_PE_LIBS) uuid urlmon shlwapi oleaut32 ole32 user32 advapi32 rtworkq EXTRAINCL = $(XSLT_PE_CFLAGS) $(XML2_PE_CFLAGS) SOURCES = \ diff --git a/dlls/msxml3/factory.c b/dlls/msxml3/factory.c index 243ee379712..323c7b49848 100644 --- a/dlls/msxml3/factory.c +++ b/dlls/msxml3/factory.c @@ -279,6 +279,7 @@ static HRESULT DOMClassFactory_Create(const GUID *clsid, REFIID riid, void **ppv static ClassFactory xmldoccf = { { &ClassFactoryVtbl }, XMLDocument_create }; static ClassFactory httpreqcf = { { &ClassFactoryVtbl }, XMLHTTPRequest_create }; +static ClassFactory httpreqcf2 = { { &ClassFactoryVtbl }, XMLHTTPRequest2_create }; static ClassFactory serverhttp = { { &ClassFactoryVtbl }, ServerXMLHTTP_create }; static ClassFactory xsltemplatecf = { { &ClassFactoryVtbl }, XSLTemplate_create }; static ClassFactory mxnsmanagercf = { {&ClassFactoryVtbl }, MXNamespaceManager_create }; @@ -340,6 +341,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv ) { cf = &httpreqcf.IClassFactory_iface; } + else if( IsEqualCLSID( rclsid, &CLSID_FreeThreadedXMLHTTP60 )) + { + cf = &httpreqcf2.IClassFactory_iface; + } else if( IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP ) || IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP30 ) || IsEqualCLSID( rclsid, &CLSID_ServerXMLHTTP40 ) || diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index e21ece7d9c4..bfa3d716304 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -37,10 +37,12 @@ #include "shlwapi.h" #include "msxml_dispex.h" +#include "initguid.h" +#include "rtworkq.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(msxml); +WINE_DEFAULT_DEBUG_CHANNEL(xmlhttp); static const WCHAR colspaceW[] = {':',' ',0}; static const WCHAR crlfW[] = {'\r','\n',0}; @@ -2054,6 +2056,468 @@ static const struct IServerXMLHTTPRequestVtbl ServerXMLHTTPRequestVtbl = ServerXMLHTTPRequest_setOption }; +static DWORD xhr2_work_queue; + +struct xml_http_request_2 +{ + httprequest req; + IXMLHTTPRequest3 IXMLHTTPRequest3_iface; + IRtwqAsyncCallback IRtwqAsyncCallback_iface; + IDispatch IDispatch_iface; + + IXMLHTTPRequest2Callback *callback; + IXMLHTTPRequest3Callback *callback3; + ISequentialStream *response_body; + ISequentialStream *request_body; + ULONGLONG request_body_size; +}; + +static inline struct xml_http_request_2 *impl_from_IXMLHTTPRequest3(IXMLHTTPRequest3 *iface) +{ + return CONTAINING_RECORD(iface, struct xml_http_request_2, IXMLHTTPRequest3_iface); +} + +static inline struct xml_http_request_2 *xml_http_request_2_from_IRtwqAsyncCallback(IRtwqAsyncCallback *iface) +{ + return CONTAINING_RECORD(iface, struct xml_http_request_2, IRtwqAsyncCallback_iface); +} + +static inline struct xml_http_request_2 *xml_http_request_2_from_IDispatch(IDispatch *iface) +{ + return CONTAINING_RECORD(iface, struct xml_http_request_2, IDispatch_iface); +} + +static HRESULT WINAPI xml_http_request_2_QueryInterface(IXMLHTTPRequest3 *iface, REFIID riid, void **obj) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualGUID(riid, &IID_IXMLHTTPRequest3) || IsEqualGUID(riid, &IID_IXMLHTTPRequest2) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *obj = iface; + IUnknown_AddRef((IUnknown*)*obj); + return S_OK; + } + + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI xml_http_request_2_AddRef(IXMLHTTPRequest3 *iface) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + ULONG ref = InterlockedIncrement(&This->req.ref); + TRACE("(%p)->(%lu)\n", This, ref); + return ref; +} + +static ULONG WINAPI xml_http_request_2_Release(IXMLHTTPRequest3 *iface) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + ULONG ref = InterlockedDecrement(&This->req.ref); + + TRACE("(%p)->(%lu)\n", This, ref); + + if (ref == 0) + { + /* do not call httprequest_put_onreadystatechange to avoid ref cycle */ + This->req.sink = NULL; + if (This->response_body) ISequentialStream_Release(This->response_body); + if (This->request_body) ISequentialStream_Release(This->request_body); + if (This->callback3) IXMLHTTPRequest3Callback_Release(This->callback3); + if (This->callback) IXMLHTTPRequest2Callback_Release(This->callback); + heap_free(This); + RtwqShutdown(); + } + + return ref; +} + +static HRESULT WINAPI xml_http_request_2_Open(IXMLHTTPRequest3 *iface, const WCHAR *method, + const WCHAR *url, IXMLHTTPRequest2Callback *callback, + const WCHAR *username, const WCHAR *password, + const WCHAR *proxy_username, const WCHAR *proxy_password) +{ + static const WCHAR accept_encoding[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0}; + static const WCHAR empty = 0; + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + VARIANT async_v, username_v, password_v; + HRESULT hr; + + TRACE("(%p)->(%s %s %p %s %s %s %s)\n", This, debugstr_w(method), debugstr_w(url), callback, + debugstr_w(username), debugstr_w(password), debugstr_w(proxy_username), debugstr_w(proxy_password)); + + if (This->callback) IXMLHTTPRequest2Callback_Release(This->callback); + if (This->callback3) IXMLHTTPRequest3Callback_Release(This->callback3); + IXMLHTTPRequest2Callback_AddRef(callback); + This->callback = callback; + if (FAILED(IXMLHTTPRequest2Callback_QueryInterface(callback, &IID_IXMLHTTPRequest3Callback, (void **)&This->callback3))) + This->callback3 = NULL; + + if (proxy_username || proxy_password) FIXME("proxy credentials not implemented\n"); + + VariantInit(&async_v); + V_VT(&async_v) = VT_BOOL; + V_BOOL(&async_v) = FALSE; /* FIXME: TRUE needs a RTWQ_WINDOW_WORKQUEUE */ + + VariantInit(&username_v); + V_VT(&username_v) = VT_BSTR; + if (username) V_BSTR(&username_v) = SysAllocString(username); + else V_BSTR(&username_v) = SysAllocString(&empty); + + VariantInit(&password_v); + V_VT(&password_v) = VT_BSTR; + if (password) V_BSTR(&password_v) = SysAllocString(password); + else V_BSTR(&password_v) = SysAllocString(&empty); + + if (FAILED(hr = httprequest_open(&This->req, (BSTR)method, (BSTR)url, async_v, username_v, password_v))) + return hr; + return httprequest_setRequestHeader(&This->req, (BSTR)accept_encoding, (BSTR)&empty); +} + +static HRESULT WINAPI xml_http_request_2_Send(IXMLHTTPRequest3 *iface, ISequentialStream *body, ULONGLONG body_size) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + IRtwqAsyncResult *result; + HRESULT hr; + + TRACE("(%p)->(%p %s)\n", This, body, wine_dbgstr_longlong( body_size )); + + if (body_size) + { + ISequentialStream_AddRef(body); + This->request_body = body; + This->request_body_size = body_size; + } + + if (FAILED(hr = RtwqCreateAsyncResult(NULL, &This->IRtwqAsyncCallback_iface, NULL, &result))) + return hr; + // IRtwqAsyncCallback_Invoke(&This->IRtwqAsyncCallback_iface, result); + hr = RtwqPutWorkItem(xhr2_work_queue, 0, result); + if (result) IRtwqAsyncResult_Release(result); + + return hr; +} + +static HRESULT WINAPI xml_http_request_2_Abort(IXMLHTTPRequest3 *iface) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + TRACE("(%p) stub!\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI xml_http_request_2_SetCookie(IXMLHTTPRequest3 *iface, const XHR_COOKIE *cookie, DWORD *state) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + FIXME("(%p)->(%p %p) stub!\n", This, cookie, state); + return E_NOTIMPL; +} + +static HRESULT WINAPI xml_http_request_2_SetCustomResponseStream(IXMLHTTPRequest3 *iface, ISequentialStream *stream) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + FIXME("(%p)->(%p) stub!\n", This, stream); + return E_NOTIMPL; +} + +static HRESULT WINAPI xml_http_request_2_SetProperty(IXMLHTTPRequest3 *iface, XHR_PROPERTY property, ULONGLONG value) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + FIXME("(%p)->(%#x %s) stub!\n", This, property, wine_dbgstr_longlong( value )); + return E_NOTIMPL; +} + +static HRESULT WINAPI xml_http_request_2_SetRequestHeader(IXMLHTTPRequest3 *iface, + const WCHAR *header, const WCHAR *value) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + TRACE("(%p)->(%s %s)\n", This, debugstr_w(header), debugstr_w(value)); + return httprequest_setRequestHeader(&This->req, (BSTR)header, (BSTR)value); +} + +static HRESULT WINAPI xml_http_request_2_GetAllResponseHeaders(IXMLHTTPRequest3 *iface, WCHAR **headers) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + FIXME("(%p)->(%p) stub!\n", This, headers); + return E_NOTIMPL; +} + +static HRESULT WINAPI xml_http_request_2_GetCookie(IXMLHTTPRequest3 *iface, const WCHAR *url, + const WCHAR *name, DWORD flags, + ULONG *cookies_count, XHR_COOKIE **cookies) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + FIXME("(%p)->(%s %s %ld %p %p) stub!\n", This, debugstr_w(url), debugstr_w(name), flags, cookies_count, cookies); + return E_NOTIMPL; +} + +static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest3 *iface, + const WCHAR *header, WCHAR **value) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + HRESULT hr; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value); + + if (FAILED(hr = httprequest_getResponseHeader(&This->req, (BSTR)header, value))) + return hr; + +#define E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80070002) + + if (hr == S_FALSE) + { + *value = NULL; + return E_FILE_NOT_FOUND; + } + + return hr; +} + +static HRESULT WINAPI xml_http_request_3_SetClientCertificate(IXMLHTTPRequest3 *iface, DWORD count, const BYTE *hashes, const WCHAR *pin) +{ + struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); + FIXME("(%p)->(%ld %p %s) stub!\n", This, count, hashes, debugstr_w(pin)); + return E_NOTIMPL; +} + +static const struct IXMLHTTPRequest3Vtbl XMLHTTPRequest3Vtbl = { + /* IUnknown methods */ + xml_http_request_2_QueryInterface, + xml_http_request_2_AddRef, + xml_http_request_2_Release, + /* IXMLHTTPRequest2 methods */ + xml_http_request_2_Open, + xml_http_request_2_Send, + xml_http_request_2_Abort, + xml_http_request_2_SetCookie, + xml_http_request_2_SetCustomResponseStream, + xml_http_request_2_SetProperty, + xml_http_request_2_SetRequestHeader, + xml_http_request_2_GetAllResponseHeaders, + xml_http_request_2_GetCookie, + xml_http_request_2_GetResponseHeader, + /* IXMLHTTPRequest3 methods */ + xml_http_request_3_SetClientCertificate, +}; + +static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_QueryInterface(IRtwqAsyncCallback *iface, REFIID riid, void **obj) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualGUID(riid, &IID_IRtwqAsyncCallback) || IsEqualGUID(riid, &IID_IUnknown)) + { + IRtwqAsyncCallback_AddRef(iface); + *obj = iface; + return S_OK; + } + + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI xml_http_request_2_IRtwqAsyncCallback_AddRef(IRtwqAsyncCallback *iface) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + TRACE("(%p)\n", This); + return xml_http_request_2_AddRef(&This->IXMLHTTPRequest3_iface); +} + +static ULONG WINAPI xml_http_request_2_IRtwqAsyncCallback_Release(IRtwqAsyncCallback *iface) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + TRACE("(%p)\n", This); + return xml_http_request_2_Release(&This->IXMLHTTPRequest3_iface); +} + +static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_GetParameters(IRtwqAsyncCallback *iface, + DWORD *flags, DWORD *queue) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + + TRACE("(%p)->(%p %p)\n", This, flags, queue); + + *flags = 0; + *queue = xhr2_work_queue; + return S_OK; +} + +static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCallback *iface, + IRtwqAsyncResult *result) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + VARIANT body_v; + HRESULT hr; + ULONG read; + + TRACE("(%p)->(%p)\n", This, result); + + VariantInit(&body_v); + + if (This->request_body) + { + V_VT(&body_v) = VT_BSTR; + V_BSTR(&body_v) = CoTaskMemAlloc(This->request_body_size); + + if (FAILED(hr = ISequentialStream_Read(This->request_body, V_BSTR(&body_v), This->request_body_size, &read)) || + read < This->request_body_size) + { + ERR("Failed to allocate request body memory, hr %#lx\n", hr); + CoTaskMemFree(V_BSTR(&body_v)); + goto done; + } + + ISequentialStream_Release(This->request_body); + This->request_body = NULL; + } + + hr = httprequest_send(&This->req, body_v); + +done: + return IRtwqAsyncResult_SetStatus(result, hr); +} + +static const struct IRtwqAsyncCallbackVtbl xml_http_request_2_IRtwqAsyncCallbackVtbl = { + /* IUnknown methods */ + xml_http_request_2_IRtwqAsyncCallback_QueryInterface, + xml_http_request_2_IRtwqAsyncCallback_AddRef, + xml_http_request_2_IRtwqAsyncCallback_Release, + /* IRtwqAsyncCallback methods */ + xml_http_request_2_IRtwqAsyncCallback_GetParameters, + xml_http_request_2_IRtwqAsyncCallback_Invoke, +}; + +static HRESULT WINAPI xml_http_request_2_IDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **obj) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IUnknown)) + { + IDispatch_AddRef(iface); + *obj = iface; + return S_OK; + } + + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI xml_http_request_2_IDispatch_AddRef(IDispatch *iface) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + TRACE("(%p)\n", This); + return xml_http_request_2_AddRef(&This->IXMLHTTPRequest3_iface); +} + +static ULONG WINAPI xml_http_request_2_IDispatch_Release(IDispatch *iface) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + TRACE("(%p)\n", This); + return xml_http_request_2_Release(&This->IXMLHTTPRequest3_iface); +} + +static HRESULT WINAPI xml_http_request_2_IDispatch_GetTypeInfoCount(IDispatch *iface, UINT *value) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + FIXME("(%p)->(%p) stub!\n", This, value); + *value = 0; + return S_OK; +} + +static HRESULT WINAPI xml_http_request_2_IDispatch_GetTypeInfo(IDispatch *iface, UINT index, + LCID lcid, ITypeInfo **value) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + FIXME("(%p)->(%d %lu %p) stub!\n", This, index, lcid, value); + *value = NULL; + return S_OK; +} + +static HRESULT WINAPI xml_http_request_2_IDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, + OLECHAR **names, UINT names_count, + LCID lcid, DISPID *disp_ids) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + FIXME("(%p)->(%s %p %d %lu %p) stub!\n", This, debugstr_guid(riid), names, names_count, lcid, disp_ids); + return S_OK; +} + +static HRESULT WINAPI xml_http_request_2_IDispatch_Invoke(IDispatch *iface, DISPID id, REFIID riid, + LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *result, EXCEPINFO *exception, UINT *arg_err) +{ + struct xml_http_request_2 *This = xml_http_request_2_from_IDispatch(iface); + IXMLHTTPRequest2 *xhr2_iface = (IXMLHTTPRequest2*)&This->IXMLHTTPRequest3_iface; + HRESULT hr; + LONG status; + BSTR status_str = NULL; + + TRACE("(%p)->(%ld %s %lu %d %p %p %p %p) stub!\n", This, id, debugstr_guid(riid), lcid, flags, + params, result, exception, arg_err); + + if (This->req.state == READYSTATE_COMPLETE) + { + VARIANT body_v; + VariantInit(&body_v); + + IXMLHTTPRequest2Callback_AddRef(This->callback); + if (This->callback3) + { + IXMLHTTPRequest3Callback_AddRef(This->callback3); + IXMLHTTPRequest3Callback_OnServerCertificateReceived(This->callback3, (IXMLHTTPRequest3 *)xhr2_iface, 0, 1, NULL); + IXMLHTTPRequest3Callback_Release(This->callback3); + } + + if (FAILED(hr = httprequest_get_status(&This->req, &status)) || + FAILED(hr = httprequest_get_statusText(&This->req, &status_str))) + { + WARN("failed to get response status, error %#lx\n", hr); + IXMLHTTPRequest2Callback_OnError(This->callback, xhr2_iface, hr); + IXMLHTTPRequest2Callback_Release(This->callback); + return S_OK; + } + + IXMLHTTPRequest2Callback_OnHeadersAvailable(This->callback, xhr2_iface, status, status_str); + SysFreeString(status_str); + + if (This->response_body) ISequentialStream_Release(This->response_body); + This->response_body = NULL; + + if (FAILED(hr = httprequest_get_responseStream(&This->req, &body_v)) || + FAILED(hr = IUnknown_QueryInterface(V_UNKNOWN(&body_v), &IID_ISequentialStream, (void **)&This->response_body))) + { + WARN("failed to get response stream, error %#lx\n", hr); + IXMLHTTPRequest2Callback_OnError(This->callback, xhr2_iface, hr); + IXMLHTTPRequest2Callback_Release(This->callback); + return S_OK; + } + + IXMLHTTPRequest2Callback_OnDataAvailable(This->callback, xhr2_iface, This->response_body); + IXMLHTTPRequest2Callback_OnResponseReceived(This->callback, xhr2_iface, This->response_body); + IXMLHTTPRequest2Callback_Release(This->callback); + } + + return S_OK; +} + +static const struct IDispatchVtbl xml_http_request_2_IDispatchVtbl = { + /* IUnknown methods */ + xml_http_request_2_IDispatch_QueryInterface, + xml_http_request_2_IDispatch_AddRef, + xml_http_request_2_IDispatch_Release, + /* IDispatch methods */ + xml_http_request_2_IDispatch_GetTypeInfoCount, + xml_http_request_2_IDispatch_GetTypeInfo, + xml_http_request_2_IDispatch_GetIDsOfNames, + xml_http_request_2_IDispatch_Invoke, +}; + static void init_httprequest(httprequest *req) { req->IXMLHTTPRequest_iface.lpVtbl = &XMLHTTPRequestVtbl; @@ -2103,6 +2567,35 @@ HRESULT XMLHTTPRequest_create(void **obj) return S_OK; } +HRESULT XMLHTTPRequest2_create(void **obj) +{ + struct xml_http_request_2 *xhr2; + TRACE("(%p)\n", obj); + + if (!(xhr2 = heap_alloc(sizeof(*xhr2)))) return E_OUTOFMEMORY; + + init_httprequest(&xhr2->req); + xhr2->IXMLHTTPRequest3_iface.lpVtbl = &XMLHTTPRequest3Vtbl; + xhr2->IRtwqAsyncCallback_iface.lpVtbl = &xml_http_request_2_IRtwqAsyncCallbackVtbl; + xhr2->IDispatch_iface.lpVtbl = &xml_http_request_2_IDispatchVtbl; + + /* do not call httprequest_put_onreadystatechange to avoid ref cycle */ + xhr2->req.sink = &xhr2->IDispatch_iface; + + xhr2->callback = NULL; + xhr2->callback3 = NULL; + xhr2->request_body = NULL; + xhr2->response_body = NULL; + + /* for async http requests we need window message queue */ + RtwqStartup(); + if (!xhr2_work_queue) RtwqAllocateWorkQueue(RTWQ_MULTITHREADED_WORKQUEUE, &xhr2_work_queue); + + *obj = &xhr2->IXMLHTTPRequest3_iface; + TRACE("returning iface %p\n", *obj); + return S_OK; +} + HRESULT ServerXMLHTTP_create(void **obj) { serverhttp *req; diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index 449a86df5e8..3e5181fa6d8 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -344,6 +344,7 @@ extern HRESULT XMLDocument_create(void**); extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**); extern HRESULT SAXAttributes_create(MSXML_VERSION, void**); extern HRESULT XMLHTTPRequest_create(void **); +extern HRESULT XMLHTTPRequest2_create(void **); extern HRESULT ServerXMLHTTP_create(void **); extern HRESULT XSLTemplate_create(void**); extern HRESULT MXWriter_create(MSXML_VERSION, void**); diff --git a/dlls/msxml3/tests/httpreq.c b/dlls/msxml3/tests/httpreq.c index bccfbaf582a..23d7680d196 100644 --- a/dlls/msxml3/tests/httpreq.c +++ b/dlls/msxml3/tests/httpreq.c @@ -26,9 +26,9 @@ #include #include "windows.h" - #include "msxml2.h" -#include "msxml2did.h" +#include "msxml6.h" +#include "msxml6did.h" #include "dispex.h" #include "initguid.h" @@ -1344,6 +1344,17 @@ static IXMLHttpRequest *create_xhr(void) return SUCCEEDED(hr) ? ret : NULL; } +static IXMLHTTPRequest2 *create_xhr2(void) +{ + IXMLHTTPRequest2 *ret; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_FreeThreadedXMLHTTP60, NULL, CLSCTX_INPROC_SERVER, + &IID_IXMLHTTPRequest2, (void**)&ret); + + return SUCCEEDED(hr) ? ret : NULL; +} + static IServerXMLHTTPRequest *create_server_xhr(void) { IServerXMLHTTPRequest *ret; @@ -1904,11 +1915,388 @@ static void test_supporterrorinfo(void) IServerXMLHTTPRequest_Release(server_xhr); } +struct xhr3_callback +{ + IXMLHTTPRequest3Callback IXMLHTTPRequest3Callback_iface; + LONG ref; + HANDLE event; +}; + +static inline struct xhr3_callback *xhr3_callback_from_IXMLHTTPRequest3Callback(IXMLHTTPRequest3Callback *iface) +{ + return CONTAINING_RECORD(iface, struct xhr3_callback, IXMLHTTPRequest3Callback_iface); +} + +static HRESULT WINAPI xhr3_callback_QueryInterface(IXMLHTTPRequest3Callback *iface, REFIID riid, void **obj) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + trace("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualGUID(riid, &IID_IXMLHTTPRequest3Callback) || IsEqualGUID(riid, &IID_IXMLHTTPRequest2Callback) || IsEqualGUID(riid, &IID_IUnknown)) + { + IXMLHTTPRequest3Callback_AddRef(iface); + *obj = iface; + return S_OK; + } + + ok(0, "unexpected interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI xhr3_callback_AddRef(IXMLHTTPRequest3Callback *iface) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + ULONG ref = InterlockedIncrement(&This->ref); + trace("(%p)->(%lu)\n", This, ref); + return ref; +} + +static ULONG WINAPI xhr3_callback_Release(IXMLHTTPRequest3Callback *iface) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + ULONG ref = InterlockedDecrement(&This->ref); + trace("(%p)->(%lu)\n", This, ref); + if (ref == 0) HeapFree(GetProcessHeap(), 0, This); + return ref; +} + +static HRESULT WINAPI xhr3_callback_OnRedirect(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest2 *request, const WCHAR* redirect_url) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + trace("(%p)->(%p %s)\n", This, request, debugstr_w(redirect_url)); + return S_OK; +} + +static HRESULT WINAPI xhr3_callback_OnHeadersAvailable(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest2 *request, DWORD status, const WCHAR *status_str) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + WCHAR *header = NULL; + HRESULT hr; + + trace("(%p)->(%p %lu %s)\n", This, request, status, debugstr_w(status_str)); + + header = (void *)0xdeadbeef; + hr = IXMLHTTPRequest2_GetResponseHeader(request, L"Content-Length", &header); + trace("Content-Length: %p (%s), hr %#lx\n", header, debugstr_w(header), hr); + + return S_OK; +} + +static HRESULT WINAPI xhr3_callback_OnDataAvailable(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest2 *request, ISequentialStream *response) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + trace("(%p)->(%p %p)\n", This, request, response); + return S_OK; +} + +static HRESULT WINAPI xhr3_callback_OnResponseReceived(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest2 *request, ISequentialStream *response) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + WCHAR *header = NULL; + char *buffer = HeapAlloc( GetProcessHeap(), 0, 256 ); + ULONG read_size = 0; + HRESULT hr; + + memset(buffer, '?', 256); + buffer[255] = 0; + + trace("(%p)->(%p %p)\n", This, request, response); + + header = (void *)0xdeadbeef; + hr = IXMLHTTPRequest2_GetResponseHeader(request, L"Cache-Control", &header); + trace("Cache-Control: %p (%s), hr %#lx\n", header, debugstr_w(header), hr); + + header = (void *)0xdeadbeef; + hr = IXMLHTTPRequest2_GetResponseHeader(request, L"Expires", &header); + trace("Expires: %p (%s), hr %#lx\n", header, debugstr_w(header), hr); + + header = (void *)0xdeadbeef; + hr = IXMLHTTPRequest2_GetResponseHeader(request, L"Content-Type", &header); + trace("Content-Type: %p (%s), hr %#lx\n", header, debugstr_w(header), hr); + + read_size = 0xdeadbeef; + hr = ISequentialStream_Read(response, buffer, 214, &read_size); + trace("Response: (%ld) %s, hr %#lx\n", read_size, debugstr_a(buffer), hr); + + read_size = 0xdeadbeef; + hr = ISequentialStream_Read(response, buffer, 1, &read_size); + trace("Response: (%ld) %s, hr %#lx\n", read_size, debugstr_a(buffer), hr); + + HeapFree( GetProcessHeap(), 0, buffer ); + SetEvent(This->event); + + return S_OK; +} + +static HRESULT WINAPI xhr3_callback_OnError(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest2 *request, HRESULT error) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + trace("(%p)->(%p %#lx)\n", This, request, error); + SetEvent(This->event); + return S_OK; +} + +static HRESULT WINAPI xhr3_callback_OnServerCertificateReceived(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest3 *request, DWORD errors, DWORD chain_size, const XHR_CERT *chain) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + trace("(%p)->(%p %lu %lu %p)\n", This, request, errors, chain_size, chain); + return S_OK; +} + +static HRESULT WINAPI xhr3_callback_OnClientCertificateRequested(IXMLHTTPRequest3Callback *iface, + IXMLHTTPRequest3 *request, DWORD issuers_size, const WCHAR **issuers) +{ + struct xhr3_callback *This = xhr3_callback_from_IXMLHTTPRequest3Callback(iface); + trace("(%p)->(%p %lu %p)\n", This, request, issuers_size, issuers); + return S_OK; +} + +static const IXMLHTTPRequest3CallbackVtbl xhr3_callback_vtbl = +{ + xhr3_callback_QueryInterface, + xhr3_callback_AddRef, + xhr3_callback_Release, + /* IXMLHTTPRequest2Callback methods */ + xhr3_callback_OnRedirect, + xhr3_callback_OnHeadersAvailable, + xhr3_callback_OnDataAvailable, + xhr3_callback_OnResponseReceived, + xhr3_callback_OnError, + /* IXMLHTTPRequest3Callback methods */ + xhr3_callback_OnServerCertificateReceived, + xhr3_callback_OnClientCertificateRequested, +}; + +static IXMLHTTPRequest2Callback* xhr3_callback_create(HANDLE event) +{ + struct xhr3_callback *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + ok(This != NULL, "failed to allocate object\n"); + if (!This) return NULL; + + This->IXMLHTTPRequest3Callback_iface.lpVtbl = &xhr3_callback_vtbl; + This->ref = 1; + This->event = event; + + return (IXMLHTTPRequest2Callback*)&This->IXMLHTTPRequest3Callback_iface; +} + +struct xhr2_stream +{ + IStream IStream_iface; + LONG ref; + IStream *stream; +}; + +static inline struct xhr2_stream *xhr2_stream_from_IStream(IStream *iface) +{ + return CONTAINING_RECORD(iface, struct xhr2_stream, IStream_iface); +} + +static HRESULT WINAPI xhr2_stream_QueryInterface(IStream *iface, REFIID riid, void **obj) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualGUID(riid, &IID_IStream) || IsEqualGUID(riid, &IID_ISequentialStream) || IsEqualGUID(riid, &IID_IUnknown)) + { + IStream_AddRef(iface); + *obj = iface; + return S_OK; + } + + ok(0, "unexpected interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI xhr2_stream_AddRef(IStream *iface) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + ULONG ref = InterlockedIncrement(&This->ref); + trace("(%p)->(%lu)\n", This, ref); + return ref; +} + +static ULONG WINAPI xhr2_stream_Release(IStream *iface) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + ULONG ref = InterlockedDecrement(&This->ref); + trace("(%p)->(%lu)\n", This, ref); + if (ref == 0) + { + IStream_Release(This->stream); + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +static HRESULT WINAPI xhr2_stream_Read(IStream *iface, void *pv, ULONG cb, + ULONG *pcbRead) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%p %lu %p)\n", This, pv, cb, pcbRead); + return IStream_Read(This->stream, pv, cb, pcbRead); +} + +static HRESULT WINAPI xhr2_stream_Write(IStream *iface, const void *pv, + ULONG cb, ULONG *pcbWritten) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%p %lu %p)\n", This, pv, cb, pcbWritten); + return IStream_Write(This->stream, pv, cb, pcbWritten); +} + +static HRESULT WINAPI xhr2_stream_Seek(IStream *iface, LARGE_INTEGER dlibMove, + DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%I64u, %lu %p)\n", This, dlibMove.QuadPart, dwOrigin, plibNewPosition); + return IStream_Seek(This->stream, dlibMove, dwOrigin, plibNewPosition); +} + +static HRESULT WINAPI xhr2_stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%I64u)\n", This, libNewSize.QuadPart); + return IStream_SetSize(This->stream, libNewSize); +} + +static HRESULT WINAPI xhr2_stream_CopyTo(IStream *iface, IStream *pstm, + ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%p %I64u %p %p)\n", This, pstm, cb.QuadPart, pcbRead, pcbWritten); + return IStream_CopyTo(This->stream, pstm, cb, pcbRead, pcbWritten); +} + +static HRESULT WINAPI xhr2_stream_Commit(IStream *iface, DWORD grfCommitFlags) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%#lx)\n", This, grfCommitFlags); + return IStream_Commit(This->stream, grfCommitFlags); +} + +static HRESULT WINAPI xhr2_stream_Revert(IStream *iface) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->()\n", This); + return IStream_Revert(This->stream); +} + +static HRESULT WINAPI xhr2_stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, + ULARGE_INTEGER cb, DWORD dwLockType) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%I64u %I64u %lu)\n", This, libOffset.QuadPart, cb.QuadPart, dwLockType); + return IStream_LockRegion(This->stream, libOffset, cb, dwLockType); +} + +static HRESULT WINAPI xhr2_stream_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, + ULARGE_INTEGER cb, DWORD dwLockType) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%I64u %I64u %lu)\n", This, libOffset.QuadPart, cb.QuadPart, dwLockType); + return IStream_UnlockRegion(This->stream, libOffset, cb, dwLockType); +} + +static HRESULT WINAPI xhr2_stream_Stat(IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%p %#lx)\n", This, pstatstg, grfStatFlag); + return IStream_Stat(This->stream, pstatstg, grfStatFlag); +} + +static HRESULT WINAPI xhr2_stream_Clone(IStream *iface, IStream **ppstm) +{ + struct xhr2_stream *This = xhr2_stream_from_IStream(iface); + trace("(%p)->(%p)\n", This, ppstm); + return IStream_Clone(This->stream, ppstm); +} + +static const IStreamVtbl xhr2_stream_vtbl = +{ + xhr2_stream_QueryInterface, + xhr2_stream_AddRef, + xhr2_stream_Release, + /* IStream methods */ + xhr2_stream_Read, + xhr2_stream_Write, + xhr2_stream_Seek, + xhr2_stream_SetSize, + xhr2_stream_CopyTo, + xhr2_stream_Commit, + xhr2_stream_Revert, + xhr2_stream_LockRegion, + xhr2_stream_UnlockRegion, + xhr2_stream_Stat, + xhr2_stream_Clone +}; + +static ISequentialStream *xhr2_stream_create(void) +{ + struct xhr2_stream *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + ok(This != NULL, "failed to allocate object\n"); + if (!This) return NULL; + + This->IStream_iface.lpVtbl = &xhr2_stream_vtbl; + This->ref = 1; + CreateStreamOnHGlobal(NULL, TRUE, &This->stream); + + return (ISequentialStream*)&This->IStream_iface; +} + +static void test_IXMLHTTPRequest2(void) +{ + IXMLHTTPRequest2 *xhr2[16]; + IXMLHTTPRequest2Callback *xhr3_callback; + ISequentialStream *stream; + HANDLE events[16]; + HRESULT hr; + int i = 0; + + if (!(xhr2[i] = create_xhr2())) + { + win_skip("IXMLHTTPRequest2 is not available\n"); + return; + } + + events[i] = CreateEventW(NULL, FALSE, FALSE, NULL); + if (!(xhr3_callback = xhr3_callback_create(events[i]))) + return; + + trace("%lu: IXMLHTTPRequest2_Open (%p)->(L\"GET\", L\"http://test.winehq.org/\", xhr3_callback, NULL, NULL, NULL, NULL)\n", GetCurrentThreadId(), xhr2[i]); + hr = IXMLHTTPRequest2_Open(xhr2[i], L"GET", L"http://test.winehq.org/", xhr3_callback, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "IXMLHTTPRequest2_Send failed %#lx\n", hr); + + if ((stream = xhr2_stream_create())) + { + trace("%lu: IXMLHTTPRequest2_Send (%p)->(%p 0)\n", GetCurrentThreadId(), xhr2[i], stream); + hr = IXMLHTTPRequest2_Send(xhr2[i], stream, 0); + ok(SUCCEEDED(hr), "IXMLHTTPRequest2_Send failed %#lx\n", hr); + + ISequentialStream_Release(stream); + } + + IXMLHTTPRequest2Callback_Release(xhr3_callback); + i++; + + while (i--) + { + WaitForSingleObject(events[i], INFINITE); + IXMLHTTPRequest2_Release(xhr2[i]); + } +} + START_TEST(httpreq) { IXMLHttpRequest *xhr; - CoInitialize(NULL); + CoInitializeEx(NULL, COINIT_MULTITHREADED); if (!(xhr = create_xhr())) { @@ -1923,6 +2311,7 @@ START_TEST(httpreq) test_server_xhr(); test_safe_httpreq(); test_supporterrorinfo(); + test_IXMLHTTPRequest2(); CoUninitialize(); } diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c index a4fe29aca02..fd244ee2e1c 100644 --- a/dlls/msxml3/tests/schema.c +++ b/dlls/msxml3/tests/schema.c @@ -32,10 +32,16 @@ #include "dispex.h" #include "cguid.h" +DEFINE_GUID(CLSID_FreeThreadedDOMDocument60, 0x88d96a06, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_FreeThreadedXMLHTTP60, 0x88d96a09, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_MXXMLWriter60, 0x88d96a0f, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_SAXAttributes60, 0x88d96a0e, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_SAXXMLReader60, 0x88d96a0c, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(IID_IXMLHTTPRequest2, 0xe5d37dc0, 0x552a, 0x4d52, 0x9c,0xc0, 0xa1,0x4d,0x54,0x6f,0xbd,0x04); +DEFINE_GUID(IID_IXMLHTTPRequest3, 0xa1c9feee, 0x0617, 0x4f23, 0x9d,0x58, 0x89,0x61,0xea,0x43,0x56,0x7c); +DEFINE_GUID(IID_IXMLHTTPRequest2Callback, 0xa44a9299, 0xe321, 0x40de, 0x88,0x66, 0x34,0x1b,0x41,0x66,0x91,0x62); +DEFINE_GUID(IID_IXMLHTTPRequest3Callback, 0xb9e57830, 0x8c6c, 0x4a6f, 0x9c,0x13, 0x47,0x77,0x2b,0xb0,0x47,0xbb); #include "wine/test.h" diff --git a/dlls/msxml3/uuid.c b/dlls/msxml3/uuid.c index 333d4f3d3c7..1b4f0452c5f 100644 --- a/dlls/msxml3/uuid.c +++ b/dlls/msxml3/uuid.c @@ -43,6 +43,7 @@ /* Cannot include msxml6 here since we will get a duplicate LIBID_MSXML2 error. */ DEFINE_GUID(CLSID_FreeThreadedDOMDocument60, 0x88d96a06, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(CLSID_FreeThreadedXMLHTTP60, 0x88d96a09, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_MXNamespaceManager60, 0x88d96a11, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_MXXMLWriter60, 0x88d96a0f, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_SAXAttributes60, 0x88d96a0e, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); @@ -51,6 +52,10 @@ DEFINE_GUID(CLSID_ServerXMLHTTP60, 0x88d96a0b, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0 DEFINE_GUID(CLSID_XMLHTTP60, 0x88d96a0a, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_XMLSchemaCache60, 0x88d96a07, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); DEFINE_GUID(CLSID_XSLTemplate60, 0x88d96a08, 0xf192, 0x11d4, 0xa6,0x5f, 0x00,0x40,0x96,0x32,0x51,0xe5); +DEFINE_GUID(IID_IXMLHTTPRequest2, 0xe5d37dc0, 0x552a, 0x4d52, 0x9c,0xc0, 0xa1,0x4d,0x54,0x6f,0xbd,0x04); +DEFINE_GUID(IID_IXMLHTTPRequest3, 0xa1c9feee, 0x0617, 0x4f23, 0x9d,0x58, 0x89,0x61,0xea,0x43,0x56,0x7c); +DEFINE_GUID(IID_IXMLHTTPRequest2Callback, 0xa44a9299, 0xe321, 0x40de, 0x88,0x66, 0x34,0x1b,0x41,0x66,0x91,0x62); +DEFINE_GUID(IID_IXMLHTTPRequest3Callback, 0xb9e57830, 0x8c6c, 0x4a6f, 0x9c,0x13, 0x47,0x77,0x2b,0xb0,0x47,0xbb); /* * Note that because of a #define in msxml2.h, we end up initializing diff --git a/include/msxml6.idl b/include/msxml6.idl index 7396826a1f6..b2d8bd3b337 100644 --- a/include/msxml6.idl +++ b/include/msxml6.idl @@ -1715,17 +1715,6 @@ interface ISAXDeclHandler : IUnknown [in] int nSystemId); } -[ - helpstring("Free Threaded XML HTTP Request class 6.0"), - progid("Msxml2.FreeThreadedXMLHTTP60.6.0"), - threading(both), - uuid(88d96a09-f192-11d4-a65f-0040963251e5) -] -coclass FreeThreadedXMLHTTP60 -{ - [default] interface IXMLHTTPRequest2; -} - [ object, local, @@ -3053,6 +3042,17 @@ interface ISchemaNotation; SCHEMATYPEVARIETY __schemaTypeVariety__; } __msxml6_ReferenceRemainingTypes__; +[ + helpstring("Free Threaded XML HTTP Request class 6.0"), + progid("Msxml2.FreeThreadedXMLHTTP60.6.0"), + threading(both), + uuid(88d96a09-f192-11d4-a65f-0040963251e5) +] +coclass FreeThreadedXMLHTTP60 +{ + [default] interface IXMLHTTPRequest2; +} + [ helpstring("XML DOM Document 6.0"), progid("Msxml2.DOMDocument.6.0"), From 54cef7c7d940f35d115b219c715a0646cad365d7 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 5 Jan 2023 14:36:31 +1100 Subject: [PATCH 0834/1506] msxml3: Implement IXMLHTTPRequest3 SetProperty CW-Bug-Id: #22822 --- dlls/msxml3/httprequest.c | 77 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index bfa3d716304..f620a08e66a 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -101,6 +101,21 @@ typedef struct /* IObjectSafety */ DWORD safeopt; + + /* Properties */ + DWORD no_prompt; + DWORD no_auth; + DWORD timeout; + BOOL no_headeres; + BOOL redirect; + BOOL cache; + BOOL extended; + BOOL query_utf8; + BOOL ignore_errors; + BOOL threshold; + DWORD enterrprised_id; + DWORD max_connections; + } httprequest; typedef struct @@ -2226,8 +2241,52 @@ static HRESULT WINAPI xml_http_request_2_SetCustomResponseStream(IXMLHTTPRequest static HRESULT WINAPI xml_http_request_2_SetProperty(IXMLHTTPRequest3 *iface, XHR_PROPERTY property, ULONGLONG value) { struct xml_http_request_2 *This = impl_from_IXMLHTTPRequest3(iface); - FIXME("(%p)->(%#x %s) stub!\n", This, property, wine_dbgstr_longlong( value )); - return E_NOTIMPL; + + TRACE("(%p)->(%#x %s) stub!\n", This, property, wine_dbgstr_longlong( value )); + + switch (property) + { + case XHR_PROP_NO_CRED_PROMPT: + This->req.no_prompt = value; + break; + case XHR_PROP_NO_AUTH: + This->req.no_auth = value; + break; + case XHR_PROP_TIMEOUT: + This->req.timeout = value; + break; + case XHR_PROP_NO_DEFAULT_HEADERS: + This->req.no_headeres = value != 0; + break; + case XHR_PROP_REPORT_REDIRECT_STATUS: + This->req.redirect = value != 0; + break; + case XHR_PROP_NO_CACHE: + This->req.cache = value != 0; + break; + case XHR_PROP_EXTENDED_ERROR: + This->req.extended = value != 0; + break; + case XHR_PROP_QUERY_STRING_UTF8: + This->req.query_utf8 = value != 0; + break; + case XHR_PROP_IGNORE_CERT_ERRORS: + This->req.ignore_errors = value != 0; + break; + case XHR_PROP_ONDATA_THRESHOLD: + This->req.threshold = value; + break; + case XHR_PROP_SET_ENTERPRISEID: + This->req.enterrprised_id = value; + break; + case XHR_PROP_MAX_CONNECTIONS: + This->req.max_connections = value; + break; + default: + WARN("Invalid property %#x\n", property); + return E_INVALIDARG; + } + return S_OK; } static HRESULT WINAPI xml_http_request_2_SetRequestHeader(IXMLHTTPRequest3 *iface, @@ -2547,6 +2606,20 @@ static void init_httprequest(httprequest *req) req->site = NULL; req->safeopt = 0; + + /* Properties */ + req->no_prompt = XHR_CRED_PROMPT_ALL; + req->no_auth = XHR_AUTH_ALL; + req->timeout = 0xFFFFFFFF; + req->no_headeres = FALSE; + req->redirect = FALSE; + req->cache = FALSE; + req->extended = FALSE; + req->query_utf8 = FALSE;; + req->ignore_errors = FALSE;; + req->threshold = 0x100; + req->enterrprised_id = 0; + req->max_connections = 10; } HRESULT XMLHTTPRequest_create(void **obj) From 15e64e85f5449cc544eabd5c9f3d8a893a88a0bc Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 12 Jan 2023 08:21:48 +1100 Subject: [PATCH 0835/1506] msxml3: Correct xml_http_request_2_GetResponseHeader CW-Bug-Id: #22822 --- dlls/msxml3/httprequest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index f620a08e66a..e47ea529284 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -2321,8 +2321,7 @@ static HRESULT WINAPI xml_http_request_2_GetResponseHeader(IXMLHTTPRequest3 *ifa TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value); - if (FAILED(hr = httprequest_getResponseHeader(&This->req, (BSTR)header, value))) - return hr; + hr = httprequest_getResponseHeader(&This->req, (BSTR)header, value); #define E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80070002) From 1f465af7e43d9c6c0f4d468898f3583e40e127fa Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 5 Oct 2023 11:38:00 -0600 Subject: [PATCH 0836/1506] msxml3: Treat body as data array in xml_http_request_2_IRtwqAsyncCallback_Invoke(). CW-Bug-Id: #22822 --- dlls/msxml3/httprequest.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index e47ea529284..c5308e7f2d1 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -2408,6 +2408,7 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal IRtwqAsyncResult *result) { struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + SAFEARRAY *sa = NULL; VARIANT body_v; HRESULT hr; ULONG read; @@ -2418,14 +2419,25 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal if (This->request_body) { - V_VT(&body_v) = VT_BSTR; - V_BSTR(&body_v) = CoTaskMemAlloc(This->request_body_size); + SAFEARRAYBOUND bound; + void *ptr; - if (FAILED(hr = ISequentialStream_Read(This->request_body, V_BSTR(&body_v), This->request_body_size, &read)) || - read < This->request_body_size) + bound.lLbound = 0; + bound.cElements = This->request_body_size; + if (!(sa = SafeArrayCreate(VT_UI1, 1, &bound))) + { + ERR("No memory.\n"); + hr = E_OUTOFMEMORY; + goto done; + } + V_ARRAY(&body_v) = sa; + V_VT(&body_v) = VT_ARRAY | VT_UI1; + SafeArrayAccessData(sa, &ptr); + hr = ISequentialStream_Read(This->request_body, ptr, This->request_body_size, &read); + SafeArrayUnaccessData(sa); + if (FAILED(hr) || read < This->request_body_size) { - ERR("Failed to allocate request body memory, hr %#lx\n", hr); - CoTaskMemFree(V_BSTR(&body_v)); + ERR("Failed to read from stream, hr %#lx\n", hr); goto done; } @@ -2436,6 +2448,8 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal hr = httprequest_send(&This->req, body_v); done: + if (sa) + SafeArrayDestroy(sa); return IRtwqAsyncResult_SetStatus(result, hr); } From c9caac62b853236bd0221a9fc5e340e265d8781d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 5 Oct 2023 12:05:28 -0600 Subject: [PATCH 0837/1506] msxml3: Try to get body size from stream in xml_http_request_2_IRtwqAsyncCallback_Invoke(). CW-Bug-Id: #22822 --- dlls/msxml3/httprequest.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index c5308e7f2d1..e6a921aeda1 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -2408,6 +2408,7 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal IRtwqAsyncResult *result) { struct xml_http_request_2 *This = xml_http_request_2_from_IRtwqAsyncCallback(iface); + IStream *stream = NULL; SAFEARRAY *sa = NULL; VARIANT body_v; HRESULT hr; @@ -2420,10 +2421,27 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal if (This->request_body) { SAFEARRAYBOUND bound; + ULONGLONG body_size; + STATSTG stream_stat; + LARGE_INTEGER li; void *ptr; + if (SUCCEEDED(ISequentialStream_QueryInterface(This->request_body, &IID_IStream, (void **)&stream)) + && SUCCEEDED(IStream_Stat(stream, &stream_stat, 0))) + { + body_size = stream_stat.cbSize.QuadPart; + li.QuadPart = 0; + IStream_Seek(stream, li, STREAM_SEEK_SET, NULL); + } + else + { + body_size = This->request_body_size; + } + + TRACE("body_size %I64u.\n", body_size); + bound.lLbound = 0; - bound.cElements = This->request_body_size; + bound.cElements = body_size; if (!(sa = SafeArrayCreate(VT_UI1, 1, &bound))) { ERR("No memory.\n"); @@ -2433,9 +2451,13 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal V_ARRAY(&body_v) = sa; V_VT(&body_v) = VT_ARRAY | VT_UI1; SafeArrayAccessData(sa, &ptr); - hr = ISequentialStream_Read(This->request_body, ptr, This->request_body_size, &read); + + if (stream) + hr = IStream_Read(stream, ptr, body_size, &read); + else + hr = ISequentialStream_Read(This->request_body, ptr, body_size, &read); SafeArrayUnaccessData(sa); - if (FAILED(hr) || read < This->request_body_size) + if (FAILED(hr) || read < body_size) { ERR("Failed to read from stream, hr %#lx\n", hr); goto done; @@ -2450,6 +2472,8 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal done: if (sa) SafeArrayDestroy(sa); + if (stream) + IStream_Release(stream); return IRtwqAsyncResult_SetStatus(result, hr); } From 77aa647ab5f391186a2398d4b0e9e96522a7d10f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 5 Oct 2023 12:02:44 -0600 Subject: [PATCH 0838/1506] msxml3: Don't fail xml_http_request_2_IRtwqAsyncCallback_Invoke() on stream read failures. CW-Bug-Id: #22822 --- dlls/msxml3/httprequest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index e6a921aeda1..f63284e8577 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -2459,8 +2459,12 @@ static HRESULT WINAPI xml_http_request_2_IRtwqAsyncCallback_Invoke(IRtwqAsyncCal SafeArrayUnaccessData(sa); if (FAILED(hr) || read < body_size) { - ERR("Failed to read from stream, hr %#lx\n", hr); - goto done; + /* Windows doesn't send the body in this case but still sends request with Content-Length + * set to requested body size. */ + ERR("Failed to read from stream, hr %#lx, read %lu\n", hr, read); + SafeArrayDestroy(sa); + sa = NULL; + V_VT(&body_v) = VT_NULL; } ISequentialStream_Release(This->request_body); From f6524e70c3eead2eeb9a7091f651d12e70b8d867 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 12 Oct 2023 21:38:46 -0600 Subject: [PATCH 0839/1506] ntdll: HACK: Avoid unitialized Dr7 in RtlRaiseException on x64. CW-Bug-Id: #22848 --- dlls/ntdll/signal_x86_64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 31fc44906fa..4d14febd8d3 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -1609,6 +1609,8 @@ __ASM_GLOBAL_FUNC( RtlRaiseException, "movq 0x4f8(%rsp),%rax\n\t" /* return address */ "movq %rax,0xf8(%rdx)\n\t" /* context->Rip */ "movq %rax,0x10(%rcx)\n\t" /* rec->ExceptionAddress */ + "xor %rax,%rax\n\t" + "movq %rax,0x70(%rdx)\n\t" /* Context->Dr7 */ "movl $1,%r8d\n\t" "movq %gs:(0x30),%rax\n\t" /* Teb */ "movq 0x60(%rax),%rax\n\t" /* Peb */ From 6c776b645996bcc14b0758ac7c387929f109fac3 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 17 Nov 2023 17:27:21 -0600 Subject: [PATCH 0840/1506] d3dx9: Implement D3DXComputeTangent CW-Bug-Id: #23002 --- dlls/d3dx9_24/d3dx9_24.spec | 2 +- dlls/d3dx9_25/d3dx9_25.spec | 2 +- dlls/d3dx9_26/d3dx9_26.spec | 2 +- dlls/d3dx9_27/d3dx9_27.spec | 2 +- dlls/d3dx9_28/d3dx9_28.spec | 2 +- dlls/d3dx9_29/d3dx9_29.spec | 2 +- dlls/d3dx9_30/d3dx9_30.spec | 2 +- dlls/d3dx9_31/d3dx9_31.spec | 2 +- dlls/d3dx9_32/d3dx9_32.spec | 2 +- dlls/d3dx9_33/d3dx9_33.spec | 2 +- dlls/d3dx9_34/d3dx9_34.spec | 2 +- dlls/d3dx9_35/d3dx9_35.spec | 2 +- dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 18 ++++++++++++++++++ dlls/d3dx9_37/d3dx9_37.spec | 2 +- dlls/d3dx9_38/d3dx9_38.spec | 2 +- dlls/d3dx9_39/d3dx9_39.spec | 2 +- dlls/d3dx9_40/d3dx9_40.spec | 2 +- dlls/d3dx9_41/d3dx9_41.spec | 2 +- dlls/d3dx9_42/d3dx9_42.spec | 2 +- dlls/d3dx9_43/d3dx9_43.spec | 2 +- 21 files changed, 38 insertions(+), 20 deletions(-) diff --git a/dlls/d3dx9_24/d3dx9_24.spec b/dlls/d3dx9_24/d3dx9_24.spec index 8791e4ec044..b3cb0bf2382 100644 --- a/dlls/d3dx9_24/d3dx9_24.spec +++ b/dlls/d3dx9_24/d3dx9_24.spec @@ -20,7 +20,7 @@ @ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_25/d3dx9_25.spec b/dlls/d3dx9_25/d3dx9_25.spec index 0431a9f7f75..41e0235c00d 100644 --- a/dlls/d3dx9_25/d3dx9_25.spec +++ b/dlls/d3dx9_25/d3dx9_25.spec @@ -20,7 +20,7 @@ @ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_26/d3dx9_26.spec b/dlls/d3dx9_26/d3dx9_26.spec index 5ab0a1d9fea..095a0cb4695 100644 --- a/dlls/d3dx9_26/d3dx9_26.spec +++ b/dlls/d3dx9_26/d3dx9_26.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_27/d3dx9_27.spec b/dlls/d3dx9_27/d3dx9_27.spec index 5ab0a1d9fea..095a0cb4695 100644 --- a/dlls/d3dx9_27/d3dx9_27.spec +++ b/dlls/d3dx9_27/d3dx9_27.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_28/d3dx9_28.spec b/dlls/d3dx9_28/d3dx9_28.spec index af5b6077202..bbd47d69fcf 100644 --- a/dlls/d3dx9_28/d3dx9_28.spec +++ b/dlls/d3dx9_28/d3dx9_28.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_29/d3dx9_29.spec b/dlls/d3dx9_29/d3dx9_29.spec index af5b6077202..bbd47d69fcf 100644 --- a/dlls/d3dx9_29/d3dx9_29.spec +++ b/dlls/d3dx9_29/d3dx9_29.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_30/d3dx9_30.spec b/dlls/d3dx9_30/d3dx9_30.spec index af5b6077202..bbd47d69fcf 100644 --- a/dlls/d3dx9_30/d3dx9_30.spec +++ b/dlls/d3dx9_30/d3dx9_30.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_31/d3dx9_31.spec b/dlls/d3dx9_31/d3dx9_31.spec index 8f77dc666a2..1250de7843d 100644 --- a/dlls/d3dx9_31/d3dx9_31.spec +++ b/dlls/d3dx9_31/d3dx9_31.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_32/d3dx9_32.spec b/dlls/d3dx9_32/d3dx9_32.spec index 2fdd2a00615..0691d18995b 100644 --- a/dlls/d3dx9_32/d3dx9_32.spec +++ b/dlls/d3dx9_32/d3dx9_32.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_33/d3dx9_33.spec b/dlls/d3dx9_33/d3dx9_33.spec index 2fdd2a00615..0691d18995b 100644 --- a/dlls/d3dx9_33/d3dx9_33.spec +++ b/dlls/d3dx9_33/d3dx9_33.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_34/d3dx9_34.spec b/dlls/d3dx9_34/d3dx9_34.spec index 2fdd2a00615..0691d18995b 100644 --- a/dlls/d3dx9_34/d3dx9_34.spec +++ b/dlls/d3dx9_34/d3dx9_34.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_35/d3dx9_35.spec b/dlls/d3dx9_35/d3dx9_35.spec index 2fdd2a00615..0691d18995b 100644 --- a/dlls/d3dx9_35/d3dx9_35.spec +++ b/dlls/d3dx9_35/d3dx9_35.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index 5b7070145de..e2ea5b6cc0c 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c index 4fbb44b826b..7ecbfaa775d 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c @@ -7614,6 +7614,24 @@ HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *mesh, DWORD texture_in_seman return hr; } +/************************************************************************* + * D3DXComputeTangent (D3DX9_36.@) + */ +HRESULT WINAPI D3DXComputeTangent(ID3DXMesh *mesh, DWORD stage_idx, DWORD tangent_idx, + DWORD binorm_idx, DWORD wrap, const DWORD *adjacency) +{ + TRACE("mesh %p, stage_idx %ld, tangent_idx %ld, binorm_idx %ld, wrap %ld, adjacency %p.\n", + mesh, stage_idx, tangent_idx, binorm_idx, wrap, adjacency); + + return D3DXComputeTangentFrameEx( mesh, D3DDECLUSAGE_TEXCOORD, stage_idx, + ( binorm_idx == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_BINORMAL, + binorm_idx, + ( tangent_idx == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_TANGENT, + tangent_idx, D3DX_DEFAULT, 0, + ( wrap ? D3DXTANGENT_WRAP_UV : 0 ) | D3DXTANGENT_GENERATE_IN_PLACE | D3DXTANGENT_ORTHOGONALIZE_FROM_U, + adjacency, -1.01f, -0.01f, -1.01f, NULL, NULL); +} + /************************************************************************* * D3DXComputeNormals (D3DX9_36.@) */ diff --git a/dlls/d3dx9_37/d3dx9_37.spec b/dlls/d3dx9_37/d3dx9_37.spec index 5b7070145de..e2ea5b6cc0c 100644 --- a/dlls/d3dx9_37/d3dx9_37.spec +++ b/dlls/d3dx9_37/d3dx9_37.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_38/d3dx9_38.spec b/dlls/d3dx9_38/d3dx9_38.spec index 5b7070145de..e2ea5b6cc0c 100644 --- a/dlls/d3dx9_38/d3dx9_38.spec +++ b/dlls/d3dx9_38/d3dx9_38.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_39/d3dx9_39.spec b/dlls/d3dx9_39/d3dx9_39.spec index 5b7070145de..e2ea5b6cc0c 100644 --- a/dlls/d3dx9_39/d3dx9_39.spec +++ b/dlls/d3dx9_39/d3dx9_39.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_40/d3dx9_40.spec b/dlls/d3dx9_40/d3dx9_40.spec index 5b7070145de..e2ea5b6cc0c 100644 --- a/dlls/d3dx9_40/d3dx9_40.spec +++ b/dlls/d3dx9_40/d3dx9_40.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_41/d3dx9_41.spec b/dlls/d3dx9_41/d3dx9_41.spec index 5b7070145de..e2ea5b6cc0c 100644 --- a/dlls/d3dx9_41/d3dx9_41.spec +++ b/dlls/d3dx9_41/d3dx9_41.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_42/d3dx9_42.spec b/dlls/d3dx9_42/d3dx9_42.spec index 4a418d1508a..1792886d9ac 100644 --- a/dlls/d3dx9_42/d3dx9_42.spec +++ b/dlls/d3dx9_42/d3dx9_42.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) diff --git a/dlls/d3dx9_43/d3dx9_43.spec b/dlls/d3dx9_43/d3dx9_43.spec index 4a418d1508a..1792886d9ac 100644 --- a/dlls/d3dx9_43/d3dx9_43.spec +++ b/dlls/d3dx9_43/d3dx9_43.spec @@ -24,7 +24,7 @@ @ stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr) @ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float) @ stdcall D3DXComputeNormals(ptr ptr) -@ stub D3DXComputeTangent(ptr long long long long ptr) +@ stdcall D3DXComputeTangent(ptr long long long long ptr) @ stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) From 67e195222d2b304a4e230e5757714038284ce30d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 4 May 2023 13:33:48 -0600 Subject: [PATCH 0841/1506] ntdll: HACK: Add WINE_RAM_REPORTING_BIAS option. CW-Bug-Id: #22241 --- dlls/ntdll/unix/loader.c | 6 ++++++ dlls/ntdll/unix/system.c | 8 ++++++++ dlls/ntdll/unix/unix_private.h | 1 + dlls/ntdll/unix/virtual.c | 1 + 4 files changed, 16 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 994413c1658..a8f6d3f91c0 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2023,11 +2023,17 @@ BOOL no_priv_elevation; BOOL localsystem_sid; BOOL simulate_writecopy; SIZE_T kernel_stack_size = 0x100000; +long long ram_reporting_bias; static void hacks_init(void) { const char *sgi = getenv( "SteamGameId" ); const char *env_str; + if ((env_str = getenv("WINE_RAM_REPORTING_BIAS"))) + { + ram_reporting_bias = atoll(env_str) * 1024 * 1024; + ERR( "HACK: ram_reporting_bias %lldMB.\n", ram_reporting_bias / (1024 * 1024) ); + } env_str = getenv("WINE_SIMULATE_ASYNC_READ"); if (env_str) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 3dc5c704aa9..129136f675d 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2116,7 +2116,15 @@ static void get_performance_info( SYSTEM_PERFORMANCE_INFORMATION *info ) mem_available = value * 1024; } fclose(fp); + totalram -= min( totalram, ram_reporting_bias ); if (mem_available) freeram = mem_available; + if ((long long)freeram >= ram_reporting_bias) freeram -= ram_reporting_bias; + else + { + long long bias = ram_reporting_bias - freeram; + freeswap -= min( bias, freeswap ); + freeram = 0; + } } } #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || \ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index bcee4508b65..e14eb43dd0d 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -188,6 +188,7 @@ extern BOOL fsync_yield_to_waiters; extern BOOL no_priv_elevation; extern BOOL localsystem_sid; extern BOOL simulate_writecopy; +extern long long ram_reporting_bias; extern void init_environment(void); extern void init_startup_info(void); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 4953a2086ec..7ec937a478f 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3426,6 +3426,7 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info, BOOL wow64 ) if (!sysinfo(&sinfo)) { ULONG64 total = (ULONG64)sinfo.totalram * sinfo.mem_unit; + total -= min(total, ram_reporting_bias); info->MmHighestPhysicalPage = max(1, total / page_size); } #elif defined(__APPLE__) From a3e976d0dc7e63f855958c7fc25ae66c8837afc9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 10 May 2023 13:17:26 -0600 Subject: [PATCH 0842/1506] ntdll: Add virtstat debug channel and log memory allocation statistics. This is solely for debugging purposes and does nothing unless +virtstat logging is enabled. CW-Bug-Id: #22045 CW-Bug-Id: #22247 --- dlls/ntdll/unix/virtual.c | 56 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 7ec937a478f..3aa1bdf1d78 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -80,6 +80,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(virtual); WINE_DECLARE_DEBUG_CHANNEL(module); WINE_DECLARE_DEBUG_CHANNEL(virtual_ranges); +WINE_DECLARE_DEBUG_CHANNEL(virtstat); struct preload_info { @@ -1195,6 +1196,53 @@ static void VIRTUAL_Dump(void) #endif +static void dump_memory_statistics(void) +{ + struct file_view *view; + SIZE_T anon_reserved = 0, anon_committed = 0, mapped = 0, mapped_committed = 0, marked_native = 0; + SIZE_T size, c_size; + char *base; + BYTE vprot; + + if (!TRACE_ON(virtstat)) return; + + WINE_RB_FOR_EACH_ENTRY( view, &views_tree, struct file_view, entry ) + { + if (view->protect & VPROT_NATIVE) + { + marked_native += view->size; + continue; + } + base = view->base; + c_size = 0; + while (base != (char *)view->base + view->size) + { + size = get_vprot_range_size( base, (char *)view->base + view->size - base, VPROT_COMMITTED, &vprot ); + if (vprot & VPROT_COMMITTED) c_size += size; + base += size; + } + if (is_view_valloc( view )) + { + anon_reserved += view->size; + anon_committed += c_size; + } + else + { + mapped += view->size; + mapped_committed += c_size; + } + } + + anon_reserved /= 1024 * 1024; + anon_committed /= 1024 * 1024; + mapped /= 1024 * 1024; + mapped_committed /= 1024 * 1024; + marked_native /= 1024 * 1024; + TRACE_(virtstat)( "Total: res %lu, comm %lu; Anon: res %lu, comm %lu, marked Unix %lu.\n", + anon_reserved + mapped, anon_committed + mapped_committed, anon_reserved, anon_committed, + marked_native ); +} + /*********************************************************************** * find_view * @@ -4690,7 +4738,11 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ set_arm64ec_range( base, size ); } - if (!status) VIRTUAL_DEBUG_DUMP_VIEW( view ); + if (!status) + { + VIRTUAL_DEBUG_DUMP_VIEW( view ); + dump_memory_statistics(); + } server_leave_uninterrupted_section( &virtual_mutex, &sigset ); @@ -4991,6 +5043,8 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si *addr_ptr = base; *size_ptr = size; } + + dump_memory_statistics(); server_leave_uninterrupted_section( &virtual_mutex, &sigset ); return status; } From d69718378dd0599580a1f4f3f8d01dda4c11b5b7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 30 Nov 2023 19:51:12 -0600 Subject: [PATCH 0843/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for Battle.net.exe. CW-Bug-Id: #23074 --- dlls/ntdll/unix/loader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index a8f6d3f91c0..ee08c45f6f1 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2093,7 +2093,10 @@ static void hacks_init(void) env_str = getenv("WINE_SIMULATE_WRITECOPY"); if (env_str) simulate_writecopy = atoi(env_str); - else if (main_argc > 1 && strstr(main_argv[1], "UplayWebCore.exe")) simulate_writecopy = TRUE; + else if (main_argc > 1 && + (strstr(main_argv[1], "UplayWebCore.exe") + || (strstr(main_argv[1], "Battle.net.exe")))) + simulate_writecopy = TRUE; else if (sgi) simulate_writecopy = !strcmp(sgi, "1608730") /* Dawn of Corruption */ || !strcmp(sgi, "1680700") /* Purgo box */ || !strcmp(sgi, "2095300") /* Breakout 13 */ From ad94200850de6a3806aae7e54843ae07ed24725a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 6 Jan 2023 18:00:19 -0600 Subject: [PATCH 0844/1506] ntdll: Support gpuvis tracing. --- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/unix/debug.c | 54 ++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/server.c | 13 ++++++++-- dlls/wow64/syscall.c | 13 ++++++++++ include/wine/debug.h | 23 +++++++++++++++++ include/wine/server.h | 6 ++--- 6 files changed, 104 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 805aaf188c8..e33e85d5ca6 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1724,6 +1724,7 @@ @ cdecl -norelay __wine_dbg_header(long long str) @ cdecl -norelay __wine_dbg_output(str) @ cdecl -norelay __wine_dbg_strdup(str) +@ stdcall -syscall -norelay __wine_dbg_ftrace(ptr long long) # Version @ cdecl wine_get_version() diff --git a/dlls/ntdll/unix/debug.c b/dlls/ntdll/unix/debug.c index a3b7421362c..73c2084d025 100644 --- a/dlls/ntdll/unix/debug.c +++ b/dlls/ntdll/unix/debug.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -275,6 +276,59 @@ NTSTATUS unixcall_wine_dbg_write( void *args ) return write( 2, params->str, params->len ); } +unsigned int WINAPI __wine_dbg_ftrace( char *str, unsigned int str_size, unsigned int ctx ) +{ + static unsigned int curr_ctx; + static int ftrace_fd = -1; + unsigned int str_len; + char ctx_str[64]; + int ctx_len; + + if (ftrace_fd == -1) + { + int expected = -1; + const char *fn; + int fd; + + if (!(fn = getenv( "WINE_FTRACE_FILE" ))) + { + MESSAGE( "wine: WINE_FTRACE_FILE is not set.\n" ); + ftrace_fd = -2; + return 0; + } + if ((fd = open( fn, O_WRONLY )) == -1) + { + MESSAGE( "wine: error opening ftrace file: %s.\n", strerror(errno) ); + ftrace_fd = -2; + return 0; + } + if (!__atomic_compare_exchange_n( &ftrace_fd, &expected, fd, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST )) + close( fd ); + else + MESSAGE( "wine: ftrace initialized.\n" ); + } + if (ftrace_fd == -2) return ~0u; + + if (ctx == ~0u) ctx_len = 0; + else if (ctx) ctx_len = sprintf( ctx_str, " (end_ctx=%u)", ctx ); + else + { + ctx = __atomic_add_fetch( &curr_ctx, 1, __ATOMIC_SEQ_CST ); + ctx_len = sprintf( ctx_str, " (begin_ctx=%u)", ctx ); + } + + str_len = strlen(str); + if (ctx_len > 0) + { + if (str_size < ctx_len) return ~0u; + if (str_len + ctx_len > str_size) str_len = str_size - ctx_len; + memcpy( &str[str_len], ctx_str, ctx_len ); + str_len += ctx_len; + } + write( ftrace_fd, str, str_len ); + return ctx; +} + #ifdef _WIN64 /*********************************************************************** * wow64_wine_dbg_write diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 68628acba63..6148cfddce2 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -84,6 +84,8 @@ #include "ddk/wdm.h" WINE_DEFAULT_DEBUG_CHANNEL(server); +WINE_DECLARE_DEBUG_CHANNEL(client); +WINE_DECLARE_DEBUG_CHANNEL(ftrace); #ifndef MSG_CMSG_CLOEXEC #define MSG_CMSG_CLOEXEC 0 @@ -263,8 +265,13 @@ unsigned int server_call_unlocked( void *req_ptr ) struct __server_request_info * const req = req_ptr; unsigned int ret; - if ((ret = send_request( req ))) return ret; - return wait_reply( req ); + FTRACE_BLOCK_START("req %s", req->name) + TRACE_(client)("%s start\n", req->name); \ + if (!(ret = send_request( req ))) + ret = wait_reply( req ); + TRACE_(client)("%s end\n", req->name); + FTRACE_BLOCK_END() + return ret; } @@ -747,7 +754,9 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT pthread_sigmask( SIG_SETMASK, &old_set, NULL ); if (signaled) break; + FTRACE_BLOCK_START("select_reply") ret = wait_select_reply( &cookie ); + FTRACE_BLOCK_END() } while (ret == STATUS_USER_APC || ret == STATUS_KERNEL_APC); diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index db51948057f..5a0624968c9 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -593,6 +593,19 @@ NTSTATUS WINAPI wow64_NtSetContextThread( UINT *args ) } +/********************************************************************** + * wow64___wine_dbg_ftrace + */ +NTSTATUS WINAPI wow64___wine_dbg_ftrace( UINT *args ) +{ + const char *str = get_ptr( &args ); + ULONG len = get_ulong( &args ); + ULONG ctx = get_ulong( &args ); + + return __wine_dbg_ftrace( (char *)str, len, ctx ); +} + + /********************************************************************** * wow64_NtSetDebugFilterState */ diff --git a/include/wine/debug.h b/include/wine/debug.h index ce5e141ccb7..f5aa9f7dbc7 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -114,6 +114,7 @@ extern DECLSPEC_EXPORT const char * __cdecl __wine_dbg_strdup( const char *str ) extern DECLSPEC_EXPORT int __cdecl __wine_dbg_output( const char *str ); extern DECLSPEC_EXPORT int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *function ); +extern unsigned int WINAPI __wine_dbg_ftrace( char *str, unsigned int str_size, unsigned int ctx ); /* * Exported definitions and macros @@ -129,6 +130,18 @@ extern DECLSPEC_EXPORT int __cdecl __wine_dbg_header( enum __wine_debug_class cl # define __wine_dbg_cdecl #endif +static inline unsigned int __wine_dbg_cdecl __wine_dbg_ftrace_printf( unsigned int ctx, const char *format, ...) +{ + char buffer[256]; + + va_list args; + + va_start( args, format ); + vsnprintf( buffer, sizeof(buffer), format, args ); + va_end( args ); + return __wine_dbg_ftrace(buffer, sizeof(buffer), ctx); +} + static const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0); static inline const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) { @@ -548,6 +561,16 @@ static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbg #define MESSAGE WINE_MESSAGE +#define FTRACE(...) do { if (TRACE_ON(ftrace)) __wine_dbg_ftrace_printf( -1, __VA_ARGS__ ); } while (0) + +#define FTRACE_BLOCK_START(...) do { \ + unsigned int ctx = TRACE_ON(ftrace) ? __wine_dbg_ftrace_printf( 0, __VA_ARGS__ ) : 0; \ + do { + +#define FTRACE_BLOCK_END() } while (0); \ + if (TRACE_ON(ftrace)) __wine_dbg_ftrace_printf( ctx, "" ); \ + } while (0); + #endif /* __WINESRC__ */ #ifdef __cplusplus diff --git a/include/wine/server.h b/include/wine/server.h index 9ba161b56c1..a673ce96101 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -48,6 +48,7 @@ struct __server_request_info unsigned int data_count; /* count of request data pointers */ void *reply_data; /* reply data pointer */ struct __server_iovec data[__SERVER_MAX_DATA]; /* request variable size data */ + const char *name; }; NTSYSAPI unsigned int CDECL wine_server_call( void *req_ptr ); @@ -124,21 +125,18 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) #define SERVER_START_REQ(type) \ do { \ - WINE_DECLARE_DEBUG_CHANNEL(client); \ - static const char *const __req_name = #type; \ struct __server_request_info __req; \ struct type##_request * const req = &__req.u.req.type##_request; \ const struct type##_reply * const reply = &__req.u.reply.type##_reply; \ memset( &__req.u.req, 0, sizeof(__req.u.req) ); \ + __req.name = #type; \ __req.u.req.request_header.req = REQ_##type; \ __req.data_count = 0; \ (void)reply; \ - TRACE_(client)("%s start\n", __req_name); \ do #define SERVER_END_REQ \ while(0); \ - TRACE_(client)("%s end\n", __req_name); \ } while(0) From 9c628fea75aded87e9cfc317420c7d3d9506b425 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 13 Dec 2012 14:05:03 +0100 Subject: [PATCH 0845/1506] HACK: Create HTMLDocument in dedicated thread to work around Gecko threading limitation. CW-Bug-Id: 18848 --- dlls/actxprxy/Makefile.in | 1 + dlls/actxprxy/actxprxy_mshtml.idl | 35 ++++++++++++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/oleobj.c | 89 +++++++++++++++++++++++++++++++ dlls/mshtml/task.c | 51 ++++++++++++++++++ include/docobjectservice.idl | 14 ++--- include/mshtmhst.idl | 6 +-- include/mshtml.idl | 18 +++++-- include/shdeprecated.idl | 4 +- 9 files changed, 203 insertions(+), 16 deletions(-) create mode 100644 dlls/actxprxy/actxprxy_mshtml.idl diff --git a/dlls/actxprxy/Makefile.in b/dlls/actxprxy/Makefile.in index 0397f7c3a93..36aa17b61ef 100644 --- a/dlls/actxprxy/Makefile.in +++ b/dlls/actxprxy/Makefile.in @@ -8,6 +8,7 @@ SOURCES = \ actxprxy_hlink.idl \ actxprxy_htiface.idl \ actxprxy_htiframe.idl \ + actxprxy_mshtml.idl \ actxprxy_objsafe.idl \ actxprxy_ocmm.idl \ actxprxy_servprov.idl \ diff --git a/dlls/actxprxy/actxprxy_mshtml.idl b/dlls/actxprxy/actxprxy_mshtml.idl new file mode 100644 index 00000000000..6f4a7ca9fd0 --- /dev/null +++ b/dlls/actxprxy/actxprxy_mshtml.idl @@ -0,0 +1,35 @@ +/* + * Copyright 2009 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* just a wrapper for mshtmhst.idl */ + +#pragma makedep proxy +#pragma makedep register + +#define NO_MSHTML_IMPORT + +#include "mshtml.idl" +#include "mshtmhst.idl" +#include "shdeprecated.idl" +#include "docobjectservice.idl" + +[ + threading(both), + uuid(b8da6310-e19b-11d0-933c-00a0c90dcaa9) /* IActiveScriptStats */ +] +coclass PSFactoryBuffer { interface IFactoryBuffer; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index db37375c089..ff735ca49da 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -982,6 +982,7 @@ HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**); HRESULT create_document_node(nsIDOMDocument*,GeckoBrowser*,HTMLInnerWindow*, compat_mode_t,HTMLDocumentNode**); HRESULT create_doctype_node(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**); +HRESULT create_marshaled_doc(HWND,REFIID,void**); HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,HTMLOuterWindow**); HRESULT update_window_doc(HTMLInnerWindow*); diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 36ff99338e3..14eb4cc22a7 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -3669,16 +3669,105 @@ static const cpc_entry_t HTMLDocumentObj_cpc[] = { {NULL} }; + + +/* TRUE if we create a dedicated thread for all HTML documents */ +static BOOL gecko_main_thread_config; + +static LONG gecko_main_thread; +static HWND gecko_main_thread_hwnd; +static HANDLE gecko_main_thread_event; + +static DWORD WINAPI gecko_main_thread_proc(void *arg) +{ + MSG msg; + + TRACE("\n"); + + CoInitialize(NULL); + + gecko_main_thread_hwnd = get_thread_hwnd(); + if(!gecko_main_thread_hwnd) { + ERR("Could not create thread window\n"); + SetEvent(gecko_main_thread_event); + CoUninitialize(); + return 0; + } + + gecko_main_thread = GetCurrentThreadId(); + SetEvent(gecko_main_thread_event); + + while(GetMessageW(&msg, NULL, 0, 0)) { + DispatchMessageW(&msg); + TranslateMessage(&msg); + } + + CoUninitialize(); + return 0; +} + +static BOOL WINAPI read_thread_config(INIT_ONCE *once, void *param, void **context) +{ + HKEY key; + DWORD res; + static const WCHAR enable_keyW[] = + {'S','o','f','t','w','a','r','e', + '\\','W','i','n','e', + '\\','M','S','H','T','M','L', + '\\','M','a','i','n','T','h','r','e','a','d','H','a','c','k',0}; + + res = RegOpenKeyW(HKEY_CURRENT_USER, enable_keyW, &key); + if(res == ERROR_SUCCESS) { + RegCloseKey(key); + FIXME("CXHACK: Using separated main thread.\n"); + gecko_main_thread_config = TRUE; + } + + return TRUE; +} + static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID riid, void **ppv) { HTMLDocumentObj *doc; HRESULT hres; + static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; + if(outer && !IsEqualGUID(&IID_IUnknown, riid)) { *ppv = NULL; return E_INVALIDARG; } + /* CXHACK 15579 */ + InitOnceExecuteOnce(&init_once, read_thread_config, NULL, NULL); + if(gecko_main_thread_config && !gecko_main_thread) { + HANDLE thread, event; + + event = CreateEventW(NULL, TRUE, FALSE, NULL); + if(InterlockedCompareExchangePointer(&gecko_main_thread_event, event, NULL)) + CloseHandle(event); + + thread = CreateThread(NULL, 0, gecko_main_thread_proc, NULL, 0, NULL); + if(thread) { + WaitForSingleObject(gecko_main_thread_event, INFINITE); + CloseHandle(thread); + }else { + ERR("Could not create a thread\n"); + } + } + + if(!gecko_main_thread) { + gecko_main_thread = GetCurrentThreadId(); + gecko_main_thread_hwnd = get_thread_hwnd(); + }else if(GetCurrentThreadId() != gecko_main_thread) { + FIXME("CXHACK: Creating HTMLDocument outside Gecko main thread\n"); + if(!gecko_main_thread_config) { + FIXME("CXHACK: Dedicated main thread not configured\n"); + FIXME("CXHACK: Create HKCU\\Software\\Wine\\MSHTML\\MainThreadHack key\n"); + } + return create_marshaled_doc(gecko_main_thread_hwnd, riid, ppv); + } + /* ensure that security manager is initialized */ if(!get_security_manager()) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c index 49f76d101a9..c14ddc3d05c 100644 --- a/dlls/mshtml/task.c +++ b/dlls/mshtml/task.c @@ -33,6 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); #define WM_PROCESSTASK 0x8008 +#define WM_CREATEDOC 0x8018 #define TIMER_ID 0x3000 typedef struct { @@ -351,6 +352,13 @@ static LRESULT process_timer(void) return 0; } +typedef struct { + IUnknown *unk; + IID iid; + IStream *stream; + HRESULT hres; +} create_doc_params_t; + static LRESULT WINAPI hidden_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { thread_data_t *thread_data; @@ -390,6 +398,20 @@ static LRESULT WINAPI hidden_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa return 0; case WM_TIMER: return process_timer(); + case WM_CREATEDOC: { + create_doc_params_t *params = (create_doc_params_t*)lParam; + IUnknown *unk; + + TRACE("WM_CREATEDOC %p\n", params); + + params->hres = HTMLDocument_Create(NULL, ¶ms->iid, (void**)&unk); + if(FAILED(params->hres)) + return 0; + + params->hres = CoMarshalInterface(params->stream, ¶ms->iid, unk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL); + IUnknown_Release(unk); + return 0; + } } if(msg > WM_USER) @@ -432,6 +454,35 @@ HWND get_thread_hwnd(void) return thread_data->thread_hwnd; } +HRESULT create_marshaled_doc(HWND main_thread_hwnd, REFIID riid, void **ppv) +{ + create_doc_params_t params = {NULL, *riid, NULL, E_FAIL}; + LARGE_INTEGER zero; + BOOL res; + HRESULT hres; + + hres = CreateStreamOnHGlobal(NULL, TRUE, ¶ms.stream); + if(FAILED(hres)) + return hres; + + res = SendMessageW(main_thread_hwnd, WM_CREATEDOC, 0, (LPARAM)¶ms); + TRACE("SendMessage ret %x\n", res); + if(FAILED(params.hres)) { + WARN("EM_CREATEDOC failed: %08lx\n", params.hres); + IStream_Release(params.stream); + return hres; + } + + zero.QuadPart = 0; + hres = IStream_Seek(params.stream, zero, STREAM_SEEK_SET, NULL); + if(SUCCEEDED(hres)) + hres = CoUnmarshalInterface(params.stream, riid, ppv); + IStream_Release(params.stream); + if(FAILED(hres)) + WARN("CoUnmarshalInterface failed: %08lx\n", hres); + return hres; +} + thread_data_t *get_thread_data(BOOL create) { thread_data_t *thread_data; diff --git a/include/docobjectservice.idl b/include/docobjectservice.idl index 4e931351b49..cfa007c75eb 100644 --- a/include/docobjectservice.idl +++ b/include/docobjectservice.idl @@ -17,23 +17,25 @@ */ import "objidl.idl"; +#ifndef NO_MSHTML_IMPORT import "mshtml.idl"; +#endif [ - local, + /* local, CXHACK 15579 */ object, uuid(3050f801-98b5-11cf-bb82-00aa00bdce0b) ] interface IDocObjectService : IUnknown { HRESULT FireBeforeNavigate2( - [in] IDispatch *pDispatch, - [in] LPCWSTR lpszUrl, + [in, optional] IDispatch *pDispatch, + [in, string, unique] LPCWSTR lpszUrl, [in] DWORD dwFlags, - [in] LPCWSTR lpszFrameName, - [in] BYTE *pPostData, + [in, string, unique] LPCWSTR lpszFrameName, + [in, unique, size_is(cbPostData)] BYTE *pPostData, [in] DWORD cbPostData, - [in] LPCWSTR lpszHeaders, + [in, string, unique] LPCWSTR lpszHeaders, [in] BOOL fPlayNavSound, [out] BOOL *pfCancel); diff --git a/include/mshtmhst.idl b/include/mshtmhst.idl index 6cc500ed7a9..efc51c6a5da 100644 --- a/include/mshtmhst.idl +++ b/include/mshtmhst.idl @@ -163,7 +163,7 @@ typedef enum tagDOCHOSTUIFLAG object, uuid(BD3F23C0-D43E-11CF-893B-00AA00BDCE1A), pointer_default(unique), - local + /* local, CXHACK 15579 */ ] interface IDocHostUIHandler : IUnknown { @@ -237,7 +237,7 @@ cpp_quote("DEFINE_GUID(CGID_DocHostCommandHandler,0xf38bc242,0xb950,0x11d1,0x89, object, uuid(3050F6D0-98b5-11CF-BB82-00AA00BDCE0B), pointer_default(unique), - local + /* local, CXHACK 15579 */ ] interface IDocHostUIHandler2 : IDocHostUIHandler { @@ -253,7 +253,7 @@ interface IDocHostUIHandler2 : IDocHostUIHandler object, uuid(3050f3f0-98b5-11cf-bb82-00aa00bdce0b), pointer_default(unique), - local + /* local, CXHACK 15579 */ ] interface ICustomDoc : IUnknown { diff --git a/include/mshtml.idl b/include/mshtml.idl index 2a1fccba6be..7fb245f5d5c 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -30353,7 +30353,11 @@ interface IElementBehaviorFactory : IUnknown } /* library MSHTML */ +#ifdef MSHTML_MARSHALING_HACK +#define IOleCommandTarget IUnknown +#else interface IOleCommandTarget; +#endif /***************************************************************************** * IHTMLPrivateWindow interface @@ -30361,7 +30365,7 @@ interface IOleCommandTarget; [ object, uuid(3050f6dc-98b5-11cf-bb82-00aa00bdce0b), - local + /* local, CXHACK 15579 */ ] interface IHTMLPrivateWindow : IUnknown { @@ -30370,7 +30374,7 @@ interface IHTMLPrivateWindow : IUnknown HRESULT SetPICSTarget(IOleCommandTarget *cmdtrg); HRESULT PICSComplete(int arg); HRESULT FindWindowByName(LPCWSTR name, IHTMLWindow2 **ret); - HRESULT GetAddressBarUrl(BSTR *url); + HRESULT GetAddressBarUrl([out, retval] BSTR *url); } /***************************************************************************** @@ -30379,7 +30383,7 @@ interface IHTMLPrivateWindow : IUnknown [ object, uuid(3050f804-98b5-11cf-bb82-00aa00bdce0b), - local + /* local, CXHACK 15579 */ ] interface IWebBrowserPriv : IUnknown { @@ -30394,7 +30398,7 @@ interface IWebBrowserPriv : IUnknown [ object, uuid(3ed72303-6ffc-4214-ba90-faf1862dec8a), - local + /* local, CXHACK 15579 */ ] interface IWebBrowserPriv2IE8 : IUnknown { @@ -30416,7 +30420,7 @@ interface IWebBrowserPriv2IE8 : IUnknown [ object, uuid(3ed72303-6ffc-4214-ba90-faf1862dec8a), - local + /* local, CXHACK 15579 */ ] interface IWebBrowserPriv2IE9 : IUnknown { @@ -30424,3 +30428,7 @@ interface IWebBrowserPriv2IE9 : IUnknown VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment, DWORD unused); /* Probably more */ } + +#ifdef MSHTML_MARSHALING_HACK +#undef IOleCommandTarget +#endif diff --git a/include/shdeprecated.idl b/include/shdeprecated.idl index c8bb3fd9bf0..bb0559578e9 100644 --- a/include/shdeprecated.idl +++ b/include/shdeprecated.idl @@ -186,7 +186,7 @@ cpp_quote("#define HLNF_ALLOW_AUTONAVIGATE 0x20000000") cpp_quote("#define HLNF_NEWWINDOWSMANAGED 0x80000000") [ - local, + /* local, CXHACK 15579 */ object, uuid(02ba3b52-0547-11d1-b833-00c04fc9b31f) ] @@ -220,7 +220,7 @@ interface IBrowserService : IUnknown HRESULT IEGetDisplayName( [in] PCIDLIST_ABSOLUTE pidl, - [out, size_is(INTERNET_MAX_URL_LENGTH)] LPWSTR pwszName, + [out, size_is(300)] LPWSTR pwszName, [in] UINT uFlags); HRESULT IEParseDisplayName( From be3559530c4b95f9efa949d8420e2ff0686dbb19 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Apr 2021 01:54:11 +0300 Subject: [PATCH 0846/1506] mshtml: Use environment variable instead of registry for dedicated thread hack. And auto enable it for The Bus. CW-Bug-Id: 18848 --- dlls/mshtml/oleobj.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 14eb4cc22a7..dd5058a102f 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -3708,18 +3708,12 @@ static DWORD WINAPI gecko_main_thread_proc(void *arg) static BOOL WINAPI read_thread_config(INIT_ONCE *once, void *param, void **context) { - HKEY key; - DWORD res; - static const WCHAR enable_keyW[] = - {'S','o','f','t','w','a','r','e', - '\\','W','i','n','e', - '\\','M','S','H','T','M','L', - '\\','M','a','i','n','T','h','r','e','a','d','H','a','c','k',0}; - - res = RegOpenKeyW(HKEY_CURRENT_USER, enable_keyW, &key); - if(res == ERROR_SUCCESS) { - RegCloseKey(key); - FIXME("CXHACK: Using separated main thread.\n"); + char str[64]; + + if((GetEnvironmentVariableA("SteamGameId", str, sizeof(str)) && !strcmp(str, "491540")) + || (GetEnvironmentVariableA("WINE_GECKO_MAIN_THREAD", str, sizeof(str)) && *str != '0')) + { + FIXME("HACK: Using separated main thread.\n"); gecko_main_thread_config = TRUE; } @@ -3760,10 +3754,10 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii gecko_main_thread = GetCurrentThreadId(); gecko_main_thread_hwnd = get_thread_hwnd(); }else if(GetCurrentThreadId() != gecko_main_thread) { - FIXME("CXHACK: Creating HTMLDocument outside Gecko main thread\n"); + FIXME("HACK: Creating HTMLDocument outside Gecko main thread\n"); if(!gecko_main_thread_config) { - FIXME("CXHACK: Dedicated main thread not configured\n"); - FIXME("CXHACK: Create HKCU\\Software\\Wine\\MSHTML\\MainThreadHack key\n"); + FIXME("HACK: Dedicated main thread not configured\n"); + FIXME("HACK: Create HKCU\\Software\\Wine\\MSHTML\\MainThreadHack key\n"); } return create_marshaled_doc(gecko_main_thread_hwnd, riid, ppv); } From 1046ff725ad23fafebd5910a0adc79b3f387e71e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Jul 2021 21:18:36 +0300 Subject: [PATCH 0847/1506] mshtml: Also enable dedicated thread hack for The Sims 3. For The Sims 3 launcher crash. CW-Bug-Id: #19151 --- dlls/mshtml/oleobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index dd5058a102f..97d8392faf8 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -3710,7 +3710,7 @@ static BOOL WINAPI read_thread_config(INIT_ONCE *once, void *param, void **conte { char str[64]; - if((GetEnvironmentVariableA("SteamGameId", str, sizeof(str)) && !strcmp(str, "491540")) + if((GetEnvironmentVariableA("SteamGameId", str, sizeof(str)) && (!strcmp(str, "491540") || !strcmp(str,"47890"))) || (GetEnvironmentVariableA("WINE_GECKO_MAIN_THREAD", str, sizeof(str)) && *str != '0')) { FIXME("HACK: Using separated main thread.\n"); From bb817903106ea26c9ebc13f79e934223cfe7e1d0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 7 Jan 2022 23:54:20 +0300 Subject: [PATCH 0848/1506] mshtml: Also call before_async_open() for iframe in nsChannel_AsyncOpen(). CW-Bug-Id: #19930 --- dlls/ieframe/tests/webbrowser.c | 144 +++++++++++++++++++++++++++----- dlls/mshtml/nsio.c | 65 ++++++++++++++ 2 files changed, 188 insertions(+), 21 deletions(-) diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c index 402014a8c07..578bc5af125 100644 --- a/dlls/ieframe/tests/webbrowser.c +++ b/dlls/ieframe/tests/webbrowser.c @@ -172,6 +172,7 @@ static HRESULT hr_site_TranslateAccelerator = E_NOTIMPL; static const WCHAR *current_url; static int wb_version, expect_update_commands_enable, set_update_commands_enable; static BOOL nav_back_todo, nav_forward_todo; /* FIXME */ +static BOOL navigation_cancelled; enum SessionOp { @@ -191,6 +192,8 @@ static LONG (WINAPI *pSetQueryNetSessionCount)(DWORD); #define DWL_HTTP 0x10 #define DWL_REFRESH 0x20 #define DWL_BACK_ENABLE 0x40 +#define DWL_IFRAME_NAV_CANCEL 0x80 +#define DWL_FROM_IFRAME_NAV_CANCEL 0x100 static DWORD dwl_flags; @@ -290,6 +293,8 @@ static void _test_ready_state(unsigned line, READYSTATE exstate, VARIANT_BOOL ex hres = IWebBrowser2_get_Busy(wb, &busy); if(expect_busy != BUSY_FAIL) { ok_(__FILE__,line)(hres == S_OK, "get_ReadyState failed: %08lx\n", hres); + todo_wine_if(dwl_flags & DWL_FROM_IFRAME_NAV_CANCEL && state == READYSTATE_LOADING + && busy != expect_busy) ok_(__FILE__,line)(busy == expect_busy, "Busy = %x, expected %x for ready state %d\n", busy, expect_busy, state); }else { @@ -415,13 +420,13 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER || !nCmdexecopt, "nCmdexecopts=%08lx\n", nCmdexecopt); else - ok(!nCmdexecopt, "nCmdexecopts=%08lx\n", nCmdexecopt); + todo_wine_if(dwl_flags & DWL_IFRAME_NAV_CANCEL) ok(!nCmdexecopt, "nCmdexecopts=%08lx\n", nCmdexecopt); ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut); ok(pvaIn != NULL, "pvaIn == NULL\n"); ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn)); switch(V_I4(pvaIn)) { case 0: - CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_0); + todo_wine_if(dwl_flags & DWL_IFRAME_NAV_CANCEL) CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_0); break; case 1: CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1); @@ -480,6 +485,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID }else if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) { switch(nCmdID) { case 63: /* win10 */ + case 65: case 105: /* TODO */ case 132: /* win10 */ case 133: /* IE11 */ @@ -719,11 +725,11 @@ static void _test_invoke_bool(unsigned line, const DISPPARAMS *params, BOOL stri static void test_OnBeforeNavigate(const VARIANT *disp, const VARIANT *url, const VARIANT *flags, const VARIANT *frame, const VARIANT *post_data, const VARIANT *headers, const VARIANT *cancel) { + BOOL cancel_nav = FALSE; BSTR str; ok(V_VT(disp) == VT_DISPATCH, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp)); ok(V_DISPATCH(disp) != NULL, "V_DISPATCH(disp) == NULL\n"); - ok(V_DISPATCH(disp) == (IDispatch*)wb, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp), wb); ok(V_VT(url) == (VT_BYREF|VT_VARIANT), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url)); ok(V_VARIANTREF(url) != NULL, "V_VARIANTREF(url) == NULL)\n"); @@ -731,10 +737,21 @@ static void test_OnBeforeNavigate(const VARIANT *disp, const VARIANT *url, const ok(V_VT(V_VARIANTREF(url)) == VT_BSTR, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n", V_VT(V_VARIANTREF(url))); ok(V_BSTR(V_VARIANTREF(url)) != NULL, "V_BSTR(V_VARIANTREF(url)) == NULL\n"); - ok(!lstrcmpW(V_BSTR(V_VARIANTREF(url)), current_url), "unexpected url %s, expected %s\n", - wine_dbgstr_w(V_BSTR(V_VARIANTREF(url))), wine_dbgstr_w(current_url)); + if (!wcscmp(V_BSTR(V_VARIANTREF(url)), L"invalid:///")) + cancel_nav = TRUE; + if (!(dwl_flags & DWL_IFRAME_NAV_CANCEL && cancel_nav)) + ok(!lstrcmpW(V_BSTR(V_VARIANTREF(url)), current_url), "unexpected url %s, expected %s\n", + wine_dbgstr_w(V_BSTR(V_VARIANTREF(url))), wine_dbgstr_w(current_url)); } + if (dwl_flags & DWL_IFRAME_NAV_CANCEL && cancel_nav) + { + ok(!!V_DISPATCH(disp), "Got NULL disp.\n"); + todo_wine ok(V_DISPATCH(disp) != (IDispatch*)wb, "Got the same browser.\n"); + } + else + ok(V_DISPATCH(disp) == (IDispatch*)wb, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp), wb); + ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(flags)); ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n", @@ -805,8 +822,15 @@ static void test_OnBeforeNavigate(const VARIANT *disp, const VARIANT *url, const V_VT(cancel)); ok(V_BOOLREF(cancel) != NULL, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n"); if(V_BOOLREF(cancel)) + { ok(*V_BOOLREF(cancel) == VARIANT_FALSE, "*V_BOOLREF(cancel) = %x, expected VARIANT_FALSE\n", *V_BOOLREF(cancel)); + if (cancel_nav) + { + *V_BOOLREF(cancel) = TRUE; + navigation_cancelled = TRUE; + } + } } static void test_navigatecomplete2(DISPPARAMS *dp) @@ -821,6 +845,7 @@ static void test_navigatecomplete2(DISPPARAMS *dp) ok(V_VT(dp->rgvarg) == (VT_BYREF|VT_VARIANT), "V_VT(dp->rgvarg) = %d\n", V_VT(dp->rgvarg)); v = V_VARIANTREF(dp->rgvarg); ok(V_VT(v) == VT_BSTR, "V_VT(url) = %d\n", V_VT(v)); + todo_wine_if(!memcmp(V_BSTR(v), L"file:", 10)) ok(!lstrcmpW(V_BSTR(v), current_url), "url=%s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), wine_dbgstr_w(current_url)); @@ -845,6 +870,8 @@ static void test_documentcomplete(DISPPARAMS *dp) ok(V_VT(dp->rgvarg) == (VT_BYREF|VT_VARIANT), "V_VT(dp->rgvarg) = %d\n", V_VT(dp->rgvarg)); v = V_VARIANTREF(dp->rgvarg); ok(V_VT(v) == VT_BSTR, "V_VT(url) = %d\n", V_VT(v)); + + todo_wine_if(!memcmp(V_BSTR(v), L"file:", 10)) ok(!lstrcmpW(V_BSTR(v), current_url), "url=%s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), wine_dbgstr_w(current_url)); @@ -907,9 +934,19 @@ static HRESULT WINAPI WebBrowserEvents2_Invoke(IDispatch *iface, DISPID dispIdMe pDispParams->rgvarg+3, pDispParams->rgvarg+2, pDispParams->rgvarg+1, pDispParams->rgvarg); if(dwl_flags & (DWL_FROM_PUT_HREF|DWL_FROM_GOFORWARD)) + { test_ready_state(READYSTATE_COMPLETE, VARIANT_FALSE); + } + else if (dwl_flags & DWL_IFRAME_NAV_CANCEL) + { + test_ready_state(READYSTATE_LOADING, navigation_cancelled ? VARIANT_TRUE : VARIANT_FALSE); + if (!navigation_cancelled) + SET_EXPECT(Invoke_BEFORENAVIGATE2); + } else - test_ready_state(READYSTATE_LOADING, VARIANT_FALSE); + { + test_ready_state(READYSTATE_LOADING, dwl_flags & DWL_FROM_IFRAME_NAV_CANCEL ? VARIANT_TRUE : VARIANT_FALSE); + } break; case DISPID_SETSECURELOCKICON: @@ -948,7 +985,7 @@ static HRESULT WINAPI WebBrowserEvents2_Invoke(IDispatch *iface, DISPID dispIdMe CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE); } } - else if (V_I4(pDispParams->rgvarg+1) == CSC_NAVIGATEBACK) + else if (V_I4(pDispParams->rgvarg+1) == CSC_NAVIGATEBACK && !(dwl_flags & DWL_FROM_IFRAME_NAV_CANCEL)) { todo_wine_if(nav_back_todo) { if(V_BOOL(pDispParams->rgvarg)) @@ -1681,6 +1718,8 @@ static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, D { todo_wine_if(is_downloading && !(dwl_flags & DWL_EXPECT_BEFORE_NAVIGATE)) CHECK_EXPECT(TranslateUrl); + if (dwl_flags & DWL_IFRAME_NAV_CANCEL && wcscmp(pchURLIn, L"invalid:///")) + SET_EXPECT(TranslateUrl); return E_NOTIMPL; } @@ -2814,12 +2853,16 @@ static void test_ConnectionPoint(IWebBrowser2 *unk, BOOL init) static void test_Navigate2(IWebBrowser2 *webbrowser, const WCHAR *nav_url) { const WCHAR *title = L"WineHQ - Run Windows applications on Linux, BSD, Solaris and Mac OS X"; + const WCHAR *file_title = L"wine_test"; VARIANT url; BOOL is_file; HRESULT hres; test_LocationURL(webbrowser, is_first_load ? L"" : current_url); - test_LocationName(webbrowser, is_first_load ? L"" : (is_http ? title : current_url)); + if (current_url && !memcmp(current_url, L"file:", 10)) + test_LocationName(webbrowser, file_title); + else + test_LocationName(webbrowser, is_first_load ? L"" : (is_http ? title : current_url)); test_ready_state(is_first_load ? READYSTATE_UNINITIALIZED : READYSTATE_COMPLETE, VARIANT_FALSE); is_http = !memcmp(nav_url, "http:", 5); @@ -2990,6 +3033,8 @@ static void test_download(DWORD flags) BOOL *b = &called_Invoke_DOCUMENTCOMPLETE; MSG msg; + navigation_cancelled = FALSE; + if(flags & DWL_REFRESH) b = use_container_olecmd ? &called_Exec_SETDOWNLOADSTATE_0 : &called_Invoke_DOWNLOADCOMPLETE; else if((flags & DWL_FROM_PUT_HREF) && !use_container_olecmd && 0) @@ -3001,8 +3046,9 @@ static void test_download(DWORD flags) if(flags & (DWL_FROM_PUT_HREF|DWL_FROM_GOBACK|DWL_FROM_GOFORWARD|DWL_REFRESH)) test_ready_state(READYSTATE_COMPLETE, VARIANT_FALSE); else - test_ready_state(READYSTATE_LOADING, VARIANT_FALSE); - + { + test_ready_state(READYSTATE_LOADING, flags & DWL_FROM_IFRAME_NAV_CANCEL ? VARIANT_TRUE : VARIANT_FALSE); + } if(flags & (DWL_EXPECT_BEFORE_NAVIGATE|(is_http ? DWL_FROM_PUT_HREF : 0)|DWL_FROM_GOFORWARD|DWL_REFRESH)) SET_EXPECT(Invoke_PROPERTYCHANGE); @@ -3065,7 +3111,7 @@ static void test_download(DWORD flags) SET_EXPECT(GetOverridesKeyPath); /* Called randomly on some VMs. */ trace("Downloading...\n"); - while(!*b && GetMessageW(&msg, NULL, 0, 0)) { + while(!navigation_cancelled && !*b && GetMessageW(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessageW(&msg); } @@ -3096,11 +3142,14 @@ static void test_download(DWORD flags) CLEAR_CALLED(EnableModeless_FALSE); /* IE 8 */ if(!(flags & DWL_REFRESH)) { - todo_wine_if(nav_back_todo) { - if(flags & (DWL_FROM_GOFORWARD|DWL_BACK_ENABLE)) - CHECK_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_TRUE); - else - CHECK_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE); + if (!(flags & DWL_FROM_IFRAME_NAV_CANCEL)) + { + todo_wine_if(nav_back_todo) { + if(flags & (DWL_FROM_GOFORWARD|DWL_BACK_ENABLE)) + CHECK_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_TRUE); + else + CHECK_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE); + } } if(flags & DWL_FROM_GOBACK) CHECK_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_TRUE); @@ -3117,20 +3166,26 @@ static void test_download(DWORD flags) if(!is_first_load) todo_wine CHECK_CALLED(GetHostInfo); if(use_container_olecmd) - CHECK_CALLED(Exec_SETDOWNLOADSTATE_0); + todo_wine_if(flags & DWL_IFRAME_NAV_CANCEL) CHECK_CALLED(Exec_SETDOWNLOADSTATE_0); else - CHECK_CALLED(Invoke_DOWNLOADCOMPLETE); + todo_wine_if(flags & DWL_IFRAME_NAV_CANCEL) CHECK_CALLED(Invoke_DOWNLOADCOMPLETE); todo_wine CHECK_CALLED(Invoke_TITLECHANGE); if(!(flags & DWL_REFRESH)) CHECK_CALLED(Invoke_NAVIGATECOMPLETE2); if(is_first_load) todo_wine CHECK_CALLED(GetDropTarget); - if(!(flags & DWL_REFRESH)) + if(!(flags & (DWL_REFRESH | DWL_IFRAME_NAV_CANCEL))) CHECK_CALLED(Invoke_DOCUMENTCOMPLETE); is_downloading = FALSE; - test_ready_state(READYSTATE_COMPLETE, VARIANT_FALSE); + if (flags & DWL_IFRAME_NAV_CANCEL) + { + test_ready_state(READYSTATE_INTERACTIVE, VARIANT_TRUE); + SET_EXPECT(Invoke_TITLECHANGE); + } + else + test_ready_state(READYSTATE_COMPLETE, VARIANT_FALSE); while(use_container_olecmd && !called_Exec_UPDATECOMMANDS && GetMessageA(&msg, NULL, 0, 0)) { TranslateMessage(&msg); @@ -3840,6 +3895,51 @@ static void init_test(IWebBrowser2 *webbrowser, DWORD flags) use_container_dochostui = !(flags & TEST_NODOCHOST); } +static const char iframe_doc_str[] = + ""; + +static void test_iframe_load(IWebBrowser2 *webbrowser) +{ + WCHAR file_path[MAX_PATH]; + WCHAR file_url[MAX_PATH]; + HRESULT hres; + HANDLE file; + VARIANT url; + DWORD size; + BOOL bret; + + GetTempPathW(MAX_PATH, file_path); + lstrcatW(file_path, L"wine_ifr_test.html"); + + file = CreateFileW(file_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, error %u.\n", GetLastError()); + if(file == INVALID_HANDLE_VALUE && GetLastError() != ERROR_FILE_EXISTS){ + ok(0, "CreateFile failed\n"); + return; + } + WriteFile(file, iframe_doc_str, strlen(iframe_doc_str), &size, NULL); + CloseHandle(file); + + GetLongPathNameW(file_path, file_path, ARRAY_SIZE(file_path)); + lstrcpyW(file_url, L"file://"); + lstrcatW(file_url, file_path); + + trace("iframe load...\n"); + test_Navigate2(webbrowser, file_url); + test_download(DWL_EXPECT_BEFORE_NAVIGATE|DWL_IFRAME_NAV_CANCEL|DWL_BACK_ENABLE); + + V_VT(&url) = VT_BSTR; + V_BSTR(&url) = SysAllocString(current_url = L"about:blank"); + hres = IWebBrowser2_Navigate2(webbrowser, &url, NULL, NULL, NULL, NULL); + ok(hres == S_OK, "Navigate2 failed: %08x\n", hres); + VariantClear(&url); + + test_download(DWL_EXPECT_BEFORE_NAVIGATE|DWL_FROM_IFRAME_NAV_CANCEL); + + bret = DeleteFileW(file_path); + ok(bret, "DeleteFileW failed, err %u.\n", GetLastError()); +} + static void test_WebBrowser(DWORD flags, BOOL do_close) { IWebBrowser2 *webbrowser; @@ -3868,6 +3968,7 @@ static void test_WebBrowser(DWORD flags, BOOL do_close) test_LocationURL(webbrowser, L""); test_ConnectionPoint(webbrowser, TRUE); + test_ClientSite(webbrowser, &ClientSite, !do_download); test_Extent(webbrowser); test_wb_funcs(webbrowser, TRUE); @@ -3934,6 +4035,8 @@ static void test_WebBrowser(DWORD flags, BOOL do_close) trace("GoForward...\n"); test_go_forward(webbrowser, L"http://test.winehq.org/tests/winehq_snapshot/", -1, 0); test_download(DWL_FROM_GOFORWARD|DWL_HTTP); + if (!(flags & TEST_NOOLECMD)) + test_iframe_load(webbrowser); }else { trace("Navigate2 repeated with the same URL...\n"); test_Navigate2(webbrowser, L"about:blank"); @@ -3942,7 +4045,6 @@ static void test_WebBrowser(DWORD flags, BOOL do_close) test_EnumVerbs(webbrowser); test_TranslateAccelerator(webbrowser); - test_dochost_qs(webbrowser); }else { test_ExecWB(webbrowser, TRUE); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index e42319dec13..b65f901a177 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -288,6 +288,50 @@ static nsresult before_async_open(nsChannel *channel, GeckoBrowser *container, B return NS_OK; } +static nsresult fire_before_navigate(nsChannel *channel, HTMLOuterWindow *window, BOOL *cancel) +{ + BSTR frame_name = NULL; + OLECHAR *new_url; + BSTR uri_str; + HRESULT hres; + + hres = IUri_GetDisplayUri(channel->uri->uri, &uri_str); + if(FAILED(hres)) + { + ERR("IUri_GetDisplayUri failed, hres %#lx.\n", hres); + return NS_ERROR_FAILURE; + } + if(window->browser->doc->hostui) + { + hres = IDocHostUIHandler_TranslateUrl(window->browser->doc->hostui, 0, uri_str, &new_url); + if(hres == S_OK && new_url) + { + if(wcscmp(uri_str, new_url)) + { + FIXME("TranslateUrl returned new URL %s -> %s.\n", debugstr_w(uri_str), debugstr_w(new_url)); + CoTaskMemFree(new_url); + *cancel = TRUE; + SysFreeString(uri_str); + return NS_OK; + } + CoTaskMemFree(new_url); + } + } + + hres = IHTMLWindow2_get_name(&window->base.IHTMLWindow2_iface, &frame_name); + if (FAILED(hres)) + { + SysFreeString(uri_str); + return NS_ERROR_FAILURE; + } + + hres = IDocObjectService_FireBeforeNavigate2(window->browser->doc->doc_object_service, NULL, uri_str, 0x40, + frame_name, NULL, 0, NULL, TRUE, cancel); + SysFreeString(frame_name); + SysFreeString(uri_str); + return SUCCEEDED(hres) ? NS_OK : NS_ERROR_FAILURE; +} + HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post_stream, nsChannelBSC *channelbsc, DWORD flags) { @@ -1087,6 +1131,27 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen This->content_type = strdupWtoA(window->browser->doc->mime); } } + else if (window->browser && window->frame_element && window->browser->doc + && window->browser->doc->doc_object_service) + { + IUnknown *unk; + if (SUCCEEDED(IHTMLFrameBase_QueryInterface(&window->frame_element->IHTMLFrameBase_iface, + &IID_IHTMLIFrameElement, (void **)&unk))) + { + IUnknown_Release(unk); + nsres = fire_before_navigate(This, window, &cancel); + if(NS_SUCCEEDED(nsres) && cancel) + { + TRACE("canceled.\n"); + nsres = NS_BINDING_ABORTED; + } + else + { + FIXME("fire_before_navigate returned error %#lx.\n", nsres); + nsres = NS_OK; + } + } + } } if(!cancel) From 476fa47ec1a875b2e9d5938b88bbecda665c5ad8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 25 May 2021 20:48:17 +0300 Subject: [PATCH 0849/1506] mshtml: HACK: Split rules in HTMLStyleSheet_put_cssText(). For Open Swords of Legends Online: Beta launcher. CW-Bug-Id: #18963 --- dlls/mshtml/htmlstylesheet.c | 49 +++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 496eabb485a..d5c486f443f 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -1161,17 +1161,48 @@ static HRESULT WINAPI HTMLStyleSheet_put_cssText(IHTMLStyleSheet *iface, BSTR v) }while(NS_SUCCEEDED(nsres)); if(v && *v) { + UINT32 i, depth, idx; nsAString nsstr; - UINT32 idx; - - /* FIXME: This won't work for multiple rules in the string. */ - nsAString_InitDepend(&nsstr, v); - nsres = nsIDOMCSSStyleSheet_InsertRule(This->nsstylesheet, &nsstr, 0, &idx); - nsAString_Finish(&nsstr); - if(NS_FAILED(nsres)) { - FIXME("InsertRule failed for string %s. Probably multiple rules passed.\n", debugstr_w(v)); - return E_FAIL; + WCHAR *ws; + + depth = 0; + ws = malloc(sizeof(*ws) * (lstrlenW(v) + 1)); + do + { + for (i = 0; v[i]; ++i) + { + ws[i] = v[i]; + if (ws[i] == '{') + ++depth; + else if (ws[i] == '}' && !--depth) + break; + } + if (ws[i]) + ws[++i] = 0; + + v += i; + + for (i = 0; ws[i]; ++i) + if (!iswspace(ws[i])) + break; + + if (!ws[i]) + { + TRACE("Skipping empty part.\n"); + continue; + } + + nsAString_InitDepend(&nsstr, ws); + nsres = nsIDOMCSSStyleSheet_InsertRule(This->nsstylesheet, &nsstr, 0, &idx); + nsAString_Finish(&nsstr); + + if(NS_FAILED(nsres)) + FIXME("InsertRule failed for string %s.\n", debugstr_w(ws)); + else + TRACE("Added rule %s.\n", debugstr_w(ws)); } + while (*v); + free(ws); } return S_OK; From b649aaed63786b035c3d9d372ac76833525b9ab4 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Sat, 24 Aug 2019 00:58:42 +0200 Subject: [PATCH 0850/1506] wined3d: Avoid NaNs in RCP and RSQ in <= SM3. CW-Bug-Id: #21762 Fixes sporadic white screen in Chapter 1 Act 3 in A Hat in Time. FWIW the NaNs end up in a RGBA16F render target, another option that might work is to fixup NaNs when writing them into the pixel shader output. --- dlls/wined3d/glsl_shader.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 5dfcbb689b7..0fd10b4853d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2561,6 +2561,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c shader_addline(buffer, ";\n"); } } + shader_addline(buffer, "const float FLT_MAX = 1e38;\n"); } /* Prototypes */ @@ -4214,9 +4215,10 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins) { DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major, ins->ctx->reg_maps->shader_version.minor); + struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_string_buffer *buffer = ins->ctx->buffer; + struct wined3d_string_buffer *prefix, *suffix; struct glsl_src_param src0_param; - const char *prefix, *suffix; unsigned int dst_size; DWORD dst_write_mask; @@ -4228,41 +4230,50 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], dst_write_mask, &src0_param); + prefix = string_buffer_get(priv->string_buffers); + suffix = string_buffer_get(priv->string_buffers); + switch (ins->handler_idx) { case WINED3DSIH_EXP: case WINED3DSIH_EXPP: - prefix = "exp2("; - suffix = ")"; + string_buffer_sprintf(prefix, "exp2("); + string_buffer_sprintf(suffix, ")"); break; case WINED3DSIH_LOG: case WINED3DSIH_LOGP: - prefix = "log2(abs("; - suffix = "))"; + string_buffer_sprintf(prefix, "log2(abs("); + string_buffer_sprintf(suffix, "))"); break; case WINED3DSIH_RCP: - prefix = "1.0 / "; - suffix = ""; + if (shader_version <= WINED3D_SHADER_VERSION(3, 0)) + string_buffer_sprintf(prefix, "%s == 0.0 ? FLT_MAX : 1.0 / ", src0_param.param_str); + else + string_buffer_sprintf(prefix, "1.0 / "); break; case WINED3DSIH_RSQ: - prefix = "inversesqrt(abs("; - suffix = "))"; + if (shader_version <= WINED3D_SHADER_VERSION(3, 0)) + string_buffer_sprintf(prefix, "%s == 0.0 ? FLT_MAX : inversesqrt(abs(", src0_param.param_str); + else + string_buffer_sprintf(prefix, "inversesqrt(abs("); + string_buffer_sprintf(suffix, "))"); break; default: - prefix = ""; - suffix = ""; FIXME("Unhandled instruction %#x.\n", ins->handler_idx); break; } if (dst_size > 1 && shader_version < WINED3D_SHADER_VERSION(4, 0)) - shader_addline(buffer, "vec%u(%s%s%s));\n", dst_size, prefix, src0_param.param_str, suffix); + shader_addline(buffer, "vec%u(%s%s%s));\n", dst_size, prefix->buffer, src0_param.param_str, suffix->buffer); else - shader_addline(buffer, "%s%s%s);\n", prefix, src0_param.param_str, suffix); + shader_addline(buffer, "%s%s%s);\n", prefix->buffer, src0_param.param_str, suffix->buffer); + + string_buffer_release(priv->string_buffers, prefix); + string_buffer_release(priv->string_buffers, suffix); } /** Process the WINED3DSIO_EXPP instruction in GLSL: From 77a7f74d47a9ef41c3bef0905e39dc7f9645c051 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Tue, 27 Aug 2019 02:55:16 +0200 Subject: [PATCH 0851/1506] wined3d: Avoid NaNs in LOG and LOGP. CW-Bug-Id: #21762 Fixes some white artifacts in A Hat in Time Chapter 2 Act 1. --- dlls/wined3d/glsl_shader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 0fd10b4853d..ba722a5fa84 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -4243,7 +4243,10 @@ static void shader_glsl_scalar_op(const struct wined3d_shader_instruction *ins) case WINED3DSIH_LOG: case WINED3DSIH_LOGP: - string_buffer_sprintf(prefix, "log2(abs("); + if (shader_version <= WINED3D_SHADER_VERSION(3, 0)) + string_buffer_sprintf(prefix, "%s == 0.0 ? -FLT_MAX : log2(abs(", src0_param.param_str); + else + string_buffer_sprintf(prefix, "log2(abs("); string_buffer_sprintf(suffix, "))"); break; From 5db8bd9dafc7b4aa3e00a2b6700c89c57e0c4c1f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 20 Jun 2022 12:24:04 -0500 Subject: [PATCH 0852/1506] winex11.drv: HACK: Add WINE_SHARE_ALL_GL_CONTEXTS environment variable. And auto enable it for Eador. Masters of the Broken World. CW-Bug-Id: #20830 wglShareLists() cannot be properly implemented on top of glX context sharing. --- dlls/winex11.drv/opengl.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 387428d673a..7e59ec5dfa7 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1970,6 +1970,34 @@ static BOOL glxdrv_wglCopyContext(struct wgl_context *src, struct wgl_context *d return TRUE; } +static int share_all_contexts = -1; + +static GLXContext get_common_context( GLXFBConfig fbconfig ) +{ + static GLXContext common_context; + + if (share_all_contexts == -1) + { + const char *e = getenv( "WINE_SHARE_ALL_GL_CONTEXTS" ); + const char *sgi = getenv( "SteamGameId" ); + + if (e) + share_all_contexts = !!atoi(e); + else + share_all_contexts = sgi && !strcmp( sgi, "232050" ); + + if (share_all_contexts) + FIXME( "HACK: sharing all the GL contexts.\n" ); + } + + if (!share_all_contexts) return NULL; + + if (!common_context) + common_context = pglXCreateNewContext( gdi_display, fbconfig, GLX_RGBA_TYPE, NULL, TRUE ); + + return common_context; +} + /*********************************************************************** * glxdrv_wglCreateContext */ @@ -1988,7 +2016,7 @@ static struct wgl_context *glxdrv_wglCreateContext( HDC hdc ) { ret->hdc = hdc; ret->fmt = gl->format; - ret->ctx = create_glxcontext(gdi_display, ret, NULL); + ret->ctx = create_glxcontext(gdi_display, ret, get_common_context( ret->fmt->fbconfig )); pthread_mutex_lock( &context_mutex ); list_add_head( &context_list, &ret->entry ); pthread_mutex_unlock( &context_mutex ); @@ -3242,6 +3270,8 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de * hasn't been made current and it hasn't shared display lists before. */ + if (share_all_contexts == 1) return TRUE; + if (!dest->has_been_current && !dest->sharing) { keep = org; @@ -3563,7 +3593,8 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg } X11DRV_expect_error(gdi_display, GLXErrorHandler, NULL); - ret->ctx = create_glxcontext(gdi_display, ret, hShareContext ? hShareContext->ctx : NULL); + ret->ctx = create_glxcontext(gdi_display, ret, + hShareContext ? hShareContext->ctx : get_common_context( ret->fmt->fbconfig )); XSync(gdi_display, False); if ((err = X11DRV_check_error()) || !ret->ctx) { From 0b1f1127b5330995fe9cd6f628c75c4ee88fd3bc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 20 Jun 2022 12:43:39 -0500 Subject: [PATCH 0853/1506] winex11.drv: HACK: Enable WINE_SHARE_ALL_GL_CONTEXTS for Cossacks 3. CW-Bug-Id: #20532 --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 7e59ec5dfa7..2ab1ffc6b9a 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1984,7 +1984,7 @@ static GLXContext get_common_context( GLXFBConfig fbconfig ) if (e) share_all_contexts = !!atoi(e); else - share_all_contexts = sgi && !strcmp( sgi, "232050" ); + share_all_contexts = sgi && (!strcmp( sgi, "232050" ) || !strcmp( sgi, "333420" )); if (share_all_contexts) FIXME( "HACK: sharing all the GL contexts.\n" ); From 7fd397d419156d7109fbdc3dde8bd73b02dd539d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 28 Oct 2022 20:25:39 -0500 Subject: [PATCH 0854/1506] winex11.drv: HACK: Enable WINE_SHARE_ALL_GL_CONTEXTS for EADesktop. CW-Bug-Id: #21497 --- dlls/winex11.drv/opengl.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 2ab1ffc6b9a..6d130be7107 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1984,8 +1984,24 @@ static GLXContext get_common_context( GLXFBConfig fbconfig ) if (e) share_all_contexts = !!atoi(e); else + { share_all_contexts = sgi && (!strcmp( sgi, "232050" ) || !strcmp( sgi, "333420" )); - + if (!share_all_contexts) + { + static const WCHAR ea_desktop[] = u"EADesktop.exe"; + UNICODE_STRING *name; + DWORD len, name_len; + + name = &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName; + len = name->Length / sizeof(WCHAR); + if (len && !name->Buffer[len]) --len; + name_len = sizeof(ea_desktop) / sizeof(*ea_desktop) - 1; + + if (len >= name_len) + share_all_contexts = !memcmp( name->Buffer + len - name_len, ea_desktop, + name_len * sizeof(*ea_desktop) ); + } + } if (share_all_contexts) FIXME( "HACK: sharing all the GL contexts.\n" ); } From edb36b7614415ba1f3039e71fafca82284c533f7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 13 Jul 2022 19:56:49 -0500 Subject: [PATCH 0855/1506] user32: Send WM_NCPAINT as notify message in send_ncpaint(). CW-Bug-Id: #20969 --- dlls/win32u/dce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index f70a2a32be9..649b82cdb6b 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1208,7 +1208,7 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags ) if (style & WS_VSCROLL) set_standard_scroll_painted( hwnd, SB_VERT, FALSE ); - send_message( hwnd, WM_NCPAINT, (WPARAM)whole_rgn, 0 ); + send_notify_message( hwnd, WM_NCPAINT, (WPARAM)whole_rgn, 0, FALSE ); } if (whole_rgn > (HRGN)1) NtGdiDeleteObjectApp( whole_rgn ); } From c6fc9aac47ffdc5644f9aace4ad365e66bb1fbce Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 24 May 2022 16:27:08 -0500 Subject: [PATCH 0856/1506] user32: Flush driver display in ReleaseDC() for other process window. CW-Bug-Id: #19779 --- dlls/win32u/dce.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 649b82cdb6b..d7aa75b3039 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1020,6 +1020,9 @@ HDC WINAPI NtUserGetDCEx( HWND hwnd, HRGN clip_rgn, DWORD flags ) */ INT WINAPI NtUserReleaseDC( HWND hwnd, HDC hdc ) { + if (hwnd && !is_current_process_window( hwnd )) + user_driver->pProcessEvents( 0 ); + return release_dc( hwnd, hdc, FALSE ); } From 9134a430a5fdcecc11aa4b3a61f026f02ae97041 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Sat, 12 Nov 2022 14:03:56 -0600 Subject: [PATCH 0857/1506] win32u: Send notify message in NtUserFlashWindowEx(). CW-Bug-Id: #21562 --- dlls/win32u/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index e563076171e..d3ce35ebb86 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -4585,7 +4585,7 @@ BOOL WINAPI NtUserFlashWindowEx( FLASHWINFO *info ) release_win_ptr( win ); if (!info->dwFlags || info->dwFlags & FLASHW_CAPTION) - send_message( hwnd, WM_NCACTIVATE, wparam, 0 ); + send_notify_message( hwnd, WM_NCACTIVATE, wparam, 0, 0 ); user_driver->pFlashWindowEx( info ); return wparam; From ed80fcf100133abba6bf908d2a41a2cbbbd353ee Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 27 Apr 2021 10:51:12 +0200 Subject: [PATCH 0858/1506] HACK: winex11.drv: Fix drawing of layered windows with a client window. CW-Bug-Id: #18807 --- dlls/winex11.drv/event.c | 5 ++++- dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index d076703c79b..7ce3f6fea4a 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -986,7 +986,10 @@ static BOOL X11DRV_Expose( HWND hwnd, XEvent *xev ) rect.right = pos.x + event->width; rect.bottom = pos.y + event->height; - if (event->window != data->client_window) + if (layered_window_client_hack && event->window == data->client_window) + OffsetRect( &rect, data->client_rect.left - data->whole_rect.left, + data->client_rect.top - data->whole_rect.top ); + if (layered_window_client_hack || event->window != data->client_window) { if (data->surface) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index d5f40de97cc..3cbab6255b2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -1010,4 +1010,6 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src ) extern BOOL vulkan_disable_child_window_rendering_hack; extern BOOL vulkan_gdi_blit_source_hack; +extern BOOL layered_window_client_hack; + #endif /* __WINE_X11DRV_H */ diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 6488114a7d6..ac2a7857b91 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -95,6 +95,7 @@ BOOL vulkan_disable_child_window_rendering_hack = FALSE; BOOL vulkan_gdi_blit_source_hack = FALSE; HANDLE steam_overlay_event; HANDLE steam_keyboard_event; +BOOL layered_window_client_hack = FALSE; static x11drv_error_callback err_callback; /* current callback for error */ static Display *err_callback_display; /* display callback is set for */ @@ -834,6 +835,17 @@ static NTSTATUS x11drv_init( void *arg ) (e && *e != '\0' && *e != '0'); } + { + const char *sgi = getenv("SteamGameId"); + const char *e = getenv("WINE_LAYERED_WINDOW_CLIENT_HACK"); + layered_window_client_hack = + (sgi && ( + strcmp(sgi, "435150") == 0 || /* Divinity: Original Sin 2 launcher */ + strcmp(sgi, "227020") == 0 /* Rise of Venice launcher */ + )) || + (e && *e != '\0' && *e != '0'); + } + init_user_driver(); X11DRV_DisplayDevices_Init(FALSE); return STATUS_SUCCESS; From 541d51c38a37f1af97b6b65301c938741d114682 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 3 Feb 2022 09:51:28 +0100 Subject: [PATCH 0859/1506] HACK: winex11.drv/opengl: Do not trigger a libX11 bug. Sometimes The Last Campfire passes invalid parameters to wglCreateContextAttribsARB, which on the Deck can trigger a libX11 bug and crash Wine. When we see the invalid value we return an error directly, without calling glXCreateContextAttribsARB. This hack can be removed once https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/152 is fixed (which happened in libx11 1.7.4). CW-Bug-Id: #20026 --- dlls/winex11.drv/opengl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 6d130be7107..fa73d8205f1 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -3578,6 +3578,21 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg case WGL_CONTEXT_LAYER_PLANE_ARB: break; case WGL_CONTEXT_FLAGS_ARB: + /* HACK: The Last Campfire sometimes uses an + * invalid value for WGL_CONTEXT_FLAGS_ARB, which + * triggers + * https://gitlab.freedesktop.org/xorg/lib/libx11/-/issues/152 + * on the Deck. If we see the invalid value we + * directly return an error, so that Wine doesn't + * crash. This hack can be removed once that issue + * is fixed. */ + if (attribList[1] == 0x31b3) + { + WARN("return early to avoid triggering a libX11 bug\n"); + free(ret); + release_gl_drawable(gl); + return NULL; + } pContextAttribList[0] = GLX_CONTEXT_FLAGS_ARB; pContextAttribList[1] = attribList[1]; pContextAttribList += 2; From 928fa704d145ca85338b14a1035f84d708b11c7e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 22 Mar 2022 21:44:24 +0300 Subject: [PATCH 0860/1506] ntdll: HACK: Also use Windows syscall numbers for Swords of Legends Online. CW-Bug-Id: #20330 --- dlls/ntdll/unix/signal_x86_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 63f732b45b4..f0467def51f 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1972,7 +1972,7 @@ static void install_bpf(struct sigaction *sig_act) { const char *sgi = getenv("SteamGameId"); - if (sgi && (!strcmp(sgi, "1174180") || !strcmp(sgi, "1404210"))) + if (sgi && (!strcmp(sgi, "1174180") || !strcmp(sgi, "1404210") || !strcmp(sgi, "1418100"))) { /* Use specific signal handler. */ sig_act->sa_sigaction = sigsys_handler_rdr2; From 61fb0f4a9a193ece9896224654defdc049624629 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 20 May 2022 18:47:05 -0500 Subject: [PATCH 0861/1506] winex11.drv: Sync calls to vkQueuePresentKHR(). CW-Bug-Id: #18863 --- dlls/winex11.drv/vulkan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 412b712f78d..33761764c74 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -1035,6 +1035,7 @@ static VkResult X11DRV_vkAcquireNextImage2KHR( VkDevice device, const VkAcquireN static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *present_info) { + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; VkResult res; UINT i; @@ -1054,7 +1055,9 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR * } } + pthread_mutex_lock( &lock ); res = pvkQueuePresentKHR(queue, present_info); + pthread_mutex_unlock( &lock ); if (TRACE_ON(fps)) { From 608690437a165bf14c699df5ad2ecbf815490f4e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 1 Mar 2022 22:11:17 +0300 Subject: [PATCH 0862/1506] winex11.drv: Generate EDID if one is not available from xrandr. CW-Bug-Id: #20204 CW-Bug-Id: #19217 --- dlls/winex11.drv/xrandr.c | 110 ++++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 11 deletions(-) diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index ade0db94b24..af70b2b5191 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -32,6 +32,7 @@ #include #endif #include +#include #include "x11drv.h" #include "wine/debug.h" @@ -444,23 +445,108 @@ static void get_screen_size( XRRScreenResources *resources, unsigned int *width, } } -static unsigned int get_edid( RROutput output, unsigned char **prop ) +static unsigned int get_edid( RROutput output, unsigned char **prop, + XRROutputInfo *output_info, XRRScreenResources *screen_resources ) { - int result, actual_format; + unsigned int mwidth, mheight, i; unsigned long bytes_after, len; + unsigned char *edid, *p, c; + int result, actual_format; + XRRModeInfo *mode; Atom actual_type; + *prop = NULL; result = pXRRGetOutputProperty( gdi_display, output, x11drv_atom(EDID), 0, 128, FALSE, FALSE, AnyPropertyType, &actual_type, &actual_format, &len, - &bytes_after, prop ); + &bytes_after, &edid ); + if (result == Success && len) + { + if (!(*prop = malloc( len ))) + { + XFree( edid ); + return 0; + } + memcpy( *prop, edid, len ); + return len; + } - if (result != Success) + WARN( "Could not retrieve EDID property for output %#lx.\n", output ); + if (!output_info->npreferred) { - WARN("Could not retrieve EDID property for output %#lx.\n", output); - *prop = NULL; + WARN( "No preferred modes for output %#lx.\n", output ); return 0; } - return len; + if (output_info->npreferred > 1) + WARN( "%u preferred modes for output %#lx, using first one.\n", output_info->npreferred, output ); + + for (i = 0; i < screen_resources->nmode; ++i) + if (screen_resources->modes[i].id == output_info->modes[0]) break; + + if (i == screen_resources->nmode) + { + ERR("Preferred mode not found for output %#lx.\n", output); + return 0; + } + + mode = &screen_resources->modes[i]; + + mwidth = mode->width / 60; /* Fake ~150dpi. */ + mheight = mode->height / 60; + + edid = calloc( 1, 128 ); + *prop = edid; + *(uint64_t *)edid = 0x00ffffffffffff00; + edid[18] = 1; + edid[19] = 4; + edid[20] = 0xa0; /* Digital input, 8 bit depth. */ + edid[21] = mwidth; + edid[22] = mheight; + edid[24] = 0x6; + for (i = 0; i < 16; ++i) edid[38 + i] = 1; + + p = edid + 54; + *(uint16_t *)&p[0] = mode->dotClock / 10000; + p[2] = mode->width; + p[3] = mode->hTotal - mode->width; + p[4] = (((mode->hTotal - mode->width) >> 8) & 0xf) | (((mode->width >> 8) & 0xf) << 4); + p[5] = mode->height; + p[6] = mode->vTotal - mode->height; + p[7] = (((mode->vTotal - mode->height) >> 8) & 0xf) | (((mode->height >> 8) & 0xf) << 4); + p[8] = mode->hSyncStart - mode->width; + p[9] = mode->hSyncEnd - mode->hSyncStart; + p[10] = (((mode->vSyncStart - mode->height) & 0xf) << 4) | ((mode->vSyncEnd - mode->vSyncStart) & 0xf); + p[11] = ((((mode->hSyncStart - mode->width) >> 8) & 3) << 6) + | ((((mode->hSyncEnd - mode->hSyncStart) >> 8) & 3) << 4) + | ((((mode->vSyncStart - mode->height) >> 4) & 3) << 2) + | (((mode->vSyncEnd - mode->vSyncStart) >> 4) & 3); + p[12] = mwidth; + p[13] = mheight; + p[14] = (((mwidth >> 8) & 0xf) << 4) | ((mheight >> 8) & 0xf); + if (mode->modeFlags & RR_Interlace) + p[17] |= 0x80; + p[17] |= 3 << 3; + if (mode->modeFlags & RR_HSyncPositive) + p[17] |= 2; + if (mode->modeFlags & RR_VSyncPositive) + p[17] |= 4; + + if (mode->modeFlags & (RR_DoubleScan | RR_PixelMultiplex | RR_DoubleClock | RR_ClockDivideBy2)) + FIXME( "Unsupported flags %#lx.\n", mode->modeFlags ); + + p += 18; + p[3] = 0xfc; + strcpy( (char *)p + 5, "Default" ); + + p += 18; + p[3] = 0x10; + p += 18; + p[3] = 0x10; + + c = 0; + for (i = 0; i < 127; ++i) + c += edid[i]; + edid[127] = 256 - c; + return 128; } static void set_screen_size( int width, int height ) @@ -1183,7 +1269,8 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne if (!output_info->crtc || !crtc_info->mode) { monitors[monitor_count].state_flags = DISPLAY_DEVICE_ATTACHED; - monitors[monitor_count].edid_len = get_edid( adapter_id, &monitors[monitor_count].edid ); + monitors[monitor_count].edid_len = get_edid( adapter_id, &monitors[monitor_count].edid, + output_info, screen_resources ); monitor_count = 1; } /* Active monitors, need to find other monitors with the same coordinates as mirrored */ @@ -1238,7 +1325,8 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne primary_index = monitor_count; monitors[monitor_count].edid_len = get_edid( screen_resources->outputs[i], - &monitors[monitor_count].edid ); + &monitors[monitor_count].edid, + enum_output_info, screen_resources ); monitor_count++; } @@ -1282,7 +1370,7 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne for (i = 0; i < monitor_count; i++) { if (monitors[i].edid) - XFree( monitors[i].edid ); + free( monitors[i].edid ); } free( monitors ); ERR("Failed to get monitors\n"); @@ -1297,7 +1385,7 @@ static void xrandr14_free_monitors( struct gdi_monitor *monitors, int count ) for (i = 0; i < count; i++) { if (monitors[i].edid) - XFree( monitors[i].edid ); + free( monitors[i].edid ); } free( monitors ); } From a342f56ab0e9b01a3dc2f2351a3bf478d6885869 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 19 Oct 2021 10:39:18 +0200 Subject: [PATCH 0863/1506] HACK: user32: Process WM_PAINT in peek_message for WS_EX_COMPOSITED windows. CW-Bug-Id: #19488 --- dlls/win32u/message.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 7f2fe415c7e..7bb3c393483 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3052,6 +3052,15 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, info.msg.wParam = result.wparam; info.msg.lParam = result.lparam; } + /* CXHACK 19488 */ + if (info.msg.message == WM_PAINT && + flags == (PM_REMOVE | PM_QS_INPUT | PM_QS_POSTMESSAGE | PM_QS_PAINT | PM_QS_SENDMESSAGE) && + (get_window_long( info.msg.hwnd, GWL_EXSTYLE ) & WS_EX_COMPOSITED )) + { + send_message( info.msg.hwnd, info.msg.message, info.msg.wParam, info.msg.lParam ); + flags &= ~PM_QS_PAINT; + continue; + } *msg = info.msg; msg->pt = point_phys_to_win_dpi( info.msg.hwnd, info.msg.pt ); thread_info->client_info.message_pos = MAKELONG( msg->pt.x, msg->pt.y ); From 0ba8798e30a7f6f9da7b9fd43cc25288b96f784d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 22 Jun 2022 10:36:46 -0500 Subject: [PATCH 0864/1506] opengl32: HACK: Fixup shaders for Cossacks 3. CW-Bug-Id: #20865 --- dlls/opengl32/make_opengl | 2 + dlls/opengl32/thunks.c | 18 +------- dlls/opengl32/wgl.c | 94 +++++++++++++++++++++++++++++++++++++++ include/wine/wgl_driver.h | 2 +- 4 files changed, 99 insertions(+), 17 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index ec6c7cbe4df..e3727b63923 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -172,6 +172,8 @@ my %manual_win_thunks = "glMapNamedBufferEXT" => 1, "glMapNamedBufferRange" => 1, "glMapNamedBufferRangeEXT" => 1, + "glShaderSource" => 1, + "glShaderSourceARB" => 1, "glUnmapBuffer" => 1, "glUnmapBufferARB" => 1, "glUnmapNamedBuffer" => 1, diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index c20abdf5488..b0cc3dd83b7 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -17979,22 +17979,6 @@ static void WINAPI glShaderOp3EXT( GLenum op, GLuint res, GLuint arg1, GLuint ar if ((status = UNIX_CALL( glShaderOp3EXT, &args ))) WARN( "glShaderOp3EXT returned %#lx\n", status ); } -static void WINAPI glShaderSource( GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length ) -{ - struct glShaderSource_params args = { .teb = NtCurrentTeb(), .shader = shader, .count = count, .string = string, .length = length }; - NTSTATUS status; - TRACE( "shader %d, count %d, string %p, length %p\n", shader, count, string, length ); - if ((status = UNIX_CALL( glShaderSource, &args ))) WARN( "glShaderSource returned %#lx\n", status ); -} - -static void WINAPI glShaderSourceARB( GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length ) -{ - struct glShaderSourceARB_params args = { .teb = NtCurrentTeb(), .shaderObj = shaderObj, .count = count, .string = string, .length = length }; - NTSTATUS status; - TRACE( "shaderObj %d, count %d, string %p, length %p\n", shaderObj, count, string, length ); - if ((status = UNIX_CALL( glShaderSourceARB, &args ))) WARN( "glShaderSourceARB returned %#lx\n", status ); -} - static void WINAPI glShaderStorageBlockBinding( GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding ) { struct glShaderStorageBlockBinding_params args = { .teb = NtCurrentTeb(), .program = program, .storageBlockIndex = storageBlockIndex, .storageBlockBinding = storageBlockBinding }; @@ -24342,6 +24326,8 @@ extern void * WINAPI glMapNamedBuffer( GLuint buffer, GLenum access ); extern void * WINAPI glMapNamedBufferEXT( GLuint buffer, GLenum access ); extern void * WINAPI glMapNamedBufferRange( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ); extern void * WINAPI glMapNamedBufferRangeEXT( GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access ); +extern void WINAPI glShaderSource( GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length ); +extern void WINAPI glShaderSourceARB( GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length ); extern GLboolean WINAPI glUnmapBuffer( GLenum target ); extern GLboolean WINAPI glUnmapBufferARB( GLenum target ); extern GLboolean WINAPI glUnmapNamedBuffer( GLuint buffer ); diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index b3cffa00a3e..7d77296f199 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1292,6 +1292,100 @@ static BOOL WINAPI call_opengl_debug_message_callback( struct wine_gl_debug_mess return TRUE; } +static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLint *length ) +{ + static int needs_fixup = -1; + static unsigned int once; + + const char add_ext[] = "#version 120\r\n" + "#extension GL_ARB_explicit_uniform_location : enable\r\n" + "#extension GL_ARB_explicit_attrib_location : enable\r\n"; + const char search_str[] = "uniform mat4 boneMatrices[NBONES];"; + const char prepend_str[] = "layout(location = 2) "; + unsigned int search_len, new_len; + const char *p, *next; + BOOL found = FALSE; + char *new, *out; + + if (needs_fixup == -1) + { + const char *sgi = getenv("SteamGameId"); + + needs_fixup = sgi && !strcmp( sgi, "333420" ); + } + + if (!needs_fixup) return NULL; + + if (length || count != 1) return NULL; + + if (!once++) + FIXME( "HACK: Fixing up shader.\n" ); + + TRACE( "Appending extension string.\n" ); + new_len = strlen( *string ) + sizeof(prepend_str) - 1 + sizeof(add_ext); + new = out = malloc( new_len ); + memcpy( out, add_ext, sizeof(add_ext) - 1 ); + out += sizeof(add_ext) - 1; + + search_len = sizeof(search_str) - 1; + next = *string; + while (*(p = next)) + { + while (*next && *next != '\r' && *next != '\n') ++next; + + if (next - p == search_len && !memcmp( p, search_str, search_len )) + { + TRACE( "Adding explicit location.\n" ); + memcpy( out, *string, p - *string ); + out += p - *string; + memcpy( out, prepend_str, sizeof(prepend_str) - 1 ); + out += sizeof(prepend_str) - 1; + strcpy( out, p ); + found = TRUE; + break; + } + + while (*next == '\n' || *next == '\r') ++next; + } + if (!found) + strcpy( out, *string ); + + return new; +} + +void WINAPI glShaderSource( GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length ) +{ + struct glShaderSource_params args = { .teb = NtCurrentTeb(), .shader = shader, .count = count, .string = string, .length = length }; + NTSTATUS status; + char *new; + TRACE( "shader %d, count %d, string %p, length %p\n", shader, count, string, length ); + if ((new = fixup_shader( count, string, length ))) + { + args.string = (const GLchar **)&new; + args.count = 1; + args.length = NULL; + } + if ((status = UNIX_CALL( glShaderSource, &args ))) WARN( "glShaderSource returned %#lx\n", status ); + free( new ); +} + +void WINAPI glShaderSourceARB( GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length ) +{ + struct glShaderSourceARB_params args = { .teb = NtCurrentTeb(), .shaderObj = shaderObj, .count = count, .string = string, .length = length }; + NTSTATUS status; + char *new; + TRACE( "shaderObj %d, count %d, string %p, length %p\n", shaderObj, count, string, length ); + if ((new = fixup_shader( count, string, length ))) + { + args.string = (const GLcharARB **)&new; + args.count = 1; + args.length = NULL; + } + if ((status = UNIX_CALL( glShaderSourceARB, &args ))) WARN( "glShaderSourceARB returned %#lx\n", status ); + free( new ); +} + + /*********************************************************************** * OpenGL initialisation routine */ diff --git a/include/wine/wgl_driver.h b/include/wine/wgl_driver.h index 93ebe7d7f46..0f3ade153f2 100644 --- a/include/wine/wgl_driver.h +++ b/include/wine/wgl_driver.h @@ -7,7 +7,7 @@ #define WINE_GLAPI #endif -#define WINE_WGL_DRIVER_VERSION 23 +#define WINE_WGL_DRIVER_VERSION 24 struct wgl_context; struct wgl_pbuffer; From 980bc88595d6ab5a6feb512863516028a5fcb2d8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 7 Dec 2022 12:08:43 -0600 Subject: [PATCH 0865/1506] win32u, server: Support setting desktop close timeout. And use zero timeout by default. CW-Bug-Id: #19584 CW-Bug-Id: #21645 --- dlls/win32u/winstation.c | 27 ++++++++++++++++++++++++--- server/protocol.def | 3 +++ server/user.h | 1 + server/winstation.c | 4 +++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index b04c0bbc910..ac625f3e212 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -390,6 +390,8 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, } } +#define TICKSPERSEC 10000000 + /*********************************************************************** * NtUserSetObjectInformation (win32u.@) */ @@ -397,8 +399,19 @@ BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DW { BOOL ret; const USEROBJECTFLAGS *obj_flags = info; + LONG64 close_timeout = 0; - if (index != UOI_FLAGS || !info || len < sizeof(*obj_flags)) + if (index == 1000) + { + /* Wine specific: set desktop close timeout. */ + if (!info || len < sizeof(DWORD)) + { + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + close_timeout = -(*(DWORD *)info * (ULONG64)TICKSPERSEC / 1000); + } + else if (index != UOI_FLAGS || !info || len < sizeof(*obj_flags)) { RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; @@ -407,8 +420,16 @@ BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DW SERVER_START_REQ( set_user_object_info ) { req->handle = wine_server_obj_handle( handle ); - req->flags = SET_USER_OBJECT_SET_FLAGS; - req->obj_flags = obj_flags->dwFlags; + if (index == 1000) + { + req->flags = SET_USER_OBJECT_SET_CLOSE_TIMEOUT; + req->close_timeout = close_timeout; + } + else + { + req->flags = SET_USER_OBJECT_SET_FLAGS; + req->obj_flags = obj_flags->dwFlags; + } ret = !wine_server_call_err( req ); } SERVER_END_REQ; diff --git a/server/protocol.def b/server/protocol.def index 5d238ba7503..cd78c8f2f26 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2897,6 +2897,7 @@ enum coords_relative obj_handle_t handle; /* handle to the object */ unsigned int flags; /* information to set/get */ unsigned int obj_flags; /* new object flags */ + timeout_t close_timeout; /* desktop close timeout */ @REPLY int is_desktop; /* is object a desktop? */ unsigned int old_obj_flags; /* old object flags */ @@ -2904,6 +2905,7 @@ enum coords_relative @END #define SET_USER_OBJECT_SET_FLAGS 1 #define SET_USER_OBJECT_GET_FULL_NAME 2 +#define SET_USER_OBJECT_SET_CLOSE_TIMEOUT 4 /* Register a hotkey */ @@ -3671,6 +3673,7 @@ struct handle_info /* Make the current process a system process */ @REQ(make_process_system) obj_handle_t handle; /* handle to the process */ + timeout_t desktop_close_timeout; /* set timeout for desktop close */ @REPLY obj_handle_t event; /* event signaled when all user processes have exited */ @END diff --git a/server/user.h b/server/user.h index c753e1799a4..26d22a00240 100644 --- a/server/user.h +++ b/server/user.h @@ -63,6 +63,7 @@ struct desktop struct hook_table *global_hooks; /* table of global hooks on this desktop */ struct list hotkeys; /* list of registered hotkeys */ struct timeout_user *close_timeout; /* timeout before closing the desktop */ + timeout_t close_timeout_val;/* timeout duration before closing desktop */ struct list touches; /* list of active touches */ struct thread_input *foreground_input; /* thread input of foreground thread */ unsigned int users; /* processes and threads using this desktop */ diff --git a/server/winstation.c b/server/winstation.c index be33253d675..0cf17d00759 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -257,6 +257,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned desktop->msg_window = NULL; desktop->global_hooks = NULL; desktop->close_timeout = NULL; + desktop->close_timeout_val = 0; desktop->foreground_input = NULL; desktop->users = 0; desktop->cursor_win = 0; @@ -368,7 +369,7 @@ static void remove_desktop_user( struct desktop *desktop ) /* if we have one remaining user, it has to be the manager of the desktop window */ if ((process = get_top_window_owner( desktop )) && desktop->users == process->running_threads && !desktop->close_timeout) - desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop ); + desktop->close_timeout = add_timeout_user( desktop->close_timeout_val, close_desktop_timeout, desktop ); } /* set the thread default desktop handle */ @@ -707,6 +708,7 @@ DECL_HANDLER(set_user_object_info) reply->is_desktop = 1; reply->old_obj_flags = desktop->flags; if (req->flags & SET_USER_OBJECT_SET_FLAGS) desktop->flags = req->obj_flags; + if (req->flags & SET_USER_OBJECT_SET_CLOSE_TIMEOUT) desktop->close_timeout_val = req->close_timeout; } else if (obj->ops == &winstation_ops) { From 464dc76e2a8fd6f381350b2850dfac33d13bfdc5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 21 Mar 2023 20:31:35 -0600 Subject: [PATCH 0866/1506] dwmapi: Sleep in DwmFlush(). CW-Bug-Id: #22046 --- dlls/dwmapi/dwmapi_main.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c index adc02552ba7..6df762c0edc 100644 --- a/dlls/dwmapi/dwmapi_main.c +++ b/dlls/dwmapi/dwmapi_main.c @@ -83,18 +83,6 @@ HRESULT WINAPI DwmGetColorizationColor(DWORD *colorization, BOOL *opaque_blend) return E_NOTIMPL; } -/********************************************************************** - * DwmFlush (DWMAPI.@) - */ -HRESULT WINAPI DwmFlush(void) -{ - static BOOL once; - - if (!once++) FIXME("() stub\n"); - - return S_OK; -} - /********************************************************************** * DwmInvalidateIconicBitmaps (DWMAPI.@) */ @@ -301,6 +289,31 @@ HRESULT WINAPI DwmGetCompositionTimingInfo(HWND hwnd, DWM_TIMING_INFO *info) return S_OK; } +/********************************************************************** + * DwmFlush (DWMAPI.@) + */ +HRESULT WINAPI DwmFlush(void) +{ + LARGE_INTEGER qpf, qpc, delay; + LONG64 qpc_refresh_period; + int display_frequency; + static BOOL once; + + if (!once++) + FIXME("() stub\n"); + else + TRACE(".\n"); + + display_frequency = get_display_frequency(); + NtQueryPerformanceCounter(&qpc, &qpf); + qpc_refresh_period = qpf.QuadPart / display_frequency; + delay.QuadPart = (qpc.QuadPart - ((qpc.QuadPart + qpc_refresh_period - 1) / qpc_refresh_period) * qpc_refresh_period) + * 10000000 / qpf.QuadPart; + NtDelayExecution(FALSE, &delay); + + return S_OK; +} + /********************************************************************** * DwmAttachMilContent (DWMAPI.@) */ From 9f4152baa166848271afcd29bc75b647570e0585 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 13 Feb 2023 17:06:08 -0600 Subject: [PATCH 0867/1506] winex11.drv: Use EDID suggested by Gamescope. CW-Bug-Id: #21894 --- dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 3 ++- dlls/winex11.drv/xrandr.c | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3cbab6255b2..3fce082afde 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -568,6 +568,7 @@ enum x11drv_atoms XATOM_text_richtext, XATOM_text_uri_list, XATOM_GAMESCOPE_FOCUSED_APP, + XATOM_GAMESCOPE_DISPLAY_EDID_PATH, NB_XATOMS }; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index ac2a7857b91..1c197c81cc9 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -232,7 +232,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "text/rtf", "text/richtext", "text/uri-list", - "GAMESCOPE_FOCUSED_APP" + "GAMESCOPE_FOCUSED_APP", + "GAMESCOPE_DISPLAY_EDID_PATH", }; /*********************************************************************** diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index af70b2b5191..47accf1de6d 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -454,6 +454,7 @@ static unsigned int get_edid( RROutput output, unsigned char **prop, int result, actual_format; XRRModeInfo *mode; Atom actual_type; + char *edid_path; *prop = NULL; result = pXRRGetOutputProperty( gdi_display, output, x11drv_atom(EDID), 0, 128, FALSE, FALSE, @@ -470,6 +471,31 @@ static unsigned int get_edid( RROutput output, unsigned char **prop, return len; } + edid_path = NULL; + if ((result = XGetWindowProperty( gdi_display, DefaultRootWindow(gdi_display), x11drv_atom(GAMESCOPE_DISPLAY_EDID_PATH), 0, + PATH_MAX, False, x11drv_atom(UTF8_STRING), &actual_type, &actual_format, + &len, &bytes_after, (unsigned char **)&edid_path )) == Success + && actual_type == x11drv_atom(UTF8_STRING)) + { + char buffer[4096]; + FILE *f; + + f = fopen( edid_path, "rb" ); + if (f) + { + len = fread( buffer, 1, sizeof(buffer), f ); + fclose( f ); + if (len) + { + XFree( edid_path ); + if (!(*prop = malloc( len ))) return 0; + memcpy( *prop, buffer, len ); + return len; + } + } + } + if (edid_path) XFree( edid_path ); + WARN( "Could not retrieve EDID property for output %#lx.\n", output ); if (!output_info->npreferred) { From 74e8b85db92a4f5643115d6c7f434795d5b535e3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 24 Apr 2023 19:58:11 -0600 Subject: [PATCH 0868/1506] HACK: server: Disable hooks that time out. An addition to "HACK: user32: Remove hooks that time out." CW-Bug-Id: #22178 --- server/hook.c | 25 ++++++++++++++++++++++++- server/queue.c | 22 ++++++++++++++++++---- server/user.h | 3 ++- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/server/hook.c b/server/hook.c index 3a89a883c3c..24eb27434db 100644 --- a/server/hook.c +++ b/server/hook.c @@ -374,16 +374,39 @@ static unsigned int get_active_hooks(void) } /* return the thread that owns the first global hook */ -struct thread *get_first_global_hook( int id ) +struct thread *get_first_global_hook( int id, thread_id_t *thread_id, client_ptr_t *proc ) { struct hook *hook; struct hook_table *global_hooks = get_global_hooks( current ); if (!global_hooks) return NULL; if (!(hook = get_first_valid_hook( global_hooks, id - WH_MINHOOK, EVENT_MIN, 0, 0, 0 ))) return NULL; + *thread_id = hook->owner->id; + *proc = hook->proc; return hook->owner; } +void disable_hung_hook( struct desktop *desktop, int id, thread_id_t thread_id, client_ptr_t proc ) +{ + struct hook_table *global_hooks = desktop->global_hooks; + int index = id - WH_MINHOOK; + struct hook *hook; + + if (!global_hooks || !proc) return; + + hook = get_first_hook( global_hooks, index ); + + while (hook) + { + if (hook->proc == proc && hook->owner->id == thread_id) + { + hook->proc = 0; + return; + } + hook = HOOK_ENTRY( list_next( &global_hooks->hooks[index], &hook->chain ) ); + } +} + /* get thread active hooks */ DECL_HANDLER(get_active_hooks) { diff --git a/server/queue.c b/server/queue.c index fb6fe2d9478..12592241c92 100644 --- a/server/queue.c +++ b/server/queue.c @@ -68,6 +68,8 @@ struct message_result void *data; /* message reply data */ unsigned int data_size; /* size of message reply data */ struct timeout_user *timeout; /* result timeout */ + thread_id_t hook_thread_id;/* Hook owner thread id. */ + client_ptr_t hook_proc; /* Hook proc address. */ }; struct message @@ -986,6 +988,13 @@ static void result_timeout( void *private ) { struct message *msg = result->msg; + if (result->sender && result->hook_thread_id && result->hook_proc) + { + if (debug_level > 1) + fprintf( stderr, "disabling hung hook: tid %04x, proc %#lx\n", + result->hook_thread_id, (unsigned long)result->hook_proc ); + disable_hung_hook( result->sender->input->desktop, msg->msg, result->hook_thread_id, result->hook_proc ); + } result->msg = NULL; msg->result = NULL; remove_queue_message( result->receiver, msg, SEND_MESSAGE ); @@ -997,7 +1006,8 @@ static void result_timeout( void *private ) /* allocate and fill a message result structure */ static struct message_result *alloc_message_result( struct msg_queue *send_queue, struct msg_queue *recv_queue, - struct message *msg, timeout_t timeout ) + struct message *msg, timeout_t timeout, + thread_id_t hook_thread_id, client_ptr_t hook_proc) { struct message_result *result = mem_alloc( sizeof(*result) ); if (result) @@ -1012,6 +1022,8 @@ static struct message_result *alloc_message_result( struct msg_queue *send_queue result->hardware_msg = NULL; result->desktop = NULL; result->callback_msg = NULL; + result->hook_thread_id = hook_thread_id; + result->hook_proc = hook_proc; if (msg->type == MSG_CALLBACK) { @@ -2001,8 +2013,10 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa struct message *msg; timeout_t timeout = 2000 * -10000; /* FIXME: load from registry */ int id = (input->type == INPUT_MOUSE) ? WH_MOUSE_LL : WH_KEYBOARD_LL; + thread_id_t hook_thread_id; + client_ptr_t hook_proc; - if (!(hook_thread = get_first_global_hook( id ))) return 0; + if (!(hook_thread = get_first_global_hook( id, &hook_thread_id, &hook_proc ))) return 0; if (!(queue = hook_thread->queue)) return 0; if (is_queue_hung( queue )) return 0; @@ -2027,7 +2041,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa else msg->lparam = input->mouse.data << 16; if (!(msg->data = memdup( hardware_msg->data, hardware_msg->data_size )) || - !(msg->result = alloc_message_result( sender, queue, msg, timeout ))) + !(msg->result = alloc_message_result( sender, queue, msg, timeout, hook_thread_id, hook_proc ))) { free_message( msg ); return 0; @@ -3031,7 +3045,7 @@ DECL_HANDLER(send_message) case MSG_ASCII: case MSG_UNICODE: case MSG_CALLBACK: - if (!(msg->result = alloc_message_result( send_queue, recv_queue, msg, req->timeout ))) + if (!(msg->result = alloc_message_result( send_queue, recv_queue, msg, req->timeout, 0, 0 ))) { free_message( msg ); break; diff --git a/server/user.h b/server/user.h index 26d22a00240..a6ef5fc1f83 100644 --- a/server/user.h +++ b/server/user.h @@ -92,7 +92,8 @@ extern void cleanup_clipboard_thread( struct thread *thread ); /* hook functions */ extern void remove_thread_hooks( struct thread *thread ); -extern struct thread *get_first_global_hook( int id ); +extern struct thread *get_first_global_hook( int id, thread_id_t *thread_id, client_ptr_t *proc ); +extern void disable_hung_hook( struct desktop *desktop, int id, thread_id_t thread_id, client_ptr_t proc ); /* queue functions */ From 8120e66df608e6f3c8905d2ce0c9f57d1670fa47 Mon Sep 17 00:00:00 2001 From: LeonTheo02 <57302337+LeonTheo02@users.noreply.github.com> Date: Thu, 23 Feb 2023 13:32:14 +0100 Subject: [PATCH 0869/1506] dxdiag: Return DirectX 12 values Changed the values DxDiag returns to reflect values taken from a modern DirectX 12 capable system via Windows DxDiag. This will allow games that check these values to detect the DirectX Version correctly. Fixes DX11 Open Beta of RAID : World War II. Link: https://github.com/ValveSoftware/wine/pull/178 --- dlls/dxdiagn/provider.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c index 0a6111fff25..a85fea13b54 100644 --- a/dlls/dxdiagn/provider.c +++ b/dlls/dxdiagn/provider.c @@ -612,7 +612,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node) WCHAR buffer[MAX_PATH], computer_name[MAX_COMPUTERNAME_LENGTH + 1], print_buf[200], localized_pagefile_fmt[200]; DWORD_PTR args[2]; - hr = add_ui4_property(node, L"dwDirectXVersionMajor", 9); + hr = add_ui4_property(node, L"dwDirectXVersionMajor", 12); if (FAILED(hr)) return hr; @@ -620,15 +620,15 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node) if (FAILED(hr)) return hr; - hr = add_bstr_property(node, L"szDirectXVersionLetter", L"c"); + hr = add_bstr_property(node, L"szDirectXVersionLetter", L" "); if (FAILED(hr)) return hr; - hr = add_bstr_property(node, L"szDirectXVersionEnglish", L"4.09.0000.0904"); + hr = add_bstr_property(node, L"szDirectXVersionEnglish", L""); if (FAILED(hr)) return hr; - hr = add_bstr_property(node, L"szDirectXVersionLongEnglish", L"= \"DirectX 9.0c (4.09.0000.0904)"); + hr = add_bstr_property(node, L"szDirectXVersionLongEnglish", L"DirectX 12"); if (FAILED(hr)) return hr; From d8b8d7748e5ecde6967554d84560b3a98c824512 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 16 Jun 2023 13:41:39 -0600 Subject: [PATCH 0870/1506] winex11.drv: HACK: Ignore ConfigureNotify events for fullscreen window for Hitman 2. --- dlls/winex11.drv/event.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 7ce3f6fea4a..6c7ee637f34 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1224,6 +1224,18 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) rect.bottom = rect.top + (data->whole_rect.bottom - data->whole_rect.top); } } + else if (steamgameid && !strcmp( steamgameid, "863550" )) + { + /* When going fullscreen WMs may set intermediate window sizes (e. g., excluding taskbar) before finally + * settle with the correct fullscreen window size. Hitman 2 is quick to react on window size change + * and trigger window resize again which randomly triggers the process to repeat. */ + if (data->net_wm_state & (1 << NET_WM_STATE_FULLSCREEN) && NtUserIsWindowRectFullScreen( &data->whole_rect ) + && !NtUserIsWindowRectFullScreen( &rect )) + { + TRACE( "Window is fullscreen, ignoring.\n" ); + goto done; + } + } } x = rect.left; From 590992926ba0fdec07e855defe77bd9be3e79486 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 12 Apr 2022 20:27:25 +0300 Subject: [PATCH 0871/1506] winex11.drv: fshack: Don't set 'pending_fullscreen' if window already has NET_WM_STATE_FULLSCREEN. CW-Bug-Id: #20483 CW-Bug-Id: #22796 --- dlls/winex11.drv/window.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 5b6627ab63f..946d32f627d 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1396,7 +1396,9 @@ void update_net_wm_states( struct x11drv_win_data *data ) if (i == NET_WM_STATE_FULLSCREEN) { - data->pending_fullscreen = (new_state & (1 << i)) != 0; + data->pending_fullscreen = (new_state & (1 << i)) + && !(data->net_wm_state & (1 << NET_WM_STATE_FULLSCREEN) + && wm_is_steamcompmgr(data->display)); TRACE( "set pending_fullscreen to: %u\n", data->pending_fullscreen ); } From b3c3d9f1056a8dca672729868ee21f2f41fa3aa3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 10 Oct 2023 14:27:58 -0600 Subject: [PATCH 0872/1506] win32u: Don't fail update_display_cache_from_registry() if there is no adapters. CW-Bug-Id: #22813 --- dlls/win32u/sysparams.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index dda7a665d23..1a131ff68b0 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1703,7 +1703,6 @@ static BOOL update_display_cache_from_registry(void) struct monitor *monitor, *monitor2; HANDLE mutex = NULL; NTSTATUS status; - BOOL ret; /* If user driver did initialize the registry, then exit */ if (!video_key && !(video_key = reg_open_key( NULL, devicemap_video_keyW, @@ -1761,11 +1760,15 @@ static BOOL update_display_cache_from_registry(void) } } - if ((ret = !list_empty( &adapters ) && !list_empty( &monitors ))) - last_query_display_time = key.LastWriteTime.QuadPart; + if (list_empty( &adapters )) + { + WARN( "No adapters found.\n" ); + assert( list_empty( &monitors )); + } + else if (!list_empty( &monitors )) last_query_display_time = key.LastWriteTime.QuadPart; pthread_mutex_unlock( &display_lock ); release_display_device_init_mutex( mutex ); - return ret; + return TRUE; } static BOOL is_same_devmode( const DEVMODEW *a, const DEVMODEW *b ) @@ -2935,6 +2938,8 @@ static DEVMODEW *get_display_settings( const WCHAR *devname, const DEVMODEW *dev struct adapter *adapter; BOOL ret; + if (list_empty( &adapters )) return NULL; + /* allocate an extra mode for easier iteration */ if (!(displays = calloc( list_count( &adapters ) + 1, sizeof(DEVMODEW) ))) return NULL; mode = displays; From 2093ebadcefcb174cdb76ece84fe551e19694d69 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 30 Oct 2023 10:48:12 -0600 Subject: [PATCH 0873/1506] win32u: Support DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO) based on Gamescope setting. CW-Bug-Id: #22912 --- dlls/win32u/sysparams.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 1a131ff68b0..43d4fddc2ab 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6596,11 +6596,36 @@ NTSTATUS WINAPI NtUserDisplayConfigGetDeviceInfo( DISPLAYCONFIG_DEVICE_INFO_HEAD return STATUS_NOT_SUPPORTED; } + case DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO: + { + DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO *info = (DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO *)packet; + const char *env; + + FIXME( "DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO semi-stub.\n" ); + + if (packet->size < sizeof(*info)) + return STATUS_INVALID_PARAMETER; + + info->advancedColorSupported = 0; + info->advancedColorEnabled = 0; + info->wideColorEnforced = 0; + info->advancedColorForceDisabled = 0; + info->colorEncoding = DISPLAYCONFIG_COLOR_ENCODING_RGB; + info->bitsPerColorChannel = 8; + if ((env = getenv("DXVK_HDR")) && *env == '1') + { + TRACE( "HDR is enabled.\n" ); + info->advancedColorSupported = 1; + info->advancedColorEnabled = 1; + info->bitsPerColorChannel = 10; + } + + return STATUS_SUCCESS; + } case DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE: case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE: case DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION: case DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION: - case DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO: case DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE: case DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL: default: From 1e1d25491ec46055c54123216eb1d46020f42c71 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 8 Nov 2023 13:36:20 -0600 Subject: [PATCH 0874/1506] winex11.drv: Don't call XIconifyWindow() on Gamescope. CW-Bug-Id: #22953 --- dlls/winex11.drv/window.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 946d32f627d..59f2e71c100 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1502,7 +1502,7 @@ static void map_window( HWND hwnd, DWORD new_style ) sync_window_style( data ); XMapWindow( data->display, data->whole_window ); /* Mutter always unminimizes windows when handling map requests. Restore iconic state */ - if (new_style & WS_MINIMIZE) + if (new_style & WS_MINIMIZE && !wm_is_steamcompmgr( data->display )) XIconifyWindow( data->display, data->whole_window, data->vis.screen ); XFlush( data->display ); if (data->surface && data->vis.visualid != default_visual.visualid) @@ -3337,7 +3337,16 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic ); if (data->iconic) { - XIconifyWindow( data->display, data->whole_window, data->vis.screen ); + if (!wm_is_steamcompmgr( data->display )) + { + /* XIconifyWindow is essentially a no-op on Gamescope but has an undesirable side effect. + * Gamescope handles wm state change to iconic and immediately changes it back to normal. + * Upon that change back we would receive WM_STATE change notification and kick the window + * out of minimized state even if the window is not focused by Gamescope. Upon focusing the + * window Gamescope will change WM_STATE regardless and we will get the window out of + * minimized state correctly. */ + XIconifyWindow( data->display, data->whole_window, data->vis.screen ); + } } else if (is_window_rect_mapped( rectWindow )) { From c5a0993522cf34b5f1000073d3e4605d42dea8bc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 30 Nov 2023 18:53:30 -0600 Subject: [PATCH 0875/1506] winex11.drv: Ignore FocusOut event from intermediate unmap on Gamescope. CW-Bug-Id: #22953 --- dlls/winex11.drv/event.c | 12 ++++++++++++ dlls/winex11.drv/window.c | 7 +++++++ dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 20 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 6c7ee637f34..cec5712ae32 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -930,9 +930,21 @@ static void focus_out( Display *display , HWND hwnd ) static BOOL X11DRV_FocusOut( HWND hwnd, XEvent *xev ) { XFocusChangeEvent *event = &xev->xfocus; + struct x11drv_win_data *data; TRACE( "win %p xwin %lx detail=%s mode=%s\n", hwnd, event->window, focus_details[event->detail], focus_modes[event->mode] ); + if ((data = get_win_data( hwnd ))) + { + if (data->fake_unmap_serial == event->serial) + { + release_win_data( data ); + TRACE( "Ignoring event from intermediate unmap.\n" ); + return FALSE; + } + release_win_data( data ); + } + if (event->detail == NotifyPointer) { if (!hwnd && event->window == x11drv_thread_data()->clip_window) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 59f2e71c100..17f44982620 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3353,7 +3353,14 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, /* whole_window could be both iconic and mapped. Since XMapWindow() doesn't do * anything if the window is already mapped, we need to unmap it first */ if (data->mapped) + { + if (wm_is_steamcompmgr( data->display )) + { + /* Gamescope will generate FocusOut event upon processing UnmapNotify. Ignore it. */ + data->fake_unmap_serial = NextRequest( data->display ); + } XUnmapWindow( data->display, data->whole_window ); + } XMapWindow( data->display, data->whole_window ); } update_net_wm_states( data ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3fce082afde..9d3f742cbad 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -656,6 +656,7 @@ struct x11drv_win_data DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */ unsigned long unmapnotify_serial; /* serial number of last UnmapNotify event */ + unsigned long fake_unmap_serial; /* serial number of unmap before map for restoring window from minimized state in X11DRV_WindowPosChanged() */ unsigned long configure_serial; /* serial number of last configure request */ struct window_surface *surface; Pixmap icon_pixmap; From 9fffd5ed928e13a983cc2e7e8b62b9ab62c74e68 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 12 Jan 2023 16:56:13 -0600 Subject: [PATCH 0876/1506] win32u: Limit the frequency of update_display_cache() calls. CW-Bug-Id: #21761 --- dlls/win32u/ntuser_private.h | 6 +++++ dlls/win32u/sysparams.c | 27 ++++++++++++++++++++- dlls/win32u/winstation.c | 47 ++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index c0120f89ebc..4221c25d65f 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -270,6 +270,12 @@ void *next_process_user_handle_ptr( HANDLE *handle, unsigned int type ); UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask ); /* winstation.c */ +struct global_shared_memory +{ + ULONG display_settings_serial; +}; + +extern volatile struct global_shared_memory *get_global_shared_memory( void ); extern const desktop_shm_t *get_desktop_shared_memory(void); extern const queue_shm_t *get_queue_shared_memory(void); extern const input_shm_t *get_input_shared_memory(void); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 43d4fddc2ab..84fc7418b62 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -958,6 +958,7 @@ static void reg_empty_key( HKEY root, const char *key_name ) static void prepare_devices(void) { + volatile struct global_shared_memory *global_shared = get_global_shared_memory(); char buffer[4096]; KEY_NODE_INFORMATION *key = (void *)buffer; KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer; @@ -967,6 +968,8 @@ static void prepare_devices(void) DWORD size; HKEY hkey, subkey, device_key, prop_key; + if (global_shared) InterlockedIncrement( (LONG *)&global_shared->display_settings_serial ); + if (!enum_key) enum_key = reg_create_key( NULL, enum_keyW, sizeof(enum_keyW), 0, NULL ); if (!control_key) control_key = reg_create_key( NULL, control_keyW, sizeof(control_keyW), 0, NULL ); if (!video_key) video_key = reg_create_key( NULL, devicemap_video_keyW, sizeof(devicemap_video_keyW), @@ -2038,12 +2041,25 @@ BOOL update_display_cache( BOOL force ) { static const WCHAR wine_service_station_name[] = {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n',0}; - HWINSTA winstation = NtUserGetProcessWindowStation(); + static ULONG last_update_serial; + + volatile struct global_shared_memory *global_shared = get_global_shared_memory(); + ULONG current_serial, global_serial; + HWINSTA winstation; struct device_manager_ctx ctx = {0}; BOOL was_virtual_desktop, ret; WCHAR name[MAX_PATH]; + __WINE_ATOMIC_LOAD_RELAXED( &last_update_serial, ¤t_serial ); + if (global_shared) + { + __WINE_ATOMIC_LOAD_RELAXED( &global_shared->display_settings_serial, &global_serial ); + if (!force && current_serial && current_serial == global_serial) return TRUE; + } + else global_serial = 0; + /* services do not have any adapters, only a virtual monitor */ + winstation = NtUserGetProcessWindowStation(); if (NtUserGetObjectInformation( winstation, UOI_NAME, name, sizeof(name), NULL ) && !wcscmp( name, wine_service_station_name )) { @@ -2051,6 +2067,7 @@ BOOL update_display_cache( BOOL force ) clear_display_devices(); list_add_tail( &monitors, &virtual_monitor.entry ); pthread_mutex_unlock( &display_lock ); + InterlockedCompareExchange( (LONG *)&last_update_serial, global_serial, current_serial ); return TRUE; } @@ -2084,6 +2101,7 @@ BOOL update_display_cache( BOOL force ) return update_display_cache( TRUE ); } + InterlockedCompareExchange( (LONG *)&last_update_serial, global_serial, current_serial ); return TRUE; } @@ -2403,6 +2421,7 @@ RECT get_primary_monitor_rect( UINT dpi ) LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info, UINT32 *num_mode_info ) { + volatile struct global_shared_memory *global_shared; struct monitor *monitor; UINT32 count = 0; @@ -2427,6 +2446,10 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in if (flags != QDC_ONLY_ACTIVE_PATHS) FIXME( "only returning active paths\n" ); + /* NtUserGetDisplayConfigBufferSizes() is called by display drivers to trigger display settings update. */ + if ((global_shared = get_global_shared_memory())) + InterlockedIncrement( (LONG *)&global_shared->display_settings_serial ); + if (lock_display_devices()) { LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry ) @@ -3157,6 +3180,7 @@ static BOOL all_detached_settings( const DEVMODEW *displays ) static LONG apply_display_settings( const WCHAR *devname, const DEVMODEW *devmode, HWND hwnd, DWORD flags, void *lparam ) { + volatile struct global_shared_memory *global_shared = get_global_shared_memory(); WCHAR primary_name[CCHDEVICENAME]; struct display_device *primary; DEVMODEW *mode, *displays; @@ -3204,6 +3228,7 @@ static LONG apply_display_settings( const WCHAR *devname, const DEVMODEW *devmod free( displays ); if (ret) return ret; + if (global_shared) InterlockedIncrement( (LONG *)&global_shared->display_settings_serial ); if (!update_display_cache( TRUE )) WARN( "Failed to update display cache after mode change.\n" ); diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index ac625f3e212..1bca929d157 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -658,6 +658,53 @@ static volatile void *map_shared_memory_section( const WCHAR *name, SIZE_T size, return ptr; } +volatile struct global_shared_memory *get_global_shared_memory( void ) +{ + static const WCHAR global_mappingW[] = + { + '\\','?','?','\\','_','_','w','i','n','e','_','w','i','n','3','2','u','_','m','a','p','p','i','n','g',0 + }; + static struct global_shared_memory *global_shared; + struct global_shared_memory *ret; + UNICODE_STRING section_str; + OBJECT_ATTRIBUTES attr; + LARGE_INTEGER size_l; + unsigned int status; + HANDLE handle; + SIZE_T size; + + __WINE_ATOMIC_LOAD_RELAXED( &global_shared, &ret ); + if (ret) return ret; + + RtlInitUnicodeString( §ion_str, global_mappingW ); + InitializeObjectAttributes( &attr, §ion_str, OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_PERMANENT, NULL, NULL ); + size_l.QuadPart = sizeof(struct global_shared_memory); + status = NtCreateSection( &handle, SECTION_ALL_ACCESS, &attr, &size_l, PAGE_READWRITE, SEC_COMMIT, NULL ); + if (status && status != STATUS_OBJECT_NAME_EXISTS) + { + static int once; + if (!once++) + ERR( "Failed to get global shared memory, status %#x.\n", status ); + } + size = sizeof(struct global_shared_memory); + status = NtMapViewOfSection( handle, GetCurrentProcess(), (void **)&ret, 0, 0, NULL, + &size, ViewUnmap, 0, PAGE_READWRITE ); + NtClose( handle ); + if (status) + { + ERR( "failed to map view of section, status %#x\n", status ); + return NULL; + } + if (InterlockedCompareExchangePointer( (void **)&global_shared, ret, NULL )) + { + if (NtUnmapViewOfSection( GetCurrentProcess(), ret )) + ERR( "NtUnmapViewOfSection failed.\n" ); + ret = global_shared; + } + + return ret; +} + const desktop_shm_t *get_desktop_shared_memory(void) { static const WCHAR dir_desktop_maps[] = From dd5d05c0e2c48daa737b39ffae5a5a5db2a36e54 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 31 Oct 2023 17:55:00 -0600 Subject: [PATCH 0877/1506] winex11.drv: fshack: Add optional centered low res modes. CW-Bug-Id: #22802 --- dlls/winex11.drv/fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index d48ee26bfb5..b54594eda23 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -295,6 +295,11 @@ static void monitor_get_modes( struct fs_monitor *monitor, DEVMODEW **modes, UIN /* Fullscreen hack doesn't support changing display orientations */ if (!real_settings_handler.get_modes( monitor->settings_id, 0, &real_modes, &real_mode_count )) return; + if ((env = getenv( "WINE_CENTER_DISPLAY_MODES" ))) + center_modes = (env[0] != '0'); + else if ((env = getenv( "SteamAppId" ))) + center_modes = !strcmp( env, "359870" ); + if ((env = getenv( "WINE_CENTER_DISPLAY_MODES" ))) center_modes = (env[0] != '0'); else if ((env = getenv( "SteamAppId" ))) From 5e9cb2ba9d78ae24488004622e5dfe132d1bf2f1 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 11 Oct 2021 11:01:33 +0200 Subject: [PATCH 0878/1506] msctf: Use list to keep thread managers. Thread managers were stored in thread local storage, which have a major flaw that they can't not be released by another thread. CW-Bug-Id: #17086 Signed-off-by: Zhiyi Zhang --- dlls/msctf/msctf.c | 46 +++++++---------------- dlls/msctf/msctf_internal.h | 1 - dlls/msctf/threadmgr.c | 73 ++++++++++++++++++++++++++++++++----- 3 files changed, 76 insertions(+), 44 deletions(-) diff --git a/dlls/msctf/msctf.c b/dlls/msctf/msctf.c index e2dde836b12..a79a32afc02 100644 --- a/dlls/msctf/msctf.c +++ b/dlls/msctf/msctf.c @@ -67,7 +67,6 @@ static UINT array_size; static struct list AtsList = LIST_INIT(AtsList); static UINT activated = 0; -DWORD tlsIndex = 0; TfClientId processId = 0; ITfCompartmentMgr *globalCompartmentMgr = NULL; @@ -394,23 +393,19 @@ HRESULT add_active_textservice(TF_LANGUAGEPROFILE *lp) ActivatedTextService *actsvr; ITfCategoryMgr *catmgr; AtsEntry *entry; - ITfThreadMgrEx *tm = TlsGetValue(tlsIndex); + ITfThreadMgr *tm; ITfClientId *clientid; - if (!tm) return E_UNEXPECTED; + if (FAILED(TF_GetThreadMgr(&tm))) return E_UNEXPECTED; actsvr = malloc(sizeof(ActivatedTextService)); - if (!actsvr) return E_OUTOFMEMORY; + if (!actsvr) goto fail; - ITfThreadMgrEx_QueryInterface(tm, &IID_ITfClientId, (void **)&clientid); + ITfThreadMgr_QueryInterface(tm, &IID_ITfClientId, (void **)&clientid); ITfClientId_GetClientId(clientid, &lp->clsid, &actsvr->tid); ITfClientId_Release(clientid); - if (!actsvr->tid) - { - free(actsvr); - return E_OUTOFMEMORY; - } + if (!actsvr->tid) goto fail; actsvr->pITfTextInputProcessor = NULL; actsvr->LanguageProfile = *lp; @@ -437,20 +432,21 @@ HRESULT add_active_textservice(TF_LANGUAGEPROFILE *lp) deactivate_remove_conflicting_ts(&actsvr->LanguageProfile.catid); if (activated > 0) - activate_given_ts(actsvr, tm); + activate_given_ts(actsvr, (ITfThreadMgrEx *)tm); entry = malloc(sizeof(AtsEntry)); - - if (!entry) - { - free(actsvr); - return E_OUTOFMEMORY; - } + if (!entry) goto fail; entry->ats = actsvr; list_add_head(&AtsList, &entry->entry); + ITfThreadMgr_Release(tm); return S_OK; + +fail: + ITfThreadMgr_Release(tm); + free(actsvr); + return E_OUTOFMEMORY; } BOOL get_active_textservice(REFCLSID rclsid, TF_LANGUAGEPROFILE *profile) @@ -554,11 +550,9 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad) switch (fdwReason) { case DLL_PROCESS_ATTACH: - tlsIndex = TlsAlloc(); break; case DLL_PROCESS_DETACH: if (fImpLoad) break; - TlsFree(tlsIndex); break; } return TRUE; @@ -592,20 +586,6 @@ HRESULT WINAPI TF_CreateThreadMgr(ITfThreadMgr **pptim) return ThreadMgr_Constructor(NULL,(IUnknown**)pptim); } -/*********************************************************************** - * TF_GetThreadMgr (MSCTF.@) - */ -HRESULT WINAPI TF_GetThreadMgr(ITfThreadMgr **pptim) -{ - TRACE("\n"); - *pptim = TlsGetValue(tlsIndex); - - if (*pptim) - ITfThreadMgr_AddRef(*pptim); - - return S_OK; -} - /*********************************************************************** * SetInputScope(MSCTF.@) */ diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h index 24c8c017ff3..3696edf5500 100644 --- a/dlls/msctf/msctf_internal.h +++ b/dlls/msctf/msctf_internal.h @@ -36,7 +36,6 @@ #define COOKIE_MAGIC_INPUTPROCESSORPROFILEACTIVATIONSINK 0x00b0 #define COOKIE_MAGIC_ACTIVELANGSINK 0x00c0 -extern DWORD tlsIndex; extern TfClientId processId; extern ITfCompartmentMgr *globalCompartmentMgr; diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c index 11c79c030ff..ff2b0b95ff7 100644 --- a/dlls/msctf/threadmgr.c +++ b/dlls/msctf/threadmgr.c @@ -37,6 +37,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msctf); +static CRITICAL_SECTION ThreadMgrCs; +static CRITICAL_SECTION_DEBUG ThreadMgrCsDebug = +{ + 0, 0, &ThreadMgrCs, + {&ThreadMgrCsDebug.ProcessLocksList, + &ThreadMgrCsDebug.ProcessLocksList }, + 0, 0, {(DWORD_PTR)(__FILE__ ": ThreadMgrCs")} +}; +static CRITICAL_SECTION ThreadMgrCs = {&ThreadMgrCsDebug, -1, 0, 0, 0, 0}; +struct list ThreadMgrList = LIST_INIT(ThreadMgrList); + typedef struct tagPreservedKey { struct list entry; @@ -98,6 +109,9 @@ typedef struct tagACLMulti { struct list ThreadMgrEventSink; struct list UIElementSink; struct list InputProcessorProfileActivationSink; + + DWORD threadId; + struct list entry; } ThreadMgr; typedef struct tagEnumTfDocumentMgr { @@ -110,6 +124,11 @@ typedef struct tagEnumTfDocumentMgr { static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); +static inline ThreadMgr *impl_from_ITfThreadMgr(ITfThreadMgr *iface) +{ + return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEx_iface); +} + static inline ThreadMgr *impl_from_ITfThreadMgrEx(ITfThreadMgrEx *iface) { return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEx_iface); @@ -155,6 +174,35 @@ static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMg return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface); } +/*********************************************************************** + * TF_GetThreadMgr (MSCTF.@) + */ +HRESULT WINAPI TF_GetThreadMgr(ITfThreadMgr **pptim) +{ + DWORD id = GetCurrentThreadId(); + ThreadMgr *cursor; + + TRACE("%p\n", pptim); + + if (!pptim) + return E_INVALIDARG; + + EnterCriticalSection(&ThreadMgrCs); + LIST_FOR_EACH_ENTRY(cursor, &ThreadMgrList, ThreadMgr, entry) + { + if (cursor->threadId == id) + { + ITfThreadMgrEx_AddRef(&cursor->ITfThreadMgrEx_iface); + *pptim = (ITfThreadMgr *)&cursor->ITfThreadMgrEx_iface; + LeaveCriticalSection(&ThreadMgrCs); + return S_OK; + } + } + LeaveCriticalSection(&ThreadMgrCs); + *pptim = NULL; + return E_FAIL; +} + static void ThreadMgr_Destructor(ThreadMgr *This) { struct list *cursor, *cursor2; @@ -163,7 +211,9 @@ static void ThreadMgr_Destructor(ThreadMgr *This) if (This->focusHook) UnhookWindowsHookEx(This->focusHook); - TlsSetValue(tlsIndex,NULL); + EnterCriticalSection(&ThreadMgrCs); + list_remove(&This->entry); + LeaveCriticalSection(&ThreadMgrCs); TRACE("destroying %p\n", This); if (This->focus) ITfDocumentMgr_Release(This->focus); @@ -386,17 +436,20 @@ static HRESULT WINAPI ThreadMgr_SetFocus(ITfThreadMgrEx *iface, ITfDocumentMgr * static LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lParam) { + ITfThreadMgr *ThreadMgr_iface; ThreadMgr *This; - This = TlsGetValue(tlsIndex); - if (!This) + if (FAILED(TF_GetThreadMgr(&ThreadMgr_iface))) { ERR("Hook proc but no ThreadMgr for this thread. Serious Error\n"); return 0; } + + This = impl_from_ITfThreadMgr(ThreadMgr_iface); if (!This->focusHook) { ERR("Hook proc but no ThreadMgr focus Hook. Serious Error\n"); + ITfThreadMgr_Release(ThreadMgr_iface); return 0; } @@ -417,6 +470,7 @@ static LRESULT CALLBACK ThreadFocusHookProc(int nCode, WPARAM wParam, LPARAM lPa } } + ITfThreadMgr_Release(ThreadMgr_iface); return CallNextHookEx(This->focusHook, nCode, wParam, lParam); } @@ -1346,13 +1400,8 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) return CLASS_E_NOAGGREGATION; /* Only 1 ThreadMgr is created per thread */ - This = TlsGetValue(tlsIndex); - if (This) - { - ThreadMgr_AddRef(&This->ITfThreadMgrEx_iface); - *ppOut = (IUnknown*)&This->ITfThreadMgrEx_iface; + if (SUCCEEDED(TF_GetThreadMgr((ITfThreadMgr **)ppOut))) return S_OK; - } This = calloc(1, sizeof(ThreadMgr)); if (This == NULL) @@ -1367,7 +1416,6 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) This->ITfUIElementMgr_iface.lpVtbl = &ThreadMgrUIElementMgrVtbl; This->ITfSourceSingle_iface.lpVtbl = &SourceSingleVtbl; This->refCount = 1; - TlsSetValue(tlsIndex,This); CompartmentMgr_Constructor((IUnknown*)&This->ITfThreadMgrEx_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); @@ -1384,6 +1432,11 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) list_init(&This->UIElementSink); list_init(&This->InputProcessorProfileActivationSink); + This->threadId = GetCurrentThreadId(); + EnterCriticalSection(&ThreadMgrCs); + list_add_tail(&ThreadMgrList, &This->entry); + LeaveCriticalSection(&ThreadMgrCs); + TRACE("returning %p\n", This); *ppOut = (IUnknown *)&This->ITfThreadMgrEx_iface; return S_OK; From 1e9c41c4239b7bddc42a0f6c755b8d94f35552f3 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Wed, 6 Oct 2021 15:44:57 -0500 Subject: [PATCH 0879/1506] setupapi: Compare dll files before overwriting them. This is mainly to prevent us from clobbering reflinks created by the proton script, and to make sure dll symlinks (which we can't overwrite) are still registered properly. CW-Bug-Id: #18633 --- dlls/setupapi/fakedll.c | 151 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 138 insertions(+), 13 deletions(-) diff --git a/dlls/setupapi/fakedll.c b/dlls/setupapi/fakedll.c index fb01d21b3ba..a2d06490b86 100644 --- a/dlls/setupapi/fakedll.c +++ b/dlls/setupapi/fakedll.c @@ -428,7 +428,7 @@ static const WCHAR *enum_load_path( unsigned int idx ) } /* try to load a pre-compiled fake dll */ -static void *load_fake_dll( const WCHAR *name, SIZE_T *size ) +static void *load_fake_dll( const WCHAR *name, SIZE_T *size, WCHAR **out_filename ) { const WCHAR *build_dir = _wgetenv( L"WINEBUILDDIR" ); const WCHAR *path; @@ -476,11 +476,94 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size ) } done: + if (res == 1) + { + *out_filename = malloc( (wcslen( ptr ) + 1) * sizeof(WCHAR) ); + wcscpy( *out_filename, ptr ); + free( file ); + return data; + } free( file ); - if (res == 1) return data; return NULL; } +/* Check if the 2 files are already the same */ +static BOOL fake_dll_matches( const WCHAR *source, const WCHAR *dest ) +{ + WIN32_FILE_ATTRIBUTE_DATA data1, data2; + HANDLE h; + char *buf; + DWORD size, bytesread; + BOOL result; + + if (!GetFileAttributesExW( source, GetFileExInfoStandard, &data1 )) + return FALSE; + + if (!GetFileAttributesExW( dest, GetFileExInfoStandard, &data2 )) + return FALSE; + + if ((data2.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) == FILE_ATTRIBUTE_REPARSE_POINT) + /* If it's a symlink, assume it was put there by the proton script and is therefore correct */ + return TRUE; + + if (data1.nFileSizeHigh != 0 || + data2.nFileSizeHigh != 0 || + data1.nFileSizeLow != data2.nFileSizeLow) + { + return FALSE; + } + + size = data1.nFileSizeLow; + + /* If size and mtime matches, don't bother comparing contents */ + if ((data1.ftLastWriteTime.dwLowDateTime != 0 || data1.ftLastWriteTime.dwHighDateTime != 0) && + data1.ftLastWriteTime.dwLowDateTime == data2.ftLastWriteTime.dwLowDateTime && + data1.ftLastWriteTime.dwHighDateTime == data2.ftLastWriteTime.dwHighDateTime) + return TRUE; + + buf = malloc( size * 2 ); + + if (!buf) + return FALSE; + + h = CreateFileW( source, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL ); + if (h == INVALID_HANDLE_VALUE) + { + free( buf ); + return FALSE; + } + + if (!ReadFile( h, buf, size, &bytesread, NULL ) || bytesread != size) + { + CloseHandle( h ); + free( buf ); + return FALSE; + } + + CloseHandle( h ); + + h = CreateFileW( dest, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL ); + if (h == INVALID_HANDLE_VALUE) + { + free( buf ); + return FALSE; + } + + if (!ReadFile( h, buf + size, size, &bytesread, NULL ) || bytesread != size) + { + CloseHandle( h ); + free( buf ); + return FALSE; + } + + CloseHandle( h ); + + result = !memcmp( buf, buf + size, size ); + + free( buf ); + return result; +} + /* create the fake dll destination file */ static HANDLE create_dest_file( const WCHAR *name, BOOL delete ) { @@ -907,7 +990,11 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, BOOL delete, struct list destname[len] = 0; if (!add_handled_dll( destname )) ret = -1; - if (ret != -1) + if (ret != -1 && fake_dll_matches( file, dest )) + { + register_fake_dll( dest, data, size, delay_copy ); + } + else if (ret != -1) { HANDLE h = create_dest_file( dest, delete ); @@ -939,6 +1026,13 @@ static void delay_copy_files( struct list *delay_copy ) LIST_FOR_EACH_ENTRY_SAFE( copy, next, delay_copy, struct delay_copy, entry ) { list_remove( ©->entry ); + + if ( fake_dll_matches( copy->src, copy->dest ) ) + { + free( copy ); + continue; + } + ret = read_file( copy->src, &data, &size ); if (ret != 1) { @@ -1051,6 +1145,7 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source ) BOOL ret; SIZE_T size; const WCHAR *filename; + WCHAR *source_filename; void *buffer; BOOL delete = !wcscmp( source, L"-" ); /* '-' source means delete the file */ @@ -1067,25 +1162,55 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source ) add_handled_dll( filename ); - if (!(h = create_dest_file( name, delete ))) return TRUE; /* not a fake dll */ - if (h == INVALID_HANDLE_VALUE) return FALSE; + if (delete) + { + if (!(h = create_dest_file( name, delete ))) return TRUE; /* not a fake dll */ + if (h == INVALID_HANDLE_VALUE) return FALSE; + + /* '-' source means delete the file */ + TRACE( "deleting %s\n", debugstr_w(name) ); + ret = FALSE; - if ((buffer = load_fake_dll( source, &size ))) + CloseHandle( h ); + DeleteFileW( name ); + } + else if ((buffer = load_fake_dll( source, &size, &source_filename ))) { - DWORD written; + if (fake_dll_matches( source_filename, name )) + { + free( source_filename ); + + register_fake_dll( name, buffer, size, &delay_copy ); + ret = TRUE; + } + else + { + DWORD written; + + free( source_filename ); - ret = (WriteFile( h, buffer, size, &written, NULL ) && written == size); - if (ret) register_fake_dll( name, buffer, size, &delay_copy ); - else ERR( "failed to write to %s (error=%lu)\n", debugstr_w(name), GetLastError() ); + if (!(h = create_dest_file( name, FALSE ))) return TRUE; /* not a fake dll */ + if (h == INVALID_HANDLE_VALUE) return FALSE; + + ret = (WriteFile( h, buffer, size, &written, NULL ) && written == size); + if (ret) register_fake_dll( name, buffer, size, &delay_copy ); + else ERR( "failed to write to %s (error=%lu)\n", debugstr_w(name), GetLastError() ); + + CloseHandle( h ); + if (!ret) DeleteFileW( name ); + } } else { + if (!(h = create_dest_file( name, FALSE ))) return TRUE; /* not a fake dll */ + if (h == INVALID_HANDLE_VALUE) return FALSE; + WARN( "fake dll %s not found for %s\n", debugstr_w(source), debugstr_w(name) ); ret = build_fake_dll( h, name ); - } - CloseHandle( h ); - if (!ret) DeleteFileW( name ); + CloseHandle( h ); + if (!ret) DeleteFileW( name ); + } delay_copy_files( &delay_copy ); return ret; From 632ec3780f8248578af1634791d344a898b5a9e0 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Thu, 4 Nov 2021 11:00:56 -0400 Subject: [PATCH 0880/1506] HACK: user32: Handle OBJID_QUERYCLASSNAMEIDX for user32 edit control. Due to Wine's implementation of RealGetWindowClass being broken for subclassed controls, we'll need to respond to OBJID_QUERYCLASSNAMEIDX to know that we have an edit control. Signed-off-by: Connor McAdams CW-Bug-Id: #18351 --- dlls/user32/edit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 39f429813d6..f7a427a5aa4 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -5105,6 +5105,12 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B } break; + case WM_GETOBJECT: + if (lParam == (DWORD)OBJID_QUERYCLASSNAMEIDX) + result = 0x10004; + + break; + default: result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode); break; From 7a0e2c5316ddeab02dab9fea3be671517c33fc9e Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Tue, 20 Dec 2022 13:38:58 -0500 Subject: [PATCH 0881/1506] tabtip: Create tabtip.exe. TabTIP: Tablet text input panel. This program watches for editable text input fields gaining focus and runs an event handler when this occurs. Signed-off-by: Connor McAdams CW-Bug-Id: #18351 --- configure.ac | 1 + programs/tabtip/Makefile.in | 8 + programs/tabtip/tabtip.c | 365 ++++++++++++++++++++++++++++++++++++ 3 files changed, 374 insertions(+) create mode 100644 programs/tabtip/Makefile.in create mode 100644 programs/tabtip/tabtip.c diff --git a/configure.ac b/configure.ac index 7a71c20c8d9..37e226c81ae 100644 --- a/configure.ac +++ b/configure.ac @@ -3548,6 +3548,7 @@ WINE_CONFIG_MAKEFILE(programs/start) WINE_CONFIG_MAKEFILE(programs/subst) WINE_CONFIG_MAKEFILE(programs/svchost) WINE_CONFIG_MAKEFILE(programs/systeminfo) +WINE_CONFIG_MAKEFILE(programs/tabtip) WINE_CONFIG_MAKEFILE(programs/taskkill) WINE_CONFIG_MAKEFILE(programs/tasklist) WINE_CONFIG_MAKEFILE(programs/tasklist/tests) diff --git a/programs/tabtip/Makefile.in b/programs/tabtip/Makefile.in new file mode 100644 index 00000000000..3b3d1f7ef92 --- /dev/null +++ b/programs/tabtip/Makefile.in @@ -0,0 +1,8 @@ +EXTRADEFS = -DWINE_NO_LONG_TYPES +MODULE = tabtip.exe +IMPORTS = uuid ole32 user32 oleacc uiautomationcore rpcrt4 shell32 + +EXTRADLLFLAGS = -mconsole -municode -mno-cygwin + +SOURCES = \ + tabtip.c diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c new file mode 100644 index 00000000000..45f77b66412 --- /dev/null +++ b/programs/tabtip/tabtip.c @@ -0,0 +1,365 @@ +/* + * Copyright 2021 Connor McAdams + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#define COBJMACROS +#include +#include "uiautomation.h" +#include "ole2.h" +#include "strsafe.h" +#include "oleacc.h" +#include "shellapi.h" +#include +#include + +#include "wine/debug.h" +#ifndef UNICODE +#define UNICODE +#endif + +WINE_DEFAULT_DEBUG_CHANNEL(tabtip); + +extern HANDLE CDECL __wine_make_process_system(void); +LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +enum { + EVENT_PGM_EXIT, + EVENT_WINE_EXIT, + THREAD_EVENT_COUNT, +}; + +struct thread_data { + HANDLE events[THREAD_EVENT_COUNT]; + HWND main_hwnd; +}; + +typedef struct { + IUIAutomationFocusChangedEventHandler IUIAutomationFocusChangedEventHandler_iface; + LONG ref; +} event_data; + +static DWORD last_keyup_event; +static BOOL keyboard_up; + +static const char *ct_id_str[] = { + "UIA_ButtonControlTypeId (50000)", + "UIA_CalendarControlTypeId (50001)", + "UIA_CheckBoxControlTypeId (50002)", + "UIA_ComboBoxControlTypeId (50003)", + "UIA_EditControlTypeId (50004)", + "UIA_HyperlinkControlTypeId (50005)", + "UIA_ImageControlTypeId (50006)", + "UIA_ListItemControlTypeId (50007)", + "UIA_ListControlTypeId (50008)", + "UIA_MenuControlTypeId (50009)", + "UIA_MenuBarControlTypeId (50010)", + "UIA_MenuItemControlTypeId (50011)", + "UIA_ProgressBarControlTypeId (50012)", + "UIA_RadioButtonControlTypeId (50013)", + "UIA_ScrollBarControlTypeId (50014)", + "UIA_SliderControlTypeId (50015)", + "UIA_SpinnerControlTypeId (50016)", + "UIA_StatusBarControlTypeId (50017)", + "UIA_TabControlTypeId (50018)", + "UIA_TabItemControlTypeId (50019)", + "UIA_TextControlTypeId (50020)", + "UIA_ToolBarControlTypeId (50021)", + "UIA_ToolTipControlTypeId (50022)", + "UIA_TreeControlTypeId (50023)", + "UIA_TreeItemControlTypeId (50024)", + "UIA_CustomControlTypeId (50025)", + "UIA_GroupControlTypeId (50026)", + "UIA_ThumbControlTypeId (50027)", + "UIA_DataGridControlTypeId (50028)", + "UIA_DataItemControlTypeId (50029)", + "UIA_DocumentControlTypeId (50030)", + "UIA_SplitButtonControlTypeId (50031)", + "UIA_WindowControlTypeId (50032)", + "UIA_PaneControlTypeId (50033)", + "UIA_HeaderControlTypeId (50034)", + "UIA_HeaderItemControlTypeId (50035)", + "UIA_TableControlTypeId (50036)", + "UIA_TitleBarControlTypeId (50037)", + "UIA_SeparatorControlTypeId (50038)", + "UIA_SemanticZoomControlTypeId (50039)", + "UIA_AppBarControlTypeId (50040)", +}; + +/* + * IUIAutomationFocusChangedEventHandler vtbl. + */ +static inline event_data *impl_from_uia_focus_event(IUIAutomationFocusChangedEventHandler *iface) +{ + return CONTAINING_RECORD(iface, event_data, IUIAutomationFocusChangedEventHandler_iface); +} + +HRESULT WINAPI uia_focus_event_QueryInterface(IUIAutomationFocusChangedEventHandler *iface, + REFIID riid, void **ppv) +{ + event_data *This = impl_from_uia_focus_event(iface); + + WINE_TRACE("This %p, %s\n", This, debugstr_guid( riid )); + if (IsEqualIID(riid, &IID_IUIAutomationFocusChangedEventHandler) || + IsEqualIID(riid, &IID_IUnknown)) { + *ppv = iface; + } else { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUIAutomationFocusChangedEventHandler_AddRef(iface); + return S_OK; +} + +ULONG WINAPI uia_focus_event_AddRef(IUIAutomationFocusChangedEventHandler* iface) +{ + event_data *This = impl_from_uia_focus_event(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + WINE_TRACE("This %p, ref %d\n", This, ref); + + return ref; +} + +ULONG WINAPI uia_focus_event_Release(IUIAutomationFocusChangedEventHandler* iface) +{ + event_data *This = impl_from_uia_focus_event(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + WINE_TRACE("This %p, ref %d\n", This, ref); + + return ref; +} + +/*** IUIAutomationFocusChangedEventHandler methods ***/ +HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChangedEventHandler *iface, + IUIAutomationElement *sender) +{ + event_data *This = impl_from_uia_focus_event(iface); + + WINE_TRACE("This %p, sender %p\n", This, sender); + if (sender) + { + VARIANT var; + INT ct_id; + BSTR name; + + IUIAutomationElement_get_CurrentControlType(sender, &ct_id); + IUIAutomationElement_get_CurrentName(sender, &name); + IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_IsKeyboardFocusablePropertyId, &var); + + if ((last_keyup_event < (GetTickCount() - 5000)) && + ct_id == UIA_EditControlTypeId && (V_VT(&var) == VT_BOOL && V_BOOL(&var))) + { + if (!keyboard_up) + { + WINE_TRACE("Keyboard up!\n"); + keyboard_up = TRUE; + ShellExecuteW(NULL, NULL, L"steam://open/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); + + last_keyup_event = GetTickCount(); + } + } + else + { + if (keyboard_up) + { + WINE_TRACE("Keyboard down!\n"); + keyboard_up = FALSE; + } + } + + if (ct_id >= 50000) + ct_id -= 50000; + else + ct_id = 0; + + WINE_TRACE("element name: %s, ct_id %s\n", wine_dbgstr_w(name), ct_id_str[ct_id]); + } + + return S_OK; +} + +IUIAutomationFocusChangedEventHandlerVtbl uia_focus_event_vtbl = { + uia_focus_event_QueryInterface, + uia_focus_event_AddRef, + uia_focus_event_Release, + uia_focus_event_HandleFocusChangedEvent, +}; + +static HRESULT create_uia_event_handler(IUIAutomation **uia_iface, event_data *data) +{ + HRESULT hr; + + hr = CoCreateInstance(&CLSID_CUIAutomation, NULL, CLSCTX_INPROC_SERVER, + &IID_IUIAutomation, (void **)uia_iface); + if (FAILED(hr)) + { + ERR("Failed to create IUIAutomation interface, hr %#x\n", hr); + return hr; + } + + data->IUIAutomationFocusChangedEventHandler_iface.lpVtbl = &uia_focus_event_vtbl; + data->ref = 1; + + hr = IUIAutomation_AddFocusChangedEventHandler(*uia_iface, NULL, + &data->IUIAutomationFocusChangedEventHandler_iface); + if (FAILED(hr)) + ERR("Failed to add focus changed event handler, hr %#x\n", hr); + + return hr; +} + +static DWORD WINAPI tabtip_exit_watcher(LPVOID lpParam) +{ + struct thread_data *data = (struct thread_data *)lpParam; + DWORD event; + + event = WaitForMultipleObjects(THREAD_EVENT_COUNT, data->events, FALSE, INFINITE); + switch (event) + { + case EVENT_PGM_EXIT: + break; + + case EVENT_WINE_EXIT: + PostMessageW(data->main_hwnd, WM_DESTROY, 0, 0); + break; + + default: + break; + } + + return 0; +} + +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) +{ + HANDLE wine_exit_event, pgm_exit_event, started_event; + // Register the window class. + const wchar_t CLASS_NAME[] = L"IPTip_Main_Window"; + struct thread_data t_data = { }; + IUIAutomation *uia_iface; + WNDCLASSW wc = { }; + event_data data = { }; + MSG msg = { }; + int ret = 0; + HWND hwnd; + + wine_exit_event = pgm_exit_event = started_event = NULL; + last_keyup_event = 0; + keyboard_up = FALSE; + + NtSetInformationProcess( GetCurrentProcess(), ProcessWineMakeProcessSystem, + &wine_exit_event, sizeof(HANDLE *) ); + pgm_exit_event = CreateEventW(NULL, 0, 0, NULL); + started_event = CreateEventW(NULL, TRUE, FALSE, L"TABTIP_STARTED_EVENT"); + + if (!pgm_exit_event || !wine_exit_event || !started_event) + { + ERR("Failed to create event handles!\n"); + ret = -1; + goto exit; + } + + wc.lpfnWndProc = WindowProc; + wc.hInstance = hInstance; + wc.lpszClassName = CLASS_NAME; + + RegisterClassW(&wc); + + hwnd = CreateWindowExW(0, CLASS_NAME, + L"Input", WS_OVERLAPPEDWINDOW, 4, 4, 0, 0, NULL, + NULL, hInstance, NULL); + + if (!hwnd) + { + ERR("Failed to create hwnd!\n"); + ret = -1; + goto exit; + } + + if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) + { + ERR("CoInitialize failed!\n"); + ret = -1; + goto exit; + } + + if (FAILED(create_uia_event_handler(&uia_iface, &data))) + { + ret = -1; + goto exit; + } + + t_data.events[EVENT_WINE_EXIT] = wine_exit_event; + t_data.events[EVENT_PGM_EXIT] = pgm_exit_event; + t_data.main_hwnd = hwnd; + + SetEvent(started_event); + CreateThread(NULL, 0, tabtip_exit_watcher, &t_data, 0, NULL); + + while (GetMessageW(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + + SetEvent(pgm_exit_event); + IUIAutomation_RemoveAllEventHandlers(uia_iface); + IUIAutomation_Release(uia_iface); + + CoUninitialize(); + +exit: + + if (wine_exit_event) + CloseHandle(wine_exit_event); + + if (pgm_exit_event) + CloseHandle(pgm_exit_event); + + if (started_event) + CloseHandle(started_event); + + return ret; +} + +LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_DESTROY: + PostQuitMessage(0); + return 0; + + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + + FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1)); + + EndPaint(hwnd, &ps); + } + return 0; + default: + break; + } + + return DefWindowProcW(hwnd, uMsg, wParam, lParam); +} From 9d81782892dcf184097a748239aabc2a870e970a Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Wed, 8 Sep 2021 18:04:33 -0400 Subject: [PATCH 0882/1506] tabtip: Retrieve bounding rectangle for focused element. Retrieve the bounding rectangle of the focused accessible object, and pass this data to the steam OSK link if it's retrieved. Signed-off-by: Connor McAdams CW-Bug-Id: #18351 --- programs/tabtip/tabtip.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 45f77b66412..2a976ef2d29 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -155,12 +155,14 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged WINE_TRACE("This %p, sender %p\n", This, sender); if (sender) { + RECT rect = { 0 }; VARIANT var; INT ct_id; BSTR name; IUIAutomationElement_get_CurrentControlType(sender, &ct_id); IUIAutomationElement_get_CurrentName(sender, &name); + IUIAutomationElement_get_CurrentBoundingRectangle(sender, &rect); IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_IsKeyboardFocusablePropertyId, &var); if ((last_keyup_event < (GetTickCount() - 5000)) && @@ -170,7 +172,16 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged { WINE_TRACE("Keyboard up!\n"); keyboard_up = TRUE; - ShellExecuteW(NULL, NULL, L"steam://open/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); + if (rect.left || rect.top || rect.right || rect.bottom) + { + WCHAR link_buf[1024]; + + wsprintfW(link_buf, L"steam://open/keyboard?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", + rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); + ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); + } + else + ShellExecuteW(NULL, NULL, L"steam://open/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); last_keyup_event = GetTickCount(); } @@ -189,7 +200,8 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged else ct_id = 0; - WINE_TRACE("element name: %s, ct_id %s\n", wine_dbgstr_w(name), ct_id_str[ct_id]); + WINE_TRACE("element name: %s, ct_id %s, rect { %d, %d } - { %d, %d }\n", wine_dbgstr_w(name), ct_id_str[ct_id], + rect.left, rect.top, rect.right, rect.bottom); } return S_OK; From 7e897477a73c0886bdf8fe4f2b8a24537ddd415c Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Thu, 9 Sep 2021 14:02:08 -0400 Subject: [PATCH 0883/1506] tabtip: Only trigger steam OSK link if we're running on Steam Deck. Signed-off-by: Connor McAdams CW-Bug-Id: #18351 --- programs/tabtip/tabtip.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 2a976ef2d29..e8f1fc9ba6e 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -55,6 +55,7 @@ typedef struct { static DWORD last_keyup_event; static BOOL keyboard_up; +static BOOL use_steam_osk; static const char *ct_id_str[] = { "UIA_ButtonControlTypeId (50000)", @@ -165,7 +166,7 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged IUIAutomationElement_get_CurrentBoundingRectangle(sender, &rect); IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_IsKeyboardFocusablePropertyId, &var); - if ((last_keyup_event < (GetTickCount() - 5000)) && + if (use_steam_osk && (last_keyup_event < (GetTickCount() - 5000)) && ct_id == UIA_EditControlTypeId && (V_VT(&var) == VT_BOOL && V_BOOL(&var))) { if (!keyboard_up) @@ -259,6 +260,18 @@ static DWORD WINAPI tabtip_exit_watcher(LPVOID lpParam) return 0; } +static void tabtip_use_osk_check(void) +{ + const char *var = getenv("SteamDeck"); + + if (var && !strcmp(var, "1")) + use_steam_osk = TRUE; + else + use_steam_osk = FALSE; + + WINE_TRACE("use_steam_osk=%d\n", use_steam_osk); +} + int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { HANDLE wine_exit_event, pgm_exit_event, started_event; @@ -275,6 +288,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine wine_exit_event = pgm_exit_event = started_event = NULL; last_keyup_event = 0; keyboard_up = FALSE; + tabtip_use_osk_check(); NtSetInformationProcess( GetCurrentProcess(), ProcessWineMakeProcessSystem, &wine_exit_event, sizeof(HANDLE *) ); From 670fa1256ec735b83891e392e2364b757bc88176 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Thu, 4 Nov 2021 11:54:50 -0400 Subject: [PATCH 0884/1506] tabtip: Close keyboard upon focus loss. Call new "steam://close/keyboard" link upon edit control focus loss, to make sure keyboard is closed. Signed-off-by: Connor McAdams CW-Bug-Id: #18351 --- programs/tabtip/tabtip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index e8f1fc9ba6e..31b62c2bae9 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -192,6 +192,7 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged if (keyboard_up) { WINE_TRACE("Keyboard down!\n"); + ShellExecuteW(NULL, NULL, L"steam://close/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); keyboard_up = FALSE; } } From 8b038003de5824ffa744a31f4da37a895b0e405e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Nov 2021 09:29:21 +0100 Subject: [PATCH 0885/1506] tabtip: Set started event before creating a window. CW-Bug-Id: #18351 CW-Bug-Id: #19584 --- programs/tabtip/tabtip.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 31b62c2bae9..c035dd11ea2 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -303,6 +303,21 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine goto exit; } + if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) + { + ERR("CoInitialize failed!\n"); + ret = -1; + goto exit; + } + + SetEvent(started_event); + + if (FAILED(create_uia_event_handler(&uia_iface, &data))) + { + ret = -1; + goto exit; + } + wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.lpszClassName = CLASS_NAME; @@ -320,24 +335,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine goto exit; } - if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) - { - ERR("CoInitialize failed!\n"); - ret = -1; - goto exit; - } - - if (FAILED(create_uia_event_handler(&uia_iface, &data))) - { - ret = -1; - goto exit; - } - t_data.events[EVENT_WINE_EXIT] = wine_exit_event; t_data.events[EVENT_PGM_EXIT] = pgm_exit_event; t_data.main_hwnd = hwnd; - - SetEvent(started_event); CreateThread(NULL, 0, tabtip_exit_watcher, &t_data, 0, NULL); while (GetMessageW(&msg, NULL, 0, 0)) From c8a821d7a6c5d6e998d471ba32fce1dc6fafd928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 29 Nov 2021 18:59:13 +0100 Subject: [PATCH 0886/1506] explorer: Start tabtip process before the main loop. CW-Bug-Id: #18351 CW-Bug-Id: #19584 --- programs/explorer/desktop.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 9a58f13d887..509594b59a4 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -1009,6 +1009,38 @@ static inline BOOL is_whitespace(WCHAR c) return c == ' ' || c == '\t'; } +static HANDLE start_tabtip_process(void) +{ + static const WCHAR tabtip_started_event[] = L"TABTIP_STARTED_EVENT"; + PROCESS_INFORMATION pi; + STARTUPINFOW si = { sizeof(si) }; + HANDLE wait_handles[2]; + + if (!CreateProcessW(L"C:\\windows\\system32\\tabtip.exe", NULL, + NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi)) + { + WINE_ERR("Couldn't start tabtip.exe: error %lu\n", GetLastError()); + return FALSE; + } + CloseHandle(pi.hThread); + + wait_handles[0] = CreateEventW(NULL, TRUE, FALSE, tabtip_started_event); + wait_handles[1] = pi.hProcess; + + /* wait for the event to become available or the process to exit */ + if ((WaitForMultipleObjects(2, wait_handles, FALSE, INFINITE)) == WAIT_OBJECT_0 + 1) + { + DWORD exit_code; + GetExitCodeProcess(pi.hProcess, &exit_code); + WINE_ERR("Unexpected termination of tabtip.exe - exit code %ld\n", exit_code); + CloseHandle(wait_handles[0]); + return pi.hProcess; + } + + CloseHandle(wait_handles[0]); + return pi.hProcess; +} + /* main desktop management function */ void manage_desktop( WCHAR *arg ) { @@ -1016,6 +1048,7 @@ void manage_desktop( WCHAR *arg ) GUID guid; MSG msg; HWND hwnd; + HANDLE taptip; unsigned int width, height; WCHAR *cmdline = NULL, *driver = NULL; WCHAR *p = arg; @@ -1130,6 +1163,9 @@ void manage_desktop( WCHAR *arg ) desktopshellbrowserwindow_init(); shellwindows_init(); + /* FIXME: hack, run tabtip.exe on startup. */ + taptip = start_tabtip_process(); + /* run the desktop message loop */ if (hwnd) { @@ -1140,6 +1176,10 @@ void manage_desktop( WCHAR *arg ) if (pShellDDEInit) pShellDDEInit( FALSE ); + TerminateProcess( taptip, 0 ); + WaitForSingleObject( taptip, INFINITE ); + CloseHandle( taptip ); + ExitProcess( 0 ); } From 2b9ee80afec7eab55a462bee7c4afc36a801b29f Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Tue, 23 Nov 2021 17:09:13 -0500 Subject: [PATCH 0887/1506] tabtip: Check UIA_ValueIsReadOnlyPropertyId before triggering OSK. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index c035dd11ea2..1f6e852b370 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -147,6 +147,14 @@ ULONG WINAPI uia_focus_event_Release(IUIAutomationFocusChangedEventHandler* ifac return ref; } +static BOOL variant_to_bool(VARIANT *v) +{ + if (V_VT(v) == VT_BOOL && (V_BOOL(v) == VARIANT_TRUE)) + return TRUE; + + return FALSE; +} + /*** IUIAutomationFocusChangedEventHandler methods ***/ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChangedEventHandler *iface, IUIAutomationElement *sender) @@ -157,7 +165,7 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged if (sender) { RECT rect = { 0 }; - VARIANT var; + VARIANT var, var2; INT ct_id; BSTR name; @@ -165,9 +173,10 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged IUIAutomationElement_get_CurrentName(sender, &name); IUIAutomationElement_get_CurrentBoundingRectangle(sender, &rect); IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_IsKeyboardFocusablePropertyId, &var); + IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_ValueIsReadOnlyPropertyId, &var2); if (use_steam_osk && (last_keyup_event < (GetTickCount() - 5000)) && - ct_id == UIA_EditControlTypeId && (V_VT(&var) == VT_BOOL && V_BOOL(&var))) + (ct_id == UIA_EditControlTypeId) && variant_to_bool(&var) && !variant_to_bool(&var2)) { if (!keyboard_up) { From 61fd94d1626c271ba7b4a669cf867007b37f537e Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Tue, 23 Nov 2021 17:11:26 -0500 Subject: [PATCH 0888/1506] tabtip: Free returned UI Automation element name string. Signed-off-by: Connor McAdams --- programs/tabtip/Makefile.in | 2 +- programs/tabtip/tabtip.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/programs/tabtip/Makefile.in b/programs/tabtip/Makefile.in index 3b3d1f7ef92..3aee8a07741 100644 --- a/programs/tabtip/Makefile.in +++ b/programs/tabtip/Makefile.in @@ -1,6 +1,6 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = tabtip.exe -IMPORTS = uuid ole32 user32 oleacc uiautomationcore rpcrt4 shell32 +IMPORTS = uuid ole32 user32 oleacc uiautomationcore rpcrt4 shell32 oleaut32 EXTRADLLFLAGS = -mconsole -municode -mno-cygwin diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 1f6e852b370..e07c5ed6bb4 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -213,6 +213,7 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged WINE_TRACE("element name: %s, ct_id %s, rect { %d, %d } - { %d, %d }\n", wine_dbgstr_w(name), ct_id_str[ct_id], rect.left, rect.top, rect.right, rect.bottom); + SysFreeString(name); } return S_OK; From 0c92d7ff5cee3d61d4d568d83e27e82ff9f72225 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Tue, 23 Nov 2021 17:14:15 -0500 Subject: [PATCH 0889/1506] tabtip: Simplify OSK triggering conditions. Get rid of old, no longer necessary OSK trigger conditions. First is the delay between subsequent OSK trigger events, which was necessary when the big picture mode OSK would steal focus, but no longer applies here. Also allow for the OSK to be triggered even if the last focused control triggered the OSK, as sometimes a subsequent text field is selected without a non-edit control inbetween. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index e07c5ed6bb4..0f90c1778cd 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -53,7 +53,6 @@ typedef struct { LONG ref; } event_data; -static DWORD last_keyup_event; static BOOL keyboard_up; static BOOL use_steam_osk; @@ -175,26 +174,21 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_IsKeyboardFocusablePropertyId, &var); IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_ValueIsReadOnlyPropertyId, &var2); - if (use_steam_osk && (last_keyup_event < (GetTickCount() - 5000)) && - (ct_id == UIA_EditControlTypeId) && variant_to_bool(&var) && !variant_to_bool(&var2)) + if (use_steam_osk && (ct_id == UIA_EditControlTypeId) && variant_to_bool(&var) && + !variant_to_bool(&var2)) { - if (!keyboard_up) + WINE_TRACE("Keyboard up!\n"); + keyboard_up = TRUE; + if (rect.left || rect.top || rect.right || rect.bottom) { - WINE_TRACE("Keyboard up!\n"); - keyboard_up = TRUE; - if (rect.left || rect.top || rect.right || rect.bottom) - { - WCHAR link_buf[1024]; - - wsprintfW(link_buf, L"steam://open/keyboard?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", - rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); - ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); - } - else - ShellExecuteW(NULL, NULL, L"steam://open/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); - - last_keyup_event = GetTickCount(); + WCHAR link_buf[1024]; + + wsprintfW(link_buf, L"steam://open/keyboard?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", + rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); + ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); } + else + ShellExecuteW(NULL, NULL, L"steam://open/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); } else { @@ -297,7 +291,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine HWND hwnd; wine_exit_event = pgm_exit_event = started_event = NULL; - last_keyup_event = 0; keyboard_up = FALSE; tabtip_use_osk_check(); From d4adc81951f2c101b314a3b417ddb32379783adf Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Thu, 20 Oct 2022 10:36:53 -0400 Subject: [PATCH 0890/1506] tabtip: Add support for disabling OSK auto-popup on specific steam app ids. CW-Bug-Id: #21421 --- programs/tabtip/tabtip.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 0f90c1778cd..53669fe117b 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -265,6 +265,10 @@ static DWORD WINAPI tabtip_exit_watcher(LPVOID lpParam) return 0; } +static const char *osk_disable_appids[] = { + "1182900", /* A Plague Tale: Requiem */ +}; + static void tabtip_use_osk_check(void) { const char *var = getenv("SteamDeck"); @@ -274,6 +278,21 @@ static void tabtip_use_osk_check(void) else use_steam_osk = FALSE; + if ((var = getenv("SteamAppId"))) + { + int i; + + for (i = 0; i < ARRAY_SIZE(osk_disable_appids); i++) + { + if (!strcmp(var, osk_disable_appids[i])) + { + WINE_TRACE("Disabling OSK auto-popup for appid %s\n", var); + use_steam_osk = FALSE; + break; + } + } + } + WINE_TRACE("use_steam_osk=%d\n", use_steam_osk); } From 3e81db0a2f23c48003c0b4b02ed91e00bb8bb66d Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Wed, 7 Dec 2022 12:47:30 -0500 Subject: [PATCH 0891/1506] tabtip: Add steam app id argument to on-screen keyboard invocation links. CW-Bug-Id: #21613 --- programs/tabtip/tabtip.c | 46 ++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 53669fe117b..d9806ecfedb 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -55,6 +55,7 @@ typedef struct { static BOOL keyboard_up; static BOOL use_steam_osk; +static unsigned int steam_app_id; static const char *ct_id_str[] = { "UIA_ButtonControlTypeId (50000)", @@ -163,6 +164,7 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged WINE_TRACE("This %p, sender %p\n", This, sender); if (sender) { + WCHAR link_buf[1024] = { 0 }; RECT rect = { 0 }; VARIANT var, var2; INT ct_id; @@ -177,29 +179,40 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged if (use_steam_osk && (ct_id == UIA_EditControlTypeId) && variant_to_bool(&var) && !variant_to_bool(&var2)) { - WINE_TRACE("Keyboard up!\n"); - keyboard_up = TRUE; + WCHAR *cur_buf_pos = link_buf; + + if (steam_app_id) + cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard?AppID=%d", steam_app_id); + else + cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard"); + if (rect.left || rect.top || rect.right || rect.bottom) { - WCHAR link_buf[1024]; - - wsprintfW(link_buf, L"steam://open/keyboard?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", - rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); - ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); + if (steam_app_id) + wsprintfW(cur_buf_pos, L"&XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", + rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); + else + wsprintfW(cur_buf_pos, L"?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", + rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); } - else - ShellExecuteW(NULL, NULL, L"steam://open/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); + + WINE_TRACE("Keyboard up!\n"); + keyboard_up = TRUE; } - else + else if (keyboard_up) { - if (keyboard_up) - { - WINE_TRACE("Keyboard down!\n"); - ShellExecuteW(NULL, NULL, L"steam://close/keyboard", NULL, NULL, SW_SHOWNOACTIVATE); - keyboard_up = FALSE; - } + if (steam_app_id) + wsprintfW(link_buf, L"steam://close/keyboard?AppID=%d", steam_app_id); + else + wsprintfW(link_buf, L"steam://close/keyboard"); + + WINE_TRACE("Keyboard down!\n"); + keyboard_up = FALSE; } + if (lstrlenW(link_buf)) + ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); + if (ct_id >= 50000) ct_id -= 50000; else @@ -291,6 +304,7 @@ static void tabtip_use_osk_check(void) break; } } + steam_app_id = strtol(var, NULL, 10); } WINE_TRACE("use_steam_osk=%d\n", use_steam_osk); From 10bab3c52003fbe7806e03bc3149dc76f7222f1d Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 6 Jan 2023 14:49:16 -0500 Subject: [PATCH 0892/1506] tabtip: Disable OSK auto popup for A Plague Tale: Innocence. A Plague Tale: Innocence spawns a short lived window containing an edit control that is never visible to the user. In order to avoid this triggering the OSK to popup briefly, just disable OSK auto popup for this game. CW-Bug-Id: #21421 --- programs/tabtip/tabtip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index d9806ecfedb..f7c08ec187a 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -280,6 +280,7 @@ static DWORD WINAPI tabtip_exit_watcher(LPVOID lpParam) static const char *osk_disable_appids[] = { "1182900", /* A Plague Tale: Requiem */ + "752590", /* A Plague Tale: Innocence */ }; static void tabtip_use_osk_check(void) From e398d8ee6654d4e9bb5e0a43335fe5913b354f90 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 10 Feb 2023 15:32:02 -0500 Subject: [PATCH 0893/1506] explorer: Only start tabtip process if desktop window is successfully created. This avoids creating an extra short-lived tabtip process when another process has created the desktop window first. Signed-off-by: Connor McAdams --- programs/explorer/desktop.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 509594b59a4..3571368b8f3 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -1048,7 +1048,7 @@ void manage_desktop( WCHAR *arg ) GUID guid; MSG msg; HWND hwnd; - HANDLE taptip; + HANDLE tabtip = NULL; unsigned int width, height; WCHAR *cmdline = NULL, *driver = NULL; WCHAR *p = arg; @@ -1163,12 +1163,12 @@ void manage_desktop( WCHAR *arg ) desktopshellbrowserwindow_init(); shellwindows_init(); - /* FIXME: hack, run tabtip.exe on startup. */ - taptip = start_tabtip_process(); - /* run the desktop message loop */ if (hwnd) { + /* FIXME: hack, run tabtip.exe on startup. */ + tabtip = start_tabtip_process(); + TRACE( "desktop message loop starting on hwnd %p\n", hwnd ); while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg ); TRACE( "desktop message loop exiting for hwnd %p\n", hwnd ); @@ -1176,9 +1176,12 @@ void manage_desktop( WCHAR *arg ) if (pShellDDEInit) pShellDDEInit( FALSE ); - TerminateProcess( taptip, 0 ); - WaitForSingleObject( taptip, INFINITE ); - CloseHandle( taptip ); + if (tabtip) + { + TerminateProcess( tabtip, 0 ); + WaitForSingleObject( tabtip, INFINITE ); + CloseHandle( tabtip ); + } ExitProcess( 0 ); } From 85cccadd1e81f33a66cb2bb28fd7ca6a36e73af3 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 22 Sep 2023 11:06:28 -0400 Subject: [PATCH 0894/1506] tabtip: Get rid of exit watching thread. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 85 ++++++++++++---------------------------- 1 file changed, 26 insertions(+), 59 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index f7c08ec187a..ce0fb76e068 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -34,20 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(tabtip); -extern HANDLE CDECL __wine_make_process_system(void); LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -enum { - EVENT_PGM_EXIT, - EVENT_WINE_EXIT, - THREAD_EVENT_COUNT, -}; - -struct thread_data { - HANDLE events[THREAD_EVENT_COUNT]; - HWND main_hwnd; -}; - typedef struct { IUIAutomationFocusChangedEventHandler IUIAutomationFocusChangedEventHandler_iface; LONG ref; @@ -256,28 +244,6 @@ static HRESULT create_uia_event_handler(IUIAutomation **uia_iface, event_data *d return hr; } -static DWORD WINAPI tabtip_exit_watcher(LPVOID lpParam) -{ - struct thread_data *data = (struct thread_data *)lpParam; - DWORD event; - - event = WaitForMultipleObjects(THREAD_EVENT_COUNT, data->events, FALSE, INFINITE); - switch (event) - { - case EVENT_PGM_EXIT: - break; - - case EVENT_WINE_EXIT: - PostMessageW(data->main_hwnd, WM_DESTROY, 0, 0); - break; - - default: - break; - } - - return 0; -} - static const char *osk_disable_appids[] = { "1182900", /* A Plague Tale: Requiem */ "752590", /* A Plague Tale: Innocence */ @@ -313,27 +279,23 @@ static void tabtip_use_osk_check(void) int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { - HANDLE wine_exit_event, pgm_exit_event, started_event; // Register the window class. const wchar_t CLASS_NAME[] = L"IPTip_Main_Window"; - struct thread_data t_data = { }; + HANDLE wine_exit_event, started_event; IUIAutomation *uia_iface; WNDCLASSW wc = { }; event_data data = { }; - MSG msg = { }; int ret = 0; HWND hwnd; - wine_exit_event = pgm_exit_event = started_event = NULL; keyboard_up = FALSE; tabtip_use_osk_check(); + wine_exit_event = started_event = NULL; NtSetInformationProcess( GetCurrentProcess(), ProcessWineMakeProcessSystem, &wine_exit_event, sizeof(HANDLE *) ); - pgm_exit_event = CreateEventW(NULL, 0, 0, NULL); started_event = CreateEventW(NULL, TRUE, FALSE, L"TABTIP_STARTED_EVENT"); - - if (!pgm_exit_event || !wine_exit_event || !started_event) + if (!wine_exit_event || !started_event) { ERR("Failed to create event handles!\n"); ret = -1; @@ -372,33 +334,38 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine goto exit; } - t_data.events[EVENT_WINE_EXIT] = wine_exit_event; - t_data.events[EVENT_PGM_EXIT] = pgm_exit_event; - t_data.main_hwnd = hwnd; - CreateThread(NULL, 0, tabtip_exit_watcher, &t_data, 0, NULL); - - while (GetMessageW(&msg, NULL, 0, 0)) + while (MsgWaitForMultipleObjects(1, &wine_exit_event, FALSE, INFINITE, QS_ALLINPUT) != WAIT_OBJECT_0) { - TranslateMessage(&msg); - DispatchMessageW(&msg); + BOOL quit = FALSE; + MSG msg; + + while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) + { + switch (msg.message) + { + case WM_QUIT: /* Unlikely to ever happen, but handle anyways. */ + quit = TRUE; + break; + + default: + TranslateMessage(&msg); + DispatchMessageW(&msg); + break; + } + } + + if (quit) + break; } - SetEvent(pgm_exit_event); IUIAutomation_RemoveAllEventHandlers(uia_iface); IUIAutomation_Release(uia_iface); CoUninitialize(); exit: - - if (wine_exit_event) - CloseHandle(wine_exit_event); - - if (pgm_exit_event) - CloseHandle(pgm_exit_event); - - if (started_event) - CloseHandle(started_event); + if (wine_exit_event) CloseHandle(wine_exit_event); + if (started_event) CloseHandle(started_event); return ret; } From 675b2c090100b570bb56e1a57daf80d695d936b9 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 22 Sep 2023 11:51:22 -0400 Subject: [PATCH 0895/1506] tabtip: Cleanup tabtip window class. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 43 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index ce0fb76e068..92f0dd59ca8 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -34,8 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(tabtip); -LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - typedef struct { IUIAutomationFocusChangedEventHandler IUIAutomationFocusChangedEventHandler_iface; LONG ref; @@ -45,6 +43,12 @@ static BOOL keyboard_up; static BOOL use_steam_osk; static unsigned int steam_app_id; +static const WCHAR tabtip_window_class_name[] = L"IPTip_Main_Window"; +static LRESULT CALLBACK tabtip_win_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + return DefWindowProcW(hwnd, msg, wparam, lparam); +} + static const char *ct_id_str[] = { "UIA_ButtonControlTypeId (50000)", "UIA_CalendarControlTypeId (50001)", @@ -279,8 +283,6 @@ static void tabtip_use_osk_check(void) int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { - // Register the window class. - const wchar_t CLASS_NAME[] = L"IPTip_Main_Window"; HANDLE wine_exit_event, started_event; IUIAutomation *uia_iface; WNDCLASSW wc = { }; @@ -317,19 +319,19 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine goto exit; } - wc.lpfnWndProc = WindowProc; + wc.lpfnWndProc = tabtip_win_proc; wc.hInstance = hInstance; - wc.lpszClassName = CLASS_NAME; - + wc.lpszClassName = tabtip_window_class_name; RegisterClassW(&wc); - hwnd = CreateWindowExW(0, CLASS_NAME, + hwnd = CreateWindowExW(0, tabtip_window_class_name, L"Input", WS_OVERLAPPEDWINDOW, 4, 4, 0, 0, NULL, NULL, hInstance, NULL); if (!hwnd) { ERR("Failed to create hwnd!\n"); + UnregisterClassW(tabtip_window_class_name, hInstance); ret = -1; goto exit; } @@ -369,28 +371,3 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine return ret; } - -LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uMsg) - { - case WM_DESTROY: - PostQuitMessage(0); - return 0; - - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdc = BeginPaint(hwnd, &ps); - - FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1)); - - EndPaint(hwnd, &ps); - } - return 0; - default: - break; - } - - return DefWindowProcW(hwnd, uMsg, wParam, lParam); -} From 5a89da7ac6ed73d2588d002739e335ac5c2378cf Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 22 Sep 2023 12:01:32 -0400 Subject: [PATCH 0896/1506] tabtip: Get rid of unnecessary event_data structure. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 70 ++++++++++++---------------------------- 1 file changed, 20 insertions(+), 50 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 92f0dd59ca8..c935e741999 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -34,11 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(tabtip); -typedef struct { - IUIAutomationFocusChangedEventHandler IUIAutomationFocusChangedEventHandler_iface; - LONG ref; -} event_data; - static BOOL keyboard_up; static BOOL use_steam_osk; static unsigned int steam_app_id; @@ -96,47 +91,27 @@ static const char *ct_id_str[] = { /* * IUIAutomationFocusChangedEventHandler vtbl. */ -static inline event_data *impl_from_uia_focus_event(IUIAutomationFocusChangedEventHandler *iface) -{ - return CONTAINING_RECORD(iface, event_data, IUIAutomationFocusChangedEventHandler_iface); -} - -HRESULT WINAPI uia_focus_event_QueryInterface(IUIAutomationFocusChangedEventHandler *iface, +static HRESULT WINAPI FocusChangedHandler_QueryInterface(IUIAutomationFocusChangedEventHandler *iface, REFIID riid, void **ppv) { - event_data *This = impl_from_uia_focus_event(iface); - - WINE_TRACE("This %p, %s\n", This, debugstr_guid( riid )); - if (IsEqualIID(riid, &IID_IUIAutomationFocusChangedEventHandler) || - IsEqualIID(riid, &IID_IUnknown)) { + *ppv = NULL; + if (IsEqualIID(riid, &IID_IUIAutomationFocusChangedEventHandler) || IsEqualIID(riid, &IID_IUnknown)) *ppv = iface; - } else { - *ppv = NULL; + else return E_NOINTERFACE; - } IUIAutomationFocusChangedEventHandler_AddRef(iface); return S_OK; } -ULONG WINAPI uia_focus_event_AddRef(IUIAutomationFocusChangedEventHandler* iface) +static ULONG WINAPI FocusChangedHandler_AddRef(IUIAutomationFocusChangedEventHandler* iface) { - event_data *This = impl_from_uia_focus_event(iface); - ULONG ref = InterlockedIncrement(&This->ref); - - WINE_TRACE("This %p, ref %d\n", This, ref); - - return ref; + return 2; } -ULONG WINAPI uia_focus_event_Release(IUIAutomationFocusChangedEventHandler* iface) +static ULONG WINAPI FocusChangedHandler_Release(IUIAutomationFocusChangedEventHandler* iface) { - event_data *This = impl_from_uia_focus_event(iface); - ULONG ref = InterlockedDecrement(&This->ref); - - WINE_TRACE("This %p, ref %d\n", This, ref); - - return ref; + return 1; } static BOOL variant_to_bool(VARIANT *v) @@ -147,13 +122,10 @@ static BOOL variant_to_bool(VARIANT *v) return FALSE; } -/*** IUIAutomationFocusChangedEventHandler methods ***/ -HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChangedEventHandler *iface, +static HRESULT WINAPI FocusChangedHandler_HandleFocusChangedEvent(IUIAutomationFocusChangedEventHandler *iface, IUIAutomationElement *sender) { - event_data *This = impl_from_uia_focus_event(iface); - - WINE_TRACE("This %p, sender %p\n", This, sender); + WINE_TRACE("sender %p\n", sender); if (sender) { WCHAR link_buf[1024] = { 0 }; @@ -218,14 +190,16 @@ HRESULT WINAPI uia_focus_event_HandleFocusChangedEvent(IUIAutomationFocusChanged return S_OK; } -IUIAutomationFocusChangedEventHandlerVtbl uia_focus_event_vtbl = { - uia_focus_event_QueryInterface, - uia_focus_event_AddRef, - uia_focus_event_Release, - uia_focus_event_HandleFocusChangedEvent, +static const IUIAutomationFocusChangedEventHandlerVtbl FocusChangedHandlerVtbl = { + FocusChangedHandler_QueryInterface, + FocusChangedHandler_AddRef, + FocusChangedHandler_Release, + FocusChangedHandler_HandleFocusChangedEvent, }; -static HRESULT create_uia_event_handler(IUIAutomation **uia_iface, event_data *data) +static IUIAutomationFocusChangedEventHandler FocusChangedHandler = { &FocusChangedHandlerVtbl }; + +static HRESULT add_uia_event_handler(IUIAutomation **uia_iface) { HRESULT hr; @@ -237,11 +211,8 @@ static HRESULT create_uia_event_handler(IUIAutomation **uia_iface, event_data *d return hr; } - data->IUIAutomationFocusChangedEventHandler_iface.lpVtbl = &uia_focus_event_vtbl; - data->ref = 1; - hr = IUIAutomation_AddFocusChangedEventHandler(*uia_iface, NULL, - &data->IUIAutomationFocusChangedEventHandler_iface); + &FocusChangedHandler); if (FAILED(hr)) ERR("Failed to add focus changed event handler, hr %#x\n", hr); @@ -286,7 +257,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine HANDLE wine_exit_event, started_event; IUIAutomation *uia_iface; WNDCLASSW wc = { }; - event_data data = { }; int ret = 0; HWND hwnd; @@ -313,7 +283,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine SetEvent(started_event); - if (FAILED(create_uia_event_handler(&uia_iface, &data))) + if (FAILED(add_uia_event_handler(&uia_iface))) { ret = -1; goto exit; From 418b9162307eaf78890d0722a227d42b130768db Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 22 Sep 2023 12:22:12 -0400 Subject: [PATCH 0897/1506] tabtip: Use custom cache request to cache relevant property IDs. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 51 +++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index c935e741999..f8020a8595c 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -199,23 +199,54 @@ static const IUIAutomationFocusChangedEventHandlerVtbl FocusChangedHandlerVtbl = static IUIAutomationFocusChangedEventHandler FocusChangedHandler = { &FocusChangedHandlerVtbl }; +static const int uia_cache_props[] = { UIA_BoundingRectanglePropertyId, UIA_ControlTypePropertyId, UIA_NamePropertyId, + UIA_HasKeyboardFocusPropertyId, UIA_ValueIsReadOnlyPropertyId, }; static HRESULT add_uia_event_handler(IUIAutomation **uia_iface) { + IUIAutomationCacheRequest *cache_req = NULL; + IUIAutomationCondition *true_cond = NULL; HRESULT hr; + int i; - hr = CoCreateInstance(&CLSID_CUIAutomation, NULL, CLSCTX_INPROC_SERVER, - &IID_IUIAutomation, (void **)uia_iface); + hr = CoCreateInstance(&CLSID_CUIAutomation8, NULL, CLSCTX_INPROC_SERVER, &IID_IUIAutomation, (void **)uia_iface); if (FAILED(hr)) { ERR("Failed to create IUIAutomation interface, hr %#x\n", hr); return hr; } - hr = IUIAutomation_AddFocusChangedEventHandler(*uia_iface, NULL, - &FocusChangedHandler); + hr = IUIAutomation_CreateCacheRequest(*uia_iface, &cache_req); + if (FAILED(hr)) + goto exit; + + hr = IUIAutomation_CreateTrueCondition(*uia_iface, &true_cond); + if (FAILED(hr)) + goto exit; + + hr = IUIAutomationCacheRequest_put_TreeFilter(cache_req, true_cond); + if (FAILED(hr)) + goto exit; + + for (i = 0; i < ARRAY_SIZE(uia_cache_props); i++) + { + hr = IUIAutomationCacheRequest_AddProperty(cache_req, uia_cache_props[i]); + if (FAILED(hr)) + { + ERR("Failed to add prop_id %d to cache req, hr %#x\n", uia_cache_props[i], hr); + goto exit; + } + } + + hr = IUIAutomation_AddFocusChangedEventHandler(*uia_iface, cache_req, &FocusChangedHandler); if (FAILED(hr)) ERR("Failed to add focus changed event handler, hr %#x\n", hr); +exit: + if (cache_req) + IUIAutomationCacheRequest_Release(cache_req); + if (true_cond) + IUIAutomationCondition_Release(true_cond); + return hr; } @@ -255,7 +286,7 @@ static void tabtip_use_osk_check(void) int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { HANDLE wine_exit_event, started_event; - IUIAutomation *uia_iface; + IUIAutomation *uia_iface = NULL; WNDCLASSW wc = { }; int ret = 0; HWND hwnd; @@ -330,12 +361,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine break; } - IUIAutomation_RemoveAllEventHandlers(uia_iface); - IUIAutomation_Release(uia_iface); +exit: + if (uia_iface) + { + IUIAutomation_RemoveAllEventHandlers(uia_iface); + IUIAutomation_Release(uia_iface); + } CoUninitialize(); - -exit: if (wine_exit_event) CloseHandle(wine_exit_event); if (started_event) CloseHandle(started_event); From 4e91c94e6a655ac489aa33835959020933996981 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 22 Sep 2023 13:11:54 -0400 Subject: [PATCH 0898/1506] tabtip: Rework focus changed event handler method to make use of cached properties. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 230 ++++++++++++++++++++++----------------- 1 file changed, 129 insertions(+), 101 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index f8020a8595c..6b025acb304 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -38,56 +38,81 @@ static BOOL keyboard_up; static BOOL use_steam_osk; static unsigned int steam_app_id; +struct str_id_pair { + int id; + const char *str; +}; + +static const struct str_id_pair uia_control_type_id_strs[] = { + { UIA_ButtonControlTypeId, "UIA_ButtonControlTypeId", }, + { UIA_CalendarControlTypeId, "UIA_CalendarControlTypeId", }, + { UIA_CheckBoxControlTypeId, "UIA_CheckBoxControlTypeId", }, + { UIA_ComboBoxControlTypeId, "UIA_ComboBoxControlTypeId", }, + { UIA_EditControlTypeId, "UIA_EditControlTypeId", }, + { UIA_HyperlinkControlTypeId, "UIA_HyperlinkControlTypeId", }, + { UIA_ImageControlTypeId, "UIA_ImageControlTypeId", }, + { UIA_ListItemControlTypeId, "UIA_ListItemControlTypeId", }, + { UIA_ListControlTypeId, "UIA_ListControlTypeId", }, + { UIA_MenuControlTypeId, "UIA_MenuControlTypeId", }, + { UIA_MenuBarControlTypeId, "UIA_MenuBarControlTypeId", }, + { UIA_MenuItemControlTypeId, "UIA_MenuItemControlTypeId", }, + { UIA_ProgressBarControlTypeId, "UIA_ProgressBarControlTypeId", }, + { UIA_RadioButtonControlTypeId, "UIA_RadioButtonControlTypeId", }, + { UIA_ScrollBarControlTypeId, "UIA_ScrollBarControlTypeId", }, + { UIA_SliderControlTypeId, "UIA_SliderControlTypeId", }, + { UIA_SpinnerControlTypeId, "UIA_SpinnerControlTypeId", }, + { UIA_StatusBarControlTypeId, "UIA_StatusBarControlTypeId", }, + { UIA_TabControlTypeId, "UIA_TabControlTypeId", }, + { UIA_TabItemControlTypeId, "UIA_TabItemControlTypeId", }, + { UIA_TextControlTypeId, "UIA_TextControlTypeId", }, + { UIA_ToolBarControlTypeId, "UIA_ToolBarControlTypeId", }, + { UIA_ToolTipControlTypeId, "UIA_ToolTipControlTypeId", }, + { UIA_TreeControlTypeId, "UIA_TreeControlTypeId", }, + { UIA_TreeItemControlTypeId, "UIA_TreeItemControlTypeId", }, + { UIA_CustomControlTypeId, "UIA_CustomControlTypeId", }, + { UIA_GroupControlTypeId, "UIA_GroupControlTypeId", }, + { UIA_ThumbControlTypeId, "UIA_ThumbControlTypeId", }, + { UIA_DataGridControlTypeId, "UIA_DataGridControlTypeId", }, + { UIA_DataItemControlTypeId, "UIA_DataItemControlTypeId", }, + { UIA_DocumentControlTypeId, "UIA_DocumentControlTypeId", }, + { UIA_SplitButtonControlTypeId, "UIA_SplitButtonControlTypeId", }, + { UIA_WindowControlTypeId, "UIA_WindowControlTypeId", }, + { UIA_PaneControlTypeId, "UIA_PaneControlTypeId", }, + { UIA_HeaderControlTypeId, "UIA_HeaderControlTypeId", }, + { UIA_HeaderItemControlTypeId, "UIA_HeaderItemControlTypeId", }, + { UIA_TableControlTypeId, "UIA_TableControlTypeId", }, + { UIA_TitleBarControlTypeId, "UIA_TitleBarControlTypeId", }, + { UIA_SeparatorControlTypeId, "UIA_SeparatorControlTypeId", }, + { UIA_SemanticZoomControlTypeId, "UIA_SemanticZoomControlTypeId", }, + { UIA_AppBarControlTypeId, "UIA_AppBarControlTypeId", }, +}; + +static int __cdecl str_id_pair_compare(const void *a, const void *b) +{ + const int *id = a; + const struct str_id_pair *pair = b; + + return ((*id) > pair->id) - ((*id) < pair->id); +} + +#define get_str_for_id(id, id_pair) \ + get_str_from_id_pair( (id), (id_pair), (ARRAY_SIZE(id_pair)) ) +static const char *get_str_from_id_pair(int id, const struct str_id_pair *id_pair, int id_pair_size) +{ + const struct str_id_pair *pair; + + if ((pair = bsearch(&id, id_pair, id_pair_size, sizeof(*pair), str_id_pair_compare))) + return pair->str; + + return ""; +} + static const WCHAR tabtip_window_class_name[] = L"IPTip_Main_Window"; static LRESULT CALLBACK tabtip_win_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { return DefWindowProcW(hwnd, msg, wparam, lparam); } -static const char *ct_id_str[] = { - "UIA_ButtonControlTypeId (50000)", - "UIA_CalendarControlTypeId (50001)", - "UIA_CheckBoxControlTypeId (50002)", - "UIA_ComboBoxControlTypeId (50003)", - "UIA_EditControlTypeId (50004)", - "UIA_HyperlinkControlTypeId (50005)", - "UIA_ImageControlTypeId (50006)", - "UIA_ListItemControlTypeId (50007)", - "UIA_ListControlTypeId (50008)", - "UIA_MenuControlTypeId (50009)", - "UIA_MenuBarControlTypeId (50010)", - "UIA_MenuItemControlTypeId (50011)", - "UIA_ProgressBarControlTypeId (50012)", - "UIA_RadioButtonControlTypeId (50013)", - "UIA_ScrollBarControlTypeId (50014)", - "UIA_SliderControlTypeId (50015)", - "UIA_SpinnerControlTypeId (50016)", - "UIA_StatusBarControlTypeId (50017)", - "UIA_TabControlTypeId (50018)", - "UIA_TabItemControlTypeId (50019)", - "UIA_TextControlTypeId (50020)", - "UIA_ToolBarControlTypeId (50021)", - "UIA_ToolTipControlTypeId (50022)", - "UIA_TreeControlTypeId (50023)", - "UIA_TreeItemControlTypeId (50024)", - "UIA_CustomControlTypeId (50025)", - "UIA_GroupControlTypeId (50026)", - "UIA_ThumbControlTypeId (50027)", - "UIA_DataGridControlTypeId (50028)", - "UIA_DataItemControlTypeId (50029)", - "UIA_DocumentControlTypeId (50030)", - "UIA_SplitButtonControlTypeId (50031)", - "UIA_WindowControlTypeId (50032)", - "UIA_PaneControlTypeId (50033)", - "UIA_HeaderControlTypeId (50034)", - "UIA_HeaderItemControlTypeId (50035)", - "UIA_TableControlTypeId (50036)", - "UIA_TitleBarControlTypeId (50037)", - "UIA_SeparatorControlTypeId (50038)", - "UIA_SemanticZoomControlTypeId (50039)", - "UIA_AppBarControlTypeId (50040)", -}; - /* * IUIAutomationFocusChangedEventHandler vtbl. */ @@ -114,79 +139,82 @@ static ULONG WINAPI FocusChangedHandler_Release(IUIAutomationFocusChangedEventHa return 1; } -static BOOL variant_to_bool(VARIANT *v) -{ - if (V_VT(v) == VT_BOOL && (V_BOOL(v) == VARIANT_TRUE)) - return TRUE; - - return FALSE; -} - static HRESULT WINAPI FocusChangedHandler_HandleFocusChangedEvent(IUIAutomationFocusChangedEventHandler *iface, IUIAutomationElement *sender) { + BOOL is_readonly, has_kbd_focus; + WCHAR link_buf[1024] = { 0 }; + RECT rect = { 0 }; + BSTR name = NULL; + int control_type; + HRESULT hr; + VARIANT v; + WINE_TRACE("sender %p\n", sender); - if (sender) - { - WCHAR link_buf[1024] = { 0 }; - RECT rect = { 0 }; - VARIANT var, var2; - INT ct_id; - BSTR name; - - IUIAutomationElement_get_CurrentControlType(sender, &ct_id); - IUIAutomationElement_get_CurrentName(sender, &name); - IUIAutomationElement_get_CurrentBoundingRectangle(sender, &rect); - IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_IsKeyboardFocusablePropertyId, &var); - IUIAutomationElement_GetCurrentPropertyValue(sender, UIA_ValueIsReadOnlyPropertyId, &var2); - - if (use_steam_osk && (ct_id == UIA_EditControlTypeId) && variant_to_bool(&var) && - !variant_to_bool(&var2)) - { - WCHAR *cur_buf_pos = link_buf; - if (steam_app_id) - cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard?AppID=%d", steam_app_id); - else - cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard"); + /* Should never happen, handle it anyways just in case. */ + if (!sender) + return S_OK; - if (rect.left || rect.top || rect.right || rect.bottom) - { - if (steam_app_id) - wsprintfW(cur_buf_pos, L"&XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", - rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); - else - wsprintfW(cur_buf_pos, L"?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", - rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); - } + hr = IUIAutomationElement_get_CachedBoundingRectangle(sender, &rect); + if (FAILED(hr)) WINE_ERR("Failed to get cached bounding rect, hr %#x\n", hr); - WINE_TRACE("Keyboard up!\n"); - keyboard_up = TRUE; - } - else if (keyboard_up) + hr = IUIAutomationElement_get_CachedControlType(sender, &control_type); + if (FAILED(hr)) WINE_ERR("Failed to get cached control type, hr %#x\n", hr); + + hr = IUIAutomationElement_get_CachedName(sender, &name); + if (FAILED(hr)) WINE_ERR("Failed to get cached name, hr %#x\n", hr); + + hr = IUIAutomationElement_get_CachedHasKeyboardFocus(sender, &has_kbd_focus); + if (FAILED(hr)) WINE_ERR("Failed to get cached has keyboard focus property, hr %#x\n", hr); + + VariantInit(&v); + hr = IUIAutomationElement_GetCachedPropertyValueEx(sender, UIA_ValueIsReadOnlyPropertyId, TRUE, &v); + if (FAILED(hr)) WINE_ERR("Failed to get cached property value for UIA_ValueIsReadOnlyPropertyId, hr %#x\n", hr); + is_readonly = ((V_VT(&v) == VT_BOOL) && (V_BOOL(&v) == VARIANT_TRUE)); + VariantClear(&v); + + if (use_steam_osk && (control_type == UIA_EditControlTypeId) && has_kbd_focus && !is_readonly) + { + WCHAR *cur_buf_pos = link_buf; + + if (steam_app_id) + cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard?AppID=%d", steam_app_id); + else + cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard"); + + if (rect.left || rect.top || rect.right || rect.bottom) { if (steam_app_id) - wsprintfW(link_buf, L"steam://close/keyboard?AppID=%d", steam_app_id); + wsprintfW(cur_buf_pos, L"&XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", + rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); else - wsprintfW(link_buf, L"steam://close/keyboard"); - - WINE_TRACE("Keyboard down!\n"); - keyboard_up = FALSE; + wsprintfW(cur_buf_pos, L"?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", + rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); } - if (lstrlenW(link_buf)) - ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); - - if (ct_id >= 50000) - ct_id -= 50000; + WINE_TRACE("Keyboard up!\n"); + keyboard_up = TRUE; + } + else if (keyboard_up) + { + if (steam_app_id) + wsprintfW(link_buf, L"steam://close/keyboard?AppID=%d", steam_app_id); else - ct_id = 0; + wsprintfW(link_buf, L"steam://close/keyboard"); - WINE_TRACE("element name: %s, ct_id %s, rect { %d, %d } - { %d, %d }\n", wine_dbgstr_w(name), ct_id_str[ct_id], - rect.left, rect.top, rect.right, rect.bottom); - SysFreeString(name); + WINE_TRACE("Keyboard down!\n"); + keyboard_up = FALSE; } + if (lstrlenW(link_buf)) + ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); + + WINE_TRACE("name %s, control_type %d (%s), rect %s, has_kbd_focus %d, is_readonly %d\n", wine_dbgstr_w(name), + control_type, get_str_for_id(control_type, uia_control_type_id_strs), wine_dbgstr_rect(&rect), + has_kbd_focus, is_readonly); + SysFreeString(name); + return S_OK; } From 1807fd0be2356e140844cfec3ce2eacd632e6cb7 Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Fri, 22 Sep 2023 13:55:21 -0400 Subject: [PATCH 0899/1506] tabtip: Make steam onscreen keyboard link generation more robust. Signed-off-by: Connor McAdams --- programs/tabtip/tabtip.c | 74 +++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index 6b025acb304..e4693c4a80a 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -113,6 +113,48 @@ static LRESULT CALLBACK tabtip_win_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR return DefWindowProcW(hwnd, msg, wparam, lparam); } +#define MAX_LINK_BUF 4096 +struct osk_link_data { + WCHAR link_buf[MAX_LINK_BUF]; + WCHAR *link_buf_pos; + int args_count; +}; + +static void osk_link_init(struct osk_link_data *data, const WCHAR *link) +{ + data->link_buf_pos = data->link_buf; + data->link_buf_pos += wsprintfW(data->link_buf, L"%s", link); + data->args_count = 0; +} + +#define MAX_ARG_BUF 512 +static const WCHAR max_int_arg_str[] = L"=-0000000000"; +static const WCHAR separator_arg_start_str[] = L"?"; +static const WCHAR separator_arg_cont_str[] = L"&"; +static const int max_separator_str_len = max(ARRAY_SIZE(separator_arg_start_str), ARRAY_SIZE(separator_arg_cont_str)); +static void osk_link_add_int_arg(struct osk_link_data *data, const WCHAR *arg, int arg_val) +{ + const WCHAR *separator_str = !data->args_count ? separator_arg_start_str : separator_arg_cont_str; + WCHAR arg_buf[MAX_ARG_BUF] = { 0 }; + int arg_buf_len; + + if ((lstrlenW(arg) + ARRAY_SIZE(max_int_arg_str)) >= MAX_ARG_BUF) + { + ERR("Arg would overflow buffer, suggest upping argument buffer size.\n"); + return; + } + + arg_buf_len = wsprintfW(arg_buf, L"%s=%d", arg, arg_val); + if ((arg_buf_len + (MAX_LINK_BUF - (data->link_buf_pos - data->link_buf)) + max_separator_str_len) >= MAX_LINK_BUF) + { + ERR("Adding another arg would overflow buffer, suggest upping link buffer size.\n"); + return; + } + + data->link_buf_pos += wsprintfW(data->link_buf_pos, L"%s%s", separator_str, arg_buf); + data->args_count++; +} + /* * IUIAutomationFocusChangedEventHandler vtbl. */ @@ -143,7 +185,7 @@ static HRESULT WINAPI FocusChangedHandler_HandleFocusChangedEvent(IUIAutomationF IUIAutomationElement *sender) { BOOL is_readonly, has_kbd_focus; - WCHAR link_buf[1024] = { 0 }; + struct osk_link_data link_data = { 0 }; RECT rect = { 0 }; BSTR name = NULL; int control_type; @@ -176,21 +218,15 @@ static HRESULT WINAPI FocusChangedHandler_HandleFocusChangedEvent(IUIAutomationF if (use_steam_osk && (control_type == UIA_EditControlTypeId) && has_kbd_focus && !is_readonly) { - WCHAR *cur_buf_pos = link_buf; - - if (steam_app_id) - cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard?AppID=%d", steam_app_id); - else - cur_buf_pos += wsprintfW(cur_buf_pos, L"steam://open/keyboard"); - + osk_link_init(&link_data, L"steam://open/keyboard"); + if (steam_app_id) osk_link_add_int_arg(&link_data, L"AppID", steam_app_id); if (rect.left || rect.top || rect.right || rect.bottom) { - if (steam_app_id) - wsprintfW(cur_buf_pos, L"&XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", - rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); - else - wsprintfW(cur_buf_pos, L"?XPosition=%d&YPosition=%d&Width=%d&Height=%d&Mode=0", - rect.left, rect.top, (rect.right - rect.left), (rect.bottom - rect.top)); + osk_link_add_int_arg(&link_data, L"XPosition", rect.left); + osk_link_add_int_arg(&link_data, L"YPosition", rect.top); + osk_link_add_int_arg(&link_data, L"Width", (rect.right - rect.left)); + osk_link_add_int_arg(&link_data, L"Height", (rect.bottom - rect.top)); + osk_link_add_int_arg(&link_data, L"Mode", 0); } WINE_TRACE("Keyboard up!\n"); @@ -198,17 +234,15 @@ static HRESULT WINAPI FocusChangedHandler_HandleFocusChangedEvent(IUIAutomationF } else if (keyboard_up) { - if (steam_app_id) - wsprintfW(link_buf, L"steam://close/keyboard?AppID=%d", steam_app_id); - else - wsprintfW(link_buf, L"steam://close/keyboard"); + osk_link_init(&link_data, L"steam://close/keyboard"); + if (steam_app_id) osk_link_add_int_arg(&link_data, L"AppID", steam_app_id); WINE_TRACE("Keyboard down!\n"); keyboard_up = FALSE; } - if (lstrlenW(link_buf)) - ShellExecuteW(NULL, NULL, link_buf, NULL, NULL, SW_SHOWNOACTIVATE); + if (use_steam_osk && link_data.link_buf_pos && (link_data.link_buf_pos != link_data.link_buf)) + ShellExecuteW(NULL, NULL, link_data.link_buf, NULL, NULL, SW_SHOWNOACTIVATE); WINE_TRACE("name %s, control_type %d (%s), rect %s, has_kbd_focus %d, is_readonly %d\n", wine_dbgstr_w(name), control_type, get_str_for_id(control_type, uia_control_type_id_strs), wine_dbgstr_rect(&rect), From 69c6b33140fc42f83667b8eefcb26c27339f7c8e Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Mon, 25 Sep 2023 08:28:58 -0400 Subject: [PATCH 0900/1506] tabtip: Enable compilation with long types. Signed-off-by: Connor McAdams --- programs/tabtip/Makefile.in | 1 - programs/tabtip/tabtip.c | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/programs/tabtip/Makefile.in b/programs/tabtip/Makefile.in index 3aee8a07741..f5556caa226 100644 --- a/programs/tabtip/Makefile.in +++ b/programs/tabtip/Makefile.in @@ -1,4 +1,3 @@ -EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = tabtip.exe IMPORTS = uuid ole32 user32 oleacc uiautomationcore rpcrt4 shell32 oleaut32 diff --git a/programs/tabtip/tabtip.c b/programs/tabtip/tabtip.c index e4693c4a80a..8a413aa29ce 100644 --- a/programs/tabtip/tabtip.c +++ b/programs/tabtip/tabtip.c @@ -199,20 +199,20 @@ static HRESULT WINAPI FocusChangedHandler_HandleFocusChangedEvent(IUIAutomationF return S_OK; hr = IUIAutomationElement_get_CachedBoundingRectangle(sender, &rect); - if (FAILED(hr)) WINE_ERR("Failed to get cached bounding rect, hr %#x\n", hr); + if (FAILED(hr)) WINE_ERR("Failed to get cached bounding rect, hr %#lx\n", hr); hr = IUIAutomationElement_get_CachedControlType(sender, &control_type); - if (FAILED(hr)) WINE_ERR("Failed to get cached control type, hr %#x\n", hr); + if (FAILED(hr)) WINE_ERR("Failed to get cached control type, hr %#lx\n", hr); hr = IUIAutomationElement_get_CachedName(sender, &name); - if (FAILED(hr)) WINE_ERR("Failed to get cached name, hr %#x\n", hr); + if (FAILED(hr)) WINE_ERR("Failed to get cached name, hr %#lx\n", hr); hr = IUIAutomationElement_get_CachedHasKeyboardFocus(sender, &has_kbd_focus); - if (FAILED(hr)) WINE_ERR("Failed to get cached has keyboard focus property, hr %#x\n", hr); + if (FAILED(hr)) WINE_ERR("Failed to get cached has keyboard focus property, hr %#lx\n", hr); VariantInit(&v); hr = IUIAutomationElement_GetCachedPropertyValueEx(sender, UIA_ValueIsReadOnlyPropertyId, TRUE, &v); - if (FAILED(hr)) WINE_ERR("Failed to get cached property value for UIA_ValueIsReadOnlyPropertyId, hr %#x\n", hr); + if (FAILED(hr)) WINE_ERR("Failed to get cached property value for UIA_ValueIsReadOnlyPropertyId, hr %#lx\n", hr); is_readonly = ((V_VT(&v) == VT_BOOL) && (V_BOOL(&v) == VARIANT_TRUE)); VariantClear(&v); @@ -273,7 +273,7 @@ static HRESULT add_uia_event_handler(IUIAutomation **uia_iface) hr = CoCreateInstance(&CLSID_CUIAutomation8, NULL, CLSCTX_INPROC_SERVER, &IID_IUIAutomation, (void **)uia_iface); if (FAILED(hr)) { - ERR("Failed to create IUIAutomation interface, hr %#x\n", hr); + ERR("Failed to create IUIAutomation interface, hr %#lx\n", hr); return hr; } @@ -294,14 +294,14 @@ static HRESULT add_uia_event_handler(IUIAutomation **uia_iface) hr = IUIAutomationCacheRequest_AddProperty(cache_req, uia_cache_props[i]); if (FAILED(hr)) { - ERR("Failed to add prop_id %d to cache req, hr %#x\n", uia_cache_props[i], hr); + ERR("Failed to add prop_id %d to cache req, hr %#lx\n", uia_cache_props[i], hr); goto exit; } } hr = IUIAutomation_AddFocusChangedEventHandler(*uia_iface, cache_req, &FocusChangedHandler); if (FAILED(hr)) - ERR("Failed to add focus changed event handler, hr %#x\n", hr); + ERR("Failed to add focus changed event handler, hr %#lx\n", hr); exit: if (cache_req) From 44d4b082eab65529e481627ede9b42a51a44d27a Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Mon, 25 Sep 2023 08:56:09 -0400 Subject: [PATCH 0901/1506] tabtip: Cleanup makefile. Signed-off-by: Connor McAdams --- programs/tabtip/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/tabtip/Makefile.in b/programs/tabtip/Makefile.in index f5556caa226..5070b74fc4c 100644 --- a/programs/tabtip/Makefile.in +++ b/programs/tabtip/Makefile.in @@ -1,7 +1,7 @@ MODULE = tabtip.exe -IMPORTS = uuid ole32 user32 oleacc uiautomationcore rpcrt4 shell32 oleaut32 +IMPORTS = ole32 user32 uiautomationcore shell32 oleaut32 -EXTRADLLFLAGS = -mconsole -municode -mno-cygwin +EXTRADLLFLAGS = -mconsole -municode SOURCES = \ tabtip.c From 97f5e6c22a639e83d261dee758e04ae243af318f Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Wed, 13 Dec 2023 07:29:44 -0500 Subject: [PATCH 0902/1506] HACK: uiautomationcore: Use IAccessible2::get_windowHandle method to get HWND when possible. MSAA proxy providers require an HWND for creation, this is usually retrieved via WindowFromAccessibleObject. However, WindowFromAccessibleObject requires navigating up to the root IAccessible in CEF applications, which due to cross-process calls can end up taking over a second for focus change events to be delivered. Using the IA2 method here gets this down to around 350ms, which isn't great but is better than before. Native does not use the get_windowHandle method, but it likely uses hooks which would negate the cross-process call performance hit. --- dlls/uiautomationcore/uia_provider.c | 35 ++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/dlls/uiautomationcore/uia_provider.c b/dlls/uiautomationcore/uia_provider.c index 2e5f0e6c6ea..ce4aa0b53ae 100644 --- a/dlls/uiautomationcore/uia_provider.c +++ b/dlls/uiautomationcore/uia_provider.c @@ -1141,16 +1141,28 @@ static HRESULT msaa_acc_get_focus(struct msaa_provider *prov, struct msaa_provid if (V_VT(&v) == VT_DISPATCH) { + IAccessible2 *ia2 = NULL; + hr = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IAccessible, (void **)&focus_acc); VariantClear(&v); if (FAILED(hr)) return hr; - hr = WindowFromAccessibleObject(focus_acc, &hwnd); - if (FAILED(hr) || !hwnd) + if ((ia2 = msaa_acc_get_ia2(focus_acc))) { - IAccessible_Release(focus_acc); - return hr; + hr = IAccessible2_get_windowHandle(ia2, &hwnd); + if (FAILED(hr)) + WARN("IA2 get_windowHandle failed with hr %#lx\n", hr); + IAccessible2_Release(ia2); + } + if (!hwnd) + { + hr = WindowFromAccessibleObject(focus_acc, &hwnd); + if (FAILED(hr) || !hwnd) + { + IAccessible_Release(focus_acc); + return hr; + } } } @@ -1463,9 +1475,18 @@ HRESULT create_msaa_provider(IAccessible *acc, LONG child_id, HWND hwnd, BOOL ro { HRESULT hr; - hr = WindowFromAccessibleObject(acc, &msaa_prov->hwnd); - if (FAILED(hr)) - WARN("WindowFromAccessibleObject failed with hr %#lx\n", hr); + if (msaa_prov->ia2) + { + hr = IAccessible2_get_windowHandle(msaa_prov->ia2, &msaa_prov->hwnd); + if (FAILED(hr)) + WARN("IA2 get_windowHandle failed with hr %#lx\n", hr); + } + if (!msaa_prov->hwnd) + { + hr = WindowFromAccessibleObject(acc, &msaa_prov->hwnd); + if (FAILED(hr)) + WARN("WindowFromAccessibleObject failed with hr %#lx\n", hr); + } } else msaa_prov->hwnd = hwnd; From a2c80442e123158be39221c3cf9ea29c42c7c62c Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Tue, 3 Jan 2023 15:07:32 -0500 Subject: [PATCH 0903/1506] windows.media.speech: HACK: Don't invoke passed in async handler interface for Forza Horizon 5. Invoking the interface causes the code to go further and causes a segfault on an unimplemented interface. Avoid this by never triggering the async handler. Signed-off-by: Connor McAdams --- dlls/windows.media.speech/async.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/windows.media.speech/async.c b/dlls/windows.media.speech/async.c index 3c5f450cc65..5d82c06193b 100644 --- a/dlls/windows.media.speech/async.c +++ b/dlls/windows.media.speech/async.c @@ -490,10 +490,19 @@ static HRESULT WINAPI async_inspectable_put_Completed( IAsyncOperation_IInspecta IAsyncOperationCompletedHandler_IInspectable *handler ) { struct async_inspectable *impl = impl_from_IAsyncOperation_IInspectable(iface); + const char *var = getenv("SteamAppId"); HRESULT hr = S_OK; TRACE("iface %p, handler %p.\n", iface, handler); + /* + * HACK: Forza Horizon 5 will segfault when trying to get an interface if + * we invoke the handler, so we should just return S_OK and let it hang + * indefinitely. + */ + if (var && !strcmp(var, "1551360")) + return S_OK; + EnterCriticalSection(&impl->cs); if (impl->status == Closed) hr = E_ILLEGAL_METHOD_CALL; From dc4d2636184fe9dbc9bf3c8da86705a1c8fdb53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 8 Dec 2023 15:42:32 +0100 Subject: [PATCH 0904/1506] mf/evr: Increase the number of prerolled samples to 3. Native seems to only preroll 2 samples, but it still stutters a bit in Secret of Mana without at least 3 buffers. This is probably caused by a different sample decoding pattern, and 3 buffers in flight should be fine. CW-Bug-Id: #21713 --- dlls/mf/evr.c | 15 ++++++++++++--- dlls/mf/session.c | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index db7053a1405..5ac526c9651 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -64,6 +64,7 @@ struct video_stream LONG refcount; unsigned int id; unsigned int flags; + unsigned int preroll_count; struct video_renderer *parent; IMFMediaEventQueue *event_queue; IMFVideoSampleAllocator *allocator; @@ -420,9 +421,16 @@ static HRESULT WINAPI video_stream_sink_ProcessSample(IMFStreamSink *iface, IMFS if (stream->flags & EVR_STREAM_PREROLLING) { - IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkPrerolled, &GUID_NULL, S_OK, NULL); - stream->flags &= ~EVR_STREAM_PREROLLING; - stream->flags |= EVR_STREAM_PREROLLED; + if (stream->preroll_count--) + IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkRequestSample, + &GUID_NULL, S_OK, NULL); + else + { + IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkPrerolled, + &GUID_NULL, S_OK, NULL); + stream->flags &= ~EVR_STREAM_PREROLLING; + stream->flags |= EVR_STREAM_PREROLLED; + } } } @@ -1528,6 +1536,7 @@ static HRESULT WINAPI video_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll * IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkRequestSample, &GUID_NULL, S_OK, NULL); stream->flags |= EVR_STREAM_PREROLLING; + stream->preroll_count = 3; } LeaveCriticalSection(&stream->cs); } diff --git a/dlls/mf/session.c b/dlls/mf/session.c index c5bbc2e4126..5abf920e2e9 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1677,7 +1677,7 @@ static HRESULT session_append_node(struct media_session *session, IMFTopologyNod &IID_IMFVideoSampleAllocator, (void **)&topo_node->u.sink.allocator))) { if (FAILED(hr = IMFVideoSampleAllocator_InitializeSampleAllocator(topo_node->u.sink.allocator, - 2, media_type))) + 4, media_type))) { WARN("Failed to initialize sample allocator for the stream, hr %#lx.\n", hr); } From 40112bb997e1561b1d88398414faeba8c0cbe2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:20 +0200 Subject: [PATCH 0905/1506] dwmapi: Add DWMWA_NCRENDERING_ENABLED stub for DwmGetWindowAttribute. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/dwmapi/dwmapi_main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c index 6df762c0edc..11012455751 100644 --- a/dlls/dwmapi/dwmapi_main.c +++ b/dlls/dwmapi/dwmapi_main.c @@ -193,15 +193,24 @@ HRESULT WINAPI DwmGetWindowAttribute(HWND hwnd, DWORD attribute, PVOID pv_attrib return E_HANDLE; if (!IsWindow(hwnd)) return E_HANDLE; + if (!pv_attribute) + return E_INVALIDARG; switch (attribute) { + case DWMWA_NCRENDERING_ENABLED: + if (size < sizeof(BOOL)) + return E_INVALIDARG; + + WARN("DWMWA_NCRENDERING_ENABLED: always returning FALSE.\n"); + *(BOOL*)(pv_attribute) = FALSE; + hr = S_OK; + break; + case DWMWA_EXTENDED_FRAME_BOUNDS: { RECT *rect = (RECT *)pv_attribute; DPI_AWARENESS_CONTEXT context; - if (!rect) - return E_INVALIDARG; if (size < sizeof(*rect)) return E_NOT_SUFFICIENT_BUFFER; if (GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) From fcb7da534bb0b9756dca35ebdfb4e10da63ab268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0906/1506] dwmapi: Add DWMWA_CLOAKED stub for DwmGetWindowAttribute. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/dwmapi/dwmapi_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c index 11012455751..67b2d2bc25f 100644 --- a/dlls/dwmapi/dwmapi_main.c +++ b/dlls/dwmapi/dwmapi_main.c @@ -226,6 +226,15 @@ HRESULT WINAPI DwmGetWindowAttribute(HWND hwnd, DWORD attribute, PVOID pv_attrib SetThreadDpiAwarenessContext(context); break; } + case DWMWA_CLOAKED: + if (size < sizeof(DWORD)) + return E_INVALIDARG; + + FIXME("DWMWA_CLOAKED: always returning 0.\n"); + *(DWORD*)(pv_attribute) = 0; + hr = S_OK; + break; + default: FIXME("attribute %ld not implemented.\n", attribute); hr = E_NOTIMPL; From 9e697382b71f1ea5bfb796dd661efa833dbd4e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0907/1506] jscript: Move thread_id from JScript struct to TLS data. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/jscript.c | 32 +++++++++++++++++++++----------- dlls/jscript/jscript.h | 8 ++++++++ dlls/jscript/jscript_main.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 12 deletions(-) diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index b1940b770d3..191747c7173 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -51,8 +51,8 @@ typedef struct { LONG ref; DWORD safeopt; + struct thread_data *thread_data; script_ctx_t *ctx; - LONG thread_id; LCID lcid; DWORD version; BOOL html_mode; @@ -524,8 +524,10 @@ static void decrease_state(JScript *This, SCRIPTSTATE state) FIXME("NULL ctx\n"); } - if(state == SCRIPTSTATE_UNINITIALIZED || state == SCRIPTSTATE_CLOSED) - This->thread_id = 0; + if((state == SCRIPTSTATE_UNINITIALIZED || state == SCRIPTSTATE_CLOSED) && This->thread_data) { + release_thread_data(This->thread_data); + This->thread_data = NULL; + } if(This->site) { IActiveScriptSite_Release(This->site); @@ -708,6 +710,8 @@ static ULONG WINAPI JScript_Release(IActiveScript *iface) This->ctx->active_script = NULL; script_release(This->ctx); } + if(This->thread_data) + release_thread_data(This->thread_data); free(This); unlock_module(); } @@ -726,6 +730,7 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, IActiveScriptSite *pass) { JScript *This = impl_from_IActiveScript(iface); + struct thread_data *thread_data; named_item_t *item; LCID lcid; HRESULT hres; @@ -738,8 +743,13 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, if(This->site) return E_UNEXPECTED; - if(InterlockedCompareExchange(&This->thread_id, GetCurrentThreadId(), 0)) + if(!(thread_data = get_thread_data())) + return E_OUTOFMEMORY; + + if(InterlockedCompareExchangePointer((void**)&This->thread_data, thread_data, NULL)) { + release_thread_data(thread_data); return E_UNEXPECTED; + } if(!This->ctx) { script_ctx_t *ctx = calloc(1, sizeof(script_ctx_t)); @@ -821,7 +831,7 @@ static HRESULT WINAPI JScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE s TRACE("(%p)->(%d)\n", This, ss); - if(This->thread_id && GetCurrentThreadId() != This->thread_id) + if(This->thread_data && This->thread_data->thread_id != GetCurrentThreadId()) return E_UNEXPECTED; if(ss == SCRIPTSTATE_UNINITIALIZED) { @@ -865,7 +875,7 @@ static HRESULT WINAPI JScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE * if(!pssState) return E_POINTER; - if(This->thread_id && This->thread_id != GetCurrentThreadId()) + if(This->thread_data && This->thread_data->thread_id != GetCurrentThreadId()) return E_UNEXPECTED; *pssState = This->ctx ? This->ctx->state : SCRIPTSTATE_UNINITIALIZED; @@ -878,7 +888,7 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface) TRACE("(%p)->()\n", This); - if(This->thread_id && This->thread_id != GetCurrentThreadId()) + if(This->thread_data && This->thread_data->thread_id != GetCurrentThreadId()) return E_UNEXPECTED; decrease_state(This, SCRIPTSTATE_CLOSED); @@ -897,7 +907,7 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, TRACE("(%p)->(%s %lx)\n", This, debugstr_w(pstrName), dwFlags); - if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED) + if(!This->thread_data || This->thread_data->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED) return E_UNEXPECTED; if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) { @@ -959,7 +969,7 @@ static HRESULT WINAPI JScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR if(!ppdisp) return E_POINTER; - if(This->thread_id != GetCurrentThreadId() || !This->ctx->global) { + if(!This->thread_data || This->thread_data->thread_id != GetCurrentThreadId() || !This->ctx->global) { *ppdisp = NULL; return E_UNEXPECTED; } @@ -1101,7 +1111,7 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface, debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter), wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLine, dwFlags, pvarResult, pexcepinfo); - if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED) + if(!This->thread_data || This->thread_data->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED) return E_UNEXPECTED; if(pstrItemName) { @@ -1204,7 +1214,7 @@ static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptPars debugstr_w(pstrProcedureName), debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter), wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLineNumber, dwFlags, ppdisp); - if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED) + if(!This->thread_data || This->thread_data->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED) return E_UNEXPECTED; if(pstrItemName) { diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 650c9278793..0e4f97b085d 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -129,6 +129,14 @@ typedef HRESULT (*builtin_setter_t)(script_ctx_t*,jsdisp_t*,jsval_t); HRESULT builtin_set_const(script_ctx_t*,jsdisp_t*,jsval_t); +struct thread_data { + LONG ref; + LONG thread_id; +}; + +struct thread_data *get_thread_data(void); +void release_thread_data(struct thread_data*); + typedef struct named_item_t { jsdisp_t *script_obj; IDispatch *disp; diff --git a/dlls/jscript/jscript_main.c b/dlls/jscript/jscript_main.c index 882c419ff83..2afe6fb2ff7 100644 --- a/dlls/jscript/jscript_main.c +++ b/dlls/jscript/jscript_main.c @@ -37,8 +37,34 @@ LONG module_ref = 0; DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); HINSTANCE jscript_hinstance; +static DWORD jscript_tls; static ITypeInfo *dispatch_typeinfo; +struct thread_data *get_thread_data(void) +{ + struct thread_data *thread_data = TlsGetValue(jscript_tls); + + if(!thread_data) { + thread_data = calloc(1, sizeof(struct thread_data)); + if(!thread_data) + return NULL; + thread_data->thread_id = GetCurrentThreadId(); + TlsSetValue(jscript_tls, thread_data); + } + + thread_data->ref++; + return thread_data; +} + +void release_thread_data(struct thread_data *thread_data) +{ + if(--thread_data->ref) + return; + + free(thread_data); + TlsSetValue(jscript_tls, NULL); +} + HRESULT get_dispatch_typeinfo(ITypeInfo **out) { ITypeInfo *typeinfo; @@ -164,13 +190,16 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hInstDLL); jscript_hinstance = hInstDLL; - if(!init_strings()) + jscript_tls = TlsAlloc(); + if(jscript_tls == TLS_OUT_OF_INDEXES || !init_strings()) return FALSE; break; case DLL_PROCESS_DETACH: if (lpv) break; if (dispatch_typeinfo) ITypeInfo_Release(dispatch_typeinfo); + if(jscript_tls != TLS_OUT_OF_INDEXES) TlsFree(jscript_tls); free_strings(); + break; } return TRUE; From f57bb9e5c18cf92cf54f223a269ed04d9246fa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0908/1506] jscript: Don't use atomic compare exchange when setting the script ctx. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It already bails out early if the thread_data was already populated, so only one thread can reach here at one time. Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/jscript.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 191747c7173..32e6278a5d0 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -776,11 +776,7 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, ctx->last_match = jsstr_empty(); - ctx = InterlockedCompareExchangePointer((void**)&This->ctx, ctx, NULL); - if(ctx) { - script_release(ctx); - return E_UNEXPECTED; - } + This->ctx = ctx; } /* Retrieve new dispatches for persistent named items */ From 0e39755a6a35ffbae946061d1cd12a58d74a40e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0909/1506] jscript: Make the garbage collector thread-wide rather than per-ctx. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 31 ++++++++++++++++--------------- dlls/jscript/jscript.c | 12 +++--------- dlls/jscript/jscript.h | 12 +++++++----- dlls/jscript/jscript_main.c | 9 +++++++++ dlls/jscript/set.c | 6 +++--- 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index ef72860f627..88c63811386 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -783,6 +783,7 @@ HRESULT gc_run(script_ctx_t *ctx) struct chunk *next; LONG ref[1020]; } *head, *chunk; + struct thread_data *thread_data = ctx->thread_data; jsdisp_t *obj, *obj2, *link, *link2; dispex_prop_t *prop, *props_end; struct gc_ctx gc_ctx = { 0 }; @@ -791,7 +792,7 @@ HRESULT gc_run(script_ctx_t *ctx) struct list *iter; /* Prevent recursive calls from side-effects during unlinking (e.g. CollectGarbage from host object's Release) */ - if(ctx->gc_is_unlinking) + if(thread_data->gc_is_unlinking) return S_OK; if(!(head = malloc(sizeof(*head)))) @@ -800,7 +801,7 @@ HRESULT gc_run(script_ctx_t *ctx) chunk = head; /* 1. Save actual refcounts and decrease them speculatively as-if we unlinked the objects */ - LIST_FOR_EACH_ENTRY(obj, &ctx->objects, jsdisp_t, entry) { + LIST_FOR_EACH_ENTRY(obj, &thread_data->objects, jsdisp_t, entry) { if(chunk_idx == ARRAY_SIZE(chunk->ref)) { if(!(chunk->next = malloc(sizeof(*chunk)))) { do { @@ -815,7 +816,7 @@ HRESULT gc_run(script_ctx_t *ctx) } chunk->ref[chunk_idx++] = obj->ref; } - LIST_FOR_EACH_ENTRY(obj, &ctx->objects, jsdisp_t, entry) { + LIST_FOR_EACH_ENTRY(obj, &thread_data->objects, jsdisp_t, entry) { for(prop = obj->props, props_end = prop + obj->prop_cnt; prop < props_end; prop++) { switch(prop->type) { case PROP_JSVAL: @@ -841,7 +842,7 @@ HRESULT gc_run(script_ctx_t *ctx) } /* 2. Clear mark on objects with non-zero "external refcount" and all objects accessible from them */ - LIST_FOR_EACH_ENTRY(obj, &ctx->objects, jsdisp_t, entry) { + LIST_FOR_EACH_ENTRY(obj, &thread_data->objects, jsdisp_t, entry) { if(!obj->ref || !obj->gc_marked) continue; @@ -899,7 +900,7 @@ HRESULT gc_run(script_ctx_t *ctx) /* For weak refs, traverse paths accessible from it via the WeakMaps, if the WeakMaps are alive at this point. We need both the key and the WeakMap for the entry to actually be accessible (and thus traversed). */ if(obj2->has_weak_refs) { - struct list *list = &RB_ENTRY_VALUE(rb_get(&ctx->weak_refs, obj2), struct weak_refs_entry, entry)->list; + struct list *list = &RB_ENTRY_VALUE(rb_get(&thread_data->weak_refs, obj2), struct weak_refs_entry, entry)->list; struct weakmap_entry *entry; LIST_FOR_EACH_ENTRY(entry, list, struct weakmap_entry, weak_refs_entry) { @@ -926,7 +927,7 @@ HRESULT gc_run(script_ctx_t *ctx) /* Restore */ chunk = head; chunk_idx = 0; - LIST_FOR_EACH_ENTRY(obj, &ctx->objects, jsdisp_t, entry) { + LIST_FOR_EACH_ENTRY(obj, &thread_data->objects, jsdisp_t, entry) { obj->ref = chunk->ref[chunk_idx++]; if(chunk_idx == ARRAY_SIZE(chunk->ref)) { struct chunk *next = chunk->next; @@ -940,13 +941,13 @@ HRESULT gc_run(script_ctx_t *ctx) return hres; /* 3. Remove all the links from the marked objects, since they are dangling */ - ctx->gc_is_unlinking = TRUE; + thread_data->gc_is_unlinking = TRUE; - iter = list_head(&ctx->objects); + iter = list_head(&thread_data->objects); while(iter) { obj = LIST_ENTRY(iter, jsdisp_t, entry); if(!obj->gc_marked) { - iter = list_next(&ctx->objects, iter); + iter = list_next(&thread_data->objects, iter); continue; } @@ -956,12 +957,12 @@ HRESULT gc_run(script_ctx_t *ctx) /* Releasing unlinked object should not delete any other object, so we can safely obtain the next pointer now */ - iter = list_next(&ctx->objects, iter); + iter = list_next(&thread_data->objects, iter); jsdisp_release(obj); } - ctx->gc_is_unlinking = FALSE; - ctx->gc_last_tick = GetTickCount(); + thread_data->gc_is_unlinking = FALSE; + thread_data->gc_last_tick = GetTickCount(); return S_OK; } @@ -2174,7 +2175,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b unsigned i; /* FIXME: Use better heuristics to decide when to run the GC */ - if(GetTickCount() - ctx->gc_last_tick > 30000) + if(GetTickCount() - ctx->thread_data->gc_last_tick > 30000) gc_run(ctx); TRACE("%p (%p)\n", dispex, prototype); @@ -2201,7 +2202,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b script_addref(ctx); dispex->ctx = ctx; - list_add_tail(&ctx->objects, &dispex->entry); + list_add_tail(&ctx->thread_data->objects, &dispex->entry); return S_OK; } @@ -2241,7 +2242,7 @@ void jsdisp_free(jsdisp_t *obj) TRACE("(%p)\n", obj); if(obj->has_weak_refs) { - struct list *list = &RB_ENTRY_VALUE(rb_get(&obj->ctx->weak_refs, obj), struct weak_refs_entry, entry)->list; + struct list *list = &RB_ENTRY_VALUE(rb_get(&obj->ctx->thread_data->weak_refs, obj), struct weak_refs_entry, entry)->list; do { remove_weakmap_entry(LIST_ENTRY(list->next, struct weakmap_entry, weak_refs_entry)); } while(obj->has_weak_refs); diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 32e6278a5d0..6829f80f299 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -88,6 +88,7 @@ void script_release(script_ctx_t *ctx) ctx->jscaller->ctx = NULL; IServiceProvider_Release(&ctx->jscaller->IServiceProvider_iface); + release_thread_data(ctx->thread_data); free(ctx); } @@ -719,13 +720,6 @@ static ULONG WINAPI JScript_Release(IActiveScript *iface) return ref; } -static int weak_refs_compare(const void *key, const struct rb_entry *entry) -{ - const struct weak_refs_entry *weak_refs_entry = RB_ENTRY_VALUE(entry, const struct weak_refs_entry, entry); - ULONG_PTR a = (ULONG_PTR)key, b = (ULONG_PTR)LIST_ENTRY(weak_refs_entry->list.next, struct weakmap_entry, weak_refs_entry)->key; - return (a > b) - (a < b); -} - static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, IActiveScriptSite *pass) { @@ -764,8 +758,6 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, ctx->html_mode = This->html_mode; ctx->acc = jsval_undefined(); list_init(&ctx->named_items); - list_init(&ctx->objects); - rb_init(&ctx->weak_refs, weak_refs_compare); heap_pool_init(&ctx->tmp_heap); hres = create_jscaller(ctx); @@ -774,6 +766,8 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, return hres; } + thread_data->ref++; + ctx->thread_data = thread_data; ctx->last_match = jsstr_empty(); This->ctx = ctx; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 0e4f97b085d..b62d577a45b 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -132,6 +132,12 @@ HRESULT builtin_set_const(script_ctx_t*,jsdisp_t*,jsval_t); struct thread_data { LONG ref; LONG thread_id; + + BOOL gc_is_unlinking; + DWORD gc_last_tick; + + struct list objects; + struct rb_tree weak_refs; }; struct thread_data *get_thread_data(void); @@ -383,10 +389,9 @@ struct _script_ctx_t { SCRIPTSTATE state; IActiveScript *active_script; + struct thread_data *thread_data; struct _call_frame_t *call_ctx; struct list named_items; - struct list objects; - struct rb_tree weak_refs; IActiveScriptSite *site; IInternetHostSecurityManager *secmgr; DWORD safeopt; @@ -399,9 +404,6 @@ struct _script_ctx_t { heap_pool_t tmp_heap; - BOOL gc_is_unlinking; - DWORD gc_last_tick; - jsval_t *stack; unsigned stack_top; jsval_t acc; diff --git a/dlls/jscript/jscript_main.c b/dlls/jscript/jscript_main.c index 2afe6fb2ff7..ecbb5a713ab 100644 --- a/dlls/jscript/jscript_main.c +++ b/dlls/jscript/jscript_main.c @@ -40,6 +40,13 @@ HINSTANCE jscript_hinstance; static DWORD jscript_tls; static ITypeInfo *dispatch_typeinfo; +static int weak_refs_compare(const void *key, const struct rb_entry *entry) +{ + const struct weak_refs_entry *weak_refs_entry = RB_ENTRY_VALUE(entry, const struct weak_refs_entry, entry); + ULONG_PTR a = (ULONG_PTR)key, b = (ULONG_PTR)LIST_ENTRY(weak_refs_entry->list.next, struct weakmap_entry, weak_refs_entry)->key; + return (a > b) - (a < b); +} + struct thread_data *get_thread_data(void) { struct thread_data *thread_data = TlsGetValue(jscript_tls); @@ -49,6 +56,8 @@ struct thread_data *get_thread_data(void) if(!thread_data) return NULL; thread_data->thread_id = GetCurrentThreadId(); + list_init(&thread_data->objects); + rb_init(&thread_data->weak_refs, weak_refs_compare); TlsSetValue(jscript_tls, thread_data); } diff --git a/dlls/jscript/set.c b/dlls/jscript/set.c index ac9efbb4da0..bf2045c7c41 100644 --- a/dlls/jscript/set.c +++ b/dlls/jscript/set.c @@ -658,7 +658,7 @@ void remove_weakmap_entry(struct weakmap_entry *entry) else { struct weak_refs_entry *weak_refs_entry = LIST_ENTRY(next, struct weak_refs_entry, list); entry->key->has_weak_refs = FALSE; - rb_remove(&entry->key->ctx->weak_refs, &weak_refs_entry->entry); + rb_remove(&entry->key->ctx->thread_data->weak_refs, &weak_refs_entry->entry); free(weak_refs_entry); } rb_remove(&weakmap->map, &entry->entry); @@ -771,14 +771,14 @@ static HRESULT WeakMap_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne } if(key->has_weak_refs) - weak_refs_entry = RB_ENTRY_VALUE(rb_get(&ctx->weak_refs, key), struct weak_refs_entry, entry); + weak_refs_entry = RB_ENTRY_VALUE(rb_get(&ctx->thread_data->weak_refs, key), struct weak_refs_entry, entry); else { if(!(weak_refs_entry = malloc(sizeof(*weak_refs_entry)))) { jsval_release(entry->value); free(entry); return E_OUTOFMEMORY; } - rb_put(&ctx->weak_refs, key, &weak_refs_entry->entry); + rb_put(&ctx->thread_data->weak_refs, key, &weak_refs_entry->entry); list_init(&weak_refs_entry->list); key->has_weak_refs = TRUE; } From 19182353b712a32f7c8384435ded86e4afecf946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0910/1506] jscript: Allow garbage collection between different jscript contexts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 18 +++++----- dlls/jscript/set.c | 5 --- dlls/jscript/tests/run.c | 75 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 82 insertions(+), 16 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 88c63811386..57882bf499e 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -820,13 +820,13 @@ HRESULT gc_run(script_ctx_t *ctx) for(prop = obj->props, props_end = prop + obj->prop_cnt; prop < props_end; prop++) { switch(prop->type) { case PROP_JSVAL: - if(is_object_instance(prop->u.val) && (link = to_jsdisp(get_object(prop->u.val))) && link->ctx == ctx) + if(is_object_instance(prop->u.val) && (link = to_jsdisp(get_object(prop->u.val)))) link->ref--; break; case PROP_ACCESSOR: - if(prop->u.accessor.getter && prop->u.accessor.getter->ctx == ctx) + if(prop->u.accessor.getter) prop->u.accessor.getter->ref--; - if(prop->u.accessor.setter && prop->u.accessor.setter->ctx == ctx) + if(prop->u.accessor.setter) prop->u.accessor.setter->ref--; break; default: @@ -834,7 +834,7 @@ HRESULT gc_run(script_ctx_t *ctx) } } - if(obj->prototype && obj->prototype->ctx == ctx) + if(obj->prototype) obj->prototype->ref--; if(obj->builtin_info->gc_traverse) obj->builtin_info->gc_traverse(&gc_ctx, GC_TRAVERSE_SPECULATIVELY, obj); @@ -870,12 +870,12 @@ HRESULT gc_run(script_ctx_t *ctx) default: continue; } - if(link && link->gc_marked && link->ctx == ctx) { + if(link && link->gc_marked) { hres = gc_stack_push(&gc_ctx, link); if(FAILED(hres)) break; } - if(link2 && link2->gc_marked && link2->ctx == ctx) { + if(link2 && link2->gc_marked) { hres = gc_stack_push(&gc_ctx, link2); if(FAILED(hres)) break; @@ -885,7 +885,7 @@ HRESULT gc_run(script_ctx_t *ctx) if(FAILED(hres)) break; - if(obj2->prototype && obj2->prototype->gc_marked && obj2->prototype->ctx == ctx) { + if(obj2->prototype && obj2->prototype->gc_marked) { hres = gc_stack_push(&gc_ctx, obj2->prototype); if(FAILED(hres)) break; @@ -974,8 +974,6 @@ HRESULT gc_process_linked_obj(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsd return S_OK; } - if(link->ctx != obj->ctx) - return S_OK; if(op == GC_TRAVERSE_SPECULATIVELY) link->ref--; else if(link->gc_marked) @@ -994,7 +992,7 @@ HRESULT gc_process_linked_val(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsd return S_OK; } - if(!is_object_instance(*link) || !(jsdisp = to_jsdisp(get_object(*link))) || jsdisp->ctx != obj->ctx) + if(!is_object_instance(*link) || !(jsdisp = to_jsdisp(get_object(*link)))) return S_OK; if(op == GC_TRAVERSE_SPECULATIVELY) jsdisp->ref--; diff --git a/dlls/jscript/set.c b/dlls/jscript/set.c index bf2045c7c41..7e49e31a5d5 100644 --- a/dlls/jscript/set.c +++ b/dlls/jscript/set.c @@ -745,11 +745,6 @@ static HRESULT WeakMap_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne if(!key) return JS_E_KEY_NOT_OBJECT; - if(key->ctx != ctx) { - FIXME("different ctx not supported\n"); - return JS_E_KEY_NOT_OBJECT; - } - if((entry = get_weakmap_entry(weakmap, key))) { jsval_t val; hres = jsval_copy(value, &val); diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 509f01e3211..db1e95dc844 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -3596,9 +3596,14 @@ static void test_destructors(void) "a.ref = { 'ref': Math, 'a': a }; b.ref = Math.ref;\n" "a.self = a; b.self = b; c.self = c;\n" "})(), true"; + static DISPID propput_dispid = DISPID_PROPERTYPUT; + IActiveScript *script, *script2; + IDispatchEx *dispex, *dispex2; IActiveScriptParse *parser; - IActiveScript *script; + DISPPARAMS dp = { 0 }; VARIANT v; + DISPID id; + BSTR str; HRESULT hres; V_VT(&v) = VT_EMPTY; @@ -3643,6 +3648,74 @@ static void test_destructors(void) CHECK_CALLED(testdestrobj); IActiveScript_Release(script); + + /* Create a cyclic ref across two jscript engines */ + V_VT(&v) = VT_EMPTY; + hres = parse_script_expr(cyclic_refs, &v, &script); + ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres); + ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v)); + + hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParse: %08lx\n", hres); + + V_VT(&v) = VT_EMPTY; + hres = IActiveScriptParse_ParseScriptText(parser, L"Math.ref", NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &v, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08lx\n", hres); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) != NULL, "V_DISPATCH(v) = NULL\n"); + + hres = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres); + VariantClear(&v); + + V_VT(&v) = VT_EMPTY; + hres = parse_script_expr(L"new Object()", &v, &script2); + ok(hres == S_OK, "parse_script_expr failed: %08lx\n", hres); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) != NULL, "V_DISPATCH(v) = NULL\n"); + + hres = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IDispatchEx, (void**)&dispex2); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres); + VariantClear(&v); + + dp.cArgs = dp.cNamedArgs = 1; + dp.rgdispidNamedArgs = &propput_dispid; + dp.rgvarg = &v; + + str = SysAllocString(L"diff_ctx"); + hres = IDispatchEx_GetDispID(dispex, str, fdexNameEnsure, &id); + ok(hres == S_OK, "GetDispID failed: %08lx\n", hres); + SysFreeString(str); + + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = (IDispatch*)dispex2; + hres = IDispatchEx_Invoke(dispex, id, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dp, NULL, NULL, NULL); + ok(hres == S_OK, "Invoke failed: %08lx\n", hres); + + str = SysAllocString(L"ref"); + hres = IDispatchEx_GetDispID(dispex2, str, fdexNameEnsure, &id); + ok(hres == S_OK, "GetDispID failed: %08lx\n", hres); + SysFreeString(str); + + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = (IDispatch*)dispex; + hres = IDispatchEx_Invoke(dispex2, id, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dp, NULL, NULL, NULL); + ok(hres == S_OK, "Invoke failed: %08lx\n", hres); + + IDispatchEx_Release(dispex2); + IDispatchEx_Release(dispex); + + SET_EXPECT(testdestrobj); + V_VT(&v) = VT_EMPTY; + hres = IActiveScriptParse_ParseScriptText(parser, L"Math.ref = undefined, CollectGarbage(), true", + NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &v, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08lx\n", hres); + ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v)); + IActiveScriptParse_Release(parser); + CHECK_CALLED(testdestrobj); + + IActiveScript_Release(script2); + IActiveScript_Release(script); } static void test_eval(void) From 248e46fd408d4056c14c8eadd5a63a0a1b8aac85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0911/1506] mshtml: Move the script hosts from the initial empty document. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlscript.h | 1 + dlls/mshtml/htmlwindow.c | 6 +++++- dlls/mshtml/script.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/htmlscript.h b/dlls/mshtml/htmlscript.h index f8760c134fe..837e9a4df62 100644 --- a/dlls/mshtml/htmlscript.h +++ b/dlls/mshtml/htmlscript.h @@ -39,6 +39,7 @@ HRESULT script_elem_from_nsscript(nsIDOMHTMLScriptElement*,HTMLScriptElement**); void bind_event_scripts(HTMLDocumentNode*); HRESULT load_script(HTMLScriptElement*,const WCHAR*,BOOL); +void move_script_hosts(HTMLInnerWindow*,HTMLInnerWindow*); void release_script_hosts(HTMLInnerWindow*); void connect_scripts(HTMLInnerWindow*); void doc_insert_script(HTMLInnerWindow*,HTMLScriptElement*,BOOL); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index fa99c453989..dd6c0bc5c5e 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4547,8 +4547,12 @@ HRESULT update_window_doc(HTMLInnerWindow *window) return S_OK; } - if(outer_window->base.inner_window) + if(outer_window->base.inner_window) { + if(!outer_window->base.inner_window->navigation_start_time && outer_window->browser->doc) + move_script_hosts(outer_window->base.inner_window, window); + detach_inner_window(outer_window->base.inner_window); + } outer_window->base.inner_window = window; outer_window->pending_window = NULL; diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index cad0f17671a..b3eb99afa02 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -1780,6 +1780,22 @@ void update_browser_script_mode(GeckoBrowser *browser, IUri *uri) ERR("JavaScript setup failed: %08lx\n", nsres); } +void move_script_hosts(HTMLInnerWindow *window, HTMLInnerWindow *new_window) +{ + ScriptHost *iter, *iter2; + + if(list_empty(&window->script_hosts)) + return; + + LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &window->script_hosts, ScriptHost, entry) { + iter->window = new_window; + list_remove(&iter->entry); + list_add_tail(&new_window->script_hosts, &iter->entry); + } + + lock_document_mode(new_window->doc); +} + void release_script_hosts(HTMLInnerWindow *window) { script_queue_entry_t *queue_iter; From b9a11e2eb8c262a8d530feff1fe5b7409205189b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0912/1506] mshtml: Implement IActiveScriptSite service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With IOleCommandTarget stub, since it's the interface used. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlscript.h | 3 + dlls/mshtml/script.c | 78 ++++++++++++ dlls/mshtml/service.c | 16 +++ dlls/mshtml/tests/events.c | 31 ++++- dlls/mshtml/tests/htmldoc.c | 52 ++++++++ dlls/mshtml/tests/script.c | 228 ++++++++++++++++++++++++++++++++++-- 6 files changed, 397 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/htmlscript.h b/dlls/mshtml/htmlscript.h index 837e9a4df62..0f494b23599 100644 --- a/dlls/mshtml/htmlscript.h +++ b/dlls/mshtml/htmlscript.h @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "activscp.h" + struct HTMLScriptElement { HTMLElement element; @@ -48,3 +50,4 @@ HRESULT exec_script(HTMLInnerWindow*,const WCHAR*,const WCHAR*,VARIANT*); void update_browser_script_mode(GeckoBrowser*,IUri*); BOOL find_global_prop(HTMLInnerWindow*,BSTR,DWORD,ScriptHost**,DISPID*); IDispatch *get_script_disp(ScriptHost*); +IActiveScriptSite *get_first_script_site(HTMLInnerWindow*); diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index b3eb99afa02..1af5167efaa 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -74,6 +74,7 @@ struct ScriptHost { IActiveScriptSiteUIControl IActiveScriptSiteUIControl_iface; IActiveScriptSiteDebug IActiveScriptSiteDebug_iface; IServiceProvider IServiceProvider_iface; + IOleCommandTarget IOleCommandTarget_iface; LONG ref; @@ -308,6 +309,9 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); *ppv = &This->IServiceProvider_iface; + }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) { + TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv); + *ppv = &This->IOleCommandTarget_iface; }else if(IsEqualGUID(&IID_ICanHandleException, riid)) { TRACE("(%p)->(IID_ICanHandleException not supported %p)\n", This, ppv); return E_NOINTERFACE; @@ -675,6 +679,18 @@ static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, RE { ScriptHost *This = impl_from_IServiceProvider(iface); + if(IsEqualGUID(&IID_IActiveScriptSite, guidService)) { + ScriptHost *script_host = This; + + TRACE("(%p)->(IID_IActiveScriptSite)\n", This); + + /* Use first script site if available */ + if(This->window && !list_empty(&This->window->script_hosts)) + script_host = LIST_ENTRY(list_head(&This->window->script_hosts), ScriptHost, entry); + + return IActiveScriptSite_QueryInterface(&script_host->IActiveScriptSite_iface, riid, ppv); + } + if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) { TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This); @@ -705,6 +721,57 @@ static const IServiceProviderVtbl ASServiceProviderVtbl = { ASServiceProvider_QueryService }; +static inline ScriptHost *impl_from_IOleCommandTarget(IOleCommandTarget *iface) +{ + return CONTAINING_RECORD(iface, ScriptHost, IOleCommandTarget_iface); +} + +static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv) +{ + ScriptHost *This = impl_from_IOleCommandTarget(iface); + return IActiveScriptSite_QueryInterface(&This->IActiveScriptSite_iface, riid, ppv); +} + +static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface) +{ + ScriptHost *This = impl_from_IOleCommandTarget(iface); + return IActiveScriptSite_AddRef(&This->IActiveScriptSite_iface); +} + +static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface) +{ + ScriptHost *This = impl_from_IOleCommandTarget(iface); + return IActiveScriptSite_Release(&This->IActiveScriptSite_iface); +} + +static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup, + ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) +{ + ScriptHost *This = impl_from_IOleCommandTarget(iface); + + FIXME("(%p)->(%s %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); + + return E_NOTIMPL; +} + +static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup, + DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + ScriptHost *This = impl_from_IOleCommandTarget(iface); + + FIXME("(%p)->(%s %ld %ld %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut); + + return E_NOTIMPL; +} + +static const IOleCommandTargetVtbl OleCommandTargetVtbl = { + OleCommandTarget_QueryInterface, + OleCommandTarget_AddRef, + OleCommandTarget_Release, + OleCommandTarget_QueryStatus, + OleCommandTarget_Exec +}; + static ScriptHost *create_script_host(HTMLInnerWindow *window, const GUID *guid) { IActiveScript *script; @@ -721,6 +788,7 @@ static ScriptHost *create_script_host(HTMLInnerWindow *window, const GUID *guid) ret->IActiveScriptSiteUIControl_iface.lpVtbl = &ActiveScriptSiteUIControlVtbl; ret->IActiveScriptSiteDebug_iface.lpVtbl = &ActiveScriptSiteDebugVtbl; ret->IServiceProvider_iface.lpVtbl = &ASServiceProviderVtbl; + ret->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl; ret->ref = 1; ret->window = window; ret->script_state = SCRIPTSTATE_UNINITIALIZED; @@ -1474,6 +1542,16 @@ IDispatch *get_script_disp(ScriptHost *script_host) return disp; } +IActiveScriptSite *get_first_script_site(HTMLInnerWindow *window) +{ + if(list_empty(&window->script_hosts)) { + ScriptHost *script_host = create_script_host(window, &CLSID_JScript); + if(!script_host) + return NULL; + } + return &LIST_ENTRY(list_head(&window->script_hosts), ScriptHost, entry)->IActiveScriptSite_iface; +} + static EventTarget *find_event_target(HTMLDocumentNode *doc, HTMLScriptElement *script_elem) { EventTarget *event_target = NULL; diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c index 1f440b846e8..f7a4003462c 100644 --- a/dlls/mshtml/service.c +++ b/dlls/mshtml/service.c @@ -29,6 +29,7 @@ #include "wine/debug.h" #include "mshtml_private.h" +#include "htmlscript.h" WINE_DEFAULT_DEBUG_CHANNEL(mshtml); @@ -360,6 +361,21 @@ static HRESULT WINAPI DocNodeServiceProvider_QueryService(IServiceProvider *ifac { HTMLDocumentNode *This = HTMLDocumentNode_from_IServiceProvider(iface); + if(IsEqualGUID(&IID_IActiveScriptSite, guidService)) { + IActiveScriptSite *site; + + TRACE("IID_IActiveScriptSite\n"); + + if(!This->window) { + FIXME("No window\n"); + return E_NOTIMPL; + } + + if(!(site = get_first_script_site(This->window))) + return E_OUTOFMEMORY; + return IActiveScriptSite_QueryInterface(site, riid, ppv); + } + if(IsEqualGUID(&SID_SContainerDispatch, guidService)) { TRACE("SID_SContainerDispatch\n"); return IHTMLDocument2_QueryInterface(&This->IHTMLDocument2_iface, riid, ppv); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 606cbbc74ce..bea5e1598a8 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -35,6 +35,8 @@ #include "shdeprecated.h" #include "dispex.h" +extern const IID IID_IActiveScriptSite; + #define DEFINE_EXPECT(func) \ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE @@ -3398,12 +3400,15 @@ static void test_doc_obj(IHTMLDocument2 *doc) IHTMLPerformance *perf, *perf2; IOmHistory *history, *history2; IHTMLScreen *screen, *screen2; + IOleCommandTarget *cmdtarget; IHTMLWindow2 *self, *window2; IEventTarget *event_target; + IUnknown *site, *site2; DISPPARAMS dp = { 0 }; IHTMLWindow7 *window7; IHTMLWindow6 *window6; IHTMLWindow5 *window5; + IServiceProvider *sp; IDispatchEx *dispex; IHTMLElement *body; VARIANT res, arg; @@ -3565,6 +3570,16 @@ static void test_doc_obj(IHTMLDocument2 *doc) ok(hres == S_OK, "get_self failed: %08lx\n", hres); ok(self != NULL, "self == NULL\n"); + /* And script sites */ + hres = IHTMLDocument2_QueryInterface(doc_node, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx\n", hres); + hres = IOleCommandTarget_QueryInterface(cmdtarget, &IID_IActiveScriptSite, (void**)&site); + ok(hres == S_OK, "Command Target QI for IActiveScriptSite failed: %08lx\n", hres); + IOleCommandTarget_Release(cmdtarget); + IServiceProvider_Release(sp); + /* Add props to location, since it gets lost on navigation, despite being same object */ bstr = SysAllocString(L"wineTestProp"); hres = IHTMLLocation_QueryInterface(location, &IID_IDispatchEx, (void**)&dispex); @@ -3631,16 +3646,28 @@ static void test_doc_obj(IHTMLDocument2 *doc) hres = IHTMLWindow2_get_document(window, &doc_node2); ok(hres == S_OK, "get_document failed: %08lx\n", hres); ok(doc_node != doc_node2, "doc_node == doc_node2\n"); - IHTMLDocument2_Release(doc_node2); hres = IHTMLDocument2_get_parentWindow(doc_node, &window2); todo_wine ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); todo_wine ok(window == window2, "window != window2\n"); - IHTMLDocument2_Release(doc_node); if(hres == S_OK) IHTMLWindow2_Release(window2); + hres = IHTMLDocument2_QueryInterface(doc_node2, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx\n", hres); + hres = IOleCommandTarget_QueryInterface(cmdtarget, &IID_IActiveScriptSite, (void**)&site2); + ok(hres == S_OK, "Command Target QI for IActiveScriptSite failed: %08lx\n", hres); + ok(site != site2, "site == site2\n"); + IOleCommandTarget_Release(cmdtarget); + IHTMLDocument2_Release(doc_node2); + IHTMLDocument2_Release(doc_node); + IServiceProvider_Release(sp); + IUnknown_Release(site2); + IUnknown_Release(site); + hres = IHTMLWindow2_get_location(window, &location2); ok(hres == S_OK, "get_location failed: %08lx\n", hres); ok(location == location2, "location != location2\n"); diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index f2ad881df39..f41d5749b3b 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -53,6 +53,7 @@ DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00, DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70); DEFINE_GUID(outer_test_iid,0xabcabc00,0,0,0,0,0,0,0,0,0,0x66); +extern const IID IID_IActiveScriptSite; #define DEFINE_EXPECT(func) \ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE @@ -8730,8 +8731,11 @@ static void test_submit(void) static void test_QueryService(IHTMLDocument2 *doc, BOOL success) { IHTMLWindow2 *window, *sp_window; + IOleCommandTarget *cmdtarget; + IHTMLDocument2 *doc_node; IServiceProvider *sp; IHlinkFrame *hf; + IUnknown *unk; HRESULT hres; hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp); @@ -8748,6 +8752,9 @@ static void test_QueryService(IHTMLDocument2 *doc, BOOL success) ok(hf == &HlinkFrame, "hf != HlinkFrame\n"); IHlinkFrame_Release(hf); + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == E_NOINTERFACE, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) returned: %08lx\n", hres); + IServiceProvider_Release(sp); hres = IHTMLDocument2_get_parentWindow(doc, &window); @@ -8766,8 +8773,28 @@ static void test_QueryService(IHTMLDocument2 *doc, BOOL success) ok(hf == &HlinkFrame, "hf != HlinkFrame\n"); IHlinkFrame_Release(hf); + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == E_NOINTERFACE, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) returned: %08lx\n", hres); + IServiceProvider_Release(sp); + + hres = IHTMLWindow2_get_document(window, &doc_node); + ok(hres == S_OK, "get_document failed: %08lx\n", hres); IHTMLWindow2_Release(window); + + hres = IHTMLDocument2_QueryInterface(doc_node, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + IHTMLDocument2_Release(doc_node); + + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget != NULL, "cmdtarget == NULL\n"); + hres = IOleCommandTarget_QueryInterface(cmdtarget, &IID_IActiveScriptSite, (void**)&unk); + ok(hres == S_OK, "Command Target QI for IActiveScriptSite failed: %08lx\n", hres); + IUnknown_Release(unk); + + IOleCommandTarget_Release(cmdtarget); + IServiceProvider_Release(sp); } static void test_HTMLDocument_StreamLoad(void) @@ -9281,8 +9308,10 @@ static BOOL check_ie(void) static void test_ServiceProvider(void) { IHTMLDocument3 *doc3, *doc3_2; + IOleCommandTarget *cmdtarget; IServiceProvider *provider; IHTMLDocument2 *doc, *doc2; + IHTMLWindow2 *window; IUnknown *unk; HRESULT hres; @@ -9318,6 +9347,29 @@ static void test_ServiceProvider(void) ok(hres == S_OK, "QueryService(HTMLEditServices) failed: %08lx\n", hres); IUnknown_Release(unk); + hres = IServiceProvider_QueryService(provider, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == E_NOINTERFACE, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) returned: %08lx\n", hres); + IServiceProvider_Release(provider); + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + + hres = IHTMLWindow2_get_document(window, &doc2); + ok(hres == S_OK, "get_document failed: %08lx\n", hres); + IHTMLWindow2_Release(window); + + hres = IHTMLDocument2_QueryInterface(doc2, &IID_IServiceProvider, (void**)&provider); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + IHTMLDocument2_Release(doc2); + + hres = IServiceProvider_QueryService(provider, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget != NULL, "cmdtarget == NULL\n"); + hres = IOleCommandTarget_QueryInterface(cmdtarget, &IID_IActiveScriptSite, (void**)&unk); + ok(hres == S_OK, "Command Target QI for IActiveScriptSite failed: %08lx\n", hres); + IUnknown_Release(unk); + + IOleCommandTarget_Release(cmdtarget); IServiceProvider_Release(provider); release_document(doc); } diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index 68ad3002a7f..1f3f4a1bb79 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -129,6 +129,7 @@ DEFINE_EXPECT(AddNamedItem); DEFINE_EXPECT(AddNamedItem2); DEFINE_EXPECT(ParseScriptText_script); DEFINE_EXPECT(ParseScriptText_script2); +DEFINE_EXPECT(ParseScriptText_script_with_prescript_site); DEFINE_EXPECT(ParseScriptText_execScript); DEFINE_EXPECT(GetScriptDispatch); DEFINE_EXPECT(funcDisp); @@ -186,6 +187,7 @@ static BOOL is_ie9plus, is_english; static IHTMLDocument2 *notif_doc; static IOleDocumentView *view; static IDispatchEx *window_dispex; +static IHTMLDocument2 *doc_obj; static BOOL doc_complete; static IDispatch *script_disp; static BOOL ax_objsafe; @@ -1924,7 +1926,8 @@ static IHTMLDocument2 *create_document(void) todo_wine #endif ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres); - return SUCCEEDED(hres) ? doc : NULL; + doc_obj = SUCCEEDED(hres) ? doc : NULL; + return doc_obj; } static void load_string(IHTMLDocument2 *doc, const char *str) @@ -3059,10 +3062,34 @@ static void test_ui(void) static void test_sp(void) { - IServiceProvider *sp; + IServiceProvider *sp, *doc_sp, *doc_obj_sp, *window_sp; + IOleCommandTarget *cmdtarget; + IHTMLWindow2 *window; + IHTMLDocument2 *doc; IUnknown *unk; HRESULT hres; + hres = IDispatchEx_QueryInterface(window_dispex, &IID_IHTMLWindow2, (void**)&window); + ok(hres == S_OK, "QueryInterface(IHTMLWindow2) failed: %08lx\n", hres); + ok(window != NULL, "window is NULL\n"); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&window_sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + ok(window_sp != NULL, "window service provider is NULL\n"); + + hres = IHTMLWindow2_get_document(window, &doc); + ok(hres == S_OK, "QueryInterface(IHTMLDocument2) failed: %08lx\n", hres); + ok(doc != NULL, "doc is NULL\n"); + ok(doc != doc_obj, "doc node == doc obj\n"); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&doc_sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + ok(doc_sp != NULL, "doc service provider is NULL\n"); + IHTMLDocument2_Release(doc); + hres = IHTMLDocument2_QueryInterface(doc_obj, &IID_IServiceProvider, (void**)&doc_obj_sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + ok(doc_obj_sp != NULL, "doc_obj service provider is NULL\n"); + hres = IActiveScriptSite_QueryInterface(site, &IID_IServiceProvider, (void**)&sp); ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); @@ -3070,7 +3097,60 @@ static void test_sp(void) ok(hres == S_OK, "Could not get SID_SContainerDispatch service: %08lx\n", hres); IUnknown_Release(unk); + hres = IServiceProvider_QueryService(sp, &SID_GetCaller, &IID_IServiceProvider, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres); + hres = IServiceProvider_QueryService(doc_sp, &SID_GetCaller, &IID_IServiceProvider, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres); + hres = IServiceProvider_QueryService(doc_obj_sp, &SID_GetCaller, &IID_IServiceProvider, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres); + hres = IServiceProvider_QueryService(window_sp, &SID_GetCaller, &IID_IServiceProvider, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres); + + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget != NULL, "IOleCommandTarget is NULL\n"); + + hres = IActiveScriptSite_QueryInterface(site, &IID_IOleCommandTarget, (void**)&unk); + ok(hres == S_OK, "QueryInterface(IOleCommandTarget) failed: %08lx\n", hres); + ok(unk != NULL, "QueryInterface(IOleCommandTarget) is NULL\n"); + ok(cmdtarget == (IOleCommandTarget*)unk, "cmdtarget from QS not same as from QI\n"); + IUnknown_Release(unk); + hres = IServiceProvider_QueryService(doc_sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&unk); + ok(hres == S_OK, "QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget == (IOleCommandTarget*)unk, "IActiveScriptSite service from document provider not same as site's\n"); + IUnknown_Release(unk); + hres = IServiceProvider_QueryService(doc_obj_sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(IActiveScriptSite->IOleCommandTarget) returned: %08lx\n", hres); + hres = IServiceProvider_QueryService(window_sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(IActiveScriptSite->IOleCommandTarget) returned: %08lx\n", hres); + + if(site2) { + IOleCommandTarget *cmdtarget2; + IServiceProvider *sp2; + + hres = IActiveScriptSite_QueryInterface(site2, &IID_IServiceProvider, (void**)&sp2); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + + hres = IServiceProvider_QueryService(sp2, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget2); + ok(hres == S_OK, "QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget2 != NULL, "IOleCommandTarget is NULL\n"); + + hres = IActiveScriptSite_QueryInterface(site2, &IID_IOleCommandTarget, (void**)&unk); + ok(hres == S_OK, "QueryInterface(IOleCommandTarget) failed: %08lx\n", hres); + ok(unk != NULL, "QueryInterface(IOleCommandTarget) is NULL\n"); + ok(cmdtarget2 != (IOleCommandTarget*)unk, "cmdtarget from site2's QS same as from QI\n"); + ok(cmdtarget2 == cmdtarget, "site1's cmdtarget not same as site2's\n"); + IOleCommandTarget_Release(cmdtarget2); + IServiceProvider_Release(sp2); + IUnknown_Release(unk); + } + + IOleCommandTarget_Release(cmdtarget); + IServiceProvider_Release(window_sp); + IServiceProvider_Release(doc_obj_sp); + IServiceProvider_Release(doc_sp); IServiceProvider_Release(sp); + IHTMLWindow2_Release(window); } static void test_script_run(void) @@ -3331,6 +3411,12 @@ static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *ifac test_script_run(); return S_OK; + }else if(!lstrcmpW(pstrCode, L"with pre-script site")) { + CHECK_EXPECT(ParseScriptText_script_with_prescript_site); + ok(!lstrcmpW(pstrItemName, L"window"), "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName)); + ok(!lstrcmpW(pstrDelimiter, L""), "pstrDelimiter = %s\n", wine_dbgstr_w(pstrDelimiter)); + ok(dwFlags == (SCRIPTTEXT_ISVISIBLE|SCRIPTTEXT_HOSTMANAGESSOURCE), "dwFlags = %lx\n", dwFlags); + return S_OK; } ok(0, "unexpected script %s\n", wine_dbgstr_w(pstrCode)); @@ -3406,6 +3492,8 @@ static HRESULT WINAPI ActiveScript_SetScriptSite(IActiveScript *iface, IActiveSc CHECK_EXPECT(SetScriptSite); ok(pass != NULL, "pass == NULL\n"); + if(site2) + ok(pass != site2, "pass == pre-script site\n"); hres = IActiveScriptSite_QueryInterface(pass, &IID_IActiveScriptSiteInterruptPoll, (void**)&poll); ok(hres == S_OK, "Could not get IActiveScriptSiteInterruptPoll interface: %08lx\n", hres); @@ -3695,6 +3783,7 @@ static HRESULT WINAPI ActiveScriptParse2_ParseScriptText(IActiveScriptParse *ifa ok(!lstrcmpW(pstrItemName, L"window"), "pstrItemName = %s\n", wine_dbgstr_w(pstrItemName)); ok(!lstrcmpW(pstrDelimiter, L""), "pstrDelimiter = %s\n", wine_dbgstr_w(pstrDelimiter)); ok(dwFlags == (SCRIPTTEXT_ISVISIBLE | SCRIPTTEXT_HOSTMANAGESSOURCE), "dwFlags = %08lx\n", dwFlags); + test_sp(); return S_OK; } @@ -4447,6 +4536,12 @@ static const char simple_script_str[] = "" ""; +static const char simple_script_with_prescript_site_str[] = + "" + "" + "" + ""; + static void test_insert_script_elem(IHTMLDocument2 *doc, const WCHAR *code, const WCHAR *lang) { IHTMLDOMNode *node, *body_node, *inserted_node; @@ -4524,10 +4619,16 @@ static void test_exec_script(IHTMLDocument2 *doc, const WCHAR *codew, const WCHA static void test_simple_script(void) { + IOleCommandTarget *cmdtarget; IHTMLDocument2 *doc_node; + IServiceProvider *sp; IHTMLWindow2 *window; + IHTMLDocument6 *doc6; IHTMLDocument2 *doc; + DISPID dispid; HRESULT hres; + VARIANT v; + BSTR bstr; doc = create_document(); if(!doc) @@ -4591,13 +4692,6 @@ static void test_simple_script(void) test_exec_script(doc, L"execScript call", L"TestScript1"); - if(site) - IActiveScriptSite_Release(site); - if(site2) - IActiveScriptSite_Release(site2); - if(window_dispex) - IDispatchEx_Release(window_dispex); - hres = IHTMLDocument2_get_parentWindow(doc, &window); ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); @@ -4614,6 +4708,16 @@ static void test_simple_script(void) CHECK_CALLED(Close); CHECK_CALLED(Close2); + if(site) + IActiveScriptSite_Release(site); + if(site2) + IActiveScriptSite_Release(site2); + if(window_dispex) + IDispatchEx_Release(window_dispex); + site = NULL; + site2 = NULL; + window_dispex = NULL; + hres = IHTMLWindow2_get_document(window, &doc); ok(hres == S_OK, "get_document failed: %08lx\n", hres); ok(doc != doc_node, "doc == doc_node\n"); @@ -4621,6 +4725,112 @@ static void test_simple_script(void) IHTMLDocument2_Release(doc_node); IHTMLDocument2_Release(doc); IHTMLWindow2_Release(window); + + /* Obtaining the IActiveScriptSite before any script engines creates a site with JScript engine, + and is preserved after document gets loaded, and even keeps it from changing its compat mode. */ + doc = create_document(); + if(!doc) + return; + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + + hres = IHTMLWindow2_get_document(window, &doc_node); + ok(hres == S_OK, "get_document failed: %08lx\n", hres); + IHTMLWindow2_Release(window); + + hres = IHTMLDocument2_QueryInterface(doc_node, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + IHTMLDocument2_Release(doc_node); + + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget != NULL, "cmdtarget == NULL\n"); + + hres = IOleCommandTarget_QueryInterface(cmdtarget, &IID_IActiveScriptSite, (void**)&site2); + ok(hres == S_OK, "Command Target QI for IActiveScriptSite failed: %08lx\n", hres); + ok(site2 != NULL, "IActiveScriptSite is NULL\n"); + IOleCommandTarget_Release(cmdtarget); + IServiceProvider_Release(sp); + + SET_EXPECT(CreateInstance); + SET_EXPECT(GetInterfaceSafetyOptions); + SET_EXPECT(SetInterfaceSafetyOptions); + SET_EXPECT(SetProperty_INVOKEVERSIONING); + SET_EXPECT(SetProperty_HACK_TRIDENTEVENTSINK); + SET_EXPECT(InitNew); + SET_EXPECT(SetScriptSite); + SET_EXPECT(GetScriptState); + SET_EXPECT(SetScriptState_STARTED); + SET_EXPECT(AddNamedItem); + SET_EXPECT(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION_FALSE); + SET_EXPECT(ParseScriptText_script_with_prescript_site); + SET_EXPECT(SetScriptState_CONNECTED); + + load_doc(doc, simple_script_with_prescript_site_str); + + CHECK_CALLED(CreateInstance); + CHECK_CALLED(GetInterfaceSafetyOptions); + CHECK_CALLED(SetInterfaceSafetyOptions); + CHECK_CALLED(SetProperty_INVOKEVERSIONING); + CHECK_CALLED(SetProperty_HACK_TRIDENTEVENTSINK); + CHECK_CALLED(InitNew); + CHECK_CALLED(SetScriptSite); + CHECK_CALLED(GetScriptState); + CHECK_CALLED(SetScriptState_STARTED); + CHECK_CALLED(AddNamedItem); + CHECK_CALLED(SetProperty_ABBREVIATE_GLOBALNAME_RESOLUTION_FALSE); + CHECK_CALLED(ParseScriptText_script_with_prescript_site); + CHECK_CALLED(SetScriptState_CONNECTED); + + if(site) + IActiveScriptSite_Release(site); + + bstr = SysAllocString(L"fail_prop"); + hres = IHTMLDocument2_GetIDsOfNames(doc, &IID_NULL, &bstr, 1, 0, &dispid); + ok(hres == DISP_E_UNKNOWNNAME, "GetIDsOfNames(fail_prop) returned: %08lx\n", hres); + SysFreeString(bstr); + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + + hres = IHTMLWindow2_get_document(window, &doc_node); + ok(hres == S_OK, "get_document failed: %08lx\n", hres); + IHTMLWindow2_Release(window); + + hres = IHTMLDocument2_QueryInterface(doc_node, &IID_IHTMLDocument6, (void**)&doc6); + ok(hres == S_OK, "Could not get IHTMLDocument6 iface: %08lx\n", hres); + hres = IHTMLDocument6_get_documentMode(doc6, &v); + ok(V_VT(&v) == VT_R4, "V_VT(documentMode) = %d\n", V_VT(&v)); + ok(V_R4(&v) == 5.0, "V_R4(documentMode) = %f\n", V_R4(&v)); + IHTMLDocument6_Release(doc6); + + hres = IHTMLDocument2_QueryInterface(doc_node, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08lx\n", hres); + IHTMLDocument2_Release(doc_node); + + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IID_IActiveScriptSite->IID_IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget != NULL, "cmdtarget == NULL\n"); + + hres = IOleCommandTarget_QueryInterface(cmdtarget, &IID_IActiveScriptSite, (void**)&site); + ok(hres == S_OK, "Command Target QI for IActiveScriptSite failed: %08lx\n", hres); + ok(site == site2, "site != site2\n"); + IOleCommandTarget_Release(cmdtarget); + IServiceProvider_Release(sp); + + SET_EXPECT(SetScriptState_DISCONNECTED); + SET_EXPECT(Close); + + IHTMLDocument2_Release(doc); + + CHECK_CALLED(SetScriptState_DISCONNECTED); + CHECK_CALLED(Close); + + IActiveScriptSite_Release(site2); + IActiveScriptSite_Release(site); + if(window_dispex) + IDispatchEx_Release(window_dispex); } static void run_from_moniker(IMoniker *mon) From abb5f14c9db9d9325288d80cf5f1223ea94dfb33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0913/1506] mshtml: Implement Exec for CGID_ScriptSite's CMDID_SCRIPTSITE_SECURITY_WINDOW. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/script.c | 29 +++++++++++++++++++++++++++-- dlls/mshtml/tests/script.c | 16 +++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 1af5167efaa..43fa6e42c66 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -759,9 +759,34 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID { ScriptHost *This = impl_from_IOleCommandTarget(iface); - FIXME("(%p)->(%s %ld %ld %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut); + TRACE("(%p)->(%s %ld %ld %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut); - return E_NOTIMPL; + if(!pguidCmdGroup) { + FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup)); + return OLECMDERR_E_UNKNOWNGROUP; + } + + if(IsEqualGUID(&CGID_ScriptSite, pguidCmdGroup)) { + switch(nCmdID) { + case CMDID_SCRIPTSITE_SECURITY_WINDOW: + if(!This->window || !This->window->base.outer_window) { + FIXME("No window\n"); + return E_FAIL; + } + V_VT(pvaOut) = VT_DISPATCH; + V_DISPATCH(pvaOut) = (IDispatch*)&This->window->base.outer_window->base.IHTMLWindow2_iface; + IDispatch_AddRef(V_DISPATCH(pvaOut)); + break; + + default: + FIXME("Unsupported nCmdID %ld of CGID_ScriptSite group\n", nCmdID); + return OLECMDERR_E_NOTSUPPORTED; + } + return S_OK; + } + + FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup)); + return OLECMDERR_E_UNKNOWNGROUP; } static const IOleCommandTargetVtbl OleCommandTargetVtbl = { diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index 1f3f4a1bb79..7d6d024553d 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -3063,11 +3063,12 @@ static void test_ui(void) static void test_sp(void) { IServiceProvider *sp, *doc_sp, *doc_obj_sp, *window_sp; + IHTMLWindow2 *window, *cmdtarget_window; IOleCommandTarget *cmdtarget; - IHTMLWindow2 *window; IHTMLDocument2 *doc; IUnknown *unk; HRESULT hres; + VARIANT var; hres = IDispatchEx_QueryInterface(window_dispex, &IID_IHTMLWindow2, (void**)&window); ok(hres == S_OK, "QueryInterface(IHTMLWindow2) failed: %08lx\n", hres); @@ -3145,6 +3146,19 @@ static void test_sp(void) IUnknown_Release(unk); } + V_VT(&var) = VT_EMPTY; + hres = IOleCommandTarget_Exec(cmdtarget, &CGID_ScriptSite, CMDID_SCRIPTSITE_SECURITY_WINDOW, 0, NULL, &var); + ok(hres == S_OK, "Exec failed: %08lx\n", hres); + ok(V_VT(&var) == VT_DISPATCH, "V_VT(CMDID_SCRIPTSITE_SECURITY_WINDOW) = %d\n", V_VT(&var)); + ok(V_DISPATCH(&var) != NULL, "V_DISPATCH(CMDID_SCRIPTSITE_SECURITY_WINDOW) = NULL\n"); + + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLWindow2, (void**)&cmdtarget_window); + ok(hres == S_OK, "QueryInterface(IHTMLWindow2) failed: %08lx\n", hres); + ok(cmdtarget_window != NULL, "cmdtarget_window is NULL\n"); + ok(window == cmdtarget_window, "window != cmdtarget_window\n"); + IHTMLWindow2_Release(cmdtarget_window); + VariantClear(&var); + IOleCommandTarget_Release(cmdtarget); IServiceProvider_Release(window_sp); IServiceProvider_Release(doc_obj_sp); From d1e5b27db0823f96e66965ba76b0d8ce8ece7c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0914/1506] vbscript: Implement IActiveScriptSite service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/vbscript/tests/caller.c | 14 +++++++++++++- dlls/vbscript/vbscript.c | 9 +++++++++ dlls/vbscript/vbscript.h | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/tests/caller.c b/dlls/vbscript/tests/caller.c index 19eccfe715d..8b99fa7e129 100644 --- a/dlls/vbscript/tests/caller.c +++ b/dlls/vbscript/tests/caller.c @@ -74,6 +74,7 @@ extern const CLSID CLSID_VBScript; expect_ ## func = called_ ## func = FALSE DEFINE_EXPECT(sp_caller_QI_NULL); +DEFINE_EXPECT(site_QI_NULL); DEFINE_EXPECT(testGetCaller); DEFINE_EXPECT(testGetCallerVBS); DEFINE_EXPECT(testGetCallerNested); @@ -303,7 +304,9 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO break; } - case DISPID_TEST_TESTGETCALLERVBS: + case DISPID_TEST_TESTGETCALLERVBS: { + IUnknown *unk; + CHECK_EXPECT(testGetCallerVBS); ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags); @@ -318,7 +321,14 @@ static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WO hres = IServiceProvider_QueryService(pspCaller, &SID_GetCaller, &IID_IServiceProvider, (void**)&caller); ok(hres == E_NOINTERFACE, "QueryService(SID_GetCaller) returned: %08lx\n", hres); ok(caller == NULL, "caller != NULL\n"); + + SET_EXPECT(site_QI_NULL); + hres = IServiceProvider_QueryService(pspCaller, &IID_IActiveScriptSite, &IID_NULL, (void**)&unk); + ok(hres == E_NOINTERFACE, "QueryService(IActiveScriptSite->NULL) returned: %08lx\n", hres); + ok(!unk, "unk != NULL\n"); + CHECK_CALLED(site_QI_NULL); break; + } case DISPID_TEST_TESTGETCALLERNESTED: CHECK_EXPECT(testGetCallerNested); @@ -374,6 +384,8 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) { *ppv = iface; }else { + if(IsEqualGUID(&IID_NULL, riid)) + CHECK_EXPECT(site_QI_NULL); *ppv = NULL; return E_NOINTERFACE; } diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index 39a5e3b1648..84a8e0bb97f 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -421,6 +421,14 @@ static HRESULT WINAPI vbcaller_QueryService(IServiceProvider *iface, REFGUID gui { struct vbcaller *This = vbcaller_from_IServiceProvider(iface); + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + TRACE("(%p)->(IID_IActiveScriptSite)\n", This); + if(This->ctx->site) + return IActiveScriptSite_QueryInterface(This->ctx->site, riid, ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + if(IsEqualGUID(guidService, &SID_GetCaller)) { TRACE("(%p)->(SID_GetCaller)\n", This); *ppv = NULL; @@ -1224,6 +1232,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU return E_OUTOFMEMORY; } + vbcaller->ctx = ctx; ctx->vbcaller = vbcaller; ctx->safeopt = INTERFACE_USES_DISPEX; list_init(&ctx->objects); diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 56e68411f45..6b67c8b1bc5 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -187,6 +187,7 @@ struct vbcaller { LONG ref; + script_ctx_t *ctx; IServiceProvider *caller; }; From b15f0318908c619a9d4fe6b63db955e0f0028dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:21 +0200 Subject: [PATCH 0915/1506] jscript: Implement IActiveScriptSite service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/jsutils.c | 8 ++++++++ dlls/jscript/tests/caller.c | 10 ++++++++++ dlls/mshtml/tests/script.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 80e068fc529..12f41acd398 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -1035,6 +1035,14 @@ static HRESULT WINAPI JSCaller_QueryService(IServiceProvider *iface, REFGUID gui { JSCaller *This = impl_from_IServiceProvider(iface); + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + TRACE("(%p)->(IID_IActiveScriptSite)\n", This); + if(This->ctx && This->ctx->site) + return IActiveScriptSite_QueryInterface(This->ctx->site, riid, ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + if(IsEqualGUID(guidService, &SID_GetCaller)) { TRACE("(%p)->(SID_GetCaller)\n", This); *ppv = NULL; diff --git a/dlls/jscript/tests/caller.c b/dlls/jscript/tests/caller.c index 99b6a21e7fb..7bb7d4a8fe1 100644 --- a/dlls/jscript/tests/caller.c +++ b/dlls/jscript/tests/caller.c @@ -75,6 +75,7 @@ static const CLSID CLSID_JScript = expect_ ## func = called_ ## func = FALSE DEFINE_EXPECT(sp_caller_QI_NULL); +DEFINE_EXPECT(site_QI_NULL); DEFINE_EXPECT(testArgConv); DEFINE_EXPECT(testGetCaller); DEFINE_EXPECT(testGetCallerJS); @@ -254,6 +255,7 @@ static void test_change_types(IVariantChangeType *change_type, IDispatch *obj_di static void test_caller(IServiceProvider *caller, IDispatch *arg_obj) { IVariantChangeType *change_type; + IUnknown *unk; HRESULT hres; hres = IServiceProvider_QueryService(caller, &SID_VariantConversion, &IID_IVariantChangeType, (void**)&change_type); @@ -263,6 +265,12 @@ static void test_caller(IServiceProvider *caller, IDispatch *arg_obj) test_change_types(change_type, arg_obj); IVariantChangeType_Release(change_type); + + SET_EXPECT(site_QI_NULL); + hres = IServiceProvider_QueryService(caller, &IID_IActiveScriptSite, &IID_NULL, (void**)&unk); + ok(hres == E_NOINTERFACE, "Querying for IActiveScriptSite->NULL returned: %08lx\n", hres); + ok(!unk, "unk != NULL\n"); + CHECK_CALLED(site_QI_NULL); } static IServiceProvider sp_caller_obj; @@ -567,6 +575,8 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) { *ppv = iface; }else { + if(IsEqualGUID(&IID_NULL, riid)) + CHECK_EXPECT(site_QI_NULL); *ppv = NULL; return E_NOINTERFACE; } diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index 7d6d024553d..df0bc4e200d 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -314,6 +314,36 @@ static BSTR get_mime_type_display_name(const WCHAR *content_type) return SysAllocString(L"File"); } +static void test_sp_caller(IServiceProvider *sp) +{ + IOleCommandTarget *cmdtarget; + IServiceProvider *caller; + IHTMLWindow2 *window; + HRESULT hres; + VARIANT var; + + hres = IServiceProvider_QueryService(sp, &SID_GetCaller, &IID_IServiceProvider, (void**)&caller); + ok(hres == S_OK, "QueryService(SID_GetCaller) returned: %08lx\n", hres); + ok(!caller, "caller != NULL\n"); + + hres = IServiceProvider_QueryService(sp, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + ok(hres == S_OK, "QueryService(IActiveScriptSite->IOleCommandTarget) failed: %08lx\n", hres); + ok(cmdtarget != NULL, "IOleCommandTarget is NULL\n"); + + V_VT(&var) = VT_EMPTY; + hres = IOleCommandTarget_Exec(cmdtarget, &CGID_ScriptSite, CMDID_SCRIPTSITE_SECURITY_WINDOW, 0, NULL, &var); + ok(hres == S_OK, "Exec failed: %08lx\n", hres); + ok(V_VT(&var) == VT_DISPATCH, "V_VT(CMDID_SCRIPTSITE_SECURITY_WINDOW) = %d\n", V_VT(&var)); + ok(V_DISPATCH(&var) != NULL, "V_DISPATCH(CMDID_SCRIPTSITE_SECURITY_WINDOW) = NULL\n"); + IOleCommandTarget_Release(cmdtarget); + + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLWindow2, (void**)&window); + ok(hres == S_OK, "QueryInterface(IHTMLWindow2) failed: %08lx\n", hres); + ok(window != NULL, "window is NULL\n"); + IHTMLWindow2_Release(window); + VariantClear(&var); +} + static void test_script_vars(unsigned argc, VARIANTARG *argv) { static const WCHAR *const jsobj_names[] = { L"abc", L"foO", L"bar", L"TostRing", L"hasownpropERty" }; @@ -1171,6 +1201,7 @@ static HRESULT WINAPI externalDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID ok(!pvarRes, "pvarRes != NULL\n"); ok(pei != NULL, "pei == NULL\n"); + test_sp_caller(pspCaller); return S_OK; case DISPID_EXTERNAL_TODO_WINE_OK: From 992e57adf3dfc4d94ac114a1b6533cc431dfcf85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0916/1506] mshtml: Use a hook to implement postMessage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need the caller ServiceProvider to obtain the source. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlwindow.c | 373 +++++++++++++++------------ dlls/mshtml/mshtml_private_iface.idl | 2 - 2 files changed, 211 insertions(+), 164 deletions(-) diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index dd6c0bc5c5e..1222ab13be8 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -2234,6 +2234,87 @@ static HRESULT WINAPI HTMLWindow6_get_maxConnectionsPerServer(IHTMLWindow6 *ifac return E_NOTIMPL; } +static HRESULT check_target_origin(HTMLInnerWindow *window, const WCHAR *target_origin) +{ + BOOL no_port = FALSE; + IUri *uri, *target; + DWORD port, port2; + BSTR bstr, bstr2; + HRESULT hres; + + if(!target_origin) + return E_INVALIDARG; + + if(!wcscmp(target_origin, L"*")) + return S_OK; + + hres = create_uri(target_origin, Uri_CREATE_NOFRAG | Uri_CREATE_NO_DECODE_EXTRA_INFO, &target); + if(FAILED(hres)) + return hres; + + if(!(uri = window->base.outer_window->uri)) { + FIXME("window with no URI\n"); + hres = S_FALSE; + goto done; + } + + bstr = NULL; + hres = IUri_GetSchemeName(uri, &bstr); + if(hres != S_OK) { + SysFreeString(bstr); + goto done; + } + hres = IUri_GetSchemeName(target, &bstr2); + if(SUCCEEDED(hres)) { + if(hres == S_OK && wcsicmp(bstr, bstr2)) + hres = S_FALSE; + SysFreeString(bstr2); + } + SysFreeString(bstr); + if(hres != S_OK) + goto done; + + bstr = NULL; + hres = IUri_GetHost(uri, &bstr); + if(hres != S_OK) { + SysFreeString(bstr); + goto done; + } + hres = IUri_GetHost(target, &bstr2); + if(SUCCEEDED(hres)) { + if(hres == S_OK && wcsicmp(bstr, bstr2)) + hres = S_FALSE; + SysFreeString(bstr2); + } + SysFreeString(bstr); + if(hres != S_OK) + goto done; + + /* Legacy modes ignore port */ + if(dispex_compat_mode(&window->event_target.dispex) < COMPAT_MODE_IE9) + goto done; + + hres = IUri_GetPort(uri, &port); + if(hres != S_OK) { + if(FAILED(hres)) + goto done; + no_port = TRUE; /* some protocols don't have ports (e.g. res) */ + } + hres = IUri_GetPort(target, &port2); + if(hres != S_OK) { + if(FAILED(hres)) + goto done; + if(no_port) + hres = S_OK; + }else if(no_port || port != port2) { + hres = S_FALSE; + } + +done: + IUri_Release(target); + return hres; +} + struct post_message_task { event_task_t header; DOMEvent *event; @@ -2251,6 +2332,77 @@ static void post_message_destr(event_task_t *_task) IDOMEvent_Release(&task->event->IDOMEvent_iface); } +static HRESULT post_message(HTMLInnerWindow *window, VARIANT msg, BSTR targetOrigin, VARIANT transfer, + IServiceProvider *caller, compat_mode_t compat_mode) +{ + DOMEvent *event; + HRESULT hres; + + if(V_VT(&transfer) != VT_EMPTY && V_VT(&transfer) != VT_ERROR) + FIXME("transfer not implemented, ignoring\n"); + + hres = check_target_origin(window, targetOrigin); + if(hres != S_OK) + return SUCCEEDED(hres) ? S_OK : hres; + + switch(V_VT(&msg)) { + case VT_EMPTY: + case VT_NULL: + case VT_VOID: + case VT_I1: + case VT_I2: + case VT_I4: + case VT_I8: + case VT_UI1: + case VT_UI2: + case VT_UI4: + case VT_UI8: + case VT_INT: + case VT_UINT: + case VT_R4: + case VT_R8: + case VT_BOOL: + case VT_BSTR: + case VT_CY: + case VT_DATE: + case VT_DECIMAL: + case VT_HRESULT: + break; + case VT_ERROR: + V_VT(&msg) = VT_EMPTY; + break; + default: + FIXME("Unsupported vt %d\n", V_VT(&msg)); + return E_NOTIMPL; + } + + if(!window->doc) { + FIXME("No document\n"); + return E_FAIL; + } + + hres = create_message_event(window->doc, &msg, &event); + if(FAILED(hres)) + return hres; + + if(compat_mode >= COMPAT_MODE_IE9) { + struct post_message_task *task; + if(!(task = malloc(sizeof(*task)))) { + IDOMEvent_Release(&event->IDOMEvent_iface); + return E_OUTOFMEMORY; + } + + /* Because message events can be sent to different windows, they get blocked by any context */ + task->header.thread_blocked = TRUE; + task->event = event; + return push_event_task(&task->header, window, post_message_proc, post_message_destr, window->task_magic); + } + + dispatch_event(&window->event_target, event); + IDOMEvent_Release(&event->IDOMEvent_iface); + return S_OK; +} + static HRESULT WINAPI HTMLWindow6_postMessage(IHTMLWindow6 *iface, BSTR msg, VARIANT targetOrigin) { HTMLWindow *This = impl_from_IHTMLWindow6(iface); @@ -2264,7 +2416,8 @@ static HRESULT WINAPI HTMLWindow6_postMessage(IHTMLWindow6 *iface, BSTR msg, VAR V_VT(&var) = VT_BSTR; V_BSTR(&var) = msg; V_VT(&transfer) = VT_EMPTY; - return IWineHTMLWindowPrivate_postMessage(&This->IWineHTMLWindowPrivate_iface, var, V_BSTR(&targetOrigin), transfer); + return post_message(This->inner_window, var, V_BSTR(&targetOrigin), transfer, NULL, + dispex_compat_mode(&This->inner_window->event_target.dispex)); } static HRESULT WINAPI HTMLWindow6_toStaticHTML(IHTMLWindow6 *iface, BSTR bstrHTML, BSTR *pbstrStaticHTML) @@ -3197,162 +3350,6 @@ static HRESULT WINAPI window_private_matchMedia(IWineHTMLWindowPrivate *iface, B return create_media_query_list(This, media_query, media_query_list); } -static HRESULT check_target_origin(HTMLInnerWindow *window, const WCHAR *target_origin) -{ - BOOL no_port = FALSE; - IUri *uri, *target; - DWORD port, port2; - BSTR bstr, bstr2; - HRESULT hres; - - if(!target_origin) - return E_INVALIDARG; - - if(!wcscmp(target_origin, L"*")) - return S_OK; - - hres = create_uri(target_origin, Uri_CREATE_NOFRAG | Uri_CREATE_NO_DECODE_EXTRA_INFO, &target); - if(FAILED(hres)) - return hres; - - if(!(uri = window->base.outer_window->uri)) { - FIXME("window with no URI\n"); - hres = S_FALSE; - goto done; - } - - bstr = NULL; - hres = IUri_GetSchemeName(uri, &bstr); - if(hres != S_OK) { - SysFreeString(bstr); - goto done; - } - hres = IUri_GetSchemeName(target, &bstr2); - if(SUCCEEDED(hres)) { - if(hres == S_OK && wcsicmp(bstr, bstr2)) - hres = S_FALSE; - SysFreeString(bstr2); - } - SysFreeString(bstr); - if(hres != S_OK) - goto done; - - bstr = NULL; - hres = IUri_GetHost(uri, &bstr); - if(hres != S_OK) { - SysFreeString(bstr); - goto done; - } - hres = IUri_GetHost(target, &bstr2); - if(SUCCEEDED(hres)) { - if(hres == S_OK && wcsicmp(bstr, bstr2)) - hres = S_FALSE; - SysFreeString(bstr2); - } - SysFreeString(bstr); - if(hres != S_OK) - goto done; - - /* Legacy modes ignore port */ - if(dispex_compat_mode(&window->event_target.dispex) < COMPAT_MODE_IE9) - goto done; - - hres = IUri_GetPort(uri, &port); - if(hres != S_OK) { - if(FAILED(hres)) - goto done; - no_port = TRUE; /* some protocols don't have ports (e.g. res) */ - } - hres = IUri_GetPort(target, &port2); - if(hres != S_OK) { - if(FAILED(hres)) - goto done; - if(no_port) - hres = S_OK; - }else if(no_port || port != port2) { - hres = S_FALSE; - } - -done: - IUri_Release(target); - return hres; -} - -static HRESULT WINAPI window_private_postMessage(IWineHTMLWindowPrivate *iface, VARIANT msg, BSTR targetOrigin, VARIANT transfer) -{ - HTMLWindow *This = impl_from_IWineHTMLWindowPrivateVtbl(iface); - HTMLInnerWindow *window = This->inner_window; - DOMEvent *event; - HRESULT hres; - - TRACE("iface %p, msg %s, targetOrigin %s, transfer %s\n", iface, debugstr_variant(&msg), - debugstr_w(targetOrigin), debugstr_variant(&transfer)); - - if(V_VT(&transfer) != VT_EMPTY && V_VT(&transfer) != VT_ERROR) - FIXME("transfer not implemented, ignoring\n"); - - hres = check_target_origin(window, targetOrigin); - if(hres != S_OK) - return SUCCEEDED(hres) ? S_OK : hres; - - switch(V_VT(&msg)) { - case VT_EMPTY: - case VT_NULL: - case VT_VOID: - case VT_I1: - case VT_I2: - case VT_I4: - case VT_I8: - case VT_UI1: - case VT_UI2: - case VT_UI4: - case VT_UI8: - case VT_INT: - case VT_UINT: - case VT_R4: - case VT_R8: - case VT_BOOL: - case VT_BSTR: - case VT_CY: - case VT_DATE: - case VT_DECIMAL: - case VT_HRESULT: - break; - case VT_ERROR: - V_VT(&msg) = VT_EMPTY; - break; - default: - FIXME("Unsupported vt %d\n", V_VT(&msg)); - return E_NOTIMPL; - } - - if(!window->doc) { - FIXME("No document\n"); - return E_FAIL; - } - - hres = create_message_event(window->doc, &msg, &event); - if(FAILED(hres)) - return hres; - - if(dispex_compat_mode(&window->event_target.dispex) >= COMPAT_MODE_IE9) { - struct post_message_task *task; - if(!(task = malloc(sizeof(*task)))) { - IDOMEvent_Release(&event->IDOMEvent_iface); - return E_OUTOFMEMORY; - } - - /* Because message events can be sent to different windows, they get blocked by any context */ - task->header.thread_blocked = TRUE; - task->event = event; - return push_event_task(&task->header, window, post_message_proc, post_message_destr, window->task_magic); - } - - dispatch_event(&window->event_target, event); - IDOMEvent_Release(&event->IDOMEvent_iface); - return S_OK; -} - static HRESULT WINAPI window_private_get_console(IWineHTMLWindowPrivate *iface, IDispatch **console) { HTMLWindow *This = impl_from_IWineHTMLWindowPrivateVtbl(iface); @@ -3401,7 +3398,6 @@ static const IWineHTMLWindowPrivateVtbl WineHTMLWindowPrivateVtbl = { window_private_cancelAnimationFrame, window_private_get_console, window_private_matchMedia, - window_private_postMessage, window_private_get_MutationObserver }; @@ -4219,6 +4215,57 @@ static HRESULT IHTMLWindow3_setTimeout_hook(DispatchEx *dispex, WORD flags, DISP return dispex_call_builtin(dispex, DISPID_IHTMLWINDOW3_SETTIMEOUT, &new_dp, res, ei, caller); } +static HRESULT IHTMLWindow6_postMessage_hook(DispatchEx *dispex, WORD flags, DISPPARAMS *dp, VARIANT *res, + EXCEPINFO *ei, IServiceProvider *caller) +{ + HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + BSTR targetOrigin, converted_msg = NULL; + VARIANT msg, transfer, converted; + compat_mode_t compat_mode; + HRESULT hres; + + if(!(flags & DISPATCH_METHOD) || dp->cArgs < 2 || dp->cNamedArgs) + return S_FALSE; + compat_mode = dispex_compat_mode(&This->event_target.dispex); + + msg = dp->rgvarg[dp->cArgs - 1]; + V_VT(&transfer) = VT_EMPTY; + if(compat_mode >= COMPAT_MODE_IE10 && dp->cArgs > 2) + transfer = dp->rgvarg[dp->cArgs - 3]; + + TRACE("(%p)->(msg %s, targetOrigin %s, transfer %s)\n", This, debugstr_variant(&msg), + debugstr_variant(&dp->rgvarg[dp->cArgs - 2]), debugstr_variant(&transfer)); + + if(compat_mode < COMPAT_MODE_IE10 && V_VT(&msg) != VT_BSTR) { + hres = change_type(&msg, &dp->rgvarg[dp->cArgs - 1], VT_BSTR, caller); + if(FAILED(hres)) + return hres; + converted_msg = V_BSTR(&msg); + } + + if(V_VT(&dp->rgvarg[dp->cArgs - 2]) == VT_BSTR) { + targetOrigin = V_BSTR(&dp->rgvarg[dp->cArgs - 2]); + V_BSTR(&converted) = NULL; + }else { + if(compat_mode < COMPAT_MODE_IE10) { + SysFreeString(converted_msg); + return E_INVALIDARG; + } + hres = change_type(&converted, &dp->rgvarg[dp->cArgs - 2], VT_BSTR, caller); + if(FAILED(hres)) { + SysFreeString(converted_msg); + return hres; + } + targetOrigin = V_BSTR(&converted); + } + + hres = post_message(This, msg, targetOrigin, transfer, caller, compat_mode); + + SysFreeString(V_BSTR(&converted)); + SysFreeString(converted_msg); + return hres; +} + static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode) { static const dispex_hook_t window2_hooks[] = { @@ -4244,6 +4291,10 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa {DISPID_IHTMLWINDOW4_CREATEPOPUP, NULL}, {DISPID_UNKNOWN} }; + static const dispex_hook_t window6_hooks[] = { + {DISPID_IHTMLWINDOW6_POSTMESSAGE, IHTMLWindow6_postMessage_hook}, + {DISPID_UNKNOWN} + }; /* Hide props not available in IE10 */ static const dispex_hook_t private_ie10_hooks[] = { @@ -4259,6 +4310,7 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa dispex_info_add_interface(info, IWineHTMLWindowPrivate_tid, compat_mode >= COMPAT_MODE_IE11 ? NULL : private_ie10_hooks); + dispex_info_add_interface(info, IHTMLWindow6_tid, window6_hooks); dispex_info_add_interface(info, IHTMLWindow5_tid, NULL); dispex_info_add_interface(info, IHTMLWindow4_tid, compat_mode >= COMPAT_MODE_IE11 ? window4_ie11_hooks : NULL); dispex_info_add_interface(info, IHTMLWindow3_tid, compat_mode >= COMPAT_MODE_IE11 ? window3_ie11_hooks : window3_hooks); @@ -4290,10 +4342,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = { .set_current_event = HTMLWindow_set_current_event }; -static const tid_t HTMLWindow_iface_tids[] = { - IHTMLWindow6_tid, - 0 -}; +static const tid_t HTMLWindow_iface_tids[] = { 0 }; static dispex_static_data_t HTMLWindow_dispex = { "Window", diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index e4d97361ce1..503593d1c25 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -131,8 +131,6 @@ interface IWineHTMLWindowPrivate : IDispatch HRESULT console([retval, out] IDispatch **console); [id(53)] HRESULT matchMedia([in] BSTR media_query, [retval, out] IDispatch **media_query_list); - [id(54)] - HRESULT postMessage([in] VARIANT msg, [in] BSTR targetOrigin, [in, optional] VARIANT transfer); [propget, id(DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER)] HRESULT MutationObserver([retval, out] IDispatch **observer_ctor); } From 92a1f64715ba487f09c0b06ac5e62925876e5be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0917/1506] mshtml: Implement `source` prop for MessageEvents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 31 +- dlls/mshtml/htmlevent.h | 2 +- dlls/mshtml/htmlwindow.c | 77 +++- dlls/mshtml/tests/documentmode.js | 1 + dlls/mshtml/tests/events.c | 604 ++++++++++++++++++++++++++++++ dlls/mshtml/tests/events.js | 14 +- 6 files changed, 713 insertions(+), 16 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 36a7fa6c83c..4e1cfd2b695 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1841,11 +1841,19 @@ static HRESULT WINAPI HTMLEventObj5_get_data(IHTMLEventObj5 *iface, BSTR *p) static HRESULT WINAPI HTMLEventObj5_get_source(IHTMLEventObj5 *iface, IDispatch **p) { HTMLEventObj *This = impl_from_IHTMLEventObj5(iface); + IDOMMessageEvent *message_event; + HRESULT hres; - FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p); - *p = NULL; - return S_OK; + if(!This->event || FAILED(IDOMEvent_QueryInterface(&This->event->IDOMEvent_iface, &IID_IDOMMessageEvent, (void**)&message_event))) { + *p = NULL; + return S_OK; + } + + hres = IDOMMessageEvent_get_source(message_event, (IHTMLWindow2**)p); + IDOMMessageEvent_Release(message_event); + return hres; } static HRESULT WINAPI HTMLEventObj5_put_origin(IHTMLEventObj5 *iface, BSTR v) @@ -3652,6 +3660,7 @@ static void DOMCustomEvent_destructor(DispatchEx *dispex) typedef struct { DOMEvent event; IDOMMessageEvent IDOMMessageEvent_iface; + IHTMLWindow2 *source; VARIANT data; } DOMMessageEvent; @@ -3746,8 +3755,12 @@ static HRESULT WINAPI DOMMessageEvent_get_origin(IDOMMessageEvent *iface, BSTR * static HRESULT WINAPI DOMMessageEvent_get_source(IDOMMessageEvent *iface, IHTMLWindow2 **p) { DOMMessageEvent *This = impl_from_IDOMMessageEvent(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + if((*p = This->source)) + IHTMLWindow2_AddRef(This->source); + return S_OK; } static HRESULT WINAPI DOMMessageEvent_initMessageEvent(IDOMMessageEvent *iface, BSTR type, VARIANT_BOOL can_bubble, @@ -3793,6 +3806,8 @@ static void DOMMessageEvent_traverse(DispatchEx *dispex, nsCycleCollectionTraver DOMMessageEvent *message_event = DOMMessageEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex)); DOMEvent_traverse(&message_event->event.dispex, cb); traverse_variant(&message_event->data, "data", cb); + if(message_event->source) + note_cc_edge((nsISupports*)message_event->source, "MessageEvent.source", cb); } static void DOMMessageEvent_unlink(DispatchEx *dispex) @@ -3800,6 +3815,7 @@ static void DOMMessageEvent_unlink(DispatchEx *dispex) DOMMessageEvent *message_event = DOMMessageEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex)); DOMEvent_unlink(&message_event->event.dispex); unlink_variant(&message_event->data); + unlink_ref(&message_event->source); } static void DOMMessageEvent_destructor(DispatchEx *dispex) @@ -4575,7 +4591,7 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven return S_OK; } -HRESULT create_message_event(HTMLDocumentNode *doc, VARIANT *data, DOMEvent **ret) +HRESULT create_message_event(HTMLDocumentNode *doc, IHTMLWindow2 *source, VARIANT *data, DOMEvent **ret) { DOMMessageEvent *message_event; DOMEvent *event; @@ -4593,6 +4609,9 @@ HRESULT create_message_event(HTMLDocumentNode *doc, VARIANT *data, DOMEvent **re return hres; } + message_event->source = source; + IHTMLWindow2_AddRef(message_event->source); + *ret = event; return S_OK; } diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 2d86ba08782..645e99a4c19 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -116,7 +116,7 @@ void dispatch_event(EventTarget*,DOMEvent*); HRESULT create_document_event(HTMLDocumentNode*,eventid_t,DOMEvent**); HRESULT create_document_event_str(HTMLDocumentNode*,const WCHAR*,IDOMEvent**); HRESULT create_event_from_nsevent(nsIDOMEvent*,compat_mode_t,DOMEvent**); -HRESULT create_message_event(HTMLDocumentNode*,VARIANT*,DOMEvent**); +HRESULT create_message_event(HTMLDocumentNode*,IHTMLWindow2*,VARIANT*,DOMEvent**); HRESULT create_storage_event(HTMLDocumentNode*,BSTR,BSTR,BSTR,const WCHAR*,BOOL,DOMEvent**); void init_nsevents(HTMLDocumentNode*); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 1222ab13be8..b088bc00dfc 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -28,6 +28,7 @@ #include "wininet.h" #include "shlguid.h" #include "shobjidl.h" +#include "activscp.h" #include "exdispid.h" #define NO_SHLWAPI_REG @@ -2315,6 +2316,61 @@ static HRESULT check_target_origin(HTMLInnerWindow *window, const WCHAR *target_ return hres; } +static IHTMLWindow2 *get_source_window(IServiceProvider *caller, compat_mode_t compat_mode) +{ + IOleCommandTarget *cmdtarget, *parent_cmdtarget; + IServiceProvider *parent; + IHTMLWindow2 *source; + HRESULT hres; + VARIANT var; + + if(!caller) + return NULL; + + hres = IServiceProvider_QueryService(caller, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&cmdtarget); + if(hres != S_OK) + cmdtarget = NULL; + + if(compat_mode < COMPAT_MODE_IE9) { + /* Legacy modes query caller unconditionally, and use it instead, if it has a command target */ + hres = IServiceProvider_QueryService(caller, &SID_GetCaller, &IID_IServiceProvider, (void**)&parent); + if(hres == S_OK && parent) { + hres = IServiceProvider_QueryService(parent, &IID_IActiveScriptSite, &IID_IOleCommandTarget, (void**)&parent_cmdtarget); + IServiceProvider_Release(parent); + if(hres == S_OK && parent_cmdtarget) { + if(cmdtarget) + IOleCommandTarget_Release(cmdtarget); + cmdtarget = parent_cmdtarget; + } + } + } + + if(!cmdtarget) + return NULL; + + V_VT(&var) = VT_EMPTY; + hres = IOleCommandTarget_Exec(cmdtarget, &CGID_ScriptSite, CMDID_SCRIPTSITE_SECURITY_WINDOW, 0, NULL, &var); + IOleCommandTarget_Release(cmdtarget); + if(hres != S_OK) + return NULL; + + /* Native assumes it's VT_DISPATCH and doesn't check it */ + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLWindow2, (void**)&source); + IDispatch_Release(V_DISPATCH(&var)); + if(hres != S_OK) + return NULL; + + if(compat_mode < COMPAT_MODE_IE9) { + IHTMLWindow2 *tmp; + hres = IHTMLWindow2_get_self(source, &tmp); + if(hres == S_OK) { + IHTMLWindow2_Release(source); + source = tmp; + } + } + return source; +} + struct post_message_task { event_task_t header; DOMEvent *event; @@ -2335,6 +2391,7 @@ static void post_message_destr(event_task_t *_task) static HRESULT post_message(HTMLInnerWindow *window, VARIANT msg, BSTR targetOrigin, VARIANT transfer, IServiceProvider *caller, compat_mode_t compat_mode) { + IHTMLWindow2 *source; DOMEvent *event; HRESULT hres; @@ -2345,6 +2402,13 @@ static HRESULT post_message(HTMLInnerWindow *window, VARIANT msg, BSTR targetOri if(hres != S_OK) return SUCCEEDED(hres) ? S_OK : hres; + source = get_source_window(caller, compat_mode); + if(!source) { + if(compat_mode < COMPAT_MODE_IE9) + return E_ABORT; + IHTMLWindow2_AddRef(source = &window->base.outer_window->base.IHTMLWindow2_iface); + } + switch(V_VT(&msg)) { case VT_EMPTY: case VT_NULL: @@ -2373,15 +2437,18 @@ static HRESULT post_message(HTMLInnerWindow *window, VARIANT msg, BSTR targetOri break; default: FIXME("Unsupported vt %d\n", V_VT(&msg)); + IHTMLWindow2_Release(source); return E_NOTIMPL; } if(!window->doc) { FIXME("No document\n"); + IHTMLWindow2_Release(source); return E_FAIL; } - hres = create_message_event(window->doc, &msg, &event); + hres = create_message_event(window->doc, source, &msg, &event); + IHTMLWindow2_Release(source); if(FAILED(hres)) return hres; @@ -2406,18 +2473,14 @@ static HRESULT post_message(HTMLInnerWindow *window, VARIANT msg, BSTR targetOri static HRESULT WINAPI HTMLWindow6_postMessage(IHTMLWindow6 *iface, BSTR msg, VARIANT targetOrigin) { HTMLWindow *This = impl_from_IHTMLWindow6(iface); - VARIANT var, transfer; TRACE("(%p)->(%s %s)\n", This, debugstr_w(msg), debugstr_variant(&targetOrigin)); if(V_VT(&targetOrigin) != VT_BSTR) return E_INVALIDARG; - V_VT(&var) = VT_BSTR; - V_BSTR(&var) = msg; - V_VT(&transfer) = VT_EMPTY; - return post_message(This->inner_window, var, V_BSTR(&targetOrigin), transfer, NULL, - dispex_compat_mode(&This->inner_window->event_target.dispex)); + /* This can't obtain the source, and never works even in IE9+ modes... */ + return E_ABORT; } static HRESULT WINAPI HTMLWindow6_toStaticHTML(IHTMLWindow6 *iface, BSTR bstrHTML, BSTR *pbstrStaticHTML) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 9f46de12466..bec247b42d1 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -2928,6 +2928,7 @@ async_test("postMessage", function() { ok(e === undefined, "e = " + e); else { ok(e.data === (v < 10 ? "10" : 10), "e.data = " + e.data); + ok(e.source === window, "e.source = " + e.source); next_test(); } } diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index bea5e1598a8..aa1a60365f2 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -26,6 +26,7 @@ #include "windef.h" #include "winbase.h" #include "ole2.h" +#include "activscp.h" #include "mshtml.h" #include "mshtmdid.h" #include "mshtmhst.h" @@ -100,6 +101,7 @@ DEFINE_EXPECT(submit_onclick_attached_check_cancel); DEFINE_EXPECT(submit_onclick_setret); DEFINE_EXPECT(elem2_cp_onclick); DEFINE_EXPECT(iframe_onload); +DEFINE_EXPECT(onmessage); DEFINE_EXPECT(visibilitychange); DEFINE_EXPECT(onbeforeunload); DEFINE_EXPECT(iframe_onbeforeunload); @@ -115,6 +117,15 @@ DEFINE_EXPECT(doc2_onstoragecommit); DEFINE_EXPECT(window2_onstorage); DEFINE_EXPECT(async_xhr_done); DEFINE_EXPECT(sync_xhr_done); +DEFINE_EXPECT(QS_IActiveScriptSite); +DEFINE_EXPECT(QS_IActiveScriptSite_parent); +DEFINE_EXPECT(QS_IActiveScriptSite_parent2); +DEFINE_EXPECT(QS_IActiveScriptSite_parent3); +DEFINE_EXPECT(QS_IActiveScriptSite_parent4); +DEFINE_EXPECT(QS_GetCaller); +DEFINE_EXPECT(QS_GetCaller_parent2); +DEFINE_EXPECT(QS_GetCaller_parent3); +DEFINE_EXPECT(cmdtarget_Exec); static HWND container_hwnd = NULL; static IHTMLWindow2 *window; @@ -173,6 +184,14 @@ static const char input_doc_str[] = static const char iframe_doc_str[] = ""; +static const char iframe_doc_ie9_str[] = + "" + ""; + +static const char iframe_doc_ie11_str[] = + "" + ""; + static void navigate(IHTMLDocument2*,const WCHAR*); static BOOL iface_cmp(void *iface1, void *iface2) @@ -1486,6 +1505,80 @@ static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, L EVENT_HANDLER_FUNC_OBJ(iframe_onreadystatechange); +static IHTMLWindow2 *onmessage_source; + +static HRESULT WINAPI onmessage(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + IHTMLWindow2 *source, *self; + HRESULT hres; + BSTR bstr; + + CHECK_EXPECT(onmessage); + + if(document_mode < 9) { + IHTMLEventObj5 *event_obj5; + IHTMLEventObj *event_obj; + IDispatch *disp; + + hres = IHTMLWindow2_get_event(window, &event_obj); + ok(hres == S_OK, "get_event failed: %08lx\n", hres); + + hres = IHTMLEventObj_get_type(event_obj, &bstr); + ok(hres == S_OK, "get_type failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"message"), "event type = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + hres = IHTMLEventObj_QueryInterface(event_obj, &IID_IHTMLEventObj5, (void**)&event_obj5); + ok(hres == S_OK, "Could not get IHTMLEventObj5: %08lx\n", hres); + IHTMLEventObj_Release(event_obj); + + hres = IHTMLEventObj5_get_url(event_obj5, &bstr); + ok(hres == S_OK, "get_url failed: %08lx\n", hres); + ok(!bstr, "url = %s\n", wine_dbgstr_w(bstr)); + + hres = IHTMLEventObj5_get_source(event_obj5, &disp); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + + hres = IDispatch_QueryInterface(disp, &IID_IHTMLWindow2, (void**)&source); + ok(hres == S_OK, "Could not get IHTMLWindow2: %08lx\n", hres); + IDispatch_Release(disp); + + hres = IHTMLWindow2_get_self(onmessage_source, &self); + ok(hres == S_OK, "get_self failed: %08lx\n", hres); + ok(source == self, "source != onmessage_source.self\n"); + IHTMLWindow2_Release(source); + IHTMLWindow2_Release(self); + + bstr = SysAllocString(L"foobar"); + hres = IHTMLEventObj5_put_url(event_obj5, bstr); + ok(hres == DISP_E_MEMBERNOTFOUND, "put_url returned: %08lx\n", hres); + SysFreeString(bstr); + + IHTMLEventObj5_Release(event_obj5); + }else { + IDOMMessageEvent *msg; + + hres = IDispatch_QueryInterface(V_DISPATCH(&pdp->rgvarg[1]), &IID_IDOMMessageEvent, (void**)&msg); + ok(hres == S_OK, "Could not get IDOMMessageEvent: %08lx\n", hres); + + hres = IDOMMessageEvent_get_data(msg, &bstr); + ok(hres == S_OK, "get_data failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "data = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + hres = IDOMMessageEvent_get_source(msg, &source); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + ok(source == onmessage_source, "source != onmessage_source\n"); + IHTMLWindow2_Release(source); + + IDOMMessageEvent_Release(msg); + } + return S_OK; +} + +EVENT_HANDLER_FUNC_OBJ(onmessage); + static HRESULT WINAPI onvisibilitychange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -1891,6 +1984,359 @@ static void pump_msgs(BOOL *b) } } +static IOleCommandTarget cmdtarget, cmdtarget_stub; + +static HRESULT WINAPI cmdtarget_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IOleCommandTarget)) + *ppv = &cmdtarget; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static ULONG WINAPI cmdtarget_AddRef(IOleCommandTarget *iface) +{ + return 2; +} + +static ULONG WINAPI cmdtarget_Release(IOleCommandTarget *iface) +{ + return 1; +} + +static HRESULT WINAPI cmdtarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup, + ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) +{ + ok(0, "unexpected call\n"); + return OLECMDERR_E_UNKNOWNGROUP; +} + +static HRESULT WINAPI cmdtarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup, + DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + CHECK_EXPECT2(cmdtarget_Exec); + ok(pguidCmdGroup && IsEqualGUID(pguidCmdGroup, &CGID_ScriptSite), "pguidCmdGroup = %s\n", wine_dbgstr_guid(pguidCmdGroup)); + ok(nCmdID == CMDID_SCRIPTSITE_SECURITY_WINDOW, "nCmdID = %lu\n", nCmdID); + ok(!nCmdexecopt, "nCmdexecopt = %lu\n", nCmdexecopt); + ok(!pvaIn, "pvaIn != NULL\n"); + ok(pvaOut != NULL, "pvaOut = NULL\n"); + + /* Native ignores the VT and assumes VT_DISPATCH, and releases it + without VariantClear, since it crashes without AddRef below... */ + V_VT(pvaOut) = VT_NULL; + V_DISPATCH(pvaOut) = (IDispatch*)onmessage_source; + IDispatch_AddRef(V_DISPATCH(pvaOut)); + return S_OK; +} + +static const IOleCommandTargetVtbl cmdtarget_vtbl = { + cmdtarget_QueryInterface, + cmdtarget_AddRef, + cmdtarget_Release, + cmdtarget_QueryStatus, + cmdtarget_Exec +}; + +static IOleCommandTarget cmdtarget = { &cmdtarget_vtbl }; + +static HRESULT WINAPI cmdtarget_stub_QueryInterface(IOleCommandTarget *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IOleCommandTarget)) + *ppv = &cmdtarget_stub; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static HRESULT WINAPI cmdtarget_stub_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup, + ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) +{ + ok(0, "unexpected call\n"); + return OLECMDERR_E_UNKNOWNGROUP; +} + +static HRESULT WINAPI cmdtarget_stub_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup, + DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) +{ + ok(0, "unexpected call\n"); + return OLECMDERR_E_UNKNOWNGROUP; +} + +static const IOleCommandTargetVtbl cmdtarget_stub_vtbl = { + cmdtarget_stub_QueryInterface, + cmdtarget_AddRef, + cmdtarget_Release, + cmdtarget_stub_QueryStatus, + cmdtarget_stub_Exec +}; + +static IOleCommandTarget cmdtarget_stub = { &cmdtarget_stub_vtbl }; + +static IServiceProvider caller_sp, caller_sp_parent, caller_sp_stub, caller_sp2, caller_sp2_parent, caller_sp2_parent3; + +static HRESULT WINAPI caller_sp_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) + *ppv = &caller_sp; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static ULONG WINAPI caller_sp_AddRef(IServiceProvider *iface) +{ + return 2; +} + +static ULONG WINAPI caller_sp_Release(IServiceProvider *iface) +{ + return 1; +} + +static HRESULT WINAPI caller_sp_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + CHECK_EXPECT2(QS_IActiveScriptSite); + ok(IsEqualGUID(riid, &IID_IOleCommandTarget), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = (document_mode < 9) ? NULL : &cmdtarget; + return (document_mode < 9) ? E_NOINTERFACE : S_OK; + } + + if(IsEqualGUID(guidService, &SID_GetCaller)) { + CHECK_EXPECT(QS_GetCaller); + SET_EXPECT(QS_IActiveScriptSite_parent); + ok(IsEqualGUID(riid, &IID_IServiceProvider), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = &caller_sp_parent; + return S_OK; + } + + ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static const IServiceProviderVtbl caller_sp_vtbl = { + caller_sp_QueryInterface, + caller_sp_AddRef, + caller_sp_Release, + caller_sp_QueryService +}; + +static IServiceProvider caller_sp = { &caller_sp_vtbl }; + +static HRESULT WINAPI caller_sp_parent_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) + *ppv = &caller_sp_parent; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static HRESULT WINAPI caller_sp_parent_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + CHECK_EXPECT(QS_IActiveScriptSite_parent); + ok(IsEqualGUID(riid, &IID_IOleCommandTarget), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static const IServiceProviderVtbl caller_sp_parent_vtbl = { + caller_sp_parent_QueryInterface, + caller_sp_AddRef, + caller_sp_Release, + caller_sp_parent_QueryService +}; + +static IServiceProvider caller_sp_parent = { &caller_sp_parent_vtbl }; + +static HRESULT WINAPI caller_sp_stub_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) + *ppv = &caller_sp_stub; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static HRESULT WINAPI caller_sp_stub_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + CHECK_EXPECT2(QS_IActiveScriptSite); + *ppv = NULL; + return E_NOINTERFACE; + } + + if(IsEqualGUID(guidService, &SID_GetCaller)) { + CHECK_EXPECT(QS_GetCaller); + ok(IsEqualGUID(riid, &IID_IServiceProvider), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return S_OK; + } + + ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static const IServiceProviderVtbl caller_sp_stub_vtbl = { + caller_sp_stub_QueryInterface, + caller_sp_AddRef, + caller_sp_Release, + caller_sp_stub_QueryService +}; + +static IServiceProvider caller_sp_stub = { &caller_sp_stub_vtbl }; + +static HRESULT WINAPI caller_sp2_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) + *ppv = &caller_sp2; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static HRESULT WINAPI caller_sp2_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + CHECK_EXPECT2(QS_IActiveScriptSite_parent2); + ok(IsEqualGUID(riid, &IID_IOleCommandTarget), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = (document_mode < 9) ? &cmdtarget_stub : &cmdtarget; + return S_OK; + } + + if(IsEqualGUID(guidService, &SID_GetCaller)) { + CHECK_EXPECT(QS_GetCaller_parent2); + SET_EXPECT(QS_IActiveScriptSite_parent3); + ok(IsEqualGUID(riid, &IID_IServiceProvider), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = &caller_sp2_parent; + return S_OK; + } + + ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static const IServiceProviderVtbl caller_sp2_vtbl = { + caller_sp2_QueryInterface, + caller_sp_AddRef, + caller_sp_Release, + caller_sp2_QueryService +}; + +static IServiceProvider caller_sp2 = { &caller_sp2_vtbl }; + +static HRESULT WINAPI caller_sp2_parent_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) + *ppv = &caller_sp2_parent; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static HRESULT WINAPI caller_sp2_parent_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + CHECK_EXPECT2(QS_IActiveScriptSite_parent3); + ok(IsEqualGUID(riid, &IID_IOleCommandTarget), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = &cmdtarget; + return S_OK; + } + + if(IsEqualGUID(guidService, &SID_GetCaller)) { + CHECK_EXPECT(QS_GetCaller_parent3); + SET_EXPECT(QS_IActiveScriptSite_parent4); + ok(IsEqualGUID(riid, &IID_IServiceProvider), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = &caller_sp2_parent3; + return S_OK; + } + + ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static const IServiceProviderVtbl caller_sp2_parent_vtbl = { + caller_sp2_parent_QueryInterface, + caller_sp_AddRef, + caller_sp_Release, + caller_sp2_parent_QueryService +}; + +static IServiceProvider caller_sp2_parent = { &caller_sp2_parent_vtbl }; + +static HRESULT WINAPI caller_sp2_parent3_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) + *ppv = &caller_sp2_parent3; + else { + ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + return S_OK; +} + +static HRESULT WINAPI caller_sp2_parent3_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + if(IsEqualGUID(guidService, &IID_IActiveScriptSite)) { + CHECK_EXPECT(QS_IActiveScriptSite_parent4); + ok(IsEqualGUID(riid, &IID_IOleCommandTarget), "unexpected riid %s\n", wine_dbgstr_guid(riid)); + *ppv = NULL; + return S_OK; + } + + ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static const IServiceProviderVtbl caller_sp2_parent3_vtbl = { + caller_sp2_parent3_QueryInterface, + caller_sp_AddRef, + caller_sp_Release, + caller_sp2_parent3_QueryService +}; + +static IServiceProvider caller_sp2_parent3 = { &caller_sp2_parent3_vtbl }; + static IConnectionPoint *get_cp(IUnknown *unk, REFIID riid) { IConnectionPointContainer *cp_container; @@ -2728,6 +3174,161 @@ static void test_focus(IHTMLDocument2 *doc) IHTMLElement4_Release(div); } +static void test_message_event(IHTMLDocument2 *doc) +{ + IHTMLFrameBase2 *iframe; + DISPPARAMS dp = { 0 }; + IHTMLWindow6 *window6; + IHTMLDocument6 *doc6; + IHTMLElement2 *elem; + IHTMLWindow2 *child; + IDispatchEx *dispex; + DISPID dispid; + HRESULT hres; + VARIANT v[2]; + BSTR bstr; + + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow6, (void**)&window6); + ok(hres == S_OK, "Could not get IHTMLWindow6 iface: %08lx\n", hres); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument6, (void**)&doc6); + ok(hres == S_OK, "Could not get IHTMLDocument6 iface: %08lx\n", hres); + bstr = SysAllocString(L"ifr"); + hres = IHTMLDocument6_getElementById(doc6, bstr, &elem); + ok(hres == S_OK, "getElementById failed: %08lx\n", hres); + IHTMLDocument6_Release(doc6); + SysFreeString(bstr); + + hres = IHTMLElement2_QueryInterface(elem, &IID_IHTMLFrameBase2, (void**)&iframe); + ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08lx\n", hres); + IHTMLElement2_Release(elem); + hres = IHTMLFrameBase2_get_contentWindow(iframe, &child); + ok(hres == S_OK, "get_contentWindow failed: %08lx\n", hres); + IHTMLFrameBase2_Release(iframe); + + dp.cArgs = 2; + dp.rgvarg = v; + V_VT(&v[0]) = VT_DISPATCH; + V_DISPATCH(&v[0]) = (IDispatch*)&onmessage_obj; + hres = IHTMLWindow6_put_onmessage(window6, v[0]); + ok(hres == S_OK, "put_onmessage failed: %08lx\n", hres); + + V_VT(&v[0]) = VT_EMPTY; + hres = IHTMLWindow6_get_onmessage(window6, &v[0]); + ok(hres == S_OK, "get_onmessage failed: %08lx\n", hres); + ok(V_VT(&v[0]) == VT_DISPATCH, "V_VT(onmessage) = %d\n", V_VT(&v[0])); + ok(V_DISPATCH(&v[0]) == (IDispatch*)&onmessage_obj, "V_DISPATCH(onmessage) = %p\n", V_DISPATCH(&v[0])); + + if(document_mode >= 9) + add_event_listener((IUnknown*)doc, L"message", (IDispatch*)&onmessage_obj, VARIANT_TRUE); + + V_VT(&v[1]) = VT_BSTR; + V_BSTR(&v[1]) = SysAllocString(L"foobar"); + V_VT(&v[0]) = VT_BSTR; + V_BSTR(&v[0]) = SysAllocString(L"*"); + bstr = SysAllocString(L"foobar"); + hres = IHTMLWindow6_postMessage(window6, V_BSTR(&v[1]), v[0]); + ok(hres == E_ABORT, "postMessage returned: %08lx\n", hres); + IHTMLWindow6_Release(window6); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres); + + bstr = SysAllocString(L"postMessage"); + hres = IDispatchEx_GetDispID(dispex, bstr, fdexNameCaseSensitive, &dispid); + ok(hres == S_OK, "GetDispID(postMessage) failed: %08lx\n", hres); + SysFreeString(bstr); + + onmessage_source = window; + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL); + ok(hres == (document_mode < 9 ? E_ABORT : S_OK), "InvokeEx(postMessage) returned: %08lx\n", hres); + if(hres == S_OK) { + SET_EXPECT(onmessage); + pump_msgs(&called_onmessage); + CHECK_CALLED(onmessage); + } + + if(document_mode < 9) + SET_EXPECT(QS_GetCaller); + SET_EXPECT(QS_IActiveScriptSite); + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_METHOD, &dp, NULL, NULL, &caller_sp_stub); + ok(hres == (document_mode < 9 ? E_ABORT : S_OK), "InvokeEx(postMessage) returned: %08lx\n", hres); + CHECK_CALLED(QS_IActiveScriptSite); + if(document_mode < 9) + CHECK_CALLED(QS_GetCaller); + else { + SET_EXPECT(onmessage); + pump_msgs(&called_onmessage); + CHECK_CALLED(onmessage); + } + + onmessage_source = child; + if(document_mode < 9) { + SET_EXPECT(QS_GetCaller); + SET_EXPECT(QS_IActiveScriptSite_parent); + }else { + SET_EXPECT(cmdtarget_Exec); + } + SET_EXPECT(QS_IActiveScriptSite); + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_METHOD, &dp, NULL, NULL, &caller_sp); + ok(hres == (document_mode < 9 ? E_ABORT : S_OK), "InvokeEx(postMessage) failed: %08lx\n", hres); + CHECK_CALLED(QS_IActiveScriptSite); + if(hres == S_OK) { + CHECK_CALLED(cmdtarget_Exec); + SET_EXPECT(onmessage); + pump_msgs(&called_onmessage); + CHECK_CALLED(onmessage); + } + + if(document_mode < 9) { + SET_EXPECT(QS_GetCaller_parent2); + SET_EXPECT(onmessage); + } + SET_EXPECT(QS_IActiveScriptSite_parent2); + SET_EXPECT(cmdtarget_Exec); + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_METHOD, &dp, NULL, NULL, &caller_sp2); + ok(hres == S_OK, "InvokeEx(postMessage) failed: %08lx\n", hres); + CHECK_CALLED(cmdtarget_Exec); + CHECK_CALLED(QS_IActiveScriptSite_parent2); + if(document_mode < 9) { + CHECK_CALLED(QS_IActiveScriptSite_parent3); + CHECK_CALLED(QS_GetCaller_parent2); + CHECK_CALLED(onmessage); + pump_msgs(NULL); + }else { + SET_EXPECT(onmessage); + pump_msgs(&called_onmessage); + CHECK_CALLED(onmessage); + } + + if(document_mode < 9) { + SET_EXPECT(QS_GetCaller_parent3); + SET_EXPECT(onmessage); + } + SET_EXPECT(QS_IActiveScriptSite_parent3); + SET_EXPECT(cmdtarget_Exec); + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_METHOD, &dp, NULL, NULL, &caller_sp2_parent); + ok(hres == S_OK, "InvokeEx(postMessage) failed: %08lx\n", hres); + CHECK_CALLED(cmdtarget_Exec); + CHECK_CALLED(QS_IActiveScriptSite_parent3); + if(document_mode < 9) { + CHECK_CALLED(QS_IActiveScriptSite_parent4); + CHECK_CALLED(QS_GetCaller_parent3); + CHECK_CALLED(onmessage); + pump_msgs(NULL); + }else { + SET_EXPECT(onmessage); + pump_msgs(&called_onmessage); + CHECK_CALLED(onmessage); + } + + onmessage_source = NULL; + VariantClear(&v[0]); + VariantClear(&v[1]); + IHTMLWindow2_Release(child); + IDispatchEx_Release(dispex); +} + static void test_visibilitychange(IHTMLDocument2 *doc) { if(!winetest_interactive) { @@ -6746,10 +7347,13 @@ START_TEST(events) run_test(input_doc_str, test_focus); run_test(empty_doc_str, test_submit); run_test(empty_doc_ie9_str, test_submit); + run_test(iframe_doc_str, test_message_event); run_test(iframe_doc_str, test_iframe_connections); if(is_ie9plus) { run_test_from_res(L"doc_with_prop.html", test_doc_obj); run_test_from_res(L"doc_with_prop_ie9.html", test_doc_obj); + run_test(iframe_doc_ie9_str, test_message_event); + run_test(iframe_doc_ie11_str, test_message_event); run_test_from_res(L"doc_with_prop_ie9.html", test_visibilitychange); run_test_from_res(L"blank_ie10.html", test_visibilitychange); run_test_from_res(L"iframe.html", test_unload_event); diff --git a/dlls/mshtml/tests/events.js b/dlls/mshtml/tests/events.js index 3b29798e9a1..a5f66a2f031 100644 --- a/dlls/mshtml/tests/events.js +++ b/dlls/mshtml/tests/events.js @@ -824,14 +824,24 @@ async_test("img_wrong_content_type", function() { }); async_test("message event", function() { - var listener_called = false; + var listener_called = false, iframe = document.createElement("iframe"); window.addEventListener("message", function(e) { + if(listener_called) { + ok(e.data === "echo", "e.data (diff origin) = " + e.data); + ok(e.source === iframe.contentWindow, "e.source (diff origin) not iframe.contentWindow"); + next_test(); + return; + } listener_called = true; ok(e.data === "test", "e.data = " + e.data); ok(e.bubbles === false, "bubbles = " + e.bubbles); ok(e.cancelable === false, "cancelable = " + e.cancelable); - next_test(); + ok(e.source === window, "e.source = " + e.source); + + iframe.onload = function() { iframe.contentWindow.postMessage("echo", "hTtP://WinEtesT.difFerent.ORG:1234"); } + iframe.src = "http://winetest.different.org:1234/xhr_iframe.html"; + document.body.appendChild(iframe); }); window.postMessage("test", "httP://wineTest.example.org"); From 7aab57ff9a6e375d1bdddbdddf4c9a3c9505e520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0918/1506] mshtml: Implement `data` getter for MessageEvent objs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 14 +++++++++++--- dlls/mshtml/tests/events.c | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 4e1cfd2b695..adf5422c995 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1831,11 +1831,19 @@ static HRESULT WINAPI HTMLEventObj5_put_data(IHTMLEventObj5 *iface, BSTR v) static HRESULT WINAPI HTMLEventObj5_get_data(IHTMLEventObj5 *iface, BSTR *p) { HTMLEventObj *This = impl_from_IHTMLEventObj5(iface); + IDOMMessageEvent *message_event; + HRESULT hres; - FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p); - *p = NULL; - return S_OK; + if(!This->event || FAILED(IDOMEvent_QueryInterface(&This->event->IDOMEvent_iface, &IID_IDOMMessageEvent, (void**)&message_event))) { + *p = NULL; + return S_OK; + } + + hres = IDOMMessageEvent_get_data(message_event, p); + IDOMMessageEvent_Release(message_event); + return hres; } static HRESULT WINAPI HTMLEventObj5_get_source(IHTMLEventObj5 *iface, IDispatch **p) diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index aa1a60365f2..8641a2aae7d 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -1537,6 +1537,11 @@ static HRESULT WINAPI onmessage(IDispatchEx *iface, DISPID id, LCID lcid, WORD w ok(hres == S_OK, "get_url failed: %08lx\n", hres); ok(!bstr, "url = %s\n", wine_dbgstr_w(bstr)); + hres = IHTMLEventObj5_get_data(event_obj5, &bstr); + ok(hres == S_OK, "get_data failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "data = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + hres = IHTMLEventObj5_get_source(event_obj5, &disp); ok(hres == S_OK, "get_source failed: %08lx\n", hres); From b535fc1383c41f3d52264021803f9c30c9d19b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0919/1506] mshtml: Implement `origin` prop for MessageEvents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 63 ++++++++++++++++++++++++++++--- dlls/mshtml/tests/documentmode.js | 1 + dlls/mshtml/tests/events.c | 13 +++++++ dlls/mshtml/tests/events.js | 2 + 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index adf5422c995..9df40510860 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -1876,11 +1876,19 @@ static HRESULT WINAPI HTMLEventObj5_put_origin(IHTMLEventObj5 *iface, BSTR v) static HRESULT WINAPI HTMLEventObj5_get_origin(IHTMLEventObj5 *iface, BSTR *p) { HTMLEventObj *This = impl_from_IHTMLEventObj5(iface); + IDOMMessageEvent *message_event; + HRESULT hres; - FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p); - *p = NULL; - return S_OK; + if(!This->event || FAILED(IDOMEvent_QueryInterface(&This->event->IDOMEvent_iface, &IID_IDOMMessageEvent, (void**)&message_event))) { + *p = NULL; + return S_OK; + } + + hres = IDOMMessageEvent_get_origin(message_event, p); + IDOMMessageEvent_Release(message_event); + return hres; } static HRESULT WINAPI HTMLEventObj5_put_issession(IHTMLEventObj5 *iface, VARIANT_BOOL v) @@ -3669,6 +3677,7 @@ typedef struct { DOMEvent event; IDOMMessageEvent IDOMMessageEvent_iface; IHTMLWindow2 *source; + BSTR origin; VARIANT data; } DOMMessageEvent; @@ -3756,8 +3765,14 @@ static HRESULT DOMMessageEvent_get_data_hook(DispatchEx *dispex, WORD flags, DIS static HRESULT WINAPI DOMMessageEvent_get_origin(IDOMMessageEvent *iface, BSTR *p) { DOMMessageEvent *This = impl_from_IDOMMessageEvent(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + if(This->origin) + return (*p = SysAllocStringLen(This->origin, SysStringLen(This->origin))) ? S_OK : E_OUTOFMEMORY; + + *p = NULL; + return S_OK; } static HRESULT WINAPI DOMMessageEvent_get_source(IDOMMessageEvent *iface, IHTMLWindow2 **p) @@ -3829,6 +3844,7 @@ static void DOMMessageEvent_unlink(DispatchEx *dispex) static void DOMMessageEvent_destructor(DispatchEx *dispex) { DOMMessageEvent *message_event = DOMMessageEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex)); + SysFreeString(message_event->origin); VariantClear(&message_event->data); DOMEvent_destructor(dispex); } @@ -4602,21 +4618,56 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven HRESULT create_message_event(HTMLDocumentNode *doc, IHTMLWindow2 *source, VARIANT *data, DOMEvent **ret) { DOMMessageEvent *message_event; + BSTR bstr, origin = NULL; + IHTMLLocation *location; DOMEvent *event; HRESULT hres; + UINT len; - hres = create_document_event(doc, EVENTID_MESSAGE, &event); + hres = IHTMLWindow2_get_location(source, &location); + if(FAILED(hres)) + return hres; + + hres = IHTMLLocation_get_protocol(location, &bstr); + if(FAILED(hres)) { + IHTMLLocation_Release(location); + return hres; + } + len = SysStringLen(bstr); + SysFreeString(bstr); + + hres = IHTMLLocation_get_href(location, &bstr); + IHTMLLocation_Release(location); if(FAILED(hres)) return hres; + if(bstr) { + static const WCHAR delims[] = L"/\\"; + + if(bstr[len] == '/' && bstr[len + 1] == '/') + len += 2 + wcscspn(bstr + len + 2, delims); + + origin = SysAllocStringLen(bstr, len); + SysFreeString(bstr); + if(!origin) + return E_OUTOFMEMORY; + } + + hres = create_document_event(doc, EVENTID_MESSAGE, &event); + if(FAILED(hres)) { + SysFreeString(origin); + return hres; + } message_event = DOMMessageEvent_from_DOMEvent(event); V_VT(&message_event->data) = VT_EMPTY; hres = VariantCopy(&message_event->data, data); if(FAILED(hres)) { IDOMEvent_Release(&event->IDOMEvent_iface); + SysFreeString(origin); return hres; } + message_event->origin = origin; message_event->source = source; IHTMLWindow2_AddRef(message_event->source); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index bec247b42d1..94183ad015e 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -2929,6 +2929,7 @@ async_test("postMessage", function() { else { ok(e.data === (v < 10 ? "10" : 10), "e.data = " + e.data); ok(e.source === window, "e.source = " + e.source); + ok(e.origin === "http://winetest.example.org", "e.origin = " + e.origin); next_test(); } } diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 8641a2aae7d..0dd622b15c3 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -1542,6 +1542,11 @@ static HRESULT WINAPI onmessage(IDispatchEx *iface, DISPID id, LCID lcid, WORD w ok(!wcscmp(bstr, L"foobar"), "data = %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); + hres = IHTMLEventObj5_get_origin(event_obj5, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"about:"), "origin = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + hres = IHTMLEventObj5_get_source(event_obj5, &disp); ok(hres == S_OK, "get_source failed: %08lx\n", hres); @@ -1558,6 +1563,9 @@ static HRESULT WINAPI onmessage(IDispatchEx *iface, DISPID id, LCID lcid, WORD w bstr = SysAllocString(L"foobar"); hres = IHTMLEventObj5_put_url(event_obj5, bstr); ok(hres == DISP_E_MEMBERNOTFOUND, "put_url returned: %08lx\n", hres); + + hres = IHTMLEventObj5_put_origin(event_obj5, bstr); + ok(hres == DISP_E_MEMBERNOTFOUND, "put_origin returned: %08lx\n", hres); SysFreeString(bstr); IHTMLEventObj5_Release(event_obj5); @@ -1572,6 +1580,11 @@ static HRESULT WINAPI onmessage(IDispatchEx *iface, DISPID id, LCID lcid, WORD w ok(!wcscmp(bstr, L"foobar"), "data = %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); + hres = IDOMMessageEvent_get_origin(msg, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"about:"), "origin = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + hres = IDOMMessageEvent_get_source(msg, &source); ok(hres == S_OK, "get_source failed: %08lx\n", hres); ok(source == onmessage_source, "source != onmessage_source\n"); diff --git a/dlls/mshtml/tests/events.js b/dlls/mshtml/tests/events.js index a5f66a2f031..a130917cfda 100644 --- a/dlls/mshtml/tests/events.js +++ b/dlls/mshtml/tests/events.js @@ -830,6 +830,7 @@ async_test("message event", function() { if(listener_called) { ok(e.data === "echo", "e.data (diff origin) = " + e.data); ok(e.source === iframe.contentWindow, "e.source (diff origin) not iframe.contentWindow"); + ok(e.origin === "http://winetest.different.org:1234", "e.origin (diff origin) = " + e.origin); next_test(); return; } @@ -838,6 +839,7 @@ async_test("message event", function() { ok(e.bubbles === false, "bubbles = " + e.bubbles); ok(e.cancelable === false, "cancelable = " + e.cancelable); ok(e.source === window, "e.source = " + e.source); + ok(e.origin === "http://winetest.example.org", "e.origin = " + e.origin); iframe.onload = function() { iframe.contentWindow.postMessage("echo", "hTtP://WinEtesT.difFerent.ORG:1234"); } iframe.src = "http://winetest.different.org:1234/xhr_iframe.html"; From 388d92b385ae9ad62a47362c00c6508370bca493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0920/1506] mshtml: Implement `initMessageEvent` for MessageEvents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 48 ++++++++++- dlls/mshtml/tests/documentmode.js | 29 +++++++ dlls/mshtml/tests/events.c | 130 ++++++++++++++++++++++++++++++ dlls/mshtml/tests/events.js | 1 + 4 files changed, 206 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 9df40510860..1f90248238e 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -3740,6 +3740,11 @@ static HRESULT WINAPI DOMMessageEvent_get_data(IDOMMessageEvent *iface, BSTR *p) TRACE("(%p)->(%p)\n", This, p); + if(V_VT(&This->data) == VT_EMPTY) { + *p = SysAllocString(L""); + return S_OK; + } + if(V_VT(&This->data) != VT_BSTR) { FIXME("non-string data\n"); return E_NOTIMPL; @@ -3791,9 +3796,48 @@ static HRESULT WINAPI DOMMessageEvent_initMessageEvent(IDOMMessageEvent *iface, BSTR last_event_id, IHTMLWindow2 *source) { DOMMessageEvent *This = impl_from_IDOMMessageEvent(iface); - FIXME("(%p)->(%s %x %x %s %s %s %p)\n", This, debugstr_w(type), can_bubble, cancelable, + BSTR new_origin = NULL; + BSTR new_data = NULL; + HRESULT hres; + + TRACE("(%p)->(%s %x %x %s %s %s %p)\n", This, debugstr_w(type), can_bubble, cancelable, debugstr_w(data), debugstr_w(origin), debugstr_w(last_event_id), source); - return E_NOTIMPL; + + if(This->event.target) { + TRACE("called on already dispatched event\n"); + return S_OK; + } + + if((data && !(new_data = SysAllocString(data))) || + (origin && !(new_origin = SysAllocString(origin)))) { + hres = E_OUTOFMEMORY; + goto fail; + } + + hres = IDOMEvent_initEvent(&This->event.IDOMEvent_iface, type, can_bubble, cancelable); + if(FAILED(hres)) + goto fail; + + if(new_data) { + VariantClear(&This->data); + V_VT(&This->data) = VT_BSTR; + V_BSTR(&This->data) = new_data; + } + if(new_origin) { + SysFreeString(This->origin); + This->origin = new_origin; + } + if(This->source) + IHTMLWindow2_Release(This->source); + This->source = source; + if(source) + IHTMLWindow2_AddRef(source); + return S_OK; + +fail: + SysFreeString(new_origin); + SysFreeString(new_data); + return hres; } static const IDOMMessageEventVtbl DOMMessageEventVtbl = { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 94183ad015e..5249e042182 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -2919,6 +2919,32 @@ sync_test("MutationObserver", function() { test_exposed("takeRecords"); }); +sync_test("initMessageEvent", function() { + var e, v = document.documentMode; + if(!document.createEvent) + return; + e = document.createEvent("MessageEvent"); + ok(e.data === (v < 10 ? "" : undefined), "e.data = " + e.data); + ok(e.bubbles === false, "bubbles = " + e.bubbles); + ok(e.cancelable === false, "cancelable = " + e.cancelable); + ok(e.source === null, "e.source = " + e.source); + ok(e.origin === "", "e.origin = " + e.origin); + + e.initMessageEvent("blah", true, true, 137, "wine", 1234, window); + ok(e.data === "137", "e.data = " + e.data); + ok(e.bubbles === true, "bubbles = " + e.bubbles); + ok(e.cancelable === true, "cancelable = " + e.cancelable); + ok(e.source === window, "e.source = " + e.source); + ok(e.origin === "wine", "e.origin = " + e.origin); + + e.initMessageEvent("abcd", false, false, "testdata", "origin", 42, null); + ok(e.data === "testdata", "e.data = " + e.data); + ok(e.bubbles === false, "bubbles = " + e.bubbles); + ok(e.cancelable === false, "cancelable = " + e.cancelable); + ok(e.source === null, "e.source = " + e.source); + ok(e.origin === "origin", "e.origin = " + e.origin); +}); + async_test("postMessage", function() { var v = document.documentMode; var onmessage_called = false; @@ -2930,6 +2956,9 @@ async_test("postMessage", function() { ok(e.data === (v < 10 ? "10" : 10), "e.data = " + e.data); ok(e.source === window, "e.source = " + e.source); ok(e.origin === "http://winetest.example.org", "e.origin = " + e.origin); + + e = document.createEvent("MessageEvent"); + ok(e.data === (v < 10 ? "" : undefined), "created e.data = " + e.data); next_test(); } } diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 0dd622b15c3..9c3a6b471f1 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -3345,6 +3345,136 @@ static void test_message_event(IHTMLDocument2 *doc) VariantClear(&v[1]); IHTMLWindow2_Release(child); IDispatchEx_Release(dispex); + + if(document_mode >= 9) { + IDOMMessageEvent *msg_event = NULL; + IDocumentEvent *doc_event; + IHTMLWindow2 *source; + IDOMEvent *event; + UINT argerr; + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IDocumentEvent, (void**)&doc_event); + ok(hres == S_OK, "Could not get IDocumentEvent iface: %08lx\n", hres); + + bstr = SysAllocString(L"MessageEvent"); + hres = IDocumentEvent_createEvent(doc_event, bstr, &event); + ok(hres == S_OK, "createEvent failed: %08lx\n", hres); + IDocumentEvent_Release(doc_event); + SysFreeString(bstr); + + hres = IDOMEvent_QueryInterface(event, &IID_IDOMMessageEvent, (void**)&msg_event); + ok(hres == S_OK, "Could not get IDOMMessageEvent iface: %08lx\n", hres); + ok(msg_event != NULL, "msg_event = NULL\n"); + IDOMEvent_Release(event); + + hres = IDOMMessageEvent_get_source(msg_event, &source); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + ok(source == NULL, "uninitialized source != NULL\n"); + + hres = IDOMMessageEvent_get_origin(msg_event, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!bstr, "uninitialized origin = %s\n", wine_dbgstr_w(bstr)); + + /* IE10+ crash when using the get_data from the interface (because it's not a string yet?) */ + if(document_mode < 10) { + hres = IDOMMessageEvent_get_data(msg_event, &bstr); + ok(hres == S_OK, "get_data failed: %08lx\n", hres); + ok(!wcscmp(bstr, L""), "uninitialized data = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + bstr = SysAllocString(L"foobar"); + hres = IDOMMessageEvent_initMessageEvent(msg_event, bstr, VARIANT_FALSE, VARIANT_FALSE, bstr, bstr, NULL, window); + ok(hres == S_OK, "initMessageEvent failed: %08lx\n", hres); + SysFreeString(bstr); + + hres = IDOMMessageEvent_get_data(msg_event, &bstr); + ok(hres == S_OK, "get_data failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "data = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + hres = IDOMMessageEvent_get_source(msg_event, &source); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + ok(source == window, "source != window\n"); + IHTMLWindow2_Release(source); + + hres = IDOMMessageEvent_get_origin(msg_event, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "origin = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + bstr = SysAllocString(L"barfoo"); + hres = IDOMMessageEvent_initMessageEvent(msg_event, bstr, VARIANT_FALSE, VARIANT_FALSE, NULL, NULL, NULL, NULL); + ok(hres == S_OK, "initMessageEvent failed: %08lx\n", hres); + SysFreeString(bstr); + + hres = IDOMMessageEvent_get_data(msg_event, &bstr); + ok(hres == S_OK, "get_data failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "data = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + hres = IDOMMessageEvent_get_source(msg_event, &source); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + ok(source == NULL, "source != NULL\n"); + + hres = IDOMMessageEvent_get_origin(msg_event, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "origin = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + }else { + bstr = SysAllocString(L"data"); + hres = IDOMMessageEvent_GetIDsOfNames(msg_event, &IID_NULL, &bstr, 1, 0, &dispid); + ok(hres == S_OK, "GetIDsOfNames(data) failed: %08lx\n", hres); + SysFreeString(bstr); + + dp.cArgs = 0; + dp.rgvarg = NULL; + hres = IDOMMessageEvent_Invoke(msg_event, dispid, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &v[0], NULL, &argerr); + ok(hres == S_OK, "Invoke(data) failed: %08lx\n", hres); + ok(V_VT(&v[0]) == VT_EMPTY, "V_VT(uninitialized data) = %d\n", V_VT(&v[0])); + + bstr = SysAllocString(L"foobar"); + hres = IDOMMessageEvent_initMessageEvent(msg_event, bstr, VARIANT_FALSE, VARIANT_FALSE, bstr, bstr, NULL, window); + ok(hres == S_OK, "initMessageEvent failed: %08lx\n", hres); + SysFreeString(bstr); + + hres = IDOMMessageEvent_Invoke(msg_event, dispid, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &v[0], NULL, &argerr); + ok(hres == S_OK, "Invoke(data) failed: %08lx\n", hres); + ok(V_VT(&v[0]) == VT_BSTR, "V_VT(data) = %d\n", V_VT(&v[0])); + ok(!wcscmp(V_BSTR(&v[0]), L"foobar"), "V_BSTR(data) = %s\n", wine_dbgstr_w(V_BSTR(&v[0]))); + VariantClear(&v[0]); + + hres = IDOMMessageEvent_get_source(msg_event, &source); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + ok(source == window, "source != window\n"); + IHTMLWindow2_Release(source); + + hres = IDOMMessageEvent_get_origin(msg_event, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "origin = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + bstr = SysAllocString(L"barfoo"); + hres = IDOMMessageEvent_initMessageEvent(msg_event, bstr, VARIANT_FALSE, VARIANT_FALSE, NULL, NULL, NULL, NULL); + ok(hres == S_OK, "initMessageEvent failed: %08lx\n", hres); + SysFreeString(bstr); + + hres = IDOMMessageEvent_Invoke(msg_event, dispid, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &v[0], NULL, &argerr); + ok(hres == S_OK, "Invoke(data) failed: %08lx\n", hres); + ok(V_VT(&v[0]) == VT_BSTR, "V_VT(data) = %d\n", V_VT(&v[0])); + ok(!wcscmp(V_BSTR(&v[0]), L"foobar"), "V_BSTR(data) = %s\n", wine_dbgstr_w(V_BSTR(&v[0]))); + + hres = IDOMMessageEvent_get_source(msg_event, &source); + ok(hres == S_OK, "get_source failed: %08lx\n", hres); + ok(source == NULL, "source != NULL\n"); + + hres = IDOMMessageEvent_get_origin(msg_event, &bstr); + ok(hres == S_OK, "get_origin failed: %08lx\n", hres); + ok(!wcscmp(bstr, L"foobar"), "origin = %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + } + + IDOMMessageEvent_Release(msg_event); + } } static void test_visibilitychange(IHTMLDocument2 *doc) diff --git a/dlls/mshtml/tests/events.js b/dlls/mshtml/tests/events.js index a130917cfda..9282d48bacc 100644 --- a/dlls/mshtml/tests/events.js +++ b/dlls/mshtml/tests/events.js @@ -835,6 +835,7 @@ async_test("message event", function() { return; } listener_called = true; + e.initMessageEvent("blah", true, true, "barfoo", "wine", 1234, window); ok(e.data === "test", "e.data = " + e.data); ok(e.bubbles === false, "bubbles = " + e.bubbles); ok(e.cancelable === false, "cancelable = " + e.cancelable); From ff979e670f1304e4f655c3d1ab41192a39a0960a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0921/1506] mshtml: Expose the IHTMLEventObj5 props to scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's mostly implemented, and issession isn't even exposed. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 1 + dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/events.html | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 1f90248238e..28af7f4ed51 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -2064,6 +2064,7 @@ static const dispex_static_data_vtbl_t HTMLEventObj_dispex_vtbl = { }; static const tid_t HTMLEventObj_iface_tids[] = { + IHTMLEventObj5_tid, IHTMLEventObj_tid, 0 }; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ff735ca49da..2f61f4558c0 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -208,6 +208,7 @@ typedef struct EventTarget EventTarget; XIID(IHTMLElementCollection) \ XIID(IHTMLEmbedElement) \ XIID(IHTMLEventObj) \ + XIID(IHTMLEventObj5) \ XIID(IHTMLFiltersCollection) \ XIID(IHTMLFormElement) \ XIID(IHTMLFrameBase) \ diff --git a/dlls/mshtml/tests/events.html b/dlls/mshtml/tests/events.html index 6f9b3dacbbc..76473277e3c 100644 --- a/dlls/mshtml/tests/events.html +++ b/dlls/mshtml/tests/events.html @@ -284,7 +284,12 @@ } function test_event_obj_props(e) { - var i, props; + var i, props = [ + "altKey", "button", "cancelBubble", "clientX", "clientY", "ctrlKey", "data", "fromElement", "keyCode", "offsetX", "offsetY", + "origin", "qualifier", "reason", "returnValue", "screenX", "screenY", "shiftKey", "source", "srcElement", "srcFilter", + "toElement", "type", "url", "x", "y" ]; + for(i = 0; i < props.length; i++) + ok(props[i] in e, props[i] + " not in event obj"); props = [ "imeCompositionChange", "imeNotifyCommand", "imeNotifyData", "imeRequest", "imeRequestData", "issession", "keyboardLayout" ]; for(i = 0; i < props.length; i++) From 3067912847bd48a1670f3c3faf644ed0c17f2d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0922/1506] jscript: Add initial implementation of ArrayBuffer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/Makefile.in | 1 + dlls/jscript/arraybuf.c | 190 +++++++++++++++++++++++++++++++++++++++ dlls/jscript/global.c | 4 + dlls/jscript/jscript.h | 5 +- dlls/jscript/object.c | 1 + dlls/mshtml/tests/es5.js | 48 ++++++++++ 6 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 dlls/jscript/arraybuf.c diff --git a/dlls/jscript/Makefile.in b/dlls/jscript/Makefile.in index c37b0dd69f3..86d9035800e 100644 --- a/dlls/jscript/Makefile.in +++ b/dlls/jscript/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = oleaut32 ole32 user32 advapi32 SOURCES = \ activex.c \ array.c \ + arraybuf.c \ bool.c \ cc_parser.y \ compile.c \ diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c new file mode 100644 index 00000000000..4f2eeff66e8 --- /dev/null +++ b/dlls/jscript/arraybuf.c @@ -0,0 +1,190 @@ +/* + * Copyright 2023 Gabriel Ivăncescu for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#include + +#include "jscript.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + +typedef struct { + jsdisp_t dispex; + DWORD size; + DECLSPEC_ALIGN(sizeof(double)) BYTE buf[]; +} ArrayBufferInstance; + +static inline ArrayBufferInstance *arraybuf_from_jsdisp(jsdisp_t *jsdisp) +{ + return CONTAINING_RECORD(jsdisp, ArrayBufferInstance, dispex); +} + +static HRESULT ArrayBuffer_get_byteLength(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + TRACE("%p\n", jsthis); + + *r = jsval_number(arraybuf_from_jsdisp(jsthis)->size); + return S_OK; +} + +static HRESULT ArrayBuffer_slice(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + FIXME("not implemented\n"); + + return E_NOTIMPL; +} + +static const builtin_prop_t ArrayBuffer_props[] = { + {L"byteLength", NULL, 0, ArrayBuffer_get_byteLength}, + {L"slice", ArrayBuffer_slice, PROPF_METHOD|2}, +}; + +static const builtin_info_t ArrayBuffer_info = { + JSCLASS_ARRAYBUFFER, + NULL, + ARRAY_SIZE(ArrayBuffer_props), + ArrayBuffer_props, + NULL, + NULL +}; + +static const builtin_prop_t ArrayBufferInst_props[] = { + {L"byteLength", NULL, 0, ArrayBuffer_get_byteLength}, +}; + +static const builtin_info_t ArrayBufferInst_info = { + JSCLASS_ARRAYBUFFER, + NULL, + ARRAY_SIZE(ArrayBufferInst_props), + ArrayBufferInst_props, + NULL, + NULL +}; + +static HRESULT create_arraybuf(script_ctx_t *ctx, DWORD size, jsdisp_t **ret) +{ + ArrayBufferInstance *arraybuf; + HRESULT hres; + + if(!(arraybuf = calloc(1, FIELD_OFFSET(ArrayBufferInstance, buf[size])))) + return E_OUTOFMEMORY; + + hres = init_dispex_from_constr(&arraybuf->dispex, ctx, &ArrayBufferInst_info, ctx->arraybuf_constr); + if(FAILED(hres)) { + free(arraybuf); + return hres; + } + + arraybuf->size = size; + + *ret = &arraybuf->dispex; + return S_OK; +} + +static HRESULT ArrayBufferConstr_isView(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + FIXME("not implemented\n"); + + return E_NOTIMPL; +} + +static HRESULT ArrayBufferConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + DWORD size = 0; + jsdisp_t *obj; + HRESULT hres; + + TRACE("\n"); + + switch(flags) { + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: { + if(argc) { + double n; + hres = to_integer(ctx, argv[0], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0) + return JS_E_INVALID_LENGTH; + if(n > (UINT_MAX - FIELD_OFFSET(ArrayBufferInstance, buf[0]))) + return E_OUTOFMEMORY; + size = n; + } + + if(r) { + hres = create_arraybuf(ctx, size, &obj); + if(FAILED(hres)) + return hres; + *r = jsval_obj(obj); + } + break; + } + default: + FIXME("unimplemented flags: %x\n", flags); + return E_NOTIMPL; + } + + return S_OK; +} + +static const builtin_prop_t ArrayBufferConstr_props[] = { + {L"isView", ArrayBufferConstr_isView, PROPF_METHOD|1}, +}; + +static const builtin_info_t ArrayBufferConstr_info = { + JSCLASS_FUNCTION, + Function_value, + ARRAY_SIZE(ArrayBufferConstr_props), + ArrayBufferConstr_props, + NULL, + NULL +}; + +HRESULT init_arraybuf_constructors(script_ctx_t *ctx) +{ + ArrayBufferInstance *arraybuf; + HRESULT hres; + + if(ctx->version < SCRIPTLANGUAGEVERSION_ES5) + return S_OK; + + if(!(arraybuf = calloc(1, FIELD_OFFSET(ArrayBufferInstance, buf[0])))) + return E_OUTOFMEMORY; + + hres = init_dispex(&arraybuf->dispex, ctx, &ArrayBuffer_info, ctx->object_prototype); + if(FAILED(hres)) { + free(arraybuf); + return hres; + } + + hres = create_builtin_constructor(ctx, ArrayBufferConstr_value, L"ArrayBuffer", &ArrayBufferConstr_info, + PROPF_CONSTR|1, &arraybuf->dispex, &ctx->arraybuf_constr); + jsdisp_release(&arraybuf->dispex); + if(FAILED(hres)) + return hres; + + hres = jsdisp_define_data_property(ctx->global, L"ArrayBuffer", PROPF_CONFIGURABLE | PROPF_WRITABLE, + jsval_obj(ctx->arraybuf_constr)); + + return hres; +} diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index 997b2542a9e..cc108b84e4b 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -1148,5 +1148,9 @@ HRESULT init_global(script_ctx_t *ctx) if(FAILED(hres)) return hres; + hres = init_arraybuf_constructors(ctx); + if(FAILED(hres)) + return hres; + return init_set_constructor(ctx); } diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index b62d577a45b..dd7aa4dddcc 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -116,6 +116,7 @@ typedef enum { JSCLASS_ARGUMENTS, JSCLASS_VBARRAY, JSCLASS_JSON, + JSCLASS_ARRAYBUFFER, JSCLASS_MAP, JSCLASS_SET, JSCLASS_WEAKMAP, @@ -435,11 +436,12 @@ struct _script_ctx_t { jsdisp_t *regexp_constr; jsdisp_t *string_constr; jsdisp_t *vbarray_constr; + jsdisp_t *arraybuf_constr; jsdisp_t *map_prototype; jsdisp_t *set_prototype; jsdisp_t *weakmap_prototype; }; - jsdisp_t *global_objects[23]; + jsdisp_t *global_objects[24]; }; }; C_ASSERT(RTL_SIZEOF_THROUGH_FIELD(script_ctx_t, weakmap_prototype) == RTL_SIZEOF_THROUGH_FIELD(script_ctx_t, global_objects)); @@ -464,6 +466,7 @@ HRESULT init_global(script_ctx_t*); HRESULT init_function_constr(script_ctx_t*,jsdisp_t*); HRESULT create_object_prototype(script_ctx_t*,jsdisp_t**); HRESULT init_set_constructor(script_ctx_t*); +HRESULT init_arraybuf_constructors(script_ctx_t*); HRESULT create_activex_constr(script_ctx_t*,jsdisp_t**); HRESULT create_array_constr(script_ctx_t*,jsdisp_t*,jsdisp_t**); diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 65b25cab239..cba35927378 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -50,6 +50,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns L"[object Object]", L"[object Object]", L"[object Object]", + L"[object ArrayBuffer]", L"[object Object]", L"[object Object]", L"[object Object]" diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index b6ce7be3c54..b9d9b0d03d6 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -28,6 +28,7 @@ var JS_E_VBARRAY_EXPECTED = 0x800a1395; var JS_E_ENUMERATOR_EXPECTED = 0x800a1397; var JS_E_REGEXP_EXPECTED = 0x800a1398; var JS_E_UNEXPECTED_QUANTIFIER = 0x800a139a; +var JS_E_INVALID_LENGTH = 0x800a13a5; var JS_E_INVALID_WRITABLE_PROP_DESC = 0x800a13ac; var JS_E_NONCONFIGURABLE_REDEFINED = 0x800a13d6; var JS_E_NONWRITABLE_MODIFIED = 0x800a13d7; @@ -1681,6 +1682,53 @@ sync_test("RegExp", function() { } }); +sync_test("ArrayBuffers & Views", function() { + var r, buf; + + function test_own_props(obj_name, props) { + var obj = eval(obj_name); + for(var i = 0; i < props.length; i++) + ok(Object.prototype.hasOwnProperty.call(obj, props[i]), props[i] + " not a property of " + obj_name); + } + + function test_readonly(obj, prop, val) { + var name = Object.getPrototypeOf(obj).constructor.toString(); + name = name.substring(9, name.indexOf("(", 9)) + ".prototype." + prop; + obj[prop] = val + 42; + ok(obj[prop] === val, name + " not read-only"); + } + + test_own_props("ArrayBuffer", [ "isView" ]); + test_own_props("ArrayBuffer.prototype", [ "byteLength", "slice" ]); + test_own_data_prop_desc(ArrayBuffer.prototype, "byteLength", false, false, false); + + r = Object.prototype.toString.call(new ArrayBuffer()); + ok(r === "[object ArrayBuffer]", "Object toString(new ArrayBuffer()) = " + r); + r = ArrayBuffer.length; + ok(r === 1, "ArrayBuffer.length = " + r); + r = ArrayBuffer.isView.length; + ok(r === 1, "ArrayBuffer.isView.length = " + r); + r = ArrayBuffer.prototype.slice.length; + ok(r === 2, "ArrayBuffer.prototype.slice.length = " + r); + + try { + new ArrayBuffer(-1); + ok(false, "new ArrayBuffer(-1) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_INVALID_LENGTH, "new ArrayBuffer(-1) threw " + n); + } + + buf = new ArrayBuffer(); + ok(buf.byteLength === 0, "ArrayBuffer().byteLength = " + buf.byteLength); + buf = new ArrayBuffer(13.1); + ok(buf.byteLength === 13, "ArrayBuffer(13).byteLength = " + buf.byteLength); + buf = ArrayBuffer("10"); + ok(buf.byteLength === 10, "ArrayBuffer(10).byteLength = " + buf.byteLength); + test_readonly(buf, "byteLength", 10); + test_own_data_prop_desc(buf, "byteLength", false, false, false); +}); + sync_test("builtin_context", function() { var nullDisp = external.nullDisp; var tests = [ From f000bd0710da8ec179ccd5e0d3dc455eae6a876b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0923/1506] jscript: Implement DataView. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 570 +++++++++++++++++++++++++++++++++++++++ dlls/jscript/error.c | 4 + dlls/jscript/jscript.h | 8 +- dlls/jscript/jscript.rc | 4 + dlls/jscript/object.c | 1 + dlls/jscript/resource.h | 4 + dlls/mshtml/tests/es5.js | 262 +++++++++++++++++- 7 files changed, 851 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index 4f2eeff66e8..c8a024346b9 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -31,11 +31,30 @@ typedef struct { DECLSPEC_ALIGN(sizeof(double)) BYTE buf[]; } ArrayBufferInstance; +typedef struct { + jsdisp_t dispex; + + jsdisp_t *buffer; + DWORD offset; + DWORD size; +} DataViewInstance; + static inline ArrayBufferInstance *arraybuf_from_jsdisp(jsdisp_t *jsdisp) { return CONTAINING_RECORD(jsdisp, ArrayBufferInstance, dispex); } +static inline DataViewInstance *dataview_from_jsdisp(jsdisp_t *jsdisp) +{ + return CONTAINING_RECORD(jsdisp, DataViewInstance, dispex); +} + +static inline ArrayBufferInstance *arraybuf_this(jsval_t vthis) +{ + jsdisp_t *jsdisp = is_object_instance(vthis) ? to_jsdisp(get_object(vthis)) : NULL; + return (jsdisp && is_class(jsdisp, JSCLASS_ARRAYBUFFER)) ? arraybuf_from_jsdisp(jsdisp) : NULL; +} + static HRESULT ArrayBuffer_get_byteLength(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { TRACE("%p\n", jsthis); @@ -160,10 +179,516 @@ static const builtin_info_t ArrayBufferConstr_info = { NULL }; +static inline DataViewInstance *dataview_this(jsval_t vthis) +{ + jsdisp_t *jsdisp = is_object_instance(vthis) ? to_jsdisp(get_object(vthis)) : NULL; + return (jsdisp && is_class(jsdisp, JSCLASS_DATAVIEW)) ? dataview_from_jsdisp(jsdisp) : NULL; +} + +static HRESULT DataView_get_buffer(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + DataViewInstance *view; + + TRACE("\n"); + + if(!(view = dataview_this(vthis))) + return JS_E_NOT_DATAVIEW; + if(r) *r = jsval_obj(jsdisp_addref(view->buffer)); + return S_OK; +} + +static HRESULT DataView_get_byteLength(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + DataViewInstance *view; + + TRACE("\n"); + + if(!(view = dataview_this(vthis))) + return JS_E_NOT_DATAVIEW; + if(r) *r = jsval_number(view->size); + return S_OK; +} + +static HRESULT DataView_get_byteOffset(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + DataViewInstance *view; + + TRACE("\n"); + + if(!(view = dataview_this(vthis))) + return JS_E_NOT_DATAVIEW; + if(r) *r = jsval_number(view->offset); + return S_OK; +} + +static inline void copy_type_data(void *dst, const void *src, unsigned type_size, BOOL little_endian) +{ +#ifdef WORDS_BIGENDIAN + BOOL swap = little_endian; +#else + BOOL swap = !little_endian; +#endif + const BYTE *in = src; + BYTE *out = dst; + unsigned i; + + if(swap) + for(i = 0; i < type_size; i++) + out[i] = in[type_size - i - 1]; + else + memcpy(out, in, type_size); +} + +static HRESULT get_data(script_ctx_t *ctx, jsval_t vthis, unsigned argc, jsval_t *argv, unsigned type_size, void *ret) +{ + BOOL little_endian = FALSE; + DataViewInstance *view; + HRESULT hres; + DWORD offset; + BYTE *data; + double n; + + if(!(view = dataview_this(vthis))) + return JS_E_NOT_DATAVIEW; + if(!argc || is_undefined(argv[0])) + return JS_E_DATAVIEW_NO_ARGUMENT; + + hres = to_integer(ctx, argv[0], &n); + if(FAILED(hres)) + return hres; + + if(n < 0.0 || n >= view->size) + return JS_E_DATAVIEW_INVALID_ACCESS; + + offset = n; + if(view->size - offset < type_size) + return JS_E_DATAVIEW_INVALID_ACCESS; + data = &arraybuf_from_jsdisp(view->buffer)->buf[view->offset + offset]; + + if(type_size == 1) { + *(BYTE*)ret = data[0]; + return S_OK; + } + + if(argc > 1) { + hres = to_boolean(argv[1], &little_endian); + if(FAILED(hres)) + return hres; + } + + copy_type_data(ret, data, type_size, little_endian); + return S_OK; +} + +static HRESULT set_data(script_ctx_t *ctx, jsval_t vthis, unsigned argc, jsval_t *argv, unsigned type_size, const void *val) +{ + BOOL little_endian = FALSE; + DataViewInstance *view; + HRESULT hres; + DWORD offset; + BYTE *data; + double n; + + if(!(view = dataview_this(vthis))) + return JS_E_NOT_DATAVIEW; + if(is_undefined(argv[0]) || is_undefined(argv[1])) + return JS_E_DATAVIEW_NO_ARGUMENT; + + hres = to_integer(ctx, argv[0], &n); + if(FAILED(hres)) + return hres; + + if(n < 0.0 || n >= view->size) + return JS_E_DATAVIEW_INVALID_ACCESS; + + offset = n; + if(view->size - offset < type_size) + return JS_E_DATAVIEW_INVALID_ACCESS; + data = &arraybuf_from_jsdisp(view->buffer)->buf[view->offset + offset]; + + if(type_size == 1) { + data[0] = *(const BYTE*)val; + return S_OK; + } + + if(argc > 2) { + hres = to_boolean(argv[2], &little_endian); + if(FAILED(hres)) + return hres; + } + + copy_type_data(data, val, type_size, little_endian); + return S_OK; +} + +static HRESULT DataView_getFloat32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + float v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getFloat64(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + double v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getInt8(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + INT8 v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getInt16(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + INT16 v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getInt32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + INT32 v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getUint8(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + UINT8 v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getUint16(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + UINT16 v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_getUint32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + UINT32 v; + + TRACE("\n"); + + hres = get_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_number(v); + return S_OK; +} + +static HRESULT DataView_setFloat32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + double n; + float v; + + TRACE("\n"); + + if(argc < 2) + return JS_E_DATAVIEW_NO_ARGUMENT; + hres = to_number(ctx, argv[1], &n); + if(FAILED(hres)) + return hres; + v = n; /* FIXME: don't assume rounding mode is round-to-nearest ties-to-even */ + + hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_undefined(); + return S_OK; +} + +static HRESULT DataView_setFloat64(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + double v; + + TRACE("\n"); + + if(argc < 2) + return JS_E_DATAVIEW_NO_ARGUMENT; + hres = to_number(ctx, argv[1], &v); + if(FAILED(hres)) + return hres; + + hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_undefined(); + return S_OK; +} + +static HRESULT DataView_setInt8(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + INT32 n; + INT8 v; + + TRACE("\n"); + + if(argc < 2) + return JS_E_DATAVIEW_NO_ARGUMENT; + hres = to_int32(ctx, argv[1], &n); + if(FAILED(hres)) + return hres; + v = n; + + hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_undefined(); + return S_OK; +} + +static HRESULT DataView_setInt16(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + INT32 n; + INT16 v; + + TRACE("\n"); + + if(argc < 2) + return JS_E_DATAVIEW_NO_ARGUMENT; + hres = to_int32(ctx, argv[1], &n); + if(FAILED(hres)) + return hres; + v = n; + + hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_undefined(); + return S_OK; +} + +static HRESULT DataView_setInt32(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + HRESULT hres; + INT32 v; + + TRACE("\n"); + + if(argc < 2) + return JS_E_DATAVIEW_NO_ARGUMENT; + hres = to_int32(ctx, argv[1], &v); + if(FAILED(hres)) + return hres; + + hres = set_data(ctx, vthis, argc, argv, sizeof(v), &v); + if(FAILED(hres)) + return hres; + if(r) *r = jsval_undefined(); + return S_OK; +} + +static const builtin_prop_t DataView_props[] = { + {L"getFloat32", DataView_getFloat32, PROPF_METHOD|1}, + {L"getFloat64", DataView_getFloat64, PROPF_METHOD|1}, + {L"getInt16", DataView_getInt16, PROPF_METHOD|1}, + {L"getInt32", DataView_getInt32, PROPF_METHOD|1}, + {L"getInt8", DataView_getInt8, PROPF_METHOD|1}, + {L"getUint16", DataView_getUint16, PROPF_METHOD|1}, + {L"getUint32", DataView_getUint32, PROPF_METHOD|1}, + {L"getUint8", DataView_getUint8, PROPF_METHOD|1}, + {L"setFloat32", DataView_setFloat32, PROPF_METHOD|1}, + {L"setFloat64", DataView_setFloat64, PROPF_METHOD|1}, + {L"setInt16", DataView_setInt16, PROPF_METHOD|1}, + {L"setInt32", DataView_setInt32, PROPF_METHOD|1}, + {L"setInt8", DataView_setInt8, PROPF_METHOD|1}, + {L"setUint16", DataView_setInt16, PROPF_METHOD|1}, + {L"setUint32", DataView_setInt32, PROPF_METHOD|1}, + {L"setUint8", DataView_setInt8, PROPF_METHOD|1}, +}; + +static void DataView_destructor(jsdisp_t *dispex) +{ + DataViewInstance *view = dataview_from_jsdisp(dispex); + if(view->buffer) + jsdisp_release(view->buffer); + free(view); +} + +static HRESULT DataView_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsdisp_t *dispex) +{ + DataViewInstance *view = dataview_from_jsdisp(dispex); + return gc_process_linked_obj(gc_ctx, op, dispex, view->buffer, (void**)&view->buffer); +} + +static const builtin_info_t DataView_info = { + JSCLASS_DATAVIEW, + NULL, + ARRAY_SIZE(DataView_props), + DataView_props, + DataView_destructor, + NULL, + NULL, + NULL, + NULL, + DataView_gc_traverse +}; + +static const builtin_info_t DataViewInst_info = { + JSCLASS_DATAVIEW, + NULL, + 0, + NULL, + DataView_destructor, + NULL, + NULL, + NULL, + NULL, + DataView_gc_traverse +}; + +static HRESULT DataViewConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + ArrayBufferInstance *arraybuf; + DataViewInstance *view; + DWORD offset = 0, size; + HRESULT hres; + + TRACE("\n"); + + switch(flags) { + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: { + if(!argc || !(arraybuf = arraybuf_this(argv[0]))) + return JS_E_DATAVIEW_NO_ARGUMENT; + size = arraybuf->size; + + if(argc > 1) { + double offs, len, maxsize = size; + hres = to_integer(ctx, argv[1], &offs); + if(FAILED(hres)) + return hres; + if(offs < 0.0 || offs > maxsize) + return JS_E_DATAVIEW_INVALID_OFFSET; + offset = offs; + + if(argc > 2 && !is_undefined(argv[2])) { + hres = to_integer(ctx, argv[2], &len); + if(FAILED(hres)) + return hres; + if(len < 0.0 || offs+len > maxsize) + return JS_E_DATAVIEW_INVALID_OFFSET; + size = len; + }else + size -= offset; + } + + if(!r) + return S_OK; + + if(!(view = calloc(1, sizeof(DataViewInstance)))) + return E_OUTOFMEMORY; + + hres = init_dispex_from_constr(&view->dispex, ctx, &DataViewInst_info, ctx->dataview_constr); + if(FAILED(hres)) { + free(view); + return hres; + } + + view->buffer = jsdisp_addref(&arraybuf->dispex); + view->offset = offset; + view->size = size; + + *r = jsval_obj(&view->dispex); + break; + } + default: + FIXME("unimplemented flags: %x\n", flags); + return E_NOTIMPL; + } + + return S_OK; +} + +static const builtin_info_t DataViewConstr_info = { + JSCLASS_FUNCTION, + Function_value, + 0, + NULL, + NULL, + NULL +}; + HRESULT init_arraybuf_constructors(script_ctx_t *ctx) { + static const struct { + const WCHAR *name; + builtin_invoke_t get; + } DataView_getters[] = { + { L"buffer", DataView_get_buffer }, + { L"byteLength", DataView_get_byteLength }, + { L"byteOffset", DataView_get_byteOffset }, + }; ArrayBufferInstance *arraybuf; + DataViewInstance *view; + property_desc_t desc; HRESULT hres; + unsigned i; if(ctx->version < SCRIPTLANGUAGEVERSION_ES5) return S_OK; @@ -185,6 +710,51 @@ HRESULT init_arraybuf_constructors(script_ctx_t *ctx) hres = jsdisp_define_data_property(ctx->global, L"ArrayBuffer", PROPF_CONFIGURABLE | PROPF_WRITABLE, jsval_obj(ctx->arraybuf_constr)); + if(FAILED(hres)) + return hres; + + if(!(view = calloc(1, sizeof(DataViewInstance)))) + return E_OUTOFMEMORY; + + hres = create_arraybuf(ctx, 0, &view->buffer); + if(FAILED(hres)) { + free(view); + return hres; + } + + hres = init_dispex(&view->dispex, ctx, &DataView_info, ctx->object_prototype); + if(FAILED(hres)) { + jsdisp_release(view->buffer); + free(view); + return hres; + } + + desc.flags = PROPF_CONFIGURABLE; + desc.mask = PROPF_CONFIGURABLE | PROPF_ENUMERABLE; + desc.explicit_getter = desc.explicit_setter = TRUE; + desc.explicit_value = FALSE; + desc.setter = NULL; + + for(i = 0; i < ARRAY_SIZE(DataView_getters); i++) { + hres = create_builtin_function(ctx, DataView_getters[i].get, NULL, NULL, PROPF_METHOD, NULL, &desc.getter); + if(SUCCEEDED(hres)) { + hres = jsdisp_define_property(&view->dispex, DataView_getters[i].name, &desc); + jsdisp_release(desc.getter); + } + if(FAILED(hres)) { + jsdisp_release(&view->dispex); + return hres; + } + } + + hres = create_builtin_constructor(ctx, DataViewConstr_value, L"DataView", &DataViewConstr_info, + PROPF_CONSTR|1, &view->dispex, &ctx->dataview_constr); + jsdisp_release(&view->dispex); + if(FAILED(hres)) + return hres; + + hres = jsdisp_define_data_property(ctx->global, L"DataView", PROPF_CONFIGURABLE | PROPF_WRITABLE, + jsval_obj(ctx->dataview_constr)); return hres; } diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index f6eda62b88d..60d090ec76e 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -483,6 +483,8 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_OBJECT_NONEXTENSIBLE: case JS_E_NONCONFIGURABLE_REDEFINED: case JS_E_NONWRITABLE_MODIFIED: + case JS_E_NOT_DATAVIEW: + case JS_E_DATAVIEW_NO_ARGUMENT: case JS_E_WRONG_THIS: case JS_E_KEY_NOT_OBJECT: case JS_E_PROP_DESC_MISMATCH: @@ -494,6 +496,8 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_FRACTION_DIGITS_OUT_OF_RANGE: case JS_E_PRECISION_OUT_OF_RANGE: case JS_E_INVALID_LENGTH: + case JS_E_DATAVIEW_INVALID_ACCESS: + case JS_E_DATAVIEW_INVALID_OFFSET: constr = ctx->range_error_constr; break; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index dd7aa4dddcc..07e0c4693be 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -117,6 +117,7 @@ typedef enum { JSCLASS_VBARRAY, JSCLASS_JSON, JSCLASS_ARRAYBUFFER, + JSCLASS_DATAVIEW, JSCLASS_MAP, JSCLASS_SET, JSCLASS_WEAKMAP, @@ -437,11 +438,12 @@ struct _script_ctx_t { jsdisp_t *string_constr; jsdisp_t *vbarray_constr; jsdisp_t *arraybuf_constr; + jsdisp_t *dataview_constr; jsdisp_t *map_prototype; jsdisp_t *set_prototype; jsdisp_t *weakmap_prototype; }; - jsdisp_t *global_objects[24]; + jsdisp_t *global_objects[25]; }; }; C_ASSERT(RTL_SIZEOF_THROUGH_FIELD(script_ctx_t, weakmap_prototype) == RTL_SIZEOF_THROUGH_FIELD(script_ctx_t, global_objects)); @@ -579,6 +581,10 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_OBJECT_NONEXTENSIBLE MAKE_JSERROR(IDS_OBJECT_NONEXTENSIBLE) #define JS_E_NONCONFIGURABLE_REDEFINED MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED) #define JS_E_NONWRITABLE_MODIFIED MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED) +#define JS_E_NOT_DATAVIEW MAKE_JSERROR(IDS_NOT_DATAVIEW) +#define JS_E_DATAVIEW_NO_ARGUMENT MAKE_JSERROR(IDS_DATAVIEW_NO_ARGUMENT) +#define JS_E_DATAVIEW_INVALID_ACCESS MAKE_JSERROR(IDS_DATAVIEW_INVALID_ACCESS) +#define JS_E_DATAVIEW_INVALID_OFFSET MAKE_JSERROR(IDS_DATAVIEW_INVALID_OFFSET) #define JS_E_WRONG_THIS MAKE_JSERROR(IDS_WRONG_THIS) #define JS_E_KEY_NOT_OBJECT MAKE_JSERROR(IDS_KEY_NOT_OBJECT) #define JS_E_PROP_DESC_MISMATCH MAKE_JSERROR(IDS_PROP_DESC_MISMATCH) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index e5289a550a3..1cfc9040f51 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -76,6 +76,10 @@ STRINGTABLE IDS_OBJECT_NONEXTENSIBLE "Cannot define property '|': object is not extensible" IDS_NONCONFIGURABLE_REDEFINED "Cannot redefine non-configurable property '|'" IDS_NONWRITABLE_MODIFIED "Cannot modify non-writable property '|'" + IDS_NOT_DATAVIEW "'this' is not a DataView object" + IDS_DATAVIEW_NO_ARGUMENT "Required argument offset or value in DataView method is not specified" + IDS_DATAVIEW_INVALID_ACCESS "DataView operation access beyond specified buffer length" + IDS_DATAVIEW_INVALID_OFFSET "DataView constructor argument offset is invalid" IDS_WRONG_THIS "'this' is not a | object" IDS_KEY_NOT_OBJECT "'key' is not an object" IDS_PROP_DESC_MISMATCH "Property cannot have both accessors and a value" diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index cba35927378..16ecc3dea3c 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -53,6 +53,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns L"[object ArrayBuffer]", L"[object Object]", L"[object Object]", + L"[object Object]", L"[object Object]" }; diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index ad771b67475..e2b60b98bd5 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -74,6 +74,10 @@ #define IDS_OBJECT_NONEXTENSIBLE 0x13D5 #define IDS_NONCONFIGURABLE_REDEFINED 0x13D6 #define IDS_NONWRITABLE_MODIFIED 0x13D7 +#define IDS_NOT_DATAVIEW 0x13DF +#define IDS_DATAVIEW_NO_ARGUMENT 0x13E0 +#define IDS_DATAVIEW_INVALID_ACCESS 0x13E1 +#define IDS_DATAVIEW_INVALID_OFFSET 0x13E2 #define IDS_WRONG_THIS 0x13FC #define IDS_KEY_NOT_OBJECT 0x13FD /* FIXME: This is not compatible with native, but we would diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index b9d9b0d03d6..a18fea6476a 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -32,6 +32,10 @@ var JS_E_INVALID_LENGTH = 0x800a13a5; var JS_E_INVALID_WRITABLE_PROP_DESC = 0x800a13ac; var JS_E_NONCONFIGURABLE_REDEFINED = 0x800a13d6; var JS_E_NONWRITABLE_MODIFIED = 0x800a13d7; +var JS_E_NOT_DATAVIEW = 0x800a13df; +var JS_E_DATAVIEW_NO_ARGUMENT = 0x800a13e0; +var JS_E_DATAVIEW_INVALID_ACCESS = 0x800a13e1; +var JS_E_DATAVIEW_INVALID_OFFSET = 0x800a13e2; var JS_E_WRONG_THIS = 0x800a13fc; var tests = []; @@ -1683,7 +1687,18 @@ sync_test("RegExp", function() { }); sync_test("ArrayBuffers & Views", function() { - var r, buf; + var i, r, buf, view, view2, arr; + + var types = [ + [ "Int8", 1 ], + [ "Uint8", 1 ], + [ "Int16", 2 ], + [ "Uint16", 2 ], + [ "Int32", 4 ], + [ "Uint32", 4 ], + [ "Float32", 4 ], + [ "Float64", 8 ] + ]; function test_own_props(obj_name, props) { var obj = eval(obj_name); @@ -1691,6 +1706,12 @@ sync_test("ArrayBuffers & Views", function() { ok(Object.prototype.hasOwnProperty.call(obj, props[i]), props[i] + " not a property of " + obj_name); } + function test_not_own_props(obj_name, props) { + var obj = eval(obj_name); + for(var i = 0; i < props.length; i++) + ok(!Object.prototype.hasOwnProperty.call(obj, props[i]), props[i] + " is a property of " + obj_name); + } + function test_readonly(obj, prop, val) { var name = Object.getPrototypeOf(obj).constructor.toString(); name = name.substring(9, name.indexOf("(", 9)) + ".prototype." + prop; @@ -1727,6 +1748,245 @@ sync_test("ArrayBuffers & Views", function() { ok(buf.byteLength === 10, "ArrayBuffer(10).byteLength = " + buf.byteLength); test_readonly(buf, "byteLength", 10); test_own_data_prop_desc(buf, "byteLength", false, false, false); + + test_own_props("DataView.prototype", [ + "buffer", "byteLength", "byteOffset", + "getInt8", "setInt8", "getUint8", "setUint8", + "getInt16", "setInt16", "getUint16", "setUint16", + "getInt32", "setInt32", "getUint32", "setUint32", + "getFloat32", "setFloat32", "getFloat64", "setFloat64" + ]); + + r = Object.prototype.toString.call(new DataView(buf)); + ok(r === "[object Object]", "Object toString(new DataView(buf)) = " + r); + r = DataView.length; + ok(r === 1, "DataView.length = " + r); + + /* DataView.prototype has actual accessors, but others don't */ + arr = [ "buffer", "byteLength", "byteOffset" ]; + for(i = 0; i < arr.length; i++) { + var prop = arr[i], desc = Object.getOwnPropertyDescriptor(DataView.prototype, prop); + ok(!("value" in desc), "DataView: value is in desc"); + ok(!("writable" in desc), "DataView: writable is in desc"); + ok(desc.enumerable === false, "DataView: desc.enumerable = " + desc.enumerable); + ok(desc.configurable === true, "DataView: desc.configurable = " + desc.configurable); + ok(Object.getPrototypeOf(desc.get) === Function.prototype, "DataView: desc.get not a function: " + desc.get); + ok("set" in desc, "DataView: set is not in desc"); + ok(desc.set === undefined, "DataView: desc.set not undefined: " + desc.set); + try { + desc.get.call(null); + ok(false, "DataView: calling " + prop + " getter with null did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "DataView: calling " + prop + " getter with null threw " + n); + } + try { + desc.get.call({}); + ok(false, "DataView: calling " + prop + " getter with an object did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "DataView: calling " + prop + " getter with an object threw " + n); + } + try { + desc.get.call(DataView); + ok(false, "DataView: calling " + prop + " getter with DataView constructor did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "DataView: calling " + prop + " getter with DataView constructor threw " + n); + } + try { + desc.get.call(new ArrayBuffer()); + ok(false, "DataView: calling " + prop + " getter with ArrayBuffer did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "DataView: calling " + prop + " getter with ArrayBuffer threw " + n); + } + r = desc.get.call(DataView.prototype); + if(prop === "buffer") + ok(Object.getPrototypeOf(r) === ArrayBuffer.prototype, "DataView: calling " + prop + " getter with DataView.prototype returned " + r); + else + ok(r === 0, "DataView: calling " + prop + " getter with DataView.prototype returned " + r); + } + + try { + new DataView(); + ok(false, "new DataView() did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_NO_ARGUMENT, "new DataView() threw " + n); + } + try { + new DataView(ArrayBuffer); + ok(false, "new DataView(ArrayBuffer) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_NO_ARGUMENT, "new DataView(ArrayBuffer) threw " + n); + } + try { + new DataView(buf, -1); + ok(false, "new DataView(buf, -1) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_OFFSET, "new DataView(buf, -1) threw " + n); + } + try { + new DataView(buf, 11); + ok(false, "new DataView(buf, 11) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_OFFSET, "new DataView(buf, 11) threw " + n); + } + try { + new DataView(buf, 9, 2); + ok(false, "new DataView(buf, 9, 2) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_OFFSET, "new DataView(buf, 9, 2) threw " + n); + } + + view = new DataView(buf, 9, 1); + ok(view.buffer === buf, "DataView(buf, 9, 1).buffer = " + view.buffer); + ok(view.byteLength === 1, "DataView(buf, 9, 1).byteLength = " + view.byteLength); + ok(view.byteOffset === 9, "DataView(buf, 9, 1).byteOffset = " + view.byteOffset); + test_readonly(view, "byteLength", 1); + test_readonly(view, "byteOffset", 9); + test_not_own_props("view", [ "buffer", "byteLength", "byteOffset" ]); + + view = new DataView(buf, 10); + ok(view.buffer === buf, "DataView(buf, 10).buffer = " + view.buffer); + ok(view.byteLength === 0, "DataView(buf, 10).byteLength = " + view.byteLength); + ok(view.byteOffset === 10, "DataView(buf, 10).byteOffset = " + view.byteOffset); + view = new DataView(buf, 1, 7); + ok(view.buffer === buf, "DataView(buf, 1, 7).buffer = " + view.buffer); + ok(view.byteLength === 7, "DataView(buf, 1, 7).byteLength = " + view.byteLength); + ok(view.byteOffset === 1, "DataView(buf, 1, 7).byteOffset = " + view.byteOffset); + view2 = new DataView(buf, 6); + ok(view2.buffer === buf, "DataView(buf, 6).buffer = " + view2.buffer); + ok(view2.byteLength === 4, "DataView(buf, 6).byteLength = " + view2.byteLength); + ok(view2.byteOffset === 6, "DataView(buf, 6).byteOffset = " + view2.byteOffset); + view = DataView(buf); + ok(view.buffer === buf, "DataView(buf).buffer = " + view.buffer); + ok(view.byteLength === 10, "DataView(buf).byteLength = " + view.byteLength); + ok(view.byteOffset === 0, "DataView(buf).byteOffset = " + view.byteOffset); + + for(i = 0; i < 10; i++) { + r = view.getInt8(i); + ok(r === 0, "view byte " + i + " = " + r); + } + + for(i = 0; i < types.length; i++) { + var method = "get" + types[i][0], offs = 11 - types[i][1]; + r = DataView.prototype[method].length; + ok(r === 1, "DataView.prototype." + method + ".length = " + r); + try { + view[method](); + ok(false, "view." + method + "() did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_NO_ARGUMENT, "view." + method + "() threw " + n); + } + try { + view[method](-1); + ok(false, "view." + method + "(-1) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_ACCESS, "view." + method + "(-1) threw " + n); + } + try { + view[method](offs); + ok(false, "view." + method + "(" + offs + ") did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_ACCESS, "view." + method + "(" + offs + ") threw " + n); + } + try { + view[method].call(null, 0); + ok(false, "view." + method + "(0) with null context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "view." + method + "(0) with null context threw " + n); + } + try { + view[method].call({}, 0); + ok(false, "view." + method + "(0) with an object context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "view." + method + "(0) with an object context threw " + n); + } + method = "set" + types[i][0]; + r = DataView.prototype[method].length; + ok(r === 1, "DataView.prototype." + method + ".length = " + r); + try { + view[method](); + ok(false, "view." + method + "() did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_NO_ARGUMENT, "view." + method + "() threw " + n); + } + try { + view[method](0); + ok(false, "view." + method + "(0) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_NO_ARGUMENT, "view." + method + "(0) threw " + n); + } + try { + view[method](-1, 0); + ok(false, "view." + method + "(-1, 0) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_ACCESS, "view." + method + "(-1, 0) threw " + n); + } + try { + view[method](offs, 0); + ok(false, "view." + method + "(" + offs + ", 0) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_DATAVIEW_INVALID_ACCESS, "view." + method + "(" + offs + ", 0) threw " + n); + } + try { + view[method].call(null, 0, 0); + ok(false, "view." + method + "(0, 0) with null context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "view." + method + "(0, 0) with null context threw " + n); + } + try { + view[method].call({}, 0, 0); + ok(false, "view." + method + "(0, 0) with an object context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_DATAVIEW, "view." + method + "(0, 0) with an object context threw " + n); + } + } + + r = view.setInt8(1, -257); + ok(r === undefined, "view.setInt8(1, -1) returned " + r); + r = view.getUint16(0); + ok(r === 255, "view.getUint16(0) returned " + r); + r = view.getUint16(0, true); + ok(r === 65280, "view.getUint16(0, true) returned " + r); + r = view.setUint32(2, "12345678", true); + ok(r === undefined, "view.setUint32(2, '12345678', true) returned " + r); + r = view.getInt32(1); + ok(r === -11640388, "view.getInt32(1) returned " + r); + r = view.setInt16(3, 65535, true); + ok(r === undefined, "view.setInt16(3, 65535) returned " + r); + r = view.getUint16(3); + ok(r === 65535, "view.getUint16(3) returned " + r); + r = view.setUint32(0, -2, true); + ok(r === undefined, "view.setUint32(0, -2) returned " + r); + r = view.getInt32(0, true); + ok(r === -2, "view.getInt32(0) returned " + r); + r = view.setFloat32(6, 1234.5, true); + ok(r === undefined, "view.setFloat32(6, 1234.5) returned " + r); + r = view2.getFloat32(0, true); + ok(r === 1234.5, "view2.getFloat32(0) returned " + r); + + /* setters differing only in signedness have identical behavior, but they're not the same methods */ + ok(view.setInt8 !== view.setUint8, "setInt8 and setUint8 are the same method"); + ok(view.setInt16 !== view.setUint16, "setInt16 and setUint16 are the same method"); + ok(view.setInt32 !== view.setUint32, "setInt32 and setUint32 are the same method"); }); sync_test("builtin_context", function() { From b8fd028be4d226ebaef8112627a95093ee21b5ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0924/1506] jscript: Implement ArrayBuffer.prototype.slice. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 49 ++++++++++++++++++++++++++++++++++++++-- dlls/jscript/error.c | 1 + dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/es5.js | 46 ++++++++++++++++++++++++++++++++++++- 6 files changed, 96 insertions(+), 3 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index c8a024346b9..90052de2b99 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -55,6 +55,8 @@ static inline ArrayBufferInstance *arraybuf_this(jsval_t vthis) return (jsdisp && is_class(jsdisp, JSCLASS_ARRAYBUFFER)) ? arraybuf_from_jsdisp(jsdisp) : NULL; } +static HRESULT create_arraybuf(script_ctx_t*,DWORD,jsdisp_t**); + static HRESULT ArrayBuffer_get_byteLength(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { TRACE("%p\n", jsthis); @@ -66,9 +68,52 @@ static HRESULT ArrayBuffer_get_byteLength(script_ctx_t *ctx, jsdisp_t *jsthis, j static HRESULT ArrayBuffer_slice(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - FIXME("not implemented\n"); + ArrayBufferInstance *arraybuf; + DWORD begin = 0, end, size; + jsdisp_t *obj; + HRESULT hres; + double n; - return E_NOTIMPL; + TRACE("\n"); + + if(!(arraybuf = arraybuf_this(vthis))) + return JS_E_ARRAYBUFFER_EXPECTED; + end = arraybuf->size; + if(!r) + return S_OK; + + if(argc) { + hres = to_integer(ctx, argv[0], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0) + n += arraybuf->size; + if(n >= 0.0 && n < arraybuf->size) { + begin = n; + if(argc > 1 && !is_undefined(argv[1])) { + hres = to_integer(ctx, argv[1], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0) + n += arraybuf->size; + if(n >= 0.0) { + end = n < arraybuf->size ? n : arraybuf->size; + end = end < begin ? begin : end; + }else + end = begin; + } + }else + end = 0; + } + + size = end - begin; + hres = create_arraybuf(ctx, size, &obj); + if(FAILED(hres)) + return hres; + memcpy(arraybuf_from_jsdisp(obj)->buf, arraybuf->buf + begin, size); + + *r = jsval_obj(obj); + return S_OK; } static const builtin_prop_t ArrayBuffer_props[] = { diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 60d090ec76e..81e3a3a9739 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -487,6 +487,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_DATAVIEW_NO_ARGUMENT: case JS_E_WRONG_THIS: case JS_E_KEY_NOT_OBJECT: + case JS_E_ARRAYBUFFER_EXPECTED: case JS_E_PROP_DESC_MISMATCH: case JS_E_INVALID_WRITABLE_PROP_DESC: constr = ctx->type_error_constr; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 07e0c4693be..2453cba4939 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -587,6 +587,7 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_DATAVIEW_INVALID_OFFSET MAKE_JSERROR(IDS_DATAVIEW_INVALID_OFFSET) #define JS_E_WRONG_THIS MAKE_JSERROR(IDS_WRONG_THIS) #define JS_E_KEY_NOT_OBJECT MAKE_JSERROR(IDS_KEY_NOT_OBJECT) +#define JS_E_ARRAYBUFFER_EXPECTED MAKE_JSERROR(IDS_ARRAYBUFFER_EXPECTED) #define JS_E_PROP_DESC_MISMATCH MAKE_JSERROR(IDS_PROP_DESC_MISMATCH) #define JS_E_INVALID_WRITABLE_PROP_DESC MAKE_JSERROR(IDS_INVALID_WRITABLE_PROP_DESC) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index 1cfc9040f51..cbdfde507b7 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -82,6 +82,7 @@ STRINGTABLE IDS_DATAVIEW_INVALID_OFFSET "DataView constructor argument offset is invalid" IDS_WRONG_THIS "'this' is not a | object" IDS_KEY_NOT_OBJECT "'key' is not an object" + IDS_ARRAYBUFFER_EXPECTED "ArrayBuffer object expected" IDS_PROP_DESC_MISMATCH "Property cannot have both accessors and a value" IDS_COMPILATION_ERROR "Microsoft JScript compilation error" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index e2b60b98bd5..801e940b95e 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -80,6 +80,7 @@ #define IDS_DATAVIEW_INVALID_OFFSET 0x13E2 #define IDS_WRONG_THIS 0x13FC #define IDS_KEY_NOT_OBJECT 0x13FD +#define IDS_ARRAYBUFFER_EXPECTED 0x15E4 /* FIXME: This is not compatible with native, but we would * conflict with IDS_UNSUPPORTED_ACTION otherwise */ #define IDS_PROP_DESC_MISMATCH 0x1F00 diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index a18fea6476a..353d0b0b5c0 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -37,6 +37,7 @@ var JS_E_DATAVIEW_NO_ARGUMENT = 0x800a13e0; var JS_E_DATAVIEW_INVALID_ACCESS = 0x800a13e1; var JS_E_DATAVIEW_INVALID_OFFSET = 0x800a13e2; var JS_E_WRONG_THIS = 0x800a13fc; +var JS_E_ARRAYBUFFER_EXPECTED = 0x800a15e4; var tests = []; @@ -1687,7 +1688,7 @@ sync_test("RegExp", function() { }); sync_test("ArrayBuffers & Views", function() { - var i, r, buf, view, view2, arr; + var i, r, buf, buf2, view, view2, arr; var types = [ [ "Int8", 1 ], @@ -1732,6 +1733,20 @@ sync_test("ArrayBuffers & Views", function() { r = ArrayBuffer.prototype.slice.length; ok(r === 2, "ArrayBuffer.prototype.slice.length = " + r); + try { + ArrayBuffer.prototype.slice.call(null); + ok(false, "ArrayBuffer: calling slice with null context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_ARRAYBUFFER_EXPECTED, "ArrayBuffer: calling slice with null context threw " + n); + } + try { + ArrayBuffer.prototype.slice.call({}); + ok(false, "ArrayBuffer: calling slice with an object context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_ARRAYBUFFER_EXPECTED, "ArrayBuffer: calling slice with an object context threw " + n); + } try { new ArrayBuffer(-1); ok(false, "new ArrayBuffer(-1) did not throw exception"); @@ -1983,10 +1998,39 @@ sync_test("ArrayBuffers & Views", function() { r = view2.getFloat32(0, true); ok(r === 1234.5, "view2.getFloat32(0) returned " + r); + r = buf.slice(-9, 1); + ok(r instanceof ArrayBuffer, "buf.slice did not return an ArrayBuffer"); + ok(r.byteLength === 0, "buf.slice(-9, 1).byteLength = " + r.byteLength); + r = buf.slice(); + ok(r.byteLength === 10, "buf.slice().byteLength = " + r.byteLength); + r = buf.slice(9, 16); + ok(r.byteLength === 1, "buf.slice(9, 16).byteLength = " + r.byteLength); + r = buf.slice(-9, -1); + ok(r.byteLength === 8, "buf.slice(-9, -1).byteLength = " + r.byteLength); + /* setters differing only in signedness have identical behavior, but they're not the same methods */ ok(view.setInt8 !== view.setUint8, "setInt8 and setUint8 are the same method"); ok(view.setInt16 !== view.setUint16, "setInt16 and setUint16 are the same method"); ok(view.setInt32 !== view.setUint32, "setInt32 and setUint32 are the same method"); + + /* slice makes a copy */ + buf2 = buf.slice(-9); + ok(buf2.byteLength === 9, "buf.slice(-9).byteLength = " + buf2.byteLength); + view2 = DataView(buf2, 1); + ok(view2.byteLength === 8, "buf.slice(-9) view(1).byteLength = " + view2.byteLength); + + r = view2.getUint32(0); + ok(r === 4294967040, "buf.slice(-9) view(1).getUint32(0) returned " + r); + view2.setInt16(0, -5); + r = view2.getUint16(1); + ok(r === 64511, "buf.slice(-9) view(1).getUint16(1) returned " + r); + r = view.getInt32(1); + ok(r === -1, "view.getInt32(1) after slice changed returned " + r); + + r = view2.setFloat64(0, 11.875); + ok(r === undefined, "buf.slice(-9) view(1).setFloat64(0, 11.875) returned " + r); + r = view2.getFloat64(0); + ok(r === 11.875, "buf.slice(-9) view(1).getFloat64(0) returned " + r); }); sync_test("builtin_context", function() { From e6db401b92a8bf53ff48538f1d1e01a5e5f06533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0925/1506] jscript: Add initial implementation of Typed Arrays. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Typed Arrays have special properties (even according to the spec); they override all positive indices, and operations on them must be special cased. Presumably (on native) this is done for performance reasons, as they are used as actual data arrays which are expected to perform well with millions of iterations and elements (e.g. using them to store and manipulate an image). The only time we still create a PROP_IDX on them is when the DISPID is requested or when enumerating (same reason). Note that even the behavior is special; defining an indexed prop on a typed array for indices out of bounds of the array doesn't do anything, although it does throw if flags don't match (since it's not configurable). Redefining an index within bounds throws if flags don't match, but otherwise acts like a normal setter (coerces it into the underlying data type). delete always returns false, even for out of bounds indices, despite them not being props (hasOwnProperty returns false). The prototype is also not consulted for any positive indices, but is for negative (unlike the spec says, native differs here), i.e. the positive indices behavior is completely overridden, even for those out of bounds. Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 354 +++++++++++++++++++++++++++++++++++++++ dlls/jscript/dispex.c | 99 ++++++++++- dlls/jscript/error.c | 3 + dlls/jscript/jscript.h | 19 ++- dlls/jscript/jscript.rc | 3 + dlls/jscript/object.c | 8 + dlls/jscript/resource.h | 3 + dlls/mshtml/tests/es5.js | 189 ++++++++++++++++++++- 8 files changed, 670 insertions(+), 8 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index 90052de2b99..8d3c56a27ca 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -39,6 +39,14 @@ typedef struct { DWORD size; } DataViewInstance; +typedef struct { + jsdisp_t dispex; + + jsdisp_t *buffer; + DWORD offset; + DWORD length; +} TypedArrayInstance; + static inline ArrayBufferInstance *arraybuf_from_jsdisp(jsdisp_t *jsdisp) { return CONTAINING_RECORD(jsdisp, ArrayBufferInstance, dispex); @@ -49,6 +57,11 @@ static inline DataViewInstance *dataview_from_jsdisp(jsdisp_t *jsdisp) return CONTAINING_RECORD(jsdisp, DataViewInstance, dispex); } +static inline TypedArrayInstance *typedarr_from_jsdisp(jsdisp_t *jsdisp) +{ + return CONTAINING_RECORD(jsdisp, TypedArrayInstance, dispex); +} + static inline ArrayBufferInstance *arraybuf_this(jsval_t vthis) { jsdisp_t *jsdisp = is_object_instance(vthis) ? to_jsdisp(get_object(vthis)) : NULL; @@ -719,6 +732,310 @@ static const builtin_info_t DataViewConstr_info = { NULL }; +#define TYPEDARRAY_LIST \ +X(Int8Array, JSCLASS_INT8ARRAY, INT8, to_int32, INT) \ +X(Int16Array, JSCLASS_INT16ARRAY, INT16, to_int32, INT) \ +X(Int32Array, JSCLASS_INT32ARRAY, INT32, to_int32, INT) \ +X(Uint8Array, JSCLASS_UINT8ARRAY, UINT8, to_int32, INT) \ +X(Uint16Array, JSCLASS_UINT16ARRAY, UINT16, to_int32, INT) \ +X(Uint32Array, JSCLASS_UINT32ARRAY, UINT32, to_int32, INT) \ +X(Float32Array, JSCLASS_FLOAT32ARRAY, float, to_number, double) \ +X(Float64Array, JSCLASS_FLOAT64ARRAY, double, to_number, double) + +#define TYPEDARRAY_INDEX(JSCLASS) ((JSCLASS) - FIRST_TYPEDARRAY_JSCLASS) + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) [TYPEDARRAY_INDEX(JSCLASS)] = L"" #NAME, +static const WCHAR *const TypedArray_name[] = { TYPEDARRAY_LIST }; +#undef X + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) [TYPEDARRAY_INDEX(JSCLASS)] = sizeof(TYPE), +static const unsigned TypedArray_elem_size[] = { TYPEDARRAY_LIST }; +#undef X + +static inline TypedArrayInstance *typedarr_this(jsval_t vthis, jsclass_t jsclass) +{ + jsdisp_t *jsdisp = is_object_instance(vthis) ? to_jsdisp(get_object(vthis)) : NULL; + return (jsdisp && is_class(jsdisp, jsclass)) ? typedarr_from_jsdisp(jsdisp) : NULL; +} + +static HRESULT TypedArray_get_buffer(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + TRACE("%p\n", jsthis); + + *r = jsval_obj(jsdisp_addref(typedarr_from_jsdisp(jsthis)->buffer)); + return S_OK; +} + +static HRESULT TypedArray_get_byteLength(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + TRACE("%p\n", jsthis); + + *r = jsval_number(typedarr_from_jsdisp(jsthis)->length * TypedArray_elem_size[TYPEDARRAY_INDEX(jsthis->builtin_info->class)]); + return S_OK; +} + +static HRESULT TypedArray_get_byteOffset(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + TRACE("%p\n", jsthis); + + *r = jsval_number(typedarr_from_jsdisp(jsthis)->offset); + return S_OK; +} + +static HRESULT TypedArray_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + TRACE("%p\n", jsthis); + + *r = jsval_number(typedarr_from_jsdisp(jsthis)->length); + return S_OK; +} + +static HRESULT TypedArray_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r, jsclass_t jsclass) +{ + TypedArrayInstance *typedarr; + + FIXME("not implemented\n"); + + if(!(typedarr = typedarr_this(vthis, jsclass))) + return JS_E_NOT_TYPEDARRAY; + return E_NOTIMPL; +} + +static HRESULT TypedArray_subarray(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r, jsclass_t jsclass) +{ + TypedArrayInstance *typedarr; + + FIXME("not implemented\n"); + + if(!(typedarr = typedarr_this(vthis, jsclass))) + return JS_E_NOT_TYPEDARRAY; + return E_NOTIMPL; +} + +static unsigned TypedArray_idx_length(jsdisp_t *jsdisp) +{ + TypedArrayInstance *typedarr = typedarr_from_jsdisp(jsdisp); + return typedarr->length; +} + +static void TypedArray_destructor(jsdisp_t *dispex) +{ + TypedArrayInstance *typedarr = typedarr_from_jsdisp(dispex); + if(typedarr->buffer) + jsdisp_release(typedarr->buffer); + free(typedarr); +} + +static HRESULT TypedArray_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsdisp_t *dispex) +{ + TypedArrayInstance *typedarr = typedarr_from_jsdisp(dispex); + return gc_process_linked_obj(gc_ctx, op, dispex, typedarr->buffer, (void**)&typedarr->buffer); +} + +static const builtin_prop_t TypedArrayInst_props[] = { + {L"buffer", NULL, 0, TypedArray_get_buffer}, + {L"byteLength", NULL, 0, TypedArray_get_byteLength}, + {L"byteOffset", NULL, 0, TypedArray_get_byteOffset}, + {L"length", NULL, 0, TypedArray_get_length}, +}; + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) \ +static HRESULT NAME ##_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) \ +{ \ + TypedArrayInstance *typedarr = typedarr_from_jsdisp(jsdisp); \ + \ + TRACE("%p[%u]\n", typedarr, idx); \ + \ + if(idx >= typedarr->length) \ + *r = jsval_undefined(); \ + else \ + *r = jsval_number(*(TYPE*)&arraybuf_from_jsdisp(typedarr->buffer)->buf[typedarr->offset + idx * sizeof(TYPE)]); \ + return S_OK; \ +} \ + \ +static HRESULT NAME ##_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) \ +{ \ + TypedArrayInstance *typedarr = typedarr_from_jsdisp(jsdisp); \ + HRESULT hres; \ + NUM_TYPE n; \ + \ + TRACE("%p[%u] = %s\n", typedarr, idx, debugstr_jsval(val)); \ + \ + if(idx >= typedarr->length) \ + return S_OK; \ + \ + hres = CONVERT(jsdisp->ctx, val, &n); \ + if(SUCCEEDED(hres)) \ + *(TYPE*)&arraybuf_from_jsdisp(typedarr->buffer)->buf[typedarr->offset + idx * sizeof(TYPE)] = n; \ + return hres; \ +} \ + \ +static HRESULT NAME ##_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, \ + jsval_t *r) \ +{ \ + return TypedArray_set(ctx, vthis, flags, argc, argv, r, JSCLASS); \ +} \ + \ +static HRESULT NAME ##_subarray(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, \ + jsval_t *r) \ +{ \ + return TypedArray_subarray(ctx, vthis, flags, argc, argv, r, JSCLASS); \ +} \ + \ +static const builtin_prop_t NAME ##_props[] = { \ + {L"buffer", NULL, 0, TypedArray_get_buffer}, \ + {L"byteLength", NULL, 0, TypedArray_get_byteLength}, \ + {L"byteOffset", NULL, 0, TypedArray_get_byteOffset}, \ + {L"length", NULL, 0, TypedArray_get_length}, \ + {L"set", NAME ##_set, PROPF_METHOD|2}, \ + {L"subarray", NAME ##_subarray, PROPF_METHOD|2}, \ +}; +TYPEDARRAY_LIST +#undef X + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) \ +[TYPEDARRAY_INDEX(JSCLASS)] = \ +{ \ + JSCLASS, \ + NULL, \ + ARRAY_SIZE(NAME ##_props), \ + NAME ##_props, \ + TypedArray_destructor, \ + NULL, \ + TypedArray_idx_length, \ + NAME ##_idx_get, \ + NAME ##_idx_put, \ + TypedArray_gc_traverse \ +}, +static const builtin_info_t TypedArray_info[] = { TYPEDARRAY_LIST }; +#undef X + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) \ +[TYPEDARRAY_INDEX(JSCLASS)] = \ +{ \ + JSCLASS, \ + NULL, \ + ARRAY_SIZE(TypedArrayInst_props), \ + TypedArrayInst_props, \ + TypedArray_destructor, \ + NULL, \ + TypedArray_idx_length, \ + NAME ##_idx_get, \ + NAME ##_idx_put, \ + TypedArray_gc_traverse \ +}, +static const builtin_info_t TypedArrayInst_info[] = { TYPEDARRAY_LIST }; +#undef X + +static HRESULT create_typedarr(script_ctx_t *ctx, jsclass_t jsclass, jsdisp_t *buffer, DWORD offset, DWORD length, + jsdisp_t **ret) +{ + TypedArrayInstance *typedarr; + HRESULT hres; + + if(!(typedarr = calloc(1, sizeof(TypedArrayInstance)))) + return E_OUTOFMEMORY; + + hres = init_dispex_from_constr(&typedarr->dispex, ctx, &TypedArrayInst_info[TYPEDARRAY_INDEX(jsclass)], + ctx->typedarr_constr[TYPEDARRAY_INDEX(jsclass)]); + if(FAILED(hres)) { + free(typedarr); + return hres; + } + + typedarr->buffer = jsdisp_addref(buffer); + typedarr->offset = offset; + typedarr->length = length; + + *ret = &typedarr->dispex; + return S_OK; +} + +static HRESULT TypedArrayConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r, jsclass_t jsclass) +{ + const unsigned typedarr_idx = TYPEDARRAY_INDEX(jsclass); + unsigned elem_size = TypedArray_elem_size[typedarr_idx]; + jsdisp_t *typedarr, *buffer = NULL; + DWORD offset = 0, length = 0; + HRESULT hres; + double n; + + TRACE("\n"); + + switch(flags) { + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: { + if(argc) { + if(is_object_instance(argv[0])) { + jsdisp_t *obj = to_jsdisp(get_object(argv[0])); + + if(!obj) + return JS_E_TYPEDARRAY_BAD_CTOR_ARG; + + FIXME("Construction from object not implemented\n"); + return E_NOTIMPL; + }else if(is_number(argv[0])) { + hres = to_integer(ctx, argv[0], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0) + return JS_E_TYPEDARRAY_INVALID_OFFSLEN; + if(n * elem_size > (UINT_MAX - FIELD_OFFSET(ArrayBufferInstance, buf[0]))) + return E_OUTOFMEMORY; + length = n; + }else + return JS_E_TYPEDARRAY_BAD_CTOR_ARG; + } + + if(!r) + return S_OK; + + if(!buffer) { + hres = create_arraybuf(ctx, length * elem_size, &buffer); + if(FAILED(hres)) + return hres; + } + + hres = create_typedarr(ctx, jsclass, buffer, offset, length, &typedarr); + jsdisp_release(buffer); + if(FAILED(hres)) + return hres; + + *r = jsval_obj(typedarr); + break; + } + default: + FIXME("unimplemented flags: %x\n", flags); + return E_NOTIMPL; + } + + return S_OK; +} + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) \ +static HRESULT NAME ## Constr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) \ +{ \ + return TypedArrayConstr_value(ctx, vthis, flags, argc, argv, r, JSCLASS); \ +} +TYPEDARRAY_LIST +#undef X + +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) [TYPEDARRAY_INDEX(JSCLASS)] = NAME ## Constr_value, +static const builtin_invoke_t TypedArray_constr[] = { TYPEDARRAY_LIST }; +#undef X + +static const builtin_info_t TypedArrayConstr_info = { + JSCLASS_FUNCTION, + Function_value, + 0, + NULL, + NULL, + NULL +}; + HRESULT init_arraybuf_constructors(script_ctx_t *ctx) { static const struct { @@ -730,6 +1047,7 @@ HRESULT init_arraybuf_constructors(script_ctx_t *ctx) { L"byteOffset", DataView_get_byteOffset }, }; ArrayBufferInstance *arraybuf; + TypedArrayInstance *typedarr; DataViewInstance *view; property_desc_t desc; HRESULT hres; @@ -800,6 +1118,42 @@ HRESULT init_arraybuf_constructors(script_ctx_t *ctx) hres = jsdisp_define_data_property(ctx->global, L"DataView", PROPF_CONFIGURABLE | PROPF_WRITABLE, jsval_obj(ctx->dataview_constr)); + if(FAILED(hres)) + return hres; + + for(i = 0; i < ARRAY_SIZE(TypedArray_info); i++) { + if(!(typedarr = calloc(1, sizeof(TypedArrayInstance)))) + return E_OUTOFMEMORY; + + hres = create_arraybuf(ctx, 0, &typedarr->buffer); + if(FAILED(hres)) { + free(typedarr); + return hres; + } + + hres = init_dispex(&typedarr->dispex, ctx, &TypedArray_info[i], ctx->object_prototype); + if(FAILED(hres)) { + jsdisp_release(typedarr->buffer); + free(typedarr); + return hres; + } + + hres = create_builtin_constructor(ctx, TypedArray_constr[i], TypedArray_name[i], &TypedArrayConstr_info, + PROPF_CONSTR|1, &typedarr->dispex, &ctx->typedarr_constr[i]); + jsdisp_release(&typedarr->dispex); + if(FAILED(hres)) + return hres; + + hres = jsdisp_define_data_property(ctx->typedarr_constr[i], L"BYTES_PER_ELEMENT", 0, + jsval_number(TypedArray_elem_size[i])); + if(FAILED(hres)) + return hres; + + hres = jsdisp_define_data_property(ctx->global, TypedArray_name[i], PROPF_CONFIGURABLE | PROPF_WRITABLE, + jsval_obj(ctx->typedarr_constr[i])); + if(FAILED(hres)) + return hres; + } return hres; } diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 57882bf499e..0f001739559 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -17,6 +17,7 @@ */ #include +#include #include "jscript.h" #include "engine.h" @@ -108,6 +109,29 @@ static inline BOOL is_function_prop(dispex_prop_t *prop) return ret; } +static inline BOOL override_idx(jsdisp_t *This, const WCHAR *name, unsigned *ret_idx) +{ + /* Typed Arrays override every positive index */ + if(This->builtin_info->class >= FIRST_TYPEDARRAY_JSCLASS && This->builtin_info->class <= LAST_TYPEDARRAY_JSCLASS) { + const WCHAR *ptr; + unsigned idx = 0; + + for(ptr = name; is_digit(*ptr) && idx <= (UINT_MAX-9 / 10); ptr++) + idx = idx*10 + (*ptr-'0'); + if(!*ptr) { + *ret_idx = idx; + return TRUE; + }else { + while(is_digit(*ptr)) ptr++; + if(!*ptr) { + *ret_idx = UINT_MAX; + return TRUE; + } + } + } + return FALSE; +} + static DWORD get_flags(jsdisp_t *This, dispex_prop_t *prop) { if(prop->type == PROP_PROTREF) { @@ -632,6 +656,7 @@ static HRESULT fill_props(jsdisp_t *obj) static HRESULT fill_protrefs(jsdisp_t *This) { dispex_prop_t *iter, *prop; + unsigned idx; HRESULT hres; hres = fill_props(This); @@ -646,6 +671,8 @@ static HRESULT fill_protrefs(jsdisp_t *This) return hres; for(iter = This->prototype->props; iter < This->prototype->props+This->prototype->prop_cnt; iter++) { + if(override_idx(This, iter->name, &idx)) + continue; hres = find_prop_name(This, iter->hash, iter->name, FALSE, &prop); if(FAILED(hres)) return hres; @@ -2057,6 +2084,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bst { jsdisp_t *This = impl_from_IDispatchEx(iface); dispex_prop_t *prop; + unsigned idx; BOOL b; HRESULT hres; @@ -2065,6 +2093,9 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bst if(grfdex & ~(fdexNameCaseSensitive|fdexNameCaseInsensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK)) FIXME("Unsupported grfdex %lx\n", grfdex); + if(override_idx(This, bstrName, &idx)) + return S_OK; + hres = find_prop_name(This, string_hash(bstrName), bstrName, grfdex & fdexNameCaseInsensitive, &prop); if(FAILED(hres)) return hres; @@ -2335,9 +2366,17 @@ jsdisp_t *iface_to_jsdisp(IDispatch *iface) HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *id) { dispex_prop_t *prop; + unsigned idx; HRESULT hres; - if(jsdisp->extensible && (flags & fdexNameEnsure)) + if(override_idx(jsdisp, name, &idx)) { + if(idx >= jsdisp->builtin_info->idx_length(jsdisp)) { + *id = DISPID_UNKNOWN; + return DISP_E_UNKNOWNNAME; + } + hres = find_prop_name(jsdisp, string_hash(name), name, FALSE, &prop); + } + else if(jsdisp->extensible && (flags & fdexNameEnsure)) hres = ensure_prop_name(jsdisp, name, PROPF_ENUMERABLE | PROPF_CONFIGURABLE | PROPF_WRITABLE, flags & fdexNameCaseInsensitive, &prop); else @@ -2638,8 +2677,12 @@ HRESULT disp_call_value_with_caller(script_ctx_t *ctx, IDispatch *disp, jsval_t HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, BOOL throw, jsval_t val) { dispex_prop_t *prop; + unsigned idx; HRESULT hres; + if(override_idx(obj, name, &idx)) + return obj->builtin_info->idx_put(obj, idx, val); + if(obj->extensible) hres = ensure_prop_name(obj, name, flags, FALSE, &prop); else @@ -2742,8 +2785,12 @@ HRESULT disp_propput_name(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name, HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val) { dispex_prop_t *prop; + unsigned idx; HRESULT hres; + if(override_idx(obj, name, &idx)) + return obj->builtin_info->idx_get(obj, idx, val); + hres = find_prop_name_prot(obj, string_hash(name), name, FALSE, &prop); if(FAILED(hres)) return hres; @@ -2762,6 +2809,9 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r) dispex_prop_t *prop; HRESULT hres; + if(obj->builtin_info->class >= FIRST_TYPEDARRAY_JSCLASS && obj->builtin_info->class <= LAST_TYPEDARRAY_JSCLASS) + return obj->builtin_info->idx_get(obj, idx, r); + swprintf(name, ARRAY_SIZE(name), L"%d", idx); hres = find_prop_name_prot(obj, string_hash(name), name, FALSE, &prop); @@ -2819,6 +2869,9 @@ HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx) BOOL b; HRESULT hres; + if(obj->builtin_info->class >= FIRST_TYPEDARRAY_JSCLASS && obj->builtin_info->class <= LAST_TYPEDARRAY_JSCLASS) + return S_OK; + swprintf(buf, ARRAY_SIZE(buf), L"%d", idx); hres = find_prop_name(obj, string_hash(buf), buf, FALSE, &prop); @@ -2910,6 +2963,7 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL if(jsdisp) { dispex_prop_t *prop; const WCHAR *ptr; + unsigned idx; ptr = jsstr_flatten(name); if(!ptr) { @@ -2917,12 +2971,17 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL return E_OUTOFMEMORY; } - hres = find_prop_name(jsdisp, string_hash(ptr), ptr, FALSE, &prop); - if(prop) { - hres = delete_prop(prop, ret); - }else { - *ret = TRUE; + if(override_idx(jsdisp, ptr, &idx)) { + *ret = FALSE; hres = S_OK; + }else { + hres = find_prop_name(jsdisp, string_hash(ptr), ptr, FALSE, &prop); + if(prop) { + hres = delete_prop(prop, ret); + }else { + *ret = TRUE; + hres = S_OK; + } } jsdisp_release(jsdisp); @@ -2962,8 +3021,25 @@ HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_onl property_desc_t *desc) { dispex_prop_t *prop; + unsigned idx; HRESULT hres; + if(override_idx(obj, name, &idx)) { + if(idx >= obj->builtin_info->idx_length(obj)) + return DISP_E_UNKNOWNNAME; + + memset(desc, 0, sizeof(*desc)); + if(!flags_only) { + hres = obj->builtin_info->idx_get(obj, idx, &desc->value); + if(FAILED(hres)) + return hres; + } + desc->flags = PROPF_ENUMERABLE | PROPF_WRITABLE; + desc->mask = PROPF_ENUMERABLE | PROPF_WRITABLE | PROPF_CONFIGURABLE; + desc->explicit_value = TRUE; + return S_OK; + } + hres = find_prop_name(obj, string_hash(name), name, FALSE, &prop); if(FAILED(hres)) return hres; @@ -3006,8 +3082,19 @@ HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_onl HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc) { dispex_prop_t *prop; + unsigned idx; HRESULT hres; + if(override_idx(obj, name, &idx)) { + if((desc->flags & desc->mask) != (desc->mask & (PROPF_WRITABLE | PROPF_ENUMERABLE))) + return throw_error(obj->ctx, JS_E_NONCONFIGURABLE_REDEFINED, name); + if(desc->explicit_value) + return obj->builtin_info->idx_put(obj, idx, desc->value); + if(desc->explicit_getter || desc->explicit_setter) + return throw_error(obj->ctx, JS_E_NONCONFIGURABLE_REDEFINED, name); + return obj->builtin_info->idx_put(obj, idx, jsval_undefined()); + } + hres = find_prop_name(obj, string_hash(name), name, FALSE, &prop); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 81e3a3a9739..aa5399d02c3 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -483,6 +483,8 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_OBJECT_NONEXTENSIBLE: case JS_E_NONCONFIGURABLE_REDEFINED: case JS_E_NONWRITABLE_MODIFIED: + case JS_E_TYPEDARRAY_BAD_CTOR_ARG: + case JS_E_NOT_TYPEDARRAY: case JS_E_NOT_DATAVIEW: case JS_E_DATAVIEW_NO_ARGUMENT: case JS_E_WRONG_THIS: @@ -497,6 +499,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_FRACTION_DIGITS_OUT_OF_RANGE: case JS_E_PRECISION_OUT_OF_RANGE: case JS_E_INVALID_LENGTH: + case JS_E_TYPEDARRAY_INVALID_OFFSLEN: case JS_E_DATAVIEW_INVALID_ACCESS: case JS_E_DATAVIEW_INVALID_OFFSET: constr = ctx->range_error_constr; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 2453cba4939..11193992f3d 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -118,11 +118,24 @@ typedef enum { JSCLASS_JSON, JSCLASS_ARRAYBUFFER, JSCLASS_DATAVIEW, + JSCLASS_INT8ARRAY, + JSCLASS_INT16ARRAY, + JSCLASS_INT32ARRAY, + JSCLASS_UINT8ARRAY, + JSCLASS_UINT16ARRAY, + JSCLASS_UINT32ARRAY, + JSCLASS_FLOAT32ARRAY, + JSCLASS_FLOAT64ARRAY, JSCLASS_MAP, JSCLASS_SET, JSCLASS_WEAKMAP, + + FIRST_TYPEDARRAY_JSCLASS = JSCLASS_INT8ARRAY, + LAST_TYPEDARRAY_JSCLASS = JSCLASS_FLOAT64ARRAY, } jsclass_t; +enum { NUM_TYPEDARRAY_TYPES = LAST_TYPEDARRAY_JSCLASS - FIRST_TYPEDARRAY_JSCLASS + 1 }; + jsdisp_t *iface_to_jsdisp(IDispatch*); typedef HRESULT (*builtin_invoke_t)(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); @@ -439,11 +452,12 @@ struct _script_ctx_t { jsdisp_t *vbarray_constr; jsdisp_t *arraybuf_constr; jsdisp_t *dataview_constr; + jsdisp_t *typedarr_constr[NUM_TYPEDARRAY_TYPES]; jsdisp_t *map_prototype; jsdisp_t *set_prototype; jsdisp_t *weakmap_prototype; }; - jsdisp_t *global_objects[25]; + jsdisp_t *global_objects[25 + NUM_TYPEDARRAY_TYPES]; }; }; C_ASSERT(RTL_SIZEOF_THROUGH_FIELD(script_ctx_t, weakmap_prototype) == RTL_SIZEOF_THROUGH_FIELD(script_ctx_t, global_objects)); @@ -581,6 +595,9 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_OBJECT_NONEXTENSIBLE MAKE_JSERROR(IDS_OBJECT_NONEXTENSIBLE) #define JS_E_NONCONFIGURABLE_REDEFINED MAKE_JSERROR(IDS_NONCONFIGURABLE_REDEFINED) #define JS_E_NONWRITABLE_MODIFIED MAKE_JSERROR(IDS_NONWRITABLE_MODIFIED) +#define JS_E_TYPEDARRAY_BAD_CTOR_ARG MAKE_JSERROR(IDS_TYPEDARRAY_BAD_CTOR_ARG) +#define JS_E_NOT_TYPEDARRAY MAKE_JSERROR(IDS_NOT_TYPEDARRAY) +#define JS_E_TYPEDARRAY_INVALID_OFFSLEN MAKE_JSERROR(IDS_TYPEDARRAY_INVALID_OFFSLEN) #define JS_E_NOT_DATAVIEW MAKE_JSERROR(IDS_NOT_DATAVIEW) #define JS_E_DATAVIEW_NO_ARGUMENT MAKE_JSERROR(IDS_DATAVIEW_NO_ARGUMENT) #define JS_E_DATAVIEW_INVALID_ACCESS MAKE_JSERROR(IDS_DATAVIEW_INVALID_ACCESS) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index cbdfde507b7..a224b6cd6f3 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -76,6 +76,9 @@ STRINGTABLE IDS_OBJECT_NONEXTENSIBLE "Cannot define property '|': object is not extensible" IDS_NONCONFIGURABLE_REDEFINED "Cannot redefine non-configurable property '|'" IDS_NONWRITABLE_MODIFIED "Cannot modify non-writable property '|'" + IDS_NOT_TYPEDARRAY "'this' is not a typed array object" + IDS_TYPEDARRAY_BAD_CTOR_ARG "Typed array constructor argument is invalid" + IDS_TYPEDARRAY_INVALID_OFFSLEN "Invalid offset/length when creating typed array" IDS_NOT_DATAVIEW "'this' is not a DataView object" IDS_DATAVIEW_NO_ARGUMENT "Required argument offset or value in DataView method is not specified" IDS_DATAVIEW_INVALID_ACCESS "DataView operation access beyond specified buffer length" diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 16ecc3dea3c..1b33f481b3b 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -52,6 +52,14 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns L"[object Object]", L"[object ArrayBuffer]", L"[object Object]", + L"[object Int8Array]", + L"[object Int16Array]", + L"[object Int32Array]", + L"[object Uint8Array]", + L"[object Uint16Array]", + L"[object Uint32Array]", + L"[object Float32Array]", + L"[object Float64Array]", L"[object Object]", L"[object Object]", L"[object Object]" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index 801e940b95e..feb2593e723 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -74,6 +74,9 @@ #define IDS_OBJECT_NONEXTENSIBLE 0x13D5 #define IDS_NONCONFIGURABLE_REDEFINED 0x13D6 #define IDS_NONWRITABLE_MODIFIED 0x13D7 +#define IDS_TYPEDARRAY_BAD_CTOR_ARG 0x13DA +#define IDS_NOT_TYPEDARRAY 0x13DB +#define IDS_TYPEDARRAY_INVALID_OFFSLEN 0x13DC #define IDS_NOT_DATAVIEW 0x13DF #define IDS_DATAVIEW_NO_ARGUMENT 0x13E0 #define IDS_DATAVIEW_INVALID_ACCESS 0x13E1 diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 353d0b0b5c0..3d0cdfb72c5 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -32,6 +32,9 @@ var JS_E_INVALID_LENGTH = 0x800a13a5; var JS_E_INVALID_WRITABLE_PROP_DESC = 0x800a13ac; var JS_E_NONCONFIGURABLE_REDEFINED = 0x800a13d6; var JS_E_NONWRITABLE_MODIFIED = 0x800a13d7; +var JS_E_TYPEDARRAY_BAD_CTOR_ARG = 0x800a13da; +var JS_E_NOT_TYPEDARRAY = 0x800a13db; +var JS_E_TYPEDARRAY_INVALID_OFFSLEN = 0x800a13dc; var JS_E_NOT_DATAVIEW = 0x800a13df; var JS_E_DATAVIEW_NO_ARGUMENT = 0x800a13e0; var JS_E_DATAVIEW_INVALID_ACCESS = 0x800a13e1; @@ -1688,7 +1691,7 @@ sync_test("RegExp", function() { }); sync_test("ArrayBuffers & Views", function() { - var i, r, buf, buf2, view, view2, arr; + var i, r, buf, buf2, view, view2, arr, arr2; var types = [ [ "Int8", 1 ], @@ -2031,6 +2034,190 @@ sync_test("ArrayBuffers & Views", function() { ok(r === undefined, "buf.slice(-9) view(1).setFloat64(0, 11.875) returned " + r); r = view2.getFloat64(0); ok(r === 11.875, "buf.slice(-9) view(1).getFloat64(0) returned " + r); + + for(i = 0; i < types.length; i++) { + var arrType = types[i][0] + "Array", typeSz = types[i][1]; + test_own_props(arrType, [ "BYTES_PER_ELEMENT" ]); + test_not_own_props(arrType, [ "from", "of" ]); + test_own_props(arrType + ".prototype", [ "buffer", "byteLength", "byteOffset", "length", "set", "subarray" ]); + test_not_own_props(arrType + ".prototype", [ + "at", "copyWithin", "entries", "every", "fill", "filter", "find", "findIndex", "forEach", + "includes", "indexOf", "join", "keys", "lastIndexOf", "map", "reduce", "reduceRight", + "reverse", "slice", "some", "sort", "toLocaleString", "toString", "values" + ]); + + arr = eval(arrType); + test_own_data_prop_desc(arr, "BYTES_PER_ELEMENT", false, false, false); + ok(arr.BYTES_PER_ELEMENT === typeSz, arrType + ".BYTES_PER_ELEMENT = " + arr.BYTES_PER_ELEMENT); + r = arr.length; + ok(r === 1, arrType + ".length = " + r); + r = arr.prototype.set.length; + ok(r === 2, arrType + ".prototype.set.length = " + r); + r = arr.prototype.subarray.length; + ok(r === 2, arrType + ".prototype.subarray.length = " + r); + + r = eval("Object.getPrototypeOf(" + arrType + ")"); + ok(r === Function.prototype, arrType + "'s prototype is not Function.prototype: " + r); + r = eval("Object.getPrototypeOf(" + arrType + ".prototype)"); + ok(r === Object.prototype, arrType + ".prototype's prototype is not Object.prototype: " + r); + r = eval("Object.prototype.toString.call(new " + arrType + "(3))"); + ok(r === "[object " + arrType + "]", "Object toString(new " + arrType + "(3)) = " + r); + r = eval(arrType + ".prototype"); + test_own_data_prop_desc(r, "byteLength", false, false, false); + test_own_data_prop_desc(r, "byteOffset", false, false, false); + test_own_data_prop_desc(r, "length", false, false, false); + test_own_data_prop_desc(r, "buffer", false, false, false); + + try { + eval("new " + arrType + "(-1)"); + ok(false, "new " + arrType + "(-1) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(-1) threw " + n); + } + try { + eval("new " + arrType + "('9')"); + ok(false, "new " + arrType + "('9') did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_BAD_CTOR_ARG, "new " + arrType + "('9') threw " + n); + } + try { + eval("new " + arrType + "(null)"); + ok(false, "new " + arrType + "(null) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_BAD_CTOR_ARG, "new " + arrType + "(null) threw " + n); + } + + arr = eval("new " + arrType + "()"); + ok(arr.byteLength === 0, arrType + "().byteLength = " + arr.byteLength); + ok(arr.byteOffset === 0, arrType + "().byteOffset = " + arr.byteOffset); + ok(arr.length === 0, arrType + "().length = " + arr.length); + ok(arr.buffer.byteLength === 0, arrType + "().buffer.byteLength = " + arr.buffer.byteLength); + test_readonly(arr, "byteLength", 0); + test_readonly(arr, "byteOffset", 0); + test_readonly(arr, "length", 0); + test_own_data_prop_desc(arr, "byteLength", false, false, false); + test_own_data_prop_desc(arr, "byteOffset", false, false, false); + test_own_data_prop_desc(arr, "length", false, false, false); + test_own_data_prop_desc(arr, "buffer", false, false, false); + + Object.freeze(arr); + ok(Object.isFrozen(arr) === true, arrType + "() not frozen"); + + arr = eval(arrType + "(9.1)"); + ok(arr.byteLength === 9 * typeSz, arrType + "(9.1).byteLength = " + arr.byteLength); + ok(arr.byteOffset === 0, arrType + "(9.1).byteOffset = " + arr.byteOffset); + ok(arr.length === 9, arrType + "(9.1).length = " + arr.length); + ok(arr.buffer.byteLength === arr.byteLength, arrType + "(9.1).buffer.byteLength = " + arr.buffer.byteLength); + for(var j = 0; j < 9; j++) + ok(arr[j] === 0, "arr[" + j + "] = " + arr[j]); + arr[5] = 42; + ok(arr[5] === 42, arrType + "(9.1)[5] = " + arr[5]); + arr[9] = 50; + ok(arr[9] === undefined, arrType + "(9.1)[9] = " + arr[9]); + + eval(arrType + ".prototype[6] = 'foo'"); + r = eval(arrType + ".prototype[6]"); + ok(r === undefined, arrType + ".prototype[6] = " + r); + ok(arr[6] === 0, arrType + "(9.1)[6] after set in prototype = " + arr[6]); + arr[6] = 0; + ok(Object.prototype.hasOwnProperty.call(arr, "6"), "'6' not a property of " + arrType + "(9.1)[6]"); + test_own_data_prop_desc(arr, "6", true, true, false); + r = (delete arr[6]); + ok(r === false, "delete " + arrType + "(9.1)[6] returned " + r); + try { + Object.defineProperty(arr, "6", {writable: false, enumerable: false, configurable: true, value: 10}); + ok(false, "redefining " + arrType + "(9.1)[6] with different flags did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NONCONFIGURABLE_REDEFINED, "redefining " + arrType + "(9.1)[6] with different flags threw " + n); + } + Object.defineProperty(arr, "6", {writable: true, enumerable: true, configurable: false, value: 10}); + ok(arr[6] === 10, arrType + "(9.1)[6] after definition = " + arr[6]); + Object.defineProperty(arr, "6", {writable: true, enumerable: true, configurable: false, value: "foo"}); + if(arrType.substr(0, 5) === "Float") + ok(arr[6] !== arr[6] /* NaN */, arrType + "(9.1)[6] after definition to string = " + arr[6]); + else + ok(arr[6] === 0, arrType + "(9.1)[6] after definition to string = " + arr[6]); + + eval(arrType + ".prototype[100] = 'foobar'"); + r = eval(arrType + ".prototype[100]"); + ok(r === undefined, arrType + ".prototype[100] = " + r); + ok(arr[100] === undefined, arrType + "(9.1)[100] after set in prototype = " + arr[100]); + arr[100] = 0; + ok(arr[100] === undefined, arrType + "(9.1)[100] after set to zero = " + arr[100]); + ok(!Object.prototype.hasOwnProperty.call(arr, "100"), "'100' is a property of " + arrType + "(9.1)[100]"); + r = (delete arr[100]); + ok(r === false, "delete " + arrType + "(9.1)[100] returned " + r); + try { + Object.defineProperty(arr, "100", {writable: false, enumerable: false, configurable: true, value: 10}); + ok(false, "redefining " + arrType + "(9.1)[100] with different flags did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NONCONFIGURABLE_REDEFINED, "redefining " + arrType + "(9.1)[100] with different flags threw " + n); + } + Object.defineProperty(arr, "100", {writable: true, enumerable: true, configurable: false, value: 10}); + ok(arr[100] === undefined, arrType + "(9.1)[100] after defined to 10 = " + arr[100]); + ok(!Object.prototype.hasOwnProperty.call(arr, "100"), "'100' is a property of " + arrType + "(9.1)[100] after definition"); + ok(arr[100] === undefined, arrType + "(9.1)[100] after definition = " + arr[100]); + + r = 0; + for(var idx in arr) { + ok(idx === ""+r, arrType + "(9.1) enum idx " + r + " = " + idx); + r++; + } + ok(r === 9, arrType + "(9.1) enum did " + r + " iterations"); + + eval(arrType + ".prototype[-1] = 'barfoo'"); + r = eval(arrType + ".prototype[-1]"); + ok(r === "barfoo", arrType + ".prototype[-1] = " + r); + ok(arr[-1] === "barfoo", arrType + "(9.1)[-1] after set in prototype = " + arr[-1]); + + eval(arrType + ".prototype.foo = 'bar'"); + r = eval(arrType + ".prototype.foo = 'bar'"); + ok(r === "bar", arrType + ".prototype.foo = " + r); + ok(arr.foo === "bar", arrType + "(9.1).foo after set in prototype = " + arr.foo); + Object.freeze(arr); + ok(Object.isFrozen(arr) === true, arrType + "(9.1) not frozen"); + arr = eval(arrType + ".prototype"); + delete arr[-1]; + delete arr.foo; + } + + arr = new Int16Array(2); + arr[0] = 65535; + arr[1] = -65535; + ok(arr[0] == -1, "16-bit arr[0] after overflow = " + arr[0]); + ok(arr[1] == 1, "16-bit arr[1] after overflow = " + arr[1]); + + arr = new Uint8Array(2); + arr[0] = -2; + arr[1] = 258; + ok(arr[0] == 254, "8-bit arr[0] after overflow = " + arr[0]); + ok(arr[1] == 2, "8-bit arr[1] after overflow = " + arr[1]); + + arr = new Int8Array(); + arr2 = new Int32Array(); + + /* methods are incompatible, even though thrown error is not explicit */ + ok(Uint16Array.prototype.subarray !== Int32Array.prototype.subarray, "Uint16Array and Int32Array have same subarray methods"); + ok(Int8Array.prototype.set !== Float32Array.prototype.set, "Int8Array and Float32Array have same set methods"); + try { + Uint8Array.prototype.set.call(arr, [12, 50]); + ok(false, "calling Uint8Array's set with Int8Array context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_TYPEDARRAY, "calling Uint8Array's set with Int8Array context threw " + n); + } + try { + Uint32Array.prototype.subarray.call(arr2, 0); + ok(false, "calling Uint32Array's subarray with Int32Array context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_TYPEDARRAY, "calling Uint32Array's subarray with Int32Array context threw " + n); + } }); sync_test("builtin_context", function() { From f589b9767b7b107179193a0f5b8fe442eaf66c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:22 +0200 Subject: [PATCH 0926/1506] jscript: Implement Typed Array construction on ArrayBuffers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 35 ++++++++++++++++++++++-- dlls/mshtml/tests/es5.js | 57 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index 8d3c56a27ca..bb086609267 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -975,8 +975,39 @@ static HRESULT TypedArrayConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD fla if(!obj) return JS_E_TYPEDARRAY_BAD_CTOR_ARG; - FIXME("Construction from object not implemented\n"); - return E_NOTIMPL; + if(obj->builtin_info->class == JSCLASS_ARRAYBUFFER) { + ArrayBufferInstance *arraybuf = arraybuf_from_jsdisp(obj); + + if(argc > 1) { + hres = to_integer(ctx, argv[1], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0 || n > arraybuf->size) + return JS_E_TYPEDARRAY_INVALID_OFFSLEN; + offset = n; + if(offset % elem_size) + return JS_E_TYPEDARRAY_INVALID_OFFSLEN; + } + if(argc > 2 && !is_undefined(argv[2])) { + hres = to_integer(ctx, argv[2], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0 || n > UINT_MAX) + return JS_E_TYPEDARRAY_INVALID_OFFSLEN; + length = n; + if(offset + length * elem_size > arraybuf->size) + return JS_E_TYPEDARRAY_INVALID_OFFSLEN; + }else { + length = arraybuf->size - offset; + if(length % elem_size) + return JS_E_TYPEDARRAY_INVALID_OFFSLEN; + length /= elem_size; + } + buffer = jsdisp_addref(&arraybuf->dispex); + }else { + FIXME("Construction from object not implemented\n"); + return E_NOTIMPL; + } }else if(is_number(argv[0])) { hres = to_integer(ctx, argv[0], &n); if(FAILED(hres)) diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 3d0cdfb72c5..da3fd12b227 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2068,6 +2068,7 @@ sync_test("ArrayBuffers & Views", function() { test_own_data_prop_desc(r, "length", false, false, false); test_own_data_prop_desc(r, "buffer", false, false, false); + buf = ArrayBuffer(34); try { eval("new " + arrType + "(-1)"); ok(false, "new " + arrType + "(-1) did not throw exception"); @@ -2075,6 +2076,27 @@ sync_test("ArrayBuffers & Views", function() { var n = ex.number >>> 0; ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(-1) threw " + n); } + try { + eval("new " + arrType + "(buf, -1)"); + ok(false, "new " + arrType + "(buf, -1) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(buf, -1) threw " + n); + } + try { + eval("new " + arrType + "(buf, 36)"); + ok(false, "new " + arrType + "(buf, 36) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(buf, 36) threw " + n); + } + try { + eval("new " + arrType + "(buf, 32, 4)"); + ok(false, "new " + arrType + "(buf, 32, 4) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(buf, 32, 4) threw " + n); + } try { eval("new " + arrType + "('9')"); ok(false, "new " + arrType + "('9') did not throw exception"); @@ -2089,6 +2111,26 @@ sync_test("ArrayBuffers & Views", function() { var n = ex.number >>> 0; ok(n === JS_E_TYPEDARRAY_BAD_CTOR_ARG, "new " + arrType + "(null) threw " + n); } + if(typeSz > 1) { + /* test misalignment */ + var a = typeSz >>> 1; + try { + eval("new " + arrType + "(buf, a, 1)"); + ok(false, "new " + arrType + "(buf, " + a + ", 1) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(buf, " + a + ", 1) threw " + n); + } + a += typeSz; + var b = new ArrayBuffer(a); + try { + eval("new " + arrType + "(b)"); + ok(false, "new " + arrType + "(new ArrayBuffer(" + a + ")) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, "new " + arrType + "(new ArrayBuffer(" + a + ")) threw " + n); + } + } arr = eval("new " + arrType + "()"); ok(arr.byteLength === 0, arrType + "().byteLength = " + arr.byteLength); @@ -2184,6 +2226,21 @@ sync_test("ArrayBuffers & Views", function() { arr = eval(arrType + ".prototype"); delete arr[-1]; delete arr.foo; + + name = arrType + "(buf, " + typeSz + ", 2)"; + arr = eval(name); + ok(arr.byteLength === 2 * typeSz, name + ".byteLength = " + arr.byteLength); + ok(arr.byteOffset === typeSz, name + ".byteOffset = " + arr.byteOffset); + ok(arr.length === 2, name + ".length = " + arr.length); + ok(arr.buffer === buf, name + ".buffer = " + arr.buffer); + view = DataView(buf); + view["set" + types[i][0]](typeSz, 10, true); + ok(arr[0] === 10, "arr[0] after DataView(buf).set" + types[i][0] + " = " + arr[0]); + arr[0] = 12; + r = view["get" + types[i][0]](typeSz, true); + ok(r === 12, "DataView(buf).get" + types[i][0] + " after arr[0] set = " + r); + Object.freeze(arr); + ok(Object.isFrozen(arr) === true, name + " not frozen"); } arr = new Int16Array(2); From fcb51d7eff560c5f26e4d8a70a2c69c2f2731be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0927/1506] jscript: Implement ArrayBuffer.isView. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 15 +++++++++++++-- dlls/jscript/jscript.h | 2 ++ dlls/mshtml/tests/es5.js | 13 +++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index bb086609267..c50638652c8 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -179,9 +179,20 @@ static HRESULT create_arraybuf(script_ctx_t *ctx, DWORD size, jsdisp_t **ret) static HRESULT ArrayBufferConstr_isView(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - FIXME("not implemented\n"); + BOOL ret = FALSE; + jsdisp_t *obj; - return E_NOTIMPL; + TRACE("\n"); + + if(!r) + return S_OK; + + if(argc && is_object_instance(argv[0]) && (obj = to_jsdisp(get_object(argv[0]))) && + obj->builtin_info->class >= FIRST_VIEW_JSCLASS && obj->builtin_info->class <= LAST_VIEW_JSCLASS) + ret = TRUE; + + *r = jsval_bool(ret); + return S_OK; } static HRESULT ArrayBufferConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 11193992f3d..9bf25630597 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -132,6 +132,8 @@ typedef enum { FIRST_TYPEDARRAY_JSCLASS = JSCLASS_INT8ARRAY, LAST_TYPEDARRAY_JSCLASS = JSCLASS_FLOAT64ARRAY, + FIRST_VIEW_JSCLASS = JSCLASS_DATAVIEW, + LAST_VIEW_JSCLASS = JSCLASS_FLOAT64ARRAY, } jsclass_t; enum { NUM_TYPEDARRAY_TYPES = LAST_TYPEDARRAY_JSCLASS - FIRST_TYPEDARRAY_JSCLASS + 1 }; diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index da3fd12b227..155199f28ba 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -1767,6 +1767,13 @@ sync_test("ArrayBuffers & Views", function() { test_readonly(buf, "byteLength", 10); test_own_data_prop_desc(buf, "byteLength", false, false, false); + ok(ArrayBuffer.isView() === false, "ArrayBuffer.isView() returned true"); + ok(ArrayBuffer.isView([]) === false, "ArrayBuffer.isView([]) returned true"); + ok(ArrayBuffer.isView({}) === false, "ArrayBuffer.isView({}) returned true"); + ok(ArrayBuffer.isView(undefined) === false, "ArrayBuffer.isView(undefined) returned true"); + ok(ArrayBuffer.isView(null) === false, "ArrayBuffer.isView(null) returned true"); + ok(ArrayBuffer.isView(buf) === false, "ArrayBuffer.isView(ArrayBuffer) returned true"); + test_own_props("DataView.prototype", [ "buffer", "byteLength", "byteOffset", "getInt8", "setInt8", "getUint8", "setUint8", @@ -1887,6 +1894,9 @@ sync_test("ArrayBuffers & Views", function() { ok(view.byteLength === 10, "DataView(buf).byteLength = " + view.byteLength); ok(view.byteOffset === 0, "DataView(buf).byteOffset = " + view.byteOffset); + ok(ArrayBuffer.isView(DataView) === false, "ArrayBuffer.isView(DataView) returned true"); + ok(ArrayBuffer.isView(view) === true, "ArrayBuffer.isView(DataView(buf)) returned false"); + for(i = 0; i < 10; i++) { r = view.getInt8(i); ok(r === 0, "view byte " + i + " = " + r); @@ -2021,6 +2031,8 @@ sync_test("ArrayBuffers & Views", function() { ok(buf2.byteLength === 9, "buf.slice(-9).byteLength = " + buf2.byteLength); view2 = DataView(buf2, 1); ok(view2.byteLength === 8, "buf.slice(-9) view(1).byteLength = " + view2.byteLength); + ok(ArrayBuffer.isView(buf2) === false, "ArrayBuffer.isView(buf.slice(-9)) returned true"); + ok(ArrayBuffer.isView(view2) === true, "ArrayBuffer.isView(DataView(buf.slice(-9))) returned false"); r = view2.getUint32(0); ok(r === 4294967040, "buf.slice(-9) view(1).getUint32(0) returned " + r); @@ -2145,6 +2157,7 @@ sync_test("ArrayBuffers & Views", function() { test_own_data_prop_desc(arr, "length", false, false, false); test_own_data_prop_desc(arr, "buffer", false, false, false); + ok(ArrayBuffer.isView(arr) === true, "ArrayBuffer.isView(" + arrType + "()) returned false"); Object.freeze(arr); ok(Object.isFrozen(arr) === true, arrType + "() not frozen"); From 416e06de342bc8bc2b2cf02d27ce6d7b52dfaa2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0928/1506] jscript: Implement Typed Array construction from objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 67 ++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/es5.js | 47 +++++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 3 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index c50638652c8..63a602c8638 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -18,6 +18,7 @@ #include +#include #include "jscript.h" @@ -801,6 +802,40 @@ static HRESULT TypedArray_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_ return S_OK; } +static HRESULT fill_typedarr_data_from_object(script_ctx_t *ctx, BYTE *data, jsdisp_t *obj, DWORD length, jsclass_t jsclass) +{ + HRESULT hres = S_OK; + jsval_t val; + UINT32 i; + + switch(jsclass) { +#define X(NAME, JSCLASS, TYPE, CONVERT, NUM_TYPE) \ + case JSCLASS: \ + for(i = 0; i < length; i++) { \ + NUM_TYPE n; \ + \ + hres = jsdisp_get_idx(obj, i, &val); \ + if(FAILED(hres)) { \ + if(hres != DISP_E_UNKNOWNNAME) \ + break; \ + val = jsval_undefined(); \ + } \ + \ + hres = CONVERT(ctx, val, &n); \ + jsval_release(val); \ + if(FAILED(hres)) \ + break; \ + *(TYPE*)&data[i * sizeof(TYPE)] = n; \ + } \ + break; + TYPEDARRAY_LIST + DEFAULT_UNREACHABLE; +#undef X + } + + return hres; +} + static HRESULT TypedArray_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, jsclass_t jsclass) { @@ -1016,8 +1051,36 @@ static HRESULT TypedArrayConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD fla } buffer = jsdisp_addref(&arraybuf->dispex); }else { - FIXME("Construction from object not implemented\n"); - return E_NOTIMPL; + jsval_t val; + UINT32 len; + DWORD size; + + hres = jsdisp_propget_name(obj, L"length", &val); + if(FAILED(hres)) + return hres; + if(is_undefined(val)) + return JS_E_TYPEDARRAY_BAD_CTOR_ARG; + + hres = to_uint32(ctx, val, &len); + jsval_release(val); + if(FAILED(hres)) + return hres; + + length = len; + size = length * elem_size; + if(size < length || size > (UINT_MAX - FIELD_OFFSET(ArrayBufferInstance, buf[0]))) + return E_OUTOFMEMORY; + + hres = create_arraybuf(ctx, size, &buffer); + if(FAILED(hres)) + return hres; + + hres = fill_typedarr_data_from_object(ctx, arraybuf_from_jsdisp(buffer)->buf, + obj, length, jsclass); + if(FAILED(hres)) { + jsdisp_release(buffer); + return hres; + } } }else if(is_number(argv[0])) { hres = to_integer(ctx, argv[0], &n); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 155199f28ba..bf0fef5118d 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2123,6 +2123,13 @@ sync_test("ArrayBuffers & Views", function() { var n = ex.number >>> 0; ok(n === JS_E_TYPEDARRAY_BAD_CTOR_ARG, "new " + arrType + "(null) threw " + n); } + try { + eval("new " + arrType + "({})"); + ok(false, "new " + arrType + "({}) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_BAD_CTOR_ARG, "new " + arrType + "({}) threw " + n); + } if(typeSz > 1) { /* test misalignment */ var a = typeSz >>> 1; @@ -2240,6 +2247,23 @@ sync_test("ArrayBuffers & Views", function() { delete arr[-1]; delete arr.foo; + arr2 = { length: 4 }; + arr2[0] = 1.5; + arr2[1] = '3'; + arr2[3] = 12; + var name = arrType + "(array-like object)"; + arr = eval(arrType + "(arr2)"); + ok(arr.byteLength === 4 * typeSz, name + ".byteLength = " + arr.byteLength); + ok(arr.byteOffset === 0, name + ".byteOffset = " + arr.byteOffset); + ok(arr.length === 4, name + ".length = " + arr.length); + if(isNaN(arr[2])) { + ok(arr[0] === 1.5, name + "[0] = " + arr[0]); + ok(arr[1] === 3, name + "[1] = " + arr[1]); + ok(arr[3] === 12, name + "[3] = " + arr[3]); + }else + for(var j = 0; j < 4; j++) + ok(arr[j] === [1, 3, 0, 12][j], name + "[" + j + "] = " + arr[j]); + name = arrType + "(buf, " + typeSz + ", 2)"; arr = eval(name); ok(arr.byteLength === 2 * typeSz, name + ".byteLength = " + arr.byteLength); @@ -2254,7 +2278,28 @@ sync_test("ArrayBuffers & Views", function() { ok(r === 12, "DataView(buf).get" + types[i][0] + " after arr[0] set = " + r); Object.freeze(arr); ok(Object.isFrozen(arr) === true, name + " not frozen"); - } + + arr2 = eval(arrType + "(arr)"); + ok(arr2.byteLength === arr.byteLength, name + " copy.byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === 0, name + " copy.byteOffset = " + arr2.byteOffset); + ok(arr2.length === arr.length, name + " copy.length = " + arr2.length); + ok(arr2.buffer !== arr.buffer, name + " copy.buffer = " + arr2.buffer); + } + + arr = new Float32Array(3); + arr[0] = 1.125; + arr[1] = 2.25; + arr[2] = 3.375; + arr2 = new Uint16Array(arr); + ok(arr[0] === 1.125, "arr[0] = " + arr[0]); + ok(arr[1] === 2.25, "arr[1] = " + arr[1]); + ok(arr[2] === 3.375, "arr[2] = " + arr[2]); + ok(arr2[0] === 1, "arr2[0] = " + arr2[0]); + ok(arr2[1] === 2, "arr2[1] = " + arr2[1]); + ok(arr2[2] === 3, "arr2[2] = " + arr2[2]); + arr2[0] = 100; + ok(arr[0] === 1.125, "arr[0] after arr2[0] changed = " + arr[0]); + ok(arr2[0] === 100, "arr2[0] after change = " + arr2[0]); arr = new Int16Array(2); arr[0] = 65535; From 147460b6cc07463fb59c733da0df02c23ff93539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0929/1506] jscript: Implement 'subarray' for Typed Arrays. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 44 ++++++++++++++++++++++++++++++-- dlls/jscript/error.c | 1 + dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/es5.js | 55 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 101 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index 63a602c8638..489bfade2c7 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -770,6 +770,8 @@ static inline TypedArrayInstance *typedarr_this(jsval_t vthis, jsclass_t jsclass return (jsdisp && is_class(jsdisp, jsclass)) ? typedarr_from_jsdisp(jsdisp) : NULL; } +static HRESULT create_typedarr(script_ctx_t*,jsclass_t,jsdisp_t*,DWORD,DWORD,jsdisp_t**); + static HRESULT TypedArray_get_buffer(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { TRACE("%p\n", jsthis); @@ -852,12 +854,50 @@ static HRESULT TypedArray_subarray(script_ctx_t *ctx, jsval_t vthis, WORD flags, jsval_t *r, jsclass_t jsclass) { TypedArrayInstance *typedarr; + DWORD begin = 0, end; + jsdisp_t *obj; + HRESULT hres; + double n; - FIXME("not implemented\n"); + TRACE("\n"); if(!(typedarr = typedarr_this(vthis, jsclass))) return JS_E_NOT_TYPEDARRAY; - return E_NOTIMPL; + if(!argc) + return JS_E_TYPEDARRAY_INVALID_SUBARRAY; + if(!r) + return S_OK; + + hres = to_integer(ctx, argv[0], &n); + if(FAILED(hres)) + return hres; + end = typedarr->length; + if(n < 0.0) + n += typedarr->length; + if(n >= 0.0) + begin = n < typedarr->length ? n : typedarr->length; + + if(argc > 1 && !is_undefined(argv[1])) { + hres = to_integer(ctx, argv[1], &n); + if(FAILED(hres)) + return hres; + if(n < 0.0) + n += typedarr->length; + if(n >= 0.0) { + end = n < typedarr->length ? n : typedarr->length; + end = end < begin ? begin : end; + }else + end = begin; + } + + hres = create_typedarr(ctx, jsclass, typedarr->buffer, + typedarr->offset + begin * TypedArray_elem_size[TYPEDARRAY_INDEX(jsclass)], + end - begin, &obj); + if(FAILED(hres)) + return hres; + + *r = jsval_obj(obj); + return S_OK; } static unsigned TypedArray_idx_length(jsdisp_t *jsdisp) diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index aa5399d02c3..ca45697e74a 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -500,6 +500,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_PRECISION_OUT_OF_RANGE: case JS_E_INVALID_LENGTH: case JS_E_TYPEDARRAY_INVALID_OFFSLEN: + case JS_E_TYPEDARRAY_INVALID_SUBARRAY: case JS_E_DATAVIEW_INVALID_ACCESS: case JS_E_DATAVIEW_INVALID_OFFSET: constr = ctx->range_error_constr; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 9bf25630597..594531ff031 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -600,6 +600,7 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_TYPEDARRAY_BAD_CTOR_ARG MAKE_JSERROR(IDS_TYPEDARRAY_BAD_CTOR_ARG) #define JS_E_NOT_TYPEDARRAY MAKE_JSERROR(IDS_NOT_TYPEDARRAY) #define JS_E_TYPEDARRAY_INVALID_OFFSLEN MAKE_JSERROR(IDS_TYPEDARRAY_INVALID_OFFSLEN) +#define JS_E_TYPEDARRAY_INVALID_SUBARRAY MAKE_JSERROR(IDS_TYPEDARRAY_INVALID_SUBARRAY) #define JS_E_NOT_DATAVIEW MAKE_JSERROR(IDS_NOT_DATAVIEW) #define JS_E_DATAVIEW_NO_ARGUMENT MAKE_JSERROR(IDS_DATAVIEW_NO_ARGUMENT) #define JS_E_DATAVIEW_INVALID_ACCESS MAKE_JSERROR(IDS_DATAVIEW_INVALID_ACCESS) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index a224b6cd6f3..b3036ffe435 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -79,6 +79,7 @@ STRINGTABLE IDS_NOT_TYPEDARRAY "'this' is not a typed array object" IDS_TYPEDARRAY_BAD_CTOR_ARG "Typed array constructor argument is invalid" IDS_TYPEDARRAY_INVALID_OFFSLEN "Invalid offset/length when creating typed array" + IDS_TYPEDARRAY_INVALID_SUBARRAY "Invalid begin/end value in typed array subarray method" IDS_NOT_DATAVIEW "'this' is not a DataView object" IDS_DATAVIEW_NO_ARGUMENT "Required argument offset or value in DataView method is not specified" IDS_DATAVIEW_INVALID_ACCESS "DataView operation access beyond specified buffer length" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index feb2593e723..91d99048858 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -77,6 +77,7 @@ #define IDS_TYPEDARRAY_BAD_CTOR_ARG 0x13DA #define IDS_NOT_TYPEDARRAY 0x13DB #define IDS_TYPEDARRAY_INVALID_OFFSLEN 0x13DC +#define IDS_TYPEDARRAY_INVALID_SUBARRAY 0x13DD #define IDS_NOT_DATAVIEW 0x13DF #define IDS_DATAVIEW_NO_ARGUMENT 0x13E0 #define IDS_DATAVIEW_INVALID_ACCESS 0x13E1 diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index bf0fef5118d..830f8569fc3 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -35,6 +35,7 @@ var JS_E_NONWRITABLE_MODIFIED = 0x800a13d7; var JS_E_TYPEDARRAY_BAD_CTOR_ARG = 0x800a13da; var JS_E_NOT_TYPEDARRAY = 0x800a13db; var JS_E_TYPEDARRAY_INVALID_OFFSLEN = 0x800a13dc; +var JS_E_TYPEDARRAY_INVALID_SUBARRAY = 0x800a13dd; var JS_E_NOT_DATAVIEW = 0x800a13df; var JS_E_DATAVIEW_NO_ARGUMENT = 0x800a13e0; var JS_E_DATAVIEW_INVALID_ACCESS = 0x800a13e1; @@ -2284,6 +2285,60 @@ sync_test("ArrayBuffers & Views", function() { ok(arr2.byteOffset === 0, name + " copy.byteOffset = " + arr2.byteOffset); ok(arr2.length === arr.length, name + " copy.length = " + arr2.length); ok(arr2.buffer !== arr.buffer, name + " copy.buffer = " + arr2.buffer); + arr2 = arr.subarray(undefined, "1"); + ok(arr2.byteLength === typeSz, name + " subarray(undefined, '1').byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === arr.byteOffset, name + " subarray(undefined, '1').byteOffset = " + arr2.byteOffset); + ok(arr2.length === 1, name + " subarray(undefined, '1').length = " + arr2.length); + ok(arr2.buffer === arr.buffer, name + " subarray(undefined, '1').buffer = " + arr2.buffer); + + name = arrType + "(10)"; + arr = eval(name); + try { + arr.subarray.call(null, 0); + ok(false, arrType + ": calling subarray with null context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_TYPEDARRAY, arrType + ": calling subarray with null context threw " + n); + } + try { + arr.subarray.call({}, 0); + ok(false, arrType + ": calling subarray with an object context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_TYPEDARRAY, arrType + ": calling subarray with an object context threw " + n); + } + try { + arr.subarray(); + ok(false, name + " subarray() did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_SUBARRAY, name + " subarray() threw " + n); + } + arr2 = arr.subarray(4); + ok(arr2.byteLength === 6 * typeSz, name + ".subarray(4).byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === 4 * typeSz, name + ".subarray(4).byteOffset = " + arr2.byteOffset); + ok(arr2.length === 6, name + ".subarray(4).length = " + arr2.length); + ok(arr2.buffer === arr.buffer, name + ".subarray(4).buffer = " + arr2.buffer); + arr2 = arr.subarray(4, 2); + ok(arr2.byteLength === 0, name + ".subarray(4, 2).byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === 4 * typeSz, name + ".subarray(4, 2).byteOffset = " + arr2.byteOffset); + ok(arr2.length === 0, name + ".subarray(4, 2).length = " + arr2.length); + ok(arr2.buffer === arr.buffer, name + ".subarray(4, 2).buffer = " + arr2.buffer); + arr2 = arr.subarray(-3, 100); + ok(arr2.byteLength === 3 * typeSz, name + ".subarray(-3, 100).byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === 7 * typeSz, name + ".subarray(-3, 100).byteOffset = " + arr2.byteOffset); + ok(arr2.length === 3, name + ".subarray(-3, 100).length = " + arr2.length); + ok(arr2.buffer === arr.buffer, name + ".subarray(-3, 100).buffer = " + arr2.buffer); + arr2 = arr.subarray(42, -1); + ok(arr2.byteLength === 0, name + ".subarray(42, -1).byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === 10 * typeSz, name + ".subarray(42, -1).byteOffset = " + arr2.byteOffset); + ok(arr2.length === 0, name + ".subarray(42, -1).length = " + arr2.length); + ok(arr2.buffer === arr.buffer, name + ".subarray(42, -1).buffer = " + arr2.buffer); + arr2 = arr.subarray(2, -3); + ok(arr2.byteLength === 5 * typeSz, name + ".subarray(2, -3).byteLength = " + arr2.byteLength); + ok(arr2.byteOffset === 2 * typeSz, name + ".subarray(2, -3).byteOffset = " + arr2.byteOffset); + ok(arr2.length === 5, name + ".subarray(2, -3).length = " + arr2.length); + ok(arr2.buffer === arr.buffer, name + ".subarray(2, -3).buffer = " + arr2.buffer); } arr = new Float32Array(3); From c6f9ea86e24f0c22261f2ec62102b50de6945504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0930/1506] jscript: Implement 'set' for Typed Arrays. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 75 ++++++++++++++++++++++++++++++- dlls/jscript/error.c | 1 + dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/es5.js | 97 +++++++++++++++++++++++++++++++++++++++- 6 files changed, 172 insertions(+), 4 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index 489bfade2c7..e8a7472c508 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -841,13 +841,84 @@ static HRESULT fill_typedarr_data_from_object(script_ctx_t *ctx, BYTE *data, jsd static HRESULT TypedArray_set(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, jsclass_t jsclass) { + const unsigned elem_size = TypedArray_elem_size[TYPEDARRAY_INDEX(jsclass)]; TypedArrayInstance *typedarr; + DWORD begin = 0, size; + BYTE *dest, *data; + IDispatch *disp; + jsdisp_t *obj; + HRESULT hres; + jsval_t val; + UINT32 len; + double n; - FIXME("not implemented\n"); + TRACE("\n"); if(!(typedarr = typedarr_this(vthis, jsclass))) return JS_E_NOT_TYPEDARRAY; - return E_NOTIMPL; + if(!argc) + return JS_E_TYPEDARRAY_INVALID_SOURCE; + + hres = to_object(ctx, argv[0], &disp); + if(FAILED(hres)) + return JS_E_TYPEDARRAY_INVALID_SOURCE; + + if(!(obj = to_jsdisp(disp))) { + FIXME("Non-JS array object\n"); + hres = JS_E_TYPEDARRAY_INVALID_SOURCE; + goto done; + } + + hres = jsdisp_propget_name(obj, L"length", &val); + if(FAILED(hres)) + goto done; + + hres = to_uint32(ctx, val, &len); + jsval_release(val); + if(FAILED(hres)) + goto done; + + if(argc > 1) { + hres = to_integer(ctx, argv[1], &n); + if(FAILED(hres)) + goto done; + if(n < 0.0 || n > typedarr->length) { + hres = JS_E_TYPEDARRAY_INVALID_OFFSLEN; + goto done; + } + begin = n; + } + + if(len > typedarr->length - begin) { + hres = JS_E_TYPEDARRAY_INVALID_OFFSLEN; + goto done; + } + size = len * elem_size; + dest = data = &arraybuf_from_jsdisp(typedarr->buffer)->buf[typedarr->offset + begin * elem_size]; + + /* If they overlap, make a temporary copy */ + if(obj->builtin_info->class >= FIRST_TYPEDARRAY_JSCLASS && obj->builtin_info->class <= LAST_TYPEDARRAY_JSCLASS) { + TypedArrayInstance *src_arr = typedarr_from_jsdisp(obj); + const BYTE *src = arraybuf_from_jsdisp(src_arr->buffer)->buf + src_arr->offset; + + if(dest < src + len * TypedArray_elem_size[TYPEDARRAY_INDEX(obj->builtin_info->class)] && + dest + size > src) { + if(!(data = malloc(size))) { + hres = E_OUTOFMEMORY; + goto done; + } + } + } + + hres = fill_typedarr_data_from_object(ctx, data, obj, len, jsclass); + if(SUCCEEDED(hres) && dest != data) { + memcpy(dest, data, size); + free(data); + } + +done: + IDispatch_Release(disp); + return hres; } static HRESULT TypedArray_subarray(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index ca45697e74a..4902940517c 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -485,6 +485,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_NONWRITABLE_MODIFIED: case JS_E_TYPEDARRAY_BAD_CTOR_ARG: case JS_E_NOT_TYPEDARRAY: + case JS_E_TYPEDARRAY_INVALID_SOURCE: case JS_E_NOT_DATAVIEW: case JS_E_DATAVIEW_NO_ARGUMENT: case JS_E_WRONG_THIS: diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 594531ff031..8c2b4103825 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -601,6 +601,7 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_NOT_TYPEDARRAY MAKE_JSERROR(IDS_NOT_TYPEDARRAY) #define JS_E_TYPEDARRAY_INVALID_OFFSLEN MAKE_JSERROR(IDS_TYPEDARRAY_INVALID_OFFSLEN) #define JS_E_TYPEDARRAY_INVALID_SUBARRAY MAKE_JSERROR(IDS_TYPEDARRAY_INVALID_SUBARRAY) +#define JS_E_TYPEDARRAY_INVALID_SOURCE MAKE_JSERROR(IDS_TYPEDARRAY_INVALID_SOURCE) #define JS_E_NOT_DATAVIEW MAKE_JSERROR(IDS_NOT_DATAVIEW) #define JS_E_DATAVIEW_NO_ARGUMENT MAKE_JSERROR(IDS_DATAVIEW_NO_ARGUMENT) #define JS_E_DATAVIEW_INVALID_ACCESS MAKE_JSERROR(IDS_DATAVIEW_INVALID_ACCESS) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index b3036ffe435..6feec39d084 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -80,6 +80,7 @@ STRINGTABLE IDS_TYPEDARRAY_BAD_CTOR_ARG "Typed array constructor argument is invalid" IDS_TYPEDARRAY_INVALID_OFFSLEN "Invalid offset/length when creating typed array" IDS_TYPEDARRAY_INVALID_SUBARRAY "Invalid begin/end value in typed array subarray method" + IDS_TYPEDARRAY_INVALID_SOURCE "Invalid source in typed array set" IDS_NOT_DATAVIEW "'this' is not a DataView object" IDS_DATAVIEW_NO_ARGUMENT "Required argument offset or value in DataView method is not specified" IDS_DATAVIEW_INVALID_ACCESS "DataView operation access beyond specified buffer length" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index 91d99048858..48572bd4992 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -78,6 +78,7 @@ #define IDS_NOT_TYPEDARRAY 0x13DB #define IDS_TYPEDARRAY_INVALID_OFFSLEN 0x13DC #define IDS_TYPEDARRAY_INVALID_SUBARRAY 0x13DD +#define IDS_TYPEDARRAY_INVALID_SOURCE 0x13DE #define IDS_NOT_DATAVIEW 0x13DF #define IDS_DATAVIEW_NO_ARGUMENT 0x13E0 #define IDS_DATAVIEW_INVALID_ACCESS 0x13E1 diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 830f8569fc3..3d199136e8e 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -36,6 +36,7 @@ var JS_E_TYPEDARRAY_BAD_CTOR_ARG = 0x800a13da; var JS_E_NOT_TYPEDARRAY = 0x800a13db; var JS_E_TYPEDARRAY_INVALID_OFFSLEN = 0x800a13dc; var JS_E_TYPEDARRAY_INVALID_SUBARRAY = 0x800a13dd; +var JS_E_TYPEDARRAY_INVALID_SOURCE = 0x800a13de; var JS_E_NOT_DATAVIEW = 0x800a13df; var JS_E_DATAVIEW_NO_ARGUMENT = 0x800a13e0; var JS_E_DATAVIEW_INVALID_ACCESS = 0x800a13e1; @@ -2339,6 +2340,87 @@ sync_test("ArrayBuffers & Views", function() { ok(arr2.byteOffset === 2 * typeSz, name + ".subarray(2, -3).byteOffset = " + arr2.byteOffset); ok(arr2.length === 5, name + ".subarray(2, -3).length = " + arr2.length); ok(arr2.buffer === arr.buffer, name + ".subarray(2, -3).buffer = " + arr2.buffer); + + try { + arr.set.call(null, [1]); + ok(false, arrType + ": calling set with null context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_TYPEDARRAY, arrType + ": calling set with null context threw " + n); + } + try { + arr.set.call({}, [1]); + ok(false, arrType + ": calling set with an object context did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_NOT_TYPEDARRAY, arrType + ": calling set with an object context threw " + n); + } + try { + arr.set(); + ok(false, name + ".set() did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_SOURCE, name + ".set() threw " + n); + } + try { + arr.set(null); + ok(false, name + ".set(null) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_SOURCE, name + ".set(null) threw " + n); + } + try { + arr.set([1,2,3], 8); + ok(false, name + ".set([1,2,3], 8) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, name + ".set([1,2,3], 8) threw " + n); + } + try { + arr.set([99], -3); + ok(false, name + ".set([99], -3) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === JS_E_TYPEDARRAY_INVALID_OFFSLEN, name + ".set([99], -3) threw " + n); + } + + r = arr.set(5); + ok(r === undefined, name + ".set(5) returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === 0, name + ".set(5): arr[" + j + "] = " + arr[j]); + + r = arr.set({}); + ok(r === undefined, name + ".set({}) returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === 0, name + ".set({}): arr[" + j + "] = " + arr[j]); + + r = arr.set("12"); + ok(r === undefined, name + ".set('12') returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === [ 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 ][j], name + ".set('12'): arr[" + j + "] = " + arr[j]); + + arr2 = { length: 2 }; + arr2[0] = 9; + arr2[1] = 7; + r = arr.set(arr2); + ok(r === undefined, name + ".set(array-like obj) returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === [ 9, 7, 0, 0, 0, 0, 0, 0, 0, 0 ][j], name + ".set(array-like obj): arr[" + j + "] = " + arr[j]); + + r = arr.set([12, 10, 11], 3); + ok(r === undefined, name + ".set([12, 10, 11], 3) returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === [ 9, 7, 0, 12, 10, 11, 0, 0, 0, 0 ][j], name + ".set([12, 10, 11], 3): arr[" + j + "] = " + arr[j]); + + r = arr.set(arr.subarray(4, 6), 5); + ok(r === undefined, name + ".set(arr.subarray(4, 2), 5) returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === [ 9, 7, 0, 12, 10, 10, 11, 0, 0, 0 ][j], name + ".set(arr.subarray(4, 2), 5): arr[" + j + "] = " + arr[j]); + + r = arr.set(arr.subarray(3, 7), 2); + ok(r === undefined, name + ".set(arr.subarray(3, 7), 2) returned " + r); + for(var j = 0; j < 10; j++) + ok(arr[j] === [ 9, 7, 12, 10, 10, 11, 11, 0, 0, 0 ][j], name + ".set(arr.subarray(3, 7), 2): arr[" + j + "] = " + arr[j]); } arr = new Float32Array(3); @@ -2368,8 +2450,19 @@ sync_test("ArrayBuffers & Views", function() { ok(arr[0] == 254, "8-bit arr[0] after overflow = " + arr[0]); ok(arr[1] == 2, "8-bit arr[1] after overflow = " + arr[1]); - arr = new Int8Array(); - arr2 = new Int32Array(); + arr = new Int8Array(12); + arr.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); + for(var j = 0; j < 12; j++) + ok(arr[j] === j + 1, "sequential arr[" + j + "] = " + arr[j]); + arr2 = new Int32Array(arr.buffer); + ok(arr2.buffer === arr.buffer, "arr2.buffer = " + arr2.buffer); + for(var j = 0; j < 3; j++) + ok(arr2[j] === [ 0x04030201, 0x08070605, 0x0c0b0a09 ][j], "sequential 32-bit arr[" + j + "] = " + arr2[j]); + + /* test overlap */ + arr2.set(arr.subarray(1, 4)); + for(var j = 0; j < 3; j++) + ok(arr2[j] === j + 2, "arr with overlap[" + j + "] = " + arr[j]); /* methods are incompatible, even though thrown error is not explicit */ ok(Uint16Array.prototype.subarray !== Int32Array.prototype.subarray, "Uint16Array and Int32Array have same subarray methods"); From 0fbee3ca728069d8a40b01dfa6c30a87d33f07f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0931/1506] jscript: Implement Uint8ClampedArray. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 18 ++++++++++++++++++ dlls/jscript/jscript.h | 1 + dlls/jscript/object.c | 1 + dlls/mshtml/tests/es5.js | 12 ++++++++++++ 4 files changed, 32 insertions(+) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index e8a7472c508..e5c22df53c4 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -17,6 +17,7 @@ */ +#include #include #include @@ -744,11 +745,28 @@ static const builtin_info_t DataViewConstr_info = { NULL }; +static HRESULT clamped_u8(script_ctx_t *ctx, jsval_t v, UINT8 *ret) +{ + HRESULT hres; + double n; + + hres = to_number(ctx, v, &n); + if(FAILED(hres)) + return hres; + + if(!isfinite(n)) + *ret = (n == INFINITY ? 255 : 0); + else + *ret = (n >= 255.0 ? 255 : n <= 0 ? 0 : lround(n)); + return S_OK; +} + #define TYPEDARRAY_LIST \ X(Int8Array, JSCLASS_INT8ARRAY, INT8, to_int32, INT) \ X(Int16Array, JSCLASS_INT16ARRAY, INT16, to_int32, INT) \ X(Int32Array, JSCLASS_INT32ARRAY, INT32, to_int32, INT) \ X(Uint8Array, JSCLASS_UINT8ARRAY, UINT8, to_int32, INT) \ +X(Uint8ClampedArray, JSCLASS_UINT8CLAMPEDARRAY, UINT8, clamped_u8, UINT8) \ X(Uint16Array, JSCLASS_UINT16ARRAY, UINT16, to_int32, INT) \ X(Uint32Array, JSCLASS_UINT32ARRAY, UINT32, to_int32, INT) \ X(Float32Array, JSCLASS_FLOAT32ARRAY, float, to_number, double) \ diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 8c2b4103825..a955f34600b 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -122,6 +122,7 @@ typedef enum { JSCLASS_INT16ARRAY, JSCLASS_INT32ARRAY, JSCLASS_UINT8ARRAY, + JSCLASS_UINT8CLAMPEDARRAY, JSCLASS_UINT16ARRAY, JSCLASS_UINT32ARRAY, JSCLASS_FLOAT32ARRAY, diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 1b33f481b3b..a918b55f020 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -56,6 +56,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns L"[object Int16Array]", L"[object Int32Array]", L"[object Uint8Array]", + L"[object Uint8ClampedArray]", L"[object Uint16Array]", L"[object Uint32Array]", L"[object Float32Array]", diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 3d199136e8e..1213eb48a4f 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2481,6 +2481,18 @@ sync_test("ArrayBuffers & Views", function() { var n = ex.number >>> 0; ok(n === JS_E_NOT_TYPEDARRAY, "calling Uint32Array's subarray with Int32Array context threw " + n); } + + /* clamped array */ + arr = new Uint8ClampedArray(7); + arr2 = new Uint8Array(7); + arr.set ([42, -1, 999, 0.9, NaN, Infinity, -Infinity]); + arr2.set([42, -1, 999, 0.9, NaN, Infinity, -Infinity]); + for(var j = 0; j < 7; j++) { + ok(arr[j] === [42, 0, 255, 1, 0, 255, 0][j], "clamped arr[" + j + "] = " + arr[j]); + ok(arr2[j] === [42, 255, 231, 0, 0, 0, 0][j], "non-clamped arr[" + j + "] = " + arr2[j]); + } + r = Object.prototype.toString.call(arr); + ok(r === "[object Uint8ClampedArray]", "Object toString for Uint8ClampedArray = " + r); }); sync_test("builtin_context", function() { From d557e781ca3e3535916f088e331de1c3388f6ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0932/1506] mshtml: Add window.msCrypto stub. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlwindow.c | 24 +++++ dlls/mshtml/mshtml_private.h | 4 +- dlls/mshtml/mshtml_private_iface.idl | 18 ++++ dlls/mshtml/omnavigator.c | 146 +++++++++++++++++++++++++++ dlls/mshtml/tests/documentmode.js | 11 ++ 5 files changed, 202 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index b088bc00dfc..dbde061aeb3 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3429,6 +3429,21 @@ static HRESULT WINAPI window_private_get_console(IWineHTMLWindowPrivate *iface, return S_OK; } +static HRESULT WINAPI window_private_get_msCrypto(IWineHTMLWindowPrivate *iface, IDispatch **crypto) +{ + HTMLInnerWindow *This = impl_from_IWineHTMLWindowPrivateVtbl(iface)->inner_window; + + TRACE("iface %p, crypto %p.\n", iface, crypto); + + if(!This->crypto) + create_crypto(This, &This->crypto); + + *crypto = (IDispatch*)This->crypto; + if(This->crypto) + IWineMSHTMLCrypto_AddRef(This->crypto); + return S_OK; +} + static HRESULT WINAPI window_private_get_MutationObserver(IWineHTMLWindowPrivate *iface, IDispatch **mutation_observer) { @@ -3461,6 +3476,7 @@ static const IWineHTMLWindowPrivateVtbl WineHTMLWindowPrivateVtbl = { window_private_cancelAnimationFrame, window_private_get_console, window_private_matchMedia, + window_private_get_msCrypto, window_private_get_MutationObserver }; @@ -4003,6 +4019,8 @@ static void HTMLWindow_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCa note_cc_edge((nsISupports*)This->session_storage, "session_storage", cb); if(This->local_storage) note_cc_edge((nsISupports*)This->local_storage, "local_storage", cb); + if(This->crypto) + note_cc_edge((nsISupports*)This->crypto, "crypto", cb); if(This->dom_window) note_cc_edge((nsISupports*)This->dom_window, "dom_window", cb); traverse_variant(&This->performance, "performance", cb); @@ -4058,6 +4076,11 @@ static void HTMLWindow_unlink(DispatchEx *dispex) This->local_storage = NULL; IHTMLStorage_Release(local_storage); } + if(This->crypto) { + IWineMSHTMLCrypto *crypto = This->crypto; + This->crypto = NULL; + IWineMSHTMLCrypto_Release(crypto); + } unlink_variant(&This->performance); unlink_ref(&This->dom_window); } @@ -4361,6 +4384,7 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa /* Hide props not available in IE10 */ static const dispex_hook_t private_ie10_hooks[] = { + {DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO}, {DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER}, {DISPID_UNKNOWN} }; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 2f61f4558c0..1c3681558fc 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -295,6 +295,7 @@ typedef struct EventTarget EventTarget; XIID(IWinePageTransitionEvent) \ XIID(IWineXMLHttpRequestPrivate) \ XIID(IWineMSHTMLConsole) \ + XIID(IWineMSHTMLCrypto) \ XIID(IWineMSHTMLMediaQueryList) \ XIID(IWineMSHTMLMutationObserver) @@ -597,6 +598,7 @@ struct HTMLInnerWindow { IHTMLStorage *session_storage; IHTMLStorage *local_storage; IWineMSHTMLConsole *console; + IWineMSHTMLCrypto *crypto; BOOL performance_initialized; VARIANT performance; @@ -1500,6 +1502,6 @@ IInternetSecurityManager *get_security_manager(void); extern HINSTANCE hInst; void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret); +void create_crypto(HTMLInnerWindow *window, IWineMSHTMLCrypto **ret); HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch **ret); - HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret); diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index 503593d1c25..f8da68d96a9 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -113,6 +113,22 @@ interface IWineMSHTMLMediaQueryList : IDispatch HRESULT removeListener([in] VARIANT *listener); } +[ + odl, + oleautomation, + dual, + hidden, + uuid(fd55b4b6-2813-4fb4-829d-380099474ab2) +] +interface IWineMSHTMLCrypto : IDispatch +{ + [propget, id(1)] + HRESULT subtle([retval, out] IDispatch **subtle); + [id(2)] + HRESULT getRandomValues([in] VARIANT *typedArray, [retval, out] IDispatch **ret); +} + +const long DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO = 54; const long DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER = 55; [ odl, @@ -131,6 +147,8 @@ interface IWineHTMLWindowPrivate : IDispatch HRESULT console([retval, out] IDispatch **console); [id(53)] HRESULT matchMedia([in] BSTR media_query, [retval, out] IDispatch **media_query_list); + [propget, id(DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO)] + HRESULT msCrypto([retval, out] IDispatch **crypto); [propget, id(DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER)] HRESULT MutationObserver([retval, out] IDispatch **observer_ctor); } diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index db7da8276ef..406b57479e6 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -3079,3 +3079,149 @@ HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch *ret = (IDispatch*)&media_query_list->IWineMSHTMLMediaQueryList_iface; return S_OK; } + +struct crypto { + DispatchEx dispex; + IWineMSHTMLCrypto IWineMSHTMLCrypto_iface; +}; + +static inline struct crypto *impl_from_IWineMSHTMLCrypto(IWineMSHTMLCrypto *iface) +{ + return CONTAINING_RECORD(iface, struct crypto, IWineMSHTMLCrypto_iface); +} + +static HRESULT WINAPI crypto_QueryInterface(IWineMSHTMLCrypto *iface, REFIID riid, void **ppv) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + return IDispatchEx_QueryInterface(&crypto->dispex.IDispatchEx_iface, riid, ppv); +} + +static ULONG WINAPI crypto_AddRef(IWineMSHTMLCrypto *iface) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + return IDispatchEx_AddRef(&crypto->dispex.IDispatchEx_iface); +} + +static ULONG WINAPI crypto_Release(IWineMSHTMLCrypto *iface) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + return IDispatchEx_Release(&crypto->dispex.IDispatchEx_iface); +} + +static HRESULT WINAPI crypto_GetTypeInfoCount(IWineMSHTMLCrypto *iface, UINT *pctinfo) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + + TRACE("(%p)->(%p)\n", crypto, pctinfo); + + return IDispatchEx_GetTypeInfoCount(&crypto->dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI crypto_GetTypeInfo(IWineMSHTMLCrypto *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + + return IDispatchEx_GetTypeInfo(&crypto->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI crypto_GetIDsOfNames(IWineMSHTMLCrypto *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + + return IDispatchEx_GetIDsOfNames(&crypto->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI crypto_Invoke(IWineMSHTMLCrypto *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + + return IDispatchEx_Invoke(&crypto->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI crypto_get_subtle(IWineMSHTMLCrypto *iface, IDispatch **subtle) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + + FIXME("(%p)->(%p)\n", crypto, subtle); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_getRandomValues(IWineMSHTMLCrypto *iface, VARIANT *typedArray, IDispatch **ret) +{ + struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + + FIXME("(%p)->(%p %p)\n", crypto, typedArray, ret); + + return E_NOTIMPL; +} + +static const IWineMSHTMLCryptoVtbl WineMSHTMLCryptoVtbl = { + crypto_QueryInterface, + crypto_AddRef, + crypto_Release, + crypto_GetTypeInfoCount, + crypto_GetTypeInfo, + crypto_GetIDsOfNames, + crypto_Invoke, + crypto_get_subtle, + crypto_getRandomValues +}; + +static inline struct crypto *crypto_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct crypto, dispex); +} + +static void *crypto_query_interface(DispatchEx *dispex, REFIID riid) +{ + struct crypto *This = crypto_from_DispatchEx(dispex); + + if(IsEqualGUID(&IID_IWineMSHTMLCrypto, riid)) + return &This->IWineMSHTMLCrypto_iface; + + return NULL; +} + +static void crypto_destructor(DispatchEx *dispex) +{ + struct crypto *This = crypto_from_DispatchEx(dispex); + free(This); +} + +static const dispex_static_data_vtbl_t crypto_dispex_vtbl = { + .query_interface = crypto_query_interface, + .destructor = crypto_destructor, +}; + +static const tid_t crypto_iface_tids[] = { + IWineMSHTMLCrypto_tid, + 0 +}; +static dispex_static_data_t crypto_dispex = { + "Crypto", + &crypto_dispex_vtbl, + IWineMSHTMLCrypto_tid, + crypto_iface_tids +}; + +void create_crypto(HTMLInnerWindow *window, IWineMSHTMLCrypto **ret) +{ + struct crypto *obj; + + if(!(obj = calloc(1, sizeof(*obj)))) { + ERR("No memory.\n"); + return; + } + + obj->IWineMSHTMLCrypto_iface.lpVtbl = &WineMSHTMLCryptoVtbl; + init_dispatch(&obj->dispex, &crypto_dispex, dispex_compat_mode(&window->event_target.dispex)); + + *ret = &obj->IWineMSHTMLCrypto_iface; +} diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 5249e042182..a45a579854e 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -344,6 +344,7 @@ sync_test("builtin_toString", function() { test("mediaQueryList", window.matchMedia("(hover:hover)"), "MediaQueryList"); } if(v >= 11) { + test("crypto", window.msCrypto, "Crypto"); test("MutationObserver", new window.MutationObserver(function() {}), "MutationObserver"); } if(v >= 9) { @@ -478,6 +479,7 @@ sync_test("window_props", function() { test_exposed("performance", true); test_exposed("console", v >= 10); test_exposed("matchMedia", v >= 10); + test_exposed("msCrypto", v >= 11); test_exposed("MutationObserver", v >= 11); }); @@ -2857,6 +2859,15 @@ sync_test("__defineSetter__", function() { ok(x.setterVal === 9, "x.setterVal after setting bar = " + x.setterVal); }); +sync_test("Crypto", function() { + var crypto = window.msCrypto; + if(!crypto) return; + + ok("subtle" in crypto, "subtle not in crypto"); + ok("getRandomValues" in crypto, "getRandomValues not in crypto"); + ok(!("randomUUID" in crypto), "randomUUID is in crypto"); +}); + sync_test("MutationObserver", function() { if (!window.MutationObserver) { return; From 426a23b1523f4caebe63d908baed3b91d949361e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0933/1506] jscript: Allow ES5 keywords in identifiers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/parser.y | 44 ++++++++++++++++++++++++++-------------- dlls/mshtml/tests/es5.js | 24 ++++++++++++++++++++-- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 42d695e0846..5ba633235d0 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -221,7 +221,7 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t %type MemberExpression %type PrimaryExpression %type GetterSetterMethod -%type Identifier_opt +%type Identifier Identifier_opt %type VariableDeclarationList %type VariableDeclarationListNoIn %type VariableDeclaration @@ -241,10 +241,11 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t %type PropertyName %type BooleanLiteral %type AssignOper -%type IdentifierName ReservedAsIdentifier +%type IdentifierName ReservedAsIdentifier ES5Keyword %nonassoc LOWER_THAN_ELSE -%nonassoc kELSE +%nonassoc kELSE kIN kINSTANCEOF ':' +%nonassoc kGET kLET kSET %% @@ -268,9 +269,9 @@ FunctionStatementList FunctionExpression : kFUNCTION left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' { $$ = new_function_expression(ctx, NULL, $3, $6, NULL, ctx->begin + @1, @7 - @1 + 1); } - | kFUNCTION tIdentifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' + | kFUNCTION Identifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' { $$ = new_function_expression(ctx, $2, $4, $7, NULL, ctx->begin + @1, @8 - @1 + 1); } - | kFUNCTION tIdentifier kDCOL tIdentifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' + | kFUNCTION Identifier kDCOL Identifier left_bracket FormalParameterList_opt right_bracket '{' FunctionBody '}' { $$ = new_function_expression(ctx, $4, $6, $9, $2, ctx->begin + @1, @10 - @1 + 1); } /* ECMA-262 10th Edition 14.1 */ @@ -279,8 +280,8 @@ FunctionBody /* ECMA-262 3rd Edition 13 */ FormalParameterList - : tIdentifier { $$ = new_parameter_list(ctx, $1); } - | FormalParameterList ',' tIdentifier + : Identifier { $$ = new_parameter_list(ctx, $1); } + | FormalParameterList ',' Identifier { $$ = parameter_list_add(ctx, $1, $3); } /* ECMA-262 3rd Edition 13 */ @@ -381,12 +382,12 @@ VariableDeclarationListNoIn /* ECMA-262 3rd Edition 12.2 */ VariableDeclaration - : tIdentifier Initialiser_opt + : Identifier Initialiser_opt { $$ = new_variable_declaration(ctx, $1, $2); } /* ECMA-262 3rd Edition 12.2 */ VariableDeclarationNoIn - : tIdentifier InitialiserNoIn_opt + : Identifier InitialiserNoIn_opt { $$ = new_variable_declaration(ctx, $1, $2); } /* ECMA-262 3rd Edition 12.2 */ @@ -479,6 +480,12 @@ WithStatement LabelledStatement : tIdentifier ':' Statement { $$ = new_labelled_statement(ctx, @$, $1, $3); } + | kGET ':' Statement + { $$ = new_labelled_statement(ctx, @$, $1, $3); } + | kSET ':' Statement + { $$ = new_labelled_statement(ctx, @$, $1, $3); } + | kLET ':' Statement + { $$ = new_labelled_statement(ctx, @$, $1, $3); } /* ECMA-262 3rd Edition 12.11 */ SwitchStatement @@ -527,7 +534,7 @@ TryStatement /* ECMA-262 3rd Edition 12.14 */ Catch - : kCATCH left_bracket tIdentifier right_bracket Block + : kCATCH left_bracket Identifier right_bracket Block { $$ = new_catch_block(ctx, $3, $5); } /* ECMA-262 3rd Edition 12.14 */ @@ -786,7 +793,7 @@ ArgumentList /* ECMA-262 3rd Edition 11.1 */ PrimaryExpression : kTHIS { $$ = new_expression(ctx, EXPR_THIS, 0); } - | tIdentifier { $$ = new_identifier_expression(ctx, $1); } + | Identifier { $$ = new_identifier_expression(ctx, $1); } | Literal { $$ = new_literal_expression(ctx, $1); } | ArrayLiteral { $$ = $1; } | ObjectLiteral { $$ = $1; } @@ -860,7 +867,11 @@ PropertyName /* ECMA-262 3rd Edition 7.6 */ Identifier_opt : /* empty*/ { $$ = NULL; } - | tIdentifier { $$ = $1; } + | Identifier { $$ = $1; } + +Identifier + : tIdentifier { $$ = $1; } + | ES5Keyword { $$ = $1; } /* ECMA-262 5.1 Edition 7.6 */ IdentifierName @@ -890,15 +901,12 @@ ReservedAsIdentifier | kFINALLY { $$ = $1; } | kFOR { $$ = $1; } | kFUNCTION { $$ = $1; } - | kGET { $$ = $1; } | kIF { $$ = $1; } | kIN { $$ = $1; } | kINSTANCEOF { $$ = $1; } - | kLET { $$ = $1; } | kNEW { $$ = $1; } | kNULL { $$ = $1; } | kRETURN { $$ = $1; } - | kSET { $$ = $1; } | kSWITCH { $$ = $1; } | kTHIS { $$ = $1; } | kTHROW { $$ = $1; } @@ -909,6 +917,12 @@ ReservedAsIdentifier | kVOID { $$ = $1; } | kWHILE { $$ = $1; } | kWITH { $$ = $1; } + | ES5Keyword { $$ = $1; } + +ES5Keyword + : kGET { $$ = $1; } + | kLET { $$ = $1; } + | kSET { $$ = $1; } /* ECMA-262 3rd Edition 7.8 */ Literal diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 1213eb48a4f..fe9203babc6 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -469,7 +469,14 @@ sync_test("array_sort", function() { }); sync_test("identifier_keywords", function() { + function get(let, set) { { get instanceof (Object); } return let + set; } + set: var let = get(1, 2); + { get: 10 } + var set = 0; var o = { + get: get, + set: set, + let: let, if: 1, default: 2, function: 3, @@ -482,8 +489,8 @@ sync_test("identifier_keywords", function() { else: true, finally: true, for: true, - in: true, - instanceof: true, + set in(x) { }, + get instanceof() { return 3; }, new: true, return: true, switch: true, @@ -504,6 +511,19 @@ sync_test("identifier_keywords", function() { ok(o.if === 1, "o.if = " + o.if); ok(ro().default === 2, "ro().default = " + ro().default); ok(o.false === true, "o.false = " + o.false); + ok(o.get === get, "o.let = " + o.get); + ok(o.set === set, "o.let = " + o.set); + ok(o.let === let, "o.let = " + o.let); + ok(o.instanceof === 3, "o.instanceof = " + o.instanceof); + + var tmp = false; + try { + eval('function var() { }'); + } + catch(set) { + tmp = true; + } + ok(tmp === true, "Expected exception for 'function var() { }'"); }); function test_own_data_prop_desc(obj, prop, expected_writable, expected_enumerable, From 3a78c21e4ba94bc9ec962f91de035d03fb0c8786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0934/1506] jscript: Handle DISP_E_MEMBERNOTFOUND when retrieving props. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be needed for asynchronous props, like for the localStorage object, when it becomes a JS object. Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 0f001739559..449e4d7fdc1 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2448,7 +2448,8 @@ HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned if(!prop || prop->type == PROP_DELETED) return JS_E_INVALID_PROPERTY; - return invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, r, &disp->ctx->jscaller->IServiceProvider_iface); + hres = invoke_prop_func(disp, to_disp(disp), prop, flags, argc, argv, r, &disp->ctx->jscaller->IServiceProvider_iface); + return (hres == DISP_E_MEMBERNOTFOUND) ? JS_E_INVALID_PROPERTY : hres; } static HRESULT disp_invoke(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, DISPPARAMS *params, VARIANT *r, @@ -2800,7 +2801,12 @@ HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val) return S_OK; } - return prop_get(obj, to_disp(obj), prop, val); + hres = prop_get(obj, to_disp(obj), prop, val); + if(hres == DISP_E_MEMBERNOTFOUND) { + *val = jsval_undefined(); + return S_OK; + } + return hres; } HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r) @@ -2823,7 +2829,12 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r) return DISP_E_UNKNOWNNAME; } - return prop_get(obj, to_disp(obj), prop, r); + hres = prop_get(obj, to_disp(obj), prop, r); + if(hres == DISP_E_MEMBERNOTFOUND) { + *r = jsval_undefined(); + return DISP_E_UNKNOWNNAME; + } + return hres; } HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val) @@ -3058,7 +3069,7 @@ HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_onl if(!flags_only) { hres = prop_get(obj, to_disp(obj), prop, &desc->value); if(FAILED(hres)) - return hres; + return (hres == DISP_E_MEMBERNOTFOUND) ? DISP_E_UNKNOWNNAME : hres; } break; case PROP_ACCESSOR: From c0465e6f96200f464c52aa54b917fc8505ea8fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0935/1506] mshtml: Pass a generic "this" dispatch when invoking builtin functions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And return proper error value, since it will be normal to fail (incompatible object). For hooks make sure to validate the "this" object before calling. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 153 ++++++++++++++++++++++----------------- dlls/mshtml/htmldoc.c | 2 +- dlls/mshtml/htmlwindow.c | 2 +- 3 files changed, 90 insertions(+), 67 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 07c26e2e762..4ebbd746711 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -124,6 +124,8 @@ PRIVATE_TID_LIST #undef XDIID }; +static inline DispatchEx *get_dispex_for_hook(IUnknown*); + static HRESULT load_typelib(void) { WCHAR module_path[MAX_PATH + 3]; @@ -755,12 +757,11 @@ static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS return S_OK; } -static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, +static HRESULT typeinfo_invoke(IUnknown *iface, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei) { DISPPARAMS params = {dp->rgvarg, NULL, dp->cArgs, 0}; ITypeInfo *ti; - IUnknown *unk; UINT argerr=0; HRESULT hres; @@ -775,16 +776,7 @@ static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags, return hres; } - hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&unk); - if(FAILED(hres)) { - ERR("Could not get iface %s: %08lx\n", debugstr_mshtml_guid(tid_ids[func->tid]), hres); - return E_FAIL; - } - - hres = ITypeInfo_Invoke(ti, unk, func->id, flags, ¶ms, res, ei, &argerr); - - IUnknown_Release(unk); - return hres; + return ITypeInfo_Invoke(ti, iface, func->id, flags, ¶ms, res, ei, &argerr); } static inline func_disp_t *impl_from_DispatchEx(DispatchEx *iface) @@ -1053,9 +1045,8 @@ HRESULT change_type(VARIANT *dst, VARIANT *src, VARTYPE vt, IServiceProvider *ca return VariantChangeType(dst, src, 0, vt); } -static HRESULT builtin_propget(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, VARIANT *res) +static HRESULT builtin_propget(IUnknown *iface, func_info_t *func, DISPPARAMS *dp, VARIANT *res) { - IUnknown *iface; HRESULT hres; if(dp && dp->cArgs) { @@ -1065,24 +1056,20 @@ static HRESULT builtin_propget(DispatchEx *This, func_info_t *func, DISPPARAMS * assert(func->get_vtbl_off); - hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); - if(SUCCEEDED(hres)) { - switch(func->prop_vt) { + switch(func->prop_vt) { #define CASE_VT(vt,type,access) \ - case vt: { \ - type val; \ - hres = ((HRESULT (WINAPI*)(IUnknown*,type*))((void**)iface->lpVtbl)[func->get_vtbl_off])(iface,&val); \ - if(SUCCEEDED(hres)) \ - access(res) = val; \ - } \ - break - BUILTIN_TYPES_SWITCH; + case vt: { \ + type val; \ + hres = ((HRESULT (WINAPI*)(IUnknown*,type*))((void**)iface->lpVtbl)[func->get_vtbl_off])(iface,&val); \ + if(SUCCEEDED(hres)) \ + access(res) = val; \ + } \ + break + BUILTIN_TYPES_SWITCH; #undef CASE_VT - default: - FIXME("Unhandled vt %d\n", func->prop_vt); - hres = E_NOTIMPL; - } - IUnknown_Release(iface); + default: + FIXME("Unhandled vt %d\n", func->prop_vt); + hres = E_NOTIMPL; } if(FAILED(hres)) @@ -1093,10 +1080,9 @@ static HRESULT builtin_propget(DispatchEx *This, func_info_t *func, DISPPARAMS * return S_OK; } -static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, IServiceProvider *caller) +static HRESULT builtin_propput(DispatchEx *This, IUnknown *iface, func_info_t *func, DISPPARAMS *dp, IServiceProvider *caller) { VARIANT *v, tmpv; - IUnknown *iface; HRESULT hres; if(dp->cArgs != 1 || (dp->cNamedArgs == 1 && *dp->rgdispidNamedArgs != DISPID_PROPERTYPUT) @@ -1122,21 +1108,16 @@ static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS * v = &tmpv; } - hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); - if(SUCCEEDED(hres)) { - switch(func->prop_vt) { + switch(func->prop_vt) { #define CASE_VT(vt,type,access) \ - case vt: \ - hres = ((HRESULT (WINAPI*)(IUnknown*,type))((void**)iface->lpVtbl)[func->put_vtbl_off])(iface,access(v)); \ - break - BUILTIN_TYPES_SWITCH; + case vt: \ + hres = ((HRESULT (WINAPI*)(IUnknown*,type))((void**)iface->lpVtbl)[func->put_vtbl_off])(iface,access(v)); \ + break + BUILTIN_TYPES_SWITCH; #undef CASE_VT - default: - FIXME("Unimplemented vt %d\n", func->prop_vt); - hres = E_NOTIMPL; - } - - IUnknown_Release(iface); + default: + FIXME("Unimplemented vt %d\n", func->prop_vt); + hres = E_NOTIMPL; } if(v == &tmpv) @@ -1144,32 +1125,40 @@ static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS * return hres; } -static HRESULT invoke_builtin_function(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, +static HRESULT invoke_builtin_function(IDispatch *this_obj, func_info_t *func, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { VARIANT arg_buf[MAX_ARGS], *arg_ptrs[MAX_ARGS], *arg, retv, ret_ref, vhres; unsigned i, nconv = 0; + DispatchEx *dispex; IUnknown *iface; HRESULT hres; - if(func->hook) { - hres = func->hook(This, DISPATCH_METHOD, dp, res, ei, caller); - if(hres != S_FALSE) + hres = IDispatch_QueryInterface(this_obj, tid_ids[func->tid], (void**)&iface); + if(FAILED(hres) || !iface) + return E_UNEXPECTED; + + if(func->hook && (dispex = get_dispex_for_hook(iface))) { + hres = func->hook(dispex, DISPATCH_METHOD, dp, res, ei, caller); + IDispatchEx_Release(&dispex->IDispatchEx_iface); + if(hres != S_FALSE) { + IUnknown_Release(iface); return hres; + } } - if(!func->call_vtbl_off) - return typeinfo_invoke(This, func, DISPATCH_METHOD, dp, res, ei); + if(!func->call_vtbl_off) { + hres = typeinfo_invoke(iface, func, DISPATCH_METHOD, dp, res, ei); + IUnknown_Release(iface); + return hres; + } if(dp->cArgs + func->default_value_cnt < func->argc) { FIXME("Invalid argument count (expected %u, got %u)\n", func->argc, dp->cArgs); + IUnknown_Release(iface); return E_INVALIDARG; } - hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); - if(FAILED(hres)) - return hres; - for(i=0; i < func->argc; i++) { BOOL own_value = FALSE; if(i >= dp->cArgs) { @@ -1282,7 +1271,7 @@ static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags, } } - hres = invoke_builtin_function(This, func, dp, res, ei, caller); + hres = invoke_builtin_function((IDispatch*)&This->IDispatchEx_iface, func, dp, res, ei, caller); break; case DISPATCH_PROPERTYGET: { func_obj_entry_t *entry; @@ -1339,6 +1328,7 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { func_info_t *func; + IUnknown *iface; HRESULT hres; hres = get_builtin_func(This->info, id, &func); @@ -1350,36 +1340,43 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD if(func->func_disp_idx >= 0) return function_invoke(This, func, flags, dp, res, ei, caller); + hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); + if(FAILED(hres) || !iface) + return E_UNEXPECTED; + if(func->hook) { hres = func->hook(This, flags, dp, res, ei, caller); - if(hres != S_FALSE) + if(hres != S_FALSE) { + IUnknown_Release(iface); return hres; + } } switch(flags) { case DISPATCH_PROPERTYPUT: if(res) V_VT(res) = VT_EMPTY; - hres = builtin_propput(This, func, dp, caller); + hres = builtin_propput(This, iface, func, dp, caller); break; case DISPATCH_PROPERTYGET: - hres = builtin_propget(This, func, dp, res); + hres = builtin_propget(iface, func, dp, res); break; default: if(!func->get_vtbl_off) { - hres = typeinfo_invoke(This, func, flags, dp, res, ei); + hres = typeinfo_invoke(iface, func, flags, dp, res, ei); }else { VARIANT v; - hres = builtin_propget(This, func, NULL, &v); + hres = builtin_propget(iface, func, NULL, &v); if(FAILED(hres)) - return hres; + break; if(flags != (DISPATCH_PROPERTYGET|DISPATCH_METHOD) || dp->cArgs) { if(V_VT(&v) != VT_DISPATCH) { FIXME("Not a function %s flags %08x\n", debugstr_variant(&v), flags); VariantClear(&v); - return E_FAIL; + hres = E_FAIL; + break; } hres = invoke_disp_value(This, V_DISPATCH(&v), lcid, flags, dp, res, ei, caller); @@ -1392,6 +1389,7 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD } } + IUnknown_Release(iface); return hres; } @@ -1405,7 +1403,7 @@ HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, if(FAILED(hres)) return hres; - return invoke_builtin_function(dispex, func, dp, res, ei, caller); + return invoke_builtin_function((IDispatch*)&dispex->IDispatchEx_iface, func, dp, res, ei, caller); } HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) @@ -1429,6 +1427,7 @@ HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) VARIANT var; DISPPARAMS dp = {&var,NULL,1,0}; func_info_t *func; + IUnknown *iface; HRESULT hres; hres = get_builtin_func(This->info, id, &func); @@ -1461,8 +1460,10 @@ HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) } *success = VARIANT_TRUE; + IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); + V_VT(&var) = VT_EMPTY; - hres = builtin_propput(This, func, &dp, NULL); + hres = builtin_propput(This, iface, func, &dp, NULL); if(FAILED(hres)) { VARIANT *ref; hres = dispex_get_dprop_ref(This, func->name, FALSE, &ref); @@ -1471,6 +1472,7 @@ HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) else VariantClear(ref); } + IUnknown_Release(iface); return S_OK; } default: @@ -1961,6 +1963,27 @@ static IDispatchExVtbl DispatchExVtbl = { DispatchEx_GetNameSpaceParent }; +extern const IDispatchExVtbl WindowDispExVtbl; +extern const IDispatchExVtbl DocDispatchExVtbl; +static inline DispatchEx *get_dispex_for_hook(IUnknown *iface) +{ + IDispatchEx *dispex; + + if(FAILED(IUnknown_QueryInterface(iface, &IID_IDispatchEx, (void**)&dispex)) || !dispex) + return NULL; + + /* FIXME: Handle these generically (needs private interface) */ + if(dispex->lpVtbl == &DispatchExVtbl) + return impl_from_IDispatchEx(dispex); + if(dispex->lpVtbl == &WindowDispExVtbl) + return &CONTAINING_RECORD(dispex, HTMLWindow, IDispatchEx_iface)->inner_window->event_target.dispex; + if(dispex->lpVtbl == &DocDispatchExVtbl) + return &CONTAINING_RECORD(dispex, HTMLDocumentNode, IDispatchEx_iface)->node.event_target.dispex; + + IDispatchEx_Release(dispex); + return NULL; +} + static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) { DispatchEx *This = impl_from_IDispatchEx(p); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index e7eca058c23..625fa0152cb 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5184,7 +5184,7 @@ static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnkn return IDispatchEx_GetNameSpaceParent(&This->node.event_target.dispex.IDispatchEx_iface, ppunk); } -static const IDispatchExVtbl DocDispatchExVtbl = { +const IDispatchExVtbl DocDispatchExVtbl = { DocDispatchEx_QueryInterface, DocDispatchEx_AddRef, DocDispatchEx_Release, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index dbde061aeb3..698ee1d4952 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3817,7 +3817,7 @@ static HRESULT WINAPI WindowDispEx_GetNameSpaceParent(IDispatchEx *iface, IUnkno return S_OK; } -static const IDispatchExVtbl WindowDispExVtbl = { +const IDispatchExVtbl WindowDispExVtbl = { WindowDispEx_QueryInterface, WindowDispEx_AddRef, WindowDispEx_Release, From 1d7677634cb290bb2f3619c6b91aa7862581037b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0936/1506] mshtml: Implement `call` for builtin function objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 78 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 4ebbd746711..178ca1102cb 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -125,6 +125,7 @@ PRIVATE_TID_LIST }; static inline DispatchEx *get_dispex_for_hook(IUnknown*); +static HRESULT invoke_builtin_function(IDispatch*,func_info_t*,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); static HRESULT load_typelib(void) { @@ -779,6 +780,28 @@ static HRESULT typeinfo_invoke(IUnknown *iface, func_info_t *func, WORD flags, D return ITypeInfo_Invoke(ti, iface, func->id, flags, ¶ms, res, ei, &argerr); } +static HRESULT function_call(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + DISPPARAMS params = { dp->rgvarg, NULL, dp->cArgs - 1, 0 }; + VARIANT *arg; + HRESULT hres; + + arg = dp->rgvarg + dp->cArgs - 1; + if(dp->cArgs < 1 || V_VT(arg) != VT_DISPATCH || !V_DISPATCH(arg)) + return CTL_E_ILLEGALFUNCTIONCALL; + + hres = invoke_builtin_function(V_DISPATCH(arg), func->info, ¶ms, res, ei, caller); + + return (hres == E_UNEXPECTED) ? CTL_E_ILLEGALFUNCTIONCALL : hres; +} + +static const struct { + const WCHAR *name; + HRESULT (*invoke)(func_disp_t*,DISPPARAMS*,LCID,VARIANT*,EXCEPINFO*,IServiceProvider*); +} function_props[] = { + { L"call", function_call } +}; + static inline func_disp_t *impl_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, func_disp_t, dispex); @@ -805,7 +828,7 @@ static HRESULT function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR case DISPATCH_METHOD: if(!This->obj) return E_UNEXPECTED; - hres = dispex_call_builtin(This->obj, This->info->id, params, res, ei, caller); + hres = invoke_builtin_function((IDispatch*)&This->obj->IDispatchEx_iface, This->info, params, res, ei, caller); break; case DISPATCH_PROPERTYGET: { unsigned name_len; @@ -846,9 +869,58 @@ static HRESULT function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR return hres; } +static HRESULT function_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) +{ + DWORD i; + + for(i = 0; i < ARRAY_SIZE(function_props); i++) { + if((flags & fdexNameCaseInsensitive) ? wcsicmp(name, function_props[i].name) : wcscmp(name, function_props[i].name)) + continue; + *dispid = MSHTML_DISPID_CUSTOM_MIN + i; + return S_OK; + } + return DISP_E_UNKNOWNNAME; +} + +static HRESULT function_get_name(DispatchEx *dispex, DISPID id, BSTR *name) +{ + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + + if(idx >= ARRAY_SIZE(function_props)) + return DISP_E_MEMBERNOTFOUND; + + return (*name = SysAllocString(function_props[idx].name)) ? S_OK : E_OUTOFMEMORY; +} + +static HRESULT function_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + func_disp_t *This = impl_from_DispatchEx(dispex); + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + + if(idx >= ARRAY_SIZE(function_props)) + return DISP_E_MEMBERNOTFOUND; + + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + return function_props[idx].invoke(This, params, lcid, res, ei, caller); + default: + return MSHTML_E_INVALID_PROPERTY; + } + + return S_OK; +} + static const dispex_static_data_vtbl_t function_dispex_vtbl = { .destructor = function_destructor, .value = function_value, + .get_dispid = function_get_dispid, + .get_name = function_get_name, + .invoke = function_invoke }; static const tid_t function_iface_tids[] = {0}; @@ -1240,7 +1312,7 @@ static HRESULT invoke_builtin_function(IDispatch *this_obj, func_info_t *func, D return V_ERROR(&vhres); } -static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, +static HRESULT func_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HRESULT hres; @@ -1338,7 +1410,7 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD return hres; if(func->func_disp_idx >= 0) - return function_invoke(This, func, flags, dp, res, ei, caller); + return func_invoke(This, func, flags, dp, res, ei, caller); hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); if(FAILED(hres) || !iface) From d033c70f6f507303c661fbd7f7ea5e7859eed3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:23 +0200 Subject: [PATCH 0937/1506] mshtml: Implement `apply` for builtin function objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 123 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 178ca1102cb..4f60d7edb3e 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -780,6 +780,128 @@ static HRESULT typeinfo_invoke(IUnknown *iface, func_info_t *func, WORD flags, D return ITypeInfo_Invoke(ti, iface, func->id, flags, ¶ms, res, ei, &argerr); } +static HRESULT get_disp_prop(IDispatch *disp, IDispatchEx *dispex, const WCHAR *name, LCID lcid, VARIANT *res, + EXCEPINFO *ei, IServiceProvider *caller) +{ + DISPPARAMS dp = { 0 }; + DISPID dispid; + HRESULT hres; + UINT err = 0; + BSTR bstr; + + if(!(bstr = SysAllocString(name))) + return E_OUTOFMEMORY; + + if(dispex) + hres = IDispatchEx_GetDispID(dispex, bstr, fdexNameCaseSensitive, &dispid); + else + hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &bstr, 1, 0, &dispid); + SysFreeString(bstr); + if(FAILED(hres)) + return hres; + if(dispid == DISPID_UNKNOWN) + return DISP_E_UNKNOWNNAME; + + if(dispex) + hres = IDispatchEx_InvokeEx(dispex, dispid, lcid, DISPATCH_PROPERTYGET, &dp, res, ei, caller); + else + hres = IDispatch_Invoke(disp, dispid, &IID_NULL, lcid, DISPATCH_PROPERTYGET, &dp, res, ei, &err); + return hres; +} + +static HRESULT get_disp_prop_vt(IDispatch *disp, IDispatchEx *dispex, const WCHAR *name, LCID lcid, VARIANT *res, + VARTYPE vt, EXCEPINFO *ei, IServiceProvider *caller) +{ + HRESULT hres; + + hres = get_disp_prop(disp, dispex, name, lcid, res, ei, caller); + if(FAILED(hres)) + return hres; + if(V_VT(res) != vt) { + VARIANT tmp = *res; + hres = change_type(res, &tmp, vt, caller); + VariantClear(&tmp); + } + return hres; +} + +static HRESULT function_apply(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + IDispatchEx *dispex = NULL; + DISPPARAMS params = { 0 }; + IDispatch *this_obj; + UINT argc = 0; + VARIANT *arg; + HRESULT hres; + + arg = dp->rgvarg + dp->cArgs - 1; + if(dp->cArgs < 1 || V_VT(arg) != VT_DISPATCH || !V_DISPATCH(arg)) + return CTL_E_ILLEGALFUNCTIONCALL; + this_obj = V_DISPATCH(arg); + + if(dp->cArgs >= 2) { + IDispatch *disp; + UINT i; + + arg--; + if((V_VT(arg) & ~VT_BYREF) != VT_DISPATCH) + return CTL_E_ILLEGALFUNCTIONCALL; + disp = (V_VT(arg) & VT_BYREF) ? *(IDispatch**)(V_BYREF(arg)) : V_DISPATCH(arg); + + /* FIXME: Native doesn't seem to detect jscript arrays by querying for length or indexed props, + and it doesn't QI nor call any other IDispatchEx methods (except AddRef) on external disps. + Array-like JS objects don't work either, they all return 0x800a01ae. So how does it do it?! */ + IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); + hres = get_disp_prop_vt(disp, dispex, L"length", lcid, res, VT_I4, ei, caller); + if(FAILED(hres)) { + if(hres == DISP_E_UNKNOWNNAME) + hres = CTL_E_ILLEGALFUNCTIONCALL; + goto fail; + } + if(V_I4(res) < 0) { + hres = CTL_E_ILLEGALFUNCTIONCALL; + goto fail; + } + params.cArgs = V_I4(res); + + /* alloc new params */ + if(params.cArgs) { + if(!(params.rgvarg = malloc(params.cArgs * sizeof(VARIANTARG)))) { + hres = E_OUTOFMEMORY; + goto fail; + } + for(i = 0; i < params.cArgs; i++) { + WCHAR buf[12]; + + arg = params.rgvarg + params.cArgs - i - 1; + swprintf(buf, ARRAY_SIZE(buf), L"%u", i); + hres = get_disp_prop(disp, dispex, buf, lcid, arg, ei, caller); + if(FAILED(hres)) { + if(hres == DISP_E_UNKNOWNNAME) { + V_VT(arg) = VT_EMPTY; + continue; + } + break; + } + } + argc = i; + if(argc < params.cArgs) + goto cleanup; + } + } + + hres = invoke_builtin_function(this_obj, func->info, ¶ms, res, ei, caller); + +cleanup: + while(argc--) + VariantClear(¶ms.rgvarg[params.cArgs - argc - 1]); + free(params.rgvarg); +fail: + if(dispex) + IDispatchEx_Release(dispex); + return (hres == E_UNEXPECTED) ? CTL_E_ILLEGALFUNCTIONCALL : hres; +} + static HRESULT function_call(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { DISPPARAMS params = { dp->rgvarg, NULL, dp->cArgs - 1, 0 }; @@ -799,6 +921,7 @@ static const struct { const WCHAR *name; HRESULT (*invoke)(func_disp_t*,DISPPARAMS*,LCID,VARIANT*,EXCEPINFO*,IServiceProvider*); } function_props[] = { + { L"apply", function_apply }, { L"call", function_call } }; From 3fe981e6bfeddac1868bbea4b444a3371f6122d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0938/1506] jscript: Move the native function's toString implementation to a helper. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/function.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 68f841b38a1..320d15324cd 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -672,9 +672,8 @@ static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, js return function->proc(ctx, vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r); } -static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) +static HRESULT native_code_toString(const WCHAR *name, jsstr_t **ret) { - NativeFunction *function = (NativeFunction*)func; DWORD name_len; jsstr_t *str; WCHAR *ptr; @@ -682,14 +681,14 @@ static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) static const WCHAR native_prefixW[] = L"\nfunction "; static const WCHAR native_suffixW[] = L"() {\n [native code]\n}\n"; - name_len = function->name ? lstrlenW(function->name) : 0; + name_len = name ? lstrlenW(name) : 0; str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len - 2, &ptr); if(!str) return E_OUTOFMEMORY; memcpy(ptr, native_prefixW, sizeof(native_prefixW)); ptr += ARRAY_SIZE(native_prefixW) - 1; - memcpy(ptr, function->name, name_len*sizeof(WCHAR)); + memcpy(ptr, name, name_len*sizeof(WCHAR)); ptr += name_len; memcpy(ptr, native_suffixW, sizeof(native_suffixW)); @@ -697,6 +696,12 @@ static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) return S_OK; } +static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) +{ + NativeFunction *function = (NativeFunction*)func; + return native_code_toString(function->name, ret); +} + static function_code_t *NativeFunction_get_code(FunctionInstance *function) { return NULL; From 1ad2d8685fd38b8e64075de8adf4ccee0218fc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0939/1506] mshtml: Move the dispex's invoke and member delete into helpers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 215 ++++++++++++++++++----------------- dlls/mshtml/htmldoc.c | 4 +- dlls/mshtml/htmlelem.c | 4 +- dlls/mshtml/htmlframe.c | 8 +- dlls/mshtml/htmlwindow.c | 6 +- dlls/mshtml/mshtml_private.h | 2 + 6 files changed, 126 insertions(+), 113 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 4f60d7edb3e..aac7f58dce2 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1852,8 +1852,7 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, TRACE("%s (%p)->(%ld %s %ld %d %p %p %p %p)\n", This->info->desc->name, This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, pDispParams, - pVarResult, pExcepInfo, NULL); + return dispex_invoke(This, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL); } static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) @@ -1886,86 +1885,10 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { DispatchEx *This = impl_from_IDispatchEx(iface); - HRESULT hres; TRACE("%s (%p)->(%lx %lx %x %p %p %p %p)\n", This->info->desc->name, This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - if(!ensure_real_info(This)) - return E_OUTOFMEMORY; - - if(wFlags == (DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF)) - wFlags = DISPATCH_PROPERTYPUT; - - switch(get_dispid_type(id)) { - case DISPEXPROP_CUSTOM: - if(!This->info->desc->vtbl->invoke) - return DISP_E_MEMBERNOTFOUND; - return This->info->desc->vtbl->invoke(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - - case DISPEXPROP_DYNAMIC: { - DWORD idx = id - DISPID_DYNPROP_0; - dynamic_prop_t *prop; - - if(!get_dynamic_data(This) || This->dynamic_data->prop_cnt <= idx) - return DISP_E_MEMBERNOTFOUND; - - prop = This->dynamic_data->props+idx; - - switch(wFlags) { - case DISPATCH_METHOD|DISPATCH_PROPERTYGET: - if(!pvarRes) - return E_INVALIDARG; - /* fall through */ - case DISPATCH_METHOD: - if(V_VT(&prop->var) != VT_DISPATCH) { - FIXME("invoke %s\n", debugstr_variant(&prop->var)); - return E_NOTIMPL; - } - - return invoke_disp_value(This, V_DISPATCH(&prop->var), lcid, wFlags, pdp, pvarRes, pei, pspCaller); - case DISPATCH_PROPERTYGET: - if(prop->flags & DYNPROP_DELETED) - return DISP_E_MEMBERNOTFOUND; - V_VT(pvarRes) = VT_EMPTY; - return variant_copy(pvarRes, &prop->var); - case DISPATCH_PROPERTYPUT: - if(pdp->cArgs != 1 || (pdp->cNamedArgs == 1 && *pdp->rgdispidNamedArgs != DISPID_PROPERTYPUT) - || pdp->cNamedArgs > 1) { - FIXME("invalid args\n"); - return E_INVALIDARG; - } - - TRACE("put %s\n", debugstr_variant(pdp->rgvarg)); - VariantClear(&prop->var); - hres = variant_copy(&prop->var, pdp->rgvarg); - if(FAILED(hres)) - return hres; - - prop->flags &= ~DYNPROP_DELETED; - return S_OK; - default: - FIXME("unhandled wFlags %x\n", wFlags); - return E_NOTIMPL; - } - } - case DISPEXPROP_BUILTIN: - if(wFlags == DISPATCH_CONSTRUCT) { - if(id == DISPID_VALUE) { - if(This->info->desc->vtbl->value) { - return This->info->desc->vtbl->value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - } - FIXME("DISPATCH_CONSTRUCT flag but missing value function\n"); - return E_FAIL; - } - FIXME("DISPATCH_CONSTRUCT flag without DISPID_VALUE\n"); - return E_FAIL; - } - - return invoke_builtin_prop(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - default: - assert(0); - return E_FAIL; - } + return dispex_invoke(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); } static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR name, DWORD grfdex) @@ -1984,7 +1907,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR nam compat_mode < COMPAT_MODE_IE9 ? hres : S_OK; } - return IDispatchEx_DeleteMemberByDispID(&This->IDispatchEx_iface, id); + return dispex_delete_prop(This, id); } static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) @@ -1993,28 +1916,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID TRACE("%s (%p)->(%lx)\n", This->info->desc->name, This, id); - if(is_custom_dispid(id) && This->info->desc->vtbl->delete) - return This->info->desc->vtbl->delete(This, id); - - if(dispex_compat_mode(This) < COMPAT_MODE_IE8) { - /* Not implemented by IE */ - return E_NOTIMPL; - } - - if(is_dynamic_dispid(id)) { - DWORD idx = id - DISPID_DYNPROP_0; - dynamic_prop_t *prop; - - if(!get_dynamic_data(This) || idx >= This->dynamic_data->prop_cnt) - return S_OK; - - prop = This->dynamic_data->props + idx; - VariantClear(&prop->var); - prop->flags |= DYNPROP_DELETED; - return S_OK; - } - - return S_OK; + return dispex_delete_prop(This, id); } static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) @@ -2179,6 +2081,115 @@ static inline DispatchEx *get_dispex_for_hook(IUnknown *iface) return NULL; } +HRESULT dispex_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *res, + EXCEPINFO *pei, IServiceProvider *caller) +{ + HRESULT hres; + + if(!ensure_real_info(dispex)) + return E_OUTOFMEMORY; + + if(wFlags == (DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF)) + wFlags = DISPATCH_PROPERTYPUT; + + switch(get_dispid_type(id)) { + case DISPEXPROP_CUSTOM: + if(!dispex->info->desc->vtbl->invoke) + return DISP_E_MEMBERNOTFOUND; + return dispex->info->desc->vtbl->invoke(dispex, id, lcid, wFlags, pdp, res, pei, caller); + + case DISPEXPROP_DYNAMIC: { + DWORD idx = id - DISPID_DYNPROP_0; + dynamic_prop_t *prop; + + if(!get_dynamic_data(dispex) || dispex->dynamic_data->prop_cnt <= idx) + return DISP_E_MEMBERNOTFOUND; + + prop = dispex->dynamic_data->props+idx; + + switch(wFlags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + if(V_VT(&prop->var) != VT_DISPATCH) { + FIXME("invoke %s\n", debugstr_variant(&prop->var)); + return E_NOTIMPL; + } + + return invoke_disp_value(dispex, V_DISPATCH(&prop->var), lcid, wFlags, pdp, res, pei, caller); + case DISPATCH_PROPERTYGET: + if(prop->flags & DYNPROP_DELETED) + return DISP_E_MEMBERNOTFOUND; + V_VT(res) = VT_EMPTY; + return variant_copy(res, &prop->var); + case DISPATCH_PROPERTYPUT: + if(pdp->cArgs != 1 || (pdp->cNamedArgs == 1 && *pdp->rgdispidNamedArgs != DISPID_PROPERTYPUT) + || pdp->cNamedArgs > 1) { + FIXME("invalid args\n"); + return E_INVALIDARG; + } + + TRACE("put %s\n", debugstr_variant(pdp->rgvarg)); + VariantClear(&prop->var); + hres = variant_copy(&prop->var, pdp->rgvarg); + if(FAILED(hres)) + return hres; + + prop->flags &= ~DYNPROP_DELETED; + return S_OK; + default: + FIXME("unhandled wFlags %x\n", wFlags); + return E_NOTIMPL; + } + } + case DISPEXPROP_BUILTIN: + if(wFlags == DISPATCH_CONSTRUCT) { + if(id == DISPID_VALUE) { + if(dispex->info->desc->vtbl->value) { + return dispex->info->desc->vtbl->value(dispex, lcid, wFlags, pdp, res, pei, caller); + } + FIXME("DISPATCH_CONSTRUCT flag but missing value function\n"); + return E_FAIL; + } + FIXME("DISPATCH_CONSTRUCT flag without DISPID_VALUE\n"); + return E_FAIL; + } + + return invoke_builtin_prop(dispex, id, lcid, wFlags, pdp, res, pei, caller); + default: + assert(0); + return E_FAIL; + } +} + +HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) +{ + if(is_custom_dispid(id) && dispex->info->desc->vtbl->delete) + return dispex->info->desc->vtbl->delete(dispex, id); + + if(dispex_compat_mode(dispex) < COMPAT_MODE_IE8) { + /* Not implemented by IE */ + return E_NOTIMPL; + } + + if(is_dynamic_dispid(id)) { + DWORD idx = id - DISPID_DYNPROP_0; + dynamic_prop_t *prop; + + if(!get_dynamic_data(dispex) || idx >= dispex->dynamic_data->prop_cnt) + return S_OK; + + prop = dispex->dynamic_data->props + idx; + VariantClear(&prop->var); + prop->flags |= DYNPROP_DELETED; + return S_OK; + } + + return S_OK; +} + static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) { DispatchEx *This = impl_from_IDispatchEx(p); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 625fa0152cb..4f70ca980b9 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6094,8 +6094,8 @@ static HRESULT HTMLDocumentNode_location_hook(DispatchEx *dispex, WORD flags, DI if(!This->window->base.outer_window) return E_FAIL; - return IDispatchEx_InvokeEx(&This->window->base.outer_window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION, - 0, flags, dp, res, ei, caller); + return dispex_invoke(&This->window->base.outer_window->base.inner_window->event_target.dispex, + DISPID_IHTMLWINDOW2_LOCATION, 0, flags, dp, res, ei, caller); } static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 687e62f1784..346721e6b35 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -2676,8 +2676,8 @@ static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String) if(!String) return E_INVALIDARG; - hres = IDispatchEx_InvokeEx(&This->node.event_target.dispex.IDispatchEx_iface, DISPID_VALUE, - LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, NULL, &var, NULL, NULL); + hres = dispex_invoke(&This->node.event_target.dispex, DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, + DISPATCH_PROPERTYGET, NULL, &var, NULL, NULL); if(SUCCEEDED(hres)) { assert(V_VT(&var) == VT_BSTR); *String = V_BSTR(&var); diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 28bf42e2569..33cea7b46fd 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -997,8 +997,8 @@ static HRESULT HTMLFrameElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, return E_FAIL; } - return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid, - flags, params, res, ei, caller); + return dispex_invoke(&This->framebase.content_window->base.inner_window->event_target.dispex, + id, lcid, flags, params, res, ei, caller); } static const NodeImplVtbl HTMLFrameElementImplVtbl = { @@ -1587,8 +1587,8 @@ static HRESULT HTMLIFrame_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD return E_FAIL; } - return IDispatchEx_InvokeEx(&This->framebase.content_window->base.IDispatchEx_iface, id, lcid, - flags, params, res, ei, caller); + return dispex_invoke(&This->framebase.content_window->base.inner_window->event_target.dispex, + id, lcid, flags, params, res, ei, caller); } static const NodeImplVtbl HTMLIFrameImplVtbl = { diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 698ee1d4952..64e3c1f7f72 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4184,7 +4184,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD prop->type = GLOBAL_DISPEXVAR; prop->id = dispex_id; - return IDispatchEx_InvokeEx(&This->event_target.dispex.IDispatchEx_iface, dispex_id, 0, flags, params, res, ei, caller); + return dispex_invoke(&This->event_target.dispex, dispex_id, 0, flags, params, res, ei, caller); } default: FIXME("Not supported flags: %x\n", flags); @@ -4212,7 +4212,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD return E_NOTIMPL; } case GLOBAL_DISPEXVAR: - return IDispatchEx_InvokeEx(&This->event_target.dispex.IDispatchEx_iface, prop->id, 0, flags, params, res, ei, caller); + return dispex_invoke(&This->event_target.dispex, prop->id, 0, flags, params, res, ei, caller); default: ERR("invalid type %d\n", prop->type); hres = DISP_E_MEMBERNOTFOUND; @@ -4275,7 +4275,7 @@ static HRESULT IHTMLWindow2_location_hook(DispatchEx *dispex, WORD flags, DISPPA if(FAILED(hres)) return hres; - hres = IDispatchEx_InvokeEx(&location->dispex.IDispatchEx_iface, DISPID_VALUE, 0, flags, dp, res, ei, caller); + hres = dispex_invoke(&location->dispex, DISPID_VALUE, 0, flags, dp, res, ei, caller); IHTMLLocation_Release(&location->IHTMLLocation_iface); return hres; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1c3681558fc..ab07a997d53 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -441,6 +441,8 @@ HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); HRESULT get_dispids(tid_t,DWORD*,DISPID**); HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*); HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*); +HRESULT dispex_invoke(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); +HRESULT dispex_delete_prop(DispatchEx*,DISPID); void release_typelib(void); HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**); const void *dispex_get_vtbl(DispatchEx*); From 477f2297d4ee5e537c37233011004a58d139bff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0940/1506] mshtml: Move the window's custom prop lookup into a helper. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlwindow.c | 43 +++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 64e3c1f7f72..e4fc0920fce 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3709,28 +3709,17 @@ HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, return DISP_E_UNKNOWNNAME; } -static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +static HRESULT lookup_custom_prop(HTMLWindow *html_window, BSTR name, DISPID *pid) { - HTMLWindow *This = impl_from_IDispatchEx(iface); - HTMLInnerWindow *window = This->inner_window; + HTMLInnerWindow *window = html_window->inner_window; HTMLOuterWindow *frame; global_prop_t *prop; IHTMLElement *elem; HRESULT hres; - TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(bstrName), grfdex, pid); - - hres = search_window_props(window, bstrName, grfdex, pid); - if(hres != DISP_E_UNKNOWNNAME) - return hres; - - hres = IDispatchEx_GetDispID(&window->base.inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex, pid); - if(hres != DISP_E_UNKNOWNNAME) - return hres; - - hres = get_frame_by_name(This->outer_window, bstrName, FALSE, &frame); + hres = get_frame_by_name(html_window->outer_window, name, FALSE, &frame); if(SUCCEEDED(hres) && frame) { - prop = alloc_global_prop(window, GLOBAL_FRAMEVAR, bstrName); + prop = alloc_global_prop(window, GLOBAL_FRAMEVAR, name); if(!prop) return E_OUTOFMEMORY; @@ -3738,12 +3727,11 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, return S_OK; } - hres = IHTMLDocument3_getElementById(&window->base.inner_window->doc->IHTMLDocument3_iface, - bstrName, &elem); + hres = IHTMLDocument3_getElementById(&window->base.inner_window->doc->IHTMLDocument3_iface, name, &elem); if(SUCCEEDED(hres) && elem) { IHTMLElement_Release(elem); - prop = alloc_global_prop(window, GLOBAL_ELEMENTVAR, bstrName); + prop = alloc_global_prop(window, GLOBAL_ELEMENTVAR, name); if(!prop) return E_OUTOFMEMORY; @@ -3754,6 +3742,25 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, return DISP_E_UNKNOWNNAME; } +static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +{ + HTMLWindow *This = impl_from_IDispatchEx(iface); + HTMLInnerWindow *window = This->inner_window; + HRESULT hres; + + TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(bstrName), grfdex, pid); + + hres = search_window_props(window, bstrName, grfdex, pid); + if(hres != DISP_E_UNKNOWNNAME) + return hres; + + hres = IDispatchEx_GetDispID(&window->base.inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex, pid); + if(hres != DISP_E_UNKNOWNNAME) + return hres; + + return lookup_custom_prop(This, bstrName, pid); +} + static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { From 28ef5f6fa46af828478002c932d4693ed9543c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0941/1506] mshtml: Pass along a separate "this" dispatch object when invoking. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed for jscript proxies, so that the accessors or functions are called on the right object, instead of the prototype. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 44 +++++++++++++++++++----------------- dlls/mshtml/htmldoc.c | 5 ++-- dlls/mshtml/htmlelem.c | 18 +++++++-------- dlls/mshtml/htmlelemcol.c | 4 ++-- dlls/mshtml/htmlform.c | 4 ++-- dlls/mshtml/htmlframe.c | 12 +++++----- dlls/mshtml/htmlnode.c | 4 ++-- dlls/mshtml/htmlobject.c | 4 ++-- dlls/mshtml/htmlselect.c | 4 ++-- dlls/mshtml/htmlstorage.c | 4 ++-- dlls/mshtml/htmlstylesheet.c | 8 +++---- dlls/mshtml/htmlwindow.c | 11 +++++---- dlls/mshtml/mshtml_private.h | 4 ++-- 13 files changed, 65 insertions(+), 61 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index aac7f58dce2..adcb6aa7520 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1015,8 +1015,8 @@ static HRESULT function_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return (*name = SysAllocString(function_props[idx].name)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT function_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT function_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { func_disp_t *This = impl_from_DispatchEx(dispex); DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; @@ -1070,7 +1070,7 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info) return ret; } -static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lcid, WORD flags, DISPPARAMS *dp, +static HRESULT invoke_disp_value(IDispatch *this_obj, IDispatch *func_disp, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { DISPID named_arg = DISPID_THIS; @@ -1091,7 +1091,7 @@ static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lc memcpy(new_dp.rgvarg+1, dp->rgvarg, dp->cArgs*sizeof(VARIANTARG)); V_VT(new_dp.rgvarg) = VT_DISPATCH; - V_DISPATCH(new_dp.rgvarg) = (IDispatch*)&This->IDispatchEx_iface; + V_DISPATCH(new_dp.rgvarg) = this_obj; hres = IDispatch_QueryInterface(func_disp, &IID_IDispatchEx, (void**)&dispex); TRACE(">>>\n"); @@ -1435,7 +1435,7 @@ static HRESULT invoke_builtin_function(IDispatch *this_obj, func_info_t *func, D return V_ERROR(&vhres); } -static HRESULT func_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, +static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HRESULT hres; @@ -1461,12 +1461,12 @@ static HRESULT func_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISP return E_FAIL; } - hres = invoke_disp_value(This, V_DISPATCH(&entry->val), 0, flags, dp, res, ei, NULL); + hres = invoke_disp_value(this_obj, V_DISPATCH(&entry->val), 0, flags, dp, res, ei, NULL); break; } } - hres = invoke_builtin_function((IDispatch*)&This->IDispatchEx_iface, func, dp, res, ei, caller); + hres = invoke_builtin_function(this_obj, func, dp, res, ei, caller); break; case DISPATCH_PROPERTYGET: { func_obj_entry_t *entry; @@ -1519,9 +1519,10 @@ static HRESULT func_invoke(DispatchEx *This, func_info_t *func, WORD flags, DISP return hres; } -static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD flags, DISPPARAMS *dp, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT invoke_builtin_prop(DispatchEx *This, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { + DispatchEx *dispex; func_info_t *func; IUnknown *iface; HRESULT hres; @@ -1533,14 +1534,15 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD return hres; if(func->func_disp_idx >= 0) - return func_invoke(This, func, flags, dp, res, ei, caller); + return func_invoke(This, this_obj, func, flags, dp, res, ei, caller); - hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface); + hres = IDispatch_QueryInterface(this_obj, tid_ids[func->tid], (void**)&iface); if(FAILED(hres) || !iface) return E_UNEXPECTED; - if(func->hook) { - hres = func->hook(This, flags, dp, res, ei, caller); + if(func->hook && (dispex = get_dispex_for_hook(iface))) { + hres = func->hook(dispex, flags, dp, res, ei, caller); + IDispatchEx_Release(&dispex->IDispatchEx_iface); if(hres != S_FALSE) { IUnknown_Release(iface); return hres; @@ -1574,7 +1576,7 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, DISPID id, LCID lcid, WORD break; } - hres = invoke_disp_value(This, V_DISPATCH(&v), lcid, flags, dp, res, ei, caller); + hres = invoke_disp_value(this_obj, V_DISPATCH(&v), lcid, flags, dp, res, ei, caller); IDispatch_Release(V_DISPATCH(&v)); }else if(res) { *res = v; @@ -1852,7 +1854,7 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, TRACE("%s (%p)->(%ld %s %ld %d %p %p %p %p)\n", This->info->desc->name, This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return dispex_invoke(This, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL); + return dispex_invoke(This, (IDispatch*)iface, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL); } static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) @@ -1888,7 +1890,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc TRACE("%s (%p)->(%lx %lx %x %p %p %p %p)\n", This->info->desc->name, This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - return dispex_invoke(This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); + return dispex_invoke(This, (IDispatch*)iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); } static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR name, DWORD grfdex) @@ -2081,8 +2083,8 @@ static inline DispatchEx *get_dispex_for_hook(IUnknown *iface) return NULL; } -HRESULT dispex_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *res, - EXCEPINFO *pei, IServiceProvider *caller) +HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *res, EXCEPINFO *pei, IServiceProvider *caller) { HRESULT hres; @@ -2096,7 +2098,7 @@ HRESULT dispex_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD wFlags, DIS case DISPEXPROP_CUSTOM: if(!dispex->info->desc->vtbl->invoke) return DISP_E_MEMBERNOTFOUND; - return dispex->info->desc->vtbl->invoke(dispex, id, lcid, wFlags, pdp, res, pei, caller); + return dispex->info->desc->vtbl->invoke(dispex, this_obj, id, lcid, wFlags, pdp, res, pei, caller); case DISPEXPROP_DYNAMIC: { DWORD idx = id - DISPID_DYNPROP_0; @@ -2118,7 +2120,7 @@ HRESULT dispex_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD wFlags, DIS return E_NOTIMPL; } - return invoke_disp_value(dispex, V_DISPATCH(&prop->var), lcid, wFlags, pdp, res, pei, caller); + return invoke_disp_value(this_obj, V_DISPATCH(&prop->var), lcid, wFlags, pdp, res, pei, caller); case DISPATCH_PROPERTYGET: if(prop->flags & DYNPROP_DELETED) return DISP_E_MEMBERNOTFOUND; @@ -2157,7 +2159,7 @@ HRESULT dispex_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD wFlags, DIS return E_FAIL; } - return invoke_builtin_prop(dispex, id, lcid, wFlags, pdp, res, pei, caller); + return invoke_builtin_prop(dispex, this_obj, id, lcid, wFlags, pdp, res, pei, caller); default: assert(0); return E_FAIL; diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 4f70ca980b9..9c424f86ab8 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5935,8 +5935,8 @@ static HRESULT HTMLDocumentNode_get_name(DispatchEx *dispex, DISPID id, BSTR *na return (*name = SysAllocString(This->elem_vars[idx])) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); nsIDOMElement *nselem; @@ -6095,6 +6095,7 @@ static HRESULT HTMLDocumentNode_location_hook(DispatchEx *dispex, WORD flags, DI return E_FAIL; return dispex_invoke(&This->window->base.outer_window->base.inner_window->event_target.dispex, + (IDispatch*)&This->window->base.outer_window->base.inner_window->base.IHTMLWindow2_iface, DISPID_IHTMLWINDOW2_LOCATION, 0, flags, dp, res, ei, caller); } diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 346721e6b35..f8b23375c73 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1231,8 +1231,8 @@ static HRESULT HTMLRectCollection_get_name(DispatchEx *dispex, DISPID id, BSTR * return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex); @@ -2676,8 +2676,8 @@ static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String) if(!String) return E_INVALIDARG; - hres = dispex_invoke(&This->node.event_target.dispex, DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, - DISPATCH_PROPERTYGET, NULL, &var, NULL, NULL); + hres = dispex_invoke(&This->node.event_target.dispex, (IDispatch*)&This->node.event_target.dispex.IDispatchEx_iface, + DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, NULL, &var, NULL, NULL); if(SUCCEEDED(hres)) { assert(V_VT(&var) == VT_BSTR); *String = V_BSTR(&var); @@ -7725,8 +7725,8 @@ static HRESULT token_list_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT token_list_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT token_list_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { struct token_list *token_list = token_list_from_DispatchEx(dispex); @@ -8147,8 +8147,8 @@ static HRESULT HTMLFiltersCollection_get_name(DispatchEx *dispex, DISPID id, BST return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { TRACE("(%p)->(%lx %lx %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei); @@ -8877,7 +8877,7 @@ static HRESULT HTMLAttributeCollection_get_name(DispatchEx *dispex, DISPID id, B return E_NOTIMPL; } -static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, +static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index 8ebe741c309..23ff4722440 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -596,8 +596,8 @@ static HRESULT HTMLElementCollection_get_name(DispatchEx *dispex, DISPID id, BST return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLElementCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLElementCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLElementCollection *This = impl_from_DispatchEx(dispex); DWORD idx; diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index fc30742d540..1da4a072c4c 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -922,8 +922,8 @@ static HRESULT HTMLFormElement_dispex_get_name(DispatchEx *dispex, DISPID id, BS return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLFormElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLFormElement_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLFormElement *This = impl_from_DispatchEx(dispex); IDispatch *ret; diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 33cea7b46fd..7af5344192a 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -987,8 +987,8 @@ static HRESULT HTMLFrameElement_get_name(DispatchEx *dispex, DISPID id, BSTR *na return *name ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLFrameElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLFrameElement_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLFrameElement *This = frame_from_DispatchEx(dispex); @@ -998,7 +998,7 @@ static HRESULT HTMLFrameElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, } return dispex_invoke(&This->framebase.content_window->base.inner_window->event_target.dispex, - id, lcid, flags, params, res, ei, caller); + this_obj, id, lcid, flags, params, res, ei, caller); } static const NodeImplVtbl HTMLFrameElementImplVtbl = { @@ -1577,8 +1577,8 @@ static HRESULT HTMLIFrame_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return *name ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLIFrame_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLIFrame_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLIFrame *This = iframe_from_DispatchEx(dispex); @@ -1588,7 +1588,7 @@ static HRESULT HTMLIFrame_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD } return dispex_invoke(&This->framebase.content_window->base.inner_window->event_target.dispex, - id, lcid, flags, params, res, ei, caller); + this_obj, id, lcid, flags, params, res, ei, caller); } static const NodeImplVtbl HTMLIFrameImplVtbl = { diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index cc458c82e32..17497239215 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -398,8 +398,8 @@ static HRESULT HTMLDOMChildrenCollection_get_name(DispatchEx *dispex, DISPID id, return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLDOMChildrenCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLDOMChildrenCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLDOMChildrenCollection *This = impl_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index d6b1799f674..48bada6de72 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -728,8 +728,8 @@ static HRESULT HTMLObjectElement_dispex_get_name(DispatchEx *dispex, DISPID id, return E_NOTIMPL; } -static HRESULT HTMLObjectElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLObjectElement_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLObjectElement *This = impl_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 88bec85597b..f8c0eada2f6 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -1398,8 +1398,8 @@ static HRESULT HTMLSelectElement_dispex_get_name(DispatchEx *dispex, DISPID id, return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLSelectElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLSelectElement_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLSelectElement *This = impl_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index 68452794449..cf87df7381d 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -1176,8 +1176,8 @@ static HRESULT HTMLStorage_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return (*name = SysAllocString(This->props[idx])) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLStorage_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLStorage_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLStorage *This = impl_from_DispatchEx(dispex); DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index d5c486f443f..bf8e6c66024 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -422,8 +422,8 @@ static HRESULT HTMLStyleSheetRulesCollection_get_name(DispatchEx *dispex, DISPID return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLStyleSheetRulesCollection *This = HTMLStyleSheetRulesCollection_from_DispatchEx(dispex); @@ -846,8 +846,8 @@ static HRESULT HTMLStyleSheetsCollection_get_name(DispatchEx *dispex, DISPID id, return (*name = SysAllocStringLen(buf, len)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLStyleSheetsCollection *This = HTMLStyleSheetsCollection_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index e4fc0920fce..272d5330b13 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4126,8 +4126,8 @@ static HRESULT HTMLWindow_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return (*name = SysAllocString(This->global_props[idx].name)) ? S_OK : E_OUTOFMEMORY; } -static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +static HRESULT HTMLWindow_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); global_prop_t *prop; @@ -4191,7 +4191,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD prop->type = GLOBAL_DISPEXVAR; prop->id = dispex_id; - return dispex_invoke(&This->event_target.dispex, dispex_id, 0, flags, params, res, ei, caller); + return dispex_invoke(&This->event_target.dispex, this_obj, dispex_id, 0, flags, params, res, ei, caller); } default: FIXME("Not supported flags: %x\n", flags); @@ -4219,7 +4219,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD return E_NOTIMPL; } case GLOBAL_DISPEXVAR: - return dispex_invoke(&This->event_target.dispex, prop->id, 0, flags, params, res, ei, caller); + return dispex_invoke(&This->event_target.dispex, this_obj, prop->id, 0, flags, params, res, ei, caller); default: ERR("invalid type %d\n", prop->type); hres = DISP_E_MEMBERNOTFOUND; @@ -4282,7 +4282,8 @@ static HRESULT IHTMLWindow2_location_hook(DispatchEx *dispex, WORD flags, DISPPA if(FAILED(hres)) return hres; - hres = dispex_invoke(&location->dispex, DISPID_VALUE, 0, flags, dp, res, ei, caller); + hres = dispex_invoke(&location->dispex, (IDispatch*)&location->IHTMLLocation_iface, + DISPID_VALUE, 0, flags, dp, res, ei, caller); IHTMLLocation_Release(&location->IHTMLLocation_iface); return hres; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ab07a997d53..946cc99151d 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -374,7 +374,7 @@ typedef struct { /* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */ HRESULT (*get_name)(DispatchEx*,DISPID,BSTR*); - HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); + HRESULT (*invoke)(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*delete)(DispatchEx*,DISPID); HRESULT (*next_dispid)(DispatchEx*,DISPID,DISPID*); @@ -441,7 +441,7 @@ HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); HRESULT get_dispids(tid_t,DWORD*,DISPID**); HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*); HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*); -HRESULT dispex_invoke(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); +HRESULT dispex_invoke(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT dispex_delete_prop(DispatchEx*,DISPID); void release_typelib(void); HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**); From 609aacd1dd6b6f2887c1d0238c7d949853bfcb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0942/1506] mshtml: Always initialize the vtable before calling init_dispatch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that init_dispatch is always able to use query_interface, which is going to be needed when initializing the proxy. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 2 +- dlls/mshtml/omnavigator.c | 4 ++-- dlls/mshtml/range.c | 8 ++++---- dlls/mshtml/selection.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 28af7f4ed51..edfa145b5a3 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -5836,8 +5836,8 @@ static int event_id_cmp(const void *key, const struct wine_rb_entry *entry) void EventTarget_Init(EventTarget *event_target, dispex_static_data_t *dispex_data, compat_mode_t compat_mode) { - init_dispatch(&event_target->dispex, dispex_data, compat_mode); event_target->IEventTarget_iface.lpVtbl = &EventTargetVtbl; + init_dispatch(&event_target->dispex, dispex_data, compat_mode); wine_rb_init(&event_target->handler_map, event_id_cmp); } diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 406b57479e6..710f20697f4 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -755,12 +755,12 @@ HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret) if(!history) return E_OUTOFMEMORY; - init_dispatch(&history->dispex, &OmHistory_dispex, dispex_compat_mode(&window->event_target.dispex)); history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl; - history->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + init_dispatch(&history->dispex, &OmHistory_dispex, dispex_compat_mode(&window->event_target.dispex)); + *ret = history; return S_OK; } diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index e9b0b0edfef..8bbaa1f4731 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -1750,11 +1750,11 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx if(!ret) return E_OUTOFMEMORY; - init_dispatch(&ret->dispex, &HTMLTxtRange_dispex, dispex_compat_mode(&doc->node.event_target.dispex)); - ret->IHTMLTxtRange_iface.lpVtbl = &HTMLTxtRangeVtbl; ret->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl; + init_dispatch(&ret->dispex, &HTMLTxtRange_dispex, dispex_compat_mode(&doc->node.event_target.dispex)); + if(nsrange) nsIDOMRange_AddRef(nsrange); ret->nsrange = nsrange; @@ -2106,10 +2106,10 @@ HRESULT create_dom_range(nsIDOMRange *nsrange, compat_mode_t compat_mode, IHTMLD if(!ret) return E_OUTOFMEMORY; - init_dispatch(&ret->dispex, &HTMLDOMRange_dispex, compat_mode); - ret->IHTMLDOMRange_iface.lpVtbl = &HTMLDOMRangeVtbl; + init_dispatch(&ret->dispex, &HTMLDOMRange_dispex, compat_mode); + if(nsrange) nsIDOMRange_AddRef(nsrange); ret->nsrange = nsrange; diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 0da2246a69e..3f93029c957 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -357,8 +357,6 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect if(!selection) return E_OUTOFMEMORY; - init_dispatch(&selection->dispex, &HTMLSelectionObject_dispex, dispex_compat_mode(&doc->node.event_target.dispex)); - selection->IHTMLSelectionObject_iface.lpVtbl = &HTMLSelectionObjectVtbl; selection->IHTMLSelectionObject2_iface.lpVtbl = &HTMLSelectionObject2Vtbl; selection->nsselection = nsselection; /* We shouldn't call AddRef here */ @@ -366,6 +364,8 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect selection->doc = doc; list_add_head(&doc->selection_list, &selection->entry); + init_dispatch(&selection->dispex, &HTMLSelectionObject_dispex, dispex_compat_mode(&doc->node.event_target.dispex)); + *ret = &selection->IHTMLSelectionObject_iface; return S_OK; } From b93f40e4c1a82b79a9d6b8defa6f7555528ce852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0943/1506] mshtml: Pass the inner window to init_dispatch. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently not used, but it will be used to initialize the proxy for non-delay-init dispex, since the window itself is the global object and should always have proxy available. This will also be needed later for legacy "prototypes" (in IE8 and below modes) where we'll have links to them from the window, so it will be needed anyway. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 4 +- dlls/mshtml/htmlattr.c | 5 ++- dlls/mshtml/htmlcurstyle.c | 3 +- dlls/mshtml/htmldoc.c | 42 ++++++++++-------- dlls/mshtml/htmlelem.c | 62 ++++++++++++++++---------- dlls/mshtml/htmlelemcol.c | 31 ++++++++----- dlls/mshtml/htmlevent.c | 84 ++++++++++++++++++++---------------- dlls/mshtml/htmlevent.h | 5 ++- dlls/mshtml/htmlform.c | 3 +- dlls/mshtml/htmlimg.c | 2 +- dlls/mshtml/htmllocation.c | 2 +- dlls/mshtml/htmlnode.c | 17 +++++--- dlls/mshtml/htmlselect.c | 2 +- dlls/mshtml/htmlstorage.c | 7 ++- dlls/mshtml/htmlstyle.c | 13 +++--- dlls/mshtml/htmlstyle.h | 4 +- dlls/mshtml/htmlstyleelem.c | 3 +- dlls/mshtml/htmlstylesheet.c | 62 +++++++++++++++++++------- dlls/mshtml/htmltable.c | 6 +-- dlls/mshtml/htmlwindow.c | 14 +++--- dlls/mshtml/mshtml_private.h | 49 +++++++++++---------- dlls/mshtml/mutation.c | 40 +++++++++++++---- dlls/mshtml/nsembed.c | 3 +- dlls/mshtml/nsevents.c | 10 ++--- dlls/mshtml/omnavigator.c | 53 +++++++++++++++-------- dlls/mshtml/range.c | 6 +-- dlls/mshtml/selection.c | 2 +- dlls/mshtml/xmlhttprequest.c | 6 +-- 28 files changed, 333 insertions(+), 207 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index adcb6aa7520..8f95ee47a02 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1063,7 +1063,7 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info) if(!ret) return NULL; - init_dispatch(&ret->dispex, &function_dispex, dispex_compat_mode(obj)); + init_dispatch(&ret->dispex, &function_dispex, NULL, dispex_compat_mode(obj)); ret->obj = obj; ret->info = info; @@ -2314,7 +2314,7 @@ const void *dispex_get_vtbl(DispatchEx *dispex) return dispex->info->desc->vtbl; } -void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, compat_mode_t compat_mode) +void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, HTMLInnerWindow *window, compat_mode_t compat_mode) { assert(compat_mode < COMPAT_MODE_CNT); diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index cbd847038d6..93ecc8972f3 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -516,7 +516,8 @@ HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute *iface) return iface->lpVtbl == &HTMLDOMAttributeVtbl ? impl_from_IHTMLDOMAttribute(iface) : NULL; } -HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dispid, compat_mode_t compat_mode, HTMLDOMAttribute **attr) +HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLDocumentNode *doc, HTMLElement *elem, DISPID dispid, + compat_mode_t compat_mode, HTMLDOMAttribute **attr) { HTMLAttributeCollection *col; HTMLDOMAttribute *ret; @@ -531,7 +532,7 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dis ret->dispid = dispid; ret->elem = elem; - init_dispatch(&ret->dispex, &HTMLDOMAttribute_dispex, compat_mode); + init_dispatch(&ret->dispex, &HTMLDOMAttribute_dispex, get_inner_window(doc), compat_mode); /* For attributes attached to an element, (elem,dispid) pair should be valid used for its operation. */ if(elem) { diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index 29543eb4a18..b5d8293f509 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -1390,7 +1390,8 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p) ret->IHTMLCurrentStyle3_iface.lpVtbl = &HTMLCurrentStyle3Vtbl; ret->IHTMLCurrentStyle4_iface.lpVtbl = &HTMLCurrentStyle4Vtbl; - init_css_style(&ret->css_style, nsstyle, &HTMLCurrentStyle_dispex, dispex_compat_mode(&elem->node.event_target.dispex)); + init_css_style(&ret->css_style, nsstyle, &HTMLCurrentStyle_dispex, get_inner_window(elem->node.doc), + dispex_compat_mode(&elem->node.event_target.dispex)); nsIDOMCSSStyleDeclaration_Release(nsstyle); IHTMLElement_AddRef(&elem->IHTMLElement_iface); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 9c424f86ab8..acfb77bf532 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -148,6 +148,12 @@ UINT get_document_charset(HTMLDocumentNode *doc) return doc->charset = ret; } +/* Get inner window even for document nodes with no window */ +HTMLInnerWindow *get_inner_window(HTMLDocumentNode *doc) +{ + return doc->window ? doc->window : doc->doc_obj->window->base.inner_window; +} + typedef struct { HTMLDOMNode node; IDOMDocumentType IDOMDocumentType_iface; @@ -592,7 +598,7 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen } if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); nsIDOMHTMLCollection_Release(nscoll); } @@ -629,7 +635,7 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme } if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); nsIDOMHTMLCollection_Release(nscoll); } @@ -666,7 +672,7 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement } if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); nsIDOMHTMLCollection_Release(nscoll); } @@ -703,7 +709,7 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement } if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); nsIDOMHTMLCollection_Release(nscoll); } @@ -740,7 +746,7 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme } if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); nsIDOMHTMLCollection_Release(nscoll); } @@ -830,7 +836,7 @@ static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLEleme } if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); nsIDOMHTMLCollection_Release(nscoll); } @@ -2029,8 +2035,7 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface, return map_nsresult(nsres); } - hres = create_style_sheet_collection(nsstylelist, - dispex_compat_mode(&This->node.event_target.dispex), p); + hres = create_style_sheet_collection(nsstylelist, This, p); nsIDOMStyleSheetList_Release(nsstylelist); return hres; } @@ -2099,8 +2104,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR if(bstrHref && *bstrHref) { FIXME("semi-stub for href %s\n", debugstr_w(bstrHref)); - return create_style_sheet(NULL, dispex_compat_mode(&This->node.event_target.dispex), - ppnewStyleSheet); + return create_style_sheet(NULL, This, ppnewStyleSheet); } hres = create_element(This, L"style", &elem); @@ -2739,7 +2743,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST return E_FAIL; } - *ppelColl = create_collection_from_nodelist(node_list, This->document_mode); + *ppelColl = create_collection_from_nodelist(node_list, This); nsIDOMNodeList_Release(node_list); return S_OK; } @@ -2816,7 +2820,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, } - *pelColl = create_collection_from_nodelist(nslist, This->document_mode); + *pelColl = create_collection_from_nodelist(nslist, This); nsIDOMNodeList_Release(nslist); return S_OK; @@ -3000,8 +3004,7 @@ static HRESULT WINAPI HTMLDocument4_get_namespaces(IHTMLDocument4 *iface, IDispa if(!This->namespaces) { HRESULT hres; - hres = create_namespace_collection(dispex_compat_mode(&This->node.event_target.dispex), - &This->namespaces); + hres = create_namespace_collection(This, &This->namespaces); if(FAILED(hres)) return hres; } @@ -3045,7 +3048,7 @@ static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface, return E_NOTIMPL; } - return create_event_obj(NULL, dispex_compat_mode(&This->node.event_target.dispex), ppEventObj); + return create_event_obj(This, NULL, ppEventObj); } static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName, @@ -3239,7 +3242,8 @@ static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute); - hres = HTMLDOMAttribute_Create(bstrattrName, NULL, 0, dispex_compat_mode(&This->node.event_target.dispex), &attr); + hres = HTMLDOMAttribute_Create(bstrattrName, This, NULL, 0, + dispex_compat_mode(&This->node.event_target.dispex), &attr); if(FAILED(hres)) return hres; @@ -3798,7 +3802,7 @@ static HRESULT WINAPI HTMLDocument7_getElementsByClassName(IHTMLDocument7 *iface } - *pel = create_collection_from_nodelist(nslist, This->document_mode); + *pel = create_collection_from_nodelist(nslist, This); nsIDOMNodeList_Release(nslist); return S_OK; } @@ -4802,7 +4806,7 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface return map_nsresult(nsres); } - hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel); + hres = create_child_collection(node_list, This, pel); nsIDOMNodeList_Release(node_list); return hres; } @@ -5690,7 +5694,7 @@ static HRESULT WINAPI DocumentRange_createRange(IDocumentRange *iface, IHTMLDOMR if(NS_FAILED(nsIDOMDocument_CreateRange(This->dom_document, &nsrange))) return E_FAIL; - hres = create_dom_range(nsrange, dispex_compat_mode(&This->node.event_target.dispex), p); + hres = create_dom_range(nsrange, This, p); nsIDOMRange_Release(nsrange); return hres; } diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index f8b23375c73..11345157d88 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -346,7 +346,7 @@ static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFilte return CONTAINING_RECORD(iface, HTMLFiltersCollection, IHTMLFiltersCollection_iface); } -static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret); +static HRESULT create_filters_collection(HTMLElement *elem, IHTMLFiltersCollection **ret); static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface) { @@ -865,7 +865,8 @@ static dispex_static_data_t HTMLRect_dispex = { HTMLRect_init_dispex_info }; -static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_mode, IHTMLRect **ret) +static HRESULT create_html_rect(nsIDOMClientRect *nsrect, HTMLInnerWindow *window, compat_mode_t compat_mode, + IHTMLRect **ret) { HTMLRect *rect; @@ -876,7 +877,7 @@ static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_m rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl; rect->IHTMLRect2_iface.lpVtbl = &HTMLRect2Vtbl; - init_dispatch(&rect->dispex, &HTMLRect_dispex, compat_mode); + init_dispatch(&rect->dispex, &HTMLRect_dispex, window, compat_mode); nsIDOMClientRect_AddRef(nsrect); rect->nsrect = nsrect; @@ -889,6 +890,7 @@ typedef struct { DispatchEx dispex; IHTMLRectCollection IHTMLRectCollection_iface; + HTMLInnerWindow *window; nsIDOMClientRectList *rect_list; } HTMLRectCollection; @@ -1138,7 +1140,7 @@ static HRESULT WINAPI HTMLRectCollection_item(IHTMLRectCollection *iface, VARIAN return S_OK; } - hres = create_html_rect(nsrect, dispex_compat_mode(&This->dispex), &rect); + hres = create_html_rect(nsrect, This->window, dispex_compat_mode(&This->dispex), &rect); nsIDOMClientRect_Release(nsrect); if(FAILED(hres)) return hres; @@ -1179,6 +1181,8 @@ static void *HTMLRectCollection_query_interface(DispatchEx *dispex, REFIID riid) static void HTMLRectCollection_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) { HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex); + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); if(This->rect_list) note_cc_edge((nsISupports*)This->rect_list, "rect_list", cb); } @@ -1186,6 +1190,12 @@ static void HTMLRectCollection_traverse(DispatchEx *dispex, nsCycleCollectionTra static void HTMLRectCollection_unlink(DispatchEx *dispex) { HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex); + + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } unlink_ref(&This->rect_list); } @@ -1251,7 +1261,7 @@ static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, IDispatch *this_obj return DISP_E_MEMBERNOTFOUND; } - hres = create_html_rect(rect, dispex_compat_mode(&This->dispex), &html_rect); + hres = create_html_rect(rect, This->window, dispex_compat_mode(&This->dispex), &html_rect); nsIDOMClientRect_Release(rect); if(FAILED(hres)) return hres; @@ -2644,7 +2654,7 @@ static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, IHTMLFiltersC if(!p) return E_POINTER; - return create_filters_collection(dispex_compat_mode(&This->node.event_target.dispex), p); + return create_filters_collection(This, p); } static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v) @@ -2829,7 +2839,7 @@ static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch ** return E_FAIL; } - *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc->document_mode); + *p = (IDispatch*)create_collection_from_nodelist(nsnode_list, This->node.doc); nsIDOMNodeList_Release(nsnode_list); return S_OK; @@ -3303,7 +3313,10 @@ static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRec rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl; rects->rect_list = rect_list; - init_dispatch(&rects->dispex, &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex)); + rects->window = get_inner_window(This->node.doc); + IHTMLWindow2_AddRef(&rects->window->base.IHTMLWindow2_iface); + + init_dispatch(&rects->dispex, &HTMLRectCollection_dispex, rects->window, dispex_compat_mode(&This->node.event_target.dispex)); *pRectCol = &rects->IHTMLRectCollection_iface; return S_OK; @@ -3329,7 +3342,7 @@ static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, I return E_FAIL; } - hres = create_html_rect(nsrect, dispex_compat_mode(&This->node.event_target.dispex), pRect); + hres = create_html_rect(nsrect, get_inner_window(This->node.doc), dispex_compat_mode(&This->node.event_target.dispex), pRect); nsIDOMClientRect_Release(nsrect); return hres; @@ -4056,7 +4069,7 @@ static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BS TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl); if(!This->dom_element) { - *pelColl = create_collection_from_htmlcol(NULL, This->node.doc->document_mode); + *pelColl = create_collection_from_htmlcol(NULL, This->node.doc, dispex_compat_mode(&This->node.event_target.dispex)); return S_OK; } @@ -4068,7 +4081,7 @@ static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BS return E_FAIL; } - *pelColl = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex)); + *pelColl = create_collection_from_htmlcol(nscol, This->node.doc, dispex_compat_mode(&This->node.event_target.dispex)); nsIDOMHTMLCollection_Release(nscol); return S_OK; } @@ -5222,7 +5235,7 @@ static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface, } } - *pel = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->node.event_target.dispex)); + *pel = create_collection_from_htmlcol(nscol, This->node.doc, dispex_compat_mode(&This->node.event_target.dispex)); nsIDOMHTMLCollection_Release(nscol); return S_OK; } @@ -6498,7 +6511,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, return map_nsresult(nsres); } - hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel); + hres = create_child_collection(node_list, This->node.doc, pel); nsIDOMNodeList_Release(node_list); return hres; } @@ -7772,7 +7785,7 @@ static dispex_static_data_t token_list_dispex = { token_list_iface_tids }; -static HRESULT create_token_list(compat_mode_t compat_mode, IHTMLElement *element, IWineDOMTokenList **ret) +static HRESULT create_token_list(compat_mode_t compat_mode, HTMLElement *element, IWineDOMTokenList **ret) { struct token_list *obj; @@ -7784,9 +7797,10 @@ static HRESULT create_token_list(compat_mode_t compat_mode, IHTMLElement *elemen } obj->IWineDOMTokenList_iface.lpVtbl = &WineDOMTokenListVtbl; - init_dispatch(&obj->dispex, &token_list_dispex, compat_mode); - IHTMLElement_AddRef(element); - obj->element = element; + + init_dispatch(&obj->dispex, &token_list_dispex, get_inner_window(element->node.doc), compat_mode); + IHTMLElement_AddRef(&element->IHTMLElement_iface); + obj->element = &element->IHTMLElement_iface; *ret = &obj->IWineDOMTokenList_iface; return S_OK; @@ -7860,7 +7874,7 @@ static HRESULT WINAPI htmlelement_private_get_classList(IWineHTMLElementPrivate TRACE("iface %p, class_list %p.\n", iface, class_list); - return create_token_list(dispex_compat_mode(&This->node.event_target.dispex), &This->IHTMLElement_iface, + return create_token_list(dispex_compat_mode(&This->node.event_target.dispex), This, (IWineDOMTokenList **)class_list); } @@ -8179,8 +8193,9 @@ static dispex_static_data_t HTMLFiltersCollection_dispex = { HTMLFiltersCollection_iface_tids }; -static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret) +static HRESULT create_filters_collection(HTMLElement *elem, IHTMLFiltersCollection **ret) { + compat_mode_t compat_mode = dispex_compat_mode(&elem->node.event_target.dispex); HTMLFiltersCollection *collection; if(!(collection = malloc(sizeof(HTMLFiltersCollection)))) @@ -8188,7 +8203,8 @@ static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFilters collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl; - init_dispatch(&collection->dispex, &HTMLFiltersCollection_dispex, min(compat_mode, COMPAT_MODE_IE8)); + init_dispatch(&collection->dispex, &HTMLFiltersCollection_dispex, get_inner_window(elem->node.doc), + min(compat_mode, COMPAT_MODE_IE8)); *ret = &collection->IHTMLFiltersCollection_iface; return S_OK; @@ -8266,7 +8282,8 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG } if(!*attr) { - hres = HTMLDOMAttribute_Create(NULL, This->elem, id, dispex_compat_mode(&This->elem->node.event_target.dispex), attr); + hres = HTMLDOMAttribute_Create(NULL, This->elem->node.doc, This->elem, id, + dispex_compat_mode(&This->elem->node.event_target.dispex), attr); if(FAILED(hres)) return hres; } @@ -8956,7 +8973,8 @@ HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **a IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface); This->attrs->elem = This; list_init(&This->attrs->attrs); - init_dispatch(&This->attrs->dispex, &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex)); + init_dispatch(&This->attrs->dispex, &HTMLAttributeCollection_dispex, get_inner_window(This->node.doc), + dispex_compat_mode(&iface->event_target.dispex)); *ac = This->attrs; IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface); diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index 23ff4722440..d451dd33a54 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -35,6 +35,7 @@ typedef struct { DispatchEx dispex; IHTMLElementCollection IHTMLElementCollection_iface; + HTMLInnerWindow *window; HTMLElement **elems; DWORD len; } HTMLElementCollection; @@ -60,7 +61,7 @@ static inline HTMLElement *elem_from_HTMLDOMNode(HTMLDOMNode *iface) return CONTAINING_RECORD(iface, HTMLElement, node); } -static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement**,DWORD,compat_mode_t); +static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement**,DWORD,HTMLInnerWindow*,compat_mode_t); static void elem_vector_add(elem_vector_t *buf, HTMLElement *elem) { @@ -424,7 +425,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface, if(buf.len > 1) { elem_vector_normalize(&buf); - *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, + *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, This->window, dispex_compat_mode(&This->dispex)); }else { if(buf.len == 1) { @@ -487,7 +488,7 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface, TRACE("found %ld tags\n", buf.len); - *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, + *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len, This->window, dispex_compat_mode(&This->dispex)); return S_OK; } @@ -530,6 +531,8 @@ static void HTMLElementCollection_traverse(DispatchEx *dispex, nsCycleCollection for(i = 0; i < This->len; i++) note_cc_edge((nsISupports*)&This->elems[i]->node.IHTMLDOMNode_iface, "elem", cb); + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); } static void HTMLElementCollection_unlink(DispatchEx *dispex) @@ -543,6 +546,11 @@ static void HTMLElementCollection_unlink(DispatchEx *dispex) node_release(&This->elems[i]->node); free(This->elems); } + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } } static void HTMLElementCollection_destructor(DispatchEx *dispex) @@ -700,11 +708,11 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node, BOOL include_ro create_all_list(node, &buf); elem_vector_normalize(&buf); - return HTMLElementCollection_Create(buf.buf, buf.len, + return HTMLElementCollection_Create(buf.buf, buf.len, get_inner_window(node->doc), dispex_compat_mode(&node->event_target.dispex)); } -IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, compat_mode_t compat_mode) +IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, HTMLDocumentNode *doc) { UINT32 length = 0, i; HTMLDOMNode *node; @@ -736,10 +744,11 @@ IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, buf.buf = NULL; } - return HTMLElementCollection_Create(buf.buf, buf.len, compat_mode); + return HTMLElementCollection_Create(buf.buf, buf.len, get_inner_window(doc), doc->document_mode); } -IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection *nscol, compat_mode_t compat_mode) +IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection *nscol, HTMLDocumentNode *doc, + compat_mode_t compat_mode) { UINT32 length = 0, i; elem_vector_t buf; @@ -772,7 +781,7 @@ IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection *nsc return NULL; } - return HTMLElementCollection_Create(buf.buf, buf.len, compat_mode); + return HTMLElementCollection_Create(buf.buf, buf.len, get_inner_window(doc), compat_mode); } HRESULT get_elem_source_index(HTMLElement *elem, LONG *ret) @@ -848,7 +857,7 @@ HRESULT get_elem_source_index(HTMLElement *elem, LONG *ret) } static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, DWORD len, - compat_mode_t compat_mode) + HTMLInnerWindow *window, compat_mode_t compat_mode) { HTMLElementCollection *ret = calloc(1, sizeof(HTMLElementCollection)); @@ -858,8 +867,10 @@ static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, ret->IHTMLElementCollection_iface.lpVtbl = &HTMLElementCollectionVtbl; ret->elems = elems; ret->len = len; + ret->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&ret->dispex, &HTMLElementCollection_dispex, compat_mode); + init_dispatch(&ret->dispex, &HTMLElementCollection_dispex, window, compat_mode); TRACE("ret=%p len=%ld\n", ret, len); diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index edfa145b5a3..bfb72c09e2b 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -2076,7 +2076,7 @@ static dispex_static_data_t HTMLEventObj_dispex = { HTMLEventObj_iface_tids }; -static HTMLEventObj *alloc_event_obj(DOMEvent *event, compat_mode_t compat_mode) +static HTMLEventObj *alloc_event_obj(DOMEvent *event, HTMLInnerWindow *window, compat_mode_t compat_mode) { HTMLEventObj *event_obj; @@ -2094,15 +2094,15 @@ static HTMLEventObj *alloc_event_obj(DOMEvent *event, compat_mode_t compat_mode) if(event) IDOMEvent_AddRef(&event->IDOMEvent_iface); - init_dispatch(&event_obj->dispex, &HTMLEventObj_dispex, compat_mode); + init_dispatch(&event_obj->dispex, &HTMLEventObj_dispex, window, compat_mode); return event_obj; } -HRESULT create_event_obj(DOMEvent *event, compat_mode_t compat_mode, IHTMLEventObj **ret) +HRESULT create_event_obj(HTMLDocumentNode *doc, DOMEvent *event, IHTMLEventObj **ret) { HTMLEventObj *event_obj; - event_obj = alloc_event_obj(event, compat_mode); + event_obj = alloc_event_obj(event, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex)); if(!event_obj) return E_OUTOFMEMORY; @@ -2413,6 +2413,8 @@ static void *DOMEvent_query_interface(DispatchEx *dispex, REFIID riid) static void DOMEvent_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) { DOMEvent *This = DOMEvent_from_DispatchEx(dispex); + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); if(This->target) note_cc_edge((nsISupports*)&This->target->IEventTarget_iface, "target", cb); if(This->nsevent) @@ -2422,6 +2424,11 @@ static void DOMEvent_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCall static void DOMEvent_unlink(DispatchEx *dispex) { DOMEvent *This = DOMEvent_from_DispatchEx(dispex); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } if(This->target) { EventTarget *target = This->target; This->target = NULL; @@ -4412,8 +4419,8 @@ static dispex_static_data_t DOMStorageEvent_dispex = { DOMStorageEvent_iface_tids }; -static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, nsIDOMEvent *nsevent, eventid_t event_id, - compat_mode_t compat_mode) +static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, nsIDOMEvent *nsevent, HTMLInnerWindow *window, + eventid_t event_id, compat_mode_t compat_mode) { DOMEvent *event = calloc(1, size); @@ -4421,6 +4428,9 @@ static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, nsIDOM return NULL; event->IDOMEvent_iface.lpVtbl = &DOMEventVtbl; event->event_id = event_id; + event->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + if(event_id != EVENTID_LAST) { event->type = wcsdup(event_info[event_id].name); if(!event->type) { @@ -4434,7 +4444,7 @@ static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, nsIDOM event->time_stamp = get_time_stamp(); - init_dispatch(&event->dispex, dispex_data, compat_mode); + init_dispatch(&event->dispex, dispex_data, window, compat_mode); return event; } @@ -4444,23 +4454,23 @@ static void fill_parent_ui_event(nsIDOMEvent *nsevent, DOMUIEvent *ui_event) nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMUIEvent, (void**)&ui_event->nsevent); } -static DOMEvent *generic_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *generic_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - return event_ctor(sizeof(DOMEvent), &DOMEvent_dispex, nsevent, event_id, compat_mode); + return event_ctor(sizeof(DOMEvent), &DOMEvent_dispex, nsevent, window, event_id, compat_mode); } -static DOMEvent *ui_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *ui_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMUIEvent *ui_event = event_ctor(sizeof(DOMUIEvent), &DOMUIEvent_dispex, nsevent, event_id, compat_mode); + DOMUIEvent *ui_event = event_ctor(sizeof(DOMUIEvent), &DOMUIEvent_dispex, nsevent, window, event_id, compat_mode); if(!ui_event) return NULL; ui_event->IDOMUIEvent_iface.lpVtbl = &DOMUIEventVtbl; ui_event->nsevent = iface; return &ui_event->event; } -static DOMEvent *mouse_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *mouse_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMMouseEvent *mouse_event = event_ctor(sizeof(DOMMouseEvent), &DOMMouseEvent_dispex, nsevent, event_id, compat_mode); + DOMMouseEvent *mouse_event = event_ctor(sizeof(DOMMouseEvent), &DOMMouseEvent_dispex, nsevent, window, event_id, compat_mode); if(!mouse_event) return NULL; mouse_event->IDOMMouseEvent_iface.lpVtbl = &DOMMouseEventVtbl; mouse_event->nsevent = iface; @@ -4468,9 +4478,9 @@ static DOMEvent *mouse_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t e return &mouse_event->ui_event.event; } -static DOMEvent *keyboard_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *keyboard_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMKeyboardEvent *keyboard_event = event_ctor(sizeof(DOMKeyboardEvent), &DOMKeyboardEvent_dispex, nsevent, event_id, compat_mode); + DOMKeyboardEvent *keyboard_event = event_ctor(sizeof(DOMKeyboardEvent), &DOMKeyboardEvent_dispex, nsevent, window, event_id, compat_mode); if(!keyboard_event) return NULL; keyboard_event->IDOMKeyboardEvent_iface.lpVtbl = &DOMKeyboardEventVtbl; keyboard_event->nsevent = iface; @@ -4478,45 +4488,45 @@ static DOMEvent *keyboard_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_ return &keyboard_event->ui_event.event; } -static DOMEvent *page_transition_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *page_transition_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMPageTransitionEvent *page_transition_event = event_ctor(sizeof(DOMCustomEvent), &DOMPageTransitionEvent_dispex, nsevent, event_id, compat_mode); + DOMPageTransitionEvent *page_transition_event = event_ctor(sizeof(DOMCustomEvent), &DOMPageTransitionEvent_dispex, nsevent, window, event_id, compat_mode); if(!page_transition_event) return NULL; page_transition_event->IWinePageTransitionEvent_iface.lpVtbl = &DOMPageTransitionEventVtbl; return &page_transition_event->event; } -static DOMEvent *custom_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *custom_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMCustomEvent *custom_event = event_ctor(sizeof(DOMCustomEvent), &DOMCustomEvent_dispex, nsevent, event_id, compat_mode); + DOMCustomEvent *custom_event = event_ctor(sizeof(DOMCustomEvent), &DOMCustomEvent_dispex, nsevent, window, event_id, compat_mode); if(!custom_event) return NULL; custom_event->IDOMCustomEvent_iface.lpVtbl = &DOMCustomEventVtbl; nsIDOMCustomEvent_Release(iface); return &custom_event->event; } -static DOMEvent *progress_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *progress_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { DOMProgressEvent *progress_event; - if(!(progress_event = event_ctor(sizeof(DOMProgressEvent), &DOMProgressEvent_dispex, nsevent, event_id, compat_mode))) + if(!(progress_event = event_ctor(sizeof(DOMProgressEvent), &DOMProgressEvent_dispex, nsevent, window, event_id, compat_mode))) return NULL; progress_event->IDOMProgressEvent_iface.lpVtbl = &DOMProgressEventVtbl; progress_event->nsevent = iface; return &progress_event->event; } -static DOMEvent *message_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *message_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMMessageEvent *message_event = event_ctor(sizeof(DOMMessageEvent), &DOMMessageEvent_dispex, nsevent, event_id, compat_mode); + DOMMessageEvent *message_event = event_ctor(sizeof(DOMMessageEvent), &DOMMessageEvent_dispex, nsevent, window, event_id, compat_mode); if(!message_event) return NULL; message_event->IDOMMessageEvent_iface.lpVtbl = &DOMMessageEventVtbl; return &message_event->event; } -static DOMEvent *storage_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) +static DOMEvent *storage_event_ctor(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow *window, eventid_t event_id, compat_mode_t compat_mode) { - DOMStorageEvent *storage_event = event_ctor(sizeof(DOMStorageEvent), &DOMStorageEvent_dispex, nsevent, event_id, compat_mode); + DOMStorageEvent *storage_event = event_ctor(sizeof(DOMStorageEvent), &DOMStorageEvent_dispex, nsevent, window, event_id, compat_mode); if(!storage_event) return NULL; storage_event->IDOMStorageEvent_iface.lpVtbl = &DOMStorageEventVtbl; return &storage_event->event; @@ -4524,7 +4534,7 @@ static DOMEvent *storage_event_ctor(void *iface, nsIDOMEvent *nsevent, eventid_t static const struct { REFIID iid; - DOMEvent *(*ctor)(void *iface, nsIDOMEvent *nsevent, eventid_t, compat_mode_t); + DOMEvent *(*ctor)(void *iface, nsIDOMEvent *nsevent, HTMLInnerWindow*, eventid_t, compat_mode_t); compat_mode_t min_compat_mode; } event_types_ctor_table[] = { [EVENT_TYPE_EVENT] = { NULL, generic_event_ctor }, @@ -4541,8 +4551,8 @@ static const struct { [EVENT_TYPE_STORAGE] = { NULL, storage_event_ctor }, }; -static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, event_type_t event_type, - eventid_t event_id) +static DOMEvent *alloc_event(nsIDOMEvent *nsevent, HTMLInnerWindow *window, compat_mode_t compat_mode, + event_type_t event_type, eventid_t event_id) { void *iface = NULL; DOMEvent *event; @@ -4554,12 +4564,12 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, ev nsIDOMEvent_QueryInterface(nsevent, event_types_ctor_table[event_type].iid, &iface); /* Transfer the iface ownership to the ctor on success */ - if(!(event = event_types_ctor_table[event_type].ctor(iface, nsevent, event_id, compat_mode)) && iface) + if(!(event = event_types_ctor_table[event_type].ctor(iface, nsevent, window, event_id, compat_mode)) && iface) nsISupports_Release(iface); return event; } -HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, compat_mode_t compat_mode, DOMEvent **ret_event) +HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, HTMLInnerWindow *window, compat_mode_t compat_mode, DOMEvent **ret_event) { event_type_t event_type = EVENT_TYPE_EVENT; eventid_t event_id = EVENTID_LAST; @@ -4591,7 +4601,7 @@ HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, compat_mode_t compat_mod } } - event = alloc_event(nsevent, compat_mode, event_type, event_id); + event = alloc_event(nsevent, window, compat_mode, event_type, event_id); if(!event) return E_OUTOFMEMORY; @@ -4624,7 +4634,7 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM } } - event = alloc_event(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), + event = alloc_event(nsevent, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex), event_type, EVENTID_LAST); nsIDOMEvent_Release(nsevent); if(!event) @@ -4649,7 +4659,7 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven return E_FAIL; } - event = alloc_event(nsevent, doc->document_mode, event_info[event_id].type, event_id); + event = alloc_event(nsevent, get_inner_window(doc), doc->document_mode, event_info[event_id].type, event_id); nsIDOMEvent_Release(nsevent); if(!event) return E_OUTOFMEMORY; @@ -5095,7 +5105,7 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event, } while(iter); if(!event->event_obj && !event->no_event_obj) { - event_obj_ref = alloc_event_obj(event, dispex_compat_mode(&event->dispex)); + event_obj_ref = alloc_event_obj(event, event->window, dispex_compat_mode(&event->dispex)); if(event_obj_ref) event->event_obj = &event_obj_ref->IHTMLEventObj_iface; } @@ -5215,7 +5225,7 @@ HRESULT fire_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *event_va } if(!event_obj) { - event_obj = alloc_event_obj(NULL, dispex_compat_mode(&node->event_target.dispex)); + event_obj = alloc_event_obj(NULL, get_inner_window(node->doc), dispex_compat_mode(&node->event_target.dispex)); if(!event_obj) return E_OUTOFMEMORY; } @@ -5834,10 +5844,10 @@ static int event_id_cmp(const void *key, const struct wine_rb_entry *entry) return wcscmp(key, WINE_RB_ENTRY_VALUE(entry, listener_container_t, entry)->type); } -void EventTarget_Init(EventTarget *event_target, dispex_static_data_t *dispex_data, compat_mode_t compat_mode) +void EventTarget_Init(EventTarget *event_target, dispex_static_data_t *dispex_data, HTMLInnerWindow *window) { event_target->IEventTarget_iface.lpVtbl = &EventTargetVtbl; - init_dispatch(&event_target->dispex, dispex_data, compat_mode); + init_dispatch(&event_target->dispex, dispex_data, window, window ? window->doc->document_mode : COMPAT_MODE_NONE); wine_rb_init(&event_target->handler_map, event_id_cmp); } diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 645e99a4c19..22a7ab3f860 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -76,6 +76,7 @@ typedef struct DOMEvent { DispatchEx dispex; IDOMEvent IDOMEvent_iface; + HTMLInnerWindow *window; nsIDOMEvent *nsevent; eventid_t event_id; @@ -107,7 +108,7 @@ HRESULT fire_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*); void update_doc_cp_events(HTMLDocumentNode*,cp_static_data_t*); HRESULT doc_init_events(HTMLDocumentNode*); void detach_events(HTMLDocumentNode *doc); -HRESULT create_event_obj(DOMEvent*,compat_mode_t,IHTMLEventObj**); +HRESULT create_event_obj(HTMLDocumentNode*,DOMEvent*,IHTMLEventObj**); void bind_target_event(HTMLDocumentNode*,EventTarget*,const WCHAR*,IDispatch*); HRESULT ensure_doc_nsevent_handler(HTMLDocumentNode*,nsIDOMNode*,eventid_t); @@ -115,7 +116,7 @@ void dispatch_event(EventTarget*,DOMEvent*); HRESULT create_document_event(HTMLDocumentNode*,eventid_t,DOMEvent**); HRESULT create_document_event_str(HTMLDocumentNode*,const WCHAR*,IDOMEvent**); -HRESULT create_event_from_nsevent(nsIDOMEvent*,compat_mode_t,DOMEvent**); +HRESULT create_event_from_nsevent(nsIDOMEvent*,HTMLInnerWindow*,compat_mode_t,DOMEvent**); HRESULT create_message_event(HTMLDocumentNode*,IHTMLWindow2*,VARIANT*,DOMEvent**); HRESULT create_storage_event(HTMLDocumentNode*,BSTR,BSTR,BSTR,const WCHAR*,BOOL,DOMEvent**); diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index 1da4a072c4c..58616f234f9 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -452,7 +452,8 @@ static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDis return E_FAIL; } - *p = (IDispatch*)create_collection_from_htmlcol(elements, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = (IDispatch*)create_collection_from_htmlcol(elements, This->element.node.doc, + dispex_compat_mode(&This->element.node.event_target.dispex)); nsIDOMHTMLCollection_Release(elements); return S_OK; } diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index f037578e5d4..9e2ca279c01 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -999,7 +999,7 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElement ret->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&ret->dispex, &HTMLImageElementFactory_dispex, dispex_compat_mode(&window->event_target.dispex)); + init_dispatch(&ret->dispex, &HTMLImageElementFactory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret_val = ret; return S_OK; diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 92701cb42bc..4df640814e8 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -653,7 +653,7 @@ HRESULT create_location(HTMLOuterWindow *window, HTMLLocation **ret) location->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&location->dispex, &HTMLLocation_dispex, COMPAT_MODE_QUIRKS); + init_dispatch(&location->dispex, &HTMLLocation_dispex, window->base.inner_window, COMPAT_MODE_QUIRKS); *ret = location; return S_OK; diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 17497239215..fc6eba70303 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -451,7 +451,7 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = { HTMLDOMNode_init_dispex_info }; -HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mode, IHTMLDOMChildrenCollection **ret) +HRESULT create_child_collection(nsIDOMNodeList *nslist, HTMLDocumentNode *doc, IHTMLDOMChildrenCollection **ret) { HTMLDOMChildrenCollection *collection; @@ -463,7 +463,8 @@ HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mod nsIDOMNodeList_AddRef(nslist); collection->nslist = nslist; - init_dispatch(&collection->dispex, &HTMLDOMChildrenCollection_dispex, compat_mode); + init_dispatch(&collection->dispex, &HTMLDOMChildrenCollection_dispex, get_inner_window(doc), + dispex_compat_mode(&doc->node.event_target.dispex)); *ret = &collection->IHTMLDOMChildrenCollection_iface; return S_OK; @@ -623,8 +624,7 @@ static HRESULT WINAPI HTMLDOMNode_get_childNodes(IHTMLDOMNode *iface, IDispatch return hres; } - hres = create_child_collection(nslist, dispex_compat_mode(&This->event_target.dispex), - (IHTMLDOMChildrenCollection**)p); + hres = create_child_collection(nslist, This->doc, (IHTMLDOMChildrenCollection**)p); nsIDOMNodeList_Release(nslist); return hres; } @@ -1475,18 +1475,21 @@ static const NodeImplVtbl HTMLDOMNodeImplVtbl = { void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode, dispex_static_data_t *dispex_data) { + HTMLInnerWindow *window = NULL; nsresult nsres; node->IHTMLDOMNode_iface.lpVtbl = &HTMLDOMNodeVtbl; node->IHTMLDOMNode2_iface.lpVtbl = &HTMLDOMNode2Vtbl; node->IHTMLDOMNode3_iface.lpVtbl = &HTMLDOMNode3Vtbl; - EventTarget_Init(&node->event_target, dispex_data, doc->document_mode); - - if(&doc->node != node) + if(&doc->node != node) { IHTMLDOMNode_AddRef(&doc->node.IHTMLDOMNode_iface); + window = get_inner_window(doc); + } node->doc = doc; + EventTarget_Init(&node->event_target, dispex_data, window); + nsIDOMNode_AddRef(nsnode); node->nsnode = nsnode; diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index f8c0eada2f6..5f6e2288c9c 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -639,7 +639,7 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionEleme ret->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&ret->dispex, &HTMLOptionElementFactory_dispex, dispex_compat_mode(&window->event_target.dispex)); + init_dispatch(&ret->dispex, &HTMLOptionElementFactory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret_ptr = ret; return S_OK; diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index cf87df7381d..47578bacd12 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -208,15 +208,14 @@ static void storage_event_proc(event_task_t *_task) struct storage_event_task *task = (struct storage_event_task*)_task; HTMLInnerWindow *window = task->header.window; DOMEvent *event = task->event; - compat_mode_t compat_mode; VARIANT_BOOL cancelled; HRESULT hres; VARIANT var; - if(event->event_id == EVENTID_STORAGE && (compat_mode = dispex_compat_mode(&window->event_target.dispex)) >= COMPAT_MODE_IE9) { + if(event->event_id == EVENTID_STORAGE && dispex_compat_mode(&window->event_target.dispex) >= COMPAT_MODE_IE9) { dispatch_event(&window->event_target, event); if(window->doc) { - hres = create_event_obj(event, compat_mode, (IHTMLEventObj**)&V_DISPATCH(&var)); + hres = create_event_obj(window->doc, event, (IHTMLEventObj**)&V_DISPATCH(&var)); if(SUCCEEDED(hres)) { V_VT(&var) = VT_DISPATCH; fire_event(&window->doc->node, L"onstorage", &var, &cancelled); @@ -1499,7 +1498,7 @@ HRESULT create_html_storage(HTMLInnerWindow *window, BOOL local, IHTMLStorage ** storage->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&storage->dispex, &HTMLStorage_dispex, dispex_compat_mode(&window->event_target.dispex)); + init_dispatch(&storage->dispex, &HTMLStorage_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *p = &storage->IHTMLStorage_iface; return S_OK; diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 6dfa9744df3..676cbc1d5b5 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -10082,14 +10082,15 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration return E_NOTIMPL; } -void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, dispex_static_data_t *dispex_info, compat_mode_t compat_mode) +void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, dispex_static_data_t *dispex_info, + HTMLInnerWindow *window, compat_mode_t compat_mode) { style->IHTMLCSSStyleDeclaration_iface.lpVtbl = &HTMLCSSStyleDeclarationVtbl; style->IHTMLCSSStyleDeclaration2_iface.lpVtbl = &HTMLCSSStyleDeclaration2Vtbl; style->nsstyle = nsstyle; nsIDOMCSSStyleDeclaration_AddRef(nsstyle); - init_dispatch(&style->dispex, dispex_info, compat_mode); + init_dispatch(&style->dispex, dispex_info, window, compat_mode); } HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) @@ -10118,7 +10119,8 @@ HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) style->elem = elem; IHTMLDOMNode_AddRef(&elem->node.IHTMLDOMNode_iface); - init_css_style(&style->css_style, nsstyle, &HTMLStyle_dispex, dispex_compat_mode(&elem->node.event_target.dispex)); + init_css_style(&style->css_style, nsstyle, &HTMLStyle_dispex, get_inner_window(elem->node.doc), + dispex_compat_mode(&elem->node.event_target.dispex)); nsIDOMCSSStyleDeclaration_Release(nsstyle); *ret = style; @@ -10143,14 +10145,15 @@ static dispex_static_data_t HTMLW3CComputedStyle_dispex = { CSSStyle_init_dispex_info }; -HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, compat_mode_t compat_mode, IHTMLCSSStyleDeclaration **p) +HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, HTMLInnerWindow *window, + compat_mode_t compat_mode, IHTMLCSSStyleDeclaration **p) { CSSStyle *style; if(!(style = calloc(1, sizeof(*style)))) return E_OUTOFMEMORY; - init_css_style(style, nsstyle, &HTMLW3CComputedStyle_dispex, compat_mode); + init_css_style(style, nsstyle, &HTMLW3CComputedStyle_dispex, window, compat_mode); *p = &style->IHTMLCSSStyleDeclaration_iface; return S_OK; } diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index f6d5ea7c5bb..a2ce5c8243d 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -148,8 +148,8 @@ typedef enum { } styleid_t; HRESULT HTMLStyle_Create(HTMLElement*,HTMLStyle**); -HRESULT create_computed_style(nsIDOMCSSStyleDeclaration*,compat_mode_t,IHTMLCSSStyleDeclaration**); -void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,dispex_static_data_t*,compat_mode_t); +HRESULT create_computed_style(nsIDOMCSSStyleDeclaration*,HTMLInnerWindow*,compat_mode_t,IHTMLCSSStyleDeclaration**); +void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,dispex_static_data_t*,HTMLInnerWindow*,compat_mode_t); void *CSSStyle_query_interface(DispatchEx*,REFIID); void CSSStyle_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*); diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c index 5b3d9165964..e63b5dbaf05 100644 --- a/dlls/mshtml/htmlstyleelem.c +++ b/dlls/mshtml/htmlstyleelem.c @@ -200,8 +200,7 @@ static HRESULT WINAPI HTMLStyleElement_get_styleSheet(IHTMLStyleElement *iface, assert(nsres == NS_OK); if(ss) { - HRESULT hres = create_style_sheet(ss, dispex_compat_mode(&This->element.node.event_target.dispex), - &This->style_sheet); + HRESULT hres = create_style_sheet(ss, This->element.node.doc, &This->style_sheet); nsIDOMStyleSheet_Release(ss); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index bf8e6c66024..35b5c91ec94 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -36,6 +36,7 @@ struct HTMLStyleSheet { IHTMLStyleSheet IHTMLStyleSheet_iface; IHTMLStyleSheet4 IHTMLStyleSheet4_iface; + HTMLInnerWindow *window; nsIDOMCSSStyleSheet *nsstylesheet; }; @@ -43,6 +44,7 @@ struct HTMLStyleSheetsCollection { DispatchEx dispex; IHTMLStyleSheetsCollection IHTMLStyleSheetsCollection_iface; + HTMLDocumentNode *doc; nsIDOMStyleSheetList *nslist; }; @@ -59,6 +61,7 @@ struct HTMLStyleSheetRulesCollection { DispatchEx dispex; IHTMLStyleSheetRulesCollection IHTMLStyleSheetRulesCollection_iface; + HTMLInnerWindow *window; nsIDOMCSSRuleList *nslist; }; @@ -218,8 +221,8 @@ static dispex_static_data_t HTMLStyleSheetRule_dispex = { HTMLStyleSheetRule_iface_tids }; -static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_mode_t compat_mode, - IHTMLStyleSheetRule **ret) +static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, HTMLInnerWindow *window, + compat_mode_t compat_mode, IHTMLStyleSheetRule **ret) { HTMLStyleSheetRule *rule; nsresult nsres; @@ -230,7 +233,7 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_m rule->IHTMLStyleSheetRule_iface.lpVtbl = &HTMLStyleSheetRuleVtbl; rule->nsstylesheetrule = NULL; - init_dispatch(&rule->dispex, &HTMLStyleSheetRule_dispex, compat_mode); + init_dispatch(&rule->dispex, &HTMLStyleSheetRule_dispex, window, compat_mode); if (nsstylesheetrule) { @@ -335,7 +338,7 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCol if(!nsstylesheetrule) return E_INVALIDARG; - hres = create_style_sheet_rule(nsstylesheetrule, dispex_compat_mode(&This->dispex), p); + hres = create_style_sheet_rule(nsstylesheetrule, This->window, dispex_compat_mode(&This->dispex), p); nsIDOMCSSRule_Release(nsstylesheetrule); return hres; } @@ -370,6 +373,8 @@ static void *HTMLStyleSheetRulesCollection_query_interface(DispatchEx *dispex, R static void HTMLStyleSheetRulesCollection_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) { HTMLStyleSheetRulesCollection *This = HTMLStyleSheetRulesCollection_from_DispatchEx(dispex); + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); if(This->nslist) note_cc_edge((nsISupports*)This->nslist, "nslist", cb); } @@ -377,6 +382,11 @@ static void HTMLStyleSheetRulesCollection_traverse(DispatchEx *dispex, nsCycleCo static void HTMLStyleSheetRulesCollection_unlink(DispatchEx *dispex) { HTMLStyleSheetRulesCollection *This = HTMLStyleSheetRulesCollection_from_DispatchEx(dispex); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } unlink_ref(&This->nslist); } @@ -444,7 +454,7 @@ static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, IDispatc return S_OK; } - hres = create_style_sheet_rule(nsstylesheetrule, dispex_compat_mode(&This->dispex), &stylesheetrule); + hres = create_style_sheet_rule(nsstylesheetrule, This->window, dispex_compat_mode(&This->dispex), &stylesheetrule); nsIDOMCSSRule_Release(nsstylesheetrule); if(FAILED(hres)) return hres; @@ -482,8 +492,8 @@ static dispex_static_data_t HTMLStyleSheetRulesCollection_dispex = { HTMLStyleSheetRulesCollection_iface_tids }; -static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, compat_mode_t compat_mode, - IHTMLStyleSheetRulesCollection **ret) +static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, HTMLInnerWindow *window, + compat_mode_t compat_mode, IHTMLStyleSheetRulesCollection **ret) { HTMLStyleSheetRulesCollection *collection; @@ -492,8 +502,10 @@ static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, co collection->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl; collection->nslist = nslist; + collection->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&collection->dispex, &HTMLStyleSheetRulesCollection_dispex, compat_mode); + init_dispatch(&collection->dispex, &HTMLStyleSheetRulesCollection_dispex, window, compat_mode); if(nslist) nsIDOMCSSRuleList_AddRef(nslist); @@ -742,7 +754,7 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection return E_INVALIDARG; } - hres = create_style_sheet(nsstylesheet, dispex_compat_mode(&This->dispex), &stylesheet); + hres = create_style_sheet(nsstylesheet, This->doc, &stylesheet); nsIDOMStyleSheet_Release(nsstylesheet); if(FAILED(hres)) return hres; @@ -794,6 +806,8 @@ static void *HTMLStyleSheetsCollection_query_interface(DispatchEx *dispex, REFII static void HTMLStyleSheetsCollection_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) { HTMLStyleSheetsCollection *This = HTMLStyleSheetsCollection_from_DispatchEx(dispex); + if(This->doc) + note_cc_edge((nsISupports*)&This->doc->node.IHTMLDOMNode_iface, "doc", cb); if(This->nslist) note_cc_edge((nsISupports*)This->nslist, "nslist", cb); } @@ -801,6 +815,11 @@ static void HTMLStyleSheetsCollection_traverse(DispatchEx *dispex, nsCycleCollec static void HTMLStyleSheetsCollection_unlink(DispatchEx *dispex) { HTMLStyleSheetsCollection *This = HTMLStyleSheetsCollection_from_DispatchEx(dispex); + if(This->doc) { + HTMLDocumentNode *doc = This->doc; + This->doc = NULL; + IHTMLDOMNode_Release(&doc->node.IHTMLDOMNode_iface); + } unlink_ref(&This->nslist); } @@ -868,7 +887,7 @@ static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, IDispatch *t return S_OK; } - hres = create_style_sheet(nsstylesheet, dispex_compat_mode(&This->dispex), &stylesheet); + hres = create_style_sheet(nsstylesheet, This->doc, &stylesheet); nsIDOMStyleSheet_Release(nsstylesheet); if(FAILED(hres)) return hres; @@ -906,7 +925,7 @@ static dispex_static_data_t HTMLStyleSheetsCollection_dispex = { HTMLStyleSheetsCollection_iface_tids }; -HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_t compat_mode, +HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, HTMLDocumentNode *doc, IHTMLStyleSheetsCollection **ret) { HTMLStyleSheetsCollection *collection; @@ -915,12 +934,15 @@ HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_ return E_OUTOFMEMORY; collection->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl; + collection->doc = doc; + IHTMLDOMNode_AddRef(&doc->node.IHTMLDOMNode_iface); if(nslist) nsIDOMStyleSheetList_AddRef(nslist); collection->nslist = nslist; - init_dispatch(&collection->dispex, &HTMLStyleSheetsCollection_dispex, compat_mode); + init_dispatch(&collection->dispex, &HTMLStyleSheetsCollection_dispex, get_inner_window(doc), + dispex_compat_mode(&doc->node.event_target.dispex)); *ret = &collection->IHTMLStyleSheetsCollection_iface; return S_OK; @@ -1265,7 +1287,7 @@ static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface, return E_FAIL; } - hres = create_style_sheet_rules_collection(nslist, dispex_compat_mode(&This->dispex), p); + hres = create_style_sheet_rules_collection(nslist, This->window, dispex_compat_mode(&This->dispex), p); nsIDOMCSSRuleList_Release(nslist); return hres; } @@ -1473,6 +1495,8 @@ static void *HTMLStyleSheet_query_interface(DispatchEx *dispex, REFIID riid) static void HTMLStyleSheet_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) { HTMLStyleSheet *This = HTMLStyleSheet_from_DispatchEx(dispex); + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); if(This->nsstylesheet) note_cc_edge((nsISupports*)This->nsstylesheet, "nsstylesheet", cb); } @@ -1480,6 +1504,11 @@ static void HTMLStyleSheet_traverse(DispatchEx *dispex, nsCycleCollectionTravers static void HTMLStyleSheet_unlink(DispatchEx *dispex) { HTMLStyleSheet *This = HTMLStyleSheet_from_DispatchEx(dispex); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } unlink_ref(&This->nsstylesheet); } @@ -1514,8 +1543,9 @@ static dispex_static_data_t HTMLStyleSheet_dispex = { HTMLStyleSheet_init_dispex_info }; -HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_mode, IHTMLStyleSheet **ret) +HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, HTMLDocumentNode *doc, IHTMLStyleSheet **ret) { + HTMLInnerWindow *window = get_inner_window(doc); HTMLStyleSheet *style_sheet; nsresult nsres; @@ -1525,8 +1555,10 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_ style_sheet->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl; style_sheet->IHTMLStyleSheet4_iface.lpVtbl = &HTMLStyleSheet4Vtbl; style_sheet->nsstylesheet = NULL; + style_sheet->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&style_sheet->dispex, &HTMLStyleSheet_dispex, compat_mode); + init_dispatch(&style_sheet->dispex, &HTMLStyleSheet_dispex, window, dispex_compat_mode(&doc->node.event_target.dispex)); if(nsstylesheet) { nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet, diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index 2c18f840c0a..335e71e594b 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -793,7 +793,7 @@ static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementC return E_FAIL; } - *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = create_collection_from_htmlcol(nscol, This->element.node.doc, dispex_compat_mode(&This->element.node.event_target.dispex)); nsIDOMHTMLCollection_Release(nscol); return S_OK; @@ -1376,7 +1376,7 @@ static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollecti return E_FAIL; } - *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = create_collection_from_htmlcol(nscol, This->element.node.doc, dispex_compat_mode(&This->element.node.event_target.dispex)); nsIDOMHTMLCollection_Release(nscol); return S_OK; @@ -1491,7 +1491,7 @@ static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementColle return E_FAIL; } - *p = create_collection_from_htmlcol(nscol, dispex_compat_mode(&This->element.node.event_target.dispex)); + *p = create_collection_from_htmlcol(nscol, This->element.node.doc, dispex_compat_mode(&This->element.node.event_target.dispex)); nsIDOMHTMLCollection_Release(nscol); return S_OK; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 272d5330b13..92db53bab04 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -885,7 +885,7 @@ static HRESULT WINAPI HTMLWindow2_get_navigator(IHTMLWindow2 *iface, IOmNavigato if(!window->navigator) { HRESULT hres; - hres = create_navigator(dispex_compat_mode(&window->event_target.dispex), &window->navigator); + hres = create_navigator(window, &window->navigator); if(FAILED(hres)) return hres; } @@ -1274,7 +1274,7 @@ static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen ** if(!window->screen) { HRESULT hres; - hres = create_html_screen(dispex_compat_mode(&window->event_target.dispex), &window->screen); + hres = create_html_screen(window, &window->screen); if(FAILED(hres)) return hres; } @@ -2640,7 +2640,8 @@ static HRESULT WINAPI HTMLWindow7_getComputedStyle(IHTMLWindow7 *iface, IHTMLDOM return S_OK; } - hres = create_computed_style(nsstyle, dispex_compat_mode(&This->inner_window->event_target.dispex), p); + hres = create_computed_style(nsstyle, This->inner_window, + dispex_compat_mode(&This->inner_window->event_target.dispex), p); nsIDOMCSSStyleDeclaration_Release(nsstyle); return hres; } @@ -3421,7 +3422,7 @@ static HRESULT WINAPI window_private_get_console(IWineHTMLWindowPrivate *iface, TRACE("iface %p, console %p.\n", iface, console); if (!window->console) - create_console(dispex_compat_mode(&window->event_target.dispex), &window->console); + create_console(This->inner_window, &window->console); *console = (IDispatch *)window->console; if (window->console) @@ -3453,8 +3454,7 @@ static HRESULT WINAPI window_private_get_MutationObserver(IWineHTMLWindowPrivate TRACE("iface %p, mutation_observer %p.\n", iface, mutation_observer); if (!This->inner_window->mutation_observer_ctor) { - hres = create_mutation_observer_ctor(dispex_compat_mode(&This->inner_window->event_target.dispex), - &This->inner_window->mutation_observer_ctor); + hres = create_mutation_observer_ctor(This->inner_window, &This->inner_window->mutation_observer_ctor); if (FAILED(hres)) return hres; } @@ -4562,7 +4562,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, window->base.outer_window = outer_window; window->base.inner_window = window; - EventTarget_Init(&window->event_target, &HTMLWindow_dispex, COMPAT_MODE_NONE); + EventTarget_Init(&window->event_target, &HTMLWindow_dispex, NULL); window->task_magic = get_task_target_magic(); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 946cc99151d..f67950d9e35 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -77,11 +77,20 @@ #define MSHTML_E_NODOC 0x800a025c #define MSHTML_E_NOT_FUNC 0x800a138a +typedef struct HTMLWindow HTMLWindow; +typedef struct HTMLInnerWindow HTMLInnerWindow; +typedef struct HTMLOuterWindow HTMLOuterWindow; +typedef struct HTMLDocumentNode HTMLDocumentNode; +typedef struct HTMLDocumentObj HTMLDocumentObj; +typedef struct HTMLFrameBase HTMLFrameBase; +typedef struct GeckoBrowser GeckoBrowser; +typedef struct HTMLAttributeCollection HTMLAttributeCollection; typedef struct DOMEvent DOMEvent; typedef struct HTMLDOMNode HTMLDOMNode; typedef struct ConnectionPoint ConnectionPoint; typedef struct BSCallback BSCallback; typedef struct EventTarget EventTarget; +typedef struct ScriptHost ScriptHost; #define TID_LIST \ XIID(NULL) \ @@ -434,7 +443,7 @@ extern void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjC extern void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*); extern void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*); -void init_dispatch(DispatchEx*,dispex_static_data_t*,compat_mode_t); +void init_dispatch(DispatchEx*,dispex_static_data_t*,HTMLInnerWindow*,compat_mode_t); void dispex_props_unlink(DispatchEx*); HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*); HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); @@ -460,17 +469,6 @@ typedef enum { dispex_prop_type_t get_dispid_type(DISPID); -typedef struct HTMLWindow HTMLWindow; -typedef struct HTMLInnerWindow HTMLInnerWindow; -typedef struct HTMLOuterWindow HTMLOuterWindow; -typedef struct HTMLDocumentNode HTMLDocumentNode; -typedef struct HTMLDocumentObj HTMLDocumentObj; -typedef struct HTMLFrameBase HTMLFrameBase; -typedef struct GeckoBrowser GeckoBrowser; -typedef struct HTMLAttributeCollection HTMLAttributeCollection; - -typedef struct ScriptHost ScriptHost; - typedef enum { GLOBAL_SCRIPTVAR, GLOBAL_ELEMENTVAR, @@ -997,11 +995,11 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactor HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**); HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**); HRESULT create_location(HTMLOuterWindow*,HTMLLocation**); -HRESULT create_navigator(compat_mode_t,IOmNavigator**); -HRESULT create_html_screen(compat_mode_t,IHTMLScreen**); +HRESULT create_navigator(HTMLInnerWindow*,IOmNavigator**); +HRESULT create_html_screen(HTMLInnerWindow*,IHTMLScreen**); HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**); HRESULT create_history(HTMLInnerWindow*,OmHistory**); -HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**); +HRESULT create_namespace_collection(HTMLDocumentNode*,IHTMLNamespaceCollection**); HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**); void detach_dom_implementation(IHTMLDOMImplementation*); HRESULT create_html_storage(HTMLInnerWindow*,BOOL,IHTMLStorage**); @@ -1043,6 +1041,7 @@ void hide_tooltip(HTMLDocumentObj*); HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*); UINT get_document_charset(HTMLDocumentNode*); +HTMLInnerWindow *get_inner_window(HTMLDocumentNode*); HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**); @@ -1110,10 +1109,10 @@ HRESULT get_readystate_string(READYSTATE,BSTR*); HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**); HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**); -HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**); -HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,compat_mode_t, +HRESULT create_style_sheet(nsIDOMStyleSheet*,HTMLDocumentNode*,IHTMLStyleSheet**); +HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,HTMLDocumentNode*, IHTMLStyleSheetsCollection**); -HRESULT create_dom_range(nsIDOMRange*,compat_mode_t,IHTMLDOMRange**); +HRESULT create_dom_range(nsIDOMRange*,HTMLDocumentNode*,IHTMLDOMRange**); HRESULT create_markup_pointer(IMarkupPointer**); void detach_document_node(HTMLDocumentNode*); @@ -1162,7 +1161,7 @@ typedef struct { HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*); -HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,compat_mode_t,HTMLDOMAttribute**); +HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLDocumentNode*,HTMLElement*,DISPID,compat_mode_t,HTMLDOMAttribute**); HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**); HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**); @@ -1198,7 +1197,7 @@ HRESULT create_svg_element(HTMLDocumentNode*,nsIDOMSVGElement*,const WCHAR*,HTML void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*); void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*); -void EventTarget_Init(EventTarget*,dispex_static_data_t*,compat_mode_t); +void EventTarget_Init(EventTarget*,dispex_static_data_t*,HTMLInnerWindow*); void *EventTarget_query_interface(EventTarget*,REFIID); void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t); @@ -1232,9 +1231,9 @@ HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*, HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**); IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL); -IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t); -IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t); -HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**); +IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,HTMLDocumentNode*); +IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,HTMLDocumentNode*,compat_mode_t); +HRESULT create_child_collection(nsIDOMNodeList*,HTMLDocumentNode*,IHTMLDOMChildrenCollection**); HRESULT attr_value_to_string(VARIANT*); HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*); @@ -1503,7 +1502,7 @@ void set_statustext(HTMLDocumentObj*,INT,LPCWSTR); IInternetSecurityManager *get_security_manager(void); extern HINSTANCE hInst; -void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret); +void create_console(HTMLInnerWindow *window, IWineMSHTMLConsole **ret); void create_crypto(HTMLInnerWindow *window, IWineMSHTMLCrypto **ret); HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch **ret); -HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret); +HRESULT create_mutation_observer_ctor(HTMLInnerWindow *window, IDispatch **ret); diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 845c189f98b..b80829912b1 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -1236,12 +1236,12 @@ static dispex_static_data_t mutation_observer_dispex = { mutation_observer_iface_tids }; -static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *callback, +static HRESULT create_mutation_observer(HTMLInnerWindow *window, IDispatch *callback, IWineMSHTMLMutationObserver **ret) { struct mutation_observer *obj; - TRACE("(compat_mode = %d, callback = %p, ret = %p)\n", compat_mode, callback, ret); + TRACE("(window = %p, callback = %p, ret = %p)\n", window, callback, ret); obj = calloc(1, sizeof(*obj)); if(!obj) @@ -1251,7 +1251,7 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca } obj->IWineMSHTMLMutationObserver_iface.lpVtbl = &WineMSHTMLMutationObserverVtbl; - init_dispatch(&obj->dispex, &mutation_observer_dispex, compat_mode); + init_dispatch(&obj->dispex, &mutation_observer_dispex, window, dispex_compat_mode(&window->event_target.dispex)); IDispatch_AddRef(callback); obj->callback = callback; @@ -1261,6 +1261,7 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca struct mutation_observer_ctor { DispatchEx dispex; + HTMLInnerWindow *window; }; static inline struct mutation_observer_ctor *mutation_observer_ctor_from_DispatchEx(DispatchEx *iface) @@ -1268,6 +1269,25 @@ static inline struct mutation_observer_ctor *mutation_observer_ctor_from_Dispatc return CONTAINING_RECORD(iface, struct mutation_observer_ctor, dispex); } +static void mutation_observer_ctor_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); + + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); +} + +static void mutation_observer_ctor_unlink(DispatchEx *dispex) +{ + struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); + + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } +} + static void mutation_observer_ctor_destructor(DispatchEx *dispex) { struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); @@ -1310,8 +1330,7 @@ static HRESULT mutation_observer_ctor_value(DispatchEx *dispex, LCID lcid, if (!res) return S_OK; - hres = create_mutation_observer(dispex_compat_mode(&This->dispex), V_DISPATCH(callback), - &mutation_observer); + hres = create_mutation_observer(This->window, V_DISPATCH(callback), &mutation_observer); if (FAILED(hres)) return hres; @@ -1323,6 +1342,8 @@ static HRESULT mutation_observer_ctor_value(DispatchEx *dispex, LCID lcid, static dispex_static_data_vtbl_t mutation_observer_ctor_dispex_vtbl = { .destructor = mutation_observer_ctor_destructor, + .traverse = mutation_observer_ctor_traverse, + .unlink = mutation_observer_ctor_unlink, .value = mutation_observer_ctor_value }; @@ -1337,11 +1358,11 @@ static dispex_static_data_t mutation_observer_ctor_dispex = { mutation_observer_ctor_iface_tids }; -HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret) +HRESULT create_mutation_observer_ctor(HTMLInnerWindow *window, IDispatch **ret) { struct mutation_observer_ctor *obj; - TRACE("(compat_mode = %d, ret = %p)\n", compat_mode, ret); + TRACE("(window = %p, ret = %p)\n", window, ret); obj = calloc(1, sizeof(*obj)); if(!obj) @@ -1350,7 +1371,10 @@ HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret return E_OUTOFMEMORY; } - init_dispatch(&obj->dispex, &mutation_observer_ctor_dispex, compat_mode); + obj->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + + init_dispatch(&obj->dispex, &mutation_observer_ctor_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret = (IDispatch *)&obj->dispex.IDispatchEx_iface; return S_OK; diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 1b31e4f7159..661b1c37088 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -1663,7 +1663,8 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList if(FAILED(hres)) return NS_ERROR_FAILURE; - hres = create_event_from_nsevent(aEvent, dispex_compat_mode(&node->event_target.dispex), &event); + hres = create_event_from_nsevent(aEvent, This->doc->window->base.inner_window, + dispex_compat_mode(&node->event_target.dispex), &event); if(SUCCEEDED(hres)) { dispatch_event(&node->event_target, event); IDOMEvent_Release(&event->IDOMEvent_iface); diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 482d3196770..c229a2c634f 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -242,7 +242,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns if(doc->window) doc->window->dom_content_loaded_event_start_time = get_time_stamp(); - hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); + hres = create_event_from_nsevent(nsevent, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex), &event); if(SUCCEEDED(hres)) { dispatch_event(&doc->node.event_target, event); IDOMEvent_Release(&event->IDOMEvent_iface); @@ -378,7 +378,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) WARN("no dom_document\n"); } - hres = create_event_from_nsevent(event, dispex_compat_mode(&doc->node.event_target.dispex), &load_event); + hres = create_event_from_nsevent(event, doc->window, dispex_compat_mode(&doc->node.event_target.dispex), &load_event); if(SUCCEEDED(hres)) { dispatch_event(&doc->window->event_target, load_event); IDOMEvent_Release(&load_event->IDOMEvent_iface); @@ -398,7 +398,7 @@ static nsresult handle_beforeunload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) return NS_OK; /* Gecko dispatches this to the document, but IE dispatches it to the window */ - hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); + hres = create_event_from_nsevent(nsevent, window, dispex_compat_mode(&doc->node.event_target.dispex), &event); if(SUCCEEDED(hres)) { dispatch_event(&window->event_target, event); IDOMEvent_Release(&event->IDOMEvent_iface); @@ -421,7 +421,7 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) if(pending_window) pending_window->unload_event_start_time = get_time_stamp(); - hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); + hres = create_event_from_nsevent(nsevent, window, dispex_compat_mode(&doc->node.event_target.dispex), &event); if(SUCCEEDED(hres)) { dispatch_event(&window->event_target, event); IDOMEvent_Release(&event->IDOMEvent_iface); @@ -466,7 +466,7 @@ static nsresult handle_htmlevent(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) target = &node->event_target; } - hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); + hres = create_event_from_nsevent(nsevent, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex), &event); if(FAILED(hres)) { IEventTarget_Release(&target->IEventTarget_iface); return NS_OK; diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 710f20697f4..29ed0c930c0 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -38,6 +38,7 @@ typedef struct { DispatchEx dispex; IOmNavigator IOmNavigator_iface; + HTMLInnerWindow *window; HTMLPluginsCollection *plugins; HTMLMimeTypesCollection *mime_types; } OmNavigator; @@ -336,7 +337,7 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa dom_implementation->IHTMLDOMImplementation2_iface.lpVtbl = &HTMLDOMImplementation2Vtbl; dom_implementation->browser = doc_node->browser; - init_dispatch(&dom_implementation->dispex, &HTMLDOMImplementation_dispex, doc_node->document_mode); + init_dispatch(&dom_implementation->dispex, &HTMLDOMImplementation_dispex, get_inner_window(doc_node), doc_node->document_mode); nsres = nsIDOMDocument_GetImplementation(doc_node->dom_document, &dom_implementation->implementation); if(NS_FAILED(nsres)) { @@ -565,7 +566,7 @@ static dispex_static_data_t HTMLScreen_dispex = { HTMLScreen_iface_tids }; -HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret) +HRESULT create_html_screen(HTMLInnerWindow *window, IHTMLScreen **ret) { HTMLScreen *screen; @@ -575,7 +576,7 @@ HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret) screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl; - init_dispatch(&screen->dispex, &HTMLScreen_dispex, compat_mode); + init_dispatch(&screen->dispex, &HTMLScreen_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret = &screen->IHTMLScreen_iface; return S_OK; @@ -759,7 +760,7 @@ HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret) history->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&history->dispex, &OmHistory_dispex, dispex_compat_mode(&window->event_target.dispex)); + init_dispatch(&history->dispex, &OmHistory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret = history; return S_OK; @@ -916,7 +917,7 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl col->IHTMLPluginsCollection_iface.lpVtbl = &HTMLPluginsCollectionVtbl; col->navigator = navigator; - init_dispatch(&col->dispex, &HTMLPluginsCollection_dispex, dispex_compat_mode(&navigator->dispex)); + init_dispatch(&col->dispex, &HTMLPluginsCollection_dispex, navigator->window, dispex_compat_mode(&navigator->dispex)); *ret = col; return S_OK; @@ -1062,7 +1063,7 @@ static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeType col->IHTMLMimeTypesCollection_iface.lpVtbl = &HTMLMimeTypesCollectionVtbl; col->navigator = navigator; - init_dispatch(&col->dispex, &HTMLMimeTypesCollection_dispex, dispex_compat_mode(&navigator->dispex)); + init_dispatch(&col->dispex, &HTMLMimeTypesCollection_dispex, navigator->window, dispex_compat_mode(&navigator->dispex)); *ret = col; return S_OK; @@ -1448,9 +1449,22 @@ static void *OmNavigator_query_interface(DispatchEx *dispex, REFIID riid) return NULL; } +static void OmNavigator_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + OmNavigator *This = OmNavigator_from_DispatchEx(dispex); + + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); +} + static void OmNavigator_unlink(DispatchEx *dispex) { OmNavigator *This = OmNavigator_from_DispatchEx(dispex); + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } if(This->plugins) { This->plugins->navigator = NULL; This->plugins = NULL; @@ -1470,6 +1484,7 @@ static void OmNavigator_destructor(DispatchEx *dispex) static const dispex_static_data_vtbl_t OmNavigator_dispex_vtbl = { .query_interface = OmNavigator_query_interface, .destructor = OmNavigator_destructor, + .traverse = OmNavigator_traverse, .unlink = OmNavigator_unlink }; @@ -1484,7 +1499,7 @@ static dispex_static_data_t OmNavigator_dispex = { OmNavigator_iface_tids }; -HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator) +HRESULT create_navigator(HTMLInnerWindow *window, IOmNavigator **navigator) { OmNavigator *ret; @@ -1493,8 +1508,10 @@ HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator) return E_OUTOFMEMORY; ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl; + ret->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&ret->dispex, &OmNavigator_dispex, compat_mode); + init_dispatch(&ret->dispex, &OmNavigator_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *navigator = &ret->IOmNavigator_iface; return S_OK; @@ -2163,7 +2180,7 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface, navigation->window = This->window; IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); - init_dispatch(&navigation->dispex, &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex)); + init_dispatch(&navigation->dispex, &HTMLPerformanceNavigation_dispex, This->window, dispex_compat_mode(&This->dispex)); This->navigation = &navigation->IHTMLPerformanceNavigation_iface; } @@ -2189,7 +2206,7 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP timing->window = This->window; IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); - init_dispatch(&timing->dispex, &HTMLPerformanceTiming_dispex, dispex_compat_mode(&This->dispex)); + init_dispatch(&timing->dispex, &HTMLPerformanceTiming_dispex, This->window, dispex_compat_mode(&This->dispex)); This->timing = &timing->IHTMLPerformanceTiming_iface; } @@ -2303,7 +2320,7 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) performance->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&performance->dispex, &HTMLPerformance_dispex, compat_mode); + init_dispatch(&performance->dispex, &HTMLPerformance_dispex, window, compat_mode); *ret = &performance->IHTMLPerformance_iface; return S_OK; @@ -2445,7 +2462,7 @@ static dispex_static_data_t HTMLNamespaceCollection_dispex = { HTMLNamespaceCollection_iface_tids }; -HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCollection **ret) +HRESULT create_namespace_collection(HTMLDocumentNode *doc_node, IHTMLNamespaceCollection **ret) { HTMLNamespaceCollection *namespaces; @@ -2453,7 +2470,8 @@ HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCol return E_OUTOFMEMORY; namespaces->IHTMLNamespaceCollection_iface.lpVtbl = &HTMLNamespaceCollectionVtbl; - init_dispatch(&namespaces->dispex, &HTMLNamespaceCollection_dispex, compat_mode); + init_dispatch(&namespaces->dispex, &HTMLNamespaceCollection_dispex, get_inner_window(doc_node), + dispex_compat_mode(&doc_node->node.event_target.dispex)); *ret = &namespaces->IHTMLNamespaceCollection_iface; return S_OK; } @@ -2695,7 +2713,7 @@ static dispex_static_data_t console_dispex = { console_iface_tids }; -void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret) +void create_console(HTMLInnerWindow *window, IWineMSHTMLConsole **ret) { struct console *obj; @@ -2707,7 +2725,7 @@ void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret) } obj->IWineMSHTMLConsole_iface.lpVtbl = &WineMSHTMLConsoleVtbl; - init_dispatch(&obj->dispex, &console_dispex, compat_mode); + init_dispatch(&obj->dispex, &console_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret = &obj->IWineMSHTMLConsole_iface; } @@ -3074,7 +3092,8 @@ HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch media_query_list->IWineMSHTMLMediaQueryList_iface.lpVtbl = &media_query_list_vtbl; list_init(&media_query_list->listeners); - init_dispatch(&media_query_list->dispex, &media_query_list_dispex, dispex_compat_mode(&window->inner_window->event_target.dispex)); + init_dispatch(&media_query_list->dispex, &media_query_list_dispex, window->inner_window, + dispex_compat_mode(&window->inner_window->event_target.dispex)); *ret = (IDispatch*)&media_query_list->IWineMSHTMLMediaQueryList_iface; return S_OK; @@ -3221,7 +3240,7 @@ void create_crypto(HTMLInnerWindow *window, IWineMSHTMLCrypto **ret) } obj->IWineMSHTMLCrypto_iface.lpVtbl = &WineMSHTMLCryptoVtbl; - init_dispatch(&obj->dispex, &crypto_dispex, dispex_compat_mode(&window->event_target.dispex)); + init_dispatch(&obj->dispex, &crypto_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret = &obj->IWineMSHTMLCrypto_iface; } diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index 8bbaa1f4731..2e167371252 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -1753,7 +1753,7 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx ret->IHTMLTxtRange_iface.lpVtbl = &HTMLTxtRangeVtbl; ret->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl; - init_dispatch(&ret->dispex, &HTMLTxtRange_dispex, dispex_compat_mode(&doc->node.event_target.dispex)); + init_dispatch(&ret->dispex, &HTMLTxtRange_dispex, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex)); if(nsrange) nsIDOMRange_AddRef(nsrange); @@ -2098,7 +2098,7 @@ static dispex_static_data_t HTMLDOMRange_dispex = { HTMLDOMRange_iface_tids }; -HRESULT create_dom_range(nsIDOMRange *nsrange, compat_mode_t compat_mode, IHTMLDOMRange **p) +HRESULT create_dom_range(nsIDOMRange *nsrange, HTMLDocumentNode *doc, IHTMLDOMRange **p) { HTMLDOMRange *ret; @@ -2108,7 +2108,7 @@ HRESULT create_dom_range(nsIDOMRange *nsrange, compat_mode_t compat_mode, IHTMLD ret->IHTMLDOMRange_iface.lpVtbl = &HTMLDOMRangeVtbl; - init_dispatch(&ret->dispex, &HTMLDOMRange_dispex, compat_mode); + init_dispatch(&ret->dispex, &HTMLDOMRange_dispex, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex)); if(nsrange) nsIDOMRange_AddRef(nsrange); diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 3f93029c957..19067d0226a 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -364,7 +364,7 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect selection->doc = doc; list_add_head(&doc->selection_list, &selection->entry); - init_dispatch(&selection->dispex, &HTMLSelectionObject_dispex, dispex_compat_mode(&doc->node.event_target.dispex)); + init_dispatch(&selection->dispex, &HTMLSelectionObject_dispex, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex)); *ret = &selection->IHTMLSelectionObject_iface; return S_OK; diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 5314e5a15cb..c9812ec17ad 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -398,7 +398,7 @@ static nsresult NSAPI XMLHttpReqEventListener_HandleEvent(nsIDOMEventListener *i blocking_xhr = thread_data->blocking_xhr; compat_mode = dispex_compat_mode(&This->xhr->event_target.dispex); - hres = create_event_from_nsevent(nsevent, compat_mode, &event); + hres = create_event_from_nsevent(nsevent, This->xhr->window, compat_mode, &event); if(FAILED(hres)) { if(!blocking_xhr || This->xhr == blocking_xhr) This->xhr->ready_state = ready_state; @@ -1712,7 +1712,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor ret->IHTMLXMLHttpRequest2_iface.lpVtbl = &HTMLXMLHttpRequest2Vtbl; ret->IWineXMLHttpRequestPrivate_iface.lpVtbl = &WineXMLHttpRequestPrivateVtbl; ret->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl; - EventTarget_Init(&ret->event_target, &HTMLXMLHttpRequest_dispex, This->window->doc->document_mode); + EventTarget_Init(&ret->event_target, &HTMLXMLHttpRequest_dispex, This->window); /* Always register the handlers because we need them to track state */ event_listener->nsIDOMEventListener_iface.lpVtbl = &XMLHttpReqEventListenerVtbl; @@ -1847,7 +1847,7 @@ HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpReq ret->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&ret->dispex, &HTMLXMLHttpRequestFactory_dispex, dispex_compat_mode(&window->event_target.dispex)); + init_dispatch(&ret->dispex, &HTMLXMLHttpRequestFactory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); *ret_ptr = ret; return S_OK; From 08baff54987faffe4ffefae16c09b71edcc7e7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0944/1506] jscript: Fill the exception in a helper function and use deferred fill-in if needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 30 ++++++++++++++++++------------ dlls/jscript/jscript.h | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 449e4d7fdc1..208957f4836 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2483,22 +2483,28 @@ static HRESULT disp_invoke(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD f hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, params, r, &ei, &err); } - if(hres == DISP_E_EXCEPTION) { - TRACE("DISP_E_EXCEPTION: %08lx %s %s\n", ei.scode, debugstr_w(ei.bstrSource), debugstr_w(ei.bstrDescription)); - reset_ei(ctx->ei); - ctx->ei->error = (SUCCEEDED(ei.scode) || ei.scode == DISP_E_EXCEPTION) ? E_FAIL : ei.scode; - if(ei.bstrSource) - ctx->ei->source = jsstr_alloc_len(ei.bstrSource, SysStringLen(ei.bstrSource)); - if(ei.bstrDescription) - ctx->ei->message = jsstr_alloc_len(ei.bstrDescription, SysStringLen(ei.bstrDescription)); - SysFreeString(ei.bstrSource); - SysFreeString(ei.bstrDescription); - SysFreeString(ei.bstrHelpFile); - } + if(hres == DISP_E_EXCEPTION) + disp_fill_exception(ctx, &ei); return hres; } +void disp_fill_exception(script_ctx_t *ctx, EXCEPINFO *ei) +{ + TRACE("DISP_E_EXCEPTION: %08lx %s %s\n", ei->scode, debugstr_w(ei->bstrSource), debugstr_w(ei->bstrDescription)); + reset_ei(ctx->ei); + if(ei->pfnDeferredFillIn) + ei->pfnDeferredFillIn(ei); + ctx->ei->error = (SUCCEEDED(ei->scode) || ei->scode == DISP_E_EXCEPTION) ? E_FAIL : ei->scode; + if(ei->bstrSource) + ctx->ei->source = jsstr_alloc_len(ei->bstrSource, SysStringLen(ei->bstrSource)); + if(ei->bstrDescription) + ctx->ei->message = jsstr_alloc_len(ei->bstrDescription, SysStringLen(ei->bstrDescription)); + SysFreeString(ei->bstrSource); + SysFreeString(ei->bstrDescription); + SysFreeString(ei->bstrHelpFile); +} + HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, unsigned argc, jsval_t *argv, jsval_t *ret) { VARIANT buf[6], retv; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index a955f34600b..50ed87f78a7 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -273,6 +273,7 @@ HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**); HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); +void disp_fill_exception(script_ctx_t*,EXCEPINFO*); HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,jsval_t*,jsval_t*); HRESULT disp_call_name(script_ctx_t*,IDispatch*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*); HRESULT disp_call_value_with_caller(script_ctx_t*,IDispatch*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*,IServiceProvider*); From 6becf96072e84d59da85843c48465626601991b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0945/1506] jscript: Pass the correct ServiceProvider when invoking internal props. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/array.c | 2 +- dlls/jscript/dispex.c | 38 ++++++++++++++++++++------------------ dlls/jscript/function.c | 20 ++++++++++---------- dlls/jscript/jscript.h | 4 ++-- dlls/jscript/json.c | 3 ++- dlls/jscript/string.c | 2 +- 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index 078e2ce7d4c..adc7e9a88dd 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -633,7 +633,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval jsval_t res; double n; - hres = jsdisp_call_value(cmp_func, jsval_undefined(), DISPATCH_METHOD, 2, args, &res); + hres = jsdisp_call_value(cmp_func, jsval_undefined(), DISPATCH_METHOD, 2, args, &res, &ctx->jscaller->IServiceProvider_iface); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 208957f4836..4da59eeb765 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -466,7 +466,7 @@ static HRESULT convert_params(script_ctx_t *ctx, const DISPPARAMS *dp, jsval_t * return S_OK; } -static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, jsval_t *r) +static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, jsval_t *r, IServiceProvider *caller) { jsdisp_t *prop_obj = This; HRESULT hres; @@ -486,7 +486,7 @@ static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, case PROP_ACCESSOR: if(prop->u.accessor.getter) { hres = jsdisp_call_value(prop->u.accessor.getter, jsval_disp(jsthis), - DISPATCH_METHOD, 0, NULL, r); + DISPATCH_METHOD, 0, NULL, r, caller); }else { *r = jsval_undefined(); hres = S_OK; @@ -509,7 +509,7 @@ static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, return hres; } -static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val) +static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServiceProvider *caller) { HRESULT hres; @@ -552,7 +552,7 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val) TRACE("no setter\n"); return S_OK; } - return jsdisp_call_value(prop->u.accessor.setter, jsval_obj(This), DISPATCH_METHOD, 1, &val, NULL); + return jsdisp_call_value(prop->u.accessor.setter, jsval_obj(This), DISPATCH_METHOD, 1, &val, NULL, caller); case PROP_IDX: if(!This->builtin_info->idx_put) { TRACE("no put_idx\n"); @@ -603,7 +603,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t case PROP_IDX: { jsval_t val; - hres = prop_get(This, jsthis ? jsthis : (IDispatch *)&This->IDispatchEx_iface, prop, &val); + hres = prop_get(This, jsthis ? jsthis : (IDispatch *)&This->IDispatchEx_iface, prop, &val, caller); if(FAILED(hres)) return hres; @@ -1983,7 +1983,8 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc if(prop) hres = invoke_prop_func(This, passed_this, prop, wFlags, argc, argv, pvarRes ? &r : NULL, pspCaller); else - hres = jsdisp_call_value(This, passed_this ? jsval_disp(passed_this) : jsval_undefined(), wFlags, argc, argv, pvarRes ? &r : NULL); + hres = jsdisp_call_value(This, passed_this ? jsval_disp(passed_this) : jsval_undefined(), + wFlags, argc, argv, pvarRes ? &r : NULL, pspCaller); while(argc--) jsval_release(argv[argc]); @@ -1999,7 +2000,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc jsval_t r; if(prop) - hres = prop_get(This, to_disp(This), prop, &r); + hres = prop_get(This, to_disp(This), prop, &r, pspCaller); else { hres = to_primitive(This->ctx, jsval_obj(This), &r, NO_HINT); if(hres == JS_E_TO_PRIMITIVE) @@ -2038,7 +2039,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc if(FAILED(hres)) break; - hres = prop_put(This, prop, val); + hres = prop_put(This, prop, val, pspCaller); jsval_release(val); break; } @@ -2335,7 +2336,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) { jsval_t val; - hres = prop_get(constr, to_disp(constr), prop, &val); + hres = prop_get(constr, to_disp(constr), prop, &val, &ctx->jscaller->IServiceProvider_iface); if(FAILED(hres)) { ERR("Could not get prototype\n"); return hres; @@ -2402,14 +2403,15 @@ HRESULT jsdisp_get_idx_id(jsdisp_t *jsdisp, DWORD idx, DISPID *id) return jsdisp_get_id(jsdisp, name, 0, id); } -HRESULT jsdisp_call_value(jsdisp_t *jsfunc, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +HRESULT jsdisp_call_value(jsdisp_t *jsfunc, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r, IServiceProvider *caller) { HRESULT hres; assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK))); if(is_class(jsfunc, JSCLASS_FUNCTION)) { - hres = Function_invoke(jsfunc, vthis, flags, argc, argv, r); + hres = Function_invoke(jsfunc, vthis, flags, argc, argv, r, caller); }else { if(!jsfunc->builtin_info->call) { WARN("Not a function\n"); @@ -2622,7 +2624,7 @@ HRESULT disp_call_value_with_caller(script_ctx_t *ctx, IDispatch *disp, jsval_t jsdisp = iface_to_jsdisp(disp); if(jsdisp && jsdisp->ctx == ctx) { - hres = jsdisp_call_value(jsdisp, vthis, flags, argc, argv, r); + hres = jsdisp_call_value(jsdisp, vthis, flags, argc, argv, r, caller); jsdisp_release(jsdisp); return hres; } @@ -2699,7 +2701,7 @@ HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, BOOL throw if(!prop || (prop->type == PROP_DELETED && !obj->extensible)) return throw ? JS_E_INVALID_ACTION : S_OK; - return prop_put(obj, prop, val); + return prop_put(obj, prop, val, &obj->ctx->jscaller->IServiceProvider_iface); } HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val) @@ -2726,7 +2728,7 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val) prop = get_prop(jsdisp, id); if(prop) - hres = prop_put(jsdisp, prop, val); + hres = prop_put(jsdisp, prop, val, &ctx->jscaller->IServiceProvider_iface); else hres = DISP_E_MEMBERNOTFOUND; @@ -2807,7 +2809,7 @@ HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val) return S_OK; } - hres = prop_get(obj, to_disp(obj), prop, val); + hres = prop_get(obj, to_disp(obj), prop, val, &obj->ctx->jscaller->IServiceProvider_iface); if(hres == DISP_E_MEMBERNOTFOUND) { *val = jsval_undefined(); return S_OK; @@ -2835,7 +2837,7 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r) return DISP_E_UNKNOWNNAME; } - hres = prop_get(obj, to_disp(obj), prop, r); + hres = prop_get(obj, to_disp(obj), prop, r, &obj->ctx->jscaller->IServiceProvider_iface); if(hres == DISP_E_MEMBERNOTFOUND) { *r = jsval_undefined(); return DISP_E_UNKNOWNNAME; @@ -2851,7 +2853,7 @@ HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val) if(!prop) return DISP_E_MEMBERNOTFOUND; - return prop_get(jsdisp, to_disp(jsdisp), prop, val); + return prop_get(jsdisp, to_disp(jsdisp), prop, val, &jsdisp->ctx->jscaller->IServiceProvider_iface); } HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val) @@ -3073,7 +3075,7 @@ HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_onl desc->mask |= PROPF_WRITABLE; desc->explicit_value = TRUE; if(!flags_only) { - hres = prop_get(obj, to_disp(obj), prop, &desc->value); + hres = prop_get(obj, to_disp(obj), prop, &desc->value, &obj->ctx->jscaller->IServiceProvider_iface); if(FAILED(hres)) return (hres == DISP_E_MEMBERNOTFOUND) ? DISP_E_UNKNOWNNAME : hres; } diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 320d15324cd..98c43a32e46 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -35,7 +35,7 @@ typedef struct { } FunctionInstance; struct _function_vtbl_t { - HRESULT (*call)(script_ctx_t*,FunctionInstance*,jsval_t,unsigned,unsigned,jsval_t*,jsval_t*); + HRESULT (*call)(script_ctx_t*,FunctionInstance*,jsval_t,unsigned,unsigned,jsval_t*,jsval_t*,IServiceProvider*); HRESULT (*toString)(FunctionInstance*,jsstr_t**); function_code_t* (*get_code)(FunctionInstance*); void (*destructor)(FunctionInstance*); @@ -264,7 +264,7 @@ void detach_arguments_object(call_frame_t *frame) jsdisp_release(&arguments->jsdisp); } -HRESULT Function_invoke(jsdisp_t *func_this, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +HRESULT Function_invoke(jsdisp_t *func_this, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) { FunctionInstance *function; @@ -278,7 +278,7 @@ HRESULT Function_invoke(jsdisp_t *func_this, jsval_t vthis, WORD flags, unsigned return E_UNEXPECTED; } - return function->vtbl->call(function->dispex.ctx, function, vthis, flags, argc, argv, r); + return function->vtbl->call(function->dispex.ctx, function, vthis, flags, argc, argv, r, caller); } static HRESULT Function_get_caller(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) @@ -420,7 +420,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi if(SUCCEEDED(hres)) { if(function) { - hres = function->vtbl->call(ctx, function, this_val, flags, cnt, args, r); + hres = function->vtbl->call(ctx, function, this_val, flags, cnt, args, r, &ctx->jscaller->IServiceProvider_iface); }else { jsval_t res; hres = disp_call_value(ctx, get_object(vthis), this_val, DISPATCH_METHOD, cnt, args, &res); @@ -470,7 +470,7 @@ static HRESULT Function_call(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig cnt = argc-1; } - hres = function->vtbl->call(ctx, function, this_val, flags, cnt, argv + 1, r); + hres = function->vtbl->call(ctx, function, this_val, flags, cnt, argv + 1, r, &ctx->jscaller->IServiceProvider_iface); jsval_release(this_val); return hres; @@ -525,7 +525,7 @@ HRESULT Function_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned ar return E_FAIL; } - return function->vtbl->call(ctx, function, vthis, flags, argc, argv, r); + return function->vtbl->call(ctx, function, vthis, flags, argc, argv, r, &ctx->jscaller->IServiceProvider_iface); } HRESULT Function_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) @@ -663,7 +663,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_ } static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, - unsigned argc, jsval_t *argv, jsval_t *r) + unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) { NativeFunction *function = (NativeFunction*)func; @@ -826,7 +826,7 @@ static const builtin_info_t InterpretedFunction_info = { }; static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, - unsigned argc, jsval_t *argv, jsval_t *r) + unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) { InterpretedFunction *function = (InterpretedFunction*)func; IDispatch *this_obj = NULL; @@ -958,7 +958,7 @@ static const builtin_info_t BindFunction_info = { }; static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, - unsigned argc, jsval_t *argv, jsval_t *r) + unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) { BindFunction *function = (BindFunction*)func; jsval_t *call_args = NULL; @@ -979,7 +979,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva memcpy(call_args + function->argc, argv, argc * sizeof(*call_args)); } - hres = function->target->vtbl->call(ctx, function->target, function->this, flags, call_argc, call_args, r); + hres = function->target->vtbl->call(ctx, function->target, function->this, flags, call_argc, call_args, r, caller); free(call_args); return hres; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 50ed87f78a7..69832a3b9c8 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -277,7 +277,7 @@ void disp_fill_exception(script_ctx_t*,EXCEPINFO*); HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,jsval_t*,jsval_t*); HRESULT disp_call_name(script_ctx_t*,IDispatch*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*); HRESULT disp_call_value_with_caller(script_ctx_t*,IDispatch*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*,IServiceProvider*); -HRESULT jsdisp_call_value(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); +HRESULT jsdisp_call_value(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*,IServiceProvider*); HRESULT jsdisp_call(jsdisp_t*,DISPID,WORD,unsigned,jsval_t*,jsval_t*); HRESULT jsdisp_call_name(jsdisp_t*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*); HRESULT disp_propget(script_ctx_t*,IDispatch*,DISPID,jsval_t*); @@ -307,7 +307,7 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons jsdisp_t*,jsdisp_t**); HRESULT create_builtin_constructor(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD, jsdisp_t*,jsdisp_t**); -HRESULT Function_invoke(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); +HRESULT Function_invoke(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*,IServiceProvider*); HRESULT Function_value(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); HRESULT Function_get_value(script_ctx_t*,jsdisp_t*,jsval_t*); diff --git a/dlls/jscript/json.c b/dlls/jscript/json.c index 277a5e01144..eb1f6b14a0d 100644 --- a/dlls/jscript/json.c +++ b/dlls/jscript/json.c @@ -774,7 +774,8 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsdisp_t *object, const WCHAR *na } args[0] = jsval_string(name_str); args[1] = value; - hres = jsdisp_call_value(ctx->replacer, jsval_obj(object), DISPATCH_METHOD, ARRAY_SIZE(args), args, &v); + hres = jsdisp_call_value(ctx->replacer, jsval_obj(object), DISPATCH_METHOD, ARRAY_SIZE(args), args, + &v, &ctx->ctx->jscaller->IServiceProvider_iface); jsstr_release(name_str); jsval_release(value); if(FAILED(hres)) diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 4033f0a2b56..625977235a9 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -699,7 +699,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, } if(SUCCEEDED(hres)) - hres = jsdisp_call_value(func, jsval_undefined(), DISPATCH_METHOD, argc, argv, &val); + hres = jsdisp_call_value(func, jsval_undefined(), DISPATCH_METHOD, argc, argv, &val, &ctx->jscaller->IServiceProvider_iface); for(i=0; i <= match->paren_count; i++) jsstr_release(get_string(argv[i])); From dad9b143b39cfa130e59cd314c57ca6d92d8700a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0946/1506] jscript: Implement proxy objects along with a private interface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native mshtml objects act like JS objects in IE9+ mode (the JS engine is implemented in mshtml). This implements a sort of proxy JS objects for mshtml objects that export a new private (internal to Wine) interface, to achieve the same behavior. Another callback interface on jscript side is exposed to mshtml implicitly, which mshtml uses to callback or notify jscript of changes or things it needs (such as being unlinked from mshtml). The props that are forwarded to the mshtml side are stored as either proxy functions or accessors, or a new prop type (for custom values), which is only available for such proxy JS objects, and use the internal interface to forward them to mshtml. Some of this interface is close to IDispatch, but is separate for two reasons: it has to skip asking jscript again for the prop (unlike when it's accessed by non-JS code for example), and accessors may potentially have a different "this" pointer as well passed to them. Since it's purely internal, the private interfaces are not part of any typelib, and for simplicity they extend IDispatchEx, to keep one vtbl. A mshtml object can also be accessed by normal COM code, and it exposes the typical interfaces while also having the jscript props (as we check in tests), so we have to forward its calls to jscript, which might forward it back to mshtml, but only once. We can't expose the jscript proxy object directly at all. However, even on native, its DISPIDs are different than the ones in the .idl file, so it's fine to forward them to jscript. We query external IDispatch objects on demand for the interface. If it's available, we either create a JS proxy object that is associated with the mshtml object exposing the interface, or re-acquire another old one (possibly dangling with refcount zero). It is also associated on the mshtml side, but not via an actual strong ref, so that we keep a 1:1 mapping between the JS proxy object and the actual mshtml object, so it preserves the props, prototypes, and DISPIDs, but without creating a cyclic ref. As a consequence of this, we don't immediately free the jsdisp when its refcount reaches zero. Instead, we release the mshtml dispatch ref we hold, and wait for mshtml to callback and unlink us. It does that when it no longer needs it, such as when the mshtml dispatch was actually destroyed (no other refs to it). We can then free the jsdisp if it's dangling, or disassociate it from the proxy otherwise. Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 538 +++++++++++++++++++++++++++++++++-- dlls/jscript/engine.c | 17 +- dlls/jscript/function.c | 137 ++++++++- dlls/jscript/jscript.c | 5 + dlls/jscript/jscript.h | 67 ++++- dlls/jscript/jsutils.c | 16 +- dlls/jscript/object.c | 20 +- dlls/mshtml/mshtml_private.h | 62 ++++ 8 files changed, 827 insertions(+), 35 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 4da59eeb765..7d7fd1050ce 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -36,6 +36,7 @@ typedef enum { PROP_BUILTIN, PROP_PROTREF, PROP_ACCESSOR, + PROP_PROXY, PROP_DELETED, PROP_IDX } prop_type_t; @@ -55,12 +56,15 @@ struct _dispex_prop_t { jsdisp_t *getter; jsdisp_t *setter; } accessor; + DISPID proxy_id; } u; int bucket_head; int bucket_next; }; +static HRESULT fix_overridden_prop(jsdisp_t *This, dispex_prop_t *prop); + static void fix_protref_prop(jsdisp_t *jsdisp, dispex_prop_t *prop) { DWORD ref; @@ -87,13 +91,16 @@ static inline DISPID prop_to_id(jsdisp_t *This, dispex_prop_t *prop) static inline dispex_prop_t *get_prop(jsdisp_t *This, DISPID id) { + dispex_prop_t *prop; DWORD idx = id - 1; if(idx >= This->prop_cnt) return NULL; - fix_protref_prop(This, &This->props[idx]); + prop = &This->props[idx]; - return This->props[idx].type == PROP_DELETED ? NULL : &This->props[idx]; + fix_overridden_prop(This, prop); + fix_protref_prop(This, prop); + return prop->type == PROP_DELETED ? NULL : prop; } static inline BOOL is_function_prop(dispex_prop_t *prop) @@ -256,6 +263,50 @@ static inline dispex_prop_t* alloc_prop(jsdisp_t *This, const WCHAR *name, prop_ return prop; } +static HRESULT alloc_proxy_prop(jsdisp_t *This, struct proxy_prop_info *info, dispex_prop_t **ret) +{ + dispex_prop_t *prop; + jsdisp_t *funcs[2]; + prop_type_t type; + HRESULT hres; + + if(!info->func[0].invoke) + type = PROP_PROXY; + else { + hres = create_proxy_functions(This, info, funcs); + if(FAILED(hres)) + return hres; + type = (info->flags & PROPF_METHOD) ? PROP_JSVAL : PROP_ACCESSOR; + } + + if((prop = *ret)) { + prop->type = type; + prop->flags = info->flags & PROPF_ALL; + }else { + prop = alloc_prop(This, info->name, type, info->flags & PROPF_ALL); + if(!prop) { + if(type != PROP_PROXY) { + jsdisp_release(funcs[0]); + if(funcs[1]) + jsdisp_release(funcs[1]); + } + return E_OUTOFMEMORY; + } + *ret = prop; + } + + if(type == PROP_PROXY) + prop->u.proxy_id = info->dispid; + else if(type == PROP_JSVAL) + prop->u.val = jsval_obj(funcs[0]); + else { + prop->u.accessor.getter = funcs[0]; + prop->u.accessor.setter = funcs[1]; + } + + return S_OK; +} + static dispex_prop_t *alloc_protref(jsdisp_t *This, const WCHAR *name, DWORD ref) { dispex_prop_t *ret; @@ -285,14 +336,26 @@ static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, This->props[bucket].bucket_head = pos; } + hres = fix_overridden_prop(This, &This->props[pos]); *ret = &This->props[pos]; - return S_OK; + return hres; } prev = pos; pos = This->props[pos].bucket_next; } + if(This->proxy) { + struct proxy_prop_info info; + hres = This->proxy->lpVtbl->PropGetInfo(This->proxy, name, case_insens, &info); + if(hres == S_OK) { + *ret = NULL; + return alloc_proxy_prop(This, &info, ret); + } + if(hres != DISP_E_UNKNOWNNAME) + return hres; + } + builtin = find_builtin_prop(This, name, case_insens); if(builtin) { unsigned flags = builtin->flags; @@ -409,12 +472,72 @@ static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, DWORD create_ } prop->u.val = jsval_undefined(); + + if(This->proxy) { + struct proxy_prop_info info; + + info.name = name; + hres = This->proxy->lpVtbl->PropDefineOverride(This->proxy, &info); + if(hres == S_FALSE) + hres = S_OK; + else if(SUCCEEDED(hres)) + hres = alloc_proxy_prop(This, &info, &prop); + } } *ret = prop; return hres; } +static HRESULT fix_overridden_prop(jsdisp_t *This, dispex_prop_t *prop) +{ + struct proxy_prop_info info; + HRESULT hres; + + if(!This->proxy) + return S_OK; + + info.name = prop->name; + info.dispid = DISPID_UNKNOWN; + + switch(prop->type) { + case PROP_PROXY: + info.dispid = prop->u.proxy_id; + break; + case PROP_PROTREF: + case PROP_DELETED: + break; + default: + return S_OK; + } + + hres = This->proxy->lpVtbl->PropFixOverride(This->proxy, &info); + if(hres != S_OK) + return FAILED(hres) ? hres : S_OK; + + /* Either the prop was restored (to PROP_PROXY), or it was removed */ + if(info.dispid == DISPID_UNKNOWN) { + if(This->prototype) { + dispex_prop_t *prot_prop; + + hres = find_prop_name_prot(This->prototype, prop->hash, prop->name, FALSE, &prot_prop); + if(FAILED(hres)) + return hres; + if(prot_prop && prot_prop->type != PROP_DELETED) { + prop->type = PROP_PROTREF; + prop->u.ref = prot_prop - This->prototype->props; + return hres; + } + } + prop->type = PROP_DELETED; + }else { + info.func[0].invoke = NULL; + hres = alloc_proxy_prop(This, &info, &prop); + } + + return hres; +} + static IDispatch *get_this(DISPPARAMS *dp) { DWORD i; @@ -466,16 +589,88 @@ static HRESULT convert_params(script_ctx_t *ctx, const DISPPARAMS *dp, jsval_t * return S_OK; } +static HRESULT proxy_disp_call(jsdisp_t *This, jsval_t vthis, DISPID id, unsigned flags, unsigned argc, + jsval_t *argv, jsval_t *ret, IServiceProvider *caller) +{ + DISPPARAMS dp = { NULL, NULL, argc, 0 }; + IDispatch *this_obj, *converted = NULL; + script_ctx_t *ctx = This->ctx; + EXCEPINFO ei = { 0 }; + VARIANT buf[6], retv; + jsdisp_t *jsdisp; + HRESULT hres; + unsigned i; + + if(!ctx->global) + return E_UNEXPECTED; + + if(dp.cArgs <= ARRAY_SIZE(buf)) + dp.rgvarg = buf; + else if(!(dp.rgvarg = malloc(dp.cArgs * sizeof(*dp.rgvarg)))) + return E_OUTOFMEMORY; + + for(i = 0; i < dp.cArgs; i++) { + hres = jsval_to_variant(argv[i], &dp.rgvarg[dp.cArgs - i - 1]); + if(FAILED(hres)) + goto cleanup; + } + + if(is_undefined(vthis) || is_null(vthis)) + this_obj = lookup_global_host(ctx); + else { + hres = to_object(ctx, vthis, &converted); + if(FAILED(hres)) + goto cleanup; + this_obj = converted; + } + + jsdisp = to_jsdisp(this_obj); + if(jsdisp && jsdisp->proxy) + this_obj = (IDispatch*)jsdisp->proxy; + + V_VT(&retv) = VT_EMPTY; + flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; + hres = This->proxy->lpVtbl->PropInvoke(This->proxy, this_obj, id, ctx->lcid, flags, &dp, ret ? &retv : NULL, &ei, caller); + if(converted) + IDispatch_Release(converted); + + if(hres == DISP_E_EXCEPTION) + disp_fill_exception(ctx, &ei); + else if(SUCCEEDED(hres) && ret) { + hres = variant_to_jsval(ctx, &retv, ret); + VariantClear(&retv); + } + +cleanup: + while(i--) + VariantClear(&dp.rgvarg[i]); + if(dp.rgvarg != buf) + free(dp.rgvarg); + return hres; +} + static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, jsval_t *r, IServiceProvider *caller) { jsdisp_t *prop_obj = This; HRESULT hres; + VARIANT var; while(prop->type == PROP_PROTREF) { prop_obj = prop_obj->prototype; prop = prop_obj->props + prop->u.ref; } + if(prop_obj->proxy) { + hres = prop_obj->proxy->lpVtbl->PropOverride(prop_obj->proxy, prop->name, &var); + if(hres != S_FALSE) { + if(SUCCEEDED(hres)) { + hres = variant_to_jsval(This->ctx, &var, r); + VariantClear(&var); + } + goto done; + } + } + switch(prop->type) { case PROP_BUILTIN: hres = prop->u.p->getter(This->ctx, prop_obj, r); @@ -492,6 +687,25 @@ static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, hres = S_OK; } break; + case PROP_PROXY: { + DISPPARAMS dp = { 0 }; + EXCEPINFO ei = { 0 }; + jsdisp_t *jsdisp; + + if((jsdisp = to_jsdisp(jsthis)) && jsdisp->proxy) + jsthis = (IDispatch*)jsdisp->proxy; + + V_VT(&var) = VT_EMPTY; + hres = prop_obj->proxy->lpVtbl->PropInvoke(prop_obj->proxy, jsthis, prop->u.proxy_id, This->ctx->lcid, + DISPATCH_PROPERTYGET, &dp, &var, &ei, caller); + if(hres == DISP_E_EXCEPTION) + disp_fill_exception(This->ctx, &ei); + else if(SUCCEEDED(hres)) { + hres = variant_to_jsval(This->ctx, &var, r); + VariantClear(&var); + } + break; + } case PROP_IDX: hres = prop_obj->builtin_info->idx_get(prop_obj, prop->u.idx, r); break; @@ -499,7 +713,10 @@ static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, ERR("type %d\n", prop->type); return E_FAIL; } + if(SUCCEEDED(hres)) + hres = convert_to_proxy(This->ctx, r); +done: if(FAILED(hres)) { TRACE("fail %08lx\n", hres); return hres; @@ -511,6 +728,7 @@ static HRESULT prop_get(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t *prop, static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServiceProvider *caller) { + jsdisp_t *prop_obj = This; HRESULT hres; if(prop->type == PROP_PROTREF) { @@ -522,8 +740,10 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi prop_iter = prototype_iter->props + prop_iter->u.ref; } while(prop_iter->type == PROP_PROTREF); - if(prop_iter->type == PROP_ACCESSOR) + if(prop_iter->type == PROP_ACCESSOR) { + prop_obj = prototype_iter; prop = prop_iter; + } } switch(prop->type) { @@ -553,6 +773,25 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi return S_OK; } return jsdisp_call_value(prop->u.accessor.setter, jsval_obj(This), DISPATCH_METHOD, 1, &val, NULL, caller); + case PROP_PROXY: { + static DISPID propput_dispid = DISPID_PROPERTYPUT; + EXCEPINFO ei = { 0 }; + VARIANT var; + DISPPARAMS dp = { &var, &propput_dispid, 1, 1 }; + + if(!(prop->flags & PROPF_WRITABLE)) + return S_OK; + hres = jsval_to_variant(val, &var); + if(FAILED(hres)) + return hres; + + hres = prop_obj->proxy->lpVtbl->PropInvoke(prop_obj->proxy, This->proxy ? (IDispatch*)This->proxy : to_disp(This), + prop->u.proxy_id, This->ctx->lcid, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, caller); + VariantClear(&var); + if(hres == DISP_E_EXCEPTION) + disp_fill_exception(This->ctx, &ei); + return hres; + } case PROP_IDX: if(!This->builtin_info->idx_put) { TRACE("no put_idx\n"); @@ -619,6 +858,9 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t jsval_release(val); return hres; } + case PROP_PROXY: + return proxy_disp_call(This, jsval_disp(jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface), + prop->u.proxy_id, flags, argc, argv, r, caller); case PROP_DELETED: assert(0); break; @@ -638,6 +880,12 @@ static HRESULT fill_props(jsdisp_t *obj) dispex_prop_t *prop; HRESULT hres; + if(obj->proxy) { + hres = obj->proxy->lpVtbl->PropEnum(obj->proxy); + if(FAILED(hres)) + return hres; + } + if(obj->builtin_info->idx_length) { unsigned i = 0, len = obj->builtin_info->idx_length(obj); WCHAR name[12]; @@ -870,7 +1118,7 @@ HRESULT gc_run(script_ctx_t *ctx) /* 2. Clear mark on objects with non-zero "external refcount" and all objects accessible from them */ LIST_FOR_EACH_ENTRY(obj, &thread_data->objects, jsdisp_t, entry) { - if(!obj->ref || !obj->gc_marked) + if(!obj->gc_marked || (!obj->ref && !obj->proxy)) continue; hres = gc_stack_push(&gc_ctx, NULL); @@ -1897,7 +2145,7 @@ static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, if(cNames == 0) return S_OK; - hres = jsdisp_get_id(This, rgszNames[0], 0, rgDispId); + hres = jsdisp_get_id(This, rgszNames[0], This->proxy ? fdexNameCaseInsensitive : 0, rgDispId); if(FAILED(hres)) return hres; @@ -2055,13 +2303,21 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return leave_script(This->ctx, hres); } -static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret) +static HRESULT delete_prop(jsdisp_t *prop_obj, dispex_prop_t *prop, BOOL *ret) { if(prop->type == PROP_PROTREF) { *ret = TRUE; return S_OK; } + if(prop_obj->proxy) { + HRESULT hres = prop_obj->proxy->lpVtbl->PropOverride(prop_obj->proxy, prop->name, NULL); + if(hres != S_FALSE) { + *ret = TRUE; + return hres; + } + } + if(!(prop->flags & PROPF_CONFIGURABLE)) { *ret = FALSE; return S_OK; @@ -2069,6 +2325,23 @@ static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret) *ret = TRUE; + if(prop->type == PROP_PROXY) { + HRESULT hres = prop_obj->proxy->lpVtbl->PropDelete(prop_obj->proxy, prop->u.proxy_id); + if(SUCCEEDED(hres)) + prop->type = PROP_DELETED; + return hres; + } + /* FIXME: Get rid of this once the builtin proxy props are moved to the prototype */ + if(prop_obj->proxy) { + if(prop->type == PROP_JSVAL && is_object_instance(prop->u.val) && + is_proxy_func(to_jsdisp(get_object(prop->u.val)))) { + return S_OK; + } + if(prop->type == PROP_ACCESSOR && + (is_proxy_func(prop->u.accessor.getter) || is_proxy_func(prop->u.accessor.setter))) { + return S_OK; + } + } if(prop->type == PROP_JSVAL) jsval_release(prop->u.val); if(prop->type == PROP_ACCESSOR) { @@ -2105,7 +2378,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bst return S_OK; } - return delete_prop(prop, &b); + return delete_prop(This, prop, &b); } static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) @@ -2122,7 +2395,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID return DISP_E_MEMBERNOTFOUND; } - return delete_prop(prop, &b); + return delete_prop(This, prop, &b); } static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) @@ -2171,7 +2444,108 @@ static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown return E_NOTIMPL; } -static IDispatchExVtbl DispatchExVtbl = { +static inline jsdisp_t *impl_from_IWineDispatchProxyCbPrivate(IWineDispatchProxyCbPrivate *iface) +{ + return impl_from_IDispatchEx((IDispatchEx*)iface); +} + +static HRESULT WINAPI WineDispatchProxyCbPrivate_InitProxy(IWineDispatchProxyCbPrivate *iface, IDispatch *obj) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + script_ctx_t *ctx = This->ctx; + jsval_t val = jsval_disp(obj); + HRESULT hres; + + if(!ctx->global) + return E_UNEXPECTED; /* Let caller know it has to initialize the host */ + + IDispatch_AddRef(obj); + hres = convert_to_proxy(ctx, &val); + if(SUCCEEDED(hres)) + jsval_release(val); + return hres; +} + +static void WINAPI WineDispatchProxyCbPrivate_Unlinked(IWineDispatchProxyCbPrivate *iface, BOOL persist) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + + if(!persist) { + IWineDispatchProxyPrivate *proxy = This->proxy; + + This->proxy = NULL; + if(!This->ref) { + jsdisp_free(This); + return; + } + + /* We hold a ref only when we're not dangling */ + IDispatchEx_Release((IDispatchEx*)proxy); + } + unlink_jsdisp(This); +} + +static HRESULT WINAPI WineDispatchProxyCbPrivate_HostUpdated(IWineDispatchProxyCbPrivate *iface, IActiveScript *script) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + script_ctx_t *ctx = get_script_ctx(script); + dispex_prop_t *prop, *end; + HRESULT hres; + BOOL b; + + if(!ctx || !ctx->global) + return S_OK; + + if(This->ctx != ctx) { + if(ctx->version < SCRIPTLANGUAGEVERSION_ES5) { + /* Incompatible compat mode, so unlink the proxy */ + *This->proxy->lpVtbl->GetProxyFieldRef(This->proxy) = NULL; + iface->lpVtbl->Unlinked(iface, FALSE); + return S_OK; + } + + if(This->ref) { + list_remove(&This->entry); + list_add_tail(&get_thread_data()->objects, &This->entry); + } + script_release(This->ctx); + script_addref(ctx); + This->ctx = ctx; + + hres = jsdisp_change_prototype(This, ctx->object_prototype); + if(FAILED(hres)) + return hres; + } + + /* It's safe to repopulate the builtin proxy props now, since the mode is already locked */ + for(prop = This->props, end = prop + This->prop_cnt; prop < end; prop++) { + struct proxy_prop_info info; + + if(prop->type == PROP_PROXY) + prop->type = PROP_DELETED; + else { + prop->flags |= PROPF_CONFIGURABLE; + delete_prop(This, prop, &b); + } + + hres = This->proxy->lpVtbl->PropGetInfo(This->proxy, prop->name, FALSE, &info); + if(hres == S_OK) + alloc_proxy_prop(This, &info, &prop); + } + + return S_OK; +} + +static HRESULT WINAPI WineDispatchProxyCbPrivate_PropEnum(IWineDispatchProxyCbPrivate *iface, const WCHAR *name) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + dispex_prop_t *prop; + + return find_prop_name(This, string_hash(name), name, FALSE, &prop); +} + +static IWineDispatchProxyCbPrivateVtbl WineDispatchProxyCbPrivateVtbl = { + { DispatchEx_QueryInterface, DispatchEx_AddRef, DispatchEx_Release, @@ -2187,17 +2561,24 @@ static IDispatchExVtbl DispatchExVtbl = { DispatchEx_GetMemberName, DispatchEx_GetNextDispID, DispatchEx_GetNameSpaceParent + }, + + /* IWineDispatchProxyCbPrivate extension */ + WineDispatchProxyCbPrivate_InitProxy, + WineDispatchProxyCbPrivate_Unlinked, + WineDispatchProxyCbPrivate_HostUpdated, + WineDispatchProxyCbPrivate_PropEnum }; jsdisp_t *as_jsdisp(IDispatch *disp) { - assert(disp->lpVtbl == (IDispatchVtbl*)&DispatchExVtbl); + assert(disp->lpVtbl == (IDispatchVtbl*)&WineDispatchProxyCbPrivateVtbl); return impl_from_IDispatchEx((IDispatchEx*)disp); } jsdisp_t *to_jsdisp(IDispatch *disp) { - return disp->lpVtbl == (IDispatchVtbl*)&DispatchExVtbl ? impl_from_IDispatchEx((IDispatchEx*)disp) : NULL; + return disp->lpVtbl == (IDispatchVtbl*)&WineDispatchProxyCbPrivateVtbl ? impl_from_IDispatchEx((IDispatchEx*)disp) : NULL; } HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype) @@ -2210,7 +2591,7 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b TRACE("%p (%p)\n", dispex, prototype); - dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; + dispex->IDispatchEx_iface.lpVtbl = (const IDispatchExVtbl*)&WineDispatchProxyCbPrivateVtbl; dispex->ref = 1; dispex->builtin_info = builtin_info; dispex->extensible = TRUE; @@ -2263,12 +2644,84 @@ HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsd return S_OK; } +static const builtin_info_t proxy_dispex_info = { + JSCLASS_OBJECT, + NULL, + 0, NULL, + NULL, + NULL +}; + +HRESULT convert_to_proxy(script_ctx_t *ctx, jsval_t *val) +{ + IWineDispatchProxyCbPrivate **proxy_ref; + IWineDispatchProxyPrivate *proxy; + jsdisp_t *jsdisp; + IDispatch *obj; + HRESULT hres; + + if(ctx->version < SCRIPTLANGUAGEVERSION_ES5 || !val || !is_object_instance(*val)) + return S_OK; + obj = get_object(*val); + if(to_jsdisp(obj)) + return S_OK; + + if(FAILED(IDispatch_QueryInterface(obj, &IID_IWineDispatchProxyPrivate, (void**)&proxy)) || !proxy) + return S_OK; + if(!proxy->lpVtbl->HasProxy(proxy)) { + IDispatchEx_Release((IDispatchEx*)proxy); + return S_OK; + } + IDispatch_Release(obj); + + if(!*(proxy_ref = proxy->lpVtbl->GetProxyFieldRef(proxy))) { + if(!ctx->global) { + FIXME("Script is uninitialized?\n"); + IDispatchEx_Release((IDispatchEx*)proxy); + return E_UNEXPECTED; + } + + hres = create_dispex(ctx, &proxy_dispex_info, ctx->object_prototype, &jsdisp); + if(FAILED(hres)) { + IDispatchEx_Release((IDispatchEx*)proxy); + return hres; + } + *proxy_ref = (IWineDispatchProxyCbPrivate*)&jsdisp->IDispatchEx_iface; + jsdisp->proxy = proxy; + + *val = jsval_obj(jsdisp); + return S_OK; + } + + /* Re-acquire the proxy if it's an old dangling proxy */ + jsdisp = impl_from_IWineDispatchProxyCbPrivate(*proxy_ref); + assert(jsdisp->proxy == proxy); + + if(!jsdisp->ref++) + list_add_tail(&get_thread_data()->objects, &jsdisp->entry); + else + IDispatchEx_Release((IDispatchEx*)proxy); /* already held by jsdisp */ + + TRACE("re-acquired %p\n", jsdisp); + *val = jsval_obj(jsdisp); + return S_OK; +} + void jsdisp_free(jsdisp_t *obj) { dispex_prop_t *prop; list_remove(&obj->entry); + /* If it's a proxy, stay alive and keep it associated with the disp, since + we can be re-acquired at some later point. When the underlying disp is + actually destroyed, it should unlink us and then we free it for real. */ + if(obj->proxy) { + list_init(&obj->entry); + IDispatchEx_Release((IDispatchEx*)obj->proxy); + return; + } + TRACE("(%p)\n", obj); if(obj->has_weak_refs) { @@ -2305,12 +2758,21 @@ void jsdisp_free(jsdisp_t *obj) free(obj); } +void jsdisp_reacquire(jsdisp_t *jsdisp) +{ + list_add_tail(&get_thread_data()->objects, &jsdisp->entry); + if(jsdisp->proxy) + IDispatchEx_AddRef((IDispatchEx*)jsdisp->proxy); +} + #ifdef TRACE_REFCNT jsdisp_t *jsdisp_addref(jsdisp_t *jsdisp) { ULONG ref = ++jsdisp->ref; TRACE("(%p) ref=%ld\n", jsdisp, ref); + if(ref == 1) + jsdisp_reacquire(jsdisp); return jsdisp; } @@ -2359,7 +2821,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built jsdisp_t *iface_to_jsdisp(IDispatch *iface) { - return iface->lpVtbl == (const IDispatchVtbl*)&DispatchExVtbl + return iface->lpVtbl == (const IDispatchVtbl*)&WineDispatchProxyCbPrivateVtbl ? jsdisp_addref( impl_from_IDispatchEx((IDispatchEx*)iface)) : NULL; } @@ -2412,6 +2874,8 @@ HRESULT jsdisp_call_value(jsdisp_t *jsfunc, jsval_t vthis, WORD flags, unsigned if(is_class(jsfunc, JSCLASS_FUNCTION)) { hres = Function_invoke(jsfunc, vthis, flags, argc, argv, r, caller); + }else if(jsfunc->proxy) { + hres = proxy_disp_call(jsfunc, vthis, DISPID_VALUE, flags, argc, argv, r, caller); }else { if(!jsfunc->builtin_info->call) { WARN("Not a function\n"); @@ -2424,6 +2888,8 @@ HRESULT jsdisp_call_value(jsdisp_t *jsfunc, jsval_t vthis, WORD flags, unsigned flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; hres = jsfunc->builtin_info->call(jsfunc->ctx, vthis, flags, argc, argv, r); } + if(SUCCEEDED(hres)) + hres = convert_to_proxy(jsfunc->ctx, r); return hres; } @@ -2632,7 +3098,7 @@ HRESULT disp_call_value_with_caller(script_ctx_t *ctx, IDispatch *disp, jsval_t jsdisp_release(jsdisp); if(is_object_instance(vthis) && (ctx->version < SCRIPTLANGUAGEVERSION_ES5 || - ((jsdisp = to_jsdisp(get_object(vthis))) && is_class(jsdisp, JSCLASS_OBJECT)))) + ((jsdisp = to_jsdisp(get_object(vthis))) && is_class(jsdisp, JSCLASS_OBJECT) && !jsdisp->proxy))) jsthis = get_object(vthis); else jsthis = NULL; @@ -2897,7 +3363,7 @@ HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx) if(FAILED(hres) || !prop) return hres; - hres = delete_prop(prop, &b); + hres = delete_prop(obj, prop, &b); if(FAILED(hres)) return hres; return b ? S_OK : JS_E_INVALID_ACTION; @@ -2915,7 +3381,7 @@ HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret) prop = get_prop(jsdisp, id); if(prop) - hres = delete_prop(prop, ret); + hres = delete_prop(jsdisp, prop, ret); else hres = DISP_E_MEMBERNOTFOUND; @@ -2955,6 +3421,9 @@ HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_ty } for(iter = &obj->props[idx]; iter < obj->props + obj->prop_cnt; iter++) { + hres = fix_overridden_prop(obj, iter); + if(FAILED(hres)) + return hres; if(iter->type == PROP_DELETED) continue; if(enum_type != JSDISP_ENUM_ALL && iter->type == PROP_PROTREF) @@ -2996,7 +3465,7 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL }else { hres = find_prop_name(jsdisp, string_hash(ptr), ptr, FALSE, &prop); if(prop) { - hres = delete_prop(prop, ret); + hres = delete_prop(jsdisp, prop, ret); }else { *ret = TRUE; hres = S_OK; @@ -3072,6 +3541,7 @@ HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_onl case PROP_BUILTIN: case PROP_JSVAL: case PROP_IDX: + case PROP_PROXY: desc->mask |= PROPF_WRITABLE; desc->explicit_value = TRUE; if(!flags_only) { @@ -3124,6 +3594,38 @@ HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t if(!prop && !(prop = alloc_prop(obj, name, PROP_DELETED, 0))) return E_OUTOFMEMORY; + if(obj->proxy && desc->explicit_value) { + struct proxy_prop_info info; + + info.name = name; + hres = obj->proxy->lpVtbl->PropDefineOverride(obj->proxy, &info); + if(hres != S_FALSE) { + dispex_prop_t bak = *prop; + if(FAILED(hres)) + return hres; + hres = alloc_proxy_prop(obj, &info, &prop); + if(SUCCEEDED(hres)) { + hres = prop_put(obj, prop, desc->value, &obj->ctx->jscaller->IServiceProvider_iface); + if(SUCCEEDED(hres)) { + switch(bak.type) { + case PROP_JSVAL: + jsval_release(bak.u.val); + break; + case PROP_ACCESSOR: + if(bak.u.accessor.getter) jsdisp_release(bak.u.accessor.getter); + if(bak.u.accessor.setter) jsdisp_release(bak.u.accessor.setter); + break; + default: + break; + } + return S_OK; + } + } + *prop = bak; + return hres; + } + } + if(prop->type == PROP_DELETED || prop->type == PROP_PROTREF) { prop->flags = desc->flags; if(desc->explicit_getter || desc->explicit_setter) { diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 76e6a271bdf..87596528aa5 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -630,15 +630,24 @@ static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, BOOL *ret) { IObjectIdentity *identity; IUnknown *unk1, *unk2; + jsdisp_t *jsdisp; HRESULT hres; - if(disp1 == disp2) { - *ret = TRUE; + if(!disp1 || !disp2) { + *ret = (disp1 == disp2); return S_OK; } - if(!disp1 || !disp2) { - *ret = FALSE; + jsdisp = to_jsdisp(disp1); + if(jsdisp && jsdisp->proxy) + disp1 = (IDispatch*)jsdisp->proxy; + + jsdisp = to_jsdisp(disp2); + if(jsdisp && jsdisp->proxy) + disp2 = (IDispatch*)jsdisp->proxy; + + if(disp1 == disp2) { + *ret = TRUE; return S_OK; } diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 98c43a32e46..54b4293a938 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -55,6 +55,12 @@ typedef struct { const WCHAR *name; } NativeFunction; +typedef struct { + FunctionInstance function; + struct proxy_func_invoker func; + const WCHAR *name; +} ProxyFunction; + typedef struct { FunctionInstance function; FunctionInstance *target; @@ -775,6 +781,132 @@ HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_pro return S_OK; } +static HRESULT ProxyFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) +{ + ProxyFunction *function = (ProxyFunction*)func; + IDispatch *this_obj, *converted = NULL; + DISPPARAMS dp = { 0 }; + EXCEPINFO ei = { 0 }; + VARIANT buf[6], ret; + jsdisp_t *jsdisp; + HRESULT hres; + unsigned i; + + if(flags & DISPATCH_CONSTRUCT) + return E_UNEXPECTED; + + if(argc > function->function.length) + argc = function->function.length; + dp.cArgs = argc; + + if(argc <= ARRAY_SIZE(buf)) + dp.rgvarg = buf; + else if(!(dp.rgvarg = malloc(argc * sizeof(*dp.rgvarg)))) + return E_OUTOFMEMORY; + + for(i = 0; i < argc; i++) { + hres = jsval_to_variant(argv[i], &dp.rgvarg[argc - i - 1]); + if(FAILED(hres)) + goto cleanup; + } + + if(is_undefined(vthis) || is_null(vthis)) + this_obj = lookup_global_host(ctx); + else { + hres = to_object(ctx, vthis, &converted); + if(FAILED(hres)) + goto cleanup; + this_obj = converted; + } + + jsdisp = to_jsdisp(this_obj); + if(jsdisp && jsdisp->proxy) + this_obj = (IDispatch*)jsdisp->proxy; + + V_VT(&ret) = VT_EMPTY; + hres = function->func.invoke(this_obj, function->func.context, &dp, r ? &ret : NULL, &ei, caller); + if(converted) + IDispatch_Release(converted); + + if(hres == DISP_E_EXCEPTION) + disp_fill_exception(ctx, &ei); + else if(SUCCEEDED(hres) && r) { + hres = variant_to_jsval(ctx, &ret, r); + VariantClear(&ret); + } + +cleanup: + while(i) + VariantClear(&dp.rgvarg[argc - i--]); + if(dp.rgvarg != buf) + free(dp.rgvarg); + return hres; +} + +static HRESULT ProxyFunction_toString(FunctionInstance *func, jsstr_t **ret) +{ + ProxyFunction *function = (ProxyFunction*)func; + return native_code_toString(function->name, ret); +} + +static function_code_t *ProxyFunction_get_code(FunctionInstance *func) +{ + return NULL; +} + +static void ProxyFunction_destructor(FunctionInstance *func) +{ +} + +static const function_vtbl_t ProxyFunctionVtbl = { + ProxyFunction_call, + ProxyFunction_toString, + ProxyFunction_get_code, + ProxyFunction_destructor, + no_gc_traverse +}; + +HRESULT create_proxy_functions(jsdisp_t *jsdisp, const struct proxy_prop_info *info, jsdisp_t **funcs) +{ + ProxyFunction *function; + HRESULT hres; + + if(jsdisp->ctx->state == SCRIPTSTATE_UNINITIALIZED || jsdisp->ctx->state == SCRIPTSTATE_CLOSED) + return E_UNEXPECTED; + + /* Method or Getter */ + hres = create_function(jsdisp->ctx, NULL, &ProxyFunctionVtbl, sizeof(ProxyFunction), + (info->flags & PROPF_METHOD) ? info->flags : PROPF_METHOD, FALSE, + NULL, (void**)&function); + if(FAILED(hres)) + return hres; + function->func = info->func[0]; + function->name = info->name; + funcs[0] = &function->function.dispex; + funcs[1] = NULL; + + /* Setter */ + if(info->func[1].invoke) { + hres = create_function(jsdisp->ctx, NULL, &ProxyFunctionVtbl, sizeof(ProxyFunction), + PROPF_METHOD|1, FALSE, NULL, (void**)&function); + if(FAILED(hres)) { + jsdisp_release(funcs[0]); + return hres; + } + function->func = info->func[1]; + function->name = info->name; + funcs[1] = &function->function.dispex; + } + + return S_OK; +} + +BOOL is_proxy_func(jsdisp_t *jsdisp) +{ + return jsdisp && is_class(jsdisp, JSCLASS_FUNCTION) && function_from_jsdisp(jsdisp)->vtbl == &ProxyFunctionVtbl; +} + /* * Create the actual prototype on demand, since it is a circular ref, which prevents the vast * majority of functions from being released quickly, leading to unnecessary scope detach. @@ -842,8 +974,11 @@ static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *fun return hres; this_obj = to_disp(new_obj); }else if(is_object_instance(vthis)) { + IDispatch_AddRef(get_object(vthis)); + hres = convert_to_proxy(ctx, &vthis); + if(FAILED(hres)) + return hres; this_obj = get_object(vthis); - IDispatch_AddRef(this_obj); }else if(ctx->version >= SCRIPTLANGUAGEVERSION_ES5 && !is_undefined(vthis) && !is_null(vthis)) { hres = to_object(ctx, vthis, &this_obj); if(FAILED(hres)) diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 6829f80f299..37d936f5d41 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -1458,3 +1458,8 @@ HRESULT create_jscript_object(BOOL is_encode, REFIID riid, void **ppv) IActiveScript_Release(&ret->IActiveScript_iface); return hres; } + +script_ctx_t *get_script_ctx(IActiveScript *script) +{ + return (script->lpVtbl == &JScriptVtbl) ? impl_from_IActiveScript(script)->ctx : NULL; +} diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 69832a3b9c8..4f441a7c4fa 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -47,6 +47,63 @@ #define SCRIPTLANGUAGEVERSION_ES5 0x102 #define SCRIPTLANGUAGEVERSION_ES6 0x103 +/* + * These are Wine jscript extensions, used for mshtml objects so they act like JS objects. + * Both extend IDispatchEx. IWineDispatchProxyCbPrivate is always available on jscript side. + * + * NOTE: Keep in sync with mshtml_private.h in mshtml.dll + */ +DEFINE_GUID(IID_IWineDispatchProxyPrivate, 0xd359f2fe,0x5531,0x741b,0xa4,0x1a,0x5c,0xf9,0x2e,0xdc,0x97,0x1b); +typedef struct _IWineDispatchProxyPrivate IWineDispatchProxyPrivate; +typedef struct _IWineDispatchProxyCbPrivate IWineDispatchProxyCbPrivate; + +struct proxy_func_invoker +{ + HRESULT (STDMETHODCALLTYPE *invoke)(IDispatch*,void*,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); + void *context; +}; + +struct proxy_prop_info +{ + struct proxy_func_invoker func[2]; + const WCHAR *name; + DISPID dispid; + unsigned flags; +}; + +typedef struct { + IDispatchExVtbl dispex; + IWineDispatchProxyCbPrivate** (STDMETHODCALLTYPE *GetProxyFieldRef)(IWineDispatchProxyPrivate *This); + BOOL (STDMETHODCALLTYPE *HasProxy)(IWineDispatchProxyPrivate *This); + HRESULT (STDMETHODCALLTYPE *PropFixOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); + HRESULT (STDMETHODCALLTYPE *PropOverride)(IWineDispatchProxyPrivate *This, const WCHAR *name, VARIANT *value); + HRESULT (STDMETHODCALLTYPE *PropDefineOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); + HRESULT (STDMETHODCALLTYPE *PropGetInfo)(IWineDispatchProxyPrivate *This, const WCHAR *name, BOOL case_insens, struct proxy_prop_info *info); + HRESULT (STDMETHODCALLTYPE *PropInvoke)(IWineDispatchProxyPrivate *This, IDispatch *this_obj, DISPID id, LCID lcid, + DWORD flags, DISPPARAMS *dp, VARIANT *ret, EXCEPINFO *ei, IServiceProvider *caller); + HRESULT (STDMETHODCALLTYPE *PropDelete)(IWineDispatchProxyPrivate *This, DISPID id); + HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyPrivate *This); + HRESULT (STDMETHODCALLTYPE *ToString)(IWineDispatchProxyPrivate *This, BSTR *string); +} IWineDispatchProxyPrivateVtbl; + +typedef struct { + IDispatchExVtbl dispex; + HRESULT (STDMETHODCALLTYPE *InitProxy)(IWineDispatchProxyCbPrivate *This, IDispatch *obj); + void (STDMETHODCALLTYPE *Unlinked)(IWineDispatchProxyCbPrivate *This, BOOL persist); + HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); + HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); +} IWineDispatchProxyCbPrivateVtbl; + +struct _IWineDispatchProxyPrivate { + const IWineDispatchProxyPrivateVtbl *lpVtbl; +}; + +struct _IWineDispatchProxyCbPrivate { + const IWineDispatchProxyCbPrivateVtbl *lpVtbl; +}; + + + typedef struct _jsval_t jsval_t; typedef struct _jsstr_t jsstr_t; typedef struct _jsexcept_t jsexcept_t; @@ -75,6 +132,7 @@ typedef struct jsdisp_t jsdisp_t; extern HINSTANCE jscript_hinstance ; HRESULT get_dispatch_typeinfo(ITypeInfo**); +/* NOTE: Keep in sync with mshtml_private.h in mshtml.dll */ #define PROPF_ARGMASK 0x00ff #define PROPF_METHOD 0x0100 #define PROPF_CONSTR 0x0200 @@ -222,6 +280,7 @@ struct jsdisp_t { script_ctx_t *ctx; jsdisp_t *prototype; + IWineDispatchProxyPrivate *proxy; const builtin_info_t *builtin_info; struct list entry; @@ -234,6 +293,7 @@ static inline IDispatch *to_disp(jsdisp_t *jsdisp) jsdisp_t *as_jsdisp(IDispatch*); jsdisp_t *to_jsdisp(IDispatch*); +void jsdisp_reacquire(jsdisp_t*); void jsdisp_free(jsdisp_t*); #ifndef TRACE_REFCNT @@ -246,7 +306,8 @@ void jsdisp_free(jsdisp_t*); */ static inline jsdisp_t *jsdisp_addref(jsdisp_t *jsdisp) { - jsdisp->ref++; + if(!jsdisp->ref++) + jsdisp_reacquire(jsdisp); return jsdisp; } @@ -272,6 +333,7 @@ enum jsdisp_enum_type { HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**); HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); +HRESULT convert_to_proxy(script_ctx_t*,jsval_t*); void disp_fill_exception(script_ctx_t*,EXCEPINFO*); HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,jsval_t*,jsval_t*); @@ -307,6 +369,8 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons jsdisp_t*,jsdisp_t**); HRESULT create_builtin_constructor(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD, jsdisp_t*,jsdisp_t**); +HRESULT create_proxy_functions(jsdisp_t*,const struct proxy_prop_info*,jsdisp_t**); +BOOL is_proxy_func(jsdisp_t*); HRESULT Function_invoke(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*,IServiceProvider*); HRESULT Function_value(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); @@ -622,6 +686,7 @@ static inline BOOL is_jscript_error(HRESULT hres) const char *debugstr_jsval(const jsval_t); HRESULT create_jscript_object(BOOL,REFIID,void**); +script_ctx_t *get_script_ctx(IActiveScript*); extern LONG module_ref ; diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 12f41acd398..80786ed2df4 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -286,7 +286,7 @@ HRESULT variant_to_jsval(script_ctx_t *ctx, VARIANT *var, jsval_t *r) } IDispatch_AddRef(V_DISPATCH(var)); *r = jsval_disp(V_DISPATCH(var)); - return S_OK; + return convert_to_proxy(ctx, r); } case VT_I1: *r = jsval_number(V_I1(var)); @@ -330,7 +330,7 @@ HRESULT variant_to_jsval(script_ctx_t *ctx, VARIANT *var, jsval_t *r) hres = IUnknown_QueryInterface(V_UNKNOWN(var), &IID_IDispatch, (void**)&disp); if(SUCCEEDED(hres)) { *r = jsval_disp(disp); - return S_OK; + return convert_to_proxy(ctx, r); } }else { *r = ctx->html_mode ? jsval_null() : jsval_null_disp(); @@ -344,6 +344,9 @@ HRESULT variant_to_jsval(script_ctx_t *ctx, VARIANT *var, jsval_t *r) HRESULT jsval_to_variant(jsval_t val, VARIANT *retv) { + jsdisp_t *jsdisp; + IDispatch *disp; + switch(jsval_type(val)) { case JSV_UNDEFINED: V_VT(retv) = VT_EMPTY; @@ -357,9 +360,14 @@ HRESULT jsval_to_variant(jsval_t val, VARIANT *retv) V_VT(retv) = VT_NULL; return S_OK; case JSV_OBJECT: + disp = get_object(val); + jsdisp = to_jsdisp(disp); + if(jsdisp && jsdisp->proxy) + disp = (IDispatch*)jsdisp->proxy; + + IDispatch_AddRef(disp); V_VT(retv) = VT_DISPATCH; - V_DISPATCH(retv) = get_object(val); - IDispatch_AddRef(get_object(val)); + V_DISPATCH(retv) = disp; return S_OK; case JSV_STRING: V_VT(retv) = VT_BSTR; diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index a918b55f020..08eb23cf7fb 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -29,7 +29,9 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns { jsdisp_t *jsdisp; const WCHAR *str; + BSTR bstr = NULL; IDispatch *disp; + jsstr_t *ret; HRESULT hres; /* Keep in sync with jsclass_t enum */ @@ -68,6 +70,9 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns TRACE("\n"); + if(!r) + return S_OK; + if(is_undefined(vthis) || is_null(vthis)) { if(ctx->version < SCRIPTLANGUAGEVERSION_ES5) str = L"[object Object]"; @@ -83,6 +88,9 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns jsdisp = to_jsdisp(disp); if(!jsdisp) { str = L"[object Object]"; + }else if(jsdisp->proxy) { + hres = jsdisp->proxy->lpVtbl->ToString(jsdisp->proxy, &bstr); + str = bstr; }else if(names[jsdisp->builtin_info->class]) { str = names[jsdisp->builtin_info->class]; }else { @@ -95,13 +103,11 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns return hres; set_output: - if(r) { - jsstr_t *ret; - ret = jsstr_alloc(str); - if(!ret) - return E_OUTOFMEMORY; - *r = jsval_string(ret); - } + ret = jsstr_alloc(str); + SysFreeString(bstr); + if(!ret) + return E_OUTOFMEMORY; + *r = jsval_string(ret); return S_OK; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index f67950d9e35..e8d3f43dce5 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -25,6 +25,7 @@ #include "hlink.h" #include "perhist.h" #include "dispex.h" +#include "activscp.h" #include "objsafe.h" #include "htiframe.h" #include "tlogstg.h" @@ -43,6 +44,67 @@ #include +/* NOTE: Keep in sync with jscript.h in jscript.dll */ +DEFINE_GUID(IID_IWineDispatchProxyPrivate, 0xd359f2fe,0x5531,0x741b,0xa4,0x1a,0x5c,0xf9,0x2e,0xdc,0x97,0x1b); +typedef struct _IWineDispatchProxyPrivate IWineDispatchProxyPrivate; +typedef struct _IWineDispatchProxyCbPrivate IWineDispatchProxyCbPrivate; + +struct proxy_func_invoker +{ + HRESULT (STDMETHODCALLTYPE *invoke)(IDispatch*,void*,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); + void *context; +}; + +struct proxy_prop_info +{ + struct proxy_func_invoker func[2]; + const WCHAR *name; + DISPID dispid; + unsigned flags; +}; + +typedef struct { + IDispatchExVtbl dispex; + IWineDispatchProxyCbPrivate** (STDMETHODCALLTYPE *GetProxyFieldRef)(IWineDispatchProxyPrivate *This); + BOOL (STDMETHODCALLTYPE *HasProxy)(IWineDispatchProxyPrivate *This); + HRESULT (STDMETHODCALLTYPE *PropFixOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); + HRESULT (STDMETHODCALLTYPE *PropOverride)(IWineDispatchProxyPrivate *This, const WCHAR *name, VARIANT *value); + HRESULT (STDMETHODCALLTYPE *PropDefineOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); + HRESULT (STDMETHODCALLTYPE *PropGetInfo)(IWineDispatchProxyPrivate *This, const WCHAR *name, BOOL case_insens, struct proxy_prop_info *info); + HRESULT (STDMETHODCALLTYPE *PropInvoke)(IWineDispatchProxyPrivate *This, IDispatch *this_obj, DISPID id, LCID lcid, + DWORD flags, DISPPARAMS *dp, VARIANT *ret, EXCEPINFO *ei, IServiceProvider *caller); + HRESULT (STDMETHODCALLTYPE *PropDelete)(IWineDispatchProxyPrivate *This, DISPID id); + HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyPrivate *This); + HRESULT (STDMETHODCALLTYPE *ToString)(IWineDispatchProxyPrivate *This, BSTR *string); +} IWineDispatchProxyPrivateVtbl; + +typedef struct { + IDispatchExVtbl dispex; + HRESULT (STDMETHODCALLTYPE *InitProxy)(IWineDispatchProxyCbPrivate *This, IDispatch *obj); + void (STDMETHODCALLTYPE *Unlinked)(IWineDispatchProxyCbPrivate *This, BOOL persist); + HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); + HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); +} IWineDispatchProxyCbPrivateVtbl; + +struct _IWineDispatchProxyPrivate { + const IWineDispatchProxyPrivateVtbl *lpVtbl; +}; + +struct _IWineDispatchProxyCbPrivate { + const IWineDispatchProxyCbPrivateVtbl *lpVtbl; +}; + +#define PROPF_ARGMASK 0x00ff +#define PROPF_METHOD 0x0100 +#define PROPF_CONSTR 0x0200 + +#define PROPF_ENUMERABLE 0x0400 +#define PROPF_WRITABLE 0x0800 +#define PROPF_CONFIGURABLE 0x1000 +#define PROPF_ALL (PROPF_ENUMERABLE | PROPF_WRITABLE | PROPF_CONFIGURABLE) + + + #define NS_ERROR_GENERATE_FAILURE(module,code) \ ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code)))) #define NS_ERROR_GENERATE_SUCCESS(module,code) \ From 062a04601f48eacb70108ff13366edef15e18570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:24 +0200 Subject: [PATCH 0947/1506] jscript: Convert named items to proxies when available. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/jscript.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 37d936f5d41..abf9182e4f5 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -141,9 +141,11 @@ static void release_named_item_script_obj(named_item_t *item) item->script_obj = NULL; } -static HRESULT retrieve_named_item_disp(IActiveScriptSite *site, named_item_t *item) +static HRESULT retrieve_named_item_disp(script_ctx_t *ctx, IActiveScriptSite *site, named_item_t *item) { + IDispatch *disp; IUnknown *unk; + jsval_t val; HRESULT hr; if(!site) @@ -155,13 +157,19 @@ static HRESULT retrieve_named_item_disp(IActiveScriptSite *site, named_item_t *i return hr; } - hr = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp); + hr = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp); IUnknown_Release(unk); if(FAILED(hr)) { WARN("object does not implement IDispatch\n"); return hr; } + val = jsval_disp(disp); + hr = convert_to_proxy(ctx, &val); + if(FAILED(hr)) + return hr; + item->disp = get_object(val); + return S_OK; } @@ -178,7 +186,7 @@ named_item_t *lookup_named_item(script_ctx_t *ctx, const WCHAR *item_name, unsig } if(!item->disp && (flags || !(item->flags & SCRIPTITEM_CODEONLY))) { - hr = retrieve_named_item_disp(ctx->site, item); + hr = retrieve_named_item_disp(ctx, ctx->site, item); if(FAILED(hr)) continue; } @@ -778,7 +786,7 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface, { if(!item->disp) { - hres = retrieve_named_item_disp(pass, item); + hres = retrieve_named_item_disp(This->ctx, pass, item); if(FAILED(hres)) return hres; } @@ -902,6 +910,7 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) { IUnknown *unk; + jsval_t val; hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL); if(FAILED(hres)) { @@ -915,6 +924,12 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, WARN("object does not implement IDispatch\n"); return hres; } + + val = jsval_disp(disp); + hres = convert_to_proxy(This->ctx, &val); + if(FAILED(hres)) + return hres; + disp = get_object(val); } item = malloc(sizeof(*item)); From c2b42808022c94d52faf7531715c7cc00e71a098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:25 +0200 Subject: [PATCH 0948/1506] mshtml: Implement the private jscript proxy interface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This implements the internal private interface for mshtml objects, so they can be used as JS proxy objects from jscript. Note that the association from these objects back to the JS proxy objects does not hold a ref to them, but only a weak ref, to prevent circular references. However, because the associated jsdisp remains alive even if it's dangling with a refcount of 0, the pointers are always valid until Unlinked is called on them via the callback, which invalidates them. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 416 +++++++++++++++++++++++++++--- dlls/mshtml/htmldoc.c | 184 ++++++++++++- dlls/mshtml/htmlstorage.c | 24 ++ dlls/mshtml/htmlstyle.c | 15 +- dlls/mshtml/htmlwindow.c | 258 +++++++++++++++++- dlls/mshtml/mshtml_private.h | 6 + dlls/mshtml/mutation.c | 26 ++ dlls/mshtml/script.c | 29 +++ dlls/mshtml/tests/documentmode.js | 9 +- dlls/mshtml/tests/dom.js | 132 ++++++++++ dlls/mshtml/tests/es5.js | 2 - dlls/mshtml/tests/events.c | 24 +- dlls/mshtml/tests/xhr.js | 1 - 13 files changed, 1067 insertions(+), 59 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 8f95ee47a02..d1456c4722a 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -124,7 +124,6 @@ PRIVATE_TID_LIST #undef XDIID }; -static inline DispatchEx *get_dispex_for_hook(IUnknown*); static HRESULT invoke_builtin_function(IDispatch*,func_info_t*,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); static HRESULT load_typelib(void) @@ -1166,7 +1165,7 @@ static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **re return DISP_E_MEMBERNOTFOUND; } -static HRESULT get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID *ret) +HRESULT dispex_get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID *ret) { int min, max, n, c; @@ -1202,6 +1201,22 @@ static HRESULT get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID return DISP_E_UNKNOWNNAME; } +static inline DispatchEx *get_dispex_for_hook(IUnknown *iface) +{ + IWineDispatchProxyPrivate *itf; + DispatchEx *dispex; + + if(FAILED(IUnknown_QueryInterface(iface, &IID_IWineDispatchProxyPrivate, (void**)&itf)) || !itf) + return NULL; + dispex = CONTAINING_RECORD(itf->lpVtbl->GetProxyFieldRef(itf), DispatchEx, proxy); + + /* The dispex and the proxy interface requested might be different (e.g. inner vs outer windows) */ + IDispatchEx_AddRef(&dispex->IDispatchEx_iface); + IDispatchEx_Release((IDispatchEx*)itf); + + return dispex; +} + HRESULT change_type(VARIANT *dst, VARIANT *src, VARTYPE vt, IServiceProvider *caller) { V_VT(dst) = VT_EMPTY; @@ -1731,6 +1746,88 @@ static BOOL ensure_real_info(DispatchEx *dispex) return dispex->info != NULL; } +static HRESULT proxy_get_dispid(DispatchEx *dispex, const WCHAR *name, BOOL case_insens, DISPID *id) +{ + DWORD grfdex = case_insens ? fdexNameCaseInsensitive : fdexNameCaseSensitive; + dynamic_prop_t *dprop; + HRESULT hres; + BSTR bstr; + + if(!ensure_real_info(dispex) || !(bstr = SysAllocString(name))) + return E_OUTOFMEMORY; + + /* FIXME: move builtins to the prototype */ + hres = dispex_get_builtin_id(dispex, bstr, grfdex, id); + SysFreeString(bstr); + if(hres != DISP_E_UNKNOWNNAME) + return hres; + + hres = get_dynamic_prop(dispex, name, grfdex, &dprop); + if(FAILED(hres)) + return hres; + + *id = DISPID_DYNPROP_0 + (dprop - dispex->dynamic_data->props); + return S_OK; +} + +static HRESULT WINAPI proxy_func_invoke(IDispatch *this_obj, void *context, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + func_info_t *func = context; + return invoke_builtin_function(this_obj, func, dp, res, ei, caller); +} + +static HRESULT WINAPI proxy_getter_invoke(IDispatch *this_obj, void *context, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + func_info_t *func = context; + DispatchEx *dispex; + IUnknown *iface; + HRESULT hres; + + hres = IDispatch_QueryInterface(this_obj, tid_ids[func->tid], (void**)&iface); + if(FAILED(hres) || !iface) + return E_UNEXPECTED; + + if(func->hook && (dispex = get_dispex_for_hook(iface))) { + hres = func->hook(dispex, DISPATCH_PROPERTYGET, dp, res, ei, caller); + IDispatchEx_Release(&dispex->IDispatchEx_iface); + if(hres != S_FALSE) + goto done; + } + hres = builtin_propget(iface, func, dp, res); + +done: + IUnknown_Release(iface); + return hres; +} + +static HRESULT WINAPI proxy_setter_invoke(IDispatch *this_obj, void *context, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + static DISPID propput_dispid = DISPID_PROPERTYPUT; + func_info_t *func = context; + DispatchEx *dispex; + IUnknown *iface; + HRESULT hres; + + dp->cNamedArgs = 1; + dp->rgdispidNamedArgs = &propput_dispid; + + hres = IDispatch_QueryInterface(this_obj, tid_ids[func->tid], (void**)&iface); + if(FAILED(hres) || !iface) + return E_UNEXPECTED; + + if(func->hook && (dispex = get_dispex_for_hook(iface))) { + hres = func->hook(dispex, DISPATCH_PROPERTYPUT, dp, res, ei, caller); + IDispatchEx_Release(&dispex->IDispatchEx_iface); + if(hres != S_FALSE) + goto done; + } + hres = builtin_propput(NULL, iface, func, dp, caller); + +done: + IUnknown_Release(iface); + return hres; +} + static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface) { return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface); @@ -1750,6 +1847,8 @@ static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid) || IsEqualGUID(&IID_IDispatchEx, riid)) *ppv = &This->IDispatchEx_iface; + else if(IsEqualGUID(&IID_IWineDispatchProxyPrivate, riid)) + *ppv = &This->IDispatchEx_iface; else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid)) { *ppv = &dispex_ccp; return S_OK; @@ -1835,6 +1934,10 @@ static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, DispatchEx *This = impl_from_IDispatchEx(iface); HRESULT hres = S_OK; + if(This->proxy) + return IDispatchEx_GetIDsOfNames((IDispatchEx*)This->proxy, riid, rgszNames, + cNames, lcid, rgDispId); + TRACE("%s (%p)->(%s %p %u %lu %p)\n", This->info->desc->name, This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); @@ -1851,6 +1954,10 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, { DispatchEx *This = impl_from_IDispatchEx(iface); + if(This->proxy && dispIdMember >= 0) + return IDispatchEx_Invoke((IDispatchEx*)This->proxy, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + TRACE("%s (%p)->(%ld %s %ld %d %p %p %p %p)\n", This->info->desc->name, This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); @@ -1863,6 +1970,9 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW dynamic_prop_t *dprop; HRESULT hres; + if(This->proxy) + return IDispatchEx_GetDispID((IDispatchEx*)This->proxy, bstrName, grfdex, pid); + TRACE("%s (%p)->(%s %lx %p)\n", This->info->desc->name, This, debugstr_w(bstrName), grfdex, pid); if(grfdex & ~(fdexNameCaseSensitive|fdexNameCaseInsensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK)) @@ -1871,7 +1981,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW if(!ensure_real_info(This)) return E_OUTOFMEMORY; - hres = get_builtin_id(This, bstrName, grfdex, pid); + hres = dispex_get_builtin_id(This, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; @@ -1888,6 +1998,9 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc { DispatchEx *This = impl_from_IDispatchEx(iface); + if(This->proxy && id >= 0) + return IDispatchEx_InvokeEx((IDispatchEx*)This->proxy, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); + TRACE("%s (%p)->(%lx %lx %x %p %p %p %p)\n", This->info->desc->name, This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); return dispex_invoke(This, (IDispatch*)iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); @@ -1899,14 +2012,15 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR nam DISPID id; HRESULT hres; + if(This->proxy) + return IDispatchEx_DeleteMemberByName((IDispatchEx*)This->proxy, name, grfdex); + TRACE("%s (%p)->(%s %lx)\n", This->info->desc->name, This, debugstr_w(name), grfdex); hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, name, grfdex & ~fdexNameEnsure, &id); if(FAILED(hres)) { - compat_mode_t compat_mode = dispex_compat_mode(This); TRACE("property %s not found\n", debugstr_w(name)); - return compat_mode < COMPAT_MODE_IE8 ? E_NOTIMPL : - compat_mode < COMPAT_MODE_IE9 ? hres : S_OK; + return dispex_compat_mode(This) < COMPAT_MODE_IE8 ? E_NOTIMPL : hres; } return dispex_delete_prop(This, id); @@ -1916,6 +2030,9 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID { DispatchEx *This = impl_from_IDispatchEx(iface); + if(This->proxy && id >= 0) + return IDispatchEx_DeleteMemberByDispID((IDispatchEx*)This->proxy, id); + TRACE("%s (%p)->(%lx)\n", This->info->desc->name, This, id); return dispex_delete_prop(This, id); @@ -1924,6 +2041,10 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) { DispatchEx *This = impl_from_IDispatchEx(iface); + + if(This->proxy && id >= 0) + return IDispatchEx_GetMemberProperties((IDispatchEx*)This->proxy, id, grfdexFetch, pgrfdex); + FIXME("%s (%p)->(%lx %lx %p)\n", This->info->desc->name, This, id, grfdexFetch, pgrfdex); return E_NOTIMPL; } @@ -1934,6 +2055,9 @@ static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BS func_info_t *func; HRESULT hres; + if(This->proxy && id >= 0) + return IDispatchEx_GetMemberName((IDispatchEx*)This->proxy, id, pbstrName); + TRACE("%s (%p)->(%lx %p)\n", This->info->desc->name, This, id, pbstrName); if(!ensure_real_info(This)) @@ -1989,6 +2113,9 @@ static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, func_info_t *func; HRESULT hres; + if(This->proxy) + return IDispatchEx_GetNextDispID((IDispatchEx*)This->proxy, grfdex, id, pid); + TRACE("%s (%p)->(%lx %lx %p)\n", This->info->desc->name, This, grfdex, id, pid); if(!ensure_real_info(This)) @@ -2044,7 +2171,215 @@ static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown return E_NOTIMPL; } -static IDispatchExVtbl DispatchExVtbl = { +static inline DispatchEx *impl_from_IWineDispatchProxyPrivate(IWineDispatchProxyPrivate *iface) +{ + return impl_from_IDispatchEx((IDispatchEx*)iface); +} + +static IWineDispatchProxyCbPrivate** WINAPI WineDispatchProxyPrivate_GetProxyFieldRef(IWineDispatchProxyPrivate *iface) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + return &This->proxy; +} + +static BOOL WINAPI WineDispatchProxyPrivate_HasProxy(IWineDispatchProxyPrivate *iface) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + return This->info->compat_mode >= COMPAT_MODE_IE9; +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + HRESULT hres; + + if(!This->info->desc->vtbl->override) + return S_FALSE; + + /* We only care about custom props, as those are the only ones which can mismatch. + Some objects with custom props (such as the Storage objects) can be out of sync, + because the underlying storage is changed asynchronously (e.g. the backing file + in localStorage), so the prop may not exist at this point, even if it did before. */ + if(info->dispid != DISPID_UNKNOWN && !is_custom_dispid(info->dispid)) + return S_FALSE; + + hres = This->info->desc->vtbl->get_dispid(This, (WCHAR*)info->name, fdexNameCaseSensitive, &info->dispid); + if(hres == DISP_E_UNKNOWNNAME) { + if(info->dispid == DISPID_UNKNOWN) + return S_FALSE; + info->dispid = DISPID_UNKNOWN; + return S_OK; + } + if(FAILED(hres)) + return hres; + info->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE | PROPF_ENUMERABLE; + return S_OK; +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropOverride(IWineDispatchProxyPrivate *iface, const WCHAR *name, VARIANT *value) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + + if(!This->info->desc->vtbl->override) + return S_FALSE; + return This->info->desc->vtbl->override(This, name, value); +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropDefineOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + HRESULT hres; + + if(!This->info->desc->vtbl->override) + return S_FALSE; + + hres = This->info->desc->vtbl->get_dispid(This, (WCHAR*)info->name, fdexNameEnsure | fdexNameCaseSensitive, &info->dispid); + if(FAILED(hres)) + return (hres == DISP_E_UNKNOWNNAME) ? S_FALSE : hres; + + info->func[0].invoke = NULL; + info->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE | PROPF_ENUMERABLE; + return S_OK; +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropGetInfo(IWineDispatchProxyPrivate *iface, const WCHAR *name, + BOOL case_insens, struct proxy_prop_info *info) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + func_info_t *func; + HRESULT hres; + + info->func[0].invoke = NULL; + + hres = proxy_get_dispid(This, name, case_insens, &info->dispid); + if(FAILED(hres)) + return hres; + + if(is_dynamic_dispid(info->dispid)) { + info->name = This->dynamic_data->props[info->dispid - DISPID_DYNPROP_0].name; + info->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE | PROPF_ENUMERABLE; + return S_OK; + } + + if(is_custom_dispid(info->dispid)) { + info->name = name; /* FIXME */ + info->flags = PROPF_WRITABLE; + if(This->info->desc->vtbl->delete) + info->flags |= PROPF_CONFIGURABLE; + if(This->info->desc->vtbl->next_dispid) + info->flags |= PROPF_ENUMERABLE; + return S_OK; + } + + hres = get_builtin_func(This->info, info->dispid, &func); + if(FAILED(hres)) + return (hres == DISP_E_MEMBERNOTFOUND) ? E_UNEXPECTED : hres; + info->func[0].context = info->func[1].context = func; + info->name = func->name; + + if(func->func_disp_idx >= 0) { + if(This->dynamic_data && This->dynamic_data->func_disps + && This->dynamic_data->func_disps[func->func_disp_idx].func_obj) { + func_obj_entry_t *entry = This->dynamic_data->func_disps + func->func_disp_idx; + + if((IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface != V_DISPATCH(&entry->val)) { + info->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE; + return S_OK; + } + } + info->flags = PROPF_METHOD | func->argc | PROPF_WRITABLE | PROPF_CONFIGURABLE; + info->func[0].invoke = proxy_func_invoke; + info->func[1].invoke = NULL; + return S_OK; + } + + info->flags = PROPF_CONFIGURABLE | (func->put_vtbl_off ? PROPF_WRITABLE : 0); + if(func->func_disp_idx == -1) + info->flags |= PROPF_ENUMERABLE; + info->func[0].invoke = proxy_getter_invoke; + info->func[1].invoke = func->put_vtbl_off ? proxy_setter_invoke : NULL; + return S_OK; +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropInvoke(IWineDispatchProxyPrivate *iface, IDispatch *this_obj, DISPID id, + LCID lcid, DWORD flags, DISPPARAMS *dp, VARIANT *ret, EXCEPINFO *ei, IServiceProvider *caller) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + + return dispex_invoke(This, this_obj, id, lcid, flags, dp, ret, ei, caller); +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropDelete(IWineDispatchProxyPrivate *iface, DISPID id) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + + return dispex_delete_prop(This, id); +} + +static HRESULT WINAPI WineDispatchProxyPrivate_PropEnum(IWineDispatchProxyPrivate *iface) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + IWineDispatchProxyCbPrivate *obj = This->proxy; + dynamic_prop_t *dyn_prop, *dyn_prop_end; + dispex_dynamic_data_t *dyn_data; + func_info_t *func, *func_end; + HRESULT hres; + HRESULT (STDMETHODCALLTYPE *callback)(IWineDispatchProxyCbPrivate*,const WCHAR*) = obj->lpVtbl->PropEnum; + + if(!ensure_real_info(This)) + return E_OUTOFMEMORY; + + for(func = This->info->funcs, func_end = func + This->info->func_cnt; func != func_end; func++) { + if(func->func_disp_idx == -1) { + hres = callback(obj, func->name); + if(FAILED(hres)) + return hres; + } + } + + if(This->info->desc->vtbl->next_dispid) { + const dispex_static_data_vtbl_t *vtbl = This->info->desc->vtbl; + DISPID id = DISPID_STARTENUM; + BSTR name; + + do { + hres = vtbl->next_dispid(This, id, &id); + if(hres != S_OK) + break; + hres = vtbl->get_name(This, id, &name); + if(SUCCEEDED(hres)) { + hres = callback(obj, name); + SysFreeString(name); + } + } while(SUCCEEDED(hres)); + + if(FAILED(hres)) + return hres; + } + + if(!(dyn_data = get_dynamic_data(This))) + return E_OUTOFMEMORY; + + for(dyn_prop = dyn_data->props, dyn_prop_end = dyn_prop + dyn_data->prop_cnt; dyn_prop != dyn_prop_end; dyn_prop++) { + if(!(dyn_prop->flags & (DYNPROP_DELETED | DYNPROP_HIDDEN))) { + hres = callback(obj, dyn_prop->name); + if(FAILED(hres)) + return hres; + } + } + + return S_OK; +} + +static HRESULT WINAPI WineDispatchProxyPrivate_ToString(IWineDispatchProxyPrivate *iface, BSTR *string) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + + return dispex_to_string(This, string); +} + +static IWineDispatchProxyPrivateVtbl WineDispatchProxyPrivateVtbl = { + { DispatchEx_QueryInterface, DispatchEx_AddRef, DispatchEx_Release, @@ -2060,29 +2395,21 @@ static IDispatchExVtbl DispatchExVtbl = { DispatchEx_GetMemberName, DispatchEx_GetNextDispID, DispatchEx_GetNameSpaceParent + }, + + /* IWineDispatchProxyPrivate extension */ + WineDispatchProxyPrivate_GetProxyFieldRef, + WineDispatchProxyPrivate_HasProxy, + WineDispatchProxyPrivate_PropFixOverride, + WineDispatchProxyPrivate_PropOverride, + WineDispatchProxyPrivate_PropDefineOverride, + WineDispatchProxyPrivate_PropGetInfo, + WineDispatchProxyPrivate_PropInvoke, + WineDispatchProxyPrivate_PropDelete, + WineDispatchProxyPrivate_PropEnum, + WineDispatchProxyPrivate_ToString }; -extern const IDispatchExVtbl WindowDispExVtbl; -extern const IDispatchExVtbl DocDispatchExVtbl; -static inline DispatchEx *get_dispex_for_hook(IUnknown *iface) -{ - IDispatchEx *dispex; - - if(FAILED(IUnknown_QueryInterface(iface, &IID_IDispatchEx, (void**)&dispex)) || !dispex) - return NULL; - - /* FIXME: Handle these generically (needs private interface) */ - if(dispex->lpVtbl == &DispatchExVtbl) - return impl_from_IDispatchEx(dispex); - if(dispex->lpVtbl == &WindowDispExVtbl) - return &CONTAINING_RECORD(dispex, HTMLWindow, IDispatchEx_iface)->inner_window->event_target.dispex; - if(dispex->lpVtbl == &DocDispatchExVtbl) - return &CONTAINING_RECORD(dispex, HTMLDocumentNode, IDispatchEx_iface)->node.event_target.dispex; - - IDispatchEx_Release(dispex); - return NULL; -} - HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *res, EXCEPINFO *pei, IServiceProvider *caller) { @@ -2226,6 +2553,12 @@ void dispex_props_unlink(DispatchEx *This) { dynamic_prop_t *prop; + if(This->proxy) { + IWineDispatchProxyCbPrivate *proxy = This->proxy; + This->proxy = NULL; + proxy->lpVtbl->Unlinked(proxy, FALSE); + } + if(!This->dynamic_data) return; @@ -2269,6 +2602,9 @@ static void NSAPI dispex_delete_cycle_collectable(void *p) if(This->info->desc->vtbl->unlink) This->info->desc->vtbl->unlink(This); + if(This->proxy) + This->proxy->lpVtbl->Unlinked(This->proxy, FALSE); + if(!This->dynamic_data) goto destructor; @@ -2318,7 +2654,8 @@ void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, HTMLInnerWind { assert(compat_mode < COMPAT_MODE_CNT); - dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; + dispex->IDispatchEx_iface.lpVtbl = (const IDispatchExVtbl*)&WineDispatchProxyPrivateVtbl; + dispex->proxy = NULL; dispex->dynamic_data = NULL; ccref_init(&dispex->ccref, 1); @@ -2338,5 +2675,26 @@ void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, HTMLInnerWind dispex->info = data->delayed_init_info; }else { dispex->info = ensure_dispex_info(data, compat_mode); + if(window) { + if(compat_mode >= COMPAT_MODE_IE9) { + IWineDispatchProxyCbPrivate *proxy = window->event_target.dispex.proxy; + if(!proxy) { + init_proxies(window); + proxy = window->event_target.dispex.proxy; + } + if(proxy) { + HRESULT hres = proxy->lpVtbl->InitProxy(proxy, (IDispatch*)&dispex->IDispatchEx_iface); + if(hres == E_UNEXPECTED) { + /* Possible element (e.g. + diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index d9201af0d20..b3f0acce89b 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -3001,6 +3001,8 @@ sync_test("Crypto", function() { var crypto = window.msCrypto; if(!crypto) return; + ok(Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(window), "msCrypto"), "msCrypto not a property of window's prototype."); + ok("subtle" in crypto, "subtle not in crypto"); ok("getRandomValues" in crypto, "getRandomValues not in crypto"); ok(!("randomUUID" in crypto), "randomUUID is in crypto"); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index de3ff54966c..bee2c235a8a 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -753,7 +753,10 @@ static void _test_class_info(unsigned line, IUnknown *unk, const CLSID *clsid) #define test_disp2(a,b,c,d,e) _test_disp2(__LINE__,a,b,c,d,e) static void _test_disp2(unsigned line, IUnknown *unk, const IID *diid, const IID *diid2, const CLSID *clsid, const WCHAR *val) { + IDispatchEx *dispex; IUnknown *u; + DISPID id; + BSTR bstr; IID iid; HRESULT hres; @@ -784,6 +787,28 @@ static void _test_disp2(unsigned line, IUnknown *unk, const IID *diid, const IID ok_(__FILE__,line)(hres == E_NOINTERFACE, "Got IProvideClassInfo iface\n"); ok_(__FILE__,line)(!u, "u = %p\n", u); } + + if(compat_mode >= COMPAT_IE9) { + dispex = _get_dispex_iface(line, unk); + bstr = SysAllocString(L"hasOwnProperty"); + hres = IDispatchEx_GetDispID(dispex, bstr, 0, &id); + ok_(__FILE__,line)(hres == S_OK, "GetDispID(hasOwnProperty) failed: %08lx\n", hres); + SysFreeString(bstr); + + bstr = SysAllocString(L"hasoWnPROperty"); + hres = IDispatchEx_GetIDsOfNames(dispex, &IID_NULL, &bstr, 1, 0, &id); + ok_(__FILE__,line)(hres == S_OK, "GetIDsOfNames(hasoWnPROperty) failed: %08lx\n", hres); + ok_(__FILE__,line)(id > 0, "Unexpected DISPID for hasoWnPROperty: %ld\n", id); + + hres = IDispatchEx_GetDispID(dispex, bstr, 0, &id); + ok_(__FILE__,line)(hres == DISP_E_UNKNOWNNAME, "GetDispID(hasoWnPROperty) returned %08lx\n", hres); + + hres = IDispatchEx_GetDispID(dispex, bstr, fdexNameCaseInsensitive, &id); + ok_(__FILE__,line)(hres == S_OK, "GetDispID(hasoWnPROperty) with fdexNameCaseInsensitive failed: %08lx\n", hres); + ok_(__FILE__,line)(id > 0, "Unexpected DISPID for hasoWnPROperty with fdexNameCaseInsensitive: %ld\n", id); + SysFreeString(bstr); + IDispatchEx_Release(dispex); + } } #define test_disp(a,b,c,d) _test_disp(__LINE__,a,b,c,d) diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index d5640525f0e..b1b9de55546 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -4257,7 +4257,6 @@ static void test_doc_obj(IHTMLDocument2 *doc) hres = IHTMLDocument2_Invoke(doc, has_own_prop_id, &IID_NULL, 0, DISPATCH_METHOD, &dp, &res, NULL, NULL); ok(hres == S_OK, "Invoke(hasOwnProperty(\"createElement\")) failed: %08lx\n", hres); ok(V_VT(&res) == VT_BOOL, "VT = %d\n", V_VT(&res)); - todo_wine ok(V_BOOL(&res) == VARIANT_FALSE, "hasOwnProperty(\"createElement\") = %d\n", V_BOOL(&res)); hres = IHTMLDocument2_GetIDsOfNames(doc, &IID_NULL, &V_BSTR(&arg), 1, 0, &dispid); @@ -4270,6 +4269,23 @@ static void test_doc_obj(IHTMLDocument2 *doc) ok(V_VT(&res) == VT_BOOL, "VT = %d\n", V_VT(&res)); ok(V_BOOL(&res) == VARIANT_TRUE, "hasOwnProperty(\"prop\") = %d\n", V_BOOL(&res)); SysFreeString(V_BSTR(&arg)); + + V_BSTR(&arg) = SysAllocString(L"proto_prop"); + hres = IHTMLDocument2_Invoke(doc, has_own_prop_id, &IID_NULL, 0, DISPATCH_METHOD, &dp, &res, NULL, NULL); + ok(hres == S_OK, "Invoke(hasOwnProperty(\"proto_prop\")) failed: %08lx\n", hres); + ok(V_VT(&res) == VT_BOOL, "VT = %d\n", V_VT(&res)); + ok(V_BOOL(&res) == VARIANT_FALSE, "hasOwnProperty(\"proto_prop\") = %d\n", V_BOOL(&res)); + + hres = IHTMLDocument2_GetIDsOfNames(doc, &IID_NULL, &V_BSTR(&arg), 1, 0, &dispid); + ok(hres == S_OK, "GetIDsOfNames(proto_prop) returned: %08lx\n", hres); + SysFreeString(V_BSTR(&arg)); + + dp.cArgs = 0; + dp.rgvarg = NULL; + hres = IHTMLDocument2_Invoke(doc, dispid, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &res, NULL, NULL); + ok(hres == S_OK, "Invoke(proto_prop) failed: %08lx\n", hres); + ok(V_VT(&res) == VT_BOOL, "VT(proto_prop) = %d\n", V_VT(&res)); + ok(V_BOOL(&res) == VARIANT_TRUE, "proto_prop = %d\n", V_BOOL(&res)); } /* test window props during navigation */ diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index df0bc4e200d..d53d0bfbd28 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -347,6 +347,7 @@ static void test_sp_caller(IServiceProvider *sp) static void test_script_vars(unsigned argc, VARIANTARG *argv) { static const WCHAR *const jsobj_names[] = { L"abc", L"foO", L"bar", L"TostRing", L"hasownpropERty" }; + static const WCHAR *const body_names[] = { L"BAcKgRound", L"bGcoLor", L"fooBar", L"vaLUEof", L"hasownPROperty" }; IHTMLBodyElement *body; IDispatchEx *disp; DISPID id, id2; @@ -430,6 +431,21 @@ static void test_script_vars(unsigned argc, VARIANTARG *argv) ok(hres == S_OK, "Could not get IHTMLBodyElement iface: %08lx\n", hres); IHTMLBodyElement_Release(body); + for(i = 0; i < ARRAY_SIZE(body_names); i++) { + bstr = SysAllocString(body_names[i]); + hres = IDispatchEx_GetIDsOfNames(disp, &IID_NULL, &bstr, 1, 0, &id); + ok(hres == S_OK, "GetIDsOfNames(%s) failed: %08lx\n", debugstr_w(bstr), hres); + ok(id > 0, "Unexpected DISPID for %s: %ld\n", debugstr_w(bstr), id); + + hres = IDispatchEx_GetDispID(disp, bstr, 0, &id); + ok(hres == DISP_E_UNKNOWNNAME, "GetDispID(%s) returned %08lx, expected %08lx\n", debugstr_w(bstr), hres, DISP_E_UNKNOWNNAME); + + hres = IDispatchEx_GetDispID(disp, bstr, fdexNameCaseInsensitive, &id); + ok(hres == S_OK, "GetDispID(%s) with fdexNameCaseInsensitive failed: %08lx\n", debugstr_w(bstr), hres); + ok(id > 0, "Unexpected DISPID for %s: %ld\n", debugstr_w(bstr), id); + SysFreeString(bstr); + } + IDispatchEx_Release(disp); } diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index c9812ec17ad..7f22a9f05fd 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1609,9 +1609,10 @@ static const tid_t HTMLXMLHttpRequest_iface_tids[] = { IHTMLXMLHttpRequest2_tid, 0 }; -static dispex_static_data_t HTMLXMLHttpRequest_dispex = { +dispex_static_data_t HTMLXMLHttpRequest_dispex = { "XMLHttpRequest", &HTMLXMLHttpRequest_event_target_vtbl.dispex_vtbl, + PROTO_ID_HTMLXMLHttpRequest, DispHTMLXMLHttpRequest_tid, HTMLXMLHttpRequest_iface_tids, HTMLXMLHttpRequest_init_dispex_info @@ -1831,6 +1832,7 @@ static const tid_t HTMLXMLHttpRequestFactory_iface_tids[] = { static dispex_static_data_t HTMLXMLHttpRequestFactory_dispex = { "Function", &HTMLXMLHttpRequestFactory_dispex_vtbl, + PROTO_ID_NULL, IHTMLXMLHttpRequestFactory_tid, HTMLXMLHttpRequestFactory_iface_tids }; From 886c46a46a34fdd98b889eb08e61d641ba4eb56a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0962/1506] mshtml: Reset builtin function props to their default values when deleted. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 63 ++++++++++++++++++++----------- dlls/mshtml/tests/documentmode.js | 42 +++++++++++++++++---- 2 files changed, 77 insertions(+), 28 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 3662113f97c..72e5ee1e4e3 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1739,6 +1739,26 @@ HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, return invoke_builtin_function((IDispatch*)&dispex->IDispatchEx_iface, func, dp, res, ei, caller); } +static VARIANT_BOOL reset_builtin_func(DispatchEx *dispex, func_info_t *func) +{ + func_obj_entry_t *entry; + + if(!dispex->dynamic_data || !dispex->dynamic_data->func_disps || + !dispex->dynamic_data->func_disps[func->func_disp_idx].func_obj) + return VARIANT_FALSE; + + entry = dispex->dynamic_data->func_disps + func->func_disp_idx; + if(V_VT(&entry->val) == VT_DISPATCH && + V_DISPATCH(&entry->val) == (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface) + return VARIANT_FALSE; + + VariantClear(&entry->val); + V_VT(&entry->val) = VT_DISPATCH; + V_DISPATCH(&entry->val) = (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface; + IDispatch_AddRef(V_DISPATCH(&entry->val)); + return VARIANT_TRUE; +} + HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) { switch(get_dispid_type(id)) { @@ -1769,26 +1789,7 @@ HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) /* For builtin functions, we set their value to the original function. */ if(func->func_disp_idx >= 0) { - func_obj_entry_t *entry; - - if(!This->dynamic_data || !This->dynamic_data->func_disps - || !This->dynamic_data->func_disps[func->func_disp_idx].func_obj) { - *success = VARIANT_FALSE; - return S_OK; - } - - entry = This->dynamic_data->func_disps + func->func_disp_idx; - if(V_VT(&entry->val) == VT_DISPATCH - && V_DISPATCH(&entry->val) == (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface) { - *success = VARIANT_FALSE; - return S_OK; - } - - VariantClear(&entry->val); - V_VT(&entry->val) = VT_DISPATCH; - V_DISPATCH(&entry->val) = (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface; - IDispatch_AddRef(V_DISPATCH(&entry->val)); - *success = VARIANT_TRUE; + *success = reset_builtin_func(This, func); return S_OK; } *success = VARIANT_TRUE; @@ -2739,6 +2740,8 @@ HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID l HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) { + HRESULT hres; + if(is_custom_dispid(id) && dispex->info->desc->vtbl->delete) return dispex->info->desc->vtbl->delete(dispex, id); @@ -2747,7 +2750,8 @@ HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) return E_NOTIMPL; } - if(is_dynamic_dispid(id)) { + switch(get_dispid_type(id)) { + case DISPEXPROP_DYNAMIC: { DWORD idx = id - DISPID_DYNPROP_0; dynamic_prop_t *prop; @@ -2759,6 +2763,23 @@ HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) prop->flags |= DYNPROP_DELETED; return S_OK; } + case DISPEXPROP_BUILTIN: { + func_info_t *func; + + if(!ensure_real_info(dispex)) + return E_OUTOFMEMORY; + + hres = get_builtin_func_prot(dispex, id, &func); + if(FAILED(hres)) + return hres; + + if(func->func_disp_idx >= 0) + reset_builtin_func(dispex, func); + return S_OK; + } + default: + break; + } return S_OK; } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index b3f0acce89b..a2640ddcdc5 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1271,7 +1271,7 @@ sync_test("navigator", function() { sync_test("delete_prop", function() { var v = document.documentMode; - var obj = document.createElement("div"), r, obj2; + var obj = document.createElement("div"), r, obj2, func, prop; obj.prop1 = true; r = false; @@ -1287,6 +1287,40 @@ sync_test("delete_prop", function() { ok(!r, "got an unexpected exception"); ok(!("prop1" in obj), "prop1 is still in obj"); + /* builtin properties don't throw any exception, but are not really deleted */ + r = (delete obj.tagName); + ok(r, "delete returned " + r); + ok("tagName" in obj, "tagName deleted from obj"); + ok(obj.tagName === "DIV", "tagName = " + obj.tagName); + + prop = obj.id; + r = (delete obj.id); + ok(r, "delete returned " + r); + ok("id" in obj, "id deleted from obj"); + ok(obj.id === prop, "id = " + obj.id); + + obj.id = "1234"; + ok(obj.id === "1234", "id after set to 1234 = " + obj.id); + r = (delete obj.id); + ok(r, "delete returned " + r); + ok("id" in obj, "id deleted from obj"); + ok(obj.id === "1234", "id = " + obj.id); + + /* builtin functions get reset to their original values */ + func = function() { } + prop = obj.setAttribute; + r = (delete obj.setAttribute); + ok(r, "delete returned " + r); + ok("setAttribute" in obj, "setAttribute deleted from obj"); + ok(obj.setAttribute === prop, "setAttribute = " + obj.setAttribute); + + obj.setAttribute = func; + ok(obj.setAttribute === func, "setAttribute after set to func = " + obj.setAttribute); + r = (delete obj.setAttribute); + ok(r, "delete returned " + r); + ok("setAttribute" in obj, "setAttribute deleted from obj"); + ok(obj.setAttribute === prop, "setAttribute = " + obj.setAttribute); + /* again, this time prop1 does not exist */ r = false; try { @@ -1307,12 +1341,6 @@ sync_test("delete_prop", function() { ok("className" in obj, "className deleted from obj"); ok(obj.className === "", "className = " + obj.className); - /* builtin propertiles don't throw any exception, but are not really deleted */ - r = (delete obj.tagName); - ok(r, "delete returned " + r); - ok("tagName" in obj, "tagName deleted from obj"); - ok(obj.tagName === "DIV", "tagName = " + obj.tagName); - obj = document.querySelectorAll("*"); ok("0" in obj, "0 is not in obj"); obj2 = obj[0]; From d646ddb468635568e49525aa3f8e22d3c91a6e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0963/1506] mshtml: Consolidate the legacy constructors into a common implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They all share the same layout, so move them into a common struct and access them using a table and array, so they can be iterated over. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 30 +++++++++ dlls/mshtml/htmlimg.c | 81 ++++++------------------ dlls/mshtml/htmlselect.c | 81 ++++++------------------ dlls/mshtml/htmlwindow.c | 116 ++++++++++++++++++----------------- dlls/mshtml/mshtml_private.h | 63 +++++++++++-------- dlls/mshtml/xmlhttprequest.c | 81 ++++++------------------ 6 files changed, 182 insertions(+), 270 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 72e5ee1e4e3..5dc326323de 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1868,6 +1868,36 @@ static BOOL ensure_real_info(DispatchEx *dispex) return dispex->info != NULL; } +static inline struct global_ctor *global_ctor_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct global_ctor, dispex); +} + +void global_ctor_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + struct global_ctor *This = global_ctor_from_DispatchEx(dispex); + + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); +} + +void global_ctor_unlink(DispatchEx *dispex) +{ + struct global_ctor *This = global_ctor_from_DispatchEx(dispex); + + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } +} + +void global_ctor_destructor(DispatchEx *dispex) +{ + struct global_ctor *This = global_ctor_from_DispatchEx(dispex); + free(This); +} + static inline struct proxy_prototype *proxy_prototype_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, struct proxy_prototype, dispex); diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index 92006268e01..d61a2f1624b 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -763,41 +763,41 @@ HRESULT HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTML return S_OK; } -static inline HTMLImageElementFactory *impl_from_IHTMLImageElementFactory(IHTMLImageElementFactory *iface) +static inline struct global_ctor *impl_from_IHTMLImageElementFactory(IHTMLImageElementFactory *iface) { - return CONTAINING_RECORD(iface, HTMLImageElementFactory, IHTMLImageElementFactory_iface); + return CONTAINING_RECORD(iface, struct global_ctor, IHTMLImageElementFactory_iface); } static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFactory *iface, REFIID riid, void **ppv) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_QueryInterface(&This->dispex.IDispatchEx_iface, riid, ppv); } static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *iface) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_AddRef(&This->dispex.IDispatchEx_iface); } static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *iface) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_Release(&This->dispex.IDispatchEx_iface); } static HRESULT WINAPI HTMLImageElementFactory_GetTypeInfoCount(IHTMLImageElementFactory *iface, UINT *pctinfo) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLImageElementFactory_GetTypeInfo(IHTMLImageElementFactory *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } @@ -805,7 +805,7 @@ static HRESULT WINAPI HTMLImageElementFactory_GetIDsOfNames(IHTMLImageElementFac REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); } @@ -814,7 +814,7 @@ static HRESULT WINAPI HTMLImageElementFactory_Invoke(IHTMLImageElementFactory *i DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } @@ -846,7 +846,7 @@ static LONG var_to_size(const VARIANT *v) static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *iface, VARIANT width, VARIANT height, IHTMLImgElement **img_elem) { - HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLImageElementFactory(iface); HTMLDocumentNode *doc = This->window->doc; IHTMLImgElement *img; HTMLElement *elem; @@ -889,7 +889,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i return S_OK; } -static const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = { +const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = { HTMLImageElementFactory_QueryInterface, HTMLImageElementFactory_AddRef, HTMLImageElementFactory_Release, @@ -900,14 +900,14 @@ static const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = { HTMLImageElementFactory_create }; -static inline HTMLImageElementFactory *impl_from_DispatchEx(DispatchEx *iface) +static inline struct global_ctor *impl_from_DispatchEx(DispatchEx *iface) { - return CONTAINING_RECORD(iface, HTMLImageElementFactory, dispex); + return CONTAINING_RECORD(iface, struct global_ctor, dispex); } static void *HTMLImageElementFactory_query_interface(DispatchEx *dispex, REFIID riid) { - HTMLImageElementFactory *This = impl_from_DispatchEx(dispex); + struct global_ctor *This = impl_from_DispatchEx(dispex); if(IsEqualGUID(&IID_IHTMLImageElementFactory, riid)) return &This->IHTMLImageElementFactory_iface; @@ -915,36 +915,11 @@ static void *HTMLImageElementFactory_query_interface(DispatchEx *dispex, REFIID return NULL; } -static void HTMLImageElementFactory_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) -{ - HTMLImageElementFactory *This = impl_from_DispatchEx(dispex); - - if(This->window) - note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); -} - -static void HTMLImageElementFactory_unlink(DispatchEx *dispex) -{ - HTMLImageElementFactory *This = impl_from_DispatchEx(dispex); - - if(This->window) { - HTMLInnerWindow *window = This->window; - This->window = NULL; - IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); - } -} - -static void HTMLImageElementFactory_destructor(DispatchEx *dispex) -{ - HTMLImageElementFactory *This = impl_from_DispatchEx(dispex); - free(This); -} - static HRESULT HTMLImageElementFactory_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { - HTMLImageElementFactory *This = impl_from_DispatchEx(dispex); + struct global_ctor *This = impl_from_DispatchEx(dispex); IHTMLImgElement *img; VARIANT empty, *width, *height; HRESULT hres; @@ -975,34 +950,16 @@ static const tid_t HTMLImageElementFactory_iface_tids[] = { static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = { .query_interface = HTMLImageElementFactory_query_interface, - .destructor = HTMLImageElementFactory_destructor, - .traverse = HTMLImageElementFactory_traverse, - .unlink = HTMLImageElementFactory_unlink, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, .value = HTMLImageElementFactory_value, }; -static dispex_static_data_t HTMLImageElementFactory_dispex = { +dispex_static_data_t HTMLImageElementFactory_dispex = { "Function", &HTMLImageElementFactory_dispex_vtbl, PROTO_ID_NULL, IHTMLImageElementFactory_tid, HTMLImageElementFactory_iface_tids }; - -HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElementFactory **ret_val) -{ - HTMLImageElementFactory *ret; - - ret = malloc(sizeof(HTMLImageElementFactory)); - if(!ret) - return E_OUTOFMEMORY; - - ret->IHTMLImageElementFactory_iface.lpVtbl = &HTMLImageElementFactoryVtbl; - ret->window = window; - IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - - init_dispatch(&ret->dispex, &HTMLImageElementFactory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); - - *ret_val = ret; - return S_OK; -} diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 2b42d212896..be5224036af 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -426,40 +426,40 @@ HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H return S_OK; } -static inline HTMLOptionElementFactory *impl_from_IHTMLOptionElementFactory(IHTMLOptionElementFactory *iface) +static inline struct global_ctor *impl_from_IHTMLOptionElementFactory(IHTMLOptionElementFactory *iface) { - return CONTAINING_RECORD(iface, HTMLOptionElementFactory, IHTMLOptionElementFactory_iface); + return CONTAINING_RECORD(iface, struct global_ctor, IHTMLOptionElementFactory_iface); } static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElementFactory *iface, REFIID riid, void **ppv) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_QueryInterface(&This->dispex.IDispatchEx_iface, riid, ppv); } static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_AddRef(&This->dispex.IDispatchEx_iface); } static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_Release(&This->dispex.IDispatchEx_iface); } static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionElementFactory *iface, UINT *pctinfo) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfo(IHTMLOptionElementFactory *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } @@ -467,7 +467,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementF LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); } @@ -475,7 +475,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } @@ -484,7 +484,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected, IHTMLOptionElement **optelem) { - HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); + struct global_ctor *This = impl_from_IHTMLOptionElementFactory(iface); nsIDOMElement *nselem; HTMLDOMNode *node; HRESULT hres; @@ -525,7 +525,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory return S_OK; } -static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = { +const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = { HTMLOptionElementFactory_QueryInterface, HTMLOptionElementFactory_AddRef, HTMLOptionElementFactory_Release, @@ -536,14 +536,14 @@ static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = { HTMLOptionElementFactory_create }; -static inline HTMLOptionElementFactory *HTMLOptionElementFactory_from_DispatchEx(DispatchEx *iface) +static inline struct global_ctor *HTMLOptionElementFactory_from_DispatchEx(DispatchEx *iface) { - return CONTAINING_RECORD(iface, HTMLOptionElementFactory, dispex); + return CONTAINING_RECORD(iface, struct global_ctor, dispex); } static void *HTMLOptionElementFactory_query_interface(DispatchEx *dispex, REFIID riid) { - HTMLOptionElementFactory *This = HTMLOptionElementFactory_from_DispatchEx(dispex); + struct global_ctor *This = HTMLOptionElementFactory_from_DispatchEx(dispex); if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) return &This->IHTMLOptionElementFactory_iface; @@ -551,36 +551,11 @@ static void *HTMLOptionElementFactory_query_interface(DispatchEx *dispex, REFIID return NULL; } -static void HTMLOptionElementFactory_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) -{ - HTMLOptionElementFactory *This = HTMLOptionElementFactory_from_DispatchEx(dispex); - - if(This->window) - note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); -} - -static void HTMLOptionElementFactory_unlink(DispatchEx *dispex) -{ - HTMLOptionElementFactory *This = HTMLOptionElementFactory_from_DispatchEx(dispex); - - if(This->window) { - HTMLInnerWindow *window = This->window; - This->window = NULL; - IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); - } -} - -static void HTMLOptionElementFactory_destructor(DispatchEx *dispex) -{ - HTMLOptionElementFactory *This = HTMLOptionElementFactory_from_DispatchEx(dispex); - free(This); -} - static HRESULT HTMLOptionElementFactory_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { - HTMLOptionElementFactory *This = HTMLOptionElementFactory_from_DispatchEx(dispex); + struct global_ctor *This = HTMLOptionElementFactory_from_DispatchEx(dispex); unsigned int i, argc = params->cArgs - params->cNamedArgs; IHTMLOptionElement *opt; VARIANT empty, *arg[4]; @@ -615,13 +590,13 @@ static const tid_t HTMLOptionElementFactory_iface_tids[] = { static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = { .query_interface = HTMLOptionElementFactory_query_interface, - .destructor = HTMLOptionElementFactory_destructor, - .traverse = HTMLOptionElementFactory_traverse, - .unlink = HTMLOptionElementFactory_unlink, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, .value = HTMLOptionElementFactory_value, }; -static dispex_static_data_t HTMLOptionElementFactory_dispex = { +dispex_static_data_t HTMLOptionElementFactory_dispex = { "Function", &HTMLOptionElementFactory_dispex_vtbl, PROTO_ID_NULL, @@ -629,24 +604,6 @@ static dispex_static_data_t HTMLOptionElementFactory_dispex = { HTMLOptionElementFactory_iface_tids, }; -HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionElementFactory **ret_ptr) -{ - HTMLOptionElementFactory *ret; - - ret = malloc(sizeof(*ret)); - if(!ret) - return E_OUTOFMEMORY; - - ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl; - ret->window = window; - IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - - init_dispatch(&ret->dispex, &HTMLOptionElementFactory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); - - *ret_ptr = ret; - return S_OK; -} - struct HTMLSelectElement { HTMLElement element; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index e7245967425..b352bd5983a 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -149,6 +149,34 @@ static void detach_inner_window(HTMLInnerWindow *window) } } +static HRESULT get_legacy_ctor(HTMLInnerWindow *window, legacy_ctor_id_t ctor_id, dispex_static_data_t *dispex, + const void *vtbl, IDispatch **ret) +{ + struct global_ctor *ctor = window->legacy_ctors[ctor_id]; + + if(!ctor) { + ctor = malloc(sizeof(*ctor)); + if(!ctor) + return E_OUTOFMEMORY; + + ctor->IUnknown_iface.lpVtbl = vtbl; + ctor->window = window; + window->legacy_ctors[ctor_id] = ctor; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + + init_dispatch(&ctor->dispex, dispex, NULL, dispex_compat_mode(&window->event_target.dispex)); + } + + *ret = (IDispatch*)&ctor->dispex.IDispatchEx_iface; + IDispatch_AddRef(*ret); + return S_OK; +} + +static inline struct global_ctor *global_ctor_from_IDispatch(IDispatch *iface) +{ + return CONTAINING_RECORD((IDispatchEx*)iface, struct global_ctor, dispex.IDispatchEx_iface); +} + static inline HTMLWindow *impl_from_IHTMLWindow2(IHTMLWindow2 *iface) { return CONTAINING_RECORD(iface, HTMLWindow, IHTMLWindow2_iface); @@ -736,21 +764,16 @@ static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageEleme { HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLInnerWindow *window = This->inner_window; + IDispatch *disp; + HRESULT hres; TRACE("(%p)->(%p)\n", This, p); - if(!window->image_factory) { - HRESULT hres; - - hres = HTMLImageElementFactory_Create(window, &window->image_factory); - if(FAILED(hres)) - return hres; - } - - *p = &window->image_factory->IHTMLImageElementFactory_iface; - IHTMLImageElementFactory_AddRef(*p); - - return S_OK; + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Image, &HTMLImageElementFactory_dispex, + &HTMLImageElementFactoryVtbl, &disp); + if(SUCCEEDED(hres)) + *p = &global_ctor_from_IDispatch(disp)->IHTMLImageElementFactory_iface; + return hres; } static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p) @@ -1294,21 +1317,16 @@ static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionEle { HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLInnerWindow *window = This->inner_window; + IDispatch *disp; + HRESULT hres; TRACE("(%p)->(%p)\n", This, p); - if(!window->option_factory) { - HRESULT hres; - - hres = HTMLOptionElementFactory_Create(window, &window->option_factory); - if(FAILED(hres)) - return hres; - } - - *p = &window->option_factory->IHTMLOptionElementFactory_iface; - IHTMLOptionElementFactory_AddRef(*p); - - return S_OK; + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Option, &HTMLOptionElementFactory_dispex, + &HTMLOptionElementFactoryVtbl, &disp); + if(SUCCEEDED(hres)) + *p = &global_ctor_from_IDispatch(disp)->IHTMLOptionElementFactory_iface; + return hres; } static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface) @@ -2067,6 +2085,8 @@ static HRESULT WINAPI HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5 *iface, VARIAN { HTMLWindow *This = impl_from_IHTMLWindow5(iface); HTMLInnerWindow *window = This->inner_window; + IDispatch *disp; + HRESULT hres; TRACE("(%p)->(%p)\n", This, p); @@ -2075,20 +2095,13 @@ static HRESULT WINAPI HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5 *iface, VARIAN return S_OK; } - if(!window->xhr_factory) { - HRESULT hres; - - hres = HTMLXMLHttpRequestFactory_Create(window, &window->xhr_factory); - if(FAILED(hres)) { - return hres; - } + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, + &HTMLXMLHttpRequestFactoryVtbl, &disp); + if(SUCCEEDED(hres)) { + V_VT(p) = VT_DISPATCH; + V_DISPATCH(p) = (IDispatch*)&global_ctor_from_IDispatch(disp)->IHTMLXMLHttpRequestFactory_iface; } - - V_VT(p) = VT_DISPATCH; - V_DISPATCH(p) = (IDispatch*)&window->xhr_factory->IHTMLXMLHttpRequestFactory_iface; - IDispatch_AddRef(V_DISPATCH(p)); - - return S_OK; + return hres; } static const IHTMLWindow5Vtbl HTMLWindow5Vtbl = { @@ -4293,12 +4306,9 @@ static void HTMLWindow_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCa note_cc_edge((nsISupports*)&This->doc->node.IHTMLDOMNode_iface, "doc", cb); if(This->console) note_cc_edge((nsISupports*)This->console, "console", cb); - if(This->image_factory) - note_cc_edge((nsISupports*)&This->image_factory->IHTMLImageElementFactory_iface, "image_factory", cb); - if(This->option_factory) - note_cc_edge((nsISupports*)&This->option_factory->IHTMLOptionElementFactory_iface, "option_factory", cb); - if(This->xhr_factory) - note_cc_edge((nsISupports*)&This->xhr_factory->IHTMLXMLHttpRequestFactory_iface, "xhr_factory", cb); + for(i = 0; i < ARRAY_SIZE(This->legacy_ctors); i++) + if(This->legacy_ctors[i]) + note_cc_edge((nsISupports*)&This->legacy_ctors[i]->dispex.IDispatchEx_iface, "legacy_ctor", cb); if(This->mutation_observer_ctor) note_cc_edge((nsISupports*)This->mutation_observer_ctor, "mutation_observer_ctor", cb); if(This->proxy_globals) { @@ -4342,20 +4352,12 @@ static void HTMLWindow_unlink(DispatchEx *dispex) release_event_target(&This->event_target); - if(This->image_factory) { - HTMLImageElementFactory *image_factory = This->image_factory; - This->image_factory = NULL; - IHTMLImageElementFactory_Release(&image_factory->IHTMLImageElementFactory_iface); - } - if(This->option_factory) { - HTMLOptionElementFactory *option_factory = This->option_factory; - This->option_factory = NULL; - IHTMLOptionElementFactory_Release(&option_factory->IHTMLOptionElementFactory_iface); - } - if(This->xhr_factory) { - HTMLXMLHttpRequestFactory *xhr_factory = This->xhr_factory; - This->xhr_factory = NULL; - IHTMLXMLHttpRequestFactory_Release(&xhr_factory->IHTMLXMLHttpRequestFactory_iface); + for(i = 0; i < ARRAY_SIZE(This->legacy_ctors); i++) { + struct global_ctor *ctor = This->legacy_ctors[i]; + if(ctor) { + This->legacy_ctors[i] = NULL; + IDispatchEx_Release(&ctor->dispex.IDispatchEx_iface); + } } unlink_ref(&This->mutation_observer_ctor); if(This->proxy_globals) { diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index d65e8e0bbad..479aade8170 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -508,6 +508,18 @@ PROXY_PROTOTYPE_LIST PROTO_ID_TOTAL_COUNT } prototype_id_t; +typedef enum { +#define X(id, name, dispex, proto_id) LEGACY_CTOR_ID_ ## id, +LEGACY_PROTOTYPE_LIST +COMMON_PROTOTYPE_LIST +#undef X + /* extra ctors that share prototypes */ + LEGACY_CTOR_ID_Image, + LEGACY_CTOR_ID_Option, + + LEGACY_CTOR_COUNT +} legacy_ctor_id_t; + typedef enum { COMPAT_MODE_INVALID = -1, COMPAT_MODE_QUIRKS, @@ -656,6 +668,18 @@ typedef enum { dispex_prop_type_t get_dispid_type(DISPID); +struct global_ctor { + DispatchEx dispex; + union { + IUnknown IUnknown_iface; + IHTMLOptionElementFactory IHTMLOptionElementFactory_iface; + IHTMLImageElementFactory IHTMLImageElementFactory_iface; + IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface; + }; + + HTMLInnerWindow *window; +}; + struct proxy_globals { IDispatch *prototype[PROTO_ID_TOTAL_COUNT - LEGACY_PROTOTYPE_COUNT]; }; @@ -680,27 +704,6 @@ struct EventTarget { struct wine_rb_tree handler_map; }; -typedef struct { - DispatchEx dispex; - IHTMLOptionElementFactory IHTMLOptionElementFactory_iface; - - HTMLInnerWindow *window; -} HTMLOptionElementFactory; - -typedef struct { - DispatchEx dispex; - IHTMLImageElementFactory IHTMLImageElementFactory_iface; - - HTMLInnerWindow *window; -} HTMLImageElementFactory; - -typedef struct { - DispatchEx dispex; - IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface; - - HTMLInnerWindow *window; -} HTMLXMLHttpRequestFactory; - struct HTMLLocation { DispatchEx dispex; IHTMLLocation IHTMLLocation_iface; @@ -780,9 +783,6 @@ struct HTMLInnerWindow { IHTMLEventObj *event; - HTMLImageElementFactory *image_factory; - HTMLOptionElementFactory *option_factory; - HTMLXMLHttpRequestFactory *xhr_factory; IHTMLScreen *screen; OmHistory *history; IOmNavigator *navigator; @@ -829,6 +829,8 @@ struct HTMLInnerWindow { ULONGLONG load_event_start_time; ULONGLONG load_event_end_time; ULONGLONG first_paint_time; + + struct global_ctor *legacy_ctors[LEGACY_CTOR_COUNT]; }; HTMLWindow *unsafe_HTMLWindow_from_IWineDispatchProxyPrivate(IWineDispatchProxyPrivate*); @@ -1186,9 +1188,9 @@ HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,H HRESULT update_window_doc(HTMLInnerWindow*); HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*); void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**); -HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**); -HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**); -HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**); +void global_ctor_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*); +void global_ctor_unlink(DispatchEx*); +void global_ctor_destructor(DispatchEx*); HRESULT create_location(HTMLOuterWindow*,HTMLLocation**); HRESULT create_navigator(HTMLInnerWindow*,IOmNavigator**); HRESULT create_html_screen(HTMLInnerWindow*,IHTMLScreen**); @@ -1704,6 +1706,13 @@ void create_crypto(HTMLInnerWindow *window, IWineMSHTMLCrypto **ret); HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch **ret); HRESULT create_mutation_observer_ctor(HTMLInnerWindow *window, IDispatch **ret); +extern const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl; +extern const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl; +extern const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl; +extern dispex_static_data_t HTMLImageElementFactory_dispex; +extern dispex_static_data_t HTMLOptionElementFactory_dispex; +extern dispex_static_data_t HTMLXMLHttpRequestFactory_dispex; + #define X(id, name, dispex, proto_id) extern dispex_static_data_t dispex; LEGACY_PROTOTYPE_LIST COMMON_PROTOTYPE_LIST diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 7f22a9f05fd..4f00422b6af 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1620,39 +1620,39 @@ dispex_static_data_t HTMLXMLHttpRequest_dispex = { /* IHTMLXMLHttpRequestFactory */ -static inline HTMLXMLHttpRequestFactory *impl_from_IHTMLXMLHttpRequestFactory(IHTMLXMLHttpRequestFactory *iface) +static inline struct global_ctor *impl_from_IHTMLXMLHttpRequestFactory(IHTMLXMLHttpRequestFactory *iface) { - return CONTAINING_RECORD(iface, HTMLXMLHttpRequestFactory, IHTMLXMLHttpRequestFactory_iface); + return CONTAINING_RECORD(iface, struct global_ctor, IHTMLXMLHttpRequestFactory_iface); } static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpRequestFactory *iface, REFIID riid, void **ppv) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_QueryInterface(&This->dispex.IDispatchEx_iface, riid, ppv); } static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory *iface) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_AddRef(&This->dispex.IDispatchEx_iface); } static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory *iface) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_Release(&This->dispex.IDispatchEx_iface); } static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfoCount(IHTMLXMLHttpRequestFactory *iface, UINT *pctinfo) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfo(IHTMLXMLHttpRequestFactory *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } @@ -1660,7 +1660,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfo(IHTMLXMLHttpRequestF static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetIDsOfNames(IHTMLXMLHttpRequestFactory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); @@ -1669,7 +1669,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetIDsOfNames(IHTMLXMLHttpReques static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactory *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); @@ -1677,7 +1677,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactor static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p) { - HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); HTMLXMLHttpRequest *ret; nsIXMLHttpRequest *nsxhr; nsIDOMEventTarget *nstarget; @@ -1743,7 +1743,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor return S_OK; } -static const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = { +const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = { HTMLXMLHttpRequestFactory_QueryInterface, HTMLXMLHttpRequestFactory_AddRef, HTMLXMLHttpRequestFactory_Release, @@ -1754,14 +1754,14 @@ static const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = { HTMLXMLHttpRequestFactory_create }; -static inline HTMLXMLHttpRequestFactory *factory_from_DispatchEx(DispatchEx *iface) +static inline struct global_ctor *ctor_from_DispatchEx(DispatchEx *iface) { - return CONTAINING_RECORD(iface, HTMLXMLHttpRequestFactory, dispex); + return CONTAINING_RECORD(iface, struct global_ctor, dispex); } static void *HTMLXMLHttpRequestFactory_query_interface(DispatchEx *dispex, REFIID riid) { - HTMLXMLHttpRequestFactory *This = factory_from_DispatchEx(dispex); + struct global_ctor *This = ctor_from_DispatchEx(dispex); if(IsEqualGUID(&IID_IHTMLXMLHttpRequestFactory, riid)) return &This->IHTMLXMLHttpRequestFactory_iface; @@ -1769,35 +1769,10 @@ static void *HTMLXMLHttpRequestFactory_query_interface(DispatchEx *dispex, REFII return NULL; } -static void HTMLXMLHttpRequestFactory_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) -{ - HTMLXMLHttpRequestFactory *This = factory_from_DispatchEx(dispex); - - if(This->window) - note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); -} - -static void HTMLXMLHttpRequestFactory_unlink(DispatchEx *dispex) -{ - HTMLXMLHttpRequestFactory *This = factory_from_DispatchEx(dispex); - - if(This->window) { - HTMLInnerWindow *window = This->window; - This->window = NULL; - IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); - } -} - -static void HTMLXMLHttpRequestFactory_destructor(DispatchEx *dispex) -{ - HTMLXMLHttpRequestFactory *This = factory_from_DispatchEx(dispex); - free(This); -} - static HRESULT HTMLXMLHttpRequestFactory_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { - HTMLXMLHttpRequestFactory *This = factory_from_DispatchEx(iface); + struct global_ctor *This = ctor_from_DispatchEx(iface); IHTMLXMLHttpRequest *xhr; HRESULT hres; @@ -1819,9 +1794,9 @@ static HRESULT HTMLXMLHttpRequestFactory_value(DispatchEx *iface, LCID lcid, WOR static const dispex_static_data_vtbl_t HTMLXMLHttpRequestFactory_dispex_vtbl = { .query_interface = HTMLXMLHttpRequestFactory_query_interface, - .destructor = HTMLXMLHttpRequestFactory_destructor, - .traverse = HTMLXMLHttpRequestFactory_traverse, - .unlink = HTMLXMLHttpRequestFactory_unlink, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, .value = HTMLXMLHttpRequestFactory_value }; @@ -1829,28 +1804,10 @@ static const tid_t HTMLXMLHttpRequestFactory_iface_tids[] = { IHTMLXMLHttpRequestFactory_tid, 0 }; -static dispex_static_data_t HTMLXMLHttpRequestFactory_dispex = { +dispex_static_data_t HTMLXMLHttpRequestFactory_dispex = { "Function", &HTMLXMLHttpRequestFactory_dispex_vtbl, PROTO_ID_NULL, IHTMLXMLHttpRequestFactory_tid, HTMLXMLHttpRequestFactory_iface_tids }; - -HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpRequestFactory **ret_ptr) -{ - HTMLXMLHttpRequestFactory *ret; - - ret = malloc(sizeof(*ret)); - if(!ret) - return E_OUTOFMEMORY; - - ret->IHTMLXMLHttpRequestFactory_iface.lpVtbl = &HTMLXMLHttpRequestFactoryVtbl; - ret->window = window; - IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - - init_dispatch(&ret->dispex, &HTMLXMLHttpRequestFactory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); - - *ret_ptr = ret; - return S_OK; -} From dc65d8d1901ffef17bdf929ba6cf39e5aedca943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0964/1506] mshtml: Allow dispex vtbl's value to override builtins. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Returning S_FALSE falls back to normal behavior. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 9 ++++++--- dlls/mshtml/htmlimg.c | 3 +++ dlls/mshtml/htmlselect.c | 6 ++---- dlls/mshtml/xmlhttprequest.c | 6 ++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 5dc326323de..40c8d9dbf73 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -779,9 +779,6 @@ static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS { HRESULT hres; - if(This->info->desc->vtbl->value) - return This->info->desc->vtbl->value(This, lcid, flags, params, res, ei, caller); - switch(flags) { case DISPATCH_PROPERTYGET: V_VT(res) = VT_BSTR; @@ -1663,6 +1660,12 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, IDispatch *this_obj, DISPID IUnknown *iface; HRESULT hres; + if(id == DISPID_VALUE && This->info->desc->vtbl->value) { + hres = This->info->desc->vtbl->value(This, lcid, flags, dp, res, ei, caller); + if(hres != S_FALSE) + return hres; + } + hres = get_builtin_func_prot(This, id, &func); if(id == DISPID_VALUE && hres == DISP_E_MEMBERNOTFOUND) return dispex_value(This, lcid, flags, dp, res, ei, caller); diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index d61a2f1624b..53848f4ea6e 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -925,6 +925,9 @@ static HRESULT HTMLImageElementFactory_value(DispatchEx *dispex, LCID lcid, HRESULT hres; int argc = params->cArgs - params->cNamedArgs; + if(flags != DISPATCH_CONSTRUCT) + return S_FALSE; + V_VT(res) = VT_NULL; V_VT(&empty) = VT_EMPTY; diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index be5224036af..5980dfdf9d8 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -561,10 +561,8 @@ static HRESULT HTMLOptionElementFactory_value(DispatchEx *dispex, LCID lcid, VARIANT empty, *arg[4]; HRESULT hres; - if(flags != DISPATCH_CONSTRUCT) { - FIXME("flags %x not supported\n", flags); - return E_NOTIMPL; - } + if(flags != DISPATCH_CONSTRUCT) + return S_FALSE; V_VT(res) = VT_NULL; V_VT(&empty) = VT_EMPTY; diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 4f00422b6af..89623bf3325 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1778,10 +1778,8 @@ static HRESULT HTMLXMLHttpRequestFactory_value(DispatchEx *iface, LCID lcid, WOR TRACE("\n"); - if(flags != DISPATCH_CONSTRUCT) { - FIXME("flags %x not supported\n", flags); - return E_NOTIMPL; - } + if(flags != DISPATCH_CONSTRUCT) + return S_FALSE; hres = IHTMLXMLHttpRequestFactory_create(&This->IHTMLXMLHttpRequestFactory_iface, &xhr); if(FAILED(hres)) From 41bc4b0279283f3e467462da513d7e96e4b8c769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0965/1506] mshtml: Implement prototypes for constructors in pre-IE9 modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Functions called on the prototypes throw INVALID_PROPERTY, while accessors succeed but always return undefined (and setters do nothing). Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 197 ++++++++++++++++++++++++++++++++++- dlls/mshtml/htmlimg.c | 4 + dlls/mshtml/htmlselect.c | 4 + dlls/mshtml/htmlwindow.c | 27 +++-- dlls/mshtml/mshtml_private.h | 11 ++ dlls/mshtml/xmlhttprequest.c | 6 +- 6 files changed, 238 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 40c8d9dbf73..320c817557f 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -157,6 +157,25 @@ PROXY_PROTOTYPE_LIST #undef X }; +static const char legacy_prototype_name[] = "legacy prototype"; +static void legacy_prototype_init_dispex_info(dispex_data_t*,compat_mode_t); +static const dispex_static_data_vtbl_t legacy_prototype_dispex_vtbl; + +static dispex_static_data_t legacy_prototype_dispex[] = { +#define X(id, name, dispex, proto_id) \ +{ \ + legacy_prototype_name, \ + &legacy_prototype_dispex_vtbl, \ + PROTO_ID_NULL, \ + NULL_tid, \ + no_iface_tids, \ + legacy_prototype_init_dispex_info \ +}, +LEGACY_PROTOTYPE_LIST +COMMON_PROTOTYPE_LIST +#undef X +}; + static inline dispex_data_t *proxy_prototype_object_info(struct proxy_prototype *prot) { dispex_static_data_t *desc = CONTAINING_RECORD(prot->dispex.info->desc, struct prototype_static_data, dispex)->desc; @@ -469,6 +488,32 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc, } } +static void copy_func_info(func_info_t *dst, func_info_t *src) +{ + unsigned i, argc = src->argc; + + *dst = *src; + dst->name = SysAllocString(src->name); + + if(src->arg_types) { + DWORD size = (argc + (src->prop_vt == VT_VOID ? 0 : 1)) * sizeof(*dst->arg_types); + dst->arg_types = malloc(size); + if(dst->arg_types) + memcpy(dst->arg_types, src->arg_types, size); + } + + if(src->arg_info) { + dst->arg_info = malloc(argc * sizeof(*dst->arg_info)); + if(dst->arg_info) { + for(i = 0; i < argc; i++) { + dst->arg_info[i].iid = src->arg_info[i].iid; + V_VT(&dst->arg_info[i].default_value) = VT_EMPTY; + VariantCopy(&dst->arg_info[i].default_value, &src->arg_info[i].default_value); + } + } + } +} + static HRESULT process_interface(dispex_data_t *data, tid_t tid, ITypeInfo *disp_typeinfo, const dispex_hook_t *hooks) { unsigned i = 7; /* skip IDispatch functions */ @@ -1600,6 +1645,8 @@ static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *f } hres = invoke_builtin_function(this_obj, func, dp, res, ei, caller); + if(hres == E_UNEXPECTED && dispex_compat_mode(This) < COMPAT_MODE_IE9) + hres = MSHTML_E_INVALID_PROPERTY; break; case DISPATCH_PROPERTYGET: { func_obj_entry_t *entry; @@ -1676,8 +1723,13 @@ static HRESULT invoke_builtin_prop(DispatchEx *This, IDispatch *this_obj, DISPID return func_invoke(This, this_obj, func, flags, dp, res, ei, caller); hres = IDispatch_QueryInterface(this_obj, tid_ids[func->tid], (void**)&iface); - if(FAILED(hres) || !iface) - return E_UNEXPECTED; + if(FAILED(hres) || !iface) { + if(dispex_compat_mode(This) >= COMPAT_MODE_IE9) + return E_UNEXPECTED; + if(res) + V_VT(res) = VT_EMPTY; + return S_OK; + } if(func->hook && (dispex = get_dispex_for_hook(iface))) { hres = func->hook(dispex, flags, dp, res, ei, caller); @@ -1871,6 +1923,92 @@ static BOOL ensure_real_info(DispatchEx *dispex) return dispex->info != NULL; } +struct legacy_prototype *get_legacy_prototype(HTMLInnerWindow *window, prototype_id_t prot_id, + compat_mode_t compat_mode) +{ + struct legacy_prototype *prot = window->legacy_prototypes[prot_id]; + + if(!prot) { + if(!(prot = malloc(sizeof(*prot)))) + return NULL; + + window->legacy_prototypes[prot_id] = prot; + + init_dispatch(&prot->dispex, &legacy_prototype_dispex[prot_id], NULL, compat_mode); + } + + IDispatchEx_AddRef(&prot->dispex.IDispatchEx_iface); + return prot; +} + +static inline struct legacy_prototype *legacy_prototype_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct legacy_prototype, dispex); +} + +static void legacy_prototype_destructor(DispatchEx *dispex) +{ + struct legacy_prototype *This = legacy_prototype_from_DispatchEx(dispex); + free(This); +} + +static HRESULT legacy_prototype_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: + return MSHTML_E_INVALID_ACTION; + case DISPATCH_PROPERTYGET: + if(!(V_BSTR(res) = SysAllocString(L"[Interface prototype object]"))) + return E_OUTOFMEMORY; + V_VT(res) = VT_BSTR; + break; + case DISPATCH_PROPERTYPUTREF|DISPATCH_PROPERTYPUT: + case DISPATCH_PROPERTYPUTREF: + case DISPATCH_PROPERTYPUT: + break; + default: + return E_INVALIDARG; + } + return S_OK; +} + +static const dispex_static_data_vtbl_t legacy_prototype_dispex_vtbl = { + .destructor = legacy_prototype_destructor, + .value = legacy_prototype_value +}; + +static void legacy_prototype_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode) +{ + prototype_id_t prot_id = info->desc - legacy_prototype_dispex; + dispex_data_t *data = ensure_dispex_info(prototype_static_data[prot_id].desc, compat_mode); + func_info_t *func; + unsigned i; + + if(!data || !data->func_cnt) + return; + + /* Copy the info from the object instance data */ + func = realloc(info->funcs, data->func_size * sizeof(*func)); + if(!func) + return; + info->funcs = func; + info->func_cnt = data->func_cnt; + info->func_disp_cnt = data->func_disp_cnt; + info->func_size = data->func_size; + + for(i = 0; i < data->func_cnt; i++) { + copy_func_info(func, &data->funcs[i]); + func++; + } + memset(func, 0, (info->func_size - i) * sizeof(*func)); +} + static inline struct global_ctor *global_ctor_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, struct global_ctor, dispex); @@ -1901,6 +2039,61 @@ void global_ctor_destructor(DispatchEx *dispex) free(This); } +HRESULT legacy_ctor_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) +{ + if((flags & fdexNameCaseInsensitive) ? !wcsicmp(name, L"prototype") : !wcscmp(name, L"prototype")) { + *dispid = MSHTML_DISPID_CUSTOM_MIN; + return S_OK; + } + return DISP_E_UNKNOWNNAME; +} + +HRESULT legacy_ctor_get_name(DispatchEx *dispex, DISPID id, BSTR *name) +{ + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + + if(idx > 0) + return DISP_E_MEMBERNOTFOUND; + return (*name = SysAllocString(L"prototype")) ? S_OK : E_OUTOFMEMORY; +} + +HRESULT legacy_ctor_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + struct global_ctor *This = CONTAINING_RECORD(dispex, struct global_ctor, dispex); + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + struct legacy_prototype *prot; + + if(idx > 0) + return DISP_E_MEMBERNOTFOUND; + + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + return MSHTML_E_INVALID_PROPERTY; + case DISPATCH_PROPERTYGET: + if(!(prot = get_legacy_prototype(This->window, This->prot_id, dispex_compat_mode(dispex)))) + return E_OUTOFMEMORY; + V_VT(res) = VT_DISPATCH; + V_DISPATCH(res) = (IDispatch*)&prot->dispex.IDispatchEx_iface; + break; + default: + return MSHTML_E_INVALID_PROPERTY; + } + + return S_OK; +} + +HRESULT legacy_ctor_delete(DispatchEx *dispex, DISPID id) +{ + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + return dispex_compat_mode(dispex) < COMPAT_MODE_IE8 ? E_NOTIMPL : + idx > 0 ? S_OK : MSHTML_E_INVALID_PROPERTY; +} + static inline struct proxy_prototype *proxy_prototype_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, struct proxy_prototype, dispex); diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index 53848f4ea6e..c8e29df893b 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -957,6 +957,10 @@ static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = { .traverse = global_ctor_traverse, .unlink = global_ctor_unlink, .value = HTMLImageElementFactory_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete }; dispex_static_data_t HTMLImageElementFactory_dispex = { diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 5980dfdf9d8..e82338d9348 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -592,6 +592,10 @@ static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = { .traverse = global_ctor_traverse, .unlink = global_ctor_unlink, .value = HTMLOptionElementFactory_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete }; dispex_static_data_t HTMLOptionElementFactory_dispex = { diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index b352bd5983a..7b435560d48 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -149,8 +149,8 @@ static void detach_inner_window(HTMLInnerWindow *window) } } -static HRESULT get_legacy_ctor(HTMLInnerWindow *window, legacy_ctor_id_t ctor_id, dispex_static_data_t *dispex, - const void *vtbl, IDispatch **ret) +static HRESULT get_legacy_ctor(HTMLInnerWindow *window, legacy_ctor_id_t ctor_id, prototype_id_t prot_id, + dispex_static_data_t *dispex, const void *vtbl, IDispatch **ret) { struct global_ctor *ctor = window->legacy_ctors[ctor_id]; @@ -160,6 +160,7 @@ static HRESULT get_legacy_ctor(HTMLInnerWindow *window, legacy_ctor_id_t ctor_id return E_OUTOFMEMORY; ctor->IUnknown_iface.lpVtbl = vtbl; + ctor->prot_id = prot_id; ctor->window = window; window->legacy_ctors[ctor_id] = ctor; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); @@ -769,8 +770,8 @@ static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageEleme TRACE("(%p)->(%p)\n", This, p); - hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Image, &HTMLImageElementFactory_dispex, - &HTMLImageElementFactoryVtbl, &disp); + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Image, PROTO_ID_HTMLImgElement, + &HTMLImageElementFactory_dispex, &HTMLImageElementFactoryVtbl, &disp); if(SUCCEEDED(hres)) *p = &global_ctor_from_IDispatch(disp)->IHTMLImageElementFactory_iface; return hres; @@ -1322,8 +1323,8 @@ static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionEle TRACE("(%p)->(%p)\n", This, p); - hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Option, &HTMLOptionElementFactory_dispex, - &HTMLOptionElementFactoryVtbl, &disp); + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Option, PROTO_ID_HTMLOptionElement, + &HTMLOptionElementFactory_dispex, &HTMLOptionElementFactoryVtbl, &disp); if(SUCCEEDED(hres)) *p = &global_ctor_from_IDispatch(disp)->IHTMLOptionElementFactory_iface; return hres; @@ -2095,8 +2096,8 @@ static HRESULT WINAPI HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5 *iface, VARIAN return S_OK; } - hres = get_legacy_ctor(window, LEGACY_CTOR_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, - &HTMLXMLHttpRequestFactoryVtbl, &disp); + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_HTMLXMLHttpRequest, PROTO_ID_HTMLXMLHttpRequest, + &HTMLXMLHttpRequestFactory_dispex, &HTMLXMLHttpRequestFactoryVtbl, &disp); if(SUCCEEDED(hres)) { V_VT(p) = VT_DISPATCH; V_DISPATCH(p) = (IDispatch*)&global_ctor_from_IDispatch(disp)->IHTMLXMLHttpRequestFactory_iface; @@ -4309,6 +4310,9 @@ static void HTMLWindow_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCa for(i = 0; i < ARRAY_SIZE(This->legacy_ctors); i++) if(This->legacy_ctors[i]) note_cc_edge((nsISupports*)&This->legacy_ctors[i]->dispex.IDispatchEx_iface, "legacy_ctor", cb); + for(i = 0; i < ARRAY_SIZE(This->legacy_prototypes); i++) + if(This->legacy_prototypes[i]) + note_cc_edge((nsISupports*)&This->legacy_prototypes[i]->dispex.IDispatchEx_iface, "legacy_prototype", cb); if(This->mutation_observer_ctor) note_cc_edge((nsISupports*)This->mutation_observer_ctor, "mutation_observer_ctor", cb); if(This->proxy_globals) { @@ -4359,6 +4363,13 @@ static void HTMLWindow_unlink(DispatchEx *dispex) IDispatchEx_Release(&ctor->dispex.IDispatchEx_iface); } } + for(i = 0; i < ARRAY_SIZE(This->legacy_prototypes); i++) { + struct legacy_prototype *prot = This->legacy_prototypes[i]; + if(prot) { + This->legacy_prototypes[i] = NULL; + IDispatchEx_Release(&prot->dispex.IDispatchEx_iface); + } + } unlink_ref(&This->mutation_observer_ctor); if(This->proxy_globals) { struct proxy_globals *globals = This->proxy_globals; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 479aade8170..c1c84a9168f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -677,9 +677,14 @@ struct global_ctor { IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface; }; + prototype_id_t prot_id; HTMLInnerWindow *window; }; +struct legacy_prototype { + DispatchEx dispex; +}; + struct proxy_globals { IDispatch *prototype[PROTO_ID_TOTAL_COUNT - LEGACY_PROTOTYPE_COUNT]; }; @@ -831,6 +836,7 @@ struct HTMLInnerWindow { ULONGLONG first_paint_time; struct global_ctor *legacy_ctors[LEGACY_CTOR_COUNT]; + struct legacy_prototype *legacy_prototypes[COMMON_PROTOTYPE_COUNT]; }; HTMLWindow *unsafe_HTMLWindow_from_IWineDispatchProxyPrivate(IWineDispatchProxyPrivate*); @@ -1188,9 +1194,14 @@ HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,H HRESULT update_window_doc(HTMLInnerWindow*); HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*); void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**); +struct legacy_prototype *get_legacy_prototype(HTMLInnerWindow*,prototype_id_t,compat_mode_t); void global_ctor_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*); void global_ctor_unlink(DispatchEx*); void global_ctor_destructor(DispatchEx*); +HRESULT legacy_ctor_get_dispid(DispatchEx*,BSTR,DWORD,DISPID*); +HRESULT legacy_ctor_get_name(DispatchEx*,DISPID,BSTR*); +HRESULT legacy_ctor_invoke(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); +HRESULT legacy_ctor_delete(DispatchEx*,DISPID); HRESULT create_location(HTMLOuterWindow*,HTMLLocation**); HRESULT create_navigator(HTMLInnerWindow*,IOmNavigator**); HRESULT create_html_screen(HTMLInnerWindow*,IHTMLScreen**); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 89623bf3325..9a99e8b4585 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1795,7 +1795,11 @@ static const dispex_static_data_vtbl_t HTMLXMLHttpRequestFactory_dispex_vtbl = { .destructor = global_ctor_destructor, .traverse = global_ctor_traverse, .unlink = global_ctor_unlink, - .value = HTMLXMLHttpRequestFactory_value + .value = HTMLXMLHttpRequestFactory_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete }; static const tid_t HTMLXMLHttpRequestFactory_iface_tids[] = { From 33ab012cf06dc02bcc86d309ddcde283de8e1df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0966/1506] mshtml: Retrieve legacy prototypes and associate them with respective objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces a finalize_dispex in the vtbl, which will also be needed later when documents need to have different dispex data, depending on the compat mode, and need to be set delayed. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 26 +++++++++++++++++++++++++- dlls/mshtml/htmldoc.c | 11 +++++++++++ dlls/mshtml/htmllocation.c | 3 ++- dlls/mshtml/htmlwindow.c | 9 +++++++++ dlls/mshtml/mshtml_private.h | 5 +++++ dlls/mshtml/mutation.c | 15 +++++++++++++++ 6 files changed, 67 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 320c817557f..989a6a89eb0 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1919,7 +1919,7 @@ static BOOL ensure_real_info(DispatchEx *dispex) if(dispex->info != dispex->info->desc->delayed_init_info) return TRUE; - dispex->info = ensure_dispex_info(dispex->info->desc, dispex_compat_mode(dispex)); + dispex->info->desc->vtbl->finalize_dispex(dispex); return dispex->info != NULL; } @@ -3017,6 +3017,9 @@ static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTrave describe_cc_node(&This->ccref, This->info->desc->name, cb); + if(This->prototype) + note_cc_edge((nsISupports*)&This->prototype->dispex.IDispatchEx_iface, "prototype", cb); + if(This->proxy) note_cc_edge((nsISupports*)This->proxy, "proxy", cb); @@ -3047,6 +3050,12 @@ void dispex_props_unlink(DispatchEx *This) { dynamic_prop_t *prop; + if(This->prototype) { + struct legacy_prototype *prototype = This->prototype; + This->prototype = NULL; + IDispatchEx_Release(&prototype->dispex.IDispatchEx_iface); + } + if(This->proxy) { IWineDispatchProxyCbPrivate *proxy = This->proxy; This->proxy = NULL; @@ -3096,6 +3105,9 @@ static void NSAPI dispex_delete_cycle_collectable(void *p) if(This->info->desc->vtbl->unlink) This->info->desc->vtbl->unlink(This); + if(This->prototype) + IDispatchEx_Release(&This->prototype->dispex.IDispatchEx_iface); + if(This->proxy) This->proxy->lpVtbl->Unlinked(This->proxy, FALSE); @@ -3144,12 +3156,22 @@ const void *dispex_get_vtbl(DispatchEx *dispex) return dispex->info->desc->vtbl; } +void finalize_delayed_init_dispex(DispatchEx *This, HTMLInnerWindow *window, dispex_static_data_t *data) +{ + compat_mode_t compat_mode = window->doc->document_mode; + + This->info = ensure_dispex_info(data, compat_mode); + if(!This->proxy && data->prototype_id < ARRAY_SIZE(window->legacy_prototypes)) + This->prototype = get_legacy_prototype(window, data->prototype_id, compat_mode); +} + void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, HTMLInnerWindow *window, compat_mode_t compat_mode) { assert(compat_mode < COMPAT_MODE_CNT); dispex->IDispatchEx_iface.lpVtbl = (const IDispatchExVtbl*)&WineDispatchProxyPrivateVtbl; dispex->proxy = NULL; + dispex->prototype = NULL; dispex->dynamic_data = NULL; ccref_init(&dispex->ccref, 1); @@ -3188,6 +3210,8 @@ void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, HTMLInnerWind if(FAILED(hres)) ERR("InitProxy failed: %08lx\n", hres); } + }else if(data->prototype_id < ARRAY_SIZE(window->legacy_prototypes)) { + dispex->prototype = get_legacy_prototype(window, data->prototype_id, compat_mode); } } } diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 9c85e378286..2dd67df9b69 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6224,6 +6224,16 @@ static compat_mode_t HTMLDocumentNode_get_compat_mode(DispatchEx *dispex) return lock_document_mode(This); } +static void HTMLDocumentNode_finalize_dispex(DispatchEx *dispex) +{ + HTMLDocumentNode *This = impl_from_DispatchEx(dispex); + + lock_document_mode(This); + + /* FIXME: IE9 and IE10 have different dispex data */ + finalize_delayed_init_dispex(dispex, get_inner_window(This), &HTMLDocumentNode_dispex); +} + static nsISupports *HTMLDocumentNode_get_gecko_target(DispatchEx *dispex) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); @@ -6285,6 +6295,7 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { .invoke = HTMLDocumentNode_invoke, .next_dispid = HTMLDocumentNode_next_dispid, .get_compat_mode = HTMLDocumentNode_get_compat_mode, + .finalize_dispex = HTMLDocumentNode_finalize_dispex }, .get_gecko_target = HTMLDocumentNode_get_gecko_target, .bind_event = HTMLDocumentNode_bind_event, diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 7c7b84589fa..4c31a921fd7 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -645,6 +645,7 @@ dispex_static_data_t HTMLLocation_dispex = { HRESULT create_location(HTMLOuterWindow *window, HTMLLocation **ret) { + compat_mode_t compat_mode = dispex_compat_mode(&window->base.inner_window->event_target.dispex); HTMLLocation *location; if(!(location = calloc(1, sizeof(*location)))) @@ -654,7 +655,7 @@ HRESULT create_location(HTMLOuterWindow *window, HTMLLocation **ret) location->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&location->dispex, &HTMLLocation_dispex, window->base.inner_window, COMPAT_MODE_QUIRKS); + init_dispatch(&location->dispex, &HTMLLocation_dispex, window->base.inner_window, min(compat_mode, COMPAT_MODE_IE8)); *ret = location; return S_OK; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 7b435560d48..eef73342c8b 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4572,6 +4572,14 @@ static compat_mode_t HTMLWindow_get_compat_mode(DispatchEx *dispex) return compat_mode; } +static void HTMLWindow_finalize_dispex(DispatchEx *dispex) +{ + HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + + HTMLWindow_get_compat_mode(dispex); + finalize_delayed_init_dispex(dispex, This, &HTMLWindow_dispex); +} + static IDispatch *HTMLWindow_get_dispatch_this(DispatchEx *dispex) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); @@ -4754,6 +4762,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = { .invoke = HTMLWindow_invoke, .next_dispid = HTMLWindow_next_dispid, .get_compat_mode = HTMLWindow_get_compat_mode, + .finalize_dispex = HTMLWindow_finalize_dispex }, .get_dispatch_this = HTMLWindow_get_dispatch_this, .get_gecko_target = HTMLWindow_get_gecko_target, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c1c84a9168f..1317601c769 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -597,6 +597,9 @@ typedef struct { /* Used by objects that want to delay their compat mode initialization until actually needed */ compat_mode_t (*get_compat_mode)(DispatchEx*); + /* Used by objects that have delayed compat mode, and need to be finalized differently depending on the resulting mode */ + void (*finalize_dispex)(DispatchEx*); + /* Used by objects that want to populate some dynamic props on initialization */ HRESULT (*populate_props)(DispatchEx*); } dispex_static_data_vtbl_t; @@ -628,6 +631,7 @@ struct DispatchEx { nsCycleCollectingAutoRefCnt ccref; IWineDispatchProxyCbPrivate *proxy; + struct legacy_prototype *prototype; dispex_data_t *info; dispex_dynamic_data_t *dynamic_data; @@ -642,6 +646,7 @@ extern void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTr void init_proxies(HTMLInnerWindow*); void init_dispatch(DispatchEx*,dispex_static_data_t*,HTMLInnerWindow*,compat_mode_t); +void finalize_delayed_init_dispex(DispatchEx*,HTMLInnerWindow*,dispex_static_data_t*); void dispex_props_unlink(DispatchEx*); HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*); HRESULT dispex_get_builtin_id(DispatchEx*,BSTR,DWORD,DISPID*); diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index d6175847113..d841736c704 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -429,6 +429,17 @@ static void setup_doc_proxy(HTMLDocumentNode *doc) } } +static void update_location_dispex(HTMLDocumentNode *doc) +{ + HTMLOuterWindow *outer_window = doc->window->base.outer_window; + + if(outer_window && outer_window->location) { + if(outer_window->location->dispex.prototype) + IDispatchEx_Release(&outer_window->location->dispex.prototype->dispex.IDispatchEx_iface); + outer_window->location->dispex.prototype = get_legacy_prototype(doc->window, PROTO_ID_HTMLLocation, min(doc->document_mode, COMPAT_MODE_IE8)); + } +} + /* * We may change document mode only in early stage of document lifetime. * Later attempts will not have an effect. @@ -447,6 +458,10 @@ compat_mode_t lock_document_mode(HTMLDocumentNode *doc) methods so we can't rely on the delay init of the dispex to set them up. */ if(doc->document_mode >= COMPAT_MODE_IE9) setup_doc_proxy(doc); + + /* location is special case since it's tied to the outer window */ + if(doc->window) + update_location_dispex(doc); } return doc->document_mode; From 97116d6addc4af2595db77b19615af474f706287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0967/1506] mshtml: Lookup the legacy prototypes props if not available on the object. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native's behavior in these modes tries to emulate jscript's prototypes. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 130 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 107 insertions(+), 23 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 989a6a89eb0..ad33cfe7823 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -90,6 +90,7 @@ struct proxy_prototype { #define DYNPROP_DELETED 0x01 #define DYNPROP_HIDDEN 0x02 +#define DYNPROP_PROTREF 0x04 /* V_VT(var) == VT_EMPTY and V_UI4(var) == the ref */ typedef struct { DispatchEx dispex; @@ -182,6 +183,7 @@ static inline dispex_data_t *proxy_prototype_object_info(struct proxy_prototype return desc->info_cache[prot->dispex.info->compat_mode]; } +static HRESULT get_dynamic_prop(DispatchEx*,const WCHAR*,DWORD,dynamic_prop_t**); static HRESULT invoke_builtin_function(IDispatch*,func_info_t*,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); static inline struct proxy_prototype *to_proxy_prototype(DispatchEx*); @@ -718,6 +720,26 @@ static HRESULT variant_copy(VARIANT *dest, VARIANT *src) return VariantCopy(dest, src); } +static void fixup_prop_ref(DispatchEx *This, dynamic_prop_t *prop) +{ + dynamic_prop_t *prot_prop; + + if(prop->flags & DYNPROP_DELETED) { + if(!This->prototype || + FAILED(get_dynamic_prop(&This->prototype->dispex, prop->name, fdexNameCaseSensitive, &prot_prop))) + return; + if(!(prot_prop->flags & DYNPROP_DELETED)) { + prop->flags = DYNPROP_PROTREF; + V_UI4(&prop->var) = prot_prop - This->prototype->dispex.dynamic_data->props; + } + return; + } + + if((prop->flags & DYNPROP_PROTREF) && + (This->prototype->dispex.dynamic_data->props[V_UI4(&prop->var)].flags & DYNPROP_DELETED)) + prop->flags = DYNPROP_DELETED; +} + static inline dispex_dynamic_data_t *get_dynamic_data(DispatchEx *This) { if(This->dynamic_data) @@ -736,8 +758,8 @@ static inline dispex_dynamic_data_t *get_dynamic_data(DispatchEx *This) static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret) { const BOOL alloc = flags & fdexNameEnsure; + dynamic_prop_t *prop, *prot_prop = NULL; dispex_dynamic_data_t *data; - dynamic_prop_t *prop; data = get_dynamic_data(This); if(!data) @@ -745,6 +767,7 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags for(prop = data->props; prop < data->props+data->prop_cnt; prop++) { if(flags & fdexNameCaseInsensitive ? !wcsicmp(prop->name, name) : !wcscmp(prop->name, name)) { + fixup_prop_ref(This, prop); if(prop->flags & DYNPROP_DELETED) { if(!alloc) return DISP_E_UNKNOWNNAME; @@ -755,7 +778,17 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags } } - if(!alloc) + if(This->prototype) { + HRESULT hres = get_dynamic_prop(&This->prototype->dispex, name, fdexNameCaseSensitive, &prot_prop); + if(hres != DISP_E_UNKNOWNNAME) { + if(FAILED(hres)) + return hres; + if(prot_prop->flags & DYNPROP_DELETED) + prot_prop = NULL; + } + } + + if(!alloc && !prot_prop) return DISP_E_UNKNOWNNAME; TRACE("creating dynamic prop %s\n", debugstr_w(name)); @@ -784,6 +817,10 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags VariantInit(&prop->var); prop->flags = 0; + if(prot_prop) { + prop->flags = DYNPROP_PROTREF; + V_UI4(&prop->var) = prot_prop - This->prototype->dispex.dynamic_data->props; + } data->prop_cnt++; *ret = prop; return S_OK; @@ -800,6 +837,7 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA if(alloc) prop->flags |= DYNPROP_HIDDEN; + prop->flags &= ~DYNPROP_PROTREF; *ret = &prop->var; return S_OK; } @@ -815,6 +853,7 @@ HRESULT dispex_get_dynid(DispatchEx *This, const WCHAR *name, BOOL hidden, DISPI if(hidden) prop->flags |= DYNPROP_HIDDEN; + prop->flags &= ~DYNPROP_PROTREF; *id = DISPID_DYNPROP_0 + (prop - This->dynamic_data->props); return S_OK; } @@ -1260,11 +1299,33 @@ static HRESULT invoke_disp_value(IDispatch *this_obj, IDispatch *func_disp, LCID return hres; } -static HRESULT get_func_obj_entry(DispatchEx *This, func_info_t *func, func_obj_entry_t **ret) +static HRESULT get_func_obj_entry(DispatchEx *This, struct legacy_prototype *prototype, func_info_t *func, + func_obj_entry_t **ret) { dispex_dynamic_data_t *dynamic_data; func_obj_entry_t *entry; + /* Use the prototype's if it's not the default while ours is */ + if(prototype && prototype->dispex.dynamic_data && prototype->dispex.dynamic_data->func_disps && + prototype->dispex.dynamic_data->func_disps[func->func_disp_idx].func_obj) { + func_obj_entry_t *prot_entry = prototype->dispex.dynamic_data->func_disps + func->func_disp_idx; + + if(V_VT(&prot_entry->val) != VT_DISPATCH || + V_DISPATCH(&prot_entry->val) != (IDispatch*)&prot_entry->func_obj->dispex.IDispatchEx_iface) { + entry = NULL; + if(This->dynamic_data && This->dynamic_data->func_disps && + This->dynamic_data->func_disps[func->func_disp_idx].func_obj) { + entry = This->dynamic_data->func_disps + func->func_disp_idx; + + if(V_VT(&entry->val) == VT_DISPATCH && + V_DISPATCH(&entry->val) == (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface) + entry = NULL; + } + *ret = entry ? entry : prot_entry; + return S_OK; + } + } + dynamic_data = get_dynamic_data(This); if(!dynamic_data) return E_OUTOFMEMORY; @@ -1616,6 +1677,7 @@ static HRESULT invoke_builtin_function(IDispatch *this_obj, func_info_t *func, D static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { + func_obj_entry_t *entry; HRESULT hres; switch(flags) { @@ -1624,10 +1686,24 @@ static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *f return E_INVALIDARG; /* fall through */ case DISPATCH_METHOD: - if(This->dynamic_data && This->dynamic_data->func_disps - && This->dynamic_data->func_disps[func->func_disp_idx].func_obj) { - func_obj_entry_t *entry = This->dynamic_data->func_disps + func->func_disp_idx; + entry = NULL; + + if(This->dynamic_data && This->dynamic_data->func_disps && + This->dynamic_data->func_disps[func->func_disp_idx].func_obj) { + entry = This->dynamic_data->func_disps + func->func_disp_idx; + + if(V_VT(&entry->val) == VT_DISPATCH && + V_DISPATCH(&entry->val) == (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface) + entry = NULL; + } + + if(!entry && This->prototype) { + if(This->prototype->dispex.dynamic_data && This->prototype->dispex.dynamic_data->func_disps && + This->prototype->dispex.dynamic_data->func_disps[func->func_disp_idx].func_obj) + entry = This->prototype->dispex.dynamic_data->func_disps + func->func_disp_idx; + } + if(entry) { if(V_VT(&entry->val) != VT_DISPATCH) { FIXME("calling %s not supported\n", debugstr_variant(&entry->val)); return E_NOTIMPL; @@ -1648,9 +1724,7 @@ static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *f if(hres == E_UNEXPECTED && dispex_compat_mode(This) < COMPAT_MODE_IE9) hres = MSHTML_E_INVALID_PROPERTY; break; - case DISPATCH_PROPERTYGET: { - func_obj_entry_t *entry; - + case DISPATCH_PROPERTYGET: if(func->id == DISPID_VALUE) { BSTR ret; @@ -1663,16 +1737,13 @@ static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *f return S_OK; } - hres = get_func_obj_entry(This, func, &entry); + hres = get_func_obj_entry(This, This->prototype, func, &entry); if(FAILED(hres)) return hres; V_VT(res) = VT_EMPTY; return VariantCopy(res, &entry->val); - } - case DISPATCH_PROPERTYPUT: { - func_obj_entry_t *entry; - + case DISPATCH_PROPERTYPUT: if(dp->cArgs != 1 || (dp->cNamedArgs == 1 && *dp->rgdispidNamedArgs != DISPID_PROPERTYPUT) || dp->cNamedArgs > 1) { FIXME("invalid args\n"); @@ -1685,12 +1756,11 @@ static HRESULT func_invoke(DispatchEx *This, IDispatch *this_obj, func_info_t *f * Native probably uses some undocumented interface in this case, but it should * be fine for us to allow IDispatchEx handle that. */ - hres = get_func_obj_entry(This, func, &entry); + hres = get_func_obj_entry(This, NULL, func, &entry); if(FAILED(hres)) return hres; return VariantCopy(&entry->val, dp->rgvarg); - } default: FIXME("Unimplemented flags %x\n", flags); hres = E_NOTIMPL; @@ -1826,8 +1896,10 @@ HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success) dynamic_prop_t *prop; prop = This->dynamic_data->props+idx; - VariantClear(&prop->var); - prop->flags |= DYNPROP_DELETED; + if(!(prop->flags & DYNPROP_PROTREF)) { + VariantClear(&prop->var); + prop->flags |= DYNPROP_DELETED; + } *success = VARIANT_TRUE; return S_OK; } @@ -2536,8 +2608,9 @@ static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BS static HRESULT next_dynamic_id(DispatchEx *dispex, DWORD idx, DISPID *ret_id) { + /* FIXME: Go through PROTREFs? (must exclude props with same name as builtins) */ while(idx < dispex->dynamic_data->prop_cnt && - (dispex->dynamic_data->props[idx].flags & (DYNPROP_DELETED | DYNPROP_HIDDEN))) + (dispex->dynamic_data->props[idx].flags & (DYNPROP_DELETED | DYNPROP_HIDDEN | DYNPROP_PROTREF))) idx++; if(idx == dispex->dynamic_data->prop_cnt) { @@ -2832,7 +2905,7 @@ static HRESULT WINAPI WineDispatchProxyPrivate_PropEnum(IWineDispatchProxyPrivat return E_OUTOFMEMORY; for(dyn_prop = dyn_data->props, dyn_prop_end = dyn_prop + dyn_data->prop_cnt; dyn_prop != dyn_prop_end; dyn_prop++) { - if(!(dyn_prop->flags & (DYNPROP_DELETED | DYNPROP_HIDDEN))) { + if(!(dyn_prop->flags & (DYNPROP_DELETED | DYNPROP_HIDDEN | DYNPROP_PROTREF))) { hres = callback(obj, dyn_prop->name); if(FAILED(hres)) return hres; @@ -2913,6 +2986,12 @@ HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID l return E_INVALIDARG; /* fall through */ case DISPATCH_METHOD: + fixup_prop_ref(dispex, prop); + if(prop->flags & DYNPROP_DELETED) + return DISP_E_MEMBERNOTFOUND; + if(prop->flags & DYNPROP_PROTREF) + prop = &dispex->prototype->dispex.dynamic_data->props[V_UI4(&prop->var)]; + if(V_VT(&prop->var) != VT_DISPATCH) { FIXME("invoke %s\n", debugstr_variant(&prop->var)); return E_NOTIMPL; @@ -2920,8 +2999,11 @@ HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID l return invoke_disp_value(this_obj, V_DISPATCH(&prop->var), lcid, wFlags, pdp, res, pei, caller); case DISPATCH_PROPERTYGET: + fixup_prop_ref(dispex, prop); if(prop->flags & DYNPROP_DELETED) return DISP_E_MEMBERNOTFOUND; + if(prop->flags & DYNPROP_PROTREF) + prop = &dispex->prototype->dispex.dynamic_data->props[V_UI4(&prop->var)]; V_VT(res) = VT_EMPTY; return variant_copy(res, &prop->var); case DISPATCH_PROPERTYPUT: @@ -2937,7 +3019,7 @@ HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID l if(FAILED(hres)) return hres; - prop->flags &= ~DYNPROP_DELETED; + prop->flags &= ~(DYNPROP_DELETED | DYNPROP_PROTREF); return S_OK; default: FIXME("unhandled wFlags %x\n", wFlags); @@ -2985,8 +3067,10 @@ HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) return S_OK; prop = dispex->dynamic_data->props + idx; - VariantClear(&prop->var); - prop->flags |= DYNPROP_DELETED; + if(!(prop->flags & DYNPROP_PROTREF)) { + VariantClear(&prop->var); + prop->flags |= DYNPROP_DELETED; + } return S_OK; } case DISPEXPROP_BUILTIN: { From 7a4da188fd7e2d82918b0c605816621aa8da572a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:26 +0200 Subject: [PATCH 0968/1506] mshtml: Implement constructors for builtin object proxies. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 151 ++++++++++++++++++- dlls/jscript/function.c | 203 +++++++++++++++++++++++++ dlls/jscript/jscript.c | 5 - dlls/jscript/jscript.h | 5 +- dlls/mshtml/dispex.c | 216 +++++++++++++++++++++++++++ dlls/mshtml/htmldoc.c | 7 + dlls/mshtml/htmlwindow.c | 46 +++--- dlls/mshtml/mshtml_private.h | 7 +- dlls/mshtml/mshtml_private_iface.idl | 3 - dlls/mshtml/mutation.c | 72 ++------- 10 files changed, 617 insertions(+), 98 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index cbdb1d5da97..98968f9f457 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2468,7 +2468,7 @@ static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown } /* ECMA-262 5.1 Edition 15.1 */ -HRESULT set_js_globals(jsdisp_t *obj) +static HRESULT set_js_globals(jsdisp_t *obj) { jsdisp_t *js_global = obj->ctx->js_global; const builtin_prop_t *bprop, *bend; @@ -2547,6 +2547,58 @@ static HRESULT get_proxy_default_prototype(script_ctx_t *ctx, IWineDispatchProxy return S_OK; } +static HRESULT get_proxy_default_constructor(script_ctx_t *ctx, jsdisp_t *jsdisp, jsdisp_t **ctor) +{ + jsdisp_t *old_global = ctx->global; + IDispatch *disp; + HRESULT hres; + jsval_t tmp; + + /* This may end up in CreateConstructor from a nested GetDefaultConstructor via some + * prototype's setup, if we're actually calling it on the window, which would define + * all of the constructors, and that assumes the global to be the one required. But + * in this case we haven't even finished setting up the window, so set it temporarily. */ + ctx->global = jsdisp; + hres = jsdisp->proxy->lpVtbl->GetDefaultConstructor(jsdisp->proxy, old_global->proxy, &disp); + ctx->global = old_global; + if(FAILED(hres)) + return hres; + + if(!disp) { + /* Set the globals on it if we're the window itself (not the prototype). + * We also have to set the props on the constructor and prototype, because + * we had to skip them earlier, since our window was *not* set up yet... */ + if(hres == S_FALSE) { + hres = set_js_globals(jsdisp); + if(SUCCEEDED(hres)) { + dispex_prop_t *ctor_prop = find_prop_name_raw(jsdisp, string_hash(L"Window"), L"Window", FALSE); + jsdisp_t *ctor_obj; + + if(ctor_prop && ctor_prop->type == PROP_JSVAL && is_object_instance(ctor_prop->u.val) && + (ctor_obj = to_jsdisp(get_object(ctor_prop->u.val)))) + { + hres = jsdisp_define_data_property(ctor_obj, L"prototype", 0, jsval_obj(jsdisp->prototype)); + if(SUCCEEDED(hres)) + hres = jsdisp_define_data_property(jsdisp->prototype, L"constructor", PROPF_WRITABLE | PROPF_CONFIGURABLE, jsval_obj(ctor_obj)); + } + } + } + *ctor = NULL; + return hres; + } + + tmp = jsval_disp(disp); + hres = convert_to_proxy(ctx, &tmp); + if(FAILED(hres)) + return hres; + *ctor = as_jsdisp(get_object(tmp)); + + hres = jsdisp_define_data_property(*ctor, L"prototype", 0, jsval_obj(jsdisp)); + if(FAILED(hres)) + jsdisp_release(*ctor); + return hres; +} + static inline jsdisp_t *impl_from_IWineDispatchProxyCbPrivate(IWineDispatchProxyCbPrivate *iface) { return impl_from_IDispatchEx((IDispatchEx*)iface); @@ -2593,7 +2645,7 @@ static HRESULT WINAPI WineDispatchProxyCbPrivate_HostUpdated(IWineDispatchProxyC jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); script_ctx_t *ctx = get_script_ctx(script); dispex_prop_t *prop, *end; - jsdisp_t *prot; + jsdisp_t *prot, *ctor; HRESULT hres; BOOL b; @@ -2643,7 +2695,84 @@ static HRESULT WINAPI WineDispatchProxyCbPrivate_HostUpdated(IWineDispatchProxyC alloc_proxy_prop(This, &info, &prop); } - return S_OK; + /* Populate the constructors on the window */ + hres = get_proxy_default_constructor(ctx, This, &ctor); + assert(FAILED(hres) || ctor == NULL); + return hres; +} + +static IDispatch* WINAPI WineDispatchProxyCbPrivate_CreateConstructor(IWineDispatchProxyCbPrivate *iface, + IDispatch *disp, const char *name) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + jsdisp_t *ctor; + HRESULT hres; + + hres = create_proxy_constructor(disp, name, This, &ctor); + return SUCCEEDED(hres) ? (IDispatch*)&ctor->IDispatchEx_iface : NULL; +} + +static HRESULT WINAPI WineDispatchProxyCbPrivate_DefineConstructor(IWineDispatchProxyCbPrivate *iface, + const char *name, IDispatch *prot_disp, IDispatch *ctor_disp) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + jsval_t val = jsval_disp(prot_disp); + jsdisp_t *prot, *ctor; + unsigned i = 0, hash; + dispex_prop_t *prop; + WCHAR nameW[64]; + HRESULT hres; + BOOL b; + + do nameW[i] = name[i]; while(name[i++]); + assert(i <= ARRAY_SIZE(nameW)); + + hres = convert_to_proxy(This->ctx, &val); + if(FAILED(hres)) + return hres; + prot = as_jsdisp(get_object(val)); + + if(ctor_disp) + hres = create_proxy_constructor(ctor_disp, name, prot, &ctor); + else { + /* The prototype's proxy should have already set up the constructor, so this can't fail */ + IDispatch *tmp_disp; + prot->proxy->lpVtbl->GetDefaultConstructor(prot->proxy, This->proxy, &tmp_disp); + val = jsval_disp(tmp_disp); + convert_to_proxy(This->ctx, &val); + ctor = as_jsdisp(get_object(val)); + } + jsdisp_release(prot); + if(FAILED(hres)) + return hres; + + /* Remove the builtin proxy prop from the prototype (first time only), since it's part of the object itself */ + hash = string_hash(nameW); + if(!find_prop_name_raw(This->prototype, hash, nameW, FALSE) && !alloc_prop(This->prototype, nameW, PROP_DELETED, 0)) { + hres = E_OUTOFMEMORY; + goto end; + } + + /* Define the constructor forcefully, so make sure to not look into the underlying proxy dispids, + otherwise it might pick up elements by this id. And if any found, force it to be configurable. */ + prop = find_prop_name_raw(This, hash, nameW, FALSE); + if(prop) { + prop->flags |= PROPF_CONFIGURABLE; + delete_prop(This, prop, &b); + }else if(!(prop = alloc_prop(This, nameW, PROP_DELETED, 0))) { + hres = E_OUTOFMEMORY; + goto end; + } + + hres = jsval_copy(jsval_obj(ctor), &prop->u.val); + if(FAILED(hres)) + goto end; + prop->type = PROP_JSVAL; + prop->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE; + +end: + jsdisp_release(ctor); + return hres; } static HRESULT WINAPI WineDispatchProxyCbPrivate_PropEnum(IWineDispatchProxyCbPrivate *iface, const WCHAR *name) @@ -2677,6 +2806,8 @@ static IWineDispatchProxyCbPrivateVtbl WineDispatchProxyCbPrivateVtbl = { WineDispatchProxyCbPrivate_InitProxy, WineDispatchProxyCbPrivate_Unlinked, WineDispatchProxyCbPrivate_HostUpdated, + WineDispatchProxyCbPrivate_CreateConstructor, + WineDispatchProxyCbPrivate_DefineConstructor, WineDispatchProxyCbPrivate_PropEnum }; @@ -2766,7 +2897,7 @@ HRESULT convert_to_proxy(script_ctx_t *ctx, jsval_t *val) { IWineDispatchProxyCbPrivate **proxy_ref; IWineDispatchProxyPrivate *proxy; - jsdisp_t *jsdisp, *prot; + jsdisp_t *jsdisp, *prot, *ctor; IDispatch *obj; HRESULT hres; @@ -2805,6 +2936,18 @@ HRESULT convert_to_proxy(script_ctx_t *ctx, jsval_t *val) *proxy_ref = (IWineDispatchProxyCbPrivate*)&jsdisp->IDispatchEx_iface; jsdisp->proxy = proxy; + hres = get_proxy_default_constructor(ctx, jsdisp, &ctor); + if(SUCCEEDED(hres) && ctor) { + hres = jsdisp_define_data_property(jsdisp, L"constructor", PROPF_WRITABLE | PROPF_CONFIGURABLE, jsval_obj(ctor)); + jsdisp_release(ctor); + } + if(FAILED(hres)) { + *proxy_ref = NULL; + jsdisp->proxy = NULL; + jsdisp_release(jsdisp); + goto fail; + } + *val = jsval_obj(jsdisp); return S_OK; } diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index f474e528dee..8c770602933 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -17,6 +17,7 @@ */ #include +#include #include "jscript.h" #include "engine.h" @@ -62,6 +63,17 @@ typedef struct { const WCHAR *name; } ProxyFunction; +typedef struct { + FunctionInstance function; + IDispatch *disp; + const char *name; +} ProxyConstructor; + +typedef struct { + FunctionInstance function; + ProxyConstructor *ctor; +} ProxyConstructorCreate; + typedef struct { FunctionInstance function; FunctionInstance *target; @@ -934,6 +946,197 @@ HRESULT create_proxy_functions(jsdisp_t *jsdisp, const struct proxy_prop_info *i return S_OK; } +static HRESULT ProxyConstructor_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) +{ + ProxyConstructor *constructor = (ProxyConstructor*)func; + + return disp_call_value_with_caller(ctx, constructor->disp, jsval_undefined(), flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, + argc, argv, r, caller); +} + +static HRESULT ProxyConstructor_toString(FunctionInstance *func, jsstr_t **ret) +{ + ProxyConstructor *constructor = (ProxyConstructor*)func; + WCHAR nameW[64]; + unsigned i = 0; + + do nameW[i] = constructor->name[i]; while(constructor->name[i++]); + assert(i <= ARRAY_SIZE(nameW)); + + return native_code_toString(nameW, ret); +} + +static function_code_t *ProxyConstructor_get_code(FunctionInstance *func) +{ + return NULL; +} + +static void ProxyConstructor_destructor(FunctionInstance *func) +{ + ProxyConstructor *constructor = (ProxyConstructor*)func; + if(constructor->disp) + IDispatch_Release(constructor->disp); +} + +static HRESULT ProxyConstructor_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, FunctionInstance *func) +{ + ProxyConstructor *constructor = (ProxyConstructor*)func; + + if(op == GC_TRAVERSE_UNLINK) { + IDispatch *disp = constructor->disp; + if(disp) { + constructor->disp = NULL; + IDispatch_Release(disp); + } + } + + return S_OK; +} + +static void ProxyConstructor_cc_traverse(FunctionInstance *func, nsCycleCollectionTraversalCallback *cb) +{ + ProxyConstructor *constructor = (ProxyConstructor*)func; + if(constructor->disp) + cc_api.note_edge((nsISupports*)constructor->disp, "disp", cb); +} + +static const function_vtbl_t ProxyConstructorVtbl = { + ProxyConstructor_call, + ProxyConstructor_toString, + ProxyConstructor_get_code, + ProxyConstructor_destructor, + ProxyConstructor_gc_traverse, + ProxyConstructor_cc_traverse +}; + +static const builtin_prop_t ProxyConstructor_props[] = { + {L"arguments", NULL, 0, Function_get_arguments} +}; + +static const builtin_info_t ProxyConstructor_info = { + JSCLASS_FUNCTION, + Function_value, + ARRAY_SIZE(ProxyConstructor_props), + ProxyConstructor_props, + Function_destructor, + NULL, + NULL, + NULL, + NULL, + Function_gc_traverse, + Function_cc_traverse +}; + +static HRESULT ProxyConstructorCreate_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r, IServiceProvider *caller) +{ + ProxyConstructorCreate *create = (ProxyConstructorCreate*)func; + + /* only allow calls since it's a method */ + if(!(flags & DISPATCH_METHOD)) + return E_UNEXPECTED; + + return disp_call_value_with_caller(ctx, create->ctor->disp, jsval_undefined(), flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, + argc, argv, r, caller); +} + +static HRESULT ProxyConstructorCreate_toString(FunctionInstance *func, jsstr_t **ret) +{ + return native_code_toString(L"create", ret); +} + +static function_code_t *ProxyConstructorCreate_get_code(FunctionInstance *func) +{ + return NULL; +} + +static void ProxyConstructorCreate_destructor(FunctionInstance *func) +{ + ProxyConstructorCreate *create = (ProxyConstructorCreate*)func; + if(create->ctor) + jsdisp_release(&create->ctor->function.dispex); +} + +static HRESULT ProxyConstructorCreate_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, FunctionInstance *func) +{ + ProxyConstructorCreate *create = (ProxyConstructorCreate*)func; + return gc_process_linked_obj(gc_ctx, op, &create->function.dispex, &create->ctor->function.dispex, (void**)&create->ctor); +} + +static void ProxyConstructorCreate_cc_traverse(FunctionInstance *func, nsCycleCollectionTraversalCallback *cb) +{ + ProxyConstructorCreate *create = (ProxyConstructorCreate*)func; + if(create->ctor) + cc_api.note_edge((nsISupports*)&create->ctor->function.dispex.IDispatchEx_iface, "ctor", cb); +} + +static const function_vtbl_t ProxyConstructorCreateVtbl = { + ProxyConstructorCreate_call, + ProxyConstructorCreate_toString, + ProxyConstructorCreate_get_code, + ProxyConstructorCreate_destructor, + ProxyConstructorCreate_gc_traverse, + ProxyConstructorCreate_cc_traverse +}; + +static const builtin_info_t ProxyConstructorCreate_info = { + JSCLASS_FUNCTION, + Function_value, + ARRAY_SIZE(ProxyConstructor_props), + ProxyConstructor_props, + Function_destructor, + NULL, + NULL, + NULL, + NULL, + Function_gc_traverse, + Function_cc_traverse +}; + +HRESULT create_proxy_constructor(IDispatch *disp, const char *name, jsdisp_t *prototype, jsdisp_t **ret) +{ + script_ctx_t *ctx = prototype->ctx; + ProxyConstructor *constructor; + HRESULT hres; + + /* create wrapper constructor function over the disp's value */ + hres = create_function(ctx, &ProxyConstructor_info, &ProxyConstructorVtbl, sizeof(ProxyConstructor), + PROPF_CONSTR, FALSE, NULL, (void**)&constructor); + if(FAILED(hres)) + return hres; + + IDispatch_AddRef(disp); + constructor->disp = disp; + constructor->name = name; + + hres = jsdisp_define_data_property(&constructor->function.dispex, L"prototype", 0, jsval_obj(prototype)); + + /* XMLHttpRequest and XDomainRequest constructors have a "create" method */ + if(SUCCEEDED(hres) && name[0] == 'X') { + ProxyConstructorCreate *create; + + hres = create_function(ctx, &ProxyConstructorCreate_info, &ProxyConstructorCreateVtbl, sizeof(ProxyConstructorCreate), + PROPF_METHOD, FALSE, NULL, (void**)&create); + if(SUCCEEDED(hres)) { + create->ctor = constructor; + jsdisp_addref(&constructor->function.dispex); + + hres = jsdisp_define_data_property(&create->function.dispex, L"prototype", 0, jsval_null()); + if(SUCCEEDED(hres)) + hres = jsdisp_define_data_property(&constructor->function.dispex, L"create", 0, jsval_obj(&create->function.dispex)); + jsdisp_release(&create->function.dispex); + } + } + if(FAILED(hres)) { + jsdisp_release(&constructor->function.dispex); + return hres; + } + + *ret = &constructor->function.dispex; + return S_OK; +} + /* * Create the actual prototype on demand, since it is a circular ref, which prevents the vast * majority of functions from being released quickly, leading to unnecessary scope detach. diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index ba839fa1cc9..2200629930e 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -936,11 +936,6 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, disp = get_object(val); if((jsdisp = to_jsdisp(disp)) && jsdisp->proxy) { - hres = set_js_globals(jsdisp); - if(FAILED(hres)) { - jsdisp_release(jsdisp); - return hres; - } jsdisp_release(This->ctx->global); This->ctx->global = jsdisp_addref(jsdisp); } diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index b97402c2530..0c9b95b381b 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -105,6 +105,7 @@ typedef struct { IDispatchExVtbl dispex; IWineDispatchProxyCbPrivate** (STDMETHODCALLTYPE *GetProxyFieldRef)(IWineDispatchProxyPrivate *This); IDispatch* (STDMETHODCALLTYPE *GetDefaultPrototype)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window); + HRESULT (STDMETHODCALLTYPE *GetDefaultConstructor)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window, IDispatch **ret); HRESULT (STDMETHODCALLTYPE *PropFixOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); HRESULT (STDMETHODCALLTYPE *PropOverride)(IWineDispatchProxyPrivate *This, const WCHAR *name, VARIANT *value); HRESULT (STDMETHODCALLTYPE *PropDefineOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); @@ -122,6 +123,8 @@ typedef struct { HRESULT (STDMETHODCALLTYPE *InitProxy)(IWineDispatchProxyCbPrivate *This, IDispatch *obj); void (STDMETHODCALLTYPE *Unlinked)(IWineDispatchProxyCbPrivate *This, BOOL persist); HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); + IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); + HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; @@ -370,7 +373,6 @@ HRESULT create_dispex(script_ctx_t*,const builtin_info_t*,jsdisp_t*,jsdisp_t**); HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); HRESULT convert_to_proxy(script_ctx_t*,jsval_t*); -HRESULT set_js_globals(jsdisp_t*); void init_cc_api(IDispatch*); void disp_fill_exception(script_ctx_t*,EXCEPINFO*); @@ -408,6 +410,7 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons HRESULT create_builtin_constructor(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD, jsdisp_t*,jsdisp_t**); HRESULT create_proxy_functions(jsdisp_t*,const struct proxy_prop_info*,jsdisp_t**); +HRESULT create_proxy_constructor(IDispatch*,const char*,jsdisp_t*,jsdisp_t**); HRESULT Function_invoke(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*,IServiceProvider*); HRESULT Function_value(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index ad33cfe7823..63371409ced 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -23,6 +23,7 @@ #include "winbase.h" #include "winuser.h" #include "ole2.h" +#include "mshtmdid.h" #include "mscoree.h" #include "wine/debug.h" @@ -88,6 +89,10 @@ struct proxy_prototype { DispatchEx dispex; }; +struct proxy_ctor { + DispatchEx dispex; +}; + #define DYNPROP_DELETED 0x01 #define DYNPROP_HIDDEN 0x02 #define DYNPROP_PROTREF 0x04 /* V_VT(var) == VT_EMPTY and V_UI4(var) == the ref */ @@ -177,6 +182,37 @@ COMMON_PROTOTYPE_LIST #undef X }; +static const dispex_static_data_vtbl_t proxy_ctor_dispex_vtbl; + +static dispex_static_data_t proxy_ctor_dispex[] = { +#define X(id, name, dispex, proto_id) \ +{ \ + name, \ + &proxy_ctor_dispex_vtbl, \ + PROTO_ID_Object, \ + NULL_tid, \ + no_iface_tids \ +}, +COMMON_PROTOTYPE_LIST +PROXY_PROTOTYPE_LIST +#undef X +}; + +static unsigned char proxy_ctor_mode_unavailable[PROTO_ID_TOTAL_COUNT - LEGACY_PROTOTYPE_COUNT] = { + [PROTO_ID_Console - LEGACY_PROTOTYPE_COUNT] = (1<dispex.info->desc, struct prototype_static_data, dispex)->desc; @@ -2240,6 +2276,126 @@ static IDispatch *get_default_prototype(prototype_id_t prot_id, compat_mode_t co return *entry; } +static IDispatch *get_proxy_constructor_disp(HTMLInnerWindow *window, prototype_id_t prot_id) +{ + static const struct { + prototype_id_t prot_id; + dispex_static_data_t *dispex; + const void *vtbl; + } ctors[] = { + { PROTO_ID_MutationObserver, &mutation_observer_ctor_dispex }, + { PROTO_ID_HTMLImgElement, &HTMLImageElementFactory_dispex, &HTMLImageElementFactoryVtbl }, + { PROTO_ID_HTMLOptionElement, &HTMLOptionElementFactory_dispex, &HTMLOptionElementFactoryVtbl }, + { PROTO_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, &HTMLXMLHttpRequestFactoryVtbl } + }; + struct global_ctor *ctor; + unsigned i; + + for(i = 0; i < ARRAY_SIZE(ctors); i++) + if(ctors[i].prot_id == prot_id) + break; + assert(i < ARRAY_SIZE(ctors)); + + if(!(ctor = malloc(sizeof(*ctor)))) + return NULL; + + ctor->IUnknown_iface.lpVtbl = ctors[i].vtbl; + ctor->prot_id = prot_id; + ctor->window = window; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + + init_dispatch(&ctor->dispex, ctors[i].dispex, NULL, dispex_compat_mode(&window->event_target.dispex)); + + return (IDispatch*)&ctor->dispex.IDispatchEx_iface; +} + +HRESULT define_global_constructors(HTMLInnerWindow *window) +{ + static const struct { + const char *name; + prototype_id_t proto_id; + } extra_ctors[] = { + { "Image", PROTO_ID_HTMLImgElement }, + { "Option", PROTO_ID_HTMLOptionElement }, + }; + compat_mode_t compat_mode; + IDispatch *prot, *ctor; + unsigned int i; + HRESULT hres; + + if(!ensure_real_info(&window->event_target.dispex)) + return E_OUTOFMEMORY; + compat_mode = dispex_compat_mode(&window->event_target.dispex); + + for(i = 0; i < ARRAY_SIZE(proxy_ctor_dispex); i++) { + if(proxy_ctor_mode_unavailable[i] & (1 << compat_mode)) + continue; + + if(!(prot = get_default_prototype(i + LEGACY_PROTOTYPE_COUNT, compat_mode, window))) + return E_OUTOFMEMORY; + + hres = window->event_target.dispex.proxy->lpVtbl->DefineConstructor(window->event_target.dispex.proxy, proxy_ctor_dispex[i].name, prot, NULL); + if(FAILED(hres)) + return hres; + } + + for(i = 0; i < ARRAY_SIZE(extra_ctors); i++) { + if(!(ctor = get_proxy_constructor_disp(window, extra_ctors[i].proto_id))) + return E_OUTOFMEMORY; + + if(!(prot = get_default_prototype(extra_ctors[i].proto_id, compat_mode, window))) + hres = E_OUTOFMEMORY; + else + hres = window->event_target.dispex.proxy->lpVtbl->DefineConstructor(window->event_target.dispex.proxy, extra_ctors[i].name, prot, ctor); + + IDispatch_Release(ctor); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + +static inline struct proxy_ctor *proxy_ctor_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct proxy_ctor, dispex); +} + +static void proxy_ctor_destructor(DispatchEx *dispex) +{ + struct proxy_ctor *This = proxy_ctor_from_DispatchEx(dispex); + free(This); +} + +static HRESULT proxy_ctor_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: + return MSHTML_E_INVALID_ACTION; + case DISPATCH_PROPERTYGET: + V_VT(res) = VT_BSTR; + return dispex_to_string(dispex, &V_BSTR(res)); + case DISPATCH_PROPERTYPUTREF|DISPATCH_PROPERTYPUT: + case DISPATCH_PROPERTYPUTREF: + case DISPATCH_PROPERTYPUT: + break; + default: + return E_INVALIDARG; + } + return S_OK; +} + +static const dispex_static_data_vtbl_t proxy_ctor_dispex_vtbl = { + .destructor = proxy_ctor_destructor, + .value = proxy_ctor_value +}; + static HRESULT proxy_get_dispid(DispatchEx *dispex, const WCHAR *name, BOOL case_insens, DISPID *id) { DWORD grfdex = case_insens ? fdexNameCaseInsensitive : fdexNameCaseSensitive; @@ -2719,6 +2875,65 @@ static IDispatch* WINAPI WineDispatchProxyPrivate_GetDefaultPrototype(IWineDispa return get_default_prototype(prot_id, dispex_compat_mode(This), base_window->inner_window); } +static HRESULT WINAPI WineDispatchProxyPrivate_GetDefaultConstructor(IWineDispatchProxyPrivate *iface, IWineDispatchProxyPrivate *window, IDispatch **ret) +{ + static const prototype_id_t special_ctors[] = { + PROTO_ID_MutationObserver, + PROTO_ID_HTMLXMLHttpRequest + }; + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + struct proxy_prototype *prot = to_proxy_prototype(This); + struct proxy_ctor *ctor; + HTMLWindow *base_window; + prototype_id_t prot_id; + IDispatch **entry; + unsigned i; + + if(!prot || !(base_window = unsafe_HTMLWindow_from_IWineDispatchProxyPrivate(window))) { + /* Not a prototype, so no constructor */ + *ret = NULL; + return S_OK; + } + + prot_id = CONTAINING_RECORD(prot->dispex.info->desc, struct prototype_static_data, dispex) - prototype_static_data; + + entry = &base_window->inner_window->proxy_globals->ctor[prot_id - LEGACY_PROTOTYPE_COUNT]; + if(*entry) { + *ret = *entry; + IDispatch_AddRef(*entry); + return S_OK; + } + + for(i = 0; i < ARRAY_SIZE(special_ctors); i++) { + IDispatch *disp; + if(prot_id != special_ctors[i]) + continue; + + disp = get_proxy_constructor_disp(CONTAINING_RECORD((IDispatchEx*)window, HTMLWindow, IDispatchEx_iface)->inner_window, prot_id); + if(!disp) + return E_OUTOFMEMORY; + + *entry = This->proxy->lpVtbl->CreateConstructor(This->proxy, disp, proxy_ctor_dispex[prot_id - LEGACY_PROTOTYPE_COUNT].name); + IDispatch_Release(disp); + if(!*entry) + return E_OUTOFMEMORY; + + *ret = *entry; + IDispatch_AddRef(*entry); + return S_OK; + } + + if(!(ctor = malloc(sizeof(*ctor)))) + return E_OUTOFMEMORY; + + init_dispatch(&ctor->dispex, &proxy_ctor_dispex[prot_id - LEGACY_PROTOTYPE_COUNT], NULL, dispex_compat_mode(This)); + + IDispatchEx_AddRef(&ctor->dispex.IDispatchEx_iface); + *entry = (IDispatch*)&ctor->dispex.IDispatchEx_iface; + *ret = *entry; + return S_OK; +} + static HRESULT WINAPI WineDispatchProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) { DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); @@ -2944,6 +3159,7 @@ static IWineDispatchProxyPrivateVtbl WineDispatchProxyPrivateVtbl = { /* IWineDispatchProxyPrivate extension */ WineDispatchProxyPrivate_GetProxyFieldRef, WineDispatchProxyPrivate_GetDefaultPrototype, + WineDispatchProxyPrivate_GetDefaultConstructor, WineDispatchProxyPrivate_PropFixOverride, WineDispatchProxyPrivate_PropOverride, WineDispatchProxyPrivate_PropDefineOverride, diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 2dd67df9b69..176b5521dcd 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5221,6 +5221,12 @@ static IDispatch* WINAPI DocWineDispProxyPrivate_GetDefaultPrototype(IWineDispat return itf->lpVtbl->GetDefaultPrototype(itf, window); } +static HRESULT WINAPI DocWineDispProxyPrivate_GetDefaultConstructor(IWineDispatchProxyPrivate *iface, IWineDispatchProxyPrivate *window, IDispatch **ret) +{ + *ret = NULL; + return S_OK; +} + static HRESULT WINAPI DocWineDispProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) { HTMLDocumentNode *This = impl_from_IWineDispatchProxyPrivate(iface); @@ -5368,6 +5374,7 @@ static const IWineDispatchProxyPrivateVtbl DocDispatchExVtbl = { /* IWineDispatchProxyPrivate extension */ DocWineDispProxyPrivate_GetProxyFieldRef, DocWineDispProxyPrivate_GetDefaultPrototype, + DocWineDispProxyPrivate_GetDefaultConstructor, DocWineDispProxyPrivate_PropFixOverride, DocWineDispProxyPrivate_PropOverride, DocWineDispProxyPrivate_PropDefineOverride, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index eef73342c8b..523fe617279 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3465,25 +3465,6 @@ static HRESULT WINAPI window_private_get_msCrypto(IWineHTMLWindowPrivate *iface, return S_OK; } -static HRESULT WINAPI window_private_get_MutationObserver(IWineHTMLWindowPrivate *iface, - IDispatch **mutation_observer) -{ - HTMLWindow *This = impl_from_IWineHTMLWindowPrivateVtbl(iface); - HRESULT hres; - - TRACE("iface %p, mutation_observer %p.\n", iface, mutation_observer); - - if (!This->inner_window->mutation_observer_ctor) { - hres = create_mutation_observer_ctor(This->inner_window, &This->inner_window->mutation_observer_ctor); - if (FAILED(hres)) - return hres; - } - - IDispatch_AddRef(This->inner_window->mutation_observer_ctor); - *mutation_observer = This->inner_window->mutation_observer_ctor; - return S_OK; -} - static const IWineHTMLWindowPrivateVtbl WineHTMLWindowPrivateVtbl = { window_private_QueryInterface, window_private_AddRef, @@ -3497,7 +3478,6 @@ static const IWineHTMLWindowPrivateVtbl WineHTMLWindowPrivateVtbl = { window_private_get_console, window_private_matchMedia, window_private_get_msCrypto, - window_private_get_MutationObserver }; static inline HTMLWindow *impl_from_IWineHTMLWindowCompatPrivateVtbl(IWineHTMLWindowCompatPrivate *iface) @@ -3942,6 +3922,21 @@ static IDispatch* WINAPI WindowWineDispProxyPrivate_GetDefaultPrototype(IWineDis return itf->lpVtbl->GetDefaultPrototype(itf, iface); } +static HRESULT WINAPI WindowWineDispProxyPrivate_GetDefaultConstructor(IWineDispatchProxyPrivate *iface, IWineDispatchProxyPrivate *window, IDispatch **ret) +{ + HTMLWindow *This = impl_from_IWineDispatchProxyPrivate(iface); + HRESULT hres; + + /* We aren't a prototype, so we don't have a constructor, but we're the global window, on which constructors are defined. */ + hres = define_global_constructors(This->inner_window); + if(FAILED(hres)) + return hres; + + /* Return S_FALSE to signal the caller that we are the object on which globals are defined. */ + *ret = NULL; + return S_FALSE; +} + static HRESULT WINAPI WindowWineDispProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) { HTMLWindow *This = impl_from_IWineDispatchProxyPrivate(iface); @@ -4124,6 +4119,7 @@ static const IWineDispatchProxyPrivateVtbl WindowDispExVtbl = { /* IWineDispatchProxyPrivate extension */ WindowWineDispProxyPrivate_GetProxyFieldRef, WindowWineDispProxyPrivate_GetDefaultPrototype, + WindowWineDispProxyPrivate_GetDefaultConstructor, WindowWineDispProxyPrivate_PropFixOverride, WindowWineDispProxyPrivate_PropOverride, WindowWineDispProxyPrivate_PropDefineOverride, @@ -4313,13 +4309,14 @@ static void HTMLWindow_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCa for(i = 0; i < ARRAY_SIZE(This->legacy_prototypes); i++) if(This->legacy_prototypes[i]) note_cc_edge((nsISupports*)&This->legacy_prototypes[i]->dispex.IDispatchEx_iface, "legacy_prototype", cb); - if(This->mutation_observer_ctor) - note_cc_edge((nsISupports*)This->mutation_observer_ctor, "mutation_observer_ctor", cb); if(This->proxy_globals) { struct proxy_globals *globals = This->proxy_globals; for(i = 0; i < ARRAY_SIZE(globals->prototype); i++) if(globals->prototype[i]) note_cc_edge((nsISupports*)globals->prototype[i], "proxy_prototype", cb); + for(i = 0; i < ARRAY_SIZE(globals->ctor); i++) + if(globals->ctor[i]) + note_cc_edge((nsISupports*)globals->ctor[i], "proxy_ctor", cb); } if(This->screen) note_cc_edge((nsISupports*)This->screen, "screen", cb); @@ -4370,7 +4367,6 @@ static void HTMLWindow_unlink(DispatchEx *dispex) IDispatchEx_Release(&prot->dispex.IDispatchEx_iface); } } - unlink_ref(&This->mutation_observer_ctor); if(This->proxy_globals) { struct proxy_globals *globals = This->proxy_globals; This->proxy_globals = NULL; @@ -4378,6 +4374,9 @@ static void HTMLWindow_unlink(DispatchEx *dispex) for(i = 0; i < ARRAY_SIZE(globals->prototype); i++) if(globals->prototype[i]) IDispatch_Release(globals->prototype[i]); + for(i = 0; i < ARRAY_SIZE(globals->ctor); i++) + if(globals->ctor[i]) + IDispatch_Release(globals->ctor[i]); free(globals); } unlink_ref(&This->screen); @@ -4725,7 +4724,6 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa /* Hide props not available in IE10 */ static const dispex_hook_t private_ie10_hooks[] = { {DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO}, - {DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER}, {DISPID_UNKNOWN} }; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1317601c769..f9a483a0d2c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -96,6 +96,7 @@ typedef struct { IDispatchExVtbl dispex; IWineDispatchProxyCbPrivate** (STDMETHODCALLTYPE *GetProxyFieldRef)(IWineDispatchProxyPrivate *This); IDispatch* (STDMETHODCALLTYPE *GetDefaultPrototype)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window); + HRESULT (STDMETHODCALLTYPE *GetDefaultConstructor)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window, IDispatch **ret); HRESULT (STDMETHODCALLTYPE *PropFixOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); HRESULT (STDMETHODCALLTYPE *PropOverride)(IWineDispatchProxyPrivate *This, const WCHAR *name, VARIANT *value); HRESULT (STDMETHODCALLTYPE *PropDefineOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); @@ -113,6 +114,8 @@ typedef struct { HRESULT (STDMETHODCALLTYPE *InitProxy)(IWineDispatchProxyCbPrivate *This, IDispatch *obj); void (STDMETHODCALLTYPE *Unlinked)(IWineDispatchProxyCbPrivate *This, BOOL persist); HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); + IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); + HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; @@ -656,6 +659,7 @@ HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*); HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*); HRESULT dispex_invoke(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT dispex_delete_prop(DispatchEx*,DISPID); +HRESULT define_global_constructors(HTMLInnerWindow*); void release_typelib(void); HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**); const void *dispex_get_vtbl(DispatchEx*); @@ -692,6 +696,7 @@ struct legacy_prototype { struct proxy_globals { IDispatch *prototype[PROTO_ID_TOTAL_COUNT - LEGACY_PROTOTYPE_COUNT]; + IDispatch *ctor[PROTO_ID_TOTAL_COUNT - LEGACY_PROTOTYPE_COUNT]; }; typedef enum { @@ -816,7 +821,6 @@ struct HTMLInnerWindow { LONG task_magic; IMoniker *mon; - IDispatch *mutation_observer_ctor; nsChannelBSC *bscallback; struct list bindings; @@ -1728,6 +1732,7 @@ extern const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl; extern dispex_static_data_t HTMLImageElementFactory_dispex; extern dispex_static_data_t HTMLOptionElementFactory_dispex; extern dispex_static_data_t HTMLXMLHttpRequestFactory_dispex; +extern dispex_static_data_t mutation_observer_ctor_dispex; #define X(id, name, dispex, proto_id) extern dispex_static_data_t dispex; LEGACY_PROTOTYPE_LIST diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index f8da68d96a9..56e2ecec438 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -129,7 +129,6 @@ interface IWineMSHTMLCrypto : IDispatch } const long DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO = 54; -const long DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER = 55; [ odl, oleautomation, @@ -149,8 +148,6 @@ interface IWineHTMLWindowPrivate : IDispatch HRESULT matchMedia([in] BSTR media_query, [retval, out] IDispatch **media_query_list); [propget, id(DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO)] HRESULT msCrypto([retval, out] IDispatch **crypto); - [propget, id(DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER)] - HRESULT MutationObserver([retval, out] IDispatch **observer_ctor); } [ diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index d841736c704..264f99d8f85 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -1301,46 +1301,16 @@ static HRESULT create_mutation_observer(HTMLInnerWindow *window, IDispatch *call return S_OK; } -struct mutation_observer_ctor { - DispatchEx dispex; - HTMLInnerWindow *window; -}; - -static inline struct mutation_observer_ctor *mutation_observer_ctor_from_DispatchEx(DispatchEx *iface) +static inline struct global_ctor *ctor_from_DispatchEx(DispatchEx *iface) { - return CONTAINING_RECORD(iface, struct mutation_observer_ctor, dispex); -} - -static void mutation_observer_ctor_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) -{ - struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); - - if(This->window) - note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); -} - -static void mutation_observer_ctor_unlink(DispatchEx *dispex) -{ - struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); - - if(This->window) { - HTMLInnerWindow *window = This->window; - This->window = NULL; - IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); - } -} - -static void mutation_observer_ctor_destructor(DispatchEx *dispex) -{ - struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); - free(This); + return CONTAINING_RECORD(iface, struct global_ctor, dispex); } static HRESULT mutation_observer_ctor_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { - struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex); + struct global_ctor *This = ctor_from_DispatchEx(dispex); VARIANT *callback; IWineMSHTMLMutationObserver *mutation_observer; HRESULT hres; @@ -1383,38 +1353,20 @@ static HRESULT mutation_observer_ctor_value(DispatchEx *dispex, LCID lcid, } static dispex_static_data_vtbl_t mutation_observer_ctor_dispex_vtbl = { - .destructor = mutation_observer_ctor_destructor, - .traverse = mutation_observer_ctor_traverse, - .unlink = mutation_observer_ctor_unlink, - .value = mutation_observer_ctor_value + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = mutation_observer_ctor_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete }; -static dispex_static_data_t mutation_observer_ctor_dispex = { +dispex_static_data_t mutation_observer_ctor_dispex = { "Function", &mutation_observer_ctor_dispex_vtbl, PROTO_ID_NULL, NULL_tid, no_iface_tids }; - -HRESULT create_mutation_observer_ctor(HTMLInnerWindow *window, IDispatch **ret) -{ - struct mutation_observer_ctor *obj; - - TRACE("(window = %p, ret = %p)\n", window, ret); - - obj = calloc(1, sizeof(*obj)); - if(!obj) - { - ERR("No memory.\n"); - return E_OUTOFMEMORY; - } - - obj->window = window; - IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - - init_dispatch(&obj->dispex, &mutation_observer_ctor_dispex, window, dispex_compat_mode(&window->event_target.dispex)); - - *ret = (IDispatch *)&obj->dispex.IDispatchEx_iface; - return S_OK; -} From f915b3f29a0ea643f920e8aa8e2bc645d7ca9e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0969/1506] mshtml/tests: Add tests for builtin object constructors and prototypes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/tests/documentmode.js | 601 +++++++++++++++++++++++++++++- dlls/mshtml/tests/dom.js | 9 + 2 files changed, 606 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a2640ddcdc5..715ff2fdd6a 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -232,7 +232,7 @@ sync_test("builtin_toString", function() { ]; var v = document.documentMode, e; - function test(msg, obj, name, tostr) { + function test(msg, obj, name, tostr, ctor_name) { var s; if(obj.toString) { s = obj.toString(); @@ -242,6 +242,32 @@ sync_test("builtin_toString", function() { s = Object.prototype.toString.call(obj); todo_wine_if(name !== "HTMLElement" && s === "[object HTMLElement]"). ok(s === (v < 9 ? "[object Object]" : "[object " + name + "]"), msg + " Object.toString returned " + s); + + if(v >= 9) { + eval("var c = window." + name + ";"); + todo_wine_if(name !== "HTMLElement" && s === "[object HTMLElement]"). + ok(c !== undefined, name + " is undefined"); + if(!ctor_name) ctor_name = name; + if(c === undefined) return; /* todo_wine */ + + s = Object.getPrototypeOf(obj); + if(name === "Object") { + ok(s === null, msg + "'s proto is not null: " + s); + + s = Object.prototype.toString.call(c); + ok(s === "[object Function]", msg + " Object.toString on constructor returned " + s); + }else { + ok(s === c.prototype, msg + "'s proto is not its constructor's prototype"); + + s = Object.prototype.toString.call(c); + todo_wine_if(name !== "HTMLElement" && s === "[object HTMLElement]"). + ok(s === "[object " + ctor_name + "]", msg + " Object.toString on constructor returned " + s); + + s = Object.prototype.toString.call(c.prototype); + todo_wine_if(name !== "HTMLElement" && s === "[object HTMLElementPrototype]"). + ok(s === "[object " + name + "Prototype]", msg + " Object.toString on constructor.prototype returned " + s); + } + } } for(var i = 0; i < tags.length; i++) @@ -318,7 +344,7 @@ sync_test("builtin_toString", function() { test("textNode", document.createTextNode("testNode"), "Text", v < 9 ? "testNode" : null); test("textRange", txtRange, "TextRange"); test("window", window, "Window", "[object Window]"); - test("xmlHttpRequest", new XMLHttpRequest(), "XMLHttpRequest"); + test("xmlHttpRequest", new XMLHttpRequest(), "XMLHttpRequest", null, "Function"); if(v < 10) { test("namespaces", document.namespaces, "MSNamespaceInfoCollection"); } @@ -343,7 +369,7 @@ sync_test("builtin_toString", function() { } if(v >= 11) { test("crypto", window.msCrypto, "Crypto"); - test("MutationObserver", new window.MutationObserver(function() {}), "MutationObserver"); + test("MutationObserver", new window.MutationObserver(function() {}), "MutationObserver", null, "Function"); } if(v >= 9) { document.body.innerHTML = ""; @@ -497,6 +523,564 @@ sync_test("builtin_obj", function() { } }); +sync_test("builtin_prototypes", function() { + var v = document.documentMode, r, obj, name, proto; + + function set_obj(n, o) { + name = n; + proto = null; + if(o) { + proto = window[n]["prototype"]; + if(typeof o !== "boolean") { + obj = o; + return; + } + } + try { + obj = new window[n](); + ok(o, "expected exception when creating " + name + "."); + }catch(ex) { + obj = null; + ok(!o, "did not expect exception when creating " + name + "."); + ok(ex.number == 0xa01bd - 0x80000000, "unexpected exception number when creating " + name + ": " + ex.number); + } + } + function test_prop(prop, own) { + if(own === undefined ? v < 9 : own) + ok(Object.prototype.hasOwnProperty.call(obj, prop), prop + " not a property of " + name + "."); + else + ok(!Object.prototype.hasOwnProperty.call(obj, prop), prop + " is a property of " + name + "."); + ok(Object.prototype.hasOwnProperty.call(proto, prop), prop + " not a property of " + name + ".prototype."); + } + function test_legacy_ctor(methods, props, non_props, set_prop, set_prop_val) { + if(v >= 9) + return; + ok(""+proto === "[Interface prototype object]", name + ".prototype = " + proto); + if(v < 8) + ok(proto.constructor === undefined, name + ".prototype.constructor = " + proto.constructor); + for(var i = 0; i < methods.length; i++) { + ok(methods[i] in proto, methods[i] + " not in " + name + ".prototype"); + var r = 0; + try { + eval("proto." + methods[i] + "();"); + }catch(ex) { + r = ex.number; + } + ok(r === 0xa01b6 - 0x80000000, name + ".prototype." + methods[i] + "() exception code = " + r); + eval("r = \"\"+proto." + methods[i] + ";"); + ok(r === "\nfunction " + methods[i] + "() {\n [native code]\n}\n", name + ".prototype." + methods[i] + " = " + r); + try { + eval("r = (delete proto." + methods[i] + ");"); + ok(v >= 8, "expected exception deleting " + name + ".prototype." + methods[i]); + ok(r === true, "delete " + name + ".prototype." + methods[i] + " returned " + r); + }catch(ex) { + ok(v < 8, "did not expect exception deleting " + name + ".prototype." + methods[i]); + } + eval("r = \"\"+proto." + methods[i] + ";"); + ok(r === "\nfunction " + methods[i] + "() {\n [native code]\n}\n", name + ".prototype." + methods[i] + " after delete = " + r); + ok(methods[i] in proto, methods[i] + " not in " + name + ".prototype after delete"); + + var func = function() { return "foobar"; } + eval("proto." + methods[i] + " = func;"); + eval("r = proto." + methods[i] + ";"); + ok(r === func, name + ".prototype." + methods[i] + " after set = " + r); + try { + eval("r = (delete proto." + methods[i] + ");"); + ok(v >= 8, "expected exception deleting " + name + ".prototype." + methods[i] + " after set"); + ok(r === true, "delete " + name + ".prototype." + methods[i] + " after set returned " + r); + eval("r = \"\"+proto." + methods[i] + ";"); + ok(r === "\nfunction " + methods[i] + "() {\n [native code]\n}\n", name + ".prototype." + methods[i] + " after second delete = " + r); + }catch(ex) { + ok(v < 8, "did not expect exception deleting " + name + ".prototype." + methods[i] + " after set"); + eval("r = proto." + methods[i] + ";"); + ok(r === func, name + ".prototype." + methods[i] + " after second delete = " + r); + } + eval("proto." + methods[i] + " = func;"); + eval("r = proto." + methods[i] + ";"); + ok(r === func, name + ".prototype." + methods[i] + " after second set = " + r); + } + for(var i = 0; i < props.length; i++) { + ok(props[i] in proto, props[i] + " not in " + name + ".prototype"); + eval("var r = proto." + props[i] + ";"); + ok(r === undefined, name + ".prototype." + props[i] + " = " + r); + try { + eval("r = (delete proto." + props[i] + ");"); + ok(v >= 8, "expected exception deleting " + name + ".prototype." + props[i]); + ok(r === true, "delete " + name + ".prototype." + props[i] + " returned " + r); + }catch(ex) { + ok(v < 8, "did not expect exception deleting " + name + ".prototype." + props[i]); + } + eval("r = proto." + props[i] + ";"); + ok(r === undefined, name + ".prototype." + props[i] + " after delete = " + r); + ok(props[i] in proto, props[i] + " not in " + name + ".prototype after delete"); + } + for(var i = 0; i < non_props.length; i++) + ok(!(non_props[i] in proto), non_props[i] + " in " + name + ".prototype"); + + eval("r = proto." + set_prop + ";"); + ok(r === undefined, name + ".prototype." + set_prop + " = " + r); + eval("proto." + set_prop + " = set_prop_val; r = proto." + set_prop + ";"); + ok(r === undefined, name + ".prototype." + set_prop + " after set = " + r); + + r = proto.winetestprop; + ok(r === undefined, name + ".prototype.winetestprop = " + r); + proto.winetestprop = "test"; + r = proto.winetestprop; + ok(r === "test", name + ".prototype.winetestprop after set = " + r); + } + + set_obj("XMLHttpRequest", true); + test_prop("open"); + test_prop("status"); + test_prop("onreadystatechange"); + test_legacy_ctor(["abort", "send"], ["readyState", "status"], ["selected", "src", "getAttribute"], "onreadystatechange", function(){}); + if(v < 9) { + r = obj.abort(); + ok(r === "foobar", "(new XMLHttpRequest).abort() returned " + r); + r = obj.winetestprop; + ok(r === "test", "(new XMLHttpRequest).winetestprop = " + r); + obj.winetestprop = "prop"; + r = obj.winetestprop; + ok(r === "prop", "(new XMLHttpRequest).winetestprop after set = " + r); + r = XMLHttpRequest.prototype.winetestprop; + ok(r === "test", "XMLHttpRequest.prototype.winetestprop after obj = " + r); + }else + ok(proto.constructor === window.XMLHttpRequest, "XMLHttpRequest.prototype.constructor = " + proto.constructor); + + set_obj("Image", true); + test_prop("src"); + test_prop("border"); + test_legacy_ctor(["getAttribute", "toString"], ["isMap", "alt"], ["selected", "send"], "src", "about:blank"); + if(v < 9) { + r = obj.toString(); + ok(r === "foobar", "(new Image).toString() returned " + r); + r = obj.winetestprop; + ok(r === "test", "(new Image).winetestprop = " + r); + obj.winetestprop = "prop"; + r = obj.winetestprop; + ok(r === "prop", "(new Image).winetestprop after set = " + r); + r = window.Image.prototype.winetestprop; + ok(r === "test", "Image.prototype.winetestprop after obj = " + r); + try { + r = (delete obj.winetestprop); + ok(v >= 8, "expected exception deleting (new Image).winetestprop"); + ok(r === true, "delete (new Image).winetestprop returned " + r); + }catch(ex) { + ok(v < 8, "did not expect exception deleting (new Image).winetestprop"); + } + r = obj.winetestprop; + ok(r === (v < 8 ? "prop" : "test"), "(new Image).winetestprop after delete = " + r); + obj = new window.Image(); + r = obj.winetestprop; + ok(r === "test", "(new Image).winetestprop second time = " + r); + window.Image.prototype.winetestprop = "string"; + r = obj.winetestprop; + ok(r === "string", "(new Image).winetestprop after change in prototype = " + r); + }else + ok(proto.constructor === window.HTMLImageElement, "Image.prototype.constructor = " + proto.constructor); + + set_obj("Option", true); + test_prop("text"); + test_prop("selected"); + test_legacy_ctor(["setAttribute", "contains"], ["index", "value"], ["src", "send"], "text", "foo"); + if(v < 9) { + r = obj.setAttribute("a", "b"); + ok(r === "foobar", "(new Option).setAttribute() returned " + r); + r = obj.winetestprop; + ok(r === "test", "(new Option).winetestprop = " + r); + obj.winetestprop = "prop"; + r = obj.winetestprop; + ok(r === "prop", "(new Option).winetestprop after set = " + r); + r = window.Option.prototype.winetestprop; + ok(r === "test", "Option.prototype.winetestprop after obj = " + r); + try { + r = (delete obj.winetestprop); + ok(v >= 8, "expected exception deleting (new Option).winetestprop"); + ok(r === true, "delete (new Option).winetestprop returned " + r); + }catch(ex) { + ok(v < 8, "did not expect exception deleting (new Option).winetestprop"); + } + r = obj.winetestprop; + ok(r === (v < 8 ? "prop" : "test"), "(new Option).winetestprop after delete = " + r); + obj = new window.Option(); + r = obj.winetestprop; + ok(r === "test", "(new Option).winetestprop second time = " + r); + window.Option.prototype.winetestprop = "string"; + r = obj.winetestprop; + ok(r === "string", "(new Option).winetestprop after change in prototype = " + r); + }else + ok(proto.constructor === window.HTMLOptionElement, "Option.prototype.constructor = " + proto.constructor); + + // other constructors don't support construction + set_obj("ClientRect"); + set_obj("ClientRectList"); + set_obj("Console"); + set_obj("CustomEvent"); + set_obj("DOMTokenList"); + set_obj("KeyboardEvent"); + set_obj("MessageEvent"); + set_obj("MouseEvent"); + set_obj("MSCSSRuleList"); + set_obj("MSCurrentStyleCSSProperties"); + set_obj("MSEventObj"); + set_obj("MSNamespaceInfoCollection"); + set_obj("MSSelection"); + set_obj("MSStyleCSSProperties"); + set_obj("Performance"); + set_obj("PerformanceNavigation"); + set_obj("PerformanceTiming"); + set_obj("UIEvent"); + if(v >= 9) { + set_obj("Attr"); + set_obj("CSSStyleDeclaration"); + set_obj("CSSStyleRule"); + set_obj("CSSStyleSheet"); + set_obj("DOMImplementation"); + set_obj("Event"); + set_obj("History"); + set_obj("HTMLCollection"); + set_obj("NamedNodeMap"); + set_obj("Navigator"); + set_obj("NodeList"); + set_obj("Screen"); + set_obj("Storage"); + set_obj("StyleSheetList"); + set_obj("Text"); + set_obj("TextRange"); + set_obj("Window"); + } + if(v >= 11) { + set_obj("Crypto"); + } + + // todo_wine + if(v === 8 && window.Event === undefined) + return; + + if(v >= 8 && v < 11) { + set_obj(v < 9 ? "Event" : "MSEventObj", document.createEventObject()); + test_prop("x"); + test_prop("y"); + test_prop("srcElement"); + test_prop("returnValue"); + + if(Object.create) { + obj = Object.create(proto); + test_prop("reason"); + test_prop("srcFilter"); + r = Object.prototype.toString.call(obj); + ok(r === "[object Object]", "Object.toString on obj created from MSEventObj.prototype returned " + r); + } + + var ctor = function() {}; + ctor.prototype = proto; + ctor.prototype.testWineProp = function() { return 42; }; + obj = new ctor(); + test_prop("shiftKey", false); + test_prop("testWineProp", false); + r = Object.prototype.toString.call(obj); + ok(r === "[object Object]", "Object.toString on custom obj returned " + r); + + r = (delete proto.shiftKey); + ok(r === true, "delete shiftKey returned " + r); + if(v < 9) + ok(Object.prototype.hasOwnProperty.call(proto, "shiftKey"), "shiftKey not a property anymore of Event.prototype."); + else { + ok(!Object.prototype.hasOwnProperty.call(proto, "shiftKey"), "shiftKey still a property of MSEventObj.prototype."); + proto.shiftKey = ctor; + ok(proto.shiftKey === ctor, "shiftKey = " + proto.shiftKey); + } + + r = (delete proto.testWineProp); + ok(r === true, "delete testWineProp returned " + r); + ok(!Object.prototype.hasOwnProperty.call(proto, "testWineProp"), "testWineProp still a property of " + name + ".prototype."); + } + + if(v >= 9) { + set_obj("Event", document.createEvent("Event")); + test_prop("initEvent"); + test_prop("currentTarget"); + + obj = Object.create(proto); + test_prop("eventPhase"); + test_prop("preventDefault"); + r = Object.prototype.toString.call(obj); + ok(r === "[object Object]", "Object.toString on obj created from Event.prototype returned " + r); + + var ctor = function() {}; + ctor.prototype = proto; + ctor.prototype.testWineProp = function() { return 42; }; + obj = new ctor(); + test_prop("timeStamp"); + test_prop("testWineProp"); + r = Object.prototype.toString.call(obj); + ok(r === "[object Object]", "Object.toString on custom obj returned " + r); + + r = (delete proto.timeStamp); + ok(r === true, "delete timeStamp returned " + r); + ok(!Object.prototype.hasOwnProperty.call(proto, "timeStamp"), "timeStamp still a property of Event.prototype."); + + r = (delete proto.testWineProp); + ok(r === true, "delete testWineProp returned " + r); + ok(!Object.prototype.hasOwnProperty.call(proto, "testWineProp"), "testWineProp still a property of Event.prototype."); + + proto.timeStamp = ctor; + ok(proto.timeStamp === ctor, "timeStamp = " + proto.timeStamp); + + set_obj("HTMLImageElement", document.createElement("img")); + document.body.setAttribute.call(obj, "width", "100"); + obj = Object.create(proto); + r = 0; + try { + document.body.setAttribute.call(obj, "width", "100"); + }catch(ex) { + r = ex.number; + } + ok(r === 0xffff - 0x80000000, "document.body.setAttribute.call(obj ...) exception code = " + r); + } + + if(v >= 8) { + obj = window.HTMLMetaElement; + ok(!("charset" in obj), "charset in HTMLMetaElement constructor."); + ok(!("setAttribute" in obj), "setAttribute in HTMLMetaElement constructor."); + ok(!Object.prototype.hasOwnProperty.call(obj, "charset"), "charset is a property of HTMLMetaElement constructor."); + if(Object.getPrototypeOf) + ok(Object.getPrototypeOf(obj) === Object.prototype, "getPrototypeOf(HTMLMetaElement constructor) = " + Object.getPrototypeOf(obj)); + r = 0; + try { + document.body.setAttribute.call(obj, "charset", "UTF-8"); + }catch(ex) { + r = ex.number; + } + ok(r === (v < 9 ? 0xa0005 : 0xffff) - 0x80000000, "setAttribute on HTMLMetaElement constructor error code = " + r); + + proto = window.HTMLMetaElement.prototype; + try { + window.HTMLMetaElement.prototype = Object.prototype; + ok(v >= 9, "expected exception setting HTMLMetaElement.prototype"); + }catch(ex) { + ok(v < 9, "did not expect exception setting HTMLMetaElement.prototype"); + ok(ex.number === 0xa01b6 - 0x80000000, "exception code setting HTMLMetaElement.prototype = " + ex.number); + } + ok(window.HTMLMetaElement.prototype === proto, "HTMLMetaElement.prototype = " + window.HTMLMetaElement.prototype); + ok(proto !== Object.prototype, "old prototype is Object.prototype"); + + obj = document.createElement("meta"); + ok("tagName" in obj, "tagName not in HTMLMetaElement"); + if(Object.getPrototypeOf) + ok(Object.getPrototypeOf(obj) === proto, "getPrototypeOf(meta element) = " + Object.getPrototypeOf(obj)); + + try { + r = (delete window.HTMLMetaElement.prototype); + ok(r === false, "delete HTMLMetaElement.prototype returned " + r); + ok(v >= 9, "expected exception deleting HTMLMetaElement.prototype"); + }catch(ex) { + ok(v < 9, "did not expect exception deleting HTMLMetaElement.prototype"); + ok(ex.number === 0xa01b6 - 0x80000000, "exception code deleting HTMLMetaElement.prototype = " + ex.number); + } + ok(Object.prototype.hasOwnProperty.call(window.HTMLMetaElement, "prototype"), "prototype not a property anymore of HTMLMetaElement."); + + try { + r = (delete window.HTMLMetaElement); + ok(r === true, "delete HTMLMetaElement returned " + r); + ok(v >= 9, "expected exception deleting HTMLMetaElement"); + ok(!Object.prototype.hasOwnProperty.call(window, "HTMLMetaElement"), "HTMLMetaElement still a property of window."); + }catch(ex) { + ok(v < 9, "did not expect exception deleting HTMLMetaElement"); + ok(ex.number === 0xa01bd - 0x80000000, "exception code deleting HTMLMetaElement = " + ex.number); + ok(Object.prototype.hasOwnProperty.call(window, "HTMLMetaElement"), "HTMLMetaElement not a property anymore of window."); + } + + obj = document.createElement("meta"); + ok("tagName" in obj, "tagName not in HTMLMetaElement"); + if(Object.getPrototypeOf) { + ok(Object.getPrototypeOf(obj) === proto, "getPrototypeOf(meta element) = " + Object.getPrototypeOf(obj)); + ok(window.HTMLMetaElement === undefined, "HTMLMetaElement = " + window.HTMLMetaElement); + } + + ok("setAttribute" in proto, "setAttribute not in proto."); + r = 0; + try { + obj.setAttribute.call(proto, "charset", "UTF-8"); + }catch(ex) { + r = ex.number; + } + todo_wine_if(v < 9). + ok(r === (v < 9 ? 0xa01b6 : 0xffff) - 0x80000000, "setAttribute on proto error code = " + r); + r = 0; + try { + proto.setAttribute("charset", "UTF-8"); + }catch(ex) { + r = ex.number; + } + ok(r === (v < 9 ? 0xa01b6 : 0xffff) - 0x80000000, "proto.setAttribute error code = " + r); + + ok(Object.prototype.hasOwnProperty.call(proto, "charset"), "charset not a property of proto."); + if(v < 9) { + proto.charset = "UTF-8"; + ok(proto.charset === undefined, "proto.charset = " + proto.charset); + }else { + r = Object.getOwnPropertyDescriptor(proto, "charset"); + ok(r.get.toString() === "\nfunction charset() {\n [native code]\n}\n", "charset.get = " + r.get.toString()); + ok(r.set.toString() === "\nfunction charset() {\n [native code]\n}\n", "charset.set = " + r.set.toString()); + ok(Object.getPrototypeOf(r.get) === Function.prototype, "unexpected charset.get prototype"); + ok(Object.getPrototypeOf(r.set) === Function.prototype, "unexpected charset.set prototype"); + + r = 0; + try { + proto.charset; + }catch(ex) { + r = ex.number; + } + ok(r === 0xffff - 0x80000000, "proto.charset error code = " + r); + r = 0; + try { + proto.charset = "UTF-8"; + }catch(ex) { + r = ex.number; + } + ok(r === 0xffff - 0x80000000, "set proto.charset error code = " + r); + } + } +}); + +sync_test("builtin_constructors", function() { + var v = document.documentMode; + + var special_ctors = [ + [ "Image", [ "prototype", "arguments" ], [ "create", "length" ] ], + [ "MutationObserver", [ "prototype", "arguments" ], [ "create", "length" ], 11 ], + [ "Option", [ "prototype", "arguments" ], [ "create", "length" ] ], + [ "XMLHttpRequest", [ "prototype", "arguments", "create" ], [ "length" ] ] + ]; + for(var i = 0; i < special_ctors.length; i++) { + if(special_ctors[i].length > 3 && v < special_ctors[i][3]) + continue; + var name = special_ctors[i][0]; + ok(Object.prototype.hasOwnProperty.call(window, name), name + " not a property of window."); + var obj = window[name]; + if(v < 9) { + ok(!Object.prototype.hasOwnProperty.call(obj, "arguments"), "arguments is a property of " + name + " constructor."); + ok(Object.prototype.hasOwnProperty.call(obj, "create"), "create not a property of " + name + " constructor."); + ok(!Object.prototype.hasOwnProperty.call(obj, "length"), "length is a property of " + name + " constructor."); + ok(Object.prototype.hasOwnProperty.call(obj, "prototype"), "prototype not a property of " + name + " constructor."); + ok(!("length" in obj), "length in " + name + " constructor."); + if(window.Window) + todo_wine. + ok(!Object.prototype.hasOwnProperty.call(window.Window.prototype, name), name + " is a property of window's prototype."); + }else { + for(var j = 0; j < special_ctors[i][1].length; j++) + ok(Object.prototype.hasOwnProperty.call(obj, special_ctors[i][1][j]), special_ctors[i][1][j] + " not a property of " + name + " constructor."); + + for(var j = 0; j < special_ctors[i][2].length; j++) + ok(!Object.prototype.hasOwnProperty.call(obj, special_ctors[i][2][j]), special_ctors[i][2][j] + " is a property of " + name + " constructor."); + + ok(Object.getPrototypeOf(obj) === Function.prototype, "getPrototypeOf(" + name + " constructor) = " + Object.getPrototypeOf(obj)); + ok(!Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(window), name), name + " is a property of window's prototype."); + + if(obj.create) { + var proto = obj.prototype, func = obj.create, s = Object.prototype.toString.call(func); + ok(s === "[object Function]", "obj.create toString = " + s); + ok(Object.getPrototypeOf(func) === Function.prototype, "getPrototypeOf(" + name + ".create) = " + Object.getPrototypeOf(func)); + ok(Object.prototype.hasOwnProperty.call(func, "arguments"), "arguments not a property of " + name + ".create"); + ok(!Object.prototype.hasOwnProperty.call(func, "length"), "length is a property of " + name + ".create"); + ok(Object.prototype.hasOwnProperty.call(func, "prototype"), "prototype not a property of " + name + ".create"); + + obj = func(); + ok(Object.getPrototypeOf(obj) === proto, "getPrototypeOf(obj.create()) = " + Object.getPrototypeOf(obj)); + obj = func.call(Object); + ok(Object.getPrototypeOf(obj) === proto, "getPrototypeOf(obj.create() on Object) = " + Object.getPrototypeOf(obj)); + } + } + } + + if(v >= 9) { + var ctors = [ + [ "Attr" ], + [ "ClientRect" ], + [ "ClientRectList" ], + [ "Comment" ], + [ "Console", 10 ], + [ "Crypto", 11 ], + [ "CSSStyleDeclaration" ], + [ "CSSStyleRule" ], + [ "CSSStyleSheet" ], + [ "CustomEvent" ], + [ "DocumentType" ], + [ "DOMImplementation" ], + [ "DOMTokenList", 10 ], + [ "Event" ], + [ "History" ], + [ "HTMLAnchorElement" ], + [ "HTMLAreaElement" ], + [ "HTMLBodyElement" ], + [ "HTMLButtonElement" ], + [ "HTMLCollection" ], + [ "HTMLDocument", 11 ], + [ "HTMLElement" ], + [ "HTMLEmbedElement" ], + [ "HTMLFormElement" ], + [ "HTMLFrameElement" ], + [ "HTMLHeadElement" ], + [ "HTMLHtmlElement" ], + [ "HTMLIFrameElement" ], + [ "HTMLImageElement" ], + [ "HTMLInputElement" ], + [ "HTMLLabelElement" ], + [ "HTMLLinkElement" ], + [ "HTMLObjectElement" ], + [ "HTMLOptionElement" ], + [ "HTMLScriptElement" ], + [ "HTMLSelectElement" ], + [ "HTMLStyleElement" ], + [ "HTMLTableDataCellElement" ], + [ "HTMLTableElement" ], + [ "HTMLTableRowElement" ], + [ "HTMLTextAreaElement" ], + [ "HTMLTitleElement" ], + [ "HTMLUnknownElement" ], + [ "KeyboardEvent" ], + [ "MediaQueryList", 10 ], + [ "MessageEvent" ], + [ "MimeTypeArray", 11 ], + [ "MouseEvent" ], + [ "MSCSSRuleList" ], + [ "MSCurrentStyleCSSProperties" ], + [ "MSEventObj" ], + [ "MSNamespaceInfoCollection", 0, 9 ], + [ "MSSelection", 0, 10 ], + [ "MSStyleCSSProperties" ], + [ "MutationObserver", 11 ], + [ "NamedNodeMap" ], + [ "Navigator" ], + [ "Node" ], + [ "NodeList" ], + [ "PageTransitionEvent", 11 ], + [ "Performance" ], + [ "PerformanceNavigation" ], + [ "PerformanceTiming" ], + [ "PluginArray", 11 ], + [ "ProgressEvent", 10 ], + [ "Range" ], + [ "Screen" ], + [ "Storage" ], + [ "StorageEvent" ], + [ "StyleSheetList" ], + [ "Text" ], + [ "TextRange" ], + [ "UIEvent" ], + [ "Window" ], + [ "XMLHttpRequest" ] + ]; + for(var i = 0; i < ctors.length; i++) { + if((ctors[i].length > 1 && v < ctors[i][1]) || (ctors[i].length > 2 && v > ctors[i][2])) + ok(!(ctors[i][0] in window), ctors[i][0] + " in window."); + else + ok(Object.prototype.hasOwnProperty.call(window, ctors[i][0]), ctors[i][0] + " not a property of window."); + } + } +}); + sync_test("elem_props", function() { var elem = document.documentElement; @@ -2840,6 +3424,13 @@ sync_test("__proto__", function() { ok(e.number === 0xa13b6 - 0x80000000 && e.name === "TypeError", "changing __proto__ on non-extensible object threw exception " + e.number + " (" + e.name + ")"); } + + obj = document.createElement("img"); + obj.__proto__ = ctor.prototype; + document.body.setAttribute.call(obj, "height", "101"); + r = document.body.getAttribute.call(obj, "height"); + ok(r === "101", "getAttribute(height) = " + r); + ok(!("getAttribute" in obj), "getAttribute exposed in obj"); }); sync_test("__defineGetter__", function() { @@ -3026,10 +3617,12 @@ sync_test("__defineSetter__", function() { }); sync_test("Crypto", function() { - var crypto = window.msCrypto; + var crypto = window.msCrypto, r; if(!crypto) return; ok(Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(window), "msCrypto"), "msCrypto not a property of window's prototype."); + r = Object.getPrototypeOf(crypto); + ok(r === window.Crypto.prototype, "getPrototypeOf(crypto) = " + r); ok("subtle" in crypto, "subtle not in crypto"); ok("getRandomValues" in crypto, "getRandomValues not in crypto"); diff --git a/dlls/mshtml/tests/dom.js b/dlls/mshtml/tests/dom.js index 16ea305d45c..afa24d91d40 100644 --- a/dlls/mshtml/tests/dom.js +++ b/dlls/mshtml/tests/dom.js @@ -147,9 +147,18 @@ async_test("iframe_location", function() { iframe.onload = function() { ok(iframe.contentWindow.location.pathname === "/emptyfile", "path = " + iframe.contentWindow.location.pathname); + ok(iframe.contentWindow.Image !== undefined, "Image is undefined"); + ok(iframe.contentWindow.VBArray !== undefined, "VBArray is undefined"); + iframe.contentWindow.Image = undefined; + iframe.contentWindow.VBArray = undefined; + iframe.contentWindow.foobar = 1234; iframe.onload = function () { ok(iframe.contentWindow.location.pathname === "/empty/file", "path = " + iframe.contentWindow.location.pathname); + ok(iframe.contentWindow.Image !== undefined, "Image is undefined (2)"); + ok(iframe.contentWindow.VBArray !== undefined, "VBArray is undefined (2)"); + ok(!Object.prototype.hasOwnProperty.call(iframe.contentWindow, "foobar"), + "contentWindow has foobar"); next_test(); } iframe.src = "empty/file"; From 8966e33184f6685c2cb85c627b4b460b89cd5300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0970/1506] mshtml: Allow instanceof for proxy constructors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even if they aren't functions. Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/engine.c | 2 +- dlls/jscript/jscript.h | 1 + dlls/jscript/tests/api.js | 1 + dlls/mshtml/dispex.c | 7 +++++++ dlls/mshtml/htmldoc.c | 6 ++++++ dlls/mshtml/htmlwindow.c | 6 ++++++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/es5.js | 19 +++++++++++++++++++ 8 files changed, 42 insertions(+), 1 deletion(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 90d83d1806f..479de3fc423 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2057,7 +2057,7 @@ static HRESULT interp_instanceof(script_ctx_t *ctx) return E_FAIL; } - if(is_class(obj, JSCLASS_FUNCTION)) { + if(is_class(obj, JSCLASS_FUNCTION) || (obj->proxy && obj->proxy->lpVtbl->IsConstructor(obj->proxy))) { hres = jsdisp_propget_name(obj, L"prototype", &prot); }else { hres = JS_E_FUNCTION_EXPECTED; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 0c9b95b381b..278f1035c22 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -106,6 +106,7 @@ typedef struct { IWineDispatchProxyCbPrivate** (STDMETHODCALLTYPE *GetProxyFieldRef)(IWineDispatchProxyPrivate *This); IDispatch* (STDMETHODCALLTYPE *GetDefaultPrototype)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window); HRESULT (STDMETHODCALLTYPE *GetDefaultConstructor)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window, IDispatch **ret); + BOOL (STDMETHODCALLTYPE *IsConstructor)(IWineDispatchProxyPrivate *This); HRESULT (STDMETHODCALLTYPE *PropFixOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); HRESULT (STDMETHODCALLTYPE *PropOverride)(IWineDispatchProxyPrivate *This, const WCHAR *name, VARIANT *value); HRESULT (STDMETHODCALLTYPE *PropDefineOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index aea412347b9..7ef50d0395d 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -2718,6 +2718,7 @@ testException(function() {not_existing_variable.something();}, "E_UNDEFINED"); testException(function() {date();}, "E_NOT_FUNC"); testException(function() {arr();}, "E_NOT_FUNC"); testException(function() {(new Object) instanceof (new Object);}, "E_NOT_FUNC"); +testException(function() {var o = new Object(); o.prototype = new Object(); (new Object) instanceof o;}, "E_NOT_FUNC"); testException(function() {eval("nonexistingfunc()")}, "E_OBJECT_EXPECTED"); testException(function() {(new Object()) instanceof 3;}, "E_NOT_FUNC"); testException(function() {(new Object()) instanceof null;}, "E_NOT_FUNC"); diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 63371409ced..691667d1e3b 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2934,6 +2934,12 @@ static HRESULT WINAPI WineDispatchProxyPrivate_GetDefaultConstructor(IWineDispat return S_OK; } +static BOOL WINAPI WineDispatchProxyPrivate_IsConstructor(IWineDispatchProxyPrivate *iface) +{ + DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); + return This->info->desc >= &proxy_ctor_dispex[0] && This->info->desc < &proxy_ctor_dispex[ARRAY_SIZE(proxy_ctor_dispex)]; +} + static HRESULT WINAPI WineDispatchProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) { DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); @@ -3160,6 +3166,7 @@ static IWineDispatchProxyPrivateVtbl WineDispatchProxyPrivateVtbl = { WineDispatchProxyPrivate_GetProxyFieldRef, WineDispatchProxyPrivate_GetDefaultPrototype, WineDispatchProxyPrivate_GetDefaultConstructor, + WineDispatchProxyPrivate_IsConstructor, WineDispatchProxyPrivate_PropFixOverride, WineDispatchProxyPrivate_PropOverride, WineDispatchProxyPrivate_PropDefineOverride, diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 176b5521dcd..b7695bb14e7 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5227,6 +5227,11 @@ static HRESULT WINAPI DocWineDispProxyPrivate_GetDefaultConstructor(IWineDispatc return S_OK; } +static BOOL WINAPI DocWineDispProxyPrivate_IsConstructor(IWineDispatchProxyPrivate *iface) +{ + return FALSE; +} + static HRESULT WINAPI DocWineDispProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) { HTMLDocumentNode *This = impl_from_IWineDispatchProxyPrivate(iface); @@ -5375,6 +5380,7 @@ static const IWineDispatchProxyPrivateVtbl DocDispatchExVtbl = { DocWineDispProxyPrivate_GetProxyFieldRef, DocWineDispProxyPrivate_GetDefaultPrototype, DocWineDispProxyPrivate_GetDefaultConstructor, + DocWineDispProxyPrivate_IsConstructor, DocWineDispProxyPrivate_PropFixOverride, DocWineDispProxyPrivate_PropOverride, DocWineDispProxyPrivate_PropDefineOverride, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 523fe617279..d680268173e 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3937,6 +3937,11 @@ static HRESULT WINAPI WindowWineDispProxyPrivate_GetDefaultConstructor(IWineDisp return S_FALSE; } +static BOOL WINAPI WindowWineDispProxyPrivate_IsConstructor(IWineDispatchProxyPrivate *iface) +{ + return FALSE; +} + static HRESULT WINAPI WindowWineDispProxyPrivate_PropFixOverride(IWineDispatchProxyPrivate *iface, struct proxy_prop_info *info) { HTMLWindow *This = impl_from_IWineDispatchProxyPrivate(iface); @@ -4120,6 +4125,7 @@ static const IWineDispatchProxyPrivateVtbl WindowDispExVtbl = { WindowWineDispProxyPrivate_GetProxyFieldRef, WindowWineDispProxyPrivate_GetDefaultPrototype, WindowWineDispProxyPrivate_GetDefaultConstructor, + WindowWineDispProxyPrivate_IsConstructor, WindowWineDispProxyPrivate_PropFixOverride, WindowWineDispProxyPrivate_PropOverride, WindowWineDispProxyPrivate_PropDefineOverride, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index f9a483a0d2c..045a3e5af64 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -97,6 +97,7 @@ typedef struct { IWineDispatchProxyCbPrivate** (STDMETHODCALLTYPE *GetProxyFieldRef)(IWineDispatchProxyPrivate *This); IDispatch* (STDMETHODCALLTYPE *GetDefaultPrototype)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window); HRESULT (STDMETHODCALLTYPE *GetDefaultConstructor)(IWineDispatchProxyPrivate *This, IWineDispatchProxyPrivate *window, IDispatch **ret); + BOOL (STDMETHODCALLTYPE *IsConstructor)(IWineDispatchProxyPrivate *This); HRESULT (STDMETHODCALLTYPE *PropFixOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); HRESULT (STDMETHODCALLTYPE *PropOverride)(IWineDispatchProxyPrivate *This, const WCHAR *name, VARIANT *value); HRESULT (STDMETHODCALLTYPE *PropDefineOverride)(IWineDispatchProxyPrivate *This, struct proxy_prop_info *info); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 9247e1f1d12..671aabab9fa 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3017,6 +3017,25 @@ sync_test("functions scope", function() { })(); }); +sync_test("instanceof", function() { + var r; + + try { + ({} instanceof { prototype: {} }); + ok(false, "expected exception using it on non-function object"); + }catch(e) { + ok(e.number === 0xa138a - 0x80000000, "using it on non-function object threw " + e.number); + } + + r = (document.createElement("iframe") instanceof HTMLIFrameElement); + ok(r === true, "iframe element not instance of HTMLIFrameElement"); + r = (document.createElement("div") instanceof HTMLIFrameElement); + ok(r === false, "div element instance of HTMLIFrameElement"); + r = (document instanceof Node); + todo_wine. + ok(r === true, "document not instance of Node"); +}); + sync_test("console", function() { var except From 6c87735fbe47271e592967932176ea324aeeb34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0971/1506] mshtml: Partially implement other legacy constructors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The constructors are based on IHTMLDOMConstructorCollection, but the interface is not exposed on native. Some constructors are not implemented because we don't have the objects, so they are commented out, but kept there since the order must match when implemented. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 38 +++++ dlls/mshtml/htmlwindow.c | 240 +++++++++++++++++++++++++++++- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/documentmode.js | 159 +++++++++++++++++++- dlls/mshtml/tests/dom.c | 4 + 5 files changed, 431 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 691667d1e3b..17e35eb65b2 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2147,6 +2147,44 @@ void global_ctor_destructor(DispatchEx *dispex) free(This); } +HRESULT global_ctor_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: + return MSHTML_E_INVALID_ACTION; + case DISPATCH_PROPERTYGET: { + static const WCHAR prefix[8] = L"[object "; + static const WCHAR suffix[] = L"]"; + WCHAR buf[ARRAY_SIZE(prefix) + 28 + ARRAY_SIZE(suffix)], *p = buf; + const char *name = dispex->info->desc->name; + + memcpy(p, prefix, sizeof(prefix)); + p += ARRAY_SIZE(prefix); + while(*name) + *p++ = *name++; + memcpy(p, suffix, sizeof(suffix)); + + if(!(V_BSTR(res) = SysAllocString(buf))) + return E_OUTOFMEMORY; + V_VT(res) = VT_BSTR; + break; + } + case DISPATCH_PROPERTYPUTREF|DISPATCH_PROPERTYPUT: + case DISPATCH_PROPERTYPUTREF: + case DISPATCH_PROPERTYPUT: + break; + default: + return E_INVALIDARG; + } + return S_OK; +} + HRESULT legacy_ctor_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) { if((flags & fdexNameCaseInsensitive) ? !wcsicmp(name, L"prototype") : !wcscmp(name, L"prototype")) { diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index d680268173e..8940f761c60 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -178,6 +178,137 @@ static inline struct global_ctor *global_ctor_from_IDispatch(IDispatch *iface) return CONTAINING_RECORD((IDispatchEx*)iface, struct global_ctor, dispex.IDispatchEx_iface); } +static const dispex_static_data_vtbl_t legacy_ctor_dispex_vtbl = { + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = global_ctor_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + +static struct { + dispex_static_data_t dispex; + prototype_id_t prototype_id; +} legacy_ctor_static_data[] = { +#define X(name, proto_id) \ +{ \ + { \ + name, \ + &legacy_ctor_dispex_vtbl, \ + PROTO_ID_NULL, \ + NULL_tid, \ + no_iface_tids \ + }, \ + proto_id \ +}, + X("Attr", PROTO_ID_HTMLDOMAttribute) + /* X("BehaviorUrnsCollection", PROTO_ID_?) */ + /* X("BookmarkCollection", PROTO_ID_?) */ + /* X("CompatibleInfo", PROTO_ID_?) */ + /* X("CompatibleInfoCollection", PROTO_ID_?) */ + /* X("ControlRangeCollection", PROTO_ID_?) */ + X("CSSCurrentStyleDeclaration", PROTO_ID_HTMLCurrentStyle) + X("CSSRuleList", PROTO_ID_HTMLStyleSheetRulesCollection) + /* X("CSSRuleStyleDeclaration", PROTO_ID_?) */ + X("CSSStyleDeclaration", PROTO_ID_HTMLW3CComputedStyle) + X("CSSStyleRule", PROTO_ID_HTMLStyleSheetRule) + X("CSSStyleSheet", PROTO_ID_HTMLStyleSheet) + /* X("DataTransfer", PROTO_ID_?) */ + X("DOMImplementation", PROTO_ID_HTMLDOMImplementation) + X("Element", PROTO_ID_HTMLElement) + X("Event", PROTO_ID_HTMLEventObj) + X("History", PROTO_ID_History) + /* X("HTCElementBehaviorDefaults", PROTO_ID_?) */ + X("HTMLAnchorElement", PROTO_ID_HTMLAnchorElement) + X("HTMLAreaElement", PROTO_ID_HTMLAreaElement) + /* X("HTMLAreasCollection", PROTO_ID_?) */ + /* X("HTMLBaseElement", PROTO_ID_?) */ + /* X("HTMLBaseFontElement", PROTO_ID_?) */ + /* X("HTMLBGSoundElement", PROTO_ID_?) */ + /* X("HTMLBlockElement", PROTO_ID_?) */ + X("HTMLBodyElement", PROTO_ID_HTMLBodyElement) + /* X("HTMLBRElement", PROTO_ID_?) */ + X("HTMLButtonElement", PROTO_ID_HTMLButtonElement) + X("HTMLCollection", PROTO_ID_HTMLElementCollection) + X("HTMLCommentElement", PROTO_ID_HTMLCommentElement) + /* X("HTMLDDElement", PROTO_ID_?) */ + /* X("HTMLDivElement", PROTO_ID_?) */ + /* X("HTMLDListElement", PROTO_ID_?) */ + X("HTMLDocument", PROTO_ID_HTMLDocument) + /* X("HTMLDTElement", PROTO_ID_?) */ + X("HTMLEmbedElement", PROTO_ID_HTMLEmbedElement) + /* X("HTMLFieldSetElement", PROTO_ID_?) */ + /* X("HTMLFontElement", PROTO_ID_?) */ + X("HTMLFormElement", PROTO_ID_HTMLFormElement) + X("HTMLFrameElement", PROTO_ID_HTMLFrameElement) + /* X("HTMLFrameSetElement", PROTO_ID_?) */ + X("HTMLGenericElement", PROTO_ID_HTMLGenericElement) + X("HTMLHeadElement", PROTO_ID_HTMLHeadElement) + /* X("HTMLHeadingElement", PROTO_ID_?) */ + /* X("HTMLHRElement", PROTO_ID_?) */ + X("HTMLHtmlElement", PROTO_ID_HTMLHtmlElement) + /* X("HTMLIFrameElement", PROTO_ID_?) */ + X("HTMLImageElement", PROTO_ID_HTMLImgElement) + X("HTMLInputElement", PROTO_ID_HTMLInputElement) + /* X("HTMLIsIndexElement", PROTO_ID_?) */ + X("HTMLLabelElement", PROTO_ID_HTMLLabelElement) + /* X("HTMLLegendElement", PROTO_ID_?) */ + /* X("HTMLLIElement", PROTO_ID_?) */ + X("HTMLLinkElement", PROTO_ID_HTMLLinkElement) + /* X("HTMLMapElement", PROTO_ID_?) */ + /* X("HTMLMarqueeElement", PROTO_ID_?) */ + X("HTMLMetaElement", PROTO_ID_HTMLMetaElement) + /* X("HTMLModelessDialog", PROTO_ID_?) */ + /* X("HTMLNamespaceInfo", PROTO_ID_?) */ + X("HTMLNamespaceInfoCollection", PROTO_ID_HTMLNamespaceCollection) + /* X("HTMLNextIdElement", PROTO_ID_?) */ + /* X("HTMLNoShowElement", PROTO_ID_?) */ + X("HTMLObjectElement", PROTO_ID_HTMLObjectElement) + /* X("HTMLOListElement", PROTO_ID_?) */ + X("HTMLOptionElement", PROTO_ID_HTMLOptionElement) + /* X("HTMLParagraphElement", PROTO_ID_?) */ + /* X("HTMLParamElement", PROTO_ID_?) */ + /* X("HTMLPhraseElement", PROTO_ID_?) */ + X("HTMLPluginsCollection", PROTO_ID_HTMLPluginsCollection) + /* X("HTMLPopup", PROTO_ID_?) */ + X("HTMLScriptElement", PROTO_ID_HTMLScriptElement) + X("HTMLSelectElement", PROTO_ID_HTMLSelectElement) + /* X("HTMLSpanElement", PROTO_ID_?) */ + /* X("HTMLStyleElement", PROTO_ID_?) */ + /* X("HTMLTableCaptionElement", PROTO_ID_?) */ + X("HTMLTableCellElement", PROTO_ID_HTMLTableCellElement) + /* X("HTMLTableColElement", PROTO_ID_?) */ + X("HTMLTableElement", PROTO_ID_HTMLTableElement) + X("HTMLTableRowElement", PROTO_ID_HTMLTableRowElement) + /* X("HTMLTableSectionElement", PROTO_ID_?) */ + X("HTMLTextAreaElement", PROTO_ID_HTMLTextAreaElement) + /* X("HTMLTextElement", PROTO_ID_?) */ + X("HTMLTitleElement", PROTO_ID_HTMLTitleElement) + /* X("HTMLUListElement", PROTO_ID_?) */ + X("HTMLUnknownElement", PROTO_ID_HTMLUnknownElement) + X("Location", PROTO_ID_HTMLLocation) + X("NamedNodeMap", PROTO_ID_HTMLAttributeCollection) + X("Navigator", PROTO_ID_Navigator) + X("NodeList", PROTO_ID_HTMLDOMChildrenCollection) + X("Screen", PROTO_ID_HTMLScreen) + X("Selection", PROTO_ID_HTMLSelectionObject) + /* X("StaticNodeList", PROTO_ID_?) */ + X("Storage", PROTO_ID_HTMLStorage) + X("StyleSheetList", PROTO_ID_HTMLStyleSheetsCollection) + /* X("StyleSheetPage", PROTO_ID_?) */ + /* X("StyleSheetPageList", PROTO_ID_?) */ + X("Text", PROTO_ID_HTMLDOMTextNode) + X("TextRange", PROTO_ID_HTMLTextRange) + /* X("TextRangeCollection", PROTO_ID_?) */ + X("TextRectangle", PROTO_ID_HTMLRect) + X("TextRectangleList", PROTO_ID_HTMLRectCollection) + X("Window", PROTO_ID_HTMLWindow) +#undef X +}; + static inline HTMLWindow *impl_from_IHTMLWindow2(IHTMLWindow2 *iface) { return CONTAINING_RECORD(iface, HTMLWindow, IHTMLWindow2_iface); @@ -3657,6 +3788,9 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe static global_prop_t *alloc_global_prop(HTMLInnerWindow *This, global_prop_type_t type, BSTR name) { + if(This->global_prop_cnt > MSHTML_CUSTOM_DISPID_CNT - ARRAY_SIZE(legacy_ctor_static_data)) + return NULL; + if(This->global_prop_cnt == This->global_prop_size) { global_prop_t *new_props; DWORD new_size; @@ -3718,6 +3852,35 @@ HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, return DISP_E_UNKNOWNNAME; } +static inline int legacy_ctor_name_cmp(const char *ctor_name, WCHAR *name) +{ + const unsigned char *p = (const unsigned char*)ctor_name; + while(*name && (*p == *name)) { + name++; + p++; + } + return (*p > *name) ? 1 : (*p < *name) ? -1 : 0; +} + +static DISPID lookup_legacy_ctor_prop(HTMLInnerWindow *window, BSTR name) +{ + DWORD i, a = 0, b = ARRAY_SIZE(legacy_ctor_static_data); + int c; + + if(dispex_compat_mode(&window->event_target.dispex) != COMPAT_MODE_IE8) + return DISPID_UNKNOWN; + + while(a < b) { + i = (a + b) / 2; + c = legacy_ctor_name_cmp(legacy_ctor_static_data[i].dispex.name, name); + if(!c) + return i + (MSHTML_DISPID_CUSTOM_MAX - ARRAY_SIZE(legacy_ctor_static_data) + 1); + if(c > 0) b = i; + else a = i + 1; + } + return DISPID_UNKNOWN; +} + static HRESULT lookup_custom_prop(HTMLWindow *html_window, BSTR name, DISPID *pid) { HTMLInnerWindow *window = html_window->inner_window; @@ -3823,6 +3986,7 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, HTMLInnerWindow *window = This->inner_window; IWineDispatchProxyCbPrivate *proxy = window->event_target.dispex.proxy; HRESULT hres; + DISPID id; if(proxy) return IDispatchEx_GetDispID((IDispatchEx*)proxy, bstrName, grfdex, pid); @@ -3833,6 +3997,12 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, if(hres != DISP_E_UNKNOWNNAME) return hres; + id = lookup_legacy_ctor_prop(window, bstrName); + if(id != DISPID_UNKNOWN) { + *pid = id; + return S_OK; + } + hres = IDispatchEx_GetDispID(&window->base.inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; @@ -3850,18 +4020,35 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) { HTMLWindow *This = impl_from_IDispatchEx(iface); + IWineDispatchProxyCbPrivate *proxy = This->inner_window->event_target.dispex.proxy; + + if(proxy) + return IDispatchEx_DeleteMemberByName((IDispatchEx*)proxy, bstrName, grfdex); TRACE("(%p)->(%s %lx)\n", This, debugstr_w(bstrName), grfdex); + if(lookup_legacy_ctor_prop(This->inner_window, bstrName) != DISPID_UNKNOWN) + return MSHTML_E_INVALID_ACTION; + return IDispatchEx_DeleteMemberByName(&This->inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex); } static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) { HTMLWindow *This = impl_from_IDispatchEx(iface); + IWineDispatchProxyCbPrivate *proxy = This->inner_window->event_target.dispex.proxy; + DWORD idx; + + if(proxy && id >= 0) + return IDispatchEx_DeleteMemberByDispID((IDispatchEx*)proxy, id); TRACE("(%p)->(%lx)\n", This, id); + idx = id - (MSHTML_DISPID_CUSTOM_MAX - ARRAY_SIZE(legacy_ctor_static_data) + 1); + if(idx < ARRAY_SIZE(legacy_ctor_static_data) && + dispex_compat_mode(&This->inner_window->event_target.dispex) == COMPAT_MODE_IE8) + return MSHTML_E_INVALID_ACTION; + return IDispatchEx_DeleteMemberByDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, id); } @@ -4438,11 +4625,23 @@ static HRESULT HTMLWindow_get_name(DispatchEx *dispex, DISPID id, BSTR *name) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + const WCHAR *str; + WCHAR nameW[38]; + unsigned i = 0; + + if(idx >= This->global_prop_cnt) { + idx = id - (MSHTML_DISPID_CUSTOM_MAX - ARRAY_SIZE(legacy_ctor_static_data) + 1); + if(idx >= ARRAY_SIZE(legacy_ctor_static_data) || + dispex_compat_mode(&This->event_target.dispex) != COMPAT_MODE_IE8) + return DISP_E_MEMBERNOTFOUND; - if(idx >= This->global_prop_cnt) - return DISP_E_MEMBERNOTFOUND; - - return (*name = SysAllocString(This->global_props[idx].name)) ? S_OK : E_OUTOFMEMORY; + do nameW[i] = legacy_ctor_static_data[idx].dispex.name[i]; while(legacy_ctor_static_data[idx].dispex.name[i++]); + assert(i <= ARRAY_SIZE(nameW)); + str = nameW; + }else { + str = This->global_props[idx].name; + } + return (*name = SysAllocString(str)) ? S_OK : E_OUTOFMEMORY; } static HRESULT HTMLWindow_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, @@ -4454,8 +4653,37 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID HRESULT hres; idx = id - MSHTML_DISPID_CUSTOM_MIN; - if(idx >= This->global_prop_cnt) - return DISP_E_MEMBERNOTFOUND; + if(idx >= This->global_prop_cnt) { + idx = id - (MSHTML_DISPID_CUSTOM_MAX - ARRAY_SIZE(legacy_ctor_static_data) + 1); + if(idx >= ARRAY_SIZE(legacy_ctor_static_data) || + dispex_compat_mode(&This->event_target.dispex) != COMPAT_MODE_IE8) + return DISP_E_MEMBERNOTFOUND; + + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: + return MSHTML_E_INVALID_ACTION; + case DISPATCH_PROPERTYGET: + /* For these generic constructors, LEGACY_CTOR_ID is the same as the PROTO_ID */ + hres = get_legacy_ctor(This, (legacy_ctor_id_t)legacy_ctor_static_data[idx].prototype_id, legacy_ctor_static_data[idx].prototype_id, + &legacy_ctor_static_data[idx].dispex, NULL, &V_DISPATCH(res)); + if(FAILED(hres)) + return hres; + V_VT(res) = VT_DISPATCH; + break; + case DISPATCH_PROPERTYPUTREF|DISPATCH_PROPERTYPUT: + case DISPATCH_PROPERTYPUTREF: + case DISPATCH_PROPERTYPUT: + break; + default: + return E_INVALIDARG; + } + return S_OK; + } prop = This->global_props+idx; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 045a3e5af64..9c00b88bddf 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1208,6 +1208,7 @@ struct legacy_prototype *get_legacy_prototype(HTMLInnerWindow*,prototype_id_t,co void global_ctor_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*); void global_ctor_unlink(DispatchEx*); void global_ctor_destructor(DispatchEx*); +HRESULT global_ctor_value(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT legacy_ctor_get_dispid(DispatchEx*,BSTR,DWORD,DISPID*); HRESULT legacy_ctor_get_name(DispatchEx*,DISPID,BSTR*); HRESULT legacy_ctor_invoke(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 715ff2fdd6a..9fd935461c2 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -753,10 +753,6 @@ sync_test("builtin_prototypes", function() { set_obj("Crypto"); } - // todo_wine - if(v === 8 && window.Event === undefined) - return; - if(v >= 8 && v < 11) { set_obj(v < 9 ? "Event" : "MSEventObj", document.createEventObject()); test_prop("x"); @@ -994,7 +990,160 @@ sync_test("builtin_constructors", function() { } } - if(v >= 9) { + if(v < 9) { + // IHTMLDOMConstructorCollection props + var ctors = [ + [ "Attr" ], + [ "BehaviorUrnsCollection" ], + [ "BookmarkCollection" ], + [ "CSSCurrentStyleDeclaration" ], + [ "CSSRuleList" ], + [ "CSSRuleStyleDeclaration" ], + [ "CSSStyleDeclaration" ], + [ "CSSStyleRule" ], + [ "CSSStyleSheet" ], + [ "CompatibleInfo" ], + [ "CompatibleInfoCollection" ], + [ "ControlRangeCollection" ], + [ "DOMImplementation" ], + [ "DataTransfer" ], + [ "Element" ], + [ "Event" ], + [ "HTCElementBehaviorDefaults" ], + [ "HTMLAnchorElement" ], + [ "HTMLAreaElement" ], + [ "HTMLAreasCollection" ], + [ "HTMLBGSoundElement" ], + [ "HTMLBRElement" ], + [ "HTMLBaseElement" ], + [ "HTMLBaseFontElement" ], + [ "HTMLBlockElement" ], + [ "HTMLBodyElement" ], + [ "HTMLButtonElement" ], + [ "HTMLCollection" ], + [ "HTMLCommentElement" ], + [ "HTMLDDElement" ], + [ "HTMLDListElement" ], + [ "HTMLDTElement" ], + [ "HTMLDivElement" ], + [ "HTMLDocument" ], + [ "HTMLEmbedElement" ], + [ "HTMLFieldSetElement" ], + [ "HTMLFontElement" ], + [ "HTMLFormElement" ], + [ "HTMLFrameElement" ], + [ "HTMLFrameSetElement" ], + [ "HTMLGenericElement" ], + [ "HTMLHRElement" ], + [ "HTMLHeadElement" ], + [ "HTMLHeadingElement" ], + [ "HTMLHtmlElement" ], + [ "HTMLIFrameElement" ], + [ "HTMLImageElement" ], + [ "HTMLInputElement" ], + [ "HTMLIsIndexElement" ], + [ "HTMLLIElement" ], + [ "HTMLLabelElement" ], + [ "HTMLLegendElement" ], + [ "HTMLLinkElement" ], + [ "HTMLMapElement" ], + [ "HTMLMarqueeElement" ], + [ "HTMLMetaElement" ], + [ "HTMLModelessDialog" ], + [ "HTMLNamespaceInfo" ], + [ "HTMLNamespaceInfoCollection" ], + [ "HTMLNextIdElement" ], + [ "HTMLNoShowElement" ], + [ "HTMLOListElement" ], + [ "HTMLObjectElement" ], + [ "HTMLOptionElement" ], + [ "HTMLParagraphElement" ], + [ "HTMLParamElement" ], + [ "HTMLPhraseElement" ], + [ "HTMLPluginsCollection" ], + [ "HTMLPopup" ], + [ "HTMLScriptElement" ], + [ "HTMLSelectElement" ], + [ "HTMLSpanElement" ], + [ "HTMLStyleElement" ], + [ "HTMLTableCaptionElement" ], + [ "HTMLTableCellElement" ], + [ "HTMLTableColElement" ], + [ "HTMLTableElement" ], + [ "HTMLTableRowElement" ], + [ "HTMLTableSectionElement" ], + [ "HTMLTextAreaElement" ], + [ "HTMLTextElement" ], + [ "HTMLTitleElement" ], + [ "HTMLUListElement" ], + [ "HTMLUnknownElement" ], + [ "History" ], + [ "Image", 0, "HTMLImageElement" ], + [ "Location" ], + [ "NamedNodeMap" ], + [ "Navigator" ], + [ "NodeList" ], + [ "Option", 0, "HTMLOptionElement" ], + [ "Screen" ], + [ "Selection" ], + [ "StaticNodeList" ], + [ "Storage" ], + [ "StyleSheetList" ], + [ "StyleSheetPage" ], + [ "StyleSheetPageList" ], + [ "Text" ], + [ "TextRange" ], + [ "TextRangeCollection" ], + [ "TextRectangle" ], + [ "TextRectangleList" ], + [ "Window" ], + [ "XDomainRequest", 0 ], + [ "XMLHttpRequest", 0 ] + ]; + for(var i = 0; i < ctors.length; i++) { + if(!(ctors[i][0] in window) && (v >= 8 || ctors[i][0] === "XDomainRequest")) { + todo_wine.ok(false, ctors[i][0] + " not implemented"); + continue; + } + var a, b, r = 0; + try { + eval("a = " + ctors[i][0] + "; b = window." + ctors[i][0] + ";"); + }catch(ex) { + r = ex.number; + } + if(r === 0x4001 - 0x80000000) /* todo_wine XDomainRequest */ + continue; + if(v < 8 && (ctors[i].length < 2 || v < ctors[i][1])) + ok(r === 0xa1391 - 0x80000000, ctors[i][0] + " not undefined: " + r); + else { + ok(r === 0, ctors[i][0] + " exception code: " + r); + ok(a === b, ctors[i][0] + ": " + a + " != " + b); + ok(ctors[i][0] in window, ctors[i][0] + " in window"); + if(v >= 8) + todo_wine_if(ctors[i][0] == "Image" || ctors[i][0] == "Option" || ctors[i][0] == "XMLHttpRequest"). + ok(!(ctors[i][0] in window.Window.prototype), ctors[i][0] + " in Window.prototype"); + r = "" + a; + todo_wine_if(ctors[i][0] == "Image" || ctors[i][0] == "Option" || ctors[i][0] == "XMLHttpRequest"). + ok(r === "[object " + ctors[i][ctors[i].length < 3 ? 0 : 2] + "]", ctors[i][0] + " returned " + r); + r = "" + a.prototype; + ok(r === "[Interface prototype object]", ctors[i][0] + ".prototype returned " + r); + + var props = [ "LookupGetter", "LookupSetter", "DefineGetter", "DefineSetter" ]; + for(var j = 0; j < props.length; j++) { + ok(!(props[j] in a.prototype), props[j] + " in " + ctors[i][0] + ".prototype"); + ok(!(props[j] in a), props[j] + " in " + ctors[i][0]); + } + ok(!("constructor" in a), "constructor in " + ctors[i][0]); + + if(v < 8 || ctors[i][0] === "HTMLModelessDialog") { + ok(!("constructor" in a.prototype), "constructor in " + ctors[i][0] + ".prototype"); + }else { + todo_wine. + ok("constructor" in a.prototype, "constructor not in " + ctors[i][0] + ".prototype"); + } + } + } + }else { var ctors = [ [ "Attr" ], [ "ClientRect" ], diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index bee2c235a8a..fbd5c493aae 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -7302,6 +7302,7 @@ static void test_window(IHTMLDocument2 *doc) IHTMLWindow2 *window, *window2, *self, *parent; IHTMLWindow5 *window5; IHTMLWindow7 *window7; + IHTMLDOMConstructorCollection *ctor_col; IHTMLDocument2 *doc2 = NULL; IDispatch *disp; IUnknown *unk; @@ -7405,6 +7406,9 @@ static void test_window(IHTMLDocument2 *doc) win_skip("IHTMLWindow5 not supported!\n"); } + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLDOMConstructorCollection, (void**)&ctor_col); + ok(hres == E_NOINTERFACE, "QueryInterface for IHTMLDOMConstructorCollection returned %08lx\n", hres); + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow7, (void**)&window7); if(SUCCEEDED(hres)) { IHTMLCSSStyleDeclaration *computed_style; From b15f1eb129f8c60f5950a72ed4bbe42098aaf75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0972/1506] mshtml: Use global_ctor_value to implement remaining flags for MutationObserver constructor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mutation.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 264f99d8f85..612de613081 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -1326,8 +1326,7 @@ static HRESULT mutation_observer_ctor_value(DispatchEx *dispex, LCID lcid, case DISPATCH_METHOD: break; default: - FIXME("flags %x is not supported\n", flags); - return E_NOTIMPL; + return global_ctor_value(dispex, lcid, flags, params, res, ei, caller); } if (argc < 1) From 188a3595bb655524a9f5eba8c1af57d87d6918f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0973/1506] mshtml: Return invalid property when calling a method on a legacy prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 27 +++++++++++++++++++++------ dlls/mshtml/tests/documentmode.js | 1 - 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 17e35eb65b2..16b2cdb852d 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -221,6 +221,7 @@ static inline dispex_data_t *proxy_prototype_object_info(struct proxy_prototype static HRESULT get_dynamic_prop(DispatchEx*,const WCHAR*,DWORD,dynamic_prop_t**); static HRESULT invoke_builtin_function(IDispatch*,func_info_t*,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); +static inline BOOL is_legacy_prototype(IDispatch*); static inline struct proxy_prototype *to_proxy_prototype(DispatchEx*); static HRESULT load_typelib(void) @@ -1018,23 +1019,25 @@ static HRESULT function_apply(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARI { IDispatchEx *dispex = NULL; DISPPARAMS params = { 0 }; + HRESULT hres, errcode; IDispatch *this_obj; UINT argc = 0; VARIANT *arg; - HRESULT hres; arg = dp->rgvarg + dp->cArgs - 1; if(dp->cArgs < 1 || V_VT(arg) != VT_DISPATCH || !V_DISPATCH(arg)) return CTL_E_ILLEGALFUNCTIONCALL; this_obj = V_DISPATCH(arg); + errcode = is_legacy_prototype(this_obj) ? MSHTML_E_INVALID_PROPERTY : CTL_E_ILLEGALFUNCTIONCALL; + if(dp->cArgs >= 2) { IDispatch *disp; UINT i; arg--; if((V_VT(arg) & ~VT_BYREF) != VT_DISPATCH) - return CTL_E_ILLEGALFUNCTIONCALL; + return errcode; disp = (V_VT(arg) & VT_BYREF) ? *(IDispatch**)(V_BYREF(arg)) : V_DISPATCH(arg); /* FIXME: Native doesn't seem to detect jscript arrays by querying for length or indexed props, @@ -1044,11 +1047,11 @@ static HRESULT function_apply(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARI hres = get_disp_prop_vt(disp, dispex, L"length", lcid, res, VT_I4, ei, caller); if(FAILED(hres)) { if(hres == DISP_E_UNKNOWNNAME) - hres = CTL_E_ILLEGALFUNCTIONCALL; + hres = errcode; goto fail; } if(V_I4(res) < 0) { - hres = CTL_E_ILLEGALFUNCTIONCALL; + hres = errcode; goto fail; } params.cArgs = V_I4(res); @@ -1088,7 +1091,7 @@ static HRESULT function_apply(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARI fail: if(dispex) IDispatchEx_Release(dispex); - return (hres == E_UNEXPECTED) ? CTL_E_ILLEGALFUNCTIONCALL : hres; + return (hres == E_UNEXPECTED) ? errcode : hres; } static HRESULT function_call(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) @@ -1103,7 +1106,8 @@ static HRESULT function_call(func_disp_t *func, DISPPARAMS *dp, LCID lcid, VARIA hres = invoke_builtin_function(V_DISPATCH(arg), func->info, ¶ms, res, ei, caller); - return (hres == E_UNEXPECTED) ? CTL_E_ILLEGALFUNCTIONCALL : hres; + return (hres != E_UNEXPECTED) ? hres : + (is_legacy_prototype(V_DISPATCH(arg)) ? MSHTML_E_INVALID_PROPERTY : CTL_E_ILLEGALFUNCTIONCALL); } static const struct { @@ -3215,6 +3219,17 @@ static IWineDispatchProxyPrivateVtbl WineDispatchProxyPrivateVtbl = { WineDispatchProxyPrivate_ToString }; +static inline BOOL is_legacy_prototype(IDispatch *disp) +{ + DispatchEx *dispex; + + if(!disp || disp->lpVtbl != (const IDispatchVtbl*)&WineDispatchProxyPrivateVtbl) + return FALSE; + dispex = impl_from_IDispatchEx((IDispatchEx*)disp); + + return dispex->info->desc >= &legacy_prototype_dispex[0] && dispex->info->desc < &legacy_prototype_dispex[ARRAY_SIZE(legacy_prototype_dispex)]; +} + HRESULT dispex_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *res, EXCEPINFO *pei, IServiceProvider *caller) { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 9fd935461c2..238c912e781 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -901,7 +901,6 @@ sync_test("builtin_prototypes", function() { }catch(ex) { r = ex.number; } - todo_wine_if(v < 9). ok(r === (v < 9 ? 0xa01b6 : 0xffff) - 0x80000000, "setAttribute on proto error code = " + r); r = 0; try { From 11ef8386cccde158666e3db807d7e2a7b0fb8209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0974/1506] mshtml: Use different legacy constructors for the builtin ones. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Image, Option and XMLHttpRequest are exposed due to the builtin getters of the window COM interfaces, but they do not actually return the same dispatch objects as the ones found by GetDispID, and neither is their default value the same. So use the legacy constructor lookup on them as well. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 4 +- dlls/mshtml/htmlimg.c | 39 ++++++++++++++++--- dlls/mshtml/htmlselect.c | 39 ++++++++++++++++--- dlls/mshtml/htmlwindow.c | 63 +++++++++++++++++++++++-------- dlls/mshtml/mshtml_private.h | 7 ++++ dlls/mshtml/tests/documentmode.js | 1 - dlls/mshtml/tests/dom.c | 40 ++++++++++++++++++++ dlls/mshtml/xmlhttprequest.c | 32 +++++++++++++++- 8 files changed, 196 insertions(+), 29 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 16b2cdb852d..c895b5f7297 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2326,8 +2326,8 @@ static IDispatch *get_proxy_constructor_disp(HTMLInnerWindow *window, prototype_ const void *vtbl; } ctors[] = { { PROTO_ID_MutationObserver, &mutation_observer_ctor_dispex }, - { PROTO_ID_HTMLImgElement, &HTMLImageElementFactory_dispex, &HTMLImageElementFactoryVtbl }, - { PROTO_ID_HTMLOptionElement, &HTMLOptionElementFactory_dispex, &HTMLOptionElementFactoryVtbl }, + { PROTO_ID_HTMLImgElement, &HTMLImageCtor_dispex, &HTMLImageElementFactoryVtbl }, + { PROTO_ID_HTMLOptionElement, &HTMLOptionCtor_dispex, &HTMLOptionElementFactoryVtbl }, { PROTO_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, &HTMLXMLHttpRequestFactoryVtbl } }; struct global_ctor *ctor; diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index c8e29df893b..11f2812b705 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -946,26 +946,55 @@ static HRESULT HTMLImageElementFactory_value(DispatchEx *dispex, LCID lcid, return S_OK; } +static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = { + .query_interface = HTMLImageElementFactory_query_interface, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = HTMLImageElementFactory_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + static const tid_t HTMLImageElementFactory_iface_tids[] = { IHTMLImageElementFactory_tid, 0 }; -static const dispex_static_data_vtbl_t HTMLImageElementFactory_dispex_vtbl = { +dispex_static_data_t HTMLImageElementFactory_dispex = { + "HTMLImageElement", + &HTMLImageElementFactory_dispex_vtbl, + PROTO_ID_NULL, + IHTMLImageElementFactory_tid, + HTMLImageElementFactory_iface_tids +}; + +static HRESULT HTMLImageCtor_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + if(flags == DISPATCH_CONSTRUCT) + return HTMLImageElementFactory_value(iface, lcid, flags, params, res, ei, caller); + + return global_ctor_value(iface, lcid, flags, params, res, ei, caller); +} + +static const dispex_static_data_vtbl_t HTMLImageCtor_dispex_vtbl = { .query_interface = HTMLImageElementFactory_query_interface, .destructor = global_ctor_destructor, .traverse = global_ctor_traverse, .unlink = global_ctor_unlink, - .value = HTMLImageElementFactory_value, + .value = HTMLImageCtor_value, .get_dispid = legacy_ctor_get_dispid, .get_name = legacy_ctor_get_name, .invoke = legacy_ctor_invoke, .delete = legacy_ctor_delete }; -dispex_static_data_t HTMLImageElementFactory_dispex = { - "Function", - &HTMLImageElementFactory_dispex_vtbl, +dispex_static_data_t HTMLImageCtor_dispex = { + "HTMLImageElement", + &HTMLImageCtor_dispex_vtbl, PROTO_ID_NULL, IHTMLImageElementFactory_tid, HTMLImageElementFactory_iface_tids diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index e82338d9348..36d69a50367 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -581,26 +581,55 @@ static HRESULT HTMLOptionElementFactory_value(DispatchEx *dispex, LCID lcid, return S_OK; } +static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = { + .query_interface = HTMLOptionElementFactory_query_interface, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = HTMLOptionElementFactory_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + static const tid_t HTMLOptionElementFactory_iface_tids[] = { IHTMLOptionElementFactory_tid, 0 }; -static const dispex_static_data_vtbl_t HTMLOptionElementFactory_dispex_vtbl = { +dispex_static_data_t HTMLOptionElementFactory_dispex = { + "HTMLOptionElement", + &HTMLOptionElementFactory_dispex_vtbl, + PROTO_ID_NULL, + IHTMLOptionElementFactory_tid, + HTMLOptionElementFactory_iface_tids, +}; + +static HRESULT HTMLOptionCtor_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + if(flags == DISPATCH_CONSTRUCT) + return HTMLOptionElementFactory_value(iface, lcid, flags, params, res, ei, caller); + + return global_ctor_value(iface, lcid, flags, params, res, ei, caller); +} + +static const dispex_static_data_vtbl_t HTMLOptionCtor_dispex_vtbl = { .query_interface = HTMLOptionElementFactory_query_interface, .destructor = global_ctor_destructor, .traverse = global_ctor_traverse, .unlink = global_ctor_unlink, - .value = HTMLOptionElementFactory_value, + .value = HTMLOptionCtor_value, .get_dispid = legacy_ctor_get_dispid, .get_name = legacy_ctor_get_name, .invoke = legacy_ctor_invoke, .delete = legacy_ctor_delete }; -dispex_static_data_t HTMLOptionElementFactory_dispex = { - "Function", - &HTMLOptionElementFactory_dispex_vtbl, +dispex_static_data_t HTMLOptionCtor_dispex = { + "HTMLOptionElement", + &HTMLOptionCtor_dispex_vtbl, PROTO_ID_NULL, IHTMLOptionElementFactory_tid, HTMLOptionElementFactory_iface_tids, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 8940f761c60..68d93672616 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -189,6 +189,19 @@ static const dispex_static_data_vtbl_t legacy_ctor_dispex_vtbl = { .delete = legacy_ctor_delete }; +static const struct { + const char *name; + prototype_id_t prototype_id; + legacy_ctor_id_t ctor_id; + dispex_static_data_t *dispex; + const void *vtbl; +} special_ctor_static_data[] = { + { "Image", PROTO_ID_HTMLImgElement, LEGACY_CTOR_ID_Image, &HTMLImageCtor_dispex, &HTMLImageElementFactoryVtbl }, + { "Option", PROTO_ID_HTMLOptionElement, LEGACY_CTOR_ID_Option, &HTMLOptionCtor_dispex, &HTMLOptionElementFactoryVtbl }, + /* { "XDomainRequest", PROTO_ID_?, LEGACY_CTOR_ID_?, ?, ? } */ + { "XMLHttpRequest", PROTO_ID_HTMLXMLHttpRequest, LEGACY_CTOR_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestCtor_dispex, &HTMLXMLHttpRequestFactoryVtbl } +}; + static struct { dispex_static_data_t dispex; prototype_id_t prototype_id; @@ -309,6 +322,8 @@ static struct { #undef X }; +enum { legacy_ctor_props_num = ARRAY_SIZE(special_ctor_static_data) + ARRAY_SIZE(legacy_ctor_static_data) }; + static inline HTMLWindow *impl_from_IHTMLWindow2(IHTMLWindow2 *iface) { return CONTAINING_RECORD(iface, HTMLWindow, IHTMLWindow2_iface); @@ -901,7 +916,7 @@ static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageEleme TRACE("(%p)->(%p)\n", This, p); - hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Image, PROTO_ID_HTMLImgElement, + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Image_builtin, PROTO_ID_HTMLImgElement, &HTMLImageElementFactory_dispex, &HTMLImageElementFactoryVtbl, &disp); if(SUCCEEDED(hres)) *p = &global_ctor_from_IDispatch(disp)->IHTMLImageElementFactory_iface; @@ -1454,7 +1469,7 @@ static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionEle TRACE("(%p)->(%p)\n", This, p); - hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Option, PROTO_ID_HTMLOptionElement, + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_Option_builtin, PROTO_ID_HTMLOptionElement, &HTMLOptionElementFactory_dispex, &HTMLOptionElementFactoryVtbl, &disp); if(SUCCEEDED(hres)) *p = &global_ctor_from_IDispatch(disp)->IHTMLOptionElementFactory_iface; @@ -2227,7 +2242,7 @@ static HRESULT WINAPI HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5 *iface, VARIAN return S_OK; } - hres = get_legacy_ctor(window, LEGACY_CTOR_ID_HTMLXMLHttpRequest, PROTO_ID_HTMLXMLHttpRequest, + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_HTMLXMLHttpRequest_builtin, PROTO_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, &HTMLXMLHttpRequestFactoryVtbl, &disp); if(SUCCEEDED(hres)) { V_VT(p) = VT_DISPATCH; @@ -3788,7 +3803,7 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe static global_prop_t *alloc_global_prop(HTMLInnerWindow *This, global_prop_type_t type, BSTR name) { - if(This->global_prop_cnt > MSHTML_CUSTOM_DISPID_CNT - ARRAY_SIZE(legacy_ctor_static_data)) + if(This->global_prop_cnt > MSHTML_CUSTOM_DISPID_CNT - legacy_ctor_props_num) return NULL; if(This->global_prop_cnt == This->global_prop_size) { @@ -3864,12 +3879,22 @@ static inline int legacy_ctor_name_cmp(const char *ctor_name, WCHAR *name) static DISPID lookup_legacy_ctor_prop(HTMLInnerWindow *window, BSTR name) { - DWORD i, a = 0, b = ARRAY_SIZE(legacy_ctor_static_data); + DWORD i, a = 0, b = ARRAY_SIZE(special_ctor_static_data); int c; + while(a < b) { + i = (a + b) / 2; + c = legacy_ctor_name_cmp(special_ctor_static_data[i].name, name); + if(!c) + return i + (MSHTML_DISPID_CUSTOM_MAX - legacy_ctor_props_num + 1); + if(c > 0) b = i; + else a = i + 1; + } + if(dispex_compat_mode(&window->event_target.dispex) != COMPAT_MODE_IE8) return DISPID_UNKNOWN; + a = 0, b = ARRAY_SIZE(legacy_ctor_static_data); while(a < b) { i = (a + b) / 2; c = legacy_ctor_name_cmp(legacy_ctor_static_data[i].dispex.name, name); @@ -4044,10 +4069,12 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISP TRACE("(%p)->(%lx)\n", This, id); - idx = id - (MSHTML_DISPID_CUSTOM_MAX - ARRAY_SIZE(legacy_ctor_static_data) + 1); - if(idx < ARRAY_SIZE(legacy_ctor_static_data) && - dispex_compat_mode(&This->inner_window->event_target.dispex) == COMPAT_MODE_IE8) - return MSHTML_E_INVALID_ACTION; + idx = id - (MSHTML_DISPID_CUSTOM_MAX - legacy_ctor_props_num + 1); + if(idx < legacy_ctor_props_num) { + if(idx < ARRAY_SIZE(special_ctor_static_data) || + dispex_compat_mode(&This->inner_window->event_target.dispex) == COMPAT_MODE_IE8) + return MSHTML_E_INVALID_ACTION; + } return IDispatchEx_DeleteMemberByDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, id); } @@ -4654,9 +4681,9 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID idx = id - MSHTML_DISPID_CUSTOM_MIN; if(idx >= This->global_prop_cnt) { - idx = id - (MSHTML_DISPID_CUSTOM_MAX - ARRAY_SIZE(legacy_ctor_static_data) + 1); - if(idx >= ARRAY_SIZE(legacy_ctor_static_data) || - dispex_compat_mode(&This->event_target.dispex) != COMPAT_MODE_IE8) + idx = id - (MSHTML_DISPID_CUSTOM_MAX - legacy_ctor_props_num + 1); + if(idx >= legacy_ctor_props_num || (idx >= ARRAY_SIZE(special_ctor_static_data) && + dispex_compat_mode(&This->event_target.dispex) != COMPAT_MODE_IE8)) return DISP_E_MEMBERNOTFOUND; switch(flags) { @@ -4668,9 +4695,15 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID case DISPATCH_CONSTRUCT: return MSHTML_E_INVALID_ACTION; case DISPATCH_PROPERTYGET: - /* For these generic constructors, LEGACY_CTOR_ID is the same as the PROTO_ID */ - hres = get_legacy_ctor(This, (legacy_ctor_id_t)legacy_ctor_static_data[idx].prototype_id, legacy_ctor_static_data[idx].prototype_id, - &legacy_ctor_static_data[idx].dispex, NULL, &V_DISPATCH(res)); + if(idx < ARRAY_SIZE(special_ctor_static_data)) + hres = get_legacy_ctor(This, special_ctor_static_data[idx].ctor_id, special_ctor_static_data[idx].prototype_id, + special_ctor_static_data[idx].dispex, special_ctor_static_data[idx].vtbl, &V_DISPATCH(res)); + else { + /* For these generic constructors, LEGACY_CTOR_ID is the same as the PROTO_ID */ + idx -= ARRAY_SIZE(special_ctor_static_data); + hres = get_legacy_ctor(This, (legacy_ctor_id_t)legacy_ctor_static_data[idx].prototype_id, legacy_ctor_static_data[idx].prototype_id, + &legacy_ctor_static_data[idx].dispex, NULL, &V_DISPATCH(res)); + } if(FAILED(hres)) return hres; V_VT(res) = VT_DISPATCH; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 9c00b88bddf..0e7612f6d08 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -521,6 +521,10 @@ COMMON_PROTOTYPE_LIST LEGACY_CTOR_ID_Image, LEGACY_CTOR_ID_Option, + LEGACY_CTOR_ID_Image_builtin, + LEGACY_CTOR_ID_Option_builtin, + LEGACY_CTOR_ID_HTMLXMLHttpRequest_builtin, + LEGACY_CTOR_COUNT } legacy_ctor_id_t; @@ -1734,6 +1738,9 @@ extern const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl; extern dispex_static_data_t HTMLImageElementFactory_dispex; extern dispex_static_data_t HTMLOptionElementFactory_dispex; extern dispex_static_data_t HTMLXMLHttpRequestFactory_dispex; +extern dispex_static_data_t HTMLImageCtor_dispex; +extern dispex_static_data_t HTMLOptionCtor_dispex; +extern dispex_static_data_t HTMLXMLHttpRequestCtor_dispex; extern dispex_static_data_t mutation_observer_ctor_dispex; #define X(id, name, dispex, proto_id) extern dispex_static_data_t dispex; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 238c912e781..87006f2d03a 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1122,7 +1122,6 @@ sync_test("builtin_constructors", function() { todo_wine_if(ctors[i][0] == "Image" || ctors[i][0] == "Option" || ctors[i][0] == "XMLHttpRequest"). ok(!(ctors[i][0] in window.Window.prototype), ctors[i][0] + " in Window.prototype"); r = "" + a; - todo_wine_if(ctors[i][0] == "Image" || ctors[i][0] == "Option" || ctors[i][0] == "XMLHttpRequest"). ok(r === "[object " + ctors[i][ctors[i].length < 3 ? 0 : 2] + "]", ctors[i][0] + " returned " + r); r = "" + a.prototype; ok(r === "[Interface prototype object]", ctors[i][0] + ".prototype returned " + r); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index fbd5c493aae..3029ea90ad3 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2228,6 +2228,42 @@ static void _set_object_name(unsigned line, IHTMLElement *elem, const WCHAR *nam _test_object_name(line, elem, name); } +static void test_factory(void *window, void *factory, const WCHAR *name, const WCHAR *value) +{ + IDispatch *disp, *window_disp = window; + DISPPARAMS dp = { NULL, NULL, 0, 0 }; + BSTR bstr = SysAllocString(name); + VARIANT var, val; + DISPID dispid; + HRESULT hres; + + hres = IDispatch_GetIDsOfNames(window_disp, &IID_NULL, &bstr, 1, 0, &dispid); + SysFreeString(bstr); + ok(hres == S_OK, "GetIDsOfNames(%s) failed: %08lx\n", wine_dbgstr_w(name), hres); + + hres = IDispatch_Invoke(window_disp, dispid, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &var, NULL, NULL); + ok(hres == S_OK, "Invoke(%s) failed: %08lx\n", wine_dbgstr_w(name), hres); + ok(V_VT(&var) == VT_DISPATCH, "VT(%s) = %d\n", wine_dbgstr_w(name), V_VT(&var)); + + hres = IUnknown_QueryInterface((IUnknown*)factory, &IID_IDispatch, (void**)&disp); + ok(hres == S_OK, "Could not get IDispatch from %s factory: %08lx\n", wine_dbgstr_w(name), hres); + ok(disp != V_DISPATCH(&var), "window.%s and the builtin getter returned same dispatch\n", wine_dbgstr_w(name)); + + hres = IDispatch_Invoke(disp, DISPID_VALUE, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &val, NULL, NULL); + IDispatch_Release(disp); + ok(hres == S_OK, "Invoke(DISPID_VALUE) for %s builtin getter returned: %08lx\n", wine_dbgstr_w(name), hres); + ok(V_VT(&val) == VT_BSTR, "V_VT(value) for %s builtin getter = %d\n", wine_dbgstr_w(name), V_VT(&val)); + ok(!lstrcmpW(V_BSTR(&val), L"[object]"), "value for %s builtin getter = %s\n", wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&val))); + VariantClear(&val); + + hres = IDispatch_Invoke(V_DISPATCH(&var), DISPID_VALUE, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dp, &val, NULL, NULL); + VariantClear(&var); + ok(hres == S_OK, "Invoke(DISPID_VALUE) for %s: %08lx\n", wine_dbgstr_w(name), hres); + ok(V_VT(&val) == VT_BSTR, "V_VT(value) for %s = %d\n", wine_dbgstr_w(name), V_VT(&val)); + ok(!lstrcmpW(V_BSTR(&val), value), "value for %s = %s\n", wine_dbgstr_w(name), wine_dbgstr_w(V_BSTR(&val))); + VariantClear(&val); +} + #define create_option_elem(d,t,v) _create_option_elem(__LINE__,d,t,v) static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *doc, const WCHAR *txt, const WCHAR *val) @@ -2247,6 +2283,7 @@ static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *do IHTMLWindow2_Release(window); ok_(__FILE__,line) (hres == S_OK, "get_Option failed: %08lx\n", hres); + test_factory(window, factory, L"Option", L"[object HTMLOptionElement]"); test_disp((IUnknown*)factory, &IID_IHTMLOptionElementFactory, NULL, L"[object]"); V_VT(&text) = VT_BSTR; @@ -2350,6 +2387,7 @@ static IHTMLImgElement *_create_img_elem(unsigned line, IHTMLDocument2 *doc, ok_(__FILE__,line) (hres == S_OK, "get_Image failed: %08lx\n", hres); test_ifaces((IUnknown*)factory, img_factory_iids); + test_factory(window, factory, L"Image", L"[object HTMLImageElement]"); test_disp((IUnknown*)factory, &IID_IHTMLImageElementFactory, NULL, L"[object]"); if(wdth >= 0){ @@ -7264,6 +7302,8 @@ static void test_xmlhttprequest(IHTMLWindow5 *window) ok(hres == S_OK, "QueryInterface(&IID_IHTMLXMLHttpRequestFactory) failed: %08lx\n", hres); ok(factory != NULL, "factory == NULL\n"); + test_factory(window, factory, L"XMLHttpRequest", L"[object XMLHttpRequest]"); + xml = NULL; hres = IHTMLXMLHttpRequestFactory_create(factory, &xml); ok(hres == S_OK, "create failed: %08lx\n", hres); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 9a99e8b4585..5df687cfee3 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1806,10 +1806,40 @@ static const tid_t HTMLXMLHttpRequestFactory_iface_tids[] = { IHTMLXMLHttpRequestFactory_tid, 0 }; + dispex_static_data_t HTMLXMLHttpRequestFactory_dispex = { - "Function", + "XMLHttpRequest", &HTMLXMLHttpRequestFactory_dispex_vtbl, PROTO_ID_NULL, IHTMLXMLHttpRequestFactory_tid, HTMLXMLHttpRequestFactory_iface_tids }; + +static HRESULT HTMLXMLHttpRequestCtor_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + if(flags == DISPATCH_CONSTRUCT) + return HTMLXMLHttpRequestFactory_value(iface, lcid, flags, params, res, ei, caller); + + return global_ctor_value(iface, lcid, flags, params, res, ei, caller); +} + +static const dispex_static_data_vtbl_t HTMLXMLHttpRequestCtor_dispex_vtbl = { + .query_interface = HTMLXMLHttpRequestFactory_query_interface, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = HTMLXMLHttpRequestCtor_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + +dispex_static_data_t HTMLXMLHttpRequestCtor_dispex = { + "XMLHttpRequest", + &HTMLXMLHttpRequestCtor_dispex_vtbl, + PROTO_ID_NULL, + IHTMLXMLHttpRequestFactory_tid, + HTMLXMLHttpRequestFactory_iface_tids +}; From 5fd503111c402edcbb3d671b3431b6fcaac79f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0975/1506] mshtml: Implement "constructor" property for legacy prototypes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 86 ++++++++++++++++++++++++++++++- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/documentmode.js | 12 ++++- 3 files changed, 97 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index c895b5f7297..480f7d10f5d 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2044,7 +2044,9 @@ struct legacy_prototype *get_legacy_prototype(HTMLInnerWindow *window, prototype if(!(prot = malloc(sizeof(*prot)))) return NULL; + prot->window = window; window->legacy_prototypes[prot_id] = prot; + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); init_dispatch(&prot->dispex, &legacy_prototype_dispex[prot_id], NULL, compat_mode); } @@ -2058,6 +2060,25 @@ static inline struct legacy_prototype *legacy_prototype_from_DispatchEx(Dispatch return CONTAINING_RECORD(iface, struct legacy_prototype, dispex); } +static void legacy_prototype_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + struct legacy_prototype *This = legacy_prototype_from_DispatchEx(dispex); + + if(This->window) + note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); +} + +static void legacy_prototype_unlink(DispatchEx *dispex) +{ + struct legacy_prototype *This = legacy_prototype_from_DispatchEx(dispex); + + if(This->window) { + HTMLInnerWindow *window = This->window; + This->window = NULL; + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + } +} + static void legacy_prototype_destructor(DispatchEx *dispex) { struct legacy_prototype *This = legacy_prototype_from_DispatchEx(dispex); @@ -2090,9 +2111,72 @@ static HRESULT legacy_prototype_value(DispatchEx *dispex, LCID lcid, WORD flags, return S_OK; } +static HRESULT legacy_prototype_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) +{ + if(dispex_compat_mode(dispex) == COMPAT_MODE_IE8) { + if((flags & fdexNameCaseInsensitive) ? !wcsicmp(name, L"constructor") : !wcscmp(name, L"constructor")) { + *dispid = MSHTML_DISPID_CUSTOM_MIN; + return S_OK; + } + } + return DISP_E_UNKNOWNNAME; +} + +static HRESULT legacy_prototype_get_name(DispatchEx *dispex, DISPID id, BSTR *name) +{ + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + + if(idx > 0 || dispex_compat_mode(dispex) != COMPAT_MODE_IE8) + return DISP_E_MEMBERNOTFOUND; + return (*name = SysAllocString(L"constructor")) ? S_OK : E_OUTOFMEMORY; +} + +static HRESULT legacy_prototype_invoke(DispatchEx *dispex, IDispatch *this_obj, DISPID id, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + static WCHAR ElementW[] = L"Element"; + struct legacy_prototype *This = legacy_prototype_from_DispatchEx(dispex); + prototype_id_t prot_id = This->dispex.info->desc - legacy_prototype_dispex; + DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN; + HTMLInnerWindow *window = This->window; + DISPPARAMS dp = { 0 }; + + if(idx > 0 || dispex_compat_mode(dispex) != COMPAT_MODE_IE8) + return DISP_E_MEMBERNOTFOUND; + + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + return MSHTML_E_INVALID_PROPERTY; + case DISPATCH_PROPERTYGET: + if(prot_id < PROTO_ID_HTMLGenericElement && prot_id != PROTO_ID_HTMLUnknownElement) + break; + if(FAILED(IDispatchEx_GetDispID(&window->base.IDispatchEx_iface, ElementW, fdexNameCaseSensitive, &id))) + break; + return IDispatchEx_InvokeEx(&window->base.IDispatchEx_iface, id, lcid, DISPATCH_PROPERTYGET, &dp, res, ei, caller); + case DISPATCH_PROPERTYPUTREF|DISPATCH_PROPERTYPUT: + case DISPATCH_PROPERTYPUTREF: + case DISPATCH_PROPERTYPUT: + return S_OK; + default: + return MSHTML_E_INVALID_PROPERTY; + } + + V_VT(res) = VT_NULL; + return S_OK; +} + static const dispex_static_data_vtbl_t legacy_prototype_dispex_vtbl = { .destructor = legacy_prototype_destructor, - .value = legacy_prototype_value + .traverse = legacy_prototype_traverse, + .unlink = legacy_prototype_unlink, + .value = legacy_prototype_value, + .get_dispid = legacy_prototype_get_dispid, + .get_name = legacy_prototype_get_name, + .invoke = legacy_prototype_invoke }; static void legacy_prototype_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 0e7612f6d08..cd3696b1238 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -697,6 +697,7 @@ struct global_ctor { struct legacy_prototype { DispatchEx dispex; + HTMLInnerWindow *window; }; struct proxy_globals { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 87006f2d03a..37d265e2726 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1136,8 +1136,18 @@ sync_test("builtin_constructors", function() { if(v < 8 || ctors[i][0] === "HTMLModelessDialog") { ok(!("constructor" in a.prototype), "constructor in " + ctors[i][0] + ".prototype"); }else { - todo_wine. ok("constructor" in a.prototype, "constructor not in " + ctors[i][0] + ".prototype"); + b = a.prototype.constructor; + r = ctors[i][(ctors[i].length > 2) ? 2 : 0]; + var ctor = (r.length > 7 && r.slice(-7) === "Element") ? window.Element : null; + ok(b === ctor, ctors[i][0] + ".prototype.constructor = " + b); + a.prototype.constructor = "foobar"; + b = a.prototype.constructor; + ok(b === ctor, ctors[i][0] + ".prototype.constructor after set = " + b); + r = (delete a.prototype.constructor); + ok(r === true, "delete " + ctors[i][0] + ".prototype.constructor returned " + r); + b = a.prototype.constructor; + ok(b === ctor, ctors[i][0] + ".prototype.constructor after delete = " + b); } } } From 1d52e28bb02fe18ce856bfd7ac2d8d6d6cb93505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0976/1506] mshtml: Exclude the constructors from the Window prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 22 +++++++++++++++++++--- dlls/mshtml/tests/documentmode.js | 2 -- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 480f7d10f5d..a1f9976c884 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2181,28 +2181,44 @@ static const dispex_static_data_vtbl_t legacy_prototype_dispex_vtbl = { static void legacy_prototype_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode) { + static const DISPID empty_exclude_list[] = { DISPID_UNKNOWN }; + static const DISPID window_exclude_list[] = { + DISPID_IHTMLWINDOW2_IMAGE, + DISPID_IHTMLWINDOW2_OPTION, + DISPID_IHTMLWINDOW5_XMLHTTPREQUEST, + DISPID_UNKNOWN + }; prototype_id_t prot_id = info->desc - legacy_prototype_dispex; dispex_data_t *data = ensure_dispex_info(prototype_static_data[prot_id].desc, compat_mode); + const DISPID *exclude = empty_exclude_list; func_info_t *func; - unsigned i; + unsigned i, j; if(!data || !data->func_cnt) return; + if(prototype_static_data[prot_id].desc == &HTMLWindow_dispex) + exclude = window_exclude_list; + /* Copy the info from the object instance data */ func = realloc(info->funcs, data->func_size * sizeof(*func)); if(!func) return; info->funcs = func; - info->func_cnt = data->func_cnt; info->func_disp_cnt = data->func_disp_cnt; info->func_size = data->func_size; for(i = 0; i < data->func_cnt; i++) { + for(j = 0; exclude[j] != DISPID_UNKNOWN; j++) + if(exclude[j] == data->funcs[i].id) + break; + if(exclude[j] != DISPID_UNKNOWN) + continue; copy_func_info(func, &data->funcs[i]); func++; } - memset(func, 0, (info->func_size - i) * sizeof(*func)); + info->func_cnt = func - info->funcs; + memset(func, 0, (info->func_size - info->func_cnt) * sizeof(*func)); } static inline struct global_ctor *global_ctor_from_DispatchEx(DispatchEx *iface) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 37d265e2726..b46d4e029c5 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -961,7 +961,6 @@ sync_test("builtin_constructors", function() { ok(Object.prototype.hasOwnProperty.call(obj, "prototype"), "prototype not a property of " + name + " constructor."); ok(!("length" in obj), "length in " + name + " constructor."); if(window.Window) - todo_wine. ok(!Object.prototype.hasOwnProperty.call(window.Window.prototype, name), name + " is a property of window's prototype."); }else { for(var j = 0; j < special_ctors[i][1].length; j++) @@ -1119,7 +1118,6 @@ sync_test("builtin_constructors", function() { ok(a === b, ctors[i][0] + ": " + a + " != " + b); ok(ctors[i][0] in window, ctors[i][0] + " in window"); if(v >= 8) - todo_wine_if(ctors[i][0] == "Image" || ctors[i][0] == "Option" || ctors[i][0] == "XMLHttpRequest"). ok(!(ctors[i][0] in window.Window.prototype), ctors[i][0] + " in Window.prototype"); r = "" + a; ok(r === "[object " + ctors[i][ctors[i].length < 3 ? 0 : 2] + "]", ctors[i][0] + " returned " + r); From c2fc83bd26e1713fa154b9b4dbba173c77a8473f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0977/1506] mshtml: Copy the builtin data to the proxy prototype on init. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit But exclude the ones found further up the prototype chain. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 77 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index a1f9976c884..7bdee79f837 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -140,6 +140,7 @@ PRIVATE_TID_LIST }; static const dispex_static_data_vtbl_t proxy_prototype_dispex_vtbl; +static void proxy_prototype_init_dispex_info(dispex_data_t*,compat_mode_t); const tid_t no_iface_tids[1] = { 0 }; static struct prototype_static_data { @@ -153,7 +154,8 @@ static struct prototype_static_data { &proxy_prototype_dispex_vtbl, \ PROTO_ID_ ## proto_id, \ NULL_tid, \ - no_iface_tids \ + no_iface_tids, \ + proxy_prototype_init_dispex_info \ }, \ &dispex \ }, @@ -1418,13 +1420,8 @@ static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **re static HRESULT get_builtin_func_prot(DispatchEx *This, DISPID id, func_info_t **ret) { - if(This->proxy) { - struct proxy_prototype *prot = to_proxy_prototype(This); - if(prot) - return get_builtin_func(proxy_prototype_object_info(prot), id, ret); - if(id != DISPID_VALUE && This->info->desc->prototype_id >= 0) - return DISP_E_MEMBERNOTFOUND; - } + if(This->proxy && !to_proxy_prototype(This) && id != DISPID_VALUE && This->info->desc->prototype_id >= 0) + return DISP_E_MEMBERNOTFOUND; return get_builtin_func(This->info, id, ret); } @@ -2366,9 +2363,65 @@ static const dispex_static_data_vtbl_t proxy_prototype_dispex_vtbl = { .destructor = proxy_prototype_destructor }; +static void proxy_prototype_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode) +{ + dispex_static_data_t *desc = CONTAINING_RECORD(info->desc, struct prototype_static_data, dispex)->desc; + dispex_data_t *data = ensure_dispex_info(desc, compat_mode); + prototype_id_t prot_id; + func_info_t *func; + unsigned i; + + if(!data || !data->func_cnt) + return; + + /* Copy the info from the object instance data, but + exclude builtins found up the prototype chain. */ + func = realloc(info->funcs, data->func_size * sizeof(*func)); + if(!func) + return; + info->funcs = func; + info->func_disp_cnt = 0; + + for(i = 0; i < data->func_cnt; i++) { + BOOL found = FALSE; + + for(prot_id = info->desc->prototype_id; prot_id >= 0; prot_id = prototype_static_data[prot_id].dispex.prototype_id) { + dispex_data_t *chain_data = ensure_dispex_info(prototype_static_data[prot_id].desc, compat_mode); + DWORD a = 0, b = chain_data->func_cnt; + + while(a < b) { + DWORD idx = (a + b) / 2; + int c = wcsicmp(chain_data->name_table[idx]->name, data->funcs[i].name); + if(!c) { + found = TRUE; + break; + } + if(c > 0) b = idx; + else a = idx + 1; + } + if(found) + break; + } + if(found) + continue; + + copy_func_info(func, &data->funcs[i]); + if(func->func_disp_idx >= 0) + info->func_disp_cnt++; + func++; + } + + info->func_cnt = func - info->funcs; + info->func_size = max(info->func_cnt, 16); + func = realloc(info->funcs, info->func_size * sizeof(*func)); + if(func) + info->funcs = func; + memset(info->funcs + info->func_cnt, 0, (info->func_size - info->func_cnt) * sizeof(*func)); +} + static HRESULT get_prototype_builtin_id(struct proxy_prototype *prot, BSTR name, DWORD flags, DISPID *id) { - dispex_data_t *data = proxy_prototype_object_info(prot); + dispex_data_t *data = prot->dispex.info; func_info_t **funcs = data->name_table; DWORD i, a = 0, b = data->func_cnt; int c; @@ -2386,6 +2439,7 @@ static HRESULT get_prototype_builtin_id(struct proxy_prototype *prot, BSTR name, else a = i + 1; } + data = proxy_prototype_object_info(prot); if(data->desc->vtbl->get_static_dispid) return data->desc->vtbl->get_static_dispid(dispex_compat_mode(&prot->dispex), name, flags, id); return DISP_E_UNKNOWNNAME; @@ -2396,9 +2450,6 @@ static IDispatch *get_default_prototype(prototype_id_t prot_id, compat_mode_t co struct proxy_prototype *prot; IDispatch **entry; - if(!ensure_dispex_info(prototype_static_data[prot_id].desc, compat_mode)) - return NULL; - if(!window->proxy_globals && (!(window->proxy_globals = calloc(1, sizeof(*window->proxy_globals))))) return NULL; @@ -3228,7 +3279,7 @@ static HRESULT WINAPI WineDispatchProxyPrivate_PropEnum(IWineDispatchProxyPrivat return E_OUTOFMEMORY; if(prot) { - dispex_data_t *info = proxy_prototype_object_info(prot); + dispex_data_t *info = prot->dispex.info; func = info->funcs; func_end = func + info->func_cnt; }else if(This->info->desc->prototype_id < 0) { From 380b244b36f29a89e3629077b9526f354677e5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0978/1506] mshtml/tests: Add initial tests for IE9+ prototype chains. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/tests/documentmode.js | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index b46d4e029c5..dfef0a14ef1 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -937,6 +937,52 @@ sync_test("builtin_prototypes", function() { ok(r === 0xffff - 0x80000000, "set proto.charset error code = " + r); } } + + if(v >= 9) { + var protos = [ + [ "ClientRect", "Object" ], + [ "ClientRectList", "Object" ], + [ "Console", "Object" ], + [ "Crypto", "Object" ], + [ "CSSStyleDeclaration", "Object" ], + [ "DOMImplementation", "Object" ], + [ "DOMTokenList", "Object" ], + [ "Event", "Object" ], + [ "History", "Object" ], + [ "HTMLCollection", "Object" ], + [ "MediaQueryList", "Object" ], + [ "MimeTypeArray", "Object" ], + [ "MSCSSRuleList", "Object" ], + [ "MSEventObj", "Object" ], + [ "MSMimeTypesCollection", "Object" ], + [ "MSNamespaceInfoCollection", "Object" ], + [ "MSPluginsCollection", "Object" ], + [ "MSSelection", "Object" ], + [ "MutationObserver", "Object" ], + [ "NamedNodeMap", "Object" ], + [ "Navigator", "Object" ], + [ "Node", "Object" ], + [ "NodeList", "Object" ], + [ "Performance", "Object" ], + [ "PerformanceNavigation", "Object" ], + [ "PerformanceTiming", "Object" ], + [ "PluginArray", "Object" ], + [ "Screen", "Object" ], + [ "Storage", "Object" ], + [ "StyleSheetList", "Object" ], + [ "TextRange", "Object" ], + [ "Window", "Object" ], + [ "XMLHttpRequest", "Object" ] + ]; + + for(var i = 0; i < protos.length; i++) { + if(!(protos[i][0] in window)) + continue; + var a, b; + eval("a = Object.getPrototypeOf(" + protos[i][0] + ".prototype); b = " + protos[i][1] + ".prototype;"); + ok(a === b, "getPrototypeOf(" + protos[i][0] + ".prototype) = " + a); + } + } }); sync_test("builtin_constructors", function() { From 3abb91eaa3381eddc86f542c46f93e1844969309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:27 +0200 Subject: [PATCH 0979/1506] mshtml: Expose ownerDocument from HTMLDOMNode in IE9+ modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlnode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 22e81db31c7..6f34c329970 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -1461,8 +1461,10 @@ static HRESULT HTMLDOMNode_clone(HTMLDOMNode *This, nsIDOMNode *nsnode, HTMLDOMN void HTMLDOMNode_init_dispex_info(dispex_data_t *info, compat_mode_t mode) { - if(mode >= COMPAT_MODE_IE9) + if(mode >= COMPAT_MODE_IE9) { + dispex_info_add_interface(info, IHTMLDOMNode2_tid, NULL); dispex_info_add_interface(info, IHTMLDOMNode3_tid, NULL); + } EventTarget_init_dispex_info(info, mode); } From 1216e2a22a471f497e1480f2b23b17108d8060dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0980/1506] mshtml: Introduce CharacterDataPrototype and set it as TextPrototype's prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface is abstract, and is only used in prototype chains (and constructor), so we needn't implement any of it. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 1 + dlls/mshtml/htmltextnode.c | 22 ++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 4 +++- dlls/mshtml/tests/documentmode.js | 25 +++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 7bdee79f837..6b3cf2ef7b5 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -141,6 +141,7 @@ PRIVATE_TID_LIST static const dispex_static_data_vtbl_t proxy_prototype_dispex_vtbl; static void proxy_prototype_init_dispex_info(dispex_data_t*,compat_mode_t); +const dispex_static_data_vtbl_t no_dispex_vtbl = { 0 }; const tid_t no_iface_tids[1] = { 0 }; static struct prototype_static_data { diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 1fbbc1b7299..5c328fdf035 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -25,6 +25,7 @@ #include "winbase.h" #include "winuser.h" #include "ole2.h" +#include "mshtmdid.h" #include "mshtml_private.h" @@ -40,6 +41,27 @@ struct HTMLDOMTextNode { nsIDOMText *nstext; }; +/* dummy dispex used only for CharacterDataPrototype in prototype chain */ +static void DOMCharacterData_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t textnode_hooks[] = { + {DISPID_IHTMLDOMTEXTNODE_TOSTRING}, + {DISPID_IHTMLDOMTEXTNODE_SPLITTEXT}, + {DISPID_UNKNOWN} + }; + dispex_info_add_interface(info, IHTMLDOMTextNode_tid, textnode_hooks); + dispex_info_add_interface(info, IHTMLDOMTextNode2_tid, NULL); +} + +dispex_static_data_t DOMCharacterData_dispex = { + "CharacterData", + &no_dispex_vtbl, + PROTO_ID_DOMCharacterData, + NULL_tid, + no_iface_tids, + DOMCharacterData_init_dispex_info +}; + static inline HTMLDOMTextNode *impl_from_IHTMLDOMTextNode(IHTMLDOMTextNode *iface) { return CONTAINING_RECORD(iface, HTMLDOMTextNode, IHTMLDOMTextNode_iface); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index cd3696b1238..32a66a9b86f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -423,7 +423,7 @@ PRIVATE_TID_LIST X(HTMLDOMAttribute, "Attr", HTMLDOMAttribute_dispex, Object) \ X(HTMLDOMChildrenCollection, "NodeList", HTMLDOMChildrenCollection_dispex, Object) \ X(HTMLDOMImplementation, "DOMImplementation", HTMLDOMImplementation_dispex, Object) \ - X(HTMLDOMTextNode, "Text", HTMLDOMTextNode_dispex, Object) \ + X(HTMLDOMTextNode, "Text", HTMLDOMTextNode_dispex, DOMCharacterData) \ X(HTMLDocument, "HTMLDocument", HTMLDocumentNode_dispex, Object) \ X(HTMLWindow, "Window", HTMLWindow_dispex, Object) \ X(HTMLAttributeCollection, "NamedNodeMap", HTMLAttributeCollection_dispex, Object) \ @@ -486,6 +486,7 @@ PRIVATE_TID_LIST X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, Object) \ X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, Object) \ X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, Object) \ + X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, Object) \ X(MediaQueryList, "MediaQueryList", media_query_list_dispex, Object) \ X(DOMTokenList, "DOMTokenList", token_list_dispex, Object) \ @@ -623,6 +624,7 @@ typedef struct { dispex_data_t *delayed_init_info; } dispex_static_data_t; +extern const dispex_static_data_vtbl_t no_dispex_vtbl; extern const tid_t no_iface_tids[1]; typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,WORD,DISPPARAMS*,VARIANT*, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index dfef0a14ef1..6d2773d0cff 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -940,6 +940,7 @@ sync_test("builtin_prototypes", function() { if(v >= 9) { var protos = [ + [ "CharacterData", "Node" ], [ "ClientRect", "Object" ], [ "ClientRectList", "Object" ], [ "Console", "Object" ], @@ -970,6 +971,7 @@ sync_test("builtin_prototypes", function() { [ "Screen", "Object" ], [ "Storage", "Object" ], [ "StyleSheetList", "Object" ], + [ "Text", "CharacterData" ], [ "TextRange", "Object" ], [ "Window", "Object" ], [ "XMLHttpRequest", "Object" ] @@ -982,6 +984,28 @@ sync_test("builtin_prototypes", function() { eval("a = Object.getPrototypeOf(" + protos[i][0] + ".prototype); b = " + protos[i][1] + ".prototype;"); ok(a === b, "getPrototypeOf(" + protos[i][0] + ".prototype) = " + a); } + + var Node_props = [ "addEventListener","appendChild","attributes","childNodes","cloneNode","compareDocumentPosition","dispatchEvent","firstChild", + "hasChildNodes","insertBefore","isDefaultNamespace","isEqualNode","isSameNode","isSupported","lastChild","localName", + "lookupNamespaceURI","lookupPrefix","namespaceURI","nextSibling","nodeName","nodeType","nodeValue","ownerDocument", + "parentNode","prefix","previousSibling","removeChild","removeEventListener","replaceChild","textContent" ]; + + protos = [ + [ "CharacterData", ["data","length"], Node_props ], + [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ] + ]; + + for(var i = 0; i < protos.length; i++) { + if(!(protos[i][0] in window)) + continue; + eval("r = " + protos[i][0] + ".prototype"); + for(var j = 0; j < protos[i][1].length; j++) + ok(Object.prototype.hasOwnProperty.call(r, protos[i][1][j]), protos[i][1][j] + " not a property of " + protos[i][0] + ".prototype"); + for(var j = 0; j < protos[i][2].length; j++) { + ok(!Object.prototype.hasOwnProperty.call(r, protos[i][2][j]), protos[i][2][j] + " is a property of " + protos[i][0] + ".prototype"); + ok(protos[i][2][j] in r, protos[i][2][j] + " not in " + protos[i][0] + ".prototype"); + } + } } }); @@ -1198,6 +1222,7 @@ sync_test("builtin_constructors", function() { }else { var ctors = [ [ "Attr" ], + [ "CharacterData" ], [ "ClientRect" ], [ "ClientRectList" ], [ "Comment" ], From 1a61da87b540944e466796c5aec1eb78cd5bb10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0981/1506] mshtml: Set prototype of CommentPrototype to CharacterDataPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IHTMLDOMTextNode and IHTMLDOMTextNode2 are introduced to HTMLCommentElement as stubs, but not exposed, since they can be called from the CharacterDataPrototype. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlcomment.c | 222 ++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 4 +- 3 files changed, 226 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index 183a63b6c62..fb7de355de4 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); struct HTMLCommentElement { HTMLElement element; IHTMLCommentElement IHTMLCommentElement_iface; + IHTMLDOMTextNode IHTMLDOMTextNode_iface; + IHTMLDOMTextNode2 IHTMLDOMTextNode2_iface; }; static inline HTMLCommentElement *impl_from_IHTMLCommentElement(IHTMLCommentElement *iface) @@ -141,6 +143,220 @@ static const IHTMLCommentElementVtbl HTMLCommentElementVtbl = { HTMLCommentElement_get_atomic }; +static inline HTMLCommentElement *impl_from_IHTMLDOMTextNode(IHTMLDOMTextNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLCommentElement, IHTMLDOMTextNode_iface); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_QueryInterface(IHTMLDOMTextNode *iface, + REFIID riid, void **ppv) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCommentElement_TextNode_AddRef(IHTMLDOMTextNode *iface) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLCommentElement_TextNode_Release(IHTMLDOMTextNode *iface) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_GetTypeInfoCount(IHTMLDOMTextNode *iface, UINT *pctinfo) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_GetTypeInfo(IHTMLDOMTextNode *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_GetIDsOfNames(IHTMLDOMTextNode *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_Invoke(IHTMLDOMTextNode *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_put_data(IHTMLDOMTextNode *iface, BSTR v) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_toString(IHTMLDOMTextNode *iface, BSTR *String) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + WARN("(%p)->(%p)\n", This, String); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_get_length(IHTMLDOMTextNode *iface, LONG *p) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode_splitText(IHTMLDOMTextNode *iface, LONG offset, IHTMLDOMNode **pRetNode) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode(iface); + WARN("(%p)->(%ld %p)\n", This, offset, pRetNode); + return E_UNEXPECTED; +} + +static const IHTMLDOMTextNodeVtbl HTMLCommentElement_TextNodeVtbl = { + HTMLCommentElement_TextNode_QueryInterface, + HTMLCommentElement_TextNode_AddRef, + HTMLCommentElement_TextNode_Release, + HTMLCommentElement_TextNode_GetTypeInfoCount, + HTMLCommentElement_TextNode_GetTypeInfo, + HTMLCommentElement_TextNode_GetIDsOfNames, + HTMLCommentElement_TextNode_Invoke, + HTMLCommentElement_TextNode_put_data, + HTMLCommentElement_TextNode_get_data, + HTMLCommentElement_TextNode_toString, + HTMLCommentElement_TextNode_get_length, + HTMLCommentElement_TextNode_splitText +}; + +static inline HTMLCommentElement *impl_from_IHTMLDOMTextNode2(IHTMLDOMTextNode2 *iface) +{ + return CONTAINING_RECORD(iface, HTMLCommentElement, IHTMLDOMTextNode2_iface); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_QueryInterface(IHTMLDOMTextNode2 *iface, REFIID riid, void **ppv) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCommentElement_TextNode2_AddRef(IHTMLDOMTextNode2 *iface) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLCommentElement_TextNode2_Release(IHTMLDOMTextNode2 *iface) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_GetTypeInfoCount(IHTMLDOMTextNode2 *iface, UINT *pctinfo) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_GetTypeInfo(IHTMLDOMTextNode2 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_GetIDsOfNames(IHTMLDOMTextNode2 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_Invoke(IHTMLDOMTextNode2 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_substringData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR *string) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + FIXME("(%p)->(%ld %ld %p)\n", This, offset, count, string); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_appendData(IHTMLDOMTextNode2 *iface, BSTR string) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(string)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_insertData(IHTMLDOMTextNode2 *iface, LONG offset, BSTR string) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + FIXME("(%p)->(%ld %s)\n", This, offset, debugstr_w(string)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_deleteData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + FIXME("(%p)->(%ld %ld)\n", This, offset, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCommentElement_TextNode2_replaceData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR string) +{ + HTMLCommentElement *This = impl_from_IHTMLDOMTextNode2(iface); + FIXME("(%p)->(%ld %ld %s)\n", This, offset, count, debugstr_w(string)); + return E_NOTIMPL; +} + +static const IHTMLDOMTextNode2Vtbl HTMLCommentElement_TextNode2Vtbl = { + HTMLCommentElement_TextNode2_QueryInterface, + HTMLCommentElement_TextNode2_AddRef, + HTMLCommentElement_TextNode2_Release, + HTMLCommentElement_TextNode2_GetTypeInfoCount, + HTMLCommentElement_TextNode2_GetTypeInfo, + HTMLCommentElement_TextNode2_GetIDsOfNames, + HTMLCommentElement_TextNode2_Invoke, + HTMLCommentElement_TextNode2_substringData, + HTMLCommentElement_TextNode2_appendData, + HTMLCommentElement_TextNode2_insertData, + HTMLCommentElement_TextNode2_deleteData, + HTMLCommentElement_TextNode2_replaceData +}; + static inline HTMLCommentElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLCommentElement, element.node); @@ -171,6 +387,10 @@ static void *HTMLCommentElement_query_interface(DispatchEx *dispex, REFIID riid) if(IsEqualGUID(&IID_IHTMLCommentElement, riid)) return &This->IHTMLCommentElement_iface; + if(IsEqualGUID(&IID_IHTMLDOMTextNode, riid)) + return &This->IHTMLDOMTextNode_iface; + if(IsEqualGUID(&IID_IHTMLDOMTextNode2, riid)) + return &This->IHTMLDOMTextNode2_iface; return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -218,6 +438,8 @@ HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTM ret->element.node.vtbl = &HTMLCommentElementImplVtbl; ret->IHTMLCommentElement_iface.lpVtbl = &HTMLCommentElementVtbl; + ret->IHTMLDOMTextNode_iface.lpVtbl = &HTMLCommentElement_TextNodeVtbl; + ret->IHTMLDOMTextNode2_iface.lpVtbl = &HTMLCommentElement_TextNode2Vtbl; HTMLElement_Init(&ret->element, doc, NULL, &HTMLCommentElement_dispex); HTMLDOMNode_Init(doc, &ret->element.node, nsnode, &HTMLCommentElement_dispex); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 32a66a9b86f..728bedef3bf 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -450,7 +450,7 @@ PRIVATE_TID_LIST X(HTMLAreaElement, "HTMLAreaElement", HTMLAreaElement_dispex, Object) \ X(HTMLBodyElement, "HTMLBodyElement", HTMLBodyElement_dispex, Object) \ X(HTMLButtonElement, "HTMLButtonElement", HTMLButtonElement_dispex, Object) \ - X(HTMLCommentElement, "Comment", HTMLCommentElement_dispex, Object) \ + X(HTMLCommentElement, "Comment", HTMLCommentElement_dispex, DOMCharacterData) \ X(HTMLEmbedElement, "HTMLEmbedElement", HTMLEmbedElement_dispex, Object) \ X(HTMLFormElement, "HTMLFormElement", HTMLFormElement_dispex, Object) \ X(HTMLFrameElement, "HTMLFrameElement", HTMLFrameElement_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 6d2773d0cff..7c45d89d9f0 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -943,6 +943,7 @@ sync_test("builtin_prototypes", function() { [ "CharacterData", "Node" ], [ "ClientRect", "Object" ], [ "ClientRectList", "Object" ], + [ "Comment", "CharacterData" ], [ "Console", "Object" ], [ "Crypto", "Object" ], [ "CSSStyleDeclaration", "Object" ], @@ -991,7 +992,8 @@ sync_test("builtin_prototypes", function() { "parentNode","prefix","previousSibling","removeChild","removeEventListener","replaceChild","textContent" ]; protos = [ - [ "CharacterData", ["data","length"], Node_props ], + [ "CharacterData", ["data","length","appendData"], Node_props ], + [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ] ]; From 88cad0d95768284487037112d53d05512ea22a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0982/1506] mshtml: Set prototype of DocumentTypePrototype to NodePrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 728bedef3bf..26aea4e7a31 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -487,7 +487,7 @@ PRIVATE_TID_LIST X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, Object) \ X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, Object) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ - X(DocumentType, "DocumentType", DocumentType_dispex, Object) \ + X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ X(MediaQueryList, "MediaQueryList", media_query_list_dispex, Object) \ X(DOMTokenList, "DOMTokenList", token_list_dispex, Object) \ X(HTMLDOMNode, "Node", HTMLDOMNode_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 7c45d89d9f0..2f738e71786 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -947,6 +947,7 @@ sync_test("builtin_prototypes", function() { [ "Console", "Object" ], [ "Crypto", "Object" ], [ "CSSStyleDeclaration", "Object" ], + [ "DocumentType", "Node" ], [ "DOMImplementation", "Object" ], [ "DOMTokenList", "Object" ], [ "Event", "Object" ], @@ -994,6 +995,7 @@ sync_test("builtin_prototypes", function() { protos = [ [ "CharacterData", ["data","length","appendData"], Node_props ], [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], + [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ] ]; From 3cf958c3107f4ba2b5bfa83e9dc57bfc1f614318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0983/1506] mshtml: Set prototype of CustomEventPrototype and UIEventPrototype to EventPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 4 ++-- dlls/mshtml/tests/documentmode.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 26aea4e7a31..0439373aec9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -478,14 +478,14 @@ PRIVATE_TID_LIST X(Crypto, "Crypto", crypto_dispex, Object) \ X(MutationObserver, "MutationObserver", mutation_observer_dispex, Object) \ X(DOMEvent, "Event", DOMEvent_dispex, Object) \ - X(DOMCustomEvent, "CustomEvent", DOMCustomEvent_dispex, Object) \ + X(DOMCustomEvent, "CustomEvent", DOMCustomEvent_dispex, DOMEvent) \ X(DOMKeyboardEvent, "KeyboardEvent", DOMKeyboardEvent_dispex, Object) \ X(DOMMessageEvent, "MessageEvent", DOMMessageEvent_dispex, Object) \ X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, Object) \ X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, Object) \ X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, Object) \ X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, Object) \ - X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, Object) \ + X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ X(MediaQueryList, "MediaQueryList", media_query_list_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 2f738e71786..0c9a737be54 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -947,6 +947,7 @@ sync_test("builtin_prototypes", function() { [ "Console", "Object" ], [ "Crypto", "Object" ], [ "CSSStyleDeclaration", "Object" ], + [ "CustomEvent", "Event" ], [ "DocumentType", "Node" ], [ "DOMImplementation", "Object" ], [ "DOMTokenList", "Object" ], @@ -975,6 +976,7 @@ sync_test("builtin_prototypes", function() { [ "StyleSheetList", "Object" ], [ "Text", "CharacterData" ], [ "TextRange", "Object" ], + [ "UIEvent", "Event" ], [ "Window", "Object" ], [ "XMLHttpRequest", "Object" ] ]; @@ -987,6 +989,8 @@ sync_test("builtin_prototypes", function() { ok(a === b, "getPrototypeOf(" + protos[i][0] + ".prototype) = " + a); } + var Event_props = [ "bubbles","cancelable","cancelBubble","currentTarget","defaultPrevented","eventPhase","initEvent","isTrusted", + "preventDefault","srcElement","stopImmediatePropagation","stopPropagation","target","timeStamp","type" ]; var Node_props = [ "addEventListener","appendChild","attributes","childNodes","cloneNode","compareDocumentPosition","dispatchEvent","firstChild", "hasChildNodes","insertBefore","isDefaultNamespace","isEqualNode","isSameNode","isSupported","lastChild","localName", "lookupNamespaceURI","lookupPrefix","namespaceURI","nextSibling","nodeName","nodeType","nodeValue","ownerDocument", @@ -995,8 +999,10 @@ sync_test("builtin_prototypes", function() { protos = [ [ "CharacterData", ["data","length","appendData"], Node_props ], [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], + [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], - [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ] + [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ], + [ "UIEvent", ["detail","initUIEvent","view"], Event_props ] ]; for(var i = 0; i < protos.length; i++) { From 49124b9ae2b1ecee06af497341d9334133fbf7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0984/1506] mshtml: Set prototype of MessageEventPrototype to EventPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 0439373aec9..2272a5b0771 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -480,7 +480,7 @@ PRIVATE_TID_LIST X(DOMEvent, "Event", DOMEvent_dispex, Object) \ X(DOMCustomEvent, "CustomEvent", DOMCustomEvent_dispex, DOMEvent) \ X(DOMKeyboardEvent, "KeyboardEvent", DOMKeyboardEvent_dispex, Object) \ - X(DOMMessageEvent, "MessageEvent", DOMMessageEvent_dispex, Object) \ + X(DOMMessageEvent, "MessageEvent", DOMMessageEvent_dispex, DOMEvent) \ X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, Object) \ X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, Object) \ X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 0c9a737be54..67a6da901ba 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -955,6 +955,7 @@ sync_test("builtin_prototypes", function() { [ "History", "Object" ], [ "HTMLCollection", "Object" ], [ "MediaQueryList", "Object" ], + [ "MessageEvent", "Event" ], [ "MimeTypeArray", "Object" ], [ "MSCSSRuleList", "Object" ], [ "MSEventObj", "Object" ], @@ -1001,6 +1002,7 @@ sync_test("builtin_prototypes", function() { [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], + [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ], [ "UIEvent", ["detail","initUIEvent","view"], Event_props ] ]; From fc1462685af4f325e6b0ded33f7d5e268ecea5a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0985/1506] mshtml: Set prototype of Keyboard/MouseEventPrototype to UIEventPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 4 ++-- dlls/mshtml/tests/documentmode.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 2272a5b0771..739415d3261 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -479,9 +479,9 @@ PRIVATE_TID_LIST X(MutationObserver, "MutationObserver", mutation_observer_dispex, Object) \ X(DOMEvent, "Event", DOMEvent_dispex, Object) \ X(DOMCustomEvent, "CustomEvent", DOMCustomEvent_dispex, DOMEvent) \ - X(DOMKeyboardEvent, "KeyboardEvent", DOMKeyboardEvent_dispex, Object) \ + X(DOMKeyboardEvent, "KeyboardEvent", DOMKeyboardEvent_dispex, DOMUIEvent) \ X(DOMMessageEvent, "MessageEvent", DOMMessageEvent_dispex, DOMEvent) \ - X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, Object) \ + X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, DOMUIEvent) \ X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, Object) \ X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, Object) \ X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 67a6da901ba..f286387d36b 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -954,9 +954,11 @@ sync_test("builtin_prototypes", function() { [ "Event", "Object" ], [ "History", "Object" ], [ "HTMLCollection", "Object" ], + [ "KeyboardEvent", "UIEvent" ], [ "MediaQueryList", "Object" ], [ "MessageEvent", "Event" ], [ "MimeTypeArray", "Object" ], + [ "MouseEvent", "UIEvent" ], [ "MSCSSRuleList", "Object" ], [ "MSEventObj", "Object" ], [ "MSMimeTypesCollection", "Object" ], @@ -1002,7 +1004,9 @@ sync_test("builtin_prototypes", function() { [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], + [ "KeyboardEvent", ["altKey","ctrlKey","getModifierState","initKeyboardEvent","key","metaKey"], ["detail","initUIEvent","view"] ], [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], + [ "MouseEvent", ["button","clientX","initMouseEvent","offsetY","pageX","shiftKey","x","y"], ["detail","initUIEvent","view"] ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ], [ "UIEvent", ["detail","initUIEvent","view"], Event_props ] ]; From f6b953fbc2147b1b58172a0f8932fa04b966d16b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0986/1506] mshtml: Set prototype of ProgressEventPrototype to EventPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 739415d3261..df624566a99 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -483,7 +483,7 @@ PRIVATE_TID_LIST X(DOMMessageEvent, "MessageEvent", DOMMessageEvent_dispex, DOMEvent) \ X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, DOMUIEvent) \ X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, Object) \ - X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, Object) \ + X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, DOMEvent) \ X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, Object) \ X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index f286387d36b..f131904bac4 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -974,6 +974,7 @@ sync_test("builtin_prototypes", function() { [ "PerformanceNavigation", "Object" ], [ "PerformanceTiming", "Object" ], [ "PluginArray", "Object" ], + [ "ProgressEvent", "Event" ], [ "Screen", "Object" ], [ "Storage", "Object" ], [ "StyleSheetList", "Object" ], @@ -1007,6 +1008,7 @@ sync_test("builtin_prototypes", function() { [ "KeyboardEvent", ["altKey","ctrlKey","getModifierState","initKeyboardEvent","key","metaKey"], ["detail","initUIEvent","view"] ], [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], [ "MouseEvent", ["button","clientX","initMouseEvent","offsetY","pageX","shiftKey","x","y"], ["detail","initUIEvent","view"] ], + [ "ProgressEvent", ["initProgressEvent","lengthComputable","loaded","total"], Event_props ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ], [ "UIEvent", ["detail","initUIEvent","view"], Event_props ] ]; From 9803810ba1899a85683b1851a32f7ad1ecf70fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0987/1506] mshtml: Set prototype of StorageEventPrototype to EventPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index df624566a99..9027a67ae03 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -484,7 +484,7 @@ PRIVATE_TID_LIST X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, DOMUIEvent) \ X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, Object) \ X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, DOMEvent) \ - X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, Object) \ + X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, DOMEvent) \ X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index f131904bac4..a3301dd8955 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -977,6 +977,7 @@ sync_test("builtin_prototypes", function() { [ "ProgressEvent", "Event" ], [ "Screen", "Object" ], [ "Storage", "Object" ], + [ "StorageEvent", "Event" ], [ "StyleSheetList", "Object" ], [ "Text", "CharacterData" ], [ "TextRange", "Object" ], @@ -1009,6 +1010,7 @@ sync_test("builtin_prototypes", function() { [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], [ "MouseEvent", ["button","clientX","initMouseEvent","offsetY","pageX","shiftKey","x","y"], ["detail","initUIEvent","view"] ], [ "ProgressEvent", ["initProgressEvent","lengthComputable","loaded","total"], Event_props ], + [ "StorageEvent", ["initStorageEvent","key","newValue","oldValue","storageArea"], Event_props ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ], [ "UIEvent", ["detail","initUIEvent","view"], Event_props ] ]; From 1bcec5e22f213e1f2a8b68201c76a010914c7f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0988/1506] mshtml: Set prototype of PageTransitionEventPrototype to EventPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 9027a67ae03..c7762a17d22 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -482,7 +482,7 @@ PRIVATE_TID_LIST X(DOMKeyboardEvent, "KeyboardEvent", DOMKeyboardEvent_dispex, DOMUIEvent) \ X(DOMMessageEvent, "MessageEvent", DOMMessageEvent_dispex, DOMEvent) \ X(DOMMouseEvent, "MouseEvent", DOMMouseEvent_dispex, DOMUIEvent) \ - X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, Object) \ + X(DOMPageTransitionEvent, "PageTransitionEvent", DOMPageTransitionEvent_dispex, DOMEvent) \ X(DOMProgressEvent, "ProgressEvent", DOMProgressEvent_dispex, DOMEvent) \ X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, DOMEvent) \ X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a3301dd8955..2fb5ab330d8 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -970,6 +970,7 @@ sync_test("builtin_prototypes", function() { [ "Navigator", "Object" ], [ "Node", "Object" ], [ "NodeList", "Object" ], + [ "PageTransitionEvent", "Event" ], [ "Performance", "Object" ], [ "PerformanceNavigation", "Object" ], [ "PerformanceTiming", "Object" ], From 079113ea8830a371073c0297e80bc4c89bc31390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0989/1506] mshtml: Introduce ElementPrototype and set it as HTMLElementPrototype's prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface will be used for non-HTML elements (such as XML elements) and its prototype is also the prototype of HTMLElementPrototype. We exlude all the props that are part of HTMLElementPrototype though. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlelem.c | 240 ++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 3 +- dlls/mshtml/tests/documentmode.js | 24 +++ 3 files changed, 266 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index f255dd6a3da..2b1a3d9df49 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -7319,6 +7319,246 @@ static const event_target_vtbl_t HTMLElement_event_target_vtbl = { .handle_event = HTMLElement_handle_event }; +static void DOMElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t elem_hooks[] = { + {DISPID_IHTMLELEMENT_CLASSNAME}, + {DISPID_IHTMLELEMENT_ID}, + {DISPID_IHTMLELEMENT_PARENTELEMENT}, + {DISPID_IHTMLELEMENT_STYLE}, + {DISPID_IHTMLELEMENT_ONHELP}, + {DISPID_IHTMLELEMENT_ONCLICK}, + {DISPID_IHTMLELEMENT_ONDBLCLICK}, + {DISPID_IHTMLELEMENT_ONKEYDOWN}, + {DISPID_IHTMLELEMENT_ONKEYUP}, + {DISPID_IHTMLELEMENT_ONKEYPRESS}, + {DISPID_IHTMLELEMENT_ONMOUSEOUT}, + {DISPID_IHTMLELEMENT_ONMOUSEOVER}, + {DISPID_IHTMLELEMENT_ONMOUSEMOVE}, + {DISPID_IHTMLELEMENT_ONMOUSEDOWN}, + {DISPID_IHTMLELEMENT_ONMOUSEUP}, + {DISPID_IHTMLELEMENT_DOCUMENT}, + {DISPID_IHTMLELEMENT_TITLE}, + {DISPID_IHTMLELEMENT_LANGUAGE}, + {DISPID_IHTMLELEMENT_ONSELECTSTART}, + {DISPID_IHTMLELEMENT_SCROLLINTOVIEW}, + {DISPID_IHTMLELEMENT_CONTAINS}, + {DISPID_IHTMLELEMENT_SOURCEINDEX}, + {DISPID_IHTMLELEMENT_RECORDNUMBER}, + {DISPID_IHTMLELEMENT_LANG}, + {DISPID_IHTMLELEMENT_OFFSETLEFT}, + {DISPID_IHTMLELEMENT_OFFSETTOP}, + {DISPID_IHTMLELEMENT_OFFSETWIDTH}, + {DISPID_IHTMLELEMENT_OFFSETHEIGHT}, + {DISPID_IHTMLELEMENT_OFFSETPARENT}, + {DISPID_IHTMLELEMENT_INNERHTML}, + {DISPID_IHTMLELEMENT_INNERTEXT}, + {DISPID_IHTMLELEMENT_OUTERHTML}, + {DISPID_IHTMLELEMENT_OUTERTEXT}, + {DISPID_IHTMLELEMENT_INSERTADJACENTHTML}, + {DISPID_IHTMLELEMENT_INSERTADJACENTTEXT}, + {DISPID_IHTMLELEMENT_PARENTTEXTEDIT}, + {DISPID_IHTMLELEMENT_ISTEXTEDIT}, + {DISPID_IHTMLELEMENT_CLICK}, + {DISPID_IHTMLELEMENT_FILTERS}, + {DISPID_IHTMLELEMENT_ONDRAGSTART}, + {DISPID_IHTMLELEMENT_TOSTRING}, + {DISPID_IHTMLELEMENT_ONBEFOREUPDATE}, + {DISPID_IHTMLELEMENT_ONAFTERUPDATE}, + {DISPID_IHTMLELEMENT_ONERRORUPDATE}, + {DISPID_IHTMLELEMENT_ONROWEXIT}, + {DISPID_IHTMLELEMENT_ONROWENTER}, + {DISPID_IHTMLELEMENT_ONDATASETCHANGED}, + {DISPID_IHTMLELEMENT_ONDATAAVAILABLE}, + {DISPID_IHTMLELEMENT_ONDATASETCOMPLETE}, + {DISPID_IHTMLELEMENT_ONFILTERCHANGE}, + {DISPID_IHTMLELEMENT_CHILDREN}, + {DISPID_IHTMLELEMENT_ALL}, + {DISPID_UNKNOWN} + }; + static const dispex_hook_t elem2_hooks[] = { + {DISPID_IHTMLELEMENT2_SCOPENAME}, + {DISPID_IHTMLELEMENT2_SETCAPTURE}, + {DISPID_IHTMLELEMENT2_RELEASECAPTURE}, + {DISPID_IHTMLELEMENT2_ONLOSECAPTURE}, + {DISPID_IHTMLELEMENT2_COMPONENTFROMPOINT}, + {DISPID_IHTMLELEMENT2_DOSCROLL}, + {DISPID_IHTMLELEMENT2_ONSCROLL}, + {DISPID_IHTMLELEMENT2_ONDRAG}, + {DISPID_IHTMLELEMENT2_ONDRAGEND}, + {DISPID_IHTMLELEMENT2_ONDRAGENTER}, + {DISPID_IHTMLELEMENT2_ONDRAGOVER}, + {DISPID_IHTMLELEMENT2_ONDRAGLEAVE}, + {DISPID_IHTMLELEMENT2_ONDROP}, + {DISPID_IHTMLELEMENT2_ONBEFORECUT}, + {DISPID_IHTMLELEMENT2_ONCUT}, + {DISPID_IHTMLELEMENT2_ONBEFORECOPY}, + {DISPID_IHTMLELEMENT2_ONCOPY}, + {DISPID_IHTMLELEMENT2_ONBEFOREPASTE}, + {DISPID_IHTMLELEMENT2_ONPASTE}, + {DISPID_IHTMLELEMENT2_CURRENTSTYLE}, + {DISPID_IHTMLELEMENT2_ONPROPERTYCHANGE}, + {DISPID_IHTMLELEMENT2_SETEXPRESSION}, + {DISPID_IHTMLELEMENT2_GETEXPRESSION}, + {DISPID_IHTMLELEMENT2_REMOVEEXPRESSION}, + {DISPID_IHTMLELEMENT2_TABINDEX}, + {DISPID_IHTMLELEMENT2_FOCUS}, + {DISPID_IHTMLELEMENT2_ACCESSKEY}, + {DISPID_IHTMLELEMENT2_ONBLUR}, + {DISPID_IHTMLELEMENT2_ONFOCUS}, + {DISPID_IHTMLELEMENT2_ONRESIZE}, + {DISPID_IHTMLELEMENT2_BLUR}, + {DISPID_IHTMLELEMENT2_ADDFILTER}, + {DISPID_IHTMLELEMENT2_REMOVEFILTER}, + {DISPID_IHTMLELEMENT2_ATTACHEVENT}, + {DISPID_IHTMLELEMENT2_DETACHEVENT}, + {DISPID_IHTMLELEMENT2_READYSTATE}, + {DISPID_IHTMLELEMENT2_ONREADYSTATECHANGE}, + {DISPID_IHTMLELEMENT2_ONROWSDELETE}, + {DISPID_IHTMLELEMENT2_ONROWSINSERTED}, + {DISPID_IHTMLELEMENT2_ONCELLCHANGE}, + {DISPID_IHTMLELEMENT2_DIR}, + {DISPID_IHTMLELEMENT2_CREATECONTROLRANGE}, + {DISPID_IHTMLELEMENT2_CLEARATTRIBUTES}, + {DISPID_IHTMLELEMENT2_MERGEATTRIBUTES}, + {DISPID_IHTMLELEMENT2_ONCONTEXTMENU}, + {DISPID_IHTMLELEMENT2_INSERTADJACENTELEMENT}, + {DISPID_IHTMLELEMENT2_APPLYELEMENT}, + {DISPID_IHTMLELEMENT2_GETADJACENTTEXT}, + {DISPID_IHTMLELEMENT2_REPLACEADJACENTTEXT}, + {DISPID_IHTMLELEMENT2_CANHAVECHILDREN}, + {DISPID_IHTMLELEMENT2_ADDBEHAVIOR}, + {DISPID_IHTMLELEMENT2_REMOVEBEHAVIOR}, + {DISPID_IHTMLELEMENT2_RUNTIMESTYLE}, + {DISPID_IHTMLELEMENT2_BEHAVIORURNS}, + {DISPID_IHTMLELEMENT2_TAGURN}, + {DISPID_IHTMLELEMENT2_ONBEFOREEDITFOCUS}, + {DISPID_IHTMLELEMENT2_READYSTATEVALUE}, + {DISPID_UNKNOWN} + }; + static const dispex_hook_t elem3_hooks[] = { + {DISPID_IHTMLELEMENT3_MERGEATTRIBUTES}, + {DISPID_IHTMLELEMENT3_ISMULTILINE}, + {DISPID_IHTMLELEMENT3_CANHAVEHTML}, + {DISPID_IHTMLELEMENT3_ONLAYOUTCOMPLETE}, + {DISPID_IHTMLELEMENT3_ONPAGE}, + {DISPID_IHTMLELEMENT3_INFLATEBLOCK}, + {DISPID_IHTMLELEMENT3_ONBEFOREDEACTIVATE}, + {DISPID_IHTMLELEMENT3_SETACTIVE}, + {DISPID_IHTMLELEMENT3_CONTENTEDITABLE}, + {DISPID_IHTMLELEMENT3_ISCONTENTEDITABLE}, + {DISPID_IHTMLELEMENT3_HIDEFOCUS}, + {DISPID_IHTMLELEMENT3_DISABLED}, + {DISPID_IHTMLELEMENT3_ISDISABLED}, + {DISPID_IHTMLELEMENT3_ONMOVE}, + {DISPID_IHTMLELEMENT3_ONCONTROLSELECT}, + {DISPID_IHTMLELEMENT3_FIREEVENT}, + {DISPID_IHTMLELEMENT3_ONRESIZESTART}, + {DISPID_IHTMLELEMENT3_ONRESIZEEND}, + {DISPID_IHTMLELEMENT3_ONMOVESTART}, + {DISPID_IHTMLELEMENT3_ONMOVEEND}, + {DISPID_IHTMLELEMENT3_ONMOUSEENTER}, + {DISPID_IHTMLELEMENT3_ONMOUSELEAVE}, + {DISPID_IHTMLELEMENT3_ONACTIVATE}, + {DISPID_IHTMLELEMENT3_ONDEACTIVATE}, + {DISPID_IHTMLELEMENT3_DRAGDROP}, + {DISPID_IHTMLELEMENT3_GLYPHMODE}, + {DISPID_UNKNOWN} + }; + static const dispex_hook_t elem4_hooks[] = { + {DISPID_IHTMLELEMENT4_ONMOUSEWHEEL}, + {DISPID_IHTMLELEMENT4_NORMALIZE}, + {DISPID_IHTMLELEMENT4_ONBEFOREACTIVATE}, + {DISPID_IHTMLELEMENT4_ONFOCUSIN}, + {DISPID_IHTMLELEMENT4_ONFOCUSOUT}, + {DISPID_UNKNOWN} + }; + static const dispex_hook_t elem6_ie10_hooks[] = { + {DISPID_IHTMLELEMENT6_HASATTRIBUTENS, IHTMLElement6_hasAttributeNS_hook}, + {DISPID_IHTMLELEMENT6_GETATTRIBUTENS, IHTMLElement6_getAttributeNS_hook}, + {DISPID_IHTMLELEMENT6_REMOVEATTRIBUTENS, IHTMLElement6_removeAttributeNS_hook}, + {DISPID_IHTMLELEMENT6_IE9_SETATTRIBUTE, IHTMLElement6_setAttribute_hook}, + + /* common for all supported modes */ + {DISPID_IHTMLELEMENT6_SETATTRIBUTENS, IHTMLElement6_setAttributeNS_hook}, + + {DISPID_IHTMLELEMENT6_IE9_NODENAME}, + {DISPID_IHTMLELEMENT6_GETELEMENTSBYCLASSNAME}, + {DISPID_IHTMLELEMENT6_ONABORT}, + {DISPID_IHTMLELEMENT6_ONCANPLAY}, + {DISPID_IHTMLELEMENT6_ONCANPLAYTHROUGH}, + {DISPID_IHTMLELEMENT6_ONCHANGE}, + {DISPID_IHTMLELEMENT6_ONDURATIONCHANGE}, + {DISPID_IHTMLELEMENT6_ONEMPTIED}, + {DISPID_IHTMLELEMENT6_ONENDED}, + {DISPID_IHTMLELEMENT6_ONERROR}, + {DISPID_IHTMLELEMENT6_ONINPUT}, + {DISPID_IHTMLELEMENT6_ONLOAD}, + {DISPID_IHTMLELEMENT6_ONLOADEDDATA}, + {DISPID_IHTMLELEMENT6_ONLOADEDMETADATA}, + {DISPID_IHTMLELEMENT6_ONLOADSTART}, + {DISPID_IHTMLELEMENT6_ONPAUSE}, + {DISPID_IHTMLELEMENT6_ONPLAY}, + {DISPID_IHTMLELEMENT6_ONPLAYING}, + {DISPID_IHTMLELEMENT6_ONPROGRESS}, + {DISPID_IHTMLELEMENT6_ONRATECHANGE}, + {DISPID_IHTMLELEMENT6_ONRESET}, + {DISPID_IHTMLELEMENT6_ONSEEKED}, + {DISPID_IHTMLELEMENT6_ONSEEKING}, + {DISPID_IHTMLELEMENT6_ONSELECT}, + {DISPID_IHTMLELEMENT6_ONSTALLED}, + {DISPID_IHTMLELEMENT6_ONSUBMIT}, + {DISPID_IHTMLELEMENT6_ONSUSPEND}, + {DISPID_IHTMLELEMENT6_ONTIMEUPDATE}, + {DISPID_IHTMLELEMENT6_ONVOLUMECHANGE}, + {DISPID_IHTMLELEMENT6_ONWAITING}, + {DISPID_IHTMLELEMENT6_IE9_HASATTRIBUTES}, + {DISPID_UNKNOWN} + }; + const dispex_hook_t *const elem6_hooks = elem6_ie10_hooks + 4; + static const dispex_hook_t elem7_hooks[] = { + {DISPID_IHTMLELEMENT7_ONMSPOINTERHOVER}, + {DISPID_IHTMLELEMENT7_ONMSTRANSITIONSTART}, + {DISPID_IHTMLELEMENT7_ONMSTRANSITIONEND}, + {DISPID_IHTMLELEMENT7_ONMSANIMATIONSTART}, + {DISPID_IHTMLELEMENT7_ONMSANIMATIONEND}, + {DISPID_IHTMLELEMENT7_ONMSANIMATIONITERATION}, + {DISPID_IHTMLELEMENT7_ONINVALID}, + {DISPID_IHTMLELEMENT7_XMSACCELERATORKEY}, + {DISPID_IHTMLELEMENT7_SPELLCHECK}, + {DISPID_IHTMLELEMENT7_ONMSMANIPULATIONSTATECHANGED}, + {DISPID_IHTMLELEMENT7_ONCUECHANGE}, + {DISPID_UNKNOWN} + }; + static const tid_t hookless_tids[] = { + IHTMLDOMNode_tid, + IHTMLDOMNode2_tid, + IElementSelector_tid, + IElementTraversal_tid, + 0 + }; + unsigned i; + + dispex_info_add_interface(info, IHTMLElement2_tid, elem2_hooks); + dispex_info_add_interface(info, IHTMLElement6_tid, mode >= COMPAT_MODE_IE10 ? elem6_ie10_hooks : elem6_hooks); + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IHTMLElement7_tid, elem7_hooks); + dispex_info_add_interface(info, IHTMLElement_tid, elem_hooks); + dispex_info_add_interface(info, IHTMLElement3_tid, elem3_hooks); + dispex_info_add_interface(info, IHTMLElement4_tid, elem4_hooks); + for(i = 0; i < ARRAY_SIZE(hookless_tids); i++) + dispex_info_add_interface(info, hookless_tids[i], NULL); +} + +dispex_static_data_t DOMElement_dispex = { + "Element", + &no_dispex_vtbl, + PROTO_ID_DOMElement, + NULL_tid, + no_iface_tids, + DOMElement_init_dispex_info +}; + struct token_list { DispatchEx dispex; IWineDOMTokenList IWineDOMTokenList_iface; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c7762a17d22..386b918f208 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -444,7 +444,7 @@ PRIVATE_TID_LIST X(HTMLW3CComputedStyle, "CSSStyleDeclaration", HTMLW3CComputedStyle_dispex, Object) \ X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, Object) \ X(HTMLStyleSheetRule, "CSSStyleRule", HTMLStyleSheetRule_dispex, Object) \ - X(HTMLElement, "HTMLElement", HTMLElement_dispex, Object) \ + X(HTMLElement, "HTMLElement", HTMLElement_dispex, DOMElement) \ X(HTMLGenericElement, "HTMLUnknownElement", HTMLGenericElement_dispex, Object) \ X(HTMLAnchorElement, "HTMLAnchorElement", HTMLAnchorElement_dispex, Object) \ X(HTMLAreaElement, "HTMLAreaElement", HTMLAreaElement_dispex, Object) \ @@ -488,6 +488,7 @@ PRIVATE_TID_LIST X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ + X(DOMElement, "Element", DOMElement_dispex, HTMLDOMNode) \ X(MediaQueryList, "MediaQueryList", media_query_list_dispex, Object) \ X(DOMTokenList, "DOMTokenList", token_list_dispex, Object) \ X(HTMLDOMNode, "Node", HTMLDOMNode_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 2fb5ab330d8..3ee4d399905 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -951,9 +951,11 @@ sync_test("builtin_prototypes", function() { [ "DocumentType", "Node" ], [ "DOMImplementation", "Object" ], [ "DOMTokenList", "Object" ], + [ "Element", "Node" ], [ "Event", "Object" ], [ "History", "Object" ], [ "HTMLCollection", "Object" ], + [ "HTMLElement", "Element" ], [ "KeyboardEvent", "UIEvent" ], [ "MediaQueryList", "Object" ], [ "MessageEvent", "Event" ], @@ -995,8 +997,27 @@ sync_test("builtin_prototypes", function() { ok(a === b, "getPrototypeOf(" + protos[i][0] + ".prototype) = " + a); } + var Elem_props = [ "clientHeight","clientLeft","clientTop","clientWidth","firstElementChild","getAttribute","getAttributeNode","getAttributeNodeNS", + "getAttributeNS","getBoundingClientRect","getClientRects","getElementsByTagName","getElementsByTagNameNS","hasAttribute", + "hasAttributeNS","lastElementChild","msMatchesSelector","nextElementSibling","previousElementSibling","querySelector", + "removeAttribute","removeAttributeNode","removeAttributeNS","scrollHeight","scrollLeft","scrollTop","scrollWidth","setAttribute", + "setAttributeNode","setAttributeNodeNS","setAttributeNS","tagName" ]; var Event_props = [ "bubbles","cancelable","cancelBubble","currentTarget","defaultPrevented","eventPhase","initEvent","isTrusted", "preventDefault","srcElement","stopImmediatePropagation","stopPropagation","target","timeStamp","type" ]; + var HtmlElem_props = [ "accessKey","applyElement","blur","canHaveHTML","children","className","clearAttributes","click","componentFromPoint", + "contains","contentEditable","createControlRange","currentStyle","dir","disabled","dragDrop","focus","getAdjacentText", + "getElementsByClassName","hideFocus","id","innerHTML","innerText","insertAdjacentElement","insertAdjacentHTML", + "insertAdjacentText","isContentEditable","isDisabled","isMultiLine","isTextEdit","lang","language","mergeAttributes", + "offsetHeight","offsetLeft","offsetParent","offsetTop","offsetWidth","onabort","onactivate","onbeforeactivate","onbeforecopy", + "onbeforecut","onbeforedeactivate","onbeforepaste","onblur","oncanplay","oncanplaythrough","onchange","onclick", + "oncontextmenu","oncopy","oncut","ondblclick","ondeactivate","ondrag","ondragend","ondragenter","ondragleave","ondragover", + "ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onhelp", + "oninput","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown", + "onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpaste","onpause","onplay","onplaying", + "onprogress","onratechange","onreset","onscroll","onseeked","onseeking","onselect","onselectstart","onstalled","onsubmit", + "onsuspend","ontimeupdate","onvolumechange","onwaiting","outerHTML","outerText","parentElement","parentTextEdit", + "recordNumber","releaseCapture","replaceAdjacentText","runtimeStyle","scrollIntoView","setActive","setCapture","sourceIndex", + "style","tabIndex","title","uniqueID","uniqueNumber" ]; var Node_props = [ "addEventListener","appendChild","attributes","childNodes","cloneNode","compareDocumentPosition","dispatchEvent","firstChild", "hasChildNodes","insertBefore","isDefaultNamespace","isEqualNode","isSameNode","isSupported","lastChild","localName", "lookupNamespaceURI","lookupPrefix","namespaceURI","nextSibling","nodeName","nodeType","nodeValue","ownerDocument", @@ -1007,6 +1028,8 @@ sync_test("builtin_prototypes", function() { [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], + [ "Element", Elem_props, Node_props ], + [ "HTMLElement", HtmlElem_props, Elem_props ], [ "KeyboardEvent", ["altKey","ctrlKey","getModifierState","initKeyboardEvent","key","metaKey"], ["detail","initUIEvent","view"] ], [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], [ "MouseEvent", ["button","clientX","initMouseEvent","offsetY","pageX","shiftKey","x","y"], ["detail","initUIEvent","view"] ], @@ -1256,6 +1279,7 @@ sync_test("builtin_constructors", function() { [ "DocumentType" ], [ "DOMImplementation" ], [ "DOMTokenList", 10 ], + [ "Element" ], [ "Event" ], [ "History" ], [ "HTMLAnchorElement" ], From 5433fd4253760084a5b93df9b1ea7cf5d47405db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0990/1506] mshtml: Set prototype of other HTML elements to HTMLElementPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 52 +++++++++++++++---------------- dlls/mshtml/tests/documentmode.js | 28 +++++++++++++++++ 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 386b918f208..1e891ac47f3 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -445,33 +445,33 @@ PRIVATE_TID_LIST X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, Object) \ X(HTMLStyleSheetRule, "CSSStyleRule", HTMLStyleSheetRule_dispex, Object) \ X(HTMLElement, "HTMLElement", HTMLElement_dispex, DOMElement) \ - X(HTMLGenericElement, "HTMLUnknownElement", HTMLGenericElement_dispex, Object) \ - X(HTMLAnchorElement, "HTMLAnchorElement", HTMLAnchorElement_dispex, Object) \ - X(HTMLAreaElement, "HTMLAreaElement", HTMLAreaElement_dispex, Object) \ - X(HTMLBodyElement, "HTMLBodyElement", HTMLBodyElement_dispex, Object) \ - X(HTMLButtonElement, "HTMLButtonElement", HTMLButtonElement_dispex, Object) \ + X(HTMLGenericElement, "HTMLUnknownElement", HTMLGenericElement_dispex, HTMLElement) \ + X(HTMLAnchorElement, "HTMLAnchorElement", HTMLAnchorElement_dispex, HTMLElement) \ + X(HTMLAreaElement, "HTMLAreaElement", HTMLAreaElement_dispex, HTMLElement) \ + X(HTMLBodyElement, "HTMLBodyElement", HTMLBodyElement_dispex, HTMLElement) \ + X(HTMLButtonElement, "HTMLButtonElement", HTMLButtonElement_dispex, HTMLElement) \ X(HTMLCommentElement, "Comment", HTMLCommentElement_dispex, DOMCharacterData) \ - X(HTMLEmbedElement, "HTMLEmbedElement", HTMLEmbedElement_dispex, Object) \ - X(HTMLFormElement, "HTMLFormElement", HTMLFormElement_dispex, Object) \ - X(HTMLFrameElement, "HTMLFrameElement", HTMLFrameElement_dispex, Object) \ - X(HTMLHeadElement, "HTMLHeadElement", HTMLHeadElement_dispex, Object) \ - X(HTMLHtmlElement, "HTMLHtmlElement", HTMLHtmlElement_dispex, Object) \ - X(HTMLIFrameElement, "HTMLIFrameElement", HTMLIFrame_dispex, Object) \ - X(HTMLImgElement, "HTMLImageElement", HTMLImgElement_dispex, Object) \ - X(HTMLInputElement, "HTMLInputElement", HTMLInputElement_dispex, Object) \ - X(HTMLLabelElement, "HTMLLabelElement", HTMLLabelElement_dispex, Object) \ - X(HTMLLinkElement, "HTMLLinkElement", HTMLLinkElement_dispex, Object) \ - X(HTMLMetaElement, "HTMLMetaElement", HTMLMetaElement_dispex, Object) \ - X(HTMLObjectElement, "HTMLObjectElement", HTMLObjectElement_dispex, Object) \ - X(HTMLOptionElement, "HTMLOptionElement", HTMLOptionElement_dispex, Object) \ - X(HTMLScriptElement, "HTMLScriptElement", HTMLScriptElement_dispex, Object) \ - X(HTMLSelectElement, "HTMLSelectElement", HTMLSelectElement_dispex, Object) \ - X(HTMLStyleElement, "HTMLStyleElement", HTMLStyleElement_dispex, Object) \ - X(HTMLTableElement, "HTMLTableElement", HTMLTable_dispex, Object) \ - X(HTMLTableCellElement, "HTMLTableDataCellElement", HTMLTableCell_dispex, Object) \ - X(HTMLTableRowElement, "HTMLTableRowElement", HTMLTableRow_dispex, Object) \ - X(HTMLTextAreaElement, "HTMLTextAreaElement", HTMLTextAreaElement_dispex, Object) \ - X(HTMLTitleElement, "HTMLTitleElement", HTMLTitleElement_dispex, Object) + X(HTMLEmbedElement, "HTMLEmbedElement", HTMLEmbedElement_dispex, HTMLElement) \ + X(HTMLFormElement, "HTMLFormElement", HTMLFormElement_dispex, HTMLElement) \ + X(HTMLFrameElement, "HTMLFrameElement", HTMLFrameElement_dispex, HTMLElement) \ + X(HTMLHeadElement, "HTMLHeadElement", HTMLHeadElement_dispex, HTMLElement) \ + X(HTMLHtmlElement, "HTMLHtmlElement", HTMLHtmlElement_dispex, HTMLElement) \ + X(HTMLIFrameElement, "HTMLIFrameElement", HTMLIFrame_dispex, HTMLElement) \ + X(HTMLImgElement, "HTMLImageElement", HTMLImgElement_dispex, HTMLElement) \ + X(HTMLInputElement, "HTMLInputElement", HTMLInputElement_dispex, HTMLElement) \ + X(HTMLLabelElement, "HTMLLabelElement", HTMLLabelElement_dispex, HTMLElement) \ + X(HTMLLinkElement, "HTMLLinkElement", HTMLLinkElement_dispex, HTMLElement) \ + X(HTMLMetaElement, "HTMLMetaElement", HTMLMetaElement_dispex, HTMLElement) \ + X(HTMLObjectElement, "HTMLObjectElement", HTMLObjectElement_dispex, HTMLElement) \ + X(HTMLOptionElement, "HTMLOptionElement", HTMLOptionElement_dispex, HTMLElement) \ + X(HTMLScriptElement, "HTMLScriptElement", HTMLScriptElement_dispex, HTMLElement) \ + X(HTMLSelectElement, "HTMLSelectElement", HTMLSelectElement_dispex, HTMLElement) \ + X(HTMLStyleElement, "HTMLStyleElement", HTMLStyleElement_dispex, HTMLElement) \ + X(HTMLTableElement, "HTMLTableElement", HTMLTable_dispex, HTMLElement) \ + X(HTMLTableCellElement, "HTMLTableDataCellElement", HTMLTableCell_dispex, HTMLElement) \ + X(HTMLTableRowElement, "HTMLTableRowElement", HTMLTableRow_dispex, HTMLElement) \ + X(HTMLTextAreaElement, "HTMLTextAreaElement", HTMLTextAreaElement_dispex, HTMLElement) \ + X(HTMLTitleElement, "HTMLTitleElement", HTMLTitleElement_dispex, HTMLElement) #define PROXY_PROTOTYPE_LIST \ X(Console, "Console", console_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 3ee4d399905..334e51ec586 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -954,8 +954,34 @@ sync_test("builtin_prototypes", function() { [ "Element", "Node" ], [ "Event", "Object" ], [ "History", "Object" ], + [ "HTMLAnchorElement", "HTMLElement" ], + [ "HTMLAreaElement", "HTMLElement" ], + [ "HTMLBodyElement", "HTMLElement" ], + [ "HTMLButtonElement", "HTMLElement" ], [ "HTMLCollection", "Object" ], [ "HTMLElement", "Element" ], + [ "HTMLEmbedElement", "HTMLElement" ], + [ "HTMLFormElement", "HTMLElement" ], + [ "HTMLFrameElement", "HTMLElement" ], + [ "HTMLHeadElement", "HTMLElement" ], + [ "HTMLHtmlElement", "HTMLElement" ], + [ "HTMLIFrameElement", "HTMLElement" ], + [ "HTMLImgElement", "HTMLElement" ], + [ "HTMLInputElement", "HTMLElement" ], + [ "HTMLLabelElement", "HTMLElement" ], + [ "HTMLLinkElement", "HTMLElement" ], + [ "HTMLMetaElement", "HTMLElement" ], + [ "HTMLObjectElement", "HTMLElement" ], + [ "HTMLOptionElement", "HTMLElement" ], + [ "HTMLScriptElement", "HTMLElement" ], + [ "HTMLSelectElement", "HTMLElement" ], + [ "HTMLStyleElement", "HTMLElement" ], + [ "HTMLTableElement", "HTMLElement" ], + [ "HTMLTableRowElement", "HTMLElement" ], + [ "HTMLTextAreaElement", "HTMLElement" ], + [ "HTMLTitleElement", "HTMLElement" ], + [ "HTMLUnknownElement", "HTMLElement" ], + [ "Image", "HTMLElement" ], [ "KeyboardEvent", "UIEvent" ], [ "MediaQueryList", "Object" ], [ "MessageEvent", "Event" ], @@ -972,6 +998,7 @@ sync_test("builtin_prototypes", function() { [ "Navigator", "Object" ], [ "Node", "Object" ], [ "NodeList", "Object" ], + [ "Option", "HTMLElement" ], [ "PageTransitionEvent", "Event" ], [ "Performance", "Object" ], [ "PerformanceNavigation", "Object" ], @@ -1030,6 +1057,7 @@ sync_test("builtin_prototypes", function() { [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], [ "Element", Elem_props, Node_props ], [ "HTMLElement", HtmlElem_props, Elem_props ], + [ "HTMLUnknownElement", ["recordset","namedRecordset"], HtmlElem_props ], [ "KeyboardEvent", ["altKey","ctrlKey","getModifierState","initKeyboardEvent","key","metaKey"], ["detail","initUIEvent","view"] ], [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], [ "MouseEvent", ["button","clientX","initMouseEvent","offsetY","pageX","shiftKey","x","y"], ["detail","initUIEvent","view"] ], From f93247aab7bd565240b27d76566162bb9ee9c4bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0991/1506] mshtml: Introduce HTMLTableCellElementPrototype and set it as HTMLTableDataCellElementPrototype's prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface is abstract, and is only used in prototype chains (and constructor), so we needn't implement any of it. HTMLTableDataCellElementPrototype is, in fact, empty (other than its "constructor" prop). Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmltable.c | 15 +++++++++++++++ dlls/mshtml/mshtml_private.h | 5 +++-- dlls/mshtml/tests/documentmode.js | 7 +++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index 64169b074cc..77e5878024d 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -527,6 +527,21 @@ HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLE return S_OK; } +/* dummy dispex used only for HTMLTableCellElementPrototype in prototype chain */ +static void HTMLTableCellProt_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + dispex_info_add_interface(info, IHTMLTableCell_tid, NULL); +} + +dispex_static_data_t HTMLTableCellProt_dispex = { + "HTMLTableCellElement", + &no_dispex_vtbl, + PROTO_ID_HTMLTableCellProt, + NULL_tid, + no_iface_tids, + HTMLTableCellProt_init_dispex_info +}; + struct HTMLTableRow { HTMLElement element; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1e891ac47f3..be986c3952c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -468,7 +468,7 @@ PRIVATE_TID_LIST X(HTMLSelectElement, "HTMLSelectElement", HTMLSelectElement_dispex, HTMLElement) \ X(HTMLStyleElement, "HTMLStyleElement", HTMLStyleElement_dispex, HTMLElement) \ X(HTMLTableElement, "HTMLTableElement", HTMLTable_dispex, HTMLElement) \ - X(HTMLTableCellElement, "HTMLTableDataCellElement", HTMLTableCell_dispex, HTMLElement) \ + X(HTMLTableCellElement, "HTMLTableDataCellElement", HTMLTableCell_dispex, HTMLTableCellProt) \ X(HTMLTableRowElement, "HTMLTableRowElement", HTMLTableRow_dispex, HTMLElement) \ X(HTMLTextAreaElement, "HTMLTextAreaElement", HTMLTextAreaElement_dispex, HTMLElement) \ X(HTMLTitleElement, "HTMLTitleElement", HTMLTitleElement_dispex, HTMLElement) @@ -497,7 +497,8 @@ PRIVATE_TID_LIST X(HTMLPerformance, "Performance", HTMLPerformance_dispex, Object) \ X(HTMLPerformanceNavigation, "PerformanceNavigation", HTMLPerformanceNavigation_dispex, Object) \ X(HTMLPerformanceTiming, "PerformanceTiming", HTMLPerformanceTiming_dispex, Object) \ - X(HTMLStyle, "MSStyleCSSProperties", HTMLStyle_dispex, Object) + X(HTMLStyle, "MSStyleCSSProperties", HTMLStyle_dispex, Object) \ + X(HTMLTableCellProt, "HTMLTableCellElement", HTMLTableCellProt_dispex, HTMLElement) typedef enum { PROTO_ID_NULL = -2, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 334e51ec586..fcb4a100f73 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -976,6 +976,8 @@ sync_test("builtin_prototypes", function() { [ "HTMLScriptElement", "HTMLElement" ], [ "HTMLSelectElement", "HTMLElement" ], [ "HTMLStyleElement", "HTMLElement" ], + [ "HTMLTableCellElement", "HTMLElement" ], + [ "HTMLTableDataCellElement", "HTMLTableCellElement" ], [ "HTMLTableElement", "HTMLElement" ], [ "HTMLTableRowElement", "HTMLElement" ], [ "HTMLTextAreaElement", "HTMLElement" ], @@ -1049,6 +1051,8 @@ sync_test("builtin_prototypes", function() { "hasChildNodes","insertBefore","isDefaultNamespace","isEqualNode","isSameNode","isSupported","lastChild","localName", "lookupNamespaceURI","lookupPrefix","namespaceURI","nextSibling","nodeName","nodeType","nodeValue","ownerDocument", "parentNode","prefix","previousSibling","removeChild","removeEventListener","replaceChild","textContent" ]; + var TableCell_props = [ "align","background","bgColor","borderColor","borderColorDark","borderColorLight","cellIndex","colSpan","height","noWrap", + "rowSpan","vAlign","width" ]; protos = [ [ "CharacterData", ["data","length","appendData"], Node_props ], @@ -1057,6 +1061,8 @@ sync_test("builtin_prototypes", function() { [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], [ "Element", Elem_props, Node_props ], [ "HTMLElement", HtmlElem_props, Elem_props ], + [ "HTMLTableCellElement", TableCell_props, HtmlElem_props ], + [ "HTMLTableDataCellElement", [], TableCell_props ], [ "HTMLUnknownElement", ["recordset","namedRecordset"], HtmlElem_props ], [ "KeyboardEvent", ["altKey","ctrlKey","getModifierState","initKeyboardEvent","key","metaKey"], ["detail","initUIEvent","view"] ], [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], @@ -1332,6 +1338,7 @@ sync_test("builtin_constructors", function() { [ "HTMLScriptElement" ], [ "HTMLSelectElement" ], [ "HTMLStyleElement" ], + [ "HTMLTableCellElement" ], [ "HTMLTableDataCellElement" ], [ "HTMLTableElement" ], [ "HTMLTableRowElement" ], From 576a71e1e0da0ffbd2637a49394151557587e74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:28 +0200 Subject: [PATCH 0992/1506] mshtml: Implement the relevant IHTMLStyle* interface props for HTMLCurrentStyle. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They'll use a common prototype, which is based on IHTMLStyle interface props, and will implicitly use this. The props not exposed by the prototype are not implemented and return E_UNEXPECTED, while setters are ignored (as would be if they weren't available on the object). Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlcurstyle.c | 2839 ++++++++++++++++++++++++++++++++++++ 1 file changed, 2839 insertions(+) diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index 9f42a8e39a4..ab6a0bd465a 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -38,6 +38,11 @@ struct HTMLCurrentStyle { IHTMLCurrentStyle2 IHTMLCurrentStyle2_iface; IHTMLCurrentStyle3 IHTMLCurrentStyle3_iface; IHTMLCurrentStyle4 IHTMLCurrentStyle4_iface; + IHTMLStyle IHTMLStyle_iface; + IHTMLStyle2 IHTMLStyle2_iface; + IHTMLStyle3 IHTMLStyle3_iface; + IHTMLStyle5 IHTMLStyle5_iface; + IHTMLStyle6 IHTMLStyle6_iface; HTMLElement *elem; }; @@ -72,6 +77,31 @@ static inline HTMLCurrentStyle *impl_from_IHTMLCurrentStyle4(IHTMLCurrentStyle4 return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLCurrentStyle4_iface); } +static inline HTMLCurrentStyle *impl_from_IHTMLStyle(IHTMLStyle *iface) +{ + return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLStyle_iface); +} + +static inline HTMLCurrentStyle *impl_from_IHTMLStyle2(IHTMLStyle2 *iface) +{ + return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLStyle2_iface); +} + +static inline HTMLCurrentStyle *impl_from_IHTMLStyle3(IHTMLStyle3 *iface) +{ + return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLStyle3_iface); +} + +static inline HTMLCurrentStyle *impl_from_IHTMLStyle5(IHTMLStyle5 *iface) +{ + return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLStyle5_iface); +} + +static inline HTMLCurrentStyle *impl_from_IHTMLStyle6(IHTMLStyle6 *iface) +{ + return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLStyle6_iface); +} + static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv) { HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface); @@ -1278,6 +1308,2800 @@ static const IHTMLCurrentStyle4Vtbl HTMLCurrentStyle4Vtbl = { HTMLCurrentStyle4_get_maxWidth }; +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, void **ppv) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IHTMLCurrentStyle_QueryInterface(&This->IHTMLCurrentStyle_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle_AddRef(IHTMLStyle *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IHTMLCurrentStyle_AddRef(&This->IHTMLCurrentStyle_iface); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle_Release(IHTMLStyle *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IHTMLCurrentStyle_Release(&This->IHTMLCurrentStyle_iface); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_GetTypeInfoCount(IHTMLStyle *iface, UINT *pctinfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IDispatchEx_GetTypeInfoCount(&This->css_style.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_GetTypeInfo(IHTMLStyle *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IDispatchEx_GetTypeInfo(&This->css_style.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_GetIDsOfNames(IHTMLStyle *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IDispatchEx_GetIDsOfNames(&This->css_style.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_Invoke(IHTMLStyle *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + return IDispatchEx_Invoke(&This->css_style.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_fontFamily(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_fontFamily(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_fontStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_fontStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_fontVariant(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_fontVariant(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_fontWeight(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_fontWeight(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_fontSize(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_fontSize(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_font(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_font(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_color(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_color(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_background(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_background(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundColor(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundColor(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + TRACE("(%p)->(%p)\n", This, p); + return IHTMLCSSStyleDeclaration_get_backgroundPositionX(&This->css_style.IHTMLCSSStyleDeclaration_iface, p); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_backgroundPositionY(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + TRACE("(%p)->(%p)\n", This, p); + return IHTMLCSSStyleDeclaration_get_backgroundPositionY(&This->css_style.IHTMLCSSStyleDeclaration_iface, p); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_wordSpacing(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_wordSpacing(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_letterSpacing(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_letterSpacing(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textDecoration(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textDecoration(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%x)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%x)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%x)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%x)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%x)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_verticalAlign(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textTransform(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textTransform(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textAlign(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textAlign(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_marginTop(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_marginRight(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_marginBottom(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_marginLeft(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_margin(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_margin(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_paddingTop(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_paddingRight(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_paddingRight(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_paddingBottom(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_paddingBottom(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_paddingLeft(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_paddingLeft(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_padding(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_padding(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_border(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_border(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderTop(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderTop(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderRight(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderRight(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderBottom(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderBottom(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderLeft(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderLeft(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderColor(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderColor(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderTopColor(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderTopColor(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderRightColor(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderRightColor(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderBottomColor(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderBottomColor(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderLeftColor(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderLeftColor(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderWidth(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderWidth(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderTopWidth(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderTopWidth(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderRightWidth(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderRightWidth(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderBottomWidth(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderBottomWidth(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderLeftWidth(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderTopStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderRightStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderRightStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderBottomStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderBottomStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_borderLeftStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_borderLeftStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_width(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_width(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_height(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_height(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_styleFloat(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_styleFloat(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + TRACE("(%p)->(%p)\n", This, p); + return get_current_style_property(This, STYLEID_FLOAT, p); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_clear(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_clear(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_display(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_display(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_visibility(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_visibility(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_listStyleType(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_listStyleType(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_listStyleImage(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_whiteSpace(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_top(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_top(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_left(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_pageBreakBefore(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_pageBreakAfter(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_pageBreakAfter(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_cssText(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%ld)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%ld)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_pixelLeft(IHTMLStyle *iface, LONG *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->()\n", This); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_pixelWidth(IHTMLStyle *iface, LONG *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%ld)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_pixelHeight(IHTMLStyle *iface, LONG *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_posTop(IHTMLStyle *iface, float v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%f)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_posTop(IHTMLStyle *iface, float *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_posLeft(IHTMLStyle *iface, float v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%f)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_posLeft(IHTMLStyle *iface, float *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_posWidth(IHTMLStyle *iface, float v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%f)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_posWidth(IHTMLStyle *iface, float *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_posHeight(IHTMLStyle *iface, float v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%f)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_posHeight(IHTMLStyle *iface, float *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_cursor(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_get_filter(IHTMLStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttributeName, + VARIANT AttributeValue, LONG lFlags) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + FIXME("(%p)->(%s %s %08lx)\n", This, debugstr_w(strAttributeName), + debugstr_variant(&AttributeValue), lFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttributeName, + LONG lFlags, VARIANT *AttributeValue) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + FIXME("(%p)->(%s v%p %08lx)\n", This, debugstr_w(strAttributeName), AttributeValue, lFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttributeName, + LONG lFlags, VARIANT_BOOL *pfSuccess) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + FIXME("(%p)->(%s %08lx %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle_toString(IHTMLStyle *iface, BSTR *String) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle(iface); + WARN("(%p)->(%p)\n", This, String); + return E_UNEXPECTED; +} + +static const IHTMLStyleVtbl HTMLStyleVtbl = { + HTMLCurrentStyle_HTMLStyle_QueryInterface, + HTMLCurrentStyle_HTMLStyle_AddRef, + HTMLCurrentStyle_HTMLStyle_Release, + HTMLCurrentStyle_HTMLStyle_GetTypeInfoCount, + HTMLCurrentStyle_HTMLStyle_GetTypeInfo, + HTMLCurrentStyle_HTMLStyle_GetIDsOfNames, + HTMLCurrentStyle_HTMLStyle_Invoke, + HTMLCurrentStyle_HTMLStyle_put_fontFamily, + HTMLCurrentStyle_HTMLStyle_get_fontFamily, + HTMLCurrentStyle_HTMLStyle_put_fontStyle, + HTMLCurrentStyle_HTMLStyle_get_fontStyle, + HTMLCurrentStyle_HTMLStyle_put_fontVariant, + HTMLCurrentStyle_HTMLStyle_get_fontVariant, + HTMLCurrentStyle_HTMLStyle_put_fontWeight, + HTMLCurrentStyle_HTMLStyle_get_fontWeight, + HTMLCurrentStyle_HTMLStyle_put_fontSize, + HTMLCurrentStyle_HTMLStyle_get_fontSize, + HTMLCurrentStyle_HTMLStyle_put_font, + HTMLCurrentStyle_HTMLStyle_get_font, + HTMLCurrentStyle_HTMLStyle_put_color, + HTMLCurrentStyle_HTMLStyle_get_color, + HTMLCurrentStyle_HTMLStyle_put_background, + HTMLCurrentStyle_HTMLStyle_get_background, + HTMLCurrentStyle_HTMLStyle_put_backgroundColor, + HTMLCurrentStyle_HTMLStyle_get_backgroundColor, + HTMLCurrentStyle_HTMLStyle_put_backgroundImage, + HTMLCurrentStyle_HTMLStyle_get_backgroundImage, + HTMLCurrentStyle_HTMLStyle_put_backgroundRepeat, + HTMLCurrentStyle_HTMLStyle_get_backgroundRepeat, + HTMLCurrentStyle_HTMLStyle_put_backgroundAttachment, + HTMLCurrentStyle_HTMLStyle_get_backgroundAttachment, + HTMLCurrentStyle_HTMLStyle_put_backgroundPosition, + HTMLCurrentStyle_HTMLStyle_get_backgroundPosition, + HTMLCurrentStyle_HTMLStyle_put_backgroundPositionX, + HTMLCurrentStyle_HTMLStyle_get_backgroundPositionX, + HTMLCurrentStyle_HTMLStyle_put_backgroundPositionY, + HTMLCurrentStyle_HTMLStyle_get_backgroundPositionY, + HTMLCurrentStyle_HTMLStyle_put_wordSpacing, + HTMLCurrentStyle_HTMLStyle_get_wordSpacing, + HTMLCurrentStyle_HTMLStyle_put_letterSpacing, + HTMLCurrentStyle_HTMLStyle_get_letterSpacing, + HTMLCurrentStyle_HTMLStyle_put_textDecoration, + HTMLCurrentStyle_HTMLStyle_get_textDecoration, + HTMLCurrentStyle_HTMLStyle_put_textDecorationNone, + HTMLCurrentStyle_HTMLStyle_get_textDecorationNone, + HTMLCurrentStyle_HTMLStyle_put_textDecorationUnderline, + HTMLCurrentStyle_HTMLStyle_get_textDecorationUnderline, + HTMLCurrentStyle_HTMLStyle_put_textDecorationOverline, + HTMLCurrentStyle_HTMLStyle_get_textDecorationOverline, + HTMLCurrentStyle_HTMLStyle_put_textDecorationLineThrough, + HTMLCurrentStyle_HTMLStyle_get_textDecorationLineThrough, + HTMLCurrentStyle_HTMLStyle_put_textDecorationBlink, + HTMLCurrentStyle_HTMLStyle_get_textDecorationBlink, + HTMLCurrentStyle_HTMLStyle_put_verticalAlign, + HTMLCurrentStyle_HTMLStyle_get_verticalAlign, + HTMLCurrentStyle_HTMLStyle_put_textTransform, + HTMLCurrentStyle_HTMLStyle_get_textTransform, + HTMLCurrentStyle_HTMLStyle_put_textAlign, + HTMLCurrentStyle_HTMLStyle_get_textAlign, + HTMLCurrentStyle_HTMLStyle_put_textIndent, + HTMLCurrentStyle_HTMLStyle_get_textIndent, + HTMLCurrentStyle_HTMLStyle_put_lineHeight, + HTMLCurrentStyle_HTMLStyle_get_lineHeight, + HTMLCurrentStyle_HTMLStyle_put_marginTop, + HTMLCurrentStyle_HTMLStyle_get_marginTop, + HTMLCurrentStyle_HTMLStyle_put_marginRight, + HTMLCurrentStyle_HTMLStyle_get_marginRight, + HTMLCurrentStyle_HTMLStyle_put_marginBottom, + HTMLCurrentStyle_HTMLStyle_get_marginBottom, + HTMLCurrentStyle_HTMLStyle_put_marginLeft, + HTMLCurrentStyle_HTMLStyle_get_marginLeft, + HTMLCurrentStyle_HTMLStyle_put_margin, + HTMLCurrentStyle_HTMLStyle_get_margin, + HTMLCurrentStyle_HTMLStyle_put_paddingTop, + HTMLCurrentStyle_HTMLStyle_get_paddingTop, + HTMLCurrentStyle_HTMLStyle_put_paddingRight, + HTMLCurrentStyle_HTMLStyle_get_paddingRight, + HTMLCurrentStyle_HTMLStyle_put_paddingBottom, + HTMLCurrentStyle_HTMLStyle_get_paddingBottom, + HTMLCurrentStyle_HTMLStyle_put_paddingLeft, + HTMLCurrentStyle_HTMLStyle_get_paddingLeft, + HTMLCurrentStyle_HTMLStyle_put_padding, + HTMLCurrentStyle_HTMLStyle_get_padding, + HTMLCurrentStyle_HTMLStyle_put_border, + HTMLCurrentStyle_HTMLStyle_get_border, + HTMLCurrentStyle_HTMLStyle_put_borderTop, + HTMLCurrentStyle_HTMLStyle_get_borderTop, + HTMLCurrentStyle_HTMLStyle_put_borderRight, + HTMLCurrentStyle_HTMLStyle_get_borderRight, + HTMLCurrentStyle_HTMLStyle_put_borderBottom, + HTMLCurrentStyle_HTMLStyle_get_borderBottom, + HTMLCurrentStyle_HTMLStyle_put_borderLeft, + HTMLCurrentStyle_HTMLStyle_get_borderLeft, + HTMLCurrentStyle_HTMLStyle_put_borderColor, + HTMLCurrentStyle_HTMLStyle_get_borderColor, + HTMLCurrentStyle_HTMLStyle_put_borderTopColor, + HTMLCurrentStyle_HTMLStyle_get_borderTopColor, + HTMLCurrentStyle_HTMLStyle_put_borderRightColor, + HTMLCurrentStyle_HTMLStyle_get_borderRightColor, + HTMLCurrentStyle_HTMLStyle_put_borderBottomColor, + HTMLCurrentStyle_HTMLStyle_get_borderBottomColor, + HTMLCurrentStyle_HTMLStyle_put_borderLeftColor, + HTMLCurrentStyle_HTMLStyle_get_borderLeftColor, + HTMLCurrentStyle_HTMLStyle_put_borderWidth, + HTMLCurrentStyle_HTMLStyle_get_borderWidth, + HTMLCurrentStyle_HTMLStyle_put_borderTopWidth, + HTMLCurrentStyle_HTMLStyle_get_borderTopWidth, + HTMLCurrentStyle_HTMLStyle_put_borderRightWidth, + HTMLCurrentStyle_HTMLStyle_get_borderRightWidth, + HTMLCurrentStyle_HTMLStyle_put_borderBottomWidth, + HTMLCurrentStyle_HTMLStyle_get_borderBottomWidth, + HTMLCurrentStyle_HTMLStyle_put_borderLeftWidth, + HTMLCurrentStyle_HTMLStyle_get_borderLeftWidth, + HTMLCurrentStyle_HTMLStyle_put_borderStyle, + HTMLCurrentStyle_HTMLStyle_get_borderStyle, + HTMLCurrentStyle_HTMLStyle_put_borderTopStyle, + HTMLCurrentStyle_HTMLStyle_get_borderTopStyle, + HTMLCurrentStyle_HTMLStyle_put_borderRightStyle, + HTMLCurrentStyle_HTMLStyle_get_borderRightStyle, + HTMLCurrentStyle_HTMLStyle_put_borderBottomStyle, + HTMLCurrentStyle_HTMLStyle_get_borderBottomStyle, + HTMLCurrentStyle_HTMLStyle_put_borderLeftStyle, + HTMLCurrentStyle_HTMLStyle_get_borderLeftStyle, + HTMLCurrentStyle_HTMLStyle_put_width, + HTMLCurrentStyle_HTMLStyle_get_width, + HTMLCurrentStyle_HTMLStyle_put_height, + HTMLCurrentStyle_HTMLStyle_get_height, + HTMLCurrentStyle_HTMLStyle_put_styleFloat, + HTMLCurrentStyle_HTMLStyle_get_styleFloat, + HTMLCurrentStyle_HTMLStyle_put_clear, + HTMLCurrentStyle_HTMLStyle_get_clear, + HTMLCurrentStyle_HTMLStyle_put_display, + HTMLCurrentStyle_HTMLStyle_get_display, + HTMLCurrentStyle_HTMLStyle_put_visibility, + HTMLCurrentStyle_HTMLStyle_get_visibility, + HTMLCurrentStyle_HTMLStyle_put_listStyleType, + HTMLCurrentStyle_HTMLStyle_get_listStyleType, + HTMLCurrentStyle_HTMLStyle_put_listStylePosition, + HTMLCurrentStyle_HTMLStyle_get_listStylePosition, + HTMLCurrentStyle_HTMLStyle_put_listStyleImage, + HTMLCurrentStyle_HTMLStyle_get_listStyleImage, + HTMLCurrentStyle_HTMLStyle_put_listStyle, + HTMLCurrentStyle_HTMLStyle_get_listStyle, + HTMLCurrentStyle_HTMLStyle_put_whiteSpace, + HTMLCurrentStyle_HTMLStyle_get_whiteSpace, + HTMLCurrentStyle_HTMLStyle_put_top, + HTMLCurrentStyle_HTMLStyle_get_top, + HTMLCurrentStyle_HTMLStyle_put_left, + HTMLCurrentStyle_HTMLStyle_get_left, + HTMLCurrentStyle_HTMLStyle_get_position, + HTMLCurrentStyle_HTMLStyle_put_zIndex, + HTMLCurrentStyle_HTMLStyle_get_zIndex, + HTMLCurrentStyle_HTMLStyle_put_overflow, + HTMLCurrentStyle_HTMLStyle_get_overflow, + HTMLCurrentStyle_HTMLStyle_put_pageBreakBefore, + HTMLCurrentStyle_HTMLStyle_get_pageBreakBefore, + HTMLCurrentStyle_HTMLStyle_put_pageBreakAfter, + HTMLCurrentStyle_HTMLStyle_get_pageBreakAfter, + HTMLCurrentStyle_HTMLStyle_put_cssText, + HTMLCurrentStyle_HTMLStyle_get_cssText, + HTMLCurrentStyle_HTMLStyle_put_pixelTop, + HTMLCurrentStyle_HTMLStyle_get_pixelTop, + HTMLCurrentStyle_HTMLStyle_put_pixelLeft, + HTMLCurrentStyle_HTMLStyle_get_pixelLeft, + HTMLCurrentStyle_HTMLStyle_put_pixelWidth, + HTMLCurrentStyle_HTMLStyle_get_pixelWidth, + HTMLCurrentStyle_HTMLStyle_put_pixelHeight, + HTMLCurrentStyle_HTMLStyle_get_pixelHeight, + HTMLCurrentStyle_HTMLStyle_put_posTop, + HTMLCurrentStyle_HTMLStyle_get_posTop, + HTMLCurrentStyle_HTMLStyle_put_posLeft, + HTMLCurrentStyle_HTMLStyle_get_posLeft, + HTMLCurrentStyle_HTMLStyle_put_posWidth, + HTMLCurrentStyle_HTMLStyle_get_posWidth, + HTMLCurrentStyle_HTMLStyle_put_posHeight, + HTMLCurrentStyle_HTMLStyle_get_posHeight, + HTMLCurrentStyle_HTMLStyle_put_cursor, + HTMLCurrentStyle_HTMLStyle_get_cursor, + HTMLCurrentStyle_HTMLStyle_put_clip, + HTMLCurrentStyle_HTMLStyle_get_clip, + HTMLCurrentStyle_HTMLStyle_put_filter, + HTMLCurrentStyle_HTMLStyle_get_filter, + HTMLCurrentStyle_HTMLStyle_setAttribute, + HTMLCurrentStyle_HTMLStyle_getAttribute, + HTMLCurrentStyle_HTMLStyle_removeAttribute, + HTMLCurrentStyle_HTMLStyle_toString +}; + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_QueryInterface(IHTMLStyle2 *iface, REFIID riid, void **ppv) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IHTMLCurrentStyle_QueryInterface(&This->IHTMLCurrentStyle_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle2_AddRef(IHTMLStyle2 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IHTMLCurrentStyle_AddRef(&This->IHTMLCurrentStyle_iface); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle2_Release(IHTMLStyle2 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IHTMLCurrentStyle_Release(&This->IHTMLCurrentStyle_iface); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_GetTypeInfoCount(IHTMLStyle2 *iface, UINT *pctinfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IDispatchEx_GetTypeInfoCount(&This->css_style.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_GetTypeInfo(IHTMLStyle2 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IDispatchEx_GetTypeInfo(&This->css_style.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_GetIDsOfNames(IHTMLStyle2 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IDispatchEx_GetIDsOfNames(&This->css_style.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_Invoke(IHTMLStyle2 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + return IDispatchEx_Invoke(&This->css_style.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_tableLayout(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_tableLayout(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_borderCollapse(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_borderCollapse(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_direction(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_direction(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_behavior(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_behavior(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_setExpression(IHTMLStyle2 *iface, BSTR propname, BSTR expression, BSTR language) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s %s %s)\n", This, debugstr_w(propname), debugstr_w(expression), debugstr_w(language)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_getExpression(IHTMLStyle2 *iface, BSTR propname, VARIANT *expression) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s %p)\n", This, debugstr_w(propname), expression); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_removeExpression(IHTMLStyle2 *iface, BSTR propname, VARIANT_BOOL *pfSuccess) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s %p)\n", This, debugstr_w(propname), pfSuccess); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_position(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_position(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_unicodeBidi(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_unicodeBidi(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_bottom(IHTMLStyle2 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_bottom(IHTMLStyle2 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_right(IHTMLStyle2 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_right(IHTMLStyle2 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_pixelBottom(IHTMLStyle2 *iface, LONG v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%ld)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_pixelBottom(IHTMLStyle2 *iface, LONG *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_pixelRight(IHTMLStyle2 *iface, LONG v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%ld)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_pixelRight(IHTMLStyle2 *iface, LONG *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_posBottom(IHTMLStyle2 *iface, float v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%f)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_posBottom(IHTMLStyle2 *iface, float *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_posRight(IHTMLStyle2 *iface, float v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%f)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_posRight(IHTMLStyle2 *iface, float *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_imeMode(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_imeMode(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_rubyAlign(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_rubyAlign(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_rubyPosition(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_rubyPosition(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_rubyOverhang(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_rubyOverhang(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_layoutGridChar(IHTMLStyle2 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_layoutGridChar(IHTMLStyle2 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_layoutGridLine(IHTMLStyle2 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_layoutGridLine(IHTMLStyle2 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_layoutGridMode(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_layoutGridMode(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_layoutGridType(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_layoutGridType(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_layoutGrid(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_layoutGrid(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_wordBreak(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_wordBreak(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_lineBreak(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_lineBreak(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_textJustify(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_textJustify(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_textJustifyTrim(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_textJustifyTrim(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_textKashida(IHTMLStyle2 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_textKashida(IHTMLStyle2 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_textAutospace(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_textAutospace(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_overflowX(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_overflowX(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_overflowY(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_overflowY(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_put_accelerator(IHTMLStyle2 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle2_get_accelerator(IHTMLStyle2 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle2(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLStyle2Vtbl HTMLStyle2Vtbl = { + HTMLCurrentStyle_HTMLStyle2_QueryInterface, + HTMLCurrentStyle_HTMLStyle2_AddRef, + HTMLCurrentStyle_HTMLStyle2_Release, + HTMLCurrentStyle_HTMLStyle2_GetTypeInfoCount, + HTMLCurrentStyle_HTMLStyle2_GetTypeInfo, + HTMLCurrentStyle_HTMLStyle2_GetIDsOfNames, + HTMLCurrentStyle_HTMLStyle2_Invoke, + HTMLCurrentStyle_HTMLStyle2_put_tableLayout, + HTMLCurrentStyle_HTMLStyle2_get_tableLayout, + HTMLCurrentStyle_HTMLStyle2_put_borderCollapse, + HTMLCurrentStyle_HTMLStyle2_get_borderCollapse, + HTMLCurrentStyle_HTMLStyle2_put_direction, + HTMLCurrentStyle_HTMLStyle2_get_direction, + HTMLCurrentStyle_HTMLStyle2_put_behavior, + HTMLCurrentStyle_HTMLStyle2_get_behavior, + HTMLCurrentStyle_HTMLStyle2_setExpression, + HTMLCurrentStyle_HTMLStyle2_getExpression, + HTMLCurrentStyle_HTMLStyle2_removeExpression, + HTMLCurrentStyle_HTMLStyle2_put_position, + HTMLCurrentStyle_HTMLStyle2_get_position, + HTMLCurrentStyle_HTMLStyle2_put_unicodeBidi, + HTMLCurrentStyle_HTMLStyle2_get_unicodeBidi, + HTMLCurrentStyle_HTMLStyle2_put_bottom, + HTMLCurrentStyle_HTMLStyle2_get_bottom, + HTMLCurrentStyle_HTMLStyle2_put_right, + HTMLCurrentStyle_HTMLStyle2_get_right, + HTMLCurrentStyle_HTMLStyle2_put_pixelBottom, + HTMLCurrentStyle_HTMLStyle2_get_pixelBottom, + HTMLCurrentStyle_HTMLStyle2_put_pixelRight, + HTMLCurrentStyle_HTMLStyle2_get_pixelRight, + HTMLCurrentStyle_HTMLStyle2_put_posBottom, + HTMLCurrentStyle_HTMLStyle2_get_posBottom, + HTMLCurrentStyle_HTMLStyle2_put_posRight, + HTMLCurrentStyle_HTMLStyle2_get_posRight, + HTMLCurrentStyle_HTMLStyle2_put_imeMode, + HTMLCurrentStyle_HTMLStyle2_get_imeMode, + HTMLCurrentStyle_HTMLStyle2_put_rubyAlign, + HTMLCurrentStyle_HTMLStyle2_get_rubyAlign, + HTMLCurrentStyle_HTMLStyle2_put_rubyPosition, + HTMLCurrentStyle_HTMLStyle2_get_rubyPosition, + HTMLCurrentStyle_HTMLStyle2_put_rubyOverhang, + HTMLCurrentStyle_HTMLStyle2_get_rubyOverhang, + HTMLCurrentStyle_HTMLStyle2_put_layoutGridChar, + HTMLCurrentStyle_HTMLStyle2_get_layoutGridChar, + HTMLCurrentStyle_HTMLStyle2_put_layoutGridLine, + HTMLCurrentStyle_HTMLStyle2_get_layoutGridLine, + HTMLCurrentStyle_HTMLStyle2_put_layoutGridMode, + HTMLCurrentStyle_HTMLStyle2_get_layoutGridMode, + HTMLCurrentStyle_HTMLStyle2_put_layoutGridType, + HTMLCurrentStyle_HTMLStyle2_get_layoutGridType, + HTMLCurrentStyle_HTMLStyle2_put_layoutGrid, + HTMLCurrentStyle_HTMLStyle2_get_layoutGrid, + HTMLCurrentStyle_HTMLStyle2_put_wordBreak, + HTMLCurrentStyle_HTMLStyle2_get_wordBreak, + HTMLCurrentStyle_HTMLStyle2_put_lineBreak, + HTMLCurrentStyle_HTMLStyle2_get_lineBreak, + HTMLCurrentStyle_HTMLStyle2_put_textJustify, + HTMLCurrentStyle_HTMLStyle2_get_textJustify, + HTMLCurrentStyle_HTMLStyle2_put_textJustifyTrim, + HTMLCurrentStyle_HTMLStyle2_get_textJustifyTrim, + HTMLCurrentStyle_HTMLStyle2_put_textKashida, + HTMLCurrentStyle_HTMLStyle2_get_textKashida, + HTMLCurrentStyle_HTMLStyle2_put_textAutospace, + HTMLCurrentStyle_HTMLStyle2_get_textAutospace, + HTMLCurrentStyle_HTMLStyle2_put_overflowX, + HTMLCurrentStyle_HTMLStyle2_get_overflowX, + HTMLCurrentStyle_HTMLStyle2_put_overflowY, + HTMLCurrentStyle_HTMLStyle2_get_overflowY, + HTMLCurrentStyle_HTMLStyle2_put_accelerator, + HTMLCurrentStyle_HTMLStyle2_get_accelerator +}; + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_QueryInterface(IHTMLStyle3 *iface, REFIID riid, void **ppv) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IHTMLCurrentStyle_QueryInterface(&This->IHTMLCurrentStyle_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle3_AddRef(IHTMLStyle3 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IHTMLCurrentStyle_AddRef(&This->IHTMLCurrentStyle_iface); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle3_Release(IHTMLStyle3 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IHTMLCurrentStyle_Release(&This->IHTMLCurrentStyle_iface); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_GetTypeInfoCount(IHTMLStyle3 *iface, UINT *pctinfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IDispatchEx_GetTypeInfoCount(&This->css_style.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_GetTypeInfo(IHTMLStyle3 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IDispatchEx_GetTypeInfo(&This->css_style.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_GetIDsOfNames(IHTMLStyle3 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IDispatchEx_GetIDsOfNames(&This->css_style.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_Invoke(IHTMLStyle3 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + return IDispatchEx_Invoke(&This->css_style.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_layoutFlow(IHTMLStyle3 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_layoutFlow(IHTMLStyle3 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_zoom(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_zoom(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%p)\n", This, p); + return IHTMLCSSStyleDeclaration_get_zoom(&This->css_style.IHTMLCSSStyleDeclaration_iface, p); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_wordWrap(IHTMLStyle3 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_wordWrap(IHTMLStyle3 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_textUnderlinePosition(IHTMLStyle3 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_textUnderlinePosition(IHTMLStyle3 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarBaseColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarBaseColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarFaceColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarFaceColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbar3dLightColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbar3dLightColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarShadowColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarShadowColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarHighlightColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarHighlightColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarDarkShadowColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarDarkShadowColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarArrowColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarArrowColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_scrollbarTrackColor(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_scrollbarTrackColor(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_writingMode(IHTMLStyle3 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_writingMode(IHTMLStyle3 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_textAlignLast(IHTMLStyle3 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_textAlignLast(IHTMLStyle3 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_put_textKashidaSpace(IHTMLStyle3 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle3_get_textKashidaSpace(IHTMLStyle3 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLStyle3Vtbl HTMLStyle3Vtbl = { + HTMLCurrentStyle_HTMLStyle3_QueryInterface, + HTMLCurrentStyle_HTMLStyle3_AddRef, + HTMLCurrentStyle_HTMLStyle3_Release, + HTMLCurrentStyle_HTMLStyle3_GetTypeInfoCount, + HTMLCurrentStyle_HTMLStyle3_GetTypeInfo, + HTMLCurrentStyle_HTMLStyle3_GetIDsOfNames, + HTMLCurrentStyle_HTMLStyle3_Invoke, + HTMLCurrentStyle_HTMLStyle3_put_layoutFlow, + HTMLCurrentStyle_HTMLStyle3_get_layoutFlow, + HTMLCurrentStyle_HTMLStyle3_put_zoom, + HTMLCurrentStyle_HTMLStyle3_get_zoom, + HTMLCurrentStyle_HTMLStyle3_put_wordWrap, + HTMLCurrentStyle_HTMLStyle3_get_wordWrap, + HTMLCurrentStyle_HTMLStyle3_put_textUnderlinePosition, + HTMLCurrentStyle_HTMLStyle3_get_textUnderlinePosition, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarBaseColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarBaseColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarFaceColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarFaceColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbar3dLightColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbar3dLightColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarShadowColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarShadowColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarHighlightColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarHighlightColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarDarkShadowColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarDarkShadowColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarArrowColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarArrowColor, + HTMLCurrentStyle_HTMLStyle3_put_scrollbarTrackColor, + HTMLCurrentStyle_HTMLStyle3_get_scrollbarTrackColor, + HTMLCurrentStyle_HTMLStyle3_put_writingMode, + HTMLCurrentStyle_HTMLStyle3_get_writingMode, + HTMLCurrentStyle_HTMLStyle3_put_textAlignLast, + HTMLCurrentStyle_HTMLStyle3_get_textAlignLast, + HTMLCurrentStyle_HTMLStyle3_put_textKashidaSpace, + HTMLCurrentStyle_HTMLStyle3_get_textKashidaSpace +}; + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_QueryInterface(IHTMLStyle5 *iface, REFIID riid, void **ppv) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IHTMLCurrentStyle_QueryInterface(&This->IHTMLCurrentStyle_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle5_AddRef(IHTMLStyle5 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IHTMLCurrentStyle_AddRef(&This->IHTMLCurrentStyle_iface); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle5_Release(IHTMLStyle5 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IHTMLCurrentStyle_Release(&This->IHTMLCurrentStyle_iface); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_GetTypeInfoCount(IHTMLStyle5 *iface, UINT *pctinfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IDispatchEx_GetTypeInfoCount(&This->css_style.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_GetTypeInfo(IHTMLStyle5 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IDispatchEx_GetTypeInfo(&This->css_style.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_GetIDsOfNames(IHTMLStyle5 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IDispatchEx_GetIDsOfNames(&This->css_style.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_Invoke(IHTMLStyle5 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + return IDispatchEx_Invoke(&This->css_style.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_put_msInterpolationMode(IHTMLStyle5 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_get_msInterpolationMode(IHTMLStyle5 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_put_maxHeight(IHTMLStyle5 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_get_maxHeight(IHTMLStyle5 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(p)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_put_minWidth(IHTMLStyle5 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_get_minWidth(IHTMLStyle5 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_put_maxWidth(IHTMLStyle5 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle5_get_maxWidth(IHTMLStyle5 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle5(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static const IHTMLStyle5Vtbl HTMLStyle5Vtbl = { + HTMLCurrentStyle_HTMLStyle5_QueryInterface, + HTMLCurrentStyle_HTMLStyle5_AddRef, + HTMLCurrentStyle_HTMLStyle5_Release, + HTMLCurrentStyle_HTMLStyle5_GetTypeInfoCount, + HTMLCurrentStyle_HTMLStyle5_GetTypeInfo, + HTMLCurrentStyle_HTMLStyle5_GetIDsOfNames, + HTMLCurrentStyle_HTMLStyle5_Invoke, + HTMLCurrentStyle_HTMLStyle5_put_msInterpolationMode, + HTMLCurrentStyle_HTMLStyle5_get_msInterpolationMode, + HTMLCurrentStyle_HTMLStyle5_put_maxHeight, + HTMLCurrentStyle_HTMLStyle5_get_maxHeight, + HTMLCurrentStyle_HTMLStyle5_put_minWidth, + HTMLCurrentStyle_HTMLStyle5_get_minWidth, + HTMLCurrentStyle_HTMLStyle5_put_maxWidth, + HTMLCurrentStyle_HTMLStyle5_get_maxWidth +}; + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_QueryInterface(IHTMLStyle6 *iface, REFIID riid, void **ppv) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IHTMLCurrentStyle_QueryInterface(&This->IHTMLCurrentStyle_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle6_AddRef(IHTMLStyle6 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IHTMLCurrentStyle_AddRef(&This->IHTMLCurrentStyle_iface); +} + +static ULONG WINAPI HTMLCurrentStyle_HTMLStyle6_Release(IHTMLStyle6 *iface) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IHTMLCurrentStyle_Release(&This->IHTMLCurrentStyle_iface); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_GetTypeInfoCount(IHTMLStyle6 *iface, UINT *pctinfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IDispatchEx_GetTypeInfoCount(&This->css_style.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_GetTypeInfo(IHTMLStyle6 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IDispatchEx_GetTypeInfo(&This->css_style.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_GetIDsOfNames(IHTMLStyle6 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IDispatchEx_GetIDsOfNames(&This->css_style.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_Invoke(IHTMLStyle6 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + return IDispatchEx_Invoke(&This->css_style.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_content(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_content(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_contentSide(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_contentSide(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_counterIncrement(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_counterIncrement(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_counterReset(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_counterReset(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_outline(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_outline(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_outlineWidth(IHTMLStyle6 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_outlineWidth(IHTMLStyle6 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_outlineStyle(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_outlineStyle(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_outlineColor(IHTMLStyle6 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_outlineColor(IHTMLStyle6 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_boxSizing(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_boxSizing(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_borderSpacing(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_borderSpacing(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_orphans(IHTMLStyle6 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_orphans(IHTMLStyle6 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_windows(IHTMLStyle6 *iface, VARIANT v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_windows(IHTMLStyle6 *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_pageBreakInside(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_pageBreakInside(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_emptyCells(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_emptyCells(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_msBlockProgression(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + return E_FAIL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_msBlockProgression(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_put_quotes(IHTMLStyle6 *iface, BSTR v) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%s)\n", This, debugstr_w(v)); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLCurrentStyle_HTMLStyle6_get_quotes(IHTMLStyle6 *iface, BSTR *p) +{ + HTMLCurrentStyle *This = impl_from_IHTMLStyle6(iface); + WARN("(%p)->(%p)\n", This, p); + return E_UNEXPECTED; +} + +static const IHTMLStyle6Vtbl HTMLStyle6Vtbl = { + HTMLCurrentStyle_HTMLStyle6_QueryInterface, + HTMLCurrentStyle_HTMLStyle6_AddRef, + HTMLCurrentStyle_HTMLStyle6_Release, + HTMLCurrentStyle_HTMLStyle6_GetTypeInfoCount, + HTMLCurrentStyle_HTMLStyle6_GetTypeInfo, + HTMLCurrentStyle_HTMLStyle6_GetIDsOfNames, + HTMLCurrentStyle_HTMLStyle6_Invoke, + HTMLCurrentStyle_HTMLStyle6_put_content, + HTMLCurrentStyle_HTMLStyle6_get_content, + HTMLCurrentStyle_HTMLStyle6_put_contentSide, + HTMLCurrentStyle_HTMLStyle6_get_contentSide, + HTMLCurrentStyle_HTMLStyle6_put_counterIncrement, + HTMLCurrentStyle_HTMLStyle6_get_counterIncrement, + HTMLCurrentStyle_HTMLStyle6_put_counterReset, + HTMLCurrentStyle_HTMLStyle6_get_counterReset, + HTMLCurrentStyle_HTMLStyle6_put_outline, + HTMLCurrentStyle_HTMLStyle6_get_outline, + HTMLCurrentStyle_HTMLStyle6_put_outlineWidth, + HTMLCurrentStyle_HTMLStyle6_get_outlineWidth, + HTMLCurrentStyle_HTMLStyle6_put_outlineStyle, + HTMLCurrentStyle_HTMLStyle6_get_outlineStyle, + HTMLCurrentStyle_HTMLStyle6_put_outlineColor, + HTMLCurrentStyle_HTMLStyle6_get_outlineColor, + HTMLCurrentStyle_HTMLStyle6_put_boxSizing, + HTMLCurrentStyle_HTMLStyle6_get_boxSizing, + HTMLCurrentStyle_HTMLStyle6_put_borderSpacing, + HTMLCurrentStyle_HTMLStyle6_get_borderSpacing, + HTMLCurrentStyle_HTMLStyle6_put_orphans, + HTMLCurrentStyle_HTMLStyle6_get_orphans, + HTMLCurrentStyle_HTMLStyle6_put_windows, + HTMLCurrentStyle_HTMLStyle6_get_windows, + HTMLCurrentStyle_HTMLStyle6_put_pageBreakInside, + HTMLCurrentStyle_HTMLStyle6_get_pageBreakInside, + HTMLCurrentStyle_HTMLStyle6_put_emptyCells, + HTMLCurrentStyle_HTMLStyle6_get_emptyCells, + HTMLCurrentStyle_HTMLStyle6_put_msBlockProgression, + HTMLCurrentStyle_HTMLStyle6_get_msBlockProgression, + HTMLCurrentStyle_HTMLStyle6_put_quotes, + HTMLCurrentStyle_HTMLStyle6_get_quotes +}; + static inline HTMLCurrentStyle *impl_from_DispatchEx(DispatchEx *dispex) { return CONTAINING_RECORD(dispex, HTMLCurrentStyle, css_style.dispex); @@ -1295,6 +4119,16 @@ static void *HTMLCurrentStyle_query_interface(DispatchEx *dispex, REFIID riid) return &This->IHTMLCurrentStyle3_iface; if(IsEqualGUID(&IID_IHTMLCurrentStyle4, riid)) return &This->IHTMLCurrentStyle4_iface; + if(IsEqualGUID(&IID_IHTMLStyle, riid)) + return &This->IHTMLStyle_iface; + if(IsEqualGUID(&IID_IHTMLStyle2, riid)) + return &This->IHTMLStyle2_iface; + if(IsEqualGUID(&IID_IHTMLStyle3, riid)) + return &This->IHTMLStyle3_iface; + if(IsEqualGUID(&IID_IHTMLStyle5, riid)) + return &This->IHTMLStyle5_iface; + if(IsEqualGUID(&IID_IHTMLStyle6, riid)) + return &This->IHTMLStyle6_iface; return CSSStyle_query_interface(&This->css_style.dispex, riid); } @@ -1390,6 +4224,11 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p) ret->IHTMLCurrentStyle2_iface.lpVtbl = &HTMLCurrentStyle2Vtbl; ret->IHTMLCurrentStyle3_iface.lpVtbl = &HTMLCurrentStyle3Vtbl; ret->IHTMLCurrentStyle4_iface.lpVtbl = &HTMLCurrentStyle4Vtbl; + ret->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl; + ret->IHTMLStyle2_iface.lpVtbl = &HTMLStyle2Vtbl; + ret->IHTMLStyle3_iface.lpVtbl = &HTMLStyle3Vtbl; + ret->IHTMLStyle5_iface.lpVtbl = &HTMLStyle5Vtbl; + ret->IHTMLStyle6_iface.lpVtbl = &HTMLStyle6Vtbl; init_css_style(&ret->css_style, nsstyle, &HTMLCurrentStyle_dispex, get_inner_window(elem->node.doc), dispex_compat_mode(&elem->node.event_target.dispex)); From 01f7cc6b8514d08cad9a91f501a863a38ef70653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0993/1506] mshtml: Introduce MSCSSPropertiesPrototype and set it as prototype of CurrentStyle and Style prototypes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface is abstract, and is only used in prototype chains (and constructor), so we needn't implement any of it. However, MSCSSPropertiesPrototype inherits from CSSStyleDeclarationPrototype. Some of the props are now exposed in MSCSSPropertiesPrototype instead, and none of styles in the style table are exposed in either the HTMLCurrentStyle or HTMLStyle prototypes; they are exposed further up the chain, so get_static_dispid logic has been moved accordingly. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlcurstyle.c | 3 +- dlls/mshtml/htmlstyle.c | 157 ++++++++++++++++++++++++++++-- dlls/mshtml/htmlstyle.h | 3 +- dlls/mshtml/mshtml_private.h | 5 +- dlls/mshtml/tests/documentmode.js | 23 +++++ 5 files changed, 178 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index ab6a0bd465a..3fd302a0db6 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -4157,7 +4157,8 @@ static const dispex_static_data_vtbl_t HTMLCurrentStyle_dispex_vtbl = { CSSSTYLE_DISPEX_VTBL_ENTRIES, .query_interface = HTMLCurrentStyle_query_interface, .traverse = HTMLCurrentStyle_traverse, - .unlink = HTMLCurrentStyle_unlink + .unlink = HTMLCurrentStyle_unlink, + .get_static_dispid = CSSStyle_get_static_dispid }; static const tid_t HTMLCurrentStyle_iface_tids[] = { diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 3f4df801c4a..da32e08b04e 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -109,6 +109,7 @@ static const WCHAR *overflow_values[] = { #define ATTR_REMOVE_COMMA 0x0010 #define ATTR_NO_NULL 0x0020 #define ATTR_COMPAT_IE10 0x0040 +#define ATTR_IN_CSSPROPERTIES 0x0080 typedef struct { const WCHAR *name; @@ -167,13 +168,13 @@ static const style_tbl_entry_t style_tbl[] = { L"background-position-x", DISPID_IHTMLCSSSTYLEDECLARATION_BACKGROUNDPOSITIONX, DISPID_A_BACKGROUNDPOSX, - ATTR_FIX_PX + ATTR_FIX_PX | ATTR_IN_CSSPROPERTIES }, { L"background-position-y", DISPID_IHTMLCSSSTYLEDECLARATION_BACKGROUNDPOSITIONY, DISPID_A_BACKGROUNDPOSY, - ATTR_FIX_PX + ATTR_FIX_PX | ATTR_IN_CSSPROPERTIES }, { L"background-repeat", @@ -9964,13 +9965,16 @@ HRESULT CSSStyle_get_static_dispid(compat_mode_t compat_mode, BSTR name, DWORD f { const style_tbl_entry_t *style_entry; + /* Found in prototypes */ + if(compat_mode >= COMPAT_MODE_IE9) + return DISP_E_UNKNOWNNAME; + style_entry = lookup_style_tbl_compat_mode(compat_mode, name); if(style_entry) { - DISPID id = compat_mode >= COMPAT_MODE_IE9 ? style_entry->dispid : style_entry->compat_dispid; - if(id == DISPID_UNKNOWN) + if(style_entry->compat_dispid == DISPID_UNKNOWN) return DISP_E_UNKNOWNNAME; - *dispid = id; + *dispid = style_entry->compat_dispid; return S_OK; } @@ -10034,7 +10038,8 @@ static const dispex_static_data_vtbl_t HTMLStyle_dispex_vtbl = { CSSSTYLE_DISPEX_VTBL_ENTRIES, .query_interface = HTMLStyle_query_interface, .traverse = HTMLStyle_traverse, - .unlink = HTMLStyle_unlink + .unlink = HTMLStyle_unlink, + .get_static_dispid = CSSStyle_get_static_dispid }; static const tid_t HTMLStyle_iface_tids[] = { @@ -10138,11 +10143,147 @@ HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) return S_OK; } +/* dummy dispex used only for MSCSSPropertiesPrototype in prototype chain */ +static HRESULT HTMLCSSProperties_get_static_dispid(compat_mode_t compat_mode, BSTR name, DWORD flags, DISPID *dispid) +{ + const style_tbl_entry_t *style_entry; + + style_entry = lookup_style_tbl_compat_mode(compat_mode, name); + if(style_entry) { + if(style_entry->dispid == DISPID_UNKNOWN || !(style_entry->flags & ATTR_IN_CSSPROPERTIES)) + return DISP_E_UNKNOWNNAME; + + *dispid = style_entry->dispid; + return S_OK; + } + + return DISP_E_UNKNOWNNAME; +} + +static void HTMLCSSProperties_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t style_hooks[] = { + {DISPID_IHTMLSTYLE_TEXTDECORATIONNONE}, + {DISPID_IHTMLSTYLE_TEXTDECORATIONUNDERLINE}, + {DISPID_IHTMLSTYLE_TEXTDECORATIONOVERLINE}, + {DISPID_IHTMLSTYLE_TEXTDECORATIONLINETHROUGH}, + {DISPID_IHTMLSTYLE_TEXTDECORATIONBLINK}, + {DISPID_IHTMLSTYLE_PIXELTOP}, + {DISPID_IHTMLSTYLE_PIXELLEFT}, + {DISPID_IHTMLSTYLE_PIXELWIDTH}, + {DISPID_IHTMLSTYLE_PIXELHEIGHT}, + {DISPID_IHTMLSTYLE_POSTOP}, + {DISPID_IHTMLSTYLE_POSLEFT}, + {DISPID_IHTMLSTYLE_POSWIDTH}, + {DISPID_IHTMLSTYLE_POSHEIGHT}, + {DISPID_IHTMLSTYLE_TOSTRING}, + {DISPID_UNKNOWN} + }; + static const dispex_hook_t style2_hooks[] = { + {DISPID_IHTMLSTYLE2_SETEXPRESSION}, + {DISPID_IHTMLSTYLE2_GETEXPRESSION}, + {DISPID_IHTMLSTYLE2_REMOVEEXPRESSION}, + {DISPID_IHTMLSTYLE2_PIXELBOTTOM}, + {DISPID_IHTMLSTYLE2_PIXELRIGHT}, + {DISPID_IHTMLSTYLE2_POSBOTTOM}, + {DISPID_IHTMLSTYLE2_POSRIGHT}, + {DISPID_UNKNOWN} + }; + + dispex_info_add_interface(info, IHTMLStyle6_tid, NULL); + dispex_info_add_interface(info, IHTMLStyle5_tid, NULL); + dispex_info_add_interface(info, IHTMLStyle3_tid, NULL); + dispex_info_add_interface(info, IHTMLStyle2_tid, style2_hooks); + dispex_info_add_interface(info, IHTMLStyle_tid, style_hooks); +} + +static const dispex_static_data_vtbl_t HTMLCSSProperties_dispex_vtbl = { + .get_static_dispid = HTMLCSSProperties_get_static_dispid +}; + +dispex_static_data_t HTMLCSSProperties_dispex = { + "MSCSSProperties", + &HTMLCSSProperties_dispex_vtbl, + PROTO_ID_HTMLCSSProperties, + NULL_tid, + no_iface_tids, + HTMLCSSProperties_init_dispex_info +}; + +static HRESULT HTMLW3CComputedStyle_get_static_dispid(compat_mode_t compat_mode, BSTR name, DWORD flags, DISPID *dispid) +{ + const style_tbl_entry_t *style_entry; + DISPID id; + + style_entry = lookup_style_tbl_compat_mode(compat_mode, name); + if(style_entry) { + if(compat_mode < COMPAT_MODE_IE9) + id = style_entry->compat_dispid; + else { + if(style_entry->flags & ATTR_IN_CSSPROPERTIES) + return DISP_E_UNKNOWNNAME; + id = style_entry->dispid; + } + if(id == DISPID_UNKNOWN) + return DISP_E_UNKNOWNNAME; + + *dispid = id; + return S_OK; + } + + return DISP_E_UNKNOWNNAME; +} + +void HTMLW3CComputedStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + /* don't expose props shared with children prototypes */ + static const dispex_hook_t styledecl_hooks[] = { + {DISPID_IHTMLCSSSTYLEDECLARATION_BACKGROUNDPOSITIONX}, + {DISPID_IHTMLCSSSTYLEDECLARATION_BACKGROUNDPOSITIONY}, + {DISPID_IHTMLCSSSTYLEDECLARATION_STYLEFLOAT}, + {DISPID_IHTMLCSSSTYLEDECLARATION_IMEMODE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LAYOUTGRIDCHAR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LAYOUTGRIDLINE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LAYOUTGRIDMODE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LAYOUTGRIDTYPE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LAYOUTGRID}, + {DISPID_IHTMLCSSSTYLEDECLARATION_TEXTAUTOSPACE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LINEBREAK}, + {DISPID_IHTMLCSSSTYLEDECLARATION_TEXTJUSTIFYTRIM}, + {DISPID_IHTMLCSSSTYLEDECLARATION_TEXTKASHIDA}, + {DISPID_IHTMLCSSSTYLEDECLARATION_ACCELERATOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_LAYOUTFLOW}, + {DISPID_IHTMLCSSSTYLEDECLARATION_ZOOM}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARBASECOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARFACECOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBAR3DLIGHTCOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARSHADOWCOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARHIGHLIGHTCOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARDARKSHADOWCOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARARROWCOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_SCROLLBARTRACKCOLOR}, + {DISPID_IHTMLCSSSTYLEDECLARATION_WRITINGMODE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_TEXTKASHIDASPACE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_MSINTERPOLATIONMODE}, + {DISPID_IHTMLCSSSTYLEDECLARATION_MSBLOCKPROGRESSION}, + {DISPID_IHTMLCSSSTYLEDECLARATION_CLIPTOP}, + {DISPID_IHTMLCSSSTYLEDECLARATION_CLIPRIGHT}, + {DISPID_IHTMLCSSSTYLEDECLARATION_CLIPBOTTOM}, + {DISPID_IHTMLCSSSTYLEDECLARATION_CLIPLEFT}, + {DISPID_UNKNOWN} + }; + if(mode >= COMPAT_MODE_IE9) + dispex_info_add_interface(info, IHTMLCSSStyleDeclaration_tid, styledecl_hooks); + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IHTMLCSSStyleDeclaration2_tid, NULL); +} + static const dispex_static_data_vtbl_t HTMLW3CComputedStyle_dispex_vtbl = { CSSSTYLE_DISPEX_VTBL_ENTRIES, .query_interface = CSSStyle_query_interface, .traverse = CSSStyle_traverse, - .unlink = CSSStyle_unlink + .unlink = CSSStyle_unlink, + .get_static_dispid = HTMLW3CComputedStyle_get_static_dispid }; dispex_static_data_t HTMLW3CComputedStyle_dispex = { @@ -10151,7 +10292,7 @@ dispex_static_data_t HTMLW3CComputedStyle_dispex = { PROTO_ID_HTMLW3CComputedStyle, DispHTMLW3CComputedStyle_tid, no_iface_tids, - CSSStyle_init_dispex_info + HTMLW3CComputedStyle_init_dispex_info }; HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, HTMLInnerWindow *window, diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index 0bfb38cbfa1..5a8c3c619b4 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -165,5 +165,4 @@ HRESULT get_elem_style(HTMLElement*,styleid_t,BSTR*); HRESULT set_elem_style(HTMLElement*,styleid_t,const WCHAR*); #define CSSSTYLE_DISPEX_VTBL_ENTRIES \ - .destructor = CSSStyle_destructor, \ - .get_static_dispid = CSSStyle_get_static_dispid + .destructor = CSSStyle_destructor diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index be986c3952c..fcd9afe1788 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -440,7 +440,7 @@ PRIVATE_TID_LIST X(HTMLStorage, "Storage", HTMLStorage_dispex, Object) \ X(HTMLTextRange, "TextRange", HTMLTxtRange_dispex, Object) \ X(HTMLXMLHttpRequest, "XMLHttpRequest", HTMLXMLHttpRequest_dispex, Object) \ - X(HTMLCurrentStyle, "MSCurrentStyleCSSProperties", HTMLCurrentStyle_dispex, Object) \ + X(HTMLCurrentStyle, "MSCurrentStyleCSSProperties", HTMLCurrentStyle_dispex, HTMLCSSProperties) \ X(HTMLW3CComputedStyle, "CSSStyleDeclaration", HTMLW3CComputedStyle_dispex, Object) \ X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, Object) \ X(HTMLStyleSheetRule, "CSSStyleRule", HTMLStyleSheetRule_dispex, Object) \ @@ -497,7 +497,8 @@ PRIVATE_TID_LIST X(HTMLPerformance, "Performance", HTMLPerformance_dispex, Object) \ X(HTMLPerformanceNavigation, "PerformanceNavigation", HTMLPerformanceNavigation_dispex, Object) \ X(HTMLPerformanceTiming, "PerformanceTiming", HTMLPerformanceTiming_dispex, Object) \ - X(HTMLStyle, "MSStyleCSSProperties", HTMLStyle_dispex, Object) \ + X(HTMLCSSProperties, "MSCSSProperties", HTMLCSSProperties_dispex, HTMLW3CComputedStyle) \ + X(HTMLStyle, "MSStyleCSSProperties", HTMLStyle_dispex, HTMLCSSProperties) \ X(HTMLTableCellProt, "HTMLTableCellElement", HTMLTableCellProt_dispex, HTMLElement) typedef enum { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index fcb4a100f73..63cf324beae 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -989,12 +989,15 @@ sync_test("builtin_prototypes", function() { [ "MessageEvent", "Event" ], [ "MimeTypeArray", "Object" ], [ "MouseEvent", "UIEvent" ], + [ "MSCSSProperties", "CSSStyleDeclaration" ], [ "MSCSSRuleList", "Object" ], + [ "MSCurrentStyleCSSProperties", "MSCSSProperties" ], [ "MSEventObj", "Object" ], [ "MSMimeTypesCollection", "Object" ], [ "MSNamespaceInfoCollection", "Object" ], [ "MSPluginsCollection", "Object" ], [ "MSSelection", "Object" ], + [ "MSStyleCSSProperties", "MSCSSProperties" ], [ "MutationObserver", "Object" ], [ "NamedNodeMap", "Object" ], [ "Navigator", "Object" ], @@ -1026,6 +1029,11 @@ sync_test("builtin_prototypes", function() { ok(a === b, "getPrototypeOf(" + protos[i][0] + ".prototype) = " + a); } + var CSS_props = [ "accelerator","backgroundPositionX","backgroundPositionY","getAttribute","imeMode","layoutFlow","layoutGrid","layoutGridChar", + "layoutGridLine","layoutGridMode","layoutGridType","lineBreak","msBlockProgression","msInterpolationMode","removeAttribute", + "scrollbar3dLightColor","scrollbarArrowColor","scrollbarBaseColor","scrollbarDarkShadowColor","scrollbarFaceColor", + "scrollbarHighlightColor","scrollbarShadowColor","scrollbarTrackColor","setAttribute","styleFloat","textAutospace", + "textJustifyTrim","textKashida","textKashidaSpace","writingMode","zoom" ]; var Elem_props = [ "clientHeight","clientLeft","clientTop","clientWidth","firstElementChild","getAttribute","getAttributeNode","getAttributeNodeNS", "getAttributeNS","getBoundingClientRect","getClientRects","getElementsByTagName","getElementsByTagNameNS","hasAttribute", "hasAttributeNS","lastElementChild","msMatchesSelector","nextElementSibling","previousElementSibling","querySelector", @@ -1067,6 +1075,9 @@ sync_test("builtin_prototypes", function() { [ "KeyboardEvent", ["altKey","ctrlKey","getModifierState","initKeyboardEvent","key","metaKey"], ["detail","initUIEvent","view"] ], [ "MessageEvent", ["data","initMessageEvent","origin","source"], Event_props ], [ "MouseEvent", ["button","clientX","initMouseEvent","offsetY","pageX","shiftKey","x","y"], ["detail","initUIEvent","view"] ], + [ "MSCSSProperties", CSS_props, ["background","border","clip","fontWeight","listStyle","quotes","setProperty","zIndex"] ], + [ "MSCurrentStyleCSSProperties", ["blockDirection","clipBottom","clipLeft","clipRight","clipTop","hasLayout"], CSS_props ], + [ "MSStyleCSSProperties", ["pixelTop","pixelWidth","posHeight","posLeft","textDecorationBlink","textDecorationNone"], CSS_props ], [ "ProgressEvent", ["initProgressEvent","lengthComputable","loaded","total"], Event_props ], [ "StorageEvent", ["initStorageEvent","key","newValue","oldValue","storageArea"], Event_props ], [ "Text", ["splitText"], ["data","length","appendData","deleteData","insertData","replaceData","substringData"] ], @@ -1350,6 +1361,7 @@ sync_test("builtin_constructors", function() { [ "MessageEvent" ], [ "MimeTypeArray", 11 ], [ "MouseEvent" ], + [ "MSCSSProperties" ], [ "MSCSSRuleList" ], [ "MSCurrentStyleCSSProperties" ], [ "MSEventObj" ], @@ -1665,10 +1677,21 @@ sync_test("style_props", function() { test_exposed("float", true); test_exposed("css-float", false); test_exposed("style-float", false); + test_exposed("styleFloat", true); test_exposed("setProperty", v >= 9); test_exposed("removeProperty", v >= 9); test_exposed("background-clip", v >= 9); test_exposed("transform", v >= 10); + test_exposed("zoom", true); + + try { + style.styleFloat = "left"; + ok(false, "expected exception setting styleFloat"); + }catch(ex) {} + try { + style.zoom = "1.0"; + ok(false, "expected exception setting zoom"); + }catch(ex) {} if(window.getComputedStyle) { style = window.getComputedStyle(document.body); From 9ad3fbad7f76389d554f877264056d033658184b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0994/1506] mshtml: Introduce StyleSheetPrototype and set it as CSSStyleSheetPrototype's prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface is abstract, and is only used in prototype chains (and constructor), so we needn't implement any of it. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlstylesheet.c | 38 +++++++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 3 ++- dlls/mshtml/tests/documentmode.js | 4 ++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 50543a64f7a..166d78a1193 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -24,6 +24,7 @@ #include "winbase.h" #include "winuser.h" #include "ole2.h" +#include "mshtmdid.h" #include "wine/debug.h" @@ -1574,3 +1575,40 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, HTMLDocumentNode *doc *ret = &style_sheet->IHTMLStyleSheet_iface; return S_OK; } + +/* dummy dispex used only for StyleSheet in prototype chain */ +static void StyleSheet_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t stylesheet_hooks[] = { + {DISPID_IHTMLSTYLESHEET_OWNINGELEMENT}, + {DISPID_IHTMLSTYLESHEET_READONLY}, + {DISPID_IHTMLSTYLESHEET_IMPORTS}, + {DISPID_IHTMLSTYLESHEET_ID}, + {DISPID_IHTMLSTYLESHEET_ADDIMPORT}, + {DISPID_IHTMLSTYLESHEET_ADDRULE}, + {DISPID_IHTMLSTYLESHEET_REMOVEIMPORT}, + {DISPID_IHTMLSTYLESHEET_REMOVERULE}, + {DISPID_IHTMLSTYLESHEET_CSSTEXT}, + {DISPID_IHTMLSTYLESHEET_RULES}, + {DISPID_UNKNOWN} + }; + static const dispex_hook_t stylesheet4_hooks[] = { + {DISPID_IHTMLSTYLESHEET4_OWNERRULE}, + {DISPID_IHTMLSTYLESHEET4_CSSRULES}, + {DISPID_IHTMLSTYLESHEET4_INSERTRULE}, + {DISPID_IHTMLSTYLESHEET4_DELETERULE}, + {DISPID_UNKNOWN} + }; + + dispex_info_add_interface(info, IHTMLStyleSheet4_tid, stylesheet4_hooks); + dispex_info_add_interface(info, IHTMLStyleSheet_tid, stylesheet_hooks); +} + +dispex_static_data_t StyleSheet_dispex = { + "StyleSheet", + &no_dispex_vtbl, + PROTO_ID_StyleSheet, + NULL_tid, + no_iface_tids, + StyleSheet_init_dispex_info +}; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index fcd9afe1788..7b948ce436f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -442,7 +442,7 @@ PRIVATE_TID_LIST X(HTMLXMLHttpRequest, "XMLHttpRequest", HTMLXMLHttpRequest_dispex, Object) \ X(HTMLCurrentStyle, "MSCurrentStyleCSSProperties", HTMLCurrentStyle_dispex, HTMLCSSProperties) \ X(HTMLW3CComputedStyle, "CSSStyleDeclaration", HTMLW3CComputedStyle_dispex, Object) \ - X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, Object) \ + X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, StyleSheet) \ X(HTMLStyleSheetRule, "CSSStyleRule", HTMLStyleSheetRule_dispex, Object) \ X(HTMLElement, "HTMLElement", HTMLElement_dispex, DOMElement) \ X(HTMLGenericElement, "HTMLUnknownElement", HTMLGenericElement_dispex, HTMLElement) \ @@ -489,6 +489,7 @@ PRIVATE_TID_LIST X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ X(DOMElement, "Element", DOMElement_dispex, HTMLDOMNode) \ + X(StyleSheet, "StyleSheet", StyleSheet_dispex, Object) \ X(MediaQueryList, "MediaQueryList", media_query_list_dispex, Object) \ X(DOMTokenList, "DOMTokenList", token_list_dispex, Object) \ X(HTMLDOMNode, "Node", HTMLDOMNode_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 63cf324beae..9b6cd2ad509 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -947,6 +947,7 @@ sync_test("builtin_prototypes", function() { [ "Console", "Object" ], [ "Crypto", "Object" ], [ "CSSStyleDeclaration", "Object" ], + [ "CSSStyleSheet", "StyleSheet" ], [ "CustomEvent", "Event" ], [ "DocumentType", "Node" ], [ "DOMImplementation", "Object" ], @@ -1013,6 +1014,7 @@ sync_test("builtin_prototypes", function() { [ "Screen", "Object" ], [ "Storage", "Object" ], [ "StorageEvent", "Event" ], + [ "StyleSheet", "Object" ], [ "StyleSheetList", "Object" ], [ "Text", "CharacterData" ], [ "TextRange", "Object" ], @@ -1065,6 +1067,7 @@ sync_test("builtin_prototypes", function() { protos = [ [ "CharacterData", ["data","length","appendData"], Node_props ], [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], + [ "CSSStyleSheet", ["addRule","cssRules","ownerRule","rules"], ["disabled","media","ownerNode","parentStyleSheet","title","type"] ], [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], [ "Element", Elem_props, Node_props ], @@ -1383,6 +1386,7 @@ sync_test("builtin_constructors", function() { [ "Screen" ], [ "Storage" ], [ "StorageEvent" ], + [ "StyleSheet" ], [ "StyleSheetList" ], [ "Text" ], [ "TextRange" ], From 145ee7c20265ab1ee2af4e8ce838a444aee8b403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0995/1506] mshtml: Introduce CSSRulePrototype and set it as CSSStyleRulePrototype's prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface is abstract, and is only used in prototype chains (and constructor), so we needn't implement any of it. IHTMLCSSRule is added as a stub interface to HTMLStyleSheetRule since it will now inherit from it and have its props exposed. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlstylesheet.c | 128 +++++++++++++++++++++++++++++- dlls/mshtml/mshtml_private.h | 4 +- dlls/mshtml/tests/documentmode.js | 4 + 3 files changed, 134 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 166d78a1193..dfa7596ebc5 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -69,6 +69,7 @@ struct HTMLStyleSheetRulesCollection { struct HTMLStyleSheetRule { DispatchEx dispex; IHTMLStyleSheetRule IHTMLStyleSheetRule_iface; + IHTMLCSSRule IHTMLCSSRule_iface; nsIDOMCSSRule *nsstylesheetrule; }; @@ -170,6 +171,108 @@ static const IHTMLStyleSheetRuleVtbl HTMLStyleSheetRuleVtbl = { HTMLStyleSheetRule_get_readOnly }; +static inline HTMLStyleSheetRule *impl_from_IHTMLCSSRule(IHTMLCSSRule *iface) +{ + return CONTAINING_RECORD(iface, HTMLStyleSheetRule, IHTMLCSSRule_iface); +} + +static HRESULT WINAPI HTMLCSSRule_QueryInterface(IHTMLCSSRule *iface, REFIID riid, void **ppv) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IHTMLStyleSheetRule_QueryInterface(&This->IHTMLStyleSheetRule_iface, riid, ppv); +} + +static ULONG WINAPI HTMLCSSRule_AddRef(IHTMLCSSRule *iface) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IHTMLStyleSheetRule_AddRef(&This->IHTMLStyleSheetRule_iface); +} + +static ULONG WINAPI HTMLCSSRule_Release(IHTMLCSSRule *iface) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IHTMLStyleSheetRule_Release(&This->IHTMLStyleSheetRule_iface); +} + +static HRESULT WINAPI HTMLCSSRule_GetTypeInfoCount( + IHTMLCSSRule *iface, UINT *pctinfo) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLCSSRule_GetTypeInfo(IHTMLCSSRule *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLCSSRule_GetIDsOfNames(IHTMLCSSRule *iface, REFIID riid, LPOLESTR *rgszNames, + UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLCSSRule_Invoke(IHTMLCSSRule *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLCSSRule_get_type(IHTMLCSSRule *iface, USHORT *p) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCSSRule_put_cssText(IHTMLCSSRule *iface, BSTR v) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCSSRule_get_cssText(IHTMLCSSRule *iface, BSTR *p) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCSSRule_get_parentRule(IHTMLCSSRule *iface, IHTMLCSSRule **p) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCSSRule_get_parentStyleSheet(IHTMLCSSRule *iface, IHTMLStyleSheet **p) +{ + HTMLStyleSheetRule *This = impl_from_IHTMLCSSRule(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLCSSRuleVtbl HTMLCSSRuleVtbl = { + HTMLCSSRule_QueryInterface, + HTMLCSSRule_AddRef, + HTMLCSSRule_Release, + HTMLCSSRule_GetTypeInfoCount, + HTMLCSSRule_GetTypeInfo, + HTMLCSSRule_GetIDsOfNames, + HTMLCSSRule_Invoke, + HTMLCSSRule_get_type, + HTMLCSSRule_put_cssText, + HTMLCSSRule_get_cssText, + HTMLCSSRule_get_parentRule, + HTMLCSSRule_get_parentStyleSheet +}; + static inline HTMLStyleSheetRule *HTMLStyleSheetRule_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, HTMLStyleSheetRule, dispex); @@ -211,6 +314,12 @@ static const dispex_static_data_vtbl_t HTMLStyleSheetRule_dispex_vtbl = { .unlink = HTMLStyleSheetRule_unlink }; +static void HTMLStyleSheetRule_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + if(mode >= COMPAT_MODE_IE9) + dispex_info_add_interface(info, IHTMLCSSRule_tid, NULL); +} + static const tid_t HTMLStyleSheetRule_iface_tids[] = { IHTMLStyleSheetRule_tid, 0 @@ -220,7 +329,8 @@ dispex_static_data_t HTMLStyleSheetRule_dispex = { &HTMLStyleSheetRule_dispex_vtbl, PROTO_ID_HTMLStyleSheetRule, DispHTMLStyleSheetRule_tid, - HTMLStyleSheetRule_iface_tids + HTMLStyleSheetRule_iface_tids, + HTMLStyleSheetRule_init_dispex_info }; static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, HTMLInnerWindow *window, @@ -233,6 +343,7 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, HTMLInne return E_OUTOFMEMORY; rule->IHTMLStyleSheetRule_iface.lpVtbl = &HTMLStyleSheetRuleVtbl; + rule->IHTMLCSSRule_iface.lpVtbl = &HTMLCSSRuleVtbl; rule->nsstylesheetrule = NULL; init_dispatch(&rule->dispex, &HTMLStyleSheetRule_dispex, window, compat_mode); @@ -249,6 +360,21 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, HTMLInne return S_OK; } +/* dummy dispex used only for StyleSheet in prototype chain */ +static void CSSRule_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + dispex_info_add_interface(info, IHTMLCSSRule_tid, NULL); +} + +dispex_static_data_t CSSRule_dispex = { + "CSSRule", + &no_dispex_vtbl, + PROTO_ID_CSSRule, + NULL_tid, + no_iface_tids, + CSSRule_init_dispex_info +}; + static inline HTMLStyleSheetRulesCollection *impl_from_IHTMLStyleSheetRulesCollection(IHTMLStyleSheetRulesCollection *iface) { return CONTAINING_RECORD(iface, HTMLStyleSheetRulesCollection, IHTMLStyleSheetRulesCollection_iface); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7b948ce436f..ed901c36627 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -361,6 +361,7 @@ typedef struct ScriptHost ScriptHost; XIID(IHTMLStyleSheet) \ XIID(IHTMLStyleSheet4) \ XIID(IHTMLStyleSheetRule) \ + XIID(IHTMLCSSRule) \ XIID(IHTMLStyleSheetRulesCollection) \ XIID(IHTMLStyleSheetsCollection) \ XIID(IHTMLTable) \ @@ -443,7 +444,7 @@ PRIVATE_TID_LIST X(HTMLCurrentStyle, "MSCurrentStyleCSSProperties", HTMLCurrentStyle_dispex, HTMLCSSProperties) \ X(HTMLW3CComputedStyle, "CSSStyleDeclaration", HTMLW3CComputedStyle_dispex, Object) \ X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, StyleSheet) \ - X(HTMLStyleSheetRule, "CSSStyleRule", HTMLStyleSheetRule_dispex, Object) \ + X(HTMLStyleSheetRule, "CSSStyleRule", HTMLStyleSheetRule_dispex, CSSRule) \ X(HTMLElement, "HTMLElement", HTMLElement_dispex, DOMElement) \ X(HTMLGenericElement, "HTMLUnknownElement", HTMLGenericElement_dispex, HTMLElement) \ X(HTMLAnchorElement, "HTMLAnchorElement", HTMLAnchorElement_dispex, HTMLElement) \ @@ -489,6 +490,7 @@ PRIVATE_TID_LIST X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ X(DOMElement, "Element", DOMElement_dispex, HTMLDOMNode) \ + X(CSSRule, "CSSRule", CSSRule_dispex, Object) \ X(StyleSheet, "StyleSheet", StyleSheet_dispex, Object) \ X(MediaQueryList, "MediaQueryList", media_query_list_dispex, Object) \ X(DOMTokenList, "DOMTokenList", token_list_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 9b6cd2ad509..63ceb18638e 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -946,7 +946,9 @@ sync_test("builtin_prototypes", function() { [ "Comment", "CharacterData" ], [ "Console", "Object" ], [ "Crypto", "Object" ], + [ "CSSRule", "Object" ], [ "CSSStyleDeclaration", "Object" ], + [ "CSSStyleRule", "CSSRule" ], [ "CSSStyleSheet", "StyleSheet" ], [ "CustomEvent", "Event" ], [ "DocumentType", "Node" ], @@ -1067,6 +1069,7 @@ sync_test("builtin_prototypes", function() { protos = [ [ "CharacterData", ["data","length","appendData"], Node_props ], [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], + [ "CSSStyleRule", ["readOnly","selectorText","style"], ["cssText","parentRule","parentStyleSheet","type" ] ], [ "CSSStyleSheet", ["addRule","cssRules","ownerRule","rules"], ["disabled","media","ownerNode","parentStyleSheet","title","type"] ], [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], @@ -1320,6 +1323,7 @@ sync_test("builtin_constructors", function() { [ "Comment" ], [ "Console", 10 ], [ "Crypto", 11 ], + [ "CSSRule" ], [ "CSSStyleDeclaration" ], [ "CSSStyleRule" ], [ "CSSStyleSheet" ], From f9597c22d99e8d81ab6423633ee8c5afdeb42c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0996/1506] mshtml: Introduce DocumentPrototype and set it as HTMLDocumentPrototype's prototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmldoc.c | 9 +++++++++ dlls/mshtml/mshtml_private.h | 3 ++- dlls/mshtml/tests/documentmode.js | 4 ++++ dlls/mshtml/tests/es5.js | 1 - 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index b7695bb14e7..ac538a1e912 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6385,6 +6385,15 @@ dispex_static_data_t HTMLDocumentNode_dispex = { HTMLDocumentNode_init_dispex_info }; +dispex_static_data_t DocumentNode_dispex = { + "Document", + &HTMLDocumentNode_event_target_vtbl.dispex_vtbl, + PROTO_ID_Document, + DispHTMLDocument_tid, + HTMLDocumentNode_iface_tids, + HTMLDocumentNode_init_dispex_info +}; + static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window) { HTMLDocumentNode *doc; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ed901c36627..ab0921b29a1 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -425,7 +425,7 @@ PRIVATE_TID_LIST X(HTMLDOMChildrenCollection, "NodeList", HTMLDOMChildrenCollection_dispex, Object) \ X(HTMLDOMImplementation, "DOMImplementation", HTMLDOMImplementation_dispex, Object) \ X(HTMLDOMTextNode, "Text", HTMLDOMTextNode_dispex, DOMCharacterData) \ - X(HTMLDocument, "HTMLDocument", HTMLDocumentNode_dispex, Object) \ + X(HTMLDocument, "HTMLDocument", HTMLDocumentNode_dispex, Document) \ X(HTMLWindow, "Window", HTMLWindow_dispex, Object) \ X(HTMLAttributeCollection, "NamedNodeMap", HTMLAttributeCollection_dispex, Object) \ X(HTMLElementCollection, "HTMLCollection", HTMLElementCollection_dispex, Object) \ @@ -488,6 +488,7 @@ PRIVATE_TID_LIST X(DOMStorageEvent, "StorageEvent", DOMStorageEvent_dispex, DOMEvent) \ X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ + X(Document, "Document", DocumentNode_dispex, HTMLDOMNode) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ X(DOMElement, "Element", DOMElement_dispex, HTMLDOMNode) \ X(CSSRule, "CSSRule", CSSRule_dispex, Object) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 63ceb18638e..f3617ac64c5 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -951,6 +951,7 @@ sync_test("builtin_prototypes", function() { [ "CSSStyleRule", "CSSRule" ], [ "CSSStyleSheet", "StyleSheet" ], [ "CustomEvent", "Event" ], + [ "Document", "Node" ], [ "DocumentType", "Node" ], [ "DOMImplementation", "Object" ], [ "DOMTokenList", "Object" ], @@ -962,6 +963,7 @@ sync_test("builtin_prototypes", function() { [ "HTMLBodyElement", "HTMLElement" ], [ "HTMLButtonElement", "HTMLElement" ], [ "HTMLCollection", "Object" ], + [ "HTMLDocument", "Document" ], [ "HTMLElement", "Element" ], [ "HTMLEmbedElement", "HTMLElement" ], [ "HTMLFormElement", "HTMLElement" ], @@ -1072,6 +1074,7 @@ sync_test("builtin_prototypes", function() { [ "CSSStyleRule", ["readOnly","selectorText","style"], ["cssText","parentRule","parentStyleSheet","type" ] ], [ "CSSStyleSheet", ["addRule","cssRules","ownerRule","rules"], ["disabled","media","ownerNode","parentStyleSheet","title","type"] ], [ "CustomEvent", ["detail","initCustomEvent"], Event_props ], + [ "Document", ["body","doctype","documentMode","onactivate","parentWindow","styleSheets","title"], Node_props ], [ "DocumentType", ["entities","internalSubset","name","notations","publicId","systemId"], Node_props ], [ "Element", Elem_props, Node_props ], [ "HTMLElement", HtmlElem_props, Elem_props ], @@ -1328,6 +1331,7 @@ sync_test("builtin_constructors", function() { [ "CSSStyleRule" ], [ "CSSStyleSheet" ], [ "CustomEvent" ], + [ "Document" ], [ "DocumentType" ], [ "DOMImplementation" ], [ "DOMTokenList", 10 ], diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 671aabab9fa..2367ca99320 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3032,7 +3032,6 @@ sync_test("instanceof", function() { r = (document.createElement("div") instanceof HTMLIFrameElement); ok(r === false, "div element instance of HTMLIFrameElement"); r = (document instanceof Node); - todo_wine. ok(r === true, "document not instance of Node"); }); From 9a889b78cbb36a4d8eb35d8af29c38a0a50f4aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0997/1506] mshtml: Set the document node to DocumentNode in IE9 and IE10 modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have to delay setting it once the mode is changed. Note that IE8 uses HTMLDocumentNodePrototype as prototype, even though it's a different architecture (without jscript proxies). Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 45 ++++++++++++++++--------------- dlls/mshtml/htmldoc.c | 10 ++++--- dlls/mshtml/tests/documentmode.js | 2 +- dlls/mshtml/tests/events.c | 1 - 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 6b3cf2ef7b5..2cb4db05822 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1987,13 +1987,33 @@ compat_mode_t dispex_compat_mode(DispatchEx *dispex) : dispex->info->desc->vtbl->get_compat_mode(dispex); } +static dispex_data_t *ensure_dispex_info(dispex_static_data_t *desc, compat_mode_t compat_mode) +{ + if(!desc->info_cache[compat_mode]) { + EnterCriticalSection(&cs_dispex_static_data); + if(!desc->info_cache[compat_mode]) + desc->info_cache[compat_mode] = preprocess_dispex_data(desc, compat_mode); + LeaveCriticalSection(&cs_dispex_static_data); + } + return desc->info_cache[compat_mode]; +} + +static BOOL ensure_real_info(DispatchEx *dispex) +{ + if(dispex->info != dispex->info->desc->delayed_init_info) + return TRUE; + + dispex->info->desc->vtbl->finalize_dispex(dispex); + return dispex->info != NULL; +} + HRESULT dispex_to_string(DispatchEx *dispex, BSTR *ret) { static const WCHAR prefix[8] = L"[object "; static const WCHAR suffix[] = L"]"; WCHAR buf[ARRAY_SIZE(prefix) + 36 + ARRAY_SIZE(suffix)], *p = buf; compat_mode_t compat_mode = dispex_compat_mode(dispex); - const char *name = dispex->info->desc->name; + const char *name; if(!ret) return E_INVALIDARG; @@ -2003,6 +2023,9 @@ HRESULT dispex_to_string(DispatchEx *dispex, BSTR *ret) if(compat_mode < COMPAT_MODE_IE9) p--; else { + if(!ensure_real_info(dispex)) + return E_OUTOFMEMORY; + name = dispex->info->desc->name; while(*name) *p++ = *name++; assert(p + ARRAY_SIZE(suffix) - buf <= ARRAY_SIZE(buf)); @@ -2013,26 +2036,6 @@ HRESULT dispex_to_string(DispatchEx *dispex, BSTR *ret) return *ret ? S_OK : E_OUTOFMEMORY; } -static dispex_data_t *ensure_dispex_info(dispex_static_data_t *desc, compat_mode_t compat_mode) -{ - if(!desc->info_cache[compat_mode]) { - EnterCriticalSection(&cs_dispex_static_data); - if(!desc->info_cache[compat_mode]) - desc->info_cache[compat_mode] = preprocess_dispex_data(desc, compat_mode); - LeaveCriticalSection(&cs_dispex_static_data); - } - return desc->info_cache[compat_mode]; -} - -static BOOL ensure_real_info(DispatchEx *dispex) -{ - if(dispex->info != dispex->info->desc->delayed_init_info) - return TRUE; - - dispex->info->desc->vtbl->finalize_dispex(dispex); - return dispex->info != NULL; -} - struct legacy_prototype *get_legacy_prototype(HTMLInnerWindow *window, prototype_id_t prot_id, compat_mode_t compat_mode) { diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index ac538a1e912..62122c520b9 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6240,11 +6240,15 @@ static compat_mode_t HTMLDocumentNode_get_compat_mode(DispatchEx *dispex) static void HTMLDocumentNode_finalize_dispex(DispatchEx *dispex) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); + compat_mode_t compat_mode = lock_document_mode(This); + dispex_static_data_t *dispex_data; - lock_document_mode(This); + if(COMPAT_MODE_IE9 <= compat_mode && compat_mode < COMPAT_MODE_IE11) + dispex_data = &DocumentNode_dispex; + else + dispex_data = &HTMLDocumentNode_dispex; - /* FIXME: IE9 and IE10 have different dispex data */ - finalize_delayed_init_dispex(dispex, get_inner_window(This), &HTMLDocumentNode_dispex); + finalize_delayed_init_dispex(dispex, get_inner_window(This), dispex_data); } static nsISupports *HTMLDocumentNode_get_gecko_target(DispatchEx *dispex) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index f3617ac64c5..e1ef0b87312 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -322,7 +322,7 @@ sync_test("builtin_toString", function() { if(clientRects) test("clientRect", clientRects[0], "ClientRect"); if(clientRects) test("clientRects", clientRects, "ClientRectList"); if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties"); - if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument"); + test("document", document, v < 11 ? "Document" : "HTMLDocument"); test("elements", document.getElementsByTagName("body"), "HTMLCollection"); test("history", window.history, "History"); test("implementation", document.implementation, "DOMImplementation"); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index b1b9de55546..a434327631d 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -4207,7 +4207,6 @@ static void test_doc_obj(IHTMLDocument2 *doc) bstr = NULL; hres = IHTMLDocument2_toString(doc, &bstr); ok(hres == S_OK, "toString failed: %08lx\n", hres); - todo_wine_if(document_mode >= 9) ok(!wcscmp(bstr, (document_mode < 9 ? L"[object]" : L"[object Document]")), "toString returned %s\n", wine_dbgstr_w(bstr)); SysFreeString(bstr); From 0d498052cefd663ba5d1a3970249a8e68097b377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0998/1506] mshtml: Use a helper function to find an attribute in the collection's list. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlelem.c | 43 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 2b1a3d9df49..eceee3cf5b8 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -524,6 +524,24 @@ HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **re return hres; } +static HTMLDOMAttribute *find_attr_in_list(HTMLAttributeCollection *attrs, DISPID dispid, LONG *pos) +{ + HTMLDOMAttribute *iter, *ret = NULL; + struct list *list = &attrs->attrs; + unsigned i = 0; + + LIST_FOR_EACH_ENTRY(iter, list, HTMLDOMAttribute, entry) { + if(iter->dispid == dispid) { + ret = iter; + break; + } + i++; + } + if(pos) + *pos = i; + return ret; +} + typedef struct { DispatchEx dispex; IHTMLRect IHTMLRect_iface; @@ -4760,7 +4778,7 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD IHTMLDOMAttribute **ppretAttribute) { HTMLElement *This = impl_from_IHTMLElement4(iface); - HTMLDOMAttribute *attr, *iter, *replace = NULL; + HTMLDOMAttribute *attr, *replace; HTMLAttributeCollection *attrs; DISPID dispid; HRESULT hres; @@ -4785,13 +4803,7 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD if(FAILED(hres)) return hres; - LIST_FOR_EACH_ENTRY(iter, &attrs->attrs, HTMLDOMAttribute, entry) { - if(iter->dispid == dispid) { - replace = iter; - break; - } - } - + replace = find_attr_in_list(attrs, dispid, NULL); if(replace) { hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value); if(FAILED(hres)) { @@ -8514,20 +8526,9 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr) { - HTMLDOMAttribute *iter; - LONG pos = 0; HRESULT hres; - *attr = NULL; - LIST_FOR_EACH_ENTRY(iter, &This->attrs, HTMLDOMAttribute, entry) { - if(iter->dispid == id) { - *attr = iter; - break; - } - pos++; - } - - if(!*attr) { + if(!(*attr = find_attr_in_list(This, id, list_pos))) { hres = HTMLDOMAttribute_Create(NULL, This->elem->node.doc, This->elem, id, dispex_compat_mode(&This->elem->node.event_target.dispex), attr); if(FAILED(hres)) @@ -8535,8 +8536,6 @@ static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG } IHTMLDOMAttribute_AddRef(&(*attr)->IHTMLDOMAttribute_iface); - if(list_pos) - *list_pos = pos; return S_OK; } From 18cd54099376627c6bf7774c4f84b62389da774b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 0999/1506] mshtml: Implement proper attribute nodes for IE9+ modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We only use them for IE9+ modes because the legacy node-like attribute props are correct wrt the older compat modes. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 17 +++ dlls/mshtml/htmlattr.c | 226 +++++++++++++++++++++++++++--- dlls/mshtml/htmldoc.c | 19 ++- dlls/mshtml/htmlelem.c | 203 ++++++++++++++++++++------- dlls/mshtml/mshtml_private.h | 9 +- dlls/mshtml/tests/documentmode.js | 70 +++++++++ 6 files changed, 474 insertions(+), 70 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 2cb4db05822..770900d50c7 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -749,6 +749,23 @@ dispex_prop_type_t get_dispid_type(DISPID id) return DISPEXPROP_BUILTIN; } +BOOL is_custom_attribute(DispatchEx *dispex, const WCHAR *name) +{ + func_info_t **funcs = dispex->info->name_table; + DWORD i, a = 0, b = dispex->info->func_cnt; + int c; + + while(a < b) { + i = (a + b) / 2; + c = wcsicmp(funcs[i]->name, name); + if(!c) + return (funcs[i]->func_disp_idx >= 0); + if(c > 0) b = i; + else a = i + 1; + } + return TRUE; +} + static HRESULT variant_copy(VARIANT *dest, VARIANT *src) { if(V_VT(src) == VT_BSTR && !V_BSTR(src)) { diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 380c736cefc..cf1ffbf7247 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -41,32 +41,32 @@ static HRESULT WINAPI HTMLDOMAttribute_QueryInterface(IHTMLDOMAttribute *iface, REFIID riid, void **ppv) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_QueryInterface(&This->dispex.IDispatchEx_iface, riid, ppv); + return IDispatchEx_QueryInterface(&This->node.event_target.dispex.IDispatchEx_iface, riid, ppv); } static ULONG WINAPI HTMLDOMAttribute_AddRef(IHTMLDOMAttribute *iface) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_AddRef(&This->dispex.IDispatchEx_iface); + return IDispatchEx_AddRef(&This->node.event_target.dispex.IDispatchEx_iface); } static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_Release(&This->dispex.IDispatchEx_iface); + return IDispatchEx_Release(&This->node.event_target.dispex.IDispatchEx_iface); } static HRESULT WINAPI HTMLDOMAttribute_GetTypeInfoCount(IHTMLDOMAttribute *iface, UINT *pctinfo) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); + return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLDOMAttribute_GetTypeInfo(IHTMLDOMAttribute *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); + return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } static HRESULT WINAPI HTMLDOMAttribute_GetIDsOfNames(IHTMLDOMAttribute *iface, REFIID riid, @@ -74,7 +74,7 @@ static HRESULT WINAPI HTMLDOMAttribute_GetIDsOfNames(IHTMLDOMAttribute *iface, R LCID lcid, DISPID *rgDispId) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); } @@ -83,7 +83,7 @@ static HRESULT WINAPI HTMLDOMAttribute_Invoke(IHTMLDOMAttribute *iface, DISPID d VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); - return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } @@ -91,6 +91,9 @@ static HRESULT WINAPI HTMLDOMAttribute_get_nodeName(IHTMLDOMAttribute *iface, BS { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); + if(This->node.nsnode) + return IHTMLDOMNode_get_nodeName(&This->node.IHTMLDOMNode_iface, p); + TRACE("(%p)->(%p)\n", This, p); if(!This->elem) { @@ -114,6 +117,9 @@ static HRESULT WINAPI HTMLDOMAttribute_put_nodeValue(IHTMLDOMAttribute *iface, V EXCEPINFO ei; VARIANT ret; + if(This->node.nsnode) + return IHTMLDOMNode_put_nodeValue(&This->node.IHTMLDOMNode_iface, v); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); if(!This->elem) @@ -129,6 +135,9 @@ static HRESULT WINAPI HTMLDOMAttribute_get_nodeValue(IHTMLDOMAttribute *iface, V { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface); + if(This->node.nsnode) + return IHTMLDOMNode_get_nodeValue(&This->node.IHTMLDOMNode_iface, p); + TRACE("(%p)->(%p)\n", This, p); if(!This->elem) @@ -145,9 +154,16 @@ static HRESULT WINAPI HTMLDOMAttribute_get_specified(IHTMLDOMAttribute *iface, V BSTR name; nsresult nsres; HRESULT hres; + cpp_bool b; TRACE("(%p)->(%p)\n", This, p); + if(This->node.nsnode) { + nsres = nsIDOMAttr_GetSpecified((nsIDOMAttr*)This->node.nsnode, &b); + *p = variant_bool(NS_SUCCEEDED(nsres) && b); + return S_OK; + } + if(!This->elem || !This->elem->dom_element) { FIXME("NULL This->elem\n"); return E_UNEXPECTED; @@ -221,21 +237,21 @@ static ULONG WINAPI HTMLDOMAttribute2_Release(IHTMLDOMAttribute2 *iface) static HRESULT WINAPI HTMLDOMAttribute2_GetTypeInfoCount(IHTMLDOMAttribute2 *iface, UINT *pctinfo) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); - return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); + return IDispatchEx_GetTypeInfoCount(&This->node.event_target.dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLDOMAttribute2_GetTypeInfo(IHTMLDOMAttribute2 *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); - return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); + return IDispatchEx_GetTypeInfo(&This->node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } static HRESULT WINAPI HTMLDOMAttribute2_GetIDsOfNames(IHTMLDOMAttribute2 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); - return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + return IDispatchEx_GetIDsOfNames(&This->node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); } @@ -244,26 +260,43 @@ static HRESULT WINAPI HTMLDOMAttribute2_Invoke(IHTMLDOMAttribute2 *iface, DISPID VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); - return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + return IDispatchEx_Invoke(&This->node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } static HRESULT WINAPI HTMLDOMAttribute2_get_name(IHTMLDOMAttribute2 *iface, BSTR *p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + nsAString nsstr; + nsresult nsres; TRACE("(%p)->(%p)\n", This, p); + if(This->node.nsnode) { + nsAString_InitDepend(&nsstr, NULL); + nsres = nsIDOMAttr_GetName((nsIDOMAttr*)This->node.nsnode, &nsstr); + return return_nsstr(nsres, &nsstr, p); + } + return IHTMLDOMAttribute_get_nodeName(&This->IHTMLDOMAttribute_iface, p); } static HRESULT WINAPI HTMLDOMAttribute2_put_value(IHTMLDOMAttribute2 *iface, BSTR v) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + nsAString nsstr; + nsresult nsres; VARIANT var; TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + if(This->node.nsnode) { + nsAString_InitDepend(&nsstr, v); + nsres = nsIDOMAttr_SetValue((nsIDOMAttr*)This->node.nsnode, &nsstr); + nsAString_Finish(&nsstr); + return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL; + } + V_VT(&var) = VT_BSTR; V_BSTR(&var) = v; return IHTMLDOMAttribute_put_nodeValue(&This->IHTMLDOMAttribute_iface, var); @@ -272,11 +305,19 @@ static HRESULT WINAPI HTMLDOMAttribute2_put_value(IHTMLDOMAttribute2 *iface, BST static HRESULT WINAPI HTMLDOMAttribute2_get_value(IHTMLDOMAttribute2 *iface, BSTR *p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + nsAString nsstr; + nsresult nsres; VARIANT val; HRESULT hres; TRACE("(%p)->(%p)\n", This, p); + if(This->node.nsnode) { + nsAString_InitDepend(&nsstr, NULL); + nsres = nsIDOMAttr_GetValue((nsIDOMAttr*)This->node.nsnode, &nsstr); + return return_nsstr(nsres, &nsstr, p); + } + V_VT(&val) = VT_EMPTY; if(This->elem) hres = get_elem_attr_value_by_dispid(This->elem, This->dispid, &val); @@ -307,7 +348,12 @@ static HRESULT WINAPI HTMLDOMAttribute2_get_expando(IHTMLDOMAttribute2 *iface, V static HRESULT WINAPI HTMLDOMAttribute2_get_nodeType(IHTMLDOMAttribute2 *iface, LONG *p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_nodeType(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } @@ -315,6 +361,9 @@ static HRESULT WINAPI HTMLDOMAttribute2_get_parentNode(IHTMLDOMAttribute2 *iface { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + if(This->node.nsnode) + return IHTMLDOMNode_get_parentNode(&This->node.IHTMLDOMNode_iface, p); + TRACE("(%p)->(%p)\n", This, p); *p = NULL; @@ -324,49 +373,84 @@ static HRESULT WINAPI HTMLDOMAttribute2_get_parentNode(IHTMLDOMAttribute2 *iface static HRESULT WINAPI HTMLDOMAttribute2_get_childNodes(IHTMLDOMAttribute2 *iface, IDispatch **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_childNodes(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_get_firstChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_firstChild(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_get_lastChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_lastChild(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_get_previousSibling(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_previousSibling(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_get_nextSibling(IHTMLDOMAttribute2 *iface, IHTMLDOMNode **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_nextSibling(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_get_attributes(IHTMLDOMAttribute2 *iface, IDispatch **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_get_attributes(&This->node.IHTMLDOMNode_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_get_ownerDocument(IHTMLDOMAttribute2 *iface, IDispatch **p) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode2_get_ownerDocument(&This->node.IHTMLDOMNode2_iface, p); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; } @@ -374,7 +458,12 @@ static HRESULT WINAPI HTMLDOMAttribute2_insertBefore(IHTMLDOMAttribute2 *iface, VARIANT refChild, IHTMLDOMNode **node) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_insertBefore(&This->node.IHTMLDOMNode_iface, newChild, refChild, node); + FIXME("(%p)->(%p %s %p)\n", This, newChild, debugstr_variant(&refChild), node); + return E_NOTIMPL; } @@ -382,7 +471,12 @@ static HRESULT WINAPI HTMLDOMAttribute2_replaceChild(IHTMLDOMAttribute2 *iface, IHTMLDOMNode *oldChild, IHTMLDOMNode **node) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_replaceChild(&This->node.IHTMLDOMNode_iface, newChild, oldChild, node); + FIXME("(%p)->(%p %p %p)\n", This, newChild, oldChild, node); + return E_NOTIMPL; } @@ -390,7 +484,12 @@ static HRESULT WINAPI HTMLDOMAttribute2_removeChild(IHTMLDOMAttribute2 *iface, I IHTMLDOMNode **node) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_removeChild(&This->node.IHTMLDOMNode_iface, oldChild, node); + FIXME("(%p)->(%p %p)\n", This, oldChild, node); + return E_NOTIMPL; } @@ -398,14 +497,24 @@ static HRESULT WINAPI HTMLDOMAttribute2_appendChild(IHTMLDOMAttribute2 *iface, I IHTMLDOMNode **node) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_appendChild(&This->node.IHTMLDOMNode_iface, newChild, node); + FIXME("(%p)->(%p %p)\n", This, newChild, node); + return E_NOTIMPL; } static HRESULT WINAPI HTMLDOMAttribute2_hasChildNodes(IHTMLDOMAttribute2 *iface, VARIANT_BOOL *fChildren) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + + if(This->node.nsnode) + return IHTMLDOMNode_hasChildNodes(&This->node.IHTMLDOMNode_iface, fChildren); + FIXME("(%p)->(%p)\n", This, fChildren); + return E_NOTIMPL; } @@ -413,7 +522,20 @@ static HRESULT WINAPI HTMLDOMAttribute2_cloneNode(IHTMLDOMAttribute2 *iface, VAR IHTMLDOMAttribute **clonedNode) { HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute2(iface); + HRESULT hres; + + if(This->node.nsnode) { + IHTMLDOMNode *cloned; + hres = IHTMLDOMNode_cloneNode(&This->node.IHTMLDOMNode_iface, fDeep, &cloned); + if(SUCCEEDED(hres)) { + hres = IHTMLDOMNode_QueryInterface(cloned, &IID_IHTMLDOMAttribute, (void**)clonedNode); + IHTMLDOMNode_Release(cloned); + } + return hres; + } + FIXME("(%p)->(%x %p)\n", This, fDeep, clonedNode); + return E_NOTIMPL; } @@ -446,11 +568,47 @@ static const IHTMLDOMAttribute2Vtbl HTMLDOMAttribute2Vtbl = { HTMLDOMAttribute2_cloneNode }; +static inline HTMLDOMAttribute *impl_from_HTMLDOMNode(HTMLDOMNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLDOMAttribute, node); +} + static inline HTMLDOMAttribute *impl_from_DispatchEx(DispatchEx *iface) { - return CONTAINING_RECORD(iface, HTMLDOMAttribute, dispex); + return CONTAINING_RECORD(iface, HTMLDOMAttribute, node.event_target.dispex); +} + +static HRESULT HTMLDOMAttribute_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) +{ + HTMLDOMAttribute *This = impl_from_HTMLDOMNode(iface); + HTMLDOMAttribute *new_attr; + nsIDOMAttr *nsattr; + nsresult nsres; + HRESULT hres; + + nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMAttr, (void**)&nsattr); + if(NS_FAILED(nsres)) { + ERR("no nsIDOMAttr iface\n"); + return E_FAIL; + } + + hres = HTMLDOMAttribute_Create(NULL, This->node.doc, This->elem, This->dispid, nsattr, + dispex_compat_mode(&This->node.event_target.dispex), &new_attr); + nsIDOMAttr_Release(nsattr); + if(FAILED(hres)) + return hres; + + *ret = &new_attr->node; + return S_OK; } +static const cpc_entry_t HTMLDOMAttribute_cpc[] = {{NULL}}; + +static const NodeImplVtbl HTMLDOMAttributeImplVtbl = { + .cpc_entries = HTMLDOMAttribute_cpc, + .clone = HTMLDOMAttribute_clone, +}; + static void *HTMLDOMAttribute_query_interface(DispatchEx *dispex, REFIID riid) { HTMLDOMAttribute *This = impl_from_DispatchEx(dispex); @@ -459,6 +617,8 @@ static void *HTMLDOMAttribute_query_interface(DispatchEx *dispex, REFIID riid) return &This->IHTMLDOMAttribute_iface; if(IsEqualGUID(&IID_IHTMLDOMAttribute2, riid)) return &This->IHTMLDOMAttribute2_iface; + if(This->node.nsnode) + return HTMLDOMNode_query_interface(&This->node.event_target.dispex, riid); return NULL; } @@ -467,6 +627,8 @@ static void HTMLDOMAttribute_traverse(DispatchEx *dispex, nsCycleCollectionTrave { HTMLDOMAttribute *This = impl_from_DispatchEx(dispex); + if(This->node.nsnode) + HTMLDOMNode_traverse(&This->node.event_target.dispex, cb); if(This->elem) note_cc_edge((nsISupports*)&This->elem->node.IHTMLDOMNode_iface, "elem", cb); traverse_variant(&This->value, "value", cb); @@ -476,6 +638,8 @@ static void HTMLDOMAttribute_unlink(DispatchEx *dispex) { HTMLDOMAttribute *This = impl_from_DispatchEx(dispex); + if(This->node.nsnode) + HTMLDOMNode_unlink(&This->node.event_target.dispex); if(This->elem) { HTMLElement *elem = This->elem; This->elem = NULL; @@ -489,7 +653,11 @@ static void HTMLDOMAttribute_destructor(DispatchEx *dispex) HTMLDOMAttribute *This = impl_from_DispatchEx(dispex); VariantClear(&This->value); free(This->name); - free(This); + + if(This->node.nsnode) + HTMLDOMNode_destructor(&This->node.event_target.dispex); + else + free(This); } static const dispex_static_data_vtbl_t HTMLDOMAttribute_dispex_vtbl = { @@ -499,6 +667,16 @@ static const dispex_static_data_vtbl_t HTMLDOMAttribute_dispex_vtbl = { .unlink = HTMLDOMAttribute_unlink }; +static void HTMLDOMAttribute_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLDOMNode_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE9) { + dispex_info_add_interface(info, IHTMLDOMNode_tid, NULL); + dispex_info_add_interface(info, IHTMLDOMNode2_tid, NULL); + } +} + static const tid_t HTMLDOMAttribute_iface_tids[] = { IHTMLDOMAttribute_tid, IHTMLDOMAttribute2_tid, @@ -509,7 +687,8 @@ dispex_static_data_t HTMLDOMAttribute_dispex = { &HTMLDOMAttribute_dispex_vtbl, PROTO_ID_HTMLDOMAttribute, DispHTMLDOMAttribute_tid, - HTMLDOMAttribute_iface_tids + HTMLDOMAttribute_iface_tids, + HTMLDOMAttribute_init_dispex_info }; HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute *iface) @@ -518,7 +697,7 @@ HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute *iface) } HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLDocumentNode *doc, HTMLElement *elem, DISPID dispid, - compat_mode_t compat_mode, HTMLDOMAttribute **attr) + nsIDOMAttr *nsattr, compat_mode_t compat_mode, HTMLDOMAttribute **attr) { HTMLAttributeCollection *col; HTMLDOMAttribute *ret; @@ -533,15 +712,14 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLDocumentNode *doc, HTMLEl ret->dispid = dispid; ret->elem = elem; - init_dispatch(&ret->dispex, &HTMLDOMAttribute_dispex, get_inner_window(doc), compat_mode); - - /* For attributes attached to an element, (elem,dispid) pair should be valid used for its operation. */ + /* For attributes attached to an element, (elem,dispid) pair should + be valid used for its operation if we don't have a proper node. */ if(elem) { IHTMLDOMNode_AddRef(&elem->node.IHTMLDOMNode_iface); hres = HTMLElement_get_attr_col(&elem->node, &col); if(FAILED(hres)) { - IHTMLDOMAttribute_Release(&ret->IHTMLDOMAttribute_iface); + free(ret); return hres; } IHTMLAttributeCollection_Release(&col->IHTMLAttributeCollection_iface); @@ -549,6 +727,16 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLDocumentNode *doc, HTMLEl list_add_tail(&elem->attrs->attrs, &ret->entry); } + /* If we have a nsattr, use proper node */ + if(nsattr) { + ret->node.vtbl = &HTMLDOMAttributeImplVtbl; + HTMLDOMNode_Init(doc, &ret->node, (nsIDOMNode*)nsattr, &HTMLDOMAttribute_dispex); + *attr = ret; + return S_OK; + } + + init_dispatch(&ret->node.event_target.dispex, &HTMLDOMAttribute_dispex, get_inner_window(doc), compat_mode); + /* For detached attributes we may still do most operations if we have its name available. */ if(name) { ret->name = wcsdup(name); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 62122c520b9..89b6e58f48b 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -3238,13 +3238,28 @@ static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR IHTMLDOMAttribute **ppattribute) { HTMLDocumentNode *This = impl_from_IHTMLDocument5(iface); + compat_mode_t compat_mode = dispex_compat_mode(&This->node.event_target.dispex); + nsIDOMAttr *nsattr = NULL; HTMLDOMAttribute *attr; + nsresult nsres; + nsAString str; HRESULT hres; TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute); - hres = HTMLDOMAttribute_Create(bstrattrName, This, NULL, 0, - dispex_compat_mode(&This->node.event_target.dispex), &attr); + if(compat_mode >= COMPAT_MODE_IE9) { + nsAString_InitDepend(&str, bstrattrName); + nsres = nsIDOMDocument_CreateAttribute(This->dom_document, &str, &nsattr); + nsAString_Finish(&str); + if(NS_FAILED(nsres)) { + ERR("CreateAttribute failed: %08lx\n", nsres); + return E_FAIL; + } + } + + hres = HTMLDOMAttribute_Create(bstrattrName, This, NULL, 0, nsattr, compat_mode, &attr); + if(nsattr) + nsIDOMAttr_Release(nsattr); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index eceee3cf5b8..8b260ce76b0 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -524,24 +524,52 @@ HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **re return hres; } -static HTMLDOMAttribute *find_attr_in_list(HTMLAttributeCollection *attrs, DISPID dispid, LONG *pos) +static HTMLDOMAttribute *find_attr_in_list(HTMLAttributeCollection *attrs, DISPID dispid, nsIDOMAttr *nsattr, LONG *pos) { HTMLDOMAttribute *iter, *ret = NULL; struct list *list = &attrs->attrs; unsigned i = 0; - LIST_FOR_EACH_ENTRY(iter, list, HTMLDOMAttribute, entry) { - if(iter->dispid == dispid) { - ret = iter; - break; + if(nsattr) { + LIST_FOR_EACH_ENTRY(iter, list, HTMLDOMAttribute, entry) { + if(iter->node.nsnode == (nsIDOMNode*)nsattr) { + ret = iter; + break; + } + i++; + } + }else { + LIST_FOR_EACH_ENTRY(iter, list, HTMLDOMAttribute, entry) { + if(iter->dispid == dispid) { + ret = iter; + break; + } + i++; } - i++; } if(pos) *pos = i; return ret; } +static DISPID get_dispid_for_nsattr(HTMLElement *elem, nsIDOMAttr *nsattr) +{ + DISPID dispid = 0; + nsAString nsstr; + + nsAString_InitDepend(&nsstr, NULL); + if(SUCCEEDED(nsIDOMAttr_GetName(nsattr, &nsstr))) { + const PRUnichar *name; + nsAString_GetData(&nsstr, &name); + + /* Supply a dummy non-builtin dispid so it can be checked for expando */ + if(is_custom_attribute(&elem->node.event_target.dispex, name)) + dispid = MSHTML_DISPID_CUSTOM_MIN; + nsAString_Finish(&nsstr); + } + return dispid; +} + typedef struct { DispatchEx dispex; IHTMLRect IHTMLRect_iface; @@ -4778,6 +4806,7 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD IHTMLDOMAttribute **ppretAttribute) { HTMLElement *This = impl_from_IHTMLElement4(iface); + nsIDOMAttr *nsattr, *oldnsattr = NULL; HTMLDOMAttribute *attr, *replace; HTMLAttributeCollection *attrs; DISPID dispid; @@ -4794,25 +4823,49 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD return E_INVALIDARG; } - hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, - attr->name, fdexNameCaseInsensitive|fdexNameEnsure, &dispid); - if(FAILED(hres)) - return hres; - hres = HTMLElement_get_attr_col(&This->node, &attrs); if(FAILED(hres)) return hres; - replace = find_attr_in_list(attrs, dispid, NULL); - if(replace) { - hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value); + nsattr = (nsIDOMAttr*)attr->node.nsnode; + if(nsattr && !attrs->nsattrs) { + FIXME("Attribute has proper node but no NS collection for it.\n"); + IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface); + return E_NOTIMPL; + } + + if(nsattr) { + if(NS_FAILED(nsIDOMMozNamedAttrMap_SetNamedItem(attrs->nsattrs, nsattr, &oldnsattr))) { + IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface); + return E_FAIL; + } + dispid = get_dispid_for_nsattr(This, nsattr); + replace = NULL; + if(oldnsattr) { + replace = find_attr_in_list(attrs, 0, oldnsattr, NULL); + nsIDOMAttr_Release(oldnsattr); + } + }else { + hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, + attr->name, fdexNameCaseInsensitive|fdexNameEnsure, &dispid); if(FAILED(hres)) { - WARN("could not get attr value: %08lx\n", hres); - V_VT(&replace->value) = VT_EMPTY; + IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface); + return hres; } - if(!replace->name) { - replace->name = attr->name; - attr->name = NULL; + replace = find_attr_in_list(attrs, dispid, NULL, NULL); + } + + if(replace) { + if(!nsattr) { + hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value); + if(FAILED(hres)) { + WARN("could not get attr value: %08lx\n", hres); + V_VT(&replace->value) = VT_EMPTY; + } + if(!replace->name) { + replace->name = attr->name; + attr->name = NULL; + } } list_add_head(&replace->entry, &attr->entry); list_remove(&replace->entry); @@ -4828,10 +4881,12 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD IHTMLAttributeCollection_Release(&attrs->IHTMLAttributeCollection_iface); - hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value); - if(FAILED(hres)) - WARN("Could not set attribute value: %08lx\n", hres); - VariantClear(&attr->value); + if(!nsattr) { + hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value); + if(FAILED(hres)) + WARN("Could not set attribute value: %08lx\n", hres); + VariantClear(&attr->value); + } *ppretAttribute = replace ? &replace->IHTMLDOMAttribute_iface : NULL; return S_OK; @@ -8468,13 +8523,30 @@ static HRESULT create_filters_collection(HTMLElement *elem, IHTMLFiltersCollecti return S_OK; } -static HRESULT get_attr_dispid_by_relative_idx(HTMLAttributeCollection *This, LONG *idx, DISPID start, DISPID *dispid) +static HRESULT get_attr_dispid_by_relative_idx(HTMLAttributeCollection *This, LONG *idx, DISPID start, + DISPID *dispid, nsIDOMAttr **nsattr) { IDispatchEx *dispex = &This->elem->node.event_target.dispex.IDispatchEx_iface; DISPID id = start; + UINT32 length; LONG len = -1; HRESULT hres; + if(This->nsattrs) { + id++; + if(dispid) { + *dispid = id + *idx; + if(!nsattr) + return S_OK; + if(NS_FAILED(nsIDOMMozNamedAttrMap_Item(This->nsattrs, *dispid, nsattr))) + return E_FAIL; + return *nsattr ? S_OK : DISP_E_UNKNOWNNAME; + } + nsIDOMMozNamedAttrMap_GetLength(This->nsattrs, &length); + *idx = (length > id) ? length - id : 0; + return S_OK; + } + FIXME("filter non-enumerable attributes out\n"); while(1) { @@ -8498,13 +8570,15 @@ static HRESULT get_attr_dispid_by_relative_idx(HTMLAttributeCollection *This, LO return S_OK; } -static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid) +static HRESULT get_attr_dispid_by_idx(HTMLAttributeCollection *This, LONG *idx, DISPID *dispid, nsIDOMAttr **nsattr) { - return get_attr_dispid_by_relative_idx(This, idx, DISPID_STARTENUM, dispid); + return get_attr_dispid_by_relative_idx(This, idx, DISPID_STARTENUM, dispid, nsattr); } -static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BSTR name, DISPID *id) +static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BSTR name, DISPID *id, nsIDOMAttr **nsattr) { + nsAString nsstr; + nsresult nsres; HRESULT hres; if(name[0]>='0' && name[0]<='9') { @@ -8513,23 +8587,36 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST idx = wcstoul(name, &end_ptr, 10); if(!*end_ptr) { - hres = get_attr_dispid_by_idx(This, &idx, id); + hres = get_attr_dispid_by_idx(This, &idx, id, nsattr); if(SUCCEEDED(hres)) return hres; } } + if(This->nsattrs) { + nsAString_InitDepend(&nsstr, name); + *nsattr = NULL; + nsres = nsIDOMMozNamedAttrMap_GetNamedItem(This->nsattrs, &nsstr, nsattr); + nsAString_Finish(&nsstr); + if(NS_FAILED(nsres)) + return E_FAIL; + return *nsattr ? S_OK : DISP_E_UNKNOWNNAME; + } + hres = IDispatchEx_GetDispID(&This->elem->node.event_target.dispex.IDispatchEx_iface, name, fdexNameCaseInsensitive, id); return hres; } -static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, LONG *list_pos, HTMLDOMAttribute **attr) +static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, nsIDOMAttr *nsattr, + LONG *list_pos, HTMLDOMAttribute **attr) { HRESULT hres; - if(!(*attr = find_attr_in_list(This, id, list_pos))) { - hres = HTMLDOMAttribute_Create(NULL, This->elem->node.doc, This->elem, id, + if(!(*attr = find_attr_in_list(This, id, nsattr, list_pos))) { + if(nsattr) + id = get_dispid_for_nsattr(This->elem, nsattr); + hres = HTMLDOMAttribute_Create(NULL, This->elem->node.doc, This->elem, id, nsattr, dispex_compat_mode(&This->elem->node.event_target.dispex), attr); if(FAILED(hres)) return hres; @@ -8604,6 +8691,7 @@ static HRESULT WINAPI HTMLAttributeCollectionEnum_Next(IEnumVARIANT *iface, ULON HTMLAttributeCollectionEnum *This = HTMLAttributeCollectionEnum_from_IEnumVARIANT(iface); DISPID tmp, dispid = This->iter_dispid; HTMLDOMAttribute *attr; + nsIDOMAttr *nsattr; LONG rel_index = 0; HRESULT hres; ULONG i; @@ -8611,10 +8699,13 @@ static HRESULT WINAPI HTMLAttributeCollectionEnum_Next(IEnumVARIANT *iface, ULON TRACE("(%p)->(%lu %p %p)\n", This, celt, rgVar, pCeltFetched); for(i = 0; i < celt; i++) { - hres = get_attr_dispid_by_relative_idx(This->col, &rel_index, dispid, &tmp); + nsattr = NULL; + hres = get_attr_dispid_by_relative_idx(This->col, &rel_index, dispid, &tmp, &nsattr); if(SUCCEEDED(hres)) { dispid = tmp; - hres = get_domattr(This->col, dispid, NULL, &attr); + hres = get_domattr(This->col, dispid, nsattr, NULL, &attr); + if(nsattr) + nsIDOMAttr_Release(nsattr); } else if(hres == DISP_E_UNKNOWNNAME) break; @@ -8649,14 +8740,14 @@ static HRESULT WINAPI HTMLAttributeCollectionEnum_Skip(IEnumVARIANT *iface, ULON return S_OK; rel_index = -1; - hres = get_attr_dispid_by_relative_idx(This->col, &rel_index, This->iter_dispid, NULL); + hres = get_attr_dispid_by_relative_idx(This->col, &rel_index, This->iter_dispid, NULL, NULL); if(FAILED(hres)) return hres; remaining = min(celt, rel_index); if(remaining) { rel_index = remaining - 1; - hres = get_attr_dispid_by_relative_idx(This->col, &rel_index, This->iter_dispid, &dispid); + hres = get_attr_dispid_by_relative_idx(This->col, &rel_index, This->iter_dispid, &dispid, NULL); if(FAILED(hres)) return hres; This->iter += remaining; @@ -8755,7 +8846,7 @@ static HRESULT WINAPI HTMLAttributeCollection_get_length(IHTMLAttributeCollectio TRACE("(%p)->(%p)\n", This, p); *p = -1; - hres = get_attr_dispid_by_idx(This, p, NULL); + hres = get_attr_dispid_by_idx(This, p, NULL, NULL); return hres; } @@ -8785,6 +8876,7 @@ static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *iface, VARIANT *name, IDispatch **ppItem) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface); + nsIDOMAttr *nsattr = NULL; HTMLDOMAttribute *attr; DISPID id; HRESULT hres; @@ -8793,10 +8885,10 @@ static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *ifa switch(V_VT(name)) { case VT_I4: - hres = get_attr_dispid_by_idx(This, &V_I4(name), &id); + hres = get_attr_dispid_by_idx(This, &V_I4(name), &id, &nsattr); break; case VT_BSTR: - hres = get_attr_dispid_by_name(This, V_BSTR(name), &id); + hres = get_attr_dispid_by_name(This, V_BSTR(name), &id, &nsattr); break; default: FIXME("unsupported name %s\n", debugstr_variant(name)); @@ -8807,7 +8899,9 @@ static HRESULT WINAPI HTMLAttributeCollection_item(IHTMLAttributeCollection *ifa if(FAILED(hres)) return hres; - hres = get_domattr(This, id, NULL, &attr); + hres = get_domattr(This, id, nsattr, NULL, &attr); + if(nsattr) + nsIDOMAttr_Release(nsattr); if(FAILED(hres)) return hres; @@ -8885,13 +8979,14 @@ static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollec IHTMLDOMAttribute **newretNode) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection2(iface); + nsIDOMAttr *nsattr = NULL; HTMLDOMAttribute *attr; DISPID id; HRESULT hres; TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), newretNode); - hres = get_attr_dispid_by_name(This, bstrName, &id); + hres = get_attr_dispid_by_name(This, bstrName, &id, &nsattr); if(hres == DISP_E_UNKNOWNNAME) { *newretNode = NULL; return S_OK; @@ -8899,7 +8994,9 @@ static HRESULT WINAPI HTMLAttributeCollection2_getNamedItem(IHTMLAttributeCollec return hres; } - hres = get_domattr(This, id, NULL, &attr); + hres = get_domattr(This, id, nsattr, NULL, &attr); + if(nsattr) + nsIDOMAttr_Release(nsattr); if(FAILED(hres)) return hres; @@ -9015,19 +9112,22 @@ static HRESULT WINAPI HTMLAttributeCollection3_removeNamedItem(IHTMLAttributeCol static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *iface, LONG index, IHTMLDOMAttribute **ppNodeOut) { HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection3(iface); + nsIDOMAttr *nsattr = NULL; HTMLDOMAttribute *attr; DISPID id; HRESULT hres; TRACE("(%p)->(%ld %p)\n", This, index, ppNodeOut); - hres = get_attr_dispid_by_idx(This, &index, &id); + hres = get_attr_dispid_by_idx(This, &index, &id, &nsattr); if(hres == DISP_E_UNKNOWNNAME) return E_INVALIDARG; if(FAILED(hres)) return hres; - hres = get_domattr(This, id, NULL, &attr); + hres = get_domattr(This, id, nsattr, NULL, &attr); + if(nsattr) + nsIDOMAttr_Release(nsattr); if(FAILED(hres)) return hres; @@ -9084,6 +9184,8 @@ static void HTMLAttributeCollection_traverse(DispatchEx *dispex, nsCycleCollecti note_cc_edge((nsISupports*)&attr->IHTMLDOMAttribute_iface, "attr", cb); if(This->elem) note_cc_edge((nsISupports*)&This->elem->node.IHTMLDOMNode_iface, "elem", cb); + if(This->nsattrs) + note_cc_edge((nsISupports*)This->nsattrs, "nsattrs", cb); } static void HTMLAttributeCollection_unlink(DispatchEx *dispex) @@ -9100,6 +9202,7 @@ static void HTMLAttributeCollection_unlink(DispatchEx *dispex) This->elem = NULL; IHTMLDOMNode_Release(&elem->node.IHTMLDOMNode_iface); } + unlink_ref(&This->nsattrs); } static void HTMLAttributeCollection_destructor(DispatchEx *dispex) @@ -9111,17 +9214,20 @@ static void HTMLAttributeCollection_destructor(DispatchEx *dispex) static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) { HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex); + nsIDOMAttr *nsattr = NULL; HTMLDOMAttribute *attr; LONG pos; HRESULT hres; TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(name), flags, dispid); - hres = get_attr_dispid_by_name(This, name, dispid); + hres = get_attr_dispid_by_name(This, name, dispid, &nsattr); if(FAILED(hres)) return hres; - hres = get_domattr(This, *dispid, &pos, &attr); + hres = get_domattr(This, *dispid, nsattr, &pos, &attr); + if(nsattr) + nsIDOMAttr_Release(nsattr); if(FAILED(hres)) return hres; IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface); @@ -9201,6 +9307,7 @@ dispex_static_data_t HTMLAttributeCollection_dispex = { HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **ac) { HTMLElement *This = impl_from_HTMLDOMNode(iface); + compat_mode_t compat_mode = dispex_compat_mode(&iface->event_target.dispex); if(This->attrs) { IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface); @@ -9219,8 +9326,10 @@ HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **a IHTMLDOMNode_AddRef(&This->node.IHTMLDOMNode_iface); This->attrs->elem = This; list_init(&This->attrs->attrs); - init_dispatch(&This->attrs->dispex, &HTMLAttributeCollection_dispex, get_inner_window(This->node.doc), - dispex_compat_mode(&iface->event_target.dispex)); + init_dispatch(&This->attrs->dispex, &HTMLAttributeCollection_dispex, get_inner_window(This->node.doc), compat_mode); + + if(compat_mode >= COMPAT_MODE_IE9 && This->dom_element) + nsIDOMElement_GetAttributes(This->dom_element, &This->attrs->nsattrs); *ac = This->attrs; IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ab0921b29a1..1d4e7f3bac7 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -669,6 +669,7 @@ HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*); HRESULT dispex_get_builtin_id(DispatchEx*,BSTR,DWORD,DISPID*); HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); HRESULT get_dispids(tid_t,DWORD*,DISPID**); +BOOL is_custom_attribute(DispatchEx*,const WCHAR*); HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*); HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*); HRESULT dispex_invoke(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); @@ -1374,12 +1375,15 @@ struct HTMLAttributeCollection { IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface; IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface; + nsIDOMMozNamedAttrMap *nsattrs; HTMLElement *elem; struct list attrs; }; typedef struct { - DispatchEx dispex; + /* valid only when attribute nodes are used (node.nsnode) */ + HTMLDOMNode node; + IHTMLDOMAttribute IHTMLDOMAttribute_iface; IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface; @@ -1395,7 +1399,8 @@ typedef struct { HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*); -HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLDocumentNode*,HTMLElement*,DISPID,compat_mode_t,HTMLDOMAttribute**); +HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLDocumentNode*,HTMLElement*,DISPID,nsIDOMAttr*, + compat_mode_t,HTMLDOMAttribute**); HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**); HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index e1ef0b87312..1ffb09fdd33 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1458,6 +1458,76 @@ sync_test("elem_props", function() { test_exposed("fileSize", v < 11); }); +sync_test("attr_props", function() { + var elem = document.createElement("style"), attr; + var v = document.documentMode; + elem.setAttribute("id", "test"); + elem.setAttribute("test", "wine"); + elem.setAttribute("z-index", "foobar"); + + function test_exposed(prop, expect) { + if(expect) + ok(prop in attr, prop + " not found in attribute."); + else + ok(!(prop in attr), prop + " found in attribute."); + } + + function test_attr(expando, specified) { + var r = attr.expando; + ok(r === expando, attr.name + " attr.expando = " + r); + r = attr.specified; + ok(r === specified, attr.name + " attr.specified = " + r); + } + + attr = elem.getAttributeNode("id"); + test_exposed("appendChild", true); + test_exposed("attributes", true); + test_exposed("childNodes", true); + test_exposed("cloneNode", true); + test_exposed("compareDocumentPosition", v >= 9); + test_exposed("expando", true); + test_exposed("firstChild", true); + test_exposed("hasChildNodes", true); + test_exposed("insertBefore", true); + test_exposed("isDefaultNamespace", v >= 9); + test_exposed("isEqualNode", v >= 9); + test_exposed("isSameNode", v >= 9); + test_exposed("isSupported", v >= 9); + test_exposed("lastChild", true); + test_exposed("localName", v >= 9); + test_exposed("lookupNamespaceURI", v >= 9); + test_exposed("lookupPrefix", v >= 9); + test_exposed("name", true); + test_exposed("namespaceURI", v >= 9); + test_exposed("nextSibling", true); + test_exposed("nodeName", true); + test_exposed("nodeType", true); + test_exposed("nodeValue", true); + test_exposed("ownerDocument", true); + test_exposed("parentNode", true); + test_exposed("prefix", v >= 9); + test_exposed("previousSibling", true); + test_exposed("removeChild", true); + test_exposed("replaceChild", true); + test_exposed("specified", true); + test_exposed("textContent", v >= 9); + test_exposed("value", true); + test_attr(false, true); + + attr = elem.getAttributeNode("test"); + test_attr(true, true); + + attr = elem.getAttributeNode("z-index"); + test_attr(true, true); + + attr = elem.getAttributeNode("tabIndex"); + if(v < 8) + test_attr(false, false); + else + todo_wine_if(v === 8). + ok(attr === null, "tabIndex attr not null."); +}); + sync_test("doc_props", function() { function test_exposed(prop, expect, is_todo) { var ok_ = is_todo ? todo_wine.ok : ok; From 862a000f3ced6be74a3d530c8bb02acf32c6e91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 1000/1506] mshtml: Return FALSE from a detached attribute's `specified` prop in old compat modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlattr.c | 4 ++-- dlls/mshtml/tests/documentmode.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index cf1ffbf7247..9e4045e99fa 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -165,8 +165,8 @@ static HRESULT WINAPI HTMLDOMAttribute_get_specified(IHTMLDOMAttribute *iface, V } if(!This->elem || !This->elem->dom_element) { - FIXME("NULL This->elem\n"); - return E_UNEXPECTED; + *p = VARIANT_FALSE; + return S_OK; } if(get_dispid_type(This->dispid) != DISPEXPROP_BUILTIN) { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 1ffb09fdd33..0291027f154 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1526,6 +1526,9 @@ sync_test("attr_props", function() { else todo_wine_if(v === 8). ok(attr === null, "tabIndex attr not null."); + + attr = document.createAttribute("winetest"); + test_attr(false, v >= 9); }); sync_test("doc_props", function() { From 8b85a0f7ee805a17eb1bd7d996020ef90163ee13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 1001/1506] mshtml: Do not treat builtin methods as attributes in old compat modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 21 +++++++++++++++++++++ dlls/mshtml/htmlelem.c | 4 +++- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/documentmode.js | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 770900d50c7..a110f6bd3d8 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1919,6 +1919,27 @@ HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, return invoke_builtin_function((IDispatch*)&dispex->IDispatchEx_iface, func, dp, res, ei, caller); } +BOOL dispex_is_builtin_method(DispatchEx *dispex, DISPID id) +{ + func_info_t *func; + + if(get_dispid_type(id) != DISPEXPROP_BUILTIN) + return FALSE; + + if(FAILED(get_builtin_func(dispex->info, id, &func)) || func->func_disp_idx < 0) + return FALSE; + + if(dispex->dynamic_data && dispex->dynamic_data->func_disps) { + func_obj_entry_t *entry = dispex->dynamic_data->func_disps + func->func_disp_idx; + + if(entry->func_obj && (V_VT(&entry->val) != VT_DISPATCH || + V_DISPATCH(&entry->val) != (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface)) + return FALSE; + } + + return TRUE; +} + static VARIANT_BOOL reset_builtin_func(DispatchEx *dispex, func_info_t *func) { func_obj_entry_t *entry; diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 8b260ce76b0..c12cecde9e0 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -8605,7 +8605,9 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, BST hres = IDispatchEx_GetDispID(&This->elem->node.event_target.dispex.IDispatchEx_iface, name, fdexNameCaseInsensitive, id); - return hres; + if(FAILED(hres)) + return hres; + return dispex_is_builtin_method(&This->elem->node.event_target.dispex, *id) ? DISP_E_UNKNOWNNAME : S_OK; } static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, nsIDOMAttr *nsattr, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1d4e7f3bac7..df431c7ced4 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -683,6 +683,7 @@ compat_mode_t dispex_compat_mode(DispatchEx*); HRESULT dispex_to_string(DispatchEx*,BSTR*); HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller); +BOOL dispex_is_builtin_method(DispatchEx*,DISPID); typedef enum { DISPEXPROP_CUSTOM, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 0291027f154..3caf5ce6e97 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -317,7 +317,7 @@ sync_test("builtin_toString", function() { if(!localStorage) win_skip("localStorage is buggy and not available, skipping"); test("attribute", document.createAttribute("class"), "Attr"); - if(false /* todo_wine */) test("attributes", e.attributes, "NamedNodeMap"); + test("attributes", e.attributes, "NamedNodeMap"); test("childNodes", document.body.childNodes, "NodeList"); if(clientRects) test("clientRect", clientRects[0], "ClientRect"); if(clientRects) test("clientRects", clientRects, "ClientRectList"); From c43efbbd6ed869af5ed66d333a58ea8894e9cbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 1002/1506] mshtml: Fix `expando` and `specified` for attributes in old compat modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `expando` returns TRUE on non-builtin attributes (builtin attributes are only the builtin accessors, not methods), while `specified` always returns TRUE on any non-builtin attribute as long as it has a user-defined value (e.g. for builtin methods, their slot must be non-default), which is an extension to just checking the dynamic props. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 40 +++++++++++++++++++++++++++++++ dlls/mshtml/htmlattr.c | 4 ++-- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/tests/documentmode.js | 4 ++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index a110f6bd3d8..6eee22a2bac 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1919,6 +1919,22 @@ HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, return invoke_builtin_function((IDispatch*)&dispex->IDispatchEx_iface, func, dp, res, ei, caller); } +BOOL dispex_is_builtin_attribute(DispatchEx *dispex, DISPID id) +{ + func_info_t *func; + + if(id == DISPID_VALUE) + return TRUE; + + if(get_dispid_type(id) != DISPEXPROP_BUILTIN) + return FALSE; + + if(FAILED(get_builtin_func(dispex->info, id, &func))) + return FALSE; + + return func->func_disp_idx < 0; +} + BOOL dispex_is_builtin_method(DispatchEx *dispex, DISPID id) { func_info_t *func; @@ -1940,6 +1956,30 @@ BOOL dispex_is_builtin_method(DispatchEx *dispex, DISPID id) return TRUE; } +BOOL dispex_is_builtin_value(DispatchEx *dispex, DISPID id) +{ + func_info_t *func; + + if(get_dispid_type(id) != DISPEXPROP_BUILTIN) + return FALSE; + + if(FAILED(get_builtin_func(dispex->info, id, &func))) + return FALSE; + + if(func->func_disp_idx < 0) + return TRUE; + + if(dispex->dynamic_data && dispex->dynamic_data->func_disps) { + func_obj_entry_t *entry = dispex->dynamic_data->func_disps + func->func_disp_idx; + + if(entry->func_obj && (V_VT(&entry->val) != VT_DISPATCH || + V_DISPATCH(&entry->val) != (IDispatch*)&entry->func_obj->dispex.IDispatchEx_iface)) + return FALSE; + } + + return TRUE; +} + static VARIANT_BOOL reset_builtin_func(DispatchEx *dispex, func_info_t *func) { func_obj_entry_t *entry; diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 9e4045e99fa..4912134e58a 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -169,7 +169,7 @@ static HRESULT WINAPI HTMLDOMAttribute_get_specified(IHTMLDOMAttribute *iface, V return S_OK; } - if(get_dispid_type(This->dispid) != DISPEXPROP_BUILTIN) { + if(!dispex_is_builtin_value(&This->elem->node.event_target.dispex, This->dispid)) { *p = VARIANT_TRUE; return S_OK; } @@ -341,7 +341,7 @@ static HRESULT WINAPI HTMLDOMAttribute2_get_expando(IHTMLDOMAttribute2 *iface, V TRACE("(%p)->(%p)\n", This, p); - *p = variant_bool(This->elem && get_dispid_type(This->dispid) != DISPEXPROP_BUILTIN); + *p = variant_bool(This->elem && !dispex_is_builtin_attribute(&This->elem->node.event_target.dispex, This->dispid)); return S_OK; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index df431c7ced4..fa17418ac07 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -683,7 +683,9 @@ compat_mode_t dispex_compat_mode(DispatchEx*); HRESULT dispex_to_string(DispatchEx*,BSTR*); HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller); +BOOL dispex_is_builtin_attribute(DispatchEx*,DISPID);; BOOL dispex_is_builtin_method(DispatchEx*,DISPID); +BOOL dispex_is_builtin_value(DispatchEx*,DISPID); typedef enum { DISPEXPROP_CUSTOM, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 3caf5ce6e97..04ca76f1c17 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1464,6 +1464,7 @@ sync_test("attr_props", function() { elem.setAttribute("id", "test"); elem.setAttribute("test", "wine"); elem.setAttribute("z-index", "foobar"); + elem.setAttribute("removeAttribute", "funcattr"); function test_exposed(prop, expect) { if(expect) @@ -1520,6 +1521,9 @@ sync_test("attr_props", function() { attr = elem.getAttributeNode("z-index"); test_attr(true, true); + attr = elem.getAttributeNode("removeAttribute"); + test_attr(true, true); + attr = elem.getAttributeNode("tabIndex"); if(v < 8) test_attr(false, false); From ddf706e32d92c0103daefa0b965148fdb51384fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 1003/1506] mshtml: Set prototype of AttrPrototype to NodePrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index fa17418ac07..e85d954b338 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -421,7 +421,7 @@ PRIVATE_TID_LIST #define COMMON_PROTOTYPE_LIST \ X(History, "History", OmHistory_dispex, Object) \ X(Navigator, "Navigator", OmNavigator_dispex, Object) \ - X(HTMLDOMAttribute, "Attr", HTMLDOMAttribute_dispex, Object) \ + X(HTMLDOMAttribute, "Attr", HTMLDOMAttribute_dispex, HTMLDOMNode) \ X(HTMLDOMChildrenCollection, "NodeList", HTMLDOMChildrenCollection_dispex, Object) \ X(HTMLDOMImplementation, "DOMImplementation", HTMLDOMImplementation_dispex, Object) \ X(HTMLDOMTextNode, "Text", HTMLDOMTextNode_dispex, DOMCharacterData) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 04ca76f1c17..e46fcd20f8f 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -940,6 +940,7 @@ sync_test("builtin_prototypes", function() { if(v >= 9) { var protos = [ + [ "Attr", "Node" ], [ "CharacterData", "Node" ], [ "ClientRect", "Object" ], [ "ClientRectList", "Object" ], @@ -1069,6 +1070,7 @@ sync_test("builtin_prototypes", function() { "rowSpan","vAlign","width" ]; protos = [ + [ "Attr", ["expando","name","specified","value"], Node_props ], [ "CharacterData", ["data","length","appendData"], Node_props ], [ "Comment", ["text"], ["insertData","replaceData","substringData"] ], [ "CSSStyleRule", ["readOnly","selectorText","style"], ["cssText","parentRule","parentStyleSheet","type" ] ], From f14374105afc39a6ed959d358f681b4f3d9be497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:29 +0200 Subject: [PATCH 1004/1506] jscript: Allow objects that expose "length" prop for Function.apply under certain conditions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Behavior depends on mode. Javascript used inside mshtml allows non-JS objects that expose "length" to be used in apply(). For ES5 and above, even JS objects that expose "length" are allowed. Javascript not in HTML mode does not, however. Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/function.c | 126 ++++++++++++++++++++++++++++-- dlls/jscript/tests/api.js | 2 + dlls/mshtml/tests/documentmode.js | 66 ++++++++++++++++ 3 files changed, 187 insertions(+), 7 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 8c770602933..bf9cb32ff89 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -408,6 +408,109 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a return S_OK; } +static HRESULT disp_to_args(script_ctx_t *ctx, IDispatch *disp, unsigned *argc, jsval_t **ret) +{ + IDispatchEx *dispex; + DWORD length, i; + jsval_t *argv; + DISPID dispid; + EXCEPINFO ei; + UINT err = 0; + HRESULT hres; + VARIANT var; + BSTR name; + + if(!(name = SysAllocString(L"length"))) + return E_OUTOFMEMORY; + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); + if(SUCCEEDED(hres) && dispex) + hres = IDispatchEx_GetDispID(dispex, name, fdexNameCaseSensitive, &dispid); + else { + hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &name, 1, 0, &dispid); + dispex = NULL; + } + SysFreeString(name); + if(SUCCEEDED(hres) && dispid == DISPID_UNKNOWN) + hres = DISP_E_UNKNOWNNAME; + if(FAILED(hres)) { + if(hres == DISP_E_UNKNOWNNAME) + hres = JS_E_JSCRIPT_EXPECTED; + goto fail; + } + + if(dispex) + hres = IDispatchEx_InvokeEx(dispex, dispid, ctx->lcid, DISPATCH_PROPERTYGET, NULL, + &var, &ei, &ctx->jscaller->IServiceProvider_iface); + else + hres = IDispatch_Invoke(disp, dispid, &IID_NULL, ctx->lcid, DISPATCH_PROPERTYGET, NULL, &var, &ei, &err); + if(FAILED(hres)) { + if(hres == DISP_E_EXCEPTION) + disp_fill_exception(ctx, &ei); + if(hres == DISP_E_MEMBERNOTFOUND) + hres = JS_E_JSCRIPT_EXPECTED; + goto fail; + } + + if(FAILED(VariantChangeType(&var, &var, 0, VT_UI4))) { + VariantClear(&var); + hres = JS_E_JSCRIPT_EXPECTED; + goto fail; + } + length = V_UI4(&var); + + argv = malloc(length * sizeof(*argv)); + if(!argv) { + hres = E_OUTOFMEMORY; + goto fail; + } + + for(i = 0; i < length; i++) { + WCHAR buf[12]; + + swprintf(buf, ARRAY_SIZE(buf), L"%u", i); + if(!(name = SysAllocString(buf))) + hres = E_OUTOFMEMORY; + else { + if(dispex) + hres = IDispatchEx_GetDispID(dispex, name, fdexNameCaseSensitive, &dispid); + else + hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &name, 1, 0, &dispid); + SysFreeString(name); + } + if(SUCCEEDED(hres)) { + if(dispex) + hres = IDispatchEx_InvokeEx(dispex, dispid, ctx->lcid, DISPATCH_PROPERTYGET, NULL, + &var, &ei, &ctx->jscaller->IServiceProvider_iface); + else + hres = IDispatch_Invoke(disp, dispid, &IID_NULL, ctx->lcid, DISPATCH_PROPERTYGET, NULL, &var, &ei, &err); + if(SUCCEEDED(hres)) { + hres = variant_to_jsval(ctx, &var, &argv[i]); + VariantClear(&var); + }else if(hres == DISP_E_EXCEPTION) { + disp_fill_exception(ctx, &ei); + } + } + if(FAILED(hres)) { + if(hres == DISP_E_UNKNOWNNAME || hres == DISP_E_MEMBERNOTFOUND) { + argv[i] = jsval_undefined(); + continue; + } + while(i--) + jsval_release(argv[i]); + free(argv); + goto fail; + } + } + + *argc = length; + *ret = argv; + hres = S_OK; +fail: + if(dispex) + IDispatchEx_Release(dispex); + return hres; +} + static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { jsval_t this_val = jsval_undefined(); @@ -439,22 +542,31 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi if(argc >= 2) { jsdisp_t *arg_array = NULL; + IDispatch *obj = NULL; if(is_object_instance(argv[1])) { - arg_array = iface_to_jsdisp(get_object(argv[1])); - if(arg_array && - (!is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS) )) { - jsdisp_release(arg_array); - arg_array = NULL; + obj = get_object(argv[1]); + arg_array = iface_to_jsdisp(obj); + + if(ctx->version < SCRIPTLANGUAGEVERSION_ES5) { + if(!arg_array) { + if(!ctx->html_mode) + obj = NULL; + }else if(!is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS)) { + jsdisp_release(arg_array); + arg_array = NULL; + obj = NULL; + } } } if(arg_array) { hres = array_to_args(ctx, arg_array, &cnt, &args); jsdisp_release(arg_array); + }else if(obj) { + hres = disp_to_args(ctx, obj, &cnt, &args); }else { - FIXME("throw TypeError\n"); - hres = E_FAIL; + hres = JS_E_JSCRIPT_EXPECTED; } } diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 7ef50d0395d..d1cbdaceb04 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -2917,6 +2917,8 @@ testFunctionThis("toString"); testFunctionThis("call"); testFunctionThis("apply"); +testException(function() {(function (a, b) {}).apply(null, testObj)}, "E_JSCRIPT_EXPECTED"); + function testArrayHostThis(func) { testException(function() { Array.prototype[func].call(testObj); }, "E_JSCRIPT_EXPECTED"); } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index e46fcd20f8f..afd804db356 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -520,6 +520,72 @@ sync_test("builtin_obj", function() { f.call = function() { }; ok(f.apply === 0, "changed f.apply = ", f.apply); ok(f.call instanceof Function, "changed f.call not instance of Function"); + + e = Array.isArray(document.body.childNodes); + ok(e === false, "isArray(childNodes) returned " + e); + } + + (function(a, b, c) { + ok(a === document.body.childNodes[0], "a = " + a); + ok(b === document.body.childNodes[1], "b = " + b); + ok(c === document.body.childNodes[2], "c = " + c); + }).apply(null, document.body.childNodes); + + elem[0] = "a"; + elem[1] = "b"; + if(v < 9) { + try { + (function(a, b) {}).apply(null, elem); + }catch(ex) { + e = ex.number; + } + todo_wine. + ok(e === 0xa13a4 - 0x80000000, "[function.apply with elem without length] e = " + e); + }else { + (function(a, b) { + ok(a === undefined, "a = " + a); + ok(b === undefined, "b = " + b); + }).apply(null, elem); + } + + elem.length = 2; + (function(a, b) { + ok(a === "a", "a = " + a); + ok(b === "b", "b = " + b); + }).apply(null, elem); + + elem = new Object; + elem[0] = "c"; + elem[1] = "d"; + if(v < 9) { + try { + (function(c, d) {}).apply(null, elem); + }catch(ex) { + e = ex.number; + } + todo_wine. + ok(e === 0xa13a4 - 0x80000000, "[function.apply with Object without length] e = " + e); + }else { + (function(c, d) { + ok(c === undefined, "c = " + c); + ok(d === undefined, "d = " + d); + }).apply(null, elem); + } + + elem.length = 2; + if(v < 9) { + try { + (function(c, d) {}).apply(null, elem); + }catch(ex) { + e = ex.number; + } + todo_wine. + ok(e === 0xa13a4 - 0x80000000, "[function.apply with Object with length] e = " + e); + }else { + (function(c, d) { + ok(c === "c", "c = " + c); + ok(d === "d", "d = " + d); + }).apply(null, elem); } }); From 53469dc0ec90d2e933f428baa0f979d975c5ee2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1005/1506] jscript: Return proper error when passing wrong type to Function.apply. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/error.c | 1 + dlls/jscript/function.c | 8 ++++---- dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/mshtml/tests/documentmode.js | 3 --- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 46cd4e2d685..74f4be9d743 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -478,6 +478,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_JSCRIPT_EXPECTED: case JS_E_ENUMERATOR_EXPECTED: case JS_E_REGEXP_EXPECTED: + case JS_E_ARRAY_OR_ARGS_EXPECTED: case JS_E_ARRAY_EXPECTED: case JS_E_CYCLIC_PROTO_VALUE: case JS_E_CANNOT_CREATE_FOR_NONEXTENSIBLE: diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index bf9cb32ff89..5f4a70fdc5a 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -434,7 +434,7 @@ static HRESULT disp_to_args(script_ctx_t *ctx, IDispatch *disp, unsigned *argc, hres = DISP_E_UNKNOWNNAME; if(FAILED(hres)) { if(hres == DISP_E_UNKNOWNNAME) - hres = JS_E_JSCRIPT_EXPECTED; + hres = JS_E_ARRAY_OR_ARGS_EXPECTED; goto fail; } @@ -447,13 +447,13 @@ static HRESULT disp_to_args(script_ctx_t *ctx, IDispatch *disp, unsigned *argc, if(hres == DISP_E_EXCEPTION) disp_fill_exception(ctx, &ei); if(hres == DISP_E_MEMBERNOTFOUND) - hres = JS_E_JSCRIPT_EXPECTED; + hres = JS_E_ARRAY_OR_ARGS_EXPECTED; goto fail; } if(FAILED(VariantChangeType(&var, &var, 0, VT_UI4))) { VariantClear(&var); - hres = JS_E_JSCRIPT_EXPECTED; + hres = JS_E_ARRAY_OR_ARGS_EXPECTED; goto fail; } length = V_UI4(&var); @@ -566,7 +566,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi }else if(obj) { hres = disp_to_args(ctx, obj, &cnt, &args); }else { - hres = JS_E_JSCRIPT_EXPECTED; + hres = ctx->html_mode ? JS_E_ARRAY_OR_ARGS_EXPECTED : JS_E_JSCRIPT_EXPECTED; } } diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 278f1035c22..13788f13037 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -699,6 +699,7 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_INVALID_URI_CHAR MAKE_JSERROR(IDS_URI_INVALID_CHAR) #define JS_E_FRACTION_DIGITS_OUT_OF_RANGE MAKE_JSERROR(IDS_FRACTION_DIGITS_OUT_OF_RANGE) #define JS_E_PRECISION_OUT_OF_RANGE MAKE_JSERROR(IDS_PRECISION_OUT_OF_RANGE) +#define JS_E_ARRAY_OR_ARGS_EXPECTED MAKE_JSERROR(IDS_ARRAY_OR_ARGS_EXPECTED) #define JS_E_INVALID_LENGTH MAKE_JSERROR(IDS_INVALID_LENGTH) #define JS_E_ARRAY_EXPECTED MAKE_JSERROR(IDS_ARRAY_EXPECTED) #define JS_E_CYCLIC_PROTO_VALUE MAKE_JSERROR(IDS_CYCLIC_PROTO_VALUE) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index 7d11a7e0932..76c9920048c 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -69,6 +69,7 @@ STRINGTABLE IDS_URI_INVALID_CHAR "URI to be encoded contains invalid characters" IDS_FRACTION_DIGITS_OUT_OF_RANGE "Number of fraction digits is out of range" IDS_PRECISION_OUT_OF_RANGE "Precision is out of range" + IDS_ARRAY_OR_ARGS_EXPECTED "Array or arguments object expected" IDS_INVALID_LENGTH "Array length must be a finite positive integer" IDS_ARRAY_EXPECTED "Array object expected" IDS_INVALID_WRITABLE_PROP_DESC "'writable' attribute on the property descriptor cannot be set to 'true' on this object" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index d694abc07cd..efd1cb749dd 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -67,6 +67,7 @@ #define IDS_URI_INVALID_CODING 0x13A1 #define IDS_FRACTION_DIGITS_OUT_OF_RANGE 0x13A2 #define IDS_PRECISION_OUT_OF_RANGE 0x13A3 +#define IDS_ARRAY_OR_ARGS_EXPECTED 0x13A4 #define IDS_INVALID_LENGTH 0x13A5 #define IDS_ARRAY_EXPECTED 0x13A7 #define IDS_INVALID_WRITABLE_PROP_DESC 0x13AC diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index afd804db356..6031e6a064b 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -539,7 +539,6 @@ sync_test("builtin_obj", function() { }catch(ex) { e = ex.number; } - todo_wine. ok(e === 0xa13a4 - 0x80000000, "[function.apply with elem without length] e = " + e); }else { (function(a, b) { @@ -563,7 +562,6 @@ sync_test("builtin_obj", function() { }catch(ex) { e = ex.number; } - todo_wine. ok(e === 0xa13a4 - 0x80000000, "[function.apply with Object without length] e = " + e); }else { (function(c, d) { @@ -579,7 +577,6 @@ sync_test("builtin_obj", function() { }catch(ex) { e = ex.number; } - todo_wine. ok(e === 0xa13a4 - 0x80000000, "[function.apply with Object with length] e = " + e); }else { (function(c, d) { From ffdcd6c2adfe5fce430034ed445a208fd9580665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1006/1506] jscript: Fallback to Object's toString for Arrays when 'this' isn't an array in ES5 mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/array.c | 8 +++++- dlls/jscript/jscript.h | 1 + dlls/jscript/object.c | 2 +- dlls/jscript/tests/api.js | 1 + dlls/mshtml/tests/documentmode.js | 46 +++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index adc7e9a88dd..6d32f942306 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -948,8 +948,14 @@ static HRESULT Array_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi TRACE("\n"); array = array_this(vthis); - if(!array) + if(!array) { + if(ctx->version >= SCRIPTLANGUAGEVERSION_ES5) { + if(is_undefined(vthis) || is_null(vthis)) + return JS_E_OBJECT_EXPECTED; + return Object_toString(ctx, vthis, flags, argc, argv, r); + } return JS_E_ARRAY_EXPECTED; + } return array_join(ctx, &array->dispex, array->length, L",", 1, to_string, r); } diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 13788f13037..210d2f669f9 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -626,6 +626,7 @@ HRESULT localize_number(script_ctx_t*,DOUBLE,BOOL,jsstr_t**); BOOL is_builtin_eval_func(jsdisp_t*); HRESULT builtin_eval(script_ctx_t*,struct _call_frame_t*,WORD,unsigned,jsval_t*,jsval_t*); HRESULT JSGlobal_eval(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); +HRESULT Object_toString(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); HRESULT Object_get_proto_(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); HRESULT Object_set_proto_(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 08eb23cf7fb..f499d1dd6c0 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -24,7 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript); -static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, +HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { jsdisp_t *jsdisp; diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index d1cbdaceb04..c262634005b 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -2703,6 +2703,7 @@ testException(function() {date.setTime();}, "E_ARG_NOT_OPT"); testException(function() {date.setYear();}, "E_ARG_NOT_OPT"); testException(function() {arr.test();}, "E_NO_PROPERTY"); testException(function() {[1,2,3].sort(nullDisp);}, "E_JSCRIPT_EXPECTED"); +testException(function() {var o = new Object(); o.length = 1; o[0] = "a"; Array.prototype.toString.call(o);}, "E_NOT_ARRAY"); testException(function() {var o = new Object(); o.length = 1; o[0] = "a"; Array.prototype.toLocaleString.call(o);}, "E_NOT_ARRAY"); testException(function() {Number.prototype.toString.call(arr);}, "E_NOT_NUM"); testException(function() {Number.prototype.toFixed.call(arr);}, "E_NOT_NUM"); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 6031e6a064b..21546e632e4 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -523,6 +523,52 @@ sync_test("builtin_obj", function() { e = Array.isArray(document.body.childNodes); ok(e === false, "isArray(childNodes) returned " + e); + e = Array.prototype.toString.call(Number); + ok(e === "[object Function]", "Array.toString(Number) = " + e); + } + + function test_toString(msg, constr, err) { + var e = 0; + if(typeof err == "string") { + e = constr.prototype.toString.call(document.body); + ok(e === err, msg + ".toString(body) = " + e); + return; + } + try { + constr.prototype.toString.call(document.body); + }catch(ex) { + e = ex.number; + } + ok(e === err - 0x80000000, "[" + msg + ".toString(body)] e = " + e); + } + + test_toString("Array", Array, v < 9 ? 0xa13a7 : "[object HTMLBodyElement]"); + test_toString("Boolean", Boolean, 0xa1392); + test_toString("Date", Date, 0xa138e); + test_toString("RegExp", RegExp, 0xa1398); + test_toString("Number", Number, 0xa1389); + + if(v >= 9) { + var obj = { length: 2 }; + obj[0] = "foo"; + obj[1] = "bar"; + e = Array.prototype.toString.call(obj); + ok(e === "[object Object]", "Array.toString(array-like object) = " + e); + + obj = Object.create(null); + obj.length = 2; + obj[0] = "foo"; + obj[1] = "bar"; + e = Array.prototype.toString.call(obj); + ok(e === "[object Object]", "Array.toString(array-like object with no prototype) = " + e); + + e = 0; + try { + Array.prototype.toString.call(null); + }catch(ex) { + e = ex.number; + } + ok(e === 0xa138f - 0x80000000, "Array.toString(null) e = " + e); } (function(a, b, c) { From 11830b1717d66c51edc7d62fd654a0f81e0d1bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1007/1506] jscript: Fix error value when passing non-string 'this' to String's toString. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/error.c | 1 + dlls/jscript/jscript.h | 1 + dlls/jscript/jscript.rc | 1 + dlls/jscript/resource.h | 1 + dlls/jscript/string.c | 2 +- dlls/jscript/tests/api.js | 3 +++ dlls/mshtml/tests/documentmode.js | 1 + 7 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 74f4be9d743..14d23c70360 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -468,6 +468,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx) case JS_E_MISSING_ARG: case JS_E_OBJECT_NOT_COLLECTION: case JS_E_FUNCTION_EXPECTED: + case JS_E_STRING_EXPECTED: case JS_E_DATE_EXPECTED: case JS_E_NUMBER_EXPECTED: case JS_E_OBJECT_EXPECTED: diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 210d2f669f9..24fee36095c 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -682,6 +682,7 @@ static inline HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_ #define JS_E_DISABLED_CC MAKE_JSERROR(IDS_DISABLED_CC) #define JS_E_EXPECTED_AT MAKE_JSERROR(IDS_EXPECTED_AT) #define JS_E_FUNCTION_EXPECTED MAKE_JSERROR(IDS_NOT_FUNC) +#define JS_E_STRING_EXPECTED MAKE_JSERROR(IDS_NOT_STRING) #define JS_E_DATE_EXPECTED MAKE_JSERROR(IDS_NOT_DATE) #define JS_E_NUMBER_EXPECTED MAKE_JSERROR(IDS_NOT_NUM) #define JS_E_OBJECT_EXPECTED MAKE_JSERROR(IDS_OBJECT_EXPECTED) diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc index 76c9920048c..3ea790dd5ca 100644 --- a/dlls/jscript/jscript.rc +++ b/dlls/jscript/jscript.rc @@ -51,6 +51,7 @@ STRINGTABLE IDS_DISABLED_CC "Conditional compilation is turned off" IDS_EXPECTED_AT "Expected '@'" IDS_NOT_FUNC "Function expected" + IDS_NOT_STRING "'[object]' is not a string object" IDS_NOT_DATE "'[object]' is not a date object" IDS_NOT_NUM "Number expected" IDS_OBJECT_EXPECTED "Object expected" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index efd1cb749dd..22bc3a551e3 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -49,6 +49,7 @@ #define IDS_DISABLED_CC 0x0406 #define IDS_EXPECTED_AT 0x0408 #define IDS_NOT_FUNC 0x138A +#define IDS_NOT_STRING 0x138D #define IDS_NOT_DATE 0x138E #define IDS_NOT_NUM 0x1389 #define IDS_OBJECT_EXPECTED 0x138F diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 625977235a9..c5e944dcf7b 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -89,7 +89,7 @@ static HRESULT stringobj_to_string(jsval_t vthis, jsval_t *r) if(!(string = string_this(vthis))) { WARN("this is not a string object\n"); - return E_FAIL; + return JS_E_STRING_EXPECTED; } if(r) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index c262634005b..4bc7e2de881 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -2633,6 +2633,7 @@ var exception_array = { E_INVALID_LENGTH: { type: "RangeError", number: -2146823259 }, E_NOT_DATE: { type: "TypeError", number: -2146823282 }, + E_NOT_STRING: { type: "TypeError", number: -2146823283 }, E_NOT_BOOL: { type: "TypeError", number: -2146823278 }, E_ARG_NOT_OPT: { type: "TypeError", number: -2146827839 }, E_NO_PROPERTY: { type: "TypeError", number: -2146827850 }, @@ -2727,6 +2728,8 @@ testException(function() {(new Object()) instanceof nullDisp;}, "E_NOT_FUNC"); testException(function() {nullDisp instanceof Object;}, "E_OBJECT_EXPECTED"); testException(function() {Function.prototype.apply.call(nullDisp, Object, []);}, "E_OBJECT_REQUIRED"); testException(function() {Function.prototype.call.call(nullDisp, Object);}, "E_OBJECT_REQUIRED"); +testException(function() {String.prototype.toString.call(null);}, "E_NOT_STRING"); +testException(function() {String.prototype.toString.call([]);}, "E_NOT_STRING"); testException(function() {"test" in 3;}, "E_OBJECT_EXPECTED"); testException(function() {"test" in null;}, "E_OBJECT_EXPECTED"); testException(function() {"test" in nullDisp;}, "E_OBJECT_EXPECTED"); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 21546e632e4..c6d93b8dee2 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -547,6 +547,7 @@ sync_test("builtin_obj", function() { test_toString("Date", Date, 0xa138e); test_toString("RegExp", RegExp, 0xa1398); test_toString("Number", Number, 0xa1389); + test_toString("String", String, 0xa138d); if(v >= 9) { var obj = { length: 2 }; From 3cae61eeb8a1088391ed3b90f358a8cd99ca1d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1008/1506] mshtml: Implement DOMParser constructor and instance object. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 2 + dlls/mshtml/mshtml_private.h | 4 + dlls/mshtml/omnavigator.c | 171 ++++++++++++++++++++++++++++++ dlls/mshtml/tests/documentmode.js | 10 ++ dlls/mshtml/tests/es5.js | 11 ++ 5 files changed, 198 insertions(+) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 6eee22a2bac..d28c5c9c1bf 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2558,6 +2558,7 @@ static IDispatch *get_proxy_constructor_disp(HTMLInnerWindow *window, prototype_ dispex_static_data_t *dispex; const void *vtbl; } ctors[] = { + { PROTO_ID_DOMParser, &DOMParserCtor_dispex }, { PROTO_ID_MutationObserver, &mutation_observer_ctor_dispex }, { PROTO_ID_HTMLImgElement, &HTMLImageCtor_dispex, &HTMLImageElementFactoryVtbl }, { PROTO_ID_HTMLOptionElement, &HTMLOptionCtor_dispex, &HTMLOptionElementFactoryVtbl }, @@ -3153,6 +3154,7 @@ static IDispatch* WINAPI WineDispatchProxyPrivate_GetDefaultPrototype(IWineDispa static HRESULT WINAPI WineDispatchProxyPrivate_GetDefaultConstructor(IWineDispatchProxyPrivate *iface, IWineDispatchProxyPrivate *window, IDispatch **ret) { static const prototype_id_t special_ctors[] = { + PROTO_ID_DOMParser, PROTO_ID_MutationObserver, PROTO_ID_HTMLXMLHttpRequest }; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index e85d954b338..8140ef3b4b6 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -200,6 +200,7 @@ typedef struct ScriptHost ScriptHost; XDIID(DispDOMStorageEvent) \ XDIID(DispDOMUIEvent) \ XDIID(DispDOMDocumentType) \ + XDIID(DispDOMParser) \ XDIID(DispHTMLAnchorElement) \ XDIID(DispHTMLAreaElement) \ XDIID(DispHTMLAttributeCollection) \ @@ -264,6 +265,7 @@ typedef struct ScriptHost ScriptHost; XIID(IDOMStorageEvent) \ XIID(IDOMUIEvent) \ XIID(IDOMDocumentType) \ + XIID(IDOMParser) \ XIID(IDocumentEvent) \ XIID(IDocumentRange) \ XIID(IDocumentSelector) \ @@ -477,6 +479,7 @@ PRIVATE_TID_LIST #define PROXY_PROTOTYPE_LIST \ X(Console, "Console", console_dispex, Object) \ X(Crypto, "Crypto", crypto_dispex, Object) \ + X(DOMParser, "DOMParser", DOMParser_dispex, Object) \ X(MutationObserver, "MutationObserver", mutation_observer_dispex, Object) \ X(DOMEvent, "Event", DOMEvent_dispex, Object) \ X(DOMCustomEvent, "CustomEvent", DOMCustomEvent_dispex, DOMEvent) \ @@ -1759,6 +1762,7 @@ extern dispex_static_data_t HTMLXMLHttpRequestFactory_dispex; extern dispex_static_data_t HTMLImageCtor_dispex; extern dispex_static_data_t HTMLOptionCtor_dispex; extern dispex_static_data_t HTMLXMLHttpRequestCtor_dispex; +extern dispex_static_data_t DOMParserCtor_dispex; extern dispex_static_data_t mutation_observer_ctor_dispex; #define X(id, name, dispex, proto_id) extern dispex_static_data_t dispex; diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 1edb1a6e815..e77fe2a746c 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -357,6 +357,177 @@ void detach_dom_implementation(IHTMLDOMImplementation *iface) dom_implementation->browser = NULL; } +struct dom_parser { + DispatchEx dispex; + IDOMParser IDOMParser_iface; +}; + +static inline struct dom_parser *impl_from_IDOMParser(IDOMParser *iface) +{ + return CONTAINING_RECORD(iface, struct dom_parser, IDOMParser_iface); +} + +static HRESULT WINAPI DOMParser_QueryInterface(IDOMParser *iface, REFIID riid, void **ppv) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + return IDispatchEx_QueryInterface(&This->dispex.IDispatchEx_iface, riid, ppv); +} + +static ULONG WINAPI DOMParser_AddRef(IDOMParser *iface) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + return IDispatchEx_AddRef(&This->dispex.IDispatchEx_iface); +} + +static ULONG WINAPI DOMParser_Release(IDOMParser *iface) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + return IDispatchEx_Release(&This->dispex.IDispatchEx_iface); +} + +static HRESULT WINAPI DOMParser_GetTypeInfoCount(IDOMParser *iface, UINT *pctinfo) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI DOMParser_GetTypeInfo(IDOMParser *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI DOMParser_GetIDsOfNames(IDOMParser *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI DOMParser_Invoke(IDOMParser *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI DOMParser_parseFromString(IDOMParser *iface, BSTR string, BSTR mimeType, IHTMLDocument2 **ppNode) +{ + struct dom_parser *This = impl_from_IDOMParser(iface); + + FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(string), debugstr_w(mimeType), ppNode); + + return E_NOTIMPL; +} + +static const IDOMParserVtbl DOMParserVtbl = { + DOMParser_QueryInterface, + DOMParser_AddRef, + DOMParser_Release, + DOMParser_GetTypeInfoCount, + DOMParser_GetTypeInfo, + DOMParser_GetIDsOfNames, + DOMParser_Invoke, + DOMParser_parseFromString +}; + +static inline struct dom_parser *DOMParser_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct dom_parser, dispex); +} + +static void *DOMParser_query_interface(DispatchEx *dispex, REFIID riid) +{ + struct dom_parser *This = DOMParser_from_DispatchEx(dispex); + + if(IsEqualGUID(&IID_IDOMParser, riid)) + return &This->IDOMParser_iface; + + return NULL; +} + +static void DOMParser_destructor(DispatchEx *dispex) +{ + struct dom_parser *This = DOMParser_from_DispatchEx(dispex); + free(This); +} + +static const dispex_static_data_vtbl_t DOMParser_dispex_vtbl = { + .query_interface = DOMParser_query_interface, + .destructor = DOMParser_destructor, +}; + +static const tid_t DOMParser_iface_tids[] = { + IDOMParser_tid, + 0 +}; + +dispex_static_data_t DOMParser_dispex = { + "DOMParser", + &DOMParser_dispex_vtbl, + PROTO_ID_DOMParser, + DispDOMParser_tid, + DOMParser_iface_tids +}; + +static HRESULT DOMParserCtor_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + struct global_ctor *This = CONTAINING_RECORD(iface, struct global_ctor, dispex); + struct dom_parser *ret; + + TRACE("\n"); + + switch(flags) { + case DISPATCH_METHOD|DISPATCH_PROPERTYGET: + if(!res) + return E_INVALIDARG; + /* fall through */ + case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: + break; + default: + return global_ctor_value(iface, lcid, flags, params, res, ei, caller); + } + + if(!(ret = calloc(1, sizeof(*ret)))) + return E_OUTOFMEMORY; + + ret->IDOMParser_iface.lpVtbl = &DOMParserVtbl; + init_dispatch(&ret->dispex, &DOMParser_dispex, This->window, dispex_compat_mode(&This->dispex)); + + V_VT(res) = VT_DISPATCH; + V_DISPATCH(res) = (IDispatch*)&ret->IDOMParser_iface; + return S_OK; +} + +static const dispex_static_data_vtbl_t DOMParserCtor_dispex_vtbl = { + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = DOMParserCtor_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + +dispex_static_data_t DOMParserCtor_dispex = { + "DOMParser", + &DOMParserCtor_dispex_vtbl, + PROTO_ID_NULL, + NULL_tid, + no_iface_tids +}; + typedef struct { DispatchEx dispex; IHTMLScreen IHTMLScreen_iface; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index c6d93b8dee2..127b779c4e0 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -355,6 +355,7 @@ sync_test("builtin_toString", function() { if(v >= 9) { test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration"); test("doctype", document.doctype, "DocumentType"); + test("domParser", new DOMParser(), "DOMParser", null, "Function"); test("Event", document.createEvent("Event"), "Event"); test("CustomEvent", document.createEvent("CustomEvent"), "CustomEvent"); @@ -821,6 +822,12 @@ sync_test("builtin_prototypes", function() { }else ok(proto.constructor === window.HTMLOptionElement, "Option.prototype.constructor = " + proto.constructor); + if(v >= 9) { + set_obj("DOMParser", true); + test_prop("parseFromString"); + ok(proto.constructor === window.DOMParser, "DOMParser.prototype.constructor = " + proto.constructor); + } + // other constructors don't support construction set_obj("ClientRect"); set_obj("ClientRectList"); @@ -1065,6 +1072,7 @@ sync_test("builtin_prototypes", function() { [ "Document", "Node" ], [ "DocumentType", "Node" ], [ "DOMImplementation", "Object" ], + [ "DOMParser", "Object" ], [ "DOMTokenList", "Object" ], [ "Element", "Node" ], [ "Event", "Object" ], @@ -1223,6 +1231,7 @@ sync_test("builtin_constructors", function() { var v = document.documentMode; var special_ctors = [ + [ "DOMParser", [ "prototype", "arguments" ], [ "create", "length" ], 9 ], [ "Image", [ "prototype", "arguments" ], [ "create", "length" ] ], [ "MutationObserver", [ "prototype", "arguments" ], [ "create", "length" ], 11 ], [ "Option", [ "prototype", "arguments" ], [ "create", "length" ] ], @@ -1725,6 +1734,7 @@ sync_test("window_props", function() { test_exposed("WeakSet", false); test_exposed("performance", true); test_exposed("console", v >= 10); + test_exposed("DOMParser", v >= 9); test_exposed("matchMedia", v >= 10); test_exposed("msCrypto", v >= 11); test_exposed("MutationObserver", v >= 11); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 2367ca99320..82d5ae5098f 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3203,3 +3203,14 @@ sync_test("initProgressEvent", function() { ok(e.loaded === 99, "loaded after re-init = " + e.loaded); ok(e.total === 50, "total after re-init = " + e.total); }); + +sync_test("DOMParser", function() { + var p, r = DOMParser.length; + ok(r === 0, "length = " + r); + + p = DOMParser(); + r = Object.getPrototypeOf(p); + ok(r === DOMParser.prototype, "prototype of instance created without new = " + r); + ok(p !== new DOMParser(), "DOMParser() == new DOMParser()"); + ok(new DOMParser() !== new DOMParser(), "new DOMParser() == new DOMParser()"); +}); From 57008285d47188f30fd8268ae066e33b9ad39168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1009/1506] mshtml: Implement DOMParser's parseFromString for HTML documents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 8 ++++ dlls/mshtml/omnavigator.c | 92 +++++++++++++++++++++++++++++++++++- dlls/mshtml/tests/es5.js | 50 +++++++++++++++++++- 3 files changed, 148 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 8140ef3b4b6..0cff16098b9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1139,6 +1139,14 @@ struct HTMLFrameBase { typedef struct nsDocumentEventListener nsDocumentEventListener; +typedef enum { + DOCTYPE_INVALID = -1, + DOCTYPE_HTML, + DOCTYPE_XHTML, + DOCTYPE_XML, + DOCTYPE_SVG, +} document_type_t; + struct HTMLDocumentNode { HTMLDOMNode node; diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index e77fe2a746c..09fb8829f71 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -31,6 +31,31 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); +static document_type_t document_type_from_content_type(const WCHAR *content_type) +{ + static const struct { + const WCHAR *content_type; + document_type_t doc_type; + } table[] = { + { L"application/xhtml+xml", DOCTYPE_XHTML }, + { L"application/xml", DOCTYPE_XML }, + { L"image/svg+xml", DOCTYPE_SVG }, + { L"text/html", DOCTYPE_HTML }, + { L"text/xml", DOCTYPE_XML }, + }; + unsigned int i, a = 0, b = ARRAY_SIZE(table); + int c; + + while(a < b) { + i = (a + b) / 2; + c = wcsicmp(table[i].content_type, content_type); + if(!c) return table[i].doc_type; + if(c > 0) b = i; + else a = i + 1; + } + return DOCTYPE_INVALID; +} + typedef struct HTMLPluginsCollection HTMLPluginsCollection; typedef struct HTMLMimeTypesCollection HTMLMimeTypesCollection; @@ -360,6 +385,8 @@ void detach_dom_implementation(IHTMLDOMImplementation *iface) struct dom_parser { DispatchEx dispex; IDOMParser IDOMParser_iface; + + HTMLDocumentNode *doc; }; static inline struct dom_parser *impl_from_IDOMParser(IDOMParser *iface) @@ -422,9 +449,50 @@ static HRESULT WINAPI DOMParser_Invoke(IDOMParser *iface, DISPID dispIdMember, static HRESULT WINAPI DOMParser_parseFromString(IDOMParser *iface, BSTR string, BSTR mimeType, IHTMLDocument2 **ppNode) { struct dom_parser *This = impl_from_IDOMParser(iface); + document_type_t doc_type; + HRESULT hres; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(string), debugstr_w(mimeType), ppNode); + + if(!string || !mimeType || (doc_type = document_type_from_content_type(mimeType)) == DOCTYPE_INVALID) + return E_INVALIDARG; + + if(doc_type == DOCTYPE_HTML) { + IHTMLDOMImplementation *impl_iface; + HTMLDOMImplementation *impl; + IHTMLDocument7 *html_doc; + IHTMLElement *html_elem; + HTMLDocumentNode *doc; - FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(string), debugstr_w(mimeType), ppNode); + hres = IHTMLDocument5_get_implementation(&This->doc->IHTMLDocument5_iface, &impl_iface); + if(FAILED(hres)) + return hres; + + impl = impl_from_IHTMLDOMImplementation(impl_iface); + hres = HTMLDOMImplementation2_createHTMLDocument(&impl->IHTMLDOMImplementation2_iface, NULL, &html_doc); + HTMLDOMImplementation_Release(impl_iface); + if(FAILED(hres)) + return hres; + doc = CONTAINING_RECORD(html_doc, HTMLDocumentNode, IHTMLDocument7_iface); + + hres = IHTMLDocument3_get_documentElement(&doc->IHTMLDocument3_iface, &html_elem); + if(FAILED(hres)) { + IHTMLDocument7_Release(html_doc); + return hres; + } + hres = IHTMLElement_put_innerHTML(html_elem, string); + IHTMLElement_Release(html_elem); + if(FAILED(hres)) { + IHTMLDocument7_Release(html_doc); + return hres; + } + + *ppNode = &doc->IHTMLDocument2_iface; + return hres; + } + + FIXME("Not implemented for XML Document\n"); return E_NOTIMPL; } @@ -454,6 +522,23 @@ static void *DOMParser_query_interface(DispatchEx *dispex, REFIID riid) return NULL; } +static void DOMParser_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + struct dom_parser *This = DOMParser_from_DispatchEx(dispex); + if(This->doc) + note_cc_edge((nsISupports*)&This->doc->node.IHTMLDOMNode_iface, "doc", cb); +} + +static void DOMParser_unlink(DispatchEx *dispex) +{ + struct dom_parser *This = DOMParser_from_DispatchEx(dispex); + if(This->doc) { + HTMLDocumentNode *doc = This->doc; + This->doc = NULL; + IHTMLDOMNode_Release(&doc->node.IHTMLDOMNode_iface); + } +} + static void DOMParser_destructor(DispatchEx *dispex) { struct dom_parser *This = DOMParser_from_DispatchEx(dispex); @@ -463,6 +548,8 @@ static void DOMParser_destructor(DispatchEx *dispex) static const dispex_static_data_vtbl_t DOMParser_dispex_vtbl = { .query_interface = DOMParser_query_interface, .destructor = DOMParser_destructor, + .traverse = DOMParser_traverse, + .unlink = DOMParser_unlink }; static const tid_t DOMParser_iface_tids[] = { @@ -502,6 +589,9 @@ static HRESULT DOMParserCtor_value(DispatchEx *iface, LCID lcid, WORD flags, DIS return E_OUTOFMEMORY; ret->IDOMParser_iface.lpVtbl = &DOMParserVtbl; + ret->doc = This->window->doc; + IHTMLDOMNode_AddRef(&ret->doc->node.IHTMLDOMNode_iface); + init_dispatch(&ret->dispex, &DOMParser_dispex, This->window, dispex_compat_mode(&This->dispex)); V_VT(res) = VT_DISPATCH; diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 82d5ae5098f..75aaa3d4932 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3205,7 +3205,7 @@ sync_test("initProgressEvent", function() { }); sync_test("DOMParser", function() { - var p, r = DOMParser.length; + var p, r = DOMParser.length, mimeType; ok(r === 0, "length = " + r); p = DOMParser(); @@ -3213,4 +3213,52 @@ sync_test("DOMParser", function() { ok(r === DOMParser.prototype, "prototype of instance created without new = " + r); ok(p !== new DOMParser(), "DOMParser() == new DOMParser()"); ok(new DOMParser() !== new DOMParser(), "new DOMParser() == new DOMParser()"); + + var teststr = { toString: function() { return "wine"; } }; + + // HTML mime types + mimeType = [ + "text/hTml" + ]; + for(var i = 0; i < mimeType.length; i++) { + var m = mimeType[i], html = p.parseFromString(teststr, m), e = external.getExpectedMimeType(m.toLowerCase()); + r = html.mimeType; + ok(r === e, "mimeType of HTML document with mime type " + m + " = " + r + ", expected " + e); + r = html.childNodes; + ok(r.length === 1 || r.length === 2, "childNodes.length of HTML document with mime type " + m + " = " + r.length); + var html_elem = r[r.length - 1]; + ok(html_elem.nodeName === "HTML", "child nodeName of HTML document with mime type " + m + " = " + r.nodeName); + ok(html_elem.nodeValue === null, "child nodeValue of HTML document with mime type " + m + " = " + r.nodeValue); + r = html.anchors; + ok(r.length === 1, "anchors.length of HTML document with mime type " + m + " = " + r.length); + r = r[0]; + ok(r.nodeName === "A", "anchor nodeName of HTML document with mime type " + m + " = " + r.nodeName); + ok(r.nodeValue === null, "anchor nodeValue of HTML document with mime type " + m + " = " + r.nodeValue); + r = r.parentNode; + ok(r.nodeName === "BODY", "anchor parent nodeName of HTML document with mime type " + m + " = " + r.nodeName); + ok(r.nodeValue === null, "anchor parent nodeValue of HTML document with mime type " + m + " = " + r.nodeValue); + r = r.parentNode; + ok(r === html_elem, "body parent of HTML document with mime type " + m + " = " + r); + } + + // Invalid mime types + mimeType = [ + "application/html", + "wine/test+xml", + "image/jpeg", + "text/plain", + "html", + "+xml", + "xml", + 42 + ]; + for(var i = 0; i < mimeType.length; i++) { + try { + p.parseFromString(teststr, mimeType[i]); + ok(false, "expected exception calling parseFromString with mime type " + mimeType[i]); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === E_INVALIDARG, "parseFromString with mime type " + mimeType[i] + " threw " + n); + } + } }); From 03c1eba1e545acfce79e09c535a31228ba20576e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1010/1506] mshtml: Use Gecko's responseXML to create the XML document in IE10 and up. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native modes IE10 and up implement XML documents as children of the DocumentPrototype, which have standard IHTMLDocument interfaces. But previous modes do not, but instead have the IXMLDOMDocument interface (which suggests it uses msxml like now). Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmldoc.c | 25 +++++++++++++++++++++---- dlls/mshtml/htmlwindow.c | 2 +- dlls/mshtml/mshtml_private.h | 5 ++++- dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/documentmode.js | 1 + dlls/mshtml/tests/xhr.js | 22 ++++++++++++++++++++++ dlls/mshtml/tests/xmlhttprequest.c | 15 +++++++++++++++ dlls/mshtml/xmlhttprequest.c | 12 ++++++++++++ 8 files changed, 77 insertions(+), 7 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 89b6e58f48b..b9d43e456f8 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -39,6 +39,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); +static dispex_static_data_t *const dispex_from_document_type[] = { + [DOCTYPE_HTML] = &HTMLDocumentNode_dispex, + [DOCTYPE_XHTML] = &XMLDocumentNode_dispex, + [DOCTYPE_XML] = &XMLDocumentNode_dispex, + [DOCTYPE_SVG] = &XMLDocumentNode_dispex, +}; + static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret); HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement **ret) @@ -6261,7 +6268,7 @@ static void HTMLDocumentNode_finalize_dispex(DispatchEx *dispex) if(COMPAT_MODE_IE9 <= compat_mode && compat_mode < COMPAT_MODE_IE11) dispex_data = &DocumentNode_dispex; else - dispex_data = &HTMLDocumentNode_dispex; + dispex_data = dispex_from_document_type[This->doc_type]; finalize_delayed_init_dispex(dispex, get_inner_window(This), dispex_data); } @@ -6413,6 +6420,15 @@ dispex_static_data_t DocumentNode_dispex = { HTMLDocumentNode_init_dispex_info }; +dispex_static_data_t XMLDocumentNode_dispex = { + "XMLDocument", + &HTMLDocumentNode_event_target_vtbl.dispex_vtbl, + PROTO_ID_XMLDocument, + DispHTMLDocument_tid, + HTMLDocumentNode_iface_tids, + HTMLDocumentNode_init_dispex_info +}; + static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window) { HTMLDocumentNode *doc; @@ -6458,7 +6474,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo } HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLInnerWindow *window, - compat_mode_t parent_mode, HTMLDocumentNode **ret) + document_type_t doc_type, compat_mode_t parent_mode, HTMLDocumentNode **ret) { HTMLDocumentObj *doc_obj = browser->doc; HTMLDocumentNode *doc; @@ -6466,6 +6482,7 @@ HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLI doc = alloc_doc_node(doc_obj, window); if(!doc) return E_OUTOFMEMORY; + doc->doc_type = doc_type; if(doc_obj && (!doc_obj->window || (window && is_main_content_window(window->base.outer_window)))) doc->cp_container.forward_container = &doc_obj->cp_container; @@ -6479,7 +6496,7 @@ HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLI doc->html_document = NULL; } - HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)doc->dom_document, &HTMLDocumentNode_dispex); + HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)doc->dom_document, dispex_from_document_type[doc_type]); init_document_mutation(doc); doc_init_events(doc); @@ -6518,7 +6535,7 @@ static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *do if(!doc_frag) return E_OUTOFMEMORY; - HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode, &HTMLDocumentNode_dispex); + HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode, dispex_from_document_type[doc_node->doc_type]); doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl; doc_frag->document_mode = lock_document_mode(doc_node); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 68d93672616..170c87dbf93 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -5278,7 +5278,7 @@ HRESULT update_window_doc(HTMLInnerWindow *window) if(outer_window->parent) parent_mode = outer_window->parent->base.inner_window->doc->document_mode; - hres = create_document_node(nsdoc, outer_window->browser, window, parent_mode, &window->doc); + hres = create_document_node(nsdoc, outer_window->browser, window, DOCTYPE_HTML, parent_mode, &window->doc); nsIDOMDocument_Release(nsdoc); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 0cff16098b9..876d483cb71 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -492,6 +492,7 @@ PRIVATE_TID_LIST X(DOMUIEvent, "UIEvent", DOMUIEvent_dispex, DOMEvent) \ X(DOMCharacterData, "CharacterData", DOMCharacterData_dispex, HTMLDOMNode) \ X(Document, "Document", DocumentNode_dispex, HTMLDOMNode) \ + X(XMLDocument, "XMLDocument", XMLDocumentNode_dispex, Document) \ X(DocumentType, "DocumentType", DocumentType_dispex, HTMLDOMNode) \ X(DOMElement, "Element", DOMElement_dispex, HTMLDOMNode) \ X(CSSRule, "CSSRule", CSSRule_dispex, Object) \ @@ -1139,6 +1140,7 @@ struct HTMLFrameBase { typedef struct nsDocumentEventListener nsDocumentEventListener; +/* NOTE: Update arrays at top of htmldoc.c if you change this */ typedef enum { DOCTYPE_INVALID = -1, DOCTYPE_HTML, @@ -1199,6 +1201,7 @@ struct HTMLDocumentNode { unsigned int content_ready : 1; unsigned int unload_sent : 1; + document_type_t doc_type; IHTMLDOMImplementation *dom_implementation; IHTMLNamespaceCollection *namespaces; @@ -1225,7 +1228,7 @@ HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**); HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**); HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**); HRESULT create_document_node(nsIDOMDocument*,GeckoBrowser*,HTMLInnerWindow*, - compat_mode_t,HTMLDocumentNode**); + document_type_t,compat_mode_t,HTMLDocumentNode**); HRESULT create_doctype_node(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**); HRESULT create_marshaled_doc(HWND,REFIID,void**); diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 09fb8829f71..af8069ae0b3 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -250,7 +250,7 @@ static HRESULT WINAPI HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplemen return E_FAIL; } - hres = create_document_node(doc, This->browser, NULL, dispex_compat_mode(&This->dispex), &new_document_node); + hres = create_document_node(doc, This->browser, NULL, DOCTYPE_HTML, dispex_compat_mode(&This->dispex), &new_document_node); nsIDOMDocument_Release(doc); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 127b779c4e0..b2e81fefe73 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1143,6 +1143,7 @@ sync_test("builtin_prototypes", function() { [ "TextRange", "Object" ], [ "UIEvent", "Event" ], [ "Window", "Object" ], + [ "XMLDocument", "Document" ], [ "XMLHttpRequest", "Object" ] ]; diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 661eafc54d9..ec690950475 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -21,6 +21,7 @@ var xml = "\nwine function test_xhr() { var xhr = new XMLHttpRequest(); var complete_cnt = 0, loadstart = false; + var v = document.documentMode; xhr.onreadystatechange = function() { if(xhr.readyState != 4) @@ -29,6 +30,26 @@ function test_xhr() { ok(xhr.responseText === xml, "unexpected responseText " + xhr.responseText); ok(xhr.responseXML !== null, "unexpected null responseXML"); + var x = xhr.responseXML, r = Object.prototype.toString.call(x); + ok(r === (v < 10 ? "[object Object]" : (v < 11 ? "[object Document]" : "[object XMLDocument]")), + "XML document Object.toString = " + r); + + r = Object.getPrototypeOf(x); + if(v < 10) + ok(r === null, "prototype of returned XML document = " + r); + else if(v < 11) + ok(r === window.Document.prototype, "prototype of returned XML document = " + r); + else + ok(r === window.XMLDocument.prototype, "prototype of returned XML document" + r); + + if(v < 10) { + ok(!("anchors" in x), "anchors is in returned XML document"); + ok(Object.prototype.hasOwnProperty.call(x, "createElement"), "createElement not a prop of returned XML document"); + }else { + ok("anchors" in x, "anchors not in returned XML document"); + ok(!x.hasOwnProperty("createElement"), "createElement is a prop of returned XML document"); + } + if(complete_cnt++ && !("onloadend" in xhr)) next_test(); } @@ -228,6 +249,7 @@ function test_content_types() { var xml_types = [ "text/xmL", "apPliCation/xml", + "application/xHtml+xml", "image/SvG+xml", "Wine/Test+xml", "++Xml", diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index 6226461a502..44132160520 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -519,10 +519,14 @@ static void _set_request_header(unsigned line, IHTMLXMLHttpRequest *xhr, const W static void test_responseXML(const WCHAR *expect_text) { IDispatch *disp; + IHTMLDocument2 *html_doc; IXMLDOMDocument *xmldom; IObjectSafety *safety; + IHTMLDOMNode *node; DWORD enabled = 0, supported = 0; + DISPID dispid; HRESULT hres; + BSTR str; disp = NULL; hres = IHTMLXMLHttpRequest_get_responseXML(xhr, &disp); @@ -545,6 +549,17 @@ static void test_responseXML(const WCHAR *expect_text) "Expected enabled: (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), got 0x%08lx\n", enabled); IObjectSafety_Release(safety); + hres = IXMLDOMDocument_QueryInterface(xmldom, &IID_IHTMLDOMNode, (void**)&node); + ok(hres == E_NOINTERFACE, "QueryInterface(IHTMLDOMNode) returned: %08lx\n", hres); + + hres = IXMLDOMDocument_QueryInterface(xmldom, &IID_IHTMLDocument2, (void**)&html_doc); + ok(hres == E_NOINTERFACE, "QueryInterface(IHTMLDocument2) returned: %08lx\n", hres); + + str = SysAllocString(L"anchors"); + hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &str, 1, LOCALE_USER_DEFAULT, &dispid); + ok(hres == DISP_E_UNKNOWNNAME, "GetIDsOfNames(\"anchors\") returned: %08lx\n", hres); + SysFreeString(str); + if(!expect_text) test_illegal_xml(xmldom); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 5df687cfee3..25f3711901b 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -611,6 +611,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *if } if(dispex_compat_mode(&This->event_target.dispex) >= COMPAT_MODE_IE10) { + HTMLDocumentNode *doc; nsIDOMDocument *nsdoc; nsresult nsres; @@ -621,7 +622,18 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *if *p = NULL; return S_OK; } + + if(!This->window->base.outer_window || !This->window->base.outer_window->browser) + hres = E_UNEXPECTED; + else + hres = create_document_node(nsdoc, This->window->base.outer_window->browser, NULL, DOCTYPE_XML, + dispex_compat_mode(&This->window->event_target.dispex), &doc); nsIDOMDocument_Release(nsdoc); + if(FAILED(hres)) + return hres; + + *p = (IDispatch*)&doc->IHTMLDocument2_iface; + return S_OK; } hres = CoCreateInstance(&CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (void**)&xmldoc); From ace3fc3b76ec940c79dab9897ff283c0d28f1b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1011/1506] mshtml: Use the proper XML document type in responseXML. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmldoc.c | 12 +++++++++++- dlls/mshtml/tests/xhr.js | 11 +++++++++-- dlls/mshtml/xmlhttprequest.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index b9d43e456f8..e6977e67968 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -39,6 +39,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); +static const WCHAR *const content_type_from_document_type[] = { + [DOCTYPE_HTML] = L"text/html", + [DOCTYPE_XHTML] = L"application/xhtml+xml", + [DOCTYPE_XML] = L"text/xml", + [DOCTYPE_SVG] = L"image/svg+xml", +}; + static dispex_static_data_t *const dispex_from_document_type[] = { [DOCTYPE_HTML] = &HTMLDocumentNode_dispex, [DOCTYPE_XHTML] = &XMLDocumentNode_dispex, @@ -1316,7 +1323,10 @@ static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p) *p = NULL; - if(This->window && !This->window->navigation_start_time) + if(!This->window) + return get_mime_type_display_name(content_type_from_document_type[This->doc_type], p); + + if(!This->window->navigation_start_time) return (*p = SysAllocString(L"")) ? S_OK : E_FAIL; nsAString_InitDepend(&nsstr, NULL); diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index ec690950475..e18a52a0be4 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -258,9 +258,16 @@ function test_content_types() { function onload() { ok(xhr.responseText === xml, "unexpected responseText " + xhr.responseText); - if(v < 10 || types === xml_types) + if(v < 10 || types === xml_types) { ok(xhr.responseXML !== null, "unexpected null responseXML for " + types[i]); - else + if(v >= 10) { + var r = xhr.responseXML.mimeType, e = "text/xml"; + if(types[i] === "application/xHtml+xml" || types[i] === "image/SvG+xml") + e = types[i].toLowerCase(); + e = external.getExpectedMimeType(e); + ok(r === e, "XML document mimeType for " + types[i] + " = " + r + ", expected " + e); + } + }else ok(xhr.responseXML === null, "unexpected non-null responseXML for " + (override ? "overridden " : "") + types[i]); if(("overrideMimeType" in xhr) && !override) { diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 25f3711901b..a0fd41e04e3 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -138,6 +138,7 @@ struct HTMLXMLHttpRequest { IProvideClassInfo2 IProvideClassInfo2_iface; LONG task_magic; LONG ready_state; + document_type_t doctype_override; response_type_t response_type; BOOLEAN synchronous; DWORD magic; @@ -611,8 +612,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *if } if(dispex_compat_mode(&This->event_target.dispex) >= COMPAT_MODE_IE10) { + nsACString header, nscstr; + document_type_t doctype; HTMLDocumentNode *doc; nsIDOMDocument *nsdoc; + const char *type; nsresult nsres; nsres = nsIXMLHttpRequest_GetResponseXML(This->nsxhr, &nsdoc); @@ -625,9 +629,27 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *if if(!This->window->base.outer_window || !This->window->base.outer_window->browser) hres = E_UNEXPECTED; - else - hres = create_document_node(nsdoc, This->window->base.outer_window->browser, NULL, DOCTYPE_XML, + else { + if(This->doctype_override != DOCTYPE_INVALID) + doctype = This->doctype_override; + else { + doctype = DOCTYPE_XML; + nsACString_InitDepend(&header, "Content-Type"); + nsACString_InitDepend(&nscstr, NULL); + nsres = nsIXMLHttpRequest_GetResponseHeader(This->nsxhr, &header, &nscstr); + nsACString_Finish(&header); + if(NS_SUCCEEDED(nsres)) { + nsACString_GetData(&nscstr, &type); + if(!stricmp(type, "application/xhtml+xml")) + doctype = DOCTYPE_XHTML; + else if(!stricmp(type, "image/svg+xml")) + doctype = DOCTYPE_SVG; + } + nsACString_Finish(&nscstr); + } + hres = create_document_node(nsdoc, This->window->base.outer_window->browser, NULL, doctype, dispex_compat_mode(&This->window->event_target.dispex), &doc); + } nsIDOMDocument_Release(nsdoc); if(FAILED(hres)) return hres; @@ -1288,6 +1310,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_overrideMimeType(IWineXMLHttpRe { HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface); static const WCHAR generic_type[] = L"application/octet-stream"; + document_type_t doctype = DOCTYPE_XML; const WCHAR *type = NULL; WCHAR *lowercase = NULL; nsAString nsstr; @@ -1301,6 +1324,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_overrideMimeType(IWineXMLHttpRe return E_OUTOFMEMORY; _wcslwr(lowercase); type = lowercase; + + if(!wcscmp(type, L"application/xhtml+xml")) + doctype = DOCTYPE_XHTML; + else if(!wcscmp(type, L"image/svg+xml")) + doctype = DOCTYPE_SVG; }else type = generic_type; } @@ -1309,6 +1337,8 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_overrideMimeType(IWineXMLHttpRe nsres = nsIXMLHttpRequest_SlowOverrideMimeType(This->nsxhr, &nsstr); nsAString_Finish(&nsstr); free(lowercase); + if(NS_SUCCEEDED(nsres)) + This->doctype_override = doctype; return map_nsresult(nsres); } @@ -1718,6 +1748,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor ret->nsxhr = nsxhr; ret->window = This->window; + ret->doctype_override = DOCTYPE_INVALID; ret->task_magic = get_task_target_magic(); IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); From bf3e0e34db631935076df93d5d3717234bc877a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1012/1506] mshtml: Implement anchors prop for XML documents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmldoc.c | 21 ++++++++++----------- dlls/mshtml/tests/xhr.js | 2 ++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index e6977e67968..6b5d73c0604 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -749,21 +749,20 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme return E_UNEXPECTED; } - if(!This->html_document) { - FIXME("Not implemented for XML document\n"); - return E_NOTIMPL; - } + if(This->doc_type == DOCTYPE_XHTML) + FIXME("Not implemented for XHTML Document, returning empty list\n"); - nsres = nsIDOMHTMLDocument_GetAnchors(This->html_document, &nscoll); - if(NS_FAILED(nsres)) { - ERR("GetAnchors failed: %08lx\n", nsres); - return E_FAIL; + if(This->html_document) { + nsres = nsIDOMHTMLDocument_GetAnchors(This->html_document, &nscoll); + if(NS_FAILED(nsres)) { + ERR("GetAnchors failed: %08lx\n", nsres); + return E_FAIL; + } } - if(nscoll) { - *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); + *p = create_collection_from_htmlcol(nscoll, This, This->document_mode); + if(nscoll) nsIDOMHTMLCollection_Release(nscoll); - } return S_OK; } diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index e18a52a0be4..045892bd346 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -48,6 +48,8 @@ function test_xhr() { }else { ok("anchors" in x, "anchors not in returned XML document"); ok(!x.hasOwnProperty("createElement"), "createElement is a prop of returned XML document"); + r = x.anchors; + ok(r.length === 0, "anchors.length of returned XML document = " + r.length); } if(complete_cnt++ && !("onloadend" in xhr)) From ec2e35c7f271a06ece206de6e063073c3d0c1e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1013/1506] mshtml: Implement DOMParser's parseFromString for XML documents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/nsembed.c | 46 +++++++++++++++++++++++++++++++ dlls/mshtml/nsiface.idl | 13 +++++++++ dlls/mshtml/omnavigator.c | 42 ++++++++++++++++++++++++++-- dlls/mshtml/tests/documentmode.js | 3 ++ dlls/mshtml/tests/es5.js | 46 +++++++++++++++++++++++++++++++ 6 files changed, 150 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 876d483cb71..b0a6c44ca1a 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -169,6 +169,7 @@ struct _IWineDispatchProxyCbPrivate { #define MSHTML_E_INVALID_PROPERTY 0x800a01b6 #define MSHTML_E_INVALID_ACTION 0x800a01bd #define MSHTML_E_NODOC 0x800a025c +#define MSHTML_E_SYNTAX 0x800a03ea #define MSHTML_E_NOT_FUNC 0x800a138a typedef struct HTMLWindow HTMLWindow; @@ -1344,6 +1345,7 @@ HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*); void setup_editor_controller(GeckoBrowser*); nsresult get_nsinterface(nsISupports*,REFIID,void**); nsIWritableVariant *create_nsvariant(void); +nsIDOMParser *create_nsdomparser(HTMLDocumentNode*); nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow); nsresult create_nsfile(const PRUnichar*,nsIFile**); char *get_nscategory_entry(const char*,const char*); diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 29a3d4680a4..b8d05e3fdac 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -42,6 +42,7 @@ WINE_DECLARE_DEBUG_CHANNEL(gecko); #define NS_WEBBROWSER_CONTRACTID "@mozilla.org/embedding/browser/nsWebBrowser;1" #define NS_COMMANDPARAMS_CONTRACTID "@mozilla.org/embedcomp/command-params;1" #define NS_HTMLSERIALIZER_CONTRACTID "@mozilla.org/layout/contentserializer;1?mimetype=text/html" +#define NS_DOMPARSER_CONTRACTID "@mozilla.org/xmlextras/domparser;1" #define NS_EDITORCONTROLLER_CONTRACTID "@mozilla.org/editor/editorcontroller;1" #define NS_PREFERENCES_CONTRACTID "@mozilla.org/preferences;1" #define NS_VARIANT_CONTRACTID "@mozilla.org/variant;1" @@ -2425,6 +2426,51 @@ __ASM_GLOBAL_FUNC(call_thiscall_func, #define nsIScriptObjectPrincipal_GetPrincipal(this) ((void* (WINAPI*)(void*,void*))&call_thiscall_func)((this)->lpVtbl->GetPrincipal,this) #endif +nsIDOMParser *create_nsdomparser(HTMLDocumentNode *doc_node) +{ + nsIScriptObjectPrincipal *sop; + HTMLOuterWindow *outer_window; + mozIDOMWindow *inner_window; + nsIGlobalObject *nsglo; + nsIDOMParser *nsparser; + nsIPrincipal *nspri; + nsresult nsres; + + outer_window = doc_node->window && doc_node->window->base.outer_window ? doc_node->window->base.outer_window : doc_node->doc_obj->window; + + nsres = nsIDOMWindow_GetInnerWindow(outer_window->nswindow, &inner_window); + if(NS_FAILED(nsres)) { + ERR("Could not get inner window: %08lx\n", nsres); + return NULL; + } + + nsres = mozIDOMWindow_QueryInterface(inner_window, &IID_nsIGlobalObject, (void**)&nsglo); + mozIDOMWindow_Release(inner_window); + assert(nsres == NS_OK); + + nsres = nsIGlobalObject_QueryInterface(nsglo, &IID_nsIScriptObjectPrincipal, (void**)&sop); + assert(nsres == NS_OK); + + /* The returned principal is *not* AddRef'd */ + nspri = nsIScriptObjectPrincipal_GetPrincipal(sop); + nsIScriptObjectPrincipal_Release(sop); + + nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, + NS_DOMPARSER_CONTRACTID, NULL, &IID_nsIDOMParser, (void**)&nsparser); + if(NS_SUCCEEDED(nsres)) { + nsres = nsIDOMParser_Init(nsparser, nspri, NULL, NULL, nsglo); + if(NS_FAILED(nsres)) + nsIDOMParser_Release(nsparser); + } + nsIGlobalObject_Release(nsglo); + if(NS_FAILED(nsres)) { + ERR("nsIDOMParser_Init failed: %08lx\n", nsres); + return NULL; + } + + return nsparser; +} + nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) { nsIScriptObjectPrincipal *sop; diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 43786b490f5..1f2131dfb24 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -4369,6 +4369,19 @@ interface nsIScriptObjectPrincipal : nsISupports nsIPrincipal* /* thiscall */ GetPrincipal(); } +[ + object, + uuid(70b9600e-8622-4c93-9ad8-22c28058dc44), + local +] +interface nsIDOMParser : nsISupports +{ + nsresult ParseFromString(const char16_t *str, const char *contentType, nsIDOMDocument **_retval); + nsresult ParseFromBuffer(const uint8_t *buf, uint32_t bufLen, const char *aContentType, nsIDOMDocument **_retval); + nsresult ParseFromStream(nsIInputStream *stream, const char *charset, int32_t contentLength, const char *contentType, nsIDOMDocument **_retval); + nsresult Init(nsIPrincipal *principal, nsIURI *documentURI, nsIURI *baseURI, nsIGlobalObject *scriptObject); +} + [ object, uuid(6f54214c-7175-498d-9d2d-0429e38c2869), diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index af8069ae0b3..1bb40b02767 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -449,7 +449,13 @@ static HRESULT WINAPI DOMParser_Invoke(IDOMParser *iface, DISPID dispIdMember, static HRESULT WINAPI DOMParser_parseFromString(IDOMParser *iface, BSTR string, BSTR mimeType, IHTMLDocument2 **ppNode) { struct dom_parser *This = impl_from_IDOMParser(iface); + nsIDOMDocument *nsdoc = NULL; + HTMLDocumentNode *xml_doc; document_type_t doc_type; + nsAString errns, errtag; + nsIDOMNodeList *nodes; + nsIDOMParser *parser; + nsresult nsres; HRESULT hres; TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(string), debugstr_w(mimeType), ppNode); @@ -492,8 +498,40 @@ static HRESULT WINAPI DOMParser_parseFromString(IDOMParser *iface, BSTR string, return hres; } - FIXME("Not implemented for XML Document\n"); - return E_NOTIMPL; + if(!(parser = create_nsdomparser(This->doc))) + return E_FAIL; + nsres = nsIDOMParser_ParseFromString(parser, string ? string : L"", + doc_type == DOCTYPE_SVG ? "image/svg+xml" : + doc_type == DOCTYPE_XHTML ? "application/xhtml+xml" : + "text/xml", &nsdoc); + nsIDOMParser_Release(parser); + if(NS_FAILED(nsres) || !nsdoc) { + ERR("ParseFromString failed: 0x%08lx\n", nsres); + return NS_FAILED(nsres) ? map_nsresult(nsres) : E_FAIL; + } + + nsAString_InitDepend(&errns, L"http://www.mozilla.org/newlayout/xml/parsererror.xml"); + nsAString_InitDepend(&errtag, L"parsererror"); + nsres = nsIDOMDocument_GetElementsByTagNameNS(nsdoc, &errns, &errtag, &nodes); + nsAString_Finish(&errtag); + nsAString_Finish(&errns); + if(NS_SUCCEEDED(nsres)) { + UINT32 length; + nsres = nsIDOMNodeList_GetLength(nodes, &length); + nsIDOMNodeList_Release(nodes); + if(NS_SUCCEEDED(nsres) && length) { + nsIDOMDocument_Release(nsdoc); + return MSHTML_E_SYNTAX; + } + } + + hres = create_document_node(nsdoc, This->doc->browser, NULL, doc_type, This->doc->document_mode, &xml_doc); + nsIDOMDocument_Release(nsdoc); + if(FAILED(hres)) + return hres; + + *ppNode = &xml_doc->IHTMLDocument2_iface; + return hres; } static const IDOMParserVtbl DOMParserVtbl = { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index b2e81fefe73..bf347459b32 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -356,6 +356,9 @@ sync_test("builtin_toString", function() { test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration"); test("doctype", document.doctype, "DocumentType"); test("domParser", new DOMParser(), "DOMParser", null, "Function"); + test("svgDocument", new DOMParser().parseFromString("foobar", "image/svg+xml"), v < 11 ? "Document" : "XMLDocument"); + test("xhtmlDocument", new DOMParser().parseFromString("foobar", "application/xhtml+xml"), v < 11 ? "Document" : "XMLDocument"); + test("xmlDocument", new DOMParser().parseFromString("foobar", "text/xml"), v < 11 ? "Document" : "XMLDocument"); test("Event", document.createEvent("Event"), "Event"); test("CustomEvent", document.createEvent("CustomEvent"), "CustomEvent"); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 75aaa3d4932..888a2267c93 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3241,6 +3241,44 @@ sync_test("DOMParser", function() { ok(r === html_elem, "body parent of HTML document with mime type " + m + " = " + r); } + // XML mime types + mimeType = [ + "text/xmL", + "aPPlication/xml", + "application/xhtml+xml", + "image/svg+xml" + ]; + for(var i = 0; i < mimeType.length; i++) { + var m = mimeType[i], xml = p.parseFromString(teststr, m), e; + e = external.getExpectedMimeType(m === "aPPlication/xml" ? "text/xml" : m.toLowerCase()); + r = xml.mimeType; + ok(r === e, "mimeType of XML document with mime type " + m + " = " + r + ", expected " + e); + r = xml.childNodes; + ok(r.length === 1, "childNodes.length of XML document with mime type " + m + " = " + r.length); + r = r[0]; + ok(r.nodeName === "a", "child nodeName of XML document with mime type " + m + " = " + r.nodeName); + ok(r.nodeValue === null, "child nodeValue of XML document with mime type " + m + " = " + r.nodeValue); + r = r.childNodes; + ok(r.length === 1, "childNodes of child.length of XML document with mime type " + m + " = " + r.length); + r = r[0]; + ok(r.nodeName === "#text", "child of child nodeName of XML document with mime type " + m + " = " + r.nodeName); + ok(r.nodeValue === "wine", "child of child nodeValue of XML document with mime type " + m + " = " + r.nodeValue); + ok(!("test" in xml), "'test' in XML document with mime type " + m); + + // test HTMLDocument specific props, which are available in DocumentPrototype, + // so they are shared in XMLDocument since they both have the same prototype + r = xml.anchors; + if(m === "application/xhtml+xml") { + todo_wine. + ok(r.length === 1, "anchors.length of XML document with mime type " + m + " = " + r.length); + r = r[0]; + todo_wine. + ok(r === xml.childNodes[0], "anchor of XML document with mime type " + m + " = " + r); + }else { + ok(r.length === 0, "anchors.length of XML document with mime type " + m + " = " + r.length); + } + } + // Invalid mime types mimeType = [ "application/html", @@ -3261,4 +3299,12 @@ sync_test("DOMParser", function() { ok(n === E_INVALIDARG, "parseFromString with mime type " + mimeType[i] + " threw " + n); } } + + try { + r = p.parseFromString("xml", "text/xml"); + ok(false, "expected exception calling parseFromString with invalid xml"); + }catch(ex) { + ok(ex.name === "SyntaxError", "parseFromString with invalid xml threw " + ex.name); + } + p.parseFromString("", "text/xml"); }); From 3fd62f38d2227ef517f647caf02e580c7e5876be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1014/1506] mshtml: Set non-HTML elements' prototype to ElementPrototype. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlelem.c | 34 +++++++++++++++++++++++-------- dlls/mshtml/tests/documentmode.js | 4 +++- dlls/mshtml/tests/es5.js | 10 +++++++++ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index c12cecde9e0..6fcab0cf89f 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -7619,7 +7619,7 @@ static void DOMElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) dispex_static_data_t DOMElement_dispex = { "Element", - &no_dispex_vtbl, + &HTMLElement_event_target_vtbl.dispex_vtbl, PROTO_ID_DOMElement, NULL_tid, no_iface_tids, @@ -8255,6 +8255,8 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMElement *n HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret) { + nsIDOMHTMLElement *nshtmlelem; + nsIDOMSVGElement *svg_element; nsIDOMElement *nselem; nsAString tag_name_str; const PRUnichar *tag_name; @@ -8274,17 +8276,32 @@ HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_g nsAString_GetData(&tag_name_str, &tag_name); + /* Check this first, as Gecko treats svg elements as non-HTML */ + nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMSVGElement, (void**)&svg_element); + if(NS_SUCCEEDED(nsres)) { + hres = create_svg_element(doc, svg_element, tag_name, &elem); + nsIDOMSVGElement_Release(svg_element); + goto done; + } + + nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)&nshtmlelem); + if(NS_FAILED(nsres)) { + if(!(elem = calloc(1, sizeof(HTMLElement)))) + hres = E_OUTOFMEMORY; + else { + elem->node.vtbl = &HTMLElementImplVtbl; + HTMLElement_Init(elem, doc, nselem, &DOMElement_dispex); + hres = S_OK; + } + goto done; + } + nsIDOMHTMLElement_Release(nshtmlelem); + tag = get_tag_desc(tag_name); if(tag) { hres = tag->constructor(doc, nselem, &elem); }else { - nsIDOMSVGElement *svg_element; - - nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMSVGElement, (void**)&svg_element); - if(NS_SUCCEEDED(nsres)) { - hres = create_svg_element(doc, svg_element, tag_name, &elem); - nsIDOMSVGElement_Release(svg_element); - }else if(use_generic || doc->document_mode >= COMPAT_MODE_IE9) { + if(use_generic || doc->document_mode >= COMPAT_MODE_IE9) { hres = HTMLGenericElement_Create(doc, nselem, &elem); }else { elem = calloc(1, sizeof(HTMLElement)); @@ -8298,6 +8315,7 @@ HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_g } } +done: TRACE("%s ret %p\n", debugstr_w(tag_name), elem); nsIDOMElement_Release(nselem); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index bf347459b32..b6ad7d95d27 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -353,12 +353,14 @@ sync_test("builtin_toString", function() { test("selection", document.selection, "MSSelection"); } if(v >= 9) { + var xml = new DOMParser().parseFromString("foobar", "text/xml"); test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration"); test("doctype", document.doctype, "DocumentType"); test("domParser", new DOMParser(), "DOMParser", null, "Function"); test("svgDocument", new DOMParser().parseFromString("foobar", "image/svg+xml"), v < 11 ? "Document" : "XMLDocument"); test("xhtmlDocument", new DOMParser().parseFromString("foobar", "application/xhtml+xml"), v < 11 ? "Document" : "XMLDocument"); - test("xmlDocument", new DOMParser().parseFromString("foobar", "text/xml"), v < 11 ? "Document" : "XMLDocument"); + test("xmlDocument", xml, v < 11 ? "Document" : "XMLDocument"); + test("xmlElement", xml.getElementsByTagName("tag")[0], "Element"); test("Event", document.createEvent("Event"), "Event"); test("CustomEvent", document.createEvent("CustomEvent"), "CustomEvent"); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 888a2267c93..bd64cf4ec8f 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3274,8 +3274,18 @@ sync_test("DOMParser", function() { r = r[0]; todo_wine. ok(r === xml.childNodes[0], "anchor of XML document with mime type " + m + " = " + r); + r = Object.prototype.toString.call(xml.getElementsByTagName("a")[0]); + todo_wine. + ok(r === "[object HTMLAnchorElement]", "element's Object.toString of XML document with mime type " + m + " = " + r); }else { ok(r.length === 0, "anchors.length of XML document with mime type " + m + " = " + r.length); + r = Object.getPrototypeOf(xml.getElementsByTagName("a")[0]); + ok(r === Element.prototype, "element's prototype of XML document with mime type " + m + " = " + r); + r = document.importNode(xml.childNodes[0], true); + ok(r.nodeName === "a", "imported node name of XML document with mime type " + m + " = " + r.nodeName); + ok(r.nodeValue === null, "imported node value of XML document with mime type " + m + " = " + r.nodeValue); + r = Object.getPrototypeOf(r); + ok(r === Element.prototype, "imported node's prototype of XML document with mime type " + m + " = " + r); } } From a251d40141e305ff6cade44a1cc28010999dcf1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:30 +0200 Subject: [PATCH 1015/1506] mshtml: Add window.msCrypto.subtle stub. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/mshtml_private.h | 2 + dlls/mshtml/mshtml_private_iface.idl | 40 ++++ dlls/mshtml/omnavigator.c | 270 ++++++++++++++++++++++++++- dlls/mshtml/tests/documentmode.js | 8 + 4 files changed, 316 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index b0a6c44ca1a..39409423634 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -403,6 +403,7 @@ typedef struct ScriptHost ScriptHost; XIID(IWineXMLHttpRequestPrivate) \ XIID(IWineMSHTMLConsole) \ XIID(IWineMSHTMLCrypto) \ + XIID(IWineMSHTMLSubtleCrypto) \ XIID(IWineMSHTMLMediaQueryList) \ XIID(IWineMSHTMLMutationObserver) @@ -480,6 +481,7 @@ PRIVATE_TID_LIST #define PROXY_PROTOTYPE_LIST \ X(Console, "Console", console_dispex, Object) \ X(Crypto, "Crypto", crypto_dispex, Object) \ + X(SubtleCrypto, "SubtleCrypto", crypto_subtle_dispex, Object) \ X(DOMParser, "DOMParser", DOMParser_dispex, Object) \ X(MutationObserver, "MutationObserver", mutation_observer_dispex, Object) \ X(DOMEvent, "Event", DOMEvent_dispex, Object) \ diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index 56e2ecec438..4327d191d5c 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -128,6 +128,46 @@ interface IWineMSHTMLCrypto : IDispatch HRESULT getRandomValues([in] VARIANT *typedArray, [retval, out] IDispatch **ret); } +[ + odl, + oleautomation, + dual, + hidden, + uuid(fd55b4b6-2813-4fb4-829d-380099474ab3) +] +interface IWineMSHTMLSubtleCrypto : IDispatch +{ + [id(1)] + HRESULT encrypt([in] VARIANT *algorithm, [in] VARIANT *key, [in] VARIANT *data, [retval, out] IDispatch **result); + [id(2)] + HRESULT decrypt([in] VARIANT *algorithm, [in] VARIANT *key, [in] VARIANT *data, [retval, out] IDispatch **result); + [id(3)] + HRESULT sign([in] VARIANT *algorithm, [in] VARIANT *key, [in] VARIANT *data, [retval, out] IDispatch **signature); + [id(4)] + HRESULT verify([in] VARIANT *algorithm, [in] VARIANT *key, [in] VARIANT *signature, [in] VARIANT *data, + [retval, out] IDispatch **result); + [id(5)] + HRESULT digest([in] VARIANT *algorithm, [in] VARIANT *data, [retval, out] IDispatch **digest); + [id(6)] + HRESULT generateKey([in] VARIANT *algorithm, VARIANT_BOOL extractable, [in] VARIANT *keyUsages, + [retval, out] IDispatch **result); + [id(7)] + HRESULT deriveKey([in] VARIANT *algorithm, [in] VARIANT *baseKey, [in] VARIANT *derivedKeyAlgorithm, + VARIANT_BOOL extractable, [in] VARIANT *keyUsages, [retval, out] IDispatch **result); + [id(8)] + HRESULT importKey([in] BSTR format, [in] VARIANT *keyData, [in] VARIANT *algorithm, VARIANT_BOOL extractable, + [in] VARIANT *keyUsages, [retval, out] IDispatch **result); + [id(9)] + HRESULT exportKey([in] BSTR format, [in] VARIANT *key, [retval, out] IDispatch **result); + [id(10)] + HRESULT wrapKey([in] BSTR format, [in] VARIANT *key, [in] VARIANT *wrappingKey, [in] VARIANT *wrapAlgo, + [retval, out] IDispatch **result); + [id(11)] + HRESULT unwrapKey([in] BSTR format, [in] VARIANT *wrappedKey, [in] VARIANT *unwrappingKey, + [in] VARIANT *unwrapAlgo, [in] VARIANT *unwrappedKeyAlgo, VARIANT_BOOL extractable, + [in] VARIANT *keyUsages, [retval, out] IDispatch **result); +} + const long DISPID_IWINEHTMLWINDOWPRIVATE_MSCRYPTO = 54; [ odl, diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 1bb40b02767..a4a3a1913ab 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -3410,9 +3410,241 @@ HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch return S_OK; } +struct crypto_subtle { + DispatchEx dispex; + IWineMSHTMLSubtleCrypto IWineMSHTMLSubtleCrypto_iface; +}; + +static inline struct crypto_subtle *impl_from_IWineMSHTMLSubtleCrypto(IWineMSHTMLSubtleCrypto *iface) +{ + return CONTAINING_RECORD(iface, struct crypto_subtle, IWineMSHTMLSubtleCrypto_iface); +} + +static HRESULT WINAPI crypto_subtle_QueryInterface(IWineMSHTMLSubtleCrypto *iface, REFIID riid, void **ppv) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_QueryInterface(&subtle->dispex.IDispatchEx_iface, riid, ppv); +} + +static ULONG WINAPI crypto_subtle_AddRef(IWineMSHTMLSubtleCrypto *iface) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_AddRef(&subtle->dispex.IDispatchEx_iface); +} + +static ULONG WINAPI crypto_subtle_Release(IWineMSHTMLSubtleCrypto *iface) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_Release(&subtle->dispex.IDispatchEx_iface); +} + +static HRESULT WINAPI crypto_subtle_GetTypeInfoCount(IWineMSHTMLSubtleCrypto *iface, UINT *pctinfo) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_GetTypeInfoCount(&subtle->dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI crypto_subtle_GetTypeInfo(IWineMSHTMLSubtleCrypto *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_GetTypeInfo(&subtle->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI crypto_subtle_GetIDsOfNames(IWineMSHTMLSubtleCrypto *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_GetIDsOfNames(&subtle->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI crypto_subtle_Invoke(IWineMSHTMLSubtleCrypto *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + return IDispatchEx_Invoke(&subtle->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI crypto_subtle_encrypt(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, VARIANT *key, + VARIANT *data, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %p %p %p)\n", subtle, algorithm, key, data, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_decrypt(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, VARIANT *key, + VARIANT *data, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %p %p %p)\n", subtle, algorithm, key, data, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_sign(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, VARIANT *key, + VARIANT *data, IDispatch **signature) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %p %p %p)\n", subtle, algorithm, key, data, signature); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_verify(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, VARIANT *key, + VARIANT *signature, VARIANT *data, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %p %p %p %p)\n", subtle, algorithm, key, signature, data, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_digest(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, VARIANT *data, + IDispatch **digest) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %p %p)\n", subtle, algorithm, data, digest); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_generateKey(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, + VARIANT_BOOL extractable, VARIANT *keyUsages, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %x %p %p)\n", subtle, algorithm, extractable, keyUsages, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_deriveKey(IWineMSHTMLSubtleCrypto *iface, VARIANT *algorithm, VARIANT *baseKey, + VARIANT *derivedKeyAlgorithm, VARIANT_BOOL extractable, VARIANT *keyUsages, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%p %p %p %x %p %p)\n", subtle, algorithm, baseKey, derivedKeyAlgorithm, extractable, + keyUsages, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_importKey(IWineMSHTMLSubtleCrypto *iface, BSTR format, VARIANT *keyData, + VARIANT *algorithm, VARIANT_BOOL extractable, VARIANT *keyUsages, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%s %p %p %x %p %p)\n", subtle, debugstr_w(format), keyData, algorithm, extractable, + keyUsages, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_exportKey(IWineMSHTMLSubtleCrypto *iface, BSTR format, VARIANT *key, + IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%s %p %p)\n", subtle, debugstr_w(format), key, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_wrapKey(IWineMSHTMLSubtleCrypto *iface, BSTR format, VARIANT *key, + VARIANT *wrappingKey, VARIANT *wrapAlgo, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%s %p %p %p %p)\n", subtle, debugstr_w(format), key, wrappingKey, wrapAlgo, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI crypto_subtle_unwrapKey(IWineMSHTMLSubtleCrypto *iface, BSTR format, VARIANT *wrappedKey, + VARIANT *unwrappingKey, VARIANT *unwrapAlgo, VARIANT *unwrappedKeyAlgo, VARIANT_BOOL extractable, + VARIANT *keyUsages, IDispatch **result) +{ + struct crypto_subtle *subtle = impl_from_IWineMSHTMLSubtleCrypto(iface); + + FIXME("(%p)->(%s %p %p %p %p %x %p %p)\n", subtle, debugstr_w(format), wrappedKey, unwrappingKey, unwrapAlgo, + unwrappedKeyAlgo, extractable, keyUsages, result); + + return E_NOTIMPL; +} + +static const IWineMSHTMLSubtleCryptoVtbl WineMSHTMLSubtleCryptoVtbl = { + crypto_subtle_QueryInterface, + crypto_subtle_AddRef, + crypto_subtle_Release, + crypto_subtle_GetTypeInfoCount, + crypto_subtle_GetTypeInfo, + crypto_subtle_GetIDsOfNames, + crypto_subtle_Invoke, + crypto_subtle_encrypt, + crypto_subtle_decrypt, + crypto_subtle_sign, + crypto_subtle_verify, + crypto_subtle_digest, + crypto_subtle_generateKey, + crypto_subtle_deriveKey, + crypto_subtle_importKey, + crypto_subtle_exportKey, + crypto_subtle_wrapKey, + crypto_subtle_unwrapKey +}; + +static inline struct crypto_subtle *crypto_subtle_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct crypto_subtle, dispex); +} + +static void *crypto_subtle_query_interface(DispatchEx *dispex, REFIID riid) +{ + struct crypto_subtle *subtle = crypto_subtle_from_DispatchEx(dispex); + + if(IsEqualGUID(&IID_IWineMSHTMLSubtleCrypto, riid)) + return &subtle->IWineMSHTMLSubtleCrypto_iface; + + return NULL; +} + +static void crypto_subtle_destructor(DispatchEx *dispex) +{ + struct crypto_subtle *subtle = crypto_subtle_from_DispatchEx(dispex); + free(subtle); +} + +static const dispex_static_data_vtbl_t crypto_subtle_dispex_vtbl = { + .query_interface = crypto_subtle_query_interface, + .destructor = crypto_subtle_destructor +}; + +static const tid_t crypto_subtle_iface_tids[] = { + IWineMSHTMLSubtleCrypto_tid, + 0 +}; +dispex_static_data_t crypto_subtle_dispex = { + "SubtleCrypto", + &crypto_subtle_dispex_vtbl, + PROTO_ID_SubtleCrypto, + IWineMSHTMLSubtleCrypto_tid, + crypto_subtle_iface_tids +}; + struct crypto { DispatchEx dispex; IWineMSHTMLCrypto IWineMSHTMLCrypto_iface; + struct crypto_subtle *subtle; }; static inline struct crypto *impl_from_IWineMSHTMLCrypto(IWineMSHTMLCrypto *iface) @@ -3478,9 +3710,11 @@ static HRESULT WINAPI crypto_get_subtle(IWineMSHTMLCrypto *iface, IDispatch **su { struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); - FIXME("(%p)->(%p)\n", crypto, subtle); + TRACE("(%p)->(%p)\n", crypto, subtle); - return E_NOTIMPL; + *subtle = (IDispatch*)&crypto->subtle->dispex.IDispatchEx_iface; + IWineMSHTMLSubtleCrypto_AddRef(&crypto->subtle->IWineMSHTMLSubtleCrypto_iface); + return S_OK; } static HRESULT WINAPI crypto_getRandomValues(IWineMSHTMLCrypto *iface, VARIANT *typedArray, IDispatch **ret) @@ -3519,6 +3753,25 @@ static void *crypto_query_interface(DispatchEx *dispex, REFIID riid) return NULL; } +static void crypto_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb) +{ + struct crypto *This = crypto_from_DispatchEx(dispex); + + if(This->subtle) + note_cc_edge((nsISupports*)&This->subtle->dispex.IDispatchEx_iface, "subtle", cb); +} + +static void crypto_unlink(DispatchEx *dispex) +{ + struct crypto *This = crypto_from_DispatchEx(dispex); + + if(This->subtle) { + struct crypto_subtle *subtle = This->subtle; + This->subtle = NULL; + IDispatchEx_Release(&subtle->dispex.IDispatchEx_iface); + } +} + static void crypto_destructor(DispatchEx *dispex) { struct crypto *This = crypto_from_DispatchEx(dispex); @@ -3528,6 +3781,8 @@ static void crypto_destructor(DispatchEx *dispex) static const dispex_static_data_vtbl_t crypto_dispex_vtbl = { .query_interface = crypto_query_interface, .destructor = crypto_destructor, + .traverse = crypto_traverse, + .unlink = crypto_unlink }; static const tid_t crypto_iface_tids[] = { @@ -3544,15 +3799,22 @@ dispex_static_data_t crypto_dispex = { void create_crypto(HTMLInnerWindow *window, IWineMSHTMLCrypto **ret) { + compat_mode_t compat_mode = dispex_compat_mode(&window->event_target.dispex); + struct crypto_subtle *subtle; struct crypto *obj; - if(!(obj = calloc(1, sizeof(*obj)))) { + if(!(obj = calloc(1, sizeof(*obj))) || !(subtle = calloc(1, sizeof(*subtle)))) { ERR("No memory.\n"); + free(obj); return; } obj->IWineMSHTMLCrypto_iface.lpVtbl = &WineMSHTMLCryptoVtbl; - init_dispatch(&obj->dispex, &crypto_dispex, window, dispex_compat_mode(&window->event_target.dispex)); + obj->subtle = subtle; + init_dispatch(&obj->dispex, &crypto_dispex, window, compat_mode); + + subtle->IWineMSHTMLSubtleCrypto_iface.lpVtbl = &WineMSHTMLSubtleCryptoVtbl; + init_dispatch(&subtle->dispex, &crypto_subtle_dispex, window, compat_mode); *ret = &obj->IWineMSHTMLCrypto_iface; } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index b6ad7d95d27..5670c3c3cf1 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -375,6 +375,7 @@ sync_test("builtin_toString", function() { } if(v >= 11) { test("crypto", window.msCrypto, "Crypto"); + test("crypto.subtle", window.msCrypto.subtle, "SubtleCrypto"); test("MutationObserver", new window.MutationObserver(function() {}), "MutationObserver", null, "Function"); } if(v >= 9) { @@ -873,6 +874,7 @@ sync_test("builtin_prototypes", function() { } if(v >= 11) { set_obj("Crypto"); + set_obj("SubtleCrypto"); } if(v >= 8 && v < 11) { @@ -1144,6 +1146,7 @@ sync_test("builtin_prototypes", function() { [ "StorageEvent", "Event" ], [ "StyleSheet", "Object" ], [ "StyleSheetList", "Object" ], + [ "SubtleCrypto", "Object" ], [ "Text", "CharacterData" ], [ "TextRange", "Object" ], [ "UIEvent", "Event" ], @@ -4173,6 +4176,11 @@ sync_test("Crypto", function() { ok("subtle" in crypto, "subtle not in crypto"); ok("getRandomValues" in crypto, "getRandomValues not in crypto"); ok(!("randomUUID" in crypto), "randomUUID is in crypto"); + + var list = [ "decrypt", "deriveKey", "digest", "encrypt", "exportKey", "generateKey", "importKey", "sign", "unwrapKey", "verify", "wrapKey" ]; + for(var i = 0; i < list.length; i++) + ok(list[i] in crypto.subtle, list[i] + " not in crypto.subtle"); + ok(!("deriveBits" in crypto.subtle), "deriveBits is in crypto.subtle"); }); sync_test("MutationObserver", function() { From e57287819f3f164823dd5eace0f451725d259450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1016/1506] mshtml: Implement window.msCrypto.getRandomValues. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 36 ++++++++++++++- dlls/jscript/dispex.c | 1 + dlls/jscript/jscript.h | 3 ++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/omnavigator.c | 19 +++++++- dlls/mshtml/tests/documentmode.js | 74 ++++++++++++++++++++++++++++++- 6 files changed, 130 insertions(+), 4 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index 75ce3d4125c..c4ecee88350 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -20,7 +20,14 @@ #include #include #include - +#include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "ntsecapi.h" #include "jscript.h" #include "wine/debug.h" @@ -1288,6 +1295,33 @@ static const builtin_info_t TypedArrayConstr_info = { NULL }; +HRESULT WINAPI WineDispatchProxyCbPrivate_GetRandomValues(IDispatch *disp) +{ + jsdisp_t *obj = to_jsdisp(disp); + TypedArrayInstance *typedarr; + DWORD size; + + if(!obj || obj->builtin_info->class < FIRST_TYPEDARRAY_JSCLASS || obj->builtin_info->class > LAST_TYPEDARRAY_JSCLASS) + return E_INVALIDARG; + + if(obj->builtin_info->class == JSCLASS_FLOAT32ARRAY || obj->builtin_info->class == JSCLASS_FLOAT64ARRAY) { + /* FIXME: Return TypeMismatchError */ + return E_FAIL; + } + + typedarr = typedarr_from_jsdisp(obj); + size = typedarr->length * TypedArray_elem_size[TYPEDARRAY_INDEX(obj->builtin_info->class)]; + if(size > 65536) { + /* FIXME: Return QuotaExceededError */ + return E_FAIL; + } + + if(!RtlGenRandom(&arraybuf_from_jsdisp(typedarr->buffer)->buf[typedarr->offset], size)) + return HRESULT_FROM_WIN32(GetLastError()); + + return S_OK; +} + HRESULT init_arraybuf_constructors(script_ctx_t *ctx) { static const struct { diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 98968f9f457..dc287728311 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2808,6 +2808,7 @@ static IWineDispatchProxyCbPrivateVtbl WineDispatchProxyCbPrivateVtbl = { WineDispatchProxyCbPrivate_HostUpdated, WineDispatchProxyCbPrivate_CreateConstructor, WineDispatchProxyCbPrivate_DefineConstructor, + WineDispatchProxyCbPrivate_GetRandomValues, WineDispatchProxyCbPrivate_PropEnum }; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 24fee36095c..e190019a06c 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -126,6 +126,7 @@ typedef struct { HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); + HRESULT (STDMETHODCALLTYPE *GetRandomValues)(IDispatch *typedarr); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; @@ -745,3 +746,5 @@ static inline void unlock_module(void) { InterlockedDecrement(&module_ref); } + +HRESULT WINAPI WineDispatchProxyCbPrivate_GetRandomValues(IDispatch*); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 39409423634..8c9cd5b40fb 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -117,6 +117,7 @@ typedef struct { HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); + HRESULT (STDMETHODCALLTYPE *GetRandomValues)(IDispatch *typedarr); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index a4a3a1913ab..cc22592f216 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -3720,10 +3720,25 @@ static HRESULT WINAPI crypto_get_subtle(IWineMSHTMLCrypto *iface, IDispatch **su static HRESULT WINAPI crypto_getRandomValues(IWineMSHTMLCrypto *iface, VARIANT *typedArray, IDispatch **ret) { struct crypto *crypto = impl_from_IWineMSHTMLCrypto(iface); + IWineDispatchProxyCbPrivate *proxy; + HRESULT hres; - FIXME("(%p)->(%p %p)\n", crypto, typedArray, ret); + TRACE("(%p)->(%p %p)\n", crypto, typedArray, ret); - return E_NOTIMPL; + if(V_VT(typedArray) != VT_DISPATCH || !V_DISPATCH(typedArray)) + return E_INVALIDARG; + + if(!(proxy = crypto->dispex.proxy)) { + FIXME("No proxy\n"); + return E_NOTIMPL; + } + + hres = proxy->lpVtbl->GetRandomValues(V_DISPATCH(typedArray)); + if(SUCCEEDED(hres) && ret) { + *ret = V_DISPATCH(typedArray); + IDispatch_AddRef(*ret); + } + return hres; } static const IWineMSHTMLCryptoVtbl WineMSHTMLCryptoVtbl = { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 5670c3c3cf1..5250003a0ce 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -4166,7 +4166,7 @@ sync_test("__defineSetter__", function() { }); sync_test("Crypto", function() { - var crypto = window.msCrypto, r; + var crypto = window.msCrypto, arr, r; if(!crypto) return; ok(Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(window), "msCrypto"), "msCrypto not a property of window's prototype."); @@ -4181,6 +4181,78 @@ sync_test("Crypto", function() { for(var i = 0; i < list.length; i++) ok(list[i] in crypto.subtle, list[i] + " not in crypto.subtle"); ok(!("deriveBits" in crypto.subtle), "deriveBits is in crypto.subtle"); + + list = [ + [ "Int8Array", 65536 ], + [ "Uint8Array", 65536 ], + [ "Int16Array", 32768 ], + [ "Uint16Array", 32768 ], + [ "Int32Array", 16384 ], + [ "Uint32Array", 16384 ] + ]; + for(var i = 0; i < list.length; i++) { + var arrType = list[i][0]; + arr = eval(arrType + "(" + list[i][1] + ")"); + + ok(arr[0] === 0, arrType + "[0] = " + arr[0]); + ok(arr[1] === 0, arrType + "[1] = " + arr[1]); + r = crypto.getRandomValues(arr); + ok(r === arr, "getRandomValues returned " + r); + + arr = eval(arrType + "(" + (list[i][1]+1) + ")"); + try { + crypto.getRandomValues(arr); + }catch(ex) { + var n = ex.number >>> 0; + todo_wine. + ok(ex.name === "QuotaExceededError", "getRandomValues(oversized " + arrType + ") threw " + ex.name); + todo_wine. + ok(n === 0, "getRandomValues(oversized " + arrType + ") threw code " + n); + todo_wine. + ok(ex.message === "QuotaExceededError", "getRandomValues(oversized " + arrType + ") threw message " + ex.message); + } + } + + try { + crypto.getRandomValues(null); + ok(false, "getRandomValues(null) did not throw exception"); + }catch(e) { + ok(e.number === 0x70057 - 0x80000000, "getRandomValues(null) threw " + e.number); + } + try { + crypto.getRandomValues(external.nullDisp); + ok(false, "getRandomValues(nullDisp) did not throw exception"); + }catch(e) { + ok(e.number === 0x70057 - 0x80000000, "getRandomValues(nullDisp) threw " + e.number); + } + try { + crypto.getRandomValues([1,2,3]); + ok(false, "getRandomValues([1,2,3]) did not throw exception"); + }catch(e) { + ok(e.number === 0x70057 - 0x80000000, "getRandomValues([1,2,3]) threw " + e.number); + } + arr = Float32Array(2); + try { + crypto.getRandomValues(arr); + ok(false, "getRandomValues(Float32Array) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + todo_wine. + ok(ex.name === "TypeMismatchError", "getRandomValues(Float32Array) threw " + ex.name); + todo_wine. + ok(n === 0, "getRandomValues(Float32Array) threw code " + n); + } + arr = Float64Array(2); + try { + crypto.getRandomValues(arr); + ok(false, "getRandomValues(Float64Array) did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + todo_wine. + ok(ex.name === "TypeMismatchError", "getRandomValues(Float64Array) threw " + ex.name); + todo_wine. + ok(n === 0, "getRandomValues(Float64Array) threw code " + n); + } }); sync_test("MutationObserver", function() { From 644e1d70c6ac9a143b1c83a3a914d2335e6ff442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1017/1506] mshtml: Add private stub interfaces for validating form/input elements. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlform.c | 128 +++++- dlls/mshtml/htmlinput.c | 583 ++++++++++++++++++++++++++- dlls/mshtml/htmlobject.c | 141 ++++++- dlls/mshtml/htmlselect.c | 136 ++++++- dlls/mshtml/htmltextarea.c | 136 ++++++- dlls/mshtml/mshtml_private.h | 3 + dlls/mshtml/mshtml_private_iface.idl | 80 ++++ dlls/mshtml/tests/documentmode.js | 80 ++++ 8 files changed, 1281 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index fcc0e78eca6..dbd529d4305 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -37,6 +37,7 @@ struct HTMLFormElement { HTMLElement element; IHTMLFormElement IHTMLFormElement_iface; + IWineHTMLFormPrivate IWineHTMLFormPrivate_iface; nsIDOMHTMLFormElement *nsform; }; @@ -769,6 +770,115 @@ static const IHTMLFormElementVtbl HTMLFormElementVtbl = { HTMLFormElement_tags }; +static inline HTMLFormElement *impl_from_IWineHTMLFormPrivateVtbl(IWineHTMLFormPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLFormElement, IWineHTMLFormPrivate_iface); +} + +static HRESULT WINAPI HTMLFormElement_private_QueryInterface(IWineHTMLFormPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLFormElement_private_AddRef(IWineHTMLFormPrivate *iface) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLFormElement_private_Release(IWineHTMLFormPrivate *iface) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLFormElement_private_GetTypeInfoCount(IWineHTMLFormPrivate *iface, UINT *pctinfo) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLFormElement_private_GetTypeInfo(IWineHTMLFormPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLFormElement_private_GetIDsOfNames(IWineHTMLFormPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLFormElement_private_Invoke(IWineHTMLFormPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLFormElement_private_put_enctype(IWineHTMLFormPrivate *iface, BSTR v) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLFormElement_private_get_enctype(IWineHTMLFormPrivate *iface, BSTR *ret) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLFormElement_private_put_noValidate(IWineHTMLFormPrivate *iface, VARIANT_BOOL v) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLFormElement_private_get_noValidate(IWineHTMLFormPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLFormElement_private_checkValidity(IWineHTMLFormPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLFormPrivateVtbl WineHTMLFormPrivateVtbl = { + HTMLFormElement_private_QueryInterface, + HTMLFormElement_private_AddRef, + HTMLFormElement_private_Release, + HTMLFormElement_private_GetTypeInfoCount, + HTMLFormElement_private_GetTypeInfo, + HTMLFormElement_private_GetIDsOfNames, + HTMLFormElement_private_Invoke, + HTMLFormElement_private_put_enctype, + HTMLFormElement_private_get_enctype, + HTMLFormElement_private_put_noValidate, + HTMLFormElement_private_get_noValidate, + HTMLFormElement_private_checkValidity, +}; + static inline HTMLFormElement *impl_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, HTMLFormElement, element.node.event_target.dispex); @@ -782,6 +892,8 @@ static void *HTMLFormElement_query_interface(DispatchEx *dispex, REFIID riid) return &This->IHTMLFormElement_iface; if(IsEqualGUID(&DIID_DispHTMLFormElement, riid)) return &This->IHTMLFormElement_iface; + if(IsEqualGUID(&IID_IWineHTMLFormPrivate, riid)) + return &This->IWineHTMLFormPrivate_iface; return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -985,13 +1097,26 @@ static const tid_t HTMLFormElement_iface_tids[] = { 0 }; +static void HTMLFormElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t form_private_ie9_hooks[] = { + {DISPID_IWINEHTMLFORMPRIVATE_NOVALIDATE}, + {DISPID_IWINEHTMLFORMPRIVATE_CHECKVALIDITY}, + {DISPID_UNKNOWN} + }; + HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE9) + dispex_info_add_interface(info, IWineHTMLFormPrivate_tid, mode < COMPAT_MODE_IE10 ? form_private_ie9_hooks : NULL); +} + dispex_static_data_t HTMLFormElement_dispex = { "HTMLFormElement", &HTMLFormElement_event_target_vtbl.dispex_vtbl, PROTO_ID_HTMLFormElement, DispHTMLFormElement_tid, HTMLFormElement_iface_tids, - HTMLElement_init_dispex_info + HTMLFormElement_init_dispex_info }; HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1004,6 +1129,7 @@ HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM return E_OUTOFMEMORY; ret->IHTMLFormElement_iface.lpVtbl = &HTMLFormElementVtbl; + ret->IWineHTMLFormPrivate_iface.lpVtbl = &WineHTMLFormPrivateVtbl; ret->element.node.vtbl = &HTMLFormElementImplVtbl; HTMLElement_Init(&ret->element, doc, nselem, &HTMLFormElement_dispex); diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 51c6ed956fc..82cea2e96f4 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -39,6 +39,8 @@ struct HTMLInputElement { IHTMLInputElement IHTMLInputElement_iface; IHTMLInputTextElement IHTMLInputTextElement_iface; IHTMLInputTextElement2 IHTMLInputTextElement2_iface; + IWineHTMLInputPrivate IWineHTMLInputPrivate_iface; + IWineHTMLParentFormPrivate IWineHTMLParentFormPrivate_iface; nsIDOMHTMLInputElement *nsinput; }; @@ -1339,6 +1341,277 @@ static const IHTMLInputTextElement2Vtbl HTMLInputTextElement2Vtbl = { HTMLInputTextElement2_setSelectionRange }; +static inline HTMLInputElement *impl_from_IWineHTMLInputPrivateVtbl(IWineHTMLInputPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLInputElement, IWineHTMLInputPrivate_iface); +} + +static HRESULT WINAPI HTMLInputElement_private_QueryInterface(IWineHTMLInputPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLInputElement_private_AddRef(IWineHTMLInputPrivate *iface) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLInputElement_private_Release(IWineHTMLInputPrivate *iface) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLInputElement_private_GetTypeInfoCount(IWineHTMLInputPrivate *iface, UINT *pctinfo) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLInputElement_private_GetTypeInfo(IWineHTMLInputPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLInputElement_private_GetIDsOfNames(IWineHTMLInputPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLInputElement_private_Invoke(IWineHTMLInputPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLInputElement_private_put_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL v) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_private_get_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_private_get_validationMessage(IWineHTMLInputPrivate *iface, BSTR *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_private_get_validity(IWineHTMLInputPrivate *iface, IDispatch **ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_private_get_willValidate(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_private_setCustomValidity(IWineHTMLInputPrivate *iface, VARIANT *message) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(message)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_private_checkValidity(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLInputPrivateVtbl WineHTMLInputPrivateVtbl = { + HTMLInputElement_private_QueryInterface, + HTMLInputElement_private_AddRef, + HTMLInputElement_private_Release, + HTMLInputElement_private_GetTypeInfoCount, + HTMLInputElement_private_GetTypeInfo, + HTMLInputElement_private_GetIDsOfNames, + HTMLInputElement_private_Invoke, + HTMLInputElement_private_put_autofocus, + HTMLInputElement_private_get_autofocus, + HTMLInputElement_private_get_validationMessage, + HTMLInputElement_private_get_validity, + HTMLInputElement_private_get_willValidate, + HTMLInputElement_private_setCustomValidity, + HTMLInputElement_private_checkValidity +}; + +static inline HTMLInputElement *impl_from_IWineHTMLParentFormPrivateVtbl(IWineHTMLParentFormPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLInputElement, IWineHTMLParentFormPrivate_iface); +} + +static HRESULT WINAPI HTMLInputElement_form_private_QueryInterface(IWineHTMLParentFormPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLInputElement_form_private_AddRef(IWineHTMLParentFormPrivate *iface) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLInputElement_form_private_Release(IWineHTMLParentFormPrivate *iface) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLInputElement_form_private_GetTypeInfoCount(IWineHTMLParentFormPrivate *iface, UINT *pctinfo) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLInputElement_form_private_GetTypeInfo(IWineHTMLParentFormPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLInputElement_form_private_GetIDsOfNames(IWineHTMLParentFormPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLInputElement_form_private_Invoke(IWineHTMLParentFormPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLInputElement_form_private_put_formAction(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_get_formAction(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_put_formEnctype(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_get_formEnctype(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_put_formMethod(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_get_formMethod(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_put_formNoValidate(IWineHTMLParentFormPrivate *iface, VARIANT_BOOL v) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_get_formNoValidate(IWineHTMLParentFormPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_put_formTarget(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLInputElement_form_private_get_formTarget(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLInputElement *This = impl_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLParentFormPrivateVtbl WineHTMLParentFormPrivateVtbl = { + HTMLInputElement_form_private_QueryInterface, + HTMLInputElement_form_private_AddRef, + HTMLInputElement_form_private_Release, + HTMLInputElement_form_private_GetTypeInfoCount, + HTMLInputElement_form_private_GetTypeInfo, + HTMLInputElement_form_private_GetIDsOfNames, + HTMLInputElement_form_private_Invoke, + HTMLInputElement_form_private_put_formAction, + HTMLInputElement_form_private_get_formAction, + HTMLInputElement_form_private_put_formEnctype, + HTMLInputElement_form_private_get_formEnctype, + HTMLInputElement_form_private_put_formMethod, + HTMLInputElement_form_private_get_formMethod, + HTMLInputElement_form_private_put_formNoValidate, + HTMLInputElement_form_private_get_formNoValidate, + HTMLInputElement_form_private_put_formTarget, + HTMLInputElement_form_private_get_formTarget +}; + static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLInputElement, element.node); @@ -1390,6 +1663,10 @@ static void *HTMLInputElement_query_interface(DispatchEx *dispex, REFIID riid) return &This->IHTMLInputTextElement_iface; if(IsEqualGUID(&IID_IHTMLInputTextElement2, riid)) return &This->IHTMLInputTextElement2_iface; + if(IsEqualGUID(&IID_IWineHTMLInputPrivate, riid)) + return &This->IWineHTMLInputPrivate_iface; + if(IsEqualGUID(&IID_IWineHTMLParentFormPrivate, riid)) + return &This->IWineHTMLParentFormPrivate_iface; return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -1438,13 +1715,24 @@ static const tid_t HTMLInputElement_iface_tids[] = { IHTMLInputTextElement2_tid, 0 }; + +static void HTMLInputElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE10) { + dispex_info_add_interface(info, IWineHTMLInputPrivate_tid, NULL); + dispex_info_add_interface(info, IWineHTMLParentFormPrivate_tid, NULL); + } +} + dispex_static_data_t HTMLInputElement_dispex = { "HTMLInputElement", &HTMLInputElement_event_target_vtbl.dispex_vtbl, PROTO_ID_HTMLInputElement, DispHTMLInputElement_tid, HTMLInputElement_iface_tids, - HTMLElement_init_dispex_info + HTMLInputElement_init_dispex_info }; HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1459,6 +1747,8 @@ HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl; ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl; ret->IHTMLInputTextElement2_iface.lpVtbl = &HTMLInputTextElement2Vtbl; + ret->IWineHTMLInputPrivate_iface.lpVtbl = &WineHTMLInputPrivateVtbl; + ret->IWineHTMLParentFormPrivate_iface.lpVtbl = &WineHTMLParentFormPrivateVtbl; ret->element.node.vtbl = &HTMLInputElementImplVtbl; HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex); @@ -1664,6 +1954,8 @@ struct HTMLButtonElement { HTMLElement element; IHTMLButtonElement IHTMLButtonElement_iface; + IWineHTMLInputPrivate IWineHTMLInputPrivate_iface; + IWineHTMLParentFormPrivate IWineHTMLParentFormPrivate_iface; nsIDOMHTMLButtonElement *nsbutton; }; @@ -1894,6 +2186,277 @@ static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = { HTMLButtonElement_createTextRange }; +static inline HTMLButtonElement *button_from_IWineHTMLInputPrivateVtbl(IWineHTMLInputPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLButtonElement, IWineHTMLInputPrivate_iface); +} + +static HRESULT WINAPI HTMLButtonElement_private_QueryInterface(IWineHTMLInputPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLButtonElement_private_AddRef(IWineHTMLInputPrivate *iface) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLButtonElement_private_Release(IWineHTMLInputPrivate *iface) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLButtonElement_private_GetTypeInfoCount(IWineHTMLInputPrivate *iface, UINT *pctinfo) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLButtonElement_private_GetTypeInfo(IWineHTMLInputPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLButtonElement_private_GetIDsOfNames(IWineHTMLInputPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLButtonElement_private_Invoke(IWineHTMLInputPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLButtonElement_private_put_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL v) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_private_get_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_private_get_validationMessage(IWineHTMLInputPrivate *iface, BSTR *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_private_get_validity(IWineHTMLInputPrivate *iface, IDispatch **ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_private_get_willValidate(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_private_setCustomValidity(IWineHTMLInputPrivate *iface, VARIANT *message) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(message)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_private_checkValidity(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLInputPrivateVtbl WineHTMLButtonInputPrivateVtbl = { + HTMLButtonElement_private_QueryInterface, + HTMLButtonElement_private_AddRef, + HTMLButtonElement_private_Release, + HTMLButtonElement_private_GetTypeInfoCount, + HTMLButtonElement_private_GetTypeInfo, + HTMLButtonElement_private_GetIDsOfNames, + HTMLButtonElement_private_Invoke, + HTMLButtonElement_private_put_autofocus, + HTMLButtonElement_private_get_autofocus, + HTMLButtonElement_private_get_validationMessage, + HTMLButtonElement_private_get_validity, + HTMLButtonElement_private_get_willValidate, + HTMLButtonElement_private_setCustomValidity, + HTMLButtonElement_private_checkValidity +}; + +static inline HTMLButtonElement *button_from_IWineHTMLParentFormPrivateVtbl(IWineHTMLParentFormPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLButtonElement, IWineHTMLParentFormPrivate_iface); +} + +static HRESULT WINAPI HTMLButtonElement_form_private_QueryInterface(IWineHTMLParentFormPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLButtonElement_form_private_AddRef(IWineHTMLParentFormPrivate *iface) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLButtonElement_form_private_Release(IWineHTMLParentFormPrivate *iface) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLButtonElement_form_private_GetTypeInfoCount(IWineHTMLParentFormPrivate *iface, UINT *pctinfo) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLButtonElement_form_private_GetTypeInfo(IWineHTMLParentFormPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLButtonElement_form_private_GetIDsOfNames(IWineHTMLParentFormPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLButtonElement_form_private_Invoke(IWineHTMLParentFormPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLButtonElement_form_private_put_formAction(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_get_formAction(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_put_formEnctype(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_get_formEnctype(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_put_formMethod(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_get_formMethod(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_put_formNoValidate(IWineHTMLParentFormPrivate *iface, VARIANT_BOOL v) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_get_formNoValidate(IWineHTMLParentFormPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_put_formTarget(IWineHTMLParentFormPrivate *iface, BSTR v) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLButtonElement_form_private_get_formTarget(IWineHTMLParentFormPrivate *iface, BSTR *ret) +{ + HTMLButtonElement *This = button_from_IWineHTMLParentFormPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLParentFormPrivateVtbl WineHTMLButtonParentFormPrivateVtbl = { + HTMLButtonElement_form_private_QueryInterface, + HTMLButtonElement_form_private_AddRef, + HTMLButtonElement_form_private_Release, + HTMLButtonElement_form_private_GetTypeInfoCount, + HTMLButtonElement_form_private_GetTypeInfo, + HTMLButtonElement_form_private_GetIDsOfNames, + HTMLButtonElement_form_private_Invoke, + HTMLButtonElement_form_private_put_formAction, + HTMLButtonElement_form_private_get_formAction, + HTMLButtonElement_form_private_put_formEnctype, + HTMLButtonElement_form_private_get_formEnctype, + HTMLButtonElement_form_private_put_formMethod, + HTMLButtonElement_form_private_get_formMethod, + HTMLButtonElement_form_private_put_formNoValidate, + HTMLButtonElement_form_private_get_formNoValidate, + HTMLButtonElement_form_private_put_formTarget, + HTMLButtonElement_form_private_get_formTarget +}; + static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLButtonElement, element.node); @@ -1927,6 +2490,10 @@ static void *HTMLButtonElement_query_interface(DispatchEx *dispex, REFIID riid) if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) return &This->IHTMLButtonElement_iface; + if(IsEqualGUID(&IID_IWineHTMLInputPrivate, riid)) + return &This->IWineHTMLInputPrivate_iface; + if(IsEqualGUID(&IID_IWineHTMLParentFormPrivate, riid)) + return &This->IWineHTMLParentFormPrivate_iface; return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -1975,13 +2542,23 @@ static const tid_t HTMLButtonElement_iface_tids[] = { 0 }; +static void HTMLButtonElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE10) { + dispex_info_add_interface(info, IWineHTMLInputPrivate_tid, NULL); + dispex_info_add_interface(info, IWineHTMLParentFormPrivate_tid, NULL); + } +} + dispex_static_data_t HTMLButtonElement_dispex = { "HTMLButtonElement", &HTMLButtonElement_event_target_vtbl.dispex_vtbl, PROTO_ID_HTMLButtonElement, DispHTMLButtonElement_tid, HTMLButtonElement_iface_tids, - HTMLElement_init_dispex_info + HTMLButtonElement_init_dispex_info }; HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1994,6 +2571,8 @@ HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H return E_OUTOFMEMORY; ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl; + ret->IWineHTMLInputPrivate_iface.lpVtbl = &WineHTMLButtonInputPrivateVtbl; + ret->IWineHTMLParentFormPrivate_iface.lpVtbl = &WineHTMLButtonParentFormPrivateVtbl; ret->element.node.vtbl = &HTMLButtonElementImplVtbl; HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex); diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index ad08d5fb67c..c292aef1a9e 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -39,6 +39,7 @@ struct HTMLObjectElement { IHTMLObjectElement IHTMLObjectElement_iface; IHTMLObjectElement2 IHTMLObjectElement2_iface; + IWineHTMLInputPrivate IWineHTMLInputPrivate_iface; nsIDOMHTMLObjectElement *nsobject; }; @@ -632,6 +633,128 @@ static const IHTMLObjectElement2Vtbl HTMLObjectElement2Vtbl = { HTMLObjectElement2_get_data }; +static inline HTMLObjectElement *impl_from_IWineHTMLInputPrivateVtbl(IWineHTMLInputPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLObjectElement, IWineHTMLInputPrivate_iface); +} + +static HRESULT WINAPI HTMLObjectElement_input_private_QueryInterface(IWineHTMLInputPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLObjectElement_input_private_AddRef(IWineHTMLInputPrivate *iface) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_AddRef(&This->plugin_container.element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLObjectElement_input_private_Release(IWineHTMLInputPrivate *iface) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_Release(&This->plugin_container.element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLObjectElement_input_private_GetTypeInfoCount(IWineHTMLInputPrivate *iface, UINT *pctinfo) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLObjectElement_input_private_GetTypeInfo(IWineHTMLInputPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLObjectElement_input_private_GetIDsOfNames(IWineHTMLInputPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface, riid, + rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLObjectElement_input_private_Invoke(IWineHTMLInputPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->plugin_container.element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, + riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLObjectElement_input_private_put_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL v) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + WARN("(%p)->(%x)\n", This, v); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLObjectElement_input_private_get_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + WARN("(%p)->(%p)\n", This, ret); + return E_UNEXPECTED; +} + +static HRESULT WINAPI HTMLObjectElement_input_private_get_validationMessage(IWineHTMLInputPrivate *iface, BSTR *ret) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_input_private_get_validity(IWineHTMLInputPrivate *iface, IDispatch **ret) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_input_private_get_willValidate(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_input_private_setCustomValidity(IWineHTMLInputPrivate *iface, VARIANT *message) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(message)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLObjectElement_input_private_checkValidity(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLObjectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLInputPrivateVtbl WineHTMLInputPrivateVtbl = { + HTMLObjectElement_input_private_QueryInterface, + HTMLObjectElement_input_private_AddRef, + HTMLObjectElement_input_private_Release, + HTMLObjectElement_input_private_GetTypeInfoCount, + HTMLObjectElement_input_private_GetTypeInfo, + HTMLObjectElement_input_private_GetIDsOfNames, + HTMLObjectElement_input_private_Invoke, + HTMLObjectElement_input_private_put_autofocus, + HTMLObjectElement_input_private_get_autofocus, + HTMLObjectElement_input_private_get_validationMessage, + HTMLObjectElement_input_private_get_validity, + HTMLObjectElement_input_private_get_willValidate, + HTMLObjectElement_input_private_setCustomValidity, + HTMLObjectElement_input_private_checkValidity +}; + static inline HTMLObjectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLObjectElement, plugin_container.element.node); @@ -658,6 +781,8 @@ static void *HTMLObjectElement_query_interface(DispatchEx *dispex, REFIID riid) return &This->IHTMLObjectElement_iface; if(IsEqualGUID(&IID_IHTMLObjectElement2, riid)) return &This->IHTMLObjectElement2_iface; + if(IsEqualGUID(&IID_IWineHTMLInputPrivate, riid)) + return &This->IWineHTMLInputPrivate_iface; if(IsEqualGUID(&IID_HTMLPluginContainer, riid)) { /* Special pseudo-interface returning HTMLPluginContainer struct. */ return &This->plugin_container; @@ -767,13 +892,26 @@ static const tid_t HTMLObjectElement_iface_tids[] = { HTMLELEMENT_TIDS, 0 }; + +static void HTMLObjectElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t input_private_hooks[] = { + {DISPID_IWINEHTMLINPUTPRIVATE_AUTOFOCUS}, + {DISPID_UNKNOWN} + }; + HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IWineHTMLInputPrivate_tid, input_private_hooks); +} + dispex_static_data_t HTMLObjectElement_dispex = { "HTMLObjectElement", &HTMLObjectElement_event_target_vtbl.dispex_vtbl, PROTO_ID_HTMLObjectElement, DispHTMLObjectElement_tid, HTMLObjectElement_iface_tids, - HTMLElement_init_dispex_info + HTMLObjectElement_init_dispex_info }; HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -787,6 +925,7 @@ HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H ret->IHTMLObjectElement_iface.lpVtbl = &HTMLObjectElementVtbl; ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl; + ret->IWineHTMLInputPrivate_iface.lpVtbl = &WineHTMLInputPrivateVtbl; ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl; HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex); diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 36d69a50367..969e170ef84 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -639,6 +639,7 @@ struct HTMLSelectElement { HTMLElement element; IHTMLSelectElement IHTMLSelectElement_iface; + IWineHTMLInputPrivate IWineHTMLInputPrivate_iface; nsIDOMHTMLSelectElement *nsselect; }; @@ -1306,6 +1307,128 @@ static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = { HTMLSelectElement_tags }; +static inline HTMLSelectElement *impl_from_IWineHTMLInputPrivateVtbl(IWineHTMLInputPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLSelectElement, IWineHTMLInputPrivate_iface); +} + +static HRESULT WINAPI HTMLSelectElement_input_private_QueryInterface(IWineHTMLInputPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLSelectElement_input_private_AddRef(IWineHTMLInputPrivate *iface) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLSelectElement_input_private_Release(IWineHTMLInputPrivate *iface) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLSelectElement_input_private_GetTypeInfoCount(IWineHTMLInputPrivate *iface, UINT *pctinfo) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLSelectElement_input_private_GetTypeInfo(IWineHTMLInputPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLSelectElement_input_private_GetIDsOfNames(IWineHTMLInputPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLSelectElement_input_private_Invoke(IWineHTMLInputPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLSelectElement_input_private_put_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL v) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLSelectElement_input_private_get_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLSelectElement_input_private_get_validationMessage(IWineHTMLInputPrivate *iface, BSTR *ret) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLSelectElement_input_private_get_validity(IWineHTMLInputPrivate *iface, IDispatch **ret) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLSelectElement_input_private_get_willValidate(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLSelectElement_input_private_setCustomValidity(IWineHTMLInputPrivate *iface, VARIANT *message) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(message)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLSelectElement_input_private_checkValidity(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLSelectElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLInputPrivateVtbl WineHTMLInputPrivateVtbl = { + HTMLSelectElement_input_private_QueryInterface, + HTMLSelectElement_input_private_AddRef, + HTMLSelectElement_input_private_Release, + HTMLSelectElement_input_private_GetTypeInfoCount, + HTMLSelectElement_input_private_GetTypeInfo, + HTMLSelectElement_input_private_GetIDsOfNames, + HTMLSelectElement_input_private_Invoke, + HTMLSelectElement_input_private_put_autofocus, + HTMLSelectElement_input_private_get_autofocus, + HTMLSelectElement_input_private_get_validationMessage, + HTMLSelectElement_input_private_get_validity, + HTMLSelectElement_input_private_get_willValidate, + HTMLSelectElement_input_private_setCustomValidity, + HTMLSelectElement_input_private_checkValidity +}; + static inline HTMLSelectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLSelectElement, element.node); @@ -1334,6 +1457,8 @@ static void *HTMLSelectElement_query_interface(DispatchEx *dispex, REFIID riid) if(IsEqualGUID(&IID_IHTMLSelectElement, riid)) return &This->IHTMLSelectElement_iface; + if(IsEqualGUID(&IID_IWineHTMLInputPrivate, riid)) + return &This->IWineHTMLInputPrivate_iface; return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -1451,13 +1576,21 @@ static const tid_t HTMLSelectElement_tids[] = { 0 }; +static void HTMLSelectElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IWineHTMLInputPrivate_tid, NULL); +} + dispex_static_data_t HTMLSelectElement_dispex = { "HTMLSelectElement", &HTMLSelectElement_event_target_vtbl.dispex_vtbl, PROTO_ID_HTMLSelectElement, DispHTMLSelectElement_tid, HTMLSelectElement_tids, - HTMLElement_init_dispex_info + HTMLSelectElement_init_dispex_info }; HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1470,6 +1603,7 @@ HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H return E_OUTOFMEMORY; ret->IHTMLSelectElement_iface.lpVtbl = &HTMLSelectElementVtbl; + ret->IWineHTMLInputPrivate_iface.lpVtbl = &WineHTMLInputPrivateVtbl; ret->element.node.vtbl = &HTMLSelectElementImplVtbl; HTMLElement_Init(&ret->element, doc, nselem, &HTMLSelectElement_dispex); diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index fd297b9cf5b..5b08786ccd4 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -36,6 +36,7 @@ struct HTMLTextAreaElement { HTMLElement element; IHTMLTextAreaElement IHTMLTextAreaElement_iface; + IWineHTMLInputPrivate IWineHTMLInputPrivate_iface; nsIDOMHTMLTextAreaElement *nstextarea; }; @@ -385,6 +386,128 @@ static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = { HTMLTextAreaElement_createTextRange }; +static inline HTMLTextAreaElement *impl_from_IWineHTMLInputPrivateVtbl(IWineHTMLInputPrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLTextAreaElement, IWineHTMLInputPrivate_iface); +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_QueryInterface(IWineHTMLInputPrivate *iface, + REFIID riid, void **ppv) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLTextAreaElement_input_private_AddRef(IWineHTMLInputPrivate *iface) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLTextAreaElement_input_private_Release(IWineHTMLInputPrivate *iface) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_GetTypeInfoCount(IWineHTMLInputPrivate *iface, UINT *pctinfo) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_GetTypeInfo(IWineHTMLInputPrivate *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_GetIDsOfNames(IWineHTMLInputPrivate *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_Invoke(IWineHTMLInputPrivate *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_put_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL v) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_get_autofocus(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_get_validationMessage(IWineHTMLInputPrivate *iface, BSTR *ret) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_get_validity(IWineHTMLInputPrivate *iface, IDispatch **ret) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_get_willValidate(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_setCustomValidity(IWineHTMLInputPrivate *iface, VARIANT *message) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(message)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLTextAreaElement_input_private_checkValidity(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) +{ + HTMLTextAreaElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static const IWineHTMLInputPrivateVtbl WineHTMLInputPrivateVtbl = { + HTMLTextAreaElement_input_private_QueryInterface, + HTMLTextAreaElement_input_private_AddRef, + HTMLTextAreaElement_input_private_Release, + HTMLTextAreaElement_input_private_GetTypeInfoCount, + HTMLTextAreaElement_input_private_GetTypeInfo, + HTMLTextAreaElement_input_private_GetIDsOfNames, + HTMLTextAreaElement_input_private_Invoke, + HTMLTextAreaElement_input_private_put_autofocus, + HTMLTextAreaElement_input_private_get_autofocus, + HTMLTextAreaElement_input_private_get_validationMessage, + HTMLTextAreaElement_input_private_get_validity, + HTMLTextAreaElement_input_private_get_willValidate, + HTMLTextAreaElement_input_private_setCustomValidity, + HTMLTextAreaElement_input_private_checkValidity +}; + static inline HTMLTextAreaElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLTextAreaElement, element.node); @@ -418,6 +541,8 @@ static void *HTMLTextAreaElement_query_interface(DispatchEx *dispex, REFIID riid if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) return &This->IHTMLTextAreaElement_iface; + if(IsEqualGUID(&IID_IWineHTMLInputPrivate, riid)) + return &This->IWineHTMLInputPrivate_iface; return HTMLElement_query_interface(&This->element.node.event_target.dispex, riid); } @@ -466,13 +591,21 @@ static const tid_t HTMLTextAreaElement_iface_tids[] = { 0 }; +static void HTMLTextAreaElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + HTMLElement_init_dispex_info(info, mode); + + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IWineHTMLInputPrivate_tid, NULL); +} + dispex_static_data_t HTMLTextAreaElement_dispex = { "HTMLTextAreaElement", &HTMLTextAreaElement_event_target_vtbl.dispex_vtbl, PROTO_ID_HTMLTextAreaElement, DispHTMLTextAreaElement_tid, HTMLTextAreaElement_iface_tids, - HTMLElement_init_dispex_info + HTMLTextAreaElement_init_dispex_info }; HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -485,6 +618,7 @@ HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, return E_OUTOFMEMORY; ret->IHTMLTextAreaElement_iface.lpVtbl = &HTMLTextAreaElementVtbl; + ret->IWineHTMLInputPrivate_iface.lpVtbl = &WineHTMLInputPrivateVtbl; ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl; HTMLElement_Init(&ret->element, doc, nselem, &HTMLTextAreaElement_dispex); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 8c9cd5b40fb..5f46f6031cd 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -398,6 +398,9 @@ typedef struct ScriptHost ScriptHost; #define PRIVATE_TID_LIST \ XIID(IWineDOMTokenList) \ XIID(IWineHTMLElementPrivate) \ + XIID(IWineHTMLInputPrivate) \ + XIID(IWineHTMLFormPrivate) \ + XIID(IWineHTMLParentFormPrivate) \ XIID(IWineHTMLWindowPrivate) \ XIID(IWineHTMLWindowCompatPrivate) \ XIID(IWinePageTransitionEvent) \ diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index 4327d191d5c..627e4699e17 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -219,6 +219,86 @@ interface IWineHTMLElementPrivate : IDispatch HRESULT classList([retval, out] IDispatch **class_list); } +const long DISPID_IWINEHTMLFORMPRIVATE_NOVALIDATE = 51; +const long DISPID_IWINEHTMLFORMPRIVATE_CHECKVALIDITY = 52; +[ + odl, + oleautomation, + dual, + hidden, + uuid(465908fd-f394-489f-b7a3-4c00fbbe9eed) +] +interface IWineHTMLFormPrivate : IDispatch +{ + [propput, id(50)] + HRESULT enctype([in] BSTR v); + [propget, id(50)] + HRESULT enctype([retval, out] BSTR *ret); + [propput, id(DISPID_IWINEHTMLFORMPRIVATE_NOVALIDATE)] + HRESULT noValidate([in] VARIANT_BOOL v); + [propget, id(DISPID_IWINEHTMLFORMPRIVATE_NOVALIDATE)] + HRESULT noValidate([retval, out] VARIANT_BOOL *ret); + [id(DISPID_IWINEHTMLFORMPRIVATE_CHECKVALIDITY)] + HRESULT checkValidity([retval, out] VARIANT_BOOL *ret); +} + +[ + odl, + oleautomation, + dual, + hidden, + uuid(465908fd-f394-489f-b7a3-4c00fbbe9eee) +] +interface IWineHTMLParentFormPrivate : IDispatch +{ + [propput, id(60)] + HRESULT formAction([in] BSTR v); + [propget, id(60)] + HRESULT formAction([retval, out] BSTR *ret); + [propput, id(61)] + HRESULT formEnctype([in] BSTR v); + [propget, id(61)] + HRESULT formEnctype([retval, out] BSTR *ret); + [propput, id(62)] + HRESULT formMethod([in] BSTR v); + [propget, id(62)] + HRESULT formMethod([retval, out] BSTR *ret); + [propput, id(63)] + HRESULT formNoValidate([in] VARIANT_BOOL v); + [propget, id(63)] + HRESULT formNoValidate([retval, out] VARIANT_BOOL *ret); + [propput, id(64)] + HRESULT formTarget([in] BSTR v); + [propget, id(64)] + HRESULT formTarget([retval, out] BSTR *ret); +} + +const long DISPID_IWINEHTMLINPUTPRIVATE_AUTOFOCUS = 50; +[ + odl, + oleautomation, + dual, + hidden, + uuid(465908fd-f394-489f-b7a3-4c00fbbe9eef) +] +interface IWineHTMLInputPrivate : IDispatch +{ + [propput, id(DISPID_IWINEHTMLINPUTPRIVATE_AUTOFOCUS)] + HRESULT autofocus([in] VARIANT_BOOL v); + [propget, id(DISPID_IWINEHTMLINPUTPRIVATE_AUTOFOCUS)] + HRESULT autofocus([retval, out] VARIANT_BOOL *ret); + [propget, id(51)] + HRESULT validationMessage([retval, out] BSTR *ret); + [propget, id(52)] + HRESULT validity([retval, out] IDispatch **ret); + [propget, id(53)] + HRESULT willValidate([retval, out] VARIANT_BOOL *ret); + [id(54)] + HRESULT setCustomValidity([in] VARIANT *message); + [id(55)] + HRESULT checkValidity([retval, out] VARIANT_BOOL *ret); +} + [ odl, oleautomation, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 5250003a0ce..dbecce5e60a 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1930,6 +1930,86 @@ sync_test("style_props", function() { } }); +sync_test("input_validation_props", function() { + var obj, v = document.documentMode; + if(v < 9) return; + + function test_exposed(prop, expect) { + if(expect) + ok(Object.prototype.hasOwnProperty.call(obj, prop), prop + " not a property of " + obj); + else + ok(!Object.prototype.hasOwnProperty.call(obj, prop), prop + " is a property of " + obj); + } + + obj = window.HTMLFormElement.prototype; + test_exposed("action", true); + test_exposed("autofocus", false); + test_exposed("checkValidity", v >= 10); + test_exposed("enctype", true); + test_exposed("formAction", false); + test_exposed("formEnctype", false); + test_exposed("formMethod", false); + test_exposed("formNoValidate", false); + test_exposed("formTarget", false); + test_exposed("method", true); + test_exposed("noValidate", v >= 10); + test_exposed("setCustomValidity", false); + test_exposed("target", true); + test_exposed("validationMessage", false); + test_exposed("validity", false); + test_exposed("willValidate", false); + + obj = window.HTMLInputElement.prototype; + test_exposed("autofocus", v >= 10); + test_exposed("checkValidity", v >= 10); + test_exposed("formAction", v >= 10); + test_exposed("formEnctype", v >= 10); + test_exposed("formMethod", v >= 10); + test_exposed("formNoValidate", v >= 10); + test_exposed("formTarget", v >= 10); + test_exposed("setCustomValidity", v >= 10); + test_exposed("validationMessage", v >= 10); + test_exposed("validity", v >= 10); + test_exposed("willValidate", v >= 10); + + obj = window.HTMLButtonElement.prototype; + test_exposed("autofocus", v >= 10); + test_exposed("checkValidity", v >= 10); + test_exposed("formAction", v >= 10); + test_exposed("formEnctype", v >= 10); + test_exposed("formMethod", v >= 10); + test_exposed("formNoValidate", v >= 10); + test_exposed("formTarget", v >= 10); + test_exposed("setCustomValidity", v >= 10); + test_exposed("validationMessage", v >= 10); + test_exposed("validity", v >= 10); + test_exposed("willValidate", v >= 10); + + obj = window.HTMLObjectElement.prototype; + test_exposed("autofocus", false); + test_exposed("checkValidity", v >= 10); + test_exposed("setCustomValidity", v >= 10); + test_exposed("validationMessage", v >= 10); + test_exposed("validity", v >= 10); + test_exposed("willValidate", v >= 10); + + obj = window.HTMLSelectElement.prototype; + test_exposed("autofocus", v >= 10); + test_exposed("checkValidity", v >= 10); + test_exposed("setCustomValidity", v >= 10); + test_exposed("validationMessage", v >= 10); + test_exposed("validity", v >= 10); + test_exposed("willValidate", v >= 10); + + obj = window.HTMLTextAreaElement.prototype; + test_exposed("autofocus", v >= 10); + test_exposed("checkValidity", v >= 10); + test_exposed("setCustomValidity", v >= 10); + test_exposed("validationMessage", v >= 10); + test_exposed("validity", v >= 10); + test_exposed("willValidate", v >= 10); +}); + sync_test("createElement_inline_attr", function() { var v = document.documentMode, e, s; From 9daf9ca106a354d19d526d60a14a2d5c1762ea33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1018/1506] mshtml: Implement checkValidity for HTMLInputElement. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 2 ++ dlls/mshtml/htmlevent.h | 1 + dlls/mshtml/htmlinput.c | 24 ++++++++++++++++++++++-- dlls/mshtml/nsiface.idl | 20 +++++++++++++++++++- dlls/mshtml/tests/es5.js | 23 +++++++++++++++++++++++ 5 files changed, 67 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index b43f2ee0faf..bba0970d7ce 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -160,6 +160,8 @@ static const event_info_t event_info[] = { EVENT_BUBBLES | EVENT_CANCELABLE}, {L"input", EVENT_TYPE_EVENT, DISPID_UNKNOWN, EVENT_DEFAULTLISTENER | EVENT_BUBBLES}, + {L"invalid", EVENT_TYPE_EVENT, DISPID_EVPROP_INVALID, + EVENT_BIND_TO_TARGET | EVENT_CANCELABLE}, {L"keydown", EVENT_TYPE_KEYBOARD, DISPID_EVMETH_ONKEYDOWN, EVENT_DEFAULTLISTENER | EVENT_HASDEFAULTHANDLERS | EVENT_BUBBLES | EVENT_CANCELABLE }, {L"keypress", EVENT_TYPE_KEYBOARD, DISPID_EVMETH_ONKEYPRESS, diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 22a7ab3f860..2933314292e 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -40,6 +40,7 @@ typedef enum { EVENTID_FOCUSOUT, EVENTID_HELP, EVENTID_INPUT, + EVENTID_INVALID, EVENTID_KEYDOWN, EVENTID_KEYPRESS, EVENTID_KEYUP, diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 82cea2e96f4..2e59dccd63a 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1442,8 +1442,28 @@ static HRESULT WINAPI HTMLInputElement_private_setCustomValidity(IWineHTMLInputP static HRESULT WINAPI HTMLInputElement_private_checkValidity(IWineHTMLInputPrivate *iface, VARIANT_BOOL *ret) { HTMLInputElement *This = impl_from_IWineHTMLInputPrivateVtbl(iface); - FIXME("(%p)->(%p)\n", This, ret); - return E_NOTIMPL; + nsIDOMValidityState *nsvalidity; + DOMEvent *event; + nsresult nsres; + HRESULT hres; + cpp_bool b; + + TRACE("(%p)->(%p)\n", This, ret); + + nsres = nsIDOMHTMLInputElement_GetValidity(This->nsinput, &nsvalidity); + if(NS_FAILED(nsres)) + return map_nsresult(nsres); + nsres = nsIDOMValidityState_GetValid(nsvalidity, &b); + nsIDOMValidityState_Release(nsvalidity); + + if(!(*ret = variant_bool(NS_SUCCEEDED(nsres) && b))) { + hres = create_document_event(This->element.node.doc, EVENTID_INVALID, &event); + if(FAILED(hres)) + return hres; + dispatch_event(&This->element.node.event_target, event); + IDOMEvent_Release(&event->IDOMEvent_iface); + } + return S_OK; } static const IWineHTMLInputPrivateVtbl WineHTMLInputPrivateVtbl = { diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 1f2131dfb24..dd4aeba27df 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -161,7 +161,6 @@ typedef nsISupports nsITransferable; typedef nsISupports nsIDOMFileList; typedef nsISupports nsIDOMFile; typedef nsISupports nsIControllers; -typedef nsISupports nsIDOMValidityState; typedef nsISupports nsIPluginInstanceOwner; typedef nsISupports nsIPluginStreamListener; typedef nsISupports nsIPluginTag; @@ -976,6 +975,25 @@ interface nsIDOMMozNamedAttrMap : nsISupports nsresult RemoveNamedItemNS(const nsAString *namespaceURI, const nsAString *localName, nsIDOMAttr **_retval); } +[ + object, + uuid(00bed276-f1f7-492f-a039-dbd9b9efc10b), + local +] +interface nsIDOMValidityState : nsISupports +{ + nsresult GetValueMissing(bool *_retval); + nsresult GetTypeMismatch(bool *_retval); + nsresult GetPatternMismatch(bool *_retval); + nsresult GetTooLong(bool *_retval); + nsresult GetRangeUnderflow(bool *_retval); + nsresult GetRangeOverflow(bool *_retval); + nsresult GetStepMismatch(bool *_retval); + nsresult GetBadInput(bool *_retval); + nsresult GetCustomError(bool *_retval); + nsresult GetValid(bool *_retval); +} + [ object, uuid(cc35b412-009b-46a3-9be0-76448f12548d), diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index bd64cf4ec8f..c328889c7d5 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3017,6 +3017,29 @@ sync_test("functions scope", function() { })(); }); +sync_test("input validation", function() { + var fired, elem = document.createElement("input"); + elem.type = "number"; + elem.setAttribute("min", "1"); + elem.setAttribute("max", "4"); + elem.addEventListener("invalid", function(e) { + ok(e.target === elem, "unexpected target " + e.target); + fired = true; + }); + fired = false; + elem.value = 1; + ok(elem.checkValidity() === true, "input number (1-4) with value 1: invalid"); + ok(fired === false, "input number (1-4) with value 1 fired invalid event"); + fired = false; + elem.value = 0; + ok(elem.checkValidity() === false, "input number (1-4) with value 0: valid"); + ok(fired === true, "input number (1-4) with value 0 did not fire invalid event"); + fired = false; + elem.value = 5; + ok(elem.checkValidity() === false, "input number (1-4) with value 5: valid"); + ok(fired === true, "input number (1-4) with value 5 did not fire invalid event"); +}); + sync_test("instanceof", function() { var r; From 63f20f5ffd29f5d1e9820c78cf442f797cfb9dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1019/1506] mshtml: Implement enctype for HTMLFormElement. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's an alternative name for `encoding`. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlform.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index dbd529d4305..3b8f0cb4e43 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -832,15 +832,19 @@ static HRESULT WINAPI HTMLFormElement_private_Invoke(IWineHTMLFormPrivate *iface static HRESULT WINAPI HTMLFormElement_private_put_enctype(IWineHTMLFormPrivate *iface, BSTR v) { HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return IHTMLFormElement_put_encoding(&This->IHTMLFormElement_iface, v); } static HRESULT WINAPI HTMLFormElement_private_get_enctype(IWineHTMLFormPrivate *iface, BSTR *ret) { HTMLFormElement *This = impl_from_IWineHTMLFormPrivateVtbl(iface); - FIXME("(%p)->(%p)\n", This, ret); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, ret); + + return IHTMLFormElement_get_encoding(&This->IHTMLFormElement_iface, ret); } static HRESULT WINAPI HTMLFormElement_private_put_noValidate(IWineHTMLFormPrivate *iface, VARIANT_BOOL v) From 6e9e4aab11ba571d194e9deb3a0b9b19f5667e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1020/1506] mshtml: Expose toJSON only in IE9+ modes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/omnavigator.c | 49 ++++++++++++++++++++---------- dlls/mshtml/tests/documentmode.js | 50 +++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 15 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index cc22592f216..87f570fdb5f 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -24,6 +24,7 @@ #include "winbase.h" #include "winuser.h" #include "ole2.h" +#include "mshtmdid.h" #include "wine/debug.h" @@ -2218,16 +2219,22 @@ static const dispex_static_data_vtbl_t HTMLPerformanceTiming_dispex_vtbl = { .unlink = HTMLPerformanceTiming_unlink }; -static const tid_t HTMLPerformanceTiming_iface_tids[] = { - IHTMLPerformanceTiming_tid, - 0 -}; +static void HTMLPerformanceTiming_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t hooks[] = { + {DISPID_IHTMLPERFORMANCETIMING_TOJSON}, + {DISPID_UNKNOWN} + }; + dispex_info_add_interface(info, IHTMLPerformanceTiming_tid, mode < COMPAT_MODE_IE9 ? hooks : NULL); +} + dispex_static_data_t HTMLPerformanceTiming_dispex = { "PerformanceTiming", &HTMLPerformanceTiming_dispex_vtbl, PROTO_ID_HTMLPerformanceTiming, IHTMLPerformanceTiming_tid, - HTMLPerformanceTiming_iface_tids + no_iface_tids, + HTMLPerformanceTiming_init_dispex_info }; typedef struct { @@ -2390,16 +2397,22 @@ static const dispex_static_data_vtbl_t HTMLPerformanceNavigation_dispex_vtbl = { .unlink = HTMLPerformanceNavigation_unlink }; -static const tid_t HTMLPerformanceNavigation_iface_tids[] = { - IHTMLPerformanceNavigation_tid, - 0 -}; +static void HTMLPerformanceNavigation_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t hooks[] = { + {DISPID_IHTMLPERFORMANCENAVIGATION_TOJSON}, + {DISPID_UNKNOWN} + }; + dispex_info_add_interface(info, IHTMLPerformanceNavigation_tid, mode < COMPAT_MODE_IE9 ? hooks : NULL); +} + dispex_static_data_t HTMLPerformanceNavigation_dispex = { "PerformanceNavigation", &HTMLPerformanceNavigation_dispex_vtbl, PROTO_ID_HTMLPerformanceNavigation, IHTMLPerformanceNavigation_tid, - HTMLPerformanceNavigation_iface_tids + no_iface_tids, + HTMLPerformanceNavigation_init_dispex_info }; typedef struct { @@ -2603,16 +2616,22 @@ static const dispex_static_data_vtbl_t HTMLPerformance_dispex_vtbl = { .unlink = HTMLPerformance_unlink }; -static const tid_t HTMLPerformance_iface_tids[] = { - IHTMLPerformance_tid, - 0 -}; +static void HTMLPerformance_init_dispex_info(dispex_data_t *info, compat_mode_t mode) +{ + static const dispex_hook_t hooks[] = { + {DISPID_IHTMLPERFORMANCE_TOJSON}, + {DISPID_UNKNOWN} + }; + dispex_info_add_interface(info, IHTMLPerformance_tid, mode < COMPAT_MODE_IE9 ? hooks : NULL); +} + dispex_static_data_t HTMLPerformance_dispex = { "Performance", &HTMLPerformance_dispex_vtbl, PROTO_ID_HTMLPerformance, IHTMLPerformance_tid, - HTMLPerformance_iface_tids + no_iface_tids, + HTMLPerformance_init_dispex_info }; HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index dbecce5e60a..d3936ed6b4a 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1766,6 +1766,56 @@ sync_test("domimpl_props", function() { test_exposed("createHTMLDocument", v >= 9); }); +sync_test("perf_props", function() { + var obj = window.performance, name = "Performance"; + var v = document.documentMode; + + function test_exposed(prop, expect) { + if(expect) + ok(prop in obj, prop + " not found in " + name + "."); + else + ok(!(prop in obj), prop + " found in " + name + "."); + } + + test_exposed("navigation", true); + test_exposed("timing", true); + test_exposed("toJSON", v >= 9); + test_exposed("toString", true); + + obj = window.performance.navigation, name = "PerformanceNavigation"; + + test_exposed("redirectCount", true); + test_exposed("type", true); + test_exposed("toJSON", v >= 9); + test_exposed("toString", true); + + obj = window.performance.timing, name = "PerformanceTiming"; + + test_exposed("connectEnd", true); + test_exposed("connectStart", true); + test_exposed("domComplete", true); + test_exposed("domContentLoadedEventEnd", true); + test_exposed("domContentLoadedEventStart", true); + test_exposed("domInteractive", true); + test_exposed("domLoading", true); + test_exposed("domainLookupEnd", true); + test_exposed("domainLookupStart", true); + test_exposed("fetchStart", true); + test_exposed("loadEventEnd", true); + test_exposed("loadEventStart", true); + test_exposed("msFirstPaint", true); + test_exposed("navigationStart", true); + test_exposed("redirectEnd", true); + test_exposed("redirectStart", true); + test_exposed("requestStart", true); + test_exposed("responseEnd", true); + test_exposed("responseStart", true); + test_exposed("unloadEventEnd", true); + test_exposed("unloadEventStart", true); + test_exposed("toJSON", v >= 9); + test_exposed("toString", true); +}); + sync_test("xhr_props", function() { var xhr = new XMLHttpRequest(); From 81ae90823fe4ff32d61ac11067c2c68425c51df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1021/1506] mshtml: Implement toJSON() for PerformanceTiming. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/dispex.c | 13 ++++++++ dlls/jscript/jscript.h | 1 + dlls/mshtml/dispex.c | 45 +++++++++++++++++++++++++++ dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/omnavigator.c | 6 ++-- dlls/mshtml/tests/dom.c | 60 ++++++++++++++++++++++++++++++++++++ dlls/mshtml/tests/es5.js | 39 +++++++++++++++++++++++ 7 files changed, 164 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index dc287728311..7b288eea424 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2775,6 +2775,18 @@ static HRESULT WINAPI WineDispatchProxyCbPrivate_DefineConstructor(IWineDispatch return hres; } +static HRESULT WINAPI WineDispatchProxyCbPrivate_CreateObject(IWineDispatchProxyCbPrivate *iface, IDispatchEx **obj) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + jsdisp_t *jsdisp; + HRESULT hres; + + hres = create_object(This->ctx, NULL, &jsdisp); + if(SUCCEEDED(hres)) + *obj = &jsdisp->IDispatchEx_iface; + return hres; +} + static HRESULT WINAPI WineDispatchProxyCbPrivate_PropEnum(IWineDispatchProxyCbPrivate *iface, const WCHAR *name) { jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); @@ -2808,6 +2820,7 @@ static IWineDispatchProxyCbPrivateVtbl WineDispatchProxyCbPrivateVtbl = { WineDispatchProxyCbPrivate_HostUpdated, WineDispatchProxyCbPrivate_CreateConstructor, WineDispatchProxyCbPrivate_DefineConstructor, + WineDispatchProxyCbPrivate_CreateObject, WineDispatchProxyCbPrivate_GetRandomValues, WineDispatchProxyCbPrivate_PropEnum }; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index e190019a06c..90a1561950f 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -126,6 +126,7 @@ typedef struct { HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); + HRESULT (STDMETHODCALLTYPE *CreateObject)(IWineDispatchProxyCbPrivate *This, IDispatchEx **obj); HRESULT (STDMETHODCALLTYPE *GetRandomValues)(IDispatch *typedarr); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index d28c5c9c1bf..275780143b3 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -3605,6 +3605,51 @@ HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) return S_OK; } +HRESULT dispex_builtin_props_to_json(DispatchEx *dispex, VARIANT *ret) +{ + static DISPID propput_dispid = DISPID_PROPERTYPUT; + IWineDispatchProxyCbPrivate *proxy; + func_info_t *func, *end; + IDispatchEx *json; + HRESULT hres; + VARIANT var; + DISPID id; + DISPPARAMS dp = { 0 }, put_dp = { &var, &propput_dispid, 1, 1 }; + + if(!(proxy = dispex->proxy)) + return E_UNEXPECTED; + + if(!ensure_real_info(dispex)) + return E_OUTOFMEMORY; + + hres = proxy->lpVtbl->CreateObject(proxy, &json); + if(FAILED(hres)) + return hres; + + for(func = dispex->info->funcs, end = func + dispex->info->func_cnt; func < end; func++) { + if(func->func_disp_idx != -1) + continue; + hres = proxy_getter_invoke((IDispatch*)&dispex->IDispatchEx_iface, func, &dp, &var, NULL, NULL); + if(SUCCEEDED(hres)) { + hres = IDispatchEx_GetDispID(json, func->name, fdexNameEnsure | fdexNameCaseSensitive, &id); + if(SUCCEEDED(hres)) { + hres = IDispatchEx_InvokeEx(json, id, 0, DISPATCH_PROPERTYPUT, &put_dp, NULL, NULL, NULL); + } + VariantClear(&var); + } + if(FAILED(hres)) { + IDispatchEx_Release(json); + return hres; + } + } + + if(ret) { + V_VT(ret) = VT_DISPATCH; + V_DISPATCH(ret) = (IDispatch*)json; + } + return hres; +} + static nsresult NSAPI dispex_traverse(void *ccp, void *p, nsCycleCollectionTraversalCallback *cb) { DispatchEx *This = impl_from_IDispatchEx(p); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 5f46f6031cd..eb7fb893f29 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -117,6 +117,7 @@ typedef struct { HRESULT (STDMETHODCALLTYPE *HostUpdated)(IWineDispatchProxyCbPrivate *This, IActiveScript *script); IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); + HRESULT (STDMETHODCALLTYPE *CreateObject)(IWineDispatchProxyCbPrivate *This, IDispatchEx **obj); HRESULT (STDMETHODCALLTYPE *GetRandomValues)(IDispatch *typedarr); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; @@ -685,6 +686,7 @@ HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*); HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*); HRESULT dispex_invoke(DispatchEx*,IDispatch*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT dispex_delete_prop(DispatchEx*,DISPID); +HRESULT dispex_builtin_props_to_json(DispatchEx*,VARIANT*); HRESULT define_global_constructors(HTMLInnerWindow*); void release_typelib(void); HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**); diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 87f570fdb5f..64f25b5bfcc 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -2137,8 +2137,10 @@ static HRESULT WINAPI HTMLPerformanceTiming_toString(IHTMLPerformanceTiming *ifa static HRESULT WINAPI HTMLPerformanceTiming_toJSON(IHTMLPerformanceTiming *iface, VARIANT *p) { HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return dispex_builtin_props_to_json(&This->dispex, p); } static const IHTMLPerformanceTimingVtbl HTMLPerformanceTimingVtbl = { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 3029ea90ad3..1ea36f5f83d 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -52,6 +52,16 @@ static enum { static const char doc_blank[] = ""; +static const char doc_blank_ie8[] = + "\n" + "" + " " + " " + " " + " " + " " + ""; + static const char doc_blank_ie9[] = "\n" "" @@ -11286,6 +11296,54 @@ static void test_quirks_mode_offsetHeight(IHTMLDocument2 *doc) IHTMLElement_Release(elem); } +static void test_quirks_mode_perf_toJSON(IHTMLDocument2 *doc) +{ + IHTMLPerformanceTiming *timing; + IHTMLPerformance *perf; + DISPPARAMS dp = { 0 }; + IHTMLWindow2 *window; + IDispatchEx *dispex; + DISPID dispid; + HRESULT hres; + VARIANT var; + BSTR bstr; + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "QueryInterface(IID_IDispatchEx) failed: %08lx\n", hres); + IHTMLWindow2_Release(window); + + bstr = SysAllocString(L"performance"); + hres = IDispatchEx_GetDispID(dispex, bstr, fdexNameCaseSensitive, &dispid); + ok(hres == S_OK, "GetDispID(performance) failed: %08lx\n", hres); + SysFreeString(bstr); + + V_VT(&var) = VT_EMPTY; + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_PROPERTYGET, &dp, &var, NULL, NULL); + ok(hres == S_OK, "InvokeEx(performance) failed: %08lx\n", hres); + ok(V_VT(&var) == VT_DISPATCH, "V_VT(performance) = %d\n", V_VT(&var)); + ok(V_DISPATCH(&var) != NULL, "V_DISPATCH(performance) = NULL\n"); + IDispatchEx_Release(dispex); + + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLPerformance, (void**)&perf); + ok(hres == S_OK, "QueryInterface(IID_IHTMLPerformance) failed: %08lx\n", hres); + ok(perf != NULL, "performance is NULL\n"); + VariantClear(&var); + + hres = IHTMLPerformance_get_timing(perf, &timing); + ok(hres == S_OK, "get_timing failed: %08lx\n", hres); + ok(timing != NULL, "performance.timing is NULL\n"); + + hres = IHTMLPerformanceTiming_toJSON(timing, &var); + ok(hres == E_UNEXPECTED, "timing.toJSON() failed: %08lx\n", hres); + ok(V_VT(&var) == VT_EMPTY, "V_VT(timing.toJSON()) = %d\n", V_VT(&var)); + IHTMLPerformanceTiming_Release(timing); + + IHTMLPerformance_Release(perf); +} + static IHTMLDocument2 *notif_doc; static BOOL doc_complete; @@ -12218,6 +12276,8 @@ START_TEST(dom) run_domtest(emptydiv_str, test_docfrag); run_domtest(doc_blank, test_replacechild_elems); run_domtest(doctype_str, test_doctype); + run_domtest(doc_blank, test_quirks_mode_perf_toJSON); + run_domtest(doc_blank_ie8, test_quirks_mode_perf_toJSON); test_quirks_mode(); test_document_mode_lock(); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index c328889c7d5..53c11710728 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3058,6 +3058,45 @@ sync_test("instanceof", function() { ok(r === true, "document not instance of Node"); }); +sync_test("perf toJSON", function() { + var tests = [ + [ "performance.timing", "connectEnd", "connectStart", "domComplete", "domContentLoadedEventEnd", + "domContentLoadedEventStart", "domInteractive", "domLoading", "domainLookupEnd", "domainLookupStart", + "fetchStart", "loadEventEnd", "loadEventStart", "msFirstPaint", "navigationStart", "redirectEnd", + "redirectStart", "requestStart", "responseEnd", "responseStart", "unloadEventEnd", "unloadEventStart" ] + ]; + + for(var i = 0; i < tests.length; i++) { + var desc, name = tests[i][0], obj = eval("window." + name), json; + + Object.defineProperty(obj, "foobar", {writable: true, enumerable: true, configurable: true, value: 1}); + Object.defineProperty(Object.getPrototypeOf(obj), "barfoo", {writable: true, enumerable: true, configurable: true, value: 3}); + json = obj.toJSON(); + + ok(Object.getPrototypeOf(json) === Object.prototype, "prototype of " + name + ".toJSON() != Object.prototype"); + ok(typeof json === "object", "typeof " + name + ".toJSON() != object"); + for(var j = 1; j < tests[i].length; j++) { + desc = Object.getOwnPropertyDescriptor(json, tests[i][j]); + ok(json.hasOwnProperty(tests[i][j]), name + ".toJSON() does not have " + tests[i][j]); + ok(desc.writable === true, name + ".toJSON()." + tests[i][j] + " not writable"); + ok(desc.enumerable === true, name + ".toJSON()." + tests[i][j] + " not enumerable"); + ok(desc.configurable === true, name + ".toJSON()." + tests[i][j] + " not configurable"); + } + ok(!("foobar" in json), "foobar in " + name + ".toJSON()"); + ok(!("barfoo" in json), "barfoo in " + name + ".toJSON()"); + + delete obj.foobar; + delete Object.getPrototypeOf(obj).barfoo; + + desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(obj), tests[i][1]); + delete Object.getPrototypeOf(obj)[tests[i][1]]; + ok(!(tests[i][1] in obj), tests[i][1] + " in " + name + " after delete"); + json = obj.toJSON(); + ok(json.hasOwnProperty(tests[i][1]), name + ".toJSON() does not have " + tests[i][1] + " after delete"); + Object.defineProperty(Object.getPrototypeOf(obj), tests[i][1], desc); + } +}); + sync_test("console", function() { var except From 3148835a3bdbfdbe96296a200290fedd555b9382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1022/1506] mshtml: Implement toJSON() for PerformanceNavigation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/omnavigator.c | 6 ++++-- dlls/mshtml/tests/dom.c | 10 ++++++++++ dlls/mshtml/tests/es5.js | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 64f25b5bfcc..854ce82fbb4 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -2336,8 +2336,10 @@ static HRESULT WINAPI HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigat static HRESULT WINAPI HTMLPerformanceNavigation_toJSON(IHTMLPerformanceNavigation *iface, VARIANT *p) { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return dispex_builtin_props_to_json(&This->dispex, p); } static const IHTMLPerformanceNavigationVtbl HTMLPerformanceNavigationVtbl = { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 1ea36f5f83d..128de928e2e 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -11298,6 +11298,7 @@ static void test_quirks_mode_offsetHeight(IHTMLDocument2 *doc) static void test_quirks_mode_perf_toJSON(IHTMLDocument2 *doc) { + IHTMLPerformanceNavigation *nav; IHTMLPerformanceTiming *timing; IHTMLPerformance *perf; DISPPARAMS dp = { 0 }; @@ -11332,6 +11333,15 @@ static void test_quirks_mode_perf_toJSON(IHTMLDocument2 *doc) ok(perf != NULL, "performance is NULL\n"); VariantClear(&var); + hres = IHTMLPerformance_get_navigation(perf, &nav); + ok(hres == S_OK, "get_navigation failed: %08lx\n", hres); + ok(nav != NULL, "performance.navigation is NULL\n"); + + hres = IHTMLPerformanceNavigation_toJSON(nav, &var); + ok(hres == E_UNEXPECTED, "navigation.toJSON() failed: %08lx\n", hres); + ok(V_VT(&var) == VT_EMPTY, "V_VT(navigation.toJSON()) = %d\n", V_VT(&var)); + IHTMLPerformanceNavigation_Release(nav); + hres = IHTMLPerformance_get_timing(perf, &timing); ok(hres == S_OK, "get_timing failed: %08lx\n", hres); ok(timing != NULL, "performance.timing is NULL\n"); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 53c11710728..4145c884a64 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3060,6 +3060,7 @@ sync_test("instanceof", function() { sync_test("perf toJSON", function() { var tests = [ + [ "performance.navigation", "redirectCount", "type" ], [ "performance.timing", "connectEnd", "connectStart", "domComplete", "domContentLoadedEventEnd", "domContentLoadedEventStart", "domInteractive", "domLoading", "domainLookupEnd", "domainLookupStart", "fetchStart", "loadEventEnd", "loadEventStart", "msFirstPaint", "navigationStart", "redirectEnd", From 5b9e4b9da03eb8e1140fc9ec55cc254a6065e6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1023/1506] mshtml: Implement toJSON() for Performance. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 15 ++++++++++++--- dlls/mshtml/omnavigator.c | 6 ++++-- dlls/mshtml/tests/dom.c | 4 ++++ dlls/mshtml/tests/es5.js | 1 + 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 275780143b3..05e10756aef 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -3608,12 +3608,14 @@ HRESULT dispex_delete_prop(DispatchEx *dispex, DISPID id) HRESULT dispex_builtin_props_to_json(DispatchEx *dispex, VARIANT *ret) { static DISPID propput_dispid = DISPID_PROPERTYPUT; + static WCHAR toJSONW[] = L"toJSON"; IWineDispatchProxyCbPrivate *proxy; func_info_t *func, *end; + DispatchEx *subdispex; + DISPID id, to_json; IDispatchEx *json; HRESULT hres; VARIANT var; - DISPID id; DISPPARAMS dp = { 0 }, put_dp = { &var, &propput_dispid, 1, 1 }; if(!(proxy = dispex->proxy)) @@ -3632,9 +3634,16 @@ HRESULT dispex_builtin_props_to_json(DispatchEx *dispex, VARIANT *ret) hres = proxy_getter_invoke((IDispatch*)&dispex->IDispatchEx_iface, func, &dp, &var, NULL, NULL); if(SUCCEEDED(hres)) { hres = IDispatchEx_GetDispID(json, func->name, fdexNameEnsure | fdexNameCaseSensitive, &id); - if(SUCCEEDED(hres)) { - hres = IDispatchEx_InvokeEx(json, id, 0, DISPATCH_PROPERTYPUT, &put_dp, NULL, NULL, NULL); + + if(SUCCEEDED(hres) && V_VT(&var) == VT_DISPATCH && (subdispex = get_dispex_for_hook((IUnknown*)V_DISPATCH(&var)))) { + if(SUCCEEDED(dispex_get_builtin_id(subdispex, toJSONW, fdexNameCaseSensitive, &to_json))) { + VariantClear(&var); + hres = dispex_call_builtin(subdispex, to_json, &dp, &var, NULL, NULL); + } + IDispatchEx_Release(&subdispex->IDispatchEx_iface); } + if(SUCCEEDED(hres)) + hres = IDispatchEx_InvokeEx(json, id, 0, DISPATCH_PROPERTYPUT, &put_dp, NULL, NULL, NULL); VariantClear(&var); } if(FAILED(hres)) { diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 854ce82fbb4..5508fa35d13 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -2551,8 +2551,10 @@ static HRESULT WINAPI HTMLPerformance_toString(IHTMLPerformance *iface, BSTR *st static HRESULT WINAPI HTMLPerformance_toJSON(IHTMLPerformance *iface, VARIANT *var) { HTMLPerformance *This = impl_from_IHTMLPerformance(iface); - FIXME("(%p)->(%p)\n", This, var); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, var); + + return dispex_builtin_props_to_json(&This->dispex, var); } static const IHTMLPerformanceVtbl HTMLPerformanceVtbl = { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 128de928e2e..6c6bb0c659e 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -11333,6 +11333,10 @@ static void test_quirks_mode_perf_toJSON(IHTMLDocument2 *doc) ok(perf != NULL, "performance is NULL\n"); VariantClear(&var); + hres = IHTMLPerformance_toJSON(perf, &var); + ok(hres == E_UNEXPECTED, "toJSON() returned: %08lx\n", hres); + ok(V_VT(&var) == VT_EMPTY, "V_VT(toJSON()) = %d\n", V_VT(&var)); + hres = IHTMLPerformance_get_navigation(perf, &nav); ok(hres == S_OK, "get_navigation failed: %08lx\n", hres); ok(nav != NULL, "performance.navigation is NULL\n"); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 4145c884a64..bbb616646a4 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -3060,6 +3060,7 @@ sync_test("instanceof", function() { sync_test("perf toJSON", function() { var tests = [ + [ "performance", "navigation", "timing" ], [ "performance.navigation", "redirectCount", "type" ], [ "performance.timing", "connectEnd", "connectStart", "domComplete", "domContentLoadedEventEnd", "domContentLoadedEventStart", "domInteractive", "domLoading", "domainLookupEnd", "domainLookupStart", From de4ca1dc9267d0121c3081bf34be5f7df5b41190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1024/1506] mshtml: Move HTMLXMLHttpRequest creation to a helper. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So it can be shared with XDomainRequest constructors. Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/xmlhttprequest.c | 43 ++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index a0fd41e04e3..9f972e0c7c2 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1717,19 +1717,16 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactor pDispParams, pVarResult, pExcepInfo, puArgErr); } -static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p) +static HRESULT create_xhr(HTMLInnerWindow *window, dispex_static_data_t *dispex, HTMLXMLHttpRequest **p) { - struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); - HTMLXMLHttpRequest *ret; - nsIXMLHttpRequest *nsxhr; - nsIDOMEventTarget *nstarget; - XMLHttpReqEventListener *event_listener; + XMLHttpReqEventListener *event_listener; + nsIDOMEventTarget *nstarget; + nsIXMLHttpRequest *nsxhr; + HTMLXMLHttpRequest *ret; nsresult nsres; unsigned i; - TRACE("(%p)->(%p)\n", This, p); - - nsxhr = create_nsxhr(This->window->dom_window); + nsxhr = create_nsxhr(window->dom_window); if(!nsxhr) return E_FAIL; @@ -1747,16 +1744,16 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor } ret->nsxhr = nsxhr; - ret->window = This->window; + ret->window = window; ret->doctype_override = DOCTYPE_INVALID; ret->task_magic = get_task_target_magic(); - IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); ret->IHTMLXMLHttpRequest_iface.lpVtbl = &HTMLXMLHttpRequestVtbl; ret->IHTMLXMLHttpRequest2_iface.lpVtbl = &HTMLXMLHttpRequest2Vtbl; ret->IWineXMLHttpRequestPrivate_iface.lpVtbl = &WineXMLHttpRequestPrivateVtbl; ret->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl; - EventTarget_Init(&ret->event_target, &HTMLXMLHttpRequest_dispex, This->window); + EventTarget_Init(&ret->event_target, dispex, window); /* Always register the handlers because we need them to track state */ event_listener->nsIDOMEventListener_iface.lpVtbl = &XMLHttpReqEventListenerVtbl; @@ -1782,10 +1779,24 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor } nsIDOMEventTarget_Release(nstarget); - *p = &ret->IHTMLXMLHttpRequest_iface; + *p = ret; return S_OK; } +static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p) +{ + struct global_ctor *This = impl_from_IHTMLXMLHttpRequestFactory(iface); + HTMLXMLHttpRequest *xhr; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + hres = create_xhr(This->window, &HTMLXMLHttpRequest_dispex, &xhr); + if(SUCCEEDED(hres)) + *p = &xhr->IHTMLXMLHttpRequest_iface; + return hres; +} + const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = { HTMLXMLHttpRequestFactory_QueryInterface, HTMLXMLHttpRequestFactory_AddRef, @@ -1816,7 +1827,7 @@ static HRESULT HTMLXMLHttpRequestFactory_value(DispatchEx *iface, LCID lcid, WOR VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { struct global_ctor *This = ctor_from_DispatchEx(iface); - IHTMLXMLHttpRequest *xhr; + HTMLXMLHttpRequest *xhr; HRESULT hres; TRACE("\n"); @@ -1824,12 +1835,12 @@ static HRESULT HTMLXMLHttpRequestFactory_value(DispatchEx *iface, LCID lcid, WOR if(flags != DISPATCH_CONSTRUCT) return S_FALSE; - hres = IHTMLXMLHttpRequestFactory_create(&This->IHTMLXMLHttpRequestFactory_iface, &xhr); + hres = create_xhr(This->window, &HTMLXMLHttpRequest_dispex, &xhr); if(FAILED(hres)) return hres; V_VT(res) = VT_DISPATCH; - V_DISPATCH(res) = (IDispatch*)xhr; + V_DISPATCH(res) = (IDispatch*)&xhr->IHTMLXMLHttpRequest_iface; return S_OK; } From 8b5347baf4c077ea60b7b23433ac401b1ed5d105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1025/1506] mshtml: Add XDomainRequest factory implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/dispex.c | 8 +- dlls/mshtml/htmlwindow.c | 28 +- dlls/mshtml/mshtml_private.h | 9 + dlls/mshtml/tests/documentmode.js | 31 ++- dlls/mshtml/tests/dom.c | 78 ++++++ dlls/mshtml/tests/events.c | 19 ++ dlls/mshtml/xmlhttprequest.c | 410 ++++++++++++++++++++++++++++++ 7 files changed, 572 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 05e10756aef..624ee8e8c15 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -212,6 +212,7 @@ static unsigned char proxy_ctor_mode_unavailable[PROTO_ID_TOTAL_COUNT - LEGACY_P [PROTO_ID_HTMLNamespaceCollection - LEGACY_PROTOTYPE_COUNT] = (1<desc - legacy_prototype_dispex; @@ -2562,7 +2564,8 @@ static IDispatch *get_proxy_constructor_disp(HTMLInnerWindow *window, prototype_ { PROTO_ID_MutationObserver, &mutation_observer_ctor_dispex }, { PROTO_ID_HTMLImgElement, &HTMLImageCtor_dispex, &HTMLImageElementFactoryVtbl }, { PROTO_ID_HTMLOptionElement, &HTMLOptionCtor_dispex, &HTMLOptionElementFactoryVtbl }, - { PROTO_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, &HTMLXMLHttpRequestFactoryVtbl } + { PROTO_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestFactory_dispex, &HTMLXMLHttpRequestFactoryVtbl }, + { PROTO_ID_HTMLXDomainRequest, &HTMLXDomainRequestFactory_dispex, &HTMLXDomainRequestFactoryVtbl } }; struct global_ctor *ctor; unsigned i; @@ -3156,7 +3159,8 @@ static HRESULT WINAPI WineDispatchProxyPrivate_GetDefaultConstructor(IWineDispat static const prototype_id_t special_ctors[] = { PROTO_ID_DOMParser, PROTO_ID_MutationObserver, - PROTO_ID_HTMLXMLHttpRequest + PROTO_ID_HTMLXMLHttpRequest, + PROTO_ID_HTMLXDomainRequest }; DispatchEx *This = impl_from_IWineDispatchProxyPrivate(iface); struct proxy_prototype *prot = to_proxy_prototype(This); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 170c87dbf93..1af8ab5ad67 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -198,7 +198,7 @@ static const struct { } special_ctor_static_data[] = { { "Image", PROTO_ID_HTMLImgElement, LEGACY_CTOR_ID_Image, &HTMLImageCtor_dispex, &HTMLImageElementFactoryVtbl }, { "Option", PROTO_ID_HTMLOptionElement, LEGACY_CTOR_ID_Option, &HTMLOptionCtor_dispex, &HTMLOptionElementFactoryVtbl }, - /* { "XDomainRequest", PROTO_ID_?, LEGACY_CTOR_ID_?, ?, ? } */ + { "XDomainRequest", PROTO_ID_HTMLXDomainRequest, LEGACY_CTOR_ID_HTMLXDomainRequest, &HTMLXDomainRequestCtor_dispex, &HTMLXDomainRequestFactoryVtbl }, { "XMLHttpRequest", PROTO_ID_HTMLXMLHttpRequest, LEGACY_CTOR_ID_HTMLXMLHttpRequest, &HTMLXMLHttpRequestCtor_dispex, &HTMLXMLHttpRequestFactoryVtbl } }; @@ -2334,8 +2334,24 @@ static HRESULT WINAPI HTMLWindow6_put_XDomainRequest(IHTMLWindow6 *iface, VARIAN static HRESULT WINAPI HTMLWindow6_get_XDomainRequest(IHTMLWindow6 *iface, VARIANT *p) { HTMLWindow *This = impl_from_IHTMLWindow6(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + HTMLInnerWindow *window = This->inner_window; + IDispatch *disp; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + if(This->outer_window->readystate == READYSTATE_UNINITIALIZED) { + V_VT(p) = VT_EMPTY; + return S_OK; + } + + hres = get_legacy_ctor(window, LEGACY_CTOR_ID_HTMLXDomainRequest_builtin, PROTO_ID_HTMLXDomainRequest, + &HTMLXDomainRequestFactory_dispex, &HTMLXDomainRequestFactoryVtbl, &disp); + if(SUCCEEDED(hres)) { + V_VT(p) = VT_DISPATCH; + V_DISPATCH(p) = (IDispatch*)&global_ctor_from_IDispatch(disp)->IHTMLXDomainRequestFactory_iface; + } + return hres; } static HRESULT WINAPI HTMLWindow6_get_sessionStorage(IHTMLWindow6 *iface, IHTMLStorage **p) @@ -4983,10 +4999,12 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa {DISPID_IHTMLWINDOW4_CREATEPOPUP, NULL}, {DISPID_UNKNOWN} }; - static const dispex_hook_t window6_hooks[] = { + static const dispex_hook_t window6_ie11_hooks[] = { + {DISPID_IHTMLWINDOW6_XDOMAINREQUEST}, /* hidden in IE11 */ {DISPID_IHTMLWINDOW6_POSTMESSAGE, IHTMLWindow6_postMessage_hook}, {DISPID_UNKNOWN} }; + const dispex_hook_t *const window6_hooks = window6_ie11_hooks + 1; /* Hide props not available in IE10 */ static const dispex_hook_t private_ie10_hooks[] = { @@ -5002,7 +5020,7 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa dispex_info_add_interface(info, IWineHTMLWindowPrivate_tid, compat_mode >= COMPAT_MODE_IE11 ? NULL : private_ie10_hooks); - dispex_info_add_interface(info, IHTMLWindow6_tid, window6_hooks); + dispex_info_add_interface(info, IHTMLWindow6_tid, compat_mode >= COMPAT_MODE_IE11 ? window6_ie11_hooks : window6_hooks); dispex_info_add_interface(info, IHTMLWindow5_tid, NULL); dispex_info_add_interface(info, IHTMLWindow4_tid, compat_mode >= COMPAT_MODE_IE11 ? window4_ie11_hooks : NULL); dispex_info_add_interface(info, IHTMLWindow3_tid, compat_mode >= COMPAT_MODE_IE11 ? window3_ie11_hooks : window3_hooks); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index eb7fb893f29..a290562cf60 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -253,6 +253,7 @@ typedef struct ScriptHost ScriptHost; XDIID(DispHTMLW3CComputedStyle) \ XDIID(DispHTMLWindow2) \ XDIID(DispHTMLXMLHttpRequest) \ + XDIID(DispXDomainRequest) \ XDIID(DispSVGCircleElement) \ XDIID(DispSVGSVGElement) \ XDIID(DispSVGTSpanElement) \ @@ -388,6 +389,8 @@ typedef struct ScriptHost ScriptHost; XIID(IHTMLXMLHttpRequest) \ XIID(IHTMLXMLHttpRequest2) \ XIID(IHTMLXMLHttpRequestFactory) \ + XIID(IHTMLXDomainRequest) \ + XIID(IHTMLXDomainRequestFactory) \ XIID(IOmHistory) \ XIID(IOmNavigator) \ XIID(ISVGCircleElement) \ @@ -450,6 +453,7 @@ PRIVATE_TID_LIST X(HTMLStorage, "Storage", HTMLStorage_dispex, Object) \ X(HTMLTextRange, "TextRange", HTMLTxtRange_dispex, Object) \ X(HTMLXMLHttpRequest, "XMLHttpRequest", HTMLXMLHttpRequest_dispex, Object) \ + X(HTMLXDomainRequest, "XDomainRequest", HTMLXDomainRequest_dispex, Object) \ X(HTMLCurrentStyle, "MSCurrentStyleCSSProperties", HTMLCurrentStyle_dispex, HTMLCSSProperties) \ X(HTMLW3CComputedStyle, "CSSStyleDeclaration", HTMLW3CComputedStyle_dispex, Object) \ X(HTMLStyleSheet, "CSSStyleSheet", HTMLStyleSheet_dispex, StyleSheet) \ @@ -544,6 +548,7 @@ COMMON_PROTOTYPE_LIST LEGACY_CTOR_ID_Image_builtin, LEGACY_CTOR_ID_Option_builtin, LEGACY_CTOR_ID_HTMLXMLHttpRequest_builtin, + LEGACY_CTOR_ID_HTMLXDomainRequest_builtin, LEGACY_CTOR_COUNT } legacy_ctor_id_t; @@ -715,6 +720,7 @@ struct global_ctor { IHTMLOptionElementFactory IHTMLOptionElementFactory_iface; IHTMLImageElementFactory IHTMLImageElementFactory_iface; IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface; + IHTMLXDomainRequestFactory IHTMLXDomainRequestFactory_iface; }; prototype_id_t prot_id; @@ -1777,12 +1783,15 @@ HRESULT create_mutation_observer_ctor(HTMLInnerWindow *window, IDispatch **ret); extern const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl; extern const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl; extern const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl; +extern const IHTMLXDomainRequestFactoryVtbl HTMLXDomainRequestFactoryVtbl; extern dispex_static_data_t HTMLImageElementFactory_dispex; extern dispex_static_data_t HTMLOptionElementFactory_dispex; extern dispex_static_data_t HTMLXMLHttpRequestFactory_dispex; +extern dispex_static_data_t HTMLXDomainRequestFactory_dispex; extern dispex_static_data_t HTMLImageCtor_dispex; extern dispex_static_data_t HTMLOptionCtor_dispex; extern dispex_static_data_t HTMLXMLHttpRequestCtor_dispex; +extern dispex_static_data_t HTMLXDomainRequestCtor_dispex; extern dispex_static_data_t DOMParserCtor_dispex; extern dispex_static_data_t mutation_observer_ctor_dispex; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index d3936ed6b4a..cc81a79bb39 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -351,6 +351,7 @@ sync_test("builtin_toString", function() { if(v < 11) { test("eventObject", document.createEventObject(), "MSEventObj"); test("selection", document.selection, "MSSelection"); + test("XDomainRequest", new XDomainRequest(), "XDomainRequest", null, "Function"); } if(v >= 9) { var xml = new DOMParser().parseFromString("foobar", "text/xml"); @@ -764,6 +765,26 @@ sync_test("builtin_prototypes", function() { }else ok(proto.constructor === window.XMLHttpRequest, "XMLHttpRequest.prototype.constructor = " + proto.constructor); + if(v < 11) { + set_obj("XDomainRequest", true); + test_prop("open"); + test_prop("send"); + test_prop("timeout"); + test_legacy_ctor(["abort"], ["contentType", "responseText"], ["status", "onreadystatechange"], "onerror", function(){}); + if(v < 9) { + r = obj.abort(); + ok(r === "foobar", "(new XDomainRequest).abort() returned " + r); + r = obj.winetestprop; + ok(r === "test", "(new XDomainRequest).winetestprop = " + r); + obj.winetestprop = "prop"; + r = obj.winetestprop; + ok(r === "prop", "(new XDomainRequest).winetestprop after set = " + r); + r = XDomainRequest.prototype.winetestprop; + ok(r === "test", "XDomainRequest.prototype.winetestprop after obj = " + r); + }else + ok(proto.constructor === window.XDomainRequest, "XDomainRequest.prototype.constructor = " + proto.constructor); + } + set_obj("Image", true); test_prop("src"); test_prop("border"); @@ -1151,6 +1172,7 @@ sync_test("builtin_prototypes", function() { [ "TextRange", "Object" ], [ "UIEvent", "Event" ], [ "Window", "Object" ], + [ "XDomainRequest", "Object" ], [ "XMLDocument", "Document" ], [ "XMLHttpRequest", "Object" ] ]; @@ -1244,10 +1266,12 @@ sync_test("builtin_constructors", function() { [ "Image", [ "prototype", "arguments" ], [ "create", "length" ] ], [ "MutationObserver", [ "prototype", "arguments" ], [ "create", "length" ], 11 ], [ "Option", [ "prototype", "arguments" ], [ "create", "length" ] ], + [ "XDomainRequest", [ "prototype", "arguments", "create" ], [ "length" ], 0, 10 ], [ "XMLHttpRequest", [ "prototype", "arguments", "create" ], [ "length" ] ] ]; for(var i = 0; i < special_ctors.length; i++) { - if(special_ctors[i].length > 3 && v < special_ctors[i][3]) + if((special_ctors[i].length > 3 && v < special_ctors[i][3]) || + (special_ctors[i].length > 4 && v > special_ctors[i][4])) continue; var name = special_ctors[i][0]; ok(Object.prototype.hasOwnProperty.call(window, name), name + " not a property of window."); @@ -1397,7 +1421,7 @@ sync_test("builtin_constructors", function() { [ "XMLHttpRequest", 0 ] ]; for(var i = 0; i < ctors.length; i++) { - if(!(ctors[i][0] in window) && (v >= 8 || ctors[i][0] === "XDomainRequest")) { + if(!(ctors[i][0] in window) && v >= 8) { todo_wine.ok(false, ctors[i][0] + " not implemented"); continue; } @@ -1407,8 +1431,6 @@ sync_test("builtin_constructors", function() { }catch(ex) { r = ex.number; } - if(r === 0x4001 - 0x80000000) /* todo_wine XDomainRequest */ - continue; if(v < 8 && (ctors[i].length < 2 || v < ctors[i][1])) ok(r === 0xa1391 - 0x80000000, ctors[i][0] + " not undefined: " + r); else { @@ -1747,6 +1769,7 @@ sync_test("window_props", function() { test_exposed("matchMedia", v >= 10); test_exposed("msCrypto", v >= 11); test_exposed("MutationObserver", v >= 11); + test_exposed("XDomainRequest", v < 11); }); sync_test("domimpl_props", function() { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 6c6bb0c659e..8e995462fbc 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -7326,6 +7326,41 @@ static void test_xmlhttprequest(IHTMLWindow5 *window) VariantClear(&var); } +static void test_xdomainrequest(IHTMLWindow6 *window) +{ + IHTMLXDomainRequestFactory *factory; + IHTMLXDomainRequest *xdr; + HRESULT hres; + VARIANT var; + + hres = IHTMLWindow6_get_XDomainRequest(window, &var); + ok(hres == S_OK, "get_XDomainRequest failed: %08lx\n", hres); + ok(V_VT(&var) == VT_DISPATCH || broken(V_VT(&var) == VT_EMPTY), "expect VT_DISPATCH, got %s\n", debugstr_variant(&var)); + + if(V_VT(&var) == VT_EMPTY) { + win_skip("Native XDomainRequest support is missing or disabled.\n"); + return; + } + + factory = NULL; + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLXDomainRequestFactory, (void**)&factory); + ok(hres == S_OK, "QueryInterface(&IID_IHTMLXDomainRequestFactory) failed: %08lx\n", hres); + ok(factory != NULL, "factory == NULL\n"); + + test_factory(window, factory, L"XDomainRequest", L"[object XDomainRequest]"); + + xdr = NULL; + hres = IHTMLXDomainRequestFactory_create(factory, &xdr); + ok(hres == S_OK, "create failed: %08lx\n", hres); + ok(xdr != NULL, "xdr == NULL\n"); + if(is_ie9plus) + test_disp((IUnknown*)xdr, &DIID_DispXDomainRequest, NULL, L"[object]"); + + IHTMLXDomainRequest_Release(xdr); + IHTMLXDomainRequestFactory_Release(factory); + VariantClear(&var); +} + static void test_read_only_style(IHTMLCSSStyleDeclaration *style) { BSTR none = SysAllocString(L"none"), display = SysAllocString(L"display"), str; @@ -7351,6 +7386,7 @@ static void test_window(IHTMLDocument2 *doc) { IHTMLWindow2 *window, *window2, *self, *parent; IHTMLWindow5 *window5; + IHTMLWindow6 *window6; IHTMLWindow7 *window7; IHTMLDOMConstructorCollection *ctor_col; IHTMLDocument2 *doc2 = NULL; @@ -7456,6 +7492,15 @@ static void test_window(IHTMLDocument2 *doc) win_skip("IHTMLWindow5 not supported!\n"); } + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow6, (void**)&window6); + if(SUCCEEDED(hres)) { + ok(window6 != NULL, "window6 == NULL\n"); + test_xdomainrequest(window6); + IHTMLWindow6_Release(window6); + }else { + win_skip("IHTMLWindow6 not supported!\n"); + } + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLDOMConstructorCollection, (void**)&ctor_col); ok(hres == E_NOINTERFACE, "QueryInterface for IHTMLDOMConstructorCollection returned %08lx\n", hres); @@ -7684,6 +7729,29 @@ static void test_xhr(IHTMLDocument2 *doc) IDispatchEx_Release(dispex); } +static void test_xdr(IHTMLDocument2 *doc) +{ + IHTMLWindow2 *window; + IDispatchEx *dispex; + DISPID id; + BSTR str; + HRESULT hres; + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres); + + str = SysAllocString(L"XDomainRequest"); + hres = IDispatchEx_GetDispID(dispex, str, 0, &id); + ok(hres == S_OK, "GetDispID failed: %08lx\n", hres); + SysFreeString(str); + + IHTMLWindow2_Release(window); + IDispatchEx_Release(dispex); +} + static void test_defaults(IHTMLDocument2 *doc) { IHTMLStyleSheetsCollection *stylesheetcol; @@ -7757,6 +7825,7 @@ static void test_defaults(IHTMLDocument2 *doc) } test_xhr(doc); + test_xdr(doc); hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLBodyElement, (void**)&body); ok(hres == S_OK, "Could not get IHTMBodyElement: %08lx\n", hres); @@ -12004,6 +12073,7 @@ static void test_document_mode_lock(void) IEventTarget *event_target; IPersistStreamInit *init; IHTMLWindow7 *window7; + IHTMLWindow6 *window6; IHTMLWindow5 *window5; IHTMLWindow2 *window; IDispatchEx *dispex; @@ -12057,6 +12127,14 @@ static void test_document_mode_lock(void) ok(V_VT(&var) == VT_EMPTY, "V_VT(XMLHttpRequest) = %d\n", V_VT(&var)); IHTMLWindow5_Release(window5); + V_VT(&var) = VT_NULL; + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow6, (void**)&window6); + ok(hres == S_OK, "Could not get IHTMLWindow6: %08lx\n", hres); + hres = IHTMLWindow6_get_XDomainRequest(window6, &var); + ok(hres == S_OK, "get_XDomainRequest failed: %08lx\n", hres); + ok(V_VT(&var) == VT_EMPTY, "V_VT(XDomainRequest) = %d\n", V_VT(&var)); + IHTMLWindow6_Release(window6); + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow7, (void**)&window7); ok(hres == S_OK, "Could not get IHTMLWindow7: %08lx\n", hres); hres = IHTMLWindow7_get_performance(window7, &var); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index a434327631d..90a616c507c 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -4148,6 +4148,7 @@ static void test_doc_obj(IHTMLDocument2 *doc) IHTMLOptionElementFactory *option, *option2; IHTMLImageElementFactory *image, *image2; IHTMLXMLHttpRequestFactory *xhr, *xhr2; + IHTMLXDomainRequestFactory *xdr, *xdr2; IHTMLDocument2 *doc_node, *doc_node2; IOmNavigator *navigator, *navigator2; IHTMLLocation *location, *location2; @@ -4323,7 +4324,14 @@ static void test_doc_obj(IHTMLDocument2 *doc) ok(hres == S_OK, "Could not get IHTMLWindow6: %08lx\n", hres); hres = IHTMLWindow6_get_sessionStorage(window6, &storage); ok(hres == S_OK, "get_sessionStorage failed: %08lx\n", hres); + + hres = IHTMLWindow6_get_XDomainRequest(window6, &res); + ok(hres == S_OK, "get_XDomainRequest failed: %08lx\n", hres); + ok(V_VT(&res) == VT_DISPATCH, "V_VT(XDomainRequest) = %d\n", V_VT(&res)); + hres = IDispatch_QueryInterface(V_DISPATCH(&res), &IID_IHTMLXDomainRequestFactory, (void**)&xdr); + ok(hres == S_OK, "Could not get IHTMLXDomainRequestFactory: %08lx\n", hres); IHTMLWindow6_Release(window6); + VariantClear(&res); hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow7, (void**)&window7); ok(hres == S_OK, "Could not get IHTMLWindow7: %08lx\n", hres); @@ -4509,7 +4517,18 @@ static void test_doc_obj(IHTMLDocument2 *doc) ok(storage != storage2, "storage == storage2\n"); IHTMLStorage_Release(storage2); IHTMLStorage_Release(storage); + + ok(hres == S_OK, "Could not get IHTMLWindow6: %08lx\n", hres); + hres = IHTMLWindow6_get_XDomainRequest(window6, &res); + ok(hres == S_OK, "get_XDomainRequest failed: %08lx\n", hres); + ok(V_VT(&res) == VT_DISPATCH, "V_VT(XDomainRequest) = %d\n", V_VT(&res)); + hres = IDispatch_QueryInterface(V_DISPATCH(&res), &IID_IHTMLXDomainRequestFactory, (void**)&xdr2); + ok(hres == S_OK, "Could not get IHTMLXDomainRequestFactory: %08lx\n", hres); + ok(xdr != xdr2, "xdr == xdr2\n"); + IHTMLXDomainRequestFactory_Release(xdr2); + IHTMLXDomainRequestFactory_Release(xdr); IHTMLWindow6_Release(window6); + VariantClear(&res); hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow7, (void**)&window7); ok(hres == S_OK, "Could not get IHTMLWindow7: %08lx\n", hres); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 9f972e0c7c2..3c6b20a3908 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -136,6 +136,7 @@ struct HTMLXMLHttpRequest { IHTMLXMLHttpRequest2 IHTMLXMLHttpRequest2_iface; IWineXMLHttpRequestPrivate IWineXMLHttpRequestPrivate_iface; IProvideClassInfo2 IProvideClassInfo2_iface; + IHTMLXDomainRequest IHTMLXDomainRequest_iface; /* only for XDomainRequests */ LONG task_magic; LONG ready_state; document_type_t doctype_override; @@ -1897,3 +1898,412 @@ dispex_static_data_t HTMLXMLHttpRequestCtor_dispex = { IHTMLXMLHttpRequestFactory_tid, HTMLXMLHttpRequestFactory_iface_tids }; + + +/* IHTMLXDomainRequest */ +static inline HTMLXMLHttpRequest *impl_from_IHTMLXDomainRequest(IHTMLXDomainRequest *iface) +{ + return CONTAINING_RECORD(iface, HTMLXMLHttpRequest, IHTMLXDomainRequest_iface); +} + +static HRESULT WINAPI HTMLXDomainRequest_QueryInterface(IHTMLXDomainRequest *iface, REFIID riid, void **ppv) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_QueryInterface(&This->event_target.dispex.IDispatchEx_iface, riid, ppv); +} + +static ULONG WINAPI HTMLXDomainRequest_AddRef(IHTMLXDomainRequest *iface) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_AddRef(&This->event_target.dispex.IDispatchEx_iface); +} + +static ULONG WINAPI HTMLXDomainRequest_Release(IHTMLXDomainRequest *iface) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_Release(&This->event_target.dispex.IDispatchEx_iface); +} + +static HRESULT WINAPI HTMLXDomainRequest_GetTypeInfoCount(IHTMLXDomainRequest *iface, UINT *pctinfo) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_GetTypeInfoCount(&This->event_target.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLXDomainRequest_GetTypeInfo(IHTMLXDomainRequest *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_GetTypeInfo(&This->event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLXDomainRequest_GetIDsOfNames(IHTMLXDomainRequest *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_GetIDsOfNames(&This->event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLXDomainRequest_Invoke(IHTMLXDomainRequest *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return IDispatchEx_Invoke(&This->event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLXDomainRequest_get_responseText(IHTMLXDomainRequest *iface, BSTR *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return HTMLXMLHttpRequest_get_responseText(&This->IHTMLXMLHttpRequest_iface, p); +} + +static HRESULT WINAPI HTMLXDomainRequest_put_timeout(IHTMLXDomainRequest *iface, LONG v) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + FIXME("(%p)->(%ld)\n", This, v); + + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLXDomainRequest_get_timeout(IHTMLXDomainRequest *iface, LONG *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + FIXME("(%p)->(%p)\n", This, p); + + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLXDomainRequest_get_contentType(IHTMLXDomainRequest *iface, BSTR *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + FIXME("(%p)->(%p)\n", This, p); + + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLXDomainRequest_put_onprogress(IHTMLXDomainRequest *iface, VARIANT v) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_event_handler(&This->event_target, EVENTID_PROGRESS, &v); +} + +static HRESULT WINAPI HTMLXDomainRequest_get_onprogress(IHTMLXDomainRequest *iface, VARIANT *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return get_event_handler(&This->event_target, EVENTID_PROGRESS, p); +} + +static HRESULT WINAPI HTMLXDomainRequest_put_onerror(IHTMLXDomainRequest *iface, VARIANT v) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_event_handler(&This->event_target, EVENTID_ERROR, &v); +} + +static HRESULT WINAPI HTMLXDomainRequest_get_onerror(IHTMLXDomainRequest *iface, VARIANT *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return get_event_handler(&This->event_target, EVENTID_ERROR, p); +} + +static HRESULT WINAPI HTMLXDomainRequest_put_ontimeout(IHTMLXDomainRequest *iface, VARIANT v) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_event_handler(&This->event_target, EVENTID_TIMEOUT, &v); +} + +static HRESULT WINAPI HTMLXDomainRequest_get_ontimeout(IHTMLXDomainRequest *iface, VARIANT *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return get_event_handler(&This->event_target, EVENTID_TIMEOUT, p); +} + +static HRESULT WINAPI HTMLXDomainRequest_put_onload(IHTMLXDomainRequest *iface, VARIANT v) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_event_handler(&This->event_target, EVENTID_LOAD, &v); +} + +static HRESULT WINAPI HTMLXDomainRequest_get_onload(IHTMLXDomainRequest *iface, VARIANT *p) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return get_event_handler(&This->event_target, EVENTID_LOAD, p); +} + +static HRESULT WINAPI HTMLXDomainRequest_abort(IHTMLXDomainRequest *iface) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return HTMLXMLHttpRequest_abort(&This->IHTMLXMLHttpRequest_iface); +} + +static HRESULT WINAPI HTMLXDomainRequest_open(IHTMLXDomainRequest *iface, BSTR bstrMethod, BSTR bstrUrl) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + + FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLXDomainRequest_send(IHTMLXDomainRequest *iface, VARIANT varBody) +{ + HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + return HTMLXMLHttpRequest_send(&This->IHTMLXMLHttpRequest_iface, varBody); +} + +static const IHTMLXDomainRequestVtbl HTMLXDomainRequestVtbl = { + HTMLXDomainRequest_QueryInterface, + HTMLXDomainRequest_AddRef, + HTMLXDomainRequest_Release, + HTMLXDomainRequest_GetTypeInfoCount, + HTMLXDomainRequest_GetTypeInfo, + HTMLXDomainRequest_GetIDsOfNames, + HTMLXDomainRequest_Invoke, + HTMLXDomainRequest_get_responseText, + HTMLXDomainRequest_put_timeout, + HTMLXDomainRequest_get_timeout, + HTMLXDomainRequest_get_contentType, + HTMLXDomainRequest_put_onprogress, + HTMLXDomainRequest_get_onprogress, + HTMLXDomainRequest_put_onerror, + HTMLXDomainRequest_get_onerror, + HTMLXDomainRequest_put_ontimeout, + HTMLXDomainRequest_get_ontimeout, + HTMLXDomainRequest_put_onload, + HTMLXDomainRequest_get_onload, + HTMLXDomainRequest_abort, + HTMLXDomainRequest_open, + HTMLXDomainRequest_send +}; + +static void *HTMLXDomainRequest_query_interface(DispatchEx *dispex, REFIID riid) +{ + HTMLXMLHttpRequest *This = impl_from_DispatchEx(dispex); + + if(IsEqualGUID(&IID_IHTMLXDomainRequest, riid)) + return &This->IHTMLXDomainRequest_iface; + + return EventTarget_query_interface(&This->event_target, riid); +} + +static const event_target_vtbl_t HTMLXDomainRequest_event_target_vtbl = { + { + .query_interface = HTMLXDomainRequest_query_interface, + .destructor = HTMLXMLHttpRequest_destructor, + .traverse = HTMLXMLHttpRequest_traverse, + .unlink = HTMLXMLHttpRequest_unlink, + .last_release = HTMLXMLHttpRequest_last_release + }, + .get_gecko_target = HTMLXMLHttpRequest_get_gecko_target, + .bind_event = HTMLXMLHttpRequest_bind_event +}; + +static void HTMLXDomainRequest_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode) +{ + dispex_info_add_interface(info, IHTMLXDomainRequest_tid, NULL); +} + +dispex_static_data_t HTMLXDomainRequest_dispex = { + "XDomainRequest", + &HTMLXDomainRequest_event_target_vtbl.dispex_vtbl, + PROTO_ID_HTMLXDomainRequest, + DispXDomainRequest_tid, + no_iface_tids, + HTMLXDomainRequest_init_dispex_info +}; + + +/* IHTMLXDomainRequestFactory */ +static inline struct global_ctor *impl_from_IHTMLXDomainRequestFactory(IHTMLXDomainRequestFactory *iface) +{ + return CONTAINING_RECORD(iface, struct global_ctor, IHTMLXDomainRequestFactory_iface); +} + +static HRESULT WINAPI HTMLXDomainRequestFactory_QueryInterface(IHTMLXDomainRequestFactory *iface, REFIID riid, void **ppv) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_QueryInterface(&This->dispex.IDispatchEx_iface, riid, ppv); +} + +static ULONG WINAPI HTMLXDomainRequestFactory_AddRef(IHTMLXDomainRequestFactory *iface) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_AddRef(&This->dispex.IDispatchEx_iface); +} + +static ULONG WINAPI HTMLXDomainRequestFactory_Release(IHTMLXDomainRequestFactory *iface) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_Release(&This->dispex.IDispatchEx_iface); +} + +static HRESULT WINAPI HTMLXDomainRequestFactory_GetTypeInfoCount(IHTMLXDomainRequestFactory *iface, UINT *pctinfo) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLXDomainRequestFactory_GetTypeInfo(IHTMLXDomainRequestFactory *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLXDomainRequestFactory_GetIDsOfNames(IHTMLXDomainRequestFactory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); +} + +static HRESULT WINAPI HTMLXDomainRequestFactory_Invoke(IHTMLXDomainRequestFactory *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLXDomainRequestFactory_create(IHTMLXDomainRequestFactory *iface, IHTMLXDomainRequest **p) +{ + struct global_ctor *This = impl_from_IHTMLXDomainRequestFactory(iface); + HTMLXMLHttpRequest *xhr; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + hres = create_xhr(This->window, &HTMLXDomainRequest_dispex, &xhr); + if(FAILED(hres)) + return hres; + + xhr->IHTMLXDomainRequest_iface.lpVtbl = &HTMLXDomainRequestVtbl; + + *p = &xhr->IHTMLXDomainRequest_iface; + return hres; +} + +const IHTMLXDomainRequestFactoryVtbl HTMLXDomainRequestFactoryVtbl = { + HTMLXDomainRequestFactory_QueryInterface, + HTMLXDomainRequestFactory_AddRef, + HTMLXDomainRequestFactory_Release, + HTMLXDomainRequestFactory_GetTypeInfoCount, + HTMLXDomainRequestFactory_GetTypeInfo, + HTMLXDomainRequestFactory_GetIDsOfNames, + HTMLXDomainRequestFactory_Invoke, + HTMLXDomainRequestFactory_create +}; + +static void *HTMLXDomainRequestFactory_query_interface(DispatchEx *dispex, REFIID riid) +{ + struct global_ctor *This = ctor_from_DispatchEx(dispex); + + if(IsEqualGUID(&IID_IHTMLXDomainRequestFactory, riid)) + return &This->IHTMLXDomainRequestFactory_iface; + + return NULL; +} + +static HRESULT HTMLXDomainRequestFactory_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + struct global_ctor *This = ctor_from_DispatchEx(iface); + IHTMLXDomainRequest *xdr; + HRESULT hres; + + TRACE("\n"); + + if(flags != DISPATCH_CONSTRUCT) + return S_FALSE; + + hres = IHTMLXDomainRequestFactory_create(&This->IHTMLXDomainRequestFactory_iface, &xdr); + if(FAILED(hres)) + return hres; + + V_VT(res) = VT_DISPATCH; + V_DISPATCH(res) = (IDispatch*)xdr; + return hres; +} + +static const dispex_static_data_vtbl_t HTMLXDomainRequestFactory_dispex_vtbl = { + .query_interface = HTMLXDomainRequestFactory_query_interface, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = HTMLXDomainRequestFactory_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + +static const tid_t HTMLXDomainRequestFactory_iface_tids[] = { + IHTMLXDomainRequestFactory_tid, + 0 +}; + +dispex_static_data_t HTMLXDomainRequestFactory_dispex = { + "XDomainRequest", + &HTMLXDomainRequestFactory_dispex_vtbl, + PROTO_ID_NULL, + IHTMLXDomainRequestFactory_tid, + HTMLXDomainRequestFactory_iface_tids +}; + +static HRESULT HTMLXDomainRequestCtor_value(DispatchEx *iface, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + if(flags == DISPATCH_CONSTRUCT) + return HTMLXDomainRequestFactory_value(iface, lcid, flags, params, res, ei, caller); + + return global_ctor_value(iface, lcid, flags, params, res, ei, caller); +} + +static const dispex_static_data_vtbl_t HTMLXDomainRequestCtor_dispex_vtbl = { + .query_interface = HTMLXDomainRequestFactory_query_interface, + .destructor = global_ctor_destructor, + .traverse = global_ctor_traverse, + .unlink = global_ctor_unlink, + .value = HTMLXDomainRequestCtor_value, + .get_dispid = legacy_ctor_get_dispid, + .get_name = legacy_ctor_get_name, + .invoke = legacy_ctor_invoke, + .delete = legacy_ctor_delete +}; + +dispex_static_data_t HTMLXDomainRequestCtor_dispex = { + "XDomainRequest", + &HTMLXDomainRequestCtor_dispex_vtbl, + PROTO_ID_NULL, + IHTMLXDomainRequestFactory_tid, + HTMLXDomainRequestFactory_iface_tids +}; From 26dd7c3ab996845728e81ba752fec17130971f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:31 +0200 Subject: [PATCH 1026/1506] mshtml: Implement XDomainRequest.open(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/tests/xhr.js | 24 +++++ dlls/mshtml/tests/xmlhttprequest.c | 137 +++++++++++++++++++++++++++++ dlls/mshtml/xmlhttprequest.c | 54 +++++++++++- 3 files changed, 213 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 045892bd346..27c82fec00e 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -237,6 +237,29 @@ function test_sync_xhr() { }, 0); } +function test_xdr() { + if(!window.XDomainRequest) { next_test(); return; } + + var xdr = new XDomainRequest(); + xdr.open("POST", "echo.php"); + // send() on native aborts with custom pluggable protocol handler even with the right + // response headers (`XDomainRequestAllowed: 1` and `Access-Control-Allow-Origin: *`). + + // Only http/https schemes are allowed, and it must match with the origin's scheme + xdr = new XDomainRequest(); + xdr.open("GET", "http://www.winehq.org/"); + + xdr = new XDomainRequest(); + try { + xdr.open("GET", "https://www.winehq.org/"); + ok(false, "xdr scheme mismatch did not throw exception"); + }catch(ex) { + var n = ex.number >>> 0; + ok(n === 0x80070005, "xdr scheme mismatch threw " + n); + } + next_test(); +} + function test_content_types() { var xhr = new XMLHttpRequest(), types, i = 0, override = false; var v = document.documentMode; @@ -465,6 +488,7 @@ function test_response() { var tests = [ test_xhr, test_sync_xhr, + test_xdr, test_content_types, test_abort, test_timeout, diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index 44132160520..565d82101af 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -63,6 +63,7 @@ DEFINE_EXPECT(xmlhttprequest_onreadystatechange_opened); DEFINE_EXPECT(xmlhttprequest_onreadystatechange_headers_received); DEFINE_EXPECT(xmlhttprequest_onreadystatechange_loading); DEFINE_EXPECT(xmlhttprequest_onreadystatechange_done); +DEFINE_EXPECT(xdomainrequest_onload); #define test_disp(u,id) _test_disp(__LINE__,u,id) static void _test_disp(unsigned line, IUnknown *unk, const IID *diid, const IID *broken_diid) @@ -266,6 +267,58 @@ static IDispatchExVtbl xmlhttprequest_onreadystatechangeFuncVtbl = { }; static IDispatchEx xmlhttprequest_onreadystatechange_obj = { &xmlhttprequest_onreadystatechangeFuncVtbl }; +static HRESULT WINAPI xdomainrequest_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + test_event_args(&DIID_DispXDomainRequest, &IID_IHTMLXDomainRequest, id, wFlags, pdp, pvarRes, pei, pspCaller); + CHECK_EXPECT(xdomainrequest_onload); + return S_OK; +} + +static IDispatchExVtbl xdomainrequest_onloadFuncVtbl = { + DispatchEx_QueryInterface, + DispatchEx_AddRef, + DispatchEx_Release, + DispatchEx_GetTypeInfoCount, + DispatchEx_GetTypeInfo, + DispatchEx_GetIDsOfNames, + DispatchEx_Invoke, + DispatchEx_GetDispID, + xdomainrequest_onload, + DispatchEx_DeleteMemberByName, + DispatchEx_DeleteMemberByDispID, + DispatchEx_GetMemberProperties, + DispatchEx_GetMemberName, + DispatchEx_GetNextDispID, + DispatchEx_GetNameSpaceParent +}; +static IDispatchEx xdomainrequest_onload_obj = { &xdomainrequest_onloadFuncVtbl }; + +static HRESULT WINAPI xdomainrequest_ignore(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + return S_OK; +} + +static IDispatchExVtbl xdomainrequest_ignoreFuncVtbl = { + DispatchEx_QueryInterface, + DispatchEx_AddRef, + DispatchEx_Release, + DispatchEx_GetTypeInfoCount, + DispatchEx_GetTypeInfo, + DispatchEx_GetIDsOfNames, + DispatchEx_Invoke, + DispatchEx_GetDispID, + xdomainrequest_ignore, + DispatchEx_DeleteMemberByName, + DispatchEx_DeleteMemberByDispID, + DispatchEx_GetMemberProperties, + DispatchEx_GetMemberName, + DispatchEx_GetNextDispID, + DispatchEx_GetNameSpaceParent +}; +static IDispatchEx xdomainrequest_ignore_obj = { &xdomainrequest_ignoreFuncVtbl }; + static BOOL doc_complete; static IHTMLDocument2 *notif_doc; @@ -1081,6 +1134,89 @@ static void test_timeout(IHTMLDocument2 *doc) IHTMLXMLHttpRequest2_Release(xhr2); } +static void test_xdr(IHTMLDocument2 *doc) +{ + IHTMLXDomainRequestFactory *factory; + IHTMLXDomainRequest *xdr; + IHTMLWindow6 *window6; + IHTMLWindow2 *window; + BSTR bstr, url; + HRESULT hres; + VARIANT v; + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + ok(window != NULL, "window == NULL\n"); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow6, (void**)&window6); + IHTMLWindow2_Release(window); + if(FAILED(hres)) { + win_skip("IHTMLWindow6 not supported\n"); + return; + } + + VariantInit(&v); + hres = IHTMLWindow6_get_XDomainRequest(window6, &v); + IHTMLWindow6_Release(window6); + ok(hres == S_OK, "get_XDomainRequest failed: %08lx\n", hres); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(&v) is %08x, expected VT_DISPATCH\n", V_VT(&v)); + + hres = IDispatch_QueryInterface(V_DISPATCH(&v), &IID_IHTMLXDomainRequestFactory, (void**)&factory); + VariantClear(&v); + ok(hres == S_OK, "QueryInterface(IID_IXDomainRequestFactory) failed: %08lx\n", hres); + ok(factory != NULL, "factory == NULL\n"); + + hres = IHTMLXDomainRequestFactory_create(factory, &xdr); + IHTMLXDomainRequestFactory_Release(factory); + ok(hres == S_OK, "create failed: %08lx\n", hres); + ok(xdr != NULL, "xdr == NULL\n"); + + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = (IDispatch*)&xdomainrequest_onload_obj; + hres = IHTMLXDomainRequest_put_onload(xdr, v); + ok(hres == S_OK, "put_onload failed: %08lx\n", hres); + + V_VT(&v) = VT_EMPTY; + hres = IHTMLXDomainRequest_get_onload(xdr, &v); + ok(hres == S_OK, "get_onload failed: %08lx\n", hres); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) == (IDispatch*)&xdomainrequest_onload_obj, "unexpected onload value\n"); + VariantClear(&v); + + /* Native IE9 sometimes (rarely) aborts if the other handlers are not set */ + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = (IDispatch*)&xdomainrequest_ignore_obj; + hres = IHTMLXDomainRequest_put_onerror(xdr, v); + ok(hres == S_OK, "put_onerror failed: %08lx\n", hres); + hres = IHTMLXDomainRequest_put_onprogress(xdr, v); + ok(hres == S_OK, "put_onprogress failed: %08lx\n", hres); + hres = IHTMLXDomainRequest_put_ontimeout(xdr, v); + ok(hres == S_OK, "put_ontimeout failed: %08lx\n", hres); + + bstr = SysAllocString(L"GET"); + url = SysAllocString(L"http://test.winehq.org/tests/cors.html"); + hres = IHTMLXDomainRequest_open(xdr, bstr, url); + ok(hres == S_OK, "open failed: %08lx\n", hres); + SysFreeString(bstr); + SysFreeString(url); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = SysAllocString(L"test"); + SET_EXPECT(xdomainrequest_onload); + hres = IHTMLXDomainRequest_send(xdr, v); + ok(hres == S_OK, "send failed: %08lx\n", hres); + if(SUCCEEDED(hres)) + pump_msgs(&called_xdomainrequest_onload); + CHECK_CALLED(xdomainrequest_onload); + + hres = IHTMLXDomainRequest_get_responseText(xdr, &bstr); + ok(hres == S_OK, "get_contentType returned %08lx\n", hres); + ok(!lstrcmpW(bstr, L"test\n"), "responseText = %s\n", debugstr_w(bstr)); + SysFreeString(bstr); + + IHTMLXDomainRequest_Release(xdr); +} + static IHTMLDocument2 *create_doc_from_url(const WCHAR *start_url) { BSTR url; @@ -1147,6 +1283,7 @@ START_TEST(xmlhttprequest) test_async_xhr_abort(doc, large_page_url); test_xhr_post(doc); test_timeout(doc); + test_xdr(doc); IHTMLDocument2_Release(doc); } SysFreeString(content_type); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 3c6b20a3908..158787cbbdb 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -2067,10 +2067,60 @@ static HRESULT WINAPI HTMLXDomainRequest_abort(IHTMLXDomainRequest *iface) static HRESULT WINAPI HTMLXDomainRequest_open(IHTMLXDomainRequest *iface, BSTR bstrMethod, BSTR bstrUrl) { HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + VARIANT vtrue, vempty; + nsACString str1, str2; + nsAString nsstr; + nsresult nsres; + HRESULT hres; + DWORD magic; + WCHAR *p; - FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl)); + TRACE("(%p)->(%s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl)); - return E_NOTIMPL; + if((p = wcschr(bstrUrl, ':')) && p[1] == '/' && p[2] == '/') { + size_t len = p - bstrUrl; + BSTR bstr; + + /* Native only allows http and https, and the scheme must match */ + if(len < 4 || len > 5 || wcsnicmp(bstrUrl, L"https", len) || !This->window->base.outer_window || !This->window->base.outer_window->uri) + return E_ACCESSDENIED; + + hres = IUri_GetSchemeName(This->window->base.outer_window->uri, &bstr); + if(FAILED(hres)) + return hres; + if(SysStringLen(bstr) != len || wcsnicmp(bstr, bstrUrl, len)) + hres = E_ACCESSDENIED; + SysFreeString(bstr); + if(FAILED(hres)) + return hres; + } + + V_VT(&vtrue) = VT_BOOL; + V_BOOL(&vtrue) = VARIANT_TRUE; + V_VT(&vempty) = VT_EMPTY; + magic = This->magic; + hres = HTMLXMLHttpRequest_open(&This->IHTMLXMLHttpRequest_iface, bstrMethod, bstrUrl, vtrue, vempty, vempty); + if(FAILED(hres) || magic != This->magic) + return hres; + + /* Prevent Gecko from parsing responseXML for no reason */ + nsAString_InitDepend(&nsstr, L"text/plain"); + nsIXMLHttpRequest_SlowOverrideMimeType(This->nsxhr, &nsstr); + nsAString_Finish(&nsstr); + + /* XDomainRequest only accepts text/plain */ + nsACString_InitDepend(&str1, "Accept"); + nsACString_InitDepend(&str2, "text/plain"); + nsres = nsIXMLHttpRequest_SetRequestHeader(This->nsxhr, &str1, &str2); + nsACString_Finish(&str1); + nsACString_Finish(&str2); + if(NS_FAILED(nsres)) { + ERR("nsIXMLHttpRequest_SetRequestHeader failed: %08lx\n", nsres); + return map_nsresult(nsres); + } + + /* IE always adds Origin header, even from same origin, but Gecko doesn't allow us to alter it. */ + return S_OK; } static HRESULT WINAPI HTMLXDomainRequest_send(IHTMLXDomainRequest *iface, VARIANT varBody) From ae498736f35e92b46872665377c2a0ac1cba5e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:32 +0200 Subject: [PATCH 1027/1506] mshtml: Implement timeout for XDomainRequest. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/tests/xmlhttprequest.c | 15 +++++++++++++++ dlls/mshtml/xmlhttprequest.c | 17 +++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index 565d82101af..846cdc0aec8 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -1142,6 +1142,7 @@ static void test_xdr(IHTMLDocument2 *doc) IHTMLWindow2 *window; BSTR bstr, url; HRESULT hres; + LONG timeout; VARIANT v; hres = IHTMLDocument2_get_parentWindow(doc, &window); @@ -1200,6 +1201,20 @@ static void test_xdr(IHTMLDocument2 *doc) SysFreeString(bstr); SysFreeString(url); + hres = IHTMLXDomainRequest_get_timeout(xdr, NULL); + ok(hres == E_INVALIDARG, "get_timeout returned %08lx\n", hres); + hres = IHTMLXDomainRequest_get_timeout(xdr, &timeout); + ok(hres == S_OK, "get_timeout returned %08lx\n", hres); + ok(timeout == -1, "timeout = %ld\n", timeout); + + hres = IHTMLXDomainRequest_put_timeout(xdr, -1); + ok(hres == E_INVALIDARG || broken(hres == E_FAIL), "put_timeout returned %08lx\n", hres); + hres = IHTMLXDomainRequest_put_timeout(xdr, 1337); + ok(hres == S_OK, "put_timeout returned %08lx\n", hres); + hres = IHTMLXDomainRequest_get_timeout(xdr, &timeout); + ok(hres == S_OK, "get_timeout returned %08lx\n", hres); + ok(timeout == 1337, "timeout = %ld\n", timeout); + V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(L"test"); SET_EXPECT(xdomainrequest_onload); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 158787cbbdb..bfc55b16b72 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1963,18 +1963,27 @@ static HRESULT WINAPI HTMLXDomainRequest_put_timeout(IHTMLXDomainRequest *iface, { HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); - FIXME("(%p)->(%ld)\n", This, v); + TRACE("(%p)->(%ld)\n", This, v); - return E_NOTIMPL; + if(v < 0) + return E_INVALIDARG; + return map_nsresult(nsIXMLHttpRequest_SetTimeout(This->nsxhr, v)); } static HRESULT WINAPI HTMLXDomainRequest_get_timeout(IHTMLXDomainRequest *iface, LONG *p) { HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + nsresult nsres; + UINT32 timeout; - FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + if(!p) + return E_INVALIDARG; + + nsres = nsIXMLHttpRequest_GetTimeout(This->nsxhr, &timeout); + *p = timeout ? timeout : -1; + return map_nsresult(nsres); } static HRESULT WINAPI HTMLXDomainRequest_get_contentType(IHTMLXDomainRequest *iface, BSTR *p) From 242061897361c636f0f55c8c250a9e69a2dee037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:32 +0200 Subject: [PATCH 1028/1506] mshtml: Implement contentType for XDomainRequest. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/tests/dom.c | 5 ++++ dlls/mshtml/tests/xmlhttprequest.c | 13 ++++++++++ dlls/mshtml/xmlhttprequest.c | 38 ++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 8e995462fbc..36863d2ac62 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -7332,6 +7332,7 @@ static void test_xdomainrequest(IHTMLWindow6 *window) IHTMLXDomainRequest *xdr; HRESULT hres; VARIANT var; + BSTR bstr; hres = IHTMLWindow6_get_XDomainRequest(window, &var); ok(hres == S_OK, "get_XDomainRequest failed: %08lx\n", hres); @@ -7356,6 +7357,10 @@ static void test_xdomainrequest(IHTMLWindow6 *window) if(is_ie9plus) test_disp((IUnknown*)xdr, &DIID_DispXDomainRequest, NULL, L"[object]"); + hres = IHTMLXDomainRequest_get_contentType(xdr, &bstr); + ok(hres == S_OK, "get_contentType returned %08lx\n", hres); + ok(bstr == NULL, "contentType = %s\n", debugstr_w(bstr)); + IHTMLXDomainRequest_Release(xdr); IHTMLXDomainRequestFactory_Release(factory); VariantClear(&var); diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c index 846cdc0aec8..c9e76ae7eb7 100644 --- a/dlls/mshtml/tests/xmlhttprequest.c +++ b/dlls/mshtml/tests/xmlhttprequest.c @@ -1194,6 +1194,10 @@ static void test_xdr(IHTMLDocument2 *doc) hres = IHTMLXDomainRequest_put_ontimeout(xdr, v); ok(hres == S_OK, "put_ontimeout failed: %08lx\n", hres); + hres = IHTMLXDomainRequest_get_contentType(xdr, &bstr); + ok(hres == S_OK, "get_contentType returned %08lx\n", hres); + ok(bstr == NULL, "contentType = %s\n", debugstr_w(bstr)); + bstr = SysAllocString(L"GET"); url = SysAllocString(L"http://test.winehq.org/tests/cors.html"); hres = IHTMLXDomainRequest_open(xdr, bstr, url); @@ -1201,6 +1205,10 @@ static void test_xdr(IHTMLDocument2 *doc) SysFreeString(bstr); SysFreeString(url); + hres = IHTMLXDomainRequest_get_contentType(xdr, &bstr); + ok(hres == S_OK, "get_contentType returned %08lx\n", hres); + ok(bstr == NULL, "contentType = %s\n", debugstr_w(bstr)); + hres = IHTMLXDomainRequest_get_timeout(xdr, NULL); ok(hres == E_INVALIDARG, "get_timeout returned %08lx\n", hres); hres = IHTMLXDomainRequest_get_timeout(xdr, &timeout); @@ -1229,6 +1237,11 @@ static void test_xdr(IHTMLDocument2 *doc) ok(!lstrcmpW(bstr, L"test\n"), "responseText = %s\n", debugstr_w(bstr)); SysFreeString(bstr); + hres = IHTMLXDomainRequest_get_contentType(xdr, &bstr); + ok(hres == S_OK, "get_contentType returned %08lx\n", hres); + ok(!lstrcmpW(bstr, L"text/html"), "contentType = %s\n", debugstr_w(bstr)); + SysFreeString(bstr); + IHTMLXDomainRequest_Release(xdr); } diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index bfc55b16b72..5db01e52878 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -1989,10 +1989,44 @@ static HRESULT WINAPI HTMLXDomainRequest_get_timeout(IHTMLXDomainRequest *iface, static HRESULT WINAPI HTMLXDomainRequest_get_contentType(IHTMLXDomainRequest *iface, BSTR *p) { HTMLXMLHttpRequest *This = impl_from_IHTMLXDomainRequest(iface); + nsAString nsstr; + nsresult nsres; + HRESULT hres; - FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + if(!p) + return E_POINTER; + + if(This->ready_state < READYSTATE_LOADED) { + *p = NULL; + return S_OK; + } + + nsAString_InitDepend(&nsstr, NULL); + nsres = nsIXMLHttpRequest_GetResponseText(This->nsxhr, &nsstr); + if(NS_SUCCEEDED(nsres)) { + const PRUnichar *data; + char text[256 * 3]; + unsigned len; + WCHAR *mime; + + nsAString_GetData(&nsstr, &data); + len = WideCharToMultiByte(CP_ACP, 0, data, wcsnlen(data, 256), text, ARRAY_SIZE(text), NULL, NULL); + nsAString_Finish(&nsstr); + + if(len) { + hres = FindMimeFromData(NULL, NULL, text, len, NULL, 0, &mime, 0); + if(SUCCEEDED(hres)) { + *p = SysAllocString(mime); + CoTaskMemFree(mime); + return *p ? S_OK : E_OUTOFMEMORY; + } + } + } + + *p = SysAllocString(L"text/plain"); + return *p ? S_OK : E_OUTOFMEMORY; } static HRESULT WINAPI HTMLXDomainRequest_put_onprogress(IHTMLXDomainRequest *iface, VARIANT v) From 21e0d244da3336a640006e4e25ae28d7612a2c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Wed, 13 Dec 2023 20:03:32 +0200 Subject: [PATCH 1029/1506] mshtml: Implement "arraybuffer" type response for XMLHttpRequest. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/jscript/arraybuf.c | 20 ++++++++++++++++++++ dlls/jscript/dispex.c | 1 + dlls/jscript/jscript.h | 2 ++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/xhr.js | 14 ++++++++++++++ dlls/mshtml/xmlhttprequest.c | 36 ++++++++++++++++++++++++++++++++++-- 6 files changed, 72 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/arraybuf.c b/dlls/jscript/arraybuf.c index c4ecee88350..d2807a7917e 100644 --- a/dlls/jscript/arraybuf.c +++ b/dlls/jscript/arraybuf.c @@ -1295,6 +1295,26 @@ static const builtin_info_t TypedArrayConstr_info = { NULL }; +static inline jsdisp_t *impl_from_IWineDispatchProxyCbPrivate(IWineDispatchProxyCbPrivate *iface) +{ + return CONTAINING_RECORD((IDispatchEx*)iface, jsdisp_t, IDispatchEx_iface); +} + +HRESULT WINAPI WineDispatchProxyCbPrivate_CreateArrayBuffer(IWineDispatchProxyCbPrivate *iface, DWORD size, IDispatch **arraybuf, void **data) +{ + jsdisp_t *This = impl_from_IWineDispatchProxyCbPrivate(iface); + jsdisp_t *obj; + HRESULT hres; + + hres = create_arraybuf(This->ctx, size, &obj); + if(FAILED(hres)) + return hres; + + *arraybuf = (IDispatch*)&obj->IDispatchEx_iface; + *data = arraybuf_from_jsdisp(obj)->buf; + return S_OK; +} + HRESULT WINAPI WineDispatchProxyCbPrivate_GetRandomValues(IDispatch *disp) { jsdisp_t *obj = to_jsdisp(disp); diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 7b288eea424..6cd5de0c9a4 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2821,6 +2821,7 @@ static IWineDispatchProxyCbPrivateVtbl WineDispatchProxyCbPrivateVtbl = { WineDispatchProxyCbPrivate_CreateConstructor, WineDispatchProxyCbPrivate_DefineConstructor, WineDispatchProxyCbPrivate_CreateObject, + WineDispatchProxyCbPrivate_CreateArrayBuffer, WineDispatchProxyCbPrivate_GetRandomValues, WineDispatchProxyCbPrivate_PropEnum }; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 90a1561950f..b681080946c 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -127,6 +127,7 @@ typedef struct { IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); HRESULT (STDMETHODCALLTYPE *CreateObject)(IWineDispatchProxyCbPrivate *This, IDispatchEx **obj); + HRESULT (STDMETHODCALLTYPE *CreateArrayBuffer)(IWineDispatchProxyCbPrivate *This, DWORD size, IDispatch **arraybuf, void **data); HRESULT (STDMETHODCALLTYPE *GetRandomValues)(IDispatch *typedarr); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; @@ -748,4 +749,5 @@ static inline void unlock_module(void) InterlockedDecrement(&module_ref); } +HRESULT WINAPI WineDispatchProxyCbPrivate_CreateArrayBuffer(IWineDispatchProxyCbPrivate*,DWORD,IDispatch**,void**); HRESULT WINAPI WineDispatchProxyCbPrivate_GetRandomValues(IDispatch*); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index a290562cf60..5683d6add25 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -118,6 +118,7 @@ typedef struct { IDispatch* (STDMETHODCALLTYPE *CreateConstructor)(IWineDispatchProxyCbPrivate *This, IDispatch *disp, const char *name); HRESULT (STDMETHODCALLTYPE *DefineConstructor)(IWineDispatchProxyCbPrivate *This, const char *name, IDispatch *prot, IDispatch *ctor); HRESULT (STDMETHODCALLTYPE *CreateObject)(IWineDispatchProxyCbPrivate *This, IDispatchEx **obj); + HRESULT (STDMETHODCALLTYPE *CreateArrayBuffer)(IWineDispatchProxyCbPrivate *This, DWORD size, IDispatch **arraybuf, void **data); HRESULT (STDMETHODCALLTYPE *GetRandomValues)(IDispatch *typedarr); HRESULT (STDMETHODCALLTYPE *PropEnum)(IWineDispatchProxyCbPrivate *This, const WCHAR *name); } IWineDispatchProxyCbPrivateVtbl; diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 27c82fec00e..65e14c86543 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -455,6 +455,20 @@ function test_response() { [ "arraybuffer", "image/png", function() { if(xhr.readyState < 4) ok(xhr.response === undefined, "response for arraybuffer with state " + state + " = " + xhr.response); + else { + var buf = xhr.response; + ok(buf instanceof ArrayBuffer, "response for arraybuffer not instanceof ArrayBuffer"); + ok(buf.byteLength === xml.length, "response for arraybuffer byteLength = " + buf.byteLength); + buf = new Uint8Array(buf); + for(var i = 0; i < buf.length; i++) { + if(buf[i] !== xml.charCodeAt(i)) { + var a = new Array(buf.length); + for(var j = 0; j < a.length; j++) a[j] = buf[j]; + ok(false, "response for arraybuffer is wrong (first bad char at pos " + i + "): " + a); + break; + } + } + } }], [ "blob", "wine/test", function() { if(xhr.readyState < 4) diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 5db01e52878..01989ee76af 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -144,6 +144,7 @@ struct HTMLXMLHttpRequest { BOOLEAN synchronous; DWORD magic; DWORD pending_events_magic; + IDispatch *response_obj; HTMLInnerWindow *window; nsIXMLHttpRequest *nsxhr; XMLHttpReqEventListener *event_listener; @@ -1194,10 +1195,21 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_Invoke(IWineXMLHttpRequestPriva static HRESULT WINAPI HTMLXMLHttpRequest_private_get_response(IWineXMLHttpRequestPrivate *iface, VARIANT *p) { HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface); + IWineDispatchProxyCbPrivate *proxy; HRESULT hres = S_OK; + UINT32 buf_size; + nsresult nsres; + void *buf; TRACE("(%p)->(%p)\n", This, p); + if(This->response_obj) { + V_VT(p) = VT_DISPATCH; + V_DISPATCH(p) = This->response_obj; + IDispatch_AddRef(This->response_obj); + return S_OK; + } + switch(This->response_type) { case response_type_empty: case response_type_text: @@ -1216,10 +1228,22 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_get_response(IWineXMLHttpReques V_VT(p) = VT_EMPTY; break; } - if(This->response_type == response_type_arraybuf) { - FIXME("response_type_arraybuf\n"); + if(!(proxy = This->event_target.dispex.proxy)) { + FIXME("No proxy\n"); return E_NOTIMPL; } + nsres = nsIXMLHttpRequest_GetResponseBuffer(This->nsxhr, NULL, 0, &buf_size); + assert(nsres == NS_OK); + + if(This->response_type == response_type_arraybuf) { + hres = proxy->lpVtbl->CreateArrayBuffer(proxy, buf_size, &This->response_obj, &buf); + if(SUCCEEDED(hres)) { + nsres = nsIXMLHttpRequest_GetResponseBuffer(This->nsxhr, buf, buf_size, &buf_size); + assert(nsres == NS_OK); + } + break; + } + FIXME("response_type_blob\n"); return E_NOTIMPL; @@ -1231,6 +1255,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_get_response(IWineXMLHttpReques assert(0); } + if(SUCCEEDED(hres) && This->response_obj) { + V_VT(p) = VT_DISPATCH; + V_DISPATCH(p) = This->response_obj; + IDispatch_AddRef(This->response_obj); + } return hres; } @@ -1555,6 +1584,8 @@ static void HTMLXMLHttpRequest_traverse(DispatchEx *dispex, nsCycleCollectionTra note_cc_edge((nsISupports*)&This->window->base.IHTMLWindow2_iface, "window", cb); if(This->pending_progress_event) note_cc_edge((nsISupports*)&This->pending_progress_event->IDOMEvent_iface, "pending_progress_event", cb); + if(This->response_obj) + note_cc_edge((nsISupports*)This->response_obj, "response_obj", cb); if(This->nsxhr) note_cc_edge((nsISupports*)This->nsxhr, "nsxhr", cb); traverse_event_target(&This->event_target, cb); @@ -1578,6 +1609,7 @@ static void HTMLXMLHttpRequest_unlink(DispatchEx *dispex) This->pending_progress_event = NULL; IDOMEvent_Release(&pending_progress_event->IDOMEvent_iface); } + unlink_ref(&This->response_obj); unlink_ref(&This->nsxhr); release_event_target(&This->event_target); } From db9fcd2a0d19d1085cc2f99fbc32035ec501e451 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 1 Apr 2020 11:47:05 -0500 Subject: [PATCH 1030/1506] winebrowser: Restore original LD_LIBRARY_PATH before calling to system --- dlls/ntdll/unix/env.c | 3 ++- programs/winebrowser/main.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 29f5aa2b17f..c2c46dd0a12 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -2507,6 +2507,7 @@ void WINAPI RtlSetLastWin32Error( DWORD err ) */ NTSTATUS WINAPI __wine_set_unix_env( const char *var, const char *val ) { - setenv(var, val, 1); + if (!val) unsetenv(var); + else setenv(var, val, 1); return 0; } diff --git a/programs/winebrowser/main.c b/programs/winebrowser/main.c index 24416070152..738930e39a6 100644 --- a/programs/winebrowser/main.c +++ b/programs/winebrowser/main.c @@ -63,6 +63,17 @@ static char *strdup_unixcp( const WCHAR *str ) return ret; } +static void restore_system_environment(void) +{ + const char* orig_ld_path = getenv("ORIG_LD_LIBRARY_PATH"); + + if (orig_ld_path) + { + __wine_set_unix_env("LD_LIBRARY_PATH", orig_ld_path); + __wine_set_unix_env("ORIG_LD_LIBRARY_PATH", NULL); + } +} + /* try to launch a unix app from a comma separated string of app names */ static int launch_app( const WCHAR *candidates, const WCHAR *argv1 ) { @@ -72,6 +83,11 @@ static int launch_app( const WCHAR *candidates, const WCHAR *argv1 ) if (!(cmdline = strdup_unixcp( argv1 ))) return 1; + /* PROTON HACK: Restore ORIG_LD_LIBRARY_PATH to LD_LIBRARY_PATH. + * System programs may not work correctly with our libraries, in + * particular gio on Ubuntu 19.04 is broken by our libgio. */ + restore_system_environment(); + while (*candidates) { WCHAR **args = CommandLineToArgvW( candidates, &count ); From 124b98506fd7f289b71fbad79d10df24d953e09d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 8 Mar 2021 16:41:19 +0100 Subject: [PATCH 1031/1506] webservices: Prefer native. CW-Bug-Id: #18637 --- dlls/webservices/Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/webservices/Makefile.in b/dlls/webservices/Makefile.in index 78b7e06af4b..8a613eb6414 100644 --- a/dlls/webservices/Makefile.in +++ b/dlls/webservices/Makefile.in @@ -2,6 +2,8 @@ MODULE = webservices.dll IMPORTLIB = webservices IMPORTS = winhttp rpcrt4 user32 ws2_32 +EXTRADLLFLAGS = -Wb,--prefer-native + SOURCES = \ channel.c \ error.c \ From f94a13a11c7595c99988279caf250580fb77f8a7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 8 Dec 2021 23:36:27 +0100 Subject: [PATCH 1032/1506] kernelbase: Ignore LOAD_LIBRARY_SEARCH_SYSTEM32 flags for webservices.dll in LoadLibraryExW. CW-Bug-Id: #18637 --- dlls/kernelbase/loader.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/kernelbase/loader.c b/dlls/kernelbase/loader.c index f9aad8e1207..cbb6e49dab2 100644 --- a/dlls/kernelbase/loader.c +++ b/dlls/kernelbase/loader.c @@ -536,6 +536,14 @@ HMODULE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW( LPCWSTR name, HANDLE file, DWOR SetLastError( ERROR_INVALID_PARAMETER ); return 0; } + + /* HACK: allow webservices.dll to be shipped together with remote debugger tools. */ + if (flags == LOAD_LIBRARY_SEARCH_SYSTEM32 && !file && !wcscmp( name, L"webservices.dll" )) + { + FIXME( "HACK: ignoring LOAD_LIBRARY_SEARCH_SYSTEM32 for webservices.dll\n" ); + flags = 0; + } + RtlInitUnicodeString( &str, name ); if (str.Buffer[str.Length/sizeof(WCHAR) - 1] != ' ') return load_library( &str, flags ); From f567f48aa978aae1521b78949e63e1395ea88062 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 19 May 2021 13:33:36 -0400 Subject: [PATCH 1033/1506] winevulkan: Implement VK_KHR_external_memory_win32 for buffers. Signed-off-by: Derek Lesho --- dlls/vulkan-1/tests/vulkan.c | 5 +- dlls/winevulkan/make_vulkan | 51 ++++-- dlls/winevulkan/vulkan.c | 260 +++++++++++++++++++++++++++++-- dlls/winevulkan/vulkan_private.h | 9 ++ 4 files changed, 295 insertions(+), 30 deletions(-) diff --git a/dlls/vulkan-1/tests/vulkan.c b/dlls/vulkan-1/tests/vulkan.c index 74b9ccd4431..c93b06ea385 100644 --- a/dlls/vulkan-1/tests/vulkan.c +++ b/dlls/vulkan-1/tests/vulkan.c @@ -624,8 +624,9 @@ static void import_memory(VkDevice vk_device, VkMemoryAllocateInfo alloc_info, V import_handle_info.name = L"wine_test_buffer_export_name"; vr = vkAllocateMemory(vk_device, &alloc_info, NULL, &memory); - ok(vr == VK_SUCCESS, "vkAllocateMemory failed, VkResult %d.\n", vr); - vkFreeMemory(vk_device, memory, NULL); + todo_wine ok(vr == VK_SUCCESS, "vkAllocateMemory failed, VkResult %d.\n", vr); + if (vr == VK_SUCCESS) + vkFreeMemory(vk_device, memory, NULL); } } diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 874e1b51acb..3d5578b6527 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -113,7 +113,6 @@ UNSUPPORTED_EXTENSIONS = [ "VK_EXT_physical_device_drm", "VK_GOOGLE_surfaceless_query", "VK_KHR_external_fence_fd", - "VK_KHR_external_memory_fd", "VK_KHR_external_semaphore_fd", "VK_SEC_amigo_profiling", # Angle specific. @@ -129,7 +128,6 @@ UNSUPPORTED_EXTENSIONS = [ # winevulkan may nonetheless use, or extensions we want to generate headers for # but not expose to applications (useful for test commits) UNEXPOSED_EXTENSIONS = { - "VK_KHR_external_memory_win32", } # The Vulkan loader provides entry-points for core functionality and important @@ -174,22 +172,27 @@ FUNCTION_OVERRIDES = { # Instance functions "vkCreateDevice" : {"extra_param" : "client_ptr"}, "vkDestroyInstance" : {"dispatch" : False}, - "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : False}, + "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : True}, "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False}, "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False}, # Device functions "vkCreateCommandPool" : {"extra_param" : "client_ptr"}, "vkGetDeviceProcAddr" : {"dispatch" : False}, + "vkAllocateMemory" : {"extra_param" : "pAllocateInfo"}, # VK_KHR_external_fence_capabilities "vkGetPhysicalDeviceExternalFencePropertiesKHR" : {"dispatch" : False}, # VK_KHR_external_memory_capabilities - "vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : False}, + "vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : True}, # VK_KHR_external_semaphore_capabilities "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR" : {"dispatch" : False}, + + # VK_KHR_external_memory_win32 + "vkGetMemoryWin32HandleKHR" : {"dispatch" : True}, + "vkGetMemoryWin32HandlePropertiesKHR" : {"dispatch" : True}, } # functions for which a user driver entry must be generated @@ -252,6 +255,8 @@ MANUAL_UNIX_THUNKS = { "vkFreeMemory", "vkGetCalibratedTimestampsEXT", "vkGetDeviceProcAddr", + "vkGetMemoryWin32HandleKHR", + "vkGetMemoryWin32HandlePropertiesKHR", "vkGetDeviceQueue", "vkGetDeviceQueue2", "vkGetInstanceProcAddr", @@ -302,6 +307,10 @@ STRUCT_CHAIN_CONVERSIONS = { # Ignore to not confuse host loader. "VkDeviceCreateInfo": ["VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO"], "VkInstanceCreateInfo": ["VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO"], + + # Structs which require pNext chain modification + "VkBufferCreateInfo": [], + "VkMemoryAllocateInfo": ["VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR", "VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"], } # Some struct members are conditionally ignored and callers are free to leave them uninitialized. @@ -809,7 +818,14 @@ class VkFunction(object): proto += ", ".join([p.definition() for p in self.params]) if is_thunk and self.extra_param: - proto += ", void *" + self.extra_param + extra_param_is_new = True + for p in self.params: + if p.name == self.extra_param: + extra_param_is_new = False + if extra_param_is_new: + proto += ", void *" + self.extra_param + else: + proto += ", void *win_" + self.extra_param proto += ")" return proto @@ -893,7 +909,7 @@ class VkFunction(object): if conv: params += ", UlongToPtr({0}{1})".format(params_prefix, self.extra_param) else: - params += ", {0}{1}".format(params_prefix, self.extra_param) + params += ", (void *){0}{1}".format(params_prefix, self.extra_param) if self.name not in MANUAL_UNIX_THUNKS: func_prefix = "{0}.p_".format(self.params[0].dispatch_table(params_prefix, conv)) @@ -971,9 +987,12 @@ class VkFunction(object): if conv: thunk += " struct\n" thunk += " {\n" + extra_param_is_new = True for p in self.params: thunk += " {0};\n".format(p.definition(conv=True, is_member=True)) - if self.extra_param: + if p.name == self.extra_param: + extra_param_is_new = False + if self.extra_param and extra_param_is_new: thunk += " PTR32 {0};\n".format(self.extra_param) if self.type != "void": thunk += " {0} result;\n".format(self.type) @@ -1576,8 +1595,9 @@ class VkMember(VkVariable): return "{0}{1} = {2} ? {3} : 0;\n".format(output, self.name, self.value(input, conv), handle.unwrap_handle(self.value(input, conv), unwrap)) else: - return "{0}{1} = {2};\n".format(output, self.name, - handle.unwrap_handle(self.value(input, conv), unwrap)) + input_name = "{0}{1}".format(input, self.name) + return "{0}{1} = {2} ? {3} : VK_NULL_HANDLE;\n".format(output, self.name, + input_name, handle.unwrap_handle(self.value(input, conv), unwrap)) elif self.is_generic_handle(): if direction == Direction.OUTPUT: LOGGER.err("OUTPUT parameter {0}.{1} cannot be unwrapped".format(self.type, self.name)) @@ -2444,9 +2464,12 @@ class StructConversionFunction(object): ident = " " if self.direction == Direction.INPUT and self.type in STRUCT_CHAIN_CONVERSIONS: + has_any_chain_conversions = False for i in STRUCT_CHAIN_CONVERSIONS[self.type]: body += " case {0}:\n".format(i) - body += ident + "break;\n" + has_any_chain_conversions = True + if has_any_chain_conversions: + body += ident + "break;\n" for ext in self.operand.struct_extensions: if not ext.required: @@ -2456,6 +2479,8 @@ class StructConversionFunction(object): continue stype = next(x for x in ext.members if x.name == "sType").values + if self.type in STRUCT_CHAIN_CONVERSIONS and stype in STRUCT_CHAIN_CONVERSIONS[self.type]: + continue win_type = ext.name + "32" if self.conv and ext.needs_win32_type() else ext.name if self.direction == Direction.INPUT: in_type = "const " + win_type @@ -3059,9 +3084,13 @@ class VkGenerator(object): f.write("struct {0}_params\n".format(vk_func.name)) f.write("{\n"); + extra_param_is_new = True for p in vk_func.params: f.write(" {0};\n".format(p.definition(is_member=True))) - if vk_func.extra_param: + if p.name == vk_func.extra_param: + extra_param_is_new = False + + if vk_func.extra_param and extra_param_is_new: f.write(" void *{0};\n".format(vk_func.extra_param)) if vk_func.type != "void": f.write(" {0} result;\n".format(vk_func.type)) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index d7b50bbbc7f..cc30ac65661 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -24,6 +24,11 @@ #include "config.h" #include #include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "wine/server.h" #include "vulkan_private.h" #include "wine/vulkan_driver.h" @@ -272,6 +277,15 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance */ for (i = 0; i < num_host_properties; i++) { + if (!strcmp(host_properties[i].extensionName, "VK_KHR_external_memory_fd")) + { + TRACE("Substituting VK_KHR_external_memory_fd for VK_KHR_external_memory_win32\n"); + + snprintf(host_properties[i].extensionName, sizeof(host_properties[i].extensionName), + VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); + host_properties[i].specVersion = VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION; + } + if (wine_vk_device_extension_supported(host_properties[i].extensionName)) { TRACE("Enabling extension '%s' for physical device %p\n", host_properties[i].extensionName, object); @@ -453,7 +467,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst) { static const char *wine_xr_extension_name = "VK_WINE_openxr_device_extensions"; - unsigned int i, append_xr = 0; + unsigned int i, append_xr = 0, replace_win32 = 0; VkBaseOutStructure *header; char **xr_extensions_list; @@ -473,12 +487,14 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de if (!strcmp(extension_name, wine_xr_extension_name)) append_xr = 1; + else if (!strcmp(extension_name, "VK_KHR_external_memory_win32")) + replace_win32 = 1; } if (append_xr) xr_extensions_list = parse_xr_extensions(&append_xr); - if (phys_dev->external_memory_align || append_xr) + if (phys_dev->external_memory_align || append_xr || replace_win32) { const char **new_extensions; unsigned int o = 0, count; @@ -493,7 +509,10 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de { if (append_xr && !strcmp(src->ppEnabledExtensionNames[i], wine_xr_extension_name)) continue; - new_extensions[o++] = src->ppEnabledExtensionNames[i]; + if (replace_win32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32")) + new_extensions[o++] = "VK_KHR_external_memory_fd"; + else + new_extensions[o++] = src->ppEnabledExtensionNames[i]; } if (phys_dev->external_memory_align) { @@ -1336,18 +1355,71 @@ void wine_vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice phys_de properties->externalFenceFeatures = 0; } -void wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice phys_dev, +static inline void wine_vk_normalize_handle_types_win(VkExternalMemoryHandleTypeFlags *types) +{ + *types &= + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT; +} + +static inline void wine_vk_normalize_handle_types_host(VkExternalMemoryHandleTypeFlags *types) +{ + *types &= + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT | +/* predicated on VK_KHR_external_memory_dma_buf + VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT | */ + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT; +} + +static void wine_vk_get_physical_device_external_buffer_properties(struct wine_phys_dev *phys_dev, + void (*p_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *), + const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties) +{ + VkPhysicalDeviceExternalBufferInfo buffer_info_dup = *buffer_info; + + wine_vk_normalize_handle_types_win(&buffer_info_dup.handleType); + if (buffer_info_dup.handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + buffer_info_dup.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + wine_vk_normalize_handle_types_host(&buffer_info_dup.handleType); + + if (buffer_info->handleType && !buffer_info_dup.handleType) + { + memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); + return; + } + + p_vkGetPhysicalDeviceExternalBufferProperties(phys_dev->host_physical_device, &buffer_info_dup, properties); + + if (properties->externalMemoryProperties.exportFromImportedHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) + properties->externalMemoryProperties.exportFromImportedHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + wine_vk_normalize_handle_types_win(&properties->externalMemoryProperties.exportFromImportedHandleTypes); + + if (properties->externalMemoryProperties.compatibleHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) + properties->externalMemoryProperties.compatibleHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + wine_vk_normalize_handle_types_win(&properties->externalMemoryProperties.compatibleHandleTypes); +} + +void wine_vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice phys_dev_handle, const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties) { - memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); + wine_vk_get_physical_device_external_buffer_properties(phys_dev, phys_dev->instance->funcs.p_vkGetPhysicalDeviceExternalBufferProperties, buffer_info, properties); } -void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_dev, +void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_dev_handle, const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties) { - memset(&properties->externalMemoryProperties, 0, sizeof(properties->externalMemoryProperties)); + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); + wine_vk_get_physical_device_external_buffer_properties(phys_dev, phys_dev->instance->funcs.p_vkGetPhysicalDeviceExternalBufferPropertiesKHR, buffer_info, properties); } VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev_handle, @@ -2244,10 +2316,26 @@ void wine_vkDestroySurfaceKHR(VkInstance handle, VkSurfaceKHR surface, free(object); } +static HANDLE create_gpu_resource(int fd, LPCWSTR name) +{ + HANDLE ret = INVALID_HANDLE_VALUE; + + TRACE("Creating shared vulkan resource fd %d name %s.\n", fd, debugstr_w(name)); + + if (name) + FIXME("Naming gpu resources not supported.\n"); + + wine_server_fd_to_handle(fd, GENERIC_ALL, 0, &ret); + + return ret; +} + VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *alloc_info, - const VkAllocationCallbacks *allocator, VkDeviceMemory *ret) + const VkAllocationCallbacks *allocator, VkDeviceMemory *ret, + void *win_pAllocateInfo) { struct wine_device *device = wine_device_from_handle(handle); + const VkMemoryAllocateInfo *win_alloc_info = win_pAllocateInfo; struct wine_device_memory *memory; VkMemoryAllocateInfo info = *alloc_info; VkImportMemoryHostPointerInfoEXT host_pointer_info; @@ -2255,12 +2343,74 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo void *mapping = NULL; VkResult result; - /* For host visible memory, we try to use VK_EXT_external_memory_host on wow64 - * to ensure that mapped pointer is 32-bit. */ + const VkImportMemoryWin32HandleInfoKHR *handle_import_info; + const VkExportMemoryWin32HandleInfoKHR *handle_export_info; + VkExportMemoryAllocateInfo *export_info; + VkImportMemoryFdInfoKHR fd_import_info; + VkMemoryGetFdInfoKHR get_fd_info; + int fd; + + if (!(memory = calloc(sizeof(*memory), 1))) + return VK_ERROR_OUT_OF_HOST_MEMORY; + + memory->handle = INVALID_HANDLE_VALUE; + fd_import_info.fd = -1; + fd_import_info.pNext = NULL; + + /* find and process handle import/export info and grab it */ + handle_import_info = wine_vk_find_struct(win_alloc_info, IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR); + handle_export_info = wine_vk_find_struct(win_alloc_info, EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR); + if (handle_export_info && handle_export_info->pAttributes && handle_export_info->pAttributes->lpSecurityDescriptor) + FIXME("Support for custom security descriptor not implemented.\n"); + + if ((export_info = wine_vk_find_struct(alloc_info, EXPORT_MEMORY_ALLOCATE_INFO))) + { + memory->handle_types = export_info->handleTypes; + if (export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + export_info->handleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + wine_vk_normalize_handle_types_host(&export_info->handleTypes); + } + mem_flags = device->phys_dev->memory_properties.memoryTypes[alloc_info->memoryTypeIndex].propertyFlags; - if (device->phys_dev->external_memory_align && (mem_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && + + /* Vulkan consumes imported FDs, but not imported HANDLEs */ + if (handle_import_info) + { + fd_import_info.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR; + fd_import_info.pNext = info.pNext; + fd_import_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + info.pNext = &fd_import_info; + + switch (handle_import_info->handleType) + { + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT: + if (handle_import_info->handle) + NtDuplicateObject( NtCurrentProcess(), handle_import_info->handle, NtCurrentProcess(), &memory->handle, 0, 0, DUPLICATE_SAME_ACCESS ); + else if (handle_import_info->name) + FIXME("Importing device memory by resource name not supported.\n"); + break; + default: + WARN("Invalid handle type %08x passed in.\n", handle_import_info->handleType); + result = VK_ERROR_INVALID_EXTERNAL_HANDLE; + goto done; + } + + if (memory->handle != INVALID_HANDLE_VALUE) + wine_server_handle_to_fd(memory->handle, FILE_READ_DATA, &fd_import_info.fd, NULL); + + if (fd_import_info.fd == -1) + { + TRACE("Couldn't access resource handle or name. type=%08x handle=%p name=%s\n", handle_import_info->handleType, handle_import_info->handle, + handle_import_info->name ? debugstr_w(handle_import_info->name) : ""); + result = VK_ERROR_INVALID_EXTERNAL_HANDLE; + goto done; + } + } + else if (device->phys_dev->external_memory_align && (mem_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && !find_next_struct(alloc_info->pNext, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT)) { + /* For host visible memory, we try to use VK_EXT_external_memory_host on wow64 + * to ensure that mapped pointer is 32-bit. */ VkMemoryHostPointerPropertiesEXT props = { .sType = VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT, @@ -2276,6 +2426,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo MEM_COMMIT, PAGE_READWRITE)) { ERR("NtAllocateVirtualMemory failed\n"); + free(memory); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -2284,6 +2435,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo if (result != VK_SUCCESS) { ERR("vkGetMemoryHostPointerPropertiesEXT failed: %d\n", result); + free(memory); return result; } @@ -2323,18 +2475,45 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo } } - if (!(memory = malloc(sizeof(*memory)))) - return VK_ERROR_OUT_OF_HOST_MEMORY; - result = device->funcs.p_vkAllocateMemory(device->host_device, &info, NULL, &memory->host_memory); + if (result == VK_SUCCESS && memory->handle == INVALID_HANDLE_VALUE && export_info && export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) + { + get_fd_info.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; + get_fd_info.pNext = NULL; + get_fd_info.memory = memory->host_memory; + get_fd_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + + if (device->funcs.p_vkGetMemoryFdKHR(device->host_device, &get_fd_info, &fd) == VK_SUCCESS) + { + memory->handle = create_gpu_resource(fd, handle_export_info ? handle_export_info->name : NULL); + memory->access = handle_export_info ? handle_export_info->dwAccess : GENERIC_ALL; + if (handle_export_info && handle_export_info->pAttributes) + memory->inherit = handle_export_info->pAttributes->bInheritHandle; + else + memory->inherit = FALSE; + close(fd); + } + + if (memory->handle == INVALID_HANDLE_VALUE) + { + device->funcs.p_vkFreeMemory(device->host_device, memory->host_memory, NULL); + result = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + } +done: if (result != VK_SUCCESS) { + if (fd_import_info.fd != -1) + close(fd_import_info.fd); + if (memory->handle != INVALID_HANDLE_VALUE) + NtClose(memory->handle); free(memory); return result; } memory->mapping = mapping; - *ret = (VkDeviceMemory)(uintptr_t)memory; + *ret = wine_device_memory_to_handle(memory); return VK_SUCCESS; } @@ -2355,6 +2534,9 @@ void wine_vkFreeMemory(VkDevice handle, VkDeviceMemory memory_handle, const VkAl NtFreeVirtualMemory(GetCurrentProcess(), &memory->mapping, &alloc_size, MEM_RELEASE); } + if (memory->handle != INVALID_HANDLE_VALUE) + NtClose(memory->handle); + free(memory); } @@ -2448,10 +2630,16 @@ VkResult wine_vkCreateBuffer(VkDevice handle, const VkBufferCreateInfo *create_i const VkAllocationCallbacks *allocator, VkBuffer *buffer) { struct wine_device *device = wine_device_from_handle(handle); - VkExternalMemoryBufferCreateInfo external_memory_info; + VkExternalMemoryBufferCreateInfo external_memory_info, *ext_info; VkBufferCreateInfo info = *create_info; - if (device->phys_dev->external_memory_align && + if ((ext_info = wine_vk_find_struct(create_info, EXTERNAL_MEMORY_BUFFER_CREATE_INFO))) + { + if (ext_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + ext_info->handleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + wine_vk_normalize_handle_types_host(&ext_info->handleTypes); + } + else if (device->phys_dev->external_memory_align && !find_next_struct(info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO)) { external_memory_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO; @@ -3064,6 +3252,8 @@ NTSTATUS vk_is_available_device_function(void *arg) { struct is_available_device_function_params *params = arg; struct wine_device *device = wine_device_from_handle(params->device); + if (!strcmp(params->name, "vkGetMemoryWin32HandleKHR") || !strcmp(params->name, "vkGetMemoryWin32HandlePropertiesKHR")) + params->name = "vkGetMemoryFdKHR"; return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, params->name); } @@ -3088,6 +3278,9 @@ NTSTATUS vk_is_available_device_function32(void *arg) UINT32 name; } *params = arg; struct wine_device *device = wine_device_from_handle(UlongToPtr(params->device)); + char *name = UlongToPtr(params->name); + if (!strcmp(name, "vkGetMemoryWin32HandleKHR") || !strcmp(name, "vkGetMemoryWin32HandlePropertiesKHR")) + return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkGetMemoryFdKHR"); return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, UlongToPtr(params->name)); } @@ -3130,3 +3323,36 @@ DECLSPEC_EXPORT VkPhysicalDevice __wine_get_wrapped_VkPhysicalDevice(VkInstance WARN("Unknown native physical device: %p\n", native_phys_dev); return NULL; } + +VkResult wine_vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32HandleInfoKHR *handle_info, HANDLE *handle) +{ + struct wine_device_memory *dev_mem = wine_device_memory_from_handle(handle_info->memory); + const VkBaseInStructure *chain; + + TRACE("%p, %p %p\n", device, handle_info, handle); + + if (!(dev_mem->handle_types & handle_info->handleType)) + return VK_ERROR_UNKNOWN; + + if ((chain = handle_info->pNext)) + FIXME("Ignoring a linked structure of type %u.\n", chain->sType); + + switch(handle_info->handleType) + { + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT: + return !NtDuplicateObject( NtCurrentProcess(), dev_mem->handle, NtCurrentProcess(), handle, dev_mem->access, dev_mem->inherit ? OBJ_INHERIT : 0, 0) ? + VK_SUCCESS : VK_ERROR_OUT_OF_HOST_MEMORY; + default: + FIXME("Unable to get handle of type %x, did the application ignore the capabilities?\n", handle_info->handleType); + return VK_ERROR_UNKNOWN; + } +} + +VkResult wine_vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits type, HANDLE handle, VkMemoryWin32HandlePropertiesKHR *properties) +{ + TRACE("%p %u %p %p\n", device, type, handle, properties); + + /* VUID-vkGetMemoryWin32HandlePropertiesKHR-handleType-00666 + handleType must not be one of the handle types defined as opaque */ + return VK_ERROR_INVALID_EXTERNAL_HANDLE; +} diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index a8dd40dd24e..52651cd0125 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -221,9 +221,18 @@ static inline struct wine_cmd_pool *wine_cmd_pool_from_handle(VkCommandPool hand struct wine_device_memory { VkDeviceMemory host_memory; + VkExternalMemoryHandleTypeFlagBits handle_types; + BOOL inherit; + DWORD access; + HANDLE handle; void *mapping; }; +static inline VkDeviceMemory wine_device_memory_to_handle(struct wine_device_memory *device_memory) +{ + return (VkDeviceMemory)(uintptr_t)device_memory; +} + static inline struct wine_device_memory *wine_device_memory_from_handle(VkDeviceMemory handle) { return (struct wine_device_memory *)(uintptr_t)handle; From 28df3ef9278f9898adf82c0a6861c7ba354af89c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 22 Dec 2022 11:09:20 -0600 Subject: [PATCH 1034/1506] winevulkan: Factor out wine_vk_get_physical_device_image_format_properties_2(). --- dlls/winevulkan/vulkan.c | 41 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index cc30ac65661..39137623260 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1422,16 +1422,15 @@ void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_d wine_vk_get_physical_device_external_buffer_properties(phys_dev, phys_dev->instance->funcs.p_vkGetPhysicalDeviceExternalBufferPropertiesKHR, buffer_info, properties); } -VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev_handle, - const VkPhysicalDeviceImageFormatInfo2 *format_info, - VkImageFormatProperties2 *properties) +static VkResult wine_vk_get_physical_device_image_format_properties_2(struct wine_phys_dev *phys_dev, + VkResult (*p_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceImageFormatInfo2 *, VkImageFormatProperties2 *), + const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties) { - struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); VkExternalImageFormatProperties *external_image_properties; VkResult res; - res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2(phys_dev->host_physical_device, - format_info, properties); + res = p_vkGetPhysicalDeviceImageFormatProperties2(phys_dev->host_physical_device, + format_info, properties); if ((external_image_properties = find_next_struct(properties, VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES))) @@ -1441,31 +1440,29 @@ VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_de p->exportFromImportedHandleTypes = 0; p->compatibleHandleTypes = 0; } - return res; } +VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev_handle, + const VkPhysicalDeviceImageFormatInfo2 *format_info, + VkImageFormatProperties2 *properties) +{ + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); + + return wine_vk_get_physical_device_image_format_properties_2(phys_dev, + phys_dev->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2, + format_info, properties); +} + VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice phys_dev_handle, const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties) { struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); - VkExternalImageFormatProperties *external_image_properties; - VkResult res; - res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2KHR(phys_dev->host_physical_device, - format_info, properties); - - if ((external_image_properties = find_next_struct(properties, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES))) - { - VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; - p->externalMemoryFeatures = 0; - p->exportFromImportedHandleTypes = 0; - p->compatibleHandleTypes = 0; - } - - return res; + return wine_vk_get_physical_device_image_format_properties_2(phys_dev, + phys_dev->instance->funcs.p_vkGetPhysicalDeviceImageFormatProperties2KHR, + format_info, properties); } /* From ntdll/unix/sync.c */ From 18a62bd846e60dd0a70d03e1722ace5202a74abe Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 19 May 2021 13:38:12 -0400 Subject: [PATCH 1035/1506] winevulkan: Implement VK_KHR_external_memory_win32 for images. Signed-off-by: Derek Lesho --- dlls/winevulkan/make_vulkan | 2 ++ dlls/winevulkan/vulkan.c | 39 +++++++++++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 3d5578b6527..5e7503e895d 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -310,7 +310,9 @@ STRUCT_CHAIN_CONVERSIONS = { # Structs which require pNext chain modification "VkBufferCreateInfo": [], + "VkImageCreateInfo": [], "VkMemoryAllocateInfo": ["VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR", "VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"], + "VkPhysicalDeviceImageFormatInfo2": [], } # Some struct members are conditionally ignored and callers are free to leave them uninitialized. diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 39137623260..15aa5dbc9c5 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1426,9 +1426,26 @@ static VkResult wine_vk_get_physical_device_image_format_properties_2(struct win VkResult (*p_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice, const VkPhysicalDeviceImageFormatInfo2 *, VkImageFormatProperties2 *), const VkPhysicalDeviceImageFormatInfo2 *format_info, VkImageFormatProperties2 *properties) { + VkPhysicalDeviceExternalImageFormatInfo *external_image_info; VkExternalImageFormatProperties *external_image_properties; VkResult res; + if ((external_image_info = find_next_struct(format_info, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO)) + && external_image_info->handleType) + { + wine_vk_normalize_handle_types_win(&external_image_info->handleType); + + if (external_image_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + external_image_info->handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + + wine_vk_normalize_handle_types_host(&external_image_info->handleType); + if (!external_image_info->handleType) + { + FIXME("Unsupported handle type %#x.\n", external_image_info->handleType); + return VK_ERROR_FORMAT_NOT_SUPPORTED; + } + } + res = p_vkGetPhysicalDeviceImageFormatProperties2(phys_dev->host_physical_device, format_info, properties); @@ -1436,9 +1453,14 @@ static VkResult wine_vk_get_physical_device_image_format_properties_2(struct win VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES))) { VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; - p->externalMemoryFeatures = 0; - p->exportFromImportedHandleTypes = 0; - p->compatibleHandleTypes = 0; + + if (p->exportFromImportedHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) + p->exportFromImportedHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + wine_vk_normalize_handle_types_win(&p->exportFromImportedHandleTypes); + + if (p->compatibleHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) + p->compatibleHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + wine_vk_normalize_handle_types_win(&p->compatibleHandleTypes); } return res; } @@ -2652,11 +2674,16 @@ VkResult wine_vkCreateImage(VkDevice handle, const VkImageCreateInfo *create_inf const VkAllocationCallbacks *allocator, VkImage *image) { struct wine_device *device = wine_device_from_handle(handle); - VkExternalMemoryImageCreateInfo external_memory_info; + VkExternalMemoryImageCreateInfo external_memory_info, *update_info; VkImageCreateInfo info = *create_info; - if (device->phys_dev->external_memory_align && - !find_next_struct(info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO)) + if ((update_info = find_next_struct(info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO))) + { + if (update_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR) + update_info->handleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; + wine_vk_normalize_handle_types_host(&update_info->handleTypes); + } + else if (device->phys_dev->external_memory_align) { external_memory_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; external_memory_info.pNext = info.pNext; From 3e174d45559f6272a98ddeeae605da3743e55eab Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 13 Oct 2021 13:16:44 +0200 Subject: [PATCH 1036/1506] winevulkan: Implement support for KMT handles and named objects. --- configure.ac | 1 + dlls/sharedgpures.sys/Makefile.in | 6 + dlls/sharedgpures.sys/shared_resource.c | 347 ++++++++++++++++++++ dlls/sharedgpures.sys/sharedgpures.sys.spec | 1 + dlls/winevulkan/vulkan.c | 190 ++++++++++- dlls/winevulkan/vulkan_private.h | 7 + include/ddk/wdm.h | 1 + loader/wine.inf.in | 13 + 8 files changed, 551 insertions(+), 15 deletions(-) create mode 100644 dlls/sharedgpures.sys/Makefile.in create mode 100644 dlls/sharedgpures.sys/shared_resource.c create mode 100644 dlls/sharedgpures.sys/sharedgpures.sys.spec diff --git a/configure.ac b/configure.ac index 37e226c81ae..055e8646fcc 100644 --- a/configure.ac +++ b/configure.ac @@ -3125,6 +3125,7 @@ WINE_CONFIG_MAKEFILE(dlls/setupapi/tests) WINE_CONFIG_MAKEFILE(dlls/setupx.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/sfc) WINE_CONFIG_MAKEFILE(dlls/sfc_os) +WINE_CONFIG_MAKEFILE(dlls/sharedgpures.sys) WINE_CONFIG_MAKEFILE(dlls/shcore) WINE_CONFIG_MAKEFILE(dlls/shcore/tests) WINE_CONFIG_MAKEFILE(dlls/shdoclc) diff --git a/dlls/sharedgpures.sys/Makefile.in b/dlls/sharedgpures.sys/Makefile.in new file mode 100644 index 00000000000..9aca43fb45e --- /dev/null +++ b/dlls/sharedgpures.sys/Makefile.in @@ -0,0 +1,6 @@ +MODULE = sharedgpures.sys +IMPORTS = ntoskrnl +EXTRADLLFLAGS = -Wl,--subsystem,native + +SOURCES = \ + shared_resource.c diff --git a/dlls/sharedgpures.sys/shared_resource.c b/dlls/sharedgpures.sys/shared_resource.c new file mode 100644 index 00000000000..e1330888b04 --- /dev/null +++ b/dlls/sharedgpures.sys/shared_resource.c @@ -0,0 +1,347 @@ +#include + +#define NONAMELESSUNION +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winternl.h" +#include "winioctl.h" + +#include "ddk/wdm.h" + +#include "wine/debug.h" +#include "wine/list.h" +#include "wine/server.h" + +WINE_DEFAULT_DEBUG_CHANNEL(sharedgpures); + +static DRIVER_OBJECT *sharedgpures_driver; + +struct shared_resource +{ + unsigned int ref_count; + void *unix_resource; + WCHAR *name; +}; + +static struct shared_resource *resource_pool; +static unsigned int resource_pool_size; + +/* TODO: If/when ntoskrnl gets support for referencing user handles directly, remove this function */ +static void *reference_client_handle(obj_handle_t handle) +{ + HANDLE client_process, kernel_handle; + OBJECT_ATTRIBUTES attr; + void *object = NULL; + CLIENT_ID cid; + + attr.Length = sizeof(OBJECT_ATTRIBUTES); + attr.RootDirectory = 0; + attr.Attributes = OBJ_KERNEL_HANDLE; + attr.ObjectName = NULL; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + cid.UniqueProcess = PsGetCurrentProcessId(); + cid.UniqueThread = 0; + + if (NtOpenProcess(&client_process, PROCESS_ALL_ACCESS, &attr, &cid) != STATUS_SUCCESS) + return NULL; + + if (NtDuplicateObject(client_process, wine_server_ptr_handle(handle), NtCurrentProcess(), &kernel_handle, + 0, OBJ_KERNEL_HANDLE, DUPLICATE_SAME_ACCESS) != STATUS_SUCCESS) + { + NtClose(client_process); + return NULL; + } + + ObReferenceObjectByHandle(kernel_handle, 0, NULL, KernelMode, &object, NULL); + + NtClose(client_process); + NtClose(kernel_handle); + + return object; +} + +#define IOCTL_SHARED_GPU_RESOURCE_CREATE CTL_CODE(FILE_DEVICE_VIDEO, 0, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +struct shared_resource_create +{ + obj_handle_t unix_handle; + WCHAR name[1]; +}; + +static NTSTATUS shared_resource_create(struct shared_resource **res, void *buff, SIZE_T insize, IO_STATUS_BLOCK *iosb) +{ + struct shared_resource_create *input = buff; + void *unix_resource; + unsigned int i; + LPWSTR name; + + if (insize < sizeof(*input)) + return STATUS_INFO_LENGTH_MISMATCH; + + if (input->name[ ((insize - offsetof(struct shared_resource_create, name)) / sizeof(WCHAR)) - 1 ]) + return STATUS_INVALID_PARAMETER; + + if (!(unix_resource = reference_client_handle(input->unix_handle))) + return STATUS_INVALID_HANDLE; + + if (insize == sizeof(*input)) + name = NULL; + else + { + name = ExAllocatePoolWithTag(NonPagedPool, insize - offsetof(struct shared_resource_create, name), 0); + wcscpy(name, &input->name[0]); + } + + for (i = 0; i < resource_pool_size; i++) + if (!resource_pool[i].ref_count) + break; + + if (i == resource_pool_size) + { + struct shared_resource *expanded_pool = + ExAllocatePoolWithTag(NonPagedPool, sizeof(struct shared_resource) * (resource_pool_size + 1024), 0); + + if (resource_pool) + { + memcpy(expanded_pool, resource_pool, resource_pool_size * sizeof(struct shared_resource)); + ExFreePoolWithTag(resource_pool, 0); + } + + memset(&expanded_pool[resource_pool_size], 0, 1024 * sizeof (struct shared_resource)); + + resource_pool = expanded_pool; + resource_pool_size += 1024; + } + + *res = &resource_pool[i]; + (*res)->ref_count = 1; + (*res)->unix_resource = unix_resource; + (*res)->name = name; + + iosb->Information = 0; + return STATUS_SUCCESS; +} + +#define IOCTL_SHARED_GPU_RESOURCE_OPEN CTL_CODE(FILE_DEVICE_VIDEO, 1, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +struct shared_resource_open +{ + obj_handle_t kmt_handle; + WCHAR name[1]; +}; + +static unsigned int kmt_to_index(obj_handle_t kmt) +{ + if (!(kmt & 0x40000000) || (kmt - 2) % 4) + return -1; + return (((unsigned int) kmt & ~0x40000000) - 2) / 4; +} + +static NTSTATUS shared_resource_open(struct shared_resource **res, void *buff, SIZE_T insize, IO_STATUS_BLOCK *iosb) +{ + struct shared_resource_open *input = buff; + unsigned int i; + + if (insize < sizeof(*input)) + return STATUS_INFO_LENGTH_MISMATCH; + + if (input->kmt_handle) + { + if (kmt_to_index(input->kmt_handle) >= resource_pool_size) + return STATUS_INVALID_HANDLE; + + *res = &resource_pool[kmt_to_index(input->kmt_handle)]; + } + else + { + if (input->name[ ((insize - offsetof(struct shared_resource_open, name)) / sizeof(WCHAR)) - 1 ]) + return STATUS_INVALID_PARAMETER; + + /* name lookup */ + for (i = 0; i < resource_pool_size; i++) + { + if (resource_pool[i].name && !wcscmp(resource_pool[i].name, input->name)) + { + *res = &resource_pool[i]; + break; + } + } + if (i == resource_pool_size) + return STATUS_OBJECT_NAME_NOT_FOUND; + } + + (*res)->ref_count++; + iosb->Information = 0; + return STATUS_SUCCESS; +} + +#define IOCTL_SHARED_GPU_RESOURCE_GETKMT CTL_CODE(FILE_DEVICE_VIDEO, 2, METHOD_BUFFERED, FILE_READ_ACCESS) + +static obj_handle_t index_to_kmt(unsigned int idx) +{ + return (idx * 4 + 2) | 0x40000000; +} + +static NTSTATUS shared_resource_getkmt(struct shared_resource *res, void *buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb) +{ + if (outsize < sizeof(unsigned int)) + return STATUS_INFO_LENGTH_MISMATCH; + + *((unsigned int *)buff) = index_to_kmt(res - resource_pool); + + iosb->Information = sizeof(unsigned int); + return STATUS_SUCCESS; +} + +/* TODO: If/when ntoskrnl gets support for opening user handles directly, remove this function */ +static obj_handle_t open_client_handle(void *object) +{ + HANDLE client_process, kernel_handle, handle = NULL; + OBJECT_ATTRIBUTES attr; + CLIENT_ID cid; + + attr.Length = sizeof(OBJECT_ATTRIBUTES); + attr.RootDirectory = 0; + attr.Attributes = OBJ_KERNEL_HANDLE; + attr.ObjectName = NULL; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + cid.UniqueProcess = PsGetCurrentProcessId(); + cid.UniqueThread = 0; + + if (NtOpenProcess(&client_process, PROCESS_ALL_ACCESS, &attr, &cid) != STATUS_SUCCESS) + return 0; + + if (ObOpenObjectByPointer(object, 0, NULL, GENERIC_ALL, NULL, KernelMode, &kernel_handle) != STATUS_SUCCESS) + { + NtClose(client_process); + return 0; + } + + NtDuplicateObject(NtCurrentProcess(), kernel_handle, client_process, &handle, + 0, 0, DUPLICATE_SAME_ACCESS); + + NtClose(client_process); + NtClose(kernel_handle); + + return wine_server_obj_handle(handle); +} + +#define IOCTL_SHARED_GPU_RESOURCE_GET_UNIX_RESOURCE CTL_CODE(FILE_DEVICE_VIDEO, 3, METHOD_BUFFERED, FILE_READ_ACCESS) + +static NTSTATUS shared_resource_get_unix_resource(struct shared_resource *res, void *buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb) +{ + if (outsize < sizeof(obj_handle_t)) + return STATUS_INFO_LENGTH_MISMATCH; + + *((obj_handle_t *)buff) = open_client_handle(res->unix_resource); + + iosb->Information = sizeof(obj_handle_t); + return STATUS_SUCCESS; +} + +static NTSTATUS WINAPI dispatch_create(DEVICE_OBJECT *device, IRP *irp) +{ + irp->IoStatus.u.Status = STATUS_SUCCESS; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +static NTSTATUS WINAPI dispatch_close(DEVICE_OBJECT *device, IRP *irp) +{ + IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); + struct shared_resource *res = stack->FileObject->FsContext; + + TRACE("Freeing shared resouce %p.\n", res); + + if (res) + { + res->ref_count--; + if (!res->ref_count && res->unix_resource) + { + /* TODO: see if its possible to destroy the object here (unlink?) */ + ObDereferenceObject(res->unix_resource); + res->unix_resource = NULL; + } + } + + irp->IoStatus.u.Status = STATUS_SUCCESS; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; +} + +static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) +{ + IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp ); + struct shared_resource **res = (struct shared_resource **) &stack->FileObject->FsContext; + NTSTATUS status; + + TRACE( "ioctl %#lx insize %lu outsize %lu\n", + stack->Parameters.DeviceIoControl.IoControlCode, + stack->Parameters.DeviceIoControl.InputBufferLength, + stack->Parameters.DeviceIoControl.OutputBufferLength ); + + switch (stack->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_SHARED_GPU_RESOURCE_CREATE: + status = shared_resource_create( res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.InputBufferLength, + &irp->IoStatus ); + break; + case IOCTL_SHARED_GPU_RESOURCE_OPEN: + status = shared_resource_open( res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.InputBufferLength, + &irp->IoStatus ); + break; + case IOCTL_SHARED_GPU_RESOURCE_GETKMT: + status = shared_resource_getkmt( *res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.OutputBufferLength, + &irp->IoStatus ); + break; + case IOCTL_SHARED_GPU_RESOURCE_GET_UNIX_RESOURCE: + status = shared_resource_get_unix_resource( *res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.OutputBufferLength, + &irp->IoStatus ); + break; + default: + FIXME( "ioctl %#lx not supported\n", stack->Parameters.DeviceIoControl.IoControlCode ); + status = STATUS_NOT_SUPPORTED; + break; + } + + irp->IoStatus.u.Status = status; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + return status; +} + +NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) +{ + static const WCHAR device_nameW[] = L"\\Device\\SharedGpuResource"; + static const WCHAR link_nameW[] = L"\\??\\SharedGpuResource"; + UNICODE_STRING device_name, link_name; + DEVICE_OBJECT *device; + NTSTATUS status; + + sharedgpures_driver = driver; + + driver->MajorFunction[IRP_MJ_CREATE] = dispatch_create; + driver->MajorFunction[IRP_MJ_CLOSE] = dispatch_close; + driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = dispatch_ioctl; + + RtlInitUnicodeString(&device_name, device_nameW); + RtlInitUnicodeString(&link_name, link_nameW); + + if ((status = IoCreateDevice(driver, 0, &device_name, 0, 0, FALSE, &device))) + return status; + + return IoCreateSymbolicLink(&link_name, &device_name); +} diff --git a/dlls/sharedgpures.sys/sharedgpures.sys.spec b/dlls/sharedgpures.sys/sharedgpures.sys.spec new file mode 100644 index 00000000000..76421d7e35b --- /dev/null +++ b/dlls/sharedgpures.sys/sharedgpures.sys.spec @@ -0,0 +1 @@ +# nothing to export diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 15aa5dbc9c5..911c0dcb0b3 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -28,6 +28,9 @@ #include "ntstatus.h" #define WIN32_NO_STATUS +#include "windef.h" +#include "winnt.h" +#include "winioctl.h" #include "wine/server.h" #include "vulkan_private.h" @@ -1378,6 +1381,10 @@ static inline void wine_vk_normalize_handle_types_host(VkExternalMemoryHandleTyp VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT; } +static const VkExternalMemoryHandleTypeFlagBits wine_vk_handle_over_fd_types = + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT; + static void wine_vk_get_physical_device_external_buffer_properties(struct wine_phys_dev *phys_dev, void (*p_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *), const VkPhysicalDeviceExternalBufferInfo *buffer_info, VkExternalBufferProperties *properties) @@ -1385,7 +1392,7 @@ static void wine_vk_get_physical_device_external_buffer_properties(struct wine_p VkPhysicalDeviceExternalBufferInfo buffer_info_dup = *buffer_info; wine_vk_normalize_handle_types_win(&buffer_info_dup.handleType); - if (buffer_info_dup.handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + if (buffer_info_dup.handleType & wine_vk_handle_over_fd_types) buffer_info_dup.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; wine_vk_normalize_handle_types_host(&buffer_info_dup.handleType); @@ -1398,11 +1405,11 @@ static void wine_vk_get_physical_device_external_buffer_properties(struct wine_p p_vkGetPhysicalDeviceExternalBufferProperties(phys_dev->host_physical_device, &buffer_info_dup, properties); if (properties->externalMemoryProperties.exportFromImportedHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) - properties->externalMemoryProperties.exportFromImportedHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + properties->externalMemoryProperties.exportFromImportedHandleTypes |= wine_vk_handle_over_fd_types; wine_vk_normalize_handle_types_win(&properties->externalMemoryProperties.exportFromImportedHandleTypes); if (properties->externalMemoryProperties.compatibleHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) - properties->externalMemoryProperties.compatibleHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + properties->externalMemoryProperties.compatibleHandleTypes |= wine_vk_handle_over_fd_types; wine_vk_normalize_handle_types_win(&properties->externalMemoryProperties.compatibleHandleTypes); } @@ -1435,7 +1442,7 @@ static VkResult wine_vk_get_physical_device_image_format_properties_2(struct win { wine_vk_normalize_handle_types_win(&external_image_info->handleType); - if (external_image_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + if (external_image_info->handleType & wine_vk_handle_over_fd_types) external_image_info->handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; wine_vk_normalize_handle_types_host(&external_image_info->handleType); @@ -1455,11 +1462,11 @@ static VkResult wine_vk_get_physical_device_image_format_properties_2(struct win VkExternalMemoryProperties *p = &external_image_properties->externalMemoryProperties; if (p->exportFromImportedHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) - p->exportFromImportedHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + p->exportFromImportedHandleTypes |= wine_vk_handle_over_fd_types; wine_vk_normalize_handle_types_win(&p->exportFromImportedHandleTypes); if (p->compatibleHandleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) - p->compatibleHandleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT; + p->compatibleHandleTypes |= wine_vk_handle_over_fd_types; wine_vk_normalize_handle_types_win(&p->compatibleHandleTypes); } return res; @@ -2335,18 +2342,154 @@ void wine_vkDestroySurfaceKHR(VkInstance handle, VkSurfaceKHR surface, free(object); } +#define IOCTL_SHARED_GPU_RESOURCE_CREATE CTL_CODE(FILE_DEVICE_VIDEO, 0, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +struct shared_resource_create +{ + obj_handle_t unix_handle; + WCHAR name[1]; +}; + static HANDLE create_gpu_resource(int fd, LPCWSTR name) { - HANDLE ret = INVALID_HANDLE_VALUE; + static const WCHAR shared_gpu_resourceW[] = {'\\','?','?','\\','S','h','a','r','e','d','G','p','u','R','e','s','o','u','r','c','e',0}; + HANDLE unix_resource = INVALID_HANDLE_VALUE; + struct shared_resource_create *inbuff; + UNICODE_STRING shared_gpu_resource_us; + HANDLE shared_resource; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + DWORD in_size; TRACE("Creating shared vulkan resource fd %d name %s.\n", fd, debugstr_w(name)); + if (wine_server_fd_to_handle(fd, GENERIC_ALL, 0, &unix_resource) != STATUS_SUCCESS) + return INVALID_HANDLE_VALUE; + + init_unicode_string(&shared_gpu_resource_us, shared_gpu_resourceW); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = 0; + attr.ObjectName = &shared_gpu_resource_us; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if ((status = NtCreateFile(&shared_resource, GENERIC_READ | GENERIC_WRITE, &attr, &iosb, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0))) + { + ERR("Failed to load open a shared resource handle, status %#lx.\n", (long int)status); + NtClose(unix_resource); + return INVALID_HANDLE_VALUE; + } + + in_size = sizeof(*inbuff) + (name ? lstrlenW(name) * sizeof(WCHAR) : 0); + inbuff = calloc(1, in_size); + inbuff->unix_handle = wine_server_obj_handle(unix_resource); + if (name) + lstrcpyW(&inbuff->name[0], name); + + if ((status = NtDeviceIoControlFile(shared_resource, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_CREATE, + inbuff, in_size, NULL, 0))) + + free(inbuff); + NtClose(unix_resource); + + if (status) + { + ERR("Failed to create video resource, status %#lx.\n", (long int)status); + NtClose(shared_resource); + return INVALID_HANDLE_VALUE; + } + + return shared_resource; +} + +#define IOCTL_SHARED_GPU_RESOURCE_OPEN CTL_CODE(FILE_DEVICE_VIDEO, 1, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +struct shared_resource_open +{ + obj_handle_t kmt_handle; + WCHAR name[1]; +}; + +static HANDLE open_shared_resource(HANDLE kmt_handle, LPCWSTR name) +{ + static const WCHAR shared_gpu_resourceW[] = {'\\','?','?','\\','S','h','a','r','e','d','G','p','u','R','e','s','o','u','r','c','e',0}; + UNICODE_STRING shared_gpu_resource_us; + struct shared_resource_open *inbuff; + HANDLE shared_resource; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + DWORD in_size; + + init_unicode_string(&shared_gpu_resource_us, shared_gpu_resourceW); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = 0; + attr.ObjectName = &shared_gpu_resource_us; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + if ((status = NtCreateFile(&shared_resource, GENERIC_READ | GENERIC_WRITE, &attr, &iosb, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0))) + { + ERR("Failed to load open a shared resource handle, status %#lx.\n", (long int)status); + return INVALID_HANDLE_VALUE; + } + + in_size = sizeof(*inbuff) + (name ? lstrlenW(name) * sizeof(WCHAR) : 0); + inbuff = calloc(1, in_size); + inbuff->kmt_handle = wine_server_obj_handle(kmt_handle); if (name) - FIXME("Naming gpu resources not supported.\n"); + lstrcpyW(&inbuff->name[0], name); + + status = NtDeviceIoControlFile(shared_resource, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_OPEN, + inbuff, in_size, NULL, 0); - wine_server_fd_to_handle(fd, GENERIC_ALL, 0, &ret); + free(inbuff); - return ret; + if (status) + { + ERR("Failed to open video resource, status %#lx.\n", (long int)status); + NtClose(shared_resource); + return INVALID_HANDLE_VALUE; + } + + return shared_resource; +} + +#define IOCTL_SHARED_GPU_RESOURCE_GET_UNIX_RESOURCE CTL_CODE(FILE_DEVICE_VIDEO, 3, METHOD_BUFFERED, FILE_READ_ACCESS) + +static int get_shared_resource_fd(HANDLE shared_resource) +{ + IO_STATUS_BLOCK iosb; + obj_handle_t unix_resource; + NTSTATUS status; + int ret; + + if (NtDeviceIoControlFile(shared_resource, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_GET_UNIX_RESOURCE, + NULL, 0, &unix_resource, sizeof(unix_resource))) + return -1; + + status = wine_server_handle_to_fd(wine_server_ptr_handle(unix_resource), FILE_READ_DATA, &ret, NULL); + NtClose(wine_server_ptr_handle(unix_resource)); + return status == STATUS_SUCCESS ? ret : -1; +} + +#define IOCTL_SHARED_GPU_RESOURCE_GETKMT CTL_CODE(FILE_DEVICE_VIDEO, 2, METHOD_BUFFERED, FILE_READ_ACCESS) + +static HANDLE get_shared_resource_kmt_handle(HANDLE shared_resource) +{ + IO_STATUS_BLOCK iosb; + obj_handle_t kmt_handle; + + if (NtDeviceIoControlFile(shared_resource, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_GETKMT, + NULL, 0, &kmt_handle, sizeof(kmt_handle))) + return INVALID_HANDLE_VALUE; + + return wine_server_ptr_handle(kmt_handle); } VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *alloc_info, @@ -2385,7 +2528,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo if ((export_info = wine_vk_find_struct(alloc_info, EXPORT_MEMORY_ALLOCATE_INFO))) { memory->handle_types = export_info->handleTypes; - if (export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + if (export_info->handleTypes & wine_vk_handle_over_fd_types) export_info->handleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; wine_vk_normalize_handle_types_host(&export_info->handleTypes); } @@ -2406,7 +2549,16 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo if (handle_import_info->handle) NtDuplicateObject( NtCurrentProcess(), handle_import_info->handle, NtCurrentProcess(), &memory->handle, 0, 0, DUPLICATE_SAME_ACCESS ); else if (handle_import_info->name) - FIXME("Importing device memory by resource name not supported.\n"); + memory->handle = open_shared_resource( 0, handle_import_info->name ); + break; + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT: + /* FIXME: the spec says that device memory imported from a KMT handle doesn't keep a reference to the underyling payload. + This means that in cases where on windows an application leaks VkDeviceMemory objects, we leak the full payload. To + fix this, we would need wine_dev_mem objects to store no reference to the payload, that means no host VkDeviceMemory + object (as objects imported from FDs hold a reference to the payload), and no win32 handle to the object. We would then + extend make_vulkan to have the thunks converting wine_dev_mem to native handles open the VkDeviceMemory from the KMT + handle, use it in the host function, then close it again. */ + memory->handle = open_shared_resource( handle_import_info->handle, NULL ); break; default: WARN("Invalid handle type %08x passed in.\n", handle_import_info->handleType); @@ -2415,7 +2567,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo } if (memory->handle != INVALID_HANDLE_VALUE) - wine_server_handle_to_fd(memory->handle, FILE_READ_DATA, &fd_import_info.fd, NULL); + fd_import_info.fd = get_shared_resource_fd(memory->handle); if (fd_import_info.fd == -1) { @@ -2654,7 +2806,7 @@ VkResult wine_vkCreateBuffer(VkDevice handle, const VkBufferCreateInfo *create_i if ((ext_info = wine_vk_find_struct(create_info, EXTERNAL_MEMORY_BUFFER_CREATE_INFO))) { - if (ext_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT) + if (ext_info->handleTypes & wine_vk_handle_over_fd_types) ext_info->handleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; wine_vk_normalize_handle_types_host(&ext_info->handleTypes); } @@ -2679,7 +2831,7 @@ VkResult wine_vkCreateImage(VkDevice handle, const VkImageCreateInfo *create_inf if ((update_info = find_next_struct(info.pNext, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO))) { - if (update_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR) + if (update_info->handleTypes & wine_vk_handle_over_fd_types) update_info->handleTypes |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; wine_vk_normalize_handle_types_host(&update_info->handleTypes); } @@ -3352,6 +3504,7 @@ VkResult wine_vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32H { struct wine_device_memory *dev_mem = wine_device_memory_from_handle(handle_info->memory); const VkBaseInStructure *chain; + HANDLE ret; TRACE("%p, %p %p\n", device, handle_info, handle); @@ -3366,6 +3519,13 @@ VkResult wine_vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32H case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT: return !NtDuplicateObject( NtCurrentProcess(), dev_mem->handle, NtCurrentProcess(), handle, dev_mem->access, dev_mem->inherit ? OBJ_INHERIT : 0, 0) ? VK_SUCCESS : VK_ERROR_OUT_OF_HOST_MEMORY; + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT: + { + if ((ret = get_shared_resource_kmt_handle(dev_mem->handle)) == INVALID_HANDLE_VALUE) + return VK_ERROR_OUT_OF_HOST_MEMORY; + *handle = ret; + return VK_SUCCESS; + } default: FIXME("Unable to get handle of type %x, did the application ignore the capabilities?\n", handle_info->handleType); return VK_ERROR_UNKNOWN; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 52651cd0125..a913a3fb6d0 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -401,4 +401,11 @@ static inline void *find_next_struct(const void *s, VkStructureType t) return NULL; } +static inline void init_unicode_string( UNICODE_STRING *str, const WCHAR *data ) +{ + str->Length = lstrlenW(data) * sizeof(WCHAR); + str->MaximumLength = str->Length + sizeof(WCHAR); + str->Buffer = (WCHAR *)data; +} + #endif /* __WINE_VULKAN_PRIVATE_H */ diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 54b9e6aa199..73c06f6802d 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1837,6 +1837,7 @@ NTSTATUS WINAPI ObRegisterCallbacks(POB_CALLBACK_REGISTRATION, void**); NTSTATUS WINAPI ObReferenceObjectByHandle(HANDLE,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,PVOID*,POBJECT_HANDLE_INFORMATION); NTSTATUS WINAPI ObReferenceObjectByName(UNICODE_STRING*,ULONG,ACCESS_STATE*,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,void*,void**); NTSTATUS WINAPI ObReferenceObjectByPointer(void*,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE); +NTSTATUS WINAPI ObOpenObjectByPointer(void *,ULONG,ACCESS_STATE*,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,HANDLE*); void WINAPI ObUnRegisterCallbacks(void*); NTSTATUS WINAPI PoCallDriver(DEVICE_OBJECT*,IRP*); diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 732e997787b..7ce0638c7df 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -209,6 +209,7 @@ AddService=Winmgmt,0,WinmgmtService AddService=wuauserv,0,wuauService AddService=NDIS,0x800,NDISService AddService=nsiproxy,0x800,NsiProxyService +AddService=SharedGpuResources,0x800,SharedGpuResourcesService [DefaultInstall.NT.Services] AddService=BITS,0,BITSService @@ -229,6 +230,7 @@ AddService=Winmgmt,0,WinmgmtService AddService=wuauserv,0,wuauService AddService=NDIS,0x800,NDISService AddService=nsiproxy,0x800,NsiProxyService +AddService=SharedGpuResources,0x800,SharedGpuResourcesService [DefaultInstall.ntamd64.Services] AddService=BITS,0,BITSService @@ -249,6 +251,7 @@ AddService=Winmgmt,0,WinmgmtService AddService=wuauserv,0,wuauService AddService=NDIS,0x800,NDISService AddService=nsiproxy,0x800,NsiProxyService +AddService=SharedGpuResources,0x800,SharedGpuResourcesService [DefaultInstall.ntarm64.Services] AddService=BITS,0,BITSService @@ -269,6 +272,7 @@ AddService=Winmgmt,0,WinmgmtService AddService=wuauserv,0,wuauService AddService=NDIS,0x800,NDISService AddService=nsiproxy,0x800,NsiProxyService +AddService=SharedGpuResources,0x800,SharedGpuResourcesService [Strings] MciExtStr="Software\Microsoft\Windows NT\CurrentVersion\MCI Extensions" @@ -2447,6 +2451,15 @@ LoadOrderGroup="System Bus Extender" [NsiProxyServiceKeys] HKR,,"Tag",0x10001,1 +[SharedGpuResourcesService] +Description="Shared GPU Resources Manager Service" +DisplayName="Shared GPU Resources Manager" +ServiceBinary="%12%\sharedgpures.sys" +ServiceType=1 +StartType=2 +ErrorControl=1 +LoadOrderGroup="System Bus Extender" + [RpcSsService] Description="RPC service" DisplayName="Remote Procedure Call (RPC)" From 842b9ef9607744a0f3f70a7feabb80b380062957 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 13 Oct 2021 13:34:49 +0200 Subject: [PATCH 1037/1506] sharedgpures: Add support for arbitrary metadata. --- dlls/sharedgpures.sys/shared_resource.c | 57 +++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/dlls/sharedgpures.sys/shared_resource.c b/dlls/sharedgpures.sys/shared_resource.c index e1330888b04..42715f7479b 100644 --- a/dlls/sharedgpures.sys/shared_resource.c +++ b/dlls/sharedgpures.sys/shared_resource.c @@ -23,6 +23,8 @@ struct shared_resource unsigned int ref_count; void *unix_resource; WCHAR *name; + void *metadata; + SIZE_T metadata_size; }; static struct shared_resource *resource_pool; @@ -245,6 +247,33 @@ static NTSTATUS shared_resource_get_unix_resource(struct shared_resource *res, v return STATUS_SUCCESS; } +#define IOCTL_SHARED_GPU_RESOURCE_SET_METADATA CTL_CODE(FILE_DEVICE_VIDEO, 4, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +static NTSTATUS shared_resource_set_metadata(struct shared_resource *res, void *buff, SIZE_T insize, IO_STATUS_BLOCK *iosb) +{ + res->metadata = ExAllocatePoolWithTag(NonPagedPool, insize, 0); + memcpy(res->metadata, buff, insize); + res->metadata_size = insize; + + iosb->Information = 0; + return STATUS_SUCCESS; +} + +#define IOCTL_SHARED_GPU_RESOURCE_GET_METADATA CTL_CODE(FILE_DEVICE_VIDEO, 5, METHOD_BUFFERED, FILE_READ_ACCESS) + +static NTSTATUS shared_resource_get_metadata(struct shared_resource *res, void *buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb) +{ + if (!res->metadata) + return STATUS_NOT_FOUND; + + if (res->metadata_size > outsize) + return STATUS_BUFFER_TOO_SMALL; + + memcpy(buff, res->metadata, res->metadata_size); + iosb->Information = res->metadata_size; + return STATUS_SUCCESS; +} + static NTSTATUS WINAPI dispatch_create(DEVICE_OBJECT *device, IRP *irp) { irp->IoStatus.u.Status = STATUS_SUCCESS; @@ -262,11 +291,19 @@ static NTSTATUS WINAPI dispatch_close(DEVICE_OBJECT *device, IRP *irp) if (res) { res->ref_count--; - if (!res->ref_count && res->unix_resource) + if (!res->ref_count) { - /* TODO: see if its possible to destroy the object here (unlink?) */ - ObDereferenceObject(res->unix_resource); - res->unix_resource = NULL; + if (res->unix_resource) + { + /* TODO: see if its possible to destroy the object here (unlink?) */ + ObDereferenceObject(res->unix_resource); + res->unix_resource = NULL; + } + if (res->metadata) + { + ExFreePoolWithTag(res->metadata, 0); + res->metadata = NULL; + } } } @@ -312,6 +349,18 @@ static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) stack->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); break; + case IOCTL_SHARED_GPU_RESOURCE_SET_METADATA: + status = shared_resource_set_metadata( *res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.InputBufferLength, + &irp->IoStatus ); + break; + case IOCTL_SHARED_GPU_RESOURCE_GET_METADATA: + status = shared_resource_get_metadata( *res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.OutputBufferLength, + &irp->IoStatus ); + break; default: FIXME( "ioctl %#lx not supported\n", stack->Parameters.DeviceIoControl.IoControlCode ); status = STATUS_NOT_SUPPORTED; From 7df45617e8f9f3120bf92e9c3f56f9a6261ee8c7 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 13 Jul 2022 13:08:41 -0400 Subject: [PATCH 1038/1506] ntoskrnl, server: Support referencing section objects. Needed for the shared resource manager to track the shared memory object for shared fences. --- dlls/ntoskrnl.exe/ntoskrnl.c | 12 +++++++++++- server/mapping.c | 14 +++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 45b8e1ab1c1..4668b58ef16 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -258,6 +258,15 @@ POBJECT_TYPE WINAPI ObGetObjectType( void *object ) return header->type; } +static const WCHAR section_type_name[] = {'S','e','c','t','i','o','n',0}; + +static struct _OBJECT_TYPE section_type = +{ + section_type_name +}; + +static POBJECT_TYPE p_section_type = §ion_type; + static const POBJECT_TYPE *known_types[] = { &ExEventObjectType, @@ -267,7 +276,8 @@ static const POBJECT_TYPE *known_types[] = &IoFileObjectType, &PsProcessType, &PsThreadType, - &SeTokenObjectType + &SeTokenObjectType, + &p_section_type, }; DECLARE_CRITICAL_SECTION(handle_map_cs); diff --git a/server/mapping.c b/server/mapping.c index 75f2ce4fc2b..6d39411f23d 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -164,6 +164,7 @@ struct type_descr mapping_type = struct mapping { struct object obj; /* object header */ + struct list kernel_object; /* list of kernel object pointers */ mem_size_t size; /* mapping size */ unsigned int flags; /* SEC_* flags */ struct fd *fd; /* fd for mapped file */ @@ -175,6 +176,7 @@ struct mapping static void mapping_dump( struct object *obj, int verbose ); static struct fd *mapping_get_fd( struct object *obj ); +static struct list *mapping_get_kernel_obj_list( struct object *obj ); static void mapping_destroy( struct object *obj ); static enum server_fd_type mapping_get_fd_type( struct fd *fd ); @@ -199,7 +201,7 @@ static const struct object_ops mapping_ops = directory_link_name, /* link_name */ default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ - no_kernel_obj_list, /* get_kernel_obj_list */ + mapping_get_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ mapping_destroy /* destroy */ }; @@ -972,6 +974,8 @@ static struct mapping *create_mapping( struct object *root, const struct unicode if (get_error() == STATUS_OBJECT_NAME_EXISTS) return mapping; /* Nothing else to do */ + list_init( &mapping->kernel_object ); + mapping->size = size; mapping->fd = NULL; mapping->shared = NULL; @@ -1064,6 +1068,8 @@ struct mapping *create_fd_mapping( struct object *root, const struct unicode_str if (!(mapping = create_named_object( root, &mapping_ops, name, attr, sd ))) return NULL; if (get_error() == STATUS_OBJECT_NAME_EXISTS) return mapping; /* Nothing else to do */ + list_init( &mapping->kernel_object ); + mapping->shared = NULL; mapping->committed = NULL; mapping->flags = SEC_FILE; @@ -1170,6 +1176,12 @@ static struct fd *mapping_get_fd( struct object *obj ) return (struct fd *)grab_object( mapping->fd ); } +static struct list *mapping_get_kernel_obj_list( struct object *obj ) +{ + struct mapping *mapping = (struct mapping *)obj; + return &mapping->kernel_object; +} + static void mapping_destroy( struct object *obj ) { struct mapping *mapping = (struct mapping *)obj; From e4fce58a7f14621ccc882ea00dbd84ddb4b46d90 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 13 Jul 2022 13:11:22 -0400 Subject: [PATCH 1039/1506] sharedgpures.sys: Keep index into resource pool in FsContext instead of direct pointer to resource. This fixes the errors due to the pointers in FsContext becoming invalid when the resource pool was expanded. Signed-off-by: Derek Lesho --- dlls/sharedgpures.sys/shared_resource.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dlls/sharedgpures.sys/shared_resource.c b/dlls/sharedgpures.sys/shared_resource.c index 42715f7479b..8c3fa3764bd 100644 --- a/dlls/sharedgpures.sys/shared_resource.c +++ b/dlls/sharedgpures.sys/shared_resource.c @@ -284,7 +284,7 @@ static NTSTATUS WINAPI dispatch_create(DEVICE_OBJECT *device, IRP *irp) static NTSTATUS WINAPI dispatch_close(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); - struct shared_resource *res = stack->FileObject->FsContext; + struct shared_resource *res = &resource_pool[ (UINT_PTR) stack->FileObject->FsContext ]; TRACE("Freeing shared resouce %p.\n", res); @@ -315,7 +315,7 @@ static NTSTATUS WINAPI dispatch_close(DEVICE_OBJECT *device, IRP *irp) static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) { IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp ); - struct shared_resource **res = (struct shared_resource **) &stack->FileObject->FsContext; + struct shared_resource *res = &resource_pool[ (UINT_PTR) stack->FileObject->FsContext ]; NTSTATUS status; TRACE( "ioctl %#lx insize %lu outsize %lu\n", @@ -326,37 +326,37 @@ static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) switch (stack->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_SHARED_GPU_RESOURCE_CREATE: - status = shared_resource_create( res, + status = shared_resource_create( &res, irp->AssociatedIrp.SystemBuffer, stack->Parameters.DeviceIoControl.InputBufferLength, &irp->IoStatus ); break; case IOCTL_SHARED_GPU_RESOURCE_OPEN: - status = shared_resource_open( res, + status = shared_resource_open( &res, irp->AssociatedIrp.SystemBuffer, stack->Parameters.DeviceIoControl.InputBufferLength, &irp->IoStatus ); break; case IOCTL_SHARED_GPU_RESOURCE_GETKMT: - status = shared_resource_getkmt( *res, + status = shared_resource_getkmt( res, irp->AssociatedIrp.SystemBuffer, stack->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); break; case IOCTL_SHARED_GPU_RESOURCE_GET_UNIX_RESOURCE: - status = shared_resource_get_unix_resource( *res, + status = shared_resource_get_unix_resource( res, irp->AssociatedIrp.SystemBuffer, stack->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); break; case IOCTL_SHARED_GPU_RESOURCE_SET_METADATA: - status = shared_resource_set_metadata( *res, + status = shared_resource_set_metadata( res, irp->AssociatedIrp.SystemBuffer, stack->Parameters.DeviceIoControl.InputBufferLength, &irp->IoStatus ); break; case IOCTL_SHARED_GPU_RESOURCE_GET_METADATA: - status = shared_resource_get_metadata( *res, + status = shared_resource_get_metadata( res, irp->AssociatedIrp.SystemBuffer, stack->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); @@ -367,6 +367,9 @@ static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) break; } + if (!status) + stack->FileObject->FsContext = (void *)(UINT_PTR)(res - resource_pool); + irp->IoStatus.u.Status = status; IoCompleteRequest( irp, IO_NO_INCREMENT ); return status; From 8c59f7b758ab2a36f2c07e48a24dd42fc26eefaa Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 13 Jul 2022 13:14:04 -0400 Subject: [PATCH 1040/1506] sharedgpures.sys: Add support for associating additional NT objects with shared resources. This is then used to share a shared memory section for shared fences --- dlls/sharedgpures.sys/shared_resource.c | 91 +++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/dlls/sharedgpures.sys/shared_resource.c b/dlls/sharedgpures.sys/shared_resource.c index 8c3fa3764bd..c6ab013ea0d 100644 --- a/dlls/sharedgpures.sys/shared_resource.c +++ b/dlls/sharedgpures.sys/shared_resource.c @@ -25,6 +25,8 @@ struct shared_resource WCHAR *name; void *metadata; SIZE_T metadata_size; + void **object_pool; + unsigned int object_pool_count; }; static struct shared_resource *resource_pool; @@ -274,6 +276,70 @@ static NTSTATUS shared_resource_get_metadata(struct shared_resource *res, void * return STATUS_SUCCESS; } +#define IOCTL_SHARED_GPU_RESOURCE_SET_OBJECT CTL_CODE(FILE_DEVICE_VIDEO, 6, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +struct shared_resource_set_object +{ + unsigned int index; + obj_handle_t handle; +}; + +static NTSTATUS shared_resource_set_object(struct shared_resource *res, void *buff, SIZE_T insize, IO_STATUS_BLOCK *iosb) +{ + struct shared_resource_set_object *params = buff; + void *object; + + if (insize < sizeof(*params)) + return STATUS_INFO_LENGTH_MISMATCH; + + if (!(object = reference_client_handle(params->handle))) + return STATUS_INVALID_HANDLE; + + if (params->index >= res->object_pool_count) + { + void **expanded_pool = ExAllocatePoolWithTag(NonPagedPool, (params->index + 1) * sizeof(void *), 0); + + if (res->object_pool) + { + memcpy(expanded_pool, res->object_pool, res->object_pool_count * sizeof(void *)); + ExFreePoolWithTag(res->object_pool, 0); + } + + memset(&expanded_pool[res->object_pool_count], 0, (params->index + 1 - res->object_pool_count) * sizeof (void *)); + + res->object_pool = expanded_pool; + res->object_pool_count = params->index + 1; + } + + if (res->object_pool[params->index]) + ObDereferenceObject(res->object_pool[params->index]); + + res->object_pool[params->index] = object; + + iosb->Information = 0; + return STATUS_SUCCESS; +} + +#define IOCTL_SHARED_GPU_RESOURCE_GET_OBJECT CTL_CODE(FILE_DEVICE_VIDEO, 6, METHOD_BUFFERED, FILE_READ_ACCESS) + +static NTSTATUS shared_resource_get_object(struct shared_resource *res, void *buff, SIZE_T insize, SIZE_T outsize, IO_STATUS_BLOCK *iosb) +{ + unsigned int index; + + if (insize < sizeof(unsigned int) || outsize < sizeof(obj_handle_t)) + return STATUS_INFO_LENGTH_MISMATCH; + + index = *(unsigned int *)buff; + + if (index >= res->object_pool_count || !res->object_pool[index]) + return STATUS_INVALID_PARAMETER; + + *((obj_handle_t *)buff) = open_client_handle(res->object_pool[index]); + + iosb->Information = sizeof(obj_handle_t); + return STATUS_SUCCESS; +} + static NTSTATUS WINAPI dispatch_create(DEVICE_OBJECT *device, IRP *irp) { irp->IoStatus.u.Status = STATUS_SUCCESS; @@ -304,6 +370,18 @@ static NTSTATUS WINAPI dispatch_close(DEVICE_OBJECT *device, IRP *irp) ExFreePoolWithTag(res->metadata, 0); res->metadata = NULL; } + if (res->object_pool) + { + unsigned int i; + for (i = 0; i < res->object_pool_count; i++) + { + if (res->object_pool[i]) + ObDereferenceObject(res->object_pool[i]); + } + ExFreePoolWithTag(res->object_pool, 0); + res->object_pool = NULL; + res->object_pool_count = 0; + } } } @@ -361,6 +439,19 @@ static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) stack->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); break; + case IOCTL_SHARED_GPU_RESOURCE_SET_OBJECT: + status = shared_resource_set_object( res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.InputBufferLength, + &irp->IoStatus ); + break; + case IOCTL_SHARED_GPU_RESOURCE_GET_OBJECT: + status = shared_resource_get_object( res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.InputBufferLength, + stack->Parameters.DeviceIoControl.OutputBufferLength, + &irp->IoStatus); + break; default: FIXME( "ioctl %#lx not supported\n", stack->Parameters.DeviceIoControl.IoControlCode ); status = STATUS_NOT_SUPPORTED; From d3796ebbe41c6428f2610b182614d88e998ad159 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Thu, 11 Aug 2022 10:57:01 -0400 Subject: [PATCH 1041/1506] winevulkan: Allowing importing D3D11 Texture handles as Vulkan memory objects. --- dlls/winevulkan/vulkan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 911c0dcb0b3..3f8f9ab64f0 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1383,7 +1383,9 @@ static inline void wine_vk_normalize_handle_types_host(VkExternalMemoryHandleTyp static const VkExternalMemoryHandleTypeFlagBits wine_vk_handle_over_fd_types = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT | - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT; + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT | + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT; static void wine_vk_get_physical_device_external_buffer_properties(struct wine_phys_dev *phys_dev, void (*p_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalBufferInfo *, VkExternalBufferProperties *), @@ -2546,12 +2548,14 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo switch (handle_import_info->handleType) { case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT: + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT: if (handle_import_info->handle) NtDuplicateObject( NtCurrentProcess(), handle_import_info->handle, NtCurrentProcess(), &memory->handle, 0, 0, DUPLICATE_SAME_ACCESS ); else if (handle_import_info->name) memory->handle = open_shared_resource( 0, handle_import_info->name ); break; case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT: + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT: /* FIXME: the spec says that device memory imported from a KMT handle doesn't keep a reference to the underyling payload. This means that in cases where on windows an application leaks VkDeviceMemory objects, we leak the full payload. To fix this, we would need wine_dev_mem objects to store no reference to the payload, that means no host VkDeviceMemory @@ -3517,9 +3521,11 @@ VkResult wine_vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32H switch(handle_info->handleType) { case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT: + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT: return !NtDuplicateObject( NtCurrentProcess(), dev_mem->handle, NtCurrentProcess(), handle, dev_mem->access, dev_mem->inherit ? OBJ_INHERIT : 0, 0) ? VK_SUCCESS : VK_ERROR_OUT_OF_HOST_MEMORY; case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT: + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT: { if ((ret = get_shared_resource_kmt_handle(dev_mem->handle)) == INVALID_HANDLE_VALUE) return VK_ERROR_OUT_OF_HOST_MEMORY; From eab05358e43728b6cb86f8e5029e63e96b0a9e3c Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 22 Apr 2022 11:53:02 -0400 Subject: [PATCH 1042/1506] winevulkan: Implement VK_KHR_external_semaphore_win32 for OPAQUE_WIN32 handleType. --- dlls/winevulkan/make_vulkan | 15 ++- dlls/winevulkan/vulkan.c | 176 ++++++++++++++++++++++++++++++++++-- 2 files changed, 178 insertions(+), 13 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 5e7503e895d..3376eaabe8d 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -99,7 +99,6 @@ UNSUPPORTED_EXTENSIONS = [ "VK_EXT_full_screen_exclusive", "VK_GOOGLE_display_timing", "VK_KHR_external_fence_win32", - "VK_KHR_external_semaphore_win32", # Relates to external_semaphore and needs type conversions in bitflags. "VK_KHR_shared_presentable_image", # Needs WSI work. "VK_KHR_video_queue", # TODO Video extensions use separate headers + xml @@ -113,7 +112,6 @@ UNSUPPORTED_EXTENSIONS = [ "VK_EXT_physical_device_drm", "VK_GOOGLE_surfaceless_query", "VK_KHR_external_fence_fd", - "VK_KHR_external_semaphore_fd", "VK_SEC_amigo_profiling", # Angle specific. # Extensions which require callback handling @@ -174,7 +172,7 @@ FUNCTION_OVERRIDES = { "vkDestroyInstance" : {"dispatch" : False}, "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : True}, "vkGetPhysicalDeviceExternalFenceProperties" : {"dispatch" : False}, - "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : False}, + "vkGetPhysicalDeviceExternalSemaphoreProperties" : {"dispatch" : True}, # Device functions "vkCreateCommandPool" : {"extra_param" : "client_ptr"}, @@ -188,7 +186,12 @@ FUNCTION_OVERRIDES = { "vkGetPhysicalDeviceExternalBufferPropertiesKHR" : {"dispatch" : True}, # VK_KHR_external_semaphore_capabilities - "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR" : {"dispatch" : False}, + "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR" : {"dispatch" : True}, + + # VK_KHR_external_semaphore_win32 + "vkCreateSemaphore" : {"dispatch" : True, "extra_param" : "pCreateInfo"}, + "vkGetSemaphoreWin32HandleKHR" : {"dispatch" : True}, + "vkImportSemaphoreWin32HandleKHR" : {"dispatch" : True}, # VK_KHR_external_memory_win32 "vkGetMemoryWin32HandleKHR" : {"dispatch" : True}, @@ -233,6 +236,7 @@ MANUAL_UNIX_THUNKS = { "vkCreateDevice", "vkCreateImage", "vkCreateInstance", + "vkCreateSemaphore", "vkCreateSwapchainKHR", "vkCreateWin32SurfaceKHR", "vkDestroyCommandPool", @@ -243,6 +247,8 @@ MANUAL_UNIX_THUNKS = { "vkDestroyInstance", "vkDestroySurfaceKHR", "vkDestroySwapchainKHR", + "vkGetSemaphoreWin32HandleKHR", + "vkImportSemaphoreWin32HandleKHR", "vkEnumerateDeviceExtensionProperties", "vkEnumerateDeviceLayerProperties", "vkEnumerateInstanceExtensionProperties", @@ -313,6 +319,7 @@ STRUCT_CHAIN_CONVERSIONS = { "VkImageCreateInfo": [], "VkMemoryAllocateInfo": ["VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR", "VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"], "VkPhysicalDeviceImageFormatInfo2": [], + "VkSemaphoreCreateInfo": ["VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"], } # Some struct members are conditionally ignored and callers are free to leave them uninitialized. diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 3f8f9ab64f0..2ff23e0b98d 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -288,6 +288,14 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); host_properties[i].specVersion = VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION; } + if (!strcmp(host_properties[i].extensionName, "VK_KHR_external_semaphore_fd")) + { + TRACE("Substituting VK_KHR_external_semaphore_fd for VK_KHR_external_semaphore_win32\n"); + + snprintf(host_properties[i].extensionName, sizeof(host_properties[i].extensionName), + VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME); + host_properties[i].specVersion = VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION; + } if (wine_vk_device_extension_supported(host_properties[i].extensionName)) { @@ -490,7 +498,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de if (!strcmp(extension_name, wine_xr_extension_name)) append_xr = 1; - else if (!strcmp(extension_name, "VK_KHR_external_memory_win32")) + else if (!strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32") || !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) replace_win32 = 1; } @@ -514,6 +522,8 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de continue; if (replace_win32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32")) new_extensions[o++] = "VK_KHR_external_memory_fd"; + else if (replace_win32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) + new_extensions[o++] = "VK_KHR_external_semaphore_fd"; else new_extensions[o++] = src->ppEnabledExtensionNames[i]; } @@ -1649,22 +1659,69 @@ VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice ha return res; } -void wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice phys_dev, +static inline void wine_vk_normalize_semaphore_handle_types_win(VkExternalSemaphoreHandleTypeFlags *types) +{ + *types &= + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT | + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT; +} + +static inline void wine_vk_normalize_semaphore_handle_types_host(VkExternalSemaphoreHandleTypeFlags *types) +{ + *types &= + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT | + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; +} + +static void wine_vk_get_physical_device_external_semaphore_properties(struct wine_phys_dev *phys_dev, + void (*p_vkGetPhysicalDeviceExternalSemaphoreProperties)(VkPhysicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *, VkExternalSemaphoreProperties *), + const VkPhysicalDeviceExternalSemaphoreInfo *semaphore_info, VkExternalSemaphoreProperties *properties) +{ + VkPhysicalDeviceExternalSemaphoreInfo semaphore_info_dup = *semaphore_info; + + wine_vk_normalize_semaphore_handle_types_win(&semaphore_info_dup.handleType); + if (semaphore_info_dup.handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) + semaphore_info_dup.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + wine_vk_normalize_semaphore_handle_types_host(&semaphore_info_dup.handleType); + + if (semaphore_info->handleType && !semaphore_info_dup.handleType) + { + properties->exportFromImportedHandleTypes = 0; + properties->compatibleHandleTypes = 0; + properties->externalSemaphoreFeatures = 0; + return; + } + + p_vkGetPhysicalDeviceExternalSemaphoreProperties(phys_dev->host_physical_device, &semaphore_info_dup, properties); + + if (properties->exportFromImportedHandleTypes & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) + properties->exportFromImportedHandleTypes |= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; + wine_vk_normalize_semaphore_handle_types_win(&properties->exportFromImportedHandleTypes); + + if (properties->compatibleHandleTypes & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) + properties->compatibleHandleTypes |= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; + wine_vk_normalize_semaphore_handle_types_win(&properties->compatibleHandleTypes); +} + +void wine_vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice phys_dev_handle, const VkPhysicalDeviceExternalSemaphoreInfo *info, VkExternalSemaphoreProperties *properties) { - properties->exportFromImportedHandleTypes = 0; - properties->compatibleHandleTypes = 0; - properties->externalSemaphoreFeatures = 0; + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); + + TRACE("%p, %p, %p\n", phys_dev, info, properties); + wine_vk_get_physical_device_external_semaphore_properties(phys_dev, phys_dev->instance->funcs.p_vkGetPhysicalDeviceExternalSemaphoreProperties, info, properties); } -void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice phys_dev, +void wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice phys_dev_handle, const VkPhysicalDeviceExternalSemaphoreInfo *info, VkExternalSemaphoreProperties *properties) { - properties->exportFromImportedHandleTypes = 0; - properties->compatibleHandleTypes = 0; - properties->externalSemaphoreFeatures = 0; + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); + + TRACE("%p, %p, %p\n", phys_dev, info, properties); + wine_vk_get_physical_device_external_semaphore_properties(phys_dev, phys_dev->instance->funcs.p_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR, info, properties); } /* @@ -3434,6 +3491,10 @@ NTSTATUS vk_is_available_device_function(void *arg) struct wine_device *device = wine_device_from_handle(params->device); if (!strcmp(params->name, "vkGetMemoryWin32HandleKHR") || !strcmp(params->name, "vkGetMemoryWin32HandlePropertiesKHR")) params->name = "vkGetMemoryFdKHR"; + else if (!strcmp(params->name, "vkGetSemaphoreWin32HandleKHR")) + params->name = "vkGetSemaphoreFdKHR"; + else if (!strcmp(params->name, "vkImportSemaphoreWin32HandleKHR")) + params->name = "vkImportSemaphoreFdKHR"; return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, params->name); } @@ -3461,6 +3522,10 @@ NTSTATUS vk_is_available_device_function32(void *arg) char *name = UlongToPtr(params->name); if (!strcmp(name, "vkGetMemoryWin32HandleKHR") || !strcmp(name, "vkGetMemoryWin32HandlePropertiesKHR")) return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkGetMemoryFdKHR"); + if (!strcmp(name, "vkGetSemaphoreWin32HandleKHR")) + return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkGetSemaphoreFdKHR"); + if (!strcmp(name, "vkImportSemaphoreWin32HandleKHR")) + return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkImportSemaphoreFdKHR"); return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, UlongToPtr(params->name)); } @@ -3546,3 +3611,96 @@ VkResult wine_vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMem handleType must not be one of the handle types defined as opaque */ return VK_ERROR_INVALID_EXTERNAL_HANDLE; } + + +VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateInfo *create_info, + const VkAllocationCallbacks *allocator, VkSemaphore *semaphore, void *win_create_info) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + VkExportSemaphoreCreateInfo *export_semaphore_info; + + TRACE("%p %p %p %p", device, create_info, allocator, semaphore); + + if ((export_semaphore_info = wine_vk_find_struct(create_info, EXPORT_SEMAPHORE_CREATE_INFO))) + { + if (export_semaphore_info->handleTypes & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) + export_semaphore_info->handleTypes |= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + wine_vk_normalize_semaphore_handle_types_host(&export_semaphore_info->handleTypes); + } + + if (wine_vk_find_struct(win_create_info, EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)) + FIXME("VkExportSemaphoreWin32HandleInfoKHR unhandled.\n"); + + return device->funcs.p_vkCreateSemaphore(device->host_device, create_info, NULL, semaphore); +} + +VkResult wine_vkGetSemaphoreWin32HandleKHR(VkDevice device_handle, const VkSemaphoreGetWin32HandleInfoKHR *handle_info, + HANDLE *handle) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + VkSemaphoreGetFdInfoKHR fd_info; + VkResult res; + int fd; + + fd_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; + fd_info.pNext = handle_info->pNext; + fd_info.semaphore = handle_info->semaphore; + fd_info.handleType = handle_info->handleType; + if (fd_info.handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + wine_vk_normalize_semaphore_handle_types_host(&fd_info.handleType); + + res = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd); + + if (res != VK_SUCCESS) + return res; + + if (wine_server_fd_to_handle(fd, GENERIC_ALL, 0, handle) != STATUS_SUCCESS) + { + close(fd); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + return VK_SUCCESS; +} + +VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, + const VkImportSemaphoreWin32HandleInfoKHR *handle_info) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + VkImportSemaphoreFdInfoKHR fd_info; + VkResult res; + int fd; + + fd_info.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR; + fd_info.pNext = handle_info->pNext; + fd_info.semaphore = handle_info->semaphore; + fd_info.flags = handle_info->flags; + fd_info.handleType = handle_info->handleType; + + if (fd_info.handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) + { + if (handle_info->name) + { + FIXME("Importing win32 semaphore by name not supported.\n"); + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + } + + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + if (wine_server_handle_to_fd(handle_info->handle, GENERIC_ALL, &fd, NULL) != STATUS_SUCCESS) + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + } + wine_vk_normalize_semaphore_handle_types_host(&fd_info.handleType); + + if (!fd_info.handleType) + { + FIXME("Importing win32 semaphore with handle type %#x not supported.\n", handle_info->handleType); + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + } + + /* importing FDs transfers ownership, importing NT handles does not */ + if ((res = device->funcs.p_vkImportSemaphoreFdKHR(device->host_device, &fd_info)) != VK_SUCCESS) + close(fd); + + return res; +} From 2f26b46ac3f17ae5209dde26dded4f22e91e0d59 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 23 Dec 2022 17:49:37 -0600 Subject: [PATCH 1043/1506] winevulkan: Don't convert handles in "unwrapped" conversions. --- dlls/winevulkan/make_vulkan | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 3376eaabe8d..f3a830e7ed6 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -1240,7 +1240,8 @@ class VkHandle(object): return self.driver_handle(name) if unwrap == Unwrap.HOST: return self.host_handle(name) - assert unwrap != Unwrap.NONE + if unwrap == Unwrap.NONE: + return name return None def is_wrapped(self): From 8921e0f9590e09429c9b2446723c56d147a66d17 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Thu, 14 Jul 2022 15:36:52 -0400 Subject: [PATCH 1044/1506] winevulkan: Add initial support for D3D12-Fence compatible timeline semaphores. --- dlls/winevulkan/make_vulkan | 32 ++ dlls/winevulkan/vulkan.c | 814 +++++++++++++++++++++++++++++-- dlls/winevulkan/vulkan_private.h | 39 ++ 3 files changed, 844 insertions(+), 41 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index f3a830e7ed6..56184118c97 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -178,6 +178,13 @@ FUNCTION_OVERRIDES = { "vkCreateCommandPool" : {"extra_param" : "client_ptr"}, "vkGetDeviceProcAddr" : {"dispatch" : False}, "vkAllocateMemory" : {"extra_param" : "pAllocateInfo"}, + "vkGetSemaphoreCounterValue" : {"dispatch" : True}, + "vkSignalSemaphore" : {"dispatch" : True}, + "vkWaitSemaphores" : {"dispatch" : True}, + "vkQueueBindSparse" : {"dispatch" : True}, + "vkQueueSubmit" : {"dispatch" : True}, + "vkQueueSubmit2" : {"dispatch" : True}, + "vkDestroySemaphore" : {"dispatch" : True}, # VK_KHR_external_fence_capabilities "vkGetPhysicalDeviceExternalFencePropertiesKHR" : {"dispatch" : False}, @@ -196,6 +203,14 @@ FUNCTION_OVERRIDES = { # VK_KHR_external_memory_win32 "vkGetMemoryWin32HandleKHR" : {"dispatch" : True}, "vkGetMemoryWin32HandlePropertiesKHR" : {"dispatch" : True}, + + # VK_KHR_timeline_semaphore + "vkGetSemaphoreCounterValueKHR" : {"dispatch" : True}, + "vkSignalSemaphoreKHR" : {"dispatch" : True}, + "vkWaitSemaphoresKHR" : {"dispatch" : True}, + + # VK_KHR_synchronization2 + "vkQueueSubmit2KHR" : {"dispatch" : True}, } # functions for which a user driver entry must be generated @@ -283,6 +298,17 @@ MANUAL_UNIX_THUNKS = { "vkMapMemory2KHR", "vkUnmapMemory", "vkUnmapMemory2KHR", + "vkGetSemaphoreCounterValue", + "vkSignalSemaphore", + "vkWaitSemaphores", + "vkQueueBindSparse", + "vkQueueSubmit", + "vkQueueSubmit2", + "vkDestroySemaphore", + "vkGetSemaphoreCounterValueKHR", + "vkSignalSemaphoreKHR", + "vkWaitSemaphoresKHR", + "vkQueueSubmit2KHR", } # loader functions which are entirely manually implemented @@ -319,7 +345,11 @@ STRUCT_CHAIN_CONVERSIONS = { "VkImageCreateInfo": [], "VkMemoryAllocateInfo": ["VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR", "VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR"], "VkPhysicalDeviceImageFormatInfo2": [], + "VkPhysicalDeviceExternalSemaphoreInfo": [], "VkSemaphoreCreateInfo": ["VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"], + "VkSubmitInfo": [], + "VkSubmitInfo2": [], + "VkBindSparseInfo" : [], } # Some struct members are conditionally ignored and callers are free to leave them uninitialized. @@ -1215,6 +1245,8 @@ class VkHandle(object): return "wine_instance_from_handle({0})->host_instance".format(name) if self.name == "VkDeviceMemory": return "wine_device_memory_from_handle({0})->host_memory".format(name) + if self.name == "VkSemaphore": + return "wine_semaphore_host_handle( wine_semaphore_from_handle({0}) )".format(name) if self.name == "VkPhysicalDevice": return "wine_phys_dev_from_handle({0})->host_physical_device".format(name) if self.name == "VkQueue": diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 2ff23e0b98d..f9cc4ebd0c0 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "ntstatus.h" #define WIN32_NO_STATUS @@ -478,7 +479,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst) { static const char *wine_xr_extension_name = "VK_WINE_openxr_device_extensions"; - unsigned int i, append_xr = 0, replace_win32 = 0; + unsigned int i, append_xr = 0, replace_win32 = 0, append_timeline = 1; VkBaseOutStructure *header; char **xr_extensions_list; @@ -500,12 +501,26 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de append_xr = 1; else if (!strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32") || !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) replace_win32 = 1; + else if (!strcmp(extension_name, "VK_KHR_timeline_semaphore")) + append_timeline = 0; + } + if (append_timeline) + { + append_timeline = 0; + for (i = 0; i < phys_dev->extension_count; ++i) + { + if (!strcmp(phys_dev->extensions[i].extensionName, "VK_KHR_timeline_semaphore")) + { + append_timeline = 1; + break; + } + } } if (append_xr) xr_extensions_list = parse_xr_extensions(&append_xr); - if (phys_dev->external_memory_align || append_xr || replace_win32) + if (phys_dev->external_memory_align || append_xr || replace_win32 || append_timeline) { const char **new_extensions; unsigned int o = 0, count; @@ -515,6 +530,9 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de count += 2; if (append_xr) count += append_xr - 1; + if (append_timeline) + ++count; + new_extensions = conversion_context_alloc(ctx, count * sizeof(*dst->ppEnabledExtensionNames)); for (i = 0; i < dst->enabledExtensionCount; ++i) { @@ -537,6 +555,8 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de TRACE("\t%s\n", xr_extensions_list[i]); new_extensions[o++] = xr_extensions_list[i]; } + if (append_timeline) + new_extensions[o++] = "VK_KHR_timeline_semaphore"; dst->enabledExtensionCount = count; dst->ppEnabledExtensionNames = new_extensions; } @@ -1679,11 +1699,37 @@ static void wine_vk_get_physical_device_external_semaphore_properties(struct win const VkPhysicalDeviceExternalSemaphoreInfo *semaphore_info, VkExternalSemaphoreProperties *properties) { VkPhysicalDeviceExternalSemaphoreInfo semaphore_info_dup = *semaphore_info; + VkSemaphoreTypeCreateInfo semaphore_type_info, *p_semaphore_type_info; - wine_vk_normalize_semaphore_handle_types_win(&semaphore_info_dup.handleType); - if (semaphore_info_dup.handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) - semaphore_info_dup.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; - wine_vk_normalize_semaphore_handle_types_host(&semaphore_info_dup.handleType); + switch(semaphore_info->handleType) + { + case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT: + semaphore_info_dup.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + break; + case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT: + { + if ((p_semaphore_type_info = wine_vk_find_struct(&semaphore_info_dup, SEMAPHORE_TYPE_CREATE_INFO))) + { + p_semaphore_type_info->semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + p_semaphore_type_info->initialValue = 0; + } + else + { + semaphore_type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; + semaphore_type_info.pNext = semaphore_info_dup.pNext; + semaphore_type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + semaphore_type_info.initialValue = 0; + + semaphore_info_dup.pNext = &semaphore_type_info; + } + + semaphore_info_dup.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + break; + } + default: + semaphore_info_dup.handleType = 0; + break; + } if (semaphore_info->handleType && !semaphore_info_dup.handleType) { @@ -1696,11 +1742,11 @@ static void wine_vk_get_physical_device_external_semaphore_properties(struct win p_vkGetPhysicalDeviceExternalSemaphoreProperties(phys_dev->host_physical_device, &semaphore_info_dup, properties); if (properties->exportFromImportedHandleTypes & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) - properties->exportFromImportedHandleTypes |= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; + properties->exportFromImportedHandleTypes = semaphore_info->handleType; wine_vk_normalize_semaphore_handle_types_win(&properties->exportFromImportedHandleTypes); if (properties->compatibleHandleTypes & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) - properties->compatibleHandleTypes |= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; + properties->compatibleHandleTypes = semaphore_info->handleType; wine_vk_normalize_semaphore_handle_types_win(&properties->compatibleHandleTypes); } @@ -3300,7 +3346,7 @@ static VkResult record_compute_cmd(struct wine_device *device, struct wine_swapc return VK_SUCCESS; } -VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pPresentInfo) +VkResult fshack_vk_queue_present(VkQueue queue_handle, const VkPresentInfoKHR *pPresentInfo) { struct wine_queue *queue = wine_queue_from_handle(queue_handle); VkCommandBuffer *blit_cmds = NULL; @@ -3612,73 +3658,305 @@ VkResult wine_vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMem return VK_ERROR_INVALID_EXTERNAL_HANDLE; } +#define IOCTL_SHARED_GPU_RESOURCE_SET_OBJECT CTL_CODE(FILE_DEVICE_VIDEO, 6, METHOD_BUFFERED, FILE_WRITE_ACCESS) + +static bool set_shared_resource_object(HANDLE shared_resource, unsigned int index, HANDLE handle) +{ + IO_STATUS_BLOCK iosb; + struct shared_resource_set_object + { + unsigned int index; + obj_handle_t handle; + } params; + + params.index = index; + params.handle = wine_server_obj_handle(handle); + + return NtDeviceIoControlFile(shared_resource, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_SET_OBJECT, + ¶ms, sizeof(params), NULL, 0) == STATUS_SUCCESS; +} + +#define IOCTL_SHARED_GPU_RESOURCE_GET_OBJECT CTL_CODE(FILE_DEVICE_VIDEO, 6, METHOD_BUFFERED, FILE_READ_ACCESS) + +static HANDLE get_shared_resource_object(HANDLE shared_resource, unsigned int index) +{ + IO_STATUS_BLOCK iosb; + obj_handle_t handle; + + if (NtDeviceIoControlFile(shared_resource, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_GET_OBJECT, + &index, sizeof(index), &handle, sizeof(handle))) + return NULL; + + return wine_server_ptr_handle(handle); +} + +static void d3d12_semaphore_lock(struct wine_semaphore *semaphore) +{ + assert( semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT ); + pthread_mutex_lock(&semaphore->d3d12_fence_shm->mutex); +} + +static void d3d12_semaphore_unlock(struct wine_semaphore *semaphore) +{ + assert( semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT ); + pthread_mutex_unlock(&semaphore->d3d12_fence_shm->mutex); +} VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkSemaphore *semaphore, void *win_create_info) { struct wine_device *device = wine_device_from_handle(device_handle); - VkExportSemaphoreCreateInfo *export_semaphore_info; - TRACE("%p %p %p %p", device, create_info, allocator, semaphore); + VkExportSemaphoreWin32HandleInfoKHR *export_handle_info = wine_vk_find_struct(win_create_info, EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR); + VkExportSemaphoreCreateInfo *export_semaphore_info, timeline_export_info; + VkSemaphoreCreateInfo create_info_dup = *create_info; + VkSemaphoreTypeCreateInfo *found_type_info, type_info; + VkSemaphoreGetFdInfoKHR fd_info; + pthread_mutexattr_t mutex_attr; + struct wine_semaphore *object; + OBJECT_ATTRIBUTES attr; + HANDLE section_handle; + LARGE_INTEGER li; + VkResult res; + SIZE_T size; + int fd; + + TRACE("(%p, %p, %p, %p)\n", device, create_info, allocator, semaphore); - if ((export_semaphore_info = wine_vk_find_struct(create_info, EXPORT_SEMAPHORE_CREATE_INFO))) + if (allocator) + FIXME("Support for allocation callbacks not implemented yet\n"); + + if (!(object = calloc(1, sizeof(*object)))) + return VK_ERROR_OUT_OF_HOST_MEMORY; + + object->handle = INVALID_HANDLE_VALUE; + + if ((export_semaphore_info = wine_vk_find_struct(&create_info_dup, EXPORT_SEMAPHORE_CREATE_INFO))) { + object->export_types = export_semaphore_info->handleTypes; if (export_semaphore_info->handleTypes & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) export_semaphore_info->handleTypes |= VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; wine_vk_normalize_semaphore_handle_types_host(&export_semaphore_info->handleTypes); } - if (wine_vk_find_struct(win_create_info, EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR)) - FIXME("VkExportSemaphoreWin32HandleInfoKHR unhandled.\n"); + if ((res = device->funcs.p_vkCreateSemaphore(device->host_device, &create_info_dup, NULL, &object->semaphore)) != VK_SUCCESS) + goto done; - return device->funcs.p_vkCreateSemaphore(device->host_device, create_info, NULL, semaphore); + if (export_semaphore_info && export_semaphore_info->handleTypes == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) + { + fd_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; + fd_info.pNext = NULL; + fd_info.semaphore = object->semaphore; + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + + if ((res = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd)) == VK_SUCCESS) + { + object->handle = create_gpu_resource(fd, export_handle_info ? export_handle_info->name : NULL); + close(fd); + } + + if (object->handle == INVALID_HANDLE_VALUE) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + } + else if (object->export_types & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + /* compatibleHandleTypes doesn't include any other types */ + assert(object->export_types == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT); + object->handle_type = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT; + + timeline_export_info.sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO; + timeline_export_info.pNext = NULL; + timeline_export_info.handleTypes = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + + type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; + type_info.pNext = &timeline_export_info; + type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + type_info.initialValue = 0; + + create_info_dup.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + create_info_dup.pNext = &type_info; + create_info_dup.flags = 0; + + if ((res = device->funcs.p_vkCreateSemaphore(device->host_device, &create_info_dup, NULL, &object->fence_timeline_semaphore)) != VK_SUCCESS) + goto done; + + fd_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; + fd_info.pNext = NULL; + fd_info.semaphore = object->fence_timeline_semaphore; + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + + if ((res = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd)) == VK_SUCCESS) + { + object->handle = create_gpu_resource(fd, export_handle_info ? export_handle_info->name : NULL); + close(fd); + } + + if (object->handle == INVALID_HANDLE_VALUE) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + + /* Shared Fence Memory */ + InitializeObjectAttributes(&attr, NULL, 0, NULL, NULL); + size = li.QuadPart = sizeof(*object->d3d12_fence_shm); + if (NtCreateSection(§ion_handle, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE, &attr, &li, PAGE_READWRITE, SEC_COMMIT, NULL)) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + + if (!set_shared_resource_object(object->handle, 0, section_handle)) + { + NtClose(section_handle); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + + if (NtMapViewOfSection(section_handle, GetCurrentProcess(), (void**) &object->d3d12_fence_shm, 0, 0, NULL, &size, ViewShare, 0, PAGE_READWRITE)) + { + NtClose(section_handle); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + + NtClose(section_handle); + + if ((found_type_info = wine_vk_find_struct(create_info, SEMAPHORE_TYPE_CREATE_INFO))) + object->d3d12_fence_shm->virtual_value = found_type_info->initialValue; + + pthread_mutexattr_init(&mutex_attr); + pthread_mutexattr_setpshared(&mutex_attr, PTHREAD_PROCESS_SHARED); + if (pthread_mutex_init(&object->d3d12_fence_shm->mutex, &mutex_attr)) + { + pthread_mutexattr_destroy(&mutex_attr); + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto done; + } + pthread_mutexattr_destroy(&mutex_attr); + + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, object, object->fence_timeline_semaphore, object); + } + if (object->fence_timeline_semaphore == VK_NULL_HANDLE) + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, object, object->semaphore, object); + *semaphore = wine_semaphore_to_handle(object); + + done: + + if (res != VK_SUCCESS) + { + if (object->d3d12_fence_shm) + { + pthread_mutex_destroy(&object->d3d12_fence_shm->mutex); + NtUnmapViewOfSection(GetCurrentProcess(), object->d3d12_fence_shm); + } + if (object->handle != INVALID_HANDLE_VALUE) + NtClose(object->handle); + if (object->semaphore != VK_NULL_HANDLE) + device->funcs.p_vkDestroySemaphore(device->host_device, object->semaphore, NULL); + if (object->fence_timeline_semaphore != VK_NULL_HANDLE) + device->funcs.p_vkDestroySemaphore(device->host_device, object->fence_timeline_semaphore, NULL); + free(object); + } + + return res; } VkResult wine_vkGetSemaphoreWin32HandleKHR(VkDevice device_handle, const VkSemaphoreGetWin32HandleInfoKHR *handle_info, HANDLE *handle) +{ + struct wine_semaphore *semaphore = wine_semaphore_from_handle(handle_info->semaphore); + + if (!(semaphore->export_types & handle_info->handleType)) + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + + if (NtDuplicateObject( NtCurrentProcess(), semaphore->handle, NtCurrentProcess(), handle, 0, 0, DUPLICATE_SAME_ACCESS )) + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + + return VK_SUCCESS; +} + +void wine_vkDestroySemaphore(VkDevice device_handle, VkSemaphore semaphore_handle, const VkAllocationCallbacks *allocator) { struct wine_device *device = wine_device_from_handle(device_handle); - VkSemaphoreGetFdInfoKHR fd_info; - VkResult res; - int fd; + struct wine_semaphore *semaphore = wine_semaphore_from_handle(semaphore_handle); - fd_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; - fd_info.pNext = handle_info->pNext; - fd_info.semaphore = handle_info->semaphore; - fd_info.handleType = handle_info->handleType; - if (fd_info.handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) - fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; - wine_vk_normalize_semaphore_handle_types_host(&fd_info.handleType); + TRACE("%p, %p, %p\n", device, semaphore, allocator); - res = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd); + if (allocator) + FIXME("Support for allocation callbacks not implemented yet\n"); - if (res != VK_SUCCESS) - return res; + if (!semaphore) + return; - if (wine_server_fd_to_handle(fd, GENERIC_ALL, 0, handle) != STATUS_SUCCESS) - { - close(fd); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } + if (semaphore->handle != INVALID_HANDLE_VALUE) + NtClose(semaphore->handle); - return VK_SUCCESS; + if (semaphore->d3d12_fence_shm) + NtUnmapViewOfSection(GetCurrentProcess(), semaphore->d3d12_fence_shm); + + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, semaphore); + device->funcs.p_vkDestroySemaphore(device->host_device, semaphore->semaphore, NULL); + + if (semaphore->fence_timeline_semaphore) + device->funcs.p_vkDestroySemaphore(device->host_device, semaphore->fence_timeline_semaphore, NULL); + + free(semaphore); } VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, const VkImportSemaphoreWin32HandleInfoKHR *handle_info) { struct wine_device *device = wine_device_from_handle(device_handle); + struct wine_semaphore *semaphore = wine_semaphore_from_handle(handle_info->semaphore); + struct wine_semaphore output_semaphore; + VkSemaphoreTypeCreateInfo type_info; VkImportSemaphoreFdInfoKHR fd_info; + VkSemaphoreCreateInfo create_info; + HANDLE d3d12_fence_shm; + NTSTATUS stat; VkResult res; - int fd; + SIZE_T size; + + TRACE("(%p, %p). semaphore = %p handle = %p\n", device, handle_info, semaphore, handle_info->handle); + + if (handle_info->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT && !semaphore->fence_timeline_semaphore) + { + type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; + type_info.pNext = NULL; + type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + type_info.initialValue = 0; + + create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + create_info.pNext = &type_info; + create_info.flags = 0; + + if ((res = device->funcs.p_vkCreateSemaphore(device->host_device, &create_info, NULL, &semaphore->fence_timeline_semaphore)) != VK_SUCCESS) + { + ERR("Failed to create timeline semaphore backing D3D12 semaphore. vr %d.\n", res); + return res; + }; + + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, semaphore); + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, semaphore, semaphore->fence_timeline_semaphore, semaphore); + } + + output_semaphore = *semaphore; + output_semaphore.handle = NULL; + output_semaphore.handle_type = handle_info->handleType; + output_semaphore.d3d12_fence_shm = NULL; fd_info.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR; fd_info.pNext = handle_info->pNext; - fd_info.semaphore = handle_info->semaphore; + fd_info.semaphore = wine_semaphore_host_handle(&output_semaphore); fd_info.flags = handle_info->flags; fd_info.handleType = handle_info->handleType; - if (fd_info.handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT) + if (handle_info->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT || + handle_info->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) { if (handle_info->name) { @@ -3686,10 +3964,49 @@ VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, return VK_ERROR_INVALID_EXTERNAL_HANDLE; } + if (NtDuplicateObject( NtCurrentProcess(), handle_info->handle, NtCurrentProcess(), &output_semaphore.handle, 0, 0, DUPLICATE_SAME_ACCESS )) + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; - if (wine_server_handle_to_fd(handle_info->handle, GENERIC_ALL, &fd, NULL) != STATUS_SUCCESS) + if ((fd_info.fd = get_shared_resource_fd(output_semaphore.handle)) == -1) + { + WARN("Invalid handle %p.\n", handle_info->handle); + NtClose(output_semaphore.handle); return VK_ERROR_INVALID_EXTERNAL_HANDLE; + } + + if (handle_info->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + if (handle_info->flags & VK_SEMAPHORE_IMPORT_TEMPORARY_BIT) + { + FIXME("Temporarily importing d3d12 fences unsupported.\n"); + close(fd_info.fd); + NtClose(output_semaphore.handle); + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + } + + if (!(d3d12_fence_shm = get_shared_resource_object(output_semaphore.handle, 0))) + { + ERR("Failed to get D3D12 semaphore memory.\n"); + close(fd_info.fd); + NtClose(output_semaphore.handle); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + size = sizeof(*output_semaphore.d3d12_fence_shm); + if ((stat = NtMapViewOfSection(d3d12_fence_shm, GetCurrentProcess(), (void**) &output_semaphore.d3d12_fence_shm, 0, 0, NULL, &size, ViewShare, 0, PAGE_READWRITE))) + { + ERR("Failed to map D3D12 semaphore memory. stat %#x.\n", (int)stat); + close(fd_info.fd); + NtClose(d3d12_fence_shm); + NtClose(output_semaphore.handle); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + NtClose(d3d12_fence_shm); + } } + wine_vk_normalize_semaphore_handle_types_host(&fd_info.handleType); if (!fd_info.handleType) @@ -3698,9 +4015,424 @@ VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, return VK_ERROR_INVALID_EXTERNAL_HANDLE; } - /* importing FDs transfers ownership, importing NT handles does not */ - if ((res = device->funcs.p_vkImportSemaphoreFdKHR(device->host_device, &fd_info)) != VK_SUCCESS) - close(fd); + if ((res = device->funcs.p_vkImportSemaphoreFdKHR(device->host_device, &fd_info)) == VK_SUCCESS) + { + if (semaphore->handle) + NtClose(semaphore->handle); + if (semaphore->d3d12_fence_shm) + NtUnmapViewOfSection(GetCurrentProcess(), semaphore->d3d12_fence_shm); + + *semaphore = output_semaphore; + } + else + { + if (output_semaphore.handle) + NtClose(output_semaphore.handle); + if (output_semaphore.d3d12_fence_shm) + NtUnmapViewOfSection(GetCurrentProcess(), output_semaphore.d3d12_fence_shm); + + /* importing FDs transfers ownership, importing NT handles does not */ + close(fd_info.fd); + } return res; } + +static VkResult vk_get_semaphore_counter_value(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value, bool khr) +{ + struct wine_semaphore *semaphore = wine_semaphore_from_handle(semaphore_handle); + struct wine_device *device = wine_device_from_handle(device_handle); + + if (khr) + return device->funcs.p_vkGetSemaphoreCounterValueKHR(device->host_device, wine_semaphore_host_handle(semaphore), value); + else + return device->funcs.p_vkGetSemaphoreCounterValue(device->host_device, wine_semaphore_host_handle(semaphore), value); +} + +static VkResult wine_vk_get_semaphore_counter_value(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value, bool khr) +{ + struct wine_semaphore *semaphore = wine_semaphore_from_handle(semaphore_handle); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + d3d12_semaphore_lock(semaphore); + *value = semaphore->d3d12_fence_shm->virtual_value; + d3d12_semaphore_unlock(semaphore); + return VK_SUCCESS; + } + + return vk_get_semaphore_counter_value(device_handle, semaphore_handle, value, khr); +} + +VkResult wine_vkGetSemaphoreCounterValue(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value) +{ + return wine_vk_get_semaphore_counter_value(device_handle, semaphore_handle, value, false); +} + +VkResult wine_vkGetSemaphoreCounterValueKHR(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value) +{ + return wine_vk_get_semaphore_counter_value(device_handle, semaphore_handle, value, true); +} + +static VkResult vk_signal_semaphore(VkDevice device_handle, const VkSemaphoreSignalInfo *signal_info, bool khr) +{ + struct wine_semaphore *semaphore = wine_semaphore_from_handle(signal_info->semaphore); + struct wine_device *device = wine_device_from_handle(device_handle); + VkSemaphoreSignalInfo dup_signal_info = *signal_info; + + dup_signal_info.semaphore = wine_semaphore_host_handle(semaphore); + if (khr) + return device->funcs.p_vkSignalSemaphoreKHR(device->host_device, &dup_signal_info); + else + return device->funcs.p_vkSignalSemaphore(device->host_device, &dup_signal_info); +} + +static NTSTATUS wine_vk_signal_semaphore(VkDevice device, const VkSemaphoreSignalInfo *signal_info, bool khr) +{ + struct wine_semaphore *semaphore = wine_semaphore_from_handle(signal_info->semaphore); + + TRACE("(%p, %p)\n", device, signal_info); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Signalling D3D12-Fence compatible timeline semaphore not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + + return vk_signal_semaphore(device, signal_info, khr); +} + +VkResult wine_vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *signal_info) +{ + return wine_vk_signal_semaphore(device, signal_info, false); +} + +VkResult wine_vkSignalSemaphoreKHR(VkDevice device, const VkSemaphoreSignalInfo *signal_info) +{ + return wine_vk_signal_semaphore(device, signal_info, true); +} + +static VkSemaphore *unwrap_semaphore_array(const VkSemaphore *in, uint32_t count, struct conversion_context *ctx) +{ + VkSemaphore *out; + unsigned int i; + + if (!in || !count) return NULL; + + out = conversion_context_alloc(ctx, count * sizeof(*out)); + for (i = 0; i < count; ++i) + out[i] = in[i] ? wine_semaphore_host_handle(wine_semaphore_from_handle(in[i])) : VK_NULL_HANDLE; + + return out; +} + +static VkResult vk_wait_semaphores(struct wine_device *device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout, bool khr) +{ + VkSemaphoreWaitInfo wait_info_dup = *wait_info; + struct conversion_context ctx; + VkResult ret; + + init_conversion_context(&ctx); + wait_info_dup.pSemaphores = unwrap_semaphore_array(wait_info->pSemaphores, wait_info->semaphoreCount, &ctx); + if (khr) + ret = device->funcs.p_vkWaitSemaphoresKHR(device->host_device, &wait_info_dup, timeout); + else + ret = device->funcs.p_vkWaitSemaphores(device->host_device, &wait_info_dup, timeout); + free_conversion_context(&ctx); + return ret; +} + +static VkResult wine_vk_wait_semaphores(VkDevice device_handle, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout, bool khr) +{ + unsigned int i; + + TRACE("(%p, %p, 0x%s)\n", device_handle, wait_info, wine_dbgstr_longlong(timeout)); + + for (i = 0; i < wait_info->semaphoreCount; i++) + { + struct wine_semaphore *semaphore = wine_semaphore_from_handle(wait_info->pSemaphores[i]); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Waiting on D3D12-Fence compatible timeline semaphores not supported."); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + return vk_wait_semaphores(wine_device_from_handle(device_handle), wait_info, timeout, khr); +} + +VkResult wine_vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout) +{ + return wine_vk_wait_semaphores(device, wait_info, timeout, false); +} + +VkResult wine_vkWaitSemaphoresKHR(VkDevice device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout) +{ + return wine_vk_wait_semaphores(device, wait_info, timeout, true); +} + +VkResult vk_queue_submit_unwrap(struct wine_queue *queue, uint32_t submit_count, const VkSubmitInfo *submits_orig, VkFence fence) +{ + struct conversion_context ctx; + VkSubmitInfo *submits; + unsigned int i, j; + VkResult ret; + + init_conversion_context(&ctx); + MEMDUP(&ctx, submits, submits_orig, submit_count); + for (i = 0; i < submit_count; ++i) + { + submits[i].pWaitSemaphores = unwrap_semaphore_array(submits[i].pWaitSemaphores, submits[i].waitSemaphoreCount, &ctx); + submits[i].pSignalSemaphores = unwrap_semaphore_array(submits[i].pSignalSemaphores, submits[i].signalSemaphoreCount, &ctx); + if (submits[i].pCommandBuffers && submits[i].commandBufferCount) + { + VkCommandBuffer *out; + + out = conversion_context_alloc(&ctx, submits[i].commandBufferCount * sizeof(*out)); + for (j = 0; j < submits[i].commandBufferCount; ++j) + out[j] = wine_cmd_buffer_from_handle(submits[i].pCommandBuffers[j])->host_command_buffer; + submits[i].pCommandBuffers = out; + } + } + ret = queue->device->funcs.p_vkQueueSubmit(queue->host_queue, submit_count, submits, fence); + free_conversion_context(&ctx); + return ret; +} + +VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo *submits, VkFence fence) +{ + struct wine_queue *queue = wine_queue_from_handle(queue_handle); + unsigned int i, k; + + TRACE("(%p %u %p 0x%s)\n", queue_handle, submit_count, submits, wine_dbgstr_longlong(fence)); + + for (i = 0; i < submit_count; i++) + { + for (k = 0; k < submits[i].waitSemaphoreCount; k++) + { + if (wine_semaphore_from_handle(submits[i].pWaitSemaphores[k])->handle_type == + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Queue submissions with waits on D3D12-Fence compatible timeline semaphores not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + + for (k = 0; k < submits[i].signalSemaphoreCount; k++) + { + if (wine_semaphore_from_handle(submits[i].pSignalSemaphores[k])->handle_type == + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Queue submissions with signalling D3D12-Fence compatible timeline semaphores not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + } + return vk_queue_submit_unwrap(queue, submit_count, submits, fence); +} + +static void duplicate_array_for_unwrapping(struct conversion_context *ctx, void **ptr, unsigned int size) +{ + void *out; + + if (!*ptr || !size) + return; + + out = conversion_context_alloc(ctx, size); + memcpy(out, *ptr, size); + *ptr = out; +} + +VkResult vk_queue_submit_2_unwrap(struct wine_queue *queue, uint32_t submit_count, const VkSubmitInfo2 *submits_orig, + VkFence fence, bool khr) +{ + struct conversion_context ctx; + VkSubmitInfo2 *submits; + unsigned int i, j; + VkResult ret; + + init_conversion_context(&ctx); + MEMDUP(&ctx, submits, submits_orig, submit_count); + for (i = 0; i < submit_count; ++i) + { + duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pWaitSemaphoreInfos, + submits[i].waitSemaphoreInfoCount * sizeof(*submits[i].pWaitSemaphoreInfos)); + for (j = 0; j < submits[i].waitSemaphoreInfoCount; ++j) + if (submits[i].pWaitSemaphoreInfos[j].semaphore) + ((VkSemaphoreSubmitInfo *)submits[i].pWaitSemaphoreInfos)[j].semaphore + = wine_semaphore_host_handle(wine_semaphore_from_handle(submits[i].pWaitSemaphoreInfos[j].semaphore)); + + duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pSignalSemaphoreInfos, + submits[i].signalSemaphoreInfoCount * sizeof(*submits[i].pSignalSemaphoreInfos)); + for (j = 0; j < submits[i].signalSemaphoreInfoCount; ++j) + if (submits[i].pSignalSemaphoreInfos[j].semaphore) + ((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j].semaphore + = wine_semaphore_host_handle(wine_semaphore_from_handle(submits[i].pSignalSemaphoreInfos[j].semaphore)); + + if (submits[i].pCommandBufferInfos && submits[i].commandBufferInfoCount) + { + duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pCommandBufferInfos, + submits[i].commandBufferInfoCount * sizeof(*submits[i].pCommandBufferInfos)); + for (j = 0; j < submits[i].commandBufferInfoCount; ++j) + ((VkCommandBufferSubmitInfo *)submits[i].pCommandBufferInfos)[j].commandBuffer + = wine_cmd_buffer_from_handle(submits[i].pCommandBufferInfos[j].commandBuffer)->host_command_buffer; + } + } + if (khr) + ret = queue->device->funcs.p_vkQueueSubmit2KHR(queue->host_queue, submit_count, submits, fence); + else + ret = queue->device->funcs.p_vkQueueSubmit2(queue->host_queue, submit_count, submits, fence); + free_conversion_context(&ctx); + return ret; +} + +static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence, bool khr) +{ + struct wine_queue *queue = wine_queue_from_handle(queue_handle); + unsigned int i, k; + + TRACE("(%p, %u, %p, %s)\n", queue_handle, submit_count, submits, wine_dbgstr_longlong(fence)); + + for (i = 0; i < submit_count; i++) + { + for (k = 0; k < submits[i].waitSemaphoreInfoCount; k++) + { + if (wine_semaphore_from_handle(submits[i].pWaitSemaphoreInfos[k].semaphore)->handle_type == + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Queue submissions with waits on D3D12-Fence compatible timeline semaphores not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + + for (k = 0; k < submits[i].signalSemaphoreInfoCount; k++) + { + if (wine_semaphore_from_handle(submits[i].pSignalSemaphoreInfos[k].semaphore)->handle_type == + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Queue submissions signalling D3D12-Fence compatible timeline semaphores not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + } + + return vk_queue_submit_2_unwrap(queue, submit_count, submits, fence, khr); +} + +VkResult wine_vkQueueSubmit2(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence) +{ + return vk_queue_submit_2(queue, submit_count, submits, fence, false); +} + +VkResult wine_vkQueueSubmit2KHR(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence) +{ + return vk_queue_submit_2(queue, submit_count, submits, fence, true); +} + +VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *present_info) +{ + VkPresentInfoKHR host_present_info = *present_info; + struct wine_semaphore *semaphore; + struct conversion_context ctx; + unsigned int i; + VkResult ret; + + TRACE("%p %p\n", queue_handle, present_info); + + for (i = 0; i < present_info->waitSemaphoreCount; ++i) + { + semaphore = wine_semaphore_from_handle(present_info->pWaitSemaphores[i]); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Waiting on D3D12-Fence compatible timeline semaphore not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + + init_conversion_context(&ctx); + host_present_info.pWaitSemaphores = unwrap_semaphore_array(present_info->pWaitSemaphores, present_info->waitSemaphoreCount, &ctx); + ret = fshack_vk_queue_present(queue_handle, &host_present_info); + free_conversion_context(&ctx); + return ret; +} + +VkResult wine_vkQueueBindSparse(VkQueue queue_handle, uint32_t bind_info_count, const VkBindSparseInfo *bind_info, VkFence fence) +{ + struct wine_queue *queue = wine_queue_from_handle(queue_handle); + struct wine_semaphore *semaphore; + struct conversion_context ctx; + VkBindSparseInfo *batch; + unsigned int i, j, k; + VkResult ret; + + TRACE("(%p, %u, %p, 0x%s)\n", queue, bind_info_count, bind_info, wine_dbgstr_longlong(fence)); + + for (i = 0; i < bind_info_count; i++) + { + batch = (VkBindSparseInfo *)&bind_info[i]; + + for (k = 0; k < batch->waitSemaphoreCount; k++) + { + semaphore = wine_semaphore_from_handle(batch->pWaitSemaphores[k]); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Waiting on D3D12-Fence compatible timeline semaphore not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + + for(k = 0; k < batch->signalSemaphoreCount; k++) + { + semaphore = wine_semaphore_from_handle(batch->pSignalSemaphores[k]); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + FIXME("Signalling D3D12-Fence compatible timeline semaphore not supported.\n"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + } + } + + init_conversion_context(&ctx); + for (i = 0; i < bind_info_count; ++i) + { + batch = (VkBindSparseInfo *)&bind_info[i]; + batch->pWaitSemaphores = unwrap_semaphore_array(batch->pWaitSemaphores, batch->waitSemaphoreCount, &ctx); + batch->pSignalSemaphores = unwrap_semaphore_array(batch->pSignalSemaphores, batch->signalSemaphoreCount, &ctx); + + duplicate_array_for_unwrapping(&ctx, (void **)&batch->pBufferBinds, batch->bufferBindCount * sizeof(*batch->pBufferBinds)); + for (j = 0; j < batch->bufferBindCount; ++j) + { + VkSparseBufferMemoryBindInfo *bind = (VkSparseBufferMemoryBindInfo *)&batch->pBufferBinds[j]; + duplicate_array_for_unwrapping(&ctx, (void **)&bind->pBinds, bind->bindCount * sizeof(*bind->pBinds)); + for (k = 0; k < bind->bindCount; ++k) + if (bind->pBinds[k].memory) + ((VkSparseMemoryBind *)bind->pBinds)[k].memory = wine_device_memory_from_handle(bind->pBinds[k].memory)->host_memory; + } + + duplicate_array_for_unwrapping(&ctx, (void **)&batch->pImageOpaqueBinds, batch->imageOpaqueBindCount * sizeof(*batch->pImageOpaqueBinds)); + for (j = 0; j < batch->imageOpaqueBindCount; ++j) + { + VkSparseImageOpaqueMemoryBindInfo *bind = (VkSparseImageOpaqueMemoryBindInfo *)&batch->pImageOpaqueBinds[j]; + duplicate_array_for_unwrapping(&ctx, (void **)&bind->pBinds, bind->bindCount * sizeof(*bind->pBinds)); + for (k = 0; k < bind->bindCount; ++k) + if (bind->pBinds[k].memory) + ((VkSparseMemoryBind *)bind->pBinds)[k].memory = wine_device_memory_from_handle(bind->pBinds[k].memory)->host_memory; + } + + duplicate_array_for_unwrapping(&ctx, (void **)&batch->pImageBinds, batch->imageBindCount * sizeof(*batch->pImageBinds)); + for (j = 0; j < batch->imageBindCount; ++j) + { + VkSparseImageMemoryBindInfo *bind = (VkSparseImageMemoryBindInfo *)&batch->pImageBinds[j]; + duplicate_array_for_unwrapping(&ctx, (void **)&bind->pBinds, bind->bindCount * sizeof(*bind->pBinds)); + for (k = 0; k < bind->bindCount; ++k) + if (bind->pBinds[k].memory) + ((VkSparseImageMemoryBind *)bind->pBinds)[k].memory = wine_device_memory_from_handle(bind->pBinds[k].memory)->host_memory; + } + } + ret = queue->device->funcs.p_vkQueueBindSparse(queue->host_queue, bind_info_count, bind_info, fence); + free_conversion_context(&ctx); + return ret; +} diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index a913a3fb6d0..f3315707200 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -324,6 +324,42 @@ static inline void free_conversion_context(struct conversion_context *pool) free(entry); } +struct wine_semaphore +{ + VkSemaphore semaphore; + VkSemaphore fence_timeline_semaphore; + + VkExternalSemaphoreHandleTypeFlagBits export_types; + + struct wine_vk_mapping mapping; + + /* mutable members */ + VkExternalSemaphoreHandleTypeFlagBits handle_type; + HANDLE handle; + struct + { + pthread_mutex_t mutex; + uint64_t virtual_value; + } *d3d12_fence_shm; +}; + +static inline struct wine_semaphore *wine_semaphore_from_handle(VkSemaphore handle) +{ + return (struct wine_semaphore *)(uintptr_t)handle; +} + +static inline VkSemaphore wine_semaphore_to_handle(struct wine_semaphore *semaphore) +{ + return (VkSemaphore)(uintptr_t)semaphore; +} + +static inline VkSemaphore wine_semaphore_host_handle(struct wine_semaphore *semaphore) +{ + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + return semaphore->fence_timeline_semaphore; + return semaphore->semaphore; +} + static inline void *conversion_context_alloc(struct conversion_context *pool, size_t size) { if (pool->used + size <= sizeof(pool->buffer)) @@ -408,4 +444,7 @@ static inline void init_unicode_string( UNICODE_STRING *str, const WCHAR *data ) str->Buffer = (WCHAR *)data; } +#define MEMDUP(ctx, dst, src, count) dst = conversion_context_alloc((ctx), sizeof(*(dst)) * (count)); \ + memcpy((void *)(dst), (src), sizeof(*(dst)) * (count)); + #endif /* __WINE_VULKAN_PRIVATE_H */ From adb91f59fec7cfcefd006aec1cb9d4295bb3b317 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 27 Dec 2022 17:59:06 -0600 Subject: [PATCH 1045/1506] winevulkan: Only append VK_KHR_timeline_semaphore for Vk API version < 1.2. CW-Bug-Id: #22526 --- dlls/winevulkan/vulkan.c | 27 +++++++++++++++++++++++++++ dlls/winevulkan/vulkan_private.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index f9cc4ebd0c0..ed8f0bfe537 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -237,6 +237,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance struct wine_phys_dev *object; uint32_t num_host_properties, num_properties = 0; VkExtensionProperties *host_properties = NULL; + VkPhysicalDeviceProperties physdev_properties; BOOL have_external_memory_host = FALSE; VkResult res; unsigned int i, j; @@ -248,6 +249,9 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance object->handle = handle; object->host_physical_device = phys_dev; + instance->funcs.p_vkGetPhysicalDeviceProperties(phys_dev, &physdev_properties); + object->api_version = physdev_properties.apiVersion; + handle->base.unix_handle = (uintptr_t)object; WINE_VK_ADD_DISPATCHABLE_MAPPING(instance, handle, phys_dev, object); @@ -504,6 +508,8 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de else if (!strcmp(extension_name, "VK_KHR_timeline_semaphore")) append_timeline = 0; } + if (append_timeline) + append_timeline = phys_dev->api_version < VK_API_VERSION_1_2 || phys_dev->instance->api_version < VK_API_VERSION_1_2; if (append_timeline) { append_timeline = 0; @@ -1058,6 +1064,8 @@ VkResult wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, app_info->engineVersion); TRACE("API version %#x.\n", app_info->apiVersion); + object->api_version = app_info->apiVersion; + if (app_info->pEngineName && !strcmp(app_info->pEngineName, "idTech")) object->quirks |= WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR; } @@ -1708,6 +1716,25 @@ static void wine_vk_get_physical_device_external_semaphore_properties(struct win break; case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT: { + unsigned int i; + + if (phys_dev->api_version < VK_API_VERSION_1_2 || + phys_dev->instance->api_version < VK_API_VERSION_1_2) + { + for (i = 0; i < phys_dev->extension_count; i++) + { + if (!strcmp(phys_dev->extensions[i].extensionName, "VK_KHR_timeline_semaphore")) + break; + } + if (i == phys_dev->extension_count) + { + properties->exportFromImportedHandleTypes = 0; + properties->compatibleHandleTypes = 0; + properties->externalSemaphoreFeatures = 0; + return; + } + } + if ((p_semaphore_type_info = wine_vk_find_struct(&semaphore_info_dup, SEMAPHORE_TYPE_CREATE_INFO))) { p_semaphore_type_info->semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index f3315707200..d840e1fc33a 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -144,6 +144,7 @@ struct wine_instance */ struct wine_phys_dev **phys_devs; uint32_t phys_dev_count; + uint32_t api_version; VkBool32 enable_wrapper_list; struct list wrappers; @@ -174,6 +175,7 @@ struct wine_phys_dev VkPhysicalDeviceMemoryProperties memory_properties; VkExtensionProperties *extensions; uint32_t extension_count; + uint32_t api_version; uint32_t external_memory_align; From 9e41b9451adcb4c869e821c70999ccba6293f97c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 2 Aug 2023 19:34:16 -0600 Subject: [PATCH 1046/1506] winevulkan: Force copying VkSubmitInfo[2] structures. Based on patches by Derek Lesho. CW-Bug-Id: #22526 --- dlls/winevulkan/make_vulkan | 46 ++++++++++++++++++++++---------- dlls/winevulkan/vulkan.c | 2 +- dlls/winevulkan/vulkan_private.h | 2 ++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 56184118c97..507537df632 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -182,7 +182,7 @@ FUNCTION_OVERRIDES = { "vkSignalSemaphore" : {"dispatch" : True}, "vkWaitSemaphores" : {"dispatch" : True}, "vkQueueBindSparse" : {"dispatch" : True}, - "vkQueueSubmit" : {"dispatch" : True}, + "vkQueueSubmit" : {"dispatch" : True, "extra_param" : "pSubmits"}, "vkQueueSubmit2" : {"dispatch" : True}, "vkDestroySemaphore" : {"dispatch" : True}, @@ -347,11 +347,16 @@ STRUCT_CHAIN_CONVERSIONS = { "VkPhysicalDeviceImageFormatInfo2": [], "VkPhysicalDeviceExternalSemaphoreInfo": [], "VkSemaphoreCreateInfo": ["VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"], - "VkSubmitInfo": [], + "VkSubmitInfo": ["VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR"], "VkSubmitInfo2": [], "VkBindSparseInfo" : [], } +STRUCT_COPY = { + "VkSubmitInfo", + "VkSubmitInfo2", +}; + # Some struct members are conditionally ignored and callers are free to leave them uninitialized. # We can't deduce that from XML, so we allow expressing it here. MEMBER_LENGTH_EXPRESSIONS = { @@ -1473,6 +1478,9 @@ class VkVariable(object): if struct.needs_conversion(conv, unwrap, Direction.OUTPUT, is_const): conversions.append(StructConversionFunction(struct, Direction.OUTPUT, conv, unwrap, is_const)) + if struct.name in STRUCT_COPY: + conversions.append(StructConversionFunction(struct, Direction.INPUT, False, unwrap, is_const, True)) + if self.is_static_array() or self.is_dynamic_array(): for conv in [False, True]: if self.needs_conversion(conv, unwrap, Direction.INPUT, parent_const): @@ -1602,7 +1610,7 @@ class VkMember(VkVariable): values=values, object_type=object_type, bit_width=bit_width, returnedonly=returnedonly, parent=parent, selection=selection, selector=selector) - def copy(self, input, output, direction, conv, unwrap): + def copy(self, input, output, direction, conv, unwrap, copy): """ Helper method for use by conversion logic to generate a C-code statement to copy this member. - `conv` indicates whether the statement is in a struct alignment conversion path. """ @@ -1658,6 +1666,11 @@ class VkMember(VkVariable): elif self.is_static_array(): bytes_count = "{0} * sizeof({1})".format(self.array_len, self.type) return "memcpy({0}{1}, {2}{1}, {3});\n".format(output, self.name, input, bytes_count) + elif self.is_dynamic_array() and copy: + if self.type == "void": + return "MEMDUP_VOID(ctx, {0}{1}, {2}{1}, {3});\n".format(output, self.name, input, self.get_dyn_array_len(input, conv)) + else: + return "MEMDUP(ctx, {0}{1}, {2}{1}, {3});\n".format(output, self.name, input, self.get_dyn_array_len(input, conv)) elif direction == Direction.INPUT: return "{0}{1} = {2};\n".format(output, self.name, self.value(input, conv)) elif conv and direction == Direction.OUTPUT and self.is_pointer(): @@ -2381,17 +2394,21 @@ class VkStruct(Sequence): class StructConversionFunction(object): - def __init__(self, struct, direction, conv, unwrap, const): + def __init__(self, struct, direction, conv, unwrap, const, copy=False): self.direction = direction self.operand = struct self.type = struct.name self.conv = conv self.unwrap = unwrap self.const = const + self.copy = copy - name = "convert_{0}_".format(self.type) - win_type = "win32" if self.conv else "win64" - name += convert_suffix(direction, win_type, unwrap, struct.is_wrapped()) + if copy: + name = "copy_{0}".format(self.type) + else: + name = "convert_{0}_".format(self.type) + win_type = "win32" if self.conv else "win64" + name += convert_suffix(direction, win_type, unwrap, struct.is_wrapped()) self.name = name def __eq__(self, other): @@ -2423,7 +2440,7 @@ class StructConversionFunction(object): body = "" - if not self.conv: + if not self.conv and not self.copy: body += "#ifdef _WIN64\n" needs_alloc = self.direction != Direction.OUTPUT and self.operand.needs_alloc(self.conv, self.unwrap) @@ -2433,8 +2450,11 @@ class StructConversionFunction(object): if self.direction == Direction.OUTPUT and self.const: win_type = "const " + win_type - if self.conv: + if self.copy: + body += "void {0}(".format(self.name) + else: body += "static inline void {0}(".format(self.name) + if self.conv: if self.direction == Direction.OUTPUT: params = ["const {0} *in".format(self.type), "{0} *out".format(win_type)] @@ -2451,8 +2471,6 @@ class StructConversionFunction(object): body += ")\n" else: - body += "static inline void {0}(".format(self.name) - params = ["const {0} *in".format(self.type), "{0} *out".format(self.type)] # Generate parameter list @@ -2492,7 +2510,7 @@ class StructConversionFunction(object): body += " || ".join("selector == {}".format(s) for s in m.selection) body += ")\n " - body += " " + m.copy("in->", "out->", self.direction, self.conv, self.unwrap) + body += " " + m.copy("in->", "out->", self.direction, self.conv, self.unwrap, self.copy) if needs_extensions: if self.conv and self.direction == Direction.INPUT: @@ -2551,7 +2569,7 @@ class StructConversionFunction(object): if m.name == "pNext": copy_body += ident + "out_ext->pNext = NULL;\n" continue - copy_body += ident + m.copy("in_ext->", "out_ext->", self.direction, self.conv, Unwrap.HOST) + copy_body += ident + m.copy("in_ext->", "out_ext->", self.direction, self.conv, Unwrap.HOST, self.copy) # Generate the definition of "in_ext" if we need it if "in_ext->" in copy_body: @@ -2586,7 +2604,7 @@ class StructConversionFunction(object): body += " FIXME(\"Unexpected pNext\\n\");\n" body += "}\n" - if not self.conv: + if not self.conv and not self.copy: body += "#endif /* _WIN64 */\n" body += "\n" diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index ed8f0bfe537..689e09e8cf6 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -4226,7 +4226,7 @@ VkResult vk_queue_submit_unwrap(struct wine_queue *queue, uint32_t submit_count, return ret; } -VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo *submits, VkFence fence) +VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo *submits, VkFence fence, void *submits_win_ptr) { struct wine_queue *queue = wine_queue_from_handle(queue_handle); unsigned int i, k; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index d840e1fc33a..891fc244527 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -448,5 +448,7 @@ static inline void init_unicode_string( UNICODE_STRING *str, const WCHAR *data ) #define MEMDUP(ctx, dst, src, count) dst = conversion_context_alloc((ctx), sizeof(*(dst)) * (count)); \ memcpy((void *)(dst), (src), sizeof(*(dst)) * (count)); +#define MEMDUP_VOID(ctx, dst, src, size) dst = conversion_context_alloc((ctx), size); \ + memcpy((void *)(dst), (src), size); #endif /* __WINE_VULKAN_PRIVATE_H */ From 051bc63d4d2079d80669815e8b6be339eb5be654 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 31 Jul 2023 11:12:21 -0600 Subject: [PATCH 1047/1506] winevulkan: Support waiting for and signalling d3d12 shared fences. CW-Bug-Id: #22526 --- dlls/winevulkan/vulkan.c | 708 +++++++++++++++++++++++++------ dlls/winevulkan/vulkan_private.h | 39 +- 2 files changed, 610 insertions(+), 137 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 689e09e8cf6..d1513df606f 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -26,6 +26,13 @@ #include #include #include +#include +#include +#include +#include +#ifdef HAVE_SYS_SYSCALL_H +# include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -33,6 +40,7 @@ #include "winnt.h" #include "winioctl.h" #include "wine/server.h" +#include "wine/list.h" #include "vulkan_private.h" #include "wine/vulkan_driver.h" @@ -41,6 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan); +static int debug_level; static BOOL is_wow64(void) { @@ -118,6 +127,38 @@ static uint64_t wine_vk_get_wrapper(struct wine_instance *instance, uint64_t hos return result; } +static void signal_timeline_sem(struct wine_device *device, VkSemaphore sem, uint64_t *value) +{ + /* May be called from native thread. */ + struct VkSemaphoreSignalInfo info = { 0 }; + VkResult res; + + info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO; + info.semaphore = sem; + ++*value; + info.value = *value; + if (device->phys_dev->api_version < VK_API_VERSION_1_2 || device->phys_dev->instance->api_version < VK_API_VERSION_1_2) + res = device->funcs.p_vkSignalSemaphoreKHR(device->host_device, &info); + else + res = device->funcs.p_vkSignalSemaphore(device->host_device, &info); + if (res != VK_SUCCESS) + fprintf(stderr, "err:winevulkan:signal_timeline_sem vkSignalSemaphore failed, res=%d.\n", res); +} + +static VkResult wait_semaphores(struct wine_device *device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout) +{ + if (device->phys_dev->api_version < VK_API_VERSION_1_2 || device->phys_dev->instance->api_version < VK_API_VERSION_1_2) + return device->funcs.p_vkWaitSemaphoresKHR(device->host_device, wait_info, timeout); + return device->funcs.p_vkWaitSemaphores(device->host_device, wait_info, timeout); +} + +static VkResult get_semaphore_value(struct wine_device *device, VkSemaphore sem, uint64_t *value) +{ + if (device->phys_dev->api_version < VK_API_VERSION_1_2 || device->phys_dev->instance->api_version < VK_API_VERSION_1_2) + return device->funcs.p_vkGetSemaphoreCounterValueKHR(device->host_device, sem, value); + return device->funcs.p_vkGetSemaphoreCounterValue(device->host_device, sem, value); +} + static VkBool32 debug_utils_callback_conversion(VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT message_types, const VkDebugUtilsMessengerCallbackDataEXT *callback_data, @@ -575,11 +616,32 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de */ static void wine_vk_device_free(struct wine_device *device) { + struct pending_d3d12_fence_op *op; struct wine_queue *queue; if (!device) return; + if (device->signaller_thread) + { + TRACE("Shutting down signaller thread.\n"); + pthread_mutex_lock(&device->signaller_mutex); + device->stop = 1; + signal_timeline_sem(device, device->sem_poll_update.sem, &device->sem_poll_update.value); + pthread_mutex_unlock(&device->signaller_mutex); + pthread_join(device->signaller_thread, NULL); + device->funcs.p_vkDestroySemaphore(device->host_device, device->sem_poll_update.sem, NULL); + pthread_cond_destroy(&device->sem_poll_updated_cond); + TRACE("Signaller thread shut down.\n"); + } + pthread_mutex_destroy(&device->signaller_mutex); + + LIST_FOR_EACH_ENTRY(op, &device->free_fence_ops_list, struct pending_d3d12_fence_op, entry) + { + device->funcs.p_vkDestroySemaphore(device->host_device, op->local_sem.sem, NULL); + free(op); + } + if (device->queues) { unsigned int i; @@ -896,6 +958,9 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre if (!(object = calloc(1, sizeof(*object)))) return VK_ERROR_OUT_OF_HOST_MEMORY; + pthread_mutex_init(&object->signaller_mutex, NULL); + list_init(&object->sem_poll_list); + list_init(&object->free_fence_ops_list); object->phys_dev = phys_dev; if ((callback = (VkCreateInfoWineDeviceCallback *)create_info->pNext) @@ -3729,6 +3794,352 @@ static void d3d12_semaphore_unlock(struct wine_semaphore *semaphore) pthread_mutex_unlock(&semaphore->d3d12_fence_shm->mutex); } +static VkSemaphore create_timeline_semaphore(struct wine_device *device) +{ + VkSemaphoreTypeCreateInfo timeline_info = { 0 }; + VkSemaphoreCreateInfo create_info = { 0 }; + VkSemaphore sem = 0; + VkResult res; + + timeline_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; + timeline_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + create_info.pNext = &timeline_info; + + res = device->funcs.p_vkCreateSemaphore(device->host_device, &create_info, NULL, &sem); + if (res != VK_SUCCESS) + ERR("vkCreateSemaphore failed, res=%d\n", res); + return sem; +} + +static void release_fence_op(struct wine_device *device, struct pending_d3d12_fence_op *op) +{ + list_remove(&op->entry); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, op); + list_add_head(&device->free_fence_ops_list, &op->entry); +} + +static int wait_info_realloc(VkSemaphoreWaitInfo *wait_info, uint32_t *wait_alloc_count) +{ + VkSemaphore *new_sem; + uint64_t *new_values; + + if (wait_info->semaphoreCount + 1 <= *wait_alloc_count) + return 1; + new_sem = realloc((void *)wait_info->pSemaphores, *wait_alloc_count * 2 * sizeof(*new_sem)); + if (!new_sem) + { + fprintf(stderr, "err:winevulkan:wait_info_realloc no memory.\n"); + return 0; + } + new_values = realloc((void *)wait_info->pValues, *wait_alloc_count * 2 * sizeof(*new_values)); + if (!new_values) + { + fprintf(stderr, "err:winevulkan:wait_info_realloc no memory.\n"); + return 0; + } + *wait_alloc_count *= 2; + wait_info->pSemaphores = new_sem; + wait_info->pValues = new_values; + return 1; +} + +static int add_sem_wait(VkSemaphoreWaitInfo *wait_info, uint32_t *wait_alloc_count, VkSemaphore sem, uint64_t value) +{ + if (!wait_info_realloc(wait_info, wait_alloc_count)) + return 0; + ((VkSemaphore *)wait_info->pSemaphores)[wait_info->semaphoreCount] = sem; + ((uint64_t *)wait_info->pValues)[wait_info->semaphoreCount] = value; + ++wait_info->semaphoreCount; + return 1; +} + +static int semaphore_process(struct wine_device *device, struct wine_semaphore *sem, + VkSemaphoreWaitInfo *wait_info, uint32_t *wait_alloc_count) +{ + /* Called from native thread. */ + struct pending_d3d12_fence_op *op, *op2; + uint64_t global_sem_wait_value; + int virtual_value_updated = 0; + uint64_t value, virtual_value; + VkResult res; + + /* Check local pending signal ops completion, update shared semaphore. */ + d3d12_semaphore_lock( sem ); + LIST_FOR_EACH_ENTRY_SAFE(op, op2, &sem->pending_signals, struct pending_d3d12_fence_op, entry) + { + if (op->virtual_value <= sem->d3d12_fence_shm->virtual_value) + goto signal_op_complete; + + res = get_semaphore_value(device, op->local_sem.sem, &value); + if (res != VK_SUCCESS) + { + fprintf(stderr, "err:winevulkan:semaphore_process vkGetSemaphoreCounterValue failed, res=%d.\n", res); + goto signal_op_complete; + } + if (value <= op->local_sem.value) + { + if (!add_sem_wait(wait_info, wait_alloc_count, op->local_sem.sem, op->local_sem.value + 1)) + { + d3d12_semaphore_unlock(sem); + return 0; + } + continue; + } + + sem->d3d12_fence_shm->virtual_value = op->virtual_value; + virtual_value_updated = 1; +signal_op_complete: + ++op->local_sem.value; + release_fence_op(device, op); + } + + if (virtual_value_updated) + signal_timeline_sem(device, sem->fence_timeline_semaphore, &sem->d3d12_fence_shm->physical_value); + global_sem_wait_value = sem->d3d12_fence_shm->physical_value + 1; + virtual_value = sem->d3d12_fence_shm->virtual_value; + d3d12_semaphore_unlock(sem); + + /* Complete satisfied local waits. */ + LIST_FOR_EACH_ENTRY_SAFE(op, op2, &sem->pending_waits, struct pending_d3d12_fence_op, entry) + { + if (op->virtual_value > virtual_value) + continue; + + signal_timeline_sem(device, op->local_sem.sem, &op->local_sem.value); + release_fence_op(device, op); + } + + /* Only poll shared semaphore if there are waits pending. */ + if (list_empty(&sem->pending_waits)) + return 1; + return add_sem_wait(wait_info, wait_alloc_count, sem->fence_timeline_semaphore, global_sem_wait_value); +} + +#define SIGNALLER_INITIAL_WAIT_COUNT 256 + +void *signaller_worker(void *arg) +{ +#ifdef HAVE_SYS_SYSCALL_H + int unix_tid = syscall( __NR_gettid ); +#else + int unix_tid = -1; +#endif + struct wine_device *device = arg; + struct wine_semaphore *sem; + VkSemaphoreWaitInfo wait_info = { 0 }; + uint32_t wait_alloc_count = 0; + VkResult res; + + if (debug_level) + fprintf(stderr, "[%d] msg:winevulkan:signaller_worker started.\n", unix_tid); + + wait_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO; + wait_info.flags = VK_SEMAPHORE_WAIT_ANY_BIT; + wait_alloc_count = SIGNALLER_INITIAL_WAIT_COUNT; + if (!(wait_info.pSemaphores = malloc(sizeof(*wait_info.pSemaphores) * wait_alloc_count))) + { + fprintf(stderr, "err:winevulkan:signaller_worker no memory.\n"); + return NULL; + } + if (!(wait_info.pValues = malloc(sizeof(*wait_info.pValues) * wait_alloc_count))) + { + fprintf(stderr, "err:winevulkan:signaller_worker no memory.\n"); + free((void *)wait_info.pSemaphores); + return NULL; + } + + for (;;) + { + pthread_mutex_lock(&device->signaller_mutex); + if (device->stop) + { + pthread_mutex_unlock(&device->signaller_mutex); + break; + } + wait_info.semaphoreCount = 1; + *(VkSemaphore *)wait_info.pSemaphores = device->sem_poll_update.sem; + *(uint64_t *)wait_info.pValues = device->sem_poll_update.value + 1; + LIST_FOR_EACH_ENTRY(sem, &device->sem_poll_list, struct wine_semaphore, poll_entry) + { + if (!semaphore_process(device, sem, &wait_info, &wait_alloc_count)) + { + pthread_mutex_unlock(&device->signaller_mutex); + break; + } + } + device->sem_poll_update_value = device->sem_poll_update.value; + pthread_cond_signal(&device->sem_poll_updated_cond); + pthread_mutex_unlock(&device->signaller_mutex); + while ((res = wait_semaphores(device, &wait_info, 3000000000ull)) == VK_TIMEOUT) + { + if (wait_info.semaphoreCount > 1) + fprintf(stderr, "err:winevulkan:signaller_worker wait timed out with non-empty poll list.\n"); + } + if (res != VK_SUCCESS) + { + fprintf(stderr, "err:winevulkan:signaller_worker error waiting for semaphores, vr %d.\n", res); + break; + } + } + + free((void *)wait_info.pSemaphores); + free((void *)wait_info.pValues); + if (debug_level) + fprintf(stderr, "[%d] msg:winevulkan:signaller_worker exiting.\n", unix_tid); + + return NULL; +} + +static void register_sem_poll(struct wine_device *device, struct wine_semaphore *semaphore) +{ + pthread_mutex_lock(&device->signaller_mutex); + if (!device->signaller_thread) + { + device->sem_poll_update.sem = create_timeline_semaphore(device); + device->sem_poll_update.value = 0; + pthread_cond_init(&device->sem_poll_updated_cond, NULL); + if (TRACE_ON(vulkan)) + debug_level = 4; + else if (WARN_ON(vulkan)) + debug_level = 3; + else if (FIXME_ON(vulkan)) + debug_level = 2; + else if (ERR_ON(vulkan)) + debug_level = 1; + else + debug_level = 0; + if (pthread_create(&device->signaller_thread, NULL, signaller_worker, device)) + ERR("Failed to create signaller_worker.\n"); + WARN("d3d12 fence used, created signaller worker.\n"); + } + assert(!semaphore->poll_entry.next); + list_add_head(&device->sem_poll_list, &semaphore->poll_entry); + signal_timeline_sem(device, device->sem_poll_update.sem, &device->sem_poll_update.value); + pthread_mutex_unlock(&device->signaller_mutex); +} + +static void update_sem_poll_wait_processed(struct wine_device *device) +{ + uint64_t update_value; + + signal_timeline_sem(device, device->sem_poll_update.sem, &device->sem_poll_update.value); + update_value = device->sem_poll_update.value; + while (device->sem_poll_update_value < update_value) + pthread_cond_wait(&device->sem_poll_updated_cond, &device->signaller_mutex); +} + +static void unregister_sem_poll(struct wine_device *device, struct wine_semaphore *semaphore) +{ + struct list *entry; + + pthread_mutex_lock(&device->signaller_mutex); + list_remove(&semaphore->poll_entry); + semaphore->poll_entry.next = semaphore->poll_entry.prev = NULL; + update_sem_poll_wait_processed(device); + pthread_mutex_unlock(&device->signaller_mutex); + + while ((entry = list_head(&semaphore->pending_waits))) + release_fence_op(device, CONTAINING_RECORD(entry, struct pending_d3d12_fence_op, entry)); + while ((entry = list_head(&semaphore->pending_signals))) + release_fence_op(device, CONTAINING_RECORD(entry, struct pending_d3d12_fence_op, entry)); +} + +static struct pending_d3d12_fence_op *get_free_fence_op(struct wine_device *device) +{ + struct pending_d3d12_fence_op *op; + struct list *entry; + + if ((entry = list_head(&device->free_fence_ops_list))) + { + list_remove(entry); + return CONTAINING_RECORD(entry, struct pending_d3d12_fence_op, entry); + } + + if (!(op = malloc(sizeof(*op)))) + { + ERR("No memory.\n"); + return NULL; + } + op->local_sem.sem = create_timeline_semaphore(device); + op->local_sem.value = 0; + ++device->allocated_fence_ops_count; + TRACE("Total allocated fence ops %u.\n", device->allocated_fence_ops_count); + return op; +} + +static void add_sem_wait_op(struct wine_device *device, struct wine_semaphore *semaphore, uint64_t virtual_value, + VkSemaphore *phys_semaphore, uint64_t *phys_wait_value) +{ + struct pending_d3d12_fence_op *op; + + pthread_mutex_lock(&device->signaller_mutex); + LIST_FOR_EACH_ENTRY(op, &semaphore->pending_waits, struct pending_d3d12_fence_op, entry) + { + if (op->virtual_value == virtual_value) + { + *phys_semaphore = op->local_sem.sem; + *phys_wait_value = op->local_sem.value + 1; + pthread_mutex_unlock(&device->signaller_mutex); + return; + } + } + if ((op = get_free_fence_op(device))) + { + op->virtual_value = virtual_value; + *phys_semaphore = op->local_sem.sem; + *phys_wait_value = op->local_sem.value + 1; + list_add_tail(&semaphore->pending_waits, &op->entry); + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, semaphore, op->local_sem.sem, op); + signal_timeline_sem(device, device->sem_poll_update.sem, &device->sem_poll_update.value); + TRACE("added wait op, semaphore %p, %s, temp sem %s, %s.\n", semaphore, wine_dbgstr_longlong(virtual_value), + wine_dbgstr_longlong(op->local_sem.sem), wine_dbgstr_longlong(op->local_sem.value)); + } + else + { + *phys_semaphore = 0; + *phys_wait_value = 0; + } + pthread_mutex_unlock(&device->signaller_mutex); +} + +static void add_sem_signal_op(struct wine_device *device, struct wine_semaphore *semaphore, uint64_t virtual_value, + VkSemaphore *phys_semaphore, uint64_t *phys_signal_value, BOOL signal_immediate) +{ + struct pending_d3d12_fence_op *op; + uint64_t value; + + pthread_mutex_lock(&device->signaller_mutex); + if ((op = get_free_fence_op(device))) + { + op->virtual_value = virtual_value; + *phys_semaphore = op->local_sem.sem; + *phys_signal_value = op->local_sem.value + 1; + list_add_tail(&semaphore->pending_signals, &op->entry); + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, semaphore, op->local_sem.sem, op); + if (signal_immediate) + { + value = op->local_sem.value; + signal_timeline_sem(device, op->local_sem.sem, &value); + update_sem_poll_wait_processed(device); + TRACE("signal op %p, semaphore %p, %s, temp sem %s, %s.\n", op, semaphore, wine_dbgstr_longlong(virtual_value), + wine_dbgstr_longlong(op->local_sem.sem), wine_dbgstr_longlong(op->local_sem.value)); + } + else + { + signal_timeline_sem(device, device->sem_poll_update.sem, &device->sem_poll_update.value); + TRACE("added signal op, semaphore %p, %s, temp sem %s, %s.\n", semaphore, wine_dbgstr_longlong(virtual_value), + wine_dbgstr_longlong(op->local_sem.sem), wine_dbgstr_longlong(op->local_sem.value)); + } + } + else + { + *phys_semaphore = 0; + *phys_signal_value = 0; + } + pthread_mutex_unlock(&device->signaller_mutex); +} + VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkSemaphore *semaphore, void *win_create_info) { @@ -3756,6 +4167,9 @@ VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateI if (!(object = calloc(1, sizeof(*object)))) return VK_ERROR_OUT_OF_HOST_MEMORY; + list_init(&object->pending_signals); + list_init(&object->pending_waits); + object->handle = INVALID_HANDLE_VALUE; if ((export_semaphore_info = wine_vk_find_struct(&create_info_dup, EXPORT_SEMAPHORE_CREATE_INFO))) @@ -3888,6 +4302,12 @@ VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateI device->funcs.p_vkDestroySemaphore(device->host_device, object->fence_timeline_semaphore, NULL); free(object); } + else if (object->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + register_sem_poll(device, object); + if (res == VK_SUCCESS) + { + TRACE("-> %p (native %#llx, shared %#llx).\n", object, (long long)object->semaphore, (long long)object->fence_timeline_semaphore); + } return res; } @@ -3919,6 +4339,9 @@ void wine_vkDestroySemaphore(VkDevice device_handle, VkSemaphore semaphore_handl if (!semaphore) return; + if (semaphore->poll_entry.next) + unregister_sem_poll(device, semaphore); + if (semaphore->handle != INVALID_HANDLE_VALUE) NtClose(semaphore->handle); @@ -3950,6 +4373,9 @@ VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, TRACE("(%p, %p). semaphore = %p handle = %p\n", device, handle_info, semaphore, handle_info->handle); + if (semaphore->poll_entry.next) + unregister_sem_poll(device, semaphore); + if (handle_info->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT && !semaphore->fence_timeline_semaphore) { type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; @@ -4050,6 +4476,9 @@ VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, NtUnmapViewOfSection(GetCurrentProcess(), semaphore->d3d12_fence_shm); *semaphore = output_semaphore; + assert(!semaphore->poll_entry.next); + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + register_sem_poll(device, semaphore); } else { @@ -4065,20 +4494,10 @@ VkResult wine_vkImportSemaphoreWin32HandleKHR(VkDevice device_handle, return res; } -static VkResult vk_get_semaphore_counter_value(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value, bool khr) -{ - struct wine_semaphore *semaphore = wine_semaphore_from_handle(semaphore_handle); - struct wine_device *device = wine_device_from_handle(device_handle); - - if (khr) - return device->funcs.p_vkGetSemaphoreCounterValueKHR(device->host_device, wine_semaphore_host_handle(semaphore), value); - else - return device->funcs.p_vkGetSemaphoreCounterValue(device->host_device, wine_semaphore_host_handle(semaphore), value); -} - static VkResult wine_vk_get_semaphore_counter_value(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value, bool khr) { struct wine_semaphore *semaphore = wine_semaphore_from_handle(semaphore_handle); + struct wine_device *device = wine_device_from_handle(device_handle); if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) { @@ -4088,7 +4507,10 @@ static VkResult wine_vk_get_semaphore_counter_value(VkDevice device_handle, VkSe return VK_SUCCESS; } - return vk_get_semaphore_counter_value(device_handle, semaphore_handle, value, khr); + if (khr) + return device->funcs.p_vkGetSemaphoreCounterValueKHR(device->host_device, wine_semaphore_host_handle(semaphore), value); + else + return device->funcs.p_vkGetSemaphoreCounterValue(device->host_device, wine_semaphore_host_handle(semaphore), value); } VkResult wine_vkGetSemaphoreCounterValue(VkDevice device_handle, VkSemaphore semaphore_handle, uint64_t *value) @@ -4101,116 +4523,194 @@ VkResult wine_vkGetSemaphoreCounterValueKHR(VkDevice device_handle, VkSemaphore return wine_vk_get_semaphore_counter_value(device_handle, semaphore_handle, value, true); } -static VkResult vk_signal_semaphore(VkDevice device_handle, const VkSemaphoreSignalInfo *signal_info, bool khr) +static NTSTATUS wine_vk_signal_semaphore(VkDevice device_handle, const VkSemaphoreSignalInfo *signal_info, bool khr) { struct wine_semaphore *semaphore = wine_semaphore_from_handle(signal_info->semaphore); struct wine_device *device = wine_device_from_handle(device_handle); VkSemaphoreSignalInfo dup_signal_info = *signal_info; - dup_signal_info.semaphore = wine_semaphore_host_handle(semaphore); + TRACE("(%p, %p)\n", device, signal_info); + + if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + add_sem_signal_op(device, semaphore, signal_info->value, &dup_signal_info.semaphore, &dup_signal_info.value, TRUE); + return VK_SUCCESS; + } + else + dup_signal_info.semaphore = wine_semaphore_host_handle(semaphore); + if (khr) return device->funcs.p_vkSignalSemaphoreKHR(device->host_device, &dup_signal_info); else return device->funcs.p_vkSignalSemaphore(device->host_device, &dup_signal_info); } -static NTSTATUS wine_vk_signal_semaphore(VkDevice device, const VkSemaphoreSignalInfo *signal_info, bool khr) +VkResult wine_vkSignalSemaphore(VkDevice device_handle, const VkSemaphoreSignalInfo *signal_info) { - struct wine_semaphore *semaphore = wine_semaphore_from_handle(signal_info->semaphore); - - TRACE("(%p, %p)\n", device, signal_info); - - if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) - { - FIXME("Signalling D3D12-Fence compatible timeline semaphore not supported.\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - - return vk_signal_semaphore(device, signal_info, khr); + return wine_vk_signal_semaphore(device_handle, signal_info, false); } -VkResult wine_vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *signal_info) +VkResult wine_vkSignalSemaphoreKHR(VkDevice device_handle, const VkSemaphoreSignalInfo *signal_info) { - return wine_vk_signal_semaphore(device, signal_info, false); + return wine_vk_signal_semaphore(device_handle, signal_info, true); } -VkResult wine_vkSignalSemaphoreKHR(VkDevice device, const VkSemaphoreSignalInfo *signal_info) +static void unwrap_semaphore(struct wine_device *device, VkSemaphore *sem_handle, uint64_t *value, BOOL signal) { - return wine_vk_signal_semaphore(device, signal_info, true); + struct wine_semaphore *sem = wine_semaphore_from_handle(*sem_handle); + + if (!sem) + return; + + if (sem->handle_type != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + *sem_handle = wine_semaphore_host_handle(sem); + return; + } + if (signal) + add_sem_signal_op(device, sem, *value, sem_handle, value, FALSE); + else + add_sem_wait_op(device, sem, *value, sem_handle, value); } -static VkSemaphore *unwrap_semaphore_array(const VkSemaphore *in, uint32_t count, struct conversion_context *ctx) +static VkResult unwrap_semaphore_array(const VkSemaphore **sems, const uint64_t **values_out, + uint32_t count, struct conversion_context *ctx, BOOL signal, struct wine_device *device) { + const uint64_t *values = NULL; + const VkSemaphore *in; VkSemaphore *out; unsigned int i; - if (!in || !count) return NULL; + in = *sems; + *sems = NULL; + + if (!in || !count) + return VK_SUCCESS; out = conversion_context_alloc(ctx, count * sizeof(*out)); for (i = 0; i < count; ++i) - out[i] = in[i] ? wine_semaphore_host_handle(wine_semaphore_from_handle(in[i])) : VK_NULL_HANDLE; - - return out; + { + struct wine_semaphore *sem; + if (!in[i]) + { + out[i] = VK_NULL_HANDLE; + continue; + } + sem = wine_semaphore_from_handle(in[i]); + if (sem->handle_type != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) + { + out[i] = wine_semaphore_host_handle(sem); + continue; + } + if (!values_out) + { + ERR("D3D12 fence without values specified.\n"); + return VK_ERROR_UNKNOWN; + } + if (!values) + { + values = *values_out; + *values_out = conversion_context_alloc(ctx, count * sizeof(*values_out)); + memcpy((void *)*values_out, values, count * sizeof(*values)); + } + if (signal) + add_sem_signal_op(device, sem, values[i], &out[i], (uint64_t *)&(*values_out)[i], FALSE); + else + add_sem_wait_op(device, sem, values[i], &out[i], (uint64_t *)&(*values_out)[i]); + } + *sems = out; + return VK_SUCCESS; } -static VkResult vk_wait_semaphores(struct wine_device *device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout, bool khr) +static VkResult wine_vk_wait_semaphores(VkDevice device_handle, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout, bool khr) { + struct wine_device *device = wine_device_from_handle(device_handle); VkSemaphoreWaitInfo wait_info_dup = *wait_info; struct conversion_context ctx; VkResult ret; init_conversion_context(&ctx); - wait_info_dup.pSemaphores = unwrap_semaphore_array(wait_info->pSemaphores, wait_info->semaphoreCount, &ctx); + if ((ret = unwrap_semaphore_array(&wait_info_dup.pSemaphores, &wait_info_dup.pValues, + wait_info->semaphoreCount, &ctx, FALSE, device))) + goto done; + if (khr) ret = device->funcs.p_vkWaitSemaphoresKHR(device->host_device, &wait_info_dup, timeout); else ret = device->funcs.p_vkWaitSemaphores(device->host_device, &wait_info_dup, timeout); +done: free_conversion_context(&ctx); return ret; } -static VkResult wine_vk_wait_semaphores(VkDevice device_handle, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout, bool khr) -{ - unsigned int i; - - TRACE("(%p, %p, 0x%s)\n", device_handle, wait_info, wine_dbgstr_longlong(timeout)); - - for (i = 0; i < wait_info->semaphoreCount; i++) - { - struct wine_semaphore *semaphore = wine_semaphore_from_handle(wait_info->pSemaphores[i]); - - if (semaphore->handle_type == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) - { - FIXME("Waiting on D3D12-Fence compatible timeline semaphores not supported."); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - } - return vk_wait_semaphores(wine_device_from_handle(device_handle), wait_info, timeout, khr); -} - VkResult wine_vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout) { + TRACE("%p %p %s.\n", device, wait_info, wine_dbgstr_longlong(timeout)); + return wine_vk_wait_semaphores(device, wait_info, timeout, false); } VkResult wine_vkWaitSemaphoresKHR(VkDevice device, const VkSemaphoreWaitInfo *wait_info, uint64_t timeout) { + TRACE("%p %p %s.\n", device, wait_info, wine_dbgstr_longlong(timeout)); + return wine_vk_wait_semaphores(device, wait_info, timeout, true); } -VkResult vk_queue_submit_unwrap(struct wine_queue *queue, uint32_t submit_count, const VkSubmitInfo *submits_orig, VkFence fence) +struct struct_chain_def { + VkStructureType sType; + unsigned int size; +}; + +VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo *submits_orig, VkFence fence, + void *submits_win_ptr) +{ + struct wine_queue *queue = wine_queue_from_handle(queue_handle); + struct wine_device *device = queue->device; + VkTimelineSemaphoreSubmitInfo *timeline_submit_info; + const VkSubmitInfo *submits_win = submits_win_ptr; + VkD3D12FenceSubmitInfoKHR *d3d12_submit_info; + const uint64_t **values; struct conversion_context ctx; VkSubmitInfo *submits; unsigned int i, j; VkResult ret; + TRACE("(%p %u %p 0x%s)\n", queue_handle, submit_count, submits_orig, wine_dbgstr_longlong(fence)); + init_conversion_context(&ctx); MEMDUP(&ctx, submits, submits_orig, submit_count); for (i = 0; i < submit_count; ++i) { - submits[i].pWaitSemaphores = unwrap_semaphore_array(submits[i].pWaitSemaphores, submits[i].waitSemaphoreCount, &ctx); - submits[i].pSignalSemaphores = unwrap_semaphore_array(submits[i].pSignalSemaphores, submits[i].signalSemaphoreCount, &ctx); + timeline_submit_info = wine_vk_find_struct(&submits[i], TIMELINE_SEMAPHORE_SUBMIT_INFO); + d3d12_submit_info = wine_vk_find_struct(&submits_win[i], D3D12_FENCE_SUBMIT_INFO_KHR); + if (d3d12_submit_info && timeline_submit_info) + WARN("Both TIMELINE_SEMAPHORE_SUBMIT_INFO and D3D12_FENCE_SUBMIT_INFO_KHR specified.\n"); + if (d3d12_submit_info && !timeline_submit_info) + { + timeline_submit_info = conversion_context_alloc(&ctx, sizeof(*timeline_submit_info)); + timeline_submit_info->sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO; + timeline_submit_info->pNext = submits[i].pNext; + timeline_submit_info->waitSemaphoreValueCount = d3d12_submit_info->waitSemaphoreValuesCount; + MEMDUP(&ctx, timeline_submit_info->pWaitSemaphoreValues, d3d12_submit_info->pWaitSemaphoreValues, d3d12_submit_info->waitSemaphoreValuesCount); + timeline_submit_info->signalSemaphoreValueCount = d3d12_submit_info->signalSemaphoreValuesCount; + MEMDUP(&ctx, timeline_submit_info->pSignalSemaphoreValues, d3d12_submit_info->pSignalSemaphoreValues, d3d12_submit_info->signalSemaphoreValuesCount); + submits[i].pNext = timeline_submit_info; + } + + if (timeline_submit_info) + values = &timeline_submit_info->pWaitSemaphoreValues; + else + values = NULL; + unwrap_semaphore_array(&submits[i].pWaitSemaphores, values, submits[i].waitSemaphoreCount, &ctx, FALSE, device); + + if (timeline_submit_info) + values = &timeline_submit_info->pSignalSemaphoreValues; + else + values = NULL; + unwrap_semaphore_array(&submits[i].pSignalSemaphores, values, submits[i].signalSemaphoreCount, &ctx, TRUE, device); + if (submits[i].pCommandBuffers && submits[i].commandBufferCount) { VkCommandBuffer *out; @@ -4226,38 +4726,6 @@ VkResult vk_queue_submit_unwrap(struct wine_queue *queue, uint32_t submit_count, return ret; } -VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo *submits, VkFence fence, void *submits_win_ptr) -{ - struct wine_queue *queue = wine_queue_from_handle(queue_handle); - unsigned int i, k; - - TRACE("(%p %u %p 0x%s)\n", queue_handle, submit_count, submits, wine_dbgstr_longlong(fence)); - - for (i = 0; i < submit_count; i++) - { - for (k = 0; k < submits[i].waitSemaphoreCount; k++) - { - if (wine_semaphore_from_handle(submits[i].pWaitSemaphores[k])->handle_type == - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) - { - FIXME("Queue submissions with waits on D3D12-Fence compatible timeline semaphores not supported.\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - } - - for (k = 0; k < submits[i].signalSemaphoreCount; k++) - { - if (wine_semaphore_from_handle(submits[i].pSignalSemaphores[k])->handle_type == - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) - { - FIXME("Queue submissions with signalling D3D12-Fence compatible timeline semaphores not supported.\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - } - } - return vk_queue_submit_unwrap(queue, submit_count, submits, fence); -} - static void duplicate_array_for_unwrapping(struct conversion_context *ctx, void **ptr, unsigned int size) { void *out; @@ -4270,14 +4738,16 @@ static void duplicate_array_for_unwrapping(struct conversion_context *ctx, void *ptr = out; } -VkResult vk_queue_submit_2_unwrap(struct wine_queue *queue, uint32_t submit_count, const VkSubmitInfo2 *submits_orig, - VkFence fence, bool khr) +static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo2 *submits_orig, VkFence fence, bool khr) { + struct wine_queue *queue = wine_queue_from_handle(queue_handle); struct conversion_context ctx; VkSubmitInfo2 *submits; unsigned int i, j; VkResult ret; + TRACE("(%p, %u, %p, %s)\n", queue_handle, submit_count, submits_orig, wine_dbgstr_longlong(fence)); + init_conversion_context(&ctx); MEMDUP(&ctx, submits, submits_orig, submit_count); for (i = 0; i < submit_count; ++i) @@ -4285,16 +4755,14 @@ VkResult vk_queue_submit_2_unwrap(struct wine_queue *queue, uint32_t submit_coun duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pWaitSemaphoreInfos, submits[i].waitSemaphoreInfoCount * sizeof(*submits[i].pWaitSemaphoreInfos)); for (j = 0; j < submits[i].waitSemaphoreInfoCount; ++j) - if (submits[i].pWaitSemaphoreInfos[j].semaphore) - ((VkSemaphoreSubmitInfo *)submits[i].pWaitSemaphoreInfos)[j].semaphore - = wine_semaphore_host_handle(wine_semaphore_from_handle(submits[i].pWaitSemaphoreInfos[j].semaphore)); + unwrap_semaphore(queue->device, &((VkSemaphoreSubmitInfo *)submits[i].pWaitSemaphoreInfos)[j].semaphore, + &((VkSemaphoreSubmitInfo *)submits[i].pWaitSemaphoreInfos)[j].value, FALSE); duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pSignalSemaphoreInfos, submits[i].signalSemaphoreInfoCount * sizeof(*submits[i].pSignalSemaphoreInfos)); for (j = 0; j < submits[i].signalSemaphoreInfoCount; ++j) - if (submits[i].pSignalSemaphoreInfos[j].semaphore) - ((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j].semaphore - = wine_semaphore_host_handle(wine_semaphore_from_handle(submits[i].pSignalSemaphoreInfos[j].semaphore)); + unwrap_semaphore(queue->device, &((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j].semaphore, + &((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j].value, TRUE); if (submits[i].pCommandBufferInfos && submits[i].commandBufferInfoCount) { @@ -4305,6 +4773,7 @@ VkResult vk_queue_submit_2_unwrap(struct wine_queue *queue, uint32_t submit_coun = wine_cmd_buffer_from_handle(submits[i].pCommandBufferInfos[j].commandBuffer)->host_command_buffer; } } + if (khr) ret = queue->device->funcs.p_vkQueueSubmit2KHR(queue->host_queue, submit_count, submits, fence); else @@ -4313,39 +4782,6 @@ VkResult vk_queue_submit_2_unwrap(struct wine_queue *queue, uint32_t submit_coun return ret; } -static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence, bool khr) -{ - struct wine_queue *queue = wine_queue_from_handle(queue_handle); - unsigned int i, k; - - TRACE("(%p, %u, %p, %s)\n", queue_handle, submit_count, submits, wine_dbgstr_longlong(fence)); - - for (i = 0; i < submit_count; i++) - { - for (k = 0; k < submits[i].waitSemaphoreInfoCount; k++) - { - if (wine_semaphore_from_handle(submits[i].pWaitSemaphoreInfos[k].semaphore)->handle_type == - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) - { - FIXME("Queue submissions with waits on D3D12-Fence compatible timeline semaphores not supported.\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - } - - for (k = 0; k < submits[i].signalSemaphoreInfoCount; k++) - { - if (wine_semaphore_from_handle(submits[i].pSignalSemaphoreInfos[k].semaphore)->handle_type == - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT) - { - FIXME("Queue submissions signalling D3D12-Fence compatible timeline semaphores not supported.\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - } - } - - return vk_queue_submit_2_unwrap(queue, submit_count, submits, fence, khr); -} - VkResult wine_vkQueueSubmit2(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence) { return vk_queue_submit_2(queue, submit_count, submits, fence, false); @@ -4358,6 +4794,7 @@ VkResult wine_vkQueueSubmit2KHR(VkQueue queue, uint32_t submit_count, const VkSu VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *present_info) { + struct wine_queue *queue = wine_queue_from_handle(queue_handle); VkPresentInfoKHR host_present_info = *present_info; struct wine_semaphore *semaphore; struct conversion_context ctx; @@ -4378,7 +4815,8 @@ VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pr } init_conversion_context(&ctx); - host_present_info.pWaitSemaphores = unwrap_semaphore_array(present_info->pWaitSemaphores, present_info->waitSemaphoreCount, &ctx); + unwrap_semaphore_array(&host_present_info.pWaitSemaphores, NULL, present_info->waitSemaphoreCount, &ctx, + FALSE, queue->device); ret = fshack_vk_queue_present(queue_handle, &host_present_info); free_conversion_context(&ctx); return ret; @@ -4426,8 +4864,8 @@ VkResult wine_vkQueueBindSparse(VkQueue queue_handle, uint32_t bind_info_count, for (i = 0; i < bind_info_count; ++i) { batch = (VkBindSparseInfo *)&bind_info[i]; - batch->pWaitSemaphores = unwrap_semaphore_array(batch->pWaitSemaphores, batch->waitSemaphoreCount, &ctx); - batch->pSignalSemaphores = unwrap_semaphore_array(batch->pSignalSemaphores, batch->signalSemaphoreCount, &ctx); + unwrap_semaphore_array(&batch->pWaitSemaphores, NULL, batch->waitSemaphoreCount, &ctx, FALSE, queue->device); + unwrap_semaphore_array(&batch->pSignalSemaphores, NULL, batch->signalSemaphoreCount, &ctx, TRUE, queue->device); duplicate_array_for_unwrapping(&ctx, (void **)&batch->pBufferBinds, batch->bufferBindCount * sizeof(*batch->pBufferBinds)); for (j = 0; j < batch->bufferBindCount; ++j) diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 891fc244527..f2118a7d668 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -24,6 +24,7 @@ #define VK_NO_PROTOTYPES #include +#include #include "vulkan_loader.h" #include "vulkan_thunks.h" @@ -53,6 +54,25 @@ static inline struct wine_cmd_buffer *wine_cmd_buffer_from_handle(VkCommandBuffe return (struct wine_cmd_buffer *)(uintptr_t)handle->base.unix_handle; } +struct wine_semaphore; + +struct local_timeline_semaphore +{ + VkSemaphore sem; + uint64_t value; +}; + +struct pending_d3d12_fence_op +{ + /* Vulkan native local semaphore. */ + struct local_timeline_semaphore local_sem; + + /* Operation values. */ + struct wine_vk_mapping mapping; + struct list entry; + uint64_t virtual_value; +}; + struct wine_device { struct vulkan_device_funcs funcs; @@ -67,6 +87,16 @@ struct wine_device VkQueueFamilyProperties *queue_props; struct wine_vk_mapping mapping; + + pthread_t signaller_thread; + pthread_mutex_t signaller_mutex; + bool stop; + struct list free_fence_ops_list; + struct list sem_poll_list; + struct local_timeline_semaphore sem_poll_update; + pthread_cond_t sem_poll_updated_cond; + uint64_t sem_poll_update_value; /* set to sem_poll_update.value by signaller thread once update is processed. */ + unsigned int allocated_fence_ops_count; }; static inline struct wine_device *wine_device_from_handle(VkDevice handle) @@ -329,7 +359,6 @@ static inline void free_conversion_context(struct conversion_context *pool) struct wine_semaphore { VkSemaphore semaphore; - VkSemaphore fence_timeline_semaphore; VkExternalSemaphoreHandleTypeFlagBits export_types; @@ -337,12 +366,18 @@ struct wine_semaphore /* mutable members */ VkExternalSemaphoreHandleTypeFlagBits handle_type; + struct list poll_entry; + struct list pending_waits; + struct list pending_signals; HANDLE handle; struct { + /* Shared mem access mutex. The non-shared parts access is guarded with device global signaller_mutex. */ pthread_mutex_t mutex; - uint64_t virtual_value; + uint64_t virtual_value, physical_value; } *d3d12_fence_shm; + /* The Vulkan shared semaphore is only waited or signaled in signaller_worker(). */ + VkSemaphore fence_timeline_semaphore; }; static inline struct wine_semaphore *wine_semaphore_from_handle(VkSemaphore handle) From 003c367b9232b7f545f748d7583f3b790e8729ca Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 7 Aug 2023 17:49:30 -0600 Subject: [PATCH 1048/1506] winevulkan: Support resetting shared fence value. CW-Bug-Id: #22526 --- dlls/winevulkan/vulkan.c | 54 ++++++++++++++++++++++++++------ dlls/winevulkan/vulkan_private.h | 10 ++++++ 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index d1513df606f..27221c594c9 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -135,8 +135,8 @@ static void signal_timeline_sem(struct wine_device *device, VkSemaphore sem, uin info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO; info.semaphore = sem; - ++*value; - info.value = *value; + info.value = *value + 1; + __atomic_store_n(value, info.value, __ATOMIC_RELEASE); if (device->phys_dev->api_version < VK_API_VERSION_1_2 || device->phys_dev->instance->api_version < VK_API_VERSION_1_2) res = device->funcs.p_vkSignalSemaphoreKHR(device->host_device, &info); else @@ -3863,14 +3863,13 @@ static int semaphore_process(struct wine_device *device, struct wine_semaphore * int virtual_value_updated = 0; uint64_t value, virtual_value; VkResult res; + uint32_t i; /* Check local pending signal ops completion, update shared semaphore. */ d3d12_semaphore_lock( sem ); + virtual_value = sem->d3d12_fence_shm->virtual_value; LIST_FOR_EACH_ENTRY_SAFE(op, op2, &sem->pending_signals, struct pending_d3d12_fence_op, entry) { - if (op->virtual_value <= sem->d3d12_fence_shm->virtual_value) - goto signal_op_complete; - res = get_semaphore_value(device, op->local_sem.sem, &value); if (res != VK_SUCCESS) { @@ -3887,28 +3886,64 @@ static int semaphore_process(struct wine_device *device, struct wine_semaphore * continue; } + virtual_value = max( sem->d3d12_fence_shm->virtual_value, op->virtual_value ); sem->d3d12_fence_shm->virtual_value = op->virtual_value; virtual_value_updated = 1; signal_op_complete: - ++op->local_sem.value; + op->local_sem.value = value; release_fence_op(device, op); } + if (sem->d3d12_fence_shm->virtual_value < virtual_value) + { + uint32_t idx = sem->d3d12_fence_shm->reset_backlog_count; + + if (debug_level >= 3) + fprintf(stderr, "warn:winevulkan:semaphore_process resetting semaphore %p virtual value.\n", sem); + if (idx == ARRAY_SIZE(sem->d3d12_fence_shm->reset_backlog)) + { + sem->d3d12_fence_shm->last_dropped_reset_physical = sem->d3d12_fence_shm->reset_backlog[0].physical_at_reset; + --idx; + memmove(&sem->d3d12_fence_shm->reset_backlog[0], &sem->d3d12_fence_shm->reset_backlog[1], + sizeof(*sem->d3d12_fence_shm->reset_backlog) * sem->d3d12_fence_shm->reset_backlog_count); + } + else + { + ++sem->d3d12_fence_shm->reset_backlog_count; + } + sem->d3d12_fence_shm->last_reset_physical = sem->d3d12_fence_shm->physical_value + 1; + sem->d3d12_fence_shm->reset_backlog[idx].physical_at_reset = sem->d3d12_fence_shm->last_reset_physical; + sem->d3d12_fence_shm->reset_backlog[idx].virtual_before_reset = virtual_value; + } if (virtual_value_updated) signal_timeline_sem(device, sem->fence_timeline_semaphore, &sem->d3d12_fence_shm->physical_value); global_sem_wait_value = sem->d3d12_fence_shm->physical_value + 1; - virtual_value = sem->d3d12_fence_shm->virtual_value; - d3d12_semaphore_unlock(sem); /* Complete satisfied local waits. */ LIST_FOR_EACH_ENTRY_SAFE(op, op2, &sem->pending_waits, struct pending_d3d12_fence_op, entry) { if (op->virtual_value > virtual_value) - continue; + { + if (op->shared_physical_value > sem->d3d12_fence_shm->last_reset_physical) + continue; + for (i = 0; i < sem->d3d12_fence_shm->reset_backlog_count; ++i) + { + if (sem->d3d12_fence_shm->reset_backlog[i].physical_at_reset >= op->shared_physical_value + && sem->d3d12_fence_shm->reset_backlog[i].virtual_before_reset >= op->virtual_value) + break; + } + if (i == sem->d3d12_fence_shm->reset_backlog_count) + { + if (sem->d3d12_fence_shm->last_dropped_reset_physical < op->shared_physical_value) + continue; + fprintf(stderr, "err:winevulkan:semaphore_process wait needs reset backlog beyond cut off.\n"); + } + } signal_timeline_sem(device, op->local_sem.sem, &op->local_sem.value); release_fence_op(device, op); } + d3d12_semaphore_unlock(sem); /* Only poll shared semaphore if there are waits pending. */ if (list_empty(&sem->pending_waits)) @@ -4087,6 +4122,7 @@ static void add_sem_wait_op(struct wine_device *device, struct wine_semaphore *s if ((op = get_free_fence_op(device))) { op->virtual_value = virtual_value; + op->shared_physical_value = __atomic_load_n(&semaphore->d3d12_fence_shm->physical_value, __ATOMIC_ACQUIRE) + 1; *phys_semaphore = op->local_sem.sem; *phys_wait_value = op->local_sem.value + 1; list_add_tail(&semaphore->pending_waits, &op->entry); diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index f2118a7d668..89fe3d8343b 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -71,6 +71,7 @@ struct pending_d3d12_fence_op struct wine_vk_mapping mapping; struct list entry; uint64_t virtual_value; + uint64_t shared_physical_value; }; struct wine_device @@ -375,6 +376,15 @@ struct wine_semaphore /* Shared mem access mutex. The non-shared parts access is guarded with device global signaller_mutex. */ pthread_mutex_t mutex; uint64_t virtual_value, physical_value; + uint64_t last_reset_physical; + uint64_t last_dropped_reset_physical; + struct + { + uint64_t physical_at_reset; + uint64_t virtual_before_reset; + } + reset_backlog[16]; + uint32_t reset_backlog_count; } *d3d12_fence_shm; /* The Vulkan shared semaphore is only waited or signaled in signaller_worker(). */ VkSemaphore fence_timeline_semaphore; From f372f0e9a945ff1d1bded563d9eb86a0fe7c1e21 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Aug 2023 13:14:43 -0600 Subject: [PATCH 1049/1506] winevulkan: Also remap Win32 functions in vk_is_available_instance_function(). CW-Bug-Id: #22526 --- dlls/winevulkan/vulkan.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 27221c594c9..3a1105cfd4d 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -3614,12 +3614,23 @@ void wine_vkDestroyDeferredOperationKHR(VkDevice handle, free(object); } +static void substitute_function_name(const char **name) +{ + if (!strcmp(*name, "vkGetMemoryWin32HandleKHR") || !strcmp(*name, "vkGetMemoryWin32HandlePropertiesKHR")) + *name = "vkGetMemoryFdKHR"; + else if (!strcmp(*name, "vkGetSemaphoreWin32HandleKHR")) + *name = "vkGetSemaphoreFdKHR"; + else if (!strcmp(*name, "vkImportSemaphoreWin32HandleKHR")) + *name = "vkImportSemaphoreFdKHR"; +} + #ifdef _WIN64 NTSTATUS vk_is_available_instance_function(void *arg) { struct is_available_instance_function_params *params = arg; struct wine_instance *instance = wine_instance_from_handle(params->instance); + substitute_function_name(¶ms->name); return !!vk_funcs->p_vkGetInstanceProcAddr(instance->host_instance, params->name); } @@ -3627,12 +3638,7 @@ NTSTATUS vk_is_available_device_function(void *arg) { struct is_available_device_function_params *params = arg; struct wine_device *device = wine_device_from_handle(params->device); - if (!strcmp(params->name, "vkGetMemoryWin32HandleKHR") || !strcmp(params->name, "vkGetMemoryWin32HandlePropertiesKHR")) - params->name = "vkGetMemoryFdKHR"; - else if (!strcmp(params->name, "vkGetSemaphoreWin32HandleKHR")) - params->name = "vkGetSemaphoreFdKHR"; - else if (!strcmp(params->name, "vkImportSemaphoreWin32HandleKHR")) - params->name = "vkImportSemaphoreFdKHR"; + substitute_function_name(¶ms->name); return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, params->name); } @@ -3646,7 +3652,9 @@ NTSTATUS vk_is_available_instance_function32(void *arg) UINT32 name; } *params = arg; struct wine_instance *instance = wine_instance_from_handle(UlongToPtr(params->instance)); - return !!vk_funcs->p_vkGetInstanceProcAddr(instance->host_instance, UlongToPtr(params->name)); + const char *name = UlongToPtr(params->name); + substitute_function_name(&name); + return !!vk_funcs->p_vkGetInstanceProcAddr(instance->host_instance, name); } NTSTATUS vk_is_available_device_function32(void *arg) @@ -3657,14 +3665,9 @@ NTSTATUS vk_is_available_device_function32(void *arg) UINT32 name; } *params = arg; struct wine_device *device = wine_device_from_handle(UlongToPtr(params->device)); - char *name = UlongToPtr(params->name); - if (!strcmp(name, "vkGetMemoryWin32HandleKHR") || !strcmp(name, "vkGetMemoryWin32HandlePropertiesKHR")) - return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkGetMemoryFdKHR"); - if (!strcmp(name, "vkGetSemaphoreWin32HandleKHR")) - return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkGetSemaphoreFdKHR"); - if (!strcmp(name, "vkImportSemaphoreWin32HandleKHR")) - return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, "vkImportSemaphoreFdKHR"); - return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, UlongToPtr(params->name)); + const char *name = UlongToPtr(params->name); + substitute_function_name(&name); + return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, name); } DECLSPEC_EXPORT VkDevice __wine_get_native_VkDevice(VkDevice handle) From 8971dee1211bfdd621c9316262e7988d4abc6602 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Aug 2023 14:30:26 -0600 Subject: [PATCH 1050/1506] winevulkan: Expose VK_KHR_win32_keyed_mutex extension. CW-Bug-Id: #22372 --- dlls/winevulkan/make_vulkan | 5 ++--- dlls/winevulkan/vulkan.c | 44 +++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 507537df632..d91818362cc 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -102,7 +102,6 @@ UNSUPPORTED_EXTENSIONS = [ # Relates to external_semaphore and needs type conversions in bitflags. "VK_KHR_shared_presentable_image", # Needs WSI work. "VK_KHR_video_queue", # TODO Video extensions use separate headers + xml - "VK_KHR_win32_keyed_mutex", "VK_NV_external_memory_rdma", # Needs shared resources work. # Extensions for other platforms @@ -347,8 +346,8 @@ STRUCT_CHAIN_CONVERSIONS = { "VkPhysicalDeviceImageFormatInfo2": [], "VkPhysicalDeviceExternalSemaphoreInfo": [], "VkSemaphoreCreateInfo": ["VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR"], - "VkSubmitInfo": ["VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR"], - "VkSubmitInfo2": [], + "VkSubmitInfo": ["VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR", "VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR"], + "VkSubmitInfo2": ["VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR"], "VkBindSparseInfo" : [], } diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 3a1105cfd4d..4f60400ae24 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -279,7 +279,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance uint32_t num_host_properties, num_properties = 0; VkExtensionProperties *host_properties = NULL; VkPhysicalDeviceProperties physdev_properties; - BOOL have_external_memory_host = FALSE; + BOOL have_external_memory_host = FALSE, have_external_memory_fd = FALSE, have_external_semaphore_fd = FALSE; VkResult res; unsigned int i, j; @@ -333,6 +333,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance snprintf(host_properties[i].extensionName, sizeof(host_properties[i].extensionName), VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); host_properties[i].specVersion = VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION; + have_external_memory_fd = TRUE; } if (!strcmp(host_properties[i].extensionName, "VK_KHR_external_semaphore_fd")) { @@ -341,6 +342,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance snprintf(host_properties[i].extensionName, sizeof(host_properties[i].extensionName), VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME); host_properties[i].specVersion = VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION; + have_external_semaphore_fd = TRUE; } if (wine_vk_device_extension_supported(host_properties[i].extensionName)) @@ -356,7 +358,8 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance have_external_memory_host = TRUE; } - TRACE("Host supported extensions %u, Wine supported extensions %u\n", num_host_properties, num_properties); + if (have_external_memory_fd && have_external_semaphore_fd) + ++num_properties; /* VK_KHR_win32_keyed_mutex */ if (!(object->extensions = calloc(num_properties, sizeof(*object->extensions)))) { @@ -372,7 +375,15 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance j++; } } + if (have_external_memory_fd && have_external_semaphore_fd) + { + strcpy(object->extensions[j].extensionName, VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME); + object->extensions[j].specVersion = VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION; + TRACE("Enabling extension '%s' for physical device %p\n", object->extensions[j].extensionName, object); + ++j; + } object->extension_count = num_properties; + TRACE("Host supported extensions %u, Wine supported extensions %u\n", num_host_properties, num_properties); if (use_external_memory() && have_external_memory_host) { @@ -524,7 +535,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst) { static const char *wine_xr_extension_name = "VK_WINE_openxr_device_extensions"; - unsigned int i, append_xr = 0, replace_win32 = 0, append_timeline = 1; + unsigned int i, append_xr = 0, have_ext_mem32 = 0, have_ext_sem32 = 0, have_keyed_mutex = 0, append_timeline = 1; VkBaseOutStructure *header; char **xr_extensions_list; @@ -544,8 +555,12 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de if (!strcmp(extension_name, wine_xr_extension_name)) append_xr = 1; - else if (!strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32") || !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) - replace_win32 = 1; + else if (!strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32")) + have_ext_mem32 = 1; + else if (!strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) + have_ext_sem32 = 1; + else if (!strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_win32_keyed_mutex")) + have_keyed_mutex = 1; else if (!strcmp(extension_name, "VK_KHR_timeline_semaphore")) append_timeline = 0; } @@ -567,7 +582,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de if (append_xr) xr_extensions_list = parse_xr_extensions(&append_xr); - if (phys_dev->external_memory_align || append_xr || replace_win32 || append_timeline) + if (phys_dev->external_memory_align || append_xr || have_ext_mem32 || have_ext_sem32 || have_keyed_mutex || append_timeline) { const char **new_extensions; unsigned int o = 0, count; @@ -579,19 +594,30 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de count += append_xr - 1; if (append_timeline) ++count; + if (have_keyed_mutex) + count += !have_ext_mem32 + !have_ext_sem32; new_extensions = conversion_context_alloc(ctx, count * sizeof(*dst->ppEnabledExtensionNames)); for (i = 0; i < dst->enabledExtensionCount; ++i) { if (append_xr && !strcmp(src->ppEnabledExtensionNames[i], wine_xr_extension_name)) continue; - if (replace_win32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32")) + if (have_ext_mem32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_memory_win32")) new_extensions[o++] = "VK_KHR_external_memory_fd"; - else if (replace_win32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) + else if (have_ext_sem32 && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_external_semaphore_win32")) new_extensions[o++] = "VK_KHR_external_semaphore_fd"; + else if (have_keyed_mutex && !strcmp(src->ppEnabledExtensionNames[i], "VK_KHR_win32_keyed_mutex")) + continue; else new_extensions[o++] = src->ppEnabledExtensionNames[i]; } + if (have_keyed_mutex) + { + if (!have_ext_mem32) + new_extensions[o++] = "VK_KHR_external_memory_fd"; + if (!have_ext_sem32) + new_extensions[o++] = "VK_KHR_external_semaphore_fd"; + } if (phys_dev->external_memory_align) { new_extensions[o++] = "VK_KHR_external_memory"; @@ -604,7 +630,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de } if (append_timeline) new_extensions[o++] = "VK_KHR_timeline_semaphore"; - dst->enabledExtensionCount = count; + dst->enabledExtensionCount = o; dst->ppEnabledExtensionNames = new_extensions; } From 56dc17cd4a3056abb5089acad7a67966028f7d4c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Aug 2023 17:52:14 -0600 Subject: [PATCH 1051/1506] winevulkan: Implement vkGetMemoryWin32HandlePropertiesKHR(). CW-Bug-Id: #22372 --- dlls/winevulkan/vulkan.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 4f60400ae24..d84b1135cba 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -3770,13 +3770,25 @@ VkResult wine_vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32H } } -VkResult wine_vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits type, HANDLE handle, VkMemoryWin32HandlePropertiesKHR *properties) +VkResult wine_vkGetMemoryWin32HandlePropertiesKHR(VkDevice device_handle, VkExternalMemoryHandleTypeFlagBits type, HANDLE handle, VkMemoryWin32HandlePropertiesKHR *properties) { + struct wine_device *device = wine_device_from_handle(device_handle); + unsigned int i; + TRACE("%p %u %p %p\n", device, type, handle, properties); - /* VUID-vkGetMemoryWin32HandlePropertiesKHR-handleType-00666 - handleType must not be one of the handle types defined as opaque */ - return VK_ERROR_INVALID_EXTERNAL_HANDLE; + if (!(type & wine_vk_handle_over_fd_types)) + { + FIXME("type %#x.\n", type); + return VK_ERROR_INVALID_EXTERNAL_HANDLE; + } + + properties->memoryTypeBits = 0; + for (i = 0; i < device->phys_dev->memory_properties.memoryTypeCount; ++i) + if (device->phys_dev->memory_properties.memoryTypes[i].propertyFlags == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) + properties->memoryTypeBits |= 1u << i; + + return VK_SUCCESS; } #define IOCTL_SHARED_GPU_RESOURCE_SET_OBJECT CTL_CODE(FILE_DEVICE_VIDEO, 6, METHOD_BUFFERED, FILE_WRITE_ACCESS) From 8385311660d0cfbb8ff0abf2c2ff87a5aeaf41d8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Aug 2023 19:13:05 -0600 Subject: [PATCH 1052/1506] winevulkan: Use resource allocated size when importing shared textures. CW-Bug-Id: #22372 --- dlls/sharedgpures.sys/shared_resource.c | 28 +++++++++++++ dlls/winevulkan/vulkan.c | 54 +++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/dlls/sharedgpures.sys/shared_resource.c b/dlls/sharedgpures.sys/shared_resource.c index c6ab013ea0d..ad836662af0 100644 --- a/dlls/sharedgpures.sys/shared_resource.c +++ b/dlls/sharedgpures.sys/shared_resource.c @@ -27,6 +27,7 @@ struct shared_resource SIZE_T metadata_size; void **object_pool; unsigned int object_pool_count; + UINT64 resource_size; }; static struct shared_resource *resource_pool; @@ -72,6 +73,7 @@ static void *reference_client_handle(obj_handle_t handle) struct shared_resource_create { + UINT64 resource_size; obj_handle_t unix_handle; WCHAR name[1]; }; @@ -125,6 +127,7 @@ static NTSTATUS shared_resource_create(struct shared_resource **res, void *buff, (*res)->ref_count = 1; (*res)->unix_resource = unix_resource; (*res)->name = name; + (*res)->resource_size = input->resource_size; iosb->Information = 0; return STATUS_SUCCESS; @@ -138,6 +141,11 @@ struct shared_resource_open WCHAR name[1]; }; +struct shared_resource_info +{ + UINT64 resource_size; +}; + static unsigned int kmt_to_index(obj_handle_t kmt) { if (!(kmt & 0x40000000) || (kmt - 2) % 4) @@ -340,6 +348,20 @@ static NTSTATUS shared_resource_get_object(struct shared_resource *res, void *bu return STATUS_SUCCESS; } +#define IOCTL_SHARED_GPU_RESOURCE_GET_INFO CTL_CODE(FILE_DEVICE_VIDEO, 7, METHOD_BUFFERED, FILE_READ_ACCESS) +static NTSTATUS shared_resource_get_info(struct shared_resource *res, void *buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb) +{ + struct shared_resource_info *info = buff; + + if (sizeof(*info) > outsize) + return STATUS_BUFFER_TOO_SMALL; + + info->resource_size = res->resource_size; + iosb->Information = sizeof(*info); + return STATUS_SUCCESS; +} + + static NTSTATUS WINAPI dispatch_create(DEVICE_OBJECT *device, IRP *irp) { irp->IoStatus.u.Status = STATUS_SUCCESS; @@ -452,6 +474,12 @@ static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp) stack->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus); break; + case IOCTL_SHARED_GPU_RESOURCE_GET_INFO: + status = shared_resource_get_info( res, + irp->AssociatedIrp.SystemBuffer, + stack->Parameters.DeviceIoControl.OutputBufferLength, + &irp->IoStatus ); + break; default: FIXME( "ioctl %#lx not supported\n", stack->Parameters.DeviceIoControl.IoControlCode ); status = STATUS_NOT_SUPPORTED; diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index d84b1135cba..85889f2d0d4 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -2569,11 +2569,12 @@ void wine_vkDestroySurfaceKHR(VkInstance handle, VkSurfaceKHR surface, struct shared_resource_create { + UINT64 resource_size; obj_handle_t unix_handle; WCHAR name[1]; }; -static HANDLE create_gpu_resource(int fd, LPCWSTR name) +static HANDLE create_gpu_resource(int fd, LPCWSTR name, UINT64 resource_size) { static const WCHAR shared_gpu_resourceW[] = {'\\','?','?','\\','S','h','a','r','e','d','G','p','u','R','e','s','o','u','r','c','e',0}; HANDLE unix_resource = INVALID_HANDLE_VALUE; @@ -2609,6 +2610,7 @@ static HANDLE create_gpu_resource(int fd, LPCWSTR name) in_size = sizeof(*inbuff) + (name ? lstrlenW(name) * sizeof(WCHAR) : 0); inbuff = calloc(1, in_size); inbuff->unix_handle = wine_server_obj_handle(unix_resource); + inbuff->resource_size = resource_size; if (name) lstrcpyW(&inbuff->name[0], name); @@ -2636,6 +2638,11 @@ struct shared_resource_open WCHAR name[1]; }; +struct shared_resource_info +{ + UINT64 resource_size; +}; + static HANDLE open_shared_resource(HANDLE kmt_handle, LPCWSTR name) { static const WCHAR shared_gpu_resourceW[] = {'\\','?','?','\\','S','h','a','r','e','d','G','p','u','R','e','s','o','u','r','c','e',0}; @@ -2683,6 +2690,21 @@ static HANDLE open_shared_resource(HANDLE kmt_handle, LPCWSTR name) return shared_resource; } +#define IOCTL_SHARED_GPU_RESOURCE_GET_INFO CTL_CODE(FILE_DEVICE_VIDEO, 7, METHOD_BUFFERED, FILE_READ_ACCESS) + +static BOOL shared_resource_get_info(HANDLE handle, struct shared_resource_info *info) +{ + IO_STATUS_BLOCK iosb; + unsigned int status; + + status = NtDeviceIoControlFile(handle, NULL, NULL, NULL, &iosb, IOCTL_SHARED_GPU_RESOURCE_GET_INFO, + NULL, 0, info, sizeof(*info)); + if (status) + ERR("Failed to get shared resource info, status %#x.\n", status); + + return !status; +} + #define IOCTL_SHARED_GPU_RESOURCE_GET_UNIX_RESOURCE CTL_CODE(FILE_DEVICE_VIDEO, 3, METHOD_BUFFERED, FILE_READ_ACCESS) static int get_shared_resource_fd(HANDLE shared_resource) @@ -2761,11 +2783,15 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo /* Vulkan consumes imported FDs, but not imported HANDLEs */ if (handle_import_info) { + struct shared_resource_info res_info; + fd_import_info.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR; fd_import_info.pNext = info.pNext; fd_import_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; info.pNext = &fd_import_info; + TRACE("import handle type %#x.\n", handle_import_info->handleType); + switch (handle_import_info->handleType) { case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT: @@ -2801,6 +2827,26 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo result = VK_ERROR_INVALID_EXTERNAL_HANDLE; goto done; } + + /* From VkMemoryAllocateInfo spec: "if the parameters define an import operation and the external handle type is + * VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT, + * or VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT, allocationSize is ignored.". Although test suggests + * that it is also true for opaque Win32 handles. */ + if (shared_resource_get_info(memory->handle, &res_info)) + { + if (res_info.resource_size) + { + TRACE("Shared resource size %llu.\n", (long long)res_info.resource_size); + if (info.allocationSize && info.allocationSize != res_info.resource_size) + FIXME("Shared resource allocationSize %llu, resource_size %llu.\n", + (long long)info.allocationSize, (long long)res_info.resource_size); + info.allocationSize = res_info.resource_size; + } + else + { + ERR("Zero shared resource size.\n"); + } + } } else if (device->phys_dev->external_memory_align && (mem_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && !find_next_struct(alloc_info->pNext, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT)) @@ -2881,7 +2927,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo if (device->funcs.p_vkGetMemoryFdKHR(device->host_device, &get_fd_info, &fd) == VK_SUCCESS) { - memory->handle = create_gpu_resource(fd, handle_export_info ? handle_export_info->name : NULL); + memory->handle = create_gpu_resource(fd, handle_export_info ? handle_export_info->name : NULL, alloc_info->allocationSize); memory->access = handle_export_info ? handle_export_info->dwAccess : GENERIC_ALL; if (handle_export_info && handle_export_info->pAttributes) memory->inherit = handle_export_info->pAttributes->bInheritHandle; @@ -4269,7 +4315,7 @@ VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateI if ((res = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd)) == VK_SUCCESS) { - object->handle = create_gpu_resource(fd, export_handle_info ? export_handle_info->name : NULL); + object->handle = create_gpu_resource(fd, export_handle_info ? export_handle_info->name : NULL, 0); close(fd); } @@ -4308,7 +4354,7 @@ VkResult wine_vkCreateSemaphore(VkDevice device_handle, const VkSemaphoreCreateI if ((res = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd)) == VK_SUCCESS) { - object->handle = create_gpu_resource(fd, export_handle_info ? export_handle_info->name : NULL); + object->handle = create_gpu_resource(fd, export_handle_info ? export_handle_info->name : NULL, 0); close(fd); } From 50b723978208dddbc251a0fc10295695f67188e8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 10 Aug 2023 20:09:33 -0600 Subject: [PATCH 1053/1506] winevulkan: Share keyed mutex data. CW-Bug-Id: #22372 --- dlls/winevulkan/vulkan.c | 195 ++++++++++++++++++++++++++++++- dlls/winevulkan/vulkan_private.h | 14 +++ 2 files changed, 207 insertions(+), 2 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 85889f2d0d4..4626e313090 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -532,7 +532,8 @@ static char **parse_xr_extensions(unsigned int *len) } static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_dev, - struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst) + struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst, + struct wine_device *device) { static const char *wine_xr_extension_name = "VK_WINE_openxr_device_extensions"; unsigned int i, append_xr = 0, have_ext_mem32 = 0, have_ext_sem32 = 0, have_keyed_mutex = 0, append_timeline = 1; @@ -617,6 +618,7 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de new_extensions[o++] = "VK_KHR_external_memory_fd"; if (!have_ext_sem32) new_extensions[o++] = "VK_KHR_external_semaphore_fd"; + device->keyed_mutexes_enabled = TRUE; } if (phys_dev->external_memory_align) { @@ -997,7 +999,7 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre } init_conversion_context(&ctx); - res = wine_vk_device_convert_create_info(phys_dev, &ctx, create_info, &create_info_host); + res = wine_vk_device_convert_create_info(phys_dev, &ctx, create_info, &create_info_host, object); if (res == VK_SUCCESS) { VkPhysicalDeviceFeatures features = {0}; @@ -2737,6 +2739,190 @@ static HANDLE get_shared_resource_kmt_handle(HANDLE shared_resource) return wine_server_ptr_handle(kmt_handle); } +static bool set_shared_resource_object(HANDLE shared_resource, unsigned int index, HANDLE handle); +static HANDLE get_shared_resource_object(HANDLE shared_resource, unsigned int index); + +static void destroy_keyed_mutex(struct wine_device *device, struct wine_device_memory *memory) +{ + if (memory->keyed_mutex_shm) + { + NtUnmapViewOfSection(GetCurrentProcess(), memory->keyed_mutex_shm); + memory->keyed_mutex_shm = NULL; + } + if (memory->keyed_mutex_sem) + { + device->funcs.p_vkDestroySemaphore(device->host_device, memory->keyed_mutex_sem, NULL); + memory->keyed_mutex_sem = VK_NULL_HANDLE; + } +} + +static void create_keyed_mutex(struct wine_device *device, struct wine_device_memory *memory) +{ + VkExportSemaphoreCreateInfo timeline_export_info; + VkSemaphoreTypeCreateInfo type_info; + VkSemaphoreCreateInfo create_info; + VkSemaphoreGetFdInfoKHR fd_info; + pthread_mutexattr_t mutex_attr; + OBJECT_ATTRIBUTES attr; + HANDLE section_handle; + LARGE_INTEGER li; + HANDLE handle; + SIZE_T size; + VkResult vr; + int fd; + + InitializeObjectAttributes(&attr, NULL, 0, NULL, NULL); + size = li.QuadPart = sizeof(*memory->keyed_mutex_shm); + if (NtCreateSection(§ion_handle, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE, &attr, &li, PAGE_READWRITE, SEC_COMMIT, NULL)) + { + ERR("NtCreateSection failed.\n"); + return; + } + + if (!set_shared_resource_object(memory->handle, 0, section_handle)) + { + NtClose(section_handle); + ERR("set_shared_resource_object failed.\n"); + return; + } + + if (NtMapViewOfSection(section_handle, GetCurrentProcess(), (void**) &memory->keyed_mutex_shm, 0, 0, NULL, &size, ViewShare, 0, PAGE_READWRITE)) + { + NtClose(section_handle); + ERR("NtMapViewOfSection failed.\n"); + return; + } + + NtClose(section_handle); + + timeline_export_info.sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO; + timeline_export_info.pNext = NULL; + timeline_export_info.handleTypes = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + + type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; + type_info.pNext = &timeline_export_info; + type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + type_info.initialValue = 0; + + create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + create_info.pNext = &type_info; + create_info.flags = 0; + + if ((vr = device->funcs.p_vkCreateSemaphore(device->host_device, &create_info, NULL, &memory->keyed_mutex_sem)) != VK_SUCCESS) + { + ERR("Failed to create semaphore, vr %d.\n", vr); + goto error; + } + fd_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; + fd_info.pNext = NULL; + fd_info.semaphore = memory->keyed_mutex_sem; + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + + if ((vr = device->funcs.p_vkGetSemaphoreFdKHR(device->host_device, &fd_info, &fd)) != VK_SUCCESS) + { + ERR("Failed to export semaphore fd, vr %d.\n", vr); + goto error; + } + if (wine_server_fd_to_handle(fd, GENERIC_ALL, 0, &handle) != STATUS_SUCCESS) + { + ERR("wine_server_fd_to_handle failed.\n"); + close(fd); + goto error; + } + close(fd); + if (!set_shared_resource_object(memory->handle, 1, handle)) + { + ERR("set_shared_resource_object failed.\n"); + NtClose(handle); + goto error; + } + NtClose(handle); + + pthread_mutexattr_init(&mutex_attr); + pthread_mutexattr_setpshared(&mutex_attr, PTHREAD_PROCESS_SHARED); + if (pthread_mutex_init(&memory->keyed_mutex_shm->mutex, &mutex_attr)) + memory->keyed_mutex_shm->instance_id_counter = 1; + memory->keyed_mutex_instance_id = ++memory->keyed_mutex_shm->instance_id_counter; + TRACE("memory %p, created keyed mutex.\n", memory); + return; + +error: + destroy_keyed_mutex(device, memory); +} + +static void import_keyed_mutex(struct wine_device *device, struct wine_device_memory *memory) +{ + VkSemaphoreTypeCreateInfo type_info; + VkImportSemaphoreFdInfoKHR fd_info; + VkSemaphoreCreateInfo create_info; + HANDLE section_handle, sem_handle; + SIZE_T size; + + VkResult vr; + + if (!(section_handle = get_shared_resource_object(memory->handle, 0))) + { + TRACE("No section handle.\n"); + return; + } + if (!(sem_handle = get_shared_resource_object(memory->handle, 1))) + { + ERR("No smeaphore handle.\n"); + NtClose(section_handle); + return; + } + + size = sizeof(*memory->keyed_mutex_shm); + if (NtMapViewOfSection(section_handle, GetCurrentProcess(), (void**) &memory->keyed_mutex_shm, 0, 0, NULL, &size, ViewShare, 0, PAGE_READWRITE)) + { + ERR("NtMapViewOfSection failed.\n"); + goto error; + } + + type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO; + type_info.pNext = NULL; + type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE; + type_info.initialValue = 0; + + create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + create_info.pNext = &type_info; + create_info.flags = 0; + + if ((vr = device->funcs.p_vkCreateSemaphore(device->host_device, &create_info, NULL, &memory->keyed_mutex_sem)) != VK_SUCCESS) + { + ERR("Failed to create semaphore, vr %d.\n", vr); + goto error; + } + + fd_info.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR; + fd_info.pNext = NULL; + fd_info.semaphore = memory->keyed_mutex_sem; + fd_info.flags = 0; + fd_info.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + + if (wine_server_handle_to_fd(sem_handle, FILE_READ_DATA, &fd_info.fd, NULL)) + { + ERR("wine_server_handle_to_fd failed.\n"); + goto error; + } + + vr = device->funcs.p_vkImportSemaphoreFdKHR(device->host_device, &fd_info); + close(fd_info.fd); + if (vr != VK_SUCCESS) + { + ERR("vkImportSemaphoreFdKHR failed, vr %d.\n", vr); + goto error; + } + + memory->keyed_mutex_instance_id = InterlockedIncrement64((LONGLONG *)&memory->keyed_mutex_shm->instance_id_counter); + TRACE("memory %p, imported keyed mutex.\n", memory); + return; +error: + NtClose(section_handle); + NtClose(sem_handle); + destroy_keyed_mutex(device, memory); +} + VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *alloc_info, const VkAllocationCallbacks *allocator, VkDeviceMemory *ret, void *win_pAllocateInfo) @@ -2847,6 +3033,8 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo ERR("Zero shared resource size.\n"); } } + if (device->keyed_mutexes_enabled) + import_keyed_mutex(device, memory); } else if (device->phys_dev->external_memory_align && (mem_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && !find_next_struct(alloc_info->pNext, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT)) @@ -2934,6 +3122,8 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo else memory->inherit = FALSE; close(fd); + if (device->keyed_mutexes_enabled) + create_keyed_mutex(device, memory); } if (memory->handle == INVALID_HANDLE_VALUE) @@ -2968,6 +3158,7 @@ void wine_vkFreeMemory(VkDevice handle, VkDeviceMemory memory_handle, const VkAl return; memory = wine_device_memory_from_handle(memory_handle); + destroy_keyed_mutex(device, memory); device->funcs.p_vkFreeMemory(device->host_device, memory->host_memory, NULL); if (memory->mapping) diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 89fe3d8343b..ffae94adbe4 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -98,6 +98,7 @@ struct wine_device pthread_cond_t sem_poll_updated_cond; uint64_t sem_poll_update_value; /* set to sem_poll_update.value by signaller thread once update is processed. */ unsigned int allocated_fence_ops_count; + BOOL keyed_mutexes_enabled; }; static inline struct wine_device *wine_device_from_handle(VkDevice handle) @@ -251,6 +252,16 @@ static inline struct wine_cmd_pool *wine_cmd_pool_from_handle(VkCommandPool hand return (struct wine_cmd_pool *)(uintptr_t)client_ptr->unix_handle; } +struct keyed_mutex_shm +{ + pthread_mutex_t mutex; + uint64_t instance_id_counter; + uint64_t acquired_to_instance; + uint64_t key; + uint64_t timeline_value; + uint64_t timeline_queued_release; +}; + struct wine_device_memory { VkDeviceMemory host_memory; @@ -259,6 +270,9 @@ struct wine_device_memory DWORD access; HANDLE handle; void *mapping; + struct keyed_mutex_shm *keyed_mutex_shm; + VkSemaphore keyed_mutex_sem; + uint64_t keyed_mutex_instance_id; }; static inline VkDeviceMemory wine_device_memory_to_handle(struct wine_device_memory *device_memory) From 67d0275e4504b8142b865aa4b3a3d98e0b03e820 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 4 Aug 2023 20:46:30 -0600 Subject: [PATCH 1054/1506] winevulkan: Support keyed mutex waits and signals in submits. CW-Bug-Id: #22372 --- dlls/winevulkan/make_vulkan | 4 +- dlls/winevulkan/vulkan.c | 284 ++++++++++++++++++++++++++++++++++-- 2 files changed, 271 insertions(+), 17 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index d91818362cc..59db16aaf9b 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -182,7 +182,7 @@ FUNCTION_OVERRIDES = { "vkWaitSemaphores" : {"dispatch" : True}, "vkQueueBindSparse" : {"dispatch" : True}, "vkQueueSubmit" : {"dispatch" : True, "extra_param" : "pSubmits"}, - "vkQueueSubmit2" : {"dispatch" : True}, + "vkQueueSubmit2" : {"dispatch" : True, "extra_param" : "pSubmits"}, "vkDestroySemaphore" : {"dispatch" : True}, # VK_KHR_external_fence_capabilities @@ -209,7 +209,7 @@ FUNCTION_OVERRIDES = { "vkWaitSemaphoresKHR" : {"dispatch" : True}, # VK_KHR_synchronization2 - "vkQueueSubmit2KHR" : {"dispatch" : True}, + "vkQueueSubmit2KHR" : {"dispatch" : True, "extra_param" : "pSubmits"}, } # functions for which a user driver entry must be generated diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 4626e313090..40da11ec4b8 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -2923,6 +2923,111 @@ static void import_keyed_mutex(struct wine_device *device, struct wine_device_me destroy_keyed_mutex(device, memory); } +static VkResult acquire_keyed_mutex(struct wine_device *device, struct wine_device_memory *memory, uint64_t key, + uint32_t timeout_ms) +{ + ULONG end_wait, curr_tick, remaining_wait; + VkSemaphoreWaitInfo wait_info = { 0 }; + uint64_t timeline; + VkResult vr; + + if (!memory->keyed_mutex_shm) + return VK_ERROR_UNKNOWN; + + wait_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO; + wait_info.semaphoreCount = 1; + wait_info.pSemaphores = &memory->keyed_mutex_sem; + wait_info.pValues = &timeline; + + end_wait = NtGetTickCount() + timeout_ms; + + while (1) + { + pthread_mutex_lock(&memory->keyed_mutex_shm->mutex); + + if (memory->keyed_mutex_shm->acquired_to_instance) + { + if ((vr = get_semaphore_value(device, memory->keyed_mutex_sem, &timeline)) != VK_SUCCESS) + { + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + return VK_ERROR_UNKNOWN; + } + assert(timeline == memory->keyed_mutex_shm->timeline_value + || timeline == memory->keyed_mutex_shm->timeline_value + 1); + if (timeline == memory->keyed_mutex_shm->timeline_value + 1) + { + /* released from queue. */ + assert(memory->keyed_mutex_shm->timeline_queued_release == timeline); + memory->keyed_mutex_shm->timeline_queued_release = 0; + ++memory->keyed_mutex_shm->timeline_value; + memory->keyed_mutex_shm->acquired_to_instance = 0; + } + } + + if (memory->keyed_mutex_shm->acquired_to_instance == memory->keyed_mutex_instance_id + && !memory->keyed_mutex_shm->timeline_queued_release) + { + /* Already acquired to this device. */ + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + return VK_ERROR_UNKNOWN; + } + if (!memory->keyed_mutex_shm->acquired_to_instance && memory->keyed_mutex_shm->key == key) + { + /* Can acquire. */ + memory->keyed_mutex_shm->acquired_to_instance = memory->keyed_mutex_instance_id; + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + return VK_SUCCESS; + } + curr_tick = NtGetTickCount(); + if (!timeout_ms || curr_tick >= end_wait) + { + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + return VK_TIMEOUT; + } + remaining_wait = timeout_ms == INFINITE ? INFINITE : end_wait - curr_tick; + timeline = memory->keyed_mutex_shm->timeline_value + 1; + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + + vr = wait_semaphores(device, &wait_info, remaining_wait * 1000000ull); + if (vr != VK_SUCCESS && vr != VK_TIMEOUT) + { + ERR("vkWaitSemaphores failed, vr %d.\n", vr); + return VK_ERROR_UNKNOWN; + } + } +} + +static VkResult release_keyed_mutex(struct wine_device *device, struct wine_device_memory *memory, uint64_t key, + uint64_t *timeline_value) +{ + if (!memory->keyed_mutex_shm) + return VK_ERROR_UNKNOWN; + + pthread_mutex_lock(&memory->keyed_mutex_shm->mutex); + if (memory->keyed_mutex_shm->acquired_to_instance != memory->keyed_mutex_instance_id + || memory->keyed_mutex_shm->timeline_queued_release) + { + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + return VK_ERROR_UNKNOWN; + } + memory->keyed_mutex_shm->key = key; + if (timeline_value) + { + /* Return timeline value to signal from queue. */ + *timeline_value = memory->keyed_mutex_shm->timeline_value + 1; + memory->keyed_mutex_shm->timeline_queued_release = *timeline_value; + } + else + { + /* Release immediately. */ + memory->keyed_mutex_shm->acquired_to_instance = 0; + signal_timeline_sem(device, memory->keyed_mutex_sem, &memory->keyed_mutex_shm->timeline_value); + } + pthread_mutex_unlock(&memory->keyed_mutex_shm->mutex); + + return VK_SUCCESS; +} + VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *alloc_info, const VkAllocationCallbacks *allocator, VkDeviceMemory *ret, void *win_pAllocateInfo) @@ -4977,17 +5082,127 @@ struct struct_chain_def unsigned int size; }; +static VkResult process_keyed_mutexes(struct conversion_context *ctx, struct wine_device *device, + uint32_t submit_count, const void *submits_win, size_t submit_size, uint32_t **signal_counts, + VkSemaphoreSubmitInfo ***signal_infos) +{ + VkWin32KeyedMutexAcquireReleaseInfoKHR *keyed_mutex_info; + struct wine_device_memory *memory; + VkResult ret = VK_ERROR_UNKNOWN; + uint32_t i, j, signal_count = 0; + void *ptr; + + for (i = 0; i < submit_count; ++i) + { + ptr = (char *)submits_win + i * submit_size; + if (!(keyed_mutex_info = wine_vk_find_struct(ptr, WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR))) + continue; + for (j = 0; j < keyed_mutex_info->acquireCount; ++j) + { + memory = wine_device_memory_from_handle(keyed_mutex_info->pAcquireSyncs[j]); + if ((ret = acquire_keyed_mutex(device, memory, keyed_mutex_info->pAcquireKeys[j], + keyed_mutex_info->pAcquireTimeouts[j])) == VK_SUCCESS) + continue; + while (j) + { + --j; + memory = wine_device_memory_from_handle(keyed_mutex_info->pAcquireSyncs[j]); + release_keyed_mutex(device, memory, keyed_mutex_info->pAcquireKeys[j], NULL); + } + goto error; + } + /* Pre-check release error conditions. */ + for (j = 0; j < keyed_mutex_info->releaseCount; ++j) + { + memory = wine_device_memory_from_handle(keyed_mutex_info->pReleaseSyncs[j]); + if (!memory->keyed_mutex_shm) + goto error; + if (memory->keyed_mutex_shm->acquired_to_instance != memory->keyed_mutex_instance_id) + goto error; + } + signal_count += keyed_mutex_info->releaseCount; + } + + if (!signal_count) + { + *signal_counts = NULL; + return VK_SUCCESS; + } + *signal_counts = conversion_context_alloc(ctx, sizeof(**signal_counts) * submit_count); + *signal_infos = conversion_context_alloc(ctx, sizeof(**signal_infos) * submit_count); + for (i = 0; i < submit_count; ++i) + { + ptr = (char *)submits_win + i * submit_size; + if (!(keyed_mutex_info = wine_vk_find_struct(ptr, WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR))) + { + (*signal_counts)[i] = 0; + continue; + } + (*signal_counts)[i] = keyed_mutex_info->releaseCount; + (*signal_infos)[i] = conversion_context_alloc(ctx, sizeof(***signal_infos) * keyed_mutex_info->releaseCount); + for (j = 0; j < keyed_mutex_info->releaseCount; ++j) + { + memory = wine_device_memory_from_handle(keyed_mutex_info->pReleaseSyncs[j]); + (*signal_infos)[i][j].sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO; + (*signal_infos)[i][j].pNext = NULL; + (*signal_infos)[i][j].semaphore = memory->keyed_mutex_sem; + (*signal_infos)[i][j].stageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + (*signal_infos)[i][j].deviceIndex = 0; + ret = release_keyed_mutex(device, memory, keyed_mutex_info->pReleaseKeys[j], &(*signal_infos)[i][j].value); + if (ret != VK_SUCCESS) + { + /* This should only be possible if a racing submit queued release before us, currently not handled. */ + ERR("release_keyed_mutex failed, ret %d.\n", ret); + (*signal_infos)[i][j].value = 0; + } + } + } + + return VK_SUCCESS; + +error: + while (i) + { + --i; + ptr = (char *)submits_win + i * submit_size; + if (!(keyed_mutex_info = wine_vk_find_struct(ptr, WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR))) + continue; + for (j = 0; j < keyed_mutex_info->acquireCount; ++j) + { + memory = wine_device_memory_from_handle(keyed_mutex_info->pAcquireSyncs[j]); + release_keyed_mutex(device, memory, keyed_mutex_info->pAcquireKeys[j], NULL); + } + } + return ret; +} + +static void duplicate_array_for_unwrapping_copy_size(struct conversion_context *ctx, void **ptr, unsigned int size, + unsigned int copy_size) +{ + void *out; + + if (!size) + return; + + out = conversion_context_alloc(ctx, size); + if (*ptr) + memcpy(out, *ptr, copy_size); + *ptr = out; +} + VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo *submits_orig, VkFence fence, void *submits_win_ptr) { struct wine_queue *queue = wine_queue_from_handle(queue_handle); struct wine_device *device = queue->device; - VkTimelineSemaphoreSubmitInfo *timeline_submit_info; + VkTimelineSemaphoreSubmitInfo *timeline_submit_info, ts_info_copy; const VkSubmitInfo *submits_win = submits_win_ptr; VkD3D12FenceSubmitInfoKHR *d3d12_submit_info; const uint64_t **values; struct conversion_context ctx; VkSubmitInfo *submits; + VkSemaphoreSubmitInfo **km_infos; + uint32_t *km_counts; unsigned int i, j; VkResult ret; @@ -4995,6 +5210,9 @@ VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const V init_conversion_context(&ctx); MEMDUP(&ctx, submits, submits_orig, submit_count); + if ((ret = process_keyed_mutexes(&ctx, device, submit_count, submits_win_ptr, sizeof(*submits), &km_counts, &km_infos))) + return ret; + for (i = 0; i < submit_count; ++i) { timeline_submit_info = wine_vk_find_struct(&submits[i], TIMELINE_SEMAPHORE_SUBMIT_INFO); @@ -5024,6 +5242,36 @@ VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const V else values = NULL; unwrap_semaphore_array(&submits[i].pSignalSemaphores, values, submits[i].signalSemaphoreCount, &ctx, TRUE, device); + if (km_counts && km_counts[i]) + { + if (timeline_submit_info) + { + ts_info_copy = *timeline_submit_info; + timeline_submit_info = &ts_info_copy; + duplicate_array_for_unwrapping_copy_size(&ctx, (void **)&timeline_submit_info->pSignalSemaphoreValues, + (timeline_submit_info->signalSemaphoreValueCount + km_counts[i]) * sizeof(*timeline_submit_info->pSignalSemaphoreValues), + timeline_submit_info->signalSemaphoreValueCount * sizeof(*timeline_submit_info->pSignalSemaphoreValues)); + } + else + { + timeline_submit_info = &ts_info_copy; + timeline_submit_info->sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO; + timeline_submit_info->pNext = submits[i].pNext; + timeline_submit_info->waitSemaphoreValueCount = 0; + timeline_submit_info->signalSemaphoreValueCount = 0; + timeline_submit_info->pSignalSemaphoreValues = conversion_context_alloc(&ctx, km_counts[i] * sizeof(*timeline_submit_info->pSignalSemaphoreValues)); + submits[i].pNext = timeline_submit_info; + } + duplicate_array_for_unwrapping_copy_size(&ctx, (void **)&submits[i].pSignalSemaphores, + (submits[i].signalSemaphoreCount + km_counts[i]) * sizeof(*submits[i].pSignalSemaphores), + submits[i].signalSemaphoreCount * sizeof(*submits[i].pSignalSemaphores)); + for (j = 0; j < km_counts[i]; ++j) + { + ((uint64_t *)timeline_submit_info->pSignalSemaphoreValues)[j + timeline_submit_info->signalSemaphoreValueCount++] + = km_infos[i][j].value; + ((VkSemaphore *)submits[i].pSignalSemaphores)[j + submits[i].signalSemaphoreCount++] = km_infos[i][j].semaphore; + } + } if (submits[i].pCommandBuffers && submits[i].commandBufferCount) { @@ -5042,20 +5290,17 @@ VkResult wine_vkQueueSubmit(VkQueue queue_handle, uint32_t submit_count, const V static void duplicate_array_for_unwrapping(struct conversion_context *ctx, void **ptr, unsigned int size) { - void *out; - - if (!*ptr || !size) - return; - - out = conversion_context_alloc(ctx, size); - memcpy(out, *ptr, size); - *ptr = out; + duplicate_array_for_unwrapping_copy_size(ctx, ptr, size, size); } -static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo2 *submits_orig, VkFence fence, bool khr) +static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, const VkSubmitInfo2 *submits_orig, + VkFence fence, bool khr, void *submits_win_ptr) { struct wine_queue *queue = wine_queue_from_handle(queue_handle); + struct wine_device *device = queue->device; struct conversion_context ctx; + VkSemaphoreSubmitInfo **km_infos; + uint32_t *km_counts, count; VkSubmitInfo2 *submits; unsigned int i, j; VkResult ret; @@ -5064,6 +5309,8 @@ static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, c init_conversion_context(&ctx); MEMDUP(&ctx, submits, submits_orig, submit_count); + if ((ret = process_keyed_mutexes(&ctx, device, submit_count, submits_win_ptr, sizeof(*submits), &km_counts, &km_infos))) + return ret; for (i = 0; i < submit_count; ++i) { duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pWaitSemaphoreInfos, @@ -5072,11 +5319,16 @@ static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, c unwrap_semaphore(queue->device, &((VkSemaphoreSubmitInfo *)submits[i].pWaitSemaphoreInfos)[j].semaphore, &((VkSemaphoreSubmitInfo *)submits[i].pWaitSemaphoreInfos)[j].value, FALSE); - duplicate_array_for_unwrapping(&ctx, (void **)&submits[i].pSignalSemaphoreInfos, + count = submits[i].signalSemaphoreInfoCount + (km_counts ? km_counts[i] : 0); + duplicate_array_for_unwrapping_copy_size(&ctx, (void **)&submits[i].pSignalSemaphoreInfos, + count * sizeof(*submits[i].pSignalSemaphoreInfos), submits[i].signalSemaphoreInfoCount * sizeof(*submits[i].pSignalSemaphoreInfos)); for (j = 0; j < submits[i].signalSemaphoreInfoCount; ++j) unwrap_semaphore(queue->device, &((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j].semaphore, &((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j].value, TRUE); + for (; j < count; ++j) + ((VkSemaphoreSubmitInfo *)submits[i].pSignalSemaphoreInfos)[j] = km_infos[i][j - submits[i].signalSemaphoreInfoCount]; + submits[i].signalSemaphoreInfoCount = count; if (submits[i].pCommandBufferInfos && submits[i].commandBufferInfoCount) { @@ -5096,14 +5348,16 @@ static VkResult vk_queue_submit_2(VkQueue queue_handle, uint32_t submit_count, c return ret; } -VkResult wine_vkQueueSubmit2(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence) +VkResult wine_vkQueueSubmit2(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence, + void *submits_win) { - return vk_queue_submit_2(queue, submit_count, submits, fence, false); + return vk_queue_submit_2(queue, submit_count, submits, fence, false, submits_win); } -VkResult wine_vkQueueSubmit2KHR(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence) +VkResult wine_vkQueueSubmit2KHR(VkQueue queue, uint32_t submit_count, const VkSubmitInfo2 *submits, VkFence fence, + void *submits_win) { - return vk_queue_submit_2(queue, submit_count, submits, fence, true); + return vk_queue_submit_2(queue, submit_count, submits, fence, true, submits_win); } VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *present_info) From 71b302a1e0b268a57120bf95ac0e209fd45eabfd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 10 Aug 2023 12:23:26 -0600 Subject: [PATCH 1055/1506] winevulkan: Export custom functions for acquiring and releasing keyed mutexes. CW-Bug-Id: #22372 --- dlls/winevulkan/make_vulkan | 24 ++++++++++++++++++------ dlls/winevulkan/vk_custom.xml | 24 ++++++++++++++++++++++++ dlls/winevulkan/vulkan.c | 12 ++++++++++++ 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 dlls/winevulkan/vk_custom.xml diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 59db16aaf9b..f8ac5976efe 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -210,6 +210,10 @@ FUNCTION_OVERRIDES = { # VK_KHR_synchronization2 "vkQueueSubmit2KHR" : {"dispatch" : True, "extra_param" : "pSubmits"}, + + # Custom functions + "wine_vkAcquireKeyedMutex" : {"dispatch": True}, + "wine_vkReleaseKeyedMutex" : {"dispatch": True}, } # functions for which a user driver entry must be generated @@ -308,6 +312,9 @@ MANUAL_UNIX_THUNKS = { "vkSignalSemaphoreKHR", "vkWaitSemaphoresKHR", "vkQueueSubmit2KHR", + # Custom functions + "wine_vkAcquireKeyedMutex", + "wine_vkReleaseKeyedMutex", } # loader functions which are entirely manually implemented @@ -3410,12 +3417,16 @@ class VkRegistry(object): # function call we want we set a member 'required' to True. tree = ET.parse(reg_filename) root = tree.getroot() + + tree_custom = ET.parse("vk_custom.xml") + root_custom = tree_custom.getroot() + self._parse_enums(root) self._parse_types(root) - self._parse_commands(root) + self._parse_commands(root, root_custom) # Pull in any required types and functions. - self._parse_features(root) + self._parse_features(root, root_custom) self._parse_extensions(root) for enum in self.enums.values(): @@ -3508,10 +3519,10 @@ class VkRegistry(object): if not handle.object_type: LOGGER.warning("No object type found for {}".format(handle.name)) - def _parse_commands(self, root): + def _parse_commands(self, root, root_custom): """ Parse command section containing the Vulkan function calls. """ funcs = {} - commands = root.findall("./commands/") + commands = root.findall("./commands/") + root_custom.findall("./commands/") # As of Vulkan 1.1, various extensions got promoted to Core. # The old commands (e.g. KHR) are available for backwards compatibility @@ -3527,6 +3538,7 @@ class VkRegistry(object): continue func = VkFunction.from_xml(command, self.types) + if func: funcs[func.name] = func @@ -3778,10 +3790,10 @@ class VkRegistry(object): # Sort in alphabetical order. self.extensions = sorted(extensions, key=lambda ext: ext["name"]) - def _parse_features(self, root): + def _parse_features(self, root, root_custom): """ Parse the feature section, which describes Core commands and types needed. """ - for feature in root.findall("./feature"): + for feature in (root.findall("./feature") + root_custom.findall("./feature")): if not api_is_vulkan(feature): continue feature_name = feature.attrib["name"] diff --git a/dlls/winevulkan/vk_custom.xml b/dlls/winevulkan/vk_custom.xml new file mode 100644 index 00000000000..a9fd68548c4 --- /dev/null +++ b/dlls/winevulkan/vk_custom.xml @@ -0,0 +1,24 @@ + + + + + VkResult wine_vkAcquireKeyedMutex + VkDevice device + VkDeviceMemory memory + uint64_t key + uint32_t timeout_ms + + + VkResult wine_vkReleaseKeyedMutex + VkDevice device + VkDeviceMemory memory + uint64_t key + + + + + + + + + diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 40da11ec4b8..27cf80ee907 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -3990,6 +3990,8 @@ static void substitute_function_name(const char **name) *name = "vkGetSemaphoreFdKHR"; else if (!strcmp(*name, "vkImportSemaphoreWin32HandleKHR")) *name = "vkImportSemaphoreFdKHR"; + else if (!strcmp(*name, "wine_vkAcquireKeyedMutex") || !strcmp(*name, "wine_vkReleaseKeyedMutex")) + *name = "vkImportSemaphoreFdKHR"; } #ifdef _WIN64 @@ -5469,3 +5471,13 @@ VkResult wine_vkQueueBindSparse(VkQueue queue_handle, uint32_t bind_info_count, free_conversion_context(&ctx); return ret; } + +VkResult wine_wine_vkAcquireKeyedMutex(VkDevice device, VkDeviceMemory memory, uint64_t key, uint32_t timeout_ms) +{ + return acquire_keyed_mutex(wine_device_from_handle(device), wine_device_memory_from_handle(memory), key, timeout_ms); +} + +VkResult wine_wine_vkReleaseKeyedMutex(VkDevice device, VkDeviceMemory memory, uint64_t key) +{ + return release_keyed_mutex(wine_device_from_handle(device), wine_device_memory_from_handle(memory), key, NULL); +} From 3ef266b948104316419ce0c0fa87a24e4f9c51c2 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 14 Jan 2022 09:46:20 +0100 Subject: [PATCH 1056/1506] HACK: riched20: Ignore WM_SETFONT for Grand Theft Auto V. CW-Bug-Id: #19917 --- dlls/riched20/editor.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index ff05ba60333..945f9f48505 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3590,6 +3590,20 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, CHARFORMAT2W fmt; HDC hDC; BOOL bRepaint = LOWORD(lParam); + const char *sgi = getenv("STEAM_COMPAT_APP_ID"); + + /* Grand Theft Auto V installer tries to set font for license + * richedit to Arial, which breaks CJK languages. Given that the + * RTF already has reasonable fonts set, we can just ignore the + * message. This can be removed once our richedit is able to do + * font substitution properly. CW bug #19917. + * + * It's important that STEAM_COMPAT_APP_ID environment variable is + * used instead of the usual SteamGameId, because the latter is + * not available during the configuration stage, when the + * installer is run. */ + if (sgi && strcmp(sgi, "271590") == 0) + return 0; if (!wParam) wParam = (WPARAM)GetStockObject(SYSTEM_FONT); From a8dc80ad01d736b03271a5e145ba1944d616e422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 13 Jan 2023 09:08:33 +0100 Subject: [PATCH 1057/1506] mf: Drop late samples in audio renderer. CW-Bug-Id: #21159 Squashed with: mf: Don't leak dropped samples. CW-Bug-Id: #22798 --- dlls/mf/sar.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 84824f954dd..970063497b1 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -1339,6 +1339,7 @@ static HRESULT stream_queue_sample(struct audio_renderer *renderer, IMFSample *s { struct queued_object *object; DWORD sample_len, sample_frames; + MFTIME time, clocktime, systime; HRESULT hr; if (FAILED(hr = IMFSample_GetTotalLength(sample, &sample_len))) @@ -1346,15 +1347,33 @@ static HRESULT stream_queue_sample(struct audio_renderer *renderer, IMFSample *s sample_frames = sample_len / renderer->frame_size; - if (!(object = calloc(1, sizeof(*object)))) - return E_OUTOFMEMORY; + if (FAILED(hr = IMFSample_GetSampleTime(sample, &time))) + { + WARN("Failed to get sample time, hr %#lx.\n", hr); + return hr; + } - object->type = OBJECT_TYPE_SAMPLE; - object->u.sample.sample = sample; - IMFSample_AddRef(object->u.sample.sample); + if (!renderer->clock) + clocktime = time; + else if (FAILED(hr = IMFPresentationClock_GetCorrelatedTime(renderer->clock, 0, &clocktime, &systime))) + { + WARN("Failed to get clock time, hr %#lx.\n", hr); + return hr; + } - list_add_tail(&renderer->queue, &object->entry); - renderer->queued_frames += sample_frames; + if (time < clocktime) + FIXME("Dropping sample %p, time %I64u, clocktime %I64u, systime %I64u.\n", sample, time, clocktime, systime); + else + { + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->type = OBJECT_TYPE_SAMPLE; + object->u.sample.sample = sample; + IMFSample_AddRef(object->u.sample.sample); + list_add_tail(&renderer->queue, &object->entry); + renderer->queued_frames += sample_frames; + } return S_OK; } From 567c9f3826e6b771ca2878791cfcec55ec5666a7 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 12 Oct 2023 11:28:45 +0100 Subject: [PATCH 1058/1506] mf: Don't make stream sink shutdown dependent on IMFActivate presence in node. Base on Bernhard's upstream MR: https://gitlab.winehq.org/wine/wine/-/merge_requests/3067 This fixes a media engine leak after it's shut down. CW-Bug-Id: #22798 --- dlls/mf/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 5abf920e2e9..e77011f10b8 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -785,7 +785,7 @@ static void session_shutdown_current_topology(struct media_session *session) WARN("Failed to shut down activation object for the sink, hr %#lx.\n", hr); IMFActivate_Release(activate); } - else if (SUCCEEDED(topology_node_get_object(node, &IID_IMFStreamSink, (void **)&stream_sink))) + if (SUCCEEDED(topology_node_get_object(node, &IID_IMFStreamSink, (void **)&stream_sink))) { if (SUCCEEDED(IMFStreamSink_GetMediaSink(stream_sink, &sink))) { From 301c4251a0bb80638dd06d6d0f16056ea43b7b90 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Fri, 27 Oct 2023 19:35:17 +0100 Subject: [PATCH 1059/1506] mfmediaengine: Be a bit more conservative with locks in engine Shutdown. During engine shutdown we acquire engine lock first, then locks of its constituents (e.g. sample grabbers); whereas normally the order is the other way around (e.g. timer callback -> acquire sample grabber lock -> OnProcessSample callback -> engine lock). This is deadlock prone. With this commit, engine lock is released before we shutdown the inner media session. CW-Bug-Id: #22798 --- dlls/mfmediaengine/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index d8694cf6011..baa6e8540ff 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -2242,6 +2242,7 @@ static HRESULT WINAPI media_engine_GetVideoAspectRatio(IMFMediaEngineEx *iface, static HRESULT WINAPI media_engine_Shutdown(IMFMediaEngineEx *iface) { struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + IMFMediaSession *session = NULL; HRESULT hr = S_OK; TRACE("%p.\n", iface); @@ -2253,10 +2254,16 @@ static HRESULT WINAPI media_engine_Shutdown(IMFMediaEngineEx *iface) { media_engine_set_flag(engine, FLAGS_ENGINE_SHUT_DOWN, TRUE); media_engine_clear_presentation(engine); - IMFMediaSession_Shutdown(engine->session); + IMFMediaSession_AddRef(engine->session); + session = engine->session; } LeaveCriticalSection(&engine->cs); + if (SUCCEEDED(hr)) + { + IMFMediaSession_Shutdown(session); + IMFMediaSession_Release(session); + } return hr; } From a097f60dc54e7195513e935fabebfcd4bb3dd5d9 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 1 Nov 2023 01:55:28 +0000 Subject: [PATCH 1060/1506] rtworkq: Avoid use-after-free. queue_release_pending_item releases the work_item reference but later accesses `item->queue`, which is a potential use-after-free. --- dlls/rtworkq/queue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/rtworkq/queue.c b/dlls/rtworkq/queue.c index 15b8da47639..03a7c1ce8bb 100644 --- a/dlls/rtworkq/queue.c +++ b/dlls/rtworkq/queue.c @@ -732,14 +732,16 @@ static HRESULT invoke_async_callback(IRtwqAsyncResult *result) static void queue_release_pending_item(struct work_item *item) { - EnterCriticalSection(&item->queue->cs); + struct queue *queue = item->queue; + EnterCriticalSection(&queue->cs); if (item->key) { list_remove(&item->entry); item->key = 0; IUnknown_Release(&item->IUnknown_iface); } - LeaveCriticalSection(&item->queue->cs); + LeaveCriticalSection(&queue->cs); + } static void CALLBACK waiting_item_callback(TP_CALLBACK_INSTANCE *instance, void *context, TP_WAIT *wait, From 795918919627648b9de2b833a5db3c4077f4cf84 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 1 Nov 2023 02:23:20 +0000 Subject: [PATCH 1061/1506] mfplat: tests: Validate MFCancelWorkItem releases the callback. --- dlls/mfplat/tests/mfplat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 7fab1598181..c7ee087bb93 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -3598,6 +3598,7 @@ static void test_scheduled_items(void) IMFAsyncResult *result; MFWORKITEM_KEY key, key2; HRESULT hr; + ULONG refcount; callback = create_test_callback(NULL); @@ -3610,6 +3611,9 @@ static void test_scheduled_items(void) hr = MFCancelWorkItem(key); ok(hr == S_OK, "Failed to cancel item, hr %#lx.\n", hr); + refcount = IMFAsyncCallback_Release(&callback->IMFAsyncCallback_iface); + ok(refcount == 0, "Unexpected refcount %lu.\n", refcount); + hr = MFCancelWorkItem(key); ok(hr == MF_E_NOT_FOUND || broken(hr == S_OK) /* < win10 */, "Unexpected hr %#lx.\n", hr); @@ -3619,6 +3623,8 @@ static void test_scheduled_items(void) return; } + callback = create_test_callback(NULL); + hr = MFCreateAsyncResult(NULL, &callback->IMFAsyncCallback_iface, NULL, &result); ok(hr == S_OK, "Failed to create result, hr %#lx.\n", hr); From 18f74d286b22d7f81a02eaab418e765132b6e732 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 1 Nov 2023 02:05:38 +0000 Subject: [PATCH 1062/1506] rtworkq: Release cancelled work items. And avoiding race condition while doing so. Usually the threadpool holds a reference to the work_item, which is released when the work_item's callback is invoked. However queue_cancel_item closes the threadpool object without releasing it, leading to a leak. The fix is not as simple as adding a IUnknown_Release, because the work_item's callback can still be called after CloseThreadpoolTimer/Wait has returned. In fact its callback might currently be running. In which case we would double release the reference. We have to stop any further callbacks to be queued, wait for any currently running callbacks to finish, then finally we can close the threadpool object. After that, if the callback wasn't called, we can safely release the work_item reference. CW-Bug-Id: #22798 --- dlls/rtworkq/queue.c | 73 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/dlls/rtworkq/queue.c b/dlls/rtworkq/queue.c index 03a7c1ce8bb..620145f64ba 100644 --- a/dlls/rtworkq/queue.c +++ b/dlls/rtworkq/queue.c @@ -878,32 +878,87 @@ static HRESULT queue_submit_timer(struct queue *queue, IRtwqAsyncResult *result, return S_OK; } -static HRESULT queue_cancel_item(struct queue *queue, RTWQWORKITEM_KEY key) +static HRESULT queue_cancel_item(struct queue *queue, const RTWQWORKITEM_KEY key) { HRESULT hr = RTWQ_E_NOT_FOUND; + union { TP_WAIT *wait_object; TP_TIMER *timer_object; } work_object; + enum work_item_type work_object_type; struct work_item *item; + const UINT64 mask = key >> 32; EnterCriticalSection(&queue->cs); LIST_FOR_EACH_ENTRY(item, &queue->pending_items, struct work_item, entry) { if (item->key == key) { - key >>= 32; - if ((key & WAIT_ITEM_KEY_MASK) == WAIT_ITEM_KEY_MASK) + hr = S_OK; + if ((mask & WAIT_ITEM_KEY_MASK) == WAIT_ITEM_KEY_MASK) + { + if (item->type != WORK_ITEM_WAIT) + WARN("Item %p is not a wait item, but its key has wait item mask.\n", item); + + work_object_type = WORK_ITEM_WAIT; + work_object.wait_object = item->u.wait_object; + item->u.wait_object = NULL; + } + else if ((mask & SCHEDULED_ITEM_KEY_MASK) == SCHEDULED_ITEM_KEY_MASK) + { + if (item->type != WORK_ITEM_TIMER) + WARN("Item %p is not a timer item, but its key has timer item mask.\n", item); + + work_object_type = WORK_ITEM_TIMER; + work_object.timer_object = item->u.timer_object; + item->u.timer_object = NULL; + } + else + { + WARN("Unknown item key mask %#I64x.\n", mask); + queue_release_pending_item(item); + goto out; + } + break; + } + } + + if (FAILED(hr)) + goto out; + + LeaveCriticalSection(&queue->cs); + + // Safely either stop the thread pool object, or if the callback is already running, wait for it to finish. + // This way, we can safely release the reference to the work item. + if (work_object_type == WORK_ITEM_WAIT) + { + SetThreadpoolWait(work_object.wait_object, NULL, NULL); + WaitForThreadpoolWaitCallbacks(work_object.wait_object, TRUE); + CloseThreadpoolWait(work_object.wait_object); + } + else if (work_object_type == WORK_ITEM_TIMER) + { + SetThreadpoolTimer(work_object.timer_object, NULL, 0, 0); + WaitForThreadpoolTimerCallbacks(work_object.timer_object, TRUE); + CloseThreadpoolTimer(work_object.timer_object); + } + + // If the work item is still in pending items, its callback hasn't been invoked yet; + // we remove it. Otherwise its callback would have already released it. + EnterCriticalSection(&queue->cs); + LIST_FOR_EACH_ENTRY(item, &queue->pending_items, struct work_item, entry) + { + if (item->key == key) + { + if (work_object_type == WORK_ITEM_WAIT) { IRtwqAsyncResult_SetStatus(item->result, RTWQ_E_OPERATION_CANCELLED); invoke_async_callback(item->result); - CloseThreadpoolWait(item->u.wait_object); } - else if ((key & SCHEDULED_ITEM_KEY_MASK) == SCHEDULED_ITEM_KEY_MASK) - CloseThreadpoolTimer(item->u.timer_object); - else - WARN("Unknown item key mask %#I64x.\n", key); queue_release_pending_item(item); - hr = S_OK; + IUnknown_Release(&item->IUnknown_iface); break; } } + +out: LeaveCriticalSection(&queue->cs); return hr; From 38ee816b818e08a36aa94c697f26ce8c317a7c1d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Dec 2023 17:02:28 -0600 Subject: [PATCH 1063/1506] ntdll: Only allocate debug info with RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO in RtlInitializeCriticalSectionEx(). CW-Bug-Id: #23142 --- dlls/kernel32/tests/sync.c | 23 ++++++++++++++++++++++- dlls/ntdll/sync.c | 6 +++--- include/winnt.h | 1 + 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index f1d0dfc3d27..96589159713 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -3117,7 +3117,7 @@ static void test_crit_section(void) to override that. */ memset(&cs, 0, sizeof(cs)); InitializeCriticalSection(&cs); - ok(cs.DebugInfo != NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); @@ -3127,10 +3127,31 @@ static void test_crit_section(void) return; } + memset(&cs, 0, sizeof(cs)); + ret = pInitializeCriticalSectionEx(&cs, 0, 0); + ok(ret, "Failed to initialize critical section.\n"); + ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + DeleteCriticalSection(&cs); + todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO); ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + DeleteCriticalSection(&cs); + todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + + memset(&cs, 0, sizeof(cs)); + ret = pInitializeCriticalSectionEx(&cs, 0, 0); + ok(ret, "Failed to initialize critical section.\n"); + ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + DeleteCriticalSection(&cs); + todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + + memset(&cs, 0, sizeof(cs)); + ret = pInitializeCriticalSectionEx(&cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); + ok(ret, "Failed to initialize critical section.\n"); + ok(cs.DebugInfo && cs.DebugInfo != (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); ret = TryEnterCriticalSection(&cs); ok(ret, "Failed to enter critical section.\n"); diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index d872d75fdd1..28f07f572c3 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -205,7 +205,7 @@ static inline NTSTATUS wait_semaphore( RTL_CRITICAL_SECTION *crit, int timeout ) */ NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit ) { - return RtlInitializeCriticalSectionEx( crit, 0, 0 ); + return RtlInitializeCriticalSectionEx( crit, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO ); } @@ -214,7 +214,7 @@ NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit ) */ NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount( RTL_CRITICAL_SECTION *crit, ULONG spincount ) { - return RtlInitializeCriticalSectionEx( crit, spincount, 0 ); + return RtlInitializeCriticalSectionEx( crit, spincount, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO ); } @@ -232,7 +232,7 @@ NTSTATUS WINAPI RtlInitializeCriticalSectionEx( RTL_CRITICAL_SECTION *crit, ULON * is done, then debug info should be managed through Rtlp[Allocate|Free]DebugInfo * so (e.g.) MakeCriticalSectionGlobal() doesn't free it using HeapFree(). */ - if (flags & RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO) + if (!(flags & RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO)) crit->DebugInfo = no_debug_info_marker; else { diff --git a/include/winnt.h b/include/winnt.h index 20db9a8aabd..0e1a197d423 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6056,6 +6056,7 @@ typedef struct _RTL_CRITICAL_SECTION { #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000 +#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO 0x10000000 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000) From 14f7b22769d6cc6f2ded0dad7fde3755459bc407 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Dec 2023 17:49:20 -0600 Subject: [PATCH 1064/1506] ntdll: Set DebugInfo to NULL for absent DebugInfo in RtlDeleteCriticalSection(). CW-Bug-Id: #23142 --- dlls/kernel32/tests/sync.c | 6 +++--- dlls/ntdll/sync.c | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 96589159713..8c609b603dd 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -3132,21 +3132,21 @@ static void test_crit_section(void) ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO); ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, 0); ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 28f07f572c3..54a8a122dc0 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -288,7 +288,11 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit ) crit->DebugInfo = NULL; } } - else NtClose( crit->LockSemaphore ); + else + { + NtClose( crit->LockSemaphore ); + crit->DebugInfo = NULL; + } crit->LockSemaphore = 0; return STATUS_SUCCESS; } From 651426a0f24aab98982949bce69a58b0e87dfee4 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 29 Nov 2023 22:46:34 +0000 Subject: [PATCH 1065/1506] mf: Only preroll media sinks when starting from stopped state. CW-Bug-Id: #23010 --- dlls/mf/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index e77011f10b8..a3cf57ab047 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -2940,7 +2940,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn session_set_presentation_clock(session); - if (session->presentation.flags & SESSION_FLAG_NEEDS_PREROLL) + if ((session->presentation.flags & SESSION_FLAG_NEEDS_PREROLL) && session_is_output_nodes_state(session, OBJ_STATE_STOPPED)) { MFTIME preroll_time = 0; From a1206eabf1836befe73b3f52fbad9a469d822e14 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 20 Dec 2023 13:43:26 -0600 Subject: [PATCH 1066/1506] server: Handle owner rights (S-1-3-4) SID in ACE. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49334 CW-Bug-Id: #23154 --- dlls/advapi32/tests/security.c | 65 ++++++++++++++++++++++++++++++++++ server/file.c | 4 +-- server/security.h | 1 + server/token.c | 1 + 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index a2f8c6574cb..318eb2ba18b 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -786,6 +786,9 @@ static void test_lookupPrivilegeValue(void) } } +static TOKEN_OWNER *get_alloc_token_owner( HANDLE token ); +static TOKEN_PRIMARY_GROUP *get_alloc_token_primary_group( HANDLE token ); + static void test_FileSecurity(void) { char wintmpdir [MAX_PATH]; @@ -800,6 +803,16 @@ static void test_FileSecurity(void) const SECURITY_INFORMATION request = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION; + TOKEN_OWNER *owner; + PSID owner_sid; + BOOL defaulted, present; + TOKEN_PRIMARY_GROUP *group; + SECURITY_ATTRIBUTES sa; + PACL dacl; + ACL_SIZE_INFORMATION acl_size; + ACCESS_ALLOWED_ACE *ace; + static SID owner_rights_sid = { SID_REVISION, 1, { SECURITY_CREATOR_SID_AUTHORITY }, { SECURITY_CREATOR_OWNER_RIGHTS_RID } }; + const WCHAR sd_onwer_rights_str[] = L"D:(A;;FA;;;S-1-3-4)"; if (!pSetFileSecurityA) { win_skip ("SetFileSecurity is not available\n"); @@ -902,6 +915,58 @@ static void test_FileSecurity(void) ok (GetLastError() == ERROR_FILE_NOT_FOUND, "last error ERROR_FILE_NOT_FOUND expected, got %ld\n", GetLastError()); + sa.nLength = sizeof(sa); + sa.bInheritHandle = FALSE; + rc = ConvertStringSecurityDescriptorToSecurityDescriptorW(sd_onwer_rights_str, SDDL_REVISION_1, &sa.lpSecurityDescriptor, NULL); + ok(rc, "got error %lu.\n", GetLastError()); + + DeleteFileA(file); + fh = CreateFileA(file, GENERIC_READ, 0, &sa, CREATE_ALWAYS, 0, NULL); + ok (fh != INVALID_HANDLE_VALUE, "error %lu\n", GetLastError()); + LocalFree(sa.lpSecurityDescriptor); + + rc = GetFileSecurityA (file, OWNER_SECURITY_INFORMATION, NULL, 0, &retSize); + ok (!rc && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %ld, error %lu.\n", rc, GetLastError()); + sd = HeapAlloc (GetProcessHeap (), 0, sdSize); + rc = GetFileSecurityA (file, OWNER_SECURITY_INFORMATION, sd, retSize, &retSize); + ok(rc, "got error %lu.\n", GetLastError()); + rc = GetSecurityDescriptorOwner(sd, &owner_sid, &defaulted); + ok(rc, "got error %lu.\n", GetLastError()); + ok(!defaulted, "got %d.\n", defaulted); + owner = get_alloc_token_owner(GetCurrentProcessToken()); + todo_wine ok(EqualSid(owner_sid, owner->Owner), "Owner SIDs are not equal %s != %s\n", debugstr_sid(owner_sid), debugstr_sid(owner->Owner)); + HeapFree (GetProcessHeap (), 0, owner); + HeapFree (GetProcessHeap (), 0, sd); + + group = get_alloc_token_primary_group(GetCurrentProcessToken()); + test_group_equal(fh, group->PrimaryGroup, __LINE__); + HeapFree (GetProcessHeap (), 0, group); + + CloseHandle(fh); + + fh = CreateFileA(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + ok (fh != INVALID_HANDLE_VALUE, "error %lu\n", GetLastError()); + if (fh != INVALID_HANDLE_VALUE) + { + rc = GetFileSecurityA (file, DACL_SECURITY_INFORMATION, NULL, 0, &retSize); + ok (!rc && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %ld, error %lu.\n", rc, GetLastError()); + sd = HeapAlloc (GetProcessHeap (), 0, sdSize); + rc = GetFileSecurityA (file, DACL_SECURITY_INFORMATION, sd, retSize, &retSize); + ok(rc, "got error %lu.\n", GetLastError()); + rc = GetSecurityDescriptorDacl(sd, &present, &dacl, &defaulted); + ok(rc, "got error %lu.\n", GetLastError()); + ok(present, "got %d.\n", present); + ok(!defaulted, "got %d.\n", defaulted); + rc = GetAclInformation(dacl, &acl_size, sizeof(acl_size), AclSizeInformation); + ok(rc, "got error %lu.\n", GetLastError()); + ok(acl_size.AceCount == 1, "got %lu.\n", acl_size.AceCount); + rc = GetAce(dacl, 0, (VOID **)&ace); + ok(rc, "got error %lu.\n", GetLastError()); + ok(EqualSid(&ace->SidStart, &owner_rights_sid), "Owner SIDs are not equal %s != %s\n", debugstr_sid(&ace->SidStart), debugstr_sid(&owner_rights_sid)); + CloseHandle(fh); + HeapFree (GetProcessHeap (), 0, sd); + } + cleanup: /* Remove temporary file and directory */ DeleteFileA(file); diff --git a/server/file.c b/server/file.c index 6da354af245..3d9bb46c590 100644 --- a/server/file.c +++ b/server/file.c @@ -620,7 +620,7 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner { bits_to_set &= ~((mode << 6) | (mode << 3)); /* user + group */ } - else if (equal_sid( sid, owner )) + else if (equal_sid( sid, owner ) || equal_sid( sid, &owner_rights_sid )) { bits_to_set &= ~(mode << 6); /* user only */ } @@ -639,7 +639,7 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner new_mode |= mode & bits_to_set; bits_to_set &= ~mode; } - else if (equal_sid( sid, owner )) + else if (equal_sid( sid, owner ) || equal_sid( sid, &owner_rights_sid )) { mode = (mode << 6); /* user only */ new_mode |= mode & bits_to_set; diff --git a/server/security.h b/server/security.h index 8bba8c59565..c202ebbe1cc 100644 --- a/server/security.h +++ b/server/security.h @@ -44,6 +44,7 @@ extern const struct luid SeManageVolumePrivilege; extern const struct luid SeImpersonatePrivilege; extern const struct luid SeCreateGlobalPrivilege; +extern const struct sid owner_rights_sid; extern const struct sid world_sid; extern struct sid local_user_sid; extern const struct sid local_system_sid; diff --git a/server/token.c b/server/token.c index ecb639ec636..ec2d7539262 100644 --- a/server/token.c +++ b/server/token.c @@ -74,6 +74,7 @@ struct sid_attrs unsigned int attrs; }; +const struct sid owner_rights_sid = { SID_REVISION, 1, SECURITY_CREATOR_SID_AUTHORITY, { SECURITY_CREATOR_OWNER_RIGHTS_RID } }; const struct sid world_sid = { SID_REVISION, 1, SECURITY_WORLD_SID_AUTHORITY, { SECURITY_WORLD_RID } }; const struct sid local_system_sid = { SID_REVISION, 1, SECURITY_NT_AUTHORITY, { SECURITY_LOCAL_SYSTEM_RID } }; const struct sid high_label_sid = { SID_REVISION, 1, SECURITY_MANDATORY_LABEL_AUTHORITY, { SECURITY_MANDATORY_HIGH_RID } }; From f5251417e0a6197e71639207b2f43de80274ad8a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 Dec 2023 19:10:07 -0600 Subject: [PATCH 1067/1506] msvcrt: Adjust _gmtime64_s() accepted time limits. CW-Bug-Id: #23111 --- dlls/msvcrt/tests/time.c | 57 ++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/time.c | 18 ++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index 4ed17c940a9..8986839122e 100644 --- a/dlls/msvcrt/tests/time.c +++ b/dlls/msvcrt/tests/time.c @@ -55,6 +55,8 @@ static __time32_t (__cdecl *p_mkgmtime32)(struct tm*); static struct tm* (__cdecl *p_gmtime32)(__time32_t*); static struct tm* (__cdecl *p_gmtime)(time_t*); static errno_t (__cdecl *p_gmtime32_s)(struct tm*, __time32_t*); +static struct tm* (__cdecl *p_gmtime64)(__time64_t*); +static errno_t (__cdecl *p_gmtime64_s)(struct tm*, __time64_t*); static errno_t (__cdecl *p_strtime_s)(char*,size_t); static errno_t (__cdecl *p_strdate_s)(char*,size_t); static errno_t (__cdecl *p_localtime32_s)(struct tm*, __time32_t*); @@ -76,6 +78,8 @@ static void init(void) p_gmtime32 = (void*)GetProcAddress(hmod, "_gmtime32"); p_gmtime = (void*)GetProcAddress(hmod, "gmtime"); p_gmtime32_s = (void*)GetProcAddress(hmod, "_gmtime32_s"); + p_gmtime64 = (void*)GetProcAddress(hmod, "_gmtime64"); + p_gmtime64_s = (void*)GetProcAddress(hmod, "_gmtime64_s"); p_mkgmtime32 = (void*)GetProcAddress(hmod, "_mkgmtime32"); p_strtime_s = (void*)GetProcAddress(hmod, "_strtime_s"); p_strdate_s = (void*)GetProcAddress(hmod, "_strdate_s"); @@ -208,6 +212,58 @@ static void test_gmtime(void) } } +static void test_gmtime64(void) +{ + struct tm *ptm, tm; + __time64_t t; + int ret; + + t = -1; + memset(&tm, 0xcc, sizeof(tm)); + ptm = p_gmtime64(&t); + ok(!!ptm, "got NULL.\n"); + ret = p_gmtime64_s(&tm, &t); + ok(!ret, "got %d.\n", ret); + ok(tm.tm_year == 69 && tm.tm_hour == 23 && tm.tm_min == 59 && tm.tm_sec == 59, "got %d, %d, %d, %d.\n", + tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); + + t = -43200; + memset(&tm, 0xcc, sizeof(tm)); + ptm = p_gmtime64(&t); + ok(!!ptm, "got NULL.\n"); + ret = p_gmtime64_s(&tm, &t); + ok(!ret, "got %d.\n", ret); + ok(tm.tm_year == 69 && tm.tm_hour == 12 && tm.tm_min == 0 && tm.tm_sec == 0, "got %d, %d, %d, %d.\n", + tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); + + t = -43201; + ptm = p_gmtime64(&t); + ok(!ptm, "got non-NULL.\n"); + memset(&tm, 0xcc, sizeof(tm)); + ret = p_gmtime64_s(&tm, &t); + ok(ret == EINVAL, "got %d.\n", ret); + ok(tm.tm_year == -1 && tm.tm_hour == -1 && tm.tm_min == -1 && tm.tm_sec == -1, "got %d, %d, %d, %d.\n", + tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); + + t = _MAX__TIME64_T + 46800; + memset(&tm, 0xcc, sizeof(tm)); + ptm = p_gmtime64(&t); + ok(!!ptm, "got NULL.\n"); + ret = p_gmtime64_s(&tm, &t); + ok(!ret, "got %d.\n", ret); + ok(tm.tm_year == 1101 && tm.tm_hour == 20 && tm.tm_min == 59 && tm.tm_sec == 59, "got %d, %d, %d, %d.\n", + tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); + + t = _MAX__TIME64_T + 46801; + ptm = p_gmtime64(&t); + ok(!ptm, "got non-NULL.\n"); + memset(&tm, 0xcc, sizeof(tm)); + ret = p_gmtime64_s(&tm, &t); + ok(ret == EINVAL, "got %d.\n", ret); + ok(tm.tm_year == -1 && tm.tm_hour == -1 && tm.tm_min == -1 && tm.tm_sec == -1, "got %d, %d, %d, %d.\n", + tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec); +} + static void test_mktime(void) { TIME_ZONE_INFORMATION tzinfo; @@ -963,6 +1019,7 @@ START_TEST(time) test_strftime(); test_ctime(); test_gmtime(); + test_gmtime64(); test_mktime(); test_localtime(); test_strdate(); diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 56b80e84105..cddcb521502 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -35,6 +35,7 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); +WINE_DECLARE_DEBUG_CHANNEL(time); #undef _ctime32 #undef _difftime32 @@ -457,7 +458,7 @@ int CDECL _gmtime64_s(struct tm *res, const __time64_t *secs) SYSTEMTIME st; ULONGLONG time; - if (!res || !secs || *secs < 0 || *secs > _MAX__TIME64_T) { + if (!res || !secs || *secs < -43200 || *secs > _MAX__TIME64_T + 46800) { if (res) { write_invalid_msvcrt_tm(res); } @@ -497,6 +498,8 @@ struct tm* CDECL _gmtime64(const __time64_t *secs) { thread_data_t * const data = msvcrt_get_thread_data(); + TRACE_(time)("secs %p, %I64d.\n", secs, secs ? *secs : 0); + if(!data->time_buffer) data->time_buffer = malloc(sizeof(struct tm)); @@ -513,6 +516,13 @@ int CDECL _gmtime32_s(struct tm *res, const __time32_t *secs) __time64_t secs64; if(secs) { + if (*secs < 0) + { + if (res) + write_invalid_msvcrt_tm(res); + *_errno() = EINVAL; + return EINVAL; + } secs64 = *secs; return _gmtime64_s(res, &secs64); } @@ -529,6 +539,12 @@ struct tm* CDECL _gmtime32(const __time32_t* secs) if(!secs) return NULL; + if (*secs < 0) + { + *_errno() = EINVAL; + return NULL; + } + secs64 = *secs; return _gmtime64( &secs64 ); } From 90412f313a8d6dce3d6b87dd727713d4d5e01515 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 22 Dec 2023 10:44:16 +0800 Subject: [PATCH 1068/1506] HACK: winegstreamer: Reduce Biomutant_Trailer.mp4 media source duration. Hack for bug 19766 - Biomutant (597820) [T5] Title Hangs After Intro Cut Scene Unless Skipped. Unreal Engine 4 games expect presentation clock correlated time to run past media source duration[1], which assumes that all streams in a media source have the same duration. Biomutant_Trailer.mp4 from Biomutant(597820) has a 1:27.734s video stream and a 1:27.776s audio stream so the media source duration is reported to be 1:27.776s. However, the game builds a topology that only uses the video stream. So the last presentation clock correlated time could be something before the media source duration 1:27.776s before it's stopped. In Unreal Engine 4.18 source, on every frame FWmfMediaSession::GetEvents()[2] checks "Time > CurrentDuration" to decide whether to stop its media session. With the time check fails, the game will hang forever waiting for the session to stop. This hack shortens the media source duration to satisfy the condition check. The reason why it works on Windows is probably due to a delay caused a busy CPU and different scheduling. [1][2]: UnrealEngine-4.18/Engine/Plugins/Media/WmfMedia/Source/WmfMedia/Private/Wmf/WmfMediaSession.cpp#FWmfMediaSession::GetEvents() CW-Bug-Id: #19766 --- dlls/winegstreamer/media_source.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 05cd260faab..ca8518ab3d0 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -1749,6 +1749,28 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->stream_count++; } + /* Hack for bug 19766 - Biomutant (597820) [T5] Title Hangs After Intro Cut Scene Unless Skipped. + * + * Unreal Engine 4 games expect presentation clock correlated time to run past media source + * duration[1], which assumes that all streams in a media source have the same duration. + * Biomutant_Trailer.mp4 from Biomutant(597820) has a 1:27.734s video stream and a 1:27.776s + * audio stream so the media source duration is reported to be 1:27.776s. However, the game + * builds a topology that only uses the video stream. So the last presentation clock correlated + * time could be something before the media source duration 1:27.776s before it's stopped. In + * Unreal Engine 4.18 source, on every frame FWmfMediaSession::GetEvents()[2] checks + * "Time > CurrentDuration" to decide whether to stop its media session. With the time check + * fails, the game will hang forever waiting for the session to stop. This hack shortens the + * media source duration to satisfy the condition check. The reason why it works on Windows is + * probably due to a delay caused a busy CPU and different scheduling. + * + * [1][2]: UnrealEngine-4.18/Engine/Plugins/Media/WmfMedia/Source/WmfMedia/Private/Wmf/WmfMediaSession.cpp#FWmfMediaSession::GetEvents() + */ + { + const char *id = getenv("SteamGameId"); + if (id && !strcmp(id, "597820") && object->duration == 877760000) /* Biomutant_Trailer.mp4 */ + object->duration = 877340000; + } + media_source_init_descriptors(object); object->state = SOURCE_STOPPED; From 27f03947563bf2d0936d9467abb2b33943a9d5eb Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Wed, 27 Dec 2023 20:20:22 +0000 Subject: [PATCH 1069/1506] gdiplus: Add GdipMeasureString hack for SpriteFontX. CW-Bug-Id: #23181 --- dlls/gdiplus/graphics.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 5101378d0e1..36ff473a6af 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5567,6 +5567,15 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, if(!graphics || !string || !font || !rect || !bounds) return InvalidParameter; + if (length == 1 && string[0] == '\n') + { + /* Proton hack for SpriteFontX class used by TouHou Makuka Sai. + * Returned size is passed to Bitmap constructor, but we currently measure "\n" as zero size. */ + char const *sgi = getenv("SteamGameId"); + if (sgi && (!strcmp(sgi, "882710") || !strcmp(sgi, "1031480"))) + string = L" "; + } + if(!graphics->hdc) { hdc = temp_hdc = CreateCompatibleDC(0); From 401dd10fe3d1a13cc7e0b96d31dc9cb7c8a7ffb0 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 18 Dec 2023 11:15:23 +0100 Subject: [PATCH 1070/1506] dbghelp: Change the order in which we try to load modules. Change from: dll.so > PE image > ELF/Mach-O image into PE image > dll.so > ELF/Mach-O image and only resychronizing ELF/Mach-O modules after PE image loading failed. This reduces quite a lot loading time for PE images (6/7ms => 1/2ms, local values, YMMV). CW-Bug-Id: https://www.codeweavers.com/support/bugs/browse/?cmd=bug_edit;bug_id=23138 (cherry picked from commit a347b5b62c5ecca96d5e649975ae7024ef2db21b) --- dlls/dbghelp/module.c | 47 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index f21733c7be9..644e92e9dc3 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -956,10 +956,12 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam } } - pcs->loader->synchronize_module_list(pcs); - /* this is a Wine extension to the API just to redo the synchronisation */ - if (!wImageName && !hFile) return 0; + if (!wImageName && !hFile) + { + pcs->loader->synchronize_module_list(pcs); + return 0; + } if (Flags & SLMFLAG_VIRTUAL) { @@ -968,27 +970,30 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam if (!module) return 0; module->module.SymType = SymVirtual; } - /* check if it's a builtin PE module with a containing ELF module */ - else if (wImageName && module_is_container_loaded(pcs, wImageName, BaseOfDll)) - { - /* force the loading of DLL as builtin */ - module = pe_load_builtin_module(pcs, wImageName, BaseOfDll, SizeOfDll); - } - if (!module) + else { - /* otherwise, try a regular PE module */ - if (!(module = pe_load_native_module(pcs, wImageName, hFile, BaseOfDll, SizeOfDll)) && - wImageName) + /* otherwise, try a regular PE image */ + module = pe_load_native_module(pcs, wImageName, hFile, BaseOfDll, SizeOfDll); + if (!module && wImageName) { - /* and finally an ELF or Mach-O module */ - module = pcs->loader->load_module(pcs, wImageName, BaseOfDll); + /* It could be either a dll.so file (for which we need the corresponding + * system module) or a system module. + * In both cases, ensure system module list is up-to-date. + */ + pcs->loader->synchronize_module_list(pcs); + /* try a dll.so... */ + if (module_is_container_loaded(pcs, wImageName, BaseOfDll)) + module = pe_load_builtin_module(pcs, wImageName, BaseOfDll, SizeOfDll); + /* at last, try ELF or Mach-O module */ + if (!module) + module = pcs->loader->load_module(pcs, wImageName, BaseOfDll); + } + if (!module) + { + WARN("Couldn't locate %s\n", debugstr_w(wImageName)); + SetLastError(ERROR_NO_MORE_FILES); + return 0; } - } - if (!module) - { - WARN("Couldn't locate %s\n", debugstr_w(wImageName)); - SetLastError(ERROR_NO_MORE_FILES); - return 0; } /* by default module_new fills module.ModuleName from a derivation * of LoadedImageName. Overwrite it, if we have better information From f53a4cc8ef8d465d6478d27172bcbf8a32eb7d37 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 8 Nov 2023 13:03:53 +0100 Subject: [PATCH 1071/1506] win32u: Increment display settings serial only after writing new settings to registry. Otherwise another process can update its display cache from the registry before the new settings have been written. Fix a regression from 43686b14. CW-Bug-Id: #22124 CW-Bug-Id: #23173 --- dlls/win32u/sysparams.c | 13 +++++++------ dlls/win32u/win32u_private.h | 2 +- dlls/win32u/winstation.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 84fc7418b62..d505bde85f3 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2037,7 +2037,7 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct return TRUE; } -BOOL update_display_cache( BOOL force ) +BOOL update_display_cache( BOOL force, BOOL increment_serial ) { static const WCHAR wine_service_station_name[] = {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n',0}; @@ -2084,6 +2084,9 @@ BOOL update_display_cache( BOOL force ) release_display_manager_ctx( &ctx ); if (!ret) WARN( "Failed to update display devices\n" ); + if (increment_serial && global_shared) + global_serial = InterlockedIncrement( (LONG *)&global_shared->display_settings_serial ); + if (!update_display_cache_from_registry()) { if (force) @@ -2098,7 +2101,7 @@ BOOL update_display_cache( BOOL force ) return FALSE; } - return update_display_cache( TRUE ); + return update_display_cache( TRUE, FALSE ); } InterlockedCompareExchange( (LONG *)&last_update_serial, global_serial, current_serial ); @@ -2107,7 +2110,7 @@ BOOL update_display_cache( BOOL force ) static BOOL lock_display_devices(void) { - if (!update_display_cache( FALSE )) return FALSE; + if (!update_display_cache( FALSE, FALSE )) return FALSE; pthread_mutex_lock( &display_lock ); return TRUE; } @@ -3180,7 +3183,6 @@ static BOOL all_detached_settings( const DEVMODEW *displays ) static LONG apply_display_settings( const WCHAR *devname, const DEVMODEW *devmode, HWND hwnd, DWORD flags, void *lparam ) { - volatile struct global_shared_memory *global_shared = get_global_shared_memory(); WCHAR primary_name[CCHDEVICENAME]; struct display_device *primary; DEVMODEW *mode, *displays; @@ -3228,8 +3230,7 @@ static LONG apply_display_settings( const WCHAR *devname, const DEVMODEW *devmod free( displays ); if (ret) return ret; - if (global_shared) InterlockedIncrement( (LONG *)&global_shared->display_settings_serial ); - if (!update_display_cache( TRUE )) + if (!update_display_cache( TRUE, TRUE )) WARN( "Failed to update display cache after mode change.\n" ); if ((adapter = find_adapter( NULL ))) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d0eb4a7acaf..a5d2a196932 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -191,7 +191,7 @@ extern RECT rect_thread_to_win_dpi( HWND hwnd, RECT rect ); extern HMONITOR monitor_from_point( POINT pt, UINT flags, UINT dpi ); extern HMONITOR monitor_from_rect( const RECT *rect, UINT flags, UINT dpi ); extern HMONITOR monitor_from_window( HWND hwnd, UINT flags, UINT dpi ); -extern BOOL update_display_cache( BOOL force ); +extern BOOL update_display_cache( BOOL force, BOOL increment_serial ); extern void user_lock(void); extern void user_unlock(void); extern void user_check_not_lock(void); diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 1bca929d157..2887e104c4a 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -184,7 +184,7 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *dev } /* force update display cache to use virtual desktop display settings */ - if (flags & DF_WINE_CREATE_DESKTOP) update_display_cache( TRUE ); + if (flags & DF_WINE_CREATE_DESKTOP) update_display_cache( TRUE, TRUE ); return ret; } @@ -262,7 +262,7 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ) struct user_thread_info *thread_info = get_user_thread_info(); thread_info->client_info.top_window = 0; thread_info->client_info.msg_window = 0; - if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( TRUE ); + if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( TRUE, TRUE ); if (thread_info->desktop_shm) { NtUnmapViewOfSection( GetCurrentProcess(), (void *)thread_info->desktop_shm ); From 837f509a87d2ee873b145883aaabcec6ff24015d Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 3 Jan 2024 15:21:10 +0800 Subject: [PATCH 1072/1506] fshack: winex11.drv: Correct top_left whole_window position in window_update_fshack(). top_left was in win32 virtual screen coordinates, and it needs to be converted to x11 root coordinates before using it for XMoveResizeWindow(). Otherwise, XMoveResizeWindow() can move a window to the wrong position when there are monitors left to the primary monitor. CW-Bug-Id: #23167 --- dlls/winex11.drv/window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 17f44982620..36185bb3db7 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3036,7 +3036,12 @@ static void window_update_fshack( struct x11drv_win_data *data, const RECT *wind if (data->whole_window) { POINT top_left = *(POINT *)&window_rect_host; + RECT real_virtual; + OffsetRect( &window_rect_host, -top_left.x, -top_left.y ); + real_virtual = fs_hack_get_real_virtual_screen(); + top_left.x -= real_virtual.left; + top_left.y -= real_virtual.top; if (set_hints) set_wm_hints( data ); From 4017840b9af7bbefb488e6f6c577e7a60182f09b Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 3 Jan 2024 15:13:37 +0800 Subject: [PATCH 1073/1506] winex11.drv: Translate whole_rect to x11 root coordinates in set_size_hints(). whole_rect is in win32 virtual screen coordinates. It needs to be converted to x11 root coordinates for XSetWMNormalHints(). CW-Bug-Id: #23167 --- dlls/winex11.drv/window.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 36185bb3db7..c385b22f592 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -830,8 +830,9 @@ static void set_size_hints( struct x11drv_win_data *data, DWORD style ) { if (data->hwnd != NtUserGetDesktopWindow()) /* don't force position of desktop */ { - size_hints->x = data->whole_rect.left; - size_hints->y = data->whole_rect.top; + POINT pt = virtual_screen_to_root( data->whole_rect.left, data->whole_rect.top ); + size_hints->x = pt.x; + size_hints->y = pt.y; size_hints->flags |= PPosition; } else size_hints->win_gravity = NorthWestGravity; From dbf46f4943db922f3cc82b5d9fb99395e2360bb4 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 3 Jan 2024 15:08:48 +0800 Subject: [PATCH 1074/1506] fshack: winex11.drv: Remove useless code. CW-Bug-Id: #23167 --- dlls/winex11.drv/fs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index b54594eda23..aaef17d9a06 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -531,8 +531,6 @@ static LONG fs_set_current_mode( x11drv_settings_id settings_id, const DEVMODEW static BOOL fs_get_gpus( struct gdi_gpu **gpus, int *count, BOOL get_properties ) { - struct list monitors = LIST_INIT( monitors ); - TRACE( "gpus %p, count %p\n", gpus, count ); if (!real_device_handler.get_gpus( gpus, count, get_properties )) return FALSE; From f2c545b0d7d5812980b1755d35db6e86d2b9e896 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 Jan 2024 10:42:29 -0600 Subject: [PATCH 1075/1506] ir50_32: HACK: Don't build dll. CW-Bug-Id: #23162 --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index 055e8646fcc..3decacab398 100644 --- a/configure.ac +++ b/configure.ac @@ -2788,7 +2788,6 @@ WINE_CONFIG_MAKEFILE(dlls/inseng) WINE_CONFIG_MAKEFILE(dlls/iphlpapi) WINE_CONFIG_MAKEFILE(dlls/iphlpapi/tests) WINE_CONFIG_MAKEFILE(dlls/iprop) -WINE_CONFIG_MAKEFILE(dlls/ir50_32) WINE_CONFIG_MAKEFILE(dlls/irprops.cpl) WINE_CONFIG_MAKEFILE(dlls/itircl) WINE_CONFIG_MAKEFILE(dlls/itss) From b72f2539e2a4533fab4712810a6bd7b0c9efdc65 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 11 Dec 2023 14:17:09 -0600 Subject: [PATCH 1076/1506] ntdll: HACK: Add 2g allocation limit option for FFX/X-2. CW-Bug-Id: #22930 --- dlls/ntdll/unix/loader.c | 4 ++++ dlls/ntdll/unix/unix_private.h | 1 + dlls/ntdll/unix/virtual.c | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index ee08c45f6f1..16e9324ff4a 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2022,6 +2022,7 @@ BOOL fsync_yield_to_waiters; BOOL no_priv_elevation; BOOL localsystem_sid; BOOL simulate_writecopy; +BOOL wine_allocs_2g_limit; SIZE_T kernel_stack_size = 0x100000; long long ram_reporting_bias; @@ -2104,6 +2105,9 @@ static void hacks_init(void) || !strcmp(sgi, "391150") /* Red Tie Runner */ || !strcmp(sgi, "2176450"); /* Mr. Hopp's Playhouse 3 */ + if (sgi) wine_allocs_2g_limit = !strcmp(sgi, "359870"); + if (wine_allocs_2g_limit) ERR("Allocation 2g limit enabled.\n"); + if (main_argc > 1 && strstr(main_argv[1], "MicrosoftEdgeUpdate.exe")) { ERR("HACK: reporting LocalSystem account SID.\n"); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index e14eb43dd0d..cf6b9ab0c53 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -189,6 +189,7 @@ extern BOOL no_priv_elevation; extern BOOL localsystem_sid; extern BOOL simulate_writecopy; extern long long ram_reporting_bias; +extern BOOL wine_allocs_2g_limit; extern void init_environment(void); extern void init_startup_info(void); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 3aa1bdf1d78..42f572e8479 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2095,6 +2095,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, int top_down = alloc_type & MEM_TOP_DOWN; void *ptr; NTSTATUS status; + const void *effective_user_space_limit = !is_win64 && wine_allocs_2g_limit ? (void *)0x7fff0000 : user_space_limit; if (alloc_type & MEM_REPLACE_PLACEHOLDER) { @@ -2131,7 +2132,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, } else { - limit_high = limit_high ? min( limit_high + 1, (UINT_PTR)user_space_limit) : (UINT_PTR)user_space_limit; + limit_high = limit_high ? min( limit_high + 1, (UINT_PTR)effective_user_space_limit) : (UINT_PTR)effective_user_space_limit; if (limit_low < (ULONG_PTR)address_space_start) limit_low = (ULONG_PTR)address_space_start; if (!align_mask) align_mask = granularity_mask; From 5b5ff8a2215bf2a1f404824e18c27ddf3f8dddb6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Jan 2024 13:51:47 -0600 Subject: [PATCH 1077/1506] amd_ags_x64: Add v4.0.0-v4.0.3 definitions. CW-Bug-Id: #23209 --- dlls/amd_ags_x64/amd_ags.h | 128 ++++++++++++++++++++++++++++++++++--- 1 file changed, 120 insertions(+), 8 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index aac9fb1413c..982452bc96e 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -303,7 +303,63 @@ typedef struct AGSRect int height; ///< Height of rectangle } AGSRect; +typedef struct AGSEyefinityInfo +{ + int iSLSActive; // Indicates if Eyefinity is active for the operating system display + // index passed into atiEyefinityGetConfigInfo(). 1 if enabled and 0 if disabled. + + int iSLSGridWidth; // Contains width of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + // For example, a 3 display wide by 2 high Eyefinity setup will return 3 for this entry. + int iSLSGridHeight; // Contains height of the multi-monitor grid that makes up the Eyefinity Single Large Surface. + // For example, a 3 display wide by 2 high Eyefinity setup will return 2 for this entry. + + int iSLSWidth; // Contains width in pixels of the multi-monitor Single Large Surface. The value returned is + // a function of the width of the SLS grid, of the horizontal resolution of each display, and + // of whether or not bezel compensation is enabled. + int iSLSHeight; // Contains height in pixels of the multi-monitor Single Large Surface. The value returned is + // a function of the height of the SLS grid, of the vertical resolution of each display, and + // of whether or not bezel compensation is enabled. + + int iBezelCompensatedDisplay; // Indicates if bezel compensation is used for the current SLS display area. + // 1 if enabled, and 0 if disabled. +} AGSEyefinityInfo; + /// The display info struct used to describe a display enumerated by AGS +typedef struct AGSDisplayInfo_403 +{ + int iGridXCoord; // Contains horizontal SLS grid coordinate of the display. The value is zero based with + // increasing values from left to right of the overall SLS grid. For example, the left-most + // display of a 3x2 Eyefinity setup will have the value 0, and the right-most will have + // the value 2. + int iGridYCoord; // Contains vertical SLS grid coordinate of the display. The value is zero based with + // increasing values from top to bottom of the overall SLS grid. For example, the top + // display of a 3x2 Eyefinity setup will have the value 0, and the bottom will have the + // value 1. + + AGSRect displayRect; // Contains the base offset and dimensions in pixels of the SLS rendering + // area associated with this display. If bezel compensation is enabled, this + // area will be larger than what the display can natively present to account + // for bezel area. If bezel compensation is disabled, this area will be equal + // to what the display can support natively. + + AGSRect displayRectVisible; // Contains the base offset and dimensions in pixels of the SLS rendering area + // associated with this display that is visible to the end user. If bezel + // compensation is enabled, this area will be equal to what the display can + // natively, but smaller that the area described in the displayRect entry. If + // bezel compensation is disabled, this area will be equal to what the display + // can support natively and equal to the area described in the displayRect entry. + // Developers wishing to place UI, HUD, or other game assets on a given display + // so that it is visible and accessible to end users need to locate them inside + // of the region defined by this rect. + + int iPreferredDisplay; // Indicates whether or not this display is the preferred one for rendering of + // game HUD and UI elements. Only one display out of the whole SLS grid will have + // this be true if it is the preferred display and 0 otherwise. Developers wishing + // to place specific UI, HUD, or other game assets on a given display so that it + // is visible and accessible to end users need to locate them inside of the region + // defined by this rect. +} AGSDisplayInfo_403; + typedef struct AGSDisplayInfo_511 { char name[ 256 ]; ///< The name of the display @@ -645,7 +701,20 @@ typedef void* (__stdcall *AGS_ALLOC_CALLBACK_511)( int allocationSize ); ///< typedef void* (__stdcall *AGS_ALLOC_CALLBACK)( size_t allocationSize ); ///< AGS user defined allocation prototype typedef void (__stdcall *AGS_FREE_CALLBACK)( void* allocationPtr ); ///< AGS user defined free prototype +/// The different modes to control Crossfire behavior. +typedef enum AGSCrossfireMode +{ + AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering. If this mode is specified, do NOT use the agsDriverExtensionsDX11_Create*() APIs to create resources + AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile + AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering +} AGSCrossfireMode; + /// The configuration options that can be passed in to \ref agsInititalize +struct AGSConfiguration_403 +{ + AGSCrossfireMode crossfireMode; // Desired Crossfire mode. See AGSCrossfireMode for more details +}; + typedef struct AGSConfiguration_511 { AGS_ALLOC_CALLBACK_511 allocCallback; ///< Optional memory allocation callback. If not supplied, malloc() is used @@ -664,7 +733,29 @@ typedef union AGSConfiguration AGSConfiguration_520 agsConfiguration520; } AGSConfiguration; + + /// The top level GPU information returned from \ref agsInitialize +struct AGSGPUInfo_403 +{ + int agsVersionMajor; // Major field of Major.Minor.Patch AGS version number + int agsVersionMinor; // Minor field of Major.Minor.Patch AGS version number + int agsVersionPatch; // Patch field of Major.Minor.Patch AGS version number + + ArchitectureVersion architectureVersion; // Set to Unknown if not AMD hardware + const char* adapterString; // The adapter name string. NULL if not AMD hardware + int deviceId; // The device id + int revisionId; // The revision id + + const char* driverVersion; // The driver package version + const char* radeonSoftwareVersion; // The Radeon Software Version + + int iNumCUs; // Number of GCN compute units. Zero if not GCN + int iCoreClock; // core clock speed at 100% power in MHz + int iMemoryClock; // memory clock speed at 100% power in MHz + float fTFlops; // Teraflops of GPU. Zero if not GCN. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD +}; + typedef struct AGSGPUInfo_511 { int agsVersionMajor; ///< Major field of Major.Minor.Patch AGS version number @@ -953,6 +1044,35 @@ typedef struct AGSDX12ReturnedParams } AGSDX12ReturnedParams; +// Description +// Function used to query Eyefinity configuration state information relevant to ISVs. State info returned +// includes: whether Eyefinity is enabled or not, SLS grid configuration, SLS dimensions, whether bezel +// compensation is enabled or not, SLS grid coordinate for each display, total rendering area for each +// display, visible rendering area for each display, and a preferred display flag. +// +// This function needs to be called twice. Firstly to null into eyefinityInfo and displaysInfo. This will +// return the number of AGSDisplayInfo objects to allocate. +// Second call requires valid pointers to eyefinityInfo and the newly allocated displaysInfo array. It is the +// responsibility of the caller to free this memory. +// +// +// Input params +// context - Pointer to a context. +// displayIndex - Operating system specific display index identifier. The value used should be the +// index of the display used for rendering operations. On Windows operating systems, +// the value can be queried using the EnumDisplayDevices() API. +// +// Output params +// eyefinityInfo - This is a pointer to an AGSEyefinityInfo structure that contains system Eyefinity +// configuration information. +// numDisplaysInfo - Pointer to the number of AGSDisplayInfo structures stored in the returned +// displaysInfo array. The value returned is equal to the number of displays +// used for the Eyefinity setup. +// displaysInfo - Pointer to an array of AGSDisplayInfo structures that contains per display +// Eyefinity configuration information. +// +AMD_AGS_API AGSReturnCode agsGetEyefinityConfigInfo( AGSContext *context, int displayIndex, AGSEyefinityInfo *eyefinityInfo, int *numDisplaysInfo, AGSDisplayInfo_403 *displaysInfo ); + /// /// Function used to create a D3D12 device with additional AMD-specific initialization parameters. /// @@ -1063,14 +1183,6 @@ AMD_AGS_API AGSReturnCode agsDriverExtensionsDX12_SetMarker( AGSContext* context /// The corresponding \ref agsDriverExtensionsDX11_DestroyDevice call must be called to release the device and free up the internal resources allocated by the create call. /// @{ -/// The different modes to control Crossfire behavior. -typedef enum AGSCrossfireMode -{ - AGS_CROSSFIRE_MODE_DRIVER_AFR = 0, ///< Use the default driver-based AFR rendering. If this mode is specified, do NOT use the agsDriverExtensionsDX11_Create*() APIs to create resources - AGS_CROSSFIRE_MODE_EXPLICIT_AFR, ///< Use the AGS Crossfire API functions to perform explicit AFR rendering without requiring a CF driver profile - AGS_CROSSFIRE_MODE_DISABLE ///< Completely disable AFR rendering -} AGSCrossfireMode; - /// The struct to specify the existing DX11 device creation parameters typedef struct AGSDX11DeviceCreationParams { From dd12b17d020e5e3d511e26f16f07828984e077a9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Jan 2024 15:28:35 -0600 Subject: [PATCH 1078/1506] amd_ags_x64: Support versions 4.0.0 - 4.0.3. CW-Bug-Id: #23209 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 95 ++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 22 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 9bd75ad000d..7f1c475e8cd 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -50,6 +50,7 @@ static const char radeon_version[] = "23.10.2"; enum amd_ags_version { + AMD_AGS_VERSION_4_0_3, AMD_AGS_VERSION_5_0_5, AMD_AGS_VERSION_5_1_1, AMD_AGS_VERSION_5_2_0, @@ -73,6 +74,7 @@ static const struct } amd_ags_info[AMD_AGS_VERSION_COUNT] = { + {AGS_MAKE_VERSION(4, 0, 0), AGS_MAKE_VERSION(4, 0, 3), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 0, 0), AGS_MAKE_VERSION(5, 0, 6), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 1, 1), AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 2, 0), AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, @@ -84,26 +86,29 @@ amd_ags_info[AMD_AGS_VERSION_COUNT] = {AGS_MAKE_VERSION(6, 1, 0), AGS_MAKE_VERSION(6, 2, 0), sizeof(AGSDeviceInfo_600), sizeof(AGSDX11ReturnedParams_600), AsicFamily_RDNA3}, }; -#define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), \ + offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} -#define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD_520_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), \ + offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), -1, \ -1, -1, -1, -1}} -#define DEF_FIELD_520_UP(name) {DEVICE_FIELD_##name, {-1, -1, offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD_520_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} -#define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ +#define DEF_FIELD_540_UP(name) {DEVICE_FIELD_##name, {-1, -1, -1, -1, \ -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ offsetof(AGSDeviceInfo_600, name), offsetof(AGSDeviceInfo_600, name)}} -#define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, -1, \ +#define DEF_FIELD_540_600(name) {DEVICE_FIELD_##name, {-1, -1, -1, -1, \ -1, offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ -1, -1}} -#define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ +#define DEF_FIELD_600_BELOW(name) {DEVICE_FIELD_##name, {offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_511, name), \ + offsetof(AGSDeviceInfo_511, name), offsetof(AGSDeviceInfo_520, name), \ offsetof(AGSDeviceInfo_520, name), offsetof(AGSDeviceInfo_540, name), \ offsetof(AGSDeviceInfo_541, name), offsetof(AGSDeviceInfo_542, name), \ -1, -1}} @@ -366,6 +371,12 @@ static enum amd_ags_version guess_version_from_exports(HMODULE hnative) * - CoD: Modern Warfare Remastered (2017) ships dll without version info which is version 5.0.1 * (not tagged in AGSSDK history), compatible with 5.0.5. */ + if (GetProcAddress(hnative, "agsGetEyefinityConfigInfo")) + { + /* agsGetEyefinityConfigInfo was deprecated in 5.0.0 */ + TRACE("agsGetEyefinityConfigInfo found.\n"); + return AMD_AGS_VERSION_4_0_3; + } if (GetProcAddress(hnative, "agsDriverExtensionsDX11_Init")) { /* agsDriverExtensionsDX11_Init was deprecated in 5.3.0 */ @@ -818,14 +829,54 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi return ret; } - memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); - gpu_info->agsVersionMinor = AGS_VER_MINOR(object->public_version); - gpu_info->agsVersionPatch = AGS_VER_PATCH(object->public_version); - gpu_info->driverVersion = driver_version; - gpu_info->radeonSoftwareVersion = radeon_version; - gpu_info->numDevices = object->device_count; - gpu_info->devices = object->devices; + if (object->version <= AMD_AGS_VERSION_4_0_3) + { + struct AGSDeviceInfo_511 *devices = (struct AGSDeviceInfo_511 *)object->devices, *device; + struct AGSGPUInfo_403 *info = (struct AGSGPUInfo_403 *)gpu_info; + unsigned int i; + + if (!object->device_count) + { + ERR("No devices.\n"); + agsDeInit(object); + return AGS_FAILURE; + } + + for (i = 0; i < object->device_count; ++i) + if (devices[i].isPrimaryDevice) + break; + if (i == object->device_count) + { + WARN("No primary device, using first.\n"); + i = 0; + } + device = &devices[i]; + memset(info, 0, sizeof(*info)); + info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); + info->agsVersionMinor = AGS_VER_MINOR(object->public_version); + info->agsVersionPatch = AGS_VER_PATCH(object->public_version); + info->architectureVersion = device->architectureVersion; + info->adapterString = device->adapterString; + info->deviceId = device->deviceId; + info->revisionId = device->revisionId; + info->driverVersion = driver_version; + info->radeonSoftwareVersion = radeon_version; + info->iNumCUs = device->numCUs; + info->iCoreClock = device->coreClock; + info->iMemoryClock = device->memoryClock; + info->fTFlops = device->teraFlops; + } + else + { + memset(gpu_info, 0, sizeof(*gpu_info)); + gpu_info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); + gpu_info->agsVersionMinor = AGS_VER_MINOR(object->public_version); + gpu_info->agsVersionPatch = AGS_VER_PATCH(object->public_version); + gpu_info->driverVersion = driver_version; + gpu_info->radeonSoftwareVersion = radeon_version; + gpu_info->numDevices = object->device_count; + gpu_info->devices = object->devices; + } TRACE("Created context %p.\n", object); @@ -1281,10 +1332,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDepthBounds_530(AGSContext* cont return set_depth_bounds(context, dx_context, enabled, min_depth, max_depth); } -C_ASSERT(AMD_AGS_VERSION_5_3_0 == 3); +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); __ASM_GLOBAL_FUNC( DX11_SetDepthBounds_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $3,%eax\n\t" + "cmp $4,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_SetDepthBounds_530") ) @@ -1333,10 +1384,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_BeginUAVOverlap(AGSContext *context return update_uav_overlap(context, dx_context, TRUE); } -C_ASSERT(AMD_AGS_VERSION_5_3_0 == 3); +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); __ASM_GLOBAL_FUNC( DX11_BeginUAVOverlap_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $3,%eax\n\t" + "cmp $4,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_BeginUAVOverlap") ) @@ -1367,10 +1418,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_EndUAVOverlap(AGSContext *context, return update_uav_overlap(context, dx_context, FALSE); } -C_ASSERT(AMD_AGS_VERSION_5_3_0 == 3); +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); __ASM_GLOBAL_FUNC( DX11_EndUAVOverlap_impl, "mov (%rcx),%eax\n\t" /* version */ - "cmp $3,%eax\n\t" + "cmp $4,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap") ) @@ -1414,10 +1465,10 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_511(AGSContext *conte return agsDriverExtensionsDX11_DestroyDevice_520(context, device, references, NULL, NULL); } -C_ASSERT(AMD_AGS_VERSION_5_2_0 == 2); +C_ASSERT(AMD_AGS_VERSION_5_2_0 == 3); __ASM_GLOBAL_FUNC( agsDriverExtensionsDX11_DestroyDevice, "mov (%rcx),%eax\n\t" /* version */ - "cmp $2,%eax\n\t" + "cmp $3,%eax\n\t" "jge 1f\n\t" "jmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_511") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_520") ) From 02ab22673dd6717d08991af10e63c19c9b4362ba Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Jan 2024 15:30:27 -0600 Subject: [PATCH 1079/1506] amd_ags_x64: Implement agsGetTotalGPUCount(). CW-Bug-Id: #23209 --- dlls/amd_ags_x64/amd_ags.h | 14 ++++++++++++++ dlls/amd_ags_x64/amd_ags_x64.spec | 1 + dlls/amd_ags_x64/amd_ags_x64_main.c | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 982452bc96e..848c90273a9 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -1044,6 +1044,20 @@ typedef struct AGSDX12ReturnedParams } AGSDX12ReturnedParams; +// Description +// Function used to query the number of GPUs in the system. +// This number may be different from agsGetCrossfireGPUCount as it reports +// all devices installed in the system, and not only those configured for +// Crossfire. +// +// Input params +// context - Pointer to a context. +// +// Output params +// numGPUs - Number of GPUs in the system. +// +AMD_AGS_API AGSReturnCode agsGetTotalGPUCount( AGSContext* context, int* numGPUs ); + // Description // Function used to query Eyefinity configuration state information relevant to ISVs. State info returned // includes: whether Eyefinity is enabled or not, SLS grid configuration, SLS dimensions, whether bezel diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index d8126fa961a..b21762488fb 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -43,3 +43,4 @@ @ stdcall agsInit(ptr ptr ptr) @ stdcall agsInitialize(long ptr ptr ptr) @ stdcall agsSetDisplayMode(ptr long long ptr) +@ stdcall agsGetTotalGPUCount(ptr ptr) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 7f1c475e8cd..e6be609f1c3 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -954,6 +954,14 @@ AGSReturnCode WINAPI agsDeInitialize(AGSContext *context) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsGetTotalGPUCount(AGSContext *context, int *numGPUs) +{ + TRACE("context %p, numGPUs %p.\n", context, numGPUs); + + *numGPUs = context->device_count; + return AGS_SUCCESS; +} + static DXGI_COLOR_SPACE_TYPE convert_ags_colorspace_506(AGSDisplaySettings_Mode_506 mode) { switch (mode) From 4aa3569271a9abd22c03cfce2a27b34307daf2ca Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Jan 2024 15:35:46 -0600 Subject: [PATCH 1080/1506] amd_ags_x64: Implement agsGetGPUMemorySize(). CW-Bug-Id: #23209 --- dlls/amd_ags_x64/amd_ags.h | 13 +++++++++++++ dlls/amd_ags_x64/amd_ags_x64.spec | 1 + dlls/amd_ags_x64/amd_ags_x64_main.c | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 848c90273a9..8eab0732d5b 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -1058,6 +1058,19 @@ typedef struct AGSDX12ReturnedParams // AMD_AGS_API AGSReturnCode agsGetTotalGPUCount( AGSContext* context, int* numGPUs ); +// Description +// Function used to query the memory size of a GPU. The number of GPUs should +// be obtained using agsGetTotalGPUCount +// +// Input params +// context - Pointer to a context. +// gpuIndex - The GPU index to query +// +// Output params +// sizeInBytes - Memory size on the device in bytes +// +AMD_AGS_API AGSReturnCode agsGetGPUMemorySize( AGSContext* context, int gpuIndex, long long* sizeInBytes ); + // Description // Function used to query Eyefinity configuration state information relevant to ISVs. State info returned // includes: whether Eyefinity is enabled or not, SLS grid configuration, SLS dimensions, whether bezel diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index b21762488fb..5487fc78441 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -44,3 +44,4 @@ @ stdcall agsInitialize(long ptr ptr ptr) @ stdcall agsSetDisplayMode(ptr long long ptr) @ stdcall agsGetTotalGPUCount(ptr ptr) +@ stdcall agsGetGPUMemorySize(ptr long ptr) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index e6be609f1c3..3f827129167 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -962,6 +962,19 @@ AGSReturnCode WINAPI agsGetTotalGPUCount(AGSContext *context, int *numGPUs) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsGetGPUMemorySize( AGSContext *context, int gpuIndex, long long *sizeInBytes ) +{ + struct AGSDeviceInfo_511 *device = &((struct AGSDeviceInfo_511 *)context->devices)[gpuIndex]; + + TRACE("context %p, gpuIndex %d, sizeInBytes %p.\n", context, gpuIndex, sizeInBytes); + + if ((unsigned)gpuIndex >= context->device_count) + return AGS_INVALID_ARGS; + + *sizeInBytes = device->localMemoryInBytes; + return AGS_SUCCESS; +} + static DXGI_COLOR_SPACE_TYPE convert_ags_colorspace_506(AGSDisplaySettings_Mode_506 mode) { switch (mode) From 52a5a371a2915f515979826aadc30d8324db9381 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Jan 2024 16:16:03 -0600 Subject: [PATCH 1081/1506] amd_ags_x64: Implement agsGetEyefinityConfigInfo(). CW-Bug-Id: #23209 --- dlls/amd_ags_x64/amd_ags_x64.spec | 1 + dlls/amd_ags_x64/amd_ags_x64_main.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 5487fc78441..b808403f800 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -45,3 +45,4 @@ @ stdcall agsSetDisplayMode(ptr long long ptr) @ stdcall agsGetTotalGPUCount(ptr ptr) @ stdcall agsGetGPUMemorySize(ptr long ptr) +@ stdcall agsGetEyefinityConfigInfo(ptr long ptr ptr ptr) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 3f827129167..9e50337626f 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -975,6 +975,30 @@ AGSReturnCode WINAPI agsGetGPUMemorySize( AGSContext *context, int gpuIndex, lon return AGS_SUCCESS; } +AGSReturnCode WINAPI agsGetEyefinityConfigInfo( AGSContext *context, int displayIndex, AGSEyefinityInfo *eyefinityInfo, + int *numDisplaysInfo, AGSDisplayInfo_403 *displaysInfo ) +{ + struct AGSDeviceInfo_511 *devices; + unsigned int i; + + TRACE("context %p, displayIndex %d, eyefinityInfo %p, numDisplaysInfo %p, displaysInfo %p\n", + context, displayIndex, eyefinityInfo, numDisplaysInfo, displaysInfo); + + devices = (struct AGSDeviceInfo_511 *)context->devices; + *numDisplaysInfo = 0; + for (i = 0; i < context->device_count; ++i) + *numDisplaysInfo += devices[i].numDisplays; + + if (!eyefinityInfo || !displaysInfo) + return AGS_SUCCESS; + + /* displaysInfo is not filled in on Windows if Eyefinity is not enabled. */ + memset(eyefinityInfo, 0, sizeof(*eyefinityInfo)); + memset(displaysInfo, 0, *numDisplaysInfo * sizeof(*displaysInfo)); + + return AGS_SUCCESS; +} + static DXGI_COLOR_SPACE_TYPE convert_ags_colorspace_506(AGSDisplaySettings_Mode_506 mode) { switch (mode) From 80e8e119e2a42af4a13d8bac6f7704443313cb2d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Jan 2024 21:05:35 -0600 Subject: [PATCH 1082/1506] explorer: Don't pop start menu on "minimize all windows" systray command. CW-Bug-Id: #23178 --- programs/explorer/systray.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index b012d3ffe72..bdd9f80a6f3 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -1059,7 +1059,15 @@ static LRESULT WINAPI shell_traywnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LP break; case WM_COMMAND: - if (HIWORD(wparam) == BN_CLICKED) click_taskbar_button( (HWND)lparam ); + if (HIWORD(wparam) == BN_CLICKED) + { + if (LOWORD(wparam) == 419) + { + FIXME( "Minimize all windows command is not supported.\n" ); + break; + } + click_taskbar_button( (HWND)lparam ); + } break; case WM_CONTEXTMENU: From eda34f74c6ad1abc61b2c5679d6fb366f640d9df Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 9 Jan 2024 11:31:50 +0000 Subject: [PATCH 1083/1506] winegstreamer: create media source from uri Supported by gstreamer's uridecodebin. Link: https://github.com/ValveSoftware/wine/pull/142 CW-Bug-Id: #20485 CW-Bug-Id: #23217 --- dlls/winegstreamer/gst_private.h | 2 +- dlls/winegstreamer/main.c | 3 ++- dlls/winegstreamer/media_source.c | 10 ++++---- dlls/winegstreamer/quartz_parser.c | 2 +- dlls/winegstreamer/unixlib.h | 2 ++ dlls/winegstreamer/wg_parser.c | 37 ++++++++++++++++++++++++++++++ dlls/winegstreamer/wm_reader.c | 4 ++-- 7 files changed, 51 insertions(+), 9 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 811f04b9539..1ff9b287d21 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -73,7 +73,7 @@ void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all); wg_parser_t wg_parser_create(enum wg_parser_type type, bool output_compressed, bool use_opengl); void wg_parser_destroy(wg_parser_t parser); -HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size); +HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size, const WCHAR *uri); void wg_parser_disconnect(wg_parser_t parser); bool wg_parser_get_next_read_offset(wg_parser_t parser, uint64_t *offset, uint32_t *size); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index c39f216daa5..bc6111abe2a 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -94,12 +94,13 @@ void wg_parser_destroy(wg_parser_t parser) WINE_UNIX_CALL(unix_wg_parser_destroy, &parser); } -HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size) +HRESULT wg_parser_connect(wg_parser_t parser, uint64_t file_size, const WCHAR *uri) { struct wg_parser_connect_params params = { .parser = parser, .file_size = file_size, + .uri = uri, }; TRACE("parser %#I64x, file_size %I64u.\n", parser, file_size); diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index ca8518ab3d0..a39293c8f9d 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -36,6 +36,7 @@ struct object_context IMFByteStream *stream; UINT64 file_size; WCHAR *url; + enum wg_parser_type type; }; static struct object_context *impl_from_IUnknown(IUnknown *iface) @@ -95,7 +96,7 @@ static const IUnknownVtbl object_context_vtbl = }; static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const WCHAR *url, - QWORD file_size, IMFAsyncResult *result, IUnknown **out) + QWORD file_size, IMFAsyncResult *result, enum wg_parser_type type, IUnknown **out) { WCHAR *tmp_url = url ? wcsdup(url) : NULL; struct object_context *context; @@ -113,6 +114,7 @@ static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const W context->file_size = file_size; context->url = tmp_url; context->result = result; + context->type = type; IMFAsyncResult_AddRef(context->result); *out = &context->IUnknown_iface; @@ -1703,7 +1705,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue))) goto fail; - if (!(parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE, FALSE))) + if (!(parser = wg_parser_create(context->type, FALSE, FALSE))) { hr = E_OUTOFMEMORY; goto fail; @@ -1714,7 +1716,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->state = SOURCE_OPENING; - if (FAILED(hr = wg_parser_connect(parser, object->file_size))) + if (FAILED(hr = wg_parser_connect(parser, object->file_size, context->url))) goto fail; stream_count = wg_parser_get_stream_count(parser); @@ -1965,7 +1967,7 @@ static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *ifa if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &result))) return hr; - if (FAILED(hr = object_context_create(flags, stream, url, file_size, result, &context))) + if (FAILED(hr = object_context_create(flags, stream, url, file_size, result, WG_PARSER_DECODEBIN, &context))) { IMFAsyncResult_Release(result); return hr; diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 42ddb551575..dcd29d1c9fd 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -1545,7 +1545,7 @@ static HRESULT parser_sink_connect(struct strmbase_sink *iface, IPin *peer, cons filter->sink_connected = true; filter->read_thread = CreateThread(NULL, 0, read_thread, filter, 0, NULL); - if (FAILED(hr = wg_parser_connect(filter->wg_parser, file_size))) + if (FAILED(hr = wg_parser_connect(filter->wg_parser, file_size, NULL))) goto err; if (!filter->init_gst(filter)) diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 4b15168ae62..2045f3b65ff 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -213,6 +213,7 @@ enum wg_parser_type WG_PARSER_DECODEBIN, WG_PARSER_AVIDEMUX, WG_PARSER_WAVPARSE, + WG_PARSER_URIDECODEBIN, }; typedef UINT64 wg_parser_t; @@ -233,6 +234,7 @@ struct wg_parser_create_params struct wg_parser_connect_params { wg_parser_t parser; + const WCHAR *uri; UINT64 file_size; }; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 5eb2f174a5a..7326cbc27cb 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -77,6 +77,7 @@ struct wg_parser guint64 file_size, start_offset, next_offset, stop_offset; guint64 next_pull_offset; + gchar *uri; pthread_t push_thread; @@ -1771,6 +1772,7 @@ static NTSTATUS wg_parser_connect(void *args) GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); const struct wg_parser_connect_params *params = args; struct wg_parser *parser = get_parser(params->parser); + const WCHAR *uri = params->uri; unsigned int i; int ret; @@ -1778,6 +1780,15 @@ static NTSTATUS wg_parser_connect(void *args) parser->file_size = params->file_size; parser->sink_connected = true; + if (uri) + { + parser->uri = malloc(wcslen(uri) * 3 + 1); + ntdll_wcstoumbs(uri, wcslen(uri) + 1, parser->uri, wcslen(uri) * 3 + 1, FALSE); + } + else + { + parser->uri = NULL; + } if (!parser->bus) { @@ -2030,6 +2041,30 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) return TRUE; } +static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) +{ + GstElement *element; + + if (!(element = create_element("uridecodebin", "base"))) + return FALSE; + + gst_bin_add(GST_BIN(parser->container), element); + parser->decodebin = element; + + g_object_set(parser->decodebin, "uri", parser->uri, NULL); + g_signal_connect(element, "pad-added", G_CALLBACK(pad_added_cb), parser); + g_signal_connect(element, "pad-removed", G_CALLBACK(pad_removed_cb), parser); + g_signal_connect(element, "autoplug-select", G_CALLBACK(autoplug_select_cb), parser); + g_signal_connect(element, "autoplug-sort", G_CALLBACK(autoplug_sort_cb), parser); + g_signal_connect(element, "no-more-pads", G_CALLBACK(no_more_pads_cb), parser); + + pthread_mutex_lock(&parser->mutex); + parser->no_more_pads = false; + pthread_mutex_unlock(&parser->mutex); + + return TRUE; +} + static BOOL avi_parser_init_gst(struct wg_parser *parser) { GstElement *element; @@ -2085,6 +2120,7 @@ static NTSTATUS wg_parser_create(void *args) [WG_PARSER_DECODEBIN] = decodebin_parser_init_gst, [WG_PARSER_AVIDEMUX] = avi_parser_init_gst, [WG_PARSER_WAVPARSE] = wave_parser_init_gst, + [WG_PARSER_URIDECODEBIN] = uridecodebin_parser_init_gst, }; struct wg_parser_create_params *params = args; @@ -2134,6 +2170,7 @@ static NTSTATUS wg_parser_destroy(void *args) pthread_cond_destroy(&parser->read_cond); pthread_cond_destroy(&parser->read_done_cond); + free(parser->uri); free(parser); return S_OK; } diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index f4aef699bbf..ffb78f3cbc9 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1467,7 +1467,7 @@ static HRESULT init_stream(struct wm_reader *reader) goto out_destroy_parser; } - if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size))) + if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size, NULL))) { ERR("Failed to connect parser, hr %#lx.\n", hr); goto out_shutdown_thread; @@ -1584,7 +1584,7 @@ static HRESULT reinit_stream(struct wm_reader *reader, bool read_compressed) goto out_destroy_parser; } - if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size))) + if (FAILED(hr = wg_parser_connect(reader->wg_parser, reader->file_size, NULL))) { ERR("Failed to connect parser, hr %#lx.\n", hr); goto out_shutdown_thread; From ee0740810a1032f4acab97799b2401935a3b8a37 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 17 Apr 2022 16:56:50 +0100 Subject: [PATCH 1084/1506] winegstreamer: add http/https/rtsp scheme handler This overrides Urlmon based scheme handlers. The urlmon scheme handlers only support playback of the media after it has been fully downloaded from the internet, and has no streaming support. This is undesirable for games like VRChat. Link: https://github.com/ValveSoftware/wine/pull/142 CW-Bug-Id: #20485 CW-Bug-Id: #23217 --- dlls/mf/mf.rgs | 8 - dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/media_source.c | 262 +++++++++++++++++++ dlls/winegstreamer/mfplat.c | 3 + dlls/winegstreamer/winegstreamer.rgs | 28 ++ dlls/winegstreamer/winegstreamer_classes.idl | 7 + 6 files changed, 301 insertions(+), 8 deletions(-) diff --git a/dlls/mf/mf.rgs b/dlls/mf/mf.rgs index f06576baccb..f127df76321 100644 --- a/dlls/mf/mf.rgs +++ b/dlls/mf/mf.rgs @@ -12,14 +12,6 @@ HKLM { val '{477ec299-1421-4bdd-971f-7ccb933f21ad}' = s 'File Scheme Handler' } - 'http:' - { - val '{9ec4b4f9-3029-45ad-947b-344de2a249e2}' = s 'Urlmon Scheme Handler' - } - 'https:' - { - val '{9ec4b4f9-3029-45ad-947b-344de2a249e2}' = s 'Urlmon Scheme Handler' - } } } } diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 1ff9b287d21..8bc50d6cd99 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -174,6 +174,7 @@ bool wg_video_format_is_rgb(enum wg_video_format format); HRESULT aac_decoder_create(REFIID riid, void **ret); HRESULT h264_decoder_create(REFIID riid, void **ret); HRESULT video_processor_create(REFIID riid, void **ret); +HRESULT gstreamer_scheme_handler_create(REFIID riid, void **ret); extern const GUID MFAudioFormat_RAW_AAC; diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index a39293c8f9d..a0fe52f1604 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -2139,3 +2139,265 @@ HRESULT gstreamer_byte_stream_handler_create(REFIID riid, void **obj) return hr; } + +struct scheme_handler +{ + IMFSchemeHandler IMFSchemeHandler_iface; + IMFAsyncCallback IMFAsyncCallback_iface; + LONG refcount; + struct list results; + CRITICAL_SECTION cs; +}; + +static struct scheme_handler *impl_from_IMFSchemeHandler(IMFSchemeHandler *iface) +{ + return CONTAINING_RECORD(iface, struct scheme_handler, IMFSchemeHandler_iface); +} + +static struct scheme_handler *scheme_handler_from_IMFAsyncCallback(IMFAsyncCallback *iface) +{ + return CONTAINING_RECORD(iface, struct scheme_handler, IMFAsyncCallback_iface); +} + +static struct result_entry *scheme_handler_find_result_entry(struct scheme_handler *handler, IMFAsyncResult *result) +{ + struct result_entry *entry; + + EnterCriticalSection(&handler->cs); + LIST_FOR_EACH_ENTRY(entry, &handler->results, struct result_entry, entry) + { + if (result == entry->result) + { + list_remove(&entry->entry); + LeaveCriticalSection(&handler->cs); + return entry; + } + } + LeaveCriticalSection(&handler->cs); + + return NULL; +} + + +static HRESULT WINAPI scheme_handler_QueryIntace(IMFSchemeHandler *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFSchemeHandler) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFSchemeHandler_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI scheme_handler_AddRef(IMFSchemeHandler *iface) +{ + struct scheme_handler *handler = impl_from_IMFSchemeHandler(iface); + ULONG refcount = InterlockedIncrement(&handler->refcount); + + TRACE("%p, refcount %lu.\n", handler, refcount); + + return refcount; +} + +static ULONG WINAPI scheme_handler_Release(IMFSchemeHandler *iface) +{ + struct scheme_handler *handler = impl_from_IMFSchemeHandler(iface); + ULONG refcount = InterlockedDecrement(&handler->refcount); + struct result_entry *result, *next; + + TRACE("%p, refcount %lu.\n", iface, refcount); + + if (!refcount) + { + LIST_FOR_EACH_ENTRY_SAFE(result, next, &handler->results, struct result_entry, entry) + result_entry_destroy(result); + DeleteCriticalSection(&handler->cs); + free(handler); + } + + return refcount; +} + +static HRESULT WINAPI scheme_handler_BeginCreateObject(IMFSchemeHandler *iface, const WCHAR *url, DWORD flags, + IPropertyStore *props, IUnknown **cancel_cookie, IMFAsyncCallback *callback, IUnknown *state) +{ + struct scheme_handler *handler = impl_from_IMFSchemeHandler(iface); + IMFByteStream *bytestream; + IMFAsyncResult *result; + IUnknown *context; + IStream *stream; + HRESULT hr; + + TRACE("%p, %s, %#lx, %p, %p, %p, %p.\n", iface, debugstr_w(url), flags, props, cancel_cookie, callback, state); + + if (cancel_cookie) + *cancel_cookie = NULL; + + if (FAILED(hr = CreateStreamOnHGlobal(0, TRUE, &stream))) + return hr; + + hr = MFCreateMFByteStreamOnStream(stream, &bytestream); + IStream_Release(stream); + if (FAILED(hr)) + return hr; + + if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &result))) + return hr; + if (FAILED(hr = object_context_create(flags, bytestream, url, 0, result, WG_PARSER_URIDECODEBIN, &context))) + { + IMFAsyncResult_Release(result); + return hr; + } + + hr = MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_IO, &handler->IMFAsyncCallback_iface, context); + IUnknown_Release(context); + IMFAsyncResult_Release(result); + + return hr; +} + +static HRESULT WINAPI scheme_handler_EndCreateObject(IMFSchemeHandler *iface, IMFAsyncResult *result, + MF_OBJECT_TYPE *obj_type, IUnknown **object) +{ + struct scheme_handler *handler = impl_from_IMFSchemeHandler(iface); + struct result_entry *entry; + HRESULT hr; + + TRACE("%p, %p, %p, %p.\n", iface, result, obj_type, object); + + if (!(entry = scheme_handler_find_result_entry(handler, result))) + { + *obj_type = MF_OBJECT_INVALID; + *object = NULL; + return MF_E_UNEXPECTED; + } + + hr = IMFAsyncResult_GetStatus(entry->result); + *obj_type = MF_OBJECT_MEDIASOURCE; + *object = entry->object; + IUnknown_AddRef(*object); + result_entry_destroy(entry); + + return hr; +} + +static HRESULT WINAPI scheme_handler_CancelObjectCreation(IMFSchemeHandler *iface, IUnknown *cancel_cookie) +{ + /* Cancellation is not supported. */ + TRACE("%p, %p.\n", iface, cancel_cookie); + return MF_E_UNEXPECTED; +} + +static const IMFSchemeHandlerVtbl scheme_handler_vtbl = +{ + scheme_handler_QueryIntace, + scheme_handler_AddRef, + scheme_handler_Release, + scheme_handler_BeginCreateObject, + scheme_handler_EndCreateObject, + scheme_handler_CancelObjectCreation, +}; + +static HRESULT WINAPI scheme_handler_callback_QueryInterface(IMFAsyncCallback *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IMFAsyncCallback) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFAsyncCallback_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI scheme_handler_callback_AddRef(IMFAsyncCallback *iface) +{ + struct scheme_handler *handler = scheme_handler_from_IMFAsyncCallback(iface); + return IMFSchemeHandler_AddRef(&handler->IMFSchemeHandler_iface); +} + +static ULONG WINAPI scheme_handler_callback_Release(IMFAsyncCallback *iface) +{ + struct scheme_handler *handler = scheme_handler_from_IMFAsyncCallback(iface); + return IMFSchemeHandler_Release(&handler->IMFSchemeHandler_iface); +} + +static HRESULT WINAPI scheme_handler_callback_GetParameters(IMFAsyncCallback *iface, DWORD *flags, DWORD *queue) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI scheme_handler_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) +{ + struct scheme_handler *handler = scheme_handler_from_IMFAsyncCallback(iface); + IUnknown *object, *state = IMFAsyncResult_GetStateNoAddRef(result); + struct object_context *context; + struct result_entry *entry; + HRESULT hr; + + if (!state || !(context = impl_from_IUnknown(state))) + return E_INVALIDARG; + + if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) + WARN("Failed to create media source, hr %#lx\n", hr); + else + { + if (FAILED(hr = result_entry_create(context->result, MF_OBJECT_MEDIASOURCE, object, &entry))) + WARN("Failed to create handler result, hr %#lx\n", hr); + else + { + EnterCriticalSection(&handler->cs); + list_add_tail(&handler->results, &entry->entry); + LeaveCriticalSection(&handler->cs); + } + + IUnknown_Release(object); + } + + IMFAsyncResult_SetStatus(context->result, hr); + MFInvokeCallback(context->result); + + return S_OK; +} + +static const IMFAsyncCallbackVtbl scheme_handler_callback_vtbl = +{ + scheme_handler_callback_QueryInterface, + scheme_handler_callback_AddRef, + scheme_handler_callback_Release, + scheme_handler_callback_GetParameters, + scheme_handler_callback_Invoke, +}; + +HRESULT gstreamer_scheme_handler_create(REFIID riid, void **obj) +{ + struct scheme_handler *handler; + HRESULT hr; + + TRACE("%s, %p.\n", debugstr_guid(riid), obj); + + if (!(handler = calloc(1, sizeof(*handler)))) + return E_OUTOFMEMORY; + + list_init(&handler->results); + InitializeCriticalSection(&handler->cs); + + handler->IMFSchemeHandler_iface.lpVtbl = &scheme_handler_vtbl; + handler->IMFAsyncCallback_iface.lpVtbl = &scheme_handler_callback_vtbl; + handler->refcount = 1; + + hr = IMFSchemeHandler_QueryInterface(&handler->IMFSchemeHandler_iface, riid, obj); + IMFSchemeHandler_Release(&handler->IMFSchemeHandler_iface); + + return hr; +} diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 3e5f8c7b1ee..aae1b63de5d 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -122,6 +122,8 @@ static const IClassFactoryVtbl class_factory_vtbl = static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; +static const GUID CLSID_GStreamerSchemePlugin = {0x587eeb6a,0x7336,0x4ebd,{0xa4,0xf2,0x91,0xc9,0x48,0xde,0x62,0x2c}}; + static const struct class_object { const GUID *clsid; @@ -133,6 +135,7 @@ class_objects[] = { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_MSAACDecMFT, &aac_decoder_create }, { &CLSID_MSH264DecoderMFT, &h264_decoder_create }, + { &CLSID_GStreamerSchemePlugin, &gstreamer_scheme_handler_create }, }; HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) diff --git a/dlls/winegstreamer/winegstreamer.rgs b/dlls/winegstreamer/winegstreamer.rgs index 923ba673f8c..c50d3a05747 100644 --- a/dlls/winegstreamer/winegstreamer.rgs +++ b/dlls/winegstreamer/winegstreamer.rgs @@ -12,3 +12,31 @@ HKCR } } } + +HKLM +{ + NoRemove 'Software' + { + NoRemove 'Microsoft' + { + NoRemove 'Windows Media Foundation' + { + NoRemove 'SchemeHandlers' + { + 'http:' + { + val '{587eeb6a-7336-4ebd-a4f2-91c948de622c}' = s 'GStreamer Scheme Handler' + } + 'https:' + { + val '{587eeb6a-7336-4ebd-a4f2-91c948de622c}' = s 'GStreamer Scheme Handler' + } + 'rtsp:' + { + val '{587eeb6a-7336-4ebd-a4f2-91c948de622c}' = s 'GStreamer Scheme Handler' + } + } + } + } + } +} diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index bb727ca8645..16b24a23261 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -131,3 +131,10 @@ coclass MFMP3SinkClassFactory {} uuid(a22c4fc7-6e91-4e1d-89e9-53b2667b72ba) ] coclass MFMPEG4SinkClassFactory {} + +[ + helpstring("GStreamer scheme handler"), + threading(both), + uuid(587eeb6a-7336-4ebd-a4f2-91c948de622c) +] +coclass GStreamerSchemePlugin { } From e809caa98f554a1173a6b6924229575ea504a100 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Fri, 12 Jan 2024 09:28:08 +0100 Subject: [PATCH 1085/1506] winegstreamer: Don't fail directly on unsupported format. CW-Bug-Id: #23207 --- dlls/winegstreamer/media_source.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index a0fe52f1604..83ab880f8ef 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -500,9 +500,8 @@ static HRESULT stream_descriptor_create(UINT32 id, struct wg_format *format, IMF DWORD count = 0; HRESULT hr; - if (!(types[0] = mf_media_type_from_wg_format(format))) - return MF_E_INVALIDMEDIATYPE; - count = 1; + if ((types[0] = mf_media_type_from_wg_format(format))) + count = 1; if (format->major_type == WG_MAJOR_TYPE_VIDEO) { From c3e392dbe30902f315ca34923347a0bc9156521f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 15 Jan 2024 20:12:46 -0600 Subject: [PATCH 1086/1506] kernelbase: HACK Force Angle Vulkan instead of GL for EpicOnlineServicesUIHelper. CW-Bug-Id: #23242 --- dlls/kernelbase/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 9f9301d8de7..81169ccddd6 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -597,7 +597,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"Paradox Launcher.exe", L" --use-angle=gl"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, - {L"\\EpicOnlineServicesUIHelper", L" --use-gl=desktop"}, + {L"\\EpicOnlineServicesUIHelper", L" --use-angle=vulkan"}, {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, {L"nw.exe.exe", L" --use-angle=d3d9"}, {L"DC Universe Online\\LaunchPad.exe", L" --use-gl=swiftshader"}, From 0c7cd52be99073c269796b9eda8036269e8a8f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 17 Jan 2024 15:15:25 +0100 Subject: [PATCH 1087/1506] evr: Use D3DCREATE_MULTITHREADED device creation flag. CW-Bug-Id: #23231 --- dlls/evr/presenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 552e24b4b97..dfbc61739cc 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -2132,7 +2132,7 @@ static HRESULT video_presenter_init_d3d(struct video_presenter *presenter) present_params.Flags = D3DPRESENTFLAG_VIDEO; present_params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetDesktopWindow(), - D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_params, &device); + D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, &present_params, &device); IDirect3D9_Release(d3d); From c9f8400b93f260a841505c72dcbc0bb64bc21269 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 17 Jan 2024 09:55:07 -0600 Subject: [PATCH 1088/1506] amd_ags_x64: Add stubs for agsDriverExtensionsDX12_Init/DeInit. CW-Bug-Id: #23258 --- dlls/amd_ags_x64/amd_ags_x64.spec | 4 ++-- dlls/amd_ags_x64/amd_ags_x64_main.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index b808403f800..4dab7f1e892 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -31,10 +31,10 @@ @ stub agsDriverExtensionsDX11_WriteBreadcrumb @ stdcall agsDriverExtensionsDX12_CreateDevice(ptr ptr ptr ptr) @ stub agsDriverExtensionsDX12_CreateFromDevice -@ stub agsDriverExtensionsDX12_DeInit +@ stdcall agsDriverExtensionsDX12_DeInit(ptr) @ stub agsDriverExtensionsDX12_Destroy @ stdcall agsDriverExtensionsDX12_DestroyDevice(ptr ptr ptr) -@ stub agsDriverExtensionsDX12_Init +@ stdcall agsDriverExtensionsDX12_Init(ptr ptr ptr) @ stub agsDriverExtensionsDX12_PopMarker @ stub agsDriverExtensionsDX12_PushMarker @ stub agsDriverExtensionsDX12_SetMarker diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 9e50337626f..c402da755b0 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1314,6 +1314,21 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_DeInit( AGSContext* context ) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensionsDX12_Init( AGSContext* context, ID3D12Device* device, unsigned int* extensionsSupported ) +{ + FIXME("context %p, device %p, extensionsSupported %p stub.\n", context, device, extensionsSupported); + + *extensionsSupported = 0; + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX12_DeInit( AGSContext* context ) +{ + TRACE("context %p.\n", context); + + return AGS_SUCCESS; +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From b4d3bfd3f75833b600b7447b1fbad89f9bdf19e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 18 Jan 2024 18:02:45 +0100 Subject: [PATCH 1089/1506] fshack: winex11: Save and restore GL_PIXEL_UNPACK_BUFFER_BINDING too. CW-Bug-Id: #23257 --- dlls/winex11.drv/opengl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index fa73d8205f1..43f87e11b1d 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2392,7 +2392,7 @@ static void gen_texture( struct wgl_context *ctx, GLuint *tex, enum fshack_textu static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable *gl ) { - GLuint prev_draw_fbo, prev_read_fbo, prev_texture, prev_renderbuffer; + GLuint prev_draw_fbo, prev_read_fbo, prev_texture, prev_renderbuffer, prev_pixel_pack_buffer; float prev_clear_color[4], prev_clear_depth; int prev_clear_stencil; unsigned int i; @@ -2440,11 +2440,14 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * opengl_funcs.gl.p_glGetIntegerv( GL_READ_FRAMEBUFFER_BINDING, (GLint *)&prev_read_fbo ); opengl_funcs.gl.p_glGetIntegerv( GL_TEXTURE_BINDING_2D, (GLint *)&prev_texture ); opengl_funcs.gl.p_glGetIntegerv( GL_RENDERBUFFER_BINDING, (GLint *)&prev_renderbuffer ); + opengl_funcs.gl.p_glGetIntegerv( GL_PIXEL_UNPACK_BUFFER_BINDING, (GLint *)&prev_pixel_pack_buffer ); opengl_funcs.gl.p_glGetFloatv( GL_COLOR_CLEAR_VALUE, prev_clear_color ); opengl_funcs.gl.p_glGetFloatv( GL_DEPTH_CLEAR_VALUE, &prev_clear_depth ); opengl_funcs.gl.p_glGetIntegerv( GL_STENCIL_CLEAR_VALUE, &prev_clear_stencil ); TRACE( "Previous draw FBO %u, read FBO %u for ctx %p\n", prev_draw_fbo, prev_read_fbo, ctx ); + pglBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 ); + if (!ctx->fs_hack_fbo) { pglGenFramebuffers( 1, &ctx->fs_hack_fbo ); @@ -2591,6 +2594,8 @@ static void fs_hack_setup_context( struct wgl_context *ctx, struct gl_drawable * ctx->fs_hack_integer = fs_hack_is_integer(); ctx->fs_hack_needs_resolve = gl->fs_hack_needs_resolve; gl->fs_hack_context_set_up = TRUE; + + pglBindBuffer( GL_PIXEL_UNPACK_BUFFER, prev_pixel_pack_buffer ); } else { From 11c6ddf91cf52de659d063acf1e1ee7ae28e4207 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 18 Jan 2024 20:06:43 +0800 Subject: [PATCH 1090/1506] user32/tests: Test GetKeyboardLayout() in CJK locales. CW-Bug-Id: #23224 --- dlls/user32/tests/input.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index f92b839f1cb..13e3a8f3b96 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -5386,6 +5386,24 @@ static void test_ClipCursor( char **argv ) if (!EqualRect( &rect, &virtual_rect )) ok_ret( 1, ClipCursor( NULL ) ); } +static void test_GetKeyboardLayout(void) +{ + LANGID lang_id; + BOOL is_cjk; + HKL hkl; + + /* Test that the high word of the keyboard layout in CJK locale on Vista+ is the same as the low + * word, even when IME is on */ + lang_id = PRIMARYLANGID(GetUserDefaultLCID()); + is_cjk = (lang_id == LANG_CHINESE || lang_id == LANG_JAPANESE || lang_id == LANG_KOREAN); + if (is_cjk && LOBYTE(LOWORD(GetVersion())) > 5) + { + hkl = GetKeyboardLayout(0); + todo_wine + ok(HIWORD(hkl) == LOWORD(hkl), "Got unexpected hkl %p.\n", hkl); + } +} + START_TEST(input) { char **argv; @@ -5431,6 +5449,7 @@ START_TEST(input) test_RegisterRawInputDevices(); test_rawinput(argv[0]); test_DefRawInputProc(); + test_GetKeyboardLayout(); if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx( argv ); From a8d0b37a65384b060cb56d5fa9e22663b26d0816 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 18 Jan 2024 19:56:49 +0800 Subject: [PATCH 1091/1506] win32u: Don't set the high word of keyboard layout to 0xe001 in CJK locales on Vista+. The high word of the keyboard layout in CJK locale on Vista+ is the same as the low word, even when IME is on according to tests in user32 and manual tests on Windows 10. Fix Super Robo Wars 30 (SteamID: 898750) crash on start when CJK locales are used. CW-Bug-Id: #23224 --- dlls/user32/tests/input.c | 1 - dlls/win32u/input.c | 15 ++++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 13e3a8f3b96..4a456d35c8f 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -5399,7 +5399,6 @@ static void test_GetKeyboardLayout(void) if (is_cjk && LOBYTE(LOWORD(GetVersion())) > 5) { hkl = GetKeyboardLayout(0); - todo_wine ok(HIWORD(hkl) == LOWORD(hkl), "Got unexpected hkl %p.\n", hkl); } } diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 2a4c2123169..69bc57f3ca4 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -892,18 +892,23 @@ static HKL get_locale_kbd_layout(void) */ NtQueryDefaultLocale( TRUE, &layout ); + layout = MAKELONG( layout, layout ); /* * Microsoft Office expects this value to be something specific * for Japanese and Korean Windows with an IME the value is 0xe001 * We should probably check to see if an IME exists and if so then * set this word properly. + * + * On Vista+, the high word is always layout, not 0xe00* even when IME is on. + * Super Robo Wars 30 (SteamID: 898750) depends on it. */ - langid = PRIMARYLANGID( LANGIDFROMLCID( layout ) ); - if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) - layout = MAKELONG( layout, 0xe001 ); /* IME */ - else - layout = MAKELONG( layout, layout ); + if (NtCurrentTeb()->Peb->OSMajorVersion <= 5) + { + langid = PRIMARYLANGID( LANGIDFROMLCID( layout ) ); + if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) + layout = MAKELONG( layout, 0xe001 ); /* IME */ + } return ULongToHandle( layout ); } From fe8b0bf53a4cc2810f670aa461d32be5ad5e6ec2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Jan 2024 17:54:30 -0600 Subject: [PATCH 1092/1506] ntdll: Return STATUS_DEBUGGER_INACTIVE from NtSystemDebugControl() stub. CW-Bug-Id: #23198 --- dlls/ntdll/tests/info.c | 24 ++++++++++++++++++++++++ dlls/ntdll/unix/system.c | 5 ++++- include/winternl.h | 14 +++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 68a9f165bfd..4118aae5e91 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -46,6 +46,7 @@ static NTSTATUS (WINAPI * pNtSetInformationDebugObject)(HANDLE,DEBUGOBJECTINFOCL static NTSTATUS (WINAPI * pDbgUiConvertStateChangeStructure)(DBGUI_WAIT_STATE_CHANGE*,DEBUG_EVENT*); static HANDLE (WINAPI * pDbgUiGetThreadDebugObject)(void); static void (WINAPI * pDbgUiSetThreadDebugObject)(HANDLE); +static NTSTATUS (WINAPI * pNtSystemDebugControl)(SYSDBG_COMMAND,PVOID,ULONG,PVOID,ULONG,PULONG); static BOOL is_wow64; static BOOL old_wow64; @@ -101,6 +102,7 @@ static void InitFunctionPtrs(void) NTDLL_GET_PROC(DbgUiConvertStateChangeStructure); NTDLL_GET_PROC(DbgUiGetThreadDebugObject); NTDLL_GET_PROC(DbgUiSetThreadDebugObject); + NTDLL_GET_PROC(NtSystemDebugControl); if (!IsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; @@ -3735,6 +3737,27 @@ static void test_ThreadIsTerminated(void) ok( status == STATUS_INVALID_HANDLE, "got %#lx.\n", status ); } +static void test_system_debug_control(void) +{ + NTSTATUS status; + int class; + + for (class = 0; class <= SysDbgSetKdBlockEnable; ++class) + { + status = pNtSystemDebugControl( class, NULL, 0, NULL, 0, NULL ); + if (is_wow64) + { + /* Most of the calls return STATUS_NOT_IMPLEMENTED on wow64. */ + ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_NOT_IMPLEMENTED || status == STATUS_INFO_LENGTH_MISMATCH, + "class %d, got %#lx.\n", class, status ); + } + else + { + ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_ACCESS_DENIED, "class %d, got %#lx.\n", class, status ); + } + } +} + START_TEST(info) { char **argv; @@ -3810,4 +3833,5 @@ START_TEST(info) test_ThreadEnableAlignmentFaultFixup(); test_process_instrumentation_callback(); + test_system_debug_control(); } diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 129136f675d..4a1e41e7e42 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -3608,7 +3608,10 @@ NTSTATUS WINAPI NtSystemDebugControl( SYSDBG_COMMAND command, void *in_buff, ULO { FIXME( "(%d, %p, %d, %p, %d, %p), stub\n", command, in_buff, (int)in_len, out_buff, (int)out_len, retlen ); - return STATUS_NOT_IMPLEMENTED; + + if (is_wow64()) return STATUS_NOT_IMPLEMENTED; + + return STATUS_DEBUGGER_INACTIVE; } diff --git a/include/winternl.h b/include/winternl.h index 627767cff33..fb07df24eb3 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3589,7 +3589,19 @@ typedef enum _SYSDBG_COMMAND { SysDbgReadMsr, SysDbgWriteMsr, SysDbgReadBusData, - SysDbgWriteBusData + SysDbgWriteBusData, + SysDbgCheckLowMemory, + SysDbgEnableKernelDebugger, + SysDbgDisableKernelDebugger, + SysDbgGetAutoKdEnable, + SysDbgSetAutoKdEnable, + SysDbgGetPrintBufferSize, + SysDbgSetPrintBufferSize, + SysDbgGetKdUmExceptionEnable, + SysDbgSetKdUmExceptionEnable, + SysDbgGetTriageDump, + SysDbgGetKdBlockEnable, + SysDbgSetKdBlockEnable, } SYSDBG_COMMAND, *PSYSDBG_COMMAND; typedef struct _CPTABLEINFO From 791bdd738ee821f05dc3347c238bb9ab6f17460b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 19 Jan 2024 14:32:00 -0600 Subject: [PATCH 1093/1506] winex11: Make XIconifyWindow() on Gamescope game specific. CW-Bug-Id: #23275 --- dlls/winex11.drv/window.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c385b22f592..f355bb20c8c 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1477,6 +1477,19 @@ static void set_xembed_flags( struct x11drv_win_data *data, unsigned long flags x11drv_atom(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*)info, 2 ); } +static int skip_iconify( Display *display ) +{ + static int cached = -1; + const char *env; + + if (cached == -1) + { + FIXME( "HACK: skip_iconify.\n" ); + cached = wm_is_steamcompmgr( display ) && (env = getenv( "SteamGameId" )) && !strcmp( env, "1827980" ); + } + + return cached; +} /*********************************************************************** * map_window @@ -1503,7 +1516,7 @@ static void map_window( HWND hwnd, DWORD new_style ) sync_window_style( data ); XMapWindow( data->display, data->whole_window ); /* Mutter always unminimizes windows when handling map requests. Restore iconic state */ - if (new_style & WS_MINIMIZE && !wm_is_steamcompmgr( data->display )) + if (new_style & WS_MINIMIZE && !skip_iconify( data->display )) XIconifyWindow( data->display, data->whole_window, data->vis.screen ); XFlush( data->display ); if (data->surface && data->vis.visualid != default_visual.visualid) @@ -3343,14 +3356,20 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic ); if (data->iconic) { - if (!wm_is_steamcompmgr( data->display )) + if (!skip_iconify( data->display )) { - /* XIconifyWindow is essentially a no-op on Gamescope but has an undesirable side effect. + /* XIconifyWindow is essentially a no-op on Gamescope but has a side effect. * Gamescope handles wm state change to iconic and immediately changes it back to normal. * Upon that change back we would receive WM_STATE change notification and kick the window - * out of minimized state even if the window is not focused by Gamescope. Upon focusing the - * window Gamescope will change WM_STATE regardless and we will get the window out of - * minimized state correctly. */ + * out of minimized state even if the window is not focused by Gamescope (possibly breaking Win-side + * focus and leading to hangs). + * Depending on what the game is going, various things may happen if we avoid that: + * - Gamescope may change WM_STATE later when focusing our window and we will get the window out of minimized state correctly; + * - The game might have no other windows and it just decided to minimize itself + * (e. g., before opening Web browser), expecting the user to unminimize it manually which + * is not possible on Gamescope. Ideally we'd have a way to detect such a case and unminimize + * when needed, but without that just let Gamescope unminimize immediately avoiding that for + * selected game(s) only. */ XIconifyWindow( data->display, data->whole_window, data->vis.screen ); } } From 7bf74984e2de84eb816e55ce7e6e9a0b4a431763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 22 Jan 2024 23:25:33 +0100 Subject: [PATCH 1094/1506] winex11: Sync with gdi_display before closing the threads display. CW-Bug-Id: #23287 --- dlls/winex11.drv/x11drv_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 1c197c81cc9..2d3104c2641 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -865,6 +865,7 @@ void X11DRV_ThreadDetach(void) vulkan_thread_detach(); if (data->xim) XCloseIM( data->xim ); if (data->font_set) XFreeFontSet( data->display, data->font_set ); + XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before closing the thread display */ XCloseDisplay( data->display ); free( data ); /* clear data in case we get re-entered from user32 before the thread is truly dead */ From e17d492f673057360c9dbcde0252be58dd112fd3 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 8 Jan 2024 15:24:11 +0100 Subject: [PATCH 1095/1506] crypt32: Pad R/S values with zeroes if smaller than their counterpart. Fixes certificate verification in Brawlhalla. (cherry picked from commit 0ceb41a5fdaf2426df60bc5b441772e7a94608a5) CW-Bug-Id: #23187 --- dlls/crypt32/cert.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index f640234d89b..373805e858f 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -2778,32 +2778,37 @@ BOOL CNG_ImportPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key) static BOOL CNG_PrepareSignatureECC(BYTE *encoded_sig, DWORD encoded_size, BYTE **sig_value, DWORD *sig_len) { CERT_ECC_SIGNATURE *ecc_sig; - DWORD size; + DWORD size, r_size, s_size, r_offset, s_offset; int i; if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ECC_SIGNATURE, encoded_sig, encoded_size, CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_sig, &size)) return FALSE; - if (!ecc_sig->r.cbData || !ecc_sig->s.cbData) + if (!(r_size = ecc_sig->r.cbData) || !(s_size = ecc_sig->s.cbData)) { LocalFree(ecc_sig); SetLastError(ERROR_INVALID_DATA); return FALSE; } + r_size = s_size = max( r_size, s_size ); - *sig_len = ecc_sig->r.cbData + ecc_sig->s.cbData; + *sig_len = r_size + s_size; if (!(*sig_value = CryptMemAlloc(*sig_len))) { LocalFree(ecc_sig); SetLastError(ERROR_OUTOFMEMORY); return FALSE; } + memset( *sig_value, 0, *sig_len ); + + r_offset = r_size - ecc_sig->r.cbData; + s_offset = s_size - ecc_sig->s.cbData; for (i = 0; i < ecc_sig->r.cbData; i++) - (*sig_value)[i] = ecc_sig->r.pbData[ecc_sig->r.cbData - i - 1]; + (*sig_value)[i + r_offset] = ecc_sig->r.pbData[ecc_sig->r.cbData - i - 1]; for (i = 0; i < ecc_sig->s.cbData; i++) - (*sig_value)[ecc_sig->r.cbData + i] = ecc_sig->s.pbData[ecc_sig->s.cbData - i - 1]; + (*sig_value)[r_size + i + s_offset] = ecc_sig->s.pbData[ecc_sig->s.cbData - i - 1]; LocalFree(ecc_sig); return TRUE; From ef084d857647a6eacd0841c31b531465d33cffd4 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 21 Dec 2023 18:11:35 +0800 Subject: [PATCH 1096/1506] include: Add some ncrypt definitions. (cherry picked from commit 2021959538e9d2eef0eae7f14052c6ba41c8154d) CW-Bug-Id: #23155 --- include/ncrypt.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/ncrypt.h b/include/ncrypt.h index 9fc2cb5b171..7a1769c8bd9 100644 --- a/include/ncrypt.h +++ b/include/ncrypt.h @@ -58,6 +58,21 @@ typedef struct NCryptKeyName { DWORD dwFlags; } NCryptKeyName; +typedef struct __NCRYPT_SUPPORTED_LENGTHS { + DWORD dwMinLength; + DWORD dwMaxLength; + DWORD dwIncrement; + DWORD dwDefaultLength; +} NCRYPT_SUPPORTED_LENGTHS; + +typedef struct __NCRYPT_UI_POLICY { + DWORD dwVersion; + DWORD dwFlags; + LPCWSTR pszCreationTitle; + LPCWSTR pszFriendlyName; + LPCWSTR pszDescription; +} NCRYPT_UI_POLICY; + typedef ULONG_PTR NCRYPT_HANDLE; typedef ULONG_PTR NCRYPT_PROV_HANDLE; typedef ULONG_PTR NCRYPT_KEY_HANDLE; @@ -76,6 +91,17 @@ typedef ULONG_PTR NCRYPT_SECRET_HANDLE; #define NCRYPT_PAD_OAEP_FLAG 0x00000004 #define NCRYPT_PAD_PSS_FLAG 0x00000008 +#define NCRYPT_ALLOW_DECRYPT_FLAG 0x00000001 +#define NCRYPT_ALLOW_SIGNING_FLAG 0x00000002 +#define NCRYPT_ALLOW_KEY_AGREEMENT_FLAG 0x00000004 +#define NCRYPT_ALLOW_KEY_IMPORT_FLAG 0x00000008 +#define NCRYPT_ALLOW_ALL_USAGES 0x00ffffff + +#define NCRYPT_ALLOW_EXPORT_FLAG 0x00000001 +#define NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG 0x00000002 +#define NCRYPT_ALLOW_ARCHIVING_FLAG 0x00000004 +#define NCRYPT_ALLOW_PLAINTEXT_ARCHIVING_FLAG 0x00000008 + #define NCRYPT_NAME_PROPERTY L"Name" #define NCRYPT_UNIQUE_NAME_PROPERTY L"Unique Name" #define NCRYPT_ALGORITHM_PROPERTY L"Algorithm Name" From 154a84c2d1a10d71b004e9191b3e31fd68de5519 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 21 Dec 2023 18:12:09 +0800 Subject: [PATCH 1097/1506] include: Add some bcrypt definitions. (cherry picked from commit 032834fd6cd17ba2c141b8a91b3f11905e0e487a) CW-Bug-Id: #23155 --- include/bcrypt.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/bcrypt.h b/include/bcrypt.h index b8b682c4746..11a607f9f61 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -58,6 +58,7 @@ typedef LONG NTSTATUS; #define BCRYPT_PADDING_SCHEMES L"PaddingSchemes" #define BCRYPT_PROVIDER_HANDLE L"ProviderHandle" #define BCRYPT_SIGNATURE_LENGTH L"SignatureLength" +#define BCRYPT_PUBLIC_KEY_LENGTH L"PublicKeyLength" #define BCRYPT_OPAQUE_KEY_BLOB L"OpaqueKeyBlob" #define BCRYPT_KEY_DATA_BLOB L"KeyDataBlob" @@ -138,6 +139,7 @@ static const WCHAR BCRYPT_OBJECT_LENGTH[] = {'O','b','j','e','c','t','L','e','n' static const WCHAR BCRYPT_PADDING_SCHEMES[] = {'P','a','d','d','i','n','g','S','c','h','e','m','e','s',0}; static const WCHAR BCRYPT_PROVIDER_HANDLE[] = {'P','r','o','v','i','d','e','r','H','a','n','d','l','e',0}; static const WCHAR BCRYPT_SIGNATURE_LENGTH[] = {'S','i','g','n','a','t','u','r','e','L','e','n','g','t','h',0}; +static const WCHAR BCRYPT_PUBLIC_KEY_LENGTH[] = {'P','u','b','l','i','c','K','e','y','L','e','n','g','t','h',0}; static const WCHAR BCRYPT_OPAQUE_KEY_BLOB[] = {'O','p','a','q','u','e','K','e','y','B','l','o','b',0}; static const WCHAR BCRYPT_KEY_DATA_BLOB[] = {'K','e','y','D','a','t','a','B','l','o','b',0}; From 6abef68d492c0814d1f010a54982e814b41110fe Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 21 Dec 2023 18:16:02 +0800 Subject: [PATCH 1098/1506] ncrypt/tests: Test default RSA key properties. (cherry picked from commit 1144efbc47c09927a1d7705631ec9574c22e4517) CW-Bug-Id: #23155 --- dlls/ncrypt/tests/ncrypt.c | 260 +++++++++++++++++++++++++++++++------ 1 file changed, 221 insertions(+), 39 deletions(-) diff --git a/dlls/ncrypt/tests/ncrypt.c b/dlls/ncrypt/tests/ncrypt.c index bd2f63bea87..572b325a04c 100644 --- a/dlls/ncrypt/tests/ncrypt.c +++ b/dlls/ncrypt/tests/ncrypt.c @@ -40,6 +40,85 @@ static UCHAR rsa_key_blob[] = { 0x44, 0x81, 0x09, 0x41, 0x80, 0x23, 0x7b, 0xf6, 0x3f, 0xaf, 0x91, 0xa1, 0x87, 0x75, 0x33, 0x15, 0xb8, 0xde, 0x32, 0x30, 0xb4, 0x5e, 0xfd}; +static UCHAR rsa_private_key_blob[] = { + 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0xaf, 0xc0, 0x68, 0x21, 0x76, 0xd7, 0x46, 0xf8, 0x23, + 0x78, 0x94, 0x22, 0xa3, 0x0f, 0x4e, 0xe8, 0xc6, 0x6a, 0x33, 0xdc, 0xbf, + 0x44, 0x6c, 0xb6, 0x95, 0x17, 0x78, 0x1e, 0x75, 0xca, 0xdc, 0x66, 0xe4, + 0x87, 0xbe, 0x91, 0xbf, 0xb3, 0xc0, 0xa5, 0x16, 0xa1, 0xb7, 0xfe, 0x4c, + 0x67, 0xaa, 0x03, 0x38, 0xe7, 0x13, 0x65, 0xfb, 0xb6, 0x4c, 0x52, 0x29, + 0xa4, 0xc4, 0x92, 0x34, 0xcd, 0x81, 0xa5, 0x0b, 0x7f, 0x5f, 0x56, 0xbf, + 0xa7, 0xf8, 0xec, 0x9a, 0xe7, 0xb3, 0x93, 0xba, 0x00, 0xe9, 0x48, 0x7a, + 0xf7, 0x04, 0x65, 0xa3, 0x14, 0x8d, 0x08, 0x78, 0xd8, 0x16, 0x5e, 0x82, + 0xeb, 0xd8, 0xea, 0x3c, 0xec, 0xcc, 0x64, 0x47, 0x97, 0x69, 0x43, 0x17, + 0x5d, 0x25, 0xd9, 0xb8, 0xdf, 0xfc, 0x80, 0x16, 0xbe, 0xbb, 0xa8, 0xe4, + 0xbf, 0x6a, 0x2f, 0xea, 0x9c, 0xe5, 0x58, 0x8a, 0xf4, 0x2b, 0xe5, 0xcf, + 0x67, 0x26, 0xe2, 0xeb, 0x92, 0x88, 0xde, 0x52, 0xee, 0x43, 0x44, 0x14, + 0x6d, 0xf7, 0x46, 0x9c, 0x87, 0xa8, 0x96, 0x85, 0xda, 0x19, 0xc3, 0x57, + 0x95, 0x09, 0x8d, 0xa2, 0x4e, 0xcd, 0x84, 0x67, 0x8e, 0x2c, 0x2d, 0x16, + 0xb0, 0xb4, 0xb4, 0x66, 0xcc, 0x7b, 0x7f, 0xaa, 0x2b, 0x14, 0x17, 0x4c, + 0x68, 0x4a, 0xa2, 0xd3, 0xfc, 0xe0, 0xb9, 0xcd, 0xa4, 0xbb, 0x44, 0x0b, + 0x84, 0xa7, 0x13, 0xd8, 0xee, 0xae, 0x8e, 0xdb, 0x0b, 0xd3, 0xc5, 0xc5, + 0x3b, 0xfd, 0x6c, 0xb0, 0x92, 0x14, 0xf0, 0x7b, 0xa7, 0x37, 0xd6, 0x21, + 0x73, 0x5d, 0x80, 0x9a, 0x49, 0x71, 0x2f, 0xc9, 0x05, 0xa5, 0x74, 0x81, + 0xc9, 0xd5, 0x2a, 0x6a, 0x7f, 0xe8, 0x8e, 0xa9, 0x7b, 0x79, 0x9e, 0x46, + 0x51, 0xe7, 0x08, 0xa1, 0x75, 0x51, 0x75, 0x7a, 0x4a, 0x43, 0x0e, 0x5b, + 0x5a, 0xb8, 0x1b, 0xa3, 0x85, 0x68, 0x27}; + +static UCHAR rsa_full_private_key_blob[] = { + 0x52, 0x53, 0x41, 0x33, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0xbb, 0x49, 0x0d, 0x3f, 0xfa, 0x15, 0x1a, 0xd7, 0xd4, + 0x7e, 0x51, 0xe7, 0x7f, 0xaf, 0xbb, 0x63, 0x8e, 0x88, 0x71, 0x8c, 0x67, + 0x91, 0xb0, 0x6b, 0xd2, 0x4f, 0x58, 0xb4, 0xd7, 0xdd, 0xcb, 0xa8, 0xc0, + 0x0c, 0xf5, 0x41, 0xfd, 0x28, 0xdf, 0xb9, 0x0d, 0x4e, 0x22, 0x24, 0x37, + 0xa5, 0xae, 0x3c, 0x9a, 0xbf, 0xae, 0x8f, 0xd9, 0xc1, 0x30, 0x87, 0x71, + 0xee, 0x5a, 0x2b, 0xfc, 0x2d, 0x5b, 0xf6, 0xe7, 0xf1, 0x69, 0xf2, 0x94, + 0x47, 0x55, 0x6e, 0xca, 0x4f, 0x66, 0xba, 0x82, 0xbb, 0x98, 0x09, 0xd0, + 0x3b, 0x8e, 0x30, 0x20, 0x0e, 0x8f, 0x44, 0xc8, 0x8d, 0xfd, 0x06, 0x65, + 0x6d, 0x7a, 0xbb, 0x0d, 0xad, 0x5c, 0x3f, 0xc5, 0x7c, 0x57, 0x0a, 0x3b, + 0x21, 0x54, 0x3e, 0xd1, 0x54, 0x07, 0x40, 0xbb, 0x85, 0x78, 0x55, 0x47, + 0x2a, 0x06, 0xbd, 0x81, 0xa7, 0x77, 0x32, 0x37, 0x56, 0x3c, 0x49, 0xf2, + 0x68, 0x32, 0x44, 0x8c, 0x6a, 0x0b, 0xfa, 0xa4, 0x66, 0xc9, 0xcc, 0x54, + 0xab, 0xb3, 0x90, 0x65, 0xce, 0x43, 0xba, 0xcd, 0xc1, 0x6a, 0x8a, 0x1b, + 0xdc, 0x16, 0x8f, 0xea, 0xf0, 0x25, 0x74, 0x6d, 0xc4, 0x84, 0x73, 0xc7, + 0xc9, 0x38, 0xa9, 0x59, 0x5b, 0xaf, 0x59, 0x9e, 0x2f, 0x56, 0x75, 0x30, + 0xc4, 0x5e, 0x80, 0x9b, 0x0b, 0x80, 0xc2, 0x5d, 0x2c, 0xb1, 0xd7, 0x65, + 0xd6, 0x7f, 0x2b, 0xc5, 0xc9, 0x92, 0x89, 0xa4, 0x83, 0x7c, 0xb2, 0x48, + 0xa2, 0x25, 0x4e, 0x8a, 0x59, 0x91, 0xbc, 0x53, 0x88, 0xa8, 0x51, 0x5d, + 0x19, 0xed, 0x5d, 0x5e, 0xde, 0x42, 0x09, 0xd7, 0x41, 0x1a, 0x3b, 0xa5, + 0xfc, 0x51, 0x7b, 0x93, 0x1e, 0x11, 0x18, 0xa0, 0x64, 0x89, 0xd5, 0x91, + 0xdf, 0x79, 0xed, 0x89, 0x49, 0x5c, 0x7d, 0x5f, 0x85, 0x54, 0x7c, 0x4d, + 0xcb, 0x8f, 0x0e, 0xbb, 0x01, 0x18, 0x5b, 0x46, 0x89, 0x27, 0x47, 0x67, + 0x0c, 0x5c, 0x9b, 0xfc, 0x46, 0xa4, 0xa5, 0xbe, 0x65, 0x90, 0x04, 0x8e, + 0x7b, 0x2c, 0x9e, 0x28, 0xcd, 0x05, 0x31, 0x56, 0xd5, 0xfe, 0x02, 0xb6, + 0xbc, 0x56, 0x49, 0xc0, 0xbf, 0x14, 0x43, 0x94, 0x78, 0xea, 0xf1, 0xec, + 0x3c, 0x8f, 0x93, 0xa6, 0x41, 0xe4, 0x08, 0x89, 0xbe, 0x3a, 0x39, 0x75, + 0xe4, 0x2c, 0xfd, 0x61, 0x9b, 0x65, 0xcc, 0x65, 0xa7, 0xba, 0xad, 0x15, + 0x46, 0xcb, 0xd6, 0xb6, 0xb5, 0xd6, 0x52, 0x2f, 0x72, 0x11, 0xe5, 0x53, + 0x08, 0xb3, 0x9e, 0xb8, 0xb5, 0xb8, 0xb5, 0x97, 0xf8, 0x54, 0x0a, 0x79, + 0x4c, 0x1b, 0x7a, 0x87, 0x87, 0x5f, 0x55, 0x0f, 0x54, 0x07, 0x47, 0xed, + 0xd9, 0x8c, 0x29, 0x44, 0x07, 0xcc, 0xb4, 0x06, 0xcf, 0x2d, 0x84, 0x9a, + 0x02, 0x24, 0x4a, 0xf0, 0x5d, 0x9d, 0x6b, 0x09, 0xcb, 0x5e, 0x06, 0x4d, + 0xa3, 0x9e, 0x85, 0x38, 0x89, 0xf4, 0x44, 0xbd, 0x4a, 0xe3, 0x2e, 0x3c, + 0x74, 0x5c, 0xad, 0xc3, 0x17, 0x6b, 0x84, 0x24, 0x94, 0xcd, 0xa1, 0x21, + 0xec, 0x0a, 0x4c, 0x66, 0x38, 0x95, 0xc1, 0x64, 0x78, 0xf5, 0x12, 0x46, + 0x58, 0x7f, 0x8a, 0x3f, 0xce, 0xda, 0x9b, 0x7e, 0xa5, 0xe4, 0xbe, 0x9c, + 0x15, 0xd4, 0xb0, 0x84, 0xf0, 0xed, 0x94, 0x37, 0x71, 0x41, 0xbe, 0x9a, + 0x02, 0x02, 0xd9, 0xc2, 0xaf, 0x44, 0x32, 0x6d, 0xcd, 0xee, 0xce, 0xcb, + 0xb9, 0x03, 0xfb, 0xf6, 0xc1, 0xf9, 0x13, 0x59, 0x71, 0x96, 0xd4, 0x50, + 0x04, 0xff, 0x4d, 0xea, 0x8b, 0x28, 0x7c, 0x8e, 0xd9, 0xa6, 0x90, 0xa0, + 0xdf, 0x91, 0x40, 0x67, 0x19, 0x31, 0xd2, 0x76, 0xb3, 0x38, 0x38, 0x2e, + 0xec, 0xd8, 0x67, 0x93, 0x98, 0xb8, 0x07, 0x20, 0x53, 0xb1, 0xec, 0xf5, + 0x26, 0xa7, 0x65, 0x42, 0x0f, 0x15, 0x1f, 0x24, 0xc3, 0x13, 0x5f, 0x35, + 0x97, 0x8f, 0x23, 0x3e, 0x7c, 0xaf, 0xe8, 0x19, 0xeb, 0xee, 0xc6, 0xd2, + 0x1d, 0x5b, 0x75, 0x31, 0xae, 0xea, 0xc1, 0x5a, 0x49, 0xa4, 0xf4, 0x37, + 0x65, 0x16, 0xc9, 0xfb, 0x0a, 0x9d, 0x33, 0x5a, 0x44, 0xaa, 0x9b, 0x0b, + 0x62, 0x48, 0x5f, 0x4c, 0xb5, 0xba, 0x3f, 0xf7, 0xb5, 0xb4, 0xed, 0x84, + 0xbe, 0xc7, 0x6c, 0x1f, 0xa4, 0xd1, 0xb8, 0x23, 0xf6, 0xa6, 0x47, 0x06, + 0x09, 0x4a, 0x61}; + static UCHAR rsa_key_blob_with_invalid_bit_length[] = { 0x52, 0x53, 0x41, 0x31, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -86,6 +165,136 @@ static UCHAR invalid_rsa_key_blob[] = { 0x44, 0x81, 0x09, 0x41, 0x80, 0x23, 0x7b, 0xf6, 0x3f, 0xaf, 0x91, 0xa1, 0x87, 0x75, 0x33, 0x15, 0xb8, 0xde, 0x32, 0x30, 0xb4, 0x5e, 0xfd}; +struct expected_property +{ + const WCHAR *name; + BYTE expected_data[64]; + DWORD expected_size; + SECURITY_STATUS expected_status; + BOOL todo; + SECURITY_STATUS broken_status; + BYTE broken_data[64]; +}; + +static void check_property(int line, NCRYPT_KEY_HANDLE key, const struct expected_property *property) +{ + BYTE buffer[64] = {0}; + SECURITY_STATUS ret; + unsigned int i; + DWORD size; + + winetest_push_context("%s", wine_dbgstr_w(property->name)); + + if (property->expected_status != ERROR_SUCCESS) + { + size = 0; + ret = NCryptGetProperty(key, property->name, buffer, sizeof(buffer), &size, 0); + todo_wine_if(property->todo) + ok_(__FILE__, line)(ret == property->expected_status || broken(ret == property->broken_status), + "got unexpected return value %#lx\n", ret); + if (ret == ERROR_SUCCESS) + ok_(__FILE__, line)(size == property->expected_size, "got unexpected size %lu\n", size); + + goto done; + } + + size = 0; + ret = NCryptGetProperty(key, property->name, NULL, 0, &size, 0); + todo_wine_if(property->todo) + ok_(__FILE__, line)(ret == property->expected_status || broken(ret == property->broken_status), + "got unexpected return value %#lx\n", ret); + if (ret != ERROR_SUCCESS) + goto done; + ok_(__FILE__, line)(size == property->expected_size, "got unexpected size %lu\n", size); + + size = 0; + ret = NCryptGetProperty(key, property->name, buffer, sizeof(buffer), &size, 0); + ok_(__FILE__, line)(ret == property->expected_status, "got unexpected return value %#lx\n", ret); + ok_(__FILE__, line)(size == property->expected_size, "got unexpected size %lu\n", size); + if (ret == ERROR_SUCCESS && memcmp(property->expected_data, buffer, property->expected_size) + && broken(memcmp(property->broken_data, buffer, property->expected_size))) + { + for (i = 0; i < size; i ++) + { + ok_(__FILE__, line)(0, "%#04x \n", buffer[i]); + } + } + +done: + winetest_pop_context(); +} + +#define check_properties(a, b) _check_properties(__LINE__, a, b) +static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HANDLE key) +{ + struct expected_property properties[] = + { + /* NCrypt properties */ + {NCRYPT_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_UNIQUE_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_ALGORITHM_PROPERTY, {'R', 0, 'S', 0, 'A', 0}, sizeof(L"RSA"), ERROR_SUCCESS, TRUE}, + {NCRYPT_LENGTH_PROPERTY, {0, 0x4} /* 1024 */, sizeof(DWORD)}, + {NCRYPT_LENGTHS_PROPERTY, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x8, 0, 0, 0, 0, 0x4, 0, 0}, sizeof(DWORD) * 4 /* NCRYPT_SUPPORTED_LENGTHS */, ERROR_SUCCESS, TRUE, ERROR_SUCCESS, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x40, 0, 0, 0, 0, 0x4, 0, 0}}, + {NCRYPT_BLOCK_LENGTH_PROPERTY, {0x80, 0, 0, 0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_UI_POLICY_PROPERTY, {0}, sizeof(NCRYPT_UI_POLICY), NTE_NOT_FOUND, TRUE}, + {NCRYPT_EXPORT_POLICY_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_WINDOW_HANDLE_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, + {NCRYPT_USE_CONTEXT_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, + {NCRYPT_IMPL_TYPE_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_KEY_USAGE_PROPERTY, {0xff, 0xff, 0xff, 0} /* NCRYPT_ALLOW_ALL_USAGES */, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_KEY_TYPE_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_VERSION_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_SECURITY_DESCR_PROPERTY, {0}, 0, NTE_BAD_FLAGS, TRUE}, + {NCRYPT_USE_COUNT_ENABLED_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_USE_COUNT_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_LAST_MODIFIED_PROPERTY, {0}, sizeof(FILETIME), NTE_NOT_FOUND, TRUE}, + {NCRYPT_WINDOW_HANDLE_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, + {NCRYPT_MAX_NAME_LENGTH_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_ALGORITHM_GROUP_PROPERTY, {'R', 0, 'S', 0, 'A', 0}, sizeof(L"RSA")}, + {NCRYPT_PROVIDER_HANDLE_PROPERTY, {0}, sizeof(NCRYPT_PROV_HANDLE), ERROR_SUCCESS}, + {NCRYPT_PIN_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_READER_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_SMARTCARD_GUID_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_CERTIFICATE_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE, NTE_NOT_SUPPORTED /* Win 7 */}, + {NCRYPT_PIN_PROMPT_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_USER_CERTSTORE_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_ROOT_CERTSTORE_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_SECURE_PIN_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_ASSOCIATED_ECDH_KEY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_SCARD_PIN_ID, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {NCRYPT_SCARD_PIN_INFO, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + /* BCrypt properties */ + {BCRYPT_ALGORITHM_NAME, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_AUTH_TAG_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_BLOCK_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_BLOCK_SIZE_LIST, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_CHAINING_MODE, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_EFFECTIVE_KEY_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_HASH_BLOCK_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_HASH_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_HASH_OID_LIST, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_KEY_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_KEY_LENGTHS, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_KEY_OBJECT_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_KEY_STRENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_OBJECT_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_PADDING_SCHEMES, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_PROVIDER_HANDLE, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, + {BCRYPT_SIGNATURE_LENGTH, {0x80, 0, 0, 0} /* 128 */, sizeof(DWORD), ERROR_SUCCESS, TRUE, NTE_NOT_SUPPORTED /* <= Win 8 */}, + {BCRYPT_PUBLIC_KEY_LENGTH, {0, 0x4} /* 1024 */, sizeof(DWORD), ERROR_SUCCESS, TRUE, NTE_NOT_SUPPORTED /* <= Win 8 */}, + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(properties); i++) + { + if (!lstrcmpW(properties[i].name, NCRYPT_PROVIDER_HANDLE_PROPERTY)) + memcpy(properties[i].expected_data, &prov, sizeof(prov)); + + check_property(line, key, &properties[i]); + } +} + static void test_key_import_rsa(void) { NCRYPT_PROV_HANDLE prov; @@ -168,39 +377,28 @@ static void test_get_property(void) NCRYPT_PROV_HANDLE prov; NCRYPT_KEY_HANDLE key; SECURITY_STATUS ret; - WCHAR value[4]; DWORD keylength, size; ret = NCryptOpenStorageProvider(&prov, NULL, 0); ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ret = NCryptImportKey(prov, 0, BCRYPT_RSAPUBLIC_BLOB, NULL, &key, rsa_key_blob, sizeof(rsa_key_blob), 0); - ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - - size = 0; - ret = NCryptGetProperty(key, NCRYPT_ALGORITHM_GROUP_PROPERTY, NULL, 0, &size, 0); - ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(size == 8, "got %lu\n", size); + ret = NCryptGetProperty(0, NCRYPT_LENGTH_PROPERTY, (BYTE *)&keylength, size, &size, 0); + ok(ret == NTE_INVALID_HANDLE, "got %#lx\n", ret); - size = 0; - value[0] = 0; - ret = NCryptGetProperty(key, NCRYPT_ALGORITHM_GROUP_PROPERTY, (BYTE *)value, sizeof(value), &size, 0); + ret = NCryptImportKey(prov, 0, BCRYPT_RSAPUBLIC_BLOB, NULL, &key, rsa_key_blob, sizeof(rsa_key_blob), 0); ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(size == 8, "got %lu\n", size); - ok(!lstrcmpW(value, L"RSA"), "The string doesn't match with 'RSA'\n"); + check_properties(prov, key); + NCryptFreeObject(key); - size = 0; - ret = NCryptGetProperty(key, NCRYPT_LENGTH_PROPERTY, NULL, 0, &size, 0); + ret = NCryptImportKey(prov, 0, BCRYPT_RSAPRIVATE_BLOB, NULL, &key, rsa_private_key_blob, sizeof(rsa_private_key_blob), 0); ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(size == sizeof(DWORD), "got %lu\n", size); + check_properties(prov, key); + NCryptFreeObject(key); - keylength = 0; - ret = NCryptGetProperty(key, NCRYPT_LENGTH_PROPERTY, (BYTE *)&keylength, size, &size, 0); + ret = NCryptImportKey(prov, 0, BCRYPT_RSAFULLPRIVATE_BLOB, NULL, &key, rsa_full_private_key_blob, sizeof(rsa_full_private_key_blob), 0); ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(keylength == 1024, "got %lu\n", keylength); - - ret = NCryptGetProperty(0, NCRYPT_LENGTH_PROPERTY, (BYTE *)&keylength, size, &size, 0); - ok(ret == NTE_INVALID_HANDLE, "got %#lx\n", ret); + check_properties(prov, key); + NCryptFreeObject(key); NCryptFreeObject(prov); } @@ -258,8 +456,6 @@ static void test_create_persisted_key(void) NCRYPT_PROV_HANDLE prov; NCRYPT_KEY_HANDLE key; SECURITY_STATUS ret; - DWORD size, keylength; - WCHAR alggroup[4]; ret = NCryptOpenStorageProvider(&prov, NULL, 0); ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); @@ -275,21 +471,7 @@ static void test_create_persisted_key(void) ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); ok(key, "got null handle\n"); - ret = NCryptGetProperty(key, NCRYPT_ALGORITHM_GROUP_PROPERTY, NULL, 0, &size, 0); - ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(size == 8, "got %lu\n", size); - - size = 0; - alggroup[0] = 0; - ret = NCryptGetProperty(key, NCRYPT_ALGORITHM_GROUP_PROPERTY, (BYTE *)alggroup, sizeof(alggroup), &size, 0); - ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(size == 8, "got %lu\n", size); - ok(!lstrcmpW(alggroup, L"RSA"), "The string doesn't match with 'RSA'\n"); - - ret = NCryptGetProperty(key, NCRYPT_LENGTH_PROPERTY, (BYTE *)&keylength, sizeof(keylength), &size, 0); - ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - ok(size == 4, "got %lu\n", size); - ok(keylength == 1024, "got %lu\n", keylength); + check_properties(prov, key); NCryptFinalizeKey(key, 0); NCryptFreeObject(key); From 60ddfb21561adb568355a97a3a30953ea14df619 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 22 Dec 2023 14:46:21 +0800 Subject: [PATCH 1099/1506] ncrypt: Add some missing RSA key properties. (cherry picked from commit 663bce9de993fc560f266893e598f5a201a70f22) CW-Bug-Id: #23155 --- dlls/ncrypt/main.c | 18 ++++++++++++++++++ dlls/ncrypt/tests/ncrypt.c | 16 ++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c index 8a720382bef..3511f8f2d3f 100644 --- a/dlls/ncrypt/main.c +++ b/dlls/ncrypt/main.c @@ -128,7 +128,9 @@ static SECURITY_STATUS set_object_property(struct object *object, const WCHAR *n static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE provider) { + NCRYPT_SUPPORTED_LENGTHS supported_lengths = {512, 16384, 8, 1024}; struct object *object; + DWORD dw_value; switch (algid) { @@ -136,8 +138,16 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro if (!(object = allocate_object(KEY))) return NULL; object->key.algid = RSA; + set_object_property(object, NCRYPT_ALGORITHM_PROPERTY, (BYTE *)BCRYPT_RSA_ALGORITHM, + sizeof(BCRYPT_RSA_ALGORITHM)); set_object_property(object, NCRYPT_ALGORITHM_GROUP_PROPERTY, (BYTE *)BCRYPT_RSA_ALGORITHM, sizeof(BCRYPT_RSA_ALGORITHM)); + set_object_property(object, NCRYPT_LENGTHS_PROPERTY, (BYTE *)&supported_lengths, + sizeof(supported_lengths)); + dw_value = 128; + set_object_property(object, NCRYPT_BLOCK_LENGTH_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value)); + dw_value = 128; + set_object_property(object, BCRYPT_SIGNATURE_LENGTH, (BYTE *)&dw_value, sizeof(dw_value)); break; default: @@ -145,6 +155,12 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro return NULL; } + dw_value = 0; + set_object_property(object, NCRYPT_EXPORT_POLICY_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value)); + dw_value = NCRYPT_ALLOW_ALL_USAGES; + set_object_property(object, NCRYPT_KEY_USAGE_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value)); + dw_value = 0; + set_object_property(object, NCRYPT_KEY_TYPE_PROPERTY, (BYTE *)&dw_value, sizeof(dw_value)); set_object_property(object, NCRYPT_PROVIDER_HANDLE_PROPERTY, (BYTE *)&provider, sizeof(provider)); return object; } @@ -181,6 +197,7 @@ SECURITY_STATUS WINAPI NCryptCreatePersistedKey(NCRYPT_PROV_HANDLE provider, NCR } set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&default_bitlen, sizeof(default_bitlen)); + set_object_property(object, BCRYPT_PUBLIC_KEY_LENGTH, (BYTE *)&default_bitlen, sizeof(default_bitlen)); } else { @@ -401,6 +418,7 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_H } set_object_property(object, NCRYPT_LENGTH_PROPERTY, (BYTE *)&rsablob->BitLength, sizeof(rsablob->BitLength)); + set_object_property(object, BCRYPT_PUBLIC_KEY_LENGTH, (BYTE *)&rsablob->BitLength, sizeof(rsablob->BitLength)); break; } default: diff --git a/dlls/ncrypt/tests/ncrypt.c b/dlls/ncrypt/tests/ncrypt.c index 572b325a04c..5f32f62bbf7 100644 --- a/dlls/ncrypt/tests/ncrypt.c +++ b/dlls/ncrypt/tests/ncrypt.c @@ -232,17 +232,17 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND /* NCrypt properties */ {NCRYPT_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_UNIQUE_NAME_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, - {NCRYPT_ALGORITHM_PROPERTY, {'R', 0, 'S', 0, 'A', 0}, sizeof(L"RSA"), ERROR_SUCCESS, TRUE}, + {NCRYPT_ALGORITHM_PROPERTY, {'R', 0, 'S', 0, 'A', 0}, sizeof(L"RSA"), ERROR_SUCCESS}, {NCRYPT_LENGTH_PROPERTY, {0, 0x4} /* 1024 */, sizeof(DWORD)}, - {NCRYPT_LENGTHS_PROPERTY, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x8, 0, 0, 0, 0, 0x4, 0, 0}, sizeof(DWORD) * 4 /* NCRYPT_SUPPORTED_LENGTHS */, ERROR_SUCCESS, TRUE, ERROR_SUCCESS, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x40, 0, 0, 0, 0, 0x4, 0, 0}}, - {NCRYPT_BLOCK_LENGTH_PROPERTY, {0x80, 0, 0, 0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_LENGTHS_PROPERTY, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x8, 0, 0, 0, 0, 0x4, 0, 0}, sizeof(DWORD) * 4 /* NCRYPT_SUPPORTED_LENGTHS */, ERROR_SUCCESS, FALSE, ERROR_SUCCESS, {0, 0x2, 0, 0, 0, 0x40, 0, 0, 0x40, 0, 0, 0, 0, 0x4, 0, 0}}, + {NCRYPT_BLOCK_LENGTH_PROPERTY, {0x80, 0, 0, 0}, sizeof(DWORD), ERROR_SUCCESS}, {NCRYPT_UI_POLICY_PROPERTY, {0}, sizeof(NCRYPT_UI_POLICY), NTE_NOT_FOUND, TRUE}, - {NCRYPT_EXPORT_POLICY_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_EXPORT_POLICY_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS}, {NCRYPT_WINDOW_HANDLE_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, {NCRYPT_USE_CONTEXT_PROPERTY, {0}, 0, NTE_NOT_FOUND, TRUE}, {NCRYPT_IMPL_TYPE_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, - {NCRYPT_KEY_USAGE_PROPERTY, {0xff, 0xff, 0xff, 0} /* NCRYPT_ALLOW_ALL_USAGES */, sizeof(DWORD), ERROR_SUCCESS, TRUE}, - {NCRYPT_KEY_TYPE_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS, TRUE}, + {NCRYPT_KEY_USAGE_PROPERTY, {0xff, 0xff, 0xff, 0} /* NCRYPT_ALLOW_ALL_USAGES */, sizeof(DWORD), ERROR_SUCCESS}, + {NCRYPT_KEY_TYPE_PROPERTY, {0}, sizeof(DWORD), ERROR_SUCCESS}, {NCRYPT_VERSION_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {NCRYPT_SECURITY_DESCR_PROPERTY, {0}, 0, NTE_BAD_FLAGS, TRUE}, @@ -281,8 +281,8 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND {BCRYPT_OBJECT_LENGTH, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {BCRYPT_PADDING_SCHEMES, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, {BCRYPT_PROVIDER_HANDLE, {0}, 0, NTE_NOT_SUPPORTED, TRUE}, - {BCRYPT_SIGNATURE_LENGTH, {0x80, 0, 0, 0} /* 128 */, sizeof(DWORD), ERROR_SUCCESS, TRUE, NTE_NOT_SUPPORTED /* <= Win 8 */}, - {BCRYPT_PUBLIC_KEY_LENGTH, {0, 0x4} /* 1024 */, sizeof(DWORD), ERROR_SUCCESS, TRUE, NTE_NOT_SUPPORTED /* <= Win 8 */}, + {BCRYPT_SIGNATURE_LENGTH, {0x80, 0, 0, 0} /* 128 */, sizeof(DWORD), ERROR_SUCCESS, FALSE, NTE_NOT_SUPPORTED /* <= Win 8 */}, + {BCRYPT_PUBLIC_KEY_LENGTH, {0, 0x4} /* 1024 */, sizeof(DWORD), ERROR_SUCCESS, FALSE, NTE_NOT_SUPPORTED /* <= Win 8 */}, }; unsigned int i; From 219a3f436f831fa6ecc6ba13c609432b91cce522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 10:49:37 +0100 Subject: [PATCH 1100/1506] winex11: Consistently use set_focus to change foreground window. It does more than that and also waits for the window manager to release its grabs. CW-Bug-Id: #23288 CW-Bug-Id: #23320 --- dlls/winex11.drv/event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index cec5712ae32..89a7506b236 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -864,7 +864,12 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) if (!hwnd) hwnd = x11drv_thread_data()->last_focus; if (hwnd && can_activate_window(hwnd)) set_focus( event->display, hwnd, CurrentTime ); } - else NtUserSetForegroundWindow( hwnd ); + else + { + wait_grab_pointer( event->display ); + NtUserSetForegroundWindow( hwnd ); + } + return TRUE; } From a3d188ee2fa324ab12b01862f042942149b9704b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 16:20:45 +0100 Subject: [PATCH 1101/1506] fshack: winex11: Avoid calling into win32u with the fs_lock held. CW-Bug-Id: #23306 --- dlls/winex11.drv/fs.c | 141 +++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 78 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index aaef17d9a06..bda79419c69 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -393,6 +393,8 @@ static struct fs_monitor *monitor_from_settings_id( x11drv_settings_id settings_ struct gdi_gpu *gpus; int count; + pthread_mutex_lock( &fs_lock ); + LIST_FOR_EACH_ENTRY( monitor, &fs_monitors, struct fs_monitor, entry ) if (!memcmp( &monitor->settings_id, &settings_id, sizeof(settings_id) )) return monitor; @@ -406,9 +408,15 @@ static struct fs_monitor *monitor_from_settings_id( x11drv_settings_id settings_ } WARN( "Failed to find monitor for adapter id %p\n", (void *)settings_id.id ); + pthread_mutex_unlock( &fs_lock ); return NULL; } +static void monitor_release( struct fs_monitor *monitor ) +{ + pthread_mutex_unlock( &fs_lock ); +} + static BOOL fs_get_modes( x11drv_settings_id id, DWORD flags, DEVMODEW **new_modes, UINT *mode_count ) { struct fs_monitor *monitor; @@ -416,12 +424,12 @@ static BOOL fs_get_modes( x11drv_settings_id id, DWORD flags, DEVMODEW **new_mod TRACE( "id %#zx, flags %#x, modes %p, modes_count %p\n", (size_t)id.id, (int)flags, new_modes, mode_count ); - pthread_mutex_lock( &fs_lock ); - if ((monitor = monitor_from_settings_id( id ))) + { monitor_get_modes( monitor, new_modes, mode_count ); + monitor_release( monitor ); + } - pthread_mutex_unlock( &fs_lock ); return monitor && *new_modes; } @@ -436,10 +444,11 @@ static BOOL fs_get_current_mode( x11drv_settings_id settings_id, DEVMODEW *mode TRACE( "settings_id %p, mode %p\n", (void *)settings_id.id, mode ); - pthread_mutex_lock( &fs_lock ); if ((monitor = monitor_from_settings_id( settings_id ))) + { *mode = monitor->user_mode; - pthread_mutex_unlock( &fs_lock ); + monitor_release( monitor ); + } return !!monitor; } @@ -453,17 +462,12 @@ static LONG fs_set_current_mode( x11drv_settings_id settings_id, const DEVMODEW TRACE( "settings_id %p, mode %s\n", (void *)settings_id.id, debugstr_devmode( user_mode ) ); - pthread_mutex_lock( &fs_lock ); - if (!(fs_monitor = monitor_from_settings_id( settings_id ))) - { - pthread_mutex_unlock( &fs_lock ); return DISP_CHANGE_FAILED; - } if (is_detached_mode( &fs_monitor->real_mode ) && !is_detached_mode( user_mode )) { - pthread_mutex_unlock( &fs_lock ); + monitor_release( fs_monitor ); FIXME( "Attaching adapters is unsupported with fullscreen hack.\n" ); return DISP_CHANGE_SUCCESSFUL; } @@ -471,7 +475,7 @@ static LONG fs_set_current_mode( x11drv_settings_id settings_id, const DEVMODEW /* Real modes may be changed since initialization */ if (!real_settings_handler.get_current_mode( settings_id, &real_mode )) { - pthread_mutex_unlock( &fs_lock ); + monitor_release( fs_monitor ); return DISP_CHANGE_FAILED; } @@ -523,7 +527,7 @@ static LONG fs_set_current_mode( x11drv_settings_id settings_id, const DEVMODEW TRACE( "user_to_real_scale %lf\n", fs_monitor->user_to_real_scale ); TRACE( "top left corner:%s\n", wine_dbgstr_point( &fs_monitor->top_left ) ); - pthread_mutex_unlock( &fs_lock ); + monitor_release( fs_monitor ); return DISP_CHANGE_SUCCESSFUL; } @@ -599,7 +603,7 @@ static struct fs_monitor *monitor_from_handle( HMONITOR handle ) if (!NtUserGetMonitorInfo( handle, (MONITORINFO *)&info )) return NULL; is_primary = !!(info.dwFlags & MONITORINFOF_PRIMARY); - if (!real_settings_handler.get_id( info.szDevice, is_primary, &settings_id )) return FALSE; + if (!real_settings_handler.get_id( info.szDevice, is_primary, &settings_id )) return NULL; return monitor_from_settings_id( settings_id ); } @@ -611,12 +615,14 @@ BOOL fs_hack_enabled( HMONITOR monitor ) TRACE( "monitor %p\n", monitor ); - pthread_mutex_lock( &fs_lock ); - fs_monitor = monitor_from_handle( monitor ); - if (fs_monitor && (fs_monitor->user_mode.dmPelsWidth != fs_monitor->real_mode.dmPelsWidth || - fs_monitor->user_mode.dmPelsHeight != fs_monitor->real_mode.dmPelsHeight)) - enabled = TRUE; - pthread_mutex_unlock( &fs_lock ); + if ((fs_monitor = monitor_from_handle( monitor ))) + { + if (fs_monitor->user_mode.dmPelsWidth != fs_monitor->real_mode.dmPelsWidth || + fs_monitor->user_mode.dmPelsHeight != fs_monitor->real_mode.dmPelsHeight) + enabled = TRUE; + monitor_release( fs_monitor ); + } + TRACE( "enabled: %s\n", enabled ? "TRUE" : "FALSE" ); return enabled; } @@ -680,19 +686,15 @@ RECT fs_hack_current_mode( HMONITOR monitor ) TRACE( "monitor %p\n", monitor ); - pthread_mutex_lock( &fs_lock ); - fs_monitor = monitor_from_handle( monitor ); - if (!fs_monitor) + if ((fs_monitor = monitor_from_handle( monitor ))) { - pthread_mutex_unlock( &fs_lock ); - return rect; + rect.left = fs_monitor->user_mode.dmPosition.x; + rect.top = fs_monitor->user_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->user_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->user_mode.dmPelsHeight; + monitor_release( fs_monitor ); } - rect.left = fs_monitor->user_mode.dmPosition.x; - rect.top = fs_monitor->user_mode.dmPosition.y; - rect.right = rect.left + fs_monitor->user_mode.dmPelsWidth; - rect.bottom = rect.top + fs_monitor->user_mode.dmPelsHeight; - pthread_mutex_unlock( &fs_lock ); TRACE( "current mode rect: %s\n", wine_dbgstr_rect( &rect ) ); return rect; } @@ -705,19 +707,15 @@ RECT fs_hack_real_mode( HMONITOR monitor ) TRACE( "monitor %p\n", monitor ); - pthread_mutex_lock( &fs_lock ); - fs_monitor = monitor_from_handle( monitor ); - if (!fs_monitor) + if ((fs_monitor = monitor_from_handle( monitor ))) { - pthread_mutex_unlock( &fs_lock ); - return rect; + rect.left = fs_monitor->real_mode.dmPosition.x; + rect.top = fs_monitor->real_mode.dmPosition.y; + rect.right = rect.left + fs_monitor->real_mode.dmPelsWidth; + rect.bottom = rect.top + fs_monitor->real_mode.dmPelsHeight; + monitor_release( fs_monitor ); } - rect.left = fs_monitor->real_mode.dmPosition.x; - rect.top = fs_monitor->real_mode.dmPosition.y; - rect.right = rect.left + fs_monitor->real_mode.dmPelsWidth; - rect.bottom = rect.top + fs_monitor->real_mode.dmPelsHeight; - pthread_mutex_unlock( &fs_lock ); TRACE( "real mode rect: %s\n", wine_dbgstr_rect( &rect ) ); return rect; } @@ -867,23 +865,19 @@ void fs_hack_rect_user_to_real( RECT *rect ) SetRect( &point, rect->left, rect->top, rect->left + 1, rect->top + 1 ); monitor = NtUserMonitorFromRect( &point, MONITOR_DEFAULTTONEAREST ); - pthread_mutex_lock( &fs_lock ); - fs_monitor = monitor_from_handle( monitor ); - if (!fs_monitor) + + if ((fs_monitor = monitor_from_handle( monitor ))) { - pthread_mutex_unlock( &fs_lock ); - WARN( "%s not transformed.\n", wine_dbgstr_rect( rect ) ); - return; + OffsetRect( rect, -fs_monitor->user_mode.dmPosition.x, + -fs_monitor->user_mode.dmPosition.y ); + rect->left = lround( rect->left * fs_monitor->user_to_real_scale ); + rect->right = lround( rect->right * fs_monitor->user_to_real_scale ); + rect->top = lround( rect->top * fs_monitor->user_to_real_scale ); + rect->bottom = lround( rect->bottom * fs_monitor->user_to_real_scale ); + OffsetRect( rect, fs_monitor->top_left.x, fs_monitor->top_left.y ); + monitor_release( fs_monitor ); } - OffsetRect( rect, -fs_monitor->user_mode.dmPosition.x, - -fs_monitor->user_mode.dmPosition.y ); - rect->left = lround( rect->left * fs_monitor->user_to_real_scale ); - rect->right = lround( rect->right * fs_monitor->user_to_real_scale ); - rect->top = lround( rect->top * fs_monitor->user_to_real_scale ); - rect->bottom = lround( rect->bottom * fs_monitor->user_to_real_scale ); - OffsetRect( rect, fs_monitor->top_left.x, fs_monitor->top_left.y ); - pthread_mutex_unlock( &fs_lock ); TRACE( "to %s\n", wine_dbgstr_rect( rect ) ); } @@ -897,16 +891,12 @@ double fs_hack_get_user_to_real_scale( HMONITOR monitor ) if (wm_is_steamcompmgr( NULL )) return scale; - pthread_mutex_lock( &fs_lock ); - fs_monitor = monitor_from_handle( monitor ); - if (!fs_monitor) + if ((fs_monitor = monitor_from_handle( monitor ))) { - pthread_mutex_unlock( &fs_lock ); - return scale; + scale = fs_monitor->user_to_real_scale; + monitor_release( fs_monitor ); } - scale = fs_monitor->user_to_real_scale; - pthread_mutex_unlock( &fs_lock ); TRACE( "scale %lf\n", scale ); return scale; } @@ -919,26 +909,21 @@ SIZE fs_hack_get_scaled_screen_size( HMONITOR monitor ) TRACE( "monitor %p\n", monitor ); - pthread_mutex_lock( &fs_lock ); - fs_monitor = monitor_from_handle( monitor ); - if (!fs_monitor) - { - pthread_mutex_unlock( &fs_lock ); - return size; - } - - if (wm_is_steamcompmgr( NULL )) + if ((fs_monitor = monitor_from_handle( monitor ))) { - pthread_mutex_unlock( &fs_lock ); - size.cx = fs_monitor->user_mode.dmPelsWidth; - size.cy = fs_monitor->user_mode.dmPelsHeight; - TRACE( "width %d height %d\n", (int)size.cx, (int)size.cy ); - return size; + if (wm_is_steamcompmgr( NULL )) + { + size.cx = fs_monitor->user_mode.dmPelsWidth; + size.cy = fs_monitor->user_mode.dmPelsHeight; + } + else + { + size.cx = lround( fs_monitor->user_mode.dmPelsWidth * fs_monitor->user_to_real_scale ); + size.cy = lround( fs_monitor->user_mode.dmPelsHeight * fs_monitor->user_to_real_scale ); + } + monitor_release( fs_monitor ); } - size.cx = lround( fs_monitor->user_mode.dmPelsWidth * fs_monitor->user_to_real_scale ); - size.cy = lround( fs_monitor->user_mode.dmPelsHeight * fs_monitor->user_to_real_scale ); - pthread_mutex_unlock( &fs_lock ); TRACE( "width %d height %d\n", (int)size.cx, (int)size.cy ); return size; } From a6733eafb6eed0659338145f7161a78cf227c558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Jan 2024 19:29:15 +0100 Subject: [PATCH 1102/1506] winegstreamer: Ask GStreamer to stop messing with signal handlers. CW-Bug-Id: #23311 --- dlls/winegstreamer/unixlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index 93a86d6b8cb..53c1328c0ab 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -273,6 +273,8 @@ NTSTATUS wg_init_gstreamer(void *arg) setenv("GST_REGISTRY_1_0", gst_reg, 1); } + gst_segtrap_set_enabled(false); + if (!gst_init_check(&argc, &argv, &err)) { fprintf(stderr, "winegstreamer: failed to initialize GStreamer: %s\n", err->message); From 6c0a373d571a41820ab9c1737afc5dbc7fb9b11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 Jan 2024 11:39:11 +0100 Subject: [PATCH 1103/1506] winebus: Disable SDL2.30 new behavior for the SDL unix backend. CW-Bug-Id: #23185 --- dlls/winebus.sys/bus_sdl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 119293fa2d9..674da28f8e4 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -115,6 +115,7 @@ MAKE_FUNCPTR(SDL_RegisterEvents); MAKE_FUNCPTR(SDL_PushEvent); MAKE_FUNCPTR(SDL_GetTicks); MAKE_FUNCPTR(SDL_LogSetPriority); +MAKE_FUNCPTR(SDL_SetHint); static int (*pSDL_JoystickRumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); static int (*pSDL_JoystickRumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); static Uint16 (*pSDL_JoystickGetProduct)(SDL_Joystick * joystick); @@ -1184,6 +1185,7 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_PushEvent); LOAD_FUNCPTR(SDL_GetTicks); LOAD_FUNCPTR(SDL_LogSetPriority); + LOAD_FUNCPTR(SDL_SetHint); #undef LOAD_FUNCPTR pSDL_JoystickRumble = dlsym(sdl_handle, "SDL_JoystickRumble"); pSDL_JoystickRumbleTriggers = dlsym(sdl_handle, "SDL_JoystickRumbleTriggers"); @@ -1193,6 +1195,10 @@ NTSTATUS sdl_bus_init(void *args) pSDL_JoystickGetType = dlsym(sdl_handle, "SDL_JoystickGetType"); pSDL_JoystickGetSerial = dlsym(sdl_handle, "SDL_JoystickGetSerial"); + /* CW-Bug-Id: #23185: Disable SDL 2.30 new behavior, we need the steam virtual + * controller name to figure which slot number it represents. */ + pSDL_SetHint("SteamVirtualGamepadInfo", ""); + if (pSDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0) { ERR("could not init SDL: %s\n", pSDL_GetError()); From 61ce3bbe5d9f4091cde93d4140061dc09d95b0a4 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 26 Jan 2024 16:38:38 +0000 Subject: [PATCH 1104/1506] gdiplus: Prefer Tahoma for generic sans serif font. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55421 Partial revert of 413fc34be7fca948dc53b3eb8cd1a08e951f2b4e. CW-Bug-Id: #23253 --- dlls/gdiplus/font.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 0dcfad34bbb..da37279fbef 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -1037,13 +1037,13 @@ GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamil stat = GdipCreateFontFamilyFromName(L"Microsoft Sans Serif", NULL, nativeFamily); if (stat == FontFamilyNotFound) - stat = GdipCreateFontFamilyFromName(L"Arial", NULL, nativeFamily); + stat = GdipCreateFontFamilyFromName(L"Tahoma", NULL, nativeFamily); if (stat == FontFamilyNotFound) - stat = GdipCreateFontFamilyFromName(L"Liberation Sans", NULL, nativeFamily); + stat = GdipCreateFontFamilyFromName(L"Arial", NULL, nativeFamily); if (stat == FontFamilyNotFound) - stat = GdipCreateFontFamilyFromName(L"Tahoma", NULL, nativeFamily); + stat = GdipCreateFontFamilyFromName(L"Liberation Sans", NULL, nativeFamily); return stat; } From 11511dfebb9ffd465a8eeb8fca6ad5e2bfbd012b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 26 Jan 2024 23:01:11 -0600 Subject: [PATCH 1105/1506] kernelbase: Workaround forced stack aligment for SignalObjectAndWait(). CW-Bug-Id: #23256 --- dlls/kernelbase/sync.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c index 406af74c269..7406291ed78 100644 --- a/dlls/kernelbase/sync.c +++ b/dlls/kernelbase/sync.c @@ -284,7 +284,11 @@ DWORD WINAPI DECLSPEC_HOTPATCH SignalObjectAndWait( HANDLE signal, HANDLE wait, DWORD timeout, BOOL alertable ) { NTSTATUS status; +#ifdef __i386__ + DECLSPEC_ALIGN(4) LARGE_INTEGER time; +#else LARGE_INTEGER time; +#endif TRACE( "%p %p %ld %d\n", signal, wait, timeout, alertable ); From 75879a2aa9087f2e3cc9f9acf864cf952357c136 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 30 Jan 2024 23:28:04 +0200 Subject: [PATCH 1106/1506] kernelbase: HACK: Add --use-gl=swiftshader for another game. CW-Bug-Id: #23297 --- dlls/kernelbase/process.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 81169ccddd6..6952f631d6d 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -590,6 +590,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) { const WCHAR *exe_name; const WCHAR *append; + const char *steamgameid; } options[] = { @@ -606,8 +607,10 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"EverQuest 2\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"Everquest F2P\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"Red Tie Runner.exe", L" --use-angle=gl"}, + {L"UnrealCEFSubProcess.exe", L" --use-gl=swiftshader", "2316580"}, }; unsigned int i; + char sgi[64]; if (!cmd) return NULL; @@ -615,6 +618,9 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) { if (wcsstr( cmd, options[i].exe_name )) { + if (options[i].steamgameid && !(GetEnvironmentVariableA( "SteamGameId", sgi, sizeof(sgi) ) + && !strcmp( sgi, options[i].steamgameid ))) + continue; FIXME( "HACK: appending %s to command line.\n", debugstr_w(options[i].append) ); return options[i].append; } From cdd03370324d4a2ae9b3ec95ec3f7752dfb85774 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 30 Jan 2024 00:18:58 +0200 Subject: [PATCH 1107/1506] winebus.sys: Fix units used for hat switches. The 0xe nibble value is reserved and makes hid-decode from hid-tools crash while tryign to parse the descriptor. 0x0 is the correct way of expressing no special units are used. (cherry picked from commit 94a7b32a55fa46d7156907b8ea6b68b545cb3122) CW-Bug-Id: #23201 --- dlls/winebus.sys/hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index 6d2b484ccca..733f9a51f96 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -233,7 +233,7 @@ BOOL hid_device_add_hatswitch(struct unix_device *iface, INT count) LOGICAL_MAXIMUM(1, 8), REPORT_SIZE(1, 8), REPORT_COUNT(4, count), - UNIT(1, 0x0e /* none */), + UNIT(1, 0x0), /* None */ INPUT(1, Data|Var|Abs|Null), }; From d293e2149089161d16d47857ce4a966b23450a66 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 30 Jan 2024 00:20:55 +0200 Subject: [PATCH 1108/1506] winebus.sys: Use 4 bits for hat switches. Declaring them as 8 bits crashes game due to how Unity's native hid support parses the data. (cherry picked from commit e3431a02e1d23ad506512b906f244eae1db05035) CW-Bug-Id: #23201 --- dlls/winebus.sys/hid.c | 74 ++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c index 733f9a51f96..d31718c6293 100644 --- a/dlls/winebus.sys/hid.c +++ b/dlls/winebus.sys/hid.c @@ -209,13 +209,14 @@ static BOOL hid_device_add_hatswitch_count(struct unix_device *iface, BYTE count ERR("hatswitches should be added before buttons!\n"); else if ((iface->hid_device_state.bit_size % 8)) ERR("hatswitches should be byte aligned, missing padding!\n"); - else if (iface->hid_device_state.bit_size + 8 * count > 0x80000) + else if (iface->hid_device_state.bit_size + 4 * (count + 1) > 0x80000) ERR("report size overflow, too many elements!\n"); else { if (!iface->hid_device_state.hatswitch_count) iface->hid_device_state.hatswitch_start = offset; iface->hid_device_state.hatswitch_count += count; - iface->hid_device_state.bit_size += 8 * count; + iface->hid_device_state.bit_size += 4 * count; + if (count % 2) iface->hid_device_state.bit_size += 4; return TRUE; } @@ -231,16 +232,28 @@ BOOL hid_device_add_hatswitch(struct unix_device *iface, INT count) USAGE(1, HID_USAGE_GENERIC_HATSWITCH), LOGICAL_MINIMUM(1, 1), LOGICAL_MAXIMUM(1, 8), - REPORT_SIZE(1, 8), + REPORT_SIZE(1, 4), REPORT_COUNT(4, count), UNIT(1, 0x0), /* None */ INPUT(1, Data|Var|Abs|Null), }; + const BYTE template_pad[] = + { + REPORT_COUNT(1, 4), + REPORT_SIZE(1, 1), + INPUT(1, Cnst|Ary|Abs), + }; if (!hid_device_add_hatswitch_count(iface, count)) return FALSE; - return hid_report_descriptor_append(desc, template, sizeof(template)); + if (!hid_report_descriptor_append(desc, template, sizeof(template))) + return FALSE; + + if ((count % 2) && !hid_report_descriptor_append(desc, template_pad, sizeof(template_pad))) + return FALSE; + + return TRUE; } static BOOL hid_device_add_axis_count(struct unix_device *iface, BOOL rel, BYTE count, @@ -1409,8 +1422,9 @@ BOOL hid_device_set_button(struct unix_device *iface, ULONG index, BOOL is_set) * +1 | 6 5 4 * v */ -static void hatswitch_decompose(BYTE value, LONG *x, LONG *y) +static void hatswitch_decompose(BYTE value, ULONG index, LONG *x, LONG *y) { + value = (index % 2) ? (value >> 4) : (value & 0x0f); *x = *y = 0; if (value == 8 || value == 1 || value == 2) *y = -1; if (value == 6 || value == 5 || value == 4) *y = +1; @@ -1418,49 +1432,61 @@ static void hatswitch_decompose(BYTE value, LONG *x, LONG *y) if (value == 2 || value == 3 || value == 4) *x = +1; } -static void hatswitch_compose(LONG x, LONG y, BYTE *value) +static void hatswitch_compose(LONG x, LONG y, BYTE *value, ULONG index) { - if (x == 0 && y == 0) *value = 0; - else if (x == 0 && y < 0) *value = 1; - else if (x > 0 && y < 0) *value = 2; - else if (x > 0 && y == 0) *value = 3; - else if (x > 0 && y > 0) *value = 4; - else if (x == 0 && y > 0) *value = 5; - else if (x < 0 && y > 0) *value = 6; - else if (x < 0 && y == 0) *value = 7; - else if (x < 0 && y < 0) *value = 8; + BYTE new_value = 0; + if (x == 0 && y == 0) new_value = 0; + else if (x == 0 && y < 0) new_value = 1; + else if (x > 0 && y < 0) new_value = 2; + else if (x > 0 && y == 0) new_value = 3; + else if (x > 0 && y > 0) new_value = 4; + else if (x == 0 && y > 0) new_value = 5; + else if (x < 0 && y > 0) new_value = 6; + else if (x < 0 && y == 0) new_value = 7; + else if (x < 0 && y < 0) new_value = 8; + + if (index % 2) + { + *value &= 0xf; + *value |= new_value << 4; + } + else + { + *value &= 0xf0; + *value |= new_value; + } } BOOL hid_device_set_hatswitch_x(struct unix_device *iface, ULONG index, LONG new_x) { struct hid_device_state *state = &iface->hid_device_state; - ULONG offset = state->hatswitch_start + index; + ULONG offset = state->hatswitch_start + index / 2; LONG x, y; if (index > state->hatswitch_count) return FALSE; - hatswitch_decompose(state->report_buf[offset], &x, &y); - hatswitch_compose(new_x, y, &state->report_buf[offset]); + hatswitch_decompose(state->report_buf[offset], index, &x, &y); + hatswitch_compose(new_x, y, &state->report_buf[offset], index); return TRUE; } BOOL hid_device_set_hatswitch_y(struct unix_device *iface, ULONG index, LONG new_y) { struct hid_device_state *state = &iface->hid_device_state; - ULONG offset = state->hatswitch_start + index; + ULONG offset = state->hatswitch_start + index / 2; LONG x, y; if (index > state->hatswitch_count) return FALSE; - hatswitch_decompose(state->report_buf[offset], &x, &y); - hatswitch_compose(x, new_y, &state->report_buf[offset]); + hatswitch_decompose(state->report_buf[offset], index, &x, &y); + hatswitch_compose(x, new_y, &state->report_buf[offset], index); return TRUE; } BOOL hid_device_move_hatswitch(struct unix_device *iface, ULONG index, LONG x, LONG y) { struct hid_device_state *state = &iface->hid_device_state; - ULONG offset = state->hatswitch_start + index; + ULONG offset = state->hatswitch_start + index / 2; LONG old_x, old_y; if (index > state->hatswitch_count) return FALSE; - hatswitch_decompose(state->report_buf[offset], &old_x, &old_y); - hatswitch_compose(old_x + x, old_y + y, &state->report_buf[offset]); + hatswitch_decompose(state->report_buf[offset], index, &old_x, &old_y); + hatswitch_compose(old_x + x, old_y + y, &state->report_buf[offset], index); return TRUE; } From 90302c7353170177a422694b821849e226591ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 31 Jan 2024 17:30:20 +0100 Subject: [PATCH 1109/1506] explorer: Create the standalone systray window with WS_EX_NOACTIVATE. CW-Bug-Id: #23341 --- programs/explorer/systray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index bdd9f80a6f3..84ae37d8b36 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -1161,7 +1161,7 @@ void initialize_systray( BOOL using_root, BOOL arg_enable_shell ) else { SIZE size = get_window_size(); - tray_window = CreateWindowExW( 0, shell_traywnd_class.lpszClassName, L"", WS_CAPTION | WS_SYSMENU, + tray_window = CreateWindowExW( WS_EX_NOACTIVATE, shell_traywnd_class.lpszClassName, L"", WS_CAPTION | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, size.cx, size.cy, 0, 0, 0, 0 ); NtUserMessageCall( tray_window, WINE_SYSTRAY_DOCK_INIT, 0, 0, NULL, NtUserSystemTrayCall, FALSE ); } From 547570939479e7e53044ee17879de7480c095978 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 1 Feb 2024 16:30:57 +0800 Subject: [PATCH 1110/1506] HACK: gamescope: user32: Disable gamescope undecorated windows hack for The Last Game. The Last Game (2563800) doesn't expect its game window client rect equals to window rect. CW-Bug-Id: #23342 --- dlls/user32/nonclient.c | 12 ++++++++++-- dlls/win32u/defwnd.c | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 61648c758ff..96c859700cd 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include "user_private.h" #include "controls.h" #include "wine/debug.h" @@ -32,8 +33,15 @@ static void adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD exStyl { int adjust = 0; - if (__wine_get_window_manager() == WINE_WM_X11_STEAMCOMPMGR && !((style & WS_POPUP) && (exStyle & WS_EX_TOOLWINDOW))) - return; + if (__wine_get_window_manager() == WINE_WM_X11_STEAMCOMPMGR) + { + /* Disable gamescope undecorated windows hack for following games. They don't expect client + * rect equals to window rect when in windowed mode. */ + const char *sgi = getenv( "SteamGameId" ); + if (!((style & WS_POPUP) && (exStyle & WS_EX_TOOLWINDOW)) && /* Bug 20038: game splash screens */ + !(sgi && !strcmp( sgi, "2563800" ))) /* Bug 23342: The Last Game */ + return; + } if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) adjust = 1; /* for the outer frame always present */ diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 83d21dff680..d68fd2b7f23 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -24,6 +24,7 @@ #pragma makedep unix #endif +#include #include "ntgdi_private.h" #include "ntuser_private.h" #include "wine/server.h" @@ -1865,8 +1866,15 @@ static void handle_nc_calc_size( HWND hwnd, WPARAM wparam, RECT *win_rect ) if (!win_rect) return; - if (__wine_get_window_manager() == WINE_WM_X11_STEAMCOMPMGR && !((style & WS_POPUP) && (ex_style & WS_EX_TOOLWINDOW))) - return; + if (__wine_get_window_manager() == WINE_WM_X11_STEAMCOMPMGR) + { + /* Disable gamescope undecorated windows hack for following games. They don't expect client + * rect equals to window rect when in windowed mode. */ + const char *sgi = getenv( "SteamGameId" ); + if (!((style & WS_POPUP) && (ex_style & WS_EX_TOOLWINDOW)) && /* Bug 20038: game splash screens */ + !(sgi && !strcmp( sgi, "2563800" ))) /* Bug 23342: The Last Game */ + return; + } if (!(style & WS_MINIMIZE)) { From ef472aeb231b03d7dc42cffacbe761d0c3b4c9fe Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 6 Feb 2024 15:37:47 -0600 Subject: [PATCH 1111/1506] kernelbase: HACK: Force Vulkan rendering for EACefSubProcess. CW-Bug-Id: #23363 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 6952f631d6d..7ea75b58a9b 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -608,6 +608,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"Everquest F2P\\LaunchPad.exe", L" --use-gl=swiftshader"}, {L"Red Tie Runner.exe", L" --use-angle=gl"}, {L"UnrealCEFSubProcess.exe", L" --use-gl=swiftshader", "2316580"}, + {L"\\EACefSubProcess.exe", L" --use-angle=vulkan"}, }; unsigned int i; char sgi[64]; From 8bcb205ddc51df52684bff307ad30906cf5de4b0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 6 Feb 2024 16:13:37 -0600 Subject: [PATCH 1112/1506] ntdll: HACK: Enable WINE_SIMULATE_WRITECOPY for Dinogen Online. CW-Bug-Id: #23379 --- dlls/ntdll/unix/loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 16e9324ff4a..aaf5964d8d3 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2103,6 +2103,7 @@ static void hacks_init(void) || !strcmp(sgi, "2095300") /* Breakout 13 */ || !strcmp(sgi, "2053940") /* Idol Hands 2 */ || !strcmp(sgi, "391150") /* Red Tie Runner */ + || !strcmp(sgi, "2152990") /* Dinogen Online */ || !strcmp(sgi, "2176450"); /* Mr. Hopp's Playhouse 3 */ if (sgi) wine_allocs_2g_limit = !strcmp(sgi, "359870"); From 24fb10aa2a8fa29580c08551272af8f85600023e Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Sat, 3 Feb 2024 14:45:36 +0200 Subject: [PATCH 1113/1506] wbemprox/tests: Test LIKE queries. (cherry picked from commit 332d48364faabaf3d2ec6aedd2be1e7bede029ad) --- dlls/wbemprox/tests/query.c | 79 +++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 825ad2459f5..fb173f5d6f4 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -140,6 +140,84 @@ static void test_select( IWbemServices *services ) SysFreeString( query ); } +static void check_explorer_like_query( IWbemServices *services, const WCHAR *str, BOOL expect_success, BOOL todo) +{ + HRESULT hr; + IWbemClassObject *obj[2]; + BSTR wql = SysAllocString( L"wql" ), query = SysAllocString( str ); + LONG flags = WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY; + ULONG count; + IEnumWbemClassObject *result; + + hr = IWbemServices_ExecQuery( services, wql, query, flags, NULL, &result ); + if (hr == S_OK) + { + VARIANT var; + IEnumWbemClassObject_Next( result, 10000, 2, obj, &count ); + + todo_wine_if(todo) + ok( count == (expect_success ? 1 : 0), "expected to get %d results but got %lu\n", + (expect_success ? 1 : 0), count); + + if (count) + { + BSTR caption; + hr = IWbemClassObject_Get( obj[0], L"Caption", 0, &var, NULL, NULL ); + ok( hr == WBEM_S_NO_ERROR, "IWbemClassObject_Get failed %#lx", hr); + caption = V_BSTR(&var); + ok( !wcscmp( caption, L"explorer.exe" ), "%s is not explorer.exe\n", debugstr_w(caption)); + VariantClear( &var ); + } + + while (count--) + IWbemClassObject_Release( obj[count] ); + } + + SysFreeString( wql ); + SysFreeString( query ); +} + + +static void test_like_query( IWbemServices *services ) +{ + int i; + WCHAR query[250]; + + struct { + BOOL todo; + BOOL expect_success; + const WCHAR *str; + } queries[] = { + { FALSE, TRUE, L"explorer%" }, + { FALSE, FALSE, L"xplorer.exe" }, + { TRUE, FALSE, L"explorer.ex" }, + { FALSE, TRUE, L"%explorer%" }, + { FALSE, TRUE, L"explorer.exe%" }, + { FALSE, TRUE, L"%explorer.exe%" }, + { TRUE, TRUE, L"%plorer.exe" }, + { TRUE, TRUE, L"%plorer.exe%" }, + { TRUE, TRUE, L"__plorer.exe" }, + { TRUE, TRUE, L"e_plorer.exe" }, + { FALSE, FALSE, L"_plorer.exe" }, + { TRUE, TRUE, L"%%%plorer.e%" }, + { TRUE, TRUE, L"%plorer.e%" }, + { TRUE, TRUE, L"%plorer.e_e" }, + { TRUE, TRUE, L"%plorer.e_e" }, + { TRUE, TRUE, L"explore%exe" }, + { FALSE, FALSE, L"fancy_explore.exe" }, + { FALSE, FALSE, L"fancy%xplore%exe" }, + { FALSE, FALSE, L"%%%f%xplore%exe" }, + }; + + for (i = 0; i < ARRAYSIZE(queries); i++) + { + wsprintfW( query, L"SELECT * FROM Win32_Process WHERE Caption LIKE '%ls'", queries[i].str ); + trace("%s\n", wine_dbgstr_w(query)); + check_explorer_like_query( services, query, queries[i].expect_success, queries[i].todo ); + } +} + + static void test_associators( IWbemServices *services ) { static const WCHAR *test[] = @@ -2366,6 +2444,7 @@ START_TEST(query) test_query_async( services ); test_query_semisync( services ); test_select( services ); + test_like_query( services ); /* classes */ test_SoftwareLicensingProduct( services ); From c5a48238e5422e07618b22e27a38c40ee70eb8f5 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 1 Feb 2024 15:51:54 +0200 Subject: [PATCH 1114/1506] wbemprox: Reimplement LIKE. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current implementation handles correctly % only at the end of the string. Nothing else matches. The new implementation while naïve and recursive handles both _ and * correctly. (cherry picked from commit f67279c57fa30a3dfc5ed23e101d7b2f64d04d85) --- dlls/wbemprox/query.c | 29 ++++++++++++++---------- dlls/wbemprox/tests/query.c | 44 ++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index 1087e271837..d7990305003 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -93,23 +93,30 @@ void destroy_view( struct view *view ) free( view ); } -static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr ) +static BOOL eval_like( const WCHAR *text, const WCHAR *pattern ) { - const WCHAR *p = lstr, *q = rstr; + if (wcsstr( pattern, L"[" )) FIXME( "character ranges (i.e. [abc], [^a-z]) are not supported\n" ); - while (*p && *q) + while (*text) { - if (q[0] == '\\' && q[1] == '\\') q++; - if (*q == '%') + if (pattern[0] == '\\' && pattern[1] == '\\') pattern++; + + if (*pattern == '%') { - while (*q == '%') q++; - if (!*q) return TRUE; - while (*p && *q && towupper( *p ) == towupper( *q )) { p++; q++; }; - if (!*p && !*q) return TRUE; + while (*pattern == '%') pattern++; + if (!*pattern) return TRUE; + while (!eval_like( text, pattern ) && *text) text++; + + return !!*text; } - if (*q != '%' && towupper( *p++ ) != towupper( *q++ )) return FALSE; + + if (*pattern != '_' && towupper( *text ) != towupper( *pattern )) return FALSE; + text++; pattern++; } - return TRUE; + + while (*pattern == '%') pattern++; + + return *pattern == '\0'; } static HRESULT eval_strcmp( UINT op, const WCHAR *lstr, const WCHAR *rstr, LONGLONG *val ) diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index fb173f5d6f4..f5a3c2a14cd 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -140,7 +140,7 @@ static void test_select( IWbemServices *services ) SysFreeString( query ); } -static void check_explorer_like_query( IWbemServices *services, const WCHAR *str, BOOL expect_success, BOOL todo) +static void check_explorer_like_query( IWbemServices *services, const WCHAR *str, BOOL expect_success) { HRESULT hr; IWbemClassObject *obj[2]; @@ -155,7 +155,6 @@ static void check_explorer_like_query( IWbemServices *services, const WCHAR *str VARIANT var; IEnumWbemClassObject_Next( result, 10000, 2, obj, &count ); - todo_wine_if(todo) ok( count == (expect_success ? 1 : 0), "expected to get %d results but got %lu\n", (expect_success ? 1 : 0), count); @@ -184,36 +183,35 @@ static void test_like_query( IWbemServices *services ) WCHAR query[250]; struct { - BOOL todo; BOOL expect_success; const WCHAR *str; } queries[] = { - { FALSE, TRUE, L"explorer%" }, - { FALSE, FALSE, L"xplorer.exe" }, - { TRUE, FALSE, L"explorer.ex" }, - { FALSE, TRUE, L"%explorer%" }, - { FALSE, TRUE, L"explorer.exe%" }, - { FALSE, TRUE, L"%explorer.exe%" }, - { TRUE, TRUE, L"%plorer.exe" }, - { TRUE, TRUE, L"%plorer.exe%" }, - { TRUE, TRUE, L"__plorer.exe" }, - { TRUE, TRUE, L"e_plorer.exe" }, - { FALSE, FALSE, L"_plorer.exe" }, - { TRUE, TRUE, L"%%%plorer.e%" }, - { TRUE, TRUE, L"%plorer.e%" }, - { TRUE, TRUE, L"%plorer.e_e" }, - { TRUE, TRUE, L"%plorer.e_e" }, - { TRUE, TRUE, L"explore%exe" }, - { FALSE, FALSE, L"fancy_explore.exe" }, - { FALSE, FALSE, L"fancy%xplore%exe" }, - { FALSE, FALSE, L"%%%f%xplore%exe" }, + { TRUE, L"explorer%" }, + { FALSE, L"xplorer.exe" }, + { FALSE, L"explorer.ex" }, + { TRUE, L"%explorer%" }, + { TRUE, L"explorer.exe%" }, + { TRUE, L"%explorer.exe%" }, + { TRUE, L"%plorer.exe" }, + { TRUE, L"%plorer.exe%" }, + { TRUE, L"__plorer.exe" }, + { TRUE, L"e_plorer.exe" }, + { FALSE, L"_plorer.exe" }, + { TRUE, L"%%%plorer.e%" }, + { TRUE, L"%plorer.e%" }, + { TRUE, L"%plorer.e_e" }, + { TRUE, L"%plorer.e_e" }, + { TRUE, L"explore%exe" }, + { FALSE, L"fancy_explore.exe" }, + { FALSE, L"fancy%xplore%exe" }, + { FALSE, L"%%%f%xplore%exe" }, }; for (i = 0; i < ARRAYSIZE(queries); i++) { wsprintfW( query, L"SELECT * FROM Win32_Process WHERE Caption LIKE '%ls'", queries[i].str ); trace("%s\n", wine_dbgstr_w(query)); - check_explorer_like_query( services, query, queries[i].expect_success, queries[i].todo ); + check_explorer_like_query( services, query, queries[i].expect_success ); } } From 67a77df8c228934bb50b4f6c3fb42a054f8aeff5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 29 Jan 2024 18:11:25 -0600 Subject: [PATCH 1115/1506] server: Check if we have waiting asyncs in (send_socket) before enforcing blocking send. (cherry picked from commit aac099826259b143710ce42bbe6fadcbda1563a8) --- dlls/ws2_32/tests/sock.c | 42 ++++++++++++++++++++++++++++++++++++++++ server/async.c | 10 ++++++++++ server/file.h | 1 + server/sock.c | 2 +- 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index c2345c1fa60..ccdb6ab7d9f 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -3106,6 +3106,29 @@ static test_setup tests [] = } }; +struct send_udp_thread_param +{ + int sock; + HANDLE start_event; +}; + +static DWORD WINAPI send_udp_thread( void *param ) +{ + struct send_udp_thread_param *p = param; + static char buf[256]; + unsigned int i; + int ret; + + WaitForSingleObject( p->start_event, INFINITE ); + for (i = 0; i < 256; ++i) + { + ret = send( p->sock, buf, sizeof(buf), 0 ); + ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i ); + } + + return 0; +} + static void test_UDP(void) { /* This function tests UDP sendto() and recvfrom(). UDP is unreliable, so it is @@ -3117,6 +3140,9 @@ static void test_UDP(void) int ss, i, n_recv, n_sent, ret; struct sockaddr_in addr; int sock; + struct send_udp_thread_param udp_thread_param; + HANDLE thread; + memset (buf,0,sizeof(buf)); for ( i = NUM_UDP_PEERS - 1; i >= 0; i-- ) { @@ -3174,6 +3200,22 @@ static void test_UDP(void) ok( ret == sizeof(buf), "got %d, error %u.\n", ret, WSAGetLastError() ); } + /* Test sending packets in parallel (mostly a regression test for Wine async handling race conditions). */ + set_blocking( sock, FALSE ); + + udp_thread_param.sock = sock; + udp_thread_param.start_event = CreateEventW( NULL, FALSE, FALSE, NULL ); + thread = CreateThread( NULL, 0, send_udp_thread, &udp_thread_param, 0, NULL ); + SetEvent( udp_thread_param.start_event ); + for (i = 0; i < 256; ++i) + { + ret = send( sock, buf, sizeof(buf), 0 ); + ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i ); + } + WaitForSingleObject( thread, INFINITE ); + CloseHandle( thread ); + CloseHandle( udp_thread_param.start_event ); + closesocket(sock); } diff --git a/server/async.c b/server/async.c index 91f0d87f9df..fa21285bc05 100644 --- a/server/async.c +++ b/server/async.c @@ -553,6 +553,16 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota } } +int async_queue_has_waiting_asyncs( struct async_queue *queue ) +{ + struct async *async; + + LIST_FOR_EACH_ENTRY( async, &queue->queue, struct async, queue_entry ) + if (!async->unknown_status) return 1; + + return 0; +} + /* check if an async operation is waiting to be alerted */ int async_waiting( struct async_queue *queue ) { diff --git a/server/file.h b/server/file.h index 7374eab536d..f5f1ed357ae 100644 --- a/server/file.h +++ b/server/file.h @@ -253,6 +253,7 @@ extern void set_async_pending( struct async *async ); extern void async_set_initial_status( struct async *async, unsigned int status ); extern void async_wake_obj( struct async *async ); extern int async_waiting( struct async_queue *queue ); +extern int async_queue_has_waiting_asyncs( struct async_queue *queue ); extern void async_terminate( struct async *async, unsigned int status ); extern void async_request_complete( struct async *async, unsigned int status, data_size_t result, data_size_t out_size, void *out_data ); diff --git a/server/sock.c b/server/sock.c index 9283ad07cbb..15137951d0d 100644 --- a/server/sock.c +++ b/server/sock.c @@ -3955,7 +3955,7 @@ DECL_HANDLER(send_socket) if (bind_errno) status = sock_get_ntstatus( bind_errno ); else if (sock->wr_shutdown) status = STATUS_PIPE_DISCONNECTED; - else if (!async_queued( &sock->write_q )) + else if (!async_queue_has_waiting_asyncs( &sock->write_q )) { /* If write_q is not empty, we cannot really tell if the already queued * asyncs will not consume all available space; if there's no space From fe1ca0959fa37a9c644fb7b202fa17c06c59b6bb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 29 Jan 2024 17:13:33 -0600 Subject: [PATCH 1116/1506] server: Check if we have waiting asyncs in sock_dispatch_asyncs() before clearing POLLOUT. (cherry picked from commit da6e707850dff714cc698feac83646dde748870e) --- dlls/ws2_32/tests/sock.c | 12 ++++++++++++ server/sock.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index ccdb6ab7d9f..a6ac748754d 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -3115,13 +3115,19 @@ struct send_udp_thread_param static DWORD WINAPI send_udp_thread( void *param ) { struct send_udp_thread_param *p = param; + static const TIMEVAL timeout_zero = {0}; static char buf[256]; + fd_set writefds; unsigned int i; int ret; WaitForSingleObject( p->start_event, INFINITE ); for (i = 0; i < 256; ++i) { + FD_ZERO(&writefds); + FD_SET(p->sock, &writefds); + ret = select( 1, NULL, &writefds, NULL, &timeout_zero ); + ok( ret == 1, "got %d, i %u.\n", ret, i ); ret = send( p->sock, buf, sizeof(buf), 0 ); ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i ); } @@ -3135,6 +3141,7 @@ static void test_UDP(void) possible that this test fails due to dropped packets. */ /* peer 0 receives data from all other peers */ + static const TIMEVAL timeout_zero = {0}; struct sock_info peer[NUM_UDP_PEERS]; char buf[16]; int ss, i, n_recv, n_sent, ret; @@ -3142,6 +3149,7 @@ static void test_UDP(void) int sock; struct send_udp_thread_param udp_thread_param; HANDLE thread; + fd_set writefds; memset (buf,0,sizeof(buf)); @@ -3211,6 +3219,10 @@ static void test_UDP(void) { ret = send( sock, buf, sizeof(buf), 0 ); ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i ); + FD_ZERO(&writefds); + FD_SET(sock, &writefds); + ret = select( 1, NULL, &writefds, NULL, &timeout_zero ); + ok( ret == 1, "got %d, i %u.\n", ret, i ); } WaitForSingleObject( thread, INFINITE ); CloseHandle( thread ); diff --git a/server/sock.c b/server/sock.c index 15137951d0d..3b9367a1b72 100644 --- a/server/sock.c +++ b/server/sock.c @@ -1233,7 +1233,7 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error ) event &= ~(POLLIN | POLLPRI); } - if ((event & POLLOUT) && async_queued( &sock->write_q )) + if ((event & POLLOUT) && async_queue_has_waiting_asyncs( &sock->write_q )) { if (async_waiting( &sock->write_q )) { From 34145c89364d5844039b07110340ab910e8c3d23 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 13 Feb 2024 21:14:58 -0600 Subject: [PATCH 1117/1506] ntdll: HACK: Enable WINE_NO_PRIV_ELEVATION for playway-launcher-installer.exe. CW-Bug-Id: #23404 --- dlls/ntdll/unix/loader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index aaf5964d8d3..9dec5d15d80 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2086,7 +2086,10 @@ static void hacks_init(void) env_str = getenv("WINE_NO_PRIV_ELEVATION"); if (env_str) no_priv_elevation = atoi(env_str); + else if (main_argc > 1 && strstr(main_argv[1], "playway-launcher-installer.exe")) no_priv_elevation = TRUE; else if (sgi) no_priv_elevation = !strcmp(sgi, "1584660"); + if (no_priv_elevation) + ERR("HACK: no_priv_elevation"); env_str = getenv("WINE_UNIX_PC_AS_NTDLL"); if (env_str) report_native_pc_as_ntdll = atoi(env_str); From c0b74b7b593b29c02184711d19cc526149058e2f Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Mon, 16 Oct 2023 16:54:57 -0300 Subject: [PATCH 1118/1506] mlang/tests: Test for GetGlobalFontLinkObject. (cherry picked from commit 6360992deaf60bd486c1e1f6f11492a6b4ec9aaa) --- dlls/mlang/tests/mlang.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index ee5ef5af738..99664a0e556 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -2295,6 +2295,11 @@ static void test_GetGlobalFontLinkObject(void) { HRESULT ret; void *unknown; + LONG refcount; + IMLangFontLink2 *IMLFL2; + IMLangFontLink *IMLFL; + IMLangCodePages *IMLCP; + IMultiLanguage *IML; ret = GetGlobalFontLinkObject(NULL); ok(ret == E_INVALIDARG, "expected E_INVALIDARG got %#lx\n", ret); @@ -2305,7 +2310,26 @@ todo_wine { ok(ret == S_OK, "expected S_OK got %#lx\n", ret); ok(unknown != NULL && unknown != (void *)0xdeadbeef, "GetGlobalFontLinkObject() returned %p\n", unknown); + if (unknown == (void *)0xdeadbeef || !unknown) return; } + + ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink2, (void**)&IMLFL2); + ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret); + + ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMultiLanguage, (void**)&IML); + ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret); + + ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink, (void**)&IMLFL); + ok(ret == S_OK, "expected S_OK got %#lx\n", ret); + IMLangFontLink_Release(IMLFL); + + ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangCodePages, (void**)&IMLCP); + ok(ret == S_OK, "expected S_OK got %#lx\n", ret); + IMLangCodePages_Release(IMLCP); + + + refcount = IUnknown_Release((IUnknown*)unknown); + ok(refcount == 1, "Got refcount %ld\n", refcount); } static void test_IMLangConvertCharset(IMultiLanguage *ml) @@ -2778,6 +2802,8 @@ START_TEST(mlang) if (!init_function_ptrs()) return; + test_GetGlobalFontLinkObject(); + CoInitialize(NULL); test_Rfc1766ToLcid(); test_LcidToRfc1766(); @@ -2785,8 +2811,6 @@ START_TEST(mlang) test_ConvertINetUnicodeToMultiByte(); test_JapaneseConversion(); - test_GetGlobalFontLinkObject(); - trace("IMultiLanguage\n"); ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, &IID_IMultiLanguage, (void **)&iML); From da13d9699b3c63c077b4ba1e6c9324410089c36f Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Mon, 16 Oct 2023 17:12:56 -0300 Subject: [PATCH 1119/1506] mlang: Implement GetGlobalFontLinkObject. (cherry picked from commit 829307455833e5182b93be7dd9b26529f1f136d2) --- dlls/mlang/mlang.c | 21 +++++++++++++++++++-- dlls/mlang/tests/mlang.c | 8 ++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index f424c87b860..55e6f6edaa5 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -44,6 +44,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(mlang); #include "initguid.h" +static INIT_ONCE font_link_global_init_once = INIT_ONCE_STATIC_INIT; +static IUnknown *font_link_global = NULL; + static HRESULT MultiLanguage_create(IUnknown *pUnkOuter, LPVOID *ppObj); static HRESULT MLangConvertCharset_create(IUnknown *outer, void **obj); static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum); @@ -3882,11 +3885,25 @@ HRESULT WINAPI DllCanUnloadNow(void) return dll_count == 0 ? S_OK : S_FALSE; } +static BOOL WINAPI allocate_font_link_cb(PINIT_ONCE init_once, PVOID args, PVOID *context) +{ + return SUCCEEDED(MultiLanguage_create(NULL, (void**)&font_link_global)); +} + HRESULT WINAPI GetGlobalFontLinkObject(void **unknown) { + TRACE("%p\n", unknown); + if (!unknown) return E_INVALIDARG; - FIXME("%p: stub\n", unknown); + if (!InitOnceExecuteOnce(&font_link_global_init_once, allocate_font_link_cb, NULL, NULL)) + { + ERR("Failed to create global font link object.\n"); + return E_FAIL; + } - return S_FALSE; + IUnknown_AddRef(font_link_global); + *unknown = font_link_global; + + return S_OK; } diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 99664a0e556..4ab4b579245 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -2306,18 +2306,18 @@ static void test_GetGlobalFontLinkObject(void) unknown = (void *)0xdeadbeef; ret = GetGlobalFontLinkObject(&unknown); -todo_wine { ok(ret == S_OK, "expected S_OK got %#lx\n", ret); ok(unknown != NULL && unknown != (void *)0xdeadbeef, "GetGlobalFontLinkObject() returned %p\n", unknown); if (unknown == (void *)0xdeadbeef || !unknown) return; - } ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink2, (void**)&IMLFL2); - ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret); + todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret); + if (ret == S_OK) IMLangFontLink2_Release(IMLFL2); ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMultiLanguage, (void**)&IML); - ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret); + todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret); + if (ret == S_OK) IMultiLanguage_Release(IML); ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink, (void**)&IMLFL); ok(ret == S_OK, "expected S_OK got %#lx\n", ret); From de86bec53124f4ddd67036fd796c96e6ac358957 Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 28 Nov 2023 16:51:18 -0300 Subject: [PATCH 1120/1506] mlang/tests: Test codepages priority bug in GetStrCodepages. (cherry picked from commit bc6231481119a244e7d3de29089878b8fbcecbf9) --- dlls/mlang/tests/mlang.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 4ab4b579245..f8e37565115 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -1324,6 +1324,14 @@ static void IMLangFontLink_Test(IMLangFontLink* iMLFL) ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages); ok(processed == 2, "expected 2, got %ld\n", processed); + dwCmpCodePages = FS_JISJAPAN; + dwCodePages = 0; + processed = 0; + ret = IMLangFontLink_GetStrCodePages(iMLFL, L"\uff90a", 2, FS_LATIN1, &dwCodePages, &processed); + ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret); + ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages); + todo_wine ok(processed == 1, "expected 1, got %ld\n", processed); + dwCodePages = 0xffff; processed = -1; ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, &dwCodePages, &processed); From c3e3bfe83abf2c4625c15ad7af099e0450758f3a Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 28 Nov 2023 17:29:21 -0300 Subject: [PATCH 1121/1506] mlang: Fix bug with codepage priority in GetStrCodePages. (cherry picked from commit b549ae11fbbe02564417e4029baa789bffe9d5aa) --- dlls/mlang/mlang.c | 9 +++------ dlls/mlang/tests/mlang.c | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 55e6f6edaa5..c7e7f360f0b 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -3336,23 +3336,20 @@ static HRESULT WINAPI fnIMLangFontLink2_GetStrCodePages( IMLangFontLink2* iface, for (i = 0; i < src_len; i++) { - DWORD cp, next_cp = 0; + DWORD cp = 0; HRESULT ret; ret = IMLangFontLink2_GetCharCodePages(iface, src[i], &cp); - if (i + 1 < src_len) - ret = IMLangFontLink2_GetCharCodePages(iface, src[i + 1], &next_cp); if (ret != S_OK) return E_FAIL; if (!cps) cps = cp; - else if ((cps & cp) != 0) cps &= cp; + else if ((cps & cp) != 0 && + !((priority_cp & cps) ^ (priority_cp & cp))) cps &= cp; else { i--; break; } - - if ((priority_cp & cps) && !(priority_cp & next_cp)) break; } if (codepages) *codepages = cps; diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index f8e37565115..6bb973dc285 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -1330,7 +1330,7 @@ static void IMLangFontLink_Test(IMLangFontLink* iMLFL) ret = IMLangFontLink_GetStrCodePages(iMLFL, L"\uff90a", 2, FS_LATIN1, &dwCodePages, &processed); ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret); ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages); - todo_wine ok(processed == 1, "expected 1, got %ld\n", processed); + ok(processed == 1, "expected 1, got %ld\n", processed); dwCodePages = 0xffff; processed = -1; From e8babc9c97f8d5d7ea41c52e10bd6a8e0a2aa976 Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 30 Jan 2024 20:43:22 -0300 Subject: [PATCH 1122/1506] gdiplus: Replace HDC with GpGraphics in parameters. (cherry picked from commit 1454ffe7ddf01226aacec07836d4afa62fecd3fa) --- dlls/gdiplus/gdiplus_private.h | 4 ++-- dlls/gdiplus/graphics.c | 36 ++++++++++++++++------------------ dlls/gdiplus/graphicspath.c | 8 ++++---- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 6f7e72124c2..a72731d79ac 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -606,13 +606,13 @@ static inline const void *buffer_read(struct memory_buffer *mbuf, INT size) return NULL; } -typedef GpStatus (*gdip_format_string_callback)(HDC hdc, +typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data); -GpStatus gdip_format_string(HDC hdc, +GpStatus gdip_format_string(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 36ff473a6af..8480c45930b 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5161,7 +5161,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w return GdipIsVisibleRect(graphics, (REAL)x, (REAL)y, (REAL)width, (REAL)height, result); } -GpStatus gdip_format_string(HDC hdc, +GpStatus gdip_format_string(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data) @@ -5243,7 +5243,7 @@ GpStatus gdip_format_string(HDC hdc, halign = format->align; while(sum < length){ - GetTextExtentExPointW(hdc, stringdup + sum, length - sum, + GetTextExtentExPointW(graphics->hdc, stringdup + sum, length - sum, nwidth, &fit, NULL, &size); fitcpy = fit; @@ -5292,7 +5292,7 @@ GpStatus gdip_format_string(HDC hdc, else lineend = fit; - GetTextExtentExPointW(hdc, stringdup + sum, lineend, + GetTextExtentExPointW(graphics->hdc, stringdup + sum, lineend, nwidth, &j, NULL, &size); bounds.Width = size.cx; @@ -5326,7 +5326,7 @@ GpStatus gdip_format_string(HDC hdc, if (hotkeyprefix_offsets[hotkeyprefix_end_pos] >= sum + lineend) break; - stat = callback(hdc, stringdup, sum, lineend, + stat = callback(graphics, stringdup, sum, lineend, font, rect, format, lineno, &bounds, &hotkeyprefix_offsets[hotkeyprefix_pos], hotkeyprefix_end_pos-hotkeyprefix_pos, user_data); @@ -5392,7 +5392,7 @@ struct measure_ranges_args { REAL rel_width, rel_height; }; -static GpStatus measure_ranges_callback(HDC hdc, +static GpStatus measure_ranges_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, @@ -5414,11 +5414,11 @@ static GpStatus measure_ranges_callback(HDC hdc, range_rect.Y = bounds->Y / args->rel_height; range_rect.Height = bounds->Height / args->rel_height; - GetTextExtentExPointW(hdc, string + index, range_start - index, + GetTextExtentExPointW(graphics->hdc, string + index, range_start - index, INT_MAX, NULL, NULL, &range_size); range_rect.X = (bounds->X + range_size.cx) / args->rel_width; - GetTextExtentExPointW(hdc, string + index, range_end - index, + GetTextExtentExPointW(graphics->hdc, string + index, range_end - index, INT_MAX, NULL, NULL, &range_size); range_rect.Width = (bounds->X + range_size.cx) / args->rel_width - range_rect.X; @@ -5496,7 +5496,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, gdi_transform_acquire(graphics); - stat = gdip_format_string(hdc, string, length, font, &scaled_rect, stringFormat, + stat = gdip_format_string(graphics, string, length, font, &scaled_rect, stringFormat, (stringFormat->attr & StringFormatFlagsNoClip) != 0, measure_ranges_callback, &args); gdi_transform_release(graphics); @@ -5517,7 +5517,7 @@ struct measure_string_args { REAL rel_width, rel_height; }; -static GpStatus measure_string_callback(HDC hdc, +static GpStatus measure_string_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, @@ -5619,7 +5619,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, gdi_transform_acquire(graphics); - gdip_format_string(hdc, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, measure_string_callback, &args); gdi_transform_release(graphics); @@ -5640,12 +5640,11 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, } struct draw_string_args { - GpGraphics *graphics; GDIPCONST GpBrush *brush; REAL x, y, rel_width, rel_height, ascent; }; -static GpStatus draw_string_callback(HDC hdc, +static GpStatus draw_string_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, @@ -5658,7 +5657,7 @@ static GpStatus draw_string_callback(HDC hdc, position.X = args->x + bounds->X / args->rel_width; position.Y = args->y + bounds->Y / args->rel_height + args->ascent; - stat = draw_driver_string(args->graphics, &string[index], length, font, format, + stat = draw_driver_string(graphics, &string[index], length, font, format, args->brush, &position, DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); @@ -5668,7 +5667,7 @@ static GpStatus draw_string_callback(HDC hdc, REAL underline_y, underline_height; int i; - GetOutlineTextMetricsW(hdc, sizeof(otm), &otm); + GetOutlineTextMetricsW(graphics->hdc, sizeof(otm), &otm); underline_height = otm.otmsUnderscoreSize / args->rel_height; underline_y = position.Y - otm.otmsUnderscorePosition / args->rel_height - underline_height / 2; @@ -5679,13 +5678,13 @@ static GpStatus draw_string_callback(HDC hdc, SIZE text_size; INT ofs = underlined_indexes[i] - index; - GetTextExtentExPointW(hdc, string + index, ofs, INT_MAX, NULL, NULL, &text_size); + GetTextExtentExPointW(graphics->hdc, string + index, ofs, INT_MAX, NULL, NULL, &text_size); start_x = text_size.cx / args->rel_width; - GetTextExtentExPointW(hdc, string + index, ofs+1, INT_MAX, NULL, NULL, &text_size); + GetTextExtentExPointW(graphics->hdc, string + index, ofs+1, INT_MAX, NULL, NULL, &text_size); end_x = text_size.cx / args->rel_width; - GdipFillRectangle(args->graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); + GdipFillRectangle(graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); } } @@ -5783,7 +5782,6 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string get_font_hfont(graphics, font, format, &gdifont, NULL, NULL); SelectObject(hdc, gdifont); - args.graphics = graphics; args.brush = brush; args.x = rect->X; @@ -5797,7 +5795,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string GetTextMetricsW(hdc, &textmetric); args.ascent = textmetric.tmAscent / rel_height; - gdip_format_string(hdc, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, draw_string_callback, &args); gdi_transform_release(graphics); diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 24c2888cfe8..391ba72de98 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -949,7 +949,7 @@ struct format_string_args float ascent; }; -static GpStatus format_string_callback(HDC dc, +static GpStatus format_string_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, @@ -975,7 +975,7 @@ static GpStatus format_string_callback(HDC dc, TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; - len = GetGlyphOutlineW(dc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + len = GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { status = GenericError; @@ -989,7 +989,7 @@ static GpStatus format_string_callback(HDC dc, status = OutOfMemory; break; } - GetGlyphOutlineW(dc, string[i], GGO_BEZIER, &gm, len, start, &identity); + GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, len, start, &identity); ofs = 0; while (ofs < len) @@ -1117,7 +1117,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT args.maxY = 0; args.scale = emSize / native_height; args.ascent = textmetric.tmAscent * args.scale; - status = gdip_format_string(dc, string, length, NULL, &scaled_layout_rect, + status = gdip_format_string(graphics, string, length, NULL, &scaled_layout_rect, format, TRUE, format_string_callback, &args); DeleteDC(dc); From 9de31d499e4a8fb84b91829fb41dcbb394ece51c Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Mon, 11 Dec 2023 10:03:32 -0300 Subject: [PATCH 1123/1506] gdiplus/tests: Add interactive test for font linking. (cherry picked from commit d68a9d1213c7f80bf1a24f1a4db64cd3d34858b1) --- dlls/gdiplus/tests/graphics.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index d71bc78c2ae..18fe1078e76 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -2305,10 +2305,29 @@ static void test_GdipDrawString(void) } expect(Ok, status); - status = GdipCreateSolidFill((ARGB)0xdeadbeef, (GpSolidFill**)&brush); + status = GdipCreateStringFormat(0,0,&format); expect(Ok, status); - status = GdipCreateStringFormat(0,0,&format); + if (winetest_interactive) + { + status = GdipCreateSolidFill(0xFF000000, (GpSolidFill**)&brush); + expect(Ok, status); + rect.X = 0; + rect.Y = 0; + rect.Width = 0; + rect.Height = 14; + GdipRotateWorldTransform(graphics, 45, MatrixOrderPrepend); + GdipScaleWorldTransform(graphics, 2, 2, MatrixOrderPrepend); + GdipGraphicsClear(graphics, 0xFFFFFFFF); + status = GdipDrawString(graphics, L"\u8336Hola\u8336", 6, fnt, &rect, format, brush); + expect(Ok, status); + RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); /* FIXME: In Windows this test works without this line. */ + Sleep(4000); + GdipDeleteBrush(brush); + GdipResetWorldTransform(graphics); + } + + status = GdipCreateSolidFill((ARGB)0xdeadbeef, (GpSolidFill**)&brush); expect(Ok, status); rect.X = 0; From 8957802e3608cc95ccdab853811aa507595f739f Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 14 Nov 2023 19:22:25 -0300 Subject: [PATCH 1124/1506] gdiplus: Implement font linking for gdiplus. (cherry picked from commit ba4681e776c0c1cef9b5b2610dc67f634999d095) --- dlls/gdiplus/Makefile.in | 2 +- dlls/gdiplus/gdiplus_private.h | 16 +++- dlls/gdiplus/graphics.c | 159 +++++++++++++++++++++++++++++---- dlls/gdiplus/graphicspath.c | 2 +- 4 files changed, 158 insertions(+), 21 deletions(-) diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index 382033be901..76474f2e086 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -1,6 +1,6 @@ MODULE = gdiplus.dll IMPORTLIB = gdiplus -IMPORTS = uuid shlwapi ole32 oleaut32 user32 gdi32 +IMPORTS = uuid shlwapi ole32 oleaut32 user32 gdi32 mlang DELAYIMPORTS = windowscodecs SOURCES = \ diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index a72731d79ac..2b5dbee43e9 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -606,8 +606,22 @@ static inline const void *buffer_read(struct memory_buffer *mbuf, INT size) return NULL; } +/* Represents a string section and the font it should use. */ +struct gdip_font_link_section { + struct list entry; + DWORD start; /* The starting index of the string where the font applies. */ + DWORD end; /* The end index of the string. */ + GpFont *font; +}; + +struct gdip_font_link_info { + GDIPCONST GpFont *base_font; + struct list sections; +}; + + typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *sections, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 8480c45930b..707fa55cfda 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -34,6 +34,7 @@ #include "winreg.h" #include "shlwapi.h" +#include "mlang.h" #include "gdiplus.h" #include "gdiplus_private.h" #include "wine/debug.h" @@ -5161,6 +5162,110 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w return GdipIsVisibleRect(graphics, (REAL)x, (REAL)y, (REAL)width, (REAL)height, result); } +/* Populates gdip_font_link_info struct based on the base_font and input string */ +static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD length, GDIPCONST GpFont *base_font, + struct gdip_font_link_info *font_link_info) +{ + IUnknown *unk; + IMLangFontLink *iMLFL; + GpFont *gpfont; + HFONT map_hfont, hfont, old_font; + LONG processed, progress = 0; + struct gdip_font_link_section *section; + DWORD font_codepages, string_codepages; + + list_init(&font_link_info->sections); + font_link_info->base_font = base_font; + + GetGlobalFontLinkObject((void**)&unk); + IUnknown_QueryInterface(unk, &IID_IMLangFontLink, (void**)&iMLFL); + IUnknown_Release(unk); + + get_font_hfont(graphics, base_font, NULL, &hfont, NULL, NULL); + IMLangFontLink_GetFontCodePages(iMLFL, graphics->hdc, hfont, &font_codepages); + + while (progress < length) + { + section = calloc(1, sizeof(*section)); + section->start = progress; + IMLangFontLink_GetStrCodePages(iMLFL, &string[progress], length - progress, + font_codepages, &string_codepages, &processed); + + if (font_codepages & string_codepages) + { + section->font = (GpFont *)base_font; + } + else + { + IMLangFontLink_MapFont(iMLFL, graphics->hdc, string_codepages, hfont, &map_hfont); + old_font = SelectObject(graphics->hdc, map_hfont); + GdipCreateFontFromDC(graphics->hdc, &gpfont); + SelectObject(graphics->hdc, old_font); + IMLangFontLink_ReleaseFont(iMLFL, map_hfont); + section->font = gpfont; + } + + section->end = section->start + processed; + list_add_tail(&font_link_info->sections, §ion->entry); + progress += processed; + } + + DeleteObject(hfont); + IMLangFontLink_Release(iMLFL); +} + +static void font_link_get_text_extent_point(struct gdip_font_link_info *font_link_info, GpGraphics *graphics, LPCWSTR string, + INT index, int length, int max_ext, LPINT fit, SIZE *size) +{ + DWORD to_measure_length; + HFONT hfont, oldhfont; + SIZE sizeaux = { 0 }; + int i = index, fitaux = 0; + struct gdip_font_link_section *section; + + size->cx = 0; + size->cy = 0; + + if (fit) + *fit = 0; + + LIST_FOR_EACH_ENTRY(section, &font_link_info->sections, struct gdip_font_link_section, entry) + { + if (i >= section->end) continue; + + to_measure_length = min(length - (i - index), section->end - i); + + get_font_hfont(graphics, section->font, NULL, &hfont, NULL, NULL); + oldhfont = SelectObject(graphics->hdc, hfont); + GetTextExtentExPointW(graphics->hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); + SelectObject(graphics->hdc, oldhfont); + DeleteObject(hfont); + + max_ext -= sizeaux.cx; + if (fit) + *fit += fitaux; + size->cx += sizeaux.cx; + size->cy = max(size->cy, sizeaux.cy); + + i += to_measure_length; + if ((i - index) >= length || fitaux < to_measure_length) break; + } +} + +static void release_font_link_info(struct gdip_font_link_info *font_link_info) +{ + struct list *entry; + + while ((entry = list_head(&font_link_info->sections))) + { + struct gdip_font_link_section *section = LIST_ENTRY(entry, struct gdip_font_link_section, entry); + list_remove(entry); + if (section->font != font_link_info->base_font) + GdipDeleteFont(section->font); + free(section); + } +} + GpStatus gdip_format_string(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, @@ -5177,6 +5282,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, INT *hotkeyprefix_offsets=NULL; INT hotkeyprefix_count=0; INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0; + struct gdip_font_link_info font_link_info = { 0 }; BOOL seen_prefix = FALSE, unixstyle_newline = TRUE; if(length == -1) length = lstrlenW(string); @@ -5242,9 +5348,10 @@ GpStatus gdip_format_string(GpGraphics *graphics, halign = format->align; + generate_font_link_info(graphics, stringdup, length, font, &font_link_info); + while(sum < length){ - GetTextExtentExPointW(graphics->hdc, stringdup + sum, length - sum, - nwidth, &fit, NULL, &size); + font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, length - sum, nwidth, &fit, &size); fitcpy = fit; if(fit == 0) @@ -5292,8 +5399,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, else lineend = fit; - GetTextExtentExPointW(graphics->hdc, stringdup + sum, lineend, - nwidth, &j, NULL, &size); + font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, lineend, nwidth, &j, &size); bounds.Width = size.cx; @@ -5327,7 +5433,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, break; stat = callback(graphics, stringdup, sum, lineend, - font, rect, format, lineno, &bounds, + &font_link_info, rect, format, lineno, &bounds, &hotkeyprefix_offsets[hotkeyprefix_pos], hotkeyprefix_end_pos-hotkeyprefix_pos, user_data); @@ -5358,6 +5464,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, break; } + release_font_link_info(&font_link_info); free(stringdup); free(hotkeyprefix_offsets); @@ -5393,7 +5500,8 @@ struct measure_ranges_args { }; static GpStatus measure_ranges_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST WCHAR *string, INT index, INT length, + struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data) @@ -5414,12 +5522,10 @@ static GpStatus measure_ranges_callback(GpGraphics *graphics, range_rect.Y = bounds->Y / args->rel_height; range_rect.Height = bounds->Height / args->rel_height; - GetTextExtentExPointW(graphics->hdc, string + index, range_start - index, - INT_MAX, NULL, NULL, &range_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, range_start - index, INT_MAX, NULL, &range_size); range_rect.X = (bounds->X + range_size.cx) / args->rel_width; - GetTextExtentExPointW(graphics->hdc, string + index, range_end - index, - INT_MAX, NULL, NULL, &range_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, range_end - index, INT_MAX, NULL, &range_size); range_rect.Width = (bounds->X + range_size.cx) / args->rel_width - range_rect.X; stat = GdipCombineRegionRect(args->regions[i], &range_rect, CombineModeUnion); @@ -5518,7 +5624,8 @@ struct measure_string_args { }; static GpStatus measure_string_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST WCHAR *string, INT index, INT length, + struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data) @@ -5645,21 +5752,37 @@ struct draw_string_args { }; static GpStatus draw_string_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST WCHAR *string, INT index, INT length, + struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data) { struct draw_string_args *args = user_data; + int i = index; PointF position; - GpStatus stat; + SIZE size; + DWORD to_draw_length; + struct gdip_font_link_section *section; + GpStatus stat = Ok; position.X = args->x + bounds->X / args->rel_width; position.Y = args->y + bounds->Y / args->rel_height + args->ascent; - stat = draw_driver_string(graphics, &string[index], length, font, format, - args->brush, &position, - DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); + LIST_FOR_EACH_ENTRY(section, &font_link_info->sections, struct gdip_font_link_section, entry) + { + if (i >= section->end) continue; + + to_draw_length = min(length - (i - index), section->end - i); + TRACE("index %d, todraw %ld, used %s\n", i, to_draw_length, section->font == font_link_info->base_font ? "base font" : "map"); + font_link_get_text_extent_point(font_link_info, graphics, string, i, to_draw_length, 0, NULL, &size); + stat = draw_driver_string(graphics, &string[i], to_draw_length, + section->font, format, args->brush, &position, + DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); + position.X += size.cx / args->rel_width; + i += to_draw_length; + if (stat != Ok || (i - index) >= length) break; + } if (stat == Ok && underlined_index_count) { @@ -5678,10 +5801,10 @@ static GpStatus draw_string_callback(GpGraphics *graphics, SIZE text_size; INT ofs = underlined_indexes[i] - index; - GetTextExtentExPointW(graphics->hdc, string + index, ofs, INT_MAX, NULL, NULL, &text_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs, INT_MAX, NULL, &text_size); start_x = text_size.cx / args->rel_width; - GetTextExtentExPointW(graphics->hdc, string + index, ofs+1, INT_MAX, NULL, NULL, &text_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs+1, INT_MAX, NULL, &text_size); end_x = text_size.cx / args->rel_width; GdipFillRectangle(graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 391ba72de98..20e0787de16 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -950,7 +950,7 @@ struct format_string_args }; static GpStatus format_string_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, + GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *priv) From 8e385eab40be58ec6d13e4b0057141ee71faa1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 11:31:22 +0100 Subject: [PATCH 1125/1506] include: Add HEAACWAVEINFO and HEAACWAVEFORMAT definitions. (cherry picked from commit 681d20146226132c2ed18ae7ecb53003e6ffcf44) --- dlls/winegstreamer/mfplat.c | 18 +----------------- include/mmreg.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index aae1b63de5d..c386ce492d1 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -25,6 +25,7 @@ #include "initguid.h" #include "d3d9types.h" #include "mfapi.h" +#include "mmreg.h" #include "wine/debug.h" #include "wine/list.h" @@ -642,23 +643,6 @@ static void mf_media_type_to_wg_format_audio(IMFMediaType *type, const GUID *sub static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUID *subtype, struct wg_format *format) { - /* Audio specific config is stored at after HEAACWAVEINFO in MF_MT_USER_DATA - * https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-heaacwaveformat - */ - typedef struct - { - WORD wPayloadType; - WORD wAudioProfileLevelIndication; - WORD wStructType; - WORD wReserved1; - DWORD dwReserved2; - } HEAACWAVEINFO; - typedef struct - { - HEAACWAVEINFO wfInfo; - BYTE pbAudioSpecificConfig[1]; - } HEAACWAVEFORMAT; - BYTE buffer[64]; HEAACWAVEFORMAT *user_data = (HEAACWAVEFORMAT *)buffer; UINT32 codec_data_size; diff --git a/include/mmreg.h b/include/mmreg.h index 1b19e1f068f..a8b0056064e 100644 --- a/include/mmreg.h +++ b/include/mmreg.h @@ -645,6 +645,22 @@ typedef struct mpeg1waveformat_tag { typedef MPEG1WAVEFORMAT *PMPEG1WAVEFORMAT, *NPMPEG1WAVEFORMAT, *LPMPEG1WAVEFORMAT; +typedef struct heaacwaveinfo_tag +{ + WAVEFORMATEX wfx; + WORD wPayloadType; + WORD wAudioProfileLevelIndication; + WORD wStructType; + WORD wReserved1; + DWORD dwReserved2; +} HEAACWAVEINFO, *PHEAACWAVEINFO; + +typedef struct heaacwaveformat_tag +{ + HEAACWAVEINFO wfInfo; + BYTE pbAudioSpecificConfig[1]; +} HEAACWAVEFORMAT, *PHEAACWAVEFORMAT; + #define ACM_MPEG_LAYER1 0x0001 #define ACM_MPEG_LAYER2 0x0002 #define ACM_MPEG_LAYER3 0x0004 From d072d00a9e9eee2f5ce679ef679a2ec112e9caa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 11:26:57 +0100 Subject: [PATCH 1126/1506] mfplat/tests: Test MFInitMediaTypeFromWaveFormatEx wrt MF_MT_FIXED_SIZE_SAMPLES. (cherry picked from commit 2155817a3646329699069a4be4905b2685f987ba) --- dlls/mfplat/tests/mfplat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index c7ee087bb93..86096f7222b 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6953,6 +6953,11 @@ static void validate_media_type(IMFMediaType *mediatype, const WAVEFORMATEX *for } else ok(FAILED(hr), "Unexpected ALL_SAMPLES_INDEPENDENT.\n"); + + hr = IMFMediaType_GetUINT32(mediatype, &MF_MT_FIXED_SIZE_SAMPLES, &value); + ok(FAILED(hr), "Unexpected FIXED_SIZE_SAMPLES.\n"); + hr = IMFMediaType_GetUINT32(mediatype, &MF_MT_COMPRESSED, &value); + ok(FAILED(hr), "Unexpected COMPRESSED.\n"); } static void test_MFInitMediaTypeFromWaveFormatEx(void) From 3fa8eaf6f7ebcbad78eb6ef5739ec3230a613319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 11:43:33 +0100 Subject: [PATCH 1127/1506] mfplat/tests: Add MFInitMediaTypeFromWaveFormatEx tests with HEAACWAVEFORMAT. (cherry picked from commit aa648beec8b6f24fbec2b9b7e3ed2dd59b7fc70a) --- dlls/mfplat/tests/mfplat.c | 45 +++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 86096f7222b..db47aaa2f1c 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6991,11 +6991,13 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) { WAVE_FORMAT_WMASPDIF }, }; - UINT8 buff[MPEGLAYER3_WFX_EXTRA_BYTES]; + UINT8 buff[1024]; WAVEFORMATEXTENSIBLE waveformatext; MPEGLAYER3WAVEFORMAT mp3format; + HEAACWAVEFORMAT aacformat; IMFMediaType *mediatype; unsigned int i, size; + UINT32 value; HRESULT hr; hr = MFCreateMediaType(&mediatype); @@ -7048,6 +7050,47 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) ok(size == mp3format.wfx.cbSize, "Unexpected size %u.\n", size); ok(!memcmp(buff, (WAVEFORMATEX *)&mp3format + 1, size), "Unexpected user data.\n"); + /* HEAACWAVEFORMAT */ + aacformat.wfInfo.wfx.wFormatTag = WAVE_FORMAT_MPEG_HEAAC; + aacformat.wfInfo.wfx.nChannels = 2; + aacformat.wfInfo.wfx.nSamplesPerSec = 44100; + aacformat.wfInfo.wfx.nAvgBytesPerSec = 16000; + aacformat.wfInfo.wfx.nBlockAlign = 1; + aacformat.wfInfo.wfx.wBitsPerSample = 0; + aacformat.wfInfo.wPayloadType = 2; + aacformat.wfInfo.wAudioProfileLevelIndication = 1; + aacformat.pbAudioSpecificConfig[0] = 0xcd; + + /* test with invalid format size */ + aacformat.wfInfo.wfx.cbSize = sizeof(aacformat) - 2 - sizeof(WAVEFORMATEX); + hr = MFInitMediaTypeFromWaveFormatEx(mediatype, (WAVEFORMATEX *)&aacformat, sizeof(aacformat) - 2); + todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + aacformat.wfInfo.wfx.cbSize = sizeof(aacformat) - sizeof(WAVEFORMATEX); + hr = MFInitMediaTypeFromWaveFormatEx(mediatype, (WAVEFORMATEX *)&aacformat, sizeof(aacformat)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + validate_media_type(mediatype, &aacformat.wfInfo.wfx); + + value = 0xdeadbeef; + hr = IMFMediaType_GetUINT32(mediatype, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, &value); + todo_wine + ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); + todo_wine + ok(value == aacformat.wfInfo.wAudioProfileLevelIndication, "Unexpected AAC_AUDIO_PROFILE_LEVEL_INDICATION %u.\n", value); + value = 0xdeadbeef; + hr = IMFMediaType_GetUINT32(mediatype, &MF_MT_AAC_PAYLOAD_TYPE, &value); + todo_wine + ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); + todo_wine + ok(value == aacformat.wfInfo.wPayloadType, "Unexpected AAC_PAYLOAD_TYPE %u.\n", value); + + hr = IMFMediaType_GetBlob(mediatype, &MF_MT_USER_DATA, buff, sizeof(buff), &size); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(size == aacformat.wfInfo.wfx.cbSize, "Unexpected size %u.\n", size); + ok(!memcmp(buff, (WAVEFORMATEX *)&aacformat + 1, size), "Unexpected user data.\n"); + IMFMediaType_Release(mediatype); } From e8bbfd14647265cf79db1c570d9da365fcf0175d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 14:28:10 +0100 Subject: [PATCH 1128/1506] mfplat/tests: Test MFWaveFormatExConvertFlag_ForceExtensible with HEAACWAVEFORMAT. (cherry picked from commit 96346d24c1ceac83ea6e5436314403aa81563e99) --- dlls/mfplat/tests/mfplat.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index db47aaa2f1c..a7d2146b8b6 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6994,6 +6994,7 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) UINT8 buff[1024]; WAVEFORMATEXTENSIBLE waveformatext; MPEGLAYER3WAVEFORMAT mp3format; + WAVEFORMATEXTENSIBLE *format; HEAACWAVEFORMAT aacformat; IMFMediaType *mediatype; unsigned int i, size; @@ -7091,6 +7092,40 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) ok(size == aacformat.wfInfo.wfx.cbSize, "Unexpected size %u.\n", size); ok(!memcmp(buff, (WAVEFORMATEX *)&aacformat + 1, size), "Unexpected user data.\n"); + hr = MFCreateWaveFormatExFromMFMediaType(mediatype, (WAVEFORMATEX **)&format, &size, MFWaveFormatExConvertFlag_ForceExtensible); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "got wFormatTag %#x\n", format->Format.wFormatTag); + ok(format->Format.cbSize == aacformat.wfInfo.wfx.cbSize + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), + "got cbSize %u\n", format->Format.cbSize); + ok(IsEqualGUID(&format->SubFormat, &MFAudioFormat_AAC), "got SubFormat %s\n", debugstr_guid(&format->SubFormat)); + ok(format->dwChannelMask == 3, "got dwChannelMask %#lx\n", format->dwChannelMask); + ok(format->Samples.wSamplesPerBlock == 0, "got wSamplesPerBlock %u\n", format->Samples.wSamplesPerBlock); + ok(!memcmp(format + 1, &aacformat.wfInfo.wfx + 1, aacformat.wfInfo.wfx.cbSize), "Unexpected user data.\n"); + CoTaskMemFree(format); + } + + /* test with invalid format size */ + aacformat.wfInfo.wfx.cbSize = 1; + hr = IMFMediaType_SetBlob(mediatype, &MF_MT_USER_DATA, buff, aacformat.wfInfo.wfx.cbSize); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateWaveFormatExFromMFMediaType(mediatype, (WAVEFORMATEX **)&format, &size, MFWaveFormatExConvertFlag_ForceExtensible); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "got wFormatTag %#x\n", format->Format.wFormatTag); + ok(format->Format.cbSize == aacformat.wfInfo.wfx.cbSize + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), + "got cbSize %u\n", format->Format.cbSize); + ok(IsEqualGUID(&format->SubFormat, &MFAudioFormat_AAC), "got SubFormat %s\n", debugstr_guid(&format->SubFormat)); + ok(format->dwChannelMask == 3, "got dwChannelMask %#lx\n", format->dwChannelMask); + ok(format->Samples.wSamplesPerBlock == 0, "got wSamplesPerBlock %u\n", format->Samples.wSamplesPerBlock); + ok(!memcmp(format + 1, &aacformat.wfInfo.wfx + 1, aacformat.wfInfo.wfx.cbSize), "Unexpected user data.\n"); + CoTaskMemFree(format); + } + IMFMediaType_Release(mediatype); } From f67042c7b9cf447091b71e0e59526594deff42f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 11:51:35 +0100 Subject: [PATCH 1129/1506] mfplat: Support AAC format attributes in MFInitMediaTypeFromWaveFormatEx. (cherry picked from commit 1939bfff9ff402c009bf72d1522aac050c469484) --- dlls/mfplat/mediatype.c | 9 +++++++++ dlls/mfplat/tests/mfplat.c | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index c73c92be642..8b96880c865 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3126,6 +3126,15 @@ HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WA mediatype_set_uint32(mediatype, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1, &hr); } + if (IsEqualGUID(&subtype, &MFAudioFormat_AAC)) + { + HEAACWAVEINFO *info = CONTAINING_RECORD(format, HEAACWAVEINFO, wfx); + if (format->cbSize < sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)) + return E_INVALIDARG; + mediatype_set_uint32(mediatype, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, info->wAudioProfileLevelIndication, &hr); + mediatype_set_uint32(mediatype, &MF_MT_AAC_PAYLOAD_TYPE, info->wPayloadType, &hr); + } + if (format->cbSize && format->wFormatTag != WAVE_FORMAT_EXTENSIBLE) mediatype_set_blob(mediatype, &MF_MT_USER_DATA, (const UINT8 *)(format + 1), format->cbSize, &hr); diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index a7d2146b8b6..0c1e6b55321 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -7065,7 +7065,6 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) /* test with invalid format size */ aacformat.wfInfo.wfx.cbSize = sizeof(aacformat) - 2 - sizeof(WAVEFORMATEX); hr = MFInitMediaTypeFromWaveFormatEx(mediatype, (WAVEFORMATEX *)&aacformat, sizeof(aacformat) - 2); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); aacformat.wfInfo.wfx.cbSize = sizeof(aacformat) - sizeof(WAVEFORMATEX); @@ -7076,15 +7075,11 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) value = 0xdeadbeef; hr = IMFMediaType_GetUINT32(mediatype, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, &value); - todo_wine ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); - todo_wine ok(value == aacformat.wfInfo.wAudioProfileLevelIndication, "Unexpected AAC_AUDIO_PROFILE_LEVEL_INDICATION %u.\n", value); value = 0xdeadbeef; hr = IMFMediaType_GetUINT32(mediatype, &MF_MT_AAC_PAYLOAD_TYPE, &value); - todo_wine ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); - todo_wine ok(value == aacformat.wfInfo.wPayloadType, "Unexpected AAC_PAYLOAD_TYPE %u.\n", value); hr = IMFMediaType_GetBlob(mediatype, &MF_MT_USER_DATA, buff, sizeof(buff), &size); From d2587d2b85d909b3d60d6a18b2805c0d900a05c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 12:15:17 +0100 Subject: [PATCH 1130/1506] mfplat: Support compressed WAVEFORMATEX in MFCreateWaveFormatExFromMFMediaType. (cherry picked from commit a634c30f00c5cf51b9499a0781f517fc0d2d835f) --- dlls/mfplat/mediatype.c | 50 ++++++++++++++++++-------------------- dlls/mfplat/tests/mfplat.c | 40 ++++++++++++------------------ 2 files changed, 39 insertions(+), 51 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 8b96880c865..a159ae4b56f 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -2965,10 +2965,10 @@ HRESULT WINAPI MFUnwrapMediaType(IMFMediaType *wrapper, IMFMediaType **ret) HRESULT WINAPI MFCreateWaveFormatExFromMFMediaType(IMFMediaType *mediatype, WAVEFORMATEX **ret_format, UINT32 *size, UINT32 flags) { - WAVEFORMATEXTENSIBLE *format_ext = NULL; + UINT32 value, extra_size = 0, user_size; WAVEFORMATEX *format; GUID major, subtype; - UINT32 value; + void *user_data; HRESULT hr; TRACE("%p, %p, %p, %#x.\n", mediatype, ret_format, size, flags); @@ -2982,36 +2982,24 @@ HRESULT WINAPI MFCreateWaveFormatExFromMFMediaType(IMFMediaType *mediatype, WAVE if (!IsEqualGUID(&major, &MFMediaType_Audio)) return E_INVALIDARG; - if (!IsEqualGUID(&subtype, &MFAudioFormat_PCM) && !IsEqualGUID(&subtype, &MFAudioFormat_Float)) + if (FAILED(hr = IMFMediaType_GetBlobSize(mediatype, &MF_MT_USER_DATA, &user_size))) { - FIXME("Unsupported audio format %s.\n", debugstr_guid(&subtype)); - return E_NOTIMPL; + if (!IsEqualGUID(&subtype, &MFAudioFormat_PCM) && !IsEqualGUID(&subtype, &MFAudioFormat_Float)) + return hr; + user_size = 0; } - /* FIXME: probably WAVE_FORMAT_MPEG/WAVE_FORMAT_MPEGLAYER3 should be handled separately. */ if (flags == MFWaveFormatExConvertFlag_ForceExtensible) - { - format_ext = CoTaskMemAlloc(sizeof(*format_ext)); - *size = sizeof(*format_ext); - format = (WAVEFORMATEX *)format_ext; - } - else - { - format = CoTaskMemAlloc(sizeof(*format)); - *size = sizeof(*format); - } + extra_size = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(*format); - if (!format) + *size = sizeof(*format) + user_size + extra_size; + if (!(format = CoTaskMemAlloc(*size))) return E_OUTOFMEMORY; memset(format, 0, *size); - - if (format_ext) - format->wFormatTag = WAVE_FORMAT_EXTENSIBLE; - else if (IsEqualGUID(&subtype, &MFAudioFormat_Float)) - format->wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - else - format->wFormatTag = WAVE_FORMAT_PCM; + format->wFormatTag = subtype.Data1; + format->cbSize = user_size + extra_size; + user_data = format + 1; if (SUCCEEDED(IMFMediaType_GetUINT32(mediatype, &MF_MT_AUDIO_NUM_CHANNELS, &value))) format->nChannels = value; @@ -3023,18 +3011,26 @@ HRESULT WINAPI MFCreateWaveFormatExFromMFMediaType(IMFMediaType *mediatype, WAVE format->nBlockAlign = value; if (SUCCEEDED(IMFMediaType_GetUINT32(mediatype, &MF_MT_AUDIO_BITS_PER_SAMPLE, &value))) format->wBitsPerSample = value; - if (format_ext) + + if (flags == MFWaveFormatExConvertFlag_ForceExtensible) { - format->cbSize = sizeof(*format_ext) - sizeof(*format); + WAVEFORMATEXTENSIBLE *format_ext = CONTAINING_RECORD(format, WAVEFORMATEXTENSIBLE, Format); + + format_ext->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + format_ext->SubFormat = subtype; + user_data = format_ext + 1; if (SUCCEEDED(IMFMediaType_GetUINT32(mediatype, &MF_MT_AUDIO_VALID_BITS_PER_SAMPLE, &value))) format_ext->Samples.wSamplesPerBlock = value; if (SUCCEEDED(IMFMediaType_GetUINT32(mediatype, &MF_MT_AUDIO_CHANNEL_MASK, &value))) format_ext->dwChannelMask = value; - memcpy(&format_ext->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM, sizeof(format_ext->SubFormat)); + else if (format_ext->Format.nChannels < ARRAY_SIZE(default_channel_mask)) + format_ext->dwChannelMask = default_channel_mask[format_ext->Format.nChannels]; } + IMFMediaType_GetBlob(mediatype, &MF_MT_USER_DATA, user_data, user_size, NULL); + *ret_format = format; return S_OK; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 0c1e6b55321..f785df89b32 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -7088,38 +7088,30 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void) ok(!memcmp(buff, (WAVEFORMATEX *)&aacformat + 1, size), "Unexpected user data.\n"); hr = MFCreateWaveFormatExFromMFMediaType(mediatype, (WAVEFORMATEX **)&format, &size, MFWaveFormatExConvertFlag_ForceExtensible); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "got wFormatTag %#x\n", format->Format.wFormatTag); - ok(format->Format.cbSize == aacformat.wfInfo.wfx.cbSize + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), - "got cbSize %u\n", format->Format.cbSize); - ok(IsEqualGUID(&format->SubFormat, &MFAudioFormat_AAC), "got SubFormat %s\n", debugstr_guid(&format->SubFormat)); - ok(format->dwChannelMask == 3, "got dwChannelMask %#lx\n", format->dwChannelMask); - ok(format->Samples.wSamplesPerBlock == 0, "got wSamplesPerBlock %u\n", format->Samples.wSamplesPerBlock); - ok(!memcmp(format + 1, &aacformat.wfInfo.wfx + 1, aacformat.wfInfo.wfx.cbSize), "Unexpected user data.\n"); - CoTaskMemFree(format); - } + ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "got wFormatTag %#x\n", format->Format.wFormatTag); + ok(format->Format.cbSize == aacformat.wfInfo.wfx.cbSize + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), + "got cbSize %u\n", format->Format.cbSize); + ok(IsEqualGUID(&format->SubFormat, &MFAudioFormat_AAC), "got SubFormat %s\n", debugstr_guid(&format->SubFormat)); + ok(format->dwChannelMask == 3, "got dwChannelMask %#lx\n", format->dwChannelMask); + ok(format->Samples.wSamplesPerBlock == 0, "got wSamplesPerBlock %u\n", format->Samples.wSamplesPerBlock); + ok(!memcmp(format + 1, &aacformat.wfInfo.wfx + 1, aacformat.wfInfo.wfx.cbSize), "Unexpected user data.\n"); + CoTaskMemFree(format); /* test with invalid format size */ aacformat.wfInfo.wfx.cbSize = 1; hr = IMFMediaType_SetBlob(mediatype, &MF_MT_USER_DATA, buff, aacformat.wfInfo.wfx.cbSize); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = MFCreateWaveFormatExFromMFMediaType(mediatype, (WAVEFORMATEX **)&format, &size, MFWaveFormatExConvertFlag_ForceExtensible); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "got wFormatTag %#x\n", format->Format.wFormatTag); - ok(format->Format.cbSize == aacformat.wfInfo.wfx.cbSize + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), - "got cbSize %u\n", format->Format.cbSize); - ok(IsEqualGUID(&format->SubFormat, &MFAudioFormat_AAC), "got SubFormat %s\n", debugstr_guid(&format->SubFormat)); - ok(format->dwChannelMask == 3, "got dwChannelMask %#lx\n", format->dwChannelMask); - ok(format->Samples.wSamplesPerBlock == 0, "got wSamplesPerBlock %u\n", format->Samples.wSamplesPerBlock); - ok(!memcmp(format + 1, &aacformat.wfInfo.wfx + 1, aacformat.wfInfo.wfx.cbSize), "Unexpected user data.\n"); - CoTaskMemFree(format); - } + ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "got wFormatTag %#x\n", format->Format.wFormatTag); + ok(format->Format.cbSize == aacformat.wfInfo.wfx.cbSize + sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), + "got cbSize %u\n", format->Format.cbSize); + ok(IsEqualGUID(&format->SubFormat, &MFAudioFormat_AAC), "got SubFormat %s\n", debugstr_guid(&format->SubFormat)); + ok(format->dwChannelMask == 3, "got dwChannelMask %#lx\n", format->dwChannelMask); + ok(format->Samples.wSamplesPerBlock == 0, "got wSamplesPerBlock %u\n", format->Samples.wSamplesPerBlock); + ok(!memcmp(format + 1, &aacformat.wfInfo.wfx + 1, aacformat.wfInfo.wfx.cbSize), "Unexpected user data.\n"); + CoTaskMemFree(format); IMFMediaType_Release(mediatype); } From 4653d4613c8ac6403a00df441324e9cd3c5fabcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 08:52:36 +0100 Subject: [PATCH 1131/1506] winegstreamer: Fix reading MF_MT_USER_DATA into HEAACWAVEFORMAT. Fixes 681d20146226132c2ed18ae7ecb53003e6ffcf44. The winegstreamer private declaration of HEAACWAVEINFO previously didn't include the WAVEFORMATEX member as it should. (cherry picked from commit 42c96b9c8fb0c4bcc912e365733b564f3faf5f7c) --- dlls/winegstreamer/mfplat.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index c386ce492d1..4372678fe0e 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -643,12 +643,14 @@ static void mf_media_type_to_wg_format_audio(IMFMediaType *type, const GUID *sub static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUID *subtype, struct wg_format *format) { - BYTE buffer[64]; - HEAACWAVEFORMAT *user_data = (HEAACWAVEFORMAT *)buffer; + BYTE buffer[sizeof(HEAACWAVEFORMAT) + 64]; + HEAACWAVEFORMAT *wfx = (HEAACWAVEFORMAT *)buffer; UINT32 codec_data_size; BOOL raw_aac; - if (FAILED(IMFMediaType_GetBlob(type, &MF_MT_USER_DATA, buffer, sizeof(buffer), &codec_data_size))) + wfx->wfInfo.wfx.cbSize = sizeof(buffer) - sizeof(wfx->wfInfo.wfx); + if (FAILED(IMFMediaType_GetBlob(type, &MF_MT_USER_DATA, (BYTE *)(&wfx->wfInfo.wfx + 1), + wfx->wfInfo.wfx.cbSize, &codec_data_size))) { FIXME("Codec data is not set.\n"); return; @@ -656,16 +658,16 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUI raw_aac = IsEqualGUID(subtype, &MFAudioFormat_RAW_AAC); if (!raw_aac) - codec_data_size -= min(codec_data_size, offsetof(HEAACWAVEFORMAT, pbAudioSpecificConfig)); + codec_data_size -= min(codec_data_size, sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)); if (codec_data_size > sizeof(format->u.audio_mpeg4.codec_data)) { FIXME("Codec data needs %u bytes.\n", codec_data_size); return; } if (raw_aac) - memcpy(format->u.audio_mpeg4.codec_data, buffer, codec_data_size); + memcpy(format->u.audio_mpeg4.codec_data, (BYTE *)(&wfx->wfInfo.wfx + 1), codec_data_size); else - memcpy(format->u.audio_mpeg4.codec_data, user_data->pbAudioSpecificConfig, codec_data_size); + memcpy(format->u.audio_mpeg4.codec_data, wfx->pbAudioSpecificConfig, codec_data_size); format->major_type = WG_MAJOR_TYPE_AUDIO_MPEG4; From dc4d6b2322fbb8fde110801f4757f220277101f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 16 Nov 2023 11:59:50 +0100 Subject: [PATCH 1132/1506] winegstreamer: Use MFCreateAudioMediaType in the AAC decoder. (cherry picked from commit c65703eac726f41b64ee58fb45fbdc9bbd83f5d7) --- dlls/winegstreamer/aac_decoder.c | 203 ++++++++++--------------------- 1 file changed, 66 insertions(+), 137 deletions(-) diff --git a/dlls/winegstreamer/aac_decoder.c b/dlls/winegstreamer/aac_decoder.c index dfab7a8b0c0..811313b6fe4 100644 --- a/dlls/winegstreamer/aac_decoder.c +++ b/dlls/winegstreamer/aac_decoder.c @@ -32,22 +32,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DECLARE_DEBUG_CHANNEL(winediag); -static struct +static HEAACWAVEINFO aac_decoder_input_types[] = { - const GUID *const guid; - UINT32 payload_type; -} aac_decoder_input_types[] = -{ - {&MFAudioFormat_AAC, 0}, - {&MFAudioFormat_RAW_AAC, -1}, - {&MFAudioFormat_AAC, 1}, - {&MFAudioFormat_AAC, 3}, - {&MFAudioFormat_ADTS, -1}, +#define MAKE_HEAACWAVEINFO(format, payload) \ + {.wfx = {.wFormatTag = format, .nChannels = 6, .nSamplesPerSec = 48000, .nAvgBytesPerSec = 1152000, \ + .nBlockAlign = 24, .wBitsPerSample = 32, .cbSize = sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)}, \ + .wPayloadType = payload} + + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 0), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_RAW_AAC1, 0), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 1), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 3), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_ADTS_AAC, 0), + +#undef MAKE_HEAACWAVEINFO }; -static const GUID *const aac_decoder_output_types[] = + +static WAVEFORMATEXTENSIBLE const aac_decoder_output_types[] = { - &MFAudioFormat_PCM, - &MFAudioFormat_Float, + {.Format = {.wFormatTag = WAVE_FORMAT_IEEE_FLOAT, .wBitsPerSample = 32, .nSamplesPerSec = 48000, .nChannels = 2}}, + {.Format = {.wFormatTag = WAVE_FORMAT_PCM, .wBitsPerSample = 16, .nSamplesPerSec = 48000, .nChannels = 2}}, }; static const UINT32 default_channel_mask[7] = @@ -234,79 +238,41 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - IMFMediaType *media_type; - const GUID *subtype; - HRESULT hr; - TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); + *type = NULL; if (id) return MF_E_INVALIDSTREAMNUMBER; - - *type = NULL; if (index >= ARRAY_SIZE(aac_decoder_input_types)) return MF_E_NO_MORE_TYPES; - subtype = aac_decoder_input_types[index].guid; - - if (FAILED(hr = MFCreateMediaType(&media_type))) - return hr; - - if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio))) - goto done; - if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, subtype))) - goto done; - - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, 32))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_NUM_CHANNELS, 6))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, 24))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, 48000))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, 1152000))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_PREFER_WAVEFORMATEX, 1))) - goto done; - if (IsEqualGUID(subtype, &MFAudioFormat_AAC)) - { - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, 0))) - goto done; - if (aac_decoder_input_types[index].payload_type != -1 - && FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AAC_PAYLOAD_TYPE, - aac_decoder_input_types[index].payload_type))) - goto done; - } - -done: - if (SUCCEEDED(hr)) - IMFMediaType_AddRef((*type = media_type)); - - IMFMediaType_Release(media_type); - return hr; + return MFCreateAudioMediaType(&aac_decoder_input_types[index].wfx, (IMFAudioMediaType **)type); } static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - UINT32 channel_count, sample_size, sample_rate, block_alignment; struct aac_decoder *decoder = impl_from_IMFTransform(iface); + UINT32 channel_count, sample_rate; + WAVEFORMATEXTENSIBLE wfx = {{0}}; IMFMediaType *media_type; - const GUID *output_type; HRESULT hr; TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); + *type = NULL; + if (id) return MF_E_INVALIDSTREAMNUMBER; if (!decoder->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET; - *type = NULL; + wfx = aac_decoder_output_types[index % ARRAY_SIZE(aac_decoder_output_types)]; if (FAILED(hr = IMFMediaType_GetUINT32(decoder->input_type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count)) || !channel_count) - channel_count = 2; + channel_count = wfx.Format.nChannels; + if (FAILED(hr = IMFMediaType_GetUINT32(decoder->input_type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &sample_rate))) + sample_rate = wfx.Format.nSamplesPerSec; if (channel_count >= ARRAY_SIZE(default_channel_mask)) return MF_E_INVALIDMEDIATYPE; @@ -321,54 +287,24 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR if (index >= ARRAY_SIZE(aac_decoder_output_types)) return MF_E_NO_MORE_TYPES; - index = ARRAY_SIZE(aac_decoder_output_types) - index - 1; - output_type = aac_decoder_output_types[index]; - if (FAILED(hr = MFCreateMediaType(&media_type))) - return hr; + wfx.Format.nChannels = channel_count; + wfx.Format.nSamplesPerSec = sample_rate; + wfx.Format.nBlockAlign = wfx.Format.wBitsPerSample * wfx.Format.nChannels / 8; + wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; - if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio))) - goto done; - if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, output_type))) - goto done; - - if (IsEqualGUID(output_type, &MFAudioFormat_Float)) - sample_size = 32; - else if (IsEqualGUID(output_type, &MFAudioFormat_PCM)) - sample_size = 16; - else + if (wfx.Format.nChannels >= 3) { - FIXME("Subtype %s not implemented!\n", debugstr_guid(output_type)); - hr = E_NOTIMPL; - goto done; + wfx.SubFormat = MFAudioFormat_Base; + wfx.SubFormat.Data1 = wfx.Format.wFormatTag; + wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfx.dwChannelMask = default_channel_mask[wfx.Format.nChannels]; } - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, sample_size))) - goto done; - - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_NUM_CHANNELS, channel_count))) - goto done; - - if (FAILED(hr = IMFMediaType_GetUINT32(decoder->input_type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &sample_rate))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, sample_rate))) - goto done; - - block_alignment = sample_size * channel_count / 8; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, block_alignment))) - goto done; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, sample_rate * block_alignment))) - goto done; - - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1))) - goto done; + if (FAILED(hr = MFCreateAudioMediaType(&wfx.Format, (IMFAudioMediaType **)&media_type))) + return hr; if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, 1))) goto done; - if (channel_count < 3 && FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_PREFER_WAVEFORMATEX, 1))) - goto done; - if (channel_count >= 3 && FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_CHANNEL_MASK, - default_channel_mask[channel_count]))) - goto done; done: if (SUCCEEDED(hr)) @@ -378,12 +314,22 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR return hr; } +static BOOL matches_format(const WAVEFORMATEXTENSIBLE *a, const WAVEFORMATEXTENSIBLE *b) +{ + if (a->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && b->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE) + return IsEqualGUID(&a->SubFormat, &b->SubFormat); + if (a->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE) + return a->SubFormat.Data1 == b->Format.wFormatTag; + if (b->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE) + return b->SubFormat.Data1 == a->Format.wFormatTag; + return a->Format.wFormatTag == b->Format.wFormatTag; +} + static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { struct aac_decoder *decoder = impl_from_IMFTransform(iface); - MF_ATTRIBUTE_TYPE item_type; - UINT32 channel_count; - GUID major, subtype; + WAVEFORMATEXTENSIBLE *format, wfx; + UINT32 size; HRESULT hr; ULONG i; @@ -392,28 +338,19 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM if (id) return MF_E_INVALIDSTREAMNUMBER; - if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major))) - return E_INVALIDARG; - - if (!IsEqualGUID(&major, &MFMediaType_Audio) - || FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) - return MF_E_INVALIDMEDIATYPE; + if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(type, (WAVEFORMATEX **)&format, &size, + MFWaveFormatExConvertFlag_ForceExtensible))) + return hr; + wfx = *format; + CoTaskMemFree(format); for (i = 0; i < ARRAY_SIZE(aac_decoder_input_types); ++i) - if (IsEqualGUID(&subtype, aac_decoder_input_types[i].guid)) + if (matches_format((WAVEFORMATEXTENSIBLE *)&aac_decoder_input_types[i], &wfx)) break; if (i == ARRAY_SIZE(aac_decoder_input_types)) return MF_E_INVALIDMEDIATYPE; - if (SUCCEEDED(IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count)) - && channel_count >= ARRAY_SIZE(default_channel_mask)) - return MF_E_INVALIDMEDIATYPE; - - if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &item_type)) - || item_type != MF_ATTRIBUTE_UINT32) - return MF_E_INVALIDMEDIATYPE; - if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_USER_DATA, &item_type)) - || item_type != MF_ATTRIBUTE_BLOB) + if (wfx.Format.nChannels >= ARRAY_SIZE(default_channel_mask) || !wfx.Format.nSamplesPerSec || !wfx.Format.cbSize) return MF_E_INVALIDMEDIATYPE; if (flags & MFT_SET_TYPE_TEST_ONLY) return S_OK; @@ -433,8 +370,8 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { struct aac_decoder *decoder = impl_from_IMFTransform(iface); - MF_ATTRIBUTE_TYPE item_type; - GUID major, subtype; + WAVEFORMATEXTENSIBLE *format, wfx; + UINT32 size; HRESULT hr; ULONG i; @@ -445,27 +382,19 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF if (!decoder->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET; - if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) - || FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) + if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(type, (WAVEFORMATEX **)&format, &size, + MFWaveFormatExConvertFlag_ForceExtensible))) return hr; - - if (!IsEqualGUID(&major, &MFMediaType_Audio)) - return MF_E_INVALIDMEDIATYPE; + wfx = *format; + CoTaskMemFree(format); for (i = 0; i < ARRAY_SIZE(aac_decoder_output_types); ++i) - if (IsEqualGUID(&subtype, aac_decoder_output_types[i])) + if (matches_format(&aac_decoder_output_types[i], &wfx)) break; if (i == ARRAY_SIZE(aac_decoder_output_types)) return MF_E_INVALIDMEDIATYPE; - if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_BITS_PER_SAMPLE, &item_type)) - || item_type != MF_ATTRIBUTE_UINT32) - return MF_E_INVALIDMEDIATYPE; - if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_NUM_CHANNELS, &item_type)) - || item_type != MF_ATTRIBUTE_UINT32) - return MF_E_INVALIDMEDIATYPE; - if (FAILED(IMFMediaType_GetItemType(type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &item_type)) - || item_type != MF_ATTRIBUTE_UINT32) + if (!wfx.Format.wBitsPerSample || !wfx.Format.nChannels || !wfx.Format.nSamplesPerSec) return MF_E_INVALIDMEDIATYPE; if (flags & MFT_SET_TYPE_TEST_ONLY) return S_OK; From 26322a76874541295c669bf22783145ab6141b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Nov 2023 11:20:54 +0100 Subject: [PATCH 1133/1506] winegstreamer: Use an array for the audio decoder input types. (cherry picked from commit 68f8b53d69453eace97ce02eb68dfd88d351a27a) --- dlls/winegstreamer/aac_decoder.c | 58 +++++++++++++++++++------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/dlls/winegstreamer/aac_decoder.c b/dlls/winegstreamer/aac_decoder.c index 811313b6fe4..c0bc57f278e 100644 --- a/dlls/winegstreamer/aac_decoder.c +++ b/dlls/winegstreamer/aac_decoder.c @@ -32,21 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DECLARE_DEBUG_CHANNEL(winediag); -static HEAACWAVEINFO aac_decoder_input_types[] = -{ -#define MAKE_HEAACWAVEINFO(format, payload) \ - {.wfx = {.wFormatTag = format, .nChannels = 6, .nSamplesPerSec = 48000, .nAvgBytesPerSec = 1152000, \ - .nBlockAlign = 24, .wBitsPerSample = 32, .cbSize = sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)}, \ - .wPayloadType = payload} - - MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 0), - MAKE_HEAACWAVEINFO(WAVE_FORMAT_RAW_AAC1, 0), - MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 1), - MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 3), - MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_ADTS_AAC, 0), - -#undef MAKE_HEAACWAVEINFO -}; +#define NEXT_WAVEFORMATEXTENSIBLE(format) (WAVEFORMATEXTENSIBLE *)((BYTE *)(&(format)->Format + 1) + (format)->Format.cbSize) static WAVEFORMATEXTENSIBLE const aac_decoder_output_types[] = { @@ -69,6 +55,10 @@ struct aac_decoder { IMFTransform IMFTransform_iface; LONG refcount; + + UINT input_type_count; + WAVEFORMATEXTENSIBLE *input_types; + IMFMediaType *input_type; IMFMediaType *output_type; @@ -238,14 +228,18 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { + struct aac_decoder *decoder = impl_from_IMFTransform(iface); + const WAVEFORMATEXTENSIBLE *format = decoder->input_types; + UINT count = decoder->input_type_count; + TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); *type = NULL; if (id) return MF_E_INVALIDSTREAMNUMBER; - if (index >= ARRAY_SIZE(aac_decoder_input_types)) - return MF_E_NO_MORE_TYPES; - return MFCreateAudioMediaType(&aac_decoder_input_types[index].wfx, (IMFAudioMediaType **)type); + for (format = decoder->input_types; index > 0 && count > 0; index--, count--) + format = NEXT_WAVEFORMATEXTENSIBLE(format); + return count ? MFCreateAudioMediaType(&format->Format, (IMFAudioMediaType **)type) : MF_E_NO_MORE_TYPES; } static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, @@ -328,10 +322,9 @@ static BOOL matches_format(const WAVEFORMATEXTENSIBLE *a, const WAVEFORMATEXTENS static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { struct aac_decoder *decoder = impl_from_IMFTransform(iface); + UINT32 size, count = decoder->input_type_count; WAVEFORMATEXTENSIBLE *format, wfx; - UINT32 size; HRESULT hr; - ULONG i; TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags); @@ -344,10 +337,9 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM wfx = *format; CoTaskMemFree(format); - for (i = 0; i < ARRAY_SIZE(aac_decoder_input_types); ++i) - if (matches_format((WAVEFORMATEXTENSIBLE *)&aac_decoder_input_types[i], &wfx)) - break; - if (i == ARRAY_SIZE(aac_decoder_input_types)) + for (format = decoder->input_types; count > 0 && !matches_format(format, &wfx); count--) + format = NEXT_WAVEFORMATEXTENSIBLE(format); + if (!count) return MF_E_INVALIDMEDIATYPE; if (wfx.Format.nChannels >= ARRAY_SIZE(default_channel_mask) || !wfx.Format.nSamplesPerSec || !wfx.Format.cbSize) @@ -574,6 +566,22 @@ static const IMFTransformVtbl transform_vtbl = transform_ProcessOutput, }; +static HEAACWAVEINFO aac_decoder_input_types[] = +{ +#define MAKE_HEAACWAVEINFO(format, payload) \ + {.wfx = {.wFormatTag = format, .nChannels = 6, .nSamplesPerSec = 48000, .nAvgBytesPerSec = 1152000, \ + .nBlockAlign = 24, .wBitsPerSample = 32, .cbSize = sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)}, \ + .wPayloadType = payload} + + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 0), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_RAW_AAC1, 0), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 1), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_HEAAC, 3), + MAKE_HEAACWAVEINFO(WAVE_FORMAT_MPEG_ADTS_AAC, 0), + +#undef MAKE_HEAACWAVEINFO +}; + HRESULT aac_decoder_create(REFIID riid, void **ret) { static const struct wg_format output_format = @@ -604,6 +612,8 @@ HRESULT aac_decoder_create(REFIID riid, void **ret) if (!(decoder = calloc(1, sizeof(*decoder)))) return E_OUTOFMEMORY; + decoder->input_types = (WAVEFORMATEXTENSIBLE *)aac_decoder_input_types; + decoder->input_type_count = ARRAY_SIZE(aac_decoder_input_types); if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue))) { From d1dbd2bf0892ee8665906a77210618321f92e8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Jan 2024 14:00:43 +0100 Subject: [PATCH 1134/1506] mf/tests: Check inserted topology loader transforms explicitly. (cherry picked from commit 56b1f8021048621d0354dac302d694500df1062e) --- dlls/mf/tests/mf.c | 180 ++++++++++++++++++++++++++++++--------------- 1 file changed, 120 insertions(+), 60 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 3dd0d9b076d..f5a7821f0f8 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2983,8 +2983,6 @@ static IMFSampleGrabberSinkCallback *create_test_grabber_callback(void) enum loader_test_flags { - LOADER_EXPECTED_DECODER = 0x1, - LOADER_EXPECTED_CONVERTER = 0x2, LOADER_TODO = 0x4, LOADER_NEEDS_VIDEO_PROCESSOR = 0x8, LOADER_SET_ENUMERATE_SOURCE_TYPES = 0x10, @@ -3066,6 +3064,18 @@ static void test_topology_loader(void) ATTR_UINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT, 1), ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 8), }; + static const media_type_desc audio_float_44100_stereo = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio), + ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_Float), + ATTR_UINT32(MF_MT_AUDIO_NUM_CHANNELS, 2), + ATTR_UINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT, 2 * 4), + ATTR_UINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 44100), + ATTR_UINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, 2 * 4 * 44100), + ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 4 * 8), + ATTR_UINT32(MF_MT_AUDIO_CHANNEL_MASK, 3), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + }; static const media_type_desc video_i420_1280 = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -3089,6 +3099,25 @@ static void test_topology_loader(void) ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32), }; + static const media_type_desc video_h264_1280 = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), + ATTR_RATIO(MF_MT_FRAME_SIZE, 1280, 720), + }; + static const media_type_desc video_nv12_1280 = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_RATIO(MF_MT_FRAME_SIZE, 1280, 720), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 1280 * 720 * 3 / 2), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 1280), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + }; static const media_type_desc video_dummy = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -3099,10 +3128,13 @@ static void test_topology_loader(void) const media_type_desc *input_type; const media_type_desc *output_type; const media_type_desc *current_input; + const media_type_desc *decoded_type; MF_CONNECT_METHOD source_method; MF_CONNECT_METHOD sink_method; HRESULT expected_result; unsigned int flags; + GUID decoder_class; + GUID converter_class; } loader_tests[] = { @@ -3167,27 +3199,24 @@ static void test_topology_loader(void) { /* PCM -> PCM, different enumerated bps, no current type, sink allow converter */ .input_type = &audio_pcm_44100, .output_type = &audio_pcm_48000, .sink_method = MF_CONNECT_ALLOW_CONVERTER, .source_method = MF_CONNECT_DIRECT, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CResamplerMediaObject, }, { /* PCM -> PCM, different enumerated bps, same current type, sink allow converter, force enumerate */ .input_type = &audio_pcm_44100, .output_type = &audio_pcm_48000, .sink_method = MF_CONNECT_ALLOW_CONVERTER, .source_method = -1, .current_input = &audio_pcm_48000, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_CONVERTER | LOADER_SET_ENUMERATE_SOURCE_TYPES, + .expected_result = S_OK, .converter_class = CLSID_CResamplerMediaObject, + .flags = LOADER_SET_ENUMERATE_SOURCE_TYPES, }, { /* PCM -> PCM, different enumerated bps, no current type, sink allow decoder */ .input_type = &audio_pcm_44100, .output_type = &audio_pcm_48000, .sink_method = MF_CONNECT_ALLOW_DECODER, .source_method = MF_CONNECT_DIRECT, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CResamplerMediaObject, }, { /* PCM -> PCM, different enumerated bps, no current type, default methods */ .input_type = &audio_pcm_44100, .output_type = &audio_pcm_48000, .sink_method = -1, .source_method = -1, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CResamplerMediaObject, }, { /* PCM -> PCM, different enumerated bps, no current type, source allow converter */ @@ -3198,14 +3227,14 @@ static void test_topology_loader(void) { /* Float -> PCM, refuse input type, add converter */ .input_type = &audio_float_44100, .output_type = &audio_pcm_48000, .sink_method = MF_CONNECT_DIRECT, .source_method = -1, - .expected_result = MF_E_NO_MORE_TYPES, - .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT | LOADER_EXPECTED_CONVERTER, + .expected_result = MF_E_NO_MORE_TYPES, .converter_class = CLSID_CResamplerMediaObject, + .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT, }, { /* Float -> PCM, refuse input type, add converter, allow resampler output type */ .input_type = &audio_float_44100, .output_type = &audio_pcm_48000_resampler, .sink_method = MF_CONNECT_DIRECT, .source_method = -1, - .expected_result = S_OK, - .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT | LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CResamplerMediaObject, + .flags = LOADER_SET_INVALID_INPUT | LOADER_ADD_RESAMPLER_MFT, }, { @@ -3232,34 +3261,39 @@ static void test_topology_loader(void) /* MP3 -> PCM */ .input_type = &audio_mp3_44100, .output_type = &audio_pcm_44100, .sink_method = MF_CONNECT_ALLOW_DECODER, .source_method = -1, .current_input = &audio_mp3_44100, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_DECODER | LOADER_TODO, + .expected_result = S_OK, .decoder_class = CLSID_CMP3DecMediaObject, + .flags = LOADER_TODO, }, { /* MP3 -> PCM, need both decoder and converter */ .input_type = &audio_mp3_44100, .output_type = &audio_float_48000, .sink_method = MF_CONNECT_ALLOW_DECODER, .source_method = -1, - .current_input = &audio_mp3_44100, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_DECODER | LOADER_EXPECTED_CONVERTER | LOADER_TODO, + .current_input = &audio_mp3_44100, .decoded_type = &audio_float_44100_stereo, + .expected_result = S_OK, .decoder_class = CLSID_CMP3DecMediaObject, .converter_class = CLSID_CResamplerMediaObject, + .flags = LOADER_TODO, }, { /* I420 -> RGB32, Color Convert media type */ .input_type = &video_i420_1280, .output_type = &video_color_convert_1280_rgb32, .sink_method = -1, .source_method = -1, - .expected_result = MF_E_TOPO_CODEC_NOT_FOUND, - .flags = LOADER_NEEDS_VIDEO_PROCESSOR | LOADER_EXPECTED_CONVERTER, + .expected_result = MF_E_TOPO_CODEC_NOT_FOUND, .converter_class = CLSID_CColorConvertDMO, + .flags = LOADER_NEEDS_VIDEO_PROCESSOR, }, { /* I420 -> RGB32, Video Processor media type */ .input_type = &video_i420_1280, .output_type = &video_video_processor_1280_rgb32, .sink_method = -1, .source_method = -1, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CColorConvertDMO, }, { /* I420 -> RGB32, Video Processor media type without frame size */ .input_type = &video_i420_1280, .output_type = &video_video_processor_rgb32, .sink_method = -1, .source_method = -1, - .expected_result = S_OK, - .flags = LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CColorConvertDMO, + }, + { + /* H264 -> RGB32, Video Processor media type */ + .input_type = &video_h264_1280, .output_type = &video_video_processor_1280_rgb32, .sink_method = -1, .source_method = -1, + .decoded_type = &video_nv12_1280, + .expected_result = S_OK, .decoder_class = CLSID_CMSH264DecoderMFT, .converter_class = CLSID_CColorConvertDMO, + .flags = LOADER_TODO, }, { /* RGB32 -> Any Video, no current output type */ @@ -3270,14 +3304,14 @@ static void test_topology_loader(void) { /* RGB32 -> Any Video, no current output type, refuse input type */ .input_type = &video_i420_1280, .output_type = &video_dummy, .sink_method = -1, .source_method = -1, - .expected_result = S_OK, - .flags = LOADER_NO_CURRENT_OUTPUT | LOADER_SET_INVALID_INPUT | LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CColorConvertDMO, + .flags = LOADER_NO_CURRENT_OUTPUT | LOADER_SET_INVALID_INPUT, }, { /* RGB32 -> Any Video, no current output type, refuse input type */ .input_type = &video_i420_1280, .output_type = &video_video_processor_rgb32, .sink_method = -1, .source_method = -1, - .expected_result = S_OK, - .flags = LOADER_NO_CURRENT_OUTPUT | LOADER_SET_INVALID_INPUT | LOADER_SET_MEDIA_TYPES | LOADER_EXPECTED_CONVERTER, + .expected_result = S_OK, .converter_class = CLSID_CColorConvertDMO, + .flags = LOADER_NO_CURRENT_OUTPUT | LOADER_SET_INVALID_INPUT | LOADER_SET_MEDIA_TYPES, }, }; @@ -3536,14 +3570,14 @@ todo_wine { ok(value == MF_TOPOLOGY_RESOLUTION_SUCCEEDED, "Unexpected value %#x.\n", value); } count = 2; - if (test->flags & LOADER_EXPECTED_DECODER) + if (!IsEqualGUID(&test->decoder_class, &GUID_NULL)) count++; - if (test->flags & LOADER_EXPECTED_CONVERTER) + if (!IsEqualGUID(&test->converter_class, &GUID_NULL)) count++; hr = IMFTopology_GetNodeCount(full_topology, &node_count); ok(hr == S_OK, "Failed to get node count, hr %#lx.\n", hr); - todo_wine_if(test->flags & LOADER_EXPECTED_DECODER) + todo_wine_if(!IsEqualGUID(&test->decoder_class, &GUID_NULL)) ok(node_count == count, "Unexpected node count %u.\n", node_count); hr = IMFTopologyNode_GetTopoNodeID(src_node, &node_id); @@ -3558,29 +3592,31 @@ todo_wine { hr = IMFTopology_GetNodeByID(full_topology, node_id, &sink_node2); ok(hr == S_OK, "Failed to get sink in resolved topology, hr %#lx.\n", hr); - if (test->flags & (LOADER_EXPECTED_DECODER | LOADER_EXPECTED_CONVERTER)) + if (!IsEqualGUID(&test->decoder_class, &GUID_NULL)) { + GUID class_id; + hr = IMFTopologyNode_GetOutput(src_node2, 0, &mft_node, &index); - ok(hr == S_OK, "Failed to get transform node in resolved topology, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get decoder in resolved topology, hr %#lx.\n", hr); ok(!index, "Unexpected stream index %lu.\n", index); hr = IMFTopologyNode_GetNodeType(mft_node, &node_type); ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#lx.\n", hr); ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u.\n", node_type); - hr = IMFTopologyNode_GetObject(mft_node, &node_object); - ok(hr == S_OK, "Failed to get object of transform node, hr %#lx.\n", hr); - - if (test->flags & LOADER_EXPECTED_DECODER) - { - value = 0; - hr = IMFTopologyNode_GetUINT32(mft_node, &MF_TOPONODE_DECODER, &value); - ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); - ok(value == 1, "Unexpected value.\n"); - } + value = 0; + hr = IMFTopologyNode_GetUINT32(mft_node, &MF_TOPONODE_DECODER, &value); + ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); + ok(value == 1, "Unexpected value.\n"); - hr = IMFTopologyNode_GetItem(mft_node, &MF_TOPONODE_TRANSFORM_OBJECTID, NULL); + class_id = GUID_NULL; + hr = IMFTopologyNode_GetGUID(mft_node, &MF_TOPONODE_TRANSFORM_OBJECTID, &class_id); ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); + ok(IsEqualGUID(&class_id, &test->decoder_class), "got MF_TOPONODE_TRANSFORM_OBJECTID %s.\n", debugstr_guid(&class_id)); + + hr = IMFTopologyNode_GetObject(mft_node, &node_object); + ok(hr == S_OK, "Failed to get object of transform node, hr %#lx.\n", hr); + IMFTopologyNode_Release(mft_node); hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void **)&transform); ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#lx.\n", hr); @@ -3588,51 +3624,75 @@ todo_wine { hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); - hr = IMFMediaType_Compare(input_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); ok(ret, "Input type of first transform doesn't match source node type.\n"); + IMFMediaType_Release(media_type); - IMFTopologyNode_Release(mft_node); + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); + if (IsEqualGUID(&test->converter_class, &GUID_NULL)) + { + hr = IMFMediaType_Compare(output_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); + ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); + ok(ret, "Output type of first transform doesn't match sink node type.\n"); + } + else if (test->decoded_type) + { + check_media_type(media_type, *test->decoded_type, -1); + } IMFMediaType_Release(media_type); + IMFTransform_Release(transform); + } + + if (!IsEqualGUID(&test->converter_class, &GUID_NULL)) + { + GUID class_id; hr = IMFTopologyNode_GetInput(sink_node2, 0, &mft_node, &index); - ok(hr == S_OK, "Failed to get transform node in resolved topology, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get decoder in resolved topology, hr %#lx.\n", hr); ok(!index, "Unexpected stream index %lu.\n", index); hr = IMFTopologyNode_GetNodeType(mft_node, &node_type); ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#lx.\n", hr); ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u.\n", node_type); - hr = IMFTopologyNode_GetItem(mft_node, &MF_TOPONODE_TRANSFORM_OBJECTID, NULL); + class_id = GUID_NULL; + hr = IMFTopologyNode_GetGUID(mft_node, &MF_TOPONODE_TRANSFORM_OBJECTID, &class_id); ok(hr == S_OK, "Failed to get attribute, hr %#lx.\n", hr); + todo_wine_if(IsEqualGUID(&test->converter_class, &CLSID_CColorConvertDMO)) + ok(IsEqualGUID(&class_id, &test->converter_class), "got MF_TOPONODE_TRANSFORM_OBJECTID %s.\n", debugstr_guid(&class_id)); hr = IMFTopologyNode_GetObject(mft_node, &node_object); ok(hr == S_OK, "Failed to get object of transform node, hr %#lx.\n", hr); + IMFTopologyNode_Release(mft_node); - hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void**) &transform); + hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void **)&transform); ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#lx.\n", hr); IUnknown_Release(node_object); - hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); - ok(hr == S_OK, "Failed to get transform output type, hr %#lx.\n", hr); - hr = IMFMediaType_Compare(output_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); - ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); - ok(ret, "Output type of last transform doesn't match sink node type.\n"); - IMFMediaType_Release(media_type); - hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); - if ((test->flags & (LOADER_EXPECTED_CONVERTER | LOADER_EXPECTED_DECODER)) != (LOADER_EXPECTED_CONVERTER | LOADER_EXPECTED_DECODER)) + if (IsEqualGUID(&test->decoder_class, &GUID_NULL)) { hr = IMFMediaType_Compare(input_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); - ok(ret, "Input type of transform doesn't match source node type.\n"); + ok(ret, "Input type of last transform doesn't match source node type.\n"); + } + else if (test->decoded_type) + { + check_media_type(media_type, *test->decoded_type, -1); } IMFMediaType_Release(media_type); - IMFTopologyNode_Release(mft_node); + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); + hr = IMFMediaType_Compare(output_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); + ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); + ok(ret, "Output type of last transform doesn't match sink node type.\n"); + IMFMediaType_Release(media_type); + IMFTransform_Release(transform); } From 27990334b826dcd745f2adc57353312cc5a40348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 7 Jun 2023 11:35:17 +0200 Subject: [PATCH 1135/1506] mf/topology_loader: Use a local variable for the indirect connection method. Instead of modifying the method_mask parameter, in case we need to retry with another transform. (cherry picked from commit 0dab1ffdf945fc28badb106cffb8f7fb88e9c930) --- dlls/mf/topology_loader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index def7c28089c..c0d7b8ad8c9 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -296,6 +296,7 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC { struct topology_branch down_branch = {.up.node = node, .down = branch->down}; struct topology_branch up_branch = {.up = branch->up, .down.node = node}; + MF_CONNECT_METHOD method = method_mask; if (FAILED(IMFActivate_ActivateObject(activates[i], &IID_IMFTransform, (void **)&transform))) continue; @@ -313,12 +314,12 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC if (SUCCEEDED(hr)) hr = IMFTransform_SetOutputType(transform, 0, down_type, 0); if (SUCCEEDED(hr)) - method_mask = MF_CONNECT_DIRECT; + method = MF_CONNECT_DIRECT; } IMFTransform_Release(transform); if (SUCCEEDED(hr)) - hr = topology_branch_connect(topology, method_mask, &down_branch, !down_type); + hr = topology_branch_connect(topology, method, &down_branch, !down_type); if (SUCCEEDED(hr)) hr = IMFTopology_AddNode(topology, node); if (SUCCEEDED(hr)) From fdf5ac03b61297d68e19777dca7ddf462b90b704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 19 Jan 2024 12:09:11 +0100 Subject: [PATCH 1136/1506] mf/topology_loader: Ignore SetOutputType errors when doing indirect connect. It only succeeds with converters, or if a decoder can directly output the downstream media type. If it fails we may have to add a converter after the decoder, and we will call topology_branch_connect on the downstream branch for that. (cherry picked from commit 2a185126caf6c1d94763ecae4a13c63de9e680f2) --- dlls/mf/tests/mf.c | 15 +++++++++++++-- dlls/mf/topology_loader.c | 7 ++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index f5a7821f0f8..bcfb0e3dbcf 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3293,7 +3293,6 @@ static void test_topology_loader(void) .input_type = &video_h264_1280, .output_type = &video_video_processor_1280_rgb32, .sink_method = -1, .source_method = -1, .decoded_type = &video_nv12_1280, .expected_result = S_OK, .decoder_class = CLSID_CMSH264DecoderMFT, .converter_class = CLSID_CColorConvertDMO, - .flags = LOADER_TODO, }, { /* RGB32 -> Any Video, no current output type */ @@ -3577,7 +3576,7 @@ todo_wine { hr = IMFTopology_GetNodeCount(full_topology, &node_count); ok(hr == S_OK, "Failed to get node count, hr %#lx.\n", hr); - todo_wine_if(!IsEqualGUID(&test->decoder_class, &GUID_NULL)) + todo_wine_if(IsEqualGUID(&test->decoder_class, &CLSID_CMP3DecMediaObject)) ok(node_count == count, "Unexpected node count %u.\n", node_count); hr = IMFTopologyNode_GetTopoNodeID(src_node, &node_id); @@ -3623,14 +3622,21 @@ todo_wine { IUnknown_Release(node_object); hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + todo_wine ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); + if (hr == S_OK) + { hr = IMFMediaType_Compare(input_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); ok(ret, "Input type of first transform doesn't match source node type.\n"); IMFMediaType_Release(media_type); + } hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + todo_wine ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); + if (hr == S_OK) + { if (IsEqualGUID(&test->converter_class, &GUID_NULL)) { hr = IMFMediaType_Compare(output_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); @@ -3642,6 +3648,7 @@ todo_wine { check_media_type(media_type, *test->decoded_type, -1); } IMFMediaType_Release(media_type); + } IMFTransform_Release(transform); } @@ -3702,13 +3709,17 @@ todo_wine { hr = IMFTopology_SetUINT32(full_topology, &IID_IMFTopology, 123); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL); + todo_wine_if(IsEqualGUID(&test->decoder_class, &CLSID_MSH264DecoderMFT)) ok(hr == S_OK, "Failed to resolve topology, hr %#lx.\n", hr); + if (hr == S_OK) + { ok(full_topology != topology2, "Unexpected instance.\n"); hr = IMFTopology_GetUINT32(topology2, &IID_IMFTopology, &value); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ref = IMFTopology_Release(topology2); ok(ref == 0, "Release returned %ld\n", ref); + } ref = IMFTopology_Release(full_topology); ok(ref == 0, "Release returned %ld\n", ref); } diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index c0d7b8ad8c9..2356c703937 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -309,11 +309,8 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC hr = topology_branch_connect_down(topology, MF_CONNECT_DIRECT, &up_branch, up_type); if (down_type) { - if (SUCCEEDED(hr)) - hr = topology_branch_fill_media_type(up_type, down_type); - if (SUCCEEDED(hr)) - hr = IMFTransform_SetOutputType(transform, 0, down_type, 0); - if (SUCCEEDED(hr)) + if (SUCCEEDED(topology_branch_fill_media_type(up_type, down_type)) + && SUCCEEDED(IMFTransform_SetOutputType(transform, 0, down_type, 0))) method = MF_CONNECT_DIRECT; } IMFTransform_Release(transform); From 0642219b753ffa447308c64771faf63726154ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 19 Jan 2024 12:09:11 +0100 Subject: [PATCH 1137/1506] mf/topology_loader: Initialize transform output type before adding converter. Otherwise the next topology_branch_connect call will fail when it will try to lookup the upstream element media type. (cherry picked from commit d95d1132302a9e5556668147c32e1191b5fd6ab4) --- dlls/mf/tests/mf.c | 4 ---- dlls/mf/topology_loader.c | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index bcfb0e3dbcf..16e4300c3c8 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3633,10 +3633,7 @@ todo_wine { } hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); - todo_wine ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); - if (hr == S_OK) - { if (IsEqualGUID(&test->converter_class, &GUID_NULL)) { hr = IMFMediaType_Compare(output_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); @@ -3648,7 +3645,6 @@ todo_wine { check_media_type(media_type, *test->decoded_type, -1); } IMFMediaType_Release(media_type); - } IMFTransform_Release(transform); } diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 2356c703937..386d6978e6c 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -297,6 +297,7 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC struct topology_branch down_branch = {.up.node = node, .down = branch->down}; struct topology_branch up_branch = {.up = branch->up, .down.node = node}; MF_CONNECT_METHOD method = method_mask; + IMFMediaType *media_type; if (FAILED(IMFActivate_ActivateObject(activates[i], &IID_IMFTransform, (void **)&transform))) continue; @@ -315,6 +316,14 @@ static HRESULT topology_branch_connect_indirect(IMFTopology *topology, MF_CONNEC } IMFTransform_Release(transform); + if (SUCCEEDED(hr) && method != MF_CONNECT_DIRECT + && SUCCEEDED(IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type))) + { + if (SUCCEEDED(topology_branch_fill_media_type(up_type, media_type))) + IMFTransform_SetOutputType(transform, 0, media_type, 0); + IMFMediaType_Release(media_type); + } + if (SUCCEEDED(hr)) hr = topology_branch_connect(topology, method, &down_branch, !down_type); if (SUCCEEDED(hr)) From ce520565d50c007ff5c6c50c32cd372b5b946db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Jan 2024 15:27:25 +0100 Subject: [PATCH 1138/1506] mf/topology_loader: Try to connect transform nodes with their current types first. And only if that fails try again by enumerating types. (cherry picked from commit 2d88c5771611ad43767d19dc5b4fe990ec252304) --- dlls/mf/tests/mf.c | 4 ---- dlls/mf/topology_loader.c | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 16e4300c3c8..3f51e563624 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3705,17 +3705,13 @@ todo_wine { hr = IMFTopology_SetUINT32(full_topology, &IID_IMFTopology, 123); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL); - todo_wine_if(IsEqualGUID(&test->decoder_class, &CLSID_MSH264DecoderMFT)) ok(hr == S_OK, "Failed to resolve topology, hr %#lx.\n", hr); - if (hr == S_OK) - { ok(full_topology != topology2, "Unexpected instance.\n"); hr = IMFTopology_GetUINT32(topology2, &IID_IMFTopology, &value); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ref = IMFTopology_Release(topology2); ok(ref == 0, "Release returned %ld\n", ref); - } ref = IMFTopology_Release(full_topology); ok(ref == 0, "Release returned %ld\n", ref); } diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 386d6978e6c..a56fb3e3909 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -528,8 +528,11 @@ static HRESULT topology_loader_resolve_branches(struct topoloader_context *conte else if (FAILED(hr = topology_branch_clone_nodes(context, branch))) WARN("Failed to clone nodes for branch %s\n", debugstr_topology_branch(branch)); else - hr = topology_branch_connect(context->output_topology, MF_CONNECT_ALLOW_DECODER, - branch, enumerate_source_types || node_type == MF_TOPOLOGY_TRANSFORM_NODE); + { + hr = topology_branch_connect(context->output_topology, MF_CONNECT_ALLOW_DECODER, branch, enumerate_source_types); + if (hr == MF_E_INVALIDMEDIATYPE && !enumerate_source_types && node_type == MF_TOPOLOGY_TRANSFORM_NODE) + hr = topology_branch_connect(context->output_topology, MF_CONNECT_ALLOW_DECODER, branch, TRUE); + } topology_branch_destroy(branch); if (FAILED(hr)) From 78d0ae995154ebaeda45a5f378bd0ab300c8be29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Jan 2024 14:47:55 +0100 Subject: [PATCH 1139/1506] winegstreamer: Implement H264 decoder GetInputCurrentType. (cherry picked from commit 6aca31f1a1662ec9a2ab720c31ea981f31af4d7f) --- dlls/mf/tests/mf.c | 4 ---- dlls/mf/tests/transform.c | 2 +- dlls/winegstreamer/h264_decoder.c | 16 +++++++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 3f51e563624..0a34329bd75 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3622,15 +3622,11 @@ todo_wine { IUnknown_Release(node_object); hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); - todo_wine ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); - if (hr == S_OK) - { hr = IMFMediaType_Compare(input_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &ret); ok(hr == S_OK, "Failed to compare media types, hr %#lx.\n", hr); ok(ret, "Input type of first transform doesn't match source node type.\n"); IMFMediaType_Release(media_type); - } hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); ok(hr == S_OK, "Failed to get transform input type, hr %#lx.\n", hr); diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index f9e6b3b45cd..06e638bea16 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4262,7 +4262,7 @@ static void test_h264_decoder(void) check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, TRUE, FALSE); + check_mft_get_input_current_type_(transform, expect_input_type_desc, FALSE, TRUE); check_mft_get_input_stream_info(transform, S_OK, &input_info); check_mft_get_output_stream_info(transform, S_OK, &output_info); diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 5a098c6e467..958bf9a9982 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -580,8 +580,18 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { - FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); - return E_NOTIMPL; + struct h264_decoder *decoder = impl_from_IMFTransform(iface); + HRESULT hr; + + TRACE("iface %p, id %#lx, type %p\n", iface, id, type); + + if (!decoder->input_type) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (FAILED(hr = MFCreateMediaType(type))) + return hr; + + return IMFMediaType_CopyAllItems(decoder->input_type, (IMFAttributes *)*type); } static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) @@ -589,7 +599,7 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD struct h264_decoder *decoder = impl_from_IMFTransform(iface); HRESULT hr; - FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); + TRACE("iface %p, id %#lx, type %p\n", iface, id, type); if (!decoder->output_type) return MF_E_TRANSFORM_TYPE_NOT_SET; From f63b1af7e9978eb74810dbfb0d152c617ea41138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Jan 2024 19:29:15 +0100 Subject: [PATCH 1140/1506] winegstreamer: Ask GStreamer to stop messing with signal handlers. (cherry picked from commit 02921e4900b5b377a4b4b0cddbb7c2b7419cee9e) --- dlls/winegstreamer/unixlib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index 53c1328c0ab..4ac667350d0 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -273,6 +273,11 @@ NTSTATUS wg_init_gstreamer(void *arg) setenv("GST_REGISTRY_1_0", gst_reg, 1); } + /* GStreamer installs a temporary SEGV handler when it loads plugins + * to initialize its registry calling exit(-1) when any fault is caught. + * We need to make sure any signal reaches our signal handlers to catch + * and handle them, or eventually propagate the exceptions to the user. + */ gst_segtrap_set_enabled(false); if (!gst_init_check(&argc, &argv, &err)) From f08b4370f3146fa401f5965fbf6af884df87b47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 17:05:11 +0100 Subject: [PATCH 1141/1506] winegstreamer: Trace wg_transform input and output caps. (cherry picked from commit 6dae92cfb916847f7cf1160e74d1c97553d3bced) --- dlls/winegstreamer/wg_transform.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 1f6bdb103d6..d429890cb59 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -328,6 +328,8 @@ NTSTATUS wg_transform_create(void *args) if (!transform->my_src) goto out; + GST_INFO("transform %p input caps %"GST_PTR_FORMAT, transform, src_caps); + gst_pad_set_element_private(transform->my_src, transform); gst_pad_set_query_function(transform->my_src, transform_src_query_cb); @@ -340,6 +342,8 @@ NTSTATUS wg_transform_create(void *args) if (!transform->my_sink) goto out; + GST_INFO("transform %p output caps %"GST_PTR_FORMAT, transform, transform->output_caps); + gst_pad_set_element_private(transform->my_sink, transform); gst_pad_set_event_function(transform->my_sink, transform_sink_event_cb); gst_pad_set_query_function(transform->my_sink, transform_sink_query_cb); @@ -537,6 +541,8 @@ NTSTATUS wg_transform_set_output_format(void *args) } transform->output_format = *format; + GST_INFO("transform %p output caps %"GST_PTR_FORMAT, transform, caps); + if (gst_caps_is_always_compatible(transform->output_caps, caps)) { gst_caps_unref(caps); @@ -827,6 +833,8 @@ NTSTATUS wg_transform_read_data(void *args) { GST_MINI_OBJECT_FLAG_UNSET(transform->output_sample, GST_SAMPLE_FLAG_WG_CAPS_CHANGED); + GST_INFO("transform %p output caps %"GST_PTR_FORMAT, transform, output_caps); + if (format) { gsize plane_align = transform->attrs.output_plane_align; From a1982d726ae2aacbdadf0a740b748220b45f0499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 17:16:10 +0100 Subject: [PATCH 1142/1506] winegstreamer: Handle allocation query in a separate helper. (cherry picked from commit ec759079a58599da90a23c83e879e33b74a4b7cf) --- dlls/winegstreamer/wg_transform.c | 114 ++++++++++++++++-------------- 1 file changed, 59 insertions(+), 55 deletions(-) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index d429890cb59..baa0b963348 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -125,74 +125,78 @@ static gboolean transform_src_query_cb(GstPad *pad, GstObject *parent, GstQuery } } -static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +static gboolean transform_sink_query_allocation(struct wg_transform *transform, GstQuery *query) { - struct wg_transform *transform = gst_pad_get_element_private(pad); + gsize plane_align = transform->attrs.output_plane_align; + GstStructure *config, *params; + GstVideoAlignment align; + gboolean needs_pool; + GstBufferPool *pool; + GstVideoInfo info; + GstCaps *caps; - GST_LOG("transform %p, type \"%s\".", transform, gst_query_type_get_name(query->type)); + gst_query_parse_allocation(query, &caps, &needs_pool); + if (stream_type_from_caps(caps) != GST_STREAM_TYPE_VIDEO || !needs_pool) + return false; - switch (query->type) - { - case GST_QUERY_ALLOCATION: - { - gsize plane_align = transform->attrs.output_plane_align; - GstStructure *config, *params; - GstVideoAlignment align; - gboolean needs_pool; - GstBufferPool *pool; - GstVideoInfo info; - GstCaps *caps; + if (!gst_video_info_from_caps(&info, caps) + || !(pool = gst_video_buffer_pool_new())) + return false; - gst_query_parse_allocation(query, &caps, &needs_pool); - if (stream_type_from_caps(caps) != GST_STREAM_TYPE_VIDEO || !needs_pool) - break; + align_video_info_planes(plane_align, &info, &align); - if (!gst_video_info_from_caps(&info, caps) - || !(pool = gst_video_buffer_pool_new())) - break; + if ((params = gst_structure_new("video-meta", + "padding-top", G_TYPE_UINT, align.padding_top, + "padding-bottom", G_TYPE_UINT, align.padding_bottom, + "padding-left", G_TYPE_UINT, align.padding_left, + "padding-right", G_TYPE_UINT, align.padding_right, + NULL))) + { + gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, params); + gst_structure_free(params); + } + + if (!(config = gst_buffer_pool_get_config(pool))) + GST_ERROR("Failed to get pool %p config.", pool); + else + { + gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_META); + gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); + gst_buffer_pool_config_set_video_alignment(config, &align); - align_video_info_planes(plane_align, &info, &align); + gst_buffer_pool_config_set_params(config, caps, + info.size, 0, 0); + gst_buffer_pool_config_set_allocator(config, transform->allocator, NULL); + if (!gst_buffer_pool_set_config(pool, config)) + GST_ERROR("Failed to set pool %p config.", pool); + } - if ((params = gst_structure_new("video-meta", - "padding-top", G_TYPE_UINT, align.padding_top, - "padding-bottom", G_TYPE_UINT, align.padding_bottom, - "padding-left", G_TYPE_UINT, align.padding_left, - "padding-right", G_TYPE_UINT, align.padding_right, - NULL))) - { - gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, params); - gst_structure_free(params); - } + /* Prevent pool reconfiguration, we don't want another alignment. */ + if (!gst_buffer_pool_set_active(pool, true)) + GST_ERROR("Pool %p failed to activate.", pool); - if (!(config = gst_buffer_pool_get_config(pool))) - GST_ERROR("Failed to get pool %p config.", pool); - else - { - gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_META); - gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); - gst_buffer_pool_config_set_video_alignment(config, &align); - - gst_buffer_pool_config_set_params(config, caps, - info.size, 0, 0); - gst_buffer_pool_config_set_allocator(config, transform->allocator, NULL); - if (!gst_buffer_pool_set_config(pool, config)) - GST_ERROR("Failed to set pool %p config.", pool); - } + gst_query_add_allocation_pool(query, pool, info.size, 0, 0); + gst_query_add_allocation_param(query, transform->allocator, NULL); - /* Prevent pool reconfiguration, we don't want another alignment. */ - if (!gst_buffer_pool_set_active(pool, true)) - GST_ERROR("Pool %p failed to activate.", pool); + GST_INFO("Proposing pool %p, buffer size %#zx, allocator %p, for query %p.", + pool, info.size, transform->allocator, query); - gst_query_add_allocation_pool(query, pool, info.size, 0, 0); - gst_query_add_allocation_param(query, transform->allocator, NULL); + g_object_unref(pool); + return true; +} - GST_INFO("Proposing pool %p, buffer size %#zx, allocator %p, for query %p.", - pool, info.size, transform->allocator, query); +static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +{ + struct wg_transform *transform = gst_pad_get_element_private(pad); - g_object_unref(pool); - return true; - } + GST_LOG("transform %p, type \"%s\".", transform, gst_query_type_get_name(query->type)); + switch (query->type) + { + case GST_QUERY_ALLOCATION: + if (transform_sink_query_allocation(transform, query)) + return true; + break; case GST_QUERY_CAPS: { GstCaps *caps, *filter, *temp; From fe825407e9f0b70119ac00807c9a42c30f3a8619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 17:17:25 +0100 Subject: [PATCH 1143/1506] winegstreamer: Handle sink caps query in a separate helper. (cherry picked from commit f39156ee6a0950cb71fabd4f50a768510f7e2366) --- dlls/winegstreamer/wg_transform.c | 48 +++++++++++++++++-------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index baa0b963348..7553c96053f 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -185,6 +185,30 @@ static gboolean transform_sink_query_allocation(struct wg_transform *transform, return true; } +static gboolean transform_sink_query_caps(struct wg_transform *transform, GstQuery *query) +{ + GstCaps *caps, *filter, *temp; + + GST_LOG("transform %p, query %"GST_PTR_FORMAT, transform, query); + + gst_query_parse_caps(query, &filter); + if (!(caps = wg_format_to_caps(&transform->output_format))) + return false; + + if (filter) + { + temp = gst_caps_intersect(caps, filter); + gst_caps_unref(caps); + caps = temp; + } + + GST_INFO("Returning caps %" GST_PTR_FORMAT, caps); + + gst_query_set_caps_result(query, caps); + gst_caps_unref(caps); + return true; +} + static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) { struct wg_transform *transform = gst_pad_get_element_private(pad); @@ -198,27 +222,9 @@ static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery return true; break; case GST_QUERY_CAPS: - { - GstCaps *caps, *filter, *temp; - - gst_query_parse_caps(query, &filter); - if (!(caps = wg_format_to_caps(&transform->output_format))) - break; - - if (filter) - { - temp = gst_caps_intersect(caps, filter); - gst_caps_unref(caps); - caps = temp; - } - - GST_INFO("Returning caps %" GST_PTR_FORMAT, caps); - - gst_query_set_caps_result(query, caps); - gst_caps_unref(caps); - return true; - } - + if (transform_sink_query_caps(transform, query)) + return true; + break; default: GST_WARNING("Ignoring \"%s\" query.", gst_query_type_get_name(query->type)); break; From 00a6df870b68fe561cb229a168da4139299871f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 17:20:07 +0100 Subject: [PATCH 1144/1506] winegstreamer: Handle sink event caps in a separate helper. (cherry picked from commit 4f349d442a14b0cec0bdd25ac8d0ddfcd3a1e71e) --- dlls/winegstreamer/wg_transform.c | 35 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 7553c96053f..e27db5c4bbe 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -233,6 +233,19 @@ static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery return gst_pad_query_default(pad, parent, query); } +static void transform_sink_event_caps(struct wg_transform *transform, GstEvent *event) +{ + GstCaps *caps; + + gst_event_parse_caps(event, &caps); + + transform->output_caps_changed = transform->output_caps_changed + || !gst_caps_is_always_compatible(transform->output_caps, caps); + + gst_caps_unref(transform->output_caps); + transform->output_caps = gst_caps_ref(caps); +} + static gboolean transform_sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) { struct wg_transform *transform = gst_pad_get_element_private(pad); @@ -241,22 +254,12 @@ static gboolean transform_sink_event_cb(GstPad *pad, GstObject *parent, GstEvent switch (event->type) { - case GST_EVENT_CAPS: - { - GstCaps *caps; - - gst_event_parse_caps(event, &caps); - - transform->output_caps_changed = transform->output_caps_changed - || !gst_caps_is_always_compatible(transform->output_caps, caps); - - gst_caps_unref(transform->output_caps); - transform->output_caps = gst_caps_ref(caps); - break; - } - default: - GST_WARNING("Ignoring \"%s\" event.", GST_EVENT_TYPE_NAME(event)); - break; + case GST_EVENT_CAPS: + transform_sink_event_caps(transform, event); + break; + default: + GST_WARNING("Ignoring \"%s\" event.", GST_EVENT_TYPE_NAME(event)); + break; } gst_event_unref(event); From b0774143b07611184e55e73b09c09a1116d3c5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 17:24:49 +0100 Subject: [PATCH 1145/1506] winegstreamer: Use GST_PTR_FORMAT to trace GStreamer objects. (cherry picked from commit 62955f22295e69539f14d808adf179afd9583e5a) --- dlls/winegstreamer/wg_transform.c | 53 ++++++++++++++++--------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index e27db5c4bbe..10541c012e4 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -87,7 +87,7 @@ static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, Gst struct wg_transform *transform = gst_pad_get_element_private(pad); GstSample *sample; - GST_LOG("transform %p, buffer %p.", transform, buffer); + GST_LOG("transform %p, %"GST_PTR_FORMAT, transform, buffer); if (!(sample = gst_sample_new(buffer, transform->output_caps, NULL, NULL))) { @@ -107,7 +107,7 @@ static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, Gst static gboolean transform_src_query_latency(struct wg_transform *transform, GstQuery *query) { - GST_LOG("transform %p, query %p", transform, query); + GST_LOG("transform %p, %"GST_PTR_FORMAT, transform, query); gst_query_set_latency(query, transform->attrs.low_latency, 0, 0); return true; } @@ -121,6 +121,7 @@ static gboolean transform_src_query_cb(GstPad *pad, GstObject *parent, GstQuery case GST_QUERY_LATENCY: return transform_src_query_latency(transform, query); default: + GST_TRACE("transform %p, ignoring %"GST_PTR_FORMAT, transform, query); return gst_pad_query_default(pad, parent, query); } } @@ -135,6 +136,8 @@ static gboolean transform_sink_query_allocation(struct wg_transform *transform, GstVideoInfo info; GstCaps *caps; + GST_LOG("transform %p, %"GST_PTR_FORMAT, transform, query); + gst_query_parse_allocation(query, &caps, &needs_pool); if (stream_type_from_caps(caps) != GST_STREAM_TYPE_VIDEO || !needs_pool) return false; @@ -157,7 +160,7 @@ static gboolean transform_sink_query_allocation(struct wg_transform *transform, } if (!(config = gst_buffer_pool_get_config(pool))) - GST_ERROR("Failed to get pool %p config.", pool); + GST_ERROR("Failed to get %"GST_PTR_FORMAT" config.", pool); else { gst_buffer_pool_config_add_option(config, GST_BUFFER_POOL_OPTION_VIDEO_META); @@ -168,17 +171,17 @@ static gboolean transform_sink_query_allocation(struct wg_transform *transform, info.size, 0, 0); gst_buffer_pool_config_set_allocator(config, transform->allocator, NULL); if (!gst_buffer_pool_set_config(pool, config)) - GST_ERROR("Failed to set pool %p config.", pool); + GST_ERROR("Failed to set %"GST_PTR_FORMAT" config.", pool); } /* Prevent pool reconfiguration, we don't want another alignment. */ if (!gst_buffer_pool_set_active(pool, true)) - GST_ERROR("Pool %p failed to activate.", pool); + GST_ERROR("%"GST_PTR_FORMAT" failed to activate.", pool); gst_query_add_allocation_pool(query, pool, info.size, 0, 0); gst_query_add_allocation_param(query, transform->allocator, NULL); - GST_INFO("Proposing pool %p, buffer size %#zx, allocator %p, for query %p.", + GST_INFO("Proposing %"GST_PTR_FORMAT", buffer size %#zx, %"GST_PTR_FORMAT", for %"GST_PTR_FORMAT, pool, info.size, transform->allocator, query); g_object_unref(pool); @@ -189,7 +192,7 @@ static gboolean transform_sink_query_caps(struct wg_transform *transform, GstQue { GstCaps *caps, *filter, *temp; - GST_LOG("transform %p, query %"GST_PTR_FORMAT, transform, query); + GST_LOG("transform %p, %"GST_PTR_FORMAT, transform, query); gst_query_parse_caps(query, &filter); if (!(caps = wg_format_to_caps(&transform->output_format))) @@ -213,23 +216,21 @@ static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery { struct wg_transform *transform = gst_pad_get_element_private(pad); - GST_LOG("transform %p, type \"%s\".", transform, gst_query_type_get_name(query->type)); - switch (query->type) { - case GST_QUERY_ALLOCATION: - if (transform_sink_query_allocation(transform, query)) - return true; - break; - case GST_QUERY_CAPS: - if (transform_sink_query_caps(transform, query)) - return true; - break; - default: - GST_WARNING("Ignoring \"%s\" query.", gst_query_type_get_name(query->type)); - break; + case GST_QUERY_ALLOCATION: + if (transform_sink_query_allocation(transform, query)) + return true; + break; + case GST_QUERY_CAPS: + if (transform_sink_query_caps(transform, query)) + return true; + break; + default: + break; } + GST_TRACE("transform %p, ignoring %"GST_PTR_FORMAT, transform, query); return gst_pad_query_default(pad, parent, query); } @@ -237,6 +238,8 @@ static void transform_sink_event_caps(struct wg_transform *transform, GstEvent * { GstCaps *caps; + GST_LOG("transform %p, %"GST_PTR_FORMAT, transform, event); + gst_event_parse_caps(event, &caps); transform->output_caps_changed = transform->output_caps_changed @@ -250,15 +253,13 @@ static gboolean transform_sink_event_cb(GstPad *pad, GstObject *parent, GstEvent { struct wg_transform *transform = gst_pad_get_element_private(pad); - GST_LOG("transform %p, type \"%s\".", transform, GST_EVENT_TYPE_NAME(event)); - switch (event->type) { case GST_EVENT_CAPS: transform_sink_event_caps(transform, event); break; default: - GST_WARNING("Ignoring \"%s\" event.", GST_EVENT_TYPE_NAME(event)); + GST_TRACE("transform %p, ignoring %"GST_PTR_FORMAT, transform, event); break; } @@ -633,7 +634,7 @@ NTSTATUS wg_transform_push_data(void *args) else { InterlockedIncrement(&sample->refcount); - GST_INFO("Wrapped %u/%u bytes from sample %p to buffer %p", sample->size, sample->max_size, sample, buffer); + GST_INFO("Wrapped %u/%u bytes from sample %p to %"GST_PTR_FORMAT, sample->size, sample->max_size, sample, buffer); } if (sample->flags & WG_SAMPLE_FLAG_HAS_PTS) @@ -740,7 +741,7 @@ static NTSTATUS read_transform_output_data(GstBuffer *buffer, GstCaps *caps, gsi if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) { - GST_ERROR("Failed to map buffer %p", buffer); + GST_ERROR("Failed to map buffer %"GST_PTR_FORMAT, buffer); sample->size = 0; return STATUS_UNSUCCESSFUL; } @@ -757,7 +758,7 @@ static NTSTATUS read_transform_output_data(GstBuffer *buffer, GstCaps *caps, gsi if (status) { - GST_ERROR("Failed to copy buffer %p", buffer); + GST_ERROR("Failed to copy buffer %"GST_PTR_FORMAT, buffer); sample->size = 0; return status; } From 370f34c98105c594e669c076935488d0ac00ff35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 19:25:03 +0100 Subject: [PATCH 1146/1506] winegstreamer: Ignore wg_transform input / output video format fps. Decoders might output some fps information and encoders might input fps, but otherwise is unnecessary and may prevent compatible caps matching. (cherry picked from commit 98b8ab9b88b77e2f8f0c51adb681094191a0be1b) --- dlls/winegstreamer/h264_decoder.c | 4 --- dlls/winegstreamer/video_decoder.c | 6 ----- dlls/winegstreamer/wg_transform.c | 39 +++++++++++++++++++++++++----- dlls/winegstreamer/wmv_decoder.c | 12 --------- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 958bf9a9982..ae4d46d40a2 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -111,8 +111,6 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) */ output_format.u.video.width = 0; output_format.u.video.height = 0; - output_format.u.video.fps_d = 0; - output_format.u.video.fps_n = 0; if (SUCCEEDED(IMFAttributes_GetUINT32(decoder->attributes, &MF_LOW_LATENCY, &low_latency))) attrs.low_latency = !!low_latency; @@ -558,8 +556,6 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF */ output_format.u.video.width = 0; output_format.u.video.height = 0; - output_format.u.video.fps_d = 0; - output_format.u.video.fps_n = 0; if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN || !wg_transform_set_output_format(decoder->wg_transform, &output_format)) diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 2faab78faf2..f24c25e03f2 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -84,9 +84,6 @@ static HRESULT try_create_wg_transform(struct video_decoder *decoder) if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN) return MF_E_INVALIDMEDIATYPE; - output_format.u.video.fps_d = 0; - output_format.u.video.fps_n = 0; - if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) { ERR("Failed to create transform with input major_type %u.\n", input_format.major_type); @@ -311,9 +308,6 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF { mf_media_type_to_wg_format(decoder->output_type, &output_format); - output_format.u.video.fps_d = 0; - output_format.u.video.fps_n = 0; - if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN || !wg_transform_set_output_format(decoder->wg_transform, &output_format)) { diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 10541c012e4..a1f5dc5971b 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -188,6 +188,16 @@ static gboolean transform_sink_query_allocation(struct wg_transform *transform, return true; } +static GstCaps *transform_format_to_caps(struct wg_transform *transform, const struct wg_format *format) +{ + struct wg_format copy = *format; + + if (format->major_type == WG_MAJOR_TYPE_VIDEO) + copy.u.video.fps_n = copy.u.video.fps_d = 0; + + return wg_format_to_caps(©); +} + static gboolean transform_sink_query_caps(struct wg_transform *transform, GstQuery *query) { GstCaps *caps, *filter, *temp; @@ -195,7 +205,7 @@ static gboolean transform_sink_query_caps(struct wg_transform *transform, GstQue GST_LOG("transform %p, %"GST_PTR_FORMAT, transform, query); gst_query_parse_caps(query, &filter); - if (!(caps = wg_format_to_caps(&transform->output_format))) + if (!(caps = transform_format_to_caps(transform, &transform->output_format))) return false; if (filter) @@ -234,6 +244,23 @@ static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery return gst_pad_query_default(pad, parent, query); } +static gboolean transform_output_caps_is_compatible(struct wg_transform *transform, GstCaps *caps) +{ + GstCaps *copy = gst_caps_copy(caps); + gboolean ret; + gsize i; + + for (i = 0; i < gst_caps_get_size(copy); ++i) + { + GstStructure *structure = gst_caps_get_structure(copy, i); + gst_structure_remove_fields(structure, "framerate", NULL); + } + + ret = gst_caps_is_always_compatible(transform->output_caps, copy); + gst_caps_unref(copy); + return ret; +} + static void transform_sink_event_caps(struct wg_transform *transform, GstEvent *event) { GstCaps *caps; @@ -243,7 +270,7 @@ static void transform_sink_event_caps(struct wg_transform *transform, GstEvent * gst_event_parse_caps(event, &caps); transform->output_caps_changed = transform->output_caps_changed - || !gst_caps_is_always_compatible(transform->output_caps, caps); + || !transform_output_caps_is_compatible(transform, caps); gst_caps_unref(transform->output_caps); transform->output_caps = gst_caps_ref(caps); @@ -333,7 +360,7 @@ NTSTATUS wg_transform_create(void *args) transform->attrs = *params->attrs; transform->output_format = output_format; - if (!(src_caps = wg_format_to_caps(&input_format))) + if (!(src_caps = transform_format_to_caps(transform, &input_format))) goto out; if (!(template = gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS, src_caps))) goto out; @@ -347,7 +374,7 @@ NTSTATUS wg_transform_create(void *args) gst_pad_set_element_private(transform->my_src, transform); gst_pad_set_query_function(transform->my_src, transform_src_query_cb); - if (!(transform->output_caps = wg_format_to_caps(&output_format))) + if (!(transform->output_caps = transform_format_to_caps(transform, &output_format))) goto out; if (!(template = gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, transform->output_caps))) goto out; @@ -548,7 +575,7 @@ NTSTATUS wg_transform_set_output_format(void *args) GstSample *sample; GstCaps *caps; - if (!(caps = wg_format_to_caps(format))) + if (!(caps = transform_format_to_caps(transform, format))) { GST_ERROR("Failed to convert format %p to caps.", format); return STATUS_UNSUCCESSFUL; @@ -557,7 +584,7 @@ NTSTATUS wg_transform_set_output_format(void *args) GST_INFO("transform %p output caps %"GST_PTR_FORMAT, transform, caps); - if (gst_caps_is_always_compatible(transform->output_caps, caps)) + if (transform_output_caps_is_compatible(transform, caps)) { gst_caps_unref(caps); return STATUS_SUCCESS; diff --git a/dlls/winegstreamer/wmv_decoder.c b/dlls/winegstreamer/wmv_decoder.c index 48940573f08..edd6c744e94 100644 --- a/dlls/winegstreamer/wmv_decoder.c +++ b/dlls/winegstreamer/wmv_decoder.c @@ -511,16 +511,6 @@ static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index if (!amt_to_wg_format((const AM_MEDIA_TYPE *)type, &wg_format)) return DMO_E_TYPE_NOT_ACCEPTED; - if (wg_format.major_type == WG_MAJOR_TYPE_VIDEO_WMV) - { - wg_format.u.video_wmv.fps_n = 0; - wg_format.u.video_wmv.fps_d = 0; - } - else if (wg_format.major_type == WG_MAJOR_TYPE_VIDEO) - { - wg_format.u.video.fps_n = 0; - wg_format.u.video.fps_d = 0; - } if (flags & DMO_SET_TYPEF_TEST_ONLY) return S_OK; @@ -578,8 +568,6 @@ static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD inde if (!amt_to_wg_format((const AM_MEDIA_TYPE *)type, &wg_format)) return DMO_E_TYPE_NOT_ACCEPTED; assert(wg_format.major_type == WG_MAJOR_TYPE_VIDEO); - wg_format.u.video.fps_n = 0; - wg_format.u.video.fps_d = 0; if (flags & DMO_SET_TYPEF_TEST_ONLY) return S_OK; From 6e060bb31516f5c84b43a20f208472f30e2a06cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 30 Jan 2024 20:21:45 +0100 Subject: [PATCH 1147/1506] winegstreamer: Allow wg_transform size changes with an explicit attribute. (cherry picked from commit 6979a9f059d7390e64f7de50d424e8d4363575c8) --- dlls/winegstreamer/h264_decoder.c | 13 +------------ dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_transform.c | 4 ++++ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index ae4d46d40a2..aff9e73d051 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -89,6 +89,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) { .output_plane_align = 15, .input_queue_length = 15, + .allow_size_change = TRUE, }; struct wg_format input_format; struct wg_format output_format; @@ -106,12 +107,6 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN) return MF_E_INVALIDMEDIATYPE; - /* Don't force any specific size, H264 streams already have the metadata for it - * and will generate a MF_E_TRANSFORM_STREAM_CHANGE result later. - */ - output_format.u.video.width = 0; - output_format.u.video.height = 0; - if (SUCCEEDED(IMFAttributes_GetUINT32(decoder->attributes, &MF_LOW_LATENCY, &low_latency))) attrs.low_latency = !!low_latency; @@ -551,12 +546,6 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF struct wg_format output_format; mf_media_type_to_wg_format(decoder->output_type, &output_format); - /* Don't force any specific size, H264 streams already have the metadata for it - * and will generate a MF_E_TRANSFORM_STREAM_CHANGE result later. - */ - output_format.u.video.width = 0; - output_format.u.video.height = 0; - if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN || !wg_transform_set_output_format(decoder->wg_transform, &output_format)) { diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 2045f3b65ff..e7dcb23ab2b 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -344,6 +344,7 @@ struct wg_transform_attrs { UINT32 output_plane_align; UINT32 input_queue_length; + BOOL allow_size_change; BOOL low_latency; }; diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index a1f5dc5971b..557d7024246 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -193,7 +193,11 @@ static GstCaps *transform_format_to_caps(struct wg_transform *transform, const s struct wg_format copy = *format; if (format->major_type == WG_MAJOR_TYPE_VIDEO) + { + if (transform->attrs.allow_size_change) + copy.u.video.width = copy.u.video.height = 0; copy.u.video.fps_n = copy.u.video.fps_d = 0; + } return wg_format_to_caps(©); } From db22f40dbb21d1b1841b002a0bb34dd759b6852a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 29 Jan 2024 13:13:43 +0100 Subject: [PATCH 1148/1506] mf/tests: Report more transform current type mismatches. (cherry picked from commit 5a12be3a9af038382559831fef764d69ff6b07b0) --- dlls/mf/tests/transform.c | 86 ++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 06e638bea16..977e819cdf8 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -709,8 +709,8 @@ static void check_mft_set_input_type(IMFTransform *transform, const struct attri IMFMediaType_Release(media_type); } -#define check_mft_get_input_current_type(a, b) check_mft_get_input_current_type_(a, b, FALSE, FALSE) -static void check_mft_get_input_current_type_(IMFTransform *transform, const struct attribute_desc *attributes, +#define check_mft_get_input_current_type(a, b) check_mft_get_input_current_type_(__LINE__, a, b, FALSE, FALSE) +static void check_mft_get_input_current_type_(int line, IMFTransform *transform, const struct attribute_desc *attributes, BOOL todo_current, BOOL todo_compare) { HRESULT hr, expect_hr = attributes ? S_OK : MF_E_TRANSFORM_TYPE_NOT_SET; @@ -719,19 +719,21 @@ static void check_mft_get_input_current_type_(IMFTransform *transform, const str hr = IMFTransform_GetInputCurrentType(transform, 0, ¤t_type); todo_wine_if(todo_current) - ok(hr == expect_hr, "GetInputCurrentType returned hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == expect_hr, "GetInputCurrentType returned hr %#lx.\n", hr); if (FAILED(hr)) return; hr = MFCreateMediaType(&media_type); - ok(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr); init_media_type(media_type, attributes, -1); hr = IMFMediaType_Compare(current_type, (IMFAttributes *)media_type, MF_ATTRIBUTES_MATCH_ALL_ITEMS, &result); - ok(hr == S_OK, "Compare returned hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "Compare returned hr %#lx.\n", hr); todo_wine_if(todo_compare) - ok(result, "got result %u.\n", !!result); + ok_(__FILE__, line)(result, "got result %u.\n", !!result); + + check_attributes_(__FILE__, line, (IMFAttributes *)current_type, attributes, -1); IMFMediaType_Release(media_type); IMFMediaType_Release(current_type); @@ -785,24 +787,31 @@ static void check_mft_set_output_type(IMFTransform *transform, const struct attr IMFMediaType_Release(media_type); } -#define check_mft_get_output_current_type(a, b) check_mft_get_output_current_type_(a, b, FALSE) -static void check_mft_get_output_current_type_(IMFTransform *transform, const struct attribute_desc *attributes, - BOOL todo_current) +#define check_mft_get_output_current_type(a, b) check_mft_get_output_current_type_(__LINE__, a, b, FALSE, FALSE) +static void check_mft_get_output_current_type_(int line, IMFTransform *transform, const struct attribute_desc *attributes, + BOOL todo_current, BOOL todo_compare) { HRESULT hr, expect_hr = attributes ? S_OK : MF_E_TRANSFORM_TYPE_NOT_SET; IMFMediaType *media_type, *current_type; + BOOL result; hr = IMFTransform_GetOutputCurrentType(transform, 0, ¤t_type); todo_wine_if(todo_current) - ok(hr == expect_hr, "GetOutputCurrentType returned hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == expect_hr, "GetOutputCurrentType returned hr %#lx.\n", hr); if (FAILED(hr)) return; hr = MFCreateMediaType(&media_type); - ok(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr); init_media_type(media_type, attributes, -1); - check_attributes((IMFAttributes *)current_type, attributes, -1); + hr = IMFMediaType_Compare(current_type, (IMFAttributes *)media_type, + MF_ATTRIBUTES_MATCH_ALL_ITEMS, &result); + ok_(__FILE__, line)(hr == S_OK, "Compare returned hr %#lx.\n", hr); + todo_wine_if(todo_compare) + ok_(__FILE__, line)(result, "got result %u.\n", !!result); + + check_attributes_(__FILE__, line, (IMFAttributes *)current_type, attributes, -1); IMFMediaType_Release(media_type); IMFMediaType_Release(current_type); @@ -3191,11 +3200,11 @@ static void test_wma_decoder(void) /* setting output media type first doesn't work */ check_mft_set_output_type(transform, output_type_desc, MF_E_TRANSFORM_TYPE_NOT_SET); - check_mft_get_output_current_type_(transform, NULL, TRUE); + check_mft_get_output_current_type_(__LINE__, transform, NULL, TRUE, FALSE); check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, TRUE, FALSE); + check_mft_get_input_current_type_(__LINE__, transform, expect_input_type_desc, TRUE, FALSE); check_mft_get_input_stream_info(transform, MF_E_TRANSFORM_TYPE_NOT_SET, NULL); check_mft_get_output_stream_info(transform, MF_E_TRANSFORM_TYPE_NOT_SET, NULL); @@ -3217,7 +3226,7 @@ static void test_wma_decoder(void) check_mft_set_output_type_required(transform, output_type_desc); check_mft_set_output_type(transform, output_type_desc, S_OK); - check_mft_get_output_current_type_(transform, expect_output_type_desc, TRUE); + check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, TRUE, FALSE); check_mft_get_input_stream_info(transform, S_OK, &input_info); check_mft_get_output_stream_info(transform, S_OK, &output_info); @@ -3828,6 +3837,7 @@ static void test_h264_encoder(void) ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), ATTR_UINT32(MF_MT_AVG_BITRATE, 193540), ATTR_BLOB(MF_MT_MPEG_SEQUENCE_HEADER, test_h264_sequence_header, sizeof(test_h264_sequence_header)), + ATTR_UINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive), {0}, }; static const MFT_OUTPUT_STREAM_INFO expect_output_info = {.cbSize = 0x8000}; @@ -4019,11 +4029,11 @@ static void test_h264_decoder(void) ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), ATTR_RATIO(MF_MT_FRAME_SIZE, input_width, input_height), - ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 0), - ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 0), - ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 0), - ATTR_UINT32(MF_MT_AVG_BIT_ERROR_RATE, 0), - ATTR_UINT32(MF_MT_COMPRESSED, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_AVG_BIT_ERROR_RATE, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_COMPRESSED, 1, .todo = TRUE), {0}, }; const struct attribute_desc expect_output_type_desc[] = @@ -4262,7 +4272,7 @@ static void test_h264_decoder(void) check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, FALSE, TRUE); + check_mft_get_input_current_type_(__LINE__, transform, expect_input_type_desc, FALSE, TRUE); check_mft_get_input_stream_info(transform, S_OK, &input_info); check_mft_get_output_stream_info(transform, S_OK, &output_info); @@ -4284,7 +4294,7 @@ static void test_h264_decoder(void) check_mft_set_output_type_required(transform, output_type_desc); check_mft_set_output_type(transform, output_type_desc, S_OK); - check_mft_get_output_current_type_(transform, expect_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, FALSE, TRUE); /* check that the output media type we've selected don't change the enumeration */ @@ -4382,7 +4392,7 @@ static void test_h264_decoder(void) ok(i == 5, "%lu output media types\n", i); /* current output type is still the one we selected */ - check_mft_get_output_current_type_(transform, expect_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, FALSE, TRUE); hr = MFCreateCollection(&output_samples); ok(hr == S_OK, "MFCreateCollection returned %#lx\n", hr); @@ -4412,7 +4422,7 @@ static void test_h264_decoder(void) ret = IMFMediaType_Release(media_type); ok(ret == 1, "Release returned %lu\n", ret); - check_mft_get_output_current_type_(transform, expect_new_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, expect_new_output_type_desc, FALSE, TRUE); output_sample = create_sample(NULL, actual_width * actual_height * 2); hr = check_mft_process_output(transform, output_sample, &output_status); @@ -4810,8 +4820,8 @@ static void test_audio_convert(void) ATTR_UINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, 22050), ATTR_UINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT, 8), ATTR_UINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, 22050 * 8), - ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), - ATTR_UINT32(MF_MT_AUDIO_CHANNEL_MASK, 3), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1, .todo = TRUE), + ATTR_UINT32(MF_MT_AUDIO_CHANNEL_MASK, 3, .todo = TRUE), {0}, }; const struct attribute_desc expect_output_type_desc[] = @@ -4939,7 +4949,7 @@ static void test_audio_convert(void) check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, FALSE, TRUE); + check_mft_get_input_current_type_(__LINE__, transform, expect_input_type_desc, FALSE, TRUE); check_mft_get_input_stream_info(transform, MF_E_TRANSFORM_TYPE_NOT_SET, NULL); check_mft_get_output_stream_info(transform, MF_E_TRANSFORM_TYPE_NOT_SET, NULL); @@ -4961,7 +4971,7 @@ static void test_audio_convert(void) check_mft_set_output_type_required(transform, output_type_desc); check_mft_set_output_type(transform, output_type_desc, S_OK); - check_mft_get_output_current_type_(transform, expect_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, FALSE, TRUE); check_mft_get_input_stream_info(transform, S_OK, &input_info); check_mft_get_output_stream_info(transform, S_OK, &output_info); @@ -5414,11 +5424,11 @@ static void test_wmv_encoder(void) check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, FALSE, TRUE); + check_mft_get_input_current_type_(__LINE__, transform, expect_input_type_desc, FALSE, TRUE); check_mft_set_output_type_required(transform, output_type_desc); check_mft_set_output_type(transform, output_type_desc, S_OK); - check_mft_get_output_current_type_(transform, expect_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, expect_output_type_desc, FALSE, FALSE); check_mft_get_input_stream_info(transform, S_OK, &expect_input_info); check_mft_get_output_stream_info(transform, S_OK, &expect_output_info); @@ -5975,7 +5985,7 @@ static void test_wmv_decoder(void) check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, FALSE, TRUE); + check_mft_get_input_current_type_(__LINE__, transform, expect_input_type_desc, FALSE, TRUE); i = -1; while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(transform, 0, ++i, &media_type))) @@ -5998,7 +6008,7 @@ static void test_wmv_decoder(void) check_mft_set_output_type_required(transform, transform_tests[j].output_type_desc); check_mft_set_output_type(transform, transform_tests[j].output_type_desc, S_OK); - check_mft_get_output_current_type_(transform, transform_tests[j].expect_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, transform_tests[j].expect_output_type_desc, FALSE, FALSE); check_mft_get_input_stream_info(transform, S_OK, transform_tests[j].expect_input_info); check_mft_get_output_stream_info(transform, S_OK, transform_tests[j].expect_output_info); @@ -6914,10 +6924,10 @@ static void test_color_convert(void) ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height), ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width), - ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 3 / 2), - ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), - ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), - ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, actual_width * actual_height * 3 / 2, .todo = TRUE), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1, .todo = TRUE), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1, .todo = TRUE), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1, .todo = TRUE), {0}, }; const struct attribute_desc expect_output_type_desc[] = @@ -7077,14 +7087,14 @@ static void test_color_convert(void) check_mft_set_input_type_required(transform, input_type_desc); check_mft_set_input_type(transform, input_type_desc); - check_mft_get_input_current_type_(transform, expect_input_type_desc, FALSE, TRUE); + check_mft_get_input_current_type_(__LINE__, transform, expect_input_type_desc, FALSE, TRUE); for (i = 0; i < ARRAY_SIZE(color_conversion_tests); i++) { winetest_push_context("color conversion #%lu", i); check_mft_set_output_type_required(transform, color_conversion_tests[i].output_type_desc); check_mft_set_output_type(transform, color_conversion_tests[i].output_type_desc, S_OK); - check_mft_get_output_current_type_(transform, color_conversion_tests[i].expect_output_type_desc, FALSE); + check_mft_get_output_current_type_(__LINE__, transform, color_conversion_tests[i].expect_output_type_desc, FALSE, TRUE); check_mft_get_input_stream_info(transform, S_OK, &input_info); check_mft_get_output_stream_info(transform, S_OK, &output_info); From 8caa1334f70df5c61a4713d15b84aa77a82f49f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 29 Jan 2024 23:33:13 +0100 Subject: [PATCH 1149/1506] mf/tests: Add some tests with video processor aperture handling. (cherry picked from commit 604bc7ccf93bd19247742c2116425109b4a36c5e) --- dlls/mf/tests/transform.c | 55 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 977e819cdf8..468239b0fd4 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -692,19 +692,21 @@ static void check_mft_set_input_type_required_(int line, IMFTransform *transform ok_(__FILE__, line)(!ref, "Release returned %lu\n", ref); } -static void check_mft_set_input_type(IMFTransform *transform, const struct attribute_desc *attributes) +#define check_mft_set_input_type(a, b) check_mft_set_input_type_(__LINE__, a, b, FALSE) +static void check_mft_set_input_type_(int line, IMFTransform *transform, const struct attribute_desc *attributes, BOOL todo) { IMFMediaType *media_type; HRESULT hr; hr = MFCreateMediaType(&media_type); - ok(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr); init_media_type(media_type, attributes, -1); hr = IMFTransform_SetInputType(transform, 0, media_type, MFT_SET_TYPE_TEST_ONLY); - ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "SetInputType returned %#lx.\n", hr); hr = IMFTransform_SetInputType(transform, 0, media_type, 0); - ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); + todo_wine_if(todo) + ok_(__FILE__, line)(hr == S_OK, "SetInputType returned %#lx.\n", hr); IMFMediaType_Release(media_type); } @@ -7349,6 +7351,28 @@ static void test_video_processor(void) ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width * 2), {0}, }; + const struct attribute_desc nv12_no_aperture[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 82, 84), + {0}, + }; + const struct attribute_desc nv12_with_aperture[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height), + ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), + {0}, + }; + const struct attribute_desc rgb32_no_aperture[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32), + ATTR_RATIO(MF_MT_FRAME_SIZE, 82, 84), + {0}, + }; const MFT_OUTPUT_STREAM_INFO initial_output_info = {0}; const MFT_INPUT_STREAM_INFO initial_input_info = {0}; MFT_OUTPUT_STREAM_INFO output_info = {0}; @@ -7910,6 +7934,29 @@ static void test_video_processor(void) ret = IMFTransform_Release(transform); ok(ret == 0, "Release returned %ld\n", ret); + + /* check that it is possible to change input media type frame size using geometric aperture */ + + hr = CoCreateInstance(class_id, NULL, CLSCTX_INPROC_SERVER, + &IID_IMFTransform, (void **)&transform); + ok(hr == S_OK, "got hr %#lx\n", hr); + + check_mft_set_input_type(transform, nv12_no_aperture); + check_mft_get_input_current_type(transform, nv12_no_aperture); + + check_mft_set_output_type(transform, rgb32_no_aperture, S_OK); + check_mft_get_output_current_type(transform, rgb32_no_aperture); + + check_mft_set_input_type_(__LINE__, transform, nv12_with_aperture, TRUE); + check_mft_get_input_current_type_(__LINE__, transform, nv12_with_aperture, TRUE, FALSE); + + /* output type is the same as before */ + check_mft_get_output_current_type(transform, rgb32_no_aperture); + + ret = IMFTransform_Release(transform); + ok(ret == 0, "Release returned %ld\n", ret); + + failed: winetest_pop_context(); CoUninitialize(); From 80df4b598244cbaf3b89f20c3c8dc5f91487eec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 18:04:49 +0100 Subject: [PATCH 1150/1506] mfreadwrite/tests: Initialize test source stream types from descriptors. (cherry picked from commit 5122f6ad9f2271844531410805bd7a918b9d95c9) --- dlls/mfreadwrite/tests/mfplat.c | 179 ++++++++++++++++++++++---------- 1 file changed, 126 insertions(+), 53 deletions(-) diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index c3544a31ac6..a93b49a64a6 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -38,11 +38,47 @@ DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); #include "mfidl.h" #include "mferror.h" #include "mfreadwrite.h" +#include "propvarutil.h" #include "d3d9.h" #include "dxva2api.h" #include "wine/test.h" +struct attribute_desc +{ + const GUID *key; + const char *name; + PROPVARIANT value; + BOOL ratio; + BOOL required; + BOOL todo; + BOOL todo_value; +}; + +#define ATTR_GUID(k, g, ...) {.key = &k, .name = #k, {.vt = VT_CLSID, .puuid = (GUID *)&g}, __VA_ARGS__ } +#define ATTR_UINT32(k, v, ...) {.key = &k, .name = #k, {.vt = VT_UI4, .ulVal = v}, __VA_ARGS__ } +#define ATTR_BLOB(k, p, n, ...) {.key = &k, .name = #k, {.vt = VT_VECTOR | VT_UI1, .caub = {.pElems = (void *)p, .cElems = n}}, __VA_ARGS__ } +#define ATTR_RATIO(k, n, d, ...) {.key = &k, .name = #k, {.vt = VT_UI8, .uhVal = {.HighPart = n, .LowPart = d}}, .ratio = TRUE, __VA_ARGS__ } +#define ATTR_UINT64(k, v, ...) {.key = &k, .name = #k, {.vt = VT_UI8, .uhVal = {.QuadPart = v}}, __VA_ARGS__ } + +#define init_media_type(a, b, c) init_attributes_(__FILE__, __LINE__, (IMFAttributes *)a, b, c) +#define init_attributes(a, b, c) init_attributes_(__FILE__, __LINE__, a, b, c) +static void init_attributes_(const char *file, int line, IMFAttributes *attributes, + const struct attribute_desc *desc, ULONG limit) +{ + HRESULT hr; + ULONG i; + + hr = IMFAttributes_DeleteAllItems(attributes); + ok_(file, line)(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (i = 0; i < limit && desc[i].key; ++i) + { + hr = IMFAttributes_SetItem(attributes, desc[i].key, &desc[i].value); + ok_(file, line)(hr == S_OK, "SetItem %s returned %#lx\n", debugstr_a(desc[i].name), hr); + } +} + static ULONG get_refcount(void *iface) { IUnknown *unknown = iface; @@ -357,48 +393,10 @@ static HRESULT WINAPI test_source_GetCharacteristics(IMFMediaSource *iface, DWOR static HRESULT WINAPI test_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **pd) { struct test_source *source = impl_from_IMFMediaSource(iface); - IMFStreamDescriptor *sds[ARRAY_SIZE(source->streams)]; - IMFMediaType *media_type; HRESULT hr = S_OK; - int i; - EnterCriticalSection(&source->cs); - - if (source->pd) - { - *pd = source->pd; - IMFPresentationDescriptor_AddRef(*pd); - } - else - { - for (i = 0; i < source->stream_count; ++i) - { - hr = MFCreateMediaType(&media_type); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetUINT32(media_type, &MF_MT_AUDIO_BITS_PER_SAMPLE, 32); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = MFCreateStreamDescriptor(i, 1, &media_type, &sds[i]); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - IMFMediaType_Release(media_type); - } - - hr = MFCreatePresentationDescriptor(source->stream_count, sds, &source->pd); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - for (i = 0; i < source->stream_count; ++i) - IMFStreamDescriptor_Release(sds[i]); - - *pd = source->pd; - IMFPresentationDescriptor_AddRef(*pd); - } - - LeaveCriticalSection(&source->cs); + *pd = source->pd; + IMFPresentationDescriptor_AddRef(*pd); return hr; } @@ -522,17 +520,22 @@ static struct test_media_stream *create_test_stream(DWORD stream_index, IMFMedia return stream; } -static IMFMediaSource *create_test_source(int stream_count) +static IMFMediaSource *create_test_source(IMFStreamDescriptor **streams, UINT stream_count) { struct test_source *source; + HRESULT hr; int i; source = calloc(1, sizeof(*source)); source->IMFMediaSource_iface.lpVtbl = &test_source_vtbl; source->refcount = 1; source->stream_count = stream_count; - MFCreateEventQueue(&source->event_queue); + hr = MFCreatePresentationDescriptor(stream_count, streams, &source->pd); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateEventQueue(&source->event_queue); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); InitializeCriticalSection(&source->cs); + for (i = 0; i < source->stream_count; ++i) source->streams[i] = create_test_stream(i, &source->IMFMediaSource_iface); @@ -1028,7 +1031,15 @@ static void test_source_reader(const char *filename, bool video) static void test_source_reader_from_media_source(void) { static const DWORD expected_sample_order[10] = {0, 0, 1, 1, 0, 0, 0, 0, 1, 0}; + static const struct attribute_desc audio_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio), + ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_PCM), + ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 32), + {0}, + }; + IMFStreamDescriptor *audio_streams[3]; struct async_callback *callback; IMFSourceReader *reader; IMFMediaSource *source; @@ -1043,7 +1054,18 @@ static void test_source_reader_from_media_source(void) int i; PROPVARIANT pos; - source = create_test_source(3); + for (i = 0; i < ARRAY_SIZE(audio_streams); i++) + { + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, audio_stream_type_desc, -1); + + hr = MFCreateStreamDescriptor(i, 1, &media_type, &audio_streams[i]); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + } + + source = create_test_source(audio_streams, 3); ok(!!source, "Failed to create test source.\n"); hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); @@ -1122,7 +1144,7 @@ static void test_source_reader_from_media_source(void) IMFSourceReader_Release(reader); IMFMediaSource_Release(source); - source = create_test_source(1); + source = create_test_source(audio_streams, 1); ok(!!source, "Failed to create test source.\n"); hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); @@ -1159,7 +1181,7 @@ static void test_source_reader_from_media_source(void) IMFMediaSource_Release(source); /* Request from stream 0. */ - source = create_test_source(3); + source = create_test_source(audio_streams, 3); ok(!!source, "Failed to create test source.\n"); hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); @@ -1193,7 +1215,7 @@ static void test_source_reader_from_media_source(void) IMFMediaSource_Release(source); /* Request a non-native bit depth. */ - source = create_test_source(1); + source = create_test_source(audio_streams, 1); ok(!!source, "Failed to create test source.\n"); hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); @@ -1241,7 +1263,7 @@ static void test_source_reader_from_media_source(void) IMFMediaSource_Release(source); /* Async mode. */ - source = create_test_source(3); + source = create_test_source(audio_streams, 3); ok(!!source, "Failed to create test source.\n"); callback = create_async_callback(); @@ -1286,7 +1308,7 @@ static void test_source_reader_from_media_source(void) IMFMediaSource_Release(source); /* RequestSample failure. */ - source = create_test_source(3); + source = create_test_source(audio_streams, 3); ok(!!source, "Failed to create test source.\n"); fail_request_sample = TRUE; @@ -1329,7 +1351,7 @@ static void test_source_reader_from_media_source(void) fail_request_sample = FALSE; /* MF_SOURCE_READER_ANY_STREAM with streams of different sample sizes */ - source = create_test_source(2); + source = create_test_source(audio_streams, 2); ok(!!source, "Failed to create test source.\n"); test_source = impl_from_IMFMediaSource(source); @@ -1359,19 +1381,32 @@ static void test_source_reader_from_media_source(void) IMFSourceReader_Release(reader); IMFMediaSource_Release(source); + + for (i = 0; i < ARRAY_SIZE(audio_streams); i++) + IMFStreamDescriptor_Release(audio_streams[i]); } static void test_reader_d3d9(void) { + static const struct attribute_desc audio_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio), + ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_PCM), + ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 32), + {0}, + }; + + IMFStreamDescriptor *audio_streams[3]; IDirect3DDeviceManager9 *d3d9_manager; IDirect3DDevice9 *d3d9_device; IMFAttributes *attributes; + IMFMediaType *media_type; IMFSourceReader *reader; IMFMediaSource *source; IDirect3D9 *d3d9; HWND window; HRESULT hr; - UINT token; + UINT i, token; ULONG refcount; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); @@ -1387,13 +1422,24 @@ static void test_reader_d3d9(void) goto done; } + for (i = 0; i < ARRAY_SIZE(audio_streams); i++) + { + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, audio_stream_type_desc, -1); + + hr = MFCreateStreamDescriptor(i, 1, &media_type, &audio_streams[i]); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + } + hr = DXVA2CreateDirect3DDeviceManager9(&token, &d3d9_manager); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IDirect3DDeviceManager9_ResetDevice(d3d9_manager, d3d9_device, token); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - source = create_test_source(3); + source = create_test_source(audio_streams, 3); ok(!!source, "Failed to create test source.\n"); hr = MFCreateAttributes(&attributes, 1); @@ -1409,11 +1455,13 @@ static void test_reader_d3d9(void) IMFSourceReader_Release(reader); + for (i = 0; i < ARRAY_SIZE(audio_streams); i++) + IMFStreamDescriptor_Release(audio_streams[i]); + refcount = IDirect3DDeviceManager9_Release(d3d9_manager); ok(!refcount, "Unexpected refcount %lu.\n", refcount); IDirect3DDevice9_Release(d3d9_device); - done: IDirect3D9_Release(d3d9); DestroyWindow(window); @@ -1511,12 +1559,34 @@ static void test_sink_writer_mp4(void) static void test_interfaces(void) { + static const struct attribute_desc audio_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio), + ATTR_GUID(MF_MT_SUBTYPE, MFAudioFormat_PCM), + ATTR_UINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 32), + {0}, + }; + + IMFStreamDescriptor *audio_streams[1]; + IMFMediaType *media_type; IMFSourceReader *reader; IMFMediaSource *source; IUnknown *unk; HRESULT hr; + UINT i; + + for (i = 0; i < ARRAY_SIZE(audio_streams); i++) + { + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, audio_stream_type_desc, -1); - source = create_test_source(1); + hr = MFCreateStreamDescriptor(i, 1, &media_type, &audio_streams[i]); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + } + + source = create_test_source(audio_streams, 1); ok(!!source, "Failed to create test source.\n"); hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); @@ -1529,6 +1599,9 @@ static void test_interfaces(void) IMFSourceReader_Release(reader); IMFMediaSource_Release(source); + + for (i = 0; i < ARRAY_SIZE(audio_streams); i++) + IMFStreamDescriptor_Release(audio_streams[i]); } START_TEST(mfplat) From 36a0c4a08a8126bfeb37f0d90144d4d9a5b44a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 18:05:44 +0100 Subject: [PATCH 1151/1506] mfreadwrite/tests: Test source reader exposed transforms and types. (cherry picked from commit f5daee4a2fb50760347cbeeed5fe39049841aef1) --- dlls/mfreadwrite/tests/Makefile.in | 2 +- dlls/mfreadwrite/tests/mfplat.c | 385 +++++++++++++++++++++++++++++ 2 files changed, 386 insertions(+), 1 deletion(-) diff --git a/dlls/mfreadwrite/tests/Makefile.in b/dlls/mfreadwrite/tests/Makefile.in index 90bac9e0896..cada1bf22ff 100644 --- a/dlls/mfreadwrite/tests/Makefile.in +++ b/dlls/mfreadwrite/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = mfreadwrite.dll -IMPORTS = ole32 user32 d3d9 dxva2 mfplat mfreadwrite mfuuid +IMPORTS = ole32 user32 d3d9 dxva2 mfplat mfreadwrite mfuuid propsys SOURCES = \ mfplat.c \ diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index a93b49a64a6..04c077dd027 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -61,6 +61,53 @@ struct attribute_desc #define ATTR_RATIO(k, n, d, ...) {.key = &k, .name = #k, {.vt = VT_UI8, .uhVal = {.HighPart = n, .LowPart = d}}, .ratio = TRUE, __VA_ARGS__ } #define ATTR_UINT64(k, v, ...) {.key = &k, .name = #k, {.vt = VT_UI8, .uhVal = {.QuadPart = v}}, __VA_ARGS__ } +#define check_media_type(a, b, c) check_attributes_(__FILE__, __LINE__, (IMFAttributes *)a, b, c) +#define check_attributes(a, b, c) check_attributes_(__FILE__, __LINE__, a, b, c) +void check_attributes_(const char *file, int line, IMFAttributes *attributes, + const struct attribute_desc *desc, ULONG limit) +{ + char buffer[1024], *buf = buffer; + PROPVARIANT value; + int i, j, ret; + HRESULT hr; + + for (i = 0; i < limit && desc[i].key; ++i) + { + hr = IMFAttributes_GetItem(attributes, desc[i].key, &value); + todo_wine_if(desc[i].todo) + ok_(file, line)(hr == S_OK, "%s missing, hr %#lx\n", debugstr_a(desc[i].name), hr); + if (hr != S_OK) continue; + + switch (value.vt) + { + default: sprintf(buffer, "??"); break; + case VT_CLSID: sprintf(buffer, "%s", debugstr_guid(value.puuid)); break; + case VT_UI4: sprintf(buffer, "%lu", value.ulVal); break; + case VT_UI8: + if (desc[i].ratio) + sprintf(buffer, "%lu:%lu", value.uhVal.HighPart, value.uhVal.LowPart); + else + sprintf(buffer, "%I64u", value.uhVal.QuadPart); + break; + case VT_VECTOR | VT_UI1: + buf += sprintf(buf, "size %lu, data {", value.caub.cElems); + for (j = 0; j < 128 && j < value.caub.cElems; ++j) + buf += sprintf(buf, "0x%02x,", value.caub.pElems[j]); + if (value.caub.cElems > 128) + buf += sprintf(buf, "...}"); + else + buf += sprintf(buf - (j ? 1 : 0), "}"); + break; + } + + ret = PropVariantCompareEx(&value, &desc[i].value, 0, 0); + todo_wine_if(desc[i].todo_value) + ok_(file, line)(ret == 0, "%s mismatch, type %u, value %s\n", + debugstr_a(desc[i].name), value.vt, buffer); + PropVariantClear(&value); + } +} + #define init_media_type(a, b, c) init_attributes_(__FILE__, __LINE__, (IMFAttributes *)a, b, c) #define init_attributes(a, b, c) init_attributes_(__FILE__, __LINE__, a, b, c) static void init_attributes_(const char *file, int line, IMFAttributes *attributes, @@ -1604,6 +1651,343 @@ static void test_interfaces(void) IMFStreamDescriptor_Release(audio_streams[i]); } +static void test_source_reader_transforms(void) +{ + static const struct attribute_desc h264_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_H264), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + {0}, + }; + static const struct attribute_desc nv12_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + {0}, + }; + static const struct attribute_desc nv12_expect_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + ATTR_UINT32(MF_MT_AVG_BIT_ERROR_RATE, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_COMPRESSED, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 96), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 13824), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + {0}, + }; + static const struct attribute_desc yuy2_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + {0}, + }; + static const struct attribute_desc yuy2_expect_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), + ATTR_RATIO(MF_MT_PIXEL_ASPECT_RATIO, 1, 1), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), + ATTR_UINT32(MF_MT_AVG_BIT_ERROR_RATE, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_COMPRESSED, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 192), + ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 7), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 18432), + ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), + {0}, + }; + static const struct attribute_desc rgb32_stream_type_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + {0}, + }; + IMFStreamDescriptor *video_stream; + IMFSourceReaderEx *reader_ex; + IMFMediaType *media_type; + IMFSourceReader *reader; + IMFTransform *transform; + IMFMediaSource *source; + GUID category; + HRESULT hr; + + /* test source reader with a RGB32 source */ + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, rgb32_stream_type_desc, -1); + hr = MFCreateStreamDescriptor(0, 1, &media_type, &video_stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + source = create_test_source(&video_stream, 1); + ok(!!source, "Failed to create test source.\n"); + + hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReader_SetStreamSelection(reader, 0, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /* skip tests on Win7 which misses IMFSourceReaderEx and has uninteresting media types differences */ + hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); + ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* Win7 */, "Unexpected hr %#lx.\n", hr); + if (broken(hr == E_NOINTERFACE)) + { + win_skip("missing IMFSourceReaderEx interface, skipping tests on Win7\n"); + goto skip_tests; + } + IMFSourceReaderEx_Release(reader_ex); + + hr = IMFSourceReader_GetNativeMediaType(reader, 0, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, rgb32_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, rgb32_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + /* only one stream type and only one stream */ + hr = IMFSourceReader_GetNativeMediaType(reader, 0, 1, &media_type); + ok(hr == MF_E_NO_MORE_TYPES, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReader_GetNativeMediaType(reader, 1, 0, &media_type); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReader_GetCurrentMediaType(reader, 1, &media_type); + ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#lx.\n", hr); + + /* cannot request encoding to compressed media type */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, h264_stream_type_desc, -1); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + /* SetCurrentMediaType needs major type and subtype */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, nv12_stream_type_desc, 1); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + /* RGB32 -> NV12 conversion */ + init_media_type(media_type, nv12_stream_type_desc, -1); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, rgb32_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + + IMFSourceReader_Release(reader); + IMFMediaSource_Release(source); + IMFStreamDescriptor_Release(video_stream); + + + /* test source reader with a NV12 source */ + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, nv12_stream_type_desc, -1); + hr = MFCreateStreamDescriptor(0, 1, &media_type, &video_stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + source = create_test_source(&video_stream, 1); + ok(!!source, "Failed to create test source.\n"); + + hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReader_SetStreamSelection(reader, 0, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFSourceReader_GetNativeMediaType(reader, 0, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + /* NV12 -> RGB32 conversion */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, rgb32_stream_type_desc, -1); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + + /* NV12 -> YUY2 conversion */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, yuy2_stream_type_desc, -1); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + + IMFSourceReader_Release(reader); + IMFMediaSource_Release(source); + IMFStreamDescriptor_Release(video_stream); + + + /* test source reader with a H264 source */ + + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, h264_stream_type_desc, -1); + hr = MFCreateStreamDescriptor(0, 1, &media_type, &video_stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + source = create_test_source(&video_stream, 1); + ok(!!source, "Failed to create test source.\n"); + + hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReader_SetStreamSelection(reader, 0, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFSourceReader_GetNativeMediaType(reader, 0, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, h264_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, h264_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + /* when H264 output is used, there's no decoder transform */ + hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + + /* H264 -> RGB32 conversion */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, rgb32_stream_type_desc, -1); + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + /* H264 -> NV12 conversion */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, nv12_stream_type_desc, 2); /* doesn't need the frame size */ + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_expect_desc, -1); + IMFMediaType_Release(media_type); + + /* the H264 decoder transform can now be accessed */ + hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, h264_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + + /* YUY2 output works too */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, yuy2_stream_type_desc, 2); /* doesn't need the frame size */ + hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, yuy2_expect_desc, -1); + IMFMediaType_Release(media_type); + + /* decoder transform is also available through the IMFSourceReaderEx interface */ + hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 0, &category, &transform); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, h264_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, yuy2_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + /* changing the transform media type doesn't change the reader output type */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(media_type, nv12_stream_type_desc, -1); + hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, yuy2_expect_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } + + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 1, &category, &transform); + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + IMFSourceReaderEx_Release(reader_ex); + +skip_tests: + IMFSourceReader_Release(reader); + IMFMediaSource_Release(source); + IMFStreamDescriptor_Release(video_stream); +} + START_TEST(mfplat) { HRESULT hr; @@ -1618,6 +2002,7 @@ START_TEST(mfplat) test_source_reader("test.wav", false); test_source_reader("test.mp4", true); test_source_reader_from_media_source(); + test_source_reader_transforms(); test_reader_d3d9(); test_sink_writer_create(); test_sink_writer_mp4(); From 98eb371ee06ff06e29ab8a2660f11cff5efe7caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 20:24:28 +0100 Subject: [PATCH 1152/1506] mfreadwrite/tests: Test source reader transforms with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING. (cherry picked from commit b37a16c7f39c7054238570d714c56d31af6c5f7d) --- dlls/mfreadwrite/tests/mfplat.c | 134 ++++++++++++++++++++++++++++---- 1 file changed, 121 insertions(+), 13 deletions(-) diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 04c077dd027..aa333b67065 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -1651,7 +1651,7 @@ static void test_interfaces(void) IMFStreamDescriptor_Release(audio_streams[i]); } -static void test_source_reader_transforms(void) +static void test_source_reader_transforms(BOOL enable_processing) { static const struct attribute_desc h264_stream_type_desc[] = { @@ -1715,8 +1715,20 @@ static void test_source_reader_transforms(void) ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), {0}, }; + static const struct attribute_desc rgb32_expect_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32, .todo_value = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1, .todo = TRUE), + ATTR_UINT32(MF_MT_DEFAULT_STRIDE, 384, .todo = TRUE), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 2, .todo = TRUE), + ATTR_UINT32(MF_MT_SAMPLE_SIZE, 36864, .todo = TRUE), + {0}, + }; IMFStreamDescriptor *video_stream; IMFSourceReaderEx *reader_ex; + IMFAttributes *attributes; IMFMediaType *media_type; IMFSourceReader *reader; IMFTransform *transform; @@ -1724,6 +1736,13 @@ static void test_source_reader_transforms(void) GUID category; HRESULT hr; + winetest_push_context("vp %u", enable_processing); + + hr = MFCreateAttributes(&attributes, 1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, enable_processing); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + /* test source reader with a RGB32 source */ hr = MFCreateMediaType(&media_type); @@ -1736,7 +1755,7 @@ static void test_source_reader_transforms(void) source = create_test_source(&video_stream, 1); ok(!!source, "Failed to create test source.\n"); - hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); + hr = MFCreateSourceReaderFromMediaSource(source, attributes, &reader); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceReader_SetStreamSelection(reader, 0, TRUE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1817,7 +1836,7 @@ static void test_source_reader_transforms(void) source = create_test_source(&video_stream, 1); ok(!!source, "Failed to create test source.\n"); - hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); + hr = MFCreateSourceReaderFromMediaSource(source, attributes, &reader); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceReader_SetStreamSelection(reader, 0, TRUE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1832,12 +1851,23 @@ static void test_source_reader_transforms(void) check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); - /* NV12 -> RGB32 conversion */ + /* NV12 -> RGB32 conversion with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING */ hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_media_type(media_type, rgb32_stream_type_desc, -1); + init_media_type(media_type, rgb32_stream_type_desc, 2); /* doesn't need the frame size */ hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); - ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + if (enable_processing) + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + else + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (enable_processing) + check_media_type(media_type, rgb32_expect_desc, -1); + else + check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); @@ -1853,12 +1883,25 @@ static void test_source_reader_transforms(void) hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - check_media_type(media_type, nv12_stream_type_desc, -1); + if (enable_processing) + check_media_type(media_type, rgb32_expect_desc, -1); + else + check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); + /* even though we are now converting to RGB32 the converter transform is not exposed */ hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + /* not even through the IMFSourceReaderEx interface */ + hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 0, &category, &transform); + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 1, &category, &transform); + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + IMFSourceReaderEx_Release(reader_ex); + IMFSourceReader_Release(reader); IMFMediaSource_Release(source); IMFStreamDescriptor_Release(video_stream); @@ -1876,7 +1919,7 @@ static void test_source_reader_transforms(void) source = create_test_source(&video_stream, 1); ok(!!source, "Failed to create test source.\n"); - hr = MFCreateSourceReaderFromMediaSource(source, NULL, &reader); + hr = MFCreateSourceReaderFromMediaSource(source, attributes, &reader); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceReader_SetStreamSelection(reader, 0, TRUE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1895,14 +1938,74 @@ static void test_source_reader_transforms(void) hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); - /* H264 -> RGB32 conversion */ + /* H264 -> RGB32 conversion with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING */ hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_media_type(media_type, rgb32_stream_type_desc, -1); + init_media_type(media_type, rgb32_stream_type_desc, 2); /* doesn't need the frame size */ hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); - todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#lx.\n", hr); + if (enable_processing) + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(media_type); + + hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (enable_processing) + check_media_type(media_type, rgb32_expect_desc, -1); + else + check_media_type(media_type, h264_stream_type_desc, -1); IMFMediaType_Release(media_type); + /* H264 decoder transform is exposed with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING */ + hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); + if (!enable_processing) + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, h264_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + /* with NV12 output */ + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } + + /* H264 decoder transform is also available through the IMFSourceReaderEx interface */ + hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 0, &category, &transform); + if (!enable_processing) + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, h264_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } + + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 1, &category, &transform); + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + IMFSourceReaderEx_Release(reader_ex); + /* H264 -> NV12 conversion */ hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1945,7 +2048,7 @@ static void test_source_reader_transforms(void) check_media_type(media_type, yuy2_expect_desc, -1); IMFMediaType_Release(media_type); - /* decoder transform is also available through the IMFSourceReaderEx interface */ + /* H264 decoder transform is also available through the IMFSourceReaderEx interface */ hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 0, &category, &transform); @@ -1986,6 +2089,10 @@ static void test_source_reader_transforms(void) IMFSourceReader_Release(reader); IMFMediaSource_Release(source); IMFStreamDescriptor_Release(video_stream); + + IMFAttributes_Release(attributes); + + winetest_pop_context(); } START_TEST(mfplat) @@ -2002,7 +2109,8 @@ START_TEST(mfplat) test_source_reader("test.wav", false); test_source_reader("test.mp4", true); test_source_reader_from_media_source(); - test_source_reader_transforms(); + test_source_reader_transforms(FALSE); + test_source_reader_transforms(TRUE); test_reader_d3d9(); test_sink_writer_create(); test_sink_writer_mp4(); From 1e0e93267c61622d71386cdf17aaaa2bae1ce213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Feb 2024 09:37:30 +0100 Subject: [PATCH 1153/1506] mfreadwrite/tests: Test source reader transforms with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING. (cherry picked from commit 3c644480377a4aac6bcc0b23b79f726366346c7a) --- dlls/mfreadwrite/tests/mfplat.c | 202 +++++++++++++++++++++++++++----- 1 file changed, 173 insertions(+), 29 deletions(-) diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index aa333b67065..08e19589ad1 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -1651,7 +1651,7 @@ static void test_interfaces(void) IMFStreamDescriptor_Release(audio_streams[i]); } -static void test_source_reader_transforms(BOOL enable_processing) +static void test_source_reader_transforms(BOOL enable_processing, BOOL enable_advanced) { static const struct attribute_desc h264_stream_type_desc[] = { @@ -1684,6 +1684,16 @@ static void test_source_reader_transforms(BOOL enable_processing) ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), {0}, }; + static const struct attribute_desc nv12_expect_advanced_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12, .todo_value = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1, .todo = TRUE), + ATTR_UINT32(MF_MT_COMPRESSED, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 2, .todo = TRUE), + {0}, + }; static const struct attribute_desc yuy2_stream_type_desc[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -1708,6 +1718,16 @@ static void test_source_reader_transforms(BOOL enable_processing) ATTR_UINT32(MF_MT_VIDEO_ROTATION, 0), {0}, }; + static const struct attribute_desc yuy2_expect_advanced_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2, .todo_value = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1, .todo = TRUE), + ATTR_UINT32(MF_MT_COMPRESSED, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 2, .todo = TRUE), + {0}, + }; static const struct attribute_desc rgb32_stream_type_desc[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -1726,6 +1746,15 @@ static void test_source_reader_transforms(BOOL enable_processing) ATTR_UINT32(MF_MT_SAMPLE_SIZE, 36864, .todo = TRUE), {0}, }; + static const struct attribute_desc rgb32_expect_advanced_desc[] = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32, .todo_value = TRUE), + ATTR_RATIO(MF_MT_FRAME_SIZE, 96, 96), + ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1, .todo = TRUE), + ATTR_UINT32(MF_MT_COMPRESSED, 0, .todo = TRUE), + ATTR_UINT32(MF_MT_INTERLACE_MODE, 2, .todo = TRUE), + }; IMFStreamDescriptor *video_stream; IMFSourceReaderEx *reader_ex; IMFAttributes *attributes; @@ -1736,12 +1765,14 @@ static void test_source_reader_transforms(BOOL enable_processing) GUID category; HRESULT hr; - winetest_push_context("vp %u", enable_processing); + winetest_push_context("vp %u adv %u", enable_processing, enable_advanced); hr = MFCreateAttributes(&attributes, 1); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFAttributes_SetUINT32(attributes, &MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, enable_processing); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING, enable_advanced); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); /* test source reader with a RGB32 source */ @@ -1805,19 +1836,43 @@ static void test_source_reader_transforms(BOOL enable_processing) hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); - /* RGB32 -> NV12 conversion */ - init_media_type(media_type, nv12_stream_type_desc, -1); + /* RGB32 -> NV12 conversion with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ + init_media_type(media_type, nv12_stream_type_desc, 2); /* doesn't need the frame size */ hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); - ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + if (enable_advanced) + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + else + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); IMFMediaType_Release(media_type); hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - check_media_type(media_type, rgb32_stream_type_desc, -1); + if (enable_advanced) + check_media_type(media_type, nv12_expect_advanced_desc, -1); + else + check_media_type(media_type, rgb32_stream_type_desc, -1); IMFMediaType_Release(media_type); + /* video processor is accessible with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); - ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + if (!enable_advanced) + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, rgb32_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } IMFSourceReader_Release(reader); IMFMediaSource_Release(source); @@ -1851,12 +1906,12 @@ static void test_source_reader_transforms(BOOL enable_processing) check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); - /* NV12 -> RGB32 conversion with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING */ + /* NV12 -> RGB32 conversion with MF_SOURCE_READER_ENABLE_(ADVANCED_)VIDEO_PROCESSING */ hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); init_media_type(media_type, rgb32_stream_type_desc, 2); /* doesn't need the frame size */ hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); - if (enable_processing) + if (enable_processing || enable_advanced) todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); else ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); @@ -1864,40 +1919,99 @@ static void test_source_reader_transforms(BOOL enable_processing) hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (enable_processing) + if (enable_advanced) + check_media_type(media_type, rgb32_expect_advanced_desc, -1); + else if (enable_processing) check_media_type(media_type, rgb32_expect_desc, -1); else check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); + /* convert transform is only exposed with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); - ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + if (!enable_advanced) + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, rgb32_stream_type_desc, -1); + IMFMediaType_Release(media_type); - /* NV12 -> YUY2 conversion */ + IMFTransform_Release(transform); + } + + /* NV12 -> YUY2 conversion with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_media_type(media_type, yuy2_stream_type_desc, -1); + init_media_type(media_type, yuy2_stream_type_desc, 2); /* doesn't need the frame size */ hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); - ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); + if (enable_advanced) + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + else + ok(hr == MF_E_TOPO_CODEC_NOT_FOUND, "Unexpected hr %#lx.\n", hr); IMFMediaType_Release(media_type); hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (enable_processing) + if (enable_advanced) + check_media_type(media_type, yuy2_expect_advanced_desc, -1); + else if (enable_processing) check_media_type(media_type, rgb32_expect_desc, -1); else check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); - /* even though we are now converting to RGB32 the converter transform is not exposed */ + /* convert transform is only exposed with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); - ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + if (!enable_advanced) + ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, yuy2_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } - /* not even through the IMFSourceReaderEx interface */ hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 0, &category, &transform); - todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + if (!enable_advanced) + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, yuy2_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 1, &category, &transform); todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); IMFSourceReaderEx_Release(reader_ex); @@ -1938,12 +2052,12 @@ static void test_source_reader_transforms(BOOL enable_processing) hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); - /* H264 -> RGB32 conversion with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING */ + /* H264 -> RGB32 conversion with MF_SOURCE_READER_ENABLE_(ADVANCED_)VIDEO_PROCESSING */ hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); init_media_type(media_type, rgb32_stream_type_desc, 2); /* doesn't need the frame size */ hr = IMFSourceReader_SetCurrentMediaType(reader, 0, NULL, media_type); - if (enable_processing) + if (enable_processing || enable_advanced) todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); else todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "Unexpected hr %#lx.\n", hr); @@ -1951,15 +2065,17 @@ static void test_source_reader_transforms(BOOL enable_processing) hr = IMFSourceReader_GetCurrentMediaType(reader, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (enable_processing) + if (enable_advanced) + check_media_type(media_type, rgb32_expect_advanced_desc, -1); + else if (enable_processing) check_media_type(media_type, rgb32_expect_desc, -1); else check_media_type(media_type, h264_stream_type_desc, -1); IMFMediaType_Release(media_type); - /* H264 decoder transform is exposed with MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING */ + /* the exposed transform is the H264 decoder or the converter with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ hr = IMFSourceReader_GetServiceForStream(reader, 0, &GUID_NULL, &IID_IMFTransform, (void **)&transform); - if (!enable_processing) + if (!enable_processing && !enable_advanced) ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr); else todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1967,13 +2083,19 @@ static void test_source_reader_transforms(BOOL enable_processing) { hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - check_media_type(media_type, h264_stream_type_desc, -1); + if (enable_advanced) + check_media_type(media_type, nv12_stream_type_desc, -1); + else + check_media_type(media_type, h264_stream_type_desc, -1); IMFMediaType_Release(media_type); /* with NV12 output */ hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - check_media_type(media_type, nv12_stream_type_desc, -1); + if (enable_advanced) + check_media_type(media_type, rgb32_stream_type_desc, -1); + else + check_media_type(media_type, nv12_stream_type_desc, -1); IMFMediaType_Release(media_type); IMFTransform_Release(transform); @@ -1983,7 +2105,7 @@ static void test_source_reader_transforms(BOOL enable_processing) hr = IMFSourceReader_QueryInterface(reader, &IID_IMFSourceReaderEx, (void **)&reader_ex); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 0, &category, &transform); - if (!enable_processing) + if (!enable_processing && !enable_advanced) todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); else todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -2002,7 +2124,28 @@ static void test_source_reader_transforms(BOOL enable_processing) IMFTransform_Release(transform); } + /* the video processor can be accessed at index 1 with MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING */ hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 1, &category, &transform); + if (!enable_advanced) + todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); + else + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, nv12_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + check_media_type(media_type, rgb32_stream_type_desc, -1); + IMFMediaType_Release(media_type); + + IMFTransform_Release(transform); + } + + hr = IMFSourceReaderEx_GetTransformForStream(reader_ex, 0, 2, &category, &transform); todo_wine ok(hr == MF_E_INVALIDINDEX, "Unexpected hr %#lx.\n", hr); IMFSourceReaderEx_Release(reader_ex); @@ -2109,8 +2252,9 @@ START_TEST(mfplat) test_source_reader("test.wav", false); test_source_reader("test.mp4", true); test_source_reader_from_media_source(); - test_source_reader_transforms(FALSE); - test_source_reader_transforms(TRUE); + test_source_reader_transforms(FALSE, FALSE); + test_source_reader_transforms(TRUE, FALSE); + test_source_reader_transforms(FALSE, TRUE); test_reader_d3d9(); test_sink_writer_create(); test_sink_writer_mp4(); From 9506607e23a7133e204648d43aa79a36be999d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 22 Nov 2023 22:22:22 +0100 Subject: [PATCH 1154/1506] HACK: winegstreamer/new_media_source: Clone the media source to new_media_source.c. For an experimental, non-decoding, source rewrite, guarded with WINE_NEW_MEDIA_SOURCE env var. CW-Bug-Id: #21953 --- dlls/mfplat/main.c | 5 + dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/mfplat.c | 2 + dlls/winegstreamer/new_media_source.c | 2053 ++++++++++++++++++ dlls/winegstreamer/winegstreamer_classes.idl | 6 + 6 files changed, 2068 insertions(+) create mode 100644 dlls/winegstreamer/new_media_source.c diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 4805812e4d1..e545fd5b999 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -6296,6 +6296,11 @@ static HRESULT resolver_get_bytestream_url_hint(IMFByteStream *stream, WCHAR con static HRESULT resolver_create_gstreamer_handler(IMFByteStreamHandler **handler) { static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; + static const GUID CLSID_GStreamerByteStreamHandler2 = {0x317df619, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; + + const char *env = getenv("WINE_NEW_MEDIA_SOURCE"); + if (env && atoi(env)) return CoCreateInstance(&CLSID_GStreamerByteStreamHandler2, NULL, CLSCTX_INPROC_SERVER, &IID_IMFByteStreamHandler, (void **)handler); + return CoCreateInstance(&CLSID_GStreamerByteStreamHandler, NULL, CLSCTX_INPROC_SERVER, &IID_IMFByteStreamHandler, (void **)handler); } diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 02b1b04fdf9..af64d13b7b7 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -14,6 +14,7 @@ SOURCES = \ media_sink.c \ media_source.c \ mfplat.c \ + new_media_source.c \ quartz_parser.c \ quartz_transform.c \ resampler.c \ diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 8bc50d6cd99..e258a5ce532 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -166,6 +166,7 @@ HRESULT wg_transform_read_quartz(wg_transform_t transform, struct wg_sample *sam HRESULT wg_transform_read_dmo(wg_transform_t transform, DMO_OUTPUT_DATA_BUFFER *buffer); HRESULT gstreamer_byte_stream_handler_create(REFIID riid, void **obj); +HRESULT gstreamer_byte_stream_handler_2_create(REFIID riid, void **obj); unsigned int wg_format_get_stride(const struct wg_format *format); diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 4372678fe0e..2537c6bf455 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -122,6 +122,7 @@ static const IClassFactoryVtbl class_factory_vtbl = }; static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; +static const GUID CLSID_GStreamerByteStreamHandler2 = {0x317df619, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_GStreamerSchemePlugin = {0x587eeb6a,0x7336,0x4ebd,{0xa4,0xf2,0x91,0xc9,0x48,0xde,0x62,0x2c}}; @@ -134,6 +135,7 @@ class_objects[] = { { &CLSID_VideoProcessorMFT, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, + { &CLSID_GStreamerByteStreamHandler2, &gstreamer_byte_stream_handler_2_create }, { &CLSID_MSAACDecMFT, &aac_decoder_create }, { &CLSID_MSH264DecoderMFT, &h264_decoder_create }, { &CLSID_GStreamerSchemePlugin, &gstreamer_scheme_handler_create }, diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c new file mode 100644 index 00000000000..2250a5faab8 --- /dev/null +++ b/dlls/winegstreamer/new_media_source.c @@ -0,0 +1,2053 @@ +/* GStreamer Media Source + * + * Copyright 2020 Derek Lesho + * Copyright 2020 Zebediah Figura for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "gst_private.h" + +#include "mfapi.h" +#include "mferror.h" + +#include "wine/list.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); + +struct object_context +{ + IUnknown IUnknown_iface; + LONG refcount; + + IMFAsyncResult *result; + IMFByteStream *stream; + UINT64 file_size; + WCHAR *url; +}; + +static struct object_context *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct object_context, IUnknown_iface); +} + +static HRESULT WINAPI object_context_QueryInterface(IUnknown *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI object_context_AddRef(IUnknown *iface) +{ + struct object_context *context = impl_from_IUnknown(iface); + ULONG refcount = InterlockedIncrement(&context->refcount); + + TRACE("%p, refcount %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI object_context_Release(IUnknown *iface) +{ + struct object_context *context = impl_from_IUnknown(iface); + ULONG refcount = InterlockedDecrement(&context->refcount); + + TRACE("%p, refcount %lu.\n", iface, refcount); + + if (!refcount) + { + IMFAsyncResult_Release(context->result); + IMFByteStream_Release(context->stream); + free(context->url); + free(context); + } + + return refcount; +} + +static const IUnknownVtbl object_context_vtbl = +{ + object_context_QueryInterface, + object_context_AddRef, + object_context_Release, +}; + +static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const WCHAR *url, + QWORD file_size, IMFAsyncResult *result, IUnknown **out) +{ + WCHAR *tmp_url = url ? wcsdup(url) : NULL; + struct object_context *context; + + if (!(context = calloc(1, sizeof(*context)))) + { + free(tmp_url); + return E_OUTOFMEMORY; + } + + context->IUnknown_iface.lpVtbl = &object_context_vtbl; + context->refcount = 1; + context->stream = stream; + IMFByteStream_AddRef(context->stream); + context->file_size = file_size; + context->url = tmp_url; + context->result = result; + IMFAsyncResult_AddRef(context->result); + + *out = &context->IUnknown_iface; + return S_OK; +} + +struct media_stream +{ + IMFMediaStream IMFMediaStream_iface; + LONG ref; + + IMFMediaSource *media_source; + IMFMediaEventQueue *event_queue; + IMFStreamDescriptor *descriptor; + + wg_parser_stream_t wg_stream; + + IUnknown **token_queue; + LONG token_queue_count; + LONG token_queue_cap; + + DWORD stream_id; + BOOL active; + BOOL eos; +}; + +enum source_async_op +{ + SOURCE_ASYNC_START, + SOURCE_ASYNC_PAUSE, + SOURCE_ASYNC_STOP, + SOURCE_ASYNC_REQUEST_SAMPLE, +}; + +struct source_async_command +{ + IUnknown IUnknown_iface; + LONG refcount; + enum source_async_op op; + union + { + struct + { + IMFPresentationDescriptor *descriptor; + GUID format; + PROPVARIANT position; + } start; + struct + { + struct media_stream *stream; + IUnknown *token; + } request_sample; + } u; +}; + +struct media_source +{ + IMFMediaSource IMFMediaSource_iface; + IMFGetService IMFGetService_iface; + IMFRateSupport IMFRateSupport_iface; + IMFRateControl IMFRateControl_iface; + IMFAsyncCallback async_commands_callback; + LONG ref; + DWORD async_commands_queue; + IMFMediaEventQueue *event_queue; + IMFByteStream *byte_stream; + + CRITICAL_SECTION cs; + + UINT64 file_size; + wg_parser_t wg_parser; + UINT64 duration; + + IMFStreamDescriptor **descriptors; + struct media_stream **streams; + ULONG stream_count; + + enum + { + SOURCE_OPENING, + SOURCE_STOPPED, + SOURCE_PAUSED, + SOURCE_RUNNING, + SOURCE_SHUTDOWN, + } state; + float rate; + + HANDLE read_thread; + bool read_thread_shutdown; +}; + +static inline struct media_stream *impl_from_IMFMediaStream(IMFMediaStream *iface) +{ + return CONTAINING_RECORD(iface, struct media_stream, IMFMediaStream_iface); +} + +static inline struct media_source *impl_from_IMFMediaSource(IMFMediaSource *iface) +{ + return CONTAINING_RECORD(iface, struct media_source, IMFMediaSource_iface); +} + +static inline struct media_source *impl_from_IMFGetService(IMFGetService *iface) +{ + return CONTAINING_RECORD(iface, struct media_source, IMFGetService_iface); +} + +static inline struct media_source *impl_from_IMFRateSupport(IMFRateSupport *iface) +{ + return CONTAINING_RECORD(iface, struct media_source, IMFRateSupport_iface); +} + +static inline struct media_source *impl_from_IMFRateControl(IMFRateControl *iface) +{ + return CONTAINING_RECORD(iface, struct media_source, IMFRateControl_iface); +} + +static inline struct media_source *impl_from_async_commands_callback_IMFAsyncCallback(IMFAsyncCallback *iface) +{ + return CONTAINING_RECORD(iface, struct media_source, async_commands_callback); +} + +static inline struct source_async_command *impl_from_async_command_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct source_async_command, IUnknown_iface); +} + +static HRESULT WINAPI source_async_command_QueryInterface(IUnknown *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI source_async_command_AddRef(IUnknown *iface) +{ + struct source_async_command *command = impl_from_async_command_IUnknown(iface); + return InterlockedIncrement(&command->refcount); +} + +static ULONG WINAPI source_async_command_Release(IUnknown *iface) +{ + struct source_async_command *command = impl_from_async_command_IUnknown(iface); + ULONG refcount = InterlockedDecrement(&command->refcount); + + if (!refcount) + { + if (command->op == SOURCE_ASYNC_START) + { + IMFPresentationDescriptor_Release(command->u.start.descriptor); + PropVariantClear(&command->u.start.position); + } + else if (command->op == SOURCE_ASYNC_REQUEST_SAMPLE) + { + if (command->u.request_sample.token) + IUnknown_Release(command->u.request_sample.token); + } + free(command); + } + + return refcount; +} + +static const IUnknownVtbl source_async_command_vtbl = +{ + source_async_command_QueryInterface, + source_async_command_AddRef, + source_async_command_Release, +}; + +static HRESULT source_create_async_op(enum source_async_op op, IUnknown **out) +{ + struct source_async_command *command; + + if (!(command = calloc(1, sizeof(*command)))) + return E_OUTOFMEMORY; + + command->IUnknown_iface.lpVtbl = &source_async_command_vtbl; + command->refcount = 1; + command->op = op; + + *out = &command->IUnknown_iface; + return S_OK; +} + +static HRESULT WINAPI callback_QueryInterface(IMFAsyncCallback *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFAsyncCallback) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFAsyncCallback_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static HRESULT WINAPI callback_GetParameters(IMFAsyncCallback *iface, + DWORD *flags, DWORD *queue) +{ + return E_NOTIMPL; +} + +static ULONG WINAPI source_async_commands_callback_AddRef(IMFAsyncCallback *iface) +{ + struct media_source *source = impl_from_async_commands_callback_IMFAsyncCallback(iface); + return IMFMediaSource_AddRef(&source->IMFMediaSource_iface); +} + +static ULONG WINAPI source_async_commands_callback_Release(IMFAsyncCallback *iface) +{ + struct media_source *source = impl_from_async_commands_callback_IMFAsyncCallback(iface); + return IMFMediaSource_Release(&source->IMFMediaSource_iface); +} + +static HRESULT stream_descriptor_get_media_type(IMFStreamDescriptor *descriptor, IMFMediaType **media_type) +{ + IMFMediaTypeHandler *handler; + HRESULT hr; + + if (FAILED(hr = IMFStreamDescriptor_GetMediaTypeHandler(descriptor, &handler))) + return hr; + hr = IMFMediaTypeHandler_GetCurrentMediaType(handler, media_type); + IMFMediaTypeHandler_Release(handler); + + return hr; +} + +static HRESULT wg_format_from_stream_descriptor(IMFStreamDescriptor *descriptor, struct wg_format *format) +{ + IMFMediaType *media_type; + HRESULT hr; + + if (FAILED(hr = stream_descriptor_get_media_type(descriptor, &media_type))) + return hr; + mf_media_type_to_wg_format(media_type, format); + IMFMediaType_Release(media_type); + + return hr; +} + +static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, wg_parser_stream_t stream, + const GUID *attr, enum wg_parser_tag tag) +{ + WCHAR *strW; + HRESULT hr; + DWORD len; + char *str; + + if (!(str = wg_parser_stream_get_tag(stream, tag)) + || !(len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0))) + hr = S_OK; + else if (!(strW = malloc(len * sizeof(*strW)))) + hr = E_OUTOFMEMORY; + else + { + if (MultiByteToWideChar(CP_UTF8, 0, str, -1, strW, len)) + hr = IMFStreamDescriptor_SetString(descriptor, attr, strW); + else + hr = E_FAIL; + free(strW); + } + + free(str); + return hr; +} + +static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *types[6], DWORD *types_count) +{ + /* Try to prefer YUV formats over RGB ones. Most decoders output in the + * YUV color space, and it's generally much less expensive for + * videoconvert to do YUV -> YUV transformations. */ + static const enum wg_video_format video_formats[] = + { + WG_VIDEO_FORMAT_NV12, + WG_VIDEO_FORMAT_YV12, + WG_VIDEO_FORMAT_YUY2, + WG_VIDEO_FORMAT_I420, + }; + UINT count = *types_count, i; + GUID base_subtype; + HRESULT hr; + + if (FAILED(hr = IMFMediaType_GetGUID(types[0], &MF_MT_SUBTYPE, &base_subtype))) + return hr; + + for (i = 0; i < ARRAY_SIZE(video_formats); ++i) + { + struct wg_format new_format = *format; + IMFMediaType *new_type; + + new_format.u.video.format = video_formats[i]; + + if (!(new_type = mf_media_type_from_wg_format(&new_format))) + { + hr = E_OUTOFMEMORY; + goto done; + } + types[count++] = new_type; + + if (video_formats[i] == WG_VIDEO_FORMAT_I420) + { + IMFMediaType *iyuv_type; + + if (FAILED(hr = MFCreateMediaType(&iyuv_type))) + goto done; + if (FAILED(hr = IMFMediaType_CopyAllItems(new_type, (IMFAttributes *)iyuv_type))) + goto done; + if (FAILED(hr = IMFMediaType_SetGUID(iyuv_type, &MF_MT_SUBTYPE, &MFVideoFormat_IYUV))) + goto done; + types[count++] = iyuv_type; + } + } + +done: + *types_count = count; + return hr; +} + +static HRESULT init_audio_media_types(struct wg_format *format, IMFMediaType *types[6], DWORD *types_count) +{ + /* Expose at least one PCM and one floating point type for the + consumer to pick from. */ + static const enum wg_audio_format audio_types[] = + { + WG_AUDIO_FORMAT_S16LE, + WG_AUDIO_FORMAT_F32LE, + }; + UINT count = *types_count, i; + + for (i = 0; i < ARRAY_SIZE(audio_types); i++) + { + struct wg_format new_format = *format; + if (new_format.u.audio.format == audio_types[i]) + continue; + new_format.u.audio.format = audio_types[i]; + if ((types[count] = mf_media_type_from_wg_format(&new_format))) + count++; + } + + *types_count = count; + return S_OK; +} + +static HRESULT stream_descriptor_create(UINT32 id, struct wg_format *format, IMFStreamDescriptor **out) +{ + IMFStreamDescriptor *descriptor; + IMFMediaTypeHandler *handler; + IMFMediaType *types[6]; + DWORD count = 0; + HRESULT hr; + + if (!(types[0] = mf_media_type_from_wg_format(format))) + return MF_E_INVALIDMEDIATYPE; + count = 1; + + if (format->major_type == WG_MAJOR_TYPE_VIDEO) + { + if (FAILED(hr = init_video_media_types(format, types, &count))) + goto done; + } + else if (format->major_type == WG_MAJOR_TYPE_AUDIO) + { + if (FAILED(hr = init_audio_media_types(format, types, &count))) + goto done; + } + + assert(count <= ARRAY_SIZE(types)); + + if (FAILED(hr = MFCreateStreamDescriptor(id, count, types, &descriptor))) + goto done; + + if (FAILED(hr = IMFStreamDescriptor_GetMediaTypeHandler(descriptor, &handler))) + IMFStreamDescriptor_Release(descriptor); + else + { + hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, types[0]); + IMFMediaTypeHandler_Release(handler); + } + +done: + while (count--) + IMFMediaType_Release(types[count]); + *out = SUCCEEDED(hr) ? descriptor : NULL; + return hr; +} + +static BOOL enqueue_token(struct media_stream *stream, IUnknown *token) +{ + if (stream->token_queue_count == stream->token_queue_cap) + { + IUnknown **buf; + stream->token_queue_cap = stream->token_queue_cap * 2 + 1; + buf = realloc(stream->token_queue, stream->token_queue_cap * sizeof(*buf)); + if (buf) + stream->token_queue = buf; + else + { + stream->token_queue_cap = stream->token_queue_count; + return FALSE; + } + } + stream->token_queue[stream->token_queue_count++] = token; + return TRUE; +} + +static void flush_token_queue(struct media_stream *stream, BOOL send) +{ + struct media_source *source = impl_from_IMFMediaSource(stream->media_source); + LONG i; + + for (i = 0; i < stream->token_queue_count; i++) + { + if (send) + { + IUnknown *op; + HRESULT hr; + + if (SUCCEEDED(hr = source_create_async_op(SOURCE_ASYNC_REQUEST_SAMPLE, &op))) + { + struct source_async_command *command = impl_from_async_command_IUnknown(op); + command->u.request_sample.stream = stream; + command->u.request_sample.token = stream->token_queue[i]; + + hr = MFPutWorkItem(source->async_commands_queue, &source->async_commands_callback, op); + IUnknown_Release(op); + } + if (FAILED(hr)) + WARN("Could not enqueue sample request, hr %#lx\n", hr); + } + else if (stream->token_queue[i]) + IUnknown_Release(stream->token_queue[i]); + } + free(stream->token_queue); + stream->token_queue = NULL; + stream->token_queue_count = 0; + stream->token_queue_cap = 0; +} + +static HRESULT media_stream_start(struct media_stream *stream, BOOL active, BOOL seeking, const PROPVARIANT *position) +{ + struct media_source *source = impl_from_IMFMediaSource(stream->media_source); + struct wg_format format; + HRESULT hr; + + TRACE("source %p, stream %p\n", source, stream); + + if (FAILED(hr = wg_format_from_stream_descriptor(stream->descriptor, &format))) + WARN("Failed to get wg_format from stream descriptor, hr %#lx\n", hr); + wg_parser_stream_enable(stream->wg_stream, &format, 0); + + if (FAILED(hr = IMFMediaEventQueue_QueueEventParamUnk(source->event_queue, active ? MEUpdatedStream : MENewStream, + &GUID_NULL, S_OK, (IUnknown *)&stream->IMFMediaStream_iface))) + WARN("Failed to send source stream event, hr %#lx\n", hr); + return IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, seeking ? MEStreamSeeked : MEStreamStarted, + &GUID_NULL, S_OK, position); +} + +static HRESULT media_source_start(struct media_source *source, IMFPresentationDescriptor *descriptor, + GUID *format, PROPVARIANT *position) +{ + BOOL starting = source->state == SOURCE_STOPPED, seek_message = !starting && position->vt != VT_EMPTY; + IMFStreamDescriptor **descriptors; + DWORD i, count; + HRESULT hr; + + TRACE("source %p, descriptor %p, format %s, position %s\n", source, descriptor, + debugstr_guid(format), wine_dbgstr_variant((VARIANT *)position)); + + if (source->state == SOURCE_SHUTDOWN) + return MF_E_SHUTDOWN; + + /* seek to beginning on stop->play */ + if (source->state == SOURCE_STOPPED && position->vt == VT_EMPTY) + { + position->vt = VT_I8; + position->hVal.QuadPart = 0; + } + + if (!(descriptors = calloc(source->stream_count, sizeof(*descriptors)))) + return E_OUTOFMEMORY; + + if (FAILED(hr = IMFPresentationDescriptor_GetStreamDescriptorCount(descriptor, &count))) + WARN("Failed to get presentation descriptor stream count, hr %#lx\n", hr); + + for (i = 0; i < count; i++) + { + IMFStreamDescriptor *stream_descriptor; + BOOL selected; + DWORD id; + + if (FAILED(hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(descriptor, i, + &selected, &stream_descriptor))) + WARN("Failed to get presentation stream descriptor, hr %#lx\n", hr); + else + { + if (FAILED(hr = IMFStreamDescriptor_GetStreamIdentifier(stream_descriptor, &id))) + WARN("Failed to get stream descriptor id, hr %#lx\n", hr); + else if (id >= source->stream_count) + WARN("Invalid stream descriptor id %lu, hr %#lx\n", id, hr); + else if (selected) + IMFStreamDescriptor_AddRef((descriptors[id] = stream_descriptor)); + + IMFStreamDescriptor_Release(stream_descriptor); + } + } + + for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + BOOL was_active = !starting && stream->active; + + if (position->vt != VT_EMPTY) + stream->eos = FALSE; + + if (!(stream->active = !!descriptors[i])) + wg_parser_stream_disable(stream->wg_stream); + else + { + if (FAILED(hr = media_stream_start(stream, was_active, seek_message, position))) + WARN("Failed to start media stream, hr %#lx\n", hr); + IMFStreamDescriptor_Release(descriptors[i]); + } + } + + free(descriptors); + + source->state = SOURCE_RUNNING; + + if (position->vt == VT_I8) + wg_parser_stream_seek(source->streams[0]->wg_stream, 1.0, position->hVal.QuadPart, 0, + AM_SEEKING_AbsolutePositioning, AM_SEEKING_NoPositioning); + + for (i = 0; i < source->stream_count; i++) + flush_token_queue(source->streams[i], position->vt == VT_EMPTY); + + return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, + seek_message ? MESourceSeeked : MESourceStarted, &GUID_NULL, S_OK, position); +} + +static HRESULT media_source_pause(struct media_source *source) +{ + unsigned int i; + HRESULT hr; + + TRACE("source %p\n", source); + + if (source->state == SOURCE_SHUTDOWN) + return MF_E_SHUTDOWN; + + for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + if (stream->active && FAILED(hr = IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamPaused, + &GUID_NULL, S_OK, NULL))) + WARN("Failed to queue MEStreamPaused event, hr %#lx\n", hr); + } + + source->state = SOURCE_PAUSED; + return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourcePaused, &GUID_NULL, S_OK, NULL); +} + +static HRESULT media_source_stop(struct media_source *source) +{ + unsigned int i; + HRESULT hr; + + TRACE("source %p\n", source); + + if (source->state == SOURCE_SHUTDOWN) + return MF_E_SHUTDOWN; + + for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + if (stream->active && FAILED(hr = IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamStopped, + &GUID_NULL, S_OK, NULL))) + WARN("Failed to queue MEStreamStopped event, hr %#lx\n", hr); + } + + source->state = SOURCE_STOPPED; + + for (i = 0; i < source->stream_count; i++) + flush_token_queue(source->streams[i], FALSE); + + return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceStopped, &GUID_NULL, S_OK, NULL); +} + +static HRESULT media_stream_send_sample(struct media_stream *stream, const struct wg_parser_buffer *wg_buffer, IUnknown *token) +{ + IMFSample *sample = NULL; + IMFMediaBuffer *buffer; + HRESULT hr; + BYTE *data; + + if (FAILED(hr = MFCreateMemoryBuffer(wg_buffer->size, &buffer))) + return hr; + if (FAILED(hr = IMFMediaBuffer_SetCurrentLength(buffer, wg_buffer->size))) + goto out; + if (FAILED(hr = IMFMediaBuffer_Lock(buffer, &data, NULL, NULL))) + goto out; + + if (!wg_parser_stream_copy_buffer(stream->wg_stream, data, 0, wg_buffer->size)) + { + wg_parser_stream_release_buffer(stream->wg_stream); + IMFMediaBuffer_Unlock(buffer); + goto out; + } + wg_parser_stream_release_buffer(stream->wg_stream); + + if (FAILED(hr = IMFMediaBuffer_Unlock(buffer))) + goto out; + + if (FAILED(hr = MFCreateSample(&sample))) + goto out; + if (FAILED(hr = IMFSample_AddBuffer(sample, buffer))) + goto out; + if (FAILED(hr = IMFSample_SetSampleTime(sample, wg_buffer->pts))) + goto out; + if (FAILED(hr = IMFSample_SetSampleDuration(sample, wg_buffer->duration))) + goto out; + if (token && FAILED(hr = IMFSample_SetUnknown(sample, &MFSampleExtension_Token, token))) + goto out; + + hr = IMFMediaEventQueue_QueueEventParamUnk(stream->event_queue, MEMediaSample, + &GUID_NULL, S_OK, (IUnknown *)sample); + +out: + if (sample) + IMFSample_Release(sample); + IMFMediaBuffer_Release(buffer); + return hr; +} + +static HRESULT media_stream_send_eos(struct media_source *source, struct media_stream *stream) +{ + PROPVARIANT empty = {.vt = VT_EMPTY}; + HRESULT hr; + UINT i; + + TRACE("source %p, stream %p\n", source, stream); + + stream->eos = TRUE; + if (FAILED(hr = IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEEndOfStream, &GUID_NULL, S_OK, &empty))) + WARN("Failed to queue MEEndOfStream event, hr %#lx\n", hr); + + for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + if (stream->active && !stream->eos) + return S_OK; + } + + if (FAILED(hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MEEndOfPresentation, &GUID_NULL, S_OK, &empty))) + WARN("Failed to queue MEEndOfPresentation event, hr %#lx\n", hr); + return S_OK; +} + +static HRESULT wait_on_sample(struct media_stream *stream, IUnknown *token) +{ + struct media_source *source = impl_from_IMFMediaSource(stream->media_source); + struct wg_parser_buffer buffer; + + TRACE("%p, %p\n", stream, token); + + if (wg_parser_stream_get_buffer(source->wg_parser, stream->wg_stream, &buffer)) + return media_stream_send_sample(stream, &buffer, token); + + return media_stream_send_eos(source, stream); +} + +static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) +{ + struct media_source *source = impl_from_async_commands_callback_IMFAsyncCallback(iface); + struct source_async_command *command; + IUnknown *state; + HRESULT hr; + + if (FAILED(hr = IMFAsyncResult_GetState(result, &state))) + return hr; + + EnterCriticalSection(&source->cs); + + command = impl_from_async_command_IUnknown(state); + switch (command->op) + { + case SOURCE_ASYNC_START: + { + IMFPresentationDescriptor *descriptor = command->u.start.descriptor; + GUID format = command->u.start.format; + PROPVARIANT position = command->u.start.position; + + if (FAILED(hr = media_source_start(source, descriptor, &format, &position))) + WARN("Failed to start source %p, hr %#lx\n", source, hr); + break; + } + case SOURCE_ASYNC_PAUSE: + if (FAILED(hr = media_source_pause(source))) + WARN("Failed to pause source %p, hr %#lx\n", source, hr); + break; + case SOURCE_ASYNC_STOP: + if (FAILED(hr = media_source_stop(source))) + WARN("Failed to stop source %p, hr %#lx\n", source, hr); + break; + case SOURCE_ASYNC_REQUEST_SAMPLE: + if (source->state == SOURCE_PAUSED) + enqueue_token(command->u.request_sample.stream, command->u.request_sample.token); + else if (source->state == SOURCE_RUNNING) + { + if (FAILED(hr = wait_on_sample(command->u.request_sample.stream, command->u.request_sample.token))) + WARN("Failed to request sample, hr %#lx\n", hr); + } + break; + } + + LeaveCriticalSection(&source->cs); + + IUnknown_Release(state); + + return S_OK; +} + +static const IMFAsyncCallbackVtbl source_async_commands_callback_vtbl = +{ + callback_QueryInterface, + source_async_commands_callback_AddRef, + source_async_commands_callback_Release, + callback_GetParameters, + source_async_commands_Invoke, +}; + +static DWORD CALLBACK read_thread(void *arg) +{ + struct media_source *source = arg; + IMFByteStream *byte_stream = source->byte_stream; + size_t buffer_size = 4096; + QWORD file_size; + void *data; + + if (!(data = malloc(buffer_size))) + return 0; + + IMFByteStream_GetLength(byte_stream, &file_size); + + TRACE("Starting read thread for media source %p.\n", source); + + while (!source->read_thread_shutdown) + { + uint64_t offset; + ULONG ret_size; + uint32_t size; + HRESULT hr; + + if (!wg_parser_get_next_read_offset(source->wg_parser, &offset, &size)) + continue; + + if (offset >= file_size) + size = 0; + else if (offset + size >= file_size) + size = file_size - offset; + + /* Some IMFByteStreams (including the standard file-based stream) return + * an error when reading past the file size. */ + if (!size) + { + wg_parser_push_data(source->wg_parser, data, 0); + continue; + } + + if (!array_reserve(&data, &buffer_size, size, 1)) + { + free(data); + return 0; + } + + ret_size = 0; + + if (SUCCEEDED(hr = IMFByteStream_SetCurrentPosition(byte_stream, offset))) + hr = IMFByteStream_Read(byte_stream, data, size, &ret_size); + if (FAILED(hr)) + ERR("Failed to read %u bytes at offset %I64u, hr %#lx.\n", size, offset, hr); + else if (ret_size != size) + ERR("Unexpected short read: requested %u bytes, got %lu.\n", size, ret_size); + wg_parser_push_data(source->wg_parser, SUCCEEDED(hr) ? data : NULL, ret_size); + } + + free(data); + TRACE("Media source is shutting down; exiting.\n"); + return 0; +} + +static HRESULT WINAPI media_stream_QueryInterface(IMFMediaStream *iface, REFIID riid, void **out) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualIID(riid, &IID_IMFMediaStream) || + IsEqualIID(riid, &IID_IMFMediaEventGenerator) || + IsEqualIID(riid, &IID_IUnknown)) + { + *out = &stream->IMFMediaStream_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI media_stream_AddRef(IMFMediaStream *iface) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + ULONG ref = InterlockedIncrement(&stream->ref); + + TRACE("%p, refcount %lu.\n", iface, ref); + + return ref; +} + +static ULONG WINAPI media_stream_Release(IMFMediaStream *iface) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + ULONG ref = InterlockedDecrement(&stream->ref); + + TRACE("%p, refcount %lu.\n", iface, ref); + + if (!ref) + { + IMFMediaSource_Release(stream->media_source); + IMFStreamDescriptor_Release(stream->descriptor); + IMFMediaEventQueue_Release(stream->event_queue); + flush_token_queue(stream, FALSE); + free(stream); + } + + return ref; +} + +static HRESULT WINAPI media_stream_GetEvent(IMFMediaStream *iface, DWORD flags, IMFMediaEvent **event) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + + TRACE("%p, %#lx, %p.\n", iface, flags, event); + + return IMFMediaEventQueue_GetEvent(stream->event_queue, flags, event); +} + +static HRESULT WINAPI media_stream_BeginGetEvent(IMFMediaStream *iface, IMFAsyncCallback *callback, IUnknown *state) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + + TRACE("%p, %p, %p.\n", iface, callback, state); + + return IMFMediaEventQueue_BeginGetEvent(stream->event_queue, callback, state); +} + +static HRESULT WINAPI media_stream_EndGetEvent(IMFMediaStream *iface, IMFAsyncResult *result, IMFMediaEvent **event) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + + TRACE("%p, %p, %p.\n", stream, result, event); + + return IMFMediaEventQueue_EndGetEvent(stream->event_queue, result, event); +} + +static HRESULT WINAPI media_stream_QueueEvent(IMFMediaStream *iface, MediaEventType event_type, REFGUID ext_type, + HRESULT hr, const PROPVARIANT *value) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + + TRACE("%p, %lu, %s, %#lx, %p.\n", iface, event_type, debugstr_guid(ext_type), hr, value); + + return IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, event_type, ext_type, hr, value); +} + +static HRESULT WINAPI media_stream_GetMediaSource(IMFMediaStream *iface, IMFMediaSource **out) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + struct media_source *source = impl_from_IMFMediaSource(stream->media_source); + HRESULT hr = S_OK; + + TRACE("%p, %p.\n", iface, out); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else + { + IMFMediaSource_AddRef(&source->IMFMediaSource_iface); + *out = &source->IMFMediaSource_iface; + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static HRESULT WINAPI media_stream_GetStreamDescriptor(IMFMediaStream* iface, IMFStreamDescriptor **descriptor) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + struct media_source *source = impl_from_IMFMediaSource(stream->media_source); + HRESULT hr = S_OK; + + TRACE("%p, %p.\n", iface, descriptor); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else + { + IMFStreamDescriptor_AddRef(stream->descriptor); + *descriptor = stream->descriptor; + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static HRESULT WINAPI media_stream_RequestSample(IMFMediaStream *iface, IUnknown *token) +{ + struct media_stream *stream = impl_from_IMFMediaStream(iface); + struct media_source *source = impl_from_IMFMediaSource(stream->media_source); + IUnknown *op; + HRESULT hr; + + TRACE("%p, %p.\n", iface, token); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else if (!stream->active) + hr = MF_E_MEDIA_SOURCE_WRONGSTATE; + else if (stream->eos) + hr = MF_E_END_OF_STREAM; + else if (SUCCEEDED(hr = source_create_async_op(SOURCE_ASYNC_REQUEST_SAMPLE, &op))) + { + struct source_async_command *command = impl_from_async_command_IUnknown(op); + command->u.request_sample.stream = stream; + if (token) + IUnknown_AddRef(token); + command->u.request_sample.token = token; + + hr = MFPutWorkItem(source->async_commands_queue, &source->async_commands_callback, op); + IUnknown_Release(op); + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static const IMFMediaStreamVtbl media_stream_vtbl = +{ + media_stream_QueryInterface, + media_stream_AddRef, + media_stream_Release, + media_stream_GetEvent, + media_stream_BeginGetEvent, + media_stream_EndGetEvent, + media_stream_QueueEvent, + media_stream_GetMediaSource, + media_stream_GetStreamDescriptor, + media_stream_RequestSample +}; + +static HRESULT media_stream_create(IMFMediaSource *source, IMFStreamDescriptor *descriptor, + wg_parser_stream_t wg_stream, struct media_stream **out) +{ + struct media_stream *object; + HRESULT hr; + + TRACE("source %p, descriptor %p, wg_stream %#I64x.\n", source, descriptor, wg_stream); + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IMFMediaStream_iface.lpVtbl = &media_stream_vtbl; + object->ref = 1; + + if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) + { + free(object); + return hr; + } + + IMFMediaSource_AddRef(source); + object->media_source = source; + IMFStreamDescriptor_AddRef(descriptor); + object->descriptor = descriptor; + + object->active = TRUE; + object->eos = FALSE; + object->wg_stream = wg_stream; + + TRACE("Created stream object %p.\n", object); + + *out = object; + return S_OK; +} + +static HRESULT WINAPI media_source_get_service_QueryInterface(IMFGetService *iface, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFGetService(iface); + return IMFMediaSource_QueryInterface(&source->IMFMediaSource_iface, riid, obj); +} + +static ULONG WINAPI media_source_get_service_AddRef(IMFGetService *iface) +{ + struct media_source *source = impl_from_IMFGetService(iface); + return IMFMediaSource_AddRef(&source->IMFMediaSource_iface); +} + +static ULONG WINAPI media_source_get_service_Release(IMFGetService *iface) +{ + struct media_source *source = impl_from_IMFGetService(iface); + return IMFMediaSource_Release(&source->IMFMediaSource_iface); +} + +static HRESULT WINAPI media_source_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFGetService(iface); + + TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualGUID(service, &MF_RATE_CONTROL_SERVICE)) + { + if (IsEqualIID(riid, &IID_IMFRateSupport)) + { + *obj = &source->IMFRateSupport_iface; + } + else if (IsEqualIID(riid, &IID_IMFRateControl)) + { + *obj = &source->IMFRateControl_iface; + } + } + else + FIXME("Unsupported service %s.\n", debugstr_guid(service)); + + if (*obj) + IUnknown_AddRef((IUnknown *)*obj); + + return *obj ? S_OK : E_NOINTERFACE; +} + +static const IMFGetServiceVtbl media_source_get_service_vtbl = +{ + media_source_get_service_QueryInterface, + media_source_get_service_AddRef, + media_source_get_service_Release, + media_source_get_service_GetService, +}; + +static HRESULT WINAPI media_source_rate_support_QueryInterface(IMFRateSupport *iface, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFRateSupport(iface); + return IMFMediaSource_QueryInterface(&source->IMFMediaSource_iface, riid, obj); +} + +static ULONG WINAPI media_source_rate_support_AddRef(IMFRateSupport *iface) +{ + struct media_source *source = impl_from_IMFRateSupport(iface); + return IMFMediaSource_AddRef(&source->IMFMediaSource_iface); +} + +static ULONG WINAPI media_source_rate_support_Release(IMFRateSupport *iface) +{ + struct media_source *source = impl_from_IMFRateSupport(iface); + return IMFMediaSource_Release(&source->IMFMediaSource_iface); +} + +static HRESULT WINAPI media_source_rate_support_GetSlowestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate) +{ + TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate); + + *rate = 0.0f; + + return S_OK; +} + +static HRESULT WINAPI media_source_rate_support_GetFastestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate) +{ + TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate); + + *rate = direction == MFRATE_FORWARD ? 1e6f : -1e6f; + + return S_OK; +} + +static HRESULT WINAPI media_source_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, + float *nearest_rate) +{ + TRACE("%p, %d, %f, %p.\n", iface, thin, rate, nearest_rate); + + if (nearest_rate) + *nearest_rate = rate; + + return rate >= -1e6f && rate <= 1e6f ? S_OK : MF_E_UNSUPPORTED_RATE; +} + +static const IMFRateSupportVtbl media_source_rate_support_vtbl = +{ + media_source_rate_support_QueryInterface, + media_source_rate_support_AddRef, + media_source_rate_support_Release, + media_source_rate_support_GetSlowestRate, + media_source_rate_support_GetFastestRate, + media_source_rate_support_IsRateSupported, +}; + +static HRESULT WINAPI media_source_rate_control_QueryInterface(IMFRateControl *iface, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFRateControl(iface); + return IMFMediaSource_QueryInterface(&source->IMFMediaSource_iface, riid, obj); +} + +static ULONG WINAPI media_source_rate_control_AddRef(IMFRateControl *iface) +{ + struct media_source *source = impl_from_IMFRateControl(iface); + return IMFMediaSource_AddRef(&source->IMFMediaSource_iface); +} + +static ULONG WINAPI media_source_rate_control_Release(IMFRateControl *iface) +{ + struct media_source *source = impl_from_IMFRateControl(iface); + return IMFMediaSource_Release(&source->IMFMediaSource_iface); +} + +static HRESULT WINAPI media_source_rate_control_SetRate(IMFRateControl *iface, BOOL thin, float rate) +{ + struct media_source *source = impl_from_IMFRateControl(iface); + HRESULT hr; + + FIXME("%p, %d, %f.\n", iface, thin, rate); + + if (rate < 0.0f) + return MF_E_REVERSE_UNSUPPORTED; + + if (thin) + return MF_E_THINNING_UNSUPPORTED; + + if (FAILED(hr = IMFRateSupport_IsRateSupported(&source->IMFRateSupport_iface, thin, rate, NULL))) + return hr; + + EnterCriticalSection(&source->cs); + source->rate = rate; + LeaveCriticalSection(&source->cs); + + return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceRateChanged, &GUID_NULL, S_OK, NULL); +} + +static HRESULT WINAPI media_source_rate_control_GetRate(IMFRateControl *iface, BOOL *thin, float *rate) +{ + struct media_source *source = impl_from_IMFRateControl(iface); + + TRACE("%p, %p, %p.\n", iface, thin, rate); + + if (thin) + *thin = FALSE; + + EnterCriticalSection(&source->cs); + *rate = source->rate; + LeaveCriticalSection(&source->cs); + + return S_OK; +} + +static const IMFRateControlVtbl media_source_rate_control_vtbl = +{ + media_source_rate_control_QueryInterface, + media_source_rate_control_AddRef, + media_source_rate_control_Release, + media_source_rate_control_SetRate, + media_source_rate_control_GetRate, +}; + +static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualIID(riid, &IID_IMFMediaSource) || + IsEqualIID(riid, &IID_IMFMediaEventGenerator) || + IsEqualIID(riid, &IID_IUnknown)) + { + *out = &source->IMFMediaSource_iface; + } + else if (IsEqualIID(riid, &IID_IMFGetService)) + { + *out = &source->IMFGetService_iface; + } + else + { + FIXME("%s, %p.\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI media_source_AddRef(IMFMediaSource *iface) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + ULONG ref = InterlockedIncrement(&source->ref); + + TRACE("%p, refcount %lu.\n", iface, ref); + + return ref; +} + +static ULONG WINAPI media_source_Release(IMFMediaSource *iface) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + ULONG ref = InterlockedDecrement(&source->ref); + + TRACE("%p, refcount %lu.\n", iface, ref); + + if (!ref) + { + IMFMediaSource_Shutdown(iface); + IMFMediaEventQueue_Release(source->event_queue); + IMFByteStream_Release(source->byte_stream); + wg_parser_destroy(source->wg_parser); + source->cs.DebugInfo->Spare[0] = 0; + DeleteCriticalSection(&source->cs); + free(source); + } + + return ref; +} + +static HRESULT WINAPI media_source_GetEvent(IMFMediaSource *iface, DWORD flags, IMFMediaEvent **event) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + + TRACE("%p, %#lx, %p.\n", iface, flags, event); + + return IMFMediaEventQueue_GetEvent(source->event_queue, flags, event); +} + +static HRESULT WINAPI media_source_BeginGetEvent(IMFMediaSource *iface, IMFAsyncCallback *callback, IUnknown *state) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + + TRACE("%p, %p, %p.\n", iface, callback, state); + + return IMFMediaEventQueue_BeginGetEvent(source->event_queue, callback, state); +} + +static HRESULT WINAPI media_source_EndGetEvent(IMFMediaSource *iface, IMFAsyncResult *result, IMFMediaEvent **event) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + + TRACE("%p, %p, %p.\n", iface, result, event); + + return IMFMediaEventQueue_EndGetEvent(source->event_queue, result, event); +} + +static HRESULT WINAPI media_source_QueueEvent(IMFMediaSource *iface, MediaEventType event_type, REFGUID ext_type, + HRESULT hr, const PROPVARIANT *value) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + + TRACE("%p, %lu, %s, %#lx, %p.\n", iface, event_type, debugstr_guid(ext_type), hr, value); + + return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, ext_type, hr, value); +} + +static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWORD *characteristics) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + HRESULT hr = S_OK; + + TRACE("%p, %p.\n", iface, characteristics); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else + *characteristics = MFMEDIASOURCE_CAN_SEEK | MFMEDIASOURCE_CAN_PAUSE; + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **descriptor) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + HRESULT hr; + UINT i; + + TRACE("%p, %p.\n", iface, descriptor); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else if (SUCCEEDED(hr = MFCreatePresentationDescriptor(source->stream_count, source->descriptors, descriptor))) + { + if (FAILED(hr = IMFPresentationDescriptor_SetUINT64(*descriptor, &MF_PD_DURATION, source->duration))) + WARN("Failed to set presentation descriptor MF_PD_DURATION, hr %#lx\n", hr); + + for (i = 0; i < source->stream_count; ++i) + { + if (FAILED(hr = IMFPresentationDescriptor_SelectStream(*descriptor, i))) + WARN("Failed to select stream %u, hr %#lx\n", i, hr); + } + + hr = S_OK; + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *descriptor, + const GUID *time_format, const PROPVARIANT *position) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + IUnknown *op; + HRESULT hr; + + TRACE("%p, %p, %p, %p.\n", iface, descriptor, time_format, position); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else if (!(IsEqualIID(time_format, &GUID_NULL))) + hr = MF_E_UNSUPPORTED_TIME_FORMAT; + else if (SUCCEEDED(hr = source_create_async_op(SOURCE_ASYNC_START, &op))) + { + struct source_async_command *command = impl_from_async_command_IUnknown(op); + command->u.start.descriptor = descriptor; + IMFPresentationDescriptor_AddRef(descriptor); + command->u.start.format = *time_format; + PropVariantCopy(&command->u.start.position, position); + + hr = MFPutWorkItem(source->async_commands_queue, &source->async_commands_callback, op); + IUnknown_Release(op); + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static HRESULT WINAPI media_source_Stop(IMFMediaSource *iface) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + IUnknown *op; + HRESULT hr; + + TRACE("%p.\n", iface); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else if (SUCCEEDED(hr = source_create_async_op(SOURCE_ASYNC_STOP, &op))) + { + hr = MFPutWorkItem(source->async_commands_queue, &source->async_commands_callback, op); + IUnknown_Release(op); + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static HRESULT WINAPI media_source_Pause(IMFMediaSource *iface) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + IUnknown *op; + HRESULT hr; + + TRACE("%p.\n", iface); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + hr = MF_E_SHUTDOWN; + else if (source->state != SOURCE_RUNNING) + hr = MF_E_INVALID_STATE_TRANSITION; + else if (SUCCEEDED(hr = source_create_async_op(SOURCE_ASYNC_PAUSE, &op))) + { + hr = MFPutWorkItem(source->async_commands_queue, &source->async_commands_callback, op); + IUnknown_Release(op); + } + + LeaveCriticalSection(&source->cs); + + return S_OK; +} + +static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) +{ + struct media_source *source = impl_from_IMFMediaSource(iface); + + TRACE("%p.\n", iface); + + EnterCriticalSection(&source->cs); + + if (source->state == SOURCE_SHUTDOWN) + { + LeaveCriticalSection(&source->cs); + return MF_E_SHUTDOWN; + } + + source->state = SOURCE_SHUTDOWN; + + wg_parser_disconnect(source->wg_parser); + + source->read_thread_shutdown = true; + WaitForSingleObject(source->read_thread, INFINITE); + CloseHandle(source->read_thread); + + IMFMediaEventQueue_Shutdown(source->event_queue); + IMFByteStream_Close(source->byte_stream); + + while (source->stream_count--) + { + struct media_stream *stream = source->streams[source->stream_count]; + IMFStreamDescriptor_Release(source->descriptors[source->stream_count]); + IMFMediaEventQueue_Shutdown(stream->event_queue); + IMFMediaStream_Release(&stream->IMFMediaStream_iface); + } + free(source->descriptors); + free(source->streams); + + LeaveCriticalSection(&source->cs); + + MFUnlockWorkQueue(source->async_commands_queue); + + return S_OK; +} + +static const IMFMediaSourceVtbl IMFMediaSource_vtbl = +{ + media_source_QueryInterface, + media_source_AddRef, + media_source_Release, + media_source_GetEvent, + media_source_BeginGetEvent, + media_source_EndGetEvent, + media_source_QueueEvent, + media_source_GetCharacteristics, + media_source_CreatePresentationDescriptor, + media_source_Start, + media_source_Stop, + media_source_Pause, + media_source_Shutdown, +}; + +static void media_source_init_descriptors(struct media_source *source) +{ + HRESULT hr = S_OK; + UINT i; + + for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + IMFStreamDescriptor *descriptor = stream->descriptor; + + if (FAILED(hr = stream_descriptor_set_tag(descriptor, stream->wg_stream, + &MF_SD_LANGUAGE, WG_PARSER_TAG_LANGUAGE))) + WARN("Failed to set stream descriptor language, hr %#lx\n", hr); + if (FAILED(hr = stream_descriptor_set_tag(descriptor, stream->wg_stream, + &MF_SD_STREAM_NAME, WG_PARSER_TAG_NAME))) + WARN("Failed to set stream descriptor name, hr %#lx\n", hr); + } +} + +static HRESULT media_source_create(struct object_context *context, IMFMediaSource **out) +{ + unsigned int stream_count = UINT_MAX; + struct media_source *object; + wg_parser_t parser; + unsigned int i; + HRESULT hr; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; + object->IMFGetService_iface.lpVtbl = &media_source_get_service_vtbl; + object->IMFRateSupport_iface.lpVtbl = &media_source_rate_support_vtbl; + object->IMFRateControl_iface.lpVtbl = &media_source_rate_control_vtbl; + object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl; + object->ref = 1; + object->byte_stream = context->stream; + IMFByteStream_AddRef(context->stream); + object->file_size = context->file_size; + object->rate = 1.0f; + InitializeCriticalSection(&object->cs); + object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); + + if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) + goto fail; + + if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue))) + goto fail; + + if (!(parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE, FALSE))) + { + hr = E_OUTOFMEMORY; + goto fail; + } + object->wg_parser = parser; + + object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL); + + object->state = SOURCE_OPENING; + + if (FAILED(hr = wg_parser_connect(parser, object->file_size, NULL))) + goto fail; + + stream_count = wg_parser_get_stream_count(parser); + + if (!(object->descriptors = calloc(stream_count, sizeof(*object->descriptors))) + || !(object->streams = calloc(stream_count, sizeof(*object->streams)))) + { + hr = E_OUTOFMEMORY; + goto fail; + } + + for (i = 0; i < stream_count; ++i) + { + wg_parser_stream_t wg_stream = wg_parser_get_stream(object->wg_parser, i); + IMFStreamDescriptor *descriptor; + struct media_stream *stream; + struct wg_format format; + + wg_parser_stream_get_preferred_format(wg_stream, &format); + if (FAILED(hr = stream_descriptor_create(i, &format, &descriptor))) + goto fail; + if (FAILED(hr = media_stream_create(&object->IMFMediaSource_iface, descriptor, wg_stream, &stream))) + { + IMFStreamDescriptor_Release(descriptor); + goto fail; + } + + object->duration = max(object->duration, wg_parser_stream_get_duration(wg_stream)); + IMFStreamDescriptor_AddRef(descriptor); + object->descriptors[i] = descriptor; + object->streams[i] = stream; + object->stream_count++; + } + + media_source_init_descriptors(object); + object->state = SOURCE_STOPPED; + + *out = &object->IMFMediaSource_iface; + TRACE("Created IMFMediaSource %p\n", *out); + return S_OK; + +fail: + WARN("Failed to construct MFMediaSource, hr %#lx.\n", hr); + + while (object->streams && object->stream_count--) + { + struct media_stream *stream = object->streams[object->stream_count]; + IMFStreamDescriptor_Release(object->descriptors[object->stream_count]); + IMFMediaStream_Release(&stream->IMFMediaStream_iface); + } + free(object->descriptors); + free(object->streams); + + if (stream_count != UINT_MAX) + wg_parser_disconnect(object->wg_parser); + if (object->read_thread) + { + object->read_thread_shutdown = true; + WaitForSingleObject(object->read_thread, INFINITE); + CloseHandle(object->read_thread); + } + if (object->wg_parser) + wg_parser_destroy(object->wg_parser); + if (object->async_commands_queue) + MFUnlockWorkQueue(object->async_commands_queue); + if (object->event_queue) + IMFMediaEventQueue_Release(object->event_queue); + IMFByteStream_Release(object->byte_stream); + free(object); + return hr; +} + +struct result_entry +{ + struct list entry; + IMFAsyncResult *result; + MF_OBJECT_TYPE type; + IUnknown *object; +}; + +static HRESULT result_entry_create(IMFAsyncResult *result, MF_OBJECT_TYPE type, + IUnknown *object, struct result_entry **out) +{ + struct result_entry *entry; + + if (!(entry = malloc(sizeof(*entry)))) + return E_OUTOFMEMORY; + + entry->result = result; + IMFAsyncResult_AddRef(entry->result); + entry->object = object; + IUnknown_AddRef(entry->object); + entry->type = type; + + *out = entry; + return S_OK; +} + +static void result_entry_destroy(struct result_entry *entry) +{ + IMFAsyncResult_Release(entry->result); + IUnknown_Release(entry->object); + free(entry); +} + +struct stream_handler +{ + IMFByteStreamHandler IMFByteStreamHandler_iface; + IMFAsyncCallback IMFAsyncCallback_iface; + LONG refcount; + struct list results; + CRITICAL_SECTION cs; +}; + +static struct result_entry *handler_find_result_entry(struct stream_handler *handler, IMFAsyncResult *result) +{ + struct result_entry *entry; + + EnterCriticalSection(&handler->cs); + LIST_FOR_EACH_ENTRY(entry, &handler->results, struct result_entry, entry) + { + if (result == entry->result) + { + list_remove(&entry->entry); + LeaveCriticalSection(&handler->cs); + return entry; + } + } + LeaveCriticalSection(&handler->cs); + + return NULL; +} + +static struct stream_handler *impl_from_IMFByteStreamHandler(IMFByteStreamHandler *iface) +{ + return CONTAINING_RECORD(iface, struct stream_handler, IMFByteStreamHandler_iface); +} + +static struct stream_handler *impl_from_IMFAsyncCallback(IMFAsyncCallback *iface) +{ + return CONTAINING_RECORD(iface, struct stream_handler, IMFAsyncCallback_iface); +} + +static HRESULT WINAPI stream_handler_QueryInterface(IMFByteStreamHandler *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFByteStreamHandler) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFByteStreamHandler_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI stream_handler_AddRef(IMFByteStreamHandler *iface) +{ + struct stream_handler *handler = impl_from_IMFByteStreamHandler(iface); + ULONG refcount = InterlockedIncrement(&handler->refcount); + + TRACE("%p, refcount %lu.\n", handler, refcount); + + return refcount; +} + +static ULONG WINAPI stream_handler_Release(IMFByteStreamHandler *iface) +{ + struct stream_handler *handler = impl_from_IMFByteStreamHandler(iface); + ULONG refcount = InterlockedDecrement(&handler->refcount); + struct result_entry *result, *next; + + TRACE("%p, refcount %lu.\n", iface, refcount); + + if (!refcount) + { + LIST_FOR_EACH_ENTRY_SAFE(result, next, &handler->results, struct result_entry, entry) + result_entry_destroy(result); + DeleteCriticalSection(&handler->cs); + free(handler); + } + + return refcount; +} + +static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *iface, IMFByteStream *stream, const WCHAR *url, DWORD flags, + IPropertyStore *props, IUnknown **cancel_cookie, IMFAsyncCallback *callback, IUnknown *state) +{ + struct stream_handler *handler = impl_from_IMFByteStreamHandler(iface); + IMFAsyncResult *result; + IUnknown *context; + QWORD file_size; + HRESULT hr; + DWORD caps; + + TRACE("%p, %s, %#lx, %p, %p, %p, %p.\n", iface, debugstr_w(url), flags, props, cancel_cookie, callback, state); + + if (cancel_cookie) + *cancel_cookie = NULL; + + if (!stream) + return E_INVALIDARG; + if (flags != MF_RESOLUTION_MEDIASOURCE) + FIXME("Unimplemented flags %#lx\n", flags); + + if (FAILED(hr = IMFByteStream_GetCapabilities(stream, &caps))) + return hr; + if (!(caps & MFBYTESTREAM_IS_SEEKABLE)) + { + FIXME("Non-seekable bytestreams not supported.\n"); + return MF_E_BYTESTREAM_NOT_SEEKABLE; + } + if (FAILED(hr = IMFByteStream_GetLength(stream, &file_size))) + { + FIXME("Failed to get byte stream length, hr %#lx.\n", hr); + return hr; + } + + if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &result))) + return hr; + if (FAILED(hr = object_context_create(flags, stream, url, file_size, result, &context))) + { + IMFAsyncResult_Release(result); + return hr; + } + + hr = MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_IO, &handler->IMFAsyncCallback_iface, context); + IUnknown_Release(context); + + if (SUCCEEDED(hr) && cancel_cookie) + { + *cancel_cookie = (IUnknown *)result; + IUnknown_AddRef(*cancel_cookie); + } + + IMFAsyncResult_Release(result); + + return hr; +} + +static HRESULT WINAPI stream_handler_EndCreateObject(IMFByteStreamHandler *iface, IMFAsyncResult *result, + MF_OBJECT_TYPE *type, IUnknown **object) +{ + struct stream_handler *handler = impl_from_IMFByteStreamHandler(iface); + struct result_entry *entry; + HRESULT hr; + + TRACE("%p, %p, %p, %p.\n", iface, result, type, object); + + if (!(entry = handler_find_result_entry(handler, result))) + { + *type = MF_OBJECT_INVALID; + *object = NULL; + return MF_E_UNEXPECTED; + } + + hr = IMFAsyncResult_GetStatus(entry->result); + *type = entry->type; + *object = entry->object; + IUnknown_AddRef(*object); + result_entry_destroy(entry); + return hr; +} + +static HRESULT WINAPI stream_handler_CancelObjectCreation(IMFByteStreamHandler *iface, IUnknown *cookie) +{ + struct stream_handler *handler = impl_from_IMFByteStreamHandler(iface); + IMFAsyncResult *result = (IMFAsyncResult *)cookie; + struct result_entry *entry; + + TRACE("%p, %p.\n", iface, cookie); + + if (!(entry = handler_find_result_entry(handler, result))) + return MF_E_UNEXPECTED; + + result_entry_destroy(entry); + return S_OK; +} + +static HRESULT WINAPI stream_handler_GetMaxNumberOfBytesRequiredForResolution(IMFByteStreamHandler *iface, QWORD *bytes) +{ + FIXME("stub (%p %p)\n", iface, bytes); + return E_NOTIMPL; +} + +static const IMFByteStreamHandlerVtbl stream_handler_vtbl = +{ + stream_handler_QueryInterface, + stream_handler_AddRef, + stream_handler_Release, + stream_handler_BeginCreateObject, + stream_handler_EndCreateObject, + stream_handler_CancelObjectCreation, + stream_handler_GetMaxNumberOfBytesRequiredForResolution, +}; + +static HRESULT WINAPI stream_handler_callback_QueryInterface(IMFAsyncCallback *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IMFAsyncCallback) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFAsyncCallback_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI stream_handler_callback_AddRef(IMFAsyncCallback *iface) +{ + struct stream_handler *handler = impl_from_IMFAsyncCallback(iface); + return IMFByteStreamHandler_AddRef(&handler->IMFByteStreamHandler_iface); +} + +static ULONG WINAPI stream_handler_callback_Release(IMFAsyncCallback *iface) +{ + struct stream_handler *handler = impl_from_IMFAsyncCallback(iface); + return IMFByteStreamHandler_Release(&handler->IMFByteStreamHandler_iface); +} + +static HRESULT WINAPI stream_handler_callback_GetParameters(IMFAsyncCallback *iface, DWORD *flags, DWORD *queue) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) +{ + struct stream_handler *handler = impl_from_IMFAsyncCallback(iface); + IUnknown *object, *state = IMFAsyncResult_GetStateNoAddRef(result); + struct object_context *context; + struct result_entry *entry; + HRESULT hr; + + if (!state || !(context = impl_from_IUnknown(state))) + return E_INVALIDARG; + + if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) + WARN("Failed to create media source, hr %#lx\n", hr); + else + { + if (FAILED(hr = result_entry_create(context->result, MF_OBJECT_MEDIASOURCE, object, &entry))) + WARN("Failed to create handler result, hr %#lx\n", hr); + else + { + EnterCriticalSection(&handler->cs); + list_add_tail(&handler->results, &entry->entry); + LeaveCriticalSection(&handler->cs); + } + + IUnknown_Release(object); + } + + IMFAsyncResult_SetStatus(context->result, hr); + MFInvokeCallback(context->result); + + return S_OK; +} + +static const IMFAsyncCallbackVtbl stream_handler_callback_vtbl = +{ + stream_handler_callback_QueryInterface, + stream_handler_callback_AddRef, + stream_handler_callback_Release, + stream_handler_callback_GetParameters, + stream_handler_callback_Invoke, +}; + +HRESULT gstreamer_byte_stream_handler_2_create(REFIID riid, void **obj) +{ + struct stream_handler *handler; + HRESULT hr; + + TRACE("%s, %p.\n", debugstr_guid(riid), obj); + + if (!(handler = calloc(1, sizeof(*handler)))) + return E_OUTOFMEMORY; + + list_init(&handler->results); + InitializeCriticalSection(&handler->cs); + + handler->IMFByteStreamHandler_iface.lpVtbl = &stream_handler_vtbl; + handler->IMFAsyncCallback_iface.lpVtbl = &stream_handler_callback_vtbl; + handler->refcount = 1; + + hr = IMFByteStreamHandler_QueryInterface(&handler->IMFByteStreamHandler_iface, riid, obj); + IMFByteStreamHandler_Release(&handler->IMFByteStreamHandler_iface); + + return hr; +} diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 16b24a23261..493e6cff2b0 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -83,6 +83,12 @@ coclass VideoProcessorMFT {} ] coclass GStreamerByteStreamHandler {} +[ + threading(both), + uuid(317df619-5e5a-468a-9f15-d827a9a08162) +] +coclass GStreamerByteStreamHandler2 {} + [ threading(both), uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) From c6d7a397da1a5cd31f44dc1ef81bc642fa0751fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 22 Nov 2023 22:37:04 +0100 Subject: [PATCH 1155/1506] HACK: winegstreamer/new_media_source: Fallback to the old media source on failure. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 97 ++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 2250a5faab8..860a14f7bb5 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -119,6 +119,93 @@ static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const W return S_OK; } +struct media_source_fallback_callback +{ + IMFAsyncCallback IMFAsyncCallback_iface; + IMFAsyncResult *result; + HANDLE event; +}; + +static HRESULT WINAPI media_source_fallback_callback_QueryInterface(IMFAsyncCallback *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IMFAsyncCallback) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFAsyncCallback_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI media_source_fallback_callback_AddRef(IMFAsyncCallback *iface) +{ + return 2; +} + +static ULONG WINAPI media_source_fallback_callback_Release(IMFAsyncCallback *iface) +{ + return 1; +} + +static HRESULT WINAPI media_source_fallback_callback_GetParameters(IMFAsyncCallback *iface, DWORD *flags, DWORD *queue) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI media_source_fallback_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) +{ + struct media_source_fallback_callback *impl = CONTAINING_RECORD(iface, struct media_source_fallback_callback, IMFAsyncCallback_iface); + + IMFAsyncResult_AddRef((impl->result = result)); + SetEvent(impl->event); + + return S_OK; +} + +static const IMFAsyncCallbackVtbl media_source_fallback_callback_vtbl = +{ + media_source_fallback_callback_QueryInterface, + media_source_fallback_callback_AddRef, + media_source_fallback_callback_Release, + media_source_fallback_callback_GetParameters, + media_source_fallback_callback_Invoke, +}; + +static HRESULT create_media_source_fallback(struct object_context *context, IUnknown **object) +{ + static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; + struct media_source_fallback_callback callback = {{&media_source_fallback_callback_vtbl}}; + IMFByteStreamHandler *handler; + MF_OBJECT_TYPE type; + HRESULT hr; + + if (!(callback.event = CreateEventW(NULL, FALSE, FALSE, NULL))) + return HRESULT_FROM_WIN32(GetLastError()); + + if (FAILED(hr = CoCreateInstance(&CLSID_GStreamerByteStreamHandler, NULL, CLSCTX_INPROC_SERVER, + &IID_IMFByteStreamHandler, (void **)&handler))) + { + CloseHandle(callback.event); + return hr; + } + + if (SUCCEEDED(hr = IMFByteStreamHandler_BeginCreateObject(handler, context->stream, NULL, MF_RESOLUTION_MEDIASOURCE, + NULL, NULL, &callback.IMFAsyncCallback_iface, NULL))) + { + WaitForSingleObject(callback.event, INFINITE); + hr = IMFByteStreamHandler_EndCreateObject(handler, callback.result, &type, object); + IMFAsyncResult_Release(callback.result); + } + + IMFByteStreamHandler_Release(handler); + CloseHandle(callback.event); + return hr; +} + struct media_stream { IMFMediaStream IMFMediaStream_iface; @@ -1724,6 +1811,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc IMFMediaEventQueue_Release(object->event_queue); IMFByteStream_Release(object->byte_stream); free(object); + return hr; } @@ -2000,7 +2088,14 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); - else + + if (FAILED(hr)) + { + FIXME("Falling back to old media source, hr %#lx\n", hr); + hr = create_media_source_fallback(context, (IUnknown **)&object); + } + + if (SUCCEEDED(hr)) { if (FAILED(hr = result_entry_create(context->result, MF_OBJECT_MEDIASOURCE, object, &entry))) WARN("Failed to create handler result, hr %#lx\n", hr); From c80502e495ea3c16dc0a62a866de2cb51da11ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 18 Aug 2023 10:59:46 +0200 Subject: [PATCH 1156/1506] winegstreamer/new_media_source: Introduce a new wg_source interface. CW-Bug-Id: #21953 --- MAINTAINERS | 1 + dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/gst_private.h | 3 + dlls/winegstreamer/main.c | 25 +++++++ dlls/winegstreamer/new_media_source.c | 15 ++++- dlls/winegstreamer/unix_private.h | 5 ++ dlls/winegstreamer/unixlib.h | 9 +++ dlls/winegstreamer/wg_parser.c | 6 ++ dlls/winegstreamer/wg_source.c | 94 +++++++++++++++++++++++++++ 9 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 dlls/winegstreamer/wg_source.c diff --git a/MAINTAINERS b/MAINTAINERS index 4bab36bfdf9..59873f6804c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -223,6 +223,7 @@ F: dlls/winegstreamer/mfplat.c F: dlls/winegstreamer/resampler.c F: dlls/winegstreamer/video_decoder.c F: dlls/winegstreamer/video_processor.c +F: dlls/winegstreamer/wg_source.c F: dlls/winegstreamer/wg_sample.c F: dlls/winegstreamer/wg_transform.c F: dlls/winegstreamer/wma_decoder.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index af64d13b7b7..49cfafc2a8e 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -27,6 +27,7 @@ SOURCES = \ wg_muxer.c \ wg_parser.c \ wg_sample.c \ + wg_source.c \ wg_transform.c \ winegstreamer_classes.idl \ wm_reader.c \ diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index e258a5ce532..13fda53b0be 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -103,6 +103,9 @@ char *wg_parser_stream_get_tag(wg_parser_stream_t stream, enum wg_parser_tag tag void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); +HRESULT wg_source_create(wg_source_t *out); +void wg_source_destroy(wg_source_t source); + wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs); void wg_transform_destroy(wg_transform_t transform); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index bc6111abe2a..60968286af4 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -340,6 +340,31 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, WINE_UNIX_CALL(unix_wg_parser_stream_seek, ¶ms); } +HRESULT wg_source_create(wg_source_t *out) +{ + struct wg_source_create_params params = {0}; + NTSTATUS status; + + TRACE("out %p\n", out); + + if ((status = WINE_UNIX_CALL(unix_wg_source_create, ¶ms))) + WARN("wg_source_create returned status %#lx\n", status); + else + { + TRACE("Returning source %#I64x.\n", params.source); + *out = params.source; + } + + return HRESULT_FROM_NT(status); +} + +void wg_source_destroy(wg_source_t source) +{ + TRACE("source %#I64x.\n", source); + + WINE_UNIX_CALL(unix_wg_source_destroy, &source); +} + wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs) { diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 860a14f7bb5..842df5e690d 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -36,6 +36,8 @@ struct object_context IMFByteStream *stream; UINT64 file_size; WCHAR *url; + + wg_source_t wg_source; }; static struct object_context *impl_from_IUnknown(IUnknown *iface) @@ -78,6 +80,8 @@ static ULONG WINAPI object_context_Release(IUnknown *iface) if (!refcount) { + if (context->wg_source) + wg_source_destroy(context->wg_source); IMFAsyncResult_Release(context->result); IMFByteStream_Release(context->stream); free(context->url); @@ -269,6 +273,7 @@ struct media_source CRITICAL_SECTION cs; + wg_source_t wg_source; UINT64 file_size; wg_parser_t wg_parser; UINT64 duration; @@ -1446,6 +1451,7 @@ static ULONG WINAPI media_source_Release(IMFMediaSource *iface) IMFMediaSource_Shutdown(iface); IMFMediaEventQueue_Release(source->event_queue); IMFByteStream_Release(source->byte_stream); + wg_source_destroy(source->wg_source); wg_parser_destroy(source->wg_parser); source->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&source->cs); @@ -1724,6 +1730,9 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc InitializeCriticalSection(&object->cs); object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); + object->wg_source = context->wg_source; + context->wg_source = 0; + if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) goto fail; @@ -1803,6 +1812,8 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc WaitForSingleObject(object->read_thread, INFINITE); CloseHandle(object->read_thread); } + if (object->wg_source) + wg_source_destroy(object->wg_source); if (object->wg_parser) wg_parser_destroy(object->wg_parser); if (object->async_commands_queue) @@ -2086,7 +2097,9 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM if (!state || !(context = impl_from_IUnknown(state))) return E_INVALIDARG; - if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) + if (FAILED(hr = wg_source_create(&context->wg_source))) + WARN("Failed to create wg_source, hr %#lx\n", hr); + else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); if (FAILED(hr)) diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 55c850bc1a3..83d18ebbf92 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -57,6 +57,11 @@ extern void wg_format_from_caps(struct wg_format *format, const GstCaps *caps); extern bool wg_format_compare(const struct wg_format *a, const struct wg_format *b); extern GstCaps *wg_format_to_caps(const struct wg_format *format); +/* wg_source.c */ + +extern NTSTATUS wg_source_create(void *args); +extern NTSTATUS wg_source_destroy(void *args); + /* wg_transform.c */ extern NTSTATUS wg_transform_create(void *args); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index e7dcb23ab2b..a4f5f758753 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -218,6 +218,7 @@ enum wg_parser_type typedef UINT64 wg_parser_t; typedef UINT64 wg_parser_stream_t; +typedef UINT64 wg_source_t; typedef UINT64 wg_transform_t; typedef UINT64 wg_muxer_t; @@ -340,6 +341,11 @@ struct wg_parser_stream_seek_params DWORD start_flags, stop_flags; }; +struct wg_source_create_params +{ + wg_source_t source; +}; + struct wg_transform_attrs { UINT32 output_plane_align; @@ -450,6 +456,9 @@ enum unix_funcs unix_wg_parser_stream_get_tag, unix_wg_parser_stream_seek, + unix_wg_source_create, + unix_wg_source_destroy, + unix_wg_transform_create, unix_wg_transform_destroy, unix_wg_transform_set_output_format, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 7326cbc27cb..b47cf9b852c 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2206,6 +2206,9 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_parser_stream_get_tag), X(wg_parser_stream_seek), + X(wg_source_create), + X(wg_source_destroy), + X(wg_transform_create), X(wg_transform_destroy), X(wg_transform_set_output_format), @@ -2539,6 +2542,9 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X64(wg_parser_stream_get_tag), X(wg_parser_stream_seek), + X(wg_source_create), + X(wg_source_destroy), + X64(wg_transform_create), X(wg_transform_destroy), X64(wg_transform_set_output_format), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c new file mode 100644 index 00000000000..52a54196ea9 --- /dev/null +++ b/dlls/winegstreamer/wg_source.c @@ -0,0 +1,94 @@ +/* + * Copyright 2023 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "winternl.h" +#include "mferror.h" + +#include "unix_private.h" + +struct wg_source +{ + GstElement *container; +}; + +static struct wg_source *get_source(wg_source_t source) +{ + return (struct wg_source *)(ULONG_PTR)source; +} + +NTSTATUS wg_source_create(void *args) +{ + struct wg_source_create_params *params = args; + struct wg_source *source; + + if (!(source = calloc(1, sizeof(*source)))) + return STATUS_UNSUCCESSFUL; + + if (!(source->container = gst_bin_new("wg_source"))) + goto error; + + gst_element_set_state(source->container, GST_STATE_PAUSED); + if (!gst_element_get_state(source->container, NULL, NULL, -1)) + goto error; + + params->source = (wg_source_t)(ULONG_PTR)source; + GST_INFO("Created winegstreamer source %p.", source); + return STATUS_SUCCESS; + +error: + if (source->container) + { + gst_element_set_state(source->container, GST_STATE_NULL); + gst_object_unref(source->container); + } + free(source); + + GST_ERROR("Failed to create winegstreamer source."); + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS wg_source_destroy(void *args) +{ + struct wg_source *source = get_source(*(wg_source_t *)args); + + GST_TRACE("source %p", source); + + gst_element_set_state(source->container, GST_STATE_NULL); + gst_object_unref(source->container); + free(source); + + return STATUS_SUCCESS; +} From 03d9fecdfbcfaa8285719d73b2758d35888512d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 18 Aug 2023 11:00:42 +0200 Subject: [PATCH 1157/1506] winegstreamer/new_media_source: Call (Begin|End)Read to read the byte stream header. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 35 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 842df5e690d..74aec7c8ee6 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -27,6 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); +#define SOURCE_BUFFER_SIZE (32 * 1024) + struct object_context { IUnknown IUnknown_iface; @@ -37,6 +39,7 @@ struct object_context UINT64 file_size; WCHAR *url; + BYTE *buffer; wg_source_t wg_source; }; @@ -84,6 +87,7 @@ static ULONG WINAPI object_context_Release(IUnknown *iface) wg_source_destroy(context->wg_source); IMFAsyncResult_Release(context->result); IMFByteStream_Release(context->stream); + free(context->buffer); free(context->url); free(context); } @@ -99,14 +103,16 @@ static const IUnknownVtbl object_context_vtbl = }; static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const WCHAR *url, - QWORD file_size, IMFAsyncResult *result, IUnknown **out) + QWORD file_size, IMFAsyncResult *result, IUnknown **out, BYTE **out_buf) { WCHAR *tmp_url = url ? wcsdup(url) : NULL; struct object_context *context; - if (!(context = calloc(1, sizeof(*context)))) + if (!(context = calloc(1, sizeof(*context))) + || !(context->buffer = malloc(SOURCE_BUFFER_SIZE))) { free(tmp_url); + free(context); return E_OUTOFMEMORY; } @@ -120,6 +126,7 @@ static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const W IMFAsyncResult_AddRef(context->result); *out = &context->IUnknown_iface; + *out_buf = context->buffer; return S_OK; } @@ -1949,7 +1956,8 @@ static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *ifa struct stream_handler *handler = impl_from_IMFByteStreamHandler(iface); IMFAsyncResult *result; IUnknown *context; - QWORD file_size; + QWORD file_size, position; + BYTE *buffer; HRESULT hr; DWORD caps; @@ -1978,13 +1986,16 @@ static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *ifa if (FAILED(hr = MFCreateAsyncResult(NULL, callback, state, &result))) return hr; - if (FAILED(hr = object_context_create(flags, stream, url, file_size, result, &context))) - { - IMFAsyncResult_Release(result); - return hr; - } + if (FAILED(hr = object_context_create(flags, stream, url, file_size, result, &context, &buffer))) + goto done; - hr = MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_IO, &handler->IMFAsyncCallback_iface, context); + if (FAILED(hr = IMFByteStream_GetCurrentPosition(stream, &position))) + WARN("Failed to get byte stream position, hr %#lx\n", hr); + else if (position != 0 && FAILED(hr = IMFByteStream_SetCurrentPosition(stream, 0))) + WARN("Failed to set byte stream position, hr %#lx\n", hr); + else if (FAILED(hr = IMFByteStream_BeginRead(stream, buffer, min(SOURCE_BUFFER_SIZE, file_size), + &handler->IMFAsyncCallback_iface, context))) + WARN("Failed to queue byte stream async read, hr %#lx\n", hr); IUnknown_Release(context); if (SUCCEEDED(hr) && cancel_cookie) @@ -1993,6 +2004,7 @@ static HRESULT WINAPI stream_handler_BeginCreateObject(IMFByteStreamHandler *ifa IUnknown_AddRef(*cancel_cookie); } +done: IMFAsyncResult_Release(result); return hr; @@ -2092,12 +2104,15 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM IUnknown *object, *state = IMFAsyncResult_GetStateNoAddRef(result); struct object_context *context; struct result_entry *entry; + DWORD size = 0; HRESULT hr; if (!state || !(context = impl_from_IUnknown(state))) return E_INVALIDARG; - if (FAILED(hr = wg_source_create(&context->wg_source))) + if (FAILED(hr = IMFByteStream_EndRead(context->stream, result, &size))) + WARN("Failed to complete stream read, hr %#lx\n", hr); + else if (FAILED(hr = wg_source_create(&context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); From dd14bb64d5aa28230f70bc16aef3b3a8ce5ae16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 18 Aug 2023 11:06:25 +0200 Subject: [PATCH 1158/1506] winegstreamer/new_media_source: Provide first block of data and stream URL to wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 2 +- dlls/winegstreamer/main.c | 15 ++++++++--- dlls/winegstreamer/new_media_source.c | 2 +- dlls/winegstreamer/unixlib.h | 3 +++ dlls/winegstreamer/wg_parser.c | 24 +++++++++++++++++- dlls/winegstreamer/wg_source.c | 36 +++++++++++++++++++++++++++ 6 files changed, 76 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 13fda53b0be..c8d1ec0cc7e 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -103,7 +103,7 @@ char *wg_parser_stream_get_tag(wg_parser_stream_t stream, enum wg_parser_tag tag void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); -HRESULT wg_source_create(wg_source_t *out); +HRESULT wg_source_create(const WCHAR *url, const void *data, uint32_t size, wg_source_t *out); void wg_source_destroy(wg_source_t source); wg_transform_t wg_transform_create(const struct wg_format *input_format, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 60968286af4..a3751aba76e 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -340,12 +340,20 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, WINE_UNIX_CALL(unix_wg_parser_stream_seek, ¶ms); } -HRESULT wg_source_create(wg_source_t *out) +HRESULT wg_source_create(const WCHAR *url, const void *data, uint32_t size, wg_source_t *out) { - struct wg_source_create_params params = {0}; + struct wg_source_create_params params = + { + .data = data, .size = size, + }; + UINT len = url ? WideCharToMultiByte(CP_ACP, 0, url, -1, NULL, 0, NULL, NULL) : 0; + char *tmp = url ? malloc(len) : NULL; NTSTATUS status; - TRACE("out %p\n", out); + TRACE("url %s, data %p, size %#x\n", debugstr_w(url), data, size); + + if ((params.url = tmp)) + WideCharToMultiByte(CP_ACP, 0, url, -1, tmp, len, NULL, NULL); if ((status = WINE_UNIX_CALL(unix_wg_source_create, ¶ms))) WARN("wg_source_create returned status %#lx\n", status); @@ -355,6 +363,7 @@ HRESULT wg_source_create(wg_source_t *out) *out = params.source; } + free(tmp); return HRESULT_FROM_NT(status); } diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 74aec7c8ee6..a7d4b76c200 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -2112,7 +2112,7 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM if (FAILED(hr = IMFByteStream_EndRead(context->stream, result, &size))) WARN("Failed to complete stream read, hr %#lx\n", hr); - else if (FAILED(hr = wg_source_create(&context->wg_source))) + else if (FAILED(hr = wg_source_create(context->url, context->buffer, size, &context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index a4f5f758753..ea913f39dd8 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -343,6 +343,9 @@ struct wg_parser_stream_seek_params struct wg_source_create_params { + const char *url; + const void *data; + UINT32 size; wg_source_t source; }; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index b47cf9b852c..dc5c5e6b246 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2356,6 +2356,28 @@ static NTSTATUS wow64_wg_parser_stream_get_tag(void *args) return wg_parser_stream_get_tag(¶ms); } +NTSTATUS wow64_wg_source_create(void *args) +{ + struct + { + PTR32 url; + PTR32 data; + UINT32 size; + wg_source_t source; + } *params32 = args; + struct wg_source_create_params params = + { + .url = ULongToPtr(params32->url), + .data = ULongToPtr(params32->data), + .size = params32->size, + }; + NTSTATUS ret; + + ret = wg_source_create(¶ms); + params32->source = params.source; + return ret; +} + NTSTATUS wow64_wg_transform_create(void *args) { struct @@ -2542,7 +2564,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X64(wg_parser_stream_get_tag), X(wg_parser_stream_seek), - X(wg_source_create), + X64(wg_source_create), X(wg_source_destroy), X64(wg_transform_create), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 52a54196ea9..47f67ea8dae 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -49,13 +49,45 @@ static struct wg_source *get_source(wg_source_t source) return (struct wg_source *)(ULONG_PTR)source; } +static GstCaps *detect_caps_from_data(const char *url, const void *data, guint size) +{ + const char *extension = url ? strrchr(url, '.') : NULL; + GstTypeFindProbability probability; + GstCaps *caps; + gchar *str; + + if (!(caps = gst_type_find_helper_for_data_with_extension(NULL, data, size, + extension ? extension + 1 : NULL, &probability))) + { + GST_ERROR("Failed to detect caps for url %s, data %p, size %u", url, data, size); + return NULL; + } + + str = gst_caps_to_string(caps); + if (probability > GST_TYPE_FIND_POSSIBLE) + GST_INFO("Detected caps %s with probability %u for url %s, data %p, size %u", + str, probability, url, data, size); + else + GST_FIXME("Detected caps %s with probability %u for url %s, data %p, size %u", + str, probability, url, data, size); + g_free(str); + + return caps; +} + NTSTATUS wg_source_create(void *args) { struct wg_source_create_params *params = args; struct wg_source *source; + GstCaps *src_caps; + if (!(src_caps = detect_caps_from_data(params->url, params->data, params->size))) + return STATUS_UNSUCCESSFUL; if (!(source = calloc(1, sizeof(*source)))) + { + gst_caps_unref(src_caps); return STATUS_UNSUCCESSFUL; + } if (!(source->container = gst_bin_new("wg_source"))) goto error; @@ -64,6 +96,8 @@ NTSTATUS wg_source_create(void *args) if (!gst_element_get_state(source->container, NULL, NULL, -1)) goto error; + gst_caps_unref(src_caps); + params->source = (wg_source_t)(ULONG_PTR)source; GST_INFO("Created winegstreamer source %p.", source); return STATUS_SUCCESS; @@ -76,6 +110,8 @@ NTSTATUS wg_source_create(void *args) } free(source); + gst_caps_unref(src_caps); + GST_ERROR("Failed to create winegstreamer source."); return STATUS_UNSUCCESSFUL; } From 05035dfb6a99c230ffd15315381736bee41abe24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Jul 2023 17:43:51 +0200 Subject: [PATCH 1159/1506] winegstreamer/new_media_source: Prefer MF_BYTESTREAM_ORIGIN_NAME for source URL. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index a7d4b76c200..e3c329bccfd 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -102,10 +102,30 @@ static const IUnknownVtbl object_context_vtbl = object_context_Release, }; +static WCHAR *byte_stream_get_url(IMFByteStream *stream, const WCHAR *url) +{ + IMFAttributes *attributes; + WCHAR buffer[MAX_PATH]; + UINT32 size; + HRESULT hr; + + if (SUCCEEDED(hr = IMFByteStream_QueryInterface(stream, &IID_IMFAttributes, (void **)&attributes))) + { + if (FAILED(hr = IMFAttributes_GetString(attributes, &MF_BYTESTREAM_ORIGIN_NAME, + buffer, ARRAY_SIZE(buffer), &size))) + WARN("Failed to get MF_BYTESTREAM_ORIGIN_NAME got size %#x, hr %#lx\n", size, hr); + else + url = buffer; + IMFAttributes_Release(attributes); + } + + return url ? wcsdup(url) : NULL; +} + static HRESULT object_context_create(DWORD flags, IMFByteStream *stream, const WCHAR *url, QWORD file_size, IMFAsyncResult *result, IUnknown **out, BYTE **out_buf) { - WCHAR *tmp_url = url ? wcsdup(url) : NULL; + WCHAR *tmp_url = byte_stream_get_url(stream, url); struct object_context *context; if (!(context = calloc(1, sizeof(*context))) From 8d1243719fe30b9ad64b97ff0e29c03ab6ceb6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 26 Apr 2023 18:06:11 +0200 Subject: [PATCH 1160/1506] winegstreamer/new_media_source: Create a source pad on the wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 47f67ea8dae..295e1138840 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -41,6 +41,7 @@ struct wg_source { + GstPad *src_pad; GstElement *container; }; @@ -75,6 +76,21 @@ static GstCaps *detect_caps_from_data(const char *url, const void *data, guint s return caps; } +static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) +{ + GstCaps *pad_caps = caps ? gst_caps_ref(caps) : gst_caps_new_any(); + const char *name = direction == GST_PAD_SRC ? "src" : "sink"; + GstPadTemplate *template; + GstPad *pad; + + if (!pad_caps || !(template = gst_pad_template_new(name, direction, GST_PAD_ALWAYS, pad_caps))) + return NULL; + pad = gst_pad_new_from_template(template, "src"); + g_object_unref(template); + gst_caps_unref(pad_caps); + return pad; +} + NTSTATUS wg_source_create(void *args) { struct wg_source_create_params *params = args; @@ -91,6 +107,9 @@ NTSTATUS wg_source_create(void *args) if (!(source->container = gst_bin_new("wg_source"))) goto error; + if (!(source->src_pad = create_pad_with_caps(GST_PAD_SRC, src_caps))) + goto error; + gst_pad_set_element_private(source->src_pad, source); gst_element_set_state(source->container, GST_STATE_PAUSED); if (!gst_element_get_state(source->container, NULL, NULL, -1)) @@ -108,6 +127,8 @@ NTSTATUS wg_source_create(void *args) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); } + if (source->src_pad) + gst_object_unref(source->src_pad); free(source); gst_caps_unref(src_caps); @@ -124,6 +145,7 @@ NTSTATUS wg_source_destroy(void *args) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); + gst_object_unref(source->src_pad); free(source); return STATUS_SUCCESS; From cee6b45a79c4b2887954921dc08d3bb7af22266c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 27 Apr 2023 15:22:44 +0200 Subject: [PATCH 1161/1506] winegstreamer/new_media_source: Create a demuxer element in wg_source_create. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 295e1138840..6f63ac0822f 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -94,8 +94,9 @@ static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) NTSTATUS wg_source_create(void *args) { struct wg_source_create_params *params = args; + GstElement *first = NULL, *last = NULL, *element; + GstCaps *src_caps, *any_caps; struct wg_source *source; - GstCaps *src_caps; if (!(src_caps = detect_caps_from_data(params->url, params->data, params->size))) return STATUS_UNSUCCESSFUL; @@ -111,6 +112,21 @@ NTSTATUS wg_source_create(void *args) goto error; gst_pad_set_element_private(source->src_pad, source); + if (!(any_caps = gst_caps_new_any())) + goto error; + if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODABLE, src_caps, any_caps)) + || !append_element(source->container, element, &first, &last)) + { + gst_caps_unref(any_caps); + goto error; + } + gst_caps_unref(any_caps); + + if (!link_src_to_element(source->src_pad, first)) + goto error; + if (!gst_pad_set_active(source->src_pad, true)) + goto error; + gst_element_set_state(source->container, GST_STATE_PAUSED); if (!gst_element_get_state(source->container, NULL, NULL, -1)) goto error; From e4be1a5008cee43f862fec2efe597d1d84dd2a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 22 Nov 2023 23:11:45 +0100 Subject: [PATCH 1162/1506] winegstreamer/new_media_source: Push a stream and segment event to the wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 14 +++++++++ dlls/winegstreamer/new_media_source.c | 2 ++ dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 8 +++++ dlls/winegstreamer/wg_parser.c | 20 +++++++++++++ dlls/winegstreamer/wg_source.c | 42 +++++++++++++++++++++++++++ 7 files changed, 88 insertions(+) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index c8d1ec0cc7e..dc50549f82d 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -105,6 +105,7 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, HRESULT wg_source_create(const WCHAR *url, const void *data, uint32_t size, wg_source_t *out); void wg_source_destroy(wg_source_t source); +HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index a3751aba76e..0786024968b 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -374,6 +374,20 @@ void wg_source_destroy(wg_source_t source) WINE_UNIX_CALL(unix_wg_source_destroy, &source); } +HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size) +{ + struct wg_source_push_data_params params = + { + .source = source, + .data = data, + .size = size, + }; + + TRACE("source %#I64x, data %p, size %#x\n", source, data, size); + + return HRESULT_FROM_NT(WINE_UNIX_CALL(unix_wg_source_push_data, ¶ms)); +} + wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs) { diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index e3c329bccfd..d63550e1b8d 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -2134,6 +2134,8 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM WARN("Failed to complete stream read, hr %#lx\n", hr); else if (FAILED(hr = wg_source_create(context->url, context->buffer, size, &context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); + else if (FAILED(hr = wg_source_push_data(context->wg_source, context->buffer, size))) + WARN("Failed to push initial data, hr %#lx\n", hr); else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 83d18ebbf92..6aa7ef92f38 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -61,6 +61,7 @@ extern GstCaps *wg_format_to_caps(const struct wg_format *format); extern NTSTATUS wg_source_create(void *args); extern NTSTATUS wg_source_destroy(void *args); +extern NTSTATUS wg_source_push_data(void *args); /* wg_transform.c */ diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index ea913f39dd8..001709ca38d 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -349,6 +349,13 @@ struct wg_source_create_params wg_source_t source; }; +struct wg_source_push_data_params +{ + wg_source_t source; + const void *data; + UINT32 size; +}; + struct wg_transform_attrs { UINT32 output_plane_align; @@ -461,6 +468,7 @@ enum unix_funcs unix_wg_source_create, unix_wg_source_destroy, + unix_wg_source_push_data, unix_wg_transform_create, unix_wg_transform_destroy, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index dc5c5e6b246..5c613a66f45 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2208,6 +2208,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_create), X(wg_source_destroy), + X(wg_source_push_data), X(wg_transform_create), X(wg_transform_destroy), @@ -2378,6 +2379,24 @@ NTSTATUS wow64_wg_source_create(void *args) return ret; } +NTSTATUS wow64_wg_source_push_data(void *args) +{ + struct + { + wg_source_t source; + PTR32 data; + UINT32 size; + } *params32 = args; + struct wg_source_push_data_params params = + { + .source = params32->source, + .data = ULongToPtr(params32->data), + .size = params32->size, + }; + + return wg_source_push_data(¶ms); +} + NTSTATUS wow64_wg_transform_create(void *args) { struct @@ -2566,6 +2585,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X64(wg_source_create), X(wg_source_destroy), + X64(wg_source_push_data), X64(wg_transform_create), X(wg_transform_destroy), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 6f63ac0822f..34dae4d8cda 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -43,6 +43,8 @@ struct wg_source { GstPad *src_pad; GstElement *container; + GstSegment segment; + bool valid_segment; }; static struct wg_source *get_source(wg_source_t source) @@ -91,12 +93,29 @@ static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) return pad; } +static GstEvent *create_stream_start_event(const char *stream_id) +{ + GstStream *stream; + GstEvent *event; + + if (!(stream = gst_stream_new(stream_id, NULL, GST_STREAM_TYPE_UNKNOWN, 0))) + return NULL; + if ((event = gst_event_new_stream_start(stream_id))) + { + gst_event_set_stream(event, stream); + gst_object_unref(stream); + } + + return event; +} + NTSTATUS wg_source_create(void *args) { struct wg_source_create_params *params = args; GstElement *first = NULL, *last = NULL, *element; GstCaps *src_caps, *any_caps; struct wg_source *source; + GstEvent *event; if (!(src_caps = detect_caps_from_data(params->url, params->data, params->size))) return STATUS_UNSUCCESSFUL; @@ -105,6 +124,7 @@ NTSTATUS wg_source_create(void *args) gst_caps_unref(src_caps); return STATUS_UNSUCCESSFUL; } + gst_segment_init(&source->segment, GST_FORMAT_BYTES); if (!(source->container = gst_bin_new("wg_source"))) goto error; @@ -131,6 +151,9 @@ NTSTATUS wg_source_create(void *args) if (!gst_element_get_state(source->container, NULL, NULL, -1)) goto error; + if (!(event = create_stream_start_event("wg_source")) + || !push_event(source->src_pad, event)) + goto error; gst_caps_unref(src_caps); params->source = (wg_source_t)(ULONG_PTR)source; @@ -166,3 +189,22 @@ NTSTATUS wg_source_destroy(void *args) return STATUS_SUCCESS; } + +NTSTATUS wg_source_push_data(void *args) +{ + struct wg_source_push_data_params *params = args; + struct wg_source *source = get_source(params->source); + GstEvent *event; + + GST_TRACE("source %p, data %p, size %#x", source, params->data, params->size); + + if (!source->valid_segment) + { + if (!(event = gst_event_new_segment(&source->segment)) + || !gst_pad_push_event(source->src_pad, event)) + GST_ERROR("Failed to push new segment event"); + source->valid_segment = true; + } + + return STATUS_SUCCESS; +} From 2b543c0b74e47f6948c3c26133662697ae5d55b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 22 Nov 2023 23:12:14 +0100 Subject: [PATCH 1163/1506] winegstreamer/new_media_source: Handle GST_QUERY_URI on wg_source src pad. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 34dae4d8cda..3847f06eb3d 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -41,6 +41,7 @@ struct wg_source { + gchar *url; GstPad *src_pad; GstElement *container; GstSegment segment; @@ -93,6 +94,32 @@ static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) return pad; } +static gboolean src_query_uri(struct wg_source *source, GstQuery *query) +{ + gchar *uri; + + gst_query_parse_uri(query, &uri); + GST_TRACE("source %p, uri %s", source, uri); + gst_query_set_uri(query, source->url); + + return true; +} + +static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +{ + struct wg_source *source = gst_pad_get_element_private(pad); + + switch (GST_QUERY_TYPE(query)) + { + case GST_QUERY_URI: + if (!source->url) + return false; + return src_query_uri(source, query); + default: + return gst_pad_query_default(pad, parent, query); + } +} + static GstEvent *create_stream_start_event(const char *stream_id) { GstStream *stream; @@ -124,6 +151,7 @@ NTSTATUS wg_source_create(void *args) gst_caps_unref(src_caps); return STATUS_UNSUCCESSFUL; } + source->url = params->url ? strdup(params->url) : NULL; gst_segment_init(&source->segment, GST_FORMAT_BYTES); if (!(source->container = gst_bin_new("wg_source"))) @@ -131,6 +159,7 @@ NTSTATUS wg_source_create(void *args) if (!(source->src_pad = create_pad_with_caps(GST_PAD_SRC, src_caps))) goto error; gst_pad_set_element_private(source->src_pad, source); + gst_pad_set_query_function(source->src_pad, src_query_cb); if (!(any_caps = gst_caps_new_any())) goto error; @@ -168,6 +197,7 @@ NTSTATUS wg_source_create(void *args) } if (source->src_pad) gst_object_unref(source->src_pad); + free(source->url); free(source); gst_caps_unref(src_caps); @@ -185,6 +215,7 @@ NTSTATUS wg_source_destroy(void *args) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); gst_object_unref(source->src_pad); + free(source->url); free(source); return STATUS_SUCCESS; From 13bfa9fbb77b8bfc94d5978aee4644936b3ba3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 22 Nov 2023 23:12:29 +0100 Subject: [PATCH 1164/1506] winegstreamer/new_media_source: Handle GST_QUERY_DURATION on wg_source src pad. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 3 ++- dlls/winegstreamer/main.c | 7 +++++-- dlls/winegstreamer/new_media_source.c | 3 ++- dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_source.c | 16 ++++++++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index dc50549f82d..c09c367a66b 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -103,7 +103,8 @@ char *wg_parser_stream_get_tag(wg_parser_stream_t stream, enum wg_parser_tag tag void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); -HRESULT wg_source_create(const WCHAR *url, const void *data, uint32_t size, wg_source_t *out); +HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, + const void *data, uint32_t size, wg_source_t *out); void wg_source_destroy(wg_source_t source); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 0786024968b..502d77d826a 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -340,17 +340,20 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, WINE_UNIX_CALL(unix_wg_parser_stream_seek, ¶ms); } -HRESULT wg_source_create(const WCHAR *url, const void *data, uint32_t size, wg_source_t *out) +HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, + const void *data, uint32_t size, wg_source_t *out) { struct wg_source_create_params params = { + .file_size = file_size, .data = data, .size = size, }; UINT len = url ? WideCharToMultiByte(CP_ACP, 0, url, -1, NULL, 0, NULL, NULL) : 0; char *tmp = url ? malloc(len) : NULL; NTSTATUS status; - TRACE("url %s, data %p, size %#x\n", debugstr_w(url), data, size); + TRACE("url %s, file_size %#I64x, data %p, size %#x\n", debugstr_w(url), + file_size, data, size); if ((params.url = tmp)) WideCharToMultiByte(CP_ACP, 0, url, -1, tmp, len, NULL, NULL); diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index d63550e1b8d..d4c66fa3599 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -2132,7 +2132,8 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM if (FAILED(hr = IMFByteStream_EndRead(context->stream, result, &size))) WARN("Failed to complete stream read, hr %#lx\n", hr); - else if (FAILED(hr = wg_source_create(context->url, context->buffer, size, &context->wg_source))) + else if (FAILED(hr = wg_source_create(context->url, context->file_size, + context->buffer, size, &context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = wg_source_push_data(context->wg_source, context->buffer, size))) WARN("Failed to push initial data, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 001709ca38d..140308436a3 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -344,6 +344,7 @@ struct wg_parser_stream_seek_params struct wg_source_create_params { const char *url; + UINT64 file_size; const void *data; UINT32 size; wg_source_t source; diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 3847f06eb3d..70502295537 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -94,6 +94,19 @@ static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) return pad; } +static gboolean src_query_duration(struct wg_source *source, GstQuery *query) +{ + GstFormat format; + + gst_query_parse_duration(query, &format, NULL); + GST_TRACE("source %p, format %s", source, gst_format_get_name(format)); + if (format != GST_FORMAT_BYTES) + return false; + + gst_query_set_duration(query, format, source->segment.stop); + return true; +} + static gboolean src_query_uri(struct wg_source *source, GstQuery *query) { gchar *uri; @@ -111,6 +124,8 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) switch (GST_QUERY_TYPE(query)) { + case GST_QUERY_DURATION: + return src_query_duration(source, query); case GST_QUERY_URI: if (!source->url) return false; @@ -153,6 +168,7 @@ NTSTATUS wg_source_create(void *args) } source->url = params->url ? strdup(params->url) : NULL; gst_segment_init(&source->segment, GST_FORMAT_BYTES); + source->segment.stop = params->file_size; if (!(source->container = gst_bin_new("wg_source"))) goto error; From e6e29231ef8e80a72cf2ddfd2095e7dcde4a9980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 26 Apr 2023 18:49:44 +0200 Subject: [PATCH 1165/1506] winegstreamer/new_media_source: Handle GST_QUERY_SCHEDULING on wg_source src pad. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 70502295537..41fc4af3efd 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -107,6 +107,14 @@ static gboolean src_query_duration(struct wg_source *source, GstQuery *query) return true; } +static gboolean src_query_scheduling(struct wg_source *source, GstQuery *query) +{ + GST_TRACE("source %p", source); + gst_query_set_scheduling(query, GST_SCHEDULING_FLAG_SEEKABLE, 1, -1, 0); + gst_query_add_scheduling_mode(query, GST_PAD_MODE_PUSH); + return true; +} + static gboolean src_query_uri(struct wg_source *source, GstQuery *query) { gchar *uri; @@ -126,6 +134,8 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) { case GST_QUERY_DURATION: return src_query_duration(source, query); + case GST_QUERY_SCHEDULING: + return src_query_scheduling(source, query); case GST_QUERY_URI: if (!source->url) return false; From 903772fbc765eab1bac1b3e0b15d36ea735e3af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 29 Apr 2023 18:31:16 +0200 Subject: [PATCH 1166/1506] winegstreamer/new_media_source: Create and link sink pads in the wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 41fc4af3efd..3d8c60ebf7f 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -39,6 +39,13 @@ #include "unix_private.h" +#define WG_SOURCE_MAX_STREAMS 32 + +struct source_stream +{ + GstPad *pad; +}; + struct wg_source { gchar *url; @@ -46,6 +53,9 @@ struct wg_source GstElement *container; GstSegment segment; bool valid_segment; + + guint stream_count; + struct source_stream streams[WG_SOURCE_MAX_STREAMS]; }; static struct wg_source *get_source(wg_source_t source) @@ -145,6 +155,14 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) } } +static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer) +{ + struct wg_soutce *source = gst_pad_get_element_private(pad); + GST_TRACE("source %p, pad %p, buffer %p.", source, pad, buffer); + gst_buffer_unref(buffer); + return GST_FLOW_EOS; +} + static GstEvent *create_stream_start_event(const char *stream_id) { GstStream *stream; @@ -161,6 +179,24 @@ static GstEvent *create_stream_start_event(const char *stream_id) return event; } +static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) +{ + struct wg_source *source = user; + GstPad *sink_pad; + guint index; + + GST_TRACE("source %p, element %p, pad %p.", source, element, pad); + if ((index = source->stream_count++) >= ARRAY_SIZE(source->streams)) + { + GST_FIXME("Not enough sink pads, need %u", source->stream_count); + return; + } + + sink_pad = source->streams[index].pad; + if (gst_pad_link(pad, sink_pad) < 0 || !gst_pad_set_active(sink_pad, true)) + GST_ERROR("Failed to link new pad to sink pad %p", sink_pad); +} + NTSTATUS wg_source_create(void *args) { struct wg_source_create_params *params = args; @@ -168,6 +204,8 @@ NTSTATUS wg_source_create(void *args) GstCaps *src_caps, *any_caps; struct wg_source *source; GstEvent *event; + GstPad *peer; + guint i; if (!(src_caps = detect_caps_from_data(params->url, params->data, params->size))) return STATUS_UNSUCCESSFUL; @@ -182,11 +220,21 @@ NTSTATUS wg_source_create(void *args) if (!(source->container = gst_bin_new("wg_source"))) goto error; + GST_OBJECT_FLAG_SET(source->container, GST_BIN_FLAG_STREAMS_AWARE); + if (!(source->src_pad = create_pad_with_caps(GST_PAD_SRC, src_caps))) goto error; gst_pad_set_element_private(source->src_pad, source); gst_pad_set_query_function(source->src_pad, src_query_cb); + for (i = 0; i < ARRAY_SIZE(source->streams); i++) + { + if (!(source->streams[i].pad = create_pad_with_caps(GST_PAD_SINK, NULL))) + goto error; + gst_pad_set_element_private(source->streams[i].pad, source); + gst_pad_set_chain_function(source->streams[i].pad, sink_chain_cb); + } + if (!(any_caps = gst_caps_new_any())) goto error; if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODABLE, src_caps, any_caps)) @@ -195,6 +243,7 @@ NTSTATUS wg_source_create(void *args) gst_caps_unref(any_caps); goto error; } + g_signal_connect(element, "pad-added", G_CALLBACK(pad_added_cb), source); gst_caps_unref(any_caps); if (!link_src_to_element(source->src_pad, first)) @@ -202,6 +251,17 @@ NTSTATUS wg_source_create(void *args) if (!gst_pad_set_active(source->src_pad, true)) goto error; + /* try to link the first output pad, some demuxers only have static pads */ + if ((peer = gst_element_get_static_pad(last, "src"))) + { + GstPad *sink_pad = source->streams[0].pad; + if (gst_pad_link(peer, sink_pad) < 0 || !gst_pad_set_active(sink_pad, true)) + GST_ERROR("Failed to link static source pad %p", peer); + else + source->stream_count++; + gst_object_unref(peer); + } + gst_element_set_state(source->container, GST_STATE_PAUSED); if (!gst_element_get_state(source->container, NULL, NULL, -1)) goto error; @@ -221,6 +281,11 @@ NTSTATUS wg_source_create(void *args) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); } + for (i = 0; i < ARRAY_SIZE(source->streams); i++) + { + if (source->streams[i].pad) + gst_object_unref(source->streams[i].pad); + } if (source->src_pad) gst_object_unref(source->src_pad); free(source->url); @@ -235,11 +300,14 @@ NTSTATUS wg_source_create(void *args) NTSTATUS wg_source_destroy(void *args) { struct wg_source *source = get_source(*(wg_source_t *)args); + guint i; GST_TRACE("source %p", source); gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); + for (i = 0; i < ARRAY_SIZE(source->streams); i++) + gst_object_unref(source->streams[i].pad); gst_object_unref(source->src_pad); free(source->url); free(source); From 4e9a52094457d1b12f852f93df96fe2dc7655cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 22 Nov 2023 23:13:14 +0100 Subject: [PATCH 1167/1506] winegstreamer/new_media_source: Push the initial data from to the wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 2 +- dlls/winegstreamer/wg_source.c | 31 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index d4c66fa3599..1d177cca6f9 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -2136,7 +2136,7 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM context->buffer, size, &context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = wg_source_push_data(context->wg_source, context->buffer, size))) - WARN("Failed to push initial data, hr %#lx\n", hr); + WARN("Failed to push wg_source data, hr %#lx\n", hr); else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 3d8c60ebf7f..54cdd14668d 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -104,6 +104,21 @@ static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) return pad; } +static GstBuffer *create_buffer_from_bytes(const void *data, guint size) +{ + GstBuffer *buffer; + + if (!(buffer = gst_buffer_new_and_alloc(size))) + GST_ERROR("Failed to allocate buffer for %#x bytes\n", size); + else + { + gst_buffer_fill(buffer, 0, data, size); + gst_buffer_set_size(buffer, size); + } + + return buffer; +} + static gboolean src_query_duration(struct wg_source *source, GstQuery *query) { GstFormat format; @@ -319,6 +334,8 @@ NTSTATUS wg_source_push_data(void *args) { struct wg_source_push_data_params *params = args; struct wg_source *source = get_source(params->source); + GstFlowReturn ret = GST_FLOW_OK; + GstBuffer *buffer; GstEvent *event; GST_TRACE("source %p, data %p, size %#x", source, params->data, params->size); @@ -331,5 +348,19 @@ NTSTATUS wg_source_push_data(void *args) source->valid_segment = true; } + if (!(buffer = create_buffer_from_bytes(params->data, params->size))) + { + GST_WARNING("Failed to allocate buffer for data"); + return STATUS_UNSUCCESSFUL; + } + + source->segment.start += params->size; + if ((ret = gst_pad_push(source->src_pad, buffer)) && ret != GST_FLOW_EOS) + { + GST_WARNING("Failed to push data buffer, ret %d", ret); + source->segment.start -= params->size; + return STATUS_UNSUCCESSFUL; + } + return STATUS_SUCCESS; } From e2bb2c048beb1d3b2bb18974b691ee1e2236539b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 28 Apr 2023 22:44:15 +0200 Subject: [PATCH 1168/1506] winegstreamer/new_media_source: Push EOS event on stream or segment end. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 54cdd14668d..ee36e777e62 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -348,6 +348,13 @@ NTSTATUS wg_source_push_data(void *args) source->valid_segment = true; } + if (!params->size) + { + if (source->segment.start != source->segment.stop) + goto eos; + return STATUS_SUCCESS; + } + if (!(buffer = create_buffer_from_bytes(params->data, params->size))) { GST_WARNING("Failed to allocate buffer for data"); @@ -362,5 +369,14 @@ NTSTATUS wg_source_push_data(void *args) return STATUS_UNSUCCESSFUL; } + if (source->segment.start != source->segment.stop) + return STATUS_SUCCESS; + +eos: + if (!(event = gst_event_new_eos()) + || !gst_pad_push_event(source->src_pad, event)) + GST_WARNING("Failed to push EOS event"); + source->segment.start = source->segment.stop; + return STATUS_SUCCESS; } From 084aa80f4fa191135ede5a4af289e84d4ca4792e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 24 Jul 2023 14:03:53 +0200 Subject: [PATCH 1169/1506] winegstreamer/new_media_source: Handle GST_EVENT_SEEK on wg_source src pad. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index ee36e777e62..be40a20f3af 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -119,6 +119,67 @@ static GstBuffer *create_buffer_from_bytes(const void *data, guint size) return buffer; } +static gboolean src_event_seek(struct wg_source *source, GstEvent *event) +{ + guint32 seqnum = gst_event_get_seqnum(event); + GstSeekType cur_type, stop_type; + GstSeekFlags flags; + GstFormat format; + gint64 cur, stop; + gdouble rate; + + gst_event_parse_seek(event, &rate, &format, &flags, &cur_type, &cur, &stop_type, &stop); + gst_event_unref(event); + if (format != GST_FORMAT_BYTES) + return false; + + GST_TRACE("source %p, rate %f, format %s, flags %#x, cur_type %u, cur %#" G_GINT64_MODIFIER "x, " + "stop_type %u, stop %#" G_GINT64_MODIFIER "x.", source, rate, gst_format_get_name(format), + flags, cur_type, cur, stop_type, stop); + + if (flags & GST_SEEK_FLAG_FLUSH) + { + if (!(event = gst_event_new_flush_start())) + GST_ERROR("Failed to allocate flush_start event"); + else + { + gst_event_set_seqnum(event, seqnum); + if (!gst_pad_push_event(source->src_pad, event)) + GST_ERROR("Failed to push flush_start event"); + } + } + + source->segment.start = cur; + + if (flags & GST_SEEK_FLAG_FLUSH) + { + if (!(event = gst_event_new_flush_stop(true))) + GST_ERROR("Failed to allocate flush_stop event"); + else + { + gst_event_set_seqnum(event, seqnum); + if (!gst_pad_push_event(source->src_pad, event)) + GST_ERROR("Failed to push flush_stop event"); + } + source->valid_segment = false; + } + + return true; +} + +static gboolean src_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +{ + struct wg_source *source = gst_pad_get_element_private(pad); + + switch (GST_EVENT_TYPE(event)) + { + case GST_EVENT_SEEK: + return src_event_seek(source, event); + default: + return gst_pad_event_default(pad, parent, event); + } +} + static gboolean src_query_duration(struct wg_source *source, GstQuery *query) { GstFormat format; @@ -140,6 +201,19 @@ static gboolean src_query_scheduling(struct wg_source *source, GstQuery *query) return true; } +static gboolean src_query_seeking(struct wg_source *source, GstQuery *query) +{ + GstFormat format; + + gst_query_parse_seeking(query, &format, NULL, NULL, NULL); + GST_TRACE("source %p, format %s", source, gst_format_get_name(format)); + if (format != GST_FORMAT_BYTES) + return false; + + gst_query_set_seeking(query, GST_FORMAT_BYTES, 1, 0, source->segment.stop); + return true; +} + static gboolean src_query_uri(struct wg_source *source, GstQuery *query) { gchar *uri; @@ -161,6 +235,8 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) return src_query_duration(source, query); case GST_QUERY_SCHEDULING: return src_query_scheduling(source, query); + case GST_QUERY_SEEKING: + return src_query_seeking(source, query); case GST_QUERY_URI: if (!source->url) return false; @@ -241,6 +317,7 @@ NTSTATUS wg_source_create(void *args) goto error; gst_pad_set_element_private(source->src_pad, source); gst_pad_set_query_function(source->src_pad, src_query_cb); + gst_pad_set_event_function(source->src_pad, src_event_cb); for (i = 0; i < ARRAY_SIZE(source->streams); i++) { From 2bec71654b05b2fdcab750b8ca27cf14a31fe55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 28 Apr 2023 11:53:27 +0200 Subject: [PATCH 1170/1506] winegstreamer/new_media_source: Handle GST_EVENT_STREAM_START and create wg_source streams. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index be40a20f3af..f4481166d26 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -254,6 +254,38 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu return GST_FLOW_EOS; } +static gboolean sink_event_stream_start(struct wg_source *source, GstPad *pad, GstEvent *event) +{ + guint group, flags; + GstStream *stream; + const gchar *id; + + gst_event_parse_stream_start(event, &id); + gst_event_parse_stream(event, &stream); + gst_event_parse_stream_flags(event, &flags); + if (!gst_event_parse_group_id(event, &group)) + group = -1; + + GST_TRACE("source %p, pad %p, stream %p, id %s, flags %#x, group %d", + source, pad, stream, id, flags, group); + + gst_event_unref(event); + return true; +} + +static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +{ + struct wg_source *source = gst_pad_get_element_private(pad); + + switch (GST_EVENT_TYPE(event)) + { + case GST_EVENT_STREAM_START: + return sink_event_stream_start(source, pad, event); + default: + return gst_pad_event_default(pad, parent, event); + } +} + static GstEvent *create_stream_start_event(const char *stream_id) { GstStream *stream; @@ -273,7 +305,10 @@ static GstEvent *create_stream_start_event(const char *stream_id) static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) { struct wg_source *source = user; + char stream_id[256]; + GstFlowReturn ret; GstPad *sink_pad; + GstEvent *event; guint index; GST_TRACE("source %p, element %p, pad %p.", source, element, pad); @@ -286,6 +321,18 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) sink_pad = source->streams[index].pad; if (gst_pad_link(pad, sink_pad) < 0 || !gst_pad_set_active(sink_pad, true)) GST_ERROR("Failed to link new pad to sink pad %p", sink_pad); + + snprintf(stream_id, ARRAY_SIZE(stream_id), "wg_source/%03u", index); + if (!(event = create_stream_start_event(stream_id))) + GST_ERROR("Failed to create stream event for sink pad %p", sink_pad); + else + { + if ((ret = gst_pad_store_sticky_event(pad, event)) < 0) + GST_ERROR("Failed to create pad %p stream, ret %d", sink_pad, ret); + if ((ret = gst_pad_store_sticky_event(sink_pad, event)) < 0) + GST_ERROR("Failed to create pad %p stream, ret %d", sink_pad, ret); + gst_event_unref(event); + } } NTSTATUS wg_source_create(void *args) @@ -325,6 +372,7 @@ NTSTATUS wg_source_create(void *args) goto error; gst_pad_set_element_private(source->streams[i].pad, source); gst_pad_set_chain_function(source->streams[i].pad, sink_chain_cb); + gst_pad_set_event_function(source->streams[i].pad, sink_event_cb); } if (!(any_caps = gst_caps_new_any())) From c9ac74b6efc6b8546332f022f8a929f0b253147b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 18 Jun 2023 22:56:43 +0200 Subject: [PATCH 1171/1506] winegstreamer/new_media_source: Query stream duration from GST_EVENT_STREAM_START. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index f4481166d26..2353d5f3201 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -53,6 +53,7 @@ struct wg_source GstElement *container; GstSegment segment; bool valid_segment; + guint64 max_duration; guint stream_count; struct source_stream streams[WG_SOURCE_MAX_STREAMS]; @@ -258,6 +259,7 @@ static gboolean sink_event_stream_start(struct wg_source *source, GstPad *pad, G { guint group, flags; GstStream *stream; + gint64 duration; const gchar *id; gst_event_parse_stream_start(event, &id); @@ -266,8 +268,11 @@ static gboolean sink_event_stream_start(struct wg_source *source, GstPad *pad, G if (!gst_event_parse_group_id(event, &group)) group = -1; - GST_TRACE("source %p, pad %p, stream %p, id %s, flags %#x, group %d", - source, pad, stream, id, flags, group); + if (gst_pad_peer_query_duration(pad, GST_FORMAT_TIME, &duration) && GST_CLOCK_TIME_IS_VALID(duration)) + source->max_duration = max(source->max_duration, duration); + + GST_TRACE("source %p, pad %p, stream %p, id %s, flags %#x, group %d, duration %" GST_TIME_FORMAT, + source, pad, stream, id, flags, group, GST_TIME_ARGS(duration)); gst_event_unref(event); return true; From 3af9d0ae13f22a974be14581c3082e46a4377e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 28 Apr 2023 12:20:15 +0200 Subject: [PATCH 1172/1506] winegstreamer/new_media_source: Handle GST_EVENT_CAPS and update wg_source streams caps. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 2353d5f3201..40d75332975 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -255,6 +255,28 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu return GST_FLOW_EOS; } +static gboolean sink_event_caps(struct wg_source *source, GstPad *pad, GstEvent *event) +{ + GstStream *stream; + GstCaps *caps; + gchar *str; + + gst_event_parse_caps(event, &caps); + str = gst_caps_to_string(caps); + GST_TRACE("source %p, pad %p, caps %s", source, pad, str); + g_free(str); + + if ((stream = gst_pad_get_stream(pad))) + { + gst_stream_set_caps(stream, gst_caps_copy(caps)); + gst_stream_set_stream_type(stream, stream_type_from_caps(caps)); + gst_object_unref(stream); + } + + gst_event_unref(event); + return !!stream; +} + static gboolean sink_event_stream_start(struct wg_source *source, GstPad *pad, GstEvent *event) { guint group, flags; @@ -284,6 +306,8 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) switch (GST_EVENT_TYPE(event)) { + case GST_EVENT_CAPS: + return sink_event_caps(source, pad, event); case GST_EVENT_STREAM_START: return sink_event_stream_start(source, pad, event); default: From 44ca3c960a8f62c76194aeb7822fd041078aacde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 18 Jun 2023 15:13:06 +0200 Subject: [PATCH 1173/1506] winegstreamer/new_media_source: Introduce a new wg_source_get_stream_count unix call. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 22 ++++++++++++++++ dlls/winegstreamer/new_media_source.c | 7 ++++-- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 7 ++++++ dlls/winegstreamer/wg_parser.c | 2 ++ dlls/winegstreamer/wg_source.c | 36 +++++++++++++++++++++++++++ 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index c09c367a66b..1a87e8600b4 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -106,6 +106,7 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, const void *data, uint32_t size, wg_source_t *out); void wg_source_destroy(wg_source_t source); +HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); wg_transform_t wg_transform_create(const struct wg_format *input_format, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 502d77d826a..b98874dd39a 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -377,6 +377,28 @@ void wg_source_destroy(wg_source_t source) WINE_UNIX_CALL(unix_wg_source_destroy, &source); } +HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count) +{ + struct wg_source_get_stream_count_params params = + { + .source = source, + }; + NTSTATUS status; + + TRACE("source %#I64x, stream_count %p\n", source, stream_count); + + if ((status = WINE_UNIX_CALL(unix_wg_source_get_stream_count, ¶ms)) + && status != STATUS_PENDING) + { + WARN("wg_source_get_stream_count returned status %#lx\n", status); + return HRESULT_FROM_NT(status); + } + + *stream_count = params.stream_count; + TRACE("source %#I64x, stream_count %u\n", source, *stream_count); + return S_OK; +} + HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size) { struct wg_source_push_data_params params = diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 1d177cca6f9..45893b397d4 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -41,6 +41,7 @@ struct object_context BYTE *buffer; wg_source_t wg_source; + UINT32 stream_count; }; static struct object_context *impl_from_IUnknown(IUnknown *iface) @@ -1735,7 +1736,7 @@ static void media_source_init_descriptors(struct media_source *source) static HRESULT media_source_create(struct object_context *context, IMFMediaSource **out) { - unsigned int stream_count = UINT_MAX; + UINT32 stream_count; struct media_source *object; wg_parser_t parser; unsigned int i; @@ -1831,7 +1832,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc free(object->descriptors); free(object->streams); - if (stream_count != UINT_MAX) + if (object->state == SOURCE_OPENING) wg_parser_disconnect(object->wg_parser); if (object->read_thread) { @@ -2137,6 +2138,8 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = wg_source_push_data(context->wg_source, context->buffer, size))) WARN("Failed to push wg_source data, hr %#lx\n", hr); + else if (FAILED(hr = wg_source_get_stream_count(context->wg_source, &context->stream_count))) + WARN("Failed to get wg_source status, hr %#lx\n", hr); else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 6aa7ef92f38..e2f56dbd55b 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -61,6 +61,7 @@ extern GstCaps *wg_format_to_caps(const struct wg_format *format); extern NTSTATUS wg_source_create(void *args); extern NTSTATUS wg_source_destroy(void *args); +extern NTSTATUS wg_source_get_stream_count(void *args); extern NTSTATUS wg_source_push_data(void *args); /* wg_transform.c */ diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 140308436a3..09bd01eac99 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -350,6 +350,12 @@ struct wg_source_create_params wg_source_t source; }; +struct wg_source_get_stream_count_params +{ + wg_source_t source; + UINT32 stream_count; +}; + struct wg_source_push_data_params { wg_source_t source; @@ -469,6 +475,7 @@ enum unix_funcs unix_wg_source_create, unix_wg_source_destroy, + unix_wg_source_get_stream_count, unix_wg_source_push_data, unix_wg_transform_create, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 5c613a66f45..e14a1f52643 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2208,6 +2208,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_create), X(wg_source_destroy), + X(wg_source_get_stream_count), X(wg_source_push_data), X(wg_transform_create), @@ -2585,6 +2586,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X64(wg_source_create), X(wg_source_destroy), + X(wg_source_get_stream_count), X64(wg_source_push_data), X64(wg_transform_create), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 40d75332975..82cfd6acfbb 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -120,6 +120,22 @@ static GstBuffer *create_buffer_from_bytes(const void *data, guint size) return buffer; } +static GstStream *source_get_stream(struct wg_source *source, guint index) +{ + return index >= source->stream_count ? NULL : gst_pad_get_stream(source->streams[index].pad); +} + +static GstCaps *source_get_stream_caps(struct wg_source *source, guint index) +{ + GstStream *stream; + GstCaps *caps; + if (!(stream = source_get_stream(source, index))) + return NULL; + caps = gst_stream_get_caps(stream); + gst_object_unref(stream); + return caps; +} + static gboolean src_event_seek(struct wg_source *source, GstEvent *event) { guint32 seqnum = gst_event_get_seqnum(event); @@ -484,6 +500,26 @@ NTSTATUS wg_source_destroy(void *args) return STATUS_SUCCESS; } +NTSTATUS wg_source_get_stream_count(void *args) +{ + struct wg_source_get_stream_count_params *params = args; + struct wg_source *source = get_source(params->source); + UINT i, stream_count; + GstCaps *caps; + + GST_TRACE("source %p", source); + + for (i = 0, stream_count = source->stream_count; i < stream_count; i++) + { + if (!(caps = source_get_stream_caps(source, i))) + return STATUS_PENDING; + gst_caps_unref(caps); + } + + params->stream_count = stream_count; + return STATUS_SUCCESS; +} + NTSTATUS wg_source_push_data(void *args) { struct wg_source_push_data_params *params = args; From 799afbf42ef00226972b257e96202258b0600ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 18 Jun 2023 15:14:14 +0200 Subject: [PATCH 1174/1506] winegstreamer/new_media_source: Set the MF_PD_TOTAL_FILE_SIZE presentation descriptor attribute. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 45893b397d4..db2a661b6ff 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -1559,6 +1559,8 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * hr = MF_E_SHUTDOWN; else if (SUCCEEDED(hr = MFCreatePresentationDescriptor(source->stream_count, source->descriptors, descriptor))) { + if (FAILED(hr = IMFPresentationDescriptor_SetUINT64(*descriptor, &MF_PD_TOTAL_FILE_SIZE, source->file_size))) + WARN("Failed to set presentation descriptor MF_PD_TOTAL_FILE_SIZE, hr %#lx\n", hr); if (FAILED(hr = IMFPresentationDescriptor_SetUINT64(*descriptor, &MF_PD_DURATION, source->duration))) WARN("Failed to set presentation descriptor MF_PD_DURATION, hr %#lx\n", hr); From ce316c3ea31b13a67fcc323b0e18d21e9cb9cc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 24 Jul 2023 14:06:25 +0200 Subject: [PATCH 1175/1506] winegstreamer/new_media_source: Read stream data and provide samples to wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 22 ++++++++++++++++++++++ dlls/winegstreamer/new_media_source.c | 20 +++++++++++++++++++- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 7 +++++++ dlls/winegstreamer/wg_parser.c | 2 ++ dlls/winegstreamer/wg_source.c | 11 +++++++++++ 7 files changed, 63 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 1a87e8600b4..dd7e2d18817 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -107,6 +107,7 @@ HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, const void *data, uint32_t size, wg_source_t *out); void wg_source_destroy(wg_source_t source); HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count); +HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); wg_transform_t wg_transform_create(const struct wg_format *input_format, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index b98874dd39a..f656bbacb98 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -399,6 +399,28 @@ HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count) return S_OK; } +HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset) +{ + struct wg_source_get_position_params params = + { + .source = source, + }; + NTSTATUS status; + + TRACE("source %#I64x, read_offset %p\n", source, read_offset); + + if ((status = WINE_UNIX_CALL(unix_wg_source_get_position, ¶ms)) + && status != STATUS_PENDING) + { + WARN("wg_source_get_position returned status %#lx\n", status); + return HRESULT_FROM_NT(status); + } + + *read_offset = params.read_offset; + TRACE("source %#I64x, read_offset %#I64x\n", source, *read_offset); + return S_OK; +} + HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size) { struct wg_source_push_data_params params = diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index db2a661b6ff..03def5550de 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -2127,6 +2127,7 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM IUnknown *object, *state = IMFAsyncResult_GetStateNoAddRef(result); struct object_context *context; struct result_entry *entry; + UINT64 read_offset; DWORD size = 0; HRESULT hr; @@ -2135,13 +2136,30 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM if (FAILED(hr = IMFByteStream_EndRead(context->stream, result, &size))) WARN("Failed to complete stream read, hr %#lx\n", hr); - else if (FAILED(hr = wg_source_create(context->url, context->file_size, + else if (!context->wg_source && FAILED(hr = wg_source_create(context->url, context->file_size, context->buffer, size, &context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = wg_source_push_data(context->wg_source, context->buffer, size))) WARN("Failed to push wg_source data, hr %#lx\n", hr); else if (FAILED(hr = wg_source_get_stream_count(context->wg_source, &context->stream_count))) WARN("Failed to get wg_source status, hr %#lx\n", hr); + else if (!context->stream_count) + { + QWORD position, offset; + if (FAILED(hr = wg_source_get_position(context->wg_source, &read_offset))) + WARN("Failed to get wg_source position, hr %#lx\n", hr); + else if (FAILED(hr = IMFByteStream_GetCurrentPosition(context->stream, &position))) + WARN("Failed to get current byte stream position, hr %#lx\n", hr); + else if (position != (offset = min(read_offset, context->file_size)) + && FAILED(hr = IMFByteStream_SetCurrentPosition(context->stream, offset))) + WARN("Failed to set current byte stream position, hr %#lx\n", hr); + else + { + UINT32 read_size = min(SOURCE_BUFFER_SIZE, context->file_size - offset); + return IMFByteStream_BeginRead(context->stream, context->buffer, read_size, + &handler->IMFAsyncCallback_iface, state); + } + } else if (FAILED(hr = media_source_create(context, (IMFMediaSource **)&object))) WARN("Failed to create media source, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index e2f56dbd55b..e6167fef1df 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -62,6 +62,7 @@ extern GstCaps *wg_format_to_caps(const struct wg_format *format); extern NTSTATUS wg_source_create(void *args); extern NTSTATUS wg_source_destroy(void *args); extern NTSTATUS wg_source_get_stream_count(void *args); +extern NTSTATUS wg_source_get_position(void *args); extern NTSTATUS wg_source_push_data(void *args); /* wg_transform.c */ diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 09bd01eac99..7cb71ea9054 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -356,6 +356,12 @@ struct wg_source_get_stream_count_params UINT32 stream_count; }; +struct wg_source_get_position_params +{ + wg_source_t source; + UINT64 read_offset; +}; + struct wg_source_push_data_params { wg_source_t source; @@ -476,6 +482,7 @@ enum unix_funcs unix_wg_source_create, unix_wg_source_destroy, unix_wg_source_get_stream_count, + unix_wg_source_get_position, unix_wg_source_push_data, unix_wg_transform_create, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index e14a1f52643..043af8a32d2 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2209,6 +2209,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_create), X(wg_source_destroy), X(wg_source_get_stream_count), + X(wg_source_get_position), X(wg_source_push_data), X(wg_transform_create), @@ -2587,6 +2588,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X64(wg_source_create), X(wg_source_destroy), X(wg_source_get_stream_count), + X(wg_source_get_position), X64(wg_source_push_data), X64(wg_transform_create), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 82cfd6acfbb..9906e8c51c6 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -520,6 +520,17 @@ NTSTATUS wg_source_get_stream_count(void *args) return STATUS_SUCCESS; } +NTSTATUS wg_source_get_position(void *args) +{ + struct wg_source_get_position_params *params = args; + struct wg_source *source = get_source(params->source); + + GST_TRACE("source %p", source); + + params->read_offset = source->segment.start; + return STATUS_SUCCESS; +} + NTSTATUS wg_source_push_data(void *args) { struct wg_source_push_data_params *params = args; From 9ce1f5f7f495546e3b234f0997ce56b27254b5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 29 Nov 2023 18:02:55 +0100 Subject: [PATCH 1176/1506] winegstreamer/new_media_source: Query the stream max duration from the wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 22 ++++++++++++++++++++++ dlls/winegstreamer/new_media_source.c | 4 ++-- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 7 +++++++ dlls/winegstreamer/wg_parser.c | 2 ++ dlls/winegstreamer/wg_source.c | 11 +++++++++++ 7 files changed, 46 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index dd7e2d18817..5c23483e332 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -107,6 +107,7 @@ HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, const void *data, uint32_t size, wg_source_t *out); void wg_source_destroy(wg_source_t source); HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count); +HRESULT wg_source_get_duration(wg_source_t source, uint64_t *duration); HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index f656bbacb98..1c5c2bec819 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -399,6 +399,28 @@ HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count) return S_OK; } +HRESULT wg_source_get_duration(wg_source_t source, uint64_t *duration) +{ + struct wg_source_get_duration_params params = + { + .source = source, + }; + NTSTATUS status; + + TRACE("source %#I64x, duration %p\n", source, duration); + + if ((status = WINE_UNIX_CALL(unix_wg_source_get_duration, ¶ms)) + && status != STATUS_PENDING) + { + WARN("wg_source_get_duration returned status %#lx\n", status); + return HRESULT_FROM_NT(status); + } + + *duration = params.duration; + TRACE("source %#I64x, duration %s\n", source, debugstr_time(*duration)); + return S_OK; +} + HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset) { struct wg_source_get_position_params params = diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 03def5550de..1ecc6cba040 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -1765,9 +1765,10 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) goto fail; - if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue))) goto fail; + if (FAILED(hr = wg_source_get_duration(object->wg_source, &object->duration))) + goto fail; if (!(parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE, FALSE))) { @@ -1808,7 +1809,6 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc goto fail; } - object->duration = max(object->duration, wg_parser_stream_get_duration(wg_stream)); IMFStreamDescriptor_AddRef(descriptor); object->descriptors[i] = descriptor; object->streams[i] = stream; diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index e6167fef1df..df3bda1cad3 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -62,6 +62,7 @@ extern GstCaps *wg_format_to_caps(const struct wg_format *format); extern NTSTATUS wg_source_create(void *args); extern NTSTATUS wg_source_destroy(void *args); extern NTSTATUS wg_source_get_stream_count(void *args); +extern NTSTATUS wg_source_get_duration(void *args); extern NTSTATUS wg_source_get_position(void *args); extern NTSTATUS wg_source_push_data(void *args); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 7cb71ea9054..aabc915ebc2 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -356,6 +356,12 @@ struct wg_source_get_stream_count_params UINT32 stream_count; }; +struct wg_source_get_duration_params +{ + wg_source_t source; + UINT64 duration; +}; + struct wg_source_get_position_params { wg_source_t source; @@ -482,6 +488,7 @@ enum unix_funcs unix_wg_source_create, unix_wg_source_destroy, unix_wg_source_get_stream_count, + unix_wg_source_get_duration, unix_wg_source_get_position, unix_wg_source_push_data, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 043af8a32d2..1f6ca1a5ccd 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2209,6 +2209,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_create), X(wg_source_destroy), X(wg_source_get_stream_count), + X(wg_source_get_duration), X(wg_source_get_position), X(wg_source_push_data), @@ -2588,6 +2589,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X64(wg_source_create), X(wg_source_destroy), X(wg_source_get_stream_count), + X(wg_source_get_duration), X(wg_source_get_position), X64(wg_source_push_data), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 9906e8c51c6..ee9d7f2c9a0 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -520,6 +520,17 @@ NTSTATUS wg_source_get_stream_count(void *args) return STATUS_SUCCESS; } +NTSTATUS wg_source_get_duration(void *args) +{ + struct wg_source_get_duration_params *params = args; + struct wg_source *source = get_source(params->source); + + GST_TRACE("source %p", source); + + params->duration = source->max_duration / 100; + return STATUS_SUCCESS; +} + NTSTATUS wg_source_get_position(void *args) { struct wg_source_get_position_params *params = args; From 384697267b5594100791ab23f12a3a545f8498d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 24 Jul 2023 14:12:21 +0200 Subject: [PATCH 1177/1506] winegstreamer/new_media_source: Set the MF_PD_MIME_TYPE presentation descriptor attribute. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 3 ++- dlls/winegstreamer/main.c | 8 +++++--- dlls/winegstreamer/new_media_source.c | 7 ++++++- dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_parser.c | 2 ++ dlls/winegstreamer/wg_source.c | 9 +++++++++ 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 5c23483e332..4af76cc4371 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -104,7 +104,8 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, uint64_t start_pos, uint64_t stop_pos, DWORD start_flags, DWORD stop_flags); HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, - const void *data, uint32_t size, wg_source_t *out); + const void *data, uint32_t size, WCHAR mime_type[256], + wg_source_t *out); void wg_source_destroy(wg_source_t source); HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count); HRESULT wg_source_get_duration(wg_source_t source, uint64_t *duration); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 1c5c2bec819..0b2bdbf299e 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -341,7 +341,8 @@ void wg_parser_stream_seek(wg_parser_stream_t stream, double rate, } HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, - const void *data, uint32_t size, wg_source_t *out) + const void *data, uint32_t size, WCHAR mime_type[256], + wg_source_t *out) { struct wg_source_create_params params = { @@ -352,8 +353,8 @@ HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, char *tmp = url ? malloc(len) : NULL; NTSTATUS status; - TRACE("url %s, file_size %#I64x, data %p, size %#x\n", debugstr_w(url), - file_size, data, size); + TRACE("url %s, file_size %#I64x, data %p, size %#x, mime_type %p\n", debugstr_w(url), + file_size, data, size, mime_type); if ((params.url = tmp)) WideCharToMultiByte(CP_ACP, 0, url, -1, tmp, len, NULL, NULL); @@ -363,6 +364,7 @@ HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, else { TRACE("Returning source %#I64x.\n", params.source); + MultiByteToWideChar(CP_ACP, 0, params.mime_type, -1, mime_type, 256); *out = params.source; } diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 1ecc6cba040..c279cfdd2f5 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -41,6 +41,7 @@ struct object_context BYTE *buffer; wg_source_t wg_source; + WCHAR mime_type[256]; UINT32 stream_count; }; @@ -302,6 +303,7 @@ struct media_source CRITICAL_SECTION cs; wg_source_t wg_source; + WCHAR mime_type[256]; UINT64 file_size; wg_parser_t wg_parser; UINT64 duration; @@ -1559,6 +1561,8 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * hr = MF_E_SHUTDOWN; else if (SUCCEEDED(hr = MFCreatePresentationDescriptor(source->stream_count, source->descriptors, descriptor))) { + if (FAILED(hr = IMFPresentationDescriptor_SetString(*descriptor, &MF_PD_MIME_TYPE, source->mime_type))) + WARN("Failed to set presentation descriptor MF_PD_MIME_TYPE, hr %#lx\n", hr); if (FAILED(hr = IMFPresentationDescriptor_SetUINT64(*descriptor, &MF_PD_TOTAL_FILE_SIZE, source->file_size))) WARN("Failed to set presentation descriptor MF_PD_TOTAL_FILE_SIZE, hr %#lx\n", hr); if (FAILED(hr = IMFPresentationDescriptor_SetUINT64(*descriptor, &MF_PD_DURATION, source->duration))) @@ -1755,6 +1759,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->ref = 1; object->byte_stream = context->stream; IMFByteStream_AddRef(context->stream); + wcscpy(object->mime_type, context->mime_type); object->file_size = context->file_size; object->rate = 1.0f; InitializeCriticalSection(&object->cs); @@ -2137,7 +2142,7 @@ static HRESULT WINAPI stream_handler_callback_Invoke(IMFAsyncCallback *iface, IM if (FAILED(hr = IMFByteStream_EndRead(context->stream, result, &size))) WARN("Failed to complete stream read, hr %#lx\n", hr); else if (!context->wg_source && FAILED(hr = wg_source_create(context->url, context->file_size, - context->buffer, size, &context->wg_source))) + context->buffer, size, context->mime_type, &context->wg_source))) WARN("Failed to create wg_source, hr %#lx\n", hr); else if (FAILED(hr = wg_source_push_data(context->wg_source, context->buffer, size))) WARN("Failed to push wg_source data, hr %#lx\n", hr); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index aabc915ebc2..f3111785dab 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -347,6 +347,7 @@ struct wg_source_create_params UINT64 file_size; const void *data; UINT32 size; + char mime_type[256]; wg_source_t source; }; diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 1f6ca1a5ccd..826fa4168bb 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2367,6 +2367,7 @@ NTSTATUS wow64_wg_source_create(void *args) PTR32 url; PTR32 data; UINT32 size; + char mime_type[256]; wg_source_t source; } *params32 = args; struct wg_source_create_params params = @@ -2378,6 +2379,7 @@ NTSTATUS wow64_wg_source_create(void *args) NTSTATUS ret; ret = wg_source_create(¶ms); + strcpy(params32->mime_type, params.mime_type); params32->source = params.source; return ret; } diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index ee9d7f2c9a0..ba82c2f107e 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -386,6 +386,7 @@ NTSTATUS wg_source_create(void *args) GstElement *first = NULL, *last = NULL, *element; GstCaps *src_caps, *any_caps; struct wg_source *source; + const gchar *media_type; GstEvent *event; GstPad *peer; guint i; @@ -401,6 +402,14 @@ NTSTATUS wg_source_create(void *args) gst_segment_init(&source->segment, GST_FORMAT_BYTES); source->segment.stop = params->file_size; + media_type = gst_structure_get_name(gst_caps_get_structure(src_caps, 0)); + if (!strcmp(media_type, "video/quicktime")) + strcpy(params->mime_type, "video/mp4"); + else if (!strcmp(media_type, "video/x-msvideo")) + strcpy(params->mime_type, "video/avi"); + else + lstrcpynA(params->mime_type, media_type, ARRAY_SIZE(params->mime_type)); + if (!(source->container = gst_bin_new("wg_source"))) goto error; GST_OBJECT_FLAG_SET(source->container, GST_BIN_FLAG_STREAMS_AWARE); From 7d40c1330d2f1934e2af370fc260e0732d3d970b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 29 Apr 2023 18:35:22 +0200 Subject: [PATCH 1178/1506] winegstreamer/new_media_source: Handle GST_EVENT_TAG and udpate wg_source streams tags. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_source.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index ba82c2f107e..1ef7bb7dff9 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -293,6 +293,31 @@ static gboolean sink_event_caps(struct wg_source *source, GstPad *pad, GstEvent return !!stream; } +static gboolean sink_event_tag(struct wg_source *source, GstPad *pad, GstEvent *event) +{ + GstTagList *new_tags; + GstStream *stream; + + gst_event_parse_tag(event, &new_tags); + GST_TRACE("source %p, pad %p, new_tags %p", source, pad, new_tags); + + if ((stream = gst_pad_get_stream(pad))) + { + GstTagList *old_tags = gst_stream_get_tags(stream); + if ((new_tags = gst_tag_list_merge(old_tags, new_tags, GST_TAG_MERGE_REPLACE))) + { + gst_stream_set_tags(stream, new_tags); + gst_tag_list_unref(new_tags); + } + if (old_tags) + gst_tag_list_unref(old_tags); + gst_object_unref(stream); + } + + gst_event_unref(event); + return stream && new_tags; +} + static gboolean sink_event_stream_start(struct wg_source *source, GstPad *pad, GstEvent *event) { guint group, flags; @@ -324,6 +349,8 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) { case GST_EVENT_CAPS: return sink_event_caps(source, pad, event); + case GST_EVENT_TAG: + return sink_event_tag(source, pad, event); case GST_EVENT_STREAM_START: return sink_event_stream_start(source, pad, event); default: From 3faccf27b0b44d33e98bb454201977f778f2c291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 19 Nov 2023 16:53:47 +0100 Subject: [PATCH 1179/1506] winegstreamer/new_media_source: Use wg_source order to build media source streams. And map them to wg_parser streams according to their format. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 2 + dlls/winegstreamer/main.c | 19 ++++++++ dlls/winegstreamer/new_media_source.c | 64 ++++++++++++++++++++++++--- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 8 ++++ dlls/winegstreamer/wg_parser.c | 2 + dlls/winegstreamer/wg_source.c | 18 ++++++++ 7 files changed, 108 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 4af76cc4371..b1c482d0250 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -111,6 +111,8 @@ HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count); HRESULT wg_source_get_duration(wg_source_t source, uint64_t *duration); HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); +bool wg_source_get_stream_format(wg_source_t source, UINT32 index, + struct wg_format *format); wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 0b2bdbf299e..5f7a5bcb8d8 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -459,6 +459,25 @@ HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size) return HRESULT_FROM_NT(WINE_UNIX_CALL(unix_wg_source_push_data, ¶ms)); } +bool wg_source_get_stream_format(wg_source_t source, UINT32 index, + struct wg_format *format) +{ + struct wg_source_get_stream_format_params params = + { + .source = source, + .index = index, + }; + + TRACE("source %#I64x, index %u, format %p\n", source, + index, format); + + if (WINE_UNIX_CALL(unix_wg_source_get_stream_format, ¶ms)) + return false; + + *format = params.format; + return true; +} + wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs) { diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index c279cfdd2f5..11965d58d24 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -1721,6 +1721,50 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = media_source_Shutdown, }; +static HRESULT map_stream_to_wg_parser_stream(struct media_source *source, UINT stream_count, + wg_parser_stream_t *parser_streams, wg_parser_stream_t parser_stream) +{ + struct wg_format parser_format, source_format; + HRESULT hr; + UINT i; + + wg_parser_stream_get_preferred_format(parser_stream, &parser_format); + + for (i = 0; i < stream_count; i++) + { + if (parser_streams[i]) + continue; + if (FAILED(hr = wg_source_get_stream_format(source->wg_source, i, &source_format))) + return hr; + if ((parser_format.major_type >= WG_MAJOR_TYPE_VIDEO) != (source_format.major_type >= WG_MAJOR_TYPE_VIDEO) + || (parser_format.major_type >= WG_MAJOR_TYPE_AUDIO) != (source_format.major_type >= WG_MAJOR_TYPE_AUDIO)) + continue; + + TRACE("Mapped stream %#I64x with descriptor %u\n", parser_stream, i); + parser_streams[i] = parser_stream; + return S_OK; + } + + return E_FAIL; +} + +static void media_source_init_parser_streams(struct media_source *source, UINT stream_count, + wg_parser_stream_t *parser_streams) +{ + wg_parser_stream_t parser_stream; + UINT i, parser_stream_count; + HRESULT hr; + + parser_stream_count = wg_parser_get_stream_count(source->wg_parser); + for (i = 0; i < parser_stream_count; i++) + { + if (!(parser_stream = wg_parser_get_stream(source->wg_parser, i))) + continue; + if (FAILED(hr = map_stream_to_wg_parser_stream(source, stream_count, parser_streams, parser_stream))) + WARN("Failed to map parser stream %u, hr %#lx\n", i, hr); + } +} + static void media_source_init_descriptors(struct media_source *source) { HRESULT hr = S_OK; @@ -1742,7 +1786,8 @@ static void media_source_init_descriptors(struct media_source *source) static HRESULT media_source_create(struct object_context *context, IMFMediaSource **out) { - UINT32 stream_count; + UINT32 stream_count = context->stream_count; + wg_parser_stream_t *parser_streams = NULL; struct media_source *object; wg_parser_t parser; unsigned int i; @@ -1789,26 +1834,30 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (FAILED(hr = wg_parser_connect(parser, object->file_size, NULL))) goto fail; - stream_count = wg_parser_get_stream_count(parser); - if (!(object->descriptors = calloc(stream_count, sizeof(*object->descriptors))) + || !(parser_streams = calloc(stream_count, sizeof(*parser_streams))) || !(object->streams = calloc(stream_count, sizeof(*object->streams)))) { hr = E_OUTOFMEMORY; goto fail; } + media_source_init_parser_streams(object, stream_count, parser_streams); + for (i = 0; i < stream_count; ++i) { - wg_parser_stream_t wg_stream = wg_parser_get_stream(object->wg_parser, i); + wg_parser_stream_t parser_stream; IMFStreamDescriptor *descriptor; struct media_stream *stream; struct wg_format format; - wg_parser_stream_get_preferred_format(wg_stream, &format); + if (!(parser_stream = parser_streams[i])) + continue; + wg_parser_stream_get_preferred_format(parser_stream, &format); + if (FAILED(hr = stream_descriptor_create(i, &format, &descriptor))) goto fail; - if (FAILED(hr = media_stream_create(&object->IMFMediaSource_iface, descriptor, wg_stream, &stream))) + if (FAILED(hr = media_stream_create(&object->IMFMediaSource_iface, descriptor, parser_stream, &stream))) { IMFStreamDescriptor_Release(descriptor); goto fail; @@ -1820,6 +1869,8 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->stream_count++; } + free(parser_streams); + media_source_init_descriptors(object); object->state = SOURCE_STOPPED; @@ -1836,6 +1887,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc IMFStreamDescriptor_Release(object->descriptors[object->stream_count]); IMFMediaStream_Release(&stream->IMFMediaStream_iface); } + free(parser_streams); free(object->descriptors); free(object->streams); diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index df3bda1cad3..646d1a90f0f 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -65,6 +65,7 @@ extern NTSTATUS wg_source_get_stream_count(void *args); extern NTSTATUS wg_source_get_duration(void *args); extern NTSTATUS wg_source_get_position(void *args); extern NTSTATUS wg_source_push_data(void *args); +extern NTSTATUS wg_source_get_stream_format(void *args); /* wg_transform.c */ diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index f3111785dab..f85e6eb74b0 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -376,6 +376,13 @@ struct wg_source_push_data_params UINT32 size; }; +struct wg_source_get_stream_format_params +{ + wg_source_t source; + UINT32 index; + struct wg_format format; +}; + struct wg_transform_attrs { UINT32 output_plane_align; @@ -492,6 +499,7 @@ enum unix_funcs unix_wg_source_get_duration, unix_wg_source_get_position, unix_wg_source_push_data, + unix_wg_source_get_stream_format, unix_wg_transform_create, unix_wg_transform_destroy, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 826fa4168bb..fe263ac49c4 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2212,6 +2212,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_get_duration), X(wg_source_get_position), X(wg_source_push_data), + X(wg_source_get_stream_format), X(wg_transform_create), X(wg_transform_destroy), @@ -2594,6 +2595,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X(wg_source_get_duration), X(wg_source_get_position), X64(wg_source_push_data), + X(wg_source_get_stream_format), X64(wg_transform_create), X(wg_transform_destroy), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 1ef7bb7dff9..f6a01413c42 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -628,3 +628,21 @@ NTSTATUS wg_source_push_data(void *args) return STATUS_SUCCESS; } + +NTSTATUS wg_source_get_stream_format(void *args) +{ + struct wg_source_get_stream_format_params *params = args; + struct wg_source *source = get_source(params->source); + guint index = params->index; + GstCaps *caps; + + GST_TRACE("source %p, index %u", source, index); + + if (!(caps = source_get_stream_caps(source, index))) + return STATUS_UNSUCCESSFUL; + wg_format_from_caps(¶ms->format, caps); + + gst_caps_unref(caps); + return STATUS_SUCCESS; +} + From 2638b0474dacbeff8215f841069bab3b9013a0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 19 Nov 2023 17:35:23 +0100 Subject: [PATCH 1180/1506] winegstreamer/new_media_source: Sort media source "video/mp4" streams by stream type. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 47 ++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 11965d58d24..4bd379d3bb6 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -311,6 +311,7 @@ struct media_source IMFStreamDescriptor **descriptors; struct media_stream **streams; ULONG stream_count; + UINT *stream_map; enum { @@ -1694,6 +1695,7 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) IMFMediaEventQueue_Shutdown(stream->event_queue); IMFMediaStream_Release(&stream->IMFMediaStream_iface); } + free(source->stream_map); free(source->descriptors); free(source->streams); @@ -1734,7 +1736,7 @@ static HRESULT map_stream_to_wg_parser_stream(struct media_source *source, UINT { if (parser_streams[i]) continue; - if (FAILED(hr = wg_source_get_stream_format(source->wg_source, i, &source_format))) + if (FAILED(hr = wg_source_get_stream_format(source->wg_source, source->stream_map[i], &source_format))) return hr; if ((parser_format.major_type >= WG_MAJOR_TYPE_VIDEO) != (source_format.major_type >= WG_MAJOR_TYPE_VIDEO) || (parser_format.major_type >= WG_MAJOR_TYPE_AUDIO) != (source_format.major_type >= WG_MAJOR_TYPE_AUDIO)) @@ -1765,6 +1767,46 @@ static void media_source_init_parser_streams(struct media_source *source, UINT s } } +static void media_source_init_stream_map(struct media_source *source, UINT stream_count) +{ + struct wg_format format; + int i, n = 0; + + if (wcscmp(source->mime_type, L"video/mp4")) + { + for (i = stream_count - 1; i >= 0; i--) + { + TRACE("mapping stream %u to wg_source stream %u\n", i, i); + source->stream_map[i] = i; + } + return; + } + + for (i = stream_count - 1; i >= 0; i--) + { + wg_source_get_stream_format(source->wg_source, i, &format); + if (format.major_type == WG_MAJOR_TYPE_UNKNOWN) continue; + if (format.major_type >= WG_MAJOR_TYPE_VIDEO) continue; + TRACE("mapping stream %u to wg_source stream %u\n", n, i); + source->stream_map[n++] = i; + } + for (i = stream_count - 1; i >= 0; i--) + { + wg_source_get_stream_format(source->wg_source, i, &format); + if (format.major_type == WG_MAJOR_TYPE_UNKNOWN) continue; + if (format.major_type < WG_MAJOR_TYPE_VIDEO) continue; + TRACE("mapping stream %u to wg_source stream %u\n", n, i); + source->stream_map[n++] = i; + } + for (i = stream_count - 1; i >= 0; i--) + { + wg_source_get_stream_format(source->wg_source, i, &format); + if (format.major_type != WG_MAJOR_TYPE_UNKNOWN) continue; + TRACE("mapping stream %u to wg_source stream %u\n", n, i); + source->stream_map[n++] = i; + } +} + static void media_source_init_descriptors(struct media_source *source) { HRESULT hr = S_OK; @@ -1836,12 +1878,14 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (!(object->descriptors = calloc(stream_count, sizeof(*object->descriptors))) || !(parser_streams = calloc(stream_count, sizeof(*parser_streams))) + || !(object->stream_map = calloc(stream_count, sizeof(*object->stream_map))) || !(object->streams = calloc(stream_count, sizeof(*object->streams)))) { hr = E_OUTOFMEMORY; goto fail; } + media_source_init_stream_map(object, stream_count); media_source_init_parser_streams(object, stream_count, parser_streams); for (i = 0; i < stream_count; ++i) @@ -1888,6 +1932,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc IMFMediaStream_Release(&stream->IMFMediaStream_iface); } free(parser_streams); + free(object->stream_map); free(object->descriptors); free(object->streams); From 10c14fa4effda9268127d2f4ccb02caa22db4c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 13 Mar 2023 12:24:48 +0100 Subject: [PATCH 1181/1506] winegstreamer/new_media_source: Initialize media source descriptor tags from wg_source. CW-Bug-Id: #21953 --- dlls/mfplay/tests/mfplay.c | 2 +- dlls/mfreadwrite/tests/mfplat.c | 8 +- dlls/winegstreamer/gst_private.h | 2 + dlls/winegstreamer/main.c | 29 ++++++ dlls/winegstreamer/new_media_source.c | 15 ++- dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 10 ++ dlls/winegstreamer/wg_parser.c | 24 +++++ dlls/winegstreamer/wg_source.c | 143 ++++++++++++++++++++++++++ 9 files changed, 221 insertions(+), 13 deletions(-) diff --git a/dlls/mfplay/tests/mfplay.c b/dlls/mfplay/tests/mfplay.c index fa66ccae57e..db23bb7de42 100644 --- a/dlls/mfplay/tests/mfplay.c +++ b/dlls/mfplay/tests/mfplay.c @@ -493,7 +493,7 @@ static void test_media_language(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); check_media_language(player, L"test-eng.mp4", L"en"); - check_media_language(player, L"test-ang.mp4", NULL); + todo_check_media_language(player, L"test-ang.mp4", NULL); check_media_language(player, L"test-und.mp4", NULL); check_media_language(player, L"test-en-US.mp4", L"en"); diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 08e19589ad1..2095d2f054d 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -949,7 +949,7 @@ static void test_source_reader(const char *filename, bool video) hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &actual_index, &stream_flags, ×tamp, &sample); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine_if (video) ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); + ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); ok(!(stream_flags & ~MF_SOURCE_READERF_ENDOFSTREAM), "Unexpected stream flags %#lx.\n", stream_flags); if (stream_flags & MF_SOURCE_READERF_ENDOFSTREAM) @@ -970,7 +970,7 @@ static void test_source_reader(const char *filename, bool video) hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &actual_index, &stream_flags, ×tamp, &sample); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(actual_index == 1, "Unexpected stream index %lu.\n", actual_index); + ok(actual_index == 1, "Unexpected stream index %lu.\n", actual_index); ok(!(stream_flags & ~MF_SOURCE_READERF_ENDOFSTREAM), "Unexpected stream flags %#lx.\n", stream_flags); if (stream_flags & MF_SOURCE_READERF_ENDOFSTREAM) @@ -1001,7 +1001,7 @@ static void test_source_reader(const char *filename, bool video) hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, &actual_index, &stream_flags, ×tamp, &sample); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine_if (video) ok(actual_index == 0, "Unexpected stream index %lu.\n", actual_index); + ok(actual_index == 0, "Unexpected stream index %lu.\n", actual_index); ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#lx.\n", stream_flags); ok(!sample, "Unexpected sample object.\n"); @@ -1022,7 +1022,7 @@ static void test_source_reader(const char *filename, bool video) hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, MF_SOURCE_READER_CONTROLF_DRAIN, &actual_index, &stream_flags, NULL, &sample); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine_if (video) ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); + ok(!actual_index, "Unexpected stream index %lu.\n", actual_index); ok(stream_flags == MF_SOURCE_READERF_ENDOFSTREAM, "Unexpected stream flags %#lx.\n", stream_flags); ok(!sample, "Unexpected sample object.\n"); diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index b1c482d0250..df5f64660a2 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -113,6 +113,8 @@ HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); bool wg_source_get_stream_format(wg_source_t source, UINT32 index, struct wg_format *format); +char *wg_source_get_stream_tag(wg_source_t source, UINT32 index, + wg_parser_tag tag); wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 5f7a5bcb8d8..11e47b1b952 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -478,6 +478,35 @@ bool wg_source_get_stream_format(wg_source_t source, UINT32 index, return true; } +char *wg_source_get_stream_tag(wg_source_t source, UINT32 index, wg_parser_tag tag) +{ + struct wg_source_get_stream_tag_params params = + { + .source = source, + .index = index, + .tag = tag, + }; + char *buffer; + + TRACE("source %#I64x, index %u, tag %#I64x\n", source, index, tag); + + if (WINE_UNIX_CALL(unix_wg_source_get_stream_tag, ¶ms) != STATUS_BUFFER_TOO_SMALL) + return NULL; + if (!(buffer = malloc(params.size))) + { + ERR("No memory.\n"); + return NULL; + } + params.buffer = buffer; + if (WINE_UNIX_CALL(unix_wg_source_get_stream_tag, ¶ms)) + { + ERR("wg_source_get_stream_tag failed unexpectedly.\n"); + free(buffer); + return NULL; + } + return buffer; +} + wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs) { diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 4bd379d3bb6..9dbdf069caf 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -488,15 +488,15 @@ static HRESULT wg_format_from_stream_descriptor(IMFStreamDescriptor *descriptor, return hr; } -static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, wg_parser_stream_t stream, - const GUID *attr, enum wg_parser_tag tag) +static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, + wg_source_t source, UINT index, const GUID *attr, enum wg_parser_tag tag) { WCHAR *strW; HRESULT hr; DWORD len; char *str; - if (!(str = wg_parser_stream_get_tag(stream, tag)) + if (!(str = wg_source_get_stream_tag(source, index, tag)) || !(len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0))) hr = S_OK; else if (!(strW = malloc(len * sizeof(*strW)))) @@ -1809,18 +1809,17 @@ static void media_source_init_stream_map(struct media_source *source, UINT strea static void media_source_init_descriptors(struct media_source *source) { - HRESULT hr = S_OK; + HRESULT hr; UINT i; for (i = 0; i < source->stream_count; i++) { - struct media_stream *stream = source->streams[i]; - IMFStreamDescriptor *descriptor = stream->descriptor; + IMFStreamDescriptor *descriptor = source->descriptors[i]; - if (FAILED(hr = stream_descriptor_set_tag(descriptor, stream->wg_stream, + if (FAILED(hr = stream_descriptor_set_tag(descriptor, source->wg_source, source->stream_map[i], &MF_SD_LANGUAGE, WG_PARSER_TAG_LANGUAGE))) WARN("Failed to set stream descriptor language, hr %#lx\n", hr); - if (FAILED(hr = stream_descriptor_set_tag(descriptor, stream->wg_stream, + if (FAILED(hr = stream_descriptor_set_tag(descriptor, source->wg_source, source->stream_map[i], &MF_SD_STREAM_NAME, WG_PARSER_TAG_NAME))) WARN("Failed to set stream descriptor name, hr %#lx\n", hr); } diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 646d1a90f0f..7116e37d57f 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -66,6 +66,7 @@ extern NTSTATUS wg_source_get_duration(void *args); extern NTSTATUS wg_source_get_position(void *args); extern NTSTATUS wg_source_push_data(void *args); extern NTSTATUS wg_source_get_stream_format(void *args); +extern NTSTATUS wg_source_get_stream_tag(void *args); /* wg_transform.c */ diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index f85e6eb74b0..cb86c756ad0 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -383,6 +383,15 @@ struct wg_source_get_stream_format_params struct wg_format format; }; +struct wg_source_get_stream_tag_params +{ + wg_source_t source; + UINT32 index; + wg_parser_tag tag; + UINT32 size; + char *buffer; +}; + struct wg_transform_attrs { UINT32 output_plane_align; @@ -500,6 +509,7 @@ enum unix_funcs unix_wg_source_get_position, unix_wg_source_push_data, unix_wg_source_get_stream_format, + unix_wg_source_get_stream_tag, unix_wg_transform_create, unix_wg_transform_destroy, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index fe263ac49c4..114c4d38224 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2213,6 +2213,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_get_position), X(wg_source_push_data), X(wg_source_get_stream_format), + X(wg_source_get_stream_tag), X(wg_transform_create), X(wg_transform_destroy), @@ -2403,6 +2404,28 @@ NTSTATUS wow64_wg_source_push_data(void *args) return wg_source_push_data(¶ms); } +NTSTATUS wow64_wg_source_get_stream_tag(void *args) +{ + struct + { + wg_source_t source; + UINT32 index; + wg_parser_tag tag; + UINT32 size; + PTR32 buffer; + } *params32 = args; + struct wg_source_get_stream_tag_params params = + { + .source = params32->source, + .index = params32->index, + .tag = params32->tag, + .size = params32->size, + .buffer = ULongToPtr(params32->buffer), + }; + + return wg_source_get_stream_tag(¶ms); +} + NTSTATUS wow64_wg_transform_create(void *args) { struct @@ -2596,6 +2619,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X(wg_source_get_position), X64(wg_source_push_data), X(wg_source_get_stream_format), + X64(wg_source_get_stream_tag), X64(wg_transform_create), X(wg_transform_destroy), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index f6a01413c42..8201c12eb03 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -64,6 +64,14 @@ static struct wg_source *get_source(wg_source_t source) return (struct wg_source *)(ULONG_PTR)source; } +static const char *media_type_from_caps(GstCaps *caps) +{ + GstStructure *structure; + if (!caps || !(structure = gst_caps_get_structure(caps, 0))) + return ""; + return gst_structure_get_name(structure); +} + static GstCaps *detect_caps_from_data(const char *url, const void *data, guint size) { const char *extension = url ? strrchr(url, '.') : NULL; @@ -136,6 +144,17 @@ static GstCaps *source_get_stream_caps(struct wg_source *source, guint index) return caps; } +static GstTagList *source_get_stream_tags(struct wg_source *source, guint index) +{ + GstStream *stream; + GstTagList *tags; + if (!(stream = source_get_stream(source, index))) + return NULL; + tags = gst_stream_get_tags(stream); + gst_object_unref(stream); + return tags; +} + static gboolean src_event_seek(struct wg_source *source, GstEvent *event) { guint32 seqnum = gst_event_get_seqnum(event); @@ -646,3 +665,127 @@ NTSTATUS wg_source_get_stream_format(void *args) return STATUS_SUCCESS; } +static gchar *stream_lang_from_tags(GstTagList *tags, bool is_quicktime) +{ + gchar *value; + + if (!gst_tag_list_get_string(tags, GST_TAG_LANGUAGE_CODE, &value) || !value) + return NULL; + + if (is_quicktime) + { + /* For QuickTime media, we convert the language tags to ISO 639-1. */ + const gchar *lang_code_iso_639_1 = gst_tag_get_language_code_iso_639_1(value); + gchar *tmp = lang_code_iso_639_1 ? g_strdup(lang_code_iso_639_1) : NULL; + g_free(value); + value = tmp; + } + + return value; +} + +static gchar *stream_name_from_tags(GstTagList *tags) +{ + /* Extract stream name from Quick Time demuxer private tag where it puts unrecognized chunks. */ + guint i, tag_count = gst_tag_list_get_tag_size(tags, "private-qt-tag"); + gchar *value = NULL; + + for (i = 0; !value && i < tag_count; ++i) + { + const gchar *name; + const GValue *val; + GstSample *sample; + GstBuffer *buf; + gsize size; + + if (!(val = gst_tag_list_get_value_index(tags, "private-qt-tag", i))) + continue; + if (!GST_VALUE_HOLDS_SAMPLE(val) || !(sample = gst_value_get_sample(val))) + continue; + name = gst_structure_get_name(gst_sample_get_info(sample)); + if (!name || strcmp(name, "application/x-gst-qt-name-tag")) + continue; + if (!(buf = gst_sample_get_buffer(sample))) + continue; + if ((size = gst_buffer_get_size(buf)) < 8) + continue; + size -= 8; + if (!(value = g_malloc(size + 1))) + return NULL; + if (gst_buffer_extract(buf, 8, value, size) != size) + { + g_free(value); + value = NULL; + continue; + } + value[size] = 0; + } + + return value; +} + +NTSTATUS wg_source_get_stream_tag(void *args) +{ + struct wg_source_get_stream_tag_params *params = args; + struct wg_source *source = get_source(params->source); + enum wg_parser_tag tag = params->tag; + guint index = params->index; + GstTagList *tags; + NTSTATUS status; + uint32_t len; + gchar *value; + + GST_TRACE("source %p, index %u, tag %u", source, index, tag); + + if (params->tag >= WG_PARSER_TAG_COUNT) + return STATUS_INVALID_PARAMETER; + if (!(tags = source_get_stream_tags(source, index))) + return STATUS_UNSUCCESSFUL; + + switch (tag) + { + case WG_PARSER_TAG_LANGUAGE: + { + bool is_quicktime = false; + GstCaps *caps; + + if ((caps = gst_pad_get_current_caps(source->src_pad))) + { + is_quicktime = !strcmp(media_type_from_caps(caps), "video/quicktime"); + gst_caps_unref(caps); + } + + value = stream_lang_from_tags(tags, is_quicktime); + break; + } + case WG_PARSER_TAG_NAME: + value = stream_name_from_tags(tags); + break; + default: + GST_FIXME("Unsupported stream tag %u", tag); + value = NULL; + break; + } + + if (!value) + goto error; + + if ((len = strlen(value) + 1) > params->size) + { + params->size = len; + status = STATUS_BUFFER_TOO_SMALL; + } + else + { + memcpy(params->buffer, value, len); + status = STATUS_SUCCESS; + } + + gst_tag_list_unref(tags); + g_free(value); + return status; + +error: + gst_tag_list_unref(tags); + return STATUS_NOT_FOUND; +} From f7ea3db660821607db68050a28923c854f6ed218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 28 Apr 2023 19:13:44 +0200 Subject: [PATCH 1182/1506] winegstreamer/new_media_source: Set MF_SD_MUTUALLY_EXCLUSIVE stream descriptor attribute. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 39 ++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 9dbdf069caf..e47b71a2e66 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -475,6 +475,19 @@ static HRESULT stream_descriptor_get_media_type(IMFStreamDescriptor *descriptor, return hr; } +static HRESULT stream_descriptor_get_major_type(IMFStreamDescriptor *descriptor, GUID *major) +{ + IMFMediaTypeHandler *handler; + HRESULT hr; + + if (FAILED(hr = IMFStreamDescriptor_GetMediaTypeHandler(descriptor, &handler))) + return hr; + hr = IMFMediaTypeHandler_GetMajorType(handler, major); + IMFMediaTypeHandler_Release(handler); + + return hr; +} + static HRESULT wg_format_from_stream_descriptor(IMFStreamDescriptor *descriptor, struct wg_format *format) { IMFMediaType *media_type; @@ -1809,12 +1822,36 @@ static void media_source_init_stream_map(struct media_source *source, UINT strea static void media_source_init_descriptors(struct media_source *source) { + UINT i, last_audio = -1, last_video = -1; HRESULT hr; - UINT i; for (i = 0; i < source->stream_count; i++) { IMFStreamDescriptor *descriptor = source->descriptors[i]; + GUID major = GUID_NULL; + UINT exclude = -1; + + if (FAILED(hr = stream_descriptor_get_major_type(descriptor, &major))) + WARN("Failed to get major type from stream descriptor, hr %#lx\n", hr); + + if (IsEqualGUID(&major, &MFMediaType_Audio)) + { + exclude = last_audio; + last_audio = i; + } + else if (IsEqualGUID(&major, &MFMediaType_Video)) + { + exclude = last_video; + last_video = i; + } + + if (exclude != -1) + { + if (FAILED(IMFStreamDescriptor_SetUINT32(source->descriptors[exclude], &MF_SD_MUTUALLY_EXCLUSIVE, 1))) + WARN("Failed to set stream %u MF_SD_MUTUALLY_EXCLUSIVE\n", exclude); + else if (FAILED(IMFStreamDescriptor_SetUINT32(descriptor, &MF_SD_MUTUALLY_EXCLUSIVE, 1))) + WARN("Failed to set stream %u MF_SD_MUTUALLY_EXCLUSIVE\n", i); + } if (FAILED(hr = stream_descriptor_set_tag(descriptor, source->wg_source, source->stream_map[i], &MF_SD_LANGUAGE, WG_PARSER_TAG_LANGUAGE))) From 00c5d030b0af6239dfb294283e6eb0adf0d144f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 29 Apr 2023 14:51:54 +0200 Subject: [PATCH 1183/1506] winegstreamer/new_media_source: Select one stream descriptor for each major type. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index e47b71a2e66..dcc1effe0c1 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -1258,9 +1258,6 @@ static HRESULT media_stream_create(IMFMediaSource *source, IMFStreamDescriptor * object->media_source = source; IMFStreamDescriptor_AddRef(descriptor); object->descriptor = descriptor; - - object->active = TRUE; - object->eos = FALSE; object->wg_stream = wg_stream; TRACE("Created stream object %p.\n", object); @@ -1584,6 +1581,8 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * for (i = 0; i < source->stream_count; ++i) { + if (!source->streams[i]->active) + continue; if (FAILED(hr = IMFPresentationDescriptor_SelectStream(*descriptor, i))) WARN("Failed to select stream %u, hr %#lx\n", i, hr); } @@ -1822,7 +1821,7 @@ static void media_source_init_stream_map(struct media_source *source, UINT strea static void media_source_init_descriptors(struct media_source *source) { - UINT i, last_audio = -1, last_video = -1; + UINT i, last_audio = -1, last_video = -1, first_audio = -1, first_video = -1; HRESULT hr; for (i = 0; i < source->stream_count; i++) @@ -1836,11 +1835,15 @@ static void media_source_init_descriptors(struct media_source *source) if (IsEqualGUID(&major, &MFMediaType_Audio)) { + if (first_audio == -1) + first_audio = i; exclude = last_audio; last_audio = i; } else if (IsEqualGUID(&major, &MFMediaType_Video)) { + if (first_video == -1) + first_video = i; exclude = last_video; last_video = i; } @@ -1860,6 +1863,21 @@ static void media_source_init_descriptors(struct media_source *source) &MF_SD_STREAM_NAME, WG_PARSER_TAG_NAME))) WARN("Failed to set stream descriptor name, hr %#lx\n", hr); } + + if (!wcscmp(source->mime_type, L"video/mp4")) + { + if (last_audio != -1) + source->streams[last_audio]->active = TRUE; + if (last_video != -1) + source->streams[last_video]->active = TRUE; + } + else + { + if (first_audio != -1) + source->streams[first_audio]->active = TRUE; + if (first_video != -1) + source->streams[first_video]->active = TRUE; + } } static HRESULT media_source_create(struct object_context *context, IMFMediaSource **out) From 11e980e9787a453dc78e20be316256316252f48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 29 Jun 2023 12:17:55 +0200 Subject: [PATCH 1184/1506] winegstreamer/new_media_source: Use 1-based ids in media source stream descriptors. CW-Bug-Id: #21953 --- dlls/winegstreamer/new_media_source.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index dcc1effe0c1..14b2679f529 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -758,10 +758,10 @@ static HRESULT media_source_start(struct media_source *source, IMFPresentationDe { if (FAILED(hr = IMFStreamDescriptor_GetStreamIdentifier(stream_descriptor, &id))) WARN("Failed to get stream descriptor id, hr %#lx\n", hr); - else if (id >= source->stream_count) + else if (id > source->stream_count) WARN("Invalid stream descriptor id %lu, hr %#lx\n", id, hr); else if (selected) - IMFStreamDescriptor_AddRef((descriptors[id] = stream_descriptor)); + IMFStreamDescriptor_AddRef((descriptors[id - 1] = stream_descriptor)); IMFStreamDescriptor_Release(stream_descriptor); } @@ -1953,7 +1953,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc continue; wg_parser_stream_get_preferred_format(parser_stream, &format); - if (FAILED(hr = stream_descriptor_create(i, &format, &descriptor))) + if (FAILED(hr = stream_descriptor_create(i + 1, &format, &descriptor))) goto fail; if (FAILED(hr = media_stream_create(&object->IMFMediaSource_iface, descriptor, parser_stream, &stream))) { From 135c44ca3f19f6e6520ecc3ccc24864bbeb2d027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 24 Jul 2023 14:25:38 +0200 Subject: [PATCH 1185/1506] winegstreamer/new_media_source: Select the wg_source streams on media source start. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 14 ++++++++++++++ dlls/winegstreamer/new_media_source.c | 2 ++ dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 8 ++++++++ dlls/winegstreamer/wg_parser.c | 1 + dlls/winegstreamer/wg_source.c | 28 +++++++++++++++++++++++++++ 7 files changed, 55 insertions(+) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index df5f64660a2..fc3b617772f 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -115,6 +115,7 @@ bool wg_source_get_stream_format(wg_source_t source, UINT32 index, struct wg_format *format); char *wg_source_get_stream_tag(wg_source_t source, UINT32 index, wg_parser_tag tag); +void wg_source_set_stream_flags(wg_source_t source, UINT32 index, BOOL select); wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 11e47b1b952..0349b2364a0 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -507,6 +507,20 @@ char *wg_source_get_stream_tag(wg_source_t source, UINT32 index, wg_parser_tag t return buffer; } +void wg_source_set_stream_flags(wg_source_t source, UINT32 index, BOOL select) +{ + struct wg_source_set_stream_flags_params params = + { + .source = source, + .index = index, + .select = select, + }; + + TRACE("source %#I64x, index %u, select %u\n", source, index, select); + + WINE_UNIX_CALL(unix_wg_source_set_stream_flags, ¶ms); +} + wg_transform_t wg_transform_create(const struct wg_format *input_format, const struct wg_format *output_format, const struct wg_transform_attrs *attrs) { diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 14b2679f529..8c5c30e653e 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -783,6 +783,8 @@ static HRESULT media_source_start(struct media_source *source, IMFPresentationDe WARN("Failed to start media stream, hr %#lx\n", hr); IMFStreamDescriptor_Release(descriptors[i]); } + + wg_source_set_stream_flags(source->wg_source, source->stream_map[i], stream->active); } free(descriptors); diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 7116e37d57f..96935676c34 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -67,6 +67,7 @@ extern NTSTATUS wg_source_get_position(void *args); extern NTSTATUS wg_source_push_data(void *args); extern NTSTATUS wg_source_get_stream_format(void *args); extern NTSTATUS wg_source_get_stream_tag(void *args); +extern NTSTATUS wg_source_set_stream_flags(void *args); /* wg_transform.c */ diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index cb86c756ad0..a465fd9d031 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -392,6 +392,13 @@ struct wg_source_get_stream_tag_params char *buffer; }; +struct wg_source_set_stream_flags_params +{ + wg_source_t source; + UINT32 index; + UINT32 select; +}; + struct wg_transform_attrs { UINT32 output_plane_align; @@ -510,6 +517,7 @@ enum unix_funcs unix_wg_source_push_data, unix_wg_source_get_stream_format, unix_wg_source_get_stream_tag, + unix_wg_source_set_stream_flags, unix_wg_transform_create, unix_wg_transform_destroy, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 114c4d38224..fd8c5731575 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2214,6 +2214,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_push_data), X(wg_source_get_stream_format), X(wg_source_get_stream_tag), + X(wg_source_set_stream_flags), X(wg_transform_create), X(wg_transform_destroy), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 8201c12eb03..48482303b4b 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -155,6 +155,16 @@ static GstTagList *source_get_stream_tags(struct wg_source *source, guint index) return tags; } +static bool source_set_stream_flags(struct wg_source *source, guint index, GstStreamFlags flags) +{ + GstStream *stream; + if (!(stream = source_get_stream(source, index))) + return false; + gst_stream_set_stream_flags(stream, flags); + gst_object_unref(stream); + return true; +} + static gboolean src_event_seek(struct wg_source *source, GstEvent *event) { guint32 seqnum = gst_event_get_seqnum(event); @@ -384,6 +394,7 @@ static GstEvent *create_stream_start_event(const char *stream_id) if (!(stream = gst_stream_new(stream_id, NULL, GST_STREAM_TYPE_UNKNOWN, 0))) return NULL; + gst_stream_set_stream_flags(stream, GST_STREAM_FLAG_SELECT); if ((event = gst_event_new_stream_start(stream_id))) { gst_event_set_stream(event, stream); @@ -789,3 +800,20 @@ NTSTATUS wg_source_get_stream_tag(void *args) gst_tag_list_unref(tags); return STATUS_NOT_FOUND; } + +NTSTATUS wg_source_set_stream_flags(void *args) +{ + struct wg_source_set_stream_flags_params *params = args; + struct wg_source *source = get_source(params->source); + BOOL select = params->select; + guint index = params->index; + GstStreamFlags flags; + + GST_TRACE("source %p, index %u, select %u", source, index, select); + + flags = select ? GST_STREAM_FLAG_SELECT : GST_STREAM_FLAG_UNSELECT; + if (!source_set_stream_flags(source, index, flags)) + return STATUS_UNSUCCESSFUL; + + return STATUS_SUCCESS; +} From a7bc220b2a3278c12fedde68991b59d6257a8b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 8 Dec 2023 17:12:56 +0100 Subject: [PATCH 1186/1506] winegstreamer/new_media_source: Seek the wg_source streams on media source start. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 9 +++++++++ dlls/winegstreamer/new_media_source.c | 2 ++ dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 7 +++++++ dlls/winegstreamer/wg_parser.c | 1 + dlls/winegstreamer/wg_source.c | 17 +++++++++++++++++ 7 files changed, 38 insertions(+) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index fc3b617772f..e7393e015e7 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -109,6 +109,7 @@ HRESULT wg_source_create(const WCHAR *url, uint64_t file_size, void wg_source_destroy(wg_source_t source); HRESULT wg_source_get_stream_count(wg_source_t source, uint32_t *stream_count); HRESULT wg_source_get_duration(wg_source_t source, uint64_t *duration); +HRESULT wg_source_set_position(wg_source_t source, uint64_t time); HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); bool wg_source_get_stream_format(wg_source_t source, UINT32 index, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 0349b2364a0..0276aa947b4 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -445,6 +445,15 @@ HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset) return S_OK; } +HRESULT wg_source_set_position(wg_source_t source, uint64_t time) +{ + struct wg_source_set_position_params params = {.source = source, .time = time}; + + TRACE("source %#I64x, time %s\n", source, debugstr_time(time)); + + return HRESULT_FROM_NT(WINE_UNIX_CALL(unix_wg_source_set_position, ¶ms)); +} + HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size) { struct wg_source_push_data_params params = diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index 8c5c30e653e..ffea4e8468f 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -790,6 +790,8 @@ static HRESULT media_source_start(struct media_source *source, IMFPresentationDe free(descriptors); source->state = SOURCE_RUNNING; + if (position->vt == VT_I8) + wg_source_set_position(source->wg_source, position->hVal.QuadPart); if (position->vt == VT_I8) wg_parser_stream_seek(source->streams[0]->wg_stream, 1.0, position->hVal.QuadPart, 0, diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index 96935676c34..f83279b9bfa 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -64,6 +64,7 @@ extern NTSTATUS wg_source_destroy(void *args); extern NTSTATUS wg_source_get_stream_count(void *args); extern NTSTATUS wg_source_get_duration(void *args); extern NTSTATUS wg_source_get_position(void *args); +extern NTSTATUS wg_source_set_position(void *args); extern NTSTATUS wg_source_push_data(void *args); extern NTSTATUS wg_source_get_stream_format(void *args); extern NTSTATUS wg_source_get_stream_tag(void *args); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index a465fd9d031..46b6865e39f 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -369,6 +369,12 @@ struct wg_source_get_position_params UINT64 read_offset; }; +struct wg_source_set_position_params +{ + wg_source_t source; + UINT64 time; +}; + struct wg_source_push_data_params { wg_source_t source; @@ -514,6 +520,7 @@ enum unix_funcs unix_wg_source_get_stream_count, unix_wg_source_get_duration, unix_wg_source_get_position, + unix_wg_source_set_position, unix_wg_source_push_data, unix_wg_source_get_stream_format, unix_wg_source_get_stream_tag, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index fd8c5731575..861f202995d 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2211,6 +2211,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_get_stream_count), X(wg_source_get_duration), X(wg_source_get_position), + X(wg_source_set_position), X(wg_source_push_data), X(wg_source_get_stream_format), X(wg_source_get_stream_tag), diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 48482303b4b..1c6d387635e 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -608,6 +608,23 @@ NTSTATUS wg_source_get_position(void *args) return STATUS_SUCCESS; } +NTSTATUS wg_source_set_position(void *args) +{ + struct wg_source_set_position_params *params = args; + struct wg_source *source = get_source(params->source); + guint64 time = params->time * 100; + GstEvent *event; + + GST_TRACE("source %p", source); + + if (!(event = gst_event_new_seek(1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, + GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1)) + || !gst_pad_push_event(source->streams[0].pad, event)) + GST_WARNING("Failed to seek source %p to %" G_GINT64_MODIFIER "x", source, time); + + return S_OK; +} + NTSTATUS wg_source_push_data(void *args) { struct wg_source_push_data_params *params = args; From 1f445af6ce21d690d4288750713248e062a4369d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 8 Dec 2023 17:19:22 +0100 Subject: [PATCH 1187/1506] winegstreamer/new_media_source: Read and discard compressed samples from wg_source. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/mfplat.c | 3 + dlls/winegstreamer/new_media_source.c | 30 +++++ dlls/winegstreamer/unix_private.h | 1 + dlls/winegstreamer/unixlib.h | 8 ++ dlls/winegstreamer/wg_parser.c | 20 ++++ dlls/winegstreamer/wg_sample.c | 69 +++++++++++ dlls/winegstreamer/wg_source.c | 164 +++++++++++++++++++++++++- 8 files changed, 292 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index e7393e015e7..84857c5adfa 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -112,6 +112,7 @@ HRESULT wg_source_get_duration(wg_source_t source, uint64_t *duration); HRESULT wg_source_set_position(wg_source_t source, uint64_t time); HRESULT wg_source_get_position(wg_source_t source, uint64_t *read_offset); HRESULT wg_source_push_data(wg_source_t source, const void *data, uint32_t size); +HRESULT wg_source_read_data(wg_source_t source, UINT32 index, IMFSample **out); bool wg_source_get_stream_format(wg_source_t source, UINT32 index, struct wg_format *format); char *wg_source_get_stream_tag(wg_source_t source, UINT32 index, diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 2537c6bf455..452289c2e6a 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "gst_private.h" #include "ks.h" @@ -26,6 +28,7 @@ #include "d3d9types.h" #include "mfapi.h" #include "mmreg.h" +#include "mferror.h" #include "wine/debug.h" #include "wine/list.h" diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index ffea4e8468f..b4c8e91db49 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -307,6 +307,7 @@ struct media_source UINT64 file_size; wg_parser_t wg_parser; UINT64 duration; + BYTE *read_buffer; IMFStreamDescriptor **descriptors; struct media_stream **streams; @@ -926,9 +927,34 @@ static HRESULT wait_on_sample(struct media_stream *stream, IUnknown *token) { struct media_source *source = impl_from_IMFMediaSource(stream->media_source); struct wg_parser_buffer buffer; + DWORD id, read_size; + UINT64 read_offset; + IMFSample *sample; + HRESULT hr; TRACE("%p, %p\n", stream, token); + if (FAILED(hr = IMFStreamDescriptor_GetStreamIdentifier(stream->descriptor, &id))) + return hr; + id = source->stream_map[id - 1]; + + while (SUCCEEDED(hr) && (hr = wg_source_read_data(source->wg_source, id, &sample)) == E_PENDING) + { + if (FAILED(hr = wg_source_get_position(source->wg_source, &read_offset))) + break; + if (FAILED(hr = IMFByteStream_SetCurrentPosition(source->byte_stream, read_offset))) + WARN("Failed to seek stream to %#I64x, hr %#lx\n", read_offset, hr); + else if (FAILED(hr = IMFByteStream_Read(source->byte_stream, source->read_buffer, SOURCE_BUFFER_SIZE, &read_size))) + WARN("Failed to read %#lx bytes from stream, hr %#lx\n", read_size, hr); + else if (FAILED(hr = wg_source_push_data(source->wg_source, source->read_buffer, read_size))) + WARN("Failed to push %#lx bytes to source, hr %#lx\n", read_size, hr); + } + + if (FAILED(hr)) + WARN("Failed to read stream %lu data, hr %#lx\n", id, hr); + else + IMFSample_Release(sample); + if (wg_parser_stream_get_buffer(source->wg_parser, stream->wg_stream, &buffer)) return media_stream_send_sample(stream, &buffer, token); @@ -1497,6 +1523,7 @@ static ULONG WINAPI media_source_Release(IMFMediaSource *iface) IMFMediaEventQueue_Release(source->event_queue); IMFByteStream_Release(source->byte_stream); wg_source_destroy(source->wg_source); + free(source->read_buffer); wg_parser_destroy(source->wg_parser); source->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&source->cs); @@ -1910,6 +1937,8 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc InitializeCriticalSection(&object->cs); object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs"); + object->read_buffer = context->buffer; + context->buffer = NULL; object->wg_source = context->wg_source; context->wg_source = 0; @@ -2011,6 +2040,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (object->event_queue) IMFMediaEventQueue_Release(object->event_queue); IMFByteStream_Release(object->byte_stream); + free(object->read_buffer); free(object); return hr; diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index f83279b9bfa..d15054661c7 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -66,6 +66,7 @@ extern NTSTATUS wg_source_get_duration(void *args); extern NTSTATUS wg_source_get_position(void *args); extern NTSTATUS wg_source_set_position(void *args); extern NTSTATUS wg_source_push_data(void *args); +extern NTSTATUS wg_source_read_data(void *args); extern NTSTATUS wg_source_get_stream_format(void *args); extern NTSTATUS wg_source_get_stream_tag(void *args); extern NTSTATUS wg_source_set_stream_flags(void *args); diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 46b6865e39f..165d0c57fd7 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -382,6 +382,13 @@ struct wg_source_push_data_params UINT32 size; }; +struct wg_source_read_data_params +{ + wg_source_t source; + UINT32 index; + struct wg_sample *sample; +}; + struct wg_source_get_stream_format_params { wg_source_t source; @@ -522,6 +529,7 @@ enum unix_funcs unix_wg_source_get_position, unix_wg_source_set_position, unix_wg_source_push_data, + unix_wg_source_read_data, unix_wg_source_get_stream_format, unix_wg_source_get_stream_tag, unix_wg_source_set_stream_flags, diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 861f202995d..d6de243f3b2 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2213,6 +2213,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = X(wg_source_get_position), X(wg_source_set_position), X(wg_source_push_data), + X(wg_source_read_data), X(wg_source_get_stream_format), X(wg_source_get_stream_tag), X(wg_source_set_stream_flags), @@ -2406,6 +2407,24 @@ NTSTATUS wow64_wg_source_push_data(void *args) return wg_source_push_data(¶ms); } +NTSTATUS wow64_wg_source_read_data(void *args) +{ + struct + { + wg_source_t source; + UINT32 index; + PTR32 sample; + } *params32 = args; + struct wg_source_read_data_params params = + { + .source = params32->source, + .index = params32->index, + .sample = ULongToPtr(params32->sample), + }; + + return wg_source_read_data(¶ms); +} + NTSTATUS wow64_wg_source_get_stream_tag(void *args) { struct @@ -2620,6 +2639,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = X(wg_source_get_duration), X(wg_source_get_position), X64(wg_source_push_data), + X64(wg_source_read_data), X(wg_source_get_stream_format), X64(wg_source_get_stream_tag), diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c index 31281066957..513907d9d77 100644 --- a/dlls/winegstreamer/wg_sample.c +++ b/dlls/winegstreamer/wg_sample.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "gst_private.h" #include "wmcodecdsp.h" @@ -534,3 +536,70 @@ HRESULT wg_transform_read_dmo(wg_transform_t transform, DMO_OUTPUT_DATA_BUFFER * wg_sample_release(wg_sample); return hr; } + +HRESULT wg_source_read_data(wg_source_t source, UINT32 index, IMFSample **out) +{ + struct wg_sample wg_sample = {0}; + struct wg_source_read_data_params params = + { + .source = source, + .index = index, + .sample = &wg_sample, + }; + IMFMediaBuffer *buffer; + IMFSample *sample; + NTSTATUS status; + HRESULT hr; + + TRACE("source %#I64x, index %u, out %p\n", source, index, out); + + status = WINE_UNIX_CALL(unix_wg_source_read_data, ¶ms); + if (status == STATUS_PENDING) return E_PENDING; + if (status == STATUS_END_OF_FILE) return MF_E_END_OF_STREAM; + if (status != STATUS_BUFFER_TOO_SMALL) return HRESULT_FROM_NT(status); + + if (FAILED(hr = MFCreateSample(&sample))) + return hr; + if (SUCCEEDED(hr = MFCreateMemoryBuffer(wg_sample.max_size, &buffer))) + { + hr = IMFSample_AddBuffer(sample, buffer); + IMFMediaBuffer_Release(buffer); + } + + if (FAILED(hr) || FAILED(hr = wg_sample_create_mf(sample, ¶ms.sample))) + goto error; + + status = WINE_UNIX_CALL(unix_wg_source_read_data, ¶ms); + if (FAILED(hr = HRESULT_FROM_NT(status))) + { + wg_sample_release(params.sample); + goto error; + } + + if (params.sample->flags & WG_SAMPLE_FLAG_HAS_PTS) + IMFSample_SetSampleTime(sample, params.sample->pts); + if (params.sample->flags & WG_SAMPLE_FLAG_HAS_DURATION) + IMFSample_SetSampleDuration(sample, params.sample->duration); + if (params.sample->flags & WG_SAMPLE_FLAG_SYNC_POINT) + IMFSample_SetUINT32(sample, &MFSampleExtension_CleanPoint, 1); + if (params.sample->flags & WG_SAMPLE_FLAG_DISCONTINUITY) + IMFSample_SetUINT32(sample, &MFSampleExtension_Discontinuity, 1); + + if (SUCCEEDED(hr = IMFSample_ConvertToContiguousBuffer(sample, &buffer))) + { + hr = IMFMediaBuffer_SetCurrentLength(buffer, params.sample->size); + IMFMediaBuffer_Release(buffer); + } + wg_sample_release(params.sample); + + if (FAILED(hr)) + goto error; + + *out = sample; + TRACE("source %#I64x, index %u, out %p\n", source, index, *out); + return S_OK; + +error: + IMFSample_Release(sample); + return hr; +} diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index 1c6d387635e..6e000e36e31 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -44,6 +44,9 @@ struct source_stream { GstPad *pad; + GstAtomicQueue *queue; + GstBuffer *buffer; + gboolean eos; }; struct wg_source @@ -165,9 +168,34 @@ static bool source_set_stream_flags(struct wg_source *source, guint index, GstSt return true; } +static GstStreamFlags source_get_stream_flags(struct wg_source *source, guint index) +{ + GstStreamFlags flags; + GstStream *stream; + if (!(stream = source_get_stream(source, index))) + return 0; + flags = gst_stream_get_stream_flags(stream); + gst_object_unref(stream); + return flags; +} + +static NTSTATUS source_get_stream_buffer(struct wg_source *source, guint index, GstBuffer **buffer) +{ + GstBuffer **stream_buffer; + if (index >= source->stream_count) + return STATUS_INVALID_PARAMETER; + + stream_buffer = &source->streams[index].buffer; + if (!*stream_buffer && !(*stream_buffer = gst_atomic_queue_pop(source->streams[index].queue))) + return source->streams[index].eos ? STATUS_END_OF_FILE : STATUS_PENDING; + + *buffer = gst_buffer_ref(*stream_buffer); + return STATUS_SUCCESS; +} + static gboolean src_event_seek(struct wg_source *source, GstEvent *event) { - guint32 seqnum = gst_event_get_seqnum(event); + guint32 i, seqnum = gst_event_get_seqnum(event); GstSeekType cur_type, stop_type; GstSeekFlags flags; GstFormat format; @@ -197,6 +225,9 @@ static gboolean src_event_seek(struct wg_source *source, GstEvent *event) source->segment.start = cur; + for (i = 0; i < ARRAY_SIZE(source->streams); i++) + source->streams[i].eos = false; + if (flags & GST_SEEK_FLAG_FLUSH) { if (!(event = gst_event_new_flush_stop(true))) @@ -294,10 +325,21 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer) { - struct wg_soutce *source = gst_pad_get_element_private(pad); + struct wg_source *source = gst_pad_get_element_private(pad); + guint index; + GST_TRACE("source %p, pad %p, buffer %p.", source, pad, buffer); - gst_buffer_unref(buffer); - return GST_FLOW_EOS; + + for (index = 0; index < source->stream_count; index++) + if (source->streams[index].pad == pad) + break; + + if (source_get_stream_flags(source, index) & GST_STREAM_FLAG_SELECT) + gst_atomic_queue_push(source->streams[index].queue, buffer); + else + gst_buffer_unref(buffer); + + return GST_FLOW_OK; } static gboolean sink_event_caps(struct wg_source *source, GstPad *pad, GstEvent *event) @@ -370,6 +412,23 @@ static gboolean sink_event_stream_start(struct wg_source *source, GstPad *pad, G return true; } +static gboolean sink_event_eos(struct wg_source *source, GstPad *pad, GstEvent *event) +{ + guint index; + + GST_TRACE("source %p, pad %p, event %p", source, pad, event); + + for (index = 0; index < source->stream_count; index++) + if (source->streams[index].pad == pad) + break; + + if (index < source->stream_count) + source->streams[index].eos = true; + + gst_event_unref(event); + return true; +} + static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) { struct wg_source *source = gst_pad_get_element_private(pad); @@ -382,6 +441,8 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) return sink_event_tag(source, pad, event); case GST_EVENT_STREAM_START: return sink_event_stream_start(source, pad, event); + case GST_EVENT_EOS: + return sink_event_eos(source, pad, event); default: return gst_pad_event_default(pad, parent, event); } @@ -481,6 +542,8 @@ NTSTATUS wg_source_create(void *args) { if (!(source->streams[i].pad = create_pad_with_caps(GST_PAD_SINK, NULL))) goto error; + if (!(source->streams[i].queue = gst_atomic_queue_new(1))) + goto error; gst_pad_set_element_private(source->streams[i].pad, source); gst_pad_set_chain_function(source->streams[i].pad, sink_chain_cb); gst_pad_set_event_function(source->streams[i].pad, sink_event_cb); @@ -534,6 +597,10 @@ NTSTATUS wg_source_create(void *args) } for (i = 0; i < ARRAY_SIZE(source->streams); i++) { + if (source->streams[i].buffer) + gst_buffer_unref(source->streams[i].buffer); + if (source->streams[i].queue) + gst_atomic_queue_unref(source->streams[i].queue); if (source->streams[i].pad) gst_object_unref(source->streams[i].pad); } @@ -558,7 +625,12 @@ NTSTATUS wg_source_destroy(void *args) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); for (i = 0; i < ARRAY_SIZE(source->streams); i++) + { + if (source->streams[i].buffer) + gst_buffer_unref(source->streams[i].buffer); + gst_atomic_queue_unref(source->streams[i].queue); gst_object_unref(source->streams[i].pad); + } gst_object_unref(source->src_pad); free(source->url); free(source); @@ -614,6 +686,7 @@ NTSTATUS wg_source_set_position(void *args) struct wg_source *source = get_source(params->source); guint64 time = params->time * 100; GstEvent *event; + guint i; GST_TRACE("source %p", source); @@ -622,6 +695,18 @@ NTSTATUS wg_source_set_position(void *args) || !gst_pad_push_event(source->streams[0].pad, event)) GST_WARNING("Failed to seek source %p to %" G_GINT64_MODIFIER "x", source, time); + for (i = 0; i < source->stream_count; i++) + { + GstBuffer *buffer; + + while (!source_get_stream_buffer(source, i, &buffer)) + { + gst_buffer_unref(source->streams[i].buffer); + source->streams[i].buffer = NULL; + gst_buffer_unref(buffer); + } + } + return S_OK; } @@ -676,6 +761,65 @@ NTSTATUS wg_source_push_data(void *args) return STATUS_SUCCESS; } +NTSTATUS wg_source_read_data(void *args) +{ + struct wg_source_read_data_params *params = args; + struct wg_source *source = get_source(params->source); + struct wg_sample *sample = params->sample; + NTSTATUS status = STATUS_SUCCESS; + guint index = params->index; + GstMapInfo info = {0}; + GstBuffer *buffer; + + GST_TRACE("source %p, index %#x, sample %p", source, index, sample); + + if ((status = source_get_stream_buffer(source, index, &buffer))) + return status; + + if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) + status = STATUS_UNSUCCESSFUL; + else + { + if (info.size > sample->max_size) + status = STATUS_BUFFER_TOO_SMALL; + else + { + memcpy(wg_sample_data(sample), info.data, info.size); + sample->size = info.size; + + if (GST_BUFFER_PTS_IS_VALID(buffer)) + { + sample->flags |= WG_SAMPLE_FLAG_HAS_PTS; + sample->pts = GST_BUFFER_PTS(buffer) / 100; + } + else if (GST_BUFFER_DTS_IS_VALID(buffer)) + { + sample->flags |= WG_SAMPLE_FLAG_HAS_PTS; + sample->pts = GST_BUFFER_DTS(buffer) / 100; + } + if (GST_BUFFER_DURATION_IS_VALID(buffer)) + { + GstClockTime duration = GST_BUFFER_DURATION(buffer) / 100; + sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION; + sample->duration = duration; + } + if (!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)) + sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT; + if (GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT)) + sample->flags |= WG_SAMPLE_FLAG_DISCONTINUITY; + + gst_buffer_unref(source->streams[index].buffer); + source->streams[index].buffer = NULL; + } + + sample->max_size = info.size; + gst_buffer_unmap(buffer, &info); + } + + gst_buffer_unref(buffer); + return status; +} + NTSTATUS wg_source_get_stream_format(void *args) { struct wg_source_get_stream_format_params *params = args; @@ -832,5 +976,17 @@ NTSTATUS wg_source_set_stream_flags(void *args) if (!source_set_stream_flags(source, index, flags)) return STATUS_UNSUCCESSFUL; + if (!select) + { + GstBuffer *buffer; + + while (!source_get_stream_buffer(source, index, &buffer)) + { + gst_buffer_unref(source->streams[index].buffer); + source->streams[index].buffer = NULL; + gst_buffer_unref(buffer); + } + } + return STATUS_SUCCESS; } From 47ff280361dd9a0b2fc0d2ea15e17420cb4c203a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 1 Jun 2023 09:05:58 +0200 Subject: [PATCH 1188/1506] winegstreamer/new_media_source: Stop using wg_parser to read samples in the media source. CW-Bug-Id: #21953 --- dlls/mfmediaengine/tests/mfmediaengine.c | 2 +- dlls/winegstreamer/new_media_source.c | 334 ++--------------------- 2 files changed, 20 insertions(+), 316 deletions(-) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 66a1f0b79e9..f9489f3dcb5 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -152,7 +152,7 @@ static void check_rgb32_data_(int line, const WCHAR *filename, const BYTE *data, expect_data = LockResource(LoadResource(GetModuleHandleW(NULL), resource)); diff = compare_rgb32(data, &length, rect, expect_data); - ok_(__FILE__, line)(diff == 0, "Unexpected %lu%% diff\n", diff); + ok_(__FILE__, line)(diff <= 3 /* small difference in wine */, "Unexpected %lu%% diff\n", diff); } static void init_functions(void) diff --git a/dlls/winegstreamer/new_media_source.c b/dlls/winegstreamer/new_media_source.c index b4c8e91db49..efaf6a3e087 100644 --- a/dlls/winegstreamer/new_media_source.c +++ b/dlls/winegstreamer/new_media_source.c @@ -248,13 +248,10 @@ struct media_stream IMFMediaEventQueue *event_queue; IMFStreamDescriptor *descriptor; - wg_parser_stream_t wg_stream; - IUnknown **token_queue; LONG token_queue_count; LONG token_queue_cap; - DWORD stream_id; BOOL active; BOOL eos; }; @@ -305,7 +302,6 @@ struct media_source wg_source_t wg_source; WCHAR mime_type[256]; UINT64 file_size; - wg_parser_t wg_parser; UINT64 duration; BYTE *read_buffer; @@ -323,9 +319,6 @@ struct media_source SOURCE_SHUTDOWN, } state; float rate; - - HANDLE read_thread; - bool read_thread_shutdown; }; static inline struct media_stream *impl_from_IMFMediaStream(IMFMediaStream *iface) @@ -528,122 +521,28 @@ static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, return hr; } -static HRESULT init_video_media_types(struct wg_format *format, IMFMediaType *types[6], DWORD *types_count) -{ - /* Try to prefer YUV formats over RGB ones. Most decoders output in the - * YUV color space, and it's generally much less expensive for - * videoconvert to do YUV -> YUV transformations. */ - static const enum wg_video_format video_formats[] = - { - WG_VIDEO_FORMAT_NV12, - WG_VIDEO_FORMAT_YV12, - WG_VIDEO_FORMAT_YUY2, - WG_VIDEO_FORMAT_I420, - }; - UINT count = *types_count, i; - GUID base_subtype; - HRESULT hr; - - if (FAILED(hr = IMFMediaType_GetGUID(types[0], &MF_MT_SUBTYPE, &base_subtype))) - return hr; - - for (i = 0; i < ARRAY_SIZE(video_formats); ++i) - { - struct wg_format new_format = *format; - IMFMediaType *new_type; - - new_format.u.video.format = video_formats[i]; - - if (!(new_type = mf_media_type_from_wg_format(&new_format))) - { - hr = E_OUTOFMEMORY; - goto done; - } - types[count++] = new_type; - - if (video_formats[i] == WG_VIDEO_FORMAT_I420) - { - IMFMediaType *iyuv_type; - - if (FAILED(hr = MFCreateMediaType(&iyuv_type))) - goto done; - if (FAILED(hr = IMFMediaType_CopyAllItems(new_type, (IMFAttributes *)iyuv_type))) - goto done; - if (FAILED(hr = IMFMediaType_SetGUID(iyuv_type, &MF_MT_SUBTYPE, &MFVideoFormat_IYUV))) - goto done; - types[count++] = iyuv_type; - } - } - -done: - *types_count = count; - return hr; -} - -static HRESULT init_audio_media_types(struct wg_format *format, IMFMediaType *types[6], DWORD *types_count) -{ - /* Expose at least one PCM and one floating point type for the - consumer to pick from. */ - static const enum wg_audio_format audio_types[] = - { - WG_AUDIO_FORMAT_S16LE, - WG_AUDIO_FORMAT_F32LE, - }; - UINT count = *types_count, i; - - for (i = 0; i < ARRAY_SIZE(audio_types); i++) - { - struct wg_format new_format = *format; - if (new_format.u.audio.format == audio_types[i]) - continue; - new_format.u.audio.format = audio_types[i]; - if ((types[count] = mf_media_type_from_wg_format(&new_format))) - count++; - } - - *types_count = count; - return S_OK; -} - static HRESULT stream_descriptor_create(UINT32 id, struct wg_format *format, IMFStreamDescriptor **out) { IMFStreamDescriptor *descriptor; IMFMediaTypeHandler *handler; - IMFMediaType *types[6]; - DWORD count = 0; + IMFMediaType *type; HRESULT hr; - if (!(types[0] = mf_media_type_from_wg_format(format))) + if (!(type = mf_media_type_from_wg_format(format))) return MF_E_INVALIDMEDIATYPE; - count = 1; - - if (format->major_type == WG_MAJOR_TYPE_VIDEO) - { - if (FAILED(hr = init_video_media_types(format, types, &count))) - goto done; - } - else if (format->major_type == WG_MAJOR_TYPE_AUDIO) - { - if (FAILED(hr = init_audio_media_types(format, types, &count))) - goto done; - } - - assert(count <= ARRAY_SIZE(types)); - - if (FAILED(hr = MFCreateStreamDescriptor(id, count, types, &descriptor))) + if (FAILED(hr = MFCreateStreamDescriptor(id, 1, &type, &descriptor))) goto done; if (FAILED(hr = IMFStreamDescriptor_GetMediaTypeHandler(descriptor, &handler))) IMFStreamDescriptor_Release(descriptor); else { - hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, types[0]); + hr = IMFMediaTypeHandler_SetCurrentMediaType(handler, type); IMFMediaTypeHandler_Release(handler); } done: - while (count--) - IMFMediaType_Release(types[count]); + IMFMediaType_Release(type); *out = SUCCEEDED(hr) ? descriptor : NULL; return hr; } @@ -710,7 +609,6 @@ static HRESULT media_stream_start(struct media_stream *stream, BOOL active, BOOL if (FAILED(hr = wg_format_from_stream_descriptor(stream->descriptor, &format))) WARN("Failed to get wg_format from stream descriptor, hr %#lx\n", hr); - wg_parser_stream_enable(stream->wg_stream, &format, 0); if (FAILED(hr = IMFMediaEventQueue_QueueEventParamUnk(source->event_queue, active ? MEUpdatedStream : MENewStream, &GUID_NULL, S_OK, (IUnknown *)&stream->IMFMediaStream_iface))) @@ -777,15 +675,15 @@ static HRESULT media_source_start(struct media_source *source, IMFPresentationDe stream->eos = FALSE; if (!(stream->active = !!descriptors[i])) - wg_parser_stream_disable(stream->wg_stream); + wg_source_set_stream_flags(source->wg_source, source->stream_map[i], FALSE); else { if (FAILED(hr = media_stream_start(stream, was_active, seek_message, position))) WARN("Failed to start media stream, hr %#lx\n", hr); + else + wg_source_set_stream_flags(source->wg_source, source->stream_map[i], TRUE); IMFStreamDescriptor_Release(descriptors[i]); } - - wg_source_set_stream_flags(source->wg_source, source->stream_map[i], stream->active); } free(descriptors); @@ -794,10 +692,6 @@ static HRESULT media_source_start(struct media_source *source, IMFPresentationDe if (position->vt == VT_I8) wg_source_set_position(source->wg_source, position->hVal.QuadPart); - if (position->vt == VT_I8) - wg_parser_stream_seek(source->streams[0]->wg_stream, 1.0, position->hVal.QuadPart, 0, - AM_SEEKING_AbsolutePositioning, AM_SEEKING_NoPositioning); - for (i = 0; i < source->stream_count; i++) flush_token_queue(source->streams[i], position->vt == VT_EMPTY); @@ -853,52 +747,6 @@ static HRESULT media_source_stop(struct media_source *source) return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceStopped, &GUID_NULL, S_OK, NULL); } -static HRESULT media_stream_send_sample(struct media_stream *stream, const struct wg_parser_buffer *wg_buffer, IUnknown *token) -{ - IMFSample *sample = NULL; - IMFMediaBuffer *buffer; - HRESULT hr; - BYTE *data; - - if (FAILED(hr = MFCreateMemoryBuffer(wg_buffer->size, &buffer))) - return hr; - if (FAILED(hr = IMFMediaBuffer_SetCurrentLength(buffer, wg_buffer->size))) - goto out; - if (FAILED(hr = IMFMediaBuffer_Lock(buffer, &data, NULL, NULL))) - goto out; - - if (!wg_parser_stream_copy_buffer(stream->wg_stream, data, 0, wg_buffer->size)) - { - wg_parser_stream_release_buffer(stream->wg_stream); - IMFMediaBuffer_Unlock(buffer); - goto out; - } - wg_parser_stream_release_buffer(stream->wg_stream); - - if (FAILED(hr = IMFMediaBuffer_Unlock(buffer))) - goto out; - - if (FAILED(hr = MFCreateSample(&sample))) - goto out; - if (FAILED(hr = IMFSample_AddBuffer(sample, buffer))) - goto out; - if (FAILED(hr = IMFSample_SetSampleTime(sample, wg_buffer->pts))) - goto out; - if (FAILED(hr = IMFSample_SetSampleDuration(sample, wg_buffer->duration))) - goto out; - if (token && FAILED(hr = IMFSample_SetUnknown(sample, &MFSampleExtension_Token, token))) - goto out; - - hr = IMFMediaEventQueue_QueueEventParamUnk(stream->event_queue, MEMediaSample, - &GUID_NULL, S_OK, (IUnknown *)sample); - -out: - if (sample) - IMFSample_Release(sample); - IMFMediaBuffer_Release(buffer); - return hr; -} - static HRESULT media_stream_send_eos(struct media_source *source, struct media_stream *stream) { PROPVARIANT empty = {.vt = VT_EMPTY}; @@ -926,7 +774,6 @@ static HRESULT media_stream_send_eos(struct media_source *source, struct media_s static HRESULT wait_on_sample(struct media_stream *stream, IUnknown *token) { struct media_source *source = impl_from_IMFMediaSource(stream->media_source); - struct wg_parser_buffer buffer; DWORD id, read_size; UINT64 read_offset; IMFSample *sample; @@ -953,10 +800,13 @@ static HRESULT wait_on_sample(struct media_stream *stream, IUnknown *token) if (FAILED(hr)) WARN("Failed to read stream %lu data, hr %#lx\n", id, hr); else + { + if (!token || SUCCEEDED(hr = IMFSample_SetUnknown(sample, &MFSampleExtension_Token, token))) + hr = IMFMediaEventQueue_QueueEventParamUnk(stream->event_queue, MEMediaSample, + &GUID_NULL, S_OK, (IUnknown *)sample); IMFSample_Release(sample); - - if (wg_parser_stream_get_buffer(source->wg_parser, stream->wg_stream, &buffer)) - return media_stream_send_sample(stream, &buffer, token); + return hr; + } return media_stream_send_eos(source, stream); } @@ -1021,66 +871,6 @@ static const IMFAsyncCallbackVtbl source_async_commands_callback_vtbl = source_async_commands_Invoke, }; -static DWORD CALLBACK read_thread(void *arg) -{ - struct media_source *source = arg; - IMFByteStream *byte_stream = source->byte_stream; - size_t buffer_size = 4096; - QWORD file_size; - void *data; - - if (!(data = malloc(buffer_size))) - return 0; - - IMFByteStream_GetLength(byte_stream, &file_size); - - TRACE("Starting read thread for media source %p.\n", source); - - while (!source->read_thread_shutdown) - { - uint64_t offset; - ULONG ret_size; - uint32_t size; - HRESULT hr; - - if (!wg_parser_get_next_read_offset(source->wg_parser, &offset, &size)) - continue; - - if (offset >= file_size) - size = 0; - else if (offset + size >= file_size) - size = file_size - offset; - - /* Some IMFByteStreams (including the standard file-based stream) return - * an error when reading past the file size. */ - if (!size) - { - wg_parser_push_data(source->wg_parser, data, 0); - continue; - } - - if (!array_reserve(&data, &buffer_size, size, 1)) - { - free(data); - return 0; - } - - ret_size = 0; - - if (SUCCEEDED(hr = IMFByteStream_SetCurrentPosition(byte_stream, offset))) - hr = IMFByteStream_Read(byte_stream, data, size, &ret_size); - if (FAILED(hr)) - ERR("Failed to read %u bytes at offset %I64u, hr %#lx.\n", size, offset, hr); - else if (ret_size != size) - ERR("Unexpected short read: requested %u bytes, got %lu.\n", size, ret_size); - wg_parser_push_data(source->wg_parser, SUCCEEDED(hr) ? data : NULL, ret_size); - } - - free(data); - TRACE("Media source is shutting down; exiting.\n"); - return 0; -} - static HRESULT WINAPI media_stream_QueryInterface(IMFMediaStream *iface, REFIID riid, void **out) { struct media_stream *stream = impl_from_IMFMediaStream(iface); @@ -1264,13 +1054,12 @@ static const IMFMediaStreamVtbl media_stream_vtbl = media_stream_RequestSample }; -static HRESULT media_stream_create(IMFMediaSource *source, IMFStreamDescriptor *descriptor, - wg_parser_stream_t wg_stream, struct media_stream **out) +static HRESULT media_stream_create(IMFMediaSource *source, IMFStreamDescriptor *descriptor, struct media_stream **out) { struct media_stream *object; HRESULT hr; - TRACE("source %p, descriptor %p, wg_stream %#I64x.\n", source, descriptor, wg_stream); + TRACE("source %p, descriptor %p.\n", source, descriptor); if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -1288,7 +1077,6 @@ static HRESULT media_stream_create(IMFMediaSource *source, IMFStreamDescriptor * object->media_source = source; IMFStreamDescriptor_AddRef(descriptor); object->descriptor = descriptor; - object->wg_stream = wg_stream; TRACE("Created stream object %p.\n", object); @@ -1524,7 +1312,6 @@ static ULONG WINAPI media_source_Release(IMFMediaSource *iface) IMFByteStream_Release(source->byte_stream); wg_source_destroy(source->wg_source); free(source->read_buffer); - wg_parser_destroy(source->wg_parser); source->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&source->cs); free(source); @@ -1722,12 +1509,6 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) source->state = SOURCE_SHUTDOWN; - wg_parser_disconnect(source->wg_parser); - - source->read_thread_shutdown = true; - WaitForSingleObject(source->read_thread, INFINITE); - CloseHandle(source->read_thread); - IMFMediaEventQueue_Shutdown(source->event_queue); IMFByteStream_Close(source->byte_stream); @@ -1766,50 +1547,6 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = media_source_Shutdown, }; -static HRESULT map_stream_to_wg_parser_stream(struct media_source *source, UINT stream_count, - wg_parser_stream_t *parser_streams, wg_parser_stream_t parser_stream) -{ - struct wg_format parser_format, source_format; - HRESULT hr; - UINT i; - - wg_parser_stream_get_preferred_format(parser_stream, &parser_format); - - for (i = 0; i < stream_count; i++) - { - if (parser_streams[i]) - continue; - if (FAILED(hr = wg_source_get_stream_format(source->wg_source, source->stream_map[i], &source_format))) - return hr; - if ((parser_format.major_type >= WG_MAJOR_TYPE_VIDEO) != (source_format.major_type >= WG_MAJOR_TYPE_VIDEO) - || (parser_format.major_type >= WG_MAJOR_TYPE_AUDIO) != (source_format.major_type >= WG_MAJOR_TYPE_AUDIO)) - continue; - - TRACE("Mapped stream %#I64x with descriptor %u\n", parser_stream, i); - parser_streams[i] = parser_stream; - return S_OK; - } - - return E_FAIL; -} - -static void media_source_init_parser_streams(struct media_source *source, UINT stream_count, - wg_parser_stream_t *parser_streams) -{ - wg_parser_stream_t parser_stream; - UINT i, parser_stream_count; - HRESULT hr; - - parser_stream_count = wg_parser_get_stream_count(source->wg_parser); - for (i = 0; i < parser_stream_count; i++) - { - if (!(parser_stream = wg_parser_get_stream(source->wg_parser, i))) - continue; - if (FAILED(hr = map_stream_to_wg_parser_stream(source, stream_count, parser_streams, parser_stream))) - WARN("Failed to map parser stream %u, hr %#lx\n", i, hr); - } -} - static void media_source_init_stream_map(struct media_source *source, UINT stream_count) { struct wg_format format; @@ -1914,9 +1651,7 @@ static void media_source_init_descriptors(struct media_source *source) static HRESULT media_source_create(struct object_context *context, IMFMediaSource **out) { UINT32 stream_count = context->stream_count; - wg_parser_stream_t *parser_streams = NULL; struct media_source *object; - wg_parser_t parser; unsigned int i; HRESULT hr; @@ -1948,23 +1683,9 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc goto fail; if (FAILED(hr = wg_source_get_duration(object->wg_source, &object->duration))) goto fail; - - if (!(parser = wg_parser_create(WG_PARSER_DECODEBIN, FALSE, FALSE))) - { - hr = E_OUTOFMEMORY; - goto fail; - } - object->wg_parser = parser; - - object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL); - object->state = SOURCE_OPENING; - if (FAILED(hr = wg_parser_connect(parser, object->file_size, NULL))) - goto fail; - if (!(object->descriptors = calloc(stream_count, sizeof(*object->descriptors))) - || !(parser_streams = calloc(stream_count, sizeof(*parser_streams))) || !(object->stream_map = calloc(stream_count, sizeof(*object->stream_map))) || !(object->streams = calloc(stream_count, sizeof(*object->streams)))) { @@ -1973,22 +1694,18 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc } media_source_init_stream_map(object, stream_count); - media_source_init_parser_streams(object, stream_count, parser_streams); for (i = 0; i < stream_count; ++i) { - wg_parser_stream_t parser_stream; IMFStreamDescriptor *descriptor; struct media_stream *stream; struct wg_format format; - if (!(parser_stream = parser_streams[i])) - continue; - wg_parser_stream_get_preferred_format(parser_stream, &format); - + if (FAILED(hr = wg_source_get_stream_format(object->wg_source, object->stream_map[i], &format))) + goto fail; if (FAILED(hr = stream_descriptor_create(i + 1, &format, &descriptor))) goto fail; - if (FAILED(hr = media_stream_create(&object->IMFMediaSource_iface, descriptor, parser_stream, &stream))) + if (FAILED(hr = media_stream_create(&object->IMFMediaSource_iface, descriptor, &stream))) { IMFStreamDescriptor_Release(descriptor); goto fail; @@ -2000,8 +1717,6 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->stream_count++; } - free(parser_streams); - media_source_init_descriptors(object); object->state = SOURCE_STOPPED; @@ -2018,23 +1733,12 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc IMFStreamDescriptor_Release(object->descriptors[object->stream_count]); IMFMediaStream_Release(&stream->IMFMediaStream_iface); } - free(parser_streams); free(object->stream_map); free(object->descriptors); free(object->streams); - if (object->state == SOURCE_OPENING) - wg_parser_disconnect(object->wg_parser); - if (object->read_thread) - { - object->read_thread_shutdown = true; - WaitForSingleObject(object->read_thread, INFINITE); - CloseHandle(object->read_thread); - } if (object->wg_source) wg_source_destroy(object->wg_source); - if (object->wg_parser) - wg_parser_destroy(object->wg_parser); if (object->async_commands_queue) MFUnlockWorkQueue(object->async_commands_queue); if (object->event_queue) From 841ac075f26a403006df0199b1e375e7f911e471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 15 Nov 2023 18:47:17 +0100 Subject: [PATCH 1189/1506] winegstreamer: Call gst_audio_info_from_caps for all audio formats. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_format.c | 54 +++++++++++++--------------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index 1c9b49a1e55..d09031a339f 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -396,43 +396,31 @@ void wg_format_from_caps(struct wg_format *format, const GstCaps *caps) { const GstStructure *structure = gst_caps_get_structure(caps, 0); const char *name = gst_structure_get_name(structure); + GstAudioInfo audio_info; + GstVideoInfo video_info; gboolean parsed; memset(format, 0, sizeof(*format)); - if (!strcmp(name, "audio/x-raw")) - { - GstAudioInfo info; - - if (gst_audio_info_from_caps(&info, caps)) - wg_format_from_audio_info(format, &info); - } - else if (!strcmp(name, "video/x-raw")) - { - GstVideoInfo info; - - if (gst_video_info_from_caps(&info, caps)) - wg_format_from_video_info(format, &info); - } - else if (!strcmp(name, "audio/mpeg") && gst_structure_get_boolean(structure, "parsed", &parsed) && parsed) - { - wg_format_from_caps_audio_mpeg1(format, caps); - } - else if (!strcmp(name, "audio/x-wma")) - { - wg_format_from_caps_audio_wma(format, caps); - } - else if (!strcmp(name, "video/x-cinepak")) - { - wg_format_from_caps_video_cinepak(format, caps); - } - else if (!strcmp(name, "video/x-wmv")) - { - wg_format_from_caps_video_wmv(format, caps); - } - else if (!strcmp(name, "video/mpeg") && gst_structure_get_boolean(structure, "parsed", &parsed) && parsed) - { - wg_format_from_caps_video_mpeg1(format, caps); + if (g_str_has_prefix(name, "audio/") && gst_audio_info_from_caps(&audio_info, caps)) + { + if (GST_AUDIO_INFO_FORMAT(&audio_info) != GST_AUDIO_FORMAT_ENCODED) + wg_format_from_audio_info(format, &audio_info); + else if (!strcmp(name, "audio/mpeg") && gst_structure_get_boolean(structure, "parsed", &parsed) && parsed) + wg_format_from_caps_audio_mpeg1(format, caps); + else if (!strcmp(name, "audio/x-wma")) + wg_format_from_caps_audio_wma(format, caps); + } + else if (g_str_has_prefix(name, "video/") && gst_video_info_from_caps(&video_info, caps)) + { + if (GST_VIDEO_INFO_FORMAT(&video_info) != GST_VIDEO_FORMAT_ENCODED) + wg_format_from_video_info(format, &video_info); + else if (!strcmp(name, "video/x-cinepak")) + wg_format_from_caps_video_cinepak(format, caps); + else if (!strcmp(name, "video/x-wmv")) + wg_format_from_caps_video_wmv(format, caps); + else if (!strcmp(name, "video/mpeg") && gst_structure_get_boolean(structure, "parsed", &parsed) && parsed) + wg_format_from_caps_video_mpeg1(format, caps); } else { From 77f74e7ad626ebcaea69d762d0b3ef7973162c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 15 Nov 2023 18:13:17 +0100 Subject: [PATCH 1190/1506] winegstreamer: Support generic audio / video encoded format. CW-Bug-Id: #21953 --- dlls/winegstreamer/mfplat.c | 2 ++ dlls/winegstreamer/quartz_parser.c | 4 +++ dlls/winegstreamer/unixlib.h | 14 ++++++++ dlls/winegstreamer/wg_format.c | 56 ++++++++++++++++++++++++++++++ dlls/winegstreamer/wg_transform.c | 6 +++- dlls/winegstreamer/wm_reader.c | 8 +++++ 6 files changed, 89 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 452289c2e6a..8c8dcc32383 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -576,11 +576,13 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_WMV: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_MPEG1: + case WG_MAJOR_TYPE_VIDEO_ENCODED: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index dcd29d1c9fd..569a7010ebb 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -467,8 +467,10 @@ unsigned int wg_format_get_max_size(const struct wg_format *format) return format->u.audio_wma.rate * format->u.audio_wma.channels * format->u.audio_wma.depth / 8; case WG_MAJOR_TYPE_AUDIO_MPEG4: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_INDEO: + case WG_MAJOR_TYPE_VIDEO_ENCODED: FIXME("Format %u not implemented!\n", format->major_type); return 0; @@ -729,8 +731,10 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool switch (format->major_type) { case WG_MAJOR_TYPE_AUDIO_MPEG4: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_INDEO: + case WG_MAJOR_TYPE_VIDEO_ENCODED: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 165d0c57fd7..1e74a36764f 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -37,12 +37,14 @@ enum wg_major_type WG_MAJOR_TYPE_AUDIO_MPEG1, WG_MAJOR_TYPE_AUDIO_MPEG4, WG_MAJOR_TYPE_AUDIO_WMA, + WG_MAJOR_TYPE_AUDIO_ENCODED, WG_MAJOR_TYPE_VIDEO, WG_MAJOR_TYPE_VIDEO_CINEPAK, WG_MAJOR_TYPE_VIDEO_H264, WG_MAJOR_TYPE_VIDEO_WMV, WG_MAJOR_TYPE_VIDEO_INDEO, WG_MAJOR_TYPE_VIDEO_MPEG1, + WG_MAJOR_TYPE_VIDEO_ENCODED, }; typedef UINT32 wg_audio_format; @@ -128,6 +130,12 @@ struct wg_format unsigned char codec_data[64]; UINT8 is_xma; } audio_wma; + struct + { + uint32_t channels; + uint32_t rate; + char caps[512]; + } audio_encoded; struct { @@ -173,6 +181,12 @@ struct wg_format int32_t width, height; uint32_t fps_n, fps_d; } video_mpeg1; + struct + { + int32_t width, height; + uint32_t fps_n, fps_d; + char caps[512]; + } video_encoded; } u; }; diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index d09031a339f..e6fc0f7b351 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -267,6 +267,25 @@ static void wg_format_from_caps_audio_wma(struct wg_format *format, const GstCap gst_buffer_unmap(codec_data, &map); } +static void wg_format_from_caps_audio_encoded(struct wg_format *format, const GstCaps *caps, + const GstAudioInfo *info) +{ + gchar *str; + gint len; + + format->major_type = WG_MAJOR_TYPE_AUDIO_ENCODED; + format->u.audio_encoded.rate = info->rate; + format->u.audio_encoded.channels = info->channels; + + str = gst_caps_to_string(caps); + len = strlen(str) + 1; + if (len >= ARRAY_SIZE(format->u.audio_encoded.caps)) + GST_FIXME("wg_format.audio_encoded.caps buffer is too small, need %u bytes", len); + else + memcpy(format->u.audio_encoded.caps, str, len); + g_free(str); +} + static void wg_format_from_caps_video_cinepak(struct wg_format *format, const GstCaps *caps) { const GstStructure *structure = gst_caps_get_structure(caps, 0); @@ -392,6 +411,27 @@ static void wg_format_from_caps_video_mpeg1(struct wg_format *format, const GstC format->u.video_mpeg1.fps_d = fps_d; } +static void wg_format_from_caps_video_encoded(struct wg_format *format, const GstCaps *caps, + const GstVideoInfo *info) +{ + gchar *str; + gint len; + + format->major_type = WG_MAJOR_TYPE_VIDEO_ENCODED; + format->u.video_encoded.width = info->width; + format->u.video_encoded.height = info->height; + format->u.video_encoded.fps_n = info->fps_n; + format->u.video_encoded.fps_d = info->fps_d; + + str = gst_caps_to_string(caps); + len = strlen(str) + 1; + if (len >= ARRAY_SIZE(format->u.video_encoded.caps)) + GST_FIXME("wg_format.video_encoded.caps buffer is too small, need %u bytes", len); + else + memcpy(format->u.video_encoded.caps, str, len); + g_free(str); +} + void wg_format_from_caps(struct wg_format *format, const GstCaps *caps) { const GstStructure *structure = gst_caps_get_structure(caps, 0); @@ -410,6 +450,11 @@ void wg_format_from_caps(struct wg_format *format, const GstCaps *caps) wg_format_from_caps_audio_mpeg1(format, caps); else if (!strcmp(name, "audio/x-wma")) wg_format_from_caps_audio_wma(format, caps); + else + { + GST_FIXME("Using fallback for encoded audio caps %" GST_PTR_FORMAT ".", caps); + wg_format_from_caps_audio_encoded(format, caps, &audio_info); + } } else if (g_str_has_prefix(name, "video/") && gst_video_info_from_caps(&video_info, caps)) { @@ -421,6 +466,11 @@ void wg_format_from_caps(struct wg_format *format, const GstCaps *caps) wg_format_from_caps_video_wmv(format, caps); else if (!strcmp(name, "video/mpeg") && gst_structure_get_boolean(structure, "parsed", &parsed) && parsed) wg_format_from_caps_video_mpeg1(format, caps); + else + { + GST_FIXME("Using fallback for encoded video caps %" GST_PTR_FORMAT ".", caps); + wg_format_from_caps_video_encoded(format, caps, &video_info); + } } else { @@ -870,6 +920,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) return wg_format_to_caps_audio_mpeg4(format); case WG_MAJOR_TYPE_AUDIO_WMA: return wg_format_to_caps_audio_wma(format); + case WG_MAJOR_TYPE_AUDIO_ENCODED: + return gst_caps_from_string(format->u.audio_encoded.caps); case WG_MAJOR_TYPE_VIDEO: return wg_format_to_caps_video(format); case WG_MAJOR_TYPE_VIDEO_CINEPAK: @@ -882,6 +934,8 @@ GstCaps *wg_format_to_caps(const struct wg_format *format) return wg_format_to_caps_video_indeo(format); case WG_MAJOR_TYPE_VIDEO_MPEG1: return wg_format_to_caps_video_mpeg1(format); + case WG_MAJOR_TYPE_VIDEO_ENCODED: + return gst_caps_from_string(format->u.video_encoded.caps); } assert(0); return NULL; @@ -897,9 +951,11 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b) case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_MPEG1: + case WG_MAJOR_TYPE_VIDEO_ENCODED: GST_FIXME("Format %u not implemented!", a->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 557d7024246..4acc449a7f5 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -404,10 +404,12 @@ NTSTATUS wg_transform_create(void *args) switch (input_format.major_type) { - case WG_MAJOR_TYPE_VIDEO_H264: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: + case WG_MAJOR_TYPE_VIDEO_ENCODED: + case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_WMV: @@ -486,11 +488,13 @@ NTSTATUS wg_transform_create(void *args) case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_WMV: case WG_MAJOR_TYPE_VIDEO_MPEG1: + case WG_MAJOR_TYPE_VIDEO_ENCODED: GST_FIXME("Format %u not implemented!", output_format.major_type); goto out; } diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index ffb78f3cbc9..1421fb6a5ac 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1675,6 +1675,10 @@ static const char *get_major_type_string(enum wg_major_type type) return "indeo"; case WG_MAJOR_TYPE_VIDEO_MPEG1: return "mpeg1-video"; + case WG_MAJOR_TYPE_AUDIO_ENCODED: + return "unknown-audio"; + case WG_MAJOR_TYPE_VIDEO_ENCODED: + return "unknown-video"; case WG_MAJOR_TYPE_UNKNOWN: return "unknown"; } @@ -2043,11 +2047,13 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface, case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_WMV: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_MPEG1: + case WG_MAJOR_TYPE_VIDEO_ENCODED: FIXME("Format %u not implemented!\n", format.major_type); break; case WG_MAJOR_TYPE_UNKNOWN: @@ -2086,11 +2092,13 @@ static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD o case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: + case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_WMV: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_MPEG1: + case WG_MAJOR_TYPE_VIDEO_ENCODED: FIXME("Format %u not implemented!\n", format.major_type); /* fallthrough */ case WG_MAJOR_TYPE_AUDIO: From 3dcb087767194196ae5e336cd14cde131e28cbc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 19 Nov 2023 12:49:03 +0100 Subject: [PATCH 1191/1506] winegstreamer: Skip encoded formats in format_is_compressed. CW-Bug-Id: #21953 --- dlls/winegstreamer/wg_parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index d6de243f3b2..dd555a7ce19 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -147,7 +147,9 @@ static bool format_is_compressed(struct wg_format *format) { return format->major_type != WG_MAJOR_TYPE_UNKNOWN && format->major_type != WG_MAJOR_TYPE_VIDEO - && format->major_type != WG_MAJOR_TYPE_AUDIO; + && format->major_type != WG_MAJOR_TYPE_AUDIO + && format->major_type != WG_MAJOR_TYPE_VIDEO_ENCODED + && format->major_type != WG_MAJOR_TYPE_AUDIO_ENCODED; } static NTSTATUS wg_parser_get_stream_count(void *args) From b98066788e613d9eba4e1b69dcedb2a63a947cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 15 Nov 2023 18:13:17 +0100 Subject: [PATCH 1192/1506] winegstreamer: Translate generic audio / video encoded media types. CW-Bug-Id: #21953 --- dlls/winegstreamer/mfplat.c | 138 +++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 8c8dcc32383..a5325061b66 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -45,6 +45,8 @@ DEFINE_MEDIATYPE_GUID(MFAudioFormat_RAW_AAC,WAVE_FORMAT_RAW_AAC1); DEFINE_MEDIATYPE_GUID(MFAudioFormat_XMAudio2, 0x0166); DEFINE_MEDIATYPE_GUID(MFVideoFormat_VC1S,MAKEFOURCC('V','C','1','S')); DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50,MAKEFOURCC('I','V','5','0')); +DEFINE_MEDIATYPE_GUID(MFAudioFormat_GStreamer,MAKEFOURCC('G','S','T','a')); +DEFINE_MEDIATYPE_GUID(MFVideoFormat_GStreamer,MAKEFOURCC('G','S','T','v')); extern GUID MEDIASUBTYPE_VC1S; @@ -569,6 +571,74 @@ static IMFMediaType *mf_media_type_from_wg_format_video(const struct wg_format * return NULL; } +static IMFMediaType *mf_media_type_from_wg_format_audio_encoded(const struct wg_format *format) +{ + IMFMediaType *type; + UINT32 value; + HRESULT hr; + + if (FAILED(MFCreateMediaType(&type))) + return NULL; + if (FAILED(hr = IMFMediaType_SetGUID(type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio))) + goto done; + if (FAILED(hr = IMFMediaType_SetGUID(type, &MF_MT_SUBTYPE, &MFAudioFormat_GStreamer))) + goto done; + + value = format->u.audio_encoded.rate; + if (value && FAILED(hr = IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, value))) + goto done; + value = format->u.audio_encoded.channels; + if (value && FAILED(hr = IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, value))) + goto done; + if (FAILED(hr = IMFMediaType_SetBlob(type, &MF_MT_USER_DATA, (BYTE *)format->u.audio_encoded.caps, + strlen(format->u.audio_encoded.caps) + 1))) + goto done; + +done: + if (FAILED(hr)) + { + IMFMediaType_Release(type); + return NULL; + } + return type; +} + +static IMFMediaType *mf_media_type_from_wg_format_video_encoded(const struct wg_format *format) +{ + UINT64 frame_rate, frame_size; + IMFMediaType *type; + HRESULT hr; + + if (FAILED(MFCreateMediaType(&type))) + return NULL; + if (FAILED(hr = IMFMediaType_SetGUID(type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video))) + goto done; + if (FAILED(hr = IMFMediaType_SetGUID(type, &MF_MT_SUBTYPE, &MFVideoFormat_GStreamer))) + goto done; + if (FAILED(hr = IMFMediaType_SetUINT32(type, &MF_MT_VIDEO_ROTATION, MFVideoRotationFormat_0))) + goto done; + if (FAILED(hr = IMFMediaType_SetUINT32(type, &MF_MT_COMPRESSED, TRUE))) + goto done; + + frame_size = (UINT64)format->u.video_encoded.width << 32 | format->u.video_encoded.height; + if (FAILED(hr = IMFMediaType_SetUINT64(type, &MF_MT_FRAME_SIZE, frame_size))) + goto done; + frame_rate = (UINT64)format->u.video_encoded.fps_n << 32 | format->u.video_encoded.fps_d; + if (FAILED(hr = IMFMediaType_SetUINT64(type, &MF_MT_FRAME_RATE, frame_rate))) + goto done; + if (FAILED(hr = IMFMediaType_SetBlob(type, &MF_MT_USER_DATA, (BYTE *)format->u.video_encoded.caps, + strlen(format->u.video_encoded.caps) + 1))) + goto done; + +done: + if (FAILED(hr)) + { + IMFMediaType_Release(type); + return NULL; + } + return type; +} + IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) { switch (format->major_type) @@ -576,13 +646,11 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) case WG_MAJOR_TYPE_AUDIO_MPEG1: case WG_MAJOR_TYPE_AUDIO_MPEG4: case WG_MAJOR_TYPE_AUDIO_WMA: - case WG_MAJOR_TYPE_AUDIO_ENCODED: case WG_MAJOR_TYPE_VIDEO_CINEPAK: case WG_MAJOR_TYPE_VIDEO_H264: case WG_MAJOR_TYPE_VIDEO_WMV: case WG_MAJOR_TYPE_VIDEO_INDEO: case WG_MAJOR_TYPE_VIDEO_MPEG1: - case WG_MAJOR_TYPE_VIDEO_ENCODED: FIXME("Format %u not implemented!\n", format->major_type); /* fallthrough */ case WG_MAJOR_TYPE_UNKNOWN: @@ -590,9 +658,13 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format) case WG_MAJOR_TYPE_AUDIO: return mf_media_type_from_wg_format_audio(format); + case WG_MAJOR_TYPE_AUDIO_ENCODED: + return mf_media_type_from_wg_format_audio_encoded(format); case WG_MAJOR_TYPE_VIDEO: return mf_media_type_from_wg_format_video(format); + case WG_MAJOR_TYPE_VIDEO_ENCODED: + return mf_media_type_from_wg_format_video_encoded(format); } assert(0); @@ -684,6 +756,29 @@ static void mf_media_type_to_wg_format_audio_mpeg4(IMFMediaType *type, const GUI format->u.audio_mpeg4.codec_data_len = codec_data_size; } +static void mf_media_type_to_wg_format_audio_encoded(IMFMediaType *type, struct wg_format *format) +{ + UINT32 caps_len; + BYTE *caps; + HRESULT hr; + + memset(format, 0, sizeof(*format)); + format->major_type = WG_MAJOR_TYPE_AUDIO_ENCODED; + + if (FAILED(hr = IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_SAMPLES_PER_SECOND, &format->u.audio_encoded.rate))) + WARN("Failed to get MF_MT_AUDIO_SAMPLES_PER_SECOND for type %p, hr %#lx.\n", type, hr); + if (FAILED(hr = IMFMediaType_GetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, &format->u.audio_encoded.channels))) + WARN("Failed to get MF_MT_AUDIO_NUM_CHANNELS for type %p, hr %#lx.\n", type, hr); + + if (FAILED(hr = IMFMediaType_GetAllocatedBlob(type, &MF_MT_USER_DATA, &caps, &caps_len))) + WARN("Failed to get MF_MT_USER_DATA for type %p, hr %#lx.\n", type, hr); + else + { + strcpy(format->u.audio_encoded.caps, (char *)caps); + CoTaskMemFree(caps); + } +} + static enum wg_video_format mf_video_format_to_wg(const GUID *subtype) { unsigned int i; @@ -922,6 +1017,41 @@ static void mf_media_type_to_wg_format_wmv(IMFMediaType *type, const GUID *subty format->u.video_wmv.format = WG_WMV_VIDEO_FORMAT_UNKNOWN; } +static void mf_media_type_to_wg_format_video_encoded(IMFMediaType *type, struct wg_format *format) +{ + UINT64 frame_rate, frame_size; + UINT32 caps_len; + HRESULT hr; + BYTE *caps; + + memset(format, 0, sizeof(*format)); + format->major_type = WG_MAJOR_TYPE_VIDEO_ENCODED; + + if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) + WARN("Failed to get MF_MT_FRAME_SIZE for type %p, hr %#lx.\n", type, hr); + else + { + format->u.video_encoded.width = frame_size >> 32; + format->u.video_encoded.height = (UINT32)frame_size; + } + + if (FAILED(IMFMediaType_GetUINT64(type, &MF_MT_FRAME_RATE, &frame_rate)) && (UINT32)frame_rate) + WARN("Failed to get MF_MT_FRAME_RATE for type %p, hr %#lx.\n", type, hr); + else + { + format->u.video_encoded.fps_n = frame_rate >> 32; + format->u.video_encoded.fps_d = (UINT32)frame_rate; + } + + if (FAILED(hr = IMFMediaType_GetAllocatedBlob(type, &MF_MT_USER_DATA, &caps, &caps_len))) + WARN("Failed to get MF_MT_USER_DATA for type %p, hr %#lx.\n", type, hr); + else + { + strcpy(format->u.video_encoded.caps, (char *)caps); + CoTaskMemFree(caps); + } +} + void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) { GUID major_type, subtype; @@ -949,6 +1079,8 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) mf_media_type_to_wg_format_audio_wma(type, &subtype, format); else if (IsEqualGUID(&subtype, &MFAudioFormat_AAC) || IsEqualGUID(&subtype, &MFAudioFormat_RAW_AAC)) mf_media_type_to_wg_format_audio_mpeg4(type, &subtype, format); + else if (IsEqualGUID(&subtype, &MFAudioFormat_GStreamer)) + mf_media_type_to_wg_format_audio_encoded(type, format); else mf_media_type_to_wg_format_audio(type, &subtype, format); } @@ -968,6 +1100,8 @@ void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format) || IsEqualGUID(&subtype, &MFVideoFormat_WVC1) || IsEqualGUID(&subtype, &MEDIASUBTYPE_VC1S)) mf_media_type_to_wg_format_wmv(type, &subtype, format); + else if (IsEqualGUID(&subtype, &MFVideoFormat_GStreamer)) + mf_media_type_to_wg_format_video_encoded(type, format); else mf_media_type_to_wg_format_video(type, &subtype, format); } From fbea0ea230e34c36869882fe6277c5cd673337b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Nov 2023 11:13:35 +0100 Subject: [PATCH 1193/1506] winegstreamer: Rename aac_decoder to audio_decoder. CW-Bug-Id: #21953 --- dlls/winegstreamer/Makefile.in | 2 +- .../{aac_decoder.c => audio_decoder.c} | 50 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) rename dlls/winegstreamer/{aac_decoder.c => audio_decoder.c} (92%) diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 49cfafc2a8e..22238b3b765 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -7,7 +7,7 @@ UNIX_CFLAGS = $(GSTREAMER_CFLAGS) UNIX_LIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS) SOURCES = \ - aac_decoder.c \ + audio_decoder.c \ color_convert.c \ h264_decoder.c \ main.c \ diff --git a/dlls/winegstreamer/aac_decoder.c b/dlls/winegstreamer/audio_decoder.c similarity index 92% rename from dlls/winegstreamer/aac_decoder.c rename to dlls/winegstreamer/audio_decoder.c index c0bc57f278e..82af33b671b 100644 --- a/dlls/winegstreamer/aac_decoder.c +++ b/dlls/winegstreamer/audio_decoder.c @@ -34,7 +34,7 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); #define NEXT_WAVEFORMATEXTENSIBLE(format) (WAVEFORMATEXTENSIBLE *)((BYTE *)(&(format)->Format + 1) + (format)->Format.cbSize) -static WAVEFORMATEXTENSIBLE const aac_decoder_output_types[] = +static WAVEFORMATEXTENSIBLE const audio_decoder_output_types[] = { {.Format = {.wFormatTag = WAVE_FORMAT_IEEE_FLOAT, .wBitsPerSample = 32, .nSamplesPerSec = 48000, .nChannels = 2}}, {.Format = {.wFormatTag = WAVE_FORMAT_PCM, .wBitsPerSample = 16, .nSamplesPerSec = 48000, .nChannels = 2}}, @@ -51,7 +51,7 @@ static const UINT32 default_channel_mask[7] = KSAUDIO_SPEAKER_5POINT1, }; -struct aac_decoder +struct audio_decoder { IMFTransform IMFTransform_iface; LONG refcount; @@ -66,12 +66,12 @@ struct aac_decoder struct wg_sample_queue *wg_sample_queue; }; -static struct aac_decoder *impl_from_IMFTransform(IMFTransform *iface) +static struct audio_decoder *impl_from_IMFTransform(IMFTransform *iface) { - return CONTAINING_RECORD(iface, struct aac_decoder, IMFTransform_iface); + return CONTAINING_RECORD(iface, struct audio_decoder, IMFTransform_iface); } -static HRESULT try_create_wg_transform(struct aac_decoder *decoder) +static HRESULT try_create_wg_transform(struct audio_decoder *decoder) { struct wg_format input_format, output_format; struct wg_transform_attrs attrs = {0}; @@ -96,7 +96,7 @@ static HRESULT try_create_wg_transform(struct aac_decoder *decoder) static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, void **out) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); @@ -115,7 +115,7 @@ static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, static ULONG WINAPI transform_AddRef(IMFTransform *iface) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); ULONG refcount = InterlockedIncrement(&decoder->refcount); TRACE("iface %p increasing refcount to %lu.\n", decoder, refcount); return refcount; @@ -123,7 +123,7 @@ static ULONG WINAPI transform_AddRef(IMFTransform *iface) static ULONG WINAPI transform_Release(IMFTransform *iface) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); ULONG refcount = InterlockedDecrement(&decoder->refcount); TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount); @@ -228,7 +228,7 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); const WAVEFORMATEXTENSIBLE *format = decoder->input_types; UINT count = decoder->input_type_count; @@ -245,7 +245,7 @@ static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); UINT32 channel_count, sample_rate; WAVEFORMATEXTENSIBLE wfx = {{0}}; IMFMediaType *media_type; @@ -260,7 +260,7 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR if (!decoder->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET; - wfx = aac_decoder_output_types[index % ARRAY_SIZE(aac_decoder_output_types)]; + wfx = audio_decoder_output_types[index % ARRAY_SIZE(audio_decoder_output_types)]; if (FAILED(hr = IMFMediaType_GetUINT32(decoder->input_type, &MF_MT_AUDIO_NUM_CHANNELS, &channel_count)) || !channel_count) @@ -271,15 +271,15 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR if (channel_count >= ARRAY_SIZE(default_channel_mask)) return MF_E_INVALIDMEDIATYPE; - if (channel_count > 2 && index >= ARRAY_SIZE(aac_decoder_output_types)) + if (channel_count > 2 && index >= ARRAY_SIZE(audio_decoder_output_types)) { /* If there are more than two channels in the input type GetOutputAvailableType additionally lists * types with 2 channels. */ - index -= ARRAY_SIZE(aac_decoder_output_types); + index -= ARRAY_SIZE(audio_decoder_output_types); channel_count = 2; } - if (index >= ARRAY_SIZE(aac_decoder_output_types)) + if (index >= ARRAY_SIZE(audio_decoder_output_types)) return MF_E_NO_MORE_TYPES; wfx.Format.nChannels = channel_count; @@ -321,7 +321,7 @@ static BOOL matches_format(const WAVEFORMATEXTENSIBLE *a, const WAVEFORMATEXTENS static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); UINT32 size, count = decoder->input_type_count; WAVEFORMATEXTENSIBLE *format, wfx; HRESULT hr; @@ -361,7 +361,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); WAVEFORMATEXTENSIBLE *format, wfx; UINT32 size; HRESULT hr; @@ -380,10 +380,10 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF wfx = *format; CoTaskMemFree(format); - for (i = 0; i < ARRAY_SIZE(aac_decoder_output_types); ++i) - if (matches_format(&aac_decoder_output_types[i], &wfx)) + for (i = 0; i < ARRAY_SIZE(audio_decoder_output_types); ++i) + if (matches_format(&audio_decoder_output_types[i], &wfx)) break; - if (i == ARRAY_SIZE(aac_decoder_output_types)) + if (i == ARRAY_SIZE(audio_decoder_output_types)) return MF_E_INVALIDMEDIATYPE; if (!wfx.Format.wBitsPerSample || !wfx.Format.nChannels || !wfx.Format.nSamplesPerSec) @@ -410,7 +410,7 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **out) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); IMFMediaType *type; HRESULT hr; @@ -432,7 +432,7 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **out) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); IMFMediaType *type; HRESULT hr; @@ -454,7 +454,7 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); bool accepts_input; TRACE("iface %p, id %#lx, flags %p.\n", iface, id, flags); @@ -495,7 +495,7 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_ static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags); @@ -508,7 +508,7 @@ static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFS static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) { - struct aac_decoder *decoder = impl_from_IMFTransform(iface); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); MFT_OUTPUT_STREAM_INFO info; HRESULT hr; @@ -598,7 +598,7 @@ HRESULT aac_decoder_create(REFIID riid, void **ret) static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_AUDIO_MPEG4}; struct wg_transform_attrs attrs = {0}; wg_transform_t transform; - struct aac_decoder *decoder; + struct audio_decoder *decoder; HRESULT hr; TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret); From 8608e399f0ad44a2529f22d15634f288c9987677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 28 Jul 2023 15:46:13 +0200 Subject: [PATCH 1194/1506] winegstreamer: Introduce a generic audio decoder transform. CW-Bug-Id: #21953 --- dlls/winegstreamer/audio_decoder.c | 38 ++++++++++++++++++++ dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/mfplat.c | 22 ++++++++++++ dlls/winegstreamer/winegstreamer_classes.idl | 6 ++++ 4 files changed, 67 insertions(+) diff --git a/dlls/winegstreamer/audio_decoder.c b/dlls/winegstreamer/audio_decoder.c index 82af33b671b..771eae465fe 100644 --- a/dlls/winegstreamer/audio_decoder.c +++ b/dlls/winegstreamer/audio_decoder.c @@ -612,6 +612,9 @@ HRESULT aac_decoder_create(REFIID riid, void **ret) if (!(decoder = calloc(1, sizeof(*decoder)))) return E_OUTOFMEMORY; + decoder->IMFTransform_iface.lpVtbl = &transform_vtbl; + decoder->refcount = 1; + decoder->input_types = (WAVEFORMATEXTENSIBLE *)aac_decoder_input_types; decoder->input_type_count = ARRAY_SIZE(aac_decoder_input_types); @@ -621,9 +624,44 @@ HRESULT aac_decoder_create(REFIID riid, void **ret) return hr; } + *ret = &decoder->IMFTransform_iface; + TRACE("Created decoder %p\n", *ret); + return S_OK; +} + +static WAVEFORMATEXTENSIBLE audio_decoder_input_types[] = +{ +#define MAKE_WAVEFORMATEXTENSIBLE(format) \ + {.Format = {.wFormatTag = WAVE_FORMAT_EXTENSIBLE, .nChannels = 6, .nSamplesPerSec = 48000, .nAvgBytesPerSec = 1152000, \ + .nBlockAlign = 24, .wBitsPerSample = 32, .cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)}, \ + .SubFormat = {format,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}}} + + MAKE_WAVEFORMATEXTENSIBLE(MAKEFOURCC('G','S','T','a')), + +#undef MAKE_WAVEFORMATEXTENSIBLE +}; + +HRESULT audio_decoder_create(REFIID riid, void **ret) +{ + struct audio_decoder *decoder; + HRESULT hr; + + TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret); + + if (!(decoder = calloc(1, sizeof(*decoder)))) + return E_OUTOFMEMORY; decoder->IMFTransform_iface.lpVtbl = &transform_vtbl; decoder->refcount = 1; + decoder->input_types = audio_decoder_input_types; + decoder->input_type_count = ARRAY_SIZE(audio_decoder_input_types); + + if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue))) + { + free(decoder); + return hr; + } + *ret = &decoder->IMFTransform_iface; TRACE("Created decoder %p\n", *ret); return S_OK; diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 84857c5adfa..c894fd0b1ae 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -188,6 +188,7 @@ unsigned int wg_format_get_stride(const struct wg_format *format); bool wg_video_format_is_rgb(enum wg_video_format format); +HRESULT audio_decoder_create(REFIID riid, void **ret); HRESULT aac_decoder_create(REFIID riid, void **ret); HRESULT h264_decoder_create(REFIID riid, void **ret); HRESULT video_processor_create(REFIID riid, void **ret); diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index a5325061b66..ea72539d1b6 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -128,6 +128,7 @@ static const IClassFactoryVtbl class_factory_vtbl = static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_GStreamerByteStreamHandler2 = {0x317df619, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; +static const GUID CLSID_GStreamerAudioDecoder = {0x480b1517, 0xc8e9, 0x4eae, {0xb0, 0x06, 0xe6, 0x30, 0x07, 0x18, 0xd8, 0x5d}}; static const GUID CLSID_GStreamerSchemePlugin = {0x587eeb6a,0x7336,0x4ebd,{0xa4,0xf2,0x91,0xc9,0x48,0xde,0x62,0x2c}}; @@ -138,6 +139,7 @@ static const struct class_object } class_objects[] = { + { &CLSID_GStreamerAudioDecoder, &audio_decoder_create }, { &CLSID_VideoProcessorMFT, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_GStreamerByteStreamHandler2, &gstreamer_byte_stream_handler_2_create }, @@ -339,6 +341,16 @@ HRESULT mfplat_DllRegisterServer(void) {MFMediaType_Video, MFVideoFormat_NV11}, }; + MFT_REGISTER_TYPE_INFO audio_decoder_input_types[] = + { + {MFMediaType_Audio, MFAudioFormat_GStreamer}, + }; + MFT_REGISTER_TYPE_INFO audio_decoder_output_types[] = + { + {MFMediaType_Audio, MFAudioFormat_Float}, + {MFMediaType_Audio, MFAudioFormat_PCM}, + }; + struct mft { GUID clsid; @@ -422,6 +434,16 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(color_convert_output_types), color_convert_output_types, }, + { + CLSID_GStreamerAudioDecoder, + MFT_CATEGORY_AUDIO_DECODER, + L"Wine Audio Decoder MFT", + MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(audio_decoder_input_types), + audio_decoder_input_types, + ARRAY_SIZE(audio_decoder_output_types), + audio_decoder_output_types, + }, }; unsigned int i; diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 493e6cff2b0..2ef6d994274 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -89,6 +89,12 @@ coclass GStreamerByteStreamHandler {} ] coclass GStreamerByteStreamHandler2 {} +[ + threading(both), + uuid(480b1517-c8e9-4eae-b006-e6300718d85d) +] +coclass GStreamerAudioDecoder {} + [ threading(both), uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) From 9c862139acf40f99d060b5a3a53c32ef40e4b2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 11:44:51 +0100 Subject: [PATCH 1195/1506] winegstreamer: Use MFCreateVideoMediaTypeFromSubtype in GetInputAvailableType. CW-Bug-Id: #21953 --- dlls/winegstreamer/h264_decoder.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index aff9e73d051..0ba9f378373 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -398,27 +398,12 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - IMFMediaType *media_type; - const GUID *subtype; - HRESULT hr; - TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); *type = NULL; - if (index >= ARRAY_SIZE(h264_decoder_input_types)) return MF_E_NO_MORE_TYPES; - subtype = h264_decoder_input_types[index]; - - if (FAILED(hr = MFCreateMediaType(&media_type))) - return hr; - - if (SUCCEEDED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video)) && - SUCCEEDED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, subtype))) - IMFMediaType_AddRef((*type = media_type)); - - IMFMediaType_Release(media_type); - return hr; + return MFCreateVideoMediaTypeFromSubtype(h264_decoder_input_types[index], (IMFVideoMediaType **)type); } static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, From e297f0ba75b9a83c7acbd84850939aaab96a6f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 11:52:09 +0100 Subject: [PATCH 1196/1506] winegstreamer: Use MFCreateVideoMediaTypeFromSubtype in GetOutputAvailableType. CW-Bug-Id: #21953 --- dlls/winegstreamer/h264_decoder.c | 116 +++++++++++++----------------- 1 file changed, 49 insertions(+), 67 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 0ba9f378373..8ec0671bbbe 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -122,102 +122,106 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) return S_OK; } -static HRESULT fill_output_media_type(struct h264_decoder *decoder, IMFMediaType *media_type) +static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID *subtype, + IMFMediaType **media_type) { IMFMediaType *default_type = decoder->output_type; + IMFVideoMediaType *video_type; UINT32 value, width, height; MFVideoArea aperture; UINT64 ratio; - GUID subtype; HRESULT hr; - if (FAILED(hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &subtype))) + if (FAILED(hr = MFCreateVideoMediaTypeFromSubtype(subtype, &video_type))) return hr; - if (FAILED(hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &ratio))) + if (FAILED(IMFVideoMediaType_GetUINT64(video_type, &MF_MT_FRAME_SIZE, &ratio))) { if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, &ratio))) ratio = (UINT64)1920 << 32 | 1080; - if (FAILED(hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, ratio))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, ratio))) + goto done; } width = ratio >> 32; height = ratio; - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_FRAME_RATE, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_FRAME_RATE, NULL))) { if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_RATE, &ratio))) ratio = (UINT64)30000 << 32 | 1001; - if (FAILED(hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_RATE, ratio))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_RATE, ratio))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_PIXEL_ASPECT_RATIO, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_PIXEL_ASPECT_RATIO, NULL))) { if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_PIXEL_ASPECT_RATIO, &ratio))) ratio = (UINT64)1 << 32 | 1; - if (FAILED(hr = IMFMediaType_SetUINT64(media_type, &MF_MT_PIXEL_ASPECT_RATIO, ratio))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_PIXEL_ASPECT_RATIO, ratio))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_SAMPLE_SIZE, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_SAMPLE_SIZE, NULL))) { - if (FAILED(hr = MFCalculateImageSize(&subtype, width, height, &value))) - return hr; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_SAMPLE_SIZE, value))) - return hr; + if (FAILED(hr = MFCalculateImageSize(subtype, width, height, &value))) + goto done; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_SAMPLE_SIZE, value))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_DEFAULT_STRIDE, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_DEFAULT_STRIDE, NULL))) { - if (FAILED(hr = MFGetStrideForBitmapInfoHeader(subtype.Data1, width, (LONG *)&value))) - return hr; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, value))) - return hr; + if (FAILED(hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, width, (LONG *)&value))) + goto done; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_DEFAULT_STRIDE, value))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_INTERLACE_MODE, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_INTERLACE_MODE, NULL))) { - if (!default_type || FAILED(hr = IMFMediaType_GetUINT32(default_type, &MF_MT_INTERLACE_MODE, &value))) + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_INTERLACE_MODE, &value))) value = MFVideoInterlace_MixedInterlaceOrProgressive; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_INTERLACE_MODE, value))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_INTERLACE_MODE, value))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, NULL))) { - if (!default_type || FAILED(hr = IMFMediaType_GetUINT32(default_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value))) + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value))) value = 1; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, value))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, value))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_VIDEO_ROTATION, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_VIDEO_ROTATION, NULL))) { - if (!default_type || FAILED(hr = IMFMediaType_GetUINT32(default_type, &MF_MT_VIDEO_ROTATION, &value))) + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_VIDEO_ROTATION, &value))) value = 0; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_VIDEO_ROTATION, value))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_VIDEO_ROTATION, value))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_FIXED_SIZE_SAMPLES, NULL))) + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_FIXED_SIZE_SAMPLES, NULL))) { - if (!default_type || FAILED(hr = IMFMediaType_GetUINT32(default_type, &MF_MT_FIXED_SIZE_SAMPLES, &value))) + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_FIXED_SIZE_SAMPLES, &value))) value = 1; - if (FAILED(hr = IMFMediaType_SetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, value))) - return hr; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_FIXED_SIZE_SAMPLES, value))) + goto done; } - if (FAILED(hr = IMFMediaType_GetItem(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, NULL)) - && SUCCEEDED(hr = IMFMediaType_GetBlob(decoder->stream_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, + if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, NULL)) + && SUCCEEDED(IMFMediaType_GetBlob(decoder->stream_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value))) { - if (FAILED(hr = IMFMediaType_SetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, + if (FAILED(hr = IMFVideoMediaType_SetBlob(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture)))) - return hr; + goto done; } - return S_OK; + IMFMediaType_AddRef((*media_type = (IMFMediaType *)video_type)); +done: + IMFVideoMediaType_Release(video_type); + return hr; } static HRESULT init_allocator(struct h264_decoder *decoder) @@ -410,37 +414,15 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR DWORD index, IMFMediaType **type) { struct h264_decoder *decoder = impl_from_IMFTransform(iface); - IMFMediaType *media_type; - const GUID *output_type; - HRESULT hr; TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); + *type = NULL; if (!decoder->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET; - - *type = NULL; - if (index >= ARRAY_SIZE(h264_decoder_output_types)) return MF_E_NO_MORE_TYPES; - output_type = h264_decoder_output_types[index]; - - if (FAILED(hr = MFCreateMediaType(&media_type))) - return hr; - - if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video))) - goto done; - if (FAILED(hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, output_type))) - goto done; - - hr = fill_output_media_type(decoder, media_type); - -done: - if (SUCCEEDED(hr)) - IMFMediaType_AddRef((*type = media_type)); - - IMFMediaType_Release(media_type); - return hr; + return create_output_media_type(decoder, h264_decoder_output_types[index], type); } static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) From e4cb607f6ae5289645f2e5dbaae8e355c4d64f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 11:57:46 +0100 Subject: [PATCH 1197/1506] winegstreamer: Remove unnecessary create_output_media_type checks. CW-Bug-Id: #21953 --- dlls/winegstreamer/h264_decoder.c | 118 ++++++++++++------------------ 1 file changed, 45 insertions(+), 73 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 8ec0671bbbe..db36af36a20 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -135,82 +135,54 @@ static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID if (FAILED(hr = MFCreateVideoMediaTypeFromSubtype(subtype, &video_type))) return hr; - if (FAILED(IMFVideoMediaType_GetUINT64(video_type, &MF_MT_FRAME_SIZE, &ratio))) - { - if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, &ratio))) - ratio = (UINT64)1920 << 32 | 1080; - if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, ratio))) - goto done; - } + if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, &ratio))) + ratio = (UINT64)1920 << 32 | 1080; + if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, ratio))) + goto done; width = ratio >> 32; height = ratio; - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_FRAME_RATE, NULL))) - { - if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_RATE, &ratio))) - ratio = (UINT64)30000 << 32 | 1001; - if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_RATE, ratio))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_PIXEL_ASPECT_RATIO, NULL))) - { - if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_PIXEL_ASPECT_RATIO, &ratio))) - ratio = (UINT64)1 << 32 | 1; - if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_PIXEL_ASPECT_RATIO, ratio))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_SAMPLE_SIZE, NULL))) - { - if (FAILED(hr = MFCalculateImageSize(subtype, width, height, &value))) - goto done; - if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_SAMPLE_SIZE, value))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_DEFAULT_STRIDE, NULL))) - { - if (FAILED(hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, width, (LONG *)&value))) - goto done; - if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_DEFAULT_STRIDE, value))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_INTERLACE_MODE, NULL))) - { - if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_INTERLACE_MODE, &value))) - value = MFVideoInterlace_MixedInterlaceOrProgressive; - if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_INTERLACE_MODE, value))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, NULL))) - { - if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value))) - value = 1; - if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, value))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_VIDEO_ROTATION, NULL))) - { - if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_VIDEO_ROTATION, &value))) - value = 0; - if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_VIDEO_ROTATION, value))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_FIXED_SIZE_SAMPLES, NULL))) - { - if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_FIXED_SIZE_SAMPLES, &value))) - value = 1; - if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_FIXED_SIZE_SAMPLES, value))) - goto done; - } - - if (FAILED(IMFVideoMediaType_GetItem(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, NULL)) - && SUCCEEDED(IMFMediaType_GetBlob(decoder->stream_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, + if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_RATE, &ratio))) + ratio = (UINT64)30000 << 32 | 1001; + if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_FRAME_RATE, ratio))) + goto done; + + if (FAILED(IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_PIXEL_ASPECT_RATIO, &ratio))) + ratio = (UINT64)1 << 32 | 1; + if (FAILED(hr = IMFVideoMediaType_SetUINT64(video_type, &MF_MT_PIXEL_ASPECT_RATIO, ratio))) + goto done; + + if (FAILED(hr = MFCalculateImageSize(subtype, width, height, &value))) + goto done; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_SAMPLE_SIZE, value))) + goto done; + + if (FAILED(hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, width, (LONG *)&value))) + goto done; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_DEFAULT_STRIDE, value))) + goto done; + + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_INTERLACE_MODE, &value))) + value = MFVideoInterlace_MixedInterlaceOrProgressive; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_INTERLACE_MODE, value))) + goto done; + + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value))) + value = 1; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, value))) + goto done; + + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_VIDEO_ROTATION, &value))) + value = 0; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_VIDEO_ROTATION, value))) + goto done; + + if (!default_type || FAILED(IMFMediaType_GetUINT32(default_type, &MF_MT_FIXED_SIZE_SAMPLES, &value))) + value = 1; + if (FAILED(hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_FIXED_SIZE_SAMPLES, value))) + goto done; + + if (SUCCEEDED(IMFMediaType_GetBlob(decoder->stream_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value))) { if (FAILED(hr = IMFVideoMediaType_SetBlob(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, From 717153865765f83da2dbd2ab9d950a4de8174886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 12:00:01 +0100 Subject: [PATCH 1198/1506] winegstreamer: Use GUID arrays for H264 decoder media types. CW-Bug-Id: #21953 --- dlls/winegstreamer/h264_decoder.c | 108 ++++++++++++++++++------------ 1 file changed, 67 insertions(+), 41 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index db36af36a20..a08dd320b57 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -33,14 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DECLARE_DEBUG_CHANNEL(winediag); -#define ALIGN_SIZE(size, alignment) (((size) + (alignment)) & ~((alignment))) - -static const GUID *const h264_decoder_input_types[] = -{ - &MFVideoFormat_H264, - &MFVideoFormat_H264_ES, -}; -static const GUID *const h264_decoder_output_types[] = +static const GUID *const video_decoder_output_types[] = { &MFVideoFormat_NV12, &MFVideoFormat_YV12, @@ -57,6 +50,11 @@ struct h264_decoder IMFAttributes *attributes; IMFAttributes *output_attributes; + UINT input_type_count; + const GUID *const *input_types; + UINT output_type_count; + const GUID *const *output_types; + UINT64 sample_time; IMFMediaType *input_type; MFT_INPUT_STREAM_INFO input_info; @@ -374,12 +372,14 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { + struct h264_decoder *decoder = impl_from_IMFTransform(iface); + TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); *type = NULL; - if (index >= ARRAY_SIZE(h264_decoder_input_types)) + if (index >= decoder->input_type_count) return MF_E_NO_MORE_TYPES; - return MFCreateVideoMediaTypeFromSubtype(h264_decoder_input_types[index], (IMFVideoMediaType **)type); + return MFCreateVideoMediaTypeFromSubtype(decoder->input_types[index], (IMFVideoMediaType **)type); } static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, @@ -392,9 +392,9 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR *type = NULL; if (!decoder->input_type) return MF_E_TRANSFORM_TYPE_NOT_SET; - if (index >= ARRAY_SIZE(h264_decoder_output_types)) + if (index >= decoder->output_type_count) return MF_E_NO_MORE_TYPES; - return create_output_media_type(decoder, h264_decoder_output_types[index], type); + return create_output_media_type(decoder, decoder->output_types[index], type); } static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) @@ -414,10 +414,10 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM if (!IsEqualGUID(&major, &MFMediaType_Video)) return MF_E_INVALIDMEDIATYPE; - for (i = 0; i < ARRAY_SIZE(h264_decoder_input_types); ++i) - if (IsEqualGUID(&subtype, h264_decoder_input_types[i])) + for (i = 0; i < decoder->input_type_count; ++i) + if (IsEqualGUID(&subtype, decoder->input_types[i])) break; - if (i == ARRAY_SIZE(h264_decoder_input_types)) + if (i == decoder->input_type_count) return MF_E_INVALIDMEDIATYPE; if (flags & MFT_SET_TYPE_TEST_ONLY) return S_OK; @@ -462,10 +462,10 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF if (!IsEqualGUID(&major, &MFMediaType_Video)) return MF_E_INVALIDMEDIATYPE; - for (i = 0; i < ARRAY_SIZE(h264_decoder_output_types); ++i) - if (IsEqualGUID(&subtype, h264_decoder_output_types[i])) + for (i = 0; i < decoder->output_type_count; ++i) + if (IsEqualGUID(&subtype, decoder->output_types[i])) break; - if (i == ARRAY_SIZE(h264_decoder_output_types)) + if (i == decoder->output_type_count) return MF_E_INVALIDMEDIATYPE; if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) @@ -777,39 +777,23 @@ static const IMFTransformVtbl transform_vtbl = transform_ProcessOutput, }; -HRESULT h264_decoder_create(REFIID riid, void **ret) +static HRESULT video_decoder_create_with_types(const GUID *const *input_types, UINT input_type_count, + const GUID *const *output_types, UINT output_type_count, IMFTransform **ret) { - static const struct wg_format output_format = - { - .major_type = WG_MAJOR_TYPE_VIDEO, - .u.video = - { - .format = WG_VIDEO_FORMAT_I420, - .width = 1920, - .height = 1080, - }, - }; - static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_VIDEO_H264}; - struct wg_transform_attrs attrs = {0}; - wg_transform_t transform; struct h264_decoder *decoder; HRESULT hr; - TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret); - - if (!(transform = wg_transform_create(&input_format, &output_format, &attrs))) - { - ERR_(winediag)("GStreamer doesn't support H.264 decoding, please install appropriate plugins\n"); - return E_FAIL; - } - wg_transform_destroy(transform); - if (!(decoder = calloc(1, sizeof(*decoder)))) return E_OUTOFMEMORY; decoder->IMFTransform_iface.lpVtbl = &transform_vtbl; decoder->refcount = 1; + decoder->input_type_count = input_type_count; + decoder->input_types = input_types; + decoder->output_type_count = output_type_count; + decoder->output_types = output_types; + decoder->input_info.dwFlags = MFT_INPUT_STREAM_WHOLE_SAMPLES | MFT_INPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_INPUT_STREAM_FIXED_SAMPLE_SIZE; decoder->input_info.cbSize = 0x1000; @@ -861,3 +845,45 @@ HRESULT h264_decoder_create(REFIID riid, void **ret) free(decoder); return hr; } + +static const GUID *const h264_decoder_input_types[] = +{ + &MFVideoFormat_H264, + &MFVideoFormat_H264_ES, +}; + +HRESULT h264_decoder_create(REFIID riid, void **out) +{ + static const struct wg_format output_format = + { + .major_type = WG_MAJOR_TYPE_VIDEO, + .u.video = + { + .format = WG_VIDEO_FORMAT_I420, + .width = 1920, + .height = 1080, + }, + }; + static const struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_VIDEO_H264}; + struct wg_transform_attrs attrs = {0}; + wg_transform_t transform; + IMFTransform *iface; + HRESULT hr; + + TRACE("riid %s, out %p.\n", debugstr_guid(riid), out); + + if (!(transform = wg_transform_create(&input_format, &output_format, &attrs))) + { + ERR_(winediag)("GStreamer doesn't support H.264 decoding, please install appropriate plugins\n"); + return E_FAIL; + } + wg_transform_destroy(transform); + + if (FAILED(hr = video_decoder_create_with_types(h264_decoder_input_types, ARRAY_SIZE(h264_decoder_input_types), + video_decoder_output_types, ARRAY_SIZE(video_decoder_output_types), &iface))) + return hr; + + hr = IMFTransform_QueryInterface(iface, riid, out); + IMFTransform_Release(iface); + return hr; +} From cd234ee21b8a42748498176cc53a490b32974074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 12:09:57 +0100 Subject: [PATCH 1199/1506] winegstreamer: Use MFCalculateImageSize to compute output info size. CW-Bug-Id: #21953 --- dlls/winegstreamer/h264_decoder.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index a08dd320b57..66396660a05 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -436,7 +436,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM { if (FAILED(hr = IMFMediaType_SetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, frame_size))) WARN("Failed to update stream type frame size, hr %#lx\n", hr); - decoder->output_info.cbSize = (frame_size >> 32) * (UINT32)frame_size * 2; + MFCalculateImageSize(decoder->output_types[0], frame_size >> 32, frame_size, (UINT32 *)&decoder->output_info.cbSize); } return S_OK; @@ -642,6 +642,7 @@ static HRESULT output_sample(struct h264_decoder *decoder, IMFSample **out, IMFS static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const struct wg_format *format) { UINT64 frame_size, frame_rate; + GUID subtype; HRESULT hr; if (decoder->stream_type) @@ -655,7 +656,9 @@ static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const str if (FAILED(hr = IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, &frame_size))) return hr; - decoder->output_info.cbSize = (frame_size >> 32) * (UINT32)frame_size * 2; + if (FAILED(hr = IMFMediaType_GetGUID(decoder->stream_type, &MF_MT_SUBTYPE, &subtype))) + return hr; + MFCalculateImageSize(&subtype, frame_size >> 32, frame_size, (UINT32 *)&decoder->output_info.cbSize); uninit_allocator(decoder); return MF_E_TRANSFORM_STREAM_CHANGE; From 01823cf0bc8ba449c6dd6ea5ec760bd8259b3cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 17 Nov 2023 00:08:42 +0100 Subject: [PATCH 1200/1506] ir50_32: Use the proper hr value for stream format change. CW-Bug-Id: #21953 --- dlls/ir50_32/ir50.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index 65c93f7fe5e..69700359e99 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -252,7 +252,7 @@ static LRESULT IV50_Decompress( IMFTransform *decoder, ICDECOMPRESS *icd, DWORD mft_buf.pSample = out_sample; hr = IMFTransform_ProcessOutput( decoder, 0, 1, &mft_buf, &mft_status ); - if ( SUCCEEDED(hr) && (mft_status & MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE) ) + if ( hr == MF_E_TRANSFORM_STREAM_CHANGE ) hr = IMFTransform_ProcessOutput( decoder, 0, 1, &mft_buf, &mft_status ); if ( SUCCEEDED(hr) ) From c3792c209e5b53094c25cb978b7ee3c0f8a9b92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 12:11:54 +0100 Subject: [PATCH 1201/1506] winegstreamer: Use the H264 decoder to implement the IV50 decoder. CW-Bug-Id: #21953 --- dlls/winegstreamer/Makefile.in | 1 - dlls/winegstreamer/h264_decoder.c | 35 +- dlls/winegstreamer/video_decoder.c | 502 ----------------------------- 3 files changed, 34 insertions(+), 504 deletions(-) delete mode 100644 dlls/winegstreamer/video_decoder.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 22238b3b765..942d6569f28 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -20,7 +20,6 @@ SOURCES = \ resampler.c \ rsrc.rc \ unixlib.c \ - video_decoder.c \ video_processor.c \ wg_allocator.c \ wg_format.c \ diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index 66396660a05..8953a61b73a 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -1,6 +1,7 @@ -/* H264 Decoder Transform +/* Generic Video Decoder Transform * * Copyright 2022 Rémi Bernon for CodeWeavers + * Copyright 2023 Shaun Ren for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -115,7 +116,10 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) } if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) + { + ERR("Failed to create transform with input major_type %u.\n", input_format.major_type); return E_FAIL; + } return S_OK; } @@ -890,3 +894,32 @@ HRESULT h264_decoder_create(REFIID riid, void **out) IMFTransform_Release(iface); return hr; } + +extern GUID MFVideoFormat_IV50; +static const GUID *const iv50_decoder_input_types[] = +{ + &MFVideoFormat_IV50, +}; +static const GUID *const iv50_decoder_output_types[] = +{ + &MFVideoFormat_YV12, + &MFVideoFormat_YUY2, + &MFVideoFormat_NV11, + &MFVideoFormat_NV12, + &MFVideoFormat_RGB32, + &MFVideoFormat_RGB24, + &MFVideoFormat_RGB565, + &MFVideoFormat_RGB555, + &MFVideoFormat_RGB8, +}; + +HRESULT WINAPI winegstreamer_create_video_decoder(IMFTransform **out) +{ + TRACE("out %p.\n", out); + + if (!init_gstreamer()) + return E_FAIL; + + return video_decoder_create_with_types(iv50_decoder_input_types, ARRAY_SIZE(iv50_decoder_input_types), + iv50_decoder_output_types, ARRAY_SIZE(iv50_decoder_output_types), out); +} diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c deleted file mode 100644 index f24c25e03f2..00000000000 --- a/dlls/winegstreamer/video_decoder.c +++ /dev/null @@ -1,502 +0,0 @@ -/* Generic Video Decoder Transform - * - * Copyright 2022 Rémi Bernon for CodeWeavers - * Copyright 2023 Shaun Ren for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "gst_private.h" - -#include "mfapi.h" -#include "mferror.h" -#include "mfobjects.h" -#include "mftransform.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(mfplat); - -DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50, MAKEFOURCC('I','V','5','0')); - -static const GUID *const input_types[] = -{ - &MFVideoFormat_IV50, -}; -static const GUID *const output_types[] = -{ - &MFVideoFormat_YV12, - &MFVideoFormat_YUY2, - &MFVideoFormat_NV11, - &MFVideoFormat_NV12, - &MFVideoFormat_RGB32, - &MFVideoFormat_RGB24, - &MFVideoFormat_RGB565, - &MFVideoFormat_RGB555, - &MFVideoFormat_RGB8, -}; - -struct video_decoder -{ - IMFTransform IMFTransform_iface; - LONG refcount; - - IMFMediaType *input_type; - IMFMediaType *output_type; - - struct wg_format wg_format; - wg_transform_t wg_transform; - struct wg_sample_queue *wg_sample_queue; -}; - -static struct video_decoder *impl_from_IMFTransform(IMFTransform *iface) -{ - return CONTAINING_RECORD(iface, struct video_decoder, IMFTransform_iface); -} - -static HRESULT try_create_wg_transform(struct video_decoder *decoder) -{ - struct wg_transform_attrs attrs = {0}; - struct wg_format input_format; - struct wg_format output_format; - - if (decoder->wg_transform) - wg_transform_destroy(decoder->wg_transform); - decoder->wg_transform = 0; - - mf_media_type_to_wg_format(decoder->input_type, &input_format); - if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN) - return MF_E_INVALIDMEDIATYPE; - - mf_media_type_to_wg_format(decoder->output_type, &output_format); - if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN) - return MF_E_INVALIDMEDIATYPE; - - if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) - { - ERR("Failed to create transform with input major_type %u.\n", input_format.major_type); - return E_FAIL; - } - - return S_OK; -} - -static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, void **out) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - - TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); - - if (IsEqualGUID(iid, &IID_IUnknown) || - IsEqualGUID(iid, &IID_IMFTransform)) - *out = &decoder->IMFTransform_iface; - else - { - *out = NULL; - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); - return E_NOINTERFACE; - } - - IUnknown_AddRef((IUnknown *)*out); - return S_OK; -} - -static ULONG WINAPI transform_AddRef(IMFTransform *iface) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - ULONG refcount = InterlockedIncrement(&decoder->refcount); - - TRACE("iface %p increasing refcount to %lu.\n", decoder, refcount); - - return refcount; -} - -static ULONG WINAPI transform_Release(IMFTransform *iface) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - ULONG refcount = InterlockedDecrement(&decoder->refcount); - - TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount); - - if (!refcount) - { - if (decoder->wg_transform) - wg_transform_destroy(decoder->wg_transform); - if (decoder->input_type) - IMFMediaType_Release(decoder->input_type); - if (decoder->output_type) - IMFMediaType_Release(decoder->output_type); - - wg_sample_queue_destroy(decoder->wg_sample_queue); - free(decoder); - } - - return refcount; -} - -static HRESULT WINAPI transform_GetStreamLimits(IMFTransform *iface, DWORD *input_minimum, - DWORD *input_maximum, DWORD *output_minimum, DWORD *output_maximum) -{ - FIXME("iface %p, input_minimum %p, input_maximum %p, output_minimum %p, output_maximum %p.\n", - iface, input_minimum, input_maximum, output_minimum, output_maximum); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetStreamCount(IMFTransform *iface, DWORD *inputs, DWORD *outputs) -{ - FIXME("iface %p, inputs %p, outputs %p.\n", iface, inputs, outputs); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetStreamIDs(IMFTransform *iface, DWORD input_size, DWORD *inputs, - DWORD output_size, DWORD *outputs) -{ - FIXME("iface %p, input_size %lu, inputs %p, output_size %lu, outputs %p.\n", - iface, input_size, inputs, output_size, outputs); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id, MFT_INPUT_STREAM_INFO *info) -{ - FIXME("iface %p, id %#lx, info %p.\n", iface, id, info); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) -{ - FIXME("iface %p, id %#lx, info %p.\n", iface, id, info); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) -{ - FIXME("iface %p, attributes %p semi-stub!\n", iface, attributes); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetInputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) -{ - FIXME("iface %p, id %#lx, attributes %p.\n", iface, id, attributes); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) -{ - FIXME("iface %p, id %#lx, attributes %p stub!\n", iface, id, attributes); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_DeleteInputStream(IMFTransform *iface, DWORD id) -{ - FIXME("iface %p, id %#lx.\n", iface, id); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD streams, DWORD *ids) -{ - FIXME("iface %p, streams %lu, ids %p.\n", iface, streams, ids); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, - IMFMediaType **type) -{ - FIXME("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, - DWORD index, IMFMediaType **type) -{ - FIXME("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - GUID major, subtype; - UINT64 frame_size; - HRESULT hr; - ULONG i; - - TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags); - - if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) || - FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) - return E_INVALIDARG; - - if (!IsEqualGUID(&major, &MFMediaType_Video)) - return MF_E_INVALIDMEDIATYPE; - - for (i = 0; i < ARRAY_SIZE(input_types); ++i) - if (IsEqualGUID(&subtype, input_types[i])) - break; - if (i == ARRAY_SIZE(input_types)) - return MF_E_INVALIDMEDIATYPE; - - if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size)) || - (frame_size >> 32) == 0 || (UINT32)frame_size == 0) - return MF_E_INVALIDMEDIATYPE; - - if (flags & MFT_SET_TYPE_TEST_ONLY) - return S_OK; - - if (decoder->output_type) - { - IMFMediaType_Release(decoder->output_type); - decoder->output_type = NULL; - } - - if (decoder->input_type) - IMFMediaType_Release(decoder->input_type); - IMFMediaType_AddRef((decoder->input_type = type)); - - return S_OK; -} - -static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - GUID major, subtype; - UINT64 frame_size; - struct wg_format output_format; - HRESULT hr; - ULONG i; - - TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags); - - if (!decoder->input_type) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) || - FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) - return hr; - - if (!IsEqualGUID(&major, &MFMediaType_Video)) - return MF_E_INVALIDMEDIATYPE; - - for (i = 0; i < ARRAY_SIZE(output_types); ++i) - if (IsEqualGUID(&subtype, output_types[i])) - break; - if (i == ARRAY_SIZE(output_types)) - return MF_E_INVALIDMEDIATYPE; - - if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) - return hr; - - if (flags & MFT_SET_TYPE_TEST_ONLY) - return S_OK; - - if (decoder->output_type) - IMFMediaType_Release(decoder->output_type); - IMFMediaType_AddRef((decoder->output_type = type)); - - if (decoder->wg_transform) - { - mf_media_type_to_wg_format(decoder->output_type, &output_format); - - if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN - || !wg_transform_set_output_format(decoder->wg_transform, &output_format)) - { - IMFMediaType_Release(decoder->output_type); - decoder->output_type = NULL; - return MF_E_INVALIDMEDIATYPE; - } - } - else if (FAILED(hr = try_create_wg_transform(decoder))) - { - IMFMediaType_Release(decoder->output_type); - decoder->output_type = NULL; - return hr; - } - - decoder->wg_format.u.video.width = frame_size >> 32; - decoder->wg_format.u.video.height = (UINT32)frame_size; - - return hr; -} - -static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) -{ - FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) -{ - FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) -{ - FIXME("iface %p, id %#lx, flags %p stub!\n", iface, id, flags); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetOutputStatus(IMFTransform *iface, DWORD *flags) -{ - FIXME("iface %p, flags %p stub!\n", iface, flags); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) -{ - TRACE("iface %p, lower %I64d, upper %I64d.\n", iface, lower, upper); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFMediaEvent *event) -{ - FIXME("iface %p, id %#lx, event %p stub!\n", iface, id, event); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) -{ - FIXME("iface %p, message %#x, param %Ix stub!\n", iface, message, param); - return S_OK; -} - -static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - HRESULT hr; - - TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags); - - if (!decoder->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - hr = wg_transform_push_mf(decoder->wg_transform, sample, decoder->wg_sample_queue); - - return hr; -} - -static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, - MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - struct wg_format wg_format; - UINT32 sample_size; - UINT64 frame_rate; - GUID subtype; - HRESULT hr; - - TRACE("iface %p, flags %#lx, count %lu, samples %p, status %p.\n", iface, flags, count, samples, status); - - if (count != 1) - return E_INVALIDARG; - - if (!decoder->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - *status = samples->dwStatus = 0; - if (!samples->pSample) - return E_INVALIDARG; - - if (FAILED(hr = IMFMediaType_GetGUID(decoder->output_type, &MF_MT_SUBTYPE, &subtype))) - return hr; - if (FAILED(hr = MFCalculateImageSize(&subtype, decoder->wg_format.u.video.width, - decoder->wg_format.u.video.height, &sample_size))) - return hr; - - if (SUCCEEDED(hr = wg_transform_read_mf(decoder->wg_transform, samples->pSample, - sample_size, &wg_format, &samples->dwStatus))) - wg_sample_queue_flush(decoder->wg_sample_queue, false); - - if (hr == MF_E_TRANSFORM_STREAM_CHANGE) - { - decoder->wg_format = wg_format; - - if (FAILED(hr = MFCalculateImageSize(&subtype, decoder->wg_format.u.video.width, - decoder->wg_format.u.video.height, &sample_size))) - return hr; - - /* keep the frame rate that was requested, GStreamer doesn't provide any */ - if (SUCCEEDED(IMFMediaType_GetUINT64(decoder->output_type, &MF_MT_FRAME_RATE, &frame_rate))) - { - decoder->wg_format.u.video.fps_n = frame_rate >> 32; - decoder->wg_format.u.video.fps_d = (UINT32)frame_rate; - } - - samples[0].dwStatus |= MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE; - *status |= MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE; - } - - return hr; -} - -static const IMFTransformVtbl transform_vtbl = -{ - transform_QueryInterface, - transform_AddRef, - transform_Release, - transform_GetStreamLimits, - transform_GetStreamCount, - transform_GetStreamIDs, - transform_GetInputStreamInfo, - transform_GetOutputStreamInfo, - transform_GetAttributes, - transform_GetInputStreamAttributes, - transform_GetOutputStreamAttributes, - transform_DeleteInputStream, - transform_AddInputStreams, - transform_GetInputAvailableType, - transform_GetOutputAvailableType, - transform_SetInputType, - transform_SetOutputType, - transform_GetInputCurrentType, - transform_GetOutputCurrentType, - transform_GetInputStatus, - transform_GetOutputStatus, - transform_SetOutputBounds, - transform_ProcessEvent, - transform_ProcessMessage, - transform_ProcessInput, - transform_ProcessOutput, -}; - -HRESULT WINAPI winegstreamer_create_video_decoder(IMFTransform **out) -{ - struct video_decoder *decoder; - HRESULT hr; - - TRACE("out %p.\n", out); - - if (!init_gstreamer()) - return E_FAIL; - - if (!(decoder = calloc(1, sizeof(*decoder)))) - return E_OUTOFMEMORY; - - decoder->IMFTransform_iface.lpVtbl = &transform_vtbl; - decoder->refcount = 1; - - decoder->wg_format.u.video.fps_d = 1; - decoder->wg_format.u.video.fps_n = 1; - - if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue))) - goto failed; - - *out = &decoder->IMFTransform_iface; - TRACE("created decoder %p.\n", *out); - return S_OK; - -failed: - free(decoder); - return hr; -} From caf1db51967aeb3d131ce790276d5e3398839de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 12:14:03 +0100 Subject: [PATCH 1202/1506] winegstreamer: Rename struct h264_decoder to struct video_decoder. CW-Bug-Id: #21953 --- dlls/winegstreamer/Makefile.in | 2 +- .../{h264_decoder.c => video_decoder.c} | 54 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) rename dlls/winegstreamer/{h264_decoder.c => video_decoder.c} (94%) diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 942d6569f28..3f143e355c5 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -9,7 +9,6 @@ UNIX_LIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS) SOURCES = \ audio_decoder.c \ color_convert.c \ - h264_decoder.c \ main.c \ media_sink.c \ media_source.c \ @@ -20,6 +19,7 @@ SOURCES = \ resampler.c \ rsrc.rc \ unixlib.c \ + video_decoder.c \ video_processor.c \ wg_allocator.c \ wg_format.c \ diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/video_decoder.c similarity index 94% rename from dlls/winegstreamer/h264_decoder.c rename to dlls/winegstreamer/video_decoder.c index 8953a61b73a..3f72a3df944 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -43,7 +43,7 @@ static const GUID *const video_decoder_output_types[] = &MFVideoFormat_YUY2, }; -struct h264_decoder +struct video_decoder { IMFTransform IMFTransform_iface; LONG refcount; @@ -72,12 +72,12 @@ struct h264_decoder IMFMediaBuffer *temp_buffer; }; -static struct h264_decoder *impl_from_IMFTransform(IMFTransform *iface) +static struct video_decoder *impl_from_IMFTransform(IMFTransform *iface) { - return CONTAINING_RECORD(iface, struct h264_decoder, IMFTransform_iface); + return CONTAINING_RECORD(iface, struct video_decoder, IMFTransform_iface); } -static HRESULT try_create_wg_transform(struct h264_decoder *decoder) +static HRESULT try_create_wg_transform(struct video_decoder *decoder) { /* Call of Duty: Black Ops 3 doesn't care about the ProcessInput/ProcessOutput * return values, it calls them in a specific order and expects the decoder @@ -124,7 +124,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) return S_OK; } -static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID *subtype, +static HRESULT create_output_media_type(struct video_decoder *decoder, const GUID *subtype, IMFMediaType **media_type) { IMFMediaType *default_type = decoder->output_type; @@ -198,7 +198,7 @@ static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID return hr; } -static HRESULT init_allocator(struct h264_decoder *decoder) +static HRESULT init_allocator(struct video_decoder *decoder) { HRESULT hr; @@ -217,7 +217,7 @@ static HRESULT init_allocator(struct h264_decoder *decoder) return S_OK; } -static void uninit_allocator(struct h264_decoder *decoder) +static void uninit_allocator(struct video_decoder *decoder) { IMFVideoSampleAllocatorEx_UninitializeSampleAllocator(decoder->allocator); decoder->allocator_initialized = FALSE; @@ -225,7 +225,7 @@ static void uninit_allocator(struct h264_decoder *decoder) static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, void **out) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); @@ -245,7 +245,7 @@ static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, static ULONG WINAPI transform_AddRef(IMFTransform *iface) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); ULONG refcount = InterlockedIncrement(&decoder->refcount); TRACE("iface %p increasing refcount to %lu.\n", decoder, refcount); @@ -255,7 +255,7 @@ static ULONG WINAPI transform_AddRef(IMFTransform *iface) static ULONG WINAPI transform_Release(IMFTransform *iface) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); ULONG refcount = InterlockedDecrement(&decoder->refcount); TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount); @@ -309,7 +309,7 @@ static HRESULT WINAPI transform_GetStreamIDs(IMFTransform *iface, DWORD input_si static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id, MFT_INPUT_STREAM_INFO *info) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, info %p.\n", iface, id, info); @@ -319,7 +319,7 @@ static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, info %p.\n", iface, id, info); @@ -329,7 +329,7 @@ static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD i static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); FIXME("iface %p, attributes %p semi-stub!\n", iface, attributes); @@ -348,7 +348,7 @@ static HRESULT WINAPI transform_GetInputStreamAttributes(IMFTransform *iface, DW static HRESULT WINAPI transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); FIXME("iface %p, id %#lx, attributes %p semi-stub!\n", iface, id, attributes); @@ -376,7 +376,7 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); @@ -389,7 +389,7 @@ static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); @@ -403,7 +403,7 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); GUID major, subtype; UINT64 frame_size; HRESULT hr; @@ -448,7 +448,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); UINT64 frame_size, stream_frame_size; GUID major, subtype; HRESULT hr; @@ -508,7 +508,7 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); HRESULT hr; TRACE("iface %p, id %#lx, type %p\n", iface, id, type); @@ -524,7 +524,7 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); HRESULT hr; TRACE("iface %p, id %#lx, type %p\n", iface, id, type); @@ -540,7 +540,7 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, flags %p.\n", iface, id, flags); @@ -571,7 +571,7 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); HRESULT hr; TRACE("iface %p, message %#x, param %Ix.\n", iface, message, param); @@ -603,7 +603,7 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_ static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags); @@ -613,7 +613,7 @@ static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFS return wg_transform_push_mf(decoder->wg_transform, sample, decoder->wg_sample_queue); } -static HRESULT output_sample(struct h264_decoder *decoder, IMFSample **out, IMFSample *src_sample) +static HRESULT output_sample(struct video_decoder *decoder, IMFSample **out, IMFSample *src_sample) { MFT_OUTPUT_DATA_BUFFER output[1]; IMFSample *sample; @@ -643,7 +643,7 @@ static HRESULT output_sample(struct h264_decoder *decoder, IMFSample **out, IMFS return S_OK; } -static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const struct wg_format *format) +static HRESULT handle_stream_type_change(struct video_decoder *decoder, const struct wg_format *format) { UINT64 frame_size, frame_rate; GUID subtype; @@ -671,7 +671,7 @@ static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const str static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); struct wg_format wg_format; UINT32 sample_size; LONGLONG duration; @@ -787,7 +787,7 @@ static const IMFTransformVtbl transform_vtbl = static HRESULT video_decoder_create_with_types(const GUID *const *input_types, UINT input_type_count, const GUID *const *output_types, UINT output_type_count, IMFTransform **ret) { - struct h264_decoder *decoder; + struct video_decoder *decoder; HRESULT hr; if (!(decoder = calloc(1, sizeof(*decoder)))) From 0dfbb87378b70526b3bcf876e1f567db7b4dd591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 13:51:11 +0100 Subject: [PATCH 1203/1506] winegstreamer: Ignore input / output fps mismatch in video_processor. CW-Bug-Id: #21953 --- dlls/winegstreamer/video_processor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/winegstreamer/video_processor.c b/dlls/winegstreamer/video_processor.c index 3075bf997d2..1cbb37dafc7 100644 --- a/dlls/winegstreamer/video_processor.c +++ b/dlls/winegstreamer/video_processor.c @@ -102,6 +102,13 @@ static HRESULT try_create_wg_transform(struct video_processor *impl) if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN) return MF_E_INVALIDMEDIATYPE; + /* prevent fps differences from failing to connect the elements */ + if (output_format.u.video.fps_d || output_format.u.video.fps_n) + { + input_format.u.video.fps_d = output_format.u.video.fps_d; + input_format.u.video.fps_n = output_format.u.video.fps_n; + } + if (!(impl->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) return E_FAIL; From 9a96d36988e87b2507ad31e6794f1f5ddac639f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 12:14:49 +0100 Subject: [PATCH 1204/1506] winegstreamer: Expose the generic video decoder transform. CW-Bug-Id: #21953 --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/mfplat.c | 30 ++++++++++++++++++++ dlls/winegstreamer/video_decoder.c | 21 ++++++++++++++ dlls/winegstreamer/winegstreamer_classes.idl | 6 ++++ 4 files changed, 58 insertions(+) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index c894fd0b1ae..bce9b5d2fe4 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -189,6 +189,7 @@ unsigned int wg_format_get_stride(const struct wg_format *format); bool wg_video_format_is_rgb(enum wg_video_format format); HRESULT audio_decoder_create(REFIID riid, void **ret); +HRESULT video_decoder_create(REFIID riid, void **ret); HRESULT aac_decoder_create(REFIID riid, void **ret); HRESULT h264_decoder_create(REFIID riid, void **ret); HRESULT video_processor_create(REFIID riid, void **ret); diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index ea72539d1b6..1e5b7a38f66 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -129,6 +129,7 @@ static const IClassFactoryVtbl class_factory_vtbl = static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_GStreamerByteStreamHandler2 = {0x317df619, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_GStreamerAudioDecoder = {0x480b1517, 0xc8e9, 0x4eae, {0xb0, 0x06, 0xe6, 0x30, 0x07, 0x18, 0xd8, 0x5d}}; +static const GUID CLSID_GStreamerVideoDecoder = {0x480b1518, 0xc8e9, 0x4eae, {0xb0, 0x06, 0xe6, 0x30, 0x07, 0x18, 0xd8, 0x5d}}; static const GUID CLSID_GStreamerSchemePlugin = {0x587eeb6a,0x7336,0x4ebd,{0xa4,0xf2,0x91,0xc9,0x48,0xde,0x62,0x2c}}; @@ -140,6 +141,7 @@ static const struct class_object class_objects[] = { { &CLSID_GStreamerAudioDecoder, &audio_decoder_create }, + { &CLSID_GStreamerVideoDecoder, &video_decoder_create }, { &CLSID_VideoProcessorMFT, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_GStreamerByteStreamHandler2, &gstreamer_byte_stream_handler_2_create }, @@ -351,6 +353,24 @@ HRESULT mfplat_DllRegisterServer(void) {MFMediaType_Audio, MFAudioFormat_PCM}, }; + MFT_REGISTER_TYPE_INFO video_decoder_input_types[] = + { + {MFMediaType_Video, MFVideoFormat_GStreamer}, + {MFMediaType_Video, MFVideoFormat_IV50}, + }; + MFT_REGISTER_TYPE_INFO video_decoder_output_types[] = + { + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_NV11}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, MFVideoFormat_RGB32}, + {MFMediaType_Video, MFVideoFormat_RGB24}, + {MFMediaType_Video, MFVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_RGB555}, + {MFMediaType_Video, MFVideoFormat_RGB8}, + }; + struct mft { GUID clsid; @@ -444,6 +464,16 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(audio_decoder_output_types), audio_decoder_output_types, }, + { + CLSID_GStreamerVideoDecoder, + MFT_CATEGORY_VIDEO_DECODER, + L"Wine Video Decoder MFT", + MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(video_decoder_input_types), + video_decoder_input_types, + ARRAY_SIZE(video_decoder_output_types), + video_decoder_output_types, + }, }; unsigned int i; diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 3f72a3df944..f75fb51ca84 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -34,6 +34,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DECLARE_DEBUG_CHANNEL(winediag); +extern GUID MFVideoFormat_GStreamer; +static const GUID *const video_decoder_input_types[] = +{ + &MFVideoFormat_GStreamer, +}; static const GUID *const video_decoder_output_types[] = { &MFVideoFormat_NV12, @@ -853,6 +858,22 @@ static HRESULT video_decoder_create_with_types(const GUID *const *input_types, U return hr; } +HRESULT video_decoder_create(REFIID riid, void **out) +{ + IMFTransform *iface; + HRESULT hr; + + TRACE("riid %s, out %p.\n", debugstr_guid(riid), out); + + if (FAILED(hr = video_decoder_create_with_types(video_decoder_input_types, ARRAY_SIZE(video_decoder_input_types), + video_decoder_output_types, ARRAY_SIZE(video_decoder_output_types), &iface))) + return hr; + + hr = IMFTransform_QueryInterface(iface, riid, out); + IMFTransform_Release(iface); + return hr; +} + static const GUID *const h264_decoder_input_types[] = { &MFVideoFormat_H264, diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 2ef6d994274..dc56ad2b0ab 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -95,6 +95,12 @@ coclass GStreamerByteStreamHandler2 {} ] coclass GStreamerAudioDecoder {} +[ + threading(both), + uuid(480b1518-c8e9-4eae-b006-e6300718d85d) +] +coclass GStreamerVideoDecoder {} + [ threading(both), uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) From d89e62d774d6a8d6f88a0a587ad614cfd6a09911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jan 2024 11:21:21 +0100 Subject: [PATCH 1205/1506] HACK: mfplat: Enable the new media source for some games. CW-Bug-Id: #21953 --- dlls/mfplat/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index e545fd5b999..facb39ee3d6 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -6298,7 +6298,13 @@ static HRESULT resolver_create_gstreamer_handler(IMFByteStreamHandler **handler) static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_GStreamerByteStreamHandler2 = {0x317df619, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; - const char *env = getenv("WINE_NEW_MEDIA_SOURCE"); + const char *env = getenv("WINE_NEW_MEDIA_SOURCE"), *sgi = getenv("SteamGameId"); + if (!env && sgi) + { + if (!strcmp(sgi, "399810") /* Call of Cthulhu */) env = "1"; + if (!strcmp(sgi, "606880") /* Greedfall */) env = "1"; + if (!strcmp(sgi, "692850") /* Bloodstained */) env = "1"; + } if (env && atoi(env)) return CoCreateInstance(&CLSID_GStreamerByteStreamHandler2, NULL, CLSCTX_INPROC_SERVER, &IID_IMFByteStreamHandler, (void **)handler); return CoCreateInstance(&CLSID_GStreamerByteStreamHandler, NULL, CLSCTX_INPROC_SERVER, &IID_IMFByteStreamHandler, (void **)handler); From 6c1326b0e6f4df6ce0c21073c4bf057428760116 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 29 Nov 2023 17:02:43 -0600 Subject: [PATCH 1206/1506] ntdll: HACK: Try to load steamoverlay.so manually if LD_PRELOAD was lost. CW-Bug-Id: #23064 --- dlls/ntdll/unix/loader.c | 5 +++++ dlls/ntdll/unix/virtual.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 9dec5d15d80..b7d1f677203 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -598,6 +598,8 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_i if (pe_info->wine_fakedll) res_start = res_end = 0; if (pe_info->image_flags & IMAGE_FLAGS_ComPlusNativeReady) machine = native_machine; + unsetenv( "WINE_LD_PRELOAD" ); + /* HACK: Unset LD_PRELOAD before executing explorer.exe to disable buggy gameoverlayrenderer.so */ if (ld_preload && argv[2] && !strcmp( argv[2], "C:\\windows\\system32\\explorer.exe" ) && argv[3] && !strcmp( argv[3], "/desktop" )) @@ -626,8 +628,11 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_i while (*next); putenv( env ); + ld_preload = NULL; } + if (ld_preload) setenv( "WINE_LD_PRELOAD", ld_preload, 1 ); + signal( SIGPIPE, SIG_DFL ); snprintf( socket_env, sizeof(socket_env), "WINESERVERSOCKET=%u", socketfd ); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 42f572e8479..b3535c8a8df 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -649,6 +649,30 @@ void *get_builtin_so_handle( void *module ) return ret; } +static void load_steam_overlay(const char *unix_lib_path) +{ + const char *preload, *p; + char path[PATH_MAX]; + unsigned int len; + void *handle; + + if (!strstr(unix_lib_path, "winex11.so")) return; + if (getenv("LD_PRELOAD") || !(preload = getenv("WINE_LD_PRELOAD"))) return; + + p = preload; + while (*(preload = p)) + { + p = strchrnul( preload, ':' ); + len = p - preload; + if (*p) ++p; + if (len + 1 > sizeof(path)) continue; + memcpy( path, preload, len ); + path[len] = 0; + if (!strstr( path, "gameoverlayrenderer.so" )) continue; + handle = dlopen( path, RTLD_NOW | RTLD_GLOBAL ); + FIXME( "HACK: tried to load %s, handle %p.\n", debugstr_a(path), handle ); + } +} /*********************************************************************** * get_builtin_unix_funcs @@ -665,7 +689,10 @@ static NTSTATUS get_builtin_unix_funcs( void *module, BOOL wow, const void **fun { if (builtin->module != module) continue; if (builtin->unix_path && !builtin->unix_handle) + { + load_steam_overlay(builtin->unix_path); builtin->unix_handle = dlopen( builtin->unix_path, RTLD_NOW ); + } if (builtin->unix_handle) { *funcs = dlsym( builtin->unix_handle, ptr_name ); @@ -693,7 +720,11 @@ NTSTATUS load_builtin_unixlib( void *module, const char *name ) if (builtin->module != module) continue; if (!builtin->unix_path) builtin->unix_path = strdup( name ); else status = STATUS_IMAGE_ALREADY_LOADED; - if (!builtin->unix_handle) builtin->unix_handle = dlopen( builtin->unix_path, RTLD_NOW ); + if (!builtin->unix_handle) + { + load_steam_overlay(builtin->unix_path); + builtin->unix_handle = dlopen( builtin->unix_path, RTLD_NOW ); + } break; } server_leave_uninterrupted_section( &virtual_mutex, &sigset ); From 044acf45072716646e435865e88e1e1369859aba Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 23 Nov 2023 10:25:57 +0200 Subject: [PATCH 1207/1506] winegstreamer: Support WMA with 5.1 and 7.1 audio. --- dlls/winegstreamer/mfplat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 1e5b7a38f66..a4cf2dfcd99 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -749,6 +749,10 @@ static void mf_media_type_to_wg_format_audio(IMFMediaType *type, const GUID *sub channel_mask = KSAUDIO_SPEAKER_MONO; else if (channels == 2) channel_mask = KSAUDIO_SPEAKER_STEREO; + else if (channels == 6) + channel_mask = KSAUDIO_SPEAKER_5POINT1; + else if (channels == 8) + channel_mask = KSAUDIO_SPEAKER_7POINT1; else { FIXME("Channel mask is not set.\n"); From 92181d905f9435eab90a03c5b2a118642b5531ad Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Fri, 29 Dec 2023 13:23:25 +0200 Subject: [PATCH 1208/1506] FAudio: Create fake codec data for WMA3. Already upstreamed, can be dropped the next bump. Link: https://github.com/FNA-XNA/FAudio/pull/327 --- libs/faudio/src/FAudio_platform_win32.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/faudio/src/FAudio_platform_win32.c b/libs/faudio/src/FAudio_platform_win32.c index c45b4a2f4f2..01a3a84d5e0 100644 --- a/libs/faudio/src/FAudio_platform_win32.c +++ b/libs/faudio/src/FAudio_platform_win32.c @@ -1300,6 +1300,7 @@ static void FAudio_INTERNAL_DecodeWMAMF( uint32_t FAudio_WMADEC_init(FAudioSourceVoice *voice, uint32_t type) { static const uint8_t fake_codec_data[16] = {0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + uint8_t fake_codec_data_wma3[18] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 0, 0, 0}; const FAudioWaveFormatExtensible *wfx = (FAudioWaveFormatExtensible *)voice->src.format; struct FAudioWMADEC *impl; MFT_OUTPUT_STREAM_INFO info = {0}; @@ -1361,11 +1362,17 @@ uint32_t FAudio_WMADEC_init(FAudioSourceVoice *voice, uint32_t type) FAudio_assert(!FAILED(hr) && "Failed set input block align!"); break; case FAUDIO_FORMAT_WMAUDIO3: + *(uint16_t *)fake_codec_data_wma3 = voice->src.format->wBitsPerSample; + for (i = 0; i < voice->src.format->nChannels; i++) + { + fake_codec_data_wma3[2] <<= 1; + fake_codec_data_wma3[2] |= 1; + } hr = IMFMediaType_SetBlob( media_type, &MF_MT_USER_DATA, - (void *)&wfx->Samples, - wfx->Format.cbSize + (void *)fake_codec_data_wma3, + sizeof(fake_codec_data_wma3) ); FAudio_assert(!FAILED(hr) && "Failed set codec private data!"); hr = IMFMediaType_SetGUID( From 4d110a8917e9e811d00cfb7c1137da6613871167 Mon Sep 17 00:00:00 2001 From: Etaash Mathamsetty Date: Sun, 10 Dec 2023 15:29:32 -0500 Subject: [PATCH 1209/1506] xinput: Implement XInputGetCapabilitiesEx. CW-Bug-Id: #23185 --- dlls/xinput1_3/main.c | 30 ++++++++++++++++++++++++++++++ dlls/xinput1_4/xinput1_4.spec | 1 + include/xinput.h | 11 +++++++++++ 3 files changed, 42 insertions(+) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index a18f63545cc..3e6a8d0288c 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -1159,3 +1159,33 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetBatteryInformation(DWORD index, BYTE typ return ERROR_NOT_SUPPORTED; } + +DWORD WINAPI DECLSPEC_HOTPATCH XInputGetCapabilitiesEx(DWORD unk, DWORD index, DWORD flags, XINPUT_CAPABILITIES_EX *caps) +{ + DWORD ret = ERROR_SUCCESS; + HIDD_ATTRIBUTES attr; + + TRACE("unk %lu, index %lu, flags %#lx, capabilities %p.\n", unk, index, flags, caps); + + start_update_thread(); + + if (index >= XUSER_MAX_COUNT) return ERROR_BAD_ARGUMENTS; + + if (!controller_lock(&controllers[index])) return ERROR_DEVICE_NOT_CONNECTED; + + if (flags & XINPUT_FLAG_GAMEPAD && controllers[index].caps.SubType != XINPUT_DEVSUBTYPE_GAMEPAD) + ret = ERROR_DEVICE_NOT_CONNECTED; + else if (!HidD_GetAttributes(controllers[index].device, &attr)) + ret = ERROR_DEVICE_NOT_CONNECTED; + else + { + caps->Capabilities = controllers[index].caps; + caps->VendorId = attr.VendorID; + caps->ProductId = attr.ProductID; + caps->VersionNumber = attr.VersionNumber; + } + + controller_unlock(&controllers[index]); + + return ret; +} diff --git a/dlls/xinput1_4/xinput1_4.spec b/dlls/xinput1_4/xinput1_4.spec index 8c3f4c0cd73..22c511237dd 100644 --- a/dlls/xinput1_4/xinput1_4.spec +++ b/dlls/xinput1_4/xinput1_4.spec @@ -7,3 +7,4 @@ 8 stdcall XInputGetKeystroke(long long ptr) 10 stub XInputGetAudioDeviceIds(long ptr ptr ptr ptr) 100 stdcall XInputGetStateEx(long ptr) +108 stdcall XInputGetCapabilitiesEx(long long long ptr) diff --git a/include/xinput.h b/include/xinput.h index f7c291630cb..96efae1858d 100644 --- a/include/xinput.h +++ b/include/xinput.h @@ -210,6 +210,16 @@ typedef struct _XINPUT_CAPABILITIES { XINPUT_VIBRATION Vibration; } XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES; +typedef struct _XINPUT_CAPABILITIES_EX +{ + XINPUT_CAPABILITIES Capabilities; + WORD VendorId; + WORD ProductId; + WORD VersionNumber; + WORD unk1; + DWORD unk2; +} XINPUT_CAPABILITIES_EX, *PXINPUT_CAPABILITIES_EX; + /* * Defines the structure for a joystick input event which is * retrieved using the function XInputGetKeystroke @@ -237,6 +247,7 @@ DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*); DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*); DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE); DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*); +DWORD WINAPI XInputGetCapabilitiesEx(DWORD, DWORD, DWORD, XINPUT_CAPABILITIES_EX*); DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*); DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*); From c7b6134c90e3cd0cce311605c5608c311feea2b3 Mon Sep 17 00:00:00 2001 From: Etaash Mathamsetty Date: Sun, 10 Dec 2023 15:36:26 -0500 Subject: [PATCH 1210/1506] xinput: Reimplement XInputGetCapabilities. CW-Bug-Id: #23185 --- dlls/xinput1_3/main.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index 3e6a8d0288c..4cb9793fa30 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -1116,25 +1116,15 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetKeystroke(DWORD index, DWORD reserved, P DWORD WINAPI DECLSPEC_HOTPATCH XInputGetCapabilities(DWORD index, DWORD flags, XINPUT_CAPABILITIES *capabilities) { - TRACE("index %lu, flags %#lx, capabilities %p.\n", index, flags, capabilities); - - start_update_thread(); - - if (index >= XUSER_MAX_COUNT) return ERROR_BAD_ARGUMENTS; - - if (!controller_lock(&controllers[index])) return ERROR_DEVICE_NOT_CONNECTED; - - if (flags & XINPUT_FLAG_GAMEPAD && controllers[index].caps.SubType != XINPUT_DEVSUBTYPE_GAMEPAD) - { - controller_unlock(&controllers[index]); - return ERROR_DEVICE_NOT_CONNECTED; - } + XINPUT_CAPABILITIES_EX caps_ex; + DWORD ret; - memcpy(capabilities, &controllers[index].caps, sizeof(*capabilities)); + TRACE("index %lu, flags %#lx, capabilities %p.\n", index, flags, capabilities); - controller_unlock(&controllers[index]); + ret = XInputGetCapabilitiesEx(0, index, flags, &caps_ex); + if (!ret) *capabilities = caps_ex.Capabilities; - return ERROR_SUCCESS; + return ret; } DWORD WINAPI DECLSPEC_HOTPATCH XInputGetDSoundAudioDeviceGuids(DWORD index, GUID *render_guid, GUID *capture_guid) From 5a7981f0d94764d65befb2acb54e4c5df8bfac49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 21 Feb 2022 15:18:15 +0100 Subject: [PATCH 1211/1506] windows.gaming.input: Stub IRawGameController2 interface. CW-Bug-Id: #23185 --- dlls/windows.gaming.input/controller.c | 60 ++++++++++++++++++++++++++ include/windows.devices.haptics.idl | 3 ++ 2 files changed, 63 insertions(+) diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c index bd3d441c445..e1749a3032d 100644 --- a/dlls/windows.gaming.input/controller.c +++ b/dlls/windows.gaming.input/controller.c @@ -61,6 +61,7 @@ struct controller IGameControllerImpl IGameControllerImpl_iface; IGameControllerInputSink IGameControllerInputSink_iface; IRawGameController IRawGameController_iface; + IRawGameController2 IRawGameController2_iface; IGameController *IGameController_outer; LONG ref; @@ -99,6 +100,12 @@ static HRESULT WINAPI controller_QueryInterface( IGameControllerImpl *iface, REF return S_OK; } + if (IsEqualGUID( iid, &IID_IRawGameController2 )) + { + IInspectable_AddRef( (*out = &impl->IRawGameController2_iface) ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -330,6 +337,58 @@ static const struct IRawGameControllerVtbl raw_controller_vtbl = raw_controller_GetSwitchKind, }; +DEFINE_IINSPECTABLE_OUTER( raw_controller_2, IRawGameController2, struct controller, IGameController_outer ) + +static HRESULT WINAPI raw_controller_2_get_SimpleHapticsControllers( IRawGameController2 *iface, IVectorView_SimpleHapticsController** value) +{ + static const struct vector_iids iids = + { + .vector = &IID_IVector_SimpleHapticsController, + .view = &IID_IVectorView_SimpleHapticsController, + .iterable = &IID_IIterable_SimpleHapticsController, + .iterator = &IID_IIterator_SimpleHapticsController, + }; + IVector_SimpleHapticsController *vector; + HRESULT hr; + + FIXME( "iface %p, value %p stub!\n", iface, value ); + + if (SUCCEEDED(hr = vector_create( &iids, (void **)&vector ))) + { + hr = IVector_SimpleHapticsController_GetView( vector, value ); + IVector_SimpleHapticsController_Release( vector ); + } + + return hr; +} + +static HRESULT WINAPI raw_controller_2_get_NonRoamableId( IRawGameController2 *iface, HSTRING* value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI raw_controller_2_get_DisplayName( IRawGameController2 *iface, HSTRING* value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct IRawGameController2Vtbl raw_controller_2_vtbl = +{ + raw_controller_2_QueryInterface, + raw_controller_2_AddRef, + raw_controller_2_Release, + /* IInspectable methods */ + raw_controller_2_GetIids, + raw_controller_2_GetRuntimeClassName, + raw_controller_2_GetTrustLevel, + /* IRawGameController2 methods */ + raw_controller_2_get_SimpleHapticsControllers, + raw_controller_2_get_NonRoamableId, + raw_controller_2_get_DisplayName, +}; + struct controller_statics { IActivationFactory IActivationFactory_iface; @@ -525,6 +584,7 @@ static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameContro impl->IGameControllerImpl_iface.lpVtbl = &controller_vtbl; impl->IGameControllerInputSink_iface.lpVtbl = &input_sink_vtbl; impl->IRawGameController_iface.lpVtbl = &raw_controller_vtbl; + impl->IRawGameController2_iface.lpVtbl = &raw_controller_2_vtbl; impl->ref = 1; TRACE( "created RawGameController %p\n", impl ); diff --git a/include/windows.devices.haptics.idl b/include/windows.devices.haptics.idl index c056ab4941c..506525a6d3c 100644 --- a/include/windows.devices.haptics.idl +++ b/include/windows.devices.haptics.idl @@ -30,7 +30,10 @@ namespace Windows.Devices.Haptics { runtimeclass SimpleHapticsController; declare { + interface Windows.Foundation.Collections.IIterator; + interface Windows.Foundation.Collections.IIterable; interface Windows.Foundation.Collections.IVectorView; + interface Windows.Foundation.Collections.IVector; interface Windows.Foundation.Collections.IVectorView; } From 262c60c40f1ee7df306d40036f4459dc71e361d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1212/1506] windows.gaming.input: Forward get_NonRoamableId to Wine provider. CW-Bug-Id: #23185 --- dlls/windows.gaming.input/controller.c | 4 ++-- dlls/windows.gaming.input/provider.c | 7 +++++++ dlls/windows.gaming.input/provider.idl | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c index e1749a3032d..1adbc5cce0b 100644 --- a/dlls/windows.gaming.input/controller.c +++ b/dlls/windows.gaming.input/controller.c @@ -364,8 +364,8 @@ static HRESULT WINAPI raw_controller_2_get_SimpleHapticsControllers( IRawGameCon static HRESULT WINAPI raw_controller_2_get_NonRoamableId( IRawGameController2 *iface, HSTRING* value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + struct controller *impl = impl_from_IRawGameController2( iface ); + return IWineGameControllerProvider_get_NonRoamableId( impl->wine_provider, value ); } static HRESULT WINAPI raw_controller_2_get_DisplayName( IRawGameController2 *iface, HSTRING* value ) diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index d0472727224..bb84a45b874 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -148,6 +148,12 @@ static BOOL CALLBACK count_ffb_axes( const DIDEVICEOBJECTINSTANCEW *obj, void *a return DIENUM_CONTINUE; } +static HRESULT WINAPI wine_provider_get_NonRoamableId( IWineGameControllerProvider *iface, HSTRING *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + static HRESULT WINAPI wine_provider_get_Type( IWineGameControllerProvider *iface, WineGameControllerType *value ) { struct provider *impl = impl_from_IWineGameControllerProvider( iface ); @@ -356,6 +362,7 @@ static const struct IWineGameControllerProviderVtbl wine_provider_vtbl = wine_provider_GetRuntimeClassName, wine_provider_GetTrustLevel, /* IWineGameControllerProvider methods */ + wine_provider_get_NonRoamableId, wine_provider_get_Type, wine_provider_get_AxisCount, wine_provider_get_ButtonCount, diff --git a/dlls/windows.gaming.input/provider.idl b/dlls/windows.gaming.input/provider.idl index e7b6e96b8aa..a6fcc6e84f3 100644 --- a/dlls/windows.gaming.input/provider.idl +++ b/dlls/windows.gaming.input/provider.idl @@ -173,6 +173,8 @@ namespace Windows.Gaming.Input.Custom { interface IWineGameControllerProvider : IInspectable requires Windows.Gaming.Input.Custom.IGameControllerProvider { + [propget] HRESULT NonRoamableId([out, retval] HSTRING *value); + [propget] HRESULT Type([out, retval] WineGameControllerType *value); [propget] HRESULT AxisCount([out, retval] INT32 *value); [propget] HRESULT ButtonCount([out, retval] INT32 *value); From 2247fac81cd938972e75ca2df5197a644026c4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1213/1506] HACK: dinput: Emulate Steam Input native hooks. CW-Bug-Id: #23185 --- dlls/dinput/joystick_hid.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index b5fc76b9222..a28c3ba39e7 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -864,6 +864,16 @@ static HRESULT hid_joystick_get_property( IDirectInputDevice8W *iface, DWORD pro { DIPROPGUIDANDPATH *value = (DIPROPGUIDANDPATH *)header; value->guidClass = GUID_DEVCLASS_HIDCLASS; + + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if (impl->attrs.VendorID == 0x28de && impl->attrs.ProductID == 0x11ff) + { + const WCHAR *tmp; + if ((tmp = wcschr( impl->device_path, '#' ))) tmp = wcschr( tmp + 1, '#' ); + lstrcpynW( value->wszPath, impl->device_path, tmp - impl->device_path + 1 ); + return DI_OK; + } + lstrcpynW( value->wszPath, impl->device_path, MAX_PATH ); return DI_OK; } From 6aa6c4ea91c48645d25ac88ed54ffbab25c8bb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1214/1506] HACK: hidclass: Emulate Steam Input native hooks. CW-Bug-Id: #23185 --- dlls/hidclass.sys/device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 7d1b9d2c356..135e58bf587 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -390,6 +390,8 @@ struct device_strings static const struct device_strings device_strings[] = { + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + { .id = L"VID_28DE&PID_11FF", .product = L"Controller (XBOX 360 For Windows)" }, /* Microsoft controllers */ { .id = L"VID_045E&PID_028E", .product = L"Controller (XBOX 360 For Windows)" }, { .id = L"VID_045E&PID_028F", .product = L"Controller (XBOX 360 For Windows)" }, From c3e45768c0324ea48a9a687ec0b69f4c69fc151e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1215/1506] HACK: ntdll: Emulate Steam Input native hooks. CW-Bug-Id: #23185 --- dlls/ntdll/unix/file.c | 68 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index c251d9c1955..d84f44d4560 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -2844,6 +2844,67 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i return STATUS_OBJECT_NAME_NOT_FOUND; } +/* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ +static BOOL replace_steam_input_path( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *redir ) +{ + static const WCHAR pipe_prefixW[] = + { + '\\','?','?','\\','p','i','p','e','\\','H','I','D','#','V','I','D','_','0','4','5','E', + '&','P','I','D','_','0','2','8','E','&','I','G','_','0','0', + }; + static const WCHAR hid_prefixW[] = + { + '\\','?','?','\\','h','i','d','#','v','i','d','_','2','8','d','e', + '&','p','i','d','_','1','1','f','f','&','i','g','_','0' + }; + static const WCHAR hid_midW[] = + { + '#','0', + }; + static const WCHAR hid_tailW[] = + { + '&','0','&','0','&','1','#','{','4','d','1','e','5','5','b','2','-','f','1','6','f','-', + '1','1','c','f','-','8','8','c','b','-','0','0','1','1','1','1','0','0','0','0','3','0','}' + }; + UNICODE_STRING *path = attr->ObjectName; + const WCHAR *slot = NULL, *slot_end = NULL, *serial, *serial_end = NULL; + UINT len = 0; + + if (!path || !path->Buffer || path->Length <= sizeof(pipe_prefixW)) return FALSE; + if (wcsnicmp( path->Buffer, pipe_prefixW, ARRAY_SIZE(pipe_prefixW) )) return FALSE; + + serial = path->Buffer + path->Length / sizeof(WCHAR); + while (serial > path->Buffer && *serial != '&') + { + if (*serial == '#') + { + slot_end = serial_end; + serial_end = serial; + slot = serial_end + 1; + } + serial--; + } + if (serial == path->Buffer || *serial != '&' || !slot_end || !serial_end) return FALSE; + + redir->Length = sizeof(hid_prefixW) + sizeof(hid_midW) + sizeof(hid_tailW); + redir->Length += (serial_end - serial + slot_end - slot) * sizeof(WCHAR); + redir->MaximumLength = redir->Length + sizeof(WCHAR); + if (!(redir->Buffer = malloc( redir->MaximumLength ))) return FALSE; + + memcpy( redir->Buffer, hid_prefixW, sizeof(hid_prefixW) ); + len += ARRAY_SIZE(hid_prefixW); + memcpy( redir->Buffer + len, slot, (slot_end - slot) * sizeof(WCHAR) ); + len += slot_end - slot; + memcpy( redir->Buffer + len, hid_midW, sizeof(hid_midW) ); + len += ARRAY_SIZE(hid_midW); + memcpy( redir->Buffer + len, serial, (serial_end - serial) * sizeof(WCHAR) ); + len += serial_end - serial; + memcpy( redir->Buffer + len, hid_tailW, sizeof(hid_tailW) ); + + TRACE( "HACK: %s -> %s\n", debugstr_us(attr->ObjectName), debugstr_us(redir) ); + attr->ObjectName = redir; + return TRUE; +} #ifndef _WIN64 @@ -2945,6 +3006,10 @@ BOOL get_redirect( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *redir ) unsigned int i, prefix_len = 0, len = attr->ObjectName->Length / sizeof(WCHAR); redir->Buffer = NULL; + + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if (replace_steam_input_path( attr, redir )) return TRUE; + if (!NtCurrentTeb64()) return FALSE; if (!len) return FALSE; @@ -3004,7 +3069,8 @@ BOOL get_redirect( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *redir ) BOOL get_redirect( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *redir ) { redir->Buffer = NULL; - return FALSE; + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + return replace_steam_input_path( attr, redir ); } #endif From 88ad474267c139f50174c1ad30b9ff91f3bb3d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1216/1506] HACK: win32u: Emulate Steam Input native hooks. CW-Bug-Id: #23185 --- dlls/win32u/rawinput.c | 43 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index e5eab049fa3..c0e64c7dc3a 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -568,10 +568,49 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data switch (command) { case RIDI_DEVICENAME: - if ((len = wcslen( device->path ) + 1) <= data_len && data) - memcpy( data, device->path, len * sizeof(WCHAR) ); + { + static const WCHAR steam_input_idW[] = + { + '\\','\\','?','\\','H','I','D','#','V','I','D','_','2','8','D','E','&','P','I','D','_','1','1','F','F','&','I','G','_',0 + }; + const WCHAR *device_path; + WCHAR bufferW[MAX_PATH]; + + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if (wcsnicmp( device->path, steam_input_idW, 29 )) device_path = device->path; + else + { + char buffer[MAX_PATH]; + UINT size = 0, slot; + const WCHAR *tmpW; + UINT16 vid, pid; + + tmpW = device->path + 29; + while (*tmpW && *tmpW != '#' && size < ARRAY_SIZE(buffer)) buffer[size++] = *tmpW++; + buffer[size] = 0; + if (sscanf( buffer, "%02u", &slot ) != 1) slot = 0; + + /* FIXME: Return the actual underlying device VID / PID somehow */ + vid = 0x045e; + pid = 0x028e; + + size = snprintf( buffer, ARRAY_SIZE(buffer), "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%04X&%04X", vid, pid ); + if ((tmpW = wcschr( device->path + 29, '&' ))) + { + do buffer[size++] = *tmpW++; + while (*tmpW != '&' && size < ARRAY_SIZE(buffer)); + } + size += snprintf( buffer + size, ARRAY_SIZE(buffer) - size, "#%d#%u", slot, (UINT)GetCurrentProcessId() ); + + ntdll_umbstowcs( buffer, size + 1, bufferW, sizeof(bufferW) ); + device_path = bufferW; + } + + if ((len = wcslen( device_path ) + 1) <= data_len && data) + memcpy( data, device_path, len * sizeof(WCHAR) ); *data_size = len; break; + } case RIDI_DEVICEINFO: if ((len = sizeof(info)) <= data_len && data) From 71f8db3bacb3f2654e5a32c2b97c7b770b44ce51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1217/1506] HACK: windows.gaming.input: Emulate Steam Input native hooks. CW-Bug-Id: #23185 --- dlls/windows.gaming.input/provider.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index bb84a45b874..9bbf42cdf0a 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -150,7 +150,34 @@ static BOOL CALLBACK count_ffb_axes( const DIDEVICEOBJECTINSTANCEW *obj, void *a static HRESULT WINAPI wine_provider_get_NonRoamableId( IWineGameControllerProvider *iface, HSTRING *value ) { + struct provider *impl = impl_from_IWineGameControllerProvider( iface ); + WCHAR buffer[1024]; + UINT16 vid, pid; + HRESULT hr; + FIXME( "iface %p, value %p stub!\n", iface, value ); + + if (FAILED(hr = IGameControllerProvider_get_HardwareVendorId( &impl->IGameControllerProvider_iface, &vid ))) return hr; + if (FAILED(hr = IGameControllerProvider_get_HardwareProductId( &impl->IGameControllerProvider_iface, &pid ))) return hr; + + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if (vid == 0x28de && pid == 0x11ff) + { + const WCHAR *tmp; + char serial[256]; + UINT32 len, slot; + + if (!(tmp = wcschr( impl->device_path + 8, '#' )) || wcsnicmp( tmp - 6, L"&XI_", 4 )) return E_NOTIMPL; + if (swscanf( tmp - 2, L"%02u#%*u&%255[^&]&", &slot, serial ) != 2) return E_NOTIMPL; + + /* FIXME: Return the actual underlying device VID / PID somehow */ + vid = 0x045e; + pid = 0x028e; + + len = swprintf( buffer, ARRAY_SIZE(buffer), L"{wgi/nrid/:steam-%04X&%04X&%s#%d#%u}", vid, pid, serial, slot, GetCurrentProcessId() ); + return WindowsCreateString( buffer, len, value ); + } + return E_NOTIMPL; } From 8c5fbf529816d5bb9808106eaca9f3ed698c839f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1218/1506] HACK: xinput: Emulate Steam Input native hooks. CW-Bug-Id: #23185 --- dlls/xinput1_3/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index 4cb9793fa30..594010f8770 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -519,6 +519,16 @@ static BOOL find_opened_device(const WCHAR *device_path, int *free_slot) *free_slot = i - 1; } + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if ((swscanf(device_path, L"\\\\?\\hid#vid_28de&pid_11ff&xi_%02u#", &i) == 1 || + swscanf(device_path, L"\\\\?\\HID#VID_28DE&PID_11FF&XI_%02u#", &i) == 1) && + i < XUSER_MAX_COUNT && *free_slot != i) + { + controller_destroy(&controllers[i], TRUE); + if (*free_slot != XUSER_MAX_COUNT) open_device_at_index(controllers[i].device_path, *free_slot); + *free_slot = i; + } + return FALSE; } @@ -1173,6 +1183,8 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetCapabilitiesEx(DWORD unk, DWORD index, D caps->VendorId = attr.VendorID; caps->ProductId = attr.ProductID; caps->VersionNumber = attr.VersionNumber; + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + caps->unk2 = index; } controller_unlock(&controllers[index]); From 532d8b068633efe4ad49b80353a7f4f28ab3dd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jan 2024 14:35:42 +0100 Subject: [PATCH 1219/1506] HACK: winebus: Expose virtual controller for Steam Input hooks emulation. Guarded behind a PROTON_EXPOSE_STEAM_CONTROLLER=1 variable. CW-Bug-Id: #23185 --- dlls/winebus.sys/bus_sdl.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 674da28f8e4..2e8fadb43d3 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -964,7 +964,8 @@ static void sdl_add_device(unsigned int index) SDL_JoystickID id; SDL_JoystickType joystick_type; SDL_GameController *controller = NULL; - const char *product, *sdl_serial, *str; + const char *product, *sdl_serial, *str, *env; + BOOL expose_steam_controller = (env = getenv("PROTON_EXPOSE_STEAM_CONTROLLER")) && atoi(env) == 1; char guid_str[33], buffer[ARRAY_SIZE(desc.product)]; int axis_count, axis_offset; @@ -1013,7 +1014,7 @@ static void sdl_add_device(unsigned int index) return; } - if (desc.vid == 0x28de && desc.pid == 0x11ff) + if (desc.vid == 0x28de && desc.pid == 0x11ff && !expose_steam_controller) { TRACE("Steam virtual controller, pretending it's an Xbox 360 controller\n"); desc.vid = 0x045e; @@ -1021,8 +1022,12 @@ static void sdl_add_device(unsigned int index) } /* CW-Bug-Id: #20528 Check steam virtual controller indexes to keep them ordered */ - if ((str = pSDL_JoystickName(joystick)) && sscanf(str, "Microsoft X-Box 360 pad %u", &desc.input) == 1) desc.input++; - else desc.input = -1; + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if ((str = pSDL_JoystickName(joystick)) && sscanf(str, "Microsoft X-Box 360 pad %u", &desc.input) == 1) + { + if (!expose_steam_controller) desc.input++; + desc.version = 0; /* keep version fixed as 0 so we can hardcode it in ntdll rawinput pipe redirection */ + } if (pSDL_JoystickGetSerial && (sdl_serial = pSDL_JoystickGetSerial(joystick))) { @@ -1033,8 +1038,15 @@ static void sdl_add_device(unsigned int index) /* Overcooked! All You Can Eat only adds controllers with unique serial numbers * Prefer keeping serial numbers unique over keeping them consistent across runs */ pSDL_JoystickGetGUIDString(pSDL_JoystickGetGUID(joystick), guid_str, sizeof(guid_str)); - snprintf(buffer, sizeof(buffer), "%s.%d", guid_str, index); - TRACE("Making up serial number for %s: %s\n", product, buffer); + + /* CW-Bug-Id: #23185 Emulate Steam Input native hooks for native SDL */ + if (desc.input != -1) snprintf(buffer, sizeof(buffer), "%s", guid_str); + else + { + snprintf(buffer, sizeof(buffer), "%s.%d", guid_str, index); + TRACE("Making up serial number for %s: %s\n", product, buffer); + } + ntdll_umbstowcs(buffer, strlen(buffer) + 1, desc.serialnumber, ARRAY_SIZE(desc.serialnumber)); } From 0c21e0c1cf8af04c068519381895c1d00794cda6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 9 Jan 2024 14:10:03 +0100 Subject: [PATCH 1220/1506] HACK: win32u: Report underlying VID/PID in Steam Input hooks emulation. CW-Bug-Id: #23185 --- dlls/win32u/rawinput.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index c0e64c7dc3a..3fa187f9673 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -531,6 +531,30 @@ UINT WINAPI NtUserGetRawInputDeviceList( RAWINPUTDEVICELIST *device_list, UINT * return count; } +static BOOL steam_input_get_vid_pid( UINT slot, UINT16 *vid, UINT16 *pid ) +{ + const char *info = getenv( "SteamVirtualGamepadInfo" ); + char buffer[256]; + UINT current; + FILE *file; + + TRACE( "reading SteamVirtualGamepadInfo %s\n", debugstr_a(info) ); + + if (!info || !(file = fopen( info, "r" ))) return FALSE; + while (fscanf( file, "%255[^\n]\n", buffer ) == 1) + { + if (sscanf( buffer, "[slot %d]", ¤t )) continue; + if (current < slot) continue; + if (current > slot) break; + if (sscanf( buffer, "VID=0x%hx", vid )) continue; + if (sscanf( buffer, "PID=0x%hx", pid )) continue; + } + + fclose( file ); + + return TRUE; +} + /********************************************************************** * NtUserGetRawInputDeviceInfo (win32u.@) */ @@ -590,9 +614,11 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data buffer[size] = 0; if (sscanf( buffer, "%02u", &slot ) != 1) slot = 0; - /* FIXME: Return the actual underlying device VID / PID somehow */ - vid = 0x045e; - pid = 0x028e; + if (!steam_input_get_vid_pid( slot, &vid, &pid )) + { + vid = 0x045e; + pid = 0x028e; + } size = snprintf( buffer, ARRAY_SIZE(buffer), "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%04X&%04X", vid, pid ); if ((tmpW = wcschr( device->path + 29, '&' ))) From 20a91d23955080ce8c8d99ea07b84cf18095d7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 9 Jan 2024 14:10:03 +0100 Subject: [PATCH 1221/1506] HACK: windows.gaming.input: Report underlying VID/PID in Steam Input hooks emulation. CW-Bug-Id: #23185 --- dlls/windows.gaming.input/provider.c | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index 9bbf42cdf0a..3515d5c9ba6 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -148,6 +148,30 @@ static BOOL CALLBACK count_ffb_axes( const DIDEVICEOBJECTINSTANCEW *obj, void *a return DIENUM_CONTINUE; } +static BOOL steam_input_get_vid_pid( UINT slot, UINT16 *vid, UINT16 *pid ) +{ + const char *info = getenv( "SteamVirtualGamepadInfo" ); + char buffer[256]; + UINT current; + FILE *file; + + TRACE( "reading SteamVirtualGamepadInfo %s\n", debugstr_a(info) ); + + if (!info || !(file = fopen( info, "r" ))) return FALSE; + while (fscanf( file, "%255[^\n]\n", buffer ) == 1) + { + if (sscanf( buffer, "[slot %d]", ¤t )) continue; + if (current < slot) continue; + if (current > slot) break; + if (sscanf( buffer, "VID=0x%hx", vid )) continue; + if (sscanf( buffer, "PID=0x%hx", pid )) continue; + } + + fclose( file ); + + return TRUE; +} + static HRESULT WINAPI wine_provider_get_NonRoamableId( IWineGameControllerProvider *iface, HSTRING *value ) { struct provider *impl = impl_from_IWineGameControllerProvider( iface ); @@ -170,9 +194,11 @@ static HRESULT WINAPI wine_provider_get_NonRoamableId( IWineGameControllerProvid if (!(tmp = wcschr( impl->device_path + 8, '#' )) || wcsnicmp( tmp - 6, L"&XI_", 4 )) return E_NOTIMPL; if (swscanf( tmp - 2, L"%02u#%*u&%255[^&]&", &slot, serial ) != 2) return E_NOTIMPL; - /* FIXME: Return the actual underlying device VID / PID somehow */ - vid = 0x045e; - pid = 0x028e; + if (!steam_input_get_vid_pid( slot, &vid, &pid )) + { + vid = 0x045e; + pid = 0x028e; + } len = swprintf( buffer, ARRAY_SIZE(buffer), L"{wgi/nrid/:steam-%04X&%04X&%s#%d#%u}", vid, pid, serial, slot, GetCurrentProcessId() ); return WindowsCreateString( buffer, len, value ); From ba11cd978077518e55b8f87311287e48109f3c49 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 23 Jan 2024 16:34:49 -0600 Subject: [PATCH 1222/1506] winhttp: Always return result at once if available in WinHttpQueryDataAvailable(). CW-Bug-Id: #23312 --- dlls/winhttp/request.c | 59 ++++++++++++++++++++++++++++--- dlls/winhttp/tests/notification.c | 7 +++- dlls/winhttp/winhttp_private.h | 13 +++++++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 84af8e58988..74278195fc3 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -257,6 +257,16 @@ static BOOL cancel_queue( struct queue *queue ) return cancelled; } +static void task_send_callback( void *ctx, BOOL abort ) +{ + struct send_callback *s = ctx; + + if (abort) return; + + TRACE( "running %p\n", ctx ); + send_callback( s->task_hdr.obj, s->status, s->info, s->buflen ); +} + static void free_header( struct header *header ) { free( header->field ); @@ -3052,9 +3062,10 @@ static DWORD query_data_ready( struct request *request ) return count; } -static BOOL skip_async_queue( struct request *request ) +static BOOL skip_async_queue( struct request *request, BOOL *data_available ) { - return request->hdr.recursion_count < 3 && (end_of_read_data( request ) || query_data_ready( request )); + *data_available = end_of_read_data( request ) || query_data_ready( request ); + return request->hdr.recursion_count < 3 && *data_available; } static DWORD query_data_available( struct request *request, DWORD *available, BOOL async ) @@ -3106,6 +3117,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) DWORD ret; struct request *request; BOOL async; + BOOL data_available = FALSE; TRACE("%p, %p\n", hrequest, available); @@ -3121,7 +3133,44 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request )) + if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &data_available )) + { + ret = query_data_available( request, available, async ); + } + else if (data_available) + { + /* Data available but recursion limit reached, only queue callback. */ + struct send_callback *s; + + if (!(s = malloc( sizeof(*s) ))) + { + release_object( &request->hdr ); + SetLastError( ERROR_OUTOFMEMORY ); + return FALSE; + } + + if (!(ret = query_data_available( request, &s->count, FALSE ))) + { + if (available) *available = s->count; + s->status = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; + s->info = &s->count; + s->buflen = sizeof(s->count); + } + else + { + s->result.dwResult = API_QUERY_DATA_AVAILABLE; + s->result.dwError = ret; + s->status = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; + s->info = &s->result; + s->buflen = sizeof(s->result); + } + + if ((ret = queue_task( &request->queue, task_send_callback, &s->task_hdr, &request->hdr ))) + free( s ); + else + ret = ERROR_IO_PENDING; + } + else { struct query_data *q; @@ -3139,7 +3188,6 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) else ret = ERROR_IO_PENDING; } - else ret = query_data_available( request, available, async ); release_object( &request->hdr ); SetLastError( ret ); @@ -3165,6 +3213,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW DWORD ret; struct request *request; BOOL async; + BOOL data_available; TRACE( "%p, %p, %lu, %p\n", hrequest, buffer, to_read, read ); @@ -3180,7 +3229,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request )) + if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request, &data_available )) { struct read_data *r; diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 78319f0df5c..40db323fb5e 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -1863,6 +1863,7 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex DWORD status, void *buffer, DWORD buflen ) { struct test_recursion_context *context = (struct test_recursion_context *)context_ptr; + static DWORD len; DWORD err; BOOL ret; BYTE b; @@ -1939,10 +1940,14 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex context->max_recursion_read = max( context->max_recursion_read, context->recursion_count ); context->read_from_callback = TRUE; InterlockedIncrement( &context->recursion_count ); - ret = WinHttpQueryDataAvailable( context->request, NULL ); + len = 0xdeadbeef; + /* Use static variable len here so write to it doesn't destroy the stack on old Windows which + * doesn't set the value at once. */ + ret = WinHttpQueryDataAvailable( context->request, &len ); err = GetLastError(); ok( ret, "failed to query data available, GetLastError() %lu\n", err ); ok( err == ERROR_SUCCESS || err == ERROR_IO_PENDING, "got %lu\n", err ); + ok( len != 0xdeadbeef || broken( len == 0xdeadbeef ) /* Win7 */, "got %lu.\n", len ); if (err == ERROR_SUCCESS) context->have_sync_callback = TRUE; InterlockedDecrement( &context->recursion_count ); break; diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 0bf1c5bc6b0..80ce2614ca1 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -312,6 +312,19 @@ struct task_header volatile LONG completion_sent; }; +struct send_callback +{ + struct task_header task_hdr; + DWORD status; + void *info; + DWORD buflen; + union + { + WINHTTP_ASYNC_RESULT result; + DWORD count; + }; +}; + struct send_request { struct task_header task_hdr; From 665742a23a47aab45b1b28bfe4873c5d15e0ab6a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 23 Jan 2024 16:56:09 -0600 Subject: [PATCH 1223/1506] winhttp: Always return result at once if available in WinHttpReadData(). CW-Bug-Id: #23312 --- dlls/winhttp/request.c | 42 ++++++++++++++++++++++++++++--- dlls/winhttp/tests/notification.c | 6 ++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 74278195fc3..14e5b493f77 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3213,7 +3213,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW DWORD ret; struct request *request; BOOL async; - BOOL data_available; + BOOL data_available = FALSE; TRACE( "%p, %p, %lu, %p\n", hrequest, buffer, to_read, read ); @@ -3229,7 +3229,44 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request, &data_available )) + if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &data_available )) + { + ret = read_data( request, buffer, to_read, read, async ); + } + else if (data_available) + { + /* Data available but recursion limit reached, only queue callback. */ + struct send_callback *s; + + if (!(s = malloc( sizeof(*s) ))) + { + release_object( &request->hdr ); + SetLastError( ERROR_OUTOFMEMORY ); + return FALSE; + } + + if (!(ret = read_data( request, buffer, to_read, &s->count, FALSE ))) + { + if (read) *read = s->count; + s->status = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; + s->info = buffer; + s->buflen = s->count; + } + else + { + s->result.dwResult = API_READ_DATA; + s->result.dwError = ret; + s->status = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; + s->info = &s->result; + s->buflen = sizeof(s->result); + } + + if ((ret = queue_task( &request->queue, task_send_callback, &s->task_hdr, &request->hdr ))) + free( s ); + else + ret = ERROR_IO_PENDING; + } + else { struct read_data *r; @@ -3248,7 +3285,6 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW else ret = ERROR_IO_PENDING; } - else ret = read_data( request, buffer, to_read, read, async ); release_object( &request->hdr ); SetLastError( ret ); diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 40db323fb5e..ed70ed906f0 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -1921,10 +1921,14 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex "got %lu, thread %#lx\n", context->recursion_count, GetCurrentThreadId() ); context->max_recursion_query = max( context->max_recursion_query, context->recursion_count ); InterlockedIncrement( &context->recursion_count ); - ret = WinHttpReadData( context->request, &b, 1, NULL ); + b = 0xff; + len = 0xdeadbeef; + ret = WinHttpReadData( context->request, &b, 1, &len ); err = GetLastError(); ok( ret, "failed to read data, GetLastError() %lu\n", err ); ok( err == ERROR_SUCCESS || err == ERROR_IO_PENDING, "got %lu\n", err ); + ok( b != 0xff, "got %#x.\n", b ); + ok( len == 1, "got %lu.\n", len ); if (err == ERROR_SUCCESS) context->have_sync_callback = TRUE; InterlockedDecrement( &context->recursion_count ); break; From 357c1ff890d8acdb7c6913c42a25ce9a80f0f4d2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 23 Jan 2024 21:23:02 -0600 Subject: [PATCH 1224/1506] ntdll: HACK: Substitute different d3dcompiler version for BDO. CW-Bug-Id: #23314 --- dlls/ntdll/loader.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 24efd25e8db..5ef024631a2 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3335,6 +3335,21 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI return status; } +static void substitute_dll( const WCHAR **libname ) +{ + static int substitute = -1; + + if (substitute == -1) + { + WCHAR env_str[32]; + + if ((substitute = (get_env( L"SteamGameId", env_str, sizeof(env_str)) && !wcsicmp( env_str, L"582660" )))) + FIXME( "HACK: substituting dll name.\n" ); + } + if (!substitute) return; + if (*libname && !wcsicmp( *libname, L"d3dcompiler_46.dll" )) + *libname = L"d3dcompiler_43.dll"; +} /*********************************************************************** * load_dll (internal) @@ -3353,6 +3368,8 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, DWORD fl TRACE( "looking for %s in %s\n", debugstr_w(libname), debugstr_w(load_path) ); + substitute_dll( &libname ); + if (system && system_dll_path.Buffer) nts = search_dll_file( system_dll_path.Buffer, libname, &nt_name, pwm, &mapping, &image_info, &id ); From 61176033a2bb3c6a5a229078f684b85ee085ef80 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 6 Feb 2024 19:05:00 -0600 Subject: [PATCH 1225/1506] ntdll: Better track thread pool wait's wait_pending state. CW-Bug-Id: #21509 --- dlls/ntdll/threadpool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c index 4f22114a55e..9a8f380bf72 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c @@ -1265,6 +1265,7 @@ static void CALLBACK waitqueue_thread_proc( void *param ) u.wait.wait_entry ) { assert( wait->type == TP_OBJECT_TYPE_WAIT ); + assert( wait->u.wait.wait_pending ); if (wait->u.wait.timeout <= now.QuadPart) { /* Wait object timed out. */ @@ -1272,6 +1273,7 @@ static void CALLBACK waitqueue_thread_proc( void *param ) { list_remove( &wait->u.wait.wait_entry ); list_add_tail( &bucket->reserved, &wait->u.wait.wait_entry ); + wait->u.wait.wait_pending = FALSE; } if ((wait->u.wait.flags & (WT_EXECUTEINWAITTHREAD | WT_EXECUTEINIOTHREAD))) { @@ -1329,6 +1331,7 @@ static void CALLBACK waitqueue_thread_proc( void *param ) { list_remove( &wait->u.wait.wait_entry ); list_add_tail( &bucket->reserved, &wait->u.wait.wait_entry ); + wait->u.wait.wait_pending = FALSE; } if ((wait->u.wait.flags & (WT_EXECUTEINWAITTHREAD | WT_EXECUTEINIOTHREAD))) { From 25d2d4c847b03b409564079a5cef1ab6ff71e457 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 6 Feb 2024 19:14:40 -0600 Subject: [PATCH 1226/1506] ntdll: Make sure wakeups from already unset events are ignored in waitqueue_thread_proc(). CW-Bug-Id: #21509 --- dlls/ntdll/threadpool.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c index 9a8f380bf72..2887e84b12c 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c @@ -160,6 +160,7 @@ struct threadpool_object LONG num_pending_callbacks; LONG num_running_callbacks; LONG num_associated_callbacks; + LONG update_serial; /* arguments for callback */ union { @@ -1243,6 +1244,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer ) static void CALLBACK waitqueue_thread_proc( void *param ) { struct threadpool_object *objects[MAXIMUM_WAITQUEUE_OBJECTS]; + LONG update_serials[MAXIMUM_WAITQUEUE_OBJECTS]; HANDLE handles[MAXIMUM_WAITQUEUE_OBJECTS + 1]; struct waitqueue_bucket *bucket = param; struct threadpool_object *wait, *next; @@ -1295,6 +1297,7 @@ static void CALLBACK waitqueue_thread_proc( void *param ) InterlockedIncrement( &wait->refcount ); objects[num_handles] = wait; handles[num_handles] = wait->u.wait.handle; + update_serials[num_handles] = wait->update_serial; num_handles++; } } @@ -1323,7 +1326,7 @@ static void CALLBACK waitqueue_thread_proc( void *param ) { wait = objects[status - STATUS_WAIT_0]; assert( wait->type == TP_OBJECT_TYPE_WAIT ); - if (wait->u.wait.bucket) + if (wait->u.wait.bucket && wait->update_serial == update_serials[status - STATUS_WAIT_0]) { /* Wait object signaled. */ assert( wait->u.wait.bucket == bucket ); @@ -1344,7 +1347,10 @@ static void CALLBACK waitqueue_thread_proc( void *param ) else tp_object_submit( wait, TRUE ); } else - WARN("wait object %p triggered while object was destroyed\n", wait); + { + WARN("wait object %p triggered while object was %s.\n", + wait, wait->u.wait.bucket ? "updated" : "destroyed"); + } } /* Release temporary references to wait objects. */ @@ -1917,6 +1923,7 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa object->num_pending_callbacks = 0; object->num_running_callbacks = 0; object->num_associated_callbacks = 0; + object->update_serial = 0; if (environment) { @@ -3051,12 +3058,15 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout ) { struct threadpool_object *this = impl_from_TP_WAIT( wait ); ULONGLONG timestamp = MAXLONGLONG; + BOOL same_handle; TRACE( "%p %p %p\n", wait, handle, timeout ); RtlEnterCriticalSection( &waitqueue.cs ); assert( this->u.wait.bucket ); + + same_handle = this->u.wait.handle == handle; this->u.wait.handle = handle; if (handle || this->u.wait.wait_pending) @@ -3090,6 +3100,8 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout ) } /* Wake up the wait queue thread. */ + if (!same_handle) + ++this->update_serial; NtSetEvent( bucket->update_event, NULL ); } From f961d5e51fb1e5839e42fa6a45f0506d7c78d325 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 9 Feb 2024 11:33:41 -0600 Subject: [PATCH 1227/1506] win32u: Send message with timeout in send_erase(). CW-Bug-Id: #23394 --- dlls/win32u/dce.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index d7aa75b3039..3f1e25ae9e2 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1248,7 +1248,10 @@ static BOOL send_erase( HWND hwnd, UINT flags, HRGN client_rgn, { /* don't erase if the clip box is empty */ if (type != NULLREGION) - need_erase = !send_message( hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0 ); + { + need_erase = !send_message_timeout( hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0, SMTO_ABORTIFHUNG, 1000, FALSE ); + if (need_erase && RtlGetLastWin32Error() == ERROR_TIMEOUT) ERR( "timeout.\n" ); + } } if (!hdc_ret) release_dc( hwnd, hdc, TRUE ); } From 99f8658c2929cad83579e74e5fda722ea23f16b7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 9 Feb 2024 11:46:31 -0600 Subject: [PATCH 1228/1506] ntdll: HACK: Add WINE_HEAP_ZERO_MEMORY variable to force zeroing allocated memory. CW-Bug-Id: #23394 --- dlls/ntdll/loader.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 5ef024631a2..8ddd5c66022 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4456,6 +4456,7 @@ void loader_init( CONTEXT *context, void **entry ) WINE_MODREF *kernel32; PEB *peb = NtCurrentTeb()->Peb; WCHAR env_str[16]; + ULONG heap_flags = HEAP_GROWABLE; NtQueryVirtualMemory( GetCurrentProcess(), LdrInitializeThunk, MemoryBasicInformation, &meminfo, sizeof(meminfo), NULL ); @@ -4474,8 +4475,13 @@ void loader_init( CONTEXT *context, void **entry ) delay_heap_free = TRUE; } } + if (get_env( L"WINE_HEAP_ZERO_MEMORY", env_str, sizeof(env_str)) && env_str[0] == L'1') + { + ERR( "Enabling heap zero hack.\n" ); + heap_flags |= HEAP_ZERO_MEMORY; + } - peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL ); + peb->ProcessHeap = RtlCreateHeap( heap_flags, NULL, 0, 0, NULL, NULL ); RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 ); RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits, From e311dafbf4ac00906a0576babc1fbdf2d043dd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 May 2023 13:34:23 +0200 Subject: [PATCH 1229/1506] winegstreamer: Introduce and use a new wg_task_pool helper. To better track GStreamer threads, avoiding potential task leaks in the default pool which keeps some thread alive. CW-Bug-Id: #22045 --- dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/unix_private.h | 4 ++ dlls/winegstreamer/wg_parser.c | 28 +++++++++ dlls/winegstreamer/wg_task_pool.c | 98 +++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 dlls/winegstreamer/wg_task_pool.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 3f143e355c5..9cae96c5ebc 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -27,6 +27,7 @@ SOURCES = \ wg_parser.c \ wg_sample.c \ wg_source.c \ + wg_task_pool.c \ wg_transform.c \ winegstreamer_classes.idl \ wm_reader.c \ diff --git a/dlls/winegstreamer/unix_private.h b/dlls/winegstreamer/unix_private.h index d15054661c7..a165b8f1cfe 100644 --- a/dlls/winegstreamer/unix_private.h +++ b/dlls/winegstreamer/unix_private.h @@ -93,6 +93,10 @@ extern NTSTATUS wg_muxer_push_sample(void *args); extern NTSTATUS wg_muxer_read_data(void *args); extern NTSTATUS wg_muxer_finalize(void *args); +/* wg_task_pool.c */ + +extern GstTaskPool *wg_task_pool_new(void); + /* wg_allocator.c */ static inline BYTE *wg_sample_data(struct wg_sample *sample) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index dd555a7ce19..2d00f4247e0 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -73,6 +73,7 @@ struct wg_parser GstElement *container, *decodebin; GstBus *bus; + GstTaskPool *task_pool; GstPad *my_src; guint64 file_size, start_offset, next_offset, stop_offset; @@ -1613,6 +1614,24 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use } break; + case GST_MESSAGE_STREAM_STATUS: + { + GstStreamStatusType type; + GstElement *element; + const GValue *val; + GstTask *task; + + gst_message_parse_stream_status(msg, &type, &element); + val = gst_message_get_stream_status_object(msg); + GST_DEBUG("parser %p, message %s, type %u, value %p (%s).", parser, GST_MESSAGE_TYPE_NAME(msg), type, val, G_VALUE_TYPE_NAME(val)); + + if (G_VALUE_TYPE(val) == GST_TYPE_TASK && (task = g_value_get_object(val)) + && type == GST_STREAM_STATUS_TYPE_CREATE) + gst_task_set_pool(task, parser->task_pool); + + break; + } + default: break; } @@ -2011,6 +2030,7 @@ static NTSTATUS wg_parser_disconnect(void *args) parser->input_cache_chunks[i].data = NULL; } + gst_task_pool_cleanup(parser->task_pool); return S_OK; } @@ -2127,6 +2147,7 @@ static NTSTATUS wg_parser_create(void *args) struct wg_parser_create_params *params = args; struct wg_parser *parser; + GError *error; if (!(parser = calloc(1, sizeof(*parser)))) return E_OUTOFMEMORY; @@ -2140,6 +2161,12 @@ static NTSTATUS wg_parser_create(void *args) parser->use_opengl = FALSE; } } + if (!(parser->task_pool = wg_task_pool_new())) + { + free(parser); + return E_OUTOFMEMORY; + } + gst_task_pool_prepare(parser->task_pool, &error); pthread_mutex_init(&parser->mutex, NULL); pthread_cond_init(&parser->init_cond, NULL); @@ -2163,6 +2190,7 @@ static NTSTATUS wg_parser_destroy(void *args) gst_bus_set_sync_handler(parser->bus, NULL, NULL, NULL); gst_object_unref(parser->bus); } + gst_object_unref(parser->task_pool); if (parser->context) gst_context_unref(parser->context); diff --git a/dlls/winegstreamer/wg_task_pool.c b/dlls/winegstreamer/wg_task_pool.c new file mode 100644 index 00000000000..ec7da286d5f --- /dev/null +++ b/dlls/winegstreamer/wg_task_pool.c @@ -0,0 +1,98 @@ +/* + * GStreamer task pool + * + * Copyright 2023 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include + +#include + +#include "unix_private.h" + +typedef struct +{ + GstTaskPool parent; +} WgTaskPool; + +typedef struct +{ + GstTaskPoolClass parent_class; +} WgTaskPoolClass; + +G_DEFINE_TYPE(WgTaskPool, wg_task_pool, GST_TYPE_TASK_POOL); + +static void wg_task_pool_prepare(GstTaskPool *pool, GError **error) +{ + GST_LOG("pool %p, error %p", pool, error); +} + +static void wg_task_pool_cleanup(GstTaskPool *pool) +{ + GST_LOG("pool %p", pool); +} + +static gpointer wg_task_pool_push(GstTaskPool *pool, GstTaskPoolFunction func, gpointer data, GError **error) +{ + pthread_t *tid; + gint res; + + GST_LOG("pool %p, func %p, data %p, error %p", pool, func, data, error); + + if (!(tid = malloc(sizeof(*tid))) || !(res = pthread_create(tid, NULL, (void *)func, data))) + return tid; + + g_set_error(error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN, "Error creating thread: %s", g_strerror(res)); + free(tid); + + return NULL; +} + +static void wg_task_pool_join(GstTaskPool *pool, gpointer id) +{ + pthread_t *tid = id; + + GST_LOG("pool %p, id %p", pool, id); + + pthread_join(*tid, NULL); + free(tid); +} + +static void wg_task_pool_class_init(WgTaskPoolClass *klass) +{ + GstTaskPoolClass *parent_class = (GstTaskPoolClass *)klass; + parent_class->prepare = wg_task_pool_prepare; + parent_class->cleanup = wg_task_pool_cleanup; + parent_class->push = wg_task_pool_push; + parent_class->join = wg_task_pool_join; +} + +static void wg_task_pool_init(WgTaskPool *pool) +{ +} + +GstTaskPool *wg_task_pool_new(void) +{ + return g_object_new(wg_task_pool_get_type(), NULL); +} From 3a3400aa407c2362a08095cb57ccb6e5aa68077d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 20 Jan 2023 14:18:25 -0600 Subject: [PATCH 1230/1506] winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for aac decoder. CW-Bug-Id: #21804 CW-Bug-Id: #22299 --- dlls/winegstreamer/audio_decoder.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/audio_decoder.c b/dlls/winegstreamer/audio_decoder.c index 771eae465fe..cd63f116cbf 100644 --- a/dlls/winegstreamer/audio_decoder.c +++ b/dlls/winegstreamer/audio_decoder.c @@ -489,7 +489,18 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - FIXME("iface %p, message %#x, param %p stub!\n", iface, message, (void *)param); + struct audio_decoder *decoder = impl_from_IMFTransform(iface); + + TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); + + if (!decoder->wg_transform) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (message == MFT_MESSAGE_COMMAND_DRAIN) + return wg_transform_drain(decoder->wg_transform); + + FIXME("Ignoring message %#x.\n", message); + return S_OK; } From 73410b62a84a58ecee639600a6b3fe689b2aa513 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 20 Jan 2023 14:47:47 -0600 Subject: [PATCH 1231/1506] winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for resampler. CW-Bug-Id: #21804 CW-Bug-Id: #22299 --- dlls/winegstreamer/resampler.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index b5b62d58800..22fb273e84c 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -509,7 +509,18 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - FIXME("iface %p, message %#x, param %p stub!\n", iface, message, (void *)param); + struct resampler *impl = impl_from_IMFTransform(iface); + + TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); + + if (!impl->wg_transform) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (message == MFT_MESSAGE_COMMAND_DRAIN) + return wg_transform_drain(impl->wg_transform); + + FIXME("Ignoring message %#x.\n", message); + return S_OK; } From c6fe011aa26d50c761c932265af9d4d506ce72b4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 20 Jan 2023 14:48:48 -0600 Subject: [PATCH 1232/1506] winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for video processor. CW-Bug-Id: #21804 CW-Bug-Id: #22299 --- dlls/winegstreamer/video_processor.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/video_processor.c b/dlls/winegstreamer/video_processor.c index 1cbb37dafc7..698ae498ec7 100644 --- a/dlls/winegstreamer/video_processor.c +++ b/dlls/winegstreamer/video_processor.c @@ -513,7 +513,18 @@ static HRESULT WINAPI video_processor_ProcessEvent(IMFTransform *iface, DWORD id static HRESULT WINAPI video_processor_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - FIXME("iface %p, message %#x, param %#Ix stub!\n", iface, message, param); + struct video_processor *impl = impl_from_IMFTransform(iface); + + TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); + + if (!impl->wg_transform) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (message == MFT_MESSAGE_COMMAND_DRAIN) + return wg_transform_drain(impl->wg_transform); + + FIXME("Ignoring message %#x.\n", message); + return S_OK; } From d6fff9c2a5511cdffc9ebbcd3b20dfe871d4ea5f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 20 Jan 2023 14:50:38 -0600 Subject: [PATCH 1233/1506] winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for wma decoder. CW-Bug-Id: #21804 CW-Bug-Id: #22299 --- dlls/winegstreamer/wma_decoder.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c index 9a9ea857e0d..a4380d3a3b5 100644 --- a/dlls/winegstreamer/wma_decoder.c +++ b/dlls/winegstreamer/wma_decoder.c @@ -501,7 +501,18 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - FIXME("iface %p, message %#x, param %p stub!\n", iface, message, (void *)param); + struct wma_decoder *decoder = impl_from_IMFTransform(iface); + + TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); + + if (!decoder->wg_transform) + return MF_E_TRANSFORM_TYPE_NOT_SET; + + if (message == MFT_MESSAGE_COMMAND_DRAIN) + return wg_transform_drain(decoder->wg_transform); + + FIXME("Ignoring message %#x.\n", message); + return S_OK; } From 88da48b1db4e75baadc77abb807cd369858448df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 17 Aug 2023 11:21:56 +0200 Subject: [PATCH 1234/1506] HACK: winegstreamer: Do not report live latency for some games. CW-Bug-Id: #22581 --- dlls/winegstreamer/video_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index f75fb51ca84..35917be2951 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -116,7 +116,7 @@ static HRESULT try_create_wg_transform(struct video_decoder *decoder) { const char *sgi; - if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100"))) + if ((sgi = getenv("SteamGameId")) && ((!strcmp(sgi, "2009100")) || (!strcmp(sgi, "2555360")))) attrs.low_latency = FALSE; } From 4bf150b45d93f340bf663e89479856d14df0c5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 21 Aug 2023 19:17:48 +0200 Subject: [PATCH 1235/1506] HACK: winegstreamer: Don't add unnecessary and slow? videoflip for some games. CW-Bug-Id: #22581 --- dlls/winegstreamer/wg_transform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 4acc449a7f5..3a17ac9b401 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -457,7 +457,7 @@ NTSTATUS wg_transform_create(void *args) case WG_MAJOR_TYPE_VIDEO: { const char *sgi; - if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100"))) + if ((sgi = getenv("SteamGameId")) && ((!strcmp(sgi, "2009100")) || (!strcmp(sgi, "2555360")))) { if (!(element = create_element("videoconvert", "base")) || !append_element(transform->container, element, &first, &last)) From 68f76f5d9c04361bc0bc88b08ab5174e150849dc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 21 Aug 2023 12:52:48 -0600 Subject: [PATCH 1236/1506] HACK: winegstreamer: Disable MF_SA_D3D11_AWARE for some games. CW-Bug-Id: #22581 --- dlls/winegstreamer/video_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 35917be2951..95a014a46e0 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -826,7 +826,7 @@ static HRESULT video_decoder_create_with_types(const GUID *const *input_types, U { const char *sgi; - if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100"))) + if ((sgi = getenv("SteamGameId")) && ((!strcmp(sgi, "2009100")) || (!strcmp(sgi, "2555360")))) IMFAttributes_SetUINT32(decoder->attributes, &MF_SA_D3D11_AWARE, FALSE); } From 410b000fde88d761881036fc25945e67030ec7e3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 14 Feb 2024 10:23:33 -0600 Subject: [PATCH 1237/1506] Revert "winhttp: Always return result at once if available in WinHttpReadData()." This reverts commit ec94ccd297c8e5f080b45b5d48a1d035a1492df6. --- dlls/winhttp/request.c | 42 +++---------------------------- dlls/winhttp/tests/notification.c | 6 +---- 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 14e5b493f77..74278195fc3 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3213,7 +3213,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW DWORD ret; struct request *request; BOOL async; - BOOL data_available = FALSE; + BOOL data_available; TRACE( "%p, %p, %lu, %p\n", hrequest, buffer, to_read, read ); @@ -3229,44 +3229,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &data_available )) - { - ret = read_data( request, buffer, to_read, read, async ); - } - else if (data_available) - { - /* Data available but recursion limit reached, only queue callback. */ - struct send_callback *s; - - if (!(s = malloc( sizeof(*s) ))) - { - release_object( &request->hdr ); - SetLastError( ERROR_OUTOFMEMORY ); - return FALSE; - } - - if (!(ret = read_data( request, buffer, to_read, &s->count, FALSE ))) - { - if (read) *read = s->count; - s->status = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; - s->info = buffer; - s->buflen = s->count; - } - else - { - s->result.dwResult = API_READ_DATA; - s->result.dwError = ret; - s->status = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; - s->info = &s->result; - s->buflen = sizeof(s->result); - } - - if ((ret = queue_task( &request->queue, task_send_callback, &s->task_hdr, &request->hdr ))) - free( s ); - else - ret = ERROR_IO_PENDING; - } - else + if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request, &data_available )) { struct read_data *r; @@ -3285,6 +3248,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW else ret = ERROR_IO_PENDING; } + else ret = read_data( request, buffer, to_read, read, async ); release_object( &request->hdr ); SetLastError( ret ); diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index ed70ed906f0..40db323fb5e 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -1921,14 +1921,10 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex "got %lu, thread %#lx\n", context->recursion_count, GetCurrentThreadId() ); context->max_recursion_query = max( context->max_recursion_query, context->recursion_count ); InterlockedIncrement( &context->recursion_count ); - b = 0xff; - len = 0xdeadbeef; - ret = WinHttpReadData( context->request, &b, 1, &len ); + ret = WinHttpReadData( context->request, &b, 1, NULL ); err = GetLastError(); ok( ret, "failed to read data, GetLastError() %lu\n", err ); ok( err == ERROR_SUCCESS || err == ERROR_IO_PENDING, "got %lu\n", err ); - ok( b != 0xff, "got %#x.\n", b ); - ok( len == 1, "got %lu.\n", len ); if (err == ERROR_SUCCESS) context->have_sync_callback = TRUE; InterlockedDecrement( &context->recursion_count ); break; From 6ae40c74f3586a5bffd1159c90f30603d4a87339 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 14 Feb 2024 10:23:35 -0600 Subject: [PATCH 1238/1506] Revert "winhttp: Always return result at once if available in WinHttpQueryDataAvailable()." This reverts commit 41ffcf40a4244b2bc23709d57aa87fa01b13e80f. --- dlls/winhttp/request.c | 59 +++---------------------------- dlls/winhttp/tests/notification.c | 7 +--- dlls/winhttp/winhttp_private.h | 13 ------- 3 files changed, 6 insertions(+), 73 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 74278195fc3..84af8e58988 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -257,16 +257,6 @@ static BOOL cancel_queue( struct queue *queue ) return cancelled; } -static void task_send_callback( void *ctx, BOOL abort ) -{ - struct send_callback *s = ctx; - - if (abort) return; - - TRACE( "running %p\n", ctx ); - send_callback( s->task_hdr.obj, s->status, s->info, s->buflen ); -} - static void free_header( struct header *header ) { free( header->field ); @@ -3062,10 +3052,9 @@ static DWORD query_data_ready( struct request *request ) return count; } -static BOOL skip_async_queue( struct request *request, BOOL *data_available ) +static BOOL skip_async_queue( struct request *request ) { - *data_available = end_of_read_data( request ) || query_data_ready( request ); - return request->hdr.recursion_count < 3 && *data_available; + return request->hdr.recursion_count < 3 && (end_of_read_data( request ) || query_data_ready( request )); } static DWORD query_data_available( struct request *request, DWORD *available, BOOL async ) @@ -3117,7 +3106,6 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) DWORD ret; struct request *request; BOOL async; - BOOL data_available = FALSE; TRACE("%p, %p\n", hrequest, available); @@ -3133,44 +3121,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) return FALSE; } - if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &data_available )) - { - ret = query_data_available( request, available, async ); - } - else if (data_available) - { - /* Data available but recursion limit reached, only queue callback. */ - struct send_callback *s; - - if (!(s = malloc( sizeof(*s) ))) - { - release_object( &request->hdr ); - SetLastError( ERROR_OUTOFMEMORY ); - return FALSE; - } - - if (!(ret = query_data_available( request, &s->count, FALSE ))) - { - if (available) *available = s->count; - s->status = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; - s->info = &s->count; - s->buflen = sizeof(s->count); - } - else - { - s->result.dwResult = API_QUERY_DATA_AVAILABLE; - s->result.dwError = ret; - s->status = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; - s->info = &s->result; - s->buflen = sizeof(s->result); - } - - if ((ret = queue_task( &request->queue, task_send_callback, &s->task_hdr, &request->hdr ))) - free( s ); - else - ret = ERROR_IO_PENDING; - } - else + if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request )) { struct query_data *q; @@ -3188,6 +3139,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) else ret = ERROR_IO_PENDING; } + else ret = query_data_available( request, available, async ); release_object( &request->hdr ); SetLastError( ret ); @@ -3213,7 +3165,6 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW DWORD ret; struct request *request; BOOL async; - BOOL data_available; TRACE( "%p, %p, %lu, %p\n", hrequest, buffer, to_read, read ); @@ -3229,7 +3180,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request, &data_available )) + if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request )) { struct read_data *r; diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 40db323fb5e..78319f0df5c 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -1863,7 +1863,6 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex DWORD status, void *buffer, DWORD buflen ) { struct test_recursion_context *context = (struct test_recursion_context *)context_ptr; - static DWORD len; DWORD err; BOOL ret; BYTE b; @@ -1940,14 +1939,10 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex context->max_recursion_read = max( context->max_recursion_read, context->recursion_count ); context->read_from_callback = TRUE; InterlockedIncrement( &context->recursion_count ); - len = 0xdeadbeef; - /* Use static variable len here so write to it doesn't destroy the stack on old Windows which - * doesn't set the value at once. */ - ret = WinHttpQueryDataAvailable( context->request, &len ); + ret = WinHttpQueryDataAvailable( context->request, NULL ); err = GetLastError(); ok( ret, "failed to query data available, GetLastError() %lu\n", err ); ok( err == ERROR_SUCCESS || err == ERROR_IO_PENDING, "got %lu\n", err ); - ok( len != 0xdeadbeef || broken( len == 0xdeadbeef ) /* Win7 */, "got %lu.\n", len ); if (err == ERROR_SUCCESS) context->have_sync_callback = TRUE; InterlockedDecrement( &context->recursion_count ); break; diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 80ce2614ca1..0bf1c5bc6b0 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -312,19 +312,6 @@ struct task_header volatile LONG completion_sent; }; -struct send_callback -{ - struct task_header task_hdr; - DWORD status; - void *info; - DWORD buflen; - union - { - WINHTTP_ASYNC_RESULT result; - DWORD count; - }; -}; - struct send_request { struct task_header task_hdr; From a7c59316d8f8e7795abf30591b85b485ecdda07c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 23 Jan 2024 16:34:49 -0600 Subject: [PATCH 1239/1506] winhttp: Always return result at once if available in WinHttpQueryDataAvailable(). (cherry picked from commit fd2534422ba66d66cc811c75d012b2b1060d1770) CW-Bug-Id: #23312 --- dlls/winhttp/request.c | 59 ++++++++++++++++++++++++++++--- dlls/winhttp/tests/notification.c | 11 +++++- dlls/winhttp/winhttp_private.h | 13 +++++++ 3 files changed, 77 insertions(+), 6 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 84af8e58988..59431e3a9f2 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -257,6 +257,16 @@ static BOOL cancel_queue( struct queue *queue ) return cancelled; } +static void task_send_callback( void *ctx, BOOL abort ) +{ + struct send_callback *s = ctx; + + if (abort) return; + + TRACE( "running %p\n", ctx ); + send_callback( s->task_hdr.obj, s->status, s->info, s->buflen ); +} + static void free_header( struct header *header ) { free( header->field ); @@ -3052,9 +3062,10 @@ static DWORD query_data_ready( struct request *request ) return count; } -static BOOL skip_async_queue( struct request *request ) +static BOOL skip_async_queue( struct request *request, BOOL *wont_block ) { - return request->hdr.recursion_count < 3 && (end_of_read_data( request ) || query_data_ready( request )); + *wont_block = end_of_read_data( request ) || query_data_ready( request ); + return request->hdr.recursion_count < 3 && *wont_block; } static DWORD query_data_available( struct request *request, DWORD *available, BOOL async ) @@ -3106,6 +3117,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) DWORD ret; struct request *request; BOOL async; + BOOL wont_block = FALSE; TRACE("%p, %p\n", hrequest, available); @@ -3121,7 +3133,44 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request )) + if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block )) + { + ret = query_data_available( request, available, async ); + } + else if (wont_block) + { + /* Data available but recursion limit reached, only queue callback. */ + struct send_callback *s; + + if (!(s = malloc( sizeof(*s) ))) + { + release_object( &request->hdr ); + SetLastError( ERROR_OUTOFMEMORY ); + return FALSE; + } + + if (!(ret = query_data_available( request, &s->count, FALSE ))) + { + if (available) *available = s->count; + s->status = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; + s->info = &s->count; + s->buflen = sizeof(s->count); + } + else + { + s->result.dwResult = API_QUERY_DATA_AVAILABLE; + s->result.dwError = ret; + s->status = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; + s->info = &s->result; + s->buflen = sizeof(s->result); + } + + if ((ret = queue_task( &request->queue, task_send_callback, &s->task_hdr, &request->hdr ))) + free( s ); + else + ret = ERROR_IO_PENDING; + } + else { struct query_data *q; @@ -3139,7 +3188,6 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) else ret = ERROR_IO_PENDING; } - else ret = query_data_available( request, available, async ); release_object( &request->hdr ); SetLastError( ret ); @@ -3165,6 +3213,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW DWORD ret; struct request *request; BOOL async; + BOOL wont_block; TRACE( "%p, %p, %lu, %p\n", hrequest, buffer, to_read, read ); @@ -3180,7 +3229,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request )) + if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request, &wont_block )) { struct read_data *r; diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 78319f0df5c..98df1571464 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -1929,6 +1929,9 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex break; case WINHTTP_CALLBACK_STATUS_READ_COMPLETE: + { + static DWORD len; + if (!buflen) { SetEvent( context->wait ); @@ -1939,13 +1942,19 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex context->max_recursion_read = max( context->max_recursion_read, context->recursion_count ); context->read_from_callback = TRUE; InterlockedIncrement( &context->recursion_count ); - ret = WinHttpQueryDataAvailable( context->request, NULL ); + len = 0xdeadbeef; + /* Use static variable len here so write to it doesn't destroy the stack on old Windows which + * doesn't set the value at once. */ + ret = WinHttpQueryDataAvailable( context->request, &len ); err = GetLastError(); ok( ret, "failed to query data available, GetLastError() %lu\n", err ); ok( err == ERROR_SUCCESS || err == ERROR_IO_PENDING, "got %lu\n", err ); + ok( len != 0xdeadbeef || broken( len == 0xdeadbeef ) /* Win7 */, "got %lu.\n", len ); if (err == ERROR_SUCCESS) context->have_sync_callback = TRUE; InterlockedDecrement( &context->recursion_count ); break; + } + case WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE: if (!context->headers_available && context->call_receive_response_status == WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE) diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 0bf1c5bc6b0..80ce2614ca1 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -312,6 +312,19 @@ struct task_header volatile LONG completion_sent; }; +struct send_callback +{ + struct task_header task_hdr; + DWORD status; + void *info; + DWORD buflen; + union + { + WINHTTP_ASYNC_RESULT result; + DWORD count; + }; +}; + struct send_request { struct task_header task_hdr; From c53c9075b4e22d0f03144bad7b4b294c90c9b6cb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 23 Jan 2024 16:56:09 -0600 Subject: [PATCH 1240/1506] winhttp: Always return result at once if available in WinHttpReadData(). (cherry picked from commit bd2a2c25f54e33b5ffae1f28f5ead4b020f55456) CW-Bug-Id: #23312 --- dlls/winhttp/request.c | 42 ++++++++++++++++++++++++++++--- dlls/winhttp/tests/notification.c | 10 +++++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 59431e3a9f2..29b30fc2583 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3213,7 +3213,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW DWORD ret; struct request *request; BOOL async; - BOOL wont_block; + BOOL wont_block = FALSE; TRACE( "%p, %p, %lu, %p\n", hrequest, buffer, to_read, read ); @@ -3229,7 +3229,44 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if ((async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) && !skip_async_queue( request, &wont_block )) + if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block )) + { + ret = read_data( request, buffer, to_read, read, async ); + } + else if (wont_block) + { + /* Data available but recursion limit reached, only queue callback. */ + struct send_callback *s; + + if (!(s = malloc( sizeof(*s) ))) + { + release_object( &request->hdr ); + SetLastError( ERROR_OUTOFMEMORY ); + return FALSE; + } + + if (!(ret = read_data( request, buffer, to_read, &s->count, FALSE ))) + { + if (read) *read = s->count; + s->status = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; + s->info = buffer; + s->buflen = s->count; + } + else + { + s->result.dwResult = API_READ_DATA; + s->result.dwError = ret; + s->status = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; + s->info = &s->result; + s->buflen = sizeof(s->result); + } + + if ((ret = queue_task( &request->queue, task_send_callback, &s->task_hdr, &request->hdr ))) + free( s ); + else + ret = ERROR_IO_PENDING; + } + else { struct read_data *r; @@ -3248,7 +3285,6 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW else ret = ERROR_IO_PENDING; } - else ret = read_data( request, buffer, to_read, read, async ); release_object( &request->hdr ); SetLastError( ret ); diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 98df1571464..3e67c439bb5 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -1904,6 +1904,9 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex break; case WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE: + { + DWORD len; + if (!context->read_from_callback) { SetEvent( context->wait ); @@ -1920,13 +1923,18 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex "got %lu, thread %#lx\n", context->recursion_count, GetCurrentThreadId() ); context->max_recursion_query = max( context->max_recursion_query, context->recursion_count ); InterlockedIncrement( &context->recursion_count ); - ret = WinHttpReadData( context->request, &b, 1, NULL ); + b = 0xff; + len = 0xdeadbeef; + ret = WinHttpReadData( context->request, &b, 1, &len ); err = GetLastError(); ok( ret, "failed to read data, GetLastError() %lu\n", err ); ok( err == ERROR_SUCCESS || err == ERROR_IO_PENDING, "got %lu\n", err ); + ok( b != 0xff, "got %#x.\n", b ); + ok( len == 1, "got %lu.\n", len ); if (err == ERROR_SUCCESS) context->have_sync_callback = TRUE; InterlockedDecrement( &context->recursion_count ); break; + } case WINHTTP_CALLBACK_STATUS_READ_COMPLETE: { From 970f435f0158e7f7e91c71546ab03a3415f41ebd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 30 Jan 2024 11:55:31 -0600 Subject: [PATCH 1241/1506] winex11.drv: Default swap interval to 0 for child window drawables in create_gl_drawable(). CW-Bug-Id: #23329 --- dlls/winex11.drv/opengl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 43f87e11b1d..af404540fde 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1541,6 +1541,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel (visual->class == PseudoColor || visual->class == GrayScale || visual->class == DirectColor) ? AllocAll : AllocNone ); gl->window = create_client_window( hwnd, visual, gl->colormap ); + gl->swap_interval = 0; if (gl->window) { gl->drawable = pglXCreateWindow( gdi_display, gl->format->fbconfig, gl->window, NULL ); From 4bf230ae4cf44dd2130dfb621ae0e3e8ab4aa9b6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 22 Jan 2024 16:28:32 -0600 Subject: [PATCH 1242/1506] winex11.drv: Fix wglSwapBuffers() with NULL current context with child window rendering. (cherry picked from commit eb5993a7c6fbc1cd9deac0dceabc8f1c76e14ba8) CW-Bug-Id: #23302 --- dlls/opengl32/tests/opengl.c | 52 ++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/opengl.c | 10 +++---- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index e3ca82a9b03..74aff6b4bbd 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -2006,6 +2006,55 @@ static void test_copy_context(HDC hdc) ok(ret, "wglMakeCurrent failed, last error %#lx.\n", GetLastError()); } +static void test_child_window(HWND hwnd, PIXELFORMATDESCRIPTOR *pfd) +{ + int pixel_format; + DWORD t1, t; + HGLRC hglrc; + HWND child; + HDC hdc; + int res; + + child = CreateWindowA("static", "Title", WS_CHILDWINDOW | WS_VISIBLE, 50, 50, 100, 100, hwnd, NULL, NULL, NULL); + ok(!!child, "got error %lu.\n", GetLastError()); + + hdc = GetDC(child); + pixel_format = ChoosePixelFormat(hdc, pfd); + res = SetPixelFormat(hdc, pixel_format, pfd); + ok(res, "got error %lu.\n", GetLastError()); + + hglrc = wglCreateContext(hdc); + ok(!!hglrc, "got error %lu.\n", GetLastError()); + + /* Test SwapBuffers with NULL context. */ + + glDrawBuffer(GL_BACK); + + /* Currently blit happening for child window in winex11 may not be updated with the latest GL frame + * even on glXWaitForSbcOML() path. So simulate continuous present for the test purpose. */ + trace("Child window rectangle should turn from red to green now.\n"); + t1 = GetTickCount(); + while ((t = GetTickCount()) - t1 < 3000) + { + res = wglMakeCurrent(hdc, hglrc); + ok(res, "got error %lu.\n", GetLastError()); + if (t - t1 > 1500) + glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + else + glClearColor(1.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + res = wglMakeCurrent(NULL, NULL); + ok(res, "got error %lu.\n", GetLastError()); + SwapBuffers(hdc); + } + + res = wglDeleteContext(hglrc); + ok(res, "got error %lu.\n", GetLastError()); + + ReleaseDC(child, hdc); + DestroyWindow(child); +} + START_TEST(opengl) { HWND hwnd; @@ -2138,6 +2187,9 @@ START_TEST(opengl) else skip("WGL_EXT_swap_control not supported, skipping test\n"); + if (winetest_interactive) + test_child_window(hwnd, &pfd); + cleanup: ReleaseDC(hwnd, hdc); DestroyWindow(hwnd); diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index af404540fde..fde7a9672af 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -4894,7 +4894,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) case DC_GL_PIXMAP_WIN: if (ctx) sync_context( ctx ); if (!gl->layered_type) escape.drawable = gl->pixmap; - if (pglXCopySubBufferMESA) { + if (ctx && pglXCopySubBufferMESA) { /* (glX)SwapBuffers has an implicit glFlush effect, however * GLX_MESA_copy_sub_buffer doesn't. Make sure GL is flushed before * copying */ @@ -4903,7 +4903,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) gl->pixmap_size.cx, gl->pixmap_size.cy ); break; } - if (pglXSwapBuffersMscOML) + if (ctx && pglXSwapBuffersMscOML) { pglFlush(); target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); @@ -4929,7 +4929,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) ctx->fs_hack = FALSE; fs_hack_setup_context( ctx, gl ); } - if ((escape.drawable || gl->layered_type) && pglXSwapBuffersMscOML) + if (ctx && (escape.drawable || gl->layered_type) && pglXSwapBuffersMscOML) { pglFlush(); target_sbc = pglXSwapBuffersMscOML( gdi_display, gl->drawable, 0, 0, 0 ); @@ -4939,14 +4939,14 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) break; } - if ((escape.drawable || gl->layered_type) && pglXWaitForSbcOML) + if (ctx && (escape.drawable || gl->layered_type) && pglXWaitForSbcOML) pglXWaitForSbcOML( gdi_display, gl->drawable, target_sbc, &ust, &msc, &sbc ); update_window_surface( gl, hwnd ); release_gl_drawable( gl ); if (escape.drawable) - NtGdiExtEscape( ctx->hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); + NtGdiExtEscape( ctx ? ctx->hdc : hdc, NULL, 0, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); return TRUE; } From 7819be399ecd7fcaa379aee9c7678c13b923e927 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 14 Feb 2024 10:48:03 -0600 Subject: [PATCH 1243/1506] Revert "explorer: Don't pop start menu on "minimize all windows" systray command." This reverts commit 1cf7a85d1288f67b3e677f3b03533d46da1d2775. --- programs/explorer/systray.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 84ae37d8b36..61490f7a325 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -1059,15 +1059,7 @@ static LRESULT WINAPI shell_traywnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LP break; case WM_COMMAND: - if (HIWORD(wparam) == BN_CLICKED) - { - if (LOWORD(wparam) == 419) - { - FIXME( "Minimize all windows command is not supported.\n" ); - break; - } - click_taskbar_button( (HWND)lparam ); - } + if (HIWORD(wparam) == BN_CLICKED) click_taskbar_button( (HWND)lparam ); break; case WM_CONTEXTMENU: From b2832654aa9add01ab328170fafc79f6421a3d15 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Jan 2024 21:05:35 -0600 Subject: [PATCH 1244/1506] explorer: Don't pop start menu on "minimize all windows" systray command. (cherry picked from commit d66fe6206d950eeeabfcf408ae4d199a558150f3) CW-Bug-Id: #23178 --- dlls/user32/tests/win.c | 29 ++++++++++++++++++++++++++++- programs/explorer/systray.c | 12 +++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 2fd31be3314..44ea1c04e61 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -1796,7 +1796,7 @@ static void test_shell_window(void) WaitForSingleObject(hthread, INFINITE); - DeleteObject(hthread); + CloseHandle(hthread); CloseDesktop(hdesk); } @@ -13030,6 +13030,32 @@ static void test_WM_NCCALCSIZE(void) DestroyWindow(hwnd); } +#define TRAY_MINIMIZE_ALL 419 + +static void test_shell_tray(void) +{ + HWND hwnd, traywnd; + + if (!(traywnd = FindWindowA( "Shell_TrayWnd", NULL ))) + { + skip( "Shell_TrayWnd not found, skipping tests.\n" ); + return; + } + + hwnd = CreateWindowW( L"static", L"parent", WS_OVERLAPPEDWINDOW|WS_VISIBLE, + 100, 100, 200, 200, 0, 0, 0, NULL ); + ok( !!hwnd, "failed, error %lu.\n", GetLastError() ); + flush_events( TRUE ); + + ok( !IsIconic( hwnd ), "window is minimized.\n" ); + + SendMessageA( traywnd, WM_COMMAND, TRAY_MINIMIZE_ALL, 0xdeadbeef ); + flush_events( TRUE ); + todo_wine ok( IsIconic( hwnd ), "window is not minimized.\n" ); + + DestroyWindow(hwnd); +} + START_TEST(win) { char **argv; @@ -13226,4 +13252,5 @@ START_TEST(win) test_topmost(); test_shell_window(); + test_shell_tray(); } diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 61490f7a325..330dea710fc 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -33,6 +33,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(systray); +#define TRAY_MINIMIZE_ALL 419 + struct notify_data /* platform-independent format for NOTIFYICONDATA */ { LONG hWnd; @@ -1059,7 +1061,15 @@ static LRESULT WINAPI shell_traywnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LP break; case WM_COMMAND: - if (HIWORD(wparam) == BN_CLICKED) click_taskbar_button( (HWND)lparam ); + if (HIWORD(wparam) == BN_CLICKED) + { + if (LOWORD(wparam) == TRAY_MINIMIZE_ALL) + { + FIXME( "Shell command %u is not supported.\n", LOWORD(wparam) ); + break; + } + click_taskbar_button( (HWND)lparam ); + } break; case WM_CONTEXTMENU: From cf0afdcb7c455a5a883a9043a84611dcfa3c1334 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 6 Feb 2024 10:04:09 -0600 Subject: [PATCH 1245/1506] explorer: Don't pop start menu on "undo minimize all windows" systray command. (cherry picked from commit 5da459f1f2471365bc98078be1a3a1f84ef1a3dd) CW-Bug-Id: #23178 --- dlls/user32/tests/win.c | 5 +++++ programs/explorer/systray.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 44ea1c04e61..69c8d945951 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -13031,6 +13031,7 @@ static void test_WM_NCCALCSIZE(void) } #define TRAY_MINIMIZE_ALL 419 +#define TRAY_MINIMIZE_ALL_UNDO 416 static void test_shell_tray(void) { @@ -13053,6 +13054,10 @@ static void test_shell_tray(void) flush_events( TRUE ); todo_wine ok( IsIconic( hwnd ), "window is not minimized.\n" ); + SendMessageA( traywnd, WM_COMMAND, TRAY_MINIMIZE_ALL_UNDO, 0xdeadbeef ); + flush_events( TRUE ); + ok( !IsIconic( hwnd ), "window is minimized.\n" ); + DestroyWindow(hwnd); } diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 330dea710fc..54f1abbb30f 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(systray); #define TRAY_MINIMIZE_ALL 419 +#define TRAY_MINIMIZE_ALL_UNDO 416 struct notify_data /* platform-independent format for NOTIFYICONDATA */ { @@ -1063,7 +1064,7 @@ static LRESULT WINAPI shell_traywnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LP case WM_COMMAND: if (HIWORD(wparam) == BN_CLICKED) { - if (LOWORD(wparam) == TRAY_MINIMIZE_ALL) + if (LOWORD(wparam) == TRAY_MINIMIZE_ALL || LOWORD(wparam) == TRAY_MINIMIZE_ALL_UNDO) { FIXME( "Shell command %u is not supported.\n", LOWORD(wparam) ); break; From 98ba5ebe8c4afbba9dd23a196580b7feb10fd67a Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 2 Feb 2024 17:55:27 +0000 Subject: [PATCH 1246/1506] mscoree: Update Wine Mono to 9.0.0. (cherry picked from commit e891073c9eacc391cfa1bdb65e734922742c2c17) --- dlls/appwiz.cpl/addons.c | 4 ++-- dlls/mscoree/mscoree_private.h | 2 +- tools/gitlab/test.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c index a2957c3040a..12d32a46216 100644 --- a/dlls/appwiz.cpl/addons.c +++ b/dlls/appwiz.cpl/addons.c @@ -56,10 +56,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(appwizcpl); #define GECKO_SHA "???" #endif -#define MONO_VERSION "8.1.0" +#define MONO_VERSION "9.0.0" #if defined(__i386__) || defined(__x86_64__) #define MONO_ARCH "x86" -#define MONO_SHA "0ed3ec533aef79b2f312155931cf7b1080009ac0c5b4c2bcfeb678ac948e0810" +#define MONO_SHA "79f6c43100675566c112f4199b9ea7b944d338164b34bd91fa11b0b0a414e1c4" #else #define MONO_ARCH "" #define MONO_SHA "???" diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index 06db53136e1..f27ff95be2d 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -45,7 +45,7 @@ extern HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version); extern HRESULT assembly_get_vtable_fixups(ASSEMBLY *assembly, VTableFixup **fixups, DWORD *count); extern HRESULT assembly_get_native_entrypoint(ASSEMBLY *assembly, NativeEntryPointFunc *func); -#define WINE_MONO_VERSION "8.1.0" +#define WINE_MONO_VERSION "9.0.0" /* Mono embedding */ typedef struct _MonoDomain MonoDomain; diff --git a/tools/gitlab/test.yml b/tools/gitlab/test.yml index 92c14d83996..aaad7b31c36 100644 --- a/tools/gitlab/test.yml +++ b/tools/gitlab/test.yml @@ -7,7 +7,7 @@ variables: GIT_STRATEGY: none GECKO_VER: 2.47.4 - MONO_VER: 8.1.0 + MONO_VER: 9.0.0 cache: - key: wine-gecko-$GECKO_VER paths: From 2455a0d61e9463028edd951a31459a6dba3a806e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 13 Feb 2023 15:05:53 +0100 Subject: [PATCH 1247/1506] windows.media.speech: Add Vosk checks to autoconf. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- configure.ac | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3decacab398..e8338e9eb50 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug an AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwind library (exception handling)])) AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb library])) AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)])) +AC_ARG_WITH(vosk, AS_HELP_STRING([--without-vosk],[do not use Vosk])) AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan])) AC_ARG_WITH(wayland, AS_HELP_STRING([--without-wayland],[do not build the Wayland driver])) AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), @@ -492,7 +493,8 @@ AC_CHECK_HEADERS(\ syscall.h \ utime.h \ valgrind/memcheck.h \ - valgrind/valgrind.h + valgrind/valgrind.h \ + vosk_api.h ) WINE_HEADER_MAJOR() AC_HEADER_STAT() @@ -1874,6 +1876,14 @@ then WINE_WARNING([No sound system was found. Windows applications will be silent.]) fi +dnl **** Check for Vosk **** +if test x$with_vosk != xno +then + WINE_CHECK_SONAME(vosk,vosk_recognizer_new) +fi +WINE_NOTICE_WITH(vosk,[test x$ac_cv_lib_soname_vosk = x], + [libvosk ${notice_platform}development files not found, speech recognition won't be supported.]) + dnl *** Check for Vulkan *** if test "x$with_vulkan" != "xno" then From 4a816ddd1621aa90a0a3de531b7f9d93458cb3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 13 Feb 2023 00:17:50 +0100 Subject: [PATCH 1248/1506] windows.media.speech: Add unixlib stub. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/Makefile.in | 2 + dlls/windows.media.speech/main.c | 26 ++++++ dlls/windows.media.speech/private.h | 4 + dlls/windows.media.speech/unixlib.c | 125 ++++++++++++++++++++++++++ dlls/windows.media.speech/unixlib.h | 39 ++++++++ 5 files changed, 196 insertions(+) create mode 100644 dlls/windows.media.speech/unixlib.c create mode 100644 dlls/windows.media.speech/unixlib.h diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 5be66d8367e..11a8ad2bba8 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -1,4 +1,5 @@ MODULE = windows.media.speech.dll +UNIXLIB = windows.media.speech.so IMPORTS = combase uuid SOURCES = \ @@ -9,4 +10,5 @@ SOURCES = \ main.c \ recognizer.c \ synthesizer.c \ + unixlib.c \ vector.c diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c index e772a791588..d53e1599eb8 100644 --- a/dlls/windows.media.speech/main.c +++ b/dlls/windows.media.speech/main.c @@ -20,10 +20,36 @@ #include "initguid.h" #include "private.h" +#include "unixlib.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(speech); +BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) +{ + NTSTATUS status; + + switch (reason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(instance); + + if ((status = __wine_init_unix_call())) + ERR("loading the unixlib failed with status %#lx.\n", status); + + if ((status = WINE_UNIX_CALL(unix_process_attach, NULL))) + WARN("initializing the unixlib failed with status %#lx.\n", status); + + break; + case DLL_PROCESS_DETACH: + WINE_UNIX_CALL(unix_process_detach, NULL); + break; + } + + return TRUE; +} + HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) { FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out); diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h index d03fe0e773e..4b6a8327d6e 100644 --- a/dlls/windows.media.speech/private.h +++ b/dlls/windows.media.speech/private.h @@ -22,6 +22,10 @@ #include +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "winerror.h" +#include "winternl.h" #define COBJMACROS #include "corerror.h" #include "windef.h" diff --git a/dlls/windows.media.speech/unixlib.c b/dlls/windows.media.speech/unixlib.c new file mode 100644 index 00000000000..6a9dac6f067 --- /dev/null +++ b/dlls/windows.media.speech/unixlib.c @@ -0,0 +1,125 @@ +/* + * Unixlib for Windows.Media.Speech + * + * Copyright 2023 Bernhard Kölbl for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include +#include +#include +#include +#include + +#ifdef SONAME_LIBVOSK +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#include +#pragma GCC diagnostic pop +#endif + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "winerror.h" +#include "winternl.h" + +#include "wine/debug.h" + +#include "unixlib.h" + +WINE_DEFAULT_DEBUG_CHANNEL(speech); +#ifdef SONAME_LIBVOSK +WINE_DECLARE_DEBUG_CHANNEL(winediag); + +static void *vosk_handle; +#define MAKE_FUNCPTR( f ) static typeof(f) * p_##f +MAKE_FUNCPTR(vosk_model_new); +MAKE_FUNCPTR(vosk_model_free); +MAKE_FUNCPTR(vosk_recognizer_new); +MAKE_FUNCPTR(vosk_recognizer_free); +#undef MAKE_FUNCPTR + +static NTSTATUS process_attach( void *args ) +{ + if (!(vosk_handle = dlopen(SONAME_LIBVOSK, RTLD_NOW))) + { + ERR_(winediag)("Wine is unable to load the Unix side dependencies for speech recognition. " + "Make sure Vosk is installed and up to date on your system and try again.\n"); + return STATUS_DLL_NOT_FOUND; + } + +#define LOAD_FUNCPTR( f ) \ + if (!(p_##f = dlsym(vosk_handle, #f))) \ + { \ + ERR("failed to load %s\n", #f); \ + goto error; \ + } + LOAD_FUNCPTR(vosk_model_new) + LOAD_FUNCPTR(vosk_model_free) + LOAD_FUNCPTR(vosk_recognizer_new) + LOAD_FUNCPTR(vosk_recognizer_free) +#undef LOAD_FUNCPTR + + return STATUS_SUCCESS; + +error: + dlclose(vosk_handle); + vosk_handle = NULL; + return STATUS_DLL_NOT_FOUND; +} + +static NTSTATUS process_detach( void *args ) +{ + if (vosk_handle) + { + dlclose(vosk_handle); + vosk_handle = NULL; + } + return STATUS_SUCCESS; +} + +#else /* SONAME_LIBVOSK */ + +#define MAKE_UNSUPPORTED_FUNC( f ) \ + static NTSTATUS f( void *args ) \ + { \ + ERR("wine was compiled without Vosk support. Speech recognition won't work.\n"); \ + return STATUS_NOT_SUPPORTED; \ + } + +MAKE_UNSUPPORTED_FUNC(process_attach) +MAKE_UNSUPPORTED_FUNC(process_detach) +#undef MAKE_UNSUPPORTED_FUNC + +#endif /* SONAME_LIBVOSK */ + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + process_attach, + process_detach, +}; + +const unixlib_entry_t __wine_unix_call_wow64_funcs[] = +{ + process_attach, + process_detach, +}; diff --git a/dlls/windows.media.speech/unixlib.h b/dlls/windows.media.speech/unixlib.h new file mode 100644 index 00000000000..6c337e54511 --- /dev/null +++ b/dlls/windows.media.speech/unixlib.h @@ -0,0 +1,39 @@ +/* + * Unix library interface for Windows.Media.Speech + * + * Copyright 2023 Bernhard Kölbl for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WINDOWS_MEDIA_SPEECH_UNIXLIB_H +#define __WINE_WINDOWS_MEDIA_SPEECH_UNIXLIB_H + +#include +#include + +#include "windef.h" +#include "winternl.h" +#include "wtypes.h" + +#include "wine/unixlib.h" + +enum unix_funcs +{ + unix_process_attach, + unix_process_detach, +}; + +#endif From 186309d1aec56e0084bd8100c2efb2a5b8102774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 6 Feb 2023 21:24:26 +0100 Subject: [PATCH 1249/1506] windows.media.speech/tests: Get rid of duplicated hresult. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/tests/speech.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index ade056a0a39..9be4fa462df 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -42,7 +42,6 @@ #define AsyncStatus_Closed 4 #define SPERR_WINRT_INTERNAL_ERROR 0x800455a0 -#define SPERR_WINRT_INCORRECT_FORMAT 0x80131537 #define IHandler_RecognitionResult ITypedEventHandler_SpeechContinuousRecognitionSession_SpeechContinuousRecognitionResultGeneratedEventArgs #define IHandler_RecognitionResultVtbl ITypedEventHandler_SpeechContinuousRecognitionSession_SpeechContinuousRecognitionResultGeneratedEventArgsVtbl @@ -1082,7 +1081,7 @@ static void test_SpeechSynthesizer(void) operation_ss_stream = (void *)0xdeadbeef; hr = ISpeechSynthesizer_SynthesizeSsmlToStreamAsync(synthesizer, str, &operation_ss_stream); /* Broken on Win 8 + 8.1 */ - ok(hr == S_OK || broken(hr == SPERR_WINRT_INCORRECT_FORMAT), "ISpeechSynthesizer_SynthesizeSsmlToStreamAsync failed, hr %#lx\n", hr); + ok(hr == S_OK || broken(hr == COR_E_FORMAT), "ISpeechSynthesizer_SynthesizeSsmlToStreamAsync failed, hr %#lx\n", hr); if (hr == S_OK) { From 3d1efbbddce37a2ae017e9792bc599522aa0d366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 20 Feb 2023 23:10:16 +0100 Subject: [PATCH 1250/1506] windows.media.speech/tests: Allow the SpeechRecognizer creation to fail in Wine. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To allow for error handling of missing Unix-side dependencies. Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/tests/speech.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 9be4fa462df..743955ab9bd 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -1307,7 +1307,7 @@ static void test_SpeechRecognizer(void) ok(ref == 1, "Got unexpected ref %lu.\n", ref); hr = RoActivateInstance(hstr, &inspectable); - ok(hr == S_OK || broken(hr == SPERR_WINRT_INTERNAL_ERROR), "Got unexpected hr %#lx.\n", hr); + ok(hr == S_OK || hr == SPERR_WINRT_INTERNAL_ERROR, "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) { @@ -1526,7 +1526,7 @@ static void test_SpeechRecognizer(void) } else if (hr == SPERR_WINRT_INTERNAL_ERROR) /* Not sure when this triggers. Probably if a language pack is not installed. */ { - win_skip("Could not init SpeechRecognizer with default language!\n"); + skip("Could not init SpeechRecognizer with default language!\n"); } done: @@ -1743,12 +1743,12 @@ static void test_Recognition(void) ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); hr = RoActivateInstance(hstr, &inspectable); - ok(hr == S_OK || broken(hr == SPERR_WINRT_INTERNAL_ERROR || hr == REGDB_E_CLASSNOTREG), "Got unexpected hr %#lx.\n", hr); + ok(hr == S_OK || hr == SPERR_WINRT_INTERNAL_ERROR || broken(hr == REGDB_E_CLASSNOTREG), "Got unexpected hr %#lx.\n", hr); WindowsDeleteString(hstr); - if (FAILED(hr)) /* Win 8 and 8.1 and Win10 without enabled SR. */ + if (FAILED(hr)) /* Win 8 and 8.1 and Win10 without enabled SR. Wine with missing Unix side dependencies. */ { - win_skip("SpeechRecognizer cannot be activated!\n"); + skip("SpeechRecognizer cannot be activated!\n"); goto done; } From 1076aa8746ceb20227c30f8234b62488fe726ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 20 Feb 2023 23:11:02 +0100 Subject: [PATCH 1251/1506] windows.media.speech: Implement Vosk create and release functions in the unixlib. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/Makefile.in | 2 +- dlls/windows.media.speech/private.h | 3 + dlls/windows.media.speech/recognizer.c | 42 ++++++ dlls/windows.media.speech/unixlib.c | 169 ++++++++++++++++++++++++- dlls/windows.media.speech/unixlib.h | 16 +++ 5 files changed, 230 insertions(+), 2 deletions(-) diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 11a8ad2bba8..ea1e4272139 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -1,6 +1,6 @@ MODULE = windows.media.speech.dll UNIXLIB = windows.media.speech.so -IMPORTS = combase uuid +IMPORTS = combase uuid user32 SOURCES = \ async.c \ diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h index 4b6a8327d6e..60d09c9f7d1 100644 --- a/dlls/windows.media.speech/private.h +++ b/dlls/windows.media.speech/private.h @@ -31,6 +31,7 @@ #include "windef.h" #include "winbase.h" #include "winstring.h" +#include "winuser.h" #include "objbase.h" #include "activation.h" @@ -47,6 +48,8 @@ #include "wine/list.h" +#define SPERR_WINRT_INTERNAL_ERROR 0x800455a0 + /* * * Windows.Media.SpeechRecognition diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index 790d127fc64..7f45605d23a 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -25,6 +25,9 @@ #include "wine/debug.h" +#include "unixlib.h" +#include "wine/unixlib.h" + WINE_DEFAULT_DEBUG_CHANNEL(speech); /* @@ -171,6 +174,8 @@ struct session IAudioCaptureClient *capture_client; WAVEFORMATEX capture_wfx; + speech_recognizer_handle unix_handle; + HANDLE worker_thread, worker_control_event, audio_buf_event; BOOLEAN worker_running, worker_paused; CRITICAL_SECTION cs; @@ -319,7 +324,9 @@ static ULONG WINAPI session_AddRef( ISpeechContinuousRecognitionSession *iface ) static ULONG WINAPI session_Release( ISpeechContinuousRecognitionSession *iface ) { struct session *impl = impl_from_ISpeechContinuousRecognitionSession(iface); + struct speech_release_recognizer_params release_params; ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); if (!ref) @@ -345,6 +352,9 @@ static ULONG WINAPI session_Release( ISpeechContinuousRecognitionSession *iface impl->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&impl->cs); + release_params.handle = impl->unix_handle; + WINE_UNIX_CALL(unix_speech_release_recognizer, &release_params); + IVector_ISpeechRecognitionConstraint_Release(impl->constraints); free(impl); } @@ -1080,6 +1090,35 @@ static HRESULT recognizer_factory_create_audio_capture(struct session *session) return hr; } +static HRESULT recognizer_factory_create_unix_instance( struct session *session ) +{ + struct speech_create_recognizer_params create_params = { 0 }; + WCHAR locale[LOCALE_NAME_MAX_LENGTH]; + NTSTATUS status; + INT len; + + if (!(len = GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH))) + return E_FAIL; + + if (CharLowerBuffW(locale, len) != len) + return E_FAIL; + + if (!WideCharToMultiByte(CP_ACP, 0, locale, len, create_params.locale, ARRAY_SIZE(create_params.locale), NULL, NULL)) + return HRESULT_FROM_WIN32(GetLastError()); + + create_params.sample_rate = (FLOAT)session->capture_wfx.nSamplesPerSec; + + if ((status = WINE_UNIX_CALL(unix_speech_create_recognizer, &create_params))) + { + ERR("Unable to create Vosk instance for locale %s, status %#lx. Speech recognition won't work.\n", debugstr_a(create_params.locale), status); + return SPERR_WINRT_INTERNAL_ERROR; + } + + session->unix_handle = create_params.handle; + + return S_OK; +} + static HRESULT WINAPI recognizer_factory_Create( ISpeechRecognizerFactory *iface, ILanguage *language, ISpeechRecognizer **speechrecognizer ) { struct recognizer *impl; @@ -1126,6 +1165,9 @@ static HRESULT WINAPI recognizer_factory_Create( ISpeechRecognizerFactory *iface if (FAILED(hr = recognizer_factory_create_audio_capture(session))) goto error; + if (FAILED(hr = recognizer_factory_create_unix_instance(session))) + goto error; + InitializeCriticalSection(&session->cs); session->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": recognition_session.cs"); diff --git a/dlls/windows.media.speech/unixlib.c b/dlls/windows.media.speech/unixlib.c index 6a9dac6f067..155780a3e4b 100644 --- a/dlls/windows.media.speech/unixlib.c +++ b/dlls/windows.media.speech/unixlib.c @@ -26,9 +26,12 @@ #include #include -#include #include +#include +#include #include +#include +#include #ifdef SONAME_LIBVOSK #pragma GCC diagnostic push @@ -97,6 +100,164 @@ static NTSTATUS process_detach( void *args ) return STATUS_SUCCESS; } +static inline speech_recognizer_handle vosk_recognizer_to_handle( VoskRecognizer *recognizer ) +{ + return (speech_recognizer_handle)(UINT_PTR)recognizer; +} + +static inline VoskRecognizer *vosk_recognizer_from_handle( speech_recognizer_handle handle ) +{ + return (VoskRecognizer *)(UINT_PTR)handle; +} + +static NTSTATUS find_model_by_locale_and_path( const char *path, const char *locale, VoskModel **model ) +{ + static const char *vosk_model_identifier_small = "vosk-model-small-"; + static const char *vosk_model_identifier = "vosk-model-"; + size_t ident_small_len = strlen(vosk_model_identifier_small); + size_t ident_len = strlen(vosk_model_identifier); + char *ent_name, *model_path, *best_match, *delim; + NTSTATUS status = STATUS_UNSUCCESSFUL; + struct dirent *dirent; + size_t path_len, len; + DIR *dir; + + TRACE("path %s, locale %s, model %p.\n", path, debugstr_a(locale), model); + + if (!path || !locale || (len = strlen(locale)) < 4) + return STATUS_UNSUCCESSFUL; + + if (!(dir = opendir(path))) + return STATUS_UNSUCCESSFUL; + + delim = strchr(locale, '-'); + path_len = strlen(path); + best_match = NULL; + *model = NULL; + + while ((dirent = readdir(dir))) + { + ent_name = dirent->d_name; + + if (!strncmp(ent_name, vosk_model_identifier_small, ident_small_len)) + ent_name += ident_small_len; + else if (!strncmp(ent_name, vosk_model_identifier, ident_len)) + ent_name += ident_len; + else + continue; + + /* + * Find the first matching model for lang and region (en-us). + * If there isn't any, pick the first one just matching lang (en). + */ + if (!strncmp(ent_name, locale, len)) + { + if (best_match) free(best_match); + best_match = strdup(dirent->d_name); + break; + } + + if (!best_match && !strncmp(ent_name, locale, delim - locale)) + best_match = strdup(dirent->d_name); + } + + closedir(dir); + + if (!best_match) + return STATUS_UNSUCCESSFUL; + + if (!(model_path = malloc(path_len + 1 /* '/' */ + strlen(best_match) + 1))) + { + status = STATUS_NO_MEMORY; + goto done; + } + + sprintf(model_path, "%s/%s", path, best_match); + + TRACE("trying to load Vosk model %s.\n", debugstr_a(model_path)); + + if ((*model = p_vosk_model_new(model_path)) != NULL) + status = STATUS_SUCCESS; + +done: + free(model_path); + free(best_match); + + return status; +} + +static NTSTATUS find_model_by_locale( const char *locale, VoskModel **model ) +{ + const char *suffix = NULL; + char *env, *path = NULL; + NTSTATUS status; + + TRACE("locale %s, model %p.\n", debugstr_a(locale), model); + + if (!model) + return STATUS_UNSUCCESSFUL; + + if (!find_model_by_locale_and_path(getenv("VOSK_MODEL_PATH"), locale, model)) + return STATUS_SUCCESS; + if (!find_model_by_locale_and_path("/usr/share/vosk", locale, model)) + return STATUS_SUCCESS; + + if ((env = getenv("XDG_CACHE_HOME"))) + suffix = "/vosk"; + else if ((env = getenv("HOME"))) + suffix = "/.cache/vosk"; + else + return STATUS_UNSUCCESSFUL; + + if (!(path = malloc(strlen(env) + strlen(suffix) + 1))) + return STATUS_NO_MEMORY; + + sprintf(path, "%s%s", env, suffix); + status = find_model_by_locale_and_path(path, locale, model); + free(path); + + return status; +} + +static NTSTATUS speech_create_recognizer( void *args ) +{ + struct speech_create_recognizer_params *params = args; + VoskRecognizer *recognizer = NULL; + VoskModel *model = NULL; + NTSTATUS status = STATUS_SUCCESS; + + TRACE("args %p.\n", args); + + if (!vosk_handle) + return STATUS_NOT_SUPPORTED; + + if ((status = find_model_by_locale(params->locale, &model))) + return status; + + if (!(recognizer = p_vosk_recognizer_new(model, params->sample_rate))) + status = STATUS_UNSUCCESSFUL; + + /* VoskModel is reference-counted. A VoskRecognizer keeps a reference to its model. */ + p_vosk_model_free(model); + + params->handle = vosk_recognizer_to_handle(recognizer); + return status; +} + +static NTSTATUS speech_release_recognizer( void *args ) +{ + struct speech_release_recognizer_params *params = args; + + TRACE("args %p.\n", args); + + if (!vosk_handle) + return STATUS_NOT_SUPPORTED; + + p_vosk_recognizer_free(vosk_recognizer_from_handle(params->handle)); + + return STATUS_SUCCESS; +} + #else /* SONAME_LIBVOSK */ #define MAKE_UNSUPPORTED_FUNC( f ) \ @@ -108,6 +269,8 @@ static NTSTATUS process_detach( void *args ) MAKE_UNSUPPORTED_FUNC(process_attach) MAKE_UNSUPPORTED_FUNC(process_detach) +MAKE_UNSUPPORTED_FUNC(speech_create_recognizer) +MAKE_UNSUPPORTED_FUNC(speech_release_recognizer) #undef MAKE_UNSUPPORTED_FUNC #endif /* SONAME_LIBVOSK */ @@ -116,10 +279,14 @@ const unixlib_entry_t __wine_unix_call_funcs[] = { process_attach, process_detach, + speech_create_recognizer, + speech_release_recognizer, }; const unixlib_entry_t __wine_unix_call_wow64_funcs[] = { process_attach, process_detach, + speech_create_recognizer, + speech_release_recognizer, }; diff --git a/dlls/windows.media.speech/unixlib.h b/dlls/windows.media.speech/unixlib.h index 6c337e54511..974e8d5f797 100644 --- a/dlls/windows.media.speech/unixlib.h +++ b/dlls/windows.media.speech/unixlib.h @@ -30,10 +30,26 @@ #include "wine/unixlib.h" +typedef UINT64 speech_recognizer_handle; + +struct speech_create_recognizer_params +{ + speech_recognizer_handle handle; + CHAR locale[LOCALE_NAME_MAX_LENGTH]; + FLOAT sample_rate; +}; + +struct speech_release_recognizer_params +{ + speech_recognizer_handle handle; +}; + enum unix_funcs { unix_process_attach, unix_process_detach, + unix_speech_create_recognizer, + unix_speech_release_recognizer, }; #endif From d6306d3d62260cb5ded246b74f710ef28b0e9f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 6 Mar 2023 23:51:31 +0100 Subject: [PATCH 1252/1506] windows.media.speech: Move unix side recognizer creation to recognizer_CompileConstraintsAsync(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 76 ++++++++++++++------------ 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index 7f45605d23a..77fb38455f7 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -735,17 +735,55 @@ static HRESULT WINAPI recognizer_get_UIOptions( ISpeechRecognizer *iface, ISpeec return E_NOTIMPL; } +static HRESULT recognizer_create_unix_instance( struct session *session ) +{ + struct speech_create_recognizer_params create_params = { 0 }; + WCHAR locale[LOCALE_NAME_MAX_LENGTH]; + NTSTATUS status; + INT len; + + if (!(len = GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH))) + return E_FAIL; + + if (CharLowerBuffW(locale, len) != len) + return E_FAIL; + + if (!WideCharToMultiByte(CP_ACP, 0, locale, len, create_params.locale, ARRAY_SIZE(create_params.locale), NULL, NULL)) + return HRESULT_FROM_WIN32(GetLastError()); + + create_params.sample_rate = (FLOAT)session->capture_wfx.nSamplesPerSec; + + if ((status = WINE_UNIX_CALL(unix_speech_create_recognizer, &create_params))) + { + ERR("Unable to create Vosk instance for locale %s, status %#lx. Speech recognition won't work.\n", debugstr_a(create_params.locale), status); + return SPERR_WINRT_INTERNAL_ERROR; + } + + session->unix_handle = create_params.handle; + + return S_OK; +} + static HRESULT recognizer_compile_constraints_async( IInspectable *invoker, IInspectable **result ) { - return compilation_result_create(SpeechRecognitionResultStatus_Success, (ISpeechRecognitionCompilationResult **) result); + struct recognizer *impl = impl_from_ISpeechRecognizer((ISpeechRecognizer *)invoker); + struct session *session = impl_from_ISpeechContinuousRecognitionSession(impl->session); + HRESULT hr; + + if (FAILED(hr = recognizer_create_unix_instance(session))) + { + WARN("Failed to created recognizer instance.\n"); + return compilation_result_create(SpeechRecognitionResultStatus_GrammarCompilationFailure, (ISpeechRecognitionCompilationResult **) result); + } + else return compilation_result_create(SpeechRecognitionResultStatus_Success, (ISpeechRecognitionCompilationResult **) result); } static HRESULT WINAPI recognizer_CompileConstraintsAsync( ISpeechRecognizer *iface, IAsyncOperation_SpeechRecognitionCompilationResult **operation ) { IAsyncOperation_IInspectable **value = (IAsyncOperation_IInspectable **)operation; - FIXME("iface %p, operation %p semi-stub!\n", iface, operation); - return async_operation_inspectable_create(&IID_IAsyncOperation_SpeechRecognitionCompilationResult, NULL, recognizer_compile_constraints_async, value); + TRACE("iface %p, operation %p semi-stub!\n", iface, operation); + return async_operation_inspectable_create(&IID_IAsyncOperation_SpeechRecognitionCompilationResult, (IInspectable *)iface, recognizer_compile_constraints_async, value); } static HRESULT WINAPI recognizer_RecognizeAsync( ISpeechRecognizer *iface, @@ -1090,35 +1128,6 @@ static HRESULT recognizer_factory_create_audio_capture(struct session *session) return hr; } -static HRESULT recognizer_factory_create_unix_instance( struct session *session ) -{ - struct speech_create_recognizer_params create_params = { 0 }; - WCHAR locale[LOCALE_NAME_MAX_LENGTH]; - NTSTATUS status; - INT len; - - if (!(len = GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH))) - return E_FAIL; - - if (CharLowerBuffW(locale, len) != len) - return E_FAIL; - - if (!WideCharToMultiByte(CP_ACP, 0, locale, len, create_params.locale, ARRAY_SIZE(create_params.locale), NULL, NULL)) - return HRESULT_FROM_WIN32(GetLastError()); - - create_params.sample_rate = (FLOAT)session->capture_wfx.nSamplesPerSec; - - if ((status = WINE_UNIX_CALL(unix_speech_create_recognizer, &create_params))) - { - ERR("Unable to create Vosk instance for locale %s, status %#lx. Speech recognition won't work.\n", debugstr_a(create_params.locale), status); - return SPERR_WINRT_INTERNAL_ERROR; - } - - session->unix_handle = create_params.handle; - - return S_OK; -} - static HRESULT WINAPI recognizer_factory_Create( ISpeechRecognizerFactory *iface, ILanguage *language, ISpeechRecognizer **speechrecognizer ) { struct recognizer *impl; @@ -1165,9 +1174,6 @@ static HRESULT WINAPI recognizer_factory_Create( ISpeechRecognizerFactory *iface if (FAILED(hr = recognizer_factory_create_audio_capture(session))) goto error; - if (FAILED(hr = recognizer_factory_create_unix_instance(session))) - goto error; - InitializeCriticalSection(&session->cs); session->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": recognition_session.cs"); From b500dc2aef3ef90f5f180988fa977e6a8b67d686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 27 Feb 2023 13:22:00 +0100 Subject: [PATCH 1253/1506] windows.media.speech: Implement recognition in the unixlib. CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 35 +++++++++++- dlls/windows.media.speech/unixlib.c | 79 ++++++++++++++++++++++++++ dlls/windows.media.speech/unixlib.h | 26 ++++++++- 3 files changed, 138 insertions(+), 2 deletions(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index 77fb38455f7..ea3b1b1859a 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -196,10 +196,13 @@ static DWORD CALLBACK session_worker_thread_cb( void *args ) { ISpeechContinuousRecognitionSession *iface = args; struct session *impl = impl_from_ISpeechContinuousRecognitionSession(iface); + struct speech_get_recognition_result_params recognition_result_params; + struct speech_recognize_audio_params recognize_audio_params; BOOLEAN running = TRUE, paused = FALSE; UINT32 frame_count, tmp_buf_size; BYTE *audio_buf, *tmp_buf = NULL; DWORD flags, status; + NTSTATUS nt_status; HANDLE events[2]; HRESULT hr; @@ -269,7 +272,37 @@ static DWORD CALLBACK session_worker_thread_cb( void *args ) IAudioCaptureClient_ReleaseBuffer(impl->capture_client, frames_available); } - /* TODO: Send mic data to recognizer and handle results. */ + recognize_audio_params.handle = impl->unix_handle; + recognize_audio_params.samples = tmp_buf; + recognize_audio_params.samples_size = tmp_buf_offset; + recognize_audio_params.status = RECOGNITION_STATUS_EXCEPTION; + + if (NT_ERROR(nt_status = WINE_UNIX_CALL(unix_speech_recognize_audio, &recognize_audio_params))) + WARN("unix_speech_recognize_audio failed with status %#lx.\n", nt_status); + + if (recognize_audio_params.status != RECOGNITION_STATUS_RESULT_AVAILABLE) + continue; + + recognition_result_params.handle = impl->unix_handle; + recognition_result_params.result_buf = NULL; + recognition_result_params.result_buf_size = 512; + + do + { + recognition_result_params.result_buf = realloc(recognition_result_params.result_buf, recognition_result_params.result_buf_size); + } + while (WINE_UNIX_CALL(unix_speech_get_recognition_result, &recognition_result_params) == STATUS_BUFFER_TOO_SMALL && + recognition_result_params.result_buf); + + if (!recognition_result_params.result_buf) + { + WARN("memory allocation failed.\n"); + break; + } + + /* TODO: Compare recognized text to available options. */ + + free(recognition_result_params.result_buf); } else { diff --git a/dlls/windows.media.speech/unixlib.c b/dlls/windows.media.speech/unixlib.c index 155780a3e4b..c41bb4cc445 100644 --- a/dlls/windows.media.speech/unixlib.c +++ b/dlls/windows.media.speech/unixlib.c @@ -59,6 +59,9 @@ MAKE_FUNCPTR(vosk_model_new); MAKE_FUNCPTR(vosk_model_free); MAKE_FUNCPTR(vosk_recognizer_new); MAKE_FUNCPTR(vosk_recognizer_free); +MAKE_FUNCPTR(vosk_recognizer_accept_waveform); +MAKE_FUNCPTR(vosk_recognizer_final_result); +MAKE_FUNCPTR(vosk_recognizer_reset); #undef MAKE_FUNCPTR static NTSTATUS process_attach( void *args ) @@ -80,6 +83,9 @@ static NTSTATUS process_attach( void *args ) LOAD_FUNCPTR(vosk_model_free) LOAD_FUNCPTR(vosk_recognizer_new) LOAD_FUNCPTR(vosk_recognizer_free) + LOAD_FUNCPTR(vosk_recognizer_accept_waveform) + LOAD_FUNCPTR(vosk_recognizer_final_result) + LOAD_FUNCPTR(vosk_recognizer_reset) #undef LOAD_FUNCPTR return STATUS_SUCCESS; @@ -258,6 +264,73 @@ static NTSTATUS speech_release_recognizer( void *args ) return STATUS_SUCCESS; } +static NTSTATUS speech_recognize_audio( void *args ) +{ + struct speech_recognize_audio_params *params = args; + VoskRecognizer *recognizer = vosk_recognizer_from_handle(params->handle); + + if (!vosk_handle) + return STATUS_NOT_SUPPORTED; + + if (!recognizer) + return STATUS_UNSUCCESSFUL; + + params->status = p_vosk_recognizer_accept_waveform(recognizer, (const char *)params->samples, params->samples_size); + + return STATUS_SUCCESS; +} + +static NTSTATUS speech_get_recognition_result( void* args ) +{ + struct speech_get_recognition_result_params *params = args; + VoskRecognizer *recognizer = vosk_recognizer_from_handle(params->handle); + static const char *result_json_start = "{\n \"text\" : \""; + const size_t json_start_len = strlen(result_json_start); + static size_t last_result_len = 0; + static char *last_result = NULL; + const char *tmp = NULL; + + TRACE("args %p.\n", args); + + if (!vosk_handle) + return STATUS_NOT_SUPPORTED; + + if (!recognizer) + return STATUS_UNSUCCESSFUL; + + if (!last_result) + { + if ((tmp = p_vosk_recognizer_final_result(recognizer))) + { + last_result = strdup(tmp); + tmp = last_result; + + /* Operations to remove the JSON wrapper "{\n \"text\" : \"some recognized text\"\n}" -> "some recognized text\0" */ + memmove(last_result, last_result + json_start_len, strlen(last_result) - json_start_len + 1); + last_result = strrchr(last_result, '\"'); + last_result[0] = '\0'; + + last_result = (char *)tmp; + last_result_len = strlen(last_result); + TRACE("last_result %s.\n", debugstr_a(last_result)); + } + else return STATUS_NOT_FOUND; + } + else if (params->result_buf_size >= last_result_len + 1) + { + memcpy(params->result_buf, last_result, last_result_len + 1); + p_vosk_recognizer_reset(recognizer); + + free (last_result); + last_result = NULL; + + return STATUS_SUCCESS; + } + + params->result_buf_size = last_result_len + 1; + return STATUS_BUFFER_TOO_SMALL; +} + #else /* SONAME_LIBVOSK */ #define MAKE_UNSUPPORTED_FUNC( f ) \ @@ -271,6 +344,8 @@ MAKE_UNSUPPORTED_FUNC(process_attach) MAKE_UNSUPPORTED_FUNC(process_detach) MAKE_UNSUPPORTED_FUNC(speech_create_recognizer) MAKE_UNSUPPORTED_FUNC(speech_release_recognizer) +MAKE_UNSUPPORTED_FUNC(speech_recognize_audio) +MAKE_UNSUPPORTED_FUNC(speech_get_recognition_result) #undef MAKE_UNSUPPORTED_FUNC #endif /* SONAME_LIBVOSK */ @@ -281,6 +356,8 @@ const unixlib_entry_t __wine_unix_call_funcs[] = process_detach, speech_create_recognizer, speech_release_recognizer, + speech_recognize_audio, + speech_get_recognition_result, }; const unixlib_entry_t __wine_unix_call_wow64_funcs[] = @@ -289,4 +366,6 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = process_detach, speech_create_recognizer, speech_release_recognizer, + speech_recognize_audio, + speech_get_recognition_result, }; diff --git a/dlls/windows.media.speech/unixlib.h b/dlls/windows.media.speech/unixlib.h index 974e8d5f797..a07d76705d5 100644 --- a/dlls/windows.media.speech/unixlib.h +++ b/dlls/windows.media.speech/unixlib.h @@ -44,12 +44,36 @@ struct speech_release_recognizer_params speech_recognizer_handle handle; }; -enum unix_funcs +enum speech_recognition_status +{ + RECOGNITION_STATUS_CONTINUING, + RECOGNITION_STATUS_RESULT_AVAILABLE, + RECOGNITION_STATUS_EXCEPTION, +}; + +struct speech_recognize_audio_params +{ + speech_recognizer_handle handle; + const BYTE *samples; + UINT32 samples_size; + enum speech_recognition_status status; +}; + +struct speech_get_recognition_result_params +{ + speech_recognizer_handle handle; + char *result_buf; + UINT32 result_buf_size; +}; + +enum vosk_funcs { unix_process_attach, unix_process_detach, unix_speech_create_recognizer, unix_speech_release_recognizer, + unix_speech_recognize_audio, + unix_speech_get_recognition_result, }; #endif From 615562d27331dc683983fe744b5c0fe03265ab85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Wed, 25 May 2022 14:14:18 +0200 Subject: [PATCH 1254/1506] windows.media.speech: Compare recognized words with available constraints. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 115 ++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index ea3b1b1859a..3d6d85336ef 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -192,18 +192,105 @@ static inline struct session *impl_from_ISpeechContinuousRecognitionSession( ISp return CONTAINING_RECORD(iface, struct session, ISpeechContinuousRecognitionSession_iface); } +static HRESULT session_find_constraint_by_string(struct session *session, WCHAR *str, HSTRING *hstr_out, ISpeechRecognitionConstraint **out) +{ + ISpeechRecognitionListConstraint *list_constraint; + IIterable_IInspectable *constraints_iterable; + IIterator_IInspectable *constraints_iterator; + ISpeechRecognitionConstraint *constraint; + IIterable_HSTRING *commands_iterable; + IIterator_HSTRING *commands_iterator; + BOOLEAN has_constraint, has_command; + IVector_HSTRING *commands; + const WCHAR *command_str; + HSTRING command; + HRESULT hr; + + TRACE("session %p, str %s, out %p.\n", session, debugstr_w(str), out); + + if (FAILED(hr = IVector_ISpeechRecognitionConstraint_QueryInterface(session->constraints, &IID_IIterable_ISpeechRecognitionConstraint, (void **)&constraints_iterable))) + return hr; + + if (FAILED(hr = IIterable_IInspectable_First(constraints_iterable, &constraints_iterator))) + { + IIterable_IInspectable_Release(constraints_iterable); + return hr; + } + + *out = NULL; + + for (hr = IIterator_IInspectable_get_HasCurrent(constraints_iterator, &has_constraint); SUCCEEDED(hr) && has_constraint && !(*out); hr = IIterator_IInspectable_MoveNext(constraints_iterator, &has_constraint)) + { + list_constraint = NULL; + commands_iterable = NULL; + commands_iterator = NULL; + commands = NULL; + + if (FAILED(IIterator_IInspectable_get_Current(constraints_iterator, (IInspectable **)&constraint))) + goto skip; + + if (FAILED(ISpeechRecognitionConstraint_QueryInterface(constraint, &IID_ISpeechRecognitionListConstraint, (void**)&list_constraint))) + goto skip; + + if (FAILED(ISpeechRecognitionListConstraint_get_Commands(list_constraint, &commands))) + goto skip; + + if (FAILED(IVector_HSTRING_QueryInterface(commands, &IID_IIterable_HSTRING, (void **)&commands_iterable))) + goto skip; + + if (FAILED(IIterable_HSTRING_First(commands_iterable, &commands_iterator))) + goto skip; + + for (hr = IIterator_HSTRING_get_HasCurrent(commands_iterator, &has_command); SUCCEEDED(hr) && has_command && !(*out); hr = IIterator_HSTRING_MoveNext(commands_iterator, &has_command)) + { + if (FAILED(IIterator_HSTRING_get_Current(commands_iterator, &command))) + continue; + + command_str = WindowsGetStringRawBuffer(command, NULL); + + TRACE("Comparing str %s to command_str %s.\n", debugstr_w(str), debugstr_w(command_str)); + + if (!wcsicmp(str, command_str)) + { + TRACE("constraint %p has str %s.\n", constraint, debugstr_w(str)); + ISpeechRecognitionConstraint_AddRef((*out = constraint)); + WindowsDuplicateString(command, hstr_out); + } + + WindowsDeleteString(command); + } + +skip: + if (commands_iterator) IIterator_HSTRING_Release(commands_iterator); + if (commands_iterable) IIterable_HSTRING_Release(commands_iterable); + if (commands) IVector_HSTRING_Release(commands); + + if (list_constraint) ISpeechRecognitionListConstraint_Release(list_constraint); + if (constraint) ISpeechRecognitionConstraint_Release(constraint); + } + + IIterator_IInspectable_Release(constraints_iterator); + IIterable_IInspectable_Release(constraints_iterable); + + hr = (*out) ? S_OK : COR_E_KEYNOTFOUND; + return hr; +} + static DWORD CALLBACK session_worker_thread_cb( void *args ) { ISpeechContinuousRecognitionSession *iface = args; struct session *impl = impl_from_ISpeechContinuousRecognitionSession(iface); struct speech_get_recognition_result_params recognition_result_params; struct speech_recognize_audio_params recognize_audio_params; + ISpeechRecognitionConstraint *constraint; BOOLEAN running = TRUE, paused = FALSE; UINT32 frame_count, tmp_buf_size; BYTE *audio_buf, *tmp_buf = NULL; + WCHAR *recognized_text; DWORD flags, status; NTSTATUS nt_status; HANDLE events[2]; + HSTRING hstring; HRESULT hr; SetThreadDescription(GetCurrentThread(), L"wine_speech_recognition_session_worker"); @@ -253,6 +340,7 @@ static DWORD CALLBACK session_worker_thread_cb( void *args ) { SIZE_T packet_size = 0, tmp_buf_offset = 0; UINT32 frames_available = 0; + INT recognized_text_len = 0; while (tmp_buf_offset < tmp_buf_size && IAudioCaptureClient_GetBuffer(impl->capture_client, &audio_buf, &frames_available, &flags, NULL, NULL) == S_OK) @@ -300,8 +388,33 @@ static DWORD CALLBACK session_worker_thread_cb( void *args ) break; } - /* TODO: Compare recognized text to available options. */ + /* Silence was recognized. */ + if (!strcmp(recognition_result_params.result_buf, "")) + { + free(recognition_result_params.result_buf); + continue; + } + + recognized_text_len = MultiByteToWideChar(CP_UTF8, 0, recognition_result_params.result_buf, -1, NULL, 0); + + if (!(recognized_text = malloc(recognized_text_len * sizeof(WCHAR)))) + { + free(recognition_result_params.result_buf); + WARN("memory allocation failed.\n"); + break; + } + + MultiByteToWideChar(CP_UTF8, 0, recognition_result_params.result_buf, -1, recognized_text, recognized_text_len); + + if (SUCCEEDED(hr = session_find_constraint_by_string(impl, recognized_text, &hstring, &constraint))) + { + /* TODO: Send event. */ + + WindowsDeleteString(hstring); + ISpeechRecognitionConstraint_Release(constraint); + } + free(recognized_text); free(recognition_result_params.result_buf); } else From 402a6ebd47b8d6a4d76a24cbc79de26a913afdb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 30 May 2022 18:36:51 +0200 Subject: [PATCH 1255/1506] windows.media.speech: Send event on recognition success. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 368 ++++++++++++++++++++++++- 1 file changed, 367 insertions(+), 1 deletion(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index 3d6d85336ef..7721764f351 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -30,6 +30,363 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); +struct recognition_result +{ + ISpeechRecognitionResult ISpeechRecognitionResult_iface; + ISpeechRecognitionResult2 ISpeechRecognitionResult2_iface; + LONG ref; + + ISpeechRecognitionConstraint *constraint; + HSTRING text; +}; + +static inline struct recognition_result *impl_from_ISpeechRecognitionResult( ISpeechRecognitionResult *iface ) +{ + return CONTAINING_RECORD(iface, struct recognition_result, ISpeechRecognitionResult_iface); +} + +static HRESULT WINAPI recognition_result_QueryInterface( ISpeechRecognitionResult *iface, REFIID iid, void **out ) +{ + struct recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_ISpeechRecognitionResult)) + { + IInspectable_AddRef((*out = &impl->ISpeechRecognitionResult_iface)); + return S_OK; + } + + if (IsEqualGUID(iid, &IID_ISpeechRecognitionResult2)) + { + IInspectable_AddRef((*out = &impl->ISpeechRecognitionResult2_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI recognition_result_AddRef( ISpeechRecognitionResult *iface ) +{ + struct recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI recognition_result_Release( ISpeechRecognitionResult *iface ) +{ + struct recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + + if(!ref) + { + ISpeechRecognitionConstraint_Release(impl->constraint); + WindowsDeleteString(impl->text); + free(impl); + } + + return ref; +} + +static HRESULT WINAPI recognition_result_GetIids( ISpeechRecognitionResult *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_GetRuntimeClassName( ISpeechRecognitionResult *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_GetTrustLevel( ISpeechRecognitionResult *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_get_Status( ISpeechRecognitionResult *iface, SpeechRecognitionResultStatus *value ) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + *value = SpeechRecognitionResultStatus_Success; + return S_OK; +} + +static HRESULT WINAPI recognition_result_get_Text( ISpeechRecognitionResult *iface, HSTRING *value ) +{ + struct recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + TRACE("iface %p, operation %p, text: %s.\n", iface, value, debugstr_hstring(impl->text)); + return WindowsDuplicateString(impl->text, value); +} + +static HRESULT WINAPI recognition_result_get_Confidence( ISpeechRecognitionResult *iface, SpeechRecognitionConfidence *value ) +{ + FIXME("iface %p, operation %p semi stub!\n", iface, value); + *value = SpeechRecognitionConfidence_High; + return S_OK; +} + +static HRESULT WINAPI recognition_result_get_SemanticInterpretation( ISpeechRecognitionResult *iface, + ISpeechRecognitionSemanticInterpretation **value ) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_GetAlternates( ISpeechRecognitionResult *iface, + UINT32 max_amount, + IVectorView_SpeechRecognitionResult **results ) +{ + IVector_IInspectable *vector; + struct vector_iids constraints_iids = + { + .iterable = &IID_IVectorView_SpeechRecognitionResult, + .iterator = &IID_IVectorView_SpeechRecognitionResult, + .vector = &IID_IVector_IInspectable, + .view = &IID_IVectorView_SpeechRecognitionResult, + }; + + FIXME("iface %p, max_amount %u, results %p stub!\n", iface, max_amount, results); + + vector_inspectable_create(&constraints_iids, (IVector_IInspectable **)&vector); + IVector_IInspectable_GetView(vector, (IVectorView_IInspectable **)results); + IVector_IInspectable_Release(vector); + return S_OK; +} + +static HRESULT WINAPI recognition_result_get_Constraint( ISpeechRecognitionResult *iface, ISpeechRecognitionConstraint **value ) +{ + struct recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + TRACE("iface %p, operation %p.\n", iface, value); + ISpeechRecognitionConstraint_AddRef((*value = impl->constraint)); + return S_OK; +} + +static HRESULT WINAPI recognition_result_get_RulePath( ISpeechRecognitionResult *iface, IVectorView_HSTRING **value ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_get_RawConfidence( ISpeechRecognitionResult *iface, DOUBLE *value ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionResultVtbl recognition_result_vtbl = +{ + /* IUnknown methods */ + recognition_result_QueryInterface, + recognition_result_AddRef, + recognition_result_Release, + /* IInspectable methods */ + recognition_result_GetIids, + recognition_result_GetRuntimeClassName, + recognition_result_GetTrustLevel, + /* ISpeechRecognitionResult methods */ + recognition_result_get_Status, + recognition_result_get_Text, + recognition_result_get_Confidence, + recognition_result_get_SemanticInterpretation, + recognition_result_GetAlternates, + recognition_result_get_Constraint, + recognition_result_get_RulePath, + recognition_result_get_RawConfidence +}; + +DEFINE_IINSPECTABLE(recognition_result2, ISpeechRecognitionResult2, struct recognition_result, ISpeechRecognitionResult_iface) + +static HRESULT WINAPI recognition_result2_get_PhraseStartTime( ISpeechRecognitionResult2 *iface, DateTime *value ) +{ + DateTime dt = { .UniversalTime = 0 }; + FIXME("iface %p, value %p stub!\n", iface, value); + *value = dt; + return S_OK; +} + + +static HRESULT WINAPI recognition_result2_get_PhraseDuration( ISpeechRecognitionResult2 *iface, TimeSpan *value ) +{ + TimeSpan ts = { .Duration = 50000000LL }; /* Use 5 seconds as stub value. */ + FIXME("iface %p, value %p stub!\n", iface, value); + *value = ts; + return S_OK; +} + +static const struct ISpeechRecognitionResult2Vtbl recognition_result2_vtbl = +{ + /* IUnknown methods */ + recognition_result2_QueryInterface, + recognition_result2_AddRef, + recognition_result2_Release, + /* IInspectable methods */ + recognition_result2_GetIids, + recognition_result2_GetRuntimeClassName, + recognition_result2_GetTrustLevel, + /* ISpeechRecognitionResult2 methods */ + recognition_result2_get_PhraseStartTime, + recognition_result2_get_PhraseDuration +}; + +static HRESULT WINAPI recognition_result_create( ISpeechRecognitionConstraint *constraint, + HSTRING result_text, + ISpeechRecognitionResult **out ) +{ + struct recognition_result *impl; + + TRACE("out %p.\n", out); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *out = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechRecognitionResult_iface.lpVtbl = &recognition_result_vtbl; + impl->ISpeechRecognitionResult2_iface.lpVtbl = &recognition_result2_vtbl; + impl->ref = 1; + + if (constraint) ISpeechRecognitionConstraint_AddRef((impl->constraint = constraint)); + WindowsDuplicateString(result_text, &impl->text); + + *out = &impl->ISpeechRecognitionResult_iface; + + TRACE("created %p.\n", *out); + + return S_OK; +} + +struct recognition_result_event_args +{ + ISpeechContinuousRecognitionResultGeneratedEventArgs ISpeechContinuousRecognitionResultGeneratedEventArgs_iface; + LONG ref; + + ISpeechRecognitionResult *result; +}; + +static inline struct recognition_result_event_args *impl_from_ISpeechContinuousRecognitionResultGeneratedEventArgs( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface ) +{ + return CONTAINING_RECORD(iface, struct recognition_result_event_args, ISpeechContinuousRecognitionResultGeneratedEventArgs_iface); +} + +static HRESULT WINAPI recognition_result_event_args_QueryInterface( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface, REFIID iid, void **out ) +{ + struct recognition_result_event_args *impl = impl_from_ISpeechContinuousRecognitionResultGeneratedEventArgs(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_ISpeechContinuousRecognitionResultGeneratedEventArgs)) + { + IInspectable_AddRef((*out = &impl->ISpeechContinuousRecognitionResultGeneratedEventArgs_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI recognition_result_event_args_AddRef( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface ) +{ + struct recognition_result_event_args *impl = impl_from_ISpeechContinuousRecognitionResultGeneratedEventArgs(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI recognition_result_event_args_Release( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface ) +{ + struct recognition_result_event_args *impl = impl_from_ISpeechContinuousRecognitionResultGeneratedEventArgs(iface); + + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + + if (!ref) + { + if (impl->result) ISpeechRecognitionResult_Release(impl->result); + free(impl); + } + + return ref; +} + +static HRESULT WINAPI recognition_result_event_args_GetIids( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_event_args_GetRuntimeClassName( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_event_args_GetTrustLevel( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT WINAPI recognition_result_event_args_get_Result( ISpeechContinuousRecognitionResultGeneratedEventArgs *iface, + ISpeechRecognitionResult **value ) +{ + struct recognition_result_event_args *impl = impl_from_ISpeechContinuousRecognitionResultGeneratedEventArgs(iface); + FIXME("iface %p value %p stub!\n", iface, value); + ISpeechRecognitionResult_AddRef((*value = impl->result)); + return S_OK; +} + +static const struct ISpeechContinuousRecognitionResultGeneratedEventArgsVtbl recognition_result_event_args_vtbl = +{ + /* IUnknown methods */ + recognition_result_event_args_QueryInterface, + recognition_result_event_args_AddRef, + recognition_result_event_args_Release, + /* IInspectable methods */ + recognition_result_event_args_GetIids, + recognition_result_event_args_GetRuntimeClassName, + recognition_result_event_args_GetTrustLevel, + /* ISpeechContinuousRecognitionResultGeneratedEventArgs methods */ + recognition_result_event_args_get_Result +}; + +static HRESULT WINAPI recognition_result_event_args_create( ISpeechRecognitionResult *result, + ISpeechContinuousRecognitionResultGeneratedEventArgs **out ) +{ + struct recognition_result_event_args *impl; + + TRACE("out %p.\n", out); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *out = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechContinuousRecognitionResultGeneratedEventArgs_iface.lpVtbl = &recognition_result_event_args_vtbl; + impl->ref = 1; + if (result) ISpeechRecognitionResult_AddRef((impl->result = result)); + + *out = &impl->ISpeechContinuousRecognitionResultGeneratedEventArgs_iface; + + TRACE("created %p.\n", *out); + return S_OK; +} + /* * * ISpeechRecognitionCompilationResult @@ -282,7 +639,9 @@ static DWORD CALLBACK session_worker_thread_cb( void *args ) struct session *impl = impl_from_ISpeechContinuousRecognitionSession(iface); struct speech_get_recognition_result_params recognition_result_params; struct speech_recognize_audio_params recognize_audio_params; + ISpeechContinuousRecognitionResultGeneratedEventArgs *event_args; ISpeechRecognitionConstraint *constraint; + ISpeechRecognitionResult *result; BOOLEAN running = TRUE, paused = FALSE; UINT32 frame_count, tmp_buf_size; BYTE *audio_buf, *tmp_buf = NULL; @@ -408,8 +767,15 @@ static DWORD CALLBACK session_worker_thread_cb( void *args ) if (SUCCEEDED(hr = session_find_constraint_by_string(impl, recognized_text, &hstring, &constraint))) { - /* TODO: Send event. */ + recognition_result_create(constraint, hstring, &result); + recognition_result_event_args_create(result, &event_args); + + typed_event_handlers_notify(&impl->result_handlers, + (IInspectable *)&impl->ISpeechContinuousRecognitionSession_iface, + (IInspectable *)event_args); + ISpeechContinuousRecognitionResultGeneratedEventArgs_Release(event_args); + ISpeechRecognitionResult_Release(result); WindowsDeleteString(hstring); ISpeechRecognitionConstraint_Release(constraint); } From 03cb57504cb46a2517276d6c464f59837a8a573f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 30 May 2022 18:37:41 +0200 Subject: [PATCH 1256/1506] windows.media.speech: Add ISpeechRecognitionSemanticInterpretation stub. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 112 ++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index 7721764f351..af66a783e78 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -30,6 +30,116 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); +struct semantic_interpretation +{ + ISpeechRecognitionSemanticInterpretation ISpeechRecognitionSemanticInterpretation_iface; + LONG ref; +}; + +static inline struct semantic_interpretation *impl_from_ISpeechRecognitionSemanticInterpretation( ISpeechRecognitionSemanticInterpretation *iface ) +{ + return CONTAINING_RECORD(iface, struct semantic_interpretation, ISpeechRecognitionSemanticInterpretation_iface); +} + +HRESULT WINAPI semantic_interpretation_QueryInterface( ISpeechRecognitionSemanticInterpretation *iface, REFIID iid, void **out ) +{ + struct semantic_interpretation *impl = impl_from_ISpeechRecognitionSemanticInterpretation(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_ISpeechRecognitionSemanticInterpretation)) + { + IInspectable_AddRef((*out = &impl->ISpeechRecognitionSemanticInterpretation_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +ULONG WINAPI semantic_interpretation_AddRef( ISpeechRecognitionSemanticInterpretation *iface ) +{ + struct semantic_interpretation *impl = impl_from_ISpeechRecognitionSemanticInterpretation(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +ULONG WINAPI semantic_interpretation_Release( ISpeechRecognitionSemanticInterpretation *iface ) +{ + struct semantic_interpretation *impl = impl_from_ISpeechRecognitionSemanticInterpretation(iface); + + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + + if(!ref) + free(impl); + + return ref; +} + +HRESULT WINAPI semantic_interpretation_GetIids( ISpeechRecognitionSemanticInterpretation *iface, ULONG *iid_count, IID **iids ) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +HRESULT WINAPI semantic_interpretation_GetRuntimeClassName( ISpeechRecognitionSemanticInterpretation *iface, HSTRING *class_name ) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +HRESULT WINAPI semantic_interpretation_GetTrustLevel( ISpeechRecognitionSemanticInterpretation *iface, TrustLevel *trust_level ) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +HRESULT WINAPI semantic_interpretation_get_Properties( ISpeechRecognitionSemanticInterpretation *iface, IMapView_HSTRING_IVectorView_HSTRING **value ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionSemanticInterpretationVtbl semantic_interpretation_vtbl = +{ + /* IUnknown methods */ + semantic_interpretation_QueryInterface, + semantic_interpretation_AddRef, + semantic_interpretation_Release, + /* IInspectable methods */ + semantic_interpretation_GetIids, + semantic_interpretation_GetRuntimeClassName, + semantic_interpretation_GetTrustLevel, + /* ISpeechRecognitionSemanticInterpretation methods */ + semantic_interpretation_get_Properties +}; + + +static HRESULT semantic_interpretation_create( ISpeechRecognitionSemanticInterpretation **out ) +{ + struct semantic_interpretation *impl; + + TRACE("out %p.\n", out); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *out = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechRecognitionSemanticInterpretation_iface.lpVtbl = &semantic_interpretation_vtbl; + impl->ref = 1; + + *out = &impl->ISpeechRecognitionSemanticInterpretation_iface; + TRACE("created %p\n", *out); + return S_OK; +} + struct recognition_result { ISpeechRecognitionResult ISpeechRecognitionResult_iface; @@ -139,7 +249,7 @@ static HRESULT WINAPI recognition_result_get_SemanticInterpretation( ISpeechReco ISpeechRecognitionSemanticInterpretation **value ) { FIXME("iface %p, operation %p stub!\n", iface, value); - return E_NOTIMPL; + return semantic_interpretation_create(value); } static HRESULT WINAPI recognition_result_GetAlternates( ISpeechRecognitionResult *iface, From fea0e6d4bfc37611a26eb97957e605f9f55d3d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 20 Feb 2024 09:40:32 +0100 Subject: [PATCH 1257/1506] HACK: windows.media.speech: Stub semantic_interpretation_get_Properties. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Kölbl CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 134 ++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 1 deletion(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index af66a783e78..b35fa692d2f 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -30,6 +30,138 @@ WINE_DEFAULT_DEBUG_CHANNEL(speech); +struct map_view_hstring_vector_view_hstring +{ + IMapView_HSTRING_IVectorView_HSTRING IMapView_HSTRING_IVectorView_HSTRING_iface; + LONG ref; +}; + +static inline struct map_view_hstring_vector_view_hstring *impl_from_IMapView_HSTRING_IVectorView_HSTRING( IMapView_HSTRING_IVectorView_HSTRING *iface ) +{ + return CONTAINING_RECORD(iface, struct map_view_hstring_vector_view_hstring, IMapView_HSTRING_IVectorView_HSTRING_iface); +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_QueryInterface( IMapView_HSTRING_IVectorView_HSTRING *iface, REFIID iid, void **out ) +{ + struct map_view_hstring_vector_view_hstring *impl = impl_from_IMapView_HSTRING_IVectorView_HSTRING(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IMapView_HSTRING_IVectorView_HSTRING)) + { + IInspectable_AddRef((*out = &impl->IMapView_HSTRING_IVectorView_HSTRING_iface)); + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +ULONG WINAPI map_view_hstring_vector_view_hstring_AddRef( IMapView_HSTRING_IVectorView_HSTRING *iface ) +{ + struct map_view_hstring_vector_view_hstring *impl = impl_from_IMapView_HSTRING_IVectorView_HSTRING(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +ULONG WINAPI map_view_hstring_vector_view_hstring_Release( IMapView_HSTRING_IVectorView_HSTRING *iface ) +{ + struct map_view_hstring_vector_view_hstring *impl = impl_from_IMapView_HSTRING_IVectorView_HSTRING(iface); + + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + + if(!ref) + free(impl); + + return ref; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_GetIids( IMapView_HSTRING_IVectorView_HSTRING *iface, ULONG *iidCount, IID **iids ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_GetRuntimeClassName( IMapView_HSTRING_IVectorView_HSTRING *iface, HSTRING *className ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_GetTrustLevel( IMapView_HSTRING_IVectorView_HSTRING *iface, TrustLevel *trustLevel ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_Lookup( IMapView_HSTRING_IVectorView_HSTRING *iface, HSTRING key, IVectorView_HSTRING **value ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_get_Size( IMapView_HSTRING_IVectorView_HSTRING *iface, unsigned int *size ) +{ + FIXME("iface %p stub!\n", iface); + *size = 0; + return S_OK; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_HasKey( IMapView_HSTRING_IVectorView_HSTRING *iface, HSTRING key, boolean *found ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +HRESULT WINAPI map_view_hstring_vector_view_hstring_Split( IMapView_HSTRING_IVectorView_HSTRING *iface, IMapView_HSTRING_IVectorView_HSTRING **first, IMapView_HSTRING_IVectorView_HSTRING **second ) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static const struct IMapView_HSTRING_IVectorView_HSTRINGVtbl map_view_hstring_vector_view_hstring_vtbl = +{ + /* IUnknown methods */ + map_view_hstring_vector_view_hstring_QueryInterface, + map_view_hstring_vector_view_hstring_AddRef, + map_view_hstring_vector_view_hstring_Release, + /* IInspectable methods */ + map_view_hstring_vector_view_hstring_GetIids, + map_view_hstring_vector_view_hstring_GetRuntimeClassName, + map_view_hstring_vector_view_hstring_GetTrustLevel, + /* IMapView* > methods */ + map_view_hstring_vector_view_hstring_Lookup, + map_view_hstring_vector_view_hstring_get_Size, + map_view_hstring_vector_view_hstring_HasKey, + map_view_hstring_vector_view_hstring_Split +}; + + +static HRESULT map_view_hstring_vector_view_hstring_create( IMapView_HSTRING_IVectorView_HSTRING **out ) +{ + struct map_view_hstring_vector_view_hstring *impl; + + TRACE("out %p.\n", out); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *out = NULL; + return E_OUTOFMEMORY; + } + + impl->IMapView_HSTRING_IVectorView_HSTRING_iface.lpVtbl = &map_view_hstring_vector_view_hstring_vtbl; + impl->ref = 1; + + *out = &impl->IMapView_HSTRING_IVectorView_HSTRING_iface; + TRACE("created %p\n", *out); + return S_OK; +} + struct semantic_interpretation { ISpeechRecognitionSemanticInterpretation ISpeechRecognitionSemanticInterpretation_iface; @@ -102,7 +234,7 @@ HRESULT WINAPI semantic_interpretation_GetTrustLevel( ISpeechRecognitionSemantic HRESULT WINAPI semantic_interpretation_get_Properties( ISpeechRecognitionSemanticInterpretation *iface, IMapView_HSTRING_IVectorView_HSTRING **value ) { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return map_view_hstring_vector_view_hstring_create(value); } static const struct ISpeechRecognitionSemanticInterpretationVtbl semantic_interpretation_vtbl = From 8d38a0bf8106f9e7c8558f883d037b335bbda906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Tue, 28 Feb 2023 16:11:36 +0100 Subject: [PATCH 1258/1506] WIP: windows.media.speech: Implement grammar. CW-Bug-Id: #20134 --- dlls/windows.media.speech/recognizer.c | 106 ++++++++++++++++++++++++- dlls/windows.media.speech/unixlib.c | 61 +++++++++++++- dlls/windows.media.speech/unixlib.h | 2 + 3 files changed, 164 insertions(+), 5 deletions(-) diff --git a/dlls/windows.media.speech/recognizer.c b/dlls/windows.media.speech/recognizer.c index b35fa692d2f..c898ea7723f 100644 --- a/dlls/windows.media.speech/recognizer.c +++ b/dlls/windows.media.speech/recognizer.c @@ -1489,7 +1489,7 @@ static HRESULT WINAPI recognizer_get_UIOptions( ISpeechRecognizer *iface, ISpeec return E_NOTIMPL; } -static HRESULT recognizer_create_unix_instance( struct session *session ) +static HRESULT recognizer_create_unix_instance( struct session *session, const char **grammar, UINT32 grammar_size ) { struct speech_create_recognizer_params create_params = { 0 }; WCHAR locale[LOCALE_NAME_MAX_LENGTH]; @@ -1506,6 +1506,8 @@ static HRESULT recognizer_create_unix_instance( struct session *session ) return HRESULT_FROM_WIN32(GetLastError()); create_params.sample_rate = (FLOAT)session->capture_wfx.nSamplesPerSec; + create_params.grammar = grammar; + create_params.grammar_size = grammar_size; if ((status = WINE_UNIX_CALL(unix_speech_create_recognizer, &create_params))) { @@ -1522,11 +1524,109 @@ static HRESULT recognizer_compile_constraints_async( IInspectable *invoker, IIns { struct recognizer *impl = impl_from_ISpeechRecognizer((ISpeechRecognizer *)invoker); struct session *session = impl_from_ISpeechContinuousRecognitionSession(impl->session); + struct speech_release_recognizer_params release_params; + ISpeechRecognitionListConstraint *list_constraint; + IIterable_IInspectable *constraints_iterable; + IIterator_IInspectable *constraints_iterator; + ISpeechRecognitionConstraint *constraint; + IIterable_HSTRING *commands_iterable; + IIterator_HSTRING *commands_iterator; + BOOLEAN has_constraint, has_command; + IVector_HSTRING *commands; + const WCHAR *command_str; + UINT32 grammar_size = 0, i = 0; + char **grammar = NULL; + HSTRING command; + UINT32 size = 0; HRESULT hr; - if (FAILED(hr = recognizer_create_unix_instance(session))) + if (FAILED(hr = IVector_ISpeechRecognitionConstraint_QueryInterface(session->constraints, &IID_IIterable_ISpeechRecognitionConstraint, (void **)&constraints_iterable))) + return hr; + + if (FAILED(hr = IIterable_IInspectable_First(constraints_iterable, &constraints_iterator))) + { + IIterable_IInspectable_Release(constraints_iterable); + return hr; + } + + for (hr = IIterator_IInspectable_get_HasCurrent(constraints_iterator, &has_constraint); SUCCEEDED(hr) && has_constraint; hr = IIterator_IInspectable_MoveNext(constraints_iterator, &has_constraint)) + { + list_constraint = NULL; + commands_iterable = NULL; + commands_iterator = NULL; + commands = NULL; + + if (FAILED(IIterator_IInspectable_get_Current(constraints_iterator, (IInspectable **)&constraint))) + goto skip; + + if (FAILED(ISpeechRecognitionConstraint_QueryInterface(constraint, &IID_ISpeechRecognitionListConstraint, (void**)&list_constraint))) + goto skip; + + if (FAILED(ISpeechRecognitionListConstraint_get_Commands(list_constraint, &commands))) + goto skip; + + if (FAILED(IVector_HSTRING_QueryInterface(commands, &IID_IIterable_HSTRING, (void **)&commands_iterable))) + goto skip; + + if (FAILED(IIterable_HSTRING_First(commands_iterable, &commands_iterator))) + goto skip; + + if (FAILED(IVector_HSTRING_get_Size(commands, &size))) + goto skip; + + grammar_size += size; + grammar = realloc(grammar, grammar_size * sizeof(char *)); + + for (hr = IIterator_HSTRING_get_HasCurrent(commands_iterator, &has_command); SUCCEEDED(hr) && has_command; hr = IIterator_HSTRING_MoveNext(commands_iterator, &has_command)) + { + if (FAILED(IIterator_HSTRING_get_Current(commands_iterator, &command))) + continue; + + command_str = WindowsGetStringRawBuffer(command, NULL); + + if (command_str) + { + WCHAR *wstr = wcsdup(command_str); + size_t len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, grammar[i], 0, NULL, NULL); + grammar[i] = malloc(len * sizeof(char)); + + CharLowerW(wstr); + WideCharToMultiByte(CP_UTF8, 0, wstr, -1, grammar[i], len, NULL, NULL); + free(wstr); + i++; + } + + WindowsDeleteString(command); + } + +skip: + if (commands_iterator) IIterator_HSTRING_Release(commands_iterator); + if (commands_iterable) IIterable_HSTRING_Release(commands_iterable); + if (commands) IVector_HSTRING_Release(commands); + + if (list_constraint) ISpeechRecognitionListConstraint_Release(list_constraint); + if (constraint) ISpeechRecognitionConstraint_Release(constraint); + } + + IIterator_IInspectable_Release(constraints_iterator); + IIterable_IInspectable_Release(constraints_iterable); + + if (session->unix_handle) + { + release_params.handle = session->unix_handle; + WINE_UNIX_CALL(unix_speech_release_recognizer, &release_params); + session->unix_handle = 0; + } + + hr = recognizer_create_unix_instance(session, (const char **)grammar, grammar_size); + + for(i = 0; i < grammar_size; ++i) + free(grammar[i]); + free(grammar); + + if (FAILED(hr)) { - WARN("Failed to created recognizer instance.\n"); + WARN("Failed to created recognizer instance with grammar.\n"); return compilation_result_create(SpeechRecognitionResultStatus_GrammarCompilationFailure, (ISpeechRecognitionCompilationResult **) result); } else return compilation_result_create(SpeechRecognitionResultStatus_Success, (ISpeechRecognitionCompilationResult **) result); diff --git a/dlls/windows.media.speech/unixlib.c b/dlls/windows.media.speech/unixlib.c index c41bb4cc445..d8f59b99b76 100644 --- a/dlls/windows.media.speech/unixlib.c +++ b/dlls/windows.media.speech/unixlib.c @@ -58,6 +58,7 @@ static void *vosk_handle; MAKE_FUNCPTR(vosk_model_new); MAKE_FUNCPTR(vosk_model_free); MAKE_FUNCPTR(vosk_recognizer_new); +MAKE_FUNCPTR(vosk_recognizer_new_grm); MAKE_FUNCPTR(vosk_recognizer_free); MAKE_FUNCPTR(vosk_recognizer_accept_waveform); MAKE_FUNCPTR(vosk_recognizer_final_result); @@ -80,6 +81,8 @@ static NTSTATUS process_attach( void *args ) goto error; \ } LOAD_FUNCPTR(vosk_model_new) + LOAD_FUNCPTR(vosk_recognizer_new) + LOAD_FUNCPTR(vosk_recognizer_new_grm) LOAD_FUNCPTR(vosk_model_free) LOAD_FUNCPTR(vosk_recognizer_new) LOAD_FUNCPTR(vosk_recognizer_free) @@ -225,12 +228,58 @@ static NTSTATUS find_model_by_locale( const char *locale, VoskModel **model ) return status; } +static NTSTATUS grammar_to_json_array(const char **grammar, UINT32 grammar_size, const char **array) +{ + size_t buf_size = strlen("[]") + 1, len; + char *buf; + UINT32 i; + + for (i = 0; i < grammar_size; ++i) + { + buf_size += strlen(grammar[i]) + 4; /* (4) - two double quotes, a comma and a space */ + } + + if (!(buf = malloc(buf_size))) + return STATUS_NO_MEMORY; + + *array = buf; + + *buf = '['; + buf++; + + for (i = 0; i < grammar_size; ++i) + { + *buf = '\"'; + buf++; + len = strlen(grammar[i]); + memcpy(buf, grammar[i], len); + buf += len; + *buf = '\"'; + buf++; + if (i < (grammar_size - 1)) + { + *buf = ','; + buf++; + *buf = ' '; + buf++; + } + } + + *buf = ']'; + buf++; + *buf = '\0'; + + TRACE("created json array %s.\n", debugstr_a(*array)); + return STATUS_SUCCESS; +} + static NTSTATUS speech_create_recognizer( void *args ) { struct speech_create_recognizer_params *params = args; VoskRecognizer *recognizer = NULL; VoskModel *model = NULL; NTSTATUS status = STATUS_SUCCESS; + const char *grammar_json; TRACE("args %p.\n", args); @@ -240,8 +289,16 @@ static NTSTATUS speech_create_recognizer( void *args ) if ((status = find_model_by_locale(params->locale, &model))) return status; - if (!(recognizer = p_vosk_recognizer_new(model, params->sample_rate))) - status = STATUS_UNSUCCESSFUL; + if (params->grammar && grammar_to_json_array(params->grammar, params->grammar_size, &grammar_json) == STATUS_SUCCESS) + { + if (!(recognizer = p_vosk_recognizer_new_grm(model, params->sample_rate, grammar_json))) + status = STATUS_UNSUCCESSFUL; + } + else + { + if (!(recognizer = p_vosk_recognizer_new(model, params->sample_rate))) + status = STATUS_UNSUCCESSFUL; + } /* VoskModel is reference-counted. A VoskRecognizer keeps a reference to its model. */ p_vosk_model_free(model); diff --git a/dlls/windows.media.speech/unixlib.h b/dlls/windows.media.speech/unixlib.h index a07d76705d5..ad2fab738b9 100644 --- a/dlls/windows.media.speech/unixlib.h +++ b/dlls/windows.media.speech/unixlib.h @@ -37,6 +37,8 @@ struct speech_create_recognizer_params speech_recognizer_handle handle; CHAR locale[LOCALE_NAME_MAX_LENGTH]; FLOAT sample_rate; + const char **grammar; + unsigned int grammar_size; }; struct speech_release_recognizer_params From 50754d3f3d30de5c61d551a5815e792ec7992218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Tue, 28 Feb 2023 22:06:23 +0100 Subject: [PATCH 1259/1506] HACK: windows.media.speech/tests: Add tests for manual recognition testing. Speak during the delay, to test the code. CW-Bug-Id: #20134 --- dlls/windows.media.speech/tests/speech.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 743955ab9bd..a6c7d56e1e1 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -202,7 +202,23 @@ HRESULT WINAPI recognition_result_handler_Invoke( IHandler_RecognitionResult *if ISpeechContinuousRecognitionSession *sender, ISpeechContinuousRecognitionResultGeneratedEventArgs *args ) { - trace("iface %p, sender %p, args %p.\n", iface, sender, args); + ISpeechRecognitionResult *result; + HSTRING hstring; + HRESULT hr; + + if (!args) return S_OK; + + hr = ISpeechContinuousRecognitionResultGeneratedEventArgs_get_Result(args, &result); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ISpeechRecognitionResult_get_Text(result, &hstring); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + trace("iface %p, sender %p, args %p, text %s.\n", iface, sender, args, debugstr_w(WindowsGetStringRawBuffer(hstring, NULL))); + + WindowsDeleteString(hstring); + ISpeechRecognitionResult_Release(result); + return S_OK; } @@ -1702,7 +1718,7 @@ static void test_Recognition(void) static const WCHAR *list_constraint_name = L"Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint"; static const WCHAR *recognizer_name = L"Windows.Media.SpeechRecognition.SpeechRecognizer"; static const WCHAR *speech_constraint_tag = L"test_message"; - static const WCHAR *speech_constraints[] = { L"This is a test.", L"Number 5!", L"What time is it?" }; + static const WCHAR *speech_constraints[] = { L"This is a test", L"Number 5", L"What time is it" }; ISpeechRecognitionListConstraintFactory *listconstraint_factory = NULL; IAsyncOperation_SpeechRecognitionCompilationResult *operation = NULL; IVector_ISpeechRecognitionConstraint *constraints = NULL; @@ -1865,6 +1881,8 @@ static void test_Recognition(void) ok(hr == S_OK, "ISpeechRecognizer2_get_State failed, hr %#lx.\n", hr); ok(recog_state == SpeechRecognizerState_Capturing || broken(recog_state == SpeechRecognizerState_Idle), "recog_state was %u.\n", recog_state); + + Sleep(10000); /* * TODO: Use a loopback device together with prerecorded audio files to test the recognizer's functionality. */ From 00f6b2f3746e6a9a08184a1af12ad31c5dbe46cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Tue, 7 Mar 2023 15:31:08 +0100 Subject: [PATCH 1260/1506] HACK: windows.media.speech: Load Vosk models from Phasmophobia. CW-Bug-Id: #20134 --- dlls/windows.media.speech/unixlib.c | 67 +++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/dlls/windows.media.speech/unixlib.c b/dlls/windows.media.speech/unixlib.c index d8f59b99b76..33f16e652e8 100644 --- a/dlls/windows.media.speech/unixlib.c +++ b/dlls/windows.media.speech/unixlib.c @@ -119,13 +119,55 @@ static inline VoskRecognizer *vosk_recognizer_from_handle( speech_recognizer_han return (VoskRecognizer *)(UINT_PTR)handle; } +static const char* map_lang_to_phasmophobia_dir(const char* lang, size_t len) +{ + if (!strncmp(lang, "ar", len)) + return "Arabic"; + if (!strncmp(lang, "ca", len)) + return "Catalan"; + if (!strncmp(lang, "zn", len)) + return "Chinese"; + if (!strncmp(lang, "cs", len)) + return "Czech"; + if (!strncmp(lang, "nl", len)) + return "Dutch"; + if (!strncmp(lang, "en", len)) + return "English"; + if (!strncmp(lang, "fr", len)) + return "French"; + if (!strncmp(lang, "de", len)) + return "German"; + if (!strncmp(lang, "de", len)) + return "German"; + if (!strncmp(lang, "el", len)) + return "Greek"; + if (!strncmp(lang, "it", len)) + return "Italian"; + if (!strncmp(lang, "ja", len)) + return "Japanese"; + if (!strncmp(lang, "pt", len)) + return "Portuguese"; + if (!strncmp(lang, "ru", len)) + return "Russian"; + if (!strncmp(lang, "es", len)) + return "Spanish"; + if (!strncmp(lang, "sw", len)) + return "Swedish"; + if (!strncmp(lang, "tr", len)) + return "Turkish"; + if (!strncmp(lang, "uk", len)) + return "Ukrainian"; + + return ""; +} + static NTSTATUS find_model_by_locale_and_path( const char *path, const char *locale, VoskModel **model ) { static const char *vosk_model_identifier_small = "vosk-model-small-"; static const char *vosk_model_identifier = "vosk-model-"; size_t ident_small_len = strlen(vosk_model_identifier_small); size_t ident_len = strlen(vosk_model_identifier); - char *ent_name, *model_path, *best_match, *delim; + char *ent_name, *model_path, *best_match, *delim, *appid = getenv("SteamAppId"), *str = NULL; NTSTATUS status = STATUS_UNSUCCESSFUL; struct dirent *dirent; size_t path_len, len; @@ -152,7 +194,7 @@ static NTSTATUS find_model_by_locale_and_path( const char *path, const char *loc ent_name += ident_small_len; else if (!strncmp(ent_name, vosk_model_identifier, ident_len)) ent_name += ident_len; - else + else if (strcmp(appid, "739630") != 0) continue; /* @@ -168,6 +210,12 @@ static NTSTATUS find_model_by_locale_and_path( const char *path, const char *loc if (!best_match && !strncmp(ent_name, locale, delim - locale)) best_match = strdup(dirent->d_name); + + if (!best_match && !strcmp(appid, "739630")) + { + if ((str = (char *)map_lang_to_phasmophobia_dir(locale, delim - locale))) + best_match = strdup(str); + } } closedir(dir); @@ -198,7 +246,7 @@ static NTSTATUS find_model_by_locale_and_path( const char *path, const char *loc static NTSTATUS find_model_by_locale( const char *locale, VoskModel **model ) { const char *suffix = NULL; - char *env, *path = NULL; + char *env, *path = NULL, *appid = getenv("SteamAppId"); NTSTATUS status; TRACE("locale %s, model %p.\n", debugstr_a(locale), model); @@ -225,6 +273,19 @@ static NTSTATUS find_model_by_locale( const char *locale, VoskModel **model ) status = find_model_by_locale_and_path(path, locale, model); free(path); + /* Hack to load Vosk models from Phasmophobia, so they don't need to be downloaded separately.*/ + if (status && appid && !strcmp(appid, "739630") && (env = getenv("PWD"))) + { + suffix = "/Phasmophobia_Data/StreamingAssets/LanguageModels"; + + if (!(path = malloc(strlen(env) + strlen(suffix) + 1))) + return STATUS_NO_MEMORY; + + sprintf(path, "%s%s", env, suffix); + status = find_model_by_locale_and_path(path, locale, model); + free(path); + } + return status; } From 93c632281640dc516bfee6092498c55f760df26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Tue, 7 Mar 2023 16:36:36 +0100 Subject: [PATCH 1261/1506] windows.media.speech: Suppress verbose Unixlib traces. CW-Bug-Id: #20134 --- dlls/windows.media.speech/unixlib.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlls/windows.media.speech/unixlib.c b/dlls/windows.media.speech/unixlib.c index 33f16e652e8..55e48a550ff 100644 --- a/dlls/windows.media.speech/unixlib.c +++ b/dlls/windows.media.speech/unixlib.c @@ -330,7 +330,6 @@ static NTSTATUS grammar_to_json_array(const char **grammar, UINT32 grammar_size, buf++; *buf = '\0'; - TRACE("created json array %s.\n", debugstr_a(*array)); return STATUS_SUCCESS; } @@ -408,8 +407,6 @@ static NTSTATUS speech_get_recognition_result( void* args ) static char *last_result = NULL; const char *tmp = NULL; - TRACE("args %p.\n", args); - if (!vosk_handle) return STATUS_NOT_SUPPORTED; @@ -430,7 +427,6 @@ static NTSTATUS speech_get_recognition_result( void* args ) last_result = (char *)tmp; last_result_len = strlen(last_result); - TRACE("last_result %s.\n", debugstr_a(last_result)); } else return STATUS_NOT_FOUND; } From 27e322103ca311a3d05cf4f5caab70636da8c15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 7 Dec 2023 11:49:06 +0100 Subject: [PATCH 1262/1506] winegstreamer: Register more VIDEO_EFFECT DMO classes. CW-Bug-Id: #20427 --- dlls/winegstreamer/mfplat.c | 33 +++++++++++++++++++++++++++++++++ include/wmcodecdsp.idl | 15 +++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index a4cf2dfcd99..0e77afde3d3 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -444,6 +444,39 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(resampler_types), resampler_types, }, + { + CLSID_CFrameRateConvertDmo, + MFT_CATEGORY_VIDEO_EFFECT, + L"Frame Rate Converter", + MFT_ENUM_FLAG_SYNCMFT, + /* FIXME: check the actual media types */ + ARRAY_SIZE(color_convert_input_types), + color_convert_input_types, + ARRAY_SIZE(color_convert_output_types), + color_convert_output_types, + }, + { + CLSID_CResizerDMO, + MFT_CATEGORY_VIDEO_EFFECT, + L"Resizer MFT", + MFT_ENUM_FLAG_SYNCMFT, + /* FIXME: check the actual media types */ + ARRAY_SIZE(color_convert_input_types), + color_convert_input_types, + ARRAY_SIZE(color_convert_output_types), + color_convert_output_types, + }, + { + CLSID_CColorControlDmo, + MFT_CATEGORY_VIDEO_EFFECT, + L"Color Control", + MFT_ENUM_FLAG_SYNCMFT, + /* FIXME: check the actual media types */ + ARRAY_SIZE(color_convert_input_types), + color_convert_input_types, + ARRAY_SIZE(color_convert_output_types), + color_convert_output_types, + }, { CLSID_CColorConvertDMO, MFT_CATEGORY_VIDEO_EFFECT, diff --git a/include/wmcodecdsp.idl b/include/wmcodecdsp.idl index a6f350ea2fc..7e91015f19e 100644 --- a/include/wmcodecdsp.idl +++ b/include/wmcodecdsp.idl @@ -72,6 +72,21 @@ coclass CWMAEncMediaObject {} ] coclass AACMFTEncoder {} +[ + uuid(01f36ce2-0907-4d8b-979d-f151be91c883) +] +coclass CFrameRateConvertDmo {} + +[ + uuid(1ea1ea14-48f4-4054-ad1a-e8aee10ac805) +] +coclass CResizerDMO {} + +[ + uuid(798059f0-89ca-4160-b325-aeb48efe4f9a) +] +coclass CColorControlDmo {} + [ uuid(98230571-0087-4204-b020-3282538e57d3) ] From a7657b93413d541d94bdeda45a699a9526d961ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 7 Dec 2023 11:49:49 +0100 Subject: [PATCH 1263/1506] HACK: winegstreamer: Register the video processor MFT as a decoder. CW-Bug-Id: #20427 --- dlls/winegstreamer/mfplat.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 0e77afde3d3..0c2e37abe8a 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -507,6 +507,19 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(video_decoder_output_types), video_decoder_output_types, }, + { + /* HACK: Register the video processor as a decoder too as + * the media source currently always decodes. + */ + CLSID_VideoProcessorMFT, + MFT_CATEGORY_VIDEO_DECODER, + L"Null Decoder", + MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(video_processor_input_types), + video_processor_input_types, + ARRAY_SIZE(video_processor_output_types), + video_processor_output_types, + }, }; unsigned int i; From 460715d32235ae3b21be6888ea888f547d1a50e0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 15 Feb 2024 12:41:28 -0600 Subject: [PATCH 1264/1506] powershell: Read input command from stdin. CW-Bug-Id: #23416 --- programs/powershell/main.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/programs/powershell/main.c b/programs/powershell/main.c index eb9a64ff0ec..25a4d13d340 100644 --- a/programs/powershell/main.c +++ b/programs/powershell/main.c @@ -24,10 +24,25 @@ int __cdecl wmain(int argc, WCHAR *argv[]) { int i; - WINE_FIXME("stub:"); + WINE_FIXME("stub.\n"); for (i = 0; i < argc; i++) - WINE_FIXME(" %s", wine_dbgstr_w(argv[i])); - WINE_FIXME("\n"); + { + WINE_FIXME("argv[%d] %s\n", i, wine_dbgstr_w(argv[i])); + if (!wcsicmp(argv[i], L"-command") && i < argc - 1 && !wcscmp(argv[i + 1], L"-")) + { + char command[4096], *p; + ++i; + while (fgets(command, sizeof(command), stdin)) + { + WINE_FIXME("command %s.\n", debugstr_a(command)); + p = command; + while (*p && !isspace(*p)) ++p; + *p = 0; + if (!stricmp(command, "exit")) + break; + } + } + } return 0; } From 2f075843d6131f4def5fa350b3d7923a91edc913 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 30 Jan 2024 12:31:39 -0600 Subject: [PATCH 1265/1506] ntdll: HACK: Disable kernel write watches for BDO. CW-Bug-Id: #23322 --- dlls/ntdll/unix/loader.c | 4 ++-- dlls/ntdll/unix/unix_private.h | 2 +- dlls/ntdll/unix/virtual.c | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index b7d1f677203..8e70e882191 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2278,7 +2278,7 @@ static jstring wine_init_jni( JNIEnv *env, jobject obj, jobjectArray cmdline, jo main_envp = environ; init_paths( argv ); - virtual_init(); + virtual_init( argc, argv ); init_environment(); #ifdef __i386__ @@ -2525,7 +2525,7 @@ DECLSPEC_EXPORT void __wine_main( int argc, char *argv[], char *envp[] ) set_max_limit( RLIMIT_NICE ); #endif - virtual_init(); + virtual_init( argc, argv ); init_environment(); #ifdef __APPLE__ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index cf6b9ab0c53..57bf0cdfd05 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -245,7 +245,7 @@ extern NTSTATUS system_time_precise( void *args ); extern void *steamclient_handle_fault( LPCVOID addr, DWORD err ); extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ); extern void *anon_mmap_alloc( size_t size, int prot ); -extern void virtual_init(void); +extern void virtual_init( int argc, char *argv[] ); extern ULONG_PTR get_system_affinity_mask(void); extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info, BOOL wow64 ); extern NTSTATUS virtual_map_builtin_module( HANDLE mapping, void **module, SIZE_T *size, diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index b3535c8a8df..ba2fe258ede 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3398,17 +3398,25 @@ static void *alloc_virtual_heap( SIZE_T size ) return anon_mmap_alloc( size, PROT_READ | PROT_WRITE ); } +static int disable_kernel_ww( int argc, char *argv[] ) +{ + const char *env_var; + + if ((env_var = getenv("WINE_DISABLE_KERNEL_WRITEWATCH"))) return !!atoi(env_var); + if (argc > 1 && argv && argv[1] && strstr( argv[1], "blackdesert64.exe" )) return 1; + return 0; +} + /*********************************************************************** * virtual_init */ -void virtual_init(void) +void virtual_init( int argc, char *argv[] ) { const struct preload_info **preload_info = dlsym( RTLD_DEFAULT, "wine_main_preload_info" ); const char *preload = getenv( "WINEPRELOADRESERVE" ); size_t size; int i; pthread_mutexattr_t attr; - const char *env_var; pthread_mutexattr_init( &attr ); pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); @@ -3422,8 +3430,7 @@ void virtual_init(void) host_addr_space_limit = address_space_limit; #endif - if (!((env_var = getenv("WINE_DISABLE_KERNEL_WRITEWATCH")) && atoi(env_var)) - && (pagemap_reset_fd = open("/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC)) != -1) + if (!disable_kernel_ww( argc, argv ) && (pagemap_reset_fd = open("/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC)) != -1) { use_kernel_writewatch = TRUE; if ((pagemap_fd = open("/proc/self/pagemap", O_RDONLY | O_CLOEXEC)) == -1) From 55717132d52e0d3e8fc70dcbebff977acbaf8591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20K=C3=B6lbl?= Date: Mon, 13 Mar 2023 21:28:03 +0100 Subject: [PATCH 1266/1506] mfmediaengine: Return S_OK in SetBalance(). --- dlls/mfmediaengine/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index baa6e8540ff..3e05626f238 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -2588,7 +2588,7 @@ static HRESULT WINAPI media_engine_SetBalance(IMFMediaEngineEx *iface, double ba { FIXME("%p, %f stub.\n", iface, balance); - return E_NOTIMPL; + return S_OK; } static BOOL WINAPI media_engine_IsPlaybackRateSupported(IMFMediaEngineEx *iface, double rate) From a4cf21c6f78639f60aa3af69de4cac9d0468f13f Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sat, 17 Feb 2024 22:11:43 +0900 Subject: [PATCH 1267/1506] ntdll: Don't leak objattr allocation in NtCreateSemaphore. https://github.com/ValveSoftware/wine/pull/219 --- dlls/ntdll/unix/sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index ed30388b026..dd08632e21c 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -272,7 +272,6 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ *handle = 0; if (max <= 0 || initial < 0 || initial > max) return STATUS_INVALID_PARAMETER; - if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; if (do_fsync()) return fsync_create_semaphore( handle, access, attr, initial, max ); @@ -280,6 +279,8 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ if (do_esync()) return esync_create_semaphore( handle, access, attr, initial, max ); + if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; + SERVER_START_REQ( create_semaphore ) { req->access = access; From 1f5128360cf30378a8b13ef62fdc260d42d636a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 20 Feb 2024 11:52:03 +0100 Subject: [PATCH 1268/1506] fixup! winebus: Disable SDL2.30 new behavior for the SDL unix backend. --- dlls/winebus.sys/bus_sdl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 2e8fadb43d3..f37c2593f2b 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -115,7 +115,7 @@ MAKE_FUNCPTR(SDL_RegisterEvents); MAKE_FUNCPTR(SDL_PushEvent); MAKE_FUNCPTR(SDL_GetTicks); MAKE_FUNCPTR(SDL_LogSetPriority); -MAKE_FUNCPTR(SDL_SetHint); +MAKE_FUNCPTR(SDL_SetHintWithPriority); static int (*pSDL_JoystickRumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); static int (*pSDL_JoystickRumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); static Uint16 (*pSDL_JoystickGetProduct)(SDL_Joystick * joystick); @@ -1197,7 +1197,7 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_PushEvent); LOAD_FUNCPTR(SDL_GetTicks); LOAD_FUNCPTR(SDL_LogSetPriority); - LOAD_FUNCPTR(SDL_SetHint); + LOAD_FUNCPTR(SDL_SetHintWithPriority); #undef LOAD_FUNCPTR pSDL_JoystickRumble = dlsym(sdl_handle, "SDL_JoystickRumble"); pSDL_JoystickRumbleTriggers = dlsym(sdl_handle, "SDL_JoystickRumbleTriggers"); @@ -1209,7 +1209,7 @@ NTSTATUS sdl_bus_init(void *args) /* CW-Bug-Id: #23185: Disable SDL 2.30 new behavior, we need the steam virtual * controller name to figure which slot number it represents. */ - pSDL_SetHint("SteamVirtualGamepadInfo", ""); + pSDL_SetHintWithPriority("SteamVirtualGamepadInfo", "", SDL_HINT_OVERRIDE); if (pSDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0) { From 63fafa548181dc474fdd5f6c0b925cb82e33cb9a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 20 Feb 2024 16:03:44 -0600 Subject: [PATCH 1269/1506] winhttp: Mind read size when skipping async read in WinHttpReadData(). CW-Bug-Id: #21085 --- dlls/winhttp/request.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 29b30fc2583..c75d6fd513f 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3062,9 +3062,11 @@ static DWORD query_data_ready( struct request *request ) return count; } -static BOOL skip_async_queue( struct request *request, BOOL *wont_block ) +static BOOL skip_async_queue( struct request *request, BOOL *wont_block, DWORD to_read ) { - *wont_block = end_of_read_data( request ) || query_data_ready( request ); + if (!request->read_chunked) + to_read = min( to_read, request->content_length - request->content_read ); + *wont_block = end_of_read_data( request ) || query_data_ready( request ) >= to_read; return request->hdr.recursion_count < 3 && *wont_block; } @@ -3133,7 +3135,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) return FALSE; } - if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block )) + if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block, 1 )) { ret = query_data_available( request, available, async ); } @@ -3229,7 +3231,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW return FALSE; } - if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block )) + if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block, to_read )) { ret = read_data( request, buffer, to_read, read, async ); } From 505f4dface671ca3a07ad7fc6eee818709a4b419 Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 20 Feb 2024 22:39:56 -0300 Subject: [PATCH 1270/1506] HACK: gdiplus: Add HDC parameter back to gdi+ internal functions. This reverts commit e8babc9c97f8d5d7ea41c52e10bd6a8e0a2aa976 (Replace HDC with GpGraphics in parameters.) without having to revert the font linking implementation. This is due to graphics->hdc member being NULL when the GpGraphics object is created with GdipGetImageGraphicsContext, so we need to be able to pass a temporal HDC object when graphics->hdc is null. --- dlls/gdiplus/gdiplus_private.h | 4 +-- dlls/gdiplus/graphics.c | 52 +++++++++++++++++----------------- dlls/gdiplus/graphicspath.c | 8 +++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 2b5dbee43e9..95d19080ff1 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -620,13 +620,13 @@ struct gdip_font_link_info { }; -typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, +typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *sections, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data); -GpStatus gdip_format_string(GpGraphics *graphics, +GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 707fa55cfda..4b942bfaa09 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5163,7 +5163,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w } /* Populates gdip_font_link_info struct based on the base_font and input string */ -static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD length, GDIPCONST GpFont *base_font, +static void generate_font_link_info(GpGraphics *graphics, HDC hdc, WCHAR *string, DWORD length, GDIPCONST GpFont *base_font, struct gdip_font_link_info *font_link_info) { IUnknown *unk; @@ -5182,7 +5182,7 @@ static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD l IUnknown_Release(unk); get_font_hfont(graphics, base_font, NULL, &hfont, NULL, NULL); - IMLangFontLink_GetFontCodePages(iMLFL, graphics->hdc, hfont, &font_codepages); + IMLangFontLink_GetFontCodePages(iMLFL, hdc, hfont, &font_codepages); while (progress < length) { @@ -5197,10 +5197,10 @@ static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD l } else { - IMLangFontLink_MapFont(iMLFL, graphics->hdc, string_codepages, hfont, &map_hfont); - old_font = SelectObject(graphics->hdc, map_hfont); - GdipCreateFontFromDC(graphics->hdc, &gpfont); - SelectObject(graphics->hdc, old_font); + IMLangFontLink_MapFont(iMLFL, hdc, string_codepages, hfont, &map_hfont); + old_font = SelectObject(hdc, map_hfont); + GdipCreateFontFromDC(hdc, &gpfont); + SelectObject(hdc, old_font); IMLangFontLink_ReleaseFont(iMLFL, map_hfont); section->font = gpfont; } @@ -5214,7 +5214,7 @@ static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD l IMLangFontLink_Release(iMLFL); } -static void font_link_get_text_extent_point(struct gdip_font_link_info *font_link_info, GpGraphics *graphics, LPCWSTR string, +static void font_link_get_text_extent_point(struct gdip_font_link_info *font_link_info, GpGraphics *graphics, HDC hdc, LPCWSTR string, INT index, int length, int max_ext, LPINT fit, SIZE *size) { DWORD to_measure_length; @@ -5236,9 +5236,9 @@ static void font_link_get_text_extent_point(struct gdip_font_link_info *font_lin to_measure_length = min(length - (i - index), section->end - i); get_font_hfont(graphics, section->font, NULL, &hfont, NULL, NULL); - oldhfont = SelectObject(graphics->hdc, hfont); - GetTextExtentExPointW(graphics->hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); - SelectObject(graphics->hdc, oldhfont); + oldhfont = SelectObject(hdc, hfont); + GetTextExtentExPointW(hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); + SelectObject(hdc, oldhfont); DeleteObject(hfont); max_ext -= sizeaux.cx; @@ -5266,7 +5266,7 @@ static void release_font_link_info(struct gdip_font_link_info *font_link_info) } } -GpStatus gdip_format_string(GpGraphics *graphics, +GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data) @@ -5348,10 +5348,10 @@ GpStatus gdip_format_string(GpGraphics *graphics, halign = format->align; - generate_font_link_info(graphics, stringdup, length, font, &font_link_info); + generate_font_link_info(graphics, hdc, stringdup, length, font, &font_link_info); while(sum < length){ - font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, length - sum, nwidth, &fit, &size); + font_link_get_text_extent_point(&font_link_info, graphics, hdc, stringdup, sum, length - sum, nwidth, &fit, &size); fitcpy = fit; if(fit == 0) @@ -5399,7 +5399,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, else lineend = fit; - font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, lineend, nwidth, &j, &size); + font_link_get_text_extent_point(&font_link_info, graphics, hdc, stringdup, sum, lineend, nwidth, &j, &size); bounds.Width = size.cx; @@ -5432,7 +5432,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, if (hotkeyprefix_offsets[hotkeyprefix_end_pos] >= sum + lineend) break; - stat = callback(graphics, stringdup, sum, lineend, + stat = callback(graphics, hdc, stringdup, sum, lineend, &font_link_info, rect, format, lineno, &bounds, &hotkeyprefix_offsets[hotkeyprefix_pos], hotkeyprefix_end_pos-hotkeyprefix_pos, user_data); @@ -5499,7 +5499,7 @@ struct measure_ranges_args { REAL rel_width, rel_height; }; -static GpStatus measure_ranges_callback(GpGraphics *graphics, +static GpStatus measure_ranges_callback(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, @@ -5522,10 +5522,10 @@ static GpStatus measure_ranges_callback(GpGraphics *graphics, range_rect.Y = bounds->Y / args->rel_height; range_rect.Height = bounds->Height / args->rel_height; - font_link_get_text_extent_point(font_link_info, graphics, string, index, range_start - index, INT_MAX, NULL, &range_size); + font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, range_start - index, INT_MAX, NULL, &range_size); range_rect.X = (bounds->X + range_size.cx) / args->rel_width; - font_link_get_text_extent_point(font_link_info, graphics, string, index, range_end - index, INT_MAX, NULL, &range_size); + font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, range_end - index, INT_MAX, NULL, &range_size); range_rect.Width = (bounds->X + range_size.cx) / args->rel_width - range_rect.X; stat = GdipCombineRegionRect(args->regions[i], &range_rect, CombineModeUnion); @@ -5602,7 +5602,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, gdi_transform_acquire(graphics); - stat = gdip_format_string(graphics, string, length, font, &scaled_rect, stringFormat, + stat = gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, stringFormat, (stringFormat->attr & StringFormatFlagsNoClip) != 0, measure_ranges_callback, &args); gdi_transform_release(graphics); @@ -5623,7 +5623,7 @@ struct measure_string_args { REAL rel_width, rel_height; }; -static GpStatus measure_string_callback(GpGraphics *graphics, +static GpStatus measure_string_callback(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, @@ -5726,7 +5726,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, gdi_transform_acquire(graphics); - gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, measure_string_callback, &args); gdi_transform_release(graphics); @@ -5751,7 +5751,7 @@ struct draw_string_args { REAL x, y, rel_width, rel_height, ascent; }; -static GpStatus draw_string_callback(GpGraphics *graphics, +static GpStatus draw_string_callback(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, @@ -5775,7 +5775,7 @@ static GpStatus draw_string_callback(GpGraphics *graphics, to_draw_length = min(length - (i - index), section->end - i); TRACE("index %d, todraw %ld, used %s\n", i, to_draw_length, section->font == font_link_info->base_font ? "base font" : "map"); - font_link_get_text_extent_point(font_link_info, graphics, string, i, to_draw_length, 0, NULL, &size); + font_link_get_text_extent_point(font_link_info, graphics, hdc, string, i, to_draw_length, 0, NULL, &size); stat = draw_driver_string(graphics, &string[i], to_draw_length, section->font, format, args->brush, &position, DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); @@ -5801,10 +5801,10 @@ static GpStatus draw_string_callback(GpGraphics *graphics, SIZE text_size; INT ofs = underlined_indexes[i] - index; - font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, ofs, INT_MAX, NULL, &text_size); start_x = text_size.cx / args->rel_width; - font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs+1, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, ofs+1, INT_MAX, NULL, &text_size); end_x = text_size.cx / args->rel_width; GdipFillRectangle(graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); @@ -5918,7 +5918,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string GetTextMetricsW(hdc, &textmetric); args.ascent = textmetric.tmAscent / rel_height; - gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, draw_string_callback, &args); gdi_transform_release(graphics); diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 20e0787de16..0d1cfb2f9c5 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -949,7 +949,7 @@ struct format_string_args float ascent; }; -static GpStatus format_string_callback(GpGraphics *graphics, +static GpStatus format_string_callback(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, @@ -975,7 +975,7 @@ static GpStatus format_string_callback(GpGraphics *graphics, TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; - len = GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + len = GetGlyphOutlineW(hdc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { status = GenericError; @@ -989,7 +989,7 @@ static GpStatus format_string_callback(GpGraphics *graphics, status = OutOfMemory; break; } - GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, len, start, &identity); + GetGlyphOutlineW(hdc, string[i], GGO_BEZIER, &gm, len, start, &identity); ofs = 0; while (ofs < len) @@ -1117,7 +1117,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT args.maxY = 0; args.scale = emSize / native_height; args.ascent = textmetric.tmAscent * args.scale; - status = gdip_format_string(graphics, string, length, NULL, &scaled_layout_rect, + status = gdip_format_string(graphics, dc, string, length, NULL, &scaled_layout_rect, format, TRUE, format_string_callback, &args); DeleteDC(dc); From 657b2f1cae99a7e593eea433a7f6282f3539a5b4 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Mon, 22 Jan 2024 16:35:45 -0500 Subject: [PATCH 1271/1506] sapi: Create a new engine only when needed in ISpVoice. Instead of creating the TTS voice engine directly in SetVoice, we save the specified voice token, and only create them in ISpVoice::Speak when necessary. (cherry picked from commit 2a56d4e6e9803183873aa84be29eab1f1ce8acc3) --- dlls/sapi/tts.c | 75 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 410a57b4bfc..c2e36fc274d 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -43,6 +43,7 @@ struct speech_voice LONG ref; ISpStreamFormat *output; + ISpObjectToken *engine_token; ISpTTSEngine *engine; LONG cur_stream_num; DWORD actions; @@ -163,6 +164,7 @@ static ULONG WINAPI speech_voice_Release(ISpeechVoice *iface) { async_cancel_queue(&This->queue); if (This->output) ISpStreamFormat_Release(This->output); + if (This->engine_token) ISpObjectToken_Release(This->engine_token); if (This->engine) ISpTTSEngine_Release(This->engine); DeleteCriticalSection(&This->cs); @@ -660,7 +662,7 @@ static HRESULT WINAPI spvoice_Resume(ISpVoice *iface) static HRESULT WINAPI spvoice_SetVoice(ISpVoice *iface, ISpObjectToken *token) { struct speech_voice *This = impl_from_ISpVoice(iface); - ISpTTSEngine *engine; + WCHAR *id = NULL, *old_id = NULL; HRESULT hr; TRACE("(%p, %p).\n", iface, token); @@ -673,27 +675,37 @@ static HRESULT WINAPI spvoice_SetVoice(ISpVoice *iface, ISpObjectToken *token) else ISpObjectToken_AddRef(token); - hr = ISpObjectToken_CreateInstance(token, NULL, CLSCTX_ALL, &IID_ISpTTSEngine, (void **)&engine); - ISpObjectToken_Release(token); - if (FAILED(hr)) - return hr; - EnterCriticalSection(&This->cs); + if (This->engine_token && + SUCCEEDED(ISpObjectToken_GetId(token, &id)) && + SUCCEEDED(ISpObjectToken_GetId(This->engine_token, &old_id)) && + !wcscmp(id, old_id)) + { + ISpObjectToken_Release(token); + goto done; + } + + if (This->engine_token) + ISpObjectToken_Release(This->engine_token); + This->engine_token = token; + if (This->engine) + { ISpTTSEngine_Release(This->engine); - This->engine = engine; + This->engine = NULL; + } +done: LeaveCriticalSection(&This->cs); - + CoTaskMemFree(id); + CoTaskMemFree(old_id); return S_OK; } static HRESULT WINAPI spvoice_GetVoice(ISpVoice *iface, ISpObjectToken **token) { struct speech_voice *This = impl_from_ISpVoice(iface); - ISpObjectWithToken *engine_token_iface; - HRESULT hr; TRACE("(%p, %p).\n", iface, token); @@ -702,21 +714,18 @@ static HRESULT WINAPI spvoice_GetVoice(ISpVoice *iface, ISpObjectToken **token) EnterCriticalSection(&This->cs); - if (!This->engine) + if (!This->engine_token) { LeaveCriticalSection(&This->cs); return create_default_token(SPCAT_VOICES, token); } - if (SUCCEEDED(hr = ISpTTSEngine_QueryInterface(This->engine, &IID_ISpObjectWithToken, (void **)&engine_token_iface))) - { - hr = ISpObjectWithToken_GetObjectToken(engine_token_iface, token); - ISpObjectWithToken_Release(engine_token_iface); - } + ISpObjectToken_AddRef(This->engine_token); + *token = This->engine_token; LeaveCriticalSection(&This->cs); - return hr; + return S_OK; } struct async_result @@ -731,6 +740,7 @@ struct speak_task struct async_result *result; struct speech_voice *voice; + ISpTTSEngine *engine; SPVTEXTFRAG *frag_list; ISpTTSEngineSite *site; DWORD flags; @@ -773,7 +783,6 @@ static void speak_proc(struct async_task *task) struct speech_voice *This = speak_task->voice; GUID fmtid; WAVEFORMATEX *wfx = NULL; - ISpTTSEngine *engine = NULL; ISpAudio *audio = NULL; HRESULT hr; @@ -794,8 +803,6 @@ static void speak_proc(struct async_task *task) ERR("failed setting output format: %#lx.\n", hr); goto done; } - engine = This->engine; - ISpTTSEngine_AddRef(engine); if (SUCCEEDED(ISpStreamFormat_QueryInterface(This->output, &IID_ISpAudio, (void **)&audio))) ISpAudio_SetState(audio, SPAS_RUN, 0); @@ -804,7 +811,7 @@ static void speak_proc(struct async_task *task) LeaveCriticalSection(&This->cs); - hr = ISpTTSEngine_Speak(engine, speak_task->flags, &fmtid, wfx, speak_task->frag_list, speak_task->site); + hr = ISpTTSEngine_Speak(speak_task->engine, speak_task->flags, &fmtid, wfx, speak_task->frag_list, speak_task->site); if (SUCCEEDED(hr)) { ISpStreamFormat_Commit(This->output, STGC_DEFAULT); @@ -821,7 +828,7 @@ static void speak_proc(struct async_task *task) ISpAudio_Release(audio); } CoTaskMemFree(wfx); - if (engine) ISpTTSEngine_Release(engine); + ISpTTSEngine_Release(speak_task->engine); free(speak_task->frag_list); ISpTTSEngineSite_Release(speak_task->site); @@ -838,6 +845,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR { struct speech_voice *This = impl_from_ISpVoice(iface); ISpTTSEngineSite *site = NULL; + ISpTTSEngine *engine = NULL; SPVTEXTFRAG *frag; struct speak_task *speak_task = NULL; struct async_result *result = NULL; @@ -891,12 +899,28 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR return hr; } - if (!This->engine) + EnterCriticalSection(&This->cs); + + if (!This->engine_token) { - /* Create a new engine with the default voice. */ + /* Set the engine token to default. */ if (FAILED(hr = ISpVoice_SetVoice(iface, NULL))) + { + LeaveCriticalSection(&This->cs); return hr; + } } + if (!This->engine && + FAILED(hr = ISpObjectToken_CreateInstance(This->engine_token, NULL, CLSCTX_ALL, &IID_ISpTTSEngine, (void **)&This->engine))) + { + LeaveCriticalSection(&This->cs); + ERR("Failed to create engine: %#lx.\n", hr); + return hr; + } + engine = This->engine; + ISpTTSEngine_AddRef(engine); + + LeaveCriticalSection(&This->cs); if (!(frag = malloc(sizeof(*frag) + contents_size))) return E_OUTOFMEMORY; @@ -920,6 +944,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR speak_task->task.proc = speak_proc; speak_task->result = NULL; speak_task->voice = This; + speak_task->engine = engine; speak_task->frag_list = frag; speak_task->site = site; speak_task->flags = flags & SPF_NLP_SPEAK_PUNC; @@ -958,6 +983,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR fail: if (site) ISpTTSEngineSite_Release(site); + if (engine) ISpTTSEngine_Release(engine); free(frag); free(speak_task); if (result) @@ -1397,6 +1423,7 @@ HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj) This->ref = 1; This->output = NULL; + This->engine_token = NULL; This->engine = NULL; This->cur_stream_num = 0; This->actions = SPVES_CONTINUE; From 59ca532e59bfbb899f923a4e3ccf0f888de8fabc Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 2 Feb 2024 01:58:10 -0500 Subject: [PATCH 1272/1506] sapi: Add ISpeechObjectToken stub. (cherry picked from commit c45bedbf23ddf619b2aa034e843dc010f47b4f58) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 27 +++++ dlls/sapi/token.c | 225 ++++++++++++++++++++++++++++++++++++++-- include/sapi.idl | 2 +- 3 files changed, 247 insertions(+), 7 deletions(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index a7d164389d9..0fe142f89a8 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -604,6 +604,8 @@ static void test_object_token(void) static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Wine\\Winetest\\sapi\\TestToken"; ISpObjectToken *token; + IDispatch *disp; + ISpeechObjectToken *speech_token; ISpDataKey *sub_key; HRESULT hr; LPWSTR tempW, token_id; @@ -611,6 +613,31 @@ static void test_object_token(void) DWORD regid; IUnknown *obj; + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpObjectToken, (void **)&token ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpObjectToken_QueryInterface( token, &IID_IDispatch, (void **)&disp ); + ok( hr == S_OK, "got %08lx\n", hr ); + IDispatch_Release( disp ); + + hr = ISpObjectToken_QueryInterface( token, &IID_ISpeechObjectToken, (void **)&speech_token ); + ok( hr == S_OK, "got %08lx\n", hr ); + ISpeechObjectToken_Release( speech_token ); + + ISpObjectToken_Release( token ); + + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, + &IID_IDispatch, (void **)&disp ); + ok( hr == S_OK, "got %08lx\n", hr ); + IDispatch_Release( disp ); + + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpeechObjectToken, (void **)&speech_token ); + ok( hr == S_OK, "got %08lx\n", hr ); + ISpeechObjectToken_Release( speech_token ); + + hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, &IID_ISpObjectToken, (void **)&token ); ok( hr == S_OK, "got %08lx\n", hr ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index f599bdb6b14..fd4efb9a95a 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -51,6 +51,7 @@ static struct data_key *impl_from_ISpRegDataKey( ISpRegDataKey *iface ) struct object_token { ISpObjectToken ISpObjectToken_iface; + ISpeechObjectToken ISpeechObjectToken_iface; LONG ref; ISpRegDataKey *data_key; @@ -62,6 +63,11 @@ static struct object_token *impl_from_ISpObjectToken( ISpObjectToken *iface ) return CONTAINING_RECORD( iface, struct object_token, ISpObjectToken_iface ); } +static struct object_token *impl_from_ISpeechObjectToken( ISpeechObjectToken *iface ) +{ + return CONTAINING_RECORD( iface, struct object_token, ISpeechObjectToken_iface ); +} + static HRESULT WINAPI data_key_QueryInterface( ISpRegDataKey *iface, REFIID iid, void **obj ) { struct data_key *This = impl_from_ISpRegDataKey( iface ); @@ -1160,15 +1166,19 @@ static HRESULT WINAPI token_QueryInterface( ISpObjectToken *iface, if (IsEqualIID( iid, &IID_IUnknown ) || IsEqualIID( iid, &IID_ISpDataKey ) || IsEqualIID( iid, &IID_ISpObjectToken )) + *obj = &This->ISpObjectToken_iface; + else if (IsEqualIID( iid, &IID_IDispatch ) || + IsEqualIID( iid, &IID_ISpeechObjectToken )) + *obj = &This->ISpeechObjectToken_iface; + else { - ISpObjectToken_AddRef( iface ); - *obj = iface; - return S_OK; + *obj = NULL; + FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); + return E_NOINTERFACE; } - FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); - *obj = NULL; - return E_NOINTERFACE; + IUnknown_AddRef( (IUnknown *)*obj ); + return S_OK; } static ULONG WINAPI token_AddRef( ISpObjectToken *iface ) @@ -1495,6 +1505,208 @@ const struct ISpObjectTokenVtbl token_vtbl = token_MatchesAttributes }; +static HRESULT WINAPI speech_token_QueryInterface( ISpeechObjectToken *iface, + REFIID iid, void **obj ) +{ + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + + TRACE( "(%p)->(%s %p)\n", This, debugstr_guid( iid ), obj ); + + return ISpObjectToken_QueryInterface( &This->ISpObjectToken_iface, iid, obj ); +} + +static ULONG WINAPI speech_token_AddRef( ISpeechObjectToken *iface ) +{ + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + + TRACE( "(%p)\n", This ); + + return ISpObjectToken_AddRef( &This->ISpObjectToken_iface ); +} + +static ULONG WINAPI speech_token_Release( ISpeechObjectToken *iface ) +{ + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + + TRACE( "(%p)\n", This ); + + return ISpObjectToken_Release( &This->ISpObjectToken_iface ); +} + +static HRESULT WINAPI speech_token_GetTypeInfoCount( ISpeechObjectToken *iface, + UINT *count ) +{ + + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetTypeInfo( ISpeechObjectToken *iface, + UINT index, + LCID lcid, + ITypeInfo **type_info ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetIDsOfNames( ISpeechObjectToken *iface, + REFIID iid, + LPOLESTR *names, + UINT count, + LCID lcid, + DISPID *dispids ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_Invoke( ISpeechObjectToken *iface, + DISPID dispid, + REFIID iid, + LCID lcid, + WORD flags, + DISPPARAMS *params, + VARIANT *result, + EXCEPINFO *excepinfo, + UINT *argerr ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_get_Id( ISpeechObjectToken *iface, + BSTR *id ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_get_DataKey( ISpeechObjectToken *iface, + ISpeechDataKey **key ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_get_Category( ISpeechObjectToken *iface, + ISpeechObjectTokenCategory **cat ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetDescription( ISpeechObjectToken *iface, + LONG locale, BSTR *desc ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_SetId( ISpeechObjectToken *iface, + BSTR id, BSTR category_id, + VARIANT_BOOL create ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetAttribute( ISpeechObjectToken *iface, + BSTR name, BSTR *value ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_CreateInstance( ISpeechObjectToken *iface, + IUnknown *outer, + SpeechTokenContext clsctx, + IUnknown **object ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_Remove( ISpeechObjectToken *iface, + BSTR clsid ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_GetStorageFileName( ISpeechObjectToken *iface, + BSTR clsid, + BSTR key, + BSTR name, + SpeechTokenShellFolder folder, + BSTR *path ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_RemoveStorageFileName( ISpeechObjectToken *iface, + BSTR clsid, + BSTR key, + VARIANT_BOOL remove ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_IsUISupported( ISpeechObjectToken *iface, + const BSTR type, + const VARIANT *data, + IUnknown *object, + VARIANT_BOOL *supported ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_DisplayUI( ISpeechObjectToken *iface, + LONG hwnd, + BSTR title, + const BSTR type, + const VARIANT *data, + IUnknown *object ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_token_MatchesAttributes( ISpeechObjectToken *iface, + const BSTR attributes, + VARIANT_BOOL *matches ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +const struct ISpeechObjectTokenVtbl speech_token_vtbl = +{ + speech_token_QueryInterface, + speech_token_AddRef, + speech_token_Release, + speech_token_GetTypeInfoCount, + speech_token_GetTypeInfo, + speech_token_GetIDsOfNames, + speech_token_Invoke, + speech_token_get_Id, + speech_token_get_DataKey, + speech_token_get_Category, + speech_token_GetDescription, + speech_token_SetId, + speech_token_GetAttribute, + speech_token_CreateInstance, + speech_token_Remove, + speech_token_GetStorageFileName, + speech_token_RemoveStorageFileName, + speech_token_IsUISupported, + speech_token_DisplayUI, + speech_token_MatchesAttributes +}; + HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ) { struct object_token *This = malloc( sizeof(*This) ); @@ -1502,6 +1714,7 @@ HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ) if (!This) return E_OUTOFMEMORY; This->ISpObjectToken_iface.lpVtbl = &token_vtbl; + This->ISpeechObjectToken_iface.lpVtbl = &speech_token_vtbl; This->ref = 1; This->data_key = NULL; diff --git a/include/sapi.idl b/include/sapi.idl index 16b8348d73b..6a593eb6b18 100644 --- a/include/sapi.idl +++ b/include/sapi.idl @@ -1293,7 +1293,7 @@ library SpeechLib coclass SpObjectToken { interface ISpObjectToken; - [default] interface ISpDataKey; + [default] interface ISpeechObjectToken; } [ From 3b57da5af2702c71b2964e87bd84e509fd359911 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 2 Feb 2024 02:19:38 -0500 Subject: [PATCH 1273/1506] sapi: Add ISpeechObjectTokens stub. (cherry picked from commit ca6f3a7af87ded6f54c23aa5a983bbe9ee74667f) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 30 ++++++++++ dlls/sapi/token.c | 129 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 153 insertions(+), 6 deletions(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 0fe142f89a8..9350c304e41 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -246,12 +246,42 @@ static void test_token_enum(void) { ISpObjectTokenEnumBuilder *token_enum; HRESULT hr; + IDispatch *disp; + ISpeechObjectTokens *speech_tokens; ISpObjectToken *tokens[5]; ISpObjectToken *out_tokens[5]; WCHAR token_id[MAX_PATH]; ULONG count; int i; + hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpObjectTokenEnumBuilder, (void **)&token_enum ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpObjectTokenEnumBuilder_QueryInterface( token_enum, + &IID_IDispatch, (void **)&disp ); + ok( hr == S_OK, "got %08lx\n", hr ); + IDispatch_Release( disp ); + + hr = ISpObjectTokenEnumBuilder_QueryInterface( token_enum, + &IID_ISpeechObjectTokens, + (void **)&speech_tokens ); + ok( hr == S_OK, "got %08lx\n", hr ); + ISpeechObjectTokens_Release( speech_tokens ); + + ISpObjectTokenEnumBuilder_Release( token_enum ); + + hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, + &IID_IDispatch, (void **)&disp ); + ok( hr == S_OK, "got %08lx\n", hr ); + IDispatch_Release( disp ); + + hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpeechObjectTokens, (void **)&speech_tokens ); + ok( hr == S_OK, "got %08lx\n", hr ); + ISpeechObjectTokens_Release( speech_tokens ); + + hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, &IID_ISpObjectTokenEnumBuilder, (void **)&token_enum ); ok( hr == S_OK, "got %08lx\n", hr ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index fd4efb9a95a..4688e6a07b9 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -579,6 +579,7 @@ struct token_with_score struct token_enum { ISpObjectTokenEnumBuilder ISpObjectTokenEnumBuilder_iface; + ISpeechObjectTokens ISpeechObjectTokens_iface; LONG ref; BOOL init; @@ -593,6 +594,11 @@ static struct token_enum *impl_from_ISpObjectTokenEnumBuilder( ISpObjectTokenEnu return CONTAINING_RECORD( iface, struct token_enum, ISpObjectTokenEnumBuilder_iface ); } +static struct token_enum *impl_from_ISpeechObjectTokens( ISpeechObjectTokens *iface ) +{ + return CONTAINING_RECORD( iface, struct token_enum, ISpeechObjectTokens_iface ); +} + static HRESULT WINAPI token_category_EnumTokens( ISpObjectTokenCategory *iface, LPCWSTR req, LPCWSTR opt, IEnumSpObjectTokens **enum_tokens ) @@ -765,15 +771,19 @@ static HRESULT WINAPI token_enum_QueryInterface( ISpObjectTokenEnumBuilder *ifac if (IsEqualIID( iid, &IID_IUnknown ) || IsEqualIID( iid, &IID_IEnumSpObjectTokens ) || IsEqualIID( iid, &IID_ISpObjectTokenEnumBuilder )) + *obj = &This->ISpObjectTokenEnumBuilder_iface; + else if (IsEqualIID( iid, &IID_IDispatch ) || + IsEqualIID( iid, &IID_ISpeechObjectTokens )) + *obj = &This->ISpeechObjectTokens_iface; + else { - ISpObjectTokenEnumBuilder_AddRef( iface ); - *obj = iface; - return S_OK; + *obj = NULL; + FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); + return E_NOINTERFACE; } - FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); - *obj = NULL; - return E_NOINTERFACE; + IUnknown_AddRef( (IUnknown *)*obj ); + return S_OK; } static ULONG WINAPI token_enum_AddRef( ISpObjectTokenEnumBuilder *iface ) @@ -1135,6 +1145,112 @@ const struct ISpObjectTokenEnumBuilderVtbl token_enum_vtbl = token_enum_Sort }; +static HRESULT WINAPI speech_tokens_QueryInterface( ISpeechObjectTokens *iface, + REFIID iid, void **obj ) +{ + struct token_enum *This = impl_from_ISpeechObjectTokens( iface ); + + TRACE( "(%p)->(%s %p)\n", This, debugstr_guid( iid ), obj ); + + return ISpObjectTokenEnumBuilder_QueryInterface( + &This->ISpObjectTokenEnumBuilder_iface, iid, obj ); +} + +static ULONG WINAPI speech_tokens_AddRef( ISpeechObjectTokens *iface ) +{ + struct token_enum *This = impl_from_ISpeechObjectTokens( iface ); + + TRACE( "(%p)\n", This ); + + return ISpObjectTokenEnumBuilder_AddRef( &This->ISpObjectTokenEnumBuilder_iface ); +} + +static ULONG WINAPI speech_tokens_Release( ISpeechObjectTokens *iface ) +{ + struct token_enum *This = impl_from_ISpeechObjectTokens( iface ); + + TRACE( "(%p)\n", This ); + + return ISpObjectTokenEnumBuilder_Release( &This->ISpObjectTokenEnumBuilder_iface ); +} + +static HRESULT WINAPI speech_tokens_GetTypeInfoCount( ISpeechObjectTokens *iface, + UINT *count ) +{ + + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_tokens_GetTypeInfo( ISpeechObjectTokens *iface, + UINT index, + LCID lcid, + ITypeInfo **type_info ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_tokens_GetIDsOfNames( ISpeechObjectTokens *iface, + REFIID iid, + LPOLESTR *names, + UINT count, + LCID lcid, + DISPID *dispids ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_tokens_Invoke( ISpeechObjectTokens *iface, + DISPID dispid, + REFIID iid, + LCID lcid, + WORD flags, + DISPPARAMS *params, + VARIANT *result, + EXCEPINFO *excepinfo, + UINT *argerr ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_tokens_get_Count( ISpeechObjectTokens *iface, + LONG *count ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_tokens_Item( ISpeechObjectTokens *iface, + LONG index, ISpeechObjectToken **token ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI speech_tokens_get__NewEnum( ISpeechObjectTokens *iface, + IUnknown **new_enum ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static const ISpeechObjectTokensVtbl speech_tokens_vtbl = +{ + speech_tokens_QueryInterface, + speech_tokens_AddRef, + speech_tokens_Release, + speech_tokens_GetTypeInfoCount, + speech_tokens_GetTypeInfo, + speech_tokens_GetIDsOfNames, + speech_tokens_Invoke, + speech_tokens_get_Count, + speech_tokens_Item, + speech_tokens_get__NewEnum +}; + HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ) { struct token_enum *This = malloc( sizeof(*This) ); @@ -1142,6 +1258,7 @@ HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ) if (!This) return E_OUTOFMEMORY; This->ISpObjectTokenEnumBuilder_iface.lpVtbl = &token_enum_vtbl; + This->ISpeechObjectTokens_iface.lpVtbl = &speech_tokens_vtbl; This->ref = 1; This->req = NULL; This->opt = NULL; From 0ce4abd8f1a96d7bdbe402f2b20d2fcbd7aeaba3 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 2 Feb 2024 14:24:34 -0500 Subject: [PATCH 1274/1506] sapi: Add stub implementation for ISpeechObjectTokens::get__NewEnum. (cherry picked from commit 26498d93cf9354237eef3ef5a2b3612527068923) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 26 +++++++++ dlls/sapi/token.c | 117 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 141 insertions(+), 2 deletions(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 9350c304e41..543b19ec69a 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -248,6 +248,8 @@ static void test_token_enum(void) HRESULT hr; IDispatch *disp; ISpeechObjectTokens *speech_tokens; + IUnknown *unk; + IEnumVARIANT *enumvar; ISpObjectToken *tokens[5]; ISpObjectToken *out_tokens[5]; WCHAR token_id[MAX_PATH]; @@ -348,6 +350,30 @@ static void test_token_enum(void) &IID_ISpObjectTokenEnumBuilder, (void **)&token_enum ); ok( hr == S_OK, "got %08lx\n", hr ); + hr = ISpObjectTokenEnumBuilder_QueryInterface( token_enum, + &IID_ISpeechObjectTokens, + (void **)&speech_tokens ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpObjectTokenEnumBuilder_SetAttribs( token_enum, NULL, NULL ); + ok( hr == S_OK, "got %08lx\n", hr ); + hr = ISpObjectTokenEnumBuilder_AddTokens( token_enum, 3, tokens ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpeechObjectTokens_get__NewEnum( speech_tokens, &unk ); + ok( hr == S_OK, "got %08lx\n", hr ); + hr = IUnknown_QueryInterface( unk, &IID_IEnumVARIANT, (void **)&enumvar ); + ok( hr == S_OK, "got %08lx\n", hr ); + IUnknown_Release( unk ); + IEnumVARIANT_Release( enumvar ); + + ISpeechObjectTokens_Release( speech_tokens ); + ISpObjectTokenEnumBuilder_Release( token_enum ); + + hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpObjectTokenEnumBuilder, (void **)&token_enum ); + ok( hr == S_OK, "got %08lx\n", hr ); + /* Vendor attribute must exist */ hr = ISpObjectTokenEnumBuilder_SetAttribs( token_enum, L"Vendor", NULL ); ok( hr == S_OK, "got %08lx\n", hr ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 4688e6a07b9..53b64a4383f 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -599,6 +599,20 @@ static struct token_enum *impl_from_ISpeechObjectTokens( ISpeechObjectTokens *if return CONTAINING_RECORD( iface, struct token_enum, ISpeechObjectTokens_iface ); } +struct enum_var +{ + IEnumVARIANT IEnumVARIANT_iface; + LONG ref; + + ISpObjectTokenEnumBuilder *token_enum; + ULONG index; +}; + +static struct enum_var *impl_from_IEnumVARIANT( IEnumVARIANT *iface ) +{ + return CONTAINING_RECORD( iface, struct enum_var, IEnumVARIANT_iface ); +} + static HRESULT WINAPI token_category_EnumTokens( ISpObjectTokenCategory *iface, LPCWSTR req, LPCWSTR opt, IEnumSpObjectTokens **enum_tokens ) @@ -1145,6 +1159,86 @@ const struct ISpObjectTokenEnumBuilderVtbl token_enum_vtbl = token_enum_Sort }; +static HRESULT WINAPI enum_var_QueryInterface( IEnumVARIANT *iface, + REFIID iid, void **obj ) +{ + struct enum_var *This = impl_from_IEnumVARIANT( iface ); + + TRACE( "(%p)->(%s %p)\n", This, debugstr_guid( iid ), obj ); + + if (IsEqualIID( iid, &IID_IUnknown ) || + IsEqualIID( iid, &IID_IEnumVARIANT )) + { + IEnumVARIANT_AddRef( iface ); + *obj = iface; + return S_OK; + } + + *obj = NULL; + FIXME( "interface %s not implemented\n", debugstr_guid( iid ) ); + return E_NOINTERFACE; +} + +static ULONG WINAPI enum_var_AddRef( IEnumVARIANT *iface ) +{ + struct enum_var *This = impl_from_IEnumVARIANT( iface ); + ULONG ref = InterlockedIncrement( &This->ref ); + + TRACE( "(%p) ref = %lu\n", This, ref ); + return ref; +} + +static ULONG WINAPI enum_var_Release( IEnumVARIANT *iface ) +{ + struct enum_var *This = impl_from_IEnumVARIANT( iface ); + ULONG ref = InterlockedDecrement( &This->ref ); + + TRACE( "(%p) ref = %lu\n", This, ref ); + + if (!ref) + { + ISpObjectTokenEnumBuilder_Release( This->token_enum ); + free( This ); + } + return ref; +} + +static HRESULT WINAPI enum_var_Next( IEnumVARIANT *iface, ULONG count, + VARIANT *vars, ULONG *fetched ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI enum_var_Skip( IEnumVARIANT *iface, ULONG count ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI enum_var_Reset( IEnumVARIANT *iface ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static HRESULT WINAPI enum_var_Clone( IEnumVARIANT *iface, IEnumVARIANT **new_enum ) +{ + FIXME( "stub\n" ); + return E_NOTIMPL; +} + +static const IEnumVARIANTVtbl enum_var_vtbl = +{ + enum_var_QueryInterface, + enum_var_AddRef, + enum_var_Release, + enum_var_Next, + enum_var_Skip, + enum_var_Reset, + enum_var_Clone +}; + static HRESULT WINAPI speech_tokens_QueryInterface( ISpeechObjectTokens *iface, REFIID iid, void **obj ) { @@ -1233,8 +1327,27 @@ static HRESULT WINAPI speech_tokens_Item( ISpeechObjectTokens *iface, static HRESULT WINAPI speech_tokens_get__NewEnum( ISpeechObjectTokens *iface, IUnknown **new_enum ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + struct enum_var *enum_var; + HRESULT hr; + + TRACE( "(%p)->(%p)\n", iface, new_enum ); + + if (!new_enum) return E_POINTER; + if (!(enum_var = malloc( sizeof(*enum_var) ))) return E_OUTOFMEMORY; + + enum_var->IEnumVARIANT_iface.lpVtbl = &enum_var_vtbl; + enum_var->ref = 1; + enum_var->index = 0; + if (FAILED(hr = ISpeechObjectTokens_QueryInterface( iface, &IID_ISpObjectTokenEnumBuilder, + (void **)&enum_var->token_enum ))) + { + free( enum_var ); + return hr; + } + + *new_enum = (IUnknown *)&enum_var->IEnumVARIANT_iface; + + return S_OK; } static const ISpeechObjectTokensVtbl speech_tokens_vtbl = From ca12f61088cc6e8841da7265942e067ea6fad40c Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Thu, 8 Feb 2024 20:20:36 -0500 Subject: [PATCH 1275/1506] sapi: Implement ISpeechObjectToken::GetDescription. (cherry picked from commit b6c1760727dae433570ef0dffb985c751d4dc0bc) CW-Bug-Id: #22520 --- dlls/sapi/Makefile.in | 2 +- dlls/sapi/tests/Makefile.in | 2 +- dlls/sapi/tests/token.c | 58 +++++++++++++++++++++++++++++++++++-- dlls/sapi/token.c | 23 +++++++++++++-- 4 files changed, 79 insertions(+), 6 deletions(-) diff --git a/dlls/sapi/Makefile.in b/dlls/sapi/Makefile.in index 008d0f74545..24a1e055766 100644 --- a/dlls/sapi/Makefile.in +++ b/dlls/sapi/Makefile.in @@ -1,5 +1,5 @@ MODULE = sapi.dll -IMPORTS = uuid ole32 user32 advapi32 +IMPORTS = uuid ole32 oleaut32 user32 advapi32 DELAYIMPORTS = winmm SOURCES = \ diff --git a/dlls/sapi/tests/Makefile.in b/dlls/sapi/tests/Makefile.in index 4c107d5e994..4e792f2daae 100644 --- a/dlls/sapi/tests/Makefile.in +++ b/dlls/sapi/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = sapi.dll -IMPORTS = ole32 user32 advapi32 winmm +IMPORTS = ole32 oleaut32 user32 advapi32 winmm SOURCES = \ automation.c \ diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 543b19ec69a..a651eb47c62 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -657,7 +657,7 @@ static IClassFactory test_class_cf = { &ClassFactoryVtbl }; static void test_object_token(void) { - static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Wine\\Winetest\\sapi\\TestToken"; + static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Winetest\\sapi\\TestToken"; ISpObjectToken *token; IDispatch *disp; @@ -665,6 +665,7 @@ static void test_object_token(void) ISpDataKey *sub_key; HRESULT hr; LPWSTR tempW, token_id; + BSTR tempB; ISpObjectTokenCategory *cat; DWORD regid; IUnknown *obj; @@ -863,11 +864,64 @@ static void test_object_token(void) CoTaskMemFree( tempW ); } + hr = ISpObjectToken_SetStringValue( token, L"409", L"409 - TestToken" ); + ok( hr == S_OK, "got %08lx\n", hr ); + hr = ISpObjectToken_SetStringValue( token, L"407", L"407 - TestToken" ); + ok( hr == S_OK, "got %08lx\n", hr ); + hr = ISpObjectToken_SetStringValue( token, L"E40C", L"E40C - TestToken" ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpObjectToken_QueryInterface( token, &IID_ISpeechObjectToken, (void **)&speech_token ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ISpeechObjectToken_GetDescription( speech_token, 0x409, NULL ); + ok( hr == E_POINTER, "got %08lx\n", hr ); + + tempB = NULL; + hr = ISpeechObjectToken_GetDescription( speech_token, 0x409, &tempB ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( tempB && !wcscmp( tempB, L"409 - TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); + SysFreeString( tempB ); + + tempB = NULL; + hr = ISpeechObjectToken_GetDescription( speech_token, 0x10407, &tempB ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( tempB && !wcscmp( tempB, L"407 - TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); + SysFreeString( tempB ); + + tempB = NULL; + hr = ISpeechObjectToken_GetDescription( speech_token, 0xE40C, &tempB ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( tempB && !wcscmp( tempB, L"E40C - TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); + SysFreeString( tempB ); + + tempB = (BSTR)0xdeadbeef; + hr = ISpeechObjectToken_GetDescription( speech_token, 0x406, &tempB ); + ok( hr == SPERR_NOT_FOUND, "got %08lx\n", hr ); + ok( tempB == (BSTR)0xdeadbeef || broken(tempB == NULL) /* < win7 */, "got %p\n", tempB ); + + hr = ISpObjectToken_SetStringValue( token, NULL, L"TestToken" ); + ok( hr == S_OK, "got %08lx\n", hr ); + + tempB = NULL; + hr = ISpeechObjectToken_GetDescription( speech_token, 0x406, &tempB ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( tempB && !wcscmp( tempB, L"TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); + SysFreeString( tempB ); + + tempB = NULL; + hr = ISpeechObjectToken_GetDescription( speech_token, 0x0, &tempB ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( tempB && !wcscmp( tempB, L"TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); + SysFreeString( tempB ); + + ISpeechObjectToken_Release( speech_token ); + ISpObjectToken_Release( test_class_token ); IUnknown_Release( obj ); ISpObjectToken_Release( token ); - RegDeleteTreeA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Winetest\\sapi" ); + RegDeleteTreeA( HKEY_LOCAL_MACHINE, "Software\\Winetest\\sapi" ); } START_TEST(token) diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 53b64a4383f..e5d87505e34 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -1829,8 +1829,27 @@ static HRESULT WINAPI speech_token_get_Category( ISpeechObjectToken *iface, static HRESULT WINAPI speech_token_GetDescription( ISpeechObjectToken *iface, LONG locale, BSTR *desc ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + struct object_token *This = impl_from_ISpeechObjectToken( iface ); + WCHAR langid[5]; + WCHAR *desc_wstr = NULL; + HRESULT hr; + + TRACE( "(%p)->(%#lx %p)\n", This, locale, desc ); + + if (!desc) return E_POINTER; + + swprintf( langid, ARRAY_SIZE( langid ), L"%X", LANGIDFROMLCID( locale ) ); + + hr = ISpObjectToken_GetStringValue( &This->ISpObjectToken_iface, langid, &desc_wstr ); + if (hr == SPERR_NOT_FOUND) + hr = ISpObjectToken_GetStringValue( &This->ISpObjectToken_iface, NULL, &desc_wstr ); + if (FAILED(hr)) + return hr; + + *desc = SysAllocString( desc_wstr ); + + CoTaskMemFree( desc_wstr ); + return *desc ? S_OK : E_OUTOFMEMORY; } static HRESULT WINAPI speech_token_SetId( ISpeechObjectToken *iface, From 9fbf40b45aae057ecf1257faff914577b5e9cf75 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Wed, 7 Feb 2024 20:01:11 -0500 Subject: [PATCH 1276/1506] sapi: Implement ISpeechObjectToken::Invoke. (cherry picked from commit 001d1a4319dfb46a4383758a446203350c91edc1) CW-Bug-Id: #22520 --- dlls/sapi/Makefile.in | 1 + dlls/sapi/dispatch.c | 85 ++++++++++++++++++++++++++++++++++++++++ dlls/sapi/sapi_private.h | 9 +++++ dlls/sapi/tests/token.c | 20 ++++++++++ dlls/sapi/token.c | 14 ++++++- 5 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 dlls/sapi/dispatch.c diff --git a/dlls/sapi/Makefile.in b/dlls/sapi/Makefile.in index 24a1e055766..a6c4d86037e 100644 --- a/dlls/sapi/Makefile.in +++ b/dlls/sapi/Makefile.in @@ -5,6 +5,7 @@ DELAYIMPORTS = winmm SOURCES = \ async.c \ automation.c \ + dispatch.c \ main.c \ mmaudio.c \ resource.c \ diff --git a/dlls/sapi/dispatch.c b/dlls/sapi/dispatch.c new file mode 100644 index 00000000000..df0c6c9bf9c --- /dev/null +++ b/dlls/sapi/dispatch.c @@ -0,0 +1,85 @@ +/* + * ITypeInfo cache for IDispatch + * + * Copyright 2019 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/debug.h" + +#define COBJMACROS + +#include "objbase.h" +#include "sapiddk.h" + +#include "sapi_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(sapi); + +static ITypeLib *typelib; +static ITypeInfo *typeinfos[last_tid]; + +static REFIID tid_id[] = +{ + &IID_ISpeechObjectToken, +}; + +HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret) +{ + HRESULT hr; + + if (!typelib) + { + ITypeLib *tl; + + hr = LoadRegTypeLib(&LIBID_SpeechLib, 5, 4, LOCALE_SYSTEM_DEFAULT, &tl); + if (FAILED(hr)) + { + ERR("Failed to load typelib, hr %#lx.\n", hr); + return hr; + } + if (InterlockedCompareExchangePointer((void **)&typelib, tl, NULL)) + ITypeLib_Release(tl); + } + if (!typeinfos[tid]) + { + ITypeInfo *typeinfo; + + hr = ITypeLib_GetTypeInfoOfGuid(typelib, tid_id[tid], &typeinfo); + if (FAILED(hr)) + { + ERR("Failed to get type info for %s, hr %#lx.\n", debugstr_guid(tid_id[tid]), hr); + return hr; + } + if (InterlockedCompareExchangePointer((void **)(typeinfos + tid), typeinfo, NULL)) + ITypeInfo_Release(typeinfo); + } + ITypeInfo_AddRef(*ret = typeinfos[tid]); + return S_OK; +} + +void release_typelib(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(typeinfos); ++i) + { + if (typeinfos[i]) + ITypeInfo_Release(typeinfos[i]); + } + if (typelib) + ITypeLib_Release(typelib); +} diff --git a/dlls/sapi/sapi_private.h b/dlls/sapi/sapi_private.h index f6a5e966461..9a3c92cc4dc 100644 --- a/dlls/sapi/sapi_private.h +++ b/dlls/sapi/sapi_private.h @@ -52,3 +52,12 @@ HRESULT mmaudio_out_create( IUnknown *outer, REFIID iid, void **obj ); HRESULT token_category_create( IUnknown *outer, REFIID iid, void **obj ); HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ); HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ); + +enum type_id +{ + ISpeechObjectToken_tid, + last_tid +}; + +HRESULT get_typeinfo( enum type_id tid, ITypeInfo **typeinfo ); +void release_typelib( void ); diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index a651eb47c62..ec8a101fea4 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -26,6 +26,8 @@ #include "wine/test.h" +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + static void test_data_key(void) { ISpRegDataKey *data_key; @@ -669,6 +671,8 @@ static void test_object_token(void) ISpObjectTokenCategory *cat; DWORD regid; IUnknown *obj; + DISPPARAMS params; + VARIANT arg, ret; hr = CoCreateInstance( &CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, &IID_ISpObjectToken, (void **)&token ); @@ -915,6 +919,22 @@ static void test_object_token(void) ok( tempB && !wcscmp( tempB, L"TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); SysFreeString( tempB ); + memset( ¶ms, 0, sizeof(params) ); + params.cArgs = 1; + params.cNamedArgs = 0; + params.rgvarg = &arg; + VariantInit( &arg ); + V_VT( &arg ) = VT_I4; + V_I4( &arg ) = 0x409; + VariantInit( &ret ); + hr = ISpeechObjectToken_Invoke( speech_token, DISPID_SOTGetDescription, &IID_NULL, + 0, DISPATCH_METHOD, ¶ms, &ret, NULL, NULL ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( V_VT( &ret ) == VT_BSTR, "got %#x\n", V_VT( &ret ) ); + ok( V_BSTR( &ret ) && !wcscmp( V_BSTR( &ret ), L"409 - TestToken" ), + "got %s\n", wine_dbgstr_w( V_BSTR( &ret ) ) ); + VariantClear( &ret ); + ISpeechObjectToken_Release( speech_token ); ISpObjectToken_Release( test_class_token ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index e5d87505e34..c8cb806bbae 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -1801,8 +1801,18 @@ static HRESULT WINAPI speech_token_Invoke( ISpeechObjectToken *iface, EXCEPINFO *excepinfo, UINT *argerr ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + ITypeInfo *ti; + HRESULT hr; + + TRACE( "(%p)->(%ld %s %#lx %#x %p %p %p %p)\n", iface, dispid, + debugstr_guid( iid ), lcid, flags, params, result, excepinfo, argerr ); + + if (FAILED(hr = get_typeinfo( ISpeechObjectToken_tid, &ti ))) + return hr; + hr = ITypeInfo_Invoke( ti, iface, dispid, flags, params, result, excepinfo, argerr ); + ITypeInfo_Release( ti ); + + return hr; } static HRESULT WINAPI speech_token_get_Id( ISpeechObjectToken *iface, From 6b4b57bb5b164aa21155567ce004c6bfba06e149 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Sun, 11 Feb 2024 14:21:50 -0500 Subject: [PATCH 1277/1506] sapi: Implement ISpeechObjectToken::GetIDsOfNames. (cherry picked from commit 59a7ee1a2cf8b0b399e3c4201706197b7b035224) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 7 +++++++ dlls/sapi/token.c | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index ec8a101fea4..6265cde2bc3 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -660,6 +660,7 @@ static IClassFactory test_class_cf = { &ClassFactoryVtbl }; static void test_object_token(void) { static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Winetest\\sapi\\TestToken"; + static const WCHAR *get_description = L"GetDescription"; ISpObjectToken *token; IDispatch *disp; @@ -671,6 +672,7 @@ static void test_object_token(void) ISpObjectTokenCategory *cat; DWORD regid; IUnknown *obj; + DISPID dispid; DISPPARAMS params; VARIANT arg, ret; @@ -919,6 +921,11 @@ static void test_object_token(void) ok( tempB && !wcscmp( tempB, L"TestToken" ), "got %s\n", wine_dbgstr_w( tempB ) ); SysFreeString( tempB ); + dispid = 0xdeadbeef; + hr = ISpeechObjectToken_GetIDsOfNames( speech_token, &IID_NULL, (WCHAR **)&get_description, 1, 0x409, &dispid ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( dispid == DISPID_SOTGetDescription, "got %08lx\n", dispid ); + memset( ¶ms, 0, sizeof(params) ); params.cArgs = 1; params.cNamedArgs = 0; diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index c8cb806bbae..888da86d7a4 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -1787,8 +1787,18 @@ static HRESULT WINAPI speech_token_GetIDsOfNames( ISpeechObjectToken *iface, LCID lcid, DISPID *dispids ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + ITypeInfo *ti; + HRESULT hr; + + TRACE( "(%p)->(%s %p %u %#lx %p)\n", + iface, debugstr_guid( iid ), names, count, lcid, dispids ); + + if (FAILED(hr = get_typeinfo( ISpeechObjectToken_tid, &ti ))) + return hr; + hr = ITypeInfo_GetIDsOfNames( ti, names, count, dispids ); + ITypeInfo_Release( ti ); + + return hr; } static HRESULT WINAPI speech_token_Invoke( ISpeechObjectToken *iface, From 858b749497d45c202082d53ae427ce6804fa1b4e Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Tue, 6 Feb 2024 16:37:07 -0500 Subject: [PATCH 1278/1506] sapi: Implement ISpeechObjectTokens::get_Count. (cherry picked from commit 261d7c3de4af85f7b2269f5b0e2809f11a102894) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 5 +++++ dlls/sapi/token.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 6265cde2bc3..a68a0b7cd46 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -362,6 +362,11 @@ static void test_token_enum(void) hr = ISpObjectTokenEnumBuilder_AddTokens( token_enum, 3, tokens ); ok( hr == S_OK, "got %08lx\n", hr ); + count = 0xdeadbeef; + hr = ISpeechObjectTokens_get_Count( speech_tokens, (LONG *)&count ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( count == 3, "got %lu\n", count ); + hr = ISpeechObjectTokens_get__NewEnum( speech_tokens, &unk ); ok( hr == S_OK, "got %08lx\n", hr ); hr = IUnknown_QueryInterface( unk, &IID_IEnumVARIANT, (void **)&enumvar ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 888da86d7a4..2cfc34304c9 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -1313,8 +1313,11 @@ static HRESULT WINAPI speech_tokens_Invoke( ISpeechObjectTokens *iface, static HRESULT WINAPI speech_tokens_get_Count( ISpeechObjectTokens *iface, LONG *count ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + struct token_enum *This = impl_from_ISpeechObjectTokens( iface ); + + TRACE( "(%p)->(%p)\n", This, count ); + + return ISpObjectTokenEnumBuilder_GetCount( &This->ISpObjectTokenEnumBuilder_iface, (ULONG *)count ); } static HRESULT WINAPI speech_tokens_Item( ISpeechObjectTokens *iface, From 09139f5a2c4725bcc6835da6696eaae545d530a0 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Tue, 6 Feb 2024 17:17:02 -0500 Subject: [PATCH 1279/1506] sapi: Implement IEnumVARIANT::Next for ISpeechObjectTokens. (cherry picked from commit 6f2a0c412fb5d09cf40b13e773529f4b9acd9ad3) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 28 ++++++++++++++++++++++++++++ dlls/sapi/token.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index a68a0b7cd46..89cbb5150a4 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -256,6 +256,7 @@ static void test_token_enum(void) ISpObjectToken *out_tokens[5]; WCHAR token_id[MAX_PATH]; ULONG count; + VARIANT vars[3]; int i; hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, @@ -372,6 +373,33 @@ static void test_token_enum(void) hr = IUnknown_QueryInterface( unk, &IID_IEnumVARIANT, (void **)&enumvar ); ok( hr == S_OK, "got %08lx\n", hr ); IUnknown_Release( unk ); + + V_VT( &vars[0] ) = VT_ILLEGAL; + V_DISPATCH( &vars[0] ) = (IDispatch *)0xdeadbeef; + hr = IEnumVARIANT_Next( enumvar, 1, vars, NULL ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( V_VT( &vars[0] ) == VT_DISPATCH, "got %#x\n", V_VT( &vars[0] ) ); + ok( V_DISPATCH( &vars[0] ) != (IDispatch *)0xdeadbeef && V_DISPATCH( &vars[0] ) != NULL, + "got %p\n", V_DISPATCH( &vars[0] ) ); + VariantClear( &vars[0] ); + + for ( i = 0; i < 3; i++ ) { + V_VT( &vars[i] ) = VT_ILLEGAL; + V_DISPATCH( &vars[i] ) = (IDispatch *)0xdeadbeef; + } + count = 0xdeadbeef; + + hr = IEnumVARIANT_Next( enumvar, 3, vars, &count ); + ok( hr == S_FALSE, "got %08lx\n", hr ); + ok( count == 2, "got %lu\n", count ); + for ( i = 0; i < 2; i++ ) { + ok( V_VT( &vars[i] ) == VT_DISPATCH, "got %#x\n", V_VT( &vars[i] ) ); + ok( V_DISPATCH( &vars[i] ) != (IDispatch *)0xdeadbeef && V_DISPATCH( &vars[i] ) != NULL, + "got %p\n", V_DISPATCH( &vars[i] ) ); + VariantClear( &vars[i] ); + } + ok( V_VT( &vars[2] ) == VT_ILLEGAL, "got %#x\n", V_VT( &vars[2] ) ); + IEnumVARIANT_Release( enumvar ); ISpeechObjectTokens_Release( speech_tokens ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 2cfc34304c9..b7f78fe98bd 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -1206,8 +1206,41 @@ static ULONG WINAPI enum_var_Release( IEnumVARIANT *iface ) static HRESULT WINAPI enum_var_Next( IEnumVARIANT *iface, ULONG count, VARIANT *vars, ULONG *fetched ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + struct enum_var *This = impl_from_IEnumVARIANT( iface ); + ULONG i, total; + HRESULT hr; + + TRACE( "(%p)->(%lu %p %p)\n", This, count, vars, fetched ); + + if (fetched) *fetched = 0; + + if (FAILED(hr = ISpObjectTokenEnumBuilder_GetCount( This->token_enum, &total ))) + return hr; + + for ( i = 0; i < count && This->index < total; i++, This->index++ ) + { + ISpObjectToken *token; + IDispatch *disp; + + if (FAILED(hr = ISpObjectTokenEnumBuilder_Item( This->token_enum, This->index, &token ))) + goto fail; + + hr = ISpObjectToken_QueryInterface( token, &IID_IDispatch, (void **)&disp ); + ISpObjectToken_Release( token ); + if (FAILED(hr)) goto fail; + + VariantInit( &vars[i] ); + V_VT( &vars[i] ) = VT_DISPATCH; + V_DISPATCH( &vars[i] ) = disp; + } + + if (fetched) *fetched = i; + return i == count ? S_OK : S_FALSE; + +fail: + while (i--) + VariantClear( &vars[i] ); + return hr; } static HRESULT WINAPI enum_var_Skip( IEnumVARIANT *iface, ULONG count ) From bfcfe8645c16700d346aa9a80c5fe5ccb2500f11 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Sun, 11 Feb 2024 00:29:46 -0500 Subject: [PATCH 1280/1506] sapi: Implement ISpeechObjectTokens::Invoke. (cherry picked from commit 6e8d4508048941015e62c42372a584d9e0dd4931) CW-Bug-Id: #22520 --- dlls/sapi/dispatch.c | 1 + dlls/sapi/sapi_private.h | 1 + dlls/sapi/tests/token.c | 11 ++++++++++- dlls/sapi/token.c | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dlls/sapi/dispatch.c b/dlls/sapi/dispatch.c index df0c6c9bf9c..731ae9ae48f 100644 --- a/dlls/sapi/dispatch.c +++ b/dlls/sapi/dispatch.c @@ -35,6 +35,7 @@ static ITypeInfo *typeinfos[last_tid]; static REFIID tid_id[] = { &IID_ISpeechObjectToken, + &IID_ISpeechObjectTokens, }; HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret) diff --git a/dlls/sapi/sapi_private.h b/dlls/sapi/sapi_private.h index 9a3c92cc4dc..55e1460ad38 100644 --- a/dlls/sapi/sapi_private.h +++ b/dlls/sapi/sapi_private.h @@ -56,6 +56,7 @@ HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ); enum type_id { ISpeechObjectToken_tid, + ISpeechObjectTokens_tid, last_tid }; diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 89cbb5150a4..6d2c40ea154 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -256,7 +256,8 @@ static void test_token_enum(void) ISpObjectToken *out_tokens[5]; WCHAR token_id[MAX_PATH]; ULONG count; - VARIANT vars[3]; + VARIANT vars[3], ret; + DISPPARAMS params; int i; hr = CoCreateInstance( &CLSID_SpObjectTokenEnum, NULL, CLSCTX_INPROC_SERVER, @@ -402,6 +403,14 @@ static void test_token_enum(void) IEnumVARIANT_Release( enumvar ); + memset( ¶ms, 0, sizeof(params) ); + VariantInit( &ret ); + hr = ISpeechObjectTokens_Invoke( speech_tokens, DISPID_SOTsCount, &IID_NULL, 0, + DISPATCH_PROPERTYGET, ¶ms, &ret, NULL, NULL ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( V_VT( &ret ) == VT_I4, "got %#x\n", V_VT( &ret ) ); + ok( V_I4( &ret ) == 3, "got %ld\n", V_I4( &ret ) ); + ISpeechObjectTokens_Release( speech_tokens ); ISpObjectTokenEnumBuilder_Release( token_enum ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index b7f78fe98bd..ad8163c9567 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -1339,8 +1339,18 @@ static HRESULT WINAPI speech_tokens_Invoke( ISpeechObjectTokens *iface, EXCEPINFO *excepinfo, UINT *argerr ) { - FIXME( "stub\n" ); - return E_NOTIMPL; + ITypeInfo *ti; + HRESULT hr; + + TRACE( "(%p)->(%ld %s %#lx %#x %p %p %p %p)\n", iface, dispid, + debugstr_guid( iid ), lcid, flags, params, result, excepinfo, argerr ); + + if (FAILED(hr = get_typeinfo( ISpeechObjectTokens_tid, &ti ))) + return hr; + hr = ITypeInfo_Invoke( ti, iface, dispid, flags, params, result, excepinfo, argerr ); + ITypeInfo_Release( ti ); + + return hr; } static HRESULT WINAPI speech_tokens_get_Count( ISpeechObjectTokens *iface, From 39099ad835cd272cfb4fe69d3c385035c33b5903 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Wed, 14 Feb 2024 20:07:41 -0500 Subject: [PATCH 1281/1506] sapi: Free typelib on DLL detach. (cherry picked from commit afac7d7e3ffc67c3575512634fd757f81ce839b8) --- dlls/sapi/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/sapi/main.c b/dlls/sapi/main.c index 108db7d13d8..8adcc7449fb 100644 --- a/dlls/sapi/main.c +++ b/dlls/sapi/main.c @@ -145,3 +145,21 @@ HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj ) return IClassFactory_QueryInterface( cf, iid, obj ); } + +/****************************************************************** + * DllMain + */ +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, void *reserved ) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls( hinst ); + break; + case DLL_PROCESS_DETACH: + if (reserved) break; + release_typelib(); + break; + } + return TRUE; +} From ec589a5bed84edcac3de1951912823b65acd8c3f Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 16 Feb 2024 14:28:42 -0500 Subject: [PATCH 1282/1506] sapi: Implement ISpeechVoice::Speak. (cherry picked from commit 5243f2e82cace7234a66e2036146a32f7aa62d80) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 9 +++++++++ dlls/sapi/tts.c | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 38ec1d31bfc..87711eac61a 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -431,6 +431,7 @@ static void test_spvoice(void) ULONG stream_num; DWORD regid; DWORD start, duration; + ISpeechVoice *speech_voice; HRESULT hr; if (waveOutGetNumDevs() == 0) { @@ -681,6 +682,14 @@ static void test_spvoice(void) ok(hr == S_OK, "got %#lx.\n", hr); ok(duration < 300, "took %lu ms.\n", duration); + hr = ISpVoice_QueryInterface(voice, &IID_ISpeechVoice, (void **)&speech_voice); + ok(hr == S_OK, "got %#lx.\n", hr); + + hr = ISpeechVoice_Speak(speech_voice, NULL, SVSFPurgeBeforeSpeak, NULL); + ok(hr == S_OK, "got %#lx.\n", hr); + + ISpeechVoice_Release(speech_voice); + done: reset_engine_params(&test_engine); ISpVoice_Release(voice); diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index c2e36fc274d..e719a544a01 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -357,9 +357,11 @@ static HRESULT WINAPI speech_voice_get_SynchronousSpeakTimeout(ISpeechVoice *ifa static HRESULT WINAPI speech_voice_Speak(ISpeechVoice *iface, BSTR text, SpeechVoiceSpeakFlags flags, LONG *number) { - FIXME("(%p, %s, %#x, %p): stub.\n", iface, debugstr_w(text), flags, number); + struct speech_voice *This = impl_from_ISpeechVoice(iface); - return E_NOTIMPL; + TRACE("(%p, %s, %#x, %p).\n", iface, debugstr_w(text), flags, number); + + return ISpVoice_Speak(&This->ISpVoice_iface, text, flags, (ULONG *)number); } static HRESULT WINAPI speech_voice_SpeakStream(ISpeechVoice *iface, ISpeechBaseStream *stream, From fe1772d3dab7fa06ba15b7b23514543104c5e70b Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 16 Feb 2024 17:08:18 -0500 Subject: [PATCH 1283/1506] sapi: Handle zero-length attributes correctly in ISpObjectTokenCategory::EnumTokens. (cherry picked from commit 4bbfd838983505ce4120ebfe94899049b071fbb8) CW-Bug-Id: #22520 --- dlls/sapi/tests/token.c | 10 ++++++++++ dlls/sapi/token.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/sapi/tests/token.c b/dlls/sapi/tests/token.c index 6d2c40ea154..c7067718c45 100644 --- a/dlls/sapi/tests/token.c +++ b/dlls/sapi/tests/token.c @@ -205,6 +205,16 @@ static void test_token_category(void) IEnumSpObjectTokens_Release( enum_tokens ); + hr = ISpObjectTokenCategory_EnumTokens( cat, L"", NULL, &enum_tokens ); + ok( hr == S_OK, "got %08lx\n", hr ); + + count = 0xdeadbeef; + hr = IEnumSpObjectTokens_GetCount( enum_tokens, &count ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( count == 5, "got %lu\n", count ); + + IEnumSpObjectTokens_Release( enum_tokens ); + hr = ISpObjectTokenCategory_EnumTokens( cat, L"Language=409", NULL, &enum_tokens ); ok( hr == S_OK, "got %08lx\n", hr ); diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index ad8163c9567..65d35dc96ff 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -947,7 +947,7 @@ static HRESULT score_attributes( ISpObjectToken *token, const WCHAR *attrs, unsigned int i, j; HRESULT hr; - if (!attrs) + if (!attrs || !*attrs) { *score = 1; return S_OK; From c843bc964d87a9c248a69d407e522144f9b4136a Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Thu, 15 Feb 2024 17:13:55 -0500 Subject: [PATCH 1284/1506] sapi: Introduce create_token_category helper in tts. (cherry picked from commit 0f8b59a245bc85e45c0fc8987d6f42794165c4d3) CW-Bug-Id: #22520 --- dlls/sapi/tts.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index e719a544a01..381558659b8 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -82,6 +82,15 @@ static inline struct tts_engine_site *impl_from_ISpTTSEngineSite(ISpTTSEngineSit return CONTAINING_RECORD(iface, struct tts_engine_site, ISpTTSEngineSite_iface); } +static HRESULT create_token_category(const WCHAR *cat_id, ISpObjectTokenCategory **cat) +{ + HRESULT hr; + if (FAILED(hr = CoCreateInstance(&CLSID_SpObjectTokenCategory, NULL, CLSCTX_INPROC_SERVER, + &IID_ISpObjectTokenCategory, (void **)cat))) + return hr; + return ISpObjectTokenCategory_SetId(*cat, cat_id, FALSE); +} + static HRESULT create_default_token(const WCHAR *cat_id, ISpObjectToken **token) { ISpObjectTokenCategory *cat; @@ -90,17 +99,13 @@ static HRESULT create_default_token(const WCHAR *cat_id, ISpObjectToken **token) TRACE("(%s, %p).\n", debugstr_w(cat_id), token); - if (FAILED(hr = CoCreateInstance(&CLSID_SpObjectTokenCategory, NULL, CLSCTX_INPROC_SERVER, - &IID_ISpObjectTokenCategory, (void **)&cat))) + if (FAILED(hr = create_token_category(cat_id, &cat))) return hr; - if (FAILED(hr = ISpObjectTokenCategory_SetId(cat, cat_id, FALSE)) || - FAILED(hr = ISpObjectTokenCategory_GetDefaultTokenId(cat, &default_token_id))) - { - ISpObjectTokenCategory_Release(cat); - return hr; - } + hr = ISpObjectTokenCategory_GetDefaultTokenId(cat, &default_token_id); ISpObjectTokenCategory_Release(cat); + if (FAILED(hr)) + return hr; if (FAILED(hr = CoCreateInstance(&CLSID_SpObjectToken, NULL, CLSCTX_INPROC_SERVER, &IID_ISpObjectToken, (void **)token))) From 4fdd8adf560a7a0bd9c95b59bcfbf4e79fec031e Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 16 Feb 2024 15:21:28 -0500 Subject: [PATCH 1285/1506] sapi: Implement ISpeechVoice::GetVoices. (cherry picked from commit 62aec0318b958655a86d25a8baad8b37525fa564) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 31 +++++++++++++++++++++++++++++-- dlls/sapi/tts.c | 21 +++++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 87711eac61a..8f88d74b9ef 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -416,7 +416,7 @@ static IClassFactory test_engine_cf = { &ClassFactoryVtbl }; static void test_spvoice(void) { - static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Wine\\Winetest\\sapi\\tts\\TestEngine"; + static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Speech\\Voices\\Tokens\\WinetestVoice"; static const WCHAR test_text[] = L"Hello! This is a test sentence."; ISpVoice *voice; @@ -432,6 +432,9 @@ static void test_spvoice(void) DWORD regid; DWORD start, duration; ISpeechVoice *speech_voice; + ISpeechObjectTokens *speech_tokens; + LONG count; + BSTR req = NULL, opt = NULL; HRESULT hr; if (waveOutGetNumDevs() == 0) { @@ -439,6 +442,8 @@ static void test_spvoice(void) return; } + RegDeleteTreeA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Speech\\Voices\\WinetestVoice"); + check_apttype(); ok(test_apt_data.type == APTTYPE_UNITIALIZED, "got apt type %d.\n", test_apt_data.type); @@ -588,6 +593,7 @@ static void test_spvoice(void) hr = ISpObjectToken_CreateKey(token, L"Attributes", &attrs_key); ok(hr == S_OK, "got %#lx.\n", hr); ISpDataKey_SetStringValue(attrs_key, L"Language", L"409"); + ISpDataKey_SetStringValue(attrs_key, L"Vendor", L"Winetest"); ISpDataKey_Release(attrs_key); hr = ISpVoice_SetVoice(voice, token); @@ -685,6 +691,25 @@ static void test_spvoice(void) hr = ISpVoice_QueryInterface(voice, &IID_ISpeechVoice, (void **)&speech_voice); ok(hr == S_OK, "got %#lx.\n", hr); + count = -1; + hr = ISpeechVoice_GetVoices(speech_voice, NULL, NULL, &speech_tokens); + ok(hr == S_OK, "got %#lx.\n", hr); + hr = ISpeechObjectTokens_get_Count(speech_tokens, &count); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(count > 0, "got %ld.\n", count); + ISpeechObjectTokens_Release(speech_tokens); + + req = SysAllocString(L"Vendor=Winetest"); + opt = SysAllocString(L"Language=409;Gender=Male"); + + count = 0xdeadbeef; + hr = ISpeechVoice_GetVoices(speech_voice, req, opt, &speech_tokens); + ok(hr == S_OK, "got %#lx.\n", hr); + hr = ISpeechObjectTokens_get_Count(speech_tokens, &count); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(count == 1, "got %ld.\n", count); + ISpeechObjectTokens_Release(speech_tokens); + hr = ISpeechVoice_Speak(speech_voice, NULL, SVSFPurgeBeforeSpeak, NULL); ok(hr == S_OK, "got %#lx.\n", hr); @@ -695,8 +720,10 @@ static void test_spvoice(void) ISpVoice_Release(voice); ISpObjectToken_Release(token); ISpMMSysAudio_Release(audio_out); + SysFreeString(req); + SysFreeString(opt); - RegDeleteTreeA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Winetest\\sapi" ); + RegDeleteTreeA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Speech\\Voices\\WinetestVoice"); } START_TEST(tts) diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 381558659b8..6fe01373e56 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -401,9 +401,26 @@ static HRESULT WINAPI speech_voice_Skip(ISpeechVoice *iface, const BSTR type, LO static HRESULT WINAPI speech_voice_GetVoices(ISpeechVoice *iface, BSTR required, BSTR optional, ISpeechObjectTokens **tokens) { - FIXME("(%p, %s, %s, %p): stub.\n", iface, debugstr_w(required), debugstr_w(optional), tokens); - return E_NOTIMPL; + ISpObjectTokenCategory *cat; + IEnumSpObjectTokens *token_enum; + HRESULT hr; + + TRACE("(%p, %s, %s, %p).\n", iface, debugstr_w(required), debugstr_w(optional), tokens); + + if (!tokens) return E_POINTER; + + if (FAILED(hr = create_token_category(SPCAT_VOICES, &cat))) + return hr; + + if (SUCCEEDED(hr = ISpObjectTokenCategory_EnumTokens(cat, required, optional, &token_enum))) + { + hr = IEnumSpObjectTokens_QueryInterface(token_enum, &IID_ISpeechObjectTokens, (void **)tokens); + IEnumSpObjectTokens_Release(token_enum); + } + + ISpObjectTokenCategory_Release(cat); + return hr; } static HRESULT WINAPI speech_voice_GetAudioOutputs(ISpeechVoice *iface, BSTR required, BSTR optional, From 26987b765930c7e9f44a1ada303525575883dd5e Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 16 Feb 2024 20:04:07 -0500 Subject: [PATCH 1286/1506] sapi: Implement ISpeechVoice::GetTypeInfoCount. (cherry picked from commit 58087358d1038365c168772eeea9628f72c56df2) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 6 ++++++ dlls/sapi/tts.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 8f88d74b9ef..8f18934fce3 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -435,6 +435,7 @@ static void test_spvoice(void) ISpeechObjectTokens *speech_tokens; LONG count; BSTR req = NULL, opt = NULL; + UINT info_count; HRESULT hr; if (waveOutGetNumDevs() == 0) { @@ -713,6 +714,11 @@ static void test_spvoice(void) hr = ISpeechVoice_Speak(speech_voice, NULL, SVSFPurgeBeforeSpeak, NULL); ok(hr == S_OK, "got %#lx.\n", hr); + info_count = 0xdeadbeef; + hr = ISpeechVoice_GetTypeInfoCount(speech_voice, &info_count); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(info_count == 1, "got %u.\n", info_count); + ISpeechVoice_Release(speech_voice); done: diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 6fe01373e56..2493a2804f2 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -179,11 +179,11 @@ static ULONG WINAPI speech_voice_Release(ISpeechVoice *iface) return ref; } -static HRESULT WINAPI speech_voice_GetTypeInfoCount(ISpeechVoice *iface, UINT *info) +static HRESULT WINAPI speech_voice_GetTypeInfoCount(ISpeechVoice *iface, UINT *count) { - FIXME("(%p, %p): stub.\n", iface, info); - - return E_NOTIMPL; + TRACE("(%p, %p).\n", iface, count); + *count = 1; + return S_OK; } static HRESULT WINAPI speech_voice_GetTypeInfo(ISpeechVoice *iface, UINT info, LCID lcid, From bffa5db35680f16b5a2a50b48509958aa402039f Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 16 Feb 2024 19:52:33 -0500 Subject: [PATCH 1287/1506] sapi: Implement ISpeechVoice::GetTypeInfo. (cherry picked from commit dd083a6195df6b1b8a98940a76e6d2c7ae99b414) CW-Bug-Id: #22520 --- dlls/sapi/dispatch.c | 1 + dlls/sapi/sapi_private.h | 1 + dlls/sapi/tests/tts.c | 13 +++++++++++++ dlls/sapi/tts.c | 8 ++++---- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/sapi/dispatch.c b/dlls/sapi/dispatch.c index 731ae9ae48f..c1f0e842788 100644 --- a/dlls/sapi/dispatch.c +++ b/dlls/sapi/dispatch.c @@ -36,6 +36,7 @@ static REFIID tid_id[] = { &IID_ISpeechObjectToken, &IID_ISpeechObjectTokens, + &IID_ISpeechVoice, }; HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret) diff --git a/dlls/sapi/sapi_private.h b/dlls/sapi/sapi_private.h index 55e1460ad38..219436f88c1 100644 --- a/dlls/sapi/sapi_private.h +++ b/dlls/sapi/sapi_private.h @@ -57,6 +57,7 @@ enum type_id { ISpeechObjectToken_tid, ISpeechObjectTokens_tid, + ISpeechVoice_tid, last_tid }; diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 8f18934fce3..111d0a0bc6c 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -436,6 +436,8 @@ static void test_spvoice(void) LONG count; BSTR req = NULL, opt = NULL; UINT info_count; + ITypeInfo *typeinfo; + TYPEATTR *typeattr; HRESULT hr; if (waveOutGetNumDevs() == 0) { @@ -719,6 +721,17 @@ static void test_spvoice(void) ok(hr == S_OK, "got %#lx.\n", hr); ok(info_count == 1, "got %u.\n", info_count); + typeinfo = NULL; + typeattr = NULL; + hr = ISpeechVoice_GetTypeInfo(speech_voice, 0, 0, &typeinfo); + ok(hr == S_OK, "got %#lx.\n", hr); + hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(typeattr->typekind == TKIND_DISPATCH, "got %u.\n", typeattr->typekind); + ok(IsEqualGUID(&typeattr->guid, &IID_ISpeechVoice), "got %s.\n", wine_dbgstr_guid(&typeattr->guid)); + ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); + ITypeInfo_Release(typeinfo); + ISpeechVoice_Release(speech_voice); done: diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 2493a2804f2..8e597252b31 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -186,12 +186,12 @@ static HRESULT WINAPI speech_voice_GetTypeInfoCount(ISpeechVoice *iface, UINT *c return S_OK; } -static HRESULT WINAPI speech_voice_GetTypeInfo(ISpeechVoice *iface, UINT info, LCID lcid, +static HRESULT WINAPI speech_voice_GetTypeInfo(ISpeechVoice *iface, UINT index, LCID lcid, ITypeInfo **type_info) { - FIXME("(%p, %u, %lu, %p): stub.\n", iface, info, lcid, type_info); - - return E_NOTIMPL; + TRACE("(%p, %u, %#lx, %p).\n", iface, index, lcid, type_info); + if (index != 0) return DISP_E_BADINDEX; + return get_typeinfo(ISpeechVoice_tid, type_info); } static HRESULT WINAPI speech_voice_GetIDsOfNames(ISpeechVoice *iface, REFIID riid, LPOLESTR *names, From d3590aad2767229a433a9adeeb62f53f8630fc20 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 16 Feb 2024 20:04:41 -0500 Subject: [PATCH 1288/1506] sapi: Implement ISpeechVoice::GetIDsOfNames. (cherry picked from commit 9d044669f3a50fa154cbe4d1d804dee319dbbf09) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 7 +++++++ dlls/sapi/tts.c | 13 ++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 111d0a0bc6c..7566bd5c5cb 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -418,6 +418,7 @@ static void test_spvoice(void) { static const WCHAR test_token_id[] = L"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Speech\\Voices\\Tokens\\WinetestVoice"; static const WCHAR test_text[] = L"Hello! This is a test sentence."; + static const WCHAR *get_voices = L"GetVoices"; ISpVoice *voice; IUnknown *dummy; @@ -438,6 +439,7 @@ static void test_spvoice(void) UINT info_count; ITypeInfo *typeinfo; TYPEATTR *typeattr; + DISPID dispid; HRESULT hr; if (waveOutGetNumDevs() == 0) { @@ -732,6 +734,11 @@ static void test_spvoice(void) ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); ITypeInfo_Release(typeinfo); + dispid = 0xdeadbeef; + hr = ISpeechVoice_GetIDsOfNames(speech_voice, &IID_NULL, (WCHAR **)&get_voices, 1, 0x409, &dispid); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(dispid == DISPID_SVGetVoices, "got %#lx.\n", dispid); + ISpeechVoice_Release(speech_voice); done: diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 8e597252b31..d08b0c5de22 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -195,11 +195,18 @@ static HRESULT WINAPI speech_voice_GetTypeInfo(ISpeechVoice *iface, UINT index, } static HRESULT WINAPI speech_voice_GetIDsOfNames(ISpeechVoice *iface, REFIID riid, LPOLESTR *names, - UINT count, LCID lcid, DISPID *dispid) + UINT count, LCID lcid, DISPID *dispids) { - FIXME("(%p, %s, %p, %u, %lu, %p): stub.\n", iface, debugstr_guid(riid), names, count, lcid, dispid); + ITypeInfo *typeinfo; + HRESULT hr; - return E_NOTIMPL; + TRACE("(%p, %s, %p, %u, %#lx, %p).\n", iface, debugstr_guid(riid), names, count, lcid, dispids); + + if (FAILED(hr = get_typeinfo(ISpeechVoice_tid, &typeinfo))) + return hr; + hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, dispids); + ITypeInfo_Release(typeinfo); + return hr; } static HRESULT WINAPI speech_voice_Invoke(ISpeechVoice *iface, DISPID dispid, REFIID riid, LCID lcid, From fc74e4901ea50c7ae771cb96bcc3d775eff3e14c Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Sat, 17 Feb 2024 00:36:26 -0500 Subject: [PATCH 1289/1506] sapi: Implement ISpeechVoice::Invoke. (cherry picked from commit c72f0ec0f06f19c5b1b443677702e867ee61f361) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 25 +++++++++++++++++++++++++ dlls/sapi/tts.c | 11 +++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 7566bd5c5cb..4d565b35294 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -440,6 +440,8 @@ static void test_spvoice(void) ITypeInfo *typeinfo; TYPEATTR *typeattr; DISPID dispid; + DISPPARAMS params; + VARIANT args[2], ret; HRESULT hr; if (waveOutGetNumDevs() == 0) { @@ -739,6 +741,29 @@ static void test_spvoice(void) ok(hr == S_OK, "got %#lx.\n", hr); ok(dispid == DISPID_SVGetVoices, "got %#lx.\n", dispid); + memset(¶ms, 0, sizeof(params)); + params.cArgs = 2; + params.cNamedArgs = 0; + params.rgvarg = args; + VariantInit(&args[0]); + VariantInit(&args[1]); + V_VT(&args[0]) = VT_BSTR; + V_VT(&args[1]) = VT_BSTR; + V_BSTR(&args[0]) = opt; + V_BSTR(&args[1]) = req; + VariantInit(&ret); + hr = ISpeechVoice_Invoke(speech_voice, dispid, &IID_NULL, 0, DISPATCH_METHOD, ¶ms, &ret, NULL, NULL); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(V_VT(&ret) == VT_DISPATCH, "got %#x.\n", V_VT(&ret)); + hr = IDispatch_QueryInterface(V_DISPATCH(&ret), &IID_ISpeechObjectTokens, (void **)&speech_tokens); + ok(hr == S_OK, "got %#lx.\n", hr); + count = -1; + hr = ISpeechObjectTokens_get_Count(speech_tokens, &count); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(count == 1, "got %ld.\n", count); + ISpeechObjectTokens_Release(speech_tokens); + VariantClear(&ret); + ISpeechVoice_Release(speech_voice); done: diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index d08b0c5de22..d22ffd7a0da 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -213,10 +213,17 @@ static HRESULT WINAPI speech_voice_Invoke(ISpeechVoice *iface, DISPID dispid, RE WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *argerr) { - FIXME("(%p, %ld, %s, %#lx, %#x, %p, %p, %p, %p): stub.\n", iface, dispid, debugstr_guid(riid), + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p, %ld, %s, %#lx, %#x, %p, %p, %p, %p).\n", iface, dispid, debugstr_guid(riid), lcid, flags, params, result, excepinfo, argerr); - return E_NOTIMPL; + if (FAILED(hr = get_typeinfo(ISpeechVoice_tid, &typeinfo))) + return hr; + hr = ITypeInfo_Invoke(typeinfo, iface, dispid, flags, params, result, excepinfo, argerr); + ITypeInfo_Release(typeinfo); + return hr; } static HRESULT WINAPI speech_voice_get_Status(ISpeechVoice *iface, ISpeechVoiceStatus **status) From 55b78c56e0fc34e60e91ae9affcf8a0d30c4a2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 21 Feb 2024 17:25:37 +0100 Subject: [PATCH 1290/1506] winegstreamer/video_decoder: Reset sample timestamp on stream start. CW-Bug-Id: #23248 --- dlls/winegstreamer/video_decoder.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 95a014a46e0..18ac6c0858f 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -600,6 +600,10 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_ case MFT_MESSAGE_COMMAND_FLUSH: return wg_transform_flush(decoder->wg_transform); + case MFT_MESSAGE_NOTIFY_START_OF_STREAM: + decoder->sample_time = 0; + return S_OK; + default: FIXME("Ignoring message %#x.\n", message); return S_OK; From 5a67ab8423d185442f93da138f12ae2bdf087182 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 20 Feb 2024 10:54:45 +0800 Subject: [PATCH 1291/1506] dsound/tests: Test that formats with more than two channels require WAVEFORMATEXTENSIBLE. (cherry picked from commit b3ec5bc7ea3138d7fe8b6a1a5fa441ae305ab413) CW-Bug-Id: #19927 --- dlls/dsound/tests/dsound.c | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index 9656a458415..c957f3a8a4b 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -1481,6 +1481,51 @@ static void perform_invalid_fmt_tests(const char *testname, IDirectSound *dso, I fmtex.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; rc = do_invalid_fmt_test(dso, buf, (WAVEFORMATEX*)&fmtex, &got_buf); ok(rc == E_INVALIDARG, "%s: SetFormat: %08lx\n", testname, rc); + + /* The following 4 tests show that formats with more than two channels require WAVEFORMATEXTENSIBLE */ + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = 2; + wfx.nSamplesPerSec = 44100; + wfx.wBitsPerSample = 16; + wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; + wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; + rc = do_invalid_fmt_test(dso, buf, &wfx, &got_buf); + ok(rc == S_OK, "%s: SetFormat: %08lx\n", testname, rc); + IDirectSoundBuffer_Release(got_buf); + + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = 4; + wfx.nSamplesPerSec = 44100; + wfx.wBitsPerSample = 16; + wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; + wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; + rc = do_invalid_fmt_test(dso, buf, &wfx, &got_buf); + todo_wine + ok(rc == (buf ? DSERR_ALLOCATED : DSERR_INVALIDPARAM), "%s: SetFormat: %08lx\n", testname, rc); + + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = 6; + wfx.nSamplesPerSec = 44100; + wfx.wBitsPerSample = 16; + wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; + wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; + rc = do_invalid_fmt_test(dso, buf, &wfx, &got_buf); + todo_wine + ok(rc == (buf ? DSERR_ALLOCATED : DSERR_INVALIDPARAM), "%s: SetFormat: %08lx\n", testname, rc); + + fmtex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); + fmtex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + fmtex.Format.nChannels = 6; + fmtex.Format.nSamplesPerSec = 44100; + fmtex.Format.wBitsPerSample = 16; + fmtex.Format.nBlockAlign = fmtex.Format.nChannels * fmtex.Format.wBitsPerSample / 8; + fmtex.Format.nAvgBytesPerSec = fmtex.Format.nSamplesPerSec * fmtex.Format.nBlockAlign; + fmtex.Samples.wValidBitsPerSample = fmtex.Format.wBitsPerSample; + fmtex.dwChannelMask = KSAUDIO_SPEAKER_5POINT1; + fmtex.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + rc = do_invalid_fmt_test(dso, buf, (WAVEFORMATEX *)&fmtex, &got_buf); + ok(rc == S_OK, "%s: SetFormat: %08lx\n", testname, rc); + IDirectSoundBuffer_Release(got_buf); } static HRESULT test_invalid_fmts(LPGUID lpGuid) From dda8157564bf82593f85fea75b5eedeb12b1c101 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 20 Feb 2024 11:04:13 +0800 Subject: [PATCH 1292/1506] dsound: Reject WAVEFORMATEX formats with more than two channels. Formats with more than two channels require WAVEFORMATEXTENSIBLE according to tests. Fix Viking: Battle for Asgard (211160) audio cracking in its intro video. (cherry picked from commit 7c7b2e8e7e8c0be1a756e6d7c705b68017459e26) CW-Bug-Id: #19927 --- dlls/dsound/dsound.c | 3 +++ dlls/dsound/primary.c | 3 +++ dlls/dsound/tests/dsound.c | 2 -- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index b1c0c76c367..247d1edcf6b 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -489,6 +489,9 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer( return DSERR_INVALIDPARAM; } + if (dsbd->lpwfxFormat->nChannels > 2 && dsbd->lpwfxFormat->wFormatTag != WAVE_FORMAT_EXTENSIBLE) + return DSERR_INVALIDPARAM; + if (dsbd->lpwfxFormat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { WAVEFORMATEXTENSIBLE *pwfxe = (WAVEFORMATEXTENSIBLE*)dsbd->lpwfxFormat; diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 8cfcd1d8a28..22cf475a674 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -538,6 +538,9 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe return DSERR_INVALIDPARAM; } + if (passed_fmt->nChannels > 2 && passed_fmt->wFormatTag != WAVE_FORMAT_EXTENSIBLE) + return DSERR_ALLOCATED; + /* **** */ AcquireSRWLockExclusive(&device->buffer_list_lock); EnterCriticalSection(&(device->mixlock)); diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index c957f3a8a4b..500bc19f655 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -1500,7 +1500,6 @@ static void perform_invalid_fmt_tests(const char *testname, IDirectSound *dso, I wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; rc = do_invalid_fmt_test(dso, buf, &wfx, &got_buf); - todo_wine ok(rc == (buf ? DSERR_ALLOCATED : DSERR_INVALIDPARAM), "%s: SetFormat: %08lx\n", testname, rc); wfx.wFormatTag = WAVE_FORMAT_PCM; @@ -1510,7 +1509,6 @@ static void perform_invalid_fmt_tests(const char *testname, IDirectSound *dso, I wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; rc = do_invalid_fmt_test(dso, buf, &wfx, &got_buf); - todo_wine ok(rc == (buf ? DSERR_ALLOCATED : DSERR_INVALIDPARAM), "%s: SetFormat: %08lx\n", testname, rc); fmtex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); From e8b8d2f0213eca6129ff3e112626b3096692a688 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 22 Feb 2024 15:45:14 +0800 Subject: [PATCH 1293/1506] fixup! winex11.drv: Listen to RawMotion and RawButton* events in the desktop thread. Fix 7be9a6ec breaks virtual desktop. CW-Bug-Id: #18383 --- dlls/winex11.drv/mouse.c | 5 ----- dlls/winex11.drv/window.c | 3 +++ dlls/winex11.drv/x11drv_main.c | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 1c853e9393f..befc691263f 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -368,11 +368,6 @@ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) mask.deviceid = XIAllMasterDevices; memset( mask_bits, 0, sizeof(mask_bits) ); - if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) - data->xi2_rawinput_only = TRUE; - else - data->xi2_rawinput_only = FALSE; - /* FIXME: steam overlay doesn't like if we use XI2 for non-raw events */ if (event_mask & PointerMotionMask) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f355bb20c8c..db51152e1dc 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2488,6 +2488,9 @@ BOOL X11DRV_CreateWindow( HWND hwnd ) struct x11drv_thread_data *data = x11drv_init_thread_data(); XSetWindowAttributes attr; + data->xi2_rawinput_only = TRUE; + X11DRV_XInput2_Enable( data->display, None, PointerMotionMask | ButtonPressMask | ButtonReleaseMask ); + /* create the cursor clipping window */ attr.override_redirect = TRUE; attr.event_mask = StructureNotifyMask | FocusChangeMask; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 2d3104c2641..19c41ea4945 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -932,9 +932,6 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) if (use_xim) xim_thread_attach( data ); X11DRV_XInput2_Init(); - if (NtUserGetWindowThread( NtUserGetDesktopWindow(), NULL ) == GetCurrentThreadId()) - X11DRV_XInput2_Enable( data->display, None, PointerMotionMask|ButtonPressMask|ButtonReleaseMask ); - return data; } From 000724f6e503d5f5ca3712749a6aed96c1c29805 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 22 Feb 2024 09:42:41 -0600 Subject: [PATCH 1294/1506] amd_ags_x64: Implement multi draw instanced functions. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64.spec | 4 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 104 ++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 4dab7f1e892..9baeed9f69f 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -15,9 +15,9 @@ @ stub agsDriverExtensionsDX11_GetMaxClipRects @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology @ stdcall agsDriverExtensionsDX11_Init(ptr ptr long ptr) -@ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect() DX11_MultiDrawIndexedInstancedIndirect_impl @ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect -@ stub agsDriverExtensionsDX11_MultiDrawInstancedIndirect +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawInstancedIndirect() DX11_MultiDrawInstancedIndirect_impl @ stub agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect @ stub agsDriverExtensionsDX11_NotifyResourceBeginAllAccess @ stub agsDriverExtensionsDX11_NotifyResourceEndAllAccess diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index c402da755b0..c2baad77263 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1126,6 +1126,7 @@ static void get_dx11_extensions_supported(ID3D11Device *device, AGSDX11Extension extensions->depthBoundsTest = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_DEPTH_BOUNDS); extensions->uavOverlap = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_BARRIER_CONTROL); + extensions->multiDrawIndirect = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_MULTI_DRAW_INDIRECT); extensions->UAVOverlapDeferredContexts = extensions->uavOverlap; ID3D11VkExtDevice_Release(ext_device); @@ -1486,6 +1487,109 @@ __ASM_GLOBAL_FUNC( DX11_EndUAVOverlap_impl, "jmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_EndUAVOverlap") ) +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect(AGSContext *context, ID3D11DeviceContext *dx_context, + unsigned int draw_count, ID3D11Buffer *buffer_for_args, unsigned int aligned_byte_offset_for_args, + unsigned int byte_stride_for_args) +{ + ID3D11VkExtContext *ext_context; + + TRACE("context %p, dx_context %p, draw_count %u, buffer_for_args %p, aligned_byte_offset_for_args %u, byte_stride_for_args %u.\n", + context, dx_context, draw_count, buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); + + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + if (!context->extensions.multiDrawIndirect) + return AGS_EXTENSION_NOT_SUPPORTED; + + if (FAILED(ID3D11DeviceContext_QueryInterface(dx_context, &IID_ID3D11VkExtContext, (void **)&ext_context))) + { + TRACE("No ID3D11VkExtContext.\n"); + return AGS_EXTENSION_NOT_SUPPORTED; + } + + ID3D11VkExtContext_MultiDrawIndexedIndirect(ext_context, draw_count, buffer_for_args, aligned_byte_offset_for_args, + byte_stride_for_args); + ID3D11VkExtContext_Release(ext_context); + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect_520(AGSContext *context, + unsigned int draw_count, ID3D11Buffer *buffer_for_args, unsigned int aligned_byte_offset_for_args, + unsigned int byte_stride_for_args) +{ + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + return agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect(context, context->d3d11_context, draw_count, + buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); +} + +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +__ASM_GLOBAL_FUNC( DX11_MultiDrawIndexedInstancedIndirect_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $4,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect_520") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect") ) + + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawInstancedIndirect(AGSContext *context, ID3D11DeviceContext *dx_context, + unsigned int draw_count, ID3D11Buffer *buffer_for_args, unsigned int aligned_byte_offset_for_args, + unsigned int byte_stride_for_args) +{ + ID3D11VkExtContext *ext_context; + + TRACE("context %p, dx_context %p, draw_count %u, buffer_for_args %p, aligned_byte_offset_for_args %u, byte_stride_for_args %u.\n", + context, dx_context, draw_count, buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); + + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + if (!context->extensions.multiDrawIndirect) + return AGS_EXTENSION_NOT_SUPPORTED; + + if (FAILED(ID3D11DeviceContext_QueryInterface(dx_context, &IID_ID3D11VkExtContext, (void **)&ext_context))) + { + TRACE("No ID3D11VkExtContext.\n"); + return AGS_EXTENSION_NOT_SUPPORTED; + } + + ID3D11VkExtContext_MultiDrawIndirect(ext_context, draw_count, buffer_for_args, aligned_byte_offset_for_args, + byte_stride_for_args); + ID3D11VkExtContext_Release(ext_context); + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawInstancedIndirect_520( AGSContext* context, unsigned int draw_count, + ID3D11Buffer *buffer_for_args, unsigned int aligned_byte_offset_for_args, unsigned int byte_stride_for_args) +{ + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + return agsDriverExtensionsDX11_MultiDrawInstancedIndirect(context, context->d3d11_context, draw_count, + buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); +} + +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +__ASM_GLOBAL_FUNC( DX11_MultiDrawInstancedIndirect_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $4,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawInstancedIndirect_520") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawInstancedIndirect") ) + + AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_520(AGSContext *context, ID3D11Device* device, unsigned int *device_ref, ID3D11DeviceContext *device_context, unsigned int *context_ref) From 6861e8c185d4f6471f5cd025530d40fcc30087d3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 22 Feb 2024 10:50:03 -0600 Subject: [PATCH 1295/1506] amd_ags_x64: Implement multi draw instanced indirect count functions. CW-Bug-Id: #22976 --- dlls/amd_ags_x64/amd_ags_x64.spec | 4 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 130 ++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 2 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 9baeed9f69f..edecba85e85 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -16,9 +16,9 @@ @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology @ stdcall agsDriverExtensionsDX11_Init(ptr ptr long ptr) @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect() DX11_MultiDrawIndexedInstancedIndirect_impl -@ stub agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect() DX11_MultiDrawIndexedInstancedIndirectCountIndirect_impl @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawInstancedIndirect() DX11_MultiDrawInstancedIndirect_impl -@ stub agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect +@ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect() DX11_MultiDrawInstancedIndirectCountIndirect_impl @ stub agsDriverExtensionsDX11_NotifyResourceBeginAllAccess @ stub agsDriverExtensionsDX11_NotifyResourceEndAllAccess @ stub agsDriverExtensionsDX11_NotifyResourceEndWrites diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index c2baad77263..65926e54291 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1127,6 +1127,7 @@ static void get_dx11_extensions_supported(ID3D11Device *device, AGSDX11Extension extensions->depthBoundsTest = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_DEPTH_BOUNDS); extensions->uavOverlap = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_BARRIER_CONTROL); extensions->multiDrawIndirect = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_MULTI_DRAW_INDIRECT); + extensions->multiDrawIndirectCountIndirect = !!ID3D11VkExtDevice_GetExtensionSupport(ext_device, D3D11_VK_EXT_MULTI_DRAW_INDIRECT_COUNT); extensions->UAVOverlapDeferredContexts = extensions->uavOverlap; ID3D11VkExtDevice_Release(ext_device); @@ -1589,6 +1590,135 @@ __ASM_GLOBAL_FUNC( DX11_MultiDrawInstancedIndirect_impl, "jmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawInstancedIndirect_520") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawInstancedIndirect") ) +static unsigned int get_max_draw_count(ID3D11Buffer *args, unsigned int offset, unsigned int stride, unsigned int size) +{ + D3D11_BUFFER_DESC desc; + unsigned int count; + + ID3D11Buffer_GetDesc(args, &desc); + if (offset >= desc.ByteWidth) + { + WARN("offset %u, buffer size %u.\n", offset, desc.ByteWidth); + return 0; + } + count = (desc.ByteWidth - offset) / stride; + if (desc.ByteWidth - offset - count * stride >= size) + ++count; + if (!count) + WARN("zero count, buffer size %u, offset %u, stride %u, size %u.\n", desc.ByteWidth, offset, stride, size); + return count; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect(AGSContext *context, ID3D11DeviceContext *dx_context, + ID3D11Buffer *buffer_for_draw_count, unsigned int aligned_byte_offset_for_draw_count, ID3D11Buffer *buffer_for_args, + unsigned int aligned_byte_offset_for_args, unsigned int byte_stride_for_args) +{ + ID3D11VkExtContext *ext_context; + unsigned int max_draw_count; + + TRACE("context %p, dx_context %p, count buffer %p, offset %u, args buffer %p, offset %u, stride %u.\n", + context, dx_context, buffer_for_draw_count, aligned_byte_offset_for_draw_count, buffer_for_args, + aligned_byte_offset_for_args, byte_stride_for_args); + + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + if (!context->extensions.multiDrawIndirectCountIndirect) + return AGS_EXTENSION_NOT_SUPPORTED; + + if (FAILED(ID3D11DeviceContext_QueryInterface(dx_context, &IID_ID3D11VkExtContext, (void **)&ext_context))) + { + TRACE("No ID3D11VkExtContext.\n"); + return AGS_EXTENSION_NOT_SUPPORTED; + } + + max_draw_count = get_max_draw_count(buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args, sizeof(D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS)); + ID3D11VkExtContext_MultiDrawIndexedIndirectCount(ext_context, max_draw_count, buffer_for_draw_count, aligned_byte_offset_for_draw_count, + buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); + ID3D11VkExtContext_Release(ext_context); + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect_520(AGSContext *context, + ID3D11Buffer *buffer_for_draw_count, unsigned int aligned_byte_offset_for_draw_count, ID3D11Buffer *buffer_for_args, + unsigned int aligned_byte_offset_for_args, unsigned int byte_stride_for_args) +{ + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + return agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect(context, context->d3d11_context, + buffer_for_draw_count, aligned_byte_offset_for_draw_count, + buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); +} + +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +__ASM_GLOBAL_FUNC( DX11_MultiDrawIndexedInstancedIndirectCountIndirect_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $4,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect_520") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect") ) + + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect(AGSContext *context, ID3D11DeviceContext *dx_context, + ID3D11Buffer *buffer_for_draw_count, unsigned int aligned_byte_offset_for_draw_count, ID3D11Buffer *buffer_for_args, + unsigned int aligned_byte_offset_for_args, unsigned int byte_stride_for_args) +{ + ID3D11VkExtContext *ext_context; + unsigned int max_draw_count; + + TRACE("context %p, dx_context %p, count buffer %p, offset %u, args buffer %p, offset %u, stride %u.\n", + context, dx_context, buffer_for_draw_count, aligned_byte_offset_for_draw_count, buffer_for_args, + aligned_byte_offset_for_args, byte_stride_for_args); + + if (!context || !dx_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + + if (!context->extensions.multiDrawIndirectCountIndirect) + return AGS_EXTENSION_NOT_SUPPORTED; + + if (FAILED(ID3D11DeviceContext_QueryInterface(dx_context, &IID_ID3D11VkExtContext, (void **)&ext_context))) + { + TRACE("No ID3D11VkExtContext.\n"); + return AGS_EXTENSION_NOT_SUPPORTED; + } + + max_draw_count = get_max_draw_count(buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args, sizeof(D3D11_DRAW_INSTANCED_INDIRECT_ARGS)); + ID3D11VkExtContext_MultiDrawIndirectCount(ext_context, max_draw_count, buffer_for_draw_count, aligned_byte_offset_for_draw_count, + buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); + ID3D11VkExtContext_Release(ext_context); + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect_520(AGSContext *context, + ID3D11Buffer *buffer_for_draw_count, unsigned int aligned_byte_offset_for_draw_count, ID3D11Buffer *buffer_for_args, + unsigned int aligned_byte_offset_for_args, unsigned int byte_stride_for_args) +{ + if (!context || !context->d3d11_context) + { + WARN("Invalid arguments.\n"); + return AGS_INVALID_ARGS; + } + return agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect(context, context->d3d11_context, + buffer_for_draw_count, aligned_byte_offset_for_draw_count, + buffer_for_args, aligned_byte_offset_for_args, byte_stride_for_args); +} + +C_ASSERT(AMD_AGS_VERSION_5_3_0 == 4); +__ASM_GLOBAL_FUNC( DX11_MultiDrawInstancedIndirectCountIndirect_impl, + "mov (%rcx),%eax\n\t" /* version */ + "cmp $4,%eax\n\t" + "jge 1f\n\t" + "jmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect_520") "\n\t" + "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_MultiDrawInstancedIndirectCountIndirect") ) AGSReturnCode WINAPI agsDriverExtensionsDX11_DestroyDevice_520(AGSContext *context, ID3D11Device* device, unsigned int *device_ref, ID3D11DeviceContext *device_context, From 322b88ed403eff9ccc6123d86221493e4dc615c6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 23 Feb 2024 19:13:16 -0600 Subject: [PATCH 1296/1506] nsiproxy.sys: Fix ipv6 route table parsing on Linux. CW-Bug-Id: #23640 --- dlls/nsiproxy.sys/ip.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c index fe49caa6e57..09f033ac634 100644 --- a/dlls/nsiproxy.sys/ip.c +++ b/dlls/nsiproxy.sys/ip.c @@ -1544,7 +1544,7 @@ struct in6_addr str_to_in6_addr(char *nptr, char **endptr) for (int i = 0; i < sizeof(ret); i++) { - if (!isxdigit( *nptr ) || !isxdigit( *nptr + 1 )) + if (!isxdigit( *nptr ) || !isxdigit( *(nptr + 1) )) { /* invalid hex string */ if (endptr) *endptr = nptr; @@ -1574,7 +1574,7 @@ static NTSTATUS ipv6_forward_enumerate_all( void *key_data, UINT key_size, void #ifdef __linux__ { - char buf[512], *ptr; + char buf[512], *ptr, *end; UINT rtf_flags; FILE *fp; @@ -1582,9 +1582,6 @@ static NTSTATUS ipv6_forward_enumerate_all( void *key_data, UINT key_size, void while ((ptr = fgets( buf, sizeof(buf), fp ))) { - while (!isspace( *ptr )) ptr++; - *ptr++ = '\0'; - entry.prefix = str_to_in6_addr( ptr, &ptr ); entry.prefix_len = strtoul( ptr + 1, &ptr, 16 ); str_to_in6_addr( ptr + 1, &ptr ); /* source network, skip */ @@ -1597,6 +1594,10 @@ static NTSTATUS ipv6_forward_enumerate_all( void *key_data, UINT key_size, void entry.protocol = (rtf_flags & RTF_GATEWAY) ? MIB_IPPROTO_NETMGMT : MIB_IPPROTO_LOCAL; entry.loopback = entry.protocol == MIB_IPPROTO_LOCAL && entry.prefix_len == 32; + while (isspace( *ptr )) ptr++; + end = ptr; + while (*end && !isspace(*end)) ++end; + *end = 0; if (!convert_unix_name_to_luid( ptr, &entry.luid )) continue; if (!convert_luid_to_index( &entry.luid, &entry.if_index )) continue; From 11a9ad1bba9ef06a33da0a44126d37d83f38c49b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 23 Feb 2024 17:49:43 -0600 Subject: [PATCH 1297/1506] iphlpapi: Partially fill Ipv4 / Ipv6 metric in GetAdaptersAddresses(). CW-Bug-Id: #23640 --- dlls/iphlpapi/iphlpapi_main.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 9c7582b71fb..207c2ae20d0 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -993,6 +993,7 @@ static DWORD gateway_and_prefix_addresses_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG { struct nsi_ipv4_forward_key *key4; struct nsi_ipv6_forward_key *key6; + struct nsi_ip_forward_rw *rw; IP_ADAPTER_GATEWAY_ADDRESS *gw, **gw_next; IP_ADAPTER_PREFIX *prefix, **prefix_next; DWORD err, count, i, prefix_len, key_size = (family == AF_INET) ? sizeof(*key4) : sizeof(*key6); @@ -1002,11 +1003,14 @@ static DWORD gateway_and_prefix_addresses_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG void *key; err = NsiAllocateAndGetTable( 1, ip_module_id( family ), NSI_IP_FORWARD_TABLE, &key, key_size, - NULL, 0, NULL, 0, NULL, 0, &count, 0 ); + (void **)&rw, sizeof(*rw), NULL, 0, NULL, 0, &count, 0 ); if (err) return err; while (aa) { + if (family == AF_INET) aa->Ipv4Metric = ~0u; + else aa->Ipv6Metric = ~0u; + for (gw_next = &aa->FirstGatewayAddress; *gw_next; gw_next = &(*gw_next)->Next) ; for (prefix_next = &aa->FirstPrefix; *prefix_next; prefix_next = &(*prefix_next)->Next) @@ -1019,6 +1023,12 @@ static DWORD gateway_and_prefix_addresses_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG luid = (family == AF_INET) ? &key4->luid : &key6->luid; if (luid->Value != aa->Luid.Value) continue; + if (rw[i].metric) + { + if (family == AF_INET) aa->Ipv4Metric = min( aa->Ipv4Metric, rw[i].metric ); + else aa->Ipv6Metric = min( aa->Ipv6Metric, rw[i].metric ); + } + if (flags & GAA_FLAG_INCLUDE_GATEWAYS) { memset( &sockaddr, 0, sizeof(sockaddr) ); @@ -1103,7 +1113,7 @@ static DWORD gateway_and_prefix_addresses_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG } err: - NsiFreeTable( key, NULL, NULL, NULL ); + NsiFreeTable( key, rw, NULL, NULL ); return err; } @@ -1269,11 +1279,8 @@ static DWORD adapters_addresses_alloc( ULONG family, ULONG flags, IP_ADAPTER_ADD if (err) goto err; } - if (flags & (GAA_FLAG_INCLUDE_GATEWAYS | GAA_FLAG_INCLUDE_PREFIX)) - { - err = call_families( gateway_and_prefix_addresses_alloc, aa, family, flags ); - if (err) goto err; - } + err = call_families( gateway_and_prefix_addresses_alloc, aa, family, flags ); + if (err) goto err; err = dns_info_alloc( aa, family, flags ); if (err) goto err; From 13a01f89a68fac414ea2bf65155afd80dd45a788 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 13:22:41 -0600 Subject: [PATCH 1298/1506] Revert "win32u: Use font AA flags when querying glyph outline with GGO_METRICS." This reverts commit 7a433892887fb907c94d67ccbb018ccfae08d25f. CW-Bug-Id: #23452 --- dlls/win32u/freetype.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/dlls/win32u/freetype.c b/dlls/win32u/freetype.c index b6f85bf2594..558adb69f9d 100644 --- a/dlls/win32u/freetype.c +++ b/dlls/win32u/freetype.c @@ -3469,7 +3469,6 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT FT_Int load_flags; FT_Matrix transform_matrices[3], *matrices = NULL; BOOL vertical_metrics; - UINT effective_format = format; TRACE("%p, %04x, %08x, %p, %08x, %p, %p\n", font, glyph, format, lpgm, buflen, buf, lpmat); @@ -3479,22 +3478,14 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT matrices = get_transform_matrices( font, tategaki, lpmat, transform_matrices ); - if ((format & ~GGO_GLYPH_INDEX) == GGO_METRICS) - effective_format = font->aa_flags | (format & GGO_GLYPH_INDEX); vertical_metrics = (tategaki && FT_HAS_VERTICAL(ft_face)); /* there is a freetype bug where vertical metrics are only properly scaled and correct in 2.4.0 or greater */ if (vertical_metrics && FT_SimpleVersion < FT_VERSION_VALUE(2, 4, 0)) vertical_metrics = FALSE; - load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices); + load_flags = get_load_flags(format, vertical_metrics, !!matrices); err = pFT_Load_Glyph(ft_face, glyph, load_flags); - if (err && format != effective_format) - { - WARN("Failed to load glyph %#x, retrying with GGO_METRICS. Error %#x.\n", glyph, err); - load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices); - err = pFT_Load_Glyph(ft_face, glyph, load_flags); - } if (err && !(load_flags & FT_LOAD_NO_HINTING)) { WARN("Failed to load glyph %#x, retrying without hinting. Error %#x.\n", glyph, err); From c0cf13bdc9fc1f61fe66196a66932894067a0368 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 13:22:43 -0600 Subject: [PATCH 1299/1506] Revert "win32u: Store effective AA flags in gdi_font." This reverts commit d098d5cf8708edb184f221acb4c19d496b64fa14. CW-Bug-Id: #23452 --- dlls/win32u/font.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 6094ea0261b..c5cf09f56f7 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -4689,7 +4689,6 @@ static HFONT font_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) *aa_flags = font_smoothing; } *aa_flags = font_funcs->get_aa_flags( font, *aa_flags, antialias_fakes ); - font->aa_flags = *aa_flags; } TRACE( "%p %s %d aa %x\n", hfont, debugstr_w(lf.lfFaceName), (int)lf.lfHeight, *aa_flags ); pthread_mutex_unlock( &font_lock ); From f027a1bd2483b978f019b2d0929e66f996d7c50f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 13:37:03 -0600 Subject: [PATCH 1300/1506] win32u: Store effective AA flags in font_physdev. CW-Bug-Id: #22992 --- dlls/win32u/font.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index c5cf09f56f7..48e839a47f3 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -55,6 +55,7 @@ struct font_physdev { struct gdi_physdev dev; struct gdi_font *font; + UINT aa_flags; }; static inline struct font_physdev *get_font_dev( PHYSDEV dev ) @@ -4689,6 +4690,7 @@ static HFONT font_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags ) *aa_flags = font_smoothing; } *aa_flags = font_funcs->get_aa_flags( font, *aa_flags, antialias_fakes ); + physdev->aa_flags = *aa_flags; } TRACE( "%p %s %d aa %x\n", hfont, debugstr_w(lf.lfFaceName), (int)lf.lfHeight, *aa_flags ); pthread_mutex_unlock( &font_lock ); From 333aef5880cf0fe770c7dd66e7d0c58a89102c85 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 15 Nov 2023 21:30:12 -0600 Subject: [PATCH 1301/1506] win32u: Use font AA flags when querying glyph outline with GGO_METRICS. CW-Bug-Id: #22992 --- dlls/win32u/font.c | 16 ++++++++-------- dlls/win32u/freetype.c | 13 +++++++++++-- dlls/win32u/ntgdi_private.h | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 48e839a47f3..08060e0a9b7 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -3851,7 +3851,7 @@ static UINT get_glyph_index_linked( struct gdi_font **font, UINT glyph ) static DWORD get_glyph_outline( struct gdi_font *font, UINT glyph, UINT format, GLYPHMETRICS *gm_ret, ABC *abc_ret, DWORD buflen, void *buf, - const MAT2 *mat ) + const MAT2 *mat, UINT aa_flags ) { GLYPHMETRICS gm; ABC abc; @@ -3885,7 +3885,7 @@ static DWORD get_glyph_outline( struct gdi_font *font, UINT glyph, UINT format, if (format == GGO_METRICS && !mat && get_gdi_font_glyph_metrics( font, index, &gm, &abc )) goto done; - ret = font_funcs->get_glyph_outline( font, index, format, &gm, &abc, buflen, buf, mat, tategaki ); + ret = font_funcs->get_glyph_outline( font, index, format, &gm, &abc, buflen, buf, mat, tategaki, aa_flags ); if (ret == GDI_ERROR) return ret; if (format == GGO_METRICS && !mat) @@ -3934,7 +3934,7 @@ static BOOL font_GetCharABCWidths( PHYSDEV dev, UINT first, UINT count, WCHAR *c for (i = 0; i < count; i++) { c = chars ? chars[i] : first + i; - get_glyph_outline( physdev->font, c, GGO_METRICS, NULL, &buffer[i], 0, NULL, NULL ); + get_glyph_outline( physdev->font, c, GGO_METRICS, NULL, &buffer[i], 0, NULL, NULL, physdev->aa_flags ); } pthread_mutex_unlock( &font_lock ); return TRUE; @@ -3960,7 +3960,7 @@ static BOOL font_GetCharABCWidthsI( PHYSDEV dev, UINT first, UINT count, WORD *g pthread_mutex_lock( &font_lock ); for (c = 0; c < count; c++, buffer++) get_glyph_outline( physdev->font, gi ? gi[c] : first + c, GGO_METRICS | GGO_GLYPH_INDEX, - NULL, buffer, 0, NULL, NULL ); + NULL, buffer, 0, NULL, NULL, physdev->aa_flags ); pthread_mutex_unlock( &font_lock ); return TRUE; } @@ -3987,7 +3987,7 @@ static BOOL font_GetCharWidth( PHYSDEV dev, UINT first, UINT count, const WCHAR for (i = 0; i < count; i++) { c = chars ? chars[i] : i + first; - if (get_glyph_outline( physdev->font, c, GGO_METRICS, NULL, &abc, 0, NULL, NULL ) == GDI_ERROR) + if (get_glyph_outline( physdev->font, c, GGO_METRICS, NULL, &abc, 0, NULL, NULL, physdev->aa_flags ) == GDI_ERROR) buffer[i] = 0; else buffer[i] = abc.abcA + abc.abcB + abc.abcC; @@ -4166,7 +4166,7 @@ static DWORD font_GetGlyphOutline( PHYSDEV dev, UINT glyph, UINT format, return dev->funcs->pGetGlyphOutline( dev, glyph, format, gm, buflen, buf, mat ); } pthread_mutex_lock( &font_lock ); - ret = get_glyph_outline( physdev->font, glyph, format, gm, NULL, buflen, buf, mat ); + ret = get_glyph_outline( physdev->font, glyph, format, gm, NULL, buflen, buf, mat, physdev->aa_flags ); pthread_mutex_unlock( &font_lock ); return ret; } @@ -4346,7 +4346,7 @@ static BOOL font_GetTextExtentExPoint( PHYSDEV dev, const WCHAR *str, INT count, pthread_mutex_lock( &font_lock ); for (i = pos = 0; i < count; i++) { - get_glyph_outline( physdev->font, str[i], GGO_METRICS, NULL, &abc, 0, NULL, NULL ); + get_glyph_outline( physdev->font, str[i], GGO_METRICS, NULL, &abc, 0, NULL, NULL, physdev->aa_flags ); pos += abc.abcA + abc.abcB + abc.abcC; dxs[i] = pos; } @@ -4376,7 +4376,7 @@ static BOOL font_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT co for (i = pos = 0; i < count; i++) { get_glyph_outline( physdev->font, indices[i], GGO_METRICS | GGO_GLYPH_INDEX, - NULL, &abc, 0, NULL, NULL ); + NULL, &abc, 0, NULL, NULL, physdev->aa_flags ); pos += abc.abcA + abc.abcB + abc.abcC; dxs[i] = pos; } diff --git a/dlls/win32u/freetype.c b/dlls/win32u/freetype.c index 558adb69f9d..880b1f8603b 100644 --- a/dlls/win32u/freetype.c +++ b/dlls/win32u/freetype.c @@ -3459,7 +3459,7 @@ static FT_Int get_load_flags( UINT format, BOOL vertical_metrics, BOOL force_no_ */ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT format, GLYPHMETRICS *lpgm, ABC *abc, UINT buflen, void *buf, - const MAT2 *lpmat, BOOL tategaki ) + const MAT2 *lpmat, BOOL tategaki, UINT aa_flags ) { struct gdi_font *base_font = font->base_font ? font->base_font : font; FT_Face ft_face = get_ft_face( font ); @@ -3469,6 +3469,7 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT FT_Int load_flags; FT_Matrix transform_matrices[3], *matrices = NULL; BOOL vertical_metrics; + UINT effective_format = format; TRACE("%p, %04x, %08x, %p, %08x, %p, %p\n", font, glyph, format, lpgm, buflen, buf, lpmat); @@ -3478,14 +3479,22 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT matrices = get_transform_matrices( font, tategaki, lpmat, transform_matrices ); + if (aa_flags && (format & ~GGO_GLYPH_INDEX) == GGO_METRICS) + effective_format = aa_flags | (format & GGO_GLYPH_INDEX); vertical_metrics = (tategaki && FT_HAS_VERTICAL(ft_face)); /* there is a freetype bug where vertical metrics are only properly scaled and correct in 2.4.0 or greater */ if (vertical_metrics && FT_SimpleVersion < FT_VERSION_VALUE(2, 4, 0)) vertical_metrics = FALSE; - load_flags = get_load_flags(format, vertical_metrics, !!matrices); + load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices); err = pFT_Load_Glyph(ft_face, glyph, load_flags); + if (err && format != effective_format) + { + WARN("Failed to load glyph %#x, retrying with GGO_METRICS. Error %#x.\n", glyph, err); + load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices); + err = pFT_Load_Glyph(ft_face, glyph, load_flags); + } if (err && !(load_flags & FT_LOAD_NO_HINTING)) { WARN("Failed to load glyph %#x, retrying without hinting. Error %#x.\n", glyph, err); diff --git a/dlls/win32u/ntgdi_private.h b/dlls/win32u/ntgdi_private.h index 5c4f8279c87..eb82df750ba 100644 --- a/dlls/win32u/ntgdi_private.h +++ b/dlls/win32u/ntgdi_private.h @@ -327,7 +327,7 @@ struct font_backend_funcs UINT (*get_default_glyph)( struct gdi_font *gdi_font ); UINT (*get_glyph_outline)( struct gdi_font *font, UINT glyph, UINT format, GLYPHMETRICS *gm, ABC *abc, UINT buflen, void *buf, - const MAT2 *mat, BOOL tategaki ); + const MAT2 *mat, BOOL tategaki, UINT aa_flags ); UINT (*get_unicode_ranges)( struct gdi_font *font, GLYPHSET *gs ); BOOL (*get_char_width_info)( struct gdi_font *font, struct char_width_info *info ); BOOL (*set_outline_text_metrics)( struct gdi_font *font ); From 73003ac0feb429f100ad7ada1cce3222f87fc986 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 19:33:28 -0600 Subject: [PATCH 1302/1506] faudio: Take lock before accessing list in LinkedList_RemoveEntry(). CW-Bug-Id: #23472 --- libs/faudio/src/FAudio_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/faudio/src/FAudio_internal.c b/libs/faudio/src/FAudio_internal.c index f0d46cfa4b6..7ce57d52a16 100644 --- a/libs/faudio/src/FAudio_internal.c +++ b/libs/faudio/src/FAudio_internal.c @@ -212,9 +212,9 @@ void LinkedList_RemoveEntry( FAudioFreeFunc pFree ) { LinkedList *latest, *prev; + FAudio_PlatformLockMutex(lock); latest = *start; prev = latest; - FAudio_PlatformLockMutex(lock); while (latest != NULL) { if (latest->entry == toRemove) From d497be23aa6940fcb269831cf3f92bc76e3f0444 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 19:34:12 -0600 Subject: [PATCH 1303/1506] faudio: Don't destroy voice when it is output to other voices. CW-Bug-Id: #23472 --- libs/faudio/include/FAudio.h | 2 +- libs/faudio/src/FAudio.c | 61 +++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/libs/faudio/include/FAudio.h b/libs/faudio/include/FAudio.h index 1a873ca2064..1994cd7543b 100644 --- a/libs/faudio/include/FAudio.h +++ b/libs/faudio/include/FAudio.h @@ -1062,7 +1062,7 @@ FAUDIOAPI void FAudioVoice_GetOutputMatrix( ); /* Removes this voice from the audio graph and frees memory. */ -FAUDIOAPI void FAudioVoice_DestroyVoice(FAudioVoice *voice); +FAUDIOAPI uint32_t FAudioVoice_DestroyVoice(FAudioVoice *voice); /* FAudioSourceVoice Interface */ diff --git a/libs/faudio/src/FAudio.c b/libs/faudio/src/FAudio.c index 9366ad58208..2bb1c1fd40d 100644 --- a/libs/faudio/src/FAudio.c +++ b/libs/faudio/src/FAudio.c @@ -2265,11 +2265,69 @@ void FAudioVoice_GetOutputMatrix( LOG_API_EXIT(voice->audio) } -void FAudioVoice_DestroyVoice(FAudioVoice *voice) +static uint32_t check_for_sends_to_voice(FAudioVoice *voice) +{ + FAudio *audio = voice->audio; + uint32_t ret = 1; + FAudioSourceVoice *source; + FAudioSubmixVoice *submix; + LinkedList *list; + uint32_t i; + + FAudio_PlatformLockMutex(audio->sourceLock); + list = audio->sources; + while (list != NULL) + { + source = (FAudioSourceVoice*) list->entry; + for (i = 0; i < source->sends.SendCount; i += 1) + if (source->sends.pSends[i].pOutputVoice == voice) + { + ret = 0; + break; + } + if (!ret) + break; + list = list->next; + } + FAudio_PlatformUnlockMutex(audio->sourceLock); + + if (!ret) + return ret; + + FAudio_PlatformLockMutex(audio->submixLock); + list = audio->submixes; + while (list != NULL) + { + submix = (FAudioSubmixVoice*) list->entry; + for (i = 0; i < submix->sends.SendCount; i += 1) + if (submix->sends.pSends[i].pOutputVoice == voice) + { + ret = 0; + break; + } + list = list->next; + } + FAudio_PlatformUnlockMutex(audio->submixLock); + + return ret; +} + +uint32_t FAudioVoice_DestroyVoice(FAudioVoice *voice) { uint32_t i; LOG_API_ENTER(voice->audio) + if (!check_for_sends_to_voice(voice)) + { + LOG_ERROR( + voice->audio, + "Voice %p is an output for other voice(s)", + voice + ) + LOG_API_EXIT(voice->audio) + return 0; + } + /* TODO: Check for dependencies and remove from audio graph first! */ FAudio_OPERATIONSET_ClearAllForVoice(voice); @@ -2443,6 +2501,7 @@ void FAudioVoice_DestroyVoice(FAudioVoice *voice) LOG_API_EXIT(voice->audio) FAudio_Release(voice->audio); voice->audio->pFree(voice); + return 1; } /* FAudioSourceVoice Interface */ From 431fdeb1e1537d04452a14c11df83569848b2a53 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 19:34:40 -0600 Subject: [PATCH 1304/1506] xaudio2: Check FAudioVoice_DestroyVoice result in destroy_voice(). CW-Bug-Id: #23472 --- dlls/xaudio2_7/xaudio_dll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index b821e9667b7..b1ef81b632e 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -499,7 +499,11 @@ static const FAudioEngineCallback FAudioEngineCallback_Vtbl = { static inline void destroy_voice(XA2VoiceImpl *This) { - FAudioVoice_DestroyVoice(This->faudio_voice); + if (!FAudioVoice_DestroyVoice(This->faudio_voice)) + { + ERR("Destroying voice %p failed.\n", This); + return; + } free_effect_chain(This->effect_chain); This->effect_chain = NULL; This->in_use = FALSE; From 448429cb322a68f0def96715e3756b59a324636b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 19:38:10 -0600 Subject: [PATCH 1305/1506] xaudio2/tests: Test destroying a voice which is an output to another one. CW-Bug-Id: #23472 --- dlls/xaudio2_7/tests/xaudio2.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dlls/xaudio2_7/tests/xaudio2.c b/dlls/xaudio2_7/tests/xaudio2.c index 2b3102d21fe..70d9ec78aee 100644 --- a/dlls/xaudio2_7/tests/xaudio2.c +++ b/dlls/xaudio2_7/tests/xaudio2.c @@ -837,7 +837,9 @@ static void test_submix(IXAudio2 *xa) HRESULT hr; IXAudio2MasteringVoice *master; XAUDIO2_VOICE_DETAILS details; - IXAudio2SubmixVoice *sub; + IXAudio2SubmixVoice *sub, *sub2; + XAUDIO2_SEND_DESCRIPTOR send_desc = { 0 }; + XAUDIO2_VOICE_SENDS sends = {1, &send_desc }; IXAudio2_StopEngine(xa); @@ -855,6 +857,26 @@ static void test_submix(IXAudio2 *xa) ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels); ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate); + hr = IXAudio2_CreateSubmixVoice(xa, &sub2, 2, 44100, 0, 0, NULL, NULL); + ok(hr == S_OK, "CreateSubmixVoice failed: %08lx\n", hr); + + send_desc.pOutputVoice = (IXAudio2Voice *)sub2; + hr = IXAudio2SubmixVoice_SetOutputVoices(sub, &sends); + ok(hr == S_OK, "CreateSubmixVoice failed: %08lx\n", hr); + + IXAudio2SubmixVoice_DestroyVoice(sub2); + IXAudio2SubmixVoice_GetVoiceDetails(sub2, &details); + + sends.SendCount = 0; + hr = IXAudio2SubmixVoice_SetOutputVoices(sub, &sends); + ok(hr == S_OK, "CreateSubmixVoice failed: %08lx\n", hr); + + IXAudio2SubmixVoice_DestroyVoice(sub2); + if (0) + { + IXAudio2SubmixVoice_GetVoiceDetails(sub2, &details); + } + IXAudio2SubmixVoice_DestroyVoice(sub); IXAudio2MasteringVoice_DestroyVoice(master); } From 0d86a4153947c2db1550dab1ca0a260ceeabf2c0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 27 Feb 2024 21:27:44 -0600 Subject: [PATCH 1306/1506] kernelbase: Use KEY_WOW64_64KEY flag when 64 bit registry access is assumed. CW-Bug-Id: #23481 --- dlls/advapi32/tests/registry.c | 22 ++++++++++++++++++++++ dlls/kernelbase/registry.c | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 30a79368c94..428dffed48d 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -2763,6 +2763,28 @@ static void test_redirection(void) RegCloseKey( root32 ); RegCloseKey( root64 ); + err = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"Software\\WOW6432Node\\test1\\test2", 0, NULL, 0, + KEY_WRITE | KEY_WOW64_32KEY, NULL, &key, NULL ); + ok(!err, "got %#lx.\n", err); + RegCloseKey(key); + + err = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"Software\\test1\\test2", 0, NULL, 0, KEY_WRITE | KEY_WOW64_32KEY, + NULL, &key, NULL ); + ok(!err, "got %#lx.\n", err); + RegCloseKey(key); + + err = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\test1\\test2", 0, KEY_WRITE | KEY_WOW64_32KEY, &key ); + ok(!err, "got %#lx.\n", err); + RegCloseKey(key); + + if (pRegDeleteTreeA) + { + err = pRegDeleteTreeA(HKEY_LOCAL_MACHINE, "Software\\WOW6432Node\\test1"); + ok(!err, "got %#lx.\n", err); + err = pRegDeleteTreeA(HKEY_LOCAL_MACHINE, "Software\\test1"); + ok(err == ERROR_FILE_NOT_FOUND, "got %#lx.\n", err); + } + /* Software\Classes is shared/reflected so behavior is different */ err = RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Classes\\Wine", diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c index a767d993254..dcdb1cf84eb 100644 --- a/dlls/kernelbase/registry.c +++ b/dlls/kernelbase/registry.c @@ -165,7 +165,7 @@ static HANDLE open_wow6432node( HANDLE key ) attr.Attributes = 0; attr.SecurityDescriptor = NULL; attr.SecurityQualityOfService = NULL; - if (NtOpenKeyEx( &ret, MAXIMUM_ALLOWED, &attr, 0 )) return key; + if (NtOpenKeyEx( &ret, MAXIMUM_ALLOWED | KEY_WOW64_64KEY, &attr, 0 )) return key; return ret; } @@ -211,7 +211,7 @@ static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING *name, DWORD o static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWORD options, ACCESS_MASK access ) { BOOL is_wow64_key = (is_win64 && (access & KEY_WOW64_32KEY)) || (is_wow64 && !(access & KEY_WOW64_64KEY)); - ACCESS_MASK access_64 = access & ~KEY_WOW64_32KEY; + ACCESS_MASK access_64 = (access & ~KEY_WOW64_32KEY) | KEY_WOW64_64KEY; DWORD i = 0, len = name->Length / sizeof(WCHAR); WCHAR *buffer = name->Buffer; UNICODE_STRING str; From f55fa9a546b146c3a7444db5196e8b4a4f56ba4b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 28 Feb 2024 11:41:41 -0600 Subject: [PATCH 1307/1506] amd_ags_x64: Support v3.2. CW-Bug-Id: #23474 --- dlls/amd_ags_x64/amd_ags.h | 17 ++++++++ dlls/amd_ags_x64/amd_ags_x64.spec | 3 ++ dlls/amd_ags_x64/amd_ags_x64_main.c | 67 +++++++++++++++++++++++++++-- 3 files changed, 83 insertions(+), 4 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 8eab0732d5b..0116a527ba5 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -733,7 +733,24 @@ typedef union AGSConfiguration AGSConfiguration_520 agsConfiguration520; } AGSConfiguration; +struct AGSGPUInfo_320 +{ + int agsVersionMajor; // Major field of Major.Minor.Patch AGS version number + int agsVersionMinor; // Minor field of Major.Minor.Patch AGS version number + int agsVersionPatch; // Patch field of Major.Minor.Patch AGS version number + + ArchitectureVersion architectureVersion; // Set to Unknown if not AMD hardware + const char* adapterString; // The adapter name string. NULL if not AMD hardware + int deviceId; // The device id + int revisionId; // The revision id + + const char* driverVersion; // The driver package version + int iNumCUs; // Number of GCN compute units. Zero if not GCN + int iCoreClock; // core clock speed at 100% power in MHz + int iMemoryClock; // memory clock speed at 100% power in MHz + float fTFlops; // Teraflops of GPU. Zero if not GCN. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD +}; /// The top level GPU information returned from \ref agsInitialize struct AGSGPUInfo_403 diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index edecba85e85..bd2d2f6dceb 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -2,18 +2,21 @@ @ stdcall agsDeInitialize(ptr) @ stdcall agsCheckDriverVersion(ptr long) @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_BeginUAVOverlap() DX11_BeginUAVOverlap_impl +@ stub agsDriverExtensions_IASetPrimitiveTopology @ stub agsDriverExtensionsDX11_CreateBuffer @ stdcall agsDriverExtensionsDX11_CreateDevice(ptr ptr ptr ptr) @ stub agsDriverExtensionsDX11_CreateFromDevice @ stub agsDriverExtensionsDX11_CreateTexture1D @ stub agsDriverExtensionsDX11_CreateTexture2D @ stub agsDriverExtensionsDX11_CreateTexture3D +@ stdcall agsDriverExtensions_DeInit(ptr) @ stdcall agsDriverExtensionsDX11_DeInit(ptr) @ stub agsDriverExtensionsDX11_Destroy @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_DestroyDevice() @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_EndUAVOverlap() DX11_EndUAVOverlap_impl @ stub agsDriverExtensionsDX11_GetMaxClipRects @ stub agsDriverExtensionsDX11_IASetPrimitiveTopology +@ stdcall agsDriverExtensions_Init(ptr ptr ptr) @ stdcall agsDriverExtensionsDX11_Init(ptr ptr long ptr) @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirect() DX11_MultiDrawIndexedInstancedIndirect_impl @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_MultiDrawIndexedInstancedIndirectCountIndirect() DX11_MultiDrawIndexedInstancedIndirectCountIndirect_impl diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 65926e54291..398c7317237 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -74,7 +74,7 @@ static const struct } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {AGS_MAKE_VERSION(4, 0, 0), AGS_MAKE_VERSION(4, 0, 3), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(3, 2, 0), AGS_MAKE_VERSION(4, 0, 3), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 0, 0), AGS_MAKE_VERSION(5, 0, 6), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 1, 1), AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 2, 0), AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, @@ -364,13 +364,20 @@ static BOOL get_ags_version_from_resource(const WCHAR *filename, enum amd_ags_ve return TRUE; } -static enum amd_ags_version guess_version_from_exports(HMODULE hnative) +static enum amd_ags_version guess_version_from_exports(HMODULE hnative, int *ags_version) { /* Known DLL versions without version info: * - An update to AGS 5.4.1 included an amd_ags_x64.dll with no file version info; * - CoD: Modern Warfare Remastered (2017) ships dll without version info which is version 5.0.1 * (not tagged in AGSSDK history), compatible with 5.0.5. */ + if (GetProcAddress(hnative, "agsDriverExtensions_Init")) + { + /* agsGetEyefinityConfigInfo was deprecated in 4.0.0 */ + TRACE("agsDriverExtensions_Init found.\n"); + *ags_version = AGS_MAKE_VERSION(3, 2, 2); + return AMD_AGS_VERSION_4_0_3; + } if (GetProcAddress(hnative, "agsGetEyefinityConfigInfo")) { /* agsGetEyefinityConfigInfo was deprecated in 5.0.0 */ @@ -440,7 +447,7 @@ static enum amd_ags_version determine_ags_version(int *ags_version) goto done; } - ret = guess_version_from_exports(hnative); + ret = guess_version_from_exports(hnative, ags_version); done: if (!*ags_version) @@ -829,7 +836,47 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi return ret; } - if (object->version <= AMD_AGS_VERSION_4_0_3) + if (object->public_version <= AGS_MAKE_VERSION(3, 2, 2)) + { + /* Unfortunately it doesn't look sanely possible to distinguish 3.2.2 and 3.2.0 versions, while in + * 3.2.2 radeonSoftwareVersion was added in the middle of the structure. So fill the shorter one + * to avoid out of bound write. */ + struct AGSDeviceInfo_511 *devices = (struct AGSDeviceInfo_511 *)object->devices, *device; + struct AGSGPUInfo_320 *info = (struct AGSGPUInfo_320 *)gpu_info; + unsigned int i; + + TRACE("filling AGSGPUInfo_320.\n"); + if (!object->device_count) + { + ERR("No devices.\n"); + agsDeInit(object); + return AGS_FAILURE; + } + + for (i = 0; i < object->device_count; ++i) + if (devices[i].isPrimaryDevice) + break; + if (i == object->device_count) + { + WARN("No primary device, using first.\n"); + i = 0; + } + device = &devices[i]; + memset(info, 0, sizeof(*info)); + info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); + info->agsVersionMinor = AGS_VER_MINOR(object->public_version); + info->agsVersionPatch = AGS_VER_PATCH(object->public_version); + info->architectureVersion = device->architectureVersion; + info->adapterString = device->adapterString; + info->deviceId = device->deviceId; + info->revisionId = device->revisionId; + info->driverVersion = driver_version; + info->iNumCUs = device->numCUs; + info->iCoreClock = device->coreClock; + info->iMemoryClock = device->memoryClock; + info->fTFlops = device->teraFlops; + } + else if (object->version <= AMD_AGS_VERSION_4_0_3) { struct AGSDeviceInfo_511 *devices = (struct AGSDeviceInfo_511 *)object->devices, *device; struct AGSGPUInfo_403 *info = (struct AGSGPUInfo_403 *)gpu_info; @@ -1303,6 +1350,13 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_Init( AGSContext *context, ID3D11De return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensions_Init( AGSContext* context, ID3D11Device* device, unsigned int* extensionsSupported ) +{ + TRACE("context %p, device %p, extensionsSupported %p.\n", context, device, extensionsSupported); + + return agsDriverExtensionsDX11_Init(context, device, ~0u, extensionsSupported); +} + AGSReturnCode WINAPI agsDriverExtensionsDX11_DeInit( AGSContext* context ) { TRACE("context %p.\n", context); @@ -1316,6 +1370,11 @@ AGSReturnCode WINAPI agsDriverExtensionsDX11_DeInit( AGSContext* context ) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensions_DeInit(AGSContext *context) +{ + return agsDriverExtensionsDX11_DeInit(context); +} + AGSReturnCode WINAPI agsDriverExtensionsDX12_Init( AGSContext* context, ID3D12Device* device, unsigned int* extensionsSupported ) { FIXME("context %p, device %p, extensionsSupported %p stub.\n", context, device, extensionsSupported); From a0e1f531dfe4e72999793d2e52ed1a8fb9534ca8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 28 Feb 2024 14:08:00 -0600 Subject: [PATCH 1308/1506] amd_ags_x64: Support versions 3.0-3.1. CW-Bug-Id: #23474 --- dlls/amd_ags_x64/amd_ags.h | 15 +++++++ dlls/amd_ags_x64/amd_ags_x64.spec | 1 + dlls/amd_ags_x64/amd_ags_x64_main.c | 68 +++++++++++++++++++++++++++-- 3 files changed, 81 insertions(+), 3 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags.h b/dlls/amd_ags_x64/amd_ags.h index 0116a527ba5..f6e50cad8f3 100644 --- a/dlls/amd_ags_x64/amd_ags.h +++ b/dlls/amd_ags_x64/amd_ags.h @@ -733,6 +733,21 @@ typedef union AGSConfiguration AGSConfiguration_520 agsConfiguration520; } AGSConfiguration; +struct AGSGPUInfo_311 +{ + ArchitectureVersion version; // Set to Unknown if not AMD hardware + const char* adapterString; // The adapter name string. NULL if not AMD hardware + int deviceId; // The device id + int revisionId; // The revision id + + const char* driverVersion; // The driver package version + + int iNumCUs; // Number of GCN compute units. Zero if not GCN + int iCoreClock; // core clock speed at 100% power in MHz + int iMemoryClock; // memory clock speed at 100% power in MHz + float fTFlops; // Teraflops of GPU. Zero if not GCN. Calculated from iCoreClock * iNumCUs * 64 Pixels/clk * 2 instructions/MAD +}; + struct AGSGPUInfo_320 { int agsVersionMajor; // Major field of Major.Minor.Patch AGS version number diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index bd2d2f6dceb..a742c951709 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -49,3 +49,4 @@ @ stdcall agsGetTotalGPUCount(ptr ptr) @ stdcall agsGetGPUMemorySize(ptr long ptr) @ stdcall agsGetEyefinityConfigInfo(ptr long ptr ptr ptr) +@ stdcall agsDriverExtensions_SetCrossfireMode(ptr long) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 398c7317237..961aca242f9 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -74,7 +74,7 @@ static const struct } amd_ags_info[AMD_AGS_VERSION_COUNT] = { - {AGS_MAKE_VERSION(3, 2, 0), AGS_MAKE_VERSION(4, 0, 3), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, + {AGS_MAKE_VERSION(3, 1, 0), AGS_MAKE_VERSION(4, 0, 3), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 0, 0), AGS_MAKE_VERSION(5, 0, 6), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 1, 1), AGS_MAKE_VERSION(5, 1, 1), sizeof(AGSDeviceInfo_511), sizeof(AGSDX11ReturnedParams_511), 0}, {AGS_MAKE_VERSION(5, 2, 0), AGS_MAKE_VERSION(5, 2, 1), sizeof(AGSDeviceInfo_520), sizeof(AGSDX11ReturnedParams_520), 0}, @@ -371,6 +371,13 @@ static enum amd_ags_version guess_version_from_exports(HMODULE hnative, int *ags * - CoD: Modern Warfare Remastered (2017) ships dll without version info which is version 5.0.1 * (not tagged in AGSSDK history), compatible with 5.0.5. */ + if (GetProcAddress(hnative, "agsDriverExtensions_SetCrossfireMode")) + { + /* agsDriverExtensions_SetCrossfireMode was deprecated in 3.2.0 */ + TRACE("agsDriverExtensions_SetCrossfireMode found.\n"); + *ags_version = AGS_MAKE_VERSION(3, 1, 1); + return AMD_AGS_VERSION_4_0_3; + } if (GetProcAddress(hnative, "agsDriverExtensions_Init")) { /* agsGetEyefinityConfigInfo was deprecated in 4.0.0 */ @@ -821,7 +828,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi TRACE("context %p, config %p, gpu_info %p.\n", context, config, gpu_info); - if (!context || !gpu_info) + if (!context) return AGS_INVALID_ARGS; if (config) @@ -836,7 +843,46 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi return ret; } - if (object->public_version <= AGS_MAKE_VERSION(3, 2, 2)) + if (object->public_version <= AGS_MAKE_VERSION(3, 1, 1)) + { + /* Unfortunately it doesn't look sanely possible to distinguish 3.1.1 and 3.1.0 versions, while in + * 3.1.0 radeonSoftwareVersion was present, removed in 3.1.1 and brought back in 3.2.2. */ + struct AGSDeviceInfo_511 *devices = (struct AGSDeviceInfo_511 *)object->devices, *device; + /* config parameter was added in 3.2.0, so gpu_info is actually the second parameter. */ + struct AGSGPUInfo_311 *info = (struct AGSGPUInfo_311 *)config; + unsigned int i; + + if (!info) + return AGS_INVALID_ARGS; + + TRACE("filling AGSGPUInfo_311.\n"); + if (!object->device_count) + { + ERR("No devices.\n"); + agsDeInit(object); + return AGS_FAILURE; + } + + for (i = 0; i < object->device_count; ++i) + if (devices[i].isPrimaryDevice) + break; + if (i == object->device_count) + { + WARN("No primary device, using first.\n"); + i = 0; + } + device = &devices[i]; + memset(info, 0, sizeof(*info)); + info->adapterString = device->adapterString; + info->deviceId = device->deviceId; + info->revisionId = device->revisionId; + info->driverVersion = driver_version; + info->iNumCUs = device->numCUs; + info->iCoreClock = device->coreClock; + info->iMemoryClock = device->memoryClock; + info->fTFlops = device->teraFlops; + } + else if (object->public_version <= AGS_MAKE_VERSION(3, 2, 2)) { /* Unfortunately it doesn't look sanely possible to distinguish 3.2.2 and 3.2.0 versions, while in * 3.2.2 radeonSoftwareVersion was added in the middle of the structure. So fill the shorter one @@ -845,6 +891,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi struct AGSGPUInfo_320 *info = (struct AGSGPUInfo_320 *)gpu_info; unsigned int i; + if (!gpu_info) + return AGS_INVALID_ARGS; + TRACE("filling AGSGPUInfo_320.\n"); if (!object->device_count) { @@ -882,6 +931,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi struct AGSGPUInfo_403 *info = (struct AGSGPUInfo_403 *)gpu_info; unsigned int i; + if (!gpu_info) + return AGS_INVALID_ARGS; + if (!object->device_count) { ERR("No devices.\n"); @@ -915,6 +967,9 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi } else { + if (!gpu_info) + return AGS_INVALID_ARGS; + memset(gpu_info, 0, sizeof(*gpu_info)); gpu_info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); gpu_info->agsVersionMinor = AGS_VER_MINOR(object->public_version); @@ -1357,6 +1412,13 @@ AGSReturnCode WINAPI agsDriverExtensions_Init( AGSContext* context, ID3D11Device return agsDriverExtensionsDX11_Init(context, device, ~0u, extensionsSupported); } +AGSReturnCode WINAPI agsDriverExtensions_SetCrossfireMode(AGSContext *context, AGSCrossfireMode mode) +{ + FIXME("context %p, mode %d stub.\n", context, mode); + + return AGS_SUCCESS; +} + AGSReturnCode WINAPI agsDriverExtensionsDX11_DeInit( AGSContext* context ) { TRACE("context %p.\n", context); From b90040301ba80464061de5bac8453ace292b64e6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 28 Feb 2024 14:43:55 -0600 Subject: [PATCH 1309/1506] amd_ags_x64: Add agsDriverExtensionsDX11_SetDiskShaderCacheEnabled() stub. CW-Bug-Id: #23474 --- dlls/amd_ags_x64/amd_ags_x64.spec | 2 +- dlls/amd_ags_x64/amd_ags_x64_main.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index a742c951709..3dcd52d5308 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -28,7 +28,7 @@ @ stub agsDriverExtensionsDX11_NumPendingAsyncCompileJobs @ stub agsDriverExtensionsDX11_SetClipRects @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_SetDepthBounds() DX11_SetDepthBounds_impl -@ stub agsDriverExtensionsDX11_SetDiskShaderCacheEnabled +@ stdcall agsDriverExtensionsDX11_SetDiskShaderCacheEnabled(ptr long) @ stub agsDriverExtensionsDX11_SetMaxAsyncCompileThreadCount @ stub agsDriverExtensionsDX11_SetViewBroadcastMasks @ stub agsDriverExtensionsDX11_WriteBreadcrumb diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 961aca242f9..c605520632e 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1888,3 +1888,9 @@ __ASM_GLOBAL_FUNC( agsDriverExtensionsDX11_DestroyDevice, "jmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_511") "\n\t" "1:\tjmp " __ASM_NAME("agsDriverExtensionsDX11_DestroyDevice_520") ) #endif + +AGSReturnCode WINAPI agsDriverExtensionsDX11_SetDiskShaderCacheEnabled(AGSContext *context, int enable) +{ + FIXME("context %p, enable %d stub.\n", context, enable); + return AGS_SUCCESS; +} From b1f019e0a50bac41194caa55c245f60c964a26dd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 27 Feb 2024 11:09:41 -0600 Subject: [PATCH 1310/1506] Revert "faudio: Don't destroy voice when it is output to other voices." This reverts commit d497be23aa6940fcb269831cf3f92bc76e3f0444. --- libs/faudio/include/FAudio.h | 2 +- libs/faudio/src/FAudio.c | 61 +----------------------------------- 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/libs/faudio/include/FAudio.h b/libs/faudio/include/FAudio.h index 1994cd7543b..1a873ca2064 100644 --- a/libs/faudio/include/FAudio.h +++ b/libs/faudio/include/FAudio.h @@ -1062,7 +1062,7 @@ FAUDIOAPI void FAudioVoice_GetOutputMatrix( ); /* Removes this voice from the audio graph and frees memory. */ -FAUDIOAPI uint32_t FAudioVoice_DestroyVoice(FAudioVoice *voice); +FAUDIOAPI void FAudioVoice_DestroyVoice(FAudioVoice *voice); /* FAudioSourceVoice Interface */ diff --git a/libs/faudio/src/FAudio.c b/libs/faudio/src/FAudio.c index 2bb1c1fd40d..9366ad58208 100644 --- a/libs/faudio/src/FAudio.c +++ b/libs/faudio/src/FAudio.c @@ -2265,69 +2265,11 @@ void FAudioVoice_GetOutputMatrix( LOG_API_EXIT(voice->audio) } -static uint32_t check_for_sends_to_voice(FAudioVoice *voice) -{ - FAudio *audio = voice->audio; - uint32_t ret = 1; - FAudioSourceVoice *source; - FAudioSubmixVoice *submix; - LinkedList *list; - uint32_t i; - - FAudio_PlatformLockMutex(audio->sourceLock); - list = audio->sources; - while (list != NULL) - { - source = (FAudioSourceVoice*) list->entry; - for (i = 0; i < source->sends.SendCount; i += 1) - if (source->sends.pSends[i].pOutputVoice == voice) - { - ret = 0; - break; - } - if (!ret) - break; - list = list->next; - } - FAudio_PlatformUnlockMutex(audio->sourceLock); - - if (!ret) - return ret; - - FAudio_PlatformLockMutex(audio->submixLock); - list = audio->submixes; - while (list != NULL) - { - submix = (FAudioSubmixVoice*) list->entry; - for (i = 0; i < submix->sends.SendCount; i += 1) - if (submix->sends.pSends[i].pOutputVoice == voice) - { - ret = 0; - break; - } - list = list->next; - } - FAudio_PlatformUnlockMutex(audio->submixLock); - - return ret; -} - -uint32_t FAudioVoice_DestroyVoice(FAudioVoice *voice) +void FAudioVoice_DestroyVoice(FAudioVoice *voice) { uint32_t i; LOG_API_ENTER(voice->audio) - if (!check_for_sends_to_voice(voice)) - { - LOG_ERROR( - voice->audio, - "Voice %p is an output for other voice(s)", - voice - ) - LOG_API_EXIT(voice->audio) - return 0; - } - /* TODO: Check for dependencies and remove from audio graph first! */ FAudio_OPERATIONSET_ClearAllForVoice(voice); @@ -2501,7 +2443,6 @@ uint32_t FAudioVoice_DestroyVoice(FAudioVoice *voice) LOG_API_EXIT(voice->audio) FAudio_Release(voice->audio); voice->audio->pFree(voice); - return 1; } /* FAudioSourceVoice Interface */ From 3d9f50f785446bd1be7fa9eb404b184a87c2cf66 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 27 Feb 2024 11:09:53 -0600 Subject: [PATCH 1311/1506] Revert "xaudio2: Check FAudioVoice_DestroyVoice result in destroy_voice()." This reverts commit 431fdeb1e1537d04452a14c11df83569848b2a53. --- dlls/xaudio2_7/xaudio_dll.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index b1ef81b632e..b821e9667b7 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -499,11 +499,7 @@ static const FAudioEngineCallback FAudioEngineCallback_Vtbl = { static inline void destroy_voice(XA2VoiceImpl *This) { - if (!FAudioVoice_DestroyVoice(This->faudio_voice)) - { - ERR("Destroying voice %p failed.\n", This); - return; - } + FAudioVoice_DestroyVoice(This->faudio_voice); free_effect_chain(This->effect_chain); This->effect_chain = NULL; This->in_use = FALSE; From a15d41172479dc04ac0ac0bf461132d6520aef5b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 28 Feb 2024 18:19:35 -0600 Subject: [PATCH 1312/1506] faudio: Don't destroy voice when it is output to other voices (cherry-picked from FAudio commit c00b01caa6e3f0dce09af6676ff55936e97b451c) CW-Bug-Id: #23472 --- libs/faudio/include/FAudio.h | 5 +++ libs/faudio/src/FAudio.c | 68 +++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/libs/faudio/include/FAudio.h b/libs/faudio/include/FAudio.h index 1a873ca2064..16837c39dbf 100644 --- a/libs/faudio/include/FAudio.h +++ b/libs/faudio/include/FAudio.h @@ -1064,6 +1064,11 @@ FAUDIOAPI void FAudioVoice_GetOutputMatrix( /* Removes this voice from the audio graph and frees memory. */ FAUDIOAPI void FAudioVoice_DestroyVoice(FAudioVoice *voice); +/* + * Returns S_OK on success and E_FAIL if voice could not be destroyed (e. g., because it is in use). + */ +FAUDIOAPI uint32_t FAudioVoice_DestroyVoiceSafeEXT(FAudioVoice *voice); + /* FAudioSourceVoice Interface */ /* Starts processing for a source voice. diff --git a/libs/faudio/src/FAudio.c b/libs/faudio/src/FAudio.c index 9366ad58208..67cbfb770e4 100644 --- a/libs/faudio/src/FAudio.c +++ b/libs/faudio/src/FAudio.c @@ -2265,11 +2265,71 @@ void FAudioVoice_GetOutputMatrix( LOG_API_EXIT(voice->audio) } -void FAudioVoice_DestroyVoice(FAudioVoice *voice) +static uint32_t check_for_sends_to_voice(FAudioVoice *voice) { + FAudio *audio = voice->audio; + uint32_t ret = 0; + FAudioSourceVoice *source; + FAudioSubmixVoice *submix; + LinkedList *list; uint32_t i; + + FAudio_PlatformLockMutex(audio->sourceLock); + list = audio->sources; + while (list != NULL) + { + source = (FAudioSourceVoice*) list->entry; + for (i = 0; i < source->sends.SendCount; i += 1) + if (source->sends.pSends[i].pOutputVoice == voice) + { + ret = 0x80004005; /* E_FAIL */ + break; + } + if (ret) + break; + list = list->next; + } + FAudio_PlatformUnlockMutex(audio->sourceLock); + + if (ret) + return ret; + + FAudio_PlatformLockMutex(audio->submixLock); + list = audio->submixes; + while (list != NULL) + { + submix = (FAudioSubmixVoice*) list->entry; + for (i = 0; i < submix->sends.SendCount; i += 1) + if (submix->sends.pSends[i].pOutputVoice == voice) + { + ret = 0x80004005; /* E_FAIL */ + break; + } + if (ret) + break; + list = list->next; + } + FAudio_PlatformUnlockMutex(audio->submixLock); + + return ret; +} + +uint32_t FAudioVoice_DestroyVoiceSafeEXT(FAudioVoice *voice) +{ + uint32_t i, ret; LOG_API_ENTER(voice->audio) + if ((ret = check_for_sends_to_voice(voice))) + { + LOG_ERROR( + voice->audio, + "Voice %p is an output for other voice(s)", + voice + ) + LOG_API_EXIT(voice->audio) + return ret; + } + /* TODO: Check for dependencies and remove from audio graph first! */ FAudio_OPERATIONSET_ClearAllForVoice(voice); @@ -2443,6 +2503,12 @@ void FAudioVoice_DestroyVoice(FAudioVoice *voice) LOG_API_EXIT(voice->audio) FAudio_Release(voice->audio); voice->audio->pFree(voice); + return 0; +} + +void FAudioVoice_DestroyVoice(FAudioVoice *voice) +{ + FAudioVoice_DestroyVoiceSafeEXT(voice); } /* FAudioSourceVoice Interface */ From 4fb3f2e70942d84e99b8a32024cf75423c6cb3d7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 26 Feb 2024 19:34:40 -0600 Subject: [PATCH 1313/1506] xaudio2: Use FAudioVoice_DestroyVoiceSafeEXT() result in destroy_voice(). CW-Bug-Id: #23472 --- dlls/xaudio2_7/xaudio_dll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index b821e9667b7..a58beb7b538 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -499,7 +499,11 @@ static const FAudioEngineCallback FAudioEngineCallback_Vtbl = { static inline void destroy_voice(XA2VoiceImpl *This) { - FAudioVoice_DestroyVoice(This->faudio_voice); + if (FAILED(FAudioVoice_DestroyVoiceSafeEXT(This->faudio_voice))) + { + ERR("Destroying voice %p failed.\n", This); + return; + } free_effect_chain(This->effect_chain); This->effect_chain = NULL; This->in_use = FALSE; From 3a6319bd5469012e9617c2b84d0aebab757c9572 Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Wed, 28 Feb 2024 00:59:28 -0600 Subject: [PATCH 1314/1506] wine.inf: Add a font replacement for Segoe UI. CW-Bug-Id: #23020 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 7ce0638c7df..bcb4c80a4d1 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -603,6 +603,7 @@ HKLM,%FontsNT%,"Webdings (TrueType)",,"webdings.ttf" HKLM,%FontsNT%,"Wingdings (TrueType)",,"wingdings.ttf" HKCU,Software\Wine\Fonts\Replacements,"Palatino Linotype",,"Times New Roman" HKCU,Software\Wine\Fonts\Replacements,"Verdana",,"Times New Roman" +HKCU,Software\Wine\Fonts\Replacements,"Segoe UI",,"Times New Roman" [MCI] HKLM,%Mci32Str%,"AVIVideo",,"mciavi32.dll" From cb977b5a5b369b623940810d24108f283b61d002 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 29 Feb 2024 17:17:11 +0200 Subject: [PATCH 1315/1506] amend! nsiproxy.sys: Fix ipv6 route table parsing on Linux. nsiproxy.sys: Fix ipv6 route table parsing on Linux. CW-Bug-Id: #23460 From 2f38ce9d95fe4cc0340c1f3987499b30405dabda Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 29 Feb 2024 17:18:19 +0200 Subject: [PATCH 1316/1506] amend! iphlpapi: Partially fill Ipv4 / Ipv6 metric in GetAdaptersAddresses(). iphlpapi: Partially fill Ipv4 / Ipv6 metric in GetAdaptersAddresses(). CW-Bug-Id: #23460 From f392d0687cb74f47dbfceb4a57b496191f183969 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 29 Feb 2024 20:02:48 -0600 Subject: [PATCH 1317/1506] fixup! ntdll: Read process memory on the client side in NtReadVirtualMemory(). CW-Bug-Id: #23456 --- dlls/ntdll/unix/virtual.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index ba2fe258ede..97b55022c7a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -6305,13 +6305,21 @@ NTSTATUS WINAPI NtReadVirtualMemory( HANDLE process, const void *addr, void *buf int unix_pid; ssize_t ret; - SERVER_START_REQ( read_process_memory ) + if (process == NtCurrentProcess()) { - req->handle = wine_server_obj_handle( process ); - status = wine_server_call( req ); - unix_pid = reply->unix_pid; + unix_pid = getpid(); + status = STATUS_SUCCESS; + } + else + { + SERVER_START_REQ( read_process_memory ) + { + req->handle = wine_server_obj_handle( process ); + status = wine_server_call( req ); + unix_pid = reply->unix_pid; + } + SERVER_END_REQ; } - SERVER_END_REQ; if (status) { From c651e01d987feca64d56e7f02bab5ca12e4eba6d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 29 Feb 2024 22:21:25 -0600 Subject: [PATCH 1318/1506] amd_ags_x64: Add spec stubs for some v3.x functions. CW-Bug-Id: #23474 --- dlls/amd_ags_x64/amd_ags_x64.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 3dcd52d5308..7c5e3fb8f69 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -4,11 +4,15 @@ @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_BeginUAVOverlap() DX11_BeginUAVOverlap_impl @ stub agsDriverExtensions_IASetPrimitiveTopology @ stub agsDriverExtensionsDX11_CreateBuffer +@ stub agsDriverExtensions_CreateBuffer @ stdcall agsDriverExtensionsDX11_CreateDevice(ptr ptr ptr ptr) @ stub agsDriverExtensionsDX11_CreateFromDevice @ stub agsDriverExtensionsDX11_CreateTexture1D @ stub agsDriverExtensionsDX11_CreateTexture2D @ stub agsDriverExtensionsDX11_CreateTexture3D +@ stub agsDriverExtensions_CreateTexture1D +@ stub agsDriverExtensions_CreateTexture2D +@ stub agsDriverExtensions_CreateTexture3D @ stdcall agsDriverExtensions_DeInit(ptr) @ stdcall agsDriverExtensionsDX11_DeInit(ptr) @ stub agsDriverExtensionsDX11_Destroy @@ -25,6 +29,9 @@ @ stub agsDriverExtensionsDX11_NotifyResourceBeginAllAccess @ stub agsDriverExtensionsDX11_NotifyResourceEndAllAccess @ stub agsDriverExtensionsDX11_NotifyResourceEndWrites +@ stub agsDriverExtensions_NotifyResourceBeginAllAccess +@ stub agsDriverExtensions_NotifyResourceEndAllAccess +@ stub agsDriverExtensions_NotifyResourceEndWrites @ stub agsDriverExtensionsDX11_NumPendingAsyncCompileJobs @ stub agsDriverExtensionsDX11_SetClipRects @ stdcall -norelay -arch=win64 agsDriverExtensionsDX11_SetDepthBounds() DX11_SetDepthBounds_impl From 42de3d209c2b30d3169caa70bb123fa6cd289797 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 4 Mar 2024 09:47:32 +0800 Subject: [PATCH 1319/1506] HACK: ntdll: Extend heap zero hack to private heaps. Call of Juarez: Bound in Blood (21980) uses uninitialized memory from msvcr80.operator_new(), which allocates memory from a private heap created specifically for MSVC runtime. CW-Bug-Id: #23466 --- dlls/ntdll/heap.c | 4 ++++ dlls/ntdll/loader.c | 2 +- dlls/ntdll/ntdll_misc.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 7819f8bdfd7..981836f28a7 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -329,6 +329,7 @@ C_ASSERT( HEAP_MIN_LARGE_BLOCK_SIZE <= HEAP_INITIAL_GROW_SIZE ); #define HEAP_CHECKING_ENABLED 0x80000000 BOOL delay_heap_free = FALSE; +BOOL heap_zero_hack = FALSE; static struct heap *process_heap; /* main process heap */ @@ -1519,6 +1520,9 @@ HANDLE WINAPI RtlCreateHeap( ULONG flags, void *addr, SIZE_T total_size, SIZE_T TRACE( "flags %#lx, addr %p, total_size %#Ix, commit_size %#Ix, unknown %p, definition %p\n", flags, addr, total_size, commit_size, unknown, definition ); + if (heap_zero_hack) + flags |= HEAP_ZERO_MEMORY; + flags &= ~(HEAP_TAIL_CHECKING_ENABLED|HEAP_FREE_CHECKING_ENABLED); if (process_heap) flags |= HEAP_PRIVATE; if (!process_heap || !total_size || (flags & HEAP_SHARED)) flags |= HEAP_GROWABLE; diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 8ddd5c66022..8dfe4e21e10 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4478,7 +4478,7 @@ void loader_init( CONTEXT *context, void **entry ) if (get_env( L"WINE_HEAP_ZERO_MEMORY", env_str, sizeof(env_str)) && env_str[0] == L'1') { ERR( "Enabling heap zero hack.\n" ); - heap_flags |= HEAP_ZERO_MEMORY; + heap_zero_hack = TRUE; } peb->ProcessHeap = RtlCreateHeap( heap_flags, NULL, 0, 0, NULL, NULL ); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 623acc1da00..af4d8b57348 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -48,6 +48,7 @@ extern UINT_PTR page_size; #endif extern BOOL delay_heap_free; +extern BOOL heap_zero_hack; /* exceptions */ extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context ); From 4c1fd4711e967c64b24a5834150f1131602afdda Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 4 Mar 2024 12:13:46 +0800 Subject: [PATCH 1320/1506] advapi32: Check NULL return key pointers when creating registry keys. Fix Warlords Battlecry III (433280) crashes at launch. CW-Bug-Id: #23484 --- dlls/advapi32/registry.c | 6 ++++++ dlls/kernelbase/registry.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 85e883bdcc9..e3226c38d0a 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -70,6 +70,9 @@ LSTATUS WINAPI RegOverridePredefKey( HKEY hkey, HKEY override ) */ LSTATUS WINAPI RegCreateKeyW( HKEY hkey, LPCWSTR lpSubKey, PHKEY phkResult ) { + if (!phkResult) + return ERROR_INVALID_PARAMETER; + return RegCreateKeyExW( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, MAXIMUM_ALLOWED, NULL, phkResult, NULL ); } @@ -82,6 +85,9 @@ LSTATUS WINAPI RegCreateKeyW( HKEY hkey, LPCWSTR lpSubKey, PHKEY phkResult ) */ LSTATUS WINAPI RegCreateKeyA( HKEY hkey, LPCSTR lpSubKey, PHKEY phkResult ) { + if (!phkResult) + return ERROR_INVALID_PARAMETER; + return RegCreateKeyExA( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, MAXIMUM_ALLOWED, NULL, phkResult, NULL ); } diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c index dcdb1cf84eb..ee57a4acdd1 100644 --- a/dlls/kernelbase/registry.c +++ b/dlls/kernelbase/registry.c @@ -592,6 +592,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD { UNICODE_STRING nameW, classW; + if (!retkey) return ERROR_BADKEY; if (reserved) return ERROR_INVALID_PARAMETER; if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; @@ -633,6 +634,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD ANSI_STRING nameA, classA; NTSTATUS status; + if (!retkey) return ERROR_BADKEY; if (reserved) return ERROR_INVALID_PARAMETER; if (!is_version_nt()) { From 53ea94e1ca8cb7de198ce89f7094e9966b92ecf6 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 4 Mar 2024 12:09:45 +0800 Subject: [PATCH 1321/1506] advapi32/tests: Test creating registry keys with a NULL return key pointer. CW-Bug-Id: #23484 --- dlls/advapi32/tests/registry.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 428dffed48d..ecfdbbe547e 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1268,6 +1268,19 @@ static void test_reg_create_key(void) PACL key_acl; SECURITY_DESCRIPTOR *sd; + /* NULL return key check */ + ret = RegCreateKeyA(hkey_main, "Subkey1", NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %ld.\n", ret); + + ret = RegCreateKeyW(hkey_main, L"Subkey1", NULL); + ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %ld.\n", ret); + + ret = RegCreateKeyExA(hkey_main, "Subkey1", 0, NULL, 0, KEY_NOTIFY, NULL, NULL, NULL); + ok(ret == ERROR_BADKEY, "Got unexpected ret %ld.\n", ret); + + ret = RegCreateKeyExW(hkey_main, L"Subkey1", 0, NULL, 0, KEY_NOTIFY, NULL, NULL, NULL); + ok(ret == ERROR_BADKEY, "Got unexpected ret %ld.\n", ret); + ret = RegCreateKeyExA(hkey_main, "Subkey1", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL); ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret); /* should succeed: all versions of Windows ignore the access rights From bed19d0c8d8623f5ac12a22d2a64a08495e89267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 28 Jan 2024 19:32:11 +0100 Subject: [PATCH 1322/1506] winex11: Process XInput2 events with QS_INPUT filter. (cherry picked from commit b341688dbd9dfc05bd61d6b8f494867e6343b702) CW-Bug-Id: #23502 --- dlls/winex11.drv/event.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 89a7506b236..ab151e28350 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -233,28 +233,6 @@ static Bool filter_event( Display *display, XEvent *event, char *arg ) case ButtonPress: case ButtonRelease: return (mask & QS_MOUSEBUTTON) != 0; -#ifdef GenericEvent - case GenericEvent: -#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - if (event->xcookie.extension == xinput2_opcode) - { - switch (event->xcookie.evtype) - { - case XI_RawButtonPress: - case XI_RawButtonRelease: - return (mask & QS_MOUSEBUTTON) != 0; - case XI_RawMotion: - case XI_RawTouchBegin: - case XI_RawTouchUpdate: - case XI_RawTouchEnd: - return (mask & QS_INPUT) != 0; - case XI_DeviceChanged: - return (mask & (QS_INPUT|QS_MOUSEBUTTON)) != 0; - } - } -#endif - return (mask & QS_SENDMESSAGE) != 0; -#endif case MotionNotify: case EnterNotify: case LeaveNotify: @@ -269,6 +247,13 @@ static Bool filter_event( Display *display, XEvent *event, char *arg ) case PropertyNotify: case ClientMessage: return (mask & QS_POSTMESSAGE) != 0; +#ifdef GenericEvent + case GenericEvent: +#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H + if (event->xcookie.extension == xinput2_opcode) return (mask & QS_INPUT) != 0; +#endif + /* fallthrough */ +#endif default: return (mask & QS_SENDMESSAGE) != 0; } From 847dbe5ad93c04fdf698af5eab1147cfabf247c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 28 Jan 2024 18:22:51 +0100 Subject: [PATCH 1323/1506] winex11: Initialize XInput2 extension on every thread. (cherry picked from commit b7867059ceea7e4448fd294e4b5ac9d1bf8e03e9) CW-Bug-Id: #23502 --- dlls/winex11.drv/mouse.c | 21 ++++++++++----------- dlls/winex11.drv/x11drv.h | 5 +++-- dlls/winex11.drv/x11drv_main.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index befc691263f..b2e1bedc0b3 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -331,22 +331,21 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes /*********************************************************************** - * X11DRV_XInput2_Init + * x11drv_xinput2_init */ -void X11DRV_XInput2_Init(void) +void x11drv_xinput2_init( struct x11drv_thread_data *data ) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - struct x11drv_thread_data *data = x11drv_thread_data(); int major = 2, minor = 2; - if (xinput2_available && pXIQueryVersion( data->display, &major, &minor ) == Success && - pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) - TRACE( "XInput2 %d.%d available\n", major, minor ); - else + if (!xinput2_available || pXIQueryVersion( data->display, &major, &minor )) { - data->xi2_core_pointer = 0; - WARN( "XInput 2.2 not available\n" ); + WARN( "XInput 2.0 not available\n" ); + xinput2_available = FALSE; + return; } + + TRACE( "XInput2 %d.%d available\n", major, minor ); #endif } @@ -1942,9 +1941,9 @@ static BOOL X11DRV_XIDeviceEvent( XIDeviceEvent *event ) #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ /*********************************************************************** - * X11DRV_XInput2_Load + * x11drv_xinput2_load */ -void X11DRV_XInput2_Load(void) +void x11drv_xinput2_load(void) { #if defined(SONAME_LIBXI) int event, error; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9d3f742cbad..605a59fe3d3 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -266,8 +266,6 @@ extern void X11DRV_ThreadDetach(void); /* X11 driver internal functions */ extern void X11DRV_Xcursor_Init(void); -extern void X11DRV_XInput2_Load(void); -extern void X11DRV_XInput2_Init(void); extern void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ); extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, @@ -597,6 +595,9 @@ extern BOOL X11DRV_MappingNotify( HWND hWnd, XEvent *event ); extern BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *event ); extern int xinput2_opcode; +extern void x11drv_xinput2_load(void); +extern void x11drv_xinput2_init( struct x11drv_thread_data *data ); + extern Bool (*pXGetEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event ); extern void (*pXFreeEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 19c41ea4945..a5eb1416c99 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -804,7 +804,7 @@ static NTSTATUS x11drv_init( void *arg ) #ifdef SONAME_LIBXCOMPOSITE X11DRV_XComposite_Init(); #endif - X11DRV_XInput2_Load(); + x11drv_xinput2_load(); XkbUseExtension( gdi_display, NULL, NULL ); X11DRV_InitKeyboard( gdi_display ); @@ -930,8 +930,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) NtUserGetThreadInfo()->driver_data = (UINT_PTR)data; if (use_xim) xim_thread_attach( data ); + x11drv_xinput2_init( data ); - X11DRV_XInput2_Init(); return data; } From ea3f64a81f282c7f7a1f3b6ccff31a0c2ac84240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 12 Feb 2024 10:00:55 +0100 Subject: [PATCH 1324/1506] winex11: Always listen to XInput2 device changes events. (cherry picked from commit 51e99345de4d2e2a7c5db939e9add141bd8c30f6) CW-Bug-Id: #23502 --- dlls/winex11.drv/mouse.c | 59 ++++++++++++++++++++------------------- dlls/winex11.drv/x11drv.h | 2 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index b2e1bedc0b3..71711f609ae 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -336,7 +336,10 @@ static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes void x11drv_xinput2_init( struct x11drv_thread_data *data ) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H + unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; int major = 2, minor = 2; + XIEventMask mask; + int count; if (!xinput2_available || pXIQueryVersion( data->display, &major, &minor )) { @@ -346,6 +349,22 @@ void x11drv_xinput2_init( struct x11drv_thread_data *data ) } TRACE( "XInput2 %d.%d available\n", major, minor ); + + mask.mask = mask_bits; + mask.mask_len = sizeof(mask_bits); + mask.deviceid = XIAllMasterDevices; + memset( mask_bits, 0, sizeof(mask_bits) ); + XISetMask( mask_bits, XI_DeviceChanged ); + pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); + + if (!pXIGetClientPointer( data->display, None, &data->xinput2_pointer )) + WARN( "Failed to get xinput2 master pointer device\n" ); + else + { + XIDeviceInfo *pointer_info = pXIQueryDevice( data->display, data->xinput2_pointer, &count ); + update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); + pXIFreeDeviceInfo( pointer_info ); + } #endif } @@ -355,12 +374,9 @@ void x11drv_xinput2_init( struct x11drv_thread_data *data ) */ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) { - struct x11drv_thread_data *data = x11drv_thread_data(); unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; BOOL raw = (window == None); - XIDeviceInfo *pointer_info; XIEventMask mask; - int count; mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); @@ -369,34 +385,19 @@ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) /* FIXME: steam overlay doesn't like if we use XI2 for non-raw events */ - if (event_mask & PointerMotionMask) - { - XISetMask( mask_bits, XI_DeviceChanged ); - if (raw) - { - XISetMask( mask_bits, XI_RawMotion ); - XISetMask( mask_bits, XI_RawTouchBegin ); - XISetMask( mask_bits, XI_RawTouchUpdate ); - XISetMask( mask_bits, XI_RawTouchEnd ); - } - } - if (event_mask & ButtonPressMask) + if (raw && event_mask) { - XISetMask( mask_bits, XI_DeviceChanged ); - if (raw) XISetMask( mask_bits, XI_RawButtonPress ); - } - if (event_mask & ButtonReleaseMask) - { - XISetMask( mask_bits, XI_DeviceChanged ); - if (raw) XISetMask( mask_bits, XI_RawButtonRelease ); + XISetMask( mask_bits, XI_RawMotion ); + XISetMask( mask_bits, XI_RawTouchBegin ); + XISetMask( mask_bits, XI_RawTouchUpdate ); + XISetMask( mask_bits, XI_RawTouchEnd ); + XISetMask( mask_bits, XI_RawButtonPress ); + XISetMask( mask_bits, XI_RawButtonRelease ); } + XISetMask( mask_bits, XI_DeviceChanged ); pXISelectEvents( display, raw ? DefaultRootWindow( display ) : window, &mask, 1 ); if (!raw) XSelectInput( display, window, event_mask ); - - pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count ); - update_relative_valuators( pointer_info->classes, pointer_info->num_classes ); - pXIFreeDeviceInfo( pointer_info ); } #endif @@ -1694,7 +1695,7 @@ static BOOL X11DRV_XIDeviceChangedEvent( XIDeviceChangedEvent *event ) { struct x11drv_thread_data *data = x11drv_thread_data(); - if (event->deviceid != data->xi2_core_pointer) return FALSE; + if (event->deviceid != data->xinput2_pointer) return FALSE; if (event->reason != XISlaveSwitch) return FALSE; update_relative_valuators( event->classes, event->num_classes ); @@ -1714,7 +1715,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input, RAWINPUT *raw if (x->number < 0 || y->number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; - if (event->deviceid != thread_data->xi2_core_pointer) return FALSE; + if (event->deviceid != thread_data->xinput2_pointer) return FALSE; if (x->mode == XIModeRelative && y->mode == XIModeRelative) input->mi.dwFlags &= ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); @@ -1859,7 +1860,7 @@ static BOOL X11DRV_RawButtonEvent( XGenericEventCookie *cookie ) button = pointer_mapping->buttons[button] - 1; if (button < 0 || button >= NB_BUTTONS) return FALSE; - if (event->deviceid != thread_data->xi2_core_pointer) return FALSE; + if (event->deviceid != thread_data->xinput2_pointer) return FALSE; TRACE( "raw button %u (raw: %u) %s\n", button, event->detail, event->evtype == XI_RawButtonRelease ? "up" : "down" ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 605a59fe3d3..4032ab85e9a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -398,7 +398,7 @@ struct x11drv_thread_data #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; - int xi2_core_pointer; /* XInput2 core pointer id */ + int xinput2_pointer; /* XInput2 core pointer id */ int xi2_rawinput_only; int xi2_active_touches; int xi2_primary_touchid; From 33e756b0c735e732fea161e6edee08b2ca557c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 4 Mar 2024 15:00:48 +0100 Subject: [PATCH 1325/1506] fixup! winex11.drv: Keep track of pointer and device button mappings. CW-Bug-Id: #23502 --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index e8338e9eb50..708c8269fc2 100644 --- a/configure.ac +++ b/configure.ac @@ -1238,6 +1238,7 @@ then dnl *** All of the following tests require X11/Xlib.h AC_CHECK_HEADERS([X11/extensions/shape.h \ + X11/extensions/XInput.h \ X11/extensions/XInput2.h \ X11/extensions/XShm.h \ X11/extensions/Xfixes.h \ From 35e491c3b36cebb1abadffc7fc127355f77d8d73 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 4 Mar 2024 18:51:54 +0100 Subject: [PATCH 1326/1506] dbghelp: Stop embedding unwind info in minidumps (X86_64). CW-Bug-Id: https://www.codeweavers.com/support/bugs/browse/?cmd=bug_edit;bug_id=23456 --- dlls/dbghelp/cpu_x86_64.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/dlls/dbghelp/cpu_x86_64.c b/dlls/dbghelp/cpu_x86_64.c index eeae1f042b2..23ed5271128 100644 --- a/dlls/dbghelp/cpu_x86_64.c +++ b/dlls/dbghelp/cpu_x86_64.c @@ -951,44 +951,7 @@ static BOOL x86_64_fetch_minidump_thread(struct dump_context* dc, unsigned index static BOOL x86_64_fetch_minidump_module(struct dump_context* dc, unsigned index, unsigned flags) { - /* FIXME: not sure about the flags... */ - if (1) - { - /* FIXME: crop values across module boundaries, */ -#ifdef __x86_64__ - struct process* pcs; - struct module* module; - const RUNTIME_FUNCTION* rtf; - ULONG size; - - if (!(pcs = process_find_by_handle(dc->process->handle)) || - !(module = module_find_by_addr(pcs, dc->modules[index].base))) - return FALSE; - rtf = (const RUNTIME_FUNCTION*)pe_map_directory(module, IMAGE_DIRECTORY_ENTRY_EXCEPTION, &size); - if (rtf) - { - const RUNTIME_FUNCTION* end = (const RUNTIME_FUNCTION*)((const char*)rtf + size); - UNWIND_INFO ui; - - while (rtf + 1 < end) - { - while (rtf->UnwindData & 1) /* follow chained entry */ - { - FIXME("RunTime_Function outside IMAGE_DIRECTORY_ENTRY_EXCEPTION unimplemented yet!\n"); - return FALSE; - /* we need to read into the other process */ - /* rtf = (RUNTIME_FUNCTION*)(module->module.BaseOfImage + (rtf->UnwindData & ~1)); */ - } - if (read_process_memory(dc->process, dc->modules[index].base + rtf->UnwindData, &ui, sizeof(ui))) - minidump_add_memory_block(dc, dc->modules[index].base + rtf->UnwindData, - FIELD_OFFSET(UNWIND_INFO, UnwindCode) + ui.CountOfCodes * sizeof(UNWIND_CODE), 0); - rtf++; - } - } -#endif - } - - return TRUE; + return FALSE; } struct cpu cpu_x86_64 = { From 3eeca96f1e1ab1427165a04001b93d0ac01fe575 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Mar 2024 12:28:48 -0600 Subject: [PATCH 1327/1506] amd_ags_x64: Add WINE_HIDE_APU option. CW-Bug-Id: #23489 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index c605520632e..0ec45bc293d 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -706,6 +706,20 @@ static void init_device_displays_511(const char *adapter_name, AGSDisplayInfo_51 heap_free(displays); } +static int hide_apu(void) +{ + static int cached = -1; + + if (cached == -1) + { + const char *s; + + cached = ((s = getenv("WINE_HIDE_APU"))) && *s != '0'; + if (cached) + FIXME("hack: hiding APU.\n"); + } + return cached; +} static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) { @@ -780,7 +794,7 @@ static AGSReturnCode init_ags_context(AGSContext *context, int ags_version) { SET_DEVICE_FIELD(device, asicFamily, AsicFamily, context->version, AsicFamily_GCN4); } - if (vk_properties->deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) + if (vk_properties->deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU && !hide_apu()) { if (context->version >= AMD_AGS_VERSION_6_0_0) device_600->isAPU = 1; From c45f4b8d94460e6fe83d561e19ece4cbc0124aa2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Mar 2024 14:37:03 -0600 Subject: [PATCH 1328/1506] winegstreamer: HACK: Do not enable low latency for Gungrave G.O.R.E. CW-Bug-Id: #23455 --- dlls/winegstreamer/video_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 18ac6c0858f..3e42d04d75a 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -116,7 +116,7 @@ static HRESULT try_create_wg_transform(struct video_decoder *decoder) { const char *sgi; - if ((sgi = getenv("SteamGameId")) && ((!strcmp(sgi, "2009100")) || (!strcmp(sgi, "2555360")))) + if ((sgi = getenv("SteamGameId")) && (!strcmp(sgi, "2009100") || !strcmp(sgi, "2555360") || !strcmp(sgi, "1630110"))) attrs.low_latency = FALSE; } From ce93000cfa80f7dafd1ccb83cd051f64348c3365 Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Thu, 29 Feb 2024 11:46:06 +1100 Subject: [PATCH 1329/1506] mshtml: Pass DOMEvent instead of nsIDOMEvent during handle_event. CW-Bug-Id: #23425 (cherry picked from commit 277acf61d0fb8e5d36fbadda8ecb349dd3dcc435) --- dlls/mshtml/htmlanchor.c | 8 ++++---- dlls/mshtml/htmlarea.c | 8 ++++---- dlls/mshtml/htmlelem.c | 6 +++--- dlls/mshtml/htmlevent.c | 2 +- dlls/mshtml/htmlevent.h | 4 ++-- dlls/mshtml/htmlform.c | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 7d2ad328890..147a5b9cbe6 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -829,13 +829,13 @@ static void HTMLAnchorElement_unlink(DispatchEx *dispex) unlink_ref(&This->nsanchor); } -static HRESULT HTMLAnchorElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +static HRESULT HTMLAnchorElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default) { HTMLAnchorElement *This = impl_from_DispatchEx(dispex); nsAString href_str, target_str; nsresult nsres; - if(eid == EVENTID_CLICK) { + if(event->event_id == EVENTID_CLICK) { nsAString_Init(&href_str, NULL); nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str); if (NS_FAILED(nsres)) { @@ -850,14 +850,14 @@ static HRESULT HTMLAnchorElement_handle_event(DispatchEx *dispex, eventid_t eid, goto fallback; } - return handle_link_click_event(&This->element, &href_str, &target_str, event, prevent_default); + return handle_link_click_event(&This->element, &href_str, &target_str, event->nsevent, prevent_default); fallback: nsAString_Finish(&href_str); nsAString_Finish(&target_str); } - return HTMLElement_handle_event(&This->element.node.event_target.dispex, eid, event, prevent_default); + return HTMLElement_handle_event(&This->element.node.event_target.dispex, event, prevent_default); } static const NodeImplVtbl HTMLAnchorElementImplVtbl = { diff --git a/dlls/mshtml/htmlarea.c b/dlls/mshtml/htmlarea.c index c4cb109039a..1b9be40baab 100644 --- a/dlls/mshtml/htmlarea.c +++ b/dlls/mshtml/htmlarea.c @@ -439,13 +439,13 @@ static void HTMLAreaElement_unlink(DispatchEx *dispex) unlink_ref(&This->nsarea); } -static HRESULT HTMLAreaElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +static HRESULT HTMLAreaElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default) { HTMLAreaElement *This = impl_from_DispatchEx(dispex); nsAString href_str, target_str; nsresult nsres; - if(eid == EVENTID_CLICK) { + if(event->event_id == EVENTID_CLICK) { nsAString_Init(&href_str, NULL); nsres = nsIDOMHTMLAreaElement_GetHref(This->nsarea, &href_str); if (NS_FAILED(nsres)) { @@ -460,14 +460,14 @@ static HRESULT HTMLAreaElement_handle_event(DispatchEx *dispex, eventid_t eid, n goto fallback; } - return handle_link_click_event(&This->element, &href_str, &target_str, event, prevent_default); + return handle_link_click_event(&This->element, &href_str, &target_str, event->nsevent, prevent_default); fallback: nsAString_Finish(&href_str); nsAString_Finish(&target_str); } - return HTMLElement_handle_event(&This->element.node.event_target.dispex, eid, event, prevent_default); + return HTMLElement_handle_event(&This->element.node.event_target.dispex, event, prevent_default); } static const NodeImplVtbl HTMLAreaElementImplVtbl = { diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 6fcab0cf89f..cbec1368eaa 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -7083,16 +7083,16 @@ void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid) ensure_doc_nsevent_handler(This->node.doc, This->node.nsnode, eid); } -HRESULT HTMLElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +HRESULT HTMLElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default) { HTMLElement *This = impl_from_DispatchEx(dispex); - switch(eid) { + switch(event->event_id) { case EVENTID_KEYDOWN: { nsIDOMKeyEvent *key_event; nsresult nsres; - nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event); + nsres = nsIDOMEvent_QueryInterface(event->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event); if(NS_SUCCEEDED(nsres)) { UINT32 code = 0; diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index bba0970d7ce..485fb8c3f39 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -5165,7 +5165,7 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event, vtbl = dispex_get_vtbl(&target_chain[i]->dispex); if(!vtbl->handle_event) continue; - hres = vtbl->handle_event(&target_chain[i]->dispex, event->event_id, event->nsevent, &prevent_default); + hres = vtbl->handle_event(&target_chain[i]->dispex, event, &prevent_default); if(FAILED(hres) || event->stop_propagation) break; if(prevent_default) diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 2933314292e..545560a4030 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -133,7 +133,7 @@ typedef struct { nsISupports *(*get_gecko_target)(DispatchEx*); void (*bind_event)(DispatchEx*,eventid_t); EventTarget *(*get_parent_event_target)(DispatchEx*); - HRESULT (*handle_event)(DispatchEx*,eventid_t,nsIDOMEvent*,BOOL*); + HRESULT (*handle_event)(DispatchEx*,DOMEvent*,BOOL*); ConnectionPointContainer *(*get_cp_container)(DispatchEx*); IHTMLEventObj *(*set_current_event)(DispatchEx*,IHTMLEventObj*); } event_target_vtbl_t; @@ -143,7 +143,7 @@ IHTMLEventObj *default_set_current_event(HTMLInnerWindow*,IHTMLEventObj*); nsISupports *HTMLElement_get_gecko_target(DispatchEx*); void HTMLElement_bind_event(DispatchEx*,eventid_t); EventTarget *HTMLElement_get_parent_event_target(DispatchEx*); -HRESULT HTMLElement_handle_event(DispatchEx*,eventid_t,nsIDOMEvent*,BOOL*); +HRESULT HTMLElement_handle_event(DispatchEx*,DOMEvent*,BOOL*); ConnectionPointContainer *HTMLElement_get_cp_container(DispatchEx*); IHTMLEventObj *HTMLElement_set_current_event(DispatchEx*,IHTMLEventObj*); diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index 3b8f0cb4e43..019f5cb1a5f 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -1061,16 +1061,16 @@ static HRESULT HTMLFormElement_invoke(DispatchEx *dispex, IDispatch *this_obj, D return S_OK; } -static HRESULT HTMLFormElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +static HRESULT HTMLFormElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default) { HTMLFormElement *This = impl_from_DispatchEx(dispex); - if(eid == EVENTID_SUBMIT) { + if(event->event_id == EVENTID_SUBMIT) { *prevent_default = TRUE; return IHTMLFormElement_submit(&This->IHTMLFormElement_iface); } - return HTMLElement_handle_event(&This->element.node.event_target.dispex, eid, event, prevent_default); + return HTMLElement_handle_event(&This->element.node.event_target.dispex, event, prevent_default); } static const NodeImplVtbl HTMLFormElementImplVtbl = { From 5d34273369e44e2b2683289fa7582711682bbf92 Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Wed, 21 Feb 2024 11:05:05 +1100 Subject: [PATCH 1330/1506] mshtml: Use generic event dispatcher for DOMContentLoaded. Use generic event dispatcher instead of nsevent for the DOMContentLoaded event. Also allow processing before dispatching event. Only update dom_content_loaded_event start/end time when the event is trusted. CW-Bug-Id: #23083 (cherry picked from commit 54980a786814ce3bed1f17be6e77658f9b9430ec) --- dlls/mshtml/htmldoc.c | 36 +++++++++++++++++++++++++++++++++++- dlls/mshtml/htmlevent.c | 14 +++++++++++++- dlls/mshtml/htmlevent.h | 1 + dlls/mshtml/nsevents.c | 22 ---------------------- 4 files changed, 49 insertions(+), 24 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 6b5d73c0604..69c739001a6 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -6333,6 +6333,38 @@ static HRESULT HTMLDocumentNode_location_hook(DispatchEx *dispex, WORD flags, DI DISPID_IHTMLWINDOW2_LOCATION, 0, flags, dp, res, ei, caller); } +static HRESULT HTMLDocumentNode_pre_handle_event(DispatchEx* dispex, DOMEvent *event) +{ + HTMLDocumentNode *doc = impl_from_DispatchEx(dispex); + switch(event->event_id) { + case EVENTID_DOMCONTENTLOADED: { + if(event->trusted && doc->window) + doc->window->dom_content_loaded_event_start_time = get_time_stamp(); + break; + } + default: + break; + } + + return S_OK; +} + +static HRESULT HTMLDocumentNode_handle_event(DispatchEx* dispex, DOMEvent *event, BOOL *prevent_default) +{ + HTMLDocumentNode *doc = impl_from_DispatchEx(dispex); + switch(event->event_id) { + case EVENTID_DOMCONTENTLOADED: { + if(event->trusted && doc->window) + doc->window->dom_content_loaded_event_end_time = get_time_stamp(); + break; + } + default: + break; + } + + return S_OK; +} + static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { { .query_interface = HTMLDocumentNode_query_interface, @@ -6348,8 +6380,10 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { .get_gecko_target = HTMLDocumentNode_get_gecko_target, .bind_event = HTMLDocumentNode_bind_event, .get_parent_event_target = HTMLDocumentNode_get_parent_event_target, + .pre_handle_event = HTMLDocumentNode_pre_handle_event, + .handle_event = HTMLDocumentNode_handle_event, .get_cp_container = HTMLDocumentNode_get_cp_container, - .set_current_event = HTMLDocumentNode_set_current_event + .set_current_event = HTMLDocumentNode_set_current_event, }; static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = { diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 485fb8c3f39..f6f21d7a9eb 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -117,7 +117,7 @@ typedef struct { /* Keep these sorted case sensitively */ static const event_info_t event_info[] = { {L"DOMContentLoaded", EVENT_TYPE_EVENT, 0, - EVENT_BUBBLES | EVENT_CANCELABLE}, + EVENT_DEFAULTLISTENER | EVENT_HASDEFAULTHANDLERS | EVENT_BUBBLES | EVENT_CANCELABLE }, {L"abort", EVENT_TYPE_EVENT, DISPID_EVMETH_ONABORT, EVENT_BIND_TO_TARGET}, {L"afterprint", EVENT_TYPE_EVENT, DISPID_EVMETH_ONAFTERPRINT, @@ -5132,6 +5132,18 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event, IEventTarget_AddRef(&event_target->IEventTarget_iface); event->phase = DEP_CAPTURING_PHASE; + + if(event_info[event->event_id].flags & EVENT_HASDEFAULTHANDLERS) { + for(i = 0; i < chain_cnt; i++) { + vtbl = dispex_get_vtbl(&target_chain[i]->dispex); + if(!vtbl->pre_handle_event) + continue; + hres = vtbl->pre_handle_event(&target_chain[i]->dispex, event); + if(FAILED(hres) || event->stop_propagation) + break; + } + } + i = chain_cnt-1; while(!event->stop_propagation && i) call_event_handlers(target_chain[i--], event, dispatch_mode); diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 545560a4030..f2cbfe18bf2 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -133,6 +133,7 @@ typedef struct { nsISupports *(*get_gecko_target)(DispatchEx*); void (*bind_event)(DispatchEx*,eventid_t); EventTarget *(*get_parent_event_target)(DispatchEx*); + HRESULT (*pre_handle_event)(DispatchEx*,DOMEvent*); HRESULT (*handle_event)(DispatchEx*,DOMEvent*,BOOL*); ConnectionPointContainer *(*get_cp_container)(DispatchEx*); IHTMLEventObj *(*set_current_event)(DispatchEx*,IHTMLEventObj*); diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index c229a2c634f..c6c6438a740 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -48,7 +48,6 @@ typedef struct { static nsresult handle_blur(HTMLDocumentNode*,nsIDOMEvent*); static nsresult handle_focus(HTMLDocumentNode*,nsIDOMEvent*); static nsresult handle_keypress(HTMLDocumentNode*,nsIDOMEvent*); -static nsresult handle_dom_content_loaded(HTMLDocumentNode*,nsIDOMEvent*); static nsresult handle_pageshow(HTMLDocumentNode*,nsIDOMEvent*); static nsresult handle_pagehide(HTMLDocumentNode*,nsIDOMEvent*); static nsresult handle_load(HTMLDocumentNode*,nsIDOMEvent*); @@ -68,7 +67,6 @@ static const struct { { EVENTID_BLUR, 0, handle_blur }, { EVENTID_FOCUS, 0, handle_focus }, { EVENTID_KEYPRESS, BUBBLES, handle_keypress }, - { EVENTID_DOMCONTENTLOADED, OVERRIDE, handle_dom_content_loaded }, { EVENTID_PAGESHOW, OVERRIDE, handle_pageshow }, { EVENTID_PAGEHIDE, OVERRIDE, handle_pagehide }, { EVENTID_LOAD, OVERRIDE, handle_load }, @@ -234,26 +232,6 @@ static nsresult handle_keypress(HTMLDocumentNode *doc, nsIDOMEvent *event) return NS_OK; } -static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) -{ - DOMEvent *event; - HRESULT hres; - - if(doc->window) - doc->window->dom_content_loaded_event_start_time = get_time_stamp(); - - hres = create_event_from_nsevent(nsevent, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex), &event); - if(SUCCEEDED(hres)) { - dispatch_event(&doc->node.event_target, event); - IDOMEvent_Release(&event->IDOMEvent_iface); - } - - if(doc->window) - doc->window->dom_content_loaded_event_end_time = get_time_stamp(); - - return NS_OK; -} - static nsresult handle_pageshow(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) { HTMLInnerWindow *window; From 2740d340a8bd181e94def94cc4776aaa97ad79ea Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Mon, 26 Feb 2024 14:36:50 +1100 Subject: [PATCH 1331/1506] mshtml/tests: Add test for document mode after InitNew and Load. CW-Bug-Id: #23083 (cherry picked from commit 34a8478da895538c4e3f2a9432e150d4a33ebe06) --- dlls/mshtml/tests/dom.c | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 36863d2ac62..b56e13aebfc 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -12253,6 +12253,81 @@ static void test_document_mode_lock(void) IHTMLDocument2_Release(doc); } +static void test_document_mode_after_initnew(void) +{ + IHTMLDocument2 *doc; + IHTMLDocument6 *doc6; + IEventTarget *event_target; + IPersistStreamInit *init; + IStream *stream; + HRESULT hres; + HGLOBAL mem; + VARIANT var; + SIZE_T len; + MSG msg; + + notif_doc = doc = create_document(); + if(!doc) + return; + doc_complete = FALSE; + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IEventTarget, (void**)&event_target); + ok(hres == E_NOINTERFACE, "QueryInterface(IID_IEventTarget) returned %08lx.\n", hres); + ok(event_target == NULL, "event_target != NULL\n"); + + len = strlen(doc_blank_ie9); + mem = GlobalAlloc(0, len); + memcpy(mem, doc_blank_ie9, len); + hres = CreateStreamOnHGlobal(mem, TRUE, &stream); + ok(hres == S_OK, "Failed to create stream: %08lx.\n", hres); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init); + ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08lx.\n", hres); + + IPersistStreamInit_InitNew(init); + IPersistStreamInit_Load(init, stream); + IPersistStreamInit_Release(init); + IStream_Release(stream); + + set_client_site(doc, TRUE); + do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument6, (void**)&doc6); + ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument6) failed: %08lx\n", hres); + + V_VT(&var) = VT_EMPTY; + hres = IHTMLDocument6_get_documentMode(doc6, &var); + ok(hres == S_OK, "get_documentMode failed: %08lx\n", hres); + ok(V_VT(&var) == VT_R4, "V_VT(documentMode) = %u\n", V_VT(&var)); + ok(V_R4(&var) == 5, "documentMode = %f, expected 5\n", V_R4(&var)); + VariantClear(&var); + + while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IEventTarget, (void**)&event_target); + todo_wine + ok(hres == S_OK, "QueryInterface(IID_IEventTarget) returned %08lx.\n", hres); + todo_wine + ok(event_target != NULL, "event_target == NULL\n"); + if (event_target != NULL) + IEventTarget_Release(event_target); + + V_VT(&var) = VT_EMPTY; + hres = IHTMLDocument6_get_documentMode(doc6, &var); + ok(hres == S_OK, "get_documentMode failed: %08lx\n", hres); + ok(V_VT(&var) == VT_R4, "V_VT(documentMode) = %u\n", V_VT(&var)); + todo_wine + ok(V_R4(&var) == 9, "documentMode = %f, expected 9\n", V_R4(&var)); + IHTMLDocument6_Release(doc6); + VariantClear(&var); + + set_client_site(doc, FALSE); + IHTMLDocument2_Release(doc); +} + static DWORD WINAPI create_document_proc(void *param) { IHTMLDocument2 *doc = NULL; @@ -12378,6 +12453,7 @@ START_TEST(dom) test_quirks_mode(); test_document_mode_lock(); + test_document_mode_after_initnew(); test_threads(); /* Run this last since it messes with the process-wide user agent */ From 5cddb1309a46fc1ab88ff467f34c12fe1a07e39b Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Mon, 26 Feb 2024 14:39:01 +1100 Subject: [PATCH 1332/1506] mshtml: Always use the event target dispex. The event target may be from a different document to the document associated with the event handler. CW-Bug-Id: #23083 (cherry picked from commit 74ff9f23717d2a8a8255d213099d2709e55e9c63) --- dlls/mshtml/nsevents.c | 2 +- dlls/mshtml/tests/dom.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index c6c6438a740..38b3cccd951 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -444,7 +444,7 @@ static nsresult handle_htmlevent(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) target = &node->event_target; } - hres = create_event_from_nsevent(nsevent, get_inner_window(doc), dispex_compat_mode(&doc->node.event_target.dispex), &event); + hres = create_event_from_nsevent(nsevent, get_inner_window(doc), dispex_compat_mode(&target->dispex), &event); if(FAILED(hres)) { IEventTarget_Release(&target->IEventTarget_iface); return NS_OK; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index b56e13aebfc..ceb59ee8a78 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -12308,18 +12308,14 @@ static void test_document_mode_after_initnew(void) } hres = IHTMLDocument2_QueryInterface(doc, &IID_IEventTarget, (void**)&event_target); - todo_wine ok(hres == S_OK, "QueryInterface(IID_IEventTarget) returned %08lx.\n", hres); - todo_wine ok(event_target != NULL, "event_target == NULL\n"); - if (event_target != NULL) - IEventTarget_Release(event_target); + IEventTarget_Release(event_target); V_VT(&var) = VT_EMPTY; hres = IHTMLDocument6_get_documentMode(doc6, &var); ok(hres == S_OK, "get_documentMode failed: %08lx\n", hres); ok(V_VT(&var) == VT_R4, "V_VT(documentMode) = %u\n", V_VT(&var)); - todo_wine ok(V_R4(&var) == 9, "documentMode = %f, expected 9\n", V_R4(&var)); IHTMLDocument6_Release(doc6); VariantClear(&var); From 8963a000fec6ee40e8a8f80a5837f6b825ecb50a Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Mon, 26 Feb 2024 16:15:43 +1100 Subject: [PATCH 1333/1506] mshtml: Don't handle special case when doc != node->doc. CW-Bug-Id: #23083 (cherry picked from commit 57c2c41d751d179dd1b5a2bb02431a072908ad6b) --- dlls/mshtml/nsevents.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 38b3cccd951..9a23d031d72 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -416,6 +416,7 @@ static nsresult handle_htmlevent(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) nsIDOMEventTarget *event_target; EventTarget *target; nsIDOMNode *nsnode; + HTMLDOMNode *node = NULL; DOMEvent *event; nsresult nsres; HRESULT hres; @@ -436,7 +437,6 @@ static nsresult handle_htmlevent(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) target = &doc->window->event_target; IHTMLWindow2_AddRef(&doc->window->base.IHTMLWindow2_iface); }else { - HTMLDOMNode *node; hres = get_node(nsnode, TRUE, &node); nsIDOMNode_Release(nsnode); if(FAILED(hres)) @@ -451,7 +451,7 @@ static nsresult handle_htmlevent(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) } /* If we fine need for more special cases here, we may consider handling it in a more generic way. */ - if(event->event_id == EVENTID_FOCUS || event->event_id == EVENTID_BLUR) { + if((!node || doc == node->doc) && (event->event_id == EVENTID_FOCUS || event->event_id == EVENTID_BLUR)) { DOMEvent *focus_event; hres = create_document_event(doc, event->event_id == EVENTID_FOCUS ? EVENTID_FOCUSIN : EVENTID_FOCUSOUT, &focus_event); From b028d34fd3a33dbba841fbe20403f5a258c6468f Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 1 Mar 2024 20:20:13 -0500 Subject: [PATCH 1334/1506] sapi: Implement ISpeechVoice::{get/put}_Volume. (cherry picked from commit 7c384f361aaa38b31fa7b9ff72085eee728c52ea) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 9 ++++++++- dlls/sapi/tts.c | 17 +++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index 4d565b35294..a5c950aa80b 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -434,7 +434,7 @@ static void test_spvoice(void) DWORD start, duration; ISpeechVoice *speech_voice; ISpeechObjectTokens *speech_tokens; - LONG count; + LONG count, volume_long; BSTR req = NULL, opt = NULL; UINT info_count; ITypeInfo *typeinfo; @@ -717,6 +717,13 @@ static void test_spvoice(void) ok(count == 1, "got %ld.\n", count); ISpeechObjectTokens_Release(speech_tokens); + volume_long = 0xdeadbeef; + hr = ISpeechVoice_put_Volume(speech_voice, 80); + ok(hr == S_OK, "got %#lx.\n", hr); + hr = ISpeechVoice_get_Volume(speech_voice, &volume_long); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(volume_long == 80, "got %ld.\n", volume_long); + hr = ISpeechVoice_Speak(speech_voice, NULL, SVSFPurgeBeforeSpeak, NULL); ok(hr == S_OK, "got %#lx.\n", hr); diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index d22ffd7a0da..325edaf04fb 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -291,16 +291,25 @@ static HRESULT WINAPI speech_voice_put_Rate(ISpeechVoice *iface, LONG rate) static HRESULT WINAPI speech_voice_get_Volume(ISpeechVoice *iface, LONG *volume) { - FIXME("(%p, %p): stub.\n", iface, volume); + struct speech_voice *This = impl_from_ISpeechVoice(iface); + USHORT res = 0; + HRESULT hr; - return E_NOTIMPL; + TRACE("(%p, %p).\n", iface, volume); + + if (!volume) return E_POINTER; + hr = ISpVoice_GetVolume(&This->ISpVoice_iface, &res); + *volume = res; + return hr; } static HRESULT WINAPI speech_voice_put_Volume(ISpeechVoice *iface, LONG volume) { - FIXME("(%p, %ld): stub.\n", iface, volume); + struct speech_voice *This = impl_from_ISpeechVoice(iface); - return E_NOTIMPL; + TRACE("(%p, %ld).\n", iface, volume); + + return ISpVoice_SetVolume(&This->ISpVoice_iface, (USHORT)volume); } static HRESULT WINAPI speech_voice_put_AllowAudioOutputFormatChangesOnNextSet(ISpeechVoice *iface, From 7ae726d11b0d8e80a88069ee232b22d11952f648 Mon Sep 17 00:00:00 2001 From: Shaun Ren Date: Fri, 1 Mar 2024 20:44:43 -0500 Subject: [PATCH 1335/1506] sapi: Implement ISpeechVoice::{get/putref}_Voice. (cherry picked from commit 43220a6063328bc445a346e5f6849731aafcaf88) CW-Bug-Id: #22520 --- dlls/sapi/tests/tts.c | 22 +++++++++++++++++++++- dlls/sapi/tts.c | 26 ++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/dlls/sapi/tests/tts.c b/dlls/sapi/tests/tts.c index a5c950aa80b..38c69e6144a 100644 --- a/dlls/sapi/tests/tts.c +++ b/dlls/sapi/tests/tts.c @@ -424,7 +424,7 @@ static void test_spvoice(void) IUnknown *dummy; ISpMMSysAudio *audio_out; ISpObjectTokenCategory *token_cat; - ISpObjectToken *token; + ISpObjectToken *token, *token2; WCHAR *token_id = NULL, *default_token_id = NULL; ISpDataKey *attrs_key; LONG rate; @@ -435,6 +435,7 @@ static void test_spvoice(void) ISpeechVoice *speech_voice; ISpeechObjectTokens *speech_tokens; LONG count, volume_long; + ISpeechObjectToken *speech_token; BSTR req = NULL, opt = NULL; UINT info_count; ITypeInfo *typeinfo; @@ -724,6 +725,25 @@ static void test_spvoice(void) ok(hr == S_OK, "got %#lx.\n", hr); ok(volume_long == 80, "got %ld.\n", volume_long); + hr = ISpObjectToken_QueryInterface(token, &IID_ISpeechObjectToken, (void **)&speech_token); + ok(hr == S_OK, "got %#lx.\n", hr); + hr = ISpeechVoice_putref_Voice(speech_voice, speech_token); + ok(hr == S_OK, "got %#lx.\n", hr); + ISpeechObjectToken_Release(speech_token); + + speech_token = (ISpeechObjectToken *)0xdeadbeef; + hr = ISpeechVoice_get_Voice(speech_voice, &speech_token); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(speech_token && speech_token != (ISpeechObjectToken *)0xdeadbeef, "got %p.\n", speech_token); + hr = ISpeechObjectToken_QueryInterface(speech_token, &IID_ISpObjectToken, (void **)&token2); + ok(hr == S_OK, "got %#lx.\n", hr); + token_id = NULL; + hr = ISpObjectToken_GetId(token2, &token_id); + ok(hr == S_OK, "got %#lx.\n", hr); + ok(!wcscmp(token_id, test_token_id), "got %s.\n", wine_dbgstr_w(token_id)); + CoTaskMemFree(token_id); + ISpObjectToken_Release(token2); + hr = ISpeechVoice_Speak(speech_voice, NULL, SVSFPurgeBeforeSpeak, NULL); ok(hr == S_OK, "got %#lx.\n", hr); diff --git a/dlls/sapi/tts.c b/dlls/sapi/tts.c index 325edaf04fb..c474a118981 100644 --- a/dlls/sapi/tts.c +++ b/dlls/sapi/tts.c @@ -235,16 +235,34 @@ static HRESULT WINAPI speech_voice_get_Status(ISpeechVoice *iface, ISpeechVoiceS static HRESULT WINAPI speech_voice_get_Voice(ISpeechVoice *iface, ISpeechObjectToken **voice) { - FIXME("(%p, %p): stub.\n", iface, voice); + struct speech_voice *This = impl_from_ISpeechVoice(iface); + ISpObjectToken *token; + HRESULT hr; - return E_NOTIMPL; + TRACE("(%p, %p).\n", iface, voice); + + if (!voice) return E_POINTER; + if (FAILED(hr = ISpVoice_GetVoice(&This->ISpVoice_iface, &token))) + return hr; + hr = ISpObjectToken_QueryInterface(token, &IID_ISpeechObjectToken, (void **)voice); + ISpObjectToken_Release(token); + return hr; } static HRESULT WINAPI speech_voice_putref_Voice(ISpeechVoice *iface, ISpeechObjectToken *voice) { - FIXME("(%p, %p): stub.\n", iface, voice); + struct speech_voice *This = impl_from_ISpeechVoice(iface); + ISpObjectToken *token; + HRESULT hr; - return E_NOTIMPL; + TRACE("(%p, %p).\n", iface, voice); + + if (!voice) return E_INVALIDARG; + if (FAILED(hr = ISpeechObjectToken_QueryInterface(voice, &IID_ISpObjectToken, (void **)&token))) + return hr; + hr = ISpVoice_SetVoice(&This->ISpVoice_iface, token); + ISpObjectToken_Release(token); + return hr; } static HRESULT WINAPI speech_voice_get_AudioOutput(ISpeechVoice *iface, ISpeechObjectToken **output) From aff91e329206a3c260b1758331e86c3fee0f2fd5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Mar 2024 16:23:06 -0600 Subject: [PATCH 1336/1506] amd_ags_x64: Add stub implementation for DX12 marker functions. CW-Bug-Id: #23474 --- dlls/amd_ags_x64/amd_ags_x64.spec | 6 +++--- dlls/amd_ags_x64/amd_ags_x64_main.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64.spec b/dlls/amd_ags_x64/amd_ags_x64.spec index 7c5e3fb8f69..744035a9a69 100644 --- a/dlls/amd_ags_x64/amd_ags_x64.spec +++ b/dlls/amd_ags_x64/amd_ags_x64.spec @@ -45,9 +45,9 @@ @ stub agsDriverExtensionsDX12_Destroy @ stdcall agsDriverExtensionsDX12_DestroyDevice(ptr ptr ptr) @ stdcall agsDriverExtensionsDX12_Init(ptr ptr ptr) -@ stub agsDriverExtensionsDX12_PopMarker -@ stub agsDriverExtensionsDX12_PushMarker -@ stub agsDriverExtensionsDX12_SetMarker +@ stdcall agsDriverExtensionsDX12_PopMarker(ptr ptr) +@ stdcall agsDriverExtensionsDX12_PushMarker(ptr ptr ptr) +@ stdcall agsDriverExtensionsDX12_SetMarker(ptr ptr ptr) @ stdcall agsGetCrossfireGPUCount(ptr ptr) @ stdcall agsGetVersionNumber() @ stdcall agsInit(ptr ptr ptr) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index 0ec45bc293d..e1cb3609b99 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -1466,6 +1466,27 @@ AGSReturnCode WINAPI agsDriverExtensionsDX12_DeInit( AGSContext* context ) return AGS_SUCCESS; } +AGSReturnCode WINAPI agsDriverExtensionsDX12_SetMarker( AGSContext *context, ID3D12GraphicsCommandList *command_list, const char *data) +{ + WARN("context %p, command_list %p, data %p stub.\n", context, command_list, data); + + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX12_PushMarker( AGSContext *context, ID3D12GraphicsCommandList *command_list, const char* data) +{ + WARN("context %p, command_list %p, data %p stub.\n", context, command_list, data); + + return AGS_SUCCESS; +} + +AGSReturnCode WINAPI agsDriverExtensionsDX12_PopMarker(AGSContext *context, ID3D12GraphicsCommandList *command_list) +{ + WARN("context %p, command_list %p stub.\n", context, command_list); + + return AGS_SUCCESS; +} + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("%p, %u, %p.\n", instance, reason, reserved); From 6ad59c41a5aa4981804f4a7bf1c58a53533754d3 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 5 Mar 2024 09:47:35 -0600 Subject: [PATCH 1337/1506] Revert "winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for video processor." This reverts commit c6fe011aa26d50c761c932265af9d4d506ce72b4. CW-Bug-Id: #22299 --- dlls/winegstreamer/video_processor.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/dlls/winegstreamer/video_processor.c b/dlls/winegstreamer/video_processor.c index 698ae498ec7..1cbb37dafc7 100644 --- a/dlls/winegstreamer/video_processor.c +++ b/dlls/winegstreamer/video_processor.c @@ -513,18 +513,7 @@ static HRESULT WINAPI video_processor_ProcessEvent(IMFTransform *iface, DWORD id static HRESULT WINAPI video_processor_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - struct video_processor *impl = impl_from_IMFTransform(iface); - - TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); - - if (!impl->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - if (message == MFT_MESSAGE_COMMAND_DRAIN) - return wg_transform_drain(impl->wg_transform); - - FIXME("Ignoring message %#x.\n", message); - + FIXME("iface %p, message %#x, param %#Ix stub!\n", iface, message, param); return S_OK; } From 11704698efabdc8e03df8443c011aa3ad6691bd9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 5 Mar 2024 09:47:36 -0600 Subject: [PATCH 1338/1506] Revert "winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for resampler." This reverts commit 73410b62a84a58ecee639600a6b3fe689b2aa513. CW-Bug-Id: #22299 --- dlls/winegstreamer/resampler.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c index 22fb273e84c..b5b62d58800 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/winegstreamer/resampler.c @@ -509,18 +509,7 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - struct resampler *impl = impl_from_IMFTransform(iface); - - TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); - - if (!impl->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - if (message == MFT_MESSAGE_COMMAND_DRAIN) - return wg_transform_drain(impl->wg_transform); - - FIXME("Ignoring message %#x.\n", message); - + FIXME("iface %p, message %#x, param %p stub!\n", iface, message, (void *)param); return S_OK; } From 9cf34c9332835f18c2ccf021079f82d00977de6b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 5 Mar 2024 09:47:37 -0600 Subject: [PATCH 1339/1506] Revert "winegstreamer: Implement MFT_MESSAGE_COMMAND_DRAIN for aac decoder." This reverts commit 3a3400aa407c2362a08095cb57ccb6e5aa68077d. CW-Bug-Id: #22299 --- dlls/winegstreamer/audio_decoder.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/dlls/winegstreamer/audio_decoder.c b/dlls/winegstreamer/audio_decoder.c index cd63f116cbf..771eae465fe 100644 --- a/dlls/winegstreamer/audio_decoder.c +++ b/dlls/winegstreamer/audio_decoder.c @@ -489,18 +489,7 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - struct audio_decoder *decoder = impl_from_IMFTransform(iface); - - TRACE("iface %p, message %#x, param %p.\n", iface, message, (void *)param); - - if (!decoder->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - if (message == MFT_MESSAGE_COMMAND_DRAIN) - return wg_transform_drain(decoder->wg_transform); - - FIXME("Ignoring message %#x.\n", message); - + FIXME("iface %p, message %#x, param %p stub!\n", iface, message, (void *)param); return S_OK; } From 34bbb1a44849b57834f6632dd6186b2dd0a36e57 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 5 Mar 2024 10:49:09 -0600 Subject: [PATCH 1340/1506] fixup! ntdll: Simulate async file read and IO cancellation to workaround AC:Odyssey out of order dialogues bug. CW-Bug-Id: #21711 --- dlls/ntdll/unix/file.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index d84f44d4560..e5ea71fae80 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -5648,6 +5648,7 @@ struct async_file_read_job LONG cancelled; struct list queue_entry; struct async_file_read_job *next; + ULONG64 queue_time_mcs; }; @@ -5668,7 +5669,9 @@ static void *async_file_read_thread(void *dummy) ULONG buffer_length = 0; void *buffer = NULL; struct list *entry; + struct timespec ts; NTSTATUS status; + ULONG64 delay; ULONG total; int result; @@ -5719,6 +5722,13 @@ static void *async_file_read_thread(void *dummy) break; } + clock_gettime( CLOCK_MONOTONIC, &ts ); + delay = ts.tv_sec * (ULONG64)1000000 + ts.tv_nsec / 1000 - job->queue_time_mcs; + if (delay < 1000) + usleep( 1000 - delay ); + else + usleep( 50 ); + total = result; status = (total || !job->length) ? STATUS_SUCCESS : STATUS_END_OF_FILE; done: @@ -5779,6 +5789,7 @@ static NTSTATUS queue_async_file_read( HANDLE handle, int unix_handle, int needs IO_STATUS_BLOCK *io, void *buffer, ULONG length, LARGE_INTEGER *offset ) { struct async_file_read_job *job; + struct timespec ts; pthread_once( &async_file_read_once, async_file_read_init ); @@ -5810,6 +5821,8 @@ static NTSTATUS queue_async_file_read( HANDLE handle, int unix_handle, int needs job->offset = *offset; job->thread_id = GetCurrentThreadId(); job->cancelled = 0; + clock_gettime( CLOCK_MONOTONIC, &ts ); + job->queue_time_mcs = ts.tv_sec * (ULONG64)1000000 + ts.tv_nsec / 1000; list_add_tail( &async_file_read_queue, &job->queue_entry ); From 96040d13a70b704ba92e4d9345d9560e6726bdef Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 3 Feb 2024 17:23:52 +0100 Subject: [PATCH 1341/1506] winevulkan: Prepare for VK_KHR_calibrated_timestamps. (cherry picked from commit db03d2be88d80195635188cb51507f4c2d9c2b13) --- dlls/winevulkan/vulkan.c | 65 +++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 27cf80ee907..1f15aadc294 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1673,17 +1673,19 @@ static inline uint64_t convert_timestamp(VkTimeDomainEXT host_domain, VkTimeDoma return value; } -VkResult wine_vkGetCalibratedTimestampsEXT(VkDevice handle, uint32_t timestamp_count, - const VkCalibratedTimestampInfoEXT *timestamp_infos, - uint64_t *timestamps, uint64_t *max_deviation) +static VkResult wine_vk_get_timestamps(struct wine_device *device, uint32_t timestamp_count, + const VkCalibratedTimestampInfoEXT *timestamp_infos, + uint64_t *timestamps, uint64_t *max_deviation, + VkResult (*get_timestamps)(VkDevice, uint32_t, const VkCalibratedTimestampInfoEXT *, uint64_t *, uint64_t *)) { - struct wine_device *device = wine_device_from_handle(handle); VkCalibratedTimestampInfoEXT* host_timestamp_infos; unsigned int i; VkResult res; - TRACE("%p, %u, %p, %p, %p\n", device, timestamp_count, timestamp_infos, timestamps, max_deviation); - if (!(host_timestamp_infos = malloc(sizeof(VkCalibratedTimestampInfoEXT) * timestamp_count))) + if (timestamp_count == 0) + return VK_SUCCESS; + + if (!(host_timestamp_infos = calloc(sizeof(VkCalibratedTimestampInfoEXT), timestamp_count))) return VK_ERROR_OUT_OF_HOST_MEMORY; for (i = 0; i < timestamp_count; i++) @@ -1693,24 +1695,23 @@ VkResult wine_vkGetCalibratedTimestampsEXT(VkDevice handle, uint32_t timestamp_c host_timestamp_infos[i].timeDomain = map_to_host_time_domain(timestamp_infos[i].timeDomain); } - res = device->funcs.p_vkGetCalibratedTimestampsEXT(device->host_device, timestamp_count, host_timestamp_infos, - timestamps, max_deviation); - if (res != VK_SUCCESS) - return res; - - for (i = 0; i < timestamp_count; i++) - timestamps[i] = convert_timestamp(host_timestamp_infos[i].timeDomain, timestamp_infos[i].timeDomain, timestamps[i]); + res = get_timestamps(device->host_device, timestamp_count, host_timestamp_infos, timestamps, max_deviation); + if (res == VK_SUCCESS) + { + for (i = 0; i < timestamp_count; i++) + timestamps[i] = convert_timestamp(host_timestamp_infos[i].timeDomain, timestamp_infos[i].timeDomain, timestamps[i]); + } free(host_timestamp_infos); return res; } -VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice handle, - uint32_t *time_domain_count, - VkTimeDomainEXT *time_domains) +static VkResult wine_vk_get_time_domains(struct wine_phys_dev *phys_dev, + uint32_t *time_domain_count, + VkTimeDomainEXT *time_domains, + VkResult (*get_domains)(VkPhysicalDevice, uint32_t *, VkTimeDomainEXT *)) { - struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); BOOL supports_device = FALSE, supports_monotonic = FALSE, supports_monotonic_raw = FALSE; const VkTimeDomainEXT performance_counter_domain = get_performance_counter_time_domain(); VkTimeDomainEXT *host_time_domains; @@ -1721,16 +1722,14 @@ VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice ha VkResult res; /* Find out the time domains supported on the host */ - res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(phys_dev->host_physical_device, - &host_time_domain_count, NULL); + res = get_domains(phys_dev->host_physical_device, &host_time_domain_count, NULL); if (res != VK_SUCCESS) return res; if (!(host_time_domains = malloc(sizeof(VkTimeDomainEXT) * host_time_domain_count))) return VK_ERROR_OUT_OF_HOST_MEMORY; - res = phys_dev->instance->funcs.p_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(phys_dev->host_physical_device, - &host_time_domain_count, host_time_domains); + res = get_domains(phys_dev->host_physical_device, &host_time_domain_count, host_time_domains); if (res != VK_SUCCESS) { free(host_time_domains); @@ -1780,6 +1779,30 @@ VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice ha return res; } +VkResult wine_vkGetCalibratedTimestampsEXT(VkDevice handle, uint32_t timestamp_count, + const VkCalibratedTimestampInfoEXT *timestamp_infos, + uint64_t *timestamps, uint64_t *max_deviation) +{ + struct wine_device *device = wine_device_from_handle(handle); + + TRACE("%p, %u, %p, %p, %p\n", device, timestamp_count, timestamp_infos, timestamps, max_deviation); + + return wine_vk_get_timestamps(device, timestamp_count, timestamp_infos, timestamps, max_deviation, + device->funcs.p_vkGetCalibratedTimestampsEXT); +} + +VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice handle, + uint32_t *time_domain_count, + VkTimeDomainEXT *time_domains) +{ + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); + + TRACE("%p, %p, %p\n", phys_dev, time_domain_count, time_domains); + + return wine_vk_get_time_domains(phys_dev, time_domain_count, time_domains, + phys_dev->instance->funcs.p_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT); +} + static inline void wine_vk_normalize_semaphore_handle_types_win(VkExternalSemaphoreHandleTypeFlags *types) { *types &= From 040deb073bcdfb8420a5e28f03735f0868dd331d Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 3 Feb 2024 17:34:27 +0100 Subject: [PATCH 1342/1506] winevulkan: Update to VK spec version 1.3.277. (cherry picked from commit ea890c4733db5119fdb63b900bb7e5c8d04b5245) --- dlls/winevulkan/make_vulkan | 5 ++++- dlls/winevulkan/vulkan.c | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index f8ac5976efe..4f5df2fc697 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -64,7 +64,7 @@ from enum import Enum LOGGER = logging.Logger("vulkan") LOGGER.addHandler(logging.StreamHandler()) -VK_XML_VERSION = "1.3.272" +VK_XML_VERSION = "1.3.277" WINE_VK_VERSION = (1, 3) # Filenames to create. @@ -101,6 +101,7 @@ UNSUPPORTED_EXTENSIONS = [ "VK_KHR_external_fence_win32", # Relates to external_semaphore and needs type conversions in bitflags. "VK_KHR_shared_presentable_image", # Needs WSI work. + "VK_KHR_video_encode_queue", "VK_KHR_video_queue", # TODO Video extensions use separate headers + xml "VK_NV_external_memory_rdma", # Needs shared resources work. @@ -278,6 +279,7 @@ MANUAL_UNIX_THUNKS = { "vkFreeCommandBuffers", "vkFreeMemory", "vkGetCalibratedTimestampsEXT", + "vkGetCalibratedTimestampsKHR", "vkGetDeviceProcAddr", "vkGetMemoryWin32HandleKHR", "vkGetMemoryWin32HandlePropertiesKHR", @@ -285,6 +287,7 @@ MANUAL_UNIX_THUNKS = { "vkGetDeviceQueue2", "vkGetInstanceProcAddr", "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT", + "vkGetPhysicalDeviceCalibrateableTimeDomainsKHR", "vkGetPhysicalDeviceExternalBufferProperties", "vkGetPhysicalDeviceExternalBufferPropertiesKHR", "vkGetPhysicalDeviceExternalFenceProperties", diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 1f15aadc294..885af7ae970 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1791,6 +1791,18 @@ VkResult wine_vkGetCalibratedTimestampsEXT(VkDevice handle, uint32_t timestamp_c device->funcs.p_vkGetCalibratedTimestampsEXT); } +VkResult wine_vkGetCalibratedTimestampsKHR(VkDevice handle, uint32_t timestamp_count, + const VkCalibratedTimestampInfoKHR *timestamp_infos, + uint64_t *timestamps, uint64_t *max_deviation) +{ + struct wine_device *device = wine_device_from_handle(handle); + + TRACE("%p, %u, %p, %p, %p\n", device, timestamp_count, timestamp_infos, timestamps, max_deviation); + + return wine_vk_get_timestamps(device, timestamp_count, timestamp_infos, timestamps, max_deviation, + device->funcs.p_vkGetCalibratedTimestampsKHR); +} + VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice handle, uint32_t *time_domain_count, VkTimeDomainEXT *time_domains) @@ -1803,6 +1815,18 @@ VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice ha phys_dev->instance->funcs.p_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT); } +VkResult wine_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR(VkPhysicalDevice handle, + uint32_t *time_domain_count, + VkTimeDomainKHR *time_domains) +{ + struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); + + TRACE("%p, %p, %p\n", phys_dev, time_domain_count, time_domains); + + return wine_vk_get_time_domains(phys_dev, time_domain_count, time_domains, + phys_dev->instance->funcs.p_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR); +} + static inline void wine_vk_normalize_semaphore_handle_types_win(VkExternalSemaphoreHandleTypeFlags *types) { *types &= From 9e49e41380cece8c4136404aefeff56d383e13b0 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 5 Mar 2024 15:59:34 +0200 Subject: [PATCH 1343/1506] Update vk.xml to 1.3.277. --- dlls/winevulkan/vk.xml | 1757 ++++++++++++++++++++++++++++------------ 1 file changed, 1235 insertions(+), 522 deletions(-) diff --git a/dlls/winevulkan/vk.xml b/dlls/winevulkan/vk.xml index a696de6f012..fb92b7c2373 100644 --- a/dlls/winevulkan/vk.xml +++ b/dlls/winevulkan/vk.xml @@ -1,7 +1,7 @@ -Copyright 2015-2023 The Khronos Group Inc. +Copyright 2015-2024 The Khronos Group Inc. SPDX-License-Identifier: Apache-2.0 OR MIT @@ -175,11 +175,11 @@ branch of the member gitlab server. #define VKSC_API_VERSION_1_0 VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 267 +#define VK_HEADER_VERSION 277 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) // Version of this file -#define VK_HEADER_VERSION 13 +#define VK_HEADER_VERSION 14 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, VK_HEADER_VERSION) @@ -482,6 +482,7 @@ typedef void* MTLSharedEvent_id; typedef VkFlags VkPresentScalingFlagsEXT; typedef VkFlags VkPresentGravityFlagsEXT; typedef VkFlags VkShaderCreateFlagsEXT; + typedef VkFlags64 VkPhysicalDeviceSchedulingControlsFlagsARM; Video Core extension typedef VkFlags VkVideoCodecOperationFlagsKHR; @@ -512,16 +513,16 @@ typedef void* MTLSharedEvent_id; typedef VkFlags VkVideoComponentBitDepthFlagsKHR; Video Encode H.264 extension - typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT; - typedef VkFlags VkVideoEncodeH264StdFlagsEXT; - typedef VkFlags VkVideoEncodeH264RateControlFlagsEXT; + typedef VkFlags VkVideoEncodeH264CapabilityFlagsKHR; + typedef VkFlags VkVideoEncodeH264StdFlagsKHR; + typedef VkFlags VkVideoEncodeH264RateControlFlagsKHR; Video Encode H.265 extension - typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT; - typedef VkFlags VkVideoEncodeH265StdFlagsEXT; - typedef VkFlags VkVideoEncodeH265RateControlFlagsEXT; - typedef VkFlags VkVideoEncodeH265CtbSizeFlagsEXT; - typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsEXT; + typedef VkFlags VkVideoEncodeH265CapabilityFlagsKHR; + typedef VkFlags VkVideoEncodeH265StdFlagsKHR; + typedef VkFlags VkVideoEncodeH265RateControlFlagsKHR; + typedef VkFlags VkVideoEncodeH265CtbSizeFlagsKHR; + typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsKHR; Types which can be void pointers or class pointers, selected at compile time VK_DEFINE_HANDLE(VkInstance) @@ -685,7 +686,8 @@ typedef void* MTLSharedEvent_id; - + + @@ -730,7 +732,8 @@ typedef void* MTLSharedEvent_id; - + + @@ -865,8 +868,10 @@ typedef void* MTLSharedEvent_id; + + Enumerated types in the header, but not used by the API @@ -903,16 +908,16 @@ typedef void* MTLSharedEvent_id; Video H.264 Encode extensions - - - + + + Video H.265 Encode extensions - - - - - + + + + + The PFN_vk*Function types are used by VkAllocationCallbacks below typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( @@ -1453,7 +1458,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkPipelineCreateFlags flagsPipeline creation flags + VkPipelineCreateFlags flagsPipeline creation flags VkPipelineShaderStageCreateInfo stage VkPipelineLayout layoutInterface layout of the pipeline VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of @@ -1592,7 +1597,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkPipelineCreateFlags flagsPipeline creation flags + VkPipelineCreateFlags flagsPipeline creation flags uint32_t stageCount const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage @@ -1656,7 +1661,7 @@ typedef void* MTLSharedEvent_id; uint32_t offsetStart of the range, in bytes uint32_t sizeSize of the range, in bytes - + VkStructureType sType const void* pNext VkPipelineLayoutCreateFlags flags @@ -1859,7 +1864,7 @@ typedef void* MTLSharedEvent_id; VkBool32 residencyStandard2DBlockShapeSparse resources support: GPU will access all 2D (single sample) sparse resources using the standard sparse image block shapes (based on pixel format) VkBool32 residencyStandard2DMultisampleBlockShapeSparse resources support: GPU will access all 2D (multisample) sparse resources using the standard sparse image block shapes (based on pixel format) VkBool32 residencyStandard3DBlockShapeSparse resources support: GPU will access all 3D sparse resources using the standard sparse image block shapes (based on pixel format) - VkBool32 residencyAlignedMipSizeSparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail + VkBool32 residencyAlignedMipSizeSparse resources support: Images with mip level dimensions that are NOT a multiple of the sparse image block dimensions will be placed in the mip tail VkBool32 residencyNonResidentStrictSparse resources support: GPU can consistently access non-resident regions of a resource, all reads return as if data is 0, writes are discarded @@ -2233,6 +2238,19 @@ typedef void* MTLSharedEvent_id; uint32_t disabledValidationFeatureCountNumber of validation features to disable const VkValidationFeatureDisableEXT* pDisabledValidationFeaturesValidation features to disable + + VkStructureType sTypeMust be VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT + const void* pNext + uint32_t settingCountNumber of settings to configure + const VkLayerSettingEXT* pSettingsValidation features to enable + + + const char* pLayerName + const char* pSettingName + VkLayerSettingTypeEXT typeThe type of the object + uint32_t valueCountNumber of values of the setting + const void* pValuesValues to pass for a setting + VkStructureType sType const void* pNext @@ -2626,7 +2644,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext VkBufferCreateFlags flags - VkBufferUsageFlags usage + VkBufferUsageFlags usage VkExternalMemoryHandleTypeFlagBits handleType @@ -3701,6 +3719,18 @@ typedef void* MTLSharedEvent_id; VkBool32 nonStrictSinglePixelWideLinesUseParallelogram VkBool32 nonStrictWideLinesUseParallelogram + + VkStructureType sType + void* pNext + VkBool32 maintenance6 + + + VkStructureType sType + void* pNext + VkBool32 blockTexelViewCompatibleMultipleLayers + uint32_t maxCombinedImageSamplerDescriptorCount + VkBool32 fragmentShadingRateClampCombinerInputs + VkStructureType sType const void* pNext @@ -3853,7 +3883,7 @@ typedef void* MTLSharedEvent_id; VkDebugUtilsMessengerCallbackDataFlagsEXT flags const char* pMessageIdName int32_t messageIdNumber - const char* pMessage + const char* pMessage uint32_t queueLabelCount const VkDebugUtilsLabelEXT* pQueueLabels uint32_t cmdBufLabelCount @@ -3913,11 +3943,12 @@ typedef void* MTLSharedEvent_id; VkBool32 fullyCoveredFragmentShaderInputVariabletrue if the implementation supports the FullyCoveredEXT SPIR-V builtin fragment shader input variable VkBool32 conservativeRasterizationPostDepthCoveragetrue if the implementation supports both conservative rasterization and post depth coverage sample coverage mask - - VkStructureType sType + + VkStructureType sType const void* pNext - VkTimeDomainEXT timeDomain + VkTimeDomainKHR timeDomain + VkStructureType sType void* pNext @@ -4142,21 +4173,29 @@ typedef void* MTLSharedEvent_id; uint64_t value - + uint32_t binding uint32_t divisor - - VkStructureType sType + + + VkStructureType sType const void* pNext uint32_t vertexBindingDivisorCount - const VkVertexInputBindingDivisorDescriptionEXT* pVertexBindingDivisors + const VkVertexInputBindingDivisorDescriptionKHR* pVertexBindingDivisors + VkStructureType sType void* pNext uint32_t maxVertexAttribDivisormax value of vertex attribute divisor + + VkStructureType sType + void* pNext + uint32_t maxVertexAttribDivisormax value of vertex attribute divisor + VkBool32 supportsNonZeroFirstInstance + VkStructureType sType void* pNext @@ -4269,12 +4308,13 @@ typedef void* MTLSharedEvent_id; VkBool32 shaderImageFloat32AtomicMinMax VkBool32 sparseImageFloat32AtomicMinMax - - VkStructureType sType + + VkStructureType sType void* pNext VkBool32 vertexAttributeInstanceRateDivisor VkBool32 vertexAttributeInstanceRateZeroDivisor + VkStructureType sType void* pNext @@ -4545,7 +4585,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkPipelineCreateFlags flagsPipeline creation flags + VkPipelineCreateFlags flagsPipeline creation flags uint32_t stageCount const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage uint32_t groupCount @@ -4558,7 +4598,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkPipelineCreateFlags flagsPipeline creation flags + VkPipelineCreateFlags flagsPipeline creation flags uint32_t stageCount const VkPipelineShaderStageCreateInfo* pStagesOne entry for each active shader stage uint32_t groupCount @@ -4977,7 +5017,7 @@ typedef void* MTLSharedEvent_id; void* pNext VkShaderStageFlags cooperativeMatrixSupportedStages - + VkStructureType sType void* pNext uint32_t MSize @@ -5192,11 +5232,12 @@ typedef void* MTLSharedEvent_id; VkBool32 shaderSubgroupClock VkBool32 shaderDeviceClock - - VkStructureType sType + + VkStructureType sType void* pNext VkBool32 indexTypeUint8 + VkStructureType sType void* pNext @@ -5362,8 +5403,8 @@ typedef void* MTLSharedEvent_id; VkDeviceMemory memory - - VkStructureType sType + + VkStructureType sType void* pNext VkBool32 rectangularLines VkBool32 bresenhamLines @@ -5372,19 +5413,22 @@ typedef void* MTLSharedEvent_id; VkBool32 stippledBresenhamLines VkBool32 stippledSmoothLines - - VkStructureType sType + + + VkStructureType sType void* pNext uint32_t lineSubPixelPrecisionBits - - VkStructureType sType - const void* pNext - VkLineRasterizationModeEXT lineRasterizationMode + + + VkStructureType sType + const void* pNext + VkLineRasterizationModeKHR lineRasterizationMode VkBool32 stippledLineEnable uint32_t lineStippleFactor uint16_t lineStipplePattern + VkStructureType sType void* pNext @@ -5994,7 +6038,12 @@ typedef void* MTLSharedEvent_id; void*pNext VkBool32 clustercullingShader VkBool32 multiviewClusterCullingShader - + + + VkStructureType sType + void*pNext + VkBool32 clusterShadingRate + VkStructureType sType const void* pNext @@ -6183,7 +6232,7 @@ typedef void* MTLSharedEvent_id; VkFragmentShadingRateNV shadingRate VkFragmentShadingRateCombinerOpKHR combinerOps[2] - + VkStructureType sType const void* pNext VkDeviceSize accelerationStructureSize @@ -6674,6 +6723,18 @@ typedef void* MTLSharedEvent_id; const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot uint32_t referenceSlotCount const VkVideoReferenceSlotInfoKHR* pReferenceSlots + + + VkStructureType sType + void* pNext + VkBool32 videoMaintenance1 + + + VkStructureType sType + const void* pNext + VkQueryPool queryPool + uint32_t firstQuery + uint32_t queryCount Video Decode Codec Standard specific structures #include "vk_video/vulkan_video_codec_h264std.h" @@ -6805,6 +6866,44 @@ typedef void* MTLSharedEvent_id; const void* pNext const StdVideoDecodeH265ReferenceInfo* pStdReferenceInfo + #include "vk_video/vulkan_video_codec_av1std.h" + + + + #include "vk_video/vulkan_video_codec_av1std_decode.h" + + + + VkStructureType sType + const void* pNext + StdVideoAV1Profile stdProfile + VkBool32 filmGrainSupport + + + VkStructureType sType + void* pNext + StdVideoAV1Level maxLevel + + + VkStructureType sType + const void* pNext + const StdVideoAV1SequenceHeader* pStdSequenceHeader + + + VkStructureType sType + const void* pNext + const StdVideoDecodeAV1PictureInfo* pStdPictureInfo + int32_t referenceNameSlotIndices[VK_MAX_VIDEO_AV1_REFERENCES_PER_FRAME_KHR] + uint32_t frameHeaderOffset + uint32_t tileCount + const uint32_t* pTileOffsets + const uint32_t* pTileSizes + + + VkStructureType sType + const void* pNext + const StdVideoDecodeAV1ReferenceInfo* pStdReferenceInfo + VkStructureType sType const void* pNext @@ -6857,7 +6956,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkVideoCodingControlFlagsKHR flags + VkVideoCodingControlFlagsKHR flags VkStructureType sType @@ -6930,10 +7029,10 @@ typedef void* MTLSharedEvent_id; VkExtent2D encodeInputPictureGranularity VkVideoEncodeFeedbackFlagsKHR supportedEncodeFeedbackFlags - - VkStructureType sType + + VkStructureType sType void* pNext - VkVideoEncodeH264CapabilityFlagsEXT flags + VkVideoEncodeH264CapabilityFlagsKHR flags StdVideoH264LevelIdc maxLevelIdc uint32_t maxSliceCount uint32_t maxPPictureL0ReferenceCount @@ -6945,17 +7044,17 @@ typedef void* MTLSharedEvent_id; int32_t maxQp VkBool32 prefersGopRemainingFrames VkBool32 requiresGopRemainingFrames - VkVideoEncodeH264StdFlagsEXT stdSyntaxFlags + VkVideoEncodeH264StdFlagsKHR stdSyntaxFlags - - VkStructureType sType + + VkStructureType sType void* pNext - VkVideoEncodeH264RateControlFlagsEXT preferredRateControlFlags + VkVideoEncodeH264RateControlFlagsKHR preferredRateControlFlags uint32_t preferredGopFrameCount uint32_t preferredIdrPeriod uint32_t preferredConsecutiveBFrameCount uint32_t preferredTemporalLayerCount - VkVideoEncodeH264QpEXT preferredConstantQp + VkVideoEncodeH264QpKHR preferredConstantQp uint32_t preferredMaxL0ReferenceCount uint32_t preferredMaxL1ReferenceCount VkBool32 preferredStdEntropyCodingModeFlag @@ -6971,111 +7070,111 @@ typedef void* MTLSharedEvent_id; - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 useMaxLevelIdc StdVideoH264LevelIdc maxLevelIdc - - VkStructureType sType + + VkStructureType sType const void* pNext uint32_t stdSPSCount const StdVideoH264SequenceParameterSet* pStdSPSs uint32_t stdPPSCount const StdVideoH264PictureParameterSet* pStdPPSsList of Picture Parameters associated with the spsStd, above - - VkStructureType sType + + VkStructureType sType const void* pNext uint32_t maxStdSPSCount uint32_t maxStdPPSCount - const VkVideoEncodeH264SessionParametersAddInfoEXT* pParametersAddInfo + const VkVideoEncodeH264SessionParametersAddInfoKHR* pParametersAddInfo - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 writeStdSPS VkBool32 writeStdPPS uint32_t stdSPSId uint32_t stdPPSId - - VkStructureType sType + + VkStructureType sType void* pNext VkBool32 hasStdSPSOverrides VkBool32 hasStdPPSOverrides - - VkStructureType sType + + VkStructureType sType const void* pNext const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo - - VkStructureType sType + + VkStructureType sType const void* pNext uint32_t naluSliceEntryCount - const VkVideoEncodeH264NaluSliceInfoEXT* pNaluSliceEntries + const VkVideoEncodeH264NaluSliceInfoKHR* pNaluSliceEntries const StdVideoEncodeH264PictureInfo* pStdPictureInfo VkBool32 generatePrefixNalu - - VkStructureType sType + + VkStructureType sType const void* pNext StdVideoH264ProfileIdc stdProfileIdc - - VkStructureType sType + + VkStructureType sType const void* pNext int32_t constantQp const StdVideoEncodeH264SliceHeader* pStdSliceHeader - - VkStructureType sType + + VkStructureType sType const void* pNext - VkVideoEncodeH264RateControlFlagsEXT flags + VkVideoEncodeH264RateControlFlagsKHR flags uint32_t gopFrameCount uint32_t idrPeriod uint32_t consecutiveBFrameCount uint32_t temporalLayerCount - + int32_t qpI int32_t qpP int32_t qpB - + uint32_t frameISize uint32_t framePSize uint32_t frameBSize - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 useGopRemainingFrames uint32_t gopRemainingI uint32_t gopRemainingP uint32_t gopRemainingB - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 useMinQp - VkVideoEncodeH264QpEXT minQp + VkVideoEncodeH264QpKHR minQp VkBool32 useMaxQp - VkVideoEncodeH264QpEXT maxQp + VkVideoEncodeH264QpKHR maxQp VkBool32 useMaxFrameSize - VkVideoEncodeH264FrameSizeEXT maxFrameSize + VkVideoEncodeH264FrameSizeKHR maxFrameSize - - VkStructureType sType + + VkStructureType sType void* pNext - VkVideoEncodeH265CapabilityFlagsEXT flags + VkVideoEncodeH265CapabilityFlagsKHR flags StdVideoH265LevelIdc maxLevelIdc uint32_t maxSliceSegmentCount VkExtent2D maxTiles - VkVideoEncodeH265CtbSizeFlagsEXT ctbSizes - VkVideoEncodeH265TransformBlockSizeFlagsEXT transformBlockSizes + VkVideoEncodeH265CtbSizeFlagsKHR ctbSizes + VkVideoEncodeH265TransformBlockSizeFlagsKHR transformBlockSizes uint32_t maxPPictureL0ReferenceCount uint32_t maxBPictureL0ReferenceCount uint32_t maxL1ReferenceCount @@ -7085,17 +7184,17 @@ typedef void* MTLSharedEvent_id; int32_t maxQp VkBool32 prefersGopRemainingFrames VkBool32 requiresGopRemainingFrames - VkVideoEncodeH265StdFlagsEXT stdSyntaxFlags + VkVideoEncodeH265StdFlagsKHR stdSyntaxFlags - - VkStructureType sType + + VkStructureType sType void* pNext - VkVideoEncodeH265RateControlFlagsEXT preferredRateControlFlags + VkVideoEncodeH265RateControlFlagsKHR preferredRateControlFlags uint32_t preferredGopFrameCount uint32_t preferredIdrPeriod uint32_t preferredConsecutiveBFrameCount uint32_t preferredSubLayerCount - VkVideoEncodeH265QpEXT preferredConstantQp + VkVideoEncodeH265QpKHR preferredConstantQp uint32_t preferredMaxL0ReferenceCount uint32_t preferredMaxL1ReferenceCount @@ -7108,14 +7207,14 @@ typedef void* MTLSharedEvent_id; - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 useMaxLevelIdc StdVideoH265LevelIdc maxLevelIdc - - VkStructureType sType + + VkStructureType sType const void* pNext uint32_t stdVPSCount const StdVideoH265VideoParameterSet* pStdVPSs @@ -7124,16 +7223,16 @@ typedef void* MTLSharedEvent_id; uint32_t stdPPSCount const StdVideoH265PictureParameterSet* pStdPPSsList of Picture Parameters associated with the spsStd, above - - VkStructureType sType + + VkStructureType sType const void* pNext uint32_t maxStdVPSCount uint32_t maxStdSPSCount uint32_t maxStdPPSCount - const VkVideoEncodeH265SessionParametersAddInfoEXT* pParametersAddInfo + const VkVideoEncodeH265SessionParametersAddInfoKHR* pParametersAddInfo - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 writeStdVPS VkBool32 writeStdSPS @@ -7142,70 +7241,70 @@ typedef void* MTLSharedEvent_id; uint32_t stdSPSId uint32_t stdPPSId - - VkStructureType sType + + VkStructureType sType void* pNext VkBool32 hasStdVPSOverrides VkBool32 hasStdSPSOverrides VkBool32 hasStdPPSOverrides - - VkStructureType sType + + VkStructureType sType const void* pNext uint32_t naluSliceSegmentEntryCount - const VkVideoEncodeH265NaluSliceSegmentInfoEXT* pNaluSliceSegmentEntries + const VkVideoEncodeH265NaluSliceSegmentInfoKHR* pNaluSliceSegmentEntries const StdVideoEncodeH265PictureInfo* pStdPictureInfo - - VkStructureType sType + + VkStructureType sType const void* pNext int32_t constantQp const StdVideoEncodeH265SliceSegmentHeader* pStdSliceSegmentHeader - - VkStructureType sType + + VkStructureType sType const void* pNext - VkVideoEncodeH265RateControlFlagsEXT flags + VkVideoEncodeH265RateControlFlagsKHR flags uint32_t gopFrameCount uint32_t idrPeriod uint32_t consecutiveBFrameCount uint32_t subLayerCount - + int32_t qpI int32_t qpP int32_t qpB - + uint32_t frameISize uint32_t framePSize uint32_t frameBSize - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 useGopRemainingFrames uint32_t gopRemainingI uint32_t gopRemainingP uint32_t gopRemainingB - - VkStructureType sType + + VkStructureType sType const void* pNext VkBool32 useMinQp - VkVideoEncodeH265QpEXT minQp + VkVideoEncodeH265QpKHR minQp VkBool32 useMaxQp - VkVideoEncodeH265QpEXT maxQp + VkVideoEncodeH265QpKHR maxQp VkBool32 useMaxFrameSize - VkVideoEncodeH265FrameSizeEXT maxFrameSize + VkVideoEncodeH265FrameSizeKHR maxFrameSize - - VkStructureType sType + + VkStructureType sType const void* pNext StdVideoH265ProfileIdc stdProfileIdc - - VkStructureType sType + + VkStructureType sType const void* pNext const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo @@ -7246,8 +7345,8 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - size_t dataSize - const void* pData + size_t dataSize + const void* pData VkStructureType sType @@ -7332,7 +7431,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext VkDeviceAddress address - VkBufferUsageFlags usage + VkBufferUsageFlags usage VkStructureType sType @@ -7545,7 +7644,7 @@ typedef void* MTLSharedEvent_id; const void* pNext zx_handle_t collectionToken - + VkStructureType sType void* pNext uint32_t memoryTypeBits @@ -7599,6 +7698,36 @@ typedef void* MTLSharedEvent_id; uint32_t minBufferCountForDedicatedSlack uint32_t minBufferCountForSharedSlack + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaModuleNV) + VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaFunctionNV) + + VkStructureType sType + const void* pNext + size_t dataSize + const void* pData + + + VkStructureType sType + const void* pNext + VkCudaModuleNV module + const char* pName + + + VkStructureType sType + const void* pNext + VkCudaFunctionNV function + uint32_t gridDimX + uint32_t gridDimY + uint32_t gridDimZ + uint32_t blockDimX + uint32_t blockDimY + uint32_t blockDimZ + uint32_t sharedMemBytes + size_t paramCount + const void* const * pParams + size_t extraCount + const void* const * pExtras + VkStructureType sType void* pNext @@ -7998,7 +8127,7 @@ typedef void* MTLSharedEvent_id; VkMicromapEXT micromap - + VkStructureType sType void* pNext uint8_t pipelineIdentifier[VK_UUID_SIZE] @@ -8261,7 +8390,7 @@ typedef void* MTLSharedEvent_id; uint32_t vendorInfoCount VkDeviceSize vendorBinarySizeSpecified in bytes - + VkStructureType sType void* pNext char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault @@ -8438,7 +8567,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType - void* pNext + const void* pNext VkDirectDriverLoadingModeLUNARG mode uint32_t driverCount const VkDirectDriverLoadingInfoLUNARG* pDrivers @@ -8577,7 +8706,7 @@ typedef void* MTLSharedEvent_id; VkBool32 cooperativeMatrix VkBool32 cooperativeMatrixRobustBufferAccess - + VkStructureType sType void* pNext uint32_t MSize @@ -8612,7 +8741,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkPipelineCreateFlags flags + VkPipelineCreateFlags flags uint32_t stageCount const VkPipelineShaderStageCreateInfo* pStages const VkPipelineLibraryCreateInfoKHR* pLibraryInfo @@ -8642,6 +8771,65 @@ typedef void* MTLSharedEvent_id; VkDeviceOrHostAddressConstAMDX infos uint64_t stride + + VkStructureType sType + const void* pNext + VkResult* pResult + + + VkStructureType sType + const void* pNext + VkShaderStageFlags stageFlags + VkPipelineLayout layout + uint32_t firstSet + uint32_t descriptorSetCount + const VkDescriptorSet* pDescriptorSets + uint32_t dynamicOffsetCount + const uint32_t* pDynamicOffsets + + + VkStructureType sType + const void* pNext + VkPipelineLayout layout + VkShaderStageFlags stageFlags + uint32_t offset + uint32_t size + const void* pValues + + + VkStructureType sType + const void* pNext + VkShaderStageFlags stageFlags + VkPipelineLayout layout + uint32_t set + uint32_t descriptorWriteCount + const VkWriteDescriptorSet* pDescriptorWrites + + + VkStructureType sType + const void* pNext + VkDescriptorUpdateTemplate descriptorUpdateTemplate + VkPipelineLayout layout + uint32_t set + const void* pData + + + VkStructureType sType + const void* pNext + VkShaderStageFlags stageFlags + VkPipelineLayout layout + uint32_t firstSet + uint32_t setCount + const uint32_t* pBufferIndices + const VkDeviceSize* pOffsets + + + VkStructureType sType + const void* pNext + VkShaderStageFlags stageFlags + VkPipelineLayout layout + uint32_t set + VkStructureType sType void* pNext @@ -8699,6 +8887,12 @@ typedef void* MTLSharedEvent_id; void* pNext VkLayeredDriverUnderlyingApiMSFT underlyingAPI + + VkStructureType sType + void* pNext + VkBool32 perStageDescriptorSet + VkBool32 dynamicPipelineLayout + VkStructureType sType void* pNext @@ -8707,7 +8901,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext - VkBool32 nullColorAttachmentWithExternalFormatResolve + VkBool32 nullColorAttachmentWithExternalFormatResolve VkChromaLocation externalFormatResolveChromaOffsetX VkChromaLocation externalFormatResolveChromaOffsetY @@ -8738,7 +8932,8 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkLatencyTimingsFrameReportNV* pTimings + uint32_t timingCount + VkLatencyTimingsFrameReportNV* pTimings VkStructureType sType @@ -8776,9 +8971,113 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - uint32_t presentModeCount + uint32_t presentModeCount VkPresentModeKHR* pPresentModes + + VkStructureType sType + void* pNext + VkBool32 cudaKernelLaunchFeatures + + + VkStructureType sType + void* pNext + uint32_t computeCapabilityMinor + uint32_t computeCapabilityMajor + + + VkStructureType sType + void* pNext + uint32_t shaderCoreCount + + + VkStructureType sType + void* pNext + VkBool32 schedulingControls + + + VkStructureType sType + void* pNext + VkPhysicalDeviceSchedulingControlsFlagsARM schedulingControlsFlags + + + VkStructureType sType + void* pNext + VkBool32 relaxedLineRasterization + + + VkStructureType sType + void* pNext + VkBool32 renderPassStriped + + + VkStructureType sType + void* pNext + VkExtent2D renderPassStripeGranularity + uint32_t maxRenderPassStripes + + + VkStructureType sType + const void* pNext + VkRect2D stripeArea + + + VkStructureType sType + const void* pNext + uint32_t stripeInfoCount + const VkRenderPassStripeInfoARM* pStripeInfos + + + VkStructureType sType + const void* pNext + uint32_t stripeSemaphoreInfoCount + const VkSemaphoreSubmitInfo* pStripeSemaphoreInfos + + + VkStructureType sType + void* pNext + VkBool32 shaderMaximalReconvergence + + + VkStructureType sType + void* pNext + VkBool32 shaderSubgroupRotate + VkBool32 shaderSubgroupRotateClustered + + + VkStructureType sType + void* pNext + VkBool32 shaderExpectAssume + + + VkStructureType sType + void* pNext + VkBool32 shaderFloatControls2 + + + VkStructureType sType + void* pNext + VkBool32 dynamicRenderingLocalRead + + + VkStructureType sType + const void* pNext + uint32_t colorAttachmentCount + const uint32_t* pColorAttachmentLocations + + + VkStructureType sType + const void* pNext + uint32_t colorAttachmentCount + const uint32_t* pColorAttachmentInputIndices + const uint32_t* pDepthInputAttachmentIndex + const uint32_t* pStencilInputAttachmentIndex + + + VkStructureType sType + void* pNext + VkBool32 shaderQuadControl + @@ -8817,6 +9116,7 @@ typedef void* MTLSharedEvent_id; + @@ -9649,11 +9949,11 @@ typedef void* MTLSharedEvent_id; - - - - - + + + + + @@ -9745,6 +10045,16 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + @@ -10193,11 +10503,15 @@ typedef void* MTLSharedEvent_id; - - - - - + + + + + + + + + @@ -10436,6 +10750,9 @@ typedef void* MTLSharedEvent_id; + + + @@ -10518,45 +10835,45 @@ typedef void* MTLSharedEvent_id; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10634,58 +10951,58 @@ typedef void* MTLSharedEvent_id; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11655,7 +11972,7 @@ typedef void* MTLSharedEvent_id; void vkCmdBindIndexBuffer VkCommandBuffer commandBuffer - VkBuffer buffer + VkBuffer buffer VkDeviceSize offset VkIndexType indexType @@ -12980,8 +13297,8 @@ typedef void* MTLSharedEvent_id; VkDevice device VkImage image int nativeFenceFd - VkSemaphore semaphore - VkFence fence + VkSemaphore semaphore + VkFence fence VkResult vkQueueSignalReleaseImageANDROID @@ -13007,19 +13324,21 @@ typedef void* MTLSharedEvent_id; VkBool32 localDimmingEnable - VkResult vkGetPhysicalDeviceCalibrateableTimeDomainsEXT + VkResult vkGetPhysicalDeviceCalibrateableTimeDomainsKHR VkPhysicalDevice physicalDevice uint32_t* pTimeDomainCount - VkTimeDomainEXT* pTimeDomains + VkTimeDomainKHR* pTimeDomains + - VkResult vkGetCalibratedTimestampsEXT + VkResult vkGetCalibratedTimestampsKHR VkDevice device uint32_t timestampCount - const VkCalibratedTimestampInfoEXT* pTimestampInfos + const VkCalibratedTimestampInfoKHR* pTimestampInfos uint64_t* pTimestamps uint64_t* pMaxDeviation + VkResult vkSetDebugUtilsObjectNameEXT VkDevice device @@ -13738,17 +14057,18 @@ typedef void* MTLSharedEvent_id; VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations - void vkCmdSetLineStippleEXT + void vkCmdSetLineStippleKHR VkCommandBuffer commandBuffer uint32_t lineStippleFactor uint16_t lineStipplePattern + VkResult vkGetFaultData VkDevice device VkFaultQueryBehavior faultQueryBehavior VkBool32* pUnrecordedFaults - uint32_t* pFaultCount + uint32_t* pFaultCount VkFaultData* pFaults @@ -13867,7 +14187,7 @@ typedef void* MTLSharedEvent_id; void vkCmdBindIndexBuffer2KHR VkCommandBuffer commandBuffer - VkBuffer buffer + VkBuffer buffer VkDeviceSize offset VkDeviceSize size VkIndexType indexType @@ -14596,6 +14916,44 @@ typedef void* MTLSharedEvent_id; VkBufferCollectionFUCHSIA collection VkBufferCollectionPropertiesFUCHSIA* pProperties + + VkResult vkCreateCudaModuleNV + VkDevice device + const VkCudaModuleCreateInfoNV* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkCudaModuleNV* pModule + + + VkResult vkGetCudaModuleCacheNV + VkDevice device + VkCudaModuleNV module + size_t* pCacheSize + void* pCacheData + + + VkResult vkCreateCudaFunctionNV + VkDevice device + const VkCudaFunctionCreateInfoNV* pCreateInfo + const VkAllocationCallbacks* pAllocator + VkCudaFunctionNV* pFunction + + + void vkDestroyCudaModuleNV + VkDevice device + VkCudaModuleNV module + const VkAllocationCallbacks* pAllocator + + + void vkDestroyCudaFunctionNV + VkDevice device + VkCudaFunctionNV function + const VkAllocationCallbacks* pAllocator + + + void vkCmdCudaLaunchKernelNV + VkCommandBuffer commandBuffer + const VkCudaLaunchInfoNV* pLaunchInfo + void vkCmdBeginRendering VkCommandBuffer commandBuffer @@ -14833,7 +15191,7 @@ typedef void* MTLSharedEvent_id; void vkDestroyShaderEXT VkDevice device - VkShaderEXT shader + VkShaderEXT shader const VkAllocationCallbacks* pAllocator @@ -14907,6 +15265,36 @@ typedef void* MTLSharedEvent_id; VkDeviceAddress scratch VkDeviceAddress countInfo + + void vkCmdBindDescriptorSets2KHR + VkCommandBuffer commandBuffer + const VkBindDescriptorSetsInfoKHR* pBindDescriptorSetsInfo + + + void vkCmdPushConstants2KHR + VkCommandBuffer commandBuffer + const VkPushConstantsInfoKHR* pPushConstantsInfo + + + void vkCmdPushDescriptorSet2KHR + VkCommandBuffer commandBuffer + const VkPushDescriptorSetInfoKHR* pPushDescriptorSetInfo + + + void vkCmdPushDescriptorSetWithTemplate2KHR + VkCommandBuffer commandBuffer + const VkPushDescriptorSetWithTemplateInfoKHR* pPushDescriptorSetWithTemplateInfo + + + void vkCmdSetDescriptorBufferOffsets2EXT + VkCommandBuffer commandBuffer + const VkSetDescriptorBufferOffsetsInfoEXT* pSetDescriptorBufferOffsetsInfo + + + void vkCmdBindDescriptorBufferEmbeddedSamplers2EXT + VkCommandBuffer commandBuffer + const VkBindDescriptorBufferEmbeddedSamplersInfoEXT* pBindDescriptorBufferEmbeddedSamplersInfo + VkResult vkSetLatencySleepModeNV VkDevice device @@ -14929,7 +15317,6 @@ typedef void* MTLSharedEvent_id; void vkGetLatencyTimingsNV VkDevice device VkSwapchainKHR swapchain - uint32_t* pTimingCount VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo @@ -14937,6 +15324,16 @@ typedef void* MTLSharedEvent_id; VkQueue queue const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo + + void vkCmdSetRenderingAttachmentLocationsKHR + VkCommandBuffer commandBuffer + const VkRenderingAttachmentLocationInfoKHR* pLocationInfo + + + void vkCmdSetRenderingInputAttachmentIndicesKHR + VkCommandBuffer commandBuffer + const VkRenderingInputAttachmentIndexInfoKHR* pLocationInfo + @@ -16773,7 +17170,7 @@ typedef void* MTLSharedEvent_id; - + @@ -16950,101 +17347,101 @@ typedef void* MTLSharedEvent_id; - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -17348,9 +17745,9 @@ typedef void* MTLSharedEvent_id; - + - + @@ -17826,7 +18223,7 @@ typedef void* MTLSharedEvent_id; - + @@ -17962,10 +18359,12 @@ typedef void* MTLSharedEvent_id; - + - - + + + + @@ -18332,10 +18731,18 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + + + + + @@ -19058,7 +19465,7 @@ typedef void* MTLSharedEvent_id; - + @@ -19070,7 +19477,7 @@ typedef void* MTLSharedEvent_id; - + @@ -19078,13 +19485,13 @@ typedef void* MTLSharedEvent_id; - + - + @@ -19176,11 +19583,15 @@ typedef void* MTLSharedEvent_id; - + - + + + + + @@ -19203,7 +19614,7 @@ typedef void* MTLSharedEvent_id; - + @@ -19246,13 +19657,13 @@ typedef void* MTLSharedEvent_id; - + - - - - - + + + + + @@ -19719,10 +20130,19 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + + + + + + @@ -19739,10 +20159,12 @@ typedef void* MTLSharedEvent_id; - + - - + + + + @@ -19861,9 +20283,9 @@ typedef void* MTLSharedEvent_id; - + - + @@ -20031,14 +20453,14 @@ typedef void* MTLSharedEvent_id; - + - - - - + + + + @@ -20081,12 +20503,12 @@ typedef void* MTLSharedEvent_id; - + - - + + @@ -20363,9 +20785,9 @@ typedef void* MTLSharedEvent_id; - + - + @@ -20571,43 +20993,43 @@ typedef void* MTLSharedEvent_id; - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -20645,8 +21067,8 @@ typedef void* MTLSharedEvent_id; - - + + @@ -20661,47 +21083,71 @@ typedef void* MTLSharedEvent_id; - + - + - + - + - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -20717,7 +21163,7 @@ typedef void* MTLSharedEvent_id; - + @@ -21134,9 +21580,9 @@ typedef void* MTLSharedEvent_id; - + - + @@ -21220,7 +21666,7 @@ typedef void* MTLSharedEvent_id; - + @@ -21839,7 +22285,7 @@ typedef void* MTLSharedEvent_id; - + @@ -21933,11 +22379,11 @@ typedef void* MTLSharedEvent_id; - + - - + + @@ -21961,10 +22407,11 @@ typedef void* MTLSharedEvent_id; - + + @@ -21972,6 +22419,7 @@ typedef void* MTLSharedEvent_id; + @@ -22061,16 +22509,28 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + - + - - + + + + + + + + + + @@ -22128,10 +22588,20 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + + + + + + + @@ -22230,10 +22700,12 @@ typedef void* MTLSharedEvent_id; - + - - + + + + @@ -22264,7 +22736,7 @@ typedef void* MTLSharedEvent_id; - + @@ -22272,7 +22744,7 @@ typedef void* MTLSharedEvent_id; - + @@ -22357,7 +22829,7 @@ typedef void* MTLSharedEvent_id; - + @@ -22394,13 +22866,12 @@ typedef void* MTLSharedEvent_id; - + - @@ -22411,21 +22882,10 @@ typedef void* MTLSharedEvent_id; - - - - - - - - - - - @@ -22436,15 +22896,45 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -22683,8 +23173,8 @@ typedef void* MTLSharedEvent_id; - - + + @@ -22845,6 +23335,7 @@ typedef void* MTLSharedEvent_id; + @@ -22925,15 +23416,31 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + + + + + + + @@ -22984,7 +23491,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23021,7 +23528,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23121,10 +23628,14 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + @@ -23183,9 +23694,9 @@ typedef void* MTLSharedEvent_id; - + - + @@ -23252,7 +23763,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23268,10 +23779,22 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + + + + + + + + + @@ -23286,19 +23809,26 @@ typedef void* MTLSharedEvent_id; - + - - - - + + + + + + + + + - + - - - + + + + + @@ -23307,7 +23837,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23320,7 +23850,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23333,7 +23863,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23343,7 +23873,7 @@ typedef void* MTLSharedEvent_id; - + @@ -23374,16 +23904,25 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + + + + - + - - + + + + @@ -23392,10 +23931,12 @@ typedef void* MTLSharedEvent_id; - + - - + + + + @@ -23437,19 +23978,31 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + - + - - + + + + + + + + + + + - + @@ -23497,22 +24050,59 @@ typedef void* MTLSharedEvent_id; - + - - + + + + + + + - + - - + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -23534,7 +24124,91 @@ typedef void* MTLSharedEvent_id; - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25156,6 +25830,30 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + + + + + + + + + + + + + + + @@ -25651,6 +26349,21 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + + + + + + From 35882c905176dfd46d446af09c085e7655562771 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 20 Feb 2024 21:07:13 +0100 Subject: [PATCH 1344/1506] winevulkan: Update to VK spec version 1.3.278. The new spec uses length attribute for some static arrays. Change is_dynamic_array to account account for that. Eventually we could use the new information to improve conversion thunks. (cherry picked from commit f380e34a5e94371f691179711e6ce4697be0da61) --- dlls/winevulkan/make_vulkan | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 4f5df2fc697..e7b91b845e7 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -64,7 +64,7 @@ from enum import Enum LOGGER = logging.Logger("vulkan") LOGGER.addHandler(logging.StreamHandler()) -VK_XML_VERSION = "1.3.277" +VK_XML_VERSION = "1.3.278" WINE_VK_VERSION = (1, 3) # Filenames to create. @@ -126,6 +126,7 @@ UNSUPPORTED_EXTENSIONS = [ # winevulkan may nonetheless use, or extensions we want to generate headers for # but not expose to applications (useful for test commits) UNEXPOSED_EXTENSIONS = { + "VK_EXT_map_memory_placed", } # The Vulkan loader provides entry-points for core functionality and important @@ -1399,7 +1400,7 @@ class VkVariable(object): Vulkan uses this for dynamically sized arrays for which there is a 'count' parameter. """ - return self.dyn_array_len is not None + return self.dyn_array_len is not None and self.array_len is None def is_static_array(self): """ Returns if the member is an array. From d012b4b1340888d40a59b7fc60d476961f03316a Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 6 Mar 2024 16:22:39 +0200 Subject: [PATCH 1345/1506] Update vk.xml to 1.3.278. --- dlls/winevulkan/vk.xml | 315 ++++++++++++++++++++++++++--------------- 1 file changed, 203 insertions(+), 112 deletions(-) diff --git a/dlls/winevulkan/vk.xml b/dlls/winevulkan/vk.xml index fb92b7c2373..c8464a2eae5 100644 --- a/dlls/winevulkan/vk.xml +++ b/dlls/winevulkan/vk.xml @@ -175,7 +175,7 @@ branch of the member gitlab server. #define VKSC_API_VERSION_1_0 VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 277 +#define VK_HEADER_VERSION 278 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) // Version of this file @@ -338,8 +338,8 @@ typedef void* MTLSharedEvent_id; typedef VkFlags VkCommandBufferResetFlags; typedef VkFlags VkCommandBufferUsageFlags; typedef VkFlags VkQueryPipelineStatisticFlags; - typedef VkFlags VkMemoryMapFlags; - typedef VkFlags VkMemoryUnmapFlagsKHR; + typedef VkFlags VkMemoryMapFlags; + typedef VkFlags VkMemoryUnmapFlagsKHR; typedef VkFlags VkImageAspectFlags; typedef VkFlags VkSparseMemoryBindFlags; typedef VkFlags VkSparseImageFormatFlags; @@ -502,7 +502,7 @@ typedef void* MTLSharedEvent_id; typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsKHR; Video Encode Core extension - typedef VkFlags VkVideoEncodeFlagsKHR; + typedef VkFlags VkVideoEncodeFlagsKHR; typedef VkFlags VkVideoEncodeUsageFlagsKHR; typedef VkFlags VkVideoEncodeContentFlagsKHR; typedef VkFlags VkVideoEncodeCapabilityFlagsKHR; @@ -619,6 +619,7 @@ typedef void* MTLSharedEvent_id; + @@ -872,6 +873,7 @@ typedef void* MTLSharedEvent_id; + Enumerated types in the header, but not used by the API @@ -900,6 +902,7 @@ typedef void* MTLSharedEvent_id; Video H.265 Decode extensions Video Encode extensions + @@ -1042,20 +1045,20 @@ typedef void* MTLSharedEvent_id; uint32_t vendorID uint32_t deviceID VkPhysicalDeviceType deviceType - char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] + char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] uint8_t pipelineCacheUUID[VK_UUID_SIZE] VkPhysicalDeviceLimits limits VkPhysicalDeviceSparseProperties sparseProperties - char extensionName[VK_MAX_EXTENSION_NAME_SIZE]extension name - uint32_t specVersionversion of the extension specification implemented + char extensionName[VK_MAX_EXTENSION_NAME_SIZE]extension name + uint32_t specVersionversion of the extension specification implemented - char layerName[VK_MAX_EXTENSION_NAME_SIZE]layer name - uint32_t specVersionversion of the layer specification implemented - uint32_t implementationVersionbuild or release version of the layer's library - char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the layer + char layerName[VK_MAX_EXTENSION_NAME_SIZE]layer name + uint32_t specVersionversion of the layer specification implemented + uint32_t implementationVersionbuild or release version of the layer's library + char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the layer VkStructureType sType @@ -1111,10 +1114,10 @@ typedef void* MTLSharedEvent_id; VkExtent3D minImageTransferGranularityMinimum alignment requirement for image transfers - uint32_t memoryTypeCount - VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES] - uint32_t memoryHeapCount - VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS] + uint32_t memoryTypeCount + VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES] + uint32_t memoryHeapCount + VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS] VkStructureType sType @@ -2593,8 +2596,8 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext VkDriverId driverID - char driverName[VK_MAX_DRIVER_NAME_SIZE] - char driverInfo[VK_MAX_DRIVER_INFO_SIZE] + char driverName[VK_MAX_DRIVER_NAME_SIZE] + char driverInfo[VK_MAX_DRIVER_INFO_SIZE] VkConformanceVersion conformanceVersion @@ -3025,7 +3028,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext uint32_t physicalDeviceCount - VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE] + VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE] VkBool32 subsetAllocation @@ -3308,7 +3311,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext - VkSurfaceKHR surface + VkSurfaceKHR surface VkStructureType sType @@ -3839,11 +3842,11 @@ typedef void* MTLSharedEvent_id; VkBool32 globalPriorityQuery - + VkStructureType sType - void* pNext - uint32_t priorityCount - VkQueueGlobalPriorityKHR priorities[VK_MAX_GLOBAL_PRIORITY_SIZE_KHR] + void* pNext + uint32_t priorityCount + VkQueueGlobalPriorityKHR priorities[VK_MAX_GLOBAL_PRIORITY_SIZE_KHR] @@ -5118,9 +5121,9 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext VkPerformanceCounterDescriptionFlagsKHR flags - char name[VK_MAX_DESCRIPTION_SIZE] - char category[VK_MAX_DESCRIPTION_SIZE] - char description[VK_MAX_DESCRIPTION_SIZE] + char name[VK_MAX_DESCRIPTION_SIZE] + char category[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] VkStructureType sType @@ -5189,7 +5192,7 @@ typedef void* MTLSharedEvent_id; VkBool32 valueBool const char* valueString - + VkPerformanceValueTypeINTEL type VkPerformanceValueDataINTEL data @@ -5295,10 +5298,10 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext - VkShaderStageFlags stages - char name[VK_MAX_DESCRIPTION_SIZE] - char description[VK_MAX_DESCRIPTION_SIZE] - uint32_t subgroupSize + VkShaderStageFlags stages + char name[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] + uint32_t subgroupSize VkStructureType sType @@ -5314,19 +5317,19 @@ typedef void* MTLSharedEvent_id; VkStructureType sType - void* pNext - char name[VK_MAX_DESCRIPTION_SIZE] - char description[VK_MAX_DESCRIPTION_SIZE] + void* pNext + char name[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] VkPipelineExecutableStatisticFormatKHR format VkPipelineExecutableStatisticValueKHR value VkStructureType sType - void* pNext - char name[VK_MAX_DESCRIPTION_SIZE] - char description[VK_MAX_DESCRIPTION_SIZE] - VkBool32 isText - size_t dataSize + void* pNext + char name[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] + VkBool32 isText + size_t dataSize void* pData @@ -5372,7 +5375,7 @@ typedef void* MTLSharedEvent_id; - + VkStructureType sType void* pNext VkRenderPass renderPass @@ -5525,56 +5528,56 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext VkDriverId driverID - char driverName[VK_MAX_DRIVER_NAME_SIZE] - char driverInfo[VK_MAX_DRIVER_INFO_SIZE] + char driverName[VK_MAX_DRIVER_NAME_SIZE] + char driverInfo[VK_MAX_DRIVER_INFO_SIZE] VkConformanceVersion conformanceVersion VkShaderFloatControlsIndependence denormBehaviorIndependence VkShaderFloatControlsIndependence roundingModeIndependence - VkBool32 shaderSignedZeroInfNanPreserveFloat16An implementation can preserve signed zero, nan, inf - VkBool32 shaderSignedZeroInfNanPreserveFloat32An implementation can preserve signed zero, nan, inf - VkBool32 shaderSignedZeroInfNanPreserveFloat64An implementation can preserve signed zero, nan, inf - VkBool32 shaderDenormPreserveFloat16An implementation can preserve denormals - VkBool32 shaderDenormPreserveFloat32An implementation can preserve denormals - VkBool32 shaderDenormPreserveFloat64An implementation can preserve denormals - VkBool32 shaderDenormFlushToZeroFloat16An implementation can flush to zero denormals - VkBool32 shaderDenormFlushToZeroFloat32An implementation can flush to zero denormals - VkBool32 shaderDenormFlushToZeroFloat64An implementation can flush to zero denormals - VkBool32 shaderRoundingModeRTEFloat16An implementation can support RTE - VkBool32 shaderRoundingModeRTEFloat32An implementation can support RTE - VkBool32 shaderRoundingModeRTEFloat64An implementation can support RTE - VkBool32 shaderRoundingModeRTZFloat16An implementation can support RTZ - VkBool32 shaderRoundingModeRTZFloat32An implementation can support RTZ - VkBool32 shaderRoundingModeRTZFloat64An implementation can support RTZ - uint32_t maxUpdateAfterBindDescriptorsInAllPools - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative - VkBool32 shaderSampledImageArrayNonUniformIndexingNative - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative - VkBool32 shaderStorageImageArrayNonUniformIndexingNative - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative - VkBool32 robustBufferAccessUpdateAfterBind - VkBool32 quadDivergentImplicitLod - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments - uint32_t maxPerStageUpdateAfterBindResources - uint32_t maxDescriptorSetUpdateAfterBindSamplers - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic - uint32_t maxDescriptorSetUpdateAfterBindSampledImages - uint32_t maxDescriptorSetUpdateAfterBindStorageImages - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments - VkResolveModeFlags supportedDepthResolveModessupported depth resolve modes - VkResolveModeFlags supportedStencilResolveModessupported stencil resolve modes - VkBool32 independentResolveNonedepth and stencil resolve modes can be set independently if one of them is none - VkBool32 independentResolvedepth and stencil resolve modes can be set independently - VkBool32 filterMinmaxSingleComponentFormats - VkBool32 filterMinmaxImageComponentMapping - uint64_t maxTimelineSemaphoreValueDifference + VkBool32 shaderSignedZeroInfNanPreserveFloat16An implementation can preserve signed zero, nan, inf + VkBool32 shaderSignedZeroInfNanPreserveFloat32An implementation can preserve signed zero, nan, inf + VkBool32 shaderSignedZeroInfNanPreserveFloat64An implementation can preserve signed zero, nan, inf + VkBool32 shaderDenormPreserveFloat16An implementation can preserve denormals + VkBool32 shaderDenormPreserveFloat32An implementation can preserve denormals + VkBool32 shaderDenormPreserveFloat64An implementation can preserve denormals + VkBool32 shaderDenormFlushToZeroFloat16An implementation can flush to zero denormals + VkBool32 shaderDenormFlushToZeroFloat32An implementation can flush to zero denormals + VkBool32 shaderDenormFlushToZeroFloat64An implementation can flush to zero denormals + VkBool32 shaderRoundingModeRTEFloat16An implementation can support RTE + VkBool32 shaderRoundingModeRTEFloat32An implementation can support RTE + VkBool32 shaderRoundingModeRTEFloat64An implementation can support RTE + VkBool32 shaderRoundingModeRTZFloat16An implementation can support RTZ + VkBool32 shaderRoundingModeRTZFloat32An implementation can support RTZ + VkBool32 shaderRoundingModeRTZFloat64An implementation can support RTZ + uint32_t maxUpdateAfterBindDescriptorsInAllPools + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative + VkBool32 shaderSampledImageArrayNonUniformIndexingNative + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative + VkBool32 shaderStorageImageArrayNonUniformIndexingNative + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative + VkBool32 robustBufferAccessUpdateAfterBind + VkBool32 quadDivergentImplicitLod + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments + uint32_t maxPerStageUpdateAfterBindResources + uint32_t maxDescriptorSetUpdateAfterBindSamplers + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic + uint32_t maxDescriptorSetUpdateAfterBindSampledImages + uint32_t maxDescriptorSetUpdateAfterBindStorageImages + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments + VkResolveModeFlags supportedDepthResolveModessupported depth resolve modes + VkResolveModeFlags supportedStencilResolveModessupported stencil resolve modes + VkBool32 independentResolveNonedepth and stencil resolve modes can be set independently if one of them is none + VkBool32 independentResolvedepth and stencil resolve modes can be set independently + VkBool32 filterMinmaxSingleComponentFormats + VkBool32 filterMinmaxImageComponentMapping + uint64_t maxTimelineSemaphoreValueDifference VkSampleCountFlags framebufferIntegerColorSampleCounts @@ -5670,12 +5673,12 @@ typedef void* MTLSharedEvent_id; VkStructureType sType - void* pNext - char name[VK_MAX_EXTENSION_NAME_SIZE] - char version[VK_MAX_EXTENSION_NAME_SIZE] - VkToolPurposeFlags purposes - char description[VK_MAX_DESCRIPTION_SIZE] - char layer[VK_MAX_EXTENSION_NAME_SIZE] + void* pNext + char name[VK_MAX_EXTENSION_NAME_SIZE] + char version[VK_MAX_EXTENSION_NAME_SIZE] + VkToolPurposeFlags purposes + char description[VK_MAX_DESCRIPTION_SIZE] + char layer[VK_MAX_EXTENSION_NAME_SIZE] @@ -7934,7 +7937,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType void* pNext uint32_t identifierSize - uint8_t identifier[VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT] + uint8_t identifier[VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT] VkStructureType sType @@ -7986,7 +7989,7 @@ typedef void* MTLSharedEvent_id; VkSubpassMergeStatusEXT subpassMergeStatus - char description[VK_MAX_DESCRIPTION_SIZE] + char description[VK_MAX_DESCRIPTION_SIZE] uint32_t postMergeIndex @@ -8379,9 +8382,9 @@ typedef void* MTLSharedEvent_id; VkDeviceSize addressPrecision - char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault - uint64_t vendorFaultCode - uint64_t vendorFaultData + char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault + uint64_t vendorFaultCode + uint64_t vendorFaultData VkStructureType sType @@ -8392,11 +8395,11 @@ typedef void* MTLSharedEvent_id; VkStructureType sType - void* pNext - char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault - VkDeviceFaultAddressInfoEXT* pAddressInfos - VkDeviceFaultVendorInfoEXT* pVendorInfos - void* pVendorBinaryData + void* pNext + char description[VK_MAX_DESCRIPTION_SIZE]Free-form description of the fault + VkDeviceFaultAddressInfoEXT* pAddressInfos + VkDeviceFaultVendorInfoEXT* pVendorInfos + void* pVendorBinaryData The fields in this structure are non-normative since structure packing is implementation-defined in C. The specification defines the normative layout. @@ -8935,7 +8938,7 @@ typedef void* MTLSharedEvent_id; uint32_t timingCount VkLatencyTimingsFrameReportNV* pTimings - + VkStructureType sType const void* pNext uint64_t presentID @@ -9078,6 +9081,28 @@ typedef void* MTLSharedEvent_id; void* pNext VkBool32 shaderQuadControl + + VkStructureType sType + void* pNext + VkBool32 shaderFloat16VectorAtomics + + + VkStructureType sType + void* pNext + VkBool32 memoryMapPlaced + VkBool32 memoryMapRangePlaced + VkBool32 memoryUnmapReserve + + + VkStructureType sType + void* pNext + VkDeviceSize minPlacedMemoryMapAlignment + + + VkStructureType sType + const void* pNext + void* pPlacedAddress + @@ -9837,6 +9862,8 @@ typedef void* MTLSharedEvent_id; + + @@ -10800,6 +10827,8 @@ typedef void* MTLSharedEvent_id; + + @@ -11211,6 +11240,8 @@ typedef void* MTLSharedEvent_id; + + @@ -11705,11 +11736,11 @@ typedef void* MTLSharedEvent_id; const VkAllocationCallbacks* pAllocator VkPipeline* pPipelines - + VkResult vkGetDeviceSubpassShadingMaxWorkgroupSizeHUAWEI VkDevice device VkRenderPass renderpass - VkExtent2D* pMaxWorkgroupSize + VkExtent2D* pMaxWorkgroupSize void vkDestroyPipeline @@ -15175,12 +15206,12 @@ typedef void* MTLSharedEvent_id; const VkMemoryMapInfoKHR* pMemoryMapInfo void** ppData - + VkResult vkUnmapMemory2KHR VkDevice device const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo - + VkResult vkCreateShadersEXT VkDevice device uint32_t createInfoCount @@ -15491,6 +15522,7 @@ typedef void* MTLSharedEvent_id; + @@ -20638,15 +20670,24 @@ typedef void* MTLSharedEvent_id; + - + - - + + + + + + + + + + @@ -23370,7 +23411,8 @@ typedef void* MTLSharedEvent_id; - + + @@ -23590,6 +23632,7 @@ typedef void* MTLSharedEvent_id; + @@ -24155,6 +24198,16 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + @@ -24211,6 +24264,38 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25789,6 +25874,9 @@ typedef void* MTLSharedEvent_id; + + + @@ -25926,6 +26014,9 @@ typedef void* MTLSharedEvent_id; + + + From b4cedf18dc829bc5064c75eab381bc6fc22647e1 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 20 Feb 2024 21:26:32 +0100 Subject: [PATCH 1346/1506] winevulkan: Remove no longer needed spec workarounds. (cherry picked from commit 7995f3813c9df22a752d59500b3a9f3e625b1fa0) --- dlls/winevulkan/make_vulkan | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index e7b91b845e7..05ffd93d65e 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2125,14 +2125,11 @@ class VkStruct(Sequence): # Those structs seem to be broken in spec, they are specified as # returned only, but documented as input structs. - if name in ["VkSubpassShadingPipelineCreateInfoHUAWEI", - "VkPipelineShaderStageRequiredSubgroupSizeCreateInfo"]: + if name in ["VkPipelineShaderStageRequiredSubgroupSizeCreateInfo"]: returnedonly = False # Those structs don't have returnedonly in spec, but they could (should?). - if name in ["VkSurfaceCapabilitiesPresentBarrierNV", - "VkCooperativeMatrixPropertiesNV", - "VkPerformanceValueINTEL"]: + if name in ["VkSurfaceCapabilitiesPresentBarrierNV"]: returnedonly = True structextends = struct.attrib.get("structextends") From b9aad66250a0343c152d0c89c5561d2a2322a243 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 2 Mar 2024 17:12:15 +0100 Subject: [PATCH 1347/1506] winevulkan: Update to VK spec version 1.3.279. Signed-off-by: Philip Rebohle (cherry picked from commit ec6879b78ec58bfad9f3039fdab9498173a44f56) --- dlls/winevulkan/make_vulkan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 05ffd93d65e..467eee61c2a 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -64,7 +64,7 @@ from enum import Enum LOGGER = logging.Logger("vulkan") LOGGER.addHandler(logging.StreamHandler()) -VK_XML_VERSION = "1.3.278" +VK_XML_VERSION = "1.3.279" WINE_VK_VERSION = (1, 3) # Filenames to create. From d78dcf8935897e8d67d4a997f1adcc7ef1ad0960 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 6 Mar 2024 16:34:43 +0200 Subject: [PATCH 1348/1506] Update vk.xml to 1.3.279. --- dlls/winevulkan/vk.xml | 73 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 10 deletions(-) diff --git a/dlls/winevulkan/vk.xml b/dlls/winevulkan/vk.xml index c8464a2eae5..ee9221e9eb3 100644 --- a/dlls/winevulkan/vk.xml +++ b/dlls/winevulkan/vk.xml @@ -175,7 +175,7 @@ branch of the member gitlab server. #define VKSC_API_VERSION_1_0 VK_MAKE_API_VERSION(VKSC_API_VARIANT, 1, 0, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 278 +#define VK_HEADER_VERSION 279 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) // Version of this file @@ -1467,7 +1467,7 @@ typedef void* MTLSharedEvent_id; VkPipeline basePipelineHandleIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of int32_t basePipelineIndexIf VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of - + VkStructureType sType const void* pNext VkDeviceAddress deviceAddress @@ -2488,7 +2488,7 @@ typedef void* MTLSharedEvent_id; VkStructureType sType const void* pNext VkPipelineBindPoint pipelineBindPoint - VkPipeline pipeline + VkPipeline pipeline VkIndirectCommandsLayoutNV indirectCommandsLayout uint32_t streamCount const VkIndirectCommandsStreamNV* pStreams @@ -9103,6 +9103,11 @@ typedef void* MTLSharedEvent_id; const void* pNext void* pPlacedAddress + + VkStructureType sType + void* pNext + VkBool32 shaderRawAccessChains + @@ -22708,8 +22713,10 @@ typedef void* MTLSharedEvent_id; - - + + + + @@ -23310,8 +23317,8 @@ typedef void* MTLSharedEvent_id; - - + + @@ -24216,10 +24223,12 @@ typedef void* MTLSharedEvent_id; - + - - + + + + @@ -24262,6 +24271,7 @@ typedef void* MTLSharedEvent_id; + @@ -24296,6 +24306,43 @@ typedef void* MTLSharedEvent_id; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25942,6 +25989,9 @@ typedef void* MTLSharedEvent_id; + + + @@ -26455,6 +26505,9 @@ typedef void* MTLSharedEvent_id; + + + From 2ba356c339ad577078967c4eed015ededc1ebe0f Mon Sep 17 00:00:00 2001 From: Helix Graziani Date: Mon, 29 Jan 2024 19:24:07 -0500 Subject: [PATCH 1349/1506] cfgmgr32: Add CM_Get_Device_Interface_PropertyW stub. (cherry picked from commit 91d60983acad0e8791b94f60dad5d318b67c0166) CW-Bug-Id: #23528 --- dlls/cfgmgr32/cfgmgr32.spec | 2 +- dlls/cfgmgr32/main.c | 13 +++++++++++++ include/cfgmgr32.h | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/cfgmgr32/cfgmgr32.spec b/dlls/cfgmgr32/cfgmgr32.spec index e4cd845e2a4..29de7bbdc55 100644 --- a/dlls/cfgmgr32/cfgmgr32.spec +++ b/dlls/cfgmgr32/cfgmgr32.spec @@ -91,7 +91,7 @@ @ stdcall CM_Get_Device_Interface_List_SizeW(ptr ptr wstr long) setupapi.CM_Get_Device_Interface_List_SizeW @ stdcall CM_Get_Device_Interface_List_Size_ExA(ptr ptr str long ptr) setupapi.CM_Get_Device_Interface_List_Size_ExA @ stdcall CM_Get_Device_Interface_List_Size_ExW(ptr ptr wstr long ptr) setupapi.CM_Get_Device_Interface_List_Size_ExW -@ stub CM_Get_Device_Interface_PropertyW +@ stdcall CM_Get_Device_Interface_PropertyW(wstr ptr ptr ptr ptr long) @ stub CM_Get_First_Log_Conf @ stub CM_Get_First_Log_Conf_Ex @ stub CM_Get_Global_State diff --git a/dlls/cfgmgr32/main.c b/dlls/cfgmgr32/main.c index f40068af0df..7d48a96be85 100644 --- a/dlls/cfgmgr32/main.c +++ b/dlls/cfgmgr32/main.c @@ -67,3 +67,16 @@ CONFIGRET WINAPI CM_Register_Notification( CM_NOTIFY_FILTER *filter, void *conte return CR_CALL_NOT_IMPLEMENTED; } + +/*********************************************************************** + * CM_Get_Device_Interface_PropertyW (cfgmgr32.@) + */ +CONFIGRET WINAPI CM_Get_Device_Interface_PropertyW( LPCWSTR device_interface, const DEVPROPKEY *property_key, + DEVPROPTYPE *property_type, BYTE *property_buffer, + ULONG *property_buffer_size, ULONG flags ) +{ + FIXME("%s %p %p %p %p %ld stub!\n", debugstr_w(device_interface), property_key, property_type, + property_buffer, property_buffer_size, flags); + + return CR_CALL_NOT_IMPLEMENTED; +} diff --git a/include/cfgmgr32.h b/include/cfgmgr32.h index a0bb89a2a67..ee1846b0e97 100644 --- a/include/cfgmgr32.h +++ b/include/cfgmgr32.h @@ -26,6 +26,7 @@ #endif #include +#include /* cfgmgr32 doesn't use the normal convention, it adds an underscore before A/W */ #ifdef WINE_NO_UNICODE_MACROS @@ -312,6 +313,7 @@ CMAPI CONFIGRET WINAPI CM_Get_Device_ID_List_ExW(PCWSTR,PWCHAR,ULONG,ULONG,HMACH #define CM_Get_Device_ID_List_Ex WINELIB_NAME_AW(CM_Get_Device_ID_List_Ex) CMAPI CONFIGRET WINAPI CM_Get_Device_ID_Size(PULONG,DEVINST,ULONG); CMAPI CONFIGRET WINAPI CM_Get_Device_ID_Size_Ex(PULONG,DEVINST,ULONG,HMACHINE); +CMAPI CONFIGRET WINAPI CM_Get_Device_Interface_PropertyW(LPCWSTR,const DEVPROPKEY*,DEVPROPTYPE*,PBYTE,PULONG,ULONG); CMAPI CONFIGRET WINAPI CM_Get_DevNode_Status(PULONG,PULONG,DEVINST,ULONG); CMAPI CONFIGRET WINAPI CM_Get_DevNode_Status_Ex(PULONG,PULONG,DEVINST,ULONG,HMACHINE); CMAPI CONFIGRET WINAPI CM_Get_Sibling(PDEVINST,DEVINST,ULONG); From c052bc05295222afa5d3bc238e8df5e782d2d180 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 6 Mar 2024 20:56:10 -0600 Subject: [PATCH 1350/1506] win32u: HACK: Clear queue QS_RAWINPUT if NtUserGetRawInputBuffer() got everything for Apex Legends. CW-Bug-Id: #23533 --- dlls/win32u/rawinput.c | 10 ++++++++++ server/protocol.def | 2 ++ server/queue.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index 3fa187f9673..1e071e30a94 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -676,6 +676,7 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data */ UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT header_size ) { + static int cached_clear_qs_rawinput = -1; unsigned int count = 0, remaining, rawinput_size, next_size, overhead; struct rawinput_thread_data *thread_data; struct hardware_msg_data *msg_data; @@ -708,6 +709,7 @@ UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT heade { req->rawinput_size = rawinput_size; req->buffer_size = 0; + req->clear_qs_rawinput = 0; if (wine_server_call( req )) return ~0u; *data_size = reply->next_size; } @@ -718,12 +720,20 @@ UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT heade if (!(thread_data = get_rawinput_thread_data())) return ~0u; rawinput = thread_data->buffer; + if (cached_clear_qs_rawinput == -1) + { + const char *sgi; + + cached_clear_qs_rawinput = (sgi = getenv( "SteamGameId" )) && !strcmp( sgi, "1172470" ); + } + /* first RAWINPUT block in the buffer is used for WM_INPUT message data */ msg_data = (struct hardware_msg_data *)NEXTRAWINPUTBLOCK(rawinput); SERVER_START_REQ( get_rawinput_buffer ) { req->rawinput_size = rawinput_size; req->buffer_size = *data_size; + req->clear_qs_rawinput = cached_clear_qs_rawinput; wine_server_set_reply( req, msg_data, RAWINPUT_BUFFER_SIZE - rawinput->header.dwSize ); if (wine_server_call( req )) return ~0u; next_size = reply->next_size; diff --git a/server/protocol.def b/server/protocol.def index cd78c8f2f26..848afbcc19c 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3872,6 +3872,8 @@ struct handle_info @REQ(get_rawinput_buffer) data_size_t rawinput_size; /* size of RAWINPUT structure */ data_size_t buffer_size; /* size of output buffer */ + int clear_qs_rawinput; + int __pad; @REPLY data_size_t next_size; /* minimum size to get next message data */ unsigned int count; diff --git a/server/queue.c b/server/queue.c index 12592241c92..a41ae7583af 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3971,6 +3971,8 @@ DECL_HANDLER(get_rawinput_buffer) count++; } + if (req->clear_qs_rawinput && !ptr) clear_queue_bits( current->queue, QS_RAWINPUT ); + reply->next_size = next_size; reply->count = count; set_reply_data_ptr( buf, pos ); From bbb57dd771f2914ffb1e0de9ea6faf714e717bbb Mon Sep 17 00:00:00 2001 From: Brendan McGrath Date: Fri, 8 Mar 2024 07:18:13 +1100 Subject: [PATCH 1351/1506] amend! mshtml: Pass DOMEvent instead of nsIDOMEvent during handle_event. mshtml: Pass DOMEvent instead of nsIDOMEvent during handle_event. CW-Bug-Id: #23083 (cherry picked from commit 277acf61d0fb8e5d36fbadda8ecb349dd3dcc435) From 07f4d1ae893a3c12a65ac42e3fabcf5c8d4fa8d0 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 8 Mar 2024 15:21:54 +0800 Subject: [PATCH 1352/1506] user32/tests: Add some ReleaseCapture() tests. CW-Bug-Id: #23531 --- dlls/user32/tests/win.c | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 69c8d945951..822c266eba6 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -13061,6 +13061,82 @@ static void test_shell_tray(void) DestroyWindow(hwnd); } +static int wm_mousemove_count; +static BOOL do_release_capture; + +static LRESULT WINAPI test_ReleaseCapture_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + if (msg == WM_MOUSEMOVE) + { + wm_mousemove_count++; + if (wm_mousemove_count >= 100) + return 1; + + if (do_release_capture) + ReleaseCapture(); + return 0; + } + return DefWindowProcA(hwnd, msg, wp, lp); +} + +static void test_ReleaseCapture(void) +{ + WNDCLASSA cls = {0}; + ATOM atom; + HWND hwnd; + POINT pt; + BOOL ret; + + cls.lpfnWndProc = test_ReleaseCapture_proc; + cls.hInstance = GetModuleHandleA(0); + cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW); + cls.hbrBackground = GetStockObject(BLACK_BRUSH); + cls.lpszClassName = "test_ReleaseCapture_class"; + atom = RegisterClassA(&cls); + ok(!!atom, "RegisterClassA failed, error %#lx.\n", GetLastError()); + + hwnd = CreateWindowExA(WS_EX_TOPMOST, cls.lpszClassName, "", WS_POPUP | WS_VISIBLE, 100, 100, + 100, 100, NULL, NULL, 0, NULL); + ok(!!hwnd, "CreateWindowA failed, error %#lx.\n", GetLastError()); + ret = SetForegroundWindow(hwnd); + ok(ret, "SetForegroundWindow failed, error %#lx.\n", GetLastError()); + GetCursorPos(&pt); + ret = SetCursorPos(150, 150); + ok(ret, "SetCursorPos failed, error %#lx.\n", GetLastError()); + flush_events(TRUE); + + /* Test a Wine bug that WM_MOUSEMOVE is post too many times when calling ReleaseCapture() during + * handling WM_MOUSEMOVE and the cursor is on the window */ + do_release_capture = TRUE; + ret = ReleaseCapture(); + ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); + flush_events(TRUE); + do_release_capture = FALSE; + todo_wine + ok(wm_mousemove_count < 10, "Got too many WM_MOUSEMOVE.\n"); + + /* Test that ReleaseCapture() should send a WM_MOUSEMOVE if a window is captured */ + SetCapture(hwnd); + wm_mousemove_count = 0; + ret = ReleaseCapture(); + ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); + flush_events(TRUE); + ok(wm_mousemove_count == 1, "Got no WM_MOUSEMOVE.\n"); + + /* Test that ReleaseCapture() shouldn't send WM_MOUSEMOVE if no window is captured */ + wm_mousemove_count = 0; + ret = ReleaseCapture(); + ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); + flush_events(TRUE); + todo_wine + ok(wm_mousemove_count == 0, "Got WM_MOUSEMOVE.\n"); + + ret = SetCursorPos(pt.x, pt.y); + ok(ret, "SetCursorPos failed, error %#lx.\n", GetLastError()); + DestroyWindow(hwnd); + UnregisterClassA(cls.lpszClassName, GetModuleHandleA(0)); +} + START_TEST(win) { char **argv; @@ -13243,6 +13319,7 @@ START_TEST(win) test_cancel_mode(); test_DragDetect(); test_WM_NCCALCSIZE(); + test_ReleaseCapture(); /* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook); From fafcc251402e5d5970c349f60234edfdbdee1d5c Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 8 Mar 2024 16:38:16 +0800 Subject: [PATCH 1353/1506] win32u: Only send mouse input in ReleaseCapture() when a window is captured. Fix a regression from "bb496ea8 - server: Always queue mouse messages delivered to another window." Fix ETHER VAPOR Remaster (214570) launches to black screen when the cursor is in the game window. The game calls ReleaseCapture() when handling WM_MOUSEMOVE. After bb496ea8, WM_MOUSEMOVE is always queued because the message window is NULL. So ReleaseCapture() ends up queuing another WM_MOUSEMOVE. So the game ends up handling infinite WM_MOUSEMOVE messages at startup and is not able to do anything. CW-Bug-Id: #23531 --- dlls/user32/tests/win.c | 2 -- dlls/win32u/input.c | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 822c266eba6..8f5d1c0b973 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -13112,7 +13112,6 @@ static void test_ReleaseCapture(void) ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); flush_events(TRUE); do_release_capture = FALSE; - todo_wine ok(wm_mousemove_count < 10, "Got too many WM_MOUSEMOVE.\n"); /* Test that ReleaseCapture() should send a WM_MOUSEMOVE if a window is captured */ @@ -13128,7 +13127,6 @@ static void test_ReleaseCapture(void) ret = ReleaseCapture(); ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); flush_events(TRUE); - todo_wine ok(wm_mousemove_count == 0, "Got WM_MOUSEMOVE.\n"); ret = SetCursorPos(pt.x, pt.y); diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 69bc57f3ca4..9acdeb40388 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1803,10 +1803,13 @@ HWND WINAPI NtUserSetCapture( HWND hwnd ) */ BOOL release_capture(void) { - BOOL ret = set_capture_window( 0, 0, NULL ); + HWND previous = NULL; + BOOL ret; + + ret = set_capture_window( 0, 0, &previous ); /* Somebody may have missed some mouse movements */ - if (ret) + if (ret && previous) { INPUT input = { .type = INPUT_MOUSE }; input.mi.dwFlags = MOUSEEVENTF_MOVE; From 77ddaa6dcfdc02e028731a8d1492e46a6e175e16 Mon Sep 17 00:00:00 2001 From: Renato Pereyra Date: Thu, 7 Mar 2024 11:32:29 -0600 Subject: [PATCH 1354/1506] winex11.drv: Apply the GL vendor override for Intel GPUs too https://github.com/ValveSoftware/wine/pull/222 The vendor override forces wine to report an AMD GPU. Previously, the vendor override only applied for NVIDIA GPUs. Also, rename WINE_GL_HIDE_NVIDIA to WINE_GL_VENDOR_REPORT_AMD. More info: https://github.com/ValveSoftware/Proton/issues/7529 --- dlls/winex11.drv/opengl.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index fde7a9672af..cd8889f6091 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -3495,7 +3495,7 @@ static const GLubyte *wglGetString(GLenum name) int sz; override_vendor = 0; - if ((env = getenv("WINE_GL_HIDE_NVIDIA"))) + if ((env = getenv("WINE_GL_VENDOR_REPORT_AMD"))) { override_vendor = env[0] != '0'; } @@ -3523,13 +3523,19 @@ static const GLubyte *wglGetString(GLenum name) if (name == GL_RENDERER) { s = pglGetString(name); - if (s && strstr((const char *)s, "NVIDIA")) return (const GLubyte *)"AMD Radeon Graphics"; + if (s && (strstr((const char *)s, "NVIDIA") || strstr((const char *)s, "Intel"))) + { + return (const GLubyte *)"AMD Radeon Graphics"; + } return s; } else if (name == GL_VENDOR) { s = pglGetString(name); - if (s && strstr((const char *)s, "NVIDIA")) return (const GLubyte *)"AMD"; + if (s && (strstr((const char *)s, "NVIDIA") || strstr((const char *)s, "Intel"))) + { + return (const GLubyte *)"AMD"; + } return s; } } From 9f1b447856caf856ab10d9936a37f71ad59fc6df Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Thu, 7 Mar 2024 20:18:03 +0000 Subject: [PATCH 1355/1506] mscoree: Implement CLRRuntimeHost_Start. (cherry picked from commit 934cfb86b5e2b485b4b90e1eeac4021733559591) CW-Bug-Id: #23538 --- dlls/mscoree/corruntimehost.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index c8d384730c0..f931473de7a 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -814,8 +814,12 @@ static ULONG WINAPI CLRRuntimeHost_Release(ICLRRuntimeHost* iface) static HRESULT WINAPI CLRRuntimeHost_Start(ICLRRuntimeHost* iface) { - FIXME("(%p)\n", iface); - return E_NOTIMPL; + RuntimeHost *This = impl_from_ICLRRuntimeHost( iface ); + MonoDomain *dummy; + + TRACE("%p\n", This); + + return RuntimeHost_GetDefaultDomain(This, NULL, &dummy); } static HRESULT WINAPI CLRRuntimeHost_Stop(ICLRRuntimeHost* iface) From fc83dbd83748ba2dcae8bdeafe22b81c2975376d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 26 Nov 2023 18:59:54 +0100 Subject: [PATCH 1356/1506] loader: Expose the standard debugging symbols for GDB. CW-Bug-Id: #22176 --- loader/main.c | 3 ++- loader/preloader.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/loader/main.c b/loader/main.c index c258e025183..5a208cc048c 100644 --- a/loader/main.c +++ b/loader/main.c @@ -38,7 +38,8 @@ extern char **environ; -/* the preloader will set this variable */ +/* the preloader will set these variables */ +__attribute((visibility("default"))) struct r_debug *wine_r_debug = NULL; const __attribute((visibility("default"))) struct wine_preload_info *wine_main_preload_info = NULL; /* canonicalize path and return its directory name */ diff --git a/loader/preloader.c b/loader/preloader.c index d0551bae63a..f27d6df8c17 100644 --- a/loader/preloader.c +++ b/loader/preloader.c @@ -79,12 +79,16 @@ #ifdef HAVE_ELF_H # include #endif + +/* define _r_debug so we can re-define it as r_debug_extended */ +#define _r_debug no_r_debug; #ifdef HAVE_LINK_H # include #endif #ifdef HAVE_SYS_LINK_H # include #endif +#undef _r_debug #include "wine/asm.h" #include "main.h" @@ -1387,6 +1391,39 @@ static void set_process_name( int argc, char *argv[] ) for (i = 1; i < argc; i++) argv[i] -= off; } +struct wld_r_debug_extended +{ + struct r_debug base; + struct wld_r_debug_extended *r_next; +}; + +/* GDB integration, _r_debug_state is *required* for GDB to hook the preloader */ +__attribute((visibility("default"))) void _r_debug_state(void) {} +__attribute((visibility("default"))) struct wld_r_debug_extended _r_debug = {{0}}; + +/* sets the preloader r_debug address into DT_DEBUG */ +static void init_r_debug( struct wld_auxv *av ) +{ + ElfW(Phdr) *phdr, *ph; + ElfW(Dyn) *dyn = NULL; + char *l_addr; + int phnum; + + _r_debug.base.r_version = 2; + _r_debug.base.r_brk = (ElfW(Addr))_r_debug_state; + + if (!(phnum = get_auxiliary( av, AT_PHNUM, 0 ))) return; + if (!(phdr = (void *)get_auxiliary( av, AT_PHDR, 0 ))) return; + l_addr = (char *)phdr - sizeof(ElfW(Ehdr)); + _r_debug.base.r_ldbase = (ElfW(Addr))l_addr; + + for (ph = phdr; ph < &phdr[phnum]; ++ph) if (ph->p_type == PT_DYNAMIC) break; + if (ph >= &phdr[phnum]) return; + + dyn = (void *)(ph->p_vaddr + l_addr); + while (dyn->d_tag != DT_DEBUG && dyn->d_tag != DT_NULL) dyn++; + if (dyn->d_tag == DT_DEBUG) dyn->d_un.d_ptr = (uintptr_t)&_r_debug; +} /* * wld_start @@ -1403,6 +1440,7 @@ void* wld_start( void **stack ) struct wld_auxv new_av[8], delete_av[3], *av; struct wld_link_map main_binary_map, ld_so_map; struct wine_preload_info **wine_main_preload_info; + struct r_debug *ld_so_r_debug, **wine_r_debug; pargc = *stack; argv = (char **)pargc + 1; @@ -1432,6 +1470,8 @@ void* wld_start( void **stack ) dump_auxiliary( av ); #endif + init_r_debug( av ); + /* reserve memory that Wine needs */ if (reserve) preload_reserve( reserve ); for (i = 0; preload_info[i].size; i++) @@ -1470,6 +1510,17 @@ void* wld_start( void **stack ) interp = (char *)main_binary_map.l_addr + main_binary_map.l_interp; map_so_lib( interp, &ld_so_map ); + /* expose ld.so _r_debug as a separate namespace in r_next */ + ld_so_r_debug = find_symbol( &ld_so_map, "_r_debug", STT_OBJECT ); + if (ld_so_r_debug) _r_debug.r_next = (struct wld_r_debug_extended *)ld_so_r_debug; + else wld_printf( "_r_debug not found in ld.so\n" ); + + _r_debug_state(); /* notify GDB that _r_debug is ready */ + + wine_r_debug = find_symbol( &main_binary_map, "wine_r_debug", STT_OBJECT ); + if (wine_r_debug) *wine_r_debug = &_r_debug.base; + else wld_printf( "wine_r_debug not found\n" ); + /* store pointer to the preload info into the appropriate main binary variable */ wine_main_preload_info = find_symbol( &main_binary_map, "wine_main_preload_info", STT_OBJECT ); if (wine_main_preload_info) *wine_main_preload_info = preload_info; From 8e3f7bd95d66091f9dfa8af7238f2fa5d43f2a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 26 Nov 2023 18:59:54 +0100 Subject: [PATCH 1357/1506] ntdll: Maintain a PE module link map and expose it to GDB. CW-Bug-Id: #22176 --- dlls/ntdll/unix/virtual.c | 130 +++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 97b55022c7a..afdbae04c60 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -51,6 +51,12 @@ #ifdef HAVE_SYS_USER_H # include #endif +#ifdef HAVE_LINK_H +# include +#endif +#ifdef HAVE_SYS_LINK_H +# include +#endif #ifdef HAVE_LIBPROCSTAT_H # include #endif @@ -82,6 +88,120 @@ WINE_DECLARE_DEBUG_CHANNEL(module); WINE_DECLARE_DEBUG_CHANNEL(virtual_ranges); WINE_DECLARE_DEBUG_CHANNEL(virtstat); +/* Gdb integration, in loader/main.c */ +static struct r_debug *wine_r_debug; + +#if defined(HAVE_LINK_H) || defined(HAVE_SYS_LINK_H) + +struct link_map_entry +{ + struct link_map map; + const void *module; +}; +static struct link_map link_map = {.l_name = (char *)""}; + +static void r_debug_set_state( int state ) +{ + wine_r_debug->r_map = &link_map; + wine_r_debug->r_state = state; + ((void (*)(void))wine_r_debug->r_brk)(); +} + +static char *get_path_from_fd( int fd, int sz ) +{ +#ifdef linux + char *ret = malloc( 32 + sz ); + + if (ret) sprintf( ret, "/proc/self/fd/%u", fd ); + return ret; +#elif defined(F_GETPATH) + char *ret = malloc( PATH_MAX + sz ); + + if (!ret) return NULL; + if (!fcntl( fd, F_GETPATH, ret )) return ret; + free( ret ); + return NULL; +#else + return NULL; +#endif +} + +static char *r_debug_path_from_fd( int fd ) +{ + char *real, *path; + if (!(path = get_path_from_fd( fd, 0 ))) return NULL; + if (!(real = realpath( path, NULL ))) return path; + free( path ); + return real; +} + +static void r_debug_add_module( void *module, int fd, INT_PTR offset ) +{ + struct link_map *ptr = link_map.l_next, *next; + struct link_map_entry *entry; + + if (!wine_r_debug) return; + + while (ptr) + { + entry = LIST_ENTRY(ptr, struct link_map_entry, map); + if (entry->module == module) break; + ptr = ptr->l_next; + } + + r_debug_set_state( RT_ADD ); + + if (ptr) entry->map.l_addr = offset; + else if ((entry = calloc( 1, sizeof(*entry) ))) + { + entry->module = module; + entry->map.l_addr = offset; + entry->map.l_name = r_debug_path_from_fd( fd ); + + entry->map.l_next = link_map.l_next; + if ((next = entry->map.l_next)) next->l_prev = &entry->map; + entry->map.l_prev = &link_map; + link_map.l_next = &entry->map; + } + + r_debug_set_state( RT_CONSISTENT ); +} + +static void r_debug_remove_module( void *module ) +{ + struct link_map *ptr = link_map.l_next, *next; + struct link_map_entry *entry; + + if (!wine_r_debug) return; + + while (ptr) + { + entry = LIST_ENTRY(ptr, struct link_map_entry, map); + if (entry->module == module) break; + ptr = ptr->l_next; + } + if (!ptr) return; + + r_debug_set_state( RT_DELETE ); + + entry->map.l_prev->l_next = entry->map.l_next; + if ((next = entry->map.l_next)) next->l_prev = entry->map.l_prev; + + r_debug_set_state( RT_CONSISTENT ); + + free( entry->map.l_name ); + free( entry ); +} + +#else /* defined(HAVE_LINK_H) || defined(HAVE_SYS_LINK_H) */ + +#define RT_CONSISTENT 0 +static void r_debug_set_state( int state ) {} +static void r_debug_add_module( void *module, int fd, INT_PTR offset ) {} +static void r_debug_remove_module( void *module ) {} + +#endif /* defined(HAVE_LINK_H) || defined(HAVE_SYS_LINK_H) */ + struct preload_info { void *addr; @@ -3051,6 +3171,7 @@ static NTSTATUS map_image_into_view( struct file_view *view, const WCHAR *filena #ifdef VALGRIND_LOAD_PDB_DEBUGINFO VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, ptr - (char *)wine_server_get_ptr( image_info->base )); #endif + r_debug_add_module( ptr, fd, ptr - (char *)wine_server_get_ptr( image_info->base ) ); return STATUS_SUCCESS; } @@ -3413,11 +3534,14 @@ static int disable_kernel_ww( int argc, char *argv[] ) void virtual_init( int argc, char *argv[] ) { const struct preload_info **preload_info = dlsym( RTLD_DEFAULT, "wine_main_preload_info" ); + struct r_debug **r_debug = dlsym( RTLD_DEFAULT, "wine_r_debug" ); const char *preload = getenv( "WINEPRELOADRESERVE" ); size_t size; int i; pthread_mutexattr_t attr; + if (r_debug && (wine_r_debug = *r_debug)) r_debug_set_state( RT_CONSISTENT ); + pthread_mutexattr_init( &attr ); pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); pthread_mutex_init( &virtual_mutex, &attr ); @@ -5972,7 +6096,11 @@ static NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr, ULONG flags ) SERVER_END_REQ; if (!status) { - if (view->protect & SEC_IMAGE) release_builtin_module( view->base ); + if (view->protect & SEC_IMAGE) + { + r_debug_remove_module( view->base ); + release_builtin_module( view->base ); + } if (flags & MEM_PRESERVE_PLACEHOLDER) free_pages_preserve_placeholder( view, view->base, view->size ); else delete_view( view ); } From 9c5f2804d5a986cd132d4583da3ae07287fd46d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 26 Nov 2023 18:35:47 +0100 Subject: [PATCH 1358/1506] tools: Add gdbunwind.py script with a syscall unwinder. CW-Bug-Id: #22176 --- tools/gdbunwind.py | 177 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 tools/gdbunwind.py diff --git a/tools/gdbunwind.py b/tools/gdbunwind.py new file mode 100644 index 00000000000..8611d789f1f --- /dev/null +++ b/tools/gdbunwind.py @@ -0,0 +1,177 @@ +#!/bin/env python3 + +# Copyright 2021 Rémi Bernon for CodeWeavers +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +from gdb.unwinder import Unwinder +import gdb +import re + +ARCH_OFFSETS_X86_64 = { + "rax": (0x0000, 'void *'), + "rbx": (0x0008, 'void *'), + "rcx": (0x0010, 'void *'), + "rdx": (0x0018, 'void *'), + "rsi": (0x0020, 'void *'), + "rdi": (0x0028, 'void *'), + "r8": (0x0030, 'void *'), + "r9": (0x0038, 'void *'), + "r10": (0x0040, 'void *'), + "r11": (0x0048, 'void *'), + "r12": (0x0050, 'void *'), + "r13": (0x0058, 'void *'), + "r14": (0x0060, 'void *'), + "r15": (0x0068, 'void *'), + "rip": (0x0070, 'void *'), + "cs": (0x0078, 'void *'), + "eflags": (0x0080, 'void *'), + "rsp": (0x0088, 'void *'), + "ss": (0x0090, 'void *'), + "rbp": (0x0098, 'void *'), + "prev_frame": (0x00a0, 'void *'), + "syscall_cfa": (0x00a8, 'void *'), + # "syscall_flags": (0x00b0, 'unsigned int'), + # "restore_flags": (0x00b4, 'unsigned int'), + "teb_offset": (0x0328, 'void *'), +} + +ARCH_OFFSETS_I386 = { + # "syscall_flags": (0x000, 'unsigned short'), + # "restore_flags": (0x002, 'unsigned short'), + "eflags": (0x004, 'unsigned int'), + "eip": (0x008, 'void *'), + "esp": (0x00c, 'void *'), + "cs": (0x010, 'unsigned short'), + "ss": (0x012, 'unsigned short'), + "ds": (0x014, 'unsigned short'), + "es": (0x016, 'unsigned short'), + "fs": (0x018, 'unsigned short'), + "gs": (0x01a, 'unsigned short'), + "eax": (0x01c, 'void *'), + "ebx": (0x020, 'void *'), + "ecx": (0x024, 'void *'), + "edx": (0x028, 'void *'), + "edi": (0x02c, 'void *'), + "esi": (0x030, 'void *'), + "ebp": (0x034, 'void *'), + "syscall_cfa": (0x038, 'void *'), + "prev_frame": (0x03c, 'void *'), + "teb_offset": (0x1f8, 'void *'), +} + + +def arch_offsets(arch): + if 'x86-64' in arch: + return ARCH_OFFSETS_X86_64 + if 'i386' in arch: + return ARCH_OFFSETS_I386 + + +def find_syscall_frame(sp, arch, teb): + (off, type) = arch_offsets(arch)['teb_offset'] + frame = int(gdb.parse_and_eval(f'*(void **){teb + off}')) + + while frame: + (off, type) = arch_offsets(arch)['prev_frame'] + next_frame = int(gdb.parse_and_eval(f'*(void **){(frame + off)}')) + if not next_frame: return frame + + (off, type) = arch_offsets(arch)['ebp'] + ebp = int(gdb.parse_and_eval(f'*(void **){(next_frame + off)}')) + if ebp >= sp: return frame + + +def callback_registers(pc, sp, pending_frame): + arch = pending_frame.architecture().name() + + if 'x86-64' in arch: + frame = int(pending_frame.read_register("rbp")) + frame = (frame - 0x448) & ~0x3f + + (off, type) = arch_offsets(arch)['syscall_cfa'] + val = gdb.parse_and_eval(f'*({type} *){int(frame + off)}') + yield 'rip', gdb.parse_and_eval(f'*(void **){int(val - 8)}') + yield 'rbp', val - 16 + + elif 'i386' in arch: + teb = int(pending_frame.read_register('edx')) + frame = find_syscall_frame(sp, arch, teb) + + (off, type) = arch_offsets(arch)['syscall_cfa'] + val = gdb.parse_and_eval(f'*({type} *){int(frame + off)}') + yield 'eip', gdb.parse_and_eval(f'*(void **){int(val - 4)}') + yield 'ebp', val - 8 + + +def registers(pc, sp, pending_frame): + arch = pending_frame.architecture().name() + frame = sp + + if 'x86-64' in arch: + if 'syscall' in str(pc): + rbp = pending_frame.read_register("rbp") + frame = rbp - 0x98 + elif 'i386' in arch: + if 'syscall' in str(pc): + ebp = pending_frame.read_register("ebp") + frame = ebp - 0x34 + else: + frame += 16 + + for reg, (off, type) in arch_offsets(arch).items(): + val = gdb.parse_and_eval(f'*({type} *){int(frame + off)}') + + if reg in ('eflags', 'cs', 'ss', 'ds', 'es', 'fs', 'gs'): + int32 = gdb.lookup_type('int') + val = val.cast(int32) + if reg in ('syscall_cfa', 'prev_frame', 'teb_offset'): + continue + + yield reg, val + + +class WineSyscallFrameId(object): + def __init__(self, sp, pc): + self.sp = sp + self.pc = pc + + +class WineSyscallUnwinder(Unwinder): + def __init__(self): + super().__init__("WineSyscallUnwinder", gdb.SIGTRAMP_FRAME) + self.pattern = re.compile('__wine_(syscall|unix_call)' + '|KiUserCallbackDispatcher') + + def __call__(self, pending_frame): + pc = pending_frame.read_register("pc") + if self.pattern.search(str(pc)) is None: + return None + + sp = pending_frame.read_register("sp") + frame = WineSyscallFrameId(sp, pc) + if 'KiUserCallbackDispatcher' in str(pc): + unwind_info = pending_frame.create_unwind_info(frame) + for reg, val in callback_registers(pc, sp, pending_frame): + unwind_info.add_saved_register(reg, val) + return unwind_info + + unwind_info = pending_frame.create_unwind_info(frame) + for reg, val in registers(pc, sp, pending_frame): + unwind_info.add_saved_register(reg, val) + return unwind_info + + +gdb.unwinder.register_unwinder(None, WineSyscallUnwinder(), replace=True) From eb709ed1d706c7d779e662b72717b5db80aa2808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 22 Jan 2024 20:28:29 +0100 Subject: [PATCH 1359/1506] HACK: loader: Map /run/host to / in the link map. CW-Bug-Id: #22176 --- dlls/ntdll/unix/virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index afdbae04c60..44ca5043dd0 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -131,6 +131,7 @@ static char *r_debug_path_from_fd( int fd ) char *real, *path; if (!(path = get_path_from_fd( fd, 0 ))) return NULL; if (!(real = realpath( path, NULL ))) return path; + if (!strncmp( real, "/run/host", 9 )) memmove( real, real + 9, strlen( real ) - 8 ); free( path ); return real; } From 5fe119b4878a0bb78d5cf44dd7031888052aa474 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 Mar 2024 19:45:07 -0600 Subject: [PATCH 1360/1506] imm32: Set lengths to 0 for NULL strings in ImmSetCompositionString(). CW-Bug-Id: #23541 --- dlls/imm32/imm.c | 6 ++++++ dlls/imm32/tests/imm32.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index cc843ce4a8e..264276d53d6 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2539,6 +2539,9 @@ BOOL WINAPI ImmSetCompositionStringA( return FALSE; if (!(ime = imc_select_ime( data ))) return FALSE; + if (!lpComp) dwCompLen = 0; + if (!lpRead) dwReadLen = 0; + if (!ime_is_unicode( ime )) return ime->pImeSetCompositionString( hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen ); comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0); @@ -2596,6 +2599,9 @@ BOOL WINAPI ImmSetCompositionStringW( return FALSE; if (!(ime = imc_select_ime( data ))) return FALSE; + if (!lpComp) dwCompLen = 0; + if (!lpRead) dwReadLen = 0; + if (ime_is_unicode( ime )) return ime->pImeSetCompositionString( hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen ); comp_len = WideCharToMultiByte(CP_ACP, 0, lpComp, dwCompLen, NULL, 0, NULL, diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 66ebbfd161d..c5d2b85558e 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -1077,12 +1077,24 @@ static void test_SCS_SETSTR(void) DWORD prop; imc = ImmGetContext(hwnd); - ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL,0); + ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 0); if (!ret) { win_skip("Composition isn't supported\n"); ImmReleaseContext(hwnd, imc); return; } + + ret = ImmSetCompositionStringW(imc, SCS_SETSTR, NULL, 128, NULL, 128); + ok(ret, "got error %lu.\n", GetLastError()); + + alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20); + ok(!alen, "got %ld.\n", alen); + wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 20); + ok(!wlen, "got %ld.\n", alen); + + ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 2); + ok(ret, "got error %lu.\n", GetLastError()); + msg_spy_flush_msgs(); alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20); From 2c6954ef9e776fd83118a2b7ec0da12cb8473437 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 11 Mar 2024 23:13:41 +0000 Subject: [PATCH 1361/1506] wm_reader: Don't reinit stream if read_compressed didn't change. CW-Bug-Id: #23483 --- dlls/winegstreamer/wm_reader.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 1421fb6a5ac..95213b1580b 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -2447,8 +2447,11 @@ static HRESULT WINAPI reader_SetReadStreamSamples(IWMSyncReader2 *iface, WORD st return E_INVALIDARG; } - stream->read_compressed = compressed; - reinit_stream(reader, compressed); + if (stream->read_compressed != compressed) + { + stream->read_compressed = compressed; + reinit_stream(reader, compressed); + } LeaveCriticalSection(&reader->cs); return S_OK; From b36dd1400ae8a2a453e4e5e061e5236023b19951 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 11 Mar 2024 13:15:26 -0600 Subject: [PATCH 1362/1506] Revert "ntdll: HACK: Disable kernel write watches for BDO." This reverts commit 2f075843d6131f4def5fa350b3d7923a91edc913. CW-Bug-Id: #23322 --- dlls/ntdll/unix/loader.c | 4 ++-- dlls/ntdll/unix/unix_private.h | 2 +- dlls/ntdll/unix/virtual.c | 15 ++++----------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 8e70e882191..b7d1f677203 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2278,7 +2278,7 @@ static jstring wine_init_jni( JNIEnv *env, jobject obj, jobjectArray cmdline, jo main_envp = environ; init_paths( argv ); - virtual_init( argc, argv ); + virtual_init(); init_environment(); #ifdef __i386__ @@ -2525,7 +2525,7 @@ DECLSPEC_EXPORT void __wine_main( int argc, char *argv[], char *envp[] ) set_max_limit( RLIMIT_NICE ); #endif - virtual_init( argc, argv ); + virtual_init(); init_environment(); #ifdef __APPLE__ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 57bf0cdfd05..cf6b9ab0c53 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -245,7 +245,7 @@ extern NTSTATUS system_time_precise( void *args ); extern void *steamclient_handle_fault( LPCVOID addr, DWORD err ); extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ); extern void *anon_mmap_alloc( size_t size, int prot ); -extern void virtual_init( int argc, char *argv[] ); +extern void virtual_init(void); extern ULONG_PTR get_system_affinity_mask(void); extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info, BOOL wow64 ); extern NTSTATUS virtual_map_builtin_module( HANDLE mapping, void **module, SIZE_T *size, diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 44ca5043dd0..32977a07008 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3520,19 +3520,10 @@ static void *alloc_virtual_heap( SIZE_T size ) return anon_mmap_alloc( size, PROT_READ | PROT_WRITE ); } -static int disable_kernel_ww( int argc, char *argv[] ) -{ - const char *env_var; - - if ((env_var = getenv("WINE_DISABLE_KERNEL_WRITEWATCH"))) return !!atoi(env_var); - if (argc > 1 && argv && argv[1] && strstr( argv[1], "blackdesert64.exe" )) return 1; - return 0; -} - /*********************************************************************** * virtual_init */ -void virtual_init( int argc, char *argv[] ) +void virtual_init(void) { const struct preload_info **preload_info = dlsym( RTLD_DEFAULT, "wine_main_preload_info" ); struct r_debug **r_debug = dlsym( RTLD_DEFAULT, "wine_r_debug" ); @@ -3540,6 +3531,7 @@ void virtual_init( int argc, char *argv[] ) size_t size; int i; pthread_mutexattr_t attr; + const char *env_var; if (r_debug && (wine_r_debug = *r_debug)) r_debug_set_state( RT_CONSISTENT ); @@ -3555,7 +3547,8 @@ void virtual_init( int argc, char *argv[] ) host_addr_space_limit = address_space_limit; #endif - if (!disable_kernel_ww( argc, argv ) && (pagemap_reset_fd = open("/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC)) != -1) + if (!((env_var = getenv("WINE_DISABLE_KERNEL_WRITEWATCH")) && atoi(env_var)) + && (pagemap_reset_fd = open("/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC)) != -1) { use_kernel_writewatch = TRUE; if ((pagemap_fd = open("/proc/self/pagemap", O_RDONLY | O_CLOEXEC)) == -1) From 33c20873be9eb92b64be0916f2d6093d5955ac0f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 11 Mar 2024 16:18:46 -0600 Subject: [PATCH 1363/1506] Revert "ntdll: Use kernel soft dirty flags for write watches support." This reverts commit af8ab05b7931136a920a28cb73074c25bca1def9. CW-Bug-Id: #23524 --- dlls/kernel32/tests/virtual.c | 54 +----------- dlls/ntdll/unix/virtual.c | 153 +++------------------------------- 2 files changed, 16 insertions(+), 191 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 445f519f409..c54fb16ba15 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -2127,61 +2127,15 @@ static void test_write_watch(void) ok( count == 1, "wrong count %Iu\n", count ); ok( results[0] == base + 5*pagesize, "wrong result %p\n", results[0] ); - ret = pResetWriteWatch( base, size ); - ok( !ret, "pResetWriteWatch failed %u\n", GetLastError() ); - - ret = VirtualProtect( base, 6*pagesize, PAGE_READWRITE, &old_prot ); - ok( ret, "VirtualProtect failed error %u\n", GetLastError() ); - ok( old_prot == PAGE_NOACCESS, "wrong old prot %x\n", old_prot ); - - base[3*pagesize + 200] = 3; - base[5*pagesize + 200] = 3; - ret = VirtualFree( base, size, MEM_DECOMMIT ); ok( ret, "VirtualFree failed %lu\n", GetLastError() ); count = 64; ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); - ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); - ok( !count, "wrong count %lu\n", count ); - - base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_READWRITE ); - ok(!!base, "VirtualAlloc failed.\n"); - - count = 64; - ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); - ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); - ok( !count, "wrong count %lu\n", count ); - - base[3*pagesize + 200] = 3; - ret = VirtualProtect( base, 6*pagesize, PAGE_READWRITE, &old_prot ); - ok( ret, "VirtualProtect failed error %u\n", GetLastError() ); - ok( old_prot == PAGE_READWRITE, "wrong old prot %x\n", old_prot ); - - base[5*pagesize + 200] = 3; - count = 64; - ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); - ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); - ok( count == 2, "wrong count %lu\n", count ); - ok( results[0] == base + 3*pagesize && results[1] == base + 5*pagesize, "wrong result %p\n", results[0] ); - - ret = VirtualFree( base, size, MEM_DECOMMIT ); - ok( ret, "VirtualFree failed %u\n", GetLastError() ); - - count = 64; - ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); - ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); - todo_wine ok( count == 1, "wrong count %lu\n", count ); - ok( results[0] == base + 3*pagesize, "wrong result %p\n", results[0] ); - - base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_READWRITE ); - ok(!!base, "VirtualAlloc failed.\n"); - - count = 64; - ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); - ok( !ret, "GetWriteWatch failed %u\n", GetLastError() ); - todo_wine ok( count == 1, "wrong count %lu\n", count ); - ok( results[0] == base + 3*pagesize, "wrong result %p\n", results[0] ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 1 || broken(count == 0), /* win98 */ + "wrong count %Iu\n", count ); + if (count) ok( results[0] == base + 5*pagesize, "wrong result %p\n", results[0] ); VirtualFree( base, 0, MEM_RELEASE ); } diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 32977a07008..66e9de9e6d3 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -332,13 +332,6 @@ static BYTE **pages_vprot; static BYTE *pages_vprot; #endif -static BOOL use_kernel_writewatch; -static int pagemap_fd, pagemap_reset_fd, clear_refs_fd; -#define PAGE_FLAGS_BUFFER_LENGTH 1024 -#define PM_SOFT_DIRTY_PAGE (1ull << 57) - -static void reset_write_watches( void *base, SIZE_T size ); - static struct file_view *view_block_start, *view_block_end, *next_free_view; #ifdef _WIN64 static const size_t view_block_size = 0x200000; @@ -1280,7 +1273,7 @@ static int get_unix_prot( BYTE vprot ) if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ; - if (vprot & VPROT_WRITEWATCH && !use_kernel_writewatch) prot &= ~PROT_WRITE; + if (vprot & VPROT_WRITEWATCH) prot &= ~PROT_WRITE; } if (!prot) prot = PROT_NONE; return prot; @@ -1703,13 +1696,6 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz TRACE( "forcing exec permission on %p-%p\n", base, (char *)base + size - 1 ); mprotect( base, size, unix_prot | PROT_EXEC ); } - - if (vprot & VPROT_WRITEWATCH && use_kernel_writewatch) - { - madvise( view->base, view->size, MADV_NOHUGEPAGE ); - reset_write_watches( view->base, view->size ); - } - return STATUS_SUCCESS; } @@ -1833,7 +1819,7 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr { int unix_prot = get_unix_prot(vprot); - if (!use_kernel_writewatch && view->protect & VPROT_WRITEWATCH) + if (view->protect & VPROT_WRITEWATCH) { /* each page may need different protections depending on write watch flag */ set_page_vprot_bits( base, size, vprot & ~VPROT_WRITEWATCH, ~vprot & ~VPROT_WRITEWATCH ); @@ -1910,24 +1896,8 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size */ static void reset_write_watches( void *base, SIZE_T size ) { - if (use_kernel_writewatch) - { - char buffer[17]; - ssize_t ret; - - memset(buffer, 0, sizeof(buffer)); - buffer[0] = '6'; - *(void **)&buffer[1] = base; - *(void **)&buffer[1 + 8] = (char *)base + size; - - if ((ret = write(clear_refs_fd, buffer, sizeof(buffer))) != sizeof(buffer)) - ERR("Could not clear soft dirty bits, ret %zd, error %s.\n", ret, strerror(errno)); - } - else - { - set_page_vprot_bits( base, size, VPROT_WRITEWATCH, 0 ); - mprotect_range( base, size, 0, 0 ); - } + set_page_vprot_bits( base, size, VPROT_WRITEWATCH, 0 ); + mprotect_range( base, size, 0, 0 ); } @@ -2261,11 +2231,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, view->protect = vprot | VPROT_PLACEHOLDER; set_vprot( view, base, size, vprot ); - if (vprot & VPROT_WRITEWATCH) - { - madvise( base, size, MADV_NOHUGEPAGE ); - reset_write_watches( base, size ); - } + if (vprot & VPROT_WRITEWATCH) reset_write_watches( base, size ); *view_ret = view; return STATUS_SUCCESS; } @@ -2434,9 +2400,6 @@ static NTSTATUS decommit_pages( struct file_view *view, size_t start, size_t siz if (!size) size = view->size; if (anon_mmap_fixed( (char *)view->base + start, size, PROT_NONE, 0 ) != MAP_FAILED) { - if (use_kernel_writewatch && view->protect & VPROT_WRITEWATCH) - madvise( view->base, view->size, MADV_NOHUGEPAGE ); - set_page_vprot_bits( (char *)view->base + start, size, 0, VPROT_COMMITTED ); return STATUS_SUCCESS; } @@ -3531,7 +3494,6 @@ void virtual_init(void) size_t size; int i; pthread_mutexattr_t attr; - const char *env_var; if (r_debug && (wine_r_debug = *r_debug)) r_debug_set_state( RT_CONSISTENT ); @@ -3547,24 +3509,6 @@ void virtual_init(void) host_addr_space_limit = address_space_limit; #endif - if (!((env_var = getenv("WINE_DISABLE_KERNEL_WRITEWATCH")) && atoi(env_var)) - && (pagemap_reset_fd = open("/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC)) != -1) - { - use_kernel_writewatch = TRUE; - if ((pagemap_fd = open("/proc/self/pagemap", O_RDONLY | O_CLOEXEC)) == -1) - { - ERR("Could not open pagemap file, error %s.\n", strerror(errno)); - exit(-1); - } - if ((clear_refs_fd = open("/proc/self/clear_refs", O_WRONLY | O_CLOEXEC)) == -1) - { - ERR("Could not open clear_refs file, error %s.\n", strerror(errno)); - exit(-1); - } - if (ERR_ON(virtual)) - MESSAGE("wine: using kernel write watches (experimental).\n"); - } - if (preload_info && *preload_info) for (i = 0; (*preload_info)[i].size; i++) mmap_add_reserved_area( (*preload_info)[i].addr, (*preload_info)[i].size ); @@ -4291,7 +4235,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) } else ret = grow_thread_stack( page, &stack_info ); } - else if (!use_kernel_writewatch && err & EXCEPTION_WRITE_FAULT) + else if (err & EXCEPTION_WRITE_FAULT) { if (vprot & VPROT_WRITEWATCH) { @@ -4390,11 +4334,11 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat for (i = 0; i < size; i += page_size) { BYTE vprot = get_page_vprot( addr + i ); - if (!use_kernel_writewatch && vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; + if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; if (!(get_unix_prot( vprot & ~VPROT_WRITEWATCH ) & PROT_WRITE)) return STATUS_INVALID_USER_BUFFER; } - if (!use_kernel_writewatch && *has_write_watch) + if (*has_write_watch) mprotect_range( addr, size, 0, VPROT_WRITEWATCH ); /* temporarily enable write access */ return STATUS_SUCCESS; } @@ -6297,90 +6241,17 @@ NTSTATUS WINAPI NtGetWriteWatch( HANDLE process, ULONG flags, PVOID base, SIZE_T char *addr = base; char *end = addr + size; - if (use_kernel_writewatch) + while (pos < *count && addr < end) { - static UINT64 buffer[PAGE_FLAGS_BUFFER_LENGTH]; - unsigned int i, length; - ssize_t read_length; - - if (flags & WRITE_WATCH_FLAG_RESET) - { - if (is_win64) - { - addresses[0] = end; - if ((read_length = pread(pagemap_reset_fd, addresses, *count * sizeof(*addresses), - ((ULONG_PTR)addr >> page_shift) * sizeof(*addresses))) == -1) - { - ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); - status = STATUS_INVALID_ADDRESS; - goto done; - } - *count = read_length / sizeof(*addresses); - *granularity = page_size; - goto done; - } - - while (pos < *count && addr < end) - { - length = min(PAGE_FLAGS_BUFFER_LENGTH, *count - pos); - - buffer[0] = (ULONG_PTR)end; - if ((read_length = pread(pagemap_reset_fd, buffer, length * sizeof(*buffer), - ((ULONG_PTR)addr >> page_shift) * sizeof(*buffer))) == -1) - { - ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); - status = STATUS_INVALID_ADDRESS; - goto done; - } - read_length /= sizeof(*buffer); - for (i = 0; i < read_length; ++i) - { - assert(pos < *count); - addresses[pos++] = (void *)(ULONG_PTR)buffer[i]; - } - if (read_length < length) - break; - addr = (char *)(ULONG_PTR)buffer[read_length - 1] + page_size; - } - } - else - { - while (pos < *count && addr < end) - { - length = min(PAGE_FLAGS_BUFFER_LENGTH, (end - addr) >> page_shift); - - if ((read_length = pread(pagemap_fd, buffer, length * sizeof(*buffer), - ((ULONG_PTR)addr >> page_shift) * sizeof(*buffer))) != length * sizeof(*buffer)) - { - ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); - status = STATUS_INVALID_ADDRESS; - goto done; - } - for (i = 0; i < length && pos < *count; ++i) - { - if (buffer[i] & PM_SOFT_DIRTY_PAGE) - addresses[pos++] = addr; - - addr += page_size; - } - } - } - } - else - { - while (pos < *count && addr < end) - { - if (!(get_page_vprot( addr ) & VPROT_WRITEWATCH)) addresses[pos++] = addr; - addr += page_size; - } - if (flags & WRITE_WATCH_FLAG_RESET) reset_write_watches( base, addr - (char *)base ); + if (!(get_page_vprot( addr ) & VPROT_WRITEWATCH)) addresses[pos++] = addr; + addr += page_size; } + if (flags & WRITE_WATCH_FLAG_RESET) reset_write_watches( base, addr - (char *)base ); *count = pos; *granularity = page_size; } else status = STATUS_INVALID_PARAMETER; -done: server_leave_uninterrupted_section( &virtual_mutex, &sigset ); return status; } From d7c6fec87095ed885278e432a958fa6726a22964 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 8 May 2020 14:32:09 +0300 Subject: [PATCH 1364/1506] ntdll: Use UFFD for write watches support if available. Requires Linux kernel 6.7+ to have effect. CW-Bug-Id: #23524 --- dlls/kernel32/tests/virtual.c | 162 ++++++++++++++++++++++++++++- dlls/ntdll/unix/uffd_tmp_defs.h | 75 ++++++++++++++ dlls/ntdll/unix/virtual.c | 176 ++++++++++++++++++++++++++++++-- dlls/ws2_32/tests/sock.c | 16 ++- 4 files changed, 410 insertions(+), 19 deletions(-) create mode 100644 dlls/ntdll/unix/uffd_tmp_defs.h diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index c54fb16ba15..bc573644d97 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -1631,7 +1631,7 @@ static void test_write_watch(void) MEMORY_BASIC_INFORMATION info; HANDLE readpipe, writepipe, file; OVERLAPPED overlapped, *overlapped2; - void *results[64]; + void *results[2048]; ULONG_PTR count; ULONG i, pagesize; BOOL success; @@ -1671,6 +1671,7 @@ static void test_write_watch(void) SetLastError( 0xdeadbeef ); ret = pGetWriteWatch( 0, GetModuleHandleW(NULL), size, results, &count, &pagesize ); + ok(ret, "failed.\n"); if (ret) { ok( ret == ~0u, "GetWriteWatch succeeded %lu\n", ret ); @@ -1694,6 +1695,7 @@ static void test_write_watch(void) ok( results[0] == base + pagesize, "wrong result %p\n", results[0] ); count = 64; + results[0] = (void *)0xdeadbeef; ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); ok( count == 1, "wrong count %Iu\n", count ); @@ -2103,6 +2105,16 @@ static void test_write_watch(void) base = VirtualAlloc( 0, size, MEM_RESERVE | MEM_WRITE_WATCH, PAGE_NOACCESS ); ok( base != NULL, "VirtualAlloc failed %lu\n", GetLastError() ); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 0, "wrong count %Iu\n", count ); + + ret = pResetWriteWatch( base, size ); + ok( !ret, "pResetWriteWatch failed %lu\n", GetLastError() ); + + base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_NOACCESS ); ok( base != NULL, "VirtualAlloc failed %lu\n", GetLastError() ); @@ -2122,20 +2134,160 @@ static void test_write_watch(void) ok( old_prot == PAGE_READWRITE, "wrong old prot %lx\n", old_prot ); count = 64; - ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ret = pGetWriteWatch( /*0*/WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); ok( count == 1, "wrong count %Iu\n", count ); ok( results[0] == base + 5*pagesize, "wrong result %p\n", results[0] ); + ret = pResetWriteWatch( base, size ); + ret = pResetWriteWatch( base + 6*pagesize, size - 6 * pagesize ); + ok( !ret, "pResetWriteWatch failed %lu\n", GetLastError() ); + + count = 64; + results[0] = (void *)0xdeadbeef; + ret = pGetWriteWatch( /*0*/WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 0, "wrong count %Iu\n", count ); + ok( results[0] == (void *)0xdeadbeef, "wrong result %p\n", results[0] ); + + ret = VirtualFree( base + pagesize, pagesize, MEM_DECOMMIT ); + ok( ret, "VirtualFree failed %lu\n", GetLastError() ); + + ret = VirtualProtect( base + 2*pagesize, pagesize, PAGE_READWRITE, &old_prot ); + ok( ret, "VirtualProtect failed error %lu\n", GetLastError() ); + ok( old_prot == PAGE_NOACCESS, "wrong old prot %lx\n", old_prot ); + + count = 64; + results[0] = (void *)0xdeadbeef; + ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 0, "wrong count %Iu\n", count ); + ok( results[0] == (void *)0xdeadbeef, "wrong result %p\n", results[0] ); + + base[2*pagesize + 200] = 3; + count = 64; + results[0] = (void *)0xdeadbeef; + ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 1, "wrong count %Iu\n", count ); + ok( results[0] == base + 2*pagesize, "wrong result %p\n", results[0] ); + + base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_NOACCESS ); + ok( !!base, "VirtualFree failed %lu\n", GetLastError() ); + + ret = VirtualProtect( base, 6*pagesize, PAGE_READWRITE, &old_prot ); + ok( ret, "VirtualProtect failed error %lu\n", GetLastError() ); + ok( old_prot == PAGE_NOACCESS, "wrong old prot %lx\n", old_prot ); + + base[3*pagesize + 200] = 3; + base[5*pagesize + 200] = 3; + ret = VirtualFree( base, size, MEM_DECOMMIT ); ok( ret, "VirtualFree failed %lu\n", GetLastError() ); count = 64; ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); - ok( count == 1 || broken(count == 0), /* win98 */ - "wrong count %Iu\n", count ); - if (count) ok( results[0] == base + 5*pagesize, "wrong result %p\n", results[0] ); + ok( !count, "wrong count %Iu\n", count ); + + base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_READWRITE ); + ok(!!base, "VirtualAlloc failed.\n"); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( !count, "wrong count %Iu\n", count ); + + /* Looks like VirtualProtect latches write watch state somewhere, so if pages are decommitted after, + * (which normally clears write watch state), a page from range which previously had protection change + * is still reported as dirty. */ + base[3*pagesize + 200] = 3; + ret = VirtualProtect( base, 6*pagesize, PAGE_READWRITE, &old_prot ); + ok( ret, "VirtualProtect failed error %lu\n", GetLastError() ); + ok( old_prot == PAGE_READWRITE, "wrong old prot %lx\n", old_prot ); + + base[5*pagesize + 200] = 3; + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 2, "wrong c ount %Iu\n", count ); + ok( results[0] == base + 3*pagesize && results[1] == base + 5*pagesize, "wrong result %p\n", results[0] ); + + ret = VirtualFree( base, size, MEM_DECOMMIT ); + ok( ret, "VirtualFree failed %lu\n", GetLastError() ); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + todo_wine ok( count == 1, "wrong count %Iu\n", count ); + ok( results[0] == base + 3*pagesize, "wrong result %p\n", results[0] ); + + base = VirtualAlloc( base, size, MEM_COMMIT, PAGE_READWRITE ); + ok(!!base, "VirtualAlloc failed.\n"); + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + todo_wine ok( count == 1, "wrong count %Iu\n", count ); + ok( results[0] == base + 3*pagesize, "wrong result %p\n", results[0] ); + + base[4*pagesize + 200] = 4; + base[2*pagesize + 200] = 4; + base[6*pagesize + 200] = 4; + + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + todo_wine ok( count == 4, "wrong count %Iu\n", count ); + ok( results[0] == base + 2*pagesize, "wrong result %p\n", results[0] ); + todo_wine ok( results[1] == base + 3*pagesize, "wrong result %p\n", results[0] ); + todo_wine ok( results[2] == base + 4*pagesize, "wrong result %p\n", results[0] ); + todo_wine ok( results[3] == base + 6*pagesize, "wrong result %p\n", results[0] ); + + VirtualFree( base, 0, MEM_RELEASE ); + + /* Test longer range */ + size = 2048 * pagesize; + base = VirtualAlloc( 0, size, MEM_RESERVE | MEM_COMMIT | MEM_WRITE_WATCH, PAGE_READWRITE ); + ok( base != NULL, "VirtualAlloc failed %lu\n", GetLastError() ); + + count = 2048; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 0, "wrong count %Iu\n", count ); + + count = 2048; + for (i = 0; i < count; i += 2) + ++base[i * pagesize]; + + ret = VirtualProtect( base, size / 2, PAGE_READONLY, &old_prot ); + ok( ret, "VirtualProtect failed error %lu\n", GetLastError() ); + + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 1024, "wrong count %Iu\n", count ); + + for (i = 0; i < count; ++i) + { + ok( results[i] == base + i * 2 * pagesize, "wrong result %p\n", results[i] ); + if (results[i] != base + i * 2 * pagesize) + break; + } + + ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 1024, "wrong count %Iu\n", count ); + + for (i = 0; i < count; ++i) + { + ok( results[i] == base + i * 2 * pagesize, "wrong result %p\n", results[i] ); + if (results[i] != base + i * 2 * pagesize) + break; + } + + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); + ok( count == 0, "wrong count %Iu\n", count ); VirtualFree( base, 0, MEM_RELEASE ); } diff --git a/dlls/ntdll/unix/uffd_tmp_defs.h b/dlls/ntdll/unix/uffd_tmp_defs.h new file mode 100644 index 00000000000..f79c34c6145 --- /dev/null +++ b/dlls/ntdll/unix/uffd_tmp_defs.h @@ -0,0 +1,75 @@ +#ifndef __UFFD_TMP_DEFS__ +#define __UFFD_TMP_DEFS__ + +#ifdef __x86_64__ +#define __NR_userfaultfd 323 +#else +#define __NR_userfaultfd 374 +#endif + +#ifndef UFFD_FEATURE_WP_ASYNC +#define UFFD_FEATURE_WP_UNPOPULATED (1<<13) +#define UFFD_FEATURE_WP_ASYNC (1<<15) +#endif + +#ifndef PAGEMAP_SCAN +/* Pagemap ioctl */ +#define PAGEMAP_SCAN _IOWR('f', 16, struct pm_scan_arg) + +/* Bits are set in flags of the page_region and masks in pm_scan_args */ +#define PAGE_IS_WPALLOWED (1 << 0) +#define PAGE_IS_WRITTEN (1 << 1) +#define PAGE_IS_FILE (1 << 2) +#define PAGE_IS_PRESENT (1 << 3) +#define PAGE_IS_SWAPPED (1 << 4) +#define PAGE_IS_PFNZERO (1 << 5) +#define PAGE_IS_HUGE (1 << 6) +/* + * struct page_region - Page region with flags + * @start: Start of the region + * @end: End of the region (exclusive) + * @categories: PAGE_IS_* category bitmask for the region + */ +struct page_region { + __u64 start; + __u64 end; + __u64 categories; +}; + +/* Flags for PAGEMAP_SCAN ioctl */ +#define PM_SCAN_WP_MATCHING (1 << 0) /* Write protect the pages matched. */ +#define PM_SCAN_CHECK_WPASYNC (1 << 1) /* Abort the scan when a non-WP-enabled page is found. */ + +/* + * struct pm_scan_arg - Pagemap ioctl argument + * @size: Size of the structure + * @flags: Flags for the IOCTL + * @start: Starting address of the region + * @end: Ending address of the region + * @walk_end Address where the scan stopped (written by kernel). + * walk_end == end informs that the scan completed on entire range. + * @vec: Address of page_region struct array for output + * @vec_len: Length of the page_region struct array + * @max_pages: Optional limit for number of returned pages (0 = disabled) + * @category_inverted: PAGE_IS_* categories which values match if 0 instead of 1 + * @category_mask: Skip pages for which any category doesn't match + * @category_anyof_mask: Skip pages for which no category matches + * @return_mask: PAGE_IS_* categories that are to be reported in `page_region`s returned + */ +struct pm_scan_arg { + __u64 size; + __u64 flags; + __u64 start; + __u64 end; + __u64 walk_end; + __u64 vec; + __u64 vec_len; + __u64 max_pages; + __u64 category_inverted; + __u64 category_mask; + __u64 category_anyof_mask; + __u64 return_mask; +}; +#endif + +#endif diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 66e9de9e6d3..8cec203820f 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -70,6 +70,10 @@ # include #endif +#include +#include +#include "uffd_tmp_defs.h" + #include #include "ntstatus.h" @@ -332,6 +336,9 @@ static BYTE **pages_vprot; static BYTE *pages_vprot; #endif +static int use_kernel_writewatch; +static int uffd_fd, pagemap_fd; + static struct file_view *view_block_start, *view_block_end, *next_free_view; #ifdef _WIN64 static const size_t view_block_size = 0x200000; @@ -369,6 +376,127 @@ void *anon_mmap_alloc( size_t size, int prot ) return mmap( NULL, size, prot, MAP_PRIVATE | MAP_ANON, -1, 0 ); } +static void kernel_writewatch_init(void) +{ + struct uffdio_api uffdio_api; + + uffd_fd = syscall( __NR_userfaultfd, O_CLOEXEC | O_NONBLOCK ); + if (uffd_fd == -1) return; + + uffdio_api.api = UFFD_API; + uffdio_api.features = UFFD_FEATURE_WP_ASYNC | UFFD_FEATURE_WP_UNPOPULATED; + if (ioctl( uffd_fd, UFFDIO_API, &uffdio_api ) || uffdio_api.api != UFFD_API) + { + close( uffd_fd ); + return; + } + pagemap_fd = open( "/proc/self/pagemap", O_CLOEXEC | O_RDONLY ); + if (pagemap_fd == -1) + { + ERR("Error opening /proc/self/pagemap.\n"); + close( uffd_fd ); + return; + } + use_kernel_writewatch = 1; +} + +static void kernel_writewatch_reset( void *start, SIZE_T len ) +{ + struct pm_scan_arg arg = { 0 }; + + arg.size = sizeof(arg); + arg.start = (UINT_PTR)start; + arg.end = arg.start + len; + arg.flags = PM_SCAN_WP_MATCHING; + arg.category_mask = PAGE_IS_WRITTEN; + arg.return_mask = PAGE_IS_WRITTEN; + if (ioctl( pagemap_fd, PAGEMAP_SCAN, &arg ) < 0) + ERR( "ioctl(PAGEMAP_SCAN) failed, err %s.\n", strerror(errno) ); +} + +static void kernel_writewatch_register_range( struct file_view *view, void *base, size_t size ) +{ + struct uffdio_register uffdio_register; + struct uffdio_writeprotect wp; + + if (!(view->protect & VPROT_WRITEWATCH) || !use_kernel_writewatch) return; + + madvise( base, size, MADV_NOHUGEPAGE ); + uffdio_register.range.start = (UINT_PTR)base; + uffdio_register.range.len = size; + uffdio_register.mode = UFFDIO_REGISTER_MODE_WP; + if (ioctl( uffd_fd, UFFDIO_REGISTER, &uffdio_register ) == -1) + { + ERR( "ioctl( UFFDIO_REGISTER ) failed, %s.\n", strerror(errno) ); + return; + } + + if (!(uffdio_register.ioctls & UFFDIO_WRITEPROTECT)) + { + ERR( "uffdio_register.ioctls %s.\n", wine_dbgstr_longlong(uffdio_register.ioctls) ); + return; + } + wp.range.start = (UINT_PTR)base; + wp.range.len = size; + wp.mode = UFFDIO_WRITEPROTECT_MODE_WP; + + if (ioctl(uffd_fd, UFFDIO_WRITEPROTECT, &wp) == -1) + { + perror("ioctl(UFFDIO_WRITEPROTECT)"); + exit(-1); + } +} + +static NTSTATUS kernel_get_write_watches( void *base, SIZE_T size, void **buffer, ULONG_PTR *count, BOOL reset ) +{ + SIZE_T buffer_len = count ? *count : 0; + struct pm_scan_arg arg = { 0 }; + char *addr = base, *next_addr; + struct page_region rgns[256]; + int rgn_count, i; + size_t c_addr; + + assert( !(size & page_mask) ); + + arg.size = sizeof(arg); + arg.vec = (UINT_PTR)rgns; + arg.vec_len = ARRAY_SIZE(rgns); + if (reset) + arg.flags |= PM_SCAN_WP_MATCHING; + arg.category_mask = PAGE_IS_WRITTEN; + arg.return_mask = PAGE_IS_WRITTEN; + + *count = 0; + while (1) + { + arg.start = (UINT_PTR)addr; + arg.end = arg.start + size; + arg.max_pages = buffer_len; + + if ((rgn_count = ioctl( pagemap_fd, PAGEMAP_SCAN, &arg )) < 0) + { + ERR( "ioctl( PAGEMAP_SCAN ) failed, error %s.\n", strerror(errno) ); + return STATUS_INTERNAL_ERROR; + } + if (!rgn_count) break; + + assert( rgn_count <= ARRAY_SIZE(rgns) ); + for (i = 0; i < rgn_count; ++i) + { + assert( rgns[i].categories == PAGE_IS_WRITTEN ); + assert( !buffer || buffer_len >= ((rgns[i].end - rgns[i].start) >> page_shift) ); + for (c_addr = rgns[i].start; buffer_len && c_addr != rgns[i].end; c_addr += page_size, --buffer_len) + buffer[(*count)++] = (void *)c_addr; + } + if (!buffer_len || rgn_count < arg.vec_len) break; + next_addr = (void *)(UINT_PTR)arg.walk_end; + assert( size >= next_addr - addr ); + if (!(size -= next_addr - addr)) break; + addr = next_addr; + } + return STATUS_SUCCESS; +} + static void mmap_add_reserved_area( void *addr, SIZE_T size ) { @@ -1273,7 +1401,7 @@ static int get_unix_prot( BYTE vprot ) if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE | PROT_READ; if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ; - if (vprot & VPROT_WRITEWATCH) prot &= ~PROT_WRITE; + if (vprot & VPROT_WRITEWATCH && !use_kernel_writewatch) prot &= ~PROT_WRITE; } if (!prot) prot = PROT_NONE; return prot; @@ -1696,6 +1824,8 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz TRACE( "forcing exec permission on %p-%p\n", base, (char *)base + size - 1 ); mprotect( base, size, unix_prot | PROT_EXEC ); } + + kernel_writewatch_register_range( view, view->base, view->size ); return STATUS_SUCCESS; } @@ -1819,7 +1949,7 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr { int unix_prot = get_unix_prot(vprot); - if (view->protect & VPROT_WRITEWATCH) + if (!use_kernel_writewatch && view->protect & VPROT_WRITEWATCH) { /* each page may need different protections depending on write watch flag */ set_page_vprot_bits( base, size, vprot & ~VPROT_WRITEWATCH, ~vprot & ~VPROT_WRITEWATCH ); @@ -1896,8 +2026,12 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size */ static void reset_write_watches( void *base, SIZE_T size ) { - set_page_vprot_bits( base, size, VPROT_WRITEWATCH, 0 ); - mprotect_range( base, size, 0, 0 ); + if (use_kernel_writewatch) kernel_writewatch_reset( base, size ); + else + { + set_page_vprot_bits( base, size, VPROT_WRITEWATCH, 0 ); + mprotect_range( base, size, 0, 0 ); + } } @@ -2231,7 +2365,11 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, view->protect = vprot | VPROT_PLACEHOLDER; set_vprot( view, base, size, vprot ); - if (vprot & VPROT_WRITEWATCH) reset_write_watches( base, size ); + if (vprot & VPROT_WRITEWATCH) + { + kernel_writewatch_register_range( view, base, size ); + reset_write_watches( base, size ); + } *view_ret = view; return STATUS_SUCCESS; } @@ -2401,6 +2539,7 @@ static NTSTATUS decommit_pages( struct file_view *view, size_t start, size_t siz if (anon_mmap_fixed( (char *)view->base + start, size, PROT_NONE, 0 ) != MAP_FAILED) { set_page_vprot_bits( (char *)view->base + start, size, 0, VPROT_COMMITTED ); + kernel_writewatch_register_range( view, (char *)view->base + start, size ); return STATUS_SUCCESS; } return STATUS_NO_MEMORY; @@ -3494,6 +3633,7 @@ void virtual_init(void) size_t size; int i; pthread_mutexattr_t attr; + const char *env_var; if (r_debug && (wine_r_debug = *r_debug)) r_debug_set_state( RT_CONSISTENT ); @@ -3509,6 +3649,12 @@ void virtual_init(void) host_addr_space_limit = address_space_limit; #endif + if (!((env_var = getenv( "WINE_DISABLE_KERNEL_WRITEWATCH" )) && atoi( env_var ))) + kernel_writewatch_init(); + + if (use_kernel_writewatch) + MESSAGE( "wine: using kernel write watches, use_kernel_writewatch %d.\n", use_kernel_writewatch ); + if (preload_info && *preload_info) for (i = 0; (*preload_info)[i].size; i++) mmap_add_reserved_area( (*preload_info)[i].addr, (*preload_info)[i].size ); @@ -4235,7 +4381,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) } else ret = grow_thread_stack( page, &stack_info ); } - else if (err & EXCEPTION_WRITE_FAULT) + else if (!use_kernel_writewatch && err & EXCEPTION_WRITE_FAULT) { if (vprot & VPROT_WRITEWATCH) { @@ -4334,11 +4480,11 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat for (i = 0; i < size; i += page_size) { BYTE vprot = get_page_vprot( addr + i ); - if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; + if (!use_kernel_writewatch && vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; if (!(get_unix_prot( vprot & ~VPROT_WRITEWATCH ) & PROT_WRITE)) return STATUS_INVALID_USER_BUFFER; } - if (*has_write_watch) + if (!use_kernel_writewatch && *has_write_watch) mprotect_range( addr, size, 0, VPROT_WRITEWATCH ); /* temporarily enable write access */ return STATUS_SUCCESS; } @@ -4380,7 +4526,7 @@ ssize_t virtual_locked_read( int fd, void *addr, size_t size ) int err = EFAULT; ssize_t ret = read( fd, addr, size ); - if (ret != -1 || errno != EFAULT) return ret; + if (ret != -1 || use_kernel_writewatch || errno != EFAULT) return ret; server_enter_uninterrupted_section( &virtual_mutex, &sigset ); if (!check_write_access( addr, size, &has_write_watch )) @@ -4405,7 +4551,7 @@ ssize_t virtual_locked_pread( int fd, void *addr, size_t size, off_t offset ) int err = EFAULT; ssize_t ret = pread( fd, addr, size, offset ); - if (ret != -1 || errno != EFAULT) return ret; + if (ret != -1 || use_kernel_writewatch || errno != EFAULT) return ret; server_enter_uninterrupted_section( &virtual_mutex, &sigset ); if (!check_write_access( addr, size, &has_write_watch )) @@ -4431,7 +4577,7 @@ ssize_t virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) int err = EFAULT; ssize_t ret = recvmsg( fd, hdr, flags ); - if (ret != -1 || errno != EFAULT) return ret; + if (ret != -1 || use_kernel_writewatch || errno != EFAULT) return ret; server_enter_uninterrupted_section( &virtual_mutex, &sigset ); for (i = 0; i < hdr->msg_iovlen; i++) @@ -6241,6 +6387,13 @@ NTSTATUS WINAPI NtGetWriteWatch( HANDLE process, ULONG flags, PVOID base, SIZE_T char *addr = base; char *end = addr + size; + if (use_kernel_writewatch) + { + if (!(status = kernel_get_write_watches( base, size, addresses, count, flags & WRITE_WATCH_FLAG_RESET ))) + *granularity = page_size; + goto done; + } + while (pos < *count && addr < end) { if (!(get_page_vprot( addr ) & VPROT_WRITEWATCH)) addresses[pos++] = addr; @@ -6252,6 +6405,7 @@ NTSTATUS WINAPI NtGetWriteWatch( HANDLE process, ULONG flags, PVOID base, SIZE_T } else status = STATUS_INVALID_PARAMETER; +done: server_leave_uninterrupted_section( &virtual_mutex, &sigset ); return status; } diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index a6ac748754d..c61e91ba708 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -7972,6 +7972,7 @@ static void test_write_watch(void) ok( count == 9 || !count /* Win 11 */, "wrong count %Iu\n", count ); ok( !base[0], "data set\n" ); + base[0x1000] = 1; send(src, "test message", sizeof("test message"), 0); ret = GetOverlappedResult( (HANDLE)dest, &ov, &bytesReturned, TRUE ); @@ -7980,10 +7981,19 @@ static void test_write_watch(void) ok( !memcmp( base, "test ", 5 ), "wrong data %s\n", base ); ok( !memcmp( base + 0x4000, "message", 8 ), "wrong data %s\n", base + 0x4000 ); + count = 64; + ret = pGetWriteWatch( 0, base, size, results, &count, &pagesize ); + ok( !ret, " GetWriteWatch failed %lu\n", GetLastError() ); + todo_wine_if( count == 3 ) ok( count == 1, "wrong count %Iu\n", count ); + todo_wine_if( count == 3 ) ok( results[0] == base + 0x1000, "got page %Iu.\n", ((char *)results[0] - base) / 0x1000 ); + + base[0x2000] = 1; count = 64; ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); - ok( count == 0, "wrong count %Iu\n", count ); + todo_wine_if( count == 4 ) ok( count == 2, "wrong count %Iu\n", count ); + todo_wine_if( count == 4 ) ok( results[0] == base + 0x1000, "got page %Iu.\n", ((char *)results[0] - base) / 0x1000 ); + todo_wine_if( count == 4 ) ok( results[1] == base + 0x2000, "got page %Iu.\n", ((char *)results[1] - base) / 0x1000 ); memset( base, 0, size ); count = 64; @@ -8014,7 +8024,7 @@ static void test_write_watch(void) count = 64; ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); - ok( count == 0, "wrong count %Iu\n", count ); + todo_wine_if( count == 2 ) ok( count == 0, "wrong count %Iu\n", count ); memset( base, 0, size ); count = 64; @@ -8043,7 +8053,7 @@ static void test_write_watch(void) count = 64; ret = pGetWriteWatch( WRITE_WATCH_FLAG_RESET, base, size, results, &count, &pagesize ); ok( !ret, "GetWriteWatch failed %lu\n", GetLastError() ); - ok( count == 0, "wrong count %Iu\n", count ); + todo_wine_if( count == 1 ) ok( count == 0, "wrong count %Iu\n", count ); } WSACloseEvent( event ); closesocket( dest ); From d52d14844e20cd6198343e82bd45ed13c85ef7f7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 11 Mar 2024 13:53:08 -0600 Subject: [PATCH 1365/1506] ntdll: Use kernel soft dirty flags for write watches support. Requires custom kernel patches to have effect. CW-Bug-Id: #23524 --- dlls/ntdll/unix/virtual.c | 121 +++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 8cec203820f..b4d0cec3a21 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -338,6 +338,9 @@ static BYTE *pages_vprot; static int use_kernel_writewatch; static int uffd_fd, pagemap_fd; +static int pagemap_reset_fd, clear_refs_fd; +#define PAGE_FLAGS_BUFFER_LENGTH 1024 +#define PM_SOFT_DIRTY_PAGE (1ull << 57) static struct file_view *view_block_start, *view_block_end, *next_free_view; #ifdef _WIN64 @@ -376,18 +379,40 @@ void *anon_mmap_alloc( size_t size, int prot ) return mmap( NULL, size, prot, MAP_PRIVATE | MAP_ANON, -1, 0 ); } +static void kernel_writewatch_softdirty_init(void) +{ + if ((pagemap_reset_fd = open( "/proc/self/pagemap_reset", O_RDONLY | O_CLOEXEC )) == -1) return; + + if ((pagemap_fd = open( "/proc/self/pagemap", O_RDONLY | O_CLOEXEC )) == -1) + { + ERR( "Could not open pagemap file, error %s.\n", strerror( errno )); + exit(-1); + } + if ((clear_refs_fd = open( "/proc/self/clear_refs", O_WRONLY | O_CLOEXEC )) == -1) + { + ERR( "Could not open clear_refs file, error %s.\n", strerror( errno )); + exit(-1); + } + use_kernel_writewatch = 2; +} + static void kernel_writewatch_init(void) { struct uffdio_api uffdio_api; uffd_fd = syscall( __NR_userfaultfd, O_CLOEXEC | O_NONBLOCK ); - if (uffd_fd == -1) return; + if (uffd_fd == -1) + { + kernel_writewatch_softdirty_init(); + return; + } uffdio_api.api = UFFD_API; uffdio_api.features = UFFD_FEATURE_WP_ASYNC | UFFD_FEATURE_WP_UNPOPULATED; if (ioctl( uffd_fd, UFFDIO_API, &uffdio_api ) || uffdio_api.api != UFFD_API) { close( uffd_fd ); + kernel_writewatch_softdirty_init(); return; } pagemap_fd = open( "/proc/self/pagemap", O_CLOEXEC | O_RDONLY ); @@ -404,6 +429,21 @@ static void kernel_writewatch_reset( void *start, SIZE_T len ) { struct pm_scan_arg arg = { 0 }; + if (use_kernel_writewatch == 2) + { + char buffer[17]; + ssize_t ret; + + memset(buffer, 0, sizeof(buffer)); + buffer[0] = '6'; + *(ULONG64 *)&buffer[1] = (ULONG_PTR)start; + *(ULONG64 *)&buffer[1 + 8] = (ULONG_PTR)start + len; + + if ((ret = write(clear_refs_fd, buffer, sizeof(buffer))) != sizeof(buffer)) + ERR("Could not clear soft dirty bits, ret %zd, error %s.\n", ret, strerror(errno)); + return; + } + arg.size = sizeof(arg); arg.start = (UINT_PTR)start; arg.end = arg.start + len; @@ -422,6 +462,12 @@ static void kernel_writewatch_register_range( struct file_view *view, void *base if (!(view->protect & VPROT_WRITEWATCH) || !use_kernel_writewatch) return; madvise( base, size, MADV_NOHUGEPAGE ); + if (use_kernel_writewatch == 2) + { + kernel_writewatch_reset( base, size ); + return; + } + uffdio_register.range.start = (UINT_PTR)base; uffdio_register.range.len = size; uffdio_register.mode = UFFDIO_REGISTER_MODE_WP; @@ -447,6 +493,77 @@ static void kernel_writewatch_register_range( struct file_view *view, void *base } } +static NTSTATUS kernel_soft_dirty_get_write_watches( void *base, SIZE_T size, void **addresses, ULONG_PTR *count, BOOL reset ) +{ + static UINT64 buffer[PAGE_FLAGS_BUFFER_LENGTH]; + char *addr = base; + char *end = addr + size; + unsigned int i, length; + ssize_t read_length; + ULONG_PTR pos = 0; + + if (reset) + { + if (is_win64) + { + addresses[0] = end; + if ((read_length = pread(pagemap_reset_fd, addresses, *count * sizeof(*addresses), + ((ULONG_PTR)addr >> page_shift) * sizeof(*addresses))) == -1) + { + ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); + return STATUS_INVALID_ADDRESS; + } + *count = read_length / sizeof(*addresses); + return STATUS_SUCCESS; + } + + while (pos < *count && addr < end) + { + length = min(PAGE_FLAGS_BUFFER_LENGTH, *count - pos); + + buffer[0] = (ULONG_PTR)end; + if ((read_length = pread(pagemap_reset_fd, buffer, length * sizeof(*buffer), + ((ULONG_PTR)addr >> page_shift) * sizeof(*buffer))) == -1) + { + ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); + return STATUS_INVALID_ADDRESS; + } + read_length /= sizeof(*buffer); + for (i = 0; i < read_length; ++i) + { + assert(pos < *count); + addresses[pos++] = (void *)(ULONG_PTR)buffer[i]; + } + if (read_length < length) + break; + addr = (char *)(ULONG_PTR)buffer[read_length - 1] + page_size; + } + *count = pos; + return STATUS_SUCCESS; + } + + while (pos < *count && addr < end) + { + length = min(PAGE_FLAGS_BUFFER_LENGTH, (end - addr) >> page_shift); + + if ((read_length = pread(pagemap_fd, buffer, length * sizeof(*buffer), + ((ULONG_PTR)addr >> page_shift) * sizeof(*buffer))) != length * sizeof(*buffer)) + { + ERR("Error reading page flags, read_length %zd, error %s.\n", read_length, strerror(errno)); + return STATUS_INVALID_ADDRESS; + } + for (i = 0; i < length && pos < *count; ++i) + { + if (buffer[i] & PM_SOFT_DIRTY_PAGE) + addresses[pos++] = addr; + + addr += page_size; + } + } + *count = pos; + return STATUS_SUCCESS; +} + static NTSTATUS kernel_get_write_watches( void *base, SIZE_T size, void **buffer, ULONG_PTR *count, BOOL reset ) { SIZE_T buffer_len = count ? *count : 0; @@ -458,6 +575,8 @@ static NTSTATUS kernel_get_write_watches( void *base, SIZE_T size, void **buffer assert( !(size & page_mask) ); + if (use_kernel_writewatch == 2) return kernel_soft_dirty_get_write_watches( base, size, buffer, count, reset ); + arg.size = sizeof(arg); arg.vec = (UINT_PTR)rgns; arg.vec_len = ARRAY_SIZE(rgns); From febbad5b6d551348e0981042cf69dd6e0b9cca9b Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 12 Mar 2024 14:05:22 +0200 Subject: [PATCH 1366/1506] HACK: winevulkan: Add option to WINE_HIDE_NVK. --- dlls/winevulkan/loader.c | 19 +++++++++++++++---- dlls/winevulkan/make_vulkan | 3 +++ dlls/winevulkan/vulkan.c | 32 +++++++++++++++++++++++++++++--- dlls/winevulkan/vulkan_loader.h | 5 +++++ dlls/winevulkan/vulkan_private.h | 5 +++++ 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index 3f6204139fb..84e9239a399 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -84,6 +84,12 @@ static BOOL is_available_device_function(VkDevice device, const char *name) return UNIX_CALL(is_available_device_function, ¶ms); } +static BOOL is_nvk(VkPhysicalDevice device) +{ + struct is_nvk_params params = { .device = device }; + return UNIX_CALL(is_nvk, ¶ms); +} + static void *alloc_vk_object(size_t size) { struct wine_vk_base *object = calloc(1, size); @@ -416,7 +422,7 @@ static void fill_luid_property(VkPhysicalDeviceProperties2 *properties2) device_node_mask); } -static void fixup_device_id(UINT *vendor_id, UINT *device_id) +static void fixup_device_id(UINT *vendor_id, UINT *device_id, BOOL is_nvk) { const char *sgi; @@ -434,6 +440,11 @@ static void fixup_device_id(UINT *vendor_id, UINT *device_id) { *device_id = 0x687f; /* Radeon RX Vega 56/64 */ } + else if (is_nvk && (sgi = getenv("WINE_HIDE_NVK")) && *sgi != '0') + { + *vendor_id = 0x1002; /* AMD */ + *device_id = 0x73df; /* RX 6700XT */ + } } void WINAPI vkGetPhysicalDeviceProperties(VkPhysicalDevice physical_device, @@ -448,7 +459,7 @@ void WINAPI vkGetPhysicalDeviceProperties(VkPhysicalDevice physical_device, params.pProperties = properties; status = UNIX_CALL(vkGetPhysicalDeviceProperties, ¶ms); assert(!status); - fixup_device_id(&properties->vendorID, &properties->deviceID); + fixup_device_id(&properties->vendorID, &properties->deviceID, is_nvk(physical_device)); } void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, @@ -464,7 +475,7 @@ void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, status = UNIX_CALL(vkGetPhysicalDeviceProperties2, ¶ms); assert(!status); fill_luid_property(properties2); - fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID); + fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID, is_nvk(phys_dev)); } void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, @@ -480,7 +491,7 @@ void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, status = UNIX_CALL(vkGetPhysicalDeviceProperties2KHR, ¶ms); assert(!status); fill_luid_property(properties2); - fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID); + fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID, is_nvk(phys_dev)); } VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 467eee61c2a..362f0321276 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2925,6 +2925,7 @@ class VkGenerator(object): f.write(" init_vulkan,\n") f.write(" vk_is_available_instance_function,\n") f.write(" vk_is_available_device_function,\n") + f.write(" vk_is_nvk,\n") for vk_func in self.registry.funcs.values(): if not vk_func.needs_exposing(): continue @@ -2949,6 +2950,7 @@ class VkGenerator(object): f.write(" init_vulkan,\n") f.write(" vk_is_available_instance_function32,\n") f.write(" vk_is_available_device_function32,\n") + f.write(" vk_is_nvk32,\n") for vk_func in self.registry.funcs.values(): if not vk_func.needs_exposing(): continue @@ -3133,6 +3135,7 @@ class VkGenerator(object): f.write(" unix_init,\n") f.write(" unix_is_available_instance_function,\n") f.write(" unix_is_available_device_function,\n") + f.write(" unix_is_nvk,\n") for vk_func in self.registry.funcs.values(): if not vk_func.needs_exposing(): continue diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 885af7ae970..253e3db68f5 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -278,7 +278,8 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance struct wine_phys_dev *object; uint32_t num_host_properties, num_properties = 0; VkExtensionProperties *host_properties = NULL; - VkPhysicalDeviceProperties physdev_properties; + VkPhysicalDeviceProperties2 physdev_properties; + VkPhysicalDeviceVulkan12Properties vk12; BOOL have_external_memory_host = FALSE, have_external_memory_fd = FALSE, have_external_semaphore_fd = FALSE; VkResult res; unsigned int i, j; @@ -290,8 +291,16 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance object->handle = handle; object->host_physical_device = phys_dev; - instance->funcs.p_vkGetPhysicalDeviceProperties(phys_dev, &physdev_properties); - object->api_version = physdev_properties.apiVersion; + memset(&vk12, 0, sizeof(vk12)); + vk12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES; + + memset(&physdev_properties, 0, sizeof(physdev_properties)); + physdev_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + physdev_properties.pNext = &vk12; + + instance->funcs.p_vkGetPhysicalDeviceProperties2(phys_dev, &physdev_properties); + object->api_version = physdev_properties.properties.apiVersion; + object->is_nvk = (vk12.driverID == VK_DRIVER_ID_MESA_NVK); handle->base.unix_handle = (uintptr_t)object; WINE_VK_ADD_DISPATCHABLE_MAPPING(instance, handle, phys_dev, object); @@ -4059,6 +4068,13 @@ NTSTATUS vk_is_available_device_function(void *arg) return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, params->name); } +NTSTATUS vk_is_nvk(void *arg) +{ + struct is_nvk_params *params = arg; + struct wine_phys_dev *device = wine_phys_dev_from_handle(params->device); + return !!device->is_nvk; +} + #endif /* _WIN64 */ NTSTATUS vk_is_available_instance_function32(void *arg) @@ -4087,6 +4103,16 @@ NTSTATUS vk_is_available_device_function32(void *arg) return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, name); } +NTSTATUS vk_is_nvk32(void *arg) +{ + struct + { + UINT32 device; + } *params = arg; + struct wine_phys_dev *device = wine_phys_dev_from_handle(UlongToPtr(params->device)); + return !!device->is_nvk; +} + DECLSPEC_EXPORT VkDevice __wine_get_native_VkDevice(VkDevice handle) { struct wine_device *device = wine_device_from_handle(handle); diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h index 70efc2bfa73..d29ccd8ae08 100644 --- a/dlls/winevulkan/vulkan_loader.h +++ b/dlls/winevulkan/vulkan_loader.h @@ -147,6 +147,11 @@ struct is_available_device_function_params const char *name; }; +struct is_nvk_params +{ + VkPhysicalDevice device; +}; + #define wine_vk_find_struct(s, t) wine_vk_find_struct_((void *)s, VK_STRUCTURE_TYPE_##t) static inline void *wine_vk_find_struct_(void *s, VkStructureType t) { diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index ffae94adbe4..3a044f08dcc 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -211,6 +211,8 @@ struct wine_phys_dev uint32_t external_memory_align; + bool is_nvk; + struct wine_vk_mapping mapping; }; @@ -351,6 +353,9 @@ NTSTATUS vk_is_available_device_function(void *arg); NTSTATUS vk_is_available_instance_function32(void *arg); NTSTATUS vk_is_available_device_function32(void *arg); +NTSTATUS vk_is_nvk(void *arg); +NTSTATUS vk_is_nvk32(void *arg); + struct conversion_context { char buffer[2048]; From caa6104097b8b14001acd7ee787c8d814a9304d9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 12 Mar 2024 14:05:40 +0200 Subject: [PATCH 1367/1506] HACK: winex11: Add option to WINE_HIDE_NVK. --- dlls/winex11.drv/display.c | 9 +++++++-- dlls/winex11.drv/xrandr.c | 5 +++++ include/wine/gdi_driver.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index d2c353250b9..22e9d79b64d 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -530,7 +530,7 @@ static const char *debugstr_devmodew( const DEVMODEW *devmode ) position ); } -static void fixup_device_id(UINT *vendor_id, UINT *device_id) +static void fixup_device_id(UINT *vendor_id, UINT *device_id, BOOL is_nvk) { const char *sgi; @@ -548,6 +548,11 @@ static void fixup_device_id(UINT *vendor_id, UINT *device_id) { *device_id = 0x687f; /* Radeon RX Vega 56/64 */ } + else if (is_nvk && (sgi = getenv("WINE_HIDE_NVK")) && *sgi != '0') + { + *vendor_id = 0x1002; /* AMD */ + *device_id = 0x73df; /* RX 6700XT */ + } } BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) @@ -571,7 +576,7 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage for (gpu = 0; gpu < gpu_count; gpu++) { - fixup_device_id( &gpus[gpu].vendor_id, &gpus[gpu].device_id ); + fixup_device_id( &gpus[gpu].vendor_id, &gpus[gpu].device_id, gpus[gpu].is_nvk ); device_manager->add_gpu( &gpus[gpu], param ); diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 47accf1de6d..6011a198810 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -856,6 +856,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid VkPhysicalDeviceMemoryProperties mem_properties; VkInstanceCreateInfo create_info; VkPhysicalDeviceIDProperties id; + VkPhysicalDeviceVulkan12Properties vk12; VkInstance vk_instance = NULL; VkDisplayKHR vk_display; DWORD len; @@ -920,8 +921,11 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid if (X11DRV_check_error() || vr != VK_SUCCESS || vk_display == VK_NULL_HANDLE) continue; + memset( &vk12, 0, sizeof(vk12) ); + vk12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES; memset( &id, 0, sizeof(id) ); id.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; + id.pNext = &vk12; properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; properties2.pNext = &id; @@ -944,6 +948,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid { gpu->vendor_id = properties2.properties.vendorID; gpu->device_id = properties2.properties.deviceID; + if (vk12.driverID == VK_DRIVER_ID_MESA_NVK) gpu->is_nvk = TRUE; } RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name), &len, properties2.properties.deviceName, strlen( properties2.properties.deviceName ) + 1 ); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 26562bfef2b..2b1dc3ca044 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -252,6 +252,7 @@ struct gdi_gpu UINT revision_id; GUID vulkan_uuid; /* Vulkan device UUID */ ULONGLONG memory_size; + BOOL is_nvk; }; struct gdi_adapter From 8d74eeb7ace5f6fc199e91bfad275b5925aa32c8 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 12 Mar 2024 13:50:23 +0000 Subject: [PATCH 1368/1506] wm_reader: Fix order of streams in reinit_stream. CW-Bug-Id: #23483 --- dlls/winegstreamer/wm_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 95213b1580b..8014691def3 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1597,7 +1597,7 @@ static HRESULT reinit_stream(struct wm_reader *reader, bool read_compressed) struct wm_stream *stream = &reader->streams[i]; struct wg_format format; - stream->wg_stream = wg_parser_get_stream(reader->wg_parser, i); + stream->wg_stream = wg_parser_get_stream(reader->wg_parser, reader->stream_count - i - 1); stream->reader = reader; wg_parser_stream_get_preferred_format(stream->wg_stream, &format); if (stream->selection == WMT_ON) From 32faf64f16dc9bec2edcef8ae9793048ec184863 Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Tue, 12 Mar 2024 12:15:53 -0300 Subject: [PATCH 1369/1506] Revert "HACK: gdiplus: Add HDC parameter back to gdi+ internal functions." This reverts commit 505f4dface671ca3a07ad7fc6eee818709a4b419. --- dlls/gdiplus/gdiplus_private.h | 4 +-- dlls/gdiplus/graphics.c | 52 +++++++++++++++++----------------- dlls/gdiplus/graphicspath.c | 8 +++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 95d19080ff1..2b5dbee43e9 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -620,13 +620,13 @@ struct gdip_font_link_info { }; -typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, HDC hdc, +typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *sections, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, INT underlined_index_count, void *user_data); -GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, +GpStatus gdip_format_string(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 4b942bfaa09..707fa55cfda 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5163,7 +5163,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w } /* Populates gdip_font_link_info struct based on the base_font and input string */ -static void generate_font_link_info(GpGraphics *graphics, HDC hdc, WCHAR *string, DWORD length, GDIPCONST GpFont *base_font, +static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD length, GDIPCONST GpFont *base_font, struct gdip_font_link_info *font_link_info) { IUnknown *unk; @@ -5182,7 +5182,7 @@ static void generate_font_link_info(GpGraphics *graphics, HDC hdc, WCHAR *string IUnknown_Release(unk); get_font_hfont(graphics, base_font, NULL, &hfont, NULL, NULL); - IMLangFontLink_GetFontCodePages(iMLFL, hdc, hfont, &font_codepages); + IMLangFontLink_GetFontCodePages(iMLFL, graphics->hdc, hfont, &font_codepages); while (progress < length) { @@ -5197,10 +5197,10 @@ static void generate_font_link_info(GpGraphics *graphics, HDC hdc, WCHAR *string } else { - IMLangFontLink_MapFont(iMLFL, hdc, string_codepages, hfont, &map_hfont); - old_font = SelectObject(hdc, map_hfont); - GdipCreateFontFromDC(hdc, &gpfont); - SelectObject(hdc, old_font); + IMLangFontLink_MapFont(iMLFL, graphics->hdc, string_codepages, hfont, &map_hfont); + old_font = SelectObject(graphics->hdc, map_hfont); + GdipCreateFontFromDC(graphics->hdc, &gpfont); + SelectObject(graphics->hdc, old_font); IMLangFontLink_ReleaseFont(iMLFL, map_hfont); section->font = gpfont; } @@ -5214,7 +5214,7 @@ static void generate_font_link_info(GpGraphics *graphics, HDC hdc, WCHAR *string IMLangFontLink_Release(iMLFL); } -static void font_link_get_text_extent_point(struct gdip_font_link_info *font_link_info, GpGraphics *graphics, HDC hdc, LPCWSTR string, +static void font_link_get_text_extent_point(struct gdip_font_link_info *font_link_info, GpGraphics *graphics, LPCWSTR string, INT index, int length, int max_ext, LPINT fit, SIZE *size) { DWORD to_measure_length; @@ -5236,9 +5236,9 @@ static void font_link_get_text_extent_point(struct gdip_font_link_info *font_lin to_measure_length = min(length - (i - index), section->end - i); get_font_hfont(graphics, section->font, NULL, &hfont, NULL, NULL); - oldhfont = SelectObject(hdc, hfont); - GetTextExtentExPointW(hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); - SelectObject(hdc, oldhfont); + oldhfont = SelectObject(graphics->hdc, hfont); + GetTextExtentExPointW(graphics->hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); + SelectObject(graphics->hdc, oldhfont); DeleteObject(hfont); max_ext -= sizeaux.cx; @@ -5266,7 +5266,7 @@ static void release_font_link_info(struct gdip_font_link_info *font_link_info) } } -GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, +GpStatus gdip_format_string(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data) @@ -5348,10 +5348,10 @@ GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, halign = format->align; - generate_font_link_info(graphics, hdc, stringdup, length, font, &font_link_info); + generate_font_link_info(graphics, stringdup, length, font, &font_link_info); while(sum < length){ - font_link_get_text_extent_point(&font_link_info, graphics, hdc, stringdup, sum, length - sum, nwidth, &fit, &size); + font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, length - sum, nwidth, &fit, &size); fitcpy = fit; if(fit == 0) @@ -5399,7 +5399,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, else lineend = fit; - font_link_get_text_extent_point(&font_link_info, graphics, hdc, stringdup, sum, lineend, nwidth, &j, &size); + font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, lineend, nwidth, &j, &size); bounds.Width = size.cx; @@ -5432,7 +5432,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, if (hotkeyprefix_offsets[hotkeyprefix_end_pos] >= sum + lineend) break; - stat = callback(graphics, hdc, stringdup, sum, lineend, + stat = callback(graphics, stringdup, sum, lineend, &font_link_info, rect, format, lineno, &bounds, &hotkeyprefix_offsets[hotkeyprefix_pos], hotkeyprefix_end_pos-hotkeyprefix_pos, user_data); @@ -5499,7 +5499,7 @@ struct measure_ranges_args { REAL rel_width, rel_height; }; -static GpStatus measure_ranges_callback(GpGraphics *graphics, HDC hdc, +static GpStatus measure_ranges_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, @@ -5522,10 +5522,10 @@ static GpStatus measure_ranges_callback(GpGraphics *graphics, HDC hdc, range_rect.Y = bounds->Y / args->rel_height; range_rect.Height = bounds->Height / args->rel_height; - font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, range_start - index, INT_MAX, NULL, &range_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, range_start - index, INT_MAX, NULL, &range_size); range_rect.X = (bounds->X + range_size.cx) / args->rel_width; - font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, range_end - index, INT_MAX, NULL, &range_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, range_end - index, INT_MAX, NULL, &range_size); range_rect.Width = (bounds->X + range_size.cx) / args->rel_width - range_rect.X; stat = GdipCombineRegionRect(args->regions[i], &range_rect, CombineModeUnion); @@ -5602,7 +5602,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, gdi_transform_acquire(graphics); - stat = gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, stringFormat, + stat = gdip_format_string(graphics, string, length, font, &scaled_rect, stringFormat, (stringFormat->attr & StringFormatFlagsNoClip) != 0, measure_ranges_callback, &args); gdi_transform_release(graphics); @@ -5623,7 +5623,7 @@ struct measure_string_args { REAL rel_width, rel_height; }; -static GpStatus measure_string_callback(GpGraphics *graphics, HDC hdc, +static GpStatus measure_string_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, @@ -5726,7 +5726,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, gdi_transform_acquire(graphics); - gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, measure_string_callback, &args); gdi_transform_release(graphics); @@ -5751,7 +5751,7 @@ struct draw_string_args { REAL x, y, rel_width, rel_height, ascent; }; -static GpStatus draw_string_callback(GpGraphics *graphics, HDC hdc, +static GpStatus draw_string_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, @@ -5775,7 +5775,7 @@ static GpStatus draw_string_callback(GpGraphics *graphics, HDC hdc, to_draw_length = min(length - (i - index), section->end - i); TRACE("index %d, todraw %ld, used %s\n", i, to_draw_length, section->font == font_link_info->base_font ? "base font" : "map"); - font_link_get_text_extent_point(font_link_info, graphics, hdc, string, i, to_draw_length, 0, NULL, &size); + font_link_get_text_extent_point(font_link_info, graphics, string, i, to_draw_length, 0, NULL, &size); stat = draw_driver_string(graphics, &string[i], to_draw_length, section->font, format, args->brush, &position, DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); @@ -5801,10 +5801,10 @@ static GpStatus draw_string_callback(GpGraphics *graphics, HDC hdc, SIZE text_size; INT ofs = underlined_indexes[i] - index; - font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, ofs, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs, INT_MAX, NULL, &text_size); start_x = text_size.cx / args->rel_width; - font_link_get_text_extent_point(font_link_info, graphics, hdc, string, index, ofs+1, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs+1, INT_MAX, NULL, &text_size); end_x = text_size.cx / args->rel_width; GdipFillRectangle(graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); @@ -5918,7 +5918,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string GetTextMetricsW(hdc, &textmetric); args.ascent = textmetric.tmAscent / rel_height; - gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, draw_string_callback, &args); gdi_transform_release(graphics); diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 0d1cfb2f9c5..20e0787de16 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -949,7 +949,7 @@ struct format_string_args float ascent; }; -static GpStatus format_string_callback(GpGraphics *graphics, HDC hdc, +static GpStatus format_string_callback(GpGraphics *graphics, GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, INT lineno, const RectF *bounds, INT *underlined_indexes, @@ -975,7 +975,7 @@ static GpStatus format_string_callback(GpGraphics *graphics, HDC hdc, TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; - len = GetGlyphOutlineW(hdc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + len = GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { status = GenericError; @@ -989,7 +989,7 @@ static GpStatus format_string_callback(GpGraphics *graphics, HDC hdc, status = OutOfMemory; break; } - GetGlyphOutlineW(hdc, string[i], GGO_BEZIER, &gm, len, start, &identity); + GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, len, start, &identity); ofs = 0; while (ofs < len) @@ -1117,7 +1117,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT args.maxY = 0; args.scale = emSize / native_height; args.ascent = textmetric.tmAscent * args.scale; - status = gdip_format_string(graphics, dc, string, length, NULL, &scaled_layout_rect, + status = gdip_format_string(graphics, string, length, NULL, &scaled_layout_rect, format, TRUE, format_string_callback, &args); DeleteDC(dc); From 505d621d48b90fda445825558473b3b47c79e156 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 23 Feb 2024 19:48:59 +0000 Subject: [PATCH 1370/1506] gdiplus: Switch to a struct for gdip_format_string callback args. (cherry picked from commit f2c92c68a21bdda69df0bd24023a658e5e8f9032) --- dlls/gdiplus/gdiplus_private.h | 22 +++++-- dlls/gdiplus/graphics.c | 116 ++++++++++++++++----------------- dlls/gdiplus/graphicspath.c | 24 +++---- 3 files changed, 83 insertions(+), 79 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 2b5dbee43e9..c88b5407257 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -619,12 +619,22 @@ struct gdip_font_link_info { struct list sections; }; - -typedef GpStatus (*gdip_format_string_callback)(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *sections, - GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, - INT lineno, const RectF *bounds, INT *underlined_indexes, - INT underlined_index_count, void *user_data); +struct gdip_format_string_info { + GpGraphics *graphics; + GDIPCONST WCHAR *string; + INT index; + INT length; + struct gdip_font_link_info font_link_info; + GDIPCONST RectF *rect; + GDIPCONST GpStringFormat *format; + INT lineno; + const RectF *bounds; + INT *underlined_indexes; + INT underlined_index_count; + void *user_data; +}; + +typedef GpStatus (*gdip_format_string_callback)(struct gdip_format_string_info *info); GpStatus gdip_format_string(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 707fa55cfda..a7ddb7d996c 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5282,17 +5282,26 @@ GpStatus gdip_format_string(GpGraphics *graphics, INT *hotkeyprefix_offsets=NULL; INT hotkeyprefix_count=0; INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0; - struct gdip_font_link_info font_link_info = { 0 }; BOOL seen_prefix = FALSE, unixstyle_newline = TRUE; + struct gdip_format_string_info info; + + info.graphics = graphics; + info.rect = rect; + info.bounds = &bounds; + info.user_data = user_data; if(length == -1) length = lstrlenW(string); stringdup = calloc(length + 1, sizeof(WCHAR)); if(!stringdup) return OutOfMemory; + info.string = stringdup; + if (!format) format = &default_drawstring_format; + info.format = format; + nwidth = (int)(rect->Width + 0.005f); nheight = (int)(rect->Height + 0.005f); if (ignore_empty_clip) @@ -5348,10 +5357,10 @@ GpStatus gdip_format_string(GpGraphics *graphics, halign = format->align; - generate_font_link_info(graphics, stringdup, length, font, &font_link_info); + generate_font_link_info(graphics, stringdup, length, font, &info.font_link_info); while(sum < length){ - font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, length - sum, nwidth, &fit, &size); + font_link_get_text_extent_point(&info.font_link_info, graphics, stringdup, sum, length - sum, nwidth, &fit, &size); fitcpy = fit; if(fit == 0) @@ -5399,7 +5408,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, else lineend = fit; - font_link_get_text_extent_point(&font_link_info, graphics, stringdup, sum, lineend, nwidth, &j, &size); + font_link_get_text_extent_point(&info.font_link_info, graphics, stringdup, sum, lineend, nwidth, &j, &size); bounds.Width = size.cx; @@ -5432,10 +5441,13 @@ GpStatus gdip_format_string(GpGraphics *graphics, if (hotkeyprefix_offsets[hotkeyprefix_end_pos] >= sum + lineend) break; - stat = callback(graphics, stringdup, sum, lineend, - &font_link_info, rect, format, lineno, &bounds, - &hotkeyprefix_offsets[hotkeyprefix_pos], - hotkeyprefix_end_pos-hotkeyprefix_pos, user_data); + info.index = sum; + info.length = lineend; + info.lineno = lineno; + info.underlined_indexes = &hotkeyprefix_offsets[hotkeyprefix_pos]; + info.underlined_index_count = hotkeyprefix_end_pos-hotkeyprefix_pos; + + stat = callback(&info); if (stat != Ok) break; @@ -5464,7 +5476,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, break; } - release_font_link_info(&font_link_info); + release_font_link_info(&info.font_link_info); free(stringdup); free(hotkeyprefix_offsets); @@ -5499,34 +5511,30 @@ struct measure_ranges_args { REAL rel_width, rel_height; }; -static GpStatus measure_ranges_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, - struct gdip_font_link_info *font_link_info, - GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, - INT lineno, const RectF *bounds, INT *underlined_indexes, - INT underlined_index_count, void *user_data) +static GpStatus measure_ranges_callback(struct gdip_format_string_info *info) { int i; GpStatus stat = Ok; - struct measure_ranges_args *args = user_data; + struct measure_ranges_args *args = info->user_data; + CharacterRange *ranges = info->format->character_ranges; - for (i=0; irange_count; i++) + for (i=0; i < info->format->range_count; i++) { - INT range_start = max(index, format->character_ranges[i].First); - INT range_end = min(index+length, format->character_ranges[i].First+format->character_ranges[i].Length); + INT range_start = max(info->index, ranges[i].First); + INT range_end = min(info->index + info->length, ranges[i].First + ranges[i].Length); if (range_start < range_end) { GpRectF range_rect; SIZE range_size; - range_rect.Y = bounds->Y / args->rel_height; - range_rect.Height = bounds->Height / args->rel_height; + range_rect.Y = info->bounds->Y / args->rel_height; + range_rect.Height = info->bounds->Height / args->rel_height; - font_link_get_text_extent_point(font_link_info, graphics, string, index, range_start - index, INT_MAX, NULL, &range_size); - range_rect.X = (bounds->X + range_size.cx) / args->rel_width; + font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, range_start - info->index, INT_MAX, NULL, &range_size); + range_rect.X = (info->bounds->X + range_size.cx) / args->rel_width; - font_link_get_text_extent_point(font_link_info, graphics, string, index, range_end - index, INT_MAX, NULL, &range_size); - range_rect.Width = (bounds->X + range_size.cx) / args->rel_width - range_rect.X; + font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, range_end - info->index, INT_MAX, NULL, &range_size); + range_rect.Width = (info->bounds->X + range_size.cx) / args->rel_width - range_rect.X; stat = GdipCombineRegionRect(args->regions[i], &range_rect, CombineModeUnion); if (stat != Ok) @@ -5623,18 +5631,13 @@ struct measure_string_args { REAL rel_width, rel_height; }; -static GpStatus measure_string_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, - struct gdip_font_link_info *font_link_info, - GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, - INT lineno, const RectF *bounds, INT *underlined_indexes, - INT underlined_index_count, void *user_data) +static GpStatus measure_string_callback(struct gdip_format_string_info *info) { - struct measure_string_args *args = user_data; + struct measure_string_args *args = info->user_data; REAL new_width, new_height; - new_width = bounds->Width / args->rel_width; - new_height = (bounds->Height + bounds->Y) / args->rel_height - args->bounds->Y; + new_width = info->bounds->Width / args->rel_width; + new_height = (info->bounds->Height + info->bounds->Y) / args->rel_height - args->bounds->Y; if (new_width > args->bounds->Width) args->bounds->Width = new_width; @@ -5643,7 +5646,7 @@ static GpStatus measure_string_callback(GpGraphics *graphics, args->bounds->Height = new_height; if (args->codepointsfitted) - *args->codepointsfitted = index + length; + *args->codepointsfitted = info->index + info->length; if (args->linesfilled) (*args->linesfilled)++; @@ -5751,63 +5754,58 @@ struct draw_string_args { REAL x, y, rel_width, rel_height, ascent; }; -static GpStatus draw_string_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, - struct gdip_font_link_info *font_link_info, - GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, - INT lineno, const RectF *bounds, INT *underlined_indexes, - INT underlined_index_count, void *user_data) +static GpStatus draw_string_callback(struct gdip_format_string_info *info) { - struct draw_string_args *args = user_data; - int i = index; + struct draw_string_args *args = info->user_data; + int i = info->index; PointF position; SIZE size; DWORD to_draw_length; struct gdip_font_link_section *section; GpStatus stat = Ok; - position.X = args->x + bounds->X / args->rel_width; - position.Y = args->y + bounds->Y / args->rel_height + args->ascent; + position.X = args->x + info->bounds->X / args->rel_width; + position.Y = args->y + info->bounds->Y / args->rel_height + args->ascent; - LIST_FOR_EACH_ENTRY(section, &font_link_info->sections, struct gdip_font_link_section, entry) + LIST_FOR_EACH_ENTRY(section, &info->font_link_info.sections, struct gdip_font_link_section, entry) { if (i >= section->end) continue; - to_draw_length = min(length - (i - index), section->end - i); - TRACE("index %d, todraw %ld, used %s\n", i, to_draw_length, section->font == font_link_info->base_font ? "base font" : "map"); - font_link_get_text_extent_point(font_link_info, graphics, string, i, to_draw_length, 0, NULL, &size); - stat = draw_driver_string(graphics, &string[i], to_draw_length, - section->font, format, args->brush, &position, + to_draw_length = min(info->length - (i - info->index), section->end - i); + TRACE("index %d, todraw %ld, used %s\n", i, to_draw_length, section->font == info->font_link_info.base_font ? "base font" : "map"); + font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, i, to_draw_length, 0, NULL, &size); + stat = draw_driver_string(info->graphics, &info->string[i], to_draw_length, + section->font, info->format, args->brush, &position, DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); position.X += size.cx / args->rel_width; i += to_draw_length; - if (stat != Ok || (i - index) >= length) break; + if (stat != Ok || (i - info->index) >= info->length) break; } - if (stat == Ok && underlined_index_count) + if (stat == Ok && info->underlined_index_count) { OUTLINETEXTMETRICW otm; REAL underline_y, underline_height; int i; - GetOutlineTextMetricsW(graphics->hdc, sizeof(otm), &otm); + GetOutlineTextMetricsW(info->graphics->hdc, sizeof(otm), &otm); underline_height = otm.otmsUnderscoreSize / args->rel_height; underline_y = position.Y - otm.otmsUnderscorePosition / args->rel_height - underline_height / 2; - for (i=0; iunderlined_index_count; i++) { REAL start_x, end_x; SIZE text_size; - INT ofs = underlined_indexes[i] - index; + INT ofs = info->underlined_indexes[i] - info->index; - font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, ofs, INT_MAX, NULL, &text_size); start_x = text_size.cx / args->rel_width; - font_link_get_text_extent_point(font_link_info, graphics, string, index, ofs+1, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, ofs+1, INT_MAX, NULL, &text_size); end_x = text_size.cx / args->rel_width; - GdipFillRectangle(graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); + GdipFillRectangle(info->graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); } } diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 20e0787de16..8fbdae1a65a 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -949,33 +949,29 @@ struct format_string_args float ascent; }; -static GpStatus format_string_callback(GpGraphics *graphics, - GDIPCONST WCHAR *string, INT index, INT length, struct gdip_font_link_info *font_link_info, - GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, - INT lineno, const RectF *bounds, INT *underlined_indexes, - INT underlined_index_count, void *priv) +static GpStatus format_string_callback(struct gdip_format_string_info* info) { static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; - struct format_string_args *args = priv; + struct format_string_args *args = info->user_data; GpPath *path = args->path; GpStatus status = Ok; - float x = rect->X + (bounds->X - rect->X) * args->scale; - float y = rect->Y + (bounds->Y - rect->Y) * args->scale; + float x = info->rect->X + (info->bounds->X - info->rect->X) * args->scale; + float y = info->rect->Y + (info->bounds->Y - info->rect->Y) * args->scale; int i; - if (underlined_index_count) + if (info->underlined_index_count) FIXME("hotkey underlines not drawn yet\n"); - if (y + bounds->Height * args->scale > args->maxY) - args->maxY = y + bounds->Height * args->scale; + if (y + info->bounds->Height * args->scale > args->maxY) + args->maxY = y + info->bounds->Height * args->scale; - for (i = index; i < length + index; ++i) + for (i = info->index; i < info->length + info->index; ++i) { GLYPHMETRICS gm; TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; - len = GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + len = GetGlyphOutlineW(info->graphics->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { status = GenericError; @@ -989,7 +985,7 @@ static GpStatus format_string_callback(GpGraphics *graphics, status = OutOfMemory; break; } - GetGlyphOutlineW(graphics->hdc, string[i], GGO_BEZIER, &gm, len, start, &identity); + GetGlyphOutlineW(info->graphics->hdc, info->string[i], GGO_BEZIER, &gm, len, start, &identity); ofs = 0; while (ofs < len) From fc7e28387b5de65267ec6ea52f273aa5d184ff7d Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 23 Feb 2024 20:05:12 +0000 Subject: [PATCH 1371/1506] gdiplus: Pass gdip_format_string_info to font link functions. (cherry picked from commit 0d0d37bbea2c59820d35082007dbedc0bd531c65) --- dlls/gdiplus/graphics.c | 51 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index a7ddb7d996c..1a57a375489 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5163,8 +5163,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w } /* Populates gdip_font_link_info struct based on the base_font and input string */ -static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD length, GDIPCONST GpFont *base_font, - struct gdip_font_link_info *font_link_info) +static void generate_font_link_info(struct gdip_format_string_info *info, DWORD length, GDIPCONST GpFont *base_font) { IUnknown *unk; IMLangFontLink *iMLFL; @@ -5174,21 +5173,21 @@ static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD l struct gdip_font_link_section *section; DWORD font_codepages, string_codepages; - list_init(&font_link_info->sections); - font_link_info->base_font = base_font; + list_init(&info->font_link_info.sections); + info->font_link_info.base_font = base_font; GetGlobalFontLinkObject((void**)&unk); IUnknown_QueryInterface(unk, &IID_IMLangFontLink, (void**)&iMLFL); IUnknown_Release(unk); - get_font_hfont(graphics, base_font, NULL, &hfont, NULL, NULL); - IMLangFontLink_GetFontCodePages(iMLFL, graphics->hdc, hfont, &font_codepages); + get_font_hfont(info->graphics, base_font, NULL, &hfont, NULL, NULL); + IMLangFontLink_GetFontCodePages(iMLFL, info->graphics->hdc, hfont, &font_codepages); while (progress < length) { section = calloc(1, sizeof(*section)); section->start = progress; - IMLangFontLink_GetStrCodePages(iMLFL, &string[progress], length - progress, + IMLangFontLink_GetStrCodePages(iMLFL, &info->string[progress], length - progress, font_codepages, &string_codepages, &processed); if (font_codepages & string_codepages) @@ -5197,16 +5196,16 @@ static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD l } else { - IMLangFontLink_MapFont(iMLFL, graphics->hdc, string_codepages, hfont, &map_hfont); - old_font = SelectObject(graphics->hdc, map_hfont); - GdipCreateFontFromDC(graphics->hdc, &gpfont); - SelectObject(graphics->hdc, old_font); + IMLangFontLink_MapFont(iMLFL, info->graphics->hdc, string_codepages, hfont, &map_hfont); + old_font = SelectObject(info->graphics->hdc, map_hfont); + GdipCreateFontFromDC(info->graphics->hdc, &gpfont); + SelectObject(info->graphics->hdc, old_font); IMLangFontLink_ReleaseFont(iMLFL, map_hfont); section->font = gpfont; } section->end = section->start + processed; - list_add_tail(&font_link_info->sections, §ion->entry); + list_add_tail(&info->font_link_info.sections, §ion->entry); progress += processed; } @@ -5214,7 +5213,7 @@ static void generate_font_link_info(GpGraphics *graphics, WCHAR *string, DWORD l IMLangFontLink_Release(iMLFL); } -static void font_link_get_text_extent_point(struct gdip_font_link_info *font_link_info, GpGraphics *graphics, LPCWSTR string, +static void font_link_get_text_extent_point(struct gdip_format_string_info *info, INT index, int length, int max_ext, LPINT fit, SIZE *size) { DWORD to_measure_length; @@ -5229,16 +5228,16 @@ static void font_link_get_text_extent_point(struct gdip_font_link_info *font_lin if (fit) *fit = 0; - LIST_FOR_EACH_ENTRY(section, &font_link_info->sections, struct gdip_font_link_section, entry) + LIST_FOR_EACH_ENTRY(section, &info->font_link_info.sections, struct gdip_font_link_section, entry) { if (i >= section->end) continue; to_measure_length = min(length - (i - index), section->end - i); - get_font_hfont(graphics, section->font, NULL, &hfont, NULL, NULL); - oldhfont = SelectObject(graphics->hdc, hfont); - GetTextExtentExPointW(graphics->hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); - SelectObject(graphics->hdc, oldhfont); + get_font_hfont(info->graphics, section->font, NULL, &hfont, NULL, NULL); + oldhfont = SelectObject(info->graphics->hdc, hfont); + GetTextExtentExPointW(info->graphics->hdc, &info->string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); + SelectObject(info->graphics->hdc, oldhfont); DeleteObject(hfont); max_ext -= sizeaux.cx; @@ -5357,10 +5356,10 @@ GpStatus gdip_format_string(GpGraphics *graphics, halign = format->align; - generate_font_link_info(graphics, stringdup, length, font, &info.font_link_info); + generate_font_link_info(&info, length, font); while(sum < length){ - font_link_get_text_extent_point(&info.font_link_info, graphics, stringdup, sum, length - sum, nwidth, &fit, &size); + font_link_get_text_extent_point(&info, sum, length - sum, nwidth, &fit, &size); fitcpy = fit; if(fit == 0) @@ -5408,7 +5407,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, else lineend = fit; - font_link_get_text_extent_point(&info.font_link_info, graphics, stringdup, sum, lineend, nwidth, &j, &size); + font_link_get_text_extent_point(&info, sum, lineend, nwidth, &j, &size); bounds.Width = size.cx; @@ -5530,10 +5529,10 @@ static GpStatus measure_ranges_callback(struct gdip_format_string_info *info) range_rect.Y = info->bounds->Y / args->rel_height; range_rect.Height = info->bounds->Height / args->rel_height; - font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, range_start - info->index, INT_MAX, NULL, &range_size); + font_link_get_text_extent_point(info, info->index, range_start - info->index, INT_MAX, NULL, &range_size); range_rect.X = (info->bounds->X + range_size.cx) / args->rel_width; - font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, range_end - info->index, INT_MAX, NULL, &range_size); + font_link_get_text_extent_point(info, info->index, range_end - info->index, INT_MAX, NULL, &range_size); range_rect.Width = (info->bounds->X + range_size.cx) / args->rel_width - range_rect.X; stat = GdipCombineRegionRect(args->regions[i], &range_rect, CombineModeUnion); @@ -5773,7 +5772,7 @@ static GpStatus draw_string_callback(struct gdip_format_string_info *info) to_draw_length = min(info->length - (i - info->index), section->end - i); TRACE("index %d, todraw %ld, used %s\n", i, to_draw_length, section->font == info->font_link_info.base_font ? "base font" : "map"); - font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, i, to_draw_length, 0, NULL, &size); + font_link_get_text_extent_point(info, i, to_draw_length, 0, NULL, &size); stat = draw_driver_string(info->graphics, &info->string[i], to_draw_length, section->font, info->format, args->brush, &position, DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); @@ -5799,10 +5798,10 @@ static GpStatus draw_string_callback(struct gdip_format_string_info *info) SIZE text_size; INT ofs = info->underlined_indexes[i] - info->index; - font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, ofs, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(info, info->index, ofs, INT_MAX, NULL, &text_size); start_x = text_size.cx / args->rel_width; - font_link_get_text_extent_point(&info->font_link_info, info->graphics, info->string, info->index, ofs+1, INT_MAX, NULL, &text_size); + font_link_get_text_extent_point(info, info->index, ofs+1, INT_MAX, NULL, &text_size); end_x = text_size.cx / args->rel_width; GdipFillRectangle(info->graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); From fd4a312a302f04a7fd1501c84ab0c7cd123c457e Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 23 Feb 2024 20:19:14 +0000 Subject: [PATCH 1372/1506] gdiplus: Restore hdc argument to gdip_format_string. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56345 (cherry picked from commit c37fea89e6202e82e91d6af75f94441a76a9c130) --- dlls/gdiplus/gdiplus_private.h | 3 ++- dlls/gdiplus/graphics.c | 27 ++++++++++++++------------- dlls/gdiplus/graphicspath.c | 6 +++--- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index c88b5407257..1ae03d7126e 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -621,6 +621,7 @@ struct gdip_font_link_info { struct gdip_format_string_info { GpGraphics *graphics; + HDC hdc; GDIPCONST WCHAR *string; INT index; INT length; @@ -636,7 +637,7 @@ struct gdip_format_string_info { typedef GpStatus (*gdip_format_string_callback)(struct gdip_format_string_info *info); -GpStatus gdip_format_string(GpGraphics *graphics, +GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 1a57a375489..2389cbf4f68 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5181,7 +5181,7 @@ static void generate_font_link_info(struct gdip_format_string_info *info, DWORD IUnknown_Release(unk); get_font_hfont(info->graphics, base_font, NULL, &hfont, NULL, NULL); - IMLangFontLink_GetFontCodePages(iMLFL, info->graphics->hdc, hfont, &font_codepages); + IMLangFontLink_GetFontCodePages(iMLFL, info->hdc, hfont, &font_codepages); while (progress < length) { @@ -5196,10 +5196,10 @@ static void generate_font_link_info(struct gdip_format_string_info *info, DWORD } else { - IMLangFontLink_MapFont(iMLFL, info->graphics->hdc, string_codepages, hfont, &map_hfont); - old_font = SelectObject(info->graphics->hdc, map_hfont); - GdipCreateFontFromDC(info->graphics->hdc, &gpfont); - SelectObject(info->graphics->hdc, old_font); + IMLangFontLink_MapFont(iMLFL, info->hdc, string_codepages, hfont, &map_hfont); + old_font = SelectObject(info->hdc, map_hfont); + GdipCreateFontFromDC(info->hdc, &gpfont); + SelectObject(info->hdc, old_font); IMLangFontLink_ReleaseFont(iMLFL, map_hfont); section->font = gpfont; } @@ -5235,9 +5235,9 @@ static void font_link_get_text_extent_point(struct gdip_format_string_info *info to_measure_length = min(length - (i - index), section->end - i); get_font_hfont(info->graphics, section->font, NULL, &hfont, NULL, NULL); - oldhfont = SelectObject(info->graphics->hdc, hfont); - GetTextExtentExPointW(info->graphics->hdc, &info->string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); - SelectObject(info->graphics->hdc, oldhfont); + oldhfont = SelectObject(info->hdc, hfont); + GetTextExtentExPointW(info->hdc, &info->string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux); + SelectObject(info->hdc, oldhfont); DeleteObject(hfont); max_ext -= sizeaux.cx; @@ -5265,7 +5265,7 @@ static void release_font_link_info(struct gdip_font_link_info *font_link_info) } } -GpStatus gdip_format_string(GpGraphics *graphics, +GpStatus gdip_format_string(GpGraphics *graphics, HDC hdc, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip, gdip_format_string_callback callback, void *user_data) @@ -5285,6 +5285,7 @@ GpStatus gdip_format_string(GpGraphics *graphics, struct gdip_format_string_info info; info.graphics = graphics; + info.hdc = hdc; info.rect = rect; info.bounds = &bounds; info.user_data = user_data; @@ -5609,7 +5610,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics, gdi_transform_acquire(graphics); - stat = gdip_format_string(graphics, string, length, font, &scaled_rect, stringFormat, + stat = gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, stringFormat, (stringFormat->attr & StringFormatFlagsNoClip) != 0, measure_ranges_callback, &args); gdi_transform_release(graphics); @@ -5728,7 +5729,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, gdi_transform_acquire(graphics); - gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, measure_string_callback, &args); gdi_transform_release(graphics); @@ -5787,7 +5788,7 @@ static GpStatus draw_string_callback(struct gdip_format_string_info *info) REAL underline_y, underline_height; int i; - GetOutlineTextMetricsW(info->graphics->hdc, sizeof(otm), &otm); + GetOutlineTextMetricsW(info->hdc, sizeof(otm), &otm); underline_height = otm.otmsUnderscoreSize / args->rel_height; underline_y = position.Y - otm.otmsUnderscorePosition / args->rel_height - underline_height / 2; @@ -5915,7 +5916,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string GetTextMetricsW(hdc, &textmetric); args.ascent = textmetric.tmAscent / rel_height; - gdip_format_string(graphics, string, length, font, &scaled_rect, format, TRUE, + gdip_format_string(graphics, hdc, string, length, font, &scaled_rect, format, TRUE, draw_string_callback, &args); gdi_transform_release(graphics); diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 8fbdae1a65a..4b272f539c4 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -971,7 +971,7 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; - len = GetGlyphOutlineW(info->graphics->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity); + len = GetGlyphOutlineW(info->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { status = GenericError; @@ -985,7 +985,7 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) status = OutOfMemory; break; } - GetGlyphOutlineW(info->graphics->hdc, info->string[i], GGO_BEZIER, &gm, len, start, &identity); + GetGlyphOutlineW(info->hdc, info->string[i], GGO_BEZIER, &gm, len, start, &identity); ofs = 0; while (ofs < len) @@ -1113,7 +1113,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT args.maxY = 0; args.scale = emSize / native_height; args.ascent = textmetric.tmAscent * args.scale; - status = gdip_format_string(graphics, string, length, NULL, &scaled_layout_rect, + status = gdip_format_string(graphics, dc, string, length, NULL, &scaled_layout_rect, format, TRUE, format_string_callback, &args); DeleteDC(dc); From f6d58ded6b4be1c447fea0f1f3085fb7f0cab33b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 11 Oct 2021 11:17:19 +0200 Subject: [PATCH 1373/1506] wine.inf: Disable nvcuda.dll by default. The nvcuda.dll stub presence may cause regressions when the games successfully load and try to use it (like Divinity The Original Sin 2). The library is enabled in proton script together with nvapi.dll. Link: https://github.com/ValveSoftware/wine/pull/119 CW-Bug-Id: #23561 --- loader/wine.inf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index bcb4c80a4d1..1e5b16a53a6 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2867,6 +2867,7 @@ HKCU,Software\Wine\DllOverrides,"ucrtbase",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"vcomp140",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"vcruntime140",0x2,"native,builtin" HKCU,Software\Wine\DllOverrides,"atiadlxx",,"disabled" +HKCU,Software\Wine\DllOverrides,"nvcuda",0x2,"disabled" ;;App-specific overrides to limit the number of resolutions HKCU,Software\Wine\AppDefaults\DarkSoulsIII.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" HKCU,Software\Wine\AppDefaults\sekiro.exe\X11 Driver,"LimitNumberOfResolutions",0x2,"32" From fb9ed24f5cfc1430508365286b7a884e42da2b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 13 Mar 2024 16:59:09 +0100 Subject: [PATCH 1374/1506] winex11: Only listen to RawButton and RawTouch events in the rawinput thread. CW-Bug-Id: #23563 --- dlls/winex11.drv/mouse.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 71711f609ae..655b0c67651 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -374,6 +374,7 @@ void x11drv_xinput2_init( struct x11drv_thread_data *data ) */ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) { + struct x11drv_thread_data *data = x11drv_thread_data(); unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; BOOL raw = (window == None); XIEventMask mask; @@ -388,11 +389,14 @@ void X11DRV_XInput2_Enable( Display *display, Window window, long event_mask ) if (raw && event_mask) { XISetMask( mask_bits, XI_RawMotion ); - XISetMask( mask_bits, XI_RawTouchBegin ); - XISetMask( mask_bits, XI_RawTouchUpdate ); - XISetMask( mask_bits, XI_RawTouchEnd ); - XISetMask( mask_bits, XI_RawButtonPress ); - XISetMask( mask_bits, XI_RawButtonRelease ); + if (data->xi2_rawinput_only) + { + XISetMask( mask_bits, XI_RawTouchBegin ); + XISetMask( mask_bits, XI_RawTouchUpdate ); + XISetMask( mask_bits, XI_RawTouchEnd ); + XISetMask( mask_bits, XI_RawButtonPress ); + XISetMask( mask_bits, XI_RawButtonRelease ); + } } XISetMask( mask_bits, XI_DeviceChanged ); @@ -2011,7 +2015,6 @@ static BOOL X11DRV_RawTouchEvent( XGenericEventCookie *xev ) int flags = 0; POINT pos; - if (!thread_data->xi2_rawinput_only) return FALSE; if (!map_raw_event_coords( event, &input, &rawinput )) return FALSE; if (!(input.mi.dwFlags & MOUSEEVENTF_ABSOLUTE)) return FALSE; pos.x = input.mi.dx; From a7888982b2e9f4f8f8020a905b8dddbee10617d6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 13 Mar 2024 11:55:42 -0600 Subject: [PATCH 1375/1506] amd_ags_x64: Do not fail context creation for NULL output GPU info. CW-Bug-Id: #23474 --- dlls/amd_ags_x64/amd_ags_x64_main.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/dlls/amd_ags_x64/amd_ags_x64_main.c b/dlls/amd_ags_x64/amd_ags_x64_main.c index e1cb3609b99..75f74e86b20 100644 --- a/dlls/amd_ags_x64/amd_ags_x64_main.c +++ b/dlls/amd_ags_x64/amd_ags_x64_main.c @@ -867,7 +867,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi unsigned int i; if (!info) - return AGS_INVALID_ARGS; + goto done; TRACE("filling AGSGPUInfo_311.\n"); if (!object->device_count) @@ -906,7 +906,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi unsigned int i; if (!gpu_info) - return AGS_INVALID_ARGS; + goto done; TRACE("filling AGSGPUInfo_320.\n"); if (!object->device_count) @@ -946,7 +946,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi unsigned int i; if (!gpu_info) - return AGS_INVALID_ARGS; + goto done; if (!object->device_count) { @@ -982,7 +982,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi else { if (!gpu_info) - return AGS_INVALID_ARGS; + goto done; memset(gpu_info, 0, sizeof(*gpu_info)); gpu_info->agsVersionMajor = AGS_VER_MAJOR(object->public_version); @@ -994,6 +994,7 @@ AGSReturnCode WINAPI agsInit(AGSContext **context, const AGSConfiguration *confi gpu_info->devices = object->devices; } +done: TRACE("Created context %p.\n", object); *context = object; @@ -1008,7 +1009,7 @@ AGSReturnCode WINAPI agsInitialize(int ags_version, const AGSConfiguration *conf TRACE("ags_verison %d, context %p, config %p, gpu_info %p.\n", ags_version, context, config, gpu_info); - if (!context || !gpu_info) + if (!context) return AGS_INVALID_ARGS; if (config) @@ -1023,11 +1024,14 @@ AGSReturnCode WINAPI agsInitialize(int ags_version, const AGSConfiguration *conf return ret; } - memset(gpu_info, 0, sizeof(*gpu_info)); - gpu_info->driverVersion = driver_version; - gpu_info->radeonSoftwareVersion = radeon_version; - gpu_info->numDevices = object->device_count; - gpu_info->devices = object->devices; + if (gpu_info) + { + memset(gpu_info, 0, sizeof(*gpu_info)); + gpu_info->driverVersion = driver_version; + gpu_info->radeonSoftwareVersion = radeon_version; + gpu_info->numDevices = object->device_count; + gpu_info->devices = object->devices; + } TRACE("Created context %p.\n", object); From 0bfa27bdb256faf411e86d4bbd54dedcd3225157 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 13 Mar 2024 18:44:31 -0600 Subject: [PATCH 1376/1506] ntdll: Wait for thread suspension in NtSuspendThread(). CW-Bug-Id: #23552 --- dlls/ntdll/unix/thread.c | 26 ++++++++++++++++++++++---- server/protocol.def | 6 ++++-- server/thread.c | 28 ++++++++++++++++++++++++---- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 64cad6e7c0e..c69d3de3e15 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1611,22 +1611,40 @@ NTSTATUS WINAPI NtOpenThread( HANDLE *handle, ACCESS_MASK access, /****************************************************************************** * NtSuspendThread (NTDLL.@) */ -NTSTATUS WINAPI NtSuspendThread( HANDLE handle, ULONG *count ) +NTSTATUS WINAPI NtSuspendThread( HANDLE handle, ULONG *ret_count ) { BOOL self = FALSE; - unsigned int ret; + unsigned int ret, count = 0; + HANDLE wait_handle = NULL; SERVER_START_REQ( suspend_thread ) { req->handle = wine_server_obj_handle( handle ); - if (!(ret = wine_server_call( req ))) + if (!(ret = wine_server_call( req )) || ret == STATUS_PENDING) { self = reply->count & 0x80000000; - if (count) *count = reply->count & 0x7fffffff; + count = reply->count & 0x7fffffff;; + wait_handle = wine_server_ptr_handle( reply->wait_handle ); } } SERVER_END_REQ; + if (self) usleep( 0 ); + + if (ret == STATUS_PENDING && wait_handle) + { + NtWaitForSingleObject( wait_handle, FALSE, NULL ); + + SERVER_START_REQ( suspend_thread ) + { + req->handle = wine_server_obj_handle( handle ); + req->waited_handle = wine_server_obj_handle( wait_handle ); + ret = wine_server_call( req ); + } + SERVER_END_REQ; + } + + if (!ret && ret_count) *ret_count = count; return ret; } diff --git a/server/protocol.def b/server/protocol.def index 848afbcc19c..a223b4f4665 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1182,9 +1182,11 @@ typedef volatile struct input_shared_memory input_shm_t; /* Suspend a thread */ @REQ(suspend_thread) - obj_handle_t handle; /* thread handle */ + obj_handle_t handle; /* thread handle */ + obj_handle_t waited_handle; /* handle waited on */ @REPLY - int count; /* new suspend count */ + int count; /* new suspend count */ + obj_handle_t wait_handle; /* handle to wait on */ @END diff --git a/server/thread.c b/server/thread.c index a6039b35d9d..e54e83c178a 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1815,12 +1815,32 @@ DECL_HANDLER(suspend_thread) { struct thread *thread; - if ((thread = get_thread_from_handle( req->handle, THREAD_SUSPEND_RESUME ))) + if (req->waited_handle) { - if (thread->state == TERMINATED) set_error( STATUS_ACCESS_DENIED ); - else reply->count = suspend_thread( thread ); - release_object( thread ); + struct context *context; + + if (!(context = (struct context *)get_handle_obj( current->process, req->waited_handle, + 0, &context_ops ))) + return; + close_handle( current->process, req->waited_handle ); /* avoid extra server call */ + set_error( context->status ); + release_object( context ); + return; } + + if (!(thread = get_thread_from_handle( req->handle, THREAD_SUSPEND_RESUME ))) return; + + if (thread->state != RUNNING) set_error( STATUS_ACCESS_DENIED ); + else + { + reply->count = suspend_thread( thread ); + if (!get_error() && thread != current && thread->context && thread->context->status == STATUS_PENDING) + { + set_error( STATUS_PENDING ); + reply->wait_handle = alloc_handle( current->process, thread->context, SYNCHRONIZE, 0 ); + } + } + release_object( thread ); } /* resume a thread */ From f61fcf98ceaf919d4276461e3ebe23c85eb67302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 14 Mar 2024 16:22:21 +0100 Subject: [PATCH 1377/1506] server: Send WM_WINE_CLIPCURSOR to release cursor only when necessary. CW-Bug-Id: #23569 --- server/protocol.def | 1 + server/queue.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/protocol.def b/server/protocol.def index a223b4f4665..ac14467f330 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -905,6 +905,7 @@ struct shared_cursor int y; unsigned int last_change; /* time of last position change */ rectangle_t clip; /* cursor clip rectangle */ + unsigned int clip_flags; /* cursor clip flags */ }; struct desktop_shared_memory diff --git a/server/queue.c b/server/queue.c index a41ae7583af..c1aebd56c29 100644 --- a/server/queue.c +++ b/server/queue.c @@ -616,6 +616,7 @@ static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsig void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsigned int flags, int reset ) { rectangle_t top_rect, new_rect; + unsigned int old_flags; int x, y; get_top_window_rectangle( desktop, &top_rect ); @@ -632,7 +633,9 @@ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsig SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) { + old_flags = shared->cursor.clip_flags; shared->cursor.clip = new_rect; + shared->cursor.clip_flags = flags; } SHARED_WRITE_END @@ -645,7 +648,8 @@ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsig if (reset) post_desktop_message( desktop, WM_WINE_CLIPCURSOR, flags, FALSE ); /* notify foreground thread, of reset, or to apply new cursor clipping rect */ - queue_cursor_message( desktop, 0, WM_WINE_CLIPCURSOR, flags, reset ); + if (rect || reset || old_flags != SET_CURSOR_NOCLIP) + queue_cursor_message( desktop, 0, WM_WINE_CLIPCURSOR, flags, reset ); } /* change the foreground input and reset the cursor clip rect */ From 559f14dbb8b73eeefec2d23592716e78c54fd667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 14 Mar 2024 18:09:17 +0100 Subject: [PATCH 1378/1506] server: Send WM_WINE_SETCURSOR message only when necessary. CW-Bug-Id: #23569 --- server/queue.c | 12 ++++++++++-- server/user.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/queue.c b/server/queue.c index c1aebd56c29..23423a239f1 100644 --- a/server/queue.c +++ b/server/queue.c @@ -535,15 +535,20 @@ static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t struct thread_input *input; desktop->cursor_win = win; - if (updated && (input = get_desktop_cursor_thread_input( desktop ))) + if (!updated) return 0; + + if (!(input = get_desktop_cursor_thread_input( desktop ))) + desktop->cursor_handle = -1; + else { user_handle_t handle = input->shared->cursor_count < 0 ? 0 : input->shared->cursor; /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle ); + desktop->cursor_handle = handle; } - return updated; + return 1; } static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win, int x, int y ) @@ -575,9 +580,12 @@ static void update_desktop_cursor_handle( struct desktop *desktop, struct thread if (input == get_desktop_cursor_thread_input( desktop )) { user_handle_t handle = input->shared->cursor_count < 0 ? 0 : input->shared->cursor, win = desktop->cursor_win; + if (handle == desktop->cursor_handle) return; + /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle ); + desktop->cursor_handle = handle; } } diff --git a/server/user.h b/server/user.h index a6ef5fc1f83..f06c9ba6b6e 100644 --- a/server/user.h +++ b/server/user.h @@ -68,6 +68,7 @@ struct desktop struct thread_input *foreground_input; /* thread input of foreground thread */ unsigned int users; /* processes and threads using this desktop */ user_handle_t cursor_win; /* window that contains the cursor */ + user_handle_t cursor_handle; /* last set cursor handle */ unsigned char keystate[256]; /* asynchronous key state */ unsigned int last_press_alt:1; /* last key press was Alt (used to determine msg on Alt release) */ struct object *shared_mapping; /* desktop shared memory mapping */ From 4d57e823fb1f5c755f0b11946614b2d1285afb0b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 14 Mar 2024 13:53:56 -0600 Subject: [PATCH 1379/1506] fixup! bcrypt: Add support for none and OAEP-padded asymmetric key encryption. CW-Bug-Id: #23572 --- dlls/bcrypt/gnutls.c | 2 +- dlls/bcrypt/tests/bcrypt.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 4abe0c354ed..553557e03d1 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -2905,7 +2905,7 @@ static NTSTATUS key_asymmetric_encrypt_gcrypt( void *args ) result_len = EXPORT_SIZE(result, key->u.a.bitlen / 8, 1); *ret_len = result_len; - if (params->output_len >= result_len) export_gnutls_datum(output, params->output_len, &result, 1); + if (params->output_len >= result_len) export_gnutls_datum(output, result_len, &result, 1); else if (params->output_len == 0) status = STATUS_SUCCESS; else status = STATUS_BUFFER_TOO_SMALL; diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 04b85be7b5e..96648bba3f7 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -2485,12 +2485,12 @@ static void test_rsa_encrypt(void) ok(ret == STATUS_SUCCESS, "got %lx\n", ret); ok(encrypted_size == 64, "got size of %ld\n", encrypted_size); - encrypted_a = malloc(encrypted_size); + encrypted_a = malloc(encrypted_size * 2); memset(encrypted_a, 0, encrypted_size); - encrypted_b = malloc(encrypted_size); + encrypted_b = malloc(encrypted_size * 2); memset(encrypted_b, 0xff, encrypted_size); - ret = BCryptEncrypt(key, input, sizeof(input), NULL, NULL, 0, encrypted_a, encrypted_size, &encrypted_size, BCRYPT_PAD_NONE); + ret = BCryptEncrypt(key, input, sizeof(input), NULL, NULL, 0, encrypted_a, encrypted_size * 2, &encrypted_size, BCRYPT_PAD_NONE); ok(ret == STATUS_INVALID_PARAMETER, "got %lx\n", ret); ret = BCryptEncrypt(key, input_no_padding, sizeof(input_no_padding), NULL, NULL, 0, encrypted_a, 12, &encrypted_size, BCRYPT_PAD_NONE); @@ -2537,12 +2537,12 @@ static void test_rsa_encrypt(void) ok(ret == STATUS_SUCCESS, "got %lx\n", ret); ok(encrypted_size == 64, "got size of %ld\n", encrypted_size); - encrypted_a = realloc(encrypted_a, encrypted_size); - memset(encrypted_a, 0, encrypted_size); - encrypted_b = realloc(encrypted_b, encrypted_size); + encrypted_a = realloc(encrypted_a, encrypted_size * 2); + memset(encrypted_a, 0, encrypted_size * 2); + encrypted_b = realloc(encrypted_b, encrypted_size * 2); memset(encrypted_b, 0, encrypted_size); - ret = BCryptEncrypt(key, input, sizeof(input), &oaep_pad, NULL, 0, encrypted_a, encrypted_size, &encrypted_size, BCRYPT_PAD_OAEP); + ret = BCryptEncrypt(key, input, sizeof(input), &oaep_pad, NULL, 0, encrypted_a, encrypted_size * 2, &encrypted_size, BCRYPT_PAD_OAEP); ok(ret == STATUS_SUCCESS, "got %lx\n", ret); ret = BCryptEncrypt(key, input, sizeof(input), &oaep_pad, NULL, 0, encrypted_b, encrypted_size, &encrypted_size, BCRYPT_PAD_OAEP); ok(ret == STATUS_SUCCESS, "got %lx\n", ret); From 6e0a371976976bd64569e5e20e1d00afd464026a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 14 Mar 2024 13:59:00 -0600 Subject: [PATCH 1380/1506] fixup! bcrypt: Add support for none and OAEP padded asymmetric key decryption. CW-Bug-Id: #23572 --- dlls/bcrypt/gnutls.c | 2 +- dlls/bcrypt/tests/bcrypt.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 553557e03d1..115219a64f6 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -3028,7 +3028,7 @@ static NTSTATUS key_asymmetric_decrypt_gcrypt( void *args ) { status = STATUS_SUCCESS; if (flags == BCRYPT_PAD_NONE) - export_gnutls_datum(output, params->output_len, &result, 1); + export_gnutls_datum(output, result_len, &result, 1); else memcpy(output, result.data, result_len); } diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 96648bba3f7..511ee7634b6 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -2506,7 +2506,7 @@ static void test_rsa_encrypt(void) decrypted_size = 0xdeadbeef; BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_NONE); ok(decrypted_size == sizeof(input_no_padding), "got %lu\n", decrypted_size); - BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_NONE); + BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, decrypted, decrypted_size * 2, &decrypted_size, BCRYPT_PAD_NONE); ok(!memcmp(decrypted, input_no_padding, sizeof(input_no_padding)), "Decrypted output it's not what expected\n"); encrypted_size = 60; @@ -2553,7 +2553,7 @@ static void test_rsa_encrypt(void) ret = BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_OAEP); ok(ret == STATUS_SUCCESS, "got %lx\n", ret); ok(decrypted_size == sizeof(input), "got %lu\n", decrypted_size); - ret = BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_OAEP); + ret = BCryptDecrypt(key, encrypted_a, encrypted_size, &oaep_pad, NULL, 0, decrypted, decrypted_size * 2, &decrypted_size, BCRYPT_PAD_OAEP); ok(ret == STATUS_SUCCESS, "got %lx\n", ret); ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n"); From 0a9d50f40494a1dd98d46317a22b21fa6a41ccff Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 14 Mar 2024 20:05:31 -0600 Subject: [PATCH 1381/1506] server: Ignore some ICMP-originated socket errors for connectionless sockets. CW-Bug-Id: #23578 --- server/sock.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/sock.c b/server/sock.c index 3b9367a1b72..9877888b465 100644 --- a/server/sock.c +++ b/server/sock.c @@ -815,7 +815,7 @@ static void post_sock_messages( struct sock *sock ) } } -static inline int sock_error( struct sock *sock ) +static inline int sock_error( struct sock *sock, int *poll_event ) { int error = 0; socklen_t len = sizeof(error); @@ -841,8 +841,14 @@ static inline int sock_error( struct sock *sock ) error = sock->errors[AFD_POLL_BIT_ACCEPT]; break; - case SOCK_CONNECTED: case SOCK_CONNECTIONLESS: + if (error == ENETUNREACH || error == EHOSTUNREACH || error == ECONNRESET) + { + if (poll_event) *poll_event &= ~POLLERR; + return 0; + } + /* fallthrough */ + case SOCK_CONNECTED: if (error == ECONNRESET || error == EPIPE) { sock->reset = 1; @@ -1348,7 +1354,7 @@ static void sock_poll_event( struct fd *fd, int event ) fprintf(stderr, "socket %p select event: %x\n", sock, event); if (event & (POLLERR | POLLHUP)) - error = sock_error( sock ); + error = sock_error( sock, &event ); switch (sock->state) { @@ -3121,7 +3127,7 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) return; } - error = sock_error( sock ); + error = sock_error( sock, NULL ); if (!error) { for (i = 0; i < ARRAY_SIZE( sock->errors ); ++i) From 9a26c7cc237360a592ef5f71607c3a881788c393 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Mar 2024 16:20:57 -0600 Subject: [PATCH 1382/1506] fixup! fshack: winex11: Always blit fs_hack in wglFlush and wglFinish when drawing to front buffer. CW-Bug-Id: #23582 --- dlls/winex11.drv/opengl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index cd8889f6091..23b22ccac25 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2729,7 +2729,9 @@ static void wglDrawBuffer( GLenum buffer ) TRACE( "buffer %#x.\n", buffer ); - ctx->drawing_to_front = (buffer == GL_FRONT); + if (!ctx->current_draw_fbo || (ctx->fs_hack && ctx->current_draw_fbo == ctx->fs_hack_fbo)) + ctx->drawing_to_front = (buffer == GL_FRONT || buffer == GL_FRONT_AND_BACK); + if (ctx->fs_hack && ctx->current_draw_fbo == ctx->fs_hack_fbo) { TRACE( "Overriding %#x with GL_COLOR_ATTACHMENT0\n", buffer ); From 1dffce0cdfdd4ff9e4782504157d5f4933943f2b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Mar 2024 19:52:04 -0600 Subject: [PATCH 1383/1506] ddraw: Store material handles in ddraw object. CW-Bug-Id: #23583 --- dlls/ddraw/ddraw.c | 36 ++++++++++++++++++++++++++ dlls/ddraw/ddraw_private.h | 52 ++++++++++++++++++++------------------ dlls/ddraw/device.c | 10 +------- dlls/ddraw/material.c | 4 +-- dlls/ddraw/viewport.c | 2 +- 5 files changed, 67 insertions(+), 37 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 8603f4a1113..f729a35d1bf 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -420,6 +420,8 @@ static void ddraw_destroy_swapchain(struct ddraw *ddraw) *****************************************************************************/ static void ddraw_destroy(struct ddraw *This) { + unsigned int i; + IDirectDraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, NULL, DDSCL_NORMAL); IDirectDraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); @@ -441,6 +443,31 @@ static void ddraw_destroy(struct ddraw *This) wined3d_device_decref(This->wined3d_device); wined3d_decref(This->wined3d); + for (i = 0; i < This->handle_table.entry_count; ++i) + { + struct ddraw_handle_entry *entry = &This->handle_table.entries[i]; + + switch (entry->type) + { + case DDRAW_HANDLE_FREE: + break; + + case DDRAW_HANDLE_MATERIAL: + { + struct d3d_material *m = entry->object; + FIXME("Material handle %#x (%p) not unset properly.\n", i + 1, m); + m->Handle = 0; + break; + } + + default: + FIXME("Handle %#x (%p) has unknown type %#x.\n", i + 1, entry->object, entry->type); + break; + } + } + + ddraw_handle_table_destroy(&This->handle_table); + if (This->d3ddevice) This->d3ddevice->ddraw = NULL; @@ -5125,6 +5152,15 @@ HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type de list_init(&ddraw->surface_list); + if (!ddraw_handle_table_init(&ddraw->handle_table, 64)) + { + ERR("Failed to initialize handle table.\n"); + ddraw_handle_table_destroy(&ddraw->handle_table); + wined3d_device_decref(ddraw->wined3d_device); + wined3d_decref(ddraw->wined3d); + return DDERR_OUTOFMEMORY; + } + if (FAILED(hr = wined3d_stateblock_create(ddraw->wined3d_device, NULL, WINED3D_SBT_PRIMARY, &ddraw->state))) { ERR("Failed to create the primary stateblock, hr %#lx.\n", hr); diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index b1fd015aa14..d0f3ebc967c 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -81,6 +81,31 @@ enum ddraw_device_state DDRAW_DEVICE_STATE_NOT_RESTORED, }; +#define DDRAW_INVALID_HANDLE ~0U + +enum ddraw_handle_type +{ + DDRAW_HANDLE_FREE, + DDRAW_HANDLE_MATERIAL, + DDRAW_HANDLE_MATRIX, + DDRAW_HANDLE_STATEBLOCK, + DDRAW_HANDLE_SURFACE, +}; + +struct ddraw_handle_entry +{ + void *object; + enum ddraw_handle_type type; +}; + +struct ddraw_handle_table +{ + struct ddraw_handle_entry *entries; + struct ddraw_handle_entry *free_entries; + UINT table_size; + UINT entry_count; +}; + struct ddraw { /* Interfaces */ @@ -132,6 +157,8 @@ struct ddraw */ struct list surface_list; + struct ddraw_handle_table handle_table; + /* FVF management */ struct FvfToDecl *decls; UINT numConvertedDecls, declArraySize; @@ -285,31 +312,6 @@ struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 * struct ddraw_surface *unsafe_impl_from_IDirect3DTexture(IDirect3DTexture *iface); struct ddraw_surface *unsafe_impl_from_IDirect3DTexture2(IDirect3DTexture2 *iface); -#define DDRAW_INVALID_HANDLE ~0U - -enum ddraw_handle_type -{ - DDRAW_HANDLE_FREE, - DDRAW_HANDLE_MATERIAL, - DDRAW_HANDLE_MATRIX, - DDRAW_HANDLE_STATEBLOCK, - DDRAW_HANDLE_SURFACE, -}; - -struct ddraw_handle_entry -{ - void *object; - enum ddraw_handle_type type; -}; - -struct ddraw_handle_table -{ - struct ddraw_handle_entry *entries; - struct ddraw_handle_entry *free_entries; - UINT table_size; - UINT entry_count; -}; - BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size); void ddraw_handle_table_destroy(struct ddraw_handle_table *t); DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type); diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index bc1d91ee00b..b86ec044fa4 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -303,14 +303,6 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface) case DDRAW_HANDLE_FREE: break; - case DDRAW_HANDLE_MATERIAL: - { - struct d3d_material *m = entry->object; - FIXME("Material handle %#lx (%p) not unset properly.\n", i + 1, m); - m->Handle = 0; - break; - } - case DDRAW_HANDLE_MATRIX: { /* No FIXME here because this might happen because of sloppy applications. */ @@ -2936,7 +2928,7 @@ static HRESULT WINAPI d3d_device3_SetLightState(IDirect3DDevice3 *iface, { struct d3d_material *m; - if (!(m = ddraw_get_object(&device->handle_table, value - 1, DDRAW_HANDLE_MATERIAL))) + if (!(m = ddraw_get_object(&device->ddraw->handle_table, value - 1, DDRAW_HANDLE_MATERIAL))) { WARN("Invalid material handle.\n"); wined3d_mutex_unlock(); diff --git a/dlls/ddraw/material.c b/dlls/ddraw/material.c index d8cb41f1733..4f8266f00d2 100644 --- a/dlls/ddraw/material.c +++ b/dlls/ddraw/material.c @@ -143,7 +143,7 @@ static ULONG WINAPI d3d_material3_Release(IDirect3DMaterial3 *iface) if (material->Handle) { wined3d_mutex_lock(); - ddraw_free_handle(&material->ddraw->d3ddevice->handle_table, material->Handle - 1, DDRAW_HANDLE_MATERIAL); + ddraw_free_handle(&material->ddraw->handle_table, material->Handle - 1, DDRAW_HANDLE_MATERIAL); wined3d_mutex_unlock(); } @@ -300,7 +300,7 @@ static HRESULT WINAPI d3d_material3_GetHandle(IDirect3DMaterial3 *iface, material->active_device = device_impl; if (!material->Handle) { - DWORD h = ddraw_allocate_handle(&device_impl->handle_table, material, DDRAW_HANDLE_MATERIAL); + DWORD h = ddraw_allocate_handle(&device_impl->ddraw->handle_table, material, DDRAW_HANDLE_MATERIAL); if (h == DDRAW_INVALID_HANDLE) { ERR("Failed to allocate a material handle.\n"); diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c index 4eda2fe4763..db235721f75 100644 --- a/dlls/ddraw/viewport.c +++ b/dlls/ddraw/viewport.c @@ -627,7 +627,7 @@ static HRESULT WINAPI d3d_viewport_SetBackground(IDirect3DViewport3 *iface, D3DM wined3d_mutex_lock(); - if (!(m = ddraw_get_object(&viewport->ddraw->d3ddevice->handle_table, material - 1, DDRAW_HANDLE_MATERIAL))) + if (!(m = ddraw_get_object(&viewport->ddraw->handle_table, material - 1, DDRAW_HANDLE_MATERIAL))) { WARN("Invalid material handle %#lx.\n", material); wined3d_mutex_unlock(); From 39ec99f05dc5a2281a684ce340dc40c8f72f525e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Mar 2024 19:56:46 -0600 Subject: [PATCH 1384/1506] ddraw: Store surface handles in ddraw object. CW-Bug-Id: #23583 --- dlls/ddraw/ddraw.c | 8 ++++++++ dlls/ddraw/device.c | 10 +--------- dlls/ddraw/executebuffer.c | 4 ++-- dlls/ddraw/surface.c | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index f729a35d1bf..4d0bbc2654d 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -460,6 +460,14 @@ static void ddraw_destroy(struct ddraw *This) break; } + case DDRAW_HANDLE_SURFACE: + { + struct ddraw_surface *surf = entry->object; + FIXME("Texture handle %#x (%p) not unset properly.\n", i + 1, surf); + surf->Handle = 0; + break; + } + default: FIXME("Handle %#x (%p) has unknown type %#x.\n", i + 1, entry->object, entry->type); break; diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index b86ec044fa4..d34be880991 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -319,14 +319,6 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface) break; } - case DDRAW_HANDLE_SURFACE: - { - struct ddraw_surface *surf = entry->object; - FIXME("Texture handle %#lx (%p) not unset properly.\n", i + 1, surf); - surf->Handle = 0; - break; - } - default: FIXME("Handle %#lx (%p) has unknown type %#x.\n", i + 1, entry->object, entry->type); break; @@ -2760,7 +2752,7 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface, break; } - surf = ddraw_get_object(&device->handle_table, value - 1, DDRAW_HANDLE_SURFACE); + surf = ddraw_get_object(&device->ddraw->handle_table, value - 1, DDRAW_HANDLE_SURFACE); if (!surf) { WARN("Invalid texture handle.\n"); diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index 320ce6649d4..f505eea37c6 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -347,13 +347,13 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d instr += size; - if (!(dst = ddraw_get_object(&device->handle_table, + if (!(dst = ddraw_get_object(&device->ddraw->handle_table, ci->hDestTexture - 1, DDRAW_HANDLE_SURFACE))) { WARN("Invalid destination texture handle %#lx.\n", ci->hDestTexture); continue; } - if (!(src = ddraw_get_object(&device->handle_table, + if (!(src = ddraw_get_object(&device->ddraw->handle_table, ci->hSrcTexture - 1, DDRAW_HANDLE_SURFACE))) { WARN("Invalid source texture handle %#lx.\n", ci->hSrcTexture); diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 5836a49f4fd..1b9a3950be4 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5419,7 +5419,7 @@ static HRESULT WINAPI d3d_texture2_GetHandle(IDirect3DTexture2 *iface, if (!surface->Handle) { - DWORD h = ddraw_allocate_handle(&device_impl->handle_table, surface, DDRAW_HANDLE_SURFACE); + DWORD h = ddraw_allocate_handle(&device_impl->ddraw->handle_table, surface, DDRAW_HANDLE_SURFACE); if (h == DDRAW_INVALID_HANDLE) { ERR("Failed to allocate a texture handle.\n"); @@ -6030,7 +6030,7 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren /* Having a texture handle set implies that the device still exists. */ if (surface->Handle) - ddraw_free_handle(&surface->ddraw->d3ddevice->handle_table, surface->Handle - 1, DDRAW_HANDLE_SURFACE); + ddraw_free_handle(&surface->ddraw->handle_table, surface->Handle - 1, DDRAW_HANDLE_SURFACE); /* Reduce the ddraw surface count. */ list_remove(&surface->surface_list_entry); From 1aae743bf28b003b2916c2da5d9c6e7bfac2d931 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Mar 2024 20:12:04 -0600 Subject: [PATCH 1385/1506] ddraw: Support multiple devices per ddraw object. CW-Bug-Id: #23583 --- dlls/ddraw/ddraw.c | 8 ++++++-- dlls/ddraw/ddraw_private.h | 3 ++- dlls/ddraw/device.c | 13 +++++-------- dlls/ddraw/main.c | 4 ++-- dlls/ddraw/surface.c | 19 ++++++++++++------- 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 4d0bbc2654d..bfb7721c34d 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -420,6 +420,7 @@ static void ddraw_destroy_swapchain(struct ddraw *ddraw) *****************************************************************************/ static void ddraw_destroy(struct ddraw *This) { + struct d3d_device *device; unsigned int i; IDirectDraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, NULL, DDSCL_NORMAL); @@ -476,8 +477,10 @@ static void ddraw_destroy(struct ddraw *This) ddraw_handle_table_destroy(&This->handle_table); - if (This->d3ddevice) - This->d3ddevice->ddraw = NULL; + LIST_FOR_EACH_ENTRY(device, &This->d3ddevice_list, struct d3d_device, ddraw_entry) + { + device->ddraw = NULL; + } /* Now free the object */ free(This); @@ -5159,6 +5162,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type de ddraw->immediate_context = wined3d_device_get_immediate_context(ddraw->wined3d_device); list_init(&ddraw->surface_list); + list_init(&ddraw->d3ddevice_list); if (!ddraw_handle_table_init(&ddraw->handle_table, 64)) { diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index d0f3ebc967c..eed8c737037 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -142,7 +142,7 @@ struct ddraw /* D3D things */ HWND d3d_window; - struct d3d_device *d3ddevice; + struct list d3ddevice_list; int d3dversion; /* Various HWNDs */ @@ -335,6 +335,7 @@ struct d3d_device struct wined3d_device *wined3d_device; struct wined3d_device_context *immediate_context; struct ddraw *ddraw; + struct list ddraw_entry; IUnknown *rt_iface; struct wined3d_streaming_buffer vertex_buffer, index_buffer; diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index d34be880991..b0f0bd910dc 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -343,7 +343,10 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface) /* Releasing the render target above may have released the last * reference to the ddraw object. */ if (This->ddraw) - This->ddraw->d3ddevice = NULL; + { + list_remove(&This->ddraw_entry); + This->ddraw = NULL; + } /* Now free the structure */ free(This); @@ -6874,7 +6877,7 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, c if (version != 1) IUnknown_AddRef(device->rt_iface); - ddraw->d3ddevice = device; + list_add_head(&ddraw->d3ddevice_list, &device->ddraw_entry); wined3d_stateblock_set_render_state(ddraw->state, WINED3D_RS_ZENABLE, d3d_device_update_depth_stencil(device)); @@ -6922,12 +6925,6 @@ HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_su return DDERR_OUTOFMEMORY; } - if (ddraw->d3ddevice) - { - FIXME("Only one Direct3D device per DirectDraw object supported.\n"); - return DDERR_INVALIDPARAMS; - } - if (!(object = calloc(1, sizeof(*object)))) { ERR("Failed to allocate device memory.\n"); diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 1ba2900704f..52f82e3c256 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -874,8 +874,8 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) WARN("DirectDraw object %p has reference counts {%lu, %lu, %lu, %lu, %lu}.\n", ddraw, ddraw->ref7, ddraw->ref4, ddraw->ref3, ddraw->ref2, ddraw->ref1); - if (ddraw->d3ddevice) - WARN("DirectDraw object %p has Direct3D device %p attached.\n", ddraw, ddraw->d3ddevice); + if (!list_empty(&ddraw->d3ddevice_list)) + WARN("DirectDraw object %p has Direct3D device(s) attached.\n", ddraw); LIST_FOR_EACH_ENTRY(surface, &ddraw->surface_list, struct ddraw_surface, surface_list_entry) { diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 1b9a3950be4..37563c56c3c 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1986,6 +1986,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface2_Blt(IDirectDrawSurface2 * *****************************************************************************/ static HRESULT ddraw_surface_attach_surface(struct ddraw_surface *This, struct ddraw_surface *Surf) { + struct d3d_device *device; + TRACE("surface %p, attachment %p.\n", This, Surf); if(Surf == This) @@ -2012,8 +2014,10 @@ static HRESULT ddraw_surface_attach_surface(struct ddraw_surface *This, struct d This->next_attached = Surf; /* Check if the WineD3D depth stencil needs updating */ - if (This->ddraw->d3ddevice) - d3d_device_update_depth_stencil(This->ddraw->d3ddevice); + LIST_FOR_EACH_ENTRY(device, &This->ddraw->d3ddevice_list, struct d3d_device, ddraw_entry) + { + d3d_device_update_depth_stencil(device); + } wined3d_mutex_unlock(); @@ -6733,18 +6737,19 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (ddraw->cooperative_level & DDSCL_EXCLUSIVE) { struct wined3d_swapchain_desc swapchain_desc; + struct d3d_device *device; wined3d_swapchain_get_desc(ddraw->wined3d_swapchain, &swapchain_desc); swapchain_desc.backbuffer_width = mode.width; swapchain_desc.backbuffer_height = mode.height; swapchain_desc.backbuffer_format = mode.format_id; - if (ddraw->d3ddevice) + LIST_FOR_EACH_ENTRY(device, &ddraw->d3ddevice_list, struct d3d_device, ddraw_entry) { - if (ddraw->d3ddevice->recording) - wined3d_stateblock_decref(ddraw->d3ddevice->recording); - ddraw->d3ddevice->recording = NULL; - ddraw->d3ddevice->update_state = ddraw->d3ddevice->state; + if (device->recording) + wined3d_stateblock_decref(device->recording); + device->recording = NULL; + device->update_state = device->state; } wined3d_stateblock_reset(ddraw->state); From 1237265a381818d8f549ccce9127e4d4689dec20 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 15 Mar 2024 21:40:03 -0600 Subject: [PATCH 1386/1506] ddraw/tests: Add tests for multiple devices. CW-Bug-Id: #23583 --- dlls/ddraw/tests/ddraw1.c | 80 +++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 121 +++++++++++++++++++++++++++++++++++--- dlls/ddraw/tests/ddraw4.c | 98 +++++++++++++++++++++++++++--- dlls/ddraw/tests/ddraw7.c | 62 ++++++++++++++++--- 4 files changed, 338 insertions(+), 23 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 02d6adbb433..88569d01bf5 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15457,6 +15457,85 @@ static void test_enum_devices(void) ok(!refcount, "Device has %lu references left.\n", refcount); } +static void test_multiple_devices(void) +{ + D3DTEXTUREHANDLE texture_handle, texture_handle2; + D3DMATERIALHANDLE mat_handle, mat_handle2; + IDirect3DViewport *viewport, *viewport2; + IDirect3DDevice *device, *device2; + IDirectDrawSurface *texture_surf; + IDirect3DMaterial *material; + DDSURFACEDESC surface_desc; + IDirect3DTexture *texture; + IDirectDraw *ddraw; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, &IID_IDirect3DHALDevice))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + device2 = create_device_ex(ddraw, window, DDSCL_NORMAL, &IID_IDirect3DHALDevice); + ok(!!device2, "got NULL.\n"); + + viewport = create_viewport(device, 0, 0, 640, 480); + viewport2 = create_viewport(device2, 0, 0, 640, 480); + + material = create_diffuse_material(device, 1.0f, 0.0f, 0.0f, 1.0f); + hr = IDirect3DMaterial2_GetHandle(material, device, &mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DMaterial2_GetHandle(material, device, &mat_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + ok(mat_handle == mat_handle2, "got different handles.\n"); + + hr = IDirect3DMaterial_GetHandle(material, device2, &mat_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + todo_wine ok(mat_handle != mat_handle2, "got same handles.\n"); + + hr = IDirect3DViewport_SetBackground(viewport, mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DViewport_SetBackground(viewport2, mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + surface_desc.dwWidth = 256; + surface_desc.dwHeight = 256; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &texture_surf, NULL); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirectDrawSurface_QueryInterface(texture_surf, &IID_IDirect3DTexture2, (void **)&texture); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DTexture_GetHandle(texture, device, &texture_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DTexture_GetHandle(texture, device2, &texture_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + ok(texture_handle != texture_handle2, "got same handles.\n"); + + IDirect3DTexture_Release(texture); + IDirectDrawSurface_Release(texture_surf); + IDirect3DMaterial_Release(material); + IDirect3DViewport_Release(viewport); + IDirect3DViewport_Release(viewport2); + + refcount = IDirect3DDevice_Release(device); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirect3DDevice_Release(device2); + ok(!refcount, "Device has %lu references left.\n", refcount); + + IDirectDraw_Release(ddraw); + DestroyWindow(window); +} + START_TEST(ddraw1) { DDDEVICEIDENTIFIER identifier; @@ -15576,4 +15655,5 @@ START_TEST(ddraw1) run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); test_enum_devices(); + test_multiple_devices(); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index f4cc5df0558..1ddb36b3b4f 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -462,7 +462,8 @@ static IDirectDraw2 *create_ddraw(void) return ddraw2; } -static IDirect3DDevice2 *create_device_ex(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, const GUID *device_guid) +static IDirect3DDevice2 *create_device_ex(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, const GUID *device_guid, + IDirectDrawSurface **ret_surface) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -541,13 +542,17 @@ static IDirect3DDevice2 *create_device_ex(IDirectDraw2 *ddraw, HWND window, DWOR } IDirect3D2_Release(d3d); - IDirectDrawSurface_Release(surface); + if (ret_surface) + *ret_surface = surface; + else + IDirectDrawSurface_Release(surface); + return device; } static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level) { - return create_device_ex(ddraw, window, coop_level, &IID_IDirect3DHALDevice); + return create_device_ex(ddraw, window, coop_level, &IID_IDirect3DHALDevice, NULL); } static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UINT y, UINT w, UINT h) @@ -1330,7 +1335,7 @@ static void test_depth_blit(const GUID *device_guid) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1856,7 +1861,7 @@ static void test_zenable(const GUID *device_guid) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1971,7 +1976,7 @@ static void test_ck_rgba(const GUID *device_guid) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -5204,7 +5209,7 @@ static void test_rt_caps(const GUID *device_guid) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -15692,7 +15697,7 @@ static void test_texture_wrong_caps(const GUID *device_guid) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -16442,6 +16447,105 @@ static void run_for_each_device_type(void (*test_func)(const GUID *)) test_func(&IID_IDirect3DRGBDevice); } +static void test_multiple_devices(void) +{ + D3DTEXTUREHANDLE texture_handle, texture_handle2; + IDirectDrawSurface *surface, *texture_surf; + D3DMATERIALHANDLE mat_handle, mat_handle2; + IDirect3DViewport2 *viewport, *viewport2; + IDirect3DDevice2 *device, *device2; + IDirect3DMaterial2 *material; + DDSURFACEDESC surface_desc; + IDirect3DTexture2 *texture; + IDirectDraw2 *ddraw; + IDirect3D2 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, &IID_IDirect3DHALDevice, &surface))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice2_GetDirect3D(device, &d3d); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + viewport = create_viewport(device, 0, 0, 640, 480); + viewport2 = create_viewport(device2, 0, 0, 640, 480); + hr = IDirect3DDevice2_SetCurrentViewport(device, viewport); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DDevice2_SetCurrentViewport(device2, viewport); + ok(hr == DDERR_INVALIDPARAMS, "got %#lx.\n", hr); + hr = IDirect3DDevice2_SetCurrentViewport(device2, viewport2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + material = create_diffuse_material(device, 1.0f, 0.0f, 0.0f, 1.0f); + hr = IDirect3DMaterial2_GetHandle(material, device, &mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DMaterial2_GetHandle(material, device, &mat_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + ok(mat_handle == mat_handle2, "got different handles.\n"); + + hr = IDirect3DMaterial2_GetHandle(material, device2, &mat_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + todo_wine ok(mat_handle != mat_handle2, "got same handles.\n"); + + hr = IDirect3DDevice2_SetLightState(device, D3DLIGHTSTATE_MATERIAL, mat_handle); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice2_SetLightState(device2, D3DLIGHTSTATE_MATERIAL, mat_handle); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice2_SetLightState(device, D3DLIGHTSTATE_MATERIAL, mat_handle2); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + + hr = IDirect3DViewport2_SetBackground(viewport, mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DViewport2_SetBackground(viewport2, mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + surface_desc.dwWidth = 256; + surface_desc.dwHeight = 256; + hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &texture_surf, NULL); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirectDrawSurface_QueryInterface(texture_surf, &IID_IDirect3DTexture2, (void **)&texture); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DTexture2_GetHandle(texture, device, &texture_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DTexture2_GetHandle(texture, device2, &texture_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + ok(texture_handle == texture_handle2, "got different handles.\n"); + + IDirect3DTexture2_Release(texture); + IDirectDrawSurface_Release(texture_surf); + IDirect3DMaterial2_Release(material); + IDirect3DViewport2_Release(viewport); + IDirect3DViewport2_Release(viewport2); + + refcount = IDirect3DDevice2_Release(device); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirect3DDevice2_Release(device2); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirectDrawSurface_Release(surface); + ok(!refcount, "Surface has %lu references left.\n", refcount); + + IDirectDraw2_Release(ddraw); + IDirect3D2_Release(d3d); + DestroyWindow(window); +} + START_TEST(ddraw2) { DDDEVICEIDENTIFIER identifier; @@ -16567,4 +16671,5 @@ START_TEST(ddraw2) run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); test_enum_devices(); + test_multiple_devices(); } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 4811053a231..8c850ca2c93 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -450,7 +450,8 @@ static IDirectDraw4 *create_ddraw(void) return ddraw4; } -static IDirect3DDevice3 *create_device_ex(HWND window, DWORD coop_level, const GUID *device_guid) +static IDirect3DDevice3 *create_device_ex(HWND window, DWORD coop_level, const GUID *device_guid, + IDirectDrawSurface4 **ret_surface) { IDirectDrawSurface4 *surface, *ds; IDirect3DDevice3 *device = NULL; @@ -539,16 +540,22 @@ static IDirect3DDevice3 *create_device_ex(HWND window, DWORD coop_level, const G hr = IDirect3D3_CreateDevice(d3d3, device_guid, surface, &device, NULL); IDirect3D3_Release(d3d3); - IDirectDrawSurface4_Release(surface); if (FAILED(hr)) + { + IDirectDrawSurface4_Release(surface); return NULL; + } + if (ret_surface) + *ret_surface = surface; + else + IDirectDrawSurface4_Release(surface); return device; } static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) { - return create_device_ex(window, coop_level, &IID_IDirect3DHALDevice); + return create_device_ex(window, coop_level, &IID_IDirect3DHALDevice, NULL); } static IDirect3DViewport3 *create_viewport(IDirect3DDevice3 *device, UINT x, UINT y, UINT w, UINT h) @@ -1506,7 +1513,7 @@ static void test_depth_blit(const GUID *device_guid) D3DRECT d3drect; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2101,7 +2108,7 @@ static void test_zenable(const GUID *device_guid) HRESULT hr; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2213,7 +2220,7 @@ static void test_ck_rgba(const GUID *device_guid) HRESULT hr; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -18750,7 +18757,7 @@ static void test_texture_wrong_caps(const GUID *device_guid) HRESULT hr; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -19506,6 +19513,82 @@ static void test_enum_devices(void) ok(!refcount, "Device has %lu references left.\n", refcount); } +static void test_multiple_devices(void) +{ + D3DMATERIALHANDLE mat_handle, mat_handle2; + IDirect3DViewport3 *viewport, *viewport2; + IDirect3DDevice3 *device, *device2; + IDirect3DMaterial3 *material; + IDirectDrawSurface4 *surface; + IDirectDraw4 *ddraw; + IDirect3D3 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + if (!(device = create_device_ex(window, DDSCL_NORMAL, &IID_IDirect3DHALDevice, &surface))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice3_GetDirect3D(device, &d3d); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DDevice3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device2, NULL); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + viewport = create_viewport(device, 0, 0, 640, 480); + viewport2 = create_viewport(device2, 0, 0, 640, 480); + hr = IDirect3DDevice3_SetCurrentViewport(device, viewport); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DDevice3_SetCurrentViewport(device2, viewport); + ok(hr == DDERR_INVALIDPARAMS, "got %#lx.\n", hr); + hr = IDirect3DDevice3_SetCurrentViewport(device2, viewport2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + material = create_diffuse_material(device, 1.0f, 0.0f, 0.0f, 1.0f); + hr = IDirect3DMaterial3_GetHandle(material, device, &mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DMaterial3_GetHandle(material, device, &mat_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + ok(mat_handle == mat_handle2, "got different handles.\n"); + + hr = IDirect3DMaterial3_GetHandle(material, device2, &mat_handle2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + todo_wine ok(mat_handle != mat_handle2, "got same handles.\n"); + + hr = IDirect3DDevice3_SetLightState(device, D3DLIGHTSTATE_MATERIAL, mat_handle); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice3_SetLightState(device2, D3DLIGHTSTATE_MATERIAL, mat_handle); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirect3DDevice3_SetLightState(device, D3DLIGHTSTATE_MATERIAL, mat_handle2); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + + hr = IDirect3DViewport3_SetBackground(viewport, mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DViewport3_SetBackground(viewport2, mat_handle); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + IDirect3DMaterial3_Release(material); + IDirect3DViewport3_Release(viewport); + IDirect3DViewport3_Release(viewport2); + + refcount = IDirect3DDevice3_Release(device); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirect3DDevice3_Release(device2); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirectDrawSurface4_Release(surface); + ok(!refcount, "Surface has %lu references left.\n", refcount); + IDirectDraw4_Release(ddraw); + IDirect3D3_Release(d3d); + DestroyWindow(window); +} + START_TEST(ddraw4) { DDDEVICEIDENTIFIER identifier; @@ -19647,4 +19730,5 @@ START_TEST(ddraw4) run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); test_enum_devices(); + test_multiple_devices(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 2771a4ed368..2ec1ab611e4 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -498,7 +498,8 @@ static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 return DDENUMRET_OK; } -static IDirect3DDevice7 *create_device_ex(HWND window, DWORD coop_level, const GUID *device_guid) +static IDirect3DDevice7 *create_device_ex(HWND window, DWORD coop_level, const GUID *device_guid, + IDirectDrawSurface7 **ret_surface) { IDirectDrawSurface7 *surface, *ds; IDirect3DDevice7 *device = NULL; @@ -586,9 +587,16 @@ static IDirect3DDevice7 *create_device_ex(HWND window, DWORD coop_level, const G hr = IDirect3D7_CreateDevice(d3d7, device_guid, surface, &device); IDirect3D7_Release(d3d7); - IDirectDrawSurface7_Release(surface); if (FAILED(hr)) + { + IDirectDrawSurface7_Release(surface); return NULL; + } + + if (ret_surface) + *ret_surface = surface; + else + IDirectDrawSurface7_Release(surface); return device; } @@ -615,7 +623,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) IDirect3D7_Release(d3d7); - return create_device_ex(window, coop_level, device_guid); + return create_device_ex(window, coop_level, device_guid, NULL); } static bool init_3d_test_context_guid(struct ddraw_test_context *context, const GUID *device_guid) @@ -625,7 +633,7 @@ static bool init_3d_test_context_guid(struct ddraw_test_context *context, const memset(context, 0, sizeof(*context)); context->window = create_window(); - if (!(context->device = create_device_ex(context->window, DDSCL_NORMAL, device_guid))) + if (!(context->device = create_device_ex(context->window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a D3D device.\n"); DestroyWindow(context->window); @@ -1586,7 +1594,7 @@ static void test_depth_blit(const GUID *device_guid) HWND window; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1844,7 +1852,7 @@ static void test_zenable(const GUID *device_guid) HRESULT hr; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1948,7 +1956,7 @@ static void test_ck_rgba(const GUID *device_guid) HRESULT hr; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -19134,7 +19142,7 @@ static void test_texture_wrong_caps(const GUID *device_guid) HRESULT hr; window = create_window(); - if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid))) + if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid, NULL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -20001,6 +20009,43 @@ static void run_for_each_device_type(void (*test_func)(const GUID *)) winetest_pop_context(); } +static void test_multiple_devices(void) +{ + IDirect3DDevice7 *device, *device2; + IDirectDrawSurface7 *surface; + IDirectDraw7 *ddraw; + IDirect3D7 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + if (!(device = create_device_ex(window, DDSCL_NORMAL, &IID_IDirect3DTnLHalDevice, &surface))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice7_GetDirect3D(device, &d3d); + ok(hr == D3D_OK, "got %#lx.\n", hr); + hr = IDirect3DDevice7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + hr = IDirect3D7_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device2); + ok(hr == D3D_OK, "got %#lx.\n", hr); + + refcount = IDirect3DDevice3_Release(device); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirect3DDevice3_Release(device2); + ok(!refcount, "Device has %lu references left.\n", refcount); + refcount = IDirectDrawSurface4_Release(surface); + ok(!refcount, "Surface has %lu references left.\n", refcount); + IDirectDraw4_Release(ddraw); + IDirect3D3_Release(d3d); + DestroyWindow(window); +} + START_TEST(ddraw7) { DDDEVICEIDENTIFIER2 identifier; @@ -20176,4 +20221,5 @@ START_TEST(ddraw7) test_enum_devices(); run_for_each_device_type(test_user_memory); test_flip_3d(); + test_multiple_devices(); } From 80e81815f5fadbdb31ec7bea79411452e9aa1273 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 18 Mar 2024 13:08:40 +0200 Subject: [PATCH 1387/1506] Revert "HACK: winex11: Add option to WINE_HIDE_NVK." This reverts commit caa6104097b8b14001acd7ee787c8d814a9304d9. --- dlls/winex11.drv/display.c | 9 ++------- dlls/winex11.drv/xrandr.c | 5 ----- include/wine/gdi_driver.h | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 22e9d79b64d..d2c353250b9 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -530,7 +530,7 @@ static const char *debugstr_devmodew( const DEVMODEW *devmode ) position ); } -static void fixup_device_id(UINT *vendor_id, UINT *device_id, BOOL is_nvk) +static void fixup_device_id(UINT *vendor_id, UINT *device_id) { const char *sgi; @@ -548,11 +548,6 @@ static void fixup_device_id(UINT *vendor_id, UINT *device_id, BOOL is_nvk) { *device_id = 0x687f; /* Radeon RX Vega 56/64 */ } - else if (is_nvk && (sgi = getenv("WINE_HIDE_NVK")) && *sgi != '0') - { - *vendor_id = 0x1002; /* AMD */ - *device_id = 0x73df; /* RX 6700XT */ - } } BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) @@ -576,7 +571,7 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage for (gpu = 0; gpu < gpu_count; gpu++) { - fixup_device_id( &gpus[gpu].vendor_id, &gpus[gpu].device_id, gpus[gpu].is_nvk ); + fixup_device_id( &gpus[gpu].vendor_id, &gpus[gpu].device_id ); device_manager->add_gpu( &gpus[gpu], param ); diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 6011a198810..47accf1de6d 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -856,7 +856,6 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid VkPhysicalDeviceMemoryProperties mem_properties; VkInstanceCreateInfo create_info; VkPhysicalDeviceIDProperties id; - VkPhysicalDeviceVulkan12Properties vk12; VkInstance vk_instance = NULL; VkDisplayKHR vk_display; DWORD len; @@ -921,11 +920,8 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid if (X11DRV_check_error() || vr != VK_SUCCESS || vk_display == VK_NULL_HANDLE) continue; - memset( &vk12, 0, sizeof(vk12) ); - vk12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES; memset( &id, 0, sizeof(id) ); id.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; - id.pNext = &vk12; properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; properties2.pNext = &id; @@ -948,7 +944,6 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid { gpu->vendor_id = properties2.properties.vendorID; gpu->device_id = properties2.properties.deviceID; - if (vk12.driverID == VK_DRIVER_ID_MESA_NVK) gpu->is_nvk = TRUE; } RtlUTF8ToUnicodeN( gpu->name, sizeof(gpu->name), &len, properties2.properties.deviceName, strlen( properties2.properties.deviceName ) + 1 ); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 2b1dc3ca044..26562bfef2b 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -252,7 +252,6 @@ struct gdi_gpu UINT revision_id; GUID vulkan_uuid; /* Vulkan device UUID */ ULONGLONG memory_size; - BOOL is_nvk; }; struct gdi_adapter From bb0a3a750d007077eb787d1637c00ee0ad1c46c6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 18 Mar 2024 13:08:45 +0200 Subject: [PATCH 1388/1506] Revert "HACK: winevulkan: Add option to WINE_HIDE_NVK." This reverts commit febbad5b6d551348e0981042cf69dd6e0b9cca9b. --- dlls/winevulkan/loader.c | 19 ++++--------------- dlls/winevulkan/make_vulkan | 3 --- dlls/winevulkan/vulkan.c | 32 +++----------------------------- dlls/winevulkan/vulkan_loader.h | 5 ----- dlls/winevulkan/vulkan_private.h | 5 ----- 5 files changed, 7 insertions(+), 57 deletions(-) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index 84e9239a399..3f6204139fb 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -84,12 +84,6 @@ static BOOL is_available_device_function(VkDevice device, const char *name) return UNIX_CALL(is_available_device_function, ¶ms); } -static BOOL is_nvk(VkPhysicalDevice device) -{ - struct is_nvk_params params = { .device = device }; - return UNIX_CALL(is_nvk, ¶ms); -} - static void *alloc_vk_object(size_t size) { struct wine_vk_base *object = calloc(1, size); @@ -422,7 +416,7 @@ static void fill_luid_property(VkPhysicalDeviceProperties2 *properties2) device_node_mask); } -static void fixup_device_id(UINT *vendor_id, UINT *device_id, BOOL is_nvk) +static void fixup_device_id(UINT *vendor_id, UINT *device_id) { const char *sgi; @@ -440,11 +434,6 @@ static void fixup_device_id(UINT *vendor_id, UINT *device_id, BOOL is_nvk) { *device_id = 0x687f; /* Radeon RX Vega 56/64 */ } - else if (is_nvk && (sgi = getenv("WINE_HIDE_NVK")) && *sgi != '0') - { - *vendor_id = 0x1002; /* AMD */ - *device_id = 0x73df; /* RX 6700XT */ - } } void WINAPI vkGetPhysicalDeviceProperties(VkPhysicalDevice physical_device, @@ -459,7 +448,7 @@ void WINAPI vkGetPhysicalDeviceProperties(VkPhysicalDevice physical_device, params.pProperties = properties; status = UNIX_CALL(vkGetPhysicalDeviceProperties, ¶ms); assert(!status); - fixup_device_id(&properties->vendorID, &properties->deviceID, is_nvk(physical_device)); + fixup_device_id(&properties->vendorID, &properties->deviceID); } void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, @@ -475,7 +464,7 @@ void WINAPI vkGetPhysicalDeviceProperties2(VkPhysicalDevice phys_dev, status = UNIX_CALL(vkGetPhysicalDeviceProperties2, ¶ms); assert(!status); fill_luid_property(properties2); - fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID, is_nvk(phys_dev)); + fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID); } void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, @@ -491,7 +480,7 @@ void WINAPI vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice phys_dev, status = UNIX_CALL(vkGetPhysicalDeviceProperties2KHR, ¶ms); assert(!status); fill_luid_property(properties2); - fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID, is_nvk(phys_dev)); + fixup_device_id(&properties2->properties.vendorID, &properties2->properties.deviceID); } VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 362f0321276..467eee61c2a 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2925,7 +2925,6 @@ class VkGenerator(object): f.write(" init_vulkan,\n") f.write(" vk_is_available_instance_function,\n") f.write(" vk_is_available_device_function,\n") - f.write(" vk_is_nvk,\n") for vk_func in self.registry.funcs.values(): if not vk_func.needs_exposing(): continue @@ -2950,7 +2949,6 @@ class VkGenerator(object): f.write(" init_vulkan,\n") f.write(" vk_is_available_instance_function32,\n") f.write(" vk_is_available_device_function32,\n") - f.write(" vk_is_nvk32,\n") for vk_func in self.registry.funcs.values(): if not vk_func.needs_exposing(): continue @@ -3135,7 +3133,6 @@ class VkGenerator(object): f.write(" unix_init,\n") f.write(" unix_is_available_instance_function,\n") f.write(" unix_is_available_device_function,\n") - f.write(" unix_is_nvk,\n") for vk_func in self.registry.funcs.values(): if not vk_func.needs_exposing(): continue diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 253e3db68f5..885af7ae970 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -278,8 +278,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance struct wine_phys_dev *object; uint32_t num_host_properties, num_properties = 0; VkExtensionProperties *host_properties = NULL; - VkPhysicalDeviceProperties2 physdev_properties; - VkPhysicalDeviceVulkan12Properties vk12; + VkPhysicalDeviceProperties physdev_properties; BOOL have_external_memory_host = FALSE, have_external_memory_fd = FALSE, have_external_semaphore_fd = FALSE; VkResult res; unsigned int i, j; @@ -291,16 +290,8 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance object->handle = handle; object->host_physical_device = phys_dev; - memset(&vk12, 0, sizeof(vk12)); - vk12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES; - - memset(&physdev_properties, 0, sizeof(physdev_properties)); - physdev_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; - physdev_properties.pNext = &vk12; - - instance->funcs.p_vkGetPhysicalDeviceProperties2(phys_dev, &physdev_properties); - object->api_version = physdev_properties.properties.apiVersion; - object->is_nvk = (vk12.driverID == VK_DRIVER_ID_MESA_NVK); + instance->funcs.p_vkGetPhysicalDeviceProperties(phys_dev, &physdev_properties); + object->api_version = physdev_properties.apiVersion; handle->base.unix_handle = (uintptr_t)object; WINE_VK_ADD_DISPATCHABLE_MAPPING(instance, handle, phys_dev, object); @@ -4068,13 +4059,6 @@ NTSTATUS vk_is_available_device_function(void *arg) return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, params->name); } -NTSTATUS vk_is_nvk(void *arg) -{ - struct is_nvk_params *params = arg; - struct wine_phys_dev *device = wine_phys_dev_from_handle(params->device); - return !!device->is_nvk; -} - #endif /* _WIN64 */ NTSTATUS vk_is_available_instance_function32(void *arg) @@ -4103,16 +4087,6 @@ NTSTATUS vk_is_available_device_function32(void *arg) return !!vk_funcs->p_vkGetDeviceProcAddr(device->host_device, name); } -NTSTATUS vk_is_nvk32(void *arg) -{ - struct - { - UINT32 device; - } *params = arg; - struct wine_phys_dev *device = wine_phys_dev_from_handle(UlongToPtr(params->device)); - return !!device->is_nvk; -} - DECLSPEC_EXPORT VkDevice __wine_get_native_VkDevice(VkDevice handle) { struct wine_device *device = wine_device_from_handle(handle); diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h index d29ccd8ae08..70efc2bfa73 100644 --- a/dlls/winevulkan/vulkan_loader.h +++ b/dlls/winevulkan/vulkan_loader.h @@ -147,11 +147,6 @@ struct is_available_device_function_params const char *name; }; -struct is_nvk_params -{ - VkPhysicalDevice device; -}; - #define wine_vk_find_struct(s, t) wine_vk_find_struct_((void *)s, VK_STRUCTURE_TYPE_##t) static inline void *wine_vk_find_struct_(void *s, VkStructureType t) { diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 3a044f08dcc..ffae94adbe4 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -211,8 +211,6 @@ struct wine_phys_dev uint32_t external_memory_align; - bool is_nvk; - struct wine_vk_mapping mapping; }; @@ -353,9 +351,6 @@ NTSTATUS vk_is_available_device_function(void *arg); NTSTATUS vk_is_available_instance_function32(void *arg); NTSTATUS vk_is_available_device_function32(void *arg); -NTSTATUS vk_is_nvk(void *arg); -NTSTATUS vk_is_nvk32(void *arg); - struct conversion_context { char buffer[2048]; From 770284796b29305734bbc7f1649499385efc51fa Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 20:33:52 -0600 Subject: [PATCH 1389/1506] winex11.drv: HACK: Don't clip child windows for C&C Red Alert 2. CW-Bug-Id: #23585 --- dlls/winex11.drv/opengl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 23b22ccac25..04bf487cb6b 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1480,8 +1480,18 @@ static enum dc_gl_layered_type get_gl_layered_type( HWND hwnd ) static BOOL drawable_needs_clipping( HWND hwnd, BOOL known_child ) { - if (known_child) return TRUE; - return NtUserGetWindowRelative( hwnd, GW_CHILD ) || NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow(); + static int no_child_clipping_cached = -1; + + if (no_child_clipping_cached == -1) + { + const char *sgi = getenv( "SteamGameId" ); + + no_child_clipping_cached = sgi && !strcmp( sgi, "2229850" ); + if (no_child_clipping_cached) FIXME( "HACK: disabling child GL window clipping.\n" ); + } + + if (known_child && !no_child_clipping_cached) return TRUE; + return (!no_child_clipping_cached && NtUserGetWindowRelative( hwnd, GW_CHILD )) || NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow(); } /*********************************************************************** From 226fd24f268adf78017ca8c24bbf5804d86a0b3d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 20:38:13 -0600 Subject: [PATCH 1390/1506] winex11.drv: HACK: Don't clip child windows for C&C Tiberian Sun. CW-Bug-Id: #23586 --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 04bf487cb6b..23eb26420fa 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1486,7 +1486,7 @@ static BOOL drawable_needs_clipping( HWND hwnd, BOOL known_child ) { const char *sgi = getenv( "SteamGameId" ); - no_child_clipping_cached = sgi && !strcmp( sgi, "2229850" ); + no_child_clipping_cached = sgi && (!strcmp( sgi, "2229850" ) || !strcmp( sgi, "2229880" )); if (no_child_clipping_cached) FIXME( "HACK: disabling child GL window clipping.\n" ); } From 5f248f71e82a12ca1ea0d4e8987f32cc4f4117a1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 19 Mar 2024 15:04:35 -0600 Subject: [PATCH 1391/1506] fixup! HACK: winex11, winevulkan: Support faking GPU PCI IDs. CW-Bug-Id: #23596 --- dlls/winevulkan/loader.c | 2 +- dlls/winex11.drv/display.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index 3f6204139fb..dbb44c556f6 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -430,7 +430,7 @@ static void fixup_device_id(UINT *vendor_id, UINT *device_id) *vendor_id = 0x10de; /* NVIDIA */ *device_id = 0x2487; /* RTX 3060 */ } - else if (*vendor_id == 0x1002 && *device_id == 0x163f && (sgi = getenv("WINE_HIDE_VANGOGH_GPU")) && *sgi != '0') + else if (*vendor_id == 0x1002 && (*device_id == 0x163f || *device_id == 0x1435) && (sgi = getenv("WINE_HIDE_VANGOGH_GPU")) && *sgi != '0') { *device_id = 0x687f; /* Radeon RX Vega 56/64 */ } diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index d2c353250b9..a0cd93bac0f 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -544,7 +544,7 @@ static void fixup_device_id(UINT *vendor_id, UINT *device_id) *vendor_id = 0x10de; /* NVIDIA */ *device_id = 0x2487; /* RTX 3060 */ } - else if (*vendor_id == 0x1002 && *device_id == 0x163f && (sgi = getenv("WINE_HIDE_VANGOGH_GPU")) && *sgi != '0') + else if (*vendor_id == 0x1002 && (*device_id == 0x163f || *device_id == 0x1435) && (sgi = getenv("WINE_HIDE_VANGOGH_GPU")) && *sgi != '0') { *device_id = 0x687f; /* Radeon RX Vega 56/64 */ } From 1b960417ebd65867877e0b87aea11f47d1f7efe3 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Wed, 28 Feb 2024 16:40:50 +0000 Subject: [PATCH 1392/1506] gdiplus: Fix crash in GdipAddPathString. Apparently, 1454ffe7ddf01226aacec07836d4afa62fecd3fa introduced the assumption that the font passed to gdip_format_string is non-NULL, and GdipAddPathString wasn't passing it in. (cherry picked from commit 1ee1f2e9d78fb3c8da21618c8fef1b4129f200f3) --- dlls/gdiplus/graphicspath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 4b272f539c4..61a6182613d 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1093,7 +1093,6 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT } get_log_fontW(font, graphics, &lfw); - GdipDeleteFont(font); GdipDeleteGraphics(graphics); hfont = CreateFontIndirectW(&lfw); @@ -1102,6 +1101,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT WARN("Failed to create font\n"); DeleteDC(dc); GdipDeletePath(backup); + GdipDeleteFont(font); return GenericError; } @@ -1113,11 +1113,12 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT args.maxY = 0; args.scale = emSize / native_height; args.ascent = textmetric.tmAscent * args.scale; - status = gdip_format_string(graphics, dc, string, length, NULL, &scaled_layout_rect, + status = gdip_format_string(graphics, dc, string, length, font, &scaled_layout_rect, format, TRUE, format_string_callback, &args); DeleteDC(dc); DeleteObject(hfont); + GdipDeleteFont(font); if (status != Ok) /* free backup */ { From be0d9ed9fb8a9102d703d4f3ace21863870f3adc Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 1 Mar 2024 18:54:33 +0000 Subject: [PATCH 1393/1506] gdiplus: Fix use after free in GdipAddPathString. (cherry picked from commit 3ca8204837ffa56064c61981fcb5128981f17196) --- dlls/gdiplus/graphicspath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 61a6182613d..430097d8ee5 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1093,7 +1093,6 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT } get_log_fontW(font, graphics, &lfw); - GdipDeleteGraphics(graphics); hfont = CreateFontIndirectW(&lfw); if (!hfont) @@ -1119,6 +1118,7 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT DeleteDC(dc); DeleteObject(hfont); GdipDeleteFont(font); + GdipDeleteGraphics(graphics); if (status != Ok) /* free backup */ { From 1accbc7e9e8d9afd5935e24e0e40e75c7bf4cd3d Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 1 Mar 2024 19:27:30 +0000 Subject: [PATCH 1394/1506] gdiplus: Implement font linking in GdipAddPathString. (cherry picked from commit 55f71fd846423338e2029cdce3714903e601bb8e) --- dlls/gdiplus/gdiplus_private.h | 4 ++++ dlls/gdiplus/graphics.c | 2 +- dlls/gdiplus/graphicspath.c | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 1ae03d7126e..0b302a405ea 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -127,6 +127,10 @@ extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj, REAL tension, REAL *x, REAL *y); +extern void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, + GDIPCONST GpStringFormat *format, HFONT *hfont, + LOGFONTW *lfw_return, GDIPCONST GpMatrix *matrix); + extern void free_installed_fonts(void); extern BOOL lengthen_path(GpPath *path, INT len); diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 2389cbf4f68..ce852e7c940 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2296,7 +2296,7 @@ void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf) lstrcpyW(lf->lfFaceName, font->family->FamilyName); } -static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, +void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, HFONT *hfont, LOGFONTW *lfw_return, GDIPCONST GpMatrix *matrix) { diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 430097d8ee5..38a195a1371 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -953,6 +953,9 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) { static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; struct format_string_args *args = info->user_data; + struct gdip_font_link_section *section = LIST_ENTRY(list_head(&info->font_link_info.sections), struct gdip_font_link_section, entry); + HFONT hfont = NULL, oldhfont = NULL; + int section_start = -1; GpPath *path = args->path; GpStatus status = Ok; float x = info->rect->X + (info->bounds->X - info->rect->X) * args->scale; @@ -971,6 +974,22 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) TTPOLYGONHEADER *ph = NULL, *origph; char *start; DWORD len, ofs = 0; + + while (i >= section->end) + section = LIST_ENTRY(list_next(&info->font_link_info.sections, §ion->entry), struct gdip_font_link_section, entry); + + if (section_start != section->start) + { + if (hfont) + { + SelectObject(info->hdc, oldhfont); + DeleteObject(hfont); + } + get_font_hfont(info->graphics, section->font, NULL, &hfont, NULL, NULL); + oldhfont = SelectObject(info->hdc, hfont); + section_start = section->start; + } + len = GetGlyphOutlineW(info->hdc, info->string[i], GGO_BEZIER, &gm, 0, NULL, &identity); if (len == GDI_ERROR) { @@ -1037,6 +1056,12 @@ static GpStatus format_string_callback(struct gdip_format_string_info* info) break; } + if (hfont) + { + SelectObject(info->hdc, oldhfont); + DeleteObject(hfont); + } + return status; } From e37b5447fed96b93f9d710333fdd2f9fc6863b4e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 21 Mar 2024 17:45:47 -0600 Subject: [PATCH 1395/1506] ddraw: Don't demand WINED3D_BIND_SHADER_RESOURCE for making surface in vidmem. CW-Bug-Id: #23605 --- dlls/ddraw/surface.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 37563c56c3c..20f79c9453d 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6813,11 +6813,19 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ { if (!(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))) { - unsigned int bind_flags = WINED3D_BIND_SHADER_RESOURCE; + unsigned int bind_flags = 0; DWORD usage = 0; if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) + { usage |= WINED3DUSAGE_LEGACY_CUBEMAP; + bind_flags |= WINED3D_BIND_SHADER_RESOURCE; + } + else if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE) + { + bind_flags |= WINED3D_BIND_SHADER_RESOURCE; + } + if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) bind_flags |= WINED3D_BIND_DEPTH_STENCIL; else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) From 3720269799f1e74711e5eb95e03d685d174cdd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 22 Mar 2024 18:56:05 +0100 Subject: [PATCH 1396/1506] HACK: winex11: Disable pointer grab wait with gamescope. CW-Bug-Id: #23595 --- dlls/winex11.drv/event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index ab151e28350..48903cd5623 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -263,6 +263,9 @@ static void wait_grab_pointer( Display *display ) { RECT rect; + /* unnecessary on gamescope, windows cannot be moved with the mouse */ + if (wm_is_steamcompmgr( display )) return; + /* release cursor grab held by any Wine process */ NtUserGetClipCursor( &rect ); NtUserClipCursor( NULL ); From 6c5bf956ab2350a32051e7b63e1a0aff081e6c1b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 22 Mar 2024 21:07:20 -0600 Subject: [PATCH 1397/1506] win32u: Avoid writing past allocated memory in peek_message(). CW-Bug-Id: #23606 --- dlls/win32u/message.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 7bb3c393483..b9fb0c52e95 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -522,7 +522,7 @@ BOOL set_keyboard_auto_repeat( BOOL enable ) * Unpack a message received from another process. */ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, - void **buffer, size_t size ) + void **buffer, size_t size, size_t buffer_size ) { size_t minsize = 0; union packed_structs *ps = *buffer; @@ -585,7 +585,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa break; case WM_GETTEXT: case WM_ASKCBFORMATNAME: - if (!get_buffer_space( buffer, (*wparam * sizeof(WCHAR)), size )) return FALSE; + if (!get_buffer_space( buffer, (*wparam * sizeof(WCHAR)), buffer_size )) return FALSE; break; case WM_WININICHANGE: if (!*lparam) return TRUE; @@ -726,17 +726,17 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa minsize = sizeof(SCROLLINFO); break; case SBM_GETSCROLLINFO: - if (!get_buffer_space( buffer, sizeof(SCROLLINFO), size )) return FALSE; + if (!get_buffer_space( buffer, sizeof(SCROLLINFO), buffer_size )) return FALSE; break; case SBM_GETSCROLLBARINFO: - if (!get_buffer_space( buffer, sizeof(SCROLLBARINFO), size )) return FALSE; + if (!get_buffer_space( buffer, sizeof(SCROLLBARINFO), buffer_size )) return FALSE; break; case EM_GETSEL: case SBM_GETRANGE: case CB_GETEDITSEL: if (*wparam || *lparam) { - if (!get_buffer_space( buffer, 2 * sizeof(DWORD), size )) return FALSE; + if (!get_buffer_space( buffer, 2 * sizeof(DWORD), buffer_size )) return FALSE; if (*wparam) *wparam = (WPARAM)*buffer; if (*lparam) *lparam = (LPARAM)((DWORD *)*buffer + 1); } @@ -744,7 +744,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa case EM_GETRECT: case LB_GETITEMRECT: case CB_GETDROPPEDCONTROLRECT: - if (!get_buffer_space( buffer, sizeof(RECT), size )) return FALSE; + if (!get_buffer_space( buffer, sizeof(RECT), buffer_size )) return FALSE; break; case EM_SETRECT: case EM_SETRECTNP: @@ -755,7 +755,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa WORD *len_ptr, len; if (size < sizeof(WORD)) return FALSE; len = *(WORD *)*buffer; - if (!get_buffer_space( buffer, (len + 1) * sizeof(WCHAR), size )) return FALSE; + if (!get_buffer_space( buffer, (len + 1) * sizeof(WCHAR), buffer_size )) return FALSE; len_ptr = *buffer; len_ptr[0] = len_ptr[1] = len; *lparam = (LPARAM)(len_ptr + 1); @@ -780,26 +780,24 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa break; case CB_GETLBTEXT: { - size_t prev_size = size; if (combobox_has_strings( hwnd )) size = (send_message( hwnd, CB_GETLBTEXTLEN, *wparam, 0 ) + 1) * sizeof(WCHAR); else size = sizeof(ULONG_PTR); - if (!get_buffer_space( buffer, size, prev_size )) return FALSE; + if (!get_buffer_space( buffer, size, buffer_size )) return FALSE; break; } case LB_GETTEXT: { - size_t prev_size = size; if (listbox_has_strings( hwnd )) size = (send_message( hwnd, LB_GETTEXTLEN, *wparam, 0 ) + 1) * sizeof(WCHAR); else size = sizeof(ULONG_PTR); - if (!get_buffer_space( buffer, size, prev_size )) return FALSE; + if (!get_buffer_space( buffer, size, buffer_size )) return FALSE; break; } case LB_GETSELITEMS: - if (!get_buffer_space( buffer, *wparam * sizeof(UINT), size )) return FALSE; + if (!get_buffer_space( buffer, *wparam * sizeof(UINT), buffer_size )) return FALSE; break; case WM_NEXTMENU: { @@ -814,7 +812,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa case WM_SIZING: case WM_MOVING: minsize = sizeof(RECT); - if (!get_buffer_space( buffer, sizeof(RECT), size )) return FALSE; + if (!get_buffer_space( buffer, sizeof(RECT), buffer_size )) return FALSE; break; case WM_MDICREATE: { @@ -880,7 +878,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa } case WM_MDIGETACTIVE: if (!*lparam) return TRUE; - if (!get_buffer_space( buffer, sizeof(BOOL), size )) return FALSE; + if (!get_buffer_space( buffer, sizeof(BOOL), buffer_size )) return FALSE; break; case WM_DEVICECHANGE: if (!(*wparam & 0x8000)) return TRUE; @@ -2899,7 +2897,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, memcpy( buffer, buffer_init, buffer_size ); } if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, - &info.msg.lParam, &buffer, size )) + &info.msg.lParam, &buffer, size, buffer_size )) continue; break; case MSG_CALLBACK: @@ -2983,7 +2981,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, memcpy( buffer, buffer_init, buffer_size ); } if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, - &info.msg.lParam, &buffer, size )) + &info.msg.lParam, &buffer, size, buffer_size )) { /* ignore it */ reply_message( &info, 0, &info.msg ); From 5c21e1acb6c506f06b8edd105018dba59c92f909 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 22 Mar 2024 21:46:45 -0600 Subject: [PATCH 1398/1506] win32u: Avoid leaking previous buffer in get_buffer_space(). CW-Bug-Id: #23606 --- dlls/win32u/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index b9fb0c52e95..7308a4d8196 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -471,7 +471,7 @@ static inline void push_string( struct packed_message *data, LPCWSTR str ) /* make sure that there is space for 'size' bytes in buffer, growing it if needed */ static inline void *get_buffer_space( void **buffer, size_t size, size_t prev_size ) { - if (prev_size < size) *buffer = malloc( size ); + if (prev_size < size) *buffer = realloc( *buffer, size ); return *buffer; } From cebce6db231eebc61643dc60cb0a8a4bf65c7450 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 13:22:12 -0600 Subject: [PATCH 1399/1506] kernelbase: HACK: Force CEF swiftshader for Aisling and the Tavern of Elves/nw.exe. CW-Bug-Id: #23612 --- dlls/bcrypt/gnutls.c | 1 + dlls/kernelbase/process.c | 1 + 2 files changed, 2 insertions(+) diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 115219a64f6..cd0caa287a5 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -2774,6 +2774,7 @@ static NTSTATUS key_asymmetric_decrypt( void *args ) #if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) const char * gcrypt_hash_algorithm_name(LPCWSTR alg_id) { + ERR("qqqqq alg_id %s.\n", debugstr_w(alg_id)); if (!wcscmp( alg_id, BCRYPT_SHA1_ALGORITHM )) return "sha1"; if (!wcscmp( alg_id, BCRYPT_SHA256_ALGORITHM )) return "sha256"; if (!wcscmp( alg_id, BCRYPT_SHA384_ALGORITHM )) return "sha384"; diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 7ea75b58a9b..a0ab56ba533 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -597,6 +597,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"UplayWebCore.exe", L" --use-angle=vulkan"}, {L"Paradox Launcher.exe", L" --use-angle=gl"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, + {L"Aisling and the Tavern of Elves\\nw.exe", L" --use-gl=swiftshader"}, {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"\\EpicOnlineServicesUIHelper", L" --use-angle=vulkan"}, {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, From c8e2f13da6213ae903a8a40c26bc4f8fc86f216b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 13:36:21 -0600 Subject: [PATCH 1400/1506] kernelbase: HACK: Force CEF swiftshader for Snares of Ruin 2. --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index a0ab56ba533..838d139210b 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -598,6 +598,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) {L"Paradox Launcher.exe", L" --use-angle=gl"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, {L"Aisling and the Tavern of Elves\\nw.exe", L" --use-gl=swiftshader"}, + {L"Snares of Ruin 2\\SoR2.exe", L" --use-gl=swiftshader"}, {L"\\EOSOverlayRenderer-Win64-Shipping.exe", L" --use-gl=swiftshader --in-process-gpu"}, {L"\\EpicOnlineServicesUIHelper", L" --use-angle=vulkan"}, {L"OlympiaRising.exe", L" --use-gl=swiftshader"}, From e105593252d3783bbdc187335440e08a67e09052 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 13:43:29 -0600 Subject: [PATCH 1401/1506] amend! kernelbase: HACK: Force CEF swiftshader for Snares of Ruin 2. kernelbase: HACK: Force CEF swiftshader for Snares of Ruin 2. CW-Bug-Id: #23613 From 7da85962247fab696507c3ff190d16b90a73a61e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 14:33:48 -0600 Subject: [PATCH 1402/1506] fixup! kernelbase: HACK: Force CEF swiftshader for Aisling and the Tavern of Elves/nw.exe. CW-Bug-Id: #23613 --- dlls/bcrypt/gnutls.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index cd0caa287a5..115219a64f6 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -2774,7 +2774,6 @@ static NTSTATUS key_asymmetric_decrypt( void *args ) #if defined(HAVE_GCRYPT_H) && defined(SONAME_LIBGCRYPT) const char * gcrypt_hash_algorithm_name(LPCWSTR alg_id) { - ERR("qqqqq alg_id %s.\n", debugstr_w(alg_id)); if (!wcscmp( alg_id, BCRYPT_SHA1_ALGORITHM )) return "sha1"; if (!wcscmp( alg_id, BCRYPT_SHA256_ALGORITHM )) return "sha256"; if (!wcscmp( alg_id, BCRYPT_SHA384_ALGORITHM )) return "sha384"; From 027486bd1fae4cea0f8e005cd022f544b1c9a799 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 16:24:01 -0600 Subject: [PATCH 1403/1506] wintypes: Report some API contracts as present in api_information_statics_IsApiContractPresentByMajor(). CW-Bug-Id: #23614 --- dlls/wintypes/main.c | 25 +++++++++++++++++++++++-- dlls/wintypes/tests/wintypes.c | 26 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index d5bfb5ad11c..7d59ab92c41 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -34,6 +34,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintypes); +static const struct +{ + const WCHAR *name; + unsigned int max_major; +} +present_contracts[] = +{ + { L"Windows.Foundation.UniversalApiContract", 10, }, +}; + +static BOOLEAN is_api_contract_present( const HSTRING hname, unsigned int version ) +{ + const WCHAR *name = WindowsGetStringRawBuffer( hname, NULL ); + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(present_contracts); ++i) + if (!wcsicmp( name, present_contracts[i].name )) return version <= present_contracts[i].max_major; + + return FALSE; +} + struct wintypes { IActivationFactory IActivationFactory_iface; @@ -280,13 +301,13 @@ static HRESULT STDMETHODCALLTYPE api_information_statics_IsEnumNamedValuePresent static HRESULT STDMETHODCALLTYPE api_information_statics_IsApiContractPresentByMajor( IApiInformationStatics *iface, HSTRING contract_name, UINT16 major_version, BOOLEAN *value) { - FIXME("iface %p, contract_name %s, major_version %u, value %p stub!\n", iface, + FIXME("iface %p, contract_name %s, major_version %u, value %p semi-stub.\n", iface, debugstr_hstring(contract_name), major_version, value); if (!contract_name) return E_INVALIDARG; - *value = FALSE; + *value = is_api_contract_present( contract_name, major_version ); return S_OK; } diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index dd6401c212b..0703582d325 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -33,12 +33,23 @@ static void test_IApiInformationStatics(void) { + static const struct + { + const WCHAR *name; + unsigned int max_major; + } + present_contracts[] = + { + { L"Windows.Foundation.UniversalApiContract", 10, }, + }; + static const WCHAR *class_name = L"Windows.Foundation.Metadata.ApiInformation"; IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IApiInformationStatics *statics = NULL; IActivationFactory *factory = NULL; HSTRING str, str2; + unsigned int i, j; BOOLEAN ret; HRESULT hr; @@ -424,6 +435,21 @@ static void test_IApiInformationStatics(void) WindowsDeleteString(str); + /* Test API contracts presence. */ + for (i = 0; i < ARRAY_SIZE(present_contracts); ++i) + { + hr = WindowsCreateString(present_contracts[i].name, wcslen(present_contracts[i].name), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + for (j = 0; j <= present_contracts[i].max_major; ++j) + { + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajor(statics, str, i, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajor failed, hr %#lx, i %u, major %u.\n", hr, i, j); + ok(ret == TRUE, "IsApiContractPresentByMajor returned FALSE, i %u, major %u.\n", i, j); + } + WindowsDeleteString(str); + } + IApiInformationStatics_Release(statics); IAgileObject_Release(agile_object); IInspectable_Release(inspectable); From 3c02a644fa723aa901fe2b29fd1ddf48243daee4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 16:02:02 -0600 Subject: [PATCH 1404/1506] windows.perception.stub: Add stub IHolographicSpaceInterop interface. CW-Bug-Id: #23614 --- .../holographicspace.c | 33 +++++++++++++++++++ dlls/windows.perception.stub/private.h | 1 + .../tests/perception.c | 2 ++ include/Makefile.in | 1 + include/holographicspaceinterop.idl | 27 +++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 include/holographicspaceinterop.idl diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c index 8a12147f4a8..53e6be0e712 100644 --- a/dlls/windows.perception.stub/holographicspace.c +++ b/dlls/windows.perception.stub/holographicspace.c @@ -27,6 +27,7 @@ struct holographicspace IActivationFactory IActivationFactory_iface; IHolographicSpaceStatics2 IHolographicSpaceStatics2_iface; IHolographicSpaceStatics3 IHolographicSpaceStatics3_iface; + IHolographicSpaceInterop IHolographicSpaceInterop_iface; LONG ref; }; @@ -65,6 +66,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; } + if (IsEqualGUID( iid, &IID_IHolographicSpaceInterop )) + { + *out = &impl->IHolographicSpaceInterop_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -193,11 +201,36 @@ static const struct IHolographicSpaceStatics3Vtbl holographicspace_statics3_vtbl holographicspace_statics3_get_IsConfigured, }; +DEFINE_IINSPECTABLE( holographicspace_interop, IHolographicSpaceInterop, struct holographicspace, IActivationFactory_iface ) + +static HRESULT WINAPI holographicspace_interop_CreateForWindow( IHolographicSpaceInterop *iface, + HWND window, REFIID iid, void **holographic_space ) +{ + FIXME( "iface %p, window %p, iid %s, holographic_space %p.\n", iface, window, debugstr_guid( iid ), holographic_space ); + + *holographic_space = NULL; + return E_NOTIMPL; +} + +static const struct IHolographicSpaceInteropVtbl holographicspace_interop_vtbl = +{ + holographicspace_interop_QueryInterface, + holographicspace_interop_AddRef, + holographicspace_interop_Release, + /* IInspectable methods */ + holographicspace_interop_GetIids, + holographicspace_interop_GetRuntimeClassName, + holographicspace_interop_GetTrustLevel, + /* IHolographicSpaceInterop methods */ + holographicspace_interop_CreateForWindow, +}; + static struct holographicspace holographicspace_statics = { {&factory_vtbl}, {&holographicspace_statics2_vtbl}, {&holographicspace_statics3_vtbl}, + {&holographicspace_interop_vtbl}, 1, }; diff --git a/dlls/windows.perception.stub/private.h b/dlls/windows.perception.stub/private.h index a6ae62916e1..ceaa2944174 100644 --- a/dlls/windows.perception.stub/private.h +++ b/dlls/windows.perception.stub/private.h @@ -36,6 +36,7 @@ #include "windows.perception.spatial.surfaces.h" #define WIDL_using_Windows_Graphics_Holographic #include "windows.graphics.holographic.h" +#include "holographicspaceinterop.h" extern IActivationFactory *observer_factory; extern IActivationFactory *holographicspace_factory; diff --git a/dlls/windows.perception.stub/tests/perception.c b/dlls/windows.perception.stub/tests/perception.c index d0bee4eb247..8714f44be4a 100644 --- a/dlls/windows.perception.stub/tests/perception.c +++ b/dlls/windows.perception.stub/tests/perception.c @@ -32,6 +32,7 @@ #include "windows.perception.spatial.surfaces.h" #define WIDL_using_Windows_Graphics_Holographic #include "windows.graphics.holographic.h" +#include "holographicspaceinterop.h" #include "wine/test.h" @@ -121,6 +122,7 @@ static void test_HolographicSpaceStatics(void) check_interface( factory, &IID_IUnknown ); check_interface( factory, &IID_IInspectable ); check_interface( factory, &IID_IAgileObject ); + check_interface( factory, &IID_IHolographicSpaceInterop ); hr = IActivationFactory_QueryInterface( factory, &IID_IHolographicSpaceStatics2, (void **)&holographicspace_statics2 ); if (hr == E_NOINTERFACE) /* win1607 */ diff --git a/include/Makefile.in b/include/Makefile.in index d4a166e265c..7149a364db8 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -345,6 +345,7 @@ SOURCES = \ highlevelmonitorconfigurationapi.h \ hlguids.h \ hlink.idl \ + holographicspaceinterop.idl \ hrtfapoapi.idl \ hstring.idl \ htiface.idl \ diff --git a/include/holographicspaceinterop.idl b/include/holographicspaceinterop.idl new file mode 100644 index 00000000000..913f60bc7a0 --- /dev/null +++ b/include/holographicspaceinterop.idl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "inspectable.idl"; + +[ + uuid(5c4ee536-6a98-4b86-a170-587013d6fd4b), +] +interface IHolographicSpaceInterop : IInspectable +{ + HRESULT CreateForWindow( [in] HWND window, [in] REFIID iid, [out, iid_is(iid)] void **holographic_space); +} From bbdf832ee7bd0db38fe760c028dd7118d19aafc1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 25 Mar 2024 16:21:46 -0600 Subject: [PATCH 1405/1506] windows.perception.stub: HACK: Set WS_EX_NOACTIVATE for window in holographicspace_interop_CreateForWindow(). CW-Bug-Id: #23614 --- dlls/windows.perception.stub/Makefile.in | 2 +- dlls/windows.perception.stub/holographicspace.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/windows.perception.stub/Makefile.in b/dlls/windows.perception.stub/Makefile.in index 18c90e697c4..9583b64bb89 100644 --- a/dlls/windows.perception.stub/Makefile.in +++ b/dlls/windows.perception.stub/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.perception.stub.dll -IMPORTS = combase +IMPORTS = combase user32 SOURCES = \ classes.idl \ diff --git a/dlls/windows.perception.stub/holographicspace.c b/dlls/windows.perception.stub/holographicspace.c index 53e6be0e712..f51be10a9c1 100644 --- a/dlls/windows.perception.stub/holographicspace.c +++ b/dlls/windows.perception.stub/holographicspace.c @@ -208,6 +208,9 @@ static HRESULT WINAPI holographicspace_interop_CreateForWindow( IHolographicSpac { FIXME( "iface %p, window %p, iid %s, holographic_space %p.\n", iface, window, debugstr_guid( iid ), holographic_space ); + FIXME( "HACK: Setting WS_EX_NOACTIVATE for %p.\n", window ); + SetWindowLongW( window, GWL_EXSTYLE, WS_EX_NOACTIVATE ); + *holographic_space = NULL; return E_NOTIMPL; } From 9807df9ab164df2a4a350e2320d67c8d2fc194d8 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 7 Aug 2023 17:30:05 +0800 Subject: [PATCH 1406/1506] mf: Make session_get_node_object() more robust. It's possible that a state object pointer not in the topology node collection gets passed to session_get_node_object(). Instead of returning the last node when the object is not found, we should return a NULL so that the state of the last node is not changed by mistake. Signed-off-by: Zhiyi Zhang (cherry picked from commit a00b30bfbf499679cb5fc356e5fdb7f9c4334dfb) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mf/session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index a3cf57ab047..ef707dea4de 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -2864,10 +2864,10 @@ static struct topo_node *session_get_node_object(struct media_session *session, LIST_FOR_EACH_ENTRY(node, &session->presentation.nodes, struct topo_node, entry) { if (node->type == node_type && object == node->object.object) - break; + return node; } - return node; + return NULL; } static BOOL session_set_node_object_state(struct media_session *session, IUnknown *object, From a46a5ee7b214cc10184dd8921d69c30991deda6d Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 16 Aug 2023 15:17:58 +0800 Subject: [PATCH 1407/1506] mf: Add a session_flush_nodes() helper. Signed-off-by: Zhiyi Zhang (cherry picked from commit 8173d3b0ab3c620aaaa73b114b22826d2c4c20c4) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mf/session.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index ef707dea4de..d38e7cc0f6b 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -912,6 +912,19 @@ static HRESULT session_subscribe_sources(struct media_session *session) return hr; } +static void session_flush_nodes(struct media_session *session) +{ + struct topo_node *node; + + LIST_FOR_EACH_ENTRY(node, &session->presentation.nodes, struct topo_node, entry) + { + if (node->type == MF_TOPOLOGY_OUTPUT_NODE) + IMFStreamSink_Flush(node->object.sink_stream); + else if (node->type == MF_TOPOLOGY_TRANSFORM_NODE) + IMFTransform_ProcessMessage(node->object.transform, MFT_MESSAGE_COMMAND_FLUSH, 0); + } +} + static void session_start(struct media_session *session, const GUID *time_format, const PROPVARIANT *start_position) { struct media_source *source; @@ -2892,7 +2905,6 @@ static void session_set_source_object_state(struct media_session *session, IUnkn struct media_source *src; struct media_sink *sink; enum object_state state; - struct topo_node *node; BOOL changed = FALSE; DWORD i, count; HRESULT hr; @@ -2988,21 +3000,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn if (!session_is_source_nodes_state(session, OBJ_STATE_STOPPED)) break; - LIST_FOR_EACH_ENTRY(node, &session->presentation.nodes, struct topo_node, entry) - { - switch (node->type) - { - case MF_TOPOLOGY_OUTPUT_NODE: - IMFStreamSink_Flush(node->object.sink_stream); - break; - case MF_TOPOLOGY_TRANSFORM_NODE: - IMFTransform_ProcessMessage(node->object.transform, MFT_MESSAGE_COMMAND_FLUSH, 0); - break; - default: - ; - } - } - + session_flush_nodes(session); session_set_caps(session, session->caps & ~MFSESSIONCAP_PAUSE); if (session->presentation.flags & SESSION_FLAG_FINALIZE_SINKS) From 69e83049c9cf5e239a2fca60cac86a16368b30b7 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 8 Aug 2023 15:24:34 +0800 Subject: [PATCH 1408/1506] mf/tests: Add a create_test_topology() helper. Signed-off-by: Zhiyi Zhang (cherry picked from commit c1223d0be0d566cc520a1fba2734877537d5058c) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mf/tests/mf.c | 80 +++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 0a34329bd75..35d22839032 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4995,6 +4995,48 @@ static void test_sample_grabber_is_mediatype_supported(void) IMFSampleGrabberSinkCallback_Release(grabber_callback); } +/* create a test topology with the specified source and sink */ +static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *sink_activate) +{ + IMFTopologyNode *src_node, *sink_node; + IMFPresentationDescriptor *pd; + IMFTopology *topology = NULL; + IMFStreamDescriptor *sd; + BOOL selected; + HRESULT hr; + + hr = MFCreateTopology(&topology); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopology_AddNode(topology, sink_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopology_AddNode(topology, src_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopologyNode_ConnectOutput(src_node, 0, sink_node, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(selected, "got selected %u.\n", !!selected); + init_source_node(source, -1, src_node, pd, sd); + hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate); + ok(hr == S_OK, "Failed to set object, hr %#lx.\n", hr); + hr = IMFTopologyNode_SetUINT32(sink_node, &MF_TOPONODE_CONNECT_METHOD, MF_CONNECT_ALLOW_DECODER); + ok(hr == S_OK, "Failed to set connect method, hr %#lx.\n", hr); + hr = IMFTopology_SetUINT32(topology, &MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + IMFStreamDescriptor_Release(sd); + IMFPresentationDescriptor_Release(pd); + IMFTopologyNode_Release(src_node); + IMFTopologyNode_Release(sink_node); + return topology; +} + static void test_sample_grabber_orientation(GUID subtype) { media_type_desc video_rgb32_desc = @@ -5004,17 +5046,13 @@ static void test_sample_grabber_orientation(GUID subtype) }; struct test_grabber_callback *grabber_callback; - IMFTopologyNode *src_node, *sink_node; - IMFPresentationDescriptor *pd; IMFAsyncCallback *callback; IMFActivate *sink_activate; IMFMediaType *output_type; IMFMediaSession *session; - IMFStreamDescriptor *sd; IMFMediaSource *source; IMFTopology *topology; PROPVARIANT propvar; - BOOL selected; HRESULT hr; DWORD res; @@ -5038,30 +5076,6 @@ static void test_sample_grabber_orientation(GUID subtype) hr = MFCreateMediaSession(NULL, &session); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = MFCreateTopology(&topology); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFTopology_AddNode(topology, sink_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFTopology_AddNode(topology, src_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFTopologyNode_ConnectOutput(src_node, 0, sink_node, 0); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd); - ok(selected, "got selected %u.\n", !!selected); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_source_node(source, -1, src_node, pd, sd); - IMFTopologyNode_Release(src_node); - IMFPresentationDescriptor_Release(pd); - IMFStreamDescriptor_Release(sd); - hr = MFCreateMediaType(&output_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); init_media_type(output_type, video_rgb32_desc, -1); @@ -5069,15 +5083,7 @@ static void test_sample_grabber_orientation(GUID subtype) ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); IMFMediaType_Release(output_type); - hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate); - ok(hr == S_OK, "Failed to set object, hr %#lx.\n", hr); - hr = IMFTopologyNode_SetUINT32(sink_node, &MF_TOPONODE_CONNECT_METHOD, MF_CONNECT_ALLOW_DECODER); - ok(hr == S_OK, "Failed to set connect method, hr %#lx.\n", hr); - IMFTopologyNode_Release(sink_node); - - hr = IMFTopology_SetUINT32(topology, &MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES, TRUE); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - + topology = create_test_topology(source, sink_activate); hr = IMFMediaSession_SetTopology(session, 0, topology); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFTopology_Release(topology); From ba94fc6d74cb1ba10b5d9cc57cb6edd7a58753d6 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 24 Oct 2023 12:42:12 -0500 Subject: [PATCH 1409/1506] mf: Support seeking while a session is started. (cherry picked from commit 9c82ce962bc51f6386c68f96111269c7f884d55a) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mf/session.c | 63 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index d38e7cc0f6b..6590f001a00 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -93,6 +93,7 @@ enum session_state SESSION_STATE_STARTING_SOURCES, SESSION_STATE_PREROLLING_SINKS, SESSION_STATE_STARTING_SINKS, + SESSION_STATE_RESTARTING_SOURCES, SESSION_STATE_STARTED, SESSION_STATE_PAUSING_SINKS, SESSION_STATE_PAUSING_SOURCES, @@ -929,6 +930,7 @@ static void session_start(struct media_session *session, const GUID *time_format { struct media_source *source; struct topo_node *topo_node; + MFTIME duration; HRESULT hr; UINT i; @@ -981,8 +983,36 @@ static void session_start(struct media_session *session, const GUID *time_format session->state = SESSION_STATE_STARTING_SOURCES; break; case SESSION_STATE_STARTED: - FIXME("Seeking is not implemented.\n"); - session_command_complete(session); + /* Check for invalid positions */ + LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) + { + hr = IMFPresentationDescriptor_GetUINT64(source->pd, &MF_PD_DURATION, (UINT64 *)&duration); + if (SUCCEEDED(hr) && IsEqualGUID(time_format, &GUID_NULL) + && start_position->vt == VT_I8 && start_position->hVal.QuadPart > duration) + { + WARN("Start position %s out of range, hr %#lx.\n", wine_dbgstr_longlong(start_position->hVal.QuadPart), hr); + session_command_complete_with_event(session, MESessionStarted, MF_E_INVALID_POSITION, NULL); + return; + } + } + + /* Stop sources */ + LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) + { + if (FAILED(hr = IMFMediaSource_Stop(source->source))) + { + WARN("Failed to stop media source %p, hr %#lx.\n", source->source, hr); + session_command_complete_with_event(session, MESessionStarted, hr, NULL); + return; + } + } + + session->presentation.time_format = *time_format; + session->presentation.start_position.vt = VT_EMPTY; + PropVariantCopy(&session->presentation.start_position, start_position); + + /* SESSION_STATE_STARTED -> SESSION_STATE_RESTARTING_SOURCES -> SESSION_STATE_STARTED */ + session->state = SESSION_STATE_RESTARTING_SOURCES; break; default: session_command_complete_with_event(session, MESessionStarted, MF_E_INVALIDREQUEST, NULL); @@ -2901,6 +2931,7 @@ static BOOL session_set_node_object_state(struct media_session *session, IUnknow static void session_set_source_object_state(struct media_session *session, IUnknown *object, MediaEventType event_type) { + struct media_source *source; IMFStreamSink *stream_sink; struct media_source *src; struct media_sink *sink; @@ -2952,6 +2983,15 @@ static void session_set_source_object_state(struct media_session *session, IUnkn session_set_presentation_clock(session); + /* If sinks are already started, start session immediately. This can happen when doing a + * seek from SESSION_STATE_STARTED */ + if (session_is_output_nodes_state(session, OBJ_STATE_STARTED) + && SUCCEEDED(session_start_clock(session))) + { + session_set_started(session); + return; + } + if ((session->presentation.flags & SESSION_FLAG_NEEDS_PREROLL) && session_is_output_nodes_state(session, OBJ_STATE_STOPPED)) { MFTIME preroll_time = 0; @@ -2989,6 +3029,25 @@ static void session_set_source_object_state(struct media_session *session, IUnkn else if (SUCCEEDED(session_start_clock(session))) session->state = SESSION_STATE_STARTING_SINKS; + break; + case SESSION_STATE_RESTARTING_SOURCES: + if (!session_is_source_nodes_state(session, OBJ_STATE_STOPPED)) + break; + + session_flush_nodes(session); + + /* Start sources */ + LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) + { + if (FAILED(hr = IMFMediaSource_Start(source->source, source->pd, + &session->presentation.time_format, &session->presentation.start_position))) + { + WARN("Failed to start media source %p, hr %#lx.\n", source->source, hr); + session_command_complete_with_event(session, MESessionStarted, hr, NULL); + return; + } + } + session->state = SESSION_STATE_STARTING_SOURCES; break; case SESSION_STATE_PAUSING_SOURCES: if (!session_is_source_nodes_state(session, OBJ_STATE_PAUSED)) From dfce0a5d5df21bc0e7cc60c16e820c1a7537589f Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 7 Aug 2023 11:52:20 +0800 Subject: [PATCH 1410/1506] mf/tests: Test IMFMediaSession::Start(). Signed-off-by: Zhiyi Zhang (cherry picked from commit 6b853a9354dfe62df838b255b4af33b423e74642) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mf/tests/mf.c | 960 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 952 insertions(+), 8 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 35d22839032..e6ae0a922d1 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2075,6 +2075,7 @@ static IMFMediaSource *create_media_source(const WCHAR *name, const WCHAR *mime) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceResolver_CreateObjectFromByteStream(resolver, stream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL, &obj_type, (IUnknown **)&source); + todo_wine_if(hr == MF_E_UNEXPECTED) /* Gitlab CI Debian runner */ ok(hr == S_OK || broken(hr == MF_E_UNSUPPORTED_BYTESTREAM_TYPE), "Unexpected hr %#lx.\n", hr); IMFSourceResolver_Release(resolver); IMFByteStream_Release(stream); @@ -2086,6 +2087,626 @@ static IMFMediaSource *create_media_source(const WCHAR *name, const WCHAR *mime) return source; } +enum object_state +{ + SOURCE_START, + SOURCE_PAUSE, + SOURCE_STOP, + SOURCE_SHUTDOWN, + SINK_ON_CLOCK_START, + SINK_ON_CLOCK_PAUSE, + SINK_ON_CLOCK_STOP, + SINK_ON_CLOCK_RESTART, + SINK_ON_CLOCK_SETRATE, +}; + +#define MAX_OBJECT_STATE 1024 + +struct object_state_record +{ + enum object_state states[MAX_OBJECT_STATE]; + unsigned int state_count; +}; +static struct object_state_record actual_object_state_record; + +#define add_object_state(a, b) _add_object_state(__LINE__, a, b) +static void _add_object_state(int line, struct object_state_record *record, enum object_state state) +{ + ok_(__FILE__, line)(record->state_count < MAX_OBJECT_STATE, "exceeded state_count maximum %d.\n", MAX_OBJECT_STATE); + if (record->state_count < MAX_OBJECT_STATE) + record->states[record->state_count++] = state; +} + +#define compare_object_states(a, b) _compare_object_states(__LINE__, a, b) +static void _compare_object_states(int line, const struct object_state_record *r1, + const struct object_state_record *r2) +{ + ok_(__FILE__, line)(r1->state_count == r2->state_count, "State count not equal.\n"); + if (r1->state_count == r2->state_count) + ok_(__FILE__, line)(!memcmp(r1->states, r2->states, sizeof(enum object_state) * r1->state_count), "Got different states.\n"); +} + +enum source_state +{ + SOURCE_STOPPED, + SOURCE_RUNNING, + SOURCE_PAUSED, +}; + +struct test_media_stream +{ + IMFMediaStream IMFMediaStream_iface; + IMFMediaEventQueue *event_queue; + IMFStreamDescriptor *sd; + IMFMediaSource *source; + LONGLONG sample_duration; + LONGLONG sample_time; + BOOL is_new; + LONG refcount; +}; + +static struct test_media_stream *impl_from_IMFMediaStream(IMFMediaStream *iface) +{ + return CONTAINING_RECORD(iface, struct test_media_stream, IMFMediaStream_iface); +} + +static HRESULT WINAPI test_media_stream_QueryInterface(IMFMediaStream *iface, REFIID riid, void **out) +{ + if (IsEqualIID(riid, &IID_IMFMediaStream) + || IsEqualIID(riid, &IID_IMFMediaEventGenerator) + || IsEqualIID(riid, &IID_IUnknown)) + { + *out = iface; + } + else + { + *out = NULL; + return E_NOINTERFACE; + } + + IMFMediaStream_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI test_media_stream_AddRef(IMFMediaStream *iface) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + return InterlockedIncrement(&stream->refcount); +} + +static ULONG WINAPI test_media_stream_Release(IMFMediaStream *iface) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + ULONG refcount = InterlockedDecrement(&stream->refcount); + + if (!refcount) + { + IMFMediaEventQueue_Release(stream->event_queue); + free(stream); + } + + return refcount; +} + +static HRESULT WINAPI test_media_stream_GetEvent(IMFMediaStream *iface, DWORD flags, IMFMediaEvent **event) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + return IMFMediaEventQueue_GetEvent(stream->event_queue, flags, event); +} + +static HRESULT WINAPI test_media_stream_BeginGetEvent(IMFMediaStream *iface, IMFAsyncCallback *callback, IUnknown *state) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + return IMFMediaEventQueue_BeginGetEvent(stream->event_queue, callback, state); +} + +static HRESULT WINAPI test_media_stream_EndGetEvent(IMFMediaStream *iface, IMFAsyncResult *result, IMFMediaEvent **event) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + return IMFMediaEventQueue_EndGetEvent(stream->event_queue, result, event); +} + +static HRESULT WINAPI test_media_stream_QueueEvent(IMFMediaStream *iface, MediaEventType event_type, REFGUID ext_type, + HRESULT hr, const PROPVARIANT *value) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + return IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, event_type, ext_type, hr, value); +} + +static HRESULT WINAPI test_media_stream_GetMediaSource(IMFMediaStream *iface, IMFMediaSource **source) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + + *source = stream->source; + IMFMediaSource_AddRef(*source); + + return S_OK; +} + +static HRESULT WINAPI test_media_stream_GetStreamDescriptor(IMFMediaStream *iface, IMFStreamDescriptor **sd) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + + *sd = stream->sd; + IMFStreamDescriptor_AddRef(*sd); + + return S_OK; +} + +static HRESULT WINAPI test_media_stream_RequestSample(IMFMediaStream *iface, IUnknown *token) +{ + struct test_media_stream *stream = impl_from_IMFMediaStream(iface); + IMFMediaBuffer *buffer; + IMFSample *sample; + HRESULT hr; + + hr = MFCreateSample(&sample); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (stream->sample_duration) + { + hr = IMFSample_SetSampleDuration(sample, stream->sample_duration); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFSample_SetSampleTime(sample, stream->sample_time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + stream->sample_time += stream->sample_duration; + } + else + { + hr = IMFSample_SetSampleTime(sample, 123); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFSample_SetSampleDuration(sample, 1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + + if (token) + IMFSample_SetUnknown(sample, &MFSampleExtension_Token, token); + + /* Reader expects buffers, empty samples are considered an error. */ + hr = MFCreateMemoryBuffer(8, &buffer); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFSample_AddBuffer(sample, buffer); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaBuffer_Release(buffer); + + hr = IMFMediaEventQueue_QueueEventParamUnk(stream->event_queue, MEMediaSample, &GUID_NULL, S_OK, + (IUnknown *)sample); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFSample_Release(sample); + + return S_OK; +} + +static const IMFMediaStreamVtbl test_media_stream_vtbl = +{ + test_media_stream_QueryInterface, + test_media_stream_AddRef, + test_media_stream_Release, + test_media_stream_GetEvent, + test_media_stream_BeginGetEvent, + test_media_stream_EndGetEvent, + test_media_stream_QueueEvent, + test_media_stream_GetMediaSource, + test_media_stream_GetStreamDescriptor, + test_media_stream_RequestSample, +}; + +#define TEST_SOURCE_NUM_STREAMS 3 + +struct test_seek_source +{ + IMFMediaSource IMFMediaSource_iface; + IMFMediaEventQueue *event_queue; + IMFPresentationDescriptor *pd; + struct test_media_stream *streams[TEST_SOURCE_NUM_STREAMS]; + enum source_state state; + unsigned stream_count; + CRITICAL_SECTION cs; + BOOL seekable; + LONG refcount; +}; + +static struct test_seek_source *impl_test_seek_source_from_IMFMediaSource(IMFMediaSource *iface) +{ + return CONTAINING_RECORD(iface, struct test_seek_source, IMFMediaSource_iface); +} + +static HRESULT WINAPI test_seek_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out) +{ + if (IsEqualIID(riid, &IID_IMFMediaSource) + || IsEqualIID(riid, &IID_IMFMediaEventGenerator) + || IsEqualIID(riid, &IID_IUnknown)) + { + *out = iface; + } + else + { + *out = NULL; + return E_NOINTERFACE; + } + + IMFMediaSource_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI test_seek_source_AddRef(IMFMediaSource *iface) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + return InterlockedIncrement(&source->refcount); +} + +static ULONG WINAPI test_seek_source_Release(IMFMediaSource *iface) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + ULONG refcount = InterlockedDecrement(&source->refcount); + + if (!refcount) + { + IMFMediaEventQueue_Release(source->event_queue); + free(source); + } + + return refcount; +} + +static HRESULT WINAPI test_seek_source_GetEvent(IMFMediaSource *iface, DWORD flags, IMFMediaEvent **event) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + return IMFMediaEventQueue_GetEvent(source->event_queue, flags, event); +} + +static HRESULT WINAPI test_seek_source_BeginGetEvent(IMFMediaSource *iface, IMFAsyncCallback *callback, IUnknown *state) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + return IMFMediaEventQueue_BeginGetEvent(source->event_queue, callback, state); +} + +static HRESULT WINAPI test_seek_source_EndGetEvent(IMFMediaSource *iface, IMFAsyncResult *result, IMFMediaEvent **event) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + return IMFMediaEventQueue_EndGetEvent(source->event_queue, result, event); +} + +static HRESULT WINAPI test_seek_source_QueueEvent(IMFMediaSource *iface, MediaEventType event_type, REFGUID ext_type, + HRESULT hr, const PROPVARIANT *value) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, ext_type, hr, value); +} + +static HRESULT WINAPI test_seek_source_GetCharacteristics(IMFMediaSource *iface, DWORD *flags) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + + if (source->seekable) + *flags = MFMEDIASOURCE_CAN_PAUSE | MFMEDIASOURCE_CAN_SEEK; + else + *flags = MFMEDIASOURCE_CAN_PAUSE; + return S_OK; +} + +static HRESULT WINAPI test_seek_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **pd) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + IMFStreamDescriptor *sds[ARRAY_SIZE(source->streams)]; + IMFMediaType *media_type; + HRESULT hr = S_OK; + int i; + + EnterCriticalSection(&source->cs); + + if (source->pd) + { + *pd = source->pd; + IMFPresentationDescriptor_AddRef(*pd); + } + else + { + for (i = 0; i < source->stream_count; ++i) + { + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)640 << 32 | 480); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = MFCreateStreamDescriptor(i, 1, &media_type, &sds[i]); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + IMFMediaType_Release(media_type); + } + + hr = MFCreatePresentationDescriptor(source->stream_count, sds, &source->pd); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationDescriptor_SetUINT64(source->pd, &MF_PD_DURATION, 10 * 10000000); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationDescriptor_SelectStream(source->pd, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + for (i = 0; i < source->stream_count; ++i) + IMFStreamDescriptor_Release(sds[i]); + + *pd = source->pd; + IMFPresentationDescriptor_AddRef(*pd); + } + + LeaveCriticalSection(&source->cs); + + return hr; +} + +static BOOL is_stream_selected(IMFPresentationDescriptor *pd, DWORD index) +{ + IMFStreamDescriptor *sd; + BOOL selected = FALSE; + + if (SUCCEEDED(IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, index, &selected, &sd))) + IMFStreamDescriptor_Release(sd); + + return selected; +} + +static HRESULT WINAPI test_seek_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *pd, const GUID *time_format, + const PROPVARIANT *start_position) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + MediaEventType event_type; + PROPVARIANT var; + HRESULT hr; + int i; + + add_object_state(&actual_object_state_record, SOURCE_START); + + ok(time_format && IsEqualGUID(time_format, &GUID_NULL), "Unexpected time format %s.\n", + wine_dbgstr_guid(time_format)); + ok(start_position && (start_position->vt == VT_I8 || start_position->vt == VT_EMPTY), + "Unexpected position type.\n"); + + /* This is what makes IMFMediaSession::Start() seeking fail, not the lacking of MFMEDIASOURCE_CAN_SEEK. + * Without this, IMFMediaSession::Start() seeking succeeds even with the missing MFMEDIASOURCE_CAN_SEEK. + * If this is check is not here, the first IMFMediaSession::Start() call to a non-zero position + * succeeds somehow on Windows 10, then all following seeks fails and no MESessionStarted events */ + if (!source->seekable && start_position && start_position->vt == VT_I8 && start_position->hVal.QuadPart) + return E_FAIL; + + EnterCriticalSection(&source->cs); + + event_type = source->state != SOURCE_STOPPED ? MESourceSeeked : MESourceStarted; + hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (i = 0; i < source->stream_count; ++i) + { + if (!is_stream_selected(pd, i)) + continue; + + var.vt = VT_UNKNOWN; + var.punkVal = (IUnknown *)&source->streams[i]->IMFMediaStream_iface; + event_type = source->streams[i]->is_new ? MENewStream : MEUpdatedStream; + source->streams[i]->is_new = FALSE; + hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, &var); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + event_type = source->state != SOURCE_STOPPED ? MEStreamSeeked : MEStreamStarted; + hr = IMFMediaEventQueue_QueueEventParamVar(source->streams[i]->event_queue, event_type, &GUID_NULL, + S_OK, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + + source->state = SOURCE_RUNNING; + + LeaveCriticalSection(&source->cs); + + return S_OK; +} + +static HRESULT WINAPI test_seek_source_Stop(IMFMediaSource *iface) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + MediaEventType event_type; + HRESULT hr; + int i; + + add_object_state(&actual_object_state_record, SOURCE_STOP); + + EnterCriticalSection(&source->cs); + + event_type = MESourceStopped; + hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (i = 0; i < source->stream_count; ++i) + { + if (!is_stream_selected(source->pd, i)) + continue; + + event_type = MEStreamStopped; + hr = IMFMediaEventQueue_QueueEventParamVar(source->streams[i]->event_queue, event_type, &GUID_NULL, + S_OK, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + + source->state = SOURCE_STOPPED; + + LeaveCriticalSection(&source->cs); + + return S_OK; +} + +static HRESULT WINAPI test_seek_source_Pause(IMFMediaSource *iface) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + MediaEventType event_type; + HRESULT hr; + int i; + + add_object_state(&actual_object_state_record, SOURCE_PAUSE); + + EnterCriticalSection(&source->cs); + + event_type = MESourcePaused; + hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (i = 0; i < source->stream_count; ++i) + { + if (!is_stream_selected(source->pd, i)) + continue; + + event_type = MEStreamPaused; + hr = IMFMediaEventQueue_QueueEventParamVar(source->streams[i]->event_queue, event_type, &GUID_NULL, + S_OK, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + + source->state = SOURCE_PAUSED; + LeaveCriticalSection(&source->cs); + + return S_OK; +} + +static HRESULT WINAPI test_seek_source_Shutdown(IMFMediaSource *iface) +{ + struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); + HRESULT hr; + + add_object_state(&actual_object_state_record, SOURCE_SHUTDOWN); + + hr = IMFMediaEventQueue_Shutdown(source->event_queue); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + return S_OK; +} + +static const IMFMediaSourceVtbl test_seek_source_vtbl = +{ + test_seek_source_QueryInterface, + test_seek_source_AddRef, + test_seek_source_Release, + test_seek_source_GetEvent, + test_seek_source_BeginGetEvent, + test_seek_source_EndGetEvent, + test_seek_source_QueueEvent, + test_seek_source_GetCharacteristics, + test_seek_source_CreatePresentationDescriptor, + test_seek_source_Start, + test_seek_source_Stop, + test_seek_source_Pause, + test_seek_source_Shutdown, +}; + +static HRESULT WINAPI test_seek_clock_sink_QueryInterface(IMFClockStateSink *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IMFClockStateSink) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFClockStateSink_AddRef(iface); + return S_OK; + } + + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI test_seek_clock_sink_AddRef(IMFClockStateSink *iface) +{ + return 2; +} + +static ULONG WINAPI test_seek_clock_sink_Release(IMFClockStateSink *iface) +{ + return 1; +} + +static HRESULT WINAPI test_seek_clock_sink_OnClockStart(IMFClockStateSink *iface, MFTIME system_time, LONGLONG offset) +{ + add_object_state(&actual_object_state_record, SINK_ON_CLOCK_START); + return S_OK; +} + +static HRESULT WINAPI test_seek_clock_sink_OnClockStop(IMFClockStateSink *iface, MFTIME system_time) +{ + add_object_state(&actual_object_state_record, SINK_ON_CLOCK_STOP); + return S_OK; +} + +static HRESULT WINAPI test_seek_clock_sink_OnClockPause(IMFClockStateSink *iface, MFTIME system_time) +{ + add_object_state(&actual_object_state_record, SINK_ON_CLOCK_PAUSE); + return S_OK; +} + +static HRESULT WINAPI test_seek_clock_sink_OnClockRestart(IMFClockStateSink *iface, MFTIME system_time) +{ + add_object_state(&actual_object_state_record, SINK_ON_CLOCK_RESTART); + return S_OK; +} + +static HRESULT WINAPI test_seek_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME system_time, float rate) +{ + add_object_state(&actual_object_state_record, SINK_ON_CLOCK_SETRATE); + return S_OK; +} + +static const IMFClockStateSinkVtbl test_seek_clock_sink_vtbl = +{ + test_seek_clock_sink_QueryInterface, + test_seek_clock_sink_AddRef, + test_seek_clock_sink_Release, + test_seek_clock_sink_OnClockStart, + test_seek_clock_sink_OnClockStop, + test_seek_clock_sink_OnClockPause, + test_seek_clock_sink_OnClockRestart, + test_seek_clock_sink_OnClockSetRate, +}; + +static struct test_media_stream *create_test_stream(DWORD stream_index, IMFMediaSource *source) +{ + struct test_media_stream *stream; + IMFPresentationDescriptor *pd; + BOOL selected; + HRESULT hr; + + stream = calloc(1, sizeof(*stream)); + stream->IMFMediaStream_iface.lpVtbl = &test_media_stream_vtbl; + stream->refcount = 1; + hr = MFCreateEventQueue(&stream->event_queue); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + stream->source = source; + IMFMediaSource_AddRef(stream->source); + stream->is_new = TRUE; + + IMFMediaSource_CreatePresentationDescriptor(source, &pd); + IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, stream_index, &selected, &stream->sd); + IMFPresentationDescriptor_Release(pd); + + return stream; +} + +static IMFMediaSource *create_test_seek_source(BOOL seekable) +{ + struct test_seek_source *source; + int i; + + source = calloc(1, sizeof(*source)); + source->IMFMediaSource_iface.lpVtbl = &test_seek_source_vtbl; + source->refcount = 1; + source->stream_count = 1; + source->seekable = seekable; + MFCreateEventQueue(&source->event_queue); + InitializeCriticalSection(&source->cs); + for (i = 0; i < source->stream_count; ++i) + source->streams[i] = create_test_stream(i, &source->IMFMediaSource_iface); + + return &source->IMFMediaSource_iface; +} + static void test_media_session_events(void) { static const media_type_desc audio_float_44100 = @@ -2887,27 +3508,27 @@ static ULONG WINAPI test_grabber_callback_Release(IMFSampleGrabberSinkCallback * static HRESULT WINAPI test_grabber_callback_OnClockStart(IMFSampleGrabberSinkCallback *iface, MFTIME time, LONGLONG offset) { - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI test_grabber_callback_OnClockStop(IMFSampleGrabberSinkCallback *iface, MFTIME time) { - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI test_grabber_callback_OnClockPause(IMFSampleGrabberSinkCallback *iface, MFTIME time) { - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI test_grabber_callback_OnClockRestart(IMFSampleGrabberSinkCallback *iface, MFTIME time) { - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI test_grabber_callback_OnClockSetRate(IMFSampleGrabberSinkCallback *iface, MFTIME time, float rate) { - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI test_grabber_callback_OnSetPresentationClock(IMFSampleGrabberSinkCallback *iface, @@ -4995,8 +5616,8 @@ static void test_sample_grabber_is_mediatype_supported(void) IMFSampleGrabberSinkCallback_Release(grabber_callback); } -/* create a test topology with the specified source and sink */ -static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *sink_activate) +/* create a test topology with the specified source and sink, and return duration if required */ +static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *sink_activate, UINT64 *duration) { IMFTopologyNode *src_node, *sink_node; IMFPresentationDescriptor *pd; @@ -5022,6 +5643,11 @@ static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *si hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(selected, "got selected %u.\n", !!selected); + if (duration) + { + hr = IMFPresentationDescriptor_GetUINT64(pd, &MF_PD_DURATION, duration); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } init_source_node(source, -1, src_node, pd, sd); hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate); ok(hr == S_OK, "Failed to set object, hr %#lx.\n", hr); @@ -5083,7 +5709,7 @@ static void test_sample_grabber_orientation(GUID subtype) ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); IMFMediaType_Release(output_type); - topology = create_test_topology(source, sink_activate); + topology = create_test_topology(source, sink_activate, NULL); hr = IMFMediaSession_SetTopology(session, 0, topology); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFTopology_Release(topology); @@ -7282,6 +7908,323 @@ static void test_MFCreateSequencerSegmentOffset(void) PropVariantClear(&propvar); } +static void test_media_session_Start(void) +{ + static const struct object_state_record expected_object_state_records[] = + { + {{SOURCE_START, SINK_ON_CLOCK_START}, 2}, + {{SOURCE_STOP, SOURCE_START, SINK_ON_CLOCK_START}, 3}, + {{SOURCE_STOP, SOURCE_START, SINK_ON_CLOCK_START}, 3}, + }; + media_type_desc video_rgb32_desc = + { + ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), + ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32), + }; + static const MFTIME allowed_error = 5000000; + IMFClockStateSink test_seek_clock_sink = {&test_seek_clock_sink_vtbl}; + struct test_grabber_callback *grabber_callback; + IMFPresentationClock *presentation_clock; + enum source_state initial_state; + IMFActivate *sink_activate; + IMFAsyncCallback *callback; + IMFMediaType *output_type; + IMFMediaSession *session; + IMFMediaSource *source; + IMFTopology *topology; + MFTIME time, old_time; + PROPVARIANT propvar; + IMFClock *clock; + UINT64 duration; + DWORD caps; + HRESULT hr; + + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "Failed to start up, hr %#lx.\n", hr); + + if (!(source = create_media_source(L"test.mp4", L"video/mp4"))) + { + todo_wine /* Gitlab CI Debian runner */ + win_skip("MP4 media source is not supported, skipping tests.\n"); + MFShutdown(); + return; + } + + grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); + hr = MFCreateMediaType(&output_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(output_type, video_rgb32_desc, -1); + hr = MFCreateSampleGrabberSinkActivate(output_type, &grabber_callback->IMFSampleGrabberSinkCallback_iface, &sink_activate); + ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); + IMFMediaType_Release(output_type); + + hr = MFCreateMediaSession(NULL, &session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + topology = create_test_topology(source, sink_activate, &duration); + hr = IMFMediaSession_SetTopology(session, 0, topology); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopology_Release(topology); + + hr = IMFMediaSession_GetClock(session, &clock); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFClock_Release(clock); + + propvar.vt = VT_EMPTY; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + callback = create_test_callback(TRUE); + hr = wait_media_event(session, callback, MESessionStarted, 5000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /* Seek to 1s */ + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationClock_GetTime(presentation_clock, &time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(llabs(time - 10000000) <= allowed_error, "Unexpected time %I64d.\n", time); + + /* Seek to beyond duration */ + propvar.vt = VT_I8; + propvar.hVal.QuadPart = duration + 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == MF_E_INVALID_POSITION, "Unexpected hr %#lx.\n", hr); + + /* Seek to negative position */ + propvar.vt = VT_I8; + propvar.hVal.QuadPart = -10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationClock_GetTime(presentation_clock, &time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(llabs(time - (-10000000)) <= allowed_error, "Unexpected time %I64d.\n", time); + + /* Seek backwards to 0s */ + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 0; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationClock_GetTime(presentation_clock, &time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(llabs(time) <= allowed_error, "Unexpected time %I64d.\n", time); + + /* Seek to 1s while in paused state */ + hr = IMFMediaSession_Pause(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionPaused, 1000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFPresentationClock_GetTime(presentation_clock, &time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(llabs(time - 10000000) <= allowed_error, "Unexpected time %I64d.\n", time); + old_time = time; + + /* Expected the presentation clock is running */ + Sleep(100); + hr = IMFPresentationClock_GetTime(presentation_clock, &time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(time > old_time, "Unexpected time %I64d.\n", time); + + hr = IMFMediaSession_Stop(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_Close(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /* Media session is shut down */ + hr = IMFMediaSource_Shutdown(source); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_Shutdown(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + + propvar.vt = VT_EMPTY; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + + IMFPresentationClock_Release(presentation_clock); + IMFMediaSource_Release(source); + IMFAsyncCallback_Release(callback); + /* sometimes briefly leaking */ + IMFMediaSession_Release(session); + IMFActivate_ShutdownObject(sink_activate); + IMFActivate_Release(sink_activate); + IMFSampleGrabberSinkCallback_Release(&grabber_callback->IMFSampleGrabberSinkCallback_iface); + + /* Unseekable media source */ + source = create_test_seek_source(FALSE); + hr = IMFMediaSource_GetCharacteristics(source, &caps); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok((caps & MFMEDIASOURCE_CAN_SEEK) == 0, "Got unexpected caps %#lx.\n", caps); + grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); + hr = MFCreateMediaType(&output_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(output_type, video_rgb32_desc, -1); + hr = MFCreateSampleGrabberSinkActivate(output_type, &grabber_callback->IMFSampleGrabberSinkCallback_iface, &sink_activate); + ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); + IMFMediaType_Release(output_type); + + hr = MFCreateMediaSession(NULL, &session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + topology = create_test_topology(source, sink_activate, &duration); + hr = IMFMediaSession_SetTopology(session, 0, topology); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopology_Release(topology); + + hr = IMFMediaSession_GetClock(session, &clock); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFClock_Release(clock); + + propvar.vt = VT_EMPTY; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + callback = create_test_callback(TRUE); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaSession_GetSessionCapabilities(session, &caps); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok((caps & MFSESSIONCAP_SEEK) == 0, "Got unexpected caps %#lx\n", caps); + + /* Seek to 1s */ + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationClock_GetTime(presentation_clock, &time); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(llabs(time) <= allowed_error, "Unexpected time %I64d.\n", time); + + hr = IMFMediaSession_Stop(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_Close(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_Shutdown(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSource_Shutdown(source); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + IMFPresentationClock_Release(presentation_clock); + IMFAsyncCallback_Release(callback); + IMFMediaSession_Release(session); + IMFMediaSource_Release(source); + IMFActivate_ShutdownObject(sink_activate); + IMFActivate_Release(sink_activate); + IMFSampleGrabberSinkCallback_Release(&grabber_callback->IMFSampleGrabberSinkCallback_iface); + + /* Test object state transitions */ + for (initial_state = SOURCE_STOPPED; initial_state <= SOURCE_PAUSED; initial_state++) + { + winetest_push_context("Test %d", initial_state); + + source = create_test_seek_source(TRUE); + callback = create_test_callback(TRUE); + + grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); + hr = MFCreateMediaType(&output_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_media_type(output_type, video_rgb32_desc, -1); + hr = MFCreateSampleGrabberSinkActivate(output_type, &grabber_callback->IMFSampleGrabberSinkCallback_iface, &sink_activate); + ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); + IMFMediaType_Release(output_type); + + hr = MFCreateMediaSession(NULL, &session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + topology = create_test_topology(source, sink_activate, &duration); + hr = IMFMediaSession_SetTopology(session, 0, topology); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopology_Release(topology); + + hr = IMFMediaSession_GetClock(session, &clock); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationClock_AddClockStateSink(presentation_clock, &test_seek_clock_sink); + ok(hr == S_OK, "Failed to add a sink, hr %#lx.\n", hr); + IMFClock_Release(clock); + + if (initial_state == SOURCE_RUNNING || initial_state == SOURCE_PAUSED) + { + propvar.vt = VT_EMPTY; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 5000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + if (initial_state == SOURCE_PAUSED) + { + hr = IMFMediaSession_Pause(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionPaused, 5000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + + /* Seek to 1s */ + memset(&actual_object_state_record, 0, sizeof(actual_object_state_record)); + + propvar.vt = VT_I8; + propvar.hVal.QuadPart = 10000000; + hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = wait_media_event(session, callback, MESessionStarted, 5000, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine_if(initial_state == SOURCE_PAUSED) + compare_object_states(&actual_object_state_record, &expected_object_state_records[initial_state]); + + hr = IMFMediaSession_Stop(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_Close(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_Shutdown(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSource_Shutdown(source); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + IMFPresentationClock_RemoveClockStateSink(presentation_clock, &test_seek_clock_sink); + IMFPresentationClock_Release(presentation_clock); + IMFAsyncCallback_Release(callback); + IMFMediaSession_Release(session); + IMFMediaSource_Release(source); + IMFActivate_ShutdownObject(sink_activate); + IMFActivate_Release(sink_activate); + IMFSampleGrabberSinkCallback_Release(&grabber_callback->IMFSampleGrabberSinkCallback_iface); + winetest_pop_context(); + } + + hr = MFShutdown(); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); +} + START_TEST(mf) { init_functions(); @@ -7318,4 +8261,5 @@ START_TEST(mf) test_MFRequireProtectedEnvironment(); test_mpeg4_media_sink(); test_MFCreateSequencerSegmentOffset(); + test_media_session_Start(); } From 283cde7ab8a1d3551cfae38f333c3de1ab779103 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 28 Jul 2023 18:04:30 +0800 Subject: [PATCH 1411/1506] mfmediaengine: Implement IMFMediaEngineEx::SetCurrentTime(). (cherry picked from commit 2bcc87b30301bef3c77601d31d87fa93e60d79d5) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mfmediaengine/main.c | 59 ++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 3e05626f238..c6f82ec055b 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -94,6 +94,7 @@ enum media_engine_flags FLAGS_ENGINE_NEW_FRAME = 0x8000, FLAGS_ENGINE_SOURCE_PENDING = 0x10000, FLAGS_ENGINE_PLAY_PENDING = 0x20000, + FLAGS_ENGINE_SEEKING = 0x40000, }; struct vec3 @@ -164,6 +165,7 @@ struct media_engine { IMFMediaSource *source; IMFPresentationDescriptor *pd; + PROPVARIANT start_position; } presentation; struct effects video_effects; struct effects audio_effects; @@ -978,7 +980,14 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface break; } case MESessionStarted: - + EnterCriticalSection(&engine->cs); + if (engine->flags & FLAGS_ENGINE_SEEKING) + { + media_engine_set_flag(engine, FLAGS_ENGINE_SEEKING | FLAGS_ENGINE_IS_ENDED, FALSE); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKED, 0, 0); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_TIMEUPDATE, 0, 0); + } + LeaveCriticalSection(&engine->cs); IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PLAYING, 0, 0); break; case MESessionEnded: @@ -1339,10 +1348,9 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi static void media_engine_start_playback(struct media_engine *engine) { - PROPVARIANT var; - - var.vt = VT_EMPTY; - IMFMediaSession_Start(engine->session, &GUID_NULL, &var); + IMFMediaSession_Start(engine->session, &GUID_NULL, &engine->presentation.start_position); + /* Reset the playback position to the current position */ + engine->presentation.start_position.vt = VT_EMPTY; } static HRESULT WINAPI media_engine_load_handler_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) @@ -1770,6 +1778,10 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface) { ret = engine->duration; } + else if (engine->flags & FLAGS_ENGINE_PAUSED && engine->presentation.start_position.vt == VT_I8) + { + ret = (double)engine->presentation.start_position.hVal.QuadPart / 10000000; + } else if (SUCCEEDED(IMFPresentationClock_GetTime(engine->clock, &clocktime))) { ret = mftime_to_seconds(clocktime); @@ -1779,17 +1791,50 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface) return ret; } +static HRESULT media_engine_set_current_time(struct media_engine *engine, double seektime) +{ + PROPVARIANT position; + DWORD caps; + HRESULT hr; + + hr = IMFMediaSession_GetSessionCapabilities(engine->session, &caps); + if (FAILED(hr) || !(caps & MFSESSIONCAP_SEEK)) + return hr; + + position.vt = VT_I8; + position.hVal.QuadPart = min(max(0, seektime), engine->duration) * 10000000; + + if (IMFMediaEngineEx_IsPaused(&engine->IMFMediaEngineEx_iface)) + { + engine->presentation.start_position = position; + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKING, 0, 0); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKED, 0, 0); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_TIMEUPDATE, 0, 0); + return S_OK; + } + + if (SUCCEEDED(hr = IMFMediaSession_Start(engine->session, &GUID_NULL, &position))) + { + media_engine_set_flag(engine, FLAGS_ENGINE_SEEKING, TRUE); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKING, 0, 0); + } + + return hr; +} + static HRESULT WINAPI media_engine_SetCurrentTime(IMFMediaEngineEx *iface, double time) { struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); - HRESULT hr = E_NOTIMPL; + HRESULT hr; - FIXME("(%p, %f): stub.\n", iface, time); + TRACE("%p, %f.\n", iface, time); EnterCriticalSection(&engine->cs); if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) hr = MF_E_SHUTDOWN; + else + hr = media_engine_set_current_time(engine, time); LeaveCriticalSection(&engine->cs); From cab32f60ad8cbed6613656f7b89fa97b49f7046a Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 20 Feb 2024 15:21:56 +0800 Subject: [PATCH 1412/1506] mfmediaengine: Implement IMFMediaEngineEx::SetCurrentTimeEx(). (cherry picked from commit 283d4bab2229c4accae8453f24c76319741dec96) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mfmediaengine/main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index c6f82ec055b..f6ea0cf3e59 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -3027,9 +3027,24 @@ static HRESULT WINAPI media_engine_SetRealTimeMode(IMFMediaEngineEx *iface, BOOL static HRESULT WINAPI media_engine_SetCurrentTimeEx(IMFMediaEngineEx *iface, double seektime, MF_MEDIA_ENGINE_SEEK_MODE mode) { - FIXME("%p, %f, %#x stub.\n", iface, seektime, mode); + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %f, %#x.\n", iface, seektime, mode); + + if (mode) + FIXME("mode %#x is ignored.\n", mode); + + EnterCriticalSection(&engine->cs); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else + hr = media_engine_set_current_time(engine, seektime); + + LeaveCriticalSection(&engine->cs); + + return hr; } static HRESULT WINAPI media_engine_EnableTimeUpdateTimer(IMFMediaEngineEx *iface, BOOL enable) From e9b0c55ec27c464482847d057cc22721121d30e9 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 20 Feb 2024 15:22:25 +0800 Subject: [PATCH 1413/1506] mfmediaengine/tests: Test IMFMediaEngineEx::SetCurrentTime/Ex(). (cherry picked from commit de89f777271a2b3fe2ab7fd7779bb6a0a70c09c4) CW-Bug-Id: #22486 CW-Bug-Id: #22799 --- dlls/mfmediaengine/tests/mfmediaengine.c | 201 +++++++++++++++++++++++ 1 file changed, 201 insertions(+) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index f9489f3dcb5..c7fabbe218f 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -2183,6 +2183,11 @@ struct test_seek_notify { IMFMediaEngineNotify IMFMediaEngineNotify_iface; HANDLE playing_event; + HANDLE seeking_event; + HANDLE seeked_event; + HANDLE time_update_event; + BOOL seeking_event_received; + BOOL time_update_event_received; HRESULT expected_error; HRESULT error; LONG refcount; @@ -2222,6 +2227,9 @@ static ULONG WINAPI test_seek_notify_Release(IMFMediaEngineNotify *iface) if (!refcount) { CloseHandle(notify->playing_event); + CloseHandle(notify->seeking_event); + CloseHandle(notify->seeked_event); + CloseHandle(notify->time_update_event); free(notify); } @@ -2238,6 +2246,17 @@ static HRESULT WINAPI test_seek_notify_EventNotify(IMFMediaEngineNotify *iface, case MF_MEDIA_ENGINE_EVENT_PLAYING: SetEvent(notify->playing_event); break; + case MF_MEDIA_ENGINE_EVENT_SEEKING: + notify->seeking_event_received = TRUE; + SetEvent(notify->seeking_event); + break; + case MF_MEDIA_ENGINE_EVENT_SEEKED: + SetEvent(notify->seeked_event); + break; + case MF_MEDIA_ENGINE_EVENT_TIMEUPDATE: + notify->time_update_event_received = TRUE; + SetEvent(notify->time_update_event); + break; case MF_MEDIA_ENGINE_EVENT_ERROR: ok(param2 == notify->expected_error, "Unexpected error %#lx\n", param2); notify->error = param2; @@ -2262,7 +2281,13 @@ static struct test_seek_notify *create_seek_notify(void) object = calloc(1, sizeof(*object)); object->IMFMediaEngineNotify_iface.lpVtbl = &test_seek_notify_vtbl; object->playing_event = CreateEventW(NULL, FALSE, FALSE, NULL); + object->seeking_event = CreateEventW(NULL, FALSE, FALSE, NULL); + object->seeked_event = CreateEventW(NULL, FALSE, FALSE, NULL); + object->time_update_event = CreateEventW(NULL, FALSE, FALSE, NULL); ok(!!object->playing_event, "Failed to create an event, error %lu.\n", GetLastError()); + ok(!!object->seeking_event, "Failed to create an event, error %lu.\n", GetLastError()); + ok(!!object->seeked_event, "Failed to create an event, error %lu.\n", GetLastError()); + ok(!!object->time_update_event, "Failed to create an event, error %lu.\n", GetLastError()); object->refcount = 1; return object; } @@ -2504,6 +2529,181 @@ static void test_media_extension(void) IMFMediaEngineExtension_Release(&extension->IMFMediaEngineExtension_iface); } +#define test_seek_result(a, b, c) _test_seek_result(__LINE__, a, b, c) +static void _test_seek_result(int line, IMFMediaEngineEx *media_engine, + struct test_seek_notify *notify, double expected_time) +{ + static const double allowed_error = 0.05; + static const int timeout = 1000; + double time; + DWORD res; + + ok(notify->seeking_event_received, "Seeking event not received.\n"); + notify->seeking_event_received = FALSE; + res = WaitForSingleObject(notify->seeking_event, timeout); + ok_(__FILE__, line)(!res, "Waiting for seeking event returned %#lx.\n", res); + res = WaitForSingleObject(notify->seeked_event, timeout); + ok_(__FILE__, line)(!res, "Waiting for seeked event returned %#lx.\n", res); + res = WaitForSingleObject(notify->time_update_event, timeout); + ok_(__FILE__, line)(!res, "Waiting for ready event returned %#lx.\n", res); + time = IMFMediaEngineEx_GetCurrentTime(media_engine); + ok_(__FILE__, line)(compare_double(time, expected_time, allowed_error), "Unexpected time %lf.\n", time); +} + +static void test_SetCurrentTime(void) +{ + static const double allowed_error = 0.05; + static const int timeout = 1000; + IMFByteStream *stream, *unseekable_stream = NULL; + double time, duration, start, end; + struct test_seek_notify *notify; + IMFMediaEngineEx *media_engine; + ULONG refcount; + HRESULT hr; + DWORD res; + BOOL ret; + BSTR url; + + notify = create_seek_notify(); + hr = create_media_engine(¬ify->IMFMediaEngineNotify_iface, NULL, DXGI_FORMAT_B8G8R8X8_UNORM, + &IID_IMFMediaEngineEx, (void **)&media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface); + + stream = load_resource(L"i420-64x64.avi", L"video/avi"); + url = SysAllocString(L"i420-64x64.avi"); + hr = IMFMediaEngineEx_SetSourceFromByteStream(media_engine, stream, url); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaEngineEx_Play(media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + res = WaitForSingleObject(notify->playing_event, 5000); + ok(!res, "Unexpected res %#lx.\n", res); + + duration = IMFMediaEngineEx_GetDuration(media_engine); + ok(duration > 0, "Got invalid duration.\n"); + start = 0; + end = duration; + + /* Test playing state */ + hr = IMFMediaEngineEx_SetCurrentTime(media_engine, end); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + test_seek_result(media_engine, notify, end); + + /* Test seeking with a negative position */ + hr = IMFMediaEngineEx_SetCurrentTime(media_engine, -1); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + test_seek_result(media_engine, notify, 0); + + /* Test seeking beyond duration */ + hr = IMFMediaEngineEx_SetCurrentTime(media_engine, end + 1); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + test_seek_result(media_engine, notify, end); + + hr = IMFMediaEngineEx_SetCurrentTimeEx(media_engine, start, MF_MEDIA_ENGINE_SEEK_MODE_NORMAL); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + test_seek_result(media_engine, notify, start); + + hr = IMFMediaEngineEx_SetCurrentTimeEx(media_engine, end, MF_MEDIA_ENGINE_SEEK_MODE_APPROXIMATE); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + test_seek_result(media_engine, notify, end); + + /* Test paused state */ + hr = IMFMediaEngineEx_Pause(media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaEngineEx_SetCurrentTime(media_engine, start); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + ok(notify->seeking_event_received, "Seeking event not received.\n"); + notify->seeking_event_received = FALSE; + ok(notify->time_update_event_received, "Time update event not received.\n"); + notify->time_update_event_received = FALSE; + res = WaitForSingleObject(notify->seeking_event, timeout); + ok(!res, "Unexpected res %#lx.\n", res); + res = WaitForSingleObject(notify->seeked_event, timeout); + ok(res == WAIT_TIMEOUT || res == 0, /* No timeout sometimes on Win10+ */ + "Unexpected res %#lx.\n", res); + res = WaitForSingleObject(notify->time_update_event, timeout); + ok(!res, "Unexpected res %#lx.\n", res); + time = IMFMediaEngineEx_GetCurrentTime(media_engine); + ok(compare_double(time, start, allowed_error), "Unexpected time %lf.\n", time); + } + + Sleep(end * 1000); + + ret = IMFMediaEngineEx_IsPaused(media_engine); + ok(ret, "Unexpected ret %d.\n", ret); + time = IMFMediaEngineEx_GetCurrentTime(media_engine); + ok(compare_double(time, start, allowed_error) + || broken(time >= end) /* Windows 11 21H2 AMD GPU TestBot */, "Unexpected time %lf.\n", time); + + hr = IMFMediaEngineEx_Play(media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + res = WaitForSingleObject(notify->seeked_event, timeout); + ok(res == WAIT_TIMEOUT, "Unexpected res %#lx.\n", res); + + /* Media engine is shut down */ + hr = IMFMediaEngineEx_Shutdown(media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaEngineEx_SetCurrentTime(media_engine, start); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaEngineEx_SetCurrentTimeEx(media_engine, start, MF_MEDIA_ENGINE_SEEK_MODE_NORMAL); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + + refcount = IMFMediaEngineEx_Release(media_engine); + todo_wine + ok(!refcount, "Got unexpected refcount %lu.\n", refcount); + + /* Unseekable bytestreams */ + notify = create_seek_notify(); + hr = create_media_engine(¬ify->IMFMediaEngineNotify_iface, NULL, DXGI_FORMAT_B8G8R8X8_UNORM, + &IID_IMFMediaEngineEx, (void **)&media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface); + unseekable_stream = create_unseekable_stream(stream); + hr = IMFMediaEngineEx_SetSourceFromByteStream(media_engine, unseekable_stream, url); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (FAILED(hr)) + goto done; + + hr = IMFMediaEngineEx_Play(media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + notify->expected_error = MF_E_INVALIDREQUEST; + res = WaitForSingleObject(notify->playing_event, 5000); + ok(res == S_OK, "Unexpected res %#lx.\n", res); + + hr = IMFMediaEngineEx_SetCurrentTime(media_engine, end); + ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + ok(!notify->seeking_event_received, "Seeking event received.\n"); + res = WaitForSingleObject(notify->seeking_event, timeout); + ok(res == WAIT_TIMEOUT, "Unexpected res %#lx.\n", res); + res = WaitForSingleObject(notify->seeked_event, timeout); + ok(res == WAIT_TIMEOUT, "Unexpected res %#lx.\n", res); + res = WaitForSingleObject(notify->time_update_event, timeout); + ok(!res, "Unexpected res %#lx.\n", res); + } + +done: + hr = IMFMediaEngineEx_Shutdown(media_engine); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + refcount = IMFMediaEngineEx_Release(media_engine); + ok(!refcount || broken(refcount == 1) /* Win8.1 */, "Got unexpected refcount %lu.\n", refcount); + IMFByteStream_Release(unseekable_stream); + SysFreeString(url); + IMFByteStream_Release(stream); +} + START_TEST(mfmediaengine) { HRESULT hr; @@ -2539,6 +2739,7 @@ START_TEST(mfmediaengine) test_GetDuration(); test_GetSeekable(); test_media_extension(); + test_SetCurrentTime(); IMFMediaEngineClassFactory_Release(factory); From 7f3a30f73e1b563689ce7aaf944dc77071b79684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 4 Mar 2024 20:05:59 +0100 Subject: [PATCH 1414/1506] winegstreamer: Remove pixel-aspect-ratio attribute which we don't support. CW-Bug-Id: #23478 --- dlls/winegstreamer/wg_format.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index e6fc0f7b351..6a1e6ac15b4 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -653,6 +653,7 @@ static GstCaps *wg_format_to_caps_video(const struct wg_format *format) /* Remove fields which we don't specify but might have some default value */ gst_structure_remove_fields(structure, "colorimetry", "chroma-site", NULL); + gst_structure_remove_fields(structure, "pixel-aspect-ratio", NULL); } } return caps; From d4ff683aacb5d995c59695d98133adede2daef8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 26 Mar 2024 16:51:37 +0100 Subject: [PATCH 1415/1506] winegstreamer: Set GST_DEBUG if not set, based on WINEDEBUG channels. --- dlls/winegstreamer/main.c | 10 +++++++++- dlls/winegstreamer/unixlib.c | 9 +++++++++ dlls/winegstreamer/unixlib.h | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 0276aa947b4..992f6b3ae98 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -33,6 +33,8 @@ #include "wmcodecdsp.h" WINE_DEFAULT_DEBUG_CHANNEL(quartz); +WINE_DECLARE_DEBUG_CHANNEL(mfplat); +WINE_DECLARE_DEBUG_CHANNEL(wmvcore); DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); DEFINE_GUID(MEDIASUBTYPE_VC1S,MAKEFOURCC('V','C','1','S'),0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71); @@ -1005,9 +1007,15 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) static BOOL CALLBACK init_gstreamer_proc(INIT_ONCE *once, void *param, void **ctx) { + struct wg_init_gstreamer_params params = + { + .trace_on = TRACE_ON(mfplat) || TRACE_ON(quartz) || TRACE_ON(wmvcore), + .warn_on = WARN_ON(mfplat) || WARN_ON(quartz) || WARN_ON(wmvcore), + .err_on = ERR_ON(mfplat) || ERR_ON(quartz) || ERR_ON(wmvcore), + }; HINSTANCE handle; - if (WINE_UNIX_CALL(unix_wg_init_gstreamer, NULL)) + if (WINE_UNIX_CALL(unix_wg_init_gstreamer, ¶ms)) return FALSE; /* Unloading glib is a bad idea.. it installs atexit handlers, diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index 4ac667350d0..3c51c83b348 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -247,6 +247,7 @@ bool push_event(GstPad *pad, GstEvent *event) NTSTATUS wg_init_gstreamer(void *arg) { + struct wg_init_gstreamer_params *params = arg; static GstGLContext *gl_context; char arg0[] = "wine"; @@ -273,6 +274,14 @@ NTSTATUS wg_init_gstreamer(void *arg) setenv("GST_REGISTRY_1_0", gst_reg, 1); } + if (params->trace_on) + setenv("GST_DEBUG", "WINE:9,protonmediaconverter:9,4", FALSE); + if (params->warn_on) + setenv("GST_DEBUG", "WINE:3,protonmediaconverter:3,3", FALSE); + if (params->err_on) + setenv("GST_DEBUG", "WINE:1,protonmediaconverter:1,1", FALSE); + setenv("GST_DEBUG_NO_COLOR", "1", FALSE); + /* GStreamer installs a temporary SEGV handler when it loads plugins * to initialize its registry calling exit(-1) when any fault is caught. * We need to make sure any signal reaches our signal handlers to catch diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 1e74a36764f..fe21a24f6f5 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -236,6 +236,13 @@ typedef UINT64 wg_source_t; typedef UINT64 wg_transform_t; typedef UINT64 wg_muxer_t; +struct wg_init_gstreamer_params +{ + UINT8 trace_on; + UINT8 warn_on; + UINT8 err_on; +}; + struct wg_parser_create_params { wg_parser_t parser; From cd09f433a4ad41dad28617bf8a780afce5099053 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 26 Mar 2024 15:40:35 -0600 Subject: [PATCH 1416/1506] fixup! ntdll: Implement CPU topology override. CW-Bug-Id: #22223 --- dlls/ntdll/unix/system.c | 71 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 4a1e41e7e42..8e2736b05b0 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -242,7 +242,7 @@ static pthread_mutex_t timezone_mutex = PTHREAD_MUTEX_INITIALIZER; static struct { struct cpu_topology_override mapping; - BOOL smt; + ULONG_PTR siblings_mask[MAXIMUM_PROCESSORS]; } cpu_override; @@ -574,9 +574,13 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info ) #endif /* End architecture specific feature detection for CPUs */ +static void fill_performance_core_info(void); +static BOOL sysfs_parse_bitmap(const char *filename, ULONG_PTR *mask); + static void fill_cpu_override(unsigned int host_cpu_count) { const char *env_override = getenv("WINE_CPU_TOPOLOGY"); + BOOL smt = FALSE; unsigned int i; char *s; @@ -593,6 +597,58 @@ static void fill_cpu_override(unsigned int host_cpu_count) goto error; } + if (!*s) + { + /* Auto assign given number of logical CPUs. */ + static const char core_info[] = "/sys/devices/system/cpu/cpu%u/topology/%s"; + char name[MAX_PATH]; + unsigned int attempt, count, j; + ULONG_PTR masks[MAXIMUM_PROCESSORS]; + + if (cpu_override.mapping.cpu_count >= host_cpu_count) + { + TRACE( "Override cpu count %u >= host cpu count %u.\n", cpu_override.mapping.cpu_count, host_cpu_count ); + cpu_override.mapping.cpu_count = 0; + return; + } + + fill_performance_core_info(); + + for (i = 0; i < host_cpu_count; ++i) + { + snprintf(name, sizeof(name), core_info, i, "thread_siblings"); + masks[i] = 0; + sysfs_parse_bitmap(name, &masks[i]); + } + for (attempt = 0; attempt < 3; ++attempt) + { + count = 0; + for (i = 0; i < host_cpu_count && count < cpu_override.mapping.cpu_count; ++i) + { + if (attempt < 2 && performance_cores_capacity) + { + if (i / 32 >= performance_cores_capacity) break; + if (!(performance_cores[i / 32] & (1 << (i % 32)))) goto skip_cpu; + } + cpu_override.mapping.host_cpu_id[count] = i; + cpu_override.siblings_mask[count] = (ULONG_PTR)1 << count; + for (j = 0; j < count; ++j) + { + if (!(masks[cpu_override.mapping.host_cpu_id[j]] & masks[i])) continue; + if (attempt < 1) goto skip_cpu; + cpu_override.siblings_mask[j] |= (ULONG_PTR)1 << count; + cpu_override.siblings_mask[count] |= (ULONG_PTR)1 << j; + } + ++count; +skip_cpu: + ; + } + if (count == cpu_override.mapping.cpu_count) break; + } + assert( count == cpu_override.mapping.cpu_count ); + goto done; + } + if (tolower(*s) == 's') { cpu_override.mapping.cpu_count *= 2; @@ -601,7 +657,7 @@ static void fill_cpu_override(unsigned int host_cpu_count) ERR("Logical CPU count exceeds limit %u.\n", MAXIMUM_PROCESSORS); goto error; } - cpu_override.smt = TRUE; + smt = TRUE; ++s; } if (*s != ':') @@ -624,6 +680,8 @@ static void fill_cpu_override(unsigned int host_cpu_count) } cpu_override.mapping.host_cpu_id[i] = strtol(s, &next, 10); + if (smt) cpu_override.siblings_mask[i] = (ULONG_PTR)3 << (i & ~1); + else cpu_override.siblings_mask[i] = (ULONG_PTR)1 << i; if (next == s) goto error; if (cpu_override.mapping.host_cpu_id[i] >= host_cpu_count) @@ -637,6 +695,7 @@ static void fill_cpu_override(unsigned int host_cpu_count) if (*s) goto error; +done: if (ERR_ON(ntdll)) { MESSAGE("wine: overriding CPU configuration, %u logical CPUs, host CPUs ", cpu_override.mapping.cpu_count); @@ -955,6 +1014,8 @@ static void fill_performance_core_info(void) char op = ','; ULONG *p; + if (performance_cores_capacity) return; + fpcore_list = fopen("/sys/devices/cpu_core/cpus", "r"); if (!fpcore_list) return; @@ -1070,7 +1131,7 @@ static NTSTATUS create_logical_proc_info(void) snprintf(name, sizeof(name), core_info, i, "thread_siblings"); if (cpu_override.mapping.cpu_count) { - thread_mask = cpu_override.smt ? (ULONG_PTR)0x3 << (i & ~1) : (ULONG_PTR)1 << i; + thread_mask = cpu_override.siblings_mask[i]; } else { @@ -1081,7 +1142,9 @@ static NTSTATUS create_logical_proc_info(void) if (cpu_override.mapping.cpu_count) { - phys_core = cpu_override.smt ? i / 2 : i; + assert( thread_mask ); + for (phys_core = 0; ; ++phys_core) + if (thread_mask & ((ULONG_PTR)1 << phys_core)) break; } else { From 86961195d589a8ed9894e4cc4d324f6bc664badc Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 26 Mar 2024 17:27:42 -0600 Subject: [PATCH 1417/1506] Revert "ntdll: Validate xstate alignment in validate_context_xstate()." This reverts commit f3757df4074d132647aa74be1428b9948ff0a7ad. CW-Bug-Id: #23244 --- dlls/ntdll/tests/exception.c | 14 -------------- dlls/ntdll/unix/thread.c | 2 -- 2 files changed, 16 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index bb62d4627a5..76190aef75a 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -10895,7 +10895,6 @@ static void test_extended_context(void) CONTEXT_EX *context_ex; CONTEXT *context; unsigned data[8]; - NTSTATUS status; HANDLE thread; ULONG64 mask; XSTATE *xs; @@ -11689,19 +11688,6 @@ static void test_extended_context(void) thread = CreateThread(NULL, 0, test_extended_context_thread, 0, CREATE_SUSPENDED, NULL); ok(!!thread, "Failed to create thread.\n"); - /* Unaligned xstate. */ - length = sizeof(context_buffer); - memset(context_buffer, 0xcc, sizeof(context_buffer)); - bret = pInitializeContext(context_buffer, CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT, - &context, &length); - ok(bret, "Got unexpected bret %#x.\n", bret); - context_ex = (CONTEXT_EX *)(context + 1); - context_ex->XState.Offset += 0x10; - status = pNtGetContextThread(thread, context); - ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status); - status = pNtGetContextThread(GetCurrentThread(), context); - ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status); - bret = pInitializeContext(context_buffer, CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT, &context, &length); ok(bret, "Got unexpected bret %#x.\n", bret); diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index c69d3de3e15..7416de09168 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -173,8 +173,6 @@ BOOL validate_context_xstate( CONTEXT *context ) || context_ex->XState.Length > sizeof(XSTATE)) return FALSE; - if (((ULONG_PTR)context_ex + context_ex->XState.Offset) & 63) return FALSE; - return TRUE; } From 50c1fd57ee3723ccf7a3981f8b8cd3e0c0106691 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 26 Mar 2024 17:27:43 -0600 Subject: [PATCH 1418/1506] Revert "ntdll: Validate context xstate at once in NtGetContextThread()." This reverts commit 92fe92017e5b6e1cee22b2d4d6b86dbb5014e5c9. CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 4 ++-- dlls/ntdll/unix/signal_x86_64.c | 4 ++-- dlls/ntdll/unix/thread.c | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 5b7d460372c..eb23dd3dc83 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1050,8 +1050,6 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) BOOL use_cached_debug_regs = FALSE; NTSTATUS ret; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; - if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) { /* debug registers require a server call if hw breakpoints are enabled */ @@ -1151,6 +1149,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index f0467def51f..df90157a474 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1088,8 +1088,6 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) BOOL use_cached_debug_regs = FALSE; BOOL self = (handle == GetCurrentThread()); - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; - if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) { /* debug registers require a server call if hw breakpoints are enabled */ @@ -1180,6 +1178,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 7416de09168..c09e5fb9d54 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -165,8 +165,6 @@ BOOL validate_context_xstate( CONTEXT *context ) { CONTEXT_EX *context_ex; - if (!((context->ContextFlags & 0x40) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX))) return TRUE; - context_ex = (CONTEXT_EX *)(context + 1); if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) From dbb8d07b0445764eae4680d4dbb81df1f38f52e8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 26 Mar 2024 17:27:44 -0600 Subject: [PATCH 1419/1506] Revert "ntdll: Factor out validate_context_xstate() function." This reverts commit 96e3ee88b6b23d47ef6ef21adacaee0f72351e05. CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 4 +++- dlls/ntdll/unix/signal_x86_64.c | 4 +++- dlls/ntdll/unix/thread.c | 17 ----------------- dlls/ntdll/unix/unix_private.h | 1 - 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index eb23dd3dc83..98e5e26ffa3 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1149,7 +1149,9 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) + || context_ex->XState.Length > sizeof(XSTATE)) + return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index df90157a474..1953179d76b 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1178,7 +1178,9 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); unsigned int mask; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) + || context_ex->XState.Length > sizeof(XSTATE)) + return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; xstate->Mask = frame->xstate.Mask & mask; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index c09e5fb9d54..73f252853fe 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -158,23 +158,6 @@ void fpu_to_fpux( XMM_SAVE_AREA32 *fpux, const I386_FLOATING_SAVE_AREA *fpu ) } -/*********************************************************************** - * validate_context_xstate - */ -BOOL validate_context_xstate( CONTEXT *context ) -{ - CONTEXT_EX *context_ex; - - context_ex = (CONTEXT_EX *)(context + 1); - - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) - || context_ex->XState.Length > sizeof(XSTATE)) - return FALSE; - - return TRUE; -} - - /*********************************************************************** * get_server_context_flags */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index cf6b9ab0c53..8ba8950fb55 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -235,7 +235,6 @@ extern void DECLSPEC_NORETURN abort_process( int status ); extern void DECLSPEC_NORETURN exit_process( int status ); extern void wait_suspend( CONTEXT *context ); extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ); -extern BOOL validate_context_xstate( CONTEXT *context ); extern NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *self, USHORT machine ); extern NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT machine ); extern unsigned int alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret, From 96ebd03463e65cc98fa4bfa3a39f6ce39ab65dd7 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 18 Jan 2024 15:17:39 -0600 Subject: [PATCH 1420/1506] ntdll: Fix exception list offset in call_user_mode_callback / user_mode_callback_return. (cherry picked from commit 39304daf4d7bdf9d3e617108e4ae4bd6bd7c7d25) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_x86_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 1953179d76b..403112b4ff3 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1620,7 +1620,7 @@ __ASM_GLOBAL_FUNC( call_user_mode_callback, "movq %rax,0xa8(%rsp)\n\t" /* frame->syscall_cfa */ "movq 0x328(%r8),%r10\n\t" /* amd64_thread_data()->syscall_frame */ "movq (%r8),%rax\n\t" /* NtCurrentTeb()->Tib.ExceptionList */ - "movq %rax,0x408(%rsp)\n\t" + "movq %rax,0x400(%rsp)\n\t" "movl 0xb0(%r10),%r14d\n\t" /* prev_frame->syscall_flags */ "movl %r14d,0xb0(%rsp)\n\t" /* frame->syscall_flags */ "movq %r10,0xa0(%rsp)\n\t" /* frame->prev_frame */ @@ -1653,7 +1653,7 @@ __ASM_GLOBAL_FUNC( user_mode_callback_return, __ASM_CFI(".cfi_rel_offset %r13,-0x18\n\t") __ASM_CFI(".cfi_rel_offset %r14,-0x20\n\t") __ASM_CFI(".cfi_rel_offset %r15,-0x28\n\t") - "movq 0x408(%r10),%rax\n\t" /* exception list */ + "movq 0x400(%r10),%rax\n\t" /* exception list */ "movq %rax,0(%rcx)\n\t" /* teb->Tib.ExceptionList */ "movq -0x38(%rbp),%r10\n\t" /* ret_ptr */ "movq -0x40(%rbp),%r11\n\t" /* ret_len */ From 8c4c32747666cd864d51611922ae894649a3f7e5 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 31 Jan 2024 14:24:24 -0600 Subject: [PATCH 1421/1506] ntdll: Don't hardcode xstate feature mask. (cherry picked from commit 1e0728c5d48d87b38c54f655702bf2e639aa4f34) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 61 +++++++++++++++++---------------- dlls/ntdll/unix/signal_x86_64.c | 61 +++++++++++++++++++++------------ dlls/ntdll/unix/system.c | 4 +++ dlls/ntdll/unix/unix_private.h | 9 +++++ 4 files changed, 84 insertions(+), 51 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 98e5e26ffa3..b20303d1b52 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -525,6 +525,7 @@ struct x86_thread_data UINT dr7; /* 1f0 */ SYSTEM_SERVICE_TABLE *syscall_table; /* 1f4 syscall table */ struct syscall_frame *syscall_frame; /* 1f8 frame pointer on syscall entry */ + UINT64 xstate_features_mask; /* 1fc */ }; C_ASSERT( sizeof(struct x86_thread_data) <= sizeof(((struct ntdll_thread_data *)0)->cpu_data) ); @@ -609,8 +610,6 @@ struct xcontext ULONG64 host_compaction_mask; }; -extern BOOL xstate_compaction_enabled; - static inline XSTATE *xstate_from_context( const CONTEXT *context ) { CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1); @@ -832,7 +831,7 @@ static inline void save_context( struct xcontext *xcontext, const ucontext_t *si context->ContextFlags |= CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS; memcpy( context->ExtendedRegisters, fpux, sizeof(*fpux) ); if (!fpu) fpux_to_fpu( &context->FloatSave, fpux ); - if ((cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX) && (xs = XState_sig(fpux))) + if (xstate_extended_features() && (xs = XState_sig(fpux))) { context_init_xstate( context, xs ); xcontext->host_compaction_mask = xs->CompactionMask; @@ -936,7 +935,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) DWORD flags = context->ContextFlags & ~CONTEXT_i386; BOOL self = (handle == GetCurrentThread()); - if ((flags & CONTEXT_XSTATE) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX)) + if ((flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); @@ -944,7 +943,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) || context_ex->XState.Length > sizeof(XSTATE)) return STATUS_INVALID_PARAMETER; - if ((xs->Mask & XSTATE_MASK_GSSE) && (context_ex->XState.Length < sizeof(XSTATE))) + if ((xs->Mask & xstate_extended_features()) && (context_ex->XState.Length < sizeof(XSTATE))) return STATUS_BUFFER_OVERFLOW; } else flags &= ~CONTEXT_XSTATE; @@ -1143,7 +1142,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) context->ContextFlags |= CONTEXT_EXTENDED_REGISTERS; } - if ((needed_flags & CONTEXT_XSTATE) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX)) + if ((needed_flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); @@ -1153,7 +1152,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) || context_ex->XState.Length > sizeof(XSTATE)) return STATUS_INVALID_PARAMETER; - mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; + mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; memset( xstate->Reserved, 0, sizeof(xstate->Reserved) ); @@ -1502,7 +1501,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, void *stack_ptr, context_init_xstate( &stack->context, dst_xs ); memset( dst_xs, 0, offsetof(XSTATE, YmmContext) ); - dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000004 : 0; + dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; if (src_xs->Mask & 4) { dst_xs->Mask = 4; @@ -1604,7 +1603,7 @@ NTSTATUS call_user_exception_dispatcher( EXCEPTION_RECORD *rec, CONTEXT *context context_init_xstate( &stack->context, dst_xs ); memset( dst_xs, 0, offsetof(XSTATE, YmmContext) ); - dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000004 : 0; + dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; if (src_xs->Mask & 4) { dst_xs->Mask = 4; @@ -2518,6 +2517,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB ldt_set_fs( thread_data->fs, teb ); thread_data->gs = get_gs(); thread_data->syscall_table = KeServiceDescriptorTable; + thread_data->xstate_features_mask = xstate_supported_features_mask; context.SegCs = get_cs(); context.SegDs = get_ds(); @@ -2553,6 +2553,8 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB *ctx = context; ctx->ContextFlags = CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS; memset( frame, 0, sizeof(*frame) ); + if (xstate_compaction_enabled) + frame->xstate.CompactionMask = 0x8000000000000000 | xstate_supported_features_mask; NtSetContextThread( GetCurrentThread(), ctx ); stack = (DWORD *)ctx; @@ -2654,26 +2656,27 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "addl %fs:0x1f4,%ebx\n\t" /* x86_thread_data()->syscall_table */ "testl $3,(%ecx)\n\t" /* frame->syscall_flags & (SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC) */ "jz 2f\n\t" - "movl $7,%eax\n\t" - "xorl %edx,%edx\n\t" - "movl %edx,0x240(%ecx)\n\t" - "movl %edx,0x244(%ecx)\n\t" - "movl %edx,0x248(%ecx)\n\t" - "movl %edx,0x24c(%ecx)\n\t" - "movl %edx,0x250(%ecx)\n\t" - "movl %edx,0x254(%ecx)\n\t" + "movl %fs:0x1fc,%eax\n\t" /* x86_thread_data()->xstate_features_mask */ + "movl %fs:0x200,%edx\n\t" /* x86_thread_data()->xstate_features_mask high dword */ + "xorl %edi,%edi\n\t" + "movl %edi,0x240(%ecx)\n\t" + "movl %edi,0x244(%ecx)\n\t" + "movl %edi,0x248(%ecx)\n\t" + "movl %edi,0x24c(%ecx)\n\t" + "movl %edi,0x250(%ecx)\n\t" + "movl %edi,0x254(%ecx)\n\t" "testl $2,(%ecx)\n\t" /* frame->syscall_flags & SYSCALL_HAVE_XSAVEC */ "jz 1f\n\t" - "movl %edx,0x258(%ecx)\n\t" - "movl %edx,0x25c(%ecx)\n\t" - "movl %edx,0x260(%ecx)\n\t" - "movl %edx,0x264(%ecx)\n\t" - "movl %edx,0x268(%ecx)\n\t" - "movl %edx,0x26c(%ecx)\n\t" - "movl %edx,0x270(%ecx)\n\t" - "movl %edx,0x274(%ecx)\n\t" - "movl %edx,0x278(%ecx)\n\t" - "movl %edx,0x27c(%ecx)\n\t" + "movl %edi,0x258(%ecx)\n\t" + "movl %edi,0x25c(%ecx)\n\t" + "movl %edi,0x260(%ecx)\n\t" + "movl %edi,0x264(%ecx)\n\t" + "movl %edi,0x268(%ecx)\n\t" + "movl %edi,0x26c(%ecx)\n\t" + "movl %edi,0x270(%ecx)\n\t" + "movl %edi,0x274(%ecx)\n\t" + "movl %edi,0x278(%ecx)\n\t" + "movl %edi,0x27c(%ecx)\n\t" /* The xsavec instruction is not supported by * binutils < 2.25. */ ".byte 0x0f, 0xc7, 0x61, 0x40\n\t" /* xsavec 0x40(%ecx) */ @@ -2718,8 +2721,8 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "testl $3,%ecx\n\t" /* SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC */ "jz 1f\n\t" "movl %eax,%esi\n\t" - "movl $7,%eax\n\t" - "xorl %edx,%edx\n\t" + "movl %fs:0x1fc,%eax\n\t" /* x86_thread_data()->xstate_features_mask */ + "movl %fs:0x200,%edx\n\t" /* x86_thread_data()->xstate_features_mask high dword */ "xrstor 0x40(%esp)\n\t" "movl %esi,%eax\n\t" "jmp 3f\n" diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 403112b4ff3..8a63ffdd8d6 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -452,6 +452,8 @@ struct amd64_thread_data struct syscall_frame *syscall_frame; /* 0328 syscall frame pointer */ SYSTEM_SERVICE_TABLE *syscall_table; /* 0330 syscall table */ DWORD fs; /* 0338 WOW TEB selector */ + DWORD align; + UINT64 xstate_features_mask; /* 0340 */ }; C_ASSERT( sizeof(struct amd64_thread_data) <= sizeof(((struct ntdll_thread_data *)0)->cpu_data) ); @@ -459,6 +461,7 @@ C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, pth C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, syscall_frame ) == 0x328 ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, syscall_table ) == 0x330 ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, fs ) == 0x338 ); +C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, xstate_features_mask ) == 0x340 ); static inline struct amd64_thread_data *amd64_thread_data(void) { @@ -488,8 +491,6 @@ struct xcontext ULONG64 host_compaction_mask; }; -extern BOOL xstate_compaction_enabled; - static inline XSTATE *xstate_from_context( const CONTEXT *context ) { CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1); @@ -910,7 +911,7 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex context->ContextFlags |= CONTEXT_FLOATING_POINT; context->FltSave = *FPU_sig(sigcontext); context->MxCsr = context->FltSave.MxCsr; - if ((cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX) && (xs = XState_sig(FPU_sig(sigcontext)))) + if (xstate_extended_features() && (xs = XState_sig(FPU_sig(sigcontext)))) { /* xcontext and sigcontext are both on the signal stack, so we can * just reference sigcontext without overflowing 32 bit XState.Offset */ @@ -940,7 +941,7 @@ static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcon amd64_thread_data()->dr7 = context->Dr7; set_sigcontext( context, sigcontext ); if (FPU_sig(sigcontext)) *FPU_sig(sigcontext) = context->FltSave; - if ((cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX) && (xs = XState_sig(FPU_sig(sigcontext)))) + if (xstate_extended_features() && (xs = XState_sig(FPU_sig(sigcontext)))) xs->CompactionMask = xcontext->host_compaction_mask; leave_handler( sigcontext ); } @@ -989,7 +990,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) BOOL self = (handle == GetCurrentThread()); struct syscall_frame *frame = amd64_thread_data()->syscall_frame; - if ((flags & CONTEXT_XSTATE) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX)) + if ((flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); @@ -997,7 +998,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) || context_ex->XState.Length > sizeof(XSTATE)) return STATUS_INVALID_PARAMETER; - if ((xs->Mask & XSTATE_MASK_GSSE) && (context_ex->XState.Length < sizeof(XSTATE))) + if ((xs->Mask & xstate_extended_features()) && (context_ex->XState.Length < sizeof(XSTATE))) return STATUS_BUFFER_OVERFLOW; } else flags &= ~CONTEXT_XSTATE; @@ -1172,7 +1173,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) context->MxCsr = context->FltSave.MxCsr; context->ContextFlags |= CONTEXT_FLOATING_POINT; } - if ((needed_flags & CONTEXT_XSTATE) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX)) + if ((needed_flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); @@ -1182,7 +1183,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) || context_ex->XState.Length > sizeof(XSTATE)) return STATUS_INVALID_PARAMETER; - mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; + mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; memset( xstate->Reserved, 0, sizeof(xstate->Reserved) ); @@ -1406,7 +1407,7 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) context_ex->XState.Length > sizeof(XSTATE)) return STATUS_INVALID_PARAMETER; - mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & XSTATE_MASK_GSSE; + mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; memset( xstate->Reserved, 0, sizeof(xstate->Reserved) ); @@ -1471,7 +1472,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec assert( !((ULONG_PTR)&stack->xstate & 63) ); context_init_xstate( &stack->context, &stack->xstate ); memset( &stack->xstate, 0, offsetof(XSTATE, YmmContext) ); - stack->xstate.CompactionMask = xstate_compaction_enabled ? 0x8000000000000004 : 0; + stack->xstate.CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; if (src_xs->Mask & 4) { stack->xstate.Mask = 4; @@ -2832,6 +2833,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB I386_CONTEXT *wow_context; thread_data->syscall_table = KeServiceDescriptorTable; + thread_data->xstate_features_mask = xstate_supported_features_mask; #if defined __linux__ arch_prctl( ARCH_SET_GS, teb ); @@ -2904,6 +2906,8 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB *ctx = context; ctx->ContextFlags = CONTEXT_FULL; memset( frame, 0, sizeof(*frame) ); + if (xstate_compaction_enabled) + frame->xstate.CompactionMask = 0x8000000000000000 | xstate_supported_features_mask; NtSetContextThread( GetCurrentThread(), ctx ); frame->cs = cs64_sel; @@ -3001,18 +3005,25 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "movl 0xb0(%rcx),%r14d\n\t" /* frame->syscall_flags */ "testl $3,%r14d\n\t" /* SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC */ "jz 2f\n\t" - "movl $7,%eax\n\t" - "xorl %edx,%edx\n\t" - "movq %rdx,0x2c0(%rcx)\n\t" - "movq %rdx,0x2c8(%rcx)\n\t" - "movq %rdx,0x2d0(%rcx)\n\t" +#ifdef __APPLE__ + "movq %gs:0x30,%rdx\n\t" + "movl 0x340(%rdx),%eax\n\t" + "movl 0x344(%rdx),%edx\n\t" +#else + "movl %gs:0x340,%eax\n\t" /* amd64_thread_data()->xstate_features_mask */ + "movl %gs:0x344,%edx\n\t" /* amd64_thread_data()->xstate_features_mask high dword */ +#endif + "xorq %rbp,%rbp\n\t" + "movq %rbp,0x2c0(%rcx)\n\t" + "movq %rbp,0x2c8(%rcx)\n\t" + "movq %rbp,0x2d0(%rcx)\n\t" "testl $2,%r14d\n\t" /* SYSCALL_HAVE_XSAVEC */ "jz 1f\n\t" - "movq %rdx,0x2d8(%rcx)\n\t" - "movq %rdx,0x2e0(%rcx)\n\t" - "movq %rdx,0x2e8(%rcx)\n\t" - "movq %rdx,0x2f0(%rcx)\n\t" - "movq %rdx,0x2f8(%rcx)\n\t" + "movq %rbp,0x2d8(%rcx)\n\t" + "movq %rbp,0x2e0(%rcx)\n\t" + "movq %rbp,0x2e8(%rcx)\n\t" + "movq %rbp,0x2f0(%rcx)\n\t" + "movq %rbp,0x2f8(%rcx)\n\t" /* The xsavec instruction is not supported by * binutils < 2.25. */ ".byte 0x48, 0x0f, 0xc7, 0xa1, 0xc0, 0x00, 0x00, 0x00\n\t" /* xsavec64 0xc0(%rcx) */ @@ -3114,8 +3125,14 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "2:\ttestl $3,%r14d\n\t" /* SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC */ "jz 3f\n\t" "movq %rax,%r11\n\t" - "movl $7,%eax\n\t" - "xorl %edx,%edx\n\t" +#ifdef __APPLE__ + "movq %gs:0x30,%rdx\n\t" + "movl 0x340(%rdx),%eax\n\t" + "movl 0x344(%rdx),%edx\n\t" +#else + "movl %gs:0x340,%eax\n\t" /* amd64_thread_data()->xstate_features_mask */ + "movl %gs:0x344,%edx\n\t" /* amd64_thread_data()->xstate_features_mask high dword */ +#endif "xrstor64 0xc0(%rcx)\n\t" "movq %r11,%rax\n\t" "movl 0xb4(%rcx),%edx\n\t" /* frame->restore_flags */ diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 8e2736b05b0..8ed7b792b60 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -255,6 +255,7 @@ cpu_override; #if defined(__i386__) || defined(__x86_64__) BOOL xstate_compaction_enabled = FALSE; +UINT64 xstate_supported_features_mask; #define AUTH 0x68747541 /* "Auth" */ #define ENTI 0x69746e65 /* "enti" */ @@ -404,6 +405,9 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info ) { do_cpuid( 0x0000000d, 1, regs3 ); /* get XSAVE details */ if (regs3[0] & 2) xstate_compaction_enabled = TRUE; + xstate_supported_features_mask = 3; + if (features & CPU_FEATURE_AVX) + xstate_supported_features_mask |= (UINT64)1 << XSTATE_AVX; } if (regs[1] == AUTH && regs[3] == ENTI && regs[2] == CAMD) diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 8ba8950fb55..7fc5932c1ff 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -227,6 +227,15 @@ extern int server_pipe( int fd[2] ); extern void fpux_to_fpu( I386_FLOATING_SAVE_AREA *fpu, const XSAVE_FORMAT *fpux ); extern void fpu_to_fpux( XSAVE_FORMAT *fpux, const I386_FLOATING_SAVE_AREA *fpu ); + +extern BOOL xstate_compaction_enabled; +extern UINT64 xstate_supported_features_mask; + +static inline UINT64 xstate_extended_features(void) +{ + return xstate_supported_features_mask & ~(UINT64)3; +} + extern void *get_cpu_area( USHORT machine ); extern void set_thread_id( TEB *teb, DWORD pid, DWORD tid ); extern NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR limit, SIZE_T reserve_size, SIZE_T commit_size ); From 46ad15dcd3d8628c0aafde2e5ed1c6d838fdd624 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 31 Jan 2024 16:12:58 -0600 Subject: [PATCH 1422/1506] ntdll: Don't hardcode xstate size in syscall frame. (cherry picked from commit 7ae488a2bb58501684c6475d4942277b852475fc) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 53 ++++++++-------- dlls/ntdll/unix/signal_x86_64.c | 104 +++++++++++++++++++------------- dlls/ntdll/unix/system.c | 21 +++++++ dlls/ntdll/unix/unix_private.h | 3 + include/winnt.h | 8 +++ 5 files changed, 123 insertions(+), 66 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index b20303d1b52..4f192e1df63 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -508,10 +508,10 @@ struct syscall_frame /* Leave space for the whole set of YMM registers. They're not used in * 32-bit mode, but some processors fault if they're not in writable memory. */ - DECLSPEC_ALIGN(64) XSTATE xstate; /* 240 */ + DECLSPEC_ALIGN(64) XSAVE_AREA_HEADER xstate; /* 240 */ }; -C_ASSERT( sizeof(struct syscall_frame) == 0x380 ); +C_ASSERT( sizeof(struct syscall_frame) == 0x280 ); struct x86_thread_data { @@ -526,12 +526,14 @@ struct x86_thread_data SYSTEM_SERVICE_TABLE *syscall_table; /* 1f4 syscall table */ struct syscall_frame *syscall_frame; /* 1f8 frame pointer on syscall entry */ UINT64 xstate_features_mask; /* 1fc */ + UINT xstate_features_size; /* 204 */ }; C_ASSERT( sizeof(struct x86_thread_data) <= sizeof(((struct ntdll_thread_data *)0)->cpu_data) ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, gs ) == 0x1d8 ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, syscall_table ) == 0x1f4 ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, syscall_frame ) == 0x1f8 ); +C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, xstate_features_size ) == 0x204 ); /* flags to control the behavior of the syscall dispatcher */ #define SYSCALL_HAVE_XSAVE 1 @@ -938,12 +940,13 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) if ((flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); + XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) || - context_ex->XState.Length > sizeof(XSTATE)) + if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || + context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; - if ((xs->Mask & xstate_extended_features()) && (context_ex->XState.Length < sizeof(XSTATE))) + if ((xs->Mask & xstate_extended_features()) + && (context_ex->XState.Length < xstate_get_size( xs->CompactionMask, xs->Mask ))) return STATUS_BUFFER_OVERFLOW; } else flags &= ~CONTEXT_XSTATE; @@ -1019,14 +1022,9 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) if (flags & CONTEXT_XSTATE) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); + XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); - if (xs->Mask & XSTATE_MASK_GSSE) - { - frame->xstate.Mask |= XSTATE_MASK_GSSE; - frame->xstate.YmmContext = xs->YmmContext; - } - else frame->xstate.Mask &= ~XSTATE_MASK_GSSE; + copy_xstate( &frame->xstate, xs, xs->Mask ); } frame->restore_flags |= flags & ~CONTEXT_INTEGER; @@ -1145,21 +1143,22 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) if ((needed_flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); - unsigned int mask; + XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + UINT64 mask; - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) - || context_ex->XState.Length > sizeof(XSTATE)) + if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || + context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; - memset( xstate->Reserved, 0, sizeof(xstate->Reserved) ); + memset( xstate->Reserved2, 0, sizeof(xstate->Reserved2) ); if (xstate->Mask) { - if (context_ex->XState.Length < sizeof(XSTATE)) return STATUS_BUFFER_OVERFLOW; - xstate->YmmContext = frame->xstate.YmmContext; + if (context_ex->XState.Length < xstate_get_size( xstate->CompactionMask, xstate->Mask )) + return STATUS_BUFFER_OVERFLOW; + copy_xstate( xstate, &frame->xstate, xstate->Mask ); } } if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386)) @@ -1500,7 +1499,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, void *stack_ptr, XSTATE *dst_xs = (XSTATE *)(((ULONG_PTR)stack->xstate + 63) & ~63); context_init_xstate( &stack->context, dst_xs ); - memset( dst_xs, 0, offsetof(XSTATE, YmmContext) ); + memset( dst_xs, 0, sizeof(XSAVE_AREA_HEADER) ); dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; if (src_xs->Mask & 4) { @@ -1640,7 +1639,8 @@ __ASM_GLOBAL_FUNC( call_user_mode_callback, __ASM_CFI(".cfi_rel_offset %edi,-12\n\t") "movl 0x18(%ebp),%edx\n\t" /* teb */ "pushl 0(%edx)\n\t" /* teb->Tib.ExceptionList */ - "subl $0x380,%esp\n\t" /* sizeof(struct syscall_frame) */ + "subl $0x280,%esp\n\t" /* sizeof(struct syscall_frame) */ + "subl %fs:0x204,%esp\n\t" /* x86_thread_data()->xstate_features_size */ "andl $~63,%esp\n\t" "leal 8(%ebp),%eax\n\t" "movl %eax,0x38(%esp)\n\t" /* frame->syscall_cfa */ @@ -2440,6 +2440,7 @@ NTSTATUS signal_alloc_thread( TEB *teb ) else thread_data->fs = gdt_fs_sel; teb->WOW32Reserved = __wine_syscall_dispatcher; + thread_data->xstate_features_size = xstate_features_size; return STATUS_SUCCESS; } @@ -2468,7 +2469,9 @@ void signal_init_process(void) struct sigaction sig_act; void *kernel_stack = (char *)ntdll_get_thread_data()->kernel_stack + kernel_stack_size; - x86_thread_data()->syscall_frame = (struct syscall_frame *)kernel_stack - 1; + x86_thread_data()->syscall_frame = (struct syscall_frame *)((ULONG_PTR)((char *)kernel_stack + - sizeof(struct syscall_frame) - xstate_features_size) & ~(ULONG_PTR)63); + x86_thread_data()->xstate_features_size = xstate_features_size; if (cpu_info.ProcessorFeatureBits & CPU_FEATURE_FXSR) syscall_flags |= SYSCALL_HAVE_FXSAVE; if (cpu_info.ProcessorFeatureBits & CPU_FEATURE_XSAVE) syscall_flags |= SYSCALL_HAVE_XSAVE; @@ -2518,6 +2521,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB thread_data->gs = get_gs(); thread_data->syscall_table = KeServiceDescriptorTable; thread_data->xstate_features_mask = xstate_supported_features_mask; + assert( thread_data->xstate_features_size == xstate_features_size ); context.SegCs = get_cs(); context.SegDs = get_ds(); @@ -2596,7 +2600,8 @@ __ASM_GLOBAL_FUNC( signal_start_thread, "movl 0x1f8(%ecx),%eax\n\t" /* x86_thread_data()->syscall_frame */ "orl %eax,%eax\n\t" "jnz 1f\n\t" - "leal -0x380(%esp),%eax\n\t" /* sizeof(struct syscall_frame) */ + "leal -0x280(%esp),%eax\n\t" /* sizeof(struct syscall_frame) */ + "subl %fs:0x204,%eax\n\t" /* x86_thread_data()->xstate_features_size */ "andl $~63,%eax\n\t" "movl %eax,0x1f8(%ecx)\n" /* x86_thread_data()->syscall_frame */ /* switch to kernel stack */ diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 8a63ffdd8d6..fb97bf4d598 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -435,10 +435,12 @@ struct syscall_frame DWORD restore_flags; /* 00b4 */ DWORD align[2]; /* 00b8 */ XMM_SAVE_AREA32 xsave; /* 00c0 */ - DECLSPEC_ALIGN(64) XSTATE xstate; /* 02c0 */ + DECLSPEC_ALIGN(64) XSAVE_AREA_HEADER xstate; /* 02c0 */ }; -C_ASSERT( sizeof( struct syscall_frame ) == 0x400); +C_ASSERT( offsetof( struct syscall_frame, xsave ) == 0xc0 ); +C_ASSERT( offsetof( struct syscall_frame, xstate ) == 0x2c0 ); +C_ASSERT( sizeof( struct syscall_frame ) == 0x300); struct amd64_thread_data { @@ -452,7 +454,7 @@ struct amd64_thread_data struct syscall_frame *syscall_frame; /* 0328 syscall frame pointer */ SYSTEM_SERVICE_TABLE *syscall_table; /* 0330 syscall table */ DWORD fs; /* 0338 WOW TEB selector */ - DWORD align; + DWORD xstate_features_size; /* 033c */ UINT64 xstate_features_mask; /* 0340 */ }; @@ -461,6 +463,7 @@ C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, pth C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, syscall_frame ) == 0x328 ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, syscall_table ) == 0x330 ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, fs ) == 0x338 ); +C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, xstate_features_size ) == 0x33c ); C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct amd64_thread_data, xstate_features_mask ) == 0x340 ); static inline struct amd64_thread_data *amd64_thread_data(void) @@ -993,12 +996,13 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) if ((flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); + XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) || - context_ex->XState.Length > sizeof(XSTATE)) + if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || + context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; - if ((xs->Mask & xstate_extended_features()) && (context_ex->XState.Length < sizeof(XSTATE))) + if ((xs->Mask & xstate_extended_features()) + && (context_ex->XState.Length < xstate_get_size( xs->CompactionMask, xs->Mask ))) return STATUS_BUFFER_OVERFLOW; } else flags &= ~CONTEXT_XSTATE; @@ -1063,14 +1067,9 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) if (flags & CONTEXT_XSTATE) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); + XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); - if (xs->Mask & XSTATE_MASK_GSSE) - { - frame->xstate.Mask |= XSTATE_MASK_GSSE; - memcpy( &frame->xstate.YmmContext, &xs->YmmContext, sizeof(xs->YmmContext) ); - } - else frame->xstate.Mask &= ~XSTATE_MASK_GSSE; + copy_xstate( &frame->xstate, xs, xs->Mask ); } frame->restore_flags |= flags & ~CONTEXT_INTEGER; @@ -1176,21 +1175,22 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) if ((needed_flags & CONTEXT_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); - unsigned int mask; + XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + UINT64 mask; - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) - || context_ex->XState.Length > sizeof(XSTATE)) + if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || + context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; - memset( xstate->Reserved, 0, sizeof(xstate->Reserved) ); + memset( xstate->Reserved2, 0, sizeof(xstate->Reserved2) ); if (xstate->Mask) { - if (context_ex->XState.Length < sizeof(XSTATE)) return STATUS_BUFFER_OVERFLOW; - memcpy( &xstate->YmmContext, &frame->xstate.YmmContext, sizeof(xstate->YmmContext) ); + if (context_ex->XState.Length < xstate_get_size( xstate->CompactionMask, xstate->Mask )) + return STATUS_BUFFER_OVERFLOW; + copy_xstate( xstate, &frame->xstate, xstate->Mask ); } } if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) @@ -1309,14 +1309,9 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size ) if (flags & CONTEXT_I386_XSTATE) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xs = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); + XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); - if (xs->Mask & XSTATE_MASK_GSSE) - { - frame->xstate.Mask |= XSTATE_MASK_GSSE; - memcpy( &frame->xstate.YmmContext, &xs->YmmContext, sizeof(xs->YmmContext) ); - } - else frame->xstate.Mask &= ~XSTATE_MASK_GSSE; + copy_xstate( &frame->xstate, xs, xs->Mask ); frame->restore_flags |= CONTEXT_XSTATE; } return STATUS_SUCCESS; @@ -1397,24 +1392,25 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) fpux_to_fpu( &context->FloatSave, &frame->xsave ); context->ContextFlags |= CONTEXT_I386_FLOATING_POINT; } - if ((needed_flags & CONTEXT_I386_XSTATE) && (cpu_info.ProcessorFeatureBits & CPU_FEATURE_AVX)) + if ((needed_flags & CONTEXT_I386_XSTATE) && xstate_extended_features()) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); - XSTATE *xstate = (XSTATE *)((char *)context_ex + context_ex->XState.Offset); - unsigned int mask; + XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + UINT64 mask; - if (context_ex->XState.Length < offsetof(XSTATE, YmmContext) || - context_ex->XState.Length > sizeof(XSTATE)) + if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || + context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; - memset( xstate->Reserved, 0, sizeof(xstate->Reserved) ); + memset( xstate->Reserved2, 0, sizeof(xstate->Reserved2) ); if (xstate->Mask) { - if (context_ex->XState.Length < sizeof(XSTATE)) return STATUS_BUFFER_OVERFLOW; - memcpy( &xstate->YmmContext, &frame->xstate.YmmContext, sizeof(xstate->YmmContext) ); + if (context_ex->XState.Length < xstate_get_size( xstate->CompactionMask, xstate->Mask )) + return STATUS_BUFFER_OVERFLOW; + copy_xstate( xstate, &frame->xstate, xstate->Mask ); } } return STATUS_SUCCESS; @@ -1573,7 +1569,7 @@ NTSTATUS call_user_exception_dispatcher( EXCEPTION_RECORD *rec, CONTEXT *context { assert( !((ULONG_PTR)&stack->xstate & 63) ); context_init_xstate( &stack->context, &stack->xstate ); - memcpy( &stack->xstate, &frame->xstate, sizeof(frame->xstate) ); + memcpy( &stack->xstate, &frame->xstate, sizeof(XSAVE_AREA_HEADER) + xstate_features_size ); } else context_init_xstate( &stack->context, NULL ); @@ -1615,13 +1611,20 @@ __ASM_GLOBAL_FUNC( call_user_mode_callback, "fnstcw -0x2c(%rbp)\n\t" "movq %rsi,-0x38(%rbp)\n\t" /* ret_ptr */ "movq %rdx,-0x40(%rbp)\n\t" /* ret_len */ - "subq $0x408,%rsp\n\t" /* sizeof(struct syscall_frame) + exception */ + "subq $0x308,%rsp\n\t" /* sizeof(struct syscall_frame) + exception */ +#ifdef __APPLE__ + "movq %gs:0x30,%rsi\n\t" + "movl 0x33c(%rsi),%esi\n\t" +#else + "movl %gs:0x33c,%esi\n\t" /* amd64_thread_data()->xstate_features_size */ +#endif + "subq %rsi,%rsp\n\t" "andq $~63,%rsp\n\t" "leaq 0x10(%rbp),%rax\n\t" "movq %rax,0xa8(%rsp)\n\t" /* frame->syscall_cfa */ "movq 0x328(%r8),%r10\n\t" /* amd64_thread_data()->syscall_frame */ "movq (%r8),%rax\n\t" /* NtCurrentTeb()->Tib.ExceptionList */ - "movq %rax,0x400(%rsp)\n\t" + "movq %rax,0x300(%rsp,%rsi)\n\t" "movl 0xb0(%r10),%r14d\n\t" /* prev_frame->syscall_flags */ "movl %r14d,0xb0(%rsp)\n\t" /* frame->syscall_flags */ "movq %r10,0xa0(%rsp)\n\t" /* frame->prev_frame */ @@ -1654,7 +1657,13 @@ __ASM_GLOBAL_FUNC( user_mode_callback_return, __ASM_CFI(".cfi_rel_offset %r13,-0x18\n\t") __ASM_CFI(".cfi_rel_offset %r14,-0x20\n\t") __ASM_CFI(".cfi_rel_offset %r15,-0x28\n\t") - "movq 0x400(%r10),%rax\n\t" /* exception list */ +#ifdef __APPLE__ + "movq %gs:0x30,%rax\n\t" + "movl 0x33c(%rax),%eax\n\t" +#else + "movl %gs:0x33c,%eax\n\t" /* amd64_thread_data()->xstate_features_size */ +#endif + "movq 0x300(%r10,%rax),%rax\n\t" /* exception list */ "movq %rax,0(%rcx)\n\t" /* teb->Tib.ExceptionList */ "movq -0x38(%rbp),%r10\n\t" /* ret_ptr */ "movq -0x40(%rbp),%r11\n\t" /* ret_len */ @@ -2651,6 +2660,7 @@ NTSTATUS signal_alloc_thread( TEB *teb ) } else thread_data->fs = fs32_sel; } + thread_data->xstate_features_size = xstate_features_size; return STATUS_SUCCESS; } @@ -2737,7 +2747,9 @@ void signal_init_process(void) WOW_TEB *wow_teb = get_wow_teb( NtCurrentTeb() ); void *ptr, *kernel_stack = (char *)ntdll_get_thread_data()->kernel_stack + kernel_stack_size; - amd64_thread_data()->syscall_frame = (struct syscall_frame *)kernel_stack - 1; + amd64_thread_data()->syscall_frame = (struct syscall_frame *)((ULONG_PTR)((char *)kernel_stack + - sizeof(struct syscall_frame) - xstate_features_size) & ~(ULONG_PTR)63); + amd64_thread_data()->xstate_features_size = xstate_features_size; /* sneak in a syscall dispatcher pointer at a fixed address (7ffe1000) */ ptr = (char *)user_shared_data + page_size; @@ -2834,6 +2846,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB thread_data->syscall_table = KeServiceDescriptorTable; thread_data->xstate_features_mask = xstate_supported_features_mask; + assert( thread_data->xstate_features_size == xstate_features_size ); #if defined __linux__ arch_prctl( ARCH_SET_GS, teb ); @@ -2950,7 +2963,14 @@ __ASM_GLOBAL_FUNC( signal_start_thread, "movq 0x328(%rcx),%r8\n\t" /* amd64_thread_data()->syscall_frame */ "orq %r8,%r8\n\t" "jnz 1f\n\t" - "leaq -0x400(%rsp),%r8\n\t" /* sizeof(struct syscall_frame) */ + "leaq -0x300(%rsp),%r8\n\t" /* sizeof(struct syscall_frame) */ +#ifdef __APPLE__ + "movq %gs:0x30,%rax\n\t" + "movl 0x33c(%rax),%eax\n\t" +#else + "movl %gs:0x33c,%eax\n\t" /* amd64_thread_data()->xstate_features_size */ +#endif + "subq %rax,%r8\n\t" "andq $~63,%r8\n\t" "movq %r8,0x328(%rcx)\n" /* amd64_thread_data()->syscall_frame */ /* switch to kernel stack */ diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 8ed7b792b60..eaf1f559d71 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -256,6 +256,23 @@ cpu_override; BOOL xstate_compaction_enabled = FALSE; UINT64 xstate_supported_features_mask; +UINT64 xstate_features_size; + +unsigned int xstate_get_size( UINT64 compaction_mask, UINT64 mask ) +{ + if (!(mask & ((UINT64)1 << XSTATE_AVX))) return sizeof(XSAVE_AREA_HEADER); + return sizeof(XSAVE_AREA_HEADER) + sizeof(YMMCONTEXT); +} + +void copy_xstate( XSAVE_AREA_HEADER *dst, XSAVE_AREA_HEADER *src, UINT64 mask ) +{ + mask &= xstate_extended_features() & src->Mask; + if (src->CompactionMask) mask &= src->CompactionMask; + if (dst->CompactionMask) mask &= dst->CompactionMask; + dst->Mask = (dst->Mask & ~xstate_extended_features()) | mask; + if (mask & ((UINT64)1 << XSTATE_AVX)) + *(YMMCONTEXT *)(dst + 1) = *(YMMCONTEXT *)(src + 1); +} #define AUTH 0x68747541 /* "Auth" */ #define ENTI 0x69746e65 /* "enti" */ @@ -408,6 +425,10 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info ) xstate_supported_features_mask = 3; if (features & CPU_FEATURE_AVX) xstate_supported_features_mask |= (UINT64)1 << XSTATE_AVX; + xstate_features_size = xstate_get_size( xstate_compaction_enabled ? 0x8000000000000000 + | xstate_supported_features_mask : 0, xstate_supported_features_mask ) + - sizeof(XSAVE_AREA_HEADER); + xstate_features_size = (xstate_features_size + 15) & ~15; } if (regs[1] == AUTH && regs[3] == ENTI && regs[2] == CAMD) diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 7fc5932c1ff..77a3de4c5d0 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -230,6 +230,9 @@ extern void fpu_to_fpux( XSAVE_FORMAT *fpux, const I386_FLOATING_SAVE_AREA *fpu extern BOOL xstate_compaction_enabled; extern UINT64 xstate_supported_features_mask; +extern UINT64 xstate_features_size; +extern unsigned int xstate_get_size( UINT64 compaction_mask, UINT64 mask ); +extern void copy_xstate( XSAVE_AREA_HEADER *dst, XSAVE_AREA_HEADER *src, UINT64 mask ); static inline UINT64 xstate_extended_features(void) { diff --git a/include/winnt.h b/include/winnt.h index 0e1a197d423..0f7c9430bfd 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -1470,6 +1470,14 @@ typedef struct _XSTATE_CONFIGURATION ULONG64 EnabledUserVisibleSupervisorFeatures; } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION; +typedef struct _XSAVE_AREA_HEADER +{ + DWORD64 Mask; + DWORD64 CompactionMask; + DWORD64 Reserved2[6]; +} +XSAVE_AREA_HEADER, *PXSAVE_AREA_HEADER; + typedef struct _YMMCONTEXT { M128A Ymm0; From 5878caa9e259a429bfb23ee00c49339b39bbac24 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 31 Jan 2024 16:26:16 -0600 Subject: [PATCH 1423/1506] ntdll: Don't hardcode xstate size in exception stack layout. (cherry picked from commit dfe2b717a622fd551053d880d2185281fb237a65) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 63 +++++++++++++++------------------ dlls/ntdll/unix/signal_x86_64.c | 47 ++++++++++++------------ 2 files changed, 53 insertions(+), 57 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 4f192e1df63..b2bdb3a7e20 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -151,7 +151,7 @@ typedef struct ucontext #define FPU_sig(context) ((FLOATING_SAVE_AREA*)((context)->uc_mcontext.fpregs)) #define FPUX_sig(context) (FPU_sig(context) && !((context)->uc_mcontext.fpregs->status >> 16) ? (XSAVE_FORMAT *)(FPU_sig(context) + 1) : NULL) -#define XState_sig(fpu) (((unsigned int *)fpu->Reserved4)[12] == FP_XSTATE_MAGIC1 ? (XSTATE *)(fpu + 1) : NULL) +#define XState_sig(fpu) (((unsigned int *)fpu->Reserved4)[12] == FP_XSTATE_MAGIC1 ? (XSAVE_AREA_HEADER *)(fpu + 1) : NULL) #ifdef __ANDROID__ /* custom signal restorer since we may have unmapped the one in vdso, and bionic doesn't check for that */ @@ -443,12 +443,10 @@ struct exc_stack_layout EXCEPTION_RECORD rec; /* 008 */ CONTEXT context; /* 058 */ CONTEXT_EX context_ex; /* 324 */ - BYTE xstate[sizeof(XSTATE)+64]; /* 33c extra space to allow for 64-byte alignment */ - DWORD align; /* 4bc */ + DWORD align; /* 33c */ }; C_ASSERT( offsetof(struct exc_stack_layout, context) == 0x58 ); -C_ASSERT( offsetof(struct exc_stack_layout, xstate) == 0x33c ); -C_ASSERT( sizeof(struct exc_stack_layout) == 0x4c0 ); +C_ASSERT( sizeof(struct exc_stack_layout) == 0x340 ); /* stack layout when calling KiUserApcDispatcher */ struct apc_stack_layout @@ -612,12 +610,12 @@ struct xcontext ULONG64 host_compaction_mask; }; -static inline XSTATE *xstate_from_context( const CONTEXT *context ) +static inline XSAVE_AREA_HEADER *xstate_from_context( const CONTEXT *context ) { CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1); if ((context->ContextFlags & CONTEXT_XSTATE) != CONTEXT_XSTATE) return NULL; - return (XSTATE *)((char *)xctx + xctx->XState.Offset); + return (XSAVE_AREA_HEADER *)((char *)xctx + xctx->XState.Offset); } static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer ) @@ -630,7 +628,7 @@ static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer ) if (xstate_buffer) { - xctx->XState.Length = sizeof(XSTATE); + xctx->XState.Length = sizeof(XSAVE_AREA_HEADER) + xstate_features_size; xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx; context->ContextFlags |= CONTEXT_XSTATE; @@ -828,7 +826,7 @@ static inline void save_context( struct xcontext *xcontext, const ucontext_t *si } if (fpux) { - XSTATE *xs; + XSAVE_AREA_HEADER *xs; context->ContextFlags |= CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS; memcpy( context->ExtendedRegisters, fpux, sizeof(*fpux) ); @@ -880,16 +878,12 @@ static inline void restore_context( const struct xcontext *xcontext, ucontext_t if (fpu) *fpu = context->FloatSave; if (fpux) { - XSTATE *src_xs, *dst_xs; + XSAVE_AREA_HEADER *xs; memcpy( fpux, context->ExtendedRegisters, sizeof(*fpux) ); - if ((dst_xs = XState_sig(fpux)) && (src_xs = xstate_from_context( context ))) - { - memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) ); - dst_xs->Mask |= src_xs->Mask; - dst_xs->CompactionMask = xcontext->host_compaction_mask; - } + if (xstate_extended_features() && (xs = XState_sig(fpux))) + xs->CompactionMask = xcontext->host_compaction_mask; } if (!fpu && !fpux) restore_fpu( context ); } @@ -1475,8 +1469,10 @@ static void setup_raise_exception( ucontext_t *sigcontext, void *stack_ptr, EXCEPTION_RECORD *rec, struct xcontext *xcontext ) { CONTEXT *context = &xcontext->c; - XSTATE *src_xs; + XSAVE_AREA_HEADER *src_xs; struct exc_stack_layout *stack; + size_t stack_size; + unsigned int xstate_size; NTSTATUS status = send_debug_event( rec, context, TRUE ); if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED) @@ -1488,7 +1484,9 @@ static void setup_raise_exception( ucontext_t *sigcontext, void *stack_ptr, /* fix up instruction pointer in context for EXCEPTION_BREAKPOINT */ if (rec->ExceptionCode == EXCEPTION_BREAKPOINT) context->Eip--; - stack = virtual_setup_exception( stack_ptr, sizeof(*stack), rec ); + xstate_size = sizeof(XSAVE_AREA_HEADER) + xstate_features_size; + stack_size = (ULONG_PTR)stack_ptr - (((ULONG_PTR)stack_ptr - sizeof(*stack) - xstate_size) & ~(ULONG_PTR)63); + stack = virtual_setup_exception( stack_ptr, stack_size, rec ); stack->rec_ptr = &stack->rec; stack->context_ptr = &stack->context; stack->rec = *rec; @@ -1496,16 +1494,13 @@ static void setup_raise_exception( ucontext_t *sigcontext, void *stack_ptr, if ((src_xs = xstate_from_context( context ))) { - XSTATE *dst_xs = (XSTATE *)(((ULONG_PTR)stack->xstate + 63) & ~63); + XSAVE_AREA_HEADER *dst_xs = (XSAVE_AREA_HEADER *)(stack + 1); + assert( !((ULONG_PTR)dst_xs & 63) ); context_init_xstate( &stack->context, dst_xs ); - memset( dst_xs, 0, sizeof(XSAVE_AREA_HEADER) ); + memset( dst_xs, 0, sizeof(*dst_xs) ); dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; - if (src_xs->Mask & 4) - { - dst_xs->Mask = 4; - memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) ); - } + copy_xstate( dst_xs, src_xs, src_xs->Mask ); } else { @@ -1586,11 +1581,14 @@ NTSTATUS call_user_exception_dispatcher( EXCEPTION_RECORD *rec, CONTEXT *context { struct syscall_frame *frame = x86_thread_data()->syscall_frame; ULONG esp = (frame->esp - sizeof(struct exc_stack_layout)) & ~3; - struct exc_stack_layout *stack = (struct exc_stack_layout *)esp; - XSTATE *src_xs; + struct exc_stack_layout *stack; + XSAVE_AREA_HEADER *src_xs; + unsigned int xstate_size; if (rec->ExceptionCode == EXCEPTION_BREAKPOINT) context->Eip--; + xstate_size = sizeof(XSAVE_AREA_HEADER) + xstate_features_size; + stack = (struct exc_stack_layout *)((esp - sizeof(*stack) - xstate_size) & ~(ULONG_PTR)63); stack->rec_ptr = &stack->rec; stack->context_ptr = &stack->context; stack->rec = *rec; @@ -1598,16 +1596,13 @@ NTSTATUS call_user_exception_dispatcher( EXCEPTION_RECORD *rec, CONTEXT *context if ((src_xs = xstate_from_context( context ))) { - XSTATE *dst_xs = (XSTATE *)(((ULONG_PTR)stack->xstate + 63) & ~63); + XSAVE_AREA_HEADER *dst_xs = (XSAVE_AREA_HEADER *)(stack + 1); context_init_xstate( &stack->context, dst_xs ); - memset( dst_xs, 0, offsetof(XSTATE, YmmContext) ); + assert( !((ULONG_PTR)dst_xs & 63) ); + memset( dst_xs, 0, sizeof(*dst_xs) ); dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; - if (src_xs->Mask & 4) - { - dst_xs->Mask = 4; - memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) ); - } + copy_xstate( dst_xs, src_xs, src_xs->Mask ); } else { diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index fb97bf4d598..8c77bcbd970 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -151,7 +151,7 @@ __ASM_GLOBAL_FUNC( alloc_fs_sel, #define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) #define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) #define FPU_sig(context) ((XMM_SAVE_AREA32 *)((context)->uc_mcontext.fpregs)) -#define XState_sig(fpu) (((unsigned int *)fpu->Reserved4)[12] == FP_XSTATE_MAGIC1 ? (XSTATE *)(fpu + 1) : NULL) +#define XState_sig(fpu) (((unsigned int *)fpu->Reserved4)[12] == FP_XSTATE_MAGIC1 ? (XSAVE_AREA_HEADER *)(fpu + 1) : NULL) #elif defined(__FreeBSD__) || defined (__FreeBSD_kernel__) @@ -370,11 +370,10 @@ struct exc_stack_layout ULONG64 align; /* 588 */ struct machine_frame machine_frame; /* 590 */ ULONG64 align2; /* 5b8 */ - XSTATE xstate; /* 5c0 */ }; C_ASSERT( offsetof(struct exc_stack_layout, rec) == 0x4f0 ); C_ASSERT( offsetof(struct exc_stack_layout, machine_frame) == 0x590 ); -C_ASSERT( sizeof(struct exc_stack_layout) == 0x700 ); +C_ASSERT( sizeof(struct exc_stack_layout) == 0x5c0 ); /* stack layout when calling KiUserApcDispatcher */ struct apc_stack_layout @@ -494,12 +493,12 @@ struct xcontext ULONG64 host_compaction_mask; }; -static inline XSTATE *xstate_from_context( const CONTEXT *context ) +static inline XSAVE_AREA_HEADER *xstate_from_context( const CONTEXT *context ) { CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1); if ((context->ContextFlags & CONTEXT_XSTATE) != CONTEXT_XSTATE) return NULL; - return (XSTATE *)((char *)xctx + xctx->XState.Offset); + return (XSAVE_AREA_HEADER *)((char *)xctx + xctx->XState.Offset); } static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer ) @@ -512,7 +511,7 @@ static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer ) if (xstate_buffer) { - xctx->XState.Length = sizeof(XSTATE); + xctx->XState.Length = sizeof(XSAVE_AREA_HEADER) + xstate_features_size; xctx->XState.Offset = (BYTE *)xstate_buffer - (BYTE *)xctx; context->ContextFlags |= CONTEXT_XSTATE; @@ -909,7 +908,7 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex context->Dr7 = amd64_thread_data()->dr7; if (FPU_sig(sigcontext)) { - XSTATE *xs; + XSAVE_AREA_HEADER *xs; context->ContextFlags |= CONTEXT_FLOATING_POINT; context->FltSave = *FPU_sig(sigcontext); @@ -934,7 +933,7 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcontext ) { const CONTEXT *context = &xcontext->c; - XSTATE *xs; + XSAVE_AREA_HEADER *xs; amd64_thread_data()->dr0 = context->Dr0; amd64_thread_data()->dr1 = context->Dr1; @@ -1427,7 +1426,8 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec struct exc_stack_layout *stack; size_t stack_size; NTSTATUS status; - XSTATE *src_xs; + XSAVE_AREA_HEADER *src_xs; + unsigned int xstate_size; if (rec->ExceptionCode == EXCEPTION_SINGLE_STEP) { @@ -1456,7 +1456,8 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec /* fix up instruction pointer in context for EXCEPTION_BREAKPOINT */ if (rec->ExceptionCode == EXCEPTION_BREAKPOINT) context->Rip--; - stack_size = (ULONG_PTR)stack_ptr - (((ULONG_PTR)stack_ptr - sizeof(*stack)) & ~(ULONG_PTR)63); + xstate_size = sizeof(XSAVE_AREA_HEADER) + xstate_features_size; + stack_size = (ULONG_PTR)stack_ptr - (((ULONG_PTR)stack_ptr - sizeof(*stack) - xstate_size) & ~(ULONG_PTR)63); stack = virtual_setup_exception( stack_ptr, stack_size, rec ); stack->rec = *rec; stack->context = *context; @@ -1465,15 +1466,12 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec if ((src_xs = xstate_from_context( context ))) { - assert( !((ULONG_PTR)&stack->xstate & 63) ); - context_init_xstate( &stack->context, &stack->xstate ); - memset( &stack->xstate, 0, offsetof(XSTATE, YmmContext) ); - stack->xstate.CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; - if (src_xs->Mask & 4) - { - stack->xstate.Mask = 4; - memcpy( &stack->xstate.YmmContext, &src_xs->YmmContext, sizeof(stack->xstate.YmmContext) ); - } + XSAVE_AREA_HEADER *dst_xs = (XSAVE_AREA_HEADER *)(stack + 1); + assert( !((ULONG_PTR)dst_xs & 63) ); + context_init_xstate( &stack->context, dst_xs ); + memset( dst_xs, 0, sizeof(*dst_xs) ); + dst_xs->CompactionMask = xstate_compaction_enabled ? 0x8000000000000000 | xstate_extended_features() : 0; + copy_xstate( dst_xs, src_xs, src_xs->Mask ); } else { @@ -1560,16 +1558,19 @@ NTSTATUS call_user_exception_dispatcher( EXCEPTION_RECORD *rec, CONTEXT *context struct syscall_frame *frame = amd64_thread_data()->syscall_frame; struct exc_stack_layout *stack; NTSTATUS status = NtSetContextThread( GetCurrentThread(), context ); + unsigned int xstate_size; if (status) return status; - stack = (struct exc_stack_layout *)((context->Rsp - sizeof(*stack)) & ~(ULONG_PTR)63); + xstate_size = sizeof(XSAVE_AREA_HEADER) + xstate_features_size; + stack = (struct exc_stack_layout *)((context->Rsp - sizeof(*stack) - xstate_size) & ~(ULONG_PTR)63); memmove( &stack->context, context, sizeof(*context) ); if ((context->ContextFlags & CONTEXT_XSTATE) == CONTEXT_XSTATE) { - assert( !((ULONG_PTR)&stack->xstate & 63) ); - context_init_xstate( &stack->context, &stack->xstate ); - memcpy( &stack->xstate, &frame->xstate, sizeof(XSAVE_AREA_HEADER) + xstate_features_size ); + XSAVE_AREA_HEADER *dst_xs = (XSAVE_AREA_HEADER *)(stack + 1); + assert( !((ULONG_PTR)dst_xs & 63) ); + context_init_xstate( &stack->context, dst_xs ); + memcpy( dst_xs, &frame->xstate, sizeof(XSAVE_AREA_HEADER) + xstate_features_size ); } else context_init_xstate( &stack->context, NULL ); From ddebce5c37f7fe03be50f72c16d90f1843a3ff91 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Tue, 20 Feb 2024 21:49:36 -0800 Subject: [PATCH 1424/1506] ntdll: On x86_64, don't access %gs in signal_start_thread(). %gs is not set until call_init_thunk(). Also, adjust other TEB accesses to be consistent with the surrounding functions. Fixes a crash on macOS introduced by 7ae488a2bb58501684c6475d4942277b852475fc ("ntdll: Don't hardcode xstate size in syscall frame.") (cherry picked from commit e628eb2c6ff84ff347d78b0c7a601665a51dbcef) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 4 ++-- dlls/ntdll/unix/signal_x86_64.c | 21 +++------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index b2bdb3a7e20..bb97279fc43 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1635,7 +1635,7 @@ __ASM_GLOBAL_FUNC( call_user_mode_callback, "movl 0x18(%ebp),%edx\n\t" /* teb */ "pushl 0(%edx)\n\t" /* teb->Tib.ExceptionList */ "subl $0x280,%esp\n\t" /* sizeof(struct syscall_frame) */ - "subl %fs:0x204,%esp\n\t" /* x86_thread_data()->xstate_features_size */ + "subl 0x204(%edx),%esp\n\t" /* x86_thread_data()->xstate_features_size */ "andl $~63,%esp\n\t" "leal 8(%ebp),%eax\n\t" "movl %eax,0x38(%esp)\n\t" /* frame->syscall_cfa */ @@ -2596,7 +2596,7 @@ __ASM_GLOBAL_FUNC( signal_start_thread, "orl %eax,%eax\n\t" "jnz 1f\n\t" "leal -0x280(%esp),%eax\n\t" /* sizeof(struct syscall_frame) */ - "subl %fs:0x204,%eax\n\t" /* x86_thread_data()->xstate_features_size */ + "subl 0x204(%ecx),%eax\n\t" /* x86_thread_data()->xstate_features_size */ "andl $~63,%eax\n\t" "movl %eax,0x1f8(%ecx)\n" /* x86_thread_data()->syscall_frame */ /* switch to kernel stack */ diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 8c77bcbd970..06a3eb6d5c7 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1613,12 +1613,7 @@ __ASM_GLOBAL_FUNC( call_user_mode_callback, "movq %rsi,-0x38(%rbp)\n\t" /* ret_ptr */ "movq %rdx,-0x40(%rbp)\n\t" /* ret_len */ "subq $0x308,%rsp\n\t" /* sizeof(struct syscall_frame) + exception */ -#ifdef __APPLE__ - "movq %gs:0x30,%rsi\n\t" - "movl 0x33c(%rsi),%esi\n\t" -#else - "movl %gs:0x33c,%esi\n\t" /* amd64_thread_data()->xstate_features_size */ -#endif + "movl 0x33c(%r8),%esi\n\t" /* amd64_thread_data()->xstate_features_size */ "subq %rsi,%rsp\n\t" "andq $~63,%rsp\n\t" "leaq 0x10(%rbp),%rax\n\t" @@ -1658,12 +1653,7 @@ __ASM_GLOBAL_FUNC( user_mode_callback_return, __ASM_CFI(".cfi_rel_offset %r13,-0x18\n\t") __ASM_CFI(".cfi_rel_offset %r14,-0x20\n\t") __ASM_CFI(".cfi_rel_offset %r15,-0x28\n\t") -#ifdef __APPLE__ - "movq %gs:0x30,%rax\n\t" - "movl 0x33c(%rax),%eax\n\t" -#else - "movl %gs:0x33c,%eax\n\t" /* amd64_thread_data()->xstate_features_size */ -#endif + "movl 0x33c(%rcx),%eax\n\t" /* amd64_thread_data()->xstate_features_size */ "movq 0x300(%r10,%rax),%rax\n\t" /* exception list */ "movq %rax,0(%rcx)\n\t" /* teb->Tib.ExceptionList */ "movq -0x38(%rbp),%r10\n\t" /* ret_ptr */ @@ -2965,12 +2955,7 @@ __ASM_GLOBAL_FUNC( signal_start_thread, "orq %r8,%r8\n\t" "jnz 1f\n\t" "leaq -0x300(%rsp),%r8\n\t" /* sizeof(struct syscall_frame) */ -#ifdef __APPLE__ - "movq %gs:0x30,%rax\n\t" - "movl 0x33c(%rax),%eax\n\t" -#else - "movl %gs:0x33c,%eax\n\t" /* amd64_thread_data()->xstate_features_size */ -#endif + "movl 0x33c(%rcx),%eax\n\t" /* amd64_thread_data()->xstate_features_size */ "subq %rax,%r8\n\t" "andq $~63,%r8\n\t" "movq %r8,0x328(%rcx)\n" /* amd64_thread_data()->syscall_frame */ From 107d15ab18663cebfb7d4597a0e8e81181070cf1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 1 Feb 2024 11:47:42 -0600 Subject: [PATCH 1425/1506] ntdll: Mind context compaction mask in context_from_server(). (cherry picked from commit ba1e2d5dda84f64bd784ae1797ad2825d8b8f096) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 17 ++--------------- dlls/ntdll/unix/signal_x86_64.c | 5 ----- dlls/ntdll/unix/thread.c | 8 ++++---- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index bb97279fc43..42eb89af586 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -607,7 +607,6 @@ struct xcontext { CONTEXT c; CONTEXT_EX c_ex; - ULONG64 host_compaction_mask; }; static inline XSAVE_AREA_HEADER *xstate_from_context( const CONTEXT *context ) @@ -831,11 +830,7 @@ static inline void save_context( struct xcontext *xcontext, const ucontext_t *si context->ContextFlags |= CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS; memcpy( context->ExtendedRegisters, fpux, sizeof(*fpux) ); if (!fpu) fpux_to_fpu( &context->FloatSave, fpux ); - if (xstate_extended_features() && (xs = XState_sig(fpux))) - { - context_init_xstate( context, xs ); - xcontext->host_compaction_mask = xs->CompactionMask; - } + if (xstate_extended_features() && (xs = XState_sig(fpux))) context_init_xstate( context, xs ); } if (!fpu && !fpux) save_fpu( context ); } @@ -876,15 +871,7 @@ static inline void restore_context( const struct xcontext *xcontext, ucontext_t SS_sig(sigcontext) = context->SegSs; if (fpu) *fpu = context->FloatSave; - if (fpux) - { - XSAVE_AREA_HEADER *xs; - - memcpy( fpux, context->ExtendedRegisters, sizeof(*fpux) ); - - if (xstate_extended_features() && (xs = XState_sig(fpux))) - xs->CompactionMask = xcontext->host_compaction_mask; - } + if (fpux) memcpy( fpux, context->ExtendedRegisters, sizeof(*fpux) ); if (!fpu && !fpux) restore_fpu( context ); } diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 06a3eb6d5c7..2143d42b8c6 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -490,7 +490,6 @@ struct xcontext { CONTEXT c; CONTEXT_EX c_ex; - ULONG64 host_compaction_mask; }; static inline XSAVE_AREA_HEADER *xstate_from_context( const CONTEXT *context ) @@ -919,7 +918,6 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex * just reference sigcontext without overflowing 32 bit XState.Offset */ context_init_xstate( context, xs ); assert( xcontext->c_ex.XState.Offset == (BYTE *)xs - (BYTE *)&xcontext->c_ex ); - xcontext->host_compaction_mask = xs->CompactionMask; } } } @@ -933,7 +931,6 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcontext ) { const CONTEXT *context = &xcontext->c; - XSAVE_AREA_HEADER *xs; amd64_thread_data()->dr0 = context->Dr0; amd64_thread_data()->dr1 = context->Dr1; @@ -943,8 +940,6 @@ static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcon amd64_thread_data()->dr7 = context->Dr7; set_sigcontext( context, sigcontext ); if (FPU_sig(sigcontext)) *FPU_sig(sigcontext) = context->FltSave; - if (xstate_extended_features() && (xs = XState_sig(FPU_sig(sigcontext)))) - xs->CompactionMask = xcontext->host_compaction_mask; leave_handler( sigcontext ); } diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 73f252853fe..244305c9df6 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -688,7 +688,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); xs->Mask &= ~4; - if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004; + if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) { if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; @@ -762,7 +762,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); xs->Mask &= ~4; - if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004; + if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) { if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; @@ -837,7 +837,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); xs->Mask &= ~4; - if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004; + if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) { if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; @@ -919,7 +919,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); xs->Mask &= ~4; - if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004; + if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) { if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; From c892efab0835ade9e4c9a7c0c7aac5ea315f7b96 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 1 Feb 2024 12:17:14 -0600 Subject: [PATCH 1426/1506] ntdll: Don't copy xstate from / to syscall frame in usr1_handler(). (cherry picked from commit efd3d31082645fab83c6a4994705654edafa9163) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 44 ++++++++++++++++++++++++--------- dlls/ntdll/unix/signal_x86_64.c | 34 +++++++++++++++++++------ 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 42eb89af586..35d9b1df2bb 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -2138,24 +2138,46 @@ static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext ) */ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { - struct xcontext xcontext; + ucontext_t *ucontext = sigcontext; init_handler( sigcontext ); - if (is_inside_syscall( sigcontext )) + + if (is_inside_syscall( ucontext )) { - DECLSPEC_ALIGN(64) XSTATE xs; - xcontext.c.ContextFlags = CONTEXT_FULL; - context_init_xstate( &xcontext.c, &xs ); + struct syscall_frame *frame = x86_thread_data()->syscall_frame; + ULONG64 saved_compaction = 0; + struct xcontext *context; - NtGetContextThread( GetCurrentThread(), &xcontext.c ); - wait_suspend( &xcontext.c ); - NtSetContextThread( GetCurrentThread(), &xcontext.c ); + context = (struct xcontext *)(((ULONG_PTR)ESP_sig(ucontext) - sizeof(*context)) & ~15); + if ((char *)context < (char *)ntdll_get_thread_data()->kernel_stack) + { + ERR_(seh)( "kernel stack overflow.\n" ); + return; + } + context->c.ContextFlags = CONTEXT_FULL; + NtGetContextThread( GetCurrentThread(), &context->c ); + if (xstate_extended_features()) + { + context_init_xstate( &context->c, &frame->xstate ); + saved_compaction = frame->xstate.CompactionMask; + } + wait_suspend( &context->c ); + if (xstate_extended_features()) frame->xstate.CompactionMask = saved_compaction; + if (context->c.ContextFlags & 0x40) + { + /* xstate is updated directly in frame's xstate */ + context->c.ContextFlags &= ~0x40; + frame->restore_flags |= 0x40; + } + NtSetContextThread( GetCurrentThread(), &context->c ); } else { - save_context( &xcontext, sigcontext ); - wait_suspend( &xcontext.c ); - restore_context( &xcontext, sigcontext ); + struct xcontext context; + + save_context( &context, ucontext ); + wait_suspend( &context.c ); + restore_context( &context, ucontext ); } } diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 2143d42b8c6..2b4483644a5 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2493,20 +2493,40 @@ static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext ) static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { ucontext_t *ucontext = init_handler( sigcontext ); - struct xcontext context; if (is_inside_syscall( ucontext )) { - DECLSPEC_ALIGN(64) XSTATE xs; - context.c.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS; - context_init_xstate( &context.c, &xs ); + struct syscall_frame *frame = amd64_thread_data()->syscall_frame; + ULONG64 saved_compaction = 0; + struct xcontext *context; - NtGetContextThread( GetCurrentThread(), &context.c ); - wait_suspend( &context.c ); - NtSetContextThread( GetCurrentThread(), &context.c ); + context = (struct xcontext *)(((ULONG_PTR)RSP_sig(ucontext) - sizeof(*context)) & ~15); + if ((char *)context < (char *)ntdll_get_thread_data()->kernel_stack) + { + ERR_(seh)( "kernel stack overflow.\n" ); + return; + } + context->c.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS; + NtGetContextThread( GetCurrentThread(), &context->c ); + if (xstate_extended_features()) + { + context_init_xstate( &context->c, &frame->xstate ); + saved_compaction = frame->xstate.CompactionMask; + } + wait_suspend( &context->c ); + if (xstate_extended_features()) frame->xstate.CompactionMask = saved_compaction; + if (context->c.ContextFlags & 0x40) + { + /* xstate is updated directly in frame's xstate */ + context->c.ContextFlags &= ~0x40; + frame->restore_flags |= 0x40; + } + NtSetContextThread( GetCurrentThread(), &context->c ); } else { + struct xcontext context; + save_context( &context, ucontext ); wait_suspend( &context.c ); restore_context( &context, ucontext ); From bb92f28d605f6a07deb9f3c800990b443113d0b9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 18 Jan 2024 11:51:36 -0600 Subject: [PATCH 1427/1506] ntdll: Support generic xstate config in context manipulation functions. (cherry picked from commit beec1b57fbaf9034a05051ea2ceeba0ffdbf0857) CW-Bug-Id: #23244 --- dlls/ntdll/exception.c | 121 ++++++++++++++++++++++++++++++++++------- 1 file changed, 102 insertions(+), 19 deletions(-) diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index 7a230237f0c..d4b5f901e10 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -797,6 +797,52 @@ static const struct context_parameters *context_get_parameters( ULONG context_fl return NULL; } +/* offset is from the start of XSAVE_AREA_HEADER. */ +static int next_compacted_xstate_offset( int off, UINT64 compaction_mask, int feature_idx ) +{ + const UINT64 feature_mask = (UINT64)1 << feature_idx; + + if (compaction_mask & feature_mask) off += user_shared_data->XState.Features[feature_idx].Size; + if (user_shared_data->XState.AlignedFeatures & (feature_mask << 1)) + off = (off + 63) & ~63; + return off; +} + +/* size includes XSAVE_AREA_HEADER but not XSAVE_FORMAT (legacy save area). */ +static int xstate_get_compacted_size( UINT64 mask ) +{ + UINT64 compaction_mask; + unsigned int i; + int off; + + compaction_mask = ((UINT64)1 << 63) | mask; + mask >>= 2; + off = sizeof(XSAVE_AREA_HEADER); + i = 2; + while (mask) + { + if (mask == 1) return off + user_shared_data->XState.Features[i].Size; + off = next_compacted_xstate_offset( off, compaction_mask, i ); + mask >>= 1; + ++i; + } + return off; +} + +static int xstate_get_size( UINT64 mask ) +{ + unsigned int i; + + mask >>= 2; + if (!mask) return sizeof(XSAVE_AREA_HEADER); + i = 2; + while (mask != 1) + { + mask >>= 1; + ++i; + } + return user_shared_data->XState.Features[i].Offset + user_shared_data->XState.Features[i].Size - sizeof(XSAVE_FORMAT); +} /********************************************************************** * RtlGetExtendedContextLength2 (NTDLL.@) @@ -822,12 +868,12 @@ NTSTATUS WINAPI RtlGetExtendedContextLength2( ULONG context_flags, ULONG *length if (!(supported_mask = RtlGetEnabledExtendedFeatures( ~(ULONG64)0) )) return STATUS_NOT_SUPPORTED; - compaction_mask &= supported_mask; - - size = p->context_size + p->context_ex_size + offsetof(XSTATE, YmmContext) + 63; + size = p->context_size + p->context_ex_size + 63; - if (compaction_mask & supported_mask & (1 << XSTATE_AVX)) - size += sizeof(YMMCONTEXT); + compaction_mask &= supported_mask & ~(ULONG64)3; + if (user_shared_data->XState.CompactionEnabled) size += xstate_get_compacted_size( compaction_mask ); + else if (compaction_mask) size += xstate_get_size( compaction_mask ); + else size += sizeof(XSAVE_AREA_HEADER); *length = size; return STATUS_SUCCESS; @@ -878,11 +924,11 @@ NTSTATUS WINAPI RtlInitializeExtendedContext2( void *context, ULONG context_flag xs = (XSTATE *)(((ULONG_PTR)c_ex + p->context_ex_size + 63) & ~(ULONG_PTR)63); c_ex->XState.Offset = (ULONG_PTR)xs - (ULONG_PTR)c_ex; - c_ex->XState.Length = offsetof(XSTATE, YmmContext); compaction_mask &= supported_mask; - if (compaction_mask & (1 << XSTATE_AVX)) - c_ex->XState.Length += sizeof(YMMCONTEXT); + if (user_shared_data->XState.CompactionEnabled) c_ex->XState.Length = xstate_get_compacted_size( compaction_mask ); + else if (compaction_mask & ~(ULONG64)3) c_ex->XState.Length = xstate_get_size( compaction_mask ); + else c_ex->XState.Length = sizeof(XSAVE_AREA_HEADER); memset( xs, 0, c_ex->XState.Length ); if (user_shared_data->XState.CompactionEnabled) @@ -916,6 +962,10 @@ NTSTATUS WINAPI RtlInitializeExtendedContext( void *context, ULONG context_flags void * WINAPI RtlLocateExtendedFeature2( CONTEXT_EX *context_ex, ULONG feature_id, XSTATE_CONFIGURATION *xstate_config, ULONG *length ) { + UINT64 feature_mask = (ULONG64)1 << feature_id; + XSAVE_AREA_HEADER *xs; + unsigned int offset, i; + TRACE( "context_ex %p, feature_id %lu, xstate_config %p, length %p.\n", context_ex, feature_id, xstate_config, length ); @@ -931,16 +981,31 @@ void * WINAPI RtlLocateExtendedFeature2( CONTEXT_EX *context_ex, ULONG feature_i return NULL; } - if (feature_id != XSTATE_AVX) + if (feature_id < 2 || feature_id >= 64) return NULL; + xs = (XSAVE_AREA_HEADER *)((BYTE *)context_ex + context_ex->XState.Offset); + if (length) - *length = sizeof(YMMCONTEXT); + *length = xstate_config->Features[feature_id].Size; + + if (xstate_config->CompactionEnabled) + { + if (!(xs->CompactionMask & feature_mask)) return NULL; + offset = sizeof(XSAVE_AREA_HEADER); + for (i = 2; i < feature_id; ++i) + offset = next_compacted_xstate_offset( offset, xs->CompactionMask, i ); + } + else + { + if (!(feature_mask & xstate_config->EnabledFeatures)) return NULL; + offset = xstate_config->Features[feature_id].Offset - sizeof(XSAVE_FORMAT); + } - if (context_ex->XState.Length < sizeof(XSTATE)) + if (context_ex->XState.Length < offset + xstate_config->Features[feature_id].Size) return NULL; - return (BYTE *)context_ex + context_ex->XState.Offset + offsetof(XSTATE, YmmContext); + return (BYTE *)xs + offset; } @@ -1070,8 +1135,9 @@ NTSTATUS WINAPI RtlCopyContext( CONTEXT *dst, DWORD context_flags, CONTEXT *src NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CONTEXT_EX *src ) { const struct context_parameters *p; - XSTATE *dst_xs, *src_xs; + XSAVE_AREA_HEADER *dst_xs, *src_xs; ULONG64 feature_mask; + unsigned int i, off, size; TRACE( "dst %p, context_flags %#lx, src %p.\n", dst, context_flags, src ); @@ -1086,18 +1152,35 @@ NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CO if (!(context_flags & 0x40)) return STATUS_SUCCESS; - if (dst->XState.Length < offsetof(XSTATE, YmmContext)) + if (dst->XState.Length < sizeof(XSAVE_AREA_HEADER)) return STATUS_BUFFER_OVERFLOW; - dst_xs = (XSTATE *)((BYTE *)dst + dst->XState.Offset); - src_xs = (XSTATE *)((BYTE *)src + src->XState.Offset); + dst_xs = (XSAVE_AREA_HEADER *)((BYTE *)dst + dst->XState.Offset); + src_xs = (XSAVE_AREA_HEADER *)((BYTE *)src + src->XState.Offset); - memset(dst_xs, 0, offsetof(XSTATE, YmmContext)); + memset(dst_xs, 0, sizeof(XSAVE_AREA_HEADER)); dst_xs->Mask = (src_xs->Mask & ~(ULONG64)3) & feature_mask; dst_xs->CompactionMask = user_shared_data->XState.CompactionEnabled ? ((ULONG64)1 << 63) | (src_xs->CompactionMask & feature_mask) : 0; - if (dst_xs->Mask & 4 && src->XState.Length >= sizeof(XSTATE) && dst->XState.Length >= sizeof(XSTATE)) - memcpy( &dst_xs->YmmContext, &src_xs->YmmContext, sizeof(dst_xs->YmmContext) ); + + if (dst_xs->CompactionMask) feature_mask &= dst_xs->CompactionMask; + feature_mask = dst_xs->Mask >> 2; + + i = 2; + off = sizeof(XSAVE_AREA_HEADER); + while (1) + { + if (feature_mask & 1) + { + if (!dst_xs->CompactionMask) off = user_shared_data->XState.Features[i].Offset - sizeof(XSAVE_FORMAT); + size = user_shared_data->XState.Features[i].Size; + if (src->XState.Length < off + size || dst->XState.Length < off + size) break; + memcpy( (BYTE *)dst_xs + off, (BYTE *)src_xs + off, size ); + } + if (!(feature_mask >>= 1)) break; + if (dst_xs->CompactionMask) off = next_compacted_xstate_offset( off, dst_xs->CompactionMask, i); + ++i; + } return STATUS_SUCCESS; } From d80d7511cc111e6eb8d11651257791844c3efd0e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 4 Mar 2024 19:54:54 -0600 Subject: [PATCH 1428/1506] ntdll: Respect red zone in usr1_handler() on x64. Fixes a regression introduced by efd3d31082645fab83c6a4994705654edafa9163. (cherry picked from commit 6f55a13169797dd073575c052a6418e3cecbcfad) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_x86_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 2b4483644a5..3932e64678f 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2500,7 +2500,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ULONG64 saved_compaction = 0; struct xcontext *context; - context = (struct xcontext *)(((ULONG_PTR)RSP_sig(ucontext) - sizeof(*context)) & ~15); + context = (struct xcontext *)(((ULONG_PTR)RSP_sig(ucontext) - 128 /* red zone */ - sizeof(*context)) & ~15); if ((char *)context < (char *)ntdll_get_thread_data()->kernel_stack) { ERR_(seh)( "kernel stack overflow.\n" ); From ab0effdc579524a6ca67c34b4491f83d50b1f1b1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 13:00:30 -0600 Subject: [PATCH 1429/1506] ntdll: Only save AVX xstate in wine_syscall_dispatcher. (cherry picked from commit 7ae23ad7758418012c3d2d40a3acfed5af18afaa) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 6 +++++- dlls/ntdll/unix/signal_x86_64.c | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 35d9b1df2bb..d781bd8b12c 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1005,6 +1005,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); copy_xstate( &frame->xstate, xs, xs->Mask ); } @@ -1131,6 +1132,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; @@ -2158,6 +2160,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) NtGetContextThread( GetCurrentThread(), &context->c ); if (xstate_extended_features()) { + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); context_init_xstate( &context->c, &frame->xstate ); saved_compaction = frame->xstate.CompactionMask; } @@ -2666,7 +2669,8 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "testl $3,(%ecx)\n\t" /* frame->syscall_flags & (SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC) */ "jz 2f\n\t" "movl %fs:0x1fc,%eax\n\t" /* x86_thread_data()->xstate_features_mask */ - "movl %fs:0x200,%edx\n\t" /* x86_thread_data()->xstate_features_mask high dword */ + "xorl %edx,%edx\n\t" + "andl $7,%eax\n\t" "xorl %edi,%edi\n\t" "movl %edi,0x240(%ecx)\n\t" "movl %edi,0x244(%ecx)\n\t" diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 3932e64678f..1f23d166263 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1063,6 +1063,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); copy_xstate( &frame->xstate, xs, xs->Mask ); } @@ -1176,6 +1177,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; @@ -1305,6 +1307,7 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size ) CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); copy_xstate( &frame->xstate, xs, xs->Mask ); frame->restore_flags |= CONTEXT_XSTATE; } @@ -1396,6 +1399,7 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return STATUS_INVALID_PARAMETER; + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; xstate->CompactionMask = xstate_compaction_enabled ? (0x8000000000000000 | mask) : 0; @@ -2510,6 +2514,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) NtGetContextThread( GetCurrentThread(), &context->c ); if (xstate_extended_features()) { + if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); context_init_xstate( &context->c, &frame->xstate ); saved_compaction = frame->xstate.CompactionMask; } @@ -3029,11 +3034,11 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, #ifdef __APPLE__ "movq %gs:0x30,%rdx\n\t" "movl 0x340(%rdx),%eax\n\t" - "movl 0x344(%rdx),%edx\n\t" #else "movl %gs:0x340,%eax\n\t" /* amd64_thread_data()->xstate_features_mask */ - "movl %gs:0x344,%edx\n\t" /* amd64_thread_data()->xstate_features_mask high dword */ #endif + "xorl %edx,%edx\n\t" + "andl $7,%eax\n\t" "xorq %rbp,%rbp\n\t" "movq %rbp,0x2c0(%rcx)\n\t" "movq %rbp,0x2c8(%rcx)\n\t" From d2c4325fc196fffdfaec4369d618dc7b015c6df6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 8 Feb 2024 14:09:12 -0600 Subject: [PATCH 1430/1506] ntdll: Preserve untouched parts of xstate in NtSetContextThread(). (cherry picked from commit a10da8a42a25c6b72d863767461b85e1f3f0ea12) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 2 ++ dlls/ntdll/unix/signal_x86_64.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index d781bd8b12c..fe0e0ed771b 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1004,9 +1004,11 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + UINT64 mask = frame->xstate.Mask; if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); copy_xstate( &frame->xstate, xs, xs->Mask ); + if (xs->CompactionMask) frame->xstate.Mask |= mask & ~xs->CompactionMask; } frame->restore_flags |= flags & ~CONTEXT_INTEGER; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 1f23d166263..c7f2e627ed3 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1062,9 +1062,11 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context ) { CONTEXT_EX *context_ex = (CONTEXT_EX *)(context + 1); XSAVE_AREA_HEADER *xs = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); + UINT64 mask = frame->xstate.Mask; if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); copy_xstate( &frame->xstate, xs, xs->Mask ); + if (xs->CompactionMask) frame->xstate.Mask |= mask & ~xs->CompactionMask; } frame->restore_flags |= flags & ~CONTEXT_INTEGER; From 505deaf044461f21dccfba23fc6de90795182dda Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 17 Jan 2024 16:33:33 -0600 Subject: [PATCH 1431/1506] ntdll: Support generic xstate in Unix-side manipulation functions. (cherry picked from commit 6bc2c092327bae6cbf73b75fd33581ee5140a285) CW-Bug-Id: #23244 --- dlls/ntdll/unix/signal_i386.c | 2 ++ dlls/ntdll/unix/signal_x86_64.c | 4 +++ dlls/ntdll/unix/system.c | 48 ++++++++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index fe0e0ed771b..d36636fdcf1 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1144,6 +1144,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) if (context_ex->XState.Length < xstate_get_size( xstate->CompactionMask, xstate->Mask )) return STATUS_BUFFER_OVERFLOW; copy_xstate( xstate, &frame->xstate, xstate->Mask ); + /* copy_xstate may use avx in memcpy, restore xstate not to break the tests. */ + frame->restore_flags |= CONTEXT_XSTATE; } } if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386)) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index c7f2e627ed3..d821cf1293b 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1189,6 +1189,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) if (context_ex->XState.Length < xstate_get_size( xstate->CompactionMask, xstate->Mask )) return STATUS_BUFFER_OVERFLOW; copy_xstate( xstate, &frame->xstate, xstate->Mask ); + /* copy_xstate may use avx in memcpy, restore xstate not to break the tests. */ + frame->restore_flags |= CONTEXT_XSTATE; } } if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) @@ -1411,6 +1413,8 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) if (context_ex->XState.Length < xstate_get_size( xstate->CompactionMask, xstate->Mask )) return STATUS_BUFFER_OVERFLOW; copy_xstate( xstate, &frame->xstate, xstate->Mask ); + /* copy_xstate may use avx in memcpy, restore xstate not to break the tests. */ + frame->restore_flags |= CONTEXT_XSTATE; } } return STATUS_SUCCESS; diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index eaf1f559d71..ea4f1958f6a 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -258,20 +258,60 @@ BOOL xstate_compaction_enabled = FALSE; UINT64 xstate_supported_features_mask; UINT64 xstate_features_size; +static int xstate_feature_offset[64] = {0, 0, 576}; +static int xstate_feature_size[64] = {0, 0, 256}; +static UINT64 xstate_aligned_features; + +static int next_xstate_offset( int off, UINT64 compaction_mask, int feature_idx ) +{ + const UINT64 feature_mask = (UINT64)1 << feature_idx; + + if (!compaction_mask) return xstate_feature_offset[feature_idx + 1] - sizeof(XSAVE_FORMAT); + + if (compaction_mask & feature_mask) off += xstate_feature_size[feature_idx]; + if (xstate_aligned_features & (feature_mask << 1)) + off = (off + 63) & ~63; + return off; +} + unsigned int xstate_get_size( UINT64 compaction_mask, UINT64 mask ) { - if (!(mask & ((UINT64)1 << XSTATE_AVX))) return sizeof(XSAVE_AREA_HEADER); - return sizeof(XSAVE_AREA_HEADER) + sizeof(YMMCONTEXT); + unsigned int i; + int off; + + mask >>= 2; + off = sizeof(XSAVE_AREA_HEADER); + i = 2; + while (mask) + { + if (mask == 1) return off + xstate_feature_size[i]; + off = next_xstate_offset( off, compaction_mask, i ); + mask >>= 1; + ++i; + } + return off; } void copy_xstate( XSAVE_AREA_HEADER *dst, XSAVE_AREA_HEADER *src, UINT64 mask ) { + unsigned int i; + int src_off, dst_off; + mask &= xstate_extended_features() & src->Mask; if (src->CompactionMask) mask &= src->CompactionMask; if (dst->CompactionMask) mask &= dst->CompactionMask; dst->Mask = (dst->Mask & ~xstate_extended_features()) | mask; - if (mask & ((UINT64)1 << XSTATE_AVX)) - *(YMMCONTEXT *)(dst + 1) = *(YMMCONTEXT *)(src + 1); + mask >>= 2; + src_off = dst_off = sizeof(XSAVE_AREA_HEADER); + i = 2; + while (1) + { + if (mask & 1) memcpy( (char *)dst + dst_off, (char *)src + src_off, xstate_feature_size[i] ); + if (!(mask >>= 1)) break; + src_off = next_xstate_offset( src_off, src->CompactionMask, i ); + dst_off = next_xstate_offset( dst_off, dst->CompactionMask, i ); + ++i; + } } #define AUTH 0x68747541 /* "Auth" */ From ee7854f3ece4cccd847945a6e0cdc53fbbccfd4e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 15:00:06 -0600 Subject: [PATCH 1432/1506] ntdll: Factor out xstate_from_server() function. (cherry picked from commit 25e0a2580758282d679dafa557b2c1771410e970) CW-Bug-Id: #23244 --- dlls/ntdll/unix/thread.c | 82 +++++++++++++--------------------------- 1 file changed, 26 insertions(+), 56 deletions(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 244305c9df6..7ae18a38ce1 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -610,6 +610,28 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void } +/*********************************************************************** + * xstate_from_server + * + * Copy xstate from the server format. + */ +static void xstate_from_server( CONTEXT_EX *xctx, const context_t *from ) +{ + XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); + unsigned int i; + + xs->Mask &= ~4; + if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; + for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) + { + if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; + memcpy( &xs->YmmContext, &from->ymm.regs, sizeof(xs->YmmContext) ); + xs->Mask |= 4; + break; + } +} + + /*********************************************************************** * context_from_server * @@ -683,20 +705,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma memcpy( to->ExtendedRegisters, from->ext.i386_regs, sizeof(to->ExtendedRegisters) ); } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_I386_XSTATE)) - { - CONTEXT_EX *xctx = (CONTEXT_EX *)(to + 1); - XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); - - xs->Mask &= ~4; - if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; - for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) - { - if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; - memcpy( &xs->YmmContext, &from->ymm.regs, sizeof(xs->YmmContext) ); - xs->Mask |= 4; - break; - } - } + xstate_from_server( (CONTEXT_EX *)(to + 1), from ); return STATUS_SUCCESS; } @@ -757,20 +766,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma to->Dr7 = from->debug.x86_64_regs.dr7; } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_I386_XSTATE)) - { - CONTEXT_EX *xctx = (CONTEXT_EX *)(to + 1); - XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); - - xs->Mask &= ~4; - if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; - for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) - { - if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; - memcpy( &xs->YmmContext, &from->ymm.regs, sizeof(xs->YmmContext) ); - xs->Mask |= 4; - break; - } - } + xstate_from_server( (CONTEXT_EX *)(to + 1), from ); return STATUS_SUCCESS; } @@ -832,20 +828,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma to->Dr7 = from->debug.x86_64_regs.dr7; } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_AMD64_XSTATE)) - { - CONTEXT_EX *xctx = (CONTEXT_EX *)(to + 1); - XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); - - xs->Mask &= ~4; - if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; - for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) - { - if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; - memcpy( &xs->YmmContext, &from->ymm.regs, sizeof(xs->YmmContext) ); - xs->Mask |= 4; - break; - } - } + xstate_from_server( (CONTEXT_EX *)(to + 1), from ); return STATUS_SUCCESS; } @@ -914,20 +897,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma to->Dr7 = from->debug.i386_regs.dr7; } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_AMD64_XSTATE)) - { - CONTEXT_EX *xctx = (CONTEXT_EX *)(to + 1); - XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); - - xs->Mask &= ~4; - if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; - for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) - { - if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; - memcpy( &xs->YmmContext, &from->ymm.regs, sizeof(xs->YmmContext) ); - xs->Mask |= 4; - break; - } - } + xstate_from_server( (CONTEXT_EX *)(to + 1), from ); return STATUS_SUCCESS; } From 172e161dea502cfea96846017a8dffb6b464f442 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 15:29:50 -0600 Subject: [PATCH 1433/1506] ntdll: Factor out context_to_server() function. (cherry picked from commit a9d77d098928f6521bef7c1b1739429b8fe11ebd) CW-Bug-Id: #23244 --- dlls/ntdll/unix/thread.c | 46 ++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 7ae18a38ce1..d821fe848c7 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -224,6 +224,20 @@ static unsigned int get_native_context_flags( USHORT native_machine, USHORT wow_ } +/*********************************************************************** + * xstate_to_server + * + * Copy xstate to the server format. + */ +static void xstate_to_server( context_t *to, const CONTEXT_EX *xctx ) +{ + const XSTATE *xs = (const XSTATE *)((const char *)xctx + xctx->XState.Offset); + + to->flags |= SERVER_CTX_YMM_REGISTERS; + if (xs->Mask & 4) memcpy( &to->ymm.regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext) ); +} + + /*********************************************************************** * context_to_server * @@ -300,13 +314,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void memcpy( to->ext.i386_regs, from->ExtendedRegisters, sizeof(to->ext.i386_regs) ); } if (flags & CONTEXT_I386_XSTATE) - { - const CONTEXT_EX *xctx = (const CONTEXT_EX *)(from + 1); - const XSTATE *xs = (const XSTATE *)((const char *)xctx + xctx->XState.Offset); - - to->flags |= SERVER_CTX_YMM_REGISTERS; - if (xs->Mask & 4) memcpy( &to->ymm.regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext) ); - } + xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); return STATUS_SUCCESS; } @@ -364,13 +372,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void fpu_to_fpux( (XMM_SAVE_AREA32 *)to->fp.x86_64_regs.fpregs, &from->FloatSave ); } if (flags & CONTEXT_I386_XSTATE) - { - const CONTEXT_EX *xctx = (const CONTEXT_EX *)(from + 1); - const XSTATE *xs = (const XSTATE *)((const char *)xctx + xctx->XState.Offset); - - to->flags |= SERVER_CTX_YMM_REGISTERS; - if (xs->Mask & 4) memcpy( &to->ymm.regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext) ); - } + xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); return STATUS_SUCCESS; } @@ -431,13 +433,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void to->debug.x86_64_regs.dr7 = from->Dr7; } if (flags & CONTEXT_AMD64_XSTATE) - { - const CONTEXT_EX *xctx = (const CONTEXT_EX *)(from + 1); - const XSTATE *xs = (const XSTATE *)((const char *)xctx + xctx->XState.Offset); - - to->flags |= SERVER_CTX_YMM_REGISTERS; - if (xs->Mask & 4) memcpy( &to->ymm.regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext) ); - } + xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); return STATUS_SUCCESS; } @@ -502,13 +498,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void to->debug.i386_regs.dr7 = from->Dr7; } if (flags & CONTEXT_AMD64_XSTATE) - { - const CONTEXT_EX *xctx = (const CONTEXT_EX *)(from + 1); - const XSTATE *xs = (const XSTATE *)((const char *)xctx + xctx->XState.Offset); - - to->flags |= SERVER_CTX_YMM_REGISTERS; - if (xs->Mask & 4) memcpy( &to->ymm.regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext) ); - } + xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); return STATUS_SUCCESS; } From 6f25b751a19312e383caa04b79b8978425bf8090 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 15:14:50 -0600 Subject: [PATCH 1434/1506] ntdll: Mind generic xstate masks in server context conversion. (cherry picked from commit 3dea242677be1ca7f18ca95b6d9d0aacc5c3f1b9) CW-Bug-Id: #23244 --- dlls/ntdll/unix/thread.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index d821fe848c7..25bc747df70 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -233,6 +233,7 @@ static void xstate_to_server( context_t *to, const CONTEXT_EX *xctx ) { const XSTATE *xs = (const XSTATE *)((const char *)xctx + xctx->XState.Offset); + if (xs->CompactionMask && !(xs->CompactionMask & 4)) return; to->flags |= SERVER_CTX_YMM_REGISTERS; if (xs->Mask & 4) memcpy( &to->ymm.regs.ymm_high, &xs->YmmContext, sizeof(xs->YmmContext) ); } @@ -610,8 +611,14 @@ static void xstate_from_server( CONTEXT_EX *xctx, const context_t *from ) XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset); unsigned int i; - xs->Mask &= ~4; - if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004; + xs->Mask &= ~(ULONG64)4; + + if (xs->CompactionMask) + { + xs->CompactionMask &= ~(UINT64)3; + if (!(xs->CompactionMask & 4)) return; + } + for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++) { if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue; From 09031e48d5b6d04b5e4f51b3cc3542186a7d8d6c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 18 Jan 2024 12:59:26 -0600 Subject: [PATCH 1435/1506] ntdll: Support more xstate features. (cherry picked from commit 29c73ee17335b30f3f49c8b3562742c6a35b482c) CW-Bug-Id: #23244 --- dlls/ntdll/tests/exception.c | 2 +- dlls/ntdll/unix/system.c | 40 +++++++++++++++++++++---- programs/wineboot/wineboot.c | 58 ++++++++++++++++++++++++++---------- 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 76190aef75a..50f407c4a52 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -10600,7 +10600,7 @@ static DWORD test_extended_context_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGI } else { - ok(xs->Mask == (xsaveopt_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask); + ok((xs->Mask & 7) == (xsaveopt_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask); /* The save area has garbage if xsaveopt is available, so we can't test * its contents. */ diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index ea4f1958f6a..2a3f107e26b 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -258,8 +258,8 @@ BOOL xstate_compaction_enabled = FALSE; UINT64 xstate_supported_features_mask; UINT64 xstate_features_size; -static int xstate_feature_offset[64] = {0, 0, 576}; -static int xstate_feature_size[64] = {0, 0, 256}; +static int xstate_feature_offset[64]; +static int xstate_feature_size[64]; static UINT64 xstate_aligned_features; static int next_xstate_offset( int off, UINT64 compaction_mask, int feature_idx ) @@ -353,6 +353,21 @@ __ASM_GLOBAL_FUNC( do_cpuid, "ret" ) #endif +extern UINT64 do_xgetbv( unsigned int cx); +#ifdef __i386__ +__ASM_GLOBAL_FUNC( do_xgetbv, + "movl 4(%esp),%ecx\n\t" + "xgetbv\n\t" + "ret" ) +#else +__ASM_GLOBAL_FUNC( do_xgetbv, + "movl %edi,%ecx\n\t" + "xgetbv\n\t" + "shlq $32,%rdx\n\t" + "orq %rdx,%rax\n\t" + "ret" ) +#endif + #ifdef __i386__ extern int have_cpuid(void); __ASM_GLOBAL_FUNC( have_cpuid, @@ -411,8 +426,11 @@ static void get_cpuid_name( char *buffer ) static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info ) { + static const ULONG64 wine_xstate_supported_features = 0xff; /* XSTATE_AVX, XSTATE_MPX_BNDREGS, XSTATE_MPX_BNDCSR, + * XSTATE_AVX512_KMASK, XSTATE_AVX512_ZMM_H, XSTATE_AVX512_ZMM */ unsigned int regs[4], regs2[4], regs3[4]; ULONGLONG features; + unsigned int i; #if defined(__i386__) info->ProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; @@ -462,13 +480,25 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info ) { do_cpuid( 0x0000000d, 1, regs3 ); /* get XSAVE details */ if (regs3[0] & 2) xstate_compaction_enabled = TRUE; - xstate_supported_features_mask = 3; - if (features & CPU_FEATURE_AVX) - xstate_supported_features_mask |= (UINT64)1 << XSTATE_AVX; + + do_cpuid( 0x0000000d, 0, regs3 ); /* get user xstate features */ + xstate_supported_features_mask = ((ULONG64)regs3[3] << 32) | regs3[0]; + xstate_supported_features_mask &= do_xgetbv( 0 ) & wine_xstate_supported_features; + TRACE("xstate_supported_features_mask %#llx.\n", (long long)xstate_supported_features_mask); + for (i = 2; i < 64; ++i) + { + if (!(xstate_supported_features_mask & ((ULONG64)1 << i))) continue; + do_cpuid( 0x0000000d, i, regs3 ); /* get user xstate features */ + xstate_feature_offset[i] = regs3[1]; + xstate_feature_size[i] = regs3[0]; + if (regs3[2] & 2) xstate_aligned_features |= (ULONG64)1 << i; + TRACE("xstate[%d] offset %d, size %d, aligned %d.\n", i, xstate_feature_offset[i], xstate_feature_size[i], !!(regs3[2] & 2)); + } xstate_features_size = xstate_get_size( xstate_compaction_enabled ? 0x8000000000000000 | xstate_supported_features_mask : 0, xstate_supported_features_mask ) - sizeof(XSAVE_AREA_HEADER); xstate_features_size = (xstate_features_size + 15) & ~15; + TRACE("xstate_features_size %lld.\n", (long long)xstate_features_size); } if (regs[1] == AUTH && regs[3] == ENTI && regs[2] == CAMD) diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 0ea276f6876..ff6bd6cc38c 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -195,10 +195,27 @@ static DWORD set_reg_value_dword( HKEY hkey, const WCHAR *name, DWORD value ) #if defined(__i386__) || defined(__x86_64__) +extern UINT64 WINAPI do_xgetbv( unsigned int cx); +#ifdef __i386__ +__ASM_STDCALL_FUNC( do_xgetbv, 4, + "movl 4(%esp),%ecx\n\t" + "xgetbv\n\t" + "ret $4" ) +#else +__ASM_GLOBAL_FUNC( do_xgetbv, + "xgetbv\n\t" + "shlq $32,%rdx\n\t" + "orq %rdx,%rax\n\t" + "ret" ) +#endif + static void initialize_xstate_features(struct _KUSER_SHARED_DATA *data) { + static const ULONG64 wine_xstate_supported_features = 0xfc; /* XSTATE_AVX, XSTATE_MPX_BNDREGS, XSTATE_MPX_BNDCSR, + * XSTATE_AVX512_KMASK, XSTATE_AVX512_ZMM_H, XSTATE_AVX512_ZMM */ XSTATE_CONFIGURATION *xstate = &data->XState; - unsigned int i; + ULONG64 supported_mask; + unsigned int i, off; int regs[4]; if (!data->ProcessorFeatures[PF_AVX_INSTRUCTIONS_AVAILABLE]) @@ -217,29 +234,40 @@ static void initialize_xstate_features(struct _KUSER_SHARED_DATA *data) __cpuidex(regs, 0xd, 0); TRACE("XSAVE details %#x, %#x, %#x, %#x.\n", regs[0], regs[1], regs[2], regs[3]); - if (!(regs[0] & XSTATE_AVX)) + supported_mask = ((ULONG64)regs[3] << 32) | regs[0]; + supported_mask &= do_xgetbv(0) & wine_xstate_supported_features; + if (!(supported_mask >> 2)) return; - xstate->EnabledFeatures = (1 << XSTATE_LEGACY_FLOATING_POINT) | (1 << XSTATE_LEGACY_SSE) | (1 << XSTATE_AVX); + xstate->EnabledFeatures = (1 << XSTATE_LEGACY_FLOATING_POINT) | (1 << XSTATE_LEGACY_SSE) | supported_mask; xstate->EnabledVolatileFeatures = xstate->EnabledFeatures; - xstate->Size = sizeof(XSAVE_FORMAT) + sizeof(XSTATE); xstate->AllFeatureSize = regs[1]; - xstate->AllFeatures[0] = offsetof(XSAVE_FORMAT, XmmRegisters); - xstate->AllFeatures[1] = sizeof(M128A) * 16; - xstate->AllFeatures[2] = sizeof(YMMCONTEXT); - - for (i = 0; i < 3; ++i) - xstate->Features[i].Size = xstate->AllFeatures[i]; - - xstate->Features[1].Offset = xstate->Features[0].Size; - xstate->Features[2].Offset = sizeof(XSAVE_FORMAT) + offsetof(XSTATE, YmmContext); __cpuidex(regs, 0xd, 1); xstate->OptimizedSave = regs[0] & 1; xstate->CompactionEnabled = !!(regs[0] & 2); - __cpuidex(regs, 0xd, 2); - TRACE("XSAVE feature 2 %#x, %#x, %#x, %#x.\n", regs[0], regs[1], regs[2], regs[3]); + xstate->Features[0].Size = xstate->AllFeatures[0] = offsetof(XSAVE_FORMAT, XmmRegisters); + xstate->Features[1].Size = xstate->AllFeatures[1] = sizeof(M128A) * 16; + xstate->Features[1].Offset = xstate->Features[0].Size; + off = sizeof(XSAVE_FORMAT) + sizeof(XSAVE_AREA_HEADER); + supported_mask >>= 2; + for (i = 2; supported_mask; ++i, supported_mask >>= 1) + { + if (!(supported_mask & 1)) continue; + __cpuidex( regs, 0xd, i ); + xstate->Features[i].Offset = regs[1]; + xstate->Features[i].Size = xstate->AllFeatures[i] = regs[0]; + if (regs[2] & 2) + { + xstate->AlignedFeatures |= (ULONG64)1 << i; + off = (off + 63) & ~63; + } + off += xstate->Features[i].Size; + TRACE("xstate[%d] offset %lu, size %lu, aligned %d.\n", i, xstate->Features[i].Offset, xstate->Features[i].Size, !!(regs[2] & 2)); + } + xstate->Size = xstate->CompactionEnabled ? off : xstate->Features[i - 1].Offset + xstate->Features[i - 1].Size; + TRACE("xstate size %lu, compacted %d, optimized %d.\n", xstate->Size, xstate->CompactionEnabled, xstate->OptimizedSave); } static BOOL is_tsc_trusted_by_the_kernel(void) From 7e4b498161dbdca51cfc15db0e76d1d0e9bc7737 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Mar 2024 13:29:11 -0600 Subject: [PATCH 1436/1506] ntdll/tests: Add more tests for xstate. (cherry picked from commit bb47eb9f723053c512136362a167ddb1cc565d71) CW-Bug-Id: #23244 --- dlls/ntdll/tests/exception.c | 100 +++++++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 50f407c4a52..ad806ded587 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -10546,11 +10546,12 @@ static const unsigned test_extended_context_spoil_data2[8] = {0x15, 0x25, 0x35, static BOOL test_extended_context_modified_state; static BOOL xsaveopt_enabled, compaction_enabled; +static ULONG64 xstate_supported_features; static DWORD test_extended_context_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame, CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher) { - static const ULONG64 expected_compaction_mask = 0x8000000000000004; + const ULONG64 expected_compaction_mask = (0x8000000000000000 | xstate_supported_features) & ~(ULONG64)3; CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1); unsigned int *context_ymm_data; DWORD expected_min_offset; @@ -10588,7 +10589,7 @@ static DWORD test_extended_context_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGI if (compaction_enabled) ok((xs->CompactionMask & (expected_compaction_mask | 3)) == expected_compaction_mask, - "Got compaction mask %#I64x.\n", xs->CompactionMask); + "Got compaction mask %#I64x, expected %#I64x.\n", xs->CompactionMask, expected_compaction_mask); else ok(!xs->CompactionMask, "Got compaction mask %#I64x.\n", xs->CompactionMask); @@ -10883,7 +10884,8 @@ static void test_extended_context(void) }; const struct context_parameters *context_arch; - const ULONG64 supported_features = 7, supported_compaction_mask = supported_features | ((ULONG64)1 << 63); + const ULONG64 supported_features = 0xff; + const ULONG64 supported_compaction_mask = supported_features | ((ULONG64)1 << 63); ULONG expected_length, expected_length_xstate, context_flags, expected_offset, max_xstate_length; ULONG64 enabled_features, expected_compaction; DECLSPEC_ALIGN(64) BYTE context_buffer2[4096]; @@ -10921,6 +10923,7 @@ static void test_extended_context(void) xsaveopt_enabled = regs[0] & 1; compaction_enabled = regs[0] & 2; } + xstate_supported_features = enabled_features & supported_features; /* Test context manipulation functions. */ length = 0xdeadbeef; @@ -11391,7 +11394,7 @@ static void test_extended_context(void) xs->Mask = 0xdeadbeef; xs->CompactionMask = 0xdeadbeef; - bret = pSetXStateFeaturesMask(context, 7); + bret = pSetXStateFeaturesMask(context, xstate_supported_features); ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x.\n", bret); context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset); ok(context_flags == (bret ? flags_fpx : flags), @@ -11405,8 +11408,8 @@ static void test_extended_context(void) mask = 0xdeadbeef; bret = pGetXStateFeaturesMask(context, &mask); if (flags & CONTEXT_NATIVE) - ok(bret && mask == (enabled_features & supported_features), - "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags); + ok(bret && mask == xstate_supported_features, + "Got unexpected bret %#x, mask %s, flags %#lx (enabled_features & supported_features %#I64x).\n", bret, wine_dbgstr_longlong(mask), flags, xstate_supported_features); else ok(!bret && mask == 0xdeadbeef, "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags); @@ -11631,6 +11634,14 @@ static void test_extended_context(void) &context, &length); memset(&xs->YmmContext, 0xcc, sizeof(xs->YmmContext)); ok(bret, "Got unexpected bret %#x.\n", bret); + + /* clear potentially leftover xstate */ + pSetXStateFeaturesMask(context, 0); + context->ContextFlags = CONTEXT_XSTATE; + SetThreadContext(GetCurrentThread(), context); + + context->ContextFlags = CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT; + pSetXStateFeaturesMask(context, ~(ULONG64)0); *(void **)(call_func_code_reset_ymm_state + call_func_offsets.func_addr) = GetThreadContext; *(void **)(call_func_code_reset_ymm_state + call_func_offsets.func_param1) = (void *)GetCurrentThread(); @@ -11648,12 +11659,12 @@ static void test_extended_context(void) ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n", context->ContextFlags); - expected_compaction = compaction_enabled ? ((ULONG64)1 << 63) | 4 : 0; + expected_compaction = compaction_enabled ? ((ULONG64)1 << 63) | (xstate_supported_features & ~(UINT64)3) : 0; xs = (XSTATE *)((BYTE *)context_ex + context_ex->XState.Offset); ok((xs->Mask & supported_features) == (xsaveopt_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask); ok((xs->CompactionMask & (supported_features | ((ULONG64)1 << 63))) == expected_compaction, - "Got unexpected CompactionMask %s.\n", wine_dbgstr_longlong(xs->CompactionMask)); + "Got unexpected CompactionMask %s (expected %#I64x).\n", wine_dbgstr_longlong(xs->CompactionMask), expected_compaction); for (i = 4; i < 8; ++i) ok(!data[i], "Got unexpected data %#x, i %u.\n", data[i], i); @@ -11663,6 +11674,36 @@ static void test_extended_context(void) || broken(((ULONG *)&xs->YmmContext)[i] == test_extended_context_data[i + 4]), "Got unexpected data %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i); + /* Test setting context which has only part of xstate in CompactionMask. */ + if (compaction_enabled && enabled_features & ((ULONG64)1 << XSTATE_AVX512_KMASK)) + { + *(void **)(call_func_code_set_ymm0 + call_func_offsets.func_addr) = SetThreadContext; + *(void **)(call_func_code_set_ymm0 + call_func_offsets.func_param1) = (void *)GetCurrentThread(); + *(void **)(call_func_code_set_ymm0 + call_func_offsets.func_param2) = context; + *(void **)(call_func_code_set_ymm0 + call_func_offsets.ymm0_save) = data; + memcpy(code_mem, call_func_code_set_ymm0, sizeof(call_func_code_set_ymm0)); + context->ContextFlags = CONTEXT_XSTATE; + xs->CompactionMask = 0x8000000000000000 | ((ULONG64)1 << XSTATE_AVX512_KMASK); + xs->Mask = 0; + memcpy(data, test_extended_context_data, sizeof(data)); + bret = func(); + ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); + /* Setting a context with only part of xstate in CompactionMask doesn't change missing parts. */ + for (i = 4; i < 8; ++i) + ok(data[i] == test_extended_context_data[i], "Got unexpected data %#x, i %u.\n", data[i], i); + + memcpy(data, test_extended_context_data, sizeof(data)); + xs->CompactionMask |= XSTATE_MASK_GSSE; + bret = func(); + ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); + for (i = 4; i < 8; ++i) + ok(!data[i], "Got unexpected data %#x, i %u.\n", data[i], i); + } + else + { + skip("avx512 is not available, skipping test.\n"); + } + /* Test fault exception context. */ memset(data, 0xff, sizeof(data)); xs->Mask = 0; @@ -11699,9 +11740,10 @@ static void test_extended_context(void) bret = GetThreadContext(thread, context); ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); todo_wine_if (!xsaveopt_enabled) - ok((xs->Mask & supported_features) == (xsaveopt_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask); + ok((xs->Mask & supported_features) == (xsaveopt_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask); ok((xs->CompactionMask & supported_compaction_mask) == expected_compaction, - "Got unexpected CompactionMask %s.\n", wine_dbgstr_longlong(xs->CompactionMask)); + "Got unexpected CompactionMask %I64x, expected %I64x.\n", xs->CompactionMask, + expected_compaction); for (i = 0; i < 16 * 4; ++i) ok(((ULONG *)&xs->YmmContext)[i] == ((xs->Mask & 4) ? 0 : 0xcccccccc), @@ -11782,6 +11824,44 @@ static void test_extended_context(void) "Got unexpected value %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i); } + if (compaction_enabled && enabled_features & ((ULONG64)1 << XSTATE_AVX512_KMASK)) + { + ULONG64 saved_mask; + ULONG *d; + + saved_mask = xs->CompactionMask; + xs->Mask = XSTATE_MASK_GSSE; + xs->CompactionMask = 0x8000000000000000 | xs->Mask; + *(ULONG *)&xs->YmmContext = 0x11111111; + bret = SetThreadContext(thread, context); + ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); + + xs->Mask = (ULONG64)1 << XSTATE_AVX512_KMASK; + xs->CompactionMask = 0x8000000000000000 | xs->Mask; + *(ULONG *)&xs->YmmContext = 0x22222222; + bret = SetThreadContext(thread, context); + ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); + + xs->CompactionMask = saved_mask; + bret = GetThreadContext(thread, context); + ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); + + todo_wine_if(xs->Mask == XSTATE_MASK_GSSE) + ok((xs->Mask & (XSTATE_MASK_GSSE | ((ULONG64)1 << XSTATE_AVX512_KMASK))) + == (XSTATE_MASK_GSSE | ((ULONG64)1 << XSTATE_AVX512_KMASK)), "got Mask %#I64x.\n", xs->Mask); + d = pLocateXStateFeature(context, XSTATE_AVX, NULL); + ok(!!d, "Got NULL.\n"); + ok(*d == 0x11111111, "got %#lx.\n", *d); + + d = pLocateXStateFeature(context, XSTATE_AVX512_KMASK, NULL); + ok(!!d, "Got NULL.\n"); + todo_wine ok(*d == 0x22222222, "got %#lx.\n", *d); + } + else + { + skip("avx512 is not available, skipping test.\n"); + } + bret = ResumeThread(thread); ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError()); From 0e9e2656590cfe95930a434035227958eaef52ac Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Jun 2022 13:41:44 -0500 Subject: [PATCH 1437/1506] ntdll: Factor out validate_context_xstate() function. CW-Bug-Id: #20821 --- dlls/ntdll/unix/signal_i386.c | 4 +--- dlls/ntdll/unix/signal_x86_64.c | 4 +--- dlls/ntdll/unix/thread.c | 17 +++++++++++++++++ dlls/ntdll/unix/unix_private.h | 1 + 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index d36636fdcf1..c5e7c3ffa98 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1130,9 +1130,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); UINT64 mask; - if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || - context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) - return STATUS_INVALID_PARAMETER; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index d821cf1293b..d292c97f517 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1175,9 +1175,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); UINT64 mask; - if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || - context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) - return STATUS_INVALID_PARAMETER; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 25bc747df70..3e71286d6bf 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -158,6 +158,23 @@ void fpu_to_fpux( XMM_SAVE_AREA32 *fpux, const I386_FLOATING_SAVE_AREA *fpu ) } +/*********************************************************************** + * validate_context_xstate + */ +BOOL validate_context_xstate( CONTEXT *context ) +{ + CONTEXT_EX *context_ex; + + context_ex = (CONTEXT_EX *)(context + 1); + + if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || + context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) + return FALSE; + + return TRUE; +} + + /*********************************************************************** * get_server_context_flags */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 77a3de4c5d0..967422d9288 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -247,6 +247,7 @@ extern void DECLSPEC_NORETURN abort_process( int status ); extern void DECLSPEC_NORETURN exit_process( int status ); extern void wait_suspend( CONTEXT *context ); extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ); +extern BOOL validate_context_xstate( CONTEXT *context ); extern NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *self, USHORT machine ); extern NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT machine ); extern unsigned int alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret, From b2712bd4c10a3ab2b7426b1a62695ceb9675f87a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Jun 2022 13:50:10 -0500 Subject: [PATCH 1438/1506] ntdll: Validate context xstate at once in NtGetContextThread(). CW-Bug-Id: #20821 --- dlls/ntdll/unix/signal_i386.c | 4 ++-- dlls/ntdll/unix/signal_x86_64.c | 4 ++-- dlls/ntdll/unix/thread.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index c5e7c3ffa98..b87fc077602 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1031,6 +1031,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) BOOL use_cached_debug_regs = FALSE; NTSTATUS ret; + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) { /* debug registers require a server call if hw breakpoints are enabled */ @@ -1130,8 +1132,6 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); UINT64 mask; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; - if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index d292c97f517..453be6ca1b3 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1085,6 +1085,8 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) BOOL use_cached_debug_regs = FALSE; BOOL self = (handle == GetCurrentThread()); + if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; + if (self && needed_flags & CONTEXT_DEBUG_REGISTERS) { /* debug registers require a server call if hw breakpoints are enabled */ @@ -1175,8 +1177,6 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) XSAVE_AREA_HEADER *xstate = (XSAVE_AREA_HEADER *)((char *)context_ex + context_ex->XState.Offset); UINT64 mask; - if (!validate_context_xstate( context )) return STATUS_INVALID_PARAMETER; - if (xstate_compaction_enabled) frame->xstate.CompactionMask |= xstate_extended_features(); mask = (xstate_compaction_enabled ? xstate->CompactionMask : xstate->Mask) & xstate_extended_features(); xstate->Mask = frame->xstate.Mask & mask; diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 3e71286d6bf..0f5fbbb9adc 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -165,6 +165,8 @@ BOOL validate_context_xstate( CONTEXT *context ) { CONTEXT_EX *context_ex; + if (!((context->ContextFlags & 0x40) && xstate_extended_features())) return TRUE; + context_ex = (CONTEXT_EX *)(context + 1); if (context_ex->XState.Length < sizeof(XSAVE_AREA_HEADER) || From d1edf798432cf613f60a4d7702a676cb7bac94cd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 16 Jun 2022 13:25:39 -0500 Subject: [PATCH 1439/1506] ntdll: Validate xstate alignment in validate_context_xstate(). CW-Bug-Id: #20821 --- dlls/ntdll/tests/exception.c | 14 ++++++++++++++ dlls/ntdll/unix/thread.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index ad806ded587..3a15c1ac7ab 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -10897,6 +10897,7 @@ static void test_extended_context(void) CONTEXT_EX *context_ex; CONTEXT *context; unsigned data[8]; + NTSTATUS status; HANDLE thread; ULONG64 mask; XSTATE *xs; @@ -11729,6 +11730,19 @@ static void test_extended_context(void) thread = CreateThread(NULL, 0, test_extended_context_thread, 0, CREATE_SUSPENDED, NULL); ok(!!thread, "Failed to create thread.\n"); + /* Unaligned xstate. */ + length = sizeof(context_buffer); + memset(context_buffer, 0xcc, sizeof(context_buffer)); + bret = pInitializeContext(context_buffer, CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT, + &context, &length); + ok(bret, "Got unexpected bret %#x.\n", bret); + context_ex = (CONTEXT_EX *)(context + 1); + context_ex->XState.Offset += 0x10; + status = pNtGetContextThread(thread, context); + ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status); + status = pNtGetContextThread(GetCurrentThread(), context); + ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status); + bret = pInitializeContext(context_buffer, CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT, &context, &length); ok(bret, "Got unexpected bret %#x.\n", bret); diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 0f5fbbb9adc..812302bf346 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -173,6 +173,8 @@ BOOL validate_context_xstate( CONTEXT *context ) context_ex->XState.Length > sizeof(XSAVE_AREA_HEADER) + xstate_features_size) return FALSE; + if (((ULONG_PTR)context_ex + context_ex->XState.Offset) & 63) return FALSE; + return TRUE; } From 85541b13fc1e768e5b3ce8d7cea35f9e933062f8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 27 Mar 2024 17:16:46 -0600 Subject: [PATCH 1440/1506] opengl32: HACK: Fixup shaders for Joe Danger 2: The Movie. CW-Bug-Id: #23619 --- dlls/opengl32/wgl.c | 70 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 7d77296f199..f7dc81daea9 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1297,21 +1297,60 @@ static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLin static int needs_fixup = -1; static unsigned int once; - const char add_ext[] = "#version 120\r\n" - "#extension GL_ARB_explicit_uniform_location : enable\r\n" - "#extension GL_ARB_explicit_attrib_location : enable\r\n"; - const char search_str[] = "uniform mat4 boneMatrices[NBONES];"; - const char prepend_str[] = "layout(location = 2) "; - unsigned int search_len, new_len; + static const struct + { + const char *gameid; + const char *add_ext; + const char *search_str; + const char *prepend_str; + } + replace[] = + { + { + "333420", + + /* add_ext */ + "#version 120\r\n" + "#extension GL_ARB_explicit_uniform_location : enable\r\n" + "#extension GL_ARB_explicit_attrib_location : enable\r\n", + /* search_str */ + "uniform mat4 boneMatrices[NBONES];", + /* replace_str */ + "layout(location = 2) ", + }, + { + "242110", + /* add_ext */ + "#version 120\r\n", + }, + }; + static const char *add_ext; + static const char *search_str; + static const char *prepend_str; + static unsigned int add_ext_len, search_len, prepend_len; + unsigned int new_len; const char *p, *next; BOOL found = FALSE; char *new, *out; if (needs_fixup == -1) { - const char *sgi = getenv("SteamGameId"); + const char *sgi = getenv("SteamGameId"); + unsigned int i; - needs_fixup = sgi && !strcmp( sgi, "333420" ); + for (i = 0; i < ARRAY_SIZE(replace); ++i) + if (!strcmp( sgi, replace[i].gameid )) break; + + needs_fixup = i < ARRAY_SIZE(replace); + if (needs_fixup) + { + add_ext = replace[i].add_ext; + add_ext_len = add_ext ? strlen(add_ext) : 0; + search_str = replace[i].search_str; + search_len = search_str ? strlen(search_str) : 0; + prepend_str = replace[i].prepend_str; + prepend_len = prepend_str ? strlen(prepend_str) : 0; + } } if (!needs_fixup) return NULL; @@ -1322,12 +1361,13 @@ static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLin FIXME( "HACK: Fixing up shader.\n" ); TRACE( "Appending extension string.\n" ); - new_len = strlen( *string ) + sizeof(prepend_str) - 1 + sizeof(add_ext); + new_len = strlen( *string ) + prepend_len + add_ext_len + 1; new = out = malloc( new_len ); - memcpy( out, add_ext, sizeof(add_ext) - 1 ); - out += sizeof(add_ext) - 1; + memcpy( out, add_ext, add_ext_len ); + out += add_ext_len; + + if (!search_str) goto skip_search; - search_len = sizeof(search_str) - 1; next = *string; while (*(p = next)) { @@ -1338,8 +1378,8 @@ static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLin TRACE( "Adding explicit location.\n" ); memcpy( out, *string, p - *string ); out += p - *string; - memcpy( out, prepend_str, sizeof(prepend_str) - 1 ); - out += sizeof(prepend_str) - 1; + memcpy( out, prepend_str, prepend_len ); + out += prepend_len; strcpy( out, p ); found = TRUE; break; @@ -1347,6 +1387,8 @@ static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLin while (*next == '\n' || *next == '\r') ++next; } + +skip_search: if (!found) strcpy( out, *string ); From a2b0f81add60786eb3dad417de1f98ec6e4395cb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 28 Mar 2024 09:58:25 -0600 Subject: [PATCH 1441/1506] opengl32: HACK: Fixup shaders for Joe Danger. CW-Bug-Id: #23619 --- dlls/opengl32/wgl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index f7dc81daea9..251e177ad9c 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1323,6 +1323,11 @@ static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLin /* add_ext */ "#version 120\r\n", }, + { + "229890", + /* add_ext */ + "#version 120\r\n", + }, }; static const char *add_ext; static const char *search_str; From 557bda3ae56c8a849e3b48ec30681f5c47a70ee6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 28 Mar 2024 11:18:03 -0600 Subject: [PATCH 1442/1506] winegstreamer: HACK: Disable MF_SA_D3D11_AWARE for The Finals. CW-Bug-Id: #23621 --- dlls/winegstreamer/video_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c index 3e42d04d75a..44e5c4821f2 100644 --- a/dlls/winegstreamer/video_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -830,7 +830,7 @@ static HRESULT video_decoder_create_with_types(const GUID *const *input_types, U { const char *sgi; - if ((sgi = getenv("SteamGameId")) && ((!strcmp(sgi, "2009100")) || (!strcmp(sgi, "2555360")))) + if ((sgi = getenv("SteamGameId")) && ((!strcmp(sgi, "2073850")) || (!strcmp(sgi, "2009100")) || (!strcmp(sgi, "2555360")))) IMFAttributes_SetUINT32(decoder->attributes, &MF_SA_D3D11_AWARE, FALSE); } From 227315680433b4122a994069c08d993ed0c4281d Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 28 Mar 2024 12:40:37 -0600 Subject: [PATCH 1443/1506] avifil32: Update lCurrentFrame in IGetFrame_fnGetFrame(). CW-Bug-Id: #23631 --- dlls/avifil32/getframe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/avifil32/getframe.c b/dlls/avifil32/getframe.c index c6df7339256..0b58c3f064f 100644 --- a/dlls/avifil32/getframe.c +++ b/dlls/avifil32/getframe.c @@ -254,6 +254,8 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos) } /* for (lNext < lPos) */ } /* if (This->lCurrentFrame != lPos) */ + This->lCurrentFrame = lPos; + return (This->hic == NULL ? This->lpInFormat : This->lpOutFormat); } From 9c3f4f0958ec374a5480535b56683b2581bde418 Mon Sep 17 00:00:00 2001 From: Ziqing Hui Date: Wed, 15 Nov 2023 11:43:21 +0800 Subject: [PATCH 1444/1506] winegstreamer: Integrate media-converter to winegstreamer. CW-Bug-Id: #23225 --- dlls/winegstreamer/Makefile.in | 8 +- .../winegstreamer/media-converter/audioconv.c | 1102 +++++++++++++++++ .../media-converter/audioconvbin.c | 148 +++ .../winegstreamer/media-converter/fossilize.c | 722 +++++++++++ dlls/winegstreamer/media-converter/lib.c | 329 +++++ .../media-converter/media-converter.h | 287 +++++ dlls/winegstreamer/media-converter/murmur3.c | 371 ++++++ .../winegstreamer/media-converter/videoconv.c | 938 ++++++++++++++ dlls/winegstreamer/unixlib.c | 9 + 9 files changed, 3913 insertions(+), 1 deletion(-) create mode 100644 dlls/winegstreamer/media-converter/audioconv.c create mode 100644 dlls/winegstreamer/media-converter/audioconvbin.c create mode 100644 dlls/winegstreamer/media-converter/fossilize.c create mode 100644 dlls/winegstreamer/media-converter/lib.c create mode 100644 dlls/winegstreamer/media-converter/media-converter.h create mode 100644 dlls/winegstreamer/media-converter/murmur3.c create mode 100644 dlls/winegstreamer/media-converter/videoconv.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 9cae96c5ebc..ac38a1b8964 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -32,4 +32,10 @@ SOURCES = \ winegstreamer_classes.idl \ wm_reader.c \ wma_decoder.c \ - wmv_decoder.c + wmv_decoder.c \ + media-converter/audioconv.c \ + media-converter/audioconvbin.c \ + media-converter/fossilize.c \ + media-converter/lib.c \ + media-converter/murmur3.c \ + media-converter/videoconv.c diff --git a/dlls/winegstreamer/media-converter/audioconv.c b/dlls/winegstreamer/media-converter/audioconv.c new file mode 100644 index 00000000000..71612cbfddd --- /dev/null +++ b/dlls/winegstreamer/media-converter/audioconv.c @@ -0,0 +1,1102 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Algorithm + * --------- + * + * The application feeds encoded audio into XAudio2 in chunks. Since we don't have access to all + * chunks in a stream on initialization (as we do with the video converter), we continuously hash + * the stream as it is sent to us. Each "chunk" is identified as the hash of the entire stream up + * to that chunk. + * + * Since chunks are small (~2 kilobytes), this leads to a significant possibility of two different + * streams having identical intro chunks (imagine two streams that start with several seconds of + * silence). This means we need a tree of chunks. Suppose two incoming streams with chunks that + * hash as shown (i.e. identical intro chunks that diverge later): + * + * Stream 1: [AA BB CC DD] + * + * Stream 2: [AA BB YY ZZ] + * + * We record a tree and the transcoder will walk it depth-first in order to reconstruct each unique + * stream: + * + * AA => aa.ptna + * AA+BB => bb.ptna + * AA+BB+CC => cc.ptna + * AA+BB+CC+DD => dd.ptna + * AA+BB+YY => yy.ptna + * AA+BB+YY+ZZ => zz.ptna + * + * Upon playback, we chain each transcoded stream chunk together as the packets come in: + * + * AA -> start stream with aa.ptna + * BB -> play bb.ptna + * CC -> play cc.ptna + * DD -> play dd.ptna + * + * or: + * + * AA -> start stream with aa.ptna + * BB -> play bb.ptna + * YY -> play yy.ptna + * ZZ -> play zz.ptna + * + * or: + * + * AA -> start stream with aa.ptna + * NN -> not recognized, instead play blank.ptna and mark this stream as needs-transcoding + * OO -> play blank.ptna + * PP -> play blank.ptna + * When the Stream is destroyed, we'll record AA+NN+OO+PP into the needs-transcode database + * for the transcoder to convert later. + * + * + * Physical Format + * --------------- + * + * All stored values are little-endian. + * + * Transcoded audio is stored in the "transcoded" Fossilize database under the + * AUDIO_CONV_FOZ_TAG_PTNADATA tag. Each chunk is stored in one entry with as many of the following + * "Proton Audio" (ptna) packets as are required to store the entire transcoded chunk: + * + * uint32_t packet_header: Information about the upcoming packet, see bitmask: + * MSB [FFFF PPPP PPPP PPPP PPPP LLLL LLLL LLLL] LSB + * L: Number of _bytes_ in this packet following this header. + * P: Number of _samples_ at the end of this packet which are padding and should be skipped. + * F: Flag bits: + * 0x1: This packet is an Opus header + * 0x2, 0x4, 0x8: Reserved for future use. + * + * If the Opus header flag is set: + * Following packet is an Opus identification header, as defined in RFC 7845 "Ogg + * Encapsulation for the Opus Audio Codec" Section 5.1. + * + * + * If the header flag is not set: + * Following packet is raw Opus data to be sent to an Opus decoder. + * + * + * If we encounter a stream which needs transcoding, we record the buffers and metadata in + * a Fossilize database. The database has three tag types: + * + * AUDIO_CONV_FOZ_TAG_STREAM: This identifies each unique stream of buffers. For example: + * [hash(AA+BB+CC+DD)] -> [AA, BB, CC, DD] + * [hash(AA+BB+XX+YY)] -> [AA, BB, XX, YY] + * + * AUDIO_CONV_FOZ_TAG_AUDIODATA: This contans the actual encoded audio data. For example: + * [AA] -> [AA's buffer data] + * [BB] -> [BB's buffer data] + * + * AUDIO_CONV_FOZ_TAG_CODECINFO: This contans the codec data required to decode the buffer. Only + * the "head" of each stream is recorded. For example: + * [AA] -> [ + * uint32_t wmaversion (from WAVEFORMATEX.wFormatTag) + * uint32_t bitrate (from WAVEFORMATEX.nAvgBytesPerSec) + * uint32_t channels (WAVEFORMATEX.nChannels) + * uint32_t rate (WAVEFORMATEX.nSamplesPerSec) + * uint32_t block_align (WAVEFORMATEX.nBlockAlign) + * uint32_t depth (WAVEFORMATEX.wBitsPerSample) + * char[remainder of entry] codec_data (codec data which follows WAVEFORMATEX) + * ] + * + */ + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +#include +#include +#include +#include + +GST_DEBUG_CATEGORY_EXTERN(media_converter_debug); +#undef GST_CAT_DEFAULT +#define GST_CAT_DEFAULT media_converter_debug + +#define AUDIO_CONV_ENCODED_LENGTH_MASK 0x00000fff /* 4kB fits in here. */ +#define AUDIO_CONV_PADDING_LENGTH_MASK 0x0ffff000 /* 120ms of samples at 48kHz fits in here. */ +#define AUDIO_CONV_PADDING_LENGTH_SHIFT 12 +#define AUDIO_CONV_FLAG_MASK 0xf0000000 +#define AUDIO_CONV_FLAG_HEADER 0x10000000 /* This chunk is the Opus header. */ +#define _AUDIO_CONV_FLAG_RESERVED1 0x20000000 /* Not yet used */ +#define _AUDIO_CONV_FLAG_RESERVED2 0x40000000 /* Not yet used */ +#define _AUDIO_CONV_FLAG_V2 0x80000000 /* Indicates a "version 2" header, process somehow differently (TBD). */ + +/* Properties of the "blank" audio file. */ +#define _BLANK_AUDIO_FILE_LENGTH_MS 10.0 +#define _BLANK_AUDIO_FILE_RATE 48000.0 + +#define AUDIO_CONV_FOZ_TAG_STREAM 0 +#define AUDIO_CONV_FOZ_TAG_CODECINFO 1 +#define AUDIO_CONV_FOZ_TAG_AUDIODATA 2 +#define AUDIO_CONV_FOZ_TAG_PTNADATA 3 +#define AUDIO_CONV_FOZ_NUM_TAGS 4 + +typedef enum +{ + NO_LOOP, + LOOPING, + LOOP_ENDED, + LOOP_ERROR, +} loop_state; + +struct buffer_entry +{ + struct payload_hash hash; + GstBuffer *buffer; +}; + +/* Followed by codec_data_size bytes codec data. */ +struct need_transcode_head +{ + size_t codec_data_size; + uint32_t wmaversion; + uint32_t bitrate; + uint32_t channels; + uint32_t rate; + uint32_t block_align; + uint32_t depth; +} __attribute__((packed)); + +/* Represents a Stream, a sequence of buffers. */ +struct stream_state +{ + struct murmur3_128_state hash_state; + struct payload_hash current_hash; + GList *buffers; /* Entry type: struct buffer_entry. */ + GList *loop_buffers; /* Entry type: struct buffer_entry. */ + struct need_transcode_head *codec_info; + bool needs_dump; +}; + +struct stream_state_serializer +{ + struct stream_state *state; + int index; +}; + +struct audio_conv_state +{ + bool sent_header; + struct need_transcode_head *codec_data; + struct murmur3_128_state hash_state; + struct murmur3_128_state loop_hash_state; + struct stream_state *stream_state; + struct fozdb *read_fozdb; +}; + +typedef struct +{ + GstElement element; + GstPad *sink_pad, *src_pad; + pthread_mutex_t state_mutex; + struct audio_conv_state *state; +} AudioConv; + +typedef struct +{ + GstElementClass class; +} AudioConvClass; + +G_DEFINE_TYPE(AudioConv, audio_conv, GST_TYPE_ELEMENT); +#define AUDIO_CONV_TYPE (audio_conv_get_type()) +#define AUDIO_CONV(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AUDIO_CONV_TYPE, AudioConv)) +#define parent_class (audio_conv_parent_class) +GST_ELEMENT_REGISTER_DEFINE(protonaudioconverter, "protonaudioconverter", + GST_RANK_MARGINAL, AUDIO_CONV_TYPE); + +static GstStaticPadTemplate audio_conv_sink_template = GST_STATIC_PAD_TEMPLATE("sink", + GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS("audio/x-wma;")); + +static GstStaticPadTemplate audio_conv_src_template = GST_STATIC_PAD_TEMPLATE("src", + GST_PAD_SRC, GST_PAD_ALWAYS, + GST_STATIC_CAPS("audio/x-opus;")); + +static struct dump_fozdb dump_fozdb = {PTHREAD_MUTEX_INITIALIZER, NULL, false}; + +static struct buffer_entry *buffer_entry_create(struct payload_hash *hash, GstBuffer *buffer) +{ + struct buffer_entry *entry = calloc(1, sizeof(*entry)); + entry->hash = *hash; + entry->buffer = gst_buffer_ref(buffer); + return entry; +} + +static void buffer_entry_release(void *arg) +{ + struct buffer_entry *entry = arg; + gst_buffer_unref(entry->buffer); + free(entry); +} + +static bool dumping_disabled(void) +{ + return option_enabled("MEDIACONV_AUDIO_DONT_DUMP"); +} + +static bool hash_data(const uint8_t *data, size_t size, struct murmur3_128_state *hash_state, struct payload_hash *hash) +{ + struct bytes_reader reader; + bytes_reader_init(&reader, data, size); + return murmur3_128_full(&reader, bytes_reader_read, hash_state, hash); +} + +static int dump_fozdb_open_audio(bool create) +{ + return dump_fozdb_open(&dump_fozdb, create, "MEDIACONV_AUDIO_DUMP_FILE", AUDIO_CONV_FOZ_NUM_TAGS); +} + +static void dump_fozdb_discard_transcoded(void) +{ + GList *chunks_to_discard = NULL, *chunks_to_keep = NULL, *chunks = NULL, *list_iter; + struct payload_hash chunk_id, *stream_id; + struct fozdb *read_fozdb; + char *read_fozdb_path; + GHashTableIter iter; + int ret; + + if (dump_fozdb.already_cleaned) + return; + dump_fozdb.already_cleaned = true; + + if (discarding_disabled()) + return; + if (!file_exists(getenv("MEDIACONV_AUDIO_DUMP_FILE"))) + return; + + if ((dump_fozdb_open_audio(false)) < 0) + return; + + if (!(read_fozdb_path = getenv("MEDIACONV_AUDIO_TRANSCODED_FILE"))) + { + GST_ERROR("Env MEDIACONV_AUDIO_TRANSCODED_FILE not set."); + return; + } + + if ((ret = fozdb_create(read_fozdb_path, O_RDONLY, true /* Read-only? */, AUDIO_CONV_FOZ_NUM_TAGS, &read_fozdb)) < 0) + { + GST_ERROR("Failed to create read fozdb, ret %d.", ret); + return; + } + + fozdb_iter_tag(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_STREAM, &iter); + while (g_hash_table_iter_next(&iter, (void *)&stream_id, NULL)) + { + uint32_t chunks_size, i; + size_t read_size; + + if (fozdb_entry_size(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_STREAM, stream_id, &chunks_size) == CONV_OK) + { + uint8_t *buffer = calloc(1, chunks_size); + if (fozdb_read_entry_data(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_STREAM, stream_id, + 0, buffer, chunks_size, &read_size, true) == CONV_OK) + { + GList *stream_chunks = NULL; + bool has_all = true; + + for (i = 0; i < read_size / sizeof(chunk_id); ++i) + { + payload_hash_from_bytes(&chunk_id, buffer + i * sizeof(chunk_id)); + if (!fozdb_has_entry(read_fozdb, AUDIO_CONV_FOZ_TAG_PTNADATA, &chunk_id)) + { + has_all = false; + break; + } + stream_chunks = g_list_append(stream_chunks, + entry_name_create(AUDIO_CONV_FOZ_TAG_AUDIODATA, &chunk_id)); + } + + for (list_iter = stream_chunks; list_iter; list_iter = list_iter->next) + { + struct entry_name *entry = list_iter->data; + if (has_all) + { + chunks_to_discard = g_list_append(chunks_to_discard, + entry_name_create(entry->tag, &entry->hash)); + chunks_to_discard = g_list_append(chunks_to_discard, + entry_name_create(AUDIO_CONV_FOZ_TAG_CODECINFO, &entry->hash)); + } + else + { + chunks_to_keep = g_list_append(chunks_to_keep, + entry_name_create(entry->tag, &entry->hash)); + chunks_to_keep = g_list_append(chunks_to_keep, + entry_name_create(AUDIO_CONV_FOZ_TAG_CODECINFO, &entry->hash)); + } + } + + if (has_all) + chunks_to_discard = g_list_append(chunks_to_discard, + entry_name_create(AUDIO_CONV_FOZ_TAG_STREAM, stream_id)); + + g_list_free_full(stream_chunks, free); + } + free(buffer); + } + } + + for (list_iter = chunks_to_discard; list_iter; list_iter = list_iter->next) + { + struct entry_name *entry = list_iter->data; + if (!g_list_find_custom(chunks_to_keep, entry, entry_name_compare)) + chunks = g_list_append(chunks, entry_name_create(entry->tag, &entry->hash)); + } + + if ((ret = fozdb_discard_entries(dump_fozdb.fozdb, chunks)) < 0) + { + GST_ERROR("Failed to discard entries, ret %d.", ret); + dump_fozdb_close(&dump_fozdb); + } + + g_list_free_full(chunks, free); + g_list_free_full(chunks_to_keep, free); + g_list_free_full(chunks_to_discard, free); +} + +static bool need_transcode_head_create_from_caps(GstCaps *caps, struct need_transcode_head **out) +{ + int wmaversion, bitrate, channels, rate, block_align, depth; + const GstStructure *structure = gst_caps_get_structure(caps, 0); + struct need_transcode_head *head; + const GValue *codec_data_value; + GstBuffer *codec_data_buffer; + gsize codec_data_size; + + GST_DEBUG("caps %"GST_PTR_FORMAT", out %p.", caps, out); + + if (!gst_structure_get_int(structure, "wmaversion", &wmaversion)) + { + GST_ERROR("Caps have no wmaversion field."); + return false; + } + if (!gst_structure_get_int(structure, "bitrate", &bitrate)) + { + GST_ERROR("Caps have no bitrate field."); + return false; + } + if (!gst_structure_get_int(structure, "channels", &channels)) + { + GST_ERROR("Caps have no channels field."); + return false; + } + if (!gst_structure_get_int(structure, "rate", &rate)) + { + GST_ERROR("Caps have no rate field."); + return false; + } + if (!gst_structure_get_int(structure, "block_align", &block_align)) + { + GST_ERROR("Caps have no block_align field."); + return false; + } + if (!gst_structure_get_int(structure, "depth", &depth)) + { + GST_ERROR("Caps have no depth field."); + return false; + } + if (!(codec_data_value = gst_structure_get_value(structure, "codec_data")) + || !(codec_data_buffer = gst_value_get_buffer(codec_data_value))) + { + GST_ERROR("Caps have no codec_data field."); + return false; + } + + codec_data_size = gst_buffer_get_size(codec_data_buffer); + head = calloc(1, sizeof(*head) + codec_data_size); + head->codec_data_size = codec_data_size; + head->wmaversion = wmaversion; + head->bitrate = bitrate; + head->channels = channels; + head->rate = rate; + head->block_align = block_align; + head->depth = depth; + gst_buffer_extract(codec_data_buffer, 0, head + 1, codec_data_size); + + *out = head; + return true; +} + +static struct need_transcode_head *need_transcode_head_dup(struct need_transcode_head *head) +{ + size_t size = sizeof(*head) + head->codec_data_size; + struct need_transcode_head *dup; + + dup = calloc(1, size); + memcpy(dup, head, size); + + return dup; +} + + +static void need_transcode_head_serialize(struct need_transcode_head *head, + uint8_t *buffer, size_t buffer_size, size_t *out_size) +{ + *out_size = sizeof(*head) - sizeof(head->codec_data_size) + head->codec_data_size; + + if (buffer_size < *out_size) + { + GST_ERROR("Buffer too small: buffer size %zu, out size %zu.", buffer_size, *out_size); + return; + } + memcpy(buffer, &head->wmaversion, *out_size); +} + +static void stream_state_serializer_init(struct stream_state_serializer *serializer, struct stream_state *state) +{ + serializer->state = state; + serializer->index = 0; +} + +static int stream_state_serializer_read(void *data_reader, uint8_t *buffer, size_t size, size_t *read_size) +{ + struct stream_state_serializer *serializer = data_reader; + struct buffer_entry *entry; + + if (!size) + { + *read_size = 0; + return CONV_OK; + } + + if (serializer->index >= g_list_length(serializer->state->buffers)) + return CONV_ERROR_DATA_END; + + entry = g_list_nth_data(serializer->state->buffers, serializer->index++); + memcpy(buffer, &entry->hash, sizeof(entry->hash)); + + *read_size = sizeof(entry->hash); + return CONV_OK; +} + +static struct stream_state *stream_state_create(void) +{ + struct stream_state *state; + state = calloc(1, sizeof(*state)); + murmur3_128_state_init(&state->hash_state, HASH_SEED); + return state; +} + +static void stream_state_release(struct stream_state *state) +{ + g_list_free_full(state->buffers, buffer_entry_release); + g_list_free_full(state->loop_buffers, buffer_entry_release); + if (state->codec_info) + free(state->codec_info); + free(state); +} + +static void stream_state_reset(struct stream_state *state) +{ + murmur3_128_state_reset(&state->hash_state); + memset(&state->current_hash, 0, sizeof(state->current_hash)); + g_list_free_full(g_steal_pointer(&state->buffers), buffer_entry_release); + g_list_free_full(g_steal_pointer(&state->loop_buffers), buffer_entry_release); + free(state->codec_info); + state->codec_info = NULL; + state->needs_dump = false; +} + +static loop_state stream_state_record_buffer(struct stream_state *state, struct payload_hash *buffer_hash, + struct payload_hash *loop_hash, GstBuffer *buffer, struct need_transcode_head *codec_info) +{ + if (!state->codec_info && codec_info) + state->codec_info = need_transcode_head_dup(codec_info); + + if (g_list_length(state->loop_buffers) < g_list_length(state->buffers)) + { + struct buffer_entry *entry = g_list_nth_data(state->buffers, g_list_length(state->loop_buffers)); + if (!memcmp(&entry->hash, loop_hash, sizeof(*loop_hash))) + { + state->loop_buffers = g_list_append(state->loop_buffers, + buffer_entry_create(buffer_hash /* Not loop_hash! */, buffer)); + if (g_list_length(state->loop_buffers) == g_list_length(state->buffers)) + { + /* Full loop, just drop them. */ + g_list_free_full(g_steal_pointer(&state->loop_buffers), buffer_entry_release); + return LOOP_ENDED; + } + + return LOOPING; + } + } + + /* Partial loop, track them and then continue */ + if (state->loop_buffers) + state->buffers = g_list_concat(state->buffers, g_steal_pointer(&state->loop_buffers)); + + state->buffers = g_list_append(state->buffers, buffer_entry_create(buffer_hash, buffer)); + + if (!hash_data((const uint8_t *)buffer_hash, sizeof(*buffer_hash), &state->hash_state, &state->current_hash)) + return LOOP_ERROR; + + return NO_LOOP; +} + +static bool stream_state_is_stream_subset(struct stream_state *state, struct fozdb *db, struct payload_hash *stream_id) +{ + uint64_t offset = 0; + GList *list_iter; + + for (list_iter = state->buffers; list_iter; list_iter = list_iter->next) + { + struct buffer_entry *entry = list_iter->data; + struct payload_hash buffer_id; + size_t read_size; + + if ((fozdb_read_entry_data(db, AUDIO_CONV_FOZ_TAG_STREAM, stream_id, + offset, (uint8_t *)&buffer_id, sizeof(buffer_id), &read_size, true)) < 0 + || read_size != sizeof(buffer_id)) + return false; + + if (memcmp(&buffer_id, &entry->hash, sizeof(buffer_id)) != 0) + return false; + + offset += sizeof(buffer_id); + } + + GST_LOG("Stream id %s is a subset of %s, so not recording stream.", + format_hash(&state->current_hash), format_hash(stream_id)); + + return true; +} + +static int stream_state_write_to_foz(struct stream_state *state) +{ + struct stream_state_serializer serializer; + struct buffer_entry *entry; + struct bytes_reader reader; + uint8_t buffer[1024]; + size_t header_size; + GList *list_iter; + bool found; + int ret; + + GST_DEBUG("state %p, current hash %s.", state, format_hash(&state->current_hash)); + + if (!state->needs_dump || !state->buffers) + return CONV_OK; + + pthread_mutex_lock(&dump_fozdb.mutex); + + if ((ret = dump_fozdb_open_audio(true)) < 0) + { + GST_ERROR("Failed to open audio dump fozdb, ret %d.", ret); + pthread_mutex_unlock(&dump_fozdb.mutex); + return ret; + } + + found = fozdb_has_entry(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_STREAM, &state->current_hash); + if (!found) + { + /* Are there any recorded streams of which this stream is a subset? */ + struct payload_hash *stream_id; + GHashTableIter stream_ids; + + fozdb_iter_tag(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_STREAM, &stream_ids); + while (g_hash_table_iter_next(&stream_ids, (void **)&stream_id, NULL)) + { + if (stream_state_is_stream_subset(state, dump_fozdb.fozdb, stream_id)) + { + found = true; + break; + } + } + } + + if (!found) + { + if (dumping_disabled()) + { + GST_LOG("Dumping disabled, so not recording stream id %s.", format_hash(&state->current_hash)); + } + else + { + GST_LOG("Recording stream id %s.", format_hash(&state->current_hash)); + + need_transcode_head_serialize(state->codec_info, buffer, sizeof(buffer), &header_size); + bytes_reader_init(&reader, buffer, header_size); + entry = state->buffers->data; + if ((ret = fozdb_write_entry(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_CODECINFO, &entry->hash, + &reader, bytes_reader_read, true)) < 0) + { + GST_ERROR("Unable to write stream header, ret %d.\n", ret); + pthread_mutex_unlock(&dump_fozdb.mutex); + return ret; + } + + stream_state_serializer_init(&serializer, state); + if ((ret = fozdb_write_entry(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_STREAM, &state->current_hash, + &serializer, stream_state_serializer_read, true)) < 0) + { + GST_ERROR("Unable to write stream, ret %d.\n", ret); + pthread_mutex_unlock(&dump_fozdb.mutex); + return ret; + } + + for (list_iter = state->buffers; list_iter; list_iter = list_iter->next) + { + struct gst_buffer_reader buffer_reader; + + entry = list_iter->data; + gst_buffer_reader_init(&buffer_reader, entry->buffer); + if ((ret = fozdb_write_entry(dump_fozdb.fozdb, AUDIO_CONV_FOZ_TAG_AUDIODATA, &entry->hash, + &buffer_reader, gst_buffer_reader_read, true)) < 0) + { + GST_ERROR("Unable to write audio data, ret %d.\n", ret); + pthread_mutex_unlock(&dump_fozdb.mutex); + return ret; + } + } + } + } + + pthread_mutex_unlock(&dump_fozdb.mutex); + return CONV_OK; +} + +static int audio_conv_state_create(struct audio_conv_state **out) +{ + struct audio_conv_state *state; + struct fozdb *fozdb = NULL; + char *read_fozdb_path; + int ret; + + if (!(read_fozdb_path = getenv("MEDIACONV_AUDIO_TRANSCODED_FILE"))) + { + GST_ERROR("Env MEDIACONV_AUDIO_TRANSCODED_FILE is not set!"); + return CONV_ERROR_ENV_NOT_SET; + } + + if ((ret = fozdb_create(read_fozdb_path, O_RDONLY, true /* Read-only? */, AUDIO_CONV_FOZ_NUM_TAGS, &fozdb)) < 0) + GST_ERROR("Failed to create fozdb from %s, ret %d.", read_fozdb_path, ret); + + state = calloc(1, sizeof(*state)); + murmur3_128_state_init(&state->hash_state, HASH_SEED); + murmur3_128_state_init(&state->loop_hash_state, HASH_SEED); + state->stream_state = stream_state_create(); + state->read_fozdb = fozdb; + + *out = state; + return CONV_OK; +} + +static void audio_conv_state_release(struct audio_conv_state *state) +{ + free(state->codec_data); + stream_state_release(state->stream_state); + if (state->read_fozdb) + fozdb_release(state->read_fozdb); + free(state); +} + +static void audio_conv_state_reset(struct audio_conv_state *state) +{ + if (stream_state_write_to_foz(state->stream_state) < 0) + GST_ERROR("Failed to write stream to dump fozdb."); + + stream_state_reset(state->stream_state); + murmur3_128_state_reset(&state->hash_state); + murmur3_128_state_reset(&state->loop_hash_state); +} + +/* Allocate a buffer on success, free it after usage. */ +static int audio_conv_state_open_transcode_file(struct audio_conv_state *state, GstBuffer *buffer, + uint8_t **out_data, size_t *out_size) +{ + struct payload_hash hash, loop_hash; + uint32_t transcoded_size; + const char *blank_audio; + bool try_loop, hash_ok; + GstMapInfo map_info; + uint64_t file_size; + loop_state loop; + uint8_t *data; + size_t size; + int fd; + + /* Hash buffer. */ + if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) + return CONV_ERROR; + hash_ok = hash_data(map_info.data, map_info.size, &state->hash_state, &hash) + && hash_data(map_info.data, map_info.size, &state->loop_hash_state, &loop_hash); + gst_buffer_unmap(buffer, &map_info); + if (!hash_ok) + { + GST_ERROR("Failed to hash buffer."); + return CONV_ERROR; + } + + loop = stream_state_record_buffer(state->stream_state, &hash, &loop_hash, buffer, state->codec_data); + gst_buffer_unref(buffer); /* Buffer has been recorded, so unref it. */ + switch (loop) + { + case NO_LOOP: + murmur3_128_state_reset(&state->loop_hash_state); + try_loop = false; + break; + + case LOOP_ENDED: + murmur3_128_state_reset(&state->loop_hash_state); + case LOOPING: + try_loop = true; + break; + + case LOOP_ERROR: + default: + return CONV_ERROR; + } + + if (try_loop) + GST_INFO("Buffer hash: %s (Loop: %s).", format_hash(&hash), format_hash(&loop_hash)); + else + GST_INFO("Buffer hash: %s.", format_hash(&hash)); + + /* Try to read transcoded data. */ + if (state->read_fozdb) + { + if (fozdb_entry_size(state->read_fozdb, + AUDIO_CONV_FOZ_TAG_PTNADATA, &hash, &transcoded_size) == CONV_OK) + { + data = calloc(1, transcoded_size); + if (fozdb_read_entry_data(state->read_fozdb, AUDIO_CONV_FOZ_TAG_PTNADATA, &hash, 0, + data, transcoded_size, &size, false) == CONV_OK) + { + *out_data = data; + *out_size = size; + return CONV_OK; + } + free(data); + } + + if (try_loop && fozdb_entry_size(state->read_fozdb, + AUDIO_CONV_FOZ_TAG_PTNADATA, &loop_hash, &transcoded_size) == CONV_OK) + { + data = calloc(1, transcoded_size); + if (fozdb_read_entry_data(state->read_fozdb, AUDIO_CONV_FOZ_TAG_PTNADATA, &loop_hash, 0, + data, transcoded_size, &size, false) == CONV_OK) + { + *out_data = data; + *out_size = size; + return CONV_OK; + } + free(data); + } + } + + /* If we can't, return the blank file */ + state->stream_state->needs_dump = true; + if (!(blank_audio = getenv("MEDIACONV_BLANK_AUDIO_FILE"))) + { + GST_ERROR("Env MEDIACONV_BLANK_AUDIO_FILE not set."); + return CONV_ERROR_ENV_NOT_SET; + } + if (!open_file(blank_audio, O_RDONLY, &fd)) + return CONV_ERROR_OPEN_FAILED; + if (!get_file_size(fd, &file_size)) + { + close(fd); + return CONV_ERROR; + } + data = calloc(1, file_size); + if (!complete_read(fd, data, file_size)) + { + free(data); + close(fd); + return CONV_ERROR_READ_FAILED; + } + + create_placeholder_file("placeholder-audio-used"); + + *out_data = data; + *out_size = file_size; + + return CONV_OK; +} + +/* Call pthread_mutex_unlock() to unlock after usage. */ +static struct audio_conv_state *audio_conv_lock_state(AudioConv *conv) +{ + pthread_mutex_lock(&conv->state_mutex); + if (!conv->state) + pthread_mutex_unlock(&conv->state_mutex); + return conv->state; +} + +static GstStateChangeReturn audio_conv_change_state(GstElement *element, GstStateChange transition) +{ + AudioConv *conv = AUDIO_CONV(element); + struct audio_conv_state *state; + int ret; + + GST_DEBUG_OBJECT(element, "State transition %s.", gst_state_change_get_name(transition)); + + switch (transition) + { + case GST_STATE_CHANGE_NULL_TO_READY: + /* Do runtime setup. */ + + /* Open fozdb here; this is the right place to fail + * and opening may be expensive. */ + pthread_mutex_lock(&dump_fozdb.mutex); + dump_fozdb_discard_transcoded(); + ret = dump_fozdb_open_audio(true); + pthread_mutex_unlock(&dump_fozdb.mutex); + if (ret < 0) + { + GST_ERROR("Failed to open dump fozdb, ret %d.", ret); + return GST_STATE_CHANGE_FAILURE; + } + + /* Create audio conv state. */ + if ((ret = audio_conv_state_create(&state)) < 0) + { + GST_ERROR("Failed to create audio conv state, ret %d.", ret); + return GST_STATE_CHANGE_FAILURE; + } + pthread_mutex_lock(&conv->state_mutex); + assert(!conv->state); + conv->state = state; + pthread_mutex_unlock(&conv->state_mutex); + break; + + case GST_STATE_CHANGE_READY_TO_NULL: + /* Do runtime teardown. */ + pthread_mutex_lock(&conv->state_mutex); + state = conv->state; + conv->state = NULL; + pthread_mutex_unlock(&conv->state_mutex); + + if (state && (ret = stream_state_write_to_foz(state->stream_state)) < 0) + GST_WARNING("Error writing out stream data, ret %d.", ret); + audio_conv_state_release(state); + break; + + default: + break; + } + + return GST_ELEMENT_CLASS(parent_class)->change_state(element, transition); + + /* XXX on ReadyToNull, sodium drops state _again_ here... why? */ +} + +static gboolean audio_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + AudioConv *conv = AUDIO_CONV(parent); + struct audio_conv_state *state; + GstCaps *caps; + bool ret; + + GST_DEBUG_OBJECT(pad, "Got sink event %"GST_PTR_FORMAT".", event); + + switch (event->type) + { + case GST_EVENT_CAPS: + if ((state = audio_conv_lock_state(conv))) + { + gst_event_parse_caps(event, &caps); + if (!need_transcode_head_create_from_caps(caps, &state->codec_data)) + { + GST_ERROR("Invalid WMA caps!"); + pthread_mutex_unlock(&conv->state_mutex); + return false; + } + pthread_mutex_unlock(&conv->state_mutex); + } + + caps = gst_caps_from_string("audio/x-opus, channel-mapping-family=0"); + ret = push_event(conv->src_pad, gst_event_new_caps(caps)); + gst_caps_unref(caps); + return ret; + + case GST_EVENT_FLUSH_STOP: + if ((state = audio_conv_lock_state(conv))) + { + audio_conv_state_reset(state); + pthread_mutex_unlock(&conv->state_mutex); + } + return gst_pad_event_default(pad, parent, event); + + default: + return gst_pad_event_default(pad, parent, event); + } +} + +static GstFlowReturn audio_conv_chain(GstPad *pad, GstObject *parent, GstBuffer *buffer) +{ + size_t ptna_data_size, offset, encoded_len; + GstFlowReturn flow_ret = GST_FLOW_ERROR; + AudioConv *conv = AUDIO_CONV(parent); + struct audio_conv_state *state; + uint8_t *ptna_data = NULL; + int ret; + + GST_LOG_OBJECT(pad, "Handling buffer <%"GST_PTR_FORMAT">.", buffer); + + if (!(state = audio_conv_lock_state(conv))) + return flow_ret; + + if ((ret = audio_conv_state_open_transcode_file(state, buffer, &ptna_data, &ptna_data_size)) < 0) + { + GST_ERROR("Failed to read transcoded audio, ret %d. Things will go badly...", ret); + goto done; + } + + for (offset = 0; offset < ptna_data_size; offset += encoded_len) + { + uint32_t packet_header, flags, padding_len; + GstBuffer *new_buffer; + bool packet_is_header; + + if (offset + 4 >= ptna_data_size) + { + GST_WARNING( "Short read on ptna header?"); + break; + } + + packet_header = bytes_to_uint32(&ptna_data[offset]); + offset += 4; + + flags = packet_header & AUDIO_CONV_FLAG_MASK, + padding_len = (packet_header & AUDIO_CONV_PADDING_LENGTH_MASK) >> AUDIO_CONV_PADDING_LENGTH_SHIFT; + encoded_len = packet_header & AUDIO_CONV_ENCODED_LENGTH_MASK; + + if (offset + encoded_len > ptna_data_size) + { + GST_WARNING("Short read on ptna data?"); + break; + } + + packet_is_header = flags & AUDIO_CONV_FLAG_HEADER; + if (packet_is_header && state->sent_header) + continue; /* Only send one header. */ + + /* TODO: can we use a GstBuffer cache here? */ + new_buffer = gst_buffer_new_and_alloc(encoded_len); + if (!packet_is_header && padding_len > 0) + gst_buffer_add_audio_clipping_meta(new_buffer, GST_FORMAT_DEFAULT, 0, padding_len); + gst_buffer_fill(new_buffer, 0, ptna_data + offset, encoded_len); + + GST_LOG("Pushing one packet of len %zu.", encoded_len); + if ((flow_ret = gst_pad_push(conv->src_pad, new_buffer)) < 0) + { + GST_ERROR("Failed to push buffer <%"GST_PTR_FORMAT"> to src pad %"GST_PTR_FORMAT, + new_buffer, conv->src_pad); + goto done; + } + + if (packet_is_header) + state->sent_header = true; + } + + flow_ret = GST_FLOW_OK; + +done: + if (ptna_data) + free(ptna_data); + pthread_mutex_unlock(&conv->state_mutex); + return flow_ret; +} + +static gboolean audio_conv_src_query(GstPad *pad, GstObject *parent, GstQuery *query) +{ + AudioConv *conv = AUDIO_CONV(parent); + GstSchedulingFlags flags; + gint min, max, align; + GstQuery *peer_query; + + GST_DEBUG_OBJECT(pad, "Got query %"GST_PTR_FORMAT".", query); + + switch (query->type) + { + case GST_QUERY_SCHEDULING: + peer_query = gst_query_new_scheduling(); + if (!gst_pad_peer_query(conv->sink_pad, peer_query)) + { + gst_query_unref(peer_query); + return false; + } + gst_query_parse_scheduling(peer_query, &flags, &min, &max, &align); + gst_query_unref(peer_query); + gst_query_set_scheduling(query, flags, min, max, align); + return true; + + default: + return gst_pad_query_default(pad, parent, query); + } + +} + +static gboolean audio_conv_active_mode(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean active) +{ + AudioConv *conv = AUDIO_CONV(parent); + return gst_pad_activate_mode(conv->sink_pad, mode, active); +} + +static void audio_conv_finalize(GObject *object) +{ + AudioConv *conv = AUDIO_CONV(object); + + pthread_mutex_destroy(&conv->state_mutex); + if (conv->state) + audio_conv_state_release(conv->state); + + G_OBJECT_CLASS(parent_class)->finalize(object); +} + +static void audio_conv_class_init(AudioConvClass *klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS(klass); + + gst_element_class_set_metadata(element_class, + "Proton audio converter", + "Codec/Demuxer", + "Converts audio for Proton", + "Andrew Eikum , Ziqing Hui "); + + element_class->change_state = audio_conv_change_state; + object_class->finalize = audio_conv_finalize; + + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&audio_conv_sink_template)); + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&audio_conv_src_template)); +} + +static void audio_conv_init(AudioConv *conv) +{ + GstElement *element = GST_ELEMENT(conv); + + conv->sink_pad = gst_pad_new_from_static_template(&audio_conv_sink_template, "sink"); + gst_pad_set_event_function(conv->sink_pad, GST_DEBUG_FUNCPTR(audio_conv_sink_event)); + gst_pad_set_chain_function(conv->sink_pad, GST_DEBUG_FUNCPTR(audio_conv_chain)); + gst_element_add_pad(element, conv->sink_pad); + + conv->src_pad = gst_pad_new_from_static_template(&audio_conv_src_template, "src"); + gst_pad_set_query_function(conv->src_pad, GST_DEBUG_FUNCPTR(audio_conv_src_query)); + gst_pad_set_activatemode_function(conv->src_pad, GST_DEBUG_FUNCPTR(audio_conv_active_mode)); + gst_element_add_pad(element, conv->src_pad); + + pthread_mutex_init(&conv->state_mutex, NULL); + conv->state = NULL; +} diff --git a/dlls/winegstreamer/media-converter/audioconvbin.c b/dlls/winegstreamer/media-converter/audioconvbin.c new file mode 100644 index 00000000000..9857a0ff507 --- /dev/null +++ b/dlls/winegstreamer/media-converter/audioconvbin.c @@ -0,0 +1,148 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +GST_DEBUG_CATEGORY_EXTERN(media_converter_debug); +#undef GST_CAT_DEFAULT +#define GST_CAT_DEFAULT media_converter_debug + +typedef struct +{ + GstBin bin; + GstElement *audio_conv, *opus_dec, *caps_setter; + GstPad *sink_pad, *src_pad; /* Ghost pads. */ +} AudioConvBin; + +typedef struct +{ + GstBinClass class; +} AudioConvBinClass; + +G_DEFINE_TYPE(AudioConvBin, audio_conv_bin, GST_TYPE_BIN); +#define AUDIO_CONV_BIN_TYPE (audio_conv_bin_get_type()) +#define AUDIO_CONV_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AUDIO_CONV_BIN_TYPE, AudioConvBin)) +GST_ELEMENT_REGISTER_DEFINE(protonaudioconverterbin, "protonaudioconverterbin", + GST_RANK_MARGINAL + 1, AUDIO_CONV_BIN_TYPE); + +static GstStaticPadTemplate audio_conv_bin_sink_template = GST_STATIC_PAD_TEMPLATE("sink", + GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS("audio/x-wma;")); + +static GstStaticPadTemplate audio_conv_bin_src_template = GST_STATIC_PAD_TEMPLATE("src", + GST_PAD_SRC, GST_PAD_ALWAYS, + GST_STATIC_CAPS("audio/x-raw, format=S16LE;")); + +static void link_elements(GstElement *src_element, GstElement *sink_element) +{ + if (!gst_element_link(src_element, sink_element)) + GST_ERROR("Failed to link src element %"GST_PTR_FORMAT" to sink element %"GST_PTR_FORMAT".", + src_element, sink_element); +} + +static gboolean audio_conv_bin_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + AudioConvBin * bin = AUDIO_CONV_BIN(parent); + GstCaps *caps, *rate_caps; + GstStructure *structure; + GstPad *audio_conv_sink; + gint override_rate; + gboolean ret; + + GST_DEBUG_OBJECT(pad, "Got sink event %"GST_PTR_FORMAT".", event); + + switch (event->type) + { + case GST_EVENT_CAPS: + gst_event_parse_caps(event, &caps); + if ((structure = gst_caps_get_structure(caps, 0)) + && gst_structure_get_int(structure, "rate", &override_rate)) + { + rate_caps = gst_caps_new_simple("audio/x-raw", "rate", G_TYPE_INT, override_rate, NULL); + g_object_set(bin->caps_setter, "caps", rate_caps, NULL); + } + else + { + GST_WARNING("Event has no rate."); + } + + /* Forward on to the real pad. */ + audio_conv_sink = gst_element_get_static_pad(bin->audio_conv, "sink"); + ret = gst_pad_send_event(audio_conv_sink, event); + gst_object_unref(audio_conv_sink); + return ret; + + default: + return gst_pad_event_default(pad, parent, event); + } +} + +static void audio_conv_bin_class_init(AudioConvBinClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS(klass); + + gst_element_class_set_metadata(element_class, + "Proton audio converter with rate fixup", + "Codec/Decoder/Audio", + "Converts audio for Proton, fixing up samplerates", + "Andrew Eikum , Ziqing Hui "); + + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&audio_conv_bin_sink_template)); + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&audio_conv_bin_src_template)); +} + +static void audio_conv_bin_init(AudioConvBin *bin) +{ + GstElement *element = GST_ELEMENT(bin); + GstPad *sink, *src; + + bin->sink_pad = gst_ghost_pad_new_no_target_from_template("sink", + gst_element_get_pad_template(element, "sink")); + bin->src_pad = gst_ghost_pad_new_no_target_from_template("src", + gst_element_get_pad_template(element, "src")); + gst_pad_set_event_function(bin->sink_pad, GST_DEBUG_FUNCPTR(audio_conv_bin_sink_event)); + + bin->audio_conv = create_element("protonaudioconverter", "protonmediaconverter"); + bin->opus_dec = create_element("opusdec", "base"); + bin->caps_setter = create_element("capssetter", "good"); + + gst_bin_add(GST_BIN(bin), bin->audio_conv); + gst_bin_add(GST_BIN(bin), bin->opus_dec); + gst_bin_add(GST_BIN(bin), bin->caps_setter); + + link_elements(bin->audio_conv, bin->opus_dec); + link_elements(bin->opus_dec, bin->caps_setter); + + sink = gst_element_get_static_pad(bin->audio_conv, "sink"); + src = gst_element_get_static_pad(bin->caps_setter, "src"); + gst_ghost_pad_set_target(GST_GHOST_PAD(bin->sink_pad), sink); + gst_ghost_pad_set_target(GST_GHOST_PAD(bin->src_pad), src); + gst_object_unref(src); + gst_object_unref(sink); + + gst_element_add_pad(element, bin->sink_pad); + gst_element_add_pad(element, bin->src_pad); + + GST_INFO("Initialized AudioConvBin %"GST_PTR_FORMAT": audio_conv %"GST_PTR_FORMAT", opus_dec %"GST_PTR_FORMAT", " + "caps_setter %"GST_PTR_FORMAT", sink_pad %"GST_PTR_FORMAT", src_pad %"GST_PTR_FORMAT".", + bin, bin->audio_conv, bin->opus_dec, bin->caps_setter, bin->sink_pad, bin->src_pad); +} diff --git a/dlls/winegstreamer/media-converter/fossilize.c b/dlls/winegstreamer/media-converter/fossilize.c new file mode 100644 index 00000000000..057825ad5b5 --- /dev/null +++ b/dlls/winegstreamer/media-converter/fossilize.c @@ -0,0 +1,722 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + * Based on "Fossilize," which is + * Copyright (c) 2018-2019 Hans-Kristian Arntzen + * https://github.com/ValveSoftware/Fossilize/ + */ + +/* This is a read/write implementation of the Fossilize database format. + * + * https://github.com/ValveSoftware/Fossilize/ + * + * That C++ implementation is specific to Vulkan, while this one tries to be generic to store any + * type of data. + */ + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +/* Fossilize StreamArchive database format version 6: + * + * The file consists of a header, followed by an unlimited series of "entries". + * + * All multi-byte entities are little-endian. + * + * The file header is as follows: + * + * Field Type Description + * ----- ---- ----------- + * magic_number uint8_t[12] Constant value: "\x81""FOSSILIZEDB" + * version uint32_t StreamArchive version: 6 + * + * + * Each entry follows this format: + * + * Field Type Description + * ----- ---- ----------- + * name unsigned char[40] Application-defined entry identifier, stored in hexadecimal big-endian + * ASCII. Usually N-char tag followed by (40 - N)-char hash. + * size uint32_t Size of the payload as stored in this file. + * flags uint32_t Flags for this entry (e.g. compression). See below. + * crc32 uint32_t CRC32 of the payload as stored in this file. + * full_size uint32_t Size of this payload after decompression. + * payload uint8_t[stored_size] Entry data. + * + * The flags field may contain: + * 0x1: No compression. + * 0x2: Deflate compression. + */ + +#define FOZDB_MIN_COMPAT_VERSION 5 +#define FOZDB_VERSION 6 + +#define FOZDB_COMPRESSION_NONE 1 +#define FOZDB_COMPRESSION_DEFLATE 2 + +#define ENTRY_NAME_SIZE 40 + +#define BUFFER_COPY_BYTES (8 * 1024 * 1024) /* Tuneable. */ + +static const uint8_t FOZDB_MAGIC[] = {0x81, 'F', 'O', 'S', 'S', 'I', 'L', 'I', 'Z', 'E', 'D', 'B'}; + +struct file_header +{ + uint8_t magic[12]; + uint8_t unused1; + uint8_t unused2; + uint8_t unused3; + uint8_t version; +} __attribute__((packed)); + +struct payload_header +{ + uint32_t size; + uint32_t compression; + uint32_t crc; + uint32_t full_size; +} __attribute__((packed)); + +struct payload_entry +{ + struct payload_hash hash; + struct payload_header header; + uint64_t offset; +}; + +static guint hash_func(gconstpointer key) +{ + const struct payload_hash *payload_hash = key; + + return payload_hash->hash[0] + ^ payload_hash->hash[1] + ^ payload_hash->hash[2] + ^ payload_hash->hash[3]; +} + +static gboolean hash_equal(gconstpointer a, gconstpointer b) +{ + return memcmp(a, b, sizeof(struct payload_hash)) == 0; +} + +static bool tag_from_ascii_bytes(uint32_t *tag, const uint8_t *ascii_bytes) +{ + char str[sizeof(*tag) * 2 + 1] = {}; + + memcpy(str, ascii_bytes, sizeof(*tag) * 2); + + *tag = strtoul(str, NULL, 16); + if (errno != 0) + { + GST_ERROR("Failed to convert string \"%s\" to tag. %s.", str, strerror(errno)); + return false; + } + + return true; +} + +static bool hash_from_ascii_bytes(struct payload_hash *hash, const uint8_t *ascii_bytes) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(hash->hash); ++i) + { + uint32_t *hash_part = &hash->hash[ARRAY_SIZE(hash->hash) - 1 - i]; + char str[sizeof(hash_part) * 2 + 1] = {}; + + memcpy(str, ascii_bytes + sizeof(*hash_part) * 2 * i, sizeof(*hash_part) * 2); + + *hash_part = strtoul(str, NULL, 16); + + if (errno != 0) + { + GST_ERROR("Failed to convert string \"%s\" to hash part %u. %s.", str, 4 - i, strerror(errno)); + return false; + } + } + + return true; +} + +static void tag_to_ascii_bytes(uint32_t tag, uint8_t *ascii_bytes) +{ + char buffer[sizeof(tag) * 2 + 1]; + sprintf(buffer, "%08x", tag); + memcpy(ascii_bytes, buffer, sizeof(tag) * 2); +} + +static void hash_to_ascii_bytes(const struct payload_hash *hash, uint8_t *ascii_bytes) +{ + char buffer[sizeof(*hash) * 2 + 1]; + sprintf(buffer, "%08x%08x%08x%08x", hash->hash[3], hash->hash[2], hash->hash[1], hash->hash[0]); + memcpy(ascii_bytes, buffer, sizeof(*hash) * 2); +} + +static void payload_header_from_bytes(struct payload_header *header, const uint8_t *bytes) +{ + header->size = bytes_to_uint32(bytes); + header->compression = bytes_to_uint32(bytes + 4); + header->crc = bytes_to_uint32(bytes + 8); + header->full_size = bytes_to_uint32(bytes + 12); +} + +static int fozdb_read_file_header(struct fozdb *db) +{ + struct file_header header; + + if (!complete_read(db->file, &header, sizeof(header))) + { + GST_ERROR("Failed to read file header."); + return CONV_ERROR_READ_FAILED; + } + if (memcmp(&header.magic, FOZDB_MAGIC, sizeof(FOZDB_MAGIC)) != 0) + { + GST_ERROR("Bad magic."); + return CONV_ERROR_CORRUPT_DATABASE; + } + if (header.version < FOZDB_MIN_COMPAT_VERSION || header.version > FOZDB_VERSION) + { + GST_ERROR("Incompatible version %u.", header.version); + return CONV_ERROR_CORRUPT_DATABASE; + } + + return CONV_OK; +} + +static int fozdb_read_entry_tag_hash_header(struct fozdb *db, + uint32_t *out_tag, struct payload_hash *out_hash, struct payload_header *out_header) +{ + uint8_t entry_name_and_header[ENTRY_NAME_SIZE + sizeof(struct payload_header)]; + struct payload_hash hash; + uint32_t tag; + + if (!complete_read(db->file, entry_name_and_header, sizeof(entry_name_and_header))) + { + GST_ERROR("Failed to read entry name and header."); + return CONV_ERROR_READ_FAILED; + } + + if (!tag_from_ascii_bytes(&tag, entry_name_and_header) + || !hash_from_ascii_bytes(&hash, entry_name_and_header + sizeof(tag) * 2)) + return CONV_ERROR_CORRUPT_DATABASE; + + payload_header_from_bytes(out_header, entry_name_and_header + ENTRY_NAME_SIZE); + + *out_tag = tag; + *out_hash = hash; + return CONV_OK; +} + +static bool fozdb_seek_to_next_entry(struct fozdb *db, struct payload_header *header, bool *truncated) +{ + uint64_t file_size = 0, data_offset = lseek(db->file, 0, SEEK_CUR); + + if (truncated) + *truncated = false; + + get_file_size(db->file, &file_size); + + if (lseek(db->file, header->size, SEEK_CUR) < 0) + { + GST_ERROR("Failed to seek to next entry. %s. " + "Entry data offset %#"PRIx64", size %#x, file size %#"PRIx64".", + strerror(errno), data_offset, header->size, file_size); + return false; + } + + if (file_size && data_offset + header->size > file_size) + { + /* Truncated chunk is not fatal. */ + GST_WARNING("Entry data larger than file, truncating database here. " + "Entry data offset %#"PRIx64", size %#x, file size %#"PRIx64".", + data_offset, header->size, file_size); + if (truncated) + *truncated = true; + } + + return true; +} + +static bool fozdb_write_entry_name(struct fozdb *db, uint32_t tag, struct payload_hash *hash) +{ + uint8_t entry_name[ENTRY_NAME_SIZE]; + + tag_to_ascii_bytes(tag, entry_name); + hash_to_ascii_bytes(hash, entry_name + sizeof(tag) * 2); + + if (!complete_write(db->file, entry_name, sizeof(entry_name))) + { + GST_ERROR("Failed to write entry name."); + return false; + } + + return true; +} + +/* Copy an entry to write_pos. */ +static int fozdb_copy_entry(struct fozdb *db, + struct entry_name *name, struct payload_header *header, uint64_t entry_data_offset) +{ + uint64_t read_offset, entry_end = entry_data_offset + header->size; + ssize_t read_size; + uint8_t *buffer; + + if (lseek(db->file, db->write_pos, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek file to write_pos."); + return CONV_ERROR_SEEK_FAILED; + } + + /* Write entry name. */ + if (!fozdb_write_entry_name(db, name->tag, &name->hash)) + return CONV_ERROR_WRITE_FAILED; + db->write_pos += ENTRY_NAME_SIZE; + + /* Write entry header. */ + if (!complete_write(db->file, header, sizeof(*header))) + { + GST_ERROR("Failed to write entry header."); + return CONV_ERROR_WRITE_FAILED; + } + db->write_pos += sizeof(*header); + + /* Copy entry data. */ + buffer = calloc(1, BUFFER_COPY_BYTES); + for (read_offset = entry_data_offset; read_offset < entry_end; read_offset += read_size) + { + size_t to_read = min(entry_end - read_offset, BUFFER_COPY_BYTES); + + /* Read data from entry. */ + if (lseek(db->file, read_offset, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek to read offset. %s.", strerror(errno)); + free(buffer); + return CONV_ERROR_SEEK_FAILED; + } + if ((read_size = read(db->file, buffer, to_read)) < 0) + { + GST_ERROR("Failed to read entry data. %s.", strerror(errno)); + free(buffer); + return CONV_ERROR_READ_FAILED; + } + if (read_size == 0) + break; + + /* Write data to write_pos. */ + if (lseek(db->file, db->write_pos, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek to write_pos. %s.", strerror(errno)); + free(buffer); + return CONV_ERROR_SEEK_FAILED; + } + if (!complete_write(db->file, buffer, read_size)) + { + GST_ERROR("Failed to write entry data to write_pos."); + free(buffer); + return CONV_ERROR_WRITE_FAILED; + } + db->write_pos += read_size; + } + free(buffer); + + if (lseek(db->file, read_offset, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek to read offset. %s.", strerror(errno)); + return CONV_ERROR_SEEK_FAILED; + } + + return CONV_OK; +} + +int fozdb_create(const char *file_name, int open_flags, bool read_only, uint32_t num_tags, struct fozdb **out) +{ + struct fozdb *db; + size_t i; + int ret; + + GST_DEBUG("file_name %s, open_flags %d, read_only %d, num_tags %u, out %p.", + file_name, open_flags, read_only, num_tags, out); + + db = calloc(1, sizeof(*db)); + + if (!open_file(file_name, open_flags, &db->file)) + { + free(db); + return CONV_ERROR_OPEN_FAILED; + } + + db->file_name = file_name; + db->num_tags = num_tags; + db->read_only = read_only; + + /* Create entry hash tables. */ + db->seen_blobs = calloc(num_tags, sizeof(*db->seen_blobs)); + for (i = 0; i < num_tags; ++i) + db->seen_blobs[i] = g_hash_table_new_full(hash_func, hash_equal, NULL, free); + + /* Load entries. */ + if ((ret = fozdb_prepare(db)) < 0) + { + GST_ERROR("Failed to prepare fozdb, ret %d.", ret); + fozdb_release(db); + return ret; + } + + GST_INFO("Created fozdb %p from %s.", db, file_name); + + *out = db; + return CONV_OK; +} + +void fozdb_release(struct fozdb *db) +{ + int i; + + GST_DEBUG("db %p.", db); + + for (i = 0; i < db->num_tags; ++i) + g_hash_table_destroy(db->seen_blobs[i]); + free(db->seen_blobs); + close(db->file); + free(db); +} + +int fozdb_prepare(struct fozdb *db) +{ + uint64_t file_size; + int ret; + + GST_DEBUG("db %p, file_name %s, read_only %d, num_tags %u.", + db, db->file_name, db->read_only, db->num_tags); + + db->write_pos = lseek(db->file, 0, SEEK_SET); + if (!get_file_size(db->file, &file_size)) + return CONV_ERROR; + + /* New file, write foz header. */ + if (!file_size) + { + struct file_header file_header; + + memcpy(file_header.magic, FOZDB_MAGIC, sizeof(FOZDB_MAGIC)); + file_header.unused1 = 0; + file_header.unused2 = 0; + file_header.unused3 = 0; + file_header.version = FOZDB_VERSION; + + if (!complete_write(db->file, &file_header, sizeof(file_header))) + { + GST_ERROR("Failed to write file header."); + return CONV_ERROR_WRITE_FAILED; + } + db->write_pos = sizeof(file_header); + + return CONV_OK; + } + + /* Read file header. */ + if ((ret = fozdb_read_file_header(db)) < 0) + return ret; + db->write_pos = lseek(db->file, 0, SEEK_CUR); + + /* Read entries to seen_blobs. */ + while (db->write_pos < file_size) + { + struct payload_entry entry, *table_entry; + uint32_t tag; + + /* Read an entry. */ + if ((ret = fozdb_read_entry_tag_hash_header(db, &tag, &entry.hash, &entry.header) < 0)) + return ret; + entry.offset = lseek(db->file, 0, SEEK_CUR); + + if (!fozdb_seek_to_next_entry(db, &entry.header, NULL)) + return CONV_ERROR_SEEK_FAILED; + db->write_pos = lseek(db->file, 0, SEEK_CUR); + + GST_INFO("Got entry: tag %u, hash %s, offset %#"PRIx64", size %#x, crc %#x.", + tag, format_hash(&entry.hash), entry.offset, entry.header.size, entry.header.crc); + + /* Insert entry to hash table. */ + if (tag >= db->num_tags) + { + GST_WARNING("Invalid tag %u.", tag); + + /* Ignore unknown tags for read-only DBs. */ + if (db->read_only) + continue; + else + return CONV_ERROR_INVALID_TAG; + } + table_entry = calloc(1, sizeof(*table_entry)); + *table_entry = entry; + g_hash_table_insert(db->seen_blobs[tag], &table_entry->hash, table_entry); + } + + return CONV_OK; +} + +bool fozdb_has_entry(struct fozdb *db, uint32_t tag, struct payload_hash *hash) +{ + if (tag >= db->num_tags) + return false; + return g_hash_table_contains(db->seen_blobs[tag], hash); +} + +int fozdb_entry_size(struct fozdb *db, uint32_t tag, struct payload_hash *hash, uint32_t *size) +{ + struct payload_entry *entry; + + if (tag >= db->num_tags) + return CONV_ERROR_INVALID_TAG; + if (!(entry = g_hash_table_lookup(db->seen_blobs[tag], hash))) + return CONV_ERROR_ENTRY_NOT_FOUND; + + *size = entry->header.full_size; + + return CONV_OK; +} + +void fozdb_iter_tag(struct fozdb *db, uint32_t tag, GHashTableIter *iter) +{ + if (tag > db->num_tags) + { + GST_ERROR("Invalid tag %u.", tag); + return; + } + g_hash_table_iter_init(iter, db->seen_blobs[tag]); +} + +int fozdb_read_entry_data(struct fozdb *db, uint32_t tag, struct payload_hash *hash, + uint64_t offset, uint8_t *buffer, size_t size, size_t *read_size, bool with_crc) +{ + struct payload_entry *entry; + size_t to_copy; + + GST_DEBUG("db %p, file_name %s, tag %u, hash %s, offset %#"PRIx64", buffer %p, size %zu, read_size %p, with_crc %d.", + db, db->file_name, tag, format_hash(hash), offset, buffer, size, read_size, with_crc); + + if (tag >= db->num_tags) + return CONV_ERROR_INVALID_TAG; + if (!(entry = g_hash_table_lookup(db->seen_blobs[tag], hash))) + return CONV_ERROR_ENTRY_NOT_FOUND; + + if (entry->header.compression != FOZDB_COMPRESSION_NONE) + return CONV_ERROR_NOT_IMPLEMENTED; + + if (offset >= entry->header.full_size) + return CONV_OK; + + if (lseek(db->file, entry->offset + offset, SEEK_SET) < 0) + return CONV_ERROR_SEEK_FAILED; + + to_copy = min(entry->header.full_size - offset, size); + if (!complete_read(db->file, buffer, to_copy)) + { + GST_ERROR("Failed to read entry data."); + return CONV_ERROR_READ_FAILED; + } + *read_size = to_copy; + + if (entry->header.crc != 0 && with_crc && entry->header.crc != crc32(0, buffer, to_copy)) + { + GST_ERROR("Wrong check sum."); + return CONV_ERROR_WRONG_CHECKSUM; + } + + return CONV_OK; +} + +int fozdb_write_entry(struct fozdb *db, uint32_t tag, struct payload_hash *hash, + void *data_src, data_read_callback read_callback, bool with_crc) +{ + struct payload_header header; + struct payload_entry *entry; + off_t header_offset; + uint32_t size = 0; + size_t read_size; + uint8_t *buffer; + uint64_t offset; + int ret; + + GST_DEBUG("db %p, file_name %s, tag %u, hash %s, data_src %p, read_callback %p, with_crc %d.", + db, db->file_name, tag, format_hash(hash), data_src, read_callback, with_crc); + + if (tag >= db->num_tags) + { + GST_ERROR("Invalid tag %u.", tag); + return CONV_ERROR_INVALID_TAG; + } + if (fozdb_has_entry(db, tag, hash)) + return CONV_OK; + + if (lseek(db->file, db->write_pos, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek file to write_pos %#"PRIx64".", db->write_pos); + return CONV_ERROR_SEEK_FAILED; + } + + /* Write entry name. */ + if (!fozdb_write_entry_name(db, tag, hash)) + return CONV_ERROR_WRITE_FAILED; + + /* Write payload header first. */ + header_offset = lseek(db->file, 0, SEEK_CUR); + header.size = UINT32_MAX; /* Will be filled later. */ + header.compression = FOZDB_COMPRESSION_NONE; + header.crc = 0; /* Will be filled later. */ + header.full_size = UINT32_MAX; /* Will be filled later. */ + if (!complete_write(db->file, &header, sizeof(header))) + { + GST_ERROR("Failed to write entry header."); + return CONV_ERROR_WRITE_FAILED; + } + offset = lseek(db->file, 0, SEEK_CUR); + + /* Write data. */ + buffer = calloc(1, BUFFER_COPY_BYTES); + while ((ret = read_callback(data_src, buffer, BUFFER_COPY_BYTES, &read_size)) == CONV_OK) + { + if (size + read_size > UINT32_MAX) + { + GST_ERROR("Data too large. Fossilize format only supports 4 GB entries."); + free(buffer); + return CONV_ERROR; + } + + size += read_size; + if (!complete_write(db->file, buffer, read_size)) + { + GST_ERROR("Failed to write entry data."); + free(buffer); + return CONV_ERROR_WRITE_FAILED; + } + + if (with_crc) + header.crc = crc32(header.crc, buffer, read_size); + } + db->write_pos = lseek(db->file, 0, SEEK_CUR); + free(buffer); + if (ret != CONV_ERROR_DATA_END) + { + GST_ERROR("Failed to read data from data src, ret %d.", ret); + return ret; + } + + /* Seek back and fill in the size to header. */ + if (lseek(db->file, header_offset, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek back to entry header. %s.", strerror(errno)); + return CONV_ERROR_SEEK_FAILED; + } + header.size = size; + header.full_size = size; + if (!complete_write(db->file, &header, sizeof(header))) + { + GST_ERROR("Failed to write entry header."); + return CONV_ERROR_WRITE_FAILED; + } + + /* Success. Record entry and exit. */ + entry = calloc(1, sizeof(*entry)); + entry->header = header; + entry->hash = *hash; + entry->offset = offset; + g_hash_table_insert(db->seen_blobs[tag], &entry->hash, entry); + + GST_INFO("Wrote entry: tag %u, hash %s, offset %#"PRIx64", size %#x, crc %#x.", + tag, format_hash(&entry->hash), entry->offset, entry->header.size, entry->header.crc); + + return CONV_OK; +} + +/* Rewrites the database, discarding entries listed. */ +int fozdb_discard_entries(struct fozdb *db, GList *to_discard_names) +{ + uint8_t entry_name_and_header[ENTRY_NAME_SIZE + sizeof(struct payload_header)]; + uint64_t file_size; + int i, ret; + + GST_DEBUG("db %p, file_name %s, to_discard_entries %p.", db, db->file_name, to_discard_names); + + /* Rewind the file and clear the entry tables. */ + if (lseek(db->file, 0, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek to file start. %s.", strerror(errno)); + return CONV_ERROR_SEEK_FAILED; + } + for (i = 0; i < db->num_tags; ++i) + g_hash_table_remove_all(db->seen_blobs[i]); + + /* Read file header. */ + if ((ret = fozdb_read_file_header(db)) < 0) + return ret; + db->write_pos = lseek(db->file, 0, SEEK_CUR); + + /* Read each entry and see if it should be discarded. */ + if (!get_file_size(db->file, &file_size)) + return CONV_ERROR; + while (lseek(db->file, 0, SEEK_CUR) < file_size) + { + struct payload_header header; + uint64_t entry_data_offset; + struct entry_name name; + bool truncated; + + if ((ret = fozdb_read_entry_tag_hash_header(db, &name.tag, &name.hash, &header) < 0)) + return CONV_ERROR_READ_FAILED; + entry_data_offset = lseek(db->file, 0, SEEK_CUR); + + /* Check if entry should be discarded. */ + if (g_list_find_custom(to_discard_names, &name, entry_name_compare)) + { + if (!fozdb_seek_to_next_entry(db, &header, &truncated)) + return CONV_ERROR_SEEK_FAILED; + if (truncated) + break; + } + else + { + if (db->write_pos == entry_data_offset - sizeof(entry_name_and_header)) + { + /* If we haven't dropped any chunks, we can just skip it rather than rewrite it. */ + if (!fozdb_seek_to_next_entry(db, &header, &truncated)) + return CONV_ERROR_SEEK_FAILED; + if (truncated) + break; + db->write_pos = lseek(db->file, 0, SEEK_CUR); + } + else + { + /* We're offset, so we have to rewrite. */ + if ((ret = fozdb_copy_entry(db, &name, &header, entry_data_offset)) < 0) + return ret; + } + } + } + + if (ftruncate(db->file, db->write_pos) < 0) + { + GST_ERROR("Failed to truncate file. %s.", strerror(errno)); + return CONV_ERROR; + } + + return fozdb_prepare(db); +} diff --git a/dlls/winegstreamer/media-converter/lib.c b/dlls/winegstreamer/media-converter/lib.c new file mode 100644 index 00000000000..61d7fe8605e --- /dev/null +++ b/dlls/winegstreamer/media-converter/lib.c @@ -0,0 +1,329 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +GST_ELEMENT_REGISTER_DECLARE(protonvideoconverter); +GST_ELEMENT_REGISTER_DECLARE(protonaudioconverter); +GST_ELEMENT_REGISTER_DECLARE(protonaudioconverterbin); + +GST_DEBUG_CATEGORY(media_converter_debug); + +static void get_dirname(const char *path, char *result) +{ + size_t i; + + for (i = strlen(path) - 1; i > 0; --i) + { + if (path[i] == '\\' || path[i] == '/') + break; + } + + memcpy(result, path, i); + result[i] = 0; +} + +static void path_concat(char *result, const char *a, const char *b) +{ + size_t a_len, b_offset; + + a_len = strlen(a); + b_offset = a_len; + memcpy(result, a, a_len); + + if (result[a_len - 1] != '/') + { + result[a_len] = '/'; + ++b_offset; + } + + strcpy(result + b_offset, b); +} + +static bool create_all_dir(const char *dir) +{ + char *ptr, buffer[4096] = {0}; + + strcpy(buffer, dir); + if (buffer[strlen(dir) - 1] != '/') + buffer[strlen(dir)] = '/'; + + ptr = strchr(buffer + 1, '/'); + while (ptr) + { + *ptr = '\0'; + + if (mkdir(buffer, 0777) < 0) + { + if (errno != EEXIST) + { + GST_ERROR("Failed to make directory %s. %s.", buffer, strerror(errno)); + return false; + } + } + *ptr = '/'; + + ptr = strchr(ptr + 1, '/'); + } + return true; +} + +static int create_file(const char *file_name) +{ + int fd, ret = CONV_OK; + char dir[4096]; + + get_dirname(file_name, dir); + if (access(dir, F_OK) < 0 && !create_all_dir(dir)) + return CONV_ERROR_PATH_NOT_FOUND; + + if ((fd = open(file_name, O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) + { + GST_WARNING("Failed to open file %s with O_CREAT. %s.", file_name, strerror(errno)); + return CONV_ERROR_OPEN_FAILED; + } + + if (futimens(fd, NULL) < 0) + { + GST_WARNING("Failed to set file %s timestamps. %s.", file_name, strerror(errno)); + ret = CONV_ERROR; + } + + close(fd); + + return ret; +} + +bool open_file(const char *file_name, int open_flags, int *out_fd) +{ + int fd; + + if ((fd = open(file_name, open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) + { + GST_WARNING("Failed to open %s with flags %d. %s.", file_name, open_flags, strerror(errno)); + return false; + } + + *out_fd = fd; + return true; +} + +bool get_file_size(int fd, uint64_t *file_size) +{ + struct stat file_info; + + if (fstat(fd, &file_info) < 0) + { + GST_WARNING("Failed to fstat fd %d. %s.", fd, strerror(errno)); + return false; + } + + *file_size = file_info.st_size; + return true; +} + +bool complete_read(int file, void *buffer, size_t size) +{ + size_t current_read = 0; + ssize_t read_size; + errno = 0; + + while (current_read < size) + { + read_size = read(file, ((char *)buffer) + current_read, size - current_read); + if(read_size <= 0) + { + if(errno != EINTR && errno != EAGAIN) + return false; + } + else + { + current_read += read_size; + } + } + + return current_read == size; +} + +bool complete_write(int file, const void *buffer, size_t size) +{ + size_t current_write = 0; + ssize_t write_size; + errno = 0; + + while (current_write < size) + { + write_size = write(file, (const char *)buffer + current_write, size - current_write); + if(write_size < 0) + { + if(errno != EINTR && errno != EAGAIN) + return false; + } + else + { + current_write += write_size; + } + } + + return current_write == size; +} + +uint32_t crc32(uint32_t crc, const uint8_t *ptr, size_t buf_len) +{ + static const uint32_t s_crc_table[256] = + { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, + 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, + 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, + 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, + 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, + 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, + 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, + 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, + 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, + 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, + 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, + 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, + 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, + 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, + 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, + 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, + 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, + 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, + 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, + 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, + }; + uint32_t crc32 = (uint32_t)crc ^ 0xffffffff; + const uint8_t *buffer = (const uint8_t *)ptr; + + while (buf_len >= 4) + { + crc32 = (crc32 >> 8) ^ s_crc_table[(crc32 ^ buffer[0]) & 0xff]; + crc32 = (crc32 >> 8) ^ s_crc_table[(crc32 ^ buffer[1]) & 0xff]; + crc32 = (crc32 >> 8) ^ s_crc_table[(crc32 ^ buffer[2]) & 0xff]; + crc32 = (crc32 >> 8) ^ s_crc_table[(crc32 ^ buffer[3]) & 0xff]; + buffer += 4; + buf_len -= 4; + } + + while (buf_len) + { + crc32 = (crc32 >> 8) ^ s_crc_table[(crc32 ^ buffer[0]) & 0xff]; + ++buffer; + --buf_len; + } + + return ~crc32; +} + +int create_placeholder_file(const char *file_name) +{ + const char *shader_path; + char path[1024]; + int ret; + + if ((shader_path = getenv("STEAM_COMPAT_SHADER_PATH"))) + { + path_concat(path, shader_path, file_name); + if ((ret = create_file(path)) < 0) + GST_ERROR("Failed to create %s file, ret %d.", file_name, ret); + } + else + { + GST_ERROR("Env STEAM_COMPAT_SHADER_PATH not set."); + ret = CONV_ERROR_ENV_NOT_SET; + } + + return ret; +} + +int dump_fozdb_open(struct dump_fozdb *db, bool create, const char *file_path_env, int num_tags) +{ + char *dump_file_path; + + if (db->fozdb) + return CONV_OK; + + if (!(dump_file_path = getenv(file_path_env))) + { + GST_ERROR("Env %s not set.", file_path_env); + return CONV_ERROR_ENV_NOT_SET; + } + + if (create) + create_file(dump_file_path); + + return fozdb_create(dump_file_path, O_RDWR, false, num_tags, &db->fozdb); +} + +void dump_fozdb_close(struct dump_fozdb *db) +{ + if (db->fozdb) + { + fozdb_release(db->fozdb); + db->fozdb = NULL; + } +} + +bool media_converter_init(void) +{ + GST_DEBUG_CATEGORY_INIT(media_converter_debug, + "protonmediaconverter", GST_DEBUG_FG_YELLOW, "Proton media converter"); + + if (!GST_ELEMENT_REGISTER(protonvideoconverter, NULL)) + { + GST_ERROR("Failed to register protonvideoconverter."); + return false; + } + + if (!GST_ELEMENT_REGISTER(protonaudioconverter, NULL)) + { + GST_ERROR("Failed to register protonaudioconverter."); + return false; + } + + if (!GST_ELEMENT_REGISTER(protonaudioconverterbin, NULL)) + { + GST_ERROR("Failed to register protonaudioconverterbin."); + return false; + } + + return true; +} diff --git a/dlls/winegstreamer/media-converter/media-converter.h b/dlls/winegstreamer/media-converter/media-converter.h new file mode 100644 index 00000000000..51b54147806 --- /dev/null +++ b/dlls/winegstreamer/media-converter/media-converter.h @@ -0,0 +1,287 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __MEDIA_CONVERTER_H__ +#define __MEDIA_CONVERTER_H__ + +#define _FILE_OFFSET_BITS 64 + +#include +#include +#include +#include + +#include "unix_private.h" + +GST_DEBUG_CATEGORY_EXTERN(media_converter_debug); +#undef GST_CAT_DEFAULT +#define GST_CAT_DEFAULT media_converter_debug + +typedef int (*data_read_callback)(void *data_reader, uint8_t *buffer, size_t size, size_t *read_size); + +/* Changing this will invalidate the cache. You MUST clear it. */ +#define HASH_SEED 0x4AA61F63 + +enum conv_ret +{ + CONV_OK = 0, + CONV_ERROR = -1, + CONV_ERROR_NOT_IMPLEMENTED = -2, + CONV_ERROR_INVALID_ARGUMENT = -3, + CONV_ERROR_OPEN_FAILED = -4, + CONV_ERROR_READ_FAILED = -5, + CONV_ERROR_WRITE_FAILED = -6, + CONV_ERROR_SEEK_FAILED = -7, + CONV_ERROR_CORRUPT_DATABASE = -8, + CONV_ERROR_WRONG_CHECKSUM = -9, + CONV_ERROR_ENTRY_NOT_FOUND = -10, + CONV_ERROR_ENV_NOT_SET = -11, + CONV_ERROR_PATH_NOT_FOUND = -12, + CONV_ERROR_INVALID_TAG = -13, + CONV_ERROR_DATA_END = -14, +}; + +struct murmur3_x64_128_state +{ + uint32_t seed; + uint64_t h1; + uint64_t h2; + size_t processed; +}; + +struct murmur3_x86_128_state +{ + uint32_t seed; + uint32_t h1; + uint32_t h2; + uint32_t h3; + uint32_t h4; + size_t processed; +}; + +struct bytes_reader +{ + const uint8_t *data; + size_t size; + size_t offset; +}; + +struct gst_buffer_reader +{ + GstBuffer *buffer; /* No ref here, no need to unref. */ + size_t offset; +}; + +struct payload_hash +{ + uint32_t hash[4]; +}; + +struct entry_name +{ + uint32_t tag; + struct payload_hash hash; +}; + +struct dump_fozdb +{ + pthread_mutex_t mutex; + struct fozdb *fozdb; + bool already_cleaned; +}; + +struct fozdb +{ + const char *file_name; + int file; + bool read_only; + uint64_t write_pos; + GHashTable **seen_blobs; + uint32_t num_tags; +}; + +/* lib.c. */ +extern bool open_file(const char *file_name, int open_flags, int *out_fd); +extern bool get_file_size(int fd, uint64_t *file_size); +extern bool complete_read(int file, void *buffer, size_t size); +extern bool complete_write(int file, const void *buffer, size_t size); +extern uint32_t crc32(uint32_t crc, const uint8_t *ptr, size_t buf_len); +extern int create_placeholder_file(const char *file_name); +extern int dump_fozdb_open(struct dump_fozdb *db, bool create, const char *file_path_env, int num_tags); +extern void dump_fozdb_close(struct dump_fozdb *db); + +/* murmur3.c. */ +extern void murmur3_x64_128_state_init(struct murmur3_x64_128_state *state, uint32_t seed); +extern void murmur3_x64_128_state_reset(struct murmur3_x64_128_state *state); +extern bool murmur3_x64_128_full(void *data_src, data_read_callback read_callback, + struct murmur3_x64_128_state* state, void *out); +extern bool murmur3_x64_128(void *data_src, data_read_callback read_callback, uint32_t seed, void *out); +extern void murmur3_x86_128_state_init(struct murmur3_x86_128_state *state, uint32_t seed); +extern void murmur3_x86_128_state_reset(struct murmur3_x86_128_state *state); +extern bool murmur3_x86_128_full(void *data_src, data_read_callback read_callback, + struct murmur3_x86_128_state* state, void *out); +extern bool murmur3_x86_128(void *data_src, data_read_callback read_callback, uint32_t seed, void *out); +#ifdef __x86_64__ +#define murmur3_128_state murmur3_x64_128_state +#define murmur3_128_state_init murmur3_x64_128_state_init +#define murmur3_128_state_reset murmur3_x64_128_state_reset +#define murmur3_128_full murmur3_x64_128_full +#define murmur3_128 murmur3_x64_128 +#elif defined(__i386__) +#define murmur3_128_state murmur3_x86_128_state +#define murmur3_128_state_init murmur3_x86_128_state_init +#define murmur3_128_state_reset murmur3_x86_128_state_reset +#define murmur3_128_full murmur3_x86_128_full +#define murmur3_128 murmur3_x86_128 +#endif /* __x86_64__ */ + +/* fossilize.c. */ +extern int fozdb_create(const char *file_name, int open_flags, bool read_only, uint32_t num_tags, struct fozdb **out); +extern void fozdb_release(struct fozdb *db); +extern int fozdb_prepare(struct fozdb *db); +extern bool fozdb_has_entry(struct fozdb *db, uint32_t tag, struct payload_hash *hash); +extern int fozdb_entry_size(struct fozdb *db, uint32_t tag, struct payload_hash *hash, uint32_t *size); +extern void fozdb_iter_tag(struct fozdb *db, uint32_t tag, GHashTableIter *iter); +extern int fozdb_read_entry_data(struct fozdb *db, uint32_t tag, struct payload_hash *hash, + uint64_t offset, uint8_t *buffer, size_t size, size_t *read_size, bool with_crc); +extern int fozdb_write_entry(struct fozdb *db, uint32_t tag, struct payload_hash *hash, + void *data_src, data_read_callback read_callback, bool with_crc); +extern int fozdb_discard_entries(struct fozdb *db, GList *to_discard_entries); + +static inline bool option_enabled(const char *env) +{ + const char *env_var; + + if (!(env_var = getenv(env))) + return false; + + return strcmp(env_var, "0") != 0; +} + +static inline bool discarding_disabled(void) +{ + return option_enabled("MEDIACONV_DONT_DISCARD"); +} + +static inline const char *format_hash(struct payload_hash *hash) +{ + int hash_str_size = 2 + sizeof(*hash) * 2 + 1; + static char buffer[1024] = {}; + static int offset = 0; + char *ret; + + if (offset + hash_str_size > sizeof(buffer)) + offset = 0; + + ret = buffer + offset; + sprintf(ret, "0x%08x%08x%08x%08x", hash->hash[3], hash->hash[2], hash->hash[1], hash->hash[0]); + offset += hash_str_size; + + return ret; +} + +static inline void bytes_reader_init(struct bytes_reader *reader, const uint8_t *data, size_t size) +{ + reader->data = data; + reader->size = size; + reader->offset = 0; +} + +static inline int bytes_reader_read(void *data_reader, uint8_t *buffer, size_t size, size_t *read_size) +{ + struct bytes_reader *reader = data_reader; + size_t data_size, to_copy; + + if (!size) + { + *read_size = 0; + return CONV_OK; + } + + if (!(data_size = reader->size - reader->offset)) + return CONV_ERROR_DATA_END; + + to_copy = min(data_size, size); + memcpy(buffer, reader->data + reader->offset, to_copy); + reader->offset += to_copy; + + *read_size = to_copy; + return CONV_OK; +} + +static inline void gst_buffer_reader_init(struct gst_buffer_reader *reader, GstBuffer *buffer) +{ + reader->buffer = buffer; /* No ref here, so no need to unref. */ + reader->offset = 0; +} + +static inline int gst_buffer_reader_read(void *data_reader, uint8_t *buffer, size_t size, size_t *read_size) +{ + struct gst_buffer_reader *reader = data_reader; + + if (!size) + { + *read_size = 0; + return CONV_OK; + } + + *read_size = gst_buffer_extract(reader->buffer, reader->offset, buffer, size); + reader->offset += *read_size; + if (!*read_size) + return CONV_ERROR_DATA_END; + + return CONV_OK; +} + +static inline bool file_exists(const char *file_path) +{ + if (!file_path) + return false; + return access(file_path, F_OK) == 0; +} + +static inline struct entry_name *entry_name_create(uint32_t tag, struct payload_hash *hash) +{ + struct entry_name *entry = calloc(1, sizeof(*entry)); + entry->tag = tag; + entry->hash = *hash; + return entry; +} + +static inline gint entry_name_compare(const void *a, const void *b) +{ + return memcmp(a, b, sizeof(struct entry_name)); +} + +static inline uint32_t bytes_to_uint32(const uint8_t *bytes) +{ + return ((uint32_t)bytes[0] << 0) + | ((uint32_t)bytes[1] << 8) + | ((uint32_t)bytes[2] << 16) + | ((uint32_t)bytes[3] << 24); +} + +static inline void payload_hash_from_bytes(struct payload_hash *hash, uint8_t *bytes) +{ + hash->hash[0] = bytes_to_uint32(bytes + 0); + hash->hash[1] = bytes_to_uint32(bytes + 4); + hash->hash[2] = bytes_to_uint32(bytes + 8); + hash->hash[3] = bytes_to_uint32(bytes + 12); +} + +#endif /* __MEDIA_CONVERTER_H__ */ diff --git a/dlls/winegstreamer/media-converter/murmur3.c b/dlls/winegstreamer/media-converter/murmur3.c new file mode 100644 index 00000000000..014345e61d5 --- /dev/null +++ b/dlls/winegstreamer/media-converter/murmur3.c @@ -0,0 +1,371 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +static uint64_t rotl64(uint64_t value, uint8_t shift) +{ + return (value << shift) | (value >> (64 - shift)); +} + +static uint32_t rotl32(uint32_t value, uint8_t shift) +{ + return (value << shift) | (value >> (32 - shift)); +} + +static uint64_t fmix64(uint64_t h) +{ + const uint64_t c1 = 0xff51afd7ed558ccd; + const uint64_t c2 = 0xc4ceb9fe1a85ec53; + const uint32_t r = 33; + + h ^= h >> r; + h *= c1; + h ^= h >> r; + h *= c2; + h ^= h >> r; + + return h; +} + +static uint32_t fmix32 (uint32_t h) +{ + const uint32_t c1 = 0x85ebca6b; + const uint32_t c2 = 0xc2b2ae35; + const uint32_t r1 = 16; + const uint32_t r2 = 13; + + h ^= h >> r1; + h *= c1; + h ^= h >> r2; + h *= c2; + h ^= h >> r1; + + return h; +} + +void murmur3_x64_128_state_init(struct murmur3_x64_128_state *state, uint32_t seed) +{ + state->seed = seed; + state->h1 = seed; + state->h2 = seed; + state->processed = 0; +} + +void murmur3_x64_128_state_reset(struct murmur3_x64_128_state *state) +{ + state->h1 = state->seed; + state->h2 = state->seed; + state->processed = 0; +} + +bool murmur3_x64_128_full(void *data_reader, data_read_callback read_callback, + struct murmur3_x64_128_state* state, void *out) +{ + const uint64_t c1 = 0x87c37b91114253d5, c2 = 0x4cf5ad432745937f, c3 = 0x52dce729, c4 = 0x38495ab5, m = 5; + size_t read_size, processed = state->processed; + const uint32_t r1 = 27, r2 = 31, r3 = 33; + uint64_t h1 = state->h1, h2 = state->h2; + uint8_t buffer[16] = {0}; + uint64_t k1, k2; + int ret; + + while ((ret = read_callback(data_reader, buffer, sizeof(buffer), &read_size)) == CONV_OK) + { + processed += read_size; + + if (read_size == 16) + { + k1 = *(uint64_t *)&buffer[0]; + k2 = *(uint64_t *)&buffer[8]; + + k1 *= c1; + k1 = rotl64(k1, r2); + k1 *= c2; + h1 ^= k1; + h1 = rotl64(h1, r1); + h1 += h2; + h1 = h1 * m + c3; + + k2 *= c2; + k2 = rotl64(k2, r3); + k2 *= c1; + h2 ^= k2; + h2 = rotl64(h2, r2); + h2 += h1; + h2 = h2 * m + c4; + } + else + { + k1 = 0; + k2 = 0; + + switch (read_size) + { + case 15: + k2 ^= ((uint64_t)buffer[14]) << 48; + case 14: + k2 ^= ((uint64_t)buffer[13]) << 40; + case 13: + k2 ^= ((uint64_t)buffer[12]) << 32; + case 12: + k2 ^= ((uint64_t)buffer[11]) << 24; + case 11: + k2 ^= ((uint64_t)buffer[10]) << 16; + case 10: + k2 ^= ((uint64_t)buffer[9]) << 8; + case 9: + k2 ^= ((uint64_t)buffer[8]) << 0; + k2 *= c2; + k2 = rotl64(k2, r3); + k2 *= c1; + h2 ^= k2; + case 8: + k1 ^= ((uint64_t)buffer[7]) << 56; + case 7: + k1 ^= ((uint64_t)buffer[6]) << 48; + case 6: + k1 ^= ((uint64_t)buffer[5]) << 40; + case 5: + k1 ^= ((uint64_t)buffer[4]) << 32; + case 4: + k1 ^= ((uint64_t)buffer[3]) << 24; + case 3: + k1 ^= ((uint64_t)buffer[2]) << 16; + case 2: + k1 ^= ((uint64_t)buffer[1]) << 8; + case 1: + k1 ^= ((uint64_t)buffer[0]) << 0; + k1 *= c1; + k1 = rotl64(k1, r2); + k1 *= c2; + h1 ^= k1; + } + } + } + + if (ret != CONV_ERROR_DATA_END) + return false; + + state->processed = processed; + state->h1 = h1; + state->h2 = h2; + + h1 ^= (uint64_t)processed; + h2 ^= (uint64_t)processed; + h1 += h2; + h2 += h1; + h1 = fmix64(h1); + h2 = fmix64(h2); + h1 += h2; + h2 += h1; + + ((uint64_t *)out)[0] = h1; + ((uint64_t *)out)[1] = h2; + + return true; +} + +bool murmur3_x64_128(void *data_src, data_read_callback read_callback, uint32_t seed, void *out) +{ + struct murmur3_x64_128_state state; + murmur3_x64_128_state_init(&state, seed); + return murmur3_x64_128_full(data_src, read_callback, &state, out); +} + +void murmur3_x86_128_state_init(struct murmur3_x86_128_state *state, uint32_t seed) +{ + state->seed = seed; + state->h1 = seed; + state->h2 = seed; + state->h3 = seed; + state->h4 = seed; + state->processed = 0; +} + +void murmur3_x86_128_state_reset(struct murmur3_x86_128_state *state) +{ + state->h1 = state->seed; + state->h2 = state->seed; + state->h3 = state->seed; + state->h4 = state->seed; + state->processed = 0; +} + +bool murmur3_x86_128_full(void *data_reader, data_read_callback read_callback, + struct murmur3_x86_128_state *state, void *out) +{ + const uint32_t c1 = 0x239b961b, c2 = 0xab0e9789, c3 = 0x38b34ae5, c4 = 0xa1e38b93; + const uint32_t c5 = 0x561ccd1b, c6 = 0x0bcaa747, c7 = 0x96cd1c35, c8 = 0x32ac3b17; + uint32_t h1 = state->h1, h2 = state->h2, h3 = state->h3, h4 = state->h4; + size_t read_size, processed = state->processed; + unsigned char buffer[16] = {0}; + uint64_t k1, k2, k3, k4; + const uint32_t m = 5; + int ret; + + while ((ret = read_callback(data_reader, buffer, sizeof(buffer), &read_size)) == CONV_OK) + { + processed += read_size; + + if (read_size == 16) + { + k1 = *(uint32_t*)&buffer[0]; + k2 = *(uint32_t*)&buffer[4]; + k3 = *(uint32_t*)&buffer[8]; + k4 = *(uint32_t*)&buffer[12]; + + k1 *= c1; + k1 = rotl32(k1, 15); + k1 *= c2; + h1 ^= k1; + h1 = rotl32(h1, 19); + h1 += h2; + h1 = h1 * m + c5; + + k2 *= c2; + k2 = rotl32(k2, 16); + k2 *= c3; + h2 ^= k2; + h2 = rotl32(h2, 17); + h2 += h3; + h2 = h2 * m + c6; + + k3 *= c3; + k3 = rotl32(k3, 17); + k3 *= c4; + h3 ^= k3; + h3 = rotl32(h3, 15); + h3 += h4; + h3 = h3 * m + c7; + + k4 *= c4; + k4 = rotl32(k4, 18); + k4 *= c1; + h4 ^= k4; + h4 = rotl32(h4, 13); + h4 += h1; + h4 = h4 * m + c8; + } + else + { + k1 = 0; + k2 = 0; + k3 = 0; + k4 = 0; + + switch (read_size) + { + case 15: + k4 ^= buffer[14] << 16; + case 14: + k4 ^= buffer[13] << 8; + case 13: + k4 ^= buffer[12] << 0; + k4 *= c4; + k4 = rotl32(k4,18); + k4 *= c1; + h4 ^= k4; + case 12: + k3 ^= buffer[11] << 24; + case 11: + k3 ^= buffer[10] << 16; + case 10: + k3 ^= buffer[9] << 8; + case 9: + k3 ^= buffer[8] << 0; + k3 *= c3; + k3 = rotl32(k3, 17); + k3 *= c4; + h3 ^= k3; + case 8: + k2 ^= buffer[7] << 24; + case 7: + k2 ^= buffer[6] << 16; + case 6: + k2 ^= buffer[5] << 8; + case 5: + k2 ^= buffer[4] << 0; + k2 *= c2; + k2 = rotl32(k2, 16); + k2 *= c3; + h2 ^= k2; + case 4: + k1 ^= buffer[3] << 24; + case 3: + k1 ^= buffer[2] << 16; + case 2: + k1 ^= buffer[1] << 8; + case 1: + k1 ^= buffer[0] << 0; + k1 *= c1; + k1 = rotl32(k1, 15); + k1 *= c2; + h1 ^= k1; + } + } + } + + if (ret != CONV_ERROR_DATA_END) + return false; + + state->processed = processed; + state->h1 = h1; + state->h2 = h2; + state->h3 = h3; + state->h4 = h4; + + h1 ^= processed; + h2 ^= processed; + h3 ^= processed; + h4 ^= processed; + h1 += h2; + h1 += h3; + h1 += h4; + h2 += h1; + h3 += h1; + h4 += h1; + h1 = fmix32(h1); + h2 = fmix32(h2); + h3 = fmix32(h3); + h4 = fmix32(h4); + h1 += h2; + h1 += h3; + h1 += h4; + h2 += h1; + h3 += h1; + h4 += h1; + + ((uint32_t*)out)[0] = h1; + ((uint32_t*)out)[1] = h2; + ((uint32_t*)out)[2] = h3; + ((uint32_t*)out)[3] = h4; + + return true; +} + +bool murmur3_x86_128(void *data_src, data_read_callback read_callback, uint32_t seed, void *out) +{ + struct murmur3_x86_128_state state; + murmur3_x86_128_state_init(&state, seed); + return murmur3_x86_128_full(data_src, read_callback, &state, out); +} diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c new file mode 100644 index 00000000000..b91aa96f1bf --- /dev/null +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -0,0 +1,938 @@ +/* + * Copyright 2024 Ziqing Hui for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Algorithm + * --------- + * + * Nicely, both Quartz and Media Foundation allow us random access to the entire data stream. So we + * can easily hash the entire incoming stream and substitute it with our Ogg Theora video. If there + * is a cache miss, then we dump the entire incoming stream. In case of a cache hit, we dump + * nothing. + * + * Incoming video data is stored in the video.foz Fossilize database. + * + * Transcoded video data is stored in the transcoded_video.foz Fossilize database. + * + * + * Hashing algorithm + * ----------------- + * + * We use murmur3 hash with the seed given below. We use the x32 variant for 32-bit programs, and + * the x64 variant for 64-bit programs. + * + * For speed when hashing, we specify a stride which will skip over chunks of the input. However, + * we will always hash the first "stride" number of bytes, to try to avoid collisions on smaller + * files with size between chunk and stride. + * + * For example, the 'H's below are hashed, the 'x's are skipped: + * + * int chunk = 4; + * int stride = chunk * 3; + * H = hashed, x = skipped + * [HHHH HHHH HHHH HHHH xxxx xxxx HHHH xxxx xxxx HHHH xxxx] < data stream + * ^^^^ ^^^^ ^^^^ stride prefix, hashed + * ^^^^ chunk + * ^^^^ ^^^^ ^^^^ stride + * ^^^^ chunk + * ^^^^ ^^^^ ^^^^ stride + * ^^^^ chunk + * ^^^^ ^^^^ stride + */ + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +#include + +#define HASH_CHUNK_SIZE (8 * 1024 * 1024) /* 8 MB. */ +#define HASH_STRIDE (HASH_CHUNK_SIZE * 6) + +#define VIDEO_CONV_FOZ_TAG_VIDEODATA 0 +#define VIDEO_CONV_FOZ_TAG_OGVDATA 1 +#define VIDEO_CONV_FOZ_TAG_STREAM 2 +#define VIDEO_CONV_FOZ_TAG_MKVDATA 3 +#define VIDEO_CONV_FOZ_NUM_TAGS 4 + +#define DURATION_NONE (UINT64_MAX) + +struct pad_reader +{ + GstPad *pad; + size_t offset; + uint8_t *chunk; + size_t chunk_offset; + size_t chunk_end; + size_t stride; /* Set to SIZE_MAX to skip no bytes. */ +}; + +struct hashes_reader +{ + GList *current_hash; +}; + +struct video_conv_state +{ + struct payload_hash transcode_hash; + struct fozdb *read_fozdb; + uint64_t upstream_duration; + uint64_t our_duration; + uint32_t transcoded_tag; + bool has_transcoded, need_stream_start; +}; + +typedef struct +{ + GstElement element; + GstPad *sink_pad, *src_pad; + pthread_mutex_t state_mutex; + struct video_conv_state *state; +} VideoConv; + +typedef struct +{ + GstElementClass class; +} VideoConvClass; + +G_DEFINE_TYPE(VideoConv, video_conv, GST_TYPE_ELEMENT); +#define VIDEO_CONV_TYPE (video_conv_get_type()) +#define VIDEO_CONV(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), VIDEO_CONV_TYPE, VideoConv)) +#define parent_class (video_conv_parent_class) +GST_ELEMENT_REGISTER_DEFINE(protonvideoconverter, "protonvideoconverter", + GST_RANK_MARGINAL, VIDEO_CONV_TYPE); + +static GstStaticPadTemplate video_conv_sink_template = GST_STATIC_PAD_TEMPLATE("sink", + GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS("video/x-ms-asf; video/x-msvideo; video/mpeg; video/quicktime;")); + +static GstStaticPadTemplate video_conv_src_template = GST_STATIC_PAD_TEMPLATE("src", + GST_PAD_SRC, GST_PAD_ALWAYS, + GST_STATIC_CAPS("video/x-matroska; application/ogg;")); + +static struct dump_fozdb dump_fozdb = {PTHREAD_MUTEX_INITIALIZER, NULL, false}; + +void hashes_reader_init(struct hashes_reader *reader, GList *hashes) +{ + reader->current_hash = hashes; +} + +static int hashes_reader_read(void *reader, uint8_t *buffer, size_t size, size_t *read_size) +{ + struct payload_hash *hash = (struct payload_hash *)buffer; + struct hashes_reader *hashes_reader = reader; + + if (!size) + { + *read_size = 0; + return CONV_OK; + } + + if (!hashes_reader->current_hash) + return CONV_ERROR_DATA_END; + + *hash = *(struct payload_hash *)(hashes_reader->current_hash->data); + hashes_reader->current_hash = hashes_reader->current_hash->next; + + *read_size = sizeof(*hash); + return CONV_OK; +} + +static int dump_fozdb_open_video(bool create) +{ + return dump_fozdb_open(&dump_fozdb, create, "MEDIACONV_VIDEO_DUMP_FILE", VIDEO_CONV_FOZ_NUM_TAGS); +} + +static void dump_fozdb_discard_transcoded(void) +{ + GList *to_discard_chunks = NULL; + struct payload_hash *stream_id; + struct fozdb *read_fozdb; + char *read_fozdb_path; + GHashTableIter iter; + int ret; + + if (dump_fozdb.already_cleaned) + return; + dump_fozdb.already_cleaned = true; + + if (discarding_disabled()) + return; + if (!file_exists(getenv("MEDIACONV_VIDEO_DUMP_FILE"))) + return; + + if (dump_fozdb_open_video(false) < 0) + return; + + if (!(read_fozdb_path = getenv("MEDIACONV_VIDEO_TRANSCODED_FILE"))) + { + GST_ERROR("Env MEDIACONV_VIDEO_TRANSCODED_FILE not set."); + return; + } + + if ((ret = fozdb_create(read_fozdb_path, O_RDONLY, true /* Read-only? */, VIDEO_CONV_FOZ_NUM_TAGS, &read_fozdb)) < 0) + { + GST_ERROR("Failed to create read fozdb, ret %d.", ret); + return; + } + + fozdb_iter_tag(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_STREAM, &iter); + while (g_hash_table_iter_next(&iter, (void **)&stream_id, NULL)) + { + struct payload_hash chunk_id; + uint32_t chunks_size, i; + size_t read_size; + + if (fozdb_has_entry(read_fozdb, VIDEO_CONV_FOZ_TAG_OGVDATA, stream_id)) + { + if (fozdb_entry_size(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_STREAM, stream_id, &chunks_size) == CONV_OK) + { + uint8_t *buffer = calloc(1, chunks_size); + if (fozdb_read_entry_data(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_STREAM, stream_id, + 0, buffer, chunks_size, &read_size, true) == CONV_OK) + { + for (i = 0; i < read_size / sizeof(chunk_id); ++i) + { + payload_hash_from_bytes(&chunk_id, buffer + i * sizeof(chunk_id)); + to_discard_chunks = g_list_append(to_discard_chunks, + entry_name_create(VIDEO_CONV_FOZ_TAG_VIDEODATA, &chunk_id)); + } + } + free(buffer); + } + + to_discard_chunks = g_list_append(to_discard_chunks, + entry_name_create(VIDEO_CONV_FOZ_TAG_STREAM, stream_id)); + } + } + + if ((ret = fozdb_discard_entries(dump_fozdb.fozdb, to_discard_chunks)) < 0) + { + GST_ERROR("Failed to discard entries, ret %d.", ret); + dump_fozdb_close(&dump_fozdb); + } + + g_list_free_full(to_discard_chunks, free); +} + +struct pad_reader *pad_reader_create_with_stride(GstPad *pad, size_t stride) +{ + struct pad_reader *pad_reader; + + pad_reader = calloc(1, sizeof(*pad_reader)); + pad_reader->chunk = calloc(HASH_CHUNK_SIZE, sizeof(*pad_reader->chunk)); + pad_reader->stride = stride; + gst_object_ref((pad_reader->pad = pad)); + + return pad_reader; +} + +struct pad_reader *pad_reader_create(GstPad *pad) +{ + return pad_reader_create_with_stride(pad, SIZE_MAX); +} + +void pad_reader_release(struct pad_reader *reader) +{ + gst_object_unref(reader->pad); + free(reader->chunk); + free(reader); +} + +int pad_reader_read(void *data_src, uint8_t *buffer, size_t size, size_t *read_size) +{ + struct pad_reader *reader = data_src; + GstBuffer *gst_buffer = NULL; + GstFlowReturn gst_ret; + size_t to_copy; + + if (!size) + { + *read_size = 0; + return CONV_OK; + } + + if (reader->chunk_offset >= reader->chunk_end) + { + reader->chunk_offset = 0; + reader->chunk_end = 0; + + if ((gst_ret = gst_pad_pull_range(reader->pad, + reader->offset, HASH_CHUNK_SIZE, &gst_buffer)) == GST_FLOW_OK) + { + gsize buffer_size = gst_buffer_get_size(gst_buffer); + + if (reader->offset + buffer_size < reader->stride) + { + to_copy = buffer_size; + reader->offset += to_copy; + } + else if (reader->offset < reader->stride) + { + to_copy = reader->stride - reader->offset; + reader->offset = reader->stride; + } + else + { + to_copy = buffer_size; + reader->offset += reader->stride; + } + + if (size >= to_copy) /* Copy directly into out buffer and return. */ + { + *read_size = gst_buffer_extract(gst_buffer, 0, buffer, to_copy); + gst_buffer_unref(gst_buffer); + return CONV_OK; + } + else + { + reader->chunk_end = gst_buffer_extract(gst_buffer, 0, reader->chunk, to_copy); + gst_buffer_unref(gst_buffer); + } + } + else if (gst_ret == GST_FLOW_EOS) + { + return CONV_ERROR_DATA_END; + } + else + { + GST_WARNING("Failed to pull data from %"GST_PTR_FORMAT", reason %s.", + reader->pad, gst_flow_get_name(gst_ret)); + return CONV_ERROR; + } + } + + /* Copy chunk data to output buffer. */ + to_copy = min(reader->chunk_end - reader->chunk_offset, size); + memcpy(buffer, reader->chunk + reader->chunk_offset, to_copy); + reader->chunk_offset += to_copy; + + *read_size = to_copy; + return CONV_OK; +} + +static int video_conv_state_create(struct video_conv_state **out) +{ + struct video_conv_state *state; + struct fozdb *fozdb = NULL; + char *read_fozdb_path; + int ret; + + if (!(read_fozdb_path = getenv("MEDIACONV_VIDEO_TRANSCODED_FILE"))) + { + GST_ERROR("MEDIACONV_VIDEO_TRANSCODED_FILE is not set."); + return CONV_ERROR_ENV_NOT_SET; + } + + if ((ret = fozdb_create(read_fozdb_path, O_RDONLY, true /* Read-only? */, VIDEO_CONV_FOZ_NUM_TAGS, &fozdb)) < 0) + GST_ERROR("Failed to create read fozdb from %s, ret %d.", read_fozdb_path, ret); + + state = calloc(1, sizeof(*state)); + state->read_fozdb = fozdb; + state->upstream_duration = DURATION_NONE; + state->our_duration = DURATION_NONE; + state->transcoded_tag = VIDEO_CONV_FOZ_TAG_MKVDATA; + state->need_stream_start = true; + + *out = state; + return CONV_OK; +} + +static void video_conv_state_release(struct video_conv_state *state) +{ + if (state->read_fozdb) + fozdb_release(state->read_fozdb); + free(state); +} + +/* Return true if the file is transcoded, false if not. */ +bool video_conv_state_begin_transcode(struct video_conv_state *state, struct payload_hash *hash) +{ + const char *blank_video; + uint64_t file_size = 0; + int fd; + + GST_DEBUG("state %p, hash %s.", state, format_hash(hash)); + + if (state->read_fozdb) + { + uint32_t entry_size; + + if (fozdb_entry_size(state->read_fozdb, VIDEO_CONV_FOZ_TAG_MKVDATA, hash, &entry_size) == CONV_OK) + { + GST_DEBUG("Found an MKV video for hash %s.", format_hash(hash)); + state->transcode_hash = *hash; + state->our_duration = entry_size; + state->transcoded_tag = VIDEO_CONV_FOZ_TAG_MKVDATA; + state->has_transcoded = true; + return true; + } + + if (fozdb_entry_size(state->read_fozdb, VIDEO_CONV_FOZ_TAG_OGVDATA, hash, &entry_size) == CONV_OK) + { + GST_DEBUG("Found an OGV video for hash %s.", format_hash(hash)); + state->transcode_hash = *hash; + state->our_duration = entry_size; + state->transcoded_tag = VIDEO_CONV_FOZ_TAG_OGVDATA; + state->has_transcoded = true; + return true; + } + } + + GST_INFO("No transcoded video for %s. Substituting a blank video.", format_hash(hash)); + + if (!(blank_video = getenv("MEDIACONV_BLANK_VIDEO_FILE"))) + { + GST_ERROR("Env MEDIACONV_BLANK_VIDEO_FILE not set."); + return false; + } + if (open_file(blank_video, O_RDONLY, &fd)) + { + get_file_size(fd, &file_size); + close(fd); + } + state->our_duration = file_size; + state->has_transcoded = false; + + create_placeholder_file("placeholder-video-used"); + + return false; +} + +int video_conv_state_fill_buffer(struct video_conv_state *state, uint64_t offset, + uint8_t *buffer, size_t size, size_t *fill_size) +{ + const char *blank_video; + uint64_t file_size; + size_t to_copy; + bool read_ok; + int fd, ret; + + if (state->has_transcoded) + { + if ((ret = fozdb_read_entry_data(state->read_fozdb, state->transcoded_tag, &state->transcode_hash, + offset, buffer, size, fill_size, false)) < 0) + GST_ERROR("Failed to read entry data, ret %d.", ret); + return ret; + } + else /* Fill blank video data to buffer. */ + { + if (!(blank_video = getenv("MEDIACONV_BLANK_VIDEO_FILE"))) + { + GST_ERROR("Env MEDIACONV_BLANK_VIDEO_FILE not set."); + return CONV_ERROR_ENV_NOT_SET; + } + if (!open_file(blank_video, O_RDONLY, &fd)) + return CONV_ERROR_OPEN_FAILED; + if (!get_file_size(fd, &file_size)) + { + close(fd); + return CONV_ERROR; + } + + /* Get copy size. */ + if (offset >= file_size) + { + close(fd); + return CONV_OK; + } + to_copy = min(file_size - offset, size); + + /* Copy data. */ + if (lseek(fd, offset, SEEK_SET) < 0) + { + GST_ERROR("Failed to seek %s to %#"PRIx64". %s.", blank_video, offset, strerror(errno)); + close(fd); + return CONV_ERROR; + } + read_ok = complete_read(fd, buffer, to_copy); + close(fd); + + if (!read_ok) + { + GST_ERROR("Failed to read blank video data."); + return CONV_ERROR_READ_FAILED; + } + *fill_size = to_copy; + return CONV_OK; + } +} + +/* Call pthread_mutex_unlock() to unlock after usage. */ +static struct video_conv_state *video_conv_lock_state(VideoConv *conv) +{ + pthread_mutex_lock(&conv->state_mutex); + if (!conv->state) + pthread_mutex_unlock(&conv->state_mutex); + return conv->state; +} + +static GstStateChangeReturn video_conv_change_state(GstElement *element, GstStateChange transition) +{ + VideoConv *conv = VIDEO_CONV(element); + struct video_conv_state *state; + int ret; + + GST_INFO_OBJECT(element, "State transition: %s.", gst_state_change_get_name(transition)); + + switch (transition) + { + case GST_STATE_CHANGE_NULL_TO_READY: + /* Do runtime setup. */ + if ((ret = video_conv_state_create(&state)) < 0) + { + GST_ERROR("Failed to create video conv state, ret %d.", ret); + return GST_STATE_CHANGE_FAILURE; + } + pthread_mutex_lock(&conv->state_mutex); + assert(!conv->state); + conv->state = state; + pthread_mutex_unlock(&conv->state_mutex); + break; + + case GST_STATE_CHANGE_READY_TO_NULL: + /* Do runtime teardown. */ + pthread_mutex_lock(&conv->state_mutex); + video_conv_state_release(conv->state); + conv->state = NULL; + pthread_mutex_unlock(&conv->state_mutex); + break; + + default: + break; + } + + return GST_ELEMENT_CLASS(parent_class)->change_state(element, transition); + + /* XXX on ReadyToNull, sodium drops state _again_ here... why? */ +} + +static uint64_t video_conv_duration_ours_to_upstream(VideoConv *conv, uint64_t pos) +{ + struct video_conv_state *state = conv->state; + + if (state->upstream_duration != DURATION_NONE && state->our_duration != DURATION_NONE) + return pos * state->upstream_duration / state->our_duration; + else + return DURATION_NONE; +} + +static void video_conv_query_upstream_duration(VideoConv *conv) +{ + gint64 duration; + + if (gst_pad_peer_query_duration(conv->sink_pad, GST_FORMAT_BYTES, &duration)) + conv->state->upstream_duration = duration; + else + GST_ERROR_OBJECT(conv, "Failed to query upstream duration."); +} + +static bool video_conv_get_upstream_range(VideoConv *conv, uint64_t offset, uint32_t requested_size, + uint64_t *upstream_offset, uint64_t *upstream_requested_size) +{ + struct video_conv_state *state; + + if (!(state = video_conv_lock_state(conv))) + return false; + + if (state->upstream_duration == DURATION_NONE) + video_conv_query_upstream_duration(conv); + + *upstream_offset = video_conv_duration_ours_to_upstream(conv, offset); + *upstream_requested_size = video_conv_duration_ours_to_upstream(conv, requested_size); + + pthread_mutex_unlock(&conv->state_mutex); + + return true; +} + +static bool video_conv_hash_upstream_data(VideoConv *conv, struct payload_hash *hash) +{ + struct pad_reader *reader; + bool ret; + + memset(hash, 0, sizeof(*hash)); + + reader = pad_reader_create_with_stride(conv->sink_pad, HASH_STRIDE); + ret = murmur3_128(reader, pad_reader_read, HASH_SEED, hash); + pad_reader_release(reader); + + return ret; +} + +static int video_conv_dump_upstream_data(VideoConv *conv, struct payload_hash *hash) +{ + struct hashes_reader chunk_hashes_reader; + struct pad_reader *pad_reader = NULL; + GList *chunk_hashes = NULL; + uint8_t *buffer = NULL; + size_t read_size; + int ret; + + GST_DEBUG("Dumping upstream data, hash %s.", format_hash(hash)); + + if ((ret = dump_fozdb_open_video(true)) < 0) + { + GST_ERROR("Failed to open video dump fozdb, ret %d.", ret); + goto done; + } + + buffer = calloc(1, HASH_CHUNK_SIZE); + pad_reader = pad_reader_create(conv->sink_pad); + while ((ret = pad_reader_read(pad_reader, buffer, HASH_CHUNK_SIZE, &read_size)) == CONV_OK) + { + struct bytes_reader bytes_reader; + struct payload_hash *chunk_hash; + + bytes_reader_init(&bytes_reader, buffer, read_size); + chunk_hash = calloc(1, sizeof(*chunk_hash)); + murmur3_128(&bytes_reader, bytes_reader_read, HASH_SEED, chunk_hash); + chunk_hashes = g_list_append(chunk_hashes, chunk_hash); + + bytes_reader_init(&bytes_reader, buffer, read_size); + if ((ret = fozdb_write_entry(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_VIDEODATA, chunk_hash, + &bytes_reader, bytes_reader_read, true)) < 0) + { + GST_ERROR("Error writing video data to fozdb, ret %d.", ret); + goto done; + } + } + + if (ret != CONV_ERROR_DATA_END) + { + GST_ERROR("Failed to read data from pad reader, ret %d.", ret); + goto done; + } + + hashes_reader_init(&chunk_hashes_reader, chunk_hashes); + if ((ret = fozdb_write_entry(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_STREAM, hash, + &chunk_hashes_reader, hashes_reader_read, true)) < 0) + GST_ERROR("Error writing stream data to fozdb, ret %d.", ret); + +done: + if (chunk_hashes) + g_list_free_full(chunk_hashes, free); + if (pad_reader) + pad_reader_release(pad_reader); + if (buffer) + free(buffer); + return ret; +} + +static void video_conv_init_transcode(VideoConv *conv) +{ + struct video_conv_state *state = conv->state; + struct payload_hash hash; + int ret; + + if (state->has_transcoded) + return; + + pthread_mutex_lock(&dump_fozdb.mutex); + + dump_fozdb_discard_transcoded(); + + if (video_conv_hash_upstream_data(conv, &hash)) + { + GST_INFO("Got upstream data hash: %s.", format_hash(&hash)); + if (!video_conv_state_begin_transcode(state, &hash) + && (ret = video_conv_dump_upstream_data(conv, &hash)) < 0) + GST_ERROR("Failed to dump upstream data, ret %d.", ret); + } + else + { + GST_WARNING("Failed to hash upstream data."); + } + + pthread_mutex_unlock(&dump_fozdb.mutex); +} + +static gboolean video_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + VideoConv *conv = VIDEO_CONV(parent); + bool ret; + + GST_DEBUG_OBJECT(pad, "Got event %"GST_PTR_FORMAT".", event); + + if (event->type == GST_EVENT_CAPS) + { + struct video_conv_state *state; + uint32_t transcode_tag; + GstCaps *caps; + + /* push_event, below, can also grab state and cause a deadlock, so make sure it's + * unlocked before calling */ + if (!(state = video_conv_lock_state(conv))) + { + GST_ERROR("VideoConv not yet in READY state?"); + return false; + } + + if (!gst_pad_activate_mode(conv->sink_pad, GST_PAD_MODE_PULL, true)) + { + GST_ERROR("Failed to activate sink pad in pull mode."); + pthread_mutex_unlock(&conv->state_mutex); + return false; + } + + video_conv_init_transcode(conv); + transcode_tag = state->transcoded_tag; + + pthread_mutex_unlock(&conv->state_mutex); + + if (transcode_tag == VIDEO_CONV_FOZ_TAG_MKVDATA) + caps = gst_caps_from_string("video/x-matroska"); + else if (transcode_tag == VIDEO_CONV_FOZ_TAG_OGVDATA) + caps = gst_caps_from_string("application/ogg"); + else + return false; + + ret = push_event(conv->src_pad, gst_event_new_caps(caps)); + gst_caps_unref(caps); + return ret; + } + + return gst_pad_event_default(pad, parent, event); +} + +static GstFlowReturn video_conv_src_get_range(GstPad *pad, GstObject *parent, + guint64 offset, guint request_size, GstBuffer **buffer) +{ + GstBuffer *my_buffer, *upstream_buffer = NULL, *new_buffer = NULL; + uint64_t upstream_offset, upstream_request_size; + GstFlowReturn flow_ret = GST_FLOW_ERROR; + VideoConv *conv = VIDEO_CONV(parent); + struct video_conv_state *state; + size_t fill_size; + GstMapInfo map; + int ret; + + if (!video_conv_get_upstream_range(conv, offset, request_size, &upstream_offset, &upstream_request_size)) + return flow_ret; + + if (!(state = video_conv_lock_state(conv))) + return flow_ret; + + /* Read and ignore upstream bytes. */ + if ((flow_ret = gst_pad_pull_range(conv->sink_pad, upstream_offset, upstream_request_size, &upstream_buffer)) < 0) + { + GST_ERROR("Failed to pull upstream data from %"GST_PTR_FORMAT", offset %#"PRIx64", size %#"PRIx64", reason %s.", + conv->sink_pad, upstream_offset, upstream_request_size, gst_flow_get_name(flow_ret)); + goto done; + } + gst_buffer_unref(upstream_buffer); + + /* Allocate and map buffer. */ + my_buffer = *buffer; + if (!my_buffer) + { + /* XXX: can we use a buffer cache here? */ + if (!(new_buffer = gst_buffer_new_and_alloc(request_size))) + { + GST_ERROR("Failed to allocate buffer of %u bytes.", request_size); + goto done; + } + my_buffer = new_buffer; + } + if (!gst_buffer_map(my_buffer, &map, GST_MAP_READWRITE)) + { + GST_ERROR("Failed to map buffer <%"GST_PTR_FORMAT">.", my_buffer); + goto done; + } + + /* Fill buffer. */ + ret = video_conv_state_fill_buffer(state, offset, map.data, map.size, &fill_size); + gst_buffer_unmap(my_buffer, &map); + if (ret < 0) + { + GST_ERROR("Failed to fill buffer, ret %d.", ret); + goto done; + } + + if (fill_size > 0 || !gst_buffer_get_size(my_buffer)) + { + gst_buffer_set_size(my_buffer, fill_size); + *buffer = my_buffer; + flow_ret = GST_FLOW_OK; + } + else + { + flow_ret = GST_FLOW_EOS; + } + +done: + if (flow_ret < 0 && new_buffer) + gst_buffer_unref(new_buffer); + pthread_mutex_unlock(&conv->state_mutex); + return flow_ret; +} + +static gboolean video_conv_src_query(GstPad *pad, GstObject *parent, GstQuery *query) +{ + VideoConv *conv = VIDEO_CONV(parent); + struct video_conv_state *state; + GstSchedulingFlags flags; + gint min, max, align; + GstQuery *peer_query; + uint64_t duration; + GstFormat format; + + GST_DEBUG_OBJECT(pad, "Got query %"GST_PTR_FORMAT".", query); + + switch (query->type) + { + case GST_QUERY_SCHEDULING: + peer_query = gst_query_new_scheduling(); + if (!gst_pad_peer_query(conv->sink_pad, peer_query)) + { + GST_ERROR_OBJECT(conv->sink_pad, "Failed to query scheduling from peer."); + gst_query_unref(peer_query); + return false; + } + gst_query_parse_scheduling(peer_query, &flags, &min, &max, &align); + gst_query_unref(peer_query); + + gst_query_set_scheduling(query, flags, min, max, align); + gst_query_add_scheduling_mode(query, GST_PAD_MODE_PULL); + + return true; + + case GST_QUERY_DURATION: + gst_query_parse_duration(query, &format, NULL); + if (format != GST_FORMAT_BYTES) + { + GST_WARNING("Duration query format is not GST_FORMAT_BYTES."); + return false; + } + + if (!(state = video_conv_lock_state(conv))) + return false; + if (state->upstream_duration == DURATION_NONE) + video_conv_query_upstream_duration(conv); + duration = state->our_duration; + pthread_mutex_unlock(&conv->state_mutex); + + if (duration == DURATION_NONE) + return false; + gst_query_set_duration(query, GST_FORMAT_BYTES, duration); + return true; + + default: + return gst_pad_query_default(pad, parent, query); + } +} + +static gboolean video_conv_src_active_mode(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean active) +{ + VideoConv *conv = VIDEO_CONV(parent); + struct video_conv_state *state; + struct payload_hash hash; + bool need_stream_start; + bool has_transcoded; + + GST_DEBUG_OBJECT(pad, "mode %s, active %d.", gst_pad_mode_get_name(mode), active); + + if (!gst_pad_activate_mode(conv->sink_pad, mode, active)) + { + GST_ERROR_OBJECT(conv->sink_pad, "Failed to active sink pad: mode %s, active %d.", + gst_pad_mode_get_name(mode), active); + return false; + } + + if (mode != GST_PAD_MODE_PULL) + return true; + + if (!(state = video_conv_lock_state(conv))) + { + GST_ERROR("VideoConv not yet in READY state?"); + return false; + } + + video_conv_init_transcode(conv); + hash = state->transcode_hash; + need_stream_start = state->need_stream_start; + has_transcoded = state->has_transcoded; + + /* push_event, below, can also grab state and cause a deadlock, so make sure it's + * unlocked before calling */ + pthread_mutex_unlock(&conv->state_mutex); + + if (need_stream_start && active && has_transcoded) + { + push_event(conv->src_pad, gst_event_new_stream_start(format_hash(&hash))); + + if (!(state = video_conv_lock_state(conv))) + { + GST_ERROR("VideoConv not yet in READY state?"); + return false; + } + state->need_stream_start = false; + pthread_mutex_unlock(&conv->state_mutex); + } + + return true; +} + + +static void video_conv_finalize(GObject *object) +{ + VideoConv *conv = VIDEO_CONV(object); + + pthread_mutex_destroy(&conv->state_mutex); + if (conv->state) + video_conv_state_release(conv->state); + + G_OBJECT_CLASS(parent_class)->finalize(object); +} + +static void video_conv_class_init(VideoConvClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS(klass); + + gst_element_class_set_metadata(element_class, + "Proton video converter", + "Codec/Demuxer", + "Converts video for Proton", + "Andrew Eikum , Ziqing Hui "); + + element_class->change_state = video_conv_change_state; + object_class->finalize = video_conv_finalize; + + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&video_conv_sink_template)); + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&video_conv_src_template)); +} + +static void video_conv_init(VideoConv *conv) +{ + GstElement *element = GST_ELEMENT(conv); + + conv->sink_pad = gst_pad_new_from_static_template(&video_conv_sink_template, "sink"); + gst_pad_set_event_function(conv->sink_pad, GST_DEBUG_FUNCPTR(video_conv_sink_event)); + gst_element_add_pad(element, conv->sink_pad); + + conv->src_pad = gst_pad_new_from_static_template(&video_conv_src_template, "src"); + gst_pad_set_getrange_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_get_range)); + gst_pad_set_query_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_query)); + gst_pad_set_activatemode_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_active_mode)); + gst_element_add_pad(element, conv->src_pad); + + pthread_mutex_init(&conv->state_mutex, NULL); + conv->state = NULL; +} diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c index 3c51c83b348..881566339eb 100644 --- a/dlls/winegstreamer/unixlib.c +++ b/dlls/winegstreamer/unixlib.c @@ -46,6 +46,8 @@ GST_DEBUG_CATEGORY(wine); +extern bool media_converter_init(void); + GstGLDisplay *gl_display; GstStreamType stream_type_from_caps(GstCaps *caps) @@ -323,5 +325,12 @@ NTSTATUS wg_init_gstreamer(void *arg) } } + if (!media_converter_init()) + { + GST_ERROR("Failed to init media converter."); + gst_object_unref(gl_display); + return STATUS_UNSUCCESSFUL; + } + return STATUS_SUCCESS; } From d5b29cf9769e5bfa200958d2118ec3490b230cf5 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:08 +0800 Subject: [PATCH 1445/1506] Revert "mfmediaengine/tests: Test IMFMediaEngineEx::SetCurrentTime/Ex()." This reverts commit e9b0c55ec27c464482847d057cc22721121d30e9. --- dlls/mfmediaengine/tests/mfmediaengine.c | 201 ----------------------- 1 file changed, 201 deletions(-) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index c7fabbe218f..f9489f3dcb5 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -2183,11 +2183,6 @@ struct test_seek_notify { IMFMediaEngineNotify IMFMediaEngineNotify_iface; HANDLE playing_event; - HANDLE seeking_event; - HANDLE seeked_event; - HANDLE time_update_event; - BOOL seeking_event_received; - BOOL time_update_event_received; HRESULT expected_error; HRESULT error; LONG refcount; @@ -2227,9 +2222,6 @@ static ULONG WINAPI test_seek_notify_Release(IMFMediaEngineNotify *iface) if (!refcount) { CloseHandle(notify->playing_event); - CloseHandle(notify->seeking_event); - CloseHandle(notify->seeked_event); - CloseHandle(notify->time_update_event); free(notify); } @@ -2246,17 +2238,6 @@ static HRESULT WINAPI test_seek_notify_EventNotify(IMFMediaEngineNotify *iface, case MF_MEDIA_ENGINE_EVENT_PLAYING: SetEvent(notify->playing_event); break; - case MF_MEDIA_ENGINE_EVENT_SEEKING: - notify->seeking_event_received = TRUE; - SetEvent(notify->seeking_event); - break; - case MF_MEDIA_ENGINE_EVENT_SEEKED: - SetEvent(notify->seeked_event); - break; - case MF_MEDIA_ENGINE_EVENT_TIMEUPDATE: - notify->time_update_event_received = TRUE; - SetEvent(notify->time_update_event); - break; case MF_MEDIA_ENGINE_EVENT_ERROR: ok(param2 == notify->expected_error, "Unexpected error %#lx\n", param2); notify->error = param2; @@ -2281,13 +2262,7 @@ static struct test_seek_notify *create_seek_notify(void) object = calloc(1, sizeof(*object)); object->IMFMediaEngineNotify_iface.lpVtbl = &test_seek_notify_vtbl; object->playing_event = CreateEventW(NULL, FALSE, FALSE, NULL); - object->seeking_event = CreateEventW(NULL, FALSE, FALSE, NULL); - object->seeked_event = CreateEventW(NULL, FALSE, FALSE, NULL); - object->time_update_event = CreateEventW(NULL, FALSE, FALSE, NULL); ok(!!object->playing_event, "Failed to create an event, error %lu.\n", GetLastError()); - ok(!!object->seeking_event, "Failed to create an event, error %lu.\n", GetLastError()); - ok(!!object->seeked_event, "Failed to create an event, error %lu.\n", GetLastError()); - ok(!!object->time_update_event, "Failed to create an event, error %lu.\n", GetLastError()); object->refcount = 1; return object; } @@ -2529,181 +2504,6 @@ static void test_media_extension(void) IMFMediaEngineExtension_Release(&extension->IMFMediaEngineExtension_iface); } -#define test_seek_result(a, b, c) _test_seek_result(__LINE__, a, b, c) -static void _test_seek_result(int line, IMFMediaEngineEx *media_engine, - struct test_seek_notify *notify, double expected_time) -{ - static const double allowed_error = 0.05; - static const int timeout = 1000; - double time; - DWORD res; - - ok(notify->seeking_event_received, "Seeking event not received.\n"); - notify->seeking_event_received = FALSE; - res = WaitForSingleObject(notify->seeking_event, timeout); - ok_(__FILE__, line)(!res, "Waiting for seeking event returned %#lx.\n", res); - res = WaitForSingleObject(notify->seeked_event, timeout); - ok_(__FILE__, line)(!res, "Waiting for seeked event returned %#lx.\n", res); - res = WaitForSingleObject(notify->time_update_event, timeout); - ok_(__FILE__, line)(!res, "Waiting for ready event returned %#lx.\n", res); - time = IMFMediaEngineEx_GetCurrentTime(media_engine); - ok_(__FILE__, line)(compare_double(time, expected_time, allowed_error), "Unexpected time %lf.\n", time); -} - -static void test_SetCurrentTime(void) -{ - static const double allowed_error = 0.05; - static const int timeout = 1000; - IMFByteStream *stream, *unseekable_stream = NULL; - double time, duration, start, end; - struct test_seek_notify *notify; - IMFMediaEngineEx *media_engine; - ULONG refcount; - HRESULT hr; - DWORD res; - BOOL ret; - BSTR url; - - notify = create_seek_notify(); - hr = create_media_engine(¬ify->IMFMediaEngineNotify_iface, NULL, DXGI_FORMAT_B8G8R8X8_UNORM, - &IID_IMFMediaEngineEx, (void **)&media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface); - - stream = load_resource(L"i420-64x64.avi", L"video/avi"); - url = SysAllocString(L"i420-64x64.avi"); - hr = IMFMediaEngineEx_SetSourceFromByteStream(media_engine, stream, url); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaEngineEx_Play(media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - res = WaitForSingleObject(notify->playing_event, 5000); - ok(!res, "Unexpected res %#lx.\n", res); - - duration = IMFMediaEngineEx_GetDuration(media_engine); - ok(duration > 0, "Got invalid duration.\n"); - start = 0; - end = duration; - - /* Test playing state */ - hr = IMFMediaEngineEx_SetCurrentTime(media_engine, end); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - test_seek_result(media_engine, notify, end); - - /* Test seeking with a negative position */ - hr = IMFMediaEngineEx_SetCurrentTime(media_engine, -1); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - test_seek_result(media_engine, notify, 0); - - /* Test seeking beyond duration */ - hr = IMFMediaEngineEx_SetCurrentTime(media_engine, end + 1); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - test_seek_result(media_engine, notify, end); - - hr = IMFMediaEngineEx_SetCurrentTimeEx(media_engine, start, MF_MEDIA_ENGINE_SEEK_MODE_NORMAL); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - test_seek_result(media_engine, notify, start); - - hr = IMFMediaEngineEx_SetCurrentTimeEx(media_engine, end, MF_MEDIA_ENGINE_SEEK_MODE_APPROXIMATE); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - test_seek_result(media_engine, notify, end); - - /* Test paused state */ - hr = IMFMediaEngineEx_Pause(media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaEngineEx_SetCurrentTime(media_engine, start); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - ok(notify->seeking_event_received, "Seeking event not received.\n"); - notify->seeking_event_received = FALSE; - ok(notify->time_update_event_received, "Time update event not received.\n"); - notify->time_update_event_received = FALSE; - res = WaitForSingleObject(notify->seeking_event, timeout); - ok(!res, "Unexpected res %#lx.\n", res); - res = WaitForSingleObject(notify->seeked_event, timeout); - ok(res == WAIT_TIMEOUT || res == 0, /* No timeout sometimes on Win10+ */ - "Unexpected res %#lx.\n", res); - res = WaitForSingleObject(notify->time_update_event, timeout); - ok(!res, "Unexpected res %#lx.\n", res); - time = IMFMediaEngineEx_GetCurrentTime(media_engine); - ok(compare_double(time, start, allowed_error), "Unexpected time %lf.\n", time); - } - - Sleep(end * 1000); - - ret = IMFMediaEngineEx_IsPaused(media_engine); - ok(ret, "Unexpected ret %d.\n", ret); - time = IMFMediaEngineEx_GetCurrentTime(media_engine); - ok(compare_double(time, start, allowed_error) - || broken(time >= end) /* Windows 11 21H2 AMD GPU TestBot */, "Unexpected time %lf.\n", time); - - hr = IMFMediaEngineEx_Play(media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - res = WaitForSingleObject(notify->seeked_event, timeout); - ok(res == WAIT_TIMEOUT, "Unexpected res %#lx.\n", res); - - /* Media engine is shut down */ - hr = IMFMediaEngineEx_Shutdown(media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaEngineEx_SetCurrentTime(media_engine, start); - ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaEngineEx_SetCurrentTimeEx(media_engine, start, MF_MEDIA_ENGINE_SEEK_MODE_NORMAL); - ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); - - refcount = IMFMediaEngineEx_Release(media_engine); - todo_wine - ok(!refcount, "Got unexpected refcount %lu.\n", refcount); - - /* Unseekable bytestreams */ - notify = create_seek_notify(); - hr = create_media_engine(¬ify->IMFMediaEngineNotify_iface, NULL, DXGI_FORMAT_B8G8R8X8_UNORM, - &IID_IMFMediaEngineEx, (void **)&media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFMediaEngineNotify_Release(¬ify->IMFMediaEngineNotify_iface); - unseekable_stream = create_unseekable_stream(stream); - hr = IMFMediaEngineEx_SetSourceFromByteStream(media_engine, unseekable_stream, url); - todo_wine - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (FAILED(hr)) - goto done; - - hr = IMFMediaEngineEx_Play(media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - notify->expected_error = MF_E_INVALIDREQUEST; - res = WaitForSingleObject(notify->playing_event, 5000); - ok(res == S_OK, "Unexpected res %#lx.\n", res); - - hr = IMFMediaEngineEx_SetCurrentTime(media_engine, end); - ok(hr == S_OK || broken(hr == MF_INVALID_STATE_ERR) /* Win8 */, "Unexpected hr %#lx.\n", hr); - if (hr == S_OK) - { - ok(!notify->seeking_event_received, "Seeking event received.\n"); - res = WaitForSingleObject(notify->seeking_event, timeout); - ok(res == WAIT_TIMEOUT, "Unexpected res %#lx.\n", res); - res = WaitForSingleObject(notify->seeked_event, timeout); - ok(res == WAIT_TIMEOUT, "Unexpected res %#lx.\n", res); - res = WaitForSingleObject(notify->time_update_event, timeout); - ok(!res, "Unexpected res %#lx.\n", res); - } - -done: - hr = IMFMediaEngineEx_Shutdown(media_engine); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - refcount = IMFMediaEngineEx_Release(media_engine); - ok(!refcount || broken(refcount == 1) /* Win8.1 */, "Got unexpected refcount %lu.\n", refcount); - IMFByteStream_Release(unseekable_stream); - SysFreeString(url); - IMFByteStream_Release(stream); -} - START_TEST(mfmediaengine) { HRESULT hr; @@ -2739,7 +2539,6 @@ START_TEST(mfmediaengine) test_GetDuration(); test_GetSeekable(); test_media_extension(); - test_SetCurrentTime(); IMFMediaEngineClassFactory_Release(factory); From 52ccf6492da32cd6803becd0d0ad6db49cb0c8f2 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:09 +0800 Subject: [PATCH 1446/1506] Revert "mfmediaengine: Implement IMFMediaEngineEx::SetCurrentTimeEx()." This reverts commit cab32f60ad8cbed6613656f7b89fa97b49f7046a. --- dlls/mfmediaengine/main.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index f6ea0cf3e59..c6f82ec055b 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -3027,24 +3027,9 @@ static HRESULT WINAPI media_engine_SetRealTimeMode(IMFMediaEngineEx *iface, BOOL static HRESULT WINAPI media_engine_SetCurrentTimeEx(IMFMediaEngineEx *iface, double seektime, MF_MEDIA_ENGINE_SEEK_MODE mode) { - struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); - HRESULT hr; - - TRACE("%p, %f, %#x.\n", iface, seektime, mode); - - if (mode) - FIXME("mode %#x is ignored.\n", mode); - - EnterCriticalSection(&engine->cs); - - if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) - hr = MF_E_SHUTDOWN; - else - hr = media_engine_set_current_time(engine, seektime); + FIXME("%p, %f, %#x stub.\n", iface, seektime, mode); - LeaveCriticalSection(&engine->cs); - - return hr; + return E_NOTIMPL; } static HRESULT WINAPI media_engine_EnableTimeUpdateTimer(IMFMediaEngineEx *iface, BOOL enable) From b2f499fe8f895283ca9e2f23194681d1d4e838d3 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:10 +0800 Subject: [PATCH 1447/1506] Revert "mfmediaengine: Implement IMFMediaEngineEx::SetCurrentTime()." This reverts commit 283cde7ab8a1d3551cfae38f333c3de1ab779103. --- dlls/mfmediaengine/main.c | 59 +++++---------------------------------- 1 file changed, 7 insertions(+), 52 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index c6f82ec055b..3e05626f238 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -94,7 +94,6 @@ enum media_engine_flags FLAGS_ENGINE_NEW_FRAME = 0x8000, FLAGS_ENGINE_SOURCE_PENDING = 0x10000, FLAGS_ENGINE_PLAY_PENDING = 0x20000, - FLAGS_ENGINE_SEEKING = 0x40000, }; struct vec3 @@ -165,7 +164,6 @@ struct media_engine { IMFMediaSource *source; IMFPresentationDescriptor *pd; - PROPVARIANT start_position; } presentation; struct effects video_effects; struct effects audio_effects; @@ -980,14 +978,7 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface break; } case MESessionStarted: - EnterCriticalSection(&engine->cs); - if (engine->flags & FLAGS_ENGINE_SEEKING) - { - media_engine_set_flag(engine, FLAGS_ENGINE_SEEKING | FLAGS_ENGINE_IS_ENDED, FALSE); - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKED, 0, 0); - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_TIMEUPDATE, 0, 0); - } - LeaveCriticalSection(&engine->cs); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PLAYING, 0, 0); break; case MESessionEnded: @@ -1348,9 +1339,10 @@ static HRESULT media_engine_create_topology(struct media_engine *engine, IMFMedi static void media_engine_start_playback(struct media_engine *engine) { - IMFMediaSession_Start(engine->session, &GUID_NULL, &engine->presentation.start_position); - /* Reset the playback position to the current position */ - engine->presentation.start_position.vt = VT_EMPTY; + PROPVARIANT var; + + var.vt = VT_EMPTY; + IMFMediaSession_Start(engine->session, &GUID_NULL, &var); } static HRESULT WINAPI media_engine_load_handler_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) @@ -1778,10 +1770,6 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface) { ret = engine->duration; } - else if (engine->flags & FLAGS_ENGINE_PAUSED && engine->presentation.start_position.vt == VT_I8) - { - ret = (double)engine->presentation.start_position.hVal.QuadPart / 10000000; - } else if (SUCCEEDED(IMFPresentationClock_GetTime(engine->clock, &clocktime))) { ret = mftime_to_seconds(clocktime); @@ -1791,50 +1779,17 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface) return ret; } -static HRESULT media_engine_set_current_time(struct media_engine *engine, double seektime) -{ - PROPVARIANT position; - DWORD caps; - HRESULT hr; - - hr = IMFMediaSession_GetSessionCapabilities(engine->session, &caps); - if (FAILED(hr) || !(caps & MFSESSIONCAP_SEEK)) - return hr; - - position.vt = VT_I8; - position.hVal.QuadPart = min(max(0, seektime), engine->duration) * 10000000; - - if (IMFMediaEngineEx_IsPaused(&engine->IMFMediaEngineEx_iface)) - { - engine->presentation.start_position = position; - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKING, 0, 0); - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKED, 0, 0); - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_TIMEUPDATE, 0, 0); - return S_OK; - } - - if (SUCCEEDED(hr = IMFMediaSession_Start(engine->session, &GUID_NULL, &position))) - { - media_engine_set_flag(engine, FLAGS_ENGINE_SEEKING, TRUE); - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_SEEKING, 0, 0); - } - - return hr; -} - static HRESULT WINAPI media_engine_SetCurrentTime(IMFMediaEngineEx *iface, double time) { struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); - HRESULT hr; + HRESULT hr = E_NOTIMPL; - TRACE("%p, %f.\n", iface, time); + FIXME("(%p, %f): stub.\n", iface, time); EnterCriticalSection(&engine->cs); if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) hr = MF_E_SHUTDOWN; - else - hr = media_engine_set_current_time(engine, time); LeaveCriticalSection(&engine->cs); From 80ef443af8a439b7c6b1e705498f4733f52239a4 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:11 +0800 Subject: [PATCH 1448/1506] Revert "mf/tests: Test IMFMediaSession::Start()." This reverts commit dfce0a5d5df21bc0e7cc60c16e820c1a7537589f. --- dlls/mf/tests/mf.c | 960 +-------------------------------------------- 1 file changed, 8 insertions(+), 952 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index e6ae0a922d1..35d22839032 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2075,7 +2075,6 @@ static IMFMediaSource *create_media_source(const WCHAR *name, const WCHAR *mime) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFSourceResolver_CreateObjectFromByteStream(resolver, stream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL, &obj_type, (IUnknown **)&source); - todo_wine_if(hr == MF_E_UNEXPECTED) /* Gitlab CI Debian runner */ ok(hr == S_OK || broken(hr == MF_E_UNSUPPORTED_BYTESTREAM_TYPE), "Unexpected hr %#lx.\n", hr); IMFSourceResolver_Release(resolver); IMFByteStream_Release(stream); @@ -2087,626 +2086,6 @@ static IMFMediaSource *create_media_source(const WCHAR *name, const WCHAR *mime) return source; } -enum object_state -{ - SOURCE_START, - SOURCE_PAUSE, - SOURCE_STOP, - SOURCE_SHUTDOWN, - SINK_ON_CLOCK_START, - SINK_ON_CLOCK_PAUSE, - SINK_ON_CLOCK_STOP, - SINK_ON_CLOCK_RESTART, - SINK_ON_CLOCK_SETRATE, -}; - -#define MAX_OBJECT_STATE 1024 - -struct object_state_record -{ - enum object_state states[MAX_OBJECT_STATE]; - unsigned int state_count; -}; -static struct object_state_record actual_object_state_record; - -#define add_object_state(a, b) _add_object_state(__LINE__, a, b) -static void _add_object_state(int line, struct object_state_record *record, enum object_state state) -{ - ok_(__FILE__, line)(record->state_count < MAX_OBJECT_STATE, "exceeded state_count maximum %d.\n", MAX_OBJECT_STATE); - if (record->state_count < MAX_OBJECT_STATE) - record->states[record->state_count++] = state; -} - -#define compare_object_states(a, b) _compare_object_states(__LINE__, a, b) -static void _compare_object_states(int line, const struct object_state_record *r1, - const struct object_state_record *r2) -{ - ok_(__FILE__, line)(r1->state_count == r2->state_count, "State count not equal.\n"); - if (r1->state_count == r2->state_count) - ok_(__FILE__, line)(!memcmp(r1->states, r2->states, sizeof(enum object_state) * r1->state_count), "Got different states.\n"); -} - -enum source_state -{ - SOURCE_STOPPED, - SOURCE_RUNNING, - SOURCE_PAUSED, -}; - -struct test_media_stream -{ - IMFMediaStream IMFMediaStream_iface; - IMFMediaEventQueue *event_queue; - IMFStreamDescriptor *sd; - IMFMediaSource *source; - LONGLONG sample_duration; - LONGLONG sample_time; - BOOL is_new; - LONG refcount; -}; - -static struct test_media_stream *impl_from_IMFMediaStream(IMFMediaStream *iface) -{ - return CONTAINING_RECORD(iface, struct test_media_stream, IMFMediaStream_iface); -} - -static HRESULT WINAPI test_media_stream_QueryInterface(IMFMediaStream *iface, REFIID riid, void **out) -{ - if (IsEqualIID(riid, &IID_IMFMediaStream) - || IsEqualIID(riid, &IID_IMFMediaEventGenerator) - || IsEqualIID(riid, &IID_IUnknown)) - { - *out = iface; - } - else - { - *out = NULL; - return E_NOINTERFACE; - } - - IMFMediaStream_AddRef(iface); - return S_OK; -} - -static ULONG WINAPI test_media_stream_AddRef(IMFMediaStream *iface) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - return InterlockedIncrement(&stream->refcount); -} - -static ULONG WINAPI test_media_stream_Release(IMFMediaStream *iface) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - ULONG refcount = InterlockedDecrement(&stream->refcount); - - if (!refcount) - { - IMFMediaEventQueue_Release(stream->event_queue); - free(stream); - } - - return refcount; -} - -static HRESULT WINAPI test_media_stream_GetEvent(IMFMediaStream *iface, DWORD flags, IMFMediaEvent **event) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - return IMFMediaEventQueue_GetEvent(stream->event_queue, flags, event); -} - -static HRESULT WINAPI test_media_stream_BeginGetEvent(IMFMediaStream *iface, IMFAsyncCallback *callback, IUnknown *state) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - return IMFMediaEventQueue_BeginGetEvent(stream->event_queue, callback, state); -} - -static HRESULT WINAPI test_media_stream_EndGetEvent(IMFMediaStream *iface, IMFAsyncResult *result, IMFMediaEvent **event) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - return IMFMediaEventQueue_EndGetEvent(stream->event_queue, result, event); -} - -static HRESULT WINAPI test_media_stream_QueueEvent(IMFMediaStream *iface, MediaEventType event_type, REFGUID ext_type, - HRESULT hr, const PROPVARIANT *value) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - return IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, event_type, ext_type, hr, value); -} - -static HRESULT WINAPI test_media_stream_GetMediaSource(IMFMediaStream *iface, IMFMediaSource **source) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - - *source = stream->source; - IMFMediaSource_AddRef(*source); - - return S_OK; -} - -static HRESULT WINAPI test_media_stream_GetStreamDescriptor(IMFMediaStream *iface, IMFStreamDescriptor **sd) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - - *sd = stream->sd; - IMFStreamDescriptor_AddRef(*sd); - - return S_OK; -} - -static HRESULT WINAPI test_media_stream_RequestSample(IMFMediaStream *iface, IUnknown *token) -{ - struct test_media_stream *stream = impl_from_IMFMediaStream(iface); - IMFMediaBuffer *buffer; - IMFSample *sample; - HRESULT hr; - - hr = MFCreateSample(&sample); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (stream->sample_duration) - { - hr = IMFSample_SetSampleDuration(sample, stream->sample_duration); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFSample_SetSampleTime(sample, stream->sample_time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - stream->sample_time += stream->sample_duration; - } - else - { - hr = IMFSample_SetSampleTime(sample, 123); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFSample_SetSampleDuration(sample, 1); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - - if (token) - IMFSample_SetUnknown(sample, &MFSampleExtension_Token, token); - - /* Reader expects buffers, empty samples are considered an error. */ - hr = MFCreateMemoryBuffer(8, &buffer); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFSample_AddBuffer(sample, buffer); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFMediaBuffer_Release(buffer); - - hr = IMFMediaEventQueue_QueueEventParamUnk(stream->event_queue, MEMediaSample, &GUID_NULL, S_OK, - (IUnknown *)sample); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFSample_Release(sample); - - return S_OK; -} - -static const IMFMediaStreamVtbl test_media_stream_vtbl = -{ - test_media_stream_QueryInterface, - test_media_stream_AddRef, - test_media_stream_Release, - test_media_stream_GetEvent, - test_media_stream_BeginGetEvent, - test_media_stream_EndGetEvent, - test_media_stream_QueueEvent, - test_media_stream_GetMediaSource, - test_media_stream_GetStreamDescriptor, - test_media_stream_RequestSample, -}; - -#define TEST_SOURCE_NUM_STREAMS 3 - -struct test_seek_source -{ - IMFMediaSource IMFMediaSource_iface; - IMFMediaEventQueue *event_queue; - IMFPresentationDescriptor *pd; - struct test_media_stream *streams[TEST_SOURCE_NUM_STREAMS]; - enum source_state state; - unsigned stream_count; - CRITICAL_SECTION cs; - BOOL seekable; - LONG refcount; -}; - -static struct test_seek_source *impl_test_seek_source_from_IMFMediaSource(IMFMediaSource *iface) -{ - return CONTAINING_RECORD(iface, struct test_seek_source, IMFMediaSource_iface); -} - -static HRESULT WINAPI test_seek_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out) -{ - if (IsEqualIID(riid, &IID_IMFMediaSource) - || IsEqualIID(riid, &IID_IMFMediaEventGenerator) - || IsEqualIID(riid, &IID_IUnknown)) - { - *out = iface; - } - else - { - *out = NULL; - return E_NOINTERFACE; - } - - IMFMediaSource_AddRef(iface); - return S_OK; -} - -static ULONG WINAPI test_seek_source_AddRef(IMFMediaSource *iface) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - return InterlockedIncrement(&source->refcount); -} - -static ULONG WINAPI test_seek_source_Release(IMFMediaSource *iface) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - ULONG refcount = InterlockedDecrement(&source->refcount); - - if (!refcount) - { - IMFMediaEventQueue_Release(source->event_queue); - free(source); - } - - return refcount; -} - -static HRESULT WINAPI test_seek_source_GetEvent(IMFMediaSource *iface, DWORD flags, IMFMediaEvent **event) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - return IMFMediaEventQueue_GetEvent(source->event_queue, flags, event); -} - -static HRESULT WINAPI test_seek_source_BeginGetEvent(IMFMediaSource *iface, IMFAsyncCallback *callback, IUnknown *state) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - return IMFMediaEventQueue_BeginGetEvent(source->event_queue, callback, state); -} - -static HRESULT WINAPI test_seek_source_EndGetEvent(IMFMediaSource *iface, IMFAsyncResult *result, IMFMediaEvent **event) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - return IMFMediaEventQueue_EndGetEvent(source->event_queue, result, event); -} - -static HRESULT WINAPI test_seek_source_QueueEvent(IMFMediaSource *iface, MediaEventType event_type, REFGUID ext_type, - HRESULT hr, const PROPVARIANT *value) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, ext_type, hr, value); -} - -static HRESULT WINAPI test_seek_source_GetCharacteristics(IMFMediaSource *iface, DWORD *flags) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - - if (source->seekable) - *flags = MFMEDIASOURCE_CAN_PAUSE | MFMEDIASOURCE_CAN_SEEK; - else - *flags = MFMEDIASOURCE_CAN_PAUSE; - return S_OK; -} - -static HRESULT WINAPI test_seek_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **pd) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - IMFStreamDescriptor *sds[ARRAY_SIZE(source->streams)]; - IMFMediaType *media_type; - HRESULT hr = S_OK; - int i; - - EnterCriticalSection(&source->cs); - - if (source->pd) - { - *pd = source->pd; - IMFPresentationDescriptor_AddRef(*pd); - } - else - { - for (i = 0; i < source->stream_count; ++i) - { - hr = MFCreateMediaType(&media_type); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)640 << 32 | 480); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = MFCreateStreamDescriptor(i, 1, &media_type, &sds[i]); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - IMFMediaType_Release(media_type); - } - - hr = MFCreatePresentationDescriptor(source->stream_count, sds, &source->pd); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationDescriptor_SetUINT64(source->pd, &MF_PD_DURATION, 10 * 10000000); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationDescriptor_SelectStream(source->pd, 0); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - for (i = 0; i < source->stream_count; ++i) - IMFStreamDescriptor_Release(sds[i]); - - *pd = source->pd; - IMFPresentationDescriptor_AddRef(*pd); - } - - LeaveCriticalSection(&source->cs); - - return hr; -} - -static BOOL is_stream_selected(IMFPresentationDescriptor *pd, DWORD index) -{ - IMFStreamDescriptor *sd; - BOOL selected = FALSE; - - if (SUCCEEDED(IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, index, &selected, &sd))) - IMFStreamDescriptor_Release(sd); - - return selected; -} - -static HRESULT WINAPI test_seek_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *pd, const GUID *time_format, - const PROPVARIANT *start_position) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - MediaEventType event_type; - PROPVARIANT var; - HRESULT hr; - int i; - - add_object_state(&actual_object_state_record, SOURCE_START); - - ok(time_format && IsEqualGUID(time_format, &GUID_NULL), "Unexpected time format %s.\n", - wine_dbgstr_guid(time_format)); - ok(start_position && (start_position->vt == VT_I8 || start_position->vt == VT_EMPTY), - "Unexpected position type.\n"); - - /* This is what makes IMFMediaSession::Start() seeking fail, not the lacking of MFMEDIASOURCE_CAN_SEEK. - * Without this, IMFMediaSession::Start() seeking succeeds even with the missing MFMEDIASOURCE_CAN_SEEK. - * If this is check is not here, the first IMFMediaSession::Start() call to a non-zero position - * succeeds somehow on Windows 10, then all following seeks fails and no MESessionStarted events */ - if (!source->seekable && start_position && start_position->vt == VT_I8 && start_position->hVal.QuadPart) - return E_FAIL; - - EnterCriticalSection(&source->cs); - - event_type = source->state != SOURCE_STOPPED ? MESourceSeeked : MESourceStarted; - hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, NULL); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - for (i = 0; i < source->stream_count; ++i) - { - if (!is_stream_selected(pd, i)) - continue; - - var.vt = VT_UNKNOWN; - var.punkVal = (IUnknown *)&source->streams[i]->IMFMediaStream_iface; - event_type = source->streams[i]->is_new ? MENewStream : MEUpdatedStream; - source->streams[i]->is_new = FALSE; - hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, &var); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - event_type = source->state != SOURCE_STOPPED ? MEStreamSeeked : MEStreamStarted; - hr = IMFMediaEventQueue_QueueEventParamVar(source->streams[i]->event_queue, event_type, &GUID_NULL, - S_OK, NULL); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - - source->state = SOURCE_RUNNING; - - LeaveCriticalSection(&source->cs); - - return S_OK; -} - -static HRESULT WINAPI test_seek_source_Stop(IMFMediaSource *iface) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - MediaEventType event_type; - HRESULT hr; - int i; - - add_object_state(&actual_object_state_record, SOURCE_STOP); - - EnterCriticalSection(&source->cs); - - event_type = MESourceStopped; - hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, NULL); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - for (i = 0; i < source->stream_count; ++i) - { - if (!is_stream_selected(source->pd, i)) - continue; - - event_type = MEStreamStopped; - hr = IMFMediaEventQueue_QueueEventParamVar(source->streams[i]->event_queue, event_type, &GUID_NULL, - S_OK, NULL); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - - source->state = SOURCE_STOPPED; - - LeaveCriticalSection(&source->cs); - - return S_OK; -} - -static HRESULT WINAPI test_seek_source_Pause(IMFMediaSource *iface) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - MediaEventType event_type; - HRESULT hr; - int i; - - add_object_state(&actual_object_state_record, SOURCE_PAUSE); - - EnterCriticalSection(&source->cs); - - event_type = MESourcePaused; - hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, event_type, &GUID_NULL, S_OK, NULL); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - for (i = 0; i < source->stream_count; ++i) - { - if (!is_stream_selected(source->pd, i)) - continue; - - event_type = MEStreamPaused; - hr = IMFMediaEventQueue_QueueEventParamVar(source->streams[i]->event_queue, event_type, &GUID_NULL, - S_OK, NULL); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - - source->state = SOURCE_PAUSED; - LeaveCriticalSection(&source->cs); - - return S_OK; -} - -static HRESULT WINAPI test_seek_source_Shutdown(IMFMediaSource *iface) -{ - struct test_seek_source *source = impl_test_seek_source_from_IMFMediaSource(iface); - HRESULT hr; - - add_object_state(&actual_object_state_record, SOURCE_SHUTDOWN); - - hr = IMFMediaEventQueue_Shutdown(source->event_queue); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - return S_OK; -} - -static const IMFMediaSourceVtbl test_seek_source_vtbl = -{ - test_seek_source_QueryInterface, - test_seek_source_AddRef, - test_seek_source_Release, - test_seek_source_GetEvent, - test_seek_source_BeginGetEvent, - test_seek_source_EndGetEvent, - test_seek_source_QueueEvent, - test_seek_source_GetCharacteristics, - test_seek_source_CreatePresentationDescriptor, - test_seek_source_Start, - test_seek_source_Stop, - test_seek_source_Pause, - test_seek_source_Shutdown, -}; - -static HRESULT WINAPI test_seek_clock_sink_QueryInterface(IMFClockStateSink *iface, REFIID riid, void **obj) -{ - if (IsEqualIID(riid, &IID_IMFClockStateSink) || - IsEqualIID(riid, &IID_IUnknown)) - { - *obj = iface; - IMFClockStateSink_AddRef(iface); - return S_OK; - } - - *obj = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI test_seek_clock_sink_AddRef(IMFClockStateSink *iface) -{ - return 2; -} - -static ULONG WINAPI test_seek_clock_sink_Release(IMFClockStateSink *iface) -{ - return 1; -} - -static HRESULT WINAPI test_seek_clock_sink_OnClockStart(IMFClockStateSink *iface, MFTIME system_time, LONGLONG offset) -{ - add_object_state(&actual_object_state_record, SINK_ON_CLOCK_START); - return S_OK; -} - -static HRESULT WINAPI test_seek_clock_sink_OnClockStop(IMFClockStateSink *iface, MFTIME system_time) -{ - add_object_state(&actual_object_state_record, SINK_ON_CLOCK_STOP); - return S_OK; -} - -static HRESULT WINAPI test_seek_clock_sink_OnClockPause(IMFClockStateSink *iface, MFTIME system_time) -{ - add_object_state(&actual_object_state_record, SINK_ON_CLOCK_PAUSE); - return S_OK; -} - -static HRESULT WINAPI test_seek_clock_sink_OnClockRestart(IMFClockStateSink *iface, MFTIME system_time) -{ - add_object_state(&actual_object_state_record, SINK_ON_CLOCK_RESTART); - return S_OK; -} - -static HRESULT WINAPI test_seek_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME system_time, float rate) -{ - add_object_state(&actual_object_state_record, SINK_ON_CLOCK_SETRATE); - return S_OK; -} - -static const IMFClockStateSinkVtbl test_seek_clock_sink_vtbl = -{ - test_seek_clock_sink_QueryInterface, - test_seek_clock_sink_AddRef, - test_seek_clock_sink_Release, - test_seek_clock_sink_OnClockStart, - test_seek_clock_sink_OnClockStop, - test_seek_clock_sink_OnClockPause, - test_seek_clock_sink_OnClockRestart, - test_seek_clock_sink_OnClockSetRate, -}; - -static struct test_media_stream *create_test_stream(DWORD stream_index, IMFMediaSource *source) -{ - struct test_media_stream *stream; - IMFPresentationDescriptor *pd; - BOOL selected; - HRESULT hr; - - stream = calloc(1, sizeof(*stream)); - stream->IMFMediaStream_iface.lpVtbl = &test_media_stream_vtbl; - stream->refcount = 1; - hr = MFCreateEventQueue(&stream->event_queue); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - stream->source = source; - IMFMediaSource_AddRef(stream->source); - stream->is_new = TRUE; - - IMFMediaSource_CreatePresentationDescriptor(source, &pd); - IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, stream_index, &selected, &stream->sd); - IMFPresentationDescriptor_Release(pd); - - return stream; -} - -static IMFMediaSource *create_test_seek_source(BOOL seekable) -{ - struct test_seek_source *source; - int i; - - source = calloc(1, sizeof(*source)); - source->IMFMediaSource_iface.lpVtbl = &test_seek_source_vtbl; - source->refcount = 1; - source->stream_count = 1; - source->seekable = seekable; - MFCreateEventQueue(&source->event_queue); - InitializeCriticalSection(&source->cs); - for (i = 0; i < source->stream_count; ++i) - source->streams[i] = create_test_stream(i, &source->IMFMediaSource_iface); - - return &source->IMFMediaSource_iface; -} - static void test_media_session_events(void) { static const media_type_desc audio_float_44100 = @@ -3508,27 +2887,27 @@ static ULONG WINAPI test_grabber_callback_Release(IMFSampleGrabberSinkCallback * static HRESULT WINAPI test_grabber_callback_OnClockStart(IMFSampleGrabberSinkCallback *iface, MFTIME time, LONGLONG offset) { - return S_OK; + return E_NOTIMPL; } static HRESULT WINAPI test_grabber_callback_OnClockStop(IMFSampleGrabberSinkCallback *iface, MFTIME time) { - return S_OK; + return E_NOTIMPL; } static HRESULT WINAPI test_grabber_callback_OnClockPause(IMFSampleGrabberSinkCallback *iface, MFTIME time) { - return S_OK; + return E_NOTIMPL; } static HRESULT WINAPI test_grabber_callback_OnClockRestart(IMFSampleGrabberSinkCallback *iface, MFTIME time) { - return S_OK; + return E_NOTIMPL; } static HRESULT WINAPI test_grabber_callback_OnClockSetRate(IMFSampleGrabberSinkCallback *iface, MFTIME time, float rate) { - return S_OK; + return E_NOTIMPL; } static HRESULT WINAPI test_grabber_callback_OnSetPresentationClock(IMFSampleGrabberSinkCallback *iface, @@ -5616,8 +4995,8 @@ static void test_sample_grabber_is_mediatype_supported(void) IMFSampleGrabberSinkCallback_Release(grabber_callback); } -/* create a test topology with the specified source and sink, and return duration if required */ -static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *sink_activate, UINT64 *duration) +/* create a test topology with the specified source and sink */ +static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *sink_activate) { IMFTopologyNode *src_node, *sink_node; IMFPresentationDescriptor *pd; @@ -5643,11 +5022,6 @@ static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *si hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(selected, "got selected %u.\n", !!selected); - if (duration) - { - hr = IMFPresentationDescriptor_GetUINT64(pd, &MF_PD_DURATION, duration); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } init_source_node(source, -1, src_node, pd, sd); hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate); ok(hr == S_OK, "Failed to set object, hr %#lx.\n", hr); @@ -5709,7 +5083,7 @@ static void test_sample_grabber_orientation(GUID subtype) ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); IMFMediaType_Release(output_type); - topology = create_test_topology(source, sink_activate, NULL); + topology = create_test_topology(source, sink_activate); hr = IMFMediaSession_SetTopology(session, 0, topology); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFTopology_Release(topology); @@ -7908,323 +7282,6 @@ static void test_MFCreateSequencerSegmentOffset(void) PropVariantClear(&propvar); } -static void test_media_session_Start(void) -{ - static const struct object_state_record expected_object_state_records[] = - { - {{SOURCE_START, SINK_ON_CLOCK_START}, 2}, - {{SOURCE_STOP, SOURCE_START, SINK_ON_CLOCK_START}, 3}, - {{SOURCE_STOP, SOURCE_START, SINK_ON_CLOCK_START}, 3}, - }; - media_type_desc video_rgb32_desc = - { - ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), - ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32), - }; - static const MFTIME allowed_error = 5000000; - IMFClockStateSink test_seek_clock_sink = {&test_seek_clock_sink_vtbl}; - struct test_grabber_callback *grabber_callback; - IMFPresentationClock *presentation_clock; - enum source_state initial_state; - IMFActivate *sink_activate; - IMFAsyncCallback *callback; - IMFMediaType *output_type; - IMFMediaSession *session; - IMFMediaSource *source; - IMFTopology *topology; - MFTIME time, old_time; - PROPVARIANT propvar; - IMFClock *clock; - UINT64 duration; - DWORD caps; - HRESULT hr; - - hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); - ok(hr == S_OK, "Failed to start up, hr %#lx.\n", hr); - - if (!(source = create_media_source(L"test.mp4", L"video/mp4"))) - { - todo_wine /* Gitlab CI Debian runner */ - win_skip("MP4 media source is not supported, skipping tests.\n"); - MFShutdown(); - return; - } - - grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); - hr = MFCreateMediaType(&output_type); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_media_type(output_type, video_rgb32_desc, -1); - hr = MFCreateSampleGrabberSinkActivate(output_type, &grabber_callback->IMFSampleGrabberSinkCallback_iface, &sink_activate); - ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); - IMFMediaType_Release(output_type); - - hr = MFCreateMediaSession(NULL, &session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - topology = create_test_topology(source, sink_activate, &duration); - hr = IMFMediaSession_SetTopology(session, 0, topology); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFTopology_Release(topology); - - hr = IMFMediaSession_GetClock(session, &clock); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFClock_Release(clock); - - propvar.vt = VT_EMPTY; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - callback = create_test_callback(TRUE); - hr = wait_media_event(session, callback, MESessionStarted, 5000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - /* Seek to 1s */ - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationClock_GetTime(presentation_clock, &time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(llabs(time - 10000000) <= allowed_error, "Unexpected time %I64d.\n", time); - - /* Seek to beyond duration */ - propvar.vt = VT_I8; - propvar.hVal.QuadPart = duration + 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == MF_E_INVALID_POSITION, "Unexpected hr %#lx.\n", hr); - - /* Seek to negative position */ - propvar.vt = VT_I8; - propvar.hVal.QuadPart = -10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationClock_GetTime(presentation_clock, &time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(llabs(time - (-10000000)) <= allowed_error, "Unexpected time %I64d.\n", time); - - /* Seek backwards to 0s */ - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 0; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationClock_GetTime(presentation_clock, &time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(llabs(time) <= allowed_error, "Unexpected time %I64d.\n", time); - - /* Seek to 1s while in paused state */ - hr = IMFMediaSession_Pause(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionPaused, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFPresentationClock_GetTime(presentation_clock, &time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(llabs(time - 10000000) <= allowed_error, "Unexpected time %I64d.\n", time); - old_time = time; - - /* Expected the presentation clock is running */ - Sleep(100); - hr = IMFPresentationClock_GetTime(presentation_clock, &time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(time > old_time, "Unexpected time %I64d.\n", time); - - hr = IMFMediaSession_Stop(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSession_Close(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - /* Media session is shut down */ - hr = IMFMediaSource_Shutdown(source); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSession_Shutdown(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, NULL); - ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); - - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); - - propvar.vt = VT_EMPTY; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); - - IMFPresentationClock_Release(presentation_clock); - IMFMediaSource_Release(source); - IMFAsyncCallback_Release(callback); - /* sometimes briefly leaking */ - IMFMediaSession_Release(session); - IMFActivate_ShutdownObject(sink_activate); - IMFActivate_Release(sink_activate); - IMFSampleGrabberSinkCallback_Release(&grabber_callback->IMFSampleGrabberSinkCallback_iface); - - /* Unseekable media source */ - source = create_test_seek_source(FALSE); - hr = IMFMediaSource_GetCharacteristics(source, &caps); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok((caps & MFMEDIASOURCE_CAN_SEEK) == 0, "Got unexpected caps %#lx.\n", caps); - grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); - hr = MFCreateMediaType(&output_type); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_media_type(output_type, video_rgb32_desc, -1); - hr = MFCreateSampleGrabberSinkActivate(output_type, &grabber_callback->IMFSampleGrabberSinkCallback_iface, &sink_activate); - ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); - IMFMediaType_Release(output_type); - - hr = MFCreateMediaSession(NULL, &session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - topology = create_test_topology(source, sink_activate, &duration); - hr = IMFMediaSession_SetTopology(session, 0, topology); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFTopology_Release(topology); - - hr = IMFMediaSession_GetClock(session, &clock); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFClock_Release(clock); - - propvar.vt = VT_EMPTY; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - callback = create_test_callback(TRUE); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - hr = IMFMediaSession_GetSessionCapabilities(session, &caps); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok((caps & MFSESSIONCAP_SEEK) == 0, "Got unexpected caps %#lx\n", caps); - - /* Seek to 1s */ - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 1000, &propvar); - ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationClock_GetTime(presentation_clock, &time); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(llabs(time) <= allowed_error, "Unexpected time %I64d.\n", time); - - hr = IMFMediaSession_Stop(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSession_Close(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSession_Shutdown(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSource_Shutdown(source); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - IMFPresentationClock_Release(presentation_clock); - IMFAsyncCallback_Release(callback); - IMFMediaSession_Release(session); - IMFMediaSource_Release(source); - IMFActivate_ShutdownObject(sink_activate); - IMFActivate_Release(sink_activate); - IMFSampleGrabberSinkCallback_Release(&grabber_callback->IMFSampleGrabberSinkCallback_iface); - - /* Test object state transitions */ - for (initial_state = SOURCE_STOPPED; initial_state <= SOURCE_PAUSED; initial_state++) - { - winetest_push_context("Test %d", initial_state); - - source = create_test_seek_source(TRUE); - callback = create_test_callback(TRUE); - - grabber_callback = impl_from_IMFSampleGrabberSinkCallback(create_test_grabber_callback()); - hr = MFCreateMediaType(&output_type); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - init_media_type(output_type, video_rgb32_desc, -1); - hr = MFCreateSampleGrabberSinkActivate(output_type, &grabber_callback->IMFSampleGrabberSinkCallback_iface, &sink_activate); - ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); - IMFMediaType_Release(output_type); - - hr = MFCreateMediaSession(NULL, &session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - topology = create_test_topology(source, sink_activate, &duration); - hr = IMFMediaSession_SetTopology(session, 0, topology); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFTopology_Release(topology); - - hr = IMFMediaSession_GetClock(session, &clock); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFClock_QueryInterface(clock, &IID_IMFPresentationClock, (void **)&presentation_clock); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationClock_AddClockStateSink(presentation_clock, &test_seek_clock_sink); - ok(hr == S_OK, "Failed to add a sink, hr %#lx.\n", hr); - IMFClock_Release(clock); - - if (initial_state == SOURCE_RUNNING || initial_state == SOURCE_PAUSED) - { - propvar.vt = VT_EMPTY; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 5000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - if (initial_state == SOURCE_PAUSED) - { - hr = IMFMediaSession_Pause(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionPaused, 5000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - - /* Seek to 1s */ - memset(&actual_object_state_record, 0, sizeof(actual_object_state_record)); - - propvar.vt = VT_I8; - propvar.hVal.QuadPart = 10000000; - hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = wait_media_event(session, callback, MESessionStarted, 5000, &propvar); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine_if(initial_state == SOURCE_PAUSED) - compare_object_states(&actual_object_state_record, &expected_object_state_records[initial_state]); - - hr = IMFMediaSession_Stop(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSession_Close(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSession_Shutdown(session); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSource_Shutdown(source); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - IMFPresentationClock_RemoveClockStateSink(presentation_clock, &test_seek_clock_sink); - IMFPresentationClock_Release(presentation_clock); - IMFAsyncCallback_Release(callback); - IMFMediaSession_Release(session); - IMFMediaSource_Release(source); - IMFActivate_ShutdownObject(sink_activate); - IMFActivate_Release(sink_activate); - IMFSampleGrabberSinkCallback_Release(&grabber_callback->IMFSampleGrabberSinkCallback_iface); - winetest_pop_context(); - } - - hr = MFShutdown(); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); -} - START_TEST(mf) { init_functions(); @@ -8261,5 +7318,4 @@ START_TEST(mf) test_MFRequireProtectedEnvironment(); test_mpeg4_media_sink(); test_MFCreateSequencerSegmentOffset(); - test_media_session_Start(); } From c1f7b96d0fcda581e13f0716d206b549425827b0 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:11 +0800 Subject: [PATCH 1449/1506] Revert "mf: Support seeking while a session is started." This reverts commit ba94fc6d74cb1ba10b5d9cc57cb6edd7a58753d6. --- dlls/mf/session.c | 63 ++--------------------------------------------- 1 file changed, 2 insertions(+), 61 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 6590f001a00..d38e7cc0f6b 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -93,7 +93,6 @@ enum session_state SESSION_STATE_STARTING_SOURCES, SESSION_STATE_PREROLLING_SINKS, SESSION_STATE_STARTING_SINKS, - SESSION_STATE_RESTARTING_SOURCES, SESSION_STATE_STARTED, SESSION_STATE_PAUSING_SINKS, SESSION_STATE_PAUSING_SOURCES, @@ -930,7 +929,6 @@ static void session_start(struct media_session *session, const GUID *time_format { struct media_source *source; struct topo_node *topo_node; - MFTIME duration; HRESULT hr; UINT i; @@ -983,36 +981,8 @@ static void session_start(struct media_session *session, const GUID *time_format session->state = SESSION_STATE_STARTING_SOURCES; break; case SESSION_STATE_STARTED: - /* Check for invalid positions */ - LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) - { - hr = IMFPresentationDescriptor_GetUINT64(source->pd, &MF_PD_DURATION, (UINT64 *)&duration); - if (SUCCEEDED(hr) && IsEqualGUID(time_format, &GUID_NULL) - && start_position->vt == VT_I8 && start_position->hVal.QuadPart > duration) - { - WARN("Start position %s out of range, hr %#lx.\n", wine_dbgstr_longlong(start_position->hVal.QuadPart), hr); - session_command_complete_with_event(session, MESessionStarted, MF_E_INVALID_POSITION, NULL); - return; - } - } - - /* Stop sources */ - LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) - { - if (FAILED(hr = IMFMediaSource_Stop(source->source))) - { - WARN("Failed to stop media source %p, hr %#lx.\n", source->source, hr); - session_command_complete_with_event(session, MESessionStarted, hr, NULL); - return; - } - } - - session->presentation.time_format = *time_format; - session->presentation.start_position.vt = VT_EMPTY; - PropVariantCopy(&session->presentation.start_position, start_position); - - /* SESSION_STATE_STARTED -> SESSION_STATE_RESTARTING_SOURCES -> SESSION_STATE_STARTED */ - session->state = SESSION_STATE_RESTARTING_SOURCES; + FIXME("Seeking is not implemented.\n"); + session_command_complete(session); break; default: session_command_complete_with_event(session, MESessionStarted, MF_E_INVALIDREQUEST, NULL); @@ -2931,7 +2901,6 @@ static BOOL session_set_node_object_state(struct media_session *session, IUnknow static void session_set_source_object_state(struct media_session *session, IUnknown *object, MediaEventType event_type) { - struct media_source *source; IMFStreamSink *stream_sink; struct media_source *src; struct media_sink *sink; @@ -2983,15 +2952,6 @@ static void session_set_source_object_state(struct media_session *session, IUnkn session_set_presentation_clock(session); - /* If sinks are already started, start session immediately. This can happen when doing a - * seek from SESSION_STATE_STARTED */ - if (session_is_output_nodes_state(session, OBJ_STATE_STARTED) - && SUCCEEDED(session_start_clock(session))) - { - session_set_started(session); - return; - } - if ((session->presentation.flags & SESSION_FLAG_NEEDS_PREROLL) && session_is_output_nodes_state(session, OBJ_STATE_STOPPED)) { MFTIME preroll_time = 0; @@ -3029,25 +2989,6 @@ static void session_set_source_object_state(struct media_session *session, IUnkn else if (SUCCEEDED(session_start_clock(session))) session->state = SESSION_STATE_STARTING_SINKS; - break; - case SESSION_STATE_RESTARTING_SOURCES: - if (!session_is_source_nodes_state(session, OBJ_STATE_STOPPED)) - break; - - session_flush_nodes(session); - - /* Start sources */ - LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) - { - if (FAILED(hr = IMFMediaSource_Start(source->source, source->pd, - &session->presentation.time_format, &session->presentation.start_position))) - { - WARN("Failed to start media source %p, hr %#lx.\n", source->source, hr); - session_command_complete_with_event(session, MESessionStarted, hr, NULL); - return; - } - } - session->state = SESSION_STATE_STARTING_SOURCES; break; case SESSION_STATE_PAUSING_SOURCES: if (!session_is_source_nodes_state(session, OBJ_STATE_PAUSED)) From fde26f8197130a3ba4aacba94c33daad826056bb Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:12 +0800 Subject: [PATCH 1450/1506] Revert "mf/tests: Add a create_test_topology() helper." This reverts commit 69e83049c9cf5e239a2fca60cac86a16368b30b7. --- dlls/mf/tests/mf.c | 80 +++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 35d22839032..0a34329bd75 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4995,48 +4995,6 @@ static void test_sample_grabber_is_mediatype_supported(void) IMFSampleGrabberSinkCallback_Release(grabber_callback); } -/* create a test topology with the specified source and sink */ -static IMFTopology *create_test_topology(IMFMediaSource *source, IMFActivate *sink_activate) -{ - IMFTopologyNode *src_node, *sink_node; - IMFPresentationDescriptor *pd; - IMFTopology *topology = NULL; - IMFStreamDescriptor *sd; - BOOL selected; - HRESULT hr; - - hr = MFCreateTopology(&topology); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFTopology_AddNode(topology, sink_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFTopology_AddNode(topology, src_node); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFTopologyNode_ConnectOutput(src_node, 0, sink_node, 0); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(selected, "got selected %u.\n", !!selected); - init_source_node(source, -1, src_node, pd, sd); - hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate); - ok(hr == S_OK, "Failed to set object, hr %#lx.\n", hr); - hr = IMFTopologyNode_SetUINT32(sink_node, &MF_TOPONODE_CONNECT_METHOD, MF_CONNECT_ALLOW_DECODER); - ok(hr == S_OK, "Failed to set connect method, hr %#lx.\n", hr); - hr = IMFTopology_SetUINT32(topology, &MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES, TRUE); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - - IMFStreamDescriptor_Release(sd); - IMFPresentationDescriptor_Release(pd); - IMFTopologyNode_Release(src_node); - IMFTopologyNode_Release(sink_node); - return topology; -} - static void test_sample_grabber_orientation(GUID subtype) { media_type_desc video_rgb32_desc = @@ -5046,13 +5004,17 @@ static void test_sample_grabber_orientation(GUID subtype) }; struct test_grabber_callback *grabber_callback; + IMFTopologyNode *src_node, *sink_node; + IMFPresentationDescriptor *pd; IMFAsyncCallback *callback; IMFActivate *sink_activate; IMFMediaType *output_type; IMFMediaSession *session; + IMFStreamDescriptor *sd; IMFMediaSource *source; IMFTopology *topology; PROPVARIANT propvar; + BOOL selected; HRESULT hr; DWORD res; @@ -5076,6 +5038,30 @@ static void test_sample_grabber_orientation(GUID subtype) hr = MFCreateMediaSession(NULL, &session); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = MFCreateTopology(&topology); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopology_AddNode(topology, sink_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopology_AddNode(topology, src_node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopologyNode_ConnectOutput(src_node, 0, sink_node, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd); + ok(selected, "got selected %u.\n", !!selected); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + init_source_node(source, -1, src_node, pd, sd); + IMFTopologyNode_Release(src_node); + IMFPresentationDescriptor_Release(pd); + IMFStreamDescriptor_Release(sd); + hr = MFCreateMediaType(&output_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); init_media_type(output_type, video_rgb32_desc, -1); @@ -5083,7 +5069,15 @@ static void test_sample_grabber_orientation(GUID subtype) ok(hr == S_OK, "Failed to create grabber sink, hr %#lx.\n", hr); IMFMediaType_Release(output_type); - topology = create_test_topology(source, sink_activate); + hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate); + ok(hr == S_OK, "Failed to set object, hr %#lx.\n", hr); + hr = IMFTopologyNode_SetUINT32(sink_node, &MF_TOPONODE_CONNECT_METHOD, MF_CONNECT_ALLOW_DECODER); + ok(hr == S_OK, "Failed to set connect method, hr %#lx.\n", hr); + IMFTopologyNode_Release(sink_node); + + hr = IMFTopology_SetUINT32(topology, &MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaSession_SetTopology(session, 0, topology); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFTopology_Release(topology); From c3870845ac4bca22aeffd6d26a9b7741b0a09e72 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 17:07:13 +0800 Subject: [PATCH 1451/1506] Revert "mf: Add a session_flush_nodes() helper." This reverts commit a46a5ee7b214cc10184dd8921d69c30991deda6d. --- dlls/mf/session.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index d38e7cc0f6b..ef707dea4de 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -912,19 +912,6 @@ static HRESULT session_subscribe_sources(struct media_session *session) return hr; } -static void session_flush_nodes(struct media_session *session) -{ - struct topo_node *node; - - LIST_FOR_EACH_ENTRY(node, &session->presentation.nodes, struct topo_node, entry) - { - if (node->type == MF_TOPOLOGY_OUTPUT_NODE) - IMFStreamSink_Flush(node->object.sink_stream); - else if (node->type == MF_TOPOLOGY_TRANSFORM_NODE) - IMFTransform_ProcessMessage(node->object.transform, MFT_MESSAGE_COMMAND_FLUSH, 0); - } -} - static void session_start(struct media_session *session, const GUID *time_format, const PROPVARIANT *start_position) { struct media_source *source; @@ -2905,6 +2892,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn struct media_source *src; struct media_sink *sink; enum object_state state; + struct topo_node *node; BOOL changed = FALSE; DWORD i, count; HRESULT hr; @@ -3000,7 +2988,21 @@ static void session_set_source_object_state(struct media_session *session, IUnkn if (!session_is_source_nodes_state(session, OBJ_STATE_STOPPED)) break; - session_flush_nodes(session); + LIST_FOR_EACH_ENTRY(node, &session->presentation.nodes, struct topo_node, entry) + { + switch (node->type) + { + case MF_TOPOLOGY_OUTPUT_NODE: + IMFStreamSink_Flush(node->object.sink_stream); + break; + case MF_TOPOLOGY_TRANSFORM_NODE: + IMFTransform_ProcessMessage(node->object.transform, MFT_MESSAGE_COMMAND_FLUSH, 0); + break; + default: + ; + } + } + session_set_caps(session, session->caps & ~MFSESSIONCAP_PAUSE); if (session->presentation.flags & SESSION_FLAG_FINALIZE_SINKS) From 71a0e7cb914a56431353dcc41dc0d0d631393536 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Sat, 25 Feb 2023 13:15:16 -0600 Subject: [PATCH 1452/1506] explorer: Add an environment variable setting to start Xalia. --- programs/explorer/desktop.c | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 3571368b8f3..fe50586184f 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -1041,6 +1041,46 @@ static HANDLE start_tabtip_process(void) return pi.hProcess; } +static void start_xalia_process(void) +{ + PROCESS_INFORMATION pi; + STARTUPINFOW si = { sizeof(si) }; + WCHAR use_envvar[2]; + LPWSTR path; + LPCWSTR path_suffix = L"/../xalia/xalia.exe"; + DWORD ret, buffersize; + + /* check if xalia is enabled */ + ret = GetEnvironmentVariableW(L"PROTON_USE_XALIA", use_envvar, ARRAY_SIZE(use_envvar)); + if (!ret || (ret <= ARRAY_SIZE(use_envvar) && lstrcmpW(use_envvar, L"0") == 0)) + return; + + /* locate xalia.exe */ + ret = GetEnvironmentVariableW(L"WINEDATADIR", NULL, 0); + if (ret == 0) + return; + + buffersize = ret + lstrlenW(path_suffix); + path = HeapAlloc(GetProcessHeap(), 0, buffersize * sizeof(*path)); + + GetEnvironmentVariableW(L"WINEDATADIR", path, ret); + if (!memcmp(path, L"\\??\\", 8)) path[1] = '\\'; /* change \??\ into \\?\ */ + lstrcatW(path, path_suffix); + + /* setup environment */ + SetEnvironmentVariableW(L"XALIA_WINE_SYSTEM_PROCESS", L"1"); + + if (!CreateProcessW(path, NULL, + NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi)) + { + WINE_ERR("Couldn't start xalia.exe: error %lu\n", GetLastError()); + return; + } + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + return; +} + /* main desktop management function */ void manage_desktop( WCHAR *arg ) { @@ -1169,6 +1209,8 @@ void manage_desktop( WCHAR *arg ) /* FIXME: hack, run tabtip.exe on startup. */ tabtip = start_tabtip_process(); + start_xalia_process(); + TRACE( "desktop message loop starting on hwnd %p\n", hwnd ); while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg ); TRACE( "desktop message loop exiting for hwnd %p\n", hwnd ); From d70dce6ecedc66b599be40a179974a690fa49fa1 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Wed, 8 Mar 2023 15:19:51 -0600 Subject: [PATCH 1453/1506] winex11.drv: Mark Xalia overlay window as a gamescope overlay. --- dlls/winex11.drv/window.c | 25 +++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 1 + 3 files changed, 27 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index db51152e1dc..29773e871b0 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2077,6 +2077,29 @@ void set_hwnd_style_props( Display *display, Window window, HWND hwnd ) } +void set_gamescope_overlay_prop( Display *display, Window window, HWND hwnd ) +{ + static const WCHAR class_name[] = {'X','a','l','i','a','O','v','e','r','l','a','y','B','o','x',0}; + WCHAR class_name_buf[16]; + UNICODE_STRING class_name_str; + INT ret; + + class_name_str.Buffer = class_name_buf; + class_name_str.MaximumLength = sizeof(class_name_buf); + + ret = NtUserGetClassName( hwnd, FALSE, &class_name_str ); + + if (ret && !wcscmp( class_name_buf, class_name )) { + DWORD one = 1; + + TRACE( "setting GAMESCOPE_XALIA_OVERLAY on window %lx, hwnd %p\n", window, hwnd ); + + XChangeProperty( display, window, x11drv_atom(GAMESCOPE_XALIA_OVERLAY), XA_CARDINAL, 32, + PropModeReplace, (unsigned char *)&one, sizeof(one) / 4 ); + } +} + + /********************************************************************** * create_whole_window * @@ -2147,6 +2170,8 @@ static void create_whole_window( struct x11drv_win_data *data ) set_hwnd_style_props( data->display, data->whole_window, data->hwnd ); + set_gamescope_overlay_prop( data->display, data->whole_window, data->hwnd ); + /* set the window text */ if (!NtUserInternalGetWindowText( data->hwnd, text, ARRAY_SIZE( text ))) text[0] = 0; sync_window_text( data->display, data->whole_window, text ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 4032ab85e9a..d60432a68e8 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -567,6 +567,7 @@ enum x11drv_atoms XATOM_text_uri_list, XATOM_GAMESCOPE_FOCUSED_APP, XATOM_GAMESCOPE_DISPLAY_EDID_PATH, + XATOM_GAMESCOPE_XALIA_OVERLAY, NB_XATOMS }; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index a5eb1416c99..b286e6cfde8 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -234,6 +234,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "text/uri-list", "GAMESCOPE_FOCUSED_APP", "GAMESCOPE_DISPLAY_EDID_PATH", + "GAMESCOPE_XALIA_OVERLAY", }; /*********************************************************************** From f1a9c2dc8e5be3aeaa20d1f3c35ba3f161e45534 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Tue, 5 Mar 2024 20:55:18 +0000 Subject: [PATCH 1454/1506] winex11.drv: Do not shape layered windows in Gamescope. The use of xshape doesn't work and actively breaks rendering in Gamescope. --- dlls/winex11.drv/bitblt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index e6890495a51..5d2392fe450 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1642,6 +1642,8 @@ static void update_surface_region( struct x11drv_window_surface *surface ) if (!shape_layered_windows) return; + if (wm_is_steamcompmgr(gdi_display)) return; + if (!surface->is_argb && surface->color_key == CLR_INVALID) { XShapeCombineMask( gdi_display, surface->window, ShapeBounding, 0, 0, None, ShapeSet ); From 0aca54d625b122fdc7af7063b4bc96756bb8f196 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Tue, 12 Mar 2024 20:39:00 +0000 Subject: [PATCH 1455/1506] win32u: Implement EVENT_OBJECT_STATECHANGE. --- dlls/win32u/window.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index d3ce35ebb86..400500f34dc 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -873,6 +873,7 @@ BOOL enable_window( HWND hwnd, BOOL enable ) send_message( hwnd, WM_ENABLE, FALSE, 0 ); } } + NtUserNotifyWinEvent( EVENT_OBJECT_STATECHANGE, hwnd, OBJID_CLIENT, 0 ); return ret; } From a5883000119c2d6d225ce88758caf9d133c1b33c Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Wed, 13 Mar 2024 19:21:23 +0000 Subject: [PATCH 1456/1506] win32u: Implement EVENT_OBJECT_LOCATIONCHANGE. --- dlls/win32u/window.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 400500f34dc..967b47f7ca0 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3545,6 +3545,10 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) winpos->cy = new_window_rect.bottom - new_window_rect.top; send_message( winpos->hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)winpos ); } + + if ((winpos->flags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE)) + NtUserNotifyWinEvent( EVENT_OBJECT_LOCATIONCHANGE, winpos->hwnd, OBJID_WINDOW, 0 ); + ret = TRUE; done: SetThreadDpiAwarenessContext( context ); From 50300bf47f94da2ab2d314dd8edf5831aa45ee4f Mon Sep 17 00:00:00 2001 From: Connor McAdams Date: Thu, 16 Feb 2023 11:52:42 -0500 Subject: [PATCH 1457/1506] win32u: Add support for raising EVENT_OBJECT_DESTROY events on windows. --- dlls/win32u/window.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 967b47f7ca0..2dcc3e20d3e 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -4693,6 +4693,7 @@ static void send_destroy_message( HWND hwnd ) if (hwnd == NtUserGetClipboardOwner()) release_clipboard_owner( hwnd ); send_message( hwnd, WM_DESTROY, 0, 0); + NtUserNotifyWinEvent( EVENT_OBJECT_DESTROY, hwnd, OBJID_WINDOW, 0 ); /* * This WM_DESTROY message can trigger re-entrant calls to DestroyWindow From 111ffe4378609d203a82c9ae8e3846c18d73a3c4 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Sat, 19 Aug 2023 14:35:34 -0500 Subject: [PATCH 1458/1506] win32u: Implement cross-process GetScrollBarInfo. --- dlls/win32u/message.c | 11 +++++++++++ dlls/win32u/scroll.c | 5 ++++- dlls/win32u/win32u_private.h | 1 + include/ntuser.h | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 7308a4d8196..b9470be3070 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -729,6 +729,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa if (!get_buffer_space( buffer, sizeof(SCROLLINFO), buffer_size )) return FALSE; break; case SBM_GETSCROLLBARINFO: + case WM_WINE_GETSCROLLBARINFO: if (!get_buffer_space( buffer, sizeof(SCROLLBARINFO), buffer_size )) return FALSE; break; case EM_GETSEL: @@ -1127,6 +1128,7 @@ static size_t pack_message( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); return sizeof(SCROLLINFO); case SBM_GETSCROLLBARINFO: + case WM_WINE_GETSCROLLBARINFO: { const SCROLLBARINFO *info = (const SCROLLBARINFO *)lparam; size_t size = min( info->cbSize, sizeof(SCROLLBARINFO) ); @@ -1363,6 +1365,10 @@ static void pack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, case SBM_GETSCROLLINFO: push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); break; + case SBM_GETSCROLLBARINFO: + case WM_WINE_GETSCROLLBARINFO: + push_data( data, (SCROLLBARINFO *)lparam, sizeof(SCROLLBARINFO) ); + break; case EM_GETRECT: case LB_GETITEMRECT: case CB_GETDROPPEDCONTROLRECT: @@ -1504,6 +1510,7 @@ static void unpack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, memcpy( (SCROLLINFO *)lparam, buffer, min( sizeof(SCROLLINFO), size )); break; case SBM_GETSCROLLBARINFO: + case WM_WINE_GETSCROLLBARINFO: memcpy( (SCROLLBARINFO *)lparam, buffer, min( sizeof(SCROLLBARINFO), size )); break; case EM_GETRECT: @@ -1708,6 +1715,7 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, size = sizeof(SCROLLINFO); break; case SBM_GETSCROLLBARINFO: + case WM_WINE_GETSCROLLBARINFO: size = sizeof(SCROLLBARINFO); break; case EM_GETSEL: @@ -1950,6 +1958,7 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me copy_size = sizeof(SCROLLINFO); break; case SBM_GETSCROLLBARINFO: + case WM_WINE_GETSCROLLBARINFO: copy_size = sizeof(SCROLLBARINFO); break; case EM_GETSEL: @@ -2121,6 +2130,8 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR case WM_WINE_UPDATEWINDOWSTATE: update_window_state( hwnd ); return 0; + case WM_WINE_GETSCROLLBARINFO: + return get_scroll_bar_info( hwnd, (LONG)wparam, (SCROLLBARINFO *)lparam ); default: if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG) return user_driver->pWindowMessage( hwnd, msg, wparam, lparam ); diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index 19a9a1379f4..65491f25c5b 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -1048,7 +1048,7 @@ static int set_scroll_info( HWND hwnd, int bar, const SCROLLINFO *info, BOOL red return ret; /* Return current position */ } -static BOOL get_scroll_bar_info( HWND hwnd, LONG id, SCROLLBARINFO *info ) +BOOL get_scroll_bar_info( HWND hwnd, LONG id, SCROLLBARINFO *info ) { struct scroll_info *scroll; int bar, dummy; @@ -1067,6 +1067,9 @@ static BOOL get_scroll_bar_info( HWND hwnd, LONG id, SCROLLBARINFO *info ) /* handle invalid data structure */ if (info->cbSize != sizeof(*info)) return FALSE; + if (bar != SB_CTL && !is_current_thread_window( hwnd )) + return send_message( hwnd, WM_WINE_GETSCROLLBARINFO, (WPARAM)id, (LPARAM)info ); + get_scroll_bar_rect( hwnd, bar, &info->rcScrollBar, &dummy, &info->dxyLineButton, &info->xyThumbTop ); /* rcScrollBar needs to be in screen coordinates */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index a5d2a196932..dc65ca858cb 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -153,6 +153,7 @@ extern BOOL rawinput_device_get_usages( HANDLE handle, USHORT *usage_page, USHOR /* scroll.c */ extern void draw_nc_scrollbar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ); +extern BOOL get_scroll_bar_info( HWND hwnd, LONG id, SCROLLBARINFO *info ); extern BOOL get_scroll_info( HWND hwnd, INT bar, SCROLLINFO *info ); extern void handle_scroll_event( HWND hwnd, INT bar, UINT msg, POINT pt ); extern LRESULT scroll_bar_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, diff --git a/include/ntuser.h b/include/ntuser.h index 738fe055ff7..fc7cd98813c 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -489,6 +489,7 @@ enum wine_internal_message WM_WINE_KEYBOARD_LL_HOOK, WM_WINE_MOUSE_LL_HOOK, WM_WINE_UPDATEWINDOWSTATE, + WM_WINE_GETSCROLLBARINFO, WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */ WM_WINE_CLIPCURSOR = 0x80001ff0, /* internal driver notification messages */ WM_WINE_SETCURSOR, From 3475b1aa02246ae43a8df746e9e714ddf4747093 Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Sat, 19 Aug 2023 15:06:50 -0500 Subject: [PATCH 1459/1506] win32u: Implement cross-process GetScrollInfo. --- dlls/win32u/message.c | 8 ++++++++ dlls/win32u/scroll.c | 8 +++++++- include/ntuser.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index b9470be3070..c0b009d8eb4 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -726,6 +726,7 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa minsize = sizeof(SCROLLINFO); break; case SBM_GETSCROLLINFO: + case WM_WINE_GETSCROLLINFO: if (!get_buffer_space( buffer, sizeof(SCROLLINFO), buffer_size )) return FALSE; break; case SBM_GETSCROLLBARINFO: @@ -1125,6 +1126,7 @@ static size_t pack_message( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); return 0; case SBM_GETSCROLLINFO: + case WM_WINE_GETSCROLLINFO: push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); return sizeof(SCROLLINFO); case SBM_GETSCROLLBARINFO: @@ -1363,6 +1365,7 @@ static void pack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, break; } case SBM_GETSCROLLINFO: + case WM_WINE_GETSCROLLINFO: push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); break; case SBM_GETSCROLLBARINFO: @@ -1507,6 +1510,7 @@ static void unpack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, } break; case SBM_GETSCROLLINFO: + case WM_WINE_GETSCROLLINFO: memcpy( (SCROLLINFO *)lparam, buffer, min( sizeof(SCROLLINFO), size )); break; case SBM_GETSCROLLBARINFO: @@ -1712,6 +1716,7 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, break; case SBM_SETSCROLLINFO: case SBM_GETSCROLLINFO: + case WM_WINE_GETSCROLLINFO: size = sizeof(SCROLLINFO); break; case SBM_GETSCROLLBARINFO: @@ -1955,6 +1960,7 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me break; case SBM_SETSCROLLINFO: case SBM_GETSCROLLINFO: + case WM_WINE_GETSCROLLINFO: copy_size = sizeof(SCROLLINFO); break; case SBM_GETSCROLLBARINFO: @@ -2132,6 +2138,8 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR return 0; case WM_WINE_GETSCROLLBARINFO: return get_scroll_bar_info( hwnd, (LONG)wparam, (SCROLLBARINFO *)lparam ); + case WM_WINE_GETSCROLLINFO: + return get_scroll_info( hwnd, (int)wparam, (SCROLLINFO *)lparam ); default: if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG) return user_driver->pWindowMessage( hwnd, msg, wparam, lparam ); diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index 65491f25c5b..e3ed1350b09 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -892,7 +892,13 @@ BOOL get_scroll_info( HWND hwnd, int bar, SCROLLINFO *info ) struct scroll_info *scroll; /* handle invalid data structure */ - if (!validate_scroll_info( info ) || !(scroll = get_scroll_info_ptr( hwnd, bar, FALSE ))) + if (!validate_scroll_info( info )) + return FALSE; + + if (bar != SB_CTL && !is_current_thread_window( hwnd )) + return send_message( hwnd, WM_WINE_GETSCROLLINFO, (WPARAM)bar, (LPARAM)info ); + + if (!(scroll = get_scroll_info_ptr( hwnd, bar, FALSE ))) return FALSE; /* fill in the desired scroll info structure */ diff --git a/include/ntuser.h b/include/ntuser.h index fc7cd98813c..0677f114aea 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -490,6 +490,7 @@ enum wine_internal_message WM_WINE_MOUSE_LL_HOOK, WM_WINE_UPDATEWINDOWSTATE, WM_WINE_GETSCROLLBARINFO, + WM_WINE_GETSCROLLINFO, WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */ WM_WINE_CLIPCURSOR = 0x80001ff0, /* internal driver notification messages */ WM_WINE_SETCURSOR, From 25357691c44cf18c9abd806725edeb581c6e770c Mon Sep 17 00:00:00 2001 From: Esme Povirk Date: Fri, 15 Mar 2024 16:30:57 +0000 Subject: [PATCH 1460/1506] win32u: Implement winevents for scrollbars. --- dlls/win32u/scroll.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index e3ed1350b09..40a9b1a6605 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -165,6 +165,16 @@ static BOOL show_scroll_bar( HWND hwnd, int bar, BOOL show_horz, BOOL show_vert /* frame has been changed, let the window redraw itself */ NtUserSetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); + + if ((set_bits & WS_HSCROLL) && !(old_style & WS_HSCROLL)) + NtUserNotifyWinEvent( EVENT_OBJECT_SHOW, hwnd, OBJID_HSCROLL, 0 ); + if ((set_bits & WS_VSCROLL) && !(old_style & WS_VSCROLL)) + NtUserNotifyWinEvent( EVENT_OBJECT_SHOW, hwnd, OBJID_VSCROLL, 0 ); + if ((clear_bits & WS_HSCROLL) && (old_style & WS_HSCROLL)) + NtUserNotifyWinEvent( EVENT_OBJECT_HIDE, hwnd, OBJID_HSCROLL, 0 ); + if ((clear_bits & WS_VSCROLL) && (old_style & WS_VSCROLL)) + NtUserNotifyWinEvent( EVENT_OBJECT_HIDE, hwnd, OBJID_VSCROLL, 0 ); + return TRUE; } return FALSE; /* no frame changes */ @@ -1049,6 +1059,19 @@ static int set_scroll_info( HWND hwnd, int bar, const SCROLLINFO *info, BOOL red refresh_scroll_bar( hwnd, bar, TRUE, TRUE ); else if (action & SA_SSI_REPAINT_ARROWS) refresh_scroll_bar( hwnd, bar, TRUE, FALSE ); + + switch (bar) + { + case SB_CTL: + NtUserNotifyWinEvent( EVENT_OBJECT_VALUECHANGE, hwnd, OBJID_CLIENT, 0 ); + break; + case SB_HORZ: + NtUserNotifyWinEvent( EVENT_OBJECT_VALUECHANGE, hwnd, OBJID_HSCROLL, 0 ); + break; + case SB_VERT: + NtUserNotifyWinEvent( EVENT_OBJECT_VALUECHANGE, hwnd, OBJID_VSCROLL, 0 ); + break; + } } return ret; /* Return current position */ From 05e023ab753ffc913be3f0bae1159b494fffd92c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 1 Apr 2024 21:15:03 -0600 Subject: [PATCH 1461/1506] kernelbase: HACK: Force in-process-gpu for Summer Islands. CW-Bug-Id: #23635 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 838d139210b..6b90a0d8ba3 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -594,6 +594,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) } options[] = { + {L"SummerIslands.exe", L" --in-process-gpu"}, {L"UplayWebCore.exe", L" --use-angle=vulkan"}, {L"Paradox Launcher.exe", L" --use-angle=gl"}, {L"Montaro\\nw.exe", L" --use-gl=swiftshader"}, From 2ea89e6985ebbc25c7774bb87b6857a7e2c6006f Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 2 Apr 2024 18:05:11 -0600 Subject: [PATCH 1462/1506] kernelbase: HACK: Force in-process-gpu for Total War: WARHAMMER II. CW-Bug-Id: #23579 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 6b90a0d8ba3..dfce336d2c0 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -594,6 +594,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) } options[] = { + {L"Warhammer2.exe", L" --in-process-gpu"}, {L"SummerIslands.exe", L" --in-process-gpu"}, {L"UplayWebCore.exe", L" --use-angle=vulkan"}, {L"Paradox Launcher.exe", L" --use-angle=gl"}, From c63b374a6a54de090ed7706e38f413bdd021c308 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 29 Mar 2024 11:46:14 +0800 Subject: [PATCH 1463/1506] gdiplus/tests: Add tests for GdipPrivateAddMemoryFont(). CW-Bug-Id: #23597 --- dlls/gdiplus/tests/font.c | 64 +++++++- dlls/gdiplus/tests/resource.rc | 8 + dlls/gdiplus/tests/wine_mac_win.ttf | Bin 0 -> 1140 bytes dlls/gdiplus/tests/wine_mac_win.ttx | 203 ++++++++++++++++++++++++ dlls/gdiplus/tests/wine_unicode_mac.ttf | Bin 0 -> 1168 bytes dlls/gdiplus/tests/wine_unicode_mac.ttx | 203 ++++++++++++++++++++++++ 6 files changed, 471 insertions(+), 7 deletions(-) create mode 100644 dlls/gdiplus/tests/wine_mac_win.ttf create mode 100644 dlls/gdiplus/tests/wine_mac_win.ttx create mode 100644 dlls/gdiplus/tests/wine_unicode_mac.ttf create mode 100644 dlls/gdiplus/tests/wine_unicode_mac.ttx diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 8f0bbce0eb4..6a21ea30361 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -43,11 +43,21 @@ static void set_rect_empty(RectF *rc) rc->Height = 0.0; } +#define load_resource(a, b, c) _load_resource(__LINE__, a, b, c) +static void _load_resource(int line, const WCHAR *filename, BYTE **data, DWORD *size) +{ + HRSRC resource = FindResourceW(NULL, filename, (const WCHAR *)RT_RCDATA); + ok_(__FILE__, line)(!!resource, "FindResourceW failed, error %lu\n", GetLastError()); + *data = LockResource(LoadResource(GetModuleHandleW(NULL), resource)); + ok_(__FILE__, line)(!!*data, "LockResource failed, error %lu\n", GetLastError()); + *size = SizeofResource(GetModuleHandleW(NULL), resource); + ok_(__FILE__, line)(*size > 0, "SizeofResource failed, error %lu\n", GetLastError()); +} + static void create_testfontfile(const WCHAR *filename, int resource, WCHAR pathW[MAX_PATH]) { - DWORD written; + DWORD written, length; HANDLE file; - HRSRC res; void *ptr; GetTempPathW(MAX_PATH, pathW); @@ -56,11 +66,9 @@ static void create_testfontfile(const WCHAR *filename, int resource, WCHAR pathW file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %ld\n", wine_dbgstr_w(pathW), GetLastError()); - res = FindResourceA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(resource), (LPCSTR)RT_RCDATA); - ok(res != 0, "couldn't find resource\n"); - ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); - WriteFile(file, ptr, SizeofResource(GetModuleHandleA(NULL), res), &written, NULL); - ok(written == SizeofResource(GetModuleHandleA(NULL), res), "couldn't write resource\n"); + load_resource(MAKEINTRESOURCEW(resource), (BYTE **)&ptr, &length); + WriteFile(file, ptr, length, &written, NULL); + ok(written == length, "couldn't write resource\n"); CloseHandle(file); } @@ -1524,6 +1532,47 @@ static void test_CloneFont(void) GdipDeleteFontFamily(family); } +static void test_GdipPrivateAddMemoryFont(void) +{ + static const WORD resource_ids[] = + { + 3, /* A font that has an invalid full name on Mac platform and a valid full name on Microsoft platform */ + 4, /* A font that has an invalid full name on Unicode platform and a valid full name on Mac platform */ + }; + GpFontCollection *fonts; + GpStatus stat; + int count, i; + void *buffer; + DWORD size; + + for (i = 0; i < ARRAY_SIZE(resource_ids); i++) + { + winetest_push_context("test %d", i); + + stat = GdipNewPrivateFontCollection(&fonts); + ok(stat == Ok, "GdipNewPrivateFontCollection failed, error %d\n", stat); + + load_resource(MAKEINTRESOURCEW(resource_ids[i]), (BYTE **)&buffer, &size); + stat = GdipPrivateAddMemoryFont(fonts, buffer, size); + if (stat == Ok) + { + stat = GdipGetFontCollectionFamilyCount(fonts, &count); + ok(stat == Ok, "GdipGetFontCollectionFamilyCount failed, error %d\n", stat); + todo_wine + ok(count == 1, "Expected count 1, got %d\n", count); + } + else if (i == 1 && stat == FileNotFound) + win_skip("Fonts without Microsoft platform names are unsupported on win7.\n"); + else + ok(0, "GdipPrivateAddMemoryFont failed, error %d\n", stat); + + stat = GdipDeletePrivateFontCollection(&fonts); + ok(stat == Ok, "GdipDeletePrivateFontCollection failed, error %d\n", stat); + + winetest_pop_context(); + } +} + START_TEST(font) { struct GdiplusStartupInput gdiplusStartupInput; @@ -1558,6 +1607,7 @@ START_TEST(font) test_heightgivendpi(); test_GdipGetFontCollectionFamilyList(); test_GdipGetFontCollectionFamilyCount(); + test_GdipPrivateAddMemoryFont(); GdiplusShutdown(gdiplusToken); } diff --git a/dlls/gdiplus/tests/resource.rc b/dlls/gdiplus/tests/resource.rc index 2db8d6359ea..4af61fef65d 100644 --- a/dlls/gdiplus/tests/resource.rc +++ b/dlls/gdiplus/tests/resource.rc @@ -23,3 +23,11 @@ /* @makedep: wine_testfont0.ttf */ 2 RCDATA wine_testfont0.ttf + +/* Generated with: fonttools ttx wine_mac_win.ttx */ +/* @makedep: wine_mac_win.ttf */ +3 RCDATA wine_mac_win.ttf + +/* Generated with: fonttools ttx wine_unicode_mac.ttx */ +/* @makedep: wine_unicode_mac.ttf */ +4 RCDATA wine_unicode_mac.ttf diff --git a/dlls/gdiplus/tests/wine_mac_win.ttf b/dlls/gdiplus/tests/wine_mac_win.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0a0493134deea4cf31e17182df526d9ececd96d2 GIT binary patch literal 1140 zcmds0O=}ZT6g@MOOjB#4%|Z$WnT28tQj=J^kb>1z7j6m>8d{X`F_|xzk1$Qr1O)Rp z6n8EKaak8GM3*j91aT$0bgkmbcwS~~$G_km?!D)ockZ1x?Sok6wel&7v0Jh@gw@0M?(KH^NRQb{j3-EhR1fW zN$HU5QV?5$nWnyGD1~C!#dXw)f6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright (c) 2024 Zhiyi Zhang for CodeWeavers + + + wine_mac_win + + + Regular + + + wine_mac_win + + + invalid_full_name + + + Version 1.0 + + + wine_mac_win + + + Copyright (c) 2024 Zhiyi Zhang for CodeWeavers + + + wine_mac_win + + + Regular + + + wine_mac_win + + + wine_mac_win + + + Version 1.0 + + + wine_mac_win + + + + diff --git a/dlls/gdiplus/tests/wine_unicode_mac.ttf b/dlls/gdiplus/tests/wine_unicode_mac.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4c0af94ade4dd5f9a89246cf5f63ae9320d659c8 GIT binary patch literal 1168 zcmds0O=}ZT6g_W}OroW=bRjN+45HYgq)9BUx+tb@+z1gGT7>a2nU4pVnJ`V-1PW&D zKTyO!poq(E#LuM*7lIo>^cT2LaAiC%GfCrL@P_;Dx#ymH-8R zQU4Yo&XK+6gtCjp+*9Tw`VGG`^vKhU4_rjx%J$3d%3b2e^y>i$^IP#9@hAGlAnXlJ z?_!(M0rOHPb|fRsc+aI2%0U-5Q6v6Mw;~z3_LW!cH$JlGHT2o&Prmp~`^@GqER;w9 zN0(lVbo_p`{8h)yN-#3S9`o|}4USViSv_gq#DvMsDBYQITc}J}qXh92h5O^ewZcOd z&!;i>8J@Ai6T&>{{%3kiMJ~4V4AcAL;n?)VBPR123xX%xHg>g&H=lYr(`=H_>N4`M z81wv1y2oQ?;F_M4SePe+h5m-=4QQdZ`CU`y|6iBzeD;z0znPlgT~0FtOE}8-+#H|B z1w6?30?y)DhRum)dY2Wv&F)oT89y>?ph!Wg;ai&V`8iy`f+%JhbHXBX&w=inDCa)|C!XL^h;$C!4D{C*rO(zLaVs?hX^>2R&=mS+nZZ`i8X^ vsG;I2Bj57k#A?KCx8=$MH`zbr+pznQa!A>sbegW;@5p3_B^5_jty299 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright (c) 2024 Zhiyi Zhang for CodeWeavers + + + wine_unicode_mac + + + Regular + + + wine_unicode_mac + + + invalid_full_name + + + Version 1.0 + + + wine_unicode_mac + + + Copyright (c) 2024 Zhiyi Zhang for CodeWeavers + + + wine_unicode_mac + + + Regular + + + wine_unicode_mac + + + wine_unicode_mac + + + Version 1.0 + + + wine_unicode_mac + + + + From 8ff4cd260fd400850dc7d314405060b68f4fc0c4 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 28 Mar 2024 17:00:39 +0800 Subject: [PATCH 1464/1506] gdiplus: Search microsoft platform names first in load_ttf_name_id(). Search names in fonts in the order of Microsoft, Mac and finally Unicode platform. This is also the order win32u uses to load font names. Fix Granado Espada Japan (1219160) launcher crashes at start in Japanese locale. The game ships a font with a broken name record of Mac platform and encoding ID 0 (Roman) but the name string is in code page 10001 (Japanese). This broken name record is placed before the name records for the Microsoft platform so it gets selected first. Then name value in the name record doesn't get converted correctly to Unicode because of the wrong code page. Thus the EnumFontFamiliesExW() in GdipPrivateAddMemoryFont() fails to find the font. CW-Bug-Id: #23597 --- dlls/gdiplus/font.c | 38 +++++++++++++++++++++++--------------- dlls/gdiplus/tests/font.c | 1 - 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index da37279fbef..67d75ed97f6 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -1385,12 +1385,13 @@ static WCHAR *copy_name_table_string( const tt_name_record *name, const BYTE *da static WCHAR *load_ttf_name_id( const BYTE *mem, DWORD_PTR size, DWORD id ) { + static const WORD platform_id_table[] = {TT_PLATFORM_MICROSOFT, TT_PLATFORM_MACINTOSH, TT_PLATFORM_APPLE_UNICODE}; LANGID lang = GetSystemDefaultLangID(); const tt_header *header; const tt_name_table *name_table; - const tt_name_record *name_record; + const tt_name_record *name_record_table, *name_record; DWORD pos, ofs = 0, count; - int i, res, best_lang = 0, best_index = -1; + int i, j, res, best_lang = 0, best_index = -1; if (sizeof(tt_header) > size) return NULL; @@ -1421,26 +1422,33 @@ static WCHAR *load_ttf_name_id( const BYTE *mem, DWORD_PTR size, DWORD id ) if (pos > size) return NULL; name_table = (const tt_name_table*)&mem[ofs]; + name_record_table = (const tt_name_record *)&mem[pos]; count = GET_BE_WORD(name_table->count); if (GET_BE_WORD(name_table->string_offset) >= size - ofs) return NULL; ofs += GET_BE_WORD(name_table->string_offset); - for (i=0; i size) - return NULL; + for (j = 0; j < count; j++) + { + name_record = name_record_table + j; + if ((const BYTE *)name_record - mem > size) + return NULL; - if (GET_BE_WORD(name_record->name_id) != id) continue; - if (GET_BE_WORD(name_record->offset) >= size - ofs) return NULL; - if (GET_BE_WORD(name_record->length) > size - ofs - GET_BE_WORD(name_record->offset)) return NULL; + if (GET_BE_WORD(name_record->platform_id) != platform_id_table[i]) continue; + if (GET_BE_WORD(name_record->name_id) != id) continue; + if (GET_BE_WORD(name_record->offset) >= size - ofs) return NULL; + if (GET_BE_WORD(name_record->length) > size - ofs - GET_BE_WORD(name_record->offset)) return NULL; - res = match_name_table_language( name_record, lang ); - if (res > best_lang) - { - best_lang = res; - best_index = i; + res = match_name_table_language(name_record, lang); + if (res > best_lang) + { + best_lang = res; + best_index = j; + } } + + if (best_index != -1) + break; } if (best_lang) diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 6a21ea30361..1bbb18f4c6d 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -1558,7 +1558,6 @@ static void test_GdipPrivateAddMemoryFont(void) { stat = GdipGetFontCollectionFamilyCount(fonts, &count); ok(stat == Ok, "GdipGetFontCollectionFamilyCount failed, error %d\n", stat); - todo_wine ok(count == 1, "Expected count 1, got %d\n", count); } else if (i == 1 && stat == FileNotFound) From 6cc0d8b2f00a8c5f467a63bdbc459c064242ba3b Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 2 Apr 2024 20:16:29 -0600 Subject: [PATCH 1465/1506] mmdevapi: Implement SAC_IsAudioObjectFormatSupported(). CW-Bug-Id: #23641 --- dlls/mmdevapi/spatialaudio.c | 67 ++++++++++++++++++++---------- dlls/mmdevapi/tests/spatialaudio.c | 21 ++++++++++ 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/dlls/mmdevapi/spatialaudio.c b/dlls/mmdevapi/spatialaudio.c index 23f3de31428..bc1b085f3cd 100644 --- a/dlls/mmdevapi/spatialaudio.c +++ b/dlls/mmdevapi/spatialaudio.c @@ -49,6 +49,36 @@ static UINT32 AudioObjectType_to_index(AudioObjectType type) return o - 2; } +static const char *debugstr_fmtex(const WAVEFORMATEX *fmt) +{ + static char buf[2048]; + + if (!fmt) + { + strcpy(buf, "(null)"); + } + else if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) + { + const WAVEFORMATEXTENSIBLE *fmtex = (const WAVEFORMATEXTENSIBLE *)fmt; + snprintf(buf, sizeof(buf), "tag: 0x%x (%s), ch: %u (mask: 0x%lx), rate: %lu, depth: %u", + fmt->wFormatTag, debugstr_guid(&fmtex->SubFormat), + fmt->nChannels, fmtex->dwChannelMask, fmt->nSamplesPerSec, + fmt->wBitsPerSample); + } + else + { + snprintf(buf, sizeof(buf), "tag: 0x%x, ch: %u, rate: %lu, depth: %u", + fmt->wFormatTag, fmt->nChannels, fmt->nSamplesPerSec, + fmt->wBitsPerSample); + } + return buf; +} + +static BOOL formats_equal(const WAVEFORMATEX *fmt1, const WAVEFORMATEX *fmt2) +{ + return !memcmp(fmt1, fmt2, sizeof(*fmt1) + fmt1->cbSize); +} + typedef struct SpatialAudioImpl SpatialAudioImpl; typedef struct SpatialAudioStreamImpl SpatialAudioStreamImpl; typedef struct SpatialAudioObjectImpl SpatialAudioObjectImpl; @@ -610,9 +640,20 @@ static HRESULT WINAPI SAC_GetMaxFrameCount(ISpatialAudioClient *iface, static HRESULT WINAPI SAC_IsAudioObjectFormatSupported(ISpatialAudioClient *iface, const WAVEFORMATEX *format) { - SpatialAudioImpl *This = impl_from_ISpatialAudioClient(iface); - FIXME("(%p)->(%p)\n", This, format); - return E_NOTIMPL; + SpatialAudioImpl *sac = impl_from_ISpatialAudioClient(iface); + + TRACE("sac %p, format %s.\n", sac, debugstr_fmtex(format)); + + if (!format) + return E_POINTER; + + if (!formats_equal(&sac->object_fmtex.Format, format)) + { + FIXME("Reporting format %s as unsupported.\n", debugstr_fmtex(format)); + return E_INVALIDARG; + } + + return S_OK; } static HRESULT WINAPI SAC_IsSpatialAudioStreamAvailable(ISpatialAudioClient *iface, @@ -630,23 +671,6 @@ static WAVEFORMATEX *clone_fmtex(const WAVEFORMATEX *src) return r; } -static const char *debugstr_fmtex(const WAVEFORMATEX *fmt) -{ - static char buf[2048]; - if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE){ - const WAVEFORMATEXTENSIBLE *fmtex = (const WAVEFORMATEXTENSIBLE *)fmt; - snprintf(buf, sizeof(buf), "tag: 0x%x (%s), ch: %u (mask: 0x%lx), rate: %lu, depth: %u", - fmt->wFormatTag, debugstr_guid(&fmtex->SubFormat), - fmt->nChannels, fmtex->dwChannelMask, fmt->nSamplesPerSec, - fmt->wBitsPerSample); - }else{ - snprintf(buf, sizeof(buf), "tag: 0x%x, ch: %u, rate: %lu, depth: %u", - fmt->wFormatTag, fmt->nChannels, fmt->nSamplesPerSec, - fmt->wBitsPerSample); - } - return buf; -} - static void static_mask_to_channels(AudioObjectType static_mask, WORD *count, DWORD *mask, UINT32 *map) { UINT32 out_chan = 0, map_idx = 0; @@ -776,8 +800,7 @@ static HRESULT WINAPI SAC_ActivateSpatialAudioStream(ISpatialAudioClient *iface, return E_INVALIDARG; } - if(!params->ObjectFormat || - memcmp(params->ObjectFormat, &This->object_fmtex.Format, sizeof(*params->ObjectFormat) + params->ObjectFormat->cbSize)){ + if(!(params->ObjectFormat && formats_equal(params->ObjectFormat, &This->object_fmtex.Format))) { *stream = NULL; return AUDCLNT_E_UNSUPPORTED_FORMAT; } diff --git a/dlls/mmdevapi/tests/spatialaudio.c b/dlls/mmdevapi/tests/spatialaudio.c index a382b57e7a2..4d8073d49ce 100644 --- a/dlls/mmdevapi/tests/spatialaudio.c +++ b/dlls/mmdevapi/tests/spatialaudio.c @@ -64,6 +64,27 @@ static void test_formats(void) ok(fmt->nAvgBytesPerSec == 192000, "Wrong avg bytes per sec, expected 192000 got %lu\n", fmt->nAvgBytesPerSec); ok(fmt->cbSize == 0, "Wrong cbSize for simple format, expected 0, got %hu\n", fmt->cbSize); + hr = ISpatialAudioClient_IsAudioObjectFormatSupported(sac, NULL); + ok(hr == E_POINTER, "Got %#lx.\n", hr); + + memcpy(&format, fmt, sizeof(format)); + hr = ISpatialAudioClient_IsAudioObjectFormatSupported(sac, &format); + ok(hr == S_OK, "Got %#lx.\n", hr); + + format.nBlockAlign *= 2; + hr = ISpatialAudioClient_IsAudioObjectFormatSupported(sac, &format); + todo_wine ok(hr == S_OK, "Got %#lx.\n", hr); + + memcpy(&format, fmt, sizeof(format)); + format.wBitsPerSample *= 2; + hr = ISpatialAudioClient_IsAudioObjectFormatSupported(sac, &format); + ok(hr == E_INVALIDARG, "Got %#lx.\n", hr); + + memcpy(&format, fmt, sizeof(format)); + format.nChannels = 2; + hr = ISpatialAudioClient_IsAudioObjectFormatSupported(sac, &format); + ok(hr == E_INVALIDARG, "Got %#lx.\n", hr); + memcpy(&format, fmt, sizeof(format)); IAudioFormatEnumerator_Release(afe); From a4503a70d1de9530686780b324884821fe28f66a Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Wed, 3 Apr 2024 10:35:29 +0800 Subject: [PATCH 1466/1506] HACK: ntdll: Enable WINE_SIMULATE_WRITECOPY for Hentai Maid Memories. CW-Bug-Id: #23637 --- dlls/ntdll/unix/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index b7d1f677203..4f8a84c6080 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2112,7 +2112,8 @@ static void hacks_init(void) || !strcmp(sgi, "2053940") /* Idol Hands 2 */ || !strcmp(sgi, "391150") /* Red Tie Runner */ || !strcmp(sgi, "2152990") /* Dinogen Online */ - || !strcmp(sgi, "2176450"); /* Mr. Hopp's Playhouse 3 */ + || !strcmp(sgi, "2176450") /* Mr. Hopp's Playhouse 3 */ + || !strcmp(sgi, "2361360"); /* Hentai Maid Memories */ if (sgi) wine_allocs_2g_limit = !strcmp(sgi, "359870"); if (wine_allocs_2g_limit) ERR("Allocation 2g limit enabled.\n"); From 3f99f09c7680f0b68242bd1e12db3fe45f3b852e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 3 Apr 2024 15:02:49 -0600 Subject: [PATCH 1467/1506] winegstreamer: Try to handle broken IStream_Stat implementation in WM reader OpenStream(). CW-Bug-Id: #23643 --- dlls/winegstreamer/wm_reader.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 8014691def3..a172f1cfbb3 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -2250,18 +2250,36 @@ static HRESULT WINAPI reader_Open(IWMSyncReader2 *iface, const WCHAR *filename) static HRESULT WINAPI reader_OpenStream(IWMSyncReader2 *iface, IStream *stream) { + static const ULONG64 canary_size = 0xdeadbeeffeedcafe; struct wm_reader *reader = impl_from_IWMSyncReader2(iface); STATSTG stat; HRESULT hr; TRACE("reader %p, stream %p.\n", reader, stream); + stat.cbSize.QuadPart = canary_size; if (FAILED(hr = IStream_Stat(stream, &stat, STATFLAG_NONAME))) { ERR("Failed to stat stream, hr %#lx.\n", hr); return hr; } + if (stat.cbSize.QuadPart == canary_size) + { + /* Call of Juarez: Gunslinger implements IStream_Stat as an empty function returning S_OK, leaving + * the output stat unchanged. Windows doesn't call IStream_Seek(_SEEK_END) and probably validates + * the size against WMV file headers so the bigger cbSize doesn't change anything. + * Such streams work as soon as the uninitialized cbSize is big enough which is usually the case + * (if that is not the case Windows will favour shorter cbSize). */ + static const LARGE_INTEGER zero = { 0 }; + ULARGE_INTEGER pos = { .QuadPart = canary_size }; + + if (SUCCEEDED(hr = IStream_Seek(stream, zero, STREAM_SEEK_END, &pos))) + IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL); + stat.cbSize.QuadPart = pos.QuadPart == canary_size ? 0 : pos.QuadPart; + ERR("IStream_Stat did not fill the stream size, size from _Seek %I64u.\n", stat.cbSize.QuadPart); + } + EnterCriticalSection(&reader->cs); if (reader->wg_parser) From 107c8d5edbcbb80b95062f23e35fe5f75c41b4cf Mon Sep 17 00:00:00 2001 From: Santino Mazza Date: Fri, 22 Mar 2024 17:08:32 -0300 Subject: [PATCH 1468/1506] crypt32: Fix CryptBinaryToString not adding a separator. (cherry picked from commit 624e87a7252abd1f03598c68edc56e6815af1ef2) --- dlls/crypt32/base64.c | 16 +++++++++------- dlls/crypt32/tests/base64.c | 8 ++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c index b61ed7ff8cc..298756ca541 100644 --- a/dlls/crypt32/base64.c +++ b/dlls/crypt32/base64.c @@ -111,8 +111,6 @@ static DWORD encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep, i = 0; while (div > 0 && ptr < end) { - if (i && i % 64 == 0) - ptr += stradd(ptr, end, sep, strlen(sep)); /* first char is the first 6 bits of the first byte*/ chunk[0] = b64[ ( d[0] >> 2) & 0x3f ]; /* second char is the last 2 bits of the first byte and the first 4 @@ -127,6 +125,9 @@ static DWORD encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep, i += 4; d += 3; div--; + + if (i && i % 64 == 0) + ptr += stradd(ptr, end, sep, strlen(sep)); } switch(pad_bytes) @@ -393,11 +394,6 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep, i = 0; while (div > 0) { - if (i && i % 64 == 0) - { - lstrcpyW(ptr, sep); - ptr += lstrlenW(sep); - } /* first char is the first 6 bits of the first byte*/ *ptr++ = b64[ ( d[0] >> 2) & 0x3f ]; /* second char is the last 2 bits of the first byte and the first 4 @@ -411,6 +407,12 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep, i += 4; d += 3; div--; + + if (i && i % 64 == 0) + { + lstrcpyW(ptr, sep); + ptr += lstrlenW(sep); + } } switch(pad_bytes) diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c index e81a57c576d..2263b236fa8 100644 --- a/dlls/crypt32/tests/base64.c +++ b/dlls/crypt32/tests/base64.c @@ -57,6 +57,8 @@ static const BYTE toEncode4[] = static const BYTE toEncode5[] = "abcdefghijlkmnopqrstuvwxyz01234567890ABCDEFGHI"; +static const BYTE toEncode6[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + static const struct BinTests tests[] = { { toEncode1, sizeof(toEncode1), "AA==\r\n", }, { toEncode2, sizeof(toEncode2), "AQI=\r\n", }, @@ -69,6 +71,9 @@ static const struct BinTests tests[] = { "SElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkwAA==\r\n" }, { toEncode5, sizeof(toEncode5), "YWJjZGVmZ2hpamxrbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5MEFCQ0RFRkdISQA=\r\n" }, + { toEncode6, sizeof(toEncode6), + "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh\r\n" + "YQA=\r\n" }, }; static const struct BinTests testsNoCR[] = { @@ -83,6 +88,9 @@ static const struct BinTests testsNoCR[] = { "SElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkwAA==\n" }, { toEncode5, sizeof(toEncode5), "YWJjZGVmZ2hpamxrbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5MEFCQ0RFRkdISQA=\n" }, + { toEncode6, sizeof(toEncode6), + "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh\n" + "YQA=\n" }, }; static WCHAR *strdupAtoW(const char *str) From c4888745f0e93f0b17619bb3289061055f1aaae2 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 4 Apr 2024 17:53:09 -0600 Subject: [PATCH 1469/1506] kernelbase: HACK: Force CEF swiftshader for Insanity's Blade. CW-Bug-Id: #23650 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index dfce336d2c0..725e9e252ce 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -594,6 +594,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) } options[] = { + {L"Insanitys Blade\\nw.exe", L" --use-gl=swiftshader"}, {L"Warhammer2.exe", L" --in-process-gpu"}, {L"SummerIslands.exe", L" --in-process-gpu"}, {L"UplayWebCore.exe", L" --use-angle=vulkan"}, From 27448768d98b9a47ff6fc4f62ce61421175e7008 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 4 Apr 2024 17:51:39 -0600 Subject: [PATCH 1470/1506] kernelbase: HACK: Force disable direct composition for Bloody Walls. CW-Bug-Id: #23651 --- dlls/kernelbase/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 725e9e252ce..4267a8c57e6 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -594,6 +594,7 @@ static const WCHAR *hack_append_command_line( const WCHAR *cmd ) } options[] = { + {L"Bloody Walls\\game.exe", L" --disable_direct_composition=1"}, {L"Insanitys Blade\\nw.exe", L" --use-gl=swiftshader"}, {L"Warhammer2.exe", L" --in-process-gpu"}, {L"SummerIslands.exe", L" --in-process-gpu"}, From f5c2fd9cb7dc27c8c7ea2925a8b45bf4e929988f Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Fri, 5 Apr 2024 12:05:04 +0300 Subject: [PATCH 1471/1506] fixup! opengl32: HACK: Fixup shaders for Joe Danger 2: The Movie. Fix possibility of strcmp dereferencing NULL when env variable SteamGameId is not set. Link: https://github.com/ValveSoftware/wine/issues/228 --- dlls/opengl32/wgl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 251e177ad9c..2a308152735 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1343,6 +1343,8 @@ static char *fixup_shader( GLsizei count, const GLchar *const*string, const GLin const char *sgi = getenv("SteamGameId"); unsigned int i; + if (!sgi) return NULL; + for (i = 0; i < ARRAY_SIZE(replace); ++i) if (!strcmp( sgi, replace[i].gameid )) break; From 06f9ea4e09590a6580fdaa1387925eb527ca8bfd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Apr 2024 12:11:51 -0600 Subject: [PATCH 1472/1506] ntdll: Return STATUS_NO_YIELD_PERFORMED from NtYieldExecution() on Linux if no yield was performed. CW-Bug-Id: #23654 --- dlls/ntdll/unix/sync.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index dd08632e21c..23f17e72e08 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -43,6 +43,9 @@ #ifdef HAVE_SCHED_H # include #endif +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif #include #include #include @@ -1626,7 +1629,17 @@ NTSTATUS WINAPI NtSignalAndWaitForSingleObject( HANDLE signal, HANDLE wait, NTSTATUS WINAPI NtYieldExecution(void) { #ifdef HAVE_SCHED_YIELD +#ifdef RUSAGE_THREAD + struct rusage u1, u2; + int ret; + + ret = getrusage( RUSAGE_THREAD, &u1 ); +#endif sched_yield(); +#ifdef RUSAGE_THREAD + if (!ret) ret = getrusage( RUSAGE_THREAD, &u2 ); + if (!ret && u1.ru_nvcsw == u2.ru_nvcsw && u1.ru_nivcsw == u2.ru_nivcsw) return STATUS_NO_YIELD_PERFORMED; +#endif return STATUS_SUCCESS; #else return STATUS_NO_YIELD_PERFORMED; From c231dbe07818d3557947f97ff25ea60113b0abe9 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Apr 2024 20:21:09 -0600 Subject: [PATCH 1473/1506] winhttp: Set actual default receive response timeout to 21sec. CW-Bug-Id: #23656 --- dlls/winhttp/request.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index c75d6fd513f..ee7315170c6 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -43,6 +43,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(winhttp); #define DEFAULT_KEEP_ALIVE_TIMEOUT 30000 +#define ACTUAL_DEFAULT_RECEIVE_RESPONSE_TIMEOUT 21000 + +static int request_receive_response_timeout( struct request *req ) +{ + if (req->receive_response_timeout == -1) return ACTUAL_DEFAULT_RECEIVE_RESPONSE_TIMEOUT; + return req->receive_response_timeout; +} + static const WCHAR *attribute_table[] = { L"Mime-Version", /* WINHTTP_QUERY_MIME_VERSION = 0 */ @@ -1658,7 +1666,7 @@ static DWORD open_connection( struct request *request ) return ret; } netconn_set_timeout( netconn, TRUE, request->send_timeout ); - netconn_set_timeout( netconn, FALSE, request->receive_response_timeout ); + netconn_set_timeout( netconn, FALSE, request_receive_response_timeout( request )); request->netconn = netconn; @@ -1696,7 +1704,7 @@ static DWORD open_connection( struct request *request ) TRACE("using connection %p\n", netconn); netconn_set_timeout( netconn, TRUE, request->send_timeout ); - netconn_set_timeout( netconn, FALSE, request->receive_response_timeout ); + netconn_set_timeout( netconn, FALSE, request_receive_response_timeout( request )); request->netconn = netconn; } @@ -2329,7 +2337,7 @@ static DWORD send_request( struct request *request, const WCHAR *headers, DWORD if (!chunked && content_length <= optional_len) { - netconn_set_timeout( request->netconn, FALSE, request->receive_response_timeout ); + netconn_set_timeout( request->netconn, FALSE, request_receive_response_timeout( request )); request->read_reply_status = read_reply( request ); if (request->state == REQUEST_RESPONSE_STATE_READ_RESPONSE_QUEUED) request->state = REQUEST_RESPONSE_STATE_READ_RESPONSE_QUEUED_REPLY_RECEIVED; @@ -2932,7 +2940,7 @@ static DWORD receive_response( struct request *request ) } /* fallthrough */ case REQUEST_RESPONSE_STATE_READ_RESPONSE_QUEUED_REQUEST_SENT: - netconn_set_timeout( request->netconn, FALSE, request->receive_response_timeout ); + netconn_set_timeout( request->netconn, FALSE, request_receive_response_timeout( request )); request->read_reply_status = read_reply( request ); request->state = REQUEST_RESPONSE_STATE_REPLY_RECEIVED; break; From 6c0704129ae5a7bf326c3741cd6a5bb8d5fb2b1a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Apr 2024 22:35:05 -0600 Subject: [PATCH 1474/1506] winhttp/tests: Add some tests for actual connection caching. CW-Bug-Id: #23656 --- dlls/winhttp/tests/winhttp.c | 114 +++++++++++++++++++++++++++++++---- 1 file changed, 102 insertions(+), 12 deletions(-) diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 09abc4c5854..8aa03596732 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -2197,6 +2197,12 @@ static const char okmsg[] = "Server: winetest\r\n" "\r\n"; +static const char okmsg_length0[] = +"HTTP/1.1 200 OK\r\n" +"Server: winetest\r\n" +"Content-length: 0\r\n" +"\r\n"; + static const char notokmsg[] = "HTTP/1.1 400 Bad Request\r\n" "\r\n"; @@ -2318,6 +2324,24 @@ static void create_websocket_accept(const char *key, char *buf, unsigned int buf CryptBinaryToStringA( (BYTE *)sha1, sizeof(sha1), CRYPT_STRING_BASE64, buf, &len); } +static int server_receive_request(int c, char *buffer, size_t buffer_size) +{ + int i, r; + + memset(buffer, 0, buffer_size); + for(i = 0; i < buffer_size - 1; i++) + { + r = recv(c, &buffer[i], 1, 0); + if (r != 1) + break; + if (i < 4) continue; + if (buffer[i - 2] == '\n' && buffer[i] == '\n' && + buffer[i - 3] == '\r' && buffer[i - 1] == '\r') + break; + } + return r; +} + static DWORD CALLBACK server_thread(LPVOID param) { struct server_info *si = param; @@ -2351,18 +2375,7 @@ static DWORD CALLBACK server_thread(LPVOID param) do { if (c == -1) c = accept(s, NULL, NULL); - - memset(buffer, 0, sizeof buffer); - for(i = 0; i < sizeof buffer - 1; i++) - { - r = recv(c, &buffer[i], 1, 0); - if (r != 1) - break; - if (i < 4) continue; - if (buffer[i - 2] == '\n' && buffer[i] == '\n' && - buffer[i - 3] == '\r' && buffer[i - 1] == '\r') - break; - } + server_receive_request(c, buffer, sizeof(buffer)); if (strstr(buffer, "GET /basic")) { send(c, okmsg, sizeof okmsg - 1, 0); @@ -2558,6 +2571,23 @@ static DWORD CALLBACK server_thread(LPVOID param) } send(c, okmsg, sizeof(okmsg) - 1, 0); } + + if (strstr(buffer, "GET /cached")) + { + send(c, okmsg_length0, sizeof okmsg_length0 - 1, 0); + r = server_receive_request(c, buffer, sizeof(buffer)); + ok(r > 0, "got %d.\n", r); + ok(!!strstr(buffer, "GET /cached"), "request not found.\n"); + send(c, okmsg_length0, sizeof okmsg_length0 - 1, 0); + r = server_receive_request(c, buffer, sizeof(buffer)); + todo_wine ok(!r, "got %d, buffer[0] %d.\n", r, buffer[0]); + } + if (strstr(buffer, "GET /notcached")) + { + send(c, okmsg, sizeof okmsg - 1, 0); + r = server_receive_request(c, buffer, sizeof(buffer)); + ok(!r, "got %d, buffer[0] %d.\n", r, buffer[0] ); + } shutdown(c, 2); closesocket(c); c = -1; @@ -5822,6 +5852,65 @@ static void test_client_cert_authentication(void) WinHttpCloseHandle( ses ); } +static void test_connection_cache(int port) +{ + HINTERNET ses, con, req; + DWORD status, size; + char buffer[256]; + BOOL ret; + + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ok(ses != NULL, "failed to open session %lu\n", GetLastError()); + + con = WinHttpConnect(ses, L"localhost", port, 0); + ok(con != NULL, "failed to open a connection %lu\n", GetLastError()); + + req = WinHttpOpenRequest(con, L"GET", L"/cached", NULL, NULL, NULL, 0); + ok(req != NULL, "failed to open a request %lu\n", GetLastError()); + ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); + ok(ret, "failed to send request %lu\n", GetLastError()); + ret = WinHttpReceiveResponse(req, NULL); + ok(ret, "failed to receive response %lu\n", GetLastError()); + size = sizeof(status); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL); + ok(ret, "failed to query status code %lu\n", GetLastError()); + ok(status == HTTP_STATUS_OK, "request failed unexpectedly %lu\n", status); + ret = WinHttpReadData(req, buffer, sizeof buffer, &size); + ok(ret, "failed to read data %lu\n", GetLastError()); + ok(!size, "got size %lu.\n", size); + WinHttpCloseHandle(req); + + req = WinHttpOpenRequest(con, L"GET", L"/cached", NULL, NULL, NULL, 0); + ok(req != NULL, "failed to open a request %lu\n", GetLastError()); + ret = WinHttpSendRequest(req, L"Connection: close", ~0ul, NULL, 0, 0, 0); + ok(ret, "failed to send request %lu\n", GetLastError()); + ret = WinHttpReceiveResponse(req, NULL); + ok(ret, "failed to receive response %lu\n", GetLastError()); + size = sizeof(status); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL); + ok(ret, "failed to query status code %lu\n", GetLastError()); + ok(status == HTTP_STATUS_OK, "request failed unexpectedly %lu\n", status); + ret = WinHttpReadData(req, buffer, sizeof buffer, &size); + ok(ret, "failed to read data %lu\n", GetLastError()); + ok(!size, "got size %lu.\n", size); + WinHttpCloseHandle(req); + + req = WinHttpOpenRequest(con, L"GET", L"/notcached", NULL, NULL, NULL, 0); + ok(req != NULL, "failed to open a request %lu\n", GetLastError()); + ret = WinHttpSendRequest(req, L"Connection: close", ~0ul, NULL, 0, 0, 0); + ok(ret, "failed to send request %lu\n", GetLastError()); + ret = WinHttpReceiveResponse(req, NULL); + ok(ret, "failed to receive response %lu\n", GetLastError()); + size = sizeof(status); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL); + ok(ret, "failed to query status code %lu\n", GetLastError()); + ok(status == HTTP_STATUS_OK, "request failed unexpectedly %lu\n", status); + WinHttpCloseHandle(req); + + WinHttpCloseHandle(con); + WinHttpCloseHandle(ses); +} + START_TEST (winhttp) { struct server_info si; @@ -5889,6 +5978,7 @@ START_TEST (winhttp) test_passport_auth(si.port); test_websocket(si.port); test_redirect(si.port); + test_connection_cache(si.port); /* send the basic request again to shutdown the server thread */ test_basic_request(si.port, NULL, L"/quit"); From 26c7c69fe79c0eb25ca70f6f244dd42680f5563a Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Apr 2024 22:45:08 -0600 Subject: [PATCH 1475/1506] winhttp: Do not cache connection if suggested by request headers. CW-Bug-Id: #23656 --- dlls/winhttp/request.c | 20 +++++++++----------- dlls/winhttp/tests/winhttp.c | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index ee7315170c6..17621af8647 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -1922,7 +1922,7 @@ static DWORD refill_buffer( struct request *request, BOOL notify ) static void finished_reading( struct request *request ) { - BOOL close = FALSE, notify; + BOOL close = FALSE, close_request_headers; WCHAR connection[20]; DWORD size = sizeof(connection); @@ -1937,18 +1937,16 @@ static void finished_reading( struct request *request ) } else if (!wcscmp( request->version, L"HTTP/1.0" )) close = TRUE; - if (close) + size = sizeof(connection); + close_request_headers = + (!query_headers( request, WINHTTP_QUERY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, NULL, connection, &size, NULL ) + || !query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, NULL, connection, &size, NULL )) + && !wcsicmp( connection, L"close" ); + if (close || close_request_headers) { - size = sizeof(connection); - notify = (!query_headers( request, WINHTTP_QUERY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - NULL, connection, &size, NULL ) - || !query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - NULL, connection, &size, NULL )) - && !wcsicmp( connection, L"close" ); - - if (notify) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 0 ); + if (close_request_headers) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 0 ); netconn_release( request->netconn ); - if (notify) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 0 ); + if (close_request_headers) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 0 ); } else cache_connection( request->netconn ); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 8aa03596732..2c3f1791898 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -2580,7 +2580,7 @@ static DWORD CALLBACK server_thread(LPVOID param) ok(!!strstr(buffer, "GET /cached"), "request not found.\n"); send(c, okmsg_length0, sizeof okmsg_length0 - 1, 0); r = server_receive_request(c, buffer, sizeof(buffer)); - todo_wine ok(!r, "got %d, buffer[0] %d.\n", r, buffer[0]); + ok(!r, "got %d, buffer[0] %d.\n", r, buffer[0]); } if (strstr(buffer, "GET /notcached")) { From 4699da416b798a50de718df614ae9af9a19ce0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 10:55:06 +0100 Subject: [PATCH 1476/1506] winegstreamer/media-converter: Split videoconv caps event handler to a separate helper. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 71 ++++++++++--------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index b91aa96f1bf..f92c3300604 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -663,50 +663,55 @@ static void video_conv_init_transcode(VideoConv *conv) pthread_mutex_unlock(&dump_fozdb.mutex); } -static gboolean video_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +static gboolean video_conv_sink_event_caps(VideoConv *conv, GstEvent *event) { - VideoConv *conv = VIDEO_CONV(parent); + struct video_conv_state *state; + uint32_t transcode_tag; + GstCaps *caps; bool ret; - GST_DEBUG_OBJECT(pad, "Got event %"GST_PTR_FORMAT".", event); + gst_event_unref(event); - if (event->type == GST_EVENT_CAPS) + /* push_event, below, can also grab state and cause a deadlock, so make sure it's + * unlocked before calling */ + if (!(state = video_conv_lock_state(conv))) { - struct video_conv_state *state; - uint32_t transcode_tag; - GstCaps *caps; + GST_ERROR("VideoConv not yet in READY state?"); + return false; + } - /* push_event, below, can also grab state and cause a deadlock, so make sure it's - * unlocked before calling */ - if (!(state = video_conv_lock_state(conv))) - { - GST_ERROR("VideoConv not yet in READY state?"); - return false; - } + if (!gst_pad_activate_mode(conv->sink_pad, GST_PAD_MODE_PULL, true)) + { + GST_ERROR("Failed to activate sink pad in pull mode."); + pthread_mutex_unlock(&conv->state_mutex); + return false; + } - if (!gst_pad_activate_mode(conv->sink_pad, GST_PAD_MODE_PULL, true)) - { - GST_ERROR("Failed to activate sink pad in pull mode."); - pthread_mutex_unlock(&conv->state_mutex); - return false; - } + video_conv_init_transcode(conv); + transcode_tag = state->transcoded_tag; - video_conv_init_transcode(conv); - transcode_tag = state->transcoded_tag; + pthread_mutex_unlock(&conv->state_mutex); - pthread_mutex_unlock(&conv->state_mutex); + if (transcode_tag == VIDEO_CONV_FOZ_TAG_MKVDATA) + caps = gst_caps_from_string("video/x-matroska"); + else if (transcode_tag == VIDEO_CONV_FOZ_TAG_OGVDATA) + caps = gst_caps_from_string("application/ogg"); + else + return false; - if (transcode_tag == VIDEO_CONV_FOZ_TAG_MKVDATA) - caps = gst_caps_from_string("video/x-matroska"); - else if (transcode_tag == VIDEO_CONV_FOZ_TAG_OGVDATA) - caps = gst_caps_from_string("application/ogg"); - else - return false; + ret = push_event(conv->src_pad, gst_event_new_caps(caps)); + gst_caps_unref(caps); + return ret; +} - ret = push_event(conv->src_pad, gst_event_new_caps(caps)); - gst_caps_unref(caps); - return ret; - } +static gboolean video_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + VideoConv *conv = VIDEO_CONV(parent); + + GST_DEBUG_OBJECT(pad, "Got event %"GST_PTR_FORMAT".", event); + + if (event->type == GST_EVENT_CAPS) + return video_conv_sink_event_caps(conv, event); return gst_pad_event_default(pad, parent, event); } From 8287b52f8ee4d17183084b03d37ec48ee1dd1bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 11:04:31 +0100 Subject: [PATCH 1477/1506] winegstreamer/media-converter: Split videoconv upstream chunk dump to a separate helper. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index f92c3300604..9597d686abb 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -576,6 +576,22 @@ static bool video_conv_hash_upstream_data(VideoConv *conv, struct payload_hash * return ret; } +static int video_conv_dump_upstream_chunk(VideoConv *conv, void *buffer, size_t read_size, + GList **chunk_hashes) +{ + struct bytes_reader bytes_reader; + struct payload_hash *chunk_hash; + + bytes_reader_init(&bytes_reader, buffer, read_size); + chunk_hash = calloc(1, sizeof(*chunk_hash)); + murmur3_128(&bytes_reader, bytes_reader_read, HASH_SEED, chunk_hash); + *chunk_hashes = g_list_append(*chunk_hashes, chunk_hash); + + bytes_reader_init(&bytes_reader, buffer, read_size); + return fozdb_write_entry(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_VIDEODATA, chunk_hash, + &bytes_reader, bytes_reader_read, true); +} + static int video_conv_dump_upstream_data(VideoConv *conv, struct payload_hash *hash) { struct hashes_reader chunk_hashes_reader; @@ -597,17 +613,7 @@ static int video_conv_dump_upstream_data(VideoConv *conv, struct payload_hash *h pad_reader = pad_reader_create(conv->sink_pad); while ((ret = pad_reader_read(pad_reader, buffer, HASH_CHUNK_SIZE, &read_size)) == CONV_OK) { - struct bytes_reader bytes_reader; - struct payload_hash *chunk_hash; - - bytes_reader_init(&bytes_reader, buffer, read_size); - chunk_hash = calloc(1, sizeof(*chunk_hash)); - murmur3_128(&bytes_reader, bytes_reader_read, HASH_SEED, chunk_hash); - chunk_hashes = g_list_append(chunk_hashes, chunk_hash); - - bytes_reader_init(&bytes_reader, buffer, read_size); - if ((ret = fozdb_write_entry(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_VIDEODATA, chunk_hash, - &bytes_reader, bytes_reader_read, true)) < 0) + if ((ret = video_conv_dump_upstream_chunk(conv, buffer, read_size, &chunk_hashes)) < 0) { GST_ERROR("Error writing video data to fozdb, ret %d.", ret); goto done; From b7de5e8424233f668107cbc883c15800861034c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 11:52:12 +0100 Subject: [PATCH 1478/1506] winegstreamer/media-converter: Split videoconv stream-start event push to a separate helper. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index 9597d686abb..28b391b2d68 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -669,6 +669,23 @@ static void video_conv_init_transcode(VideoConv *conv) pthread_mutex_unlock(&dump_fozdb.mutex); } +static gboolean video_conv_push_stream_start(VideoConv *conv, struct payload_hash *hash) +{ + struct video_conv_state *state; + + push_event(conv->src_pad, gst_event_new_stream_start(format_hash(hash))); + + if (!(state = video_conv_lock_state(conv))) + { + GST_ERROR("VideoConv not yet in READY state?"); + return false; + } + state->need_stream_start = false; + pthread_mutex_unlock(&conv->state_mutex); + + return true; +} + static gboolean video_conv_sink_event_caps(VideoConv *conv, GstEvent *event) { struct video_conv_state *state; @@ -885,18 +902,7 @@ static gboolean video_conv_src_active_mode(GstPad *pad, GstObject *parent, GstPa pthread_mutex_unlock(&conv->state_mutex); if (need_stream_start && active && has_transcoded) - { - push_event(conv->src_pad, gst_event_new_stream_start(format_hash(&hash))); - - if (!(state = video_conv_lock_state(conv))) - { - GST_ERROR("VideoConv not yet in READY state?"); - return false; - } - state->need_stream_start = false; - pthread_mutex_unlock(&conv->state_mutex); - } - + return video_conv_push_stream_start(conv, &hash); return true; } From 1d22a0dac47870925b1fe05b3b97a5f0b679c80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 17:10:58 +0100 Subject: [PATCH 1479/1506] winegstreamer/media-converter: Split videoconv event caps push to a separate helper. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index 28b391b2d68..4a58a989fdf 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -686,12 +686,27 @@ static gboolean video_conv_push_stream_start(VideoConv *conv, struct payload_has return true; } +static gboolean video_conv_push_caps(VideoConv *conv, uint32_t transcode_tag) +{ + GstCaps *caps; + gboolean ret; + + if (transcode_tag == VIDEO_CONV_FOZ_TAG_MKVDATA) + caps = gst_caps_from_string("video/x-matroska"); + else if (transcode_tag == VIDEO_CONV_FOZ_TAG_OGVDATA) + caps = gst_caps_from_string("application/ogg"); + else + return false; + + ret = push_event(conv->src_pad, gst_event_new_caps(caps)); + gst_caps_unref(caps); + return ret; +} + static gboolean video_conv_sink_event_caps(VideoConv *conv, GstEvent *event) { struct video_conv_state *state; uint32_t transcode_tag; - GstCaps *caps; - bool ret; gst_event_unref(event); @@ -715,16 +730,7 @@ static gboolean video_conv_sink_event_caps(VideoConv *conv, GstEvent *event) pthread_mutex_unlock(&conv->state_mutex); - if (transcode_tag == VIDEO_CONV_FOZ_TAG_MKVDATA) - caps = gst_caps_from_string("video/x-matroska"); - else if (transcode_tag == VIDEO_CONV_FOZ_TAG_OGVDATA) - caps = gst_caps_from_string("application/ogg"); - else - return false; - - ret = push_event(conv->src_pad, gst_event_new_caps(caps)); - gst_caps_unref(caps); - return ret; + return video_conv_push_caps(conv, transcode_tag); } static gboolean video_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) From 0246157701b61d7062707831195e31fa9cf87050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 10:54:28 +0100 Subject: [PATCH 1480/1506] winegstreamer/media-converter: Open the blank file on videoconv state creation. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 73 +++++++------------ 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index 4a58a989fdf..bf2c4c6b168 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -92,6 +92,7 @@ struct video_conv_state { struct payload_hash transcode_hash; struct fozdb *read_fozdb; + int blank_file; uint64_t upstream_duration; uint64_t our_duration; uint32_t transcoded_tag; @@ -331,22 +332,37 @@ static int video_conv_state_create(struct video_conv_state **out) { struct video_conv_state *state; struct fozdb *fozdb = NULL; - char *read_fozdb_path; - int ret; + char *read_fozdb_path, *blank_video; + uint64_t blank_file_size; + int ret, fd; if (!(read_fozdb_path = getenv("MEDIACONV_VIDEO_TRANSCODED_FILE"))) { GST_ERROR("MEDIACONV_VIDEO_TRANSCODED_FILE is not set."); return CONV_ERROR_ENV_NOT_SET; } + if (!(blank_video = getenv("MEDIACONV_BLANK_VIDEO_FILE"))) + { + GST_ERROR("Env MEDIACONV_BLANK_VIDEO_FILE not set."); + return CONV_ERROR_ENV_NOT_SET; + } + + if (!open_file(blank_video, O_RDONLY, &fd)) + return CONV_ERROR_OPEN_FAILED; + if (!get_file_size(fd, &blank_file_size)) + { + close(fd); + return CONV_ERROR_OPEN_FAILED; + } if ((ret = fozdb_create(read_fozdb_path, O_RDONLY, true /* Read-only? */, VIDEO_CONV_FOZ_NUM_TAGS, &fozdb)) < 0) GST_ERROR("Failed to create read fozdb from %s, ret %d.", read_fozdb_path, ret); state = calloc(1, sizeof(*state)); state->read_fozdb = fozdb; + state->blank_file = fd; state->upstream_duration = DURATION_NONE; - state->our_duration = DURATION_NONE; + state->our_duration = blank_file_size; state->transcoded_tag = VIDEO_CONV_FOZ_TAG_MKVDATA; state->need_stream_start = true; @@ -358,16 +374,13 @@ static void video_conv_state_release(struct video_conv_state *state) { if (state->read_fozdb) fozdb_release(state->read_fozdb); + close(state->blank_file); free(state); } /* Return true if the file is transcoded, false if not. */ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct payload_hash *hash) { - const char *blank_video; - uint64_t file_size = 0; - int fd; - GST_DEBUG("state %p, hash %s.", state, format_hash(hash)); if (state->read_fozdb) @@ -396,18 +409,6 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay } GST_INFO("No transcoded video for %s. Substituting a blank video.", format_hash(hash)); - - if (!(blank_video = getenv("MEDIACONV_BLANK_VIDEO_FILE"))) - { - GST_ERROR("Env MEDIACONV_BLANK_VIDEO_FILE not set."); - return false; - } - if (open_file(blank_video, O_RDONLY, &fd)) - { - get_file_size(fd, &file_size); - close(fd); - } - state->our_duration = file_size; state->has_transcoded = false; create_placeholder_file("placeholder-video-used"); @@ -418,11 +419,9 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay int video_conv_state_fill_buffer(struct video_conv_state *state, uint64_t offset, uint8_t *buffer, size_t size, size_t *fill_size) { - const char *blank_video; - uint64_t file_size; size_t to_copy; bool read_ok; - int fd, ret; + int ret; if (state->has_transcoded) { @@ -433,38 +432,18 @@ int video_conv_state_fill_buffer(struct video_conv_state *state, uint64_t offset } else /* Fill blank video data to buffer. */ { - if (!(blank_video = getenv("MEDIACONV_BLANK_VIDEO_FILE"))) - { - GST_ERROR("Env MEDIACONV_BLANK_VIDEO_FILE not set."); - return CONV_ERROR_ENV_NOT_SET; - } - if (!open_file(blank_video, O_RDONLY, &fd)) - return CONV_ERROR_OPEN_FAILED; - if (!get_file_size(fd, &file_size)) - { - close(fd); - return CONV_ERROR; - } - /* Get copy size. */ - if (offset >= file_size) - { - close(fd); + if (offset >= state->our_duration) return CONV_OK; - } - to_copy = min(file_size - offset, size); + to_copy = min(state->our_duration - offset, size); /* Copy data. */ - if (lseek(fd, offset, SEEK_SET) < 0) + if (lseek(state->blank_file, offset, SEEK_SET) < 0) { - GST_ERROR("Failed to seek %s to %#"PRIx64". %s.", blank_video, offset, strerror(errno)); - close(fd); + GST_ERROR("Failed to seek to %#"PRIx64". %s.", offset, strerror(errno)); return CONV_ERROR; } - read_ok = complete_read(fd, buffer, to_copy); - close(fd); - - if (!read_ok) + if (!(read_ok = complete_read(state->blank_file, buffer, to_copy))) { GST_ERROR("Failed to read blank video data."); return CONV_ERROR_READ_FAILED; From 5e24cabfaa0345bed0cb16ecb48619879d91a3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 10:54:28 +0100 Subject: [PATCH 1481/1506] winegstreamer/media-converter: Use an enum for video conv state flags. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index bf2c4c6b168..cf3f99fe7a2 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -88,6 +88,12 @@ struct hashes_reader GList *current_hash; }; +enum video_conv_state_flags +{ + VIDEO_CONV_STREAM_STARTED = 1, + VIDEO_CONV_HAS_TRANSCODED = 2, +}; + struct video_conv_state { struct payload_hash transcode_hash; @@ -96,7 +102,7 @@ struct video_conv_state uint64_t upstream_duration; uint64_t our_duration; uint32_t transcoded_tag; - bool has_transcoded, need_stream_start; + uint32_t state_flags; }; typedef struct @@ -364,7 +370,6 @@ static int video_conv_state_create(struct video_conv_state **out) state->upstream_duration = DURATION_NONE; state->our_duration = blank_file_size; state->transcoded_tag = VIDEO_CONV_FOZ_TAG_MKVDATA; - state->need_stream_start = true; *out = state; return CONV_OK; @@ -393,7 +398,7 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay state->transcode_hash = *hash; state->our_duration = entry_size; state->transcoded_tag = VIDEO_CONV_FOZ_TAG_MKVDATA; - state->has_transcoded = true; + state->state_flags |= VIDEO_CONV_HAS_TRANSCODED; return true; } @@ -403,13 +408,13 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay state->transcode_hash = *hash; state->our_duration = entry_size; state->transcoded_tag = VIDEO_CONV_FOZ_TAG_OGVDATA; - state->has_transcoded = true; + state->state_flags |= VIDEO_CONV_HAS_TRANSCODED; return true; } } GST_INFO("No transcoded video for %s. Substituting a blank video.", format_hash(hash)); - state->has_transcoded = false; + state->state_flags &= ~VIDEO_CONV_HAS_TRANSCODED; create_placeholder_file("placeholder-video-used"); @@ -423,7 +428,7 @@ int video_conv_state_fill_buffer(struct video_conv_state *state, uint64_t offset bool read_ok; int ret; - if (state->has_transcoded) + if (state->state_flags & VIDEO_CONV_HAS_TRANSCODED) { if ((ret = fozdb_read_entry_data(state->read_fozdb, state->transcoded_tag, &state->transcode_hash, offset, buffer, size, fill_size, false)) < 0) @@ -626,7 +631,7 @@ static void video_conv_init_transcode(VideoConv *conv) struct payload_hash hash; int ret; - if (state->has_transcoded) + if (state->state_flags & VIDEO_CONV_HAS_TRANSCODED) return; pthread_mutex_lock(&dump_fozdb.mutex); @@ -659,7 +664,7 @@ static gboolean video_conv_push_stream_start(VideoConv *conv, struct payload_has GST_ERROR("VideoConv not yet in READY state?"); return false; } - state->need_stream_start = false; + state->state_flags |= VIDEO_CONV_STREAM_STARTED; pthread_mutex_unlock(&conv->state_mutex); return true; @@ -856,8 +861,7 @@ static gboolean video_conv_src_active_mode(GstPad *pad, GstObject *parent, GstPa VideoConv *conv = VIDEO_CONV(parent); struct video_conv_state *state; struct payload_hash hash; - bool need_stream_start; - bool has_transcoded; + uint32_t state_flags; GST_DEBUG_OBJECT(pad, "mode %s, active %d.", gst_pad_mode_get_name(mode), active); @@ -879,14 +883,13 @@ static gboolean video_conv_src_active_mode(GstPad *pad, GstObject *parent, GstPa video_conv_init_transcode(conv); hash = state->transcode_hash; - need_stream_start = state->need_stream_start; - has_transcoded = state->has_transcoded; + state_flags = state->state_flags; /* push_event, below, can also grab state and cause a deadlock, so make sure it's * unlocked before calling */ pthread_mutex_unlock(&conv->state_mutex); - if (need_stream_start && active && has_transcoded) + if (active && !(state_flags & VIDEO_CONV_STREAM_STARTED) && (state_flags & VIDEO_CONV_HAS_TRANSCODED)) return video_conv_push_stream_start(conv, &hash); return true; } From 512bb1577b0a2327ff2d501d42dc44ca703e7659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 29 Mar 2024 15:17:07 +0100 Subject: [PATCH 1482/1506] winegstreamer/media-converter: Wrap around the blank video if shorter than upstream data. CW-Bug-Id: #22319 --- dlls/winegstreamer/media-converter/videoconv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index cf3f99fe7a2..3e2e17018f4 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -437,9 +437,7 @@ int video_conv_state_fill_buffer(struct video_conv_state *state, uint64_t offset } else /* Fill blank video data to buffer. */ { - /* Get copy size. */ - if (offset >= state->our_duration) - return CONV_OK; + offset = offset % state->our_duration; to_copy = min(state->our_duration - offset, size); /* Copy data. */ From b35f9cd3ae3ed0109463f94de84ffb07b868ea6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 29 Mar 2024 15:17:07 +0100 Subject: [PATCH 1483/1506] winegstreamer/media-converter: Use gst_util_uint64_scale_round to round upstream position. CW-Bug-Id: #22319 --- dlls/winegstreamer/media-converter/videoconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index 3e2e17018f4..32a097e2583 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -510,7 +510,7 @@ static uint64_t video_conv_duration_ours_to_upstream(VideoConv *conv, uint64_t p struct video_conv_state *state = conv->state; if (state->upstream_duration != DURATION_NONE && state->our_duration != DURATION_NONE) - return pos * state->upstream_duration / state->our_duration; + return gst_util_uint64_scale_round(pos, state->upstream_duration, state->our_duration); else return DURATION_NONE; } From 49dda8b7d462d5f702d71dc50a5f9bff8f01a424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 29 Mar 2024 15:17:07 +0100 Subject: [PATCH 1484/1506] winegstreamer/media-converter: Implement support for push mode in videoconv. CW-Bug-Id: #22319 --- .../winegstreamer/media-converter/videoconv.c | 334 +++++++++++++++++- 1 file changed, 319 insertions(+), 15 deletions(-) diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index 32a097e2583..99c451c4a17 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -59,6 +59,7 @@ #endif #include "media-converter.h" +#include #include @@ -92,6 +93,7 @@ enum video_conv_state_flags { VIDEO_CONV_STREAM_STARTED = 1, VIDEO_CONV_HAS_TRANSCODED = 2, + VIDEO_CONV_IS_DUMPING = 4, }; struct video_conv_state @@ -103,6 +105,8 @@ struct video_conv_state uint64_t our_duration; uint32_t transcoded_tag; uint32_t state_flags; + uint64_t read_offset; + GList *chunk_hashes; }; typedef struct @@ -111,6 +115,8 @@ typedef struct GstPad *sink_pad, *src_pad; pthread_mutex_t state_mutex; struct video_conv_state *state; + GstPadMode active_mode; + GstAdapter *adapter; } VideoConv; typedef struct @@ -388,6 +394,8 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay { GST_DEBUG("state %p, hash %s.", state, format_hash(hash)); + state->transcode_hash = *hash; + if (state->read_fozdb) { uint32_t entry_size; @@ -395,7 +403,6 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay if (fozdb_entry_size(state->read_fozdb, VIDEO_CONV_FOZ_TAG_MKVDATA, hash, &entry_size) == CONV_OK) { GST_DEBUG("Found an MKV video for hash %s.", format_hash(hash)); - state->transcode_hash = *hash; state->our_duration = entry_size; state->transcoded_tag = VIDEO_CONV_FOZ_TAG_MKVDATA; state->state_flags |= VIDEO_CONV_HAS_TRANSCODED; @@ -405,7 +412,6 @@ bool video_conv_state_begin_transcode(struct video_conv_state *state, struct pay if (fozdb_entry_size(state->read_fozdb, VIDEO_CONV_FOZ_TAG_OGVDATA, hash, &entry_size) == CONV_OK) { GST_DEBUG("Found an OGV video for hash %s.", format_hash(hash)); - state->transcode_hash = *hash; state->our_duration = entry_size; state->transcoded_tag = VIDEO_CONV_FOZ_TAG_OGVDATA; state->state_flags |= VIDEO_CONV_HAS_TRANSCODED; @@ -544,21 +550,63 @@ static bool video_conv_get_upstream_range(VideoConv *conv, uint64_t offset, uint return true; } +static uint64_t video_conv_duration_ours_to_downstream(VideoConv *conv, uint64_t pos) +{ + struct video_conv_state *state = conv->state; + + if (state->upstream_duration != DURATION_NONE && state->our_duration != DURATION_NONE) + return gst_util_uint64_scale_round(pos, state->our_duration, state->upstream_duration); + else + return DURATION_NONE; +} + +static bool video_conv_get_downstream_range(VideoConv *conv, uint64_t offset, uint32_t end, + uint64_t *downstream_offset, uint64_t *downstream_end) +{ + struct video_conv_state *state; + + if (!(state = video_conv_lock_state(conv))) + return false; + + if (state->upstream_duration == DURATION_NONE) + video_conv_query_upstream_duration(conv); + + *downstream_offset = video_conv_duration_ours_to_downstream(conv, offset); + *downstream_end = video_conv_duration_ours_to_downstream(conv, end); + + pthread_mutex_unlock(&conv->state_mutex); + + return true; +} + static bool video_conv_hash_upstream_data(VideoConv *conv, struct payload_hash *hash) { - struct pad_reader *reader; - bool ret; + bool ret = false; memset(hash, 0, sizeof(*hash)); - reader = pad_reader_create_with_stride(conv->sink_pad, HASH_STRIDE); - ret = murmur3_128(reader, pad_reader_read, HASH_SEED, hash); - pad_reader_release(reader); + if (conv->active_mode == GST_PAD_MODE_PUSH && gst_adapter_available(conv->adapter) > 0) + { + struct bytes_reader bytes_reader; + gsize read_size = gst_adapter_available(conv->adapter); + const void *buffer = gst_adapter_map(conv->adapter, read_size); + bytes_reader_init(&bytes_reader, buffer, read_size); + ret = murmur3_128(&bytes_reader, bytes_reader_read, HASH_SEED, hash); + gst_adapter_unmap(conv->adapter); + gst_adapter_clear(conv->adapter); + } + else if (gst_pad_activate_mode(conv->sink_pad, GST_PAD_MODE_PULL, true)) + { + struct pad_reader *reader = pad_reader_create_with_stride(conv->sink_pad, HASH_STRIDE); + ret = murmur3_128(reader, pad_reader_read, HASH_SEED, hash); + pad_reader_release(reader); + conv->active_mode = GST_PAD_MODE_PULL; + } return ret; } -static int video_conv_dump_upstream_chunk(VideoConv *conv, void *buffer, size_t read_size, +static int video_conv_dump_upstream_chunk(VideoConv *conv, const void *buffer, size_t read_size, GList **chunk_hashes) { struct bytes_reader bytes_reader; @@ -591,6 +639,12 @@ static int video_conv_dump_upstream_data(VideoConv *conv, struct payload_hash *h goto done; } + if (conv->active_mode == GST_PAD_MODE_PUSH) + { + conv->state->state_flags |= VIDEO_CONV_IS_DUMPING; + return 0; + } + buffer = calloc(1, HASH_CHUNK_SIZE); pad_reader = pad_reader_create(conv->sink_pad); while ((ret = pad_reader_read(pad_reader, buffer, HASH_CHUNK_SIZE, &read_size)) == CONV_OK) @@ -648,7 +702,24 @@ static void video_conv_init_transcode(VideoConv *conv) GST_WARNING("Failed to hash upstream data."); } - pthread_mutex_unlock(&dump_fozdb.mutex); + if (!(state->state_flags & VIDEO_CONV_IS_DUMPING)) + pthread_mutex_unlock(&dump_fozdb.mutex); +} + +static uint32_t video_conv_get_state_flags(VideoConv *conv) +{ + struct video_conv_state *state; + uint32_t state_flags; + + if (!(state = video_conv_lock_state(conv))) + { + GST_ERROR("VideoConv not yet in READY state?"); + return 0; + } + state_flags = state->state_flags; + pthread_mutex_unlock(&conv->state_mutex); + + return state_flags; } static gboolean video_conv_push_stream_start(VideoConv *conv, struct payload_hash *hash) @@ -700,19 +771,81 @@ static gboolean video_conv_sink_event_caps(VideoConv *conv, GstEvent *event) return false; } - if (!gst_pad_activate_mode(conv->sink_pad, GST_PAD_MODE_PULL, true)) + video_conv_init_transcode(conv); + transcode_tag = state->transcoded_tag; + + pthread_mutex_unlock(&conv->state_mutex); + + return video_conv_push_caps(conv, transcode_tag); +} + +static gboolean video_conv_sink_event_eos(VideoConv *conv, GstEvent *event) +{ + struct video_conv_state *state; + struct payload_hash hash; + uint32_t transcode_tag; + uint32_t state_flags; + int ret; + + gst_event_unref(event); + + if (!(state = video_conv_lock_state(conv))) + return false; + + if (state->state_flags & VIDEO_CONV_IS_DUMPING) { - GST_ERROR("Failed to activate sink pad in pull mode."); + struct hashes_reader chunk_hashes_reader; + gsize read_bytes; + + if ((read_bytes = gst_adapter_available(conv->adapter))) + { + const void *buffer = gst_adapter_map(conv->adapter, read_bytes); + + if ((ret = video_conv_dump_upstream_chunk(conv, buffer, read_bytes, &state->chunk_hashes)) < 0) + GST_ERROR("Error writing stream data to fozdb, ret %d.", ret); + + gst_adapter_unmap(conv->adapter); + gst_adapter_clear(conv->adapter); + } + + hashes_reader_init(&chunk_hashes_reader, state->chunk_hashes); + if ((ret = fozdb_write_entry(dump_fozdb.fozdb, VIDEO_CONV_FOZ_TAG_STREAM, &state->transcode_hash, + &chunk_hashes_reader, hashes_reader_read, true)) < 0) + GST_ERROR("Error writing stream data to fozdb, ret %d.", ret); + + if (state->chunk_hashes) + g_list_free_full(state->chunk_hashes, free); + + pthread_mutex_unlock(&dump_fozdb.mutex); + state->state_flags &= ~VIDEO_CONV_IS_DUMPING; pthread_mutex_unlock(&conv->state_mutex); - return false; + + return gst_pad_push_event(conv->src_pad, gst_event_new_eos()); } video_conv_init_transcode(conv); + hash = state->transcode_hash; + state_flags = state->state_flags; transcode_tag = state->transcoded_tag; pthread_mutex_unlock(&conv->state_mutex); - return video_conv_push_caps(conv, transcode_tag); + if (!(state_flags & VIDEO_CONV_STREAM_STARTED)) + { + /* rewind and start a new stream for dumping or playback */ + if (!push_event(conv->sink_pad, gst_event_new_seek(1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH, + GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, -1))) + return false; + if (!video_conv_push_stream_start(conv, &hash)) + return false; + if (!video_conv_push_caps(conv, transcode_tag)) + return false; + + /* return false to cancel upstream pads EOS event handling and avoid setting EOS flag */ + return false; + } + + return gst_pad_push_event(conv->src_pad, gst_event_new_eos()); } static gboolean video_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) @@ -723,8 +856,167 @@ static gboolean video_conv_sink_event(GstPad *pad, GstObject *parent, GstEvent * if (event->type == GST_EVENT_CAPS) return video_conv_sink_event_caps(conv, event); + if (event->type == GST_EVENT_EOS) + return video_conv_sink_event_eos(conv, event); + + if (video_conv_get_state_flags(conv) & VIDEO_CONV_STREAM_STARTED) + return gst_pad_event_default(pad, parent, event); + + gst_event_unref(event); + return true; +} + +static gboolean video_conv_src_event_seek(VideoConv *conv, GstEvent *event) +{ + guint seqnum = gst_event_get_seqnum(event); + guint64 upstream_offset, upstream_size; + GstSeekType offset_type, stop_type; + struct video_conv_state *state; + gint64 offset, stop; + GstSeekFlags flags; + GstFormat format; + gdouble rate; + + gst_event_parse_seek(event, &rate, &format, &flags, &offset_type, &offset, &stop_type, &stop); + gst_event_unref(event); + if (format != GST_FORMAT_BYTES) + return false; + + GST_TRACE("conv %p, rate %f, format %s, flags %#x, offset_type %u, cur %#" G_GINT64_MODIFIER "x, " + "stop_type %u, stop %#" G_GINT64_MODIFIER "x.", conv, rate, gst_format_get_name(format), + flags, offset_type, offset, stop_type, stop); + + if (!(state = video_conv_lock_state(conv))) + return GST_FLOW_ERROR; + if (state->state_flags & VIDEO_CONV_IS_DUMPING) + { + pthread_mutex_unlock(&conv->state_mutex); + return true; + } + pthread_mutex_unlock(&conv->state_mutex); + + if (!video_conv_get_upstream_range(conv, offset, HASH_CHUNK_SIZE, &upstream_offset, &upstream_size)) + return false; + + if ((event = gst_event_new_seek(1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH, + GST_SEEK_TYPE_SET, upstream_offset, GST_SEEK_TYPE_NONE, -1))) + gst_event_set_seqnum(event, seqnum); + return push_event(conv->sink_pad, event); +} + +static gboolean video_conv_src_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + VideoConv *conv = VIDEO_CONV(parent); + + GST_DEBUG_OBJECT(pad, "Got event %"GST_PTR_FORMAT".", event); + + if (event->type == GST_EVENT_SEEK) + return video_conv_src_event_seek(conv, event); + + if (video_conv_get_state_flags(conv) & VIDEO_CONV_STREAM_STARTED) + return gst_pad_event_default(pad, parent, event); + + gst_event_unref(event); + return true; +} + +static void video_conv_dump_buffered_chunks(VideoConv *conv, gsize bytes_available) +{ + struct video_conv_state *state = conv->state; + int ret; + + while (bytes_available >= HASH_CHUNK_SIZE) + { + const void *buffer = gst_adapter_map(conv->adapter, HASH_CHUNK_SIZE); + if ((ret = video_conv_dump_upstream_chunk(conv, buffer, HASH_CHUNK_SIZE, &state->chunk_hashes)) < 0) + { + pthread_mutex_unlock(&dump_fozdb.mutex); + state->state_flags &= ~VIDEO_CONV_IS_DUMPING; + break; + } + + gst_adapter_unmap(conv->adapter); + gst_adapter_flush(conv->adapter, HASH_CHUNK_SIZE); + bytes_available -= HASH_CHUNK_SIZE; + } +} + +static GstFlowReturn video_conv_sink_chain(GstPad *pad, GstObject *parent, GstBuffer *buffer) +{ + gsize buffer_size = gst_buffer_get_size(buffer), buffer_offset = GST_BUFFER_OFFSET(buffer); + uint64_t downstream_offset, downstream_end, seek_offset = -1; + VideoConv *conv = VIDEO_CONV(parent); + struct video_conv_state *state; + GstBuffer *transcoded = NULL; + uint32_t state_flags; + int ret = 0; + + GST_DEBUG_OBJECT(pad, "Got buffer %"GST_PTR_FORMAT".", buffer); + + if (!(state = video_conv_lock_state(conv))) + return GST_FLOW_ERROR; + state_flags = state->state_flags; + + if ((state_flags & VIDEO_CONV_IS_DUMPING) || !(state_flags & VIDEO_CONV_STREAM_STARTED)) + { + gsize bytes_available = gst_adapter_available(conv->adapter) + buffer_size; + gst_adapter_push(conv->adapter, buffer); + + if (state_flags & VIDEO_CONV_IS_DUMPING) + video_conv_dump_buffered_chunks(conv, bytes_available); + else if (!(bytes_available % HASH_CHUNK_SIZE) && bytes_available >= HASH_STRIDE) + { + state->read_offset += HASH_STRIDE; + seek_offset = state->read_offset; + } + } + + pthread_mutex_unlock(&conv->state_mutex); + + if (ret < 0) + { + GST_ERROR("Failed to dump or read transcoded buffer, error %d.", ret); + if (transcoded) + gst_buffer_unref(transcoded); + return GST_FLOW_ERROR; + } + + if (seek_offset != -1 && !push_event(pad, gst_event_new_seek(1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_FLUSH, + GST_SEEK_TYPE_SET, seek_offset, GST_SEEK_TYPE_NONE, -1))) + return GST_FLOW_ERROR; + if (!(state_flags & VIDEO_CONV_STREAM_STARTED)) + return GST_FLOW_OK; - return gst_pad_event_default(pad, parent, event); + if (!video_conv_get_downstream_range(conv, buffer_offset, buffer_offset + buffer_size, + &downstream_offset, &downstream_end)) + return GST_FLOW_ERROR; + + if (downstream_end == downstream_offset) + return GST_FLOW_OK; + if (!(transcoded = gst_buffer_new_and_alloc(downstream_end - downstream_offset))) + return GST_FLOW_ERROR; + else + { + GstBufferMapInfo map; + size_t fill_size = 0; + + if (gst_buffer_map(transcoded, &map, GST_MAP_READWRITE)) + { + ret = video_conv_state_fill_buffer(state, downstream_offset, map.data, map.size, &fill_size); + gst_buffer_unmap(transcoded, &map); + gst_buffer_set_size(transcoded, fill_size); + } + + if (gst_buffer_get_size(transcoded)) + { + GST_BUFFER_OFFSET(transcoded) = downstream_offset; + return gst_pad_push(conv->src_pad, transcoded); + } + + gst_buffer_unref(transcoded); + } + + return GST_FLOW_OK; } static GstFlowReturn video_conv_src_get_range(GstPad *pad, GstObject *parent, @@ -825,7 +1117,13 @@ static gboolean video_conv_src_query(GstPad *pad, GstObject *parent, GstQuery *q gst_query_unref(peer_query); gst_query_set_scheduling(query, flags, min, max, align); - gst_query_add_scheduling_mode(query, GST_PAD_MODE_PULL); + if (conv->active_mode != GST_PAD_MODE_NONE) + gst_query_add_scheduling_mode(query, conv->active_mode); + else + { + gst_query_add_scheduling_mode(query, GST_PAD_MODE_PULL); + gst_query_add_scheduling_mode(query, GST_PAD_MODE_PUSH); + } return true; @@ -870,6 +1168,7 @@ static gboolean video_conv_src_active_mode(GstPad *pad, GstObject *parent, GstPa return false; } + conv->active_mode = mode; if (mode != GST_PAD_MODE_PULL) return true; @@ -897,6 +1196,7 @@ static void video_conv_finalize(GObject *object) { VideoConv *conv = VIDEO_CONV(object); + gst_object_unref(conv->adapter); pthread_mutex_destroy(&conv->state_mutex); if (conv->state) video_conv_state_release(conv->state); @@ -928,9 +1228,11 @@ static void video_conv_init(VideoConv *conv) conv->sink_pad = gst_pad_new_from_static_template(&video_conv_sink_template, "sink"); gst_pad_set_event_function(conv->sink_pad, GST_DEBUG_FUNCPTR(video_conv_sink_event)); + gst_pad_set_chain_function(conv->sink_pad, GST_DEBUG_FUNCPTR(video_conv_sink_chain)); gst_element_add_pad(element, conv->sink_pad); conv->src_pad = gst_pad_new_from_static_template(&video_conv_src_template, "src"); + gst_pad_set_event_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_event)); gst_pad_set_getrange_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_get_range)); gst_pad_set_query_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_query)); gst_pad_set_activatemode_function(conv->src_pad, GST_DEBUG_FUNCPTR(video_conv_src_active_mode)); @@ -938,4 +1240,6 @@ static void video_conv_init(VideoConv *conv) pthread_mutex_init(&conv->state_mutex, NULL); conv->state = NULL; + conv->adapter = gst_adapter_new(); + conv->active_mode = GST_PAD_MODE_NONE; } From d7cbbc14773b2396df0dc499cca30d01a20a3c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 10:54:28 +0100 Subject: [PATCH 1485/1506] winegstreamer/media-converter: Wrap videoconv and a demuxer in a new protondemuxer bin. CW-Bug-Id: #22319 --- dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/media-converter/lib.c | 7 + .../media-converter/protondemuxer.c | 223 ++++++++++++++++++ .../winegstreamer/media-converter/videoconv.c | 2 +- 4 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 dlls/winegstreamer/media-converter/protondemuxer.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index ac38a1b8964..f76a7fb35f2 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -38,4 +38,5 @@ SOURCES = \ media-converter/fossilize.c \ media-converter/lib.c \ media-converter/murmur3.c \ + media-converter/protondemuxer.c \ media-converter/videoconv.c diff --git a/dlls/winegstreamer/media-converter/lib.c b/dlls/winegstreamer/media-converter/lib.c index 61d7fe8605e..4f7884c1178 100644 --- a/dlls/winegstreamer/media-converter/lib.c +++ b/dlls/winegstreamer/media-converter/lib.c @@ -26,6 +26,7 @@ GST_ELEMENT_REGISTER_DECLARE(protonvideoconverter); GST_ELEMENT_REGISTER_DECLARE(protonaudioconverter); GST_ELEMENT_REGISTER_DECLARE(protonaudioconverterbin); +GST_ELEMENT_REGISTER_DECLARE(protondemuxer); GST_DEBUG_CATEGORY(media_converter_debug); @@ -325,5 +326,11 @@ bool media_converter_init(void) return false; } + if (!GST_ELEMENT_REGISTER(protondemuxer, NULL)) + { + GST_ERROR("Failed to register protondemuxer."); + return false; + } + return true; } diff --git a/dlls/winegstreamer/media-converter/protondemuxer.c b/dlls/winegstreamer/media-converter/protondemuxer.c new file mode 100644 index 00000000000..9ab4be5ae3c --- /dev/null +++ b/dlls/winegstreamer/media-converter/protondemuxer.c @@ -0,0 +1,223 @@ +/* + * Copyright 2024 Remi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "media-converter.h" + +GST_DEBUG_CATEGORY_EXTERN(media_converter_debug); +#undef GST_CAT_DEFAULT +#define GST_CAT_DEFAULT media_converter_debug + +typedef struct +{ + GstBin bin; + GstElement *video_conv, *demuxer; + GstPad *sink_pad; /* Ghost pad. */ + GstPad *inner_sink, *inner_src; +} ProtonDemuxer; + +typedef struct +{ + GstBinClass class; +} ProtonDemuxerClass; + +G_DEFINE_TYPE(ProtonDemuxer, proton_demuxer, GST_TYPE_BIN); +#define PROTON_DEMUXER_TYPE (proton_demuxer_get_type()) +#define PROTON_DEMUXER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PROTON_DEMUXER_TYPE, ProtonDemuxer)) +GST_ELEMENT_REGISTER_DEFINE(protondemuxer, "protondemuxer", GST_RANK_MARGINAL, PROTON_DEMUXER_TYPE); + +static GstStaticPadTemplate proton_demuxer_sink_template = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, GST_STATIC_CAPS("video/x-ms-asf; video/x-msvideo; video/mpeg; video/quicktime;")); +static GstStaticPadTemplate proton_demuxer_src_template = GST_STATIC_PAD_TEMPLATE("src", GST_PAD_SRC, + GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); + +static gboolean proton_demuxer_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + GST_DEBUG_OBJECT(pad, "Got sink event %"GST_PTR_FORMAT".", event); + return gst_pad_event_default(pad, parent, event); +} + +static void proton_demuxer_pad_added(GstElement *element, GstPad *pad, gpointer user) +{ + ProtonDemuxer *bin = PROTON_DEMUXER(user); + GstPad *ghost_src; + GstEvent *event; + + GST_DEBUG_OBJECT(element, "Got inner pad added %"GST_PTR_FORMAT".", pad); + + ghost_src = gst_ghost_pad_new(GST_PAD_NAME(pad), pad); + gst_pad_set_active(ghost_src, true); + + if ((event = gst_pad_get_sticky_event(pad, GST_EVENT_STREAM_START, 0))) + { + gst_pad_store_sticky_event(ghost_src, event); + gst_event_unref(event); + } + + gst_element_add_pad(GST_ELEMENT(&bin->bin), ghost_src); +} + +static void proton_demuxer_no_more_pads(GstElement *element, gpointer user) +{ + ProtonDemuxer *bin = PROTON_DEMUXER(user); + GST_DEBUG_OBJECT(element, "Got inner no-more-pads."); + gst_element_no_more_pads(GST_ELEMENT(&bin->bin)); +} + +static GstFlowReturn proton_demuxer_inner_sink_chain(GstPad *pad, GstObject *parent, GstBuffer *buffer) +{ + ProtonDemuxer *bin = PROTON_DEMUXER(gst_pad_get_element_private(pad)); + GST_DEBUG_OBJECT(pad, "Got inner sink buffer %"GST_PTR_FORMAT".", buffer); + return gst_pad_push(bin->inner_src, buffer); +} + +static gboolean proton_demuxer_inner_sink_event_caps(ProtonDemuxer *bin, GstEvent *event) +{ + GstCaps *src_caps, *any_caps; + GstEvent *stream_start; + GstPad *src; + + gst_event_parse_caps(event, &src_caps); + + if (!bin->demuxer) + { + if (!(any_caps = gst_caps_new_any())) + return false; + if (!(bin->demuxer = find_element(GST_ELEMENT_FACTORY_TYPE_DECODABLE, src_caps, any_caps))) + { + gst_caps_unref(any_caps); + return false; + } + gst_caps_unref(any_caps); + g_signal_connect(bin->demuxer, "pad-added", G_CALLBACK(proton_demuxer_pad_added), bin); + g_signal_connect(bin->demuxer, "no-more-pads", G_CALLBACK(proton_demuxer_no_more_pads), bin); + + if ((src = gst_element_get_static_pad(bin->demuxer, "src"))) + { + GstPad *ghost_src = gst_ghost_pad_new_no_target_from_template(GST_PAD_NAME(src), + gst_element_get_pad_template(GST_ELEMENT(&bin->bin), "src")); + gst_ghost_pad_set_target(GST_GHOST_PAD(ghost_src), src); + gst_element_add_pad(GST_ELEMENT(&bin->bin), ghost_src); + gst_object_unref(src); + + gst_element_no_more_pads(GST_ELEMENT(&bin->bin)); + } + + gst_bin_add(GST_BIN(bin), bin->demuxer); + link_src_to_element(bin->inner_src, bin->demuxer); + gst_pad_set_active(bin->inner_src, true); + + if ((stream_start = gst_pad_get_sticky_event(bin->inner_sink, GST_EVENT_STREAM_START, 0))) + push_event(bin->inner_src, stream_start); + + gst_element_sync_state_with_parent(bin->demuxer); + } + + return gst_pad_push_event(bin->inner_src, event); +} + +static gboolean proton_demuxer_inner_sink_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + ProtonDemuxer *bin = PROTON_DEMUXER(gst_pad_get_element_private(pad)); + + GST_DEBUG_OBJECT(pad, "Got inner sink event %"GST_PTR_FORMAT".", event); + + if (event->type == GST_EVENT_CAPS) + return proton_demuxer_inner_sink_event_caps(bin, event); + if (!bin->demuxer) + return gst_pad_event_default(pad, parent, event); + if (event->type == GST_EVENT_STREAM_START) + { + GstEvent *stream_start; + if ((stream_start = gst_pad_get_sticky_event(bin->inner_src, GST_EVENT_STREAM_START, 0))) + push_event(bin->inner_src, stream_start); + return gst_pad_event_default(pad, parent, event); + } + + return gst_pad_push_event(bin->inner_src, event); +} + +static gboolean proton_demuxer_inner_src_query(GstPad *pad, GstObject *parent, GstQuery *query) +{ + ProtonDemuxer *bin = PROTON_DEMUXER(gst_pad_get_element_private(pad)); + + GST_DEBUG_OBJECT(pad, "Got inner src query %"GST_PTR_FORMAT".", query); + + if (!bin->demuxer) + return gst_pad_query_default(pad, parent, query); + return gst_pad_peer_query(bin->inner_sink, query); +} + +static gboolean proton_demuxer_inner_src_event(GstPad *pad, GstObject *parent, GstEvent *event) +{ + ProtonDemuxer *bin = PROTON_DEMUXER(gst_pad_get_element_private(pad)); + GST_DEBUG_OBJECT(pad, "Got inner src event %"GST_PTR_FORMAT".", event); + return gst_pad_push_event(bin->inner_sink, event); +} + +static void proton_demuxer_class_init(ProtonDemuxerClass * klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS(klass); + + /* wg_parser autoplugging ordering relies on the element "Proton video converter" name */ + gst_element_class_set_metadata(element_class, "Proton video converter", "Codec/Demuxer", "Demuxes video for Proton", + "Andrew Eikum , Ziqing Hui "); + + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&proton_demuxer_sink_template)); + gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&proton_demuxer_src_template)); +} + +static void proton_demuxer_init(ProtonDemuxer *bin) +{ + GstStaticPadTemplate inner_sink_template = GST_STATIC_PAD_TEMPLATE("inner-sink", + GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); + GstStaticPadTemplate inner_src_template = GST_STATIC_PAD_TEMPLATE("inner-src", + GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); + GstElement *element = GST_ELEMENT(bin); + GstPad *sink; + + bin->sink_pad = gst_ghost_pad_new_no_target_from_template("sink", gst_element_get_pad_template(element, "sink")); + gst_pad_set_event_function(bin->sink_pad, GST_DEBUG_FUNCPTR(proton_demuxer_sink_event)); + + bin->inner_sink = gst_pad_new_from_static_template(&inner_sink_template, "inner-sink"); + gst_pad_set_chain_function(bin->inner_sink, GST_DEBUG_FUNCPTR(proton_demuxer_inner_sink_chain)); + gst_pad_set_event_function(bin->inner_sink, GST_DEBUG_FUNCPTR(proton_demuxer_inner_sink_event)); + gst_pad_set_element_private(bin->inner_sink, bin); + + bin->inner_src = gst_pad_new_from_static_template(&inner_src_template, "inner-src"); + gst_pad_set_query_function(bin->inner_src, GST_DEBUG_FUNCPTR(proton_demuxer_inner_src_query)); + gst_pad_set_event_function(bin->inner_src, GST_DEBUG_FUNCPTR(proton_demuxer_inner_src_event)); + gst_pad_set_element_private(bin->inner_src, bin); + + bin->video_conv = create_element("protonvideoconverter", "protonmediaconverter"); + gst_bin_add(GST_BIN(bin), bin->video_conv); + link_element_to_sink(bin->video_conv, bin->inner_sink); + gst_pad_set_active(bin->inner_sink, true); + + sink = gst_element_get_static_pad(bin->video_conv, "sink"); + gst_ghost_pad_set_target(GST_GHOST_PAD(bin->sink_pad), sink); + gst_object_unref(sink); + + gst_element_add_pad(element, bin->sink_pad); + + GST_INFO("Initialized ProtonDemuxer %"GST_PTR_FORMAT": video_conv %"GST_PTR_FORMAT", demuxer %"GST_PTR_FORMAT", " + "sink_pad %"GST_PTR_FORMAT".", bin, bin->video_conv, bin->demuxer, bin->sink_pad); +} diff --git a/dlls/winegstreamer/media-converter/videoconv.c b/dlls/winegstreamer/media-converter/videoconv.c index 99c451c4a17..0f916b86f66 100644 --- a/dlls/winegstreamer/media-converter/videoconv.c +++ b/dlls/winegstreamer/media-converter/videoconv.c @@ -129,7 +129,7 @@ G_DEFINE_TYPE(VideoConv, video_conv, GST_TYPE_ELEMENT); #define VIDEO_CONV(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), VIDEO_CONV_TYPE, VideoConv)) #define parent_class (video_conv_parent_class) GST_ELEMENT_REGISTER_DEFINE(protonvideoconverter, "protonvideoconverter", - GST_RANK_MARGINAL, VIDEO_CONV_TYPE); + GST_RANK_MARGINAL + 1, VIDEO_CONV_TYPE); static GstStaticPadTemplate video_conv_sink_template = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, From 89965249df21413ab6efde5bb2b060f70d623d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 5 Mar 2024 22:23:44 +0100 Subject: [PATCH 1486/1506] winegstreamer/media-converter: Automatically add an audio decoder to protondemuxer. CW-Bug-Id: #22319 --- .../media-converter/protondemuxer.c | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/media-converter/protondemuxer.c b/dlls/winegstreamer/media-converter/protondemuxer.c index 9ab4be5ae3c..124d105ca46 100644 --- a/dlls/winegstreamer/media-converter/protondemuxer.c +++ b/dlls/winegstreamer/media-converter/protondemuxer.c @@ -58,13 +58,39 @@ static gboolean proton_demuxer_sink_event(GstPad *pad, GstObject *parent, GstEve static void proton_demuxer_pad_added(GstElement *element, GstPad *pad, gpointer user) { ProtonDemuxer *bin = PROTON_DEMUXER(user); - GstPad *ghost_src; + GstPad *ghost_src, *src_pad; + GstElement *decoder = NULL; GstEvent *event; + GstCaps *caps; GST_DEBUG_OBJECT(element, "Got inner pad added %"GST_PTR_FORMAT".", pad); - ghost_src = gst_ghost_pad_new(GST_PAD_NAME(pad), pad); - gst_pad_set_active(ghost_src, true); + if ((caps = gst_pad_get_current_caps(pad))) + { + const char *mime_type = gst_structure_get_name(gst_caps_get_structure(caps, 0)); + GST_DEBUG_OBJECT(element, "Got inner pad caps %"GST_PTR_FORMAT".", caps); + + if (!strcmp(mime_type, "audio/x-vorbis")) + decoder = create_element("vorbisdec", "base"); + else if (!strcmp(mime_type, "audio/x-opus")) + decoder = create_element("opusdec", "base"); + + gst_caps_unref(caps); + } + + if (!decoder) + ghost_src = gst_ghost_pad_new(GST_PAD_NAME(pad), pad); + else + { + gst_bin_add(GST_BIN(bin), decoder); + link_src_to_element(pad, decoder); + + src_pad = gst_element_get_static_pad(decoder, "src"); + ghost_src = gst_ghost_pad_new(GST_PAD_NAME(src_pad), src_pad); + gst_object_unref(src_pad); + + gst_element_sync_state_with_parent(decoder); + } if ((event = gst_pad_get_sticky_event(pad, GST_EVENT_STREAM_START, 0))) { @@ -72,6 +98,7 @@ static void proton_demuxer_pad_added(GstElement *element, GstPad *pad, gpointer gst_event_unref(event); } + gst_pad_set_active(ghost_src, true); gst_element_add_pad(GST_ELEMENT(&bin->bin), ghost_src); } From de8a5440be5d328f69475ffc6894972cf23693d9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 9 Apr 2024 11:56:54 +0300 Subject: [PATCH 1487/1506] HACK: winebuild: Include target arch in the hash used for timestamp. So that 32 and 64 bit PEs produce different values even if they have the same name. --- tools/winebuild/spec32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 6e3a0941310..26cb6878391 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -62,7 +62,7 @@ static unsigned int hash_filename( const char *name ) /* FNV-1 hash */ unsigned int ret = 2166136261u; while (*name) ret = (ret * 16777619) ^ *name++; - return ret; + return ret + target.cpu; } /* check if entry point needs a relay thunk */ From e0aaae1f1f8aec6c936715274e8907a8166903bb Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 5 Apr 2024 17:09:27 -0600 Subject: [PATCH 1488/1506] ntdll/tests: Add tests for CONTEXT_EXCEPTION_REQUEST. CW-Bug-Id: #23654 --- dlls/ntdll/tests/exception.c | 321 ++++++++++++++++++++++++++++++++-- dlls/ntdll/tests/ntdll_test.h | 2 + dlls/ntdll/tests/wow64.c | 14 +- include/winnt.h | 5 + 4 files changed, 322 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 3a15c1ac7ab..710bf19bd21 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -18,20 +18,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "ntdll_test.h" + #include -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "winnt.h" -#include "winreg.h" #include "winuser.h" -#include "winternl.h" #include "ddk/wdm.h" #include "excpt.h" -#include "wine/test.h" #include "intrin.h" static void *code_mem; @@ -284,6 +277,19 @@ static void test_debugger_xstate(HANDLE thread, CONTEXT *ctx, enum debugger_stag status = pNtSetContextThread(thread, xctx); ok(!status, "NtSetContextThread failed with 0x%lx\n", status); } + +#define check_context_exception_request( a, b ) check_context_exception_request_( a, b, __LINE__ ) +static void check_context_exception_request_( DWORD flags, BOOL hardware_exception, unsigned int line ) +{ + static const DWORD exception_reporting_flags = CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING + | CONTEXT_EXCEPTION_ACTIVE | CONTEXT_SERVICE_ACTIVE; + DWORD expected_flags = CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING; + + if (!(flags & CONTEXT_EXCEPTION_REPORTING)) return; + expected_flags |= hardware_exception ? CONTEXT_EXCEPTION_ACTIVE : CONTEXT_SERVICE_ACTIVE; + ok_(__FILE__, line)( (flags & exception_reporting_flags) == expected_flags, "got %#lx, expected %#lx.\n", + flags, expected_flags ); +} #endif #ifdef __i386__ @@ -1154,13 +1160,16 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) sizeof(stage), &size_read); ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status); - ctx.ContextFlags = CONTEXT_FULL | CONTEXT_EXTENDED_REGISTERS; + ctx.ContextFlags = CONTEXT_FULL | CONTEXT_EXTENDED_REGISTERS | CONTEXT_EXCEPTION_REQUEST; status = pNtGetContextThread(pi.hThread, &ctx); ok(!status, "NtGetContextThread failed with 0x%lx\n", status); + todo_wine ok(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING + || broken( !(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) ) /* Win7 WoW64 */, + "got %#lx.\n", ctx.ContextFlags); - trace("exception 0x%lx at %p firstchance=%ld Eip=0x%lx, Eax=0x%lx\n", + trace("exception 0x%lx at %p firstchance=%ld Eip=0x%lx, Eax=0x%lx ctx.ContextFlags %#lx\n", de.u.Exception.ExceptionRecord.ExceptionCode, - de.u.Exception.ExceptionRecord.ExceptionAddress, de.u.Exception.dwFirstChance, ctx.Eip, ctx.Eax); + de.u.Exception.ExceptionRecord.ExceptionAddress, de.u.Exception.dwFirstChance, ctx.Eip, ctx.Eax, ctx.ContextFlags); if (counter > 100) { @@ -1177,6 +1186,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) (char *)ctx.Eip < (char *)ntdll + nt->OptionalHeader.SizeOfImage, "wrong eip %p ntdll %p-%p\n", (void *)ctx.Eip, ntdll, (char *)ntdll + nt->OptionalHeader.SizeOfImage ); + check_context_exception_request( ctx.ContextFlags, TRUE ); } else { @@ -1190,6 +1200,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ctx.Eax = 0xf00f00f1; /* let the debuggee handle the exception */ continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, !is_wow64 ); } else if (stage == STAGE_RTLRAISE_HANDLE_LAST_CHANCE) { @@ -1226,6 +1237,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ctx.Eip, (char *)code_mem_address + 0xb); /* here we handle exception */ } + check_context_exception_request( ctx.ContextFlags, !is_wow64 ); } else if (stage == STAGE_SERVICE_CONTINUE || stage == STAGE_SERVICE_NOT_HANDLED) { @@ -1235,6 +1247,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) "expected Eip = %p, got 0x%lx\n", (char *)code_mem_address + 0x1d, ctx.Eip); if (stage == STAGE_SERVICE_NOT_HANDLED) continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, TRUE ); } else if (stage == STAGE_BREAKPOINT_CONTINUE || stage == STAGE_BREAKPOINT_NOT_HANDLED) { @@ -1244,6 +1257,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) "expected Eip = %p, got 0x%lx\n", (char *)code_mem_address + 2, ctx.Eip); if (stage == STAGE_BREAKPOINT_NOT_HANDLED) continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, TRUE ); } else if (stage == STAGE_EXCEPTION_INVHANDLE_CONTINUE || stage == STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED) { @@ -1254,14 +1268,17 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) "unexpected number of parameters %ld, expected 0\n", de.u.Exception.ExceptionRecord.NumberParameters); if (stage == STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED) continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, !is_wow64 ); } else if (stage == STAGE_NO_EXCEPTION_INVHANDLE_NOT_HANDLED) { ok(FALSE || broken(TRUE) /* < Win10 */, "should not throw exception\n"); continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, !is_wow64 ); } else if (stage == STAGE_XSTATE || stage == STAGE_XSTATE_LEGACY_SSE) { + check_context_exception_request( ctx.ContextFlags, TRUE ); test_debugger_xstate(pi.hThread, &ctx, stage); } else if (stage == STAGE_SEGMENTS) @@ -1282,6 +1299,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ok( !ctx.SegEs, "wrong es %04lx / %04lx\n", ctx.SegEs, ctx.SegSs ); ok( !ctx.SegGs, "wrong gs %04lx / %04lx\n", ctx.SegGs, ctx.SegSs ); } + check_context_exception_request( ctx.ContextFlags, TRUE ); } else ok(FALSE, "unexpected stage %u\n", stage); @@ -4052,9 +4070,10 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) sizeof(stage), &size_read); ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status); - ctx.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS; + ctx.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS | CONTEXT_EXCEPTION_REQUEST; status = pNtGetContextThread(pi.hThread, &ctx); ok(!status, "NtGetContextThread failed with 0x%lx\n", status); + todo_wine ok(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING, "got %#lx.\n", ctx.ContextFlags); trace("exception 0x%lx at %p firstchance=%ld Rip=%p, Rax=%p\n", de.u.Exception.ExceptionRecord.ExceptionCode, @@ -4076,6 +4095,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) (char *)ctx.Rip < (char *)ntdll + nt->OptionalHeader.SizeOfImage, "wrong rip %p ntdll %p-%p\n", (void *)ctx.Rip, ntdll, (char *)ntdll + nt->OptionalHeader.SizeOfImage ); + check_context_exception_request( ctx.ContextFlags, TRUE ); } else { @@ -4089,6 +4109,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ctx.Rax = 0xf00f00f1; /* let the debuggee handle the exception */ continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, FALSE ); } else if (stage == STAGE_RTLRAISE_HANDLE_LAST_CHANCE) { @@ -4117,6 +4138,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ctx.Rip, (char *)code_mem_address + 0x10); /* here we handle exception */ } + check_context_exception_request( ctx.ContextFlags, FALSE ); } else if (stage == STAGE_SERVICE_CONTINUE || stage == STAGE_SERVICE_NOT_HANDLED) { @@ -4125,6 +4147,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ok((char *)ctx.Rip == (char *)code_mem_address + 0x30, "expected Rip = %p, got %p\n", (char *)code_mem_address + 0x30, (char *)ctx.Rip); if (stage == STAGE_SERVICE_NOT_HANDLED) continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, TRUE ); } else if (stage == STAGE_BREAKPOINT_CONTINUE || stage == STAGE_BREAKPOINT_NOT_HANDLED) { @@ -4133,6 +4156,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ok((char *)ctx.Rip == (char *)code_mem_address + 2, "expected Rip = %p, got %p\n", (char *)code_mem_address + 2, (char *)ctx.Rip); if (stage == STAGE_BREAKPOINT_NOT_HANDLED) continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, TRUE ); } else if (stage == STAGE_EXCEPTION_INVHANDLE_CONTINUE || stage == STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED) { @@ -4143,14 +4167,17 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) "unexpected number of parameters %ld, expected 0\n", de.u.Exception.ExceptionRecord.NumberParameters); if (stage == STAGE_EXCEPTION_INVHANDLE_NOT_HANDLED) continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, FALSE ); } else if (stage == STAGE_NO_EXCEPTION_INVHANDLE_NOT_HANDLED) { ok(FALSE || broken(TRUE) /* < Win10 */, "should not throw exception\n"); continuestatus = DBG_EXCEPTION_NOT_HANDLED; + check_context_exception_request( ctx.ContextFlags, FALSE ); } else if (stage == STAGE_XSTATE || stage == STAGE_XSTATE_LEGACY_SSE) { + check_context_exception_request( ctx.ContextFlags, TRUE ); test_debugger_xstate(pi.hThread, &ctx, stage); } else if (stage == STAGE_SEGMENTS) @@ -4175,6 +4202,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ok( ctx.SegEs == ctx.SegSs, "wrong es %04x / %04x\n", ctx.SegEs, ctx.SegSs ); todo_wine ok( ctx.SegFs != ctx.SegSs, "wrong fs %04x / %04x\n", ctx.SegFs, ctx.SegSs ); ok( ctx.SegGs == ctx.SegSs, "wrong gs %04x / %04x\n", ctx.SegGs, ctx.SegSs ); + check_context_exception_request( ctx.ContextFlags, TRUE ); } else ok(FALSE, "unexpected stage %u\n", stage); @@ -4596,9 +4624,21 @@ static void test_wow64_context(void) ret = pRtlWow64GetThreadContext( pi.hThread, &ctx ); ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); ok( ctx.ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#lx\n", ctx.ContextFlags ); + + ctx.ContextFlags = WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST; + ret = pRtlWow64GetThreadContext( pi.hThread, &ctx ); + ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); + todo_wine ok( (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) || broken( ctx.ContextFlags == WOW64_CONTEXT_ALL ) /*Win 7*/, + "got context flags %#lx\n", ctx.ContextFlags ); + if (context.SegCs == cs32) { trace( "in 32-bit mode %04x\n", context.SegCs ); + if (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) + ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING) + || ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING + | CONTEXT_EXCEPTION_ACTIVE), + "got %#lx.\n", ctx.ContextFlags ); ok( ctx.Eip == context.Rip, "cs32: eip %08lx / %p\n", ctx.Eip, (void *)context.Rip ); ok( ctx.Ebp == context.Rbp, "cs32: ebp %08lx / %p\n", ctx.Ebp, (void *)context.Rbp ); ok( ctx.Esp == context.Rsp, "cs32: esp %08lx / %p\n", ctx.Esp, (void *)context.Rsp ); @@ -4673,6 +4713,12 @@ static void test_wow64_context(void) else { trace( "in 64-bit mode %04x\n", context.SegCs ); + if (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) + ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST + | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE) + || ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST + | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE), + "got %#lx.\n", ctx.ContextFlags ); ok( ctx.Eip != context.Rip, "cs64: eip %08lx / %p\n", ctx.Eip, (void *)context.Rip); ok( ctx.SegCs == cs32, "cs64: wrong cs %04lx / %04x\n", ctx.SegCs, cs32 ); ok( ctx.SegDs == context.SegDs, "cs64: wrong ds %04lx / %04x\n", ctx.SegDs, context.SegDs ); @@ -12341,6 +12387,254 @@ static void test_set_live_context(void) } #endif +struct context_exception_request_thread_param +{ + LONG volatile sync; + HANDLE event; +}; +static volatile int *p_context_exception_request_value; +struct context_exception_request_thread_param *context_exception_request_param; + +static LONG CALLBACK test_context_exception_request_handler( EXCEPTION_POINTERS *info ) +{ + PEXCEPTION_RECORD rec = info->ExceptionRecord; + CONTEXT *c = info->ContextRecord; + DWORD old_prot; + + ok( !(c->ContextFlags & (CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE + | CONTEXT_EXCEPTION_ACTIVE)), "got %#lx.\n", c->ContextFlags ); + + ok( rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION, "got %#lx.\n", rec->ExceptionCode ); + VirtualProtect( (void *)p_context_exception_request_value, sizeof(*p_context_exception_request_value), + PAGE_READWRITE, &old_prot ); + + WriteRelease( &context_exception_request_param->sync, 5 ); + while (ReadAcquire( &context_exception_request_param->sync ) != 6) + ; + + return EXCEPTION_CONTINUE_EXECUTION; +} + +static DWORD WINAPI test_context_exception_request_thread( void *arg ) +{ +#ifndef _WIN64 + static BYTE wait_sync_x64_code[] = + { + 0x89, 0x11, /* mov %edx,(%rcx) */ + 0x83, 0xc2, 0x01, /* add $0x1,%edx */ + 0x0f, 0x1f, 0x00, /* 1: nopl (%rax) */ + 0x8b, 0x01, /* mov (%rcx),%eax */ + 0x39, 0xd0, /* cmp %edx,%eax */ + 0x75, 0xfa, /* jne 1b */ + 0xc3, /* ret */ + }; + ULONG64 args[2]; +#endif + struct context_exception_request_thread_param *p = arg; + void *vectored_handler; + + context_exception_request_param = p; + vectored_handler = pRtlAddVectoredExceptionHandler( TRUE, test_context_exception_request_handler ); + ok( !!vectored_handler, "failed.\n" ); + + WriteRelease( &p->sync, 1 ); + while (ReadAcquire( &p->sync ) != 2) + ; + + WaitForSingleObject( p->event, INFINITE ); + +#ifndef _WIN64 + memcpy( (char *)code_mem + 1024, wait_sync_x64_code, sizeof(wait_sync_x64_code) ); + args[0] = (ULONG_PTR)&p->sync; + args[1] = 3; + if (is_wow64 && !old_wow64) call_func64( (ULONG64)(ULONG_PTR)code_mem + 1024, ARRAY_SIZE(args), args, code_mem ); +#endif + + p_context_exception_request_value = VirtualAlloc( NULL, sizeof(*p_context_exception_request_value), + MEM_RESERVE | MEM_COMMIT, PAGE_READONLY ); + ok( !!p_context_exception_request_value, "got NULL.\n" ); + *p_context_exception_request_value = 1; + ok( *p_context_exception_request_value == 1, "got %d.\n", *p_context_exception_request_value ); + VirtualFree( (void *)p_context_exception_request_value, 0, MEM_RELEASE ); + pRtlRemoveVectoredExceptionHandler( vectored_handler ); + +#ifndef _WIN64 + args[1] = 7; + if (is_wow64 && !old_wow64) call_func64( (ULONG64)(ULONG_PTR)code_mem + 1024, ARRAY_SIZE(args), args, code_mem ); +#endif + + return 0; +} + +static void test_context_exception_request(void) +{ + struct context_exception_request_thread_param p; + DWORD expected_flags; + HANDLE thread; + CONTEXT c; + BOOL ret; + + if (!pRtlAddVectoredExceptionHandler || !pRtlRemoveVectoredExceptionHandler) + { + skip( "RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found.\n" ); + return; + } + + c.ContextFlags = CONTEXT_CONTROL; + ret = GetThreadContext( GetCurrentThread(), &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + ok( c.ContextFlags == CONTEXT_CONTROL, "got %#lx.\n", c.ContextFlags ); + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( GetCurrentThread(), &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == 0x10001 ) /* Win7 WoW64 */, + "got %#lx.\n", c.ContextFlags ); + if (c.ContextFlags == 0x10001) + { + win_skip( "Old WoW64 behaviour, skipping tests.\n" ); + return; + } + + ret = DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &thread, 0, TRUE, DUPLICATE_SAME_ACCESS ); + ok( ret, "got error %lu.\n", GetLastError() ); + c.ContextFlags = expected_flags | CONTEXT_EXCEPTION_REQUEST; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + CloseHandle( thread ); + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE + | CONTEXT_EXCEPTION_ACTIVE; + ret = GetThreadContext( GetCurrentThread(), &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + p.event = CreateEventW( NULL, FALSE, FALSE, NULL ); + thread = CreateThread( NULL, 0, test_context_exception_request_thread, &p, CREATE_SUSPENDED, NULL ); + ok( !!thread, "got error %lu.\n", GetLastError() ); + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == (CONTEXT_CONTROL + | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING)) /* Win7 64 */, "got %#lx.\n", c.ContextFlags ); + + p.sync = 0; + ResumeThread(thread); + + while (ReadAcquire( &p.sync ) != 1) + SwitchToThread(); + /* thread is in user code. */ + SuspendThread( thread ); + + c.ContextFlags = CONTEXT_CONTROL; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + ok( c.ContextFlags == CONTEXT_CONTROL, "got %#lx.\n", c.ContextFlags ); + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE; + ret = SetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE + | CONTEXT_EXCEPTION_ACTIVE; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + ResumeThread(thread); + WriteRelease( &p.sync, 2 ); + /* Try to make sure the thread entered WaitForSingleObject(). */ + Sleep(30); + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + c.ContextFlags = CONTEXT_CONTROL; + ret = SetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE + | CONTEXT_EXCEPTION_ACTIVE; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + SetEvent( p.event ); + + if (is_wow64 && !old_wow64) + { + while (ReadAcquire( &p.sync ) != 3) + SwitchToThread(); + /* thread is in x64 code. */ + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags ); + + WriteRelease( &p.sync, 4 ); + } + + while (ReadAcquire( &p.sync ) != 5) + SwitchToThread(); + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE + | CONTEXT_EXCEPTION_ACTIVE; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + + WriteRelease( &p.sync, 6 ); + + if (is_wow64 && !old_wow64) + { + while (ReadAcquire( &p.sync ) != 7) + SwitchToThread(); + /* thread is in x64 code. */ + + expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; + + c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; + ret = GetThreadContext( thread, &c ); + ok( ret, "got error %lu.\n", GetLastError() ); + todo_wine ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags ); + + WriteRelease( &p.sync, 8 ); + } + + WaitForSingleObject( thread, INFINITE ); + CloseHandle( thread ); + CloseHandle( p.event ); +} + START_TEST(exception) { HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); @@ -12617,5 +12911,6 @@ START_TEST(exception) test_suspend_thread(); test_suspend_process(); test_unload_trace(); + test_context_exception_request(); VirtualFree(code_mem, 0, MEM_RELEASE); } diff --git a/dlls/ntdll/tests/ntdll_test.h b/dlls/ntdll/tests/ntdll_test.h index 67278358b29..ed824583870 100644 --- a/dlls/ntdll/tests/ntdll_test.h +++ b/dlls/ntdll/tests/ntdll_test.h @@ -30,3 +30,5 @@ #include "wine/test.h" #include "wine/heap.h" + +extern NTSTATUS call_func64( ULONG64 func64, int nb_args, ULONG64 *args, void *code_mem ); diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 01cd0cad035..1d48918165e 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -1440,7 +1440,7 @@ static const BYTE call_func64_code[] = 0xcb, /* lret */ }; -static NTSTATUS call_func64( ULONG64 func64, int nb_args, ULONG64 *args ) +NTSTATUS call_func64( ULONG64 func64, int nb_args, ULONG64 *args, void *code_mem ) { NTSTATUS (WINAPI *func)( ULONG64 func64, int nb_args, ULONG64 *args ) = code_mem; @@ -1940,7 +1940,7 @@ static void test_iosb(void) iosb64.Information = 0xdeadbeef; args[0] = (LONG_PTR)server; - status = call_func64( func, ARRAY_SIZE(args), args ); + status = call_func64( func, ARRAY_SIZE(args), args, code_mem ); ok( status == STATUS_PENDING, "NtFsControlFile returned %lx\n", status ); ok( iosb32.Status == 0x55555555, "status changed to %lx\n", iosb32.Status ); ok( iosb64.Pointer == PtrToUlong(&iosb32), "status changed to %lx\n", iosb64.Status ); @@ -1965,7 +1965,7 @@ static void test_iosb(void) args[8] = (ULONG_PTR)&id; args[9] = sizeof(id); - status = call_func64( func, ARRAY_SIZE(args), args ); + status = call_func64( func, ARRAY_SIZE(args), args, code_mem ); ok( status == STATUS_PENDING || status == STATUS_SUCCESS, "NtFsControlFile returned %lx\n", status ); todo_wine { @@ -1995,7 +1995,7 @@ static void test_iosb(void) id = 0xdeadbeef; args[0] = (LONG_PTR)server; - status = call_func64( func, ARRAY_SIZE(args), args ); + status = call_func64( func, ARRAY_SIZE(args), args, code_mem ); ok( status == STATUS_SUCCESS, "NtFsControlFile returned %lx\n", status ); ok( iosb32.Status == 0x55555555, "status changed to %lx\n", iosb32.Status ); ok( iosb32.Information == 0x55555555, "info changed to %Ix\n", iosb32.Information ); @@ -2018,7 +2018,7 @@ static NTSTATUS invoke_syscall( const char *name, ULONG args32[] ) else win_skip( "syscall thunk %s not recognized\n", name ); - return call_func64( func, ARRAY_SIZE(args64), args64 ); + return call_func64( func, ARRAY_SIZE(args64), args64, code_mem ); } static void test_syscalls(void) @@ -2124,14 +2124,14 @@ static void test_cpu_area(void) ULONG64 context, context_ex; ULONG64 args[] = { (ULONG_PTR)&machine, (ULONG_PTR)&context, (ULONG_PTR)&context_ex }; - status = call_func64( ptr, ARRAY_SIZE(args), args ); + status = call_func64( ptr, ARRAY_SIZE(args), args, code_mem ); ok( !status, "RtlWow64GetCpuAreaInfo failed %lx\n", status ); ok( machine == IMAGE_FILE_MACHINE_I386, "wrong machine %x\n", machine ); ok( context == teb64->TlsSlots[WOW64_TLS_CPURESERVED] + 4, "wrong context %s / %s\n", wine_dbgstr_longlong(context), wine_dbgstr_longlong(teb64->TlsSlots[WOW64_TLS_CPURESERVED]) ); ok( !context_ex, "got context_ex %s\n", wine_dbgstr_longlong(context_ex) ); args[0] = args[1] = args[2] = 0; - status = call_func64( ptr, ARRAY_SIZE(args), args ); + status = call_func64( ptr, ARRAY_SIZE(args), args, code_mem ); ok( !status, "RtlWow64GetCpuAreaInfo failed %lx\n", status ); } else win_skip( "RtlWow64GetCpuAreaInfo not supported\n" ); diff --git a/include/winnt.h b/include/winnt.h index 0f7c9430bfd..7f2a5f7b18b 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -1523,6 +1523,11 @@ typedef struct _CONTEXT_EX #endif } CONTEXT_EX, *PCONTEXT_EX; +#define CONTEXT_EXCEPTION_ACTIVE 0x08000000 +#define CONTEXT_SERVICE_ACTIVE 0x10000000 +#define CONTEXT_EXCEPTION_REQUEST 0x40000000 +#define CONTEXT_EXCEPTION_REPORTING 0x80000000 + #define CONTEXT_ARM 0x0200000 #define CONTEXT_ARM_CONTROL (CONTEXT_ARM | 0x00000001) #define CONTEXT_ARM_INTEGER (CONTEXT_ARM | 0x00000002) From bca6c4d6d4f84ffef60b59b4b7800abb0ede1a8e Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 9 Apr 2024 17:26:10 -0600 Subject: [PATCH 1489/1506] ntdll: Set exception reporting flags in NtGetContextThread(). CW-Bug-Id: #23654 --- dlls/ntdll/tests/exception.c | 8 ++++---- dlls/ntdll/unix/signal_arm.c | 1 + dlls/ntdll/unix/signal_arm64.c | 3 +++ dlls/ntdll/unix/signal_i386.c | 1 + dlls/ntdll/unix/signal_x86_64.c | 2 ++ dlls/ntdll/unix/unix_private.h | 11 +++++++++++ 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 710bf19bd21..d11850fd841 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -12490,8 +12490,8 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( GetCurrentThread(), &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == 0x10001 ) /* Win7 WoW64 */, - "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == 0x10001 ) /* Win7 WoW64 */, + "got %#lx.\n", c.ContextFlags ); if (c.ContextFlags == 0x10001) { win_skip( "Old WoW64 behaviour, skipping tests.\n" ); @@ -12505,14 +12505,14 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); CloseHandle( thread ); c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE; ret = GetThreadContext( GetCurrentThread(), &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); p.event = CreateEventW( NULL, FALSE, FALSE, NULL ); thread = CreateThread( NULL, 0, test_context_exception_request_thread, &p, CREATE_SUSPENDED, NULL ); diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c index afa3e71c5e2..56a897fcdd0 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -1033,6 +1033,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) memcpy( context->D, frame->d, sizeof(frame->d) ); context->ContextFlags |= CONTEXT_FLOATING_POINT; } + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); return STATUS_SUCCESS; } diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index 389f16f89d9..6785d56d7f2 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -710,6 +710,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) context->ContextFlags |= CONTEXT_FLOATING_POINT; } if (needed_flags & CONTEXT_DEBUG_REGISTERS) FIXME( "debug registers not supported\n" ); + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); return STATUS_SUCCESS; } @@ -917,6 +918,7 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) context->Dr7 = wow_frame->Dr7; } /* FIXME: CONTEXT_I386_XSTATE */ + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); break; } @@ -956,6 +958,7 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) memcpy( context->D, wow_frame->D, sizeof(wow_frame->D) ); context->ContextFlags |= CONTEXT_FLOATING_POINT; } + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); break; } diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index b87fc077602..876a683617f 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1168,6 +1168,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) x86_thread_data()->dr7 = context->Dr7; } } + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); } if (context->ContextFlags & (CONTEXT_INTEGER & ~CONTEXT_i386)) diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 453be6ca1b3..847ede602fc 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1213,6 +1213,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) amd64_thread_data()->dr7 = context->Dr7; } } + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); return STATUS_SUCCESS; } @@ -1415,6 +1416,7 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size ) frame->restore_flags |= CONTEXT_XSTATE; } } + set_context_exception_reporting_flags( &context->ContextFlags, CONTEXT_SERVICE_ACTIVE ); return STATUS_SUCCESS; } diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 967422d9288..97546ca1797 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -228,6 +228,17 @@ extern int server_pipe( int fd[2] ); extern void fpux_to_fpu( I386_FLOATING_SAVE_AREA *fpu, const XSAVE_FORMAT *fpux ); extern void fpu_to_fpux( XSAVE_FORMAT *fpux, const I386_FLOATING_SAVE_AREA *fpu ); +static inline void set_context_exception_reporting_flags( DWORD *context_flags, DWORD reporting_flag ) +{ + if (!(*context_flags & CONTEXT_EXCEPTION_REQUEST)) + { + *context_flags &= ~(CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE); + return; + } + *context_flags = (*context_flags & ~(CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE)) + | CONTEXT_EXCEPTION_REPORTING | reporting_flag; +} + extern BOOL xstate_compaction_enabled; extern UINT64 xstate_supported_features_mask; extern UINT64 xstate_features_size; From c989fa268c153486cad4b696ad49e8da93a0b0c0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 9 Apr 2024 17:35:56 -0600 Subject: [PATCH 1490/1506] ntdll: Store exception reporting flags in server context. CW-Bug-Id: #23654 --- dlls/ntdll/tests/exception.c | 18 ++++++------- dlls/ntdll/unix/server.c | 4 +++ dlls/ntdll/unix/thread.c | 50 +++++++++++++++++++++++++++++++++--- server/protocol.def | 13 ++++++++++ server/thread.c | 5 ++-- server/trace.c | 13 ++++++++++ tools/make_requests | 2 +- 7 files changed, 89 insertions(+), 16 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index d11850fd841..c7ba65795de 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -287,7 +287,7 @@ static void check_context_exception_request_( DWORD flags, BOOL hardware_excepti if (!(flags & CONTEXT_EXCEPTION_REPORTING)) return; expected_flags |= hardware_exception ? CONTEXT_EXCEPTION_ACTIVE : CONTEXT_SERVICE_ACTIVE; - ok_(__FILE__, line)( (flags & exception_reporting_flags) == expected_flags, "got %#lx, expected %#lx.\n", + todo_wine ok_(__FILE__, line)( (flags & exception_reporting_flags) == expected_flags, "got %#lx, expected %#lx.\n", flags, expected_flags ); } #endif @@ -1163,7 +1163,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ctx.ContextFlags = CONTEXT_FULL | CONTEXT_EXTENDED_REGISTERS | CONTEXT_EXCEPTION_REQUEST; status = pNtGetContextThread(pi.hThread, &ctx); ok(!status, "NtGetContextThread failed with 0x%lx\n", status); - todo_wine ok(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING + ok(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING || broken( !(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) ) /* Win7 WoW64 */, "got %#lx.\n", ctx.ContextFlags); @@ -4073,7 +4073,7 @@ static void test_debugger(DWORD cont_status, BOOL with_WaitForDebugEventEx) ctx.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS | CONTEXT_EXCEPTION_REQUEST; status = pNtGetContextThread(pi.hThread, &ctx); ok(!status, "NtGetContextThread failed with 0x%lx\n", status); - todo_wine ok(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING, "got %#lx.\n", ctx.ContextFlags); + ok(ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING, "got %#lx.\n", ctx.ContextFlags); trace("exception 0x%lx at %p firstchance=%ld Rip=%p, Rax=%p\n", de.u.Exception.ExceptionRecord.ExceptionCode, @@ -4628,7 +4628,7 @@ static void test_wow64_context(void) ctx.ContextFlags = WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST; ret = pRtlWow64GetThreadContext( pi.hThread, &ctx ); ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); - todo_wine ok( (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) || broken( ctx.ContextFlags == WOW64_CONTEXT_ALL ) /*Win 7*/, + ok( (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) || broken( ctx.ContextFlags == WOW64_CONTEXT_ALL ) /*Win 7*/, "got context flags %#lx\n", ctx.ContextFlags ); if (context.SegCs == cs32) @@ -4714,7 +4714,7 @@ static void test_wow64_context(void) { trace( "in 64-bit mode %04x\n", context.SegCs ); if (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) - ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST + todo_wine ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE) || ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE), @@ -12548,13 +12548,13 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); ResumeThread(thread); WriteRelease( &p.sync, 2 ); @@ -12604,13 +12604,13 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); WriteRelease( &p.sync, 6 ); diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 6148cfddce2..992e5cfdc3d 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -762,7 +762,11 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT if (ret == STATUS_USER_APC) *user_apc = reply_data.call.user; if (reply_size > sizeof(reply_data.call)) + { memcpy( context, reply_data.context, reply_size - sizeof(reply_data.call) ); + context[0].flags &= ~SERVER_CTX_EXEC_SPACE; + context[1].flags &= ~SERVER_CTX_EXEC_SPACE; + } return ret; } diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 812302bf346..65fa0aa9894 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -184,7 +184,7 @@ BOOL validate_context_xstate( CONTEXT *context ) */ static unsigned int get_server_context_flags( const void *context, USHORT machine ) { - unsigned int flags, ret = 0; + unsigned int flags = 0, ret = 0; switch (machine) { @@ -222,6 +222,7 @@ static unsigned int get_server_context_flags( const void *context, USHORT machin if (flags & CONTEXT_ARM64_DEBUG_REGISTERS) ret |= SERVER_CTX_DEBUG_REGISTERS; break; } + if (flags & CONTEXT_EXCEPTION_REQUEST) ret |= SERVER_CTX_EXEC_SPACE; return ret; } @@ -236,11 +237,11 @@ static unsigned int get_native_context_flags( USHORT native_machine, USHORT wow_ switch (MAKELONG( native_machine, wow_machine )) { case MAKELONG( IMAGE_FILE_MACHINE_AMD64, IMAGE_FILE_MACHINE_I386 ): - return SERVER_CTX_DEBUG_REGISTERS | SERVER_CTX_FLOATING_POINT | SERVER_CTX_YMM_REGISTERS; + return SERVER_CTX_DEBUG_REGISTERS | SERVER_CTX_FLOATING_POINT | SERVER_CTX_YMM_REGISTERS | SERVER_CTX_EXEC_SPACE; case MAKELONG( IMAGE_FILE_MACHINE_ARM64, IMAGE_FILE_MACHINE_ARMNT ): - return SERVER_CTX_DEBUG_REGISTERS | SERVER_CTX_FLOATING_POINT; + return SERVER_CTX_DEBUG_REGISTERS | SERVER_CTX_FLOATING_POINT | SERVER_CTX_EXEC_SPACE; default: - return 0; + return SERVER_CTX_EXEC_SPACE; } } @@ -260,6 +261,21 @@ static void xstate_to_server( context_t *to, const CONTEXT_EX *xctx ) } +/*********************************************************************** + * exception_request_flags_to_server + * + * Copy exception reporting flags to the server format. + */ +static void exception_request_flags_to_server( context_t *to, DWORD context_flags ) +{ + if (!(context_flags & CONTEXT_EXCEPTION_REPORTING)) return; + to->flags |= SERVER_CTX_EXEC_SPACE; + if (context_flags & CONTEXT_SERVICE_ACTIVE) to->exec_space.space.space = EXEC_SPACE_SYSCALL; + else if (context_flags & CONTEXT_EXCEPTION_ACTIVE) to->exec_space.space.space = EXEC_SPACE_EXCEPTION; + else to->exec_space.space.space = EXEC_SPACE_USERMODE; +} + + /*********************************************************************** * context_to_server * @@ -337,6 +353,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void } if (flags & CONTEXT_I386_XSTATE) xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); + exception_request_flags_to_server( to, flags ); return STATUS_SUCCESS; } @@ -395,6 +412,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void } if (flags & CONTEXT_I386_XSTATE) xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); + exception_request_flags_to_server( to, flags ); return STATUS_SUCCESS; } @@ -456,6 +474,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void } if (flags & CONTEXT_AMD64_XSTATE) xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); + exception_request_flags_to_server( to, flags ); return STATUS_SUCCESS; } @@ -521,6 +540,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void } if (flags & CONTEXT_AMD64_XSTATE) xstate_to_server( to, (const CONTEXT_EX *)(from + 1) ); + exception_request_flags_to_server( to, flags ); return STATUS_SUCCESS; } @@ -568,6 +588,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void for (i = 0; i < ARM_MAX_WATCHPOINTS; i++) to->debug.arm_regs.wvr[i] = from->Wvr[i]; for (i = 0; i < ARM_MAX_WATCHPOINTS; i++) to->debug.arm_regs.wcr[i] = from->Wcr[i]; } + exception_request_flags_to_server( to, flags ); return STATUS_SUCCESS; } @@ -609,6 +630,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void for (i = 0; i < ARM64_MAX_WATCHPOINTS; i++) to->debug.arm64_regs.wcr[i] = from->Wcr[i]; for (i = 0; i < ARM64_MAX_WATCHPOINTS; i++) to->debug.arm64_regs.wvr[i] = from->Wvr[i]; } + exception_request_flags_to_server( to, flags ); return STATUS_SUCCESS; } @@ -650,6 +672,20 @@ static void xstate_from_server( CONTEXT_EX *xctx, const context_t *from ) } +/*********************************************************************** + * exception_request_flags_from_server + * + * Copy exception reporting flags from the server format. + */ +static void exception_request_flags_from_server( DWORD *context_flags, const context_t *from ) +{ + if (!(*context_flags & CONTEXT_EXCEPTION_REQUEST) || !(from->flags & SERVER_CTX_EXEC_SPACE)) return; + *context_flags = (*context_flags & ~(CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE)) | CONTEXT_EXCEPTION_REPORTING; + if (from->exec_space.space.space == EXEC_SPACE_SYSCALL) *context_flags |= CONTEXT_SERVICE_ACTIVE; + else if (from->exec_space.space.space == EXEC_SPACE_EXCEPTION) *context_flags |= CONTEXT_EXCEPTION_ACTIVE; +} + + /*********************************************************************** * context_from_server * @@ -724,6 +760,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_I386_XSTATE)) xstate_from_server( (CONTEXT_EX *)(to + 1), from ); + exception_request_flags_from_server( &to->ContextFlags, from ); return STATUS_SUCCESS; } @@ -785,6 +822,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_I386_XSTATE)) xstate_from_server( (CONTEXT_EX *)(to + 1), from ); + exception_request_flags_from_server( &to->ContextFlags, from ); return STATUS_SUCCESS; } @@ -847,6 +885,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_AMD64_XSTATE)) xstate_from_server( (CONTEXT_EX *)(to + 1), from ); + exception_request_flags_from_server( &to->ContextFlags, from ); return STATUS_SUCCESS; } @@ -916,6 +955,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma } if ((from->flags & SERVER_CTX_YMM_REGISTERS) && (to_flags & CONTEXT_AMD64_XSTATE)) xstate_from_server( (CONTEXT_EX *)(to + 1), from ); + exception_request_flags_from_server( &to->ContextFlags, from ); return STATUS_SUCCESS; } @@ -963,6 +1003,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma for (i = 0; i < ARM_MAX_WATCHPOINTS; i++) to->Wvr[i] = from->debug.arm_regs.wvr[i]; for (i = 0; i < ARM_MAX_WATCHPOINTS; i++) to->Wcr[i] = from->debug.arm_regs.wcr[i]; } + exception_request_flags_from_server( &to->ContextFlags, from ); return STATUS_SUCCESS; } @@ -1004,6 +1045,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma for (i = 0; i < ARM64_MAX_WATCHPOINTS; i++) to->Wcr[i] = from->debug.arm64_regs.wcr[i]; for (i = 0; i < ARM64_MAX_WATCHPOINTS; i++) to->Wvr[i] = from->debug.arm64_regs.wvr[i]; } + exception_request_flags_from_server( &to->ContextFlags, from ); return STATUS_SUCCESS; } diff --git a/server/protocol.def b/server/protocol.def index ac14467f330..99396170aef 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -125,6 +125,14 @@ typedef union } unload_dll; } debug_event_t; + +enum context_exec_space +{ + EXEC_SPACE_USERMODE, + EXEC_SPACE_SYSCALL, + EXEC_SPACE_EXCEPTION, +}; + /* context data */ typedef struct { @@ -171,6 +179,10 @@ typedef struct unsigned char i386_regs[512]; } ext; /* selected by SERVER_CTX_EXTENDED_REGISTERS */ union + { + struct { enum context_exec_space space; int __pad; } space; + } exec_space; /* selected by SERVER_CTX_EXEC_SPACE */ + union { struct { struct { unsigned __int64 low, high; } ymm_high[16]; } regs; } ymm; /* selected by SERVER_CTX_YMM_REGISTERS */ @@ -183,6 +195,7 @@ typedef struct #define SERVER_CTX_DEBUG_REGISTERS 0x10 #define SERVER_CTX_EXTENDED_REGISTERS 0x20 #define SERVER_CTX_YMM_REGISTERS 0x40 +#define SERVER_CTX_EXEC_SPACE 0x80 /* structure used in sending an fd from client to server */ struct send_fd diff --git a/server/thread.c b/server/thread.c index e54e83c178a..0620686399d 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1564,6 +1564,7 @@ static void copy_context( context_t *to, const context_t *from, unsigned int fla if (flags & SERVER_CTX_DEBUG_REGISTERS) to->debug = from->debug; if (flags & SERVER_CTX_EXTENDED_REGISTERS) to->ext = from->ext; if (flags & SERVER_CTX_YMM_REGISTERS) to->ymm = from->ymm; + if (flags & SERVER_CTX_EXEC_SPACE) to->exec_space = from->exec_space; } /* gets the current impersonation token */ @@ -2224,14 +2225,14 @@ DECL_HANDLER(set_thread_context) /* If context is in a pending state, we don't know if we will use WoW or native * context, so store both and discard irrevelant one in select request. */ const int is_pending = thread->context->status == STATUS_PENDING; - unsigned int native_flags = contexts[CTX_NATIVE].flags; + unsigned int native_flags = contexts[CTX_NATIVE].flags & ~SERVER_CTX_EXEC_SPACE; if (ctx_count == 2 && (is_pending || thread->context->regs[CTX_WOW].machine)) { context_t *ctx = &thread->context->regs[CTX_WOW]; /* some regs are always set from the native context */ - flags = contexts[CTX_WOW].flags & ~req->native_flags; + flags = contexts[CTX_WOW].flags & ~(req->native_flags | SERVER_CTX_EXEC_SPACE); if (is_pending) ctx->machine = contexts[CTX_WOW].machine; else native_flags &= req->native_flags; diff --git a/server/trace.c b/server/trace.c index 313a4541a1a..a44836e6543 100644 --- a/server/trace.c +++ b/server/trace.c @@ -840,6 +840,19 @@ static void dump_varargs_context( const char *prefix, data_size_t size ) fprintf( stderr, "%s{machine=%04x", prefix, ctx.machine ); break; } + if (ctx.flags & SERVER_CTX_EXEC_SPACE) + { + const char *space; + + switch (ctx.exec_space.space.space) + { + case EXEC_SPACE_USERMODE: space = "user"; break; + case EXEC_SPACE_SYSCALL: space = "syscall"; break; + case EXEC_SPACE_EXCEPTION: space = "exception"; break; + default: space = "invalid"; break; + } + fprintf( stderr, ",exec_space=%s", space ); + } fputc( '}', stderr ); remove_data( size ); } diff --git a/tools/make_requests b/tools/make_requests index 77b5ab331f4..b450e22c2b8 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -54,7 +54,7 @@ my %formats = "hw_input_t" => [ 40, 8, "&dump_hw_input" ], # varargs-only structures "apc_call_t" => [ 64, 8 ], - "context_t" => [ 1720, 8 ], + "context_t" => [ 1728, 8 ], "cursor_pos_t" => [ 24, 8 ], "debug_event_t" => [ 160, 8 ], "message_data_t" => [ 56, 8 ], From 00eb20380a50d5ec2616b2b96f2ccf2c32e1412c Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 9 Apr 2024 18:00:11 -0600 Subject: [PATCH 1491/1506] ntdll: Store exception reporting flags on suspend. CW-Bug-Id: #23654 --- dlls/ntdll/tests/exception.c | 10 +++++----- dlls/ntdll/unix/signal_arm.c | 9 +++++++-- dlls/ntdll/unix/signal_arm64.c | 9 +++++++-- dlls/ntdll/unix/signal_i386.c | 4 +++- dlls/ntdll/unix/signal_x86_64.c | 6 ++++-- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index c7ba65795de..5b0d0662fbb 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -4714,7 +4714,7 @@ static void test_wow64_context(void) { trace( "in 64-bit mode %04x\n", context.SegCs ); if (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) - todo_wine ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST + ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE) || ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE), @@ -12523,8 +12523,8 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == (CONTEXT_CONTROL - | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING)) /* Win7 64 */, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == (CONTEXT_CONTROL + | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING)) /* Win7 64 */, "got %#lx.\n", c.ContextFlags ); p.sync = 0; ResumeThread(thread); @@ -12566,7 +12566,7 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); c.ContextFlags = CONTEXT_CONTROL; ret = SetThreadContext( thread, &c ); @@ -12576,7 +12576,7 @@ static void test_context_exception_request(void) | CONTEXT_EXCEPTION_ACTIVE; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); + ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags ); SetEvent( p.event ); diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c index 56a897fcdd0..0484e57eb8c 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -1525,7 +1525,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) if (is_inside_syscall( sigcontext )) { - context.ContextFlags = CONTEXT_FULL; + context.ContextFlags = CONTEXT_FULL | CONTEXT_EXCEPTION_REQUEST; NtGetContextThread( GetCurrentThread(), &context ); wait_suspend( &context ); NtSetContextThread( GetCurrentThread(), &context ); @@ -1533,6 +1533,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) else { save_context( &context, sigcontext ); + context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING; wait_suspend( &context ); restore_context( &context, sigcontext ); } @@ -1639,7 +1640,11 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB if (context.Pc & 1) context.Cpsr |= 0x20; /* thumb mode */ if ((ctx = get_cpu_area( IMAGE_FILE_MACHINE_ARMNT ))) *ctx = context; - if (suspend) wait_suspend( &context ); + if (suspend) + { + context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; + wait_suspend( &context ); + } ctx = (CONTEXT *)((ULONG_PTR)context.Sp & ~15) - 1; *ctx = context; diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index 6785d56d7f2..5afc2cc2b91 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -1494,7 +1494,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) if (is_inside_syscall( sigcontext )) { - context.ContextFlags = CONTEXT_FULL; + context.ContextFlags = CONTEXT_FULL | CONTEXT_EXCEPTION_REQUEST; NtGetContextThread( GetCurrentThread(), &context ); wait_suspend( &context ); NtSetContextThread( GetCurrentThread(), &context ); @@ -1502,6 +1502,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) else { save_context( &context, sigcontext ); + context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING; wait_suspend( &context ); restore_context( &context, sigcontext ); } @@ -1687,7 +1688,11 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB if (arm_context->Pc & 1) arm_context->Cpsr |= 0x20; /* thumb mode */ } - if (suspend) wait_suspend( &context ); + if (suspend) + { + context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; + wait_suspend( &context ); + } ctx = (CONTEXT *)((ULONG_PTR)context.Sp & ~15) - 1; *ctx = context; diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 876a683617f..61df990ce61 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -2159,7 +2159,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ERR_(seh)( "kernel stack overflow.\n" ); return; } - context->c.ContextFlags = CONTEXT_FULL; + context->c.ContextFlags = CONTEXT_FULL | CONTEXT_EXCEPTION_REQUEST; NtGetContextThread( GetCurrentThread(), &context->c ); if (xstate_extended_features()) { @@ -2182,6 +2182,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) struct xcontext context; save_context( &context, ucontext ); + context.c.ContextFlags |= CONTEXT_EXCEPTION_REPORTING; wait_suspend( &context.c ); restore_context( &context, ucontext ); } @@ -2551,6 +2552,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB if (suspend) { + context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; wait_suspend( &context ); if (context.ContextFlags & CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386) { diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 847ede602fc..c4790a00b47 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2516,7 +2516,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ERR_(seh)( "kernel stack overflow.\n" ); return; } - context->c.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS; + context->c.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS | CONTEXT_EXCEPTION_REQUEST; NtGetContextThread( GetCurrentThread(), &context->c ); if (xstate_extended_features()) { @@ -2539,6 +2539,8 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) struct xcontext context; save_context( &context, ucontext ); + context.c.ContextFlags |= CONTEXT_EXCEPTION_REPORTING; + if (is_wow64() && context.c.SegCs == cs64_sel) context.c.ContextFlags |= CONTEXT_EXCEPTION_ACTIVE; wait_suspend( &context.c ); restore_context( &context, ucontext ); } @@ -2885,7 +2887,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB # error Please define setting %gs for your architecture #endif - context.ContextFlags = CONTEXT_ALL; + context.ContextFlags = CONTEXT_ALL | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE; context.Rcx = (ULONG_PTR)entry; context.Rdx = (ULONG_PTR)arg; context.Rsp = (ULONG_PTR)teb->Tib.StackBase - 0x28; From 1875b212f0ad43379006e14e462469ee3d492234 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 8 Apr 2024 10:47:02 -0600 Subject: [PATCH 1492/1506] ntdll: Store exception reporting flags for debug events. CW-Bug-Id: #23654 --- dlls/ntdll/tests/exception.c | 6 +++--- dlls/ntdll/unix/signal_arm.c | 2 +- dlls/ntdll/unix/signal_arm64.c | 2 +- dlls/ntdll/unix/signal_i386.c | 2 +- dlls/ntdll/unix/signal_x86_64.c | 2 +- dlls/ntdll/unix/thread.c | 6 ++++-- dlls/ntdll/unix/unix_private.h | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 5b0d0662fbb..1d1c9697713 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -287,7 +287,7 @@ static void check_context_exception_request_( DWORD flags, BOOL hardware_excepti if (!(flags & CONTEXT_EXCEPTION_REPORTING)) return; expected_flags |= hardware_exception ? CONTEXT_EXCEPTION_ACTIVE : CONTEXT_SERVICE_ACTIVE; - todo_wine ok_(__FILE__, line)( (flags & exception_reporting_flags) == expected_flags, "got %#lx, expected %#lx.\n", + ok_(__FILE__, line)( (flags & exception_reporting_flags) == expected_flags, "got %#lx, expected %#lx.\n", flags, expected_flags ); } #endif @@ -12591,7 +12591,7 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags ); + ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags ); WriteRelease( &p.sync, 4 ); } @@ -12625,7 +12625,7 @@ static void test_context_exception_request(void) c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST; ret = GetThreadContext( thread, &c ); ok( ret, "got error %lu.\n", GetLastError() ); - todo_wine ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags ); + ok( c.ContextFlags == expected_flags, "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags ); WriteRelease( &p.sync, 8 ); } diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c index 0484e57eb8c..dbad562c6d3 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -1071,7 +1071,7 @@ static void setup_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec ) rec->ExceptionAddress = (void *)PC_sig(sigcontext); save_context( &context, sigcontext ); - status = send_debug_event( rec, &context, TRUE ); + status = send_debug_event( rec, &context, TRUE, TRUE ); if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED) { restore_context( &context, sigcontext ); diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index 5afc2cc2b91..a4bae5563a8 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -982,7 +982,7 @@ static void setup_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec ) rec->ExceptionAddress = (void *)PC_sig(sigcontext); save_context( &context, sigcontext ); - status = send_debug_event( rec, &context, TRUE ); + status = send_debug_event( rec, &context, TRUE, TRUE ); if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED) { restore_context( &context, sigcontext ); diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 61df990ce61..faf09c05371 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1465,7 +1465,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, void *stack_ptr, struct exc_stack_layout *stack; size_t stack_size; unsigned int xstate_size; - NTSTATUS status = send_debug_event( rec, context, TRUE ); + NTSTATUS status = send_debug_event( rec, context, TRUE, TRUE ); if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED) { diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index c4790a00b47..be9af2c23d1 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1451,7 +1451,7 @@ static void setup_raise_exception( ucontext_t *sigcontext, EXCEPTION_RECORD *rec context->EFlags &= ~0x100; /* clear single-step flag */ } - status = send_debug_event( rec, context, TRUE ); + status = send_debug_event( rec, context, TRUE, TRUE ); if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED) { restore_context( xcontext, sigcontext ); diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 65fa0aa9894..c3ab1317295 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1506,7 +1506,7 @@ void wait_suspend( CONTEXT *context ) * * Send an EXCEPTION_DEBUG_EVENT event to the debugger. */ -NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ) +NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance, BOOL exception ) { unsigned int ret; DWORD i; @@ -1543,6 +1543,8 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_c select_op.wait.handles[0] = handle; contexts_to_server( server_contexts, context ); + server_contexts[0].flags |= SERVER_CTX_EXEC_SPACE; + server_contexts[0].exec_space.space.space = exception ? EXEC_SPACE_EXCEPTION : EXEC_SPACE_SYSCALL; server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, server_contexts, NULL ); @@ -1565,7 +1567,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_c */ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ) { - NTSTATUS status = send_debug_event( rec, context, first_chance ); + NTSTATUS status = send_debug_event( rec, context, first_chance, !(is_win64 || is_wow64() || is_old_wow64()) ); if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED) return NtContinue( context, FALSE ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 97546ca1797..2b62d5c7754 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -257,7 +257,7 @@ extern void DECLSPEC_NORETURN abort_thread( int status ); extern void DECLSPEC_NORETURN abort_process( int status ); extern void DECLSPEC_NORETURN exit_process( int status ); extern void wait_suspend( CONTEXT *context ); -extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance ); +extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_chance, BOOL exception ); extern BOOL validate_context_xstate( CONTEXT *context ); extern NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *self, USHORT machine ); extern NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT machine ); From d1b39200a3ff39607a7a3341405b0b3656082705 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 9 Apr 2024 20:36:26 -0600 Subject: [PATCH 1493/1506] Revert "ntdll: Add WINE_DISABLE_WRITE_WATCH env var to disable write watch support." This reverts commit 60b7ce66f2d4c96240dd8baf8e0e9110d4ebd14b. CW-Bug-Id: #23654 --- dlls/ntdll/unix/virtual.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index b4d0cec3a21..6c1dc3a8b88 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4998,22 +4998,6 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ SIZE_T size = *size_ptr; NTSTATUS status = STATUS_SUCCESS; - if (type & MEM_WRITE_WATCH) - { - static int disable = -1; - - if (disable == -1) - { - const char *env_var; - - if ((disable = (env_var = getenv("WINE_DISABLE_WRITE_WATCH")) && atoi(env_var))) - FIXME("Disabling write watch support.\n"); - } - - if (disable) - return STATUS_NOT_SUPPORTED; - } - /* Round parameters to a page boundary */ if (is_beyond_limit( 0, size, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE; From 9f5933b8b2c9654ac00625acadf1b06af6938df7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 19 Jan 2024 13:42:14 +0100 Subject: [PATCH 1494/1506] winevulkan: Return result through NtCallbackReturn for the debug callbacks. (cherry picked from commit 643538a836f33b4996730cf05dc2af77667d6150) --- dlls/winevulkan/loader.c | 14 +++++++++----- dlls/winevulkan/vulkan.c | 13 ++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index dbb44c556f6..e35b4f42427 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -625,15 +625,19 @@ void WINAPI vkFreeCommandBuffers(VkDevice device, VkCommandPool cmd_pool, uint32 } } -static BOOL WINAPI call_vulkan_debug_report_callback( struct wine_vk_debug_report_params *params, ULONG size ) +static NTSTATUS WINAPI call_vulkan_debug_report_callback( void *args, ULONG size ) { - return params->user_callback(params->flags, params->object_type, params->object_handle, params->location, - params->code, params->layer_prefix, params->message, params->user_data); + struct wine_vk_debug_report_params *params = args; + VkBool32 ret = params->user_callback(params->flags, params->object_type, params->object_handle, params->location, + params->code, params->layer_prefix, params->message, params->user_data); + return NtCallbackReturn( &ret, sizeof(ret), STATUS_SUCCESS ); } -static BOOL WINAPI call_vulkan_debug_utils_callback( struct wine_vk_debug_utils_params *params, ULONG size ) +static NTSTATUS WINAPI call_vulkan_debug_utils_callback( void *args, ULONG size ) { - return params->user_callback(params->severity, params->message_types, ¶ms->data, params->user_data); + struct wine_vk_debug_utils_params *params = args; + VkBool32 ret = params->user_callback(params->severity, params->message_types, ¶ms->data, params->user_data); + return NtCallbackReturn( &ret, sizeof(ret), STATUS_SUCCESS ); } BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 885af7ae970..e4e437327f3 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -169,7 +169,6 @@ static VkBool32 debug_utils_callback_conversion(VkDebugUtilsMessageSeverityFlagB struct wine_debug_utils_messenger *object; void *ret_ptr; ULONG ret_len; - VkBool32 result; unsigned int i; TRACE("%i, %u, %p, %p\n", severity, message_types, callback_data, user_data); @@ -217,12 +216,11 @@ static VkBool32 debug_utils_callback_conversion(VkDebugUtilsMessageSeverityFlagB params.data.pObjects = object_name_infos; /* applications should always return VK_FALSE */ - result = KeUserModeCallback( NtUserCallVulkanDebugUtilsCallback, ¶ms, sizeof(params), - &ret_ptr, &ret_len ); + KeUserModeCallback( NtUserCallVulkanDebugUtilsCallback, ¶ms, sizeof(params), &ret_ptr, &ret_len ); free(object_name_infos); - - return result; + if (ret_len == sizeof(VkBool32)) return *(VkBool32 *)ret_ptr; + return VK_FALSE; } static VkBool32 debug_report_callback_conversion(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT object_type, @@ -258,8 +256,9 @@ static VkBool32 debug_report_callback_conversion(VkDebugReportFlagsEXT flags, Vk if (!params.object_handle) params.object_type = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT; - return KeUserModeCallback( NtUserCallVulkanDebugReportCallback, ¶ms, sizeof(params), - &ret_ptr, &ret_len ); + KeUserModeCallback( NtUserCallVulkanDebugReportCallback, ¶ms, sizeof(params), &ret_ptr, &ret_len ); + if (ret_len == sizeof(VkBool32)) return *(VkBool32 *)ret_ptr; + return VK_FALSE; } static void wine_vk_physical_device_free(struct wine_phys_dev *phys_dev) From ae2f9792e462559be77532406c6eecd242dbb4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 25 Nov 2023 01:44:49 +0100 Subject: [PATCH 1495/1506] winevulkan: Keep the create_info HWND on the surface wrappers. (cherry picked from commit 982c2ede7a8e1bda5f10d5a662448948b04efbb8) --- dlls/winevulkan/vulkan.c | 16 ++++++---------- dlls/winevulkan/vulkan_private.h | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index e4e437327f3..818f8e8655c 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -2566,24 +2566,20 @@ VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCrea return res; } -VkResult wine_vkCreateWin32SurfaceKHR(VkInstance handle, const VkWin32SurfaceCreateInfoKHR *createInfo, +VkResult wine_vkCreateWin32SurfaceKHR(VkInstance handle, const VkWin32SurfaceCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) { struct wine_instance *instance = wine_instance_from_handle(handle); struct wine_surface *object; VkResult res; - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); - - object = calloc(1, sizeof(*object)); - - if (!object) - return VK_ERROR_OUT_OF_HOST_MEMORY; + if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); - res = instance->funcs.p_vkCreateWin32SurfaceKHR(instance->host_instance, createInfo, NULL, - &object->driver_surface); + if (!(object = calloc(1, sizeof(*object)))) return VK_ERROR_OUT_OF_HOST_MEMORY; + object->hwnd = create_info->hwnd; + res = instance->funcs.p_vkCreateWin32SurfaceKHR(instance->host_instance, create_info, + NULL /* allocator */, &object->driver_surface); if (res != VK_SUCCESS) { free(object); diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index ffae94adbe4..800036d2c2d 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -324,7 +324,8 @@ static inline VkDebugReportCallbackEXT wine_debug_report_callback_to_handle( struct wine_surface { VkSurfaceKHR host_surface; - VkSurfaceKHR driver_surface; /* wine driver surface */ + VkSurfaceKHR driver_surface; + HWND hwnd; struct wine_vk_mapping mapping; }; From 6df0775d2b15ab555de9fc7354a581412854526b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 21 Feb 2024 14:28:49 +0100 Subject: [PATCH 1496/1506] winevulkan: Rename wine_device_memory mapping to vm_map. To avoid conflict with handle mapping macros. (cherry picked from commit 84e462070658464576e73c8a836ccab8fb296734) --- dlls/winevulkan/vulkan.c | 12 ++++++------ dlls/winevulkan/vulkan_private.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 818f8e8655c..073ae5faf51 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -3291,7 +3291,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo return result; } - memory->mapping = mapping; + memory->vm_map = mapping; *ret = wine_device_memory_to_handle(memory); return VK_SUCCESS; } @@ -3308,10 +3308,10 @@ void wine_vkFreeMemory(VkDevice handle, VkDeviceMemory memory_handle, const VkAl destroy_keyed_mutex(device, memory); device->funcs.p_vkFreeMemory(device->host_device, memory->host_memory, NULL); - if (memory->mapping) + if (memory->vm_map) { SIZE_T alloc_size = 0; - NtFreeVirtualMemory(GetCurrentProcess(), &memory->mapping, &alloc_size, MEM_RELEASE); + NtFreeVirtualMemory(GetCurrentProcess(), &memory->vm_map, &alloc_size, MEM_RELEASE); } if (memory->handle != INVALID_HANDLE_VALUE) @@ -3343,9 +3343,9 @@ VkResult wine_vkMapMemory2KHR(VkDevice handle, const VkMemoryMapInfoKHR *map_inf VkResult result; info.memory = memory->host_memory; - if (memory->mapping) + if (memory->vm_map) { - *data = (char *)memory->mapping + info.offset; + *data = (char *)memory->vm_map + info.offset; TRACE("returning %p\n", *data); return VK_SUCCESS; } @@ -3391,7 +3391,7 @@ VkResult wine_vkUnmapMemory2KHR(VkDevice handle, const VkMemoryUnmapInfoKHR *unm struct wine_device_memory *memory = wine_device_memory_from_handle(unmap_info->memory); VkMemoryUnmapInfoKHR info; - if (memory->mapping) + if (memory->vm_map) return VK_SUCCESS; if (!device->funcs.p_vkUnmapMemory2KHR) diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 800036d2c2d..fe579ee7d9a 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -269,7 +269,7 @@ struct wine_device_memory BOOL inherit; DWORD access; HANDLE handle; - void *mapping; + void *vm_map; struct keyed_mutex_shm *keyed_mutex_shm; VkSemaphore keyed_mutex_sem; uint64_t keyed_mutex_instance_id; From 25613b465686357b599a25a2409beef9fb34c941 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 21 Feb 2024 14:48:13 +0100 Subject: [PATCH 1497/1506] winevulkan: Use handle map for memory objects. (cherry picked from commit 64914849ac42cebd6d6f6b88ae8b16d22e493184) --- dlls/winevulkan/vulkan.c | 2 ++ dlls/winevulkan/vulkan_private.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 073ae5faf51..16f1b30c7c6 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -3291,6 +3291,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo return result; } + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, memory, memory->host_memory, memory); memory->vm_map = mapping; *ret = wine_device_memory_to_handle(memory); return VK_SUCCESS; @@ -3306,6 +3307,7 @@ void wine_vkFreeMemory(VkDevice handle, VkDeviceMemory memory_handle, const VkAl memory = wine_device_memory_from_handle(memory_handle); destroy_keyed_mutex(device, memory); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, memory); device->funcs.p_vkFreeMemory(device->host_device, memory->host_memory, NULL); if (memory->vm_map) diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index fe579ee7d9a..ecd148ea48a 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -273,6 +273,8 @@ struct wine_device_memory struct keyed_mutex_shm *keyed_mutex_shm; VkSemaphore keyed_mutex_sem; uint64_t keyed_mutex_instance_id; + + struct wine_vk_mapping mapping; }; static inline VkDeviceMemory wine_device_memory_to_handle(struct wine_device_memory *device_memory) From 878376338c5471d33a9d56e2ed4c674aac380cb0 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Wed, 10 Apr 2024 01:19:25 +0300 Subject: [PATCH 1498/1506] winevulkan: Remove handle mapping after host destory is called. For VK_EXT_debug_utils callbacks on destroy / free. --- dlls/winevulkan/vulkan.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 16f1b30c7c6..aeb4c425df8 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -684,8 +684,8 @@ static void wine_vk_device_free(struct wine_device *device) if (device->host_device && device->funcs.p_vkDestroyDevice) { - WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, device); device->funcs.p_vkDestroyDevice(device->host_device, NULL /* pAllocator */); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, device); } free(device); @@ -1419,9 +1419,8 @@ void wine_vkDestroyCommandPool(VkDevice device_handle, VkCommandPool handle, if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); - WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, pool); - device->funcs.p_vkDestroyCommandPool(device->host_device, pool->host_command_pool, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, pool); free(pool); } @@ -3307,8 +3306,8 @@ void wine_vkFreeMemory(VkDevice handle, VkDeviceMemory memory_handle, const VkAl memory = wine_device_memory_from_handle(memory_handle); destroy_keyed_mutex(device, memory); - WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, memory); device->funcs.p_vkFreeMemory(device->host_device, memory->host_memory, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, memory); if (memory->vm_map) { @@ -3671,9 +3670,9 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR handle, c free(swapchain->fs_hack_images); } - WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, swapchain); device->funcs.p_vkDestroySwapchainKHR(device->host_device, swapchain->host_swapchain, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, swapchain); free(swapchain); } @@ -4813,8 +4812,8 @@ void wine_vkDestroySemaphore(VkDevice device_handle, VkSemaphore semaphore_handl if (semaphore->d3d12_fence_shm) NtUnmapViewOfSection(GetCurrentProcess(), semaphore->d3d12_fence_shm); - WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, semaphore); device->funcs.p_vkDestroySemaphore(device->host_device, semaphore->semaphore, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, semaphore); if (semaphore->fence_timeline_semaphore) device->funcs.p_vkDestroySemaphore(device->host_device, semaphore->fence_timeline_semaphore, NULL); From 7885c8964957ccbf5ac07220fd5c437ad5d3eb0c Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Tue, 26 Mar 2024 11:01:56 +0800 Subject: [PATCH 1499/1506] fshack: winex11.drv: Introduce fs_hack_is_window_rect_fullscreen(). Introduce fs_hack_is_window_rect_fullscreen() and it replaces fs_hack_matches_current_mode() for determining whether fshack should be enabled for a window. The difference is that the new function considers a window with a rectangle larger than the monitor rectangle also fullscreen. This is actually closer to the behavior of NtUserIsWindowRectFullScreen(). Ideally, we should enable fshack for all windows and scale them all when a ChangeDisplaySetting() call is made to change resolutions. But that would be a bigger change and has higher overhead so let's not do that unless necessary. Another reason for this change is to avoid a black screen issue on Nvidia drivers. For example, on Arch Linux with Nvidia driver 550. Call of Juarez (21980) changes the resolution to 1024x768 then changes the game window to (-3, -22, 1030, 793). Because the new window rectangle doesn't match the fake monitor resolution, fshack is disabled for the window and its client window gets resized to the unscaled one. However, the fshack monitor still has the fake 1024x768 so Vulkan swapchains need to draw to a surface with the physical resolution. Because the unscaled client window is smaller than the physical resolution, vkAcquireNextImageKHR() always returns VK_ERROR_OUT_OF_DATE_KHR on Nvidia drivers. Of course, because Nvidia drivers are proprietary so I can't confirm this is the exact cause. CW-Bug-Id: #23466 --- dlls/winex11.drv/fs.c | 14 +++++++------- dlls/winex11.drv/window.c | 12 +++++------- dlls/winex11.drv/x11drv.h | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/dlls/winex11.drv/fs.c b/dlls/winex11.drv/fs.c index bda79419c69..73824021060 100644 --- a/dlls/winex11.drv/fs.c +++ b/dlls/winex11.drv/fs.c @@ -720,21 +720,21 @@ RECT fs_hack_real_mode( HMONITOR monitor ) return rect; } -/* Return whether width and height are the same as the current mode used by a monitor */ -BOOL fs_hack_matches_current_mode( HMONITOR monitor, INT width, INT height ) +/* Return whether a window rectangle is fullscreen on a fshack monitor */ +BOOL fs_hack_is_window_rect_fullscreen( HMONITOR monitor, const RECT *rect ) { MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; - BOOL matched; + BOOL fullscreen; TRACE( "monitor %p\n", monitor ); if (!NtUserGetMonitorInfo( monitor, &info )) return FALSE; - matched = (width == info.rcMonitor.right - info.rcMonitor.left) && - (height == info.rcMonitor.bottom - info.rcMonitor.top); - TRACE( "matched: %s\n", matched ? "TRUE" : "FALSE" ); + fullscreen = rect->left <= info.rcMonitor.left && rect->right >= info.rcMonitor.right && + rect->top <= info.rcMonitor.top && rect->bottom >= info.rcMonitor.bottom; + TRACE( "fullscreen: %s\n", fullscreen ? "TRUE" : "FALSE" ); - return matched; + return fullscreen; } /* Transform a point in user virtual screen coordinates to real virtual screen coordinates */ diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 29773e871b0..3f64774d2cb 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3135,9 +3135,9 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, if (!data && !(data = X11DRV_create_win_data( hwnd, window_rect, client_rect ))) return TRUE; + monitor = fs_hack_monitor_from_rect( window_rect ); - if (fs_hack_enabled( monitor ) && fs_hack_matches_current_mode( monitor, window_rect->right - window_rect->left, - window_rect->bottom - window_rect->top )) + if (fs_hack_enabled( monitor ) && fs_hack_is_window_rect_fullscreen( monitor, window_rect )) window_update_fshack( data, window_rect, client_rect, monitor, TRUE ); else window_update_fshack( data, window_rect, client_rect, monitor, FALSE ); @@ -3500,7 +3500,7 @@ UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) monitor = fs_hack_monitor_from_rect( rect ); if (data->fs_hack || (fs_hack_enabled( monitor ) && - fs_hack_matches_current_mode( monitor, rect->right - rect->left, rect->bottom - rect->top ))) + fs_hack_is_window_rect_fullscreen( monitor, rect ))) { MONITORINFO info = {.cbSize = sizeof(MONITORINFO)}; NtUserGetMonitorInfo( monitor, &info ); @@ -3757,8 +3757,7 @@ static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old HMONITOR monitor = fs_hack_monitor_from_hwnd( data->hwnd ); if (fs_hack_mapping_required( monitor ) && - fs_hack_matches_current_mode( monitor, data->whole_rect.right - data->whole_rect.left, - data->whole_rect.bottom - data->whole_rect.top )) + fs_hack_is_window_rect_fullscreen( monitor, &data->whole_rect )) { window_update_fshack( data, NULL, NULL, monitor, TRUE ); return; @@ -3783,8 +3782,7 @@ static void handle_window_desktop_resize( struct x11drv_win_data *data, UINT old } if (!fs_hack_mapping_required( monitor ) || - !fs_hack_matches_current_mode( monitor, data->whole_rect.right - data->whole_rect.left, - data->whole_rect.bottom - data->whole_rect.top )) + !fs_hack_is_window_rect_fullscreen( monitor, &data->whole_rect )) window_update_fshack( data, NULL, NULL, monitor, FALSE ); } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index d60432a68e8..da610e060a6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -710,7 +710,7 @@ extern BOOL fs_hack_mapping_required( HMONITOR monitor ); extern BOOL fs_hack_is_integer(void); extern HMONITOR fs_hack_monitor_from_hwnd( HWND hwnd ); extern HMONITOR fs_hack_monitor_from_rect( const RECT *rect ); -extern BOOL fs_hack_matches_current_mode( HMONITOR monitor, INT width, INT height ); +extern BOOL fs_hack_is_window_rect_fullscreen( HMONITOR monitor, const RECT *rect ); extern RECT fs_hack_current_mode( HMONITOR monitor ); extern RECT fs_hack_real_mode( HMONITOR monitor ); extern void fs_hack_point_user_to_real( POINT *pos ); From 7e89d722a4466c3ab95b724b69800e0fec7b48d6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 10 Apr 2024 20:25:06 -0600 Subject: [PATCH 1500/1506] win32u: Store desktop flags in shared memory and use that in is_virtual_desktop(). CW-Bug-Id: #23665 --- dlls/win32u/winstation.c | 15 ++++++++++----- server/protocol.def | 1 + server/winstation.c | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 2887e104c4a..fbede26d8a8 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -42,12 +42,17 @@ WINE_DECLARE_DEBUG_CHANNEL(win); BOOL is_virtual_desktop(void) { - HANDLE desktop = NtUserGetThreadDesktop( GetCurrentThreadId() ); - USEROBJECTFLAGS flags = {0}; - DWORD len; + const desktop_shm_t *desktop = get_desktop_shared_memory(); + unsigned int flags; + + if (!desktop) return FALSE; + SHARED_READ_BEGIN( desktop, desktop_shm_t ) + { + flags = desktop->flags; + } + SHARED_READ_END - if (!NtUserGetObjectInformation( desktop, UOI_FLAGS, &flags, sizeof(flags), &len )) return FALSE; - return !!(flags.dwFlags & DF_WINE_CREATE_DESKTOP); + return !!(flags & DF_WINE_CREATE_DESKTOP); } /*********************************************************************** diff --git a/server/protocol.def b/server/protocol.def index 99396170aef..aef47aa3a7b 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -928,6 +928,7 @@ struct desktop_shared_memory unsigned char keystate[256]; /* asynchronous key state */ thread_id_t foreground_tid; /* tid of the foreground thread */ __int64 update_serial; + unsigned int flags; }; typedef volatile struct desktop_shared_memory desktop_shm_t; diff --git a/server/winstation.c b/server/winstation.c index 0cf17d00759..534078a5813 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -136,6 +136,27 @@ static const struct object_ops desktop_ops = desktop_destroy /* destroy */ }; +#if defined(__i386__) || defined(__x86_64__) +#define __SHARED_INCREMENT_SEQ( x ) ++(x) +#else +#define __SHARED_INCREMENT_SEQ( x ) __atomic_add_fetch( &(x), 1, __ATOMIC_RELEASE ) +#endif + +#define SHARED_WRITE_BEGIN( object, type ) \ + do { \ + const type *__shared = (object)->shared; \ + type *shared = (type *)__shared; \ + unsigned int __seq = __SHARED_INCREMENT_SEQ( shared->seq ); \ + assert( (__seq & 1) != 0 ); \ + do + +#define SHARED_WRITE_END \ + while(0); \ + __seq = __SHARED_INCREMENT_SEQ( shared->seq ) - __seq; \ + assert( __seq == 1 ); \ + } while(0); + + /* create a winstation object */ static struct winstation *create_winstation( struct object *root, const struct unicode_str *name, unsigned int attr, unsigned int flags ) @@ -276,6 +297,11 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned desktop->flags |= (flags & DF_WINE_CREATE_DESKTOP); clear_error(); } + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + shared->flags = desktop->flags; + } + SHARED_WRITE_END } return desktop; } @@ -707,7 +733,15 @@ DECL_HANDLER(set_user_object_info) struct desktop *desktop = (struct desktop *)obj; reply->is_desktop = 1; reply->old_obj_flags = desktop->flags; - if (req->flags & SET_USER_OBJECT_SET_FLAGS) desktop->flags = req->obj_flags; + if (req->flags & SET_USER_OBJECT_SET_FLAGS) + { + desktop->flags = req->obj_flags; + SHARED_WRITE_BEGIN( desktop, desktop_shm_t ) + { + shared->flags = desktop->flags; + } + SHARED_WRITE_END + } if (req->flags & SET_USER_OBJECT_SET_CLOSE_TIMEOUT) desktop->close_timeout_val = req->close_timeout; } else if (obj->ops == &winstation_ops) From c3d309185319110c61d32f462ccbc1e2163c4b37 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 10 Apr 2024 20:25:45 -0600 Subject: [PATCH 1501/1506] user32: HACK: Avoid triggering displays update in GetDisplayConfigBufferSizes(). To be dropped on next rebase. CW-Bug-Id: #23665 --- dlls/user32/sysparams.c | 7 +++++++ dlls/user32/user32.spec | 2 +- dlls/win32u/sysparams.c | 9 ++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index b941f126a58..e91737cbcc2 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -999,3 +999,10 @@ LONG WINAPI SetDisplayConfig(UINT32 path_info_count, DISPLAYCONFIG_PATH_INFO *pa return ERROR_SUCCESS; } + +LONG WINAPI GetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info, + UINT32 *num_mode_info ) +{ + flags |= 0x40000000; /* HACK: avoid triggering display updates in NtUserGetDisplayConfigBufferSizes(). */ + return NtUserGetDisplayConfigBufferSizes(flags, num_path_info, num_mode_info); +} diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index e8d94f86af6..ffe5af2daa0 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -292,7 +292,7 @@ @ stdcall GetDesktopWindow() @ stdcall GetDialogBaseUnits() @ stdcall GetDisplayAutoRotationPreferences(ptr) -@ stdcall GetDisplayConfigBufferSizes(long ptr ptr) NtUserGetDisplayConfigBufferSizes +@ stdcall GetDisplayConfigBufferSizes(long ptr ptr) @ stdcall GetDlgCtrlID(long) @ stdcall GetDlgItem(long long) @ stdcall GetDlgItemInt(long long ptr long) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index d505bde85f3..ac8ddb42af3 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2427,6 +2427,7 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in volatile struct global_shared_memory *global_shared; struct monitor *monitor; UINT32 count = 0; + BOOL skip_update = FALSE; TRACE( "(0x%x %p %p)\n", flags, num_path_info, num_mode_info ); @@ -2435,6 +2436,12 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in *num_path_info = 0; + if (flags & 0x40000000) + { + flags &= ~0x40000000; + skip_update = TRUE; + } + switch (flags) { case QDC_ALL_PATHS: @@ -2450,7 +2457,7 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in FIXME( "only returning active paths\n" ); /* NtUserGetDisplayConfigBufferSizes() is called by display drivers to trigger display settings update. */ - if ((global_shared = get_global_shared_memory())) + if (!skip_update && (global_shared = get_global_shared_memory())) InterlockedIncrement( (LONG *)&global_shared->display_settings_serial ); if (lock_display_devices()) From 9f43fa590ef7590549c06a4d34f5db63c38585c5 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Thu, 11 Apr 2024 20:02:03 +0300 Subject: [PATCH 1502/1506] winevulkan: Make client's device memory wrapper available to callback converter. With VK_EXT_device_address_binding_report we can get debug_util callbacks used to track memory bindings. Since it's the host's implementation that starts the callback we have to be sure that we have a way of converting it to the client side's variant before it's even added to the handle map - i.e. we don't know the host handle at that time yet. ntuser_thread_info which is thread-local is used. --- dlls/winevulkan/vulkan.c | 27 +++++++++++++++++++++++++++ include/ntuser.h | 1 + 2 files changed, 28 insertions(+) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index aeb4c425df8..c40309ee468 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -49,6 +49,28 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan); +static void set_memory_being_allocated(struct wine_instance *instance, struct wine_device_memory *memory) +{ + struct ntuser_thread_info *thread_info; + if (!instance->enable_wrapper_list) return; + thread_info = NtUserGetThreadInfo(); + thread_info->vulkan_data = (uintptr_t) memory; +} + +static uint64_t get_memory_being_allocated(uint64_t host_handle) +{ + struct ntuser_thread_info *thread_info; + struct wine_device_memory *memory; + + thread_info = NtUserGetThreadInfo(); + if (!thread_info->vulkan_data) return 0; + + memory = (struct wine_device_memory*) (uintptr_t) thread_info->vulkan_data; + memory->host_memory = host_handle; + + return (uintptr_t) memory; +} + static int debug_level; static BOOL is_wow64(void) @@ -200,6 +222,8 @@ static VkBool32 debug_utils_callback_conversion(VkDebugUtilsMessageSeverityFlagB if (wine_vk_is_type_wrapped(callback_data->pObjects[i].objectType)) { object_name_infos[i].objectHandle = wine_vk_get_wrapper(object->instance, callback_data->pObjects[i].objectHandle); + if (!object_name_infos[i].objectHandle && object_name_infos[i].objectType == VK_OBJECT_TYPE_DEVICE_MEMORY) + object_name_infos[i].objectHandle = get_memory_being_allocated(callback_data->pObjects[i].objectHandle); if (!object_name_infos[i].objectHandle) { WARN("handle conversion failed 0x%s\n", wine_dbgstr_longlong(callback_data->pObjects[i].objectHandle)); @@ -3251,7 +3275,10 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo } } + set_memory_being_allocated(device->phys_dev->instance, memory); result = device->funcs.p_vkAllocateMemory(device->host_device, &info, NULL, &memory->host_memory); + set_memory_being_allocated(device->phys_dev->instance, NULL); + if (result == VK_SUCCESS && memory->handle == INVALID_HANDLE_VALUE && export_info && export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) { get_fd_info.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; diff --git a/include/ntuser.h b/include/ntuser.h index 0677f114aea..bf65f214bc2 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -87,6 +87,7 @@ struct ntuser_thread_info UINT default_imc; /* default input context */ UINT64 client_imm; /* client IMM thread info */ UINT64 wmchar_data; /* client data for WM_CHAR mappings */ + UINT64 vulkan_data; /* used by winevulkan for tls */ }; static inline struct ntuser_thread_info *NtUserGetThreadInfo(void) From b11119b3805815969955afeffbc5f1d109390095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 12 Apr 2024 11:16:14 +0200 Subject: [PATCH 1503/1506] HACK: mfplat: Enable new media source by default for more games. CW-Bug-Id: #23618 --- dlls/mfplat/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index facb39ee3d6..3d1fe615a5a 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -6304,6 +6304,7 @@ static HRESULT resolver_create_gstreamer_handler(IMFByteStreamHandler **handler) if (!strcmp(sgi, "399810") /* Call of Cthulhu */) env = "1"; if (!strcmp(sgi, "606880") /* Greedfall */) env = "1"; if (!strcmp(sgi, "692850") /* Bloodstained */) env = "1"; + if (!strcmp(sgi, "934700") /* Dead Island 2 */) env = "1"; } if (env && atoi(env)) return CoCreateInstance(&CLSID_GStreamerByteStreamHandler2, NULL, CLSCTX_INPROC_SERVER, &IID_IMFByteStreamHandler, (void **)handler); From 5316d6828aa7d7616a02213e4aa16880af8946bd Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Fri, 12 Apr 2024 15:20:17 -0600 Subject: [PATCH 1504/1506] ntdll: Implement NtQuerySystemInformation( SystemProcessIdInformation ). CW-Bug-Id: #23669 --- dlls/ntdll/tests/info.c | 129 +++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/system.c | 37 +++++++++++ dlls/wow64/struct32.h | 6 ++ dlls/wow64/system.c | 18 ++++++ include/winternl.h | 6 ++ server/process.c | 5 +- server/protocol.def | 1 + 7 files changed, 201 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 4118aae5e91..c574285abe8 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -21,6 +21,7 @@ #include "ntdll_test.h" #include #include +#include static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); static NTSTATUS (WINAPI * pNtSetSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG); @@ -3758,6 +3759,133 @@ static void test_system_debug_control(void) } } +static void test_process_id(void) +{ + char image_name_buffer[1024 * sizeof(WCHAR)]; + UNICODE_STRING *image_name = (UNICODE_STRING *)image_name_buffer; + SYSTEM_PROCESS_ID_INFORMATION info; + unsigned int i, length; + DWORD pids[2048]; + WCHAR name[2048]; + NTSTATUS status; + HANDLE process; + ULONG len; + BOOL bret; + + status = NtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, image_name, + sizeof(image_name_buffer), NULL ); + ok( !status, "got %#lx.\n", status ); + length = image_name->Length; + image_name->Buffer[length] = 0; + + len = 0xdeadbeef; + status = pNtQuerySystemInformation( SystemProcessIdInformation, NULL, 0, &len ); + ok( status == STATUS_INFO_LENGTH_MISMATCH || (is_wow64 && status == STATUS_ACCESS_VIOLATION), "got %#lx.\n", status ); + ok( len == sizeof(info) || (is_wow64 && len == 0xdeadbeef), "got %#lx.\n", len ); + + info.ProcessId = (void *)0xdeadbeef; + info.ImageName.Length = info.ImageName.MaximumLength = 0; + info.ImageName.Buffer = NULL; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( status == STATUS_INVALID_CID, "got %#lx.\n", status ); + ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length ); + ok( !info.ImageName.MaximumLength, "got %#x.\n", info.ImageName.MaximumLength ); + + info.ProcessId = (void *)(ULONG_PTR)GetCurrentProcessId(); + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx.\n", status ); + ok( len == sizeof(info), "got %#lx.\n", len ); + ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length ); + ok( info.ImageName.MaximumLength == length + 2 || (is_wow64 && !info.ImageName.MaximumLength), + "got %#x.\n", info.ImageName.MaximumLength ); + + info.ImageName.MaximumLength = sizeof(name); + len = 0xdeadbeef; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( status == STATUS_ACCESS_VIOLATION, "got %#lx.\n", status ); + ok( len == sizeof(info), "got %#lx.\n", len ); + ok( info.ImageName.Length == length || (is_wow64 && !info.ImageName.Length), + "got %u.\n", info.ImageName.Length ); + ok( info.ImageName.MaximumLength == length + 2 || (is_wow64 && !info.ImageName.Length), + "got %#x.\n", info.ImageName.MaximumLength ); + + info.ProcessId = (void *)0xdeadbeef; + info.ImageName.MaximumLength = sizeof(name); + info.ImageName.Buffer = name; + info.ImageName.Length = 0; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( status == STATUS_INVALID_CID, "got %#lx.\n", status ); + ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length ); + ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength ); + ok( info.ImageName.Buffer == name, "got %p, %p.\n", info.ImageName.Buffer, name ); + + info.ProcessId = NULL; + info.ImageName.MaximumLength = sizeof(name); + info.ImageName.Buffer = name; + info.ImageName.Length = 0; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( status == STATUS_INVALID_CID, "got %#lx.\n", status ); + ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length ); + ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength ); + ok( info.ImageName.Buffer == name, "got non NULL.\n" ); + + info.ProcessId = NULL; + info.ImageName.MaximumLength = sizeof(name); + info.ImageName.Buffer = name; + info.ImageName.Length = 4; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status ); + ok( info.ImageName.Length == 4, "got %#x.\n", info.ImageName.Length ); + ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength ); + ok( info.ImageName.Buffer == name, "got non NULL.\n" ); + + info.ProcessId = (void *)(ULONG_PTR)GetCurrentProcessId(); + info.ImageName.MaximumLength = sizeof(name); + info.ImageName.Buffer = name; + info.ImageName.Length = 4; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), NULL ); + ok( status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status ); + ok( info.ImageName.Length == 4, "got %#x.\n", info.ImageName.Length ); + ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength ); + + info.ImageName.Length = 0; + memset( name, 0xcc, sizeof(name) ); + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( !status, "got %#lx.\n", status ); + ok( info.ImageName.Length == length, "got %#x.\n", info.ImageName.Length ); + ok( len == sizeof(info), "got %#lx.\n", len ); + ok( info.ImageName.MaximumLength == info.ImageName.Length + 2, "got %#x.\n", info.ImageName.MaximumLength ); + ok( !name[info.ImageName.Length / 2], "got %#x.\n", name[info.ImageName.Length / 2] ); + + ok( info.ImageName.Length == image_name->Length, "got %#x, %#x.\n", info.ImageName.Length, image_name->Length ); + ok( !wcscmp( name, image_name->Buffer ), "got %s, %s.\n", debugstr_w(name), debugstr_w(image_name->Buffer) ); + + bret = EnumProcesses( pids, sizeof(pids), &len ); + ok( bret, "got error %lu.\n", GetLastError() ); + for (i = 0; i < len / sizeof(*pids); ++i) + { + process = OpenProcess( PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pids[i] ); + if (pids[i] && !process && GetLastError() != ERROR_ACCESS_DENIED) + { + /* process is gone already. */ + continue; + } + info.ProcessId = (void *)(ULONG_PTR)pids[i]; + info.ImageName.Length = 0; + info.ImageName.MaximumLength = sizeof(name); + info.ImageName.Buffer = name; + status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len ); + ok( info.ImageName.Buffer == name || (!info.ImageName.MaximumLength && !info.ImageName.Length), + "got %p, %p, pid %lu, lengh %u / %u.\n", info.ImageName.Buffer, name, pids[i], + info.ImageName.Length, info.ImageName.MaximumLength ); + if (pids[i]) + ok( !status, "got %#lx, pid %lu.\n", status, pids[i] ); + else + ok( status == STATUS_INVALID_CID, "got %#lx, pid %lu.\n", status, pids[i] ); + if (process) CloseHandle( process ); + } +} + START_TEST(info) { char **argv; @@ -3834,4 +3962,5 @@ START_TEST(info) test_ThreadEnableAlignmentFaultFixup(); test_process_instrumentation_callback(); test_system_debug_control(); + test_process_id(); } diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 2a3f107e26b..0e77e7d7b14 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -3499,6 +3499,43 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, break; } + case SystemProcessIdInformation: /* 88 */ + { + SYSTEM_PROCESS_ID_INFORMATION *id = info; + UNICODE_STRING *str = &id->ImageName; + BOOL valid_buffer; + + len = sizeof(*id); + if (len > size) ret = STATUS_INFO_LENGTH_MISMATCH; + else if (id->ImageName.Length) ret = STATUS_INVALID_PARAMETER; + else if (!id->ProcessId) ret = STATUS_INVALID_CID; + + if (ret) break; + + valid_buffer = virtual_check_buffer_for_write( str->Buffer, str->MaximumLength ); + SERVER_START_REQ( get_process_image_name ) + { + req->pid = HandleToULong( id->ProcessId ); + if (valid_buffer) wine_server_set_reply( req, str->Buffer, str->MaximumLength ); + ret = wine_server_call( req ); + if (ret == STATUS_BUFFER_TOO_SMALL) ret = STATUS_INFO_LENGTH_MISMATCH; + if (ret == STATUS_SUCCESS && reply->len + 2 > str->MaximumLength) ret = STATUS_INFO_LENGTH_MISMATCH; + if (ret == STATUS_SUCCESS || ret == STATUS_INFO_LENGTH_MISMATCH) str->MaximumLength = reply->len + 2; + if (!ret && valid_buffer) + { + str->Length = reply->len; + str->Buffer[reply->len / 2] = 0; + } + else if (!valid_buffer && (!ret || ret == STATUS_INFO_LENGTH_MISMATCH)) + { + str->Length = reply->len; + ret = STATUS_ACCESS_VIOLATION; + } + } + SERVER_END_REQ; + break; + } + case SystemDynamicTimeZoneInformation: /* 102 */ { RTL_DYNAMIC_TIME_ZONE_INFORMATION tz; diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index 482f1297b28..daa89b84dfc 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -524,6 +524,12 @@ typedef struct ULONG Flags; } SYSTEM_CACHE_INFORMATION32; +typedef struct +{ + ULONG ProcessId; + UNICODE_STRING32 ImageName; +} SYSTEM_PROCESS_ID_INFORMATION32; + typedef struct { ULONG OwnerPid; diff --git a/dlls/wow64/system.c b/dlls/wow64/system.c index 51c568fedda..c3012dc2492 100644 --- a/dlls/wow64/system.c +++ b/dlls/wow64/system.c @@ -406,6 +406,24 @@ NTSTATUS WINAPI wow64_NtQuerySystemInformation( UINT *args ) } return status; + case SystemProcessIdInformation: + { + SYSTEM_PROCESS_ID_INFORMATION32 *info32 = ptr; + SYSTEM_PROCESS_ID_INFORMATION info; + + if (retlen) *retlen = sizeof(*info32); + if (len < sizeof(*info32)) return STATUS_INFO_LENGTH_MISMATCH; + + info.ProcessId = ULongToHandle( info32->ProcessId ); + unicode_str_32to64( &info.ImageName, &info32->ImageName ); + if (!(status = NtQuerySystemInformation( class, &info, sizeof(info), NULL ))) + { + info32->ImageName.MaximumLength = info.ImageName.MaximumLength; + info32->ImageName.Length = info.ImageName.Length; + } + return status; + } + case SystemHandleInformation: /* SYSTEM_HANDLE_INFORMATION */ if (len >= sizeof(SYSTEM_HANDLE_INFORMATION32)) { diff --git a/include/winternl.h b/include/winternl.h index fb07df24eb3..d151719f898 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2991,6 +2991,12 @@ typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION UCHAR TableBuffer[1]; } SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION; +typedef struct _SYSTEM_PROCESS_ID_INFORMATION +{ + void *ProcessId; + UNICODE_STRING ImageName; +} SYSTEM_PROCESS_ID_INFORMATION, *PSYSTEM_PROCESS_ID_INFORMATION; + typedef struct _TIME_FIELDS { CSHORT Year; CSHORT Month; diff --git a/server/process.c b/server/process.c index 20d959b661f..050950bc206 100644 --- a/server/process.c +++ b/server/process.c @@ -1586,7 +1586,10 @@ DECL_HANDLER(get_process_debug_info) /* fetch the name of the process image */ DECL_HANDLER(get_process_image_name) { - struct process *process = get_process_from_handle( req->handle, PROCESS_QUERY_LIMITED_INFORMATION ); + struct process *process; + + if (req->pid) process = get_process_from_id( req->pid ); + else process = get_process_from_handle( req->handle, PROCESS_QUERY_LIMITED_INFORMATION ); if (!process) return; if (process->image) diff --git a/server/protocol.def b/server/protocol.def index aef47aa3a7b..4ec9b5a5f43 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1113,6 +1113,7 @@ typedef volatile struct input_shared_memory input_shm_t; /* Fetch the name of the process image */ @REQ(get_process_image_name) obj_handle_t handle; /* process handle */ + process_id_t pid; /* process id */ int win32; /* return a win32 filename? */ @REPLY data_size_t len; /* len in bytes required to store filename */ From 518fc943216f201aafe7b983b34b060c7a4c991e Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 15 Apr 2024 12:25:00 +0300 Subject: [PATCH 1505/1506] win32u: Update Nvidia's DriverVersion to match 552.12. --- dlls/win32u/sysparams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index ac8ddb42af3..2e6e0915091 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1406,7 +1406,7 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) break; /* Nvidia */ case 0x10de: - sprintf( buffer, "31.0.15.3625" ); + sprintf( buffer, "31.0.15.5212" ); break; /* Default value for any other vendor. */ default: From 425527769e3f6576a187e880bc290ffb29aea087 Mon Sep 17 00:00:00 2001 From: peterjc123 Date: Tue, 16 Apr 2024 15:37:25 +0000 Subject: [PATCH 1506/1506] wg_parser: Add missing argument flags for wow64_wg_source_create --- dlls/winegstreamer/wg_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index 2d00f4247e0..64c88740640 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -2400,6 +2400,7 @@ NTSTATUS wow64_wg_source_create(void *args) struct { PTR32 url; + UINT64 file_size; PTR32 data; UINT32 size; char mime_type[256]; @@ -2408,6 +2409,7 @@ NTSTATUS wow64_wg_source_create(void *args) struct wg_source_create_params params = { .url = ULongToPtr(params32->url), + .file_size = params32->file_size, .data = ULongToPtr(params32->data), .size = params32->size, };